@desivocal/agents-cdn 1.0.20-alpha.2 → 1.0.20-alpha.4
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/dv-agent.es.js +10 -9
- package/dist/dv-agent.umd.js +23 -23
- package/package.json +1 -1
package/dist/dv-agent.umd.js
CHANGED
|
@@ -124,8 +124,8 @@ Check the render method of \``+i+"`.":""}var Eu=["value","defaultValue"];functio
|
|
|
124
124
|
* @return {boolean} True if the event is supported.
|
|
125
125
|
* @internal
|
|
126
126
|
* @license Modernizr 3.0.0pre (Custom Build) | MIT
|
|
127
|
-
*/function hh(i){if(!_r)return!1;var o="on"+i,f=o in document;if(!f){var m=document.createElement("div");m.setAttribute(o,"return;"),f=typeof m[o]=="function"}return f}function eE(){tn("onChange",["change","click","focusin","focusout","input","keydown","keyup","selectionchange"])}function ph(i,o,f,m){$v(m);var y=GC(o,"onChange");if(y.length>0){var C=new Ga("onChange","change",null,f,m);i.push({event:C,listeners:y})}}var u=null,d=null;function g(i){var o=i.nodeName&&i.nodeName.toLowerCase();return o==="select"||o==="input"&&i.type==="file"}function S(i){var o=[];ph(o,d,i,Ip(i)),nC(x,o)}function x(i){SU(i,0)}function _(i){var o=Hm(i);if(El(o))return i}function L(i,o){if(i==="change")return o}var q=!1;_r&&(q=hh("input")&&(!document.documentMode||document.documentMode>9));function te(i,o){u=i,d=o,u.attachEvent("onpropertychange",Fe)}function ye(){u&&(u.detachEvent("onpropertychange",Fe),u=null,d=null)}function Fe(i){i.propertyName==="value"&&_(d)&&S(i)}function $e(i,o,f){i==="focusin"?(ye(),te(o,f)):i==="focusout"&&ye()}function Ue(i,o){if(i==="selectionchange"||i==="keyup"||i==="keydown")return _(d)}function mt(i){var o=i.nodeName;return o&&o.toLowerCase()==="input"&&(i.type==="checkbox"||i.type==="radio")}function wt(i,o){if(i==="click")return _(o)}function Et(i,o){if(i==="input"||i==="change")return _(o)}function Zr(i){var o=i._wrapperState;!o||!o.controlled||i.type!=="number"||Tt(i,"number",i.value)}function ue(i,o,f,m,y,C,w){var P=f?Hm(f):window,D,F;if(g(P)?D=L:HC(P)?q?D=Et:(D=Ue,F=$e):mt(P)&&(D=wt),D){var B=D(o,f);if(B){ph(i,B,m,y);return}}F&&F(o,P,f),o==="focusout"&&Zr(P)}function ie(){qn("onMouseEnter",["mouseout","mouseover"]),qn("onMouseLeave",["mouseout","mouseover"]),qn("onPointerEnter",["pointerout","pointerover"]),qn("onPointerLeave",["pointerout","pointerover"])}function he(i,o,f,m,y,C,w){var P=o==="mouseover"||o==="pointerover",D=o==="mouseout"||o==="pointerout";if(P&&!j_(m)){var F=m.relatedTarget||m.fromElement;if(F&&(vh(F)||Gy(F)))return}if(!(!D&&!P)){var B;if(y.window===y)B=y;else{var ae=y.ownerDocument;ae?B=ae.defaultView||ae.parentWindow:B=window}var re,ge;if(D){var be=m.relatedTarget||m.toElement;if(re=f,ge=be?vh(be):null,ge!==null){var we=aa(ge);(ge!==we||ge.tag!==E&&ge.tag!==R)&&(ge=null)}}else re=null,ge=f;if(re!==ge){var st=Em,Vt="onMouseLeave",Pt="onMouseEnter",Ln="mouse";(o==="pointerout"||o==="pointerover")&&(st=Ry,Vt="onPointerLeave",Pt="onPointerEnter",Ln="pointer");var wn=re==null?B:Hm(re),ce=ge==null?B:Hm(ge),_e=new st(Vt,Ln+"leave",re,m,y);_e.target=wn,_e.relatedTarget=ce;var de=null,qe=vh(y);if(qe===f){var yt=new st(Pt,Ln+"enter",ge,m,y);yt.target=ce,yt.relatedTarget=wn,de=yt}sne(i,_e,de,re,ge)}}}function Ke(i,o){return i===o&&(i!==0||1/i===1/o)||i!==i&&o!==o}var dt=typeof Object.is=="function"?Object.is:Ke;function Ut(i,o){if(dt(i,o))return!0;if(typeof i!="object"||i===null||typeof o!="object"||o===null)return!1;var f=Object.keys(i),m=Object.keys(o);if(f.length!==m.length)return!1;for(var y=0;y<f.length;y++){var C=f[y];if(!vr.call(o,C)||!dt(i[C],o[C]))return!1}return!0}function zt(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function Qt(i){for(;i;){if(i.nextSibling)return i.nextSibling;i=i.parentNode}}function pi(i,o){for(var f=zt(i),m=0,y=0;f;){if(f.nodeType===Hs){if(y=m+f.textContent.length,m<=o&&y>=o)return{node:f,offset:o-m};m=y}f=zt(Qt(f))}}function zn(i){var o=i.ownerDocument,f=o&&o.defaultView||window,m=f.getSelection&&f.getSelection();if(!m||m.rangeCount===0)return null;var y=m.anchorNode,C=m.anchorOffset,w=m.focusNode,P=m.focusOffset;try{y.nodeType,w.nodeType}catch{return null}return Zl(i,y,C,w,P)}function Zl(i,o,f,m,y){var C=0,w=-1,P=-1,D=0,F=0,B=i,ae=null;e:for(;;){for(var re=null;B===o&&(f===0||B.nodeType===Hs)&&(w=C+f),B===m&&(y===0||B.nodeType===Hs)&&(P=C+y),B.nodeType===Hs&&(C+=B.nodeValue.length),(re=B.firstChild)!==null;)ae=B,B=re;for(;;){if(B===i)break e;if(ae===o&&++D===f&&(w=C),ae===m&&++F===y&&(P=C),(re=B.nextSibling)!==null)break;B=ae,ae=B.parentNode}B=re}return w===-1||P===-1?null:{start:w,end:P}}function tE(i,o){var f=i.ownerDocument||document,m=f&&f.defaultView||window;if(m.getSelection){var y=m.getSelection(),C=i.textContent.length,w=Math.min(o.start,C),P=o.end===void 0?w:Math.min(o.end,C);if(!y.extend&&w>P){var D=P;P=w,w=D}var F=pi(i,w),B=pi(i,P);if(F&&B){if(y.rangeCount===1&&y.anchorNode===F.node&&y.anchorOffset===F.offset&&y.focusNode===B.node&&y.focusOffset===B.offset)return;var ae=f.createRange();ae.setStart(F.node,F.offset),y.removeAllRanges(),w>P?(y.addRange(ae),y.extend(B.node,B.offset)):(ae.setEnd(B.node,B.offset),y.addRange(ae))}}}function lU(i){return i&&i.nodeType===Hs}function uU(i,o){return!i||!o?!1:i===o?!0:lU(i)?!1:lU(o)?uU(i,o.parentNode):"contains"in i?i.contains(o):i.compareDocumentPosition?!!(i.compareDocumentPosition(o)&16):!1}function Hte(i){return i&&i.ownerDocument&&uU(i.ownerDocument.documentElement,i)}function $te(i){try{return typeof i.contentWindow.location.href=="string"}catch{return!1}}function cU(){for(var i=window,o=Vs();o instanceof i.HTMLIFrameElement;){if($te(o))i=o.contentWindow;else return o;o=Vs(i.document)}return o}function nE(i){var o=i&&i.nodeName&&i.nodeName.toLowerCase();return o&&(o==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||o==="textarea"||i.contentEditable==="true")}function qte(){var i=cU();return{focusedElem:i,selectionRange:nE(i)?Gte(i):null}}function Wte(i){var o=cU(),f=i.focusedElem,m=i.selectionRange;if(o!==f&&Hte(f)){m!==null&&nE(f)&&Yte(f,m);for(var y=[],C=f;C=C.parentNode;)C.nodeType===xa&&y.push({element:C,left:C.scrollLeft,top:C.scrollTop});typeof f.focus=="function"&&f.focus();for(var w=0;w<y.length;w++){var P=y[w];P.element.scrollLeft=P.left,P.element.scrollTop=P.top}}}function Gte(i){var o;return"selectionStart"in i?o={start:i.selectionStart,end:i.selectionEnd}:o=zn(i),o||{start:0,end:0}}function Yte(i,o){var f=o.start,m=o.end;m===void 0&&(m=f),"selectionStart"in i?(i.selectionStart=f,i.selectionEnd=Math.min(m,i.value.length)):tE(i,o)}var Kte=_r&&"documentMode"in document&&document.documentMode<=11;function Zte(){tn("onSelect",["focusout","contextmenu","dragend","focusin","keydown","keyup","mousedown","mouseup","selectionchange"])}var Fm=null,rE=null,Ly=null,iE=!1;function Qte(i){if("selectionStart"in i&&nE(i))return{start:i.selectionStart,end:i.selectionEnd};var o=i.ownerDocument&&i.ownerDocument.defaultView||window,f=o.getSelection();return{anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}}function Xte(i){return i.window===i?i.document:i.nodeType===$s?i:i.ownerDocument}function dU(i,o,f){var m=Xte(f);if(!(iE||Fm==null||Fm!==Vs(m))){var y=Qte(Fm);if(!Ly||!Ut(Ly,y)){Ly=y;var C=GC(rE,"onSelect");if(C.length>0){var w=new Ga("onSelect","select",null,o,f);i.push({event:w,listeners:C}),w.target=Fm}}}}function Jte(i,o,f,m,y,C,w){var P=f?Hm(f):window;switch(o){case"focusin":(HC(P)||P.contentEditable==="true")&&(Fm=P,rE=f,Ly=null);break;case"focusout":Fm=null,rE=null,Ly=null;break;case"mousedown":iE=!0;break;case"contextmenu":case"mouseup":case"dragend":iE=!1,dU(i,m,y);break;case"selectionchange":if(Kte)break;case"keydown":case"keyup":dU(i,m,y)}}function $C(i,o){var f={};return f[i.toLowerCase()]=o.toLowerCase(),f["Webkit"+i]="webkit"+o,f["Moz"+i]="moz"+o,f}var jm={animationend:$C("Animation","AnimationEnd"),animationiteration:$C("Animation","AnimationIteration"),animationstart:$C("Animation","AnimationStart"),transitionend:$C("Transition","TransitionEnd")},aE={},fU={};_r&&(fU=document.createElement("div").style,"AnimationEvent"in window||(delete jm.animationend.animation,delete jm.animationiteration.animation,delete jm.animationstart.animation),"TransitionEvent"in window||delete jm.transitionend.transition);function qC(i){if(aE[i])return aE[i];if(!jm[i])return i;var o=jm[i];for(var f in o)if(o.hasOwnProperty(f)&&f in fU)return aE[i]=o[f];return i}var hU=qC("animationend"),pU=qC("animationiteration"),mU=qC("animationstart"),gU=qC("transitionend"),vU=new Map,yU=["abort","auxClick","cancel","canPlay","canPlayThrough","click","close","contextMenu","copy","cut","drag","dragEnd","dragEnter","dragExit","dragLeave","dragOver","dragStart","drop","durationChange","emptied","encrypted","ended","error","gotPointerCapture","input","invalid","keyDown","keyPress","keyUp","load","loadedData","loadedMetadata","loadStart","lostPointerCapture","mouseDown","mouseMove","mouseOut","mouseOver","mouseUp","paste","pause","play","playing","pointerCancel","pointerDown","pointerMove","pointerOut","pointerOver","pointerUp","progress","rateChange","reset","resize","seeked","seeking","stalled","submit","suspend","timeUpdate","touchCancel","touchEnd","touchStart","volumeChange","scroll","toggle","touchMove","waiting","wheel"];function Rd(i,o){vU.set(i,o),tn(o,[i])}function ene(){for(var i=0;i<yU.length;i++){var o=yU[i],f=o.toLowerCase(),m=o[0].toUpperCase()+o.slice(1);Rd(f,"on"+m)}Rd(hU,"onAnimationEnd"),Rd(pU,"onAnimationIteration"),Rd(mU,"onAnimationStart"),Rd("dblclick","onDoubleClick"),Rd("focusin","onFocus"),Rd("focusout","onBlur"),Rd(gU,"onTransitionEnd")}function tne(i,o,f,m,y,C,w){var P=vU.get(o);if(P!==void 0){var D=Ga,F=o;switch(o){case"keypress":if(wd(m)===0)return;case"keydown":case"keyup":D=K_;break;case"focusin":F="focus",D=Rm;break;case"focusout":F="blur",D=Rm;break;case"beforeblur":case"afterblur":D=Rm;break;case"click":if(m.button===2)return;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":D=Em;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":D=xy;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":D=Q_;break;case hU:case pU:case mU:D=wy;break;case gU:D=Py;break;case"scroll":D=AC;break;case"wheel":D=Gl;break;case"copy":case"cut":case"paste":D=W_;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":D=Ry;break}var B=(C&Pu)!==0;{var ae=!B&&o==="scroll",re=ane(f,P,m.type,B,ae);if(re.length>0){var ge=new D(P,F,null,m,y);i.push({event:ge,listeners:re})}}}}ene(),ie(),eE(),Zte(),jC();function nne(i,o,f,m,y,C,w){tne(i,o,f,m,y,C);var P=(C&Hv)===0;P&&(he(i,o,f,m,y),ue(i,o,f,m,y),Jte(i,o,f,m,y),J_(i,o,f,m,y))}var Ny=["abort","canplay","canplaythrough","durationchange","emptied","encrypted","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","resize","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting"],oE=new Set(["cancel","close","invalid","load","scroll","toggle"].concat(Ny));function bU(i,o,f){var m=i.type||"unknown-event";i.currentTarget=f,If(m,o,void 0,i),i.currentTarget=null}function rne(i,o,f){var m;if(f)for(var y=o.length-1;y>=0;y--){var C=o[y],w=C.instance,P=C.currentTarget,D=C.listener;if(w!==m&&i.isPropagationStopped())return;bU(i,D,P),m=w}else for(var F=0;F<o.length;F++){var B=o[F],ae=B.instance,re=B.currentTarget,ge=B.listener;if(ae!==m&&i.isPropagationStopped())return;bU(i,ge,re),m=ae}}function SU(i,o){for(var f=(o&Pu)!==0,m=0;m<i.length;m++){var y=i[m],C=y.event,w=y.listeners;rne(C,w,f)}qs()}function ine(i,o,f,m,y){var C=Ip(f),w=[];nne(w,i,m,f,C,o),SU(w,o)}function Ir(i,o){oE.has(i)||c('Did not expect a listenToNonDelegatedEvent() call for "%s". This is a bug in React. Please file an issue.',i);var f=!1,m=Lre(o),y=lne(i);m.has(y)||(CU(o,i,ss,f),m.add(y))}function sE(i,o,f){oE.has(i)&&!o&&c('Did not expect a listenToNativeEvent() call for "%s" in the bubble phase. This is a bug in React. Please file an issue.',i);var m=0;o&&(m|=Pu),CU(f,i,m,o)}var WC="_reactListening"+Math.random().toString(36).slice(2);function Iy(i){if(!i[WC]){i[WC]=!0,bt.forEach(function(f){f!=="selectionchange"&&(oE.has(f)||sE(f,!1,i),sE(f,!0,i))});var o=i.nodeType===$s?i:i.ownerDocument;o!==null&&(o[WC]||(o[WC]=!0,sE("selectionchange",!1,o)))}}function CU(i,o,f,m,y){var C=qa(i,o,f),w=void 0;Nf&&(o==="touchstart"||o==="touchmove"||o==="wheel")&&(w=!0),i=i,m?w!==void 0?Td(i,o,C,w):Ty(i,o,C):w!==void 0?Zs(i,o,C,w):Ma(i,o,C)}function kU(i,o){return i===o||i.nodeType===ti&&i.parentNode===o}function lE(i,o,f,m,y){var C=m;if(!(o&Bv)&&!(o&ss)){var w=y;if(m!==null){var P=m;e:for(;;){if(P===null)return;var D=P.tag;if(D===k||D===T){var F=P.stateNode.containerInfo;if(kU(F,w))break;if(D===T)for(var B=P.return;B!==null;){var ae=B.tag;if(ae===k||ae===T){var re=B.stateNode.containerInfo;if(kU(re,w))return}B=B.return}for(;F!==null;){var ge=vh(F);if(ge===null)return;var be=ge.tag;if(be===E||be===R){P=C=ge;continue e}F=F.parentNode}}P=P.return}}}nC(function(){return ine(i,o,f,C)})}function Uy(i,o,f){return{instance:i,listener:o,currentTarget:f}}function ane(i,o,f,m,y,C){for(var w=o!==null?o+"Capture":null,P=m?w:o,D=[],F=i,B=null;F!==null;){var ae=F,re=ae.stateNode,ge=ae.tag;if(ge===E&&re!==null&&(B=re,P!==null)){var be=Au(F,P);be!=null&&D.push(Uy(F,be,B))}if(y)break;F=F.return}return D}function GC(i,o){for(var f=o+"Capture",m=[],y=i;y!==null;){var C=y,w=C.stateNode,P=C.tag;if(P===E&&w!==null){var D=w,F=Au(y,f);F!=null&&m.unshift(Uy(y,F,D));var B=Au(y,o);B!=null&&m.push(Uy(y,B,D))}y=y.return}return m}function Vm(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==E);return i||null}function one(i,o){for(var f=i,m=o,y=0,C=f;C;C=Vm(C))y++;for(var w=0,P=m;P;P=Vm(P))w++;for(;y-w>0;)f=Vm(f),y--;for(;w-y>0;)m=Vm(m),w--;for(var D=y;D--;){if(f===m||m!==null&&f===m.alternate)return f;f=Vm(f),m=Vm(m)}return null}function TU(i,o,f,m,y){for(var C=o._reactName,w=[],P=f;P!==null&&P!==m;){var D=P,F=D.alternate,B=D.stateNode,ae=D.tag;if(F!==null&&F===m)break;if(ae===E&&B!==null){var re=B;if(y){var ge=Au(P,C);ge!=null&&w.unshift(Uy(P,ge,re))}else if(!y){var be=Au(P,C);be!=null&&w.push(Uy(P,be,re))}}P=P.return}w.length!==0&&i.push({event:o,listeners:w})}function sne(i,o,f,m,y){var C=m&&y?one(m,y):null;m!==null&&TU(i,o,m,C,!1),y!==null&&f!==null&&TU(i,f,y,C,!0)}function lne(i,o){return i+"__bubble"}var xo=!1,Fy="dangerouslySetInnerHTML",YC="suppressContentEditableWarning",Pd="suppressHydrationWarning",xU="autoFocus",mh="children",gh="style",KC="__html",uE,ZC,jy,wU,QC,_U,EU;uE={dialog:!0,webview:!0},ZC=function(i,o){ZS(i,o),rd(i,o),tC(i,o,{registrationNameDependencies:it,possibleRegistrationNames:xt})},_U=_r&&!document.documentMode,jy=function(i,o,f){if(!xo){var m=XC(f),y=XC(o);y!==m&&(xo=!0,c("Prop `%s` did not match. Server: %s Client: %s",i,JSON.stringify(y),JSON.stringify(m)))}},wU=function(i){if(!xo){xo=!0;var o=[];i.forEach(function(f){o.push(f)}),c("Extra attributes from the server: %s",o)}},QC=function(i,o){o===!1?c("Expected `%s` listener to be a function, instead got `false`.\n\nIf you used to conditionally omit it with %s={condition && value}, pass %s={condition ? value : undefined} instead.",i,i,i):c("Expected `%s` listener to be a function, instead got a value of `%s` type.",i,typeof o)},EU=function(i,o){var f=i.namespaceURI===Io?i.ownerDocument.createElement(i.tagName):i.ownerDocument.createElementNS(i.namespaceURI,i.tagName);return f.innerHTML=o,f.innerHTML};var une=/\r\n?/g,cne=/\u0000|\uFFFD/g;function XC(i){Ve(i);var o=typeof i=="string"?i:""+i;return o.replace(une,`
|
|
128
|
-
`).replace(cne,"")}function JC(i,o,f,m){var y=XC(o),C=XC(i);if(C!==y&&(m&&(xo||(xo=!0,c('Text content did not match. Server: "%s" Client: "%s"',C,y))),f&&ve))throw new Error("Text content does not match server-rendered HTML.")}function RU(i){return i.nodeType===$s?i:i.ownerDocument}function dne(){}function ek(i){i.onclick=dne}function fne(i,o,f,m,y){for(var C in m)if(m.hasOwnProperty(C)){var w=m[C];if(C===gh)w&&Object.freeze(w),qS(o,w);else if(C===Fy){var P=w?w[KC]:void 0;P!=null&&MS(o,P)}else if(C===mh)if(typeof w=="string"){var D=i!=="textarea"||w!=="";D&&Pl(o,w)}else typeof w=="number"&&Pl(o,""+w);else C===YC||C===Pd||C===xU||(it.hasOwnProperty(C)?w!=null&&(typeof w!="function"&&QC(C,w),C==="onScroll"&&Ir("scroll",o)):w!=null&&It(o,C,w,y))}}function hne(i,o,f,m){for(var y=0;y<o.length;y+=2){var C=o[y],w=o[y+1];C===gh?qS(i,w):C===Fy?MS(i,w):C===mh?Pl(i,w):It(i,C,w,m)}}function pne(i,o,f,m){var y,C=RU(f),w,P=m;if(P===Io&&(P=Iv(i)),P===Io){if(y=Dl(i,o),!y&&i!==i.toLowerCase()&&c("<%s /> is using incorrect casing. Use PascalCase for React components, or lowercase for HTML elements.",i),i==="script"){var D=C.createElement("div");D.innerHTML="<script><\/script>";var F=D.firstChild;w=D.removeChild(F)}else if(typeof o.is=="string")w=C.createElement(i,{is:o.is});else if(w=C.createElement(i),i==="select"){var B=w;o.multiple?B.multiple=!0:o.size&&(B.size=o.size)}}else w=C.createElementNS(P,i);return P===Io&&!y&&Object.prototype.toString.call(w)==="[object HTMLUnknownElement]"&&!vr.call(uE,i)&&(uE[i]=!0,c("The tag <%s> is unrecognized in this browser. If you meant to render a React component, start its name with an uppercase letter.",i)),w}function mne(i,o){return RU(o).createTextNode(i)}function gne(i,o,f,m){var y=Dl(o,f);ZC(o,f);var C;switch(o){case"dialog":Ir("cancel",i),Ir("close",i),C=f;break;case"iframe":case"object":case"embed":Ir("load",i),C=f;break;case"video":case"audio":for(var w=0;w<Ny.length;w++)Ir(Ny[w],i);C=f;break;case"source":Ir("error",i),C=f;break;case"img":case"image":case"link":Ir("error",i),Ir("load",i),C=f;break;case"details":Ir("toggle",i),C=f;break;case"input":Zc(i,f),C=go(i,f),Ir("invalid",i);break;case"option":Kn(i,f),C=f;break;case"select":Tf(i,f),C=Ru(i,f),Ir("invalid",i);break;case"textarea":DS(i,f),C=Dp(i,f),Ir("invalid",i);break;default:C=f}switch(Lp(o,C),fne(o,i,m,C,y),o){case"input":mo(i),pe(i,f,!1);break;case"textarea":mo(i),OS(i);break;case"option":lr(i,f);break;case"select":Mv(i,f);break;default:typeof C.onClick=="function"&&ek(i);break}}function vne(i,o,f,m,y){ZC(o,m);var C=null,w,P;switch(o){case"input":w=go(i,f),P=go(i,m),C=[];break;case"select":w=Ru(i,f),P=Ru(i,m),C=[];break;case"textarea":w=Dp(i,f),P=Dp(i,m),C=[];break;default:w=f,P=m,typeof w.onClick!="function"&&typeof P.onClick=="function"&&ek(i);break}Lp(o,P);var D,F,B=null;for(D in w)if(!(P.hasOwnProperty(D)||!w.hasOwnProperty(D)||w[D]==null))if(D===gh){var ae=w[D];for(F in ae)ae.hasOwnProperty(F)&&(B||(B={}),B[F]="")}else D===Fy||D===mh||D===YC||D===Pd||D===xU||(it.hasOwnProperty(D)?C||(C=[]):(C=C||[]).push(D,null));for(D in P){var re=P[D],ge=w!=null?w[D]:void 0;if(!(!P.hasOwnProperty(D)||re===ge||re==null&&ge==null))if(D===gh)if(re&&Object.freeze(re),ge){for(F in ge)ge.hasOwnProperty(F)&&(!re||!re.hasOwnProperty(F))&&(B||(B={}),B[F]="");for(F in re)re.hasOwnProperty(F)&&ge[F]!==re[F]&&(B||(B={}),B[F]=re[F])}else B||(C||(C=[]),C.push(D,B)),B=re;else if(D===Fy){var be=re?re[KC]:void 0,we=ge?ge[KC]:void 0;be!=null&&we!==be&&(C=C||[]).push(D,be)}else D===mh?(typeof re=="string"||typeof re=="number")&&(C=C||[]).push(D,""+re):D===YC||D===Pd||(it.hasOwnProperty(D)?(re!=null&&(typeof re!="function"&&QC(D,re),D==="onScroll"&&Ir("scroll",i)),!C&&ge!==re&&(C=[])):(C=C||[]).push(D,re))}return B&&(Uo(B,P[gh]),(C=C||[]).push(gh,B)),C}function yne(i,o,f,m,y){f==="input"&&y.type==="radio"&&y.name!=null&&O(i,y);var C=Dl(f,m),w=Dl(f,y);switch(hne(i,o,C,w),f){case"input":Y(i,y);break;case"textarea":AS(i,y);break;case"select":Pp(i,y);break}}function bne(i){{var o=i.toLowerCase();return ed.hasOwnProperty(o)&&ed[o]||null}}function Sne(i,o,f,m,y,C,w){var P,D;switch(P=Dl(o,f),ZC(o,f),o){case"dialog":Ir("cancel",i),Ir("close",i);break;case"iframe":case"object":case"embed":Ir("load",i);break;case"video":case"audio":for(var F=0;F<Ny.length;F++)Ir(Ny[F],i);break;case"source":Ir("error",i);break;case"img":case"image":case"link":Ir("error",i),Ir("load",i);break;case"details":Ir("toggle",i);break;case"input":Zc(i,f),Ir("invalid",i);break;case"option":Kn(i,f);break;case"select":Tf(i,f),Ir("invalid",i);break;case"textarea":DS(i,f),Ir("invalid",i);break}Lp(o,f);{D=new Set;for(var B=i.attributes,ae=0;ae<B.length;ae++){var re=B[ae].name.toLowerCase();switch(re){case"value":break;case"checked":break;case"selected":break;default:D.add(B[ae].name)}}}var ge=null;for(var be in f)if(f.hasOwnProperty(be)){var we=f[be];if(be===mh)typeof we=="string"?i.textContent!==we&&(f[Pd]!==!0&&JC(i.textContent,we,C,w),ge=[mh,we]):typeof we=="number"&&i.textContent!==""+we&&(f[Pd]!==!0&&JC(i.textContent,we,C,w),ge=[mh,""+we]);else if(it.hasOwnProperty(be))we!=null&&(typeof we!="function"&&QC(be,we),be==="onScroll"&&Ir("scroll",i));else if(w&&typeof P=="boolean"){var st=void 0,Vt=Jn(be);if(f[Pd]!==!0){if(!(be===YC||be===Pd||be==="value"||be==="checked"||be==="selected")){if(be===Fy){var Pt=i.innerHTML,Ln=we?we[KC]:void 0;if(Ln!=null){var wn=EU(i,Ln);wn!==Pt&&jy(be,Pt,wn)}}else if(be===gh){if(D.delete(be),_U){var ce=I_(we);st=i.getAttribute("style"),ce!==st&&jy(be,st,ce)}}else if(P&&!Ce)D.delete(be.toLowerCase()),st=Me(i,be,we),we!==st&&jy(be,st,we);else if(!un(be,Vt,P)&&!Wn(be,we,Vt,P)){var _e=!1;if(Vt!==null)D.delete(Vt.attributeName),st=et(i,be,we,Vt);else{var de=m;if(de===Io&&(de=Iv(o)),de===Io)D.delete(be.toLowerCase());else{var qe=bne(be);qe!==null&&qe!==be&&(_e=!0,D.delete(qe)),D.delete(be)}st=Me(i,be,we)}var yt=Ce;!yt&&we!==st&&!_e&&jy(be,st,we)}}}}}switch(w&&D.size>0&&f[Pd]!==!0&&wU(D),o){case"input":mo(i),pe(i,f,!0);break;case"textarea":mo(i),OS(i);break;case"select":case"option":break;default:typeof f.onClick=="function"&&ek(i);break}return ge}function Cne(i,o,f){var m=i.nodeValue!==o;return m}function cE(i,o){{if(xo)return;xo=!0,c("Did not expect server HTML to contain a <%s> in <%s>.",o.nodeName.toLowerCase(),i.nodeName.toLowerCase())}}function dE(i,o){{if(xo)return;xo=!0,c('Did not expect server HTML to contain the text node "%s" in <%s>.',o.nodeValue,i.nodeName.toLowerCase())}}function fE(i,o,f){{if(xo)return;xo=!0,c("Expected server HTML to contain a matching <%s> in <%s>.",o,i.nodeName.toLowerCase())}}function hE(i,o){{if(o===""||xo)return;xo=!0,c('Expected server HTML to contain a matching text node for "%s" in <%s>.',o,i.nodeName.toLowerCase())}}function kne(i,o,f){switch(o){case"input":Te(i,f);return;case"textarea":P_(i,f);return;case"select":Lv(i,f);return}}var Vy=function(){},zy=function(){};{var Tne=["address","applet","area","article","aside","base","basefont","bgsound","blockquote","body","br","button","caption","center","col","colgroup","dd","details","dir","div","dl","dt","embed","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","iframe","img","input","isindex","li","link","listing","main","marquee","menu","menuitem","meta","nav","noembed","noframes","noscript","object","ol","p","param","plaintext","pre","script","section","select","source","style","summary","table","tbody","td","template","textarea","tfoot","th","thead","title","tr","track","ul","wbr","xmp"],PU=["applet","caption","html","table","td","th","marquee","object","template","foreignObject","desc","title"],xne=PU.concat(["button"]),wne=["dd","dt","li","option","optgroup","p","rp","rt"],DU={current:null,formTag:null,aTagInScope:null,buttonTagInScope:null,nobrTagInScope:null,pTagInButtonScope:null,listItemTagAutoclosing:null,dlItemTagAutoclosing:null};zy=function(i,o){var f=rn({},i||DU),m={tag:o};return PU.indexOf(o)!==-1&&(f.aTagInScope=null,f.buttonTagInScope=null,f.nobrTagInScope=null),xne.indexOf(o)!==-1&&(f.pTagInButtonScope=null),Tne.indexOf(o)!==-1&&o!=="address"&&o!=="div"&&o!=="p"&&(f.listItemTagAutoclosing=null,f.dlItemTagAutoclosing=null),f.current=m,o==="form"&&(f.formTag=m),o==="a"&&(f.aTagInScope=m),o==="button"&&(f.buttonTagInScope=m),o==="nobr"&&(f.nobrTagInScope=m),o==="p"&&(f.pTagInButtonScope=m),o==="li"&&(f.listItemTagAutoclosing=m),(o==="dd"||o==="dt")&&(f.dlItemTagAutoclosing=m),f};var _ne=function(i,o){switch(o){case"select":return i==="option"||i==="optgroup"||i==="#text";case"optgroup":return i==="option"||i==="#text";case"option":return i==="#text";case"tr":return i==="th"||i==="td"||i==="style"||i==="script"||i==="template";case"tbody":case"thead":case"tfoot":return i==="tr"||i==="style"||i==="script"||i==="template";case"colgroup":return i==="col"||i==="template";case"table":return i==="caption"||i==="colgroup"||i==="tbody"||i==="tfoot"||i==="thead"||i==="style"||i==="script"||i==="template";case"head":return i==="base"||i==="basefont"||i==="bgsound"||i==="link"||i==="meta"||i==="title"||i==="noscript"||i==="noframes"||i==="style"||i==="script"||i==="template";case"html":return i==="head"||i==="body"||i==="frameset";case"frameset":return i==="frame";case"#document":return i==="html"}switch(i){case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":return o!=="h1"&&o!=="h2"&&o!=="h3"&&o!=="h4"&&o!=="h5"&&o!=="h6";case"rp":case"rt":return wne.indexOf(o)===-1;case"body":case"caption":case"col":case"colgroup":case"frameset":case"frame":case"head":case"html":case"tbody":case"td":case"tfoot":case"th":case"thead":case"tr":return o==null}return!0},Ene=function(i,o){switch(i){case"address":case"article":case"aside":case"blockquote":case"center":case"details":case"dialog":case"dir":case"div":case"dl":case"fieldset":case"figcaption":case"figure":case"footer":case"header":case"hgroup":case"main":case"menu":case"nav":case"ol":case"p":case"section":case"summary":case"ul":case"pre":case"listing":case"table":case"hr":case"xmp":case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":return o.pTagInButtonScope;case"form":return o.formTag||o.pTagInButtonScope;case"li":return o.listItemTagAutoclosing;case"dd":case"dt":return o.dlItemTagAutoclosing;case"button":return o.buttonTagInScope;case"a":return o.aTagInScope;case"nobr":return o.nobrTagInScope}return null},AU={};Vy=function(i,o,f){f=f||DU;var m=f.current,y=m&&m.tag;o!=null&&(i!=null&&c("validateDOMNesting: when childText is passed, childTag should be null"),i="#text");var C=_ne(i,y)?null:m,w=C?null:Ene(i,f),P=C||w;if(P){var D=P.tag,F=!!C+"|"+i+"|"+D;if(!AU[F]){AU[F]=!0;var B=i,ae="";if(i==="#text"?/\S/.test(o)?B="Text nodes":(B="Whitespace text nodes",ae=" Make sure you don't have any extra whitespace between tags on each line of your source code."):B="<"+i+">",C){var re="";D==="table"&&i==="tr"&&(re+=" Add a <tbody>, <thead> or <tfoot> to your code to match the DOM tree generated by the browser."),c("validateDOMNesting(...): %s cannot appear as a child of <%s>.%s%s",B,D,ae,re)}else c("validateDOMNesting(...): %s cannot appear as a descendant of <%s>.",B,D)}}}}var tk="suppressHydrationWarning",nk="$",rk="/$",By="$?",Hy="$!",Rne="style",pE=null,mE=null;function Pne(i){var o,f,m=i.nodeType;switch(m){case $s:case xf:{o=m===$s?"#document":"#fragment";var y=i.documentElement;f=y?y.namespaceURI:Ap(null,"");break}default:{var C=m===ti?i.parentNode:i,w=C.namespaceURI||null;o=C.tagName,f=Ap(w,o);break}}{var P=o.toLowerCase(),D=zy(null,P);return{namespace:f,ancestorInfo:D}}}function Dne(i,o,f){{var m=i,y=Ap(m.namespace,o),C=zy(m.ancestorInfo,o);return{namespace:y,ancestorInfo:C}}}function Jse(i){return i}function Ane(i){pE=Oi(),mE=qte();var o=null;return Kr(!1),o}function One(i){Wte(mE),Kr(pE),pE=null,mE=null}function Mne(i,o,f,m,y){var C;{var w=m;if(Vy(i,null,w.ancestorInfo),typeof o.children=="string"||typeof o.children=="number"){var P=""+o.children,D=zy(w.ancestorInfo,i);Vy(null,P,D)}C=w.namespace}var F=pne(i,o,f,C);return Wy(y,F),TE(F,o),F}function Lne(i,o){i.appendChild(o)}function Nne(i,o,f,m,y){switch(gne(i,o,f,m),o){case"button":case"input":case"select":case"textarea":return!!f.autoFocus;case"img":return!0;default:return!1}}function Ine(i,o,f,m,y,C){{var w=C;if(typeof m.children!=typeof f.children&&(typeof m.children=="string"||typeof m.children=="number")){var P=""+m.children,D=zy(w.ancestorInfo,o);Vy(null,P,D)}}return vne(i,o,f,m)}function gE(i,o){return i==="textarea"||i==="noscript"||typeof o.children=="string"||typeof o.children=="number"||typeof o.dangerouslySetInnerHTML=="object"&&o.dangerouslySetInnerHTML!==null&&o.dangerouslySetInnerHTML.__html!=null}function Une(i,o,f,m){{var y=f;Vy(null,i,y.ancestorInfo)}var C=mne(i,o);return Wy(m,C),C}function Fne(){var i=window.event;return i===void 0?Di:kd(i.type)}var vE=typeof setTimeout=="function"?setTimeout:void 0,jne=typeof clearTimeout=="function"?clearTimeout:void 0,yE=-1,OU=typeof Promise=="function"?Promise:void 0,Vne=typeof queueMicrotask=="function"?queueMicrotask:typeof OU<"u"?function(i){return OU.resolve(null).then(i).catch(zne)}:vE;function zne(i){setTimeout(function(){throw i})}function Bne(i,o,f,m){switch(o){case"button":case"input":case"select":case"textarea":f.autoFocus&&i.focus();return;case"img":{f.src&&(i.src=f.src);return}}}function Hne(i,o,f,m,y,C){yne(i,o,f,m,y),TE(i,y)}function MU(i){Pl(i,"")}function $ne(i,o,f){i.nodeValue=f}function qne(i,o){i.appendChild(o)}function Wne(i,o){var f;i.nodeType===ti?(f=i.parentNode,f.insertBefore(o,i)):(f=i,f.appendChild(o));var m=i._reactRootContainer;m==null&&f.onclick===null&&ek(f)}function Gne(i,o,f){i.insertBefore(o,f)}function Yne(i,o,f){i.nodeType===ti?i.parentNode.insertBefore(o,f):i.insertBefore(o,f)}function Kne(i,o){i.removeChild(o)}function Zne(i,o){i.nodeType===ti?i.parentNode.removeChild(o):i.removeChild(o)}function bE(i,o){var f=o,m=0;do{var y=f.nextSibling;if(i.removeChild(f),y&&y.nodeType===ti){var C=y.data;if(C===rk)if(m===0){i.removeChild(y),Zi(o);return}else m--;else(C===nk||C===By||C===Hy)&&m++}f=y}while(f);Zi(o)}function Qne(i,o){i.nodeType===ti?bE(i.parentNode,o):i.nodeType===xa&&bE(i,o),Zi(i)}function Xne(i){i=i;var o=i.style;typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none"}function Jne(i){i.nodeValue=""}function ere(i,o){i=i;var f=o[Rne],m=f!=null&&f.hasOwnProperty("display")?f.display:null;i.style.display=Mp("display",m)}function tre(i,o){i.nodeValue=o}function nre(i){i.nodeType===xa?i.textContent="":i.nodeType===$s&&i.documentElement&&i.removeChild(i.documentElement)}function rre(i,o,f){return i.nodeType!==xa||o.toLowerCase()!==i.nodeName.toLowerCase()?null:i}function ire(i,o){return o===""||i.nodeType!==Hs?null:i}function are(i){return i.nodeType!==ti?null:i}function LU(i){return i.data===By}function SE(i){return i.data===Hy}function ore(i){var o=i.nextSibling&&i.nextSibling.dataset,f,m,y;return o&&(f=o.dgst,m=o.msg,y=o.stck),{message:m,digest:f,stack:y}}function sre(i,o){i._reactRetry=o}function ik(i){for(;i!=null;i=i.nextSibling){var o=i.nodeType;if(o===xa||o===Hs)break;if(o===ti){var f=i.data;if(f===nk||f===Hy||f===By)break;if(f===rk)return null}}return i}function $y(i){return ik(i.nextSibling)}function lre(i){return ik(i.firstChild)}function ure(i){return ik(i.firstChild)}function cre(i){return ik(i.nextSibling)}function dre(i,o,f,m,y,C,w){Wy(C,i),TE(i,f);var P;{var D=y;P=D.namespace}var F=(C.mode&vn)!==Mt;return Sne(i,o,f,P,m,F,w)}function fre(i,o,f,m){return Wy(f,i),f.mode&vn,Cne(i,o)}function hre(i,o){Wy(o,i)}function pre(i){for(var o=i.nextSibling,f=0;o;){if(o.nodeType===ti){var m=o.data;if(m===rk){if(f===0)return $y(o);f--}else(m===nk||m===Hy||m===By)&&f++}o=o.nextSibling}return null}function NU(i){for(var o=i.previousSibling,f=0;o;){if(o.nodeType===ti){var m=o.data;if(m===nk||m===Hy||m===By){if(f===0)return o;f--}else m===rk&&f++}o=o.previousSibling}return null}function mre(i){Zi(i)}function gre(i){Zi(i)}function vre(i){return i!=="head"&&i!=="body"}function yre(i,o,f,m){var y=!0;JC(o.nodeValue,f,m,y)}function bre(i,o,f,m,y,C){if(o[tk]!==!0){var w=!0;JC(m.nodeValue,y,C,w)}}function Sre(i,o){o.nodeType===xa?cE(i,o):o.nodeType===ti||dE(i,o)}function Cre(i,o){{var f=i.parentNode;f!==null&&(o.nodeType===xa?cE(f,o):o.nodeType===ti||dE(f,o))}}function kre(i,o,f,m,y){(y||o[tk]!==!0)&&(m.nodeType===xa?cE(f,m):m.nodeType===ti||dE(f,m))}function Tre(i,o,f){fE(i,o)}function xre(i,o){hE(i,o)}function wre(i,o,f){{var m=i.parentNode;m!==null&&fE(m,o)}}function _re(i,o){{var f=i.parentNode;f!==null&&hE(f,o)}}function Ere(i,o,f,m,y,C){(C||o[tk]!==!0)&&fE(f,m)}function Rre(i,o,f,m,y){(y||o[tk]!==!0)&&hE(f,m)}function Pre(i){c("An error occurred during hydration. The server HTML was replaced with client content in <%s>.",i.nodeName.toLowerCase())}function Dre(i){Iy(i)}var zm=Math.random().toString(36).slice(2),Bm="__reactFiber$"+zm,CE="__reactProps$"+zm,qy="__reactContainer$"+zm,kE="__reactEvents$"+zm,Are="__reactListeners$"+zm,Ore="__reactHandles$"+zm;function Mre(i){delete i[Bm],delete i[CE],delete i[kE],delete i[Are],delete i[Ore]}function Wy(i,o){o[Bm]=i}function ak(i,o){o[qy]=i}function IU(i){i[qy]=null}function Gy(i){return!!i[qy]}function vh(i){var o=i[Bm];if(o)return o;for(var f=i.parentNode;f;){if(o=f[qy]||f[Bm],o){var m=o.alternate;if(o.child!==null||m!==null&&m.child!==null)for(var y=NU(i);y!==null;){var C=y[Bm];if(C)return C;y=NU(y)}return o}i=f,f=i.parentNode}return null}function Dd(i){var o=i[Bm]||i[qy];return o&&(o.tag===E||o.tag===R||o.tag===N||o.tag===k)?o:null}function Hm(i){if(i.tag===E||i.tag===R)return i.stateNode;throw new Error("getNodeFromInstance: Invalid argument.")}function ok(i){return i[CE]||null}function TE(i,o){i[CE]=o}function Lre(i){var o=i[kE];return o===void 0&&(o=i[kE]=new Set),o}var UU={},FU=r.ReactDebugCurrentFrame;function sk(i){if(i){var o=i._owner,f=yf(i.type,i._source,o?o.type:null);FU.setExtraStackFrame(f)}else FU.setExtraStackFrame(null)}function Qs(i,o,f,m,y){{var C=Function.call.bind(vr);for(var w in i)if(C(i,w)){var P=void 0;try{if(typeof i[w]!="function"){var D=Error((m||"React class")+": "+f+" type `"+w+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[w]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw D.name="Invariant Violation",D}P=i[w](o,w,m,f,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(F){P=F}P&&!(P instanceof Error)&&(sk(y),c("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",m||"React class",f,w,typeof P),sk(null)),P instanceof Error&&!(P.message in UU)&&(UU[P.message]=!0,sk(y),c("Failed %s type: %s",f,P.message),sk(null))}}}var xE=[],lk;lk=[];var ec=-1;function Ad(i){return{current:i}}function La(i,o){if(ec<0){c("Unexpected pop.");return}o!==lk[ec]&&c("Unexpected Fiber popped."),i.current=xE[ec],xE[ec]=null,lk[ec]=null,ec--}function Na(i,o,f){ec++,xE[ec]=i.current,lk[ec]=f,i.current=o}var wE;wE={};var $o={};Object.freeze($o);var tc=Ad($o),Ql=Ad(!1),_E=$o;function $m(i,o,f){return f&&Xl(o)?_E:tc.current}function jU(i,o,f){{var m=i.stateNode;m.__reactInternalMemoizedUnmaskedChildContext=o,m.__reactInternalMemoizedMaskedChildContext=f}}function qm(i,o){{var f=i.type,m=f.contextTypes;if(!m)return $o;var y=i.stateNode;if(y&&y.__reactInternalMemoizedUnmaskedChildContext===o)return y.__reactInternalMemoizedMaskedChildContext;var C={};for(var w in m)C[w]=o[w];{var P=Zt(i)||"Unknown";Qs(m,C,"context",P)}return y&&jU(i,o,C),C}}function uk(){return Ql.current}function Xl(i){{var o=i.childContextTypes;return o!=null}}function ck(i){La(Ql,i),La(tc,i)}function EE(i){La(Ql,i),La(tc,i)}function VU(i,o,f){{if(tc.current!==$o)throw new Error("Unexpected context found on stack. This error is likely caused by a bug in React. Please file an issue.");Na(tc,o,i),Na(Ql,f,i)}}function zU(i,o,f){{var m=i.stateNode,y=o.childContextTypes;if(typeof m.getChildContext!="function"){{var C=Zt(i)||"Unknown";wE[C]||(wE[C]=!0,c("%s.childContextTypes is specified but there is no getChildContext() method on the instance. You can either define getChildContext() on %s or remove childContextTypes from it.",C,C))}return f}var w=m.getChildContext();for(var P in w)if(!(P in y))throw new Error((Zt(i)||"Unknown")+'.getChildContext(): key "'+P+'" is not defined in childContextTypes.');{var D=Zt(i)||"Unknown";Qs(y,w,"child context",D)}return rn({},f,w)}}function dk(i){{var o=i.stateNode,f=o&&o.__reactInternalMemoizedMergedChildContext||$o;return _E=tc.current,Na(tc,f,i),Na(Ql,Ql.current,i),!0}}function BU(i,o,f){{var m=i.stateNode;if(!m)throw new Error("Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue.");if(f){var y=zU(i,o,_E);m.__reactInternalMemoizedMergedChildContext=y,La(Ql,i),La(tc,i),Na(tc,y,i),Na(Ql,f,i)}else La(Ql,i),Na(Ql,f,i)}}function Nre(i){{if(!oC(i)||i.tag!==v)throw new Error("Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue.");var o=i;do{switch(o.tag){case k:return o.stateNode.context;case v:{var f=o.type;if(Xl(f))return o.stateNode.__reactInternalMemoizedMergedChildContext;break}}o=o.return}while(o!==null);throw new Error("Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue.")}}var Od=0,fk=1,nc=null,RE=!1,PE=!1;function HU(i){nc===null?nc=[i]:nc.push(i)}function Ire(i){RE=!0,HU(i)}function $U(){RE&&Md()}function Md(){if(!PE&&nc!==null){PE=!0;var i=0,o=$a();try{var f=!0,m=nc;for(fi(Oa);i<m.length;i++){var y=m[i];do y=y(f);while(y!==null)}nc=null,RE=!1}catch(C){throw nc!==null&&(nc=nc.slice(i+1)),Qv(Gs,Md),C}finally{fi(o),PE=!1}}return null}var Wm=[],Gm=0,hk=null,pk=0,ps=[],ms=0,yh=null,rc=1,ic="";function Ure(i){return Sh(),(i.flags&Ff)!==Ot}function Fre(i){return Sh(),pk}function jre(){var i=ic,o=rc,f=o&~Vre(o);return f.toString(32)+i}function bh(i,o){Sh(),Wm[Gm++]=pk,Wm[Gm++]=hk,hk=i,pk=o}function qU(i,o,f){Sh(),ps[ms++]=rc,ps[ms++]=ic,ps[ms++]=yh,yh=i;var m=rc,y=ic,C=mk(m)-1,w=m&~(1<<C),P=f+1,D=mk(o)+C;if(D>30){var F=C-C%5,B=(1<<F)-1,ae=(w&B).toString(32),re=w>>F,ge=C-F,be=mk(o)+ge,we=P<<ge,st=we|re,Vt=ae+y;rc=1<<be|st,ic=Vt}else{var Pt=P<<C,Ln=Pt|w,wn=y;rc=1<<D|Ln,ic=wn}}function DE(i){Sh();var o=i.return;if(o!==null){var f=1,m=0;bh(i,f),qU(i,f,m)}}function mk(i){return 32-di(i)}function Vre(i){return 1<<mk(i)-1}function AE(i){for(;i===hk;)hk=Wm[--Gm],Wm[Gm]=null,pk=Wm[--Gm],Wm[Gm]=null;for(;i===yh;)yh=ps[--ms],ps[ms]=null,ic=ps[--ms],ps[ms]=null,rc=ps[--ms],ps[ms]=null}function zre(){return Sh(),yh!==null?{id:rc,overflow:ic}:null}function Bre(i,o){Sh(),ps[ms++]=rc,ps[ms++]=ic,ps[ms++]=yh,rc=o.id,ic=o.overflow,yh=i}function Sh(){la()||c("Expected to be hydrating. This is a bug in React. Please file an issue.")}var sa=null,gs=null,Xs=!1,Ch=!1,Ld=null;function Hre(){Xs&&c("We should not be hydrating here. This is a bug in React. Please file a bug.")}function WU(){Ch=!0}function $re(){return Ch}function qre(i){var o=i.stateNode.containerInfo;return gs=ure(o),sa=i,Xs=!0,Ld=null,Ch=!1,!0}function Wre(i,o,f){return gs=cre(o),sa=i,Xs=!0,Ld=null,Ch=!1,f!==null&&Bre(i,f),!0}function GU(i,o){switch(i.tag){case k:{Sre(i.stateNode.containerInfo,o);break}case E:{var f=(i.mode&vn)!==Mt;kre(i.type,i.memoizedProps,i.stateNode,o,f);break}case N:{var m=i.memoizedState;m.dehydrated!==null&&Cre(m.dehydrated,o);break}}}function YU(i,o){GU(i,o);var f=Zoe();f.stateNode=o,f.return=i;var m=i.deletions;m===null?(i.deletions=[f],i.flags|=wa):m.push(f)}function OE(i,o){{if(Ch)return;switch(i.tag){case k:{var f=i.stateNode.containerInfo;switch(o.tag){case E:var m=o.type;o.pendingProps,Tre(f,m);break;case R:var y=o.pendingProps;xre(f,y);break}break}case E:{var C=i.type,w=i.memoizedProps,P=i.stateNode;switch(o.tag){case E:{var D=o.type,F=o.pendingProps,B=(i.mode&vn)!==Mt;Ere(C,w,P,D,F,B);break}case R:{var ae=o.pendingProps,re=(i.mode&vn)!==Mt;Rre(C,w,P,ae,re);break}}break}case N:{var ge=i.memoizedState,be=ge.dehydrated;if(be!==null)switch(o.tag){case E:var we=o.type;o.pendingProps,wre(be,we);break;case R:var st=o.pendingProps;_re(be,st);break}break}default:return}}}function KU(i,o){o.flags=o.flags&~Vr|jr,OE(i,o)}function ZU(i,o){switch(i.tag){case E:{var f=i.type;i.pendingProps;var m=rre(o,f);return m!==null?(i.stateNode=m,sa=i,gs=lre(m),!0):!1}case R:{var y=i.pendingProps,C=ire(o,y);return C!==null?(i.stateNode=C,sa=i,gs=null,!0):!1}case N:{var w=are(o);if(w!==null){var P={dehydrated:w,treeContext:zre(),retryLane:Pa};i.memoizedState=P;var D=Qoe(w);return D.return=i,i.child=D,sa=i,gs=null,!0}return!1}default:return!1}}function ME(i){return(i.mode&vn)!==Mt&&(i.flags&pn)===Ot}function LE(i){throw new Error("Hydration failed because the initial UI does not match what was rendered on the server.")}function NE(i){if(Xs){var o=gs;if(!o){ME(i)&&(OE(sa,i),LE()),KU(sa,i),Xs=!1,sa=i;return}var f=o;if(!ZU(i,o)){ME(i)&&(OE(sa,i),LE()),o=$y(f);var m=sa;if(!o||!ZU(i,o)){KU(sa,i),Xs=!1,sa=i;return}YU(m,f)}}}function Gre(i,o,f){var m=i.stateNode,y=!Ch,C=dre(m,i.type,i.memoizedProps,o,f,i,y);return i.updateQueue=C,C!==null}function Yre(i){var o=i.stateNode,f=i.memoizedProps,m=fre(o,f,i);if(m){var y=sa;if(y!==null)switch(y.tag){case k:{var C=y.stateNode.containerInfo,w=(y.mode&vn)!==Mt;yre(C,o,f,w);break}case E:{var P=y.type,D=y.memoizedProps,F=y.stateNode,B=(y.mode&vn)!==Mt;bre(P,D,F,o,f,B);break}}}return m}function Kre(i){var o=i.memoizedState,f=o!==null?o.dehydrated:null;if(!f)throw new Error("Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue.");hre(f,i)}function Zre(i){var o=i.memoizedState,f=o!==null?o.dehydrated:null;if(!f)throw new Error("Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue.");return pre(f)}function QU(i){for(var o=i.return;o!==null&&o.tag!==E&&o.tag!==k&&o.tag!==N;)o=o.return;sa=o}function gk(i){if(i!==sa)return!1;if(!Xs)return QU(i),Xs=!0,!1;if(i.tag!==k&&(i.tag!==E||vre(i.type)&&!gE(i.type,i.memoizedProps))){var o=gs;if(o)if(ME(i))XU(i),LE();else for(;o;)YU(i,o),o=$y(o)}return QU(i),i.tag===N?gs=Zre(i):gs=sa?$y(i.stateNode):null,!0}function Qre(){return Xs&&gs!==null}function XU(i){for(var o=gs;o;)GU(i,o),o=$y(o)}function Ym(){sa=null,gs=null,Xs=!1,Ch=!1}function JU(){Ld!==null&&(W9(Ld),Ld=null)}function la(){return Xs}function IE(i){Ld===null?Ld=[i]:Ld.push(i)}var Xre=r.ReactCurrentBatchConfig,Jre=null;function eie(){return Xre.transition}var Js={recordUnsafeLifecycleWarnings:function(i,o){},flushPendingUnsafeLifecycleWarnings:function(){},recordLegacyContextWarning:function(i,o){},flushLegacyContextWarning:function(){},discardPendingWarnings:function(){}};{var tie=function(i){for(var o=null,f=i;f!==null;)f.mode&an&&(o=f),f=f.return;return o},kh=function(i){var o=[];return i.forEach(function(f){o.push(f)}),o.sort().join(", ")},Yy=[],Ky=[],Zy=[],Qy=[],Xy=[],Jy=[],Th=new Set;Js.recordUnsafeLifecycleWarnings=function(i,o){Th.has(i.type)||(typeof o.componentWillMount=="function"&&o.componentWillMount.__suppressDeprecationWarning!==!0&&Yy.push(i),i.mode&an&&typeof o.UNSAFE_componentWillMount=="function"&&Ky.push(i),typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps.__suppressDeprecationWarning!==!0&&Zy.push(i),i.mode&an&&typeof o.UNSAFE_componentWillReceiveProps=="function"&&Qy.push(i),typeof o.componentWillUpdate=="function"&&o.componentWillUpdate.__suppressDeprecationWarning!==!0&&Xy.push(i),i.mode&an&&typeof o.UNSAFE_componentWillUpdate=="function"&&Jy.push(i))},Js.flushPendingUnsafeLifecycleWarnings=function(){var i=new Set;Yy.length>0&&(Yy.forEach(function(re){i.add(Zt(re)||"Component"),Th.add(re.type)}),Yy=[]);var o=new Set;Ky.length>0&&(Ky.forEach(function(re){o.add(Zt(re)||"Component"),Th.add(re.type)}),Ky=[]);var f=new Set;Zy.length>0&&(Zy.forEach(function(re){f.add(Zt(re)||"Component"),Th.add(re.type)}),Zy=[]);var m=new Set;Qy.length>0&&(Qy.forEach(function(re){m.add(Zt(re)||"Component"),Th.add(re.type)}),Qy=[]);var y=new Set;Xy.length>0&&(Xy.forEach(function(re){y.add(Zt(re)||"Component"),Th.add(re.type)}),Xy=[]);var C=new Set;if(Jy.length>0&&(Jy.forEach(function(re){C.add(Zt(re)||"Component"),Th.add(re.type)}),Jy=[]),o.size>0){var w=kh(o);c(`Using UNSAFE_componentWillMount in strict mode is not recommended and may indicate bugs in your code. See https://reactjs.org/link/unsafe-component-lifecycles for details.
|
|
127
|
+
*/function hh(i){if(!_r)return!1;var o="on"+i,f=o in document;if(!f){var m=document.createElement("div");m.setAttribute(o,"return;"),f=typeof m[o]=="function"}return f}function eE(){tn("onChange",["change","click","focusin","focusout","input","keydown","keyup","selectionchange"])}function ph(i,o,f,m){$v(m);var y=GC(o,"onChange");if(y.length>0){var C=new Ga("onChange","change",null,f,m);i.push({event:C,listeners:y})}}var u=null,d=null;function g(i){var o=i.nodeName&&i.nodeName.toLowerCase();return o==="select"||o==="input"&&i.type==="file"}function S(i){var o=[];ph(o,d,i,Ip(i)),nC(x,o)}function x(i){SU(i,0)}function _(i){var o=Hm(i);if(El(o))return i}function L(i,o){if(i==="change")return o}var q=!1;_r&&(q=hh("input")&&(!document.documentMode||document.documentMode>9));function te(i,o){u=i,d=o,u.attachEvent("onpropertychange",Fe)}function ye(){u&&(u.detachEvent("onpropertychange",Fe),u=null,d=null)}function Fe(i){i.propertyName==="value"&&_(d)&&S(i)}function $e(i,o,f){i==="focusin"?(ye(),te(o,f)):i==="focusout"&&ye()}function Ue(i,o){if(i==="selectionchange"||i==="keyup"||i==="keydown")return _(d)}function mt(i){var o=i.nodeName;return o&&o.toLowerCase()==="input"&&(i.type==="checkbox"||i.type==="radio")}function wt(i,o){if(i==="click")return _(o)}function Et(i,o){if(i==="input"||i==="change")return _(o)}function Zr(i){var o=i._wrapperState;!o||!o.controlled||i.type!=="number"||Tt(i,"number",i.value)}function ue(i,o,f,m,y,C,w){var P=f?Hm(f):window,D,F;if(g(P)?D=L:HC(P)?q?D=Et:(D=Ue,F=$e):mt(P)&&(D=wt),D){var B=D(o,f);if(B){ph(i,B,m,y);return}}F&&F(o,P,f),o==="focusout"&&Zr(P)}function ie(){qn("onMouseEnter",["mouseout","mouseover"]),qn("onMouseLeave",["mouseout","mouseover"]),qn("onPointerEnter",["pointerout","pointerover"]),qn("onPointerLeave",["pointerout","pointerover"])}function he(i,o,f,m,y,C,w){var P=o==="mouseover"||o==="pointerover",D=o==="mouseout"||o==="pointerout";if(P&&!j_(m)){var F=m.relatedTarget||m.fromElement;if(F&&(vh(F)||Gy(F)))return}if(!(!D&&!P)){var B;if(y.window===y)B=y;else{var ae=y.ownerDocument;ae?B=ae.defaultView||ae.parentWindow:B=window}var re,ge;if(D){var be=m.relatedTarget||m.toElement;if(re=f,ge=be?vh(be):null,ge!==null){var we=aa(ge);(ge!==we||ge.tag!==E&&ge.tag!==R)&&(ge=null)}}else re=null,ge=f;if(re!==ge){var st=Em,Vt="onMouseLeave",Pt="onMouseEnter",Ln="mouse";(o==="pointerout"||o==="pointerover")&&(st=Ry,Vt="onPointerLeave",Pt="onPointerEnter",Ln="pointer");var wn=re==null?B:Hm(re),ce=ge==null?B:Hm(ge),_e=new st(Vt,Ln+"leave",re,m,y);_e.target=wn,_e.relatedTarget=ce;var de=null,qe=vh(y);if(qe===f){var yt=new st(Pt,Ln+"enter",ge,m,y);yt.target=ce,yt.relatedTarget=wn,de=yt}lne(i,_e,de,re,ge)}}}function Ke(i,o){return i===o&&(i!==0||1/i===1/o)||i!==i&&o!==o}var dt=typeof Object.is=="function"?Object.is:Ke;function Ut(i,o){if(dt(i,o))return!0;if(typeof i!="object"||i===null||typeof o!="object"||o===null)return!1;var f=Object.keys(i),m=Object.keys(o);if(f.length!==m.length)return!1;for(var y=0;y<f.length;y++){var C=f[y];if(!vr.call(o,C)||!dt(i[C],o[C]))return!1}return!0}function zt(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function Qt(i){for(;i;){if(i.nextSibling)return i.nextSibling;i=i.parentNode}}function pi(i,o){for(var f=zt(i),m=0,y=0;f;){if(f.nodeType===Hs){if(y=m+f.textContent.length,m<=o&&y>=o)return{node:f,offset:o-m};m=y}f=zt(Qt(f))}}function zn(i){var o=i.ownerDocument,f=o&&o.defaultView||window,m=f.getSelection&&f.getSelection();if(!m||m.rangeCount===0)return null;var y=m.anchorNode,C=m.anchorOffset,w=m.focusNode,P=m.focusOffset;try{y.nodeType,w.nodeType}catch{return null}return Zl(i,y,C,w,P)}function Zl(i,o,f,m,y){var C=0,w=-1,P=-1,D=0,F=0,B=i,ae=null;e:for(;;){for(var re=null;B===o&&(f===0||B.nodeType===Hs)&&(w=C+f),B===m&&(y===0||B.nodeType===Hs)&&(P=C+y),B.nodeType===Hs&&(C+=B.nodeValue.length),(re=B.firstChild)!==null;)ae=B,B=re;for(;;){if(B===i)break e;if(ae===o&&++D===f&&(w=C),ae===m&&++F===y&&(P=C),(re=B.nextSibling)!==null)break;B=ae,ae=B.parentNode}B=re}return w===-1||P===-1?null:{start:w,end:P}}function tE(i,o){var f=i.ownerDocument||document,m=f&&f.defaultView||window;if(m.getSelection){var y=m.getSelection(),C=i.textContent.length,w=Math.min(o.start,C),P=o.end===void 0?w:Math.min(o.end,C);if(!y.extend&&w>P){var D=P;P=w,w=D}var F=pi(i,w),B=pi(i,P);if(F&&B){if(y.rangeCount===1&&y.anchorNode===F.node&&y.anchorOffset===F.offset&&y.focusNode===B.node&&y.focusOffset===B.offset)return;var ae=f.createRange();ae.setStart(F.node,F.offset),y.removeAllRanges(),w>P?(y.addRange(ae),y.extend(B.node,B.offset)):(ae.setEnd(B.node,B.offset),y.addRange(ae))}}}function lU(i){return i&&i.nodeType===Hs}function uU(i,o){return!i||!o?!1:i===o?!0:lU(i)?!1:lU(o)?uU(i,o.parentNode):"contains"in i?i.contains(o):i.compareDocumentPosition?!!(i.compareDocumentPosition(o)&16):!1}function $te(i){return i&&i.ownerDocument&&uU(i.ownerDocument.documentElement,i)}function qte(i){try{return typeof i.contentWindow.location.href=="string"}catch{return!1}}function cU(){for(var i=window,o=Vs();o instanceof i.HTMLIFrameElement;){if(qte(o))i=o.contentWindow;else return o;o=Vs(i.document)}return o}function nE(i){var o=i&&i.nodeName&&i.nodeName.toLowerCase();return o&&(o==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||o==="textarea"||i.contentEditable==="true")}function Wte(){var i=cU();return{focusedElem:i,selectionRange:nE(i)?Yte(i):null}}function Gte(i){var o=cU(),f=i.focusedElem,m=i.selectionRange;if(o!==f&&$te(f)){m!==null&&nE(f)&&Kte(f,m);for(var y=[],C=f;C=C.parentNode;)C.nodeType===xa&&y.push({element:C,left:C.scrollLeft,top:C.scrollTop});typeof f.focus=="function"&&f.focus();for(var w=0;w<y.length;w++){var P=y[w];P.element.scrollLeft=P.left,P.element.scrollTop=P.top}}}function Yte(i){var o;return"selectionStart"in i?o={start:i.selectionStart,end:i.selectionEnd}:o=zn(i),o||{start:0,end:0}}function Kte(i,o){var f=o.start,m=o.end;m===void 0&&(m=f),"selectionStart"in i?(i.selectionStart=f,i.selectionEnd=Math.min(m,i.value.length)):tE(i,o)}var Zte=_r&&"documentMode"in document&&document.documentMode<=11;function Qte(){tn("onSelect",["focusout","contextmenu","dragend","focusin","keydown","keyup","mousedown","mouseup","selectionchange"])}var Fm=null,rE=null,Ly=null,iE=!1;function Xte(i){if("selectionStart"in i&&nE(i))return{start:i.selectionStart,end:i.selectionEnd};var o=i.ownerDocument&&i.ownerDocument.defaultView||window,f=o.getSelection();return{anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}}function Jte(i){return i.window===i?i.document:i.nodeType===$s?i:i.ownerDocument}function dU(i,o,f){var m=Jte(f);if(!(iE||Fm==null||Fm!==Vs(m))){var y=Xte(Fm);if(!Ly||!Ut(Ly,y)){Ly=y;var C=GC(rE,"onSelect");if(C.length>0){var w=new Ga("onSelect","select",null,o,f);i.push({event:w,listeners:C}),w.target=Fm}}}}function ene(i,o,f,m,y,C,w){var P=f?Hm(f):window;switch(o){case"focusin":(HC(P)||P.contentEditable==="true")&&(Fm=P,rE=f,Ly=null);break;case"focusout":Fm=null,rE=null,Ly=null;break;case"mousedown":iE=!0;break;case"contextmenu":case"mouseup":case"dragend":iE=!1,dU(i,m,y);break;case"selectionchange":if(Zte)break;case"keydown":case"keyup":dU(i,m,y)}}function $C(i,o){var f={};return f[i.toLowerCase()]=o.toLowerCase(),f["Webkit"+i]="webkit"+o,f["Moz"+i]="moz"+o,f}var jm={animationend:$C("Animation","AnimationEnd"),animationiteration:$C("Animation","AnimationIteration"),animationstart:$C("Animation","AnimationStart"),transitionend:$C("Transition","TransitionEnd")},aE={},fU={};_r&&(fU=document.createElement("div").style,"AnimationEvent"in window||(delete jm.animationend.animation,delete jm.animationiteration.animation,delete jm.animationstart.animation),"TransitionEvent"in window||delete jm.transitionend.transition);function qC(i){if(aE[i])return aE[i];if(!jm[i])return i;var o=jm[i];for(var f in o)if(o.hasOwnProperty(f)&&f in fU)return aE[i]=o[f];return i}var hU=qC("animationend"),pU=qC("animationiteration"),mU=qC("animationstart"),gU=qC("transitionend"),vU=new Map,yU=["abort","auxClick","cancel","canPlay","canPlayThrough","click","close","contextMenu","copy","cut","drag","dragEnd","dragEnter","dragExit","dragLeave","dragOver","dragStart","drop","durationChange","emptied","encrypted","ended","error","gotPointerCapture","input","invalid","keyDown","keyPress","keyUp","load","loadedData","loadedMetadata","loadStart","lostPointerCapture","mouseDown","mouseMove","mouseOut","mouseOver","mouseUp","paste","pause","play","playing","pointerCancel","pointerDown","pointerMove","pointerOut","pointerOver","pointerUp","progress","rateChange","reset","resize","seeked","seeking","stalled","submit","suspend","timeUpdate","touchCancel","touchEnd","touchStart","volumeChange","scroll","toggle","touchMove","waiting","wheel"];function Rd(i,o){vU.set(i,o),tn(o,[i])}function tne(){for(var i=0;i<yU.length;i++){var o=yU[i],f=o.toLowerCase(),m=o[0].toUpperCase()+o.slice(1);Rd(f,"on"+m)}Rd(hU,"onAnimationEnd"),Rd(pU,"onAnimationIteration"),Rd(mU,"onAnimationStart"),Rd("dblclick","onDoubleClick"),Rd("focusin","onFocus"),Rd("focusout","onBlur"),Rd(gU,"onTransitionEnd")}function nne(i,o,f,m,y,C,w){var P=vU.get(o);if(P!==void 0){var D=Ga,F=o;switch(o){case"keypress":if(wd(m)===0)return;case"keydown":case"keyup":D=K_;break;case"focusin":F="focus",D=Rm;break;case"focusout":F="blur",D=Rm;break;case"beforeblur":case"afterblur":D=Rm;break;case"click":if(m.button===2)return;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":D=Em;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":D=xy;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":D=Q_;break;case hU:case pU:case mU:D=wy;break;case gU:D=Py;break;case"scroll":D=AC;break;case"wheel":D=Gl;break;case"copy":case"cut":case"paste":D=W_;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":D=Ry;break}var B=(C&Pu)!==0;{var ae=!B&&o==="scroll",re=one(f,P,m.type,B,ae);if(re.length>0){var ge=new D(P,F,null,m,y);i.push({event:ge,listeners:re})}}}}tne(),ie(),eE(),Qte(),jC();function rne(i,o,f,m,y,C,w){nne(i,o,f,m,y,C);var P=(C&Hv)===0;P&&(he(i,o,f,m,y),ue(i,o,f,m,y),ene(i,o,f,m,y),J_(i,o,f,m,y))}var Ny=["abort","canplay","canplaythrough","durationchange","emptied","encrypted","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","resize","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting"],oE=new Set(["cancel","close","invalid","load","scroll","toggle"].concat(Ny));function bU(i,o,f){var m=i.type||"unknown-event";i.currentTarget=f,If(m,o,void 0,i),i.currentTarget=null}function ine(i,o,f){var m;if(f)for(var y=o.length-1;y>=0;y--){var C=o[y],w=C.instance,P=C.currentTarget,D=C.listener;if(w!==m&&i.isPropagationStopped())return;bU(i,D,P),m=w}else for(var F=0;F<o.length;F++){var B=o[F],ae=B.instance,re=B.currentTarget,ge=B.listener;if(ae!==m&&i.isPropagationStopped())return;bU(i,ge,re),m=ae}}function SU(i,o){for(var f=(o&Pu)!==0,m=0;m<i.length;m++){var y=i[m],C=y.event,w=y.listeners;ine(C,w,f)}qs()}function ane(i,o,f,m,y){var C=Ip(f),w=[];rne(w,i,m,f,C,o),SU(w,o)}function Ir(i,o){oE.has(i)||c('Did not expect a listenToNonDelegatedEvent() call for "%s". This is a bug in React. Please file an issue.',i);var f=!1,m=Nre(o),y=une(i);m.has(y)||(CU(o,i,ss,f),m.add(y))}function sE(i,o,f){oE.has(i)&&!o&&c('Did not expect a listenToNativeEvent() call for "%s" in the bubble phase. This is a bug in React. Please file an issue.',i);var m=0;o&&(m|=Pu),CU(f,i,m,o)}var WC="_reactListening"+Math.random().toString(36).slice(2);function Iy(i){if(!i[WC]){i[WC]=!0,bt.forEach(function(f){f!=="selectionchange"&&(oE.has(f)||sE(f,!1,i),sE(f,!0,i))});var o=i.nodeType===$s?i:i.ownerDocument;o!==null&&(o[WC]||(o[WC]=!0,sE("selectionchange",!1,o)))}}function CU(i,o,f,m,y){var C=qa(i,o,f),w=void 0;Nf&&(o==="touchstart"||o==="touchmove"||o==="wheel")&&(w=!0),i=i,m?w!==void 0?Td(i,o,C,w):Ty(i,o,C):w!==void 0?Zs(i,o,C,w):Ma(i,o,C)}function kU(i,o){return i===o||i.nodeType===ti&&i.parentNode===o}function lE(i,o,f,m,y){var C=m;if(!(o&Bv)&&!(o&ss)){var w=y;if(m!==null){var P=m;e:for(;;){if(P===null)return;var D=P.tag;if(D===k||D===T){var F=P.stateNode.containerInfo;if(kU(F,w))break;if(D===T)for(var B=P.return;B!==null;){var ae=B.tag;if(ae===k||ae===T){var re=B.stateNode.containerInfo;if(kU(re,w))return}B=B.return}for(;F!==null;){var ge=vh(F);if(ge===null)return;var be=ge.tag;if(be===E||be===R){P=C=ge;continue e}F=F.parentNode}}P=P.return}}}nC(function(){return ane(i,o,f,C)})}function Uy(i,o,f){return{instance:i,listener:o,currentTarget:f}}function one(i,o,f,m,y,C){for(var w=o!==null?o+"Capture":null,P=m?w:o,D=[],F=i,B=null;F!==null;){var ae=F,re=ae.stateNode,ge=ae.tag;if(ge===E&&re!==null&&(B=re,P!==null)){var be=Au(F,P);be!=null&&D.push(Uy(F,be,B))}if(y)break;F=F.return}return D}function GC(i,o){for(var f=o+"Capture",m=[],y=i;y!==null;){var C=y,w=C.stateNode,P=C.tag;if(P===E&&w!==null){var D=w,F=Au(y,f);F!=null&&m.unshift(Uy(y,F,D));var B=Au(y,o);B!=null&&m.push(Uy(y,B,D))}y=y.return}return m}function Vm(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==E);return i||null}function sne(i,o){for(var f=i,m=o,y=0,C=f;C;C=Vm(C))y++;for(var w=0,P=m;P;P=Vm(P))w++;for(;y-w>0;)f=Vm(f),y--;for(;w-y>0;)m=Vm(m),w--;for(var D=y;D--;){if(f===m||m!==null&&f===m.alternate)return f;f=Vm(f),m=Vm(m)}return null}function TU(i,o,f,m,y){for(var C=o._reactName,w=[],P=f;P!==null&&P!==m;){var D=P,F=D.alternate,B=D.stateNode,ae=D.tag;if(F!==null&&F===m)break;if(ae===E&&B!==null){var re=B;if(y){var ge=Au(P,C);ge!=null&&w.unshift(Uy(P,ge,re))}else if(!y){var be=Au(P,C);be!=null&&w.push(Uy(P,be,re))}}P=P.return}w.length!==0&&i.push({event:o,listeners:w})}function lne(i,o,f,m,y){var C=m&&y?sne(m,y):null;m!==null&&TU(i,o,m,C,!1),y!==null&&f!==null&&TU(i,f,y,C,!0)}function une(i,o){return i+"__bubble"}var xo=!1,Fy="dangerouslySetInnerHTML",YC="suppressContentEditableWarning",Pd="suppressHydrationWarning",xU="autoFocus",mh="children",gh="style",KC="__html",uE,ZC,jy,wU,QC,_U,EU;uE={dialog:!0,webview:!0},ZC=function(i,o){ZS(i,o),rd(i,o),tC(i,o,{registrationNameDependencies:it,possibleRegistrationNames:xt})},_U=_r&&!document.documentMode,jy=function(i,o,f){if(!xo){var m=XC(f),y=XC(o);y!==m&&(xo=!0,c("Prop `%s` did not match. Server: %s Client: %s",i,JSON.stringify(y),JSON.stringify(m)))}},wU=function(i){if(!xo){xo=!0;var o=[];i.forEach(function(f){o.push(f)}),c("Extra attributes from the server: %s",o)}},QC=function(i,o){o===!1?c("Expected `%s` listener to be a function, instead got `false`.\n\nIf you used to conditionally omit it with %s={condition && value}, pass %s={condition ? value : undefined} instead.",i,i,i):c("Expected `%s` listener to be a function, instead got a value of `%s` type.",i,typeof o)},EU=function(i,o){var f=i.namespaceURI===Io?i.ownerDocument.createElement(i.tagName):i.ownerDocument.createElementNS(i.namespaceURI,i.tagName);return f.innerHTML=o,f.innerHTML};var cne=/\r\n?/g,dne=/\u0000|\uFFFD/g;function XC(i){Ve(i);var o=typeof i=="string"?i:""+i;return o.replace(cne,`
|
|
128
|
+
`).replace(dne,"")}function JC(i,o,f,m){var y=XC(o),C=XC(i);if(C!==y&&(m&&(xo||(xo=!0,c('Text content did not match. Server: "%s" Client: "%s"',C,y))),f&&ve))throw new Error("Text content does not match server-rendered HTML.")}function RU(i){return i.nodeType===$s?i:i.ownerDocument}function fne(){}function ek(i){i.onclick=fne}function hne(i,o,f,m,y){for(var C in m)if(m.hasOwnProperty(C)){var w=m[C];if(C===gh)w&&Object.freeze(w),qS(o,w);else if(C===Fy){var P=w?w[KC]:void 0;P!=null&&MS(o,P)}else if(C===mh)if(typeof w=="string"){var D=i!=="textarea"||w!=="";D&&Pl(o,w)}else typeof w=="number"&&Pl(o,""+w);else C===YC||C===Pd||C===xU||(it.hasOwnProperty(C)?w!=null&&(typeof w!="function"&&QC(C,w),C==="onScroll"&&Ir("scroll",o)):w!=null&&It(o,C,w,y))}}function pne(i,o,f,m){for(var y=0;y<o.length;y+=2){var C=o[y],w=o[y+1];C===gh?qS(i,w):C===Fy?MS(i,w):C===mh?Pl(i,w):It(i,C,w,m)}}function mne(i,o,f,m){var y,C=RU(f),w,P=m;if(P===Io&&(P=Iv(i)),P===Io){if(y=Dl(i,o),!y&&i!==i.toLowerCase()&&c("<%s /> is using incorrect casing. Use PascalCase for React components, or lowercase for HTML elements.",i),i==="script"){var D=C.createElement("div");D.innerHTML="<script><\/script>";var F=D.firstChild;w=D.removeChild(F)}else if(typeof o.is=="string")w=C.createElement(i,{is:o.is});else if(w=C.createElement(i),i==="select"){var B=w;o.multiple?B.multiple=!0:o.size&&(B.size=o.size)}}else w=C.createElementNS(P,i);return P===Io&&!y&&Object.prototype.toString.call(w)==="[object HTMLUnknownElement]"&&!vr.call(uE,i)&&(uE[i]=!0,c("The tag <%s> is unrecognized in this browser. If you meant to render a React component, start its name with an uppercase letter.",i)),w}function gne(i,o){return RU(o).createTextNode(i)}function vne(i,o,f,m){var y=Dl(o,f);ZC(o,f);var C;switch(o){case"dialog":Ir("cancel",i),Ir("close",i),C=f;break;case"iframe":case"object":case"embed":Ir("load",i),C=f;break;case"video":case"audio":for(var w=0;w<Ny.length;w++)Ir(Ny[w],i);C=f;break;case"source":Ir("error",i),C=f;break;case"img":case"image":case"link":Ir("error",i),Ir("load",i),C=f;break;case"details":Ir("toggle",i),C=f;break;case"input":Zc(i,f),C=go(i,f),Ir("invalid",i);break;case"option":Kn(i,f),C=f;break;case"select":Tf(i,f),C=Ru(i,f),Ir("invalid",i);break;case"textarea":DS(i,f),C=Dp(i,f),Ir("invalid",i);break;default:C=f}switch(Lp(o,C),hne(o,i,m,C,y),o){case"input":mo(i),pe(i,f,!1);break;case"textarea":mo(i),OS(i);break;case"option":lr(i,f);break;case"select":Mv(i,f);break;default:typeof C.onClick=="function"&&ek(i);break}}function yne(i,o,f,m,y){ZC(o,m);var C=null,w,P;switch(o){case"input":w=go(i,f),P=go(i,m),C=[];break;case"select":w=Ru(i,f),P=Ru(i,m),C=[];break;case"textarea":w=Dp(i,f),P=Dp(i,m),C=[];break;default:w=f,P=m,typeof w.onClick!="function"&&typeof P.onClick=="function"&&ek(i);break}Lp(o,P);var D,F,B=null;for(D in w)if(!(P.hasOwnProperty(D)||!w.hasOwnProperty(D)||w[D]==null))if(D===gh){var ae=w[D];for(F in ae)ae.hasOwnProperty(F)&&(B||(B={}),B[F]="")}else D===Fy||D===mh||D===YC||D===Pd||D===xU||(it.hasOwnProperty(D)?C||(C=[]):(C=C||[]).push(D,null));for(D in P){var re=P[D],ge=w!=null?w[D]:void 0;if(!(!P.hasOwnProperty(D)||re===ge||re==null&&ge==null))if(D===gh)if(re&&Object.freeze(re),ge){for(F in ge)ge.hasOwnProperty(F)&&(!re||!re.hasOwnProperty(F))&&(B||(B={}),B[F]="");for(F in re)re.hasOwnProperty(F)&&ge[F]!==re[F]&&(B||(B={}),B[F]=re[F])}else B||(C||(C=[]),C.push(D,B)),B=re;else if(D===Fy){var be=re?re[KC]:void 0,we=ge?ge[KC]:void 0;be!=null&&we!==be&&(C=C||[]).push(D,be)}else D===mh?(typeof re=="string"||typeof re=="number")&&(C=C||[]).push(D,""+re):D===YC||D===Pd||(it.hasOwnProperty(D)?(re!=null&&(typeof re!="function"&&QC(D,re),D==="onScroll"&&Ir("scroll",i)),!C&&ge!==re&&(C=[])):(C=C||[]).push(D,re))}return B&&(Uo(B,P[gh]),(C=C||[]).push(gh,B)),C}function bne(i,o,f,m,y){f==="input"&&y.type==="radio"&&y.name!=null&&O(i,y);var C=Dl(f,m),w=Dl(f,y);switch(pne(i,o,C,w),f){case"input":Y(i,y);break;case"textarea":AS(i,y);break;case"select":Pp(i,y);break}}function Sne(i){{var o=i.toLowerCase();return ed.hasOwnProperty(o)&&ed[o]||null}}function Cne(i,o,f,m,y,C,w){var P,D;switch(P=Dl(o,f),ZC(o,f),o){case"dialog":Ir("cancel",i),Ir("close",i);break;case"iframe":case"object":case"embed":Ir("load",i);break;case"video":case"audio":for(var F=0;F<Ny.length;F++)Ir(Ny[F],i);break;case"source":Ir("error",i);break;case"img":case"image":case"link":Ir("error",i),Ir("load",i);break;case"details":Ir("toggle",i);break;case"input":Zc(i,f),Ir("invalid",i);break;case"option":Kn(i,f);break;case"select":Tf(i,f),Ir("invalid",i);break;case"textarea":DS(i,f),Ir("invalid",i);break}Lp(o,f);{D=new Set;for(var B=i.attributes,ae=0;ae<B.length;ae++){var re=B[ae].name.toLowerCase();switch(re){case"value":break;case"checked":break;case"selected":break;default:D.add(B[ae].name)}}}var ge=null;for(var be in f)if(f.hasOwnProperty(be)){var we=f[be];if(be===mh)typeof we=="string"?i.textContent!==we&&(f[Pd]!==!0&&JC(i.textContent,we,C,w),ge=[mh,we]):typeof we=="number"&&i.textContent!==""+we&&(f[Pd]!==!0&&JC(i.textContent,we,C,w),ge=[mh,""+we]);else if(it.hasOwnProperty(be))we!=null&&(typeof we!="function"&&QC(be,we),be==="onScroll"&&Ir("scroll",i));else if(w&&typeof P=="boolean"){var st=void 0,Vt=Jn(be);if(f[Pd]!==!0){if(!(be===YC||be===Pd||be==="value"||be==="checked"||be==="selected")){if(be===Fy){var Pt=i.innerHTML,Ln=we?we[KC]:void 0;if(Ln!=null){var wn=EU(i,Ln);wn!==Pt&&jy(be,Pt,wn)}}else if(be===gh){if(D.delete(be),_U){var ce=I_(we);st=i.getAttribute("style"),ce!==st&&jy(be,st,ce)}}else if(P&&!Ce)D.delete(be.toLowerCase()),st=Me(i,be,we),we!==st&&jy(be,st,we);else if(!un(be,Vt,P)&&!Wn(be,we,Vt,P)){var _e=!1;if(Vt!==null)D.delete(Vt.attributeName),st=et(i,be,we,Vt);else{var de=m;if(de===Io&&(de=Iv(o)),de===Io)D.delete(be.toLowerCase());else{var qe=Sne(be);qe!==null&&qe!==be&&(_e=!0,D.delete(qe)),D.delete(be)}st=Me(i,be,we)}var yt=Ce;!yt&&we!==st&&!_e&&jy(be,st,we)}}}}}switch(w&&D.size>0&&f[Pd]!==!0&&wU(D),o){case"input":mo(i),pe(i,f,!0);break;case"textarea":mo(i),OS(i);break;case"select":case"option":break;default:typeof f.onClick=="function"&&ek(i);break}return ge}function kne(i,o,f){var m=i.nodeValue!==o;return m}function cE(i,o){{if(xo)return;xo=!0,c("Did not expect server HTML to contain a <%s> in <%s>.",o.nodeName.toLowerCase(),i.nodeName.toLowerCase())}}function dE(i,o){{if(xo)return;xo=!0,c('Did not expect server HTML to contain the text node "%s" in <%s>.',o.nodeValue,i.nodeName.toLowerCase())}}function fE(i,o,f){{if(xo)return;xo=!0,c("Expected server HTML to contain a matching <%s> in <%s>.",o,i.nodeName.toLowerCase())}}function hE(i,o){{if(o===""||xo)return;xo=!0,c('Expected server HTML to contain a matching text node for "%s" in <%s>.',o,i.nodeName.toLowerCase())}}function Tne(i,o,f){switch(o){case"input":Te(i,f);return;case"textarea":P_(i,f);return;case"select":Lv(i,f);return}}var Vy=function(){},zy=function(){};{var xne=["address","applet","area","article","aside","base","basefont","bgsound","blockquote","body","br","button","caption","center","col","colgroup","dd","details","dir","div","dl","dt","embed","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","iframe","img","input","isindex","li","link","listing","main","marquee","menu","menuitem","meta","nav","noembed","noframes","noscript","object","ol","p","param","plaintext","pre","script","section","select","source","style","summary","table","tbody","td","template","textarea","tfoot","th","thead","title","tr","track","ul","wbr","xmp"],PU=["applet","caption","html","table","td","th","marquee","object","template","foreignObject","desc","title"],wne=PU.concat(["button"]),_ne=["dd","dt","li","option","optgroup","p","rp","rt"],DU={current:null,formTag:null,aTagInScope:null,buttonTagInScope:null,nobrTagInScope:null,pTagInButtonScope:null,listItemTagAutoclosing:null,dlItemTagAutoclosing:null};zy=function(i,o){var f=rn({},i||DU),m={tag:o};return PU.indexOf(o)!==-1&&(f.aTagInScope=null,f.buttonTagInScope=null,f.nobrTagInScope=null),wne.indexOf(o)!==-1&&(f.pTagInButtonScope=null),xne.indexOf(o)!==-1&&o!=="address"&&o!=="div"&&o!=="p"&&(f.listItemTagAutoclosing=null,f.dlItemTagAutoclosing=null),f.current=m,o==="form"&&(f.formTag=m),o==="a"&&(f.aTagInScope=m),o==="button"&&(f.buttonTagInScope=m),o==="nobr"&&(f.nobrTagInScope=m),o==="p"&&(f.pTagInButtonScope=m),o==="li"&&(f.listItemTagAutoclosing=m),(o==="dd"||o==="dt")&&(f.dlItemTagAutoclosing=m),f};var Ene=function(i,o){switch(o){case"select":return i==="option"||i==="optgroup"||i==="#text";case"optgroup":return i==="option"||i==="#text";case"option":return i==="#text";case"tr":return i==="th"||i==="td"||i==="style"||i==="script"||i==="template";case"tbody":case"thead":case"tfoot":return i==="tr"||i==="style"||i==="script"||i==="template";case"colgroup":return i==="col"||i==="template";case"table":return i==="caption"||i==="colgroup"||i==="tbody"||i==="tfoot"||i==="thead"||i==="style"||i==="script"||i==="template";case"head":return i==="base"||i==="basefont"||i==="bgsound"||i==="link"||i==="meta"||i==="title"||i==="noscript"||i==="noframes"||i==="style"||i==="script"||i==="template";case"html":return i==="head"||i==="body"||i==="frameset";case"frameset":return i==="frame";case"#document":return i==="html"}switch(i){case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":return o!=="h1"&&o!=="h2"&&o!=="h3"&&o!=="h4"&&o!=="h5"&&o!=="h6";case"rp":case"rt":return _ne.indexOf(o)===-1;case"body":case"caption":case"col":case"colgroup":case"frameset":case"frame":case"head":case"html":case"tbody":case"td":case"tfoot":case"th":case"thead":case"tr":return o==null}return!0},Rne=function(i,o){switch(i){case"address":case"article":case"aside":case"blockquote":case"center":case"details":case"dialog":case"dir":case"div":case"dl":case"fieldset":case"figcaption":case"figure":case"footer":case"header":case"hgroup":case"main":case"menu":case"nav":case"ol":case"p":case"section":case"summary":case"ul":case"pre":case"listing":case"table":case"hr":case"xmp":case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":return o.pTagInButtonScope;case"form":return o.formTag||o.pTagInButtonScope;case"li":return o.listItemTagAutoclosing;case"dd":case"dt":return o.dlItemTagAutoclosing;case"button":return o.buttonTagInScope;case"a":return o.aTagInScope;case"nobr":return o.nobrTagInScope}return null},AU={};Vy=function(i,o,f){f=f||DU;var m=f.current,y=m&&m.tag;o!=null&&(i!=null&&c("validateDOMNesting: when childText is passed, childTag should be null"),i="#text");var C=Ene(i,y)?null:m,w=C?null:Rne(i,f),P=C||w;if(P){var D=P.tag,F=!!C+"|"+i+"|"+D;if(!AU[F]){AU[F]=!0;var B=i,ae="";if(i==="#text"?/\S/.test(o)?B="Text nodes":(B="Whitespace text nodes",ae=" Make sure you don't have any extra whitespace between tags on each line of your source code."):B="<"+i+">",C){var re="";D==="table"&&i==="tr"&&(re+=" Add a <tbody>, <thead> or <tfoot> to your code to match the DOM tree generated by the browser."),c("validateDOMNesting(...): %s cannot appear as a child of <%s>.%s%s",B,D,ae,re)}else c("validateDOMNesting(...): %s cannot appear as a descendant of <%s>.",B,D)}}}}var tk="suppressHydrationWarning",nk="$",rk="/$",By="$?",Hy="$!",Pne="style",pE=null,mE=null;function Dne(i){var o,f,m=i.nodeType;switch(m){case $s:case xf:{o=m===$s?"#document":"#fragment";var y=i.documentElement;f=y?y.namespaceURI:Ap(null,"");break}default:{var C=m===ti?i.parentNode:i,w=C.namespaceURI||null;o=C.tagName,f=Ap(w,o);break}}{var P=o.toLowerCase(),D=zy(null,P);return{namespace:f,ancestorInfo:D}}}function Ane(i,o,f){{var m=i,y=Ap(m.namespace,o),C=zy(m.ancestorInfo,o);return{namespace:y,ancestorInfo:C}}}function ele(i){return i}function One(i){pE=Oi(),mE=Wte();var o=null;return Kr(!1),o}function Mne(i){Gte(mE),Kr(pE),pE=null,mE=null}function Lne(i,o,f,m,y){var C;{var w=m;if(Vy(i,null,w.ancestorInfo),typeof o.children=="string"||typeof o.children=="number"){var P=""+o.children,D=zy(w.ancestorInfo,i);Vy(null,P,D)}C=w.namespace}var F=mne(i,o,f,C);return Wy(y,F),TE(F,o),F}function Nne(i,o){i.appendChild(o)}function Ine(i,o,f,m,y){switch(vne(i,o,f,m),o){case"button":case"input":case"select":case"textarea":return!!f.autoFocus;case"img":return!0;default:return!1}}function Une(i,o,f,m,y,C){{var w=C;if(typeof m.children!=typeof f.children&&(typeof m.children=="string"||typeof m.children=="number")){var P=""+m.children,D=zy(w.ancestorInfo,o);Vy(null,P,D)}}return yne(i,o,f,m)}function gE(i,o){return i==="textarea"||i==="noscript"||typeof o.children=="string"||typeof o.children=="number"||typeof o.dangerouslySetInnerHTML=="object"&&o.dangerouslySetInnerHTML!==null&&o.dangerouslySetInnerHTML.__html!=null}function Fne(i,o,f,m){{var y=f;Vy(null,i,y.ancestorInfo)}var C=gne(i,o);return Wy(m,C),C}function jne(){var i=window.event;return i===void 0?Di:kd(i.type)}var vE=typeof setTimeout=="function"?setTimeout:void 0,Vne=typeof clearTimeout=="function"?clearTimeout:void 0,yE=-1,OU=typeof Promise=="function"?Promise:void 0,zne=typeof queueMicrotask=="function"?queueMicrotask:typeof OU<"u"?function(i){return OU.resolve(null).then(i).catch(Bne)}:vE;function Bne(i){setTimeout(function(){throw i})}function Hne(i,o,f,m){switch(o){case"button":case"input":case"select":case"textarea":f.autoFocus&&i.focus();return;case"img":{f.src&&(i.src=f.src);return}}}function $ne(i,o,f,m,y,C){bne(i,o,f,m,y),TE(i,y)}function MU(i){Pl(i,"")}function qne(i,o,f){i.nodeValue=f}function Wne(i,o){i.appendChild(o)}function Gne(i,o){var f;i.nodeType===ti?(f=i.parentNode,f.insertBefore(o,i)):(f=i,f.appendChild(o));var m=i._reactRootContainer;m==null&&f.onclick===null&&ek(f)}function Yne(i,o,f){i.insertBefore(o,f)}function Kne(i,o,f){i.nodeType===ti?i.parentNode.insertBefore(o,f):i.insertBefore(o,f)}function Zne(i,o){i.removeChild(o)}function Qne(i,o){i.nodeType===ti?i.parentNode.removeChild(o):i.removeChild(o)}function bE(i,o){var f=o,m=0;do{var y=f.nextSibling;if(i.removeChild(f),y&&y.nodeType===ti){var C=y.data;if(C===rk)if(m===0){i.removeChild(y),Zi(o);return}else m--;else(C===nk||C===By||C===Hy)&&m++}f=y}while(f);Zi(o)}function Xne(i,o){i.nodeType===ti?bE(i.parentNode,o):i.nodeType===xa&&bE(i,o),Zi(i)}function Jne(i){i=i;var o=i.style;typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none"}function ere(i){i.nodeValue=""}function tre(i,o){i=i;var f=o[Pne],m=f!=null&&f.hasOwnProperty("display")?f.display:null;i.style.display=Mp("display",m)}function nre(i,o){i.nodeValue=o}function rre(i){i.nodeType===xa?i.textContent="":i.nodeType===$s&&i.documentElement&&i.removeChild(i.documentElement)}function ire(i,o,f){return i.nodeType!==xa||o.toLowerCase()!==i.nodeName.toLowerCase()?null:i}function are(i,o){return o===""||i.nodeType!==Hs?null:i}function ore(i){return i.nodeType!==ti?null:i}function LU(i){return i.data===By}function SE(i){return i.data===Hy}function sre(i){var o=i.nextSibling&&i.nextSibling.dataset,f,m,y;return o&&(f=o.dgst,m=o.msg,y=o.stck),{message:m,digest:f,stack:y}}function lre(i,o){i._reactRetry=o}function ik(i){for(;i!=null;i=i.nextSibling){var o=i.nodeType;if(o===xa||o===Hs)break;if(o===ti){var f=i.data;if(f===nk||f===Hy||f===By)break;if(f===rk)return null}}return i}function $y(i){return ik(i.nextSibling)}function ure(i){return ik(i.firstChild)}function cre(i){return ik(i.firstChild)}function dre(i){return ik(i.nextSibling)}function fre(i,o,f,m,y,C,w){Wy(C,i),TE(i,f);var P;{var D=y;P=D.namespace}var F=(C.mode&vn)!==Mt;return Cne(i,o,f,P,m,F,w)}function hre(i,o,f,m){return Wy(f,i),f.mode&vn,kne(i,o)}function pre(i,o){Wy(o,i)}function mre(i){for(var o=i.nextSibling,f=0;o;){if(o.nodeType===ti){var m=o.data;if(m===rk){if(f===0)return $y(o);f--}else(m===nk||m===Hy||m===By)&&f++}o=o.nextSibling}return null}function NU(i){for(var o=i.previousSibling,f=0;o;){if(o.nodeType===ti){var m=o.data;if(m===nk||m===Hy||m===By){if(f===0)return o;f--}else m===rk&&f++}o=o.previousSibling}return null}function gre(i){Zi(i)}function vre(i){Zi(i)}function yre(i){return i!=="head"&&i!=="body"}function bre(i,o,f,m){var y=!0;JC(o.nodeValue,f,m,y)}function Sre(i,o,f,m,y,C){if(o[tk]!==!0){var w=!0;JC(m.nodeValue,y,C,w)}}function Cre(i,o){o.nodeType===xa?cE(i,o):o.nodeType===ti||dE(i,o)}function kre(i,o){{var f=i.parentNode;f!==null&&(o.nodeType===xa?cE(f,o):o.nodeType===ti||dE(f,o))}}function Tre(i,o,f,m,y){(y||o[tk]!==!0)&&(m.nodeType===xa?cE(f,m):m.nodeType===ti||dE(f,m))}function xre(i,o,f){fE(i,o)}function wre(i,o){hE(i,o)}function _re(i,o,f){{var m=i.parentNode;m!==null&&fE(m,o)}}function Ere(i,o){{var f=i.parentNode;f!==null&&hE(f,o)}}function Rre(i,o,f,m,y,C){(C||o[tk]!==!0)&&fE(f,m)}function Pre(i,o,f,m,y){(y||o[tk]!==!0)&&hE(f,m)}function Dre(i){c("An error occurred during hydration. The server HTML was replaced with client content in <%s>.",i.nodeName.toLowerCase())}function Are(i){Iy(i)}var zm=Math.random().toString(36).slice(2),Bm="__reactFiber$"+zm,CE="__reactProps$"+zm,qy="__reactContainer$"+zm,kE="__reactEvents$"+zm,Ore="__reactListeners$"+zm,Mre="__reactHandles$"+zm;function Lre(i){delete i[Bm],delete i[CE],delete i[kE],delete i[Ore],delete i[Mre]}function Wy(i,o){o[Bm]=i}function ak(i,o){o[qy]=i}function IU(i){i[qy]=null}function Gy(i){return!!i[qy]}function vh(i){var o=i[Bm];if(o)return o;for(var f=i.parentNode;f;){if(o=f[qy]||f[Bm],o){var m=o.alternate;if(o.child!==null||m!==null&&m.child!==null)for(var y=NU(i);y!==null;){var C=y[Bm];if(C)return C;y=NU(y)}return o}i=f,f=i.parentNode}return null}function Dd(i){var o=i[Bm]||i[qy];return o&&(o.tag===E||o.tag===R||o.tag===N||o.tag===k)?o:null}function Hm(i){if(i.tag===E||i.tag===R)return i.stateNode;throw new Error("getNodeFromInstance: Invalid argument.")}function ok(i){return i[CE]||null}function TE(i,o){i[CE]=o}function Nre(i){var o=i[kE];return o===void 0&&(o=i[kE]=new Set),o}var UU={},FU=r.ReactDebugCurrentFrame;function sk(i){if(i){var o=i._owner,f=yf(i.type,i._source,o?o.type:null);FU.setExtraStackFrame(f)}else FU.setExtraStackFrame(null)}function Qs(i,o,f,m,y){{var C=Function.call.bind(vr);for(var w in i)if(C(i,w)){var P=void 0;try{if(typeof i[w]!="function"){var D=Error((m||"React class")+": "+f+" type `"+w+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[w]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw D.name="Invariant Violation",D}P=i[w](o,w,m,f,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(F){P=F}P&&!(P instanceof Error)&&(sk(y),c("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",m||"React class",f,w,typeof P),sk(null)),P instanceof Error&&!(P.message in UU)&&(UU[P.message]=!0,sk(y),c("Failed %s type: %s",f,P.message),sk(null))}}}var xE=[],lk;lk=[];var ec=-1;function Ad(i){return{current:i}}function La(i,o){if(ec<0){c("Unexpected pop.");return}o!==lk[ec]&&c("Unexpected Fiber popped."),i.current=xE[ec],xE[ec]=null,lk[ec]=null,ec--}function Na(i,o,f){ec++,xE[ec]=i.current,lk[ec]=f,i.current=o}var wE;wE={};var $o={};Object.freeze($o);var tc=Ad($o),Ql=Ad(!1),_E=$o;function $m(i,o,f){return f&&Xl(o)?_E:tc.current}function jU(i,o,f){{var m=i.stateNode;m.__reactInternalMemoizedUnmaskedChildContext=o,m.__reactInternalMemoizedMaskedChildContext=f}}function qm(i,o){{var f=i.type,m=f.contextTypes;if(!m)return $o;var y=i.stateNode;if(y&&y.__reactInternalMemoizedUnmaskedChildContext===o)return y.__reactInternalMemoizedMaskedChildContext;var C={};for(var w in m)C[w]=o[w];{var P=Zt(i)||"Unknown";Qs(m,C,"context",P)}return y&&jU(i,o,C),C}}function uk(){return Ql.current}function Xl(i){{var o=i.childContextTypes;return o!=null}}function ck(i){La(Ql,i),La(tc,i)}function EE(i){La(Ql,i),La(tc,i)}function VU(i,o,f){{if(tc.current!==$o)throw new Error("Unexpected context found on stack. This error is likely caused by a bug in React. Please file an issue.");Na(tc,o,i),Na(Ql,f,i)}}function zU(i,o,f){{var m=i.stateNode,y=o.childContextTypes;if(typeof m.getChildContext!="function"){{var C=Zt(i)||"Unknown";wE[C]||(wE[C]=!0,c("%s.childContextTypes is specified but there is no getChildContext() method on the instance. You can either define getChildContext() on %s or remove childContextTypes from it.",C,C))}return f}var w=m.getChildContext();for(var P in w)if(!(P in y))throw new Error((Zt(i)||"Unknown")+'.getChildContext(): key "'+P+'" is not defined in childContextTypes.');{var D=Zt(i)||"Unknown";Qs(y,w,"child context",D)}return rn({},f,w)}}function dk(i){{var o=i.stateNode,f=o&&o.__reactInternalMemoizedMergedChildContext||$o;return _E=tc.current,Na(tc,f,i),Na(Ql,Ql.current,i),!0}}function BU(i,o,f){{var m=i.stateNode;if(!m)throw new Error("Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue.");if(f){var y=zU(i,o,_E);m.__reactInternalMemoizedMergedChildContext=y,La(Ql,i),La(tc,i),Na(tc,y,i),Na(Ql,f,i)}else La(Ql,i),Na(Ql,f,i)}}function Ire(i){{if(!oC(i)||i.tag!==v)throw new Error("Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue.");var o=i;do{switch(o.tag){case k:return o.stateNode.context;case v:{var f=o.type;if(Xl(f))return o.stateNode.__reactInternalMemoizedMergedChildContext;break}}o=o.return}while(o!==null);throw new Error("Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue.")}}var Od=0,fk=1,nc=null,RE=!1,PE=!1;function HU(i){nc===null?nc=[i]:nc.push(i)}function Ure(i){RE=!0,HU(i)}function $U(){RE&&Md()}function Md(){if(!PE&&nc!==null){PE=!0;var i=0,o=$a();try{var f=!0,m=nc;for(fi(Oa);i<m.length;i++){var y=m[i];do y=y(f);while(y!==null)}nc=null,RE=!1}catch(C){throw nc!==null&&(nc=nc.slice(i+1)),Qv(Gs,Md),C}finally{fi(o),PE=!1}}return null}var Wm=[],Gm=0,hk=null,pk=0,ps=[],ms=0,yh=null,rc=1,ic="";function Fre(i){return Sh(),(i.flags&Ff)!==Ot}function jre(i){return Sh(),pk}function Vre(){var i=ic,o=rc,f=o&~zre(o);return f.toString(32)+i}function bh(i,o){Sh(),Wm[Gm++]=pk,Wm[Gm++]=hk,hk=i,pk=o}function qU(i,o,f){Sh(),ps[ms++]=rc,ps[ms++]=ic,ps[ms++]=yh,yh=i;var m=rc,y=ic,C=mk(m)-1,w=m&~(1<<C),P=f+1,D=mk(o)+C;if(D>30){var F=C-C%5,B=(1<<F)-1,ae=(w&B).toString(32),re=w>>F,ge=C-F,be=mk(o)+ge,we=P<<ge,st=we|re,Vt=ae+y;rc=1<<be|st,ic=Vt}else{var Pt=P<<C,Ln=Pt|w,wn=y;rc=1<<D|Ln,ic=wn}}function DE(i){Sh();var o=i.return;if(o!==null){var f=1,m=0;bh(i,f),qU(i,f,m)}}function mk(i){return 32-di(i)}function zre(i){return 1<<mk(i)-1}function AE(i){for(;i===hk;)hk=Wm[--Gm],Wm[Gm]=null,pk=Wm[--Gm],Wm[Gm]=null;for(;i===yh;)yh=ps[--ms],ps[ms]=null,ic=ps[--ms],ps[ms]=null,rc=ps[--ms],ps[ms]=null}function Bre(){return Sh(),yh!==null?{id:rc,overflow:ic}:null}function Hre(i,o){Sh(),ps[ms++]=rc,ps[ms++]=ic,ps[ms++]=yh,rc=o.id,ic=o.overflow,yh=i}function Sh(){la()||c("Expected to be hydrating. This is a bug in React. Please file an issue.")}var sa=null,gs=null,Xs=!1,Ch=!1,Ld=null;function $re(){Xs&&c("We should not be hydrating here. This is a bug in React. Please file a bug.")}function WU(){Ch=!0}function qre(){return Ch}function Wre(i){var o=i.stateNode.containerInfo;return gs=cre(o),sa=i,Xs=!0,Ld=null,Ch=!1,!0}function Gre(i,o,f){return gs=dre(o),sa=i,Xs=!0,Ld=null,Ch=!1,f!==null&&Hre(i,f),!0}function GU(i,o){switch(i.tag){case k:{Cre(i.stateNode.containerInfo,o);break}case E:{var f=(i.mode&vn)!==Mt;Tre(i.type,i.memoizedProps,i.stateNode,o,f);break}case N:{var m=i.memoizedState;m.dehydrated!==null&&kre(m.dehydrated,o);break}}}function YU(i,o){GU(i,o);var f=Qoe();f.stateNode=o,f.return=i;var m=i.deletions;m===null?(i.deletions=[f],i.flags|=wa):m.push(f)}function OE(i,o){{if(Ch)return;switch(i.tag){case k:{var f=i.stateNode.containerInfo;switch(o.tag){case E:var m=o.type;o.pendingProps,xre(f,m);break;case R:var y=o.pendingProps;wre(f,y);break}break}case E:{var C=i.type,w=i.memoizedProps,P=i.stateNode;switch(o.tag){case E:{var D=o.type,F=o.pendingProps,B=(i.mode&vn)!==Mt;Rre(C,w,P,D,F,B);break}case R:{var ae=o.pendingProps,re=(i.mode&vn)!==Mt;Pre(C,w,P,ae,re);break}}break}case N:{var ge=i.memoizedState,be=ge.dehydrated;if(be!==null)switch(o.tag){case E:var we=o.type;o.pendingProps,_re(be,we);break;case R:var st=o.pendingProps;Ere(be,st);break}break}default:return}}}function KU(i,o){o.flags=o.flags&~Vr|jr,OE(i,o)}function ZU(i,o){switch(i.tag){case E:{var f=i.type;i.pendingProps;var m=ire(o,f);return m!==null?(i.stateNode=m,sa=i,gs=ure(m),!0):!1}case R:{var y=i.pendingProps,C=are(o,y);return C!==null?(i.stateNode=C,sa=i,gs=null,!0):!1}case N:{var w=ore(o);if(w!==null){var P={dehydrated:w,treeContext:Bre(),retryLane:Pa};i.memoizedState=P;var D=Xoe(w);return D.return=i,i.child=D,sa=i,gs=null,!0}return!1}default:return!1}}function ME(i){return(i.mode&vn)!==Mt&&(i.flags&pn)===Ot}function LE(i){throw new Error("Hydration failed because the initial UI does not match what was rendered on the server.")}function NE(i){if(Xs){var o=gs;if(!o){ME(i)&&(OE(sa,i),LE()),KU(sa,i),Xs=!1,sa=i;return}var f=o;if(!ZU(i,o)){ME(i)&&(OE(sa,i),LE()),o=$y(f);var m=sa;if(!o||!ZU(i,o)){KU(sa,i),Xs=!1,sa=i;return}YU(m,f)}}}function Yre(i,o,f){var m=i.stateNode,y=!Ch,C=fre(m,i.type,i.memoizedProps,o,f,i,y);return i.updateQueue=C,C!==null}function Kre(i){var o=i.stateNode,f=i.memoizedProps,m=hre(o,f,i);if(m){var y=sa;if(y!==null)switch(y.tag){case k:{var C=y.stateNode.containerInfo,w=(y.mode&vn)!==Mt;bre(C,o,f,w);break}case E:{var P=y.type,D=y.memoizedProps,F=y.stateNode,B=(y.mode&vn)!==Mt;Sre(P,D,F,o,f,B);break}}}return m}function Zre(i){var o=i.memoizedState,f=o!==null?o.dehydrated:null;if(!f)throw new Error("Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue.");pre(f,i)}function Qre(i){var o=i.memoizedState,f=o!==null?o.dehydrated:null;if(!f)throw new Error("Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue.");return mre(f)}function QU(i){for(var o=i.return;o!==null&&o.tag!==E&&o.tag!==k&&o.tag!==N;)o=o.return;sa=o}function gk(i){if(i!==sa)return!1;if(!Xs)return QU(i),Xs=!0,!1;if(i.tag!==k&&(i.tag!==E||yre(i.type)&&!gE(i.type,i.memoizedProps))){var o=gs;if(o)if(ME(i))XU(i),LE();else for(;o;)YU(i,o),o=$y(o)}return QU(i),i.tag===N?gs=Qre(i):gs=sa?$y(i.stateNode):null,!0}function Xre(){return Xs&&gs!==null}function XU(i){for(var o=gs;o;)GU(i,o),o=$y(o)}function Ym(){sa=null,gs=null,Xs=!1,Ch=!1}function JU(){Ld!==null&&(W9(Ld),Ld=null)}function la(){return Xs}function IE(i){Ld===null?Ld=[i]:Ld.push(i)}var Jre=r.ReactCurrentBatchConfig,eie=null;function tie(){return Jre.transition}var Js={recordUnsafeLifecycleWarnings:function(i,o){},flushPendingUnsafeLifecycleWarnings:function(){},recordLegacyContextWarning:function(i,o){},flushLegacyContextWarning:function(){},discardPendingWarnings:function(){}};{var nie=function(i){for(var o=null,f=i;f!==null;)f.mode&an&&(o=f),f=f.return;return o},kh=function(i){var o=[];return i.forEach(function(f){o.push(f)}),o.sort().join(", ")},Yy=[],Ky=[],Zy=[],Qy=[],Xy=[],Jy=[],Th=new Set;Js.recordUnsafeLifecycleWarnings=function(i,o){Th.has(i.type)||(typeof o.componentWillMount=="function"&&o.componentWillMount.__suppressDeprecationWarning!==!0&&Yy.push(i),i.mode&an&&typeof o.UNSAFE_componentWillMount=="function"&&Ky.push(i),typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps.__suppressDeprecationWarning!==!0&&Zy.push(i),i.mode&an&&typeof o.UNSAFE_componentWillReceiveProps=="function"&&Qy.push(i),typeof o.componentWillUpdate=="function"&&o.componentWillUpdate.__suppressDeprecationWarning!==!0&&Xy.push(i),i.mode&an&&typeof o.UNSAFE_componentWillUpdate=="function"&&Jy.push(i))},Js.flushPendingUnsafeLifecycleWarnings=function(){var i=new Set;Yy.length>0&&(Yy.forEach(function(re){i.add(Zt(re)||"Component"),Th.add(re.type)}),Yy=[]);var o=new Set;Ky.length>0&&(Ky.forEach(function(re){o.add(Zt(re)||"Component"),Th.add(re.type)}),Ky=[]);var f=new Set;Zy.length>0&&(Zy.forEach(function(re){f.add(Zt(re)||"Component"),Th.add(re.type)}),Zy=[]);var m=new Set;Qy.length>0&&(Qy.forEach(function(re){m.add(Zt(re)||"Component"),Th.add(re.type)}),Qy=[]);var y=new Set;Xy.length>0&&(Xy.forEach(function(re){y.add(Zt(re)||"Component"),Th.add(re.type)}),Xy=[]);var C=new Set;if(Jy.length>0&&(Jy.forEach(function(re){C.add(Zt(re)||"Component"),Th.add(re.type)}),Jy=[]),o.size>0){var w=kh(o);c(`Using UNSAFE_componentWillMount in strict mode is not recommended and may indicate bugs in your code. See https://reactjs.org/link/unsafe-component-lifecycles for details.
|
|
129
129
|
|
|
130
130
|
* Move code with side effects to componentDidMount, and set initial state in the constructor.
|
|
131
131
|
|
|
@@ -154,17 +154,17 @@ Please update the following components: %s`,B)}if(y.size>0){var ae=kh(y);l(`comp
|
|
|
154
154
|
* Move data fetching code or side effects to componentDidUpdate.
|
|
155
155
|
* Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder.
|
|
156
156
|
|
|
157
|
-
Please update the following components: %s`,ae)}};var vk=new Map,eF=new Set;Js.recordLegacyContextWarning=function(i,o){var f=
|
|
157
|
+
Please update the following components: %s`,ae)}};var vk=new Map,eF=new Set;Js.recordLegacyContextWarning=function(i,o){var f=nie(i);if(f===null){c("Expected to find a StrictMode component in a strict mode tree. This error is likely caused by a bug in React. Please file an issue.");return}if(!eF.has(i.type)){var m=vk.get(f);(i.type.contextTypes!=null||i.type.childContextTypes!=null||o!==null&&typeof o.getChildContext=="function")&&(m===void 0&&(m=[],vk.set(f,m)),m.push(i))}},Js.flushLegacyContextWarning=function(){vk.forEach(function(i,o){if(i.length!==0){var f=i[0],m=new Set;i.forEach(function(C){m.add(Zt(C)||"Component"),eF.add(C.type)});var y=kh(m);try{sr(f),c(`Legacy context API has been detected within a strict-mode tree.
|
|
158
158
|
|
|
159
159
|
The old API will be supported in all 16.x releases, but applications using it should migrate to the new version.
|
|
160
160
|
|
|
161
161
|
Please update the following components: %s
|
|
162
162
|
|
|
163
|
-
Learn more about this warning here: https://reactjs.org/link/legacy-context`,y)}finally{Fr()}}})},Js.discardPendingWarnings=function(){Yy=[],Ky=[],Zy=[],Qy=[],Xy=[],Jy=[],vk=new Map}}var UE,FE,jE,VE,zE,tF=function(i,o){};UE=!1,FE=!1,jE={},VE={},zE={},tF=function(i,o){if(!(i===null||typeof i!="object")&&!(!i._store||i._store.validated||i.key!=null)){if(typeof i._store!="object")throw new Error("React Component in warnForMissingKey should have a _store. This error is likely caused by a bug in React. Please file an issue.");i._store.validated=!0;var f=Zt(o)||"Component";VE[f]||(VE[f]=!0,c('Each child in a list should have a unique "key" prop. See https://reactjs.org/link/warning-keys for more information.'))}};function
|
|
163
|
+
Learn more about this warning here: https://reactjs.org/link/legacy-context`,y)}finally{Fr()}}})},Js.discardPendingWarnings=function(){Yy=[],Ky=[],Zy=[],Qy=[],Xy=[],Jy=[],vk=new Map}}var UE,FE,jE,VE,zE,tF=function(i,o){};UE=!1,FE=!1,jE={},VE={},zE={},tF=function(i,o){if(!(i===null||typeof i!="object")&&!(!i._store||i._store.validated||i.key!=null)){if(typeof i._store!="object")throw new Error("React Component in warnForMissingKey should have a _store. This error is likely caused by a bug in React. Please file an issue.");i._store.validated=!0;var f=Zt(o)||"Component";VE[f]||(VE[f]=!0,c('Each child in a list should have a unique "key" prop. See https://reactjs.org/link/warning-keys for more information.'))}};function rie(i){return i.prototype&&i.prototype.isReactComponent}function e0(i,o,f){var m=f.ref;if(m!==null&&typeof m!="function"&&typeof m!="object"){if((i.mode&an||H)&&!(f._owner&&f._self&&f._owner.stateNode!==f._self)&&!(f._owner&&f._owner.tag!==v)&&!(typeof f.type=="function"&&!rie(f.type))&&f._owner){var y=Zt(i)||"Component";jE[y]||(c('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. We recommend using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',y,m),jE[y]=!0)}if(f._owner){var C=f._owner,w;if(C){var P=C;if(P.tag!==v)throw new Error("Function components cannot have string refs. We recommend using useRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref");w=P.stateNode}if(!w)throw new Error("Missing owner for string ref "+m+". This error is likely caused by a bug in React. Please file an issue.");var D=w;le(m,"ref");var F=""+m;if(o!==null&&o.ref!==null&&typeof o.ref=="function"&&o.ref._stringRef===F)return o.ref;var B=function(ae){var re=D.refs;ae===null?delete re[F]:re[F]=ae};return B._stringRef=F,B}else{if(typeof m!="string")throw new Error("Expected ref to be a function, a string, an object returned by React.createRef(), or null.");if(!f._owner)throw new Error("Element ref was specified as a string ("+m+`) but no owner was set. This could happen for one of the following reasons:
|
|
164
164
|
1. You may be adding a ref to a function component
|
|
165
165
|
2. You may be adding a ref to a component that was not created inside a component's render method
|
|
166
166
|
3. You have multiple copies of React loaded
|
|
167
|
-
See https://reactjs.org/link/refs-must-have-owner for more information.`)}}return m}function yk(i,o){var f=Object.prototype.toString.call(o);throw new Error("Objects are not valid as a React child (found: "+(f==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":f)+"). If you meant to render a collection of children, use an array instead.")}function bk(i){{var o=Zt(i)||"Component";if(zE[o])return;zE[o]=!0,c("Functions are not valid as a React child. This may happen if you return a Component instead of <Component /> from render. Or maybe you meant to call this function rather than return it.")}}function nF(i){var o=i._payload,f=i._init;return f(o)}function rF(i){function o(ce,_e){if(i){var de=ce.deletions;de===null?(ce.deletions=[_e],ce.flags|=wa):de.push(_e)}}function f(ce,_e){if(!i)return null;for(var de=_e;de!==null;)o(ce,de),de=de.sibling;return null}function m(ce,_e){for(var de=new Map,qe=_e;qe!==null;)qe.key!==null?de.set(qe.key,qe):de.set(qe.index,qe),qe=qe.sibling;return de}function y(ce,_e){var de=Oh(ce,_e);return de.index=0,de.sibling=null,de}function C(ce,_e,de){if(ce.index=de,!i)return ce.flags|=Ff,_e;var qe=ce.alternate;if(qe!==null){var yt=qe.index;return yt<_e?(ce.flags|=jr,_e):yt}else return ce.flags|=jr,_e}function w(ce){return i&&ce.alternate===null&&(ce.flags|=jr),ce}function P(ce,_e,de,qe){if(_e===null||_e.tag!==R){var yt=IP(de,ce.mode,qe);return yt.return=ce,yt}else{var ft=y(_e,de);return ft.return=ce,ft}}function D(ce,_e,de,qe){var yt=de.type;if(yt===jt)return B(ce,_e,de.props.children,qe,de.key);if(_e!==null&&(_e.elementType===yt||lj(_e,de)||typeof yt=="object"&&yt!==null&&yt.$$typeof===Jt&&nF(yt)===_e.type)){var ft=y(_e,de.props);return ft.ref=e0(ce,_e,de),ft.return=ce,ft._debugSource=de._source,ft._debugOwner=de._owner,ft}var Wt=NP(de,ce.mode,qe);return Wt.ref=e0(ce,_e,de),Wt.return=ce,Wt}function F(ce,_e,de,qe){if(_e===null||_e.tag!==T||_e.stateNode.containerInfo!==de.containerInfo||_e.stateNode.implementation!==de.implementation){var yt=UP(de,ce.mode,qe);return yt.return=ce,yt}else{var ft=y(_e,de.children||[]);return ft.return=ce,ft}}function B(ce,_e,de,qe,yt){if(_e===null||_e.tag!==M){var ft=qd(de,ce.mode,qe,yt);return ft.return=ce,ft}else{var Wt=y(_e,de);return Wt.return=ce,Wt}}function ae(ce,_e,de){if(typeof _e=="string"&&_e!==""||typeof _e=="number"){var qe=IP(""+_e,ce.mode,de);return qe.return=ce,qe}if(typeof _e=="object"&&_e!==null){switch(_e.$$typeof){case Ht:{var yt=NP(_e,ce.mode,de);return yt.ref=e0(ce,null,_e),yt.return=ce,yt}case Sn:{var ft=UP(_e,ce.mode,de);return ft.return=ce,ft}case Jt:{var Wt=_e._payload,nn=_e._init;return ae(ce,nn(Wt),de)}}if(on(_e)||Rr(_e)){var fr=qd(_e,ce.mode,de,null);return fr.return=ce,fr}yk(ce,_e)}return typeof _e=="function"&&bk(ce),null}function re(ce,_e,de,qe){var yt=_e!==null?_e.key:null;if(typeof de=="string"&&de!==""||typeof de=="number")return yt!==null?null:P(ce,_e,""+de,qe);if(typeof de=="object"&&de!==null){switch(de.$$typeof){case Ht:return de.key===yt?D(ce,_e,de,qe):null;case Sn:return de.key===yt?F(ce,_e,de,qe):null;case Jt:{var ft=de._payload,Wt=de._init;return re(ce,_e,Wt(ft),qe)}}if(on(de)||Rr(de))return yt!==null?null:B(ce,_e,de,qe,null);yk(ce,de)}return typeof de=="function"&&bk(ce),null}function ge(ce,_e,de,qe,yt){if(typeof qe=="string"&&qe!==""||typeof qe=="number"){var ft=ce.get(de)||null;return P(_e,ft,""+qe,yt)}if(typeof qe=="object"&&qe!==null){switch(qe.$$typeof){case Ht:{var Wt=ce.get(qe.key===null?de:qe.key)||null;return D(_e,Wt,qe,yt)}case Sn:{var nn=ce.get(qe.key===null?de:qe.key)||null;return F(_e,nn,qe,yt)}case Jt:var fr=qe._payload,Bn=qe._init;return ge(ce,_e,de,Bn(fr),yt)}if(on(qe)||Rr(qe)){var mi=ce.get(de)||null;return B(_e,mi,qe,yt,null)}yk(_e,qe)}return typeof qe=="function"&&bk(_e),null}function be(ce,_e,de){{if(typeof ce!="object"||ce===null)return _e;switch(ce.$$typeof){case Ht:case Sn:tF(ce,de);var qe=ce.key;if(typeof qe!="string")break;if(_e===null){_e=new Set,_e.add(qe);break}if(!_e.has(qe)){_e.add(qe);break}c("Encountered two children with the same key, `%s`. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted — the behavior is unsupported and could change in a future version.",qe);break;case Jt:var yt=ce._payload,ft=ce._init;be(ft(yt),_e,de);break}}return _e}function we(ce,_e,de,qe){for(var yt=null,ft=0;ft<de.length;ft++){var Wt=de[ft];yt=be(Wt,yt,ce)}for(var nn=null,fr=null,Bn=_e,mi=0,Hn=0,oi=null;Bn!==null&&Hn<de.length;Hn++){Bn.index>Hn?(oi=Bn,Bn=null):oi=Bn.sibling;var Ua=re(ce,Bn,de[Hn],qe);if(Ua===null){Bn===null&&(Bn=oi);break}i&&Bn&&Ua.alternate===null&&o(ce,Bn),mi=C(Ua,mi,Hn),fr===null?nn=Ua:fr.sibling=Ua,fr=Ua,Bn=oi}if(Hn===de.length){if(f(ce,Bn),la()){var ma=Hn;bh(ce,ma)}return nn}if(Bn===null){for(;Hn<de.length;Hn++){var Wo=ae(ce,de[Hn],qe);Wo!==null&&(mi=C(Wo,mi,Hn),fr===null?nn=Wo:fr.sibling=Wo,fr=Wo)}if(la()){var Qa=Hn;bh(ce,Qa)}return nn}for(var Xa=m(ce,Bn);Hn<de.length;Hn++){var Fa=ge(Xa,ce,Hn,de[Hn],qe);Fa!==null&&(i&&Fa.alternate!==null&&Xa.delete(Fa.key===null?Hn:Fa.key),mi=C(Fa,mi,Hn),fr===null?nn=Fa:fr.sibling=Fa,fr=Fa)}if(i&&Xa.forEach(function(hg){return o(ce,hg)}),la()){var dc=Hn;bh(ce,dc)}return nn}function st(ce,_e,de,qe){var yt=Rr(de);if(typeof yt!="function")throw new Error("An object is not an iterable. This error is likely caused by a bug in React. Please file an issue.");{typeof Symbol=="function"&&de[Symbol.toStringTag]==="Generator"&&(FE||c("Using Generators as children is unsupported and will likely yield unexpected results because enumerating a generator mutates it. You may convert it to an array with `Array.from()` or the `[...spread]` operator before rendering. Keep in mind you might need to polyfill these features for older browsers."),FE=!0),de.entries===yt&&(UE||c("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),UE=!0);var ft=yt.call(de);if(ft)for(var Wt=null,nn=ft.next();!nn.done;nn=ft.next()){var fr=nn.value;Wt=be(fr,Wt,ce)}}var Bn=yt.call(de);if(Bn==null)throw new Error("An iterable object provided no iterator.");for(var mi=null,Hn=null,oi=_e,Ua=0,ma=0,Wo=null,Qa=Bn.next();oi!==null&&!Qa.done;ma++,Qa=Bn.next()){oi.index>ma?(Wo=oi,oi=null):Wo=oi.sibling;var Xa=re(ce,oi,Qa.value,qe);if(Xa===null){oi===null&&(oi=Wo);break}i&&oi&&Xa.alternate===null&&o(ce,oi),Ua=C(Xa,Ua,ma),Hn===null?mi=Xa:Hn.sibling=Xa,Hn=Xa,oi=Wo}if(Qa.done){if(f(ce,oi),la()){var Fa=ma;bh(ce,Fa)}return mi}if(oi===null){for(;!Qa.done;ma++,Qa=Bn.next()){var dc=ae(ce,Qa.value,qe);dc!==null&&(Ua=C(dc,Ua,ma),Hn===null?mi=dc:Hn.sibling=dc,Hn=dc)}if(la()){var hg=ma;bh(ce,hg)}return mi}for(var O0=m(ce,oi);!Qa.done;ma++,Qa=Bn.next()){var ou=ge(O0,ce,ma,Qa.value,qe);ou!==null&&(i&&ou.alternate!==null&&O0.delete(ou.key===null?ma:ou.key),Ua=C(ou,Ua,ma),Hn===null?mi=ou:Hn.sibling=ou,Hn=ou)}if(i&&O0.forEach(function(Rse){return o(ce,Rse)}),la()){var Ese=ma;bh(ce,Ese)}return mi}function Vt(ce,_e,de,qe){if(_e!==null&&_e.tag===R){f(ce,_e.sibling);var yt=y(_e,de);return yt.return=ce,yt}f(ce,_e);var ft=IP(de,ce.mode,qe);return ft.return=ce,ft}function Pt(ce,_e,de,qe){for(var yt=de.key,ft=_e;ft!==null;){if(ft.key===yt){var Wt=de.type;if(Wt===jt){if(ft.tag===M){f(ce,ft.sibling);var nn=y(ft,de.props.children);return nn.return=ce,nn._debugSource=de._source,nn._debugOwner=de._owner,nn}}else if(ft.elementType===Wt||lj(ft,de)||typeof Wt=="object"&&Wt!==null&&Wt.$$typeof===Jt&&nF(Wt)===ft.type){f(ce,ft.sibling);var fr=y(ft,de.props);return fr.ref=e0(ce,ft,de),fr.return=ce,fr._debugSource=de._source,fr._debugOwner=de._owner,fr}f(ce,ft);break}else o(ce,ft);ft=ft.sibling}if(de.type===jt){var Bn=qd(de.props.children,ce.mode,qe,de.key);return Bn.return=ce,Bn}else{var mi=NP(de,ce.mode,qe);return mi.ref=e0(ce,_e,de),mi.return=ce,mi}}function Ln(ce,_e,de,qe){for(var yt=de.key,ft=_e;ft!==null;){if(ft.key===yt)if(ft.tag===T&&ft.stateNode.containerInfo===de.containerInfo&&ft.stateNode.implementation===de.implementation){f(ce,ft.sibling);var Wt=y(ft,de.children||[]);return Wt.return=ce,Wt}else{f(ce,ft);break}else o(ce,ft);ft=ft.sibling}var nn=UP(de,ce.mode,qe);return nn.return=ce,nn}function wn(ce,_e,de,qe){var yt=typeof de=="object"&&de!==null&&de.type===jt&&de.key===null;if(yt&&(de=de.props.children),typeof de=="object"&&de!==null){switch(de.$$typeof){case Ht:return w(Pt(ce,_e,de,qe));case Sn:return w(Ln(ce,_e,de,qe));case Jt:var ft=de._payload,Wt=de._init;return wn(ce,_e,Wt(ft),qe)}if(on(de))return we(ce,_e,de,qe);if(Rr(de))return st(ce,_e,de,qe);yk(ce,de)}return typeof de=="string"&&de!==""||typeof de=="number"?w(Vt(ce,_e,""+de,qe)):(typeof de=="function"&&bk(ce),f(ce,_e))}return wn}var Km=rF(!0),iF=rF(!1);function rie(i,o){if(i!==null&&o.child!==i.child)throw new Error("Resuming work not yet implemented.");if(o.child!==null){var f=o.child,m=Oh(f,f.pendingProps);for(o.child=m,m.return=o;f.sibling!==null;)f=f.sibling,m=m.sibling=Oh(f,f.pendingProps),m.return=o;m.sibling=null}}function iie(i,o){for(var f=i.child;f!==null;)qoe(f,o),f=f.sibling}var BE=Ad(null),HE;HE={};var Sk=null,Zm=null,$E=null,Ck=!1;function kk(){Sk=null,Zm=null,$E=null,Ck=!1}function aF(){Ck=!0}function oF(){Ck=!1}function sF(i,o,f){Na(BE,o._currentValue,i),o._currentValue=f,o._currentRenderer!==void 0&&o._currentRenderer!==null&&o._currentRenderer!==HE&&c("Detected multiple renderers concurrently rendering the same context provider. This is currently unsupported."),o._currentRenderer=HE}function qE(i,o){var f=BE.current;La(BE,o),i._currentValue=f}function WE(i,o,f){for(var m=i;m!==null;){var y=m.alternate;if(Hu(m.childLanes,o)?y!==null&&!Hu(y.childLanes,o)&&(y.childLanes=sn(y.childLanes,o)):(m.childLanes=sn(m.childLanes,o),y!==null&&(y.childLanes=sn(y.childLanes,o))),m===f)break;m=m.return}m!==f&&c("Expected to find the propagation root when scheduling context work. This error is likely caused by a bug in React. Please file an issue.")}function aie(i,o,f){oie(i,o,f)}function oie(i,o,f){var m=i.child;for(m!==null&&(m.return=i);m!==null;){var y=void 0,C=m.dependencies;if(C!==null){y=m.child;for(var w=C.firstContext;w!==null;){if(w.context===o){if(m.tag===v){var P=Ci(f),D=ac(rr,P);D.tag=xk;var F=m.updateQueue;if(F!==null){var B=F.shared,ae=B.pending;ae===null?D.next=D:(D.next=ae.next,ae.next=D),B.pending=D}}m.lanes=sn(m.lanes,f);var re=m.alternate;re!==null&&(re.lanes=sn(re.lanes,f)),WE(m.return,f,i),C.lanes=sn(C.lanes,f);break}w=w.next}}else if(m.tag===V)y=m.type===i.type?null:m.child;else if(m.tag===oe){var ge=m.return;if(ge===null)throw new Error("We just came from a parent so we must have had a parent. This is a bug in React.");ge.lanes=sn(ge.lanes,f);var be=ge.alternate;be!==null&&(be.lanes=sn(be.lanes,f)),WE(ge,f,i),y=m.sibling}else y=m.child;if(y!==null)y.return=m;else for(y=m;y!==null;){if(y===i){y=null;break}var we=y.sibling;if(we!==null){we.return=y.return,y=we;break}y=y.return}m=y}}function Qm(i,o){Sk=i,Zm=null,$E=null;var f=i.dependencies;if(f!==null){var m=f.firstContext;m!==null&&(Aa(f.lanes,o)&&m0(),f.firstContext=null)}}function Ti(i){Ck&&c("Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo().");var o=i._currentValue;if($E!==i){var f={context:i,memoizedValue:o,next:null};if(Zm===null){if(Sk===null)throw new Error("Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo().");Zm=f,Sk.dependencies={lanes:Pe,firstContext:f}}else Zm=Zm.next=f}return o}var xh=null;function GE(i){xh===null?xh=[i]:xh.push(i)}function sie(){if(xh!==null){for(var i=0;i<xh.length;i++){var o=xh[i],f=o.interleaved;if(f!==null){o.interleaved=null;var m=f.next,y=o.pending;if(y!==null){var C=y.next;y.next=m,f.next=C}o.pending=f}}xh=null}}function lF(i,o,f,m){var y=o.interleaved;return y===null?(f.next=f,GE(o)):(f.next=y.next,y.next=f),o.interleaved=f,Tk(i,m)}function lie(i,o,f,m){var y=o.interleaved;y===null?(f.next=f,GE(o)):(f.next=y.next,y.next=f),o.interleaved=f}function uie(i,o,f,m){var y=o.interleaved;return y===null?(f.next=f,GE(o)):(f.next=y.next,y.next=f),o.interleaved=f,Tk(i,m)}function wo(i,o){return Tk(i,o)}var cie=Tk;function Tk(i,o){i.lanes=sn(i.lanes,o);var f=i.alternate;f!==null&&(f.lanes=sn(f.lanes,o)),f===null&&(i.flags&(jr|Vr))!==Ot&&ij(i);for(var m=i,y=i.return;y!==null;)y.childLanes=sn(y.childLanes,o),f=y.alternate,f!==null?f.childLanes=sn(f.childLanes,o):(y.flags&(jr|Vr))!==Ot&&ij(i),m=y,y=y.return;if(m.tag===k){var C=m.stateNode;return C}else return null}var uF=0,cF=1,xk=2,YE=3,wk=!1,KE,_k;KE=!1,_k=null;function ZE(i){var o={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:Pe},effects:null};i.updateQueue=o}function dF(i,o){var f=o.updateQueue,m=i.updateQueue;if(f===m){var y={baseState:m.baseState,firstBaseUpdate:m.firstBaseUpdate,lastBaseUpdate:m.lastBaseUpdate,shared:m.shared,effects:m.effects};o.updateQueue=y}}function ac(i,o){var f={eventTime:i,lane:o,tag:uF,payload:null,callback:null,next:null};return f}function Nd(i,o,f){var m=i.updateQueue;if(m===null)return null;var y=m.shared;if(_k===y&&!KE&&(c("An update (setState, replaceState, or forceUpdate) was scheduled from inside an update function. Update functions should be pure, with zero side-effects. Consider using componentDidUpdate or a callback."),KE=!0),loe()){var C=y.pending;return C===null?o.next=o:(o.next=C.next,C.next=o),y.pending=o,cie(i,f)}else return uie(i,y,o,f)}function Ek(i,o,f){var m=o.updateQueue;if(m!==null){var y=m.shared;if(py(f)){var C=y.lanes;C=gm(C,i.pendingLanes);var w=sn(C,f);y.lanes=w,eh(i,w)}}}function QE(i,o){var f=i.updateQueue,m=i.alternate;if(m!==null){var y=m.updateQueue;if(f===y){var C=null,w=null,P=f.firstBaseUpdate;if(P!==null){var D=P;do{var F={eventTime:D.eventTime,lane:D.lane,tag:D.tag,payload:D.payload,callback:D.callback,next:null};w===null?C=w=F:(w.next=F,w=F),D=D.next}while(D!==null);w===null?C=w=o:(w.next=o,w=o)}else C=w=o;f={baseState:y.baseState,firstBaseUpdate:C,lastBaseUpdate:w,shared:y.shared,effects:y.effects},i.updateQueue=f;return}}var B=f.lastBaseUpdate;B===null?f.firstBaseUpdate=o:B.next=o,f.lastBaseUpdate=o}function die(i,o,f,m,y,C){switch(f.tag){case cF:{var w=f.payload;if(typeof w=="function"){aF();var P=w.call(C,m,y);{if(i.mode&an){nr(!0);try{w.call(C,m,y)}finally{nr(!1)}}oF()}return P}return w}case YE:i.flags=i.flags&~Gi|pn;case uF:{var D=f.payload,F;if(typeof D=="function"){aF(),F=D.call(C,m,y);{if(i.mode&an){nr(!0);try{D.call(C,m,y)}finally{nr(!1)}}oF()}}else F=D;return F==null?m:rn({},m,F)}case xk:return wk=!0,m}return m}function Rk(i,o,f,m){var y=i.updateQueue;wk=!1,_k=y.shared;var C=y.firstBaseUpdate,w=y.lastBaseUpdate,P=y.shared.pending;if(P!==null){y.shared.pending=null;var D=P,F=D.next;D.next=null,w===null?C=F:w.next=F,w=D;var B=i.alternate;if(B!==null){var ae=B.updateQueue,re=ae.lastBaseUpdate;re!==w&&(re===null?ae.firstBaseUpdate=F:re.next=F,ae.lastBaseUpdate=D)}}if(C!==null){var ge=y.baseState,be=Pe,we=null,st=null,Vt=null,Pt=C;do{var Ln=Pt.lane,wn=Pt.eventTime;if(Hu(m,Ln)){if(Vt!==null){var _e={eventTime:wn,lane:ii,tag:Pt.tag,payload:Pt.payload,callback:Pt.callback,next:null};Vt=Vt.next=_e}ge=die(i,y,Pt,ge,o,f);var de=Pt.callback;if(de!==null&&Pt.lane!==ii){i.flags|=pr;var qe=y.effects;qe===null?y.effects=[Pt]:qe.push(Pt)}}else{var ce={eventTime:wn,lane:Ln,tag:Pt.tag,payload:Pt.payload,callback:Pt.callback,next:null};Vt===null?(st=Vt=ce,we=ge):Vt=Vt.next=ce,be=sn(be,Ln)}if(Pt=Pt.next,Pt===null){if(P=y.shared.pending,P===null)break;var yt=P,ft=yt.next;yt.next=null,Pt=ft,y.lastBaseUpdate=yt,y.shared.pending=null}}while(!0);Vt===null&&(we=ge),y.baseState=we,y.firstBaseUpdate=st,y.lastBaseUpdate=Vt;var Wt=y.shared.interleaved;if(Wt!==null){var nn=Wt;do be=sn(be,nn.lane),nn=nn.next;while(nn!==Wt)}else C===null&&(y.shared.lanes=Pe);E0(be),i.lanes=be,i.memoizedState=ge}_k=null}function fie(i,o){if(typeof i!="function")throw new Error("Invalid argument passed as callback. Expected a function. Instead "+("received: "+i));i.call(o)}function fF(){wk=!1}function Pk(){return wk}function hF(i,o,f){var m=o.effects;if(o.effects=null,m!==null)for(var y=0;y<m.length;y++){var C=m[y],w=C.callback;w!==null&&(C.callback=null,fie(w,f))}}var t0={},Id=Ad(t0),n0=Ad(t0),Dk=Ad(t0);function Ak(i){if(i===t0)throw new Error("Expected host context to exist. This error is likely caused by a bug in React. Please file an issue.");return i}function pF(){var i=Ak(Dk.current);return i}function XE(i,o){Na(Dk,o,i),Na(n0,i,i),Na(Id,t0,i);var f=Pne(o);La(Id,i),Na(Id,f,i)}function Xm(i){La(Id,i),La(n0,i),La(Dk,i)}function JE(){var i=Ak(Id.current);return i}function mF(i){Ak(Dk.current);var o=Ak(Id.current),f=Dne(o,i.type);o!==f&&(Na(n0,i,i),Na(Id,f,i))}function eR(i){n0.current===i&&(La(Id,i),La(n0,i))}var hie=0,gF=1,vF=1,r0=2,el=Ad(hie);function tR(i,o){return(i&o)!==0}function Jm(i){return i&gF}function nR(i,o){return i&gF|o}function pie(i,o){return i|o}function Ud(i,o){Na(el,o,i)}function eg(i){La(el,i)}function mie(i,o){var f=i.memoizedState;return f!==null?f.dehydrated!==null:(i.memoizedProps,!0)}function Ok(i){for(var o=i;o!==null;){if(o.tag===N){var f=o.memoizedState;if(f!==null){var m=f.dehydrated;if(m===null||LU(m)||SE(m))return o}}else if(o.tag===J&&o.memoizedProps.revealOrder!==void 0){var y=(o.flags&pn)!==Ot;if(y)return o}else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===i)return null;for(;o.sibling===null;){if(o.return===null||o.return===i)return null;o=o.return}o.sibling.return=o.return,o=o.sibling}return null}var _o=0,Mi=1,Jl=2,Li=4,ua=8,rR=[];function iR(){for(var i=0;i<rR.length;i++){var o=rR[i];o._workInProgressVersionPrimary=null}rR.length=0}function gie(i,o){var f=o._getVersion,m=f(o._source);i.mutableSourceEagerHydrationData==null?i.mutableSourceEagerHydrationData=[o,m]:i.mutableSourceEagerHydrationData.push(o,m)}var gt=r.ReactCurrentDispatcher,i0=r.ReactCurrentBatchConfig,aR,tg;aR=new Set;var wh=Pe,dr=null,Ni=null,Ii=null,Mk=!1,a0=!1,o0=0,vie=0,yie=25,Ae=null,vs=null,Fd=-1,oR=!1;function Qn(){{var i=Ae;vs===null?vs=[i]:vs.push(i)}}function nt(){{var i=Ae;vs!==null&&(Fd++,vs[Fd]!==i&&bie(i))}}function ng(i){i!=null&&!on(i)&&c("%s received a final argument that is not an array (instead, received `%s`). When specified, the final argument must be an array.",Ae,typeof i)}function bie(i){{var o=Zt(dr);if(!aR.has(o)&&(aR.add(o),vs!==null)){for(var f="",m=30,y=0;y<=Fd;y++){for(var C=vs[y],w=y===Fd?i:C,P=y+1+". "+C;P.length<m;)P+=" ";P+=w+`
|
|
167
|
+
See https://reactjs.org/link/refs-must-have-owner for more information.`)}}return m}function yk(i,o){var f=Object.prototype.toString.call(o);throw new Error("Objects are not valid as a React child (found: "+(f==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":f)+"). If you meant to render a collection of children, use an array instead.")}function bk(i){{var o=Zt(i)||"Component";if(zE[o])return;zE[o]=!0,c("Functions are not valid as a React child. This may happen if you return a Component instead of <Component /> from render. Or maybe you meant to call this function rather than return it.")}}function nF(i){var o=i._payload,f=i._init;return f(o)}function rF(i){function o(ce,_e){if(i){var de=ce.deletions;de===null?(ce.deletions=[_e],ce.flags|=wa):de.push(_e)}}function f(ce,_e){if(!i)return null;for(var de=_e;de!==null;)o(ce,de),de=de.sibling;return null}function m(ce,_e){for(var de=new Map,qe=_e;qe!==null;)qe.key!==null?de.set(qe.key,qe):de.set(qe.index,qe),qe=qe.sibling;return de}function y(ce,_e){var de=Oh(ce,_e);return de.index=0,de.sibling=null,de}function C(ce,_e,de){if(ce.index=de,!i)return ce.flags|=Ff,_e;var qe=ce.alternate;if(qe!==null){var yt=qe.index;return yt<_e?(ce.flags|=jr,_e):yt}else return ce.flags|=jr,_e}function w(ce){return i&&ce.alternate===null&&(ce.flags|=jr),ce}function P(ce,_e,de,qe){if(_e===null||_e.tag!==R){var yt=IP(de,ce.mode,qe);return yt.return=ce,yt}else{var ft=y(_e,de);return ft.return=ce,ft}}function D(ce,_e,de,qe){var yt=de.type;if(yt===jt)return B(ce,_e,de.props.children,qe,de.key);if(_e!==null&&(_e.elementType===yt||lj(_e,de)||typeof yt=="object"&&yt!==null&&yt.$$typeof===Jt&&nF(yt)===_e.type)){var ft=y(_e,de.props);return ft.ref=e0(ce,_e,de),ft.return=ce,ft._debugSource=de._source,ft._debugOwner=de._owner,ft}var Wt=NP(de,ce.mode,qe);return Wt.ref=e0(ce,_e,de),Wt.return=ce,Wt}function F(ce,_e,de,qe){if(_e===null||_e.tag!==T||_e.stateNode.containerInfo!==de.containerInfo||_e.stateNode.implementation!==de.implementation){var yt=UP(de,ce.mode,qe);return yt.return=ce,yt}else{var ft=y(_e,de.children||[]);return ft.return=ce,ft}}function B(ce,_e,de,qe,yt){if(_e===null||_e.tag!==M){var ft=qd(de,ce.mode,qe,yt);return ft.return=ce,ft}else{var Wt=y(_e,de);return Wt.return=ce,Wt}}function ae(ce,_e,de){if(typeof _e=="string"&&_e!==""||typeof _e=="number"){var qe=IP(""+_e,ce.mode,de);return qe.return=ce,qe}if(typeof _e=="object"&&_e!==null){switch(_e.$$typeof){case Ht:{var yt=NP(_e,ce.mode,de);return yt.ref=e0(ce,null,_e),yt.return=ce,yt}case Sn:{var ft=UP(_e,ce.mode,de);return ft.return=ce,ft}case Jt:{var Wt=_e._payload,nn=_e._init;return ae(ce,nn(Wt),de)}}if(on(_e)||Rr(_e)){var fr=qd(_e,ce.mode,de,null);return fr.return=ce,fr}yk(ce,_e)}return typeof _e=="function"&&bk(ce),null}function re(ce,_e,de,qe){var yt=_e!==null?_e.key:null;if(typeof de=="string"&&de!==""||typeof de=="number")return yt!==null?null:P(ce,_e,""+de,qe);if(typeof de=="object"&&de!==null){switch(de.$$typeof){case Ht:return de.key===yt?D(ce,_e,de,qe):null;case Sn:return de.key===yt?F(ce,_e,de,qe):null;case Jt:{var ft=de._payload,Wt=de._init;return re(ce,_e,Wt(ft),qe)}}if(on(de)||Rr(de))return yt!==null?null:B(ce,_e,de,qe,null);yk(ce,de)}return typeof de=="function"&&bk(ce),null}function ge(ce,_e,de,qe,yt){if(typeof qe=="string"&&qe!==""||typeof qe=="number"){var ft=ce.get(de)||null;return P(_e,ft,""+qe,yt)}if(typeof qe=="object"&&qe!==null){switch(qe.$$typeof){case Ht:{var Wt=ce.get(qe.key===null?de:qe.key)||null;return D(_e,Wt,qe,yt)}case Sn:{var nn=ce.get(qe.key===null?de:qe.key)||null;return F(_e,nn,qe,yt)}case Jt:var fr=qe._payload,Bn=qe._init;return ge(ce,_e,de,Bn(fr),yt)}if(on(qe)||Rr(qe)){var mi=ce.get(de)||null;return B(_e,mi,qe,yt,null)}yk(_e,qe)}return typeof qe=="function"&&bk(_e),null}function be(ce,_e,de){{if(typeof ce!="object"||ce===null)return _e;switch(ce.$$typeof){case Ht:case Sn:tF(ce,de);var qe=ce.key;if(typeof qe!="string")break;if(_e===null){_e=new Set,_e.add(qe);break}if(!_e.has(qe)){_e.add(qe);break}c("Encountered two children with the same key, `%s`. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted — the behavior is unsupported and could change in a future version.",qe);break;case Jt:var yt=ce._payload,ft=ce._init;be(ft(yt),_e,de);break}}return _e}function we(ce,_e,de,qe){for(var yt=null,ft=0;ft<de.length;ft++){var Wt=de[ft];yt=be(Wt,yt,ce)}for(var nn=null,fr=null,Bn=_e,mi=0,Hn=0,oi=null;Bn!==null&&Hn<de.length;Hn++){Bn.index>Hn?(oi=Bn,Bn=null):oi=Bn.sibling;var Ua=re(ce,Bn,de[Hn],qe);if(Ua===null){Bn===null&&(Bn=oi);break}i&&Bn&&Ua.alternate===null&&o(ce,Bn),mi=C(Ua,mi,Hn),fr===null?nn=Ua:fr.sibling=Ua,fr=Ua,Bn=oi}if(Hn===de.length){if(f(ce,Bn),la()){var ma=Hn;bh(ce,ma)}return nn}if(Bn===null){for(;Hn<de.length;Hn++){var Wo=ae(ce,de[Hn],qe);Wo!==null&&(mi=C(Wo,mi,Hn),fr===null?nn=Wo:fr.sibling=Wo,fr=Wo)}if(la()){var Qa=Hn;bh(ce,Qa)}return nn}for(var Xa=m(ce,Bn);Hn<de.length;Hn++){var Fa=ge(Xa,ce,Hn,de[Hn],qe);Fa!==null&&(i&&Fa.alternate!==null&&Xa.delete(Fa.key===null?Hn:Fa.key),mi=C(Fa,mi,Hn),fr===null?nn=Fa:fr.sibling=Fa,fr=Fa)}if(i&&Xa.forEach(function(hg){return o(ce,hg)}),la()){var dc=Hn;bh(ce,dc)}return nn}function st(ce,_e,de,qe){var yt=Rr(de);if(typeof yt!="function")throw new Error("An object is not an iterable. This error is likely caused by a bug in React. Please file an issue.");{typeof Symbol=="function"&&de[Symbol.toStringTag]==="Generator"&&(FE||c("Using Generators as children is unsupported and will likely yield unexpected results because enumerating a generator mutates it. You may convert it to an array with `Array.from()` or the `[...spread]` operator before rendering. Keep in mind you might need to polyfill these features for older browsers."),FE=!0),de.entries===yt&&(UE||c("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),UE=!0);var ft=yt.call(de);if(ft)for(var Wt=null,nn=ft.next();!nn.done;nn=ft.next()){var fr=nn.value;Wt=be(fr,Wt,ce)}}var Bn=yt.call(de);if(Bn==null)throw new Error("An iterable object provided no iterator.");for(var mi=null,Hn=null,oi=_e,Ua=0,ma=0,Wo=null,Qa=Bn.next();oi!==null&&!Qa.done;ma++,Qa=Bn.next()){oi.index>ma?(Wo=oi,oi=null):Wo=oi.sibling;var Xa=re(ce,oi,Qa.value,qe);if(Xa===null){oi===null&&(oi=Wo);break}i&&oi&&Xa.alternate===null&&o(ce,oi),Ua=C(Xa,Ua,ma),Hn===null?mi=Xa:Hn.sibling=Xa,Hn=Xa,oi=Wo}if(Qa.done){if(f(ce,oi),la()){var Fa=ma;bh(ce,Fa)}return mi}if(oi===null){for(;!Qa.done;ma++,Qa=Bn.next()){var dc=ae(ce,Qa.value,qe);dc!==null&&(Ua=C(dc,Ua,ma),Hn===null?mi=dc:Hn.sibling=dc,Hn=dc)}if(la()){var hg=ma;bh(ce,hg)}return mi}for(var O0=m(ce,oi);!Qa.done;ma++,Qa=Bn.next()){var ou=ge(O0,ce,ma,Qa.value,qe);ou!==null&&(i&&ou.alternate!==null&&O0.delete(ou.key===null?ma:ou.key),Ua=C(ou,Ua,ma),Hn===null?mi=ou:Hn.sibling=ou,Hn=ou)}if(i&&O0.forEach(function(Pse){return o(ce,Pse)}),la()){var Rse=ma;bh(ce,Rse)}return mi}function Vt(ce,_e,de,qe){if(_e!==null&&_e.tag===R){f(ce,_e.sibling);var yt=y(_e,de);return yt.return=ce,yt}f(ce,_e);var ft=IP(de,ce.mode,qe);return ft.return=ce,ft}function Pt(ce,_e,de,qe){for(var yt=de.key,ft=_e;ft!==null;){if(ft.key===yt){var Wt=de.type;if(Wt===jt){if(ft.tag===M){f(ce,ft.sibling);var nn=y(ft,de.props.children);return nn.return=ce,nn._debugSource=de._source,nn._debugOwner=de._owner,nn}}else if(ft.elementType===Wt||lj(ft,de)||typeof Wt=="object"&&Wt!==null&&Wt.$$typeof===Jt&&nF(Wt)===ft.type){f(ce,ft.sibling);var fr=y(ft,de.props);return fr.ref=e0(ce,ft,de),fr.return=ce,fr._debugSource=de._source,fr._debugOwner=de._owner,fr}f(ce,ft);break}else o(ce,ft);ft=ft.sibling}if(de.type===jt){var Bn=qd(de.props.children,ce.mode,qe,de.key);return Bn.return=ce,Bn}else{var mi=NP(de,ce.mode,qe);return mi.ref=e0(ce,_e,de),mi.return=ce,mi}}function Ln(ce,_e,de,qe){for(var yt=de.key,ft=_e;ft!==null;){if(ft.key===yt)if(ft.tag===T&&ft.stateNode.containerInfo===de.containerInfo&&ft.stateNode.implementation===de.implementation){f(ce,ft.sibling);var Wt=y(ft,de.children||[]);return Wt.return=ce,Wt}else{f(ce,ft);break}else o(ce,ft);ft=ft.sibling}var nn=UP(de,ce.mode,qe);return nn.return=ce,nn}function wn(ce,_e,de,qe){var yt=typeof de=="object"&&de!==null&&de.type===jt&&de.key===null;if(yt&&(de=de.props.children),typeof de=="object"&&de!==null){switch(de.$$typeof){case Ht:return w(Pt(ce,_e,de,qe));case Sn:return w(Ln(ce,_e,de,qe));case Jt:var ft=de._payload,Wt=de._init;return wn(ce,_e,Wt(ft),qe)}if(on(de))return we(ce,_e,de,qe);if(Rr(de))return st(ce,_e,de,qe);yk(ce,de)}return typeof de=="string"&&de!==""||typeof de=="number"?w(Vt(ce,_e,""+de,qe)):(typeof de=="function"&&bk(ce),f(ce,_e))}return wn}var Km=rF(!0),iF=rF(!1);function iie(i,o){if(i!==null&&o.child!==i.child)throw new Error("Resuming work not yet implemented.");if(o.child!==null){var f=o.child,m=Oh(f,f.pendingProps);for(o.child=m,m.return=o;f.sibling!==null;)f=f.sibling,m=m.sibling=Oh(f,f.pendingProps),m.return=o;m.sibling=null}}function aie(i,o){for(var f=i.child;f!==null;)Woe(f,o),f=f.sibling}var BE=Ad(null),HE;HE={};var Sk=null,Zm=null,$E=null,Ck=!1;function kk(){Sk=null,Zm=null,$E=null,Ck=!1}function aF(){Ck=!0}function oF(){Ck=!1}function sF(i,o,f){Na(BE,o._currentValue,i),o._currentValue=f,o._currentRenderer!==void 0&&o._currentRenderer!==null&&o._currentRenderer!==HE&&c("Detected multiple renderers concurrently rendering the same context provider. This is currently unsupported."),o._currentRenderer=HE}function qE(i,o){var f=BE.current;La(BE,o),i._currentValue=f}function WE(i,o,f){for(var m=i;m!==null;){var y=m.alternate;if(Hu(m.childLanes,o)?y!==null&&!Hu(y.childLanes,o)&&(y.childLanes=sn(y.childLanes,o)):(m.childLanes=sn(m.childLanes,o),y!==null&&(y.childLanes=sn(y.childLanes,o))),m===f)break;m=m.return}m!==f&&c("Expected to find the propagation root when scheduling context work. This error is likely caused by a bug in React. Please file an issue.")}function oie(i,o,f){sie(i,o,f)}function sie(i,o,f){var m=i.child;for(m!==null&&(m.return=i);m!==null;){var y=void 0,C=m.dependencies;if(C!==null){y=m.child;for(var w=C.firstContext;w!==null;){if(w.context===o){if(m.tag===v){var P=Ci(f),D=ac(rr,P);D.tag=xk;var F=m.updateQueue;if(F!==null){var B=F.shared,ae=B.pending;ae===null?D.next=D:(D.next=ae.next,ae.next=D),B.pending=D}}m.lanes=sn(m.lanes,f);var re=m.alternate;re!==null&&(re.lanes=sn(re.lanes,f)),WE(m.return,f,i),C.lanes=sn(C.lanes,f);break}w=w.next}}else if(m.tag===V)y=m.type===i.type?null:m.child;else if(m.tag===oe){var ge=m.return;if(ge===null)throw new Error("We just came from a parent so we must have had a parent. This is a bug in React.");ge.lanes=sn(ge.lanes,f);var be=ge.alternate;be!==null&&(be.lanes=sn(be.lanes,f)),WE(ge,f,i),y=m.sibling}else y=m.child;if(y!==null)y.return=m;else for(y=m;y!==null;){if(y===i){y=null;break}var we=y.sibling;if(we!==null){we.return=y.return,y=we;break}y=y.return}m=y}}function Qm(i,o){Sk=i,Zm=null,$E=null;var f=i.dependencies;if(f!==null){var m=f.firstContext;m!==null&&(Aa(f.lanes,o)&&m0(),f.firstContext=null)}}function Ti(i){Ck&&c("Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo().");var o=i._currentValue;if($E!==i){var f={context:i,memoizedValue:o,next:null};if(Zm===null){if(Sk===null)throw new Error("Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo().");Zm=f,Sk.dependencies={lanes:Pe,firstContext:f}}else Zm=Zm.next=f}return o}var xh=null;function GE(i){xh===null?xh=[i]:xh.push(i)}function lie(){if(xh!==null){for(var i=0;i<xh.length;i++){var o=xh[i],f=o.interleaved;if(f!==null){o.interleaved=null;var m=f.next,y=o.pending;if(y!==null){var C=y.next;y.next=m,f.next=C}o.pending=f}}xh=null}}function lF(i,o,f,m){var y=o.interleaved;return y===null?(f.next=f,GE(o)):(f.next=y.next,y.next=f),o.interleaved=f,Tk(i,m)}function uie(i,o,f,m){var y=o.interleaved;y===null?(f.next=f,GE(o)):(f.next=y.next,y.next=f),o.interleaved=f}function cie(i,o,f,m){var y=o.interleaved;return y===null?(f.next=f,GE(o)):(f.next=y.next,y.next=f),o.interleaved=f,Tk(i,m)}function wo(i,o){return Tk(i,o)}var die=Tk;function Tk(i,o){i.lanes=sn(i.lanes,o);var f=i.alternate;f!==null&&(f.lanes=sn(f.lanes,o)),f===null&&(i.flags&(jr|Vr))!==Ot&&ij(i);for(var m=i,y=i.return;y!==null;)y.childLanes=sn(y.childLanes,o),f=y.alternate,f!==null?f.childLanes=sn(f.childLanes,o):(y.flags&(jr|Vr))!==Ot&&ij(i),m=y,y=y.return;if(m.tag===k){var C=m.stateNode;return C}else return null}var uF=0,cF=1,xk=2,YE=3,wk=!1,KE,_k;KE=!1,_k=null;function ZE(i){var o={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:Pe},effects:null};i.updateQueue=o}function dF(i,o){var f=o.updateQueue,m=i.updateQueue;if(f===m){var y={baseState:m.baseState,firstBaseUpdate:m.firstBaseUpdate,lastBaseUpdate:m.lastBaseUpdate,shared:m.shared,effects:m.effects};o.updateQueue=y}}function ac(i,o){var f={eventTime:i,lane:o,tag:uF,payload:null,callback:null,next:null};return f}function Nd(i,o,f){var m=i.updateQueue;if(m===null)return null;var y=m.shared;if(_k===y&&!KE&&(c("An update (setState, replaceState, or forceUpdate) was scheduled from inside an update function. Update functions should be pure, with zero side-effects. Consider using componentDidUpdate or a callback."),KE=!0),uoe()){var C=y.pending;return C===null?o.next=o:(o.next=C.next,C.next=o),y.pending=o,die(i,f)}else return cie(i,y,o,f)}function Ek(i,o,f){var m=o.updateQueue;if(m!==null){var y=m.shared;if(py(f)){var C=y.lanes;C=gm(C,i.pendingLanes);var w=sn(C,f);y.lanes=w,eh(i,w)}}}function QE(i,o){var f=i.updateQueue,m=i.alternate;if(m!==null){var y=m.updateQueue;if(f===y){var C=null,w=null,P=f.firstBaseUpdate;if(P!==null){var D=P;do{var F={eventTime:D.eventTime,lane:D.lane,tag:D.tag,payload:D.payload,callback:D.callback,next:null};w===null?C=w=F:(w.next=F,w=F),D=D.next}while(D!==null);w===null?C=w=o:(w.next=o,w=o)}else C=w=o;f={baseState:y.baseState,firstBaseUpdate:C,lastBaseUpdate:w,shared:y.shared,effects:y.effects},i.updateQueue=f;return}}var B=f.lastBaseUpdate;B===null?f.firstBaseUpdate=o:B.next=o,f.lastBaseUpdate=o}function fie(i,o,f,m,y,C){switch(f.tag){case cF:{var w=f.payload;if(typeof w=="function"){aF();var P=w.call(C,m,y);{if(i.mode&an){nr(!0);try{w.call(C,m,y)}finally{nr(!1)}}oF()}return P}return w}case YE:i.flags=i.flags&~Gi|pn;case uF:{var D=f.payload,F;if(typeof D=="function"){aF(),F=D.call(C,m,y);{if(i.mode&an){nr(!0);try{D.call(C,m,y)}finally{nr(!1)}}oF()}}else F=D;return F==null?m:rn({},m,F)}case xk:return wk=!0,m}return m}function Rk(i,o,f,m){var y=i.updateQueue;wk=!1,_k=y.shared;var C=y.firstBaseUpdate,w=y.lastBaseUpdate,P=y.shared.pending;if(P!==null){y.shared.pending=null;var D=P,F=D.next;D.next=null,w===null?C=F:w.next=F,w=D;var B=i.alternate;if(B!==null){var ae=B.updateQueue,re=ae.lastBaseUpdate;re!==w&&(re===null?ae.firstBaseUpdate=F:re.next=F,ae.lastBaseUpdate=D)}}if(C!==null){var ge=y.baseState,be=Pe,we=null,st=null,Vt=null,Pt=C;do{var Ln=Pt.lane,wn=Pt.eventTime;if(Hu(m,Ln)){if(Vt!==null){var _e={eventTime:wn,lane:ii,tag:Pt.tag,payload:Pt.payload,callback:Pt.callback,next:null};Vt=Vt.next=_e}ge=fie(i,y,Pt,ge,o,f);var de=Pt.callback;if(de!==null&&Pt.lane!==ii){i.flags|=pr;var qe=y.effects;qe===null?y.effects=[Pt]:qe.push(Pt)}}else{var ce={eventTime:wn,lane:Ln,tag:Pt.tag,payload:Pt.payload,callback:Pt.callback,next:null};Vt===null?(st=Vt=ce,we=ge):Vt=Vt.next=ce,be=sn(be,Ln)}if(Pt=Pt.next,Pt===null){if(P=y.shared.pending,P===null)break;var yt=P,ft=yt.next;yt.next=null,Pt=ft,y.lastBaseUpdate=yt,y.shared.pending=null}}while(!0);Vt===null&&(we=ge),y.baseState=we,y.firstBaseUpdate=st,y.lastBaseUpdate=Vt;var Wt=y.shared.interleaved;if(Wt!==null){var nn=Wt;do be=sn(be,nn.lane),nn=nn.next;while(nn!==Wt)}else C===null&&(y.shared.lanes=Pe);E0(be),i.lanes=be,i.memoizedState=ge}_k=null}function hie(i,o){if(typeof i!="function")throw new Error("Invalid argument passed as callback. Expected a function. Instead "+("received: "+i));i.call(o)}function fF(){wk=!1}function Pk(){return wk}function hF(i,o,f){var m=o.effects;if(o.effects=null,m!==null)for(var y=0;y<m.length;y++){var C=m[y],w=C.callback;w!==null&&(C.callback=null,hie(w,f))}}var t0={},Id=Ad(t0),n0=Ad(t0),Dk=Ad(t0);function Ak(i){if(i===t0)throw new Error("Expected host context to exist. This error is likely caused by a bug in React. Please file an issue.");return i}function pF(){var i=Ak(Dk.current);return i}function XE(i,o){Na(Dk,o,i),Na(n0,i,i),Na(Id,t0,i);var f=Dne(o);La(Id,i),Na(Id,f,i)}function Xm(i){La(Id,i),La(n0,i),La(Dk,i)}function JE(){var i=Ak(Id.current);return i}function mF(i){Ak(Dk.current);var o=Ak(Id.current),f=Ane(o,i.type);o!==f&&(Na(n0,i,i),Na(Id,f,i))}function eR(i){n0.current===i&&(La(Id,i),La(n0,i))}var pie=0,gF=1,vF=1,r0=2,el=Ad(pie);function tR(i,o){return(i&o)!==0}function Jm(i){return i&gF}function nR(i,o){return i&gF|o}function mie(i,o){return i|o}function Ud(i,o){Na(el,o,i)}function eg(i){La(el,i)}function gie(i,o){var f=i.memoizedState;return f!==null?f.dehydrated!==null:(i.memoizedProps,!0)}function Ok(i){for(var o=i;o!==null;){if(o.tag===N){var f=o.memoizedState;if(f!==null){var m=f.dehydrated;if(m===null||LU(m)||SE(m))return o}}else if(o.tag===J&&o.memoizedProps.revealOrder!==void 0){var y=(o.flags&pn)!==Ot;if(y)return o}else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===i)return null;for(;o.sibling===null;){if(o.return===null||o.return===i)return null;o=o.return}o.sibling.return=o.return,o=o.sibling}return null}var _o=0,Mi=1,Jl=2,Li=4,ua=8,rR=[];function iR(){for(var i=0;i<rR.length;i++){var o=rR[i];o._workInProgressVersionPrimary=null}rR.length=0}function vie(i,o){var f=o._getVersion,m=f(o._source);i.mutableSourceEagerHydrationData==null?i.mutableSourceEagerHydrationData=[o,m]:i.mutableSourceEagerHydrationData.push(o,m)}var gt=r.ReactCurrentDispatcher,i0=r.ReactCurrentBatchConfig,aR,tg;aR=new Set;var wh=Pe,dr=null,Ni=null,Ii=null,Mk=!1,a0=!1,o0=0,yie=0,bie=25,Ae=null,vs=null,Fd=-1,oR=!1;function Qn(){{var i=Ae;vs===null?vs=[i]:vs.push(i)}}function nt(){{var i=Ae;vs!==null&&(Fd++,vs[Fd]!==i&&Sie(i))}}function ng(i){i!=null&&!on(i)&&c("%s received a final argument that is not an array (instead, received `%s`). When specified, the final argument must be an array.",Ae,typeof i)}function Sie(i){{var o=Zt(dr);if(!aR.has(o)&&(aR.add(o),vs!==null)){for(var f="",m=30,y=0;y<=Fd;y++){for(var C=vs[y],w=y===Fd?i:C,P=y+1+". "+C;P.length<m;)P+=" ";P+=w+`
|
|
168
168
|
`,f+=P}c(`React has detected a change in the order of Hooks called by %s. This will lead to bugs and errors if not fixed. For more information, read the Rules of Hooks: https://reactjs.org/link/rules-of-hooks
|
|
169
169
|
|
|
170
170
|
Previous render Next render
|
|
@@ -177,7 +177,7 @@ See https://reactjs.org/link/refs-must-have-owner for more information.`)}}retur
|
|
|
177
177
|
See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.`)}function sR(i,o){if(oR)return!1;if(o===null)return c("%s received a final argument during this render, but not during the previous render. Even though the final argument is optional, its type cannot change between renders.",Ae),!1;i.length!==o.length&&c(`The final argument passed to %s changed size between renders. The order and size of this array must remain constant.
|
|
178
178
|
|
|
179
179
|
Previous: %s
|
|
180
|
-
Incoming: %s`,Ae,"["+o.join(", ")+"]","["+i.join(", ")+"]");for(var f=0;f<o.length&&f<i.length;f++)if(!dt(i[f],o[f]))return!1;return!0}function rg(i,o,f,m,y,C){wh=C,dr=o,vs=i!==null?i._debugHookTypes:null,Fd=-1,oR=i!==null&&i.type!==o.type,o.memoizedState=null,o.updateQueue=null,o.lanes=Pe,i!==null&&i.memoizedState!==null?gt.current=jF:vs!==null?gt.current=FF:gt.current=UF;var w=f(m,y);if(a0){var P=0;do{if(a0=!1,o0=0,P>=yie)throw new Error("Too many re-renders. React limits the number of renders to prevent an infinite loop.");P+=1,oR=!1,Ni=null,Ii=null,o.updateQueue=null,Fd=-1,gt.current=VF,w=f(m,y)}while(a0)}gt.current=Wk,o._debugHookTypes=vs;var D=Ni!==null&&Ni.next!==null;if(wh=Pe,dr=null,Ni=null,Ii=null,Ae=null,vs=null,Fd=-1,i!==null&&(i.flags&ri)!==(o.flags&ri)&&(i.mode&vn)!==Mt&&c("Internal React error: Expected static flag was missing. Please notify the React team."),Mk=!1,D)throw new Error("Rendered fewer hooks than expected. This may be caused by an accidental early return statement.");return w}function ig(){var i=o0!==0;return o0=0,i}function yF(i,o,f){o.updateQueue=i.updateQueue,(o.mode&cr)!==Mt?o.flags&=-50333701:o.flags&=-2053,i.lanes=Jf(i.lanes,f)}function bF(){if(gt.current=Wk,Mk){for(var i=dr.memoizedState;i!==null;){var o=i.queue;o!==null&&(o.pending=null),i=i.next}Mk=!1}wh=Pe,dr=null,Ni=null,Ii=null,vs=null,Fd=-1,Ae=null,OF=!1,a0=!1,o0=0}function eu(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ii===null?dr.memoizedState=Ii=i:Ii=Ii.next=i,Ii}function ys(){var i;if(Ni===null){var o=dr.alternate;o!==null?i=o.memoizedState:i=null}else i=Ni.next;var f;if(Ii===null?f=dr.memoizedState:f=Ii.next,f!==null)Ii=f,f=Ii.next,Ni=i;else{if(i===null)throw new Error("Rendered more hooks than during the previous render.");Ni=i;var m={memoizedState:Ni.memoizedState,baseState:Ni.baseState,baseQueue:Ni.baseQueue,queue:Ni.queue,next:null};Ii===null?dr.memoizedState=Ii=m:Ii=Ii.next=m}return Ii}function SF(){return{lastEffect:null,stores:null}}function lR(i,o){return typeof o=="function"?o(i):o}function uR(i,o,f){var m=eu(),y;f!==void 0?y=f(o):y=o,m.memoizedState=m.baseState=y;var C={pending:null,interleaved:null,lanes:Pe,dispatch:null,lastRenderedReducer:i,lastRenderedState:y};m.queue=C;var w=C.dispatch=Tie.bind(null,dr,C);return[m.memoizedState,w]}function cR(i,o,f){var m=ys(),y=m.queue;if(y===null)throw new Error("Should have a queue. This is likely a bug in React. Please file an issue.");y.lastRenderedReducer=i;var C=Ni,w=C.baseQueue,P=y.pending;if(P!==null){if(w!==null){var D=w.next,F=P.next;w.next=F,P.next=D}C.baseQueue!==w&&c("Internal error: Expected work-in-progress queue to be a clone. This is a bug in React."),C.baseQueue=w=P,y.pending=null}if(w!==null){var B=w.next,ae=C.baseState,re=null,ge=null,be=null,we=B;do{var st=we.lane;if(Hu(wh,st)){if(be!==null){var Pt={lane:ii,action:we.action,hasEagerState:we.hasEagerState,eagerState:we.eagerState,next:null};be=be.next=Pt}if(we.hasEagerState)ae=we.eagerState;else{var Ln=we.action;ae=i(ae,Ln)}}else{var Vt={lane:st,action:we.action,hasEagerState:we.hasEagerState,eagerState:we.eagerState,next:null};be===null?(ge=be=Vt,re=ae):be=be.next=Vt,dr.lanes=sn(dr.lanes,st),E0(st)}we=we.next}while(we!==null&&we!==B);be===null?re=ae:be.next=ge,dt(ae,m.memoizedState)||m0(),m.memoizedState=ae,m.baseState=re,m.baseQueue=be,y.lastRenderedState=ae}var wn=y.interleaved;if(wn!==null){var ce=wn;do{var _e=ce.lane;dr.lanes=sn(dr.lanes,_e),E0(_e),ce=ce.next}while(ce!==wn)}else w===null&&(y.lanes=Pe);var de=y.dispatch;return[m.memoizedState,de]}function dR(i,o,f){var m=ys(),y=m.queue;if(y===null)throw new Error("Should have a queue. This is likely a bug in React. Please file an issue.");y.lastRenderedReducer=i;var C=y.dispatch,w=y.pending,P=m.memoizedState;if(w!==null){y.pending=null;var D=w.next,F=D;do{var B=F.action;P=i(P,B),F=F.next}while(F!==D);dt(P,m.memoizedState)||m0(),m.memoizedState=P,m.baseQueue===null&&(m.baseState=P),y.lastRenderedState=P}return[P,C]}function ele(i,o,f){}function tle(i,o,f){}function fR(i,o,f){var m=dr,y=eu(),C,w=la();if(w){if(f===void 0)throw new Error("Missing getServerSnapshot, which is required for server-rendered content. Will revert to client rendering.");C=f(),tg||C!==f()&&(c("The result of getServerSnapshot should be cached to avoid an infinite loop"),tg=!0)}else{if(C=o(),!tg){var P=o();dt(C,P)||(c("The result of getSnapshot should be cached to avoid an infinite loop"),tg=!0)}var D=d1();if(D===null)throw new Error("Expected a work-in-progress root. This is a bug in React. Please file an issue.");Xf(D,wh)||CF(m,o,C)}y.memoizedState=C;var F={value:C,getSnapshot:o};return y.queue=F,Fk(TF.bind(null,m,F,i),[i]),m.flags|=Ba,s0(Mi|ua,kF.bind(null,m,F,C,o),void 0,null),C}function Lk(i,o,f){var m=dr,y=ys(),C=o();if(!tg){var w=o();dt(C,w)||(c("The result of getSnapshot should be cached to avoid an infinite loop"),tg=!0)}var P=y.memoizedState,D=!dt(P,C);D&&(y.memoizedState=C,m0());var F=y.queue;if(u0(TF.bind(null,m,F,i),[i]),F.getSnapshot!==o||D||Ii!==null&&Ii.memoizedState.tag&Mi){m.flags|=Ba,s0(Mi|ua,kF.bind(null,m,F,C,o),void 0,null);var B=d1();if(B===null)throw new Error("Expected a work-in-progress root. This is a bug in React. Please file an issue.");Xf(B,wh)||CF(m,o,C)}return C}function CF(i,o,f){i.flags|=$p;var m={getSnapshot:o,value:f},y=dr.updateQueue;if(y===null)y=SF(),dr.updateQueue=y,y.stores=[m];else{var C=y.stores;C===null?y.stores=[m]:C.push(m)}}function kF(i,o,f,m){o.value=f,o.getSnapshot=m,xF(o)&&wF(i)}function TF(i,o,f){var m=function(){xF(o)&&wF(i)};return f(m)}function xF(i){var o=i.getSnapshot,f=i.value;try{var m=o();return!dt(f,m)}catch{return!0}}function wF(i){var o=wo(i,$t);o!==null&&Vi(o,i,$t,rr)}function Nk(i){var o=eu();typeof i=="function"&&(i=i()),o.memoizedState=o.baseState=i;var f={pending:null,interleaved:null,lanes:Pe,dispatch:null,lastRenderedReducer:lR,lastRenderedState:i};o.queue=f;var m=f.dispatch=xie.bind(null,dr,f);return[o.memoizedState,m]}function hR(i){return cR(lR)}function pR(i){return dR(lR)}function s0(i,o,f,m){var y={tag:i,create:o,destroy:f,deps:m,next:null},C=dr.updateQueue;if(C===null)C=SF(),dr.updateQueue=C,C.lastEffect=y.next=y;else{var w=C.lastEffect;if(w===null)C.lastEffect=y.next=y;else{var P=w.next;w.next=y,y.next=P,C.lastEffect=y}}return y}function mR(i){var o=eu();{var f={current:i};return o.memoizedState=f,f}}function Ik(i){var o=ys();return o.memoizedState}function l0(i,o,f,m){var y=eu(),C=m===void 0?null:m;dr.flags|=i,y.memoizedState=s0(Mi|o,f,void 0,C)}function Uk(i,o,f,m){var y=ys(),C=m===void 0?null:m,w=void 0;if(Ni!==null){var P=Ni.memoizedState;if(w=P.destroy,C!==null){var D=P.deps;if(sR(C,D)){y.memoizedState=s0(o,f,w,C);return}}}dr.flags|=i,y.memoizedState=s0(Mi|o,f,w,C)}function Fk(i,o){return(dr.mode&cr)!==Mt?l0(Ml|Ba|Yv,ua,i,o):l0(Ba|Yv,ua,i,o)}function u0(i,o){return Uk(Ba,ua,i,o)}function gR(i,o){return l0(Tn,Jl,i,o)}function jk(i,o){return Uk(Tn,Jl,i,o)}function vR(i,o){var f=Tn;return f|=Ol,(dr.mode&cr)!==Mt&&(f|=ia),l0(f,Li,i,o)}function Vk(i,o){return Uk(Tn,Li,i,o)}function _F(i,o){if(typeof o=="function"){var f=o,m=i();return f(m),function(){f(null)}}else if(o!=null){var y=o;y.hasOwnProperty("current")||c("Expected useImperativeHandle() first argument to either be a ref callback or React.createRef() object. Instead received: %s.","an object with keys {"+Object.keys(y).join(", ")+"}");var C=i();return y.current=C,function(){y.current=null}}}function yR(i,o,f){typeof o!="function"&&c("Expected useImperativeHandle() second argument to be a function that creates a handle. Instead received: %s.",o!==null?typeof o:"null");var m=f!=null?f.concat([i]):null,y=Tn;return y|=Ol,(dr.mode&cr)!==Mt&&(y|=ia),l0(y,Li,_F.bind(null,o,i),m)}function zk(i,o,f){typeof o!="function"&&c("Expected useImperativeHandle() second argument to be a function that creates a handle. Instead received: %s.",o!==null?typeof o:"null");var m=f!=null?f.concat([i]):null;return Uk(Tn,Li,_F.bind(null,o,i),m)}function Sie(i,o){}var Bk=Sie;function bR(i,o){var f=eu(),m=o===void 0?null:o;return f.memoizedState=[i,m],i}function Hk(i,o){var f=ys(),m=o===void 0?null:o,y=f.memoizedState;if(y!==null&&m!==null){var C=y[1];if(sR(m,C))return y[0]}return f.memoizedState=[i,m],i}function SR(i,o){var f=eu(),m=o===void 0?null:o,y=i();return f.memoizedState=[y,m],y}function $k(i,o){var f=ys(),m=o===void 0?null:o,y=f.memoizedState;if(y!==null&&m!==null){var C=y[1];if(sR(m,C))return y[0]}var w=i();return f.memoizedState=[w,m],w}function CR(i){var o=eu();return o.memoizedState=i,i}function EF(i){var o=ys(),f=Ni,m=f.memoizedState;return PF(o,m,i)}function RF(i){var o=ys();if(Ni===null)return o.memoizedState=i,i;var f=Ni.memoizedState;return PF(o,f,i)}function PF(i,o,f){var m=!hy(wh);if(m){if(!dt(f,o)){var y=my();dr.lanes=sn(dr.lanes,y),E0(y),i.baseState=!0}return o}else return i.baseState&&(i.baseState=!1,m0()),i.memoizedState=f,f}function Cie(i,o,f){var m=$a();fi(th(m,So)),i(!0);var y=i0.transition;i0.transition={};var C=i0.transition;i0.transition._updatedFibers=new Set;try{i(!1),o()}finally{if(fi(m),i0.transition=y,y===null&&C._updatedFibers){var w=C._updatedFibers.size;w>10&&l("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table."),C._updatedFibers.clear()}}}function kR(){var i=Nk(!1),o=i[0],f=i[1],m=Cie.bind(null,f),y=eu();return y.memoizedState=m,[o,m]}function DF(){var i=hR(),o=i[0],f=ys(),m=f.memoizedState;return[o,m]}function AF(){var i=pR(),o=i[0],f=ys(),m=f.memoizedState;return[o,m]}var OF=!1;function kie(){return OF}function TR(){var i=eu(),o=d1(),f=o.identifierPrefix,m;if(la()){var y=jre();m=":"+f+"R"+y;var C=o0++;C>0&&(m+="H"+C.toString(32)),m+=":"}else{var w=vie++;m=":"+f+"r"+w.toString(32)+":"}return i.memoizedState=m,m}function qk(){var i=ys(),o=i.memoizedState;return o}function Tie(i,o,f){typeof arguments[3]=="function"&&c("State updates from the useState() and useReducer() Hooks don't support the second callback argument. To execute a side effect after rendering, declare it in the component body with useEffect().");var m=Hd(i),y={lane:m,action:f,hasEagerState:!1,eagerState:null,next:null};if(MF(i))LF(o,y);else{var C=lF(i,o,y,m);if(C!==null){var w=Za();Vi(C,i,m,w),NF(C,o,m)}}IF(i,m)}function xie(i,o,f){typeof arguments[3]=="function"&&c("State updates from the useState() and useReducer() Hooks don't support the second callback argument. To execute a side effect after rendering, declare it in the component body with useEffect().");var m=Hd(i),y={lane:m,action:f,hasEagerState:!1,eagerState:null,next:null};if(MF(i))LF(o,y);else{var C=i.alternate;if(i.lanes===Pe&&(C===null||C.lanes===Pe)){var w=o.lastRenderedReducer;if(w!==null){var P;P=gt.current,gt.current=tl;try{var D=o.lastRenderedState,F=w(D,f);if(y.hasEagerState=!0,y.eagerState=F,dt(F,D)){lie(i,o,y,m);return}}catch{}finally{gt.current=P}}}var B=lF(i,o,y,m);if(B!==null){var ae=Za();Vi(B,i,m,ae),NF(B,o,m)}}IF(i,m)}function MF(i){var o=i.alternate;return i===dr||o!==null&&o===dr}function LF(i,o){a0=Mk=!0;var f=i.pending;f===null?o.next=o:(o.next=f.next,f.next=o),i.pending=o}function NF(i,o,f){if(py(f)){var m=o.lanes;m=gm(m,i.pendingLanes);var y=sn(m,f);o.lanes=y,eh(i,y)}}function IF(i,o,f){$f(i,o)}var Wk={readContext:Ti,useCallback:Ia,useContext:Ia,useEffect:Ia,useImperativeHandle:Ia,useInsertionEffect:Ia,useLayoutEffect:Ia,useMemo:Ia,useReducer:Ia,useRef:Ia,useState:Ia,useDebugValue:Ia,useDeferredValue:Ia,useTransition:Ia,useMutableSource:Ia,useSyncExternalStore:Ia,useId:Ia,unstable_isNewReconciler:He},UF=null,FF=null,jF=null,VF=null,tu=null,tl=null,Gk=null;{var xR=function(){c("Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo().")},en=function(){c("Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. You can only call Hooks at the top level of your React function. For more information, see https://reactjs.org/link/rules-of-hooks")};UF={readContext:function(i){return Ti(i)},useCallback:function(i,o){return Ae="useCallback",Qn(),ng(o),bR(i,o)},useContext:function(i){return Ae="useContext",Qn(),Ti(i)},useEffect:function(i,o){return Ae="useEffect",Qn(),ng(o),Fk(i,o)},useImperativeHandle:function(i,o,f){return Ae="useImperativeHandle",Qn(),ng(f),yR(i,o,f)},useInsertionEffect:function(i,o){return Ae="useInsertionEffect",Qn(),ng(o),gR(i,o)},useLayoutEffect:function(i,o){return Ae="useLayoutEffect",Qn(),ng(o),vR(i,o)},useMemo:function(i,o){Ae="useMemo",Qn(),ng(o);var f=gt.current;gt.current=tu;try{return SR(i,o)}finally{gt.current=f}},useReducer:function(i,o,f){Ae="useReducer",Qn();var m=gt.current;gt.current=tu;try{return uR(i,o,f)}finally{gt.current=m}},useRef:function(i){return Ae="useRef",Qn(),mR(i)},useState:function(i){Ae="useState",Qn();var o=gt.current;gt.current=tu;try{return Nk(i)}finally{gt.current=o}},useDebugValue:function(i,o){return Ae="useDebugValue",Qn(),void 0},useDeferredValue:function(i){return Ae="useDeferredValue",Qn(),CR(i)},useTransition:function(){return Ae="useTransition",Qn(),kR()},useMutableSource:function(i,o,f){return Ae="useMutableSource",Qn(),void 0},useSyncExternalStore:function(i,o,f){return Ae="useSyncExternalStore",Qn(),fR(i,o,f)},useId:function(){return Ae="useId",Qn(),TR()},unstable_isNewReconciler:He},FF={readContext:function(i){return Ti(i)},useCallback:function(i,o){return Ae="useCallback",nt(),bR(i,o)},useContext:function(i){return Ae="useContext",nt(),Ti(i)},useEffect:function(i,o){return Ae="useEffect",nt(),Fk(i,o)},useImperativeHandle:function(i,o,f){return Ae="useImperativeHandle",nt(),yR(i,o,f)},useInsertionEffect:function(i,o){return Ae="useInsertionEffect",nt(),gR(i,o)},useLayoutEffect:function(i,o){return Ae="useLayoutEffect",nt(),vR(i,o)},useMemo:function(i,o){Ae="useMemo",nt();var f=gt.current;gt.current=tu;try{return SR(i,o)}finally{gt.current=f}},useReducer:function(i,o,f){Ae="useReducer",nt();var m=gt.current;gt.current=tu;try{return uR(i,o,f)}finally{gt.current=m}},useRef:function(i){return Ae="useRef",nt(),mR(i)},useState:function(i){Ae="useState",nt();var o=gt.current;gt.current=tu;try{return Nk(i)}finally{gt.current=o}},useDebugValue:function(i,o){return Ae="useDebugValue",nt(),void 0},useDeferredValue:function(i){return Ae="useDeferredValue",nt(),CR(i)},useTransition:function(){return Ae="useTransition",nt(),kR()},useMutableSource:function(i,o,f){return Ae="useMutableSource",nt(),void 0},useSyncExternalStore:function(i,o,f){return Ae="useSyncExternalStore",nt(),fR(i,o,f)},useId:function(){return Ae="useId",nt(),TR()},unstable_isNewReconciler:He},jF={readContext:function(i){return Ti(i)},useCallback:function(i,o){return Ae="useCallback",nt(),Hk(i,o)},useContext:function(i){return Ae="useContext",nt(),Ti(i)},useEffect:function(i,o){return Ae="useEffect",nt(),u0(i,o)},useImperativeHandle:function(i,o,f){return Ae="useImperativeHandle",nt(),zk(i,o,f)},useInsertionEffect:function(i,o){return Ae="useInsertionEffect",nt(),jk(i,o)},useLayoutEffect:function(i,o){return Ae="useLayoutEffect",nt(),Vk(i,o)},useMemo:function(i,o){Ae="useMemo",nt();var f=gt.current;gt.current=tl;try{return $k(i,o)}finally{gt.current=f}},useReducer:function(i,o,f){Ae="useReducer",nt();var m=gt.current;gt.current=tl;try{return cR(i,o,f)}finally{gt.current=m}},useRef:function(i){return Ae="useRef",nt(),Ik()},useState:function(i){Ae="useState",nt();var o=gt.current;gt.current=tl;try{return hR(i)}finally{gt.current=o}},useDebugValue:function(i,o){return Ae="useDebugValue",nt(),Bk()},useDeferredValue:function(i){return Ae="useDeferredValue",nt(),EF(i)},useTransition:function(){return Ae="useTransition",nt(),DF()},useMutableSource:function(i,o,f){return Ae="useMutableSource",nt(),void 0},useSyncExternalStore:function(i,o,f){return Ae="useSyncExternalStore",nt(),Lk(i,o)},useId:function(){return Ae="useId",nt(),qk()},unstable_isNewReconciler:He},VF={readContext:function(i){return Ti(i)},useCallback:function(i,o){return Ae="useCallback",nt(),Hk(i,o)},useContext:function(i){return Ae="useContext",nt(),Ti(i)},useEffect:function(i,o){return Ae="useEffect",nt(),u0(i,o)},useImperativeHandle:function(i,o,f){return Ae="useImperativeHandle",nt(),zk(i,o,f)},useInsertionEffect:function(i,o){return Ae="useInsertionEffect",nt(),jk(i,o)},useLayoutEffect:function(i,o){return Ae="useLayoutEffect",nt(),Vk(i,o)},useMemo:function(i,o){Ae="useMemo",nt();var f=gt.current;gt.current=Gk;try{return $k(i,o)}finally{gt.current=f}},useReducer:function(i,o,f){Ae="useReducer",nt();var m=gt.current;gt.current=Gk;try{return dR(i,o,f)}finally{gt.current=m}},useRef:function(i){return Ae="useRef",nt(),Ik()},useState:function(i){Ae="useState",nt();var o=gt.current;gt.current=Gk;try{return pR(i)}finally{gt.current=o}},useDebugValue:function(i,o){return Ae="useDebugValue",nt(),Bk()},useDeferredValue:function(i){return Ae="useDeferredValue",nt(),RF(i)},useTransition:function(){return Ae="useTransition",nt(),AF()},useMutableSource:function(i,o,f){return Ae="useMutableSource",nt(),void 0},useSyncExternalStore:function(i,o,f){return Ae="useSyncExternalStore",nt(),Lk(i,o)},useId:function(){return Ae="useId",nt(),qk()},unstable_isNewReconciler:He},tu={readContext:function(i){return xR(),Ti(i)},useCallback:function(i,o){return Ae="useCallback",en(),Qn(),bR(i,o)},useContext:function(i){return Ae="useContext",en(),Qn(),Ti(i)},useEffect:function(i,o){return Ae="useEffect",en(),Qn(),Fk(i,o)},useImperativeHandle:function(i,o,f){return Ae="useImperativeHandle",en(),Qn(),yR(i,o,f)},useInsertionEffect:function(i,o){return Ae="useInsertionEffect",en(),Qn(),gR(i,o)},useLayoutEffect:function(i,o){return Ae="useLayoutEffect",en(),Qn(),vR(i,o)},useMemo:function(i,o){Ae="useMemo",en(),Qn();var f=gt.current;gt.current=tu;try{return SR(i,o)}finally{gt.current=f}},useReducer:function(i,o,f){Ae="useReducer",en(),Qn();var m=gt.current;gt.current=tu;try{return uR(i,o,f)}finally{gt.current=m}},useRef:function(i){return Ae="useRef",en(),Qn(),mR(i)},useState:function(i){Ae="useState",en(),Qn();var o=gt.current;gt.current=tu;try{return Nk(i)}finally{gt.current=o}},useDebugValue:function(i,o){return Ae="useDebugValue",en(),Qn(),void 0},useDeferredValue:function(i){return Ae="useDeferredValue",en(),Qn(),CR(i)},useTransition:function(){return Ae="useTransition",en(),Qn(),kR()},useMutableSource:function(i,o,f){return Ae="useMutableSource",en(),Qn(),void 0},useSyncExternalStore:function(i,o,f){return Ae="useSyncExternalStore",en(),Qn(),fR(i,o,f)},useId:function(){return Ae="useId",en(),Qn(),TR()},unstable_isNewReconciler:He},tl={readContext:function(i){return xR(),Ti(i)},useCallback:function(i,o){return Ae="useCallback",en(),nt(),Hk(i,o)},useContext:function(i){return Ae="useContext",en(),nt(),Ti(i)},useEffect:function(i,o){return Ae="useEffect",en(),nt(),u0(i,o)},useImperativeHandle:function(i,o,f){return Ae="useImperativeHandle",en(),nt(),zk(i,o,f)},useInsertionEffect:function(i,o){return Ae="useInsertionEffect",en(),nt(),jk(i,o)},useLayoutEffect:function(i,o){return Ae="useLayoutEffect",en(),nt(),Vk(i,o)},useMemo:function(i,o){Ae="useMemo",en(),nt();var f=gt.current;gt.current=tl;try{return $k(i,o)}finally{gt.current=f}},useReducer:function(i,o,f){Ae="useReducer",en(),nt();var m=gt.current;gt.current=tl;try{return cR(i,o,f)}finally{gt.current=m}},useRef:function(i){return Ae="useRef",en(),nt(),Ik()},useState:function(i){Ae="useState",en(),nt();var o=gt.current;gt.current=tl;try{return hR(i)}finally{gt.current=o}},useDebugValue:function(i,o){return Ae="useDebugValue",en(),nt(),Bk()},useDeferredValue:function(i){return Ae="useDeferredValue",en(),nt(),EF(i)},useTransition:function(){return Ae="useTransition",en(),nt(),DF()},useMutableSource:function(i,o,f){return Ae="useMutableSource",en(),nt(),void 0},useSyncExternalStore:function(i,o,f){return Ae="useSyncExternalStore",en(),nt(),Lk(i,o)},useId:function(){return Ae="useId",en(),nt(),qk()},unstable_isNewReconciler:He},Gk={readContext:function(i){return xR(),Ti(i)},useCallback:function(i,o){return Ae="useCallback",en(),nt(),Hk(i,o)},useContext:function(i){return Ae="useContext",en(),nt(),Ti(i)},useEffect:function(i,o){return Ae="useEffect",en(),nt(),u0(i,o)},useImperativeHandle:function(i,o,f){return Ae="useImperativeHandle",en(),nt(),zk(i,o,f)},useInsertionEffect:function(i,o){return Ae="useInsertionEffect",en(),nt(),jk(i,o)},useLayoutEffect:function(i,o){return Ae="useLayoutEffect",en(),nt(),Vk(i,o)},useMemo:function(i,o){Ae="useMemo",en(),nt();var f=gt.current;gt.current=tl;try{return $k(i,o)}finally{gt.current=f}},useReducer:function(i,o,f){Ae="useReducer",en(),nt();var m=gt.current;gt.current=tl;try{return dR(i,o,f)}finally{gt.current=m}},useRef:function(i){return Ae="useRef",en(),nt(),Ik()},useState:function(i){Ae="useState",en(),nt();var o=gt.current;gt.current=tl;try{return pR(i)}finally{gt.current=o}},useDebugValue:function(i,o){return Ae="useDebugValue",en(),nt(),Bk()},useDeferredValue:function(i){return Ae="useDeferredValue",en(),nt(),RF(i)},useTransition:function(){return Ae="useTransition",en(),nt(),AF()},useMutableSource:function(i,o,f){return Ae="useMutableSource",en(),nt(),void 0},useSyncExternalStore:function(i,o,f){return Ae="useSyncExternalStore",en(),nt(),Lk(i,o)},useId:function(){return Ae="useId",en(),nt(),qk()},unstable_isNewReconciler:He}}var jd=n.unstable_now,zF=0,Yk=-1,c0=-1,Kk=-1,wR=!1,Zk=!1;function BF(){return wR}function wie(){Zk=!0}function _ie(){wR=!1,Zk=!1}function Eie(){wR=Zk,Zk=!1}function HF(){return zF}function $F(){zF=jd()}function _R(i){c0=jd(),i.actualStartTime<0&&(i.actualStartTime=jd())}function qF(i){c0=-1}function Qk(i,o){if(c0>=0){var f=jd()-c0;i.actualDuration+=f,o&&(i.selfBaseDuration=f),c0=-1}}function nu(i){if(Yk>=0){var o=jd()-Yk;Yk=-1;for(var f=i.return;f!==null;){switch(f.tag){case k:var m=f.stateNode;m.effectDuration+=o;return;case I:var y=f.stateNode;y.effectDuration+=o;return}f=f.return}}}function ER(i){if(Kk>=0){var o=jd()-Kk;Kk=-1;for(var f=i.return;f!==null;){switch(f.tag){case k:var m=f.stateNode;m!==null&&(m.passiveEffectDuration+=o);return;case I:var y=f.stateNode;y!==null&&(y.passiveEffectDuration+=o);return}f=f.return}}}function ru(){Yk=jd()}function RR(){Kk=jd()}function PR(i){for(var o=i.child;o;)i.actualDuration+=o.actualDuration,o=o.sibling}function nl(i,o){if(i&&i.defaultProps){var f=rn({},o),m=i.defaultProps;for(var y in m)f[y]===void 0&&(f[y]=m[y]);return f}return o}var DR={},AR,OR,MR,LR,NR,WF,Xk,IR,UR,FR,d0;{AR=new Set,OR=new Set,MR=new Set,LR=new Set,IR=new Set,NR=new Set,UR=new Set,FR=new Set,d0=new Set;var GF=new Set;Xk=function(i,o){if(!(i===null||typeof i=="function")){var f=o+"_"+i;GF.has(f)||(GF.add(f),c("%s(...): Expected the last optional `callback` argument to be a function. Instead received: %s.",o,i))}},WF=function(i,o){if(o===void 0){var f=On(i)||"Component";NR.has(f)||(NR.add(f),c("%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. You have returned undefined.",f))}},Object.defineProperty(DR,"_processChildContext",{enumerable:!1,value:function(){throw new Error("_processChildContext is not available in React 16+. This likely means you have multiple copies of React and are attempting to nest a React 15 tree inside a React 16 tree using unstable_renderSubtreeIntoContainer, which isn't supported. Try to make sure you have only one copy of React (and ideally, switch to ReactDOM.createPortal).")}}),Object.freeze(DR)}function jR(i,o,f,m){var y=i.memoizedState,C=f(m,y);{if(i.mode&an){nr(!0);try{C=f(m,y)}finally{nr(!1)}}WF(o,C)}var w=C==null?y:rn({},y,C);if(i.memoizedState=w,i.lanes===Pe){var P=i.updateQueue;P.baseState=w}}var VR={isMounted:Kv,enqueueSetState:function(i,o,f){var m=ld(i),y=Za(),C=Hd(m),w=ac(y,C);w.payload=o,f!=null&&(Xk(f,"setState"),w.callback=f);var P=Nd(m,w,C);P!==null&&(Vi(P,m,C,y),Ek(P,m,C)),$f(m,C)},enqueueReplaceState:function(i,o,f){var m=ld(i),y=Za(),C=Hd(m),w=ac(y,C);w.tag=cF,w.payload=o,f!=null&&(Xk(f,"replaceState"),w.callback=f);var P=Nd(m,w,C);P!==null&&(Vi(P,m,C,y),Ek(P,m,C)),$f(m,C)},enqueueForceUpdate:function(i,o){var f=ld(i),m=Za(),y=Hd(f),C=ac(m,y);C.tag=xk,o!=null&&(Xk(o,"forceUpdate"),C.callback=o);var w=Nd(f,C,y);w!==null&&(Vi(w,f,y,m),Ek(w,f,y)),uy(f,y)}};function YF(i,o,f,m,y,C,w){var P=i.stateNode;if(typeof P.shouldComponentUpdate=="function"){var D=P.shouldComponentUpdate(m,C,w);{if(i.mode&an){nr(!0);try{D=P.shouldComponentUpdate(m,C,w)}finally{nr(!1)}}D===void 0&&c("%s.shouldComponentUpdate(): Returned undefined instead of a boolean value. Make sure to return true or false.",On(o)||"Component")}return D}return o.prototype&&o.prototype.isPureReactComponent?!Ut(f,m)||!Ut(y,C):!0}function Rie(i,o,f){var m=i.stateNode;{var y=On(o)||"Component",C=m.render;C||(o.prototype&&typeof o.prototype.render=="function"?c("%s(...): No `render` method found on the returned component instance: did you accidentally return an object from the constructor?",y):c("%s(...): No `render` method found on the returned component instance: you may have forgotten to define `render`.",y)),m.getInitialState&&!m.getInitialState.isReactClassApproved&&!m.state&&c("getInitialState was defined on %s, a plain JavaScript class. This is only supported for classes created using React.createClass. Did you mean to define a state property instead?",y),m.getDefaultProps&&!m.getDefaultProps.isReactClassApproved&&c("getDefaultProps was defined on %s, a plain JavaScript class. This is only supported for classes created using React.createClass. Use a static property to define defaultProps instead.",y),m.propTypes&&c("propTypes was defined as an instance property on %s. Use a static property to define propTypes instead.",y),m.contextType&&c("contextType was defined as an instance property on %s. Use a static property to define contextType instead.",y),o.childContextTypes&&!d0.has(o)&&(i.mode&an)===Mt&&(d0.add(o),c(`%s uses the legacy childContextTypes API which is no longer supported and will be removed in the next major release. Use React.createContext() instead
|
|
180
|
+
Incoming: %s`,Ae,"["+o.join(", ")+"]","["+i.join(", ")+"]");for(var f=0;f<o.length&&f<i.length;f++)if(!dt(i[f],o[f]))return!1;return!0}function rg(i,o,f,m,y,C){wh=C,dr=o,vs=i!==null?i._debugHookTypes:null,Fd=-1,oR=i!==null&&i.type!==o.type,o.memoizedState=null,o.updateQueue=null,o.lanes=Pe,i!==null&&i.memoizedState!==null?gt.current=jF:vs!==null?gt.current=FF:gt.current=UF;var w=f(m,y);if(a0){var P=0;do{if(a0=!1,o0=0,P>=bie)throw new Error("Too many re-renders. React limits the number of renders to prevent an infinite loop.");P+=1,oR=!1,Ni=null,Ii=null,o.updateQueue=null,Fd=-1,gt.current=VF,w=f(m,y)}while(a0)}gt.current=Wk,o._debugHookTypes=vs;var D=Ni!==null&&Ni.next!==null;if(wh=Pe,dr=null,Ni=null,Ii=null,Ae=null,vs=null,Fd=-1,i!==null&&(i.flags&ri)!==(o.flags&ri)&&(i.mode&vn)!==Mt&&c("Internal React error: Expected static flag was missing. Please notify the React team."),Mk=!1,D)throw new Error("Rendered fewer hooks than expected. This may be caused by an accidental early return statement.");return w}function ig(){var i=o0!==0;return o0=0,i}function yF(i,o,f){o.updateQueue=i.updateQueue,(o.mode&cr)!==Mt?o.flags&=-50333701:o.flags&=-2053,i.lanes=Jf(i.lanes,f)}function bF(){if(gt.current=Wk,Mk){for(var i=dr.memoizedState;i!==null;){var o=i.queue;o!==null&&(o.pending=null),i=i.next}Mk=!1}wh=Pe,dr=null,Ni=null,Ii=null,vs=null,Fd=-1,Ae=null,OF=!1,a0=!1,o0=0}function eu(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ii===null?dr.memoizedState=Ii=i:Ii=Ii.next=i,Ii}function ys(){var i;if(Ni===null){var o=dr.alternate;o!==null?i=o.memoizedState:i=null}else i=Ni.next;var f;if(Ii===null?f=dr.memoizedState:f=Ii.next,f!==null)Ii=f,f=Ii.next,Ni=i;else{if(i===null)throw new Error("Rendered more hooks than during the previous render.");Ni=i;var m={memoizedState:Ni.memoizedState,baseState:Ni.baseState,baseQueue:Ni.baseQueue,queue:Ni.queue,next:null};Ii===null?dr.memoizedState=Ii=m:Ii=Ii.next=m}return Ii}function SF(){return{lastEffect:null,stores:null}}function lR(i,o){return typeof o=="function"?o(i):o}function uR(i,o,f){var m=eu(),y;f!==void 0?y=f(o):y=o,m.memoizedState=m.baseState=y;var C={pending:null,interleaved:null,lanes:Pe,dispatch:null,lastRenderedReducer:i,lastRenderedState:y};m.queue=C;var w=C.dispatch=xie.bind(null,dr,C);return[m.memoizedState,w]}function cR(i,o,f){var m=ys(),y=m.queue;if(y===null)throw new Error("Should have a queue. This is likely a bug in React. Please file an issue.");y.lastRenderedReducer=i;var C=Ni,w=C.baseQueue,P=y.pending;if(P!==null){if(w!==null){var D=w.next,F=P.next;w.next=F,P.next=D}C.baseQueue!==w&&c("Internal error: Expected work-in-progress queue to be a clone. This is a bug in React."),C.baseQueue=w=P,y.pending=null}if(w!==null){var B=w.next,ae=C.baseState,re=null,ge=null,be=null,we=B;do{var st=we.lane;if(Hu(wh,st)){if(be!==null){var Pt={lane:ii,action:we.action,hasEagerState:we.hasEagerState,eagerState:we.eagerState,next:null};be=be.next=Pt}if(we.hasEagerState)ae=we.eagerState;else{var Ln=we.action;ae=i(ae,Ln)}}else{var Vt={lane:st,action:we.action,hasEagerState:we.hasEagerState,eagerState:we.eagerState,next:null};be===null?(ge=be=Vt,re=ae):be=be.next=Vt,dr.lanes=sn(dr.lanes,st),E0(st)}we=we.next}while(we!==null&&we!==B);be===null?re=ae:be.next=ge,dt(ae,m.memoizedState)||m0(),m.memoizedState=ae,m.baseState=re,m.baseQueue=be,y.lastRenderedState=ae}var wn=y.interleaved;if(wn!==null){var ce=wn;do{var _e=ce.lane;dr.lanes=sn(dr.lanes,_e),E0(_e),ce=ce.next}while(ce!==wn)}else w===null&&(y.lanes=Pe);var de=y.dispatch;return[m.memoizedState,de]}function dR(i,o,f){var m=ys(),y=m.queue;if(y===null)throw new Error("Should have a queue. This is likely a bug in React. Please file an issue.");y.lastRenderedReducer=i;var C=y.dispatch,w=y.pending,P=m.memoizedState;if(w!==null){y.pending=null;var D=w.next,F=D;do{var B=F.action;P=i(P,B),F=F.next}while(F!==D);dt(P,m.memoizedState)||m0(),m.memoizedState=P,m.baseQueue===null&&(m.baseState=P),y.lastRenderedState=P}return[P,C]}function tle(i,o,f){}function nle(i,o,f){}function fR(i,o,f){var m=dr,y=eu(),C,w=la();if(w){if(f===void 0)throw new Error("Missing getServerSnapshot, which is required for server-rendered content. Will revert to client rendering.");C=f(),tg||C!==f()&&(c("The result of getServerSnapshot should be cached to avoid an infinite loop"),tg=!0)}else{if(C=o(),!tg){var P=o();dt(C,P)||(c("The result of getSnapshot should be cached to avoid an infinite loop"),tg=!0)}var D=d1();if(D===null)throw new Error("Expected a work-in-progress root. This is a bug in React. Please file an issue.");Xf(D,wh)||CF(m,o,C)}y.memoizedState=C;var F={value:C,getSnapshot:o};return y.queue=F,Fk(TF.bind(null,m,F,i),[i]),m.flags|=Ba,s0(Mi|ua,kF.bind(null,m,F,C,o),void 0,null),C}function Lk(i,o,f){var m=dr,y=ys(),C=o();if(!tg){var w=o();dt(C,w)||(c("The result of getSnapshot should be cached to avoid an infinite loop"),tg=!0)}var P=y.memoizedState,D=!dt(P,C);D&&(y.memoizedState=C,m0());var F=y.queue;if(u0(TF.bind(null,m,F,i),[i]),F.getSnapshot!==o||D||Ii!==null&&Ii.memoizedState.tag&Mi){m.flags|=Ba,s0(Mi|ua,kF.bind(null,m,F,C,o),void 0,null);var B=d1();if(B===null)throw new Error("Expected a work-in-progress root. This is a bug in React. Please file an issue.");Xf(B,wh)||CF(m,o,C)}return C}function CF(i,o,f){i.flags|=$p;var m={getSnapshot:o,value:f},y=dr.updateQueue;if(y===null)y=SF(),dr.updateQueue=y,y.stores=[m];else{var C=y.stores;C===null?y.stores=[m]:C.push(m)}}function kF(i,o,f,m){o.value=f,o.getSnapshot=m,xF(o)&&wF(i)}function TF(i,o,f){var m=function(){xF(o)&&wF(i)};return f(m)}function xF(i){var o=i.getSnapshot,f=i.value;try{var m=o();return!dt(f,m)}catch{return!0}}function wF(i){var o=wo(i,$t);o!==null&&Vi(o,i,$t,rr)}function Nk(i){var o=eu();typeof i=="function"&&(i=i()),o.memoizedState=o.baseState=i;var f={pending:null,interleaved:null,lanes:Pe,dispatch:null,lastRenderedReducer:lR,lastRenderedState:i};o.queue=f;var m=f.dispatch=wie.bind(null,dr,f);return[o.memoizedState,m]}function hR(i){return cR(lR)}function pR(i){return dR(lR)}function s0(i,o,f,m){var y={tag:i,create:o,destroy:f,deps:m,next:null},C=dr.updateQueue;if(C===null)C=SF(),dr.updateQueue=C,C.lastEffect=y.next=y;else{var w=C.lastEffect;if(w===null)C.lastEffect=y.next=y;else{var P=w.next;w.next=y,y.next=P,C.lastEffect=y}}return y}function mR(i){var o=eu();{var f={current:i};return o.memoizedState=f,f}}function Ik(i){var o=ys();return o.memoizedState}function l0(i,o,f,m){var y=eu(),C=m===void 0?null:m;dr.flags|=i,y.memoizedState=s0(Mi|o,f,void 0,C)}function Uk(i,o,f,m){var y=ys(),C=m===void 0?null:m,w=void 0;if(Ni!==null){var P=Ni.memoizedState;if(w=P.destroy,C!==null){var D=P.deps;if(sR(C,D)){y.memoizedState=s0(o,f,w,C);return}}}dr.flags|=i,y.memoizedState=s0(Mi|o,f,w,C)}function Fk(i,o){return(dr.mode&cr)!==Mt?l0(Ml|Ba|Yv,ua,i,o):l0(Ba|Yv,ua,i,o)}function u0(i,o){return Uk(Ba,ua,i,o)}function gR(i,o){return l0(Tn,Jl,i,o)}function jk(i,o){return Uk(Tn,Jl,i,o)}function vR(i,o){var f=Tn;return f|=Ol,(dr.mode&cr)!==Mt&&(f|=ia),l0(f,Li,i,o)}function Vk(i,o){return Uk(Tn,Li,i,o)}function _F(i,o){if(typeof o=="function"){var f=o,m=i();return f(m),function(){f(null)}}else if(o!=null){var y=o;y.hasOwnProperty("current")||c("Expected useImperativeHandle() first argument to either be a ref callback or React.createRef() object. Instead received: %s.","an object with keys {"+Object.keys(y).join(", ")+"}");var C=i();return y.current=C,function(){y.current=null}}}function yR(i,o,f){typeof o!="function"&&c("Expected useImperativeHandle() second argument to be a function that creates a handle. Instead received: %s.",o!==null?typeof o:"null");var m=f!=null?f.concat([i]):null,y=Tn;return y|=Ol,(dr.mode&cr)!==Mt&&(y|=ia),l0(y,Li,_F.bind(null,o,i),m)}function zk(i,o,f){typeof o!="function"&&c("Expected useImperativeHandle() second argument to be a function that creates a handle. Instead received: %s.",o!==null?typeof o:"null");var m=f!=null?f.concat([i]):null;return Uk(Tn,Li,_F.bind(null,o,i),m)}function Cie(i,o){}var Bk=Cie;function bR(i,o){var f=eu(),m=o===void 0?null:o;return f.memoizedState=[i,m],i}function Hk(i,o){var f=ys(),m=o===void 0?null:o,y=f.memoizedState;if(y!==null&&m!==null){var C=y[1];if(sR(m,C))return y[0]}return f.memoizedState=[i,m],i}function SR(i,o){var f=eu(),m=o===void 0?null:o,y=i();return f.memoizedState=[y,m],y}function $k(i,o){var f=ys(),m=o===void 0?null:o,y=f.memoizedState;if(y!==null&&m!==null){var C=y[1];if(sR(m,C))return y[0]}var w=i();return f.memoizedState=[w,m],w}function CR(i){var o=eu();return o.memoizedState=i,i}function EF(i){var o=ys(),f=Ni,m=f.memoizedState;return PF(o,m,i)}function RF(i){var o=ys();if(Ni===null)return o.memoizedState=i,i;var f=Ni.memoizedState;return PF(o,f,i)}function PF(i,o,f){var m=!hy(wh);if(m){if(!dt(f,o)){var y=my();dr.lanes=sn(dr.lanes,y),E0(y),i.baseState=!0}return o}else return i.baseState&&(i.baseState=!1,m0()),i.memoizedState=f,f}function kie(i,o,f){var m=$a();fi(th(m,So)),i(!0);var y=i0.transition;i0.transition={};var C=i0.transition;i0.transition._updatedFibers=new Set;try{i(!1),o()}finally{if(fi(m),i0.transition=y,y===null&&C._updatedFibers){var w=C._updatedFibers.size;w>10&&l("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table."),C._updatedFibers.clear()}}}function kR(){var i=Nk(!1),o=i[0],f=i[1],m=kie.bind(null,f),y=eu();return y.memoizedState=m,[o,m]}function DF(){var i=hR(),o=i[0],f=ys(),m=f.memoizedState;return[o,m]}function AF(){var i=pR(),o=i[0],f=ys(),m=f.memoizedState;return[o,m]}var OF=!1;function Tie(){return OF}function TR(){var i=eu(),o=d1(),f=o.identifierPrefix,m;if(la()){var y=Vre();m=":"+f+"R"+y;var C=o0++;C>0&&(m+="H"+C.toString(32)),m+=":"}else{var w=yie++;m=":"+f+"r"+w.toString(32)+":"}return i.memoizedState=m,m}function qk(){var i=ys(),o=i.memoizedState;return o}function xie(i,o,f){typeof arguments[3]=="function"&&c("State updates from the useState() and useReducer() Hooks don't support the second callback argument. To execute a side effect after rendering, declare it in the component body with useEffect().");var m=Hd(i),y={lane:m,action:f,hasEagerState:!1,eagerState:null,next:null};if(MF(i))LF(o,y);else{var C=lF(i,o,y,m);if(C!==null){var w=Za();Vi(C,i,m,w),NF(C,o,m)}}IF(i,m)}function wie(i,o,f){typeof arguments[3]=="function"&&c("State updates from the useState() and useReducer() Hooks don't support the second callback argument. To execute a side effect after rendering, declare it in the component body with useEffect().");var m=Hd(i),y={lane:m,action:f,hasEagerState:!1,eagerState:null,next:null};if(MF(i))LF(o,y);else{var C=i.alternate;if(i.lanes===Pe&&(C===null||C.lanes===Pe)){var w=o.lastRenderedReducer;if(w!==null){var P;P=gt.current,gt.current=tl;try{var D=o.lastRenderedState,F=w(D,f);if(y.hasEagerState=!0,y.eagerState=F,dt(F,D)){uie(i,o,y,m);return}}catch{}finally{gt.current=P}}}var B=lF(i,o,y,m);if(B!==null){var ae=Za();Vi(B,i,m,ae),NF(B,o,m)}}IF(i,m)}function MF(i){var o=i.alternate;return i===dr||o!==null&&o===dr}function LF(i,o){a0=Mk=!0;var f=i.pending;f===null?o.next=o:(o.next=f.next,f.next=o),i.pending=o}function NF(i,o,f){if(py(f)){var m=o.lanes;m=gm(m,i.pendingLanes);var y=sn(m,f);o.lanes=y,eh(i,y)}}function IF(i,o,f){$f(i,o)}var Wk={readContext:Ti,useCallback:Ia,useContext:Ia,useEffect:Ia,useImperativeHandle:Ia,useInsertionEffect:Ia,useLayoutEffect:Ia,useMemo:Ia,useReducer:Ia,useRef:Ia,useState:Ia,useDebugValue:Ia,useDeferredValue:Ia,useTransition:Ia,useMutableSource:Ia,useSyncExternalStore:Ia,useId:Ia,unstable_isNewReconciler:He},UF=null,FF=null,jF=null,VF=null,tu=null,tl=null,Gk=null;{var xR=function(){c("Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo().")},en=function(){c("Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. You can only call Hooks at the top level of your React function. For more information, see https://reactjs.org/link/rules-of-hooks")};UF={readContext:function(i){return Ti(i)},useCallback:function(i,o){return Ae="useCallback",Qn(),ng(o),bR(i,o)},useContext:function(i){return Ae="useContext",Qn(),Ti(i)},useEffect:function(i,o){return Ae="useEffect",Qn(),ng(o),Fk(i,o)},useImperativeHandle:function(i,o,f){return Ae="useImperativeHandle",Qn(),ng(f),yR(i,o,f)},useInsertionEffect:function(i,o){return Ae="useInsertionEffect",Qn(),ng(o),gR(i,o)},useLayoutEffect:function(i,o){return Ae="useLayoutEffect",Qn(),ng(o),vR(i,o)},useMemo:function(i,o){Ae="useMemo",Qn(),ng(o);var f=gt.current;gt.current=tu;try{return SR(i,o)}finally{gt.current=f}},useReducer:function(i,o,f){Ae="useReducer",Qn();var m=gt.current;gt.current=tu;try{return uR(i,o,f)}finally{gt.current=m}},useRef:function(i){return Ae="useRef",Qn(),mR(i)},useState:function(i){Ae="useState",Qn();var o=gt.current;gt.current=tu;try{return Nk(i)}finally{gt.current=o}},useDebugValue:function(i,o){return Ae="useDebugValue",Qn(),void 0},useDeferredValue:function(i){return Ae="useDeferredValue",Qn(),CR(i)},useTransition:function(){return Ae="useTransition",Qn(),kR()},useMutableSource:function(i,o,f){return Ae="useMutableSource",Qn(),void 0},useSyncExternalStore:function(i,o,f){return Ae="useSyncExternalStore",Qn(),fR(i,o,f)},useId:function(){return Ae="useId",Qn(),TR()},unstable_isNewReconciler:He},FF={readContext:function(i){return Ti(i)},useCallback:function(i,o){return Ae="useCallback",nt(),bR(i,o)},useContext:function(i){return Ae="useContext",nt(),Ti(i)},useEffect:function(i,o){return Ae="useEffect",nt(),Fk(i,o)},useImperativeHandle:function(i,o,f){return Ae="useImperativeHandle",nt(),yR(i,o,f)},useInsertionEffect:function(i,o){return Ae="useInsertionEffect",nt(),gR(i,o)},useLayoutEffect:function(i,o){return Ae="useLayoutEffect",nt(),vR(i,o)},useMemo:function(i,o){Ae="useMemo",nt();var f=gt.current;gt.current=tu;try{return SR(i,o)}finally{gt.current=f}},useReducer:function(i,o,f){Ae="useReducer",nt();var m=gt.current;gt.current=tu;try{return uR(i,o,f)}finally{gt.current=m}},useRef:function(i){return Ae="useRef",nt(),mR(i)},useState:function(i){Ae="useState",nt();var o=gt.current;gt.current=tu;try{return Nk(i)}finally{gt.current=o}},useDebugValue:function(i,o){return Ae="useDebugValue",nt(),void 0},useDeferredValue:function(i){return Ae="useDeferredValue",nt(),CR(i)},useTransition:function(){return Ae="useTransition",nt(),kR()},useMutableSource:function(i,o,f){return Ae="useMutableSource",nt(),void 0},useSyncExternalStore:function(i,o,f){return Ae="useSyncExternalStore",nt(),fR(i,o,f)},useId:function(){return Ae="useId",nt(),TR()},unstable_isNewReconciler:He},jF={readContext:function(i){return Ti(i)},useCallback:function(i,o){return Ae="useCallback",nt(),Hk(i,o)},useContext:function(i){return Ae="useContext",nt(),Ti(i)},useEffect:function(i,o){return Ae="useEffect",nt(),u0(i,o)},useImperativeHandle:function(i,o,f){return Ae="useImperativeHandle",nt(),zk(i,o,f)},useInsertionEffect:function(i,o){return Ae="useInsertionEffect",nt(),jk(i,o)},useLayoutEffect:function(i,o){return Ae="useLayoutEffect",nt(),Vk(i,o)},useMemo:function(i,o){Ae="useMemo",nt();var f=gt.current;gt.current=tl;try{return $k(i,o)}finally{gt.current=f}},useReducer:function(i,o,f){Ae="useReducer",nt();var m=gt.current;gt.current=tl;try{return cR(i,o,f)}finally{gt.current=m}},useRef:function(i){return Ae="useRef",nt(),Ik()},useState:function(i){Ae="useState",nt();var o=gt.current;gt.current=tl;try{return hR(i)}finally{gt.current=o}},useDebugValue:function(i,o){return Ae="useDebugValue",nt(),Bk()},useDeferredValue:function(i){return Ae="useDeferredValue",nt(),EF(i)},useTransition:function(){return Ae="useTransition",nt(),DF()},useMutableSource:function(i,o,f){return Ae="useMutableSource",nt(),void 0},useSyncExternalStore:function(i,o,f){return Ae="useSyncExternalStore",nt(),Lk(i,o)},useId:function(){return Ae="useId",nt(),qk()},unstable_isNewReconciler:He},VF={readContext:function(i){return Ti(i)},useCallback:function(i,o){return Ae="useCallback",nt(),Hk(i,o)},useContext:function(i){return Ae="useContext",nt(),Ti(i)},useEffect:function(i,o){return Ae="useEffect",nt(),u0(i,o)},useImperativeHandle:function(i,o,f){return Ae="useImperativeHandle",nt(),zk(i,o,f)},useInsertionEffect:function(i,o){return Ae="useInsertionEffect",nt(),jk(i,o)},useLayoutEffect:function(i,o){return Ae="useLayoutEffect",nt(),Vk(i,o)},useMemo:function(i,o){Ae="useMemo",nt();var f=gt.current;gt.current=Gk;try{return $k(i,o)}finally{gt.current=f}},useReducer:function(i,o,f){Ae="useReducer",nt();var m=gt.current;gt.current=Gk;try{return dR(i,o,f)}finally{gt.current=m}},useRef:function(i){return Ae="useRef",nt(),Ik()},useState:function(i){Ae="useState",nt();var o=gt.current;gt.current=Gk;try{return pR(i)}finally{gt.current=o}},useDebugValue:function(i,o){return Ae="useDebugValue",nt(),Bk()},useDeferredValue:function(i){return Ae="useDeferredValue",nt(),RF(i)},useTransition:function(){return Ae="useTransition",nt(),AF()},useMutableSource:function(i,o,f){return Ae="useMutableSource",nt(),void 0},useSyncExternalStore:function(i,o,f){return Ae="useSyncExternalStore",nt(),Lk(i,o)},useId:function(){return Ae="useId",nt(),qk()},unstable_isNewReconciler:He},tu={readContext:function(i){return xR(),Ti(i)},useCallback:function(i,o){return Ae="useCallback",en(),Qn(),bR(i,o)},useContext:function(i){return Ae="useContext",en(),Qn(),Ti(i)},useEffect:function(i,o){return Ae="useEffect",en(),Qn(),Fk(i,o)},useImperativeHandle:function(i,o,f){return Ae="useImperativeHandle",en(),Qn(),yR(i,o,f)},useInsertionEffect:function(i,o){return Ae="useInsertionEffect",en(),Qn(),gR(i,o)},useLayoutEffect:function(i,o){return Ae="useLayoutEffect",en(),Qn(),vR(i,o)},useMemo:function(i,o){Ae="useMemo",en(),Qn();var f=gt.current;gt.current=tu;try{return SR(i,o)}finally{gt.current=f}},useReducer:function(i,o,f){Ae="useReducer",en(),Qn();var m=gt.current;gt.current=tu;try{return uR(i,o,f)}finally{gt.current=m}},useRef:function(i){return Ae="useRef",en(),Qn(),mR(i)},useState:function(i){Ae="useState",en(),Qn();var o=gt.current;gt.current=tu;try{return Nk(i)}finally{gt.current=o}},useDebugValue:function(i,o){return Ae="useDebugValue",en(),Qn(),void 0},useDeferredValue:function(i){return Ae="useDeferredValue",en(),Qn(),CR(i)},useTransition:function(){return Ae="useTransition",en(),Qn(),kR()},useMutableSource:function(i,o,f){return Ae="useMutableSource",en(),Qn(),void 0},useSyncExternalStore:function(i,o,f){return Ae="useSyncExternalStore",en(),Qn(),fR(i,o,f)},useId:function(){return Ae="useId",en(),Qn(),TR()},unstable_isNewReconciler:He},tl={readContext:function(i){return xR(),Ti(i)},useCallback:function(i,o){return Ae="useCallback",en(),nt(),Hk(i,o)},useContext:function(i){return Ae="useContext",en(),nt(),Ti(i)},useEffect:function(i,o){return Ae="useEffect",en(),nt(),u0(i,o)},useImperativeHandle:function(i,o,f){return Ae="useImperativeHandle",en(),nt(),zk(i,o,f)},useInsertionEffect:function(i,o){return Ae="useInsertionEffect",en(),nt(),jk(i,o)},useLayoutEffect:function(i,o){return Ae="useLayoutEffect",en(),nt(),Vk(i,o)},useMemo:function(i,o){Ae="useMemo",en(),nt();var f=gt.current;gt.current=tl;try{return $k(i,o)}finally{gt.current=f}},useReducer:function(i,o,f){Ae="useReducer",en(),nt();var m=gt.current;gt.current=tl;try{return cR(i,o,f)}finally{gt.current=m}},useRef:function(i){return Ae="useRef",en(),nt(),Ik()},useState:function(i){Ae="useState",en(),nt();var o=gt.current;gt.current=tl;try{return hR(i)}finally{gt.current=o}},useDebugValue:function(i,o){return Ae="useDebugValue",en(),nt(),Bk()},useDeferredValue:function(i){return Ae="useDeferredValue",en(),nt(),EF(i)},useTransition:function(){return Ae="useTransition",en(),nt(),DF()},useMutableSource:function(i,o,f){return Ae="useMutableSource",en(),nt(),void 0},useSyncExternalStore:function(i,o,f){return Ae="useSyncExternalStore",en(),nt(),Lk(i,o)},useId:function(){return Ae="useId",en(),nt(),qk()},unstable_isNewReconciler:He},Gk={readContext:function(i){return xR(),Ti(i)},useCallback:function(i,o){return Ae="useCallback",en(),nt(),Hk(i,o)},useContext:function(i){return Ae="useContext",en(),nt(),Ti(i)},useEffect:function(i,o){return Ae="useEffect",en(),nt(),u0(i,o)},useImperativeHandle:function(i,o,f){return Ae="useImperativeHandle",en(),nt(),zk(i,o,f)},useInsertionEffect:function(i,o){return Ae="useInsertionEffect",en(),nt(),jk(i,o)},useLayoutEffect:function(i,o){return Ae="useLayoutEffect",en(),nt(),Vk(i,o)},useMemo:function(i,o){Ae="useMemo",en(),nt();var f=gt.current;gt.current=tl;try{return $k(i,o)}finally{gt.current=f}},useReducer:function(i,o,f){Ae="useReducer",en(),nt();var m=gt.current;gt.current=tl;try{return dR(i,o,f)}finally{gt.current=m}},useRef:function(i){return Ae="useRef",en(),nt(),Ik()},useState:function(i){Ae="useState",en(),nt();var o=gt.current;gt.current=tl;try{return pR(i)}finally{gt.current=o}},useDebugValue:function(i,o){return Ae="useDebugValue",en(),nt(),Bk()},useDeferredValue:function(i){return Ae="useDeferredValue",en(),nt(),RF(i)},useTransition:function(){return Ae="useTransition",en(),nt(),AF()},useMutableSource:function(i,o,f){return Ae="useMutableSource",en(),nt(),void 0},useSyncExternalStore:function(i,o,f){return Ae="useSyncExternalStore",en(),nt(),Lk(i,o)},useId:function(){return Ae="useId",en(),nt(),qk()},unstable_isNewReconciler:He}}var jd=n.unstable_now,zF=0,Yk=-1,c0=-1,Kk=-1,wR=!1,Zk=!1;function BF(){return wR}function _ie(){Zk=!0}function Eie(){wR=!1,Zk=!1}function Rie(){wR=Zk,Zk=!1}function HF(){return zF}function $F(){zF=jd()}function _R(i){c0=jd(),i.actualStartTime<0&&(i.actualStartTime=jd())}function qF(i){c0=-1}function Qk(i,o){if(c0>=0){var f=jd()-c0;i.actualDuration+=f,o&&(i.selfBaseDuration=f),c0=-1}}function nu(i){if(Yk>=0){var o=jd()-Yk;Yk=-1;for(var f=i.return;f!==null;){switch(f.tag){case k:var m=f.stateNode;m.effectDuration+=o;return;case I:var y=f.stateNode;y.effectDuration+=o;return}f=f.return}}}function ER(i){if(Kk>=0){var o=jd()-Kk;Kk=-1;for(var f=i.return;f!==null;){switch(f.tag){case k:var m=f.stateNode;m!==null&&(m.passiveEffectDuration+=o);return;case I:var y=f.stateNode;y!==null&&(y.passiveEffectDuration+=o);return}f=f.return}}}function ru(){Yk=jd()}function RR(){Kk=jd()}function PR(i){for(var o=i.child;o;)i.actualDuration+=o.actualDuration,o=o.sibling}function nl(i,o){if(i&&i.defaultProps){var f=rn({},o),m=i.defaultProps;for(var y in m)f[y]===void 0&&(f[y]=m[y]);return f}return o}var DR={},AR,OR,MR,LR,NR,WF,Xk,IR,UR,FR,d0;{AR=new Set,OR=new Set,MR=new Set,LR=new Set,IR=new Set,NR=new Set,UR=new Set,FR=new Set,d0=new Set;var GF=new Set;Xk=function(i,o){if(!(i===null||typeof i=="function")){var f=o+"_"+i;GF.has(f)||(GF.add(f),c("%s(...): Expected the last optional `callback` argument to be a function. Instead received: %s.",o,i))}},WF=function(i,o){if(o===void 0){var f=On(i)||"Component";NR.has(f)||(NR.add(f),c("%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. You have returned undefined.",f))}},Object.defineProperty(DR,"_processChildContext",{enumerable:!1,value:function(){throw new Error("_processChildContext is not available in React 16+. This likely means you have multiple copies of React and are attempting to nest a React 15 tree inside a React 16 tree using unstable_renderSubtreeIntoContainer, which isn't supported. Try to make sure you have only one copy of React (and ideally, switch to ReactDOM.createPortal).")}}),Object.freeze(DR)}function jR(i,o,f,m){var y=i.memoizedState,C=f(m,y);{if(i.mode&an){nr(!0);try{C=f(m,y)}finally{nr(!1)}}WF(o,C)}var w=C==null?y:rn({},y,C);if(i.memoizedState=w,i.lanes===Pe){var P=i.updateQueue;P.baseState=w}}var VR={isMounted:Kv,enqueueSetState:function(i,o,f){var m=ld(i),y=Za(),C=Hd(m),w=ac(y,C);w.payload=o,f!=null&&(Xk(f,"setState"),w.callback=f);var P=Nd(m,w,C);P!==null&&(Vi(P,m,C,y),Ek(P,m,C)),$f(m,C)},enqueueReplaceState:function(i,o,f){var m=ld(i),y=Za(),C=Hd(m),w=ac(y,C);w.tag=cF,w.payload=o,f!=null&&(Xk(f,"replaceState"),w.callback=f);var P=Nd(m,w,C);P!==null&&(Vi(P,m,C,y),Ek(P,m,C)),$f(m,C)},enqueueForceUpdate:function(i,o){var f=ld(i),m=Za(),y=Hd(f),C=ac(m,y);C.tag=xk,o!=null&&(Xk(o,"forceUpdate"),C.callback=o);var w=Nd(f,C,y);w!==null&&(Vi(w,f,y,m),Ek(w,f,y)),uy(f,y)}};function YF(i,o,f,m,y,C,w){var P=i.stateNode;if(typeof P.shouldComponentUpdate=="function"){var D=P.shouldComponentUpdate(m,C,w);{if(i.mode&an){nr(!0);try{D=P.shouldComponentUpdate(m,C,w)}finally{nr(!1)}}D===void 0&&c("%s.shouldComponentUpdate(): Returned undefined instead of a boolean value. Make sure to return true or false.",On(o)||"Component")}return D}return o.prototype&&o.prototype.isPureReactComponent?!Ut(f,m)||!Ut(y,C):!0}function Pie(i,o,f){var m=i.stateNode;{var y=On(o)||"Component",C=m.render;C||(o.prototype&&typeof o.prototype.render=="function"?c("%s(...): No `render` method found on the returned component instance: did you accidentally return an object from the constructor?",y):c("%s(...): No `render` method found on the returned component instance: you may have forgotten to define `render`.",y)),m.getInitialState&&!m.getInitialState.isReactClassApproved&&!m.state&&c("getInitialState was defined on %s, a plain JavaScript class. This is only supported for classes created using React.createClass. Did you mean to define a state property instead?",y),m.getDefaultProps&&!m.getDefaultProps.isReactClassApproved&&c("getDefaultProps was defined on %s, a plain JavaScript class. This is only supported for classes created using React.createClass. Use a static property to define defaultProps instead.",y),m.propTypes&&c("propTypes was defined as an instance property on %s. Use a static property to define propTypes instead.",y),m.contextType&&c("contextType was defined as an instance property on %s. Use a static property to define contextType instead.",y),o.childContextTypes&&!d0.has(o)&&(i.mode&an)===Mt&&(d0.add(o),c(`%s uses the legacy childContextTypes API which is no longer supported and will be removed in the next major release. Use React.createContext() instead
|
|
181
181
|
|
|
182
182
|
.Learn more about this warning here: https://reactjs.org/link/legacy-context`,y)),o.contextTypes&&!d0.has(o)&&(i.mode&an)===Mt&&(d0.add(o),c(`%s uses the legacy contextTypes API which is no longer supported and will be removed in the next major release. Use React.createContext() with static contextType instead.
|
|
183
183
|
|
|
@@ -189,13 +189,13 @@ The above lifecycles should be removed. Learn more about this warning here:
|
|
|
189
189
|
https://reactjs.org/link/unsafe-component-lifecycles`,st,Vt,ge!==null?`
|
|
190
190
|
`+ge:"",be!==null?`
|
|
191
191
|
`+be:"",we!==null?`
|
|
192
|
-
`+we:""))}}}return m&&jU(i,y,C),B}function
|
|
192
|
+
`+we:""))}}}return m&&jU(i,y,C),B}function Die(i,o){var f=o.state;typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),f!==o.state&&(c("%s.componentWillMount(): Assigning directly to this.state is deprecated (except inside a component's constructor). Use setState instead.",Zt(i)||"Component"),VR.enqueueReplaceState(o,o.state,null))}function QF(i,o,f,m){var y=o.state;if(typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(f,m),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(f,m),o.state!==y){{var C=Zt(i)||"Component";AR.has(C)||(AR.add(C),c("%s.componentWillReceiveProps(): Assigning directly to this.state is deprecated (except inside a component's constructor). Use setState instead.",C))}VR.enqueueReplaceState(o,o.state,null)}}function zR(i,o,f,m){Pie(i,o,f);var y=i.stateNode;y.props=f,y.state=i.memoizedState,y.refs={},ZE(i);var C=o.contextType;if(typeof C=="object"&&C!==null)y.context=Ti(C);else{var w=$m(i,o,!0);y.context=qm(i,w)}{if(y.state===f){var P=On(o)||"Component";IR.has(P)||(IR.add(P),c("%s: It is not recommended to assign props directly to state because updates to props won't be reflected in state. In most cases, it is better to use props directly.",P))}i.mode&an&&Js.recordLegacyContextWarning(i,y),Js.recordUnsafeLifecycleWarnings(i,y)}y.state=i.memoizedState;var D=o.getDerivedStateFromProps;if(typeof D=="function"&&(jR(i,o,D,f),y.state=i.memoizedState),typeof o.getDerivedStateFromProps!="function"&&typeof y.getSnapshotBeforeUpdate!="function"&&(typeof y.UNSAFE_componentWillMount=="function"||typeof y.componentWillMount=="function")&&(Die(i,y),Rk(i,f,y,m),y.state=i.memoizedState),typeof y.componentDidMount=="function"){var F=Tn;F|=Ol,(i.mode&cr)!==Mt&&(F|=ia),i.flags|=F}}function Aie(i,o,f,m){var y=i.stateNode,C=i.memoizedProps;y.props=C;var w=y.context,P=o.contextType,D=$o;if(typeof P=="object"&&P!==null)D=Ti(P);else{var F=$m(i,o,!0);D=qm(i,F)}var B=o.getDerivedStateFromProps,ae=typeof B=="function"||typeof y.getSnapshotBeforeUpdate=="function";!ae&&(typeof y.UNSAFE_componentWillReceiveProps=="function"||typeof y.componentWillReceiveProps=="function")&&(C!==f||w!==D)&&QF(i,y,f,D),fF();var re=i.memoizedState,ge=y.state=re;if(Rk(i,f,y,m),ge=i.memoizedState,C===f&&re===ge&&!uk()&&!Pk()){if(typeof y.componentDidMount=="function"){var be=Tn;be|=Ol,(i.mode&cr)!==Mt&&(be|=ia),i.flags|=be}return!1}typeof B=="function"&&(jR(i,o,B,f),ge=i.memoizedState);var we=Pk()||YF(i,o,C,f,re,ge,D);if(we){if(!ae&&(typeof y.UNSAFE_componentWillMount=="function"||typeof y.componentWillMount=="function")&&(typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount()),typeof y.componentDidMount=="function"){var st=Tn;st|=Ol,(i.mode&cr)!==Mt&&(st|=ia),i.flags|=st}}else{if(typeof y.componentDidMount=="function"){var Vt=Tn;Vt|=Ol,(i.mode&cr)!==Mt&&(Vt|=ia),i.flags|=Vt}i.memoizedProps=f,i.memoizedState=ge}return y.props=f,y.state=ge,y.context=D,we}function Oie(i,o,f,m,y){var C=o.stateNode;dF(i,o);var w=o.memoizedProps,P=o.type===o.elementType?w:nl(o.type,w);C.props=P;var D=o.pendingProps,F=C.context,B=f.contextType,ae=$o;if(typeof B=="object"&&B!==null)ae=Ti(B);else{var re=$m(o,f,!0);ae=qm(o,re)}var ge=f.getDerivedStateFromProps,be=typeof ge=="function"||typeof C.getSnapshotBeforeUpdate=="function";!be&&(typeof C.UNSAFE_componentWillReceiveProps=="function"||typeof C.componentWillReceiveProps=="function")&&(w!==D||F!==ae)&&QF(o,C,m,ae),fF();var we=o.memoizedState,st=C.state=we;if(Rk(o,m,C,y),st=o.memoizedState,w===D&&we===st&&!uk()&&!Pk()&&!z)return typeof C.componentDidUpdate=="function"&&(w!==i.memoizedProps||we!==i.memoizedState)&&(o.flags|=Tn),typeof C.getSnapshotBeforeUpdate=="function"&&(w!==i.memoizedProps||we!==i.memoizedState)&&(o.flags|=yo),!1;typeof ge=="function"&&(jR(o,f,ge,m),st=o.memoizedState);var Vt=Pk()||YF(o,f,P,m,we,st,ae)||z;return Vt?(!be&&(typeof C.UNSAFE_componentWillUpdate=="function"||typeof C.componentWillUpdate=="function")&&(typeof C.componentWillUpdate=="function"&&C.componentWillUpdate(m,st,ae),typeof C.UNSAFE_componentWillUpdate=="function"&&C.UNSAFE_componentWillUpdate(m,st,ae)),typeof C.componentDidUpdate=="function"&&(o.flags|=Tn),typeof C.getSnapshotBeforeUpdate=="function"&&(o.flags|=yo)):(typeof C.componentDidUpdate=="function"&&(w!==i.memoizedProps||we!==i.memoizedState)&&(o.flags|=Tn),typeof C.getSnapshotBeforeUpdate=="function"&&(w!==i.memoizedProps||we!==i.memoizedState)&&(o.flags|=yo),o.memoizedProps=m,o.memoizedState=st),C.props=m,C.state=st,C.context=ae,Vt}function _h(i,o){return{value:i,source:o,stack:An(o),digest:null}}function BR(i,o,f){return{value:i,source:null,stack:f??null,digest:o??null}}function Mie(i,o){return!0}function HR(i,o){try{var f=Mie(i,o);if(f===!1)return;var m=o.value,y=o.source,C=o.stack,w=C!==null?C:"";if(m!=null&&m._suppressLogging){if(i.tag===v)return;console.error(m)}var P=y?Zt(y):null,D=P?"The above error occurred in the <"+P+"> component:":"The above error occurred in one of your React components:",F;if(i.tag===k)F=`Consider adding an error boundary to your tree to customize error handling behavior.
|
|
193
193
|
Visit https://reactjs.org/link/error-boundaries to learn more about error boundaries.`;else{var B=Zt(i)||"Anonymous";F="React will try to recreate this component tree from scratch "+("using the error boundary you provided, "+B+".")}var ae=D+`
|
|
194
194
|
`+w+`
|
|
195
195
|
|
|
196
|
-
`+(""+F);console.error(ae)}catch(re){setTimeout(function(){throw re})}}var Mie=typeof WeakMap=="function"?WeakMap:Map;function XF(i,o,f){var m=ac(rr,f);m.tag=YE,m.payload={element:null};var y=o.value;return m.callback=function(){woe(y),HR(i,o)},m}function $R(i,o,f){var m=ac(rr,f);m.tag=YE;var y=i.type.getDerivedStateFromError;if(typeof y=="function"){var C=o.value;m.payload=function(){return y(C)},m.callback=function(){uj(i),HR(i,o)}}var w=i.stateNode;return w!==null&&typeof w.componentDidCatch=="function"&&(m.callback=function(){uj(i),HR(i,o),typeof y!="function"&&Toe(this);var D=o.value,F=o.stack;this.componentDidCatch(D,{componentStack:F!==null?F:""}),typeof y!="function"&&(Aa(i.lanes,$t)||c("%s: Error boundaries should implement getDerivedStateFromError(). In that method, return a state update to display an error message or fallback UI.",Zt(i)||"Unknown"))}),m}function JF(i,o,f){var m=i.pingCache,y;if(m===null?(m=i.pingCache=new Mie,y=new Set,m.set(o,y)):(y=m.get(o),y===void 0&&(y=new Set,m.set(o,y))),!y.has(f)){y.add(f);var C=_oe.bind(null,i,o,f);Yi&&R0(i,f),o.then(C,C)}}function Lie(i,o,f,m){var y=i.updateQueue;if(y===null){var C=new Set;C.add(f),i.updateQueue=C}else y.add(f)}function Nie(i,o){var f=i.tag;if((i.mode&vn)===Mt&&(f===p||f===j||f===X)){var m=i.alternate;m?(i.updateQueue=m.updateQueue,i.memoizedState=m.memoizedState,i.lanes=m.lanes):(i.updateQueue=null,i.memoizedState=null)}}function e9(i){var o=i;do{if(o.tag===N&&mie(o))return o;o=o.return}while(o!==null);return null}function t9(i,o,f,m,y){if((i.mode&vn)===Mt){if(i===o)i.flags|=Gi;else{if(i.flags|=pn,f.flags|=jo,f.flags&=-52805,f.tag===v){var C=f.alternate;if(C===null)f.tag=$;else{var w=ac(rr,$t);w.tag=xk,Nd(f,w,$t)}}f.lanes=sn(f.lanes,$t)}return i}return i.flags|=Gi,i.lanes=y,i}function Iie(i,o,f,m,y){if(f.flags|=Lu,Yi&&R0(i,y),m!==null&&typeof m=="object"&&typeof m.then=="function"){var C=m;Nie(f),la()&&f.mode&vn&&WU();var w=e9(o);if(w!==null){w.flags&=~Pr,t9(w,o,f,i,y),w.mode&vn&&JF(i,C,y),Lie(w,i,C);return}else{if(!fy(y)){JF(i,C,y),TP();return}var P=new Error("A component suspended while responding to synchronous input. This will cause the UI to be replaced with a loading indicator. To fix, updates that suspend should be wrapped with startTransition.");m=P}}else if(la()&&f.mode&vn){WU();var D=e9(o);if(D!==null){(D.flags&Gi)===Ot&&(D.flags|=Pr),t9(D,o,f,i,y),IE(_h(m,f));return}}m=_h(m,f),moe(m);var F=o;do{switch(F.tag){case k:{var B=m;F.flags|=Gi;var ae=Ci(y);F.lanes=sn(F.lanes,ae);var re=XF(F,B,ae);QE(F,re);return}case v:var ge=m,be=F.type,we=F.stateNode;if((F.flags&pn)===Ot&&(typeof be.getDerivedStateFromError=="function"||we!==null&&typeof we.componentDidCatch=="function"&&!ej(we))){F.flags|=Gi;var st=Ci(y);F.lanes=sn(F.lanes,st);var Vt=$R(F,ge,st);QE(F,Vt);return}break}F=F.return}while(F!==null)}function Uie(){return null}var f0=r.ReactCurrentOwner,rl=!1,qR,h0,WR,GR,YR,Eh,KR,Jk,p0;qR={},h0={},WR={},GR={},YR={},Eh=!1,KR={},Jk={},p0={};function Ya(i,o,f,m){i===null?o.child=iF(o,null,f,m):o.child=Km(o,i.child,f,m)}function Fie(i,o,f,m){o.child=Km(o,i.child,null,m),o.child=Km(o,null,f,m)}function n9(i,o,f,m,y){if(o.type!==o.elementType){var C=f.propTypes;C&&Qs(C,m,"prop",On(f))}var w=f.render,P=o.ref,D,F;Qm(o,y),bo(o);{if(f0.current=o,ho(!0),D=rg(i,o,w,m,P,y),F=ig(),o.mode&an){nr(!0);try{D=rg(i,o,w,m,P,y),F=ig()}finally{nr(!1)}}ho(!1)}return Ul(),i!==null&&!rl?(yF(i,o,y),oc(i,o,y)):(la()&&F&&DE(o),o.flags|=Ws,Ya(i,o,D,y),o.child)}function r9(i,o,f,m,y){if(i===null){var C=f.type;if(Hoe(C)&&f.compare===null&&f.defaultProps===void 0){var w=C;return w=fg(C),o.tag=X,o.type=w,XR(o,C),i9(i,o,w,m,y)}{var P=C.propTypes;if(P&&Qs(P,m,"prop",On(C)),f.defaultProps!==void 0){var D=On(C)||"Unknown";p0[D]||(c("%s: Support for defaultProps will be removed from memo components in a future major release. Use JavaScript default parameters instead.",D),p0[D]=!0)}}var F=LP(f.type,null,m,o,o.mode,y);return F.ref=o.ref,F.return=o,o.child=F,F}{var B=f.type,ae=B.propTypes;ae&&Qs(ae,m,"prop",On(B))}var re=i.child,ge=iP(i,y);if(!ge){var be=re.memoizedProps,we=f.compare;if(we=we!==null?we:Ut,we(be,m)&&i.ref===o.ref)return oc(i,o,y)}o.flags|=Ws;var st=Oh(re,m);return st.ref=o.ref,st.return=o,o.child=st,st}function i9(i,o,f,m,y){if(o.type!==o.elementType){var C=o.elementType;if(C.$$typeof===Jt){var w=C,P=w._payload,D=w._init;try{C=D(P)}catch{C=null}var F=C&&C.propTypes;F&&Qs(F,m,"prop",On(C))}}if(i!==null){var B=i.memoizedProps;if(Ut(B,m)&&i.ref===o.ref&&o.type===i.type)if(rl=!1,o.pendingProps=m=B,iP(i,y))(i.flags&jo)!==Ot&&(rl=!0);else return o.lanes=i.lanes,oc(i,o,y)}return ZR(i,o,f,m,y)}function a9(i,o,f){var m=o.pendingProps,y=m.children,C=i!==null?i.memoizedState:null;if(m.mode==="hidden"||ee)if((o.mode&vn)===Mt){var w={baseLanes:Pe,cachePool:null,transitions:null};o.memoizedState=w,f1(o,f)}else if(Aa(f,Pa)){var ae={baseLanes:Pe,cachePool:null,transitions:null};o.memoizedState=ae;var re=C!==null?C.baseLanes:f;f1(o,re)}else{var P=null,D;if(C!==null){var F=C.baseLanes;D=sn(F,f)}else D=f;o.lanes=o.childLanes=Pa;var B={baseLanes:D,cachePool:P,transitions:null};return o.memoizedState=B,o.updateQueue=null,f1(o,D),null}else{var ge;C!==null?(ge=sn(C.baseLanes,f),o.memoizedState=null):ge=f,f1(o,ge)}return Ya(i,o,y,f),o.child}function jie(i,o,f){var m=o.pendingProps;return Ya(i,o,m,f),o.child}function Vie(i,o,f){var m=o.pendingProps.children;return Ya(i,o,m,f),o.child}function zie(i,o,f){{o.flags|=Tn;{var m=o.stateNode;m.effectDuration=0,m.passiveEffectDuration=0}}var y=o.pendingProps,C=y.children;return Ya(i,o,C,f),o.child}function o9(i,o){var f=o.ref;(i===null&&f!==null||i!==null&&i.ref!==f)&&(o.flags|=ni,o.flags|=jf)}function ZR(i,o,f,m,y){if(o.type!==o.elementType){var C=f.propTypes;C&&Qs(C,m,"prop",On(f))}var w;{var P=$m(o,f,!0);w=qm(o,P)}var D,F;Qm(o,y),bo(o);{if(f0.current=o,ho(!0),D=rg(i,o,f,m,w,y),F=ig(),o.mode&an){nr(!0);try{D=rg(i,o,f,m,w,y),F=ig()}finally{nr(!1)}}ho(!1)}return Ul(),i!==null&&!rl?(yF(i,o,y),oc(i,o,y)):(la()&&F&&DE(o),o.flags|=Ws,Ya(i,o,D,y),o.child)}function s9(i,o,f,m,y){{switch(ise(o)){case!1:{var C=o.stateNode,w=o.type,P=new w(o.memoizedProps,C.context),D=P.state;C.updater.enqueueSetState(C,D,null);break}case!0:{o.flags|=pn,o.flags|=Gi;var F=new Error("Simulated error coming from DevTools"),B=Ci(y);o.lanes=sn(o.lanes,B);var ae=$R(o,_h(F,o),B);QE(o,ae);break}}if(o.type!==o.elementType){var re=f.propTypes;re&&Qs(re,m,"prop",On(f))}}var ge;Xl(f)?(ge=!0,dk(o)):ge=!1,Qm(o,y);var be=o.stateNode,we;be===null?(t1(i,o),ZF(o,f,m),zR(o,f,m,y),we=!0):i===null?we=Die(o,f,m,y):we=Aie(i,o,f,m,y);var st=QR(i,o,f,we,ge,y);{var Vt=o.stateNode;we&&Vt.props!==m&&(Eh||c("It looks like %s is reassigning its own `this.props` while rendering. This is not supported and can lead to confusing bugs.",Zt(o)||"a component"),Eh=!0)}return st}function QR(i,o,f,m,y,C){o9(i,o);var w=(o.flags&pn)!==Ot;if(!m&&!w)return y&&BU(o,f,!1),oc(i,o,C);var P=o.stateNode;f0.current=o;var D;if(w&&typeof f.getDerivedStateFromError!="function")D=null,qF();else{bo(o);{if(ho(!0),D=P.render(),o.mode&an){nr(!0);try{P.render()}finally{nr(!1)}}ho(!1)}Ul()}return o.flags|=Ws,i!==null&&w?Fie(i,o,D,C):Ya(i,o,D,C),o.memoizedState=P.state,y&&BU(o,f,!0),o.child}function l9(i){var o=i.stateNode;o.pendingContext?VU(i,o.pendingContext,o.pendingContext!==o.context):o.context&&VU(i,o.context,!1),XE(i,o.containerInfo)}function Bie(i,o,f){if(l9(o),i===null)throw new Error("Should have a current fiber. This is a bug in React.");var m=o.pendingProps,y=o.memoizedState,C=y.element;dF(i,o),Rk(o,m,null,f);var w=o.memoizedState;o.stateNode;var P=w.element;if(y.isDehydrated){var D={element:P,isDehydrated:!1,cache:w.cache,pendingSuspenseBoundaries:w.pendingSuspenseBoundaries,transitions:w.transitions},F=o.updateQueue;if(F.baseState=D,o.memoizedState=D,o.flags&Pr){var B=_h(new Error("There was an error while hydrating. Because the error happened outside of a Suspense boundary, the entire root will switch to client rendering."),o);return u9(i,o,P,f,B)}else if(P!==C){var ae=_h(new Error("This root received an early update, before anything was able hydrate. Switched the entire root to client rendering."),o);return u9(i,o,P,f,ae)}else{qre(o);var re=iF(o,null,P,f);o.child=re;for(var ge=re;ge;)ge.flags=ge.flags&~jr|Vr,ge=ge.sibling}}else{if(Ym(),P===C)return oc(i,o,f);Ya(i,o,P,f)}return o.child}function u9(i,o,f,m,y){return Ym(),IE(y),o.flags|=Pr,Ya(i,o,f,m),o.child}function Hie(i,o,f){mF(o),i===null&&NE(o);var m=o.type,y=o.pendingProps,C=i!==null?i.memoizedProps:null,w=y.children,P=gE(m,y);return P?w=null:C!==null&&gE(m,C)&&(o.flags|=tr),o9(i,o),Ya(i,o,w,f),o.child}function $ie(i,o){return i===null&&NE(o),null}function qie(i,o,f,m){t1(i,o);var y=o.pendingProps,C=f,w=C._payload,P=C._init,D=P(w);o.type=D;var F=o.tag=$oe(D),B=nl(D,y),ae;switch(F){case p:return XR(o,D),o.type=D=fg(D),ae=ZR(null,o,D,B,m),ae;case v:return o.type=D=RP(D),ae=s9(null,o,D,B,m),ae;case j:return o.type=D=PP(D),ae=n9(null,o,D,B,m),ae;case ne:{if(o.type!==o.elementType){var re=D.propTypes;re&&Qs(re,B,"prop",On(D))}return ae=r9(null,o,D,nl(D.type,B),m),ae}}var ge="";throw D!==null&&typeof D=="object"&&D.$$typeof===Jt&&(ge=" Did you wrap a component in React.lazy() more than once?"),new Error("Element type is invalid. Received a promise that resolves to: "+D+". "+("Lazy element type must resolve to a class or function."+ge))}function Wie(i,o,f,m,y){t1(i,o),o.tag=v;var C;return Xl(f)?(C=!0,dk(o)):C=!1,Qm(o,y),ZF(o,f,m),zR(o,f,m,y),QR(null,o,f,!0,C,y)}function Gie(i,o,f,m){t1(i,o);var y=o.pendingProps,C;{var w=$m(o,f,!1);C=qm(o,w)}Qm(o,m);var P,D;bo(o);{if(f.prototype&&typeof f.prototype.render=="function"){var F=On(f)||"Unknown";qR[F]||(c("The <%s /> component appears to have a render method, but doesn't extend React.Component. This is likely to cause errors. Change %s to extend React.Component instead.",F,F),qR[F]=!0)}o.mode&an&&Js.recordLegacyContextWarning(o,null),ho(!0),f0.current=o,P=rg(null,o,f,y,C,m),D=ig(),ho(!1)}if(Ul(),o.flags|=Ws,typeof P=="object"&&P!==null&&typeof P.render=="function"&&P.$$typeof===void 0){var B=On(f)||"Unknown";h0[B]||(c("The <%s /> component appears to be a function component that returns a class instance. Change %s to a class that extends React.Component instead. If you can't use a class try assigning the prototype on the function as a workaround. `%s.prototype = React.Component.prototype`. Don't use an arrow function since it cannot be called with `new` by React.",B,B,B),h0[B]=!0)}if(typeof P=="object"&&P!==null&&typeof P.render=="function"&&P.$$typeof===void 0){{var ae=On(f)||"Unknown";h0[ae]||(c("The <%s /> component appears to be a function component that returns a class instance. Change %s to a class that extends React.Component instead. If you can't use a class try assigning the prototype on the function as a workaround. `%s.prototype = React.Component.prototype`. Don't use an arrow function since it cannot be called with `new` by React.",ae,ae,ae),h0[ae]=!0)}o.tag=v,o.memoizedState=null,o.updateQueue=null;var re=!1;return Xl(f)?(re=!0,dk(o)):re=!1,o.memoizedState=P.state!==null&&P.state!==void 0?P.state:null,ZE(o),KF(o,P),zR(o,f,y,m),QR(null,o,f,!0,re,m)}else{if(o.tag=p,o.mode&an){nr(!0);try{P=rg(null,o,f,y,C,m),D=ig()}finally{nr(!1)}}return la()&&D&&DE(o),Ya(null,o,P,m),XR(o,f),o.child}}function XR(i,o){{if(o&&o.childContextTypes&&c("%s(...): childContextTypes cannot be defined on a function component.",o.displayName||o.name||"Component"),i.ref!==null){var f="",m=na();m&&(f+=`
|
|
196
|
+
`+(""+F);console.error(ae)}catch(re){setTimeout(function(){throw re})}}var Lie=typeof WeakMap=="function"?WeakMap:Map;function XF(i,o,f){var m=ac(rr,f);m.tag=YE,m.payload={element:null};var y=o.value;return m.callback=function(){_oe(y),HR(i,o)},m}function $R(i,o,f){var m=ac(rr,f);m.tag=YE;var y=i.type.getDerivedStateFromError;if(typeof y=="function"){var C=o.value;m.payload=function(){return y(C)},m.callback=function(){uj(i),HR(i,o)}}var w=i.stateNode;return w!==null&&typeof w.componentDidCatch=="function"&&(m.callback=function(){uj(i),HR(i,o),typeof y!="function"&&xoe(this);var D=o.value,F=o.stack;this.componentDidCatch(D,{componentStack:F!==null?F:""}),typeof y!="function"&&(Aa(i.lanes,$t)||c("%s: Error boundaries should implement getDerivedStateFromError(). In that method, return a state update to display an error message or fallback UI.",Zt(i)||"Unknown"))}),m}function JF(i,o,f){var m=i.pingCache,y;if(m===null?(m=i.pingCache=new Lie,y=new Set,m.set(o,y)):(y=m.get(o),y===void 0&&(y=new Set,m.set(o,y))),!y.has(f)){y.add(f);var C=Eoe.bind(null,i,o,f);Yi&&R0(i,f),o.then(C,C)}}function Nie(i,o,f,m){var y=i.updateQueue;if(y===null){var C=new Set;C.add(f),i.updateQueue=C}else y.add(f)}function Iie(i,o){var f=i.tag;if((i.mode&vn)===Mt&&(f===p||f===j||f===X)){var m=i.alternate;m?(i.updateQueue=m.updateQueue,i.memoizedState=m.memoizedState,i.lanes=m.lanes):(i.updateQueue=null,i.memoizedState=null)}}function e9(i){var o=i;do{if(o.tag===N&&gie(o))return o;o=o.return}while(o!==null);return null}function t9(i,o,f,m,y){if((i.mode&vn)===Mt){if(i===o)i.flags|=Gi;else{if(i.flags|=pn,f.flags|=jo,f.flags&=-52805,f.tag===v){var C=f.alternate;if(C===null)f.tag=$;else{var w=ac(rr,$t);w.tag=xk,Nd(f,w,$t)}}f.lanes=sn(f.lanes,$t)}return i}return i.flags|=Gi,i.lanes=y,i}function Uie(i,o,f,m,y){if(f.flags|=Lu,Yi&&R0(i,y),m!==null&&typeof m=="object"&&typeof m.then=="function"){var C=m;Iie(f),la()&&f.mode&vn&&WU();var w=e9(o);if(w!==null){w.flags&=~Pr,t9(w,o,f,i,y),w.mode&vn&&JF(i,C,y),Nie(w,i,C);return}else{if(!fy(y)){JF(i,C,y),TP();return}var P=new Error("A component suspended while responding to synchronous input. This will cause the UI to be replaced with a loading indicator. To fix, updates that suspend should be wrapped with startTransition.");m=P}}else if(la()&&f.mode&vn){WU();var D=e9(o);if(D!==null){(D.flags&Gi)===Ot&&(D.flags|=Pr),t9(D,o,f,i,y),IE(_h(m,f));return}}m=_h(m,f),goe(m);var F=o;do{switch(F.tag){case k:{var B=m;F.flags|=Gi;var ae=Ci(y);F.lanes=sn(F.lanes,ae);var re=XF(F,B,ae);QE(F,re);return}case v:var ge=m,be=F.type,we=F.stateNode;if((F.flags&pn)===Ot&&(typeof be.getDerivedStateFromError=="function"||we!==null&&typeof we.componentDidCatch=="function"&&!ej(we))){F.flags|=Gi;var st=Ci(y);F.lanes=sn(F.lanes,st);var Vt=$R(F,ge,st);QE(F,Vt);return}break}F=F.return}while(F!==null)}function Fie(){return null}var f0=r.ReactCurrentOwner,rl=!1,qR,h0,WR,GR,YR,Eh,KR,Jk,p0;qR={},h0={},WR={},GR={},YR={},Eh=!1,KR={},Jk={},p0={};function Ya(i,o,f,m){i===null?o.child=iF(o,null,f,m):o.child=Km(o,i.child,f,m)}function jie(i,o,f,m){o.child=Km(o,i.child,null,m),o.child=Km(o,null,f,m)}function n9(i,o,f,m,y){if(o.type!==o.elementType){var C=f.propTypes;C&&Qs(C,m,"prop",On(f))}var w=f.render,P=o.ref,D,F;Qm(o,y),bo(o);{if(f0.current=o,ho(!0),D=rg(i,o,w,m,P,y),F=ig(),o.mode&an){nr(!0);try{D=rg(i,o,w,m,P,y),F=ig()}finally{nr(!1)}}ho(!1)}return Ul(),i!==null&&!rl?(yF(i,o,y),oc(i,o,y)):(la()&&F&&DE(o),o.flags|=Ws,Ya(i,o,D,y),o.child)}function r9(i,o,f,m,y){if(i===null){var C=f.type;if($oe(C)&&f.compare===null&&f.defaultProps===void 0){var w=C;return w=fg(C),o.tag=X,o.type=w,XR(o,C),i9(i,o,w,m,y)}{var P=C.propTypes;if(P&&Qs(P,m,"prop",On(C)),f.defaultProps!==void 0){var D=On(C)||"Unknown";p0[D]||(c("%s: Support for defaultProps will be removed from memo components in a future major release. Use JavaScript default parameters instead.",D),p0[D]=!0)}}var F=LP(f.type,null,m,o,o.mode,y);return F.ref=o.ref,F.return=o,o.child=F,F}{var B=f.type,ae=B.propTypes;ae&&Qs(ae,m,"prop",On(B))}var re=i.child,ge=iP(i,y);if(!ge){var be=re.memoizedProps,we=f.compare;if(we=we!==null?we:Ut,we(be,m)&&i.ref===o.ref)return oc(i,o,y)}o.flags|=Ws;var st=Oh(re,m);return st.ref=o.ref,st.return=o,o.child=st,st}function i9(i,o,f,m,y){if(o.type!==o.elementType){var C=o.elementType;if(C.$$typeof===Jt){var w=C,P=w._payload,D=w._init;try{C=D(P)}catch{C=null}var F=C&&C.propTypes;F&&Qs(F,m,"prop",On(C))}}if(i!==null){var B=i.memoizedProps;if(Ut(B,m)&&i.ref===o.ref&&o.type===i.type)if(rl=!1,o.pendingProps=m=B,iP(i,y))(i.flags&jo)!==Ot&&(rl=!0);else return o.lanes=i.lanes,oc(i,o,y)}return ZR(i,o,f,m,y)}function a9(i,o,f){var m=o.pendingProps,y=m.children,C=i!==null?i.memoizedState:null;if(m.mode==="hidden"||ee)if((o.mode&vn)===Mt){var w={baseLanes:Pe,cachePool:null,transitions:null};o.memoizedState=w,f1(o,f)}else if(Aa(f,Pa)){var ae={baseLanes:Pe,cachePool:null,transitions:null};o.memoizedState=ae;var re=C!==null?C.baseLanes:f;f1(o,re)}else{var P=null,D;if(C!==null){var F=C.baseLanes;D=sn(F,f)}else D=f;o.lanes=o.childLanes=Pa;var B={baseLanes:D,cachePool:P,transitions:null};return o.memoizedState=B,o.updateQueue=null,f1(o,D),null}else{var ge;C!==null?(ge=sn(C.baseLanes,f),o.memoizedState=null):ge=f,f1(o,ge)}return Ya(i,o,y,f),o.child}function Vie(i,o,f){var m=o.pendingProps;return Ya(i,o,m,f),o.child}function zie(i,o,f){var m=o.pendingProps.children;return Ya(i,o,m,f),o.child}function Bie(i,o,f){{o.flags|=Tn;{var m=o.stateNode;m.effectDuration=0,m.passiveEffectDuration=0}}var y=o.pendingProps,C=y.children;return Ya(i,o,C,f),o.child}function o9(i,o){var f=o.ref;(i===null&&f!==null||i!==null&&i.ref!==f)&&(o.flags|=ni,o.flags|=jf)}function ZR(i,o,f,m,y){if(o.type!==o.elementType){var C=f.propTypes;C&&Qs(C,m,"prop",On(f))}var w;{var P=$m(o,f,!0);w=qm(o,P)}var D,F;Qm(o,y),bo(o);{if(f0.current=o,ho(!0),D=rg(i,o,f,m,w,y),F=ig(),o.mode&an){nr(!0);try{D=rg(i,o,f,m,w,y),F=ig()}finally{nr(!1)}}ho(!1)}return Ul(),i!==null&&!rl?(yF(i,o,y),oc(i,o,y)):(la()&&F&&DE(o),o.flags|=Ws,Ya(i,o,D,y),o.child)}function s9(i,o,f,m,y){{switch(ase(o)){case!1:{var C=o.stateNode,w=o.type,P=new w(o.memoizedProps,C.context),D=P.state;C.updater.enqueueSetState(C,D,null);break}case!0:{o.flags|=pn,o.flags|=Gi;var F=new Error("Simulated error coming from DevTools"),B=Ci(y);o.lanes=sn(o.lanes,B);var ae=$R(o,_h(F,o),B);QE(o,ae);break}}if(o.type!==o.elementType){var re=f.propTypes;re&&Qs(re,m,"prop",On(f))}}var ge;Xl(f)?(ge=!0,dk(o)):ge=!1,Qm(o,y);var be=o.stateNode,we;be===null?(t1(i,o),ZF(o,f,m),zR(o,f,m,y),we=!0):i===null?we=Aie(o,f,m,y):we=Oie(i,o,f,m,y);var st=QR(i,o,f,we,ge,y);{var Vt=o.stateNode;we&&Vt.props!==m&&(Eh||c("It looks like %s is reassigning its own `this.props` while rendering. This is not supported and can lead to confusing bugs.",Zt(o)||"a component"),Eh=!0)}return st}function QR(i,o,f,m,y,C){o9(i,o);var w=(o.flags&pn)!==Ot;if(!m&&!w)return y&&BU(o,f,!1),oc(i,o,C);var P=o.stateNode;f0.current=o;var D;if(w&&typeof f.getDerivedStateFromError!="function")D=null,qF();else{bo(o);{if(ho(!0),D=P.render(),o.mode&an){nr(!0);try{P.render()}finally{nr(!1)}}ho(!1)}Ul()}return o.flags|=Ws,i!==null&&w?jie(i,o,D,C):Ya(i,o,D,C),o.memoizedState=P.state,y&&BU(o,f,!0),o.child}function l9(i){var o=i.stateNode;o.pendingContext?VU(i,o.pendingContext,o.pendingContext!==o.context):o.context&&VU(i,o.context,!1),XE(i,o.containerInfo)}function Hie(i,o,f){if(l9(o),i===null)throw new Error("Should have a current fiber. This is a bug in React.");var m=o.pendingProps,y=o.memoizedState,C=y.element;dF(i,o),Rk(o,m,null,f);var w=o.memoizedState;o.stateNode;var P=w.element;if(y.isDehydrated){var D={element:P,isDehydrated:!1,cache:w.cache,pendingSuspenseBoundaries:w.pendingSuspenseBoundaries,transitions:w.transitions},F=o.updateQueue;if(F.baseState=D,o.memoizedState=D,o.flags&Pr){var B=_h(new Error("There was an error while hydrating. Because the error happened outside of a Suspense boundary, the entire root will switch to client rendering."),o);return u9(i,o,P,f,B)}else if(P!==C){var ae=_h(new Error("This root received an early update, before anything was able hydrate. Switched the entire root to client rendering."),o);return u9(i,o,P,f,ae)}else{Wre(o);var re=iF(o,null,P,f);o.child=re;for(var ge=re;ge;)ge.flags=ge.flags&~jr|Vr,ge=ge.sibling}}else{if(Ym(),P===C)return oc(i,o,f);Ya(i,o,P,f)}return o.child}function u9(i,o,f,m,y){return Ym(),IE(y),o.flags|=Pr,Ya(i,o,f,m),o.child}function $ie(i,o,f){mF(o),i===null&&NE(o);var m=o.type,y=o.pendingProps,C=i!==null?i.memoizedProps:null,w=y.children,P=gE(m,y);return P?w=null:C!==null&&gE(m,C)&&(o.flags|=tr),o9(i,o),Ya(i,o,w,f),o.child}function qie(i,o){return i===null&&NE(o),null}function Wie(i,o,f,m){t1(i,o);var y=o.pendingProps,C=f,w=C._payload,P=C._init,D=P(w);o.type=D;var F=o.tag=qoe(D),B=nl(D,y),ae;switch(F){case p:return XR(o,D),o.type=D=fg(D),ae=ZR(null,o,D,B,m),ae;case v:return o.type=D=RP(D),ae=s9(null,o,D,B,m),ae;case j:return o.type=D=PP(D),ae=n9(null,o,D,B,m),ae;case ne:{if(o.type!==o.elementType){var re=D.propTypes;re&&Qs(re,B,"prop",On(D))}return ae=r9(null,o,D,nl(D.type,B),m),ae}}var ge="";throw D!==null&&typeof D=="object"&&D.$$typeof===Jt&&(ge=" Did you wrap a component in React.lazy() more than once?"),new Error("Element type is invalid. Received a promise that resolves to: "+D+". "+("Lazy element type must resolve to a class or function."+ge))}function Gie(i,o,f,m,y){t1(i,o),o.tag=v;var C;return Xl(f)?(C=!0,dk(o)):C=!1,Qm(o,y),ZF(o,f,m),zR(o,f,m,y),QR(null,o,f,!0,C,y)}function Yie(i,o,f,m){t1(i,o);var y=o.pendingProps,C;{var w=$m(o,f,!1);C=qm(o,w)}Qm(o,m);var P,D;bo(o);{if(f.prototype&&typeof f.prototype.render=="function"){var F=On(f)||"Unknown";qR[F]||(c("The <%s /> component appears to have a render method, but doesn't extend React.Component. This is likely to cause errors. Change %s to extend React.Component instead.",F,F),qR[F]=!0)}o.mode&an&&Js.recordLegacyContextWarning(o,null),ho(!0),f0.current=o,P=rg(null,o,f,y,C,m),D=ig(),ho(!1)}if(Ul(),o.flags|=Ws,typeof P=="object"&&P!==null&&typeof P.render=="function"&&P.$$typeof===void 0){var B=On(f)||"Unknown";h0[B]||(c("The <%s /> component appears to be a function component that returns a class instance. Change %s to a class that extends React.Component instead. If you can't use a class try assigning the prototype on the function as a workaround. `%s.prototype = React.Component.prototype`. Don't use an arrow function since it cannot be called with `new` by React.",B,B,B),h0[B]=!0)}if(typeof P=="object"&&P!==null&&typeof P.render=="function"&&P.$$typeof===void 0){{var ae=On(f)||"Unknown";h0[ae]||(c("The <%s /> component appears to be a function component that returns a class instance. Change %s to a class that extends React.Component instead. If you can't use a class try assigning the prototype on the function as a workaround. `%s.prototype = React.Component.prototype`. Don't use an arrow function since it cannot be called with `new` by React.",ae,ae,ae),h0[ae]=!0)}o.tag=v,o.memoizedState=null,o.updateQueue=null;var re=!1;return Xl(f)?(re=!0,dk(o)):re=!1,o.memoizedState=P.state!==null&&P.state!==void 0?P.state:null,ZE(o),KF(o,P),zR(o,f,y,m),QR(null,o,f,!0,re,m)}else{if(o.tag=p,o.mode&an){nr(!0);try{P=rg(null,o,f,y,C,m),D=ig()}finally{nr(!1)}}return la()&&D&&DE(o),Ya(null,o,P,m),XR(o,f),o.child}}function XR(i,o){{if(o&&o.childContextTypes&&c("%s(...): childContextTypes cannot be defined on a function component.",o.displayName||o.name||"Component"),i.ref!==null){var f="",m=na();m&&(f+=`
|
|
197
197
|
|
|
198
|
-
Check the render method of \``+m+"`.");var y=m||"",C=i._debugSource;C&&(y=C.fileName+":"+C.lineNumber),YR[y]||(YR[y]=!0,c("Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?%s",f))}if(o.defaultProps!==void 0){var w=On(o)||"Unknown";p0[w]||(c("%s: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead.",w),p0[w]=!0)}if(typeof o.getDerivedStateFromProps=="function"){var P=On(o)||"Unknown";GR[P]||(c("%s: Function components do not support getDerivedStateFromProps.",P),GR[P]=!0)}if(typeof o.contextType=="object"&&o.contextType!==null){var D=On(o)||"Unknown";WR[D]||(c("%s: Function components do not support contextType.",D),WR[D]=!0)}}}var JR={dehydrated:null,treeContext:null,retryLane:ii};function eP(i){return{baseLanes:i,cachePool:Uie(),transitions:null}}function Yie(i,o){var f=null;return{baseLanes:sn(i.baseLanes,o),cachePool:f,transitions:i.transitions}}function Kie(i,o,f,m){if(o!==null){var y=o.memoizedState;if(y===null)return!1}return tR(i,r0)}function Zie(i,o){return Jf(i.childLanes,o)}function c9(i,o,f){var m=o.pendingProps;ase(o)&&(o.flags|=pn);var y=el.current,C=!1,w=(o.flags&pn)!==Ot;if(w||Kie(y,i)?(C=!0,o.flags&=~pn):(i===null||i.memoizedState!==null)&&(y=pie(y,vF)),y=Jm(y),Ud(o,y),i===null){NE(o);var P=o.memoizedState;if(P!==null){var D=P.dehydrated;if(D!==null)return tae(o,D)}var F=m.children,B=m.fallback;if(C){var ae=Qie(o,F,B,f),re=o.child;return re.memoizedState=eP(f),o.memoizedState=JR,ae}else return tP(o,F)}else{var ge=i.memoizedState;if(ge!==null){var be=ge.dehydrated;if(be!==null)return nae(i,o,w,m,be,ge,f)}if(C){var we=m.fallback,st=m.children,Vt=Jie(i,o,st,we,f),Pt=o.child,Ln=i.child.memoizedState;return Pt.memoizedState=Ln===null?eP(f):Yie(Ln,f),Pt.childLanes=Zie(i,f),o.memoizedState=JR,Vt}else{var wn=m.children,ce=Xie(i,o,wn,f);return o.memoizedState=null,ce}}}function tP(i,o,f){var m=i.mode,y={mode:"visible",children:o},C=nP(y,m);return C.return=i,i.child=C,C}function Qie(i,o,f,m){var y=i.mode,C=i.child,w={mode:"hidden",children:o},P,D;return(y&vn)===Mt&&C!==null?(P=C,P.childLanes=Pe,P.pendingProps=w,i.mode&Rn&&(P.actualDuration=0,P.actualStartTime=-1,P.selfBaseDuration=0,P.treeBaseDuration=0),D=qd(f,y,m,null)):(P=nP(w,y),D=qd(f,y,m,null)),P.return=i,D.return=i,P.sibling=D,i.child=P,D}function nP(i,o,f){return dj(i,o,Pe,null)}function d9(i,o){return Oh(i,o)}function Xie(i,o,f,m){var y=i.child,C=y.sibling,w=d9(y,{mode:"visible",children:f});if((o.mode&vn)===Mt&&(w.lanes=m),w.return=o,w.sibling=null,C!==null){var P=o.deletions;P===null?(o.deletions=[C],o.flags|=wa):P.push(C)}return o.child=w,w}function Jie(i,o,f,m,y){var C=o.mode,w=i.child,P=w.sibling,D={mode:"hidden",children:f},F;if((C&vn)===Mt&&o.child!==w){var B=o.child;F=B,F.childLanes=Pe,F.pendingProps=D,o.mode&Rn&&(F.actualDuration=0,F.actualStartTime=-1,F.selfBaseDuration=w.selfBaseDuration,F.treeBaseDuration=w.treeBaseDuration),o.deletions=null}else F=d9(w,D),F.subtreeFlags=w.subtreeFlags&ri;var ae;return P!==null?ae=Oh(P,m):(ae=qd(m,C,y,null),ae.flags|=jr),ae.return=o,F.return=o,F.sibling=ae,o.child=F,ae}function e1(i,o,f,m){m!==null&&IE(m),Km(o,i.child,null,f);var y=o.pendingProps,C=y.children,w=tP(o,C);return w.flags|=jr,o.memoizedState=null,w}function eae(i,o,f,m,y){var C=o.mode,w={mode:"visible",children:f},P=nP(w,C),D=qd(m,C,y,null);return D.flags|=jr,P.return=o,D.return=o,P.sibling=D,o.child=P,(o.mode&vn)!==Mt&&Km(o,i.child,null,y),D}function tae(i,o,f){return(i.mode&vn)===Mt?(c("Cannot hydrate Suspense in legacy mode. Switch from ReactDOM.hydrate(element, container) to ReactDOMClient.hydrateRoot(container, <App />).render(element) or remove the Suspense components from the server rendered components."),i.lanes=$t):SE(o)?i.lanes=Si:i.lanes=Pa,null}function nae(i,o,f,m,y,C,w){if(f)if(o.flags&Pr){o.flags&=~Pr;var ce=BR(new Error("There was an error while hydrating this Suspense boundary. Switched to client rendering."));return e1(i,o,w,ce)}else{if(o.memoizedState!==null)return o.child=i.child,o.flags|=pn,null;var _e=m.children,de=m.fallback,qe=eae(i,o,_e,de,w),yt=o.child;return yt.memoizedState=eP(w),o.memoizedState=JR,qe}else{if(Hre(),(o.mode&vn)===Mt)return e1(i,o,w,null);if(SE(y)){var P,D,F;{var B=ore(y);P=B.digest,D=B.message,F=B.stack}var ae;D?ae=new Error(D):ae=new Error("The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering.");var re=BR(ae,P,F);return e1(i,o,w,re)}var ge=Aa(w,i.childLanes);if(rl||ge){var be=d1();if(be!==null){var we=bm(be,w);if(we!==ii&&we!==C.retryLane){C.retryLane=we;var st=rr;wo(i,we),Vi(be,i,we,st)}}TP();var Vt=BR(new Error("This Suspense boundary received an update before it finished hydrating. This caused the boundary to switch to client rendering. The usual way to fix this is to wrap the original update in startTransition."));return e1(i,o,w,Vt)}else if(LU(y)){o.flags|=pn,o.child=i.child;var Pt=Eoe.bind(null,i);return sre(y,Pt),null}else{Wre(o,y,C.treeContext);var Ln=m.children,wn=tP(o,Ln);return wn.flags|=Vr,wn}}}function f9(i,o,f){i.lanes=sn(i.lanes,o);var m=i.alternate;m!==null&&(m.lanes=sn(m.lanes,o)),WE(i.return,o,f)}function rae(i,o,f){for(var m=o;m!==null;){if(m.tag===N){var y=m.memoizedState;y!==null&&f9(m,f,i)}else if(m.tag===J)f9(m,f,i);else if(m.child!==null){m.child.return=m,m=m.child;continue}if(m===i)return;for(;m.sibling===null;){if(m.return===null||m.return===i)return;m=m.return}m.sibling.return=m.return,m=m.sibling}}function iae(i){for(var o=i,f=null;o!==null;){var m=o.alternate;m!==null&&Ok(m)===null&&(f=o),o=o.sibling}return f}function aae(i){if(i!==void 0&&i!=="forwards"&&i!=="backwards"&&i!=="together"&&!KR[i])if(KR[i]=!0,typeof i=="string")switch(i.toLowerCase()){case"together":case"forwards":case"backwards":{c('"%s" is not a valid value for revealOrder on <SuspenseList />. Use lowercase "%s" instead.',i,i.toLowerCase());break}case"forward":case"backward":{c('"%s" is not a valid value for revealOrder on <SuspenseList />. React uses the -s suffix in the spelling. Use "%ss" instead.',i,i.toLowerCase());break}default:c('"%s" is not a supported revealOrder on <SuspenseList />. Did you mean "together", "forwards" or "backwards"?',i);break}else c('%s is not a supported value for revealOrder on <SuspenseList />. Did you mean "together", "forwards" or "backwards"?',i)}function oae(i,o){i!==void 0&&!Jk[i]&&(i!=="collapsed"&&i!=="hidden"?(Jk[i]=!0,c('"%s" is not a supported value for tail on <SuspenseList />. Did you mean "collapsed" or "hidden"?',i)):o!=="forwards"&&o!=="backwards"&&(Jk[i]=!0,c('<SuspenseList tail="%s" /> is only valid if revealOrder is "forwards" or "backwards". Did you mean to specify revealOrder="forwards"?',i)))}function h9(i,o){{var f=on(i),m=!f&&typeof Rr(i)=="function";if(f||m){var y=f?"array":"iterable";return c("A nested %s was passed to row #%s in <SuspenseList />. Wrap it in an additional SuspenseList to configure its revealOrder: <SuspenseList revealOrder=...> ... <SuspenseList revealOrder=...>{%s}</SuspenseList> ... </SuspenseList>",y,o,y),!1}}return!0}function sae(i,o){if((o==="forwards"||o==="backwards")&&i!==void 0&&i!==null&&i!==!1)if(on(i)){for(var f=0;f<i.length;f++)if(!h9(i[f],f))return}else{var m=Rr(i);if(typeof m=="function"){var y=m.call(i);if(y)for(var C=y.next(),w=0;!C.done;C=y.next()){if(!h9(C.value,w))return;w++}}else c('A single row was passed to a <SuspenseList revealOrder="%s" />. This is not useful since it needs multiple rows. Did you mean to pass multiple children or an array?',o)}}function rP(i,o,f,m,y){var C=i.memoizedState;C===null?i.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:m,tail:f,tailMode:y}:(C.isBackwards=o,C.rendering=null,C.renderingStartTime=0,C.last=m,C.tail=f,C.tailMode=y)}function p9(i,o,f){var m=o.pendingProps,y=m.revealOrder,C=m.tail,w=m.children;aae(y),oae(C,y),sae(w,y),Ya(i,o,w,f);var P=el.current,D=tR(P,r0);if(D)P=nR(P,r0),o.flags|=pn;else{var F=i!==null&&(i.flags&pn)!==Ot;F&&rae(o,o.child,f),P=Jm(P)}if(Ud(o,P),(o.mode&vn)===Mt)o.memoizedState=null;else switch(y){case"forwards":{var B=iae(o.child),ae;B===null?(ae=o.child,o.child=null):(ae=B.sibling,B.sibling=null),rP(o,!1,ae,B,C);break}case"backwards":{var re=null,ge=o.child;for(o.child=null;ge!==null;){var be=ge.alternate;if(be!==null&&Ok(be)===null){o.child=ge;break}var we=ge.sibling;ge.sibling=re,re=ge,ge=we}rP(o,!0,re,null,C);break}case"together":{rP(o,!1,null,null,void 0);break}default:o.memoizedState=null}return o.child}function lae(i,o,f){XE(o,o.stateNode.containerInfo);var m=o.pendingProps;return i===null?o.child=Km(o,null,m,f):Ya(i,o,m,f),o.child}var m9=!1;function uae(i,o,f){var m=o.type,y=m._context,C=o.pendingProps,w=o.memoizedProps,P=C.value;{"value"in C||m9||(m9=!0,c("The `value` prop is required for the `<Context.Provider>`. Did you misspell it or forget to pass it?"));var D=o.type.propTypes;D&&Qs(D,C,"prop","Context.Provider")}if(sF(o,y,P),w!==null){var F=w.value;if(dt(F,P)){if(w.children===C.children&&!uk())return oc(i,o,f)}else aie(o,y,f)}var B=C.children;return Ya(i,o,B,f),o.child}var g9=!1;function cae(i,o,f){var m=o.type;m._context===void 0?m!==m.Consumer&&(g9||(g9=!0,c("Rendering <Context> directly is not supported and will be removed in a future major release. Did you mean to render <Context.Consumer> instead?"))):m=m._context;var y=o.pendingProps,C=y.children;typeof C!="function"&&c("A context consumer was rendered with multiple children, or a child that isn't a function. A context consumer expects a single child that is a function. If you did pass a function, make sure there is no trailing or leading whitespace around it."),Qm(o,f);var w=Ti(m);bo(o);var P;return f0.current=o,ho(!0),P=C(w),ho(!1),Ul(),o.flags|=Ws,Ya(i,o,P,f),o.child}function m0(){rl=!0}function t1(i,o){(o.mode&vn)===Mt&&i!==null&&(i.alternate=null,o.alternate=null,o.flags|=jr)}function oc(i,o,f){return i!==null&&(o.dependencies=i.dependencies),qF(),E0(o.lanes),Aa(f,o.childLanes)?(rie(i,o),o.child):null}function dae(i,o,f){{var m=o.return;if(m===null)throw new Error("Cannot swap the root fiber.");if(i.alternate=null,o.alternate=null,f.index=o.index,f.sibling=o.sibling,f.return=o.return,f.ref=o.ref,o===m.child)m.child=f;else{var y=m.child;if(y===null)throw new Error("Expected parent to have a child.");for(;y.sibling!==o;)if(y=y.sibling,y===null)throw new Error("Expected to find the previous sibling.");y.sibling=f}var C=m.deletions;return C===null?(m.deletions=[i],m.flags|=wa):C.push(i),f.flags|=jr,f}}function iP(i,o){var f=i.lanes;return!!Aa(f,o)}function fae(i,o,f){switch(o.tag){case k:l9(o),o.stateNode,Ym();break;case E:mF(o);break;case v:{var m=o.type;Xl(m)&&dk(o);break}case T:XE(o,o.stateNode.containerInfo);break;case V:{var y=o.memoizedProps.value,C=o.type._context;sF(o,C,y);break}case I:{var w=Aa(f,o.childLanes);w&&(o.flags|=Tn);{var P=o.stateNode;P.effectDuration=0,P.passiveEffectDuration=0}}break;case N:{var D=o.memoizedState;if(D!==null){if(D.dehydrated!==null)return Ud(o,Jm(el.current)),o.flags|=pn,null;var F=o.child,B=F.childLanes;if(Aa(f,B))return c9(i,o,f);Ud(o,Jm(el.current));var ae=oc(i,o,f);return ae!==null?ae.sibling:null}else Ud(o,Jm(el.current));break}case J:{var re=(i.flags&pn)!==Ot,ge=Aa(f,o.childLanes);if(re){if(ge)return p9(i,o,f);o.flags|=pn}var be=o.memoizedState;if(be!==null&&(be.rendering=null,be.tail=null,be.lastEffect=null),Ud(o,el.current),ge)break;return null}case ke:case Ge:return o.lanes=Pe,a9(i,o,f)}return oc(i,o,f)}function v9(i,o,f){if(o._debugNeedsRemount&&i!==null)return dae(i,o,LP(o.type,o.key,o.pendingProps,o._debugOwner||null,o.mode,o.lanes));if(i!==null){var m=i.memoizedProps,y=o.pendingProps;if(m!==y||uk()||o.type!==i.type)rl=!0;else{var C=iP(i,f);if(!C&&(o.flags&pn)===Ot)return rl=!1,fae(i,o,f);(i.flags&jo)!==Ot?rl=!0:rl=!1}}else if(rl=!1,la()&&Ure(o)){var w=o.index,P=Fre();qU(o,P,w)}switch(o.lanes=Pe,o.tag){case b:return Gie(i,o,o.type,f);case se:{var D=o.elementType;return qie(i,o,D,f)}case p:{var F=o.type,B=o.pendingProps,ae=o.elementType===F?B:nl(F,B);return ZR(i,o,F,ae,f)}case v:{var re=o.type,ge=o.pendingProps,be=o.elementType===re?ge:nl(re,ge);return s9(i,o,re,be,f)}case k:return Bie(i,o,f);case E:return Hie(i,o,f);case R:return $ie(i,o);case N:return c9(i,o,f);case T:return lae(i,o,f);case j:{var we=o.type,st=o.pendingProps,Vt=o.elementType===we?st:nl(we,st);return n9(i,o,we,Vt,f)}case M:return jie(i,o,f);case A:return Vie(i,o,f);case I:return zie(i,o,f);case V:return uae(i,o,f);case U:return cae(i,o,f);case ne:{var Pt=o.type,Ln=o.pendingProps,wn=nl(Pt,Ln);if(o.type!==o.elementType){var ce=Pt.propTypes;ce&&Qs(ce,wn,"prop",On(Pt))}return wn=nl(Pt.type,wn),r9(i,o,Pt,wn,f)}case X:return i9(i,o,o.type,o.pendingProps,f);case $:{var _e=o.type,de=o.pendingProps,qe=o.elementType===_e?de:nl(_e,de);return Wie(i,o,_e,qe,f)}case J:return p9(i,o,f);case xe:break;case ke:return a9(i,o,f)}throw new Error("Unknown unit of work tag ("+o.tag+"). This error is likely caused by a bug in React. Please file an issue.")}function ag(i){i.flags|=Tn}function y9(i){i.flags|=ni,i.flags|=jf}var b9,aP,S9,C9;b9=function(i,o,f,m){for(var y=o.child;y!==null;){if(y.tag===E||y.tag===R)Lne(i,y.stateNode);else if(y.tag!==T){if(y.child!==null){y.child.return=y,y=y.child;continue}}if(y===o)return;for(;y.sibling===null;){if(y.return===null||y.return===o)return;y=y.return}y.sibling.return=y.return,y=y.sibling}},aP=function(i,o){},S9=function(i,o,f,m,y){var C=i.memoizedProps;if(C!==m){var w=o.stateNode,P=JE(),D=Ine(w,f,C,m,y,P);o.updateQueue=D,D&&ag(o)}},C9=function(i,o,f,m){f!==m&&ag(o)};function g0(i,o){if(!la())switch(i.tailMode){case"hidden":{for(var f=i.tail,m=null;f!==null;)f.alternate!==null&&(m=f),f=f.sibling;m===null?i.tail=null:m.sibling=null;break}case"collapsed":{for(var y=i.tail,C=null;y!==null;)y.alternate!==null&&(C=y),y=y.sibling;C===null?!o&&i.tail!==null?i.tail.sibling=null:i.tail=null:C.sibling=null;break}}}function ca(i){var o=i.alternate!==null&&i.alternate.child===i.child,f=Pe,m=Ot;if(o){if((i.mode&Rn)!==Mt){for(var D=i.selfBaseDuration,F=i.child;F!==null;)f=sn(f,sn(F.lanes,F.childLanes)),m|=F.subtreeFlags&ri,m|=F.flags&ri,D+=F.treeBaseDuration,F=F.sibling;i.treeBaseDuration=D}else for(var B=i.child;B!==null;)f=sn(f,sn(B.lanes,B.childLanes)),m|=B.subtreeFlags&ri,m|=B.flags&ri,B.return=i,B=B.sibling;i.subtreeFlags|=m}else{if((i.mode&Rn)!==Mt){for(var y=i.actualDuration,C=i.selfBaseDuration,w=i.child;w!==null;)f=sn(f,sn(w.lanes,w.childLanes)),m|=w.subtreeFlags,m|=w.flags,y+=w.actualDuration,C+=w.treeBaseDuration,w=w.sibling;i.actualDuration=y,i.treeBaseDuration=C}else for(var P=i.child;P!==null;)f=sn(f,sn(P.lanes,P.childLanes)),m|=P.subtreeFlags,m|=P.flags,P.return=i,P=P.sibling;i.subtreeFlags|=m}return i.childLanes=f,o}function hae(i,o,f){if(Qre()&&(o.mode&vn)!==Mt&&(o.flags&pn)===Ot)return XU(o),Ym(),o.flags|=Pr|Lu|Gi,!1;var m=gk(o);if(f!==null&&f.dehydrated!==null)if(i===null){if(!m)throw new Error("A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React.");if(Kre(o),ca(o),(o.mode&Rn)!==Mt){var y=f!==null;if(y){var C=o.child;C!==null&&(o.treeBaseDuration-=C.treeBaseDuration)}}return!1}else{if(Ym(),(o.flags&pn)===Ot&&(o.memoizedState=null),o.flags|=Tn,ca(o),(o.mode&Rn)!==Mt){var w=f!==null;if(w){var P=o.child;P!==null&&(o.treeBaseDuration-=P.treeBaseDuration)}}return!1}else return JU(),!0}function k9(i,o,f){var m=o.pendingProps;switch(AE(o),o.tag){case b:case se:case X:case p:case j:case M:case A:case I:case U:case ne:return ca(o),null;case v:{var y=o.type;return Xl(y)&&ck(o),ca(o),null}case k:{var C=o.stateNode;if(Xm(o),EE(o),iR(),C.pendingContext&&(C.context=C.pendingContext,C.pendingContext=null),i===null||i.child===null){var w=gk(o);if(w)ag(o);else if(i!==null){var P=i.memoizedState;(!P.isDehydrated||(o.flags&Pr)!==Ot)&&(o.flags|=yo,JU())}}return aP(i,o),ca(o),null}case E:{eR(o);var D=pF(),F=o.type;if(i!==null&&o.stateNode!=null)S9(i,o,F,m,D),i.ref!==o.ref&&y9(o);else{if(!m){if(o.stateNode===null)throw new Error("We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.");return ca(o),null}var B=JE(),ae=gk(o);if(ae)Gre(o,D,B)&&ag(o);else{var re=Mne(F,m,D,B,o);b9(re,o,!1,!1),o.stateNode=re,Nne(re,F,m,D)&&ag(o)}o.ref!==null&&y9(o)}return ca(o),null}case R:{var ge=m;if(i&&o.stateNode!=null){var be=i.memoizedProps;C9(i,o,be,ge)}else{if(typeof ge!="string"&&o.stateNode===null)throw new Error("We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.");var we=pF(),st=JE(),Vt=gk(o);Vt?Yre(o)&&ag(o):o.stateNode=Une(ge,we,st,o)}return ca(o),null}case N:{eg(o);var Pt=o.memoizedState;if(i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){var Ln=hae(i,o,Pt);if(!Ln)return o.flags&Gi?o:null}if((o.flags&pn)!==Ot)return o.lanes=f,(o.mode&Rn)!==Mt&&PR(o),o;var wn=Pt!==null,ce=i!==null&&i.memoizedState!==null;if(wn!==ce&&wn){var _e=o.child;if(_e.flags|=ls,(o.mode&vn)!==Mt){var de=i===null&&(o.memoizedProps.unstable_avoidThisFallback!==!0||!0);de||tR(el.current,vF)?poe():TP()}}var qe=o.updateQueue;if(qe!==null&&(o.flags|=Tn),ca(o),(o.mode&Rn)!==Mt&&wn){var yt=o.child;yt!==null&&(o.treeBaseDuration-=yt.treeBaseDuration)}return null}case T:return Xm(o),aP(i,o),i===null&&Dre(o.stateNode.containerInfo),ca(o),null;case V:var ft=o.type._context;return qE(ft,o),ca(o),null;case $:{var Wt=o.type;return Xl(Wt)&&ck(o),ca(o),null}case J:{eg(o);var nn=o.memoizedState;if(nn===null)return ca(o),null;var fr=(o.flags&pn)!==Ot,Bn=nn.rendering;if(Bn===null)if(fr)g0(nn,!1);else{var mi=goe()&&(i===null||(i.flags&pn)===Ot);if(!mi)for(var Hn=o.child;Hn!==null;){var oi=Ok(Hn);if(oi!==null){fr=!0,o.flags|=pn,g0(nn,!1);var Ua=oi.updateQueue;return Ua!==null&&(o.updateQueue=Ua,o.flags|=Tn),o.subtreeFlags=Ot,iie(o,f),Ud(o,nR(el.current,r0)),o.child}Hn=Hn.sibling}nn.tail!==null&&Gr()>H9()&&(o.flags|=pn,fr=!0,g0(nn,!1),o.lanes=pC)}else{if(!fr){var ma=Ok(Bn);if(ma!==null){o.flags|=pn,fr=!0;var Wo=ma.updateQueue;if(Wo!==null&&(o.updateQueue=Wo,o.flags|=Tn),g0(nn,!0),nn.tail===null&&nn.tailMode==="hidden"&&!Bn.alternate&&!la())return ca(o),null}else Gr()*2-nn.renderingStartTime>H9()&&f!==Pa&&(o.flags|=pn,fr=!0,g0(nn,!1),o.lanes=pC)}if(nn.isBackwards)Bn.sibling=o.child,o.child=Bn;else{var Qa=nn.last;Qa!==null?Qa.sibling=Bn:o.child=Bn,nn.last=Bn}}if(nn.tail!==null){var Xa=nn.tail;nn.rendering=Xa,nn.tail=Xa.sibling,nn.renderingStartTime=Gr(),Xa.sibling=null;var Fa=el.current;return fr?Fa=nR(Fa,r0):Fa=Jm(Fa),Ud(o,Fa),Xa}return ca(o),null}case xe:break;case ke:case Ge:{kP(o);var dc=o.memoizedState,hg=dc!==null;if(i!==null){var O0=i.memoizedState,ou=O0!==null;ou!==hg&&!ee&&(o.flags|=ls)}return!hg||(o.mode&vn)===Mt?ca(o):Aa(au,Pa)&&(ca(o),o.subtreeFlags&(jr|Tn)&&(o.flags|=ls)),null}case Je:return null;case je:return null}throw new Error("Unknown unit of work tag ("+o.tag+"). This error is likely caused by a bug in React. Please file an issue.")}function pae(i,o,f){switch(AE(o),o.tag){case v:{var m=o.type;Xl(m)&&ck(o);var y=o.flags;return y&Gi?(o.flags=y&~Gi|pn,(o.mode&Rn)!==Mt&&PR(o),o):null}case k:{o.stateNode,Xm(o),EE(o),iR();var C=o.flags;return(C&Gi)!==Ot&&(C&pn)===Ot?(o.flags=C&~Gi|pn,o):null}case E:return eR(o),null;case N:{eg(o);var w=o.memoizedState;if(w!==null&&w.dehydrated!==null){if(o.alternate===null)throw new Error("Threw in newly mounted dehydrated component. This is likely a bug in React. Please file an issue.");Ym()}var P=o.flags;return P&Gi?(o.flags=P&~Gi|pn,(o.mode&Rn)!==Mt&&PR(o),o):null}case J:return eg(o),null;case T:return Xm(o),null;case V:var D=o.type._context;return qE(D,o),null;case ke:case Ge:return kP(o),null;case Je:return null;default:return null}}function T9(i,o,f){switch(AE(o),o.tag){case v:{var m=o.type.childContextTypes;m!=null&&ck(o);break}case k:{o.stateNode,Xm(o),EE(o),iR();break}case E:{eR(o);break}case T:Xm(o);break;case N:eg(o);break;case J:eg(o);break;case V:var y=o.type._context;qE(y,o);break;case ke:case Ge:kP(o);break}}var x9=null;x9=new Set;var n1=!1,da=!1,mae=typeof WeakSet=="function"?WeakSet:Set,_t=null,og=null,sg=null;function gae(i){vo(null,function(){throw i}),Gv()}var vae=function(i,o){if(o.props=i.memoizedProps,o.state=i.memoizedState,i.mode&Rn)try{ru(),o.componentWillUnmount()}finally{nu(i)}else o.componentWillUnmount()};function w9(i,o){try{Vd(Li,i)}catch(f){Tr(i,o,f)}}function oP(i,o,f){try{vae(i,f)}catch(m){Tr(i,o,m)}}function yae(i,o,f){try{f.componentDidMount()}catch(m){Tr(i,o,m)}}function _9(i,o){try{R9(i)}catch(f){Tr(i,o,f)}}function lg(i,o){var f=i.ref;if(f!==null)if(typeof f=="function"){var m;try{if(Rt&&ht&&i.mode&Rn)try{ru(),m=f(null)}finally{nu(i)}else m=f(null)}catch(y){Tr(i,o,y)}typeof m=="function"&&c("Unexpected return value from a callback ref in %s. A callback ref should not return a function.",Zt(i))}else f.current=null}function r1(i,o,f){try{f()}catch(m){Tr(i,o,m)}}var E9=!1;function bae(i,o){Ane(i.containerInfo),_t=o,Sae();var f=E9;return E9=!1,f}function Sae(){for(;_t!==null;){var i=_t,o=i.child;(i.subtreeFlags&Ll)!==Ot&&o!==null?(o.return=i,_t=o):Cae()}}function Cae(){for(;_t!==null;){var i=_t;sr(i);try{kae(i)}catch(f){Tr(i,i.return,f)}Fr();var o=i.sibling;if(o!==null){o.return=i.return,_t=o;return}_t=i.return}}function kae(i){var o=i.alternate,f=i.flags;if((f&yo)!==Ot){switch(sr(i),i.tag){case p:case j:case X:break;case v:{if(o!==null){var m=o.memoizedProps,y=o.memoizedState,C=i.stateNode;i.type===i.elementType&&!Eh&&(C.props!==i.memoizedProps&&c("Expected %s props to match memoized props before getSnapshotBeforeUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.",Zt(i)||"instance"),C.state!==i.memoizedState&&c("Expected %s state to match memoized state before getSnapshotBeforeUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.",Zt(i)||"instance"));var w=C.getSnapshotBeforeUpdate(i.elementType===i.type?m:nl(i.type,m),y);{var P=x9;w===void 0&&!P.has(i.type)&&(P.add(i.type),c("%s.getSnapshotBeforeUpdate(): A snapshot value (or null) must be returned. You have returned undefined.",Zt(i)))}C.__reactInternalSnapshotBeforeUpdate=w}break}case k:{{var D=i.stateNode;nre(D.containerInfo)}break}case E:case R:case T:case $:break;default:throw new Error("This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.")}Fr()}}function il(i,o,f){var m=o.updateQueue,y=m!==null?m.lastEffect:null;if(y!==null){var C=y.next,w=C;do{if((w.tag&i)===i){var P=w.destroy;w.destroy=void 0,P!==void 0&&((i&ua)!==_o?Fl(o):(i&Li)!==_o&&ay(o),(i&Jl)!==_o&&P0(!0),r1(o,f,P),(i&Jl)!==_o&&P0(!1),(i&ua)!==_o?Wp():(i&Li)!==_o&&fd())}w=w.next}while(w!==C)}}function Vd(i,o){var f=o.updateQueue,m=f!==null?f.lastEffect:null;if(m!==null){var y=m.next,C=y;do{if((C.tag&i)===i){(i&ua)!==_o?fC(o):(i&Li)!==_o&&hC(o);var w=C.create;(i&Jl)!==_o&&P0(!0),C.destroy=w(),(i&Jl)!==_o&&P0(!1),(i&ua)!==_o?Ys():(i&Li)!==_o&&Gp();{var P=C.destroy;if(P!==void 0&&typeof P!="function"){var D=void 0;(C.tag&Li)!==Ot?D="useLayoutEffect":(C.tag&Jl)!==Ot?D="useInsertionEffect":D="useEffect";var F=void 0;P===null?F=" You returned null. If your effect does not require clean up, return undefined (or nothing).":typeof P.then=="function"?F=`
|
|
198
|
+
Check the render method of \``+m+"`.");var y=m||"",C=i._debugSource;C&&(y=C.fileName+":"+C.lineNumber),YR[y]||(YR[y]=!0,c("Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?%s",f))}if(o.defaultProps!==void 0){var w=On(o)||"Unknown";p0[w]||(c("%s: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead.",w),p0[w]=!0)}if(typeof o.getDerivedStateFromProps=="function"){var P=On(o)||"Unknown";GR[P]||(c("%s: Function components do not support getDerivedStateFromProps.",P),GR[P]=!0)}if(typeof o.contextType=="object"&&o.contextType!==null){var D=On(o)||"Unknown";WR[D]||(c("%s: Function components do not support contextType.",D),WR[D]=!0)}}}var JR={dehydrated:null,treeContext:null,retryLane:ii};function eP(i){return{baseLanes:i,cachePool:Fie(),transitions:null}}function Kie(i,o){var f=null;return{baseLanes:sn(i.baseLanes,o),cachePool:f,transitions:i.transitions}}function Zie(i,o,f,m){if(o!==null){var y=o.memoizedState;if(y===null)return!1}return tR(i,r0)}function Qie(i,o){return Jf(i.childLanes,o)}function c9(i,o,f){var m=o.pendingProps;ose(o)&&(o.flags|=pn);var y=el.current,C=!1,w=(o.flags&pn)!==Ot;if(w||Zie(y,i)?(C=!0,o.flags&=~pn):(i===null||i.memoizedState!==null)&&(y=mie(y,vF)),y=Jm(y),Ud(o,y),i===null){NE(o);var P=o.memoizedState;if(P!==null){var D=P.dehydrated;if(D!==null)return nae(o,D)}var F=m.children,B=m.fallback;if(C){var ae=Xie(o,F,B,f),re=o.child;return re.memoizedState=eP(f),o.memoizedState=JR,ae}else return tP(o,F)}else{var ge=i.memoizedState;if(ge!==null){var be=ge.dehydrated;if(be!==null)return rae(i,o,w,m,be,ge,f)}if(C){var we=m.fallback,st=m.children,Vt=eae(i,o,st,we,f),Pt=o.child,Ln=i.child.memoizedState;return Pt.memoizedState=Ln===null?eP(f):Kie(Ln,f),Pt.childLanes=Qie(i,f),o.memoizedState=JR,Vt}else{var wn=m.children,ce=Jie(i,o,wn,f);return o.memoizedState=null,ce}}}function tP(i,o,f){var m=i.mode,y={mode:"visible",children:o},C=nP(y,m);return C.return=i,i.child=C,C}function Xie(i,o,f,m){var y=i.mode,C=i.child,w={mode:"hidden",children:o},P,D;return(y&vn)===Mt&&C!==null?(P=C,P.childLanes=Pe,P.pendingProps=w,i.mode&Rn&&(P.actualDuration=0,P.actualStartTime=-1,P.selfBaseDuration=0,P.treeBaseDuration=0),D=qd(f,y,m,null)):(P=nP(w,y),D=qd(f,y,m,null)),P.return=i,D.return=i,P.sibling=D,i.child=P,D}function nP(i,o,f){return dj(i,o,Pe,null)}function d9(i,o){return Oh(i,o)}function Jie(i,o,f,m){var y=i.child,C=y.sibling,w=d9(y,{mode:"visible",children:f});if((o.mode&vn)===Mt&&(w.lanes=m),w.return=o,w.sibling=null,C!==null){var P=o.deletions;P===null?(o.deletions=[C],o.flags|=wa):P.push(C)}return o.child=w,w}function eae(i,o,f,m,y){var C=o.mode,w=i.child,P=w.sibling,D={mode:"hidden",children:f},F;if((C&vn)===Mt&&o.child!==w){var B=o.child;F=B,F.childLanes=Pe,F.pendingProps=D,o.mode&Rn&&(F.actualDuration=0,F.actualStartTime=-1,F.selfBaseDuration=w.selfBaseDuration,F.treeBaseDuration=w.treeBaseDuration),o.deletions=null}else F=d9(w,D),F.subtreeFlags=w.subtreeFlags&ri;var ae;return P!==null?ae=Oh(P,m):(ae=qd(m,C,y,null),ae.flags|=jr),ae.return=o,F.return=o,F.sibling=ae,o.child=F,ae}function e1(i,o,f,m){m!==null&&IE(m),Km(o,i.child,null,f);var y=o.pendingProps,C=y.children,w=tP(o,C);return w.flags|=jr,o.memoizedState=null,w}function tae(i,o,f,m,y){var C=o.mode,w={mode:"visible",children:f},P=nP(w,C),D=qd(m,C,y,null);return D.flags|=jr,P.return=o,D.return=o,P.sibling=D,o.child=P,(o.mode&vn)!==Mt&&Km(o,i.child,null,y),D}function nae(i,o,f){return(i.mode&vn)===Mt?(c("Cannot hydrate Suspense in legacy mode. Switch from ReactDOM.hydrate(element, container) to ReactDOMClient.hydrateRoot(container, <App />).render(element) or remove the Suspense components from the server rendered components."),i.lanes=$t):SE(o)?i.lanes=Si:i.lanes=Pa,null}function rae(i,o,f,m,y,C,w){if(f)if(o.flags&Pr){o.flags&=~Pr;var ce=BR(new Error("There was an error while hydrating this Suspense boundary. Switched to client rendering."));return e1(i,o,w,ce)}else{if(o.memoizedState!==null)return o.child=i.child,o.flags|=pn,null;var _e=m.children,de=m.fallback,qe=tae(i,o,_e,de,w),yt=o.child;return yt.memoizedState=eP(w),o.memoizedState=JR,qe}else{if($re(),(o.mode&vn)===Mt)return e1(i,o,w,null);if(SE(y)){var P,D,F;{var B=sre(y);P=B.digest,D=B.message,F=B.stack}var ae;D?ae=new Error(D):ae=new Error("The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering.");var re=BR(ae,P,F);return e1(i,o,w,re)}var ge=Aa(w,i.childLanes);if(rl||ge){var be=d1();if(be!==null){var we=bm(be,w);if(we!==ii&&we!==C.retryLane){C.retryLane=we;var st=rr;wo(i,we),Vi(be,i,we,st)}}TP();var Vt=BR(new Error("This Suspense boundary received an update before it finished hydrating. This caused the boundary to switch to client rendering. The usual way to fix this is to wrap the original update in startTransition."));return e1(i,o,w,Vt)}else if(LU(y)){o.flags|=pn,o.child=i.child;var Pt=Roe.bind(null,i);return lre(y,Pt),null}else{Gre(o,y,C.treeContext);var Ln=m.children,wn=tP(o,Ln);return wn.flags|=Vr,wn}}}function f9(i,o,f){i.lanes=sn(i.lanes,o);var m=i.alternate;m!==null&&(m.lanes=sn(m.lanes,o)),WE(i.return,o,f)}function iae(i,o,f){for(var m=o;m!==null;){if(m.tag===N){var y=m.memoizedState;y!==null&&f9(m,f,i)}else if(m.tag===J)f9(m,f,i);else if(m.child!==null){m.child.return=m,m=m.child;continue}if(m===i)return;for(;m.sibling===null;){if(m.return===null||m.return===i)return;m=m.return}m.sibling.return=m.return,m=m.sibling}}function aae(i){for(var o=i,f=null;o!==null;){var m=o.alternate;m!==null&&Ok(m)===null&&(f=o),o=o.sibling}return f}function oae(i){if(i!==void 0&&i!=="forwards"&&i!=="backwards"&&i!=="together"&&!KR[i])if(KR[i]=!0,typeof i=="string")switch(i.toLowerCase()){case"together":case"forwards":case"backwards":{c('"%s" is not a valid value for revealOrder on <SuspenseList />. Use lowercase "%s" instead.',i,i.toLowerCase());break}case"forward":case"backward":{c('"%s" is not a valid value for revealOrder on <SuspenseList />. React uses the -s suffix in the spelling. Use "%ss" instead.',i,i.toLowerCase());break}default:c('"%s" is not a supported revealOrder on <SuspenseList />. Did you mean "together", "forwards" or "backwards"?',i);break}else c('%s is not a supported value for revealOrder on <SuspenseList />. Did you mean "together", "forwards" or "backwards"?',i)}function sae(i,o){i!==void 0&&!Jk[i]&&(i!=="collapsed"&&i!=="hidden"?(Jk[i]=!0,c('"%s" is not a supported value for tail on <SuspenseList />. Did you mean "collapsed" or "hidden"?',i)):o!=="forwards"&&o!=="backwards"&&(Jk[i]=!0,c('<SuspenseList tail="%s" /> is only valid if revealOrder is "forwards" or "backwards". Did you mean to specify revealOrder="forwards"?',i)))}function h9(i,o){{var f=on(i),m=!f&&typeof Rr(i)=="function";if(f||m){var y=f?"array":"iterable";return c("A nested %s was passed to row #%s in <SuspenseList />. Wrap it in an additional SuspenseList to configure its revealOrder: <SuspenseList revealOrder=...> ... <SuspenseList revealOrder=...>{%s}</SuspenseList> ... </SuspenseList>",y,o,y),!1}}return!0}function lae(i,o){if((o==="forwards"||o==="backwards")&&i!==void 0&&i!==null&&i!==!1)if(on(i)){for(var f=0;f<i.length;f++)if(!h9(i[f],f))return}else{var m=Rr(i);if(typeof m=="function"){var y=m.call(i);if(y)for(var C=y.next(),w=0;!C.done;C=y.next()){if(!h9(C.value,w))return;w++}}else c('A single row was passed to a <SuspenseList revealOrder="%s" />. This is not useful since it needs multiple rows. Did you mean to pass multiple children or an array?',o)}}function rP(i,o,f,m,y){var C=i.memoizedState;C===null?i.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:m,tail:f,tailMode:y}:(C.isBackwards=o,C.rendering=null,C.renderingStartTime=0,C.last=m,C.tail=f,C.tailMode=y)}function p9(i,o,f){var m=o.pendingProps,y=m.revealOrder,C=m.tail,w=m.children;oae(y),sae(C,y),lae(w,y),Ya(i,o,w,f);var P=el.current,D=tR(P,r0);if(D)P=nR(P,r0),o.flags|=pn;else{var F=i!==null&&(i.flags&pn)!==Ot;F&&iae(o,o.child,f),P=Jm(P)}if(Ud(o,P),(o.mode&vn)===Mt)o.memoizedState=null;else switch(y){case"forwards":{var B=aae(o.child),ae;B===null?(ae=o.child,o.child=null):(ae=B.sibling,B.sibling=null),rP(o,!1,ae,B,C);break}case"backwards":{var re=null,ge=o.child;for(o.child=null;ge!==null;){var be=ge.alternate;if(be!==null&&Ok(be)===null){o.child=ge;break}var we=ge.sibling;ge.sibling=re,re=ge,ge=we}rP(o,!0,re,null,C);break}case"together":{rP(o,!1,null,null,void 0);break}default:o.memoizedState=null}return o.child}function uae(i,o,f){XE(o,o.stateNode.containerInfo);var m=o.pendingProps;return i===null?o.child=Km(o,null,m,f):Ya(i,o,m,f),o.child}var m9=!1;function cae(i,o,f){var m=o.type,y=m._context,C=o.pendingProps,w=o.memoizedProps,P=C.value;{"value"in C||m9||(m9=!0,c("The `value` prop is required for the `<Context.Provider>`. Did you misspell it or forget to pass it?"));var D=o.type.propTypes;D&&Qs(D,C,"prop","Context.Provider")}if(sF(o,y,P),w!==null){var F=w.value;if(dt(F,P)){if(w.children===C.children&&!uk())return oc(i,o,f)}else oie(o,y,f)}var B=C.children;return Ya(i,o,B,f),o.child}var g9=!1;function dae(i,o,f){var m=o.type;m._context===void 0?m!==m.Consumer&&(g9||(g9=!0,c("Rendering <Context> directly is not supported and will be removed in a future major release. Did you mean to render <Context.Consumer> instead?"))):m=m._context;var y=o.pendingProps,C=y.children;typeof C!="function"&&c("A context consumer was rendered with multiple children, or a child that isn't a function. A context consumer expects a single child that is a function. If you did pass a function, make sure there is no trailing or leading whitespace around it."),Qm(o,f);var w=Ti(m);bo(o);var P;return f0.current=o,ho(!0),P=C(w),ho(!1),Ul(),o.flags|=Ws,Ya(i,o,P,f),o.child}function m0(){rl=!0}function t1(i,o){(o.mode&vn)===Mt&&i!==null&&(i.alternate=null,o.alternate=null,o.flags|=jr)}function oc(i,o,f){return i!==null&&(o.dependencies=i.dependencies),qF(),E0(o.lanes),Aa(f,o.childLanes)?(iie(i,o),o.child):null}function fae(i,o,f){{var m=o.return;if(m===null)throw new Error("Cannot swap the root fiber.");if(i.alternate=null,o.alternate=null,f.index=o.index,f.sibling=o.sibling,f.return=o.return,f.ref=o.ref,o===m.child)m.child=f;else{var y=m.child;if(y===null)throw new Error("Expected parent to have a child.");for(;y.sibling!==o;)if(y=y.sibling,y===null)throw new Error("Expected to find the previous sibling.");y.sibling=f}var C=m.deletions;return C===null?(m.deletions=[i],m.flags|=wa):C.push(i),f.flags|=jr,f}}function iP(i,o){var f=i.lanes;return!!Aa(f,o)}function hae(i,o,f){switch(o.tag){case k:l9(o),o.stateNode,Ym();break;case E:mF(o);break;case v:{var m=o.type;Xl(m)&&dk(o);break}case T:XE(o,o.stateNode.containerInfo);break;case V:{var y=o.memoizedProps.value,C=o.type._context;sF(o,C,y);break}case I:{var w=Aa(f,o.childLanes);w&&(o.flags|=Tn);{var P=o.stateNode;P.effectDuration=0,P.passiveEffectDuration=0}}break;case N:{var D=o.memoizedState;if(D!==null){if(D.dehydrated!==null)return Ud(o,Jm(el.current)),o.flags|=pn,null;var F=o.child,B=F.childLanes;if(Aa(f,B))return c9(i,o,f);Ud(o,Jm(el.current));var ae=oc(i,o,f);return ae!==null?ae.sibling:null}else Ud(o,Jm(el.current));break}case J:{var re=(i.flags&pn)!==Ot,ge=Aa(f,o.childLanes);if(re){if(ge)return p9(i,o,f);o.flags|=pn}var be=o.memoizedState;if(be!==null&&(be.rendering=null,be.tail=null,be.lastEffect=null),Ud(o,el.current),ge)break;return null}case ke:case Ge:return o.lanes=Pe,a9(i,o,f)}return oc(i,o,f)}function v9(i,o,f){if(o._debugNeedsRemount&&i!==null)return fae(i,o,LP(o.type,o.key,o.pendingProps,o._debugOwner||null,o.mode,o.lanes));if(i!==null){var m=i.memoizedProps,y=o.pendingProps;if(m!==y||uk()||o.type!==i.type)rl=!0;else{var C=iP(i,f);if(!C&&(o.flags&pn)===Ot)return rl=!1,hae(i,o,f);(i.flags&jo)!==Ot?rl=!0:rl=!1}}else if(rl=!1,la()&&Fre(o)){var w=o.index,P=jre();qU(o,P,w)}switch(o.lanes=Pe,o.tag){case b:return Yie(i,o,o.type,f);case se:{var D=o.elementType;return Wie(i,o,D,f)}case p:{var F=o.type,B=o.pendingProps,ae=o.elementType===F?B:nl(F,B);return ZR(i,o,F,ae,f)}case v:{var re=o.type,ge=o.pendingProps,be=o.elementType===re?ge:nl(re,ge);return s9(i,o,re,be,f)}case k:return Hie(i,o,f);case E:return $ie(i,o,f);case R:return qie(i,o);case N:return c9(i,o,f);case T:return uae(i,o,f);case j:{var we=o.type,st=o.pendingProps,Vt=o.elementType===we?st:nl(we,st);return n9(i,o,we,Vt,f)}case M:return Vie(i,o,f);case A:return zie(i,o,f);case I:return Bie(i,o,f);case V:return cae(i,o,f);case U:return dae(i,o,f);case ne:{var Pt=o.type,Ln=o.pendingProps,wn=nl(Pt,Ln);if(o.type!==o.elementType){var ce=Pt.propTypes;ce&&Qs(ce,wn,"prop",On(Pt))}return wn=nl(Pt.type,wn),r9(i,o,Pt,wn,f)}case X:return i9(i,o,o.type,o.pendingProps,f);case $:{var _e=o.type,de=o.pendingProps,qe=o.elementType===_e?de:nl(_e,de);return Gie(i,o,_e,qe,f)}case J:return p9(i,o,f);case xe:break;case ke:return a9(i,o,f)}throw new Error("Unknown unit of work tag ("+o.tag+"). This error is likely caused by a bug in React. Please file an issue.")}function ag(i){i.flags|=Tn}function y9(i){i.flags|=ni,i.flags|=jf}var b9,aP,S9,C9;b9=function(i,o,f,m){for(var y=o.child;y!==null;){if(y.tag===E||y.tag===R)Nne(i,y.stateNode);else if(y.tag!==T){if(y.child!==null){y.child.return=y,y=y.child;continue}}if(y===o)return;for(;y.sibling===null;){if(y.return===null||y.return===o)return;y=y.return}y.sibling.return=y.return,y=y.sibling}},aP=function(i,o){},S9=function(i,o,f,m,y){var C=i.memoizedProps;if(C!==m){var w=o.stateNode,P=JE(),D=Une(w,f,C,m,y,P);o.updateQueue=D,D&&ag(o)}},C9=function(i,o,f,m){f!==m&&ag(o)};function g0(i,o){if(!la())switch(i.tailMode){case"hidden":{for(var f=i.tail,m=null;f!==null;)f.alternate!==null&&(m=f),f=f.sibling;m===null?i.tail=null:m.sibling=null;break}case"collapsed":{for(var y=i.tail,C=null;y!==null;)y.alternate!==null&&(C=y),y=y.sibling;C===null?!o&&i.tail!==null?i.tail.sibling=null:i.tail=null:C.sibling=null;break}}}function ca(i){var o=i.alternate!==null&&i.alternate.child===i.child,f=Pe,m=Ot;if(o){if((i.mode&Rn)!==Mt){for(var D=i.selfBaseDuration,F=i.child;F!==null;)f=sn(f,sn(F.lanes,F.childLanes)),m|=F.subtreeFlags&ri,m|=F.flags&ri,D+=F.treeBaseDuration,F=F.sibling;i.treeBaseDuration=D}else for(var B=i.child;B!==null;)f=sn(f,sn(B.lanes,B.childLanes)),m|=B.subtreeFlags&ri,m|=B.flags&ri,B.return=i,B=B.sibling;i.subtreeFlags|=m}else{if((i.mode&Rn)!==Mt){for(var y=i.actualDuration,C=i.selfBaseDuration,w=i.child;w!==null;)f=sn(f,sn(w.lanes,w.childLanes)),m|=w.subtreeFlags,m|=w.flags,y+=w.actualDuration,C+=w.treeBaseDuration,w=w.sibling;i.actualDuration=y,i.treeBaseDuration=C}else for(var P=i.child;P!==null;)f=sn(f,sn(P.lanes,P.childLanes)),m|=P.subtreeFlags,m|=P.flags,P.return=i,P=P.sibling;i.subtreeFlags|=m}return i.childLanes=f,o}function pae(i,o,f){if(Xre()&&(o.mode&vn)!==Mt&&(o.flags&pn)===Ot)return XU(o),Ym(),o.flags|=Pr|Lu|Gi,!1;var m=gk(o);if(f!==null&&f.dehydrated!==null)if(i===null){if(!m)throw new Error("A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React.");if(Zre(o),ca(o),(o.mode&Rn)!==Mt){var y=f!==null;if(y){var C=o.child;C!==null&&(o.treeBaseDuration-=C.treeBaseDuration)}}return!1}else{if(Ym(),(o.flags&pn)===Ot&&(o.memoizedState=null),o.flags|=Tn,ca(o),(o.mode&Rn)!==Mt){var w=f!==null;if(w){var P=o.child;P!==null&&(o.treeBaseDuration-=P.treeBaseDuration)}}return!1}else return JU(),!0}function k9(i,o,f){var m=o.pendingProps;switch(AE(o),o.tag){case b:case se:case X:case p:case j:case M:case A:case I:case U:case ne:return ca(o),null;case v:{var y=o.type;return Xl(y)&&ck(o),ca(o),null}case k:{var C=o.stateNode;if(Xm(o),EE(o),iR(),C.pendingContext&&(C.context=C.pendingContext,C.pendingContext=null),i===null||i.child===null){var w=gk(o);if(w)ag(o);else if(i!==null){var P=i.memoizedState;(!P.isDehydrated||(o.flags&Pr)!==Ot)&&(o.flags|=yo,JU())}}return aP(i,o),ca(o),null}case E:{eR(o);var D=pF(),F=o.type;if(i!==null&&o.stateNode!=null)S9(i,o,F,m,D),i.ref!==o.ref&&y9(o);else{if(!m){if(o.stateNode===null)throw new Error("We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.");return ca(o),null}var B=JE(),ae=gk(o);if(ae)Yre(o,D,B)&&ag(o);else{var re=Lne(F,m,D,B,o);b9(re,o,!1,!1),o.stateNode=re,Ine(re,F,m,D)&&ag(o)}o.ref!==null&&y9(o)}return ca(o),null}case R:{var ge=m;if(i&&o.stateNode!=null){var be=i.memoizedProps;C9(i,o,be,ge)}else{if(typeof ge!="string"&&o.stateNode===null)throw new Error("We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.");var we=pF(),st=JE(),Vt=gk(o);Vt?Kre(o)&&ag(o):o.stateNode=Fne(ge,we,st,o)}return ca(o),null}case N:{eg(o);var Pt=o.memoizedState;if(i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){var Ln=pae(i,o,Pt);if(!Ln)return o.flags&Gi?o:null}if((o.flags&pn)!==Ot)return o.lanes=f,(o.mode&Rn)!==Mt&&PR(o),o;var wn=Pt!==null,ce=i!==null&&i.memoizedState!==null;if(wn!==ce&&wn){var _e=o.child;if(_e.flags|=ls,(o.mode&vn)!==Mt){var de=i===null&&(o.memoizedProps.unstable_avoidThisFallback!==!0||!0);de||tR(el.current,vF)?moe():TP()}}var qe=o.updateQueue;if(qe!==null&&(o.flags|=Tn),ca(o),(o.mode&Rn)!==Mt&&wn){var yt=o.child;yt!==null&&(o.treeBaseDuration-=yt.treeBaseDuration)}return null}case T:return Xm(o),aP(i,o),i===null&&Are(o.stateNode.containerInfo),ca(o),null;case V:var ft=o.type._context;return qE(ft,o),ca(o),null;case $:{var Wt=o.type;return Xl(Wt)&&ck(o),ca(o),null}case J:{eg(o);var nn=o.memoizedState;if(nn===null)return ca(o),null;var fr=(o.flags&pn)!==Ot,Bn=nn.rendering;if(Bn===null)if(fr)g0(nn,!1);else{var mi=voe()&&(i===null||(i.flags&pn)===Ot);if(!mi)for(var Hn=o.child;Hn!==null;){var oi=Ok(Hn);if(oi!==null){fr=!0,o.flags|=pn,g0(nn,!1);var Ua=oi.updateQueue;return Ua!==null&&(o.updateQueue=Ua,o.flags|=Tn),o.subtreeFlags=Ot,aie(o,f),Ud(o,nR(el.current,r0)),o.child}Hn=Hn.sibling}nn.tail!==null&&Gr()>H9()&&(o.flags|=pn,fr=!0,g0(nn,!1),o.lanes=pC)}else{if(!fr){var ma=Ok(Bn);if(ma!==null){o.flags|=pn,fr=!0;var Wo=ma.updateQueue;if(Wo!==null&&(o.updateQueue=Wo,o.flags|=Tn),g0(nn,!0),nn.tail===null&&nn.tailMode==="hidden"&&!Bn.alternate&&!la())return ca(o),null}else Gr()*2-nn.renderingStartTime>H9()&&f!==Pa&&(o.flags|=pn,fr=!0,g0(nn,!1),o.lanes=pC)}if(nn.isBackwards)Bn.sibling=o.child,o.child=Bn;else{var Qa=nn.last;Qa!==null?Qa.sibling=Bn:o.child=Bn,nn.last=Bn}}if(nn.tail!==null){var Xa=nn.tail;nn.rendering=Xa,nn.tail=Xa.sibling,nn.renderingStartTime=Gr(),Xa.sibling=null;var Fa=el.current;return fr?Fa=nR(Fa,r0):Fa=Jm(Fa),Ud(o,Fa),Xa}return ca(o),null}case xe:break;case ke:case Ge:{kP(o);var dc=o.memoizedState,hg=dc!==null;if(i!==null){var O0=i.memoizedState,ou=O0!==null;ou!==hg&&!ee&&(o.flags|=ls)}return!hg||(o.mode&vn)===Mt?ca(o):Aa(au,Pa)&&(ca(o),o.subtreeFlags&(jr|Tn)&&(o.flags|=ls)),null}case Je:return null;case je:return null}throw new Error("Unknown unit of work tag ("+o.tag+"). This error is likely caused by a bug in React. Please file an issue.")}function mae(i,o,f){switch(AE(o),o.tag){case v:{var m=o.type;Xl(m)&&ck(o);var y=o.flags;return y&Gi?(o.flags=y&~Gi|pn,(o.mode&Rn)!==Mt&&PR(o),o):null}case k:{o.stateNode,Xm(o),EE(o),iR();var C=o.flags;return(C&Gi)!==Ot&&(C&pn)===Ot?(o.flags=C&~Gi|pn,o):null}case E:return eR(o),null;case N:{eg(o);var w=o.memoizedState;if(w!==null&&w.dehydrated!==null){if(o.alternate===null)throw new Error("Threw in newly mounted dehydrated component. This is likely a bug in React. Please file an issue.");Ym()}var P=o.flags;return P&Gi?(o.flags=P&~Gi|pn,(o.mode&Rn)!==Mt&&PR(o),o):null}case J:return eg(o),null;case T:return Xm(o),null;case V:var D=o.type._context;return qE(D,o),null;case ke:case Ge:return kP(o),null;case Je:return null;default:return null}}function T9(i,o,f){switch(AE(o),o.tag){case v:{var m=o.type.childContextTypes;m!=null&&ck(o);break}case k:{o.stateNode,Xm(o),EE(o),iR();break}case E:{eR(o);break}case T:Xm(o);break;case N:eg(o);break;case J:eg(o);break;case V:var y=o.type._context;qE(y,o);break;case ke:case Ge:kP(o);break}}var x9=null;x9=new Set;var n1=!1,da=!1,gae=typeof WeakSet=="function"?WeakSet:Set,_t=null,og=null,sg=null;function vae(i){vo(null,function(){throw i}),Gv()}var yae=function(i,o){if(o.props=i.memoizedProps,o.state=i.memoizedState,i.mode&Rn)try{ru(),o.componentWillUnmount()}finally{nu(i)}else o.componentWillUnmount()};function w9(i,o){try{Vd(Li,i)}catch(f){Tr(i,o,f)}}function oP(i,o,f){try{yae(i,f)}catch(m){Tr(i,o,m)}}function bae(i,o,f){try{f.componentDidMount()}catch(m){Tr(i,o,m)}}function _9(i,o){try{R9(i)}catch(f){Tr(i,o,f)}}function lg(i,o){var f=i.ref;if(f!==null)if(typeof f=="function"){var m;try{if(Rt&&ht&&i.mode&Rn)try{ru(),m=f(null)}finally{nu(i)}else m=f(null)}catch(y){Tr(i,o,y)}typeof m=="function"&&c("Unexpected return value from a callback ref in %s. A callback ref should not return a function.",Zt(i))}else f.current=null}function r1(i,o,f){try{f()}catch(m){Tr(i,o,m)}}var E9=!1;function Sae(i,o){One(i.containerInfo),_t=o,Cae();var f=E9;return E9=!1,f}function Cae(){for(;_t!==null;){var i=_t,o=i.child;(i.subtreeFlags&Ll)!==Ot&&o!==null?(o.return=i,_t=o):kae()}}function kae(){for(;_t!==null;){var i=_t;sr(i);try{Tae(i)}catch(f){Tr(i,i.return,f)}Fr();var o=i.sibling;if(o!==null){o.return=i.return,_t=o;return}_t=i.return}}function Tae(i){var o=i.alternate,f=i.flags;if((f&yo)!==Ot){switch(sr(i),i.tag){case p:case j:case X:break;case v:{if(o!==null){var m=o.memoizedProps,y=o.memoizedState,C=i.stateNode;i.type===i.elementType&&!Eh&&(C.props!==i.memoizedProps&&c("Expected %s props to match memoized props before getSnapshotBeforeUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.",Zt(i)||"instance"),C.state!==i.memoizedState&&c("Expected %s state to match memoized state before getSnapshotBeforeUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.",Zt(i)||"instance"));var w=C.getSnapshotBeforeUpdate(i.elementType===i.type?m:nl(i.type,m),y);{var P=x9;w===void 0&&!P.has(i.type)&&(P.add(i.type),c("%s.getSnapshotBeforeUpdate(): A snapshot value (or null) must be returned. You have returned undefined.",Zt(i)))}C.__reactInternalSnapshotBeforeUpdate=w}break}case k:{{var D=i.stateNode;rre(D.containerInfo)}break}case E:case R:case T:case $:break;default:throw new Error("This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.")}Fr()}}function il(i,o,f){var m=o.updateQueue,y=m!==null?m.lastEffect:null;if(y!==null){var C=y.next,w=C;do{if((w.tag&i)===i){var P=w.destroy;w.destroy=void 0,P!==void 0&&((i&ua)!==_o?Fl(o):(i&Li)!==_o&&ay(o),(i&Jl)!==_o&&P0(!0),r1(o,f,P),(i&Jl)!==_o&&P0(!1),(i&ua)!==_o?Wp():(i&Li)!==_o&&fd())}w=w.next}while(w!==C)}}function Vd(i,o){var f=o.updateQueue,m=f!==null?f.lastEffect:null;if(m!==null){var y=m.next,C=y;do{if((C.tag&i)===i){(i&ua)!==_o?fC(o):(i&Li)!==_o&&hC(o);var w=C.create;(i&Jl)!==_o&&P0(!0),C.destroy=w(),(i&Jl)!==_o&&P0(!1),(i&ua)!==_o?Ys():(i&Li)!==_o&&Gp();{var P=C.destroy;if(P!==void 0&&typeof P!="function"){var D=void 0;(C.tag&Li)!==Ot?D="useLayoutEffect":(C.tag&Jl)!==Ot?D="useInsertionEffect":D="useEffect";var F=void 0;P===null?F=" You returned null. If your effect does not require clean up, return undefined (or nothing).":typeof P.then=="function"?F=`
|
|
199
199
|
|
|
200
200
|
It looks like you wrote `+D+`(async () => ...) or returned a Promise. Instead, write the async function inside your effect and call it immediately:
|
|
201
201
|
|
|
@@ -208,11 +208,11 @@ It looks like you wrote `+D+`(async () => ...) or returned a Promise. Instead, w
|
|
|
208
208
|
fetchData();
|
|
209
209
|
}, [someId]); // Or [] if effect doesn't need props or state
|
|
210
210
|
|
|
211
|
-
Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching`:F=" You returned: "+P,c("%s must not return anything besides a function, which is used for clean-up.%s",D,F)}}}C=C.next}while(C!==y)}}function Tae(i,o){if((o.flags&Tn)!==Ot)switch(o.tag){case I:{var f=o.stateNode.passiveEffectDuration,m=o.memoizedProps,y=m.id,C=m.onPostCommit,w=HF(),P=o.alternate===null?"mount":"update";BF()&&(P="nested-update"),typeof C=="function"&&C(y,P,f,w);var D=o.return;e:for(;D!==null;){switch(D.tag){case k:var F=D.stateNode;F.passiveEffectDuration+=f;break e;case I:var B=D.stateNode;B.passiveEffectDuration+=f;break e}D=D.return}break}}}function xae(i,o,f,m){if((f.flags&Nl)!==Ot)switch(f.tag){case p:case j:case X:{if(!da)if(f.mode&Rn)try{ru(),Vd(Li|Mi,f)}finally{nu(f)}else Vd(Li|Mi,f);break}case v:{var y=f.stateNode;if(f.flags&Tn&&!da)if(o===null)if(f.type===f.elementType&&!Eh&&(y.props!==f.memoizedProps&&c("Expected %s props to match memoized props before componentDidMount. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.",Zt(f)||"instance"),y.state!==f.memoizedState&&c("Expected %s state to match memoized state before componentDidMount. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.",Zt(f)||"instance")),f.mode&Rn)try{ru(),y.componentDidMount()}finally{nu(f)}else y.componentDidMount();else{var C=f.elementType===f.type?o.memoizedProps:nl(f.type,o.memoizedProps),w=o.memoizedState;if(f.type===f.elementType&&!Eh&&(y.props!==f.memoizedProps&&c("Expected %s props to match memoized props before componentDidUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.",Zt(f)||"instance"),y.state!==f.memoizedState&&c("Expected %s state to match memoized state before componentDidUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.",Zt(f)||"instance")),f.mode&Rn)try{ru(),y.componentDidUpdate(C,w,y.__reactInternalSnapshotBeforeUpdate)}finally{nu(f)}else y.componentDidUpdate(C,w,y.__reactInternalSnapshotBeforeUpdate)}var P=f.updateQueue;P!==null&&(f.type===f.elementType&&!Eh&&(y.props!==f.memoizedProps&&c("Expected %s props to match memoized props before processing the update queue. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.",Zt(f)||"instance"),y.state!==f.memoizedState&&c("Expected %s state to match memoized state before processing the update queue. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.",Zt(f)||"instance")),hF(f,P,y));break}case k:{var D=f.updateQueue;if(D!==null){var F=null;if(f.child!==null)switch(f.child.tag){case E:F=f.child.stateNode;break;case v:F=f.child.stateNode;break}hF(f,D,F)}break}case E:{var B=f.stateNode;if(o===null&&f.flags&Tn){var ae=f.type,re=f.memoizedProps;Bne(B,ae,re)}break}case R:break;case T:break;case I:{{var ge=f.memoizedProps,be=ge.onCommit,we=ge.onRender,st=f.stateNode.effectDuration,Vt=HF(),Pt=o===null?"mount":"update";BF()&&(Pt="nested-update"),typeof we=="function"&&we(f.memoizedProps.id,Pt,f.actualDuration,f.treeBaseDuration,f.actualStartTime,Vt);{typeof be=="function"&&be(f.memoizedProps.id,Pt,st,Vt),Coe(f);var Ln=f.return;e:for(;Ln!==null;){switch(Ln.tag){case k:var wn=Ln.stateNode;wn.effectDuration+=st;break e;case I:var ce=Ln.stateNode;ce.effectDuration+=st;break e}Ln=Ln.return}}}break}case N:{Oae(i,f);break}case J:case $:case xe:case ke:case Ge:case je:break;default:throw new Error("This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.")}da||f.flags&ni&&R9(f)}function wae(i){switch(i.tag){case p:case j:case X:{if(i.mode&Rn)try{ru(),w9(i,i.return)}finally{nu(i)}else w9(i,i.return);break}case v:{var o=i.stateNode;typeof o.componentDidMount=="function"&&yae(i,i.return,o),_9(i,i.return);break}case E:{_9(i,i.return);break}}}function _ae(i,o){for(var f=null,m=i;;){if(m.tag===E){if(f===null){f=m;try{var y=m.stateNode;o?Xne(y):ere(m.stateNode,m.memoizedProps)}catch(w){Tr(i,i.return,w)}}}else if(m.tag===R){if(f===null)try{var C=m.stateNode;o?Jne(C):tre(C,m.memoizedProps)}catch(w){Tr(i,i.return,w)}}else if(!((m.tag===ke||m.tag===Ge)&&m.memoizedState!==null&&m!==i)){if(m.child!==null){m.child.return=m,m=m.child;continue}}if(m===i)return;for(;m.sibling===null;){if(m.return===null||m.return===i)return;f===m&&(f=null),m=m.return}f===m&&(f=null),m.sibling.return=m.return,m=m.sibling}}function R9(i){var o=i.ref;if(o!==null){var f=i.stateNode,m;switch(i.tag){case E:m=f;break;default:m=f}if(typeof o=="function"){var y;if(i.mode&Rn)try{ru(),y=o(m)}finally{nu(i)}else y=o(m);typeof y=="function"&&c("Unexpected return value from a callback ref in %s. A callback ref should not return a function.",Zt(i))}else o.hasOwnProperty("current")||c("Unexpected ref object provided for %s. Use either a ref-setter function or React.createRef().",Zt(i)),o.current=m}}function Eae(i){var o=i.alternate;o!==null&&(o.return=null),i.return=null}function P9(i){var o=i.alternate;o!==null&&(i.alternate=null,P9(o));{if(i.child=null,i.deletions=null,i.sibling=null,i.tag===E){var f=i.stateNode;f!==null&&Mre(f)}i.stateNode=null,i._debugOwner=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}}function Rae(i){for(var o=i.return;o!==null;){if(D9(o))return o;o=o.return}throw new Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.")}function D9(i){return i.tag===E||i.tag===k||i.tag===T}function A9(i){var o=i;e:for(;;){for(;o.sibling===null;){if(o.return===null||D9(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==E&&o.tag!==R&&o.tag!==oe;){if(o.flags&jr||o.child===null||o.tag===T)continue e;o.child.return=o,o=o.child}if(!(o.flags&jr))return o.stateNode}}function Pae(i){var o=Rae(i);switch(o.tag){case E:{var f=o.stateNode;o.flags&tr&&(MU(f),o.flags&=~tr);var m=A9(i);lP(i,m,f);break}case k:case T:{var y=o.stateNode.containerInfo,C=A9(i);sP(i,C,y);break}default:throw new Error("Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue.")}}function sP(i,o,f){var m=i.tag,y=m===E||m===R;if(y){var C=i.stateNode;o?Yne(f,C,o):Wne(f,C)}else if(m!==T){var w=i.child;if(w!==null){sP(w,o,f);for(var P=w.sibling;P!==null;)sP(P,o,f),P=P.sibling}}}function lP(i,o,f){var m=i.tag,y=m===E||m===R;if(y){var C=i.stateNode;o?Gne(f,C,o):qne(f,C)}else if(m!==T){var w=i.child;if(w!==null){lP(w,o,f);for(var P=w.sibling;P!==null;)lP(P,o,f),P=P.sibling}}}var fa=null,al=!1;function Dae(i,o,f){{var m=o;e:for(;m!==null;){switch(m.tag){case E:{fa=m.stateNode,al=!1;break e}case k:{fa=m.stateNode.containerInfo,al=!0;break e}case T:{fa=m.stateNode.containerInfo,al=!0;break e}}m=m.return}if(fa===null)throw new Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.");O9(i,o,f),fa=null,al=!1}Eae(f)}function zd(i,o,f){for(var m=f.child;m!==null;)O9(i,o,m),m=m.sibling}function O9(i,o,f){switch(dd(f),f.tag){case E:da||lg(f,o);case R:{{var m=fa,y=al;fa=null,zd(i,o,f),fa=m,al=y,fa!==null&&(al?Zne(fa,f.stateNode):Kne(fa,f.stateNode))}return}case oe:{fa!==null&&(al?Qne(fa,f.stateNode):bE(fa,f.stateNode));return}case T:{{var C=fa,w=al;fa=f.stateNode.containerInfo,al=!0,zd(i,o,f),fa=C,al=w}return}case p:case j:case ne:case X:{if(!da){var P=f.updateQueue;if(P!==null){var D=P.lastEffect;if(D!==null){var F=D.next,B=F;do{var ae=B,re=ae.destroy,ge=ae.tag;re!==void 0&&((ge&Jl)!==_o?r1(f,o,re):(ge&Li)!==_o&&(ay(f),f.mode&Rn?(ru(),r1(f,o,re),nu(f)):r1(f,o,re),fd())),B=B.next}while(B!==F)}}}zd(i,o,f);return}case v:{if(!da){lg(f,o);var be=f.stateNode;typeof be.componentWillUnmount=="function"&&oP(f,o,be)}zd(i,o,f);return}case xe:{zd(i,o,f);return}case ke:{if(f.mode&vn){var we=da;da=we||f.memoizedState!==null,zd(i,o,f),da=we}else zd(i,o,f);break}default:{zd(i,o,f);return}}}function Aae(i){i.memoizedState}function Oae(i,o){var f=o.memoizedState;if(f===null){var m=o.alternate;if(m!==null){var y=m.memoizedState;if(y!==null){var C=y.dehydrated;C!==null&&gre(C)}}}}function M9(i){var o=i.updateQueue;if(o!==null){i.updateQueue=null;var f=i.stateNode;f===null&&(f=i.stateNode=new mae),o.forEach(function(m){var y=Roe.bind(null,i,m);if(!f.has(m)){if(f.add(m),Yi)if(og!==null&&sg!==null)R0(sg,og);else throw Error("Expected finished root and lanes to be set. This is a bug in React.");m.then(y,y)}})}}function Mae(i,o,f){og=f,sg=i,sr(o),L9(o,i),sr(o),og=null,sg=null}function ol(i,o,f){var m=o.deletions;if(m!==null)for(var y=0;y<m.length;y++){var C=m[y];try{Dae(i,o,C)}catch(D){Tr(C,o,D)}}var w=No();if(o.subtreeFlags&ud)for(var P=o.child;P!==null;)sr(P),L9(P,i),P=P.sibling;sr(w)}function L9(i,o,f){var m=i.alternate,y=i.flags;switch(i.tag){case p:case j:case ne:case X:{if(ol(o,i),iu(i),y&Tn){try{il(Jl|Mi,i,i.return),Vd(Jl|Mi,i)}catch(Wt){Tr(i,i.return,Wt)}if(i.mode&Rn){try{ru(),il(Li|Mi,i,i.return)}catch(Wt){Tr(i,i.return,Wt)}nu(i)}else try{il(Li|Mi,i,i.return)}catch(Wt){Tr(i,i.return,Wt)}}return}case v:{ol(o,i),iu(i),y&ni&&m!==null&&lg(m,m.return);return}case E:{ol(o,i),iu(i),y&ni&&m!==null&&lg(m,m.return);{if(i.flags&tr){var C=i.stateNode;try{MU(C)}catch(Wt){Tr(i,i.return,Wt)}}if(y&Tn){var w=i.stateNode;if(w!=null){var P=i.memoizedProps,D=m!==null?m.memoizedProps:P,F=i.type,B=i.updateQueue;if(i.updateQueue=null,B!==null)try{Hne(w,B,F,D,P,i)}catch(Wt){Tr(i,i.return,Wt)}}}}return}case R:{if(ol(o,i),iu(i),y&Tn){if(i.stateNode===null)throw new Error("This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue.");var ae=i.stateNode,re=i.memoizedProps,ge=m!==null?m.memoizedProps:re;try{$ne(ae,ge,re)}catch(Wt){Tr(i,i.return,Wt)}}return}case k:{if(ol(o,i),iu(i),y&Tn&&m!==null){var be=m.memoizedState;if(be.isDehydrated)try{mre(o.containerInfo)}catch(Wt){Tr(i,i.return,Wt)}}return}case T:{ol(o,i),iu(i);return}case N:{ol(o,i),iu(i);var we=i.child;if(we.flags&ls){var st=we.stateNode,Vt=we.memoizedState,Pt=Vt!==null;if(st.isHidden=Pt,Pt){var Ln=we.alternate!==null&&we.alternate.memoizedState!==null;Ln||hoe()}}if(y&Tn){try{Aae(i)}catch(Wt){Tr(i,i.return,Wt)}M9(i)}return}case ke:{var wn=m!==null&&m.memoizedState!==null;if(i.mode&vn){var ce=da;da=ce||wn,ol(o,i),da=ce}else ol(o,i);if(iu(i),y&ls){var _e=i.stateNode,de=i.memoizedState,qe=de!==null,yt=i;if(_e.isHidden=qe,qe&&!wn&&(yt.mode&vn)!==Mt){_t=yt;for(var ft=yt.child;ft!==null;)_t=ft,Nae(ft),ft=ft.sibling}_ae(yt,qe)}return}case J:{ol(o,i),iu(i),y&Tn&&M9(i);return}case xe:return;default:{ol(o,i),iu(i);return}}}function iu(i){var o=i.flags;if(o&jr){try{Pae(i)}catch(f){Tr(i,i.return,f)}i.flags&=~jr}o&Vr&&(i.flags&=~Vr)}function Lae(i,o,f){og=f,sg=o,_t=i,N9(i,o,f),og=null,sg=null}function N9(i,o,f){for(var m=(i.mode&vn)!==Mt;_t!==null;){var y=_t,C=y.child;if(y.tag===ke&&m){var w=y.memoizedState!==null,P=w||n1;if(P){uP(i,o,f);continue}else{var D=y.alternate,F=D!==null&&D.memoizedState!==null,B=F||da,ae=n1,re=da;n1=P,da=B,da&&!re&&(_t=y,Iae(y));for(var ge=C;ge!==null;)_t=ge,N9(ge,o,f),ge=ge.sibling;_t=y,n1=ae,da=re,uP(i,o,f);continue}}(y.subtreeFlags&Nl)!==Ot&&C!==null?(C.return=y,_t=C):uP(i,o,f)}}function uP(i,o,f){for(;_t!==null;){var m=_t;if((m.flags&Nl)!==Ot){var y=m.alternate;sr(m);try{xae(o,y,m,f)}catch(w){Tr(m,m.return,w)}Fr()}if(m===i){_t=null;return}var C=m.sibling;if(C!==null){C.return=m.return,_t=C;return}_t=m.return}}function Nae(i){for(;_t!==null;){var o=_t,f=o.child;switch(o.tag){case p:case j:case ne:case X:{if(o.mode&Rn)try{ru(),il(Li,o,o.return)}finally{nu(o)}else il(Li,o,o.return);break}case v:{lg(o,o.return);var m=o.stateNode;typeof m.componentWillUnmount=="function"&&oP(o,o.return,m);break}case E:{lg(o,o.return);break}case ke:{var y=o.memoizedState!==null;if(y){I9(i);continue}break}}f!==null?(f.return=o,_t=f):I9(i)}}function I9(i){for(;_t!==null;){var o=_t;if(o===i){_t=null;return}var f=o.sibling;if(f!==null){f.return=o.return,_t=f;return}_t=o.return}}function Iae(i){for(;_t!==null;){var o=_t,f=o.child;if(o.tag===ke){var m=o.memoizedState!==null;if(m){U9(i);continue}}f!==null?(f.return=o,_t=f):U9(i)}}function U9(i){for(;_t!==null;){var o=_t;sr(o);try{wae(o)}catch(m){Tr(o,o.return,m)}if(Fr(),o===i){_t=null;return}var f=o.sibling;if(f!==null){f.return=o.return,_t=f;return}_t=o.return}}function Uae(i,o,f,m){_t=o,Fae(o,i,f,m)}function Fae(i,o,f,m){for(;_t!==null;){var y=_t,C=y.child;(y.subtreeFlags&Ri)!==Ot&&C!==null?(C.return=y,_t=C):jae(i,o,f,m)}}function jae(i,o,f,m){for(;_t!==null;){var y=_t;if((y.flags&Ba)!==Ot){sr(y);try{Vae(o,y,f,m)}catch(w){Tr(y,y.return,w)}Fr()}if(y===i){_t=null;return}var C=y.sibling;if(C!==null){C.return=y.return,_t=C;return}_t=y.return}}function Vae(i,o,f,m){switch(o.tag){case p:case j:case X:{if(o.mode&Rn){RR();try{Vd(ua|Mi,o)}finally{ER(o)}}else Vd(ua|Mi,o);break}}}function zae(i){_t=i,Bae()}function Bae(){for(;_t!==null;){var i=_t,o=i.child;if((_t.flags&wa)!==Ot){var f=i.deletions;if(f!==null){for(var m=0;m<f.length;m++){var y=f[m];_t=y,qae(y,i)}{var C=i.alternate;if(C!==null){var w=C.child;if(w!==null){C.child=null;do{var P=w.sibling;w.sibling=null,w=P}while(w!==null)}}}_t=i}}(i.subtreeFlags&Ri)!==Ot&&o!==null?(o.return=i,_t=o):Hae()}}function Hae(){for(;_t!==null;){var i=_t;(i.flags&Ba)!==Ot&&(sr(i),$ae(i),Fr());var o=i.sibling;if(o!==null){o.return=i.return,_t=o;return}_t=i.return}}function $ae(i){switch(i.tag){case p:case j:case X:{i.mode&Rn?(RR(),il(ua|Mi,i,i.return),ER(i)):il(ua|Mi,i,i.return);break}}}function qae(i,o){for(;_t!==null;){var f=_t;sr(f),Gae(f,o),Fr();var m=f.child;m!==null?(m.return=f,_t=m):Wae(i)}}function Wae(i){for(;_t!==null;){var o=_t,f=o.sibling,m=o.return;if(P9(o),o===i){_t=null;return}if(f!==null){f.return=m,_t=f;return}_t=m}}function Gae(i,o){switch(i.tag){case p:case j:case X:{i.mode&Rn?(RR(),il(ua,i,o),ER(i)):il(ua,i,o);break}}}function Yae(i){switch(i.tag){case p:case j:case X:{try{Vd(Li|Mi,i)}catch(f){Tr(i,i.return,f)}break}case v:{var o=i.stateNode;try{o.componentDidMount()}catch(f){Tr(i,i.return,f)}break}}}function Kae(i){switch(i.tag){case p:case j:case X:{try{Vd(ua|Mi,i)}catch(o){Tr(i,i.return,o)}break}}}function Zae(i){switch(i.tag){case p:case j:case X:{try{il(Li|Mi,i,i.return)}catch(f){Tr(i,i.return,f)}break}case v:{var o=i.stateNode;typeof o.componentWillUnmount=="function"&&oP(i,i.return,o);break}}}function Qae(i){switch(i.tag){case p:case j:case X:try{il(ua|Mi,i,i.return)}catch(o){Tr(i,i.return,o)}}}if(typeof Symbol=="function"&&Symbol.for){var v0=Symbol.for;v0("selector.component"),v0("selector.has_pseudo_class"),v0("selector.role"),v0("selector.test_id"),v0("selector.text")}var Xae=[];function Jae(){Xae.forEach(function(i){return i()})}var eoe=r.ReactCurrentActQueue;function toe(i){{var o=typeof IS_REACT_ACT_ENVIRONMENT<"u"?IS_REACT_ACT_ENVIRONMENT:void 0,f=typeof jest<"u";return f&&o!==!1}}function F9(){{var i=typeof IS_REACT_ACT_ENVIRONMENT<"u"?IS_REACT_ACT_ENVIRONMENT:void 0;return!i&&eoe.current!==null&&c("The current testing environment is not configured to support act(...)"),i}}var noe=Math.ceil,cP=r.ReactCurrentDispatcher,dP=r.ReactCurrentOwner,ha=r.ReactCurrentBatchConfig,sl=r.ReactCurrentActQueue,Ui=0,j9=1,pa=2,bs=4,sc=0,y0=1,Rh=2,i1=3,b0=4,V9=5,fP=6,Mn=Ui,Ka=null,Qr=null,Fi=Pe,au=Pe,hP=Ad(Pe),ji=sc,S0=null,a1=Pe,C0=Pe,o1=Pe,k0=null,Eo=null,pP=0,z9=500,B9=1/0,roe=500,lc=null;function T0(){B9=Gr()+roe}function H9(){return B9}var s1=!1,mP=null,ug=null,Ph=!1,Bd=null,x0=Pe,gP=[],vP=null,ioe=50,w0=0,yP=null,bP=!1,l1=!1,aoe=50,cg=0,u1=null,_0=rr,c1=Pe,$9=!1;function d1(){return Ka}function Za(){return(Mn&(pa|bs))!==Ui?Gr():(_0!==rr||(_0=Gr()),_0)}function Hd(i){var o=i.mode;if((o&vn)===Mt)return $t;if((Mn&pa)!==Ui&&Fi!==Pe)return Ci(Fi);var f=eie()!==Jre;if(f){if(ha.transition!==null){var m=ha.transition;m._updatedFibers||(m._updatedFibers=new Set),m._updatedFibers.add(i)}return c1===ii&&(c1=my()),c1}var y=$a();if(y!==ii)return y;var C=Fne();return C}function ooe(i){var o=i.mode;return(o&vn)===Mt?$t:SC()}function Vi(i,o,f,m){Doe(),$9&&c("useInsertionEffect must not schedule updates."),bP&&(l1=!0),yd(i,f,m),(Mn&pa)!==Pe&&i===Ka?Moe(o):(Yi&&kC(i,o,f),Loe(o),i===Ka&&((Mn&pa)===Ui&&(C0=sn(C0,f)),ji===b0&&$d(i,Fi)),Ro(i,m),f===$t&&Mn===Ui&&(o.mode&vn)===Mt&&!sl.isBatchingLegacy&&(T0(),$U()))}function soe(i,o,f){var m=i.current;m.lanes=o,yd(i,o,f),Ro(i,f)}function loe(i){return(Mn&pa)!==Ui}function Ro(i,o){var f=i.callbackNode;vC(i,o);var m=Da(i,i===Ka?Fi:Pe);if(m===Pe){f!==null&&oj(f),i.callbackNode=null,i.callbackPriority=ii;return}var y=Bu(m),C=i.callbackPriority;if(C===y&&!(sl.current!==null&&f!==_P)){f==null&&C!==$t&&c("Expected scheduled callback to exist. This error is likely caused by a bug in React. Please file an issue.");return}f!=null&&oj(f);var w;if(y===$t)i.tag===Od?(sl.isBatchingLegacy!==null&&(sl.didScheduleLegacyUpdate=!0),Ire(G9.bind(null,i))):HU(G9.bind(null,i)),sl.current!==null?sl.current.push(Md):Vne(function(){(Mn&(pa|bs))===Ui&&Md()}),w=null;else{var P;switch(xC(m)){case Oa:P=Gs;break;case So:P=Vf;break;case Di:P=Iu;break;case Cm:P=cd;break;default:P=Iu;break}w=EP(P,q9.bind(null,i))}i.callbackPriority=y,i.callbackNode=w}function q9(i,o){if(_ie(),_0=rr,c1=Pe,(Mn&(pa|bs))!==Ui)throw new Error("Should not already be working.");var f=i.callbackNode,m=cc();if(m&&i.callbackNode!==f)return null;var y=Da(i,i===Ka?Fi:Pe);if(y===Pe)return null;var C=!Xf(i,y)&&!bC(i,y)&&!o,w=C?yoe(i,y):h1(i,y);if(w!==sc){if(w===Rh){var P=hm(i);P!==Pe&&(y=P,w=SP(i,P))}if(w===y0){var D=S0;throw Dh(i,Pe),$d(i,y),Ro(i,Gr()),D}if(w===fP)$d(i,y);else{var F=!Xf(i,y),B=i.current.alternate;if(F&&!coe(B)){if(w=h1(i,y),w===Rh){var ae=hm(i);ae!==Pe&&(y=ae,w=SP(i,ae))}if(w===y0){var re=S0;throw Dh(i,Pe),$d(i,y),Ro(i,Gr()),re}}i.finishedWork=B,i.finishedLanes=y,uoe(i,w,y)}}return Ro(i,Gr()),i.callbackNode===f?q9.bind(null,i):null}function SP(i,o){var f=k0;if($u(i)){var m=Dh(i,o);m.flags|=Pr,Pre(i.containerInfo)}var y=h1(i,o);if(y!==Rh){var C=Eo;Eo=f,C!==null&&W9(C)}return y}function W9(i){Eo===null?Eo=i:Eo.push.apply(Eo,i)}function uoe(i,o,f){switch(o){case sc:case y0:throw new Error("Root did not complete. This is a bug in React.");case Rh:{Ah(i,Eo,lc);break}case i1:{if($d(i,f),pm(f)&&!sj()){var m=pP+z9-Gr();if(m>10){var y=Da(i,Pe);if(y!==Pe)break;var C=i.suspendedLanes;if(!Hu(C,f)){Za(),ym(i,C);break}i.timeoutHandle=vE(Ah.bind(null,i,Eo,lc),m);break}}Ah(i,Eo,lc);break}case b0:{if($d(i,f),B_(f))break;if(!sj()){var w=dy(i,f),P=w,D=Gr()-P,F=Poe(D)-D;if(F>10){i.timeoutHandle=vE(Ah.bind(null,i,Eo,lc),F);break}}Ah(i,Eo,lc);break}case V9:{Ah(i,Eo,lc);break}default:throw new Error("Unknown root exit status.")}}function coe(i){for(var o=i;;){if(o.flags&$p){var f=o.updateQueue;if(f!==null){var m=f.stores;if(m!==null)for(var y=0;y<m.length;y++){var C=m[y],w=C.getSnapshot,P=C.value;try{if(!dt(w(),P))return!1}catch{return!1}}}}var D=o.child;if(o.subtreeFlags&$p&&D!==null){D.return=o,o=D;continue}if(o===i)return!0;for(;o.sibling===null;){if(o.return===null||o.return===i)return!0;o=o.return}o.sibling.return=o.return,o=o.sibling}return!0}function $d(i,o){o=Jf(o,o1),o=Jf(o,C0),vy(i,o)}function G9(i){if(Eie(),(Mn&(pa|bs))!==Ui)throw new Error("Should not already be working.");cc();var o=Da(i,Pe);if(!Aa(o,$t))return Ro(i,Gr()),null;var f=h1(i,o);if(i.tag!==Od&&f===Rh){var m=hm(i);m!==Pe&&(o=m,f=SP(i,m))}if(f===y0){var y=S0;throw Dh(i,Pe),$d(i,o),Ro(i,Gr()),y}if(f===fP)throw new Error("Root did not complete. This is a bug in React.");var C=i.current.alternate;return i.finishedWork=C,i.finishedLanes=o,Ah(i,Eo,lc),Ro(i,Gr()),null}function doe(i,o){o!==Pe&&(eh(i,sn(o,$t)),Ro(i,Gr()),(Mn&(pa|bs))===Ui&&(T0(),Md()))}function CP(i,o){var f=Mn;Mn|=j9;try{return i(o)}finally{Mn=f,Mn===Ui&&!sl.isBatchingLegacy&&(T0(),$U())}}function foe(i,o,f,m,y){var C=$a(),w=ha.transition;try{return ha.transition=null,fi(Oa),i(o,f,m,y)}finally{fi(C),ha.transition=w,Mn===Ui&&T0()}}function uc(i){Bd!==null&&Bd.tag===Od&&(Mn&(pa|bs))===Ui&&cc();var o=Mn;Mn|=j9;var f=ha.transition,m=$a();try{return ha.transition=null,fi(Oa),i?i():void 0}finally{fi(m),ha.transition=f,Mn=o,(Mn&(pa|bs))===Ui&&Md()}}function Y9(){return(Mn&(pa|bs))!==Ui}function f1(i,o){Na(hP,au,i),au=sn(au,o)}function kP(i){au=hP.current,La(hP,i)}function Dh(i,o){i.finishedWork=null,i.finishedLanes=Pe;var f=i.timeoutHandle;if(f!==yE&&(i.timeoutHandle=yE,jne(f)),Qr!==null)for(var m=Qr.return;m!==null;){var y=m.alternate;T9(y,m),m=m.return}Ka=i;var C=Oh(i.current,null);return Qr=C,Fi=au=o,ji=sc,S0=null,a1=Pe,C0=Pe,o1=Pe,k0=null,Eo=null,sie(),Js.discardPendingWarnings(),C}function K9(i,o){do{var f=Qr;try{if(kk(),bF(),Fr(),dP.current=null,f===null||f.return===null){ji=y0,S0=o,Qr=null;return}if(Rt&&f.mode&Rn&&Qk(f,!0),Ct)if(Ul(),o!==null&&typeof o=="object"&&typeof o.then=="function"){var m=o;Bf(f,m,Fi)}else ds(f,o,Fi);Iie(i,f.return,f,o,Fi),J9(f)}catch(y){o=y,Qr===f&&f!==null?(f=f.return,Qr=f):f=Qr;continue}return}while(!0)}function Z9(){var i=cP.current;return cP.current=Wk,i===null?Wk:i}function Q9(i){cP.current=i}function hoe(){pP=Gr()}function E0(i){a1=sn(i,a1)}function poe(){ji===sc&&(ji=i1)}function TP(){(ji===sc||ji===i1||ji===Rh)&&(ji=b0),Ka!==null&&(Bl(a1)||Bl(C0))&&$d(Ka,Fi)}function moe(i){ji!==b0&&(ji=Rh),k0===null?k0=[i]:k0.push(i)}function goe(){return ji===sc}function h1(i,o){var f=Mn;Mn|=pa;var m=Z9();if(Ka!==i||Fi!==o){if(Yi){var y=i.memoizedUpdaters;y.size>0&&(R0(i,Fi),y.clear()),yy(i,o)}lc=Sm(),Dh(i,o)}sy(o);do try{voe();break}catch(C){K9(i,C)}while(!0);if(kk(),Mn=f,Q9(m),Qr!==null)throw new Error("Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue.");return Dr(),Ka=null,Fi=Pe,ji}function voe(){for(;Qr!==null;)X9(Qr)}function yoe(i,o){var f=Mn;Mn|=pa;var m=Z9();if(Ka!==i||Fi!==o){if(Yi){var y=i.memoizedUpdaters;y.size>0&&(R0(i,Fi),y.clear()),yy(i,o)}lc=Sm(),T0(),Dh(i,o)}sy(o);do try{boe();break}catch(C){K9(i,C)}while(!0);return kk(),Q9(m),Mn=f,Qr!==null?(ly(),sc):(Dr(),Ka=null,Fi=Pe,ji)}function boe(){for(;Qr!==null&&!Jv();)X9(Qr)}function X9(i){var o=i.alternate;sr(i);var f;(i.mode&Rn)!==Mt?(_R(i),f=xP(o,i,au),Qk(i,!0)):f=xP(o,i,au),Fr(),i.memoizedProps=i.pendingProps,f===null?J9(i):Qr=f,dP.current=null}function J9(i){var o=i;do{var f=o.alternate,m=o.return;if((o.flags&Lu)===Ot){sr(o);var y=void 0;if((o.mode&Rn)===Mt?y=k9(f,o,au):(_R(o),y=k9(f,o,au),Qk(o,!1)),Fr(),y!==null){Qr=y;return}}else{var C=pae(f,o);if(C!==null){C.flags&=aC,Qr=C;return}if((o.mode&Rn)!==Mt){Qk(o,!1);for(var w=o.actualDuration,P=o.child;P!==null;)w+=P.actualDuration,P=P.sibling;o.actualDuration=w}if(m!==null)m.flags|=Lu,m.subtreeFlags=Ot,m.deletions=null;else{ji=fP,Qr=null;return}}var D=o.sibling;if(D!==null){Qr=D;return}o=m,Qr=o}while(o!==null);ji===sc&&(ji=V9)}function Ah(i,o,f){var m=$a(),y=ha.transition;try{ha.transition=null,fi(Oa),Soe(i,o,f,m)}finally{ha.transition=y,fi(m)}return null}function Soe(i,o,f,m){do cc();while(Bd!==null);if(Aoe(),(Mn&(pa|bs))!==Ui)throw new Error("Should not already be working.");var y=i.finishedWork,C=i.finishedLanes;if(dC(C),y===null)return cs(),null;if(C===Pe&&c("root.finishedLanes should not be empty during a commit. This is a bug in React."),i.finishedWork=null,i.finishedLanes=Pe,y===i.current)throw new Error("Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue.");i.callbackNode=null,i.callbackPriority=ii;var w=sn(y.lanes,y.childLanes);CC(i,w),i===Ka&&(Ka=null,Qr=null,Fi=Pe),((y.subtreeFlags&Ri)!==Ot||(y.flags&Ri)!==Ot)&&(Ph||(Ph=!0,vP=f,EP(Iu,function(){return cc(),null})));var P=(y.subtreeFlags&(Ll|ud|Nl|Ri))!==Ot,D=(y.flags&(Ll|ud|Nl|Ri))!==Ot;if(P||D){var F=ha.transition;ha.transition=null;var B=$a();fi(Oa);var ae=Mn;Mn|=bs,dP.current=null,bae(i,y),$F(),Mae(i,y,C),One(i.containerInfo),i.current=y,Hf(C),Lae(y,i,C),Fu(),sC(),Mn=ae,fi(B),ha.transition=F}else i.current=y,$F();var re=Ph;if(Ph?(Ph=!1,Bd=i,x0=C):(cg=0,u1=null),w=i.pendingLanes,w===Pe&&(ug=null),re||rj(i.current,!1),ny(y.stateNode,m),Yi&&i.memoizedUpdaters.clear(),Jae(),Ro(i,Gr()),o!==null)for(var ge=i.onRecoverableError,be=0;be<o.length;be++){var we=o[be],st=we.stack,Vt=we.digest;ge(we.value,{componentStack:st,digest:Vt})}if(s1){s1=!1;var Pt=mP;throw mP=null,Pt}return Aa(x0,$t)&&i.tag!==Od&&cc(),w=i.pendingLanes,Aa(w,$t)?(wie(),i===yP?w0++:(w0=0,yP=i)):w0=0,Md(),cs(),null}function cc(){if(Bd!==null){var i=xC(x0),o=Ki(Di,i),f=ha.transition,m=$a();try{return ha.transition=null,fi(o),koe()}finally{fi(m),ha.transition=f}}return!1}function Coe(i){gP.push(i),Ph||(Ph=!0,EP(Iu,function(){return cc(),null}))}function koe(){if(Bd===null)return!1;var i=vP;vP=null;var o=Bd,f=x0;if(Bd=null,x0=Pe,(Mn&(pa|bs))!==Ui)throw new Error("Cannot flush passive effects while already rendering.");bP=!0,l1=!1,oy(f);var m=Mn;Mn|=bs,zae(o.current),Uae(o,o.current,f,i);{var y=gP;gP=[];for(var C=0;C<y.length;C++){var w=y[C];Tae(o,w)}}hd(),rj(o.current,!0),Mn=m,Md(),l1?o===u1?cg++:(cg=0,u1=o):cg=0,bP=!1,l1=!1,ry(o);{var P=o.current.stateNode;P.effectDuration=0,P.passiveEffectDuration=0}return!0}function ej(i){return ug!==null&&ug.has(i)}function Toe(i){ug===null?ug=new Set([i]):ug.add(i)}function xoe(i){s1||(s1=!0,mP=i)}var woe=xoe;function tj(i,o,f){var m=_h(f,o),y=XF(i,m,$t),C=Nd(i,y,$t),w=Za();C!==null&&(yd(C,$t,w),Ro(C,w))}function Tr(i,o,f){if(gae(f),P0(!1),i.tag===k){tj(i,i,f);return}var m=null;for(m=o;m!==null;){if(m.tag===k){tj(m,i,f);return}else if(m.tag===v){var y=m.type,C=m.stateNode;if(typeof y.getDerivedStateFromError=="function"||typeof C.componentDidCatch=="function"&&!ej(C)){var w=_h(f,i),P=$R(m,w,$t),D=Nd(m,P,$t),F=Za();D!==null&&(yd(D,$t,F),Ro(D,F));return}}m=m.return}c(`Internal React error: Attempted to capture a commit phase error inside a detached tree. This indicates a bug in React. Likely causes include deleting the same fiber more than once, committing an already-finished tree, or an inconsistent return pointer.
|
|
211
|
+
Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching`:F=" You returned: "+P,c("%s must not return anything besides a function, which is used for clean-up.%s",D,F)}}}C=C.next}while(C!==y)}}function xae(i,o){if((o.flags&Tn)!==Ot)switch(o.tag){case I:{var f=o.stateNode.passiveEffectDuration,m=o.memoizedProps,y=m.id,C=m.onPostCommit,w=HF(),P=o.alternate===null?"mount":"update";BF()&&(P="nested-update"),typeof C=="function"&&C(y,P,f,w);var D=o.return;e:for(;D!==null;){switch(D.tag){case k:var F=D.stateNode;F.passiveEffectDuration+=f;break e;case I:var B=D.stateNode;B.passiveEffectDuration+=f;break e}D=D.return}break}}}function wae(i,o,f,m){if((f.flags&Nl)!==Ot)switch(f.tag){case p:case j:case X:{if(!da)if(f.mode&Rn)try{ru(),Vd(Li|Mi,f)}finally{nu(f)}else Vd(Li|Mi,f);break}case v:{var y=f.stateNode;if(f.flags&Tn&&!da)if(o===null)if(f.type===f.elementType&&!Eh&&(y.props!==f.memoizedProps&&c("Expected %s props to match memoized props before componentDidMount. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.",Zt(f)||"instance"),y.state!==f.memoizedState&&c("Expected %s state to match memoized state before componentDidMount. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.",Zt(f)||"instance")),f.mode&Rn)try{ru(),y.componentDidMount()}finally{nu(f)}else y.componentDidMount();else{var C=f.elementType===f.type?o.memoizedProps:nl(f.type,o.memoizedProps),w=o.memoizedState;if(f.type===f.elementType&&!Eh&&(y.props!==f.memoizedProps&&c("Expected %s props to match memoized props before componentDidUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.",Zt(f)||"instance"),y.state!==f.memoizedState&&c("Expected %s state to match memoized state before componentDidUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.",Zt(f)||"instance")),f.mode&Rn)try{ru(),y.componentDidUpdate(C,w,y.__reactInternalSnapshotBeforeUpdate)}finally{nu(f)}else y.componentDidUpdate(C,w,y.__reactInternalSnapshotBeforeUpdate)}var P=f.updateQueue;P!==null&&(f.type===f.elementType&&!Eh&&(y.props!==f.memoizedProps&&c("Expected %s props to match memoized props before processing the update queue. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.",Zt(f)||"instance"),y.state!==f.memoizedState&&c("Expected %s state to match memoized state before processing the update queue. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.",Zt(f)||"instance")),hF(f,P,y));break}case k:{var D=f.updateQueue;if(D!==null){var F=null;if(f.child!==null)switch(f.child.tag){case E:F=f.child.stateNode;break;case v:F=f.child.stateNode;break}hF(f,D,F)}break}case E:{var B=f.stateNode;if(o===null&&f.flags&Tn){var ae=f.type,re=f.memoizedProps;Hne(B,ae,re)}break}case R:break;case T:break;case I:{{var ge=f.memoizedProps,be=ge.onCommit,we=ge.onRender,st=f.stateNode.effectDuration,Vt=HF(),Pt=o===null?"mount":"update";BF()&&(Pt="nested-update"),typeof we=="function"&&we(f.memoizedProps.id,Pt,f.actualDuration,f.treeBaseDuration,f.actualStartTime,Vt);{typeof be=="function"&&be(f.memoizedProps.id,Pt,st,Vt),koe(f);var Ln=f.return;e:for(;Ln!==null;){switch(Ln.tag){case k:var wn=Ln.stateNode;wn.effectDuration+=st;break e;case I:var ce=Ln.stateNode;ce.effectDuration+=st;break e}Ln=Ln.return}}}break}case N:{Mae(i,f);break}case J:case $:case xe:case ke:case Ge:case je:break;default:throw new Error("This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.")}da||f.flags&ni&&R9(f)}function _ae(i){switch(i.tag){case p:case j:case X:{if(i.mode&Rn)try{ru(),w9(i,i.return)}finally{nu(i)}else w9(i,i.return);break}case v:{var o=i.stateNode;typeof o.componentDidMount=="function"&&bae(i,i.return,o),_9(i,i.return);break}case E:{_9(i,i.return);break}}}function Eae(i,o){for(var f=null,m=i;;){if(m.tag===E){if(f===null){f=m;try{var y=m.stateNode;o?Jne(y):tre(m.stateNode,m.memoizedProps)}catch(w){Tr(i,i.return,w)}}}else if(m.tag===R){if(f===null)try{var C=m.stateNode;o?ere(C):nre(C,m.memoizedProps)}catch(w){Tr(i,i.return,w)}}else if(!((m.tag===ke||m.tag===Ge)&&m.memoizedState!==null&&m!==i)){if(m.child!==null){m.child.return=m,m=m.child;continue}}if(m===i)return;for(;m.sibling===null;){if(m.return===null||m.return===i)return;f===m&&(f=null),m=m.return}f===m&&(f=null),m.sibling.return=m.return,m=m.sibling}}function R9(i){var o=i.ref;if(o!==null){var f=i.stateNode,m;switch(i.tag){case E:m=f;break;default:m=f}if(typeof o=="function"){var y;if(i.mode&Rn)try{ru(),y=o(m)}finally{nu(i)}else y=o(m);typeof y=="function"&&c("Unexpected return value from a callback ref in %s. A callback ref should not return a function.",Zt(i))}else o.hasOwnProperty("current")||c("Unexpected ref object provided for %s. Use either a ref-setter function or React.createRef().",Zt(i)),o.current=m}}function Rae(i){var o=i.alternate;o!==null&&(o.return=null),i.return=null}function P9(i){var o=i.alternate;o!==null&&(i.alternate=null,P9(o));{if(i.child=null,i.deletions=null,i.sibling=null,i.tag===E){var f=i.stateNode;f!==null&&Lre(f)}i.stateNode=null,i._debugOwner=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}}function Pae(i){for(var o=i.return;o!==null;){if(D9(o))return o;o=o.return}throw new Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.")}function D9(i){return i.tag===E||i.tag===k||i.tag===T}function A9(i){var o=i;e:for(;;){for(;o.sibling===null;){if(o.return===null||D9(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==E&&o.tag!==R&&o.tag!==oe;){if(o.flags&jr||o.child===null||o.tag===T)continue e;o.child.return=o,o=o.child}if(!(o.flags&jr))return o.stateNode}}function Dae(i){var o=Pae(i);switch(o.tag){case E:{var f=o.stateNode;o.flags&tr&&(MU(f),o.flags&=~tr);var m=A9(i);lP(i,m,f);break}case k:case T:{var y=o.stateNode.containerInfo,C=A9(i);sP(i,C,y);break}default:throw new Error("Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue.")}}function sP(i,o,f){var m=i.tag,y=m===E||m===R;if(y){var C=i.stateNode;o?Kne(f,C,o):Gne(f,C)}else if(m!==T){var w=i.child;if(w!==null){sP(w,o,f);for(var P=w.sibling;P!==null;)sP(P,o,f),P=P.sibling}}}function lP(i,o,f){var m=i.tag,y=m===E||m===R;if(y){var C=i.stateNode;o?Yne(f,C,o):Wne(f,C)}else if(m!==T){var w=i.child;if(w!==null){lP(w,o,f);for(var P=w.sibling;P!==null;)lP(P,o,f),P=P.sibling}}}var fa=null,al=!1;function Aae(i,o,f){{var m=o;e:for(;m!==null;){switch(m.tag){case E:{fa=m.stateNode,al=!1;break e}case k:{fa=m.stateNode.containerInfo,al=!0;break e}case T:{fa=m.stateNode.containerInfo,al=!0;break e}}m=m.return}if(fa===null)throw new Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.");O9(i,o,f),fa=null,al=!1}Rae(f)}function zd(i,o,f){for(var m=f.child;m!==null;)O9(i,o,m),m=m.sibling}function O9(i,o,f){switch(dd(f),f.tag){case E:da||lg(f,o);case R:{{var m=fa,y=al;fa=null,zd(i,o,f),fa=m,al=y,fa!==null&&(al?Qne(fa,f.stateNode):Zne(fa,f.stateNode))}return}case oe:{fa!==null&&(al?Xne(fa,f.stateNode):bE(fa,f.stateNode));return}case T:{{var C=fa,w=al;fa=f.stateNode.containerInfo,al=!0,zd(i,o,f),fa=C,al=w}return}case p:case j:case ne:case X:{if(!da){var P=f.updateQueue;if(P!==null){var D=P.lastEffect;if(D!==null){var F=D.next,B=F;do{var ae=B,re=ae.destroy,ge=ae.tag;re!==void 0&&((ge&Jl)!==_o?r1(f,o,re):(ge&Li)!==_o&&(ay(f),f.mode&Rn?(ru(),r1(f,o,re),nu(f)):r1(f,o,re),fd())),B=B.next}while(B!==F)}}}zd(i,o,f);return}case v:{if(!da){lg(f,o);var be=f.stateNode;typeof be.componentWillUnmount=="function"&&oP(f,o,be)}zd(i,o,f);return}case xe:{zd(i,o,f);return}case ke:{if(f.mode&vn){var we=da;da=we||f.memoizedState!==null,zd(i,o,f),da=we}else zd(i,o,f);break}default:{zd(i,o,f);return}}}function Oae(i){i.memoizedState}function Mae(i,o){var f=o.memoizedState;if(f===null){var m=o.alternate;if(m!==null){var y=m.memoizedState;if(y!==null){var C=y.dehydrated;C!==null&&vre(C)}}}}function M9(i){var o=i.updateQueue;if(o!==null){i.updateQueue=null;var f=i.stateNode;f===null&&(f=i.stateNode=new gae),o.forEach(function(m){var y=Poe.bind(null,i,m);if(!f.has(m)){if(f.add(m),Yi)if(og!==null&&sg!==null)R0(sg,og);else throw Error("Expected finished root and lanes to be set. This is a bug in React.");m.then(y,y)}})}}function Lae(i,o,f){og=f,sg=i,sr(o),L9(o,i),sr(o),og=null,sg=null}function ol(i,o,f){var m=o.deletions;if(m!==null)for(var y=0;y<m.length;y++){var C=m[y];try{Aae(i,o,C)}catch(D){Tr(C,o,D)}}var w=No();if(o.subtreeFlags&ud)for(var P=o.child;P!==null;)sr(P),L9(P,i),P=P.sibling;sr(w)}function L9(i,o,f){var m=i.alternate,y=i.flags;switch(i.tag){case p:case j:case ne:case X:{if(ol(o,i),iu(i),y&Tn){try{il(Jl|Mi,i,i.return),Vd(Jl|Mi,i)}catch(Wt){Tr(i,i.return,Wt)}if(i.mode&Rn){try{ru(),il(Li|Mi,i,i.return)}catch(Wt){Tr(i,i.return,Wt)}nu(i)}else try{il(Li|Mi,i,i.return)}catch(Wt){Tr(i,i.return,Wt)}}return}case v:{ol(o,i),iu(i),y&ni&&m!==null&&lg(m,m.return);return}case E:{ol(o,i),iu(i),y&ni&&m!==null&&lg(m,m.return);{if(i.flags&tr){var C=i.stateNode;try{MU(C)}catch(Wt){Tr(i,i.return,Wt)}}if(y&Tn){var w=i.stateNode;if(w!=null){var P=i.memoizedProps,D=m!==null?m.memoizedProps:P,F=i.type,B=i.updateQueue;if(i.updateQueue=null,B!==null)try{$ne(w,B,F,D,P,i)}catch(Wt){Tr(i,i.return,Wt)}}}}return}case R:{if(ol(o,i),iu(i),y&Tn){if(i.stateNode===null)throw new Error("This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue.");var ae=i.stateNode,re=i.memoizedProps,ge=m!==null?m.memoizedProps:re;try{qne(ae,ge,re)}catch(Wt){Tr(i,i.return,Wt)}}return}case k:{if(ol(o,i),iu(i),y&Tn&&m!==null){var be=m.memoizedState;if(be.isDehydrated)try{gre(o.containerInfo)}catch(Wt){Tr(i,i.return,Wt)}}return}case T:{ol(o,i),iu(i);return}case N:{ol(o,i),iu(i);var we=i.child;if(we.flags&ls){var st=we.stateNode,Vt=we.memoizedState,Pt=Vt!==null;if(st.isHidden=Pt,Pt){var Ln=we.alternate!==null&&we.alternate.memoizedState!==null;Ln||poe()}}if(y&Tn){try{Oae(i)}catch(Wt){Tr(i,i.return,Wt)}M9(i)}return}case ke:{var wn=m!==null&&m.memoizedState!==null;if(i.mode&vn){var ce=da;da=ce||wn,ol(o,i),da=ce}else ol(o,i);if(iu(i),y&ls){var _e=i.stateNode,de=i.memoizedState,qe=de!==null,yt=i;if(_e.isHidden=qe,qe&&!wn&&(yt.mode&vn)!==Mt){_t=yt;for(var ft=yt.child;ft!==null;)_t=ft,Iae(ft),ft=ft.sibling}Eae(yt,qe)}return}case J:{ol(o,i),iu(i),y&Tn&&M9(i);return}case xe:return;default:{ol(o,i),iu(i);return}}}function iu(i){var o=i.flags;if(o&jr){try{Dae(i)}catch(f){Tr(i,i.return,f)}i.flags&=~jr}o&Vr&&(i.flags&=~Vr)}function Nae(i,o,f){og=f,sg=o,_t=i,N9(i,o,f),og=null,sg=null}function N9(i,o,f){for(var m=(i.mode&vn)!==Mt;_t!==null;){var y=_t,C=y.child;if(y.tag===ke&&m){var w=y.memoizedState!==null,P=w||n1;if(P){uP(i,o,f);continue}else{var D=y.alternate,F=D!==null&&D.memoizedState!==null,B=F||da,ae=n1,re=da;n1=P,da=B,da&&!re&&(_t=y,Uae(y));for(var ge=C;ge!==null;)_t=ge,N9(ge,o,f),ge=ge.sibling;_t=y,n1=ae,da=re,uP(i,o,f);continue}}(y.subtreeFlags&Nl)!==Ot&&C!==null?(C.return=y,_t=C):uP(i,o,f)}}function uP(i,o,f){for(;_t!==null;){var m=_t;if((m.flags&Nl)!==Ot){var y=m.alternate;sr(m);try{wae(o,y,m,f)}catch(w){Tr(m,m.return,w)}Fr()}if(m===i){_t=null;return}var C=m.sibling;if(C!==null){C.return=m.return,_t=C;return}_t=m.return}}function Iae(i){for(;_t!==null;){var o=_t,f=o.child;switch(o.tag){case p:case j:case ne:case X:{if(o.mode&Rn)try{ru(),il(Li,o,o.return)}finally{nu(o)}else il(Li,o,o.return);break}case v:{lg(o,o.return);var m=o.stateNode;typeof m.componentWillUnmount=="function"&&oP(o,o.return,m);break}case E:{lg(o,o.return);break}case ke:{var y=o.memoizedState!==null;if(y){I9(i);continue}break}}f!==null?(f.return=o,_t=f):I9(i)}}function I9(i){for(;_t!==null;){var o=_t;if(o===i){_t=null;return}var f=o.sibling;if(f!==null){f.return=o.return,_t=f;return}_t=o.return}}function Uae(i){for(;_t!==null;){var o=_t,f=o.child;if(o.tag===ke){var m=o.memoizedState!==null;if(m){U9(i);continue}}f!==null?(f.return=o,_t=f):U9(i)}}function U9(i){for(;_t!==null;){var o=_t;sr(o);try{_ae(o)}catch(m){Tr(o,o.return,m)}if(Fr(),o===i){_t=null;return}var f=o.sibling;if(f!==null){f.return=o.return,_t=f;return}_t=o.return}}function Fae(i,o,f,m){_t=o,jae(o,i,f,m)}function jae(i,o,f,m){for(;_t!==null;){var y=_t,C=y.child;(y.subtreeFlags&Ri)!==Ot&&C!==null?(C.return=y,_t=C):Vae(i,o,f,m)}}function Vae(i,o,f,m){for(;_t!==null;){var y=_t;if((y.flags&Ba)!==Ot){sr(y);try{zae(o,y,f,m)}catch(w){Tr(y,y.return,w)}Fr()}if(y===i){_t=null;return}var C=y.sibling;if(C!==null){C.return=y.return,_t=C;return}_t=y.return}}function zae(i,o,f,m){switch(o.tag){case p:case j:case X:{if(o.mode&Rn){RR();try{Vd(ua|Mi,o)}finally{ER(o)}}else Vd(ua|Mi,o);break}}}function Bae(i){_t=i,Hae()}function Hae(){for(;_t!==null;){var i=_t,o=i.child;if((_t.flags&wa)!==Ot){var f=i.deletions;if(f!==null){for(var m=0;m<f.length;m++){var y=f[m];_t=y,Wae(y,i)}{var C=i.alternate;if(C!==null){var w=C.child;if(w!==null){C.child=null;do{var P=w.sibling;w.sibling=null,w=P}while(w!==null)}}}_t=i}}(i.subtreeFlags&Ri)!==Ot&&o!==null?(o.return=i,_t=o):$ae()}}function $ae(){for(;_t!==null;){var i=_t;(i.flags&Ba)!==Ot&&(sr(i),qae(i),Fr());var o=i.sibling;if(o!==null){o.return=i.return,_t=o;return}_t=i.return}}function qae(i){switch(i.tag){case p:case j:case X:{i.mode&Rn?(RR(),il(ua|Mi,i,i.return),ER(i)):il(ua|Mi,i,i.return);break}}}function Wae(i,o){for(;_t!==null;){var f=_t;sr(f),Yae(f,o),Fr();var m=f.child;m!==null?(m.return=f,_t=m):Gae(i)}}function Gae(i){for(;_t!==null;){var o=_t,f=o.sibling,m=o.return;if(P9(o),o===i){_t=null;return}if(f!==null){f.return=m,_t=f;return}_t=m}}function Yae(i,o){switch(i.tag){case p:case j:case X:{i.mode&Rn?(RR(),il(ua,i,o),ER(i)):il(ua,i,o);break}}}function Kae(i){switch(i.tag){case p:case j:case X:{try{Vd(Li|Mi,i)}catch(f){Tr(i,i.return,f)}break}case v:{var o=i.stateNode;try{o.componentDidMount()}catch(f){Tr(i,i.return,f)}break}}}function Zae(i){switch(i.tag){case p:case j:case X:{try{Vd(ua|Mi,i)}catch(o){Tr(i,i.return,o)}break}}}function Qae(i){switch(i.tag){case p:case j:case X:{try{il(Li|Mi,i,i.return)}catch(f){Tr(i,i.return,f)}break}case v:{var o=i.stateNode;typeof o.componentWillUnmount=="function"&&oP(i,i.return,o);break}}}function Xae(i){switch(i.tag){case p:case j:case X:try{il(ua|Mi,i,i.return)}catch(o){Tr(i,i.return,o)}}}if(typeof Symbol=="function"&&Symbol.for){var v0=Symbol.for;v0("selector.component"),v0("selector.has_pseudo_class"),v0("selector.role"),v0("selector.test_id"),v0("selector.text")}var Jae=[];function eoe(){Jae.forEach(function(i){return i()})}var toe=r.ReactCurrentActQueue;function noe(i){{var o=typeof IS_REACT_ACT_ENVIRONMENT<"u"?IS_REACT_ACT_ENVIRONMENT:void 0,f=typeof jest<"u";return f&&o!==!1}}function F9(){{var i=typeof IS_REACT_ACT_ENVIRONMENT<"u"?IS_REACT_ACT_ENVIRONMENT:void 0;return!i&&toe.current!==null&&c("The current testing environment is not configured to support act(...)"),i}}var roe=Math.ceil,cP=r.ReactCurrentDispatcher,dP=r.ReactCurrentOwner,ha=r.ReactCurrentBatchConfig,sl=r.ReactCurrentActQueue,Ui=0,j9=1,pa=2,bs=4,sc=0,y0=1,Rh=2,i1=3,b0=4,V9=5,fP=6,Mn=Ui,Ka=null,Qr=null,Fi=Pe,au=Pe,hP=Ad(Pe),ji=sc,S0=null,a1=Pe,C0=Pe,o1=Pe,k0=null,Eo=null,pP=0,z9=500,B9=1/0,ioe=500,lc=null;function T0(){B9=Gr()+ioe}function H9(){return B9}var s1=!1,mP=null,ug=null,Ph=!1,Bd=null,x0=Pe,gP=[],vP=null,aoe=50,w0=0,yP=null,bP=!1,l1=!1,ooe=50,cg=0,u1=null,_0=rr,c1=Pe,$9=!1;function d1(){return Ka}function Za(){return(Mn&(pa|bs))!==Ui?Gr():(_0!==rr||(_0=Gr()),_0)}function Hd(i){var o=i.mode;if((o&vn)===Mt)return $t;if((Mn&pa)!==Ui&&Fi!==Pe)return Ci(Fi);var f=tie()!==eie;if(f){if(ha.transition!==null){var m=ha.transition;m._updatedFibers||(m._updatedFibers=new Set),m._updatedFibers.add(i)}return c1===ii&&(c1=my()),c1}var y=$a();if(y!==ii)return y;var C=jne();return C}function soe(i){var o=i.mode;return(o&vn)===Mt?$t:SC()}function Vi(i,o,f,m){Aoe(),$9&&c("useInsertionEffect must not schedule updates."),bP&&(l1=!0),yd(i,f,m),(Mn&pa)!==Pe&&i===Ka?Loe(o):(Yi&&kC(i,o,f),Noe(o),i===Ka&&((Mn&pa)===Ui&&(C0=sn(C0,f)),ji===b0&&$d(i,Fi)),Ro(i,m),f===$t&&Mn===Ui&&(o.mode&vn)===Mt&&!sl.isBatchingLegacy&&(T0(),$U()))}function loe(i,o,f){var m=i.current;m.lanes=o,yd(i,o,f),Ro(i,f)}function uoe(i){return(Mn&pa)!==Ui}function Ro(i,o){var f=i.callbackNode;vC(i,o);var m=Da(i,i===Ka?Fi:Pe);if(m===Pe){f!==null&&oj(f),i.callbackNode=null,i.callbackPriority=ii;return}var y=Bu(m),C=i.callbackPriority;if(C===y&&!(sl.current!==null&&f!==_P)){f==null&&C!==$t&&c("Expected scheduled callback to exist. This error is likely caused by a bug in React. Please file an issue.");return}f!=null&&oj(f);var w;if(y===$t)i.tag===Od?(sl.isBatchingLegacy!==null&&(sl.didScheduleLegacyUpdate=!0),Ure(G9.bind(null,i))):HU(G9.bind(null,i)),sl.current!==null?sl.current.push(Md):zne(function(){(Mn&(pa|bs))===Ui&&Md()}),w=null;else{var P;switch(xC(m)){case Oa:P=Gs;break;case So:P=Vf;break;case Di:P=Iu;break;case Cm:P=cd;break;default:P=Iu;break}w=EP(P,q9.bind(null,i))}i.callbackPriority=y,i.callbackNode=w}function q9(i,o){if(Eie(),_0=rr,c1=Pe,(Mn&(pa|bs))!==Ui)throw new Error("Should not already be working.");var f=i.callbackNode,m=cc();if(m&&i.callbackNode!==f)return null;var y=Da(i,i===Ka?Fi:Pe);if(y===Pe)return null;var C=!Xf(i,y)&&!bC(i,y)&&!o,w=C?boe(i,y):h1(i,y);if(w!==sc){if(w===Rh){var P=hm(i);P!==Pe&&(y=P,w=SP(i,P))}if(w===y0){var D=S0;throw Dh(i,Pe),$d(i,y),Ro(i,Gr()),D}if(w===fP)$d(i,y);else{var F=!Xf(i,y),B=i.current.alternate;if(F&&!doe(B)){if(w=h1(i,y),w===Rh){var ae=hm(i);ae!==Pe&&(y=ae,w=SP(i,ae))}if(w===y0){var re=S0;throw Dh(i,Pe),$d(i,y),Ro(i,Gr()),re}}i.finishedWork=B,i.finishedLanes=y,coe(i,w,y)}}return Ro(i,Gr()),i.callbackNode===f?q9.bind(null,i):null}function SP(i,o){var f=k0;if($u(i)){var m=Dh(i,o);m.flags|=Pr,Dre(i.containerInfo)}var y=h1(i,o);if(y!==Rh){var C=Eo;Eo=f,C!==null&&W9(C)}return y}function W9(i){Eo===null?Eo=i:Eo.push.apply(Eo,i)}function coe(i,o,f){switch(o){case sc:case y0:throw new Error("Root did not complete. This is a bug in React.");case Rh:{Ah(i,Eo,lc);break}case i1:{if($d(i,f),pm(f)&&!sj()){var m=pP+z9-Gr();if(m>10){var y=Da(i,Pe);if(y!==Pe)break;var C=i.suspendedLanes;if(!Hu(C,f)){Za(),ym(i,C);break}i.timeoutHandle=vE(Ah.bind(null,i,Eo,lc),m);break}}Ah(i,Eo,lc);break}case b0:{if($d(i,f),B_(f))break;if(!sj()){var w=dy(i,f),P=w,D=Gr()-P,F=Doe(D)-D;if(F>10){i.timeoutHandle=vE(Ah.bind(null,i,Eo,lc),F);break}}Ah(i,Eo,lc);break}case V9:{Ah(i,Eo,lc);break}default:throw new Error("Unknown root exit status.")}}function doe(i){for(var o=i;;){if(o.flags&$p){var f=o.updateQueue;if(f!==null){var m=f.stores;if(m!==null)for(var y=0;y<m.length;y++){var C=m[y],w=C.getSnapshot,P=C.value;try{if(!dt(w(),P))return!1}catch{return!1}}}}var D=o.child;if(o.subtreeFlags&$p&&D!==null){D.return=o,o=D;continue}if(o===i)return!0;for(;o.sibling===null;){if(o.return===null||o.return===i)return!0;o=o.return}o.sibling.return=o.return,o=o.sibling}return!0}function $d(i,o){o=Jf(o,o1),o=Jf(o,C0),vy(i,o)}function G9(i){if(Rie(),(Mn&(pa|bs))!==Ui)throw new Error("Should not already be working.");cc();var o=Da(i,Pe);if(!Aa(o,$t))return Ro(i,Gr()),null;var f=h1(i,o);if(i.tag!==Od&&f===Rh){var m=hm(i);m!==Pe&&(o=m,f=SP(i,m))}if(f===y0){var y=S0;throw Dh(i,Pe),$d(i,o),Ro(i,Gr()),y}if(f===fP)throw new Error("Root did not complete. This is a bug in React.");var C=i.current.alternate;return i.finishedWork=C,i.finishedLanes=o,Ah(i,Eo,lc),Ro(i,Gr()),null}function foe(i,o){o!==Pe&&(eh(i,sn(o,$t)),Ro(i,Gr()),(Mn&(pa|bs))===Ui&&(T0(),Md()))}function CP(i,o){var f=Mn;Mn|=j9;try{return i(o)}finally{Mn=f,Mn===Ui&&!sl.isBatchingLegacy&&(T0(),$U())}}function hoe(i,o,f,m,y){var C=$a(),w=ha.transition;try{return ha.transition=null,fi(Oa),i(o,f,m,y)}finally{fi(C),ha.transition=w,Mn===Ui&&T0()}}function uc(i){Bd!==null&&Bd.tag===Od&&(Mn&(pa|bs))===Ui&&cc();var o=Mn;Mn|=j9;var f=ha.transition,m=$a();try{return ha.transition=null,fi(Oa),i?i():void 0}finally{fi(m),ha.transition=f,Mn=o,(Mn&(pa|bs))===Ui&&Md()}}function Y9(){return(Mn&(pa|bs))!==Ui}function f1(i,o){Na(hP,au,i),au=sn(au,o)}function kP(i){au=hP.current,La(hP,i)}function Dh(i,o){i.finishedWork=null,i.finishedLanes=Pe;var f=i.timeoutHandle;if(f!==yE&&(i.timeoutHandle=yE,Vne(f)),Qr!==null)for(var m=Qr.return;m!==null;){var y=m.alternate;T9(y,m),m=m.return}Ka=i;var C=Oh(i.current,null);return Qr=C,Fi=au=o,ji=sc,S0=null,a1=Pe,C0=Pe,o1=Pe,k0=null,Eo=null,lie(),Js.discardPendingWarnings(),C}function K9(i,o){do{var f=Qr;try{if(kk(),bF(),Fr(),dP.current=null,f===null||f.return===null){ji=y0,S0=o,Qr=null;return}if(Rt&&f.mode&Rn&&Qk(f,!0),Ct)if(Ul(),o!==null&&typeof o=="object"&&typeof o.then=="function"){var m=o;Bf(f,m,Fi)}else ds(f,o,Fi);Uie(i,f.return,f,o,Fi),J9(f)}catch(y){o=y,Qr===f&&f!==null?(f=f.return,Qr=f):f=Qr;continue}return}while(!0)}function Z9(){var i=cP.current;return cP.current=Wk,i===null?Wk:i}function Q9(i){cP.current=i}function poe(){pP=Gr()}function E0(i){a1=sn(i,a1)}function moe(){ji===sc&&(ji=i1)}function TP(){(ji===sc||ji===i1||ji===Rh)&&(ji=b0),Ka!==null&&(Bl(a1)||Bl(C0))&&$d(Ka,Fi)}function goe(i){ji!==b0&&(ji=Rh),k0===null?k0=[i]:k0.push(i)}function voe(){return ji===sc}function h1(i,o){var f=Mn;Mn|=pa;var m=Z9();if(Ka!==i||Fi!==o){if(Yi){var y=i.memoizedUpdaters;y.size>0&&(R0(i,Fi),y.clear()),yy(i,o)}lc=Sm(),Dh(i,o)}sy(o);do try{yoe();break}catch(C){K9(i,C)}while(!0);if(kk(),Mn=f,Q9(m),Qr!==null)throw new Error("Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue.");return Dr(),Ka=null,Fi=Pe,ji}function yoe(){for(;Qr!==null;)X9(Qr)}function boe(i,o){var f=Mn;Mn|=pa;var m=Z9();if(Ka!==i||Fi!==o){if(Yi){var y=i.memoizedUpdaters;y.size>0&&(R0(i,Fi),y.clear()),yy(i,o)}lc=Sm(),T0(),Dh(i,o)}sy(o);do try{Soe();break}catch(C){K9(i,C)}while(!0);return kk(),Q9(m),Mn=f,Qr!==null?(ly(),sc):(Dr(),Ka=null,Fi=Pe,ji)}function Soe(){for(;Qr!==null&&!Jv();)X9(Qr)}function X9(i){var o=i.alternate;sr(i);var f;(i.mode&Rn)!==Mt?(_R(i),f=xP(o,i,au),Qk(i,!0)):f=xP(o,i,au),Fr(),i.memoizedProps=i.pendingProps,f===null?J9(i):Qr=f,dP.current=null}function J9(i){var o=i;do{var f=o.alternate,m=o.return;if((o.flags&Lu)===Ot){sr(o);var y=void 0;if((o.mode&Rn)===Mt?y=k9(f,o,au):(_R(o),y=k9(f,o,au),Qk(o,!1)),Fr(),y!==null){Qr=y;return}}else{var C=mae(f,o);if(C!==null){C.flags&=aC,Qr=C;return}if((o.mode&Rn)!==Mt){Qk(o,!1);for(var w=o.actualDuration,P=o.child;P!==null;)w+=P.actualDuration,P=P.sibling;o.actualDuration=w}if(m!==null)m.flags|=Lu,m.subtreeFlags=Ot,m.deletions=null;else{ji=fP,Qr=null;return}}var D=o.sibling;if(D!==null){Qr=D;return}o=m,Qr=o}while(o!==null);ji===sc&&(ji=V9)}function Ah(i,o,f){var m=$a(),y=ha.transition;try{ha.transition=null,fi(Oa),Coe(i,o,f,m)}finally{ha.transition=y,fi(m)}return null}function Coe(i,o,f,m){do cc();while(Bd!==null);if(Ooe(),(Mn&(pa|bs))!==Ui)throw new Error("Should not already be working.");var y=i.finishedWork,C=i.finishedLanes;if(dC(C),y===null)return cs(),null;if(C===Pe&&c("root.finishedLanes should not be empty during a commit. This is a bug in React."),i.finishedWork=null,i.finishedLanes=Pe,y===i.current)throw new Error("Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue.");i.callbackNode=null,i.callbackPriority=ii;var w=sn(y.lanes,y.childLanes);CC(i,w),i===Ka&&(Ka=null,Qr=null,Fi=Pe),((y.subtreeFlags&Ri)!==Ot||(y.flags&Ri)!==Ot)&&(Ph||(Ph=!0,vP=f,EP(Iu,function(){return cc(),null})));var P=(y.subtreeFlags&(Ll|ud|Nl|Ri))!==Ot,D=(y.flags&(Ll|ud|Nl|Ri))!==Ot;if(P||D){var F=ha.transition;ha.transition=null;var B=$a();fi(Oa);var ae=Mn;Mn|=bs,dP.current=null,Sae(i,y),$F(),Lae(i,y,C),Mne(i.containerInfo),i.current=y,Hf(C),Nae(y,i,C),Fu(),sC(),Mn=ae,fi(B),ha.transition=F}else i.current=y,$F();var re=Ph;if(Ph?(Ph=!1,Bd=i,x0=C):(cg=0,u1=null),w=i.pendingLanes,w===Pe&&(ug=null),re||rj(i.current,!1),ny(y.stateNode,m),Yi&&i.memoizedUpdaters.clear(),eoe(),Ro(i,Gr()),o!==null)for(var ge=i.onRecoverableError,be=0;be<o.length;be++){var we=o[be],st=we.stack,Vt=we.digest;ge(we.value,{componentStack:st,digest:Vt})}if(s1){s1=!1;var Pt=mP;throw mP=null,Pt}return Aa(x0,$t)&&i.tag!==Od&&cc(),w=i.pendingLanes,Aa(w,$t)?(_ie(),i===yP?w0++:(w0=0,yP=i)):w0=0,Md(),cs(),null}function cc(){if(Bd!==null){var i=xC(x0),o=Ki(Di,i),f=ha.transition,m=$a();try{return ha.transition=null,fi(o),Toe()}finally{fi(m),ha.transition=f}}return!1}function koe(i){gP.push(i),Ph||(Ph=!0,EP(Iu,function(){return cc(),null}))}function Toe(){if(Bd===null)return!1;var i=vP;vP=null;var o=Bd,f=x0;if(Bd=null,x0=Pe,(Mn&(pa|bs))!==Ui)throw new Error("Cannot flush passive effects while already rendering.");bP=!0,l1=!1,oy(f);var m=Mn;Mn|=bs,Bae(o.current),Fae(o,o.current,f,i);{var y=gP;gP=[];for(var C=0;C<y.length;C++){var w=y[C];xae(o,w)}}hd(),rj(o.current,!0),Mn=m,Md(),l1?o===u1?cg++:(cg=0,u1=o):cg=0,bP=!1,l1=!1,ry(o);{var P=o.current.stateNode;P.effectDuration=0,P.passiveEffectDuration=0}return!0}function ej(i){return ug!==null&&ug.has(i)}function xoe(i){ug===null?ug=new Set([i]):ug.add(i)}function woe(i){s1||(s1=!0,mP=i)}var _oe=woe;function tj(i,o,f){var m=_h(f,o),y=XF(i,m,$t),C=Nd(i,y,$t),w=Za();C!==null&&(yd(C,$t,w),Ro(C,w))}function Tr(i,o,f){if(vae(f),P0(!1),i.tag===k){tj(i,i,f);return}var m=null;for(m=o;m!==null;){if(m.tag===k){tj(m,i,f);return}else if(m.tag===v){var y=m.type,C=m.stateNode;if(typeof y.getDerivedStateFromError=="function"||typeof C.componentDidCatch=="function"&&!ej(C)){var w=_h(f,i),P=$R(m,w,$t),D=Nd(m,P,$t),F=Za();D!==null&&(yd(D,$t,F),Ro(D,F));return}}m=m.return}c(`Internal React error: Attempted to capture a commit phase error inside a detached tree. This indicates a bug in React. Likely causes include deleting the same fiber more than once, committing an already-finished tree, or an inconsistent return pointer.
|
|
212
212
|
|
|
213
213
|
Error message:
|
|
214
214
|
|
|
215
|
-
%s`,f)}function
|
|
215
|
+
%s`,f)}function Eoe(i,o,f){var m=i.pingCache;m!==null&&m.delete(o);var y=Za();ym(i,f),Ioe(i),Ka===i&&Hu(Fi,f)&&(ji===b0||ji===i1&&pm(Fi)&&Gr()-pP<z9?Dh(i,Pe):o1=sn(o1,f)),Ro(i,y)}function nj(i,o){o===ii&&(o=soe(i));var f=Za(),m=wo(i,o);m!==null&&(yd(m,o,f),Ro(m,f))}function Roe(i){var o=i.memoizedState,f=ii;o!==null&&(f=o.retryLane),nj(i,f)}function Poe(i,o){var f=ii,m;switch(i.tag){case N:m=i.stateNode;var y=i.memoizedState;y!==null&&(f=y.retryLane);break;case J:m=i.stateNode;break;default:throw new Error("Pinged unknown suspense boundary type. This is probably a bug in React.")}m!==null&&m.delete(o),nj(i,f)}function Doe(i){return i<120?120:i<480?480:i<1080?1080:i<1920?1920:i<3e3?3e3:i<4320?4320:roe(i/1960)*1960}function Aoe(){if(w0>aoe)throw w0=0,yP=null,new Error("Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.");cg>ooe&&(cg=0,u1=null,c("Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render."))}function Ooe(){Js.flushLegacyContextWarning(),Js.flushPendingUnsafeLifecycleWarnings()}function rj(i,o){sr(i),p1(i,ia,Qae),o&&p1(i,Ml,Xae),p1(i,ia,Kae),o&&p1(i,Ml,Zae),Fr()}function p1(i,o,f){for(var m=i,y=null;m!==null;){var C=m.subtreeFlags&o;m!==y&&m.child!==null&&C!==Ot?m=m.child:((m.flags&o)!==Ot&&f(m),m.sibling!==null?m=m.sibling:m=y=m.return)}}var m1=null;function ij(i){{if((Mn&pa)!==Ui||!(i.mode&vn))return;var o=i.tag;if(o!==b&&o!==k&&o!==v&&o!==p&&o!==j&&o!==ne&&o!==X)return;var f=Zt(i)||"ReactComponent";if(m1!==null){if(m1.has(f))return;m1.add(f)}else m1=new Set([f]);var m=yi;try{sr(i),c("Can't perform a React state update on a component that hasn't mounted yet. This indicates that you have a side-effect in your render function that asynchronously later calls tries to update the component. Move this work to useEffect instead.")}finally{m?sr(i):Fr()}}}var xP;{var Moe=null;xP=function(i,o,f){var m=fj(Moe,o);try{return v9(i,o,f)}catch(C){if(qre()||C!==null&&typeof C=="object"&&typeof C.then=="function")throw C;if(kk(),bF(),T9(i,o),fj(o,m),o.mode&Rn&&_R(o),vo(null,v9,null,i,o,f),Wv()){var y=Gv();typeof y=="object"&&y!==null&&y._suppressLogging&&typeof C=="object"&&C!==null&&!C._suppressLogging&&(C._suppressLogging=!0)}throw C}}}var aj=!1,wP;wP=new Set;function Loe(i){if(Ta&&!Tie())switch(i.tag){case p:case j:case X:{var o=Qr&&Zt(Qr)||"Unknown",f=o;if(!wP.has(f)){wP.add(f);var m=Zt(i)||"Unknown";c("Cannot update a component (`%s`) while rendering a different component (`%s`). To locate the bad setState() call inside `%s`, follow the stack trace as described in https://reactjs.org/link/setstate-in-render",m,o,o)}break}case v:{aj||(c("Cannot update during an existing state transition (such as within `render`). Render methods should be a pure function of props and state."),aj=!0);break}}}function R0(i,o){if(Yi){var f=i.memoizedUpdaters;f.forEach(function(m){kC(i,m,o)})}}var _P={};function EP(i,o){{var f=sl.current;return f!==null?(f.push(o),_P):Qv(i,o)}}function oj(i){if(i!==_P)return Xv(i)}function sj(){return sl.current!==null}function Noe(i){{if(i.mode&vn){if(!F9())return}else if(!noe()||Mn!==Ui||i.tag!==p&&i.tag!==j&&i.tag!==X)return;if(sl.current===null){var o=yi;try{sr(i),c(`An update to %s inside a test was not wrapped in act(...).
|
|
216
216
|
|
|
217
217
|
When testing, code that causes React state updates should be wrapped into act(...):
|
|
218
218
|
|
|
@@ -221,7 +221,7 @@ act(() => {
|
|
|
221
221
|
});
|
|
222
222
|
/* assert on the output */
|
|
223
223
|
|
|
224
|
-
This ensures that you're testing the behavior the user would see in the browser. Learn more at https://reactjs.org/link/wrap-tests-with-act`,Zt(i))}finally{o?sr(i):Fr()}}}}function
|
|
224
|
+
This ensures that you're testing the behavior the user would see in the browser. Learn more at https://reactjs.org/link/wrap-tests-with-act`,Zt(i))}finally{o?sr(i):Fr()}}}}function Ioe(i){i.tag!==Od&&F9()&&sl.current===null&&c(`A suspended resource finished loading inside a test, but the event was not wrapped in act(...).
|
|
225
225
|
|
|
226
226
|
When testing, code that resolves suspended data should be wrapped into act(...):
|
|
227
227
|
|
|
@@ -230,15 +230,15 @@ act(() => {
|
|
|
230
230
|
});
|
|
231
231
|
/* assert on the output */
|
|
232
232
|
|
|
233
|
-
This ensures that you're testing the behavior the user would see in the browser. Learn more at https://reactjs.org/link/wrap-tests-with-act`)}function P0(i){$9=i}var Ss=null,dg=null,
|
|
233
|
+
This ensures that you're testing the behavior the user would see in the browser. Learn more at https://reactjs.org/link/wrap-tests-with-act`)}function P0(i){$9=i}var Ss=null,dg=null,Uoe=function(i){Ss=i};function fg(i){{if(Ss===null)return i;var o=Ss(i);return o===void 0?i:o.current}}function RP(i){return fg(i)}function PP(i){{if(Ss===null)return i;var o=Ss(i);if(o===void 0){if(i!=null&&typeof i.render=="function"){var f=fg(i.render);if(i.render!==f){var m={$$typeof:Le,render:f};return i.displayName!==void 0&&(m.displayName=i.displayName),m}}return i}return o.current}}function lj(i,o){{if(Ss===null)return!1;var f=i.elementType,m=o.type,y=!1,C=typeof m=="object"&&m!==null?m.$$typeof:null;switch(i.tag){case v:{typeof m=="function"&&(y=!0);break}case p:{(typeof m=="function"||C===Jt)&&(y=!0);break}case j:{(C===Le||C===Jt)&&(y=!0);break}case ne:case X:{(C===gn||C===Jt)&&(y=!0);break}default:return!1}if(y){var w=Ss(f);if(w!==void 0&&w===Ss(m))return!0}return!1}}function uj(i){{if(Ss===null||typeof WeakSet!="function")return;dg===null&&(dg=new WeakSet),dg.add(i)}}var Foe=function(i,o){{if(Ss===null)return;var f=o.staleFamilies,m=o.updatedFamilies;cc(),uc(function(){DP(i.current,m,f)})}},joe=function(i,o){{if(i.context!==$o)return;cc(),uc(function(){D0(o,i,null,null)})}};function DP(i,o,f){{var m=i.alternate,y=i.child,C=i.sibling,w=i.tag,P=i.type,D=null;switch(w){case p:case X:case v:D=P;break;case j:D=P.render;break}if(Ss===null)throw new Error("Expected resolveFamily to be set during hot reload.");var F=!1,B=!1;if(D!==null){var ae=Ss(D);ae!==void 0&&(f.has(ae)?B=!0:o.has(ae)&&(w===v?B=!0:F=!0))}if(dg!==null&&(dg.has(i)||m!==null&&dg.has(m))&&(B=!0),B&&(i._debugNeedsRemount=!0),B||F){var re=wo(i,$t);re!==null&&Vi(re,i,$t,rr)}y!==null&&!B&&DP(y,o,f),C!==null&&DP(C,o,f)}}var Voe=function(i,o){{var f=new Set,m=new Set(o.map(function(y){return y.current}));return AP(i.current,m,f),f}};function AP(i,o,f){{var m=i.child,y=i.sibling,C=i.tag,w=i.type,P=null;switch(C){case p:case X:case v:P=w;break;case j:P=w.render;break}var D=!1;P!==null&&o.has(P)&&(D=!0),D?zoe(i,f):m!==null&&AP(m,o,f),y!==null&&AP(y,o,f)}}function zoe(i,o){{var f=Boe(i,o);if(f)return;for(var m=i;;){switch(m.tag){case E:o.add(m.stateNode);return;case T:o.add(m.stateNode.containerInfo);return;case k:o.add(m.stateNode.containerInfo);return}if(m.return===null)throw new Error("Expected to reach root first.");m=m.return}}}function Boe(i,o){for(var f=i,m=!1;;){if(f.tag===E)m=!0,o.add(f.stateNode);else if(f.child!==null){f.child.return=f,f=f.child;continue}if(f===i)return m;for(;f.sibling===null;){if(f.return===null||f.return===i)return m;f=f.return}f.sibling.return=f.return,f=f.sibling}return!1}var OP;{OP=!1;try{var cj=Object.preventExtensions({})}catch{OP=!0}}function Hoe(i,o,f,m){this.tag=i,this.key=f,this.elementType=null,this.type=null,this.stateNode=null,this.return=null,this.child=null,this.sibling=null,this.index=0,this.ref=null,this.pendingProps=o,this.memoizedProps=null,this.updateQueue=null,this.memoizedState=null,this.dependencies=null,this.mode=m,this.flags=Ot,this.subtreeFlags=Ot,this.deletions=null,this.lanes=Pe,this.childLanes=Pe,this.alternate=null,this.actualDuration=Number.NaN,this.actualStartTime=Number.NaN,this.selfBaseDuration=Number.NaN,this.treeBaseDuration=Number.NaN,this.actualDuration=0,this.actualStartTime=-1,this.selfBaseDuration=0,this.treeBaseDuration=0,this._debugSource=null,this._debugOwner=null,this._debugNeedsRemount=!1,this._debugHookTypes=null,!OP&&typeof Object.preventExtensions=="function"&&Object.preventExtensions(this)}var qo=function(i,o,f,m){return new Hoe(i,o,f,m)};function MP(i){var o=i.prototype;return!!(o&&o.isReactComponent)}function $oe(i){return typeof i=="function"&&!MP(i)&&i.defaultProps===void 0}function qoe(i){if(typeof i=="function")return MP(i)?v:p;if(i!=null){var o=i.$$typeof;if(o===Le)return j;if(o===gn)return ne}return b}function Oh(i,o){var f=i.alternate;f===null?(f=qo(i.tag,o,i.key,i.mode),f.elementType=i.elementType,f.type=i.type,f.stateNode=i.stateNode,f._debugSource=i._debugSource,f._debugOwner=i._debugOwner,f._debugHookTypes=i._debugHookTypes,f.alternate=i,i.alternate=f):(f.pendingProps=o,f.type=i.type,f.flags=Ot,f.subtreeFlags=Ot,f.deletions=null,f.actualDuration=0,f.actualStartTime=-1),f.flags=i.flags&ri,f.childLanes=i.childLanes,f.lanes=i.lanes,f.child=i.child,f.memoizedProps=i.memoizedProps,f.memoizedState=i.memoizedState,f.updateQueue=i.updateQueue;var m=i.dependencies;switch(f.dependencies=m===null?null:{lanes:m.lanes,firstContext:m.firstContext},f.sibling=i.sibling,f.index=i.index,f.ref=i.ref,f.selfBaseDuration=i.selfBaseDuration,f.treeBaseDuration=i.treeBaseDuration,f._debugNeedsRemount=i._debugNeedsRemount,f.tag){case b:case p:case X:f.type=fg(i.type);break;case v:f.type=RP(i.type);break;case j:f.type=PP(i.type);break}return f}function Woe(i,o){i.flags&=ri|jr;var f=i.alternate;if(f===null)i.childLanes=Pe,i.lanes=o,i.child=null,i.subtreeFlags=Ot,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null,i.selfBaseDuration=0,i.treeBaseDuration=0;else{i.childLanes=f.childLanes,i.lanes=f.lanes,i.child=f.child,i.subtreeFlags=Ot,i.deletions=null,i.memoizedProps=f.memoizedProps,i.memoizedState=f.memoizedState,i.updateQueue=f.updateQueue,i.type=f.type;var m=f.dependencies;i.dependencies=m===null?null:{lanes:m.lanes,firstContext:m.firstContext},i.selfBaseDuration=f.selfBaseDuration,i.treeBaseDuration=f.treeBaseDuration}return i}function Goe(i,o,f){var m;return i===fk?(m=vn,o===!0&&(m|=an,m|=cr)):m=Mt,Yi&&(m|=Rn),qo(k,null,null,m)}function LP(i,o,f,m,y,C){var w=b,P=i;if(typeof i=="function")MP(i)?(w=v,P=RP(P)):P=fg(P);else if(typeof i=="string")w=E;else e:switch(i){case jt:return qd(f.children,y,C,o);case Cn:w=A,y|=an,(y&vn)!==Mt&&(y|=cr);break;case er:return Yoe(f,y,C,o);case Xe:return Koe(f,y,C,o);case ot:return Zoe(f,y,C,o);case qr:return dj(f,y,C,o);case yr:case kn:case Cr:case $i:case cn:default:{if(typeof i=="object"&&i!==null)switch(i.$$typeof){case Er:w=V;break e;case K:w=U;break e;case Le:w=j,P=PP(P);break e;case gn:w=ne;break e;case Jt:w=se,P=null;break e}var D="";{(i===void 0||typeof i=="object"&&i!==null&&Object.keys(i).length===0)&&(D+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var F=m?Zt(m):null;F&&(D+=`
|
|
234
234
|
|
|
235
|
-
Check the render method of \``+F+"`.")}throw new Error("Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) "+("but got: "+(i==null?i:typeof i)+"."+D))}}var B=qo(w,f,o,y);return B.elementType=i,B.type=P,B.lanes=C,B._debugOwner=m,B}function NP(i,o,f){var m=null;m=i._owner;var y=i.type,C=i.key,w=i.props,P=LP(y,C,w,m,o,f);return P._debugSource=i._source,P._debugOwner=i._owner,P}function qd(i,o,f,m){var y=qo(M,i,m,o);return y.lanes=f,y}function
|
|
235
|
+
Check the render method of \``+F+"`.")}throw new Error("Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) "+("but got: "+(i==null?i:typeof i)+"."+D))}}var B=qo(w,f,o,y);return B.elementType=i,B.type=P,B.lanes=C,B._debugOwner=m,B}function NP(i,o,f){var m=null;m=i._owner;var y=i.type,C=i.key,w=i.props,P=LP(y,C,w,m,o,f);return P._debugSource=i._source,P._debugOwner=i._owner,P}function qd(i,o,f,m){var y=qo(M,i,m,o);return y.lanes=f,y}function Yoe(i,o,f,m){typeof i.id!="string"&&c('Profiler must specify an "id" of type `string` as a prop. Received the type `%s` instead.',typeof i.id);var y=qo(I,i,m,o|Rn);return y.elementType=er,y.lanes=f,y.stateNode={effectDuration:0,passiveEffectDuration:0},y}function Koe(i,o,f,m){var y=qo(N,i,m,o);return y.elementType=Xe,y.lanes=f,y}function Zoe(i,o,f,m){var y=qo(J,i,m,o);return y.elementType=ot,y.lanes=f,y}function dj(i,o,f,m){var y=qo(ke,i,m,o);y.elementType=qr,y.lanes=f;var C={isHidden:!1};return y.stateNode=C,y}function IP(i,o,f){var m=qo(R,i,null,o);return m.lanes=f,m}function Qoe(){var i=qo(E,null,null,Mt);return i.elementType="DELETED",i}function Xoe(i){var o=qo(oe,null,null,Mt);return o.stateNode=i,o}function UP(i,o,f){var m=i.children!==null?i.children:[],y=qo(T,m,i.key,o);return y.lanes=f,y.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},y}function fj(i,o){return i===null&&(i=qo(b,null,null,Mt)),i.tag=o.tag,i.key=o.key,i.elementType=o.elementType,i.type=o.type,i.stateNode=o.stateNode,i.return=o.return,i.child=o.child,i.sibling=o.sibling,i.index=o.index,i.ref=o.ref,i.pendingProps=o.pendingProps,i.memoizedProps=o.memoizedProps,i.updateQueue=o.updateQueue,i.memoizedState=o.memoizedState,i.dependencies=o.dependencies,i.mode=o.mode,i.flags=o.flags,i.subtreeFlags=o.subtreeFlags,i.deletions=o.deletions,i.lanes=o.lanes,i.childLanes=o.childLanes,i.alternate=o.alternate,i.actualDuration=o.actualDuration,i.actualStartTime=o.actualStartTime,i.selfBaseDuration=o.selfBaseDuration,i.treeBaseDuration=o.treeBaseDuration,i._debugSource=o._debugSource,i._debugOwner=o._debugOwner,i._debugNeedsRemount=o._debugNeedsRemount,i._debugHookTypes=o._debugHookTypes,i}function Joe(i,o,f,m,y){this.tag=o,this.containerInfo=i,this.pendingChildren=null,this.current=null,this.pingCache=null,this.finishedWork=null,this.timeoutHandle=yE,this.context=null,this.pendingContext=null,this.callbackNode=null,this.callbackPriority=ii,this.eventTimes=vm(Pe),this.expirationTimes=vm(rr),this.pendingLanes=Pe,this.suspendedLanes=Pe,this.pingedLanes=Pe,this.expiredLanes=Pe,this.mutableReadLanes=Pe,this.finishedLanes=Pe,this.entangledLanes=Pe,this.entanglements=vm(Pe),this.identifierPrefix=m,this.onRecoverableError=y,this.mutableSourceEagerHydrationData=null,this.effectDuration=0,this.passiveEffectDuration=0;{this.memoizedUpdaters=new Set;for(var C=this.pendingUpdatersLaneMap=[],w=0;w<cy;w++)C.push(new Set)}switch(o){case fk:this._debugRootType=f?"hydrateRoot()":"createRoot()";break;case Od:this._debugRootType=f?"hydrate()":"render()";break}}function hj(i,o,f,m,y,C,w,P,D,F){var B=new Joe(i,o,f,P,D),ae=Goe(o,C);B.current=ae,ae.stateNode=B;{var re={element:m,isDehydrated:f,cache:null,transitions:null,pendingSuspenseBoundaries:null};ae.memoizedState=re}return ZE(ae),B}var FP="18.3.1";function ese(i,o,f){var m=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;return Z(m),{$$typeof:Sn,key:m==null?null:""+m,children:i,containerInfo:o,implementation:f}}var jP,VP;jP=!1,VP={};function pj(i){if(!i)return $o;var o=ld(i),f=Ire(o);if(o.tag===v){var m=o.type;if(Xl(m))return zU(o,m,f)}return f}function tse(i,o){{var f=ld(i);if(f===void 0){if(typeof i.render=="function")throw new Error("Unable to find node on an unmounted component.");var m=Object.keys(i).join(",");throw new Error("Argument appears to not be a ReactComponent. Keys: "+m)}var y=Ea(f);if(y===null)return null;if(y.mode&an){var C=Zt(f)||"Component";if(!VP[C]){VP[C]=!0;var w=yi;try{sr(y),f.mode&an?c("%s is deprecated in StrictMode. %s was passed an instance of %s which is inside StrictMode. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-find-node",o,o,C):c("%s is deprecated in StrictMode. %s was passed an instance of %s which renders StrictMode children. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-find-node",o,o,C)}finally{w?sr(w):Fr()}}}return y.stateNode}}function mj(i,o,f,m,y,C,w,P){var D=!1,F=null;return hj(i,o,D,F,f,m,y,C,w)}function gj(i,o,f,m,y,C,w,P,D,F){var B=!0,ae=hj(f,m,B,i,y,C,w,P,D);ae.context=pj(null);var re=ae.current,ge=Za(),be=Hd(re),we=ac(ge,be);return we.callback=o??null,Nd(re,we,be),loe(ae,be,ge),ae}function D0(i,o,f,m){ty(o,i);var y=o.current,C=Za(),w=Hd(y);Yp(w);var P=pj(f);o.context===null?o.context=P:o.pendingContext=P,Ta&&yi!==null&&!jP&&(jP=!0,c(`Render methods should be a pure function of props and state; triggering nested component updates from render is not allowed. If necessary, trigger nested updates in componentDidUpdate.
|
|
236
236
|
|
|
237
|
-
Check the render method of %s.`,Zt(yi)||"Unknown"));var D=ac(C,w);D.payload={element:i},m=m===void 0?null:m,m!==null&&(typeof m!="function"&&c("render(...): Expected the last optional `callback` argument to be a function. Instead received: %s.",m),D.callback=m);var F=Nd(y,D,w);return F!==null&&(Vi(F,y,w,C),Ek(F,y,w)),w}function g1(i){var o=i.current;if(!o.child)return null;switch(o.child.tag){case E:return o.child.stateNode;default:return o.child.stateNode}}function
|
|
237
|
+
Check the render method of %s.`,Zt(yi)||"Unknown"));var D=ac(C,w);D.payload={element:i},m=m===void 0?null:m,m!==null&&(typeof m!="function"&&c("render(...): Expected the last optional `callback` argument to be a function. Instead received: %s.",m),D.callback=m);var F=Nd(y,D,w);return F!==null&&(Vi(F,y,w,C),Ek(F,y,w)),w}function g1(i){var o=i.current;if(!o.child)return null;switch(o.child.tag){case E:return o.child.stateNode;default:return o.child.stateNode}}function nse(i){switch(i.tag){case k:{var o=i.stateNode;if($u(o)){var f=yC(o);foe(o,f)}break}case N:{uc(function(){var y=wo(i,$t);if(y!==null){var C=Za();Vi(y,i,$t,C)}});var m=$t;zP(i,m);break}}}function vj(i,o){var f=i.memoizedState;f!==null&&f.dehydrated!==null&&(f.retryLane=gy(f.retryLane,o))}function zP(i,o){vj(i,o);var f=i.alternate;f&&vj(f,o)}function rse(i){if(i.tag===N){var o=vd,f=wo(i,o);if(f!==null){var m=Za();Vi(f,i,o,m)}zP(i,o)}}function ise(i){if(i.tag===N){var o=Hd(i),f=wo(i,o);if(f!==null){var m=Za();Vi(f,i,o,m)}zP(i,o)}}function yj(i){var o=Vo(i);return o===null?null:o.stateNode}var bj=function(i){return null};function ase(i){return bj(i)}var Sj=function(i){return!1};function ose(i){return Sj(i)}var Cj=null,kj=null,Tj=null,xj=null,wj=null,_j=null,Ej=null,Rj=null,Pj=null;{var Dj=function(i,o,f){var m=o[f],y=on(i)?i.slice():rn({},i);return f+1===o.length?(on(y)?y.splice(m,1):delete y[m],y):(y[m]=Dj(i[m],o,f+1),y)},Aj=function(i,o){return Dj(i,o,0)},Oj=function(i,o,f,m){var y=o[m],C=on(i)?i.slice():rn({},i);if(m+1===o.length){var w=f[m];C[w]=C[y],on(C)?C.splice(y,1):delete C[y]}else C[y]=Oj(i[y],o,f,m+1);return C},Mj=function(i,o,f){if(o.length!==f.length){l("copyWithRename() expects paths of the same length");return}else for(var m=0;m<f.length-1;m++)if(o[m]!==f[m]){l("copyWithRename() expects paths to be the same except for the deepest key");return}return Oj(i,o,f,0)},Lj=function(i,o,f,m){if(f>=o.length)return m;var y=o[f],C=on(i)?i.slice():rn({},i);return C[y]=Lj(i[y],o,f+1,m),C},Nj=function(i,o,f){return Lj(i,o,0,f)},BP=function(i,o){for(var f=i.memoizedState;f!==null&&o>0;)f=f.next,o--;return f};Cj=function(i,o,f,m){var y=BP(i,o);if(y!==null){var C=Nj(y.memoizedState,f,m);y.memoizedState=C,y.baseState=C,i.memoizedProps=rn({},i.memoizedProps);var w=wo(i,$t);w!==null&&Vi(w,i,$t,rr)}},kj=function(i,o,f){var m=BP(i,o);if(m!==null){var y=Aj(m.memoizedState,f);m.memoizedState=y,m.baseState=y,i.memoizedProps=rn({},i.memoizedProps);var C=wo(i,$t);C!==null&&Vi(C,i,$t,rr)}},Tj=function(i,o,f,m){var y=BP(i,o);if(y!==null){var C=Mj(y.memoizedState,f,m);y.memoizedState=C,y.baseState=C,i.memoizedProps=rn({},i.memoizedProps);var w=wo(i,$t);w!==null&&Vi(w,i,$t,rr)}},xj=function(i,o,f){i.pendingProps=Nj(i.memoizedProps,o,f),i.alternate&&(i.alternate.pendingProps=i.pendingProps);var m=wo(i,$t);m!==null&&Vi(m,i,$t,rr)},wj=function(i,o){i.pendingProps=Aj(i.memoizedProps,o),i.alternate&&(i.alternate.pendingProps=i.pendingProps);var f=wo(i,$t);f!==null&&Vi(f,i,$t,rr)},_j=function(i,o,f){i.pendingProps=Mj(i.memoizedProps,o,f),i.alternate&&(i.alternate.pendingProps=i.pendingProps);var m=wo(i,$t);m!==null&&Vi(m,i,$t,rr)},Ej=function(i){var o=wo(i,$t);o!==null&&Vi(o,i,$t,rr)},Rj=function(i){bj=i},Pj=function(i){Sj=i}}function sse(i){var o=Ea(i);return o===null?null:o.stateNode}function lse(i){return null}function use(){return yi}function cse(i){var o=i.findFiberByHostInstance,f=r.ReactCurrentDispatcher;return ey({bundleType:i.bundleType,version:i.version,rendererPackageName:i.rendererPackageName,rendererConfig:i.rendererConfig,overrideHookState:Cj,overrideHookStateDeletePath:kj,overrideHookStateRenamePath:Tj,overrideProps:xj,overridePropsDeletePath:wj,overridePropsRenamePath:_j,setErrorHandler:Rj,setSuspenseHandler:Pj,scheduleUpdate:Ej,currentDispatcherRef:f,findHostInstanceByFiber:sse,findFiberByHostInstance:o||lse,findHostInstancesForRefresh:Voe,scheduleRefresh:Foe,scheduleRoot:joe,setRefreshHandler:Uoe,getCurrentFiber:use,reconcilerVersion:FP})}var Ij=typeof reportError=="function"?reportError:function(i){console.error(i)};function HP(i){this._internalRoot=i}v1.prototype.render=HP.prototype.render=function(i){var o=this._internalRoot;if(o===null)throw new Error("Cannot update an unmounted root.");{typeof arguments[1]=="function"?c("render(...): does not support the second callback argument. To execute a side effect after rendering, declare it in a component body with useEffect()."):y1(arguments[1])?c("You passed a container to the second argument of root.render(...). You don't need to pass it again since you already passed it to create the root."):typeof arguments[1]<"u"&&c("You passed a second argument to root.render(...) but it only accepts one argument.");var f=o.containerInfo;if(f.nodeType!==ti){var m=yj(o.current);m&&m.parentNode!==f&&c("render(...): It looks like the React-rendered content of the root container was removed without using React. This is not supported and will cause errors. Instead, call root.unmount() to empty a root's container.")}}D0(i,o,null,null)},v1.prototype.unmount=HP.prototype.unmount=function(){typeof arguments[0]=="function"&&c("unmount(...): does not support a callback argument. To execute a side effect after rendering, declare it in a component body with useEffect().");var i=this._internalRoot;if(i!==null){this._internalRoot=null;var o=i.containerInfo;Y9()&&c("Attempted to synchronously unmount a root while React was already rendering. React cannot finish unmounting the root until the current render has completed, which may lead to a race condition."),uc(function(){D0(null,i,null,null)}),IU(o)}};function dse(i,o){if(!y1(i))throw new Error("createRoot(...): Target container is not a DOM element.");Uj(i);var f=!1,m=!1,y="",C=Ij;o!=null&&(o.hydrate?l("hydrate through createRoot is deprecated. Use ReactDOMClient.hydrateRoot(container, <App />) instead."):typeof o=="object"&&o!==null&&o.$$typeof===Ht&&c(`You passed a JSX element to createRoot. You probably meant to call root.render instead. Example usage:
|
|
238
238
|
|
|
239
239
|
let root = createRoot(domContainer);
|
|
240
|
-
root.render(<App />);`),o.unstable_strictMode===!0&&(f=!0),o.identifierPrefix!==void 0&&(y=o.identifierPrefix),o.onRecoverableError!==void 0&&(C=o.onRecoverableError),o.transitionCallbacks!==void 0&&o.transitionCallbacks);var w=mj(i,fk,null,f,m,y,C);ak(w.current,i);var P=i.nodeType===ti?i.parentNode:i;return Iy(P),new HP(w)}function v1(i){this._internalRoot=i}function
|
|
241
|
-
You might need to use a local HTTP server (instead of file://): https://reactjs.org/link/react-devtools-faq`:""),"font-weight:bold")}eo.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=qP,eo.createPortal=Cse,eo.createRoot=Tse,eo.findDOMNode=gse,eo.flushSync=wse,eo.hydrate=vse,eo.hydrateRoot=xse,eo.render=yse,eo.unmountComponentAtNode=Sse,eo.unstable_batchedUpdates=CP,eo.unstable_renderSubtreeIntoContainer=kse,eo.version=FP,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}(),eo}var rD={};function iD(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function")){if(rD.NODE_ENV!=="production")throw new Error("^_^");try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(iD)}catch(t){console.error(t)}}}rD.NODE_ENV==="production"?(iD(),k1.exports=Qj()):k1.exports=Xj();var aD=k1.exports,Jj={},bg=aD;if(Jj.NODE_ENV==="production")yg.createRoot=bg.createRoot,yg.hydrateRoot=bg.hydrateRoot;else{var L0=bg.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;yg.createRoot=function(t,e){L0.usingClientEntryPoint=!0;try{return bg.createRoot(t,e)}finally{L0.usingClientEntryPoint=!1}},yg.hydrateRoot=function(t,e,n){L0.usingClientEntryPoint=!0;try{return bg.hydrateRoot(t,e,n)}finally{L0.usingClientEntryPoint=!1}}}var oD={};function e6(t,e){return e.forEach(function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach(function(r){if(r!=="default"&&!(r in t)){var a=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:function(){return n[r]}})}})}),Object.freeze(t)}var t6=Object.defineProperty,n6=(t,e,n)=>e in t?t6(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,sD=(t,e,n)=>n6(t,typeof e!="symbol"?e+"":e,n);let to=class{constructor(){sD(this,"_locking"),sD(this,"_locks"),this._locking=Promise.resolve(),this._locks=0}isLocked(){return this._locks>0}lock(){this._locks+=1;let e;const n=new Promise(a=>e=()=>{this._locks-=1,a()}),r=this._locking.then(()=>e);return this._locking=this._locking.then(()=>n),r}};function Xr(t,e){if(!t)throw new Error(e)}const r6=34028234663852886e22,i6=-34028234663852886e22,a6=4294967295,o6=2147483647,s6=-2147483648;function N0(t){if(typeof t!="number")throw new Error("invalid int 32: "+typeof t);if(!Number.isInteger(t)||t>o6||t<s6)throw new Error("invalid int 32: "+t)}function w1(t){if(typeof t!="number")throw new Error("invalid uint 32: "+typeof t);if(!Number.isInteger(t)||t>a6||t<0)throw new Error("invalid uint 32: "+t)}function lD(t){if(typeof t!="number")throw new Error("invalid float 32: "+typeof t);if(Number.isFinite(t)&&(t>r6||t<i6))throw new Error("invalid float 32: "+t)}const uD=Symbol("@bufbuild/protobuf/enum-type");function l6(t){const e=t[uD];return Xr(e,"missing enum type on enum object"),e}function cD(t,e,n,r){t[uD]=dD(e,n.map(a=>({no:a.no,name:a.name,localName:t[a.no]})))}function dD(t,e,n){const r=Object.create(null),a=Object.create(null),s=[];for(const l of e){const c=fD(l);s.push(c),r[l.name]=c,a[l.no]=c}return{typeName:t,values:s,findName(l){return r[l]},findNumber(l){return a[l]}}}function u6(t,e,n){const r={};for(const a of e){const s=fD(a);r[s.localName]=s.no,r[s.no]=s.localName}return cD(r,t,e),r}function fD(t){return"localName"in t?t:Object.assign(Object.assign({},t),{localName:t.name})}class _1{equals(e){return this.getType().runtime.util.equals(this.getType(),this,e)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(e,n){const r=this.getType(),a=r.runtime.bin,s=a.makeReadOptions(n);return a.readMessage(this,s.readerFactory(e),e.byteLength,s),this}fromJson(e,n){const r=this.getType(),a=r.runtime.json,s=a.makeReadOptions(n);return a.readMessage(r,e,s,this),this}fromJsonString(e,n){let r;try{r=JSON.parse(e)}catch(a){throw new Error("cannot decode ".concat(this.getType().typeName," from JSON: ").concat(a instanceof Error?a.message:String(a)))}return this.fromJson(r,n)}toBinary(e){const n=this.getType(),r=n.runtime.bin,a=r.makeWriteOptions(e),s=a.writerFactory();return r.writeMessage(this,s,a),s.finish()}toJson(e){const n=this.getType(),r=n.runtime.json,a=r.makeWriteOptions(e);return r.writeMessage(this,a)}toJsonString(e){var n;const r=this.toJson(e);return JSON.stringify(r,null,(n=e==null?void 0:e.prettySpaces)!==null&&n!==void 0?n:0)}toJSON(){return this.toJson({emitDefaultValues:!0})}getType(){return Object.getPrototypeOf(this).constructor}}function c6(t,e,n,r){var a;const s=(a=r==null?void 0:r.localName)!==null&&a!==void 0?a:e.substring(e.lastIndexOf(".")+1),l={[s]:function(c){t.util.initFields(this),t.util.initPartial(c,this)}}[s];return Object.setPrototypeOf(l.prototype,new _1),Object.assign(l,{runtime:t,typeName:e,fields:t.util.newFieldList(n),fromBinary(c,h){return new l().fromBinary(c,h)},fromJson(c,h){return new l().fromJson(c,h)},fromJsonString(c,h){return new l().fromJsonString(c,h)},equals(c,h){return t.util.equals(l,c,h)}}),l}function d6(){let t=0,e=0;for(let r=0;r<28;r+=7){let a=this.buf[this.pos++];if(t|=(a&127)<<r,!(a&128))return this.assertBounds(),[t,e]}let n=this.buf[this.pos++];if(t|=(n&15)<<28,e=(n&112)>>4,!(n&128))return this.assertBounds(),[t,e];for(let r=3;r<=31;r+=7){let a=this.buf[this.pos++];if(e|=(a&127)<<r,!(a&128))return this.assertBounds(),[t,e]}throw new Error("invalid varint")}function E1(t,e,n){for(let s=0;s<28;s=s+7){const l=t>>>s,c=!(!(l>>>7)&&e==0),h=(c?l|128:l)&255;if(n.push(h),!c)return}const r=t>>>28&15|(e&7)<<4,a=!!(e>>3);if(n.push((a?r|128:r)&255),!!a){for(let s=3;s<31;s=s+7){const l=e>>>s,c=!!(l>>>7),h=(c?l|128:l)&255;if(n.push(h),!c)return}n.push(e>>>31&1)}}const I0=4294967296;function hD(t){const e=t[0]==="-";e&&(t=t.slice(1));const n=1e6;let r=0,a=0;function s(l,c){const h=Number(t.slice(l,c));a*=n,r=r*n+h,r>=I0&&(a=a+(r/I0|0),r=r%I0)}return s(-24,-18),s(-18,-12),s(-12,-6),s(-6),e?mD(r,a):R1(r,a)}function f6(t,e){let n=R1(t,e);const r=n.hi&2147483648;r&&(n=mD(n.lo,n.hi));const a=pD(n.lo,n.hi);return r?"-"+a:a}function pD(t,e){if({lo:t,hi:e}=h6(t,e),e<=2097151)return String(I0*e+t);const n=t&16777215,r=(t>>>24|e<<8)&16777215,a=e>>16&65535;let s=n+r*6777216+a*6710656,l=r+a*8147497,c=a*2;const h=1e7;return s>=h&&(l+=Math.floor(s/h),s%=h),l>=h&&(c+=Math.floor(l/h),l%=h),c.toString()+gD(l)+gD(s)}function h6(t,e){return{lo:t>>>0,hi:e>>>0}}function R1(t,e){return{lo:t|0,hi:e|0}}function mD(t,e){return e=~e,t?t=~t+1:e+=1,R1(t,e)}const gD=t=>{const e=String(t);return"0000000".slice(e.length)+e};function vD(t,e){if(t>=0){for(;t>127;)e.push(t&127|128),t=t>>>7;e.push(t)}else{for(let n=0;n<9;n++)e.push(t&127|128),t=t>>7;e.push(1)}}function p6(){let t=this.buf[this.pos++],e=t&127;if(!(t&128))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<7,!(t&128))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<14,!(t&128))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<21,!(t&128))return this.assertBounds(),e;t=this.buf[this.pos++],e|=(t&15)<<28;for(let n=5;t&128&&n<10;n++)t=this.buf[this.pos++];if(t&128)throw new Error("invalid varint");return this.assertBounds(),e>>>0}function m6(){const t=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof t.getBigInt64=="function"&&typeof t.getBigUint64=="function"&&typeof t.setBigInt64=="function"&&typeof t.setBigUint64=="function"&&(typeof process!="object"||typeof oD!="object"||oD.BUF_BIGINT_DISABLE!=="1")){const a=BigInt("-9223372036854775808"),s=BigInt("9223372036854775807"),l=BigInt("0"),c=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(h){const p=typeof h=="bigint"?h:BigInt(h);if(p>s||p<a)throw new Error("int64 invalid: ".concat(h));return p},uParse(h){const p=typeof h=="bigint"?h:BigInt(h);if(p>c||p<l)throw new Error("uint64 invalid: ".concat(h));return p},enc(h){return t.setBigInt64(0,this.parse(h),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},uEnc(h){return t.setBigInt64(0,this.uParse(h),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},dec(h,p){return t.setInt32(0,h,!0),t.setInt32(4,p,!0),t.getBigInt64(0,!0)},uDec(h,p){return t.setInt32(0,h,!0),t.setInt32(4,p,!0),t.getBigUint64(0,!0)}}}const n=a=>Xr(/^-?[0-9]+$/.test(a),"int64 invalid: ".concat(a)),r=a=>Xr(/^[0-9]+$/.test(a),"uint64 invalid: ".concat(a));return{zero:"0",supported:!1,parse(a){return typeof a!="string"&&(a=a.toString()),n(a),a},uParse(a){return typeof a!="string"&&(a=a.toString()),r(a),a},enc(a){return typeof a!="string"&&(a=a.toString()),n(a),hD(a)},uEnc(a){return typeof a!="string"&&(a=a.toString()),r(a),hD(a)},dec(a,s){return f6(a,s)},uDec(a,s){return pD(a,s)}}}const Ur=m6();var Ne;(function(t){t[t.DOUBLE=1]="DOUBLE",t[t.FLOAT=2]="FLOAT",t[t.INT64=3]="INT64",t[t.UINT64=4]="UINT64",t[t.INT32=5]="INT32",t[t.FIXED64=6]="FIXED64",t[t.FIXED32=7]="FIXED32",t[t.BOOL=8]="BOOL",t[t.STRING=9]="STRING",t[t.BYTES=12]="BYTES",t[t.UINT32=13]="UINT32",t[t.SFIXED32=15]="SFIXED32",t[t.SFIXED64=16]="SFIXED64",t[t.SINT32=17]="SINT32",t[t.SINT64=18]="SINT64"})(Ne||(Ne={}));var fc;(function(t){t[t.BIGINT=0]="BIGINT",t[t.STRING=1]="STRING"})(fc||(fc={}));function hc(t,e,n){if(e===n)return!0;if(t==Ne.BYTES){if(!(e instanceof Uint8Array)||!(n instanceof Uint8Array)||e.length!==n.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==n[r])return!1;return!0}switch(t){case Ne.UINT64:case Ne.FIXED64:case Ne.INT64:case Ne.SFIXED64:case Ne.SINT64:return e==n}return!1}function Mh(t,e){switch(t){case Ne.BOOL:return!1;case Ne.UINT64:case Ne.FIXED64:case Ne.INT64:case Ne.SFIXED64:case Ne.SINT64:return e==0?Ur.zero:"0";case Ne.DOUBLE:case Ne.FLOAT:return 0;case Ne.BYTES:return new Uint8Array(0);case Ne.STRING:return"";default:return 0}}function yD(t,e){switch(t){case Ne.BOOL:return e===!1;case Ne.STRING:return e==="";case Ne.BYTES:return e instanceof Uint8Array&&!e.byteLength;default:return e==0}}var si;(function(t){t[t.Varint=0]="Varint",t[t.Bit64=1]="Bit64",t[t.LengthDelimited=2]="LengthDelimited",t[t.StartGroup=3]="StartGroup",t[t.EndGroup=4]="EndGroup",t[t.Bit32=5]="Bit32"})(si||(si={}));class g6{constructor(e){this.stack=[],this.textEncoder=e??new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let a=0;a<this.chunks.length;a++)e+=this.chunks[a].length;let n=new Uint8Array(e),r=0;for(let a=0;a<this.chunks.length;a++)n.set(this.chunks[a],r),r+=this.chunks[a].length;return this.chunks=[],n}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),n=this.stack.pop();if(!n)throw new Error("invalid state, fork stack empty");return this.chunks=n.chunks,this.buf=n.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,n){return this.uint32((e<<3|n)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(w1(e);e>127;)this.buf.push(e&127|128),e=e>>>7;return this.buf.push(e),this}int32(e){return N0(e),vD(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let n=this.textEncoder.encode(e);return this.uint32(n.byteLength),this.raw(n)}float(e){lD(e);let n=new Uint8Array(4);return new DataView(n.buffer).setFloat32(0,e,!0),this.raw(n)}double(e){let n=new Uint8Array(8);return new DataView(n.buffer).setFloat64(0,e,!0),this.raw(n)}fixed32(e){w1(e);let n=new Uint8Array(4);return new DataView(n.buffer).setUint32(0,e,!0),this.raw(n)}sfixed32(e){N0(e);let n=new Uint8Array(4);return new DataView(n.buffer).setInt32(0,e,!0),this.raw(n)}sint32(e){return N0(e),e=(e<<1^e>>31)>>>0,vD(e,this.buf),this}sfixed64(e){let n=new Uint8Array(8),r=new DataView(n.buffer),a=Ur.enc(e);return r.setInt32(0,a.lo,!0),r.setInt32(4,a.hi,!0),this.raw(n)}fixed64(e){let n=new Uint8Array(8),r=new DataView(n.buffer),a=Ur.uEnc(e);return r.setInt32(0,a.lo,!0),r.setInt32(4,a.hi,!0),this.raw(n)}int64(e){let n=Ur.enc(e);return E1(n.lo,n.hi,this.buf),this}sint64(e){let n=Ur.enc(e),r=n.hi>>31,a=n.lo<<1^r,s=(n.hi<<1|n.lo>>>31)^r;return E1(a,s,this.buf),this}uint64(e){let n=Ur.uEnc(e);return E1(n.lo,n.hi,this.buf),this}}class v6{constructor(e,n){this.varint64=d6,this.uint32=p6,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=n??new TextDecoder}tag(){let e=this.uint32(),n=e>>>3,r=e&7;if(n<=0||r<0||r>5)throw new Error("illegal tag: field no "+n+" wire type "+r);return[n,r]}skip(e,n){let r=this.pos;switch(e){case si.Varint:for(;this.buf[this.pos++]&128;);break;case si.Bit64:this.pos+=4;case si.Bit32:this.pos+=4;break;case si.LengthDelimited:let a=this.uint32();this.pos+=a;break;case si.StartGroup:for(;;){const[s,l]=this.tag();if(l===si.EndGroup){if(n!==void 0&&s!==n)throw new Error("invalid end group tag");break}this.skip(l,s)}break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(r,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return Ur.dec(...this.varint64())}uint64(){return Ur.uDec(...this.varint64())}sint64(){let[e,n]=this.varint64(),r=-(e&1);return e=(e>>>1|(n&1)<<31)^r,n=n>>>1^r,Ur.dec(e,n)}bool(){let[e,n]=this.varint64();return e!==0||n!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return Ur.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Ur.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),n=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(n,n+e)}string(){return this.textDecoder.decode(this.bytes())}}function y6(t,e,n,r){let a;return{typeName:e,extendee:n,get field(){if(!a){const s=typeof r=="function"?r():r;s.name=e.split(".").pop(),s.jsonName="[".concat(e,"]"),a=t.util.newFieldList([s]).list()[0]}return a},runtime:t}}function bD(t){const e=t.field.localName,n=Object.create(null);return n[e]=b6(t),[n,()=>n[e]]}function b6(t){const e=t.field;if(e.repeated)return[];if(e.default!==void 0)return e.default;switch(e.kind){case"enum":return e.T.values[0].no;case"scalar":return Mh(e.T,e.L);case"message":const n=e.T,r=new n;return n.fieldWrapper?n.fieldWrapper.unwrapField(r):r;case"map":throw"map fields are not allowed to be extensions"}}function S6(t,e){if(!e.repeated&&(e.kind=="enum"||e.kind=="scalar")){for(let n=t.length-1;n>=0;--n)if(t[n].no==e.no)return[t[n]];return[]}return t.filter(n=>n.no===e.no)}let su="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),U0=[];for(let t=0;t<su.length;t++)U0[su[t].charCodeAt(0)]=t;U0[45]=su.indexOf("+"),U0[95]=su.indexOf("/");const SD={dec(t){let e=t.length*3/4;t[t.length-2]=="="?e-=2:t[t.length-1]=="="&&(e-=1);let n=new Uint8Array(e),r=0,a=0,s,l=0;for(let c=0;c<t.length;c++){if(s=U0[t.charCodeAt(c)],s===void 0)switch(t[c]){case"=":a=0;case`
|
|
240
|
+
root.render(<App />);`),o.unstable_strictMode===!0&&(f=!0),o.identifierPrefix!==void 0&&(y=o.identifierPrefix),o.onRecoverableError!==void 0&&(C=o.onRecoverableError),o.transitionCallbacks!==void 0&&o.transitionCallbacks);var w=mj(i,fk,null,f,m,y,C);ak(w.current,i);var P=i.nodeType===ti?i.parentNode:i;return Iy(P),new HP(w)}function v1(i){this._internalRoot=i}function fse(i){i&&PC(i)}v1.prototype.unstable_scheduleHydration=fse;function hse(i,o,f){if(!y1(i))throw new Error("hydrateRoot(...): Target container is not a DOM element.");Uj(i),o===void 0&&c("Must provide initial children as second argument to hydrateRoot. Example usage: hydrateRoot(domContainer, <App />)");var m=f??null,y=f!=null&&f.hydratedSources||null,C=!1,w=!1,P="",D=Ij;f!=null&&(f.unstable_strictMode===!0&&(C=!0),f.identifierPrefix!==void 0&&(P=f.identifierPrefix),f.onRecoverableError!==void 0&&(D=f.onRecoverableError));var F=gj(o,null,i,fk,m,C,w,P,D);if(ak(F.current,i),Iy(i),y)for(var B=0;B<y.length;B++){var ae=y[B];vie(F,ae)}return new v1(F)}function y1(i){return!!(i&&(i.nodeType===xa||i.nodeType===$s||i.nodeType===xf))}function A0(i){return!!(i&&(i.nodeType===xa||i.nodeType===$s||i.nodeType===xf||i.nodeType===ti&&i.nodeValue===" react-mount-point-unstable "))}function Uj(i){i.nodeType===xa&&i.tagName&&i.tagName.toUpperCase()==="BODY"&&c("createRoot(): Creating roots directly with document.body is discouraged, since its children are often manipulated by third-party scripts and browser extensions. This may lead to subtle reconciliation issues. Try using a container element created for your app."),Gy(i)&&(i._reactRootContainer?c("You are calling ReactDOMClient.createRoot() on a container that was previously passed to ReactDOM.render(). This is not supported."):c("You are calling ReactDOMClient.createRoot() on a container that has already been passed to createRoot() before. Instead, call root.render() on the existing root instead if you want to update it."))}var pse=r.ReactCurrentOwner,Fj;Fj=function(i){if(i._reactRootContainer&&i.nodeType!==ti){var o=yj(i._reactRootContainer.current);o&&o.parentNode!==i&&c("render(...): It looks like the React-rendered content of this container was removed without using React. This is not supported and will cause errors. Instead, call ReactDOM.unmountComponentAtNode to empty a container.")}var f=!!i._reactRootContainer,m=$P(i),y=!!(m&&Dd(m));y&&!f&&c("render(...): Replacing React-rendered children with a new root component. If you intended to update the children of this node, you should instead have the existing children update their state and render the new components instead of calling ReactDOM.render."),i.nodeType===xa&&i.tagName&&i.tagName.toUpperCase()==="BODY"&&c("render(): Rendering components directly into document.body is discouraged, since its children are often manipulated by third-party scripts and browser extensions. This may lead to subtle reconciliation issues. Try rendering into a container element created for your app.")};function $P(i){return i?i.nodeType===$s?i.documentElement:i.firstChild:null}function jj(){}function mse(i,o,f,m,y){if(y){if(typeof m=="function"){var C=m;m=function(){var re=g1(w);C.call(re)}}var w=gj(o,m,i,Od,null,!1,!1,"",jj);i._reactRootContainer=w,ak(w.current,i);var P=i.nodeType===ti?i.parentNode:i;return Iy(P),uc(),w}else{for(var D;D=i.lastChild;)i.removeChild(D);if(typeof m=="function"){var F=m;m=function(){var re=g1(B);F.call(re)}}var B=mj(i,Od,null,!1,!1,"",jj);i._reactRootContainer=B,ak(B.current,i);var ae=i.nodeType===ti?i.parentNode:i;return Iy(ae),uc(function(){D0(o,B,f,m)}),B}}function gse(i,o){i!==null&&typeof i!="function"&&c("%s(...): Expected the last optional `callback` argument to be a function. Instead received: %s.",o,i)}function b1(i,o,f,m,y){Fj(f),gse(y===void 0?null:y,"render");var C=f._reactRootContainer,w;if(!C)w=mse(f,o,i,y,m);else{if(w=C,typeof y=="function"){var P=y;y=function(){var D=g1(w);P.call(D)}}D0(o,w,i,y)}return g1(w)}var Vj=!1;function vse(i){{Vj||(Vj=!0,c("findDOMNode is deprecated and will be removed in the next major release. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-find-node"));var o=pse.current;if(o!==null&&o.stateNode!==null){var f=o.stateNode._warnedAboutRefsInRender;f||c("%s is accessing findDOMNode inside its render(). render() should be a pure function of props and state. It should never access something that requires stale data from the previous render, such as refs. Move this logic to componentDidMount and componentDidUpdate instead.",On(o.type)||"A component"),o.stateNode._warnedAboutRefsInRender=!0}}return i==null?null:i.nodeType===xa?i:tse(i,"findDOMNode")}function yse(i,o,f){if(c("ReactDOM.hydrate is no longer supported in React 18. Use hydrateRoot instead. Until you switch to the new API, your app will behave as if it's running React 17. Learn more: https://reactjs.org/link/switch-to-createroot"),!A0(o))throw new Error("Target container is not a DOM element.");{var m=Gy(o)&&o._reactRootContainer===void 0;m&&c("You are calling ReactDOM.hydrate() on a container that was previously passed to ReactDOMClient.createRoot(). This is not supported. Did you mean to call hydrateRoot(container, element)?")}return b1(null,i,o,!0,f)}function bse(i,o,f){if(c("ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API, your app will behave as if it's running React 17. Learn more: https://reactjs.org/link/switch-to-createroot"),!A0(o))throw new Error("Target container is not a DOM element.");{var m=Gy(o)&&o._reactRootContainer===void 0;m&&c("You are calling ReactDOM.render() on a container that was previously passed to ReactDOMClient.createRoot(). This is not supported. Did you mean to call root.render(element)?")}return b1(null,i,o,!1,f)}function Sse(i,o,f,m){if(c("ReactDOM.unstable_renderSubtreeIntoContainer() is no longer supported in React 18. Consider using a portal instead. Until you switch to the createRoot API, your app will behave as if it's running React 17. Learn more: https://reactjs.org/link/switch-to-createroot"),!A0(f))throw new Error("Target container is not a DOM element.");if(i==null||!Mu(i))throw new Error("parentComponent must be a valid React Component");return b1(i,o,f,!1,m)}var zj=!1;function Cse(i){if(zj||(zj=!0,c("unmountComponentAtNode is deprecated and will be removed in the next major release. Switch to the createRoot API. Learn more: https://reactjs.org/link/switch-to-createroot")),!A0(i))throw new Error("unmountComponentAtNode(...): Target container is not a DOM element.");{var o=Gy(i)&&i._reactRootContainer===void 0;o&&c("You are calling ReactDOM.unmountComponentAtNode() on a container that was previously passed to ReactDOMClient.createRoot(). This is not supported. Did you mean to call root.unmount()?")}if(i._reactRootContainer){{var f=$P(i),m=f&&!Dd(f);m&&c("unmountComponentAtNode(): The node you're attempting to unmount was rendered by another copy of React.")}return uc(function(){b1(null,null,i,!1,function(){i._reactRootContainer=null,IU(i)})}),!0}else{{var y=$P(i),C=!!(y&&Dd(y)),w=i.nodeType===xa&&A0(i.parentNode)&&!!i.parentNode._reactRootContainer;C&&c("unmountComponentAtNode(): The node you're attempting to unmount was rendered by React and is not a top-level container. %s",w?"You may have accidentally passed in a React root node instead of its container.":"Instead, have the parent component update its state and rerender in order to remove this component.")}return!1}}$_(nse),Sy(rse),q_(ise),km($a),wC(TC),(typeof Map!="function"||Map.prototype==null||typeof Map.prototype.forEach!="function"||typeof Set!="function"||Set.prototype==null||typeof Set.prototype.clear!="function"||typeof Set.prototype.forEach!="function")&&c("React depends on Map and Set built-in types. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"),Mf(Tne),rC(CP,hoe,uc);function kse(i,o){var f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;if(!y1(o))throw new Error("Target container is not a DOM element.");return ese(i,o,null,f)}function Tse(i,o,f,m){return Sse(i,o,f,m)}var qP={usingClientEntryPoint:!1,Events:[Dd,Hm,ok,$v,id,CP]};function xse(i,o){return qP.usingClientEntryPoint||c('You are importing createRoot from "react-dom" which is not supported. You should instead import it from "react-dom/client".'),dse(i,o)}function wse(i,o,f){return qP.usingClientEntryPoint||c('You are importing hydrateRoot from "react-dom" which is not supported. You should instead import it from "react-dom/client".'),hse(i,o,f)}function _se(i){return Y9()&&c("flushSync was called from inside a lifecycle method. React cannot flush when React is already rendering. Consider moving this call to a scheduler task or micro task."),uc(i)}var Ese=cse({findFiberByHostInstance:vh,bundleType:1,version:FP,rendererPackageName:"react-dom"});if(!Ese&&_r&&window.top===window.self&&(navigator.userAgent.indexOf("Chrome")>-1&&navigator.userAgent.indexOf("Edge")===-1||navigator.userAgent.indexOf("Firefox")>-1)){var Bj=window.location.protocol;/^(https?|file):$/.test(Bj)&&console.info("%cDownload the React DevTools for a better development experience: https://reactjs.org/link/react-devtools"+(Bj==="file:"?`
|
|
241
|
+
You might need to use a local HTTP server (instead of file://): https://reactjs.org/link/react-devtools-faq`:""),"font-weight:bold")}eo.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=qP,eo.createPortal=kse,eo.createRoot=xse,eo.findDOMNode=vse,eo.flushSync=_se,eo.hydrate=yse,eo.hydrateRoot=wse,eo.render=bse,eo.unmountComponentAtNode=Cse,eo.unstable_batchedUpdates=CP,eo.unstable_renderSubtreeIntoContainer=Tse,eo.version=FP,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}(),eo}var rD={};function iD(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function")){if(rD.NODE_ENV!=="production")throw new Error("^_^");try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(iD)}catch(t){console.error(t)}}}rD.NODE_ENV==="production"?(iD(),k1.exports=Qj()):k1.exports=Xj();var aD=k1.exports,Jj={},bg=aD;if(Jj.NODE_ENV==="production")yg.createRoot=bg.createRoot,yg.hydrateRoot=bg.hydrateRoot;else{var L0=bg.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;yg.createRoot=function(t,e){L0.usingClientEntryPoint=!0;try{return bg.createRoot(t,e)}finally{L0.usingClientEntryPoint=!1}},yg.hydrateRoot=function(t,e,n){L0.usingClientEntryPoint=!0;try{return bg.hydrateRoot(t,e,n)}finally{L0.usingClientEntryPoint=!1}}}var oD={};function e6(t,e){return e.forEach(function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach(function(r){if(r!=="default"&&!(r in t)){var a=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:function(){return n[r]}})}})}),Object.freeze(t)}var t6=Object.defineProperty,n6=(t,e,n)=>e in t?t6(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,sD=(t,e,n)=>n6(t,typeof e!="symbol"?e+"":e,n);let to=class{constructor(){sD(this,"_locking"),sD(this,"_locks"),this._locking=Promise.resolve(),this._locks=0}isLocked(){return this._locks>0}lock(){this._locks+=1;let e;const n=new Promise(a=>e=()=>{this._locks-=1,a()}),r=this._locking.then(()=>e);return this._locking=this._locking.then(()=>n),r}};function Xr(t,e){if(!t)throw new Error(e)}const r6=34028234663852886e22,i6=-34028234663852886e22,a6=4294967295,o6=2147483647,s6=-2147483648;function N0(t){if(typeof t!="number")throw new Error("invalid int 32: "+typeof t);if(!Number.isInteger(t)||t>o6||t<s6)throw new Error("invalid int 32: "+t)}function w1(t){if(typeof t!="number")throw new Error("invalid uint 32: "+typeof t);if(!Number.isInteger(t)||t>a6||t<0)throw new Error("invalid uint 32: "+t)}function lD(t){if(typeof t!="number")throw new Error("invalid float 32: "+typeof t);if(Number.isFinite(t)&&(t>r6||t<i6))throw new Error("invalid float 32: "+t)}const uD=Symbol("@bufbuild/protobuf/enum-type");function l6(t){const e=t[uD];return Xr(e,"missing enum type on enum object"),e}function cD(t,e,n,r){t[uD]=dD(e,n.map(a=>({no:a.no,name:a.name,localName:t[a.no]})))}function dD(t,e,n){const r=Object.create(null),a=Object.create(null),s=[];for(const l of e){const c=fD(l);s.push(c),r[l.name]=c,a[l.no]=c}return{typeName:t,values:s,findName(l){return r[l]},findNumber(l){return a[l]}}}function u6(t,e,n){const r={};for(const a of e){const s=fD(a);r[s.localName]=s.no,r[s.no]=s.localName}return cD(r,t,e),r}function fD(t){return"localName"in t?t:Object.assign(Object.assign({},t),{localName:t.name})}class _1{equals(e){return this.getType().runtime.util.equals(this.getType(),this,e)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(e,n){const r=this.getType(),a=r.runtime.bin,s=a.makeReadOptions(n);return a.readMessage(this,s.readerFactory(e),e.byteLength,s),this}fromJson(e,n){const r=this.getType(),a=r.runtime.json,s=a.makeReadOptions(n);return a.readMessage(r,e,s,this),this}fromJsonString(e,n){let r;try{r=JSON.parse(e)}catch(a){throw new Error("cannot decode ".concat(this.getType().typeName," from JSON: ").concat(a instanceof Error?a.message:String(a)))}return this.fromJson(r,n)}toBinary(e){const n=this.getType(),r=n.runtime.bin,a=r.makeWriteOptions(e),s=a.writerFactory();return r.writeMessage(this,s,a),s.finish()}toJson(e){const n=this.getType(),r=n.runtime.json,a=r.makeWriteOptions(e);return r.writeMessage(this,a)}toJsonString(e){var n;const r=this.toJson(e);return JSON.stringify(r,null,(n=e==null?void 0:e.prettySpaces)!==null&&n!==void 0?n:0)}toJSON(){return this.toJson({emitDefaultValues:!0})}getType(){return Object.getPrototypeOf(this).constructor}}function c6(t,e,n,r){var a;const s=(a=r==null?void 0:r.localName)!==null&&a!==void 0?a:e.substring(e.lastIndexOf(".")+1),l={[s]:function(c){t.util.initFields(this),t.util.initPartial(c,this)}}[s];return Object.setPrototypeOf(l.prototype,new _1),Object.assign(l,{runtime:t,typeName:e,fields:t.util.newFieldList(n),fromBinary(c,h){return new l().fromBinary(c,h)},fromJson(c,h){return new l().fromJson(c,h)},fromJsonString(c,h){return new l().fromJsonString(c,h)},equals(c,h){return t.util.equals(l,c,h)}}),l}function d6(){let t=0,e=0;for(let r=0;r<28;r+=7){let a=this.buf[this.pos++];if(t|=(a&127)<<r,!(a&128))return this.assertBounds(),[t,e]}let n=this.buf[this.pos++];if(t|=(n&15)<<28,e=(n&112)>>4,!(n&128))return this.assertBounds(),[t,e];for(let r=3;r<=31;r+=7){let a=this.buf[this.pos++];if(e|=(a&127)<<r,!(a&128))return this.assertBounds(),[t,e]}throw new Error("invalid varint")}function E1(t,e,n){for(let s=0;s<28;s=s+7){const l=t>>>s,c=!(!(l>>>7)&&e==0),h=(c?l|128:l)&255;if(n.push(h),!c)return}const r=t>>>28&15|(e&7)<<4,a=!!(e>>3);if(n.push((a?r|128:r)&255),!!a){for(let s=3;s<31;s=s+7){const l=e>>>s,c=!!(l>>>7),h=(c?l|128:l)&255;if(n.push(h),!c)return}n.push(e>>>31&1)}}const I0=4294967296;function hD(t){const e=t[0]==="-";e&&(t=t.slice(1));const n=1e6;let r=0,a=0;function s(l,c){const h=Number(t.slice(l,c));a*=n,r=r*n+h,r>=I0&&(a=a+(r/I0|0),r=r%I0)}return s(-24,-18),s(-18,-12),s(-12,-6),s(-6),e?mD(r,a):R1(r,a)}function f6(t,e){let n=R1(t,e);const r=n.hi&2147483648;r&&(n=mD(n.lo,n.hi));const a=pD(n.lo,n.hi);return r?"-"+a:a}function pD(t,e){if({lo:t,hi:e}=h6(t,e),e<=2097151)return String(I0*e+t);const n=t&16777215,r=(t>>>24|e<<8)&16777215,a=e>>16&65535;let s=n+r*6777216+a*6710656,l=r+a*8147497,c=a*2;const h=1e7;return s>=h&&(l+=Math.floor(s/h),s%=h),l>=h&&(c+=Math.floor(l/h),l%=h),c.toString()+gD(l)+gD(s)}function h6(t,e){return{lo:t>>>0,hi:e>>>0}}function R1(t,e){return{lo:t|0,hi:e|0}}function mD(t,e){return e=~e,t?t=~t+1:e+=1,R1(t,e)}const gD=t=>{const e=String(t);return"0000000".slice(e.length)+e};function vD(t,e){if(t>=0){for(;t>127;)e.push(t&127|128),t=t>>>7;e.push(t)}else{for(let n=0;n<9;n++)e.push(t&127|128),t=t>>7;e.push(1)}}function p6(){let t=this.buf[this.pos++],e=t&127;if(!(t&128))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<7,!(t&128))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<14,!(t&128))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<21,!(t&128))return this.assertBounds(),e;t=this.buf[this.pos++],e|=(t&15)<<28;for(let n=5;t&128&&n<10;n++)t=this.buf[this.pos++];if(t&128)throw new Error("invalid varint");return this.assertBounds(),e>>>0}function m6(){const t=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof t.getBigInt64=="function"&&typeof t.getBigUint64=="function"&&typeof t.setBigInt64=="function"&&typeof t.setBigUint64=="function"&&(typeof process!="object"||typeof oD!="object"||oD.BUF_BIGINT_DISABLE!=="1")){const a=BigInt("-9223372036854775808"),s=BigInt("9223372036854775807"),l=BigInt("0"),c=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(h){const p=typeof h=="bigint"?h:BigInt(h);if(p>s||p<a)throw new Error("int64 invalid: ".concat(h));return p},uParse(h){const p=typeof h=="bigint"?h:BigInt(h);if(p>c||p<l)throw new Error("uint64 invalid: ".concat(h));return p},enc(h){return t.setBigInt64(0,this.parse(h),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},uEnc(h){return t.setBigInt64(0,this.uParse(h),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},dec(h,p){return t.setInt32(0,h,!0),t.setInt32(4,p,!0),t.getBigInt64(0,!0)},uDec(h,p){return t.setInt32(0,h,!0),t.setInt32(4,p,!0),t.getBigUint64(0,!0)}}}const n=a=>Xr(/^-?[0-9]+$/.test(a),"int64 invalid: ".concat(a)),r=a=>Xr(/^[0-9]+$/.test(a),"uint64 invalid: ".concat(a));return{zero:"0",supported:!1,parse(a){return typeof a!="string"&&(a=a.toString()),n(a),a},uParse(a){return typeof a!="string"&&(a=a.toString()),r(a),a},enc(a){return typeof a!="string"&&(a=a.toString()),n(a),hD(a)},uEnc(a){return typeof a!="string"&&(a=a.toString()),r(a),hD(a)},dec(a,s){return f6(a,s)},uDec(a,s){return pD(a,s)}}}const Ur=m6();var Ne;(function(t){t[t.DOUBLE=1]="DOUBLE",t[t.FLOAT=2]="FLOAT",t[t.INT64=3]="INT64",t[t.UINT64=4]="UINT64",t[t.INT32=5]="INT32",t[t.FIXED64=6]="FIXED64",t[t.FIXED32=7]="FIXED32",t[t.BOOL=8]="BOOL",t[t.STRING=9]="STRING",t[t.BYTES=12]="BYTES",t[t.UINT32=13]="UINT32",t[t.SFIXED32=15]="SFIXED32",t[t.SFIXED64=16]="SFIXED64",t[t.SINT32=17]="SINT32",t[t.SINT64=18]="SINT64"})(Ne||(Ne={}));var fc;(function(t){t[t.BIGINT=0]="BIGINT",t[t.STRING=1]="STRING"})(fc||(fc={}));function hc(t,e,n){if(e===n)return!0;if(t==Ne.BYTES){if(!(e instanceof Uint8Array)||!(n instanceof Uint8Array)||e.length!==n.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==n[r])return!1;return!0}switch(t){case Ne.UINT64:case Ne.FIXED64:case Ne.INT64:case Ne.SFIXED64:case Ne.SINT64:return e==n}return!1}function Mh(t,e){switch(t){case Ne.BOOL:return!1;case Ne.UINT64:case Ne.FIXED64:case Ne.INT64:case Ne.SFIXED64:case Ne.SINT64:return e==0?Ur.zero:"0";case Ne.DOUBLE:case Ne.FLOAT:return 0;case Ne.BYTES:return new Uint8Array(0);case Ne.STRING:return"";default:return 0}}function yD(t,e){switch(t){case Ne.BOOL:return e===!1;case Ne.STRING:return e==="";case Ne.BYTES:return e instanceof Uint8Array&&!e.byteLength;default:return e==0}}var si;(function(t){t[t.Varint=0]="Varint",t[t.Bit64=1]="Bit64",t[t.LengthDelimited=2]="LengthDelimited",t[t.StartGroup=3]="StartGroup",t[t.EndGroup=4]="EndGroup",t[t.Bit32=5]="Bit32"})(si||(si={}));class g6{constructor(e){this.stack=[],this.textEncoder=e??new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let a=0;a<this.chunks.length;a++)e+=this.chunks[a].length;let n=new Uint8Array(e),r=0;for(let a=0;a<this.chunks.length;a++)n.set(this.chunks[a],r),r+=this.chunks[a].length;return this.chunks=[],n}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),n=this.stack.pop();if(!n)throw new Error("invalid state, fork stack empty");return this.chunks=n.chunks,this.buf=n.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,n){return this.uint32((e<<3|n)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(w1(e);e>127;)this.buf.push(e&127|128),e=e>>>7;return this.buf.push(e),this}int32(e){return N0(e),vD(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let n=this.textEncoder.encode(e);return this.uint32(n.byteLength),this.raw(n)}float(e){lD(e);let n=new Uint8Array(4);return new DataView(n.buffer).setFloat32(0,e,!0),this.raw(n)}double(e){let n=new Uint8Array(8);return new DataView(n.buffer).setFloat64(0,e,!0),this.raw(n)}fixed32(e){w1(e);let n=new Uint8Array(4);return new DataView(n.buffer).setUint32(0,e,!0),this.raw(n)}sfixed32(e){N0(e);let n=new Uint8Array(4);return new DataView(n.buffer).setInt32(0,e,!0),this.raw(n)}sint32(e){return N0(e),e=(e<<1^e>>31)>>>0,vD(e,this.buf),this}sfixed64(e){let n=new Uint8Array(8),r=new DataView(n.buffer),a=Ur.enc(e);return r.setInt32(0,a.lo,!0),r.setInt32(4,a.hi,!0),this.raw(n)}fixed64(e){let n=new Uint8Array(8),r=new DataView(n.buffer),a=Ur.uEnc(e);return r.setInt32(0,a.lo,!0),r.setInt32(4,a.hi,!0),this.raw(n)}int64(e){let n=Ur.enc(e);return E1(n.lo,n.hi,this.buf),this}sint64(e){let n=Ur.enc(e),r=n.hi>>31,a=n.lo<<1^r,s=(n.hi<<1|n.lo>>>31)^r;return E1(a,s,this.buf),this}uint64(e){let n=Ur.uEnc(e);return E1(n.lo,n.hi,this.buf),this}}class v6{constructor(e,n){this.varint64=d6,this.uint32=p6,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=n??new TextDecoder}tag(){let e=this.uint32(),n=e>>>3,r=e&7;if(n<=0||r<0||r>5)throw new Error("illegal tag: field no "+n+" wire type "+r);return[n,r]}skip(e,n){let r=this.pos;switch(e){case si.Varint:for(;this.buf[this.pos++]&128;);break;case si.Bit64:this.pos+=4;case si.Bit32:this.pos+=4;break;case si.LengthDelimited:let a=this.uint32();this.pos+=a;break;case si.StartGroup:for(;;){const[s,l]=this.tag();if(l===si.EndGroup){if(n!==void 0&&s!==n)throw new Error("invalid end group tag");break}this.skip(l,s)}break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(r,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return Ur.dec(...this.varint64())}uint64(){return Ur.uDec(...this.varint64())}sint64(){let[e,n]=this.varint64(),r=-(e&1);return e=(e>>>1|(n&1)<<31)^r,n=n>>>1^r,Ur.dec(e,n)}bool(){let[e,n]=this.varint64();return e!==0||n!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return Ur.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Ur.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),n=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(n,n+e)}string(){return this.textDecoder.decode(this.bytes())}}function y6(t,e,n,r){let a;return{typeName:e,extendee:n,get field(){if(!a){const s=typeof r=="function"?r():r;s.name=e.split(".").pop(),s.jsonName="[".concat(e,"]"),a=t.util.newFieldList([s]).list()[0]}return a},runtime:t}}function bD(t){const e=t.field.localName,n=Object.create(null);return n[e]=b6(t),[n,()=>n[e]]}function b6(t){const e=t.field;if(e.repeated)return[];if(e.default!==void 0)return e.default;switch(e.kind){case"enum":return e.T.values[0].no;case"scalar":return Mh(e.T,e.L);case"message":const n=e.T,r=new n;return n.fieldWrapper?n.fieldWrapper.unwrapField(r):r;case"map":throw"map fields are not allowed to be extensions"}}function S6(t,e){if(!e.repeated&&(e.kind=="enum"||e.kind=="scalar")){for(let n=t.length-1;n>=0;--n)if(t[n].no==e.no)return[t[n]];return[]}return t.filter(n=>n.no===e.no)}let su="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),U0=[];for(let t=0;t<su.length;t++)U0[su[t].charCodeAt(0)]=t;U0[45]=su.indexOf("+"),U0[95]=su.indexOf("/");const SD={dec(t){let e=t.length*3/4;t[t.length-2]=="="?e-=2:t[t.length-1]=="="&&(e-=1);let n=new Uint8Array(e),r=0,a=0,s,l=0;for(let c=0;c<t.length;c++){if(s=U0[t.charCodeAt(c)],s===void 0)switch(t[c]){case"=":a=0;case`
|
|
242
242
|
`:case"\r":case" ":case" ":continue;default:throw Error("invalid base64 string.")}switch(a){case 0:l=s,a=1;break;case 1:n[r++]=l<<2|(s&48)>>4,l=s,a=2;break;case 2:n[r++]=(l&15)<<4|(s&60)>>2,l=s,a=3;break;case 3:n[r++]=(l&3)<<6|s,a=0;break}}if(a==1)throw Error("invalid base64 string.");return n.subarray(0,r)},enc(t){let e="",n=0,r,a=0;for(let s=0;s<t.length;s++)switch(r=t[s],n){case 0:e+=su[r>>2],a=(r&3)<<4,n=1;break;case 1:e+=su[a|r>>4],a=(r&15)<<2,n=2;break;case 2:e+=su[a|r>>6],e+=su[r&63],n=0;break}return n&&(e+=su[a],e+="=",n==1&&(e+="=")),e}};function C6(t,e,n){kD(e,t);const r=e.runtime.bin.makeReadOptions(n),a=S6(t.getType().runtime.bin.listUnknownFields(t),e.field),[s,l]=bD(e);for(const c of a)e.runtime.bin.readField(s,r.readerFactory(c.data),e.field,c.wireType,r);return l()}function k6(t,e,n,r){kD(e,t);const a=e.runtime.bin.makeReadOptions(r),s=e.runtime.bin.makeWriteOptions(r);if(CD(t,e)){const p=t.getType().runtime.bin.listUnknownFields(t).filter(v=>v.no!=e.field.no);t.getType().runtime.bin.discardUnknownFields(t);for(const v of p)t.getType().runtime.bin.onUnknownField(t,v.no,v.wireType,v.data)}const l=s.writerFactory();let c=e.field;!c.opt&&!c.repeated&&(c.kind=="enum"||c.kind=="scalar")&&(c=Object.assign(Object.assign({},e.field),{opt:!0})),e.runtime.bin.writeField(c,n,l,s);const h=a.readerFactory(l.finish());for(;h.pos<h.len;){const[p,v]=h.tag(),b=h.skip(v,p);t.getType().runtime.bin.onUnknownField(t,p,v,b)}}function CD(t,e){const n=t.getType();return e.extendee.typeName===n.typeName&&!!n.runtime.bin.listUnknownFields(t).find(r=>r.no==e.field.no)}function kD(t,e){Xr(t.extendee.typeName==e.getType().typeName,"extension ".concat(t.typeName," can only be applied to message ").concat(t.extendee.typeName))}function TD(t,e){const n=t.localName;if(t.repeated)return e[n].length>0;if(t.oneof)return e[t.oneof.localName].case===n;switch(t.kind){case"enum":case"scalar":return t.opt||t.req?e[n]!==void 0:t.kind=="enum"?e[n]!==t.T.values[0].no:!yD(t.T,e[n]);case"message":return e[n]!==void 0;case"map":return Object.keys(e[n]).length>0}}function xD(t,e){const n=t.localName,r=!t.opt&&!t.req;if(t.repeated)e[n]=[];else if(t.oneof)e[t.oneof.localName]={case:void 0};else switch(t.kind){case"map":e[n]={};break;case"enum":e[n]=r?t.T.values[0].no:void 0;break;case"scalar":e[n]=r?Mh(t.T,t.L):void 0;break;case"message":e[n]=void 0;break}}function Wd(t,e){if(t===null||typeof t!="object"||!Object.getOwnPropertyNames(_1.prototype).every(r=>r in t&&typeof t[r]=="function"))return!1;const n=t.getType();return n===null||typeof n!="function"||!("typeName"in n)||typeof n.typeName!="string"?!1:e===void 0?!0:n.typeName==e.typeName}function wD(t,e){return Wd(e)||!t.fieldWrapper?e:t.fieldWrapper.wrapField(e)}Ne.DOUBLE,Ne.FLOAT,Ne.INT64,Ne.UINT64,Ne.INT32,Ne.UINT32,Ne.BOOL,Ne.STRING,Ne.BYTES;const _D={ignoreUnknownFields:!1},ED={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};function T6(t){return t?Object.assign(Object.assign({},_D),t):_D}function x6(t){return t?Object.assign(Object.assign({},ED),t):ED}const F0=Symbol(),j0=Symbol();function w6(){return{makeReadOptions:T6,makeWriteOptions:x6,readMessage(t,e,n,r){if(e==null||Array.isArray(e)||typeof e!="object")throw new Error("cannot decode message ".concat(t.typeName," from JSON: ").concat(ll(e)));r=r??new t;const a=new Map,s=n.typeRegistry;for(const[l,c]of Object.entries(e)){const h=t.fields.findJsonName(l);if(h){if(h.oneof){if(c===null&&h.kind=="scalar")continue;const p=a.get(h.oneof);if(p!==void 0)throw new Error("cannot decode message ".concat(t.typeName,' from JSON: multiple keys for oneof "').concat(h.oneof.name,'" present: "').concat(p,'", "').concat(l,'"'));a.set(h.oneof,l)}RD(r,c,h,n,t)}else{let p=!1;if(s!=null&&s.findExtension&&l.startsWith("[")&&l.endsWith("]")){const v=s.findExtension(l.substring(1,l.length-1));if(v&&v.extendee.typeName==t.typeName){p=!0;const[b,k]=bD(v);RD(b,c,v.field,n,v),k6(r,v,k(),n)}}if(!p&&!n.ignoreUnknownFields)throw new Error("cannot decode message ".concat(t.typeName,' from JSON: key "').concat(l,'" is unknown'))}}return r},writeMessage(t,e){const n=t.getType(),r={};let a;try{for(a of n.fields.byNumber()){if(!TD(a,t)){if(a.req)throw"required field not set";if(!e.emitDefaultValues||!E6(a))continue}const l=a.oneof?t[a.oneof.localName].value:t[a.localName],c=PD(a,l,e);c!==void 0&&(r[e.useProtoFieldName?a.name:a.jsonName]=c)}const s=e.typeRegistry;if(s!=null&&s.findExtensionFor)for(const l of n.runtime.bin.listUnknownFields(t)){const c=s.findExtensionFor(n.typeName,l.no);if(c&&CD(t,c)){const h=C6(t,c,e),p=PD(c.field,h,e);p!==void 0&&(r[c.field.jsonName]=p)}}}catch(s){const l=a?"cannot encode field ".concat(n.typeName,".").concat(a.name," to JSON"):"cannot encode message ".concat(n.typeName," to JSON"),c=s instanceof Error?s.message:String(s);throw new Error(l+(c.length>0?": ".concat(c):""))}return r},readScalar(t,e,n){return Sg(t,e,n??fc.BIGINT,!0)},writeScalar(t,e,n){if(e!==void 0&&(n||yD(t,e)))return V0(t,e)},debug:ll}}function ll(t){if(t===null)return"null";switch(typeof t){case"object":return Array.isArray(t)?"array":"object";case"string":return t.length>100?"string":'"'.concat(t.split('"').join('\\"'),'"');default:return String(t)}}function RD(t,e,n,r,a){let s=n.localName;if(n.repeated){if(Xr(n.kind!="map"),e===null)return;if(!Array.isArray(e))throw new Error("cannot decode field ".concat(a.typeName,".").concat(n.name," from JSON: ").concat(ll(e)));const l=t[s];for(const c of e){if(c===null)throw new Error("cannot decode field ".concat(a.typeName,".").concat(n.name," from JSON: ").concat(ll(c)));switch(n.kind){case"message":l.push(n.T.fromJson(c,r));break;case"enum":const h=P1(n.T,c,r.ignoreUnknownFields,!0);h!==j0&&l.push(h);break;case"scalar":try{l.push(Sg(n.T,c,n.L,!0))}catch(p){let v="cannot decode field ".concat(a.typeName,".").concat(n.name," from JSON: ").concat(ll(c));throw p instanceof Error&&p.message.length>0&&(v+=": ".concat(p.message)),new Error(v)}break}}}else if(n.kind=="map"){if(e===null)return;if(typeof e!="object"||Array.isArray(e))throw new Error("cannot decode field ".concat(a.typeName,".").concat(n.name," from JSON: ").concat(ll(e)));const l=t[s];for(const[c,h]of Object.entries(e)){if(h===null)throw new Error("cannot decode field ".concat(a.typeName,".").concat(n.name," from JSON: map value null"));let p;try{p=_6(n.K,c)}catch(v){let b="cannot decode map key for field ".concat(a.typeName,".").concat(n.name," from JSON: ").concat(ll(e));throw v instanceof Error&&v.message.length>0&&(b+=": ".concat(v.message)),new Error(b)}switch(n.V.kind){case"message":l[p]=n.V.T.fromJson(h,r);break;case"enum":const v=P1(n.V.T,h,r.ignoreUnknownFields,!0);v!==j0&&(l[p]=v);break;case"scalar":try{l[p]=Sg(n.V.T,h,fc.BIGINT,!0)}catch(b){let k="cannot decode map value for field ".concat(a.typeName,".").concat(n.name," from JSON: ").concat(ll(e));throw b instanceof Error&&b.message.length>0&&(k+=": ".concat(b.message)),new Error(k)}break}}}else switch(n.oneof&&(t=t[n.oneof.localName]={case:s},s="value"),n.kind){case"message":const l=n.T;if(e===null&&l.typeName!="google.protobuf.Value")return;let c=t[s];Wd(c)?c.fromJson(e,r):(t[s]=c=l.fromJson(e,r),l.fieldWrapper&&!n.oneof&&(t[s]=l.fieldWrapper.unwrapField(c)));break;case"enum":const h=P1(n.T,e,r.ignoreUnknownFields,!1);switch(h){case F0:xD(n,t);break;case j0:break;default:t[s]=h;break}break;case"scalar":try{const p=Sg(n.T,e,n.L,!1);switch(p){case F0:xD(n,t);break;default:t[s]=p;break}}catch(p){let v="cannot decode field ".concat(a.typeName,".").concat(n.name," from JSON: ").concat(ll(e));throw p instanceof Error&&p.message.length>0&&(v+=": ".concat(p.message)),new Error(v)}break}}function _6(t,e){if(t===Ne.BOOL)switch(e){case"true":e=!0;break;case"false":e=!1;break}return Sg(t,e,fc.BIGINT,!0).toString()}function Sg(t,e,n,r){if(e===null)return r?Mh(t,n):F0;switch(t){case Ne.DOUBLE:case Ne.FLOAT:if(e==="NaN")return Number.NaN;if(e==="Infinity")return Number.POSITIVE_INFINITY;if(e==="-Infinity")return Number.NEGATIVE_INFINITY;if(e===""||typeof e=="string"&&e.trim().length!==e.length||typeof e!="string"&&typeof e!="number")break;const a=Number(e);if(Number.isNaN(a)||!Number.isFinite(a))break;return t==Ne.FLOAT&&lD(a),a;case Ne.INT32:case Ne.FIXED32:case Ne.SFIXED32:case Ne.SINT32:case Ne.UINT32:let s;if(typeof e=="number"?s=e:typeof e=="string"&&e.length>0&&e.trim().length===e.length&&(s=Number(e)),s===void 0)break;return t==Ne.UINT32||t==Ne.FIXED32?w1(s):N0(s),s;case Ne.INT64:case Ne.SFIXED64:case Ne.SINT64:if(typeof e!="number"&&typeof e!="string")break;const l=Ur.parse(e);return n?l.toString():l;case Ne.FIXED64:case Ne.UINT64:if(typeof e!="number"&&typeof e!="string")break;const c=Ur.uParse(e);return n?c.toString():c;case Ne.BOOL:if(typeof e!="boolean")break;return e;case Ne.STRING:if(typeof e!="string")break;try{encodeURIComponent(e)}catch{throw new Error("invalid UTF8")}return e;case Ne.BYTES:if(e==="")return new Uint8Array(0);if(typeof e!="string")break;return SD.dec(e)}throw new Error}function P1(t,e,n,r){if(e===null)return t.typeName=="google.protobuf.NullValue"?0:r?t.values[0].no:F0;switch(typeof e){case"number":if(Number.isInteger(e))return e;break;case"string":const a=t.findName(e);if(a!==void 0)return a.no;if(n)return j0;break}throw new Error("cannot decode enum ".concat(t.typeName," from JSON: ").concat(ll(e)))}function E6(t){return t.repeated||t.kind=="map"?!0:!(t.oneof||t.kind=="message"||t.opt||t.req)}function PD(t,e,n){if(t.kind=="map"){Xr(typeof e=="object"&&e!=null);const r={},a=Object.entries(e);switch(t.V.kind){case"scalar":for(const[l,c]of a)r[l.toString()]=V0(t.V.T,c);break;case"message":for(const[l,c]of a)r[l.toString()]=c.toJson(n);break;case"enum":const s=t.V.T;for(const[l,c]of a)r[l.toString()]=D1(s,c,n.enumAsInteger);break}return n.emitDefaultValues||a.length>0?r:void 0}if(t.repeated){Xr(Array.isArray(e));const r=[];switch(t.kind){case"scalar":for(let a=0;a<e.length;a++)r.push(V0(t.T,e[a]));break;case"enum":for(let a=0;a<e.length;a++)r.push(D1(t.T,e[a],n.enumAsInteger));break;case"message":for(let a=0;a<e.length;a++)r.push(e[a].toJson(n));break}return n.emitDefaultValues||r.length>0?r:void 0}switch(t.kind){case"scalar":return V0(t.T,e);case"enum":return D1(t.T,e,n.enumAsInteger);case"message":return wD(t.T,e).toJson(n)}}function D1(t,e,n){var r;if(Xr(typeof e=="number"),t.typeName=="google.protobuf.NullValue")return null;if(n)return e;const a=t.findNumber(e);return(r=a==null?void 0:a.name)!==null&&r!==void 0?r:e}function V0(t,e){switch(t){case Ne.INT32:case Ne.SFIXED32:case Ne.SINT32:case Ne.FIXED32:case Ne.UINT32:return Xr(typeof e=="number"),e;case Ne.FLOAT:case Ne.DOUBLE:return Xr(typeof e=="number"),Number.isNaN(e)?"NaN":e===Number.POSITIVE_INFINITY?"Infinity":e===Number.NEGATIVE_INFINITY?"-Infinity":e;case Ne.STRING:return Xr(typeof e=="string"),e;case Ne.BOOL:return Xr(typeof e=="boolean"),e;case Ne.UINT64:case Ne.FIXED64:case Ne.INT64:case Ne.SFIXED64:case Ne.SINT64:return Xr(typeof e=="bigint"||typeof e=="string"||typeof e=="number"),e.toString();case Ne.BYTES:return Xr(e instanceof Uint8Array),SD.enc(e)}}const Lh=Symbol("@bufbuild/protobuf/unknown-fields"),DD={readUnknownFields:!0,readerFactory:t=>new v6(t)},AD={writeUnknownFields:!0,writerFactory:()=>new g6};function R6(t){return t?Object.assign(Object.assign({},DD),t):DD}function P6(t){return t?Object.assign(Object.assign({},AD),t):AD}function D6(){return{makeReadOptions:R6,makeWriteOptions:P6,listUnknownFields(t){var e;return(e=t[Lh])!==null&&e!==void 0?e:[]},discardUnknownFields(t){delete t[Lh]},writeUnknownFields(t,e){const r=t[Lh];if(r)for(const a of r)e.tag(a.no,a.wireType).raw(a.data)},onUnknownField(t,e,n,r){const a=t;Array.isArray(a[Lh])||(a[Lh]=[]),a[Lh].push({no:e,wireType:n,data:r})},readMessage(t,e,n,r,a){const s=t.getType(),l=a?e.len:e.pos+n;let c,h;for(;e.pos<l&&([c,h]=e.tag(),!(a===!0&&h==si.EndGroup));){const p=s.fields.find(c);if(!p){const v=e.skip(h,c);r.readUnknownFields&&this.onUnknownField(t,c,h,v);continue}OD(t,e,p,h,r)}if(a&&(h!=si.EndGroup||c!==n))throw new Error("invalid end group tag")},readField:OD,writeMessage(t,e,n){const r=t.getType();for(const a of r.fields.byNumber()){if(!TD(a,t)){if(a.req)throw new Error("cannot encode field ".concat(r.typeName,".").concat(a.name," to binary: required field not set"));continue}const s=a.oneof?t[a.oneof.localName].value:t[a.localName];MD(a,s,e,n)}return n.writeUnknownFields&&this.writeUnknownFields(t,e),e},writeField(t,e,n,r){e!==void 0&&MD(t,e,n,r)}}}function OD(t,e,n,r,a){let{repeated:s,localName:l}=n;switch(n.oneof&&(t=t[n.oneof.localName],t.case!=l&&delete t.value,t.case=l,l="value"),n.kind){case"scalar":case"enum":const c=n.kind=="enum"?Ne.INT32:n.T;let h=B0;if(n.kind=="scalar"&&n.L>0&&(h=O6),s){let k=t[l];if(r==si.LengthDelimited&&c!=Ne.STRING&&c!=Ne.BYTES){let E=e.uint32()+e.pos;for(;e.pos<E;)k.push(h(e,c))}else k.push(h(e,c))}else t[l]=h(e,c);break;case"message":const p=n.T;s?t[l].push(z0(e,new p,a,n)):Wd(t[l])?z0(e,t[l],a,n):(t[l]=z0(e,new p,a,n),p.fieldWrapper&&!n.oneof&&!n.repeated&&(t[l]=p.fieldWrapper.unwrapField(t[l])));break;case"map":let[v,b]=A6(n,e,a);t[l][v]=b;break}}function z0(t,e,n,r){const a=e.getType().runtime.bin,s=r==null?void 0:r.delimited;return a.readMessage(e,t,s?r.no:t.uint32(),n,s),e}function A6(t,e,n){const r=e.uint32(),a=e.pos+r;let s,l;for(;e.pos<a;){const[c]=e.tag();switch(c){case 1:s=B0(e,t.K);break;case 2:switch(t.V.kind){case"scalar":l=B0(e,t.V.T);break;case"enum":l=e.int32();break;case"message":l=z0(e,new t.V.T,n,void 0);break}break}}if(s===void 0&&(s=Mh(t.K,fc.BIGINT)),typeof s!="string"&&typeof s!="number"&&(s=s.toString()),l===void 0)switch(t.V.kind){case"scalar":l=Mh(t.V.T,fc.BIGINT);break;case"enum":l=t.V.T.values[0].no;break;case"message":l=new t.V.T;break}return[s,l]}function O6(t,e){const n=B0(t,e);return typeof n=="bigint"?n.toString():n}function B0(t,e){switch(e){case Ne.STRING:return t.string();case Ne.BOOL:return t.bool();case Ne.DOUBLE:return t.double();case Ne.FLOAT:return t.float();case Ne.INT32:return t.int32();case Ne.INT64:return t.int64();case Ne.UINT64:return t.uint64();case Ne.FIXED64:return t.fixed64();case Ne.BYTES:return t.bytes();case Ne.FIXED32:return t.fixed32();case Ne.SFIXED32:return t.sfixed32();case Ne.SFIXED64:return t.sfixed64();case Ne.SINT64:return t.sint64();case Ne.UINT32:return t.uint32();case Ne.SINT32:return t.sint32()}}function MD(t,e,n,r){Xr(e!==void 0);const a=t.repeated;switch(t.kind){case"scalar":case"enum":let s=t.kind=="enum"?Ne.INT32:t.T;if(a)if(Xr(Array.isArray(e)),t.packed)L6(n,s,t.no,e);else for(const l of e)Cg(n,s,t.no,l);else Cg(n,s,t.no,e);break;case"message":if(a){Xr(Array.isArray(e));for(const l of e)LD(n,r,t,l)}else LD(n,r,t,e);break;case"map":Xr(typeof e=="object"&&e!=null);for(const[l,c]of Object.entries(e))M6(n,r,t,l,c);break}}function M6(t,e,n,r,a){t.tag(n.no,si.LengthDelimited),t.fork();let s=r;switch(n.K){case Ne.INT32:case Ne.FIXED32:case Ne.UINT32:case Ne.SFIXED32:case Ne.SINT32:s=Number.parseInt(r);break;case Ne.BOOL:Xr(r=="true"||r=="false"),s=r=="true";break}switch(Cg(t,n.K,1,s),n.V.kind){case"scalar":Cg(t,n.V.T,2,a);break;case"enum":Cg(t,Ne.INT32,2,a);break;case"message":Xr(a!==void 0),t.tag(2,si.LengthDelimited).bytes(a.toBinary(e));break}t.join()}function LD(t,e,n,r){const a=wD(n.T,r);n.delimited?t.tag(n.no,si.StartGroup).raw(a.toBinary(e)).tag(n.no,si.EndGroup):t.tag(n.no,si.LengthDelimited).bytes(a.toBinary(e))}function Cg(t,e,n,r){Xr(r!==void 0);let[a,s]=ND(e);t.tag(n,a)[s](r)}function L6(t,e,n,r){if(!r.length)return;t.tag(n,si.LengthDelimited).fork();let[,a]=ND(e);for(let s=0;s<r.length;s++)t[a](r[s]);t.join()}function ND(t){let e=si.Varint;switch(t){case Ne.BYTES:case Ne.STRING:e=si.LengthDelimited;break;case Ne.DOUBLE:case Ne.FIXED64:case Ne.SFIXED64:e=si.Bit64;break;case Ne.FIXED32:case Ne.SFIXED32:case Ne.FLOAT:e=si.Bit32;break}const n=Ne[t].toLowerCase();return[e,n]}function N6(){return{setEnumType:cD,initPartial(t,e){if(t===void 0)return;const n=e.getType();for(const r of n.fields.byMember()){const a=r.localName,s=e,l=t;if(l[a]!=null)switch(r.kind){case"oneof":const c=l[a].case;if(c===void 0)continue;const h=r.findField(c);let p=l[a].value;h&&h.kind=="message"&&!Wd(p,h.T)?p=new h.T(p):h&&h.kind==="scalar"&&h.T===Ne.BYTES&&(p=kg(p)),s[a]={case:c,value:p};break;case"scalar":case"enum":let v=l[a];r.T===Ne.BYTES&&(v=r.repeated?v.map(kg):kg(v)),s[a]=v;break;case"map":switch(r.V.kind){case"scalar":case"enum":if(r.V.T===Ne.BYTES)for(const[T,E]of Object.entries(l[a]))s[a][T]=kg(E);else Object.assign(s[a],l[a]);break;case"message":const k=r.V.T;for(const T of Object.keys(l[a])){let E=l[a][T];k.fieldWrapper||(E=new k(E)),s[a][T]=E}break}break;case"message":const b=r.T;if(r.repeated)s[a]=l[a].map(k=>Wd(k,b)?k:new b(k));else{const k=l[a];b.fieldWrapper?b.typeName==="google.protobuf.BytesValue"?s[a]=kg(k):s[a]=k:s[a]=Wd(k,b)?k:new b(k)}break}}},equals(t,e,n){return e===n?!0:!e||!n?!1:t.fields.byMember().every(r=>{const a=e[r.localName],s=n[r.localName];if(r.repeated){if(a.length!==s.length)return!1;switch(r.kind){case"message":return a.every((l,c)=>r.T.equals(l,s[c]));case"scalar":return a.every((l,c)=>hc(r.T,l,s[c]));case"enum":return a.every((l,c)=>hc(Ne.INT32,l,s[c]))}throw new Error("repeated cannot contain ".concat(r.kind))}switch(r.kind){case"message":return r.T.equals(a,s);case"enum":return hc(Ne.INT32,a,s);case"scalar":return hc(r.T,a,s);case"oneof":if(a.case!==s.case)return!1;const l=r.findField(a.case);if(l===void 0)return!0;switch(l.kind){case"message":return l.T.equals(a.value,s.value);case"enum":return hc(Ne.INT32,a.value,s.value);case"scalar":return hc(l.T,a.value,s.value)}throw new Error("oneof cannot contain ".concat(l.kind));case"map":const c=Object.keys(a).concat(Object.keys(s));switch(r.V.kind){case"message":const h=r.V.T;return c.every(v=>h.equals(a[v],s[v]));case"enum":return c.every(v=>hc(Ne.INT32,a[v],s[v]));case"scalar":const p=r.V.T;return c.every(v=>hc(p,a[v],s[v]))}break}})},clone(t){const e=t.getType(),n=new e,r=n;for(const a of e.fields.byMember()){const s=t[a.localName];let l;if(a.repeated)l=s.map(H0);else if(a.kind=="map"){l=r[a.localName];for(const[c,h]of Object.entries(s))l[c]=H0(h)}else a.kind=="oneof"?l=a.findField(s.case)?{case:s.case,value:H0(s.value)}:{case:void 0}:l=H0(s);r[a.localName]=l}for(const a of e.runtime.bin.listUnknownFields(t))e.runtime.bin.onUnknownField(r,a.no,a.wireType,a.data);return n}}}function H0(t){if(t===void 0)return t;if(Wd(t))return t.clone();if(t instanceof Uint8Array){const e=new Uint8Array(t.byteLength);return e.set(t),e}return t}function kg(t){return t instanceof Uint8Array?t:new Uint8Array(t)}function I6(t,e,n){return{syntax:t,json:w6(),bin:D6(),util:Object.assign(Object.assign({},N6()),{newFieldList:e,initFields:n}),makeMessageType(r,a,s){return c6(this,r,a,s)},makeEnum:u6,makeEnumType:dD,getEnumType:l6,makeExtension(r,a,s){return y6(this,r,a,s)}}}class U6{constructor(e,n){this._fields=e,this._normalizer=n}findJsonName(e){if(!this.jsonNames){const n={};for(const r of this.list())n[r.jsonName]=n[r.name]=r;this.jsonNames=n}return this.jsonNames[e]}find(e){if(!this.numbers){const n={};for(const r of this.list())n[r.no]=r;this.numbers=n}return this.numbers[e]}list(){return this.all||(this.all=this._normalizer(this._fields)),this.all}byNumber(){return this.numbersAsc||(this.numbersAsc=this.list().concat().sort((e,n)=>e.no-n.no)),this.numbersAsc}byMember(){if(!this.members){this.members=[];const e=this.members;let n;for(const r of this.list())r.oneof?r.oneof!==n&&(n=r.oneof,e.push(n)):e.push(r)}return this.members}}function ID(t,e){const n=UD(t);return e?n:H6(B6(n))}function F6(t){return ID(t,!1)}const j6=UD;function UD(t){let e=!1;const n=[];for(let r=0;r<t.length;r++){let a=t.charAt(r);switch(a){case"_":e=!0;break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":n.push(a),e=!1;break;default:e&&(e=!1,a=a.toUpperCase()),n.push(a);break}}return n.join("")}const V6=new Set(["constructor","toString","toJSON","valueOf"]),z6=new Set(["getType","clone","equals","fromBinary","fromJson","fromJsonString","toBinary","toJson","toJsonString","toObject"]),FD=t=>"".concat(t,"$"),B6=t=>z6.has(t)?FD(t):t,H6=t=>V6.has(t)?FD(t):t;class $6{constructor(e){this.kind="oneof",this.repeated=!1,this.packed=!1,this.opt=!1,this.req=!1,this.default=void 0,this.fields=[],this.name=e,this.localName=F6(e)}addField(e){Xr(e.oneof===this,"field ".concat(e.name," not one of ").concat(this.name)),this.fields.push(e)}findField(e){if(!this._lookup){this._lookup=Object.create(null);for(let n=0;n<this.fields.length;n++)this._lookup[this.fields[n].localName]=this.fields[n]}return this._lookup[e]}}function q6(t,e){var n,r,a,s,l,c;const h=[];let p;for(const v of typeof t=="function"?t():t){const b=v;if(b.localName=ID(v.name,v.oneof!==void 0),b.jsonName=(n=v.jsonName)!==null&&n!==void 0?n:j6(v.name),b.repeated=(r=v.repeated)!==null&&r!==void 0?r:!1,v.kind=="scalar"&&(b.L=(a=v.L)!==null&&a!==void 0?a:fc.BIGINT),b.delimited=(s=v.delimited)!==null&&s!==void 0?s:!1,b.req=(l=v.req)!==null&&l!==void 0?l:!1,b.opt=(c=v.opt)!==null&&c!==void 0?c:!1,v.packed===void 0&&(b.packed=v.kind=="enum"||v.kind=="scalar"&&v.T!=Ne.BYTES&&v.T!=Ne.STRING),v.oneof!==void 0){const k=typeof v.oneof=="string"?v.oneof:v.oneof.name;(!p||p.name!=k)&&(p=new $6(k)),b.oneof=p,p.addField(b)}h.push(b)}return h}const Se=I6("proto3",t=>new U6(t,e=>q6(e)),t=>{for(const e of t.getType().fields.byMember()){if(e.opt)continue;const n=e.localName,r=t;if(e.repeated){r[n]=[];continue}switch(e.kind){case"oneof":r[n]={case:void 0};break;case"enum":r[n]=0;break;case"map":r[n]={};break;case"scalar":r[n]=Mh(e.T,e.L);break}}});class no extends _1{constructor(e){super(),this.seconds=Ur.zero,this.nanos=0,Se.util.initPartial(e,this)}fromJson(e,n){if(typeof e!="string")throw new Error("cannot decode google.protobuf.Timestamp from JSON: ".concat(Se.json.debug(e)));const r=e.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/);if(!r)throw new Error("cannot decode google.protobuf.Timestamp from JSON: invalid RFC 3339 string");const a=Date.parse(r[1]+"-"+r[2]+"-"+r[3]+"T"+r[4]+":"+r[5]+":"+r[6]+(r[8]?r[8]:"Z"));if(Number.isNaN(a))throw new Error("cannot decode google.protobuf.Timestamp from JSON: invalid RFC 3339 string");if(a<Date.parse("0001-01-01T00:00:00Z")||a>Date.parse("9999-12-31T23:59:59Z"))throw new Error("cannot decode message google.protobuf.Timestamp from JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive");return this.seconds=Ur.parse(a/1e3),this.nanos=0,r[7]&&(this.nanos=parseInt("1"+r[7]+"0".repeat(9-r[7].length))-1e9),this}toJson(e){const n=Number(this.seconds)*1e3;if(n<Date.parse("0001-01-01T00:00:00Z")||n>Date.parse("9999-12-31T23:59:59Z"))throw new Error("cannot encode google.protobuf.Timestamp to JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive");if(this.nanos<0)throw new Error("cannot encode google.protobuf.Timestamp to JSON: nanos must not be negative");let r="Z";if(this.nanos>0){const a=(this.nanos+1e9).toString().substring(1);a.substring(3)==="000000"?r="."+a.substring(0,3)+"Z":a.substring(6)==="000"?r="."+a.substring(0,6)+"Z":r="."+a+"Z"}return new Date(n).toISOString().replace(".000Z",r)}toDate(){return new Date(Number(this.seconds)*1e3+Math.ceil(this.nanos/1e6))}static now(){return no.fromDate(new Date)}static fromDate(e){const n=e.getTime();return new no({seconds:Ur.parse(Math.floor(n/1e3)),nanos:n%1e3*1e6})}static fromBinary(e,n){return new no().fromBinary(e,n)}static fromJson(e,n){return new no().fromJson(e,n)}static fromJsonString(e,n){return new no().fromJsonString(e,n)}static equals(e,n){return Se.util.equals(no,e,n)}}no.runtime=Se,no.typeName="google.protobuf.Timestamp",no.fields=Se.util.newFieldList(()=>[{no:1,name:"seconds",kind:"scalar",T:3},{no:2,name:"nanos",kind:"scalar",T:5}]);const W6=Se.makeMessageType("livekit.MetricsBatch",()=>[{no:1,name:"timestamp_ms",kind:"scalar",T:3},{no:2,name:"normalized_timestamp",kind:"message",T:no},{no:3,name:"str_data",kind:"scalar",T:9,repeated:!0},{no:4,name:"time_series",kind:"message",T:G6,repeated:!0},{no:5,name:"events",kind:"message",T:K6,repeated:!0}]),G6=Se.makeMessageType("livekit.TimeSeriesMetric",()=>[{no:1,name:"label",kind:"scalar",T:13},{no:2,name:"participant_identity",kind:"scalar",T:13},{no:3,name:"track_sid",kind:"scalar",T:13},{no:4,name:"samples",kind:"message",T:Y6,repeated:!0},{no:5,name:"rid",kind:"scalar",T:13}]),Y6=Se.makeMessageType("livekit.MetricSample",()=>[{no:1,name:"timestamp_ms",kind:"scalar",T:3},{no:2,name:"normalized_timestamp",kind:"message",T:no},{no:3,name:"value",kind:"scalar",T:2}]),K6=Se.makeMessageType("livekit.EventMetric",()=>[{no:1,name:"label",kind:"scalar",T:13},{no:2,name:"participant_identity",kind:"scalar",T:13},{no:3,name:"track_sid",kind:"scalar",T:13},{no:4,name:"start_timestamp_ms",kind:"scalar",T:3},{no:5,name:"end_timestamp_ms",kind:"scalar",T:3,opt:!0},{no:6,name:"normalized_start_timestamp",kind:"message",T:no},{no:7,name:"normalized_end_timestamp",kind:"message",T:no,opt:!0},{no:8,name:"metadata",kind:"scalar",T:9},{no:9,name:"rid",kind:"scalar",T:13}]),jD=Se.makeEnum("livekit.BackupCodecPolicy",[{no:0,name:"PREFER_REGRESSION"},{no:1,name:"SIMULCAST"},{no:2,name:"REGRESSION"}]),Cs=Se.makeEnum("livekit.TrackType",[{no:0,name:"AUDIO"},{no:1,name:"VIDEO"},{no:2,name:"DATA"}]),gi=Se.makeEnum("livekit.TrackSource",[{no:0,name:"UNKNOWN"},{no:1,name:"CAMERA"},{no:2,name:"MICROPHONE"},{no:3,name:"SCREEN_SHARE"},{no:4,name:"SCREEN_SHARE_AUDIO"}]),Nh=Se.makeEnum("livekit.VideoQuality",[{no:0,name:"LOW"},{no:1,name:"MEDIUM"},{no:2,name:"HIGH"},{no:3,name:"OFF"}]),Tg=Se.makeEnum("livekit.ConnectionQuality",[{no:0,name:"POOR"},{no:1,name:"GOOD"},{no:2,name:"EXCELLENT"},{no:3,name:"LOST"}]),xg=Se.makeEnum("livekit.ClientConfigSetting",[{no:0,name:"UNSET"},{no:1,name:"DISABLED"},{no:2,name:"ENABLED"}]),ks=Se.makeEnum("livekit.DisconnectReason",[{no:0,name:"UNKNOWN_REASON"},{no:1,name:"CLIENT_INITIATED"},{no:2,name:"DUPLICATE_IDENTITY"},{no:3,name:"SERVER_SHUTDOWN"},{no:4,name:"PARTICIPANT_REMOVED"},{no:5,name:"ROOM_DELETED"},{no:6,name:"STATE_MISMATCH"},{no:7,name:"JOIN_FAILURE"},{no:8,name:"MIGRATION"},{no:9,name:"SIGNAL_CLOSE"},{no:10,name:"ROOM_CLOSED"},{no:11,name:"USER_UNAVAILABLE"},{no:12,name:"USER_REJECTED"},{no:13,name:"SIP_TRUNK_FAILURE"}]),Ih=Se.makeEnum("livekit.ReconnectReason",[{no:0,name:"RR_UNKNOWN"},{no:1,name:"RR_SIGNAL_DISCONNECTED"},{no:2,name:"RR_PUBLISHER_FAILED"},{no:3,name:"RR_SUBSCRIBER_FAILED"},{no:4,name:"RR_SWITCH_CANDIDATE"}]),Z6=Se.makeEnum("livekit.SubscriptionError",[{no:0,name:"SE_UNKNOWN"},{no:1,name:"SE_CODEC_UNSUPPORTED"},{no:2,name:"SE_TRACK_NOTFOUND"}]),ul=Se.makeEnum("livekit.AudioTrackFeature",[{no:0,name:"TF_STEREO"},{no:1,name:"TF_NO_DTX"},{no:2,name:"TF_AUTO_GAIN_CONTROL"},{no:3,name:"TF_ECHO_CANCELLATION"},{no:4,name:"TF_NOISE_SUPPRESSION"},{no:5,name:"TF_ENHANCED_NOISE_CANCELLATION"}]),A1=Se.makeMessageType("livekit.Room",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"empty_timeout",kind:"scalar",T:13},{no:14,name:"departure_timeout",kind:"scalar",T:13},{no:4,name:"max_participants",kind:"scalar",T:13},{no:5,name:"creation_time",kind:"scalar",T:3},{no:15,name:"creation_time_ms",kind:"scalar",T:3},{no:6,name:"turn_password",kind:"scalar",T:9},{no:7,name:"enabled_codecs",kind:"message",T:$0,repeated:!0},{no:8,name:"metadata",kind:"scalar",T:9},{no:9,name:"num_participants",kind:"scalar",T:13},{no:11,name:"num_publishers",kind:"scalar",T:13},{no:10,name:"active_recording",kind:"scalar",T:8},{no:13,name:"version",kind:"message",T:XD}]),$0=Se.makeMessageType("livekit.Codec",()=>[{no:1,name:"mime",kind:"scalar",T:9},{no:2,name:"fmtp_line",kind:"scalar",T:9}]),Q6=Se.makeMessageType("livekit.ParticipantPermission",()=>[{no:1,name:"can_subscribe",kind:"scalar",T:8},{no:2,name:"can_publish",kind:"scalar",T:8},{no:3,name:"can_publish_data",kind:"scalar",T:8},{no:9,name:"can_publish_sources",kind:"enum",T:Se.getEnumType(gi),repeated:!0},{no:7,name:"hidden",kind:"scalar",T:8},{no:8,name:"recorder",kind:"scalar",T:8},{no:10,name:"can_update_metadata",kind:"scalar",T:8},{no:11,name:"agent",kind:"scalar",T:8},{no:12,name:"can_subscribe_metrics",kind:"scalar",T:8}]),wg=Se.makeMessageType("livekit.ParticipantInfo",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"identity",kind:"scalar",T:9},{no:3,name:"state",kind:"enum",T:Se.getEnumType(O1)},{no:4,name:"tracks",kind:"message",T:Uh,repeated:!0},{no:5,name:"metadata",kind:"scalar",T:9},{no:6,name:"joined_at",kind:"scalar",T:3},{no:17,name:"joined_at_ms",kind:"scalar",T:3},{no:9,name:"name",kind:"scalar",T:9},{no:10,name:"version",kind:"scalar",T:13},{no:11,name:"permission",kind:"message",T:Q6},{no:12,name:"region",kind:"scalar",T:9},{no:13,name:"is_publisher",kind:"scalar",T:8},{no:14,name:"kind",kind:"enum",T:Se.getEnumType(_g)},{no:15,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:16,name:"disconnect_reason",kind:"enum",T:Se.getEnumType(ks)},{no:18,name:"kind_details",kind:"enum",T:Se.getEnumType(X6),repeated:!0}]),O1=Se.makeEnum("livekit.ParticipantInfo.State",[{no:0,name:"JOINING"},{no:1,name:"JOINED"},{no:2,name:"ACTIVE"},{no:3,name:"DISCONNECTED"}]),_g=Se.makeEnum("livekit.ParticipantInfo.Kind",[{no:0,name:"STANDARD"},{no:1,name:"INGRESS"},{no:2,name:"EGRESS"},{no:3,name:"SIP"},{no:4,name:"AGENT"}]),X6=Se.makeEnum("livekit.ParticipantInfo.KindDetail",[{no:0,name:"CLOUD_AGENT"},{no:1,name:"FORWARDED"}]),Po=Se.makeEnum("livekit.Encryption.Type",[{no:0,name:"NONE"},{no:1,name:"GCM"},{no:2,name:"CUSTOM"}]),J6=Se.makeMessageType("livekit.SimulcastCodecInfo",()=>[{no:1,name:"mime_type",kind:"scalar",T:9},{no:2,name:"mid",kind:"scalar",T:9},{no:3,name:"cid",kind:"scalar",T:9},{no:4,name:"layers",kind:"message",T:Gd,repeated:!0}]),Uh=Se.makeMessageType("livekit.TrackInfo",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"type",kind:"enum",T:Se.getEnumType(Cs)},{no:3,name:"name",kind:"scalar",T:9},{no:4,name:"muted",kind:"scalar",T:8},{no:5,name:"width",kind:"scalar",T:13},{no:6,name:"height",kind:"scalar",T:13},{no:7,name:"simulcast",kind:"scalar",T:8},{no:8,name:"disable_dtx",kind:"scalar",T:8},{no:9,name:"source",kind:"enum",T:Se.getEnumType(gi)},{no:10,name:"layers",kind:"message",T:Gd,repeated:!0},{no:11,name:"mime_type",kind:"scalar",T:9},{no:12,name:"mid",kind:"scalar",T:9},{no:13,name:"codecs",kind:"message",T:J6,repeated:!0},{no:14,name:"stereo",kind:"scalar",T:8},{no:15,name:"disable_red",kind:"scalar",T:8},{no:16,name:"encryption",kind:"enum",T:Se.getEnumType(Po)},{no:17,name:"stream",kind:"scalar",T:9},{no:18,name:"version",kind:"message",T:XD},{no:19,name:"audio_features",kind:"enum",T:Se.getEnumType(ul),repeated:!0},{no:20,name:"backup_codec_policy",kind:"enum",T:Se.getEnumType(jD)}]),Gd=Se.makeMessageType("livekit.VideoLayer",()=>[{no:1,name:"quality",kind:"enum",T:Se.getEnumType(Nh)},{no:2,name:"width",kind:"scalar",T:13},{no:3,name:"height",kind:"scalar",T:13},{no:4,name:"bitrate",kind:"scalar",T:13},{no:5,name:"ssrc",kind:"scalar",T:13}]),ro=Se.makeMessageType("livekit.DataPacket",()=>[{no:1,name:"kind",kind:"enum",T:Se.getEnumType($n)},{no:4,name:"participant_identity",kind:"scalar",T:9},{no:5,name:"destination_identities",kind:"scalar",T:9,repeated:!0},{no:2,name:"user",kind:"message",T:zD,oneof:"value"},{no:3,name:"speaker",kind:"message",T:e8,oneof:"value"},{no:6,name:"sip_dtmf",kind:"message",T:BD,oneof:"value"},{no:7,name:"transcription",kind:"message",T:t8,oneof:"value"},{no:8,name:"metrics",kind:"message",T:W6,oneof:"value"},{no:9,name:"chat_message",kind:"message",T:M1,oneof:"value"},{no:10,name:"rpc_request",kind:"message",T:HD,oneof:"value"},{no:11,name:"rpc_ack",kind:"message",T:$D,oneof:"value"},{no:12,name:"rpc_response",kind:"message",T:qD,oneof:"value"},{no:13,name:"stream_header",kind:"message",T:N1,oneof:"value"},{no:14,name:"stream_chunk",kind:"message",T:I1,oneof:"value"},{no:15,name:"stream_trailer",kind:"message",T:U1,oneof:"value"}]),$n=Se.makeEnum("livekit.DataPacket.Kind",[{no:0,name:"RELIABLE"},{no:1,name:"LOSSY"}]),e8=Se.makeMessageType("livekit.ActiveSpeakerUpdate",()=>[{no:1,name:"speakers",kind:"message",T:VD,repeated:!0}]),VD=Se.makeMessageType("livekit.SpeakerInfo",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"level",kind:"scalar",T:2},{no:3,name:"active",kind:"scalar",T:8}]),zD=Se.makeMessageType("livekit.UserPacket",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:5,name:"participant_identity",kind:"scalar",T:9},{no:2,name:"payload",kind:"scalar",T:12},{no:3,name:"destination_sids",kind:"scalar",T:9,repeated:!0},{no:6,name:"destination_identities",kind:"scalar",T:9,repeated:!0},{no:4,name:"topic",kind:"scalar",T:9,opt:!0},{no:8,name:"id",kind:"scalar",T:9,opt:!0},{no:9,name:"start_time",kind:"scalar",T:4,opt:!0},{no:10,name:"end_time",kind:"scalar",T:4,opt:!0},{no:11,name:"nonce",kind:"scalar",T:12}]),BD=Se.makeMessageType("livekit.SipDTMF",()=>[{no:3,name:"code",kind:"scalar",T:13},{no:4,name:"digit",kind:"scalar",T:9}]),t8=Se.makeMessageType("livekit.Transcription",()=>[{no:2,name:"transcribed_participant_identity",kind:"scalar",T:9},{no:3,name:"track_id",kind:"scalar",T:9},{no:4,name:"segments",kind:"message",T:n8,repeated:!0}]),n8=Se.makeMessageType("livekit.TranscriptionSegment",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"text",kind:"scalar",T:9},{no:3,name:"start_time",kind:"scalar",T:4},{no:4,name:"end_time",kind:"scalar",T:4},{no:5,name:"final",kind:"scalar",T:8},{no:6,name:"language",kind:"scalar",T:9}]),M1=Se.makeMessageType("livekit.ChatMessage",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"timestamp",kind:"scalar",T:3},{no:3,name:"edit_timestamp",kind:"scalar",T:3,opt:!0},{no:4,name:"message",kind:"scalar",T:9},{no:5,name:"deleted",kind:"scalar",T:8},{no:6,name:"generated",kind:"scalar",T:8}]),HD=Se.makeMessageType("livekit.RpcRequest",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"method",kind:"scalar",T:9},{no:3,name:"payload",kind:"scalar",T:9},{no:4,name:"response_timeout_ms",kind:"scalar",T:13},{no:5,name:"version",kind:"scalar",T:13}]),$D=Se.makeMessageType("livekit.RpcAck",()=>[{no:1,name:"request_id",kind:"scalar",T:9}]),qD=Se.makeMessageType("livekit.RpcResponse",()=>[{no:1,name:"request_id",kind:"scalar",T:9},{no:2,name:"payload",kind:"scalar",T:9,oneof:"value"},{no:3,name:"error",kind:"message",T:WD,oneof:"value"}]),WD=Se.makeMessageType("livekit.RpcError",()=>[{no:1,name:"code",kind:"scalar",T:13},{no:2,name:"message",kind:"scalar",T:9},{no:3,name:"data",kind:"scalar",T:9}]),GD=Se.makeMessageType("livekit.ParticipantTracks",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sids",kind:"scalar",T:9,repeated:!0}]),r8=Se.makeMessageType("livekit.ServerInfo",()=>[{no:1,name:"edition",kind:"enum",T:Se.getEnumType(YD)},{no:2,name:"version",kind:"scalar",T:9},{no:3,name:"protocol",kind:"scalar",T:5},{no:4,name:"region",kind:"scalar",T:9},{no:5,name:"node_id",kind:"scalar",T:9},{no:6,name:"debug_info",kind:"scalar",T:9},{no:7,name:"agent_protocol",kind:"scalar",T:5}]),YD=Se.makeEnum("livekit.ServerInfo.Edition",[{no:0,name:"Standard"},{no:1,name:"Cloud"}]),i8=Se.makeMessageType("livekit.ClientInfo",()=>[{no:1,name:"sdk",kind:"enum",T:Se.getEnumType(KD)},{no:2,name:"version",kind:"scalar",T:9},{no:3,name:"protocol",kind:"scalar",T:5},{no:4,name:"os",kind:"scalar",T:9},{no:5,name:"os_version",kind:"scalar",T:9},{no:6,name:"device_model",kind:"scalar",T:9},{no:7,name:"browser",kind:"scalar",T:9},{no:8,name:"browser_version",kind:"scalar",T:9},{no:9,name:"address",kind:"scalar",T:9},{no:10,name:"network",kind:"scalar",T:9},{no:11,name:"other_sdks",kind:"scalar",T:9}]),KD=Se.makeEnum("livekit.ClientInfo.SDK",[{no:0,name:"UNKNOWN"},{no:1,name:"JS"},{no:2,name:"SWIFT"},{no:3,name:"ANDROID"},{no:4,name:"FLUTTER"},{no:5,name:"GO"},{no:6,name:"UNITY"},{no:7,name:"REACT_NATIVE"},{no:8,name:"RUST"},{no:9,name:"PYTHON"},{no:10,name:"CPP"},{no:11,name:"UNITY_WEB"},{no:12,name:"NODE"}]),ZD=Se.makeMessageType("livekit.ClientConfiguration",()=>[{no:1,name:"video",kind:"message",T:QD},{no:2,name:"screen",kind:"message",T:QD},{no:3,name:"resume_connection",kind:"enum",T:Se.getEnumType(xg)},{no:4,name:"disabled_codecs",kind:"message",T:a8},{no:5,name:"force_relay",kind:"enum",T:Se.getEnumType(xg)}]),QD=Se.makeMessageType("livekit.VideoConfiguration",()=>[{no:1,name:"hardware_encoder",kind:"enum",T:Se.getEnumType(xg)}]),a8=Se.makeMessageType("livekit.DisabledCodecs",()=>[{no:1,name:"codecs",kind:"message",T:$0,repeated:!0},{no:2,name:"publish",kind:"message",T:$0,repeated:!0}]),XD=Se.makeMessageType("livekit.TimedVersion",()=>[{no:1,name:"unix_micro",kind:"scalar",T:3},{no:2,name:"ticks",kind:"scalar",T:5}]),L1=Se.makeEnum("livekit.DataStream.OperationType",[{no:0,name:"CREATE"},{no:1,name:"UPDATE"},{no:2,name:"DELETE"},{no:3,name:"REACTION"}]),JD=Se.makeMessageType("livekit.DataStream.TextHeader",()=>[{no:1,name:"operation_type",kind:"enum",T:Se.getEnumType(L1)},{no:2,name:"version",kind:"scalar",T:5},{no:3,name:"reply_to_stream_id",kind:"scalar",T:9},{no:4,name:"attached_stream_ids",kind:"scalar",T:9,repeated:!0},{no:5,name:"generated",kind:"scalar",T:8}],{localName:"DataStream_TextHeader"}),eA=Se.makeMessageType("livekit.DataStream.ByteHeader",()=>[{no:1,name:"name",kind:"scalar",T:9}],{localName:"DataStream_ByteHeader"}),N1=Se.makeMessageType("livekit.DataStream.Header",()=>[{no:1,name:"stream_id",kind:"scalar",T:9},{no:2,name:"timestamp",kind:"scalar",T:3},{no:3,name:"topic",kind:"scalar",T:9},{no:4,name:"mime_type",kind:"scalar",T:9},{no:5,name:"total_length",kind:"scalar",T:4,opt:!0},{no:7,name:"encryption_type",kind:"enum",T:Se.getEnumType(Po)},{no:8,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:9,name:"text_header",kind:"message",T:JD,oneof:"content_header"},{no:10,name:"byte_header",kind:"message",T:eA,oneof:"content_header"}],{localName:"DataStream_Header"}),I1=Se.makeMessageType("livekit.DataStream.Chunk",()=>[{no:1,name:"stream_id",kind:"scalar",T:9},{no:2,name:"chunk_index",kind:"scalar",T:4},{no:3,name:"content",kind:"scalar",T:12},{no:4,name:"version",kind:"scalar",T:5},{no:5,name:"iv",kind:"scalar",T:12,opt:!0}],{localName:"DataStream_Chunk"}),U1=Se.makeMessageType("livekit.DataStream.Trailer",()=>[{no:1,name:"stream_id",kind:"scalar",T:9},{no:2,name:"reason",kind:"scalar",T:9},{no:3,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}}],{localName:"DataStream_Trailer"}),Ts=Se.makeEnum("livekit.SignalTarget",[{no:0,name:"PUBLISHER"},{no:1,name:"SUBSCRIBER"}]),F1=Se.makeEnum("livekit.StreamState",[{no:0,name:"ACTIVE"},{no:1,name:"PAUSED"}]),o8=Se.makeEnum("livekit.CandidateProtocol",[{no:0,name:"UDP"},{no:1,name:"TCP"},{no:2,name:"TLS"}]),s8=Se.makeMessageType("livekit.SignalRequest",()=>[{no:1,name:"offer",kind:"message",T:Yd,oneof:"message"},{no:2,name:"answer",kind:"message",T:Yd,oneof:"message"},{no:3,name:"trickle",kind:"message",T:z1,oneof:"message"},{no:4,name:"add_track",kind:"message",T:V1,oneof:"message"},{no:5,name:"mute",kind:"message",T:B1,oneof:"message"},{no:6,name:"subscription",kind:"message",T:q0,oneof:"message"},{no:7,name:"track_setting",kind:"message",T:nA,oneof:"message"},{no:8,name:"leave",kind:"message",T:W0,oneof:"message"},{no:10,name:"update_layers",kind:"message",T:iA,oneof:"message"},{no:11,name:"subscription_permission",kind:"message",T:lA,oneof:"message"},{no:12,name:"sync_state",kind:"message",T:uA,oneof:"message"},{no:13,name:"simulate",kind:"message",T:cl,oneof:"message"},{no:14,name:"ping",kind:"scalar",T:3,oneof:"message"},{no:15,name:"update_metadata",kind:"message",T:aA,oneof:"message"},{no:16,name:"ping_req",kind:"message",T:dA,oneof:"message"},{no:17,name:"update_audio_track",kind:"message",T:rA,oneof:"message"},{no:18,name:"update_video_track",kind:"message",T:f8,oneof:"message"}]),tA=Se.makeMessageType("livekit.SignalResponse",()=>[{no:1,name:"join",kind:"message",T:l8,oneof:"message"},{no:2,name:"answer",kind:"message",T:Yd,oneof:"message"},{no:3,name:"offer",kind:"message",T:Yd,oneof:"message"},{no:4,name:"trickle",kind:"message",T:z1,oneof:"message"},{no:5,name:"update",kind:"message",T:d8,oneof:"message"},{no:6,name:"track_published",kind:"message",T:H1,oneof:"message"},{no:8,name:"leave",kind:"message",T:W0,oneof:"message"},{no:9,name:"mute",kind:"message",T:B1,oneof:"message"},{no:10,name:"speakers_changed",kind:"message",T:h8,oneof:"message"},{no:11,name:"room_update",kind:"message",T:p8,oneof:"message"},{no:12,name:"connection_quality",kind:"message",T:g8,oneof:"message"},{no:13,name:"stream_state_update",kind:"message",T:y8,oneof:"message"},{no:14,name:"subscribed_quality_update",kind:"message",T:S8,oneof:"message"},{no:15,name:"subscription_permission_update",kind:"message",T:C8,oneof:"message"},{no:16,name:"refresh_token",kind:"scalar",T:9,oneof:"message"},{no:17,name:"track_unpublished",kind:"message",T:c8,oneof:"message"},{no:18,name:"pong",kind:"scalar",T:3,oneof:"message"},{no:19,name:"reconnect",kind:"message",T:u8,oneof:"message"},{no:20,name:"pong_resp",kind:"message",T:k8,oneof:"message"},{no:21,name:"subscription_response",kind:"message",T:w8,oneof:"message"},{no:22,name:"request_response",kind:"message",T:_8,oneof:"message"},{no:23,name:"track_subscribed",kind:"message",T:E8,oneof:"message"}]),j1=Se.makeMessageType("livekit.SimulcastCodec",()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"cid",kind:"scalar",T:9}]),V1=Se.makeMessageType("livekit.AddTrackRequest",()=>[{no:1,name:"cid",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"type",kind:"enum",T:Se.getEnumType(Cs)},{no:4,name:"width",kind:"scalar",T:13},{no:5,name:"height",kind:"scalar",T:13},{no:6,name:"muted",kind:"scalar",T:8},{no:7,name:"disable_dtx",kind:"scalar",T:8},{no:8,name:"source",kind:"enum",T:Se.getEnumType(gi)},{no:9,name:"layers",kind:"message",T:Gd,repeated:!0},{no:10,name:"simulcast_codecs",kind:"message",T:j1,repeated:!0},{no:11,name:"sid",kind:"scalar",T:9},{no:12,name:"stereo",kind:"scalar",T:8},{no:13,name:"disable_red",kind:"scalar",T:8},{no:14,name:"encryption",kind:"enum",T:Se.getEnumType(Po)},{no:15,name:"stream",kind:"scalar",T:9},{no:16,name:"backup_codec_policy",kind:"enum",T:Se.getEnumType(jD)}]),z1=Se.makeMessageType("livekit.TrickleRequest",()=>[{no:1,name:"candidateInit",kind:"scalar",T:9},{no:2,name:"target",kind:"enum",T:Se.getEnumType(Ts)},{no:3,name:"final",kind:"scalar",T:8}]),B1=Se.makeMessageType("livekit.MuteTrackRequest",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"muted",kind:"scalar",T:8}]),l8=Se.makeMessageType("livekit.JoinResponse",()=>[{no:1,name:"room",kind:"message",T:A1},{no:2,name:"participant",kind:"message",T:wg},{no:3,name:"other_participants",kind:"message",T:wg,repeated:!0},{no:4,name:"server_version",kind:"scalar",T:9},{no:5,name:"ice_servers",kind:"message",T:oA,repeated:!0},{no:6,name:"subscriber_primary",kind:"scalar",T:8},{no:7,name:"alternative_url",kind:"scalar",T:9},{no:8,name:"client_configuration",kind:"message",T:ZD},{no:9,name:"server_region",kind:"scalar",T:9},{no:10,name:"ping_timeout",kind:"scalar",T:5},{no:11,name:"ping_interval",kind:"scalar",T:5},{no:12,name:"server_info",kind:"message",T:r8},{no:13,name:"sif_trailer",kind:"scalar",T:12},{no:14,name:"enabled_publish_codecs",kind:"message",T:$0,repeated:!0},{no:15,name:"fast_publish",kind:"scalar",T:8}]),u8=Se.makeMessageType("livekit.ReconnectResponse",()=>[{no:1,name:"ice_servers",kind:"message",T:oA,repeated:!0},{no:2,name:"client_configuration",kind:"message",T:ZD}]),H1=Se.makeMessageType("livekit.TrackPublishedResponse",()=>[{no:1,name:"cid",kind:"scalar",T:9},{no:2,name:"track",kind:"message",T:Uh}]),c8=Se.makeMessageType("livekit.TrackUnpublishedResponse",()=>[{no:1,name:"track_sid",kind:"scalar",T:9}]),Yd=Se.makeMessageType("livekit.SessionDescription",()=>[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"sdp",kind:"scalar",T:9}]),d8=Se.makeMessageType("livekit.ParticipantUpdate",()=>[{no:1,name:"participants",kind:"message",T:wg,repeated:!0}]),q0=Se.makeMessageType("livekit.UpdateSubscription",()=>[{no:1,name:"track_sids",kind:"scalar",T:9,repeated:!0},{no:2,name:"subscribe",kind:"scalar",T:8},{no:3,name:"participant_tracks",kind:"message",T:GD,repeated:!0}]),nA=Se.makeMessageType("livekit.UpdateTrackSettings",()=>[{no:1,name:"track_sids",kind:"scalar",T:9,repeated:!0},{no:3,name:"disabled",kind:"scalar",T:8},{no:4,name:"quality",kind:"enum",T:Se.getEnumType(Nh)},{no:5,name:"width",kind:"scalar",T:13},{no:6,name:"height",kind:"scalar",T:13},{no:7,name:"fps",kind:"scalar",T:13},{no:8,name:"priority",kind:"scalar",T:13}]),rA=Se.makeMessageType("livekit.UpdateLocalAudioTrack",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"features",kind:"enum",T:Se.getEnumType(ul),repeated:!0}]),f8=Se.makeMessageType("livekit.UpdateLocalVideoTrack",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"width",kind:"scalar",T:13},{no:3,name:"height",kind:"scalar",T:13}]),W0=Se.makeMessageType("livekit.LeaveRequest",()=>[{no:1,name:"can_reconnect",kind:"scalar",T:8},{no:2,name:"reason",kind:"enum",T:Se.getEnumType(ks)},{no:3,name:"action",kind:"enum",T:Se.getEnumType(Fh)},{no:4,name:"regions",kind:"message",T:T8}]),Fh=Se.makeEnum("livekit.LeaveRequest.Action",[{no:0,name:"DISCONNECT"},{no:1,name:"RESUME"},{no:2,name:"RECONNECT"}]),iA=Se.makeMessageType("livekit.UpdateVideoLayers",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"layers",kind:"message",T:Gd,repeated:!0}]),aA=Se.makeMessageType("livekit.UpdateParticipantMetadata",()=>[{no:1,name:"metadata",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:4,name:"request_id",kind:"scalar",T:13}]),oA=Se.makeMessageType("livekit.ICEServer",()=>[{no:1,name:"urls",kind:"scalar",T:9,repeated:!0},{no:2,name:"username",kind:"scalar",T:9},{no:3,name:"credential",kind:"scalar",T:9}]),h8=Se.makeMessageType("livekit.SpeakersChanged",()=>[{no:1,name:"speakers",kind:"message",T:VD,repeated:!0}]),p8=Se.makeMessageType("livekit.RoomUpdate",()=>[{no:1,name:"room",kind:"message",T:A1}]),m8=Se.makeMessageType("livekit.ConnectionQualityInfo",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"quality",kind:"enum",T:Se.getEnumType(Tg)},{no:3,name:"score",kind:"scalar",T:2}]),g8=Se.makeMessageType("livekit.ConnectionQualityUpdate",()=>[{no:1,name:"updates",kind:"message",T:m8,repeated:!0}]),v8=Se.makeMessageType("livekit.StreamStateInfo",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sid",kind:"scalar",T:9},{no:3,name:"state",kind:"enum",T:Se.getEnumType(F1)}]),y8=Se.makeMessageType("livekit.StreamStateUpdate",()=>[{no:1,name:"stream_states",kind:"message",T:v8,repeated:!0}]),$1=Se.makeMessageType("livekit.SubscribedQuality",()=>[{no:1,name:"quality",kind:"enum",T:Se.getEnumType(Nh)},{no:2,name:"enabled",kind:"scalar",T:8}]),b8=Se.makeMessageType("livekit.SubscribedCodec",()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"qualities",kind:"message",T:$1,repeated:!0}]),S8=Se.makeMessageType("livekit.SubscribedQualityUpdate",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"subscribed_qualities",kind:"message",T:$1,repeated:!0},{no:3,name:"subscribed_codecs",kind:"message",T:b8,repeated:!0}]),sA=Se.makeMessageType("livekit.TrackPermission",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"all_tracks",kind:"scalar",T:8},{no:3,name:"track_sids",kind:"scalar",T:9,repeated:!0},{no:4,name:"participant_identity",kind:"scalar",T:9}]),lA=Se.makeMessageType("livekit.SubscriptionPermission",()=>[{no:1,name:"all_participants",kind:"scalar",T:8},{no:2,name:"track_permissions",kind:"message",T:sA,repeated:!0}]),C8=Se.makeMessageType("livekit.SubscriptionPermissionUpdate",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sid",kind:"scalar",T:9},{no:3,name:"allowed",kind:"scalar",T:8}]),uA=Se.makeMessageType("livekit.SyncState",()=>[{no:1,name:"answer",kind:"message",T:Yd},{no:2,name:"subscription",kind:"message",T:q0},{no:3,name:"publish_tracks",kind:"message",T:H1,repeated:!0},{no:4,name:"data_channels",kind:"message",T:cA,repeated:!0},{no:5,name:"offer",kind:"message",T:Yd},{no:6,name:"track_sids_disabled",kind:"scalar",T:9,repeated:!0}]),cA=Se.makeMessageType("livekit.DataChannelInfo",()=>[{no:1,name:"label",kind:"scalar",T:9},{no:2,name:"id",kind:"scalar",T:13},{no:3,name:"target",kind:"enum",T:Se.getEnumType(Ts)}]),cl=Se.makeMessageType("livekit.SimulateScenario",()=>[{no:1,name:"speaker_update",kind:"scalar",T:5,oneof:"scenario"},{no:2,name:"node_failure",kind:"scalar",T:8,oneof:"scenario"},{no:3,name:"migration",kind:"scalar",T:8,oneof:"scenario"},{no:4,name:"server_leave",kind:"scalar",T:8,oneof:"scenario"},{no:5,name:"switch_candidate_protocol",kind:"enum",T:Se.getEnumType(o8),oneof:"scenario"},{no:6,name:"subscriber_bandwidth",kind:"scalar",T:3,oneof:"scenario"},{no:7,name:"disconnect_signal_on_resume",kind:"scalar",T:8,oneof:"scenario"},{no:8,name:"disconnect_signal_on_resume_no_messages",kind:"scalar",T:8,oneof:"scenario"},{no:9,name:"leave_request_full_reconnect",kind:"scalar",T:8,oneof:"scenario"}]),dA=Se.makeMessageType("livekit.Ping",()=>[{no:1,name:"timestamp",kind:"scalar",T:3},{no:2,name:"rtt",kind:"scalar",T:3}]),k8=Se.makeMessageType("livekit.Pong",()=>[{no:1,name:"last_ping_timestamp",kind:"scalar",T:3},{no:2,name:"timestamp",kind:"scalar",T:3}]),T8=Se.makeMessageType("livekit.RegionSettings",()=>[{no:1,name:"regions",kind:"message",T:x8,repeated:!0}]),x8=Se.makeMessageType("livekit.RegionInfo",()=>[{no:1,name:"region",kind:"scalar",T:9},{no:2,name:"url",kind:"scalar",T:9},{no:3,name:"distance",kind:"scalar",T:3}]),w8=Se.makeMessageType("livekit.SubscriptionResponse",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"err",kind:"enum",T:Se.getEnumType(Z6)}]),_8=Se.makeMessageType("livekit.RequestResponse",()=>[{no:1,name:"request_id",kind:"scalar",T:13},{no:2,name:"reason",kind:"enum",T:Se.getEnumType(q1)},{no:3,name:"message",kind:"scalar",T:9}]),q1=Se.makeEnum("livekit.RequestResponse.Reason",[{no:0,name:"OK"},{no:1,name:"NOT_FOUND"},{no:2,name:"NOT_ALLOWED"},{no:3,name:"LIMIT_EXCEEDED"}]),E8=Se.makeMessageType("livekit.TrackSubscribed",()=>[{no:1,name:"track_sid",kind:"scalar",T:9}]);function R8(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var G0={exports:{}},P8=G0.exports,fA;function D8(){return fA||(fA=1,function(t){(function(e,n){t.exports?t.exports=n():e.log=n()})(P8,function(){var e=function(){},n="undefined",r=typeof window!==n&&typeof window.navigator!==n&&/Trident\/|MSIE /.test(window.navigator.userAgent),a=["trace","debug","info","warn","error"],s={},l=null;function c(R,M){var A=R[M];if(typeof A.bind=="function")return A.bind(R);try{return Function.prototype.bind.call(A,R)}catch{return function(){return Function.prototype.apply.apply(A,[R,arguments])}}}function h(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function p(R){return R==="debug"&&(R="log"),typeof console===n?!1:R==="trace"&&r?h:console[R]!==void 0?c(console,R):console.log!==void 0?c(console,"log"):e}function v(){for(var R=this.getLevel(),M=0;M<a.length;M++){var A=a[M];this[A]=M<R?e:this.methodFactory(A,R,this.name)}if(this.log=this.debug,typeof console===n&&R<this.levels.SILENT)return"No console available for logging"}function b(R){return function(){typeof console!==n&&(v.call(this),this[R].apply(this,arguments))}}function k(R,M,A){return p(R)||b.apply(this,arguments)}function T(R,M){var A=this,U,V,j,I="loglevel";typeof R=="string"?I+=":"+R:typeof R=="symbol"&&(I=void 0);function N(oe){var J=(a[oe]||"silent").toUpperCase();if(!(typeof window===n||!I)){try{window.localStorage[I]=J;return}catch{}try{window.document.cookie=encodeURIComponent(I)+"="+J+";"}catch{}}}function ne(){var oe;if(!(typeof window===n||!I)){try{oe=window.localStorage[I]}catch{}if(typeof oe===n)try{var J=window.document.cookie,xe=encodeURIComponent(I),ke=J.indexOf(xe+"=");ke!==-1&&(oe=/^([^;]+)/.exec(J.slice(ke+xe.length+1))[1])}catch{}return A.levels[oe]===void 0&&(oe=void 0),oe}}function X(){if(!(typeof window===n||!I)){try{window.localStorage.removeItem(I)}catch{}try{window.document.cookie=encodeURIComponent(I)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function se(oe){var J=oe;if(typeof J=="string"&&A.levels[J.toUpperCase()]!==void 0&&(J=A.levels[J.toUpperCase()]),typeof J=="number"&&J>=0&&J<=A.levels.SILENT)return J;throw new TypeError("log.setLevel() called with invalid level: "+oe)}A.name=R,A.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},A.methodFactory=M||k,A.getLevel=function(){return j??V??U},A.setLevel=function(oe,J){return j=se(oe),J!==!1&&N(j),v.call(A)},A.setDefaultLevel=function(oe){V=se(oe),ne()||A.setLevel(oe,!1)},A.resetLevel=function(){j=null,X(),v.call(A)},A.enableAll=function(oe){A.setLevel(A.levels.TRACE,oe)},A.disableAll=function(oe){A.setLevel(A.levels.SILENT,oe)},A.rebuild=function(){if(l!==A&&(U=se(l.getLevel())),v.call(A),l===A)for(var oe in s)s[oe].rebuild()},U=se(l?l.getLevel():"WARN");var $=ne();$!=null&&(j=se($)),v.call(A)}l=new T,l.getLogger=function(M){if(typeof M!="symbol"&&typeof M!="string"||M==="")throw new TypeError("You must supply a name when creating a logger.");var A=s[M];return A||(A=s[M]=new T(M,l.methodFactory)),A};var E=typeof window!==n?window.log:void 0;return l.noConflict=function(){return typeof window!==n&&window.log===l&&(window.log=E),l},l.getLoggers=function(){return s},l.default=l,l})}(G0)),G0.exports}var Y0=D8(),W1;(function(t){t[t.trace=0]="trace",t[t.debug=1]="debug",t[t.info=2]="info",t[t.warn=3]="warn",t[t.error=4]="error",t[t.silent=5]="silent"})(W1||(W1={}));var xs;(function(t){t.Default="livekit",t.Room="livekit-room",t.Participant="livekit-participant",t.Track="livekit-track",t.Publication="livekit-track-publication",t.Engine="livekit-engine",t.Signal="livekit-signal",t.PCManager="livekit-pc-manager",t.PCTransport="livekit-pc-transport",t.E2EE="lk-e2ee"})(xs||(xs={}));let Nn=Y0.getLogger("livekit");Object.values(xs).map(t=>Y0.getLogger(t)),Nn.setDefaultLevel(W1.info);function lu(t){const e=Y0.getLogger(t);return e.setDefaultLevel(Nn.getLevel()),e}const A8=Y0.getLogger("lk-e2ee"),Eg=7e3,O8=[0,300,2*2*300,3*3*300,4*4*300,Eg,Eg,Eg,Eg,Eg];class M8{constructor(e){this._retryDelays=e!==void 0?[...e]:O8}nextRetryDelayInMs(e){if(e.retryCount>=this._retryDelays.length)return null;const n=this._retryDelays[e.retryCount];return e.retryCount<=1?n:n+Math.random()*1e3}}function L8(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,r=Object.getOwnPropertySymbols(t);a<r.length;a++)e.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(t,r[a])&&(n[r[a]]=t[r[a]]);return n}function Q(t,e,n,r){function a(s){return s instanceof n?s:new n(function(l){l(s)})}return new(n||(n=Promise))(function(s,l){function c(v){try{p(r.next(v))}catch(b){l(b)}}function h(v){try{p(r.throw(v))}catch(b){l(b)}}function p(v){v.done?s(v.value):a(v.value).then(c,h)}p((r=r.apply(t,e||[])).next())})}function hA(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function pc(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof hA=="function"?hA(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(s){n[s]=t[s]&&function(l){return new Promise(function(c,h){l=t[s](l),a(c,h,l.done,l.value)})}}function a(s,l,c,h){Promise.resolve(h).then(function(p){s({value:p,done:c})},l)}}typeof SuppressedError=="function"&&SuppressedError;var K0={exports:{}},pA;function N8(){if(pA)return K0.exports;pA=1;var t=typeof Reflect=="object"?Reflect:null,e=t&&typeof t.apply=="function"?t.apply:function(I,N,ne){return Function.prototype.apply.call(I,N,ne)},n;t&&typeof t.ownKeys=="function"?n=t.ownKeys:Object.getOwnPropertySymbols?n=function(I){return Object.getOwnPropertyNames(I).concat(Object.getOwnPropertySymbols(I))}:n=function(I){return Object.getOwnPropertyNames(I)};function r(j){console&&console.warn&&console.warn(j)}var a=Number.isNaN||function(I){return I!==I};function s(){s.init.call(this)}K0.exports=s,K0.exports.once=A,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var l=10;function c(j){if(typeof j!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof j)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return l},set:function(j){if(typeof j!="number"||j<0||a(j))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+j+".");l=j}}),s.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(I){if(typeof I!="number"||I<0||a(I))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+I+".");return this._maxListeners=I,this};function h(j){return j._maxListeners===void 0?s.defaultMaxListeners:j._maxListeners}s.prototype.getMaxListeners=function(){return h(this)},s.prototype.emit=function(I){for(var N=[],ne=1;ne<arguments.length;ne++)N.push(arguments[ne]);var X=I==="error",se=this._events;if(se!==void 0)X=X&&se.error===void 0;else if(!X)return!1;if(X){var $;if(N.length>0&&($=N[0]),$ instanceof Error)throw $;var oe=new Error("Unhandled error."+($?" ("+$.message+")":""));throw oe.context=$,oe}var J=se[I];if(J===void 0)return!1;if(typeof J=="function")e(J,this,N);else for(var xe=J.length,ke=E(J,xe),ne=0;ne<xe;++ne)e(ke[ne],this,N);return!0};function p(j,I,N,ne){var X,se,$;if(c(N),se=j._events,se===void 0?(se=j._events=Object.create(null),j._eventsCount=0):(se.newListener!==void 0&&(j.emit("newListener",I,N.listener?N.listener:N),se=j._events),$=se[I]),$===void 0)$=se[I]=N,++j._eventsCount;else if(typeof $=="function"?$=se[I]=ne?[N,$]:[$,N]:ne?$.unshift(N):$.push(N),X=h(j),X>0&&$.length>X&&!$.warned){$.warned=!0;var oe=new Error("Possible EventEmitter memory leak detected. "+$.length+" "+String(I)+" listeners added. Use emitter.setMaxListeners() to increase limit");oe.name="MaxListenersExceededWarning",oe.emitter=j,oe.type=I,oe.count=$.length,r(oe)}return j}s.prototype.addListener=function(I,N){return p(this,I,N,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(I,N){return p(this,I,N,!0)};function v(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function b(j,I,N){var ne={fired:!1,wrapFn:void 0,target:j,type:I,listener:N},X=v.bind(ne);return X.listener=N,ne.wrapFn=X,X}s.prototype.once=function(I,N){return c(N),this.on(I,b(this,I,N)),this},s.prototype.prependOnceListener=function(I,N){return c(N),this.prependListener(I,b(this,I,N)),this},s.prototype.removeListener=function(I,N){var ne,X,se,$,oe;if(c(N),X=this._events,X===void 0)return this;if(ne=X[I],ne===void 0)return this;if(ne===N||ne.listener===N)--this._eventsCount===0?this._events=Object.create(null):(delete X[I],X.removeListener&&this.emit("removeListener",I,ne.listener||N));else if(typeof ne!="function"){for(se=-1,$=ne.length-1;$>=0;$--)if(ne[$]===N||ne[$].listener===N){oe=ne[$].listener,se=$;break}if(se<0)return this;se===0?ne.shift():R(ne,se),ne.length===1&&(X[I]=ne[0]),X.removeListener!==void 0&&this.emit("removeListener",I,oe||N)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(I){var N,ne,X;if(ne=this._events,ne===void 0)return this;if(ne.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):ne[I]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete ne[I]),this;if(arguments.length===0){var se=Object.keys(ne),$;for(X=0;X<se.length;++X)$=se[X],$!=="removeListener"&&this.removeAllListeners($);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(N=ne[I],typeof N=="function")this.removeListener(I,N);else if(N!==void 0)for(X=N.length-1;X>=0;X--)this.removeListener(I,N[X]);return this};function k(j,I,N){var ne=j._events;if(ne===void 0)return[];var X=ne[I];return X===void 0?[]:typeof X=="function"?N?[X.listener||X]:[X]:N?M(X):E(X,X.length)}s.prototype.listeners=function(I){return k(this,I,!0)},s.prototype.rawListeners=function(I){return k(this,I,!1)},s.listenerCount=function(j,I){return typeof j.listenerCount=="function"?j.listenerCount(I):T.call(j,I)},s.prototype.listenerCount=T;function T(j){var I=this._events;if(I!==void 0){var N=I[j];if(typeof N=="function")return 1;if(N!==void 0)return N.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]};function E(j,I){for(var N=new Array(I),ne=0;ne<I;++ne)N[ne]=j[ne];return N}function R(j,I){for(;I+1<j.length;I++)j[I]=j[I+1];j.pop()}function M(j){for(var I=new Array(j.length),N=0;N<I.length;++N)I[N]=j[N].listener||j[N];return I}function A(j,I){return new Promise(function(N,ne){function X($){j.removeListener(I,se),ne($)}function se(){typeof j.removeListener=="function"&&j.removeListener("error",X),N([].slice.call(arguments))}V(j,I,se,{once:!0}),I!=="error"&&U(j,X,{once:!0})})}function U(j,I,N){typeof j.on=="function"&&V(j,"error",I,N)}function V(j,I,N,ne){if(typeof j.on=="function")ne.once?j.once(I,N):j.on(I,N);else if(typeof j.addEventListener=="function")j.addEventListener(I,function X(se){ne.once&&j.removeEventListener(I,X),N(se)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof j)}return K0.exports}var dl=N8();let mA=!0,gA=!0;function Z0(t,e,n){const r=t.match(e);return r&&r.length>=n&&parseInt(r[n],10)}function Kd(t,e,n){if(!t.RTCPeerConnection)return;const r=t.RTCPeerConnection.prototype,a=r.addEventListener;r.addEventListener=function(l,c){if(l!==e)return a.apply(this,arguments);const h=p=>{const v=n(p);v&&(c.handleEvent?c.handleEvent(v):c(v))};return this._eventMap=this._eventMap||{},this._eventMap[e]||(this._eventMap[e]=new Map),this._eventMap[e].set(c,h),a.apply(this,[l,h])};const s=r.removeEventListener;r.removeEventListener=function(l,c){if(l!==e||!this._eventMap||!this._eventMap[e])return s.apply(this,arguments);if(!this._eventMap[e].has(c))return s.apply(this,arguments);const h=this._eventMap[e].get(c);return this._eventMap[e].delete(c),this._eventMap[e].size===0&&delete this._eventMap[e],Object.keys(this._eventMap).length===0&&delete this._eventMap,s.apply(this,[l,h])},Object.defineProperty(r,"on"+e,{get(){return this["_on"+e]},set(l){this["_on"+e]&&(this.removeEventListener(e,this["_on"+e]),delete this["_on"+e]),l&&this.addEventListener(e,this["_on"+e]=l)},enumerable:!0,configurable:!0})}function I8(t){return typeof t!="boolean"?new Error("Argument type: "+typeof t+". Please use a boolean."):(mA=t,t?"adapter.js logging disabled":"adapter.js logging enabled")}function U8(t){return typeof t!="boolean"?new Error("Argument type: "+typeof t+". Please use a boolean."):(gA=!t,"adapter.js deprecation warnings "+(t?"disabled":"enabled"))}function vA(){if(typeof window=="object"){if(mA)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function G1(t,e){gA&&console.warn(t+" is deprecated, please use "+e+" instead.")}function F8(t){const e={browser:null,version:null};if(typeof t>"u"||!t.navigator||!t.navigator.userAgent)return e.browser="Not a browser.",e;const{navigator:n}=t;if(n.userAgentData&&n.userAgentData.brands){const r=n.userAgentData.brands.find(a=>a.brand==="Chromium");if(r)return{browser:"chrome",version:parseInt(r.version,10)}}if(n.mozGetUserMedia)e.browser="firefox",e.version=Z0(n.userAgent,/Firefox\/(\d+)\./,1);else if(n.webkitGetUserMedia||t.isSecureContext===!1&&t.webkitRTCPeerConnection)e.browser="chrome",e.version=Z0(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(t.RTCPeerConnection&&n.userAgent.match(/AppleWebKit\/(\d+)\./))e.browser="safari",e.version=Z0(n.userAgent,/AppleWebKit\/(\d+)\./,1),e.supportsUnifiedPlan=t.RTCRtpTransceiver&&"currentDirection"in t.RTCRtpTransceiver.prototype;else return e.browser="Not a supported browser.",e;return e}function yA(t){return Object.prototype.toString.call(t)==="[object Object]"}function bA(t){return yA(t)?Object.keys(t).reduce(function(e,n){const r=yA(t[n]),a=r?bA(t[n]):t[n],s=r&&!Object.keys(a).length;return a===void 0||s?e:Object.assign(e,{[n]:a})},{}):t}function Y1(t,e,n){!e||n.has(e.id)||(n.set(e.id,e),Object.keys(e).forEach(r=>{r.endsWith("Id")?Y1(t,t.get(e[r]),n):r.endsWith("Ids")&&e[r].forEach(a=>{Y1(t,t.get(a),n)})}))}function SA(t,e,n){const r=n?"outbound-rtp":"inbound-rtp",a=new Map;if(e===null)return a;const s=[];return t.forEach(l=>{l.type==="track"&&l.trackIdentifier===e.id&&s.push(l)}),s.forEach(l=>{t.forEach(c=>{c.type===r&&c.trackId===l.id&&Y1(t,c,a)})}),a}const CA=vA;function kA(t,e){const n=t&&t.navigator;if(!n.mediaDevices)return;const r=function(c){if(typeof c!="object"||c.mandatory||c.optional)return c;const h={};return Object.keys(c).forEach(p=>{if(p==="require"||p==="advanced"||p==="mediaSource")return;const v=typeof c[p]=="object"?c[p]:{ideal:c[p]};v.exact!==void 0&&typeof v.exact=="number"&&(v.min=v.max=v.exact);const b=function(k,T){return k?k+T.charAt(0).toUpperCase()+T.slice(1):T==="deviceId"?"sourceId":T};if(v.ideal!==void 0){h.optional=h.optional||[];let k={};typeof v.ideal=="number"?(k[b("min",p)]=v.ideal,h.optional.push(k),k={},k[b("max",p)]=v.ideal,h.optional.push(k)):(k[b("",p)]=v.ideal,h.optional.push(k))}v.exact!==void 0&&typeof v.exact!="number"?(h.mandatory=h.mandatory||{},h.mandatory[b("",p)]=v.exact):["min","max"].forEach(k=>{v[k]!==void 0&&(h.mandatory=h.mandatory||{},h.mandatory[b(k,p)]=v[k])})}),c.advanced&&(h.optional=(h.optional||[]).concat(c.advanced)),h},a=function(c,h){if(e.version>=61)return h(c);if(c=JSON.parse(JSON.stringify(c)),c&&typeof c.audio=="object"){const p=function(v,b,k){b in v&&!(k in v)&&(v[k]=v[b],delete v[b])};c=JSON.parse(JSON.stringify(c)),p(c.audio,"autoGainControl","googAutoGainControl"),p(c.audio,"noiseSuppression","googNoiseSuppression"),c.audio=r(c.audio)}if(c&&typeof c.video=="object"){let p=c.video.facingMode;p=p&&(typeof p=="object"?p:{ideal:p});const v=e.version<66;if(p&&(p.exact==="user"||p.exact==="environment"||p.ideal==="user"||p.ideal==="environment")&&!(n.mediaDevices.getSupportedConstraints&&n.mediaDevices.getSupportedConstraints().facingMode&&!v)){delete c.video.facingMode;let b;if(p.exact==="environment"||p.ideal==="environment"?b=["back","rear"]:(p.exact==="user"||p.ideal==="user")&&(b=["front"]),b)return n.mediaDevices.enumerateDevices().then(k=>{k=k.filter(E=>E.kind==="videoinput");let T=k.find(E=>b.some(R=>E.label.toLowerCase().includes(R)));return!T&&k.length&&b.includes("back")&&(T=k[k.length-1]),T&&(c.video.deviceId=p.exact?{exact:T.deviceId}:{ideal:T.deviceId}),c.video=r(c.video),CA("chrome: "+JSON.stringify(c)),h(c)})}c.video=r(c.video)}return CA("chrome: "+JSON.stringify(c)),h(c)},s=function(c){return e.version>=64?c:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[c.name]||c.name,message:c.message,constraint:c.constraint||c.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}},l=function(c,h,p){a(c,v=>{n.webkitGetUserMedia(v,h,b=>{p&&p(s(b))})})};if(n.getUserMedia=l.bind(n),n.mediaDevices.getUserMedia){const c=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(h){return a(h,p=>c(p).then(v=>{if(p.audio&&!v.getAudioTracks().length||p.video&&!v.getVideoTracks().length)throw v.getTracks().forEach(b=>{b.stop()}),new DOMException("","NotFoundError");return v},v=>Promise.reject(s(v))))}}}function TA(t){t.MediaStream=t.MediaStream||t.webkitMediaStream}function xA(t){if(typeof t=="object"&&t.RTCPeerConnection&&!("ontrack"in t.RTCPeerConnection.prototype)){Object.defineProperty(t.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(n){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=n)},enumerable:!0,configurable:!0});const e=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=r=>{r.stream.addEventListener("addtrack",a=>{let s;t.RTCPeerConnection.prototype.getReceivers?s=this.getReceivers().find(c=>c.track&&c.track.id===a.track.id):s={track:a.track};const l=new Event("track");l.track=a.track,l.receiver=s,l.transceiver={receiver:s},l.streams=[r.stream],this.dispatchEvent(l)}),r.stream.getTracks().forEach(a=>{let s;t.RTCPeerConnection.prototype.getReceivers?s=this.getReceivers().find(c=>c.track&&c.track.id===a.id):s={track:a};const l=new Event("track");l.track=a,l.receiver=s,l.transceiver={receiver:s},l.streams=[r.stream],this.dispatchEvent(l)})},this.addEventListener("addstream",this._ontrackpoly)),e.apply(this,arguments)}}else Kd(t,"track",e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e))}function wA(t){if(typeof t=="object"&&t.RTCPeerConnection&&!("getSenders"in t.RTCPeerConnection.prototype)&&"createDTMFSender"in t.RTCPeerConnection.prototype){const e=function(a,s){return{track:s,get dtmf(){return this._dtmf===void 0&&(s.kind==="audio"?this._dtmf=a.createDTMFSender(s):this._dtmf=null),this._dtmf},_pc:a}};if(!t.RTCPeerConnection.prototype.getSenders){t.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const a=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(c,h){let p=a.apply(this,arguments);return p||(p=e(this,c),this._senders.push(p)),p};const s=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(c){s.apply(this,arguments);const h=this._senders.indexOf(c);h!==-1&&this._senders.splice(h,1)}}const n=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(s){this._senders=this._senders||[],n.apply(this,[s]),s.getTracks().forEach(l=>{this._senders.push(e(this,l))})};const r=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(s){this._senders=this._senders||[],r.apply(this,[s]),s.getTracks().forEach(l=>{const c=this._senders.find(h=>h.track===l);c&&this._senders.splice(this._senders.indexOf(c),1)})}}else if(typeof t=="object"&&t.RTCPeerConnection&&"getSenders"in t.RTCPeerConnection.prototype&&"createDTMFSender"in t.RTCPeerConnection.prototype&&t.RTCRtpSender&&!("dtmf"in t.RTCRtpSender.prototype)){const e=t.RTCPeerConnection.prototype.getSenders;t.RTCPeerConnection.prototype.getSenders=function(){const r=e.apply(this,[]);return r.forEach(a=>a._pc=this),r},Object.defineProperty(t.RTCRtpSender.prototype,"dtmf",{get(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function _A(t){if(!(typeof t=="object"&&t.RTCPeerConnection&&t.RTCRtpSender&&t.RTCRtpReceiver))return;if(!("getStats"in t.RTCRtpSender.prototype)){const n=t.RTCPeerConnection.prototype.getSenders;n&&(t.RTCPeerConnection.prototype.getSenders=function(){const s=n.apply(this,[]);return s.forEach(l=>l._pc=this),s});const r=t.RTCPeerConnection.prototype.addTrack;r&&(t.RTCPeerConnection.prototype.addTrack=function(){const s=r.apply(this,arguments);return s._pc=this,s}),t.RTCRtpSender.prototype.getStats=function(){const s=this;return this._pc.getStats().then(l=>SA(l,s.track,!0))}}if(!("getStats"in t.RTCRtpReceiver.prototype)){const n=t.RTCPeerConnection.prototype.getReceivers;n&&(t.RTCPeerConnection.prototype.getReceivers=function(){const a=n.apply(this,[]);return a.forEach(s=>s._pc=this),a}),Kd(t,"track",r=>(r.receiver._pc=r.srcElement,r)),t.RTCRtpReceiver.prototype.getStats=function(){const a=this;return this._pc.getStats().then(s=>SA(s,a.track,!1))}}if(!("getStats"in t.RTCRtpSender.prototype&&"getStats"in t.RTCRtpReceiver.prototype))return;const e=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof t.MediaStreamTrack){const r=arguments[0];let a,s,l;return this.getSenders().forEach(c=>{c.track===r&&(a?l=!0:a=c)}),this.getReceivers().forEach(c=>(c.track===r&&(s?l=!0:s=c),c.track===r)),l||a&&s?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):a?a.getStats():s?s.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return e.apply(this,arguments)}}function EA(t){t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(l=>this._shimmedLocalStreams[l][0])};const e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(l,c){if(!c)return e.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const h=e.apply(this,arguments);return this._shimmedLocalStreams[c.id]?this._shimmedLocalStreams[c.id].indexOf(h)===-1&&this._shimmedLocalStreams[c.id].push(h):this._shimmedLocalStreams[c.id]=[c,h],h};const n=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(l){this._shimmedLocalStreams=this._shimmedLocalStreams||{},l.getTracks().forEach(p=>{if(this.getSenders().find(b=>b.track===p))throw new DOMException("Track already exists.","InvalidAccessError")});const c=this.getSenders();n.apply(this,arguments);const h=this.getSenders().filter(p=>c.indexOf(p)===-1);this._shimmedLocalStreams[l.id]=[l].concat(h)};const r=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(l){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[l.id],r.apply(this,arguments)};const a=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(l){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},l&&Object.keys(this._shimmedLocalStreams).forEach(c=>{const h=this._shimmedLocalStreams[c].indexOf(l);h!==-1&&this._shimmedLocalStreams[c].splice(h,1),this._shimmedLocalStreams[c].length===1&&delete this._shimmedLocalStreams[c]}),a.apply(this,arguments)}}function RA(t,e){if(!t.RTCPeerConnection)return;if(t.RTCPeerConnection.prototype.addTrack&&e.version>=65)return EA(t);const n=t.RTCPeerConnection.prototype.getLocalStreams;t.RTCPeerConnection.prototype.getLocalStreams=function(){const v=n.apply(this);return this._reverseStreams=this._reverseStreams||{},v.map(b=>this._reverseStreams[b.id])};const r=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(v){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},v.getTracks().forEach(b=>{if(this.getSenders().find(T=>T.track===b))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[v.id]){const b=new t.MediaStream(v.getTracks());this._streams[v.id]=b,this._reverseStreams[b.id]=v,v=b}r.apply(this,[v])};const a=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(v){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},a.apply(this,[this._streams[v.id]||v]),delete this._reverseStreams[this._streams[v.id]?this._streams[v.id].id:v.id],delete this._streams[v.id]},t.RTCPeerConnection.prototype.addTrack=function(v,b){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const k=[].slice.call(arguments,1);if(k.length!==1||!k[0].getTracks().find(R=>R===v))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find(R=>R.track===v))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const E=this._streams[b.id];if(E)E.addTrack(v),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const R=new t.MediaStream([v]);this._streams[b.id]=R,this._reverseStreams[R.id]=b,this.addStream(R)}return this.getSenders().find(R=>R.track===v)};function s(p,v){let b=v.sdp;return Object.keys(p._reverseStreams||[]).forEach(k=>{const T=p._reverseStreams[k],E=p._streams[T.id];b=b.replace(new RegExp(E.id,"g"),T.id)}),new RTCSessionDescription({type:v.type,sdp:b})}function l(p,v){let b=v.sdp;return Object.keys(p._reverseStreams||[]).forEach(k=>{const T=p._reverseStreams[k],E=p._streams[T.id];b=b.replace(new RegExp(T.id,"g"),E.id)}),new RTCSessionDescription({type:v.type,sdp:b})}["createOffer","createAnswer"].forEach(function(p){const v=t.RTCPeerConnection.prototype[p],b={[p](){const k=arguments;return arguments.length&&typeof arguments[0]=="function"?v.apply(this,[E=>{const R=s(this,E);k[0].apply(null,[R])},E=>{k[1]&&k[1].apply(null,E)},arguments[2]]):v.apply(this,arguments).then(E=>s(this,E))}};t.RTCPeerConnection.prototype[p]=b[p]});const c=t.RTCPeerConnection.prototype.setLocalDescription;t.RTCPeerConnection.prototype.setLocalDescription=function(){return!arguments.length||!arguments[0].type?c.apply(this,arguments):(arguments[0]=l(this,arguments[0]),c.apply(this,arguments))};const h=Object.getOwnPropertyDescriptor(t.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(t.RTCPeerConnection.prototype,"localDescription",{get(){const p=h.get.apply(this);return p.type===""?p:s(this,p)}}),t.RTCPeerConnection.prototype.removeTrack=function(v){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!v._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(v._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{};let k;Object.keys(this._streams).forEach(T=>{this._streams[T].getTracks().find(R=>v.track===R)&&(k=this._streams[T])}),k&&(k.getTracks().length===1?this.removeStream(this._reverseStreams[k.id]):k.removeTrack(v.track),this.dispatchEvent(new Event("negotiationneeded")))}}function K1(t,e){!t.RTCPeerConnection&&t.webkitRTCPeerConnection&&(t.RTCPeerConnection=t.webkitRTCPeerConnection),t.RTCPeerConnection&&e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(n){const r=t.RTCPeerConnection.prototype[n],a={[n](){return arguments[0]=new(n==="addIceCandidate"?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};t.RTCPeerConnection.prototype[n]=a[n]})}function PA(t,e){Kd(t,"negotiationneeded",n=>{const r=n.target;if(!((e.version<72||r.getConfiguration&&r.getConfiguration().sdpSemantics==="plan-b")&&r.signalingState!=="stable"))return n})}var DA=Object.freeze({__proto__:null,fixNegotiationNeeded:PA,shimAddTrackRemoveTrack:RA,shimAddTrackRemoveTrackWithNative:EA,shimGetSendersWithDtmf:wA,shimGetUserMedia:kA,shimMediaStream:TA,shimOnTrack:xA,shimPeerConnection:K1,shimSenderReceiverGetStats:_A});function AA(t,e){const n=t&&t.navigator,r=t&&t.MediaStreamTrack;if(n.getUserMedia=function(a,s,l){G1("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),n.mediaDevices.getUserMedia(a).then(s,l)},!(e.version>55&&"autoGainControl"in n.mediaDevices.getSupportedConstraints())){const a=function(l,c,h){c in l&&!(h in l)&&(l[h]=l[c],delete l[c])},s=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(l){return typeof l=="object"&&typeof l.audio=="object"&&(l=JSON.parse(JSON.stringify(l)),a(l.audio,"autoGainControl","mozAutoGainControl"),a(l.audio,"noiseSuppression","mozNoiseSuppression")),s(l)},r&&r.prototype.getSettings){const l=r.prototype.getSettings;r.prototype.getSettings=function(){const c=l.apply(this,arguments);return a(c,"mozAutoGainControl","autoGainControl"),a(c,"mozNoiseSuppression","noiseSuppression"),c}}if(r&&r.prototype.applyConstraints){const l=r.prototype.applyConstraints;r.prototype.applyConstraints=function(c){return this.kind==="audio"&&typeof c=="object"&&(c=JSON.parse(JSON.stringify(c)),a(c,"autoGainControl","mozAutoGainControl"),a(c,"noiseSuppression","mozNoiseSuppression")),l.apply(this,[c])}}}}function j8(t,e){t.navigator.mediaDevices&&"getDisplayMedia"in t.navigator.mediaDevices||t.navigator.mediaDevices&&(t.navigator.mediaDevices.getDisplayMedia=function(r){if(!(r&&r.video)){const a=new DOMException("getDisplayMedia without video constraints is undefined");return a.name="NotFoundError",a.code=8,Promise.reject(a)}return r.video===!0?r.video={mediaSource:e}:r.video.mediaSource=e,t.navigator.mediaDevices.getUserMedia(r)})}function OA(t){typeof t=="object"&&t.RTCTrackEvent&&"receiver"in t.RTCTrackEvent.prototype&&!("transceiver"in t.RTCTrackEvent.prototype)&&Object.defineProperty(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function Z1(t,e){if(typeof t!="object"||!(t.RTCPeerConnection||t.mozRTCPeerConnection))return;!t.RTCPeerConnection&&t.mozRTCPeerConnection&&(t.RTCPeerConnection=t.mozRTCPeerConnection),e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(a){const s=t.RTCPeerConnection.prototype[a],l={[a](){return arguments[0]=new(a==="addIceCandidate"?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),s.apply(this,arguments)}};t.RTCPeerConnection.prototype[a]=l[a]});const n={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},r=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){const[s,l,c]=arguments;return r.apply(this,[s||null]).then(h=>{if(e.version<53&&!l)try{h.forEach(p=>{p.type=n[p.type]||p.type})}catch(p){if(p.name!=="TypeError")throw p;h.forEach((v,b)=>{h.set(b,Object.assign({},v,{type:n[v.type]||v.type}))})}return h}).then(l,c)}}function MA(t){if(!(typeof t=="object"&&t.RTCPeerConnection&&t.RTCRtpSender)||t.RTCRtpSender&&"getStats"in t.RTCRtpSender.prototype)return;const e=t.RTCPeerConnection.prototype.getSenders;e&&(t.RTCPeerConnection.prototype.getSenders=function(){const a=e.apply(this,[]);return a.forEach(s=>s._pc=this),a});const n=t.RTCPeerConnection.prototype.addTrack;n&&(t.RTCPeerConnection.prototype.addTrack=function(){const a=n.apply(this,arguments);return a._pc=this,a}),t.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function LA(t){if(!(typeof t=="object"&&t.RTCPeerConnection&&t.RTCRtpSender)||t.RTCRtpSender&&"getStats"in t.RTCRtpReceiver.prototype)return;const e=t.RTCPeerConnection.prototype.getReceivers;e&&(t.RTCPeerConnection.prototype.getReceivers=function(){const r=e.apply(this,[]);return r.forEach(a=>a._pc=this),r}),Kd(t,"track",n=>(n.receiver._pc=n.srcElement,n)),t.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function NA(t){!t.RTCPeerConnection||"removeStream"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.removeStream=function(n){G1("removeStream","removeTrack"),this.getSenders().forEach(r=>{r.track&&n.getTracks().includes(r.track)&&this.removeTrack(r)})})}function IA(t){t.DataChannel&&!t.RTCDataChannel&&(t.RTCDataChannel=t.DataChannel)}function UA(t){if(!(typeof t=="object"&&t.RTCPeerConnection))return;const e=t.RTCPeerConnection.prototype.addTransceiver;e&&(t.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let r=arguments[1]&&arguments[1].sendEncodings;r===void 0&&(r=[]),r=[...r];const a=r.length>0;a&&r.forEach(l=>{if("rid"in l&&!/^[a-z0-9]{0,16}$/i.test(l.rid))throw new TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in l&&!(parseFloat(l.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in l&&!(parseFloat(l.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});const s=e.apply(this,arguments);if(a){const{sender:l}=s,c=l.getParameters();(!("encodings"in c)||c.encodings.length===1&&Object.keys(c.encodings[0]).length===0)&&(c.encodings=r,l.sendEncodings=r,this.setParametersPromises.push(l.setParameters(c).then(()=>{delete l.sendEncodings}).catch(()=>{delete l.sendEncodings})))}return s})}function FA(t){if(!(typeof t=="object"&&t.RTCRtpSender))return;const e=t.RTCRtpSender.prototype.getParameters;e&&(t.RTCRtpSender.prototype.getParameters=function(){const r=e.apply(this,arguments);return"encodings"in r||(r.encodings=[].concat(this.sendEncodings||[{}])),r})}function jA(t){if(!(typeof t=="object"&&t.RTCPeerConnection))return;const e=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>e.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):e.apply(this,arguments)}}function VA(t){if(!(typeof t=="object"&&t.RTCPeerConnection))return;const e=t.RTCPeerConnection.prototype.createAnswer;t.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>e.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):e.apply(this,arguments)}}var zA=Object.freeze({__proto__:null,shimAddTransceiver:UA,shimCreateAnswer:VA,shimCreateOffer:jA,shimGetDisplayMedia:j8,shimGetParameters:FA,shimGetUserMedia:AA,shimOnTrack:OA,shimPeerConnection:Z1,shimRTCDataChannel:IA,shimReceiverGetStats:LA,shimRemoveStream:NA,shimSenderGetStats:MA});function BA(t){if(!(typeof t!="object"||!t.RTCPeerConnection)){if("getLocalStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in t.RTCPeerConnection.prototype)){const e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addStream=function(r){this._localStreams||(this._localStreams=[]),this._localStreams.includes(r)||this._localStreams.push(r),r.getAudioTracks().forEach(a=>e.call(this,a,r)),r.getVideoTracks().forEach(a=>e.call(this,a,r))},t.RTCPeerConnection.prototype.addTrack=function(r){for(var a=arguments.length,s=new Array(a>1?a-1:0),l=1;l<a;l++)s[l-1]=arguments[l];return s&&s.forEach(c=>{this._localStreams?this._localStreams.includes(c)||this._localStreams.push(c):this._localStreams=[c]}),e.apply(this,arguments)}}"removeStream"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.removeStream=function(n){this._localStreams||(this._localStreams=[]);const r=this._localStreams.indexOf(n);if(r===-1)return;this._localStreams.splice(r,1);const a=n.getTracks();this.getSenders().forEach(s=>{a.includes(s.track)&&this.removeTrack(s)})})}}function HA(t){if(!(typeof t!="object"||!t.RTCPeerConnection)&&("getRemoteStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in t.RTCPeerConnection.prototype))){Object.defineProperty(t.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(n){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=n),this.addEventListener("track",this._onaddstreampoly=r=>{r.streams.forEach(a=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(a))return;this._remoteStreams.push(a);const s=new Event("addstream");s.stream=a,this.dispatchEvent(s)})})}});const e=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){const r=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(a){a.streams.forEach(s=>{if(r._remoteStreams||(r._remoteStreams=[]),r._remoteStreams.indexOf(s)>=0)return;r._remoteStreams.push(s);const l=new Event("addstream");l.stream=s,r.dispatchEvent(l)})}),e.apply(r,arguments)}}}function $A(t){if(typeof t!="object"||!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype,n=e.createOffer,r=e.createAnswer,a=e.setLocalDescription,s=e.setRemoteDescription,l=e.addIceCandidate;e.createOffer=function(p,v){const b=arguments.length>=2?arguments[2]:arguments[0],k=n.apply(this,[b]);return v?(k.then(p,v),Promise.resolve()):k},e.createAnswer=function(p,v){const b=arguments.length>=2?arguments[2]:arguments[0],k=r.apply(this,[b]);return v?(k.then(p,v),Promise.resolve()):k};let c=function(h,p,v){const b=a.apply(this,[h]);return v?(b.then(p,v),Promise.resolve()):b};e.setLocalDescription=c,c=function(h,p,v){const b=s.apply(this,[h]);return v?(b.then(p,v),Promise.resolve()):b},e.setRemoteDescription=c,c=function(h,p,v){const b=l.apply(this,[h]);return v?(b.then(p,v),Promise.resolve()):b},e.addIceCandidate=c}function qA(t){const e=t&&t.navigator;if(e.mediaDevices&&e.mediaDevices.getUserMedia){const n=e.mediaDevices,r=n.getUserMedia.bind(n);e.mediaDevices.getUserMedia=a=>r(WA(a))}!e.getUserMedia&&e.mediaDevices&&e.mediaDevices.getUserMedia&&(e.getUserMedia=(function(r,a,s){e.mediaDevices.getUserMedia(r).then(a,s)}).bind(e))}function WA(t){return t&&t.video!==void 0?Object.assign({},t,{video:bA(t.video)}):t}function GA(t){if(!t.RTCPeerConnection)return;const e=t.RTCPeerConnection;t.RTCPeerConnection=function(r,a){if(r&&r.iceServers){const s=[];for(let l=0;l<r.iceServers.length;l++){let c=r.iceServers[l];c.urls===void 0&&c.url?(G1("RTCIceServer.url","RTCIceServer.urls"),c=JSON.parse(JSON.stringify(c)),c.urls=c.url,delete c.url,s.push(c)):s.push(r.iceServers[l])}r.iceServers=s}return new e(r,a)},t.RTCPeerConnection.prototype=e.prototype,"generateCertificate"in e&&Object.defineProperty(t.RTCPeerConnection,"generateCertificate",{get(){return e.generateCertificate}})}function YA(t){typeof t=="object"&&t.RTCTrackEvent&&"receiver"in t.RTCTrackEvent.prototype&&!("transceiver"in t.RTCTrackEvent.prototype)&&Object.defineProperty(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function KA(t){const e=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function(r){if(r){typeof r.offerToReceiveAudio<"u"&&(r.offerToReceiveAudio=!!r.offerToReceiveAudio);const a=this.getTransceivers().find(l=>l.receiver.track.kind==="audio");r.offerToReceiveAudio===!1&&a?a.direction==="sendrecv"?a.setDirection?a.setDirection("sendonly"):a.direction="sendonly":a.direction==="recvonly"&&(a.setDirection?a.setDirection("inactive"):a.direction="inactive"):r.offerToReceiveAudio===!0&&!a&&this.addTransceiver("audio",{direction:"recvonly"}),typeof r.offerToReceiveVideo<"u"&&(r.offerToReceiveVideo=!!r.offerToReceiveVideo);const s=this.getTransceivers().find(l=>l.receiver.track.kind==="video");r.offerToReceiveVideo===!1&&s?s.direction==="sendrecv"?s.setDirection?s.setDirection("sendonly"):s.direction="sendonly":s.direction==="recvonly"&&(s.setDirection?s.setDirection("inactive"):s.direction="inactive"):r.offerToReceiveVideo===!0&&!s&&this.addTransceiver("video",{direction:"recvonly"})}return e.apply(this,arguments)}}function ZA(t){typeof t!="object"||t.AudioContext||(t.AudioContext=t.webkitAudioContext)}var QA=Object.freeze({__proto__:null,shimAudioContext:ZA,shimCallbacksAPI:$A,shimConstraints:WA,shimCreateOfferLegacy:KA,shimGetUserMedia:qA,shimLocalStreamsAPI:BA,shimRTCIceServerUrls:GA,shimRemoteStreamsAPI:HA,shimTrackEventTransceiver:YA}),Q1={exports:{}},XA;function V8(){return XA||(XA=1,function(t){const e={};e.generateIdentifier=function(){return Math.random().toString(36).substring(2,12)},e.localCName=e.generateIdentifier(),e.splitLines=function(n){return n.trim().split(`
|
|
243
243
|
`).map(r=>r.trim())},e.splitSections=function(n){return n.split(`
|
|
244
244
|
m=`).map((a,s)=>(s>0?"m="+a:a).trim()+`\r
|
|
@@ -273,9 +273,9 @@ t=0 0\r
|
|
|
273
273
|
`},e.getDirection=function(n,r){const a=e.splitLines(n);for(let s=0;s<a.length;s++)switch(a[s]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return a[s].substring(2)}return r?e.getDirection(r):"sendrecv"},e.getKind=function(n){return e.splitLines(n)[0].split(" ")[0].substring(2)},e.isRejected=function(n){return n.split(" ",2)[1]==="0"},e.parseMLine=function(n){const a=e.splitLines(n)[0].substring(2).split(" ");return{kind:a[0],port:parseInt(a[1],10),protocol:a[2],fmt:a.slice(3).join(" ")}},e.parseOLine=function(n){const a=e.matchPrefix(n,"o=")[0].substring(2).split(" ");return{username:a[0],sessionId:a[1],sessionVersion:parseInt(a[2],10),netType:a[3],addressType:a[4],address:a[5]}},e.isValidSDP=function(n){if(typeof n!="string"||n.length===0)return!1;const r=e.splitLines(n);for(let a=0;a<r.length;a++)if(r[a].length<2||r[a].charAt(1)!=="=")return!1;return!0},t.exports=e}(Q1)),Q1.exports}var JA=V8(),jh=R8(JA),z8=e6({__proto__:null,default:jh},[JA]);function Q0(t){if(!t.RTCIceCandidate||t.RTCIceCandidate&&"foundation"in t.RTCIceCandidate.prototype)return;const e=t.RTCIceCandidate;t.RTCIceCandidate=function(r){if(typeof r=="object"&&r.candidate&&r.candidate.indexOf("a=")===0&&(r=JSON.parse(JSON.stringify(r)),r.candidate=r.candidate.substring(2)),r.candidate&&r.candidate.length){const a=new e(r),s=jh.parseCandidate(r.candidate);for(const l in s)l in a||Object.defineProperty(a,l,{value:s[l]});return a.toJSON=function(){return{candidate:a.candidate,sdpMid:a.sdpMid,sdpMLineIndex:a.sdpMLineIndex,usernameFragment:a.usernameFragment}},a}return new e(r)},t.RTCIceCandidate.prototype=e.prototype,Kd(t,"icecandidate",n=>(n.candidate&&Object.defineProperty(n,"candidate",{value:new t.RTCIceCandidate(n.candidate),writable:"false"}),n))}function X1(t){!t.RTCIceCandidate||t.RTCIceCandidate&&"relayProtocol"in t.RTCIceCandidate.prototype||Kd(t,"icecandidate",e=>{if(e.candidate){const n=jh.parseCandidate(e.candidate.candidate);n.type==="relay"&&(e.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[n.priority>>24])}return e})}function X0(t,e){if(!t.RTCPeerConnection)return;"sctp"in t.RTCPeerConnection.prototype||Object.defineProperty(t.RTCPeerConnection.prototype,"sctp",{get(){return typeof this._sctp>"u"?null:this._sctp}});const n=function(c){if(!c||!c.sdp)return!1;const h=jh.splitSections(c.sdp);return h.shift(),h.some(p=>{const v=jh.parseMLine(p);return v&&v.kind==="application"&&v.protocol.indexOf("SCTP")!==-1})},r=function(c){const h=c.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(h===null||h.length<2)return-1;const p=parseInt(h[1],10);return p!==p?-1:p},a=function(c){let h=65536;return e.browser==="firefox"&&(e.version<57?c===-1?h=16384:h=2147483637:e.version<60?h=e.version===57?65535:65536:h=2147483637),h},s=function(c,h){let p=65536;e.browser==="firefox"&&e.version===57&&(p=65535);const v=jh.matchPrefix(c.sdp,"a=max-message-size:");return v.length>0?p=parseInt(v[0].substring(19),10):e.browser==="firefox"&&h!==-1&&(p=2147483637),p},l=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,e.browser==="chrome"&&e.version>=76){const{sdpSemantics:h}=this.getConfiguration();h==="plan-b"&&Object.defineProperty(this,"sctp",{get(){return typeof this._sctp>"u"?null:this._sctp},enumerable:!0,configurable:!0})}if(n(arguments[0])){const h=r(arguments[0]),p=a(h),v=s(arguments[0],h);let b;p===0&&v===0?b=Number.POSITIVE_INFINITY:p===0||v===0?b=Math.max(p,v):b=Math.min(p,v);const k={};Object.defineProperty(k,"maxMessageSize",{get(){return b}}),this._sctp=k}return l.apply(this,arguments)}}function J0(t){if(!(t.RTCPeerConnection&&"createDataChannel"in t.RTCPeerConnection.prototype))return;function e(r,a){const s=r.send;r.send=function(){const c=arguments[0],h=c.length||c.size||c.byteLength;if(r.readyState==="open"&&a.sctp&&h>a.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+a.sctp.maxMessageSize+" bytes)");return s.apply(r,arguments)}}const n=t.RTCPeerConnection.prototype.createDataChannel;t.RTCPeerConnection.prototype.createDataChannel=function(){const a=n.apply(this,arguments);return e(a,this),a},Kd(t,"datachannel",r=>(e(r.channel,r.target),r))}function J1(t){if(!t.RTCPeerConnection||"connectionState"in t.RTCPeerConnection.prototype)return;const e=t.RTCPeerConnection.prototype;Object.defineProperty(e,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(e,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(n){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),n&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=n)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(n=>{const r=e[n];e[n]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=a=>{const s=a.target;if(s._lastConnectionState!==s.connectionState){s._lastConnectionState=s.connectionState;const l=new Event("connectionstatechange",a);s.dispatchEvent(l)}return a},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),r.apply(this,arguments)}})}function eT(t,e){if(!t.RTCPeerConnection||e.browser==="chrome"&&e.version>=71||e.browser==="safari"&&e.version>=605)return;const n=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(a){if(a&&a.sdp&&a.sdp.indexOf(`
|
|
274
274
|
a=extmap-allow-mixed`)!==-1){const s=a.sdp.split(`
|
|
275
275
|
`).filter(l=>l.trim()!=="a=extmap-allow-mixed").join(`
|
|
276
|
-
`);t.RTCSessionDescription&&a instanceof t.RTCSessionDescription?arguments[0]=new t.RTCSessionDescription({type:a.type,sdp:s}):a.sdp=s}return n.apply(this,arguments)}}function eb(t,e){if(!(t.RTCPeerConnection&&t.RTCPeerConnection.prototype))return;const n=t.RTCPeerConnection.prototype.addIceCandidate;!n||n.length===0||(t.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?(e.browser==="chrome"&&e.version<78||e.browser==="firefox"&&e.version<68||e.browser==="safari")&&arguments[0]&&arguments[0].candidate===""?Promise.resolve():n.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function tb(t,e){if(!(t.RTCPeerConnection&&t.RTCPeerConnection.prototype))return;const n=t.RTCPeerConnection.prototype.setLocalDescription;!n||n.length===0||(t.RTCPeerConnection.prototype.setLocalDescription=function(){let a=arguments[0]||{};if(typeof a!="object"||a.type&&a.sdp)return n.apply(this,arguments);if(a={type:a.type,sdp:a.sdp},!a.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":a.type="offer";break;default:a.type="answer";break}return a.sdp||a.type!=="offer"&&a.type!=="answer"?n.apply(this,[a]):(a.type==="offer"?this.createOffer:this.createAnswer).apply(this).then(l=>n.apply(this,[l]))})}var B8=Object.freeze({__proto__:null,removeExtmapAllowMixed:eT,shimAddIceCandidateNullOrEmpty:eb,shimConnectionState:J1,shimMaxMessageSize:X0,shimParameterlessSetLocalDescription:tb,shimRTCIceCandidate:Q0,shimRTCIceCandidateRelayProtocol:X1,shimSendThrowTypeError:J0});function H8(){let{window:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0};const n=vA,r=F8(t),a={browserDetails:r,commonShim:B8,extractVersion:Z0,disableLog:I8,disableWarnings:U8,sdp:z8};switch(r.browser){case"chrome":if(!DA||!K1||!e.shimChrome)return n("Chrome shim is not included in this adapter release."),a;if(r.version===null)return n("Chrome shim can not determine version, not shimming."),a;n("adapter.js shimming chrome."),a.browserShim=DA,eb(t,r),tb(t),kA(t,r),TA(t),K1(t,r),xA(t),RA(t,r),wA(t),_A(t),PA(t,r),Q0(t),X1(t),J1(t),X0(t,r),J0(t),eT(t,r);break;case"firefox":if(!zA||!Z1||!e.shimFirefox)return n("Firefox shim is not included in this adapter release."),a;n("adapter.js shimming firefox."),a.browserShim=zA,eb(t,r),tb(t),AA(t,r),Z1(t,r),OA(t),NA(t),MA(t),LA(t),IA(t),UA(t),FA(t),jA(t),VA(t),Q0(t),J1(t),X0(t,r),J0(t);break;case"safari":if(!QA||!e.shimSafari)return n("Safari shim is not included in this adapter release."),a;n("adapter.js shimming safari."),a.browserShim=QA,eb(t,r),tb(t),GA(t),KA(t),$A(t),BA(t),HA(t),YA(t),qA(t),ZA(t),Q0(t),X1(t),X0(t,r),J0(t),eT(t,r);break;default:n("Unsupported browser!");break}return a}H8({window:typeof window>"u"?void 0:window});const $8=10,nb="lk_e2ee",q8={sharedKey:!1,ratchetSalt:"LKFrameEncryptionKey",ratchetWindowSize:8,failureTolerance:$8,keyringSize:16};var mc;(function(t){t.SetKey="setKey",t.RatchetRequest="ratchetRequest",t.KeyRatcheted="keyRatcheted"})(mc||(mc={}));var eO;(function(t){t.KeyRatcheted="keyRatcheted"})(eO||(eO={}));var gc;(function(t){t.ParticipantEncryptionStatusChanged="participantEncryptionStatusChanged",t.EncryptionError="encryptionError"})(gc||(gc={}));var tO;(function(t){t.Error="cryptorError"})(tO||(tO={}));function W8(){return G8()||tT()}function tT(){return typeof window.RTCRtpScriptTransform<"u"}function G8(){return typeof window.RTCRtpSender<"u"&&typeof window.RTCRtpSender.prototype.createEncodedStreams<"u"}class Dse extends dl.EventEmitter{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};super(),this.onKeyRatcheted=(n,r)=>{Nn.debug("key ratcheted event received",{material:n,keyIndex:r})},this.keyInfoMap=new Map,this.options=Object.assign(Object.assign({},q8),e),this.on(mc.KeyRatcheted,this.onKeyRatcheted)}onSetEncryptionKey(e,n,r){const a={key:e,participantIdentity:n,keyIndex:r};if(!this.options.sharedKey&&!n)throw new Error("participant identity needs to be passed for encryption key if sharedKey option is false");this.keyInfoMap.set("".concat(n??"shared","-").concat(r??0),a),this.emit(mc.SetKey,a)}getKeys(){return Array.from(this.keyInfoMap.values())}getOptions(){return this.options}ratchetKey(e,n){this.emit(mc.RatchetRequest,e,n)}}class vc extends Error{constructor(e,n){super(n||"an error has occured"),this.name="LiveKitError",this.code=e}}var Un;(function(t){t[t.NotAllowed=0]="NotAllowed",t[t.ServerUnreachable=1]="ServerUnreachable",t[t.InternalError=2]="InternalError",t[t.Cancelled=3]="Cancelled",t[t.LeaveRequest=4]="LeaveRequest"})(Un||(Un={}));class br extends vc{constructor(e,n,r,a){super(1,e),this.name="ConnectionError",this.status=r,this.reason=n,this.context=a,this.reasonName=Un[n]}}class nT extends vc{constructor(e){super(21,e??"device is unsupported"),this.name="DeviceUnsupportedError"}}class uu extends vc{constructor(e){super(20,e??"track is invalid"),this.name="TrackInvalidError"}}class Y8 extends vc{constructor(e){super(10,e??"unsupported server"),this.name="UnsupportedServer"}}class xi extends vc{constructor(e){super(12,e??"unexpected connection state"),this.name="UnexpectedConnectionState"}}class rT extends vc{constructor(e){super(13,e??"unable to negotiate"),this.name="NegotiationError"}}class iT extends vc{constructor(e,n){super(15,e),this.name="PublishTrackError",this.status=n}}class nO extends vc{constructor(e,n){super(15,e),this.reason=n,this.reasonName=typeof n=="string"?n:q1[n]}}var rb;(function(t){t.PermissionDenied="PermissionDenied",t.NotFound="NotFound",t.DeviceInUse="DeviceInUse",t.Other="Other"})(rb||(rb={})),function(t){function e(n){if(n&&"name"in n)return n.name==="NotFoundError"||n.name==="DevicesNotFoundError"?t.NotFound:n.name==="NotAllowedError"||n.name==="PermissionDeniedError"?t.PermissionDenied:n.name==="NotReadableError"||n.name==="TrackStartError"?t.DeviceInUse:t.Other}t.getFailure=e}(rb||(rb={}));var rO;(function(t){t[t.InvalidKey=0]="InvalidKey",t[t.MissingKey=1]="MissingKey",t[t.InternalError=2]="InternalError"})(rO||(rO={}));var Ee;(function(t){t.Connected="connected",t.Reconnecting="reconnecting",t.SignalReconnecting="signalReconnecting",t.Reconnected="reconnected",t.Disconnected="disconnected",t.ConnectionStateChanged="connectionStateChanged",t.MediaDevicesChanged="mediaDevicesChanged",t.ParticipantConnected="participantConnected",t.ParticipantDisconnected="participantDisconnected",t.TrackPublished="trackPublished",t.TrackSubscribed="trackSubscribed",t.TrackSubscriptionFailed="trackSubscriptionFailed",t.TrackUnpublished="trackUnpublished",t.TrackUnsubscribed="trackUnsubscribed",t.TrackMuted="trackMuted",t.TrackUnmuted="trackUnmuted",t.LocalTrackPublished="localTrackPublished",t.LocalTrackUnpublished="localTrackUnpublished",t.LocalAudioSilenceDetected="localAudioSilenceDetected",t.ActiveSpeakersChanged="activeSpeakersChanged",t.ParticipantMetadataChanged="participantMetadataChanged",t.ParticipantNameChanged="participantNameChanged",t.ParticipantAttributesChanged="participantAttributesChanged",t.RoomMetadataChanged="roomMetadataChanged",t.DataReceived="dataReceived",t.SipDTMFReceived="sipDTMFReceived",t.TranscriptionReceived="transcriptionReceived",t.ConnectionQualityChanged="connectionQualityChanged",t.TrackStreamStateChanged="trackStreamStateChanged",t.TrackSubscriptionPermissionChanged="trackSubscriptionPermissionChanged",t.TrackSubscriptionStatusChanged="trackSubscriptionStatusChanged",t.AudioPlaybackStatusChanged="audioPlaybackChanged",t.VideoPlaybackStatusChanged="videoPlaybackChanged",t.MediaDevicesError="mediaDevicesError",t.ParticipantPermissionsChanged="participantPermissionsChanged",t.SignalConnected="signalConnected",t.RecordingStatusChanged="recordingStatusChanged",t.ParticipantEncryptionStatusChanged="participantEncryptionStatusChanged",t.EncryptionError="encryptionError",t.DCBufferStatusChanged="dcBufferStatusChanged",t.ActiveDeviceChanged="activeDeviceChanged",t.ChatMessage="chatMessage",t.LocalTrackSubscribed="localTrackSubscribed",t.MetricsReceived="metricsReceived"})(Ee||(Ee={}));var Ie;(function(t){t.TrackPublished="trackPublished",t.TrackSubscribed="trackSubscribed",t.TrackSubscriptionFailed="trackSubscriptionFailed",t.TrackUnpublished="trackUnpublished",t.TrackUnsubscribed="trackUnsubscribed",t.TrackMuted="trackMuted",t.TrackUnmuted="trackUnmuted",t.LocalTrackPublished="localTrackPublished",t.LocalTrackUnpublished="localTrackUnpublished",t.ParticipantMetadataChanged="participantMetadataChanged",t.ParticipantNameChanged="participantNameChanged",t.DataReceived="dataReceived",t.SipDTMFReceived="sipDTMFReceived",t.TranscriptionReceived="transcriptionReceived",t.IsSpeakingChanged="isSpeakingChanged",t.ConnectionQualityChanged="connectionQualityChanged",t.TrackStreamStateChanged="trackStreamStateChanged",t.TrackSubscriptionPermissionChanged="trackSubscriptionPermissionChanged",t.TrackSubscriptionStatusChanged="trackSubscriptionStatusChanged",t.MediaDevicesError="mediaDevicesError",t.AudioStreamAcquired="audioStreamAcquired",t.ParticipantPermissionsChanged="participantPermissionsChanged",t.PCTrackAdded="pcTrackAdded",t.AttributesChanged="attributesChanged",t.LocalTrackSubscribed="localTrackSubscribed",t.ChatMessage="chatMessage"})(Ie||(Ie={}));var tt;(function(t){t.TransportsCreated="transportsCreated",t.Connected="connected",t.Disconnected="disconnected",t.Resuming="resuming",t.Resumed="resumed",t.Restarting="restarting",t.Restarted="restarted",t.SignalResumed="signalResumed",t.SignalRestarted="signalRestarted",t.Closing="closing",t.MediaTrackAdded="mediaTrackAdded",t.ActiveSpeakersUpdate="activeSpeakersUpdate",t.DataPacketReceived="dataPacketReceived",t.RTPVideoMapUpdate="rtpVideoMapUpdate",t.DCBufferStatusChanged="dcBufferStatusChanged",t.ParticipantUpdate="participantUpdate",t.RoomUpdate="roomUpdate",t.SpeakersChanged="speakersChanged",t.StreamStateChanged="streamStateChanged",t.ConnectionQualityUpdate="connectionQualityUpdate",t.SubscriptionError="subscriptionError",t.SubscriptionPermissionUpdate="subscriptionPermissionUpdate",t.RemoteMute="remoteMute",t.SubscribedQualityUpdate="subscribedQualityUpdate",t.LocalTrackUnpublished="localTrackUnpublished",t.LocalTrackSubscribed="localTrackSubscribed",t.Offline="offline",t.SignalRequestResponse="signalRequestResponse",t.SignalConnected="signalConnected"})(tt||(tt={}));var Qe;(function(t){t.Message="message",t.Muted="muted",t.Unmuted="unmuted",t.Restarted="restarted",t.Ended="ended",t.Subscribed="subscribed",t.Unsubscribed="unsubscribed",t.UpdateSettings="updateSettings",t.UpdateSubscription="updateSubscription",t.AudioPlaybackStarted="audioPlaybackStarted",t.AudioPlaybackFailed="audioPlaybackFailed",t.AudioSilenceDetected="audioSilenceDetected",t.VisibilityChanged="visibilityChanged",t.VideoDimensionsChanged="videoDimensionsChanged",t.VideoPlaybackStarted="videoPlaybackStarted",t.VideoPlaybackFailed="videoPlaybackFailed",t.ElementAttached="elementAttached",t.ElementDetached="elementDetached",t.UpstreamPaused="upstreamPaused",t.UpstreamResumed="upstreamResumed",t.SubscriptionPermissionChanged="subscriptionPermissionChanged",t.SubscriptionStatusChanged="subscriptionStatusChanged",t.SubscriptionFailed="subscriptionFailed",t.TrackProcessorUpdate="trackProcessorUpdate",t.AudioTrackFeatureUpdate="audioTrackFeatureUpdate",t.TranscriptionReceived="transcriptionReceived",t.TimeSyncUpdate="timeSyncUpdate"})(Qe||(Qe={}));function K8(t){return typeof t>"u"?t:typeof structuredClone=="function"?structuredClone(t):JSON.parse(JSON.stringify(t))}const Z8=/version\/(\d+(\.?_?\d+)+)/i;let aT;function ws(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(typeof navigator>"u")return;const n=navigator.userAgent.toLowerCase();if(aT===void 0||e){const r=Q8.find(a=>{let{test:s}=a;return s.test(n)});aT=r==null?void 0:r.describe(n)}return aT}const Q8=[{test:/firefox|iceweasel|fxios/i,describe(t){return{name:"Firefox",version:ib(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,t),os:t.toLowerCase().includes("fxios")?"iOS":void 0,osVersion:oT(t)}}},{test:/chrom|crios|crmo/i,describe(t){return{name:"Chrome",version:ib(/(?:chrome|chromium|crios|crmo)\/(\d+(\.?_?\d+)+)/i,t),os:t.toLowerCase().includes("crios")?"iOS":void 0,osVersion:oT(t)}}},{test:/safari|applewebkit/i,describe(t){return{name:"Safari",version:ib(Z8,t),os:t.includes("mobile/")?"iOS":"macOS",osVersion:oT(t)}}}];function ib(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;const r=e.match(t);return r&&r.length>=n&&r[n]||""}function oT(t){return t.includes("mac os")?ib(/\(.+?(\d+_\d+(:?_\d+)?)/,t,1).replace(/_/g,"."):void 0}var X8="2.11.4";const J8=X8,eV=15;class Qi{}Qi.setTimeout=function(){return setTimeout(...arguments)},Qi.setInterval=function(){return setInterval(...arguments)},Qi.clearTimeout=function(){return clearTimeout(...arguments)},Qi.clearInterval=function(){return clearInterval(...arguments)};const tV=5e3,Rg=[];var Go;(function(t){t[t.LOW=0]="LOW",t[t.MEDIUM=1]="MEDIUM",t[t.HIGH=2]="HIGH"})(Go||(Go={}));class De extends dl.EventEmitter{constructor(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var a;super(),this.attachedElements=[],this.isMuted=!1,this.streamState=De.StreamState.Active,this.isInBackground=!1,this._currentBitrate=0,this.log=Nn,this.appVisibilityChangedListener=()=>{this.backgroundTimeout&&clearTimeout(this.backgroundTimeout),document.visibilityState==="hidden"?this.backgroundTimeout=setTimeout(()=>this.handleAppVisibilityChanged(),tV):this.handleAppVisibilityChanged()},this.log=lu((a=r.loggerName)!==null&&a!==void 0?a:xs.Track),this.loggerContextCb=r.loggerContextCb,this.setMaxListeners(100),this.kind=n,this._mediaStreamTrack=e,this._mediaStreamID=e.id,this.source=De.Source.Unknown}get logContext(){var e;return Object.assign(Object.assign({},(e=this.loggerContextCb)===null||e===void 0?void 0:e.call(this)),ar(this))}get currentBitrate(){return this._currentBitrate}get mediaStreamTrack(){return this._mediaStreamTrack}get mediaStreamID(){return this._mediaStreamID}attach(e){let n="audio";this.kind===De.Kind.Video&&(n="video"),this.attachedElements.length===0&&this.kind===De.Kind.Video&&this.addAppVisibilityListener(),e||(n==="audio"&&(Rg.forEach(s=>{s.parentElement===null&&!e&&(e=s)}),e&&Rg.splice(Rg.indexOf(e),1)),e||(e=document.createElement(n))),this.attachedElements.includes(e)||this.attachedElements.push(e),Vh(this.mediaStreamTrack,e);const r=e.srcObject.getTracks(),a=r.some(s=>s.kind==="audio");return e.play().then(()=>{this.emit(a?Qe.AudioPlaybackStarted:Qe.VideoPlaybackStarted)}).catch(s=>{s.name==="NotAllowedError"?this.emit(a?Qe.AudioPlaybackFailed:Qe.VideoPlaybackFailed,s):s.name==="AbortError"?Nn.debug("".concat(a?"audio":"video"," playback aborted, likely due to new play request")):Nn.warn("could not playback ".concat(a?"audio":"video"),s),a&&e&&r.some(l=>l.kind==="video")&&s.name==="NotAllowedError"&&(e.muted=!0,e.play().catch(()=>{}))}),this.emit(Qe.ElementAttached,e),e}detach(e){try{if(e){zh(this.mediaStreamTrack,e);const r=this.attachedElements.indexOf(e);return r>=0&&(this.attachedElements.splice(r,1),this.recycleElement(e),this.emit(Qe.ElementDetached,e)),e}const n=[];return this.attachedElements.forEach(r=>{zh(this.mediaStreamTrack,r),n.push(r),this.recycleElement(r),this.emit(Qe.ElementDetached,r)}),this.attachedElements=[],n}finally{this.attachedElements.length===0&&this.removeAppVisibilityListener()}}stop(){this.stopMonitor(),this._mediaStreamTrack.stop()}enable(){this._mediaStreamTrack.enabled=!0}disable(){this._mediaStreamTrack.enabled=!1}stopMonitor(){this.monitorInterval&&clearInterval(this.monitorInterval),this.timeSyncHandle&&cancelAnimationFrame(this.timeSyncHandle)}updateLoggerOptions(e){e.loggerName&&(this.log=lu(e.loggerName)),e.loggerContextCb&&(this.loggerContextCb=e.loggerContextCb)}recycleElement(e){if(e instanceof HTMLAudioElement){let n=!0;e.pause(),Rg.forEach(r=>{r.parentElement||(n=!1)}),n&&Rg.push(e)}}handleAppVisibilityChanged(){return Q(this,void 0,void 0,function*(){this.isInBackground=document.visibilityState==="hidden",!this.isInBackground&&this.kind===De.Kind.Video&&setTimeout(()=>this.attachedElements.forEach(e=>e.play().catch(()=>{})),0)})}addAppVisibilityListener(){ao()?(this.isInBackground=document.visibilityState==="hidden",document.addEventListener("visibilitychange",this.appVisibilityChangedListener)):this.isInBackground=!1}removeAppVisibilityListener(){ao()&&document.removeEventListener("visibilitychange",this.appVisibilityChangedListener)}}function Vh(t,e){let n;e.srcObject instanceof MediaStream?n=e.srcObject:n=new MediaStream;let r;t.kind==="audio"?r=n.getAudioTracks():r=n.getVideoTracks(),r.includes(t)||(r.forEach(a=>{n.removeTrack(a)}),n.addTrack(t)),(!yc()||!(e instanceof HTMLVideoElement))&&(e.autoplay=!0),e.muted=n.getAudioTracks().length===0,e instanceof HTMLVideoElement&&(e.playsInline=!0),e.srcObject!==n&&(e.srcObject=n,(yc()||Bh())&&e instanceof HTMLVideoElement&&setTimeout(()=>{e.srcObject=n,e.play().catch(()=>{})},0))}function zh(t,e){if(e.srcObject instanceof MediaStream){const n=e.srcObject;n.removeTrack(t),n.getTracks().length>0?e.srcObject=n:e.srcObject=null}}(function(t){let e;(function(p){p.Audio="audio",p.Video="video",p.Unknown="unknown"})(e=t.Kind||(t.Kind={}));let n;(function(p){p.Camera="camera",p.Microphone="microphone",p.ScreenShare="screen_share",p.ScreenShareAudio="screen_share_audio",p.Unknown="unknown"})(n=t.Source||(t.Source={}));let r;(function(p){p.Active="active",p.Paused="paused",p.Unknown="unknown"})(r=t.StreamState||(t.StreamState={}));function a(p){switch(p){case e.Audio:return Cs.AUDIO;case e.Video:return Cs.VIDEO;default:return Cs.DATA}}t.kindToProto=a;function s(p){switch(p){case Cs.AUDIO:return e.Audio;case Cs.VIDEO:return e.Video;default:return e.Unknown}}t.kindFromProto=s;function l(p){switch(p){case n.Camera:return gi.CAMERA;case n.Microphone:return gi.MICROPHONE;case n.ScreenShare:return gi.SCREEN_SHARE;case n.ScreenShareAudio:return gi.SCREEN_SHARE_AUDIO;default:return gi.UNKNOWN}}t.sourceToProto=l;function c(p){switch(p){case gi.CAMERA:return n.Camera;case gi.MICROPHONE:return n.Microphone;case gi.SCREEN_SHARE:return n.ScreenShare;case gi.SCREEN_SHARE_AUDIO:return n.ScreenShareAudio;default:return n.Unknown}}t.sourceFromProto=c;function h(p){switch(p){case F1.ACTIVE:return r.Active;case F1.PAUSED:return r.Paused;default:return r.Unknown}}t.streamStateFromProto=h})(De||(De={}));class gr{constructor(e,n,r,a,s){if(typeof e=="object")this.width=e.width,this.height=e.height,this.aspectRatio=e.aspectRatio,this.encoding={maxBitrate:e.maxBitrate,maxFramerate:e.maxFramerate,priority:e.priority};else if(n!==void 0&&r!==void 0)this.width=e,this.height=n,this.aspectRatio=e/n,this.encoding={maxBitrate:r,maxFramerate:a,priority:s};else throw new TypeError("Unsupported options: provide at least width, height and maxBitrate")}get resolution(){return{width:this.width,height:this.height,frameRate:this.encoding.maxFramerate,aspectRatio:this.aspectRatio}}}const nV=["vp8","h264"],rV=["vp8","h264","vp9","av1"];function iV(t){return!!nV.find(e=>e===t)}var iO;(function(t){t[t.PREFER_REGRESSION=0]="PREFER_REGRESSION",t[t.SIMULCAST=1]="SIMULCAST",t[t.REGRESSION=2]="REGRESSION"})(iO||(iO={}));var sT;(function(t){t.telephone={maxBitrate:12e3},t.speech={maxBitrate:24e3},t.music={maxBitrate:48e3},t.musicStereo={maxBitrate:64e3},t.musicHighQuality={maxBitrate:96e3},t.musicHighQualityStereo={maxBitrate:128e3}})(sT||(sT={}));const Pg={h90:new gr(160,90,9e4,20),h180:new gr(320,180,16e4,20),h216:new gr(384,216,18e4,20),h360:new gr(640,360,45e4,20),h540:new gr(960,540,8e5,25),h720:new gr(1280,720,17e5,30),h1080:new gr(1920,1080,3e6,30),h1440:new gr(2560,1440,5e6,30),h2160:new gr(3840,2160,8e6,30)},lT={h120:new gr(160,120,7e4,20),h180:new gr(240,180,125e3,20),h240:new gr(320,240,14e4,20),h360:new gr(480,360,33e4,20),h480:new gr(640,480,5e5,20),h540:new gr(720,540,6e5,25),h720:new gr(960,720,13e5,30),h1080:new gr(1440,1080,23e5,30),h1440:new gr(1920,1440,38e5,30)},uT={h360fps3:new gr(640,360,2e5,3,"medium"),h360fps15:new gr(640,360,4e5,15,"medium"),h720fps5:new gr(1280,720,8e5,5,"medium"),h720fps15:new gr(1280,720,15e5,15,"medium"),h720fps30:new gr(1280,720,2e6,30,"medium"),h1080fps15:new gr(1920,1080,25e5,15,"medium"),h1080fps30:new gr(1920,1080,5e6,30,"medium"),original:new gr(0,0,7e6,30,"medium")},aV="|",aO="https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension";function oV(t){const e=t.split(aV);return e.length>1?[e[0],t.substr(e[0].length+1)]:[t,""]}function io(t){return Q(this,void 0,void 0,function*(){return new Promise(e=>Qi.setTimeout(e,t))})}function cT(){return"addTransceiver"in RTCPeerConnection.prototype}function dT(){return"addTrack"in RTCPeerConnection.prototype}function sV(){if(!("getCapabilities"in RTCRtpSender)||yc())return!1;const t=RTCRtpSender.getCapabilities("video");let e=!1;if(t){for(const n of t.codecs)if(n.mimeType==="video/AV1"){e=!0;break}}return e}function lV(){if(!("getCapabilities"in RTCRtpSender)||Bh())return!1;if(yc()){const n=ws();if(n!=null&&n.version&&bc(n.version,"16")<0)return!1}const t=RTCRtpSender.getCapabilities("video");let e=!1;if(t){for(const n of t.codecs)if(n.mimeType==="video/VP9"){e=!0;break}}return e}function Dg(t){return t==="av1"||t==="vp9"}function fT(t){return document?(t||(t=document.createElement("audio")),"setSinkId"in t):!1}function uV(){return typeof RTCPeerConnection>"u"?!1:cT()||dT()}function Bh(){var t;return((t=ws())===null||t===void 0?void 0:t.name)==="Firefox"}function yc(){var t;return((t=ws())===null||t===void 0?void 0:t.name)==="Safari"}function cV(){const t=ws();return(t==null?void 0:t.name)==="Safari"&&t.version.startsWith("17.")}function oO(){var t,e;return ao()?(e=(t=navigator.userAgentData)===null||t===void 0?void 0:t.mobile)!==null&&e!==void 0?e:/Tablet|iPad|Mobile|Android|BlackBerry/.test(navigator.userAgent):!1}function dV(){const t=ws(),e="17.2";if(t)return t.name!=="Safari"&&t.os!=="iOS"||t.os==="iOS"&&t.osVersion&&bc(e,t.osVersion)>=0?!0:t.name==="Safari"&&bc(e,t.version)>=0}function ao(){return typeof document<"u"}function fl(){return navigator.product=="ReactNative"}function hT(t){return t.hostname.endsWith(".livekit.cloud")||t.hostname.endsWith(".livekit.run")}function sO(){if(global&&global.LiveKitReactNativeGlobal)return global.LiveKitReactNativeGlobal}function lO(){if(!fl())return;let t=sO();if(t)return t.platform}function uO(){if(ao())return window.devicePixelRatio;if(fl()){let t=sO();if(t)return t.devicePixelRatio}return 1}function bc(t,e){const n=t.split("."),r=e.split("."),a=Math.min(n.length,r.length);for(let s=0;s<a;++s){const l=parseInt(n[s],10),c=parseInt(r[s],10);if(l>c)return 1;if(l<c)return-1;if(s===a-1&&l===c)return 0}return t===""&&e!==""?-1:e===""?1:n.length==r.length?0:n.length<r.length?-1:1}function fV(t){for(const e of t)e.target.handleResize(e)}function hV(t){for(const e of t)e.target.handleVisibilityChanged(e)}let pT=null;const cO=()=>(pT||(pT=new ResizeObserver(fV)),pT);let mT=null;const dO=()=>(mT||(mT=new IntersectionObserver(hV,{root:null,rootMargin:"0px"})),mT);function pV(){var t;const e=new i8({sdk:KD.JS,protocol:eV,version:J8});return fl()&&(e.os=(t=lO())!==null&&t!==void 0?t:""),e}function fO(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:16,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:16,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;const a=document.createElement("canvas");a.width=t,a.height=e;const s=a.getContext("2d");s==null||s.fillRect(0,0,a.width,a.height),r&&s&&(s.beginPath(),s.arc(t/2,e/2,50,0,Math.PI*2,!0),s.closePath(),s.fillStyle="grey",s.fill());const l=a.captureStream(),[c]=l.getTracks();if(!c)throw Error("Could not get empty media stream video track");return c.enabled=n,c}let Ag;function gT(){if(!Ag){const t=new AudioContext,e=t.createOscillator(),n=t.createGain();n.gain.setValueAtTime(0,0);const r=t.createMediaStreamDestination();if(e.connect(n),n.connect(r),e.start(),[Ag]=r.stream.getAudioTracks(),!Ag)throw Error("Could not get empty media stream audio track");Ag.enabled=!1}return Ag.clone()}class hO{constructor(e,n){this.onFinally=n,this.promise=new Promise((r,a)=>Q(this,void 0,void 0,function*(){this.resolve=r,this.reject=a,e&&(yield e(r,a))})).finally(()=>{var r;return(r=this.onFinally)===null||r===void 0?void 0:r.call(this)})}}function mV(t){return rV.includes(t)}function Sc(t){if(typeof t=="string"||typeof t=="number")return t;if(Array.isArray(t))return t[0];if(t.exact)return Array.isArray(t.exact)?t.exact[0]:t.exact;if(t.ideal)return Array.isArray(t.ideal)?t.ideal[0]:t.ideal;throw Error("could not unwrap constraint")}function gV(t){return t.startsWith("http")?t.replace(/^(http)/,"ws"):t}function vT(t){return t.startsWith("ws")?t.replace(/^(ws)/,"http"):t}function vV(t,e){return t.segments.map(n=>{let{id:r,text:a,language:s,startTime:l,endTime:c,final:h}=n;var p;const v=(p=e.get(r))!==null&&p!==void 0?p:Date.now(),b=Date.now();return h?e.delete(r):e.set(r,v),{id:r,text:a,startTime:Number.parseInt(l.toString()),endTime:Number.parseInt(c.toString()),final:h,language:s,firstReceivedTime:v,lastReceivedTime:b}})}function yV(t){const{id:e,timestamp:n,message:r,editTimestamp:a}=t;return{id:e,timestamp:Number.parseInt(n.toString()),editTimestamp:a?Number.parseInt(a.toString()):void 0,message:r}}function pO(t){switch(t.reason){case Un.LeaveRequest:return t.context;case Un.Cancelled:return ks.CLIENT_INITIATED;case Un.NotAllowed:return ks.USER_REJECTED;case Un.ServerUnreachable:return ks.JOIN_FAILURE;default:return ks.UNKNOWN_REASON}}function ab(t){return t!==void 0?Number(t):void 0}function Zd(t){return t!==void 0?BigInt(t):void 0}function Hh(t){return!!t&&!(t instanceof MediaStreamTrack)&&t.isLocal}function cu(t){return!!t&&t.kind==De.Kind.Audio}function $h(t){return!!t&&t.kind==De.Kind.Video}function Cc(t){return Hh(t)&&$h(t)}function Qd(t){return Hh(t)&&cu(t)}function yT(t){return!!t&&!t.isLocal}function bV(t){return!!t&&!t.isLocal}function bT(t){return yT(t)&&$h(t)}function SV(t){return t.isLocal}function CV(t,e){const n=[];let r=new TextEncoder().encode(t);for(;r.length>e;){let a=e;for(;a>0;){const s=r[a];if(s!==void 0&&(s&192)!==128)break;a--}n.push(r.slice(0,a)),r=r.slice(a)}return r.length>0&&n.push(r),n}function mO(t,e,n){var r,a,s,l;const{optionsWithoutProcessor:c,audioProcessor:h,videoProcessor:p}=bO(t??{}),v=e==null?void 0:e.processor,b=n==null?void 0:n.processor,k=c??{};return k.audio===!0&&(k.audio={}),k.video===!0&&(k.video={}),k.audio&&(ST(k.audio,e),(r=(s=k.audio).deviceId)!==null&&r!==void 0||(s.deviceId={ideal:"default"}),(h||v)&&(k.audio.processor=h??v)),k.video&&(ST(k.video,n),(a=(l=k.video).deviceId)!==null&&a!==void 0||(l.deviceId={ideal:"default"}),(p||b)&&(k.video.processor=p??b)),k}function ST(t,e){return Object.keys(e).forEach(n=>{t[n]===void 0&&(t[n]=e[n])}),t}function CT(t){var e,n,r,a;const s={};if(t.video)if(typeof t.video=="object"){const l={},c=l,h=t.video;Object.keys(h).forEach(p=>{switch(p){case"resolution":ST(c,h.resolution);break;default:c[p]=h[p]}}),s.video=l,(e=(r=s.video).deviceId)!==null&&e!==void 0||(r.deviceId={ideal:"default"})}else s.video=t.video?{deviceId:{ideal:"default"}}:!1;else s.video=!1;return t.audio?typeof t.audio=="object"?(s.audio=t.audio,(n=(a=s.audio).deviceId)!==null&&n!==void 0||(a.deviceId={ideal:"default"})):s.audio={deviceId:{ideal:"default"}}:s.audio=!1,s}function gO(t){return Q(this,arguments,void 0,function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:200;return function*(){const r=vO();if(r){const a=r.createAnalyser();a.fftSize=2048;const s=a.frequencyBinCount,l=new Uint8Array(s);r.createMediaStreamSource(new MediaStream([e.mediaStreamTrack])).connect(a),yield io(n),a.getByteTimeDomainData(l);const h=l.some(p=>p!==128&&p!==0);return r.close(),!h}return!1}()})}function vO(){var t;const e=typeof window<"u"&&(window.AudioContext||window.webkitAudioContext);if(e){const n=new e({latencyHint:"interactive"});if(n.state==="suspended"&&typeof window<"u"&&(!((t=window.document)===null||t===void 0)&&t.body)){const r=()=>Q(this,void 0,void 0,function*(){var a;try{n.state==="suspended"&&(yield n.resume())}catch(s){console.warn("Error trying to auto-resume audio context",s)}(a=window.document.body)===null||a===void 0||a.removeEventListener("click",r)});window.document.body.addEventListener("click",r)}return n}}function kV(t){return t==="audioinput"?De.Source.Microphone:t==="videoinput"?De.Source.Camera:De.Source.Unknown}function yO(t){return t===De.Source.Microphone?"audioinput":t===De.Source.Camera?"videoinput":void 0}function TV(t){var e,n;let r=(e=t.video)!==null&&e!==void 0?e:!0;return t.resolution&&t.resolution.width>0&&t.resolution.height>0&&(r=typeof r=="boolean"?{}:r,yc()?r=Object.assign(Object.assign({},r),{width:{max:t.resolution.width},height:{max:t.resolution.height},frameRate:t.resolution.frameRate}):r=Object.assign(Object.assign({},r),{width:{ideal:t.resolution.width},height:{ideal:t.resolution.height},frameRate:t.resolution.frameRate})),{audio:(n=t.audio)!==null&&n!==void 0?n:!1,video:r,controller:t.controller,selfBrowserSurface:t.selfBrowserSurface,surfaceSwitching:t.surfaceSwitching,systemAudio:t.systemAudio,preferCurrentTab:t.preferCurrentTab}}function ob(t){return t.split("/")[1].toLowerCase()}function xV(t){const e=[];return t.forEach(n=>{n.track!==void 0&&e.push(new H1({cid:n.track.mediaStreamID,track:n.trackInfo}))}),e}function ar(t){return"mediaStreamTrack"in t?{trackID:t.sid,source:t.source,muted:t.isMuted,enabled:t.mediaStreamTrack.enabled,kind:t.kind,streamID:t.mediaStreamID,streamTrackID:t.mediaStreamTrack.id}:{trackID:t.trackSid,enabled:t.isEnabled,muted:t.isMuted,trackInfo:Object.assign({mimeType:t.mimeType,name:t.trackName,encrypted:t.isEncrypted,kind:t.kind,source:t.source},t.track?ar(t.track):{})}}function wV(){return typeof RTCRtpReceiver<"u"&&"getSynchronizationSources"in RTCRtpReceiver}function _V(t,e){var n;t===void 0&&(t={}),e===void 0&&(e={});const r=[...Object.keys(e),...Object.keys(t)],a={};for(const s of r)t[s]!==e[s]&&(a[s]=(n=e[s])!==null&&n!==void 0?n:"");return a}function bO(t){const e=Object.assign({},t);let n,r;return typeof e.audio=="object"&&e.audio.processor&&(n=e.audio.processor,e.audio=Object.assign(Object.assign({},e.audio),{processor:void 0})),typeof e.video=="object"&&e.video.processor&&(r=e.video.processor,e.video=Object.assign(Object.assign({},e.video),{processor:void 0})),{audioProcessor:n,videoProcessor:r,optionsWithoutProcessor:K8(e)}}function EV(t){switch(t){case gi.CAMERA:return De.Source.Camera;case gi.MICROPHONE:return De.Source.Microphone;case gi.SCREEN_SHARE:return De.Source.ScreenShare;case gi.SCREEN_SHARE_AUDIO:return De.Source.ScreenShareAudio;default:return De.Source.Unknown}}class RV extends dl.EventEmitter{constructor(e){super(),this.onWorkerMessage=n=>{var r,a;const{kind:s,data:l}=n.data;switch(s){case"error":Nn.error(l.error.message),this.emit(gc.EncryptionError,l.error);break;case"initAck":l.enabled&&this.keyProvider.getKeys().forEach(c=>{this.postKey(c)});break;case"enable":if(l.enabled&&this.keyProvider.getKeys().forEach(c=>{this.postKey(c)}),this.encryptionEnabled!==l.enabled&&l.participantIdentity===((r=this.room)===null||r===void 0?void 0:r.localParticipant.identity))this.emit(gc.ParticipantEncryptionStatusChanged,l.enabled,this.room.localParticipant),this.encryptionEnabled=l.enabled;else if(l.participantIdentity){const c=(a=this.room)===null||a===void 0?void 0:a.getParticipantByIdentity(l.participantIdentity);if(!c)throw TypeError("couldn't set encryption status, participant not found".concat(l.participantIdentity));this.emit(gc.ParticipantEncryptionStatusChanged,l.enabled,c)}break;case"ratchetKey":this.keyProvider.emit(mc.KeyRatcheted,l.material,l.keyIndex);break}},this.onWorkerError=n=>{Nn.error("e2ee worker encountered an error:",{error:n.error}),this.emit(gc.EncryptionError,n.error)},this.keyProvider=e.keyProvider,this.worker=e.worker,this.encryptionEnabled=!1}setup(e){if(!W8())throw new nT("tried to setup end-to-end encryption on an unsupported browser");if(Nn.info("setting up e2ee"),e!==this.room){this.room=e,this.setupEventListeners(e,this.keyProvider);const n={kind:"init",data:{keyProviderOptions:this.keyProvider.getOptions(),loglevel:A8.getLevel()}};this.worker&&(Nn.info("initializing worker",{worker:this.worker}),this.worker.onmessage=this.onWorkerMessage,this.worker.onerror=this.onWorkerError,this.worker.postMessage(n))}}setParticipantCryptorEnabled(e,n){Nn.debug("set e2ee to ".concat(e," for participant ").concat(n)),this.postEnable(e,n)}setSifTrailer(e){!e||e.length===0?Nn.warn("ignoring server sent trailer as it's empty"):this.postSifTrailer(e)}setupEngine(e){e.on(tt.RTPVideoMapUpdate,n=>{this.postRTPMap(n)})}setupEventListeners(e,n){e.on(Ee.TrackPublished,(r,a)=>this.setParticipantCryptorEnabled(r.trackInfo.encryption!==Po.NONE,a.identity)),e.on(Ee.ConnectionStateChanged,r=>{r===Fn.Connected&&e.remoteParticipants.forEach(a=>{a.trackPublications.forEach(s=>{this.setParticipantCryptorEnabled(s.trackInfo.encryption!==Po.NONE,a.identity)})})}).on(Ee.TrackUnsubscribed,(r,a,s)=>{var l;const c={kind:"removeTransform",data:{participantIdentity:s.identity,trackId:r.mediaStreamID}};(l=this.worker)===null||l===void 0||l.postMessage(c)}).on(Ee.TrackSubscribed,(r,a,s)=>{this.setupE2EEReceiver(r,s.identity,a.trackInfo)}).on(Ee.SignalConnected,()=>{if(!this.room)throw new TypeError("expected room to be present on signal connect");n.getKeys().forEach(r=>{this.postKey(r)}),this.setParticipantCryptorEnabled(this.room.localParticipant.isE2EEEnabled,this.room.localParticipant.identity)}),e.localParticipant.on(Ie.LocalTrackPublished,r=>Q(this,void 0,void 0,function*(){this.setupE2EESender(r.track,r.track.sender)})),n.on(mc.SetKey,r=>this.postKey(r)).on(mc.RatchetRequest,(r,a)=>this.postRatchetRequest(r,a))}postRatchetRequest(e,n){if(!this.worker)throw Error("could not ratchet key, worker is missing");const r={kind:"ratchetRequest",data:{participantIdentity:e,keyIndex:n}};this.worker.postMessage(r)}postKey(e){let{key:n,participantIdentity:r,keyIndex:a}=e;var s;if(!this.worker)throw Error("could not set key, worker is missing");const l={kind:"setKey",data:{participantIdentity:r,isPublisher:r===((s=this.room)===null||s===void 0?void 0:s.localParticipant.identity),key:n,keyIndex:a}};this.worker.postMessage(l)}postEnable(e,n){if(this.worker){const r={kind:"enable",data:{enabled:e,participantIdentity:n}};this.worker.postMessage(r)}else throw new ReferenceError("failed to enable e2ee, worker is not ready")}postRTPMap(e){var n;if(!this.worker)throw TypeError("could not post rtp map, worker is missing");if(!(!((n=this.room)===null||n===void 0)&&n.localParticipant.identity))throw TypeError("could not post rtp map, local participant identity is missing");const r={kind:"setRTPMap",data:{map:e,participantIdentity:this.room.localParticipant.identity}};this.worker.postMessage(r)}postSifTrailer(e){if(!this.worker)throw Error("could not post SIF trailer, worker is missing");const n={kind:"setSifTrailer",data:{trailer:e}};this.worker.postMessage(n)}setupE2EEReceiver(e,n,r){if(e.receiver){if(!(r!=null&&r.mimeType)||r.mimeType==="")throw new TypeError("MimeType missing from trackInfo, cannot set up E2EE cryptor");this.handleReceiver(e.receiver,e.mediaStreamID,n,e.kind==="video"?ob(r.mimeType):void 0)}}setupE2EESender(e,n){if(!Hh(e)||!n){n||Nn.warn("early return because sender is not ready");return}this.handleSender(n,e.mediaStreamID,void 0)}handleReceiver(e,n,r,a){return Q(this,void 0,void 0,function*(){if(this.worker){if(tT()){const s={kind:"decode",participantIdentity:r,trackId:n,codec:a};e.transform=new RTCRtpScriptTransform(this.worker,s)}else{if(nb in e&&a){const h={kind:"updateCodec",data:{trackId:n,codec:a,participantIdentity:r}};this.worker.postMessage(h);return}let s=e.writableStream,l=e.readableStream;if(!s||!l){const h=e.createEncodedStreams();e.writableStream=h.writable,s=h.writable,e.readableStream=h.readable,l=h.readable}const c={kind:"decode",data:{readableStream:l,writableStream:s,trackId:n,codec:a,participantIdentity:r}};this.worker.postMessage(c,[l,s])}e[nb]=!0}})}handleSender(e,n,r){var a;if(!(nb in e||!this.worker)){if(!(!((a=this.room)===null||a===void 0)&&a.localParticipant.identity)||this.room.localParticipant.identity==="")throw TypeError("local identity needs to be known in order to set up encrypted sender");if(tT()){Nn.info("initialize script transform");const s={kind:"encode",participantIdentity:this.room.localParticipant.identity,trackId:n,codec:r};e.transform=new RTCRtpScriptTransform(this.worker,s)}else{Nn.info("initialize encoded streams");const s=e.createEncodedStreams(),l={kind:"encode",data:{readableStream:s.readable,writableStream:s.writable,codec:r,trackId:n,participantIdentity:this.room.localParticipant.identity}};this.worker.postMessage(l,[s.readable,s.writable])}e[nb]=!0}}}const kT="default";class zi{constructor(){this._previousDevices=[]}static getInstance(){return this.instance===void 0&&(this.instance=new zi),this.instance}get previousDevices(){return this._previousDevices}getDevices(e){return Q(this,arguments,void 0,function(n){var r=this;let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){var s;if(((s=zi.userMediaPromiseMap)===null||s===void 0?void 0:s.size)>0){Nn.debug("awaiting getUserMedia promise");try{n?yield zi.userMediaPromiseMap.get(n):yield Promise.all(zi.userMediaPromiseMap.values())}catch{Nn.warn("error waiting for media permissons")}}let l=yield navigator.mediaDevices.enumerateDevices();if(a&&!(yc()&&r.hasDeviceInUse(n))&&(l.filter(h=>h.kind===n).length===0||l.some(h=>{const p=h.label==="",v=n?h.kind===n:!0;return p&&v}))){const h={video:n!=="audioinput"&&n!=="audiooutput",audio:n!=="videoinput"&&{deviceId:{ideal:"default"}}},p=yield navigator.mediaDevices.getUserMedia(h);l=yield navigator.mediaDevices.enumerateDevices(),p.getTracks().forEach(v=>{v.stop()})}return r._previousDevices=l,n&&(l=l.filter(c=>c.kind===n)),l}()})}normalizeDeviceId(e,n,r){return Q(this,void 0,void 0,function*(){if(n!==kT)return n;const a=yield this.getDevices(e),s=a.find(c=>c.deviceId===kT);if(!s){Nn.warn("could not reliably determine default device");return}const l=a.find(c=>c.deviceId!==kT&&c.groupId===(r??s.groupId));if(!l){Nn.warn("could not reliably determine default device");return}return l==null?void 0:l.deviceId})}hasDeviceInUse(e){return e?zi.userMediaPromiseMap.has(e):zi.userMediaPromiseMap.size>0}}zi.mediaDeviceKinds=["audioinput","audiooutput","videoinput"],zi.userMediaPromiseMap=new Map;var Og;(function(t){t[t.WAITING=0]="WAITING",t[t.RUNNING=1]="RUNNING",t[t.COMPLETED=2]="COMPLETED"})(Og||(Og={}));class PV{constructor(){this.pendingTasks=new Map,this.taskMutex=new to,this.nextTaskIndex=0}run(e){return Q(this,void 0,void 0,function*(){const n={id:this.nextTaskIndex++,enqueuedAt:Date.now(),status:Og.WAITING};this.pendingTasks.set(n.id,n);const r=yield this.taskMutex.lock();try{return n.executedAt=Date.now(),n.status=Og.RUNNING,yield e()}finally{n.status=Og.COMPLETED,this.pendingTasks.delete(n.id),r()}})}flush(){return Q(this,void 0,void 0,function*(){return this.run(()=>Q(this,void 0,void 0,function*(){}))})}snapshot(){return Array.from(this.pendingTasks.values())}}function DV(t,e){const n=new URL(gV(t));return e.forEach((r,a)=>{n.searchParams.set(a,r)}),SO(n,"rtc")}function AV(t){const e=new URL(vT(t));return SO(e,"validate")}function OV(t){return t.endsWith("/")?t:"".concat(t,"/")}function SO(t,e){return t.pathname="".concat(OV(t.pathname)).concat(e),t.toString()}const MV=["syncState","trickle","offer","answer","simulate","leave"];function LV(t){const e=MV.indexOf(t.case)>=0;return Nn.trace("request allowed to bypass queue:",{canPass:e,req:t}),e}var Or;(function(t){t[t.CONNECTING=0]="CONNECTING",t[t.CONNECTED=1]="CONNECTED",t[t.RECONNECTING=2]="RECONNECTING",t[t.DISCONNECTING=3]="DISCONNECTING",t[t.DISCONNECTED=4]="DISCONNECTED"})(Or||(Or={}));class TT{get currentState(){return this.state}get isDisconnected(){return this.state===Or.DISCONNECTING||this.state===Or.DISCONNECTED}get isEstablishingConnection(){return this.state===Or.CONNECTING||this.state===Or.RECONNECTING}getNextRequestId(){return this._requestId+=1,this._requestId}constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var r;this.rtt=0,this.state=Or.DISCONNECTED,this.log=Nn,this._requestId=0,this.resetCallbacks=()=>{this.onAnswer=void 0,this.onLeave=void 0,this.onLocalTrackPublished=void 0,this.onLocalTrackUnpublished=void 0,this.onNegotiateRequested=void 0,this.onOffer=void 0,this.onRemoteMuteChanged=void 0,this.onSubscribedQualityUpdate=void 0,this.onTokenRefresh=void 0,this.onTrickle=void 0,this.onClose=void 0},this.log=lu((r=n.loggerName)!==null&&r!==void 0?r:xs.Signal),this.loggerContextCb=n.loggerContextCb,this.useJSON=e,this.requestQueue=new PV,this.queuedRequests=[],this.closingLock=new to,this.connectionLock=new to,this.state=Or.DISCONNECTED}get logContext(){var e,n;return(n=(e=this.loggerContextCb)===null||e===void 0?void 0:e.call(this))!==null&&n!==void 0?n:{}}join(e,n,r,a){return Q(this,void 0,void 0,function*(){return this.state=Or.CONNECTING,this.options=r,yield this.connect(e,n,r,a)})}reconnect(e,n,r,a){return Q(this,void 0,void 0,function*(){if(!this.options){this.log.warn("attempted to reconnect without signal options being set, ignoring",this.logContext);return}return this.state=Or.RECONNECTING,this.clearPingInterval(),yield this.connect(e,n,Object.assign(Object.assign({},this.options),{reconnect:!0,sid:r,reconnectReason:a}))})}connect(e,n,r,a){this.connectOptions=r;const s=pV(),l=NV(n,s,r),c=DV(e,l),h=AV(c);return new Promise((p,v)=>Q(this,void 0,void 0,function*(){const b=yield this.connectionLock.lock();try{const k=()=>Q(this,void 0,void 0,function*(){this.close(),clearTimeout(T),v(new br("room connection has been cancelled (signal)",Un.Cancelled))}),T=setTimeout(()=>{this.close(),v(new br("room connection has timed out (signal)",Un.ServerUnreachable))},r.websocketTimeout);a!=null&&a.aborted&&k(),a==null||a.addEventListener("abort",k);const E=new URL(c);E.searchParams.has("access_token")&&E.searchParams.set("access_token","<redacted>"),this.log.debug("connecting to ".concat(E),Object.assign({reconnect:r.reconnect,reconnectReason:r.reconnectReason},this.logContext)),this.ws&&(yield this.close(!1)),this.ws=new WebSocket(c),this.ws.binaryType="arraybuffer",this.ws.onopen=()=>{clearTimeout(T)},this.ws.onerror=R=>Q(this,void 0,void 0,function*(){if(this.state!==Or.CONNECTED){this.state=Or.DISCONNECTED,clearTimeout(T);try{const M=yield fetch(h);if(M.status.toFixed(0).startsWith("4")){const A=yield M.text();v(new br(A,Un.NotAllowed,M.status))}else v(new br("Encountered unknown websocket error during connection: ".concat(R.toString()),Un.InternalError,M.status))}catch(M){v(new br(M instanceof Error?M.message:"server was not reachable",Un.ServerUnreachable))}return}this.handleWSError(R)}),this.ws.onmessage=R=>Q(this,void 0,void 0,function*(){var M,A,U;let V;if(typeof R.data=="string"){const j=JSON.parse(R.data);V=tA.fromJson(j,{ignoreUnknownFields:!0})}else if(R.data instanceof ArrayBuffer)V=tA.fromBinary(new Uint8Array(R.data));else{this.log.error("could not decode websocket message: ".concat(typeof R.data),this.logContext);return}if(this.state!==Or.CONNECTED){let j=!1;if(((M=V.message)===null||M===void 0?void 0:M.case)==="join"?(this.state=Or.CONNECTED,a==null||a.removeEventListener("abort",k),this.pingTimeoutDuration=V.message.value.pingTimeout,this.pingIntervalDuration=V.message.value.pingInterval,this.pingTimeoutDuration&&this.pingTimeoutDuration>0&&(this.log.debug("ping config",Object.assign(Object.assign({},this.logContext),{timeout:this.pingTimeoutDuration,interval:this.pingIntervalDuration})),this.startPingInterval()),p(V.message.value)):this.state===Or.RECONNECTING&&V.message.case!=="leave"?(this.state=Or.CONNECTED,a==null||a.removeEventListener("abort",k),this.startPingInterval(),((A=V.message)===null||A===void 0?void 0:A.case)==="reconnect"?p(V.message.value):(this.log.debug("declaring signal reconnected without reconnect response received",this.logContext),p(void 0),j=!0)):this.isEstablishingConnection&&V.message.case==="leave"?v(new br("Received leave request while trying to (re)connect",Un.LeaveRequest,void 0,V.message.value.reason)):r.reconnect||v(new br("did not receive join response, got ".concat((U=V.message)===null||U===void 0?void 0:U.case," instead"),Un.InternalError)),!j)return}this.signalLatency&&(yield io(this.signalLatency)),this.handleSignalResponse(V)}),this.ws.onclose=R=>{this.isEstablishingConnection&&v(new br("Websocket got closed during a (re)connection attempt",Un.InternalError)),this.log.warn("websocket closed",Object.assign(Object.assign({},this.logContext),{reason:R.reason,code:R.code,wasClean:R.wasClean,state:this.state})),this.handleOnClose(R.reason)}}finally{b()}}))}close(){return Q(this,arguments,void 0,function(){var e=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){const r=yield e.closingLock.lock();try{if(e.clearPingInterval(),n&&(e.state=Or.DISCONNECTING),e.ws){e.ws.onmessage=null,e.ws.onopen=null,e.ws.onclose=null;const a=new Promise(s=>{e.ws?e.ws.onclose=()=>{s()}:s()});e.ws.readyState<e.ws.CLOSING&&(e.ws.close(),yield Promise.race([a,io(250)])),e.ws=void 0}}finally{n&&(e.state=Or.DISCONNECTED),r()}}()})}sendOffer(e){this.log.debug("sending offer",Object.assign(Object.assign({},this.logContext),{offerSdp:e.sdp})),this.sendRequest({case:"offer",value:sb(e)})}sendAnswer(e){return this.log.debug("sending answer",Object.assign(Object.assign({},this.logContext),{answerSdp:e.sdp})),this.sendRequest({case:"answer",value:sb(e)})}sendIceCandidate(e,n){return this.log.debug("sending ice candidate",Object.assign(Object.assign({},this.logContext),{candidate:e})),this.sendRequest({case:"trickle",value:new z1({candidateInit:JSON.stringify(e),target:n})})}sendMuteTrack(e,n){return this.sendRequest({case:"mute",value:new B1({sid:e,muted:n})})}sendAddTrack(e){return this.sendRequest({case:"addTrack",value:e})}sendUpdateLocalMetadata(e,n){return Q(this,arguments,void 0,function(r,a){var s=this;let l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){const c=s.getNextRequestId();return yield s.sendRequest({case:"updateMetadata",value:new aA({requestId:c,metadata:r,name:a,attributes:l})}),c}()})}sendUpdateTrackSettings(e){this.sendRequest({case:"trackSetting",value:e})}sendUpdateSubscription(e){return this.sendRequest({case:"subscription",value:e})}sendSyncState(e){return this.sendRequest({case:"syncState",value:e})}sendUpdateVideoLayers(e,n){return this.sendRequest({case:"updateLayers",value:new iA({trackSid:e,layers:n})})}sendUpdateSubscriptionPermissions(e,n){return this.sendRequest({case:"subscriptionPermission",value:new lA({allParticipants:e,trackPermissions:n})})}sendSimulateScenario(e){return this.sendRequest({case:"simulate",value:e})}sendPing(){return Promise.all([this.sendRequest({case:"ping",value:Ur.parse(Date.now())}),this.sendRequest({case:"pingReq",value:new dA({timestamp:Ur.parse(Date.now()),rtt:Ur.parse(this.rtt)})})])}sendUpdateLocalAudioTrack(e,n){return this.sendRequest({case:"updateAudioTrack",value:new rA({trackSid:e,features:n})})}sendLeave(){return this.sendRequest({case:"leave",value:new W0({reason:ks.CLIENT_INITIATED,action:Fh.DISCONNECT})})}sendRequest(e){return Q(this,arguments,void 0,function(n){var r=this;let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return function*(){if(!a&&!LV(n)&&r.state===Or.RECONNECTING){r.queuedRequests.push(()=>Q(r,void 0,void 0,function*(){yield this.sendRequest(n,!0)}));return}if(a||(yield r.requestQueue.flush()),r.signalLatency&&(yield io(r.signalLatency)),!r.ws||r.ws.readyState!==r.ws.OPEN){r.log.error("cannot send signal request before connected, type: ".concat(n==null?void 0:n.case),r.logContext);return}const l=new s8({message:n});try{r.useJSON?r.ws.send(l.toJsonString()):r.ws.send(l.toBinary())}catch(c){r.log.error("error sending signal message",Object.assign(Object.assign({},r.logContext),{error:c}))}}()})}handleSignalResponse(e){var n,r;const a=e.message;if(a==null){this.log.debug("received unsupported message",this.logContext);return}let s=!1;if(a.case==="answer"){const l=CO(a.value);this.onAnswer&&this.onAnswer(l)}else if(a.case==="offer"){const l=CO(a.value);this.onOffer&&this.onOffer(l)}else if(a.case==="trickle"){const l=JSON.parse(a.value.candidateInit);this.onTrickle&&this.onTrickle(l,a.value.target)}else a.case==="update"?this.onParticipantUpdate&&this.onParticipantUpdate((n=a.value.participants)!==null&&n!==void 0?n:[]):a.case==="trackPublished"?this.onLocalTrackPublished&&this.onLocalTrackPublished(a.value):a.case==="speakersChanged"?this.onSpeakersChanged&&this.onSpeakersChanged((r=a.value.speakers)!==null&&r!==void 0?r:[]):a.case==="leave"?this.onLeave&&this.onLeave(a.value):a.case==="mute"?this.onRemoteMuteChanged&&this.onRemoteMuteChanged(a.value.sid,a.value.muted):a.case==="roomUpdate"?this.onRoomUpdate&&a.value.room&&this.onRoomUpdate(a.value.room):a.case==="connectionQuality"?this.onConnectionQuality&&this.onConnectionQuality(a.value):a.case==="streamStateUpdate"?this.onStreamStateUpdate&&this.onStreamStateUpdate(a.value):a.case==="subscribedQualityUpdate"?this.onSubscribedQualityUpdate&&this.onSubscribedQualityUpdate(a.value):a.case==="subscriptionPermissionUpdate"?this.onSubscriptionPermissionUpdate&&this.onSubscriptionPermissionUpdate(a.value):a.case==="refreshToken"?this.onTokenRefresh&&this.onTokenRefresh(a.value):a.case==="trackUnpublished"?this.onLocalTrackUnpublished&&this.onLocalTrackUnpublished(a.value):a.case==="subscriptionResponse"?this.onSubscriptionError&&this.onSubscriptionError(a.value):a.case==="pong"||(a.case==="pongResp"?(this.rtt=Date.now()-Number.parseInt(a.value.lastPingTimestamp.toString()),this.resetPingTimeout(),s=!0):a.case==="requestResponse"?this.onRequestResponse&&this.onRequestResponse(a.value):a.case==="trackSubscribed"?this.onLocalTrackSubscribed&&this.onLocalTrackSubscribed(a.value.trackSid):this.log.debug("unsupported message",Object.assign(Object.assign({},this.logContext),{msgCase:a.case})));s||this.resetPingTimeout()}setReconnected(){for(;this.queuedRequests.length>0;){const e=this.queuedRequests.shift();e&&this.requestQueue.run(e)}}handleOnClose(e){return Q(this,void 0,void 0,function*(){if(this.state===Or.DISCONNECTED)return;const n=this.onClose;yield this.close(),this.log.debug("websocket connection closed: ".concat(e),Object.assign(Object.assign({},this.logContext),{reason:e})),n&&n(e)})}handleWSError(e){this.log.error("websocket error",Object.assign(Object.assign({},this.logContext),{error:e}))}resetPingTimeout(){if(this.clearPingTimeout(),!this.pingTimeoutDuration){this.log.warn("ping timeout duration not set",this.logContext);return}this.pingTimeout=Qi.setTimeout(()=>{this.log.warn("ping timeout triggered. last pong received at: ".concat(new Date(Date.now()-this.pingTimeoutDuration*1e3).toUTCString()),this.logContext),this.handleOnClose("ping timeout")},this.pingTimeoutDuration*1e3)}clearPingTimeout(){this.pingTimeout&&Qi.clearTimeout(this.pingTimeout)}startPingInterval(){if(this.clearPingInterval(),this.resetPingTimeout(),!this.pingIntervalDuration){this.log.warn("ping interval duration not set",this.logContext);return}this.log.debug("start ping interval",this.logContext),this.pingInterval=Qi.setInterval(()=>{this.sendPing()},this.pingIntervalDuration*1e3)}clearPingInterval(){this.log.debug("clearing ping interval",this.logContext),this.clearPingTimeout(),this.pingInterval&&Qi.clearInterval(this.pingInterval)}}function CO(t){const e={type:"offer",sdp:t.sdp};switch(t.type){case"answer":case"offer":case"pranswer":case"rollback":e.type=t.type;break}return e}function sb(t){return new Yd({sdp:t.sdp,type:t.type})}function NV(t,e,n){var r;const a=new URLSearchParams;return a.set("access_token",t),n.reconnect&&(a.set("reconnect","1"),n.sid&&a.set("sid",n.sid)),a.set("auto_subscribe",n.autoSubscribe?"1":"0"),a.set("sdk",fl()?"reactnative":"js"),a.set("version",e.version),a.set("protocol",e.protocol.toString()),e.deviceModel&&a.set("device_model",e.deviceModel),e.os&&a.set("os",e.os),e.osVersion&&a.set("os_version",e.osVersion),e.browser&&a.set("browser",e.browser),e.browserVersion&&a.set("browser_version",e.browserVersion),n.adaptiveStream&&a.set("adaptive_stream","1"),n.reconnectReason&&a.set("reconnect_reason",n.reconnectReason.toString()),!((r=navigator.connection)===null||r===void 0)&&r.type&&a.set("network",navigator.connection.type),a}var _s={},xT={},wT={exports:{}},kO;function _T(){if(kO)return wT.exports;kO=1;var t=wT.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return e.address!=null?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return e.subtype!=null?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return e.sessionConfig!=null?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var n="candidate:%s %d %s %d %s %d typ %s";return n+=e.raddr!=null?" raddr %s rport %d":"%v%v",n+=e.tcptype!=null?" tcptype %s":"%v",e.generation!=null&&(n+=" generation %d"),n+=e["network-id"]!=null?" network-id %d":"%v",n+=e["network-cost"]!=null?" network-cost %d":"%v",n}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var n="ssrc:%d";return e.attribute!=null&&(n+=" %s",e.value!=null&&(n+=":%s")),n}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return e.maxMessageSize!=null?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(e.clksrcExt!=null?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var n="mediaclk:";return n+=e.id!=null?"id=%s %s":"%v%s",n+=e.mediaClockValue!=null?"=%s":"",n+=e.rateNumerator!=null?" rate=%s":"",n+=e.rateDenominator!=null?"/%s":"",n}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};return Object.keys(t).forEach(function(e){var n=t[e];n.forEach(function(r){r.reg||(r.reg=/(.*)/),r.format||(r.format="%s")})}),wT.exports}var TO;function IV(){return TO||(TO=1,function(t){var e=function(c){return String(Number(c))===c?Number(c):c},n=function(c,h,p,v){if(v&&!p)h[v]=e(c[1]);else for(var b=0;b<p.length;b+=1)c[b+1]!=null&&(h[p[b]]=e(c[b+1]))},r=function(c,h,p){var v=c.name&&c.names;c.push&&!h[c.push]?h[c.push]=[]:v&&!h[c.name]&&(h[c.name]={});var b=c.push?{}:v?h[c.name]:h;n(p.match(c.reg),b,c.names,c.name),c.push&&h[c.push].push(b)},a=_T(),s=RegExp.prototype.test.bind(/^([a-z])=(.*)/);t.parse=function(c){var h={},p=[],v=h;return c.split(/(\r\n|\r|\n)/).filter(s).forEach(function(b){var k=b[0],T=b.slice(2);k==="m"&&(p.push({rtp:[],fmtp:[]}),v=p[p.length-1]);for(var E=0;E<(a[k]||[]).length;E+=1){var R=a[k][E];if(R.reg.test(T))return r(R,v,T)}}),h.media=p,h};var l=function(c,h){var p=h.split(/=(.+)/,2);return p.length===2?c[p[0]]=e(p[1]):p.length===1&&h.length>1&&(c[p[0]]=void 0),c};t.parseParams=function(c){return c.split(/;\s?/).reduce(l,{})},t.parseFmtpConfig=t.parseParams,t.parsePayloads=function(c){return c.toString().split(" ").map(Number)},t.parseRemoteCandidates=function(c){for(var h=[],p=c.split(" ").map(e),v=0;v<p.length;v+=3)h.push({component:p[v],ip:p[v+1],port:p[v+2]});return h},t.parseImageAttributes=function(c){return c.split(" ").map(function(h){return h.substring(1,h.length-1).split(",").reduce(l,{})})},t.parseSimulcastStreamList=function(c){return c.split(";").map(function(h){return h.split(",").map(function(p){var v,b=!1;return p[0]!=="~"?v=e(p):(v=e(p.substring(1,p.length)),b=!0),{scid:v,paused:b}})})}}(xT)),xT}var ET,xO;function UV(){if(xO)return ET;xO=1;var t=_T(),e=/%[sdv%]/g,n=function(l){var c=1,h=arguments,p=h.length;return l.replace(e,function(v){if(c>=p)return v;var b=h[c];switch(c+=1,v){case"%%":return"%";case"%s":return String(b);case"%d":return Number(b);case"%v":return""}})},r=function(l,c,h){var p=c.format instanceof Function?c.format(c.push?h:h[c.name]):c.format,v=[l+"="+p];if(c.names)for(var b=0;b<c.names.length;b+=1){var k=c.names[b];c.name?v.push(h[c.name][k]):v.push(h[c.names[b]])}else v.push(h[c.name]);return n.apply(null,v)},a=["v","o","s","i","u","e","p","c","b","t","r","z","a"],s=["i","c","b","a"];return ET=function(l,c){c=c||{},l.version==null&&(l.version=0),l.name==null&&(l.name=" "),l.media.forEach(function(b){b.payloads==null&&(b.payloads="")});var h=c.outerOrder||a,p=c.innerOrder||s,v=[];return h.forEach(function(b){t[b].forEach(function(k){k.name in l&&l[k.name]!=null?v.push(r(b,k,l)):k.push in l&&l[k.push]!=null&&l[k.push].forEach(function(T){v.push(r(b,k,T))})})}),l.media.forEach(function(b){v.push(r("m",t.m[0],b)),p.forEach(function(k){t[k].forEach(function(T){T.name in b&&b[T.name]!=null?v.push(r(k,T,b)):T.push in b&&b[T.push]!=null&&b[T.push].forEach(function(E){v.push(r(k,T,E))})})})}),v.join(`\r
|
|
276
|
+
`);t.RTCSessionDescription&&a instanceof t.RTCSessionDescription?arguments[0]=new t.RTCSessionDescription({type:a.type,sdp:s}):a.sdp=s}return n.apply(this,arguments)}}function eb(t,e){if(!(t.RTCPeerConnection&&t.RTCPeerConnection.prototype))return;const n=t.RTCPeerConnection.prototype.addIceCandidate;!n||n.length===0||(t.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?(e.browser==="chrome"&&e.version<78||e.browser==="firefox"&&e.version<68||e.browser==="safari")&&arguments[0]&&arguments[0].candidate===""?Promise.resolve():n.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function tb(t,e){if(!(t.RTCPeerConnection&&t.RTCPeerConnection.prototype))return;const n=t.RTCPeerConnection.prototype.setLocalDescription;!n||n.length===0||(t.RTCPeerConnection.prototype.setLocalDescription=function(){let a=arguments[0]||{};if(typeof a!="object"||a.type&&a.sdp)return n.apply(this,arguments);if(a={type:a.type,sdp:a.sdp},!a.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":a.type="offer";break;default:a.type="answer";break}return a.sdp||a.type!=="offer"&&a.type!=="answer"?n.apply(this,[a]):(a.type==="offer"?this.createOffer:this.createAnswer).apply(this).then(l=>n.apply(this,[l]))})}var B8=Object.freeze({__proto__:null,removeExtmapAllowMixed:eT,shimAddIceCandidateNullOrEmpty:eb,shimConnectionState:J1,shimMaxMessageSize:X0,shimParameterlessSetLocalDescription:tb,shimRTCIceCandidate:Q0,shimRTCIceCandidateRelayProtocol:X1,shimSendThrowTypeError:J0});function H8(){let{window:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0};const n=vA,r=F8(t),a={browserDetails:r,commonShim:B8,extractVersion:Z0,disableLog:I8,disableWarnings:U8,sdp:z8};switch(r.browser){case"chrome":if(!DA||!K1||!e.shimChrome)return n("Chrome shim is not included in this adapter release."),a;if(r.version===null)return n("Chrome shim can not determine version, not shimming."),a;n("adapter.js shimming chrome."),a.browserShim=DA,eb(t,r),tb(t),kA(t,r),TA(t),K1(t,r),xA(t),RA(t,r),wA(t),_A(t),PA(t,r),Q0(t),X1(t),J1(t),X0(t,r),J0(t),eT(t,r);break;case"firefox":if(!zA||!Z1||!e.shimFirefox)return n("Firefox shim is not included in this adapter release."),a;n("adapter.js shimming firefox."),a.browserShim=zA,eb(t,r),tb(t),AA(t,r),Z1(t,r),OA(t),NA(t),MA(t),LA(t),IA(t),UA(t),FA(t),jA(t),VA(t),Q0(t),J1(t),X0(t,r),J0(t);break;case"safari":if(!QA||!e.shimSafari)return n("Safari shim is not included in this adapter release."),a;n("adapter.js shimming safari."),a.browserShim=QA,eb(t,r),tb(t),GA(t),KA(t),$A(t),BA(t),HA(t),YA(t),qA(t),ZA(t),Q0(t),X1(t),X0(t,r),J0(t),eT(t,r);break;default:n("Unsupported browser!");break}return a}H8({window:typeof window>"u"?void 0:window});const $8=10,nb="lk_e2ee",q8={sharedKey:!1,ratchetSalt:"LKFrameEncryptionKey",ratchetWindowSize:8,failureTolerance:$8,keyringSize:16};var mc;(function(t){t.SetKey="setKey",t.RatchetRequest="ratchetRequest",t.KeyRatcheted="keyRatcheted"})(mc||(mc={}));var eO;(function(t){t.KeyRatcheted="keyRatcheted"})(eO||(eO={}));var gc;(function(t){t.ParticipantEncryptionStatusChanged="participantEncryptionStatusChanged",t.EncryptionError="encryptionError"})(gc||(gc={}));var tO;(function(t){t.Error="cryptorError"})(tO||(tO={}));function W8(){return G8()||tT()}function tT(){return typeof window.RTCRtpScriptTransform<"u"}function G8(){return typeof window.RTCRtpSender<"u"&&typeof window.RTCRtpSender.prototype.createEncodedStreams<"u"}class Ase extends dl.EventEmitter{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};super(),this.onKeyRatcheted=(n,r)=>{Nn.debug("key ratcheted event received",{material:n,keyIndex:r})},this.keyInfoMap=new Map,this.options=Object.assign(Object.assign({},q8),e),this.on(mc.KeyRatcheted,this.onKeyRatcheted)}onSetEncryptionKey(e,n,r){const a={key:e,participantIdentity:n,keyIndex:r};if(!this.options.sharedKey&&!n)throw new Error("participant identity needs to be passed for encryption key if sharedKey option is false");this.keyInfoMap.set("".concat(n??"shared","-").concat(r??0),a),this.emit(mc.SetKey,a)}getKeys(){return Array.from(this.keyInfoMap.values())}getOptions(){return this.options}ratchetKey(e,n){this.emit(mc.RatchetRequest,e,n)}}class vc extends Error{constructor(e,n){super(n||"an error has occured"),this.name="LiveKitError",this.code=e}}var Un;(function(t){t[t.NotAllowed=0]="NotAllowed",t[t.ServerUnreachable=1]="ServerUnreachable",t[t.InternalError=2]="InternalError",t[t.Cancelled=3]="Cancelled",t[t.LeaveRequest=4]="LeaveRequest"})(Un||(Un={}));class br extends vc{constructor(e,n,r,a){super(1,e),this.name="ConnectionError",this.status=r,this.reason=n,this.context=a,this.reasonName=Un[n]}}class nT extends vc{constructor(e){super(21,e??"device is unsupported"),this.name="DeviceUnsupportedError"}}class uu extends vc{constructor(e){super(20,e??"track is invalid"),this.name="TrackInvalidError"}}class Y8 extends vc{constructor(e){super(10,e??"unsupported server"),this.name="UnsupportedServer"}}class xi extends vc{constructor(e){super(12,e??"unexpected connection state"),this.name="UnexpectedConnectionState"}}class rT extends vc{constructor(e){super(13,e??"unable to negotiate"),this.name="NegotiationError"}}class iT extends vc{constructor(e,n){super(15,e),this.name="PublishTrackError",this.status=n}}class nO extends vc{constructor(e,n){super(15,e),this.reason=n,this.reasonName=typeof n=="string"?n:q1[n]}}var rb;(function(t){t.PermissionDenied="PermissionDenied",t.NotFound="NotFound",t.DeviceInUse="DeviceInUse",t.Other="Other"})(rb||(rb={})),function(t){function e(n){if(n&&"name"in n)return n.name==="NotFoundError"||n.name==="DevicesNotFoundError"?t.NotFound:n.name==="NotAllowedError"||n.name==="PermissionDeniedError"?t.PermissionDenied:n.name==="NotReadableError"||n.name==="TrackStartError"?t.DeviceInUse:t.Other}t.getFailure=e}(rb||(rb={}));var rO;(function(t){t[t.InvalidKey=0]="InvalidKey",t[t.MissingKey=1]="MissingKey",t[t.InternalError=2]="InternalError"})(rO||(rO={}));var Ee;(function(t){t.Connected="connected",t.Reconnecting="reconnecting",t.SignalReconnecting="signalReconnecting",t.Reconnected="reconnected",t.Disconnected="disconnected",t.ConnectionStateChanged="connectionStateChanged",t.MediaDevicesChanged="mediaDevicesChanged",t.ParticipantConnected="participantConnected",t.ParticipantDisconnected="participantDisconnected",t.TrackPublished="trackPublished",t.TrackSubscribed="trackSubscribed",t.TrackSubscriptionFailed="trackSubscriptionFailed",t.TrackUnpublished="trackUnpublished",t.TrackUnsubscribed="trackUnsubscribed",t.TrackMuted="trackMuted",t.TrackUnmuted="trackUnmuted",t.LocalTrackPublished="localTrackPublished",t.LocalTrackUnpublished="localTrackUnpublished",t.LocalAudioSilenceDetected="localAudioSilenceDetected",t.ActiveSpeakersChanged="activeSpeakersChanged",t.ParticipantMetadataChanged="participantMetadataChanged",t.ParticipantNameChanged="participantNameChanged",t.ParticipantAttributesChanged="participantAttributesChanged",t.RoomMetadataChanged="roomMetadataChanged",t.DataReceived="dataReceived",t.SipDTMFReceived="sipDTMFReceived",t.TranscriptionReceived="transcriptionReceived",t.ConnectionQualityChanged="connectionQualityChanged",t.TrackStreamStateChanged="trackStreamStateChanged",t.TrackSubscriptionPermissionChanged="trackSubscriptionPermissionChanged",t.TrackSubscriptionStatusChanged="trackSubscriptionStatusChanged",t.AudioPlaybackStatusChanged="audioPlaybackChanged",t.VideoPlaybackStatusChanged="videoPlaybackChanged",t.MediaDevicesError="mediaDevicesError",t.ParticipantPermissionsChanged="participantPermissionsChanged",t.SignalConnected="signalConnected",t.RecordingStatusChanged="recordingStatusChanged",t.ParticipantEncryptionStatusChanged="participantEncryptionStatusChanged",t.EncryptionError="encryptionError",t.DCBufferStatusChanged="dcBufferStatusChanged",t.ActiveDeviceChanged="activeDeviceChanged",t.ChatMessage="chatMessage",t.LocalTrackSubscribed="localTrackSubscribed",t.MetricsReceived="metricsReceived"})(Ee||(Ee={}));var Ie;(function(t){t.TrackPublished="trackPublished",t.TrackSubscribed="trackSubscribed",t.TrackSubscriptionFailed="trackSubscriptionFailed",t.TrackUnpublished="trackUnpublished",t.TrackUnsubscribed="trackUnsubscribed",t.TrackMuted="trackMuted",t.TrackUnmuted="trackUnmuted",t.LocalTrackPublished="localTrackPublished",t.LocalTrackUnpublished="localTrackUnpublished",t.ParticipantMetadataChanged="participantMetadataChanged",t.ParticipantNameChanged="participantNameChanged",t.DataReceived="dataReceived",t.SipDTMFReceived="sipDTMFReceived",t.TranscriptionReceived="transcriptionReceived",t.IsSpeakingChanged="isSpeakingChanged",t.ConnectionQualityChanged="connectionQualityChanged",t.TrackStreamStateChanged="trackStreamStateChanged",t.TrackSubscriptionPermissionChanged="trackSubscriptionPermissionChanged",t.TrackSubscriptionStatusChanged="trackSubscriptionStatusChanged",t.MediaDevicesError="mediaDevicesError",t.AudioStreamAcquired="audioStreamAcquired",t.ParticipantPermissionsChanged="participantPermissionsChanged",t.PCTrackAdded="pcTrackAdded",t.AttributesChanged="attributesChanged",t.LocalTrackSubscribed="localTrackSubscribed",t.ChatMessage="chatMessage"})(Ie||(Ie={}));var tt;(function(t){t.TransportsCreated="transportsCreated",t.Connected="connected",t.Disconnected="disconnected",t.Resuming="resuming",t.Resumed="resumed",t.Restarting="restarting",t.Restarted="restarted",t.SignalResumed="signalResumed",t.SignalRestarted="signalRestarted",t.Closing="closing",t.MediaTrackAdded="mediaTrackAdded",t.ActiveSpeakersUpdate="activeSpeakersUpdate",t.DataPacketReceived="dataPacketReceived",t.RTPVideoMapUpdate="rtpVideoMapUpdate",t.DCBufferStatusChanged="dcBufferStatusChanged",t.ParticipantUpdate="participantUpdate",t.RoomUpdate="roomUpdate",t.SpeakersChanged="speakersChanged",t.StreamStateChanged="streamStateChanged",t.ConnectionQualityUpdate="connectionQualityUpdate",t.SubscriptionError="subscriptionError",t.SubscriptionPermissionUpdate="subscriptionPermissionUpdate",t.RemoteMute="remoteMute",t.SubscribedQualityUpdate="subscribedQualityUpdate",t.LocalTrackUnpublished="localTrackUnpublished",t.LocalTrackSubscribed="localTrackSubscribed",t.Offline="offline",t.SignalRequestResponse="signalRequestResponse",t.SignalConnected="signalConnected"})(tt||(tt={}));var Qe;(function(t){t.Message="message",t.Muted="muted",t.Unmuted="unmuted",t.Restarted="restarted",t.Ended="ended",t.Subscribed="subscribed",t.Unsubscribed="unsubscribed",t.UpdateSettings="updateSettings",t.UpdateSubscription="updateSubscription",t.AudioPlaybackStarted="audioPlaybackStarted",t.AudioPlaybackFailed="audioPlaybackFailed",t.AudioSilenceDetected="audioSilenceDetected",t.VisibilityChanged="visibilityChanged",t.VideoDimensionsChanged="videoDimensionsChanged",t.VideoPlaybackStarted="videoPlaybackStarted",t.VideoPlaybackFailed="videoPlaybackFailed",t.ElementAttached="elementAttached",t.ElementDetached="elementDetached",t.UpstreamPaused="upstreamPaused",t.UpstreamResumed="upstreamResumed",t.SubscriptionPermissionChanged="subscriptionPermissionChanged",t.SubscriptionStatusChanged="subscriptionStatusChanged",t.SubscriptionFailed="subscriptionFailed",t.TrackProcessorUpdate="trackProcessorUpdate",t.AudioTrackFeatureUpdate="audioTrackFeatureUpdate",t.TranscriptionReceived="transcriptionReceived",t.TimeSyncUpdate="timeSyncUpdate"})(Qe||(Qe={}));function K8(t){return typeof t>"u"?t:typeof structuredClone=="function"?structuredClone(t):JSON.parse(JSON.stringify(t))}const Z8=/version\/(\d+(\.?_?\d+)+)/i;let aT;function ws(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(typeof navigator>"u")return;const n=navigator.userAgent.toLowerCase();if(aT===void 0||e){const r=Q8.find(a=>{let{test:s}=a;return s.test(n)});aT=r==null?void 0:r.describe(n)}return aT}const Q8=[{test:/firefox|iceweasel|fxios/i,describe(t){return{name:"Firefox",version:ib(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,t),os:t.toLowerCase().includes("fxios")?"iOS":void 0,osVersion:oT(t)}}},{test:/chrom|crios|crmo/i,describe(t){return{name:"Chrome",version:ib(/(?:chrome|chromium|crios|crmo)\/(\d+(\.?_?\d+)+)/i,t),os:t.toLowerCase().includes("crios")?"iOS":void 0,osVersion:oT(t)}}},{test:/safari|applewebkit/i,describe(t){return{name:"Safari",version:ib(Z8,t),os:t.includes("mobile/")?"iOS":"macOS",osVersion:oT(t)}}}];function ib(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;const r=e.match(t);return r&&r.length>=n&&r[n]||""}function oT(t){return t.includes("mac os")?ib(/\(.+?(\d+_\d+(:?_\d+)?)/,t,1).replace(/_/g,"."):void 0}var X8="2.11.4";const J8=X8,eV=15;class Qi{}Qi.setTimeout=function(){return setTimeout(...arguments)},Qi.setInterval=function(){return setInterval(...arguments)},Qi.clearTimeout=function(){return clearTimeout(...arguments)},Qi.clearInterval=function(){return clearInterval(...arguments)};const tV=5e3,Rg=[];var Go;(function(t){t[t.LOW=0]="LOW",t[t.MEDIUM=1]="MEDIUM",t[t.HIGH=2]="HIGH"})(Go||(Go={}));class De extends dl.EventEmitter{constructor(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var a;super(),this.attachedElements=[],this.isMuted=!1,this.streamState=De.StreamState.Active,this.isInBackground=!1,this._currentBitrate=0,this.log=Nn,this.appVisibilityChangedListener=()=>{this.backgroundTimeout&&clearTimeout(this.backgroundTimeout),document.visibilityState==="hidden"?this.backgroundTimeout=setTimeout(()=>this.handleAppVisibilityChanged(),tV):this.handleAppVisibilityChanged()},this.log=lu((a=r.loggerName)!==null&&a!==void 0?a:xs.Track),this.loggerContextCb=r.loggerContextCb,this.setMaxListeners(100),this.kind=n,this._mediaStreamTrack=e,this._mediaStreamID=e.id,this.source=De.Source.Unknown}get logContext(){var e;return Object.assign(Object.assign({},(e=this.loggerContextCb)===null||e===void 0?void 0:e.call(this)),ar(this))}get currentBitrate(){return this._currentBitrate}get mediaStreamTrack(){return this._mediaStreamTrack}get mediaStreamID(){return this._mediaStreamID}attach(e){let n="audio";this.kind===De.Kind.Video&&(n="video"),this.attachedElements.length===0&&this.kind===De.Kind.Video&&this.addAppVisibilityListener(),e||(n==="audio"&&(Rg.forEach(s=>{s.parentElement===null&&!e&&(e=s)}),e&&Rg.splice(Rg.indexOf(e),1)),e||(e=document.createElement(n))),this.attachedElements.includes(e)||this.attachedElements.push(e),Vh(this.mediaStreamTrack,e);const r=e.srcObject.getTracks(),a=r.some(s=>s.kind==="audio");return e.play().then(()=>{this.emit(a?Qe.AudioPlaybackStarted:Qe.VideoPlaybackStarted)}).catch(s=>{s.name==="NotAllowedError"?this.emit(a?Qe.AudioPlaybackFailed:Qe.VideoPlaybackFailed,s):s.name==="AbortError"?Nn.debug("".concat(a?"audio":"video"," playback aborted, likely due to new play request")):Nn.warn("could not playback ".concat(a?"audio":"video"),s),a&&e&&r.some(l=>l.kind==="video")&&s.name==="NotAllowedError"&&(e.muted=!0,e.play().catch(()=>{}))}),this.emit(Qe.ElementAttached,e),e}detach(e){try{if(e){zh(this.mediaStreamTrack,e);const r=this.attachedElements.indexOf(e);return r>=0&&(this.attachedElements.splice(r,1),this.recycleElement(e),this.emit(Qe.ElementDetached,e)),e}const n=[];return this.attachedElements.forEach(r=>{zh(this.mediaStreamTrack,r),n.push(r),this.recycleElement(r),this.emit(Qe.ElementDetached,r)}),this.attachedElements=[],n}finally{this.attachedElements.length===0&&this.removeAppVisibilityListener()}}stop(){this.stopMonitor(),this._mediaStreamTrack.stop()}enable(){this._mediaStreamTrack.enabled=!0}disable(){this._mediaStreamTrack.enabled=!1}stopMonitor(){this.monitorInterval&&clearInterval(this.monitorInterval),this.timeSyncHandle&&cancelAnimationFrame(this.timeSyncHandle)}updateLoggerOptions(e){e.loggerName&&(this.log=lu(e.loggerName)),e.loggerContextCb&&(this.loggerContextCb=e.loggerContextCb)}recycleElement(e){if(e instanceof HTMLAudioElement){let n=!0;e.pause(),Rg.forEach(r=>{r.parentElement||(n=!1)}),n&&Rg.push(e)}}handleAppVisibilityChanged(){return Q(this,void 0,void 0,function*(){this.isInBackground=document.visibilityState==="hidden",!this.isInBackground&&this.kind===De.Kind.Video&&setTimeout(()=>this.attachedElements.forEach(e=>e.play().catch(()=>{})),0)})}addAppVisibilityListener(){ao()?(this.isInBackground=document.visibilityState==="hidden",document.addEventListener("visibilitychange",this.appVisibilityChangedListener)):this.isInBackground=!1}removeAppVisibilityListener(){ao()&&document.removeEventListener("visibilitychange",this.appVisibilityChangedListener)}}function Vh(t,e){let n;e.srcObject instanceof MediaStream?n=e.srcObject:n=new MediaStream;let r;t.kind==="audio"?r=n.getAudioTracks():r=n.getVideoTracks(),r.includes(t)||(r.forEach(a=>{n.removeTrack(a)}),n.addTrack(t)),(!yc()||!(e instanceof HTMLVideoElement))&&(e.autoplay=!0),e.muted=n.getAudioTracks().length===0,e instanceof HTMLVideoElement&&(e.playsInline=!0),e.srcObject!==n&&(e.srcObject=n,(yc()||Bh())&&e instanceof HTMLVideoElement&&setTimeout(()=>{e.srcObject=n,e.play().catch(()=>{})},0))}function zh(t,e){if(e.srcObject instanceof MediaStream){const n=e.srcObject;n.removeTrack(t),n.getTracks().length>0?e.srcObject=n:e.srcObject=null}}(function(t){let e;(function(p){p.Audio="audio",p.Video="video",p.Unknown="unknown"})(e=t.Kind||(t.Kind={}));let n;(function(p){p.Camera="camera",p.Microphone="microphone",p.ScreenShare="screen_share",p.ScreenShareAudio="screen_share_audio",p.Unknown="unknown"})(n=t.Source||(t.Source={}));let r;(function(p){p.Active="active",p.Paused="paused",p.Unknown="unknown"})(r=t.StreamState||(t.StreamState={}));function a(p){switch(p){case e.Audio:return Cs.AUDIO;case e.Video:return Cs.VIDEO;default:return Cs.DATA}}t.kindToProto=a;function s(p){switch(p){case Cs.AUDIO:return e.Audio;case Cs.VIDEO:return e.Video;default:return e.Unknown}}t.kindFromProto=s;function l(p){switch(p){case n.Camera:return gi.CAMERA;case n.Microphone:return gi.MICROPHONE;case n.ScreenShare:return gi.SCREEN_SHARE;case n.ScreenShareAudio:return gi.SCREEN_SHARE_AUDIO;default:return gi.UNKNOWN}}t.sourceToProto=l;function c(p){switch(p){case gi.CAMERA:return n.Camera;case gi.MICROPHONE:return n.Microphone;case gi.SCREEN_SHARE:return n.ScreenShare;case gi.SCREEN_SHARE_AUDIO:return n.ScreenShareAudio;default:return n.Unknown}}t.sourceFromProto=c;function h(p){switch(p){case F1.ACTIVE:return r.Active;case F1.PAUSED:return r.Paused;default:return r.Unknown}}t.streamStateFromProto=h})(De||(De={}));class gr{constructor(e,n,r,a,s){if(typeof e=="object")this.width=e.width,this.height=e.height,this.aspectRatio=e.aspectRatio,this.encoding={maxBitrate:e.maxBitrate,maxFramerate:e.maxFramerate,priority:e.priority};else if(n!==void 0&&r!==void 0)this.width=e,this.height=n,this.aspectRatio=e/n,this.encoding={maxBitrate:r,maxFramerate:a,priority:s};else throw new TypeError("Unsupported options: provide at least width, height and maxBitrate")}get resolution(){return{width:this.width,height:this.height,frameRate:this.encoding.maxFramerate,aspectRatio:this.aspectRatio}}}const nV=["vp8","h264"],rV=["vp8","h264","vp9","av1"];function iV(t){return!!nV.find(e=>e===t)}var iO;(function(t){t[t.PREFER_REGRESSION=0]="PREFER_REGRESSION",t[t.SIMULCAST=1]="SIMULCAST",t[t.REGRESSION=2]="REGRESSION"})(iO||(iO={}));var sT;(function(t){t.telephone={maxBitrate:12e3},t.speech={maxBitrate:24e3},t.music={maxBitrate:48e3},t.musicStereo={maxBitrate:64e3},t.musicHighQuality={maxBitrate:96e3},t.musicHighQualityStereo={maxBitrate:128e3}})(sT||(sT={}));const Pg={h90:new gr(160,90,9e4,20),h180:new gr(320,180,16e4,20),h216:new gr(384,216,18e4,20),h360:new gr(640,360,45e4,20),h540:new gr(960,540,8e5,25),h720:new gr(1280,720,17e5,30),h1080:new gr(1920,1080,3e6,30),h1440:new gr(2560,1440,5e6,30),h2160:new gr(3840,2160,8e6,30)},lT={h120:new gr(160,120,7e4,20),h180:new gr(240,180,125e3,20),h240:new gr(320,240,14e4,20),h360:new gr(480,360,33e4,20),h480:new gr(640,480,5e5,20),h540:new gr(720,540,6e5,25),h720:new gr(960,720,13e5,30),h1080:new gr(1440,1080,23e5,30),h1440:new gr(1920,1440,38e5,30)},uT={h360fps3:new gr(640,360,2e5,3,"medium"),h360fps15:new gr(640,360,4e5,15,"medium"),h720fps5:new gr(1280,720,8e5,5,"medium"),h720fps15:new gr(1280,720,15e5,15,"medium"),h720fps30:new gr(1280,720,2e6,30,"medium"),h1080fps15:new gr(1920,1080,25e5,15,"medium"),h1080fps30:new gr(1920,1080,5e6,30,"medium"),original:new gr(0,0,7e6,30,"medium")},aV="|",aO="https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension";function oV(t){const e=t.split(aV);return e.length>1?[e[0],t.substr(e[0].length+1)]:[t,""]}function io(t){return Q(this,void 0,void 0,function*(){return new Promise(e=>Qi.setTimeout(e,t))})}function cT(){return"addTransceiver"in RTCPeerConnection.prototype}function dT(){return"addTrack"in RTCPeerConnection.prototype}function sV(){if(!("getCapabilities"in RTCRtpSender)||yc())return!1;const t=RTCRtpSender.getCapabilities("video");let e=!1;if(t){for(const n of t.codecs)if(n.mimeType==="video/AV1"){e=!0;break}}return e}function lV(){if(!("getCapabilities"in RTCRtpSender)||Bh())return!1;if(yc()){const n=ws();if(n!=null&&n.version&&bc(n.version,"16")<0)return!1}const t=RTCRtpSender.getCapabilities("video");let e=!1;if(t){for(const n of t.codecs)if(n.mimeType==="video/VP9"){e=!0;break}}return e}function Dg(t){return t==="av1"||t==="vp9"}function fT(t){return document?(t||(t=document.createElement("audio")),"setSinkId"in t):!1}function uV(){return typeof RTCPeerConnection>"u"?!1:cT()||dT()}function Bh(){var t;return((t=ws())===null||t===void 0?void 0:t.name)==="Firefox"}function yc(){var t;return((t=ws())===null||t===void 0?void 0:t.name)==="Safari"}function cV(){const t=ws();return(t==null?void 0:t.name)==="Safari"&&t.version.startsWith("17.")}function oO(){var t,e;return ao()?(e=(t=navigator.userAgentData)===null||t===void 0?void 0:t.mobile)!==null&&e!==void 0?e:/Tablet|iPad|Mobile|Android|BlackBerry/.test(navigator.userAgent):!1}function dV(){const t=ws(),e="17.2";if(t)return t.name!=="Safari"&&t.os!=="iOS"||t.os==="iOS"&&t.osVersion&&bc(e,t.osVersion)>=0?!0:t.name==="Safari"&&bc(e,t.version)>=0}function ao(){return typeof document<"u"}function fl(){return navigator.product=="ReactNative"}function hT(t){return t.hostname.endsWith(".livekit.cloud")||t.hostname.endsWith(".livekit.run")}function sO(){if(global&&global.LiveKitReactNativeGlobal)return global.LiveKitReactNativeGlobal}function lO(){if(!fl())return;let t=sO();if(t)return t.platform}function uO(){if(ao())return window.devicePixelRatio;if(fl()){let t=sO();if(t)return t.devicePixelRatio}return 1}function bc(t,e){const n=t.split("."),r=e.split("."),a=Math.min(n.length,r.length);for(let s=0;s<a;++s){const l=parseInt(n[s],10),c=parseInt(r[s],10);if(l>c)return 1;if(l<c)return-1;if(s===a-1&&l===c)return 0}return t===""&&e!==""?-1:e===""?1:n.length==r.length?0:n.length<r.length?-1:1}function fV(t){for(const e of t)e.target.handleResize(e)}function hV(t){for(const e of t)e.target.handleVisibilityChanged(e)}let pT=null;const cO=()=>(pT||(pT=new ResizeObserver(fV)),pT);let mT=null;const dO=()=>(mT||(mT=new IntersectionObserver(hV,{root:null,rootMargin:"0px"})),mT);function pV(){var t;const e=new i8({sdk:KD.JS,protocol:eV,version:J8});return fl()&&(e.os=(t=lO())!==null&&t!==void 0?t:""),e}function fO(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:16,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:16,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;const a=document.createElement("canvas");a.width=t,a.height=e;const s=a.getContext("2d");s==null||s.fillRect(0,0,a.width,a.height),r&&s&&(s.beginPath(),s.arc(t/2,e/2,50,0,Math.PI*2,!0),s.closePath(),s.fillStyle="grey",s.fill());const l=a.captureStream(),[c]=l.getTracks();if(!c)throw Error("Could not get empty media stream video track");return c.enabled=n,c}let Ag;function gT(){if(!Ag){const t=new AudioContext,e=t.createOscillator(),n=t.createGain();n.gain.setValueAtTime(0,0);const r=t.createMediaStreamDestination();if(e.connect(n),n.connect(r),e.start(),[Ag]=r.stream.getAudioTracks(),!Ag)throw Error("Could not get empty media stream audio track");Ag.enabled=!1}return Ag.clone()}class hO{constructor(e,n){this.onFinally=n,this.promise=new Promise((r,a)=>Q(this,void 0,void 0,function*(){this.resolve=r,this.reject=a,e&&(yield e(r,a))})).finally(()=>{var r;return(r=this.onFinally)===null||r===void 0?void 0:r.call(this)})}}function mV(t){return rV.includes(t)}function Sc(t){if(typeof t=="string"||typeof t=="number")return t;if(Array.isArray(t))return t[0];if(t.exact)return Array.isArray(t.exact)?t.exact[0]:t.exact;if(t.ideal)return Array.isArray(t.ideal)?t.ideal[0]:t.ideal;throw Error("could not unwrap constraint")}function gV(t){return t.startsWith("http")?t.replace(/^(http)/,"ws"):t}function vT(t){return t.startsWith("ws")?t.replace(/^(ws)/,"http"):t}function vV(t,e){return t.segments.map(n=>{let{id:r,text:a,language:s,startTime:l,endTime:c,final:h}=n;var p;const v=(p=e.get(r))!==null&&p!==void 0?p:Date.now(),b=Date.now();return h?e.delete(r):e.set(r,v),{id:r,text:a,startTime:Number.parseInt(l.toString()),endTime:Number.parseInt(c.toString()),final:h,language:s,firstReceivedTime:v,lastReceivedTime:b}})}function yV(t){const{id:e,timestamp:n,message:r,editTimestamp:a}=t;return{id:e,timestamp:Number.parseInt(n.toString()),editTimestamp:a?Number.parseInt(a.toString()):void 0,message:r}}function pO(t){switch(t.reason){case Un.LeaveRequest:return t.context;case Un.Cancelled:return ks.CLIENT_INITIATED;case Un.NotAllowed:return ks.USER_REJECTED;case Un.ServerUnreachable:return ks.JOIN_FAILURE;default:return ks.UNKNOWN_REASON}}function ab(t){return t!==void 0?Number(t):void 0}function Zd(t){return t!==void 0?BigInt(t):void 0}function Hh(t){return!!t&&!(t instanceof MediaStreamTrack)&&t.isLocal}function cu(t){return!!t&&t.kind==De.Kind.Audio}function $h(t){return!!t&&t.kind==De.Kind.Video}function Cc(t){return Hh(t)&&$h(t)}function Qd(t){return Hh(t)&&cu(t)}function yT(t){return!!t&&!t.isLocal}function bV(t){return!!t&&!t.isLocal}function bT(t){return yT(t)&&$h(t)}function SV(t){return t.isLocal}function CV(t,e){const n=[];let r=new TextEncoder().encode(t);for(;r.length>e;){let a=e;for(;a>0;){const s=r[a];if(s!==void 0&&(s&192)!==128)break;a--}n.push(r.slice(0,a)),r=r.slice(a)}return r.length>0&&n.push(r),n}function mO(t,e,n){var r,a,s,l;const{optionsWithoutProcessor:c,audioProcessor:h,videoProcessor:p}=bO(t??{}),v=e==null?void 0:e.processor,b=n==null?void 0:n.processor,k=c??{};return k.audio===!0&&(k.audio={}),k.video===!0&&(k.video={}),k.audio&&(ST(k.audio,e),(r=(s=k.audio).deviceId)!==null&&r!==void 0||(s.deviceId={ideal:"default"}),(h||v)&&(k.audio.processor=h??v)),k.video&&(ST(k.video,n),(a=(l=k.video).deviceId)!==null&&a!==void 0||(l.deviceId={ideal:"default"}),(p||b)&&(k.video.processor=p??b)),k}function ST(t,e){return Object.keys(e).forEach(n=>{t[n]===void 0&&(t[n]=e[n])}),t}function CT(t){var e,n,r,a;const s={};if(t.video)if(typeof t.video=="object"){const l={},c=l,h=t.video;Object.keys(h).forEach(p=>{switch(p){case"resolution":ST(c,h.resolution);break;default:c[p]=h[p]}}),s.video=l,(e=(r=s.video).deviceId)!==null&&e!==void 0||(r.deviceId={ideal:"default"})}else s.video=t.video?{deviceId:{ideal:"default"}}:!1;else s.video=!1;return t.audio?typeof t.audio=="object"?(s.audio=t.audio,(n=(a=s.audio).deviceId)!==null&&n!==void 0||(a.deviceId={ideal:"default"})):s.audio={deviceId:{ideal:"default"}}:s.audio=!1,s}function gO(t){return Q(this,arguments,void 0,function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:200;return function*(){const r=vO();if(r){const a=r.createAnalyser();a.fftSize=2048;const s=a.frequencyBinCount,l=new Uint8Array(s);r.createMediaStreamSource(new MediaStream([e.mediaStreamTrack])).connect(a),yield io(n),a.getByteTimeDomainData(l);const h=l.some(p=>p!==128&&p!==0);return r.close(),!h}return!1}()})}function vO(){var t;const e=typeof window<"u"&&(window.AudioContext||window.webkitAudioContext);if(e){const n=new e({latencyHint:"interactive"});if(n.state==="suspended"&&typeof window<"u"&&(!((t=window.document)===null||t===void 0)&&t.body)){const r=()=>Q(this,void 0,void 0,function*(){var a;try{n.state==="suspended"&&(yield n.resume())}catch(s){console.warn("Error trying to auto-resume audio context",s)}(a=window.document.body)===null||a===void 0||a.removeEventListener("click",r)});window.document.body.addEventListener("click",r)}return n}}function kV(t){return t==="audioinput"?De.Source.Microphone:t==="videoinput"?De.Source.Camera:De.Source.Unknown}function yO(t){return t===De.Source.Microphone?"audioinput":t===De.Source.Camera?"videoinput":void 0}function TV(t){var e,n;let r=(e=t.video)!==null&&e!==void 0?e:!0;return t.resolution&&t.resolution.width>0&&t.resolution.height>0&&(r=typeof r=="boolean"?{}:r,yc()?r=Object.assign(Object.assign({},r),{width:{max:t.resolution.width},height:{max:t.resolution.height},frameRate:t.resolution.frameRate}):r=Object.assign(Object.assign({},r),{width:{ideal:t.resolution.width},height:{ideal:t.resolution.height},frameRate:t.resolution.frameRate})),{audio:(n=t.audio)!==null&&n!==void 0?n:!1,video:r,controller:t.controller,selfBrowserSurface:t.selfBrowserSurface,surfaceSwitching:t.surfaceSwitching,systemAudio:t.systemAudio,preferCurrentTab:t.preferCurrentTab}}function ob(t){return t.split("/")[1].toLowerCase()}function xV(t){const e=[];return t.forEach(n=>{n.track!==void 0&&e.push(new H1({cid:n.track.mediaStreamID,track:n.trackInfo}))}),e}function ar(t){return"mediaStreamTrack"in t?{trackID:t.sid,source:t.source,muted:t.isMuted,enabled:t.mediaStreamTrack.enabled,kind:t.kind,streamID:t.mediaStreamID,streamTrackID:t.mediaStreamTrack.id}:{trackID:t.trackSid,enabled:t.isEnabled,muted:t.isMuted,trackInfo:Object.assign({mimeType:t.mimeType,name:t.trackName,encrypted:t.isEncrypted,kind:t.kind,source:t.source},t.track?ar(t.track):{})}}function wV(){return typeof RTCRtpReceiver<"u"&&"getSynchronizationSources"in RTCRtpReceiver}function _V(t,e){var n;t===void 0&&(t={}),e===void 0&&(e={});const r=[...Object.keys(e),...Object.keys(t)],a={};for(const s of r)t[s]!==e[s]&&(a[s]=(n=e[s])!==null&&n!==void 0?n:"");return a}function bO(t){const e=Object.assign({},t);let n,r;return typeof e.audio=="object"&&e.audio.processor&&(n=e.audio.processor,e.audio=Object.assign(Object.assign({},e.audio),{processor:void 0})),typeof e.video=="object"&&e.video.processor&&(r=e.video.processor,e.video=Object.assign(Object.assign({},e.video),{processor:void 0})),{audioProcessor:n,videoProcessor:r,optionsWithoutProcessor:K8(e)}}function EV(t){switch(t){case gi.CAMERA:return De.Source.Camera;case gi.MICROPHONE:return De.Source.Microphone;case gi.SCREEN_SHARE:return De.Source.ScreenShare;case gi.SCREEN_SHARE_AUDIO:return De.Source.ScreenShareAudio;default:return De.Source.Unknown}}class RV extends dl.EventEmitter{constructor(e){super(),this.onWorkerMessage=n=>{var r,a;const{kind:s,data:l}=n.data;switch(s){case"error":Nn.error(l.error.message),this.emit(gc.EncryptionError,l.error);break;case"initAck":l.enabled&&this.keyProvider.getKeys().forEach(c=>{this.postKey(c)});break;case"enable":if(l.enabled&&this.keyProvider.getKeys().forEach(c=>{this.postKey(c)}),this.encryptionEnabled!==l.enabled&&l.participantIdentity===((r=this.room)===null||r===void 0?void 0:r.localParticipant.identity))this.emit(gc.ParticipantEncryptionStatusChanged,l.enabled,this.room.localParticipant),this.encryptionEnabled=l.enabled;else if(l.participantIdentity){const c=(a=this.room)===null||a===void 0?void 0:a.getParticipantByIdentity(l.participantIdentity);if(!c)throw TypeError("couldn't set encryption status, participant not found".concat(l.participantIdentity));this.emit(gc.ParticipantEncryptionStatusChanged,l.enabled,c)}break;case"ratchetKey":this.keyProvider.emit(mc.KeyRatcheted,l.material,l.keyIndex);break}},this.onWorkerError=n=>{Nn.error("e2ee worker encountered an error:",{error:n.error}),this.emit(gc.EncryptionError,n.error)},this.keyProvider=e.keyProvider,this.worker=e.worker,this.encryptionEnabled=!1}setup(e){if(!W8())throw new nT("tried to setup end-to-end encryption on an unsupported browser");if(Nn.info("setting up e2ee"),e!==this.room){this.room=e,this.setupEventListeners(e,this.keyProvider);const n={kind:"init",data:{keyProviderOptions:this.keyProvider.getOptions(),loglevel:A8.getLevel()}};this.worker&&(Nn.info("initializing worker",{worker:this.worker}),this.worker.onmessage=this.onWorkerMessage,this.worker.onerror=this.onWorkerError,this.worker.postMessage(n))}}setParticipantCryptorEnabled(e,n){Nn.debug("set e2ee to ".concat(e," for participant ").concat(n)),this.postEnable(e,n)}setSifTrailer(e){!e||e.length===0?Nn.warn("ignoring server sent trailer as it's empty"):this.postSifTrailer(e)}setupEngine(e){e.on(tt.RTPVideoMapUpdate,n=>{this.postRTPMap(n)})}setupEventListeners(e,n){e.on(Ee.TrackPublished,(r,a)=>this.setParticipantCryptorEnabled(r.trackInfo.encryption!==Po.NONE,a.identity)),e.on(Ee.ConnectionStateChanged,r=>{r===Fn.Connected&&e.remoteParticipants.forEach(a=>{a.trackPublications.forEach(s=>{this.setParticipantCryptorEnabled(s.trackInfo.encryption!==Po.NONE,a.identity)})})}).on(Ee.TrackUnsubscribed,(r,a,s)=>{var l;const c={kind:"removeTransform",data:{participantIdentity:s.identity,trackId:r.mediaStreamID}};(l=this.worker)===null||l===void 0||l.postMessage(c)}).on(Ee.TrackSubscribed,(r,a,s)=>{this.setupE2EEReceiver(r,s.identity,a.trackInfo)}).on(Ee.SignalConnected,()=>{if(!this.room)throw new TypeError("expected room to be present on signal connect");n.getKeys().forEach(r=>{this.postKey(r)}),this.setParticipantCryptorEnabled(this.room.localParticipant.isE2EEEnabled,this.room.localParticipant.identity)}),e.localParticipant.on(Ie.LocalTrackPublished,r=>Q(this,void 0,void 0,function*(){this.setupE2EESender(r.track,r.track.sender)})),n.on(mc.SetKey,r=>this.postKey(r)).on(mc.RatchetRequest,(r,a)=>this.postRatchetRequest(r,a))}postRatchetRequest(e,n){if(!this.worker)throw Error("could not ratchet key, worker is missing");const r={kind:"ratchetRequest",data:{participantIdentity:e,keyIndex:n}};this.worker.postMessage(r)}postKey(e){let{key:n,participantIdentity:r,keyIndex:a}=e;var s;if(!this.worker)throw Error("could not set key, worker is missing");const l={kind:"setKey",data:{participantIdentity:r,isPublisher:r===((s=this.room)===null||s===void 0?void 0:s.localParticipant.identity),key:n,keyIndex:a}};this.worker.postMessage(l)}postEnable(e,n){if(this.worker){const r={kind:"enable",data:{enabled:e,participantIdentity:n}};this.worker.postMessage(r)}else throw new ReferenceError("failed to enable e2ee, worker is not ready")}postRTPMap(e){var n;if(!this.worker)throw TypeError("could not post rtp map, worker is missing");if(!(!((n=this.room)===null||n===void 0)&&n.localParticipant.identity))throw TypeError("could not post rtp map, local participant identity is missing");const r={kind:"setRTPMap",data:{map:e,participantIdentity:this.room.localParticipant.identity}};this.worker.postMessage(r)}postSifTrailer(e){if(!this.worker)throw Error("could not post SIF trailer, worker is missing");const n={kind:"setSifTrailer",data:{trailer:e}};this.worker.postMessage(n)}setupE2EEReceiver(e,n,r){if(e.receiver){if(!(r!=null&&r.mimeType)||r.mimeType==="")throw new TypeError("MimeType missing from trackInfo, cannot set up E2EE cryptor");this.handleReceiver(e.receiver,e.mediaStreamID,n,e.kind==="video"?ob(r.mimeType):void 0)}}setupE2EESender(e,n){if(!Hh(e)||!n){n||Nn.warn("early return because sender is not ready");return}this.handleSender(n,e.mediaStreamID,void 0)}handleReceiver(e,n,r,a){return Q(this,void 0,void 0,function*(){if(this.worker){if(tT()){const s={kind:"decode",participantIdentity:r,trackId:n,codec:a};e.transform=new RTCRtpScriptTransform(this.worker,s)}else{if(nb in e&&a){const h={kind:"updateCodec",data:{trackId:n,codec:a,participantIdentity:r}};this.worker.postMessage(h);return}let s=e.writableStream,l=e.readableStream;if(!s||!l){const h=e.createEncodedStreams();e.writableStream=h.writable,s=h.writable,e.readableStream=h.readable,l=h.readable}const c={kind:"decode",data:{readableStream:l,writableStream:s,trackId:n,codec:a,participantIdentity:r}};this.worker.postMessage(c,[l,s])}e[nb]=!0}})}handleSender(e,n,r){var a;if(!(nb in e||!this.worker)){if(!(!((a=this.room)===null||a===void 0)&&a.localParticipant.identity)||this.room.localParticipant.identity==="")throw TypeError("local identity needs to be known in order to set up encrypted sender");if(tT()){Nn.info("initialize script transform");const s={kind:"encode",participantIdentity:this.room.localParticipant.identity,trackId:n,codec:r};e.transform=new RTCRtpScriptTransform(this.worker,s)}else{Nn.info("initialize encoded streams");const s=e.createEncodedStreams(),l={kind:"encode",data:{readableStream:s.readable,writableStream:s.writable,codec:r,trackId:n,participantIdentity:this.room.localParticipant.identity}};this.worker.postMessage(l,[s.readable,s.writable])}e[nb]=!0}}}const kT="default";class zi{constructor(){this._previousDevices=[]}static getInstance(){return this.instance===void 0&&(this.instance=new zi),this.instance}get previousDevices(){return this._previousDevices}getDevices(e){return Q(this,arguments,void 0,function(n){var r=this;let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){var s;if(((s=zi.userMediaPromiseMap)===null||s===void 0?void 0:s.size)>0){Nn.debug("awaiting getUserMedia promise");try{n?yield zi.userMediaPromiseMap.get(n):yield Promise.all(zi.userMediaPromiseMap.values())}catch{Nn.warn("error waiting for media permissons")}}let l=yield navigator.mediaDevices.enumerateDevices();if(a&&!(yc()&&r.hasDeviceInUse(n))&&(l.filter(h=>h.kind===n).length===0||l.some(h=>{const p=h.label==="",v=n?h.kind===n:!0;return p&&v}))){const h={video:n!=="audioinput"&&n!=="audiooutput",audio:n!=="videoinput"&&{deviceId:{ideal:"default"}}},p=yield navigator.mediaDevices.getUserMedia(h);l=yield navigator.mediaDevices.enumerateDevices(),p.getTracks().forEach(v=>{v.stop()})}return r._previousDevices=l,n&&(l=l.filter(c=>c.kind===n)),l}()})}normalizeDeviceId(e,n,r){return Q(this,void 0,void 0,function*(){if(n!==kT)return n;const a=yield this.getDevices(e),s=a.find(c=>c.deviceId===kT);if(!s){Nn.warn("could not reliably determine default device");return}const l=a.find(c=>c.deviceId!==kT&&c.groupId===(r??s.groupId));if(!l){Nn.warn("could not reliably determine default device");return}return l==null?void 0:l.deviceId})}hasDeviceInUse(e){return e?zi.userMediaPromiseMap.has(e):zi.userMediaPromiseMap.size>0}}zi.mediaDeviceKinds=["audioinput","audiooutput","videoinput"],zi.userMediaPromiseMap=new Map;var Og;(function(t){t[t.WAITING=0]="WAITING",t[t.RUNNING=1]="RUNNING",t[t.COMPLETED=2]="COMPLETED"})(Og||(Og={}));class PV{constructor(){this.pendingTasks=new Map,this.taskMutex=new to,this.nextTaskIndex=0}run(e){return Q(this,void 0,void 0,function*(){const n={id:this.nextTaskIndex++,enqueuedAt:Date.now(),status:Og.WAITING};this.pendingTasks.set(n.id,n);const r=yield this.taskMutex.lock();try{return n.executedAt=Date.now(),n.status=Og.RUNNING,yield e()}finally{n.status=Og.COMPLETED,this.pendingTasks.delete(n.id),r()}})}flush(){return Q(this,void 0,void 0,function*(){return this.run(()=>Q(this,void 0,void 0,function*(){}))})}snapshot(){return Array.from(this.pendingTasks.values())}}function DV(t,e){const n=new URL(gV(t));return e.forEach((r,a)=>{n.searchParams.set(a,r)}),SO(n,"rtc")}function AV(t){const e=new URL(vT(t));return SO(e,"validate")}function OV(t){return t.endsWith("/")?t:"".concat(t,"/")}function SO(t,e){return t.pathname="".concat(OV(t.pathname)).concat(e),t.toString()}const MV=["syncState","trickle","offer","answer","simulate","leave"];function LV(t){const e=MV.indexOf(t.case)>=0;return Nn.trace("request allowed to bypass queue:",{canPass:e,req:t}),e}var Or;(function(t){t[t.CONNECTING=0]="CONNECTING",t[t.CONNECTED=1]="CONNECTED",t[t.RECONNECTING=2]="RECONNECTING",t[t.DISCONNECTING=3]="DISCONNECTING",t[t.DISCONNECTED=4]="DISCONNECTED"})(Or||(Or={}));class TT{get currentState(){return this.state}get isDisconnected(){return this.state===Or.DISCONNECTING||this.state===Or.DISCONNECTED}get isEstablishingConnection(){return this.state===Or.CONNECTING||this.state===Or.RECONNECTING}getNextRequestId(){return this._requestId+=1,this._requestId}constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var r;this.rtt=0,this.state=Or.DISCONNECTED,this.log=Nn,this._requestId=0,this.resetCallbacks=()=>{this.onAnswer=void 0,this.onLeave=void 0,this.onLocalTrackPublished=void 0,this.onLocalTrackUnpublished=void 0,this.onNegotiateRequested=void 0,this.onOffer=void 0,this.onRemoteMuteChanged=void 0,this.onSubscribedQualityUpdate=void 0,this.onTokenRefresh=void 0,this.onTrickle=void 0,this.onClose=void 0},this.log=lu((r=n.loggerName)!==null&&r!==void 0?r:xs.Signal),this.loggerContextCb=n.loggerContextCb,this.useJSON=e,this.requestQueue=new PV,this.queuedRequests=[],this.closingLock=new to,this.connectionLock=new to,this.state=Or.DISCONNECTED}get logContext(){var e,n;return(n=(e=this.loggerContextCb)===null||e===void 0?void 0:e.call(this))!==null&&n!==void 0?n:{}}join(e,n,r,a){return Q(this,void 0,void 0,function*(){return this.state=Or.CONNECTING,this.options=r,yield this.connect(e,n,r,a)})}reconnect(e,n,r,a){return Q(this,void 0,void 0,function*(){if(!this.options){this.log.warn("attempted to reconnect without signal options being set, ignoring",this.logContext);return}return this.state=Or.RECONNECTING,this.clearPingInterval(),yield this.connect(e,n,Object.assign(Object.assign({},this.options),{reconnect:!0,sid:r,reconnectReason:a}))})}connect(e,n,r,a){this.connectOptions=r;const s=pV(),l=NV(n,s,r),c=DV(e,l),h=AV(c);return new Promise((p,v)=>Q(this,void 0,void 0,function*(){const b=yield this.connectionLock.lock();try{const k=()=>Q(this,void 0,void 0,function*(){this.close(),clearTimeout(T),v(new br("room connection has been cancelled (signal)",Un.Cancelled))}),T=setTimeout(()=>{this.close(),v(new br("room connection has timed out (signal)",Un.ServerUnreachable))},r.websocketTimeout);a!=null&&a.aborted&&k(),a==null||a.addEventListener("abort",k);const E=new URL(c);E.searchParams.has("access_token")&&E.searchParams.set("access_token","<redacted>"),this.log.debug("connecting to ".concat(E),Object.assign({reconnect:r.reconnect,reconnectReason:r.reconnectReason},this.logContext)),this.ws&&(yield this.close(!1)),this.ws=new WebSocket(c),this.ws.binaryType="arraybuffer",this.ws.onopen=()=>{clearTimeout(T)},this.ws.onerror=R=>Q(this,void 0,void 0,function*(){if(this.state!==Or.CONNECTED){this.state=Or.DISCONNECTED,clearTimeout(T);try{const M=yield fetch(h);if(M.status.toFixed(0).startsWith("4")){const A=yield M.text();v(new br(A,Un.NotAllowed,M.status))}else v(new br("Encountered unknown websocket error during connection: ".concat(R.toString()),Un.InternalError,M.status))}catch(M){v(new br(M instanceof Error?M.message:"server was not reachable",Un.ServerUnreachable))}return}this.handleWSError(R)}),this.ws.onmessage=R=>Q(this,void 0,void 0,function*(){var M,A,U;let V;if(typeof R.data=="string"){const j=JSON.parse(R.data);V=tA.fromJson(j,{ignoreUnknownFields:!0})}else if(R.data instanceof ArrayBuffer)V=tA.fromBinary(new Uint8Array(R.data));else{this.log.error("could not decode websocket message: ".concat(typeof R.data),this.logContext);return}if(this.state!==Or.CONNECTED){let j=!1;if(((M=V.message)===null||M===void 0?void 0:M.case)==="join"?(this.state=Or.CONNECTED,a==null||a.removeEventListener("abort",k),this.pingTimeoutDuration=V.message.value.pingTimeout,this.pingIntervalDuration=V.message.value.pingInterval,this.pingTimeoutDuration&&this.pingTimeoutDuration>0&&(this.log.debug("ping config",Object.assign(Object.assign({},this.logContext),{timeout:this.pingTimeoutDuration,interval:this.pingIntervalDuration})),this.startPingInterval()),p(V.message.value)):this.state===Or.RECONNECTING&&V.message.case!=="leave"?(this.state=Or.CONNECTED,a==null||a.removeEventListener("abort",k),this.startPingInterval(),((A=V.message)===null||A===void 0?void 0:A.case)==="reconnect"?p(V.message.value):(this.log.debug("declaring signal reconnected without reconnect response received",this.logContext),p(void 0),j=!0)):this.isEstablishingConnection&&V.message.case==="leave"?v(new br("Received leave request while trying to (re)connect",Un.LeaveRequest,void 0,V.message.value.reason)):r.reconnect||v(new br("did not receive join response, got ".concat((U=V.message)===null||U===void 0?void 0:U.case," instead"),Un.InternalError)),!j)return}this.signalLatency&&(yield io(this.signalLatency)),this.handleSignalResponse(V)}),this.ws.onclose=R=>{this.isEstablishingConnection&&v(new br("Websocket got closed during a (re)connection attempt",Un.InternalError)),this.log.warn("websocket closed",Object.assign(Object.assign({},this.logContext),{reason:R.reason,code:R.code,wasClean:R.wasClean,state:this.state})),this.handleOnClose(R.reason)}}finally{b()}}))}close(){return Q(this,arguments,void 0,function(){var e=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){const r=yield e.closingLock.lock();try{if(e.clearPingInterval(),n&&(e.state=Or.DISCONNECTING),e.ws){e.ws.onmessage=null,e.ws.onopen=null,e.ws.onclose=null;const a=new Promise(s=>{e.ws?e.ws.onclose=()=>{s()}:s()});e.ws.readyState<e.ws.CLOSING&&(e.ws.close(),yield Promise.race([a,io(250)])),e.ws=void 0}}finally{n&&(e.state=Or.DISCONNECTED),r()}}()})}sendOffer(e){this.log.debug("sending offer",Object.assign(Object.assign({},this.logContext),{offerSdp:e.sdp})),this.sendRequest({case:"offer",value:sb(e)})}sendAnswer(e){return this.log.debug("sending answer",Object.assign(Object.assign({},this.logContext),{answerSdp:e.sdp})),this.sendRequest({case:"answer",value:sb(e)})}sendIceCandidate(e,n){return this.log.debug("sending ice candidate",Object.assign(Object.assign({},this.logContext),{candidate:e})),this.sendRequest({case:"trickle",value:new z1({candidateInit:JSON.stringify(e),target:n})})}sendMuteTrack(e,n){return this.sendRequest({case:"mute",value:new B1({sid:e,muted:n})})}sendAddTrack(e){return this.sendRequest({case:"addTrack",value:e})}sendUpdateLocalMetadata(e,n){return Q(this,arguments,void 0,function(r,a){var s=this;let l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){const c=s.getNextRequestId();return yield s.sendRequest({case:"updateMetadata",value:new aA({requestId:c,metadata:r,name:a,attributes:l})}),c}()})}sendUpdateTrackSettings(e){this.sendRequest({case:"trackSetting",value:e})}sendUpdateSubscription(e){return this.sendRequest({case:"subscription",value:e})}sendSyncState(e){return this.sendRequest({case:"syncState",value:e})}sendUpdateVideoLayers(e,n){return this.sendRequest({case:"updateLayers",value:new iA({trackSid:e,layers:n})})}sendUpdateSubscriptionPermissions(e,n){return this.sendRequest({case:"subscriptionPermission",value:new lA({allParticipants:e,trackPermissions:n})})}sendSimulateScenario(e){return this.sendRequest({case:"simulate",value:e})}sendPing(){return Promise.all([this.sendRequest({case:"ping",value:Ur.parse(Date.now())}),this.sendRequest({case:"pingReq",value:new dA({timestamp:Ur.parse(Date.now()),rtt:Ur.parse(this.rtt)})})])}sendUpdateLocalAudioTrack(e,n){return this.sendRequest({case:"updateAudioTrack",value:new rA({trackSid:e,features:n})})}sendLeave(){return this.sendRequest({case:"leave",value:new W0({reason:ks.CLIENT_INITIATED,action:Fh.DISCONNECT})})}sendRequest(e){return Q(this,arguments,void 0,function(n){var r=this;let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return function*(){if(!a&&!LV(n)&&r.state===Or.RECONNECTING){r.queuedRequests.push(()=>Q(r,void 0,void 0,function*(){yield this.sendRequest(n,!0)}));return}if(a||(yield r.requestQueue.flush()),r.signalLatency&&(yield io(r.signalLatency)),!r.ws||r.ws.readyState!==r.ws.OPEN){r.log.error("cannot send signal request before connected, type: ".concat(n==null?void 0:n.case),r.logContext);return}const l=new s8({message:n});try{r.useJSON?r.ws.send(l.toJsonString()):r.ws.send(l.toBinary())}catch(c){r.log.error("error sending signal message",Object.assign(Object.assign({},r.logContext),{error:c}))}}()})}handleSignalResponse(e){var n,r;const a=e.message;if(a==null){this.log.debug("received unsupported message",this.logContext);return}let s=!1;if(a.case==="answer"){const l=CO(a.value);this.onAnswer&&this.onAnswer(l)}else if(a.case==="offer"){const l=CO(a.value);this.onOffer&&this.onOffer(l)}else if(a.case==="trickle"){const l=JSON.parse(a.value.candidateInit);this.onTrickle&&this.onTrickle(l,a.value.target)}else a.case==="update"?this.onParticipantUpdate&&this.onParticipantUpdate((n=a.value.participants)!==null&&n!==void 0?n:[]):a.case==="trackPublished"?this.onLocalTrackPublished&&this.onLocalTrackPublished(a.value):a.case==="speakersChanged"?this.onSpeakersChanged&&this.onSpeakersChanged((r=a.value.speakers)!==null&&r!==void 0?r:[]):a.case==="leave"?this.onLeave&&this.onLeave(a.value):a.case==="mute"?this.onRemoteMuteChanged&&this.onRemoteMuteChanged(a.value.sid,a.value.muted):a.case==="roomUpdate"?this.onRoomUpdate&&a.value.room&&this.onRoomUpdate(a.value.room):a.case==="connectionQuality"?this.onConnectionQuality&&this.onConnectionQuality(a.value):a.case==="streamStateUpdate"?this.onStreamStateUpdate&&this.onStreamStateUpdate(a.value):a.case==="subscribedQualityUpdate"?this.onSubscribedQualityUpdate&&this.onSubscribedQualityUpdate(a.value):a.case==="subscriptionPermissionUpdate"?this.onSubscriptionPermissionUpdate&&this.onSubscriptionPermissionUpdate(a.value):a.case==="refreshToken"?this.onTokenRefresh&&this.onTokenRefresh(a.value):a.case==="trackUnpublished"?this.onLocalTrackUnpublished&&this.onLocalTrackUnpublished(a.value):a.case==="subscriptionResponse"?this.onSubscriptionError&&this.onSubscriptionError(a.value):a.case==="pong"||(a.case==="pongResp"?(this.rtt=Date.now()-Number.parseInt(a.value.lastPingTimestamp.toString()),this.resetPingTimeout(),s=!0):a.case==="requestResponse"?this.onRequestResponse&&this.onRequestResponse(a.value):a.case==="trackSubscribed"?this.onLocalTrackSubscribed&&this.onLocalTrackSubscribed(a.value.trackSid):this.log.debug("unsupported message",Object.assign(Object.assign({},this.logContext),{msgCase:a.case})));s||this.resetPingTimeout()}setReconnected(){for(;this.queuedRequests.length>0;){const e=this.queuedRequests.shift();e&&this.requestQueue.run(e)}}handleOnClose(e){return Q(this,void 0,void 0,function*(){if(this.state===Or.DISCONNECTED)return;const n=this.onClose;yield this.close(),this.log.debug("websocket connection closed: ".concat(e),Object.assign(Object.assign({},this.logContext),{reason:e})),n&&n(e)})}handleWSError(e){this.log.error("websocket error",Object.assign(Object.assign({},this.logContext),{error:e}))}resetPingTimeout(){if(this.clearPingTimeout(),!this.pingTimeoutDuration){this.log.warn("ping timeout duration not set",this.logContext);return}this.pingTimeout=Qi.setTimeout(()=>{this.log.warn("ping timeout triggered. last pong received at: ".concat(new Date(Date.now()-this.pingTimeoutDuration*1e3).toUTCString()),this.logContext),this.handleOnClose("ping timeout")},this.pingTimeoutDuration*1e3)}clearPingTimeout(){this.pingTimeout&&Qi.clearTimeout(this.pingTimeout)}startPingInterval(){if(this.clearPingInterval(),this.resetPingTimeout(),!this.pingIntervalDuration){this.log.warn("ping interval duration not set",this.logContext);return}this.log.debug("start ping interval",this.logContext),this.pingInterval=Qi.setInterval(()=>{this.sendPing()},this.pingIntervalDuration*1e3)}clearPingInterval(){this.log.debug("clearing ping interval",this.logContext),this.clearPingTimeout(),this.pingInterval&&Qi.clearInterval(this.pingInterval)}}function CO(t){const e={type:"offer",sdp:t.sdp};switch(t.type){case"answer":case"offer":case"pranswer":case"rollback":e.type=t.type;break}return e}function sb(t){return new Yd({sdp:t.sdp,type:t.type})}function NV(t,e,n){var r;const a=new URLSearchParams;return a.set("access_token",t),n.reconnect&&(a.set("reconnect","1"),n.sid&&a.set("sid",n.sid)),a.set("auto_subscribe",n.autoSubscribe?"1":"0"),a.set("sdk",fl()?"reactnative":"js"),a.set("version",e.version),a.set("protocol",e.protocol.toString()),e.deviceModel&&a.set("device_model",e.deviceModel),e.os&&a.set("os",e.os),e.osVersion&&a.set("os_version",e.osVersion),e.browser&&a.set("browser",e.browser),e.browserVersion&&a.set("browser_version",e.browserVersion),n.adaptiveStream&&a.set("adaptive_stream","1"),n.reconnectReason&&a.set("reconnect_reason",n.reconnectReason.toString()),!((r=navigator.connection)===null||r===void 0)&&r.type&&a.set("network",navigator.connection.type),a}var _s={},xT={},wT={exports:{}},kO;function _T(){if(kO)return wT.exports;kO=1;var t=wT.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return e.address!=null?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return e.subtype!=null?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return e.sessionConfig!=null?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var n="candidate:%s %d %s %d %s %d typ %s";return n+=e.raddr!=null?" raddr %s rport %d":"%v%v",n+=e.tcptype!=null?" tcptype %s":"%v",e.generation!=null&&(n+=" generation %d"),n+=e["network-id"]!=null?" network-id %d":"%v",n+=e["network-cost"]!=null?" network-cost %d":"%v",n}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var n="ssrc:%d";return e.attribute!=null&&(n+=" %s",e.value!=null&&(n+=":%s")),n}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return e.maxMessageSize!=null?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(e.clksrcExt!=null?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var n="mediaclk:";return n+=e.id!=null?"id=%s %s":"%v%s",n+=e.mediaClockValue!=null?"=%s":"",n+=e.rateNumerator!=null?" rate=%s":"",n+=e.rateDenominator!=null?"/%s":"",n}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};return Object.keys(t).forEach(function(e){var n=t[e];n.forEach(function(r){r.reg||(r.reg=/(.*)/),r.format||(r.format="%s")})}),wT.exports}var TO;function IV(){return TO||(TO=1,function(t){var e=function(c){return String(Number(c))===c?Number(c):c},n=function(c,h,p,v){if(v&&!p)h[v]=e(c[1]);else for(var b=0;b<p.length;b+=1)c[b+1]!=null&&(h[p[b]]=e(c[b+1]))},r=function(c,h,p){var v=c.name&&c.names;c.push&&!h[c.push]?h[c.push]=[]:v&&!h[c.name]&&(h[c.name]={});var b=c.push?{}:v?h[c.name]:h;n(p.match(c.reg),b,c.names,c.name),c.push&&h[c.push].push(b)},a=_T(),s=RegExp.prototype.test.bind(/^([a-z])=(.*)/);t.parse=function(c){var h={},p=[],v=h;return c.split(/(\r\n|\r|\n)/).filter(s).forEach(function(b){var k=b[0],T=b.slice(2);k==="m"&&(p.push({rtp:[],fmtp:[]}),v=p[p.length-1]);for(var E=0;E<(a[k]||[]).length;E+=1){var R=a[k][E];if(R.reg.test(T))return r(R,v,T)}}),h.media=p,h};var l=function(c,h){var p=h.split(/=(.+)/,2);return p.length===2?c[p[0]]=e(p[1]):p.length===1&&h.length>1&&(c[p[0]]=void 0),c};t.parseParams=function(c){return c.split(/;\s?/).reduce(l,{})},t.parseFmtpConfig=t.parseParams,t.parsePayloads=function(c){return c.toString().split(" ").map(Number)},t.parseRemoteCandidates=function(c){for(var h=[],p=c.split(" ").map(e),v=0;v<p.length;v+=3)h.push({component:p[v],ip:p[v+1],port:p[v+2]});return h},t.parseImageAttributes=function(c){return c.split(" ").map(function(h){return h.substring(1,h.length-1).split(",").reduce(l,{})})},t.parseSimulcastStreamList=function(c){return c.split(";").map(function(h){return h.split(",").map(function(p){var v,b=!1;return p[0]!=="~"?v=e(p):(v=e(p.substring(1,p.length)),b=!0),{scid:v,paused:b}})})}}(xT)),xT}var ET,xO;function UV(){if(xO)return ET;xO=1;var t=_T(),e=/%[sdv%]/g,n=function(l){var c=1,h=arguments,p=h.length;return l.replace(e,function(v){if(c>=p)return v;var b=h[c];switch(c+=1,v){case"%%":return"%";case"%s":return String(b);case"%d":return Number(b);case"%v":return""}})},r=function(l,c,h){var p=c.format instanceof Function?c.format(c.push?h:h[c.name]):c.format,v=[l+"="+p];if(c.names)for(var b=0;b<c.names.length;b+=1){var k=c.names[b];c.name?v.push(h[c.name][k]):v.push(h[c.names[b]])}else v.push(h[c.name]);return n.apply(null,v)},a=["v","o","s","i","u","e","p","c","b","t","r","z","a"],s=["i","c","b","a"];return ET=function(l,c){c=c||{},l.version==null&&(l.version=0),l.name==null&&(l.name=" "),l.media.forEach(function(b){b.payloads==null&&(b.payloads="")});var h=c.outerOrder||a,p=c.innerOrder||s,v=[];return h.forEach(function(b){t[b].forEach(function(k){k.name in l&&l[k.name]!=null?v.push(r(b,k,l)):k.push in l&&l[k.push]!=null&&l[k.push].forEach(function(T){v.push(r(b,k,T))})})}),l.media.forEach(function(b){v.push(r("m",t.m[0],b)),p.forEach(function(k){t[k].forEach(function(T){T.name in b&&b[T.name]!=null?v.push(r(k,T,b)):T.push in b&&b[T.push]!=null&&b[T.push].forEach(function(E){v.push(r(k,T,E))})})})}),v.join(`\r
|
|
277
277
|
`)+`\r
|
|
278
|
-
`},ET}var wO;function FV(){if(wO)return _s;wO=1;var t=IV(),e=UV(),n=_T();return _s.grammar=n,_s.write=e,_s.parse=t.parse,_s.parseParams=t.parseParams,_s.parseFmtpConfig=t.parseFmtpConfig,_s.parsePayloads=t.parsePayloads,_s.parseRemoteCandidates=t.parseRemoteCandidates,_s.parseImageAttributes=t.parseImageAttributes,_s.parseSimulcastStreamList=t.parseSimulcastStreamList,_s}var kc=FV();function RT(t,e,n){var r,a,s;e===void 0&&(e=50),n===void 0&&(n={});var l=(r=n.isImmediate)!=null&&r,c=(a=n.callback)!=null&&a,h=n.maxWait,p=Date.now(),v=[];function b(){if(h!==void 0){var T=Date.now()-p;if(T+e>=h)return h-T}return e}var k=function(){var T=[].slice.call(arguments),E=this;return new Promise(function(R,M){var A=l&&s===void 0;if(s!==void 0&&clearTimeout(s),s=setTimeout(function(){if(s=void 0,p=Date.now(),!l){var V=t.apply(E,T);c&&c(V),v.forEach(function(j){return(0,j.resolve)(V)}),v=[]}},b()),A){var U=t.apply(E,T);return c&&c(U),R(U)}v.push({resolve:R,reject:M})})};return k.cancel=function(T){s!==void 0&&clearTimeout(s),v.forEach(function(E){return(0,E.reject)(T)}),v=[]},k}const jV=.7,VV=20,qh={NegotiationStarted:"negotiationStarted",NegotiationComplete:"negotiationComplete",RTPVideoPayloadTypes:"rtpVideoPayloadTypes"};class _O extends dl.EventEmitter{get pc(){return this._pc||(this._pc=this.createPC()),this._pc}constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var r;super(),this.log=Nn,this.ddExtID=0,this.pendingCandidates=[],this.restartingIce=!1,this.renegotiate=!1,this.trackBitrates=[],this.remoteStereoMids=[],this.remoteNackMids=[],this.negotiate=RT(a=>Q(this,void 0,void 0,function*(){this.emit(qh.NegotiationStarted);try{yield this.createAndSendOffer()}catch(s){if(a)a(s);else throw s}}),VV),this.close=()=>{this._pc&&(this._pc.close(),this._pc.onconnectionstatechange=null,this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.ondatachannel=null,this._pc.onnegotiationneeded=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ondatachannel=null,this._pc.ontrack=null,this._pc.onconnectionstatechange=null,this._pc.oniceconnectionstatechange=null,this._pc=null)},this.log=lu((r=n.loggerName)!==null&&r!==void 0?r:xs.PCTransport),this.loggerOptions=n,this.config=e,this._pc=this.createPC()}createPC(){const e=new RTCPeerConnection(this.config);return e.onicecandidate=n=>{var r;n.candidate&&((r=this.onIceCandidate)===null||r===void 0||r.call(this,n.candidate))},e.onicecandidateerror=n=>{var r;(r=this.onIceCandidateError)===null||r===void 0||r.call(this,n)},e.oniceconnectionstatechange=()=>{var n;(n=this.onIceConnectionStateChange)===null||n===void 0||n.call(this,e.iceConnectionState)},e.onsignalingstatechange=()=>{var n;(n=this.onSignalingStatechange)===null||n===void 0||n.call(this,e.signalingState)},e.onconnectionstatechange=()=>{var n;(n=this.onConnectionStateChange)===null||n===void 0||n.call(this,e.connectionState)},e.ondatachannel=n=>{var r;(r=this.onDataChannel)===null||r===void 0||r.call(this,n)},e.ontrack=n=>{var r;(r=this.onTrack)===null||r===void 0||r.call(this,n)},e}get logContext(){var e,n;return Object.assign({},(n=(e=this.loggerOptions).loggerContextCb)===null||n===void 0?void 0:n.call(e))}get isICEConnected(){return this._pc!==null&&(this.pc.iceConnectionState==="connected"||this.pc.iceConnectionState==="completed")}addIceCandidate(e){return Q(this,void 0,void 0,function*(){if(this.pc.remoteDescription&&!this.restartingIce)return this.pc.addIceCandidate(e);this.pendingCandidates.push(e)})}setRemoteDescription(e){return Q(this,void 0,void 0,function*(){var n;let r;if(e.type==="offer"){let{stereoMids:a,nackMids:s}=zV(e);this.remoteStereoMids=a,this.remoteNackMids=s}else if(e.type==="answer"){const a=kc.parse((n=e.sdp)!==null&&n!==void 0?n:"");a.media.forEach(s=>{s.type==="audio"&&this.trackBitrates.some(l=>{if(!l.transceiver||s.mid!=l.transceiver.mid)return!1;let c=0;if(s.rtp.some(p=>p.codec.toUpperCase()===l.codec.toUpperCase()?(c=p.payload,!0):!1),c===0)return!0;let h=!1;for(const p of s.fmtp)if(p.payload===c){p.config=p.config.split(";").filter(v=>!v.includes("maxaveragebitrate")).join(";"),l.maxbr>0&&(p.config+=";maxaveragebitrate=".concat(l.maxbr*1e3)),h=!0;break}return h||l.maxbr>0&&s.fmtp.push({payload:c,config:"maxaveragebitrate=".concat(l.maxbr*1e3)}),!0})}),r=kc.write(a)}yield this.setMungedSDP(e,r,!0),this.pendingCandidates.forEach(a=>{this.pc.addIceCandidate(a)}),this.pendingCandidates=[],this.restartingIce=!1,this.renegotiate?(this.renegotiate=!1,yield this.createAndSendOffer()):e.type==="answer"&&(this.emit(qh.NegotiationComplete),e.sdp&&kc.parse(e.sdp).media.forEach(s=>{s.type==="video"&&this.emit(qh.RTPVideoPayloadTypes,s.rtp)}))})}createAndSendOffer(e){return Q(this,void 0,void 0,function*(){var n;if(this.onOffer===void 0)return;if(e!=null&&e.iceRestart&&(this.log.debug("restarting ICE",this.logContext),this.restartingIce=!0),this._pc&&this._pc.signalingState==="have-local-offer"){const s=this._pc.remoteDescription;if(e!=null&&e.iceRestart&&s)yield this._pc.setRemoteDescription(s);else{this.renegotiate=!0;return}}else if(!this._pc||this._pc.signalingState==="closed"){this.log.warn("could not createOffer with closed peer connection",this.logContext);return}this.log.debug("starting to negotiate",this.logContext);const r=yield this.pc.createOffer(e);this.log.debug("original offer",Object.assign({sdp:r.sdp},this.logContext));const a=kc.parse((n=r.sdp)!==null&&n!==void 0?n:"");a.media.forEach(s=>{RO(s),s.type==="audio"?EO(s,[],[]):s.type==="video"&&this.trackBitrates.some(l=>{if(!s.msid||!l.cid||!s.msid.includes(l.cid))return!1;let c=0;if(s.rtp.some(p=>p.codec.toUpperCase()===l.codec.toUpperCase()?(c=p.payload,!0):!1),c===0||(Dg(l.codec)&&this.ensureVideoDDExtensionForSVC(s,a),l.codec!=="av1"))return!0;const h=Math.round(l.maxbr*jV);for(const p of s.fmtp)if(p.payload===c){p.config.includes("x-google-start-bitrate")||(p.config+=";x-google-start-bitrate=".concat(h));break}return!0})}),yield this.setMungedSDP(r,kc.write(a)),this.onOffer(r)})}createAndSetAnswer(){return Q(this,void 0,void 0,function*(){var e;const n=yield this.pc.createAnswer(),r=kc.parse((e=n.sdp)!==null&&e!==void 0?e:"");return r.media.forEach(a=>{RO(a),a.type==="audio"&&EO(a,this.remoteStereoMids,this.remoteNackMids)}),yield this.setMungedSDP(n,kc.write(r)),n})}createDataChannel(e,n){return this.pc.createDataChannel(e,n)}addTransceiver(e,n){return this.pc.addTransceiver(e,n)}addTrack(e){if(!this._pc)throw new xi("PC closed, cannot add track");return this._pc.addTrack(e)}setTrackCodecBitrate(e){this.trackBitrates.push(e)}setConfiguration(e){var n;if(!this._pc)throw new xi("PC closed, cannot configure");return(n=this._pc)===null||n===void 0?void 0:n.setConfiguration(e)}canRemoveTrack(){var e;return!!(!((e=this._pc)===null||e===void 0)&&e.removeTrack)}removeTrack(e){var n;return(n=this._pc)===null||n===void 0?void 0:n.removeTrack(e)}getConnectionState(){var e,n;return(n=(e=this._pc)===null||e===void 0?void 0:e.connectionState)!==null&&n!==void 0?n:"closed"}getICEConnectionState(){var e,n;return(n=(e=this._pc)===null||e===void 0?void 0:e.iceConnectionState)!==null&&n!==void 0?n:"closed"}getSignallingState(){var e,n;return(n=(e=this._pc)===null||e===void 0?void 0:e.signalingState)!==null&&n!==void 0?n:"closed"}getTransceivers(){var e,n;return(n=(e=this._pc)===null||e===void 0?void 0:e.getTransceivers())!==null&&n!==void 0?n:[]}getSenders(){var e,n;return(n=(e=this._pc)===null||e===void 0?void 0:e.getSenders())!==null&&n!==void 0?n:[]}getLocalDescription(){var e;return(e=this._pc)===null||e===void 0?void 0:e.localDescription}getRemoteDescription(){var e;return(e=this.pc)===null||e===void 0?void 0:e.remoteDescription}getStats(){return this.pc.getStats()}getConnectedAddress(){return Q(this,void 0,void 0,function*(){var e;if(!this._pc)return;let n="";const r=new Map,a=new Map;if((yield this._pc.getStats()).forEach(c=>{switch(c.type){case"transport":n=c.selectedCandidatePairId;break;case"candidate-pair":n===""&&c.selected&&(n=c.id),r.set(c.id,c);break;case"remote-candidate":a.set(c.id,"".concat(c.address,":").concat(c.port));break}}),n==="")return;const l=(e=r.get(n))===null||e===void 0?void 0:e.remoteCandidateId;if(l!==void 0)return a.get(l)})}setMungedSDP(e,n,r){return Q(this,void 0,void 0,function*(){if(n){const a=e.sdp;e.sdp=n;try{this.log.debug("setting munged ".concat(r?"remote":"local"," description"),this.logContext),r?yield this.pc.setRemoteDescription(e):yield this.pc.setLocalDescription(e);return}catch(s){this.log.warn("not able to set ".concat(e.type,", falling back to unmodified sdp"),Object.assign(Object.assign({},this.logContext),{error:s,sdp:n})),e.sdp=a}}try{r?yield this.pc.setRemoteDescription(e):yield this.pc.setLocalDescription(e)}catch(a){let s="unknown error";a instanceof Error?s=a.message:typeof a=="string"&&(s=a);const l={error:s,sdp:e.sdp};throw!r&&this.pc.remoteDescription&&(l.remoteSdp=this.pc.remoteDescription),this.log.error("unable to set ".concat(e.type),Object.assign(Object.assign({},this.logContext),{fields:l})),new rT(s)}})}ensureVideoDDExtensionForSVC(e,n){var r,a;if(!((r=e.ext)===null||r===void 0?void 0:r.some(l=>l.uri===aO))){if(this.ddExtID===0){let l=0;n.media.forEach(c=>{var h;c.type==="video"&&((h=c.ext)===null||h===void 0||h.forEach(p=>{p.value>l&&(l=p.value)}))}),this.ddExtID=l+1}(a=e.ext)===null||a===void 0||a.push({value:this.ddExtID,uri:aO})}}}function EO(t,e,n){let r=0;t.rtp.some(a=>a.codec==="opus"?(r=a.payload,!0):!1),r>0&&(t.rtcpFb||(t.rtcpFb=[]),n.includes(t.mid)&&!t.rtcpFb.some(a=>a.payload===r&&a.type==="nack")&&t.rtcpFb.push({payload:r,type:"nack"}),e.includes(t.mid)&&t.fmtp.some(a=>a.payload===r?(a.config.includes("stereo=1")||(a.config+=";stereo=1"),!0):!1))}function zV(t){var e;const n=[],r=[],a=kc.parse((e=t.sdp)!==null&&e!==void 0?e:"");let s=0;return a.media.forEach(l=>{var c;l.type==="audio"&&(l.rtp.some(h=>h.codec==="opus"?(s=h.payload,!0):!1),!((c=l.rtcpFb)===null||c===void 0)&&c.some(h=>h.payload===s&&h.type==="nack")&&r.push(l.mid),l.fmtp.some(h=>h.payload===s?(h.config.includes("sprop-stereo=1")&&n.push(l.mid),!0):!1))}),{stereoMids:n,nackMids:r}}function RO(t){if(t.connection){const e=t.connection.ip.indexOf(":")>=0;(t.connection.version===4&&e||t.connection.version===6&&!e)&&(t.connection.ip="0.0.0.0",t.connection.version=4)}}const PT="vp8",BV={audioPreset:sT.music,dtx:!0,red:!0,forceStereo:!1,simulcast:!0,screenShareEncoding:uT.h1080fps15.encoding,stopMicTrackOnMute:!1,videoCodec:PT,backupCodec:!0},PO={deviceId:{ideal:"default"},autoGainControl:!0,echoCancellation:!0,noiseSuppression:!0,voiceIsolation:!0},DO={deviceId:{ideal:"default"},resolution:Pg.h720.resolution},HV={adaptiveStream:!1,dynacast:!1,stopLocalTrackOnUnpublish:!0,reconnectPolicy:new M8,disconnectOnPageLeave:!0,webAudioMix:!1},DT={autoSubscribe:!0,maxRetries:1,peerConnectionTimeout:15e3,websocketTimeout:15e3};var Jr;(function(t){t[t.NEW=0]="NEW",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED",t[t.FAILED=3]="FAILED",t[t.CLOSING=4]="CLOSING",t[t.CLOSED=5]="CLOSED"})(Jr||(Jr={}));class $V{get needsPublisher(){return this.isPublisherConnectionRequired}get needsSubscriber(){return this.isSubscriberConnectionRequired}get currentState(){return this.state}constructor(e,n,r){var a;this.peerConnectionTimeout=DT.peerConnectionTimeout,this.log=Nn,this.updateState=()=>{var s;const l=this.state,c=this.requiredTransports.map(h=>h.getConnectionState());c.every(h=>h==="connected")?this.state=Jr.CONNECTED:c.some(h=>h==="failed")?this.state=Jr.FAILED:c.some(h=>h==="connecting")?this.state=Jr.CONNECTING:c.every(h=>h==="closed")?this.state=Jr.CLOSED:c.some(h=>h==="closed")?this.state=Jr.CLOSING:c.every(h=>h==="new")&&(this.state=Jr.NEW),l!==this.state&&(this.log.debug("pc state change: from ".concat(Jr[l]," to ").concat(Jr[this.state]),this.logContext),(s=this.onStateChange)===null||s===void 0||s.call(this,this.state,this.publisher.getConnectionState(),this.subscriber.getConnectionState()))},this.log=lu((a=r.loggerName)!==null&&a!==void 0?a:xs.PCManager),this.loggerOptions=r,this.isPublisherConnectionRequired=!n,this.isSubscriberConnectionRequired=n,this.publisher=new _O(e,r),this.subscriber=new _O(e,r),this.publisher.onConnectionStateChange=this.updateState,this.subscriber.onConnectionStateChange=this.updateState,this.publisher.onIceConnectionStateChange=this.updateState,this.subscriber.onIceConnectionStateChange=this.updateState,this.publisher.onSignalingStatechange=this.updateState,this.subscriber.onSignalingStatechange=this.updateState,this.publisher.onIceCandidate=s=>{var l;(l=this.onIceCandidate)===null||l===void 0||l.call(this,s,Ts.PUBLISHER)},this.subscriber.onIceCandidate=s=>{var l;(l=this.onIceCandidate)===null||l===void 0||l.call(this,s,Ts.SUBSCRIBER)},this.subscriber.onDataChannel=s=>{var l;(l=this.onDataChannel)===null||l===void 0||l.call(this,s)},this.subscriber.onTrack=s=>{var l;(l=this.onTrack)===null||l===void 0||l.call(this,s)},this.publisher.onOffer=s=>{var l;(l=this.onPublisherOffer)===null||l===void 0||l.call(this,s)},this.state=Jr.NEW,this.connectionLock=new to,this.remoteOfferLock=new to}get logContext(){var e,n;return Object.assign({},(n=(e=this.loggerOptions).loggerContextCb)===null||n===void 0?void 0:n.call(e))}requirePublisher(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.isPublisherConnectionRequired=e,this.updateState()}requireSubscriber(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.isSubscriberConnectionRequired=e,this.updateState()}createAndSendPublisherOffer(e){return this.publisher.createAndSendOffer(e)}setPublisherAnswer(e){return this.publisher.setRemoteDescription(e)}removeTrack(e){return this.publisher.removeTrack(e)}close(){return Q(this,void 0,void 0,function*(){if(this.publisher&&this.publisher.getSignallingState()!=="closed"){const e=this.publisher;for(const n of e.getSenders())try{e.canRemoveTrack()&&e.removeTrack(n)}catch(r){this.log.warn("could not removeTrack",Object.assign(Object.assign({},this.logContext),{error:r}))}}yield Promise.all([this.publisher.close(),this.subscriber.close()]),this.updateState()})}triggerIceRestart(){return Q(this,void 0,void 0,function*(){this.subscriber.restartingIce=!0,this.needsPublisher&&(yield this.createAndSendPublisherOffer({iceRestart:!0}))})}addIceCandidate(e,n){return Q(this,void 0,void 0,function*(){n===Ts.PUBLISHER?yield this.publisher.addIceCandidate(e):yield this.subscriber.addIceCandidate(e)})}createSubscriberAnswerFromOffer(e){return Q(this,void 0,void 0,function*(){this.log.debug("received server offer",Object.assign(Object.assign({},this.logContext),{RTCSdpType:e.type,sdp:e.sdp,signalingState:this.subscriber.getSignallingState().toString()}));const n=yield this.remoteOfferLock.lock();try{return yield this.subscriber.setRemoteDescription(e),yield this.subscriber.createAndSetAnswer()}finally{n()}})}updateConfiguration(e,n){this.publisher.setConfiguration(e),this.subscriber.setConfiguration(e),n&&this.triggerIceRestart()}ensurePCTransportConnection(e,n){return Q(this,void 0,void 0,function*(){var r;const a=yield this.connectionLock.lock();try{this.isPublisherConnectionRequired&&this.publisher.getConnectionState()!=="connected"&&this.publisher.getConnectionState()!=="connecting"&&(this.log.debug("negotiation required, start negotiating",this.logContext),this.publisher.negotiate()),yield Promise.all((r=this.requiredTransports)===null||r===void 0?void 0:r.map(s=>this.ensureTransportConnected(s,e,n)))}finally{a()}})}negotiate(e){return Q(this,void 0,void 0,function*(){return new Promise((n,r)=>Q(this,void 0,void 0,function*(){const a=setTimeout(()=>{r("negotiation timed out")},this.peerConnectionTimeout),s=()=>{clearTimeout(a),r("negotiation aborted")};e.signal.addEventListener("abort",s),this.publisher.once(qh.NegotiationStarted,()=>{e.signal.aborted||this.publisher.once(qh.NegotiationComplete,()=>{clearTimeout(a),n()})}),yield this.publisher.negotiate(l=>{clearTimeout(a),r(l)})}))})}addPublisherTransceiver(e,n){return this.publisher.addTransceiver(e,n)}addPublisherTrack(e){return this.publisher.addTrack(e)}createPublisherDataChannel(e,n){return this.publisher.createDataChannel(e,n)}getConnectedAddress(e){return e===Ts.PUBLISHER?this.publisher.getConnectedAddress():e===Ts.SUBSCRIBER?this.publisher.getConnectedAddress():this.requiredTransports[0].getConnectedAddress()}get requiredTransports(){const e=[];return this.isPublisherConnectionRequired&&e.push(this.publisher),this.isSubscriberConnectionRequired&&e.push(this.subscriber),e}ensureTransportConnected(e,n){return Q(this,arguments,void 0,function(r,a){var s=this;let l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.peerConnectionTimeout;return function*(){if(r.getConnectionState()!=="connected")return new Promise((h,p)=>Q(s,void 0,void 0,function*(){const v=()=>{this.log.warn("abort transport connection",this.logContext),Qi.clearTimeout(b),p(new br("room connection has been cancelled",Un.Cancelled))};a!=null&&a.signal.aborted&&v(),a==null||a.signal.addEventListener("abort",v);const b=Qi.setTimeout(()=>{a==null||a.signal.removeEventListener("abort",v),p(new br("could not establish pc connection",Un.InternalError))},l);for(;this.state!==Jr.CONNECTED;)if(yield io(50),a!=null&&a.signal.aborted){p(new br("room connection has been cancelled",Un.Cancelled));return}Qi.clearTimeout(b),a==null||a.signal.removeEventListener("abort",v),h()}))}()})}}class ei extends Error{constructor(e,n,r){super(n),this.code=e,this.message=OO(n,ei.MAX_MESSAGE_BYTES),this.data=r?OO(r,ei.MAX_DATA_BYTES):void 0}static fromProto(e){return new ei(e.code,e.message,e.data)}toProto(){return new WD({code:this.code,message:this.message,data:this.data})}static builtIn(e,n){return new ei(ei.ErrorCode[e],ei.ErrorMessage[e],n)}}ei.MAX_MESSAGE_BYTES=256,ei.MAX_DATA_BYTES=15360,ei.ErrorCode={APPLICATION_ERROR:1500,CONNECTION_TIMEOUT:1501,RESPONSE_TIMEOUT:1502,RECIPIENT_DISCONNECTED:1503,RESPONSE_PAYLOAD_TOO_LARGE:1504,SEND_FAILED:1505,UNSUPPORTED_METHOD:1400,RECIPIENT_NOT_FOUND:1401,REQUEST_PAYLOAD_TOO_LARGE:1402,UNSUPPORTED_SERVER:1403,UNSUPPORTED_VERSION:1404},ei.ErrorMessage={APPLICATION_ERROR:"Application error in method handler",CONNECTION_TIMEOUT:"Connection timeout",RESPONSE_TIMEOUT:"Response timeout",RECIPIENT_DISCONNECTED:"Recipient disconnected",RESPONSE_PAYLOAD_TOO_LARGE:"Response payload too large",SEND_FAILED:"Failed to send",UNSUPPORTED_METHOD:"Method not supported at destination",RECIPIENT_NOT_FOUND:"Recipient not found",REQUEST_PAYLOAD_TOO_LARGE:"Request payload too large",UNSUPPORTED_SERVER:"RPC not supported by server",UNSUPPORTED_VERSION:"Unsupported RPC version"};const AO=15360;function AT(t){return new TextEncoder().encode(t).length}function OO(t,e){if(AT(t)<=e)return t;let n=0,r=t.length;const a=new TextEncoder;for(;n<r;){const s=Math.floor((n+r+1)/2);a.encode(t.slice(0,s)).length<=e?n=s:r=s-1}return t.slice(0,n)}const OT=2e3;function lb(t,e){if(!e)return 0;let n,r;return"bytesReceived"in t?(n=t.bytesReceived,r=e.bytesReceived):"bytesSent"in t&&(n=t.bytesSent,r=e.bytesSent),n===void 0||r===void 0||t.timestamp===void 0||e.timestamp===void 0?0:(n-r)*8*1e3/(t.timestamp-e.timestamp)}const qV=1e3;class MO extends De{get sender(){return this._sender}set sender(e){this._sender=e}get constraints(){return this._constraints}constructor(e,n,r){let a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,s=arguments.length>4?arguments[4]:void 0;super(e,n,s),this.manuallyStopped=!1,this._isUpstreamPaused=!1,this.handleTrackMuteEvent=()=>this.debouncedTrackMuteHandler().catch(()=>this.log.debug("track mute bounce got cancelled by an unmute event",this.logContext)),this.debouncedTrackMuteHandler=RT(()=>Q(this,void 0,void 0,function*(){yield this.pauseUpstream()}),5e3),this.handleTrackUnmuteEvent=()=>Q(this,void 0,void 0,function*(){this.debouncedTrackMuteHandler.cancel("unmute"),yield this.resumeUpstream()}),this.handleEnded=()=>{this.isInBackground&&(this.reacquireTrack=!0),this._mediaStreamTrack.removeEventListener("mute",this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener("unmute",this.handleTrackUnmuteEvent),this.emit(Qe.Ended,this)},this.reacquireTrack=!1,this.providedByUser=a,this.muteLock=new to,this.pauseUpstreamLock=new to,this.processorLock=new to,this.restartLock=new to,this.setMediaStreamTrack(e,!0),this._constraints=e.getConstraints(),r&&(this._constraints=r)}get id(){return this._mediaStreamTrack.id}get dimensions(){if(this.kind!==De.Kind.Video)return;const{width:e,height:n}=this._mediaStreamTrack.getSettings();if(e&&n)return{width:e,height:n}}get isUpstreamPaused(){return this._isUpstreamPaused}get isUserProvided(){return this.providedByUser}get mediaStreamTrack(){var e,n;return(n=(e=this.processor)===null||e===void 0?void 0:e.processedTrack)!==null&&n!==void 0?n:this._mediaStreamTrack}get isLocal(){return!0}getSourceTrackSettings(){return this._mediaStreamTrack.getSettings()}setMediaStreamTrack(e,n){return Q(this,void 0,void 0,function*(){var r;if(e===this._mediaStreamTrack&&!n)return;this._mediaStreamTrack&&(this.attachedElements.forEach(s=>{zh(this._mediaStreamTrack,s)}),this.debouncedTrackMuteHandler.cancel("new-track"),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.removeEventListener("mute",this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener("unmute",this.handleTrackUnmuteEvent)),this.mediaStream=new MediaStream([e]),e&&(e.addEventListener("ended",this.handleEnded),e.addEventListener("mute",this.handleTrackMuteEvent),e.addEventListener("unmute",this.handleTrackUnmuteEvent),this._constraints=e.getConstraints());let a;if(this.processor&&e){const s=yield this.processorLock.lock();try{if(this.log.debug("restarting processor",this.logContext),this.kind==="unknown")throw TypeError("cannot set processor on track of unknown kind");this.processorElement&&(Vh(e,this.processorElement),this.processorElement.muted=!0),yield this.processor.restart({track:e,kind:this.kind,element:this.processorElement}),a=this.processor.processedTrack}finally{s()}}this.sender&&((r=this.sender.transport)===null||r===void 0?void 0:r.state)!=="closed"&&(yield this.sender.replaceTrack(a??e)),!this.providedByUser&&this._mediaStreamTrack!==e&&this._mediaStreamTrack.stop(),this._mediaStreamTrack=e,e&&(this._mediaStreamTrack.enabled=!this.isMuted,yield this.resumeUpstream(),this.attachedElements.forEach(s=>{Vh(a??e,s)}))})}waitForDimensions(){return Q(this,arguments,void 0,function(){var e=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:qV;return function*(){var r;if(e.kind===De.Kind.Audio)throw new Error("cannot get dimensions for audio tracks");((r=ws())===null||r===void 0?void 0:r.os)==="iOS"&&(yield io(10));const a=Date.now();for(;Date.now()-a<n;){const s=e.dimensions;if(s)return s;yield io(50)}throw new uu("unable to get track dimensions after timeout")}()})}setDeviceId(e){return Q(this,void 0,void 0,function*(){return this._constraints.deviceId===e&&this._mediaStreamTrack.getSettings().deviceId===Sc(e)||(this._constraints.deviceId=e,this.isMuted)?!0:(yield this.restartTrack(),Sc(e)===this._mediaStreamTrack.getSettings().deviceId)})}getDeviceId(){return Q(this,arguments,void 0,function(){var e=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){if(e.source===De.Source.ScreenShare)return;const{deviceId:r,groupId:a}=e._mediaStreamTrack.getSettings(),s=e.kind===De.Kind.Audio?"audioinput":"videoinput";return n?zi.getInstance().normalizeDeviceId(s,r,a):r}()})}mute(){return Q(this,void 0,void 0,function*(){return this.setTrackMuted(!0),this})}unmute(){return Q(this,void 0,void 0,function*(){return this.setTrackMuted(!1),this})}replaceTrack(e,n){return Q(this,void 0,void 0,function*(){if(!this.sender)throw new uu("unable to replace an unpublished track");let r,a;return typeof n=="boolean"?r=n:n!==void 0&&(r=n.userProvidedTrack,a=n.stopProcessor),this.providedByUser=r??!0,this.log.debug("replace MediaStreamTrack",this.logContext),yield this.setMediaStreamTrack(e),a&&this.processor&&(yield this.stopProcessor()),this})}restart(e){return Q(this,void 0,void 0,function*(){this.manuallyStopped=!1;const n=yield this.restartLock.lock();try{e||(e=this._constraints);const{deviceId:r,facingMode:a}=e,s=L8(e,["deviceId","facingMode"]);this.log.debug("restarting track with constraints",Object.assign(Object.assign({},this.logContext),{constraints:e}));const l={audio:!1,video:!1};this.kind===De.Kind.Video?l.video=r||a?{deviceId:r,facingMode:a}:!0:l.audio=r?{deviceId:r}:!0,this.attachedElements.forEach(p=>{zh(this.mediaStreamTrack,p)}),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.stop();const h=(yield navigator.mediaDevices.getUserMedia(l)).getTracks()[0];return yield h.applyConstraints(s),h.addEventListener("ended",this.handleEnded),this.log.debug("re-acquired MediaStreamTrack",this.logContext),yield this.setMediaStreamTrack(h),this._constraints=e,this.emit(Qe.Restarted,this),this.manuallyStopped&&(this.log.warn("track was stopped during a restart, stopping restarted track",this.logContext),this.stop()),this}finally{n()}})}setTrackMuted(e){this.log.debug("setting ".concat(this.kind," track ").concat(e?"muted":"unmuted"),this.logContext),!(this.isMuted===e&&this._mediaStreamTrack.enabled!==e)&&(this.isMuted=e,this._mediaStreamTrack.enabled=!e,this.emit(e?Qe.Muted:Qe.Unmuted,this))}get needsReAcquisition(){return this._mediaStreamTrack.readyState!=="live"||this._mediaStreamTrack.muted||!this._mediaStreamTrack.enabled||this.reacquireTrack}handleAppVisibilityChanged(){const e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return Q(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),oO()&&(this.log.debug("visibility changed, is in Background: ".concat(this.isInBackground),this.logContext),!this.isInBackground&&this.needsReAcquisition&&!this.isUserProvided&&!this.isMuted&&(this.log.debug("track needs to be reacquired, restarting ".concat(this.source),this.logContext),yield this.restart(),this.reacquireTrack=!1))})}stop(){var e;this.manuallyStopped=!0,super.stop(),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.removeEventListener("mute",this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener("unmute",this.handleTrackUnmuteEvent),(e=this.processor)===null||e===void 0||e.destroy(),this.processor=void 0}pauseUpstream(){return Q(this,void 0,void 0,function*(){var e;const n=yield this.pauseUpstreamLock.lock();try{if(this._isUpstreamPaused===!0)return;if(!this.sender){this.log.warn("unable to pause upstream for an unpublished track",this.logContext);return}this._isUpstreamPaused=!0,this.emit(Qe.UpstreamPaused,this);const r=ws();if((r==null?void 0:r.name)==="Safari"&&bc(r.version,"12.0")<0)throw new nT("pauseUpstream is not supported on Safari < 12.");((e=this.sender.transport)===null||e===void 0?void 0:e.state)!=="closed"&&(yield this.sender.replaceTrack(null))}finally{n()}})}resumeUpstream(){return Q(this,void 0,void 0,function*(){var e;const n=yield this.pauseUpstreamLock.lock();try{if(this._isUpstreamPaused===!1)return;if(!this.sender){this.log.warn("unable to resume upstream for an unpublished track",this.logContext);return}this._isUpstreamPaused=!1,this.emit(Qe.UpstreamResumed,this),((e=this.sender.transport)===null||e===void 0?void 0:e.state)!=="closed"&&(yield this.sender.replaceTrack(this.mediaStreamTrack))}finally{n()}})}getRTCStatsReport(){return Q(this,void 0,void 0,function*(){var e;return!((e=this.sender)===null||e===void 0)&&e.getStats?yield this.sender.getStats():void 0})}setProcessor(e){return Q(this,arguments,void 0,function(n){var r=this;let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){var s;const l=yield r.processorLock.lock();try{r.log.debug("setting up processor",r.logContext);const c=document.createElement(r.kind),h={kind:r.kind,track:r._mediaStreamTrack,element:c,audioContext:r.audioContext};if(yield n.init(h),r.log.debug("processor initialized",r.logContext),r.processor&&(yield r.stopProcessor()),r.kind==="unknown")throw TypeError("cannot set processor on track of unknown kind");if(Vh(r._mediaStreamTrack,c),c.muted=!0,c.play().catch(p=>r.log.error("failed to play processor element",Object.assign(Object.assign({},r.logContext),{error:p}))),r.processor=n,r.processorElement=c,r.processor.processedTrack){for(const p of r.attachedElements)p!==r.processorElement&&a&&(zh(r._mediaStreamTrack,p),Vh(r.processor.processedTrack,p));yield(s=r.sender)===null||s===void 0?void 0:s.replaceTrack(r.processor.processedTrack)}r.emit(Qe.TrackProcessorUpdate,r.processor)}finally{l()}}()})}getProcessor(){return this.processor}stopProcessor(){return Q(this,arguments,void 0,function(){var e=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){var r,a;e.processor&&(e.log.debug("stopping processor",e.logContext),(r=e.processor.processedTrack)===null||r===void 0||r.stop(),yield e.processor.destroy(),e.processor=void 0,n||((a=e.processorElement)===null||a===void 0||a.remove(),e.processorElement=void 0),yield e._mediaStreamTrack.applyConstraints(e._constraints),yield e.setMediaStreamTrack(e._mediaStreamTrack,!0),e.emit(Qe.TrackProcessorUpdate))}()})}}class ub extends MO{get enhancedNoiseCancellation(){return this.isKrispNoiseFilterEnabled}constructor(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0;super(e,De.Kind.Audio,n,r,s),this.stopOnMute=!1,this.isKrispNoiseFilterEnabled=!1,this.monitorSender=()=>Q(this,void 0,void 0,function*(){if(!this.sender){this._currentBitrate=0;return}let l;try{l=yield this.getSenderStats()}catch(c){this.log.error("could not get audio sender stats",Object.assign(Object.assign({},this.logContext),{error:c}));return}l&&this.prevStats&&(this._currentBitrate=lb(l,this.prevStats)),this.prevStats=l}),this.handleKrispNoiseFilterEnable=()=>{this.isKrispNoiseFilterEnabled=!0,this.log.debug("Krisp noise filter enabled",this.logContext),this.emit(Qe.AudioTrackFeatureUpdate,this,ul.TF_ENHANCED_NOISE_CANCELLATION,!0)},this.handleKrispNoiseFilterDisable=()=>{this.isKrispNoiseFilterEnabled=!1,this.log.debug("Krisp noise filter disabled",this.logContext),this.emit(Qe.AudioTrackFeatureUpdate,this,ul.TF_ENHANCED_NOISE_CANCELLATION,!1)},this.audioContext=a,this.checkForSilence()}mute(){const e=Object.create(null,{mute:{get:()=>super.mute}});return Q(this,void 0,void 0,function*(){const n=yield this.muteLock.lock();try{return this.isMuted?(this.log.debug("Track already muted",this.logContext),this):(this.source===De.Source.Microphone&&this.stopOnMute&&!this.isUserProvided&&(this.log.debug("stopping mic track",this.logContext),this._mediaStreamTrack.stop()),yield e.mute.call(this),this)}finally{n()}})}unmute(){const e=Object.create(null,{unmute:{get:()=>super.unmute}});return Q(this,void 0,void 0,function*(){const n=yield this.muteLock.lock();try{if(!this.isMuted)return this.log.debug("Track already unmuted",this.logContext),this;const r=this._constraints.deviceId&&this._mediaStreamTrack.getSettings().deviceId!==Sc(this._constraints.deviceId);return this.source===De.Source.Microphone&&(this.stopOnMute||this._mediaStreamTrack.readyState==="ended"||r)&&!this.isUserProvided&&(this.log.debug("reacquiring mic track",this.logContext),yield this.restartTrack()),yield e.unmute.call(this),this}finally{n()}})}restartTrack(e){return Q(this,void 0,void 0,function*(){let n;if(e){const r=CT({audio:e});typeof r.audio!="boolean"&&(n=r.audio)}yield this.restart(n)})}restart(e){const n=Object.create(null,{restart:{get:()=>super.restart}});return Q(this,void 0,void 0,function*(){const r=yield n.restart.call(this,e);return this.checkForSilence(),r})}startMonitor(){ao()&&(this.monitorInterval||(this.monitorInterval=setInterval(()=>{this.monitorSender()},OT)))}setProcessor(e){return Q(this,void 0,void 0,function*(){var n;const r=yield this.processorLock.lock();try{if(!fl()&&!this.audioContext)throw Error("Audio context needs to be set on LocalAudioTrack in order to enable processors");this.processor&&(yield this.stopProcessor());const a={kind:this.kind,track:this._mediaStreamTrack,audioContext:this.audioContext};this.log.debug("setting up audio processor ".concat(e.name),this.logContext),yield e.init(a),this.processor=e,this.processor.processedTrack&&(yield(n=this.sender)===null||n===void 0?void 0:n.replaceTrack(this.processor.processedTrack),this.processor.processedTrack.addEventListener("enable-lk-krisp-noise-filter",this.handleKrispNoiseFilterEnable),this.processor.processedTrack.addEventListener("disable-lk-krisp-noise-filter",this.handleKrispNoiseFilterDisable)),this.emit(Qe.TrackProcessorUpdate,this.processor)}finally{r()}})}setAudioContext(e){this.audioContext=e}getSenderStats(){return Q(this,void 0,void 0,function*(){var e;if(!(!((e=this.sender)===null||e===void 0)&&e.getStats))return;const n=yield this.sender.getStats();let r;return n.forEach(a=>{a.type==="outbound-rtp"&&(r={type:"audio",streamId:a.id,packetsSent:a.packetsSent,packetsLost:a.packetsLost,bytesSent:a.bytesSent,timestamp:a.timestamp,roundTripTime:a.roundTripTime,jitter:a.jitter})}),r})}checkForSilence(){return Q(this,void 0,void 0,function*(){const e=yield gO(this);return e&&(this.isMuted||this.log.warn("silence detected on local audio track",this.logContext),this.emit(Qe.AudioSilenceDetected)),e})}}function WV(t,e,n){switch(t.kind){case"audio":return new ub(t,e,!1,void 0,n);case"video":return new db(t,e,!1,n);default:throw new uu("unsupported track type: ".concat(t.kind))}}const GV=Object.values(Pg),YV=Object.values(lT),KV=Object.values(uT),ZV=[Pg.h180,Pg.h360],QV=[lT.h180,lT.h360],XV=t=>[{scaleResolutionDownBy:2,fps:t.encoding.maxFramerate}].map(n=>{var r,a;return new gr(Math.floor(t.width/n.scaleResolutionDownBy),Math.floor(t.height/n.scaleResolutionDownBy),Math.max(15e4,Math.floor(t.encoding.maxBitrate/(Math.pow(n.scaleResolutionDownBy,2)*(((r=t.encoding.maxFramerate)!==null&&r!==void 0?r:30)/((a=n.fps)!==null&&a!==void 0?a:30))))),n.fps,t.encoding.priority)}),MT=["q","h","f"];function LT(t,e,n,r){var a,s;let l=r==null?void 0:r.videoEncoding;t&&(l=r==null?void 0:r.screenShareEncoding);const c=r==null?void 0:r.simulcast,h=r==null?void 0:r.scalabilityMode,p=r==null?void 0:r.videoCodec;if(!l&&!c&&!h||!e||!n)return[{}];l||(l=ez(t,e,n,p),Nn.debug("using video encoding",l));const v=l.maxFramerate,b=new gr(e,n,l.maxBitrate,l.maxFramerate,l.priority);if(h&&Dg(p)){const E=new cb(h),R=[];if(E.spatial>3)throw new Error("unsupported scalabilityMode: ".concat(h));const M=ws();if(yc()||fl()||(M==null?void 0:M.name)==="Chrome"&&bc(M==null?void 0:M.version,"113")<0){const A=E.suffix=="h"?2:3;for(let U=0;U<E.spatial;U+=1)R.push({rid:MT[2-U],maxBitrate:l.maxBitrate/Math.pow(A,U),maxFramerate:b.encoding.maxFramerate});R[0].scalabilityMode=h}else R.push({maxBitrate:l.maxBitrate,maxFramerate:b.encoding.maxFramerate,scalabilityMode:h});return b.encoding.priority&&(R[0].priority=b.encoding.priority,R[0].networkPriority=b.encoding.priority),Nn.debug("using svc encoding",{encodings:R}),R}if(!c)return[l];let k=[];t?k=(a=NO(r==null?void 0:r.screenShareSimulcastLayers))!==null&&a!==void 0?a:LO(t,b):k=(s=NO(r==null?void 0:r.videoSimulcastLayers))!==null&&s!==void 0?s:LO(t,b);let T;if(k.length>0){const E=k[0];k.length>1&&([,T]=k);const R=Math.max(e,n);if(R>=960&&T)return NT(e,n,[E,T,b],v);if(R>=480)return NT(e,n,[E,b],v)}return NT(e,n,[b])}function JV(t,e,n){var r,a,s,l;if(!n.backupCodec||n.backupCodec===!0||n.backupCodec.codec===n.videoCodec)return;e!==n.backupCodec.codec&&Nn.warn("requested a different codec than specified as backup",{serverRequested:e,backup:n.backupCodec.codec}),n.videoCodec=e,n.videoEncoding=n.backupCodec.encoding;const c=t.mediaStreamTrack.getSettings(),h=(r=c.width)!==null&&r!==void 0?r:(a=t.dimensions)===null||a===void 0?void 0:a.width,p=(s=c.height)!==null&&s!==void 0?s:(l=t.dimensions)===null||l===void 0?void 0:l.height;return t.source===De.Source.ScreenShare&&n.simulcast&&(n.simulcast=!1),LT(t.source===De.Source.ScreenShare,h,p,n)}function ez(t,e,n,r){const a=tz(t,e,n);let{encoding:s}=a[0];const l=Math.max(e,n);for(let c=0;c<a.length;c+=1){const h=a[c];if(s=h.encoding,h.width>=l)break}if(r)switch(r){case"av1":s=Object.assign({},s),s.maxBitrate=s.maxBitrate*.7;break;case"vp9":s=Object.assign({},s),s.maxBitrate=s.maxBitrate*.85;break}return s}function tz(t,e,n){if(t)return KV;const r=e>n?e/n:n/e;return Math.abs(r-16/9)<Math.abs(r-4/3)?GV:YV}function LO(t,e){if(t)return XV(e);const{width:n,height:r}=e,a=n>r?n/r:r/n;return Math.abs(a-16/9)<Math.abs(a-4/3)?ZV:QV}function NT(t,e,n,r){const a=[];if(n.forEach((s,l)=>{if(l>=MT.length)return;const c=Math.min(t,e),p={rid:MT[l],scaleResolutionDownBy:Math.max(1,c/Math.min(s.width,s.height)),maxBitrate:s.encoding.maxBitrate},v=r&&s.encoding.maxFramerate?Math.min(r,s.encoding.maxFramerate):s.encoding.maxFramerate;v&&(p.maxFramerate=v);const b=Bh()||l===0;s.encoding.priority&&b&&(p.priority=s.encoding.priority,p.networkPriority=s.encoding.priority),a.push(p)}),fl()&&lO()==="ios"){let s;a.forEach(c=>{s?c.maxFramerate&&c.maxFramerate>s&&(s=c.maxFramerate):s=c.maxFramerate});let l=!0;a.forEach(c=>{var h;c.maxFramerate!=s&&(l&&(l=!1,Nn.info("Simulcast on iOS React-Native requires all encodings to share the same framerate.")),Nn.info('Setting framerate of encoding "'.concat((h=c.rid)!==null&&h!==void 0?h:"",'" to ').concat(s)),c.maxFramerate=s)})}return a}function NO(t){if(t)return t.sort((e,n)=>{const{encoding:r}=e,{encoding:a}=n;return r.maxBitrate>a.maxBitrate?1:r.maxBitrate<a.maxBitrate?-1:r.maxBitrate===a.maxBitrate&&r.maxFramerate&&a.maxFramerate?r.maxFramerate>a.maxFramerate?1:-1:0})}class cb{constructor(e){const n=e.match(/^L(\d)T(\d)(h|_KEY|_KEY_SHIFT){0,1}$/);if(!n)throw new Error("invalid scalability mode");if(this.spatial=parseInt(n[1]),this.temporal=parseInt(n[2]),n.length>3)switch(n[3]){case"h":case"_KEY":case"_KEY_SHIFT":this.suffix=n[3]}}toString(){var e;return"L".concat(this.spatial,"T").concat(this.temporal).concat((e=this.suffix)!==null&&e!==void 0?e:"")}}function nz(t){return t.source===De.Source.ScreenShare||t.constraints.height&&Sc(t.constraints.height)>=1080?"maintain-resolution":"balanced"}const rz=5e3;class db extends MO{get sender(){return this._sender}set sender(e){this._sender=e,this.degradationPreference&&this.setDegradationPreference(this.degradationPreference)}constructor(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=arguments.length>3?arguments[3]:void 0;super(e,De.Kind.Video,n,r,a),this.simulcastCodecs=new Map,this.degradationPreference="balanced",this.monitorSender=()=>Q(this,void 0,void 0,function*(){if(!this.sender){this._currentBitrate=0;return}let s;try{s=yield this.getSenderStats()}catch(c){this.log.error("could not get audio sender stats",Object.assign(Object.assign({},this.logContext),{error:c}));return}const l=new Map(s.map(c=>[c.rid,c]));if(this.prevStats){let c=0;l.forEach((h,p)=>{var v;const b=(v=this.prevStats)===null||v===void 0?void 0:v.get(p);c+=lb(h,b)}),this._currentBitrate=c}this.prevStats=l}),this.senderLock=new to}get isSimulcast(){return!!(this.sender&&this.sender.getParameters().encodings.length>1)}startMonitor(e){var n;if(this.signalClient=e,!ao())return;const r=(n=this.sender)===null||n===void 0?void 0:n.getParameters();r&&(this.encodings=r.encodings),!this.monitorInterval&&(this.monitorInterval=setInterval(()=>{this.monitorSender()},OT))}stop(){this._mediaStreamTrack.getConstraints(),this.simulcastCodecs.forEach(e=>{e.mediaStreamTrack.stop()}),super.stop()}pauseUpstream(){const e=Object.create(null,{pauseUpstream:{get:()=>super.pauseUpstream}});return Q(this,void 0,void 0,function*(){var n,r,a,s,l;yield e.pauseUpstream.call(this);try{for(var c=!0,h=pc(this.simulcastCodecs.values()),p;p=yield h.next(),n=p.done,!n;c=!0)s=p.value,c=!1,yield(l=s.sender)===null||l===void 0?void 0:l.replaceTrack(null)}catch(v){r={error:v}}finally{try{!c&&!n&&(a=h.return)&&(yield a.call(h))}finally{if(r)throw r.error}}})}resumeUpstream(){const e=Object.create(null,{resumeUpstream:{get:()=>super.resumeUpstream}});return Q(this,void 0,void 0,function*(){var n,r,a,s,l;yield e.resumeUpstream.call(this);try{for(var c=!0,h=pc(this.simulcastCodecs.values()),p;p=yield h.next(),n=p.done,!n;c=!0){s=p.value,c=!1;const v=s;yield(l=v.sender)===null||l===void 0?void 0:l.replaceTrack(v.mediaStreamTrack)}}catch(v){r={error:v}}finally{try{!c&&!n&&(a=h.return)&&(yield a.call(h))}finally{if(r)throw r.error}}})}mute(){const e=Object.create(null,{mute:{get:()=>super.mute}});return Q(this,void 0,void 0,function*(){const n=yield this.muteLock.lock();try{return this.isMuted?(this.log.debug("Track already muted",this.logContext),this):(this.source===De.Source.Camera&&!this.isUserProvided&&(this.log.debug("stopping camera track",this.logContext),this._mediaStreamTrack.stop()),yield e.mute.call(this),this)}finally{n()}})}unmute(){const e=Object.create(null,{unmute:{get:()=>super.unmute}});return Q(this,void 0,void 0,function*(){const n=yield this.muteLock.lock();try{return this.isMuted?(this.source===De.Source.Camera&&!this.isUserProvided&&(this.log.debug("reacquiring camera track",this.logContext),yield this.restartTrack()),yield e.unmute.call(this),this):(this.log.debug("Track already unmuted",this.logContext),this)}finally{n()}})}setTrackMuted(e){super.setTrackMuted(e);for(const n of this.simulcastCodecs.values())n.mediaStreamTrack.enabled=!e}getSenderStats(){return Q(this,void 0,void 0,function*(){var e;if(!(!((e=this.sender)===null||e===void 0)&&e.getStats))return[];const n=[],r=yield this.sender.getStats();return r.forEach(a=>{var s;if(a.type==="outbound-rtp"){const l={type:"video",streamId:a.id,frameHeight:a.frameHeight,frameWidth:a.frameWidth,framesPerSecond:a.framesPerSecond,framesSent:a.framesSent,firCount:a.firCount,pliCount:a.pliCount,nackCount:a.nackCount,packetsSent:a.packetsSent,bytesSent:a.bytesSent,qualityLimitationReason:a.qualityLimitationReason,qualityLimitationDurations:a.qualityLimitationDurations,qualityLimitationResolutionChanges:a.qualityLimitationResolutionChanges,rid:(s=a.rid)!==null&&s!==void 0?s:a.id,retransmittedPacketsSent:a.retransmittedPacketsSent,targetBitrate:a.targetBitrate,timestamp:a.timestamp},c=r.get(a.remoteId);c&&(l.jitter=c.jitter,l.packetsLost=c.packetsLost,l.roundTripTime=c.roundTripTime),n.push(l)}}),n.sort((a,s)=>{var l,c;return((l=s.frameWidth)!==null&&l!==void 0?l:0)-((c=a.frameWidth)!==null&&c!==void 0?c:0)}),n})}setPublishingQuality(e){const n=[];for(let r=Go.LOW;r<=Go.HIGH;r+=1)n.push(new $1({quality:r,enabled:r<=e}));this.log.debug("setting publishing quality. max quality ".concat(e),this.logContext),this.setPublishingLayers(n)}restartTrack(e){return Q(this,void 0,void 0,function*(){var n,r,a,s,l;let c;if(e){const b=CT({video:e});typeof b.video!="boolean"&&(c=b.video)}yield this.restart(c);try{for(var h=!0,p=pc(this.simulcastCodecs.values()),v;v=yield p.next(),n=v.done,!n;h=!0){s=v.value,h=!1;const b=s;b.sender&&((l=b.sender.transport)===null||l===void 0?void 0:l.state)!=="closed"&&(b.mediaStreamTrack=this.mediaStreamTrack.clone(),yield b.sender.replaceTrack(b.mediaStreamTrack))}}catch(b){r={error:b}}finally{try{!h&&!n&&(a=p.return)&&(yield a.call(p))}finally{if(r)throw r.error}}})}setProcessor(e){const n=Object.create(null,{setProcessor:{get:()=>super.setProcessor}});return Q(this,arguments,void 0,function(r){var a=this;let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){var l,c,h,p,v,b;if(yield n.setProcessor.call(a,r,s),!((v=a.processor)===null||v===void 0)&&v.processedTrack)try{for(var k=!0,T=pc(a.simulcastCodecs.values()),E;E=yield T.next(),l=E.done,!l;k=!0)p=E.value,k=!1,yield(b=p.sender)===null||b===void 0?void 0:b.replaceTrack(a.processor.processedTrack)}catch(R){c={error:R}}finally{try{!k&&!l&&(h=T.return)&&(yield h.call(T))}finally{if(c)throw c.error}}}()})}setDegradationPreference(e){return Q(this,void 0,void 0,function*(){if(this.degradationPreference=e,this.sender)try{this.log.debug("setting degradationPreference to ".concat(e),this.logContext);const n=this.sender.getParameters();n.degradationPreference=e,this.sender.setParameters(n)}catch(n){this.log.warn("failed to set degradationPreference",Object.assign({error:n},this.logContext))}})}addSimulcastTrack(e,n){if(this.simulcastCodecs.has(e)){this.log.error("".concat(e," already added, skipping adding simulcast codec"),this.logContext);return}const r={codec:e,mediaStreamTrack:this.mediaStreamTrack.clone(),sender:void 0,encodings:n};return this.simulcastCodecs.set(e,r),r}setSimulcastTrackSender(e,n){const r=this.simulcastCodecs.get(e);r&&(r.sender=n,setTimeout(()=>{this.subscribedCodecs&&this.setPublishingCodecs(this.subscribedCodecs)},rz))}setPublishingCodecs(e){return Q(this,void 0,void 0,function*(){var n,r,a,s,l,c,h;if(this.log.debug("setting publishing codecs",Object.assign(Object.assign({},this.logContext),{codecs:e,currentCodec:this.codec})),!this.codec&&e.length>0)return yield this.setPublishingLayers(e[0].qualities),[];this.subscribedCodecs=e;const p=[];try{for(n=!0,r=pc(e);a=yield r.next(),s=a.done,!s;n=!0){h=a.value,n=!1;const v=h;if(!this.codec||this.codec===v.codec)yield this.setPublishingLayers(v.qualities);else{const b=this.simulcastCodecs.get(v.codec);if(this.log.debug("try setPublishingCodec for ".concat(v.codec),Object.assign(Object.assign({},this.logContext),{simulcastCodecInfo:b})),!b||!b.sender){for(const k of v.qualities)if(k.enabled){p.push(v.codec);break}}else b.encodings&&(this.log.debug("try setPublishingLayersForSender ".concat(v.codec),this.logContext),yield IO(b.sender,b.encodings,v.qualities,this.senderLock,this.log,this.logContext))}}}catch(v){l={error:v}}finally{try{!n&&!s&&(c=r.return)&&(yield c.call(r))}finally{if(l)throw l.error}}return p})}setPublishingLayers(e){return Q(this,void 0,void 0,function*(){this.log.debug("setting publishing layers",Object.assign(Object.assign({},this.logContext),{qualities:e})),!(!this.sender||!this.encodings)&&(yield IO(this.sender,this.encodings,e,this.senderLock,this.log,this.logContext))})}handleAppVisibilityChanged(){const e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return Q(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),oO()&&this.isInBackground&&this.source===De.Source.Camera&&(this._mediaStreamTrack.enabled=!1)})}}function IO(t,e,n,r,a,s){return Q(this,void 0,void 0,function*(){const l=yield r.lock();a.debug("setPublishingLayersForSender",Object.assign(Object.assign({},s),{sender:t,qualities:n,senderEncodings:e}));try{const c=t.getParameters(),{encodings:h}=c;if(!h)return;if(h.length!==e.length){a.warn("cannot set publishing layers, encodings mismatch",Object.assign(Object.assign({},s),{encodings:h,senderEncodings:e}));return}let p=!1;const v=ws();if((v==null?void 0:v.name)==="Chrome"&&bc(v==null?void 0:v.version,"133")>0&&h[0].scalabilityMode){const k=h[0],T=new cb(k.scalabilityMode);let E=Nh.OFF;if(n.forEach(R=>{R.enabled&&(E===Nh.OFF||R.quality>E)&&(E=R.quality)}),E===Nh.OFF)k.active&&(k.active=!1,p=!0);else if(!k.active||T.spatial!==E+1){p=!0,k.active=!0;const R=new cb(e[0].scalabilityMode);T.spatial=E+1,T.suffix=R.suffix,T.spatial===1&&(T.suffix=void 0),k.scalabilityMode=T.toString(),k.scaleResolutionDownBy=Math.pow(2,2-E),e[0].maxBitrate&&(k.maxBitrate=e[0].maxBitrate/(k.scaleResolutionDownBy*k.scaleResolutionDownBy))}}else h.forEach((k,T)=>{var E;let R=(E=k.rid)!==null&&E!==void 0?E:"";R===""&&(R="q");const M=UO(R),A=n.find(U=>U.quality===M);A&&k.active!==A.enabled&&(p=!0,k.active=A.enabled,a.debug("setting layer ".concat(A.quality," to ").concat(k.active?"enabled":"disabled"),s),Bh()&&(A.enabled?(k.scaleResolutionDownBy=e[T].scaleResolutionDownBy,k.maxBitrate=e[T].maxBitrate,k.maxFrameRate=e[T].maxFrameRate):(k.scaleResolutionDownBy=4,k.maxBitrate=10,k.maxFrameRate=2)))});p&&(c.encodings=h,a.debug("setting encodings",Object.assign(Object.assign({},s),{encodings:c.encodings})),yield t.setParameters(c))}finally{l()}})}function UO(t){switch(t){case"f":return Go.HIGH;case"h":return Go.MEDIUM;case"q":return Go.LOW;default:return Go.HIGH}}function FO(t,e,n,r){if(!n)return[new Gd({quality:Go.HIGH,width:t,height:e,bitrate:0,ssrc:0})];if(r){const a=n[0].scalabilityMode,s=new cb(a),l=[],c=s.suffix=="h"?1.5:2,h=s.suffix=="h"?2:3;for(let p=0;p<s.spatial;p+=1)l.push(new Gd({quality:Math.min(Go.HIGH,s.spatial-1)-p,width:Math.ceil(t/Math.pow(c,p)),height:Math.ceil(e/Math.pow(c,p)),bitrate:n[0].maxBitrate?Math.ceil(n[0].maxBitrate/Math.pow(h,p)):0,ssrc:0}));return l}return n.map(a=>{var s,l,c;const h=(s=a.scaleResolutionDownBy)!==null&&s!==void 0?s:1;let p=UO((l=a.rid)!==null&&l!==void 0?l:"");return new Gd({quality:p,width:Math.ceil(t/h),height:Math.ceil(e/h),bitrate:(c=a.maxBitrate)!==null&&c!==void 0?c:0,ssrc:0})})}const jO="_lossy",VO="_reliable",iz=2*1e3,IT="leave-reconnect";var Es;(function(t){t[t.New=0]="New",t[t.Connected=1]="Connected",t[t.Disconnected=2]="Disconnected",t[t.Reconnecting=3]="Reconnecting",t[t.Closed=4]="Closed"})(Es||(Es={}));class az extends dl.EventEmitter{get isClosed(){return this._isClosed}get pendingReconnect(){return!!this.reconnectTimeout}constructor(e){var n;super(),this.options=e,this.rtcConfig={},this.peerConnectionTimeout=DT.peerConnectionTimeout,this.fullReconnectOnNext=!1,this.subscriberPrimary=!1,this.pcState=Es.New,this._isClosed=!0,this.pendingTrackResolvers={},this.reconnectAttempts=0,this.reconnectStart=0,this.attemptingReconnect=!1,this.joinAttempts=0,this.maxJoinAttempts=1,this.shouldFailNext=!1,this.log=Nn,this.handleDataChannel=r=>Q(this,[r],void 0,function(a){var s=this;let{channel:l}=a;return function*(){if(l){if(l.label===VO)s.reliableDCSub=l;else if(l.label===jO)s.lossyDCSub=l;else return;s.log.debug("on data channel ".concat(l.id,", ").concat(l.label),s.logContext),l.onmessage=s.handleDataMessage}}()}),this.handleDataMessage=r=>Q(this,void 0,void 0,function*(){var a,s;const l=yield this.dataProcessLock.lock();try{let c;if(r.data instanceof ArrayBuffer)c=r.data;else if(r.data instanceof Blob)c=yield r.data.arrayBuffer();else{this.log.error("unsupported data type",Object.assign(Object.assign({},this.logContext),{data:r.data}));return}const h=ro.fromBinary(new Uint8Array(c));((a=h.value)===null||a===void 0?void 0:a.case)==="speaker"?this.emit(tt.ActiveSpeakersUpdate,h.value.value.speakers):(((s=h.value)===null||s===void 0?void 0:s.case)==="user"&&sz(h,h.value.value),this.emit(tt.DataPacketReceived,h))}finally{l()}}),this.handleDataError=r=>{const s=r.currentTarget.maxRetransmits===0?"lossy":"reliable";if(r instanceof ErrorEvent&&r.error){const{error:l}=r.error;this.log.error("DataChannel error on ".concat(s,": ").concat(r.message),Object.assign(Object.assign({},this.logContext),{error:l}))}else this.log.error("Unknown DataChannel error on ".concat(s),Object.assign(Object.assign({},this.logContext),{event:r}))},this.handleBufferedAmountLow=r=>{const s=r.currentTarget.maxRetransmits===0?$n.LOSSY:$n.RELIABLE;this.updateAndEmitDCBufferStatus(s)},this.handleDisconnect=(r,a)=>{if(this._isClosed)return;this.log.warn("".concat(r," disconnected"),this.logContext),this.reconnectAttempts===0&&(this.reconnectStart=Date.now());const s=h=>{this.log.warn("could not recover connection after ".concat(this.reconnectAttempts," attempts, ").concat(h,"ms. giving up"),this.logContext),this.emit(tt.Disconnected),this.close()},l=Date.now()-this.reconnectStart;let c=this.getNextRetryDelay({elapsedMs:l,retryCount:this.reconnectAttempts});if(c===null){s(l);return}r===IT&&(c=0),this.log.debug("reconnecting in ".concat(c,"ms"),this.logContext),this.clearReconnectTimeout(),this.token&&this.regionUrlProvider&&this.regionUrlProvider.updateToken(this.token),this.reconnectTimeout=Qi.setTimeout(()=>this.attemptReconnect(a).finally(()=>this.reconnectTimeout=void 0),c)},this.waitForRestarted=()=>new Promise((r,a)=>{this.pcState===Es.Connected&&r();const s=()=>{this.off(tt.Disconnected,l),r()},l=()=>{this.off(tt.Restarted,s),a()};this.once(tt.Restarted,s),this.once(tt.Disconnected,l)}),this.updateAndEmitDCBufferStatus=r=>{const a=this.isBufferStatusLow(r);typeof a<"u"&&a!==this.dcBufferStatus.get(r)&&(this.dcBufferStatus.set(r,a),this.emit(tt.DCBufferStatusChanged,a,r))},this.isBufferStatusLow=r=>{const a=this.dataChannelForKind(r);if(a)return a.bufferedAmount<=a.bufferedAmountLowThreshold},this.handleBrowserOnLine=()=>{this.client.currentState===Or.RECONNECTING&&(this.clearReconnectTimeout(),this.attemptReconnect(Ih.RR_SIGNAL_DISCONNECTED))},this.log=lu((n=e.loggerName)!==null&&n!==void 0?n:xs.Engine),this.loggerOptions={loggerName:e.loggerName,loggerContextCb:()=>this.logContext},this.client=new TT(void 0,this.loggerOptions),this.client.signalLatency=this.options.expSignalLatency,this.reconnectPolicy=this.options.reconnectPolicy,this.registerOnLineListener(),this.closingLock=new to,this.dataProcessLock=new to,this.dcBufferStatus=new Map([[$n.LOSSY,!0],[$n.RELIABLE,!0]]),this.client.onParticipantUpdate=r=>this.emit(tt.ParticipantUpdate,r),this.client.onConnectionQuality=r=>this.emit(tt.ConnectionQualityUpdate,r),this.client.onRoomUpdate=r=>this.emit(tt.RoomUpdate,r),this.client.onSubscriptionError=r=>this.emit(tt.SubscriptionError,r),this.client.onSubscriptionPermissionUpdate=r=>this.emit(tt.SubscriptionPermissionUpdate,r),this.client.onSpeakersChanged=r=>this.emit(tt.SpeakersChanged,r),this.client.onStreamStateUpdate=r=>this.emit(tt.StreamStateChanged,r),this.client.onRequestResponse=r=>this.emit(tt.SignalRequestResponse,r)}get logContext(){var e,n,r,a,s,l,c,h;return{room:(n=(e=this.latestJoinResponse)===null||e===void 0?void 0:e.room)===null||n===void 0?void 0:n.name,roomID:(a=(r=this.latestJoinResponse)===null||r===void 0?void 0:r.room)===null||a===void 0?void 0:a.sid,participant:(l=(s=this.latestJoinResponse)===null||s===void 0?void 0:s.participant)===null||l===void 0?void 0:l.identity,pID:(h=(c=this.latestJoinResponse)===null||c===void 0?void 0:c.participant)===null||h===void 0?void 0:h.sid}}join(e,n,r,a){return Q(this,void 0,void 0,function*(){this.url=e,this.token=n,this.signalOpts=r,this.maxJoinAttempts=r.maxRetries;try{this.joinAttempts+=1,this.setupSignalClientCallbacks();const s=yield this.client.join(e,n,r,a);return this._isClosed=!1,this.latestJoinResponse=s,this.subscriberPrimary=s.subscriberPrimary,this.pcManager||(yield this.configure(s)),(!this.subscriberPrimary||s.fastPublish)&&this.negotiate(),this.clientConfiguration=s.clientConfiguration,setTimeout(()=>{this.emit(tt.SignalConnected)},10),s}catch(s){if(s instanceof br&&s.reason===Un.ServerUnreachable&&(this.log.warn("Couldn't connect to server, attempt ".concat(this.joinAttempts," of ").concat(this.maxJoinAttempts),this.logContext),this.joinAttempts<this.maxJoinAttempts))return this.join(e,n,r,a);throw s}})}close(){return Q(this,void 0,void 0,function*(){const e=yield this.closingLock.lock();if(this.isClosed){e();return}try{this._isClosed=!0,this.joinAttempts=0,this.emit(tt.Closing),this.removeAllListeners(),this.deregisterOnLineListener(),this.clearPendingReconnect(),yield this.cleanupPeerConnections(),yield this.cleanupClient()}finally{e()}})}cleanupPeerConnections(){return Q(this,void 0,void 0,function*(){var e;yield(e=this.pcManager)===null||e===void 0?void 0:e.close(),this.pcManager=void 0;const n=r=>{r&&(r.close(),r.onbufferedamountlow=null,r.onclose=null,r.onclosing=null,r.onerror=null,r.onmessage=null,r.onopen=null)};n(this.lossyDC),n(this.lossyDCSub),n(this.reliableDC),n(this.reliableDCSub),this.lossyDC=void 0,this.lossyDCSub=void 0,this.reliableDC=void 0,this.reliableDCSub=void 0})}cleanupClient(){return Q(this,void 0,void 0,function*(){yield this.client.close(),this.client.resetCallbacks()})}addTrack(e){if(this.pendingTrackResolvers[e.cid])throw new uu("a track with the same ID has already been published");return new Promise((n,r)=>{const a=setTimeout(()=>{delete this.pendingTrackResolvers[e.cid],r(new br("publication of local track timed out, no response from server",Un.InternalError))},1e4);this.pendingTrackResolvers[e.cid]={resolve:s=>{clearTimeout(a),n(s)},reject:()=>{clearTimeout(a),r(new Error("Cancelled publication by calling unpublish"))}},this.client.sendAddTrack(e)})}removeTrack(e){if(e.track&&this.pendingTrackResolvers[e.track.id]){const{reject:n}=this.pendingTrackResolvers[e.track.id];n&&n(),delete this.pendingTrackResolvers[e.track.id]}try{return this.pcManager.removeTrack(e),!0}catch(n){this.log.warn("failed to remove track",Object.assign(Object.assign({},this.logContext),{error:n}))}return!1}updateMuteStatus(e,n){this.client.sendMuteTrack(e,n)}get dataSubscriberReadyState(){var e;return(e=this.reliableDCSub)===null||e===void 0?void 0:e.readyState}getConnectedServerAddress(){return Q(this,void 0,void 0,function*(){var e;return(e=this.pcManager)===null||e===void 0?void 0:e.getConnectedAddress()})}setRegionUrlProvider(e){this.regionUrlProvider=e}configure(e){return Q(this,void 0,void 0,function*(){var n,r;if(this.pcManager&&this.pcManager.currentState!==Jr.NEW)return;this.participantSid=(n=e.participant)===null||n===void 0?void 0:n.sid;const a=this.makeRTCConfiguration(e);this.pcManager=new $V(a,e.subscriberPrimary,this.loggerOptions),this.emit(tt.TransportsCreated,this.pcManager.publisher,this.pcManager.subscriber),this.pcManager.onIceCandidate=(s,l)=>{this.client.sendIceCandidate(s,l)},this.pcManager.onPublisherOffer=s=>{this.client.sendOffer(s)},this.pcManager.onDataChannel=this.handleDataChannel,this.pcManager.onStateChange=(s,l,c)=>Q(this,void 0,void 0,function*(){if(this.log.debug("primary PC state changed ".concat(s),this.logContext),["closed","disconnected","failed"].includes(l)&&(this.publisherConnectionPromise=void 0),s===Jr.CONNECTED){const v=this.pcState===Es.New;this.pcState=Es.Connected,v&&this.emit(tt.Connected,e)}else s===Jr.FAILED&&this.pcState===Es.Connected&&(this.pcState=Es.Disconnected,this.handleDisconnect("peerconnection failed",c==="failed"?Ih.RR_SUBSCRIBER_FAILED:Ih.RR_PUBLISHER_FAILED));const h=this.client.isDisconnected||this.client.currentState===Or.RECONNECTING,p=[Jr.FAILED,Jr.CLOSING,Jr.CLOSED].includes(s);h&&p&&!this._isClosed&&this.emit(tt.Offline)}),this.pcManager.onTrack=s=>{this.emit(tt.MediaTrackAdded,s.track,s.streams[0],s.receiver)},oz((r=e.serverInfo)===null||r===void 0?void 0:r.protocol)||this.createDataChannels()})}setupSignalClientCallbacks(){this.client.onAnswer=e=>Q(this,void 0,void 0,function*(){this.pcManager&&(this.log.debug("received server answer",Object.assign(Object.assign({},this.logContext),{RTCSdpType:e.type})),yield this.pcManager.setPublisherAnswer(e))}),this.client.onTrickle=(e,n)=>{this.pcManager&&(this.log.debug("got ICE candidate from peer",Object.assign(Object.assign({},this.logContext),{candidate:e,target:n})),this.pcManager.addIceCandidate(e,n))},this.client.onOffer=e=>Q(this,void 0,void 0,function*(){if(!this.pcManager)return;const n=yield this.pcManager.createSubscriberAnswerFromOffer(e);this.client.sendAnswer(n)}),this.client.onLocalTrackPublished=e=>{var n;if(this.log.debug("received trackPublishedResponse",Object.assign(Object.assign({},this.logContext),{cid:e.cid,track:(n=e.track)===null||n===void 0?void 0:n.sid})),!this.pendingTrackResolvers[e.cid]){this.log.error("missing track resolver for ".concat(e.cid),Object.assign(Object.assign({},this.logContext),{cid:e.cid}));return}const{resolve:r}=this.pendingTrackResolvers[e.cid];delete this.pendingTrackResolvers[e.cid],r(e.track)},this.client.onLocalTrackUnpublished=e=>{this.emit(tt.LocalTrackUnpublished,e)},this.client.onLocalTrackSubscribed=e=>{this.emit(tt.LocalTrackSubscribed,e)},this.client.onTokenRefresh=e=>{this.token=e},this.client.onRemoteMuteChanged=(e,n)=>{this.emit(tt.RemoteMute,e,n)},this.client.onSubscribedQualityUpdate=e=>{this.emit(tt.SubscribedQualityUpdate,e)},this.client.onClose=()=>{this.handleDisconnect("signal",Ih.RR_SIGNAL_DISCONNECTED)},this.client.onLeave=e=>{switch(this.log.debug("client leave request",Object.assign(Object.assign({},this.logContext),{reason:e==null?void 0:e.reason})),e.regions&&this.regionUrlProvider&&(this.log.debug("updating regions",this.logContext),this.regionUrlProvider.setServerReportedRegions(e.regions)),e.action){case Fh.DISCONNECT:this.emit(tt.Disconnected,e==null?void 0:e.reason),this.close();break;case Fh.RECONNECT:this.fullReconnectOnNext=!0,this.handleDisconnect(IT);break;case Fh.RESUME:this.handleDisconnect(IT)}}}makeRTCConfiguration(e){var n;const r=Object.assign({},this.rtcConfig);if(!((n=this.signalOpts)===null||n===void 0)&&n.e2eeEnabled&&(this.log.debug("E2EE - setting up transports with insertable streams",this.logContext),r.encodedInsertableStreams=!0),e.iceServers&&!r.iceServers){const a=[];e.iceServers.forEach(s=>{const l={urls:s.urls};s.username&&(l.username=s.username),s.credential&&(l.credential=s.credential),a.push(l)}),r.iceServers=a}return e.clientConfiguration&&e.clientConfiguration.forceRelay===xg.ENABLED&&(r.iceTransportPolicy="relay"),r.sdpSemantics="unified-plan",r.continualGatheringPolicy="gather_continually",r}createDataChannels(){this.pcManager&&(this.lossyDC&&(this.lossyDC.onmessage=null,this.lossyDC.onerror=null),this.reliableDC&&(this.reliableDC.onmessage=null,this.reliableDC.onerror=null),this.lossyDC=this.pcManager.createPublisherDataChannel(jO,{ordered:!0,maxRetransmits:0}),this.reliableDC=this.pcManager.createPublisherDataChannel(VO,{ordered:!0}),this.lossyDC.onmessage=this.handleDataMessage,this.reliableDC.onmessage=this.handleDataMessage,this.lossyDC.onerror=this.handleDataError,this.reliableDC.onerror=this.handleDataError,this.lossyDC.bufferedAmountLowThreshold=65535,this.reliableDC.bufferedAmountLowThreshold=65535,this.lossyDC.onbufferedamountlow=this.handleBufferedAmountLow,this.reliableDC.onbufferedamountlow=this.handleBufferedAmountLow)}createSender(e,n,r){return Q(this,void 0,void 0,function*(){if(cT())return yield this.createTransceiverRTCRtpSender(e,n,r);if(dT())return this.log.warn("using add-track fallback",this.logContext),yield this.createRTCRtpSender(e.mediaStreamTrack);throw new xi("Required webRTC APIs not supported on this device")})}createSimulcastSender(e,n,r,a){return Q(this,void 0,void 0,function*(){if(cT())return this.createSimulcastTransceiverSender(e,n,r,a);if(dT())return this.log.debug("using add-track fallback",this.logContext),this.createRTCRtpSender(e.mediaStreamTrack);throw new xi("Cannot stream on this device")})}createTransceiverRTCRtpSender(e,n,r){return Q(this,void 0,void 0,function*(){if(!this.pcManager)throw new xi("publisher is closed");const a=[];e.mediaStream&&a.push(e.mediaStream),$h(e)&&(e.codec=n.videoCodec);const s={direction:"sendonly",streams:a};return r&&(s.sendEncodings=r),(yield this.pcManager.addPublisherTransceiver(e.mediaStreamTrack,s)).sender})}createSimulcastTransceiverSender(e,n,r,a){return Q(this,void 0,void 0,function*(){if(!this.pcManager)throw new xi("publisher is closed");const s={direction:"sendonly"};a&&(s.sendEncodings=a);const l=yield this.pcManager.addPublisherTransceiver(n.mediaStreamTrack,s);if(r.videoCodec)return e.setSimulcastTrackSender(r.videoCodec,l.sender),l.sender})}createRTCRtpSender(e){return Q(this,void 0,void 0,function*(){if(!this.pcManager)throw new xi("publisher is closed");return this.pcManager.addPublisherTrack(e)})}attemptReconnect(e){return Q(this,void 0,void 0,function*(){var n,r,a;if(!this._isClosed){if(this.attemptingReconnect){Nn.warn("already attempting reconnect, returning early",this.logContext);return}(((n=this.clientConfiguration)===null||n===void 0?void 0:n.resumeConnection)===xg.DISABLED||((a=(r=this.pcManager)===null||r===void 0?void 0:r.currentState)!==null&&a!==void 0?a:Jr.NEW)===Jr.NEW)&&(this.fullReconnectOnNext=!0);try{this.attemptingReconnect=!0,this.fullReconnectOnNext?yield this.restartConnection():yield this.resumeConnection(e),this.clearPendingReconnect(),this.fullReconnectOnNext=!1}catch(s){this.reconnectAttempts+=1;let l=!0;s instanceof xi?(this.log.debug("received unrecoverable error",Object.assign(Object.assign({},this.logContext),{error:s})),l=!1):s instanceof Wh||(this.fullReconnectOnNext=!0),l?this.handleDisconnect("reconnect",Ih.RR_UNKNOWN):(this.log.info("could not recover connection after ".concat(this.reconnectAttempts," attempts, ").concat(Date.now()-this.reconnectStart,"ms. giving up"),this.logContext),this.emit(tt.Disconnected),yield this.close())}finally{this.attemptingReconnect=!1}}})}getNextRetryDelay(e){try{return this.reconnectPolicy.nextRetryDelayInMs(e)}catch(n){this.log.warn("encountered error in reconnect policy",Object.assign(Object.assign({},this.logContext),{error:n}))}return null}restartConnection(e){return Q(this,void 0,void 0,function*(){var n,r,a;try{if(!this.url||!this.token)throw new xi("could not reconnect, url or token not saved");this.log.info("reconnecting, attempt: ".concat(this.reconnectAttempts),this.logContext),this.emit(tt.Restarting),this.client.isDisconnected||(yield this.client.sendLeave()),yield this.cleanupPeerConnections(),yield this.cleanupClient();let s;try{if(!this.signalOpts)throw this.log.warn("attempted connection restart, without signal options present",this.logContext),new Wh;s=yield this.join(e??this.url,this.token,this.signalOpts)}catch(l){throw l instanceof br&&l.reason===Un.NotAllowed?new xi("could not reconnect, token might be expired"):new Wh}if(this.shouldFailNext)throw this.shouldFailNext=!1,new Error("simulated failure");if(this.client.setReconnected(),this.emit(tt.SignalRestarted,s),yield this.waitForPCReconnected(),this.client.currentState!==Or.CONNECTED)throw new Wh("Signal connection got severed during reconnect");(n=this.regionUrlProvider)===null||n===void 0||n.resetAttempts(),this.emit(tt.Restarted)}catch(s){const l=yield(r=this.regionUrlProvider)===null||r===void 0?void 0:r.getNextBestRegionUrl();if(l){yield this.restartConnection(l);return}else throw(a=this.regionUrlProvider)===null||a===void 0||a.resetAttempts(),s}})}resumeConnection(e){return Q(this,void 0,void 0,function*(){var n;if(!this.url||!this.token)throw new xi("could not reconnect, url or token not saved");if(!this.pcManager)throw new xi("publisher and subscriber connections unset");this.log.info("resuming signal connection, attempt ".concat(this.reconnectAttempts),this.logContext),this.emit(tt.Resuming);let r;try{this.setupSignalClientCallbacks(),r=yield this.client.reconnect(this.url,this.token,this.participantSid,e)}catch(a){let s="";throw a instanceof Error&&(s=a.message,this.log.error(a.message,Object.assign(Object.assign({},this.logContext),{error:a}))),a instanceof br&&a.reason===Un.NotAllowed?new xi("could not reconnect, token might be expired"):a instanceof br&&a.reason===Un.LeaveRequest?a:new Wh(s)}if(this.emit(tt.SignalResumed),r){const a=this.makeRTCConfiguration(r);this.pcManager.updateConfiguration(a)}else this.log.warn("Did not receive reconnect response",this.logContext);if(this.shouldFailNext)throw this.shouldFailNext=!1,new Error("simulated failure");if(yield this.pcManager.triggerIceRestart(),yield this.waitForPCReconnected(),this.client.currentState!==Or.CONNECTED)throw new Wh("Signal connection got severed during reconnect");this.client.setReconnected(),((n=this.reliableDC)===null||n===void 0?void 0:n.readyState)==="open"&&this.reliableDC.id===null&&this.createDataChannels(),this.emit(tt.Resumed)})}waitForPCInitialConnection(e,n){return Q(this,void 0,void 0,function*(){if(!this.pcManager)throw new xi("PC manager is closed");yield this.pcManager.ensurePCTransportConnection(n,e)})}waitForPCReconnected(){return Q(this,void 0,void 0,function*(){this.pcState=Es.Reconnecting,this.log.debug("waiting for peer connection to reconnect",this.logContext);try{if(yield io(iz),!this.pcManager)throw new xi("PC manager is closed");yield this.pcManager.ensurePCTransportConnection(void 0,this.peerConnectionTimeout),this.pcState=Es.Connected}catch(e){throw this.pcState=Es.Disconnected,new br("could not establish PC connection, ".concat(e.message),Un.InternalError)}})}publishRpcResponse(e,n,r,a){return Q(this,void 0,void 0,function*(){const s=new ro({destinationIdentities:[e],kind:$n.RELIABLE,value:{case:"rpcResponse",value:new qD({requestId:n,value:a?{case:"error",value:a.toProto()}:{case:"payload",value:r??""}})}});yield this.sendDataPacket(s,$n.RELIABLE)})}publishRpcAck(e,n){return Q(this,void 0,void 0,function*(){const r=new ro({destinationIdentities:[e],kind:$n.RELIABLE,value:{case:"rpcAck",value:new $D({requestId:n})}});yield this.sendDataPacket(r,$n.RELIABLE)})}sendDataPacket(e,n){return Q(this,void 0,void 0,function*(){const r=e.toBinary();yield this.ensurePublisherConnected(n);const a=this.dataChannelForKind(n);a&&a.send(r),this.updateAndEmitDCBufferStatus(n)})}waitForBufferStatusLow(e){return new Promise((n,r)=>Q(this,void 0,void 0,function*(){if(this.isBufferStatusLow(e))n();else{const a=()=>r("Engine closed");for(this.once(tt.Closing,a);!this.dcBufferStatus.get(e);)yield io(10);this.off(tt.Closing,a),n()}}))}ensureDataTransportConnected(e){return Q(this,arguments,void 0,function(n){var r=this;let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.subscriberPrimary;return function*(){var s;if(!r.pcManager)throw new xi("PC manager is closed");const l=a?r.pcManager.subscriber:r.pcManager.publisher,c=a?"Subscriber":"Publisher";if(!l)throw new br("".concat(c," connection not set"),Un.InternalError);let h=!1;!a&&!r.dataChannelForKind(n,a)&&(r.createDataChannels(),h=!0),!h&&!a&&!r.pcManager.publisher.isICEConnected&&r.pcManager.publisher.getICEConnectionState()!=="checking"&&(h=!0),h&&r.negotiate();const p=r.dataChannelForKind(n,a);if((p==null?void 0:p.readyState)==="open")return;const v=new Date().getTime()+r.peerConnectionTimeout;for(;new Date().getTime()<v;){if(l.isICEConnected&&((s=r.dataChannelForKind(n,a))===null||s===void 0?void 0:s.readyState)==="open")return;yield io(50)}throw new br("could not establish ".concat(c," connection, state: ").concat(l.getICEConnectionState()),Un.InternalError)}()})}ensurePublisherConnected(e){return Q(this,void 0,void 0,function*(){this.publisherConnectionPromise||(this.publisherConnectionPromise=this.ensureDataTransportConnected(e,!1)),yield this.publisherConnectionPromise})}verifyTransport(){return!(!this.pcManager||this.pcManager.currentState!==Jr.CONNECTED||!this.client.ws||this.client.ws.readyState===WebSocket.CLOSED)}negotiate(){return Q(this,void 0,void 0,function*(){return new Promise((e,n)=>Q(this,void 0,void 0,function*(){if(!this.pcManager){n(new rT("PC manager is closed"));return}this.pcManager.requirePublisher(),this.pcManager.publisher.getTransceivers().length==0&&!this.lossyDC&&!this.reliableDC&&this.createDataChannels();const r=new AbortController,a=()=>{r.abort(),this.log.debug("engine disconnected while negotiation was ongoing",this.logContext),e()};this.isClosed&&n("cannot negotiate on closed engine"),this.on(tt.Closing,a),this.pcManager.publisher.once(qh.RTPVideoPayloadTypes,s=>{const l=new Map;s.forEach(c=>{const h=c.codec.toLowerCase();mV(h)&&l.set(c.payload,h)}),this.emit(tt.RTPVideoMapUpdate,l)});try{yield this.pcManager.negotiate(r),e()}catch(s){s instanceof rT&&(this.fullReconnectOnNext=!0),this.handleDisconnect("negotiation",Ih.RR_UNKNOWN),n(s)}finally{this.off(tt.Closing,a)}}))})}dataChannelForKind(e,n){if(n){if(e===$n.LOSSY)return this.lossyDCSub;if(e===$n.RELIABLE)return this.reliableDCSub}else{if(e===$n.LOSSY)return this.lossyDC;if(e===$n.RELIABLE)return this.reliableDC}}sendSyncState(e,n){var r,a;if(!this.pcManager){this.log.warn("sync state cannot be sent without peer connection setup",this.logContext);return}const s=this.pcManager.subscriber.getLocalDescription(),l=this.pcManager.subscriber.getRemoteDescription(),c=(a=(r=this.signalOpts)===null||r===void 0?void 0:r.autoSubscribe)!==null&&a!==void 0?a:!0,h=new Array,p=new Array;e.forEach(v=>{v.isDesired!==c&&h.push(v.trackSid),v.isEnabled||p.push(v.trackSid)}),this.client.sendSyncState(new uA({answer:s?sb({sdp:s.sdp,type:s.type}):void 0,offer:l?sb({sdp:l.sdp,type:l.type}):void 0,subscription:new q0({trackSids:h,subscribe:!c,participantTracks:[]}),publishTracks:xV(n),dataChannels:this.dataChannelsInfo(),trackSidsDisabled:p}))}failNext(){this.shouldFailNext=!0}dataChannelsInfo(){const e=[],n=(r,a)=>{(r==null?void 0:r.id)!==void 0&&r.id!==null&&e.push(new cA({label:r.label,id:r.id,target:a}))};return n(this.dataChannelForKind($n.LOSSY),Ts.PUBLISHER),n(this.dataChannelForKind($n.RELIABLE),Ts.PUBLISHER),n(this.dataChannelForKind($n.LOSSY,!0),Ts.SUBSCRIBER),n(this.dataChannelForKind($n.RELIABLE,!0),Ts.SUBSCRIBER),e}clearReconnectTimeout(){this.reconnectTimeout&&Qi.clearTimeout(this.reconnectTimeout)}clearPendingReconnect(){this.clearReconnectTimeout(),this.reconnectAttempts=0}registerOnLineListener(){ao()&&window.addEventListener("online",this.handleBrowserOnLine)}deregisterOnLineListener(){ao()&&window.removeEventListener("online",this.handleBrowserOnLine)}}class Wh extends Error{}function oz(t){return t!==void 0&&t>13}function sz(t,e){const n=t.participantIdentity?t.participantIdentity:e.participantIdentity;t.participantIdentity=n,e.participantIdentity=n;const r=t.destinationIdentities.length!==0?t.destinationIdentities:e.destinationIdentities;t.destinationIdentities=r,e.destinationIdentities=r}class UT{constructor(e,n){this.lastUpdateAt=0,this.settingsCacheTime=3e3,this.attemptedRegions=[],this.serverUrl=new URL(e),this.token=n}updateToken(e){this.token=e}isCloud(){return hT(this.serverUrl)}getServerUrl(){return this.serverUrl}getNextBestRegionUrl(e){return Q(this,void 0,void 0,function*(){if(!this.isCloud())throw Error("region availability is only supported for LiveKit Cloud domains");(!this.regionSettings||Date.now()-this.lastUpdateAt>this.settingsCacheTime)&&(this.regionSettings=yield this.fetchRegionSettings(e));const n=this.regionSettings.regions.filter(r=>!this.attemptedRegions.find(a=>a.url===r.url));if(n.length>0){const r=n[0];return this.attemptedRegions.push(r),Nn.debug("next region: ".concat(r.region)),r.url}else return null})}resetAttempts(){this.attemptedRegions=[]}fetchRegionSettings(e){return Q(this,void 0,void 0,function*(){const n=yield fetch("".concat(lz(this.serverUrl),"/regions"),{headers:{authorization:"Bearer ".concat(this.token)},signal:e});if(n.ok){const r=yield n.json();return this.lastUpdateAt=Date.now(),r}else throw new br("Could not fetch region settings: ".concat(n.statusText),n.status===401?Un.NotAllowed:Un.InternalError,n.status)})}setServerReportedRegions(e){this.regionSettings=e,this.lastUpdateAt=Date.now()}}function lz(t){return"".concat(t.protocol.replace("ws","http"),"//").concat(t.host,"/settings")}class zO{get info(){return this._info}constructor(e,n,r){this.reader=n,this.totalByteSize=r,this._info=e,this.bytesReceived=0}}class uz extends zO{handleChunkReceived(e){var n;this.bytesReceived+=e.content.byteLength;const r=this.totalByteSize?this.bytesReceived/this.totalByteSize:void 0;(n=this.onProgress)===null||n===void 0||n.call(this,r)}[Symbol.asyncIterator](){const e=this.reader.getReader();return{next:()=>Q(this,void 0,void 0,function*(){try{const{done:n,value:r}=yield e.read();return n?{done:!0,value:void 0}:(this.handleChunkReceived(r),{done:!1,value:r.content})}catch{return{done:!0,value:void 0}}}),return(){return Q(this,void 0,void 0,function*(){return e.releaseLock(),{done:!0,value:void 0}})}}}readAll(){return Q(this,void 0,void 0,function*(){var e,n,r,a;let s=new Set;try{for(var l=!0,c=pc(this),h;h=yield c.next(),e=h.done,!e;l=!0){a=h.value,l=!1;const p=a;s.add(p)}}catch(p){n={error:p}}finally{try{!l&&!e&&(r=c.return)&&(yield r.call(c))}finally{if(n)throw n.error}}return Array.from(s)})}}class cz extends zO{constructor(e,n,r){super(e,n,r),this.receivedChunks=new Map}handleChunkReceived(e){var n;const r=ab(e.chunkIndex),a=this.receivedChunks.get(r);if(a&&a.version>e.version)return;this.receivedChunks.set(r,e),this.bytesReceived+=e.content.byteLength;const s=this.totalByteSize?this.bytesReceived/this.totalByteSize:void 0;(n=this.onProgress)===null||n===void 0||n.call(this,s)}[Symbol.asyncIterator](){const e=this.reader.getReader(),n=new TextDecoder;return{next:()=>Q(this,void 0,void 0,function*(){try{const{done:r,value:a}=yield e.read();return r?{done:!0,value:void 0}:(this.handleChunkReceived(a),{done:!1,value:n.decode(a.content)})}catch{return{done:!0,value:void 0}}}),return(){return Q(this,void 0,void 0,function*(){return e.releaseLock(),{done:!0,value:void 0}})}}}readAll(){return Q(this,void 0,void 0,function*(){var e,n,r,a;let s="";try{for(var l=!0,c=pc(this),h;h=yield c.next(),e=h.done,!e;l=!0)a=h.value,l=!1,s+=a}catch(p){n={error:p}}finally{try{!l&&!e&&(r=c.return)&&(yield r.call(c))}finally{if(n)throw n.error}}return s})}}class BO{constructor(e,n,r){this.writableStream=e,this.defaultWriter=e.getWriter(),this.onClose=r,this.info=n}write(e){return this.defaultWriter.write(e)}close(){return Q(this,void 0,void 0,function*(){var e;yield this.defaultWriter.close(),this.defaultWriter.releaseLock(),(e=this.onClose)===null||e===void 0||e.call(this)})}}class dz extends BO{}class fz extends BO{}class HO extends De{constructor(e,n,r,a,s){super(e,r,s),this.sid=n,this.receiver=a}get isLocal(){return!1}setMuted(e){this.isMuted!==e&&(this.isMuted=e,this._mediaStreamTrack.enabled=!e,this.emit(e?Qe.Muted:Qe.Unmuted,this))}setMediaStream(e){this.mediaStream=e;const n=r=>{r.track===this._mediaStreamTrack&&(e.removeEventListener("removetrack",n),this.receiver&&"playoutDelayHint"in this.receiver&&(this.receiver.playoutDelayHint=void 0),this.receiver=void 0,this._currentBitrate=0,this.emit(Qe.Ended,this))};e.addEventListener("removetrack",n)}start(){this.startMonitor(),super.enable()}stop(){this.stopMonitor(),super.disable()}getRTCStatsReport(){return Q(this,void 0,void 0,function*(){var e;return!((e=this.receiver)===null||e===void 0)&&e.getStats?yield this.receiver.getStats():void 0})}setPlayoutDelay(e){this.receiver?"playoutDelayHint"in this.receiver?this.receiver.playoutDelayHint=e:this.log.warn("Playout delay not supported in this browser"):this.log.warn("Cannot set playout delay, track already ended")}getPlayoutDelay(){if(this.receiver){if("playoutDelayHint"in this.receiver)return this.receiver.playoutDelayHint;this.log.warn("Playout delay not supported in this browser")}else this.log.warn("Cannot get playout delay, track already ended");return 0}startMonitor(){this.monitorInterval||(this.monitorInterval=setInterval(()=>this.monitorReceiver(),OT)),wV()&&this.registerTimeSyncUpdate()}registerTimeSyncUpdate(){const e=()=>{var n;this.timeSyncHandle=requestAnimationFrame(()=>e());const r=(n=this.receiver)===null||n===void 0?void 0:n.getSynchronizationSources()[0];if(r){const{timestamp:a,rtpTimestamp:s}=r;s&&this.rtpTimestamp!==s&&(this.emit(Qe.TimeSyncUpdate,{timestamp:a,rtpTimestamp:s}),this.rtpTimestamp=s)}};e()}}class $O extends HO{constructor(e,n,r,a,s,l){super(e,n,De.Kind.Audio,r,l),this.monitorReceiver=()=>Q(this,void 0,void 0,function*(){if(!this.receiver){this._currentBitrate=0;return}const c=yield this.getReceiverStats();c&&this.prevStats&&this.receiver&&(this._currentBitrate=lb(c,this.prevStats)),this.prevStats=c}),this.audioContext=a,this.webAudioPluginNodes=[],s&&(this.sinkId=s.deviceId)}setVolume(e){var n;for(const r of this.attachedElements)this.audioContext?(n=this.gainNode)===null||n===void 0||n.gain.setTargetAtTime(e,0,.1):r.volume=e;fl()&&this._mediaStreamTrack._setVolume(e),this.elementVolume=e}getVolume(){if(this.elementVolume)return this.elementVolume;if(fl())return 1;let e=0;return this.attachedElements.forEach(n=>{n.volume>e&&(e=n.volume)}),e}setSinkId(e){return Q(this,void 0,void 0,function*(){this.sinkId=e,yield Promise.all(this.attachedElements.map(n=>{if(fT(n))return n.setSinkId(e)}))})}attach(e){const n=this.attachedElements.length===0;return e?super.attach(e):e=super.attach(),this.sinkId&&fT(e)&&e.setSinkId(this.sinkId),this.audioContext&&n&&(this.log.debug("using audio context mapping",this.logContext),this.connectWebAudio(this.audioContext,e),e.volume=0,e.muted=!0),this.elementVolume&&this.setVolume(this.elementVolume),e}detach(e){let n;return e?(n=super.detach(e),this.audioContext&&(this.attachedElements.length>0?this.connectWebAudio(this.audioContext,this.attachedElements[0]):this.disconnectWebAudio())):(n=super.detach(),this.disconnectWebAudio()),n}setAudioContext(e){this.audioContext=e,e&&this.attachedElements.length>0?this.connectWebAudio(e,this.attachedElements[0]):e||this.disconnectWebAudio()}setWebAudioPlugins(e){this.webAudioPluginNodes=e,this.attachedElements.length>0&&this.audioContext&&this.connectWebAudio(this.audioContext,this.attachedElements[0])}connectWebAudio(e,n){this.disconnectWebAudio(),this.sourceNode=e.createMediaStreamSource(n.srcObject);let r=this.sourceNode;this.webAudioPluginNodes.forEach(a=>{r.connect(a),r=a}),this.gainNode=e.createGain(),r.connect(this.gainNode),this.gainNode.connect(e.destination),this.elementVolume&&this.gainNode.gain.setTargetAtTime(this.elementVolume,0,.1),e.state!=="running"&&e.resume().then(()=>{e.state!=="running"&&this.emit(Qe.AudioPlaybackFailed,new Error("Audio Context couldn't be started automatically"))}).catch(a=>{this.emit(Qe.AudioPlaybackFailed,a)})}disconnectWebAudio(){var e,n;(e=this.gainNode)===null||e===void 0||e.disconnect(),(n=this.sourceNode)===null||n===void 0||n.disconnect(),this.gainNode=void 0,this.sourceNode=void 0}getReceiverStats(){return Q(this,void 0,void 0,function*(){if(!this.receiver||!this.receiver.getStats)return;const e=yield this.receiver.getStats();let n;return e.forEach(r=>{r.type==="inbound-rtp"&&(n={type:"audio",streamId:r.id,timestamp:r.timestamp,jitter:r.jitter,bytesReceived:r.bytesReceived,concealedSamples:r.concealedSamples,concealmentEvents:r.concealmentEvents,silentConcealedSamples:r.silentConcealedSamples,silentConcealmentEvents:r.silentConcealmentEvents,totalAudioEnergy:r.totalAudioEnergy,totalSamplesDuration:r.totalSamplesDuration})}),n})}}const FT=100;class hz extends HO{constructor(e,n,r,a,s){super(e,n,De.Kind.Video,r,s),this.elementInfos=[],this.monitorReceiver=()=>Q(this,void 0,void 0,function*(){if(!this.receiver){this._currentBitrate=0;return}const l=yield this.getReceiverStats();l&&this.prevStats&&this.receiver&&(this._currentBitrate=lb(l,this.prevStats)),this.prevStats=l}),this.debouncedHandleResize=RT(()=>{this.updateDimensions()},FT),this.adaptiveStreamSettings=a}get isAdaptiveStream(){return this.adaptiveStreamSettings!==void 0}get mediaStreamTrack(){return this._mediaStreamTrack}setMuted(e){super.setMuted(e),this.attachedElements.forEach(n=>{e?zh(this._mediaStreamTrack,n):Vh(this._mediaStreamTrack,n)})}attach(e){if(e?super.attach(e):e=super.attach(),this.adaptiveStreamSettings&&this.elementInfos.find(n=>n.element===e)===void 0){const n=new pz(e);this.observeElementInfo(n)}return e}observeElementInfo(e){this.adaptiveStreamSettings&&this.elementInfos.find(n=>n===e)===void 0?(e.handleResize=()=>{this.debouncedHandleResize()},e.handleVisibilityChanged=()=>{this.updateVisibility()},this.elementInfos.push(e),e.observe(),this.debouncedHandleResize(),this.updateVisibility()):this.log.warn("visibility resize observer not triggered",this.logContext)}stopObservingElementInfo(e){if(!this.isAdaptiveStream){this.log.warn("stopObservingElementInfo ignored",this.logContext);return}const n=this.elementInfos.filter(r=>r===e);for(const r of n)r.stopObserving();this.elementInfos=this.elementInfos.filter(r=>r!==e),this.updateVisibility(),this.debouncedHandleResize()}detach(e){let n=[];if(e)return this.stopObservingElement(e),super.detach(e);n=super.detach();for(const r of n)this.stopObservingElement(r);return n}getDecoderImplementation(){var e;return(e=this.prevStats)===null||e===void 0?void 0:e.decoderImplementation}getReceiverStats(){return Q(this,void 0,void 0,function*(){if(!this.receiver||!this.receiver.getStats)return;const e=yield this.receiver.getStats();let n,r="",a=new Map;return e.forEach(s=>{s.type==="inbound-rtp"?(r=s.codecId,n={type:"video",streamId:s.id,framesDecoded:s.framesDecoded,framesDropped:s.framesDropped,framesReceived:s.framesReceived,packetsReceived:s.packetsReceived,packetsLost:s.packetsLost,frameWidth:s.frameWidth,frameHeight:s.frameHeight,pliCount:s.pliCount,firCount:s.firCount,nackCount:s.nackCount,jitter:s.jitter,timestamp:s.timestamp,bytesReceived:s.bytesReceived,decoderImplementation:s.decoderImplementation}):s.type==="codec"&&a.set(s.id,s)}),n&&r!==""&&a.get(r)&&(n.mimeType=a.get(r).mimeType),n})}stopObservingElement(e){const n=this.elementInfos.filter(r=>r.element===e);for(const r of n)this.stopObservingElementInfo(r)}handleAppVisibilityChanged(){const e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return Q(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),this.isAdaptiveStream&&this.updateVisibility()})}updateVisibility(){var e,n;const r=this.elementInfos.reduce((c,h)=>Math.max(c,h.visibilityChangedAt||0),0),a=!((n=(e=this.adaptiveStreamSettings)===null||e===void 0?void 0:e.pauseVideoInBackground)!==null&&n!==void 0)||n?this.isInBackground:!1,s=this.elementInfos.some(c=>c.pictureInPicture),l=this.elementInfos.some(c=>c.visible)&&!a||s;if(this.lastVisible!==l){if(!l&&Date.now()-r<FT){Qi.setTimeout(()=>{this.updateVisibility()},FT);return}this.lastVisible=l,this.emit(Qe.VisibilityChanged,l,this)}}updateDimensions(){var e,n;let r=0,a=0;const s=this.getPixelDensity();for(const l of this.elementInfos){const c=l.width()*s,h=l.height()*s;c+h>r+a&&(r=c,a=h)}((e=this.lastDimensions)===null||e===void 0?void 0:e.width)===r&&((n=this.lastDimensions)===null||n===void 0?void 0:n.height)===a||(this.lastDimensions={width:r,height:a},this.emit(Qe.VideoDimensionsChanged,this.lastDimensions,this))}getPixelDensity(){var e;const n=(e=this.adaptiveStreamSettings)===null||e===void 0?void 0:e.pixelDensity;return n==="screen"?uO():n||(uO()>2?2:1)}}class pz{get visible(){return this.isPiP||this.isIntersecting}get pictureInPicture(){return this.isPiP}constructor(e,n){this.onVisibilityChanged=r=>{var a;const{target:s,isIntersecting:l}=r;s===this.element&&(this.isIntersecting=l,this.isPiP=Mg(this.element),this.visibilityChangedAt=Date.now(),(a=this.handleVisibilityChanged)===null||a===void 0||a.call(this))},this.onEnterPiP=()=>{var r,a,s;(a=(r=window.documentPictureInPicture)===null||r===void 0?void 0:r.window)===null||a===void 0||a.addEventListener("pagehide",this.onLeavePiP),this.isPiP=Mg(this.element),(s=this.handleVisibilityChanged)===null||s===void 0||s.call(this)},this.onLeavePiP=()=>{var r;this.isPiP=Mg(this.element),(r=this.handleVisibilityChanged)===null||r===void 0||r.call(this)},this.element=e,this.isIntersecting=n??jT(e),this.isPiP=ao()&&Mg(e),this.visibilityChangedAt=0}width(){return this.element.clientWidth}height(){return this.element.clientHeight}observe(){var e,n,r;this.isIntersecting=jT(this.element),this.isPiP=Mg(this.element),this.element.handleResize=()=>{var a;(a=this.handleResize)===null||a===void 0||a.call(this)},this.element.handleVisibilityChanged=this.onVisibilityChanged,dO().observe(this.element),cO().observe(this.element),this.element.addEventListener("enterpictureinpicture",this.onEnterPiP),this.element.addEventListener("leavepictureinpicture",this.onLeavePiP),(e=window.documentPictureInPicture)===null||e===void 0||e.addEventListener("enter",this.onEnterPiP),(r=(n=window.documentPictureInPicture)===null||n===void 0?void 0:n.window)===null||r===void 0||r.addEventListener("pagehide",this.onLeavePiP)}stopObserving(){var e,n,r,a,s;(e=dO())===null||e===void 0||e.unobserve(this.element),(n=cO())===null||n===void 0||n.unobserve(this.element),this.element.removeEventListener("enterpictureinpicture",this.onEnterPiP),this.element.removeEventListener("leavepictureinpicture",this.onLeavePiP),(r=window.documentPictureInPicture)===null||r===void 0||r.removeEventListener("enter",this.onEnterPiP),(s=(a=window.documentPictureInPicture)===null||a===void 0?void 0:a.window)===null||s===void 0||s.removeEventListener("pagehide",this.onLeavePiP)}}function Mg(t){var e,n;return document.pictureInPictureElement===t?!0:!((e=window.documentPictureInPicture)===null||e===void 0)&&e.window?jT(t,(n=window.documentPictureInPicture)===null||n===void 0?void 0:n.window):!1}function jT(t,e){const n=e||window;let r=t.offsetTop,a=t.offsetLeft;const s=t.offsetWidth,l=t.offsetHeight,{hidden:c}=t,{display:h}=getComputedStyle(t);for(;t.offsetParent;)t=t.offsetParent,r+=t.offsetTop,a+=t.offsetLeft;return r<n.pageYOffset+n.innerHeight&&a<n.pageXOffset+n.innerWidth&&r+l>n.pageYOffset&&a+s>n.pageXOffset&&!c&&h!=="none"}class du extends dl.EventEmitter{constructor(e,n,r,a){var s;super(),this.metadataMuted=!1,this.encryption=Po.NONE,this.log=Nn,this.handleMuted=()=>{this.emit(Qe.Muted)},this.handleUnmuted=()=>{this.emit(Qe.Unmuted)},this.log=lu((s=a==null?void 0:a.loggerName)!==null&&s!==void 0?s:xs.Publication),this.loggerContextCb=this.loggerContextCb,this.setMaxListeners(100),this.kind=e,this.trackSid=n,this.trackName=r,this.source=De.Source.Unknown}setTrack(e){this.track&&(this.track.off(Qe.Muted,this.handleMuted),this.track.off(Qe.Unmuted,this.handleUnmuted)),this.track=e,e&&(e.on(Qe.Muted,this.handleMuted),e.on(Qe.Unmuted,this.handleUnmuted))}get logContext(){var e;return Object.assign(Object.assign({},(e=this.loggerContextCb)===null||e===void 0?void 0:e.call(this)),ar(this))}get isMuted(){return this.metadataMuted}get isEnabled(){return!0}get isSubscribed(){return this.track!==void 0}get isEncrypted(){return this.encryption!==Po.NONE}get audioTrack(){if(cu(this.track))return this.track}get videoTrack(){if($h(this.track))return this.track}updateInfo(e){this.trackSid=e.sid,this.trackName=e.name,this.source=De.sourceFromProto(e.source),this.mimeType=e.mimeType,this.kind===De.Kind.Video&&e.width>0&&(this.dimensions={width:e.width,height:e.height},this.simulcasted=e.simulcast),this.encryption=e.encryption,this.trackInfo=e,this.log.debug("update publication info",Object.assign(Object.assign({},this.logContext),{info:e}))}}(function(t){(function(e){e.Desired="desired",e.Subscribed="subscribed",e.Unsubscribed="unsubscribed"})(t.SubscriptionStatus||(t.SubscriptionStatus={})),function(e){e.Allowed="allowed",e.NotAllowed="not_allowed"}(t.PermissionStatus||(t.PermissionStatus={}))})(du||(du={}));class VT extends du{get isUpstreamPaused(){var e;return(e=this.track)===null||e===void 0?void 0:e.isUpstreamPaused}constructor(e,n,r,a){super(e,n.sid,n.name,a),this.track=void 0,this.handleTrackEnded=()=>{this.emit(Qe.Ended)},this.updateInfo(n),this.setTrack(r)}setTrack(e){this.track&&this.track.off(Qe.Ended,this.handleTrackEnded),super.setTrack(e),e&&e.on(Qe.Ended,this.handleTrackEnded)}get isMuted(){return this.track?this.track.isMuted:super.isMuted}get audioTrack(){return super.audioTrack}get videoTrack(){return super.videoTrack}get isLocal(){return!0}mute(){return Q(this,void 0,void 0,function*(){var e;return(e=this.track)===null||e===void 0?void 0:e.mute()})}unmute(){return Q(this,void 0,void 0,function*(){var e;return(e=this.track)===null||e===void 0?void 0:e.unmute()})}pauseUpstream(){return Q(this,void 0,void 0,function*(){var e;yield(e=this.track)===null||e===void 0?void 0:e.pauseUpstream()})}resumeUpstream(){return Q(this,void 0,void 0,function*(){var e;yield(e=this.track)===null||e===void 0?void 0:e.resumeUpstream()})}getTrackFeatures(){var e;if(cu(this.track)){const n=this.track.getSourceTrackSettings(),r=new Set;return n.autoGainControl&&r.add(ul.TF_AUTO_GAIN_CONTROL),n.echoCancellation&&r.add(ul.TF_ECHO_CANCELLATION),n.noiseSuppression&&r.add(ul.TF_NOISE_SUPPRESSION),n.channelCount&&n.channelCount>1&&r.add(ul.TF_STEREO),!((e=this.options)===null||e===void 0)&&e.dtx||r.add(ul.TF_NO_DTX),this.track.enhancedNoiseCancellation&&r.add(ul.TF_ENHANCED_NOISE_CANCELLATION),Array.from(r.values())}else return[]}}function fb(t,e){return Q(this,void 0,void 0,function*(){t??(t={});let n=!1;const{audioProcessor:r,videoProcessor:a,optionsWithoutProcessor:s}=bO(t);let l=s.audio,c=s.video;if(r&&typeof s.audio=="object"&&(s.audio.processor=r),a&&typeof s.video=="object"&&(s.video.processor=a),t.audio&&typeof s.audio=="object"&&typeof s.audio.deviceId=="string"){const b=s.audio.deviceId;s.audio.deviceId={exact:b},n=!0,l=Object.assign(Object.assign({},s.audio),{deviceId:{ideal:b}})}if(s.video&&typeof s.video=="object"&&typeof s.video.deviceId=="string"){const b=s.video.deviceId;s.video.deviceId={exact:b},n=!0,c=Object.assign(Object.assign({},s.video),{deviceId:{ideal:b}})}(s.audio===!0||typeof s.audio=="object"&&!s.audio.deviceId)&&(s.audio={deviceId:"default"}),(s.video===!0||typeof s.video=="object"&&!s.video.deviceId)&&(s.video={deviceId:"default"});const h=mO(s,PO,DO),p=CT(h),v=navigator.mediaDevices.getUserMedia(p);s.audio&&(zi.userMediaPromiseMap.set("audioinput",v),v.catch(()=>zi.userMediaPromiseMap.delete("audioinput"))),s.video&&(zi.userMediaPromiseMap.set("videoinput",v),v.catch(()=>zi.userMediaPromiseMap.delete("videoinput")));try{const b=yield v;return yield Promise.all(b.getTracks().map(k=>Q(this,void 0,void 0,function*(){const T=k.kind==="audio";let E=T?h.audio:h.video;(typeof E=="boolean"||!E)&&(E={});let R;const M=T?p.audio:p.video;typeof M!="boolean"&&(R=M);const A=k.getSettings().deviceId;R!=null&&R.deviceId&&Sc(R.deviceId)!==A?R.deviceId=A:R||(R={deviceId:A});const U=WV(k,R,e);return U.kind===De.Kind.Video?U.source=De.Source.Camera:U.kind===De.Kind.Audio&&(U.source=De.Source.Microphone),U.mediaStream=b,cu(U)&&r?yield U.setProcessor(r):$h(U)&&a&&(yield U.setProcessor(a)),U})))}catch(b){if(!n)throw b;return fb(Object.assign(Object.assign({},t),{audio:l,video:c}),e)}})}function mz(t){return Q(this,void 0,void 0,function*(){return(yield fb({audio:!1,video:!0}))[0]})}function gz(t){return Q(this,void 0,void 0,function*(){return(yield fb({audio:!0,video:!1}))[0]})}var Tc;(function(t){t.Excellent="excellent",t.Good="good",t.Poor="poor",t.Lost="lost",t.Unknown="unknown"})(Tc||(Tc={}));function vz(t){switch(t){case Tg.EXCELLENT:return Tc.Excellent;case Tg.GOOD:return Tc.Good;case Tg.POOR:return Tc.Poor;case Tg.LOST:return Tc.Lost;default:return Tc.Unknown}}class qO extends dl.EventEmitter{get logContext(){var e,n;return Object.assign({},(n=(e=this.loggerOptions)===null||e===void 0?void 0:e.loggerContextCb)===null||n===void 0?void 0:n.call(e))}get isEncrypted(){return this.trackPublications.size>0&&Array.from(this.trackPublications.values()).every(e=>e.isEncrypted)}get isAgent(){var e;return((e=this.permissions)===null||e===void 0?void 0:e.agent)||this.kind===_g.AGENT}get kind(){return this._kind}get attributes(){return Object.freeze(Object.assign({},this._attributes))}constructor(e,n,r,a,s,l){let c=arguments.length>6&&arguments[6]!==void 0?arguments[6]:_g.STANDARD;var h;super(),this.audioLevel=0,this.isSpeaking=!1,this._connectionQuality=Tc.Unknown,this.log=Nn,this.log=lu((h=l==null?void 0:l.loggerName)!==null&&h!==void 0?h:xs.Participant),this.loggerOptions=l,this.setMaxListeners(100),this.sid=e,this.identity=n,this.name=r,this.metadata=a,this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.trackPublications=new Map,this._kind=c,this._attributes=s??{}}getTrackPublications(){return Array.from(this.trackPublications.values())}getTrackPublication(e){for(const[,n]of this.trackPublications)if(n.source===e)return n}getTrackPublicationByName(e){for(const[,n]of this.trackPublications)if(n.trackName===e)return n}get connectionQuality(){return this._connectionQuality}get isCameraEnabled(){var e;const n=this.getTrackPublication(De.Source.Camera);return!(!((e=n==null?void 0:n.isMuted)!==null&&e!==void 0)||e)}get isMicrophoneEnabled(){var e;const n=this.getTrackPublication(De.Source.Microphone);return!(!((e=n==null?void 0:n.isMuted)!==null&&e!==void 0)||e)}get isScreenShareEnabled(){return!!this.getTrackPublication(De.Source.ScreenShare)}get isLocal(){return!1}get joinedAt(){return this.participantInfo?new Date(Number.parseInt(this.participantInfo.joinedAt.toString())*1e3):new Date}updateInfo(e){return this.participantInfo&&this.participantInfo.sid===e.sid&&this.participantInfo.version>e.version?!1:(this.identity=e.identity,this.sid=e.sid,this._setName(e.name),this._setMetadata(e.metadata),this._setAttributes(e.attributes),e.permission&&this.setPermissions(e.permission),this.participantInfo=e,this.log.trace("update participant info",Object.assign(Object.assign({},this.logContext),{info:e})),!0)}_setMetadata(e){const n=this.metadata!==e,r=this.metadata;this.metadata=e,n&&this.emit(Ie.ParticipantMetadataChanged,r)}_setName(e){const n=this.name!==e;this.name=e,n&&this.emit(Ie.ParticipantNameChanged,e)}_setAttributes(e){const n=_V(this.attributes,e);this._attributes=e,Object.keys(n).length>0&&this.emit(Ie.AttributesChanged,n)}setPermissions(e){var n,r,a,s,l,c;const h=this.permissions,p=e.canPublish!==((n=this.permissions)===null||n===void 0?void 0:n.canPublish)||e.canSubscribe!==((r=this.permissions)===null||r===void 0?void 0:r.canSubscribe)||e.canPublishData!==((a=this.permissions)===null||a===void 0?void 0:a.canPublishData)||e.hidden!==((s=this.permissions)===null||s===void 0?void 0:s.hidden)||e.recorder!==((l=this.permissions)===null||l===void 0?void 0:l.recorder)||e.canPublishSources.length!==this.permissions.canPublishSources.length||e.canPublishSources.some((v,b)=>{var k;return v!==((k=this.permissions)===null||k===void 0?void 0:k.canPublishSources[b])})||e.canSubscribeMetrics!==((c=this.permissions)===null||c===void 0?void 0:c.canSubscribeMetrics);return this.permissions=e,p&&this.emit(Ie.ParticipantPermissionsChanged,h),p}setIsSpeaking(e){e!==this.isSpeaking&&(this.isSpeaking=e,e&&(this.lastSpokeAt=new Date),this.emit(Ie.IsSpeakingChanged,e))}setConnectionQuality(e){const n=this._connectionQuality;this._connectionQuality=vz(e),n!==this._connectionQuality&&this.emit(Ie.ConnectionQualityChanged,this._connectionQuality)}setAudioContext(e){this.audioContext=e,this.audioTrackPublications.forEach(n=>cu(n.track)&&n.track.setAudioContext(e))}addTrackPublication(e){e.on(Qe.Muted,()=>{this.emit(Ie.TrackMuted,e)}),e.on(Qe.Unmuted,()=>{this.emit(Ie.TrackUnmuted,e)});const n=e;switch(n.track&&(n.track.sid=e.trackSid),this.trackPublications.set(e.trackSid,e),e.kind){case De.Kind.Audio:this.audioTrackPublications.set(e.trackSid,e);break;case De.Kind.Video:this.videoTrackPublications.set(e.trackSid,e);break}}}function yz(t){var e,n,r;if(!t.participantSid&&!t.participantIdentity)throw new Error("Invalid track permission, must provide at least one of participantIdentity and participantSid");return new sA({participantIdentity:(e=t.participantIdentity)!==null&&e!==void 0?e:"",participantSid:(n=t.participantSid)!==null&&n!==void 0?n:"",allTracks:(r=t.allowAll)!==null&&r!==void 0?r:!1,trackSids:t.allowedTrackSids||[]})}const WO=15e3;class hb extends qO{constructor(e,n,r,a,s){super(e,n,void 0,void 0,void 0,{loggerName:a.loggerName,loggerContextCb:()=>this.engine.logContext}),this.pendingPublishing=new Set,this.pendingPublishPromises=new Map,this.participantTrackPermissions=[],this.allParticipantsAllowedToSubscribe=!0,this.encryptionType=Po.NONE,this.enabledPublishVideoCodecs=[],this.pendingAcks=new Map,this.pendingResponses=new Map,this.handleReconnecting=()=>{this.reconnectFuture||(this.reconnectFuture=new hO)},this.handleReconnected=()=>{var l,c;(c=(l=this.reconnectFuture)===null||l===void 0?void 0:l.resolve)===null||c===void 0||c.call(l),this.reconnectFuture=void 0,this.updateTrackSubscriptionPermissions()},this.handleDisconnected=()=>{var l,c;this.reconnectFuture&&(this.reconnectFuture.promise.catch(h=>this.log.warn(h.message,this.logContext)),(c=(l=this.reconnectFuture)===null||l===void 0?void 0:l.reject)===null||c===void 0||c.call(l,"Got disconnected during reconnection attempt"),this.reconnectFuture=void 0)},this.handleSignalRequestResponse=l=>{const{requestId:c,reason:h,message:p}=l,v=this.pendingSignalRequests.get(c);v&&(h!==q1.OK&&v.reject(new nO(p,h)),this.pendingSignalRequests.delete(c))},this.handleDataPacket=l=>{switch(l.value.case){case"rpcResponse":let c=l.value.value,h=null,p=null;c.value.case==="payload"?h=c.value.value:c.value.case==="error"&&(p=ei.fromProto(c.value.value)),this.handleIncomingRpcResponse(c.requestId,h,p);break;case"rpcAck":let v=l.value.value;this.handleIncomingRpcAck(v.requestId);break}},this.updateTrackSubscriptionPermissions=()=>{this.log.debug("updating track subscription permissions",Object.assign(Object.assign({},this.logContext),{allParticipantsAllowed:this.allParticipantsAllowedToSubscribe,participantTrackPermissions:this.participantTrackPermissions})),this.engine.client.sendUpdateSubscriptionPermissions(this.allParticipantsAllowedToSubscribe,this.participantTrackPermissions.map(l=>yz(l)))},this.onTrackUnmuted=l=>{this.onTrackMuted(l,l.isUpstreamPaused)},this.onTrackMuted=(l,c)=>{if(c===void 0&&(c=!0),!l.sid){this.log.error("could not update mute status for unpublished track",Object.assign(Object.assign({},this.logContext),ar(l)));return}this.engine.updateMuteStatus(l.sid,c)},this.onTrackUpstreamPaused=l=>{this.log.debug("upstream paused",Object.assign(Object.assign({},this.logContext),ar(l))),this.onTrackMuted(l,!0)},this.onTrackUpstreamResumed=l=>{this.log.debug("upstream resumed",Object.assign(Object.assign({},this.logContext),ar(l))),this.onTrackMuted(l,l.isMuted)},this.onTrackFeatureUpdate=l=>{const c=this.audioTrackPublications.get(l.sid);if(!c){this.log.warn("Could not update local audio track settings, missing publication for track ".concat(l.sid),this.logContext);return}this.engine.client.sendUpdateLocalAudioTrack(c.trackSid,c.getTrackFeatures())},this.handleSubscribedQualityUpdate=l=>Q(this,void 0,void 0,function*(){var c,h,p,v,b,k;if(!(!((b=this.roomOptions)===null||b===void 0)&&b.dynacast))return;const T=this.videoTrackPublications.get(l.trackSid);if(!T){this.log.warn("received subscribed quality update for unknown track",Object.assign(Object.assign({},this.logContext),{trackSid:l.trackSid}));return}if(l.subscribedCodecs.length>0){if(!T.videoTrack)return;const A=yield T.videoTrack.setPublishingCodecs(l.subscribedCodecs);try{for(var E=!0,R=pc(A),M;M=yield R.next(),c=M.done,!c;E=!0){v=M.value,E=!1;const U=v;iV(U)&&(this.log.debug("publish ".concat(U," for ").concat(T.videoTrack.sid),Object.assign(Object.assign({},this.logContext),ar(T))),yield this.publishAdditionalCodecForTrack(T.videoTrack,U,T.options))}}catch(U){h={error:U}}finally{try{!E&&!c&&(p=R.return)&&(yield p.call(R))}finally{if(h)throw h.error}}}else l.subscribedQualities.length>0&&(yield(k=T.videoTrack)===null||k===void 0?void 0:k.setPublishingLayers(l.subscribedQualities))}),this.handleLocalTrackUnpublished=l=>{const c=this.trackPublications.get(l.trackSid);if(!c){this.log.warn("received unpublished event for unknown track",Object.assign(Object.assign({},this.logContext),{trackSid:l.trackSid}));return}this.unpublishTrack(c.track)},this.handleTrackEnded=l=>Q(this,void 0,void 0,function*(){if(l.source===De.Source.ScreenShare||l.source===De.Source.ScreenShareAudio)this.log.debug("unpublishing local track due to TrackEnded",Object.assign(Object.assign({},this.logContext),ar(l))),this.unpublishTrack(l);else if(l.isUserProvided)yield l.mute();else if(Qd(l)||Cc(l))try{if(ao())try{const c=yield navigator==null?void 0:navigator.permissions.query({name:l.source===De.Source.Camera?"camera":"microphone"});if(c&&c.state==="denied")throw this.log.warn("user has revoked access to ".concat(l.source),Object.assign(Object.assign({},this.logContext),ar(l))),c.onchange=()=>{c.state!=="denied"&&(l.isMuted||l.restartTrack(),c.onchange=null)},new Error("GetUserMedia Permission denied")}catch{}l.isMuted||(this.log.debug("track ended, attempting to use a different device",Object.assign(Object.assign({},this.logContext),ar(l))),Qd(l)?yield l.restartTrack({deviceId:"default"}):yield l.restartTrack())}catch{this.log.warn("could not restart track, muting instead",Object.assign(Object.assign({},this.logContext),ar(l))),yield l.mute()}}),this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.trackPublications=new Map,this.engine=r,this.roomOptions=a,this.setupEngine(r),this.activeDeviceMap=new Map([["audioinput","default"],["videoinput","default"],["audiooutput","default"]]),this.pendingSignalRequests=new Map,this.rpcHandlers=s}get lastCameraError(){return this.cameraError}get lastMicrophoneError(){return this.microphoneError}get isE2EEEnabled(){return this.encryptionType!==Po.NONE}getTrackPublication(e){const n=super.getTrackPublication(e);if(n)return n}getTrackPublicationByName(e){const n=super.getTrackPublicationByName(e);if(n)return n}setupEngine(e){this.engine=e,this.engine.on(tt.RemoteMute,(n,r)=>{const a=this.trackPublications.get(n);!a||!a.track||(r?a.mute():a.unmute())}),this.engine.on(tt.Connected,this.handleReconnected).on(tt.SignalRestarted,this.handleReconnected).on(tt.SignalResumed,this.handleReconnected).on(tt.Restarting,this.handleReconnecting).on(tt.Resuming,this.handleReconnecting).on(tt.LocalTrackUnpublished,this.handleLocalTrackUnpublished).on(tt.SubscribedQualityUpdate,this.handleSubscribedQualityUpdate).on(tt.Disconnected,this.handleDisconnected).on(tt.SignalRequestResponse,this.handleSignalRequestResponse).on(tt.DataPacketReceived,this.handleDataPacket)}setMetadata(e){return Q(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({metadata:e})})}setName(e){return Q(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({name:e})})}setAttributes(e){return Q(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({attributes:e})})}requestMetadataUpdate(e){return Q(this,arguments,void 0,function(n){var r=this;let{metadata:a,name:s,attributes:l}=n;return function*(){return new Promise((c,h)=>Q(r,void 0,void 0,function*(){var p,v;try{let b=!1;const k=yield this.engine.client.sendUpdateLocalMetadata((p=a??this.metadata)!==null&&p!==void 0?p:"",(v=s??this.name)!==null&&v!==void 0?v:"",l),T=performance.now();for(this.pendingSignalRequests.set(k,{resolve:c,reject:E=>{h(E),b=!0},values:{name:s,metadata:a,attributes:l}});performance.now()-T<5e3&&!b;){if((!s||this.name===s)&&(!a||this.metadata===a)&&(!l||Object.entries(l).every(E=>{let[R,M]=E;return this.attributes[R]===M||M===""&&!this.attributes[R]}))){this.pendingSignalRequests.delete(k),c();return}yield io(50)}h(new nO("Request to update local metadata timed out","TimeoutError"))}catch(b){b instanceof Error&&h(b)}}))}()})}setCameraEnabled(e,n,r){return this.setTrackEnabled(De.Source.Camera,e,n,r)}setMicrophoneEnabled(e,n,r){return this.setTrackEnabled(De.Source.Microphone,e,n,r)}setScreenShareEnabled(e,n,r){return this.setTrackEnabled(De.Source.ScreenShare,e,n,r)}setPermissions(e){const n=this.permissions,r=super.setPermissions(e);return r&&n&&this.emit(Ie.ParticipantPermissionsChanged,n),r}setE2EEEnabled(e){return Q(this,void 0,void 0,function*(){this.encryptionType=e?Po.GCM:Po.NONE,yield this.republishAllTracks(void 0,!1)})}setTrackEnabled(e,n,r,a){return Q(this,void 0,void 0,function*(){var s,l;this.log.debug("setTrackEnabled",Object.assign(Object.assign({},this.logContext),{source:e,enabled:n})),this.republishPromise&&(yield this.republishPromise);let c=this.getTrackPublication(e);if(n)if(c)yield c.unmute();else{let h;if(this.pendingPublishing.has(e)){const p=yield this.waitForPendingPublicationOfSource(e);return p||this.log.info("waiting for pending publication promise timed out",Object.assign(Object.assign({},this.logContext),{source:e})),yield p==null?void 0:p.unmute(),p}this.pendingPublishing.add(e);try{switch(e){case De.Source.Camera:h=yield this.createTracks({video:(s=r)!==null&&s!==void 0?s:!0});break;case De.Source.Microphone:h=yield this.createTracks({audio:(l=r)!==null&&l!==void 0?l:!0});break;case De.Source.ScreenShare:h=yield this.createScreenTracks(Object.assign({},r));break;default:throw new uu(e)}}catch(p){throw h==null||h.forEach(v=>{v.stop()}),p instanceof Error&&this.emit(Ie.MediaDevicesError,p),this.pendingPublishing.delete(e),p}try{const p=[];for(const b of h)this.log.info("publishing track",Object.assign(Object.assign({},this.logContext),ar(b))),p.push(this.publishTrack(b,a));[c]=yield Promise.all(p)}catch(p){throw h==null||h.forEach(v=>{v.stop()}),p}finally{this.pendingPublishing.delete(e)}}else if(!(c!=null&&c.track)&&this.pendingPublishing.has(e)&&(c=yield this.waitForPendingPublicationOfSource(e),c||this.log.info("waiting for pending publication promise timed out",Object.assign(Object.assign({},this.logContext),{source:e}))),c&&c.track)if(e===De.Source.ScreenShare){c=yield this.unpublishTrack(c.track);const h=this.getTrackPublication(De.Source.ScreenShareAudio);h&&h.track&&this.unpublishTrack(h.track)}else yield c.mute();return c})}enableCameraAndMicrophone(){return Q(this,void 0,void 0,function*(){if(!(this.pendingPublishing.has(De.Source.Camera)||this.pendingPublishing.has(De.Source.Microphone))){this.pendingPublishing.add(De.Source.Camera),this.pendingPublishing.add(De.Source.Microphone);try{const e=yield this.createTracks({audio:!0,video:!0});yield Promise.all(e.map(n=>this.publishTrack(n)))}finally{this.pendingPublishing.delete(De.Source.Camera),this.pendingPublishing.delete(De.Source.Microphone)}}})}createTracks(e){return Q(this,void 0,void 0,function*(){var n,r;e??(e={});const a=mO(e,(n=this.roomOptions)===null||n===void 0?void 0:n.audioCaptureDefaults,(r=this.roomOptions)===null||r===void 0?void 0:r.videoCaptureDefaults);try{return(yield fb(a,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext})).map(c=>(cu(c)&&(this.microphoneError=void 0,c.setAudioContext(this.audioContext),c.source=De.Source.Microphone,this.emit(Ie.AudioStreamAcquired)),$h(c)&&(this.cameraError=void 0,c.source=De.Source.Camera),c))}catch(s){throw s instanceof Error&&(e.audio&&(this.microphoneError=s),e.video&&(this.cameraError=s)),s}})}createScreenTracks(e){return Q(this,void 0,void 0,function*(){if(e===void 0&&(e={}),navigator.mediaDevices.getDisplayMedia===void 0)throw new nT("getDisplayMedia not supported");e.resolution===void 0&&!cV()&&(e.resolution=uT.h1080fps30.resolution);const n=TV(e),r=yield navigator.mediaDevices.getDisplayMedia(n),a=r.getVideoTracks();if(a.length===0)throw new uu("no video track found");const s=new db(a[0],void 0,!1,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});s.source=De.Source.ScreenShare,e.contentHint&&(s.mediaStreamTrack.contentHint=e.contentHint);const l=[s];if(r.getAudioTracks().length>0){this.emit(Ie.AudioStreamAcquired);const c=new ub(r.getAudioTracks()[0],void 0,!1,this.audioContext,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});c.source=De.Source.ScreenShareAudio,l.push(c)}return l})}publishTrack(e,n){return Q(this,void 0,void 0,function*(){return this.publishOrRepublishTrack(e,n)})}publishOrRepublishTrack(e,n){return Q(this,arguments,void 0,function(r,a){var s=this;let l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return function*(){var c,h,p,v;Qd(r)&&r.setAudioContext(s.audioContext),yield(c=s.reconnectFuture)===null||c===void 0?void 0:c.promise,s.republishPromise&&!l&&(yield s.republishPromise),Hh(r)&&s.pendingPublishPromises.has(r)&&(yield s.pendingPublishPromises.get(r));let b;if(r instanceof MediaStreamTrack)b=r.getConstraints();else{b=r.constraints;let A;switch(r.source){case De.Source.Microphone:A="audioinput";break;case De.Source.Camera:A="videoinput"}A&&s.activeDeviceMap.has(A)&&(b=Object.assign(Object.assign({},b),{deviceId:s.activeDeviceMap.get(A)}))}if(r instanceof MediaStreamTrack)switch(r.kind){case"audio":r=new ub(r,b,!0,s.audioContext,{loggerName:s.roomOptions.loggerName,loggerContextCb:()=>s.logContext});break;case"video":r=new db(r,b,!0,{loggerName:s.roomOptions.loggerName,loggerContextCb:()=>s.logContext});break;default:throw new uu("unsupported MediaStreamTrack kind ".concat(r.kind))}else r.updateLoggerOptions({loggerName:s.roomOptions.loggerName,loggerContextCb:()=>s.logContext});let k;if(s.trackPublications.forEach(A=>{A.track&&A.track===r&&(k=A)}),k)return s.log.warn("track has already been published, skipping",Object.assign(Object.assign({},s.logContext),ar(k))),k;const T="channelCount"in r.mediaStreamTrack.getSettings()&&r.mediaStreamTrack.getSettings().channelCount===2||r.mediaStreamTrack.getConstraints().channelCount===2,E=(h=a==null?void 0:a.forceStereo)!==null&&h!==void 0?h:T;E&&(a||(a={}),a.dtx===void 0&&s.log.info("Opus DTX will be disabled for stereo tracks by default. Enable them explicitly to make it work.",Object.assign(Object.assign({},s.logContext),ar(r))),a.red===void 0&&s.log.info("Opus RED will be disabled for stereo tracks by default. Enable them explicitly to make it work."),(p=a.dtx)!==null&&p!==void 0||(a.dtx=!1),(v=a.red)!==null&&v!==void 0||(a.red=!1));const R=Object.assign(Object.assign({},s.roomOptions.publishDefaults),a);!dV()&&s.roomOptions.e2ee&&(s.log.info("End-to-end encryption is set up, simulcast publishing will be disabled on Safari versions and iOS browsers running iOS < v17.2",Object.assign({},s.logContext)),R.simulcast=!1),R.source&&(r.source=R.source);const M=new Promise((A,U)=>Q(s,void 0,void 0,function*(){try{if(this.engine.client.currentState!==Or.CONNECTED){this.log.debug("deferring track publication until signal is connected",Object.assign(Object.assign({},this.logContext),{track:ar(r)}));const V=()=>Q(this,void 0,void 0,function*(){try{const j=yield this.publish(r,R,E);A(j)}catch(j){U(j)}});setTimeout(()=>{this.engine.off(tt.SignalConnected,V),U(new iT("publishing rejected as engine not connected within timeout",408))},15e3),this.engine.once(tt.SignalConnected,V),this.engine.on(tt.Closing,()=>{this.engine.off(tt.SignalConnected,V),U(new iT("publishing rejected as engine closed",499))})}else try{const V=yield this.publish(r,R,E);A(V)}catch(V){U(V)}}catch(V){U(V)}}));s.pendingPublishPromises.set(r,M);try{return yield M}catch(A){throw A}finally{s.pendingPublishPromises.delete(r)}}()})}hasPermissionsToPublish(e){if(!this.permissions)return this.log.warn("no permissions present for publishing track",Object.assign(Object.assign({},this.logContext),ar(e))),!1;const{canPublish:n,canPublishSources:r}=this.permissions;return n&&(r.length===0||r.map(a=>EV(a)).includes(e.source))?!0:(this.log.warn("insufficient permissions to publish",Object.assign(Object.assign({},this.logContext),ar(e))),!1)}publish(e,n,r){return Q(this,void 0,void 0,function*(){var a,s,l,c,h,p,v,b,k,T;if(!this.hasPermissionsToPublish(e))throw new iT("failed to publish track, insufficient permissions",403);Array.from(this.trackPublications.values()).find(I=>Hh(e)&&I.source===e.source)&&e.source!==De.Source.Unknown&&this.log.info("publishing a second track with the same source: ".concat(e.source),Object.assign(Object.assign({},this.logContext),ar(e))),n.stopMicTrackOnMute&&cu(e)&&(e.stopOnMute=!0),e.source===De.Source.ScreenShare&&Bh()&&(n.simulcast=!1),n.videoCodec==="av1"&&!sV()&&(n.videoCodec=void 0),n.videoCodec==="vp9"&&!lV()&&(n.videoCodec=void 0),n.videoCodec===void 0&&(n.videoCodec=PT),this.enabledPublishVideoCodecs.length>0&&(this.enabledPublishVideoCodecs.some(I=>n.videoCodec===ob(I.mime))||(n.videoCodec=ob(this.enabledPublishVideoCodecs[0].mime)));const R=n.videoCodec;e.on(Qe.Muted,this.onTrackMuted),e.on(Qe.Unmuted,this.onTrackUnmuted),e.on(Qe.Ended,this.handleTrackEnded),e.on(Qe.UpstreamPaused,this.onTrackUpstreamPaused),e.on(Qe.UpstreamResumed,this.onTrackUpstreamResumed),e.on(Qe.AudioTrackFeatureUpdate,this.onTrackFeatureUpdate);const M=new V1({cid:e.mediaStreamTrack.id,name:n.name,type:De.kindToProto(e.kind),muted:e.isMuted,source:De.sourceToProto(e.source),disableDtx:!(!((a=n.dtx)!==null&&a!==void 0)||a),encryption:this.encryptionType,stereo:r,disableRed:this.isE2EEEnabled||!(!((s=n.red)!==null&&s!==void 0)||s),stream:n==null?void 0:n.stream,backupCodecPolicy:n==null?void 0:n.backupCodecPolicy});let A;if(e.kind===De.Kind.Video){let I={width:0,height:0};try{I=yield e.waitForDimensions()}catch{const ne=(c=(l=this.roomOptions.videoCaptureDefaults)===null||l===void 0?void 0:l.resolution)!==null&&c!==void 0?c:Pg.h720.resolution;I={width:ne.width,height:ne.height},this.log.error("could not determine track dimensions, using defaults",Object.assign(Object.assign(Object.assign({},this.logContext),ar(e)),{dims:I}))}M.width=I.width,M.height=I.height,Cc(e)&&(Dg(R)&&(e.source===De.Source.ScreenShare&&(n.scalabilityMode="L1T3","contentHint"in e.mediaStreamTrack&&(e.mediaStreamTrack.contentHint="motion",this.log.info("forcing contentHint to motion for screenshare with SVC codecs",Object.assign(Object.assign({},this.logContext),ar(e))))),n.scalabilityMode=(h=n.scalabilityMode)!==null&&h!==void 0?h:"L3T3_KEY"),M.simulcastCodecs=[new j1({codec:R,cid:e.mediaStreamTrack.id})],n.backupCodec===!0&&(n.backupCodec={codec:PT}),n.backupCodec&&R!==n.backupCodec.codec&&M.encryption===Po.NONE&&(this.roomOptions.dynacast||(this.roomOptions.dynacast=!0),M.simulcastCodecs.push(new j1({codec:n.backupCodec.codec,cid:""})))),A=LT(e.source===De.Source.ScreenShare,M.width,M.height,n),M.layers=FO(M.width,M.height,A,Dg(n.videoCodec))}else e.kind===De.Kind.Audio&&(A=[{maxBitrate:(p=n.audioPreset)===null||p===void 0?void 0:p.maxBitrate,priority:(b=(v=n.audioPreset)===null||v===void 0?void 0:v.priority)!==null&&b!==void 0?b:"high",networkPriority:(T=(k=n.audioPreset)===null||k===void 0?void 0:k.priority)!==null&&T!==void 0?T:"high"}]);if(!this.engine||this.engine.isClosed)throw new xi("cannot publish track when not connected");const U=()=>Q(this,void 0,void 0,function*(){var I,N,ne;if(!this.engine.pcManager)throw new xi("pcManager is not ready");if(e.sender=yield this.engine.createSender(e,n,A),Cc(e)&&((I=n.degradationPreference)!==null&&I!==void 0||(n.degradationPreference=nz(e)),e.setDegradationPreference(n.degradationPreference)),A)if(Bh()&&e.kind===De.Kind.Audio){let X;for(const se of this.engine.pcManager.publisher.getTransceivers())if(se.sender===e.sender){X=se;break}X&&this.engine.pcManager.publisher.setTrackCodecBitrate({transceiver:X,codec:"opus",maxbr:!((N=A[0])===null||N===void 0)&&N.maxBitrate?A[0].maxBitrate/1e3:0})}else e.codec&&Dg(e.codec)&&(!((ne=A[0])===null||ne===void 0)&&ne.maxBitrate)&&this.engine.pcManager.publisher.setTrackCodecBitrate({cid:M.cid,codec:e.codec,maxbr:A[0].maxBitrate/1e3});yield this.engine.negotiate()});let V;if(this.enabledPublishVideoCodecs.length>0)V=(yield Promise.all([this.engine.addTrack(M),U()]))[0];else{V=yield this.engine.addTrack(M);let I;if(V.codecs.forEach(N=>{I===void 0&&(I=N.mimeType)}),I&&e.kind===De.Kind.Video){const N=ob(I);N!==R&&(this.log.debug("falling back to server selected codec",Object.assign(Object.assign(Object.assign({},this.logContext),ar(e)),{codec:N})),n.videoCodec=N,A=LT(e.source===De.Source.ScreenShare,M.width,M.height,n))}yield U()}const j=new VT(e.kind,V,e,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});return j.options=n,e.sid=V.sid,this.log.debug("publishing ".concat(e.kind," with encodings"),Object.assign(Object.assign({},this.logContext),{encodings:A,trackInfo:V})),Cc(e)?e.startMonitor(this.engine.client):Qd(e)&&e.startMonitor(),this.addTrackPublication(j),this.emit(Ie.LocalTrackPublished,j),j})}get isLocal(){return!0}publishAdditionalCodecForTrack(e,n,r){return Q(this,void 0,void 0,function*(){var a;if(this.encryptionType!==Po.NONE)return;let s;if(this.trackPublications.forEach(T=>{T.track&&T.track===e&&(s=T)}),!s)throw new uu("track is not published");if(!Cc(e))throw new uu("track is not a video track");const l=Object.assign(Object.assign({},(a=this.roomOptions)===null||a===void 0?void 0:a.publishDefaults),r),c=JV(e,n,l);if(!c){this.log.info("backup codec has been disabled, ignoring request to add additional codec for track",Object.assign(Object.assign({},this.logContext),ar(e)));return}const h=e.addSimulcastTrack(n,c);if(!h)return;const p=new V1({cid:h.mediaStreamTrack.id,type:De.kindToProto(e.kind),muted:e.isMuted,source:De.sourceToProto(e.source),sid:e.sid,simulcastCodecs:[{codec:l.videoCodec,cid:h.mediaStreamTrack.id}]});if(p.layers=FO(p.width,p.height,c),!this.engine||this.engine.isClosed)throw new xi("cannot publish track when not connected");const v=()=>Q(this,void 0,void 0,function*(){yield this.engine.createSimulcastSender(e,h,l,c),yield this.engine.negotiate()}),k=(yield Promise.all([this.engine.addTrack(p),v()]))[0];this.log.debug("published ".concat(n," for track ").concat(e.sid),Object.assign(Object.assign({},this.logContext),{encodings:c,trackInfo:k}))})}unpublishTrack(e,n){return Q(this,void 0,void 0,function*(){var r,a;if(Hh(e)){const p=this.pendingPublishPromises.get(e);p&&(this.log.info("awaiting publish promise before attempting to unpublish",Object.assign(Object.assign({},this.logContext),ar(e))),yield p)}const s=this.getPublicationForTrack(e),l=s?ar(s):void 0;if(this.log.debug("unpublishing track",Object.assign(Object.assign({},this.logContext),l)),!s||!s.track){this.log.warn("track was not unpublished because no publication was found",Object.assign(Object.assign({},this.logContext),l));return}e=s.track,e.off(Qe.Muted,this.onTrackMuted),e.off(Qe.Unmuted,this.onTrackUnmuted),e.off(Qe.Ended,this.handleTrackEnded),e.off(Qe.UpstreamPaused,this.onTrackUpstreamPaused),e.off(Qe.UpstreamResumed,this.onTrackUpstreamResumed),e.off(Qe.AudioTrackFeatureUpdate,this.onTrackFeatureUpdate),n===void 0&&(n=(a=(r=this.roomOptions)===null||r===void 0?void 0:r.stopLocalTrackOnUnpublish)!==null&&a!==void 0?a:!0),n?e.stop():e.stopMonitor();let c=!1;const h=e.sender;if(e.sender=void 0,this.engine.pcManager&&this.engine.pcManager.currentState<Jr.FAILED&&h)try{for(const p of this.engine.pcManager.publisher.getTransceivers())p.sender===h&&(p.direction="inactive",c=!0);if(this.engine.removeTrack(h)&&(c=!0),Cc(e)){for(const[,p]of e.simulcastCodecs)p.sender&&(this.engine.removeTrack(p.sender)&&(c=!0),p.sender=void 0);e.simulcastCodecs.clear()}}catch(p){this.log.warn("failed to unpublish track",Object.assign(Object.assign(Object.assign({},this.logContext),l),{error:p}))}switch(this.trackPublications.delete(s.trackSid),s.kind){case De.Kind.Audio:this.audioTrackPublications.delete(s.trackSid);break;case De.Kind.Video:this.videoTrackPublications.delete(s.trackSid);break}return this.emit(Ie.LocalTrackUnpublished,s),s.setTrack(void 0),c&&(yield this.engine.negotiate()),s})}unpublishTracks(e){return Q(this,void 0,void 0,function*(){return(yield Promise.all(e.map(r=>this.unpublishTrack(r)))).filter(r=>!!r)})}republishAllTracks(e){return Q(this,arguments,void 0,function(n){var r=this;let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){r.republishPromise&&(yield r.republishPromise),r.republishPromise=new Promise((s,l)=>Q(r,void 0,void 0,function*(){try{const c=[];this.trackPublications.forEach(h=>{h.track&&(n&&(h.options=Object.assign(Object.assign({},h.options),n)),c.push(h))}),yield Promise.all(c.map(h=>Q(this,void 0,void 0,function*(){const p=h.track;yield this.unpublishTrack(p,!1),a&&!p.isMuted&&p.source!==De.Source.ScreenShare&&p.source!==De.Source.ScreenShareAudio&&(Qd(p)||Cc(p))&&!p.isUserProvided&&(this.log.debug("restarting existing track",Object.assign(Object.assign({},this.logContext),{track:h.trackSid})),yield p.restartTrack()),yield this.publishOrRepublishTrack(p,h.options,!0)}))),s()}catch(c){l(c)}finally{this.republishPromise=void 0}})),yield r.republishPromise}()})}publishData(e){return Q(this,arguments,void 0,function(n){var r=this;let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){const s=a.reliable?$n.RELIABLE:$n.LOSSY,l=a.destinationIdentities,c=a.topic,h=new ro({kind:s,value:{case:"user",value:new zD({participantIdentity:r.identity,payload:n,destinationIdentities:l,topic:c})}});yield r.engine.sendDataPacket(h,s)}()})}publishDtmf(e,n){return Q(this,void 0,void 0,function*(){const r=new ro({kind:$n.RELIABLE,value:{case:"sipDtmf",value:new BD({code:e,digit:n})}});yield this.engine.sendDataPacket(r,$n.RELIABLE)})}sendChatMessage(e,n){return Q(this,void 0,void 0,function*(){const r={id:crypto.randomUUID(),message:e,timestamp:Date.now(),attachedFiles:n==null?void 0:n.attachments},a=new ro({value:{case:"chatMessage",value:new M1(Object.assign(Object.assign({},r),{timestamp:Ur.parse(r.timestamp)}))}});return yield this.engine.sendDataPacket(a,$n.RELIABLE),this.emit(Ie.ChatMessage,r),r})}editChatMessage(e,n){return Q(this,void 0,void 0,function*(){const r=Object.assign(Object.assign({},n),{message:e,editTimestamp:Date.now()}),a=new ro({value:{case:"chatMessage",value:new M1(Object.assign(Object.assign({},r),{timestamp:Ur.parse(r.timestamp),editTimestamp:Ur.parse(r.editTimestamp)}))}});return yield this.engine.sendDataPacket(a,$n.RELIABLE),this.emit(Ie.ChatMessage,r),r})}sendText(e,n){return Q(this,void 0,void 0,function*(){var r;const a=crypto.randomUUID(),l=new TextEncoder().encode(e).byteLength,c=(r=n==null?void 0:n.attachments)===null||r===void 0?void 0:r.map(()=>crypto.randomUUID()),h=new Array(c?c.length+1:1).fill(0),p=(b,k)=>{var T;h[k]=b;const E=h.reduce((R,M)=>R+M,0);(T=n==null?void 0:n.onProgress)===null||T===void 0||T.call(n,E)},v=yield this.streamText({streamId:a,totalSize:l,destinationIdentities:n==null?void 0:n.destinationIdentities,topic:n==null?void 0:n.topic,attachedStreamIds:c,attributes:n==null?void 0:n.attributes});return yield v.write(e),p(1,0),yield v.close(),n!=null&&n.attachments&&c&&(yield Promise.all(n.attachments.map((b,k)=>Q(this,void 0,void 0,function*(){return this._sendFile(c[k],b,{topic:n.topic,mimeType:b.type,onProgress:T=>{p(T,k+1)}})})))),v.info})}streamText(e){return Q(this,void 0,void 0,function*(){var n,r;const a=(n=e==null?void 0:e.streamId)!==null&&n!==void 0?n:crypto.randomUUID(),s={id:a,mimeType:"text/plain",timestamp:Date.now(),topic:(r=e==null?void 0:e.topic)!==null&&r!==void 0?r:"",size:e==null?void 0:e.totalSize,attributes:e==null?void 0:e.attributes},l=new N1({streamId:a,mimeType:s.mimeType,topic:s.topic,timestamp:Zd(s.timestamp),totalLength:Zd(e==null?void 0:e.totalSize),attributes:s.attributes,contentHeader:{case:"textHeader",value:new JD({version:e==null?void 0:e.version,attachedStreamIds:e==null?void 0:e.attachedStreamIds,replyToStreamId:e==null?void 0:e.replyToStreamId,operationType:(e==null?void 0:e.type)==="update"?L1.UPDATE:L1.CREATE})}}),c=e==null?void 0:e.destinationIdentities,h=new ro({destinationIdentities:c,value:{case:"streamHeader",value:l}});yield this.engine.sendDataPacket(h,$n.RELIABLE);let p=0;const v=this,b=new WritableStream({write(E){return Q(this,void 0,void 0,function*(){for(const R of CV(E,WO)){yield v.engine.waitForBufferStatusLow($n.RELIABLE);const M=new I1({content:R,streamId:a,chunkIndex:Zd(p)}),A=new ro({destinationIdentities:c,value:{case:"streamChunk",value:M}});yield v.engine.sendDataPacket(A,$n.RELIABLE),p+=1}})},close(){return Q(this,void 0,void 0,function*(){const E=new U1({streamId:a}),R=new ro({destinationIdentities:c,value:{case:"streamTrailer",value:E}});yield v.engine.sendDataPacket(R,$n.RELIABLE)})},abort(E){console.log("Sink error:",E)}});let k=()=>Q(this,void 0,void 0,function*(){yield T.close()});v.engine.once(tt.Closing,k);const T=new dz(b,s,()=>this.engine.off(tt.Closing,k));return T})}sendFile(e,n){return Q(this,void 0,void 0,function*(){const r=crypto.randomUUID();return yield this._sendFile(r,e,n),{id:r}})}_sendFile(e,n,r){return Q(this,void 0,void 0,function*(){var a;const s=yield this.streamBytes({streamId:e,totalSize:n.size,name:n.name,mimeType:(a=r==null?void 0:r.mimeType)!==null&&a!==void 0?a:n.type,topic:r==null?void 0:r.topic,destinationIdentities:r==null?void 0:r.destinationIdentities}),l=n.stream().getReader();for(;;){const{done:c,value:h}=yield l.read();if(c)break;yield s.write(h)}return yield s.close(),s.info})}streamBytes(e){return Q(this,void 0,void 0,function*(){var n,r,a,s,l;const c=(n=e==null?void 0:e.streamId)!==null&&n!==void 0?n:crypto.randomUUID(),h=e==null?void 0:e.destinationIdentities,p={id:c,mimeType:(r=e==null?void 0:e.mimeType)!==null&&r!==void 0?r:"application/octet-stream",topic:(a=e==null?void 0:e.topic)!==null&&a!==void 0?a:"",timestamp:Date.now(),attributes:e==null?void 0:e.attributes,size:e==null?void 0:e.totalSize,name:(s=e==null?void 0:e.name)!==null&&s!==void 0?s:"unknown"},v=new N1({totalLength:Zd((l=p.size)!==null&&l!==void 0?l:0),mimeType:p.mimeType,streamId:c,topic:p.topic,timestamp:Zd(Date.now()),contentHeader:{case:"byteHeader",value:new eA({name:p.name})}}),b=new ro({destinationIdentities:h,value:{case:"streamHeader",value:v}});yield this.engine.sendDataPacket(b,$n.RELIABLE);let k=0;const T=new to,E=this.engine,R=this.log,M=new WritableStream({write(U){return Q(this,void 0,void 0,function*(){const V=yield T.lock();let j=0;try{for(;j<U.byteLength;){const I=U.slice(j,j+WO);yield E.waitForBufferStatusLow($n.RELIABLE);const N=new ro({destinationIdentities:h,value:{case:"streamChunk",value:new I1({content:I,streamId:c,chunkIndex:Zd(k)})}});yield E.sendDataPacket(N,$n.RELIABLE),k+=1,j+=I.byteLength}}finally{V()}})},close(){return Q(this,void 0,void 0,function*(){const U=new U1({streamId:c}),V=new ro({destinationIdentities:h,value:{case:"streamTrailer",value:U}});yield E.sendDataPacket(V,$n.RELIABLE)})},abort(U){R.error("Sink error:",U)}});return new fz(M,p)})}performRpc(e){return Q(this,arguments,void 0,function(n){var r=this;let{destinationIdentity:a,method:s,payload:l,responseTimeout:c=1e4}=n;return function*(){return new Promise((p,v)=>Q(r,void 0,void 0,function*(){var b,k,T,E;if(AT(l)>AO){v(ei.builtIn("REQUEST_PAYLOAD_TOO_LARGE"));return}if(!((k=(b=this.engine.latestJoinResponse)===null||b===void 0?void 0:b.serverInfo)===null||k===void 0)&&k.version&&bc((E=(T=this.engine.latestJoinResponse)===null||T===void 0?void 0:T.serverInfo)===null||E===void 0?void 0:E.version,"1.8.0")<0){v(ei.builtIn("UNSUPPORTED_SERVER"));return}const R=crypto.randomUUID();yield this.publishRpcRequest(a,R,s,l,c-2e3);const M=setTimeout(()=>{this.pendingAcks.delete(R),v(ei.builtIn("CONNECTION_TIMEOUT")),this.pendingResponses.delete(R),clearTimeout(A)},2e3);this.pendingAcks.set(R,{resolve:()=>{clearTimeout(M)},participantIdentity:a});const A=setTimeout(()=>{this.pendingResponses.delete(R),v(ei.builtIn("RESPONSE_TIMEOUT"))},c);this.pendingResponses.set(R,{resolve:(U,V)=>{clearTimeout(A),this.pendingAcks.has(R)&&(console.warn("RPC response received before ack",R),this.pendingAcks.delete(R),clearTimeout(M)),V?v(V):p(U??"")},participantIdentity:a})}))}()})}registerRpcMethod(e,n){this.rpcHandlers.has(e)&&this.log.warn("you're overriding the RPC handler for method ".concat(e,", in the future this will throw an error")),this.rpcHandlers.set(e,n)}unregisterRpcMethod(e){this.rpcHandlers.delete(e)}setTrackSubscriptionPermissions(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];this.participantTrackPermissions=n,this.allParticipantsAllowedToSubscribe=e,this.engine.client.isDisconnected||this.updateTrackSubscriptionPermissions()}handleIncomingRpcAck(e){const n=this.pendingAcks.get(e);n?(n.resolve(),this.pendingAcks.delete(e)):console.error("Ack received for unexpected RPC request",e)}handleIncomingRpcResponse(e,n,r){const a=this.pendingResponses.get(e);a?(a.resolve(n,r),this.pendingResponses.delete(e)):console.error("Response received for unexpected RPC request",e)}publishRpcRequest(e,n,r,a,s){return Q(this,void 0,void 0,function*(){const l=new ro({destinationIdentities:[e],kind:$n.RELIABLE,value:{case:"rpcRequest",value:new HD({id:n,method:r,payload:a,responseTimeoutMs:s,version:1})}});yield this.engine.sendDataPacket(l,$n.RELIABLE)})}handleParticipantDisconnected(e){for(const[n,{participantIdentity:r}]of this.pendingAcks)r===e&&this.pendingAcks.delete(n);for(const[n,{participantIdentity:r,resolve:a}]of this.pendingResponses)r===e&&(a(null,ei.builtIn("RECIPIENT_DISCONNECTED")),this.pendingResponses.delete(n))}setEnabledPublishCodecs(e){this.enabledPublishVideoCodecs=e.filter(n=>n.mime.split("/")[0].toLowerCase()==="video")}updateInfo(e){return e.sid!==this.sid||!super.updateInfo(e)?!1:(e.tracks.forEach(n=>{var r,a;const s=this.trackPublications.get(n.sid);if(s){const l=s.isMuted||((a=(r=s.track)===null||r===void 0?void 0:r.isUpstreamPaused)!==null&&a!==void 0?a:!1);l!==n.muted&&(this.log.debug("updating server mute state after reconcile",Object.assign(Object.assign(Object.assign({},this.logContext),ar(s)),{mutedOnServer:l})),this.engine.client.sendMuteTrack(n.sid,l))}}),!0)}getPublicationForTrack(e){let n;return this.trackPublications.forEach(r=>{const a=r.track;a&&(e instanceof MediaStreamTrack?(Qd(a)||Cc(a))&&a.mediaStreamTrack===e&&(n=r):e===a&&(n=r))}),n}waitForPendingPublicationOfSource(e){return Q(this,void 0,void 0,function*(){const r=Date.now();for(;Date.now()<r+1e4;){const a=Array.from(this.pendingPublishPromises.entries()).find(s=>{let[l]=s;return l.source===e});if(a)return a[1];yield io(20)}})}}class GO extends du{constructor(e,n,r,a){super(e,n.sid,n.name,a),this.track=void 0,this.allowed=!0,this.disabled=!1,this.currentVideoQuality=Go.HIGH,this.handleEnded=s=>{this.setTrack(void 0),this.emit(Qe.Ended,s)},this.handleVisibilityChange=s=>{this.log.debug("adaptivestream video visibility ".concat(this.trackSid,", visible=").concat(s),this.logContext),this.disabled=!s,this.emitTrackUpdate()},this.handleVideoDimensionsChange=s=>{this.log.debug("adaptivestream video dimensions ".concat(s.width,"x").concat(s.height),this.logContext),this.videoDimensions=s,this.emitTrackUpdate()},this.subscribed=r,this.updateInfo(n)}setSubscribed(e){const n=this.subscriptionStatus,r=this.permissionStatus;this.subscribed=e,e&&(this.allowed=!0);const a=new q0({trackSids:[this.trackSid],subscribe:this.subscribed,participantTracks:[new GD({participantSid:"",trackSids:[this.trackSid]})]});this.emit(Qe.UpdateSubscription,a),this.emitSubscriptionUpdateIfChanged(n),this.emitPermissionUpdateIfChanged(r)}get subscriptionStatus(){return this.subscribed===!1?du.SubscriptionStatus.Unsubscribed:super.isSubscribed?du.SubscriptionStatus.Subscribed:du.SubscriptionStatus.Desired}get permissionStatus(){return this.allowed?du.PermissionStatus.Allowed:du.PermissionStatus.NotAllowed}get isSubscribed(){return this.subscribed===!1?!1:super.isSubscribed}get isDesired(){return this.subscribed!==!1}get isEnabled(){return!this.disabled}get isLocal(){return!1}setEnabled(e){!this.isManualOperationAllowed()||this.disabled===!e||(this.disabled=!e,this.emitTrackUpdate())}setVideoQuality(e){!this.isManualOperationAllowed()||this.currentVideoQuality===e||(this.currentVideoQuality=e,this.videoDimensions=void 0,this.emitTrackUpdate())}setVideoDimensions(e){var n,r;this.isManualOperationAllowed()&&(((n=this.videoDimensions)===null||n===void 0?void 0:n.width)===e.width&&((r=this.videoDimensions)===null||r===void 0?void 0:r.height)===e.height||(bT(this.track)&&(this.videoDimensions=e),this.currentVideoQuality=void 0,this.emitTrackUpdate()))}setVideoFPS(e){this.isManualOperationAllowed()&&bT(this.track)&&this.fps!==e&&(this.fps=e,this.emitTrackUpdate())}get videoQuality(){return this.currentVideoQuality}setTrack(e){const n=this.subscriptionStatus,r=this.permissionStatus,a=this.track;a!==e&&(a&&(a.off(Qe.VideoDimensionsChanged,this.handleVideoDimensionsChange),a.off(Qe.VisibilityChanged,this.handleVisibilityChange),a.off(Qe.Ended,this.handleEnded),a.detach(),a.stopMonitor(),this.emit(Qe.Unsubscribed,a)),super.setTrack(e),e&&(e.sid=this.trackSid,e.on(Qe.VideoDimensionsChanged,this.handleVideoDimensionsChange),e.on(Qe.VisibilityChanged,this.handleVisibilityChange),e.on(Qe.Ended,this.handleEnded),this.emit(Qe.Subscribed,e)),this.emitPermissionUpdateIfChanged(r),this.emitSubscriptionUpdateIfChanged(n))}setAllowed(e){const n=this.subscriptionStatus,r=this.permissionStatus;this.allowed=e,this.emitPermissionUpdateIfChanged(r),this.emitSubscriptionUpdateIfChanged(n)}setSubscriptionError(e){this.emit(Qe.SubscriptionFailed,e)}updateInfo(e){super.updateInfo(e);const n=this.metadataMuted;this.metadataMuted=e.muted,this.track?this.track.setMuted(e.muted):n!==e.muted&&this.emit(e.muted?Qe.Muted:Qe.Unmuted)}emitSubscriptionUpdateIfChanged(e){const n=this.subscriptionStatus;e!==n&&this.emit(Qe.SubscriptionStatusChanged,n,e)}emitPermissionUpdateIfChanged(e){this.permissionStatus!==e&&this.emit(Qe.SubscriptionPermissionChanged,this.permissionStatus,e)}isManualOperationAllowed(){return this.kind===De.Kind.Video&&this.isAdaptiveStream?(this.log.warn("adaptive stream is enabled, cannot change video track settings",this.logContext),!1):this.isDesired?!0:(this.log.warn("cannot update track settings when not subscribed",this.logContext),!1)}get isAdaptiveStream(){return bT(this.track)&&this.track.isAdaptiveStream}emitTrackUpdate(){const e=new nA({trackSids:[this.trackSid],disabled:this.disabled,fps:this.fps});this.videoDimensions?(e.width=Math.ceil(this.videoDimensions.width),e.height=Math.ceil(this.videoDimensions.height)):this.currentVideoQuality!==void 0?e.quality=this.currentVideoQuality:e.quality=Go.HIGH,this.emit(Qe.UpdateSettings,e)}}class pb extends qO{static fromParticipantInfo(e,n,r){return new pb(e,n.sid,n.identity,n.name,n.metadata,n.attributes,r,n.kind)}get logContext(){return Object.assign(Object.assign({},super.logContext),{rpID:this.sid,remoteParticipant:this.identity})}constructor(e,n,r,a,s,l,c){let h=arguments.length>7&&arguments[7]!==void 0?arguments[7]:_g.STANDARD;super(n,r||"",a,s,l,c,h),this.signalClient=e,this.trackPublications=new Map,this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.volumeMap=new Map}addTrackPublication(e){super.addTrackPublication(e),e.on(Qe.UpdateSettings,n=>{this.log.debug("send update settings",Object.assign(Object.assign({},this.logContext),ar(e))),this.signalClient.sendUpdateTrackSettings(n)}),e.on(Qe.UpdateSubscription,n=>{n.participantTracks.forEach(r=>{r.participantSid=this.sid}),this.signalClient.sendUpdateSubscription(n)}),e.on(Qe.SubscriptionPermissionChanged,n=>{this.emit(Ie.TrackSubscriptionPermissionChanged,e,n)}),e.on(Qe.SubscriptionStatusChanged,n=>{this.emit(Ie.TrackSubscriptionStatusChanged,e,n)}),e.on(Qe.Subscribed,n=>{this.emit(Ie.TrackSubscribed,n,e)}),e.on(Qe.Unsubscribed,n=>{this.emit(Ie.TrackUnsubscribed,n,e)}),e.on(Qe.SubscriptionFailed,n=>{this.emit(Ie.TrackSubscriptionFailed,e.trackSid,n)})}getTrackPublication(e){const n=super.getTrackPublication(e);if(n)return n}getTrackPublicationByName(e){const n=super.getTrackPublicationByName(e);if(n)return n}setVolume(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:De.Source.Microphone;this.volumeMap.set(n,e);const r=this.getTrackPublication(n);r&&r.track&&r.track.setVolume(e)}getVolume(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:De.Source.Microphone;const n=this.getTrackPublication(e);return n&&n.track?n.track.getVolume():this.volumeMap.get(e)}addSubscribedMediaTrack(e,n,r,a,s,l){let c=this.getTrackPublicationBySid(n);if(c||n.startsWith("TR")||this.trackPublications.forEach(v=>{!c&&e.kind===v.kind.toString()&&(c=v)}),!c){if(l===0){this.log.error("could not find published track",Object.assign(Object.assign({},this.logContext),{trackSid:n})),this.emit(Ie.TrackSubscriptionFailed,n);return}l===void 0&&(l=20),setTimeout(()=>{this.addSubscribedMediaTrack(e,n,r,a,s,l-1)},150);return}if(e.readyState==="ended"){this.log.error("unable to subscribe because MediaStreamTrack is ended. Do not call MediaStreamTrack.stop()",Object.assign(Object.assign({},this.logContext),ar(c))),this.emit(Ie.TrackSubscriptionFailed,n);return}const h=e.kind==="video";let p;return h?p=new hz(e,n,a,s):p=new $O(e,n,a,this.audioContext,this.audioOutput),p.source=c.source,p.isMuted=c.isMuted,p.setMediaStream(r),p.start(),c.setTrack(p),this.volumeMap.has(c.source)&&yT(p)&&cu(p)&&p.setVolume(this.volumeMap.get(c.source)),c}get hasMetadata(){return!!this.participantInfo}getTrackPublicationBySid(e){return this.trackPublications.get(e)}updateInfo(e){if(!super.updateInfo(e))return!1;const n=new Map,r=new Map;return e.tracks.forEach(a=>{var s,l;let c=this.getTrackPublicationBySid(a.sid);if(c)c.updateInfo(a);else{const h=De.kindFromProto(a.type);if(!h)return;c=new GO(h,a,(s=this.signalClient.connectOptions)===null||s===void 0?void 0:s.autoSubscribe,{loggerContextCb:()=>this.logContext,loggerName:(l=this.loggerOptions)===null||l===void 0?void 0:l.loggerName}),c.updateInfo(a),r.set(a.sid,c);const p=Array.from(this.trackPublications.values()).find(v=>v.source===(c==null?void 0:c.source));p&&c.source!==De.Source.Unknown&&this.log.debug("received a second track publication for ".concat(this.identity," with the same source: ").concat(c.source),Object.assign(Object.assign({},this.logContext),{oldTrack:ar(p),newTrack:ar(c)})),this.addTrackPublication(c)}n.set(a.sid,c)}),this.trackPublications.forEach(a=>{n.has(a.trackSid)||(this.log.trace("detected removed track on remote participant, unpublishing",Object.assign(Object.assign({},this.logContext),ar(a))),this.unpublishTrack(a.trackSid,!0))}),r.forEach(a=>{this.emit(Ie.TrackPublished,a)}),!0}unpublishTrack(e,n){const r=this.trackPublications.get(e);if(!r)return;const{track:a}=r;switch(a&&(a.stop(),r.setTrack(void 0)),this.trackPublications.delete(e),r.kind){case De.Kind.Audio:this.audioTrackPublications.delete(e);break;case De.Kind.Video:this.videoTrackPublications.delete(e);break}n&&this.emit(Ie.TrackUnpublished,r)}setAudioOutput(e){return Q(this,void 0,void 0,function*(){this.audioOutput=e;const n=[];this.audioTrackPublications.forEach(r=>{var a;cu(r.track)&&yT(r.track)&&n.push(r.track.setSinkId((a=e.deviceId)!==null&&a!==void 0?a:"default"))}),yield Promise.all(n)})}emit(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return this.log.trace("participant event",Object.assign(Object.assign({},this.logContext),{event:e,args:r})),super.emit(e,...r)}}var Fn;(function(t){t.Disconnected="disconnected",t.Connecting="connecting",t.Connected="connected",t.Reconnecting="reconnecting",t.SignalReconnecting="signalReconnecting"})(Fn||(Fn={}));const bz=4*1e3;class Gh extends dl.EventEmitter{constructor(e){var n,r,a,s;if(super(),n=this,this.state=Fn.Disconnected,this.activeSpeakers=[],this.isE2EEEnabled=!1,this.audioEnabled=!0,this.isVideoPlaybackBlocked=!1,this.log=Nn,this.bufferedEvents=[],this.isResuming=!1,this.byteStreamControllers=new Map,this.textStreamControllers=new Map,this.byteStreamHandlers=new Map,this.textStreamHandlers=new Map,this.rpcHandlers=new Map,this.connect=(l,c,h)=>Q(this,void 0,void 0,function*(){var p;if(!uV())throw fl()?Error("WebRTC isn't detected, have you called registerGlobals?"):Error("LiveKit doesn't seem to be supported on this browser. Try to update your browser and make sure no browser extensions are disabling webRTC.");const v=yield this.disconnectLock.lock();if(this.state===Fn.Connected)return this.log.info("already connected to room ".concat(this.name),this.logContext),v(),Promise.resolve();if(this.connectFuture)return v(),this.connectFuture.promise;this.setAndEmitConnectionState(Fn.Connecting),((p=this.regionUrlProvider)===null||p===void 0?void 0:p.getServerUrl().toString())!==l&&(this.regionUrl=void 0,this.regionUrlProvider=void 0),hT(new URL(l))&&(this.regionUrlProvider===void 0?this.regionUrlProvider=new UT(l,c):this.regionUrlProvider.updateToken(c),this.regionUrlProvider.fetchRegionSettings().then(T=>{var E;(E=this.regionUrlProvider)===null||E===void 0||E.setServerReportedRegions(T)}).catch(T=>{this.log.warn("could not fetch region settings",Object.assign(Object.assign({},this.logContext),{error:T}))}));const b=(T,E,R)=>Q(this,void 0,void 0,function*(){var M,A;this.abortController&&this.abortController.abort();const U=new AbortController;this.abortController=U,v==null||v();try{yield this.attemptConnection(R??l,c,h,U),this.abortController=void 0,T()}catch(V){if(this.regionUrlProvider&&V instanceof br&&V.reason!==Un.Cancelled&&V.reason!==Un.NotAllowed){let j=null;try{j=yield this.regionUrlProvider.getNextBestRegionUrl((M=this.abortController)===null||M===void 0?void 0:M.signal)}catch(I){if(I instanceof br&&(I.status===401||I.reason===Un.Cancelled)){this.handleDisconnect(this.options.stopLocalTrackOnUnpublish),E(I);return}}j&&!(!((A=this.abortController)===null||A===void 0)&&A.signal.aborted)?(this.log.info("Initial connection failed with ConnectionError: ".concat(V.message,". Retrying with another region: ").concat(j),this.logContext),this.recreateEngine(),yield b(T,E,j)):(this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,pO(V)),E(V))}else{let j=ks.UNKNOWN_REASON;V instanceof br&&(j=pO(V)),this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,j),E(V)}}}),k=this.regionUrl;return this.regionUrl=void 0,this.connectFuture=new hO((T,E)=>{b(T,E,k)},()=>{this.clearConnectionFutures()}),this.connectFuture.promise}),this.connectSignal=(l,c,h,p,v,b)=>Q(this,void 0,void 0,function*(){var k,T,E;const R=yield h.join(l,c,{autoSubscribe:p.autoSubscribe,adaptiveStream:typeof v.adaptiveStream=="object"?!0:v.adaptiveStream,maxRetries:p.maxRetries,e2eeEnabled:!!this.e2eeManager,websocketTimeout:p.websocketTimeout},b.signal);let M=R.serverInfo;if(M||(M={version:R.serverVersion,region:R.serverRegion}),this.serverInfo=M,this.log.debug("connected to Livekit Server ".concat(Object.entries(M).map(A=>{let[U,V]=A;return"".concat(U,": ").concat(V)}).join(", ")),{room:(k=R.room)===null||k===void 0?void 0:k.name,roomSid:(T=R.room)===null||T===void 0?void 0:T.sid,identity:(E=R.participant)===null||E===void 0?void 0:E.identity}),!M.version)throw new Y8("unknown server version");return M.version==="0.15.1"&&this.options.dynacast&&(this.log.debug("disabling dynacast due to server version",this.logContext),v.dynacast=!1),R}),this.applyJoinResponse=l=>{const c=l.participant;if(this.localParticipant.sid=c.sid,this.localParticipant.identity=c.identity,this.localParticipant.setEnabledPublishCodecs(l.enabledPublishCodecs),this.options.e2ee&&this.e2eeManager)try{this.e2eeManager.setSifTrailer(l.sifTrailer)}catch(h){this.log.error(h instanceof Error?h.message:"Could not set SifTrailer",Object.assign(Object.assign({},this.logContext),{error:h}))}this.handleParticipantUpdates([c,...l.otherParticipants]),l.room&&this.handleRoomUpdate(l.room)},this.attemptConnection=(l,c,h,p)=>Q(this,void 0,void 0,function*(){var v,b;this.state===Fn.Reconnecting||this.isResuming||!((v=this.engine)===null||v===void 0)&&v.pendingReconnect?(this.log.info("Reconnection attempt replaced by new connection attempt",this.logContext),this.recreateEngine()):this.maybeCreateEngine(),!((b=this.regionUrlProvider)===null||b===void 0)&&b.isCloud()&&this.engine.setRegionUrlProvider(this.regionUrlProvider),this.acquireAudioContext(),this.connOptions=Object.assign(Object.assign({},DT),h),this.connOptions.rtcConfig&&(this.engine.rtcConfig=this.connOptions.rtcConfig),this.connOptions.peerConnectionTimeout&&(this.engine.peerConnectionTimeout=this.connOptions.peerConnectionTimeout);try{const k=yield this.connectSignal(l,c,this.engine,this.connOptions,this.options,p);this.applyJoinResponse(k),this.setupLocalParticipantEvents(),this.emit(Ee.SignalConnected)}catch(k){yield this.engine.close(),this.recreateEngine();const T=new br("could not establish signal connection",Un.ServerUnreachable);throw k instanceof Error&&(T.message="".concat(T.message,": ").concat(k.message)),k instanceof br&&(T.reason=k.reason,T.status=k.status),this.log.debug("error trying to establish signal connection",Object.assign(Object.assign({},this.logContext),{error:k})),T}if(p.signal.aborted)throw yield this.engine.close(),this.recreateEngine(),new br("Connection attempt aborted",Un.Cancelled);try{yield this.engine.waitForPCInitialConnection(this.connOptions.peerConnectionTimeout,p)}catch(k){throw yield this.engine.close(),this.recreateEngine(),k}ao()&&this.options.disconnectOnPageLeave&&(window.addEventListener("pagehide",this.onPageLeave),window.addEventListener("beforeunload",this.onPageLeave)),ao()&&document.addEventListener("freeze",this.onPageLeave),this.setAndEmitConnectionState(Fn.Connected),this.emit(Ee.Connected),this.registerConnectionReconcile()}),this.disconnect=function(){for(var l=arguments.length,c=new Array(l),h=0;h<l;h++)c[h]=arguments[h];return Q(n,[...c],void 0,function(){var p=this;let v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){var b,k,T,E;const R=yield p.disconnectLock.lock();try{if(p.state===Fn.Disconnected){p.log.debug("already disconnected",p.logContext);return}p.log.info("disconnect from room",Object.assign({},p.logContext)),(p.state===Fn.Connecting||p.state===Fn.Reconnecting||p.isResuming)&&(p.log.warn("abort connection attempt",p.logContext),(b=p.abortController)===null||b===void 0||b.abort(),(T=(k=p.connectFuture)===null||k===void 0?void 0:k.reject)===null||T===void 0||T.call(k,new br("Client initiated disconnect",Un.Cancelled)),p.connectFuture=void 0),!((E=p.engine)===null||E===void 0)&&E.client.isDisconnected||(yield p.engine.client.sendLeave()),p.engine&&(yield p.engine.close()),p.handleDisconnect(v,ks.CLIENT_INITIATED),p.engine=void 0}finally{R()}}()})},this.onPageLeave=()=>Q(this,void 0,void 0,function*(){this.log.info("Page leave detected, disconnecting",this.logContext),yield this.disconnect()}),this.startAudio=()=>Q(this,void 0,void 0,function*(){const l=[],c=ws();if(c&&c.os==="iOS"){const h="livekit-dummy-audio-el";let p=document.getElementById(h);if(!p){p=document.createElement("audio"),p.id=h,p.autoplay=!0,p.hidden=!0;const v=gT();v.enabled=!0;const b=new MediaStream([v]);p.srcObject=b,document.addEventListener("visibilitychange",()=>{p&&(p.srcObject=document.hidden?null:b,document.hidden||(this.log.debug("page visible again, triggering startAudio to resume playback and update playback status",this.logContext),this.startAudio()))}),document.body.append(p),this.once(Ee.Disconnected,()=>{p==null||p.remove(),p=null})}l.push(p)}this.remoteParticipants.forEach(h=>{h.audioTrackPublications.forEach(p=>{p.track&&p.track.attachedElements.forEach(v=>{l.push(v)})})});try{yield Promise.all([this.acquireAudioContext(),...l.map(h=>(h.muted=!1,h.play()))]),this.handleAudioPlaybackStarted()}catch(h){throw this.handleAudioPlaybackFailed(h),h}}),this.startVideo=()=>Q(this,void 0,void 0,function*(){const l=[];for(const c of this.remoteParticipants.values())c.videoTrackPublications.forEach(h=>{var p;(p=h.track)===null||p===void 0||p.attachedElements.forEach(v=>{l.includes(v)||l.push(v)})});yield Promise.all(l.map(c=>c.play())).then(()=>{this.handleVideoPlaybackStarted()}).catch(c=>{c.name==="NotAllowedError"?this.handleVideoPlaybackFailed():this.log.warn("Resuming video playback failed, make sure you call `startVideo` directly in a user gesture handler",this.logContext)})}),this.handleRestarting=()=>{this.clearConnectionReconcile(),this.isResuming=!1;for(const l of this.remoteParticipants.values())this.handleParticipantDisconnected(l.identity,l);this.setAndEmitConnectionState(Fn.Reconnecting)&&this.emit(Ee.Reconnecting)},this.handleSignalRestarted=l=>Q(this,void 0,void 0,function*(){this.log.debug("signal reconnected to server, region ".concat(l.serverRegion),Object.assign(Object.assign({},this.logContext),{region:l.serverRegion})),this.bufferedEvents=[],this.applyJoinResponse(l);try{yield this.localParticipant.republishAllTracks(void 0,!0)}catch(c){this.log.error("error trying to re-publish tracks after reconnection",Object.assign(Object.assign({},this.logContext),{error:c}))}try{yield this.engine.waitForRestarted(),this.log.debug("fully reconnected to server",Object.assign(Object.assign({},this.logContext),{region:l.serverRegion}))}catch{return}this.setAndEmitConnectionState(Fn.Connected),this.emit(Ee.Reconnected),this.registerConnectionReconcile(),this.emitBufferedEvents()}),this.handleParticipantUpdates=l=>{l.forEach(c=>{var h;if(c.identity===this.localParticipant.identity){this.localParticipant.updateInfo(c);return}c.identity===""&&(c.identity=(h=this.sidToIdentity.get(c.sid))!==null&&h!==void 0?h:"");let p=this.remoteParticipants.get(c.identity);c.state===O1.DISCONNECTED?this.handleParticipantDisconnected(c.identity,p):p=this.getOrCreateParticipant(c.identity,c)})},this.handleActiveSpeakersUpdate=l=>{const c=[],h={};l.forEach(p=>{if(h[p.sid]=!0,p.sid===this.localParticipant.sid)this.localParticipant.audioLevel=p.level,this.localParticipant.setIsSpeaking(!0),c.push(this.localParticipant);else{const v=this.getRemoteParticipantBySid(p.sid);v&&(v.audioLevel=p.level,v.setIsSpeaking(!0),c.push(v))}}),h[this.localParticipant.sid]||(this.localParticipant.audioLevel=0,this.localParticipant.setIsSpeaking(!1)),this.remoteParticipants.forEach(p=>{h[p.sid]||(p.audioLevel=0,p.setIsSpeaking(!1))}),this.activeSpeakers=c,this.emitWhenConnected(Ee.ActiveSpeakersChanged,c)},this.handleSpeakersChanged=l=>{const c=new Map;this.activeSpeakers.forEach(p=>{const v=this.remoteParticipants.get(p.identity);v&&v.sid!==p.sid||c.set(p.sid,p)}),l.forEach(p=>{let v=this.getRemoteParticipantBySid(p.sid);p.sid===this.localParticipant.sid&&(v=this.localParticipant),v&&(v.audioLevel=p.level,v.setIsSpeaking(p.active),p.active?c.set(p.sid,v):c.delete(p.sid))});const h=Array.from(c.values());h.sort((p,v)=>v.audioLevel-p.audioLevel),this.activeSpeakers=h,this.emitWhenConnected(Ee.ActiveSpeakersChanged,h)},this.handleStreamStateUpdate=l=>{l.streamStates.forEach(c=>{const h=this.getRemoteParticipantBySid(c.participantSid);if(!h)return;const p=h.getTrackPublicationBySid(c.trackSid);if(!p||!p.track)return;const v=De.streamStateFromProto(c.state);v!==p.track.streamState&&(p.track.streamState=v,h.emit(Ie.TrackStreamStateChanged,p,p.track.streamState),this.emitWhenConnected(Ee.TrackStreamStateChanged,p,p.track.streamState,h))})},this.handleSubscriptionPermissionUpdate=l=>{const c=this.getRemoteParticipantBySid(l.participantSid);if(!c)return;const h=c.getTrackPublicationBySid(l.trackSid);h&&h.setAllowed(l.allowed)},this.handleSubscriptionError=l=>{const c=Array.from(this.remoteParticipants.values()).find(p=>p.trackPublications.has(l.trackSid));if(!c)return;const h=c.getTrackPublicationBySid(l.trackSid);h&&h.setSubscriptionError(l.err)},this.handleDataPacket=l=>{const c=this.remoteParticipants.get(l.participantIdentity);if(l.value.case==="user")this.handleUserPacket(c,l.value.value,l.kind);else if(l.value.case==="transcription")this.handleTranscription(c,l.value.value);else if(l.value.case==="sipDtmf")this.handleSipDtmf(c,l.value.value);else if(l.value.case==="chatMessage")this.handleChatMessage(c,l.value.value);else if(l.value.case==="metrics")this.handleMetrics(l.value.value,c);else if(l.value.case==="streamHeader")this.handleStreamHeader(l.value.value,l.participantIdentity);else if(l.value.case==="streamChunk")this.handleStreamChunk(l.value.value);else if(l.value.case==="streamTrailer")this.handleStreamTrailer(l.value.value);else if(l.value.case==="rpcRequest"){const h=l.value.value;this.handleIncomingRpcRequest(l.participantIdentity,h.id,h.method,h.payload,h.responseTimeoutMs,h.version)}},this.handleUserPacket=(l,c,h)=>{this.emit(Ee.DataReceived,c.payload,l,h,c.topic),l==null||l.emit(Ie.DataReceived,c.payload,h)},this.handleSipDtmf=(l,c)=>{this.emit(Ee.SipDTMFReceived,c,l),l==null||l.emit(Ie.SipDTMFReceived,c)},this.bufferedSegments=new Map,this.handleTranscription=(l,c)=>{const h=c.transcribedParticipantIdentity===this.localParticipant.identity?this.localParticipant:this.getParticipantByIdentity(c.transcribedParticipantIdentity),p=h==null?void 0:h.trackPublications.get(c.trackId),v=vV(c,this.transcriptionReceivedTimes);p==null||p.emit(Qe.TranscriptionReceived,v),h==null||h.emit(Ie.TranscriptionReceived,v,p),this.emit(Ee.TranscriptionReceived,v,h,p)},this.handleChatMessage=(l,c)=>{const h=yV(c);this.emit(Ee.ChatMessage,h,l)},this.handleMetrics=(l,c)=>{this.emit(Ee.MetricsReceived,l,c)},this.handleAudioPlaybackStarted=()=>{this.canPlaybackAudio||(this.audioEnabled=!0,this.emit(Ee.AudioPlaybackStatusChanged,!0))},this.handleAudioPlaybackFailed=l=>{this.log.warn("could not playback audio",Object.assign(Object.assign({},this.logContext),{error:l})),this.canPlaybackAudio&&(this.audioEnabled=!1,this.emit(Ee.AudioPlaybackStatusChanged,!1))},this.handleVideoPlaybackStarted=()=>{this.isVideoPlaybackBlocked&&(this.isVideoPlaybackBlocked=!1,this.emit(Ee.VideoPlaybackStatusChanged,!0))},this.handleVideoPlaybackFailed=()=>{this.isVideoPlaybackBlocked||(this.isVideoPlaybackBlocked=!0,this.emit(Ee.VideoPlaybackStatusChanged,!1))},this.handleDeviceChange=()=>Q(this,void 0,void 0,function*(){var l,c,h;const p=zi.getInstance().previousDevices,v=yield zi.getInstance().getDevices(void 0,!1),b=ws();if((b==null?void 0:b.name)==="Chrome"&&b.os!=="iOS")for(let T of v){const E=p.find(R=>R.deviceId===T.deviceId);E&&E.label!==""&&E.kind===T.kind&&E.label!==T.label&&this.getActiveDevice(T.kind)==="default"&&this.emit(Ee.ActiveDeviceChanged,T.kind,T.deviceId)}const k=["audiooutput","audioinput","videoinput"];for(let T of k){const E=kV(T),R=this.localParticipant.getTrackPublication(E);if(R&&(!((l=R.track)===null||l===void 0)&&l.isUserProvided))continue;const M=v.filter(U=>U.kind===T),A=this.getActiveDevice(T);if(A===((c=p.filter(U=>U.kind===T)[0])===null||c===void 0?void 0:c.deviceId)&&M.length>0&&((h=M[0])===null||h===void 0?void 0:h.deviceId)!==A){yield this.switchActiveDevice(T,M[0].deviceId);continue}T==="audioinput"&&!yc()||T==="videoinput"||M.length>0&&!M.find(U=>U.deviceId===this.getActiveDevice(T))&&(yield this.switchActiveDevice(T,M[0].deviceId))}this.emit(Ee.MediaDevicesChanged)}),this.handleRoomUpdate=l=>{const c=this.roomInfo;this.roomInfo=l,c&&c.metadata!==l.metadata&&this.emitWhenConnected(Ee.RoomMetadataChanged,l.metadata),(c==null?void 0:c.activeRecording)!==l.activeRecording&&this.emitWhenConnected(Ee.RecordingStatusChanged,l.activeRecording)},this.handleConnectionQualityUpdate=l=>{l.updates.forEach(c=>{if(c.participantSid===this.localParticipant.sid){this.localParticipant.setConnectionQuality(c.quality);return}const h=this.getRemoteParticipantBySid(c.participantSid);h&&h.setConnectionQuality(c.quality)})},this.onLocalParticipantMetadataChanged=l=>{this.emit(Ee.ParticipantMetadataChanged,l,this.localParticipant)},this.onLocalParticipantNameChanged=l=>{this.emit(Ee.ParticipantNameChanged,l,this.localParticipant)},this.onLocalAttributesChanged=l=>{this.emit(Ee.ParticipantAttributesChanged,l,this.localParticipant)},this.onLocalTrackMuted=l=>{this.emit(Ee.TrackMuted,l,this.localParticipant)},this.onLocalTrackUnmuted=l=>{this.emit(Ee.TrackUnmuted,l,this.localParticipant)},this.onTrackProcessorUpdate=l=>{var c;(c=l==null?void 0:l.onPublish)===null||c===void 0||c.call(l,this)},this.onLocalTrackPublished=l=>Q(this,void 0,void 0,function*(){var c,h,p,v,b,k;(c=l.track)===null||c===void 0||c.on(Qe.TrackProcessorUpdate,this.onTrackProcessorUpdate),(h=l.track)===null||h===void 0||h.on(Qe.Restarted,this.onLocalTrackRestarted),(b=(v=(p=l.track)===null||p===void 0?void 0:p.getProcessor())===null||v===void 0?void 0:v.onPublish)===null||b===void 0||b.call(v,this),this.emit(Ee.LocalTrackPublished,l,this.localParticipant),Qd(l.track)&&(yield l.track.checkForSilence())&&this.emit(Ee.LocalAudioSilenceDetected,l);const T=yield(k=l.track)===null||k===void 0?void 0:k.getDeviceId(!1),E=yO(l.source);E&&T&&T!==this.localParticipant.activeDeviceMap.get(E)&&(this.localParticipant.activeDeviceMap.set(E,T),this.emit(Ee.ActiveDeviceChanged,E,T))}),this.onLocalTrackUnpublished=l=>{var c,h;(c=l.track)===null||c===void 0||c.off(Qe.TrackProcessorUpdate,this.onTrackProcessorUpdate),(h=l.track)===null||h===void 0||h.off(Qe.Restarted,this.onLocalTrackRestarted),this.emit(Ee.LocalTrackUnpublished,l,this.localParticipant)},this.onLocalTrackRestarted=l=>Q(this,void 0,void 0,function*(){const c=yield l.getDeviceId(!1),h=yO(l.source);h&&c&&c!==this.localParticipant.activeDeviceMap.get(h)&&(this.log.debug("local track restarted, setting ".concat(h," ").concat(c," active"),this.logContext),this.localParticipant.activeDeviceMap.set(h,c),this.emit(Ee.ActiveDeviceChanged,h,c))}),this.onLocalConnectionQualityChanged=l=>{this.emit(Ee.ConnectionQualityChanged,l,this.localParticipant)},this.onMediaDevicesError=l=>{this.emit(Ee.MediaDevicesError,l)},this.onLocalParticipantPermissionsChanged=l=>{this.emit(Ee.ParticipantPermissionsChanged,l,this.localParticipant)},this.onLocalChatMessageSent=l=>{this.emit(Ee.ChatMessage,l,this.localParticipant)},this.setMaxListeners(100),this.remoteParticipants=new Map,this.sidToIdentity=new Map,this.options=Object.assign(Object.assign({},HV),e),this.log=lu((r=this.options.loggerName)!==null&&r!==void 0?r:xs.Room),this.transcriptionReceivedTimes=new Map,this.options.audioCaptureDefaults=Object.assign(Object.assign({},PO),e==null?void 0:e.audioCaptureDefaults),this.options.videoCaptureDefaults=Object.assign(Object.assign({},DO),e==null?void 0:e.videoCaptureDefaults),this.options.publishDefaults=Object.assign(Object.assign({},BV),e==null?void 0:e.publishDefaults),this.maybeCreateEngine(),this.disconnectLock=new to,this.localParticipant=new hb("","",this.engine,this.options,this.rpcHandlers),this.options.videoCaptureDefaults.deviceId&&this.localParticipant.activeDeviceMap.set("videoinput",Sc(this.options.videoCaptureDefaults.deviceId)),this.options.audioCaptureDefaults.deviceId&&this.localParticipant.activeDeviceMap.set("audioinput",Sc(this.options.audioCaptureDefaults.deviceId)),!((a=this.options.audioOutput)===null||a===void 0)&&a.deviceId&&this.switchActiveDevice("audiooutput",Sc(this.options.audioOutput.deviceId)).catch(l=>this.log.warn("Could not set audio output: ".concat(l.message),this.logContext)),this.options.e2ee&&this.setupE2EE(),ao()){const l=new AbortController;(s=navigator.mediaDevices)===null||s===void 0||s.addEventListener("devicechange",this.handleDeviceChange,{signal:l.signal}),Gh.cleanupRegistry&&Gh.cleanupRegistry.register(this,()=>{l.abort()})}}registerTextStreamHandler(e,n){if(this.textStreamHandlers.has(e))throw new TypeError('A text stream handler for topic "'.concat(e,'" has already been set.'));this.textStreamHandlers.set(e,n)}unregisterTextStreamHandler(e){this.textStreamHandlers.delete(e)}registerByteStreamHandler(e,n){if(this.byteStreamHandlers.has(e))throw new TypeError('A byte stream handler for topic "'.concat(e,'" has already been set.'));this.byteStreamHandlers.set(e,n)}unregisterByteStreamHandler(e){this.byteStreamHandlers.delete(e)}registerRpcMethod(e,n){if(this.rpcHandlers.has(e))throw Error("RPC handler already registered for method ".concat(e,", unregisterRpcMethod before trying to register again"));this.rpcHandlers.set(e,n)}unregisterRpcMethod(e){this.rpcHandlers.delete(e)}handleIncomingRpcRequest(e,n,r,a,s,l){return Q(this,void 0,void 0,function*(){if(yield this.engine.publishRpcAck(e,n),l!==1){yield this.engine.publishRpcResponse(e,n,null,ei.builtIn("UNSUPPORTED_VERSION"));return}const c=this.rpcHandlers.get(r);if(!c){yield this.engine.publishRpcResponse(e,n,null,ei.builtIn("UNSUPPORTED_METHOD"));return}let h=null,p=null;try{const v=yield c({requestId:n,callerIdentity:e,payload:a,responseTimeout:s});AT(v)>AO?(h=ei.builtIn("RESPONSE_PAYLOAD_TOO_LARGE"),console.warn("RPC Response payload too large for ".concat(r))):p=v}catch(v){v instanceof ei?h=v:(console.warn("Uncaught error returned by RPC handler for ".concat(r,". Returning APPLICATION_ERROR instead."),v),h=ei.builtIn("APPLICATION_ERROR"))}yield this.engine.publishRpcResponse(e,n,p,h)})}setE2EEEnabled(e){return Q(this,void 0,void 0,function*(){if(this.e2eeManager)yield Promise.all([this.localParticipant.setE2EEEnabled(e)]),this.localParticipant.identity!==""&&this.e2eeManager.setParticipantCryptorEnabled(e,this.localParticipant.identity);else throw Error("e2ee not configured, please set e2ee settings within the room options")})}setupE2EE(){var e;this.options.e2ee&&("e2eeManager"in this.options.e2ee?this.e2eeManager=this.options.e2ee.e2eeManager:this.e2eeManager=new RV(this.options.e2ee),this.e2eeManager.on(gc.ParticipantEncryptionStatusChanged,(n,r)=>{SV(r)&&(this.isE2EEEnabled=n),this.emit(Ee.ParticipantEncryptionStatusChanged,n,r)}),this.e2eeManager.on(gc.EncryptionError,n=>this.emit(Ee.EncryptionError,n)),(e=this.e2eeManager)===null||e===void 0||e.setup(this))}get logContext(){var e;return{room:this.name,roomID:(e=this.roomInfo)===null||e===void 0?void 0:e.sid,participant:this.localParticipant.identity,pID:this.localParticipant.sid}}get isRecording(){var e,n;return(n=(e=this.roomInfo)===null||e===void 0?void 0:e.activeRecording)!==null&&n!==void 0?n:!1}getSid(){return Q(this,void 0,void 0,function*(){return this.state===Fn.Disconnected?"":this.roomInfo&&this.roomInfo.sid!==""?this.roomInfo.sid:new Promise((e,n)=>{const r=a=>{a.sid!==""&&(this.engine.off(tt.RoomUpdate,r),e(a.sid))};this.engine.on(tt.RoomUpdate,r),this.once(Ee.Disconnected,()=>{this.engine.off(tt.RoomUpdate,r),n("Room disconnected before room server id was available")})})})}get name(){var e,n;return(n=(e=this.roomInfo)===null||e===void 0?void 0:e.name)!==null&&n!==void 0?n:""}get metadata(){var e;return(e=this.roomInfo)===null||e===void 0?void 0:e.metadata}get numParticipants(){var e,n;return(n=(e=this.roomInfo)===null||e===void 0?void 0:e.numParticipants)!==null&&n!==void 0?n:0}get numPublishers(){var e,n;return(n=(e=this.roomInfo)===null||e===void 0?void 0:e.numPublishers)!==null&&n!==void 0?n:0}maybeCreateEngine(){this.engine&&!this.engine.isClosed||(this.engine=new az(this.options),this.engine.on(tt.ParticipantUpdate,this.handleParticipantUpdates).on(tt.RoomUpdate,this.handleRoomUpdate).on(tt.SpeakersChanged,this.handleSpeakersChanged).on(tt.StreamStateChanged,this.handleStreamStateUpdate).on(tt.ConnectionQualityUpdate,this.handleConnectionQualityUpdate).on(tt.SubscriptionError,this.handleSubscriptionError).on(tt.SubscriptionPermissionUpdate,this.handleSubscriptionPermissionUpdate).on(tt.MediaTrackAdded,(e,n,r)=>{this.onTrackAdded(e,n,r)}).on(tt.Disconnected,e=>{this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,e)}).on(tt.ActiveSpeakersUpdate,this.handleActiveSpeakersUpdate).on(tt.DataPacketReceived,this.handleDataPacket).on(tt.Resuming,()=>{this.clearConnectionReconcile(),this.isResuming=!0,this.log.info("Resuming signal connection",this.logContext),this.setAndEmitConnectionState(Fn.SignalReconnecting)&&this.emit(Ee.SignalReconnecting)}).on(tt.Resumed,()=>{this.registerConnectionReconcile(),this.isResuming=!1,this.log.info("Resumed signal connection",this.logContext),this.updateSubscriptions(),this.emitBufferedEvents(),this.setAndEmitConnectionState(Fn.Connected)&&this.emit(Ee.Reconnected)}).on(tt.SignalResumed,()=>{this.bufferedEvents=[],(this.state===Fn.Reconnecting||this.isResuming)&&this.sendSyncState()}).on(tt.Restarting,this.handleRestarting).on(tt.SignalRestarted,this.handleSignalRestarted).on(tt.Offline,()=>{this.setAndEmitConnectionState(Fn.Reconnecting)&&this.emit(Ee.Reconnecting)}).on(tt.DCBufferStatusChanged,(e,n)=>{this.emit(Ee.DCBufferStatusChanged,e,n)}).on(tt.LocalTrackSubscribed,e=>{const n=this.localParticipant.getTrackPublications().find(r=>{let{trackSid:a}=r;return a===e});if(!n){this.log.warn("could not find local track subscription for subscribed event",this.logContext);return}this.localParticipant.emit(Ie.LocalTrackSubscribed,n),this.emitWhenConnected(Ee.LocalTrackSubscribed,n,this.localParticipant)}),this.localParticipant&&this.localParticipant.setupEngine(this.engine),this.e2eeManager&&this.e2eeManager.setupEngine(this.engine))}static getLocalDevices(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return zi.getInstance().getDevices(e,n)}prepareConnection(e,n){return Q(this,void 0,void 0,function*(){if(this.state===Fn.Disconnected){this.log.debug("prepareConnection to ".concat(e),this.logContext);try{if(hT(new URL(e))&&n){this.regionUrlProvider=new UT(e,n);const r=yield this.regionUrlProvider.getNextBestRegionUrl();r&&this.state===Fn.Disconnected&&(this.regionUrl=r,yield fetch(vT(r),{method:"HEAD"}),this.log.debug("prepared connection to ".concat(r),this.logContext))}else yield fetch(vT(e),{method:"HEAD"})}catch(r){this.log.warn("could not prepare connection",Object.assign(Object.assign({},this.logContext),{error:r}))}}})}getParticipantByIdentity(e){return this.localParticipant.identity===e?this.localParticipant:this.remoteParticipants.get(e)}clearConnectionFutures(){this.connectFuture=void 0}simulateScenario(e,n){return Q(this,void 0,void 0,function*(){let r=()=>{},a;switch(e){case"signal-reconnect":yield this.engine.client.handleOnClose("simulate disconnect");break;case"speaker":a=new cl({scenario:{case:"speakerUpdate",value:3}});break;case"node-failure":a=new cl({scenario:{case:"nodeFailure",value:!0}});break;case"server-leave":a=new cl({scenario:{case:"serverLeave",value:!0}});break;case"migration":a=new cl({scenario:{case:"migration",value:!0}});break;case"resume-reconnect":this.engine.failNext(),yield this.engine.client.handleOnClose("simulate resume-disconnect");break;case"disconnect-signal-on-resume":r=()=>Q(this,void 0,void 0,function*(){yield this.engine.client.handleOnClose("simulate resume-disconnect")}),a=new cl({scenario:{case:"disconnectSignalOnResume",value:!0}});break;case"disconnect-signal-on-resume-no-messages":r=()=>Q(this,void 0,void 0,function*(){yield this.engine.client.handleOnClose("simulate resume-disconnect")}),a=new cl({scenario:{case:"disconnectSignalOnResumeNoMessages",value:!0}});break;case"full-reconnect":this.engine.fullReconnectOnNext=!0,yield this.engine.client.handleOnClose("simulate full-reconnect");break;case"force-tcp":case"force-tls":a=new cl({scenario:{case:"switchCandidateProtocol",value:e==="force-tls"?2:1}}),r=()=>Q(this,void 0,void 0,function*(){const s=this.engine.client.onLeave;s&&s(new W0({reason:ks.CLIENT_INITIATED,action:Fh.RECONNECT}))});break;case"subscriber-bandwidth":if(n===void 0||typeof n!="number")throw new Error("subscriber-bandwidth requires a number as argument");a=new cl({scenario:{case:"subscriberBandwidth",value:Zd(n)}});break;case"leave-full-reconnect":a=new cl({scenario:{case:"leaveRequestFullReconnect",value:!0}})}a&&(yield this.engine.client.sendSimulateScenario(a),yield r())})}get canPlaybackAudio(){return this.audioEnabled}get canPlaybackVideo(){return!this.isVideoPlaybackBlocked}getActiveDevice(e){return this.localParticipant.activeDeviceMap.get(e)}switchActiveDevice(e,n){return Q(this,arguments,void 0,function(r,a){var s=this;let l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return function*(){var c,h,p,v,b,k,T,E;let R=!0,M=!1;const A=l?{exact:a}:a;if(r==="audioinput"){M=s.localParticipant.audioTrackPublications.size===0;const U=(c=s.getActiveDevice(r))!==null&&c!==void 0?c:s.options.audioCaptureDefaults.deviceId;s.options.audioCaptureDefaults.deviceId=A;const V=Array.from(s.localParticipant.audioTrackPublications.values()).filter(j=>j.source===De.Source.Microphone);try{R=(yield Promise.all(V.map(j=>{var I;return(I=j.audioTrack)===null||I===void 0?void 0:I.setDeviceId(A)}))).every(j=>j===!0)}catch(j){throw s.options.audioCaptureDefaults.deviceId=U,j}}else if(r==="videoinput"){M=s.localParticipant.videoTrackPublications.size===0;const U=(h=s.getActiveDevice(r))!==null&&h!==void 0?h:s.options.videoCaptureDefaults.deviceId;s.options.videoCaptureDefaults.deviceId=A;const V=Array.from(s.localParticipant.videoTrackPublications.values()).filter(j=>j.source===De.Source.Camera);try{R=(yield Promise.all(V.map(j=>{var I;return(I=j.videoTrack)===null||I===void 0?void 0:I.setDeviceId(A)}))).every(j=>j===!0)}catch(j){throw s.options.videoCaptureDefaults.deviceId=U,j}}else if(r==="audiooutput"){if(!fT()&&!s.options.webAudioMix||s.options.webAudioMix&&s.audioContext&&!("setSinkId"in s.audioContext))throw new Error("cannot switch audio output, setSinkId not supported");s.options.webAudioMix&&(a=(p=yield zi.getInstance().normalizeDeviceId("audiooutput",a))!==null&&p!==void 0?p:""),(v=(E=s.options).audioOutput)!==null&&v!==void 0||(E.audioOutput={});const U=(b=s.getActiveDevice(r))!==null&&b!==void 0?b:s.options.audioOutput.deviceId;s.options.audioOutput.deviceId=a;try{s.options.webAudioMix&&((k=s.audioContext)===null||k===void 0||k.setSinkId(a)),yield Promise.all(Array.from(s.remoteParticipants.values()).map(V=>V.setAudioOutput({deviceId:a})))}catch(V){throw s.options.audioOutput.deviceId=U,V}}return(M||r==="audiooutput")&&(s.localParticipant.activeDeviceMap.set(r,r==="audiooutput"&&((T=s.options.audioOutput)===null||T===void 0?void 0:T.deviceId)||a),s.emit(Ee.ActiveDeviceChanged,r,a)),R}()})}setupLocalParticipantEvents(){this.localParticipant.on(Ie.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).on(Ie.ParticipantNameChanged,this.onLocalParticipantNameChanged).on(Ie.AttributesChanged,this.onLocalAttributesChanged).on(Ie.TrackMuted,this.onLocalTrackMuted).on(Ie.TrackUnmuted,this.onLocalTrackUnmuted).on(Ie.LocalTrackPublished,this.onLocalTrackPublished).on(Ie.LocalTrackUnpublished,this.onLocalTrackUnpublished).on(Ie.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).on(Ie.MediaDevicesError,this.onMediaDevicesError).on(Ie.AudioStreamAcquired,this.startAudio).on(Ie.ChatMessage,this.onLocalChatMessageSent).on(Ie.ParticipantPermissionsChanged,this.onLocalParticipantPermissionsChanged)}recreateEngine(){var e;(e=this.engine)===null||e===void 0||e.close(),this.engine=void 0,this.isResuming=!1,this.remoteParticipants.clear(),this.sidToIdentity.clear(),this.bufferedEvents=[],this.maybeCreateEngine()}onTrackAdded(e,n,r){if(this.state===Fn.Connecting||this.state===Fn.Reconnecting){const v=()=>{this.onTrackAdded(e,n,r),b()},b=()=>{this.off(Ee.Reconnected,v),this.off(Ee.Connected,v),this.off(Ee.Disconnected,b)};this.once(Ee.Reconnected,v),this.once(Ee.Connected,v),this.once(Ee.Disconnected,b);return}if(this.state===Fn.Disconnected){this.log.warn("skipping incoming track after Room disconnected",this.logContext);return}if(e.readyState==="ended"){this.log.info("skipping incoming track as it already ended",this.logContext);return}const a=oV(n.id),s=a[0];let l=a[1],c=e.id;if(l&&l.startsWith("TR")&&(c=l),s===this.localParticipant.sid){this.log.warn("tried to create RemoteParticipant for local participant",this.logContext);return}const h=Array.from(this.remoteParticipants.values()).find(v=>v.sid===s);if(!h){this.log.error("Tried to add a track for a participant, that's not present. Sid: ".concat(s),this.logContext);return}let p;this.options.adaptiveStream&&(typeof this.options.adaptiveStream=="object"?p=this.options.adaptiveStream:p={}),h.addSubscribedMediaTrack(e,c,n,r,p)}handleDisconnect(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,n=arguments.length>1?arguments[1]:void 0;var r;if(this.clearConnectionReconcile(),this.isResuming=!1,this.bufferedEvents=[],this.transcriptionReceivedTimes.clear(),this.state!==Fn.Disconnected){this.regionUrl=void 0;try{this.remoteParticipants.forEach(a=>{a.trackPublications.forEach(s=>{a.unpublishTrack(s.trackSid)})}),this.localParticipant.trackPublications.forEach(a=>{var s,l,c;a.track&&this.localParticipant.unpublishTrack(a.track,e),e?((s=a.track)===null||s===void 0||s.detach(),(l=a.track)===null||l===void 0||l.stop()):(c=a.track)===null||c===void 0||c.stopMonitor()}),this.localParticipant.off(Ie.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).off(Ie.ParticipantNameChanged,this.onLocalParticipantNameChanged).off(Ie.AttributesChanged,this.onLocalAttributesChanged).off(Ie.TrackMuted,this.onLocalTrackMuted).off(Ie.TrackUnmuted,this.onLocalTrackUnmuted).off(Ie.LocalTrackPublished,this.onLocalTrackPublished).off(Ie.LocalTrackUnpublished,this.onLocalTrackUnpublished).off(Ie.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).off(Ie.MediaDevicesError,this.onMediaDevicesError).off(Ie.AudioStreamAcquired,this.startAudio).off(Ie.ChatMessage,this.onLocalChatMessageSent).off(Ie.ParticipantPermissionsChanged,this.onLocalParticipantPermissionsChanged),this.localParticipant.trackPublications.clear(),this.localParticipant.videoTrackPublications.clear(),this.localParticipant.audioTrackPublications.clear(),this.remoteParticipants.clear(),this.sidToIdentity.clear(),this.activeSpeakers=[],this.audioContext&&typeof this.options.webAudioMix=="boolean"&&(this.audioContext.close(),this.audioContext=void 0),ao()&&(window.removeEventListener("beforeunload",this.onPageLeave),window.removeEventListener("pagehide",this.onPageLeave),window.removeEventListener("freeze",this.onPageLeave),(r=navigator.mediaDevices)===null||r===void 0||r.removeEventListener("devicechange",this.handleDeviceChange))}finally{this.setAndEmitConnectionState(Fn.Disconnected),this.emit(Ee.Disconnected,n)}}}handleParticipantDisconnected(e,n){var r;this.remoteParticipants.delete(e),n&&(n.trackPublications.forEach(a=>{n.unpublishTrack(a.trackSid,!0)}),this.emit(Ee.ParticipantDisconnected,n),(r=this.localParticipant)===null||r===void 0||r.handleParticipantDisconnected(n.identity))}handleStreamHeader(e,n){return Q(this,void 0,void 0,function*(){var r;if(e.contentHeader.case==="byteHeader"){const a=this.byteStreamHandlers.get(e.topic);if(!a){this.log.debug("ignoring incoming byte stream due to no handler for topic",e.topic);return}let s;const l={id:e.streamId,name:(r=e.contentHeader.value.name)!==null&&r!==void 0?r:"unknown",mimeType:e.mimeType,size:e.totalLength?Number(e.totalLength):void 0,topic:e.topic,timestamp:ab(e.timestamp),attributes:e.attributes},c=new ReadableStream({start:h=>{s=h,this.byteStreamControllers.set(e.streamId,{info:l,controller:s,startTime:Date.now()})}});a(new uz(l,c,ab(e.totalLength)),{identity:n})}else if(e.contentHeader.case==="textHeader"){const a=this.textStreamHandlers.get(e.topic);if(!a){this.log.debug("ignoring incoming text stream due to no handler for topic",e.topic);return}let s;const l={id:e.streamId,mimeType:e.mimeType,size:e.totalLength?Number(e.totalLength):void 0,topic:e.topic,timestamp:Number(e.timestamp),attributes:e.attributes},c=new ReadableStream({start:h=>{s=h,this.textStreamControllers.set(e.streamId,{info:l,controller:s,startTime:Date.now()})}});a(new cz(l,c,ab(e.totalLength)),{identity:n})}})}handleStreamChunk(e){const n=this.byteStreamControllers.get(e.streamId);n&&e.content.length>0&&n.controller.enqueue(e);const r=this.textStreamControllers.get(e.streamId);r&&e.content.length>0&&r.controller.enqueue(e)}handleStreamTrailer(e){const n=this.textStreamControllers.get(e.streamId);n&&(n.info.attributes=Object.assign(Object.assign({},n.info.attributes),e.attributes),n.controller.close(),this.textStreamControllers.delete(e.streamId));const r=this.byteStreamControllers.get(e.streamId);r&&(r.info.attributes=Object.assign(Object.assign({},r.info.attributes),e.attributes),r.controller.close(),this.byteStreamControllers.delete(e.streamId))}acquireAudioContext(){return Q(this,void 0,void 0,function*(){var e,n;if(typeof this.options.webAudioMix!="boolean"&&this.options.webAudioMix.audioContext?this.audioContext=this.options.webAudioMix.audioContext:(!this.audioContext||this.audioContext.state==="closed")&&(this.audioContext=(e=vO())!==null&&e!==void 0?e:void 0),this.options.webAudioMix&&this.remoteParticipants.forEach(a=>a.setAudioContext(this.audioContext)),this.localParticipant.setAudioContext(this.audioContext),this.audioContext&&this.audioContext.state==="suspended")try{yield Promise.race([this.audioContext.resume(),io(200)])}catch(a){this.log.warn("Could not resume audio context",Object.assign(Object.assign({},this.logContext),{error:a}))}const r=((n=this.audioContext)===null||n===void 0?void 0:n.state)==="running";r!==this.canPlaybackAudio&&(this.audioEnabled=r,this.emit(Ee.AudioPlaybackStatusChanged,r))})}createParticipant(e,n){var r;let a;return n?a=pb.fromParticipantInfo(this.engine.client,n,{loggerContextCb:()=>this.logContext,loggerName:this.options.loggerName}):a=new pb(this.engine.client,"",e,void 0,void 0,void 0,{loggerContextCb:()=>this.logContext,loggerName:this.options.loggerName}),this.options.webAudioMix&&a.setAudioContext(this.audioContext),!((r=this.options.audioOutput)===null||r===void 0)&&r.deviceId&&a.setAudioOutput(this.options.audioOutput).catch(s=>this.log.warn("Could not set audio output: ".concat(s.message),this.logContext)),a}getOrCreateParticipant(e,n){if(this.remoteParticipants.has(e)){const a=this.remoteParticipants.get(e);return n&&a.updateInfo(n)&&this.sidToIdentity.set(n.sid,n.identity),a}const r=this.createParticipant(e,n);return this.remoteParticipants.set(e,r),this.sidToIdentity.set(n.sid,n.identity),this.emitWhenConnected(Ee.ParticipantConnected,r),r.on(Ie.TrackPublished,a=>{this.emitWhenConnected(Ee.TrackPublished,a,r)}).on(Ie.TrackSubscribed,(a,s)=>{a.kind===De.Kind.Audio?(a.on(Qe.AudioPlaybackStarted,this.handleAudioPlaybackStarted),a.on(Qe.AudioPlaybackFailed,this.handleAudioPlaybackFailed)):a.kind===De.Kind.Video&&(a.on(Qe.VideoPlaybackFailed,this.handleVideoPlaybackFailed),a.on(Qe.VideoPlaybackStarted,this.handleVideoPlaybackStarted)),this.emit(Ee.TrackSubscribed,a,s,r)}).on(Ie.TrackUnpublished,a=>{this.emit(Ee.TrackUnpublished,a,r)}).on(Ie.TrackUnsubscribed,(a,s)=>{this.emit(Ee.TrackUnsubscribed,a,s,r)}).on(Ie.TrackMuted,a=>{this.emitWhenConnected(Ee.TrackMuted,a,r)}).on(Ie.TrackUnmuted,a=>{this.emitWhenConnected(Ee.TrackUnmuted,a,r)}).on(Ie.ParticipantMetadataChanged,a=>{this.emitWhenConnected(Ee.ParticipantMetadataChanged,a,r)}).on(Ie.ParticipantNameChanged,a=>{this.emitWhenConnected(Ee.ParticipantNameChanged,a,r)}).on(Ie.AttributesChanged,a=>{this.emitWhenConnected(Ee.ParticipantAttributesChanged,a,r)}).on(Ie.ConnectionQualityChanged,a=>{this.emitWhenConnected(Ee.ConnectionQualityChanged,a,r)}).on(Ie.ParticipantPermissionsChanged,a=>{this.emitWhenConnected(Ee.ParticipantPermissionsChanged,a,r)}).on(Ie.TrackSubscriptionStatusChanged,(a,s)=>{this.emitWhenConnected(Ee.TrackSubscriptionStatusChanged,a,s,r)}).on(Ie.TrackSubscriptionFailed,(a,s)=>{this.emit(Ee.TrackSubscriptionFailed,a,r,s)}).on(Ie.TrackSubscriptionPermissionChanged,(a,s)=>{this.emitWhenConnected(Ee.TrackSubscriptionPermissionChanged,a,s,r)}),n&&r.updateInfo(n),r}sendSyncState(){const e=Array.from(this.remoteParticipants.values()).reduce((r,a)=>(r.push(...a.getTrackPublications()),r),[]),n=this.localParticipant.getTrackPublications();this.engine.sendSyncState(e,n)}updateSubscriptions(){for(const e of this.remoteParticipants.values())for(const n of e.videoTrackPublications.values())n.isSubscribed&&bV(n)&&n.emitTrackUpdate()}getRemoteParticipantBySid(e){const n=this.sidToIdentity.get(e);if(n)return this.remoteParticipants.get(n)}registerConnectionReconcile(){this.clearConnectionReconcile();let e=0;this.connectionReconcileInterval=Qi.setInterval(()=>{!this.engine||this.engine.isClosed||!this.engine.verifyTransport()?(e++,this.log.warn("detected connection state mismatch",Object.assign(Object.assign({},this.logContext),{numFailures:e,engine:this.engine?{closed:this.engine.isClosed,transportsConnected:this.engine.verifyTransport()}:void 0})),e>=3&&(this.recreateEngine(),this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,ks.STATE_MISMATCH))):e=0},bz)}clearConnectionReconcile(){this.connectionReconcileInterval&&Qi.clearInterval(this.connectionReconcileInterval)}setAndEmitConnectionState(e){return e===this.state?!1:(this.state=e,this.emit(Ee.ConnectionStateChanged,this.state),!0)}emitBufferedEvents(){this.bufferedEvents.forEach(e=>{let[n,r]=e;this.emit(n,...r)}),this.bufferedEvents=[]}emitWhenConnected(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];if(this.state===Fn.Reconnecting||this.isResuming||!this.engine||this.engine.pendingReconnect)this.bufferedEvents.push([e,r]);else if(this.state===Fn.Connected)return this.emit(e,...r);return!1}simulateParticipants(e){return Q(this,void 0,void 0,function*(){var n,r;const a=Object.assign({audio:!0,video:!0,useRealTracks:!1},e.publish),s=Object.assign({count:9,audio:!1,video:!0,aspectRatios:[1.66,1.7,1.3]},e.participants);if(this.handleDisconnect(),this.roomInfo=new A1({sid:"RM_SIMULATED",name:"simulated-room",emptyTimeout:0,maxParticipants:0,creationTime:Ur.parse(new Date().getTime()),metadata:"",numParticipants:1,numPublishers:1,turnPassword:"",enabledCodecs:[],activeRecording:!1}),this.localParticipant.updateInfo(new wg({identity:"simulated-local",name:"local-name"})),this.setupLocalParticipantEvents(),this.emit(Ee.SignalConnected),this.emit(Ee.Connected),this.setAndEmitConnectionState(Fn.Connected),a.video){const l=new VT(De.Kind.Video,new Uh({source:gi.CAMERA,sid:Math.floor(Math.random()*1e4).toString(),type:Cs.AUDIO,name:"video-dummy"}),new db(a.useRealTracks?(yield window.navigator.mediaDevices.getUserMedia({video:!0})).getVideoTracks()[0]:fO(160*((n=s.aspectRatios[0])!==null&&n!==void 0?n:1),160,!0,!0),void 0,!1,{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext}),{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext});this.localParticipant.addTrackPublication(l),this.localParticipant.emit(Ie.LocalTrackPublished,l)}if(a.audio){const l=new VT(De.Kind.Audio,new Uh({source:gi.MICROPHONE,sid:Math.floor(Math.random()*1e4).toString(),type:Cs.AUDIO}),new ub(a.useRealTracks?(yield navigator.mediaDevices.getUserMedia({audio:!0})).getAudioTracks()[0]:gT(),void 0,!1,this.audioContext,{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext}),{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext});this.localParticipant.addTrackPublication(l),this.localParticipant.emit(Ie.LocalTrackPublished,l)}for(let l=0;l<s.count-1;l+=1){let c=new wg({sid:Math.floor(Math.random()*1e4).toString(),identity:"simulated-".concat(l),state:O1.ACTIVE,tracks:[],joinedAt:Ur.parse(Date.now())});const h=this.getOrCreateParticipant(c.identity,c);if(s.video){const p=fO(160*((r=s.aspectRatios[l%s.aspectRatios.length])!==null&&r!==void 0?r:1),160,!1,!0),v=new Uh({source:gi.CAMERA,sid:Math.floor(Math.random()*1e4).toString(),type:Cs.AUDIO});h.addSubscribedMediaTrack(p,v.sid,new MediaStream([p]),new RTCRtpReceiver),c.tracks=[...c.tracks,v]}if(s.audio){const p=gT(),v=new Uh({source:gi.MICROPHONE,sid:Math.floor(Math.random()*1e4).toString(),type:Cs.AUDIO});h.addSubscribedMediaTrack(p,v.sid,new MediaStream([p]),new RTCRtpReceiver),c.tracks=[...c.tracks,v]}h.updateInfo(c)}})}emit(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];if(e!==Ee.ActiveSpeakersChanged&&e!==Ee.TranscriptionReceived){const s=YO(r).filter(l=>l!==void 0);this.log.debug("room event ".concat(e),Object.assign(Object.assign({},this.logContext),{event:e,args:s}))}return super.emit(e,...r)}}Gh.cleanupRegistry=typeof FinalizationRegistry<"u"&&new FinalizationRegistry(t=>{t()});function YO(t){return t.map(e=>{if(e)return Array.isArray(e)?YO(e):typeof e=="object"?"logContext"in e?e.logContext:void 0:e})}var Rs;(function(t){t[t.IDLE=0]="IDLE",t[t.RUNNING=1]="RUNNING",t[t.SKIPPED=2]="SKIPPED",t[t.SUCCESS=3]="SUCCESS",t[t.FAILED=4]="FAILED"})(Rs||(Rs={}));class xc extends dl.EventEmitter{constructor(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};super(),this.status=Rs.IDLE,this.logs=[],this.options={},this.url=e,this.token=n,this.name=this.constructor.name,this.room=new Gh(r.roomOptions),this.connectOptions=r.connectOptions,this.options=r}run(e){return Q(this,void 0,void 0,function*(){if(this.status!==Rs.IDLE)throw Error("check is running already");this.setStatus(Rs.RUNNING);try{yield this.perform()}catch(n){n instanceof Error&&(this.options.errorsAsWarnings?this.appendWarning(n.message):this.appendError(n.message))}return yield this.disconnect(),yield new Promise(n=>setTimeout(n,500)),this.status!==Rs.SKIPPED&&this.setStatus(this.isSuccess()?Rs.SUCCESS:Rs.FAILED),e&&e(),this.getInfo()})}isSuccess(){return!this.logs.some(e=>e.level==="error")}connect(e){return Q(this,void 0,void 0,function*(){return this.room.state===Fn.Connected?this.room:(e||(e=this.url),yield this.room.connect(e,this.token,this.connectOptions),this.room)})}disconnect(){return Q(this,void 0,void 0,function*(){this.room&&this.room.state!==Fn.Disconnected&&(yield this.room.disconnect(),yield new Promise(e=>setTimeout(e,500)))})}skip(){this.setStatus(Rs.SKIPPED)}switchProtocol(e){return Q(this,void 0,void 0,function*(){let n=!1,r=!1;if(this.room.on(Ee.Reconnecting,()=>{n=!0}),this.room.once(Ee.Reconnected,()=>{r=!0}),this.room.simulateScenario("force-".concat(e)),yield new Promise(s=>setTimeout(s,1e3)),!n)return;const a=Date.now()+1e4;for(;Date.now()<a;){if(r)return;yield io(100)}throw new Error("Could not reconnect using ".concat(e," protocol after 10 seconds"))})}appendMessage(e){this.logs.push({level:"info",message:e}),this.emit("update",this.getInfo())}appendWarning(e){this.logs.push({level:"warning",message:e}),this.emit("update",this.getInfo())}appendError(e){this.logs.push({level:"error",message:e}),this.emit("update",this.getInfo())}setStatus(e){this.status=e,this.emit("update",this.getInfo())}get engine(){var e;return(e=this.room)===null||e===void 0?void 0:e.engine}getInfo(){return{logs:this.logs,name:this.name,status:this.status,description:this.description}}}class Sz extends xc{get description(){return"Cloud regions"}perform(){return Q(this,void 0,void 0,function*(){const e=new UT(this.url,this.token);if(!e.isCloud()){this.skip();return}const n=[],r=new Set;for(let s=0;s<3;s++){const l=yield e.getNextBestRegionUrl();if(!l)break;if(r.has(l))continue;r.add(l);const c=yield this.checkCloudRegion(l);this.appendMessage("".concat(c.region," RTT: ").concat(c.rtt,"ms, duration: ").concat(c.duration,"ms")),n.push(c)}n.sort((s,l)=>(s.duration-l.duration)*.5+(s.rtt-l.rtt)*.5);const a=n[0];this.bestStats=a,this.appendMessage("best Cloud region: ".concat(a.region))})}getInfo(){const e=super.getInfo();return e.data=this.bestStats,e}checkCloudRegion(e){return Q(this,void 0,void 0,function*(){var n,r;yield this.connect(e),this.options.protocol==="tcp"&&(yield this.switchProtocol("tcp"));const a=(n=this.room.serverInfo)===null||n===void 0?void 0:n.region;if(!a)throw new Error("Region not found");const s=yield this.room.localParticipant.streamText({topic:"test"}),l=1e3,h=1e6/l,p="A".repeat(l),v=Date.now();for(let E=0;E<h;E++)yield s.write(p);yield s.close();const b=Date.now(),k=yield(r=this.room.engine.pcManager)===null||r===void 0?void 0:r.publisher.getStats(),T={region:a,rtt:1e4,duration:b-v};return k==null||k.forEach(E=>{E.type==="candidate-pair"&&E.nominated&&(T.rtt=E.currentRoundTripTime*1e3)}),yield this.disconnect(),T})}}const zT=1e4;class Cz extends xc{get description(){return"Connection via UDP vs TCP"}perform(){return Q(this,void 0,void 0,function*(){const e=yield this.checkConnectionProtocol("udp"),n=yield this.checkConnectionProtocol("tcp");this.bestStats=e,e.qualityLimitationDurations.bandwidth-n.qualityLimitationDurations.bandwidth>.5||(e.packetsLost-n.packetsLost)/e.packetsSent>.01?(this.appendMessage("best connection quality via tcp"),this.bestStats=n):this.appendMessage("best connection quality via udp");const r=this.bestStats;this.appendMessage("upstream bitrate: ".concat((r.bitrateTotal/r.count/1e3/1e3).toFixed(2)," mbps")),this.appendMessage("RTT: ".concat((r.rttTotal/r.count*1e3).toFixed(2)," ms")),this.appendMessage("jitter: ".concat((r.jitterTotal/r.count*1e3).toFixed(2)," ms")),r.packetsLost>0&&this.appendWarning("packets lost: ".concat((r.packetsLost/r.packetsSent*100).toFixed(2),"%")),r.qualityLimitationDurations.bandwidth>1&&this.appendWarning("bandwidth limited ".concat((r.qualityLimitationDurations.bandwidth/(zT/1e3)*100).toFixed(2),"%")),r.qualityLimitationDurations.cpu>0&&this.appendWarning("cpu limited ".concat((r.qualityLimitationDurations.cpu/(zT/1e3)*100).toFixed(2),"%"))})}getInfo(){const e=super.getInfo();return e.data=this.bestStats,e}checkConnectionProtocol(e){return Q(this,void 0,void 0,function*(){yield this.connect(),e==="tcp"?yield this.switchProtocol("tcp"):yield this.switchProtocol("udp");const n=document.createElement("canvas");n.width=1280,n.height=720;const r=n.getContext("2d");if(!r)throw new Error("Could not get canvas context");let a=0;const s=()=>{a=(a+1)%360,r.fillStyle="hsl(".concat(a,", 100%, 50%)"),r.fillRect(0,0,n.width,n.height),requestAnimationFrame(s)};s();const c=n.captureStream(30).getVideoTracks()[0],p=(yield this.room.localParticipant.publishTrack(c,{simulcast:!1,degradationPreference:"maintain-resolution",videoEncoding:{maxBitrate:2e6}})).track,v={protocol:e,packetsLost:0,packetsSent:0,qualityLimitationDurations:{},rttTotal:0,jitterTotal:0,bitrateTotal:0,count:0},b=setInterval(()=>Q(this,void 0,void 0,function*(){const k=yield p.getRTCStatsReport();k==null||k.forEach(T=>{T.type==="outbound-rtp"?(v.packetsSent=T.packetsSent,v.qualityLimitationDurations=T.qualityLimitationDurations,v.bitrateTotal+=T.targetBitrate,v.count++):T.type==="remote-inbound-rtp"&&(v.packetsLost=T.packetsLost,v.rttTotal+=T.roundTripTime,v.jitterTotal+=T.jitter)})}),1e3);return yield new Promise(k=>setTimeout(k,zT)),clearInterval(b),c.stop(),n.remove(),yield this.disconnect(),v})}}class kz extends xc{get description(){return"Can publish audio"}perform(){return Q(this,void 0,void 0,function*(){var e;const n=yield this.connect(),r=yield gz();if(yield gO(r,1e3))throw new Error("unable to detect audio from microphone");this.appendMessage("detected audio from microphone"),n.localParticipant.publishTrack(r),yield new Promise(c=>setTimeout(c,3e3));const s=yield(e=r.sender)===null||e===void 0?void 0:e.getStats();if(!s)throw new Error("Could not get RTCStats");let l=0;if(s.forEach(c=>{c.type==="outbound-rtp"&&(c.kind==="audio"||!c.kind&&c.mediaType==="audio")&&(l=c.packetsSent)}),l===0)throw new Error("Could not determine packets are sent");this.appendMessage("published ".concat(l," audio packets"))})}}class Tz extends xc{get description(){return"Can publish video"}perform(){return Q(this,void 0,void 0,function*(){var e;const n=yield this.connect(),r=yield mz();yield this.checkForVideo(r.mediaStreamTrack),n.localParticipant.publishTrack(r),yield new Promise(l=>setTimeout(l,5e3));const a=yield(e=r.sender)===null||e===void 0?void 0:e.getStats();if(!a)throw new Error("Could not get RTCStats");let s=0;if(a.forEach(l=>{l.type==="outbound-rtp"&&(l.kind==="video"||!l.kind&&l.mediaType==="video")&&(s+=l.packetsSent)}),s===0)throw new Error("Could not determine packets are sent");this.appendMessage("published ".concat(s," video packets"))})}checkForVideo(e){return Q(this,void 0,void 0,function*(){const n=new MediaStream;n.addTrack(e.clone());const r=document.createElement("video");r.srcObject=n,r.muted=!0,yield new Promise(a=>{r.onplay=()=>{setTimeout(()=>{var s,l,c,h;const p=document.createElement("canvas"),v=e.getSettings(),b=(l=(s=v.width)!==null&&s!==void 0?s:r.videoWidth)!==null&&l!==void 0?l:1280,k=(h=(c=v.height)!==null&&c!==void 0?c:r.videoHeight)!==null&&h!==void 0?h:720;p.width=b,p.height=k;const T=p.getContext("2d");T.drawImage(r,0,0);const R=T.getImageData(0,0,p.width,p.height).data;let M=!0;for(let A=0;A<R.length;A+=4)if(R[A]!==0||R[A+1]!==0||R[A+2]!==0){M=!1;break}M?this.appendError("camera appears to be producing only black frames"):this.appendMessage("received video frames"),a()},1e3)},r.play()}),r.remove()})}}class xz extends xc{get description(){return"Resuming connection after interruption"}perform(){return Q(this,void 0,void 0,function*(){var e;const n=yield this.connect();let r=!1,a=!1,s;const l=new Promise(p=>{setTimeout(p,5e3),s=p}),c=()=>{r=!0};n.on(Ee.SignalReconnecting,c).on(Ee.Reconnecting,c).on(Ee.Reconnected,()=>{a=!0,s(!0)}),(e=n.engine.client.ws)===null||e===void 0||e.close();const h=n.engine.client.onClose;if(h&&h(""),yield l,r){if(!a||n.state!==Fn.Connected)throw this.appendWarning("reconnection is only possible in Redis-based configurations"),new Error("Not able to reconnect")}else throw new Error("Did not attempt to reconnect")})}}class wz extends xc{get description(){return"Can connect via TURN"}perform(){return Q(this,void 0,void 0,function*(){var e,n;const r=new TT,a=yield r.join(this.url,this.token,{autoSubscribe:!0,maxRetries:0,e2eeEnabled:!1,websocketTimeout:15e3});let s=!1,l=!1,c=!1;for(let h of a.iceServers)for(let p of h.urls)p.startsWith("turn:")?(l=!0,c=!0):p.startsWith("turns:")&&(l=!0,c=!0,s=!0),p.startsWith("stun:")&&(c=!0);c?l&&!s&&this.appendWarning("TURN is configured server side, but TURN/TLS is unavailable."):this.appendWarning("No STUN servers configured on server side."),yield r.close(),!((n=(e=this.connectOptions)===null||e===void 0?void 0:e.rtcConfig)===null||n===void 0)&&n.iceServers||l?yield this.room.connect(this.url,this.token,{rtcConfig:{iceTransportPolicy:"relay"}}):(this.appendWarning("No TURN servers configured."),this.skip(),yield new Promise(h=>setTimeout(h,0)))})}}class _z extends xc{get description(){return"Establishing WebRTC connection"}perform(){return Q(this,void 0,void 0,function*(){let e=!1,n=!1;this.room.on(Ee.SignalConnected,()=>{const r=this.room.engine.client.onTrickle;this.room.engine.client.onTrickle=(a,s)=>{if(a.candidate){const l=new RTCIceCandidate(a);let c="".concat(l.protocol," ").concat(l.address,":").concat(l.port," ").concat(l.type);l.address&&(Ez(l.address)?c+=" (private)":l.protocol==="tcp"&&l.tcpType==="passive"?(e=!0,c+=" (passive)"):l.protocol==="udp"&&(n=!0)),this.appendMessage(c)}r&&r(a,s)},this.room.engine.pcManager&&(this.room.engine.pcManager.subscriber.onIceCandidateError=a=>{a instanceof RTCPeerConnectionIceErrorEvent&&this.appendWarning("error with ICE candidate: ".concat(a.errorCode," ").concat(a.errorText," ").concat(a.url))})});try{yield this.connect(),Nn.info("now the room is connected")}catch(r){throw this.appendWarning("ports need to be open on firewall in order to connect."),r}e||this.appendWarning("Server is not configured for ICE/TCP"),n||this.appendWarning("No public IPv4 UDP candidates were found. Your server is likely not configured correctly")})}}function Ez(t){const e=t.split(".");if(e.length===4){if(e[0]==="10")return!0;if(e[0]==="192"&&e[1]==="168")return!0;if(e[0]==="172"){const n=parseInt(e[1],10);if(n>=16&&n<=31)return!0}}return!1}class Rz extends xc{get description(){return"Connecting to signal connection via WebSocket"}perform(){return Q(this,void 0,void 0,function*(){var e,n,r;(this.url.startsWith("ws:")||this.url.startsWith("http:"))&&this.appendWarning("Server is insecure, clients may block connections to it");let a=new TT;const s=yield a.join(this.url,this.token,{autoSubscribe:!0,maxRetries:0,e2eeEnabled:!1,websocketTimeout:15e3});this.appendMessage("Connected to server, version ".concat(s.serverVersion,".")),((e=s.serverInfo)===null||e===void 0?void 0:e.edition)===YD.Cloud&&(!((n=s.serverInfo)===null||n===void 0)&&n.region)&&this.appendMessage("LiveKit Cloud: ".concat((r=s.serverInfo)===null||r===void 0?void 0:r.region)),yield a.close()})}}class Ase extends dl.EventEmitter{constructor(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};super(),this.options={},this.checkResults=new Map,this.url=e,this.token=n,this.options=r}getNextCheckId(){const e=this.checkResults.size;return this.checkResults.set(e,{logs:[],status:Rs.IDLE,name:"",description:""}),e}updateCheck(e,n){this.checkResults.set(e,n),this.emit("checkUpdate",e,n)}isSuccess(){return Array.from(this.checkResults.values()).every(e=>e.status!==Rs.FAILED)}getResults(){return Array.from(this.checkResults.values())}createAndRunCheck(e){return Q(this,void 0,void 0,function*(){const n=this.getNextCheckId(),r=new e(this.url,this.token,this.options),a=l=>{this.updateCheck(n,l)};r.on("update",a);const s=yield r.run();return r.off("update",a),s})}checkWebsocket(){return Q(this,void 0,void 0,function*(){return this.createAndRunCheck(Rz)})}checkWebRTC(){return Q(this,void 0,void 0,function*(){return this.createAndRunCheck(_z)})}checkTURN(){return Q(this,void 0,void 0,function*(){return this.createAndRunCheck(wz)})}checkReconnect(){return Q(this,void 0,void 0,function*(){return this.createAndRunCheck(xz)})}checkPublishAudio(){return Q(this,void 0,void 0,function*(){return this.createAndRunCheck(kz)})}checkPublishVideo(){return Q(this,void 0,void 0,function*(){return this.createAndRunCheck(Tz)})}checkConnectionProtocol(){return Q(this,void 0,void 0,function*(){const e=yield this.createAndRunCheck(Cz);if(e.data&&"protocol"in e.data){const n=e.data;this.options.protocol=n.protocol}return e})}checkCloudRegion(){return Q(this,void 0,void 0,function*(){return this.createAndRunCheck(Sz)})}}var mb=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Pz(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var BT={exports:{}},Dz=BT.exports,KO;function Az(){return KO||(KO=1,function(t){(function(e,n){t.exports?t.exports=n():e.log=n()})(Dz,function(){var e=function(){},n="undefined",r=typeof window!==n&&typeof window.navigator!==n&&/Trident\/|MSIE /.test(window.navigator.userAgent),a=["trace","debug","info","warn","error"],s={},l=null;function c(R,M){var A=R[M];if(typeof A.bind=="function")return A.bind(R);try{return Function.prototype.bind.call(A,R)}catch{return function(){return Function.prototype.apply.apply(A,[R,arguments])}}}function h(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function p(R){return R==="debug"&&(R="log"),typeof console===n?!1:R==="trace"&&r?h:console[R]!==void 0?c(console,R):console.log!==void 0?c(console,"log"):e}function v(){for(var R=this.getLevel(),M=0;M<a.length;M++){var A=a[M];this[A]=M<R?e:this.methodFactory(A,R,this.name)}if(this.log=this.debug,typeof console===n&&R<this.levels.SILENT)return"No console available for logging"}function b(R){return function(){typeof console!==n&&(v.call(this),this[R].apply(this,arguments))}}function k(R,M,A){return p(R)||b.apply(this,arguments)}function T(R,M){var A=this,U,V,j,I="loglevel";typeof R=="string"?I+=":"+R:typeof R=="symbol"&&(I=void 0);function N(oe){var J=(a[oe]||"silent").toUpperCase();if(!(typeof window===n||!I)){try{window.localStorage[I]=J;return}catch{}try{window.document.cookie=encodeURIComponent(I)+"="+J+";"}catch{}}}function ne(){var oe;if(!(typeof window===n||!I)){try{oe=window.localStorage[I]}catch{}if(typeof oe===n)try{var J=window.document.cookie,xe=encodeURIComponent(I),ke=J.indexOf(xe+"=");ke!==-1&&(oe=/^([^;]+)/.exec(J.slice(ke+xe.length+1))[1])}catch{}return A.levels[oe]===void 0&&(oe=void 0),oe}}function X(){if(!(typeof window===n||!I)){try{window.localStorage.removeItem(I)}catch{}try{window.document.cookie=encodeURIComponent(I)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function se(oe){var J=oe;if(typeof J=="string"&&A.levels[J.toUpperCase()]!==void 0&&(J=A.levels[J.toUpperCase()]),typeof J=="number"&&J>=0&&J<=A.levels.SILENT)return J;throw new TypeError("log.setLevel() called with invalid level: "+oe)}A.name=R,A.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},A.methodFactory=M||k,A.getLevel=function(){return j??V??U},A.setLevel=function(oe,J){return j=se(oe),J!==!1&&N(j),v.call(A)},A.setDefaultLevel=function(oe){V=se(oe),ne()||A.setLevel(oe,!1)},A.resetLevel=function(){j=null,X(),v.call(A)},A.enableAll=function(oe){A.setLevel(A.levels.TRACE,oe)},A.disableAll=function(oe){A.setLevel(A.levels.SILENT,oe)},A.rebuild=function(){if(l!==A&&(U=se(l.getLevel())),v.call(A),l===A)for(var oe in s)s[oe].rebuild()},U=se(l?l.getLevel():"WARN");var $=ne();$!=null&&(j=se($)),v.call(A)}l=new T,l.getLogger=function(R){if(typeof R!="symbol"&&typeof R!="string"||R==="")throw new TypeError("You must supply a name when creating a logger.");var M=s[R];return M||(M=s[R]=new T(R,l.methodFactory)),M};var E=typeof window!==n?window.log:void 0;return l.noConflict=function(){return typeof window!==n&&window.log===l&&(window.log=E),l},l.getLoggers=function(){return s},l.default=l,l})}(BT)),BT.exports}var Oz=Az();const Mz=Pz(Oz);var HT=function(t,e){return HT=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(n[a]=r[a])},HT(t,e)};function fu(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");HT(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}function Lz(t,e,n,r){function a(s){return s instanceof n?s:new n(function(l){l(s)})}return new(n||(n=Promise))(function(s,l){function c(v){try{p(r.next(v))}catch(b){l(b)}}function h(v){try{p(r.throw(v))}catch(b){l(b)}}function p(v){v.done?s(v.value):a(v.value).then(c,h)}p((r=r.apply(t,[])).next())})}function ZO(t,e){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,a,s,l=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return l.next=c(0),l.throw=c(1),l.return=c(2),typeof Symbol=="function"&&(l[Symbol.iterator]=function(){return this}),l;function c(p){return function(v){return h([p,v])}}function h(p){if(r)throw new TypeError("Generator is already executing.");for(;l&&(l=0,p[0]&&(n=0)),n;)try{if(r=1,a&&(s=p[0]&2?a.return:p[0]?a.throw||((s=a.return)&&s.call(a),0):a.next)&&!(s=s.call(a,p[1])).done)return s;switch(a=0,s&&(p=[p[0]&2,s.value]),p[0]){case 0:case 1:s=p;break;case 4:return n.label++,{value:p[1],done:!1};case 5:n.label++,a=p[1],p=[0];continue;case 7:p=n.ops.pop(),n.trys.pop();continue;default:if(s=n.trys,!(s=s.length>0&&s[s.length-1])&&(p[0]===6||p[0]===2)){n=0;continue}if(p[0]===3&&(!s||p[1]>s[0]&&p[1]<s[3])){n.label=p[1];break}if(p[0]===6&&n.label<s[1]){n.label=s[1],s=p;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(p);break}s[2]&&n.ops.pop(),n.trys.pop();continue}p=e.call(t,n)}catch(v){p=[6,v],a=0}finally{r=s=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}}function Yh(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function gb(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),a,s=[],l;try{for(;(e===void 0||e-- >0)&&!(a=r.next()).done;)s.push(a.value)}catch(c){l={error:c}}finally{try{a&&!a.done&&(n=r.return)&&n.call(r)}finally{if(l)throw l.error}}return s}function vb(t,e,n){if(arguments.length===2)for(var r=0,a=e.length,s;r<a;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return t.concat(s||Array.prototype.slice.call(e))}function Kh(t){return this instanceof Kh?(this.v=t,this):new Kh(t)}function Nz(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),a,s=[];return a=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),c("next"),c("throw"),c("return",l),a[Symbol.asyncIterator]=function(){return this},a;function l(T){return function(E){return Promise.resolve(E).then(T,b)}}function c(T,E){r[T]&&(a[T]=function(R){return new Promise(function(M,A){s.push([T,R,M,A])>1||h(T,R)})},E&&(a[T]=E(a[T])))}function h(T,E){try{p(r[T](E))}catch(R){k(s[0][3],R)}}function p(T){T.value instanceof Kh?Promise.resolve(T.value.v).then(v,b):k(s[0][2],T)}function v(T){h("next",T)}function b(T){h("throw",T)}function k(T,E){T(E),s.shift(),s.length&&h(s[0][0],s[0][1])}}function Iz(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof Yh=="function"?Yh(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(s){n[s]=t[s]&&function(l){return new Promise(function(c,h){l=t[s](l),a(c,h,l.done,l.value)})}}function a(s,l,c,h){Promise.resolve(h).then(function(p){s({value:p,done:c})},l)}}function wi(t){return typeof t=="function"}function $T(t){var e=function(r){Error.call(r),r.stack=new Error().stack},n=t(e);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var qT=$T(function(t){return function(e){t(this),this.message=e?e.length+` errors occurred during unsubscription:
|
|
278
|
+
`},ET}var wO;function FV(){if(wO)return _s;wO=1;var t=IV(),e=UV(),n=_T();return _s.grammar=n,_s.write=e,_s.parse=t.parse,_s.parseParams=t.parseParams,_s.parseFmtpConfig=t.parseFmtpConfig,_s.parsePayloads=t.parsePayloads,_s.parseRemoteCandidates=t.parseRemoteCandidates,_s.parseImageAttributes=t.parseImageAttributes,_s.parseSimulcastStreamList=t.parseSimulcastStreamList,_s}var kc=FV();function RT(t,e,n){var r,a,s;e===void 0&&(e=50),n===void 0&&(n={});var l=(r=n.isImmediate)!=null&&r,c=(a=n.callback)!=null&&a,h=n.maxWait,p=Date.now(),v=[];function b(){if(h!==void 0){var T=Date.now()-p;if(T+e>=h)return h-T}return e}var k=function(){var T=[].slice.call(arguments),E=this;return new Promise(function(R,M){var A=l&&s===void 0;if(s!==void 0&&clearTimeout(s),s=setTimeout(function(){if(s=void 0,p=Date.now(),!l){var V=t.apply(E,T);c&&c(V),v.forEach(function(j){return(0,j.resolve)(V)}),v=[]}},b()),A){var U=t.apply(E,T);return c&&c(U),R(U)}v.push({resolve:R,reject:M})})};return k.cancel=function(T){s!==void 0&&clearTimeout(s),v.forEach(function(E){return(0,E.reject)(T)}),v=[]},k}const jV=.7,VV=20,qh={NegotiationStarted:"negotiationStarted",NegotiationComplete:"negotiationComplete",RTPVideoPayloadTypes:"rtpVideoPayloadTypes"};class _O extends dl.EventEmitter{get pc(){return this._pc||(this._pc=this.createPC()),this._pc}constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var r;super(),this.log=Nn,this.ddExtID=0,this.pendingCandidates=[],this.restartingIce=!1,this.renegotiate=!1,this.trackBitrates=[],this.remoteStereoMids=[],this.remoteNackMids=[],this.negotiate=RT(a=>Q(this,void 0,void 0,function*(){this.emit(qh.NegotiationStarted);try{yield this.createAndSendOffer()}catch(s){if(a)a(s);else throw s}}),VV),this.close=()=>{this._pc&&(this._pc.close(),this._pc.onconnectionstatechange=null,this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.ondatachannel=null,this._pc.onnegotiationneeded=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ondatachannel=null,this._pc.ontrack=null,this._pc.onconnectionstatechange=null,this._pc.oniceconnectionstatechange=null,this._pc=null)},this.log=lu((r=n.loggerName)!==null&&r!==void 0?r:xs.PCTransport),this.loggerOptions=n,this.config=e,this._pc=this.createPC()}createPC(){const e=new RTCPeerConnection(this.config);return e.onicecandidate=n=>{var r;n.candidate&&((r=this.onIceCandidate)===null||r===void 0||r.call(this,n.candidate))},e.onicecandidateerror=n=>{var r;(r=this.onIceCandidateError)===null||r===void 0||r.call(this,n)},e.oniceconnectionstatechange=()=>{var n;(n=this.onIceConnectionStateChange)===null||n===void 0||n.call(this,e.iceConnectionState)},e.onsignalingstatechange=()=>{var n;(n=this.onSignalingStatechange)===null||n===void 0||n.call(this,e.signalingState)},e.onconnectionstatechange=()=>{var n;(n=this.onConnectionStateChange)===null||n===void 0||n.call(this,e.connectionState)},e.ondatachannel=n=>{var r;(r=this.onDataChannel)===null||r===void 0||r.call(this,n)},e.ontrack=n=>{var r;(r=this.onTrack)===null||r===void 0||r.call(this,n)},e}get logContext(){var e,n;return Object.assign({},(n=(e=this.loggerOptions).loggerContextCb)===null||n===void 0?void 0:n.call(e))}get isICEConnected(){return this._pc!==null&&(this.pc.iceConnectionState==="connected"||this.pc.iceConnectionState==="completed")}addIceCandidate(e){return Q(this,void 0,void 0,function*(){if(this.pc.remoteDescription&&!this.restartingIce)return this.pc.addIceCandidate(e);this.pendingCandidates.push(e)})}setRemoteDescription(e){return Q(this,void 0,void 0,function*(){var n;let r;if(e.type==="offer"){let{stereoMids:a,nackMids:s}=zV(e);this.remoteStereoMids=a,this.remoteNackMids=s}else if(e.type==="answer"){const a=kc.parse((n=e.sdp)!==null&&n!==void 0?n:"");a.media.forEach(s=>{s.type==="audio"&&this.trackBitrates.some(l=>{if(!l.transceiver||s.mid!=l.transceiver.mid)return!1;let c=0;if(s.rtp.some(p=>p.codec.toUpperCase()===l.codec.toUpperCase()?(c=p.payload,!0):!1),c===0)return!0;let h=!1;for(const p of s.fmtp)if(p.payload===c){p.config=p.config.split(";").filter(v=>!v.includes("maxaveragebitrate")).join(";"),l.maxbr>0&&(p.config+=";maxaveragebitrate=".concat(l.maxbr*1e3)),h=!0;break}return h||l.maxbr>0&&s.fmtp.push({payload:c,config:"maxaveragebitrate=".concat(l.maxbr*1e3)}),!0})}),r=kc.write(a)}yield this.setMungedSDP(e,r,!0),this.pendingCandidates.forEach(a=>{this.pc.addIceCandidate(a)}),this.pendingCandidates=[],this.restartingIce=!1,this.renegotiate?(this.renegotiate=!1,yield this.createAndSendOffer()):e.type==="answer"&&(this.emit(qh.NegotiationComplete),e.sdp&&kc.parse(e.sdp).media.forEach(s=>{s.type==="video"&&this.emit(qh.RTPVideoPayloadTypes,s.rtp)}))})}createAndSendOffer(e){return Q(this,void 0,void 0,function*(){var n;if(this.onOffer===void 0)return;if(e!=null&&e.iceRestart&&(this.log.debug("restarting ICE",this.logContext),this.restartingIce=!0),this._pc&&this._pc.signalingState==="have-local-offer"){const s=this._pc.remoteDescription;if(e!=null&&e.iceRestart&&s)yield this._pc.setRemoteDescription(s);else{this.renegotiate=!0;return}}else if(!this._pc||this._pc.signalingState==="closed"){this.log.warn("could not createOffer with closed peer connection",this.logContext);return}this.log.debug("starting to negotiate",this.logContext);const r=yield this.pc.createOffer(e);this.log.debug("original offer",Object.assign({sdp:r.sdp},this.logContext));const a=kc.parse((n=r.sdp)!==null&&n!==void 0?n:"");a.media.forEach(s=>{RO(s),s.type==="audio"?EO(s,[],[]):s.type==="video"&&this.trackBitrates.some(l=>{if(!s.msid||!l.cid||!s.msid.includes(l.cid))return!1;let c=0;if(s.rtp.some(p=>p.codec.toUpperCase()===l.codec.toUpperCase()?(c=p.payload,!0):!1),c===0||(Dg(l.codec)&&this.ensureVideoDDExtensionForSVC(s,a),l.codec!=="av1"))return!0;const h=Math.round(l.maxbr*jV);for(const p of s.fmtp)if(p.payload===c){p.config.includes("x-google-start-bitrate")||(p.config+=";x-google-start-bitrate=".concat(h));break}return!0})}),yield this.setMungedSDP(r,kc.write(a)),this.onOffer(r)})}createAndSetAnswer(){return Q(this,void 0,void 0,function*(){var e;const n=yield this.pc.createAnswer(),r=kc.parse((e=n.sdp)!==null&&e!==void 0?e:"");return r.media.forEach(a=>{RO(a),a.type==="audio"&&EO(a,this.remoteStereoMids,this.remoteNackMids)}),yield this.setMungedSDP(n,kc.write(r)),n})}createDataChannel(e,n){return this.pc.createDataChannel(e,n)}addTransceiver(e,n){return this.pc.addTransceiver(e,n)}addTrack(e){if(!this._pc)throw new xi("PC closed, cannot add track");return this._pc.addTrack(e)}setTrackCodecBitrate(e){this.trackBitrates.push(e)}setConfiguration(e){var n;if(!this._pc)throw new xi("PC closed, cannot configure");return(n=this._pc)===null||n===void 0?void 0:n.setConfiguration(e)}canRemoveTrack(){var e;return!!(!((e=this._pc)===null||e===void 0)&&e.removeTrack)}removeTrack(e){var n;return(n=this._pc)===null||n===void 0?void 0:n.removeTrack(e)}getConnectionState(){var e,n;return(n=(e=this._pc)===null||e===void 0?void 0:e.connectionState)!==null&&n!==void 0?n:"closed"}getICEConnectionState(){var e,n;return(n=(e=this._pc)===null||e===void 0?void 0:e.iceConnectionState)!==null&&n!==void 0?n:"closed"}getSignallingState(){var e,n;return(n=(e=this._pc)===null||e===void 0?void 0:e.signalingState)!==null&&n!==void 0?n:"closed"}getTransceivers(){var e,n;return(n=(e=this._pc)===null||e===void 0?void 0:e.getTransceivers())!==null&&n!==void 0?n:[]}getSenders(){var e,n;return(n=(e=this._pc)===null||e===void 0?void 0:e.getSenders())!==null&&n!==void 0?n:[]}getLocalDescription(){var e;return(e=this._pc)===null||e===void 0?void 0:e.localDescription}getRemoteDescription(){var e;return(e=this.pc)===null||e===void 0?void 0:e.remoteDescription}getStats(){return this.pc.getStats()}getConnectedAddress(){return Q(this,void 0,void 0,function*(){var e;if(!this._pc)return;let n="";const r=new Map,a=new Map;if((yield this._pc.getStats()).forEach(c=>{switch(c.type){case"transport":n=c.selectedCandidatePairId;break;case"candidate-pair":n===""&&c.selected&&(n=c.id),r.set(c.id,c);break;case"remote-candidate":a.set(c.id,"".concat(c.address,":").concat(c.port));break}}),n==="")return;const l=(e=r.get(n))===null||e===void 0?void 0:e.remoteCandidateId;if(l!==void 0)return a.get(l)})}setMungedSDP(e,n,r){return Q(this,void 0,void 0,function*(){if(n){const a=e.sdp;e.sdp=n;try{this.log.debug("setting munged ".concat(r?"remote":"local"," description"),this.logContext),r?yield this.pc.setRemoteDescription(e):yield this.pc.setLocalDescription(e);return}catch(s){this.log.warn("not able to set ".concat(e.type,", falling back to unmodified sdp"),Object.assign(Object.assign({},this.logContext),{error:s,sdp:n})),e.sdp=a}}try{r?yield this.pc.setRemoteDescription(e):yield this.pc.setLocalDescription(e)}catch(a){let s="unknown error";a instanceof Error?s=a.message:typeof a=="string"&&(s=a);const l={error:s,sdp:e.sdp};throw!r&&this.pc.remoteDescription&&(l.remoteSdp=this.pc.remoteDescription),this.log.error("unable to set ".concat(e.type),Object.assign(Object.assign({},this.logContext),{fields:l})),new rT(s)}})}ensureVideoDDExtensionForSVC(e,n){var r,a;if(!((r=e.ext)===null||r===void 0?void 0:r.some(l=>l.uri===aO))){if(this.ddExtID===0){let l=0;n.media.forEach(c=>{var h;c.type==="video"&&((h=c.ext)===null||h===void 0||h.forEach(p=>{p.value>l&&(l=p.value)}))}),this.ddExtID=l+1}(a=e.ext)===null||a===void 0||a.push({value:this.ddExtID,uri:aO})}}}function EO(t,e,n){let r=0;t.rtp.some(a=>a.codec==="opus"?(r=a.payload,!0):!1),r>0&&(t.rtcpFb||(t.rtcpFb=[]),n.includes(t.mid)&&!t.rtcpFb.some(a=>a.payload===r&&a.type==="nack")&&t.rtcpFb.push({payload:r,type:"nack"}),e.includes(t.mid)&&t.fmtp.some(a=>a.payload===r?(a.config.includes("stereo=1")||(a.config+=";stereo=1"),!0):!1))}function zV(t){var e;const n=[],r=[],a=kc.parse((e=t.sdp)!==null&&e!==void 0?e:"");let s=0;return a.media.forEach(l=>{var c;l.type==="audio"&&(l.rtp.some(h=>h.codec==="opus"?(s=h.payload,!0):!1),!((c=l.rtcpFb)===null||c===void 0)&&c.some(h=>h.payload===s&&h.type==="nack")&&r.push(l.mid),l.fmtp.some(h=>h.payload===s?(h.config.includes("sprop-stereo=1")&&n.push(l.mid),!0):!1))}),{stereoMids:n,nackMids:r}}function RO(t){if(t.connection){const e=t.connection.ip.indexOf(":")>=0;(t.connection.version===4&&e||t.connection.version===6&&!e)&&(t.connection.ip="0.0.0.0",t.connection.version=4)}}const PT="vp8",BV={audioPreset:sT.music,dtx:!0,red:!0,forceStereo:!1,simulcast:!0,screenShareEncoding:uT.h1080fps15.encoding,stopMicTrackOnMute:!1,videoCodec:PT,backupCodec:!0},PO={deviceId:{ideal:"default"},autoGainControl:!0,echoCancellation:!0,noiseSuppression:!0,voiceIsolation:!0},DO={deviceId:{ideal:"default"},resolution:Pg.h720.resolution},HV={adaptiveStream:!1,dynacast:!1,stopLocalTrackOnUnpublish:!0,reconnectPolicy:new M8,disconnectOnPageLeave:!0,webAudioMix:!1},DT={autoSubscribe:!0,maxRetries:1,peerConnectionTimeout:15e3,websocketTimeout:15e3};var Jr;(function(t){t[t.NEW=0]="NEW",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED",t[t.FAILED=3]="FAILED",t[t.CLOSING=4]="CLOSING",t[t.CLOSED=5]="CLOSED"})(Jr||(Jr={}));class $V{get needsPublisher(){return this.isPublisherConnectionRequired}get needsSubscriber(){return this.isSubscriberConnectionRequired}get currentState(){return this.state}constructor(e,n,r){var a;this.peerConnectionTimeout=DT.peerConnectionTimeout,this.log=Nn,this.updateState=()=>{var s;const l=this.state,c=this.requiredTransports.map(h=>h.getConnectionState());c.every(h=>h==="connected")?this.state=Jr.CONNECTED:c.some(h=>h==="failed")?this.state=Jr.FAILED:c.some(h=>h==="connecting")?this.state=Jr.CONNECTING:c.every(h=>h==="closed")?this.state=Jr.CLOSED:c.some(h=>h==="closed")?this.state=Jr.CLOSING:c.every(h=>h==="new")&&(this.state=Jr.NEW),l!==this.state&&(this.log.debug("pc state change: from ".concat(Jr[l]," to ").concat(Jr[this.state]),this.logContext),(s=this.onStateChange)===null||s===void 0||s.call(this,this.state,this.publisher.getConnectionState(),this.subscriber.getConnectionState()))},this.log=lu((a=r.loggerName)!==null&&a!==void 0?a:xs.PCManager),this.loggerOptions=r,this.isPublisherConnectionRequired=!n,this.isSubscriberConnectionRequired=n,this.publisher=new _O(e,r),this.subscriber=new _O(e,r),this.publisher.onConnectionStateChange=this.updateState,this.subscriber.onConnectionStateChange=this.updateState,this.publisher.onIceConnectionStateChange=this.updateState,this.subscriber.onIceConnectionStateChange=this.updateState,this.publisher.onSignalingStatechange=this.updateState,this.subscriber.onSignalingStatechange=this.updateState,this.publisher.onIceCandidate=s=>{var l;(l=this.onIceCandidate)===null||l===void 0||l.call(this,s,Ts.PUBLISHER)},this.subscriber.onIceCandidate=s=>{var l;(l=this.onIceCandidate)===null||l===void 0||l.call(this,s,Ts.SUBSCRIBER)},this.subscriber.onDataChannel=s=>{var l;(l=this.onDataChannel)===null||l===void 0||l.call(this,s)},this.subscriber.onTrack=s=>{var l;(l=this.onTrack)===null||l===void 0||l.call(this,s)},this.publisher.onOffer=s=>{var l;(l=this.onPublisherOffer)===null||l===void 0||l.call(this,s)},this.state=Jr.NEW,this.connectionLock=new to,this.remoteOfferLock=new to}get logContext(){var e,n;return Object.assign({},(n=(e=this.loggerOptions).loggerContextCb)===null||n===void 0?void 0:n.call(e))}requirePublisher(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.isPublisherConnectionRequired=e,this.updateState()}requireSubscriber(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.isSubscriberConnectionRequired=e,this.updateState()}createAndSendPublisherOffer(e){return this.publisher.createAndSendOffer(e)}setPublisherAnswer(e){return this.publisher.setRemoteDescription(e)}removeTrack(e){return this.publisher.removeTrack(e)}close(){return Q(this,void 0,void 0,function*(){if(this.publisher&&this.publisher.getSignallingState()!=="closed"){const e=this.publisher;for(const n of e.getSenders())try{e.canRemoveTrack()&&e.removeTrack(n)}catch(r){this.log.warn("could not removeTrack",Object.assign(Object.assign({},this.logContext),{error:r}))}}yield Promise.all([this.publisher.close(),this.subscriber.close()]),this.updateState()})}triggerIceRestart(){return Q(this,void 0,void 0,function*(){this.subscriber.restartingIce=!0,this.needsPublisher&&(yield this.createAndSendPublisherOffer({iceRestart:!0}))})}addIceCandidate(e,n){return Q(this,void 0,void 0,function*(){n===Ts.PUBLISHER?yield this.publisher.addIceCandidate(e):yield this.subscriber.addIceCandidate(e)})}createSubscriberAnswerFromOffer(e){return Q(this,void 0,void 0,function*(){this.log.debug("received server offer",Object.assign(Object.assign({},this.logContext),{RTCSdpType:e.type,sdp:e.sdp,signalingState:this.subscriber.getSignallingState().toString()}));const n=yield this.remoteOfferLock.lock();try{return yield this.subscriber.setRemoteDescription(e),yield this.subscriber.createAndSetAnswer()}finally{n()}})}updateConfiguration(e,n){this.publisher.setConfiguration(e),this.subscriber.setConfiguration(e),n&&this.triggerIceRestart()}ensurePCTransportConnection(e,n){return Q(this,void 0,void 0,function*(){var r;const a=yield this.connectionLock.lock();try{this.isPublisherConnectionRequired&&this.publisher.getConnectionState()!=="connected"&&this.publisher.getConnectionState()!=="connecting"&&(this.log.debug("negotiation required, start negotiating",this.logContext),this.publisher.negotiate()),yield Promise.all((r=this.requiredTransports)===null||r===void 0?void 0:r.map(s=>this.ensureTransportConnected(s,e,n)))}finally{a()}})}negotiate(e){return Q(this,void 0,void 0,function*(){return new Promise((n,r)=>Q(this,void 0,void 0,function*(){const a=setTimeout(()=>{r("negotiation timed out")},this.peerConnectionTimeout),s=()=>{clearTimeout(a),r("negotiation aborted")};e.signal.addEventListener("abort",s),this.publisher.once(qh.NegotiationStarted,()=>{e.signal.aborted||this.publisher.once(qh.NegotiationComplete,()=>{clearTimeout(a),n()})}),yield this.publisher.negotiate(l=>{clearTimeout(a),r(l)})}))})}addPublisherTransceiver(e,n){return this.publisher.addTransceiver(e,n)}addPublisherTrack(e){return this.publisher.addTrack(e)}createPublisherDataChannel(e,n){return this.publisher.createDataChannel(e,n)}getConnectedAddress(e){return e===Ts.PUBLISHER?this.publisher.getConnectedAddress():e===Ts.SUBSCRIBER?this.publisher.getConnectedAddress():this.requiredTransports[0].getConnectedAddress()}get requiredTransports(){const e=[];return this.isPublisherConnectionRequired&&e.push(this.publisher),this.isSubscriberConnectionRequired&&e.push(this.subscriber),e}ensureTransportConnected(e,n){return Q(this,arguments,void 0,function(r,a){var s=this;let l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.peerConnectionTimeout;return function*(){if(r.getConnectionState()!=="connected")return new Promise((h,p)=>Q(s,void 0,void 0,function*(){const v=()=>{this.log.warn("abort transport connection",this.logContext),Qi.clearTimeout(b),p(new br("room connection has been cancelled",Un.Cancelled))};a!=null&&a.signal.aborted&&v(),a==null||a.signal.addEventListener("abort",v);const b=Qi.setTimeout(()=>{a==null||a.signal.removeEventListener("abort",v),p(new br("could not establish pc connection",Un.InternalError))},l);for(;this.state!==Jr.CONNECTED;)if(yield io(50),a!=null&&a.signal.aborted){p(new br("room connection has been cancelled",Un.Cancelled));return}Qi.clearTimeout(b),a==null||a.signal.removeEventListener("abort",v),h()}))}()})}}class ei extends Error{constructor(e,n,r){super(n),this.code=e,this.message=OO(n,ei.MAX_MESSAGE_BYTES),this.data=r?OO(r,ei.MAX_DATA_BYTES):void 0}static fromProto(e){return new ei(e.code,e.message,e.data)}toProto(){return new WD({code:this.code,message:this.message,data:this.data})}static builtIn(e,n){return new ei(ei.ErrorCode[e],ei.ErrorMessage[e],n)}}ei.MAX_MESSAGE_BYTES=256,ei.MAX_DATA_BYTES=15360,ei.ErrorCode={APPLICATION_ERROR:1500,CONNECTION_TIMEOUT:1501,RESPONSE_TIMEOUT:1502,RECIPIENT_DISCONNECTED:1503,RESPONSE_PAYLOAD_TOO_LARGE:1504,SEND_FAILED:1505,UNSUPPORTED_METHOD:1400,RECIPIENT_NOT_FOUND:1401,REQUEST_PAYLOAD_TOO_LARGE:1402,UNSUPPORTED_SERVER:1403,UNSUPPORTED_VERSION:1404},ei.ErrorMessage={APPLICATION_ERROR:"Application error in method handler",CONNECTION_TIMEOUT:"Connection timeout",RESPONSE_TIMEOUT:"Response timeout",RECIPIENT_DISCONNECTED:"Recipient disconnected",RESPONSE_PAYLOAD_TOO_LARGE:"Response payload too large",SEND_FAILED:"Failed to send",UNSUPPORTED_METHOD:"Method not supported at destination",RECIPIENT_NOT_FOUND:"Recipient not found",REQUEST_PAYLOAD_TOO_LARGE:"Request payload too large",UNSUPPORTED_SERVER:"RPC not supported by server",UNSUPPORTED_VERSION:"Unsupported RPC version"};const AO=15360;function AT(t){return new TextEncoder().encode(t).length}function OO(t,e){if(AT(t)<=e)return t;let n=0,r=t.length;const a=new TextEncoder;for(;n<r;){const s=Math.floor((n+r+1)/2);a.encode(t.slice(0,s)).length<=e?n=s:r=s-1}return t.slice(0,n)}const OT=2e3;function lb(t,e){if(!e)return 0;let n,r;return"bytesReceived"in t?(n=t.bytesReceived,r=e.bytesReceived):"bytesSent"in t&&(n=t.bytesSent,r=e.bytesSent),n===void 0||r===void 0||t.timestamp===void 0||e.timestamp===void 0?0:(n-r)*8*1e3/(t.timestamp-e.timestamp)}const qV=1e3;class MO extends De{get sender(){return this._sender}set sender(e){this._sender=e}get constraints(){return this._constraints}constructor(e,n,r){let a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,s=arguments.length>4?arguments[4]:void 0;super(e,n,s),this.manuallyStopped=!1,this._isUpstreamPaused=!1,this.handleTrackMuteEvent=()=>this.debouncedTrackMuteHandler().catch(()=>this.log.debug("track mute bounce got cancelled by an unmute event",this.logContext)),this.debouncedTrackMuteHandler=RT(()=>Q(this,void 0,void 0,function*(){yield this.pauseUpstream()}),5e3),this.handleTrackUnmuteEvent=()=>Q(this,void 0,void 0,function*(){this.debouncedTrackMuteHandler.cancel("unmute"),yield this.resumeUpstream()}),this.handleEnded=()=>{this.isInBackground&&(this.reacquireTrack=!0),this._mediaStreamTrack.removeEventListener("mute",this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener("unmute",this.handleTrackUnmuteEvent),this.emit(Qe.Ended,this)},this.reacquireTrack=!1,this.providedByUser=a,this.muteLock=new to,this.pauseUpstreamLock=new to,this.processorLock=new to,this.restartLock=new to,this.setMediaStreamTrack(e,!0),this._constraints=e.getConstraints(),r&&(this._constraints=r)}get id(){return this._mediaStreamTrack.id}get dimensions(){if(this.kind!==De.Kind.Video)return;const{width:e,height:n}=this._mediaStreamTrack.getSettings();if(e&&n)return{width:e,height:n}}get isUpstreamPaused(){return this._isUpstreamPaused}get isUserProvided(){return this.providedByUser}get mediaStreamTrack(){var e,n;return(n=(e=this.processor)===null||e===void 0?void 0:e.processedTrack)!==null&&n!==void 0?n:this._mediaStreamTrack}get isLocal(){return!0}getSourceTrackSettings(){return this._mediaStreamTrack.getSettings()}setMediaStreamTrack(e,n){return Q(this,void 0,void 0,function*(){var r;if(e===this._mediaStreamTrack&&!n)return;this._mediaStreamTrack&&(this.attachedElements.forEach(s=>{zh(this._mediaStreamTrack,s)}),this.debouncedTrackMuteHandler.cancel("new-track"),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.removeEventListener("mute",this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener("unmute",this.handleTrackUnmuteEvent)),this.mediaStream=new MediaStream([e]),e&&(e.addEventListener("ended",this.handleEnded),e.addEventListener("mute",this.handleTrackMuteEvent),e.addEventListener("unmute",this.handleTrackUnmuteEvent),this._constraints=e.getConstraints());let a;if(this.processor&&e){const s=yield this.processorLock.lock();try{if(this.log.debug("restarting processor",this.logContext),this.kind==="unknown")throw TypeError("cannot set processor on track of unknown kind");this.processorElement&&(Vh(e,this.processorElement),this.processorElement.muted=!0),yield this.processor.restart({track:e,kind:this.kind,element:this.processorElement}),a=this.processor.processedTrack}finally{s()}}this.sender&&((r=this.sender.transport)===null||r===void 0?void 0:r.state)!=="closed"&&(yield this.sender.replaceTrack(a??e)),!this.providedByUser&&this._mediaStreamTrack!==e&&this._mediaStreamTrack.stop(),this._mediaStreamTrack=e,e&&(this._mediaStreamTrack.enabled=!this.isMuted,yield this.resumeUpstream(),this.attachedElements.forEach(s=>{Vh(a??e,s)}))})}waitForDimensions(){return Q(this,arguments,void 0,function(){var e=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:qV;return function*(){var r;if(e.kind===De.Kind.Audio)throw new Error("cannot get dimensions for audio tracks");((r=ws())===null||r===void 0?void 0:r.os)==="iOS"&&(yield io(10));const a=Date.now();for(;Date.now()-a<n;){const s=e.dimensions;if(s)return s;yield io(50)}throw new uu("unable to get track dimensions after timeout")}()})}setDeviceId(e){return Q(this,void 0,void 0,function*(){return this._constraints.deviceId===e&&this._mediaStreamTrack.getSettings().deviceId===Sc(e)||(this._constraints.deviceId=e,this.isMuted)?!0:(yield this.restartTrack(),Sc(e)===this._mediaStreamTrack.getSettings().deviceId)})}getDeviceId(){return Q(this,arguments,void 0,function(){var e=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){if(e.source===De.Source.ScreenShare)return;const{deviceId:r,groupId:a}=e._mediaStreamTrack.getSettings(),s=e.kind===De.Kind.Audio?"audioinput":"videoinput";return n?zi.getInstance().normalizeDeviceId(s,r,a):r}()})}mute(){return Q(this,void 0,void 0,function*(){return this.setTrackMuted(!0),this})}unmute(){return Q(this,void 0,void 0,function*(){return this.setTrackMuted(!1),this})}replaceTrack(e,n){return Q(this,void 0,void 0,function*(){if(!this.sender)throw new uu("unable to replace an unpublished track");let r,a;return typeof n=="boolean"?r=n:n!==void 0&&(r=n.userProvidedTrack,a=n.stopProcessor),this.providedByUser=r??!0,this.log.debug("replace MediaStreamTrack",this.logContext),yield this.setMediaStreamTrack(e),a&&this.processor&&(yield this.stopProcessor()),this})}restart(e){return Q(this,void 0,void 0,function*(){this.manuallyStopped=!1;const n=yield this.restartLock.lock();try{e||(e=this._constraints);const{deviceId:r,facingMode:a}=e,s=L8(e,["deviceId","facingMode"]);this.log.debug("restarting track with constraints",Object.assign(Object.assign({},this.logContext),{constraints:e}));const l={audio:!1,video:!1};this.kind===De.Kind.Video?l.video=r||a?{deviceId:r,facingMode:a}:!0:l.audio=r?{deviceId:r}:!0,this.attachedElements.forEach(p=>{zh(this.mediaStreamTrack,p)}),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.stop();const h=(yield navigator.mediaDevices.getUserMedia(l)).getTracks()[0];return yield h.applyConstraints(s),h.addEventListener("ended",this.handleEnded),this.log.debug("re-acquired MediaStreamTrack",this.logContext),yield this.setMediaStreamTrack(h),this._constraints=e,this.emit(Qe.Restarted,this),this.manuallyStopped&&(this.log.warn("track was stopped during a restart, stopping restarted track",this.logContext),this.stop()),this}finally{n()}})}setTrackMuted(e){this.log.debug("setting ".concat(this.kind," track ").concat(e?"muted":"unmuted"),this.logContext),!(this.isMuted===e&&this._mediaStreamTrack.enabled!==e)&&(this.isMuted=e,this._mediaStreamTrack.enabled=!e,this.emit(e?Qe.Muted:Qe.Unmuted,this))}get needsReAcquisition(){return this._mediaStreamTrack.readyState!=="live"||this._mediaStreamTrack.muted||!this._mediaStreamTrack.enabled||this.reacquireTrack}handleAppVisibilityChanged(){const e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return Q(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),oO()&&(this.log.debug("visibility changed, is in Background: ".concat(this.isInBackground),this.logContext),!this.isInBackground&&this.needsReAcquisition&&!this.isUserProvided&&!this.isMuted&&(this.log.debug("track needs to be reacquired, restarting ".concat(this.source),this.logContext),yield this.restart(),this.reacquireTrack=!1))})}stop(){var e;this.manuallyStopped=!0,super.stop(),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.removeEventListener("mute",this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener("unmute",this.handleTrackUnmuteEvent),(e=this.processor)===null||e===void 0||e.destroy(),this.processor=void 0}pauseUpstream(){return Q(this,void 0,void 0,function*(){var e;const n=yield this.pauseUpstreamLock.lock();try{if(this._isUpstreamPaused===!0)return;if(!this.sender){this.log.warn("unable to pause upstream for an unpublished track",this.logContext);return}this._isUpstreamPaused=!0,this.emit(Qe.UpstreamPaused,this);const r=ws();if((r==null?void 0:r.name)==="Safari"&&bc(r.version,"12.0")<0)throw new nT("pauseUpstream is not supported on Safari < 12.");((e=this.sender.transport)===null||e===void 0?void 0:e.state)!=="closed"&&(yield this.sender.replaceTrack(null))}finally{n()}})}resumeUpstream(){return Q(this,void 0,void 0,function*(){var e;const n=yield this.pauseUpstreamLock.lock();try{if(this._isUpstreamPaused===!1)return;if(!this.sender){this.log.warn("unable to resume upstream for an unpublished track",this.logContext);return}this._isUpstreamPaused=!1,this.emit(Qe.UpstreamResumed,this),((e=this.sender.transport)===null||e===void 0?void 0:e.state)!=="closed"&&(yield this.sender.replaceTrack(this.mediaStreamTrack))}finally{n()}})}getRTCStatsReport(){return Q(this,void 0,void 0,function*(){var e;return!((e=this.sender)===null||e===void 0)&&e.getStats?yield this.sender.getStats():void 0})}setProcessor(e){return Q(this,arguments,void 0,function(n){var r=this;let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){var s;const l=yield r.processorLock.lock();try{r.log.debug("setting up processor",r.logContext);const c=document.createElement(r.kind),h={kind:r.kind,track:r._mediaStreamTrack,element:c,audioContext:r.audioContext};if(yield n.init(h),r.log.debug("processor initialized",r.logContext),r.processor&&(yield r.stopProcessor()),r.kind==="unknown")throw TypeError("cannot set processor on track of unknown kind");if(Vh(r._mediaStreamTrack,c),c.muted=!0,c.play().catch(p=>r.log.error("failed to play processor element",Object.assign(Object.assign({},r.logContext),{error:p}))),r.processor=n,r.processorElement=c,r.processor.processedTrack){for(const p of r.attachedElements)p!==r.processorElement&&a&&(zh(r._mediaStreamTrack,p),Vh(r.processor.processedTrack,p));yield(s=r.sender)===null||s===void 0?void 0:s.replaceTrack(r.processor.processedTrack)}r.emit(Qe.TrackProcessorUpdate,r.processor)}finally{l()}}()})}getProcessor(){return this.processor}stopProcessor(){return Q(this,arguments,void 0,function(){var e=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){var r,a;e.processor&&(e.log.debug("stopping processor",e.logContext),(r=e.processor.processedTrack)===null||r===void 0||r.stop(),yield e.processor.destroy(),e.processor=void 0,n||((a=e.processorElement)===null||a===void 0||a.remove(),e.processorElement=void 0),yield e._mediaStreamTrack.applyConstraints(e._constraints),yield e.setMediaStreamTrack(e._mediaStreamTrack,!0),e.emit(Qe.TrackProcessorUpdate))}()})}}class ub extends MO{get enhancedNoiseCancellation(){return this.isKrispNoiseFilterEnabled}constructor(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0;super(e,De.Kind.Audio,n,r,s),this.stopOnMute=!1,this.isKrispNoiseFilterEnabled=!1,this.monitorSender=()=>Q(this,void 0,void 0,function*(){if(!this.sender){this._currentBitrate=0;return}let l;try{l=yield this.getSenderStats()}catch(c){this.log.error("could not get audio sender stats",Object.assign(Object.assign({},this.logContext),{error:c}));return}l&&this.prevStats&&(this._currentBitrate=lb(l,this.prevStats)),this.prevStats=l}),this.handleKrispNoiseFilterEnable=()=>{this.isKrispNoiseFilterEnabled=!0,this.log.debug("Krisp noise filter enabled",this.logContext),this.emit(Qe.AudioTrackFeatureUpdate,this,ul.TF_ENHANCED_NOISE_CANCELLATION,!0)},this.handleKrispNoiseFilterDisable=()=>{this.isKrispNoiseFilterEnabled=!1,this.log.debug("Krisp noise filter disabled",this.logContext),this.emit(Qe.AudioTrackFeatureUpdate,this,ul.TF_ENHANCED_NOISE_CANCELLATION,!1)},this.audioContext=a,this.checkForSilence()}mute(){const e=Object.create(null,{mute:{get:()=>super.mute}});return Q(this,void 0,void 0,function*(){const n=yield this.muteLock.lock();try{return this.isMuted?(this.log.debug("Track already muted",this.logContext),this):(this.source===De.Source.Microphone&&this.stopOnMute&&!this.isUserProvided&&(this.log.debug("stopping mic track",this.logContext),this._mediaStreamTrack.stop()),yield e.mute.call(this),this)}finally{n()}})}unmute(){const e=Object.create(null,{unmute:{get:()=>super.unmute}});return Q(this,void 0,void 0,function*(){const n=yield this.muteLock.lock();try{if(!this.isMuted)return this.log.debug("Track already unmuted",this.logContext),this;const r=this._constraints.deviceId&&this._mediaStreamTrack.getSettings().deviceId!==Sc(this._constraints.deviceId);return this.source===De.Source.Microphone&&(this.stopOnMute||this._mediaStreamTrack.readyState==="ended"||r)&&!this.isUserProvided&&(this.log.debug("reacquiring mic track",this.logContext),yield this.restartTrack()),yield e.unmute.call(this),this}finally{n()}})}restartTrack(e){return Q(this,void 0,void 0,function*(){let n;if(e){const r=CT({audio:e});typeof r.audio!="boolean"&&(n=r.audio)}yield this.restart(n)})}restart(e){const n=Object.create(null,{restart:{get:()=>super.restart}});return Q(this,void 0,void 0,function*(){const r=yield n.restart.call(this,e);return this.checkForSilence(),r})}startMonitor(){ao()&&(this.monitorInterval||(this.monitorInterval=setInterval(()=>{this.monitorSender()},OT)))}setProcessor(e){return Q(this,void 0,void 0,function*(){var n;const r=yield this.processorLock.lock();try{if(!fl()&&!this.audioContext)throw Error("Audio context needs to be set on LocalAudioTrack in order to enable processors");this.processor&&(yield this.stopProcessor());const a={kind:this.kind,track:this._mediaStreamTrack,audioContext:this.audioContext};this.log.debug("setting up audio processor ".concat(e.name),this.logContext),yield e.init(a),this.processor=e,this.processor.processedTrack&&(yield(n=this.sender)===null||n===void 0?void 0:n.replaceTrack(this.processor.processedTrack),this.processor.processedTrack.addEventListener("enable-lk-krisp-noise-filter",this.handleKrispNoiseFilterEnable),this.processor.processedTrack.addEventListener("disable-lk-krisp-noise-filter",this.handleKrispNoiseFilterDisable)),this.emit(Qe.TrackProcessorUpdate,this.processor)}finally{r()}})}setAudioContext(e){this.audioContext=e}getSenderStats(){return Q(this,void 0,void 0,function*(){var e;if(!(!((e=this.sender)===null||e===void 0)&&e.getStats))return;const n=yield this.sender.getStats();let r;return n.forEach(a=>{a.type==="outbound-rtp"&&(r={type:"audio",streamId:a.id,packetsSent:a.packetsSent,packetsLost:a.packetsLost,bytesSent:a.bytesSent,timestamp:a.timestamp,roundTripTime:a.roundTripTime,jitter:a.jitter})}),r})}checkForSilence(){return Q(this,void 0,void 0,function*(){const e=yield gO(this);return e&&(this.isMuted||this.log.warn("silence detected on local audio track",this.logContext),this.emit(Qe.AudioSilenceDetected)),e})}}function WV(t,e,n){switch(t.kind){case"audio":return new ub(t,e,!1,void 0,n);case"video":return new db(t,e,!1,n);default:throw new uu("unsupported track type: ".concat(t.kind))}}const GV=Object.values(Pg),YV=Object.values(lT),KV=Object.values(uT),ZV=[Pg.h180,Pg.h360],QV=[lT.h180,lT.h360],XV=t=>[{scaleResolutionDownBy:2,fps:t.encoding.maxFramerate}].map(n=>{var r,a;return new gr(Math.floor(t.width/n.scaleResolutionDownBy),Math.floor(t.height/n.scaleResolutionDownBy),Math.max(15e4,Math.floor(t.encoding.maxBitrate/(Math.pow(n.scaleResolutionDownBy,2)*(((r=t.encoding.maxFramerate)!==null&&r!==void 0?r:30)/((a=n.fps)!==null&&a!==void 0?a:30))))),n.fps,t.encoding.priority)}),MT=["q","h","f"];function LT(t,e,n,r){var a,s;let l=r==null?void 0:r.videoEncoding;t&&(l=r==null?void 0:r.screenShareEncoding);const c=r==null?void 0:r.simulcast,h=r==null?void 0:r.scalabilityMode,p=r==null?void 0:r.videoCodec;if(!l&&!c&&!h||!e||!n)return[{}];l||(l=ez(t,e,n,p),Nn.debug("using video encoding",l));const v=l.maxFramerate,b=new gr(e,n,l.maxBitrate,l.maxFramerate,l.priority);if(h&&Dg(p)){const E=new cb(h),R=[];if(E.spatial>3)throw new Error("unsupported scalabilityMode: ".concat(h));const M=ws();if(yc()||fl()||(M==null?void 0:M.name)==="Chrome"&&bc(M==null?void 0:M.version,"113")<0){const A=E.suffix=="h"?2:3;for(let U=0;U<E.spatial;U+=1)R.push({rid:MT[2-U],maxBitrate:l.maxBitrate/Math.pow(A,U),maxFramerate:b.encoding.maxFramerate});R[0].scalabilityMode=h}else R.push({maxBitrate:l.maxBitrate,maxFramerate:b.encoding.maxFramerate,scalabilityMode:h});return b.encoding.priority&&(R[0].priority=b.encoding.priority,R[0].networkPriority=b.encoding.priority),Nn.debug("using svc encoding",{encodings:R}),R}if(!c)return[l];let k=[];t?k=(a=NO(r==null?void 0:r.screenShareSimulcastLayers))!==null&&a!==void 0?a:LO(t,b):k=(s=NO(r==null?void 0:r.videoSimulcastLayers))!==null&&s!==void 0?s:LO(t,b);let T;if(k.length>0){const E=k[0];k.length>1&&([,T]=k);const R=Math.max(e,n);if(R>=960&&T)return NT(e,n,[E,T,b],v);if(R>=480)return NT(e,n,[E,b],v)}return NT(e,n,[b])}function JV(t,e,n){var r,a,s,l;if(!n.backupCodec||n.backupCodec===!0||n.backupCodec.codec===n.videoCodec)return;e!==n.backupCodec.codec&&Nn.warn("requested a different codec than specified as backup",{serverRequested:e,backup:n.backupCodec.codec}),n.videoCodec=e,n.videoEncoding=n.backupCodec.encoding;const c=t.mediaStreamTrack.getSettings(),h=(r=c.width)!==null&&r!==void 0?r:(a=t.dimensions)===null||a===void 0?void 0:a.width,p=(s=c.height)!==null&&s!==void 0?s:(l=t.dimensions)===null||l===void 0?void 0:l.height;return t.source===De.Source.ScreenShare&&n.simulcast&&(n.simulcast=!1),LT(t.source===De.Source.ScreenShare,h,p,n)}function ez(t,e,n,r){const a=tz(t,e,n);let{encoding:s}=a[0];const l=Math.max(e,n);for(let c=0;c<a.length;c+=1){const h=a[c];if(s=h.encoding,h.width>=l)break}if(r)switch(r){case"av1":s=Object.assign({},s),s.maxBitrate=s.maxBitrate*.7;break;case"vp9":s=Object.assign({},s),s.maxBitrate=s.maxBitrate*.85;break}return s}function tz(t,e,n){if(t)return KV;const r=e>n?e/n:n/e;return Math.abs(r-16/9)<Math.abs(r-4/3)?GV:YV}function LO(t,e){if(t)return XV(e);const{width:n,height:r}=e,a=n>r?n/r:r/n;return Math.abs(a-16/9)<Math.abs(a-4/3)?ZV:QV}function NT(t,e,n,r){const a=[];if(n.forEach((s,l)=>{if(l>=MT.length)return;const c=Math.min(t,e),p={rid:MT[l],scaleResolutionDownBy:Math.max(1,c/Math.min(s.width,s.height)),maxBitrate:s.encoding.maxBitrate},v=r&&s.encoding.maxFramerate?Math.min(r,s.encoding.maxFramerate):s.encoding.maxFramerate;v&&(p.maxFramerate=v);const b=Bh()||l===0;s.encoding.priority&&b&&(p.priority=s.encoding.priority,p.networkPriority=s.encoding.priority),a.push(p)}),fl()&&lO()==="ios"){let s;a.forEach(c=>{s?c.maxFramerate&&c.maxFramerate>s&&(s=c.maxFramerate):s=c.maxFramerate});let l=!0;a.forEach(c=>{var h;c.maxFramerate!=s&&(l&&(l=!1,Nn.info("Simulcast on iOS React-Native requires all encodings to share the same framerate.")),Nn.info('Setting framerate of encoding "'.concat((h=c.rid)!==null&&h!==void 0?h:"",'" to ').concat(s)),c.maxFramerate=s)})}return a}function NO(t){if(t)return t.sort((e,n)=>{const{encoding:r}=e,{encoding:a}=n;return r.maxBitrate>a.maxBitrate?1:r.maxBitrate<a.maxBitrate?-1:r.maxBitrate===a.maxBitrate&&r.maxFramerate&&a.maxFramerate?r.maxFramerate>a.maxFramerate?1:-1:0})}class cb{constructor(e){const n=e.match(/^L(\d)T(\d)(h|_KEY|_KEY_SHIFT){0,1}$/);if(!n)throw new Error("invalid scalability mode");if(this.spatial=parseInt(n[1]),this.temporal=parseInt(n[2]),n.length>3)switch(n[3]){case"h":case"_KEY":case"_KEY_SHIFT":this.suffix=n[3]}}toString(){var e;return"L".concat(this.spatial,"T").concat(this.temporal).concat((e=this.suffix)!==null&&e!==void 0?e:"")}}function nz(t){return t.source===De.Source.ScreenShare||t.constraints.height&&Sc(t.constraints.height)>=1080?"maintain-resolution":"balanced"}const rz=5e3;class db extends MO{get sender(){return this._sender}set sender(e){this._sender=e,this.degradationPreference&&this.setDegradationPreference(this.degradationPreference)}constructor(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=arguments.length>3?arguments[3]:void 0;super(e,De.Kind.Video,n,r,a),this.simulcastCodecs=new Map,this.degradationPreference="balanced",this.monitorSender=()=>Q(this,void 0,void 0,function*(){if(!this.sender){this._currentBitrate=0;return}let s;try{s=yield this.getSenderStats()}catch(c){this.log.error("could not get audio sender stats",Object.assign(Object.assign({},this.logContext),{error:c}));return}const l=new Map(s.map(c=>[c.rid,c]));if(this.prevStats){let c=0;l.forEach((h,p)=>{var v;const b=(v=this.prevStats)===null||v===void 0?void 0:v.get(p);c+=lb(h,b)}),this._currentBitrate=c}this.prevStats=l}),this.senderLock=new to}get isSimulcast(){return!!(this.sender&&this.sender.getParameters().encodings.length>1)}startMonitor(e){var n;if(this.signalClient=e,!ao())return;const r=(n=this.sender)===null||n===void 0?void 0:n.getParameters();r&&(this.encodings=r.encodings),!this.monitorInterval&&(this.monitorInterval=setInterval(()=>{this.monitorSender()},OT))}stop(){this._mediaStreamTrack.getConstraints(),this.simulcastCodecs.forEach(e=>{e.mediaStreamTrack.stop()}),super.stop()}pauseUpstream(){const e=Object.create(null,{pauseUpstream:{get:()=>super.pauseUpstream}});return Q(this,void 0,void 0,function*(){var n,r,a,s,l;yield e.pauseUpstream.call(this);try{for(var c=!0,h=pc(this.simulcastCodecs.values()),p;p=yield h.next(),n=p.done,!n;c=!0)s=p.value,c=!1,yield(l=s.sender)===null||l===void 0?void 0:l.replaceTrack(null)}catch(v){r={error:v}}finally{try{!c&&!n&&(a=h.return)&&(yield a.call(h))}finally{if(r)throw r.error}}})}resumeUpstream(){const e=Object.create(null,{resumeUpstream:{get:()=>super.resumeUpstream}});return Q(this,void 0,void 0,function*(){var n,r,a,s,l;yield e.resumeUpstream.call(this);try{for(var c=!0,h=pc(this.simulcastCodecs.values()),p;p=yield h.next(),n=p.done,!n;c=!0){s=p.value,c=!1;const v=s;yield(l=v.sender)===null||l===void 0?void 0:l.replaceTrack(v.mediaStreamTrack)}}catch(v){r={error:v}}finally{try{!c&&!n&&(a=h.return)&&(yield a.call(h))}finally{if(r)throw r.error}}})}mute(){const e=Object.create(null,{mute:{get:()=>super.mute}});return Q(this,void 0,void 0,function*(){const n=yield this.muteLock.lock();try{return this.isMuted?(this.log.debug("Track already muted",this.logContext),this):(this.source===De.Source.Camera&&!this.isUserProvided&&(this.log.debug("stopping camera track",this.logContext),this._mediaStreamTrack.stop()),yield e.mute.call(this),this)}finally{n()}})}unmute(){const e=Object.create(null,{unmute:{get:()=>super.unmute}});return Q(this,void 0,void 0,function*(){const n=yield this.muteLock.lock();try{return this.isMuted?(this.source===De.Source.Camera&&!this.isUserProvided&&(this.log.debug("reacquiring camera track",this.logContext),yield this.restartTrack()),yield e.unmute.call(this),this):(this.log.debug("Track already unmuted",this.logContext),this)}finally{n()}})}setTrackMuted(e){super.setTrackMuted(e);for(const n of this.simulcastCodecs.values())n.mediaStreamTrack.enabled=!e}getSenderStats(){return Q(this,void 0,void 0,function*(){var e;if(!(!((e=this.sender)===null||e===void 0)&&e.getStats))return[];const n=[],r=yield this.sender.getStats();return r.forEach(a=>{var s;if(a.type==="outbound-rtp"){const l={type:"video",streamId:a.id,frameHeight:a.frameHeight,frameWidth:a.frameWidth,framesPerSecond:a.framesPerSecond,framesSent:a.framesSent,firCount:a.firCount,pliCount:a.pliCount,nackCount:a.nackCount,packetsSent:a.packetsSent,bytesSent:a.bytesSent,qualityLimitationReason:a.qualityLimitationReason,qualityLimitationDurations:a.qualityLimitationDurations,qualityLimitationResolutionChanges:a.qualityLimitationResolutionChanges,rid:(s=a.rid)!==null&&s!==void 0?s:a.id,retransmittedPacketsSent:a.retransmittedPacketsSent,targetBitrate:a.targetBitrate,timestamp:a.timestamp},c=r.get(a.remoteId);c&&(l.jitter=c.jitter,l.packetsLost=c.packetsLost,l.roundTripTime=c.roundTripTime),n.push(l)}}),n.sort((a,s)=>{var l,c;return((l=s.frameWidth)!==null&&l!==void 0?l:0)-((c=a.frameWidth)!==null&&c!==void 0?c:0)}),n})}setPublishingQuality(e){const n=[];for(let r=Go.LOW;r<=Go.HIGH;r+=1)n.push(new $1({quality:r,enabled:r<=e}));this.log.debug("setting publishing quality. max quality ".concat(e),this.logContext),this.setPublishingLayers(n)}restartTrack(e){return Q(this,void 0,void 0,function*(){var n,r,a,s,l;let c;if(e){const b=CT({video:e});typeof b.video!="boolean"&&(c=b.video)}yield this.restart(c);try{for(var h=!0,p=pc(this.simulcastCodecs.values()),v;v=yield p.next(),n=v.done,!n;h=!0){s=v.value,h=!1;const b=s;b.sender&&((l=b.sender.transport)===null||l===void 0?void 0:l.state)!=="closed"&&(b.mediaStreamTrack=this.mediaStreamTrack.clone(),yield b.sender.replaceTrack(b.mediaStreamTrack))}}catch(b){r={error:b}}finally{try{!h&&!n&&(a=p.return)&&(yield a.call(p))}finally{if(r)throw r.error}}})}setProcessor(e){const n=Object.create(null,{setProcessor:{get:()=>super.setProcessor}});return Q(this,arguments,void 0,function(r){var a=this;let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){var l,c,h,p,v,b;if(yield n.setProcessor.call(a,r,s),!((v=a.processor)===null||v===void 0)&&v.processedTrack)try{for(var k=!0,T=pc(a.simulcastCodecs.values()),E;E=yield T.next(),l=E.done,!l;k=!0)p=E.value,k=!1,yield(b=p.sender)===null||b===void 0?void 0:b.replaceTrack(a.processor.processedTrack)}catch(R){c={error:R}}finally{try{!k&&!l&&(h=T.return)&&(yield h.call(T))}finally{if(c)throw c.error}}}()})}setDegradationPreference(e){return Q(this,void 0,void 0,function*(){if(this.degradationPreference=e,this.sender)try{this.log.debug("setting degradationPreference to ".concat(e),this.logContext);const n=this.sender.getParameters();n.degradationPreference=e,this.sender.setParameters(n)}catch(n){this.log.warn("failed to set degradationPreference",Object.assign({error:n},this.logContext))}})}addSimulcastTrack(e,n){if(this.simulcastCodecs.has(e)){this.log.error("".concat(e," already added, skipping adding simulcast codec"),this.logContext);return}const r={codec:e,mediaStreamTrack:this.mediaStreamTrack.clone(),sender:void 0,encodings:n};return this.simulcastCodecs.set(e,r),r}setSimulcastTrackSender(e,n){const r=this.simulcastCodecs.get(e);r&&(r.sender=n,setTimeout(()=>{this.subscribedCodecs&&this.setPublishingCodecs(this.subscribedCodecs)},rz))}setPublishingCodecs(e){return Q(this,void 0,void 0,function*(){var n,r,a,s,l,c,h;if(this.log.debug("setting publishing codecs",Object.assign(Object.assign({},this.logContext),{codecs:e,currentCodec:this.codec})),!this.codec&&e.length>0)return yield this.setPublishingLayers(e[0].qualities),[];this.subscribedCodecs=e;const p=[];try{for(n=!0,r=pc(e);a=yield r.next(),s=a.done,!s;n=!0){h=a.value,n=!1;const v=h;if(!this.codec||this.codec===v.codec)yield this.setPublishingLayers(v.qualities);else{const b=this.simulcastCodecs.get(v.codec);if(this.log.debug("try setPublishingCodec for ".concat(v.codec),Object.assign(Object.assign({},this.logContext),{simulcastCodecInfo:b})),!b||!b.sender){for(const k of v.qualities)if(k.enabled){p.push(v.codec);break}}else b.encodings&&(this.log.debug("try setPublishingLayersForSender ".concat(v.codec),this.logContext),yield IO(b.sender,b.encodings,v.qualities,this.senderLock,this.log,this.logContext))}}}catch(v){l={error:v}}finally{try{!n&&!s&&(c=r.return)&&(yield c.call(r))}finally{if(l)throw l.error}}return p})}setPublishingLayers(e){return Q(this,void 0,void 0,function*(){this.log.debug("setting publishing layers",Object.assign(Object.assign({},this.logContext),{qualities:e})),!(!this.sender||!this.encodings)&&(yield IO(this.sender,this.encodings,e,this.senderLock,this.log,this.logContext))})}handleAppVisibilityChanged(){const e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return Q(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),oO()&&this.isInBackground&&this.source===De.Source.Camera&&(this._mediaStreamTrack.enabled=!1)})}}function IO(t,e,n,r,a,s){return Q(this,void 0,void 0,function*(){const l=yield r.lock();a.debug("setPublishingLayersForSender",Object.assign(Object.assign({},s),{sender:t,qualities:n,senderEncodings:e}));try{const c=t.getParameters(),{encodings:h}=c;if(!h)return;if(h.length!==e.length){a.warn("cannot set publishing layers, encodings mismatch",Object.assign(Object.assign({},s),{encodings:h,senderEncodings:e}));return}let p=!1;const v=ws();if((v==null?void 0:v.name)==="Chrome"&&bc(v==null?void 0:v.version,"133")>0&&h[0].scalabilityMode){const k=h[0],T=new cb(k.scalabilityMode);let E=Nh.OFF;if(n.forEach(R=>{R.enabled&&(E===Nh.OFF||R.quality>E)&&(E=R.quality)}),E===Nh.OFF)k.active&&(k.active=!1,p=!0);else if(!k.active||T.spatial!==E+1){p=!0,k.active=!0;const R=new cb(e[0].scalabilityMode);T.spatial=E+1,T.suffix=R.suffix,T.spatial===1&&(T.suffix=void 0),k.scalabilityMode=T.toString(),k.scaleResolutionDownBy=Math.pow(2,2-E),e[0].maxBitrate&&(k.maxBitrate=e[0].maxBitrate/(k.scaleResolutionDownBy*k.scaleResolutionDownBy))}}else h.forEach((k,T)=>{var E;let R=(E=k.rid)!==null&&E!==void 0?E:"";R===""&&(R="q");const M=UO(R),A=n.find(U=>U.quality===M);A&&k.active!==A.enabled&&(p=!0,k.active=A.enabled,a.debug("setting layer ".concat(A.quality," to ").concat(k.active?"enabled":"disabled"),s),Bh()&&(A.enabled?(k.scaleResolutionDownBy=e[T].scaleResolutionDownBy,k.maxBitrate=e[T].maxBitrate,k.maxFrameRate=e[T].maxFrameRate):(k.scaleResolutionDownBy=4,k.maxBitrate=10,k.maxFrameRate=2)))});p&&(c.encodings=h,a.debug("setting encodings",Object.assign(Object.assign({},s),{encodings:c.encodings})),yield t.setParameters(c))}finally{l()}})}function UO(t){switch(t){case"f":return Go.HIGH;case"h":return Go.MEDIUM;case"q":return Go.LOW;default:return Go.HIGH}}function FO(t,e,n,r){if(!n)return[new Gd({quality:Go.HIGH,width:t,height:e,bitrate:0,ssrc:0})];if(r){const a=n[0].scalabilityMode,s=new cb(a),l=[],c=s.suffix=="h"?1.5:2,h=s.suffix=="h"?2:3;for(let p=0;p<s.spatial;p+=1)l.push(new Gd({quality:Math.min(Go.HIGH,s.spatial-1)-p,width:Math.ceil(t/Math.pow(c,p)),height:Math.ceil(e/Math.pow(c,p)),bitrate:n[0].maxBitrate?Math.ceil(n[0].maxBitrate/Math.pow(h,p)):0,ssrc:0}));return l}return n.map(a=>{var s,l,c;const h=(s=a.scaleResolutionDownBy)!==null&&s!==void 0?s:1;let p=UO((l=a.rid)!==null&&l!==void 0?l:"");return new Gd({quality:p,width:Math.ceil(t/h),height:Math.ceil(e/h),bitrate:(c=a.maxBitrate)!==null&&c!==void 0?c:0,ssrc:0})})}const jO="_lossy",VO="_reliable",iz=2*1e3,IT="leave-reconnect";var Es;(function(t){t[t.New=0]="New",t[t.Connected=1]="Connected",t[t.Disconnected=2]="Disconnected",t[t.Reconnecting=3]="Reconnecting",t[t.Closed=4]="Closed"})(Es||(Es={}));class az extends dl.EventEmitter{get isClosed(){return this._isClosed}get pendingReconnect(){return!!this.reconnectTimeout}constructor(e){var n;super(),this.options=e,this.rtcConfig={},this.peerConnectionTimeout=DT.peerConnectionTimeout,this.fullReconnectOnNext=!1,this.subscriberPrimary=!1,this.pcState=Es.New,this._isClosed=!0,this.pendingTrackResolvers={},this.reconnectAttempts=0,this.reconnectStart=0,this.attemptingReconnect=!1,this.joinAttempts=0,this.maxJoinAttempts=1,this.shouldFailNext=!1,this.log=Nn,this.handleDataChannel=r=>Q(this,[r],void 0,function(a){var s=this;let{channel:l}=a;return function*(){if(l){if(l.label===VO)s.reliableDCSub=l;else if(l.label===jO)s.lossyDCSub=l;else return;s.log.debug("on data channel ".concat(l.id,", ").concat(l.label),s.logContext),l.onmessage=s.handleDataMessage}}()}),this.handleDataMessage=r=>Q(this,void 0,void 0,function*(){var a,s;const l=yield this.dataProcessLock.lock();try{let c;if(r.data instanceof ArrayBuffer)c=r.data;else if(r.data instanceof Blob)c=yield r.data.arrayBuffer();else{this.log.error("unsupported data type",Object.assign(Object.assign({},this.logContext),{data:r.data}));return}const h=ro.fromBinary(new Uint8Array(c));((a=h.value)===null||a===void 0?void 0:a.case)==="speaker"?this.emit(tt.ActiveSpeakersUpdate,h.value.value.speakers):(((s=h.value)===null||s===void 0?void 0:s.case)==="user"&&sz(h,h.value.value),this.emit(tt.DataPacketReceived,h))}finally{l()}}),this.handleDataError=r=>{const s=r.currentTarget.maxRetransmits===0?"lossy":"reliable";if(r instanceof ErrorEvent&&r.error){const{error:l}=r.error;this.log.error("DataChannel error on ".concat(s,": ").concat(r.message),Object.assign(Object.assign({},this.logContext),{error:l}))}else this.log.error("Unknown DataChannel error on ".concat(s),Object.assign(Object.assign({},this.logContext),{event:r}))},this.handleBufferedAmountLow=r=>{const s=r.currentTarget.maxRetransmits===0?$n.LOSSY:$n.RELIABLE;this.updateAndEmitDCBufferStatus(s)},this.handleDisconnect=(r,a)=>{if(this._isClosed)return;this.log.warn("".concat(r," disconnected"),this.logContext),this.reconnectAttempts===0&&(this.reconnectStart=Date.now());const s=h=>{this.log.warn("could not recover connection after ".concat(this.reconnectAttempts," attempts, ").concat(h,"ms. giving up"),this.logContext),this.emit(tt.Disconnected),this.close()},l=Date.now()-this.reconnectStart;let c=this.getNextRetryDelay({elapsedMs:l,retryCount:this.reconnectAttempts});if(c===null){s(l);return}r===IT&&(c=0),this.log.debug("reconnecting in ".concat(c,"ms"),this.logContext),this.clearReconnectTimeout(),this.token&&this.regionUrlProvider&&this.regionUrlProvider.updateToken(this.token),this.reconnectTimeout=Qi.setTimeout(()=>this.attemptReconnect(a).finally(()=>this.reconnectTimeout=void 0),c)},this.waitForRestarted=()=>new Promise((r,a)=>{this.pcState===Es.Connected&&r();const s=()=>{this.off(tt.Disconnected,l),r()},l=()=>{this.off(tt.Restarted,s),a()};this.once(tt.Restarted,s),this.once(tt.Disconnected,l)}),this.updateAndEmitDCBufferStatus=r=>{const a=this.isBufferStatusLow(r);typeof a<"u"&&a!==this.dcBufferStatus.get(r)&&(this.dcBufferStatus.set(r,a),this.emit(tt.DCBufferStatusChanged,a,r))},this.isBufferStatusLow=r=>{const a=this.dataChannelForKind(r);if(a)return a.bufferedAmount<=a.bufferedAmountLowThreshold},this.handleBrowserOnLine=()=>{this.client.currentState===Or.RECONNECTING&&(this.clearReconnectTimeout(),this.attemptReconnect(Ih.RR_SIGNAL_DISCONNECTED))},this.log=lu((n=e.loggerName)!==null&&n!==void 0?n:xs.Engine),this.loggerOptions={loggerName:e.loggerName,loggerContextCb:()=>this.logContext},this.client=new TT(void 0,this.loggerOptions),this.client.signalLatency=this.options.expSignalLatency,this.reconnectPolicy=this.options.reconnectPolicy,this.registerOnLineListener(),this.closingLock=new to,this.dataProcessLock=new to,this.dcBufferStatus=new Map([[$n.LOSSY,!0],[$n.RELIABLE,!0]]),this.client.onParticipantUpdate=r=>this.emit(tt.ParticipantUpdate,r),this.client.onConnectionQuality=r=>this.emit(tt.ConnectionQualityUpdate,r),this.client.onRoomUpdate=r=>this.emit(tt.RoomUpdate,r),this.client.onSubscriptionError=r=>this.emit(tt.SubscriptionError,r),this.client.onSubscriptionPermissionUpdate=r=>this.emit(tt.SubscriptionPermissionUpdate,r),this.client.onSpeakersChanged=r=>this.emit(tt.SpeakersChanged,r),this.client.onStreamStateUpdate=r=>this.emit(tt.StreamStateChanged,r),this.client.onRequestResponse=r=>this.emit(tt.SignalRequestResponse,r)}get logContext(){var e,n,r,a,s,l,c,h;return{room:(n=(e=this.latestJoinResponse)===null||e===void 0?void 0:e.room)===null||n===void 0?void 0:n.name,roomID:(a=(r=this.latestJoinResponse)===null||r===void 0?void 0:r.room)===null||a===void 0?void 0:a.sid,participant:(l=(s=this.latestJoinResponse)===null||s===void 0?void 0:s.participant)===null||l===void 0?void 0:l.identity,pID:(h=(c=this.latestJoinResponse)===null||c===void 0?void 0:c.participant)===null||h===void 0?void 0:h.sid}}join(e,n,r,a){return Q(this,void 0,void 0,function*(){this.url=e,this.token=n,this.signalOpts=r,this.maxJoinAttempts=r.maxRetries;try{this.joinAttempts+=1,this.setupSignalClientCallbacks();const s=yield this.client.join(e,n,r,a);return this._isClosed=!1,this.latestJoinResponse=s,this.subscriberPrimary=s.subscriberPrimary,this.pcManager||(yield this.configure(s)),(!this.subscriberPrimary||s.fastPublish)&&this.negotiate(),this.clientConfiguration=s.clientConfiguration,setTimeout(()=>{this.emit(tt.SignalConnected)},10),s}catch(s){if(s instanceof br&&s.reason===Un.ServerUnreachable&&(this.log.warn("Couldn't connect to server, attempt ".concat(this.joinAttempts," of ").concat(this.maxJoinAttempts),this.logContext),this.joinAttempts<this.maxJoinAttempts))return this.join(e,n,r,a);throw s}})}close(){return Q(this,void 0,void 0,function*(){const e=yield this.closingLock.lock();if(this.isClosed){e();return}try{this._isClosed=!0,this.joinAttempts=0,this.emit(tt.Closing),this.removeAllListeners(),this.deregisterOnLineListener(),this.clearPendingReconnect(),yield this.cleanupPeerConnections(),yield this.cleanupClient()}finally{e()}})}cleanupPeerConnections(){return Q(this,void 0,void 0,function*(){var e;yield(e=this.pcManager)===null||e===void 0?void 0:e.close(),this.pcManager=void 0;const n=r=>{r&&(r.close(),r.onbufferedamountlow=null,r.onclose=null,r.onclosing=null,r.onerror=null,r.onmessage=null,r.onopen=null)};n(this.lossyDC),n(this.lossyDCSub),n(this.reliableDC),n(this.reliableDCSub),this.lossyDC=void 0,this.lossyDCSub=void 0,this.reliableDC=void 0,this.reliableDCSub=void 0})}cleanupClient(){return Q(this,void 0,void 0,function*(){yield this.client.close(),this.client.resetCallbacks()})}addTrack(e){if(this.pendingTrackResolvers[e.cid])throw new uu("a track with the same ID has already been published");return new Promise((n,r)=>{const a=setTimeout(()=>{delete this.pendingTrackResolvers[e.cid],r(new br("publication of local track timed out, no response from server",Un.InternalError))},1e4);this.pendingTrackResolvers[e.cid]={resolve:s=>{clearTimeout(a),n(s)},reject:()=>{clearTimeout(a),r(new Error("Cancelled publication by calling unpublish"))}},this.client.sendAddTrack(e)})}removeTrack(e){if(e.track&&this.pendingTrackResolvers[e.track.id]){const{reject:n}=this.pendingTrackResolvers[e.track.id];n&&n(),delete this.pendingTrackResolvers[e.track.id]}try{return this.pcManager.removeTrack(e),!0}catch(n){this.log.warn("failed to remove track",Object.assign(Object.assign({},this.logContext),{error:n}))}return!1}updateMuteStatus(e,n){this.client.sendMuteTrack(e,n)}get dataSubscriberReadyState(){var e;return(e=this.reliableDCSub)===null||e===void 0?void 0:e.readyState}getConnectedServerAddress(){return Q(this,void 0,void 0,function*(){var e;return(e=this.pcManager)===null||e===void 0?void 0:e.getConnectedAddress()})}setRegionUrlProvider(e){this.regionUrlProvider=e}configure(e){return Q(this,void 0,void 0,function*(){var n,r;if(this.pcManager&&this.pcManager.currentState!==Jr.NEW)return;this.participantSid=(n=e.participant)===null||n===void 0?void 0:n.sid;const a=this.makeRTCConfiguration(e);this.pcManager=new $V(a,e.subscriberPrimary,this.loggerOptions),this.emit(tt.TransportsCreated,this.pcManager.publisher,this.pcManager.subscriber),this.pcManager.onIceCandidate=(s,l)=>{this.client.sendIceCandidate(s,l)},this.pcManager.onPublisherOffer=s=>{this.client.sendOffer(s)},this.pcManager.onDataChannel=this.handleDataChannel,this.pcManager.onStateChange=(s,l,c)=>Q(this,void 0,void 0,function*(){if(this.log.debug("primary PC state changed ".concat(s),this.logContext),["closed","disconnected","failed"].includes(l)&&(this.publisherConnectionPromise=void 0),s===Jr.CONNECTED){const v=this.pcState===Es.New;this.pcState=Es.Connected,v&&this.emit(tt.Connected,e)}else s===Jr.FAILED&&this.pcState===Es.Connected&&(this.pcState=Es.Disconnected,this.handleDisconnect("peerconnection failed",c==="failed"?Ih.RR_SUBSCRIBER_FAILED:Ih.RR_PUBLISHER_FAILED));const h=this.client.isDisconnected||this.client.currentState===Or.RECONNECTING,p=[Jr.FAILED,Jr.CLOSING,Jr.CLOSED].includes(s);h&&p&&!this._isClosed&&this.emit(tt.Offline)}),this.pcManager.onTrack=s=>{this.emit(tt.MediaTrackAdded,s.track,s.streams[0],s.receiver)},oz((r=e.serverInfo)===null||r===void 0?void 0:r.protocol)||this.createDataChannels()})}setupSignalClientCallbacks(){this.client.onAnswer=e=>Q(this,void 0,void 0,function*(){this.pcManager&&(this.log.debug("received server answer",Object.assign(Object.assign({},this.logContext),{RTCSdpType:e.type})),yield this.pcManager.setPublisherAnswer(e))}),this.client.onTrickle=(e,n)=>{this.pcManager&&(this.log.debug("got ICE candidate from peer",Object.assign(Object.assign({},this.logContext),{candidate:e,target:n})),this.pcManager.addIceCandidate(e,n))},this.client.onOffer=e=>Q(this,void 0,void 0,function*(){if(!this.pcManager)return;const n=yield this.pcManager.createSubscriberAnswerFromOffer(e);this.client.sendAnswer(n)}),this.client.onLocalTrackPublished=e=>{var n;if(this.log.debug("received trackPublishedResponse",Object.assign(Object.assign({},this.logContext),{cid:e.cid,track:(n=e.track)===null||n===void 0?void 0:n.sid})),!this.pendingTrackResolvers[e.cid]){this.log.error("missing track resolver for ".concat(e.cid),Object.assign(Object.assign({},this.logContext),{cid:e.cid}));return}const{resolve:r}=this.pendingTrackResolvers[e.cid];delete this.pendingTrackResolvers[e.cid],r(e.track)},this.client.onLocalTrackUnpublished=e=>{this.emit(tt.LocalTrackUnpublished,e)},this.client.onLocalTrackSubscribed=e=>{this.emit(tt.LocalTrackSubscribed,e)},this.client.onTokenRefresh=e=>{this.token=e},this.client.onRemoteMuteChanged=(e,n)=>{this.emit(tt.RemoteMute,e,n)},this.client.onSubscribedQualityUpdate=e=>{this.emit(tt.SubscribedQualityUpdate,e)},this.client.onClose=()=>{this.handleDisconnect("signal",Ih.RR_SIGNAL_DISCONNECTED)},this.client.onLeave=e=>{switch(this.log.debug("client leave request",Object.assign(Object.assign({},this.logContext),{reason:e==null?void 0:e.reason})),e.regions&&this.regionUrlProvider&&(this.log.debug("updating regions",this.logContext),this.regionUrlProvider.setServerReportedRegions(e.regions)),e.action){case Fh.DISCONNECT:this.emit(tt.Disconnected,e==null?void 0:e.reason),this.close();break;case Fh.RECONNECT:this.fullReconnectOnNext=!0,this.handleDisconnect(IT);break;case Fh.RESUME:this.handleDisconnect(IT)}}}makeRTCConfiguration(e){var n;const r=Object.assign({},this.rtcConfig);if(!((n=this.signalOpts)===null||n===void 0)&&n.e2eeEnabled&&(this.log.debug("E2EE - setting up transports with insertable streams",this.logContext),r.encodedInsertableStreams=!0),e.iceServers&&!r.iceServers){const a=[];e.iceServers.forEach(s=>{const l={urls:s.urls};s.username&&(l.username=s.username),s.credential&&(l.credential=s.credential),a.push(l)}),r.iceServers=a}return e.clientConfiguration&&e.clientConfiguration.forceRelay===xg.ENABLED&&(r.iceTransportPolicy="relay"),r.sdpSemantics="unified-plan",r.continualGatheringPolicy="gather_continually",r}createDataChannels(){this.pcManager&&(this.lossyDC&&(this.lossyDC.onmessage=null,this.lossyDC.onerror=null),this.reliableDC&&(this.reliableDC.onmessage=null,this.reliableDC.onerror=null),this.lossyDC=this.pcManager.createPublisherDataChannel(jO,{ordered:!0,maxRetransmits:0}),this.reliableDC=this.pcManager.createPublisherDataChannel(VO,{ordered:!0}),this.lossyDC.onmessage=this.handleDataMessage,this.reliableDC.onmessage=this.handleDataMessage,this.lossyDC.onerror=this.handleDataError,this.reliableDC.onerror=this.handleDataError,this.lossyDC.bufferedAmountLowThreshold=65535,this.reliableDC.bufferedAmountLowThreshold=65535,this.lossyDC.onbufferedamountlow=this.handleBufferedAmountLow,this.reliableDC.onbufferedamountlow=this.handleBufferedAmountLow)}createSender(e,n,r){return Q(this,void 0,void 0,function*(){if(cT())return yield this.createTransceiverRTCRtpSender(e,n,r);if(dT())return this.log.warn("using add-track fallback",this.logContext),yield this.createRTCRtpSender(e.mediaStreamTrack);throw new xi("Required webRTC APIs not supported on this device")})}createSimulcastSender(e,n,r,a){return Q(this,void 0,void 0,function*(){if(cT())return this.createSimulcastTransceiverSender(e,n,r,a);if(dT())return this.log.debug("using add-track fallback",this.logContext),this.createRTCRtpSender(e.mediaStreamTrack);throw new xi("Cannot stream on this device")})}createTransceiverRTCRtpSender(e,n,r){return Q(this,void 0,void 0,function*(){if(!this.pcManager)throw new xi("publisher is closed");const a=[];e.mediaStream&&a.push(e.mediaStream),$h(e)&&(e.codec=n.videoCodec);const s={direction:"sendonly",streams:a};return r&&(s.sendEncodings=r),(yield this.pcManager.addPublisherTransceiver(e.mediaStreamTrack,s)).sender})}createSimulcastTransceiverSender(e,n,r,a){return Q(this,void 0,void 0,function*(){if(!this.pcManager)throw new xi("publisher is closed");const s={direction:"sendonly"};a&&(s.sendEncodings=a);const l=yield this.pcManager.addPublisherTransceiver(n.mediaStreamTrack,s);if(r.videoCodec)return e.setSimulcastTrackSender(r.videoCodec,l.sender),l.sender})}createRTCRtpSender(e){return Q(this,void 0,void 0,function*(){if(!this.pcManager)throw new xi("publisher is closed");return this.pcManager.addPublisherTrack(e)})}attemptReconnect(e){return Q(this,void 0,void 0,function*(){var n,r,a;if(!this._isClosed){if(this.attemptingReconnect){Nn.warn("already attempting reconnect, returning early",this.logContext);return}(((n=this.clientConfiguration)===null||n===void 0?void 0:n.resumeConnection)===xg.DISABLED||((a=(r=this.pcManager)===null||r===void 0?void 0:r.currentState)!==null&&a!==void 0?a:Jr.NEW)===Jr.NEW)&&(this.fullReconnectOnNext=!0);try{this.attemptingReconnect=!0,this.fullReconnectOnNext?yield this.restartConnection():yield this.resumeConnection(e),this.clearPendingReconnect(),this.fullReconnectOnNext=!1}catch(s){this.reconnectAttempts+=1;let l=!0;s instanceof xi?(this.log.debug("received unrecoverable error",Object.assign(Object.assign({},this.logContext),{error:s})),l=!1):s instanceof Wh||(this.fullReconnectOnNext=!0),l?this.handleDisconnect("reconnect",Ih.RR_UNKNOWN):(this.log.info("could not recover connection after ".concat(this.reconnectAttempts," attempts, ").concat(Date.now()-this.reconnectStart,"ms. giving up"),this.logContext),this.emit(tt.Disconnected),yield this.close())}finally{this.attemptingReconnect=!1}}})}getNextRetryDelay(e){try{return this.reconnectPolicy.nextRetryDelayInMs(e)}catch(n){this.log.warn("encountered error in reconnect policy",Object.assign(Object.assign({},this.logContext),{error:n}))}return null}restartConnection(e){return Q(this,void 0,void 0,function*(){var n,r,a;try{if(!this.url||!this.token)throw new xi("could not reconnect, url or token not saved");this.log.info("reconnecting, attempt: ".concat(this.reconnectAttempts),this.logContext),this.emit(tt.Restarting),this.client.isDisconnected||(yield this.client.sendLeave()),yield this.cleanupPeerConnections(),yield this.cleanupClient();let s;try{if(!this.signalOpts)throw this.log.warn("attempted connection restart, without signal options present",this.logContext),new Wh;s=yield this.join(e??this.url,this.token,this.signalOpts)}catch(l){throw l instanceof br&&l.reason===Un.NotAllowed?new xi("could not reconnect, token might be expired"):new Wh}if(this.shouldFailNext)throw this.shouldFailNext=!1,new Error("simulated failure");if(this.client.setReconnected(),this.emit(tt.SignalRestarted,s),yield this.waitForPCReconnected(),this.client.currentState!==Or.CONNECTED)throw new Wh("Signal connection got severed during reconnect");(n=this.regionUrlProvider)===null||n===void 0||n.resetAttempts(),this.emit(tt.Restarted)}catch(s){const l=yield(r=this.regionUrlProvider)===null||r===void 0?void 0:r.getNextBestRegionUrl();if(l){yield this.restartConnection(l);return}else throw(a=this.regionUrlProvider)===null||a===void 0||a.resetAttempts(),s}})}resumeConnection(e){return Q(this,void 0,void 0,function*(){var n;if(!this.url||!this.token)throw new xi("could not reconnect, url or token not saved");if(!this.pcManager)throw new xi("publisher and subscriber connections unset");this.log.info("resuming signal connection, attempt ".concat(this.reconnectAttempts),this.logContext),this.emit(tt.Resuming);let r;try{this.setupSignalClientCallbacks(),r=yield this.client.reconnect(this.url,this.token,this.participantSid,e)}catch(a){let s="";throw a instanceof Error&&(s=a.message,this.log.error(a.message,Object.assign(Object.assign({},this.logContext),{error:a}))),a instanceof br&&a.reason===Un.NotAllowed?new xi("could not reconnect, token might be expired"):a instanceof br&&a.reason===Un.LeaveRequest?a:new Wh(s)}if(this.emit(tt.SignalResumed),r){const a=this.makeRTCConfiguration(r);this.pcManager.updateConfiguration(a)}else this.log.warn("Did not receive reconnect response",this.logContext);if(this.shouldFailNext)throw this.shouldFailNext=!1,new Error("simulated failure");if(yield this.pcManager.triggerIceRestart(),yield this.waitForPCReconnected(),this.client.currentState!==Or.CONNECTED)throw new Wh("Signal connection got severed during reconnect");this.client.setReconnected(),((n=this.reliableDC)===null||n===void 0?void 0:n.readyState)==="open"&&this.reliableDC.id===null&&this.createDataChannels(),this.emit(tt.Resumed)})}waitForPCInitialConnection(e,n){return Q(this,void 0,void 0,function*(){if(!this.pcManager)throw new xi("PC manager is closed");yield this.pcManager.ensurePCTransportConnection(n,e)})}waitForPCReconnected(){return Q(this,void 0,void 0,function*(){this.pcState=Es.Reconnecting,this.log.debug("waiting for peer connection to reconnect",this.logContext);try{if(yield io(iz),!this.pcManager)throw new xi("PC manager is closed");yield this.pcManager.ensurePCTransportConnection(void 0,this.peerConnectionTimeout),this.pcState=Es.Connected}catch(e){throw this.pcState=Es.Disconnected,new br("could not establish PC connection, ".concat(e.message),Un.InternalError)}})}publishRpcResponse(e,n,r,a){return Q(this,void 0,void 0,function*(){const s=new ro({destinationIdentities:[e],kind:$n.RELIABLE,value:{case:"rpcResponse",value:new qD({requestId:n,value:a?{case:"error",value:a.toProto()}:{case:"payload",value:r??""}})}});yield this.sendDataPacket(s,$n.RELIABLE)})}publishRpcAck(e,n){return Q(this,void 0,void 0,function*(){const r=new ro({destinationIdentities:[e],kind:$n.RELIABLE,value:{case:"rpcAck",value:new $D({requestId:n})}});yield this.sendDataPacket(r,$n.RELIABLE)})}sendDataPacket(e,n){return Q(this,void 0,void 0,function*(){const r=e.toBinary();yield this.ensurePublisherConnected(n);const a=this.dataChannelForKind(n);a&&a.send(r),this.updateAndEmitDCBufferStatus(n)})}waitForBufferStatusLow(e){return new Promise((n,r)=>Q(this,void 0,void 0,function*(){if(this.isBufferStatusLow(e))n();else{const a=()=>r("Engine closed");for(this.once(tt.Closing,a);!this.dcBufferStatus.get(e);)yield io(10);this.off(tt.Closing,a),n()}}))}ensureDataTransportConnected(e){return Q(this,arguments,void 0,function(n){var r=this;let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.subscriberPrimary;return function*(){var s;if(!r.pcManager)throw new xi("PC manager is closed");const l=a?r.pcManager.subscriber:r.pcManager.publisher,c=a?"Subscriber":"Publisher";if(!l)throw new br("".concat(c," connection not set"),Un.InternalError);let h=!1;!a&&!r.dataChannelForKind(n,a)&&(r.createDataChannels(),h=!0),!h&&!a&&!r.pcManager.publisher.isICEConnected&&r.pcManager.publisher.getICEConnectionState()!=="checking"&&(h=!0),h&&r.negotiate();const p=r.dataChannelForKind(n,a);if((p==null?void 0:p.readyState)==="open")return;const v=new Date().getTime()+r.peerConnectionTimeout;for(;new Date().getTime()<v;){if(l.isICEConnected&&((s=r.dataChannelForKind(n,a))===null||s===void 0?void 0:s.readyState)==="open")return;yield io(50)}throw new br("could not establish ".concat(c," connection, state: ").concat(l.getICEConnectionState()),Un.InternalError)}()})}ensurePublisherConnected(e){return Q(this,void 0,void 0,function*(){this.publisherConnectionPromise||(this.publisherConnectionPromise=this.ensureDataTransportConnected(e,!1)),yield this.publisherConnectionPromise})}verifyTransport(){return!(!this.pcManager||this.pcManager.currentState!==Jr.CONNECTED||!this.client.ws||this.client.ws.readyState===WebSocket.CLOSED)}negotiate(){return Q(this,void 0,void 0,function*(){return new Promise((e,n)=>Q(this,void 0,void 0,function*(){if(!this.pcManager){n(new rT("PC manager is closed"));return}this.pcManager.requirePublisher(),this.pcManager.publisher.getTransceivers().length==0&&!this.lossyDC&&!this.reliableDC&&this.createDataChannels();const r=new AbortController,a=()=>{r.abort(),this.log.debug("engine disconnected while negotiation was ongoing",this.logContext),e()};this.isClosed&&n("cannot negotiate on closed engine"),this.on(tt.Closing,a),this.pcManager.publisher.once(qh.RTPVideoPayloadTypes,s=>{const l=new Map;s.forEach(c=>{const h=c.codec.toLowerCase();mV(h)&&l.set(c.payload,h)}),this.emit(tt.RTPVideoMapUpdate,l)});try{yield this.pcManager.negotiate(r),e()}catch(s){s instanceof rT&&(this.fullReconnectOnNext=!0),this.handleDisconnect("negotiation",Ih.RR_UNKNOWN),n(s)}finally{this.off(tt.Closing,a)}}))})}dataChannelForKind(e,n){if(n){if(e===$n.LOSSY)return this.lossyDCSub;if(e===$n.RELIABLE)return this.reliableDCSub}else{if(e===$n.LOSSY)return this.lossyDC;if(e===$n.RELIABLE)return this.reliableDC}}sendSyncState(e,n){var r,a;if(!this.pcManager){this.log.warn("sync state cannot be sent without peer connection setup",this.logContext);return}const s=this.pcManager.subscriber.getLocalDescription(),l=this.pcManager.subscriber.getRemoteDescription(),c=(a=(r=this.signalOpts)===null||r===void 0?void 0:r.autoSubscribe)!==null&&a!==void 0?a:!0,h=new Array,p=new Array;e.forEach(v=>{v.isDesired!==c&&h.push(v.trackSid),v.isEnabled||p.push(v.trackSid)}),this.client.sendSyncState(new uA({answer:s?sb({sdp:s.sdp,type:s.type}):void 0,offer:l?sb({sdp:l.sdp,type:l.type}):void 0,subscription:new q0({trackSids:h,subscribe:!c,participantTracks:[]}),publishTracks:xV(n),dataChannels:this.dataChannelsInfo(),trackSidsDisabled:p}))}failNext(){this.shouldFailNext=!0}dataChannelsInfo(){const e=[],n=(r,a)=>{(r==null?void 0:r.id)!==void 0&&r.id!==null&&e.push(new cA({label:r.label,id:r.id,target:a}))};return n(this.dataChannelForKind($n.LOSSY),Ts.PUBLISHER),n(this.dataChannelForKind($n.RELIABLE),Ts.PUBLISHER),n(this.dataChannelForKind($n.LOSSY,!0),Ts.SUBSCRIBER),n(this.dataChannelForKind($n.RELIABLE,!0),Ts.SUBSCRIBER),e}clearReconnectTimeout(){this.reconnectTimeout&&Qi.clearTimeout(this.reconnectTimeout)}clearPendingReconnect(){this.clearReconnectTimeout(),this.reconnectAttempts=0}registerOnLineListener(){ao()&&window.addEventListener("online",this.handleBrowserOnLine)}deregisterOnLineListener(){ao()&&window.removeEventListener("online",this.handleBrowserOnLine)}}class Wh extends Error{}function oz(t){return t!==void 0&&t>13}function sz(t,e){const n=t.participantIdentity?t.participantIdentity:e.participantIdentity;t.participantIdentity=n,e.participantIdentity=n;const r=t.destinationIdentities.length!==0?t.destinationIdentities:e.destinationIdentities;t.destinationIdentities=r,e.destinationIdentities=r}class UT{constructor(e,n){this.lastUpdateAt=0,this.settingsCacheTime=3e3,this.attemptedRegions=[],this.serverUrl=new URL(e),this.token=n}updateToken(e){this.token=e}isCloud(){return hT(this.serverUrl)}getServerUrl(){return this.serverUrl}getNextBestRegionUrl(e){return Q(this,void 0,void 0,function*(){if(!this.isCloud())throw Error("region availability is only supported for LiveKit Cloud domains");(!this.regionSettings||Date.now()-this.lastUpdateAt>this.settingsCacheTime)&&(this.regionSettings=yield this.fetchRegionSettings(e));const n=this.regionSettings.regions.filter(r=>!this.attemptedRegions.find(a=>a.url===r.url));if(n.length>0){const r=n[0];return this.attemptedRegions.push(r),Nn.debug("next region: ".concat(r.region)),r.url}else return null})}resetAttempts(){this.attemptedRegions=[]}fetchRegionSettings(e){return Q(this,void 0,void 0,function*(){const n=yield fetch("".concat(lz(this.serverUrl),"/regions"),{headers:{authorization:"Bearer ".concat(this.token)},signal:e});if(n.ok){const r=yield n.json();return this.lastUpdateAt=Date.now(),r}else throw new br("Could not fetch region settings: ".concat(n.statusText),n.status===401?Un.NotAllowed:Un.InternalError,n.status)})}setServerReportedRegions(e){this.regionSettings=e,this.lastUpdateAt=Date.now()}}function lz(t){return"".concat(t.protocol.replace("ws","http"),"//").concat(t.host,"/settings")}class zO{get info(){return this._info}constructor(e,n,r){this.reader=n,this.totalByteSize=r,this._info=e,this.bytesReceived=0}}class uz extends zO{handleChunkReceived(e){var n;this.bytesReceived+=e.content.byteLength;const r=this.totalByteSize?this.bytesReceived/this.totalByteSize:void 0;(n=this.onProgress)===null||n===void 0||n.call(this,r)}[Symbol.asyncIterator](){const e=this.reader.getReader();return{next:()=>Q(this,void 0,void 0,function*(){try{const{done:n,value:r}=yield e.read();return n?{done:!0,value:void 0}:(this.handleChunkReceived(r),{done:!1,value:r.content})}catch{return{done:!0,value:void 0}}}),return(){return Q(this,void 0,void 0,function*(){return e.releaseLock(),{done:!0,value:void 0}})}}}readAll(){return Q(this,void 0,void 0,function*(){var e,n,r,a;let s=new Set;try{for(var l=!0,c=pc(this),h;h=yield c.next(),e=h.done,!e;l=!0){a=h.value,l=!1;const p=a;s.add(p)}}catch(p){n={error:p}}finally{try{!l&&!e&&(r=c.return)&&(yield r.call(c))}finally{if(n)throw n.error}}return Array.from(s)})}}class cz extends zO{constructor(e,n,r){super(e,n,r),this.receivedChunks=new Map}handleChunkReceived(e){var n;const r=ab(e.chunkIndex),a=this.receivedChunks.get(r);if(a&&a.version>e.version)return;this.receivedChunks.set(r,e),this.bytesReceived+=e.content.byteLength;const s=this.totalByteSize?this.bytesReceived/this.totalByteSize:void 0;(n=this.onProgress)===null||n===void 0||n.call(this,s)}[Symbol.asyncIterator](){const e=this.reader.getReader(),n=new TextDecoder;return{next:()=>Q(this,void 0,void 0,function*(){try{const{done:r,value:a}=yield e.read();return r?{done:!0,value:void 0}:(this.handleChunkReceived(a),{done:!1,value:n.decode(a.content)})}catch{return{done:!0,value:void 0}}}),return(){return Q(this,void 0,void 0,function*(){return e.releaseLock(),{done:!0,value:void 0}})}}}readAll(){return Q(this,void 0,void 0,function*(){var e,n,r,a;let s="";try{for(var l=!0,c=pc(this),h;h=yield c.next(),e=h.done,!e;l=!0)a=h.value,l=!1,s+=a}catch(p){n={error:p}}finally{try{!l&&!e&&(r=c.return)&&(yield r.call(c))}finally{if(n)throw n.error}}return s})}}class BO{constructor(e,n,r){this.writableStream=e,this.defaultWriter=e.getWriter(),this.onClose=r,this.info=n}write(e){return this.defaultWriter.write(e)}close(){return Q(this,void 0,void 0,function*(){var e;yield this.defaultWriter.close(),this.defaultWriter.releaseLock(),(e=this.onClose)===null||e===void 0||e.call(this)})}}class dz extends BO{}class fz extends BO{}class HO extends De{constructor(e,n,r,a,s){super(e,r,s),this.sid=n,this.receiver=a}get isLocal(){return!1}setMuted(e){this.isMuted!==e&&(this.isMuted=e,this._mediaStreamTrack.enabled=!e,this.emit(e?Qe.Muted:Qe.Unmuted,this))}setMediaStream(e){this.mediaStream=e;const n=r=>{r.track===this._mediaStreamTrack&&(e.removeEventListener("removetrack",n),this.receiver&&"playoutDelayHint"in this.receiver&&(this.receiver.playoutDelayHint=void 0),this.receiver=void 0,this._currentBitrate=0,this.emit(Qe.Ended,this))};e.addEventListener("removetrack",n)}start(){this.startMonitor(),super.enable()}stop(){this.stopMonitor(),super.disable()}getRTCStatsReport(){return Q(this,void 0,void 0,function*(){var e;return!((e=this.receiver)===null||e===void 0)&&e.getStats?yield this.receiver.getStats():void 0})}setPlayoutDelay(e){this.receiver?"playoutDelayHint"in this.receiver?this.receiver.playoutDelayHint=e:this.log.warn("Playout delay not supported in this browser"):this.log.warn("Cannot set playout delay, track already ended")}getPlayoutDelay(){if(this.receiver){if("playoutDelayHint"in this.receiver)return this.receiver.playoutDelayHint;this.log.warn("Playout delay not supported in this browser")}else this.log.warn("Cannot get playout delay, track already ended");return 0}startMonitor(){this.monitorInterval||(this.monitorInterval=setInterval(()=>this.monitorReceiver(),OT)),wV()&&this.registerTimeSyncUpdate()}registerTimeSyncUpdate(){const e=()=>{var n;this.timeSyncHandle=requestAnimationFrame(()=>e());const r=(n=this.receiver)===null||n===void 0?void 0:n.getSynchronizationSources()[0];if(r){const{timestamp:a,rtpTimestamp:s}=r;s&&this.rtpTimestamp!==s&&(this.emit(Qe.TimeSyncUpdate,{timestamp:a,rtpTimestamp:s}),this.rtpTimestamp=s)}};e()}}class $O extends HO{constructor(e,n,r,a,s,l){super(e,n,De.Kind.Audio,r,l),this.monitorReceiver=()=>Q(this,void 0,void 0,function*(){if(!this.receiver){this._currentBitrate=0;return}const c=yield this.getReceiverStats();c&&this.prevStats&&this.receiver&&(this._currentBitrate=lb(c,this.prevStats)),this.prevStats=c}),this.audioContext=a,this.webAudioPluginNodes=[],s&&(this.sinkId=s.deviceId)}setVolume(e){var n;for(const r of this.attachedElements)this.audioContext?(n=this.gainNode)===null||n===void 0||n.gain.setTargetAtTime(e,0,.1):r.volume=e;fl()&&this._mediaStreamTrack._setVolume(e),this.elementVolume=e}getVolume(){if(this.elementVolume)return this.elementVolume;if(fl())return 1;let e=0;return this.attachedElements.forEach(n=>{n.volume>e&&(e=n.volume)}),e}setSinkId(e){return Q(this,void 0,void 0,function*(){this.sinkId=e,yield Promise.all(this.attachedElements.map(n=>{if(fT(n))return n.setSinkId(e)}))})}attach(e){const n=this.attachedElements.length===0;return e?super.attach(e):e=super.attach(),this.sinkId&&fT(e)&&e.setSinkId(this.sinkId),this.audioContext&&n&&(this.log.debug("using audio context mapping",this.logContext),this.connectWebAudio(this.audioContext,e),e.volume=0,e.muted=!0),this.elementVolume&&this.setVolume(this.elementVolume),e}detach(e){let n;return e?(n=super.detach(e),this.audioContext&&(this.attachedElements.length>0?this.connectWebAudio(this.audioContext,this.attachedElements[0]):this.disconnectWebAudio())):(n=super.detach(),this.disconnectWebAudio()),n}setAudioContext(e){this.audioContext=e,e&&this.attachedElements.length>0?this.connectWebAudio(e,this.attachedElements[0]):e||this.disconnectWebAudio()}setWebAudioPlugins(e){this.webAudioPluginNodes=e,this.attachedElements.length>0&&this.audioContext&&this.connectWebAudio(this.audioContext,this.attachedElements[0])}connectWebAudio(e,n){this.disconnectWebAudio(),this.sourceNode=e.createMediaStreamSource(n.srcObject);let r=this.sourceNode;this.webAudioPluginNodes.forEach(a=>{r.connect(a),r=a}),this.gainNode=e.createGain(),r.connect(this.gainNode),this.gainNode.connect(e.destination),this.elementVolume&&this.gainNode.gain.setTargetAtTime(this.elementVolume,0,.1),e.state!=="running"&&e.resume().then(()=>{e.state!=="running"&&this.emit(Qe.AudioPlaybackFailed,new Error("Audio Context couldn't be started automatically"))}).catch(a=>{this.emit(Qe.AudioPlaybackFailed,a)})}disconnectWebAudio(){var e,n;(e=this.gainNode)===null||e===void 0||e.disconnect(),(n=this.sourceNode)===null||n===void 0||n.disconnect(),this.gainNode=void 0,this.sourceNode=void 0}getReceiverStats(){return Q(this,void 0,void 0,function*(){if(!this.receiver||!this.receiver.getStats)return;const e=yield this.receiver.getStats();let n;return e.forEach(r=>{r.type==="inbound-rtp"&&(n={type:"audio",streamId:r.id,timestamp:r.timestamp,jitter:r.jitter,bytesReceived:r.bytesReceived,concealedSamples:r.concealedSamples,concealmentEvents:r.concealmentEvents,silentConcealedSamples:r.silentConcealedSamples,silentConcealmentEvents:r.silentConcealmentEvents,totalAudioEnergy:r.totalAudioEnergy,totalSamplesDuration:r.totalSamplesDuration})}),n})}}const FT=100;class hz extends HO{constructor(e,n,r,a,s){super(e,n,De.Kind.Video,r,s),this.elementInfos=[],this.monitorReceiver=()=>Q(this,void 0,void 0,function*(){if(!this.receiver){this._currentBitrate=0;return}const l=yield this.getReceiverStats();l&&this.prevStats&&this.receiver&&(this._currentBitrate=lb(l,this.prevStats)),this.prevStats=l}),this.debouncedHandleResize=RT(()=>{this.updateDimensions()},FT),this.adaptiveStreamSettings=a}get isAdaptiveStream(){return this.adaptiveStreamSettings!==void 0}get mediaStreamTrack(){return this._mediaStreamTrack}setMuted(e){super.setMuted(e),this.attachedElements.forEach(n=>{e?zh(this._mediaStreamTrack,n):Vh(this._mediaStreamTrack,n)})}attach(e){if(e?super.attach(e):e=super.attach(),this.adaptiveStreamSettings&&this.elementInfos.find(n=>n.element===e)===void 0){const n=new pz(e);this.observeElementInfo(n)}return e}observeElementInfo(e){this.adaptiveStreamSettings&&this.elementInfos.find(n=>n===e)===void 0?(e.handleResize=()=>{this.debouncedHandleResize()},e.handleVisibilityChanged=()=>{this.updateVisibility()},this.elementInfos.push(e),e.observe(),this.debouncedHandleResize(),this.updateVisibility()):this.log.warn("visibility resize observer not triggered",this.logContext)}stopObservingElementInfo(e){if(!this.isAdaptiveStream){this.log.warn("stopObservingElementInfo ignored",this.logContext);return}const n=this.elementInfos.filter(r=>r===e);for(const r of n)r.stopObserving();this.elementInfos=this.elementInfos.filter(r=>r!==e),this.updateVisibility(),this.debouncedHandleResize()}detach(e){let n=[];if(e)return this.stopObservingElement(e),super.detach(e);n=super.detach();for(const r of n)this.stopObservingElement(r);return n}getDecoderImplementation(){var e;return(e=this.prevStats)===null||e===void 0?void 0:e.decoderImplementation}getReceiverStats(){return Q(this,void 0,void 0,function*(){if(!this.receiver||!this.receiver.getStats)return;const e=yield this.receiver.getStats();let n,r="",a=new Map;return e.forEach(s=>{s.type==="inbound-rtp"?(r=s.codecId,n={type:"video",streamId:s.id,framesDecoded:s.framesDecoded,framesDropped:s.framesDropped,framesReceived:s.framesReceived,packetsReceived:s.packetsReceived,packetsLost:s.packetsLost,frameWidth:s.frameWidth,frameHeight:s.frameHeight,pliCount:s.pliCount,firCount:s.firCount,nackCount:s.nackCount,jitter:s.jitter,timestamp:s.timestamp,bytesReceived:s.bytesReceived,decoderImplementation:s.decoderImplementation}):s.type==="codec"&&a.set(s.id,s)}),n&&r!==""&&a.get(r)&&(n.mimeType=a.get(r).mimeType),n})}stopObservingElement(e){const n=this.elementInfos.filter(r=>r.element===e);for(const r of n)this.stopObservingElementInfo(r)}handleAppVisibilityChanged(){const e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return Q(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),this.isAdaptiveStream&&this.updateVisibility()})}updateVisibility(){var e,n;const r=this.elementInfos.reduce((c,h)=>Math.max(c,h.visibilityChangedAt||0),0),a=!((n=(e=this.adaptiveStreamSettings)===null||e===void 0?void 0:e.pauseVideoInBackground)!==null&&n!==void 0)||n?this.isInBackground:!1,s=this.elementInfos.some(c=>c.pictureInPicture),l=this.elementInfos.some(c=>c.visible)&&!a||s;if(this.lastVisible!==l){if(!l&&Date.now()-r<FT){Qi.setTimeout(()=>{this.updateVisibility()},FT);return}this.lastVisible=l,this.emit(Qe.VisibilityChanged,l,this)}}updateDimensions(){var e,n;let r=0,a=0;const s=this.getPixelDensity();for(const l of this.elementInfos){const c=l.width()*s,h=l.height()*s;c+h>r+a&&(r=c,a=h)}((e=this.lastDimensions)===null||e===void 0?void 0:e.width)===r&&((n=this.lastDimensions)===null||n===void 0?void 0:n.height)===a||(this.lastDimensions={width:r,height:a},this.emit(Qe.VideoDimensionsChanged,this.lastDimensions,this))}getPixelDensity(){var e;const n=(e=this.adaptiveStreamSettings)===null||e===void 0?void 0:e.pixelDensity;return n==="screen"?uO():n||(uO()>2?2:1)}}class pz{get visible(){return this.isPiP||this.isIntersecting}get pictureInPicture(){return this.isPiP}constructor(e,n){this.onVisibilityChanged=r=>{var a;const{target:s,isIntersecting:l}=r;s===this.element&&(this.isIntersecting=l,this.isPiP=Mg(this.element),this.visibilityChangedAt=Date.now(),(a=this.handleVisibilityChanged)===null||a===void 0||a.call(this))},this.onEnterPiP=()=>{var r,a,s;(a=(r=window.documentPictureInPicture)===null||r===void 0?void 0:r.window)===null||a===void 0||a.addEventListener("pagehide",this.onLeavePiP),this.isPiP=Mg(this.element),(s=this.handleVisibilityChanged)===null||s===void 0||s.call(this)},this.onLeavePiP=()=>{var r;this.isPiP=Mg(this.element),(r=this.handleVisibilityChanged)===null||r===void 0||r.call(this)},this.element=e,this.isIntersecting=n??jT(e),this.isPiP=ao()&&Mg(e),this.visibilityChangedAt=0}width(){return this.element.clientWidth}height(){return this.element.clientHeight}observe(){var e,n,r;this.isIntersecting=jT(this.element),this.isPiP=Mg(this.element),this.element.handleResize=()=>{var a;(a=this.handleResize)===null||a===void 0||a.call(this)},this.element.handleVisibilityChanged=this.onVisibilityChanged,dO().observe(this.element),cO().observe(this.element),this.element.addEventListener("enterpictureinpicture",this.onEnterPiP),this.element.addEventListener("leavepictureinpicture",this.onLeavePiP),(e=window.documentPictureInPicture)===null||e===void 0||e.addEventListener("enter",this.onEnterPiP),(r=(n=window.documentPictureInPicture)===null||n===void 0?void 0:n.window)===null||r===void 0||r.addEventListener("pagehide",this.onLeavePiP)}stopObserving(){var e,n,r,a,s;(e=dO())===null||e===void 0||e.unobserve(this.element),(n=cO())===null||n===void 0||n.unobserve(this.element),this.element.removeEventListener("enterpictureinpicture",this.onEnterPiP),this.element.removeEventListener("leavepictureinpicture",this.onLeavePiP),(r=window.documentPictureInPicture)===null||r===void 0||r.removeEventListener("enter",this.onEnterPiP),(s=(a=window.documentPictureInPicture)===null||a===void 0?void 0:a.window)===null||s===void 0||s.removeEventListener("pagehide",this.onLeavePiP)}}function Mg(t){var e,n;return document.pictureInPictureElement===t?!0:!((e=window.documentPictureInPicture)===null||e===void 0)&&e.window?jT(t,(n=window.documentPictureInPicture)===null||n===void 0?void 0:n.window):!1}function jT(t,e){const n=e||window;let r=t.offsetTop,a=t.offsetLeft;const s=t.offsetWidth,l=t.offsetHeight,{hidden:c}=t,{display:h}=getComputedStyle(t);for(;t.offsetParent;)t=t.offsetParent,r+=t.offsetTop,a+=t.offsetLeft;return r<n.pageYOffset+n.innerHeight&&a<n.pageXOffset+n.innerWidth&&r+l>n.pageYOffset&&a+s>n.pageXOffset&&!c&&h!=="none"}class du extends dl.EventEmitter{constructor(e,n,r,a){var s;super(),this.metadataMuted=!1,this.encryption=Po.NONE,this.log=Nn,this.handleMuted=()=>{this.emit(Qe.Muted)},this.handleUnmuted=()=>{this.emit(Qe.Unmuted)},this.log=lu((s=a==null?void 0:a.loggerName)!==null&&s!==void 0?s:xs.Publication),this.loggerContextCb=this.loggerContextCb,this.setMaxListeners(100),this.kind=e,this.trackSid=n,this.trackName=r,this.source=De.Source.Unknown}setTrack(e){this.track&&(this.track.off(Qe.Muted,this.handleMuted),this.track.off(Qe.Unmuted,this.handleUnmuted)),this.track=e,e&&(e.on(Qe.Muted,this.handleMuted),e.on(Qe.Unmuted,this.handleUnmuted))}get logContext(){var e;return Object.assign(Object.assign({},(e=this.loggerContextCb)===null||e===void 0?void 0:e.call(this)),ar(this))}get isMuted(){return this.metadataMuted}get isEnabled(){return!0}get isSubscribed(){return this.track!==void 0}get isEncrypted(){return this.encryption!==Po.NONE}get audioTrack(){if(cu(this.track))return this.track}get videoTrack(){if($h(this.track))return this.track}updateInfo(e){this.trackSid=e.sid,this.trackName=e.name,this.source=De.sourceFromProto(e.source),this.mimeType=e.mimeType,this.kind===De.Kind.Video&&e.width>0&&(this.dimensions={width:e.width,height:e.height},this.simulcasted=e.simulcast),this.encryption=e.encryption,this.trackInfo=e,this.log.debug("update publication info",Object.assign(Object.assign({},this.logContext),{info:e}))}}(function(t){(function(e){e.Desired="desired",e.Subscribed="subscribed",e.Unsubscribed="unsubscribed"})(t.SubscriptionStatus||(t.SubscriptionStatus={})),function(e){e.Allowed="allowed",e.NotAllowed="not_allowed"}(t.PermissionStatus||(t.PermissionStatus={}))})(du||(du={}));class VT extends du{get isUpstreamPaused(){var e;return(e=this.track)===null||e===void 0?void 0:e.isUpstreamPaused}constructor(e,n,r,a){super(e,n.sid,n.name,a),this.track=void 0,this.handleTrackEnded=()=>{this.emit(Qe.Ended)},this.updateInfo(n),this.setTrack(r)}setTrack(e){this.track&&this.track.off(Qe.Ended,this.handleTrackEnded),super.setTrack(e),e&&e.on(Qe.Ended,this.handleTrackEnded)}get isMuted(){return this.track?this.track.isMuted:super.isMuted}get audioTrack(){return super.audioTrack}get videoTrack(){return super.videoTrack}get isLocal(){return!0}mute(){return Q(this,void 0,void 0,function*(){var e;return(e=this.track)===null||e===void 0?void 0:e.mute()})}unmute(){return Q(this,void 0,void 0,function*(){var e;return(e=this.track)===null||e===void 0?void 0:e.unmute()})}pauseUpstream(){return Q(this,void 0,void 0,function*(){var e;yield(e=this.track)===null||e===void 0?void 0:e.pauseUpstream()})}resumeUpstream(){return Q(this,void 0,void 0,function*(){var e;yield(e=this.track)===null||e===void 0?void 0:e.resumeUpstream()})}getTrackFeatures(){var e;if(cu(this.track)){const n=this.track.getSourceTrackSettings(),r=new Set;return n.autoGainControl&&r.add(ul.TF_AUTO_GAIN_CONTROL),n.echoCancellation&&r.add(ul.TF_ECHO_CANCELLATION),n.noiseSuppression&&r.add(ul.TF_NOISE_SUPPRESSION),n.channelCount&&n.channelCount>1&&r.add(ul.TF_STEREO),!((e=this.options)===null||e===void 0)&&e.dtx||r.add(ul.TF_NO_DTX),this.track.enhancedNoiseCancellation&&r.add(ul.TF_ENHANCED_NOISE_CANCELLATION),Array.from(r.values())}else return[]}}function fb(t,e){return Q(this,void 0,void 0,function*(){t??(t={});let n=!1;const{audioProcessor:r,videoProcessor:a,optionsWithoutProcessor:s}=bO(t);let l=s.audio,c=s.video;if(r&&typeof s.audio=="object"&&(s.audio.processor=r),a&&typeof s.video=="object"&&(s.video.processor=a),t.audio&&typeof s.audio=="object"&&typeof s.audio.deviceId=="string"){const b=s.audio.deviceId;s.audio.deviceId={exact:b},n=!0,l=Object.assign(Object.assign({},s.audio),{deviceId:{ideal:b}})}if(s.video&&typeof s.video=="object"&&typeof s.video.deviceId=="string"){const b=s.video.deviceId;s.video.deviceId={exact:b},n=!0,c=Object.assign(Object.assign({},s.video),{deviceId:{ideal:b}})}(s.audio===!0||typeof s.audio=="object"&&!s.audio.deviceId)&&(s.audio={deviceId:"default"}),(s.video===!0||typeof s.video=="object"&&!s.video.deviceId)&&(s.video={deviceId:"default"});const h=mO(s,PO,DO),p=CT(h),v=navigator.mediaDevices.getUserMedia(p);s.audio&&(zi.userMediaPromiseMap.set("audioinput",v),v.catch(()=>zi.userMediaPromiseMap.delete("audioinput"))),s.video&&(zi.userMediaPromiseMap.set("videoinput",v),v.catch(()=>zi.userMediaPromiseMap.delete("videoinput")));try{const b=yield v;return yield Promise.all(b.getTracks().map(k=>Q(this,void 0,void 0,function*(){const T=k.kind==="audio";let E=T?h.audio:h.video;(typeof E=="boolean"||!E)&&(E={});let R;const M=T?p.audio:p.video;typeof M!="boolean"&&(R=M);const A=k.getSettings().deviceId;R!=null&&R.deviceId&&Sc(R.deviceId)!==A?R.deviceId=A:R||(R={deviceId:A});const U=WV(k,R,e);return U.kind===De.Kind.Video?U.source=De.Source.Camera:U.kind===De.Kind.Audio&&(U.source=De.Source.Microphone),U.mediaStream=b,cu(U)&&r?yield U.setProcessor(r):$h(U)&&a&&(yield U.setProcessor(a)),U})))}catch(b){if(!n)throw b;return fb(Object.assign(Object.assign({},t),{audio:l,video:c}),e)}})}function mz(t){return Q(this,void 0,void 0,function*(){return(yield fb({audio:!1,video:!0}))[0]})}function gz(t){return Q(this,void 0,void 0,function*(){return(yield fb({audio:!0,video:!1}))[0]})}var Tc;(function(t){t.Excellent="excellent",t.Good="good",t.Poor="poor",t.Lost="lost",t.Unknown="unknown"})(Tc||(Tc={}));function vz(t){switch(t){case Tg.EXCELLENT:return Tc.Excellent;case Tg.GOOD:return Tc.Good;case Tg.POOR:return Tc.Poor;case Tg.LOST:return Tc.Lost;default:return Tc.Unknown}}class qO extends dl.EventEmitter{get logContext(){var e,n;return Object.assign({},(n=(e=this.loggerOptions)===null||e===void 0?void 0:e.loggerContextCb)===null||n===void 0?void 0:n.call(e))}get isEncrypted(){return this.trackPublications.size>0&&Array.from(this.trackPublications.values()).every(e=>e.isEncrypted)}get isAgent(){var e;return((e=this.permissions)===null||e===void 0?void 0:e.agent)||this.kind===_g.AGENT}get kind(){return this._kind}get attributes(){return Object.freeze(Object.assign({},this._attributes))}constructor(e,n,r,a,s,l){let c=arguments.length>6&&arguments[6]!==void 0?arguments[6]:_g.STANDARD;var h;super(),this.audioLevel=0,this.isSpeaking=!1,this._connectionQuality=Tc.Unknown,this.log=Nn,this.log=lu((h=l==null?void 0:l.loggerName)!==null&&h!==void 0?h:xs.Participant),this.loggerOptions=l,this.setMaxListeners(100),this.sid=e,this.identity=n,this.name=r,this.metadata=a,this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.trackPublications=new Map,this._kind=c,this._attributes=s??{}}getTrackPublications(){return Array.from(this.trackPublications.values())}getTrackPublication(e){for(const[,n]of this.trackPublications)if(n.source===e)return n}getTrackPublicationByName(e){for(const[,n]of this.trackPublications)if(n.trackName===e)return n}get connectionQuality(){return this._connectionQuality}get isCameraEnabled(){var e;const n=this.getTrackPublication(De.Source.Camera);return!(!((e=n==null?void 0:n.isMuted)!==null&&e!==void 0)||e)}get isMicrophoneEnabled(){var e;const n=this.getTrackPublication(De.Source.Microphone);return!(!((e=n==null?void 0:n.isMuted)!==null&&e!==void 0)||e)}get isScreenShareEnabled(){return!!this.getTrackPublication(De.Source.ScreenShare)}get isLocal(){return!1}get joinedAt(){return this.participantInfo?new Date(Number.parseInt(this.participantInfo.joinedAt.toString())*1e3):new Date}updateInfo(e){return this.participantInfo&&this.participantInfo.sid===e.sid&&this.participantInfo.version>e.version?!1:(this.identity=e.identity,this.sid=e.sid,this._setName(e.name),this._setMetadata(e.metadata),this._setAttributes(e.attributes),e.permission&&this.setPermissions(e.permission),this.participantInfo=e,this.log.trace("update participant info",Object.assign(Object.assign({},this.logContext),{info:e})),!0)}_setMetadata(e){const n=this.metadata!==e,r=this.metadata;this.metadata=e,n&&this.emit(Ie.ParticipantMetadataChanged,r)}_setName(e){const n=this.name!==e;this.name=e,n&&this.emit(Ie.ParticipantNameChanged,e)}_setAttributes(e){const n=_V(this.attributes,e);this._attributes=e,Object.keys(n).length>0&&this.emit(Ie.AttributesChanged,n)}setPermissions(e){var n,r,a,s,l,c;const h=this.permissions,p=e.canPublish!==((n=this.permissions)===null||n===void 0?void 0:n.canPublish)||e.canSubscribe!==((r=this.permissions)===null||r===void 0?void 0:r.canSubscribe)||e.canPublishData!==((a=this.permissions)===null||a===void 0?void 0:a.canPublishData)||e.hidden!==((s=this.permissions)===null||s===void 0?void 0:s.hidden)||e.recorder!==((l=this.permissions)===null||l===void 0?void 0:l.recorder)||e.canPublishSources.length!==this.permissions.canPublishSources.length||e.canPublishSources.some((v,b)=>{var k;return v!==((k=this.permissions)===null||k===void 0?void 0:k.canPublishSources[b])})||e.canSubscribeMetrics!==((c=this.permissions)===null||c===void 0?void 0:c.canSubscribeMetrics);return this.permissions=e,p&&this.emit(Ie.ParticipantPermissionsChanged,h),p}setIsSpeaking(e){e!==this.isSpeaking&&(this.isSpeaking=e,e&&(this.lastSpokeAt=new Date),this.emit(Ie.IsSpeakingChanged,e))}setConnectionQuality(e){const n=this._connectionQuality;this._connectionQuality=vz(e),n!==this._connectionQuality&&this.emit(Ie.ConnectionQualityChanged,this._connectionQuality)}setAudioContext(e){this.audioContext=e,this.audioTrackPublications.forEach(n=>cu(n.track)&&n.track.setAudioContext(e))}addTrackPublication(e){e.on(Qe.Muted,()=>{this.emit(Ie.TrackMuted,e)}),e.on(Qe.Unmuted,()=>{this.emit(Ie.TrackUnmuted,e)});const n=e;switch(n.track&&(n.track.sid=e.trackSid),this.trackPublications.set(e.trackSid,e),e.kind){case De.Kind.Audio:this.audioTrackPublications.set(e.trackSid,e);break;case De.Kind.Video:this.videoTrackPublications.set(e.trackSid,e);break}}}function yz(t){var e,n,r;if(!t.participantSid&&!t.participantIdentity)throw new Error("Invalid track permission, must provide at least one of participantIdentity and participantSid");return new sA({participantIdentity:(e=t.participantIdentity)!==null&&e!==void 0?e:"",participantSid:(n=t.participantSid)!==null&&n!==void 0?n:"",allTracks:(r=t.allowAll)!==null&&r!==void 0?r:!1,trackSids:t.allowedTrackSids||[]})}const WO=15e3;class hb extends qO{constructor(e,n,r,a,s){super(e,n,void 0,void 0,void 0,{loggerName:a.loggerName,loggerContextCb:()=>this.engine.logContext}),this.pendingPublishing=new Set,this.pendingPublishPromises=new Map,this.participantTrackPermissions=[],this.allParticipantsAllowedToSubscribe=!0,this.encryptionType=Po.NONE,this.enabledPublishVideoCodecs=[],this.pendingAcks=new Map,this.pendingResponses=new Map,this.handleReconnecting=()=>{this.reconnectFuture||(this.reconnectFuture=new hO)},this.handleReconnected=()=>{var l,c;(c=(l=this.reconnectFuture)===null||l===void 0?void 0:l.resolve)===null||c===void 0||c.call(l),this.reconnectFuture=void 0,this.updateTrackSubscriptionPermissions()},this.handleDisconnected=()=>{var l,c;this.reconnectFuture&&(this.reconnectFuture.promise.catch(h=>this.log.warn(h.message,this.logContext)),(c=(l=this.reconnectFuture)===null||l===void 0?void 0:l.reject)===null||c===void 0||c.call(l,"Got disconnected during reconnection attempt"),this.reconnectFuture=void 0)},this.handleSignalRequestResponse=l=>{const{requestId:c,reason:h,message:p}=l,v=this.pendingSignalRequests.get(c);v&&(h!==q1.OK&&v.reject(new nO(p,h)),this.pendingSignalRequests.delete(c))},this.handleDataPacket=l=>{switch(l.value.case){case"rpcResponse":let c=l.value.value,h=null,p=null;c.value.case==="payload"?h=c.value.value:c.value.case==="error"&&(p=ei.fromProto(c.value.value)),this.handleIncomingRpcResponse(c.requestId,h,p);break;case"rpcAck":let v=l.value.value;this.handleIncomingRpcAck(v.requestId);break}},this.updateTrackSubscriptionPermissions=()=>{this.log.debug("updating track subscription permissions",Object.assign(Object.assign({},this.logContext),{allParticipantsAllowed:this.allParticipantsAllowedToSubscribe,participantTrackPermissions:this.participantTrackPermissions})),this.engine.client.sendUpdateSubscriptionPermissions(this.allParticipantsAllowedToSubscribe,this.participantTrackPermissions.map(l=>yz(l)))},this.onTrackUnmuted=l=>{this.onTrackMuted(l,l.isUpstreamPaused)},this.onTrackMuted=(l,c)=>{if(c===void 0&&(c=!0),!l.sid){this.log.error("could not update mute status for unpublished track",Object.assign(Object.assign({},this.logContext),ar(l)));return}this.engine.updateMuteStatus(l.sid,c)},this.onTrackUpstreamPaused=l=>{this.log.debug("upstream paused",Object.assign(Object.assign({},this.logContext),ar(l))),this.onTrackMuted(l,!0)},this.onTrackUpstreamResumed=l=>{this.log.debug("upstream resumed",Object.assign(Object.assign({},this.logContext),ar(l))),this.onTrackMuted(l,l.isMuted)},this.onTrackFeatureUpdate=l=>{const c=this.audioTrackPublications.get(l.sid);if(!c){this.log.warn("Could not update local audio track settings, missing publication for track ".concat(l.sid),this.logContext);return}this.engine.client.sendUpdateLocalAudioTrack(c.trackSid,c.getTrackFeatures())},this.handleSubscribedQualityUpdate=l=>Q(this,void 0,void 0,function*(){var c,h,p,v,b,k;if(!(!((b=this.roomOptions)===null||b===void 0)&&b.dynacast))return;const T=this.videoTrackPublications.get(l.trackSid);if(!T){this.log.warn("received subscribed quality update for unknown track",Object.assign(Object.assign({},this.logContext),{trackSid:l.trackSid}));return}if(l.subscribedCodecs.length>0){if(!T.videoTrack)return;const A=yield T.videoTrack.setPublishingCodecs(l.subscribedCodecs);try{for(var E=!0,R=pc(A),M;M=yield R.next(),c=M.done,!c;E=!0){v=M.value,E=!1;const U=v;iV(U)&&(this.log.debug("publish ".concat(U," for ").concat(T.videoTrack.sid),Object.assign(Object.assign({},this.logContext),ar(T))),yield this.publishAdditionalCodecForTrack(T.videoTrack,U,T.options))}}catch(U){h={error:U}}finally{try{!E&&!c&&(p=R.return)&&(yield p.call(R))}finally{if(h)throw h.error}}}else l.subscribedQualities.length>0&&(yield(k=T.videoTrack)===null||k===void 0?void 0:k.setPublishingLayers(l.subscribedQualities))}),this.handleLocalTrackUnpublished=l=>{const c=this.trackPublications.get(l.trackSid);if(!c){this.log.warn("received unpublished event for unknown track",Object.assign(Object.assign({},this.logContext),{trackSid:l.trackSid}));return}this.unpublishTrack(c.track)},this.handleTrackEnded=l=>Q(this,void 0,void 0,function*(){if(l.source===De.Source.ScreenShare||l.source===De.Source.ScreenShareAudio)this.log.debug("unpublishing local track due to TrackEnded",Object.assign(Object.assign({},this.logContext),ar(l))),this.unpublishTrack(l);else if(l.isUserProvided)yield l.mute();else if(Qd(l)||Cc(l))try{if(ao())try{const c=yield navigator==null?void 0:navigator.permissions.query({name:l.source===De.Source.Camera?"camera":"microphone"});if(c&&c.state==="denied")throw this.log.warn("user has revoked access to ".concat(l.source),Object.assign(Object.assign({},this.logContext),ar(l))),c.onchange=()=>{c.state!=="denied"&&(l.isMuted||l.restartTrack(),c.onchange=null)},new Error("GetUserMedia Permission denied")}catch{}l.isMuted||(this.log.debug("track ended, attempting to use a different device",Object.assign(Object.assign({},this.logContext),ar(l))),Qd(l)?yield l.restartTrack({deviceId:"default"}):yield l.restartTrack())}catch{this.log.warn("could not restart track, muting instead",Object.assign(Object.assign({},this.logContext),ar(l))),yield l.mute()}}),this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.trackPublications=new Map,this.engine=r,this.roomOptions=a,this.setupEngine(r),this.activeDeviceMap=new Map([["audioinput","default"],["videoinput","default"],["audiooutput","default"]]),this.pendingSignalRequests=new Map,this.rpcHandlers=s}get lastCameraError(){return this.cameraError}get lastMicrophoneError(){return this.microphoneError}get isE2EEEnabled(){return this.encryptionType!==Po.NONE}getTrackPublication(e){const n=super.getTrackPublication(e);if(n)return n}getTrackPublicationByName(e){const n=super.getTrackPublicationByName(e);if(n)return n}setupEngine(e){this.engine=e,this.engine.on(tt.RemoteMute,(n,r)=>{const a=this.trackPublications.get(n);!a||!a.track||(r?a.mute():a.unmute())}),this.engine.on(tt.Connected,this.handleReconnected).on(tt.SignalRestarted,this.handleReconnected).on(tt.SignalResumed,this.handleReconnected).on(tt.Restarting,this.handleReconnecting).on(tt.Resuming,this.handleReconnecting).on(tt.LocalTrackUnpublished,this.handleLocalTrackUnpublished).on(tt.SubscribedQualityUpdate,this.handleSubscribedQualityUpdate).on(tt.Disconnected,this.handleDisconnected).on(tt.SignalRequestResponse,this.handleSignalRequestResponse).on(tt.DataPacketReceived,this.handleDataPacket)}setMetadata(e){return Q(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({metadata:e})})}setName(e){return Q(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({name:e})})}setAttributes(e){return Q(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({attributes:e})})}requestMetadataUpdate(e){return Q(this,arguments,void 0,function(n){var r=this;let{metadata:a,name:s,attributes:l}=n;return function*(){return new Promise((c,h)=>Q(r,void 0,void 0,function*(){var p,v;try{let b=!1;const k=yield this.engine.client.sendUpdateLocalMetadata((p=a??this.metadata)!==null&&p!==void 0?p:"",(v=s??this.name)!==null&&v!==void 0?v:"",l),T=performance.now();for(this.pendingSignalRequests.set(k,{resolve:c,reject:E=>{h(E),b=!0},values:{name:s,metadata:a,attributes:l}});performance.now()-T<5e3&&!b;){if((!s||this.name===s)&&(!a||this.metadata===a)&&(!l||Object.entries(l).every(E=>{let[R,M]=E;return this.attributes[R]===M||M===""&&!this.attributes[R]}))){this.pendingSignalRequests.delete(k),c();return}yield io(50)}h(new nO("Request to update local metadata timed out","TimeoutError"))}catch(b){b instanceof Error&&h(b)}}))}()})}setCameraEnabled(e,n,r){return this.setTrackEnabled(De.Source.Camera,e,n,r)}setMicrophoneEnabled(e,n,r){return this.setTrackEnabled(De.Source.Microphone,e,n,r)}setScreenShareEnabled(e,n,r){return this.setTrackEnabled(De.Source.ScreenShare,e,n,r)}setPermissions(e){const n=this.permissions,r=super.setPermissions(e);return r&&n&&this.emit(Ie.ParticipantPermissionsChanged,n),r}setE2EEEnabled(e){return Q(this,void 0,void 0,function*(){this.encryptionType=e?Po.GCM:Po.NONE,yield this.republishAllTracks(void 0,!1)})}setTrackEnabled(e,n,r,a){return Q(this,void 0,void 0,function*(){var s,l;this.log.debug("setTrackEnabled",Object.assign(Object.assign({},this.logContext),{source:e,enabled:n})),this.republishPromise&&(yield this.republishPromise);let c=this.getTrackPublication(e);if(n)if(c)yield c.unmute();else{let h;if(this.pendingPublishing.has(e)){const p=yield this.waitForPendingPublicationOfSource(e);return p||this.log.info("waiting for pending publication promise timed out",Object.assign(Object.assign({},this.logContext),{source:e})),yield p==null?void 0:p.unmute(),p}this.pendingPublishing.add(e);try{switch(e){case De.Source.Camera:h=yield this.createTracks({video:(s=r)!==null&&s!==void 0?s:!0});break;case De.Source.Microphone:h=yield this.createTracks({audio:(l=r)!==null&&l!==void 0?l:!0});break;case De.Source.ScreenShare:h=yield this.createScreenTracks(Object.assign({},r));break;default:throw new uu(e)}}catch(p){throw h==null||h.forEach(v=>{v.stop()}),p instanceof Error&&this.emit(Ie.MediaDevicesError,p),this.pendingPublishing.delete(e),p}try{const p=[];for(const b of h)this.log.info("publishing track",Object.assign(Object.assign({},this.logContext),ar(b))),p.push(this.publishTrack(b,a));[c]=yield Promise.all(p)}catch(p){throw h==null||h.forEach(v=>{v.stop()}),p}finally{this.pendingPublishing.delete(e)}}else if(!(c!=null&&c.track)&&this.pendingPublishing.has(e)&&(c=yield this.waitForPendingPublicationOfSource(e),c||this.log.info("waiting for pending publication promise timed out",Object.assign(Object.assign({},this.logContext),{source:e}))),c&&c.track)if(e===De.Source.ScreenShare){c=yield this.unpublishTrack(c.track);const h=this.getTrackPublication(De.Source.ScreenShareAudio);h&&h.track&&this.unpublishTrack(h.track)}else yield c.mute();return c})}enableCameraAndMicrophone(){return Q(this,void 0,void 0,function*(){if(!(this.pendingPublishing.has(De.Source.Camera)||this.pendingPublishing.has(De.Source.Microphone))){this.pendingPublishing.add(De.Source.Camera),this.pendingPublishing.add(De.Source.Microphone);try{const e=yield this.createTracks({audio:!0,video:!0});yield Promise.all(e.map(n=>this.publishTrack(n)))}finally{this.pendingPublishing.delete(De.Source.Camera),this.pendingPublishing.delete(De.Source.Microphone)}}})}createTracks(e){return Q(this,void 0,void 0,function*(){var n,r;e??(e={});const a=mO(e,(n=this.roomOptions)===null||n===void 0?void 0:n.audioCaptureDefaults,(r=this.roomOptions)===null||r===void 0?void 0:r.videoCaptureDefaults);try{return(yield fb(a,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext})).map(c=>(cu(c)&&(this.microphoneError=void 0,c.setAudioContext(this.audioContext),c.source=De.Source.Microphone,this.emit(Ie.AudioStreamAcquired)),$h(c)&&(this.cameraError=void 0,c.source=De.Source.Camera),c))}catch(s){throw s instanceof Error&&(e.audio&&(this.microphoneError=s),e.video&&(this.cameraError=s)),s}})}createScreenTracks(e){return Q(this,void 0,void 0,function*(){if(e===void 0&&(e={}),navigator.mediaDevices.getDisplayMedia===void 0)throw new nT("getDisplayMedia not supported");e.resolution===void 0&&!cV()&&(e.resolution=uT.h1080fps30.resolution);const n=TV(e),r=yield navigator.mediaDevices.getDisplayMedia(n),a=r.getVideoTracks();if(a.length===0)throw new uu("no video track found");const s=new db(a[0],void 0,!1,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});s.source=De.Source.ScreenShare,e.contentHint&&(s.mediaStreamTrack.contentHint=e.contentHint);const l=[s];if(r.getAudioTracks().length>0){this.emit(Ie.AudioStreamAcquired);const c=new ub(r.getAudioTracks()[0],void 0,!1,this.audioContext,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});c.source=De.Source.ScreenShareAudio,l.push(c)}return l})}publishTrack(e,n){return Q(this,void 0,void 0,function*(){return this.publishOrRepublishTrack(e,n)})}publishOrRepublishTrack(e,n){return Q(this,arguments,void 0,function(r,a){var s=this;let l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return function*(){var c,h,p,v;Qd(r)&&r.setAudioContext(s.audioContext),yield(c=s.reconnectFuture)===null||c===void 0?void 0:c.promise,s.republishPromise&&!l&&(yield s.republishPromise),Hh(r)&&s.pendingPublishPromises.has(r)&&(yield s.pendingPublishPromises.get(r));let b;if(r instanceof MediaStreamTrack)b=r.getConstraints();else{b=r.constraints;let A;switch(r.source){case De.Source.Microphone:A="audioinput";break;case De.Source.Camera:A="videoinput"}A&&s.activeDeviceMap.has(A)&&(b=Object.assign(Object.assign({},b),{deviceId:s.activeDeviceMap.get(A)}))}if(r instanceof MediaStreamTrack)switch(r.kind){case"audio":r=new ub(r,b,!0,s.audioContext,{loggerName:s.roomOptions.loggerName,loggerContextCb:()=>s.logContext});break;case"video":r=new db(r,b,!0,{loggerName:s.roomOptions.loggerName,loggerContextCb:()=>s.logContext});break;default:throw new uu("unsupported MediaStreamTrack kind ".concat(r.kind))}else r.updateLoggerOptions({loggerName:s.roomOptions.loggerName,loggerContextCb:()=>s.logContext});let k;if(s.trackPublications.forEach(A=>{A.track&&A.track===r&&(k=A)}),k)return s.log.warn("track has already been published, skipping",Object.assign(Object.assign({},s.logContext),ar(k))),k;const T="channelCount"in r.mediaStreamTrack.getSettings()&&r.mediaStreamTrack.getSettings().channelCount===2||r.mediaStreamTrack.getConstraints().channelCount===2,E=(h=a==null?void 0:a.forceStereo)!==null&&h!==void 0?h:T;E&&(a||(a={}),a.dtx===void 0&&s.log.info("Opus DTX will be disabled for stereo tracks by default. Enable them explicitly to make it work.",Object.assign(Object.assign({},s.logContext),ar(r))),a.red===void 0&&s.log.info("Opus RED will be disabled for stereo tracks by default. Enable them explicitly to make it work."),(p=a.dtx)!==null&&p!==void 0||(a.dtx=!1),(v=a.red)!==null&&v!==void 0||(a.red=!1));const R=Object.assign(Object.assign({},s.roomOptions.publishDefaults),a);!dV()&&s.roomOptions.e2ee&&(s.log.info("End-to-end encryption is set up, simulcast publishing will be disabled on Safari versions and iOS browsers running iOS < v17.2",Object.assign({},s.logContext)),R.simulcast=!1),R.source&&(r.source=R.source);const M=new Promise((A,U)=>Q(s,void 0,void 0,function*(){try{if(this.engine.client.currentState!==Or.CONNECTED){this.log.debug("deferring track publication until signal is connected",Object.assign(Object.assign({},this.logContext),{track:ar(r)}));const V=()=>Q(this,void 0,void 0,function*(){try{const j=yield this.publish(r,R,E);A(j)}catch(j){U(j)}});setTimeout(()=>{this.engine.off(tt.SignalConnected,V),U(new iT("publishing rejected as engine not connected within timeout",408))},15e3),this.engine.once(tt.SignalConnected,V),this.engine.on(tt.Closing,()=>{this.engine.off(tt.SignalConnected,V),U(new iT("publishing rejected as engine closed",499))})}else try{const V=yield this.publish(r,R,E);A(V)}catch(V){U(V)}}catch(V){U(V)}}));s.pendingPublishPromises.set(r,M);try{return yield M}catch(A){throw A}finally{s.pendingPublishPromises.delete(r)}}()})}hasPermissionsToPublish(e){if(!this.permissions)return this.log.warn("no permissions present for publishing track",Object.assign(Object.assign({},this.logContext),ar(e))),!1;const{canPublish:n,canPublishSources:r}=this.permissions;return n&&(r.length===0||r.map(a=>EV(a)).includes(e.source))?!0:(this.log.warn("insufficient permissions to publish",Object.assign(Object.assign({},this.logContext),ar(e))),!1)}publish(e,n,r){return Q(this,void 0,void 0,function*(){var a,s,l,c,h,p,v,b,k,T;if(!this.hasPermissionsToPublish(e))throw new iT("failed to publish track, insufficient permissions",403);Array.from(this.trackPublications.values()).find(I=>Hh(e)&&I.source===e.source)&&e.source!==De.Source.Unknown&&this.log.info("publishing a second track with the same source: ".concat(e.source),Object.assign(Object.assign({},this.logContext),ar(e))),n.stopMicTrackOnMute&&cu(e)&&(e.stopOnMute=!0),e.source===De.Source.ScreenShare&&Bh()&&(n.simulcast=!1),n.videoCodec==="av1"&&!sV()&&(n.videoCodec=void 0),n.videoCodec==="vp9"&&!lV()&&(n.videoCodec=void 0),n.videoCodec===void 0&&(n.videoCodec=PT),this.enabledPublishVideoCodecs.length>0&&(this.enabledPublishVideoCodecs.some(I=>n.videoCodec===ob(I.mime))||(n.videoCodec=ob(this.enabledPublishVideoCodecs[0].mime)));const R=n.videoCodec;e.on(Qe.Muted,this.onTrackMuted),e.on(Qe.Unmuted,this.onTrackUnmuted),e.on(Qe.Ended,this.handleTrackEnded),e.on(Qe.UpstreamPaused,this.onTrackUpstreamPaused),e.on(Qe.UpstreamResumed,this.onTrackUpstreamResumed),e.on(Qe.AudioTrackFeatureUpdate,this.onTrackFeatureUpdate);const M=new V1({cid:e.mediaStreamTrack.id,name:n.name,type:De.kindToProto(e.kind),muted:e.isMuted,source:De.sourceToProto(e.source),disableDtx:!(!((a=n.dtx)!==null&&a!==void 0)||a),encryption:this.encryptionType,stereo:r,disableRed:this.isE2EEEnabled||!(!((s=n.red)!==null&&s!==void 0)||s),stream:n==null?void 0:n.stream,backupCodecPolicy:n==null?void 0:n.backupCodecPolicy});let A;if(e.kind===De.Kind.Video){let I={width:0,height:0};try{I=yield e.waitForDimensions()}catch{const ne=(c=(l=this.roomOptions.videoCaptureDefaults)===null||l===void 0?void 0:l.resolution)!==null&&c!==void 0?c:Pg.h720.resolution;I={width:ne.width,height:ne.height},this.log.error("could not determine track dimensions, using defaults",Object.assign(Object.assign(Object.assign({},this.logContext),ar(e)),{dims:I}))}M.width=I.width,M.height=I.height,Cc(e)&&(Dg(R)&&(e.source===De.Source.ScreenShare&&(n.scalabilityMode="L1T3","contentHint"in e.mediaStreamTrack&&(e.mediaStreamTrack.contentHint="motion",this.log.info("forcing contentHint to motion for screenshare with SVC codecs",Object.assign(Object.assign({},this.logContext),ar(e))))),n.scalabilityMode=(h=n.scalabilityMode)!==null&&h!==void 0?h:"L3T3_KEY"),M.simulcastCodecs=[new j1({codec:R,cid:e.mediaStreamTrack.id})],n.backupCodec===!0&&(n.backupCodec={codec:PT}),n.backupCodec&&R!==n.backupCodec.codec&&M.encryption===Po.NONE&&(this.roomOptions.dynacast||(this.roomOptions.dynacast=!0),M.simulcastCodecs.push(new j1({codec:n.backupCodec.codec,cid:""})))),A=LT(e.source===De.Source.ScreenShare,M.width,M.height,n),M.layers=FO(M.width,M.height,A,Dg(n.videoCodec))}else e.kind===De.Kind.Audio&&(A=[{maxBitrate:(p=n.audioPreset)===null||p===void 0?void 0:p.maxBitrate,priority:(b=(v=n.audioPreset)===null||v===void 0?void 0:v.priority)!==null&&b!==void 0?b:"high",networkPriority:(T=(k=n.audioPreset)===null||k===void 0?void 0:k.priority)!==null&&T!==void 0?T:"high"}]);if(!this.engine||this.engine.isClosed)throw new xi("cannot publish track when not connected");const U=()=>Q(this,void 0,void 0,function*(){var I,N,ne;if(!this.engine.pcManager)throw new xi("pcManager is not ready");if(e.sender=yield this.engine.createSender(e,n,A),Cc(e)&&((I=n.degradationPreference)!==null&&I!==void 0||(n.degradationPreference=nz(e)),e.setDegradationPreference(n.degradationPreference)),A)if(Bh()&&e.kind===De.Kind.Audio){let X;for(const se of this.engine.pcManager.publisher.getTransceivers())if(se.sender===e.sender){X=se;break}X&&this.engine.pcManager.publisher.setTrackCodecBitrate({transceiver:X,codec:"opus",maxbr:!((N=A[0])===null||N===void 0)&&N.maxBitrate?A[0].maxBitrate/1e3:0})}else e.codec&&Dg(e.codec)&&(!((ne=A[0])===null||ne===void 0)&&ne.maxBitrate)&&this.engine.pcManager.publisher.setTrackCodecBitrate({cid:M.cid,codec:e.codec,maxbr:A[0].maxBitrate/1e3});yield this.engine.negotiate()});let V;if(this.enabledPublishVideoCodecs.length>0)V=(yield Promise.all([this.engine.addTrack(M),U()]))[0];else{V=yield this.engine.addTrack(M);let I;if(V.codecs.forEach(N=>{I===void 0&&(I=N.mimeType)}),I&&e.kind===De.Kind.Video){const N=ob(I);N!==R&&(this.log.debug("falling back to server selected codec",Object.assign(Object.assign(Object.assign({},this.logContext),ar(e)),{codec:N})),n.videoCodec=N,A=LT(e.source===De.Source.ScreenShare,M.width,M.height,n))}yield U()}const j=new VT(e.kind,V,e,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});return j.options=n,e.sid=V.sid,this.log.debug("publishing ".concat(e.kind," with encodings"),Object.assign(Object.assign({},this.logContext),{encodings:A,trackInfo:V})),Cc(e)?e.startMonitor(this.engine.client):Qd(e)&&e.startMonitor(),this.addTrackPublication(j),this.emit(Ie.LocalTrackPublished,j),j})}get isLocal(){return!0}publishAdditionalCodecForTrack(e,n,r){return Q(this,void 0,void 0,function*(){var a;if(this.encryptionType!==Po.NONE)return;let s;if(this.trackPublications.forEach(T=>{T.track&&T.track===e&&(s=T)}),!s)throw new uu("track is not published");if(!Cc(e))throw new uu("track is not a video track");const l=Object.assign(Object.assign({},(a=this.roomOptions)===null||a===void 0?void 0:a.publishDefaults),r),c=JV(e,n,l);if(!c){this.log.info("backup codec has been disabled, ignoring request to add additional codec for track",Object.assign(Object.assign({},this.logContext),ar(e)));return}const h=e.addSimulcastTrack(n,c);if(!h)return;const p=new V1({cid:h.mediaStreamTrack.id,type:De.kindToProto(e.kind),muted:e.isMuted,source:De.sourceToProto(e.source),sid:e.sid,simulcastCodecs:[{codec:l.videoCodec,cid:h.mediaStreamTrack.id}]});if(p.layers=FO(p.width,p.height,c),!this.engine||this.engine.isClosed)throw new xi("cannot publish track when not connected");const v=()=>Q(this,void 0,void 0,function*(){yield this.engine.createSimulcastSender(e,h,l,c),yield this.engine.negotiate()}),k=(yield Promise.all([this.engine.addTrack(p),v()]))[0];this.log.debug("published ".concat(n," for track ").concat(e.sid),Object.assign(Object.assign({},this.logContext),{encodings:c,trackInfo:k}))})}unpublishTrack(e,n){return Q(this,void 0,void 0,function*(){var r,a;if(Hh(e)){const p=this.pendingPublishPromises.get(e);p&&(this.log.info("awaiting publish promise before attempting to unpublish",Object.assign(Object.assign({},this.logContext),ar(e))),yield p)}const s=this.getPublicationForTrack(e),l=s?ar(s):void 0;if(this.log.debug("unpublishing track",Object.assign(Object.assign({},this.logContext),l)),!s||!s.track){this.log.warn("track was not unpublished because no publication was found",Object.assign(Object.assign({},this.logContext),l));return}e=s.track,e.off(Qe.Muted,this.onTrackMuted),e.off(Qe.Unmuted,this.onTrackUnmuted),e.off(Qe.Ended,this.handleTrackEnded),e.off(Qe.UpstreamPaused,this.onTrackUpstreamPaused),e.off(Qe.UpstreamResumed,this.onTrackUpstreamResumed),e.off(Qe.AudioTrackFeatureUpdate,this.onTrackFeatureUpdate),n===void 0&&(n=(a=(r=this.roomOptions)===null||r===void 0?void 0:r.stopLocalTrackOnUnpublish)!==null&&a!==void 0?a:!0),n?e.stop():e.stopMonitor();let c=!1;const h=e.sender;if(e.sender=void 0,this.engine.pcManager&&this.engine.pcManager.currentState<Jr.FAILED&&h)try{for(const p of this.engine.pcManager.publisher.getTransceivers())p.sender===h&&(p.direction="inactive",c=!0);if(this.engine.removeTrack(h)&&(c=!0),Cc(e)){for(const[,p]of e.simulcastCodecs)p.sender&&(this.engine.removeTrack(p.sender)&&(c=!0),p.sender=void 0);e.simulcastCodecs.clear()}}catch(p){this.log.warn("failed to unpublish track",Object.assign(Object.assign(Object.assign({},this.logContext),l),{error:p}))}switch(this.trackPublications.delete(s.trackSid),s.kind){case De.Kind.Audio:this.audioTrackPublications.delete(s.trackSid);break;case De.Kind.Video:this.videoTrackPublications.delete(s.trackSid);break}return this.emit(Ie.LocalTrackUnpublished,s),s.setTrack(void 0),c&&(yield this.engine.negotiate()),s})}unpublishTracks(e){return Q(this,void 0,void 0,function*(){return(yield Promise.all(e.map(r=>this.unpublishTrack(r)))).filter(r=>!!r)})}republishAllTracks(e){return Q(this,arguments,void 0,function(n){var r=this;let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){r.republishPromise&&(yield r.republishPromise),r.republishPromise=new Promise((s,l)=>Q(r,void 0,void 0,function*(){try{const c=[];this.trackPublications.forEach(h=>{h.track&&(n&&(h.options=Object.assign(Object.assign({},h.options),n)),c.push(h))}),yield Promise.all(c.map(h=>Q(this,void 0,void 0,function*(){const p=h.track;yield this.unpublishTrack(p,!1),a&&!p.isMuted&&p.source!==De.Source.ScreenShare&&p.source!==De.Source.ScreenShareAudio&&(Qd(p)||Cc(p))&&!p.isUserProvided&&(this.log.debug("restarting existing track",Object.assign(Object.assign({},this.logContext),{track:h.trackSid})),yield p.restartTrack()),yield this.publishOrRepublishTrack(p,h.options,!0)}))),s()}catch(c){l(c)}finally{this.republishPromise=void 0}})),yield r.republishPromise}()})}publishData(e){return Q(this,arguments,void 0,function(n){var r=this;let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){const s=a.reliable?$n.RELIABLE:$n.LOSSY,l=a.destinationIdentities,c=a.topic,h=new ro({kind:s,value:{case:"user",value:new zD({participantIdentity:r.identity,payload:n,destinationIdentities:l,topic:c})}});yield r.engine.sendDataPacket(h,s)}()})}publishDtmf(e,n){return Q(this,void 0,void 0,function*(){const r=new ro({kind:$n.RELIABLE,value:{case:"sipDtmf",value:new BD({code:e,digit:n})}});yield this.engine.sendDataPacket(r,$n.RELIABLE)})}sendChatMessage(e,n){return Q(this,void 0,void 0,function*(){const r={id:crypto.randomUUID(),message:e,timestamp:Date.now(),attachedFiles:n==null?void 0:n.attachments},a=new ro({value:{case:"chatMessage",value:new M1(Object.assign(Object.assign({},r),{timestamp:Ur.parse(r.timestamp)}))}});return yield this.engine.sendDataPacket(a,$n.RELIABLE),this.emit(Ie.ChatMessage,r),r})}editChatMessage(e,n){return Q(this,void 0,void 0,function*(){const r=Object.assign(Object.assign({},n),{message:e,editTimestamp:Date.now()}),a=new ro({value:{case:"chatMessage",value:new M1(Object.assign(Object.assign({},r),{timestamp:Ur.parse(r.timestamp),editTimestamp:Ur.parse(r.editTimestamp)}))}});return yield this.engine.sendDataPacket(a,$n.RELIABLE),this.emit(Ie.ChatMessage,r),r})}sendText(e,n){return Q(this,void 0,void 0,function*(){var r;const a=crypto.randomUUID(),l=new TextEncoder().encode(e).byteLength,c=(r=n==null?void 0:n.attachments)===null||r===void 0?void 0:r.map(()=>crypto.randomUUID()),h=new Array(c?c.length+1:1).fill(0),p=(b,k)=>{var T;h[k]=b;const E=h.reduce((R,M)=>R+M,0);(T=n==null?void 0:n.onProgress)===null||T===void 0||T.call(n,E)},v=yield this.streamText({streamId:a,totalSize:l,destinationIdentities:n==null?void 0:n.destinationIdentities,topic:n==null?void 0:n.topic,attachedStreamIds:c,attributes:n==null?void 0:n.attributes});return yield v.write(e),p(1,0),yield v.close(),n!=null&&n.attachments&&c&&(yield Promise.all(n.attachments.map((b,k)=>Q(this,void 0,void 0,function*(){return this._sendFile(c[k],b,{topic:n.topic,mimeType:b.type,onProgress:T=>{p(T,k+1)}})})))),v.info})}streamText(e){return Q(this,void 0,void 0,function*(){var n,r;const a=(n=e==null?void 0:e.streamId)!==null&&n!==void 0?n:crypto.randomUUID(),s={id:a,mimeType:"text/plain",timestamp:Date.now(),topic:(r=e==null?void 0:e.topic)!==null&&r!==void 0?r:"",size:e==null?void 0:e.totalSize,attributes:e==null?void 0:e.attributes},l=new N1({streamId:a,mimeType:s.mimeType,topic:s.topic,timestamp:Zd(s.timestamp),totalLength:Zd(e==null?void 0:e.totalSize),attributes:s.attributes,contentHeader:{case:"textHeader",value:new JD({version:e==null?void 0:e.version,attachedStreamIds:e==null?void 0:e.attachedStreamIds,replyToStreamId:e==null?void 0:e.replyToStreamId,operationType:(e==null?void 0:e.type)==="update"?L1.UPDATE:L1.CREATE})}}),c=e==null?void 0:e.destinationIdentities,h=new ro({destinationIdentities:c,value:{case:"streamHeader",value:l}});yield this.engine.sendDataPacket(h,$n.RELIABLE);let p=0;const v=this,b=new WritableStream({write(E){return Q(this,void 0,void 0,function*(){for(const R of CV(E,WO)){yield v.engine.waitForBufferStatusLow($n.RELIABLE);const M=new I1({content:R,streamId:a,chunkIndex:Zd(p)}),A=new ro({destinationIdentities:c,value:{case:"streamChunk",value:M}});yield v.engine.sendDataPacket(A,$n.RELIABLE),p+=1}})},close(){return Q(this,void 0,void 0,function*(){const E=new U1({streamId:a}),R=new ro({destinationIdentities:c,value:{case:"streamTrailer",value:E}});yield v.engine.sendDataPacket(R,$n.RELIABLE)})},abort(E){console.log("Sink error:",E)}});let k=()=>Q(this,void 0,void 0,function*(){yield T.close()});v.engine.once(tt.Closing,k);const T=new dz(b,s,()=>this.engine.off(tt.Closing,k));return T})}sendFile(e,n){return Q(this,void 0,void 0,function*(){const r=crypto.randomUUID();return yield this._sendFile(r,e,n),{id:r}})}_sendFile(e,n,r){return Q(this,void 0,void 0,function*(){var a;const s=yield this.streamBytes({streamId:e,totalSize:n.size,name:n.name,mimeType:(a=r==null?void 0:r.mimeType)!==null&&a!==void 0?a:n.type,topic:r==null?void 0:r.topic,destinationIdentities:r==null?void 0:r.destinationIdentities}),l=n.stream().getReader();for(;;){const{done:c,value:h}=yield l.read();if(c)break;yield s.write(h)}return yield s.close(),s.info})}streamBytes(e){return Q(this,void 0,void 0,function*(){var n,r,a,s,l;const c=(n=e==null?void 0:e.streamId)!==null&&n!==void 0?n:crypto.randomUUID(),h=e==null?void 0:e.destinationIdentities,p={id:c,mimeType:(r=e==null?void 0:e.mimeType)!==null&&r!==void 0?r:"application/octet-stream",topic:(a=e==null?void 0:e.topic)!==null&&a!==void 0?a:"",timestamp:Date.now(),attributes:e==null?void 0:e.attributes,size:e==null?void 0:e.totalSize,name:(s=e==null?void 0:e.name)!==null&&s!==void 0?s:"unknown"},v=new N1({totalLength:Zd((l=p.size)!==null&&l!==void 0?l:0),mimeType:p.mimeType,streamId:c,topic:p.topic,timestamp:Zd(Date.now()),contentHeader:{case:"byteHeader",value:new eA({name:p.name})}}),b=new ro({destinationIdentities:h,value:{case:"streamHeader",value:v}});yield this.engine.sendDataPacket(b,$n.RELIABLE);let k=0;const T=new to,E=this.engine,R=this.log,M=new WritableStream({write(U){return Q(this,void 0,void 0,function*(){const V=yield T.lock();let j=0;try{for(;j<U.byteLength;){const I=U.slice(j,j+WO);yield E.waitForBufferStatusLow($n.RELIABLE);const N=new ro({destinationIdentities:h,value:{case:"streamChunk",value:new I1({content:I,streamId:c,chunkIndex:Zd(k)})}});yield E.sendDataPacket(N,$n.RELIABLE),k+=1,j+=I.byteLength}}finally{V()}})},close(){return Q(this,void 0,void 0,function*(){const U=new U1({streamId:c}),V=new ro({destinationIdentities:h,value:{case:"streamTrailer",value:U}});yield E.sendDataPacket(V,$n.RELIABLE)})},abort(U){R.error("Sink error:",U)}});return new fz(M,p)})}performRpc(e){return Q(this,arguments,void 0,function(n){var r=this;let{destinationIdentity:a,method:s,payload:l,responseTimeout:c=1e4}=n;return function*(){return new Promise((p,v)=>Q(r,void 0,void 0,function*(){var b,k,T,E;if(AT(l)>AO){v(ei.builtIn("REQUEST_PAYLOAD_TOO_LARGE"));return}if(!((k=(b=this.engine.latestJoinResponse)===null||b===void 0?void 0:b.serverInfo)===null||k===void 0)&&k.version&&bc((E=(T=this.engine.latestJoinResponse)===null||T===void 0?void 0:T.serverInfo)===null||E===void 0?void 0:E.version,"1.8.0")<0){v(ei.builtIn("UNSUPPORTED_SERVER"));return}const R=crypto.randomUUID();yield this.publishRpcRequest(a,R,s,l,c-2e3);const M=setTimeout(()=>{this.pendingAcks.delete(R),v(ei.builtIn("CONNECTION_TIMEOUT")),this.pendingResponses.delete(R),clearTimeout(A)},2e3);this.pendingAcks.set(R,{resolve:()=>{clearTimeout(M)},participantIdentity:a});const A=setTimeout(()=>{this.pendingResponses.delete(R),v(ei.builtIn("RESPONSE_TIMEOUT"))},c);this.pendingResponses.set(R,{resolve:(U,V)=>{clearTimeout(A),this.pendingAcks.has(R)&&(console.warn("RPC response received before ack",R),this.pendingAcks.delete(R),clearTimeout(M)),V?v(V):p(U??"")},participantIdentity:a})}))}()})}registerRpcMethod(e,n){this.rpcHandlers.has(e)&&this.log.warn("you're overriding the RPC handler for method ".concat(e,", in the future this will throw an error")),this.rpcHandlers.set(e,n)}unregisterRpcMethod(e){this.rpcHandlers.delete(e)}setTrackSubscriptionPermissions(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];this.participantTrackPermissions=n,this.allParticipantsAllowedToSubscribe=e,this.engine.client.isDisconnected||this.updateTrackSubscriptionPermissions()}handleIncomingRpcAck(e){const n=this.pendingAcks.get(e);n?(n.resolve(),this.pendingAcks.delete(e)):console.error("Ack received for unexpected RPC request",e)}handleIncomingRpcResponse(e,n,r){const a=this.pendingResponses.get(e);a?(a.resolve(n,r),this.pendingResponses.delete(e)):console.error("Response received for unexpected RPC request",e)}publishRpcRequest(e,n,r,a,s){return Q(this,void 0,void 0,function*(){const l=new ro({destinationIdentities:[e],kind:$n.RELIABLE,value:{case:"rpcRequest",value:new HD({id:n,method:r,payload:a,responseTimeoutMs:s,version:1})}});yield this.engine.sendDataPacket(l,$n.RELIABLE)})}handleParticipantDisconnected(e){for(const[n,{participantIdentity:r}]of this.pendingAcks)r===e&&this.pendingAcks.delete(n);for(const[n,{participantIdentity:r,resolve:a}]of this.pendingResponses)r===e&&(a(null,ei.builtIn("RECIPIENT_DISCONNECTED")),this.pendingResponses.delete(n))}setEnabledPublishCodecs(e){this.enabledPublishVideoCodecs=e.filter(n=>n.mime.split("/")[0].toLowerCase()==="video")}updateInfo(e){return e.sid!==this.sid||!super.updateInfo(e)?!1:(e.tracks.forEach(n=>{var r,a;const s=this.trackPublications.get(n.sid);if(s){const l=s.isMuted||((a=(r=s.track)===null||r===void 0?void 0:r.isUpstreamPaused)!==null&&a!==void 0?a:!1);l!==n.muted&&(this.log.debug("updating server mute state after reconcile",Object.assign(Object.assign(Object.assign({},this.logContext),ar(s)),{mutedOnServer:l})),this.engine.client.sendMuteTrack(n.sid,l))}}),!0)}getPublicationForTrack(e){let n;return this.trackPublications.forEach(r=>{const a=r.track;a&&(e instanceof MediaStreamTrack?(Qd(a)||Cc(a))&&a.mediaStreamTrack===e&&(n=r):e===a&&(n=r))}),n}waitForPendingPublicationOfSource(e){return Q(this,void 0,void 0,function*(){const r=Date.now();for(;Date.now()<r+1e4;){const a=Array.from(this.pendingPublishPromises.entries()).find(s=>{let[l]=s;return l.source===e});if(a)return a[1];yield io(20)}})}}class GO extends du{constructor(e,n,r,a){super(e,n.sid,n.name,a),this.track=void 0,this.allowed=!0,this.disabled=!1,this.currentVideoQuality=Go.HIGH,this.handleEnded=s=>{this.setTrack(void 0),this.emit(Qe.Ended,s)},this.handleVisibilityChange=s=>{this.log.debug("adaptivestream video visibility ".concat(this.trackSid,", visible=").concat(s),this.logContext),this.disabled=!s,this.emitTrackUpdate()},this.handleVideoDimensionsChange=s=>{this.log.debug("adaptivestream video dimensions ".concat(s.width,"x").concat(s.height),this.logContext),this.videoDimensions=s,this.emitTrackUpdate()},this.subscribed=r,this.updateInfo(n)}setSubscribed(e){const n=this.subscriptionStatus,r=this.permissionStatus;this.subscribed=e,e&&(this.allowed=!0);const a=new q0({trackSids:[this.trackSid],subscribe:this.subscribed,participantTracks:[new GD({participantSid:"",trackSids:[this.trackSid]})]});this.emit(Qe.UpdateSubscription,a),this.emitSubscriptionUpdateIfChanged(n),this.emitPermissionUpdateIfChanged(r)}get subscriptionStatus(){return this.subscribed===!1?du.SubscriptionStatus.Unsubscribed:super.isSubscribed?du.SubscriptionStatus.Subscribed:du.SubscriptionStatus.Desired}get permissionStatus(){return this.allowed?du.PermissionStatus.Allowed:du.PermissionStatus.NotAllowed}get isSubscribed(){return this.subscribed===!1?!1:super.isSubscribed}get isDesired(){return this.subscribed!==!1}get isEnabled(){return!this.disabled}get isLocal(){return!1}setEnabled(e){!this.isManualOperationAllowed()||this.disabled===!e||(this.disabled=!e,this.emitTrackUpdate())}setVideoQuality(e){!this.isManualOperationAllowed()||this.currentVideoQuality===e||(this.currentVideoQuality=e,this.videoDimensions=void 0,this.emitTrackUpdate())}setVideoDimensions(e){var n,r;this.isManualOperationAllowed()&&(((n=this.videoDimensions)===null||n===void 0?void 0:n.width)===e.width&&((r=this.videoDimensions)===null||r===void 0?void 0:r.height)===e.height||(bT(this.track)&&(this.videoDimensions=e),this.currentVideoQuality=void 0,this.emitTrackUpdate()))}setVideoFPS(e){this.isManualOperationAllowed()&&bT(this.track)&&this.fps!==e&&(this.fps=e,this.emitTrackUpdate())}get videoQuality(){return this.currentVideoQuality}setTrack(e){const n=this.subscriptionStatus,r=this.permissionStatus,a=this.track;a!==e&&(a&&(a.off(Qe.VideoDimensionsChanged,this.handleVideoDimensionsChange),a.off(Qe.VisibilityChanged,this.handleVisibilityChange),a.off(Qe.Ended,this.handleEnded),a.detach(),a.stopMonitor(),this.emit(Qe.Unsubscribed,a)),super.setTrack(e),e&&(e.sid=this.trackSid,e.on(Qe.VideoDimensionsChanged,this.handleVideoDimensionsChange),e.on(Qe.VisibilityChanged,this.handleVisibilityChange),e.on(Qe.Ended,this.handleEnded),this.emit(Qe.Subscribed,e)),this.emitPermissionUpdateIfChanged(r),this.emitSubscriptionUpdateIfChanged(n))}setAllowed(e){const n=this.subscriptionStatus,r=this.permissionStatus;this.allowed=e,this.emitPermissionUpdateIfChanged(r),this.emitSubscriptionUpdateIfChanged(n)}setSubscriptionError(e){this.emit(Qe.SubscriptionFailed,e)}updateInfo(e){super.updateInfo(e);const n=this.metadataMuted;this.metadataMuted=e.muted,this.track?this.track.setMuted(e.muted):n!==e.muted&&this.emit(e.muted?Qe.Muted:Qe.Unmuted)}emitSubscriptionUpdateIfChanged(e){const n=this.subscriptionStatus;e!==n&&this.emit(Qe.SubscriptionStatusChanged,n,e)}emitPermissionUpdateIfChanged(e){this.permissionStatus!==e&&this.emit(Qe.SubscriptionPermissionChanged,this.permissionStatus,e)}isManualOperationAllowed(){return this.kind===De.Kind.Video&&this.isAdaptiveStream?(this.log.warn("adaptive stream is enabled, cannot change video track settings",this.logContext),!1):this.isDesired?!0:(this.log.warn("cannot update track settings when not subscribed",this.logContext),!1)}get isAdaptiveStream(){return bT(this.track)&&this.track.isAdaptiveStream}emitTrackUpdate(){const e=new nA({trackSids:[this.trackSid],disabled:this.disabled,fps:this.fps});this.videoDimensions?(e.width=Math.ceil(this.videoDimensions.width),e.height=Math.ceil(this.videoDimensions.height)):this.currentVideoQuality!==void 0?e.quality=this.currentVideoQuality:e.quality=Go.HIGH,this.emit(Qe.UpdateSettings,e)}}class pb extends qO{static fromParticipantInfo(e,n,r){return new pb(e,n.sid,n.identity,n.name,n.metadata,n.attributes,r,n.kind)}get logContext(){return Object.assign(Object.assign({},super.logContext),{rpID:this.sid,remoteParticipant:this.identity})}constructor(e,n,r,a,s,l,c){let h=arguments.length>7&&arguments[7]!==void 0?arguments[7]:_g.STANDARD;super(n,r||"",a,s,l,c,h),this.signalClient=e,this.trackPublications=new Map,this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.volumeMap=new Map}addTrackPublication(e){super.addTrackPublication(e),e.on(Qe.UpdateSettings,n=>{this.log.debug("send update settings",Object.assign(Object.assign({},this.logContext),ar(e))),this.signalClient.sendUpdateTrackSettings(n)}),e.on(Qe.UpdateSubscription,n=>{n.participantTracks.forEach(r=>{r.participantSid=this.sid}),this.signalClient.sendUpdateSubscription(n)}),e.on(Qe.SubscriptionPermissionChanged,n=>{this.emit(Ie.TrackSubscriptionPermissionChanged,e,n)}),e.on(Qe.SubscriptionStatusChanged,n=>{this.emit(Ie.TrackSubscriptionStatusChanged,e,n)}),e.on(Qe.Subscribed,n=>{this.emit(Ie.TrackSubscribed,n,e)}),e.on(Qe.Unsubscribed,n=>{this.emit(Ie.TrackUnsubscribed,n,e)}),e.on(Qe.SubscriptionFailed,n=>{this.emit(Ie.TrackSubscriptionFailed,e.trackSid,n)})}getTrackPublication(e){const n=super.getTrackPublication(e);if(n)return n}getTrackPublicationByName(e){const n=super.getTrackPublicationByName(e);if(n)return n}setVolume(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:De.Source.Microphone;this.volumeMap.set(n,e);const r=this.getTrackPublication(n);r&&r.track&&r.track.setVolume(e)}getVolume(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:De.Source.Microphone;const n=this.getTrackPublication(e);return n&&n.track?n.track.getVolume():this.volumeMap.get(e)}addSubscribedMediaTrack(e,n,r,a,s,l){let c=this.getTrackPublicationBySid(n);if(c||n.startsWith("TR")||this.trackPublications.forEach(v=>{!c&&e.kind===v.kind.toString()&&(c=v)}),!c){if(l===0){this.log.error("could not find published track",Object.assign(Object.assign({},this.logContext),{trackSid:n})),this.emit(Ie.TrackSubscriptionFailed,n);return}l===void 0&&(l=20),setTimeout(()=>{this.addSubscribedMediaTrack(e,n,r,a,s,l-1)},150);return}if(e.readyState==="ended"){this.log.error("unable to subscribe because MediaStreamTrack is ended. Do not call MediaStreamTrack.stop()",Object.assign(Object.assign({},this.logContext),ar(c))),this.emit(Ie.TrackSubscriptionFailed,n);return}const h=e.kind==="video";let p;return h?p=new hz(e,n,a,s):p=new $O(e,n,a,this.audioContext,this.audioOutput),p.source=c.source,p.isMuted=c.isMuted,p.setMediaStream(r),p.start(),c.setTrack(p),this.volumeMap.has(c.source)&&yT(p)&&cu(p)&&p.setVolume(this.volumeMap.get(c.source)),c}get hasMetadata(){return!!this.participantInfo}getTrackPublicationBySid(e){return this.trackPublications.get(e)}updateInfo(e){if(!super.updateInfo(e))return!1;const n=new Map,r=new Map;return e.tracks.forEach(a=>{var s,l;let c=this.getTrackPublicationBySid(a.sid);if(c)c.updateInfo(a);else{const h=De.kindFromProto(a.type);if(!h)return;c=new GO(h,a,(s=this.signalClient.connectOptions)===null||s===void 0?void 0:s.autoSubscribe,{loggerContextCb:()=>this.logContext,loggerName:(l=this.loggerOptions)===null||l===void 0?void 0:l.loggerName}),c.updateInfo(a),r.set(a.sid,c);const p=Array.from(this.trackPublications.values()).find(v=>v.source===(c==null?void 0:c.source));p&&c.source!==De.Source.Unknown&&this.log.debug("received a second track publication for ".concat(this.identity," with the same source: ").concat(c.source),Object.assign(Object.assign({},this.logContext),{oldTrack:ar(p),newTrack:ar(c)})),this.addTrackPublication(c)}n.set(a.sid,c)}),this.trackPublications.forEach(a=>{n.has(a.trackSid)||(this.log.trace("detected removed track on remote participant, unpublishing",Object.assign(Object.assign({},this.logContext),ar(a))),this.unpublishTrack(a.trackSid,!0))}),r.forEach(a=>{this.emit(Ie.TrackPublished,a)}),!0}unpublishTrack(e,n){const r=this.trackPublications.get(e);if(!r)return;const{track:a}=r;switch(a&&(a.stop(),r.setTrack(void 0)),this.trackPublications.delete(e),r.kind){case De.Kind.Audio:this.audioTrackPublications.delete(e);break;case De.Kind.Video:this.videoTrackPublications.delete(e);break}n&&this.emit(Ie.TrackUnpublished,r)}setAudioOutput(e){return Q(this,void 0,void 0,function*(){this.audioOutput=e;const n=[];this.audioTrackPublications.forEach(r=>{var a;cu(r.track)&&yT(r.track)&&n.push(r.track.setSinkId((a=e.deviceId)!==null&&a!==void 0?a:"default"))}),yield Promise.all(n)})}emit(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return this.log.trace("participant event",Object.assign(Object.assign({},this.logContext),{event:e,args:r})),super.emit(e,...r)}}var Fn;(function(t){t.Disconnected="disconnected",t.Connecting="connecting",t.Connected="connected",t.Reconnecting="reconnecting",t.SignalReconnecting="signalReconnecting"})(Fn||(Fn={}));const bz=4*1e3;class Gh extends dl.EventEmitter{constructor(e){var n,r,a,s;if(super(),n=this,this.state=Fn.Disconnected,this.activeSpeakers=[],this.isE2EEEnabled=!1,this.audioEnabled=!0,this.isVideoPlaybackBlocked=!1,this.log=Nn,this.bufferedEvents=[],this.isResuming=!1,this.byteStreamControllers=new Map,this.textStreamControllers=new Map,this.byteStreamHandlers=new Map,this.textStreamHandlers=new Map,this.rpcHandlers=new Map,this.connect=(l,c,h)=>Q(this,void 0,void 0,function*(){var p;if(!uV())throw fl()?Error("WebRTC isn't detected, have you called registerGlobals?"):Error("LiveKit doesn't seem to be supported on this browser. Try to update your browser and make sure no browser extensions are disabling webRTC.");const v=yield this.disconnectLock.lock();if(this.state===Fn.Connected)return this.log.info("already connected to room ".concat(this.name),this.logContext),v(),Promise.resolve();if(this.connectFuture)return v(),this.connectFuture.promise;this.setAndEmitConnectionState(Fn.Connecting),((p=this.regionUrlProvider)===null||p===void 0?void 0:p.getServerUrl().toString())!==l&&(this.regionUrl=void 0,this.regionUrlProvider=void 0),hT(new URL(l))&&(this.regionUrlProvider===void 0?this.regionUrlProvider=new UT(l,c):this.regionUrlProvider.updateToken(c),this.regionUrlProvider.fetchRegionSettings().then(T=>{var E;(E=this.regionUrlProvider)===null||E===void 0||E.setServerReportedRegions(T)}).catch(T=>{this.log.warn("could not fetch region settings",Object.assign(Object.assign({},this.logContext),{error:T}))}));const b=(T,E,R)=>Q(this,void 0,void 0,function*(){var M,A;this.abortController&&this.abortController.abort();const U=new AbortController;this.abortController=U,v==null||v();try{yield this.attemptConnection(R??l,c,h,U),this.abortController=void 0,T()}catch(V){if(this.regionUrlProvider&&V instanceof br&&V.reason!==Un.Cancelled&&V.reason!==Un.NotAllowed){let j=null;try{j=yield this.regionUrlProvider.getNextBestRegionUrl((M=this.abortController)===null||M===void 0?void 0:M.signal)}catch(I){if(I instanceof br&&(I.status===401||I.reason===Un.Cancelled)){this.handleDisconnect(this.options.stopLocalTrackOnUnpublish),E(I);return}}j&&!(!((A=this.abortController)===null||A===void 0)&&A.signal.aborted)?(this.log.info("Initial connection failed with ConnectionError: ".concat(V.message,". Retrying with another region: ").concat(j),this.logContext),this.recreateEngine(),yield b(T,E,j)):(this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,pO(V)),E(V))}else{let j=ks.UNKNOWN_REASON;V instanceof br&&(j=pO(V)),this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,j),E(V)}}}),k=this.regionUrl;return this.regionUrl=void 0,this.connectFuture=new hO((T,E)=>{b(T,E,k)},()=>{this.clearConnectionFutures()}),this.connectFuture.promise}),this.connectSignal=(l,c,h,p,v,b)=>Q(this,void 0,void 0,function*(){var k,T,E;const R=yield h.join(l,c,{autoSubscribe:p.autoSubscribe,adaptiveStream:typeof v.adaptiveStream=="object"?!0:v.adaptiveStream,maxRetries:p.maxRetries,e2eeEnabled:!!this.e2eeManager,websocketTimeout:p.websocketTimeout},b.signal);let M=R.serverInfo;if(M||(M={version:R.serverVersion,region:R.serverRegion}),this.serverInfo=M,this.log.debug("connected to Livekit Server ".concat(Object.entries(M).map(A=>{let[U,V]=A;return"".concat(U,": ").concat(V)}).join(", ")),{room:(k=R.room)===null||k===void 0?void 0:k.name,roomSid:(T=R.room)===null||T===void 0?void 0:T.sid,identity:(E=R.participant)===null||E===void 0?void 0:E.identity}),!M.version)throw new Y8("unknown server version");return M.version==="0.15.1"&&this.options.dynacast&&(this.log.debug("disabling dynacast due to server version",this.logContext),v.dynacast=!1),R}),this.applyJoinResponse=l=>{const c=l.participant;if(this.localParticipant.sid=c.sid,this.localParticipant.identity=c.identity,this.localParticipant.setEnabledPublishCodecs(l.enabledPublishCodecs),this.options.e2ee&&this.e2eeManager)try{this.e2eeManager.setSifTrailer(l.sifTrailer)}catch(h){this.log.error(h instanceof Error?h.message:"Could not set SifTrailer",Object.assign(Object.assign({},this.logContext),{error:h}))}this.handleParticipantUpdates([c,...l.otherParticipants]),l.room&&this.handleRoomUpdate(l.room)},this.attemptConnection=(l,c,h,p)=>Q(this,void 0,void 0,function*(){var v,b;this.state===Fn.Reconnecting||this.isResuming||!((v=this.engine)===null||v===void 0)&&v.pendingReconnect?(this.log.info("Reconnection attempt replaced by new connection attempt",this.logContext),this.recreateEngine()):this.maybeCreateEngine(),!((b=this.regionUrlProvider)===null||b===void 0)&&b.isCloud()&&this.engine.setRegionUrlProvider(this.regionUrlProvider),this.acquireAudioContext(),this.connOptions=Object.assign(Object.assign({},DT),h),this.connOptions.rtcConfig&&(this.engine.rtcConfig=this.connOptions.rtcConfig),this.connOptions.peerConnectionTimeout&&(this.engine.peerConnectionTimeout=this.connOptions.peerConnectionTimeout);try{const k=yield this.connectSignal(l,c,this.engine,this.connOptions,this.options,p);this.applyJoinResponse(k),this.setupLocalParticipantEvents(),this.emit(Ee.SignalConnected)}catch(k){yield this.engine.close(),this.recreateEngine();const T=new br("could not establish signal connection",Un.ServerUnreachable);throw k instanceof Error&&(T.message="".concat(T.message,": ").concat(k.message)),k instanceof br&&(T.reason=k.reason,T.status=k.status),this.log.debug("error trying to establish signal connection",Object.assign(Object.assign({},this.logContext),{error:k})),T}if(p.signal.aborted)throw yield this.engine.close(),this.recreateEngine(),new br("Connection attempt aborted",Un.Cancelled);try{yield this.engine.waitForPCInitialConnection(this.connOptions.peerConnectionTimeout,p)}catch(k){throw yield this.engine.close(),this.recreateEngine(),k}ao()&&this.options.disconnectOnPageLeave&&(window.addEventListener("pagehide",this.onPageLeave),window.addEventListener("beforeunload",this.onPageLeave)),ao()&&document.addEventListener("freeze",this.onPageLeave),this.setAndEmitConnectionState(Fn.Connected),this.emit(Ee.Connected),this.registerConnectionReconcile()}),this.disconnect=function(){for(var l=arguments.length,c=new Array(l),h=0;h<l;h++)c[h]=arguments[h];return Q(n,[...c],void 0,function(){var p=this;let v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){var b,k,T,E;const R=yield p.disconnectLock.lock();try{if(p.state===Fn.Disconnected){p.log.debug("already disconnected",p.logContext);return}p.log.info("disconnect from room",Object.assign({},p.logContext)),(p.state===Fn.Connecting||p.state===Fn.Reconnecting||p.isResuming)&&(p.log.warn("abort connection attempt",p.logContext),(b=p.abortController)===null||b===void 0||b.abort(),(T=(k=p.connectFuture)===null||k===void 0?void 0:k.reject)===null||T===void 0||T.call(k,new br("Client initiated disconnect",Un.Cancelled)),p.connectFuture=void 0),!((E=p.engine)===null||E===void 0)&&E.client.isDisconnected||(yield p.engine.client.sendLeave()),p.engine&&(yield p.engine.close()),p.handleDisconnect(v,ks.CLIENT_INITIATED),p.engine=void 0}finally{R()}}()})},this.onPageLeave=()=>Q(this,void 0,void 0,function*(){this.log.info("Page leave detected, disconnecting",this.logContext),yield this.disconnect()}),this.startAudio=()=>Q(this,void 0,void 0,function*(){const l=[],c=ws();if(c&&c.os==="iOS"){const h="livekit-dummy-audio-el";let p=document.getElementById(h);if(!p){p=document.createElement("audio"),p.id=h,p.autoplay=!0,p.hidden=!0;const v=gT();v.enabled=!0;const b=new MediaStream([v]);p.srcObject=b,document.addEventListener("visibilitychange",()=>{p&&(p.srcObject=document.hidden?null:b,document.hidden||(this.log.debug("page visible again, triggering startAudio to resume playback and update playback status",this.logContext),this.startAudio()))}),document.body.append(p),this.once(Ee.Disconnected,()=>{p==null||p.remove(),p=null})}l.push(p)}this.remoteParticipants.forEach(h=>{h.audioTrackPublications.forEach(p=>{p.track&&p.track.attachedElements.forEach(v=>{l.push(v)})})});try{yield Promise.all([this.acquireAudioContext(),...l.map(h=>(h.muted=!1,h.play()))]),this.handleAudioPlaybackStarted()}catch(h){throw this.handleAudioPlaybackFailed(h),h}}),this.startVideo=()=>Q(this,void 0,void 0,function*(){const l=[];for(const c of this.remoteParticipants.values())c.videoTrackPublications.forEach(h=>{var p;(p=h.track)===null||p===void 0||p.attachedElements.forEach(v=>{l.includes(v)||l.push(v)})});yield Promise.all(l.map(c=>c.play())).then(()=>{this.handleVideoPlaybackStarted()}).catch(c=>{c.name==="NotAllowedError"?this.handleVideoPlaybackFailed():this.log.warn("Resuming video playback failed, make sure you call `startVideo` directly in a user gesture handler",this.logContext)})}),this.handleRestarting=()=>{this.clearConnectionReconcile(),this.isResuming=!1;for(const l of this.remoteParticipants.values())this.handleParticipantDisconnected(l.identity,l);this.setAndEmitConnectionState(Fn.Reconnecting)&&this.emit(Ee.Reconnecting)},this.handleSignalRestarted=l=>Q(this,void 0,void 0,function*(){this.log.debug("signal reconnected to server, region ".concat(l.serverRegion),Object.assign(Object.assign({},this.logContext),{region:l.serverRegion})),this.bufferedEvents=[],this.applyJoinResponse(l);try{yield this.localParticipant.republishAllTracks(void 0,!0)}catch(c){this.log.error("error trying to re-publish tracks after reconnection",Object.assign(Object.assign({},this.logContext),{error:c}))}try{yield this.engine.waitForRestarted(),this.log.debug("fully reconnected to server",Object.assign(Object.assign({},this.logContext),{region:l.serverRegion}))}catch{return}this.setAndEmitConnectionState(Fn.Connected),this.emit(Ee.Reconnected),this.registerConnectionReconcile(),this.emitBufferedEvents()}),this.handleParticipantUpdates=l=>{l.forEach(c=>{var h;if(c.identity===this.localParticipant.identity){this.localParticipant.updateInfo(c);return}c.identity===""&&(c.identity=(h=this.sidToIdentity.get(c.sid))!==null&&h!==void 0?h:"");let p=this.remoteParticipants.get(c.identity);c.state===O1.DISCONNECTED?this.handleParticipantDisconnected(c.identity,p):p=this.getOrCreateParticipant(c.identity,c)})},this.handleActiveSpeakersUpdate=l=>{const c=[],h={};l.forEach(p=>{if(h[p.sid]=!0,p.sid===this.localParticipant.sid)this.localParticipant.audioLevel=p.level,this.localParticipant.setIsSpeaking(!0),c.push(this.localParticipant);else{const v=this.getRemoteParticipantBySid(p.sid);v&&(v.audioLevel=p.level,v.setIsSpeaking(!0),c.push(v))}}),h[this.localParticipant.sid]||(this.localParticipant.audioLevel=0,this.localParticipant.setIsSpeaking(!1)),this.remoteParticipants.forEach(p=>{h[p.sid]||(p.audioLevel=0,p.setIsSpeaking(!1))}),this.activeSpeakers=c,this.emitWhenConnected(Ee.ActiveSpeakersChanged,c)},this.handleSpeakersChanged=l=>{const c=new Map;this.activeSpeakers.forEach(p=>{const v=this.remoteParticipants.get(p.identity);v&&v.sid!==p.sid||c.set(p.sid,p)}),l.forEach(p=>{let v=this.getRemoteParticipantBySid(p.sid);p.sid===this.localParticipant.sid&&(v=this.localParticipant),v&&(v.audioLevel=p.level,v.setIsSpeaking(p.active),p.active?c.set(p.sid,v):c.delete(p.sid))});const h=Array.from(c.values());h.sort((p,v)=>v.audioLevel-p.audioLevel),this.activeSpeakers=h,this.emitWhenConnected(Ee.ActiveSpeakersChanged,h)},this.handleStreamStateUpdate=l=>{l.streamStates.forEach(c=>{const h=this.getRemoteParticipantBySid(c.participantSid);if(!h)return;const p=h.getTrackPublicationBySid(c.trackSid);if(!p||!p.track)return;const v=De.streamStateFromProto(c.state);v!==p.track.streamState&&(p.track.streamState=v,h.emit(Ie.TrackStreamStateChanged,p,p.track.streamState),this.emitWhenConnected(Ee.TrackStreamStateChanged,p,p.track.streamState,h))})},this.handleSubscriptionPermissionUpdate=l=>{const c=this.getRemoteParticipantBySid(l.participantSid);if(!c)return;const h=c.getTrackPublicationBySid(l.trackSid);h&&h.setAllowed(l.allowed)},this.handleSubscriptionError=l=>{const c=Array.from(this.remoteParticipants.values()).find(p=>p.trackPublications.has(l.trackSid));if(!c)return;const h=c.getTrackPublicationBySid(l.trackSid);h&&h.setSubscriptionError(l.err)},this.handleDataPacket=l=>{const c=this.remoteParticipants.get(l.participantIdentity);if(l.value.case==="user")this.handleUserPacket(c,l.value.value,l.kind);else if(l.value.case==="transcription")this.handleTranscription(c,l.value.value);else if(l.value.case==="sipDtmf")this.handleSipDtmf(c,l.value.value);else if(l.value.case==="chatMessage")this.handleChatMessage(c,l.value.value);else if(l.value.case==="metrics")this.handleMetrics(l.value.value,c);else if(l.value.case==="streamHeader")this.handleStreamHeader(l.value.value,l.participantIdentity);else if(l.value.case==="streamChunk")this.handleStreamChunk(l.value.value);else if(l.value.case==="streamTrailer")this.handleStreamTrailer(l.value.value);else if(l.value.case==="rpcRequest"){const h=l.value.value;this.handleIncomingRpcRequest(l.participantIdentity,h.id,h.method,h.payload,h.responseTimeoutMs,h.version)}},this.handleUserPacket=(l,c,h)=>{this.emit(Ee.DataReceived,c.payload,l,h,c.topic),l==null||l.emit(Ie.DataReceived,c.payload,h)},this.handleSipDtmf=(l,c)=>{this.emit(Ee.SipDTMFReceived,c,l),l==null||l.emit(Ie.SipDTMFReceived,c)},this.bufferedSegments=new Map,this.handleTranscription=(l,c)=>{const h=c.transcribedParticipantIdentity===this.localParticipant.identity?this.localParticipant:this.getParticipantByIdentity(c.transcribedParticipantIdentity),p=h==null?void 0:h.trackPublications.get(c.trackId),v=vV(c,this.transcriptionReceivedTimes);p==null||p.emit(Qe.TranscriptionReceived,v),h==null||h.emit(Ie.TranscriptionReceived,v,p),this.emit(Ee.TranscriptionReceived,v,h,p)},this.handleChatMessage=(l,c)=>{const h=yV(c);this.emit(Ee.ChatMessage,h,l)},this.handleMetrics=(l,c)=>{this.emit(Ee.MetricsReceived,l,c)},this.handleAudioPlaybackStarted=()=>{this.canPlaybackAudio||(this.audioEnabled=!0,this.emit(Ee.AudioPlaybackStatusChanged,!0))},this.handleAudioPlaybackFailed=l=>{this.log.warn("could not playback audio",Object.assign(Object.assign({},this.logContext),{error:l})),this.canPlaybackAudio&&(this.audioEnabled=!1,this.emit(Ee.AudioPlaybackStatusChanged,!1))},this.handleVideoPlaybackStarted=()=>{this.isVideoPlaybackBlocked&&(this.isVideoPlaybackBlocked=!1,this.emit(Ee.VideoPlaybackStatusChanged,!0))},this.handleVideoPlaybackFailed=()=>{this.isVideoPlaybackBlocked||(this.isVideoPlaybackBlocked=!0,this.emit(Ee.VideoPlaybackStatusChanged,!1))},this.handleDeviceChange=()=>Q(this,void 0,void 0,function*(){var l,c,h;const p=zi.getInstance().previousDevices,v=yield zi.getInstance().getDevices(void 0,!1),b=ws();if((b==null?void 0:b.name)==="Chrome"&&b.os!=="iOS")for(let T of v){const E=p.find(R=>R.deviceId===T.deviceId);E&&E.label!==""&&E.kind===T.kind&&E.label!==T.label&&this.getActiveDevice(T.kind)==="default"&&this.emit(Ee.ActiveDeviceChanged,T.kind,T.deviceId)}const k=["audiooutput","audioinput","videoinput"];for(let T of k){const E=kV(T),R=this.localParticipant.getTrackPublication(E);if(R&&(!((l=R.track)===null||l===void 0)&&l.isUserProvided))continue;const M=v.filter(U=>U.kind===T),A=this.getActiveDevice(T);if(A===((c=p.filter(U=>U.kind===T)[0])===null||c===void 0?void 0:c.deviceId)&&M.length>0&&((h=M[0])===null||h===void 0?void 0:h.deviceId)!==A){yield this.switchActiveDevice(T,M[0].deviceId);continue}T==="audioinput"&&!yc()||T==="videoinput"||M.length>0&&!M.find(U=>U.deviceId===this.getActiveDevice(T))&&(yield this.switchActiveDevice(T,M[0].deviceId))}this.emit(Ee.MediaDevicesChanged)}),this.handleRoomUpdate=l=>{const c=this.roomInfo;this.roomInfo=l,c&&c.metadata!==l.metadata&&this.emitWhenConnected(Ee.RoomMetadataChanged,l.metadata),(c==null?void 0:c.activeRecording)!==l.activeRecording&&this.emitWhenConnected(Ee.RecordingStatusChanged,l.activeRecording)},this.handleConnectionQualityUpdate=l=>{l.updates.forEach(c=>{if(c.participantSid===this.localParticipant.sid){this.localParticipant.setConnectionQuality(c.quality);return}const h=this.getRemoteParticipantBySid(c.participantSid);h&&h.setConnectionQuality(c.quality)})},this.onLocalParticipantMetadataChanged=l=>{this.emit(Ee.ParticipantMetadataChanged,l,this.localParticipant)},this.onLocalParticipantNameChanged=l=>{this.emit(Ee.ParticipantNameChanged,l,this.localParticipant)},this.onLocalAttributesChanged=l=>{this.emit(Ee.ParticipantAttributesChanged,l,this.localParticipant)},this.onLocalTrackMuted=l=>{this.emit(Ee.TrackMuted,l,this.localParticipant)},this.onLocalTrackUnmuted=l=>{this.emit(Ee.TrackUnmuted,l,this.localParticipant)},this.onTrackProcessorUpdate=l=>{var c;(c=l==null?void 0:l.onPublish)===null||c===void 0||c.call(l,this)},this.onLocalTrackPublished=l=>Q(this,void 0,void 0,function*(){var c,h,p,v,b,k;(c=l.track)===null||c===void 0||c.on(Qe.TrackProcessorUpdate,this.onTrackProcessorUpdate),(h=l.track)===null||h===void 0||h.on(Qe.Restarted,this.onLocalTrackRestarted),(b=(v=(p=l.track)===null||p===void 0?void 0:p.getProcessor())===null||v===void 0?void 0:v.onPublish)===null||b===void 0||b.call(v,this),this.emit(Ee.LocalTrackPublished,l,this.localParticipant),Qd(l.track)&&(yield l.track.checkForSilence())&&this.emit(Ee.LocalAudioSilenceDetected,l);const T=yield(k=l.track)===null||k===void 0?void 0:k.getDeviceId(!1),E=yO(l.source);E&&T&&T!==this.localParticipant.activeDeviceMap.get(E)&&(this.localParticipant.activeDeviceMap.set(E,T),this.emit(Ee.ActiveDeviceChanged,E,T))}),this.onLocalTrackUnpublished=l=>{var c,h;(c=l.track)===null||c===void 0||c.off(Qe.TrackProcessorUpdate,this.onTrackProcessorUpdate),(h=l.track)===null||h===void 0||h.off(Qe.Restarted,this.onLocalTrackRestarted),this.emit(Ee.LocalTrackUnpublished,l,this.localParticipant)},this.onLocalTrackRestarted=l=>Q(this,void 0,void 0,function*(){const c=yield l.getDeviceId(!1),h=yO(l.source);h&&c&&c!==this.localParticipant.activeDeviceMap.get(h)&&(this.log.debug("local track restarted, setting ".concat(h," ").concat(c," active"),this.logContext),this.localParticipant.activeDeviceMap.set(h,c),this.emit(Ee.ActiveDeviceChanged,h,c))}),this.onLocalConnectionQualityChanged=l=>{this.emit(Ee.ConnectionQualityChanged,l,this.localParticipant)},this.onMediaDevicesError=l=>{this.emit(Ee.MediaDevicesError,l)},this.onLocalParticipantPermissionsChanged=l=>{this.emit(Ee.ParticipantPermissionsChanged,l,this.localParticipant)},this.onLocalChatMessageSent=l=>{this.emit(Ee.ChatMessage,l,this.localParticipant)},this.setMaxListeners(100),this.remoteParticipants=new Map,this.sidToIdentity=new Map,this.options=Object.assign(Object.assign({},HV),e),this.log=lu((r=this.options.loggerName)!==null&&r!==void 0?r:xs.Room),this.transcriptionReceivedTimes=new Map,this.options.audioCaptureDefaults=Object.assign(Object.assign({},PO),e==null?void 0:e.audioCaptureDefaults),this.options.videoCaptureDefaults=Object.assign(Object.assign({},DO),e==null?void 0:e.videoCaptureDefaults),this.options.publishDefaults=Object.assign(Object.assign({},BV),e==null?void 0:e.publishDefaults),this.maybeCreateEngine(),this.disconnectLock=new to,this.localParticipant=new hb("","",this.engine,this.options,this.rpcHandlers),this.options.videoCaptureDefaults.deviceId&&this.localParticipant.activeDeviceMap.set("videoinput",Sc(this.options.videoCaptureDefaults.deviceId)),this.options.audioCaptureDefaults.deviceId&&this.localParticipant.activeDeviceMap.set("audioinput",Sc(this.options.audioCaptureDefaults.deviceId)),!((a=this.options.audioOutput)===null||a===void 0)&&a.deviceId&&this.switchActiveDevice("audiooutput",Sc(this.options.audioOutput.deviceId)).catch(l=>this.log.warn("Could not set audio output: ".concat(l.message),this.logContext)),this.options.e2ee&&this.setupE2EE(),ao()){const l=new AbortController;(s=navigator.mediaDevices)===null||s===void 0||s.addEventListener("devicechange",this.handleDeviceChange,{signal:l.signal}),Gh.cleanupRegistry&&Gh.cleanupRegistry.register(this,()=>{l.abort()})}}registerTextStreamHandler(e,n){if(this.textStreamHandlers.has(e))throw new TypeError('A text stream handler for topic "'.concat(e,'" has already been set.'));this.textStreamHandlers.set(e,n)}unregisterTextStreamHandler(e){this.textStreamHandlers.delete(e)}registerByteStreamHandler(e,n){if(this.byteStreamHandlers.has(e))throw new TypeError('A byte stream handler for topic "'.concat(e,'" has already been set.'));this.byteStreamHandlers.set(e,n)}unregisterByteStreamHandler(e){this.byteStreamHandlers.delete(e)}registerRpcMethod(e,n){if(this.rpcHandlers.has(e))throw Error("RPC handler already registered for method ".concat(e,", unregisterRpcMethod before trying to register again"));this.rpcHandlers.set(e,n)}unregisterRpcMethod(e){this.rpcHandlers.delete(e)}handleIncomingRpcRequest(e,n,r,a,s,l){return Q(this,void 0,void 0,function*(){if(yield this.engine.publishRpcAck(e,n),l!==1){yield this.engine.publishRpcResponse(e,n,null,ei.builtIn("UNSUPPORTED_VERSION"));return}const c=this.rpcHandlers.get(r);if(!c){yield this.engine.publishRpcResponse(e,n,null,ei.builtIn("UNSUPPORTED_METHOD"));return}let h=null,p=null;try{const v=yield c({requestId:n,callerIdentity:e,payload:a,responseTimeout:s});AT(v)>AO?(h=ei.builtIn("RESPONSE_PAYLOAD_TOO_LARGE"),console.warn("RPC Response payload too large for ".concat(r))):p=v}catch(v){v instanceof ei?h=v:(console.warn("Uncaught error returned by RPC handler for ".concat(r,". Returning APPLICATION_ERROR instead."),v),h=ei.builtIn("APPLICATION_ERROR"))}yield this.engine.publishRpcResponse(e,n,p,h)})}setE2EEEnabled(e){return Q(this,void 0,void 0,function*(){if(this.e2eeManager)yield Promise.all([this.localParticipant.setE2EEEnabled(e)]),this.localParticipant.identity!==""&&this.e2eeManager.setParticipantCryptorEnabled(e,this.localParticipant.identity);else throw Error("e2ee not configured, please set e2ee settings within the room options")})}setupE2EE(){var e;this.options.e2ee&&("e2eeManager"in this.options.e2ee?this.e2eeManager=this.options.e2ee.e2eeManager:this.e2eeManager=new RV(this.options.e2ee),this.e2eeManager.on(gc.ParticipantEncryptionStatusChanged,(n,r)=>{SV(r)&&(this.isE2EEEnabled=n),this.emit(Ee.ParticipantEncryptionStatusChanged,n,r)}),this.e2eeManager.on(gc.EncryptionError,n=>this.emit(Ee.EncryptionError,n)),(e=this.e2eeManager)===null||e===void 0||e.setup(this))}get logContext(){var e;return{room:this.name,roomID:(e=this.roomInfo)===null||e===void 0?void 0:e.sid,participant:this.localParticipant.identity,pID:this.localParticipant.sid}}get isRecording(){var e,n;return(n=(e=this.roomInfo)===null||e===void 0?void 0:e.activeRecording)!==null&&n!==void 0?n:!1}getSid(){return Q(this,void 0,void 0,function*(){return this.state===Fn.Disconnected?"":this.roomInfo&&this.roomInfo.sid!==""?this.roomInfo.sid:new Promise((e,n)=>{const r=a=>{a.sid!==""&&(this.engine.off(tt.RoomUpdate,r),e(a.sid))};this.engine.on(tt.RoomUpdate,r),this.once(Ee.Disconnected,()=>{this.engine.off(tt.RoomUpdate,r),n("Room disconnected before room server id was available")})})})}get name(){var e,n;return(n=(e=this.roomInfo)===null||e===void 0?void 0:e.name)!==null&&n!==void 0?n:""}get metadata(){var e;return(e=this.roomInfo)===null||e===void 0?void 0:e.metadata}get numParticipants(){var e,n;return(n=(e=this.roomInfo)===null||e===void 0?void 0:e.numParticipants)!==null&&n!==void 0?n:0}get numPublishers(){var e,n;return(n=(e=this.roomInfo)===null||e===void 0?void 0:e.numPublishers)!==null&&n!==void 0?n:0}maybeCreateEngine(){this.engine&&!this.engine.isClosed||(this.engine=new az(this.options),this.engine.on(tt.ParticipantUpdate,this.handleParticipantUpdates).on(tt.RoomUpdate,this.handleRoomUpdate).on(tt.SpeakersChanged,this.handleSpeakersChanged).on(tt.StreamStateChanged,this.handleStreamStateUpdate).on(tt.ConnectionQualityUpdate,this.handleConnectionQualityUpdate).on(tt.SubscriptionError,this.handleSubscriptionError).on(tt.SubscriptionPermissionUpdate,this.handleSubscriptionPermissionUpdate).on(tt.MediaTrackAdded,(e,n,r)=>{this.onTrackAdded(e,n,r)}).on(tt.Disconnected,e=>{this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,e)}).on(tt.ActiveSpeakersUpdate,this.handleActiveSpeakersUpdate).on(tt.DataPacketReceived,this.handleDataPacket).on(tt.Resuming,()=>{this.clearConnectionReconcile(),this.isResuming=!0,this.log.info("Resuming signal connection",this.logContext),this.setAndEmitConnectionState(Fn.SignalReconnecting)&&this.emit(Ee.SignalReconnecting)}).on(tt.Resumed,()=>{this.registerConnectionReconcile(),this.isResuming=!1,this.log.info("Resumed signal connection",this.logContext),this.updateSubscriptions(),this.emitBufferedEvents(),this.setAndEmitConnectionState(Fn.Connected)&&this.emit(Ee.Reconnected)}).on(tt.SignalResumed,()=>{this.bufferedEvents=[],(this.state===Fn.Reconnecting||this.isResuming)&&this.sendSyncState()}).on(tt.Restarting,this.handleRestarting).on(tt.SignalRestarted,this.handleSignalRestarted).on(tt.Offline,()=>{this.setAndEmitConnectionState(Fn.Reconnecting)&&this.emit(Ee.Reconnecting)}).on(tt.DCBufferStatusChanged,(e,n)=>{this.emit(Ee.DCBufferStatusChanged,e,n)}).on(tt.LocalTrackSubscribed,e=>{const n=this.localParticipant.getTrackPublications().find(r=>{let{trackSid:a}=r;return a===e});if(!n){this.log.warn("could not find local track subscription for subscribed event",this.logContext);return}this.localParticipant.emit(Ie.LocalTrackSubscribed,n),this.emitWhenConnected(Ee.LocalTrackSubscribed,n,this.localParticipant)}),this.localParticipant&&this.localParticipant.setupEngine(this.engine),this.e2eeManager&&this.e2eeManager.setupEngine(this.engine))}static getLocalDevices(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return zi.getInstance().getDevices(e,n)}prepareConnection(e,n){return Q(this,void 0,void 0,function*(){if(this.state===Fn.Disconnected){this.log.debug("prepareConnection to ".concat(e),this.logContext);try{if(hT(new URL(e))&&n){this.regionUrlProvider=new UT(e,n);const r=yield this.regionUrlProvider.getNextBestRegionUrl();r&&this.state===Fn.Disconnected&&(this.regionUrl=r,yield fetch(vT(r),{method:"HEAD"}),this.log.debug("prepared connection to ".concat(r),this.logContext))}else yield fetch(vT(e),{method:"HEAD"})}catch(r){this.log.warn("could not prepare connection",Object.assign(Object.assign({},this.logContext),{error:r}))}}})}getParticipantByIdentity(e){return this.localParticipant.identity===e?this.localParticipant:this.remoteParticipants.get(e)}clearConnectionFutures(){this.connectFuture=void 0}simulateScenario(e,n){return Q(this,void 0,void 0,function*(){let r=()=>{},a;switch(e){case"signal-reconnect":yield this.engine.client.handleOnClose("simulate disconnect");break;case"speaker":a=new cl({scenario:{case:"speakerUpdate",value:3}});break;case"node-failure":a=new cl({scenario:{case:"nodeFailure",value:!0}});break;case"server-leave":a=new cl({scenario:{case:"serverLeave",value:!0}});break;case"migration":a=new cl({scenario:{case:"migration",value:!0}});break;case"resume-reconnect":this.engine.failNext(),yield this.engine.client.handleOnClose("simulate resume-disconnect");break;case"disconnect-signal-on-resume":r=()=>Q(this,void 0,void 0,function*(){yield this.engine.client.handleOnClose("simulate resume-disconnect")}),a=new cl({scenario:{case:"disconnectSignalOnResume",value:!0}});break;case"disconnect-signal-on-resume-no-messages":r=()=>Q(this,void 0,void 0,function*(){yield this.engine.client.handleOnClose("simulate resume-disconnect")}),a=new cl({scenario:{case:"disconnectSignalOnResumeNoMessages",value:!0}});break;case"full-reconnect":this.engine.fullReconnectOnNext=!0,yield this.engine.client.handleOnClose("simulate full-reconnect");break;case"force-tcp":case"force-tls":a=new cl({scenario:{case:"switchCandidateProtocol",value:e==="force-tls"?2:1}}),r=()=>Q(this,void 0,void 0,function*(){const s=this.engine.client.onLeave;s&&s(new W0({reason:ks.CLIENT_INITIATED,action:Fh.RECONNECT}))});break;case"subscriber-bandwidth":if(n===void 0||typeof n!="number")throw new Error("subscriber-bandwidth requires a number as argument");a=new cl({scenario:{case:"subscriberBandwidth",value:Zd(n)}});break;case"leave-full-reconnect":a=new cl({scenario:{case:"leaveRequestFullReconnect",value:!0}})}a&&(yield this.engine.client.sendSimulateScenario(a),yield r())})}get canPlaybackAudio(){return this.audioEnabled}get canPlaybackVideo(){return!this.isVideoPlaybackBlocked}getActiveDevice(e){return this.localParticipant.activeDeviceMap.get(e)}switchActiveDevice(e,n){return Q(this,arguments,void 0,function(r,a){var s=this;let l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return function*(){var c,h,p,v,b,k,T,E;let R=!0,M=!1;const A=l?{exact:a}:a;if(r==="audioinput"){M=s.localParticipant.audioTrackPublications.size===0;const U=(c=s.getActiveDevice(r))!==null&&c!==void 0?c:s.options.audioCaptureDefaults.deviceId;s.options.audioCaptureDefaults.deviceId=A;const V=Array.from(s.localParticipant.audioTrackPublications.values()).filter(j=>j.source===De.Source.Microphone);try{R=(yield Promise.all(V.map(j=>{var I;return(I=j.audioTrack)===null||I===void 0?void 0:I.setDeviceId(A)}))).every(j=>j===!0)}catch(j){throw s.options.audioCaptureDefaults.deviceId=U,j}}else if(r==="videoinput"){M=s.localParticipant.videoTrackPublications.size===0;const U=(h=s.getActiveDevice(r))!==null&&h!==void 0?h:s.options.videoCaptureDefaults.deviceId;s.options.videoCaptureDefaults.deviceId=A;const V=Array.from(s.localParticipant.videoTrackPublications.values()).filter(j=>j.source===De.Source.Camera);try{R=(yield Promise.all(V.map(j=>{var I;return(I=j.videoTrack)===null||I===void 0?void 0:I.setDeviceId(A)}))).every(j=>j===!0)}catch(j){throw s.options.videoCaptureDefaults.deviceId=U,j}}else if(r==="audiooutput"){if(!fT()&&!s.options.webAudioMix||s.options.webAudioMix&&s.audioContext&&!("setSinkId"in s.audioContext))throw new Error("cannot switch audio output, setSinkId not supported");s.options.webAudioMix&&(a=(p=yield zi.getInstance().normalizeDeviceId("audiooutput",a))!==null&&p!==void 0?p:""),(v=(E=s.options).audioOutput)!==null&&v!==void 0||(E.audioOutput={});const U=(b=s.getActiveDevice(r))!==null&&b!==void 0?b:s.options.audioOutput.deviceId;s.options.audioOutput.deviceId=a;try{s.options.webAudioMix&&((k=s.audioContext)===null||k===void 0||k.setSinkId(a)),yield Promise.all(Array.from(s.remoteParticipants.values()).map(V=>V.setAudioOutput({deviceId:a})))}catch(V){throw s.options.audioOutput.deviceId=U,V}}return(M||r==="audiooutput")&&(s.localParticipant.activeDeviceMap.set(r,r==="audiooutput"&&((T=s.options.audioOutput)===null||T===void 0?void 0:T.deviceId)||a),s.emit(Ee.ActiveDeviceChanged,r,a)),R}()})}setupLocalParticipantEvents(){this.localParticipant.on(Ie.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).on(Ie.ParticipantNameChanged,this.onLocalParticipantNameChanged).on(Ie.AttributesChanged,this.onLocalAttributesChanged).on(Ie.TrackMuted,this.onLocalTrackMuted).on(Ie.TrackUnmuted,this.onLocalTrackUnmuted).on(Ie.LocalTrackPublished,this.onLocalTrackPublished).on(Ie.LocalTrackUnpublished,this.onLocalTrackUnpublished).on(Ie.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).on(Ie.MediaDevicesError,this.onMediaDevicesError).on(Ie.AudioStreamAcquired,this.startAudio).on(Ie.ChatMessage,this.onLocalChatMessageSent).on(Ie.ParticipantPermissionsChanged,this.onLocalParticipantPermissionsChanged)}recreateEngine(){var e;(e=this.engine)===null||e===void 0||e.close(),this.engine=void 0,this.isResuming=!1,this.remoteParticipants.clear(),this.sidToIdentity.clear(),this.bufferedEvents=[],this.maybeCreateEngine()}onTrackAdded(e,n,r){if(this.state===Fn.Connecting||this.state===Fn.Reconnecting){const v=()=>{this.onTrackAdded(e,n,r),b()},b=()=>{this.off(Ee.Reconnected,v),this.off(Ee.Connected,v),this.off(Ee.Disconnected,b)};this.once(Ee.Reconnected,v),this.once(Ee.Connected,v),this.once(Ee.Disconnected,b);return}if(this.state===Fn.Disconnected){this.log.warn("skipping incoming track after Room disconnected",this.logContext);return}if(e.readyState==="ended"){this.log.info("skipping incoming track as it already ended",this.logContext);return}const a=oV(n.id),s=a[0];let l=a[1],c=e.id;if(l&&l.startsWith("TR")&&(c=l),s===this.localParticipant.sid){this.log.warn("tried to create RemoteParticipant for local participant",this.logContext);return}const h=Array.from(this.remoteParticipants.values()).find(v=>v.sid===s);if(!h){this.log.error("Tried to add a track for a participant, that's not present. Sid: ".concat(s),this.logContext);return}let p;this.options.adaptiveStream&&(typeof this.options.adaptiveStream=="object"?p=this.options.adaptiveStream:p={}),h.addSubscribedMediaTrack(e,c,n,r,p)}handleDisconnect(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,n=arguments.length>1?arguments[1]:void 0;var r;if(this.clearConnectionReconcile(),this.isResuming=!1,this.bufferedEvents=[],this.transcriptionReceivedTimes.clear(),this.state!==Fn.Disconnected){this.regionUrl=void 0;try{this.remoteParticipants.forEach(a=>{a.trackPublications.forEach(s=>{a.unpublishTrack(s.trackSid)})}),this.localParticipant.trackPublications.forEach(a=>{var s,l,c;a.track&&this.localParticipant.unpublishTrack(a.track,e),e?((s=a.track)===null||s===void 0||s.detach(),(l=a.track)===null||l===void 0||l.stop()):(c=a.track)===null||c===void 0||c.stopMonitor()}),this.localParticipant.off(Ie.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).off(Ie.ParticipantNameChanged,this.onLocalParticipantNameChanged).off(Ie.AttributesChanged,this.onLocalAttributesChanged).off(Ie.TrackMuted,this.onLocalTrackMuted).off(Ie.TrackUnmuted,this.onLocalTrackUnmuted).off(Ie.LocalTrackPublished,this.onLocalTrackPublished).off(Ie.LocalTrackUnpublished,this.onLocalTrackUnpublished).off(Ie.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).off(Ie.MediaDevicesError,this.onMediaDevicesError).off(Ie.AudioStreamAcquired,this.startAudio).off(Ie.ChatMessage,this.onLocalChatMessageSent).off(Ie.ParticipantPermissionsChanged,this.onLocalParticipantPermissionsChanged),this.localParticipant.trackPublications.clear(),this.localParticipant.videoTrackPublications.clear(),this.localParticipant.audioTrackPublications.clear(),this.remoteParticipants.clear(),this.sidToIdentity.clear(),this.activeSpeakers=[],this.audioContext&&typeof this.options.webAudioMix=="boolean"&&(this.audioContext.close(),this.audioContext=void 0),ao()&&(window.removeEventListener("beforeunload",this.onPageLeave),window.removeEventListener("pagehide",this.onPageLeave),window.removeEventListener("freeze",this.onPageLeave),(r=navigator.mediaDevices)===null||r===void 0||r.removeEventListener("devicechange",this.handleDeviceChange))}finally{this.setAndEmitConnectionState(Fn.Disconnected),this.emit(Ee.Disconnected,n)}}}handleParticipantDisconnected(e,n){var r;this.remoteParticipants.delete(e),n&&(n.trackPublications.forEach(a=>{n.unpublishTrack(a.trackSid,!0)}),this.emit(Ee.ParticipantDisconnected,n),(r=this.localParticipant)===null||r===void 0||r.handleParticipantDisconnected(n.identity))}handleStreamHeader(e,n){return Q(this,void 0,void 0,function*(){var r;if(e.contentHeader.case==="byteHeader"){const a=this.byteStreamHandlers.get(e.topic);if(!a){this.log.debug("ignoring incoming byte stream due to no handler for topic",e.topic);return}let s;const l={id:e.streamId,name:(r=e.contentHeader.value.name)!==null&&r!==void 0?r:"unknown",mimeType:e.mimeType,size:e.totalLength?Number(e.totalLength):void 0,topic:e.topic,timestamp:ab(e.timestamp),attributes:e.attributes},c=new ReadableStream({start:h=>{s=h,this.byteStreamControllers.set(e.streamId,{info:l,controller:s,startTime:Date.now()})}});a(new uz(l,c,ab(e.totalLength)),{identity:n})}else if(e.contentHeader.case==="textHeader"){const a=this.textStreamHandlers.get(e.topic);if(!a){this.log.debug("ignoring incoming text stream due to no handler for topic",e.topic);return}let s;const l={id:e.streamId,mimeType:e.mimeType,size:e.totalLength?Number(e.totalLength):void 0,topic:e.topic,timestamp:Number(e.timestamp),attributes:e.attributes},c=new ReadableStream({start:h=>{s=h,this.textStreamControllers.set(e.streamId,{info:l,controller:s,startTime:Date.now()})}});a(new cz(l,c,ab(e.totalLength)),{identity:n})}})}handleStreamChunk(e){const n=this.byteStreamControllers.get(e.streamId);n&&e.content.length>0&&n.controller.enqueue(e);const r=this.textStreamControllers.get(e.streamId);r&&e.content.length>0&&r.controller.enqueue(e)}handleStreamTrailer(e){const n=this.textStreamControllers.get(e.streamId);n&&(n.info.attributes=Object.assign(Object.assign({},n.info.attributes),e.attributes),n.controller.close(),this.textStreamControllers.delete(e.streamId));const r=this.byteStreamControllers.get(e.streamId);r&&(r.info.attributes=Object.assign(Object.assign({},r.info.attributes),e.attributes),r.controller.close(),this.byteStreamControllers.delete(e.streamId))}acquireAudioContext(){return Q(this,void 0,void 0,function*(){var e,n;if(typeof this.options.webAudioMix!="boolean"&&this.options.webAudioMix.audioContext?this.audioContext=this.options.webAudioMix.audioContext:(!this.audioContext||this.audioContext.state==="closed")&&(this.audioContext=(e=vO())!==null&&e!==void 0?e:void 0),this.options.webAudioMix&&this.remoteParticipants.forEach(a=>a.setAudioContext(this.audioContext)),this.localParticipant.setAudioContext(this.audioContext),this.audioContext&&this.audioContext.state==="suspended")try{yield Promise.race([this.audioContext.resume(),io(200)])}catch(a){this.log.warn("Could not resume audio context",Object.assign(Object.assign({},this.logContext),{error:a}))}const r=((n=this.audioContext)===null||n===void 0?void 0:n.state)==="running";r!==this.canPlaybackAudio&&(this.audioEnabled=r,this.emit(Ee.AudioPlaybackStatusChanged,r))})}createParticipant(e,n){var r;let a;return n?a=pb.fromParticipantInfo(this.engine.client,n,{loggerContextCb:()=>this.logContext,loggerName:this.options.loggerName}):a=new pb(this.engine.client,"",e,void 0,void 0,void 0,{loggerContextCb:()=>this.logContext,loggerName:this.options.loggerName}),this.options.webAudioMix&&a.setAudioContext(this.audioContext),!((r=this.options.audioOutput)===null||r===void 0)&&r.deviceId&&a.setAudioOutput(this.options.audioOutput).catch(s=>this.log.warn("Could not set audio output: ".concat(s.message),this.logContext)),a}getOrCreateParticipant(e,n){if(this.remoteParticipants.has(e)){const a=this.remoteParticipants.get(e);return n&&a.updateInfo(n)&&this.sidToIdentity.set(n.sid,n.identity),a}const r=this.createParticipant(e,n);return this.remoteParticipants.set(e,r),this.sidToIdentity.set(n.sid,n.identity),this.emitWhenConnected(Ee.ParticipantConnected,r),r.on(Ie.TrackPublished,a=>{this.emitWhenConnected(Ee.TrackPublished,a,r)}).on(Ie.TrackSubscribed,(a,s)=>{a.kind===De.Kind.Audio?(a.on(Qe.AudioPlaybackStarted,this.handleAudioPlaybackStarted),a.on(Qe.AudioPlaybackFailed,this.handleAudioPlaybackFailed)):a.kind===De.Kind.Video&&(a.on(Qe.VideoPlaybackFailed,this.handleVideoPlaybackFailed),a.on(Qe.VideoPlaybackStarted,this.handleVideoPlaybackStarted)),this.emit(Ee.TrackSubscribed,a,s,r)}).on(Ie.TrackUnpublished,a=>{this.emit(Ee.TrackUnpublished,a,r)}).on(Ie.TrackUnsubscribed,(a,s)=>{this.emit(Ee.TrackUnsubscribed,a,s,r)}).on(Ie.TrackMuted,a=>{this.emitWhenConnected(Ee.TrackMuted,a,r)}).on(Ie.TrackUnmuted,a=>{this.emitWhenConnected(Ee.TrackUnmuted,a,r)}).on(Ie.ParticipantMetadataChanged,a=>{this.emitWhenConnected(Ee.ParticipantMetadataChanged,a,r)}).on(Ie.ParticipantNameChanged,a=>{this.emitWhenConnected(Ee.ParticipantNameChanged,a,r)}).on(Ie.AttributesChanged,a=>{this.emitWhenConnected(Ee.ParticipantAttributesChanged,a,r)}).on(Ie.ConnectionQualityChanged,a=>{this.emitWhenConnected(Ee.ConnectionQualityChanged,a,r)}).on(Ie.ParticipantPermissionsChanged,a=>{this.emitWhenConnected(Ee.ParticipantPermissionsChanged,a,r)}).on(Ie.TrackSubscriptionStatusChanged,(a,s)=>{this.emitWhenConnected(Ee.TrackSubscriptionStatusChanged,a,s,r)}).on(Ie.TrackSubscriptionFailed,(a,s)=>{this.emit(Ee.TrackSubscriptionFailed,a,r,s)}).on(Ie.TrackSubscriptionPermissionChanged,(a,s)=>{this.emitWhenConnected(Ee.TrackSubscriptionPermissionChanged,a,s,r)}),n&&r.updateInfo(n),r}sendSyncState(){const e=Array.from(this.remoteParticipants.values()).reduce((r,a)=>(r.push(...a.getTrackPublications()),r),[]),n=this.localParticipant.getTrackPublications();this.engine.sendSyncState(e,n)}updateSubscriptions(){for(const e of this.remoteParticipants.values())for(const n of e.videoTrackPublications.values())n.isSubscribed&&bV(n)&&n.emitTrackUpdate()}getRemoteParticipantBySid(e){const n=this.sidToIdentity.get(e);if(n)return this.remoteParticipants.get(n)}registerConnectionReconcile(){this.clearConnectionReconcile();let e=0;this.connectionReconcileInterval=Qi.setInterval(()=>{!this.engine||this.engine.isClosed||!this.engine.verifyTransport()?(e++,this.log.warn("detected connection state mismatch",Object.assign(Object.assign({},this.logContext),{numFailures:e,engine:this.engine?{closed:this.engine.isClosed,transportsConnected:this.engine.verifyTransport()}:void 0})),e>=3&&(this.recreateEngine(),this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,ks.STATE_MISMATCH))):e=0},bz)}clearConnectionReconcile(){this.connectionReconcileInterval&&Qi.clearInterval(this.connectionReconcileInterval)}setAndEmitConnectionState(e){return e===this.state?!1:(this.state=e,this.emit(Ee.ConnectionStateChanged,this.state),!0)}emitBufferedEvents(){this.bufferedEvents.forEach(e=>{let[n,r]=e;this.emit(n,...r)}),this.bufferedEvents=[]}emitWhenConnected(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];if(this.state===Fn.Reconnecting||this.isResuming||!this.engine||this.engine.pendingReconnect)this.bufferedEvents.push([e,r]);else if(this.state===Fn.Connected)return this.emit(e,...r);return!1}simulateParticipants(e){return Q(this,void 0,void 0,function*(){var n,r;const a=Object.assign({audio:!0,video:!0,useRealTracks:!1},e.publish),s=Object.assign({count:9,audio:!1,video:!0,aspectRatios:[1.66,1.7,1.3]},e.participants);if(this.handleDisconnect(),this.roomInfo=new A1({sid:"RM_SIMULATED",name:"simulated-room",emptyTimeout:0,maxParticipants:0,creationTime:Ur.parse(new Date().getTime()),metadata:"",numParticipants:1,numPublishers:1,turnPassword:"",enabledCodecs:[],activeRecording:!1}),this.localParticipant.updateInfo(new wg({identity:"simulated-local",name:"local-name"})),this.setupLocalParticipantEvents(),this.emit(Ee.SignalConnected),this.emit(Ee.Connected),this.setAndEmitConnectionState(Fn.Connected),a.video){const l=new VT(De.Kind.Video,new Uh({source:gi.CAMERA,sid:Math.floor(Math.random()*1e4).toString(),type:Cs.AUDIO,name:"video-dummy"}),new db(a.useRealTracks?(yield window.navigator.mediaDevices.getUserMedia({video:!0})).getVideoTracks()[0]:fO(160*((n=s.aspectRatios[0])!==null&&n!==void 0?n:1),160,!0,!0),void 0,!1,{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext}),{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext});this.localParticipant.addTrackPublication(l),this.localParticipant.emit(Ie.LocalTrackPublished,l)}if(a.audio){const l=new VT(De.Kind.Audio,new Uh({source:gi.MICROPHONE,sid:Math.floor(Math.random()*1e4).toString(),type:Cs.AUDIO}),new ub(a.useRealTracks?(yield navigator.mediaDevices.getUserMedia({audio:!0})).getAudioTracks()[0]:gT(),void 0,!1,this.audioContext,{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext}),{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext});this.localParticipant.addTrackPublication(l),this.localParticipant.emit(Ie.LocalTrackPublished,l)}for(let l=0;l<s.count-1;l+=1){let c=new wg({sid:Math.floor(Math.random()*1e4).toString(),identity:"simulated-".concat(l),state:O1.ACTIVE,tracks:[],joinedAt:Ur.parse(Date.now())});const h=this.getOrCreateParticipant(c.identity,c);if(s.video){const p=fO(160*((r=s.aspectRatios[l%s.aspectRatios.length])!==null&&r!==void 0?r:1),160,!1,!0),v=new Uh({source:gi.CAMERA,sid:Math.floor(Math.random()*1e4).toString(),type:Cs.AUDIO});h.addSubscribedMediaTrack(p,v.sid,new MediaStream([p]),new RTCRtpReceiver),c.tracks=[...c.tracks,v]}if(s.audio){const p=gT(),v=new Uh({source:gi.MICROPHONE,sid:Math.floor(Math.random()*1e4).toString(),type:Cs.AUDIO});h.addSubscribedMediaTrack(p,v.sid,new MediaStream([p]),new RTCRtpReceiver),c.tracks=[...c.tracks,v]}h.updateInfo(c)}})}emit(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];if(e!==Ee.ActiveSpeakersChanged&&e!==Ee.TranscriptionReceived){const s=YO(r).filter(l=>l!==void 0);this.log.debug("room event ".concat(e),Object.assign(Object.assign({},this.logContext),{event:e,args:s}))}return super.emit(e,...r)}}Gh.cleanupRegistry=typeof FinalizationRegistry<"u"&&new FinalizationRegistry(t=>{t()});function YO(t){return t.map(e=>{if(e)return Array.isArray(e)?YO(e):typeof e=="object"?"logContext"in e?e.logContext:void 0:e})}var Rs;(function(t){t[t.IDLE=0]="IDLE",t[t.RUNNING=1]="RUNNING",t[t.SKIPPED=2]="SKIPPED",t[t.SUCCESS=3]="SUCCESS",t[t.FAILED=4]="FAILED"})(Rs||(Rs={}));class xc extends dl.EventEmitter{constructor(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};super(),this.status=Rs.IDLE,this.logs=[],this.options={},this.url=e,this.token=n,this.name=this.constructor.name,this.room=new Gh(r.roomOptions),this.connectOptions=r.connectOptions,this.options=r}run(e){return Q(this,void 0,void 0,function*(){if(this.status!==Rs.IDLE)throw Error("check is running already");this.setStatus(Rs.RUNNING);try{yield this.perform()}catch(n){n instanceof Error&&(this.options.errorsAsWarnings?this.appendWarning(n.message):this.appendError(n.message))}return yield this.disconnect(),yield new Promise(n=>setTimeout(n,500)),this.status!==Rs.SKIPPED&&this.setStatus(this.isSuccess()?Rs.SUCCESS:Rs.FAILED),e&&e(),this.getInfo()})}isSuccess(){return!this.logs.some(e=>e.level==="error")}connect(e){return Q(this,void 0,void 0,function*(){return this.room.state===Fn.Connected?this.room:(e||(e=this.url),yield this.room.connect(e,this.token,this.connectOptions),this.room)})}disconnect(){return Q(this,void 0,void 0,function*(){this.room&&this.room.state!==Fn.Disconnected&&(yield this.room.disconnect(),yield new Promise(e=>setTimeout(e,500)))})}skip(){this.setStatus(Rs.SKIPPED)}switchProtocol(e){return Q(this,void 0,void 0,function*(){let n=!1,r=!1;if(this.room.on(Ee.Reconnecting,()=>{n=!0}),this.room.once(Ee.Reconnected,()=>{r=!0}),this.room.simulateScenario("force-".concat(e)),yield new Promise(s=>setTimeout(s,1e3)),!n)return;const a=Date.now()+1e4;for(;Date.now()<a;){if(r)return;yield io(100)}throw new Error("Could not reconnect using ".concat(e," protocol after 10 seconds"))})}appendMessage(e){this.logs.push({level:"info",message:e}),this.emit("update",this.getInfo())}appendWarning(e){this.logs.push({level:"warning",message:e}),this.emit("update",this.getInfo())}appendError(e){this.logs.push({level:"error",message:e}),this.emit("update",this.getInfo())}setStatus(e){this.status=e,this.emit("update",this.getInfo())}get engine(){var e;return(e=this.room)===null||e===void 0?void 0:e.engine}getInfo(){return{logs:this.logs,name:this.name,status:this.status,description:this.description}}}class Sz extends xc{get description(){return"Cloud regions"}perform(){return Q(this,void 0,void 0,function*(){const e=new UT(this.url,this.token);if(!e.isCloud()){this.skip();return}const n=[],r=new Set;for(let s=0;s<3;s++){const l=yield e.getNextBestRegionUrl();if(!l)break;if(r.has(l))continue;r.add(l);const c=yield this.checkCloudRegion(l);this.appendMessage("".concat(c.region," RTT: ").concat(c.rtt,"ms, duration: ").concat(c.duration,"ms")),n.push(c)}n.sort((s,l)=>(s.duration-l.duration)*.5+(s.rtt-l.rtt)*.5);const a=n[0];this.bestStats=a,this.appendMessage("best Cloud region: ".concat(a.region))})}getInfo(){const e=super.getInfo();return e.data=this.bestStats,e}checkCloudRegion(e){return Q(this,void 0,void 0,function*(){var n,r;yield this.connect(e),this.options.protocol==="tcp"&&(yield this.switchProtocol("tcp"));const a=(n=this.room.serverInfo)===null||n===void 0?void 0:n.region;if(!a)throw new Error("Region not found");const s=yield this.room.localParticipant.streamText({topic:"test"}),l=1e3,h=1e6/l,p="A".repeat(l),v=Date.now();for(let E=0;E<h;E++)yield s.write(p);yield s.close();const b=Date.now(),k=yield(r=this.room.engine.pcManager)===null||r===void 0?void 0:r.publisher.getStats(),T={region:a,rtt:1e4,duration:b-v};return k==null||k.forEach(E=>{E.type==="candidate-pair"&&E.nominated&&(T.rtt=E.currentRoundTripTime*1e3)}),yield this.disconnect(),T})}}const zT=1e4;class Cz extends xc{get description(){return"Connection via UDP vs TCP"}perform(){return Q(this,void 0,void 0,function*(){const e=yield this.checkConnectionProtocol("udp"),n=yield this.checkConnectionProtocol("tcp");this.bestStats=e,e.qualityLimitationDurations.bandwidth-n.qualityLimitationDurations.bandwidth>.5||(e.packetsLost-n.packetsLost)/e.packetsSent>.01?(this.appendMessage("best connection quality via tcp"),this.bestStats=n):this.appendMessage("best connection quality via udp");const r=this.bestStats;this.appendMessage("upstream bitrate: ".concat((r.bitrateTotal/r.count/1e3/1e3).toFixed(2)," mbps")),this.appendMessage("RTT: ".concat((r.rttTotal/r.count*1e3).toFixed(2)," ms")),this.appendMessage("jitter: ".concat((r.jitterTotal/r.count*1e3).toFixed(2)," ms")),r.packetsLost>0&&this.appendWarning("packets lost: ".concat((r.packetsLost/r.packetsSent*100).toFixed(2),"%")),r.qualityLimitationDurations.bandwidth>1&&this.appendWarning("bandwidth limited ".concat((r.qualityLimitationDurations.bandwidth/(zT/1e3)*100).toFixed(2),"%")),r.qualityLimitationDurations.cpu>0&&this.appendWarning("cpu limited ".concat((r.qualityLimitationDurations.cpu/(zT/1e3)*100).toFixed(2),"%"))})}getInfo(){const e=super.getInfo();return e.data=this.bestStats,e}checkConnectionProtocol(e){return Q(this,void 0,void 0,function*(){yield this.connect(),e==="tcp"?yield this.switchProtocol("tcp"):yield this.switchProtocol("udp");const n=document.createElement("canvas");n.width=1280,n.height=720;const r=n.getContext("2d");if(!r)throw new Error("Could not get canvas context");let a=0;const s=()=>{a=(a+1)%360,r.fillStyle="hsl(".concat(a,", 100%, 50%)"),r.fillRect(0,0,n.width,n.height),requestAnimationFrame(s)};s();const c=n.captureStream(30).getVideoTracks()[0],p=(yield this.room.localParticipant.publishTrack(c,{simulcast:!1,degradationPreference:"maintain-resolution",videoEncoding:{maxBitrate:2e6}})).track,v={protocol:e,packetsLost:0,packetsSent:0,qualityLimitationDurations:{},rttTotal:0,jitterTotal:0,bitrateTotal:0,count:0},b=setInterval(()=>Q(this,void 0,void 0,function*(){const k=yield p.getRTCStatsReport();k==null||k.forEach(T=>{T.type==="outbound-rtp"?(v.packetsSent=T.packetsSent,v.qualityLimitationDurations=T.qualityLimitationDurations,v.bitrateTotal+=T.targetBitrate,v.count++):T.type==="remote-inbound-rtp"&&(v.packetsLost=T.packetsLost,v.rttTotal+=T.roundTripTime,v.jitterTotal+=T.jitter)})}),1e3);return yield new Promise(k=>setTimeout(k,zT)),clearInterval(b),c.stop(),n.remove(),yield this.disconnect(),v})}}class kz extends xc{get description(){return"Can publish audio"}perform(){return Q(this,void 0,void 0,function*(){var e;const n=yield this.connect(),r=yield gz();if(yield gO(r,1e3))throw new Error("unable to detect audio from microphone");this.appendMessage("detected audio from microphone"),n.localParticipant.publishTrack(r),yield new Promise(c=>setTimeout(c,3e3));const s=yield(e=r.sender)===null||e===void 0?void 0:e.getStats();if(!s)throw new Error("Could not get RTCStats");let l=0;if(s.forEach(c=>{c.type==="outbound-rtp"&&(c.kind==="audio"||!c.kind&&c.mediaType==="audio")&&(l=c.packetsSent)}),l===0)throw new Error("Could not determine packets are sent");this.appendMessage("published ".concat(l," audio packets"))})}}class Tz extends xc{get description(){return"Can publish video"}perform(){return Q(this,void 0,void 0,function*(){var e;const n=yield this.connect(),r=yield mz();yield this.checkForVideo(r.mediaStreamTrack),n.localParticipant.publishTrack(r),yield new Promise(l=>setTimeout(l,5e3));const a=yield(e=r.sender)===null||e===void 0?void 0:e.getStats();if(!a)throw new Error("Could not get RTCStats");let s=0;if(a.forEach(l=>{l.type==="outbound-rtp"&&(l.kind==="video"||!l.kind&&l.mediaType==="video")&&(s+=l.packetsSent)}),s===0)throw new Error("Could not determine packets are sent");this.appendMessage("published ".concat(s," video packets"))})}checkForVideo(e){return Q(this,void 0,void 0,function*(){const n=new MediaStream;n.addTrack(e.clone());const r=document.createElement("video");r.srcObject=n,r.muted=!0,yield new Promise(a=>{r.onplay=()=>{setTimeout(()=>{var s,l,c,h;const p=document.createElement("canvas"),v=e.getSettings(),b=(l=(s=v.width)!==null&&s!==void 0?s:r.videoWidth)!==null&&l!==void 0?l:1280,k=(h=(c=v.height)!==null&&c!==void 0?c:r.videoHeight)!==null&&h!==void 0?h:720;p.width=b,p.height=k;const T=p.getContext("2d");T.drawImage(r,0,0);const R=T.getImageData(0,0,p.width,p.height).data;let M=!0;for(let A=0;A<R.length;A+=4)if(R[A]!==0||R[A+1]!==0||R[A+2]!==0){M=!1;break}M?this.appendError("camera appears to be producing only black frames"):this.appendMessage("received video frames"),a()},1e3)},r.play()}),r.remove()})}}class xz extends xc{get description(){return"Resuming connection after interruption"}perform(){return Q(this,void 0,void 0,function*(){var e;const n=yield this.connect();let r=!1,a=!1,s;const l=new Promise(p=>{setTimeout(p,5e3),s=p}),c=()=>{r=!0};n.on(Ee.SignalReconnecting,c).on(Ee.Reconnecting,c).on(Ee.Reconnected,()=>{a=!0,s(!0)}),(e=n.engine.client.ws)===null||e===void 0||e.close();const h=n.engine.client.onClose;if(h&&h(""),yield l,r){if(!a||n.state!==Fn.Connected)throw this.appendWarning("reconnection is only possible in Redis-based configurations"),new Error("Not able to reconnect")}else throw new Error("Did not attempt to reconnect")})}}class wz extends xc{get description(){return"Can connect via TURN"}perform(){return Q(this,void 0,void 0,function*(){var e,n;const r=new TT,a=yield r.join(this.url,this.token,{autoSubscribe:!0,maxRetries:0,e2eeEnabled:!1,websocketTimeout:15e3});let s=!1,l=!1,c=!1;for(let h of a.iceServers)for(let p of h.urls)p.startsWith("turn:")?(l=!0,c=!0):p.startsWith("turns:")&&(l=!0,c=!0,s=!0),p.startsWith("stun:")&&(c=!0);c?l&&!s&&this.appendWarning("TURN is configured server side, but TURN/TLS is unavailable."):this.appendWarning("No STUN servers configured on server side."),yield r.close(),!((n=(e=this.connectOptions)===null||e===void 0?void 0:e.rtcConfig)===null||n===void 0)&&n.iceServers||l?yield this.room.connect(this.url,this.token,{rtcConfig:{iceTransportPolicy:"relay"}}):(this.appendWarning("No TURN servers configured."),this.skip(),yield new Promise(h=>setTimeout(h,0)))})}}class _z extends xc{get description(){return"Establishing WebRTC connection"}perform(){return Q(this,void 0,void 0,function*(){let e=!1,n=!1;this.room.on(Ee.SignalConnected,()=>{const r=this.room.engine.client.onTrickle;this.room.engine.client.onTrickle=(a,s)=>{if(a.candidate){const l=new RTCIceCandidate(a);let c="".concat(l.protocol," ").concat(l.address,":").concat(l.port," ").concat(l.type);l.address&&(Ez(l.address)?c+=" (private)":l.protocol==="tcp"&&l.tcpType==="passive"?(e=!0,c+=" (passive)"):l.protocol==="udp"&&(n=!0)),this.appendMessage(c)}r&&r(a,s)},this.room.engine.pcManager&&(this.room.engine.pcManager.subscriber.onIceCandidateError=a=>{a instanceof RTCPeerConnectionIceErrorEvent&&this.appendWarning("error with ICE candidate: ".concat(a.errorCode," ").concat(a.errorText," ").concat(a.url))})});try{yield this.connect(),Nn.info("now the room is connected")}catch(r){throw this.appendWarning("ports need to be open on firewall in order to connect."),r}e||this.appendWarning("Server is not configured for ICE/TCP"),n||this.appendWarning("No public IPv4 UDP candidates were found. Your server is likely not configured correctly")})}}function Ez(t){const e=t.split(".");if(e.length===4){if(e[0]==="10")return!0;if(e[0]==="192"&&e[1]==="168")return!0;if(e[0]==="172"){const n=parseInt(e[1],10);if(n>=16&&n<=31)return!0}}return!1}class Rz extends xc{get description(){return"Connecting to signal connection via WebSocket"}perform(){return Q(this,void 0,void 0,function*(){var e,n,r;(this.url.startsWith("ws:")||this.url.startsWith("http:"))&&this.appendWarning("Server is insecure, clients may block connections to it");let a=new TT;const s=yield a.join(this.url,this.token,{autoSubscribe:!0,maxRetries:0,e2eeEnabled:!1,websocketTimeout:15e3});this.appendMessage("Connected to server, version ".concat(s.serverVersion,".")),((e=s.serverInfo)===null||e===void 0?void 0:e.edition)===YD.Cloud&&(!((n=s.serverInfo)===null||n===void 0)&&n.region)&&this.appendMessage("LiveKit Cloud: ".concat((r=s.serverInfo)===null||r===void 0?void 0:r.region)),yield a.close()})}}class Ose extends dl.EventEmitter{constructor(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};super(),this.options={},this.checkResults=new Map,this.url=e,this.token=n,this.options=r}getNextCheckId(){const e=this.checkResults.size;return this.checkResults.set(e,{logs:[],status:Rs.IDLE,name:"",description:""}),e}updateCheck(e,n){this.checkResults.set(e,n),this.emit("checkUpdate",e,n)}isSuccess(){return Array.from(this.checkResults.values()).every(e=>e.status!==Rs.FAILED)}getResults(){return Array.from(this.checkResults.values())}createAndRunCheck(e){return Q(this,void 0,void 0,function*(){const n=this.getNextCheckId(),r=new e(this.url,this.token,this.options),a=l=>{this.updateCheck(n,l)};r.on("update",a);const s=yield r.run();return r.off("update",a),s})}checkWebsocket(){return Q(this,void 0,void 0,function*(){return this.createAndRunCheck(Rz)})}checkWebRTC(){return Q(this,void 0,void 0,function*(){return this.createAndRunCheck(_z)})}checkTURN(){return Q(this,void 0,void 0,function*(){return this.createAndRunCheck(wz)})}checkReconnect(){return Q(this,void 0,void 0,function*(){return this.createAndRunCheck(xz)})}checkPublishAudio(){return Q(this,void 0,void 0,function*(){return this.createAndRunCheck(kz)})}checkPublishVideo(){return Q(this,void 0,void 0,function*(){return this.createAndRunCheck(Tz)})}checkConnectionProtocol(){return Q(this,void 0,void 0,function*(){const e=yield this.createAndRunCheck(Cz);if(e.data&&"protocol"in e.data){const n=e.data;this.options.protocol=n.protocol}return e})}checkCloudRegion(){return Q(this,void 0,void 0,function*(){return this.createAndRunCheck(Sz)})}}var mb=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Pz(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var BT={exports:{}},Dz=BT.exports,KO;function Az(){return KO||(KO=1,function(t){(function(e,n){t.exports?t.exports=n():e.log=n()})(Dz,function(){var e=function(){},n="undefined",r=typeof window!==n&&typeof window.navigator!==n&&/Trident\/|MSIE /.test(window.navigator.userAgent),a=["trace","debug","info","warn","error"],s={},l=null;function c(R,M){var A=R[M];if(typeof A.bind=="function")return A.bind(R);try{return Function.prototype.bind.call(A,R)}catch{return function(){return Function.prototype.apply.apply(A,[R,arguments])}}}function h(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function p(R){return R==="debug"&&(R="log"),typeof console===n?!1:R==="trace"&&r?h:console[R]!==void 0?c(console,R):console.log!==void 0?c(console,"log"):e}function v(){for(var R=this.getLevel(),M=0;M<a.length;M++){var A=a[M];this[A]=M<R?e:this.methodFactory(A,R,this.name)}if(this.log=this.debug,typeof console===n&&R<this.levels.SILENT)return"No console available for logging"}function b(R){return function(){typeof console!==n&&(v.call(this),this[R].apply(this,arguments))}}function k(R,M,A){return p(R)||b.apply(this,arguments)}function T(R,M){var A=this,U,V,j,I="loglevel";typeof R=="string"?I+=":"+R:typeof R=="symbol"&&(I=void 0);function N(oe){var J=(a[oe]||"silent").toUpperCase();if(!(typeof window===n||!I)){try{window.localStorage[I]=J;return}catch{}try{window.document.cookie=encodeURIComponent(I)+"="+J+";"}catch{}}}function ne(){var oe;if(!(typeof window===n||!I)){try{oe=window.localStorage[I]}catch{}if(typeof oe===n)try{var J=window.document.cookie,xe=encodeURIComponent(I),ke=J.indexOf(xe+"=");ke!==-1&&(oe=/^([^;]+)/.exec(J.slice(ke+xe.length+1))[1])}catch{}return A.levels[oe]===void 0&&(oe=void 0),oe}}function X(){if(!(typeof window===n||!I)){try{window.localStorage.removeItem(I)}catch{}try{window.document.cookie=encodeURIComponent(I)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function se(oe){var J=oe;if(typeof J=="string"&&A.levels[J.toUpperCase()]!==void 0&&(J=A.levels[J.toUpperCase()]),typeof J=="number"&&J>=0&&J<=A.levels.SILENT)return J;throw new TypeError("log.setLevel() called with invalid level: "+oe)}A.name=R,A.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},A.methodFactory=M||k,A.getLevel=function(){return j??V??U},A.setLevel=function(oe,J){return j=se(oe),J!==!1&&N(j),v.call(A)},A.setDefaultLevel=function(oe){V=se(oe),ne()||A.setLevel(oe,!1)},A.resetLevel=function(){j=null,X(),v.call(A)},A.enableAll=function(oe){A.setLevel(A.levels.TRACE,oe)},A.disableAll=function(oe){A.setLevel(A.levels.SILENT,oe)},A.rebuild=function(){if(l!==A&&(U=se(l.getLevel())),v.call(A),l===A)for(var oe in s)s[oe].rebuild()},U=se(l?l.getLevel():"WARN");var $=ne();$!=null&&(j=se($)),v.call(A)}l=new T,l.getLogger=function(R){if(typeof R!="symbol"&&typeof R!="string"||R==="")throw new TypeError("You must supply a name when creating a logger.");var M=s[R];return M||(M=s[R]=new T(R,l.methodFactory)),M};var E=typeof window!==n?window.log:void 0;return l.noConflict=function(){return typeof window!==n&&window.log===l&&(window.log=E),l},l.getLoggers=function(){return s},l.default=l,l})}(BT)),BT.exports}var Oz=Az();const Mz=Pz(Oz);var HT=function(t,e){return HT=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(n[a]=r[a])},HT(t,e)};function fu(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");HT(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}function Lz(t,e,n,r){function a(s){return s instanceof n?s:new n(function(l){l(s)})}return new(n||(n=Promise))(function(s,l){function c(v){try{p(r.next(v))}catch(b){l(b)}}function h(v){try{p(r.throw(v))}catch(b){l(b)}}function p(v){v.done?s(v.value):a(v.value).then(c,h)}p((r=r.apply(t,[])).next())})}function ZO(t,e){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,a,s,l=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return l.next=c(0),l.throw=c(1),l.return=c(2),typeof Symbol=="function"&&(l[Symbol.iterator]=function(){return this}),l;function c(p){return function(v){return h([p,v])}}function h(p){if(r)throw new TypeError("Generator is already executing.");for(;l&&(l=0,p[0]&&(n=0)),n;)try{if(r=1,a&&(s=p[0]&2?a.return:p[0]?a.throw||((s=a.return)&&s.call(a),0):a.next)&&!(s=s.call(a,p[1])).done)return s;switch(a=0,s&&(p=[p[0]&2,s.value]),p[0]){case 0:case 1:s=p;break;case 4:return n.label++,{value:p[1],done:!1};case 5:n.label++,a=p[1],p=[0];continue;case 7:p=n.ops.pop(),n.trys.pop();continue;default:if(s=n.trys,!(s=s.length>0&&s[s.length-1])&&(p[0]===6||p[0]===2)){n=0;continue}if(p[0]===3&&(!s||p[1]>s[0]&&p[1]<s[3])){n.label=p[1];break}if(p[0]===6&&n.label<s[1]){n.label=s[1],s=p;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(p);break}s[2]&&n.ops.pop(),n.trys.pop();continue}p=e.call(t,n)}catch(v){p=[6,v],a=0}finally{r=s=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}}function Yh(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function gb(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),a,s=[],l;try{for(;(e===void 0||e-- >0)&&!(a=r.next()).done;)s.push(a.value)}catch(c){l={error:c}}finally{try{a&&!a.done&&(n=r.return)&&n.call(r)}finally{if(l)throw l.error}}return s}function vb(t,e,n){if(arguments.length===2)for(var r=0,a=e.length,s;r<a;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return t.concat(s||Array.prototype.slice.call(e))}function Kh(t){return this instanceof Kh?(this.v=t,this):new Kh(t)}function Nz(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),a,s=[];return a=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),c("next"),c("throw"),c("return",l),a[Symbol.asyncIterator]=function(){return this},a;function l(T){return function(E){return Promise.resolve(E).then(T,b)}}function c(T,E){r[T]&&(a[T]=function(R){return new Promise(function(M,A){s.push([T,R,M,A])>1||h(T,R)})},E&&(a[T]=E(a[T])))}function h(T,E){try{p(r[T](E))}catch(R){k(s[0][3],R)}}function p(T){T.value instanceof Kh?Promise.resolve(T.value.v).then(v,b):k(s[0][2],T)}function v(T){h("next",T)}function b(T){h("throw",T)}function k(T,E){T(E),s.shift(),s.length&&h(s[0][0],s[0][1])}}function Iz(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof Yh=="function"?Yh(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(s){n[s]=t[s]&&function(l){return new Promise(function(c,h){l=t[s](l),a(c,h,l.done,l.value)})}}function a(s,l,c,h){Promise.resolve(h).then(function(p){s({value:p,done:c})},l)}}function wi(t){return typeof t=="function"}function $T(t){var e=function(r){Error.call(r),r.stack=new Error().stack},n=t(e);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var qT=$T(function(t){return function(e){t(this),this.message=e?e.length+` errors occurred during unsubscription:
|
|
279
279
|
`+e.map(function(n,r){return r+1+") "+n.toString()}).join(`
|
|
280
280
|
`):"",this.name="UnsubscriptionError",this.errors=e}});function yb(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var Lg=function(){function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,n,r,a,s;if(!this.closed){this.closed=!0;var l=this._parentage;if(l)if(this._parentage=null,Array.isArray(l))try{for(var c=Yh(l),h=c.next();!h.done;h=c.next()){var p=h.value;p.remove(this)}}catch(R){e={error:R}}finally{try{h&&!h.done&&(n=c.return)&&n.call(c)}finally{if(e)throw e.error}}else l.remove(this);var v=this.initialTeardown;if(wi(v))try{v()}catch(R){s=R instanceof qT?R.errors:[R]}var b=this._finalizers;if(b){this._finalizers=null;try{for(var k=Yh(b),T=k.next();!T.done;T=k.next()){var E=T.value;try{JO(E)}catch(R){s=s??[],R instanceof qT?s=vb(vb([],gb(s)),gb(R.errors)):s.push(R)}}}catch(R){r={error:R}}finally{try{T&&!T.done&&(a=k.return)&&a.call(k)}finally{if(r)throw r.error}}}if(s)throw new qT(s)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)JO(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(e)}},t.prototype._hasParent=function(e){var n=this._parentage;return n===e||Array.isArray(n)&&n.includes(e)},t.prototype._addParent=function(e){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(e),n):n?[n,e]:e},t.prototype._removeParent=function(e){var n=this._parentage;n===e?this._parentage=null:Array.isArray(n)&&yb(n,e)},t.prototype.remove=function(e){var n=this._finalizers;n&&yb(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}(),QO=Lg.EMPTY;function XO(t){return t instanceof Lg||t&&"closed"in t&&wi(t.remove)&&wi(t.add)&&wi(t.unsubscribe)}function JO(t){wi(t)?t():t.unsubscribe()}var Uz={Promise:void 0},Fz={setTimeout:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,vb([t,e],gb(n)))},clearTimeout:function(t){return clearTimeout(t)},delegate:void 0};function eM(t){Fz.setTimeout(function(){throw t})}function WT(){}function bb(t){t()}var GT=function(t){fu(e,t);function e(n){var r=t.call(this)||this;return r.isStopped=!1,n?(r.destination=n,XO(n)&&n.add(r)):r.destination=zz,r}return e.create=function(n,r,a){return new YT(n,r,a)},e.prototype.next=function(n){this.isStopped||this._next(n)},e.prototype.error=function(n){this.isStopped||(this.isStopped=!0,this._error(n))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(n){this.destination.next(n)},e.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(Lg),jz=function(){function t(e){this.partialObserver=e}return t.prototype.next=function(e){var n=this.partialObserver;if(n.next)try{n.next(e)}catch(r){Sb(r)}},t.prototype.error=function(e){var n=this.partialObserver;if(n.error)try{n.error(e)}catch(r){Sb(r)}else Sb(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(n){Sb(n)}},t}(),YT=function(t){fu(e,t);function e(n,r,a){var s=t.call(this)||this,l;return wi(n)||!n?l={next:n??void 0,error:r??void 0,complete:a??void 0}:l=n,s.destination=new jz(l),s}return e}(GT);function Sb(t){eM(t)}function Vz(t){throw t}var zz={closed:!0,next:WT,error:Vz,complete:WT},KT=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function tM(t){return t}function Bz(t){return t.length===0?tM:t.length===1?t[0]:function(e){return t.reduce(function(n,r){return r(n)},e)}}var _i=function(){function t(e){e&&(this._subscribe=e)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(e,n,r){var a=this,s=$z(e)?e:new YT(e,n,r);return bb(function(){var l=a,c=l.operator,h=l.source;s.add(c?c.call(s,h):h?a._subscribe(s):a._trySubscribe(s))}),s},t.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(n){e.error(n)}},t.prototype.forEach=function(e,n){var r=this;return n=nM(n),new n(function(a,s){var l=new YT({next:function(c){try{e(c)}catch(h){s(h),l.unsubscribe()}},error:s,complete:a});r.subscribe(l)})},t.prototype._subscribe=function(e){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(e)},t.prototype[KT]=function(){return this},t.prototype.pipe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return Bz(e)(this)},t.prototype.toPromise=function(e){var n=this;return e=nM(e),new e(function(r,a){var s;n.subscribe(function(l){return s=l},function(l){return a(l)},function(){return r(s)})})},t.create=function(e){return new t(e)},t}();function nM(t){var e;return(e=t??Uz.Promise)!==null&&e!==void 0?e:Promise}function Hz(t){return t&&wi(t.next)&&wi(t.error)&&wi(t.complete)}function $z(t){return t&&t instanceof GT||Hz(t)&&XO(t)}function qz(t){return wi(t==null?void 0:t.lift)}function wc(t){return function(e){if(qz(e))return e.lift(function(n){try{return t(n,this)}catch(r){this.error(r)}});throw new TypeError("Unable to lift unknown Observable type")}}function Xd(t,e,n,r,a){return new Wz(t,e,n,r,a)}var Wz=function(t){fu(e,t);function e(n,r,a,s,l,c){var h=t.call(this,n)||this;return h.onFinalize=l,h.shouldUnsubscribe=c,h._next=r?function(p){try{r(p)}catch(v){n.error(v)}}:t.prototype._next,h._error=s?function(p){try{s(p)}catch(v){n.error(v)}finally{this.unsubscribe()}}:t.prototype._error,h._complete=a?function(){try{a()}catch(p){n.error(p)}finally{this.unsubscribe()}}:t.prototype._complete,h}return e.prototype.unsubscribe=function(){var n;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;t.prototype.unsubscribe.call(this),!r&&((n=this.onFinalize)===null||n===void 0||n.call(this))}},e}(GT),Gz=$T(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),Cb=function(t){fu(e,t);function e(){var n=t.call(this)||this;return n.closed=!1,n.currentObservers=null,n.observers=[],n.isStopped=!1,n.hasError=!1,n.thrownError=null,n}return e.prototype.lift=function(n){var r=new rM(this,this);return r.operator=n,r},e.prototype._throwIfClosed=function(){if(this.closed)throw new Gz},e.prototype.next=function(n){var r=this;bb(function(){var a,s;if(r._throwIfClosed(),!r.isStopped){r.currentObservers||(r.currentObservers=Array.from(r.observers));try{for(var l=Yh(r.currentObservers),c=l.next();!c.done;c=l.next()){var h=c.value;h.next(n)}}catch(p){a={error:p}}finally{try{c&&!c.done&&(s=l.return)&&s.call(l)}finally{if(a)throw a.error}}}})},e.prototype.error=function(n){var r=this;bb(function(){if(r._throwIfClosed(),!r.isStopped){r.hasError=r.isStopped=!0,r.thrownError=n;for(var a=r.observers;a.length;)a.shift().error(n)}})},e.prototype.complete=function(){var n=this;bb(function(){if(n._throwIfClosed(),!n.isStopped){n.isStopped=!0;for(var r=n.observers;r.length;)r.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var n;return((n=this.observers)===null||n===void 0?void 0:n.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(n){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,n)},e.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},e.prototype._innerSubscribe=function(n){var r=this,a=this,s=a.hasError,l=a.isStopped,c=a.observers;return s||l?QO:(this.currentObservers=null,c.push(n),new Lg(function(){r.currentObservers=null,yb(c,n)}))},e.prototype._checkFinalizedStatuses=function(n){var r=this,a=r.hasError,s=r.thrownError,l=r.isStopped;a?n.error(s):l&&n.complete()},e.prototype.asObservable=function(){var n=new _i;return n.source=this,n},e.create=function(n,r){return new rM(n,r)},e}(_i),rM=function(t){fu(e,t);function e(n,r){var a=t.call(this)||this;return a.destination=n,a.source=r,a}return e.prototype.next=function(n){var r,a;(a=(r=this.destination)===null||r===void 0?void 0:r.next)===null||a===void 0||a.call(r,n)},e.prototype.error=function(n){var r,a;(a=(r=this.destination)===null||r===void 0?void 0:r.error)===null||a===void 0||a.call(r,n)},e.prototype.complete=function(){var n,r;(r=(n=this.destination)===null||n===void 0?void 0:n.complete)===null||r===void 0||r.call(n)},e.prototype._subscribe=function(n){var r,a;return(a=(r=this.source)===null||r===void 0?void 0:r.subscribe(n))!==null&&a!==void 0?a:QO},e}(Cb),Yz=function(t){fu(e,t);function e(n){var r=t.call(this)||this;return r._value=n,r}return Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(n){var r=t.prototype._subscribe.call(this,n);return!r.closed&&n.next(this._value),r},e.prototype.getValue=function(){var n=this,r=n.hasError,a=n.thrownError,s=n._value;if(r)throw a;return this._throwIfClosed(),s},e.prototype.next=function(n){t.prototype.next.call(this,this._value=n)},e}(Cb),Kz={now:function(){return Date.now()}},Zz=function(t){fu(e,t);function e(n,r){return t.call(this)||this}return e.prototype.schedule=function(n,r){return this},e}(Lg),iM={setInterval:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setInterval.apply(void 0,vb([t,e],gb(n)))},clearInterval:function(t){return clearInterval(t)},delegate:void 0},Qz=function(t){fu(e,t);function e(n,r){var a=t.call(this,n,r)||this;return a.scheduler=n,a.work=r,a.pending=!1,a}return e.prototype.schedule=function(n,r){var a;if(r===void 0&&(r=0),this.closed)return this;this.state=n;var s=this.id,l=this.scheduler;return s!=null&&(this.id=this.recycleAsyncId(l,s,r)),this.pending=!0,this.delay=r,this.id=(a=this.id)!==null&&a!==void 0?a:this.requestAsyncId(l,this.id,r),this},e.prototype.requestAsyncId=function(n,r,a){return a===void 0&&(a=0),iM.setInterval(n.flush.bind(n,this),a)},e.prototype.recycleAsyncId=function(n,r,a){if(a===void 0&&(a=0),a!=null&&this.delay===a&&this.pending===!1)return r;r!=null&&iM.clearInterval(r)},e.prototype.execute=function(n,r){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var a=this._execute(n,r);if(a)return a;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(n,r){var a=!1,s;try{this.work(n)}catch(l){a=!0,s=l||new Error("Scheduled action threw falsy error")}if(a)return this.unsubscribe(),s},e.prototype.unsubscribe=function(){if(!this.closed){var n=this,r=n.id,a=n.scheduler,s=a.actions;this.work=this.state=this.scheduler=null,this.pending=!1,yb(s,this),r!=null&&(this.id=this.recycleAsyncId(a,r,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},e}(Zz),aM=function(){function t(e,n){n===void 0&&(n=t.now),this.schedulerActionCtor=e,this.now=n}return t.prototype.schedule=function(e,n,r){return n===void 0&&(n=0),new this.schedulerActionCtor(this,e).schedule(r,n)},t.now=Kz.now,t}(),Xz=function(t){fu(e,t);function e(n,r){r===void 0&&(r=aM.now);var a=t.call(this,n,r)||this;return a.actions=[],a._active=!1,a}return e.prototype.flush=function(n){var r=this.actions;if(this._active){r.push(n);return}var a;this._active=!0;do if(a=n.execute(n.state,n.delay))break;while(n=r.shift());if(this._active=!1,a){for(;n=r.shift();)n.unsubscribe();throw a}},e}(aM);new Xz(Qz);function Jz(t){return t&&wi(t.schedule)}function e7(t){return t[t.length-1]}function oM(t){return Jz(e7(t))?t.pop():void 0}var sM=function(t){return t&&typeof t.length=="number"&&typeof t!="function"};function lM(t){return wi(t==null?void 0:t.then)}function uM(t){return wi(t[KT])}function cM(t){return Symbol.asyncIterator&&wi(t==null?void 0:t[Symbol.asyncIterator])}function dM(t){return new TypeError("You provided "+(t!==null&&typeof t=="object"?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function t7(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var fM=t7();function hM(t){return wi(t==null?void 0:t[fM])}function pM(t){return Nz(this,arguments,function(){var e,n,r,a;return ZO(this,function(s){switch(s.label){case 0:e=t.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,Kh(e.read())];case 3:return n=s.sent(),r=n.value,a=n.done,a?[4,Kh(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,Kh(r)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return e.releaseLock(),[7];case 10:return[2]}})})}function mM(t){return wi(t==null?void 0:t.getReader)}function Zh(t){if(t instanceof _i)return t;if(t!=null){if(uM(t))return n7(t);if(sM(t))return r7(t);if(lM(t))return i7(t);if(cM(t))return gM(t);if(hM(t))return a7(t);if(mM(t))return o7(t)}throw dM(t)}function n7(t){return new _i(function(e){var n=t[KT]();if(wi(n.subscribe))return n.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function r7(t){return new _i(function(e){for(var n=0;n<t.length&&!e.closed;n++)e.next(t[n]);e.complete()})}function i7(t){return new _i(function(e){t.then(function(n){e.closed||(e.next(n),e.complete())},function(n){return e.error(n)}).then(null,eM)})}function a7(t){return new _i(function(e){var n,r;try{for(var a=Yh(t),s=a.next();!s.done;s=a.next()){var l=s.value;if(e.next(l),e.closed)return}}catch(c){n={error:c}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}e.complete()})}function gM(t){return new _i(function(e){s7(t,e).catch(function(n){return e.error(n)})})}function o7(t){return gM(pM(t))}function s7(t,e){var n,r,a,s;return Lz(this,void 0,void 0,function(){var l,c;return ZO(this,function(h){switch(h.label){case 0:h.trys.push([0,5,6,11]),n=Iz(t),h.label=1;case 1:return[4,n.next()];case 2:if(r=h.sent(),!!r.done)return[3,4];if(l=r.value,e.next(l),e.closed)return[2];h.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return c=h.sent(),a={error:c},[3,11];case 6:return h.trys.push([6,,9,10]),r&&!r.done&&(s=n.return)?[4,s.call(n)]:[3,8];case 7:h.sent(),h.label=8;case 8:return[3,10];case 9:if(a)throw a.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}function Jd(t,e,n,r,a){r===void 0&&(r=0),a===void 0&&(a=!1);var s=e.schedule(function(){n(),a?t.add(this.schedule(null,r)):this.unsubscribe()},r);if(t.add(s),!a)return s}function vM(t,e){return e===void 0&&(e=0),wc(function(n,r){n.subscribe(Xd(r,function(a){return Jd(r,t,function(){return r.next(a)},e)},function(){return Jd(r,t,function(){return r.complete()},e)},function(a){return Jd(r,t,function(){return r.error(a)},e)}))})}function yM(t,e){return e===void 0&&(e=0),wc(function(n,r){r.add(t.schedule(function(){return n.subscribe(r)},e))})}function l7(t,e){return Zh(t).pipe(yM(e),vM(e))}function u7(t,e){return Zh(t).pipe(yM(e),vM(e))}function c7(t,e){return new _i(function(n){var r=0;return e.schedule(function(){r===t.length?n.complete():(n.next(t[r++]),n.closed||this.schedule())})})}function d7(t,e){return new _i(function(n){var r;return Jd(n,e,function(){r=t[fM](),Jd(n,e,function(){var a,s,l;try{a=r.next(),s=a.value,l=a.done}catch(c){n.error(c);return}l?n.complete():n.next(s)},0,!0)}),function(){return wi(r==null?void 0:r.return)&&r.return()}})}function bM(t,e){if(!t)throw new Error("Iterable cannot be null");return new _i(function(n){Jd(n,e,function(){var r=t[Symbol.asyncIterator]();Jd(n,e,function(){r.next().then(function(a){a.done?n.complete():n.next(a.value)})},0,!0)})})}function f7(t,e){return bM(pM(t),e)}function h7(t,e){if(t!=null){if(uM(t))return l7(t,e);if(sM(t))return c7(t,e);if(lM(t))return u7(t,e);if(cM(t))return bM(t,e);if(hM(t))return d7(t,e);if(mM(t))return f7(t,e)}throw dM(t)}function SM(t,e){return e?h7(t,e):Zh(t)}$T(function(t){return function(e){e===void 0&&(e=null),t(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=e}});function Ps(t,e){return wc(function(n,r){var a=0;n.subscribe(Xd(r,function(s){r.next(t.call(e,s,a++))}))})}function p7(t,e,n,r,a,s,l,c){var h=[],p=0,v=0,b=!1,k=function(){b&&!h.length&&!p&&e.complete()},T=function(R){return p<r?E(R):h.push(R)},E=function(R){p++;var M=!1;Zh(n(R,v++)).subscribe(Xd(e,function(A){e.next(A)},function(){M=!0},void 0,function(){if(M)try{p--;for(var A=function(){var U=h.shift();l||E(U)};h.length&&p<r;)A();k()}catch(U){e.error(U)}}))};return t.subscribe(Xd(e,T,function(){b=!0,k()})),function(){}}function CM(t,e,n){return n===void 0&&(n=1/0),wi(e)?CM(function(r,a){return Ps(function(s,l){return e(r,s,a,l)})(Zh(t(r,a)))},n):(typeof e=="number"&&(n=e),wc(function(r,a){return p7(r,a,t,n)}))}function m7(t){return CM(tM,t)}function g7(){return m7(1)}function kM(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return g7()(SM(t,oM(t)))}function TM(t,e){return wc(function(n,r){var a=0;n.subscribe(Xd(r,function(s){return t.call(e,s,a++)&&r.next(s)}))})}function v7(t,e,n,r,a){return function(s,l){var c=n,h=e,p=0;s.subscribe(Xd(l,function(v){var b=p++;h=c?t(h,v,b):(c=!0,v),l.next(h)},a))}}function xM(t,e){return wc(v7(t,e,arguments.length>=2,!0))}function _c(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=oM(t);return wc(function(r,a){(n?kM(t,r,n):kM(t,r)).subscribe(a)})}function wM(t){return wc(function(e,n){Zh(t).subscribe(Xd(n,function(){return n.complete()},WT)),!n.closed&&e.subscribe(n)})}var y7=Object.defineProperty,b7=Object.defineProperties,S7=Object.getOwnPropertyDescriptors,_M=Object.getOwnPropertySymbols,C7=Object.prototype.hasOwnProperty,k7=Object.prototype.propertyIsEnumerable,EM=(t,e,n)=>e in t?y7(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Ng=(t,e)=>{for(var n in e||(e={}))C7.call(e,n)&&EM(t,n,e[n]);if(_M)for(var n of _M(e))k7.call(e,n)&&EM(t,n,e[n]);return t},kb=(t,e)=>b7(t,S7(e)),Tb=(t,e,n)=>new Promise((r,a)=>{var s=h=>{try{c(n.next(h))}catch(p){a(p)}},l=h=>{try{c(n.throw(h))}catch(p){a(p)}},c=h=>h.done?r(h.value):Promise.resolve(h.value).then(s,l);c((n=n.apply(t,e)).next())}),T7="lk";function ZT(t){return typeof t>"u"?!1:x7(t)||w7(t)}function x7(t){var e;return t?t.hasOwnProperty("participant")&&t.hasOwnProperty("source")&&t.hasOwnProperty("track")&&typeof((e=t.publication)==null?void 0:e.track)<"u":!1}function w7(t){return t?t.hasOwnProperty("participant")&&t.hasOwnProperty("source")&&t.hasOwnProperty("publication")&&typeof t.publication<"u":!1}function _7(t){return t?t.hasOwnProperty("participant")&&t.hasOwnProperty("source")&&typeof t.publication>"u":!1}function RM(t){if(typeof t=="string"||typeof t=="number")return`${t}`;if(_7(t))return`${t.participant.identity}_${t.source}_placeholder`;if(ZT(t))return`${t.participant.identity}_${t.publication.source}_${t.publication.trackSid}`;throw new Error(`Can't generate a id for the given track reference: ${t}`)}var E7=[Ee.ConnectionStateChanged,Ee.RoomMetadataChanged,Ee.ActiveSpeakersChanged,Ee.ConnectionQualityChanged,Ee.ParticipantConnected,Ee.ParticipantDisconnected,Ee.ParticipantPermissionsChanged,Ee.ParticipantMetadataChanged,Ee.ParticipantNameChanged,Ee.ParticipantAttributesChanged,Ee.TrackMuted,Ee.TrackUnmuted,Ee.TrackPublished,Ee.TrackUnpublished,Ee.TrackStreamStateChanged,Ee.TrackSubscriptionFailed,Ee.TrackSubscriptionPermissionChanged,Ee.TrackSubscriptionStatusChanged],PM=[...E7,Ee.LocalTrackPublished,Ee.LocalTrackUnpublished],R7=[Ie.TrackPublished,Ie.TrackUnpublished,Ie.TrackMuted,Ie.TrackUnmuted,Ie.TrackStreamStateChanged,Ie.TrackSubscribed,Ie.TrackUnsubscribed,Ie.TrackSubscriptionPermissionChanged,Ie.TrackSubscriptionFailed,Ie.LocalTrackPublished,Ie.LocalTrackUnpublished],P7=[Ie.ConnectionQualityChanged,Ie.IsSpeakingChanged,Ie.ParticipantMetadataChanged,Ie.ParticipantPermissionsChanged,Ie.TrackMuted,Ie.TrackUnmuted,Ie.TrackPublished,Ie.TrackUnpublished,Ie.TrackStreamStateChanged,Ie.TrackSubscriptionFailed,Ie.TrackSubscriptionPermissionChanged,Ie.TrackSubscriptionStatusChanged];[...P7,Ie.LocalTrackPublished,Ie.LocalTrackUnpublished];var Ec=Mz.getLogger("lk-components-js");Ec.setDefaultLevel("WARN");function D7(t,e){var n;return kb(Ng({},t),{receivedAtMediaTimestamp:(n=e.rtpTimestamp)!=null?n:0,receivedAt:e.timestamp})}function A7(t,e,n){return[...t,...e].reduceRight((r,a)=>(r.find(s=>s.id===a.id)||r.unshift(a),r),[]).slice(0-n)}function DM(t){return typeof t=="object"}function AM(t){return Array.isArray(t)&&t.filter(DM).length>0}function O7(t){return`${T7}-${t}`}function M7(t){const e=QT(t),n=NM(t.participant).pipe(Ps(()=>QT(t)),_c(e));return{className:O7(t.source===De.Source.Camera||t.source===De.Source.ScreenShare?"participant-media-video":"participant-media-audio"),trackObserver:n}}function QT(t){if(ZT(t))return t.publication;{const{source:e,name:n,participant:r}=t;if(e&&n)return r.getTrackPublications().find(a=>a.source===e&&a.trackName===n);if(n)return r.getTrackPublicationByName(n);if(e)return r.getTrackPublication(e);throw new Error("At least one of source and name needs to be defined")}}function OM(t,...e){return new _i(n=>{const r=()=>{n.next(t)};return e.forEach(a=>{t.on(a,r)}),()=>{e.forEach(a=>{t.off(a,r)})}}).pipe(_c(t))}function MM(t,e){return new _i(n=>{const r=(...a)=>{n.next(a)};return t.on(e,r),()=>{t.off(e,r)}})}function L7(t){return MM(t,Ee.ConnectionStateChanged).pipe(Ps(([e])=>e),_c(t.state))}function N7(t){return MM(t,Ee.DataReceived)}function LM(t,...e){return new _i(n=>{const r=()=>{n.next(t)};return e.forEach(a=>{t.on(a,r)}),()=>{e.forEach(a=>{t.off(a,r)})}}).pipe(_c(t))}function NM(t){return LM(t,Ie.TrackMuted,Ie.TrackUnmuted,Ie.ParticipantPermissionsChanged,Ie.TrackPublished,Ie.TrackUnpublished,Ie.LocalTrackPublished,Ie.LocalTrackUnpublished,Ie.MediaDevicesError,Ie.TrackSubscriptionStatusChanged).pipe(Ps(e=>{const{isMicrophoneEnabled:n,isCameraEnabled:r,isScreenShareEnabled:a}=e,s=e.getTrackPublication(De.Source.Microphone),l=e.getTrackPublication(De.Source.Camera);return{isCameraEnabled:r,isMicrophoneEnabled:n,isScreenShareEnabled:a,cameraTrack:l,microphoneTrack:s,participant:e}}))}function I7(t,e){return new _i(n=>{const r=(...a)=>{n.next(a)};return t.on(e,r),()=>{t.off(e,r)}})}function U7(t,e={}){var n;let r;const a=new _i(h=>(r=h,()=>c.unsubscribe())).pipe(_c(Array.from(t.remoteParticipants.values()))),s=(n=e.additionalRoomEvents)!=null?n:PM,l=Array.from(new Set([Ee.ParticipantConnected,Ee.ParticipantDisconnected,Ee.ConnectionStateChanged,...s])),c=OM(t,...l).subscribe(h=>r==null?void 0:r.next(Array.from(h.remoteParticipants.values())));return t.remoteParticipants.size>0&&(r==null||r.next(Array.from(t.remoteParticipants.values()))),a}function IM(t){return typeof t>"u"?new _i:I7(t,Ie.AttributesChanged).pipe(Ps(([e])=>({changed:e,attributes:t.attributes})),_c({changed:t.attributes,attributes:t.attributes}))}var F7={CHAT:"lk.chat"},j7={CHAT:"lk-chat-topic"};function UM(t,e){return Tb(this,arguments,function*(n,r,a={}){const{reliable:s,destinationIdentities:l,topic:c}=a;yield n.publishData(r,{destinationIdentities:l,topic:c,reliable:s})})}function V7(t,e,n){const r=Array.isArray(e)?e:[e],a=N7(t).pipe(TM(([,,,c])=>e===void 0||c!==void 0&&r.includes(c)),Ps(([c,h,,p])=>({payload:c,topic:p,from:h})));let s;const l=new _i(c=>{s=c});return{messageObservable:a,isSendingObservable:l,send:(c,...h)=>Tb(this,[c,...h],function*(p,v={}){s.next(!0);try{yield UM(t.localParticipant,p,Ng({topic:r[0]},v))}finally{s.next(!1)}})}}var xb=new WeakMap;function z7(t){return t.ignoreLegacy==!0}var B7=t=>JSON.parse(new TextDecoder().decode(t)),H7=t=>new TextEncoder().encode(JSON.stringify(t));function $7(t,e){var n,r,a,s,l,c;const h=()=>{var I,N,ne;return((I=t.serverInfo)==null?void 0:I.edition)===1||!!((N=t.serverInfo)!=null&&N.version)&&bc((ne=t.serverInfo)==null?void 0:ne.version,"1.8.2")>0},p=new Cb,v=(n=void 0)!=null?n:F7.CHAT,b=(r=void 0)!=null?r:j7.CHAT;let k=!1;xb.has(t)||(k=!0);const T=(a=xb.get(t))!=null?a:new Map,E=(s=T.get(v))!=null?s:new Cb;T.set(v,E),xb.set(t,T);const R=(l=void 0)!=null?l:B7;if(k){t.registerTextStreamHandler(v,(N,ne)=>Tb(this,null,function*(){const{id:X,timestamp:se}=N.info;SM(N).pipe(xM(($,oe)=>$+oe),Ps($=>({id:X,timestamp:se,message:$,from:t.getParticipantByIdentity(ne.identity)}))).subscribe({next:$=>E.next($)})}));const{messageObservable:I}=V7(t,[b]);I.pipe(Ps(N=>{const ne=R(N.payload);return z7(ne)?void 0:kb(Ng({},ne),{from:N.from})}),TM(N=>!!N),wM(p)).subscribe(E)}const M=E.pipe(xM((I,N)=>{if("id"in N&&I.find(ne=>{var X,se;return((X=ne.from)==null?void 0:X.identity)===((se=N.from)==null?void 0:se.identity)&&ne.id===N.id})){const ne=I.findIndex(X=>X.id===N.id);if(ne>-1){const X=I[ne];I[ne]=kb(Ng({},N),{timestamp:X.timestamp,editTimestamp:N.timestamp})}return[...I]}return[...I,N]},[]),wM(p)),A=new Yz(!1),U=(c=void 0)!=null?c:H7,V=(I,N)=>Tb(this,null,function*(){N||(N={}),N.topic!=null||(N.topic=v),A.next(!0);try{const ne={id:(yield t.localParticipant.sendText(I,N)).id,timestamp:Date.now(),message:I,from:t.localParticipant,attachedFiles:N.attachments};E.next(ne);const X=U(kb(Ng({},ne),{ignoreLegacy:h()}));return yield UM(t.localParticipant,X,{reliable:!0,topic:b}),ne}finally{A.next(!1)}});function j(){p.next(),p.complete(),E.complete(),xb.delete(t),t.unregisterTextStreamHandler(v)}return t.once(Ee.Disconnected,j),{messageObservable:M,isSendingObservable:A,send:V}}function FM(t,e,n=!0){const r=[t.localParticipant,...Array.from(t.remoteParticipants.values())],a=[];return r.forEach(s=>{e.forEach(l=>{const c=Array.from(s.trackPublications.values()).filter(h=>h.source===l&&(!n||h.track)).map(h=>({participant:s,publication:h,source:h.source}));a.push(...c)})}),{trackReferences:a,participants:r}}function jM(t,e,n=!1){const{sources:r,kind:a,name:s}=e;return Array.from(t.trackPublications.values()).filter(l=>(!r||r.includes(l.source))&&(!a||l.kind===a)&&(!s||l.trackName===s)&&(!n||l.track)).map(l=>({participant:t,publication:l,source:l.source}))}function q7(t,e,n){var r,a;const s=(r=n.additionalRoomEvents)!=null?r:PM,l=(a=n.onlySubscribed)!=null?a:!0,c=Array.from(new Set([Ee.ParticipantConnected,Ee.ParticipantDisconnected,Ee.ConnectionStateChanged,Ee.LocalTrackPublished,Ee.LocalTrackUnpublished,Ee.TrackPublished,Ee.TrackUnpublished,Ee.TrackSubscriptionStatusChanged,...s]).values());return OM(t,...c).pipe(Ps(h=>{const p=FM(h,e,l);return Ec.debug(`TrackReference[] was updated. (length ${p.trackReferences.length})`,p),p}),_c(FM(t,e,l)))}function W7(t,e){return LM(t,...R7).pipe(Ps(n=>{const r=jM(n,e);return Ec.debug(`TrackReference[] was updated. (length ${r.length})`,r),r}),_c(jM(t,e)))}function VM(t,e){return new _i(n=>{const r=(...a)=>{n.next(a)};return t.on(e,r),()=>{t.off(e,r)}})}function G7(t){return VM(t,Qe.TranscriptionReceived)}function Y7(t){return VM(t,Qe.TimeSyncUpdate).pipe(Ps(([e])=>e))}G.createContext(void 0);const K7=G.createContext(void 0);function Z7(){return G.useContext(K7)}function Q7(t){const e=Z7(),n=t??e;if(!n)throw new Error("No TrackRef, make sure you are inside a TrackRefContext or pass the TrackRef explicitly");return n}const X7=G.createContext(void 0);function zM(){return G.useContext(X7)}const XT=G.createContext(void 0);function JT(){const t=G.useContext(XT);if(!t)throw Error("tried to access room context outside of livekit room component");return t}function J7(){return G.useContext(XT)}function wb(t){const e=J7(),n=t??e;if(!n)throw new Error("No room provided, make sure you are inside a Room context or pass the room explicitly");return n}G.createContext(void 0);function BM(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var a=t.length;for(e=0;e<a;e++)t[e]&&(n=BM(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function eB(){for(var t,e,n=0,r="",a=arguments.length;n<a;n++)(t=arguments[n])&&(e=BM(t))&&(r&&(r+=" "),r+=e);return r}function tB(...t){return(...e)=>{for(const n of t)if(typeof n=="function")try{n(...e)}catch(r){console.error(r)}}}function nB(...t){const e={...t[0]};for(let n=1;n<t.length;n++){const r=t[n];for(const a in r){const s=e[a],l=r[a];typeof s=="function"&&typeof l=="function"&&a[0]==="o"&&a[1]==="n"&&a.charCodeAt(2)>=65&&a.charCodeAt(2)<=90?e[a]=tB(s,l):(a==="className"||a==="UNSAFE_className")&&typeof s=="string"&&typeof l=="string"?e[a]=eB(s,l):e[a]=l!==void 0?l:s}}return e}function rB(t){return t!==void 0}function iB(...t){return nB(...t.filter(rB))}function Qh(t,e,n=!0){const[r,a]=G.useState(e);return G.useEffect(()=>{if(n&&a(e),typeof window>"u"||!t)return;const s=t.subscribe(a);return()=>s.unsubscribe()},[t,n]),r}function ex(t){const e=wb(t),n=G.useMemo(()=>L7(e),[e]);return Qh(n,e.state)}function aB(t={}){const e=wb(t.room),[n,r]=G.useState(e.localParticipant),[a,s]=G.useState(n.isMicrophoneEnabled),[l,c]=G.useState(n.isMicrophoneEnabled),[h,p]=G.useState(n.lastMicrophoneError),[v,b]=G.useState(n.lastCameraError),[k,T]=G.useState(n.isMicrophoneEnabled),[E,R]=G.useState(void 0),[M,A]=G.useState(void 0),U=V=>{c(V.isCameraEnabled),s(V.isMicrophoneEnabled),T(V.isScreenShareEnabled),A(V.cameraTrack),R(V.microphoneTrack),p(V.participant.lastMicrophoneError),b(V.participant.lastCameraError),r(V.participant)};return G.useEffect(()=>{const V=NM(e.localParticipant).subscribe(U);return()=>V.unsubscribe()},[e]),{isMicrophoneEnabled:a,isScreenShareEnabled:k,isCameraEnabled:l,microphoneTrack:E,cameraTrack:M,lastMicrophoneError:h,lastCameraError:v,localParticipant:n}}function HM(t={}){const e=wb(t.room),[n,r]=G.useState([]);return G.useEffect(()=>{const a=U7(e,{additionalRoomEvents:t.updateOnlyOn}).subscribe(r);return()=>a.unsubscribe()},[e,JSON.stringify(t.updateOnlyOn)]),n}function oB(t=[De.Source.Camera,De.Source.Microphone,De.Source.ScreenShare,De.Source.ScreenShareAudio,De.Source.Unknown],e={}){const n=wb(e.room),[r,a]=G.useState([]),[s,l]=G.useState([]),c=G.useMemo(()=>t.map(h=>DM(h)?h.source:h),[JSON.stringify(t)]);return G.useEffect(()=>{const h=q7(n,c,{additionalRoomEvents:e.updateOnlyOn,onlySubscribed:e.onlySubscribed}).subscribe(({trackReferences:p,participants:v})=>{Ec.debug("setting track bundles",p,v),a(p),l(v)});return()=>h.unsubscribe()},[n,JSON.stringify(e.onlySubscribed),JSON.stringify(e.updateOnlyOn),JSON.stringify(t)]),G.useMemo(()=>{if(AM(t)){const h=lB(t,s),p=Array.from(r);return s.forEach(v=>{h.has(v.identity)&&(h.get(v.identity)??[]).forEach(b=>{if(r.find(({participant:T,publication:E})=>v.identity===T.identity&&E.source===b))return;Ec.debug(`Add ${b} placeholder for participant ${v.identity}.`);const k={participant:v,source:b};p.push(k)})}),p}else return r},[r,s,t])}function sB(t,e){const n=new Set(t);for(const r of e)n.delete(r);return n}function lB(t,e){const n=new Map;if(AM(t)){const r=t.filter(a=>a.withPlaceholder).map(a=>a.source);e.forEach(a=>{const s=a.getTrackPublications().map(c=>{var h;return(h=c.track)==null?void 0:h.source}).filter(c=>c!==void 0),l=Array.from(sB(new Set(r),new Set(s)));l.length>0&&n.set(a.identity,l)})}return n}function $M(t){const e=JT(),n=ex(e),r=G.useMemo(()=>n===Fn.Disconnected,[n]),a=G.useMemo(()=>$7(e),[e,t,r]),s=Qh(a.isSendingObservable,!1),l=Qh(a.messageObservable,[]);return{send:a.send,chatMessages:l,isSending:s}}function uB(t,e){const n=JT(),r=zM(),a=e?n.getParticipantByIdentity(e):r,s=G.useMemo(()=>a?W7(a,{sources:t}):void 0,[a==null?void 0:a.sid,a==null?void 0:a.identity,JSON.stringify(t)]);return Qh(s,[])}function cB(t){var e,n,r;const a=G.useMemo(()=>{var s;return(s=t==null?void 0:t.publication)!=null&&s.track?Y7(t==null?void 0:t.publication.track):void 0},[(e=t==null?void 0:t.publication)==null?void 0:e.track]);return Qh(a,{timestamp:Date.now(),rtpTimestamp:(r=(n=t==null?void 0:t.publication)==null?void 0:n.track)==null?void 0:r.rtpTimestamp})}const dB={bufferSize:100};function tx(t,e){const n={...dB,...e},[r,a]=G.useState([]),s=cB(t),l=c=>{var h;(h=n.onTranscription)==null||h.call(n,c),a(p=>A7(p,c.map(v=>D7(v,s)),n.bufferSize))};return G.useEffect(()=>{if(!(t!=null&&t.publication))return;const c=G7(t.publication).subscribe(h=>{l(...h)});return()=>{c.unsubscribe()}},[t&&RM(t),l]),{segments:r}}function fB(t={}){const e=zM(),n=t.participant??e,r=G.useMemo(()=>IM(n),[n]);return Qh(r,{attributes:n==null?void 0:n.attributes})}const qM="lk.agent.state";function hB(){const t=HM().find(l=>l.kind===_g.AGENT),e=uB([De.Source.Microphone],t==null?void 0:t.identity)[0],{segments:n}=tx(e),r=ex(),{attributes:a}=fB({participant:t}),s=G.useMemo(()=>r===Fn.Disconnected?"disconnected":r===Fn.Connecting||!t||!(a!=null&&a[qM])?"connecting":a[qM],[a,t,r]);return{agent:t,state:s,audioTrack:e,agentTranscriptions:n,agentAttributes:a}}function pB(t,e={}){const[n,r]=G.useState(QT(t)),[a,s]=G.useState(n==null?void 0:n.isMuted),[l,c]=G.useState(n==null?void 0:n.isSubscribed),[h,p]=G.useState(n==null?void 0:n.track),[v,b]=G.useState("landscape"),k=G.useRef(),{className:T,trackObserver:E}=G.useMemo(()=>M7(t),[t.participant.sid??t.participant.identity,t.source,ZT(t)&&t.publication.trackSid]);return G.useEffect(()=>{const R=E.subscribe(M=>{Ec.debug("update track",M),r(M),s(M==null?void 0:M.isMuted),c(M==null?void 0:M.isSubscribed),p(M==null?void 0:M.track)});return()=>R==null?void 0:R.unsubscribe()},[E]),G.useEffect(()=>{var R,M;return h&&(k.current&&h.detach(k.current),(R=e.element)!=null&&R.current&&!(t.participant.isLocal&&(h==null?void 0:h.kind)==="audio")&&h.attach(e.element.current)),k.current=(M=e.element)==null?void 0:M.current,()=>{k.current&&(h==null||h.detach(k.current))}},[h,e.element]),G.useEffect(()=>{var R,M;if(typeof((R=n==null?void 0:n.dimensions)==null?void 0:R.width)=="number"&&typeof((M=n==null?void 0:n.dimensions)==null?void 0:M.height)=="number"){const A=n.dimensions.width>n.dimensions.height?"landscape":"portrait";b(A)}},[n]),{publication:n,isMuted:a,isSubscribed:l,track:h,elementProps:iB(e.props,{className:T,"data-lk-local-participant":t.participant.isLocal,"data-lk-source":n==null?void 0:n.source,...(n==null?void 0:n.kind)==="video"&&{"data-lk-orientation":v}})}}var nx,WM;function mB(){if(WM)return nx;WM=1;var t="Expected a function",e=NaN,n="[object Symbol]",r=/^\s+|\s+$/g,a=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,l=/^0o[0-7]+$/i,c=parseInt,h=typeof mb=="object"&&mb&&mb.Object===Object&&mb,p=typeof self=="object"&&self&&self.Object===Object&&self,v=h||p||Function("return this")(),b=Object.prototype,k=b.toString,T=Math.max,E=Math.min,R=function(){return v.Date.now()};function M(I,N,ne){var X,se,$,oe,J,xe,ke=0,Ge=!1,Je=!1,je=!0;if(typeof I!="function")throw new TypeError(t);N=j(N)||0,A(ne)&&(Ge=!!ne.leading,Je="maxWait"in ne,$=Je?T(j(ne.maxWait)||0,N):$,je="trailing"in ne?!!ne.trailing:je);function ve(bt){var it=X,xt=se;return X=se=void 0,ke=bt,oe=I.apply(xt,it),oe}function He(bt){return ke=bt,J=setTimeout(Ce,N),Ge?ve(bt):oe}function z(bt){var it=bt-xe,xt=bt-ke,tn=N-it;return Je?E(tn,$-xt):tn}function ee(bt){var it=bt-xe,xt=bt-ke;return xe===void 0||it>=N||it<0||Je&&xt>=$}function Ce(){var bt=R();if(ee(bt))return H(bt);J=setTimeout(Ce,z(bt))}function H(bt){return J=void 0,je&&X?ve(bt):(X=se=void 0,oe)}function Ct(){J!==void 0&&clearTimeout(J),ke=0,X=xe=se=J=void 0}function Rt(){return J===void 0?oe:H(R())}function ht(){var bt=R(),it=ee(bt);if(X=arguments,se=this,xe=bt,it){if(J===void 0)return He(xe);if(Je)return J=setTimeout(Ce,N),ve(xe)}return J===void 0&&(J=setTimeout(Ce,N)),oe}return ht.cancel=Ct,ht.flush=Rt,ht}function A(I){var N=typeof I;return!!I&&(N=="object"||N=="function")}function U(I){return!!I&&typeof I=="object"}function V(I){return typeof I=="symbol"||U(I)&&k.call(I)==n}function j(I){if(typeof I=="number")return I;if(V(I))return e;if(A(I)){var N=typeof I.valueOf=="function"?I.valueOf():I;I=A(N)?N+"":N}if(typeof I!="string")return I===0?I:+I;I=I.replace(r,"");var ne=s.test(I);return ne||l.test(I)?c(I.slice(2),ne?2:8):a.test(I)?e:+I}return nx=M,nx}mB();const gB=G.forwardRef(function({trackRef:t,onSubscriptionStatusChanged:e,volume:n,...r},a){const s=Q7(t),l=G.useRef(null);G.useImperativeHandle(a,()=>l.current);const{elementProps:c,isSubscribed:h,track:p,publication:v}=pB(s,{element:l,props:r});return G.useEffect(()=>{e==null||e(!!h)},[h,e]),G.useEffect(()=>{p===void 0||n===void 0||(p instanceof $O?p.setVolume(n):Ec.warn("Volume can only be set on remote audio tracks."))},[n,p]),G.useEffect(()=>{v===void 0||r.muted===void 0||(v instanceof GO?v.setEnabled(!r.muted):Ec.warn("Can only call setEnabled on remote track publications."))},[r.muted,v,p]),G.createElement("audio",{ref:l,...c})});function vB({volume:t,muted:e}){const n=oB([De.Source.Microphone,De.Source.ScreenShareAudio,De.Source.Unknown],{updateOnlyOn:[],onlySubscribed:!0}).filter(r=>!r.participant.isLocal&&r.publication.kind===De.Kind.Audio);return G.createElement("div",{style:{display:"none"}},n.map(r=>G.createElement(gB,{key:RM(r),trackRef:r,volume:t,muted:e})))}const rx=G.createContext({});function ix(t){const e=G.useRef(null);return e.current===null&&(e.current=t()),e.current}const _b=G.createContext(null),ax=G.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});class yB extends G.Component{getSnapshotBeforeUpdate(e){const n=this.props.childRef.current;if(n&&e.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=n.offsetHeight||0,r.width=n.offsetWidth||0,r.top=n.offsetTop,r.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function bB({children:t,isPresent:e}){const n=G.useId(),r=G.useRef(null),a=G.useRef({width:0,height:0,top:0,left:0}),{nonce:s}=G.useContext(ax);return G.useInsertionEffect(()=>{const{width:l,height:c,top:h,left:p}=a.current;if(e||!r.current||!l||!c)return;r.current.dataset.motionPopId=n;const v=document.createElement("style");return s&&(v.nonce=s),document.head.appendChild(v),v.sheet&&v.sheet.insertRule(`
|
|
281
281
|
[data-motion-pop-id="${n}"] {
|
|
@@ -395,7 +395,7 @@ a=extmap-allow-mixed`)!==-1){const s=a.sdp.split(`
|
|
|
395
395
|
*
|
|
396
396
|
* This source code is licensed under the ISC license.
|
|
397
397
|
* See the LICENSE file in the root directory of this source tree.
|
|
398
|
-
*/const lW=Bi("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),uW=({fill:t,width:e,height:n,size:r=18,className:a,style:s})=>W.jsx("svg",{viewBox:"0 0 19 19",xmlns:"http://www.w3.org/2000/svg",className:a,width:e||r,height:n||r,fill:t||"currentColor",style:s,children:W.jsx("path",{d:"M11.5253 1.30593C11.5508 1.21075 11.5947 1.12151 11.6547 1.04333C11.7147 0.965143 11.7894 0.899537 11.8748 0.85026C11.9601 0.800983 12.0543 0.769 12.152 0.756139C12.2496 0.743278 12.3489 0.749791 12.4441 0.775306C13.8344 1.13807 15.103 1.86491 16.119 2.88096C17.1351 3.89702 17.8619 5.16556 18.2247 6.55593C18.2502 6.6511 18.2567 6.75036 18.2439 6.84805C18.231 6.94573 18.199 7.03993 18.1497 7.12525C18.1005 7.21057 18.0349 7.28534 17.9567 7.3453C17.8785 7.40526 17.7893 7.44922 17.6941 7.47468C17.6307 7.49132 17.5655 7.49983 17.5 7.49999C17.3347 7.49999 17.1741 7.44539 17.043 7.34469C16.912 7.24399 16.8179 7.10282 16.7753 6.94312C16.4795 5.80811 15.8863 4.77253 15.0569 3.94314C14.2275 3.11375 13.1919 2.52054 12.0569 2.22468C11.9616 2.19932 11.8723 2.15543 11.794 2.09552C11.7157 2.0356 11.65 1.96084 11.6006 1.87551C11.5513 1.79018 11.5192 1.69595 11.5063 1.59822C11.4933 1.50048 11.4998 1.40116 11.5253 1.30593ZM11.3069 5.22468C12.5997 5.56968 13.4303 6.40031 13.7753 7.69312C13.8179 7.85282 13.912 7.99399 14.043 8.09469C14.1741 8.19539 14.3347 8.24999 14.5 8.24999C14.5655 8.24983 14.6307 8.24132 14.6941 8.22468C14.7893 8.19922 14.8785 8.15526 14.9567 8.0953C15.0349 8.03534 15.1005 7.96057 15.1497 7.87525C15.199 7.78993 15.231 7.69573 15.2439 7.59805C15.2567 7.50036 15.2502 7.4011 15.2247 7.30593C14.7447 5.50968 13.4903 4.25531 11.6941 3.77531C11.5019 3.72396 11.2971 3.75107 11.1249 3.85067C10.9527 3.95027 10.8271 4.1142 10.7758 4.3064C10.7244 4.4986 10.7516 4.70332 10.8512 4.87553C10.9508 5.04774 11.1147 5.17334 11.3069 5.22468ZM18.9888 14.1637C18.8216 15.4341 18.1977 16.6001 17.2337 17.4441C16.2696 18.2881 15.0313 18.7523 13.75 18.75C6.30626 18.75 0.250008 12.6937 0.250008 5.24999C0.247712 3.9687 0.711903 2.73039 1.55588 1.76633C2.39986 0.802276 3.56592 0.178406 4.83626 0.0112434C5.1575 -0.0279808 5.4828 0.0377391 5.76362 0.198592C6.04444 0.359445 6.2657 0.606804 6.39438 0.903743L8.37438 5.32406V5.33531C8.4729 5.56261 8.51359 5.81077 8.49282 6.05763C8.47204 6.30449 8.39044 6.54236 8.25532 6.74999C8.23845 6.77531 8.22063 6.79874 8.20188 6.82218L6.25001 9.13593C6.9522 10.5628 8.4447 12.0422 9.89032 12.7462L12.1722 10.8047C12.1946 10.7858 12.2181 10.7683 12.2425 10.7522C12.45 10.6138 12.6887 10.5293 12.937 10.5064C13.1853 10.4835 13.4354 10.5229 13.6647 10.6209L13.6769 10.6266L18.0934 12.6056C18.3909 12.7338 18.6389 12.9549 18.8003 13.2358C18.9616 13.5166 19.0278 13.8422 18.9888 14.1637ZM17.5 13.9762C17.5 13.9762 17.4934 13.9762 17.4897 13.9762L13.0834 12.0028L10.8006 13.9444C10.7785 13.9631 10.7553 13.9807 10.7313 13.9969C10.5154 14.1409 10.2659 14.2264 10.0071 14.2452C9.74828 14.2639 9.48904 14.2152 9.2547 14.1037C7.49876 13.2553 5.74845 11.5181 4.89907 9.78093C4.7866 9.5483 4.73613 9.29055 4.75255 9.03267C4.76898 8.7748 4.85174 8.52554 4.99282 8.30906C5.00872 8.28364 5.02659 8.2595 5.04626 8.23687L7.00001 5.92031L5.03126 1.51406C5.03089 1.51032 5.03089 1.50655 5.03126 1.50281C4.12212 1.6214 3.28739 2.06733 2.68339 2.7571C2.0794 3.44687 1.74755 4.33316 1.75001 5.24999C1.75348 8.43153 3.01888 11.4818 5.26856 13.7314C7.51825 15.9811 10.5685 17.2465 13.75 17.25C14.6663 17.2531 15.5523 16.9225 16.2425 16.3198C16.9327 15.7171 17.3797 14.8837 17.5 13.9753V13.9762Z"})}),cW=({fill:t,width:e,height:n,size:r=18,className:a,style:s})=>W.jsx("svg",{viewBox:"0 0 17 17",xmlns:"http://www.w3.org/2000/svg",className:a,width:e||r,height:n||r,fill:t||"currentColor",style:s,children:W.jsx("path",{d:"M15.3727 11.3798L11.6922 9.73056L11.682 9.72587C11.491 9.64415 11.2825 9.61135 11.0756 9.63045C10.8687 9.64954 10.6698 9.71993 10.4969 9.83524C10.4765 9.84869 10.457 9.86329 10.4383 9.87899L8.53673 11.5001C7.33204 10.9149 6.08829 9.68055 5.50313 8.49149L7.12657 6.56102C7.14219 6.54149 7.15704 6.52196 7.1711 6.50087C7.28394 6.32845 7.35239 6.13081 7.37039 5.92553C7.38838 5.72026 7.35534 5.51372 7.27423 5.3243V5.31493L5.62032 1.62821C5.51309 1.38076 5.3287 1.17463 5.09468 1.04058C4.86067 0.906541 4.58958 0.851774 4.32188 0.884461C3.26326 1.02376 2.29155 1.54366 1.58824 2.34704C0.884919 3.15042 0.498093 4.18234 0.500007 5.25009C0.500007 11.4532 5.54688 16.5001 11.75 16.5001C12.8177 16.502 13.8497 16.1152 14.6531 15.4119C15.4564 14.7085 15.9763 13.7368 16.1156 12.6782C16.1484 12.4106 16.0937 12.1396 15.9598 11.9056C15.8259 11.6716 15.62 11.4871 15.3727 11.3798ZM11.75 15.2501C9.09873 15.2472 6.55687 14.1927 4.68214 12.318C2.8074 10.4432 1.7529 7.90136 1.75001 5.25009C1.74707 4.48719 2.02192 3.7493 2.52324 3.17423C3.02456 2.59916 3.71806 2.22623 4.47423 2.12509C4.47392 2.1282 4.47392 2.13134 4.47423 2.13446L6.11485 5.80634L4.50001 7.73915C4.48362 7.75801 4.46873 7.77812 4.45548 7.7993C4.33791 7.97971 4.26894 8.18743 4.25525 8.40232C4.24157 8.61722 4.28362 8.83201 4.37735 9.02587C5.08516 10.4735 6.54376 11.9212 8.00704 12.6282C8.20232 12.7211 8.41835 12.7617 8.63403 12.7461C8.8497 12.7304 9.05763 12.6592 9.23751 12.5391C9.25757 12.5256 9.27687 12.511 9.29532 12.4954L11.1945 10.8751L14.8664 12.5196C14.8664 12.5196 14.8727 12.5196 14.875 12.5196C14.7751 13.2769 14.4027 13.9718 13.8275 14.4743C13.2524 14.9769 12.5138 15.2527 11.75 15.2501Z"})}),dW=({fill:t,width:e,height:n,size:r=18,className:a,style:s})=>W.jsx("svg",{viewBox:"0 0 20 16",xmlns:"http://www.w3.org/2000/svg",className:a,width:e||r,height:n||r,fill:t||"currentColor",style:s,children:W.jsx("path",{d:"M4.21328 0.704679C4.15839 0.642809 4.09177 0.592448 4.01728 0.556515C3.94278 0.520582 3.8619 0.499791 3.77931 0.495348C3.69672 0.490905 3.61408 0.502898 3.53616 0.530632C3.45824 0.558365 3.3866 0.601288 3.32539 0.656913C3.26419 0.712537 3.21463 0.779756 3.17959 0.854675C3.14455 0.929593 3.12473 1.01072 3.12128 1.09336C3.11783 1.17599 3.13081 1.25849 3.15948 1.33607C3.18814 1.41365 3.23192 1.48477 3.28828 1.5453L5.44375 3.91718C4.12152 4.47256 2.92021 5.28033 1.90703 6.2953C0.344526 7.8578 0.194526 10.1594 1.54062 11.8945C1.70579 12.1059 1.93457 12.2585 2.19315 12.3298C2.45172 12.4011 2.72639 12.3874 2.97656 12.2906L6.80468 10.9336L6.82734 10.925C7.02045 10.8478 7.19125 10.7236 7.32426 10.5637C7.45727 10.4039 7.54829 10.2133 7.58906 10.0094L8.05 7.7039C8.26906 7.62838 8.49236 7.56578 8.71875 7.5164L15.7898 15.2953C15.8447 15.3572 15.9113 15.4075 15.9858 15.4435C16.0603 15.4794 16.1412 15.5002 16.2238 15.5046C16.3064 15.5091 16.389 15.4971 16.467 15.4694C16.5449 15.4416 16.6165 15.3987 16.6777 15.3431C16.7389 15.2874 16.7885 15.2202 16.8235 15.1453C16.8586 15.0704 16.8784 14.9893 16.8818 14.9066C16.8853 14.824 16.8723 14.7415 16.8436 14.6639C16.815 14.5863 16.7712 14.5152 16.7148 14.4547L4.21328 0.704679ZM7.62734 6.52655C7.42378 6.59909 7.24251 6.72315 7.1012 6.88664C6.9599 7.05013 6.86339 7.24745 6.82109 7.45937L6.36015 9.76405L2.54921 11.1156C2.5414 11.1156 2.53593 11.1258 2.52812 11.1289C1.56484 9.88671 1.66874 8.29921 2.79062 7.1789C3.79625 6.17293 5.00827 5.39726 6.34296 4.90546L7.77265 6.4789C7.72421 6.49452 7.67578 6.50937 7.62734 6.52655ZM18.4594 11.8945C18.2942 12.1059 18.0654 12.2585 17.8068 12.3298C17.5483 12.4011 17.2736 12.3874 17.0234 12.2906L16.3008 12.0344C16.2234 12.0069 16.1522 11.9645 16.0913 11.9096C16.0303 11.8546 15.9808 11.7882 15.9455 11.7141C15.8742 11.5644 15.8653 11.3925 15.9207 11.2363C15.9481 11.159 15.9906 11.0878 16.0455 11.0268C16.1005 10.9658 16.1669 10.9163 16.241 10.881C16.3907 10.8097 16.5625 10.8008 16.7187 10.8562L17.4508 11.1156L17.4742 11.125C18.4352 9.88671 18.3336 8.29921 17.2094 7.1789C15.2047 5.17421 12.375 4.11093 9.44765 4.26405C9.36558 4.26831 9.28346 4.25636 9.20601 4.22889C9.12855 4.20141 9.05726 4.15895 8.99621 4.10392C8.93517 4.0489 8.88556 3.98238 8.85021 3.90819C8.81487 3.83399 8.79449 3.75355 8.79023 3.67148C8.78597 3.5894 8.79792 3.50729 8.8254 3.42983C8.85287 3.35237 8.89534 3.28109 8.95036 3.22004C9.00539 3.15899 9.0719 3.10938 9.1461 3.07404C9.2203 3.03869 9.30073 3.01831 9.38281 3.01405C12.6641 2.84296 15.8383 4.03749 18.093 6.2953C19.6547 7.85702 19.8055 10.1594 18.4594 11.8945Z"})}),fW=({fill:t,width:e,height:n,size:r=18,className:a,style:s})=>W.jsx("svg",{viewBox:"0 0 14 19",xmlns:"http://www.w3.org/2000/svg",className:a,width:e||r,height:n||r,fill:t||"currentColor",style:s,children:W.jsx("path",{d:"M7 12.75C7.99424 12.749 8.94747 12.3535 9.65051 11.6505C10.3535 10.9475 10.749 9.99424 10.75 9V4C10.75 3.00544 10.3549 2.05161 9.65165 1.34835C8.94839 0.645088 7.99456 0.25 7 0.25C6.00544 0.25 5.05161 0.645088 4.34835 1.34835C3.64509 2.05161 3.25 3.00544 3.25 4V9C3.25103 9.99424 3.64645 10.9475 4.34949 11.6505C5.05253 12.3535 6.00576 12.749 7 12.75ZM4.5 4C4.5 3.33696 4.76339 2.70107 5.23223 2.23223C5.70107 1.76339 6.33696 1.5 7 1.5C7.66304 1.5 8.29893 1.76339 8.76777 2.23223C9.23661 2.70107 9.5 3.33696 9.5 4V9C9.5 9.66304 9.23661 10.2989 8.76777 10.7678C8.29893 11.2366 7.66304 11.5 7 11.5C6.33696 11.5 5.70107 11.2366 5.23223 10.7678C4.76339 10.2989 4.5 9.66304 4.5 9V4ZM7.625 15.2188V17.75C7.625 17.9158 7.55915 18.0747 7.44194 18.1919C7.32473 18.3092 7.16576 18.375 7 18.375C6.83424 18.375 6.67527 18.3092 6.55806 18.1919C6.44085 18.0747 6.375 17.9158 6.375 17.75V15.2188C4.8341 15.062 3.40607 14.3393 2.36707 13.1907C1.32806 12.042 0.751903 10.5489 0.75 9C0.75 8.83424 0.815848 8.67527 0.933058 8.55806C1.05027 8.44085 1.20924 8.375 1.375 8.375C1.54076 8.375 1.69973 8.44085 1.81694 8.55806C1.93415 8.67527 2 8.83424 2 9C2 10.3261 2.52678 11.5979 3.46447 12.5355C4.40215 13.4732 5.67392 14 7 14C8.32608 14 9.59785 13.4732 10.5355 12.5355C11.4732 11.5979 12 10.3261 12 9C12 8.83424 12.0658 8.67527 12.1831 8.55806C12.3003 8.44085 12.4592 8.375 12.625 8.375C12.7908 8.375 12.9497 8.44085 13.0669 8.55806C13.1842 8.67527 13.25 8.83424 13.25 9C13.2481 10.5489 12.6719 12.042 11.6329 13.1907C10.5939 14.3393 9.1659 15.062 7.625 15.2188Z"})}),$I=({fill:t,width:e,height:n,size:r=18,className:a,style:s})=>W.jsx("svg",{viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",className:a,width:e||r,height:n||r,fill:t||"currentColor",style:s,children:W.jsx("path",{d:"M17.1305 13.5905C17.5623 12.6948 17.7742 11.709 17.7486 10.7149C17.7229 9.72084 17.4604 8.74725 16.983 7.87501C16.5055 7.00276 15.8267 6.25704 15.0032 5.69978C14.1796 5.14253 13.2349 4.78982 12.2477 4.67097C11.9192 3.9072 11.4416 3.21664 10.8429 2.63974C10.2442 2.06284 9.53637 1.6112 8.76093 1.31126C7.98549 1.01131 7.158 0.869103 6.32692 0.892953C5.49584 0.916802 4.67787 1.10623 3.9209 1.45015C3.16394 1.79407 2.48321 2.28556 1.91857 2.89584C1.35393 3.50612 0.916724 4.22293 0.632564 5.00429C0.348404 5.78565 0.222999 6.61585 0.263692 7.44628C0.304386 8.27671 0.510359 9.09067 0.869551 9.8405L0.301582 11.771C0.238079 11.9865 0.233833 12.2151 0.289291 12.4328C0.344749 12.6506 0.457861 12.8493 0.616727 13.0082C0.775593 13.167 0.97434 13.2801 1.19206 13.3356C1.40978 13.3911 1.63842 13.3868 1.85393 13.3233L3.7844 12.7553C4.40426 13.0532 5.06884 13.2472 5.75158 13.3296C6.08328 14.1068 6.56914 14.8086 7.17979 15.3927C7.79043 15.9768 8.51318 16.431 9.30434 16.7279C10.0955 17.0247 10.9386 17.158 11.7828 17.1198C12.6269 17.0815 13.4546 16.8725 14.2156 16.5053L16.1461 17.0733C16.3615 17.1367 16.5901 17.141 16.8077 17.0855C17.0253 17.0301 17.224 16.9171 17.3828 16.7583C17.5417 16.5996 17.6548 16.4009 17.7103 16.1834C17.7659 15.9658 17.7618 15.7372 17.6985 15.5218L17.1305 13.5905ZM3.84377 11.4608C3.78404 11.461 3.72463 11.4694 3.66721 11.4858L1.50002 12.1249L2.1383 9.95613C2.1837 9.79944 2.16603 9.63122 2.08908 9.48738C1.5237 8.43002 1.35711 7.2047 1.61968 6.03477C1.88225 4.86485 2.5565 3.82824 3.51951 3.1139C4.48252 2.39957 5.67017 2.05508 6.86595 2.14324C8.06173 2.2314 9.18601 2.74633 10.0339 3.59417C10.8817 4.44201 11.3966 5.5663 11.4848 6.76208C11.5729 7.95786 11.2285 9.1455 10.5141 10.1085C9.79979 11.0715 8.76318 11.7458 7.59325 12.0083C6.42333 12.2709 5.198 12.1043 4.14065 11.5389C4.04972 11.4886 3.94768 11.4618 3.84377 11.4608ZM15.8586 13.7053L16.5 15.8749L14.3313 15.2366C14.1746 15.1912 14.0064 15.2089 13.8625 15.2858C12.7116 15.9004 11.3662 16.0411 10.113 15.678C8.85983 15.3149 7.79803 14.4767 7.15393 13.3421C8.00969 13.2527 8.83776 12.9875 9.58619 12.5631C10.3346 12.1386 10.9873 11.5641 11.5032 10.8755C12.0191 10.1869 12.3871 9.39916 12.5842 8.56163C12.7813 7.72409 12.8032 6.85486 12.6485 6.00847C13.3941 6.18423 14.0893 6.52896 14.6806 7.01605C15.2718 7.50315 15.7432 8.11959 16.0584 8.81779C16.3736 9.51599 16.5242 10.2773 16.4985 11.0429C16.4728 11.8085 16.2715 12.558 15.9102 13.2335C15.8324 13.3782 15.8147 13.5477 15.861 13.7053H15.8586Z"})}),hW=({fill:t,width:e,height:n,size:r=18,className:a})=>W.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 256 256",className:a,width:e||r,height:n||r,fill:t||"currentColor",children:W.jsx("path",{d:"M227.32,28.68a16,16,0,0,0-15.66-4.08l-.15,0L19.57,82.84a16,16,0,0,0-2.49,29.8L102,154l41.3,84.87A15.86,15.86,0,0,0,157.74,248q.69,0,1.38-.06a15.88,15.88,0,0,0,14-11.51l58.2-191.94c0-.05,0-.1,0-.15A16,16,0,0,0,227.32,28.68ZM157.83,231.85l-.05.14,0-.07-40.06-82.3,48-48a8,8,0,0,0-11.31-11.31l-48,48L24.08,98.25l-.07,0,.14,0L216,40Z"})}),qI={primaryColor:"#313335",primaryTextColor:"#ffffff",backgroundColor:"#fafafa",surfaceColor:"#F3F3F5",textColor:"#212121",mutedTextColor:"#11111180",borderColor:"#e5e5e5",errorColor:"#ef4444",successColor:"#10b981",buttonStyle:"rounded",borderRadius:"20px",fontFamily:"inherit"};function WI(t){return{...qI,...t}}function mw(t){switch(t){case"pill":return"9999px";case"square":return"6px";case"rounded":default:return"12px"}}const GI=G.createContext(qI);function pW({theme:t,children:e}){const n=G.useMemo(()=>WI(t),[t]);return W.jsx(GI.Provider,{value:n,children:e})}function Zo(){return G.useContext(GI)}function YI(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var a=t.length;for(e=0;e<a;e++)t[e]&&(n=YI(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function KI(){for(var t,e,n=0,r="",a=arguments.length;n<a;n++)(t=arguments[n])&&(e=YI(t))&&(r&&(r+=" "),r+=e);return r}const gw="-",mW=t=>{const e=vW(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:l=>{const c=l.split(gw);return c[0]===""&&c.length!==1&&c.shift(),ZI(c,e)||gW(l)},getConflictingClassGroupIds:(l,c)=>{const h=n[l]||[];return c&&r[l]?[...h,...r[l]]:h}}},ZI=(t,e)=>{var l;if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),a=r?ZI(t.slice(1),r):void 0;if(a)return a;if(e.validators.length===0)return;const s=t.join(gw);return(l=e.validators.find(({validator:c})=>c(s)))==null?void 0:l.classGroupId},QI=/^\[(.+)\]$/,gW=t=>{if(QI.test(t)){const e=QI.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},vW=t=>{const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return bW(Object.entries(t.classGroups),n).forEach(([s,l])=>{vw(l,r,s,e)}),r},vw=(t,e,n,r)=>{t.forEach(a=>{if(typeof a=="string"){const s=a===""?e:XI(e,a);s.classGroupId=n;return}if(typeof a=="function"){if(yW(a)){vw(a(r),e,n,r);return}e.validators.push({validator:a,classGroupId:n});return}Object.entries(a).forEach(([s,l])=>{vw(l,XI(e,s),n,r)})})},XI=(t,e)=>{let n=t;return e.split(gw).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},yW=t=>t.isThemeGetter,bW=(t,e)=>e?t.map(([n,r])=>{const a=r.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([l,c])=>[e+l,c])):s);return[n,a]}):t,SW=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;const a=(s,l)=>{n.set(s,l),e++,e>t&&(e=0,r=n,n=new Map)};return{get(s){let l=n.get(s);if(l!==void 0)return l;if((l=r.get(s))!==void 0)return a(s,l),l},set(s,l){n.has(s)?n.set(s,l):a(s,l)}}},JI="!",CW=t=>{const{separator:e,experimentalParseClassName:n}=t,r=e.length===1,a=e[0],s=e.length,l=c=>{const h=[];let p=0,v=0,b;for(let M=0;M<c.length;M++){let A=c[M];if(p===0){if(A===a&&(r||c.slice(M,M+s)===e)){h.push(c.slice(v,M)),v=M+s;continue}if(A==="/"){b=M;continue}}A==="["?p++:A==="]"&&p--}const k=h.length===0?c:c.substring(v),T=k.startsWith(JI),E=T?k.substring(1):k,R=b&&b>v?b-v:void 0;return{modifiers:h,hasImportantModifier:T,baseClassName:E,maybePostfixModifierPosition:R}};return n?c=>n({className:c,parseClassName:l}):l},kW=t=>{if(t.length<=1)return t;const e=[];let n=[];return t.forEach(r=>{r[0]==="["?(e.push(...n.sort(),r),n=[]):n.push(r)}),e.push(...n.sort()),e},TW=t=>({cache:SW(t.cacheSize),parseClassName:CW(t),...mW(t)}),xW=/\s+/,wW=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a}=e,s=[],l=t.trim().split(xW);let c="";for(let h=l.length-1;h>=0;h-=1){const p=l[h],{modifiers:v,hasImportantModifier:b,baseClassName:k,maybePostfixModifierPosition:T}=n(p);let E=!!T,R=r(E?k.substring(0,T):k);if(!R){if(!E){c=p+(c.length>0?" "+c:c);continue}if(R=r(k),!R){c=p+(c.length>0?" "+c:c);continue}E=!1}const M=kW(v).join(":"),A=b?M+JI:M,U=A+R;if(s.includes(U))continue;s.push(U);const V=a(R,E);for(let j=0;j<V.length;++j){const I=V[j];s.push(A+I)}c=p+(c.length>0?" "+c:c)}return c};function _W(){let t=0,e,n,r="";for(;t<arguments.length;)(e=arguments[t++])&&(n=e3(e))&&(r&&(r+=" "),r+=n);return r}const e3=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=e3(t[r]))&&(n&&(n+=" "),n+=e);return n};function EW(t,...e){let n,r,a,s=l;function l(h){const p=e.reduce((v,b)=>b(v),t());return n=TW(p),r=n.cache.get,a=n.cache.set,s=c,c(h)}function c(h){const p=r(h);if(p)return p;const v=wW(h,n);return a(h,v),v}return function(){return s(_W.apply(null,arguments))}}const Lr=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},t3=/^\[(?:([a-z-]+):)?(.+)\]$/i,RW=/^\d+\/\d+$/,PW=new Set(["px","full","screen"]),DW=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,AW=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,OW=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,MW=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,LW=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,gu=t=>up(t)||PW.has(t)||RW.test(t),Mc=t=>cp(t,"length",BW),up=t=>!!t&&!Number.isNaN(Number(t)),yw=t=>cp(t,"number",up),Jg=t=>!!t&&Number.isInteger(Number(t)),NW=t=>t.endsWith("%")&&up(t.slice(0,-1)),mn=t=>t3.test(t),Lc=t=>DW.test(t),IW=new Set(["length","size","percentage"]),UW=t=>cp(t,IW,n3),FW=t=>cp(t,"position",n3),jW=new Set(["image","url"]),VW=t=>cp(t,jW,$W),zW=t=>cp(t,"",HW),ev=()=>!0,cp=(t,e,n)=>{const r=t3.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1},BW=t=>AW.test(t)&&!OW.test(t),n3=()=>!1,HW=t=>MW.test(t),$W=t=>LW.test(t),qW=EW(()=>{const t=Lr("colors"),e=Lr("spacing"),n=Lr("blur"),r=Lr("brightness"),a=Lr("borderColor"),s=Lr("borderRadius"),l=Lr("borderSpacing"),c=Lr("borderWidth"),h=Lr("contrast"),p=Lr("grayscale"),v=Lr("hueRotate"),b=Lr("invert"),k=Lr("gap"),T=Lr("gradientColorStops"),E=Lr("gradientColorStopPositions"),R=Lr("inset"),M=Lr("margin"),A=Lr("opacity"),U=Lr("padding"),V=Lr("saturate"),j=Lr("scale"),I=Lr("sepia"),N=Lr("skew"),ne=Lr("space"),X=Lr("translate"),se=()=>["auto","contain","none"],$=()=>["auto","hidden","clip","visible","scroll"],oe=()=>["auto",mn,e],J=()=>[mn,e],xe=()=>["",gu,Mc],ke=()=>["auto",up,mn],Ge=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],Je=()=>["solid","dashed","dotted","double","none"],je=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ve=()=>["start","end","center","between","around","evenly","stretch"],He=()=>["","0",mn],z=()=>["auto","avoid","all","avoid-page","page","left","right","column"],ee=()=>[up,mn];return{cacheSize:500,separator:":",theme:{colors:[ev],spacing:[gu,Mc],blur:["none","",Lc,mn],brightness:ee(),borderColor:[t],borderRadius:["none","","full",Lc,mn],borderSpacing:J(),borderWidth:xe(),contrast:ee(),grayscale:He(),hueRotate:ee(),invert:He(),gap:J(),gradientColorStops:[t],gradientColorStopPositions:[NW,Mc],inset:oe(),margin:oe(),opacity:ee(),padding:J(),saturate:ee(),scale:ee(),sepia:He(),skew:ee(),space:J(),translate:J()},classGroups:{aspect:[{aspect:["auto","square","video",mn]}],container:["container"],columns:[{columns:[Lc]}],"break-after":[{"break-after":z()}],"break-before":[{"break-before":z()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...Ge(),mn]}],overflow:[{overflow:$()}],"overflow-x":[{"overflow-x":$()}],"overflow-y":[{"overflow-y":$()}],overscroll:[{overscroll:se()}],"overscroll-x":[{"overscroll-x":se()}],"overscroll-y":[{"overscroll-y":se()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[R]}],"inset-x":[{"inset-x":[R]}],"inset-y":[{"inset-y":[R]}],start:[{start:[R]}],end:[{end:[R]}],top:[{top:[R]}],right:[{right:[R]}],bottom:[{bottom:[R]}],left:[{left:[R]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Jg,mn]}],basis:[{basis:oe()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",mn]}],grow:[{grow:He()}],shrink:[{shrink:He()}],order:[{order:["first","last","none",Jg,mn]}],"grid-cols":[{"grid-cols":[ev]}],"col-start-end":[{col:["auto",{span:["full",Jg,mn]},mn]}],"col-start":[{"col-start":ke()}],"col-end":[{"col-end":ke()}],"grid-rows":[{"grid-rows":[ev]}],"row-start-end":[{row:["auto",{span:[Jg,mn]},mn]}],"row-start":[{"row-start":ke()}],"row-end":[{"row-end":ke()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",mn]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",mn]}],gap:[{gap:[k]}],"gap-x":[{"gap-x":[k]}],"gap-y":[{"gap-y":[k]}],"justify-content":[{justify:["normal",...ve()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...ve(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...ve(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[U]}],px:[{px:[U]}],py:[{py:[U]}],ps:[{ps:[U]}],pe:[{pe:[U]}],pt:[{pt:[U]}],pr:[{pr:[U]}],pb:[{pb:[U]}],pl:[{pl:[U]}],m:[{m:[M]}],mx:[{mx:[M]}],my:[{my:[M]}],ms:[{ms:[M]}],me:[{me:[M]}],mt:[{mt:[M]}],mr:[{mr:[M]}],mb:[{mb:[M]}],ml:[{ml:[M]}],"space-x":[{"space-x":[ne]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[ne]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",mn,e]}],"min-w":[{"min-w":[mn,e,"min","max","fit"]}],"max-w":[{"max-w":[mn,e,"none","full","min","max","fit","prose",{screen:[Lc]},Lc]}],h:[{h:[mn,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[mn,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[mn,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[mn,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Lc,Mc]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",yw]}],"font-family":[{font:[ev]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",mn]}],"line-clamp":[{"line-clamp":["none",up,yw]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",gu,mn]}],"list-image":[{"list-image":["none",mn]}],"list-style-type":[{list:["none","disc","decimal",mn]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[A]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[A]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Je(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",gu,Mc]}],"underline-offset":[{"underline-offset":["auto",gu,mn]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:J()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",mn]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",mn]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[A]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...Ge(),FW]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",UW]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},VW]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[E]}],"gradient-via-pos":[{via:[E]}],"gradient-to-pos":[{to:[E]}],"gradient-from":[{from:[T]}],"gradient-via":[{via:[T]}],"gradient-to":[{to:[T]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[c]}],"border-w-x":[{"border-x":[c]}],"border-w-y":[{"border-y":[c]}],"border-w-s":[{"border-s":[c]}],"border-w-e":[{"border-e":[c]}],"border-w-t":[{"border-t":[c]}],"border-w-r":[{"border-r":[c]}],"border-w-b":[{"border-b":[c]}],"border-w-l":[{"border-l":[c]}],"border-opacity":[{"border-opacity":[A]}],"border-style":[{border:[...Je(),"hidden"]}],"divide-x":[{"divide-x":[c]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[c]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[A]}],"divide-style":[{divide:Je()}],"border-color":[{border:[a]}],"border-color-x":[{"border-x":[a]}],"border-color-y":[{"border-y":[a]}],"border-color-s":[{"border-s":[a]}],"border-color-e":[{"border-e":[a]}],"border-color-t":[{"border-t":[a]}],"border-color-r":[{"border-r":[a]}],"border-color-b":[{"border-b":[a]}],"border-color-l":[{"border-l":[a]}],"divide-color":[{divide:[a]}],"outline-style":[{outline:["",...Je()]}],"outline-offset":[{"outline-offset":[gu,mn]}],"outline-w":[{outline:[gu,Mc]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:xe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[A]}],"ring-offset-w":[{"ring-offset":[gu,Mc]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Lc,zW]}],"shadow-color":[{shadow:[ev]}],opacity:[{opacity:[A]}],"mix-blend":[{"mix-blend":[...je(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":je()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[h]}],"drop-shadow":[{"drop-shadow":["","none",Lc,mn]}],grayscale:[{grayscale:[p]}],"hue-rotate":[{"hue-rotate":[v]}],invert:[{invert:[b]}],saturate:[{saturate:[V]}],sepia:[{sepia:[I]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[h]}],"backdrop-grayscale":[{"backdrop-grayscale":[p]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[v]}],"backdrop-invert":[{"backdrop-invert":[b]}],"backdrop-opacity":[{"backdrop-opacity":[A]}],"backdrop-saturate":[{"backdrop-saturate":[V]}],"backdrop-sepia":[{"backdrop-sepia":[I]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[l]}],"border-spacing-x":[{"border-spacing-x":[l]}],"border-spacing-y":[{"border-spacing-y":[l]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",mn]}],duration:[{duration:ee()}],ease:[{ease:["linear","in","out","in-out",mn]}],delay:[{delay:ee()}],animate:[{animate:["none","spin","ping","pulse","bounce",mn]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[j]}],"scale-x":[{"scale-x":[j]}],"scale-y":[{"scale-y":[j]}],rotate:[{rotate:[Jg,mn]}],"translate-x":[{"translate-x":[X]}],"translate-y":[{"translate-y":[X]}],"skew-x":[{"skew-x":[N]}],"skew-y":[{"skew-y":[N]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",mn]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",mn]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":J()}],"scroll-mx":[{"scroll-mx":J()}],"scroll-my":[{"scroll-my":J()}],"scroll-ms":[{"scroll-ms":J()}],"scroll-me":[{"scroll-me":J()}],"scroll-mt":[{"scroll-mt":J()}],"scroll-mr":[{"scroll-mr":J()}],"scroll-mb":[{"scroll-mb":J()}],"scroll-ml":[{"scroll-ml":J()}],"scroll-p":[{"scroll-p":J()}],"scroll-px":[{"scroll-px":J()}],"scroll-py":[{"scroll-py":J()}],"scroll-ps":[{"scroll-ps":J()}],"scroll-pe":[{"scroll-pe":J()}],"scroll-pt":[{"scroll-pt":J()}],"scroll-pr":[{"scroll-pr":J()}],"scroll-pb":[{"scroll-pb":J()}],"scroll-pl":[{"scroll-pl":J()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",mn]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[gu,Mc,yw]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});function xr(...t){return qW(KI(t))}const WW=t=>t.includes("agent")||t.includes("Agent");function bw(t,e,n){return{message:t.final?t.text:`${t.text} ...`,isSelf:n instanceof hb,timestamp:(e==null?void 0:e.timestamp)??Date.now(),name:n instanceof hb?"You":"Agent",...n instanceof hb?{}:{sourceUrl:(e==null?void 0:e.sourceUrl)||""}}}const GW=({callMode:t,isLoading:e,buttonConfig:n,isCalling:r,onCallTrigger:a})=>{var c,h,p;const s=Zo(),l=mw(s.buttonStyle);return W.jsx("button",{disabled:e,onClick:()=>a(t),className:xr("ringg_ai-h-12 ringg_ai-flex ringg_ai-items-center ringg_ai-justify-center ringg_ai-gap-2 ringg_ai-font-medium ringg_ai-transition-all","hover:ringg_ai-opacity-90 disabled:ringg_ai-opacity-50 disabled:ringg_ai-cursor-not-allowed","ringg_ai-call-btn",r?"ringg_ai-w-fit ringg_ai-px-6":"ringg_ai-w-full"),style:{backgroundColor:s.primaryColor,color:s.primaryTextColor,borderRadius:s.buttonStyle==="pill"?"9999px":l,...(c=n==null?void 0:n.call)==null?void 0:c.styles},children:e&&t==="audio"?W.jsxs(W.Fragment,{children:[W.jsx(Gb,{className:"ringg_ai-h-4 ringg_ai-w-4 ringg_ai-animate-spin"}),W.jsx("span",{children:"Connecting..."})]}):W.jsxs(W.Fragment,{children:[t==="audio"&&W.jsx(uW,{className:"ringg_ai-h-4 ringg_ai-w-4"}),t==="text"&&W.jsx($I,{className:"ringg_ai-h-4 ringg_ai-w-4"}),t==="audio"&&(((h=n==null?void 0:n.call)==null?void 0:h.textBeforeCall)||"Start Call"),t==="text"&&(((p=n==null?void 0:n.text)==null?void 0:p.textBeforeCall)||"Start Chat")]})})};var jn;(function(t){t.assertEqual=a=>a;function e(a){}t.assertIs=e;function n(a){throw new Error}t.assertNever=n,t.arrayToEnum=a=>{const s={};for(const l of a)s[l]=l;return s},t.getValidEnumValues=a=>{const s=t.objectKeys(a).filter(c=>typeof a[a[c]]!="number"),l={};for(const c of s)l[c]=a[c];return t.objectValues(l)},t.objectValues=a=>t.objectKeys(a).map(function(s){return a[s]}),t.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const s=[];for(const l in a)Object.prototype.hasOwnProperty.call(a,l)&&s.push(l);return s},t.find=(a,s)=>{for(const l of a)if(s(l))return l},t.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&isFinite(a)&&Math.floor(a)===a;function r(a,s=" | "){return a.map(l=>typeof l=="string"?`'${l}'`:l).join(s)}t.joinValues=r,t.jsonStringifyReplacer=(a,s)=>typeof s=="bigint"?s.toString():s})(jn||(jn={}));var Sw;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(Sw||(Sw={}));const St=jn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),vu=t=>{switch(typeof t){case"undefined":return St.undefined;case"string":return St.string;case"number":return isNaN(t)?St.nan:St.number;case"boolean":return St.boolean;case"function":return St.function;case"bigint":return St.bigint;case"symbol":return St.symbol;case"object":return Array.isArray(t)?St.array:t===null?St.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?St.promise:typeof Map<"u"&&t instanceof Map?St.map:typeof Set<"u"&&t instanceof Set?St.set:typeof Date<"u"&&t instanceof Date?St.date:St.object;default:return St.unknown}},We=jn.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),YW=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class Ao extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(s){return s.message},r={_errors:[]},a=s=>{for(const l of s.issues)if(l.code==="invalid_union")l.unionErrors.map(a);else if(l.code==="invalid_return_type")a(l.returnTypeError);else if(l.code==="invalid_arguments")a(l.argumentsError);else if(l.path.length===0)r._errors.push(n(l));else{let c=r,h=0;for(;h<l.path.length;){const p=l.path[h];h===l.path.length-1?(c[p]=c[p]||{_errors:[]},c[p]._errors.push(n(l))):c[p]=c[p]||{_errors:[]},c=c[p],h++}}};return a(this),r}static assert(e){if(!(e instanceof Ao))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,jn.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},r=[];for(const a of this.issues)a.path.length>0?(n[a.path[0]]=n[a.path[0]]||[],n[a.path[0]].push(e(a))):r.push(e(a));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Ao.create=t=>new Ao(t);const dp=(t,e)=>{let n;switch(t.code){case We.invalid_type:t.received===St.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case We.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,jn.jsonStringifyReplacer)}`;break;case We.unrecognized_keys:n=`Unrecognized key(s) in object: ${jn.joinValues(t.keys,", ")}`;break;case We.invalid_union:n="Invalid input";break;case We.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${jn.joinValues(t.options)}`;break;case We.invalid_enum_value:n=`Invalid enum value. Expected ${jn.joinValues(t.options)}, received '${t.received}'`;break;case We.invalid_arguments:n="Invalid function arguments";break;case We.invalid_return_type:n="Invalid function return type";break;case We.invalid_date:n="Invalid date";break;case We.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:jn.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case We.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case We.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case We.custom:n="Invalid input";break;case We.invalid_intersection_types:n="Intersection results could not be merged";break;case We.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case We.not_finite:n="Number must be finite";break;default:n=e.defaultError,jn.assertNever(t)}return{message:n}};let r3=dp;function KW(t){r3=t}function Yb(){return r3}const Kb=t=>{const{data:e,path:n,errorMaps:r,issueData:a}=t,s=[...n,...a.path||[]],l={...a,path:s};if(a.message!==void 0)return{...a,path:s,message:a.message};let c="";const h=r.filter(p=>!!p).slice().reverse();for(const p of h)c=p(l,{data:e,defaultError:c}).message;return{...a,path:s,message:c}},ZW=[];function lt(t,e){const n=Yb(),r=Kb({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===dp?void 0:dp].filter(a=>!!a)});t.common.issues.push(r)}class ya{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const a of n){if(a.status==="aborted")return Xt;a.status==="dirty"&&e.dirty(),r.push(a.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const a of n){const s=await a.key,l=await a.value;r.push({key:s,value:l})}return ya.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const a of n){const{key:s,value:l}=a;if(s.status==="aborted"||l.status==="aborted")return Xt;s.status==="dirty"&&e.dirty(),l.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof l.value<"u"||a.alwaysSet)&&(r[s.value]=l.value)}return{status:e.value,value:r}}}const Xt=Object.freeze({status:"aborted"}),fp=t=>({status:"dirty",value:t}),ja=t=>({status:"valid",value:t}),Cw=t=>t.status==="aborted",kw=t=>t.status==="dirty",sf=t=>t.status==="valid",tv=t=>typeof Promise<"u"&&t instanceof Promise;function Zb(t,e,n,r){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(t)}function i3(t,e,n,r,a){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,n),n}typeof SuppressedError=="function"&&SuppressedError;var Dt;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Dt||(Dt={}));var nv,rv;class gl{constructor(e,n,r,a){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=a}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const a3=(t,e)=>{if(sf(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Ao(t.common.issues);return this._error=n,this._error}}};function fn(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:a}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(l,c)=>{var h,p;const{message:v}=t;return l.code==="invalid_enum_value"?{message:v??c.defaultError}:typeof c.data>"u"?{message:(h=v??r)!==null&&h!==void 0?h:c.defaultError}:l.code!=="invalid_type"?{message:c.defaultError}:{message:(p=v??n)!==null&&p!==void 0?p:c.defaultError}},description:a}}class yn{get description(){return this._def.description}_getType(e){return vu(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:vu(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ya,ctx:{common:e.parent.common,data:e.data,parsedType:vu(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(tv(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){var r;const a={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:vu(e)},s=this._parseSync({data:e,path:a.path,parent:a});return a3(a,s)}"~validate"(e){var n,r;const a={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:vu(e)};if(!this["~standard"].async)try{const s=this._parseSync({data:e,path:[],parent:a});return sf(s)?{value:s.value}:{issues:a.common.issues}}catch(s){!((r=(n=s==null?void 0:s.message)===null||n===void 0?void 0:n.toLowerCase())===null||r===void 0)&&r.includes("encountered")&&(this["~standard"].async=!0),a.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:a}).then(s=>sf(s)?{value:s.value}:{issues:a.common.issues})}async parseAsync(e,n){const r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:vu(e)},a=this._parse({data:e,path:r.path,parent:r}),s=await(tv(a)?a:Promise.resolve(a));return a3(r,s)}refine(e,n){const r=a=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(a):n;return this._refinement((a,s)=>{const l=e(a),c=()=>s.addIssue({code:We.custom,...r(a)});return typeof Promise<"u"&&l instanceof Promise?l.then(h=>h?!0:(c(),!1)):l?!0:(c(),!1)})}refinement(e,n){return this._refinement((r,a)=>e(r)?!0:(a.addIssue(typeof n=="function"?n(r,a):n),!1))}_refinement(e){return new Ms({schema:this,typeName:Yt.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return yl.create(this,this._def)}nullable(){return Fc.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Os.create(this)}promise(){return gp.create(this,this._def)}or(e){return sv.create([this,e],this._def)}and(e){return lv.create(this,e,this._def)}transform(e){return new Ms({...fn(this._def),schema:this,typeName:Yt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new hv({...fn(this._def),innerType:this,defaultValue:n,typeName:Yt.ZodDefault})}brand(){return new ww({typeName:Yt.ZodBranded,type:this,...fn(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new pv({...fn(this._def),innerType:this,catchValue:n,typeName:Yt.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return mv.create(this,e)}readonly(){return gv.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const QW=/^c[^\s-]{8,}$/i,XW=/^[0-9a-z]+$/,JW=/^[0-9A-HJKMNP-TV-Z]{26}$/i,eG=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,tG=/^[a-z0-9_-]{21}$/i,nG=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,rG=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,iG=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,aG="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Tw;const oG=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,sG=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,lG=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,uG=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,cG=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,dG=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,o3="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",fG=new RegExp(`^${o3}$`);function s3(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function hG(t){return new RegExp(`^${s3(t)}$`)}function l3(t){let e=`${o3}T${s3(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function pG(t,e){return!!((e==="v4"||!e)&&oG.test(t)||(e==="v6"||!e)&&lG.test(t))}function mG(t,e){if(!nG.test(t))return!1;try{const[n]=t.split("."),r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),a=JSON.parse(atob(r));return!(typeof a!="object"||a===null||!a.typ||!a.alg||e&&a.alg!==e)}catch{return!1}}function gG(t,e){return!!((e==="v4"||!e)&&sG.test(t)||(e==="v6"||!e)&&uG.test(t))}class As extends yn{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==St.string){const s=this._getOrReturnCtx(e);return lt(s,{code:We.invalid_type,expected:St.string,received:s.parsedType}),Xt}const r=new ya;let a;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(a=this._getOrReturnCtx(e,a),lt(a,{code:We.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")e.data.length>s.value&&(a=this._getOrReturnCtx(e,a),lt(a,{code:We.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){const l=e.data.length>s.value,c=e.data.length<s.value;(l||c)&&(a=this._getOrReturnCtx(e,a),l?lt(a,{code:We.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):c&<(a,{code:We.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")iG.test(e.data)||(a=this._getOrReturnCtx(e,a),lt(a,{validation:"email",code:We.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")Tw||(Tw=new RegExp(aG,"u")),Tw.test(e.data)||(a=this._getOrReturnCtx(e,a),lt(a,{validation:"emoji",code:We.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")eG.test(e.data)||(a=this._getOrReturnCtx(e,a),lt(a,{validation:"uuid",code:We.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")tG.test(e.data)||(a=this._getOrReturnCtx(e,a),lt(a,{validation:"nanoid",code:We.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")QW.test(e.data)||(a=this._getOrReturnCtx(e,a),lt(a,{validation:"cuid",code:We.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")XW.test(e.data)||(a=this._getOrReturnCtx(e,a),lt(a,{validation:"cuid2",code:We.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")JW.test(e.data)||(a=this._getOrReturnCtx(e,a),lt(a,{validation:"ulid",code:We.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),lt(a,{validation:"url",code:We.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),lt(a,{validation:"regex",code:We.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(a=this._getOrReturnCtx(e,a),lt(a,{code:We.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(a=this._getOrReturnCtx(e,a),lt(a,{code:We.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(a=this._getOrReturnCtx(e,a),lt(a,{code:We.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?l3(s).test(e.data)||(a=this._getOrReturnCtx(e,a),lt(a,{code:We.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?fG.test(e.data)||(a=this._getOrReturnCtx(e,a),lt(a,{code:We.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?hG(s).test(e.data)||(a=this._getOrReturnCtx(e,a),lt(a,{code:We.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?rG.test(e.data)||(a=this._getOrReturnCtx(e,a),lt(a,{validation:"duration",code:We.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?pG(e.data,s.version)||(a=this._getOrReturnCtx(e,a),lt(a,{validation:"ip",code:We.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?mG(e.data,s.alg)||(a=this._getOrReturnCtx(e,a),lt(a,{validation:"jwt",code:We.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?gG(e.data,s.version)||(a=this._getOrReturnCtx(e,a),lt(a,{validation:"cidr",code:We.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?cG.test(e.data)||(a=this._getOrReturnCtx(e,a),lt(a,{validation:"base64",code:We.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?dG.test(e.data)||(a=this._getOrReturnCtx(e,a),lt(a,{validation:"base64url",code:We.invalid_string,message:s.message}),r.dirty()):jn.assertNever(s);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(a=>e.test(a),{validation:n,code:We.invalid_string,...Dt.errToObj(r)})}_addCheck(e){return new As({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Dt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Dt.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Dt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Dt.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Dt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Dt.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Dt.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Dt.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Dt.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Dt.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Dt.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Dt.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Dt.errToObj(e)})}datetime(e){var n,r;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(n=e==null?void 0:e.offset)!==null&&n!==void 0?n:!1,local:(r=e==null?void 0:e.local)!==null&&r!==void 0?r:!1,...Dt.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...Dt.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Dt.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...Dt.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...Dt.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...Dt.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...Dt.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...Dt.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...Dt.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...Dt.errToObj(n)})}nonempty(e){return this.min(1,Dt.errToObj(e))}trim(){return new As({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new As({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new As({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}As.create=t=>{var e;return new As({checks:[],typeName:Yt.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...fn(t)})};function vG(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,a=n>r?n:r,s=parseInt(t.toFixed(a).replace(".","")),l=parseInt(e.toFixed(a).replace(".",""));return s%l/Math.pow(10,a)}class Nc extends yn{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==St.number){const s=this._getOrReturnCtx(e);return lt(s,{code:We.invalid_type,expected:St.number,received:s.parsedType}),Xt}let r;const a=new ya;for(const s of this._def.checks)s.kind==="int"?jn.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),lt(r,{code:We.invalid_type,expected:"integer",received:"float",message:s.message}),a.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),lt(r,{code:We.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),lt(r,{code:We.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="multipleOf"?vG(e.data,s.value)!==0&&(r=this._getOrReturnCtx(e,r),lt(r,{code:We.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),lt(r,{code:We.not_finite,message:s.message}),a.dirty()):jn.assertNever(s);return{status:a.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,Dt.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Dt.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Dt.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Dt.toString(n))}setLimit(e,n,r,a){return new Nc({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Dt.toString(a)}]})}_addCheck(e){return new Nc({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Dt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Dt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Dt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Dt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Dt.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Dt.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:Dt.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Dt.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Dt.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&jn.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}}Nc.create=t=>new Nc({checks:[],typeName:Yt.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...fn(t)});class Ic extends yn{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==St.bigint)return this._getInvalidInput(e);let r;const a=new ya;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),lt(r,{code:We.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),lt(r,{code:We.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),lt(r,{code:We.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):jn.assertNever(s);return{status:a.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return lt(n,{code:We.invalid_type,expected:St.bigint,received:n.parsedType}),Xt}gte(e,n){return this.setLimit("min",e,!0,Dt.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Dt.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Dt.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Dt.toString(n))}setLimit(e,n,r,a){return new Ic({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Dt.toString(a)}]})}_addCheck(e){return new Ic({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Dt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Dt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Dt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Dt.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Dt.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}Ic.create=t=>{var e;return new Ic({checks:[],typeName:Yt.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...fn(t)})};class iv extends yn{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==St.boolean){const r=this._getOrReturnCtx(e);return lt(r,{code:We.invalid_type,expected:St.boolean,received:r.parsedType}),Xt}return ja(e.data)}}iv.create=t=>new iv({typeName:Yt.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...fn(t)});class lf extends yn{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==St.date){const s=this._getOrReturnCtx(e);return lt(s,{code:We.invalid_type,expected:St.date,received:s.parsedType}),Xt}if(isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return lt(s,{code:We.invalid_date}),Xt}const r=new ya;let a;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(a=this._getOrReturnCtx(e,a),lt(a,{code:We.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(a=this._getOrReturnCtx(e,a),lt(a,{code:We.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):jn.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new lf({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:Dt.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:Dt.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}lf.create=t=>new lf({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:Yt.ZodDate,...fn(t)});class Qb extends yn{_parse(e){if(this._getType(e)!==St.symbol){const r=this._getOrReturnCtx(e);return lt(r,{code:We.invalid_type,expected:St.symbol,received:r.parsedType}),Xt}return ja(e.data)}}Qb.create=t=>new Qb({typeName:Yt.ZodSymbol,...fn(t)});class av extends yn{_parse(e){if(this._getType(e)!==St.undefined){const r=this._getOrReturnCtx(e);return lt(r,{code:We.invalid_type,expected:St.undefined,received:r.parsedType}),Xt}return ja(e.data)}}av.create=t=>new av({typeName:Yt.ZodUndefined,...fn(t)});class ov extends yn{_parse(e){if(this._getType(e)!==St.null){const r=this._getOrReturnCtx(e);return lt(r,{code:We.invalid_type,expected:St.null,received:r.parsedType}),Xt}return ja(e.data)}}ov.create=t=>new ov({typeName:Yt.ZodNull,...fn(t)});class hp extends yn{constructor(){super(...arguments),this._any=!0}_parse(e){return ja(e.data)}}hp.create=t=>new hp({typeName:Yt.ZodAny,...fn(t)});class uf extends yn{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ja(e.data)}}uf.create=t=>new uf({typeName:Yt.ZodUnknown,...fn(t)});class yu extends yn{_parse(e){const n=this._getOrReturnCtx(e);return lt(n,{code:We.invalid_type,expected:St.never,received:n.parsedType}),Xt}}yu.create=t=>new yu({typeName:Yt.ZodNever,...fn(t)});class Xb extends yn{_parse(e){if(this._getType(e)!==St.undefined){const r=this._getOrReturnCtx(e);return lt(r,{code:We.invalid_type,expected:St.void,received:r.parsedType}),Xt}return ja(e.data)}}Xb.create=t=>new Xb({typeName:Yt.ZodVoid,...fn(t)});class Os extends yn{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),a=this._def;if(n.parsedType!==St.array)return lt(n,{code:We.invalid_type,expected:St.array,received:n.parsedType}),Xt;if(a.exactLength!==null){const l=n.data.length>a.exactLength.value,c=n.data.length<a.exactLength.value;(l||c)&&(lt(n,{code:l?We.too_big:We.too_small,minimum:c?a.exactLength.value:void 0,maximum:l?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(a.minLength!==null&&n.data.length<a.minLength.value&&(lt(n,{code:We.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),a.maxLength!==null&&n.data.length>a.maxLength.value&&(lt(n,{code:We.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((l,c)=>a.type._parseAsync(new gl(n,l,n.path,c)))).then(l=>ya.mergeArray(r,l));const s=[...n.data].map((l,c)=>a.type._parseSync(new gl(n,l,n.path,c)));return ya.mergeArray(r,s)}get element(){return this._def.type}min(e,n){return new Os({...this._def,minLength:{value:e,message:Dt.toString(n)}})}max(e,n){return new Os({...this._def,maxLength:{value:e,message:Dt.toString(n)}})}length(e,n){return new Os({...this._def,exactLength:{value:e,message:Dt.toString(n)}})}nonempty(e){return this.min(1,e)}}Os.create=(t,e)=>new Os({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Yt.ZodArray,...fn(e)});function pp(t){if(t instanceof $r){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=yl.create(pp(r))}return new $r({...t._def,shape:()=>e})}else return t instanceof Os?new Os({...t._def,type:pp(t.element)}):t instanceof yl?yl.create(pp(t.unwrap())):t instanceof Fc?Fc.create(pp(t.unwrap())):t instanceof vl?vl.create(t.items.map(e=>pp(e))):t}class $r extends yn{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=jn.objectKeys(e);return this._cached={shape:e,keys:n}}_parse(e){if(this._getType(e)!==St.object){const p=this._getOrReturnCtx(e);return lt(p,{code:We.invalid_type,expected:St.object,received:p.parsedType}),Xt}const{status:r,ctx:a}=this._processInputParams(e),{shape:s,keys:l}=this._getCached(),c=[];if(!(this._def.catchall instanceof yu&&this._def.unknownKeys==="strip"))for(const p in a.data)l.includes(p)||c.push(p);const h=[];for(const p of l){const v=s[p],b=a.data[p];h.push({key:{status:"valid",value:p},value:v._parse(new gl(a,b,a.path,p)),alwaysSet:p in a.data})}if(this._def.catchall instanceof yu){const p=this._def.unknownKeys;if(p==="passthrough")for(const v of c)h.push({key:{status:"valid",value:v},value:{status:"valid",value:a.data[v]}});else if(p==="strict")c.length>0&&(lt(a,{code:We.unrecognized_keys,keys:c}),r.dirty());else if(p!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const p=this._def.catchall;for(const v of c){const b=a.data[v];h.push({key:{status:"valid",value:v},value:p._parse(new gl(a,b,a.path,v)),alwaysSet:v in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const p=[];for(const v of h){const b=await v.key,k=await v.value;p.push({key:b,value:k,alwaysSet:v.alwaysSet})}return p}).then(p=>ya.mergeObjectSync(r,p)):ya.mergeObjectSync(r,h)}get shape(){return this._def.shape()}strict(e){return Dt.errToObj,new $r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{var a,s,l,c;const h=(l=(s=(a=this._def).errorMap)===null||s===void 0?void 0:s.call(a,n,r).message)!==null&&l!==void 0?l:r.defaultError;return n.code==="unrecognized_keys"?{message:(c=Dt.errToObj(e).message)!==null&&c!==void 0?c:h}:{message:h}}}:{}})}strip(){return new $r({...this._def,unknownKeys:"strip"})}passthrough(){return new $r({...this._def,unknownKeys:"passthrough"})}extend(e){return new $r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new $r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Yt.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new $r({...this._def,catchall:e})}pick(e){const n={};return jn.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new $r({...this._def,shape:()=>n})}omit(e){const n={};return jn.objectKeys(this.shape).forEach(r=>{e[r]||(n[r]=this.shape[r])}),new $r({...this._def,shape:()=>n})}deepPartial(){return pp(this)}partial(e){const n={};return jn.objectKeys(this.shape).forEach(r=>{const a=this.shape[r];e&&!e[r]?n[r]=a:n[r]=a.optional()}),new $r({...this._def,shape:()=>n})}required(e){const n={};return jn.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof yl;)s=s._def.innerType;n[r]=s}}),new $r({...this._def,shape:()=>n})}keyof(){return u3(jn.objectKeys(this.shape))}}$r.create=(t,e)=>new $r({shape:()=>t,unknownKeys:"strip",catchall:yu.create(),typeName:Yt.ZodObject,...fn(e)}),$r.strictCreate=(t,e)=>new $r({shape:()=>t,unknownKeys:"strict",catchall:yu.create(),typeName:Yt.ZodObject,...fn(e)}),$r.lazycreate=(t,e)=>new $r({shape:t,unknownKeys:"strip",catchall:yu.create(),typeName:Yt.ZodObject,...fn(e)});class sv extends yn{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function a(s){for(const c of s)if(c.result.status==="valid")return c.result;for(const c of s)if(c.result.status==="dirty")return n.common.issues.push(...c.ctx.common.issues),c.result;const l=s.map(c=>new Ao(c.ctx.common.issues));return lt(n,{code:We.invalid_union,unionErrors:l}),Xt}if(n.common.async)return Promise.all(r.map(async s=>{const l={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:l}),ctx:l}})).then(a);{let s;const l=[];for(const h of r){const p={...n,common:{...n.common,issues:[]},parent:null},v=h._parseSync({data:n.data,path:n.path,parent:p});if(v.status==="valid")return v;v.status==="dirty"&&!s&&(s={result:v,ctx:p}),p.common.issues.length&&l.push(p.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const c=l.map(h=>new Ao(h));return lt(n,{code:We.invalid_union,unionErrors:c}),Xt}}get options(){return this._def.options}}sv.create=(t,e)=>new sv({options:t,typeName:Yt.ZodUnion,...fn(e)});const bu=t=>t instanceof cv?bu(t.schema):t instanceof Ms?bu(t.innerType()):t instanceof dv?[t.value]:t instanceof Uc?t.options:t instanceof fv?jn.objectValues(t.enum):t instanceof hv?bu(t._def.innerType):t instanceof av?[void 0]:t instanceof ov?[null]:t instanceof yl?[void 0,...bu(t.unwrap())]:t instanceof Fc?[null,...bu(t.unwrap())]:t instanceof ww||t instanceof gv?bu(t.unwrap()):t instanceof pv?bu(t._def.innerType):[];class Jb extends yn{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==St.object)return lt(n,{code:We.invalid_type,expected:St.object,received:n.parsedType}),Xt;const r=this.discriminator,a=n.data[r],s=this.optionsMap.get(a);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(lt(n,{code:We.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Xt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){const a=new Map;for(const s of n){const l=bu(s.shape[e]);if(!l.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const c of l){if(a.has(c))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(c)}`);a.set(c,s)}}return new Jb({typeName:Yt.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:a,...fn(r)})}}function xw(t,e){const n=vu(t),r=vu(e);if(t===e)return{valid:!0,data:t};if(n===St.object&&r===St.object){const a=jn.objectKeys(e),s=jn.objectKeys(t).filter(c=>a.indexOf(c)!==-1),l={...t,...e};for(const c of s){const h=xw(t[c],e[c]);if(!h.valid)return{valid:!1};l[c]=h.data}return{valid:!0,data:l}}else if(n===St.array&&r===St.array){if(t.length!==e.length)return{valid:!1};const a=[];for(let s=0;s<t.length;s++){const l=t[s],c=e[s],h=xw(l,c);if(!h.valid)return{valid:!1};a.push(h.data)}return{valid:!0,data:a}}else return n===St.date&&r===St.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class lv extends yn{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),a=(s,l)=>{if(Cw(s)||Cw(l))return Xt;const c=xw(s.value,l.value);return c.valid?((kw(s)||kw(l))&&n.dirty(),{status:n.value,value:c.data}):(lt(r,{code:We.invalid_intersection_types}),Xt)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,l])=>a(s,l)):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}lv.create=(t,e,n)=>new lv({left:t,right:e,typeName:Yt.ZodIntersection,...fn(n)});class vl extends yn{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==St.array)return lt(r,{code:We.invalid_type,expected:St.array,received:r.parsedType}),Xt;if(r.data.length<this._def.items.length)return lt(r,{code:We.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Xt;!this._def.rest&&r.data.length>this._def.items.length&&(lt(r,{code:We.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((l,c)=>{const h=this._def.items[c]||this._def.rest;return h?h._parse(new gl(r,l,r.path,c)):null}).filter(l=>!!l);return r.common.async?Promise.all(s).then(l=>ya.mergeArray(n,l)):ya.mergeArray(n,s)}get items(){return this._def.items}rest(e){return new vl({...this._def,rest:e})}}vl.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new vl({items:t,typeName:Yt.ZodTuple,rest:null,...fn(e)})};class uv extends yn{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==St.object)return lt(r,{code:We.invalid_type,expected:St.object,received:r.parsedType}),Xt;const a=[],s=this._def.keyType,l=this._def.valueType;for(const c in r.data)a.push({key:s._parse(new gl(r,c,r.path,c)),value:l._parse(new gl(r,r.data[c],r.path,c)),alwaysSet:c in r.data});return r.common.async?ya.mergeObjectAsync(n,a):ya.mergeObjectSync(n,a)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof yn?new uv({keyType:e,valueType:n,typeName:Yt.ZodRecord,...fn(r)}):new uv({keyType:As.create(),valueType:e,typeName:Yt.ZodRecord,...fn(n)})}}class eS extends yn{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==St.map)return lt(r,{code:We.invalid_type,expected:St.map,received:r.parsedType}),Xt;const a=this._def.keyType,s=this._def.valueType,l=[...r.data.entries()].map(([c,h],p)=>({key:a._parse(new gl(r,c,r.path,[p,"key"])),value:s._parse(new gl(r,h,r.path,[p,"value"]))}));if(r.common.async){const c=new Map;return Promise.resolve().then(async()=>{for(const h of l){const p=await h.key,v=await h.value;if(p.status==="aborted"||v.status==="aborted")return Xt;(p.status==="dirty"||v.status==="dirty")&&n.dirty(),c.set(p.value,v.value)}return{status:n.value,value:c}})}else{const c=new Map;for(const h of l){const p=h.key,v=h.value;if(p.status==="aborted"||v.status==="aborted")return Xt;(p.status==="dirty"||v.status==="dirty")&&n.dirty(),c.set(p.value,v.value)}return{status:n.value,value:c}}}}eS.create=(t,e,n)=>new eS({valueType:e,keyType:t,typeName:Yt.ZodMap,...fn(n)});class cf extends yn{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==St.set)return lt(r,{code:We.invalid_type,expected:St.set,received:r.parsedType}),Xt;const a=this._def;a.minSize!==null&&r.data.size<a.minSize.value&&(lt(r,{code:We.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),n.dirty()),a.maxSize!==null&&r.data.size>a.maxSize.value&&(lt(r,{code:We.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),n.dirty());const s=this._def.valueType;function l(h){const p=new Set;for(const v of h){if(v.status==="aborted")return Xt;v.status==="dirty"&&n.dirty(),p.add(v.value)}return{status:n.value,value:p}}const c=[...r.data.values()].map((h,p)=>s._parse(new gl(r,h,r.path,p)));return r.common.async?Promise.all(c).then(h=>l(h)):l(c)}min(e,n){return new cf({...this._def,minSize:{value:e,message:Dt.toString(n)}})}max(e,n){return new cf({...this._def,maxSize:{value:e,message:Dt.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}cf.create=(t,e)=>new cf({valueType:t,minSize:null,maxSize:null,typeName:Yt.ZodSet,...fn(e)});class mp extends yn{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==St.function)return lt(n,{code:We.invalid_type,expected:St.function,received:n.parsedType}),Xt;function r(c,h){return Kb({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Yb(),dp].filter(p=>!!p),issueData:{code:We.invalid_arguments,argumentsError:h}})}function a(c,h){return Kb({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Yb(),dp].filter(p=>!!p),issueData:{code:We.invalid_return_type,returnTypeError:h}})}const s={errorMap:n.common.contextualErrorMap},l=n.data;if(this._def.returns instanceof gp){const c=this;return ja(async function(...h){const p=new Ao([]),v=await c._def.args.parseAsync(h,s).catch(T=>{throw p.addIssue(r(h,T)),p}),b=await Reflect.apply(l,this,v);return await c._def.returns._def.type.parseAsync(b,s).catch(T=>{throw p.addIssue(a(b,T)),p})})}else{const c=this;return ja(function(...h){const p=c._def.args.safeParse(h,s);if(!p.success)throw new Ao([r(h,p.error)]);const v=Reflect.apply(l,this,p.data),b=c._def.returns.safeParse(v,s);if(!b.success)throw new Ao([a(v,b.error)]);return b.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new mp({...this._def,args:vl.create(e).rest(uf.create())})}returns(e){return new mp({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new mp({args:e||vl.create([]).rest(uf.create()),returns:n||uf.create(),typeName:Yt.ZodFunction,...fn(r)})}}class cv extends yn{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}cv.create=(t,e)=>new cv({getter:t,typeName:Yt.ZodLazy,...fn(e)});class dv extends yn{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return lt(n,{received:n.data,code:We.invalid_literal,expected:this._def.value}),Xt}return{status:"valid",value:e.data}}get value(){return this._def.value}}dv.create=(t,e)=>new dv({value:t,typeName:Yt.ZodLiteral,...fn(e)});function u3(t,e){return new Uc({values:t,typeName:Yt.ZodEnum,...fn(e)})}class Uc extends yn{constructor(){super(...arguments),nv.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return lt(n,{expected:jn.joinValues(r),received:n.parsedType,code:We.invalid_type}),Xt}if(Zb(this,nv)||i3(this,nv,new Set(this._def.values)),!Zb(this,nv).has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return lt(n,{received:n.data,code:We.invalid_enum_value,options:r}),Xt}return ja(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return Uc.create(e,{...this._def,...n})}exclude(e,n=this._def){return Uc.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}}nv=new WeakMap,Uc.create=u3;class fv extends yn{constructor(){super(...arguments),rv.set(this,void 0)}_parse(e){const n=jn.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==St.string&&r.parsedType!==St.number){const a=jn.objectValues(n);return lt(r,{expected:jn.joinValues(a),received:r.parsedType,code:We.invalid_type}),Xt}if(Zb(this,rv)||i3(this,rv,new Set(jn.getValidEnumValues(this._def.values))),!Zb(this,rv).has(e.data)){const a=jn.objectValues(n);return lt(r,{received:r.data,code:We.invalid_enum_value,options:a}),Xt}return ja(e.data)}get enum(){return this._def.values}}rv=new WeakMap,fv.create=(t,e)=>new fv({values:t,typeName:Yt.ZodNativeEnum,...fn(e)});class gp extends yn{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==St.promise&&n.common.async===!1)return lt(n,{code:We.invalid_type,expected:St.promise,received:n.parsedType}),Xt;const r=n.parsedType===St.promise?n.data:Promise.resolve(n.data);return ja(r.then(a=>this._def.type.parseAsync(a,{path:n.path,errorMap:n.common.contextualErrorMap})))}}gp.create=(t,e)=>new gp({type:t,typeName:Yt.ZodPromise,...fn(e)});class Ms extends yn{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Yt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),a=this._def.effect||null,s={addIssue:l=>{lt(r,l),l.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),a.type==="preprocess"){const l=a.transform(r.data,s);if(r.common.async)return Promise.resolve(l).then(async c=>{if(n.value==="aborted")return Xt;const h=await this._def.schema._parseAsync({data:c,path:r.path,parent:r});return h.status==="aborted"?Xt:h.status==="dirty"||n.value==="dirty"?fp(h.value):h});{if(n.value==="aborted")return Xt;const c=this._def.schema._parseSync({data:l,path:r.path,parent:r});return c.status==="aborted"?Xt:c.status==="dirty"||n.value==="dirty"?fp(c.value):c}}if(a.type==="refinement"){const l=c=>{const h=a.refinement(c,s);if(r.common.async)return Promise.resolve(h);if(h instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(r.common.async===!1){const c=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return c.status==="aborted"?Xt:(c.status==="dirty"&&n.dirty(),l(c.value),{status:n.value,value:c.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(c=>c.status==="aborted"?Xt:(c.status==="dirty"&&n.dirty(),l(c.value).then(()=>({status:n.value,value:c.value}))))}if(a.type==="transform")if(r.common.async===!1){const l=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!sf(l))return l;const c=a.transform(l.value,s);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:c}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(l=>sf(l)?Promise.resolve(a.transform(l.value,s)).then(c=>({status:n.value,value:c})):l);jn.assertNever(a)}}Ms.create=(t,e,n)=>new Ms({schema:t,typeName:Yt.ZodEffects,effect:e,...fn(n)}),Ms.createWithPreprocess=(t,e,n)=>new Ms({schema:e,effect:{type:"preprocess",transform:t},typeName:Yt.ZodEffects,...fn(n)});class yl extends yn{_parse(e){return this._getType(e)===St.undefined?ja(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}yl.create=(t,e)=>new yl({innerType:t,typeName:Yt.ZodOptional,...fn(e)});class Fc extends yn{_parse(e){return this._getType(e)===St.null?ja(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Fc.create=(t,e)=>new Fc({innerType:t,typeName:Yt.ZodNullable,...fn(e)});class hv extends yn{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===St.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}hv.create=(t,e)=>new hv({innerType:t,typeName:Yt.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...fn(e)});class pv extends yn{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return tv(a)?a.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ao(r.common.issues)},input:r.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Ao(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}pv.create=(t,e)=>new pv({innerType:t,typeName:Yt.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...fn(e)});class tS extends yn{_parse(e){if(this._getType(e)!==St.nan){const r=this._getOrReturnCtx(e);return lt(r,{code:We.invalid_type,expected:St.nan,received:r.parsedType}),Xt}return{status:"valid",value:e.data}}}tS.create=t=>new tS({typeName:Yt.ZodNaN,...fn(t)});const yG=Symbol("zod_brand");class ww extends yn{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class mv extends yn{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Xt:s.status==="dirty"?(n.dirty(),fp(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{const a=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?Xt:a.status==="dirty"?(n.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:r.path,parent:r})}}static create(e,n){return new mv({in:e,out:n,typeName:Yt.ZodPipeline})}}class gv extends yn{_parse(e){const n=this._def.innerType._parse(e),r=a=>(sf(a)&&(a.value=Object.freeze(a.value)),a);return tv(n)?n.then(a=>r(a)):r(n)}unwrap(){return this._def.innerType}}gv.create=(t,e)=>new gv({innerType:t,typeName:Yt.ZodReadonly,...fn(e)});function c3(t,e={},n){return t?hp.create().superRefine((r,a)=>{var s,l;if(!t(r)){const c=typeof e=="function"?e(r):typeof e=="string"?{message:e}:e,h=(l=(s=c.fatal)!==null&&s!==void 0?s:n)!==null&&l!==void 0?l:!0,p=typeof c=="string"?{message:c}:c;a.addIssue({code:"custom",...p,fatal:h})}}):hp.create()}const bG={object:$r.lazycreate};var Yt;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Yt||(Yt={}));const SG=(t,e={message:`Input not instance of ${t.name}`})=>c3(n=>n instanceof t,e),d3=As.create,f3=Nc.create,CG=tS.create,kG=Ic.create,h3=iv.create,TG=lf.create,xG=Qb.create,wG=av.create,_G=ov.create,EG=hp.create,RG=uf.create,PG=yu.create,DG=Xb.create,AG=Os.create,OG=$r.create,MG=$r.strictCreate,LG=sv.create,NG=Jb.create,IG=lv.create,UG=vl.create,FG=uv.create,jG=eS.create,VG=cf.create,zG=mp.create,BG=cv.create,HG=dv.create,$G=Uc.create,qG=fv.create,WG=gp.create,p3=Ms.create,GG=yl.create,YG=Fc.create,KG=Ms.createWithPreprocess,ZG=mv.create;var m3=Object.freeze({__proto__:null,defaultErrorMap:dp,setErrorMap:KW,getErrorMap:Yb,makeIssue:Kb,EMPTY_PATH:ZW,addIssueToContext:lt,ParseStatus:ya,INVALID:Xt,DIRTY:fp,OK:ja,isAborted:Cw,isDirty:kw,isValid:sf,isAsync:tv,get util(){return jn},get objectUtil(){return Sw},ZodParsedType:St,getParsedType:vu,ZodType:yn,datetimeRegex:l3,ZodString:As,ZodNumber:Nc,ZodBigInt:Ic,ZodBoolean:iv,ZodDate:lf,ZodSymbol:Qb,ZodUndefined:av,ZodNull:ov,ZodAny:hp,ZodUnknown:uf,ZodNever:yu,ZodVoid:Xb,ZodArray:Os,ZodObject:$r,ZodUnion:sv,ZodDiscriminatedUnion:Jb,ZodIntersection:lv,ZodTuple:vl,ZodRecord:uv,ZodMap:eS,ZodSet:cf,ZodFunction:mp,ZodLazy:cv,ZodLiteral:dv,ZodEnum:Uc,ZodNativeEnum:fv,ZodPromise:gp,ZodEffects:Ms,ZodTransformer:Ms,ZodOptional:yl,ZodNullable:Fc,ZodDefault:hv,ZodCatch:pv,ZodNaN:tS,BRAND:yG,ZodBranded:ww,ZodPipeline:mv,ZodReadonly:gv,custom:c3,Schema:yn,ZodSchema:yn,late:bG,get ZodFirstPartyTypeKind(){return Yt},coerce:{string:t=>As.create({...t,coerce:!0}),number:t=>Nc.create({...t,coerce:!0}),boolean:t=>iv.create({...t,coerce:!0}),bigint:t=>Ic.create({...t,coerce:!0}),date:t=>lf.create({...t,coerce:!0})},any:EG,array:AG,bigint:kG,boolean:h3,date:TG,discriminatedUnion:NG,effect:p3,enum:$G,function:zG,instanceof:SG,intersection:IG,lazy:BG,literal:HG,map:jG,nan:CG,nativeEnum:qG,never:PG,null:_G,nullable:YG,number:f3,object:OG,oboolean:()=>h3().optional(),onumber:()=>f3().optional(),optional:GG,ostring:()=>d3().optional(),pipeline:ZG,preprocess:KG,promise:WG,record:FG,set:VG,strictObject:MG,string:d3,symbol:xG,transformer:p3,tuple:UG,undefined:wG,union:LG,unknown:RG,void:DG,NEVER:Xt,ZodIssueCode:We,quotelessJson:YW,ZodError:Ao});const QG=m3.object({message:m3.string().min(1,{message:"Please enter a message."})}),XG=[{id:"text",label:"Chat",icon:$I},{id:"audio",label:"Voice Call",icon:cW}];var vv=t=>t.type==="checkbox",df=t=>t instanceof Date,Va=t=>t==null;const g3=t=>typeof t=="object";var ui=t=>!Va(t)&&!Array.isArray(t)&&g3(t)&&!df(t),v3=t=>ui(t)&&t.target?vv(t.target)?t.target.checked:t.target.value:t,JG=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,y3=(t,e)=>t.has(JG(e)),eY=t=>{const e=t.constructor&&t.constructor.prototype;return ui(e)&&e.hasOwnProperty("isPrototypeOf")},_w=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function so(t){let e;const n=Array.isArray(t),r=typeof FileList<"u"?t instanceof FileList:!1;if(t instanceof Date)e=new Date(t);else if(t instanceof Set)e=new Set(t);else if(!(_w&&(t instanceof Blob||r))&&(n||ui(t)))if(e=n?[]:{},!n&&!eY(t))e=t;else for(const a in t)t.hasOwnProperty(a)&&(e[a]=so(t[a]));else return t;return e}var nS=t=>Array.isArray(t)?t.filter(Boolean):[],ci=t=>t===void 0,rt=(t,e,n)=>{if(!e||!ui(t))return n;const r=nS(e.split(/[,[\].]+?/)).reduce((a,s)=>Va(a)?a:a[s],t);return ci(r)||r===t?ci(t[e])?n:t[e]:r},Qo=t=>typeof t=="boolean",Ew=t=>/^\w*$/.test(t),b3=t=>nS(t.replace(/["|']|\]/g,"").split(/\.|\[/)),or=(t,e,n)=>{let r=-1;const a=Ew(e)?[e]:b3(e),s=a.length,l=s-1;for(;++r<s;){const c=a[r];let h=n;if(r!==l){const p=t[c];h=ui(p)||Array.isArray(p)?p:isNaN(+a[r+1])?{}:[]}if(c==="__proto__"||c==="constructor"||c==="prototype")return;t[c]=h,t=t[c]}return t};const rS={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Ls={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Su={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},S3=ir.createContext(null),iS=()=>ir.useContext(S3),tY=t=>{const{children:e,...n}=t;return ir.createElement(S3.Provider,{value:n},e)};var C3=(t,e,n,r=!0)=>{const a={defaultValues:e._defaultValues};for(const s in t)Object.defineProperty(a,s,{get:()=>{const l=s;return e._proxyFormState[l]!==Ls.all&&(e._proxyFormState[l]=!r||Ls.all),n&&(n[l]=!0),t[l]}});return a},lo=t=>ui(t)&&!Object.keys(t).length,k3=(t,e,n,r)=>{n(t);const{name:a,...s}=t;return lo(s)||Object.keys(s).length>=Object.keys(e).length||Object.keys(s).find(l=>e[l]===(!r||Ls.all))},yv=t=>Array.isArray(t)?t:[t],T3=(t,e,n)=>!t||!e||t===e||yv(t).some(r=>r&&(n?r===e:r.startsWith(e)||e.startsWith(r)));function Rw(t){const e=ir.useRef(t);e.current=t,ir.useEffect(()=>{const n=!t.disabled&&e.current.subject&&e.current.subject.subscribe({next:e.current.next});return()=>{n&&n.unsubscribe()}},[t.disabled])}function nY(t){const e=iS(),{control:n=e.control,disabled:r,name:a,exact:s}=t||{},[l,c]=ir.useState(n._formState),h=ir.useRef(!0),p=ir.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),v=ir.useRef(a);return v.current=a,Rw({disabled:r,next:b=>h.current&&T3(v.current,b.name,s)&&k3(b,p.current,n._updateFormState)&&c({...n._formState,...b}),subject:n._subjects.state}),ir.useEffect(()=>(h.current=!0,p.current.isValid&&n._updateValid(!0),()=>{h.current=!1}),[n]),ir.useMemo(()=>C3(l,n,p.current,!1),[l,n])}var bl=t=>typeof t=="string",x3=(t,e,n,r,a)=>bl(t)?(r&&e.watch.add(t),rt(n,t,a)):Array.isArray(t)?t.map(s=>(r&&e.watch.add(s),rt(n,s))):(r&&(e.watchAll=!0),n);function rY(t){const e=iS(),{control:n=e.control,name:r,defaultValue:a,disabled:s,exact:l}=t||{},c=ir.useRef(r);c.current=r,Rw({disabled:s,subject:n._subjects.values,next:v=>{T3(c.current,v.name,l)&&p(so(x3(c.current,n._names,v.values||n._formValues,!1,a)))}});const[h,p]=ir.useState(n._getWatch(r,a));return ir.useEffect(()=>n._removeUnmounted()),h}function iY(t){const e=iS(),{name:n,disabled:r,control:a=e.control,shouldUnregister:s}=t,l=y3(a._names.array,n),c=rY({control:a,name:n,defaultValue:rt(a._formValues,n,rt(a._defaultValues,n,t.defaultValue)),exact:!0}),h=nY({control:a,name:n,exact:!0}),p=ir.useRef(a.register(n,{...t.rules,value:c,...Qo(t.disabled)?{disabled:t.disabled}:{}})),v=ir.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!rt(h.errors,n)},isDirty:{enumerable:!0,get:()=>!!rt(h.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!rt(h.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!rt(h.validatingFields,n)},error:{enumerable:!0,get:()=>rt(h.errors,n)}}),[h,n]),b=ir.useMemo(()=>({name:n,value:c,...Qo(r)||h.disabled?{disabled:h.disabled||r}:{},onChange:k=>p.current.onChange({target:{value:v3(k),name:n},type:rS.CHANGE}),onBlur:()=>p.current.onBlur({target:{value:rt(a._formValues,n),name:n},type:rS.BLUR}),ref:k=>{const T=rt(a._fields,n);T&&k&&(T._f.ref={focus:()=>k.focus(),select:()=>k.select(),setCustomValidity:E=>k.setCustomValidity(E),reportValidity:()=>k.reportValidity()})}}),[n,a._formValues,r,h.disabled,c,a._fields]);return ir.useEffect(()=>{const k=a._options.shouldUnregister||s,T=(E,R)=>{const M=rt(a._fields,E);M&&M._f&&(M._f.mount=R)};if(T(n,!0),k){const E=so(rt(a._options.defaultValues,n));or(a._defaultValues,n,E),ci(rt(a._formValues,n))&&or(a._formValues,n,E)}return!l&&a.register(n),()=>{(l?k&&!a._state.action:k)?a.unregister(n):T(n,!1)}},[n,a,l,s]),ir.useEffect(()=>{a._updateDisabledField({disabled:r,fields:a._fields,name:n})},[r,n,a]),ir.useMemo(()=>({field:b,formState:h,fieldState:v}),[b,h,v])}const aY=t=>t.render(iY(t));var w3=(t,e,n,r,a)=>e?{...n[t],types:{...n[t]&&n[t].types?n[t].types:{},[r]:a||!0}}:{},_3=t=>({isOnSubmit:!t||t===Ls.onSubmit,isOnBlur:t===Ls.onBlur,isOnChange:t===Ls.onChange,isOnAll:t===Ls.all,isOnTouch:t===Ls.onTouched}),E3=(t,e,n)=>!n&&(e.watchAll||e.watch.has(t)||[...e.watch].some(r=>t.startsWith(r)&&/^\.\w+/.test(t.slice(r.length))));const bv=(t,e,n,r)=>{for(const a of n||Object.keys(t)){const s=rt(t,a);if(s){const{_f:l,...c}=s;if(l){if(l.refs&&l.refs[0]&&e(l.refs[0],a)&&!r)return!0;if(l.ref&&e(l.ref,l.name)&&!r)return!0;if(bv(c,e))break}else if(ui(c)&&bv(c,e))break}}};var oY=(t,e,n)=>{const r=yv(rt(t,n));return or(r,"root",e[n]),or(t,n,r),t},Pw=t=>t.type==="file",Sl=t=>typeof t=="function",aS=t=>{if(!_w)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},oS=t=>bl(t),Dw=t=>t.type==="radio",sS=t=>t instanceof RegExp;const R3={value:!1,isValid:!1},P3={value:!0,isValid:!0};var D3=t=>{if(Array.isArray(t)){if(t.length>1){const e=t.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:e,isValid:!!e.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!ci(t[0].attributes.value)?ci(t[0].value)||t[0].value===""?P3:{value:t[0].value,isValid:!0}:P3:R3}return R3};const A3={isValid:!1,value:null};var O3=t=>Array.isArray(t)?t.reduce((e,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:e,A3):A3;function M3(t,e,n="validate"){if(oS(t)||Array.isArray(t)&&t.every(oS)||Qo(t)&&!t)return{type:n,message:oS(t)?t:"",ref:e}}var vp=t=>ui(t)&&!sS(t)?t:{value:t,message:""},L3=async(t,e,n,r,a,s)=>{const{ref:l,refs:c,required:h,maxLength:p,minLength:v,min:b,max:k,pattern:T,validate:E,name:R,valueAsNumber:M,mount:A}=t._f,U=rt(n,R);if(!A||e.has(R))return{};const V=c?c[0]:l,j=J=>{a&&V.reportValidity&&(V.setCustomValidity(Qo(J)?"":J||""),V.reportValidity())},I={},N=Dw(l),ne=vv(l),X=N||ne,se=(M||Pw(l))&&ci(l.value)&&ci(U)||aS(l)&&l.value===""||U===""||Array.isArray(U)&&!U.length,$=w3.bind(null,R,r,I),oe=(J,xe,ke,Ge=Su.maxLength,Je=Su.minLength)=>{const je=J?xe:ke;I[R]={type:J?Ge:Je,message:je,ref:l,...$(J?Ge:Je,je)}};if(s?!Array.isArray(U)||!U.length:h&&(!X&&(se||Va(U))||Qo(U)&&!U||ne&&!D3(c).isValid||N&&!O3(c).isValid)){const{value:J,message:xe}=oS(h)?{value:!!h,message:h}:vp(h);if(J&&(I[R]={type:Su.required,message:xe,ref:V,...$(Su.required,xe)},!r))return j(xe),I}if(!se&&(!Va(b)||!Va(k))){let J,xe;const ke=vp(k),Ge=vp(b);if(!Va(U)&&!isNaN(U)){const Je=l.valueAsNumber||U&&+U;Va(ke.value)||(J=Je>ke.value),Va(Ge.value)||(xe=Je<Ge.value)}else{const Je=l.valueAsDate||new Date(U),je=z=>new Date(new Date().toDateString()+" "+z),ve=l.type=="time",He=l.type=="week";bl(ke.value)&&U&&(J=ve?je(U)>je(ke.value):He?U>ke.value:Je>new Date(ke.value)),bl(Ge.value)&&U&&(xe=ve?je(U)<je(Ge.value):He?U<Ge.value:Je<new Date(Ge.value))}if((J||xe)&&(oe(!!J,ke.message,Ge.message,Su.max,Su.min),!r))return j(I[R].message),I}if((p||v)&&!se&&(bl(U)||s&&Array.isArray(U))){const J=vp(p),xe=vp(v),ke=!Va(J.value)&&U.length>+J.value,Ge=!Va(xe.value)&&U.length<+xe.value;if((ke||Ge)&&(oe(ke,J.message,xe.message),!r))return j(I[R].message),I}if(T&&!se&&bl(U)){const{value:J,message:xe}=vp(T);if(sS(J)&&!U.match(J)&&(I[R]={type:Su.pattern,message:xe,ref:l,...$(Su.pattern,xe)},!r))return j(xe),I}if(E){if(Sl(E)){const J=await E(U,n),xe=M3(J,V);if(xe&&(I[R]={...xe,...$(Su.validate,xe.message)},!r))return j(xe.message),I}else if(ui(E)){let J={};for(const xe in E){if(!lo(J)&&!r)break;const ke=M3(await E[xe](U,n),V,xe);ke&&(J={...ke,...$(xe,ke.message)},j(ke.message),r&&(I[R]=J))}if(!lo(J)&&(I[R]={ref:V,...J},!r))return I}}return j(!0),I};function sY(t,e){const n=e.slice(0,-1).length;let r=0;for(;r<n;)t=ci(t)?r++:t[e[r++]];return t}function lY(t){for(const e in t)if(t.hasOwnProperty(e)&&!ci(t[e]))return!1;return!0}function Ei(t,e){const n=Array.isArray(e)?e:Ew(e)?[e]:b3(e),r=n.length===1?t:sY(t,n),a=n.length-1,s=n[a];return r&&delete r[s],a!==0&&(ui(r)&&lo(r)||Array.isArray(r)&&lY(r))&&Ei(t,n.slice(0,-1)),t}var Aw=()=>{let t=[];return{get observers(){return t},next:a=>{for(const s of t)s.next&&s.next(a)},subscribe:a=>(t.push(a),{unsubscribe:()=>{t=t.filter(s=>s!==a)}}),unsubscribe:()=>{t=[]}}},Ow=t=>Va(t)||!g3(t);function jc(t,e){if(Ow(t)||Ow(e))return t===e;if(df(t)&&df(e))return t.getTime()===e.getTime();const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(const a of n){const s=t[a];if(!r.includes(a))return!1;if(a!=="ref"){const l=e[a];if(df(s)&&df(l)||ui(s)&&ui(l)||Array.isArray(s)&&Array.isArray(l)?!jc(s,l):s!==l)return!1}}return!0}var N3=t=>t.type==="select-multiple",uY=t=>Dw(t)||vv(t),Mw=t=>aS(t)&&t.isConnected,I3=t=>{for(const e in t)if(Sl(t[e]))return!0;return!1};function lS(t,e={}){const n=Array.isArray(t);if(ui(t)||n)for(const r in t)Array.isArray(t[r])||ui(t[r])&&!I3(t[r])?(e[r]=Array.isArray(t[r])?[]:{},lS(t[r],e[r])):Va(t[r])||(e[r]=!0);return e}function U3(t,e,n){const r=Array.isArray(t);if(ui(t)||r)for(const a in t)Array.isArray(t[a])||ui(t[a])&&!I3(t[a])?ci(e)||Ow(n[a])?n[a]=Array.isArray(t[a])?lS(t[a],[]):{...lS(t[a])}:U3(t[a],Va(e)?{}:e[a],n[a]):n[a]=!jc(t[a],e[a]);return n}var Sv=(t,e)=>U3(t,e,lS(e)),F3=(t,{valueAsNumber:e,valueAsDate:n,setValueAs:r})=>ci(t)?t:e?t===""?NaN:t&&+t:n&&bl(t)?new Date(t):r?r(t):t;function Lw(t){const e=t.ref;return Pw(e)?e.files:Dw(e)?O3(t.refs).value:N3(e)?[...e.selectedOptions].map(({value:n})=>n):vv(e)?D3(t.refs).value:F3(ci(e.value)?t.ref.value:e.value,t)}var cY=(t,e,n,r)=>{const a={};for(const s of t){const l=rt(e,s);l&&or(a,s,l._f)}return{criteriaMode:n,names:[...t],fields:a,shouldUseNativeValidation:r}},Cv=t=>ci(t)?t:sS(t)?t.source:ui(t)?sS(t.value)?t.value.source:t.value:t;const j3="AsyncFunction";var dY=t=>!!t&&!!t.validate&&!!(Sl(t.validate)&&t.validate.constructor.name===j3||ui(t.validate)&&Object.values(t.validate).find(e=>e.constructor.name===j3)),fY=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate);function V3(t,e,n){const r=rt(t,n);if(r||Ew(n))return{error:r,name:n};const a=n.split(".");for(;a.length;){const s=a.join("."),l=rt(e,s),c=rt(t,s);if(l&&!Array.isArray(l)&&n!==s)return{name:n};if(c&&c.type)return{name:s,error:c};a.pop()}return{name:n}}var hY=(t,e,n,r,a)=>a.isOnAll?!1:!n&&a.isOnTouch?!(e||t):(n?r.isOnBlur:a.isOnBlur)?!t:(n?r.isOnChange:a.isOnChange)?t:!0,pY=(t,e)=>!nS(rt(t,e)).length&&Ei(t,e);const mY={mode:Ls.onSubmit,reValidateMode:Ls.onChange,shouldFocusError:!0};function gY(t={}){let e={...mY,...t},n={submitCount:0,isDirty:!1,isLoading:Sl(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1},r={},a=ui(e.defaultValues)||ui(e.values)?so(e.defaultValues||e.values)||{}:{},s=e.shouldUnregister?{}:so(a),l={action:!1,mount:!1,watch:!1},c={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},h,p=0;const v={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},b={values:Aw(),array:Aw(),state:Aw()},k=_3(e.mode),T=_3(e.reValidateMode),E=e.criteriaMode===Ls.all,R=Z=>le=>{clearTimeout(p),p=setTimeout(Z,le)},M=async Z=>{if(!e.disabled&&(v.isValid||Z)){const le=e.resolver?lo((await X()).errors):await $(r,!0);le!==n.isValid&&b.state.next({isValid:le})}},A=(Z,le)=>{!e.disabled&&(v.isValidating||v.validatingFields)&&((Z||Array.from(c.mount)).forEach(me=>{me&&(le?or(n.validatingFields,me,le):Ei(n.validatingFields,me))}),b.state.next({validatingFields:n.validatingFields,isValidating:!lo(n.validatingFields)}))},U=(Z,le=[],me,Ve,ze=!0,Oe=!0)=>{if(Ve&&me&&!e.disabled){if(l.action=!0,Oe&&Array.isArray(rt(r,Z))){const ut=me(rt(r,Z),Ve.argA,Ve.argB);ze&&or(r,Z,ut)}if(Oe&&Array.isArray(rt(n.errors,Z))){const ut=me(rt(n.errors,Z),Ve.argA,Ve.argB);ze&&or(n.errors,Z,ut),pY(n.errors,Z)}if(v.touchedFields&&Oe&&Array.isArray(rt(n.touchedFields,Z))){const ut=me(rt(n.touchedFields,Z),Ve.argA,Ve.argB);ze&&or(n.touchedFields,Z,ut)}v.dirtyFields&&(n.dirtyFields=Sv(a,s)),b.state.next({name:Z,isDirty:J(Z,le),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else or(s,Z,le)},V=(Z,le)=>{or(n.errors,Z,le),b.state.next({errors:n.errors})},j=Z=>{n.errors=Z,b.state.next({errors:n.errors,isValid:!1})},I=(Z,le,me,Ve)=>{const ze=rt(r,Z);if(ze){const Oe=rt(s,Z,ci(me)?rt(a,Z):me);ci(Oe)||Ve&&Ve.defaultChecked||le?or(s,Z,le?Oe:Lw(ze._f)):Ge(Z,Oe),l.mount&&M()}},N=(Z,le,me,Ve,ze)=>{let Oe=!1,ut=!1;const Nt={name:Z};if(!e.disabled){const fe=!!(rt(r,Z)&&rt(r,Z)._f&&rt(r,Z)._f.disabled);if(!me||Ve){v.isDirty&&(ut=n.isDirty,n.isDirty=Nt.isDirty=J(),Oe=ut!==Nt.isDirty);const Re=fe||jc(rt(a,Z),le);ut=!!(!fe&&rt(n.dirtyFields,Z)),Re||fe?Ei(n.dirtyFields,Z):or(n.dirtyFields,Z,!0),Nt.dirtyFields=n.dirtyFields,Oe=Oe||v.dirtyFields&&ut!==!Re}if(me){const Re=rt(n.touchedFields,Z);Re||(or(n.touchedFields,Z,me),Nt.touchedFields=n.touchedFields,Oe=Oe||v.touchedFields&&Re!==me)}Oe&&ze&&b.state.next(Nt)}return Oe?Nt:{}},ne=(Z,le,me,Ve)=>{const ze=rt(n.errors,Z),Oe=v.isValid&&Qo(le)&&n.isValid!==le;if(e.delayError&&me?(h=R(()=>V(Z,me)),h(e.delayError)):(clearTimeout(p),h=null,me?or(n.errors,Z,me):Ei(n.errors,Z)),(me?!jc(ze,me):ze)||!lo(Ve)||Oe){const ut={...Ve,...Oe&&Qo(le)?{isValid:le}:{},errors:n.errors,name:Z};n={...n,...ut},b.state.next(ut)}},X=async Z=>{A(Z,!0);const le=await e.resolver(s,e.context,cY(Z||c.mount,r,e.criteriaMode,e.shouldUseNativeValidation));return A(Z),le},se=async Z=>{const{errors:le}=await X(Z);if(Z)for(const me of Z){const Ve=rt(le,me);Ve?or(n.errors,me,Ve):Ei(n.errors,me)}else n.errors=le;return le},$=async(Z,le,me={valid:!0})=>{for(const Ve in Z){const ze=Z[Ve];if(ze){const{_f:Oe,...ut}=ze;if(Oe){const Nt=c.array.has(Oe.name),fe=ze._f&&dY(ze._f);fe&&v.validatingFields&&A([Ve],!0);const Re=await L3(ze,c.disabled,s,E,e.shouldUseNativeValidation&&!le,Nt);if(fe&&v.validatingFields&&A([Ve]),Re[Oe.name]&&(me.valid=!1,le))break;!le&&(rt(Re,Oe.name)?Nt?oY(n.errors,Re,Oe.name):or(n.errors,Oe.name,Re[Oe.name]):Ei(n.errors,Oe.name))}!lo(ut)&&await $(ut,le,me)}}return me.valid},oe=()=>{for(const Z of c.unMount){const le=rt(r,Z);le&&(le._f.refs?le._f.refs.every(me=>!Mw(me)):!Mw(le._f.ref))&&ht(Z)}c.unMount=new Set},J=(Z,le)=>!e.disabled&&(Z&&le&&or(s,Z,le),!jc(ee(),a)),xe=(Z,le,me)=>x3(Z,c,{...l.mount?s:ci(le)?a:bl(Z)?{[Z]:le}:le},me,le),ke=Z=>nS(rt(l.mount?s:a,Z,e.shouldUnregister?rt(a,Z,[]):[])),Ge=(Z,le,me={})=>{const Ve=rt(r,Z);let ze=le;if(Ve){const Oe=Ve._f;Oe&&(!Oe.disabled&&or(s,Z,F3(le,Oe)),ze=aS(Oe.ref)&&Va(le)?"":le,N3(Oe.ref)?[...Oe.ref.options].forEach(ut=>ut.selected=ze.includes(ut.value)):Oe.refs?vv(Oe.ref)?Oe.refs.length>1?Oe.refs.forEach(ut=>(!ut.defaultChecked||!ut.disabled)&&(ut.checked=Array.isArray(ze)?!!ze.find(Nt=>Nt===ut.value):ze===ut.value)):Oe.refs[0]&&(Oe.refs[0].checked=!!ze):Oe.refs.forEach(ut=>ut.checked=ut.value===ze):Pw(Oe.ref)?Oe.ref.value="":(Oe.ref.value=ze,Oe.ref.type||b.values.next({name:Z,values:{...s}})))}(me.shouldDirty||me.shouldTouch)&&N(Z,ze,me.shouldTouch,me.shouldDirty,!0),me.shouldValidate&&z(Z)},Je=(Z,le,me)=>{for(const Ve in le){const ze=le[Ve],Oe=`${Z}.${Ve}`,ut=rt(r,Oe);(c.array.has(Z)||ui(ze)||ut&&!ut._f)&&!df(ze)?Je(Oe,ze,me):Ge(Oe,ze,me)}},je=(Z,le,me={})=>{const Ve=rt(r,Z),ze=c.array.has(Z),Oe=so(le);or(s,Z,Oe),ze?(b.array.next({name:Z,values:{...s}}),(v.isDirty||v.dirtyFields)&&me.shouldDirty&&b.state.next({name:Z,dirtyFields:Sv(a,s),isDirty:J(Z,Oe)})):Ve&&!Ve._f&&!Va(Oe)?Je(Z,Oe,me):Ge(Z,Oe,me),E3(Z,c)&&b.state.next({...n}),b.values.next({name:l.mount?Z:void 0,values:{...s}})},ve=async Z=>{l.mount=!0;const le=Z.target;let me=le.name,Ve=!0;const ze=rt(r,me),Oe=()=>le.type?Lw(ze._f):v3(Z),ut=Nt=>{Ve=Number.isNaN(Nt)||df(Nt)&&isNaN(Nt.getTime())||jc(Nt,rt(s,me,Nt))};if(ze){let Nt,fe;const Re=Oe(),vt=Z.type===rS.BLUR||Z.type===rS.FOCUS_OUT,Ft=!fY(ze._f)&&!e.resolver&&!rt(n.errors,me)&&!ze._f.deps||hY(vt,rt(n.touchedFields,me),n.isSubmitted,T,k),Kt=E3(me,c,vt);or(s,me,Re),vt?(ze._f.onBlur&&ze._f.onBlur(Z),h&&h(0)):ze._f.onChange&&ze._f.onChange(Z);const Be=N(me,Re,vt,!1),ct=!lo(Be)||Kt;if(!vt&&b.values.next({name:me,type:Z.type,values:{...s}}),Ft)return v.isValid&&(e.mode==="onBlur"&&vt?M():vt||M()),ct&&b.state.next({name:me,...Kt?{}:Be});if(!vt&&Kt&&b.state.next({...n}),e.resolver){const{errors:At}=await X([me]);if(ut(Re),Ve){const ln=V3(n.errors,r,me),En=V3(At,r,ln.name||me);Nt=En.error,me=En.name,fe=lo(At)}}else A([me],!0),Nt=(await L3(ze,c.disabled,s,E,e.shouldUseNativeValidation))[me],A([me]),ut(Re),Ve&&(Nt?fe=!1:v.isValid&&(fe=await $(r,!0)));Ve&&(ze._f.deps&&z(ze._f.deps),ne(me,fe,Nt,Be))}},He=(Z,le)=>{if(rt(n.errors,le)&&Z.focus)return Z.focus(),1},z=async(Z,le={})=>{let me,Ve;const ze=yv(Z);if(e.resolver){const Oe=await se(ci(Z)?Z:ze);me=lo(Oe),Ve=Z?!ze.some(ut=>rt(Oe,ut)):me}else Z?(Ve=(await Promise.all(ze.map(async Oe=>{const ut=rt(r,Oe);return await $(ut&&ut._f?{[Oe]:ut}:ut)}))).every(Boolean),!(!Ve&&!n.isValid)&&M()):Ve=me=await $(r);return b.state.next({...!bl(Z)||v.isValid&&me!==n.isValid?{}:{name:Z},...e.resolver||!Z?{isValid:me}:{},errors:n.errors}),le.shouldFocus&&!Ve&&bv(r,He,Z?ze:c.mount),Ve},ee=Z=>{const le={...l.mount?s:a};return ci(Z)?le:bl(Z)?rt(le,Z):Z.map(me=>rt(le,me))},Ce=(Z,le)=>({invalid:!!rt((le||n).errors,Z),isDirty:!!rt((le||n).dirtyFields,Z),error:rt((le||n).errors,Z),isValidating:!!rt(n.validatingFields,Z),isTouched:!!rt((le||n).touchedFields,Z)}),H=Z=>{Z&&yv(Z).forEach(le=>Ei(n.errors,le)),b.state.next({errors:Z?n.errors:{}})},Ct=(Z,le,me)=>{const Ve=(rt(r,Z,{_f:{}})._f||{}).ref,ze=rt(n.errors,Z)||{},{ref:Oe,message:ut,type:Nt,...fe}=ze;or(n.errors,Z,{...fe,...le,ref:Ve}),b.state.next({name:Z,errors:n.errors,isValid:!1}),me&&me.shouldFocus&&Ve&&Ve.focus&&Ve.focus()},Rt=(Z,le)=>Sl(Z)?b.values.subscribe({next:me=>Z(xe(void 0,le),me)}):xe(Z,le,!0),ht=(Z,le={})=>{for(const me of Z?yv(Z):c.mount)c.mount.delete(me),c.array.delete(me),le.keepValue||(Ei(r,me),Ei(s,me)),!le.keepError&&Ei(n.errors,me),!le.keepDirty&&Ei(n.dirtyFields,me),!le.keepTouched&&Ei(n.touchedFields,me),!le.keepIsValidating&&Ei(n.validatingFields,me),!e.shouldUnregister&&!le.keepDefaultValue&&Ei(a,me);b.values.next({values:{...s}}),b.state.next({...n,...le.keepDirty?{isDirty:J()}:{}}),!le.keepIsValid&&M()},bt=({disabled:Z,name:le,field:me,fields:Ve})=>{(Qo(Z)&&l.mount||Z||c.disabled.has(le))&&(Z?c.disabled.add(le):c.disabled.delete(le),N(le,Lw(me?me._f:rt(Ve,le)._f),!1,!1,!0))},it=(Z,le={})=>{let me=rt(r,Z);const Ve=Qo(le.disabled)||Qo(e.disabled);return or(r,Z,{...me||{},_f:{...me&&me._f?me._f:{ref:{name:Z}},name:Z,mount:!0,...le}}),c.mount.add(Z),me?bt({field:me,disabled:Qo(le.disabled)?le.disabled:e.disabled,name:Z}):I(Z,!0,le.value),{...Ve?{disabled:le.disabled||e.disabled}:{},...e.progressive?{required:!!le.required,min:Cv(le.min),max:Cv(le.max),minLength:Cv(le.minLength),maxLength:Cv(le.maxLength),pattern:Cv(le.pattern)}:{},name:Z,onChange:ve,onBlur:ve,ref:ze=>{if(ze){it(Z,le),me=rt(r,Z);const Oe=ci(ze.value)&&ze.querySelectorAll&&ze.querySelectorAll("input,select,textarea")[0]||ze,ut=uY(Oe),Nt=me._f.refs||[];if(ut?Nt.find(fe=>fe===Oe):Oe===me._f.ref)return;or(r,Z,{_f:{...me._f,...ut?{refs:[...Nt.filter(Mw),Oe,...Array.isArray(rt(a,Z))?[{}]:[]],ref:{type:Oe.type,name:Z}}:{ref:Oe}}}),I(Z,!1,void 0,Oe)}else me=rt(r,Z,{}),me._f&&(me._f.mount=!1),(e.shouldUnregister||le.shouldUnregister)&&!(y3(c.array,Z)&&l.action)&&c.unMount.add(Z)}}},xt=()=>e.shouldFocusError&&bv(r,He,c.mount),tn=Z=>{Qo(Z)&&(b.state.next({disabled:Z}),bv(r,(le,me)=>{const Ve=rt(r,me);Ve&&(le.disabled=Ve._f.disabled||Z,Array.isArray(Ve._f.refs)&&Ve._f.refs.forEach(ze=>{ze.disabled=Ve._f.disabled||Z}))},0,!1))},qn=(Z,le)=>async me=>{let Ve;me&&(me.preventDefault&&me.preventDefault(),me.persist&&me.persist());let ze=so(s);if(c.disabled.size)for(const Oe of c.disabled)or(ze,Oe,void 0);if(b.state.next({isSubmitting:!0}),e.resolver){const{errors:Oe,values:ut}=await X();n.errors=Oe,ze=ut}else await $(r);if(Ei(n.errors,"root"),lo(n.errors)){b.state.next({errors:{}});try{await Z(ze,me)}catch(Oe){Ve=Oe}}else le&&await le({...n.errors},me),xt(),setTimeout(xt);if(b.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:lo(n.errors)&&!Ve,submitCount:n.submitCount+1,errors:n.errors}),Ve)throw Ve},_r=(Z,le={})=>{rt(r,Z)&&(ci(le.defaultValue)?je(Z,so(rt(a,Z))):(je(Z,le.defaultValue),or(a,Z,so(le.defaultValue))),le.keepTouched||Ei(n.touchedFields,Z),le.keepDirty||(Ei(n.dirtyFields,Z),n.isDirty=le.defaultValue?J(Z,so(rt(a,Z))):J()),le.keepError||(Ei(n.errors,Z),v.isValid&&M()),b.state.next({...n}))},vr=(Z,le={})=>{const me=Z?so(Z):a,Ve=so(me),ze=lo(Z),Oe=ze?a:Ve;if(le.keepDefaultValues||(a=me),!le.keepValues){if(le.keepDirtyValues){const ut=new Set([...c.mount,...Object.keys(Sv(a,s))]);for(const Nt of Array.from(ut))rt(n.dirtyFields,Nt)?or(Oe,Nt,rt(s,Nt)):je(Nt,rt(Oe,Nt))}else{if(_w&&ci(Z))for(const ut of c.mount){const Nt=rt(r,ut);if(Nt&&Nt._f){const fe=Array.isArray(Nt._f.refs)?Nt._f.refs[0]:Nt._f.ref;if(aS(fe)){const Re=fe.closest("form");if(Re){Re.reset();break}}}}r={}}s=e.shouldUnregister?le.keepDefaultValues?so(a):{}:so(Oe),b.array.next({values:{...Oe}}),b.values.next({values:{...Oe}})}c={mount:le.keepDirtyValues?c.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},l.mount=!v.isValid||!!le.keepIsValid||!!le.keepDirtyValues,l.watch=!!e.shouldUnregister,b.state.next({submitCount:le.keepSubmitCount?n.submitCount:0,isDirty:ze?!1:le.keepDirty?n.isDirty:!!(le.keepDefaultValues&&!jc(Z,a)),isSubmitted:le.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:ze?{}:le.keepDirtyValues?le.keepDefaultValues&&s?Sv(a,s):n.dirtyFields:le.keepDefaultValues&&Z?Sv(a,Z):le.keepDirty?n.dirtyFields:{},touchedFields:le.keepTouched?n.touchedFields:{},errors:le.keepErrors?n.errors:{},isSubmitSuccessful:le.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},Xn=(Z,le)=>vr(Sl(Z)?Z(s):Z,le);return{control:{register:it,unregister:ht,getFieldState:Ce,handleSubmit:qn,setError:Ct,_executeSchema:X,_getWatch:xe,_getDirty:J,_updateValid:M,_removeUnmounted:oe,_updateFieldArray:U,_updateDisabledField:bt,_getFieldArray:ke,_reset:vr,_resetDefaultValues:()=>Sl(e.defaultValues)&&e.defaultValues().then(Z=>{Xn(Z,e.resetOptions),b.state.next({isLoading:!1})}),_updateFormState:Z=>{n={...n,...Z}},_disableForm:tn,_subjects:b,_proxyFormState:v,_setErrors:j,get _fields(){return r},get _formValues(){return s},get _state(){return l},set _state(Z){l=Z},get _defaultValues(){return a},get _names(){return c},set _names(Z){c=Z},get _formState(){return n},set _formState(Z){n=Z},get _options(){return e},set _options(Z){e={...e,...Z}}},trigger:z,register:it,handleSubmit:qn,watch:Rt,setValue:je,getValues:ee,reset:Xn,resetField:_r,clearErrors:H,unregister:ht,setError:Ct,setFocus:(Z,le={})=>{const me=rt(r,Z),Ve=me&&me._f;if(Ve){const ze=Ve.refs?Ve.refs[0]:Ve.ref;ze.focus&&(ze.focus(),le.shouldSelect&&Sl(ze.select)&&ze.select())}},getFieldState:Ce}}function vY(t={}){const e=ir.useRef(void 0),n=ir.useRef(void 0),[r,a]=ir.useState({isDirty:!1,isValidating:!1,isLoading:Sl(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1,defaultValues:Sl(t.defaultValues)?void 0:t.defaultValues});e.current||(e.current={...gY(t),formState:r});const s=e.current.control;return s._options=t,Rw({subject:s._subjects.state,next:l=>{k3(l,s._proxyFormState,s._updateFormState,!0)&&a({...s._formState})}}),ir.useEffect(()=>s._disableForm(t.disabled),[s,t.disabled]),ir.useEffect(()=>{if(s._proxyFormState.isDirty){const l=s._getDirty();l!==r.isDirty&&s._subjects.state.next({isDirty:l})}},[s,r.isDirty]),ir.useEffect(()=>{t.values&&!jc(t.values,n.current)?(s._reset(t.values,s._options.resetOptions),n.current=t.values,a(l=>({...l}))):s._resetDefaultValues()},[t.values,s]),ir.useEffect(()=>{t.errors&&s._setErrors(t.errors)},[t.errors,s]),ir.useEffect(()=>{s._state.mount||(s._updateValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),ir.useEffect(()=>{t.shouldUnregister&&s._subjects.values.next({values:s._getWatch()})},[t.shouldUnregister,s]),e.current.formState=C3(r,s),e.current}const z3=(t,e,n)=>{if(t&&"reportValidity"in t){const r=rt(n,e);t.setCustomValidity(r&&r.message||""),t.reportValidity()}},B3=(t,e)=>{for(const n in e.fields){const r=e.fields[n];r&&r.ref&&"reportValidity"in r.ref?z3(r.ref,n,t):r.refs&&r.refs.forEach(a=>z3(a,n,t))}},yY=(t,e)=>{e.shouldUseNativeValidation&&B3(t,e);const n={};for(const r in t){const a=rt(e.fields,r),s=Object.assign(t[r]||{},{ref:a&&a.ref});if(bY(e.names||Object.keys(t),r)){const l=Object.assign({},rt(n,r));or(l,"root",s),or(n,r,l)}else or(n,r,s)}return n},bY=(t,e)=>t.some(n=>n.startsWith(e+"."));var SY=function(t,e){for(var n={};t.length;){var r=t[0],a=r.code,s=r.message,l=r.path.join(".");if(!n[l])if("unionErrors"in r){var c=r.unionErrors[0].errors[0];n[l]={message:c.message,type:c.code}}else n[l]={message:s,type:a};if("unionErrors"in r&&r.unionErrors.forEach(function(v){return v.errors.forEach(function(b){return t.push(b)})}),e){var h=n[l].types,p=h&&h[r.code];n[l]=w3(l,e,n,a,p?[].concat(p,r.message):r.message)}t.shift()}return n},CY=function(t,e,n){return n===void 0&&(n={}),function(r,a,s){try{return Promise.resolve(function(l,c){try{var h=Promise.resolve(t[n.mode==="sync"?"parse":"parseAsync"](r,e)).then(function(p){return s.shouldUseNativeValidation&&B3({},s),{errors:{},values:n.raw?r:p}})}catch(p){return c(p)}return h&&h.then?h.then(void 0,c):h}(0,function(l){if(function(c){return Array.isArray(c==null?void 0:c.errors)}(l))return{values:{},errors:yY(SY(l.errors,!s.shouldUseNativeValidation&&s.criteriaMode==="all"),s)};throw l}))}catch(l){return Promise.reject(l)}}};function H3(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function kY(...t){return e=>{let n=!1;const r=t.map(a=>{const s=H3(a,e);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let a=0;a<r.length;a++){const s=r[a];typeof s=="function"?s():H3(t[a],null)}}}}var uS=G.forwardRef((t,e)=>{const{children:n,...r}=t,a=G.Children.toArray(n),s=a.find(xY);if(s){const l=s.props.children,c=a.map(h=>h===s?G.Children.count(l)>1?G.Children.only(null):G.isValidElement(l)?l.props.children:null:h);return W.jsx(Nw,{...r,ref:e,children:G.isValidElement(l)?G.cloneElement(l,void 0,c):null})}return W.jsx(Nw,{...r,ref:e,children:n})});uS.displayName="Slot";var Nw=G.forwardRef((t,e)=>{const{children:n,...r}=t;if(G.isValidElement(n)){const a=_Y(n);return G.cloneElement(n,{...wY(r,n.props),ref:e?kY(e,a):a})}return G.Children.count(n)>1?G.Children.only(null):null});Nw.displayName="SlotClone";var TY=({children:t})=>W.jsx(W.Fragment,{children:t});function xY(t){return G.isValidElement(t)&&t.type===TY}function wY(t,e){const n={...e};for(const r in e){const a=t[r],s=e[r];/^on[A-Z]/.test(r)?a&&s?n[r]=(...c)=>{s(...c),a(...c)}:a&&(n[r]=a):r==="style"?n[r]={...a,...s}:r==="className"&&(n[r]=[a,s].filter(Boolean).join(" "))}return{...t,...n}}function _Y(t){var r,a;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(a=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:a.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var EY=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],RY=EY.reduce((t,e)=>{const n=G.forwardRef((r,a)=>{const{asChild:s,...l}=r,c=s?uS:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),W.jsx(c,{...l,ref:a})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{}),PY="Label",$3=G.forwardRef((t,e)=>W.jsx(RY.label,{...t,ref:e,onMouseDown:n=>{var a;n.target.closest("button, input, select, textarea")||((a=t.onMouseDown)==null||a.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));$3.displayName=PY;var q3=$3;const W3=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,G3=KI,Y3=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return G3(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:a,defaultVariants:s}=e,l=Object.keys(a).map(p=>{const v=n==null?void 0:n[p],b=s==null?void 0:s[p];if(v===null)return null;const k=W3(v)||W3(b);return a[p][k]}),c=n&&Object.entries(n).reduce((p,v)=>{let[b,k]=v;return k===void 0||(p[b]=k),p},{}),h=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((p,v)=>{let{class:b,className:k,...T}=v;return Object.entries(T).every(E=>{let[R,M]=E;return Array.isArray(M)?M.includes({...s,...c}[R]):{...s,...c}[R]===M})?[...p,b,k]:p},[]);return G3(t,l,h,n==null?void 0:n.class,n==null?void 0:n.className)},DY=Y3("ringg_ai-text-sm ringg_ai-font-medium ringg_ai-leading-none peer-disabled:ringg_ai-cursor-not-allowed peer-disabled:ringg_ai-opacity-70"),K3=G.forwardRef(({className:t,...e},n)=>W.jsx(q3,{ref:n,className:xr(DY(),t),...e}));K3.displayName=q3.displayName;const AY=tY,Z3=G.createContext({}),OY=({...t})=>W.jsx(Z3.Provider,{value:{name:t.name},children:W.jsx(aY,{...t})}),cS=()=>{const t=G.useContext(Z3),e=G.useContext(Q3),{getFieldState:n,formState:r}=iS(),a=n(t.name,r);if(!t)throw new Error("useFormField should be used within <FormField>");const{id:s}=e;return{id:s,name:t.name,formItemId:`${s}-form-item`,formDescriptionId:`${s}-form-item-description`,formMessageId:`${s}-form-item-message`,...a}},Q3=G.createContext({}),X3=G.forwardRef(({className:t,...e},n)=>{const r=G.useId();return W.jsx(Q3.Provider,{value:{id:r},children:W.jsx("div",{ref:n,className:xr("ringg_ai-space-y-2",t),...e})})});X3.displayName="FormItem";const MY=G.forwardRef(({className:t,...e},n)=>{const{error:r,formItemId:a}=cS();return W.jsx(K3,{ref:n,className:xr(r&&"ringg_ai-text-destructive",t),htmlFor:a,...e})});MY.displayName="FormLabel";const J3=G.forwardRef(({...t},e)=>{const{error:n,formItemId:r,formDescriptionId:a,formMessageId:s}=cS();return W.jsx(uS,{ref:e,id:r,"aria-describedby":n?`${a} ${s}`:`${a}`,"aria-invalid":!!n,...t})});J3.displayName="FormControl";const LY=G.forwardRef(({className:t,...e},n)=>{const{formDescriptionId:r}=cS();return W.jsx("p",{ref:n,id:r,className:xr("ringg_ai-text-[0.8rem] ringg_ai-text-muted-foreground",t),...e})});LY.displayName="FormDescription";const e4=G.forwardRef(({className:t,children:e,...n},r)=>{const{error:a,formMessageId:s}=cS(),l=a?String((a==null?void 0:a.message)??""):e;return l?W.jsx("p",{ref:r,id:s,className:xr("ringg_ai-text-[0.8rem] ringg_ai-font-medium ringg_ai-text-destructive",t),...n,children:l}):null});e4.displayName="FormMessage";const NY=({isSending:t,onMessageSubmit:e})=>{const n=Zo(),r=vY({defaultValues:{message:""},resolver:CY(QG),mode:"onSubmit"}),a=s=>{console.log("%c[Message Sent] User:","background: #3b82f6; color: white; padding: 2px 6px; border-radius: 3px;",s.message),e==null||e(s.message),r.reset()};return W.jsx(AY,{...r,children:W.jsx("form",{onSubmit:r.handleSubmit(a),children:W.jsx(OY,{control:r.control,name:"message",render:({field:s})=>W.jsxs(X3,{children:[W.jsxs("div",{className:"ringg_ai-relative",children:[W.jsx(J3,{children:W.jsx("input",{placeholder:"Type here",autoComplete:"off",className:"ringg_ai-w-full ringg_ai-rounded-full ringg_ai-h-12 ringg_ai-px-4 ringg_ai-pr-14 ringg_ai-text-sm ringg_ai-border focus:ringg_ai-outline-none focus:ringg_ai-ring-2",style:{backgroundColor:n.surfaceColor,color:n.textColor,borderColor:n.borderColor,"--tw-ring-color":n.primaryColor},...s})}),W.jsxs("button",{type:"submit",disabled:t,className:"ringg_ai-absolute ringg_ai-right-1 ringg_ai-top-1/2 ringg_ai-transform -ringg_ai-translate-y-1/2 ringg_ai-rounded-full ringg_ai-h-10 ringg_ai-w-10 ringg_ai-flex ringg_ai-items-center ringg_ai-justify-center ringg_ai-transition-opacity hover:ringg_ai-opacity-80 disabled:ringg_ai-opacity-50",style:{backgroundColor:n.primaryColor,color:n.primaryTextColor},children:[W.jsx(hW,{className:"ringg_ai-h-4 ringg_ai-w-4"}),W.jsx("span",{className:"ringg_ai-sr-only",children:"Send message"})]})]}),W.jsx(e4,{})]})})})})},IY=({isCalling:t,callMode:e,buttonConfig:n,onCallEnd:r})=>{var v,b;const a=Zo(),s=JT(),{send:l,isSending:c}=$M(),h=async()=>s.localParticipant.setMicrophoneEnabled(!s.localParticipant.isMicrophoneEnabled),p=()=>r==null?void 0:r();return t&&e==="text"?W.jsx(NY,{isSending:c,onMessageSubmit:l}):t&&e==="audio"?W.jsxs("div",{className:"ringg_ai-flex ringg_ai-flex-row ringg_ai-w-full ringg_ai-justify-between ringg_ai-items-center",children:[W.jsxs("div",{className:"ringg_ai-flex ringg_ai-flex-col ringg_ai-gap-1",children:[W.jsx("button",{onClick:h,className:xr("ringg_ai-rounded-full ringg_ai-h-12 ringg_ai-w-12 ringg_ai-flex ringg_ai-items-center ringg_ai-justify-center ringg_ai-transition-opacity hover:ringg_ai-opacity-80"),style:{backgroundColor:a.surfaceColor,...(v=n==null?void 0:n.mic)==null?void 0:v.styles},children:s.localParticipant.isMicrophoneEnabled?W.jsx(fW,{className:"ringg_ai-h-4 ringg_ai-w-4",style:{color:a.textColor}}):W.jsx(rW,{className:"ringg_ai-h-4 ringg_ai-w-4",style:{color:a.textColor}})}),W.jsx("p",{className:"ringg_ai-text-sm ringg_ai-text-center ringg_ai-font-normal",style:{color:a.mutedTextColor},children:s.localParticipant.isMicrophoneEnabled?"Mute":"Un-Mute"})]}),W.jsxs("div",{className:"ringg_ai-flex ringg_ai-flex-col ringg_ai-gap-1",children:[W.jsx("button",{onClick:p,className:xr("ringg_ai-rounded-full ringg_ai-h-12 ringg_ai-w-12 ringg_ai-flex ringg_ai-items-center ringg_ai-justify-center ringg_ai-transition-opacity hover:ringg_ai-opacity-80"),style:{backgroundColor:a.errorColor,...(b=n==null?void 0:n.mic)==null?void 0:b.styles},children:W.jsx(dW,{className:"ringg_ai-h-4 ringg_ai-w-4 ringg_ai-text-white"})}),W.jsx("p",{className:"ringg_ai-text-sm ringg_ai-text-center ringg_ai-font-normal",style:{color:a.mutedTextColor},children:"End Call"})]})]}):null},UY=({children:t,open:e,containerRef:n})=>{const r=Zo();return!e||!n.current?null:aD.createPortal(W.jsx("div",{className:"ringg_ai-absolute ringg_ai-inset-0 ringg_ai-z-[9999] ringg_ai-flex ringg_ai-items-center ringg_ai-justify-center ringg_ai-bg-black/50",children:W.jsx("div",{className:"ringg_ai-relative ringg_ai-shadow-lg ringg_ai-max-w-md ringg_ai-w-full ringg_ai-mx-4 ringg_ai-p-6",style:{backgroundColor:r.backgroundColor,borderRadius:r.borderRadius,color:r.textColor},children:t})}),n.current)},FY=({children:t,className:e=""})=>W.jsx("div",{className:xr("ringg_ai-space-y-4",e),children:t}),jY=({children:t})=>W.jsx("div",{className:"ringg_ai-space-y-2",children:t}),VY=({children:t})=>{const e=Zo();return W.jsx("h2",{className:"ringg_ai-text-md ringg_ai-font-medium",style:{color:e.textColor},children:t})},zY=({children:t})=>{const e=Zo();return W.jsx("p",{className:"ringg_ai-text-sm",style:{color:e.mutedTextColor},children:t})},BY=({children:t})=>W.jsx("div",{className:"ringg_ai-flex ringg_ai-justify-center ringg_ai-space-x-2 ringg_ai-pt-4",children:t}),HY=({filled:t,onClick:e,onMouseEnter:n,onMouseLeave:r,starsStyles:a})=>{const s=(a==null?void 0:a.filledColor)??"#FBBF24",l=(a==null?void 0:a.emptyColor)??"#D1D5DB";return W.jsx("button",{type:"button",onClick:e,onMouseEnter:n,onMouseLeave:r,className:"ringg_ai-p-1 ringg_ai-transition-transform hover:ringg_ai-scale-110",children:W.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:t?s:"none",stroke:t?s:l,strokeWidth:"2",className:"ringg_ai-w-8 ringg_ai-h-8 ringg_ai-cursor-pointer ringg_ai-transition-colors",children:W.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.48 3.499a.562.562 0 011.04 0l2.125 5.111a.563.563 0 00.475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 00-.182.557l1.285 5.385a.562.562 0 01-.84.61l-4.725-2.885a.563.563 0 00-.586 0L6.982 20.54a.562.562 0 01-.84-.61l1.285-5.386a.562.562 0 00-.182-.557l-4.204-3.602a.563.563 0 01.321-.988l5.518-.442a.563.563 0 00.475-.345L11.48 3.5z"})})})},$Y=({callMode:t,isSubmitting:e,feedbackScreenConfig:n,onSubmit:r,onSkip:a})=>{const s=Zo(),l=mw(s.buttonStyle),[c,h]=G.useState(0),[p,v]=G.useState(0),[b,k]=G.useState(""),T=()=>{c>0&&r(c,b)},E=p||c,R=(n==null?void 0:n.starsCount)??5,M=Array.from({length:R},(A,U)=>U+1);return W.jsxs("div",{className:"ringg_ai-flex ringg_ai-flex-col ringg_ai-items-center ringg_ai-justify-center ringg_ai-p-6 ringg_ai-h-full ringg_ai-gap-4",children:[W.jsxs("div",{className:"ringg_ai-text-center",children:[W.jsx("h3",{className:"ringg_ai-text-lg ringg_ai-font-semibold ringg_ai-mb-1",style:{color:s.textColor},children:(n==null?void 0:n.title)??`How was your ${t==="text"?"chat":"call"}?`}),W.jsx("p",{className:"ringg_ai-text-sm",style:{color:s.mutedTextColor},children:(n==null?void 0:n.description)??"Your feedback helps us improve!"})]}),W.jsx("div",{className:"ringg_ai-flex ringg_ai-gap-1 ringg_ai-my-2",children:M.map(A=>W.jsx(HY,{filled:A<=E,onClick:()=>h(A),onMouseEnter:()=>v(A),onMouseLeave:()=>v(0),starsStyles:n==null?void 0:n.starsStyles},A))}),W.jsx("textarea",{value:b,onChange:A=>k(A.target.value),placeholder:(n==null?void 0:n.placeholder)??"We'd love to hear more...",className:xr("ringg_ai-w-full ringg_ai-min-h-[80px] ringg_ai-p-3 ringg_ai-text-sm ringg_ai-border ringg_ai-resize-none focus:ringg_ai-outline-none focus:ringg_ai-ring-2"),style:{backgroundColor:s.surfaceColor,color:s.textColor,borderColor:s.borderColor,borderRadius:l,"--tw-ring-color":s.primaryColor},maxLength:500}),W.jsxs("div",{className:"ringg_ai-flex ringg_ai-w-full ringg_ai-flex-col ringg_ai-gap-3 ringg_ai-mt-2",children:[W.jsx("button",{onClick:T,disabled:c===0||e,className:xr("ringg_ai-w-full ringg_ai-py-2.5 ringg_ai-font-medium ringg_ai-transition-all","hover:ringg_ai-opacity-90 disabled:ringg_ai-opacity-50 disabled:ringg_ai-cursor-not-allowed"),style:{backgroundColor:s.primaryColor,color:s.primaryTextColor,borderRadius:l,...n==null?void 0:n.submitBtnStyles},children:(n==null?void 0:n.submitBtnCTA)??"Submit Feedback"}),W.jsx("button",{type:"button",onClick:a,disabled:e,className:"ringg_ai-text-sm ringg_ai-w-full ringg_ai-transition-colors hover:ringg_ai-opacity-80",style:{color:s.mutedTextColor},children:"Skip"})]})]})},qY=({isCalling:t,isLoading:e,title:n,description:r,logoUrl:a="https://assets.ringg.ai/images/logo/logo-dark.png",logoStyles:s})=>{const l=Zo();if(!t)return W.jsxs(W.Fragment,{children:[W.jsx("div",{className:"ringg_ai-mx-auto ringg_ai-overflow-clip ringg_ai-w-[70px] ringg_ai-h-[70px] ringg_ai-rounded-full ringg_ai-flex ringg_ai-items-center ringg_ai-justify-center",style:{backgroundColor:l.primaryColor,...s},children:W.jsx("img",{src:a,alt:"Logo"})}),W.jsxs("div",{className:"ringg_ai-flex ringg_ai-gap-1 ringg_ai-flex-col",children:[W.jsx("h2",{className:"ringg_ai-text-xl ringg_ai-text-center ringg_ai-font-medium",style:{color:l.textColor},children:n}),!e&&W.jsxs("p",{className:"ringg_ai-text-sm ringg_ai-text-center ringg_ai-font-normal",style:{color:l.mutedTextColor},children:[r,"."]}),e&&W.jsx("p",{className:"ringg_ai-text-sm ringg_ai-text-yellow-500 ringg_ai-text-center ringg_ai-font-normal",children:"Connecting.."})]})]});if(t)return W.jsxs("div",{className:"ringg_ai-absolute ringg_ai-overflow-clip ringg_ai-border-b ringg_ai-w-full ringg_ai-top-0 ringg_ai-left-0 ringg_ai-p-4 ringg_ai-flex ringg_ai-flex-row ringg_ai-gap-2 ringg_ai-justify-start ringg_ai-items-center",style:{backgroundColor:l.backgroundColor,borderColor:l.borderColor},children:[W.jsx("div",{className:"ringg_ai-w-[48px] ringg_ai-h-[48px] ringg_ai-rounded-full ringg_ai-flex ringg_ai-items-center ringg_ai-justify-center",style:{backgroundColor:l.primaryColor,...s},children:W.jsx("img",{src:a,alt:"Logo"})}),W.jsxs("div",{className:"ringg_ai-w-fit ringg_ai-flex ringg_ai-flex-col",children:[W.jsx("h2",{className:"ringg_ai-text-xl ringg_ai-text-start ringg_ai-font-medium",style:{color:l.textColor},children:n}),W.jsx("p",{className:"ringg_ai-text-sm ringg_ai-text-start ringg_ai-font-normal",style:{color:l.successColor},children:e?"Calling...":t?"Call in Progress":""})]})]})};function WY(t){const e=new Map;return t.forEach(n=>{const a=new Date(n.datetime).toISOString().split("T")[0];e.has(a)||e.set(a,[]),e.get(a).push(n)}),Array.from(e.entries()).sort(([n],[r])=>n.localeCompare(r)).map(([n,r])=>{const a=new Date(n);return{date:n,dateLabel:a.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"}),slots:r.sort((s,l)=>new Date(s.datetime).getTime()-new Date(l.datetime).getTime())}})}function t4(t,e){return new Date(t).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0,timeZone:e})}function GY(t){return new Date(t).toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})}function Iw(t,e){const n={};for(const[r,a]of Object.entries(t))if(typeof a=="string"&&a.startsWith("{")&&a.endsWith("}")){const s=a.slice(1,-1);n[r]=e[s]??a}else n[r]=a;return n}function n4(t){return t.component_type==="calendar_booking"}function r4(t){return t.component_type==="form"}function YY(t){return t.component_type==="buttons"}function KY(t){return t.component_type==="confirmation"}const ZY={primaryColor:"#313335",primaryTextColor:"#ffffff",backgroundColor:"#F3F3F5",surfaceColor:"#ffffff",textColor:"#212121",mutedTextColor:"#11111180",borderColor:"#e5e5e5",errorColor:"#ef4444",successColor:"#10b981",fontFamily:"inherit",fontSize:"14px",borderRadius:"12px",padding:"16px",buttonStyle:"rounded",buttonSize:"md"};function Uw(t){return{...ZY,...t}}function Fw(t){switch(t){case"pill":return"9999px";case"square":return"4px";case"rounded":default:return"8px"}}const i4=G.createContext(null),dS=()=>{const t=G.useContext(i4);let e;try{e=Zo()}catch{e=null}return t||Uw(e?{primaryColor:e.primaryColor,primaryTextColor:e.primaryTextColor,backgroundColor:e.surfaceColor,textColor:e.textColor,mutedTextColor:e.mutedTextColor,borderColor:e.borderColor,errorColor:e.errorColor,successColor:e.successColor,buttonStyle:e.buttonStyle}:{})},QY=({payload:t,isProcessing:e,onComplete:n})=>{var T;const r=dS(),a=Fw(r.buttonStyle),{data:s}=t,l=G.useMemo(()=>WY(s.available_slots),[s.available_slots]),[c,h]=G.useState(((T=l[0])==null?void 0:T.date)||""),[p,v]=G.useState(null),b=l.find(E=>E.date===c),k=()=>{p&&n(p.id,p.datetime)};return W.jsxs("div",{children:[W.jsxs("div",{className:"ringg_ai-flex ringg_ai-items-center ringg_ai-gap-2 ringg_ai-mb-3",children:[W.jsx(jI,{className:"ringg_ai-w-4 ringg_ai-h-4",style:{color:r.primaryColor}}),W.jsx("p",{className:"ringg_ai-text-sm ringg_ai-font-medium",style:{color:r.textColor},children:s.title})]}),W.jsxs("p",{className:"ringg_ai-text-xs ringg_ai-mb-3",style:{color:r.mutedTextColor},children:["Timezone: ",s.timezone]}),W.jsxs("div",{className:"ringg_ai-mb-3",children:[W.jsx("p",{className:"ringg_ai-text-xs ringg_ai-font-semibold ringg_ai-uppercase ringg_ai-tracking-wide ringg_ai-mb-2",style:{color:r.mutedTextColor},children:"Select Date"}),W.jsx("div",{className:"ringg_ai-flex ringg_ai-gap-2 ringg_ai-flex-wrap",children:l.map(E=>W.jsx("button",{onClick:()=>{h(E.date),v(null)},className:xr("ringg_ai-px-3 ringg_ai-py-2 ringg_ai-text-xs ringg_ai-font-semibold ringg_ai-transition-all ringg_ai-duration-200","hover:ringg_ai-opacity-90 focus:ringg_ai-outline-none focus:ringg_ai-ring-2 focus:ringg_ai-ring-offset-1"),style:{borderRadius:a,backgroundColor:c===E.date?r.primaryColor:"white",color:c===E.date?r.primaryTextColor:r.textColor,border:c===E.date?"none":`1px solid ${r.borderColor}`,boxShadow:c===E.date?"0 2px 4px rgba(0,0,0,0.1)":"none","--tw-ring-color":r.primaryColor},children:E.dateLabel},E.date))})]}),W.jsx(sx,{mode:"wait",children:b&&W.jsxs(mu.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"ringg_ai-mb-3",children:[W.jsxs("p",{className:"ringg_ai-text-xs ringg_ai-font-semibold ringg_ai-uppercase ringg_ai-tracking-wide ringg_ai-mb-2 ringg_ai-flex ringg_ai-items-center ringg_ai-gap-1",style:{color:r.mutedTextColor},children:[W.jsx(zI,{className:"ringg_ai-w-3 ringg_ai-h-3"}),"Select Time"]}),W.jsx("div",{className:"ringg_ai-grid ringg_ai-grid-cols-3 ringg_ai-gap-1.5",children:b.slots.map(E=>W.jsx("button",{onClick:()=>v(E),className:xr("ringg_ai-px-2 ringg_ai-py-2 ringg_ai-text-xs ringg_ai-font-medium ringg_ai-transition-all ringg_ai-duration-200","hover:ringg_ai-opacity-90 focus:ringg_ai-outline-none focus:ringg_ai-ring-2 focus:ringg_ai-ring-offset-1"),style:{borderRadius:a,backgroundColor:(p==null?void 0:p.id)===E.id?r.primaryColor:"white",color:(p==null?void 0:p.id)===E.id?r.primaryTextColor:r.textColor,border:`1px solid ${(p==null?void 0:p.id)===E.id?r.primaryColor:r.borderColor}`,boxShadow:(p==null?void 0:p.id)===E.id?"0 2px 4px rgba(0,0,0,0.1)":"none","--tw-ring-color":r.primaryColor},children:t4(E.datetime,s.timezone)},E.id))})]},c)}),W.jsx("button",{onClick:k,disabled:!p||e,className:xr("ringg_ai-w-full ringg_ai-h-9 ringg_ai-text-sm ringg_ai-font-semibold ringg_ai-transition-all ringg_ai-duration-200","hover:ringg_ai-opacity-90 focus:ringg_ai-outline-none focus:ringg_ai-ring-2 focus:ringg_ai-ring-offset-2","disabled:ringg_ai-opacity-50 disabled:ringg_ai-cursor-not-allowed disabled:hover:ringg_ai-opacity-50"),style:{borderRadius:a,backgroundColor:!p||e?r.borderColor:r.primaryColor,color:!p||e?r.mutedTextColor:r.primaryTextColor,"--tw-ring-color":r.primaryColor},children:e?W.jsxs("span",{className:"ringg_ai-flex ringg_ai-items-center ringg_ai-justify-center ringg_ai-gap-2",children:[W.jsx(Gb,{className:"ringg_ai-w-4 ringg_ai-h-4 ringg_ai-animate-spin"}),"Processing..."]}):"Next"})]})},XY={text:pw,email:HI,tel:aW,number:pw,select:VI,textarea:BI},JY=({payload:t,isProcessing:e,onComplete:n})=>{const r=dS(),a=Fw(r.buttonStyle),{data:s}=t,[l,c]=G.useState({}),[h,p]=G.useState({}),v=(U,V)=>{if(U.required&&!V.trim())return`${U.label} is required`;if(V&&U.validation){if(U.validation.minLength&&V.length<U.validation.minLength)return U.validation.message||`${U.label} must be at least ${U.validation.minLength} characters`;if(U.validation.maxLength&&V.length>U.validation.maxLength)return U.validation.message||`${U.label} must be at most ${U.validation.maxLength} characters`;if(U.validation.pattern&&!new RegExp(U.validation.pattern).test(V))return U.validation.message||`${U.label} is invalid`}return U.type==="email"&&V&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(V)?"Please enter a valid email address":U.type==="tel"&&V&&!/^[\d\s\-+()]{7,}$/.test(V)?"Please enter a valid phone number":null},b=()=>{const U={};let V=!0;return s.fields.forEach(j=>{const I=v(j,l[j.name]||"");I&&(U[j.name]=I,V=!1)}),p(U),V},k=(U,V)=>{c(j=>({...j,[U]:V})),h[U]&&p(j=>{const I={...j};return delete I[U],I})},T=()=>{b()&&n(l)},E=U=>typeof U=="string"?U:U.label,R=U=>typeof U=="string"?U:U.value,M=U=>({backgroundColor:"white",color:r.textColor,borderColor:U?r.errorColor:r.borderColor,borderRadius:a}),A="focus:ringg_ai-outline-none focus:ringg_ai-ring-2";return W.jsxs("div",{children:[W.jsxs("div",{className:"ringg_ai-flex ringg_ai-items-center ringg_ai-gap-2 ringg_ai-mb-2",children:[W.jsx(BI,{className:"ringg_ai-w-4 ringg_ai-h-4",style:{color:r.primaryColor}}),W.jsx("p",{className:"ringg_ai-text-sm ringg_ai-font-medium",style:{color:r.textColor},children:s.title})]}),s.description&&W.jsx("p",{className:"ringg_ai-text-xs ringg_ai-mb-3",style:{color:r.mutedTextColor},children:s.description}),W.jsx("div",{className:"ringg_ai-space-y-2.5 ringg_ai-mb-3",children:s.fields.map(U=>{const V=XY[U.type]||pw,j=!!h[U.name];return W.jsxs("div",{children:[W.jsxs("label",{className:"ringg_ai-text-xs ringg_ai-font-medium ringg_ai-mb-1 ringg_ai-flex ringg_ai-items-center ringg_ai-gap-1",style:{color:r.mutedTextColor},children:[W.jsx(V,{className:"ringg_ai-w-3 ringg_ai-h-3"}),U.label,U.required&&W.jsx("span",{style:{color:r.errorColor},children:"*"})]}),U.type==="select"&&U.options&&W.jsxs("div",{className:"ringg_ai-relative",children:[W.jsxs("select",{value:l[U.name]||"",onChange:I=>k(U.name,I.target.value),className:xr("ringg_ai-w-full ringg_ai-px-3 ringg_ai-py-2 ringg_ai-text-xs ringg_ai-border ringg_ai-transition-colors ringg_ai-appearance-none",A),style:{...M(j),"--tw-ring-color":r.primaryColor},children:[W.jsx("option",{value:"",children:U.placeholder||`Select ${U.label.toLowerCase()}`}),U.options.map((I,N)=>W.jsx("option",{value:R(I),children:E(I)},N))]}),W.jsx(VI,{className:"ringg_ai-absolute ringg_ai-right-3 ringg_ai-top-1/2 -ringg_ai-translate-y-1/2 ringg_ai-w-3.5 ringg_ai-h-3.5 ringg_ai-pointer-events-none",style:{color:r.mutedTextColor}})]}),U.type==="textarea"&&W.jsx("textarea",{placeholder:U.placeholder||`Enter ${U.label.toLowerCase()}`,value:l[U.name]||"",onChange:I=>k(U.name,I.target.value),rows:2,className:xr("ringg_ai-w-full ringg_ai-px-3 ringg_ai-py-2 ringg_ai-text-xs ringg_ai-border ringg_ai-transition-colors ringg_ai-resize-none",A),style:{...M(j),"--tw-ring-color":r.primaryColor}}),U.type!=="select"&&U.type!=="textarea"&&W.jsx("input",{type:U.type,placeholder:U.placeholder||`Enter ${U.label.toLowerCase()}`,value:l[U.name]||"",onChange:I=>k(U.name,I.target.value),className:xr("ringg_ai-w-full ringg_ai-px-3 ringg_ai-py-2 ringg_ai-text-xs ringg_ai-border ringg_ai-transition-colors",A),style:{...M(j),"--tw-ring-color":r.primaryColor}}),j&&W.jsx("p",{className:"ringg_ai-text-xs ringg_ai-mt-0.5",style:{color:r.errorColor},children:h[U.name]})]},U.name)})}),W.jsx("button",{onClick:T,disabled:e,className:xr("ringg_ai-w-full ringg_ai-h-9 ringg_ai-text-sm ringg_ai-font-semibold ringg_ai-transition-all ringg_ai-duration-200","hover:ringg_ai-opacity-90 focus:ringg_ai-outline-none focus:ringg_ai-ring-2 focus:ringg_ai-ring-offset-2","disabled:ringg_ai-opacity-50 disabled:ringg_ai-cursor-not-allowed disabled:hover:ringg_ai-opacity-50"),style:{borderRadius:a,backgroundColor:e?r.borderColor:r.primaryColor,color:e?r.mutedTextColor:r.primaryTextColor,"--tw-ring-color":r.primaryColor},children:e?W.jsxs("span",{className:"ringg_ai-flex ringg_ai-items-center ringg_ai-justify-center ringg_ai-gap-2",children:[W.jsx(Gb,{className:"ringg_ai-w-4 ringg_ai-h-4 ringg_ai-animate-spin"}),"Submitting..."]}):s.submit_label||"Next"})]})},eK=({payload:t,isProcessing:e,onButtonClick:n})=>{const r=dS(),a=Fw(r.buttonStyle),{data:s}=t,[l,c]=G.useState(null),h=async v=>{if(v.action.type==="navigate"){n(v.id,v.action);return}c(v.id);try{await n(v.id,v.action)}finally{c(null)}},p=v=>{const b={borderRadius:a};switch(v){case"primary":return{...b,backgroundColor:r.primaryColor,color:r.primaryTextColor};case"secondary":return{...b,backgroundColor:r.surfaceColor,color:r.textColor,border:`1px solid ${r.borderColor}`};case"outline":return{...b,backgroundColor:"transparent",color:r.primaryColor,border:`2px solid ${r.primaryColor}`};case"destructive":return{...b,backgroundColor:r.errorColor,color:r.primaryTextColor};default:return{...b,backgroundColor:r.primaryColor,color:r.primaryTextColor}}};return W.jsxs("div",{children:[s.title&&W.jsx("p",{className:"ringg_ai-text-sm ringg_ai-font-medium ringg_ai-mb-3",style:{color:r.textColor},children:s.title}),W.jsx("div",{className:"ringg_ai-flex ringg_ai-flex-col ringg_ai-gap-2",children:s.buttons.map(v=>{const b=l===v.id||e&&l===v.id,k=v.action.type==="navigate",T=b||e;return W.jsx("button",{onClick:()=>h(v),disabled:T,className:xr("ringg_ai-w-full ringg_ai-h-9 ringg_ai-text-sm ringg_ai-font-semibold ringg_ai-transition-all ringg_ai-duration-200 ringg_ai-flex ringg_ai-items-center ringg_ai-justify-center ringg_ai-gap-2","hover:ringg_ai-opacity-90 focus:ringg_ai-outline-none focus:ringg_ai-ring-2 focus:ringg_ai-ring-offset-2",T&&"ringg_ai-opacity-50 ringg_ai-cursor-not-allowed hover:ringg_ai-opacity-50"),style:{...p(v.style),"--tw-ring-color":r.primaryColor},children:b?W.jsxs(W.Fragment,{children:[W.jsx(Gb,{className:"ringg_ai-w-4 ringg_ai-h-4 ringg_ai-animate-spin"}),"Loading..."]}):W.jsxs(W.Fragment,{children:[v.label,k&&W.jsx(tW,{className:"ringg_ai-w-3.5 ringg_ai-h-3.5"})]})},v.id)})})]})},a4=({data:t,collectedData:e})=>{const n=dS(),r=t.icon||"success",a=()=>{switch(r){case"success":return{icon:hw,bgColor:n.successColor};case"info":return{icon:nW,bgColor:n.primaryColor};case"warning":return{icon:oW,bgColor:"#f59e0b"};case"error":return{icon:eW,bgColor:n.errorColor};default:return{icon:hw,bgColor:n.successColor}}},{icon:s,bgColor:l}=a(),c=t.details||[],h=["slot_date","slot_time","name","email","phone"],p=e?Object.entries(e).filter(([k])=>h.includes(k)).sort((k,T)=>h.indexOf(k[0])-h.indexOf(T[0])).map(([k,T])=>({key:k,label:k.replace(/slot_/g,"").replace(/_/g," ").replace(/\b\w/g,E=>E.toUpperCase()),value:T})):[],v=c.length>0?c:p,b=k=>k?k.includes("date")?jI:k.includes("time")?zI:k.includes("email")?HI:k.includes("name")?sW:null:null;return W.jsxs(mu.div,{initial:{opacity:0},animate:{opacity:1},className:"ringg_ai-py-2",children:[W.jsxs("div",{className:"ringg_ai-flex ringg_ai-items-start ringg_ai-gap-3 ringg_ai-mb-4",children:[W.jsx(mu.div,{initial:{scale:0},animate:{scale:1},transition:{type:"spring",stiffness:400,damping:15},className:"ringg_ai-w-9 ringg_ai-h-9 ringg_ai-rounded-full ringg_ai-flex ringg_ai-items-center ringg_ai-justify-center ringg_ai-flex-shrink-0",style:{backgroundColor:l},children:W.jsx(s,{className:"ringg_ai-w-4.5 ringg_ai-h-4.5 ringg_ai-text-white"})}),W.jsxs(mu.div,{initial:{opacity:0,x:-8},animate:{opacity:1,x:0},transition:{delay:.1},className:"ringg_ai-flex-1 ringg_ai-min-w-0 ringg_ai-pt-0.5",children:[W.jsx("h3",{className:"ringg_ai-text-sm ringg_ai-font-semibold ringg_ai-leading-tight",style:{color:n.textColor},children:t.title}),t.message&&W.jsx("p",{className:"ringg_ai-text-xs ringg_ai-mt-1 ringg_ai-leading-relaxed",style:{color:n.mutedTextColor},children:t.message})]})]}),v.length>0&&W.jsx(mu.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:.15},className:"ringg_ai-rounded-lg ringg_ai-divide-y",style:{backgroundColor:n.surfaceColor,borderColor:n.borderColor},children:v.slice(0,4).map((k,T)=>{const E=k.key?b(k.key):null;return W.jsxs("div",{className:"ringg_ai-flex ringg_ai-items-center ringg_ai-gap-2.5 ringg_ai-px-3 ringg_ai-py-2.5",style:{borderColor:n.borderColor},children:[E&&W.jsx(E,{className:"ringg_ai-w-3.5 ringg_ai-h-3.5 ringg_ai-flex-shrink-0",style:{color:n.mutedTextColor}}),W.jsx("span",{className:"ringg_ai-text-xs ringg_ai-flex-shrink-0",style:{color:n.mutedTextColor},children:k.label}),W.jsx("span",{className:"ringg_ai-text-xs ringg_ai-font-medium ringg_ai-ml-auto ringg_ai-truncate",style:{color:n.textColor},title:k.value,children:k.value})]},T)})})]})};function tK(t){return t.component_type==="interactive_flow"}const nK=({initialComponent:t,onApiCall:e,onComplete:n,onSendResponse:r})=>{const a=tK(t),s=Zo(),l=G.useMemo(()=>{const X=t.theme||{};return Uw({primaryColor:s.primaryColor,primaryTextColor:s.primaryTextColor,backgroundColor:s.surfaceColor,surfaceColor:s.backgroundColor,textColor:s.textColor,mutedTextColor:s.mutedTextColor,borderColor:s.borderColor,...X})},[t.theme,s]),c=a?t.data.steps:[{id:"single",title:"",component:t}],h=c.length,[p,v]=G.useState(0),[b,k]=G.useState(!1),[T,E]=G.useState({}),[R,M]=G.useState(null),[A,U]=G.useState(new Array(h).fill(!1)),V=c[p],j=h>1,I=G.useCallback(()=>{p>0&&v(X=>X-1)},[p]),N=G.useCallback(async X=>{k(!0);const se={...T,...X};E(se),U($=>{const oe=[...$];return oe[p]=!0,oe});try{const $=p===h-1;if(r)await r(t.component_id,{step_index:p,step_data:X,all_data:se,is_final_step:$}),$?(M({title:"Success!",message:"Your selection has been submitted.",icon:"success"}),n==null||n(se)):v(oe=>oe+1);else if($)if(a){const{on_complete:oe}=t.data,J=Iw(oe.payload,{...se,all_data:JSON.stringify(se)}),xe=await e(oe.method,oe.endpoint,J);if(xe.success)M(xe.confirmation||{title:"Success!",message:xe.message,icon:"success"}),n==null||n(se);else throw new Error(xe.message||"Failed to complete")}else{const oe=V.component;let J=null;if(n4(oe)){const xe=Iw(oe.actions.on_select.payload,{...se,selected_slot_id:X.slot_id||""});J=await e(oe.actions.on_select.method,oe.actions.on_select.endpoint,xe)}else if(r4(oe)){const xe=Iw(oe.actions.on_submit.payload,{...se,user_input:JSON.stringify(X),form_data:JSON.stringify(X)});J=await e(oe.actions.on_submit.method,oe.actions.on_submit.endpoint,xe)}if(J!=null&&J.success)M(J.confirmation||{title:"Success!",message:J.message,icon:"success"}),n==null||n(se);else if(J)throw new Error(J.message||"Failed")}else v(oe=>oe+1)}catch($){console.error("Error processing step:",$),M({title:"Something went wrong",message:$.message||"Please try again.",icon:"error"})}finally{k(!1)}},[T,p,h,a,t,V,e,n,r]),ne=G.useCallback(async(X,se)=>{if(se.type==="navigate"&&se.url){window.open(se.url,"_blank","noopener,noreferrer");return}if(r){N({selected_button:X});return}if(se.type==="api_call"&&se.endpoint){k(!0);try{(await e(se.method||"POST",se.endpoint,se.payload||{})).success&&N({selected_button:X})}catch($){console.error("Error in button action:",$)}finally{k(!1)}}else N({selected_button:X})},[e,N,r]);return W.jsx(i4.Provider,{value:l,children:W.jsxs(mu.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"ringg_ai-w-full ringg_ai-rounded-xl ringg_ai-overflow-hidden",style:{backgroundColor:l.backgroundColor,color:l.textColor,fontFamily:l.fontFamily,fontSize:l.fontSize,borderRadius:l.borderRadius},children:[j&&!R&&W.jsxs("div",{className:"ringg_ai-px-4 ringg_ai-pt-4 ringg_ai-pb-3",children:[W.jsx("div",{className:"ringg_ai-flex ringg_ai-items-center ringg_ai-gap-2",children:c.map((X,se)=>W.jsxs("div",{className:"ringg_ai-flex ringg_ai-items-center ringg_ai-gap-2 ringg_ai-flex-1 ringg_ai-min-w-0",children:[W.jsx("div",{className:"ringg_ai-w-7 ringg_ai-h-7 ringg_ai-rounded-full ringg_ai-text-xs ringg_ai-font-semibold ringg_ai-flex ringg_ai-items-center ringg_ai-justify-center ringg_ai-flex-shrink-0 ringg_ai-transition-all",style:{backgroundColor:A[se]?l.successColor:se===p?l.primaryColor:l.borderColor,color:A[se]||se===p?l.primaryTextColor:l.mutedTextColor},children:A[se]?W.jsx(hw,{className:"ringg_ai-w-3.5 ringg_ai-h-3.5"}):se+1}),se<c.length-1&&W.jsx("div",{className:"ringg_ai-flex-1 ringg_ai-h-[2px] ringg_ai-rounded-full ringg_ai-transition-all",style:{backgroundColor:A[se]?l.successColor:l.borderColor}})]},X.id))}),W.jsx("p",{className:"ringg_ai-text-xs ringg_ai-font-medium ringg_ai-mt-3 ringg_ai-truncate",style:{color:l.textColor},children:V.title||`Step ${p+1} of ${h}`})]}),W.jsxs("div",{className:xr("ringg_ai-px-4 ringg_ai-pb-4",!j&&"ringg_ai-pt-4"),children:[p>0&&!R&&W.jsxs("button",{onClick:I,className:"ringg_ai-flex ringg_ai-items-center ringg_ai-gap-1 ringg_ai-text-xs ringg_ai-mb-3 ringg_ai-transition-colors hover:ringg_ai-opacity-80",style:{color:l.mutedTextColor},children:[W.jsx(Jq,{className:"ringg_ai-w-3.5 ringg_ai-h-3.5"}),"Back"]}),W.jsx(sx,{mode:"wait",children:R?W.jsx(a4,{data:R,collectedData:T},"confirmation"):W.jsxs(mu.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},transition:{duration:.2},children:[n4(V.component)&&W.jsx(QY,{payload:V.component,isProcessing:b,onComplete:(X,se)=>N({slot_id:X,slot_datetime:se,slot_time:t4(se),slot_date:GY(se)})}),r4(V.component)&&W.jsx(JY,{payload:V.component,isProcessing:b,onComplete:X=>N(X)}),YY(V.component)&&W.jsx(eK,{payload:V.component,isProcessing:b,onButtonClick:ne}),KY(V.component)&&W.jsx(a4,{data:V.component.data})]},p)})]})]})})};function Vse(){}function zse(){}function rK(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const iK=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,aK=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,oK={};function o4(t,e){return(oK.jsx?aK:iK).test(t)}const sK=/[ \t\n\f\r]/g;function lK(t){return typeof t=="object"?t.type==="text"?s4(t.value):!1:s4(t)}function s4(t){return t.replace(sK,"")===""}class kv{constructor(e,n,r){this.property=e,this.normal=n,r&&(this.space=r)}}kv.prototype.property={},kv.prototype.normal={},kv.prototype.space=null;function l4(t,e){const n={},r={};let a=-1;for(;++a<t.length;)Object.assign(n,t[a].property),Object.assign(r,t[a].normal);return new kv(n,r,e)}function jw(t){return t.toLowerCase()}class Xo{constructor(e,n){this.property=e,this.attribute=n}}Xo.prototype.space=null,Xo.prototype.boolean=!1,Xo.prototype.booleanish=!1,Xo.prototype.overloadedBoolean=!1,Xo.prototype.number=!1,Xo.prototype.commaSeparated=!1,Xo.prototype.spaceSeparated=!1,Xo.prototype.commaOrSpaceSeparated=!1,Xo.prototype.mustUseProperty=!1,Xo.prototype.defined=!1;let uK=0;const hn=ff(),vi=ff(),u4=ff(),Ye=ff(),wr=ff(),yp=ff(),Oo=ff();function ff(){return 2**++uK}const Vw=Object.freeze(Object.defineProperty({__proto__:null,boolean:hn,booleanish:vi,commaOrSpaceSeparated:Oo,commaSeparated:yp,number:Ye,overloadedBoolean:u4,spaceSeparated:wr},Symbol.toStringTag,{value:"Module"})),zw=Object.keys(Vw);class Bw extends Xo{constructor(e,n,r,a){let s=-1;if(super(e,n),c4(this,"space",a),typeof r=="number")for(;++s<zw.length;){const l=zw[s];c4(this,zw[s],(r&Vw[l])===Vw[l])}}}Bw.prototype.defined=!0;function c4(t,e,n){n&&(t[e]=n)}const cK={}.hasOwnProperty;function bp(t){const e={},n={};let r;for(r in t.properties)if(cK.call(t.properties,r)){const a=t.properties[r],s=new Bw(r,t.transform(t.attributes||{},r),a,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),e[r]=s,n[jw(r)]=r,n[jw(s.attribute)]=r}return new kv(e,n,t.space)}const d4=bp({space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()},properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}}),f4=bp({space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()},properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function h4(t,e){return e in t?t[e]:e}function p4(t,e){return h4(t,e.toLowerCase())}const m4=bp({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:p4,properties:{xmlns:null,xmlnsXLink:null}}),g4=bp({transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()},properties:{ariaActiveDescendant:null,ariaAtomic:vi,ariaAutoComplete:null,ariaBusy:vi,ariaChecked:vi,ariaColCount:Ye,ariaColIndex:Ye,ariaColSpan:Ye,ariaControls:wr,ariaCurrent:null,ariaDescribedBy:wr,ariaDetails:null,ariaDisabled:vi,ariaDropEffect:wr,ariaErrorMessage:null,ariaExpanded:vi,ariaFlowTo:wr,ariaGrabbed:vi,ariaHasPopup:null,ariaHidden:vi,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:wr,ariaLevel:Ye,ariaLive:null,ariaModal:vi,ariaMultiLine:vi,ariaMultiSelectable:vi,ariaOrientation:null,ariaOwns:wr,ariaPlaceholder:null,ariaPosInSet:Ye,ariaPressed:vi,ariaReadOnly:vi,ariaRelevant:null,ariaRequired:vi,ariaRoleDescription:wr,ariaRowCount:Ye,ariaRowIndex:Ye,ariaRowSpan:Ye,ariaSelected:vi,ariaSetSize:Ye,ariaSort:null,ariaValueMax:Ye,ariaValueMin:Ye,ariaValueNow:Ye,ariaValueText:null,role:null}}),dK=bp({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:p4,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:yp,acceptCharset:wr,accessKey:wr,action:null,allow:null,allowFullScreen:hn,allowPaymentRequest:hn,allowUserMedia:hn,alt:null,as:null,async:hn,autoCapitalize:null,autoComplete:wr,autoFocus:hn,autoPlay:hn,blocking:wr,capture:null,charSet:null,checked:hn,cite:null,className:wr,cols:Ye,colSpan:null,content:null,contentEditable:vi,controls:hn,controlsList:wr,coords:Ye|yp,crossOrigin:null,data:null,dateTime:null,decoding:null,default:hn,defer:hn,dir:null,dirName:null,disabled:hn,download:u4,draggable:vi,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:hn,formTarget:null,headers:wr,height:Ye,hidden:hn,high:Ye,href:null,hrefLang:null,htmlFor:wr,httpEquiv:wr,id:null,imageSizes:null,imageSrcSet:null,inert:hn,inputMode:null,integrity:null,is:null,isMap:hn,itemId:null,itemProp:wr,itemRef:wr,itemScope:hn,itemType:wr,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:hn,low:Ye,manifest:null,max:null,maxLength:Ye,media:null,method:null,min:null,minLength:Ye,multiple:hn,muted:hn,name:null,nonce:null,noModule:hn,noValidate:hn,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:hn,optimum:Ye,pattern:null,ping:wr,placeholder:null,playsInline:hn,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:hn,referrerPolicy:null,rel:wr,required:hn,reversed:hn,rows:Ye,rowSpan:Ye,sandbox:wr,scope:null,scoped:hn,seamless:hn,selected:hn,shadowRootClonable:hn,shadowRootDelegatesFocus:hn,shadowRootMode:null,shape:null,size:Ye,sizes:null,slot:null,span:Ye,spellCheck:vi,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ye,step:null,style:null,tabIndex:Ye,target:null,title:null,translate:null,type:null,typeMustMatch:hn,useMap:null,value:vi,width:Ye,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:wr,axis:null,background:null,bgColor:null,border:Ye,borderColor:null,bottomMargin:Ye,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:hn,declare:hn,event:null,face:null,frame:null,frameBorder:null,hSpace:Ye,leftMargin:Ye,link:null,longDesc:null,lowSrc:null,marginHeight:Ye,marginWidth:Ye,noResize:hn,noHref:hn,noShade:hn,noWrap:hn,object:null,profile:null,prompt:null,rev:null,rightMargin:Ye,rules:null,scheme:null,scrolling:vi,standby:null,summary:null,text:null,topMargin:Ye,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ye,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:hn,disableRemotePlayback:hn,prefix:null,property:null,results:Ye,security:null,unselectable:null}}),fK=bp({space:"svg",attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},transform:h4,properties:{about:Oo,accentHeight:Ye,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ye,amplitude:Ye,arabicForm:null,ascent:Ye,attributeName:null,attributeType:null,azimuth:Ye,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ye,by:null,calcMode:null,capHeight:Ye,className:wr,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Ye,diffuseConstant:Ye,direction:null,display:null,dur:null,divisor:Ye,dominantBaseline:null,download:hn,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ye,enableBackground:null,end:null,event:null,exponent:Ye,externalResourcesRequired:null,fill:null,fillOpacity:Ye,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:yp,g2:yp,glyphName:yp,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ye,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ye,horizOriginX:Ye,horizOriginY:Ye,id:null,ideographic:Ye,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ye,k:Ye,k1:Ye,k2:Ye,k3:Ye,k4:Ye,kernelMatrix:Oo,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ye,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Ye,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Ye,overlineThickness:Ye,paintOrder:null,panose1:null,path:null,pathLength:Ye,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:wr,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ye,pointsAtY:Ye,pointsAtZ:Ye,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Oo,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Oo,rev:Oo,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Oo,requiredFeatures:Oo,requiredFonts:Oo,requiredFormats:Oo,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Ye,specularExponent:Ye,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ye,strikethroughThickness:Ye,string:null,stroke:null,strokeDashArray:Oo,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ye,strokeOpacity:Ye,strokeWidth:null,style:null,surfaceScale:Ye,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Oo,tabIndex:Ye,tableValues:null,target:null,targetX:Ye,targetY:Ye,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Oo,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ye,underlineThickness:Ye,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ye,values:null,vAlphabetic:Ye,vMathematical:Ye,vectorEffect:null,vHanging:Ye,vIdeographic:Ye,version:null,vertAdvY:Ye,vertOriginX:Ye,vertOriginY:Ye,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ye,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null}}),hK=/^data[-\w.:]+$/i,v4=/-[a-z]/g,pK=/[A-Z]/g;function mK(t,e){const n=jw(e);let r=e,a=Xo;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&hK.test(e)){if(e.charAt(4)==="-"){const s=e.slice(5).replace(v4,vK);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=e.slice(4);if(!v4.test(s)){let l=s.replace(pK,gK);l.charAt(0)!=="-"&&(l="-"+l),e="data"+l}}a=Bw}return new a(r,e)}function gK(t){return"-"+t.toLowerCase()}function vK(t){return t.charAt(1).toUpperCase()}const yK={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},bK=l4([f4,d4,m4,g4,dK],"html"),Hw=l4([f4,d4,m4,g4,fK],"svg");function SK(t){return t.join(" ").trim()}var y4={},b4=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,CK=/\n/g,kK=/^\s*/,TK=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,xK=/^:\s*/,wK=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,_K=/^[;\s]*/,EK=/^\s+|\s+$/g,RK=`
|
|
398
|
+
*/const lW=Bi("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),uW=({fill:t,width:e,height:n,size:r=18,className:a,style:s})=>W.jsx("svg",{viewBox:"0 0 19 19",xmlns:"http://www.w3.org/2000/svg",className:a,width:e||r,height:n||r,fill:t||"currentColor",style:s,children:W.jsx("path",{d:"M11.5253 1.30593C11.5508 1.21075 11.5947 1.12151 11.6547 1.04333C11.7147 0.965143 11.7894 0.899537 11.8748 0.85026C11.9601 0.800983 12.0543 0.769 12.152 0.756139C12.2496 0.743278 12.3489 0.749791 12.4441 0.775306C13.8344 1.13807 15.103 1.86491 16.119 2.88096C17.1351 3.89702 17.8619 5.16556 18.2247 6.55593C18.2502 6.6511 18.2567 6.75036 18.2439 6.84805C18.231 6.94573 18.199 7.03993 18.1497 7.12525C18.1005 7.21057 18.0349 7.28534 17.9567 7.3453C17.8785 7.40526 17.7893 7.44922 17.6941 7.47468C17.6307 7.49132 17.5655 7.49983 17.5 7.49999C17.3347 7.49999 17.1741 7.44539 17.043 7.34469C16.912 7.24399 16.8179 7.10282 16.7753 6.94312C16.4795 5.80811 15.8863 4.77253 15.0569 3.94314C14.2275 3.11375 13.1919 2.52054 12.0569 2.22468C11.9616 2.19932 11.8723 2.15543 11.794 2.09552C11.7157 2.0356 11.65 1.96084 11.6006 1.87551C11.5513 1.79018 11.5192 1.69595 11.5063 1.59822C11.4933 1.50048 11.4998 1.40116 11.5253 1.30593ZM11.3069 5.22468C12.5997 5.56968 13.4303 6.40031 13.7753 7.69312C13.8179 7.85282 13.912 7.99399 14.043 8.09469C14.1741 8.19539 14.3347 8.24999 14.5 8.24999C14.5655 8.24983 14.6307 8.24132 14.6941 8.22468C14.7893 8.19922 14.8785 8.15526 14.9567 8.0953C15.0349 8.03534 15.1005 7.96057 15.1497 7.87525C15.199 7.78993 15.231 7.69573 15.2439 7.59805C15.2567 7.50036 15.2502 7.4011 15.2247 7.30593C14.7447 5.50968 13.4903 4.25531 11.6941 3.77531C11.5019 3.72396 11.2971 3.75107 11.1249 3.85067C10.9527 3.95027 10.8271 4.1142 10.7758 4.3064C10.7244 4.4986 10.7516 4.70332 10.8512 4.87553C10.9508 5.04774 11.1147 5.17334 11.3069 5.22468ZM18.9888 14.1637C18.8216 15.4341 18.1977 16.6001 17.2337 17.4441C16.2696 18.2881 15.0313 18.7523 13.75 18.75C6.30626 18.75 0.250008 12.6937 0.250008 5.24999C0.247712 3.9687 0.711903 2.73039 1.55588 1.76633C2.39986 0.802276 3.56592 0.178406 4.83626 0.0112434C5.1575 -0.0279808 5.4828 0.0377391 5.76362 0.198592C6.04444 0.359445 6.2657 0.606804 6.39438 0.903743L8.37438 5.32406V5.33531C8.4729 5.56261 8.51359 5.81077 8.49282 6.05763C8.47204 6.30449 8.39044 6.54236 8.25532 6.74999C8.23845 6.77531 8.22063 6.79874 8.20188 6.82218L6.25001 9.13593C6.9522 10.5628 8.4447 12.0422 9.89032 12.7462L12.1722 10.8047C12.1946 10.7858 12.2181 10.7683 12.2425 10.7522C12.45 10.6138 12.6887 10.5293 12.937 10.5064C13.1853 10.4835 13.4354 10.5229 13.6647 10.6209L13.6769 10.6266L18.0934 12.6056C18.3909 12.7338 18.6389 12.9549 18.8003 13.2358C18.9616 13.5166 19.0278 13.8422 18.9888 14.1637ZM17.5 13.9762C17.5 13.9762 17.4934 13.9762 17.4897 13.9762L13.0834 12.0028L10.8006 13.9444C10.7785 13.9631 10.7553 13.9807 10.7313 13.9969C10.5154 14.1409 10.2659 14.2264 10.0071 14.2452C9.74828 14.2639 9.48904 14.2152 9.2547 14.1037C7.49876 13.2553 5.74845 11.5181 4.89907 9.78093C4.7866 9.5483 4.73613 9.29055 4.75255 9.03267C4.76898 8.7748 4.85174 8.52554 4.99282 8.30906C5.00872 8.28364 5.02659 8.2595 5.04626 8.23687L7.00001 5.92031L5.03126 1.51406C5.03089 1.51032 5.03089 1.50655 5.03126 1.50281C4.12212 1.6214 3.28739 2.06733 2.68339 2.7571C2.0794 3.44687 1.74755 4.33316 1.75001 5.24999C1.75348 8.43153 3.01888 11.4818 5.26856 13.7314C7.51825 15.9811 10.5685 17.2465 13.75 17.25C14.6663 17.2531 15.5523 16.9225 16.2425 16.3198C16.9327 15.7171 17.3797 14.8837 17.5 13.9753V13.9762Z"})}),cW=({fill:t,width:e,height:n,size:r=18,className:a,style:s})=>W.jsx("svg",{viewBox:"0 0 17 17",xmlns:"http://www.w3.org/2000/svg",className:a,width:e||r,height:n||r,fill:t||"currentColor",style:s,children:W.jsx("path",{d:"M15.3727 11.3798L11.6922 9.73056L11.682 9.72587C11.491 9.64415 11.2825 9.61135 11.0756 9.63045C10.8687 9.64954 10.6698 9.71993 10.4969 9.83524C10.4765 9.84869 10.457 9.86329 10.4383 9.87899L8.53673 11.5001C7.33204 10.9149 6.08829 9.68055 5.50313 8.49149L7.12657 6.56102C7.14219 6.54149 7.15704 6.52196 7.1711 6.50087C7.28394 6.32845 7.35239 6.13081 7.37039 5.92553C7.38838 5.72026 7.35534 5.51372 7.27423 5.3243V5.31493L5.62032 1.62821C5.51309 1.38076 5.3287 1.17463 5.09468 1.04058C4.86067 0.906541 4.58958 0.851774 4.32188 0.884461C3.26326 1.02376 2.29155 1.54366 1.58824 2.34704C0.884919 3.15042 0.498093 4.18234 0.500007 5.25009C0.500007 11.4532 5.54688 16.5001 11.75 16.5001C12.8177 16.502 13.8497 16.1152 14.6531 15.4119C15.4564 14.7085 15.9763 13.7368 16.1156 12.6782C16.1484 12.4106 16.0937 12.1396 15.9598 11.9056C15.8259 11.6716 15.62 11.4871 15.3727 11.3798ZM11.75 15.2501C9.09873 15.2472 6.55687 14.1927 4.68214 12.318C2.8074 10.4432 1.7529 7.90136 1.75001 5.25009C1.74707 4.48719 2.02192 3.7493 2.52324 3.17423C3.02456 2.59916 3.71806 2.22623 4.47423 2.12509C4.47392 2.1282 4.47392 2.13134 4.47423 2.13446L6.11485 5.80634L4.50001 7.73915C4.48362 7.75801 4.46873 7.77812 4.45548 7.7993C4.33791 7.97971 4.26894 8.18743 4.25525 8.40232C4.24157 8.61722 4.28362 8.83201 4.37735 9.02587C5.08516 10.4735 6.54376 11.9212 8.00704 12.6282C8.20232 12.7211 8.41835 12.7617 8.63403 12.7461C8.8497 12.7304 9.05763 12.6592 9.23751 12.5391C9.25757 12.5256 9.27687 12.511 9.29532 12.4954L11.1945 10.8751L14.8664 12.5196C14.8664 12.5196 14.8727 12.5196 14.875 12.5196C14.7751 13.2769 14.4027 13.9718 13.8275 14.4743C13.2524 14.9769 12.5138 15.2527 11.75 15.2501Z"})}),dW=({fill:t,width:e,height:n,size:r=18,className:a,style:s})=>W.jsx("svg",{viewBox:"0 0 20 16",xmlns:"http://www.w3.org/2000/svg",className:a,width:e||r,height:n||r,fill:t||"currentColor",style:s,children:W.jsx("path",{d:"M4.21328 0.704679C4.15839 0.642809 4.09177 0.592448 4.01728 0.556515C3.94278 0.520582 3.8619 0.499791 3.77931 0.495348C3.69672 0.490905 3.61408 0.502898 3.53616 0.530632C3.45824 0.558365 3.3866 0.601288 3.32539 0.656913C3.26419 0.712537 3.21463 0.779756 3.17959 0.854675C3.14455 0.929593 3.12473 1.01072 3.12128 1.09336C3.11783 1.17599 3.13081 1.25849 3.15948 1.33607C3.18814 1.41365 3.23192 1.48477 3.28828 1.5453L5.44375 3.91718C4.12152 4.47256 2.92021 5.28033 1.90703 6.2953C0.344526 7.8578 0.194526 10.1594 1.54062 11.8945C1.70579 12.1059 1.93457 12.2585 2.19315 12.3298C2.45172 12.4011 2.72639 12.3874 2.97656 12.2906L6.80468 10.9336L6.82734 10.925C7.02045 10.8478 7.19125 10.7236 7.32426 10.5637C7.45727 10.4039 7.54829 10.2133 7.58906 10.0094L8.05 7.7039C8.26906 7.62838 8.49236 7.56578 8.71875 7.5164L15.7898 15.2953C15.8447 15.3572 15.9113 15.4075 15.9858 15.4435C16.0603 15.4794 16.1412 15.5002 16.2238 15.5046C16.3064 15.5091 16.389 15.4971 16.467 15.4694C16.5449 15.4416 16.6165 15.3987 16.6777 15.3431C16.7389 15.2874 16.7885 15.2202 16.8235 15.1453C16.8586 15.0704 16.8784 14.9893 16.8818 14.9066C16.8853 14.824 16.8723 14.7415 16.8436 14.6639C16.815 14.5863 16.7712 14.5152 16.7148 14.4547L4.21328 0.704679ZM7.62734 6.52655C7.42378 6.59909 7.24251 6.72315 7.1012 6.88664C6.9599 7.05013 6.86339 7.24745 6.82109 7.45937L6.36015 9.76405L2.54921 11.1156C2.5414 11.1156 2.53593 11.1258 2.52812 11.1289C1.56484 9.88671 1.66874 8.29921 2.79062 7.1789C3.79625 6.17293 5.00827 5.39726 6.34296 4.90546L7.77265 6.4789C7.72421 6.49452 7.67578 6.50937 7.62734 6.52655ZM18.4594 11.8945C18.2942 12.1059 18.0654 12.2585 17.8068 12.3298C17.5483 12.4011 17.2736 12.3874 17.0234 12.2906L16.3008 12.0344C16.2234 12.0069 16.1522 11.9645 16.0913 11.9096C16.0303 11.8546 15.9808 11.7882 15.9455 11.7141C15.8742 11.5644 15.8653 11.3925 15.9207 11.2363C15.9481 11.159 15.9906 11.0878 16.0455 11.0268C16.1005 10.9658 16.1669 10.9163 16.241 10.881C16.3907 10.8097 16.5625 10.8008 16.7187 10.8562L17.4508 11.1156L17.4742 11.125C18.4352 9.88671 18.3336 8.29921 17.2094 7.1789C15.2047 5.17421 12.375 4.11093 9.44765 4.26405C9.36558 4.26831 9.28346 4.25636 9.20601 4.22889C9.12855 4.20141 9.05726 4.15895 8.99621 4.10392C8.93517 4.0489 8.88556 3.98238 8.85021 3.90819C8.81487 3.83399 8.79449 3.75355 8.79023 3.67148C8.78597 3.5894 8.79792 3.50729 8.8254 3.42983C8.85287 3.35237 8.89534 3.28109 8.95036 3.22004C9.00539 3.15899 9.0719 3.10938 9.1461 3.07404C9.2203 3.03869 9.30073 3.01831 9.38281 3.01405C12.6641 2.84296 15.8383 4.03749 18.093 6.2953C19.6547 7.85702 19.8055 10.1594 18.4594 11.8945Z"})}),fW=({fill:t,width:e,height:n,size:r=18,className:a,style:s})=>W.jsx("svg",{viewBox:"0 0 14 19",xmlns:"http://www.w3.org/2000/svg",className:a,width:e||r,height:n||r,fill:t||"currentColor",style:s,children:W.jsx("path",{d:"M7 12.75C7.99424 12.749 8.94747 12.3535 9.65051 11.6505C10.3535 10.9475 10.749 9.99424 10.75 9V4C10.75 3.00544 10.3549 2.05161 9.65165 1.34835C8.94839 0.645088 7.99456 0.25 7 0.25C6.00544 0.25 5.05161 0.645088 4.34835 1.34835C3.64509 2.05161 3.25 3.00544 3.25 4V9C3.25103 9.99424 3.64645 10.9475 4.34949 11.6505C5.05253 12.3535 6.00576 12.749 7 12.75ZM4.5 4C4.5 3.33696 4.76339 2.70107 5.23223 2.23223C5.70107 1.76339 6.33696 1.5 7 1.5C7.66304 1.5 8.29893 1.76339 8.76777 2.23223C9.23661 2.70107 9.5 3.33696 9.5 4V9C9.5 9.66304 9.23661 10.2989 8.76777 10.7678C8.29893 11.2366 7.66304 11.5 7 11.5C6.33696 11.5 5.70107 11.2366 5.23223 10.7678C4.76339 10.2989 4.5 9.66304 4.5 9V4ZM7.625 15.2188V17.75C7.625 17.9158 7.55915 18.0747 7.44194 18.1919C7.32473 18.3092 7.16576 18.375 7 18.375C6.83424 18.375 6.67527 18.3092 6.55806 18.1919C6.44085 18.0747 6.375 17.9158 6.375 17.75V15.2188C4.8341 15.062 3.40607 14.3393 2.36707 13.1907C1.32806 12.042 0.751903 10.5489 0.75 9C0.75 8.83424 0.815848 8.67527 0.933058 8.55806C1.05027 8.44085 1.20924 8.375 1.375 8.375C1.54076 8.375 1.69973 8.44085 1.81694 8.55806C1.93415 8.67527 2 8.83424 2 9C2 10.3261 2.52678 11.5979 3.46447 12.5355C4.40215 13.4732 5.67392 14 7 14C8.32608 14 9.59785 13.4732 10.5355 12.5355C11.4732 11.5979 12 10.3261 12 9C12 8.83424 12.0658 8.67527 12.1831 8.55806C12.3003 8.44085 12.4592 8.375 12.625 8.375C12.7908 8.375 12.9497 8.44085 13.0669 8.55806C13.1842 8.67527 13.25 8.83424 13.25 9C13.2481 10.5489 12.6719 12.042 11.6329 13.1907C10.5939 14.3393 9.1659 15.062 7.625 15.2188Z"})}),$I=({fill:t,width:e,height:n,size:r=18,className:a,style:s})=>W.jsx("svg",{viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",className:a,width:e||r,height:n||r,fill:t||"currentColor",style:s,children:W.jsx("path",{d:"M17.1305 13.5905C17.5623 12.6948 17.7742 11.709 17.7486 10.7149C17.7229 9.72084 17.4604 8.74725 16.983 7.87501C16.5055 7.00276 15.8267 6.25704 15.0032 5.69978C14.1796 5.14253 13.2349 4.78982 12.2477 4.67097C11.9192 3.9072 11.4416 3.21664 10.8429 2.63974C10.2442 2.06284 9.53637 1.6112 8.76093 1.31126C7.98549 1.01131 7.158 0.869103 6.32692 0.892953C5.49584 0.916802 4.67787 1.10623 3.9209 1.45015C3.16394 1.79407 2.48321 2.28556 1.91857 2.89584C1.35393 3.50612 0.916724 4.22293 0.632564 5.00429C0.348404 5.78565 0.222999 6.61585 0.263692 7.44628C0.304386 8.27671 0.510359 9.09067 0.869551 9.8405L0.301582 11.771C0.238079 11.9865 0.233833 12.2151 0.289291 12.4328C0.344749 12.6506 0.457861 12.8493 0.616727 13.0082C0.775593 13.167 0.97434 13.2801 1.19206 13.3356C1.40978 13.3911 1.63842 13.3868 1.85393 13.3233L3.7844 12.7553C4.40426 13.0532 5.06884 13.2472 5.75158 13.3296C6.08328 14.1068 6.56914 14.8086 7.17979 15.3927C7.79043 15.9768 8.51318 16.431 9.30434 16.7279C10.0955 17.0247 10.9386 17.158 11.7828 17.1198C12.6269 17.0815 13.4546 16.8725 14.2156 16.5053L16.1461 17.0733C16.3615 17.1367 16.5901 17.141 16.8077 17.0855C17.0253 17.0301 17.224 16.9171 17.3828 16.7583C17.5417 16.5996 17.6548 16.4009 17.7103 16.1834C17.7659 15.9658 17.7618 15.7372 17.6985 15.5218L17.1305 13.5905ZM3.84377 11.4608C3.78404 11.461 3.72463 11.4694 3.66721 11.4858L1.50002 12.1249L2.1383 9.95613C2.1837 9.79944 2.16603 9.63122 2.08908 9.48738C1.5237 8.43002 1.35711 7.2047 1.61968 6.03477C1.88225 4.86485 2.5565 3.82824 3.51951 3.1139C4.48252 2.39957 5.67017 2.05508 6.86595 2.14324C8.06173 2.2314 9.18601 2.74633 10.0339 3.59417C10.8817 4.44201 11.3966 5.5663 11.4848 6.76208C11.5729 7.95786 11.2285 9.1455 10.5141 10.1085C9.79979 11.0715 8.76318 11.7458 7.59325 12.0083C6.42333 12.2709 5.198 12.1043 4.14065 11.5389C4.04972 11.4886 3.94768 11.4618 3.84377 11.4608ZM15.8586 13.7053L16.5 15.8749L14.3313 15.2366C14.1746 15.1912 14.0064 15.2089 13.8625 15.2858C12.7116 15.9004 11.3662 16.0411 10.113 15.678C8.85983 15.3149 7.79803 14.4767 7.15393 13.3421C8.00969 13.2527 8.83776 12.9875 9.58619 12.5631C10.3346 12.1386 10.9873 11.5641 11.5032 10.8755C12.0191 10.1869 12.3871 9.39916 12.5842 8.56163C12.7813 7.72409 12.8032 6.85486 12.6485 6.00847C13.3941 6.18423 14.0893 6.52896 14.6806 7.01605C15.2718 7.50315 15.7432 8.11959 16.0584 8.81779C16.3736 9.51599 16.5242 10.2773 16.4985 11.0429C16.4728 11.8085 16.2715 12.558 15.9102 13.2335C15.8324 13.3782 15.8147 13.5477 15.861 13.7053H15.8586Z"})}),hW=({fill:t,width:e,height:n,size:r=18,className:a})=>W.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 256 256",className:a,width:e||r,height:n||r,fill:t||"currentColor",children:W.jsx("path",{d:"M227.32,28.68a16,16,0,0,0-15.66-4.08l-.15,0L19.57,82.84a16,16,0,0,0-2.49,29.8L102,154l41.3,84.87A15.86,15.86,0,0,0,157.74,248q.69,0,1.38-.06a15.88,15.88,0,0,0,14-11.51l58.2-191.94c0-.05,0-.1,0-.15A16,16,0,0,0,227.32,28.68ZM157.83,231.85l-.05.14,0-.07-40.06-82.3,48-48a8,8,0,0,0-11.31-11.31l-48,48L24.08,98.25l-.07,0,.14,0L216,40Z"})}),qI={primaryColor:"#313335",primaryTextColor:"#ffffff",backgroundColor:"#fafafa",surfaceColor:"#F3F3F5",textColor:"#212121",mutedTextColor:"#11111180",borderColor:"#e5e5e5",errorColor:"#ef4444",successColor:"#10b981",buttonStyle:"rounded",borderRadius:"20px",fontFamily:"inherit"};function WI(t){return{...qI,...t}}function mw(t){switch(t){case"pill":return"9999px";case"square":return"6px";case"rounded":default:return"12px"}}const GI=G.createContext(qI);function pW({theme:t,children:e}){const n=G.useMemo(()=>WI(t),[t]);return W.jsx(GI.Provider,{value:n,children:e})}function Zo(){return G.useContext(GI)}function YI(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var a=t.length;for(e=0;e<a;e++)t[e]&&(n=YI(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function KI(){for(var t,e,n=0,r="",a=arguments.length;n<a;n++)(t=arguments[n])&&(e=YI(t))&&(r&&(r+=" "),r+=e);return r}const gw="-",mW=t=>{const e=vW(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:l=>{const c=l.split(gw);return c[0]===""&&c.length!==1&&c.shift(),ZI(c,e)||gW(l)},getConflictingClassGroupIds:(l,c)=>{const h=n[l]||[];return c&&r[l]?[...h,...r[l]]:h}}},ZI=(t,e)=>{var l;if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),a=r?ZI(t.slice(1),r):void 0;if(a)return a;if(e.validators.length===0)return;const s=t.join(gw);return(l=e.validators.find(({validator:c})=>c(s)))==null?void 0:l.classGroupId},QI=/^\[(.+)\]$/,gW=t=>{if(QI.test(t)){const e=QI.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},vW=t=>{const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return bW(Object.entries(t.classGroups),n).forEach(([s,l])=>{vw(l,r,s,e)}),r},vw=(t,e,n,r)=>{t.forEach(a=>{if(typeof a=="string"){const s=a===""?e:XI(e,a);s.classGroupId=n;return}if(typeof a=="function"){if(yW(a)){vw(a(r),e,n,r);return}e.validators.push({validator:a,classGroupId:n});return}Object.entries(a).forEach(([s,l])=>{vw(l,XI(e,s),n,r)})})},XI=(t,e)=>{let n=t;return e.split(gw).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},yW=t=>t.isThemeGetter,bW=(t,e)=>e?t.map(([n,r])=>{const a=r.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([l,c])=>[e+l,c])):s);return[n,a]}):t,SW=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;const a=(s,l)=>{n.set(s,l),e++,e>t&&(e=0,r=n,n=new Map)};return{get(s){let l=n.get(s);if(l!==void 0)return l;if((l=r.get(s))!==void 0)return a(s,l),l},set(s,l){n.has(s)?n.set(s,l):a(s,l)}}},JI="!",CW=t=>{const{separator:e,experimentalParseClassName:n}=t,r=e.length===1,a=e[0],s=e.length,l=c=>{const h=[];let p=0,v=0,b;for(let M=0;M<c.length;M++){let A=c[M];if(p===0){if(A===a&&(r||c.slice(M,M+s)===e)){h.push(c.slice(v,M)),v=M+s;continue}if(A==="/"){b=M;continue}}A==="["?p++:A==="]"&&p--}const k=h.length===0?c:c.substring(v),T=k.startsWith(JI),E=T?k.substring(1):k,R=b&&b>v?b-v:void 0;return{modifiers:h,hasImportantModifier:T,baseClassName:E,maybePostfixModifierPosition:R}};return n?c=>n({className:c,parseClassName:l}):l},kW=t=>{if(t.length<=1)return t;const e=[];let n=[];return t.forEach(r=>{r[0]==="["?(e.push(...n.sort(),r),n=[]):n.push(r)}),e.push(...n.sort()),e},TW=t=>({cache:SW(t.cacheSize),parseClassName:CW(t),...mW(t)}),xW=/\s+/,wW=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a}=e,s=[],l=t.trim().split(xW);let c="";for(let h=l.length-1;h>=0;h-=1){const p=l[h],{modifiers:v,hasImportantModifier:b,baseClassName:k,maybePostfixModifierPosition:T}=n(p);let E=!!T,R=r(E?k.substring(0,T):k);if(!R){if(!E){c=p+(c.length>0?" "+c:c);continue}if(R=r(k),!R){c=p+(c.length>0?" "+c:c);continue}E=!1}const M=kW(v).join(":"),A=b?M+JI:M,U=A+R;if(s.includes(U))continue;s.push(U);const V=a(R,E);for(let j=0;j<V.length;++j){const I=V[j];s.push(A+I)}c=p+(c.length>0?" "+c:c)}return c};function _W(){let t=0,e,n,r="";for(;t<arguments.length;)(e=arguments[t++])&&(n=e3(e))&&(r&&(r+=" "),r+=n);return r}const e3=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=e3(t[r]))&&(n&&(n+=" "),n+=e);return n};function EW(t,...e){let n,r,a,s=l;function l(h){const p=e.reduce((v,b)=>b(v),t());return n=TW(p),r=n.cache.get,a=n.cache.set,s=c,c(h)}function c(h){const p=r(h);if(p)return p;const v=wW(h,n);return a(h,v),v}return function(){return s(_W.apply(null,arguments))}}const Lr=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},t3=/^\[(?:([a-z-]+):)?(.+)\]$/i,RW=/^\d+\/\d+$/,PW=new Set(["px","full","screen"]),DW=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,AW=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,OW=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,MW=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,LW=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,gu=t=>up(t)||PW.has(t)||RW.test(t),Mc=t=>cp(t,"length",BW),up=t=>!!t&&!Number.isNaN(Number(t)),yw=t=>cp(t,"number",up),Jg=t=>!!t&&Number.isInteger(Number(t)),NW=t=>t.endsWith("%")&&up(t.slice(0,-1)),mn=t=>t3.test(t),Lc=t=>DW.test(t),IW=new Set(["length","size","percentage"]),UW=t=>cp(t,IW,n3),FW=t=>cp(t,"position",n3),jW=new Set(["image","url"]),VW=t=>cp(t,jW,$W),zW=t=>cp(t,"",HW),ev=()=>!0,cp=(t,e,n)=>{const r=t3.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1},BW=t=>AW.test(t)&&!OW.test(t),n3=()=>!1,HW=t=>MW.test(t),$W=t=>LW.test(t),qW=EW(()=>{const t=Lr("colors"),e=Lr("spacing"),n=Lr("blur"),r=Lr("brightness"),a=Lr("borderColor"),s=Lr("borderRadius"),l=Lr("borderSpacing"),c=Lr("borderWidth"),h=Lr("contrast"),p=Lr("grayscale"),v=Lr("hueRotate"),b=Lr("invert"),k=Lr("gap"),T=Lr("gradientColorStops"),E=Lr("gradientColorStopPositions"),R=Lr("inset"),M=Lr("margin"),A=Lr("opacity"),U=Lr("padding"),V=Lr("saturate"),j=Lr("scale"),I=Lr("sepia"),N=Lr("skew"),ne=Lr("space"),X=Lr("translate"),se=()=>["auto","contain","none"],$=()=>["auto","hidden","clip","visible","scroll"],oe=()=>["auto",mn,e],J=()=>[mn,e],xe=()=>["",gu,Mc],ke=()=>["auto",up,mn],Ge=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],Je=()=>["solid","dashed","dotted","double","none"],je=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ve=()=>["start","end","center","between","around","evenly","stretch"],He=()=>["","0",mn],z=()=>["auto","avoid","all","avoid-page","page","left","right","column"],ee=()=>[up,mn];return{cacheSize:500,separator:":",theme:{colors:[ev],spacing:[gu,Mc],blur:["none","",Lc,mn],brightness:ee(),borderColor:[t],borderRadius:["none","","full",Lc,mn],borderSpacing:J(),borderWidth:xe(),contrast:ee(),grayscale:He(),hueRotate:ee(),invert:He(),gap:J(),gradientColorStops:[t],gradientColorStopPositions:[NW,Mc],inset:oe(),margin:oe(),opacity:ee(),padding:J(),saturate:ee(),scale:ee(),sepia:He(),skew:ee(),space:J(),translate:J()},classGroups:{aspect:[{aspect:["auto","square","video",mn]}],container:["container"],columns:[{columns:[Lc]}],"break-after":[{"break-after":z()}],"break-before":[{"break-before":z()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...Ge(),mn]}],overflow:[{overflow:$()}],"overflow-x":[{"overflow-x":$()}],"overflow-y":[{"overflow-y":$()}],overscroll:[{overscroll:se()}],"overscroll-x":[{"overscroll-x":se()}],"overscroll-y":[{"overscroll-y":se()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[R]}],"inset-x":[{"inset-x":[R]}],"inset-y":[{"inset-y":[R]}],start:[{start:[R]}],end:[{end:[R]}],top:[{top:[R]}],right:[{right:[R]}],bottom:[{bottom:[R]}],left:[{left:[R]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Jg,mn]}],basis:[{basis:oe()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",mn]}],grow:[{grow:He()}],shrink:[{shrink:He()}],order:[{order:["first","last","none",Jg,mn]}],"grid-cols":[{"grid-cols":[ev]}],"col-start-end":[{col:["auto",{span:["full",Jg,mn]},mn]}],"col-start":[{"col-start":ke()}],"col-end":[{"col-end":ke()}],"grid-rows":[{"grid-rows":[ev]}],"row-start-end":[{row:["auto",{span:[Jg,mn]},mn]}],"row-start":[{"row-start":ke()}],"row-end":[{"row-end":ke()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",mn]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",mn]}],gap:[{gap:[k]}],"gap-x":[{"gap-x":[k]}],"gap-y":[{"gap-y":[k]}],"justify-content":[{justify:["normal",...ve()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...ve(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...ve(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[U]}],px:[{px:[U]}],py:[{py:[U]}],ps:[{ps:[U]}],pe:[{pe:[U]}],pt:[{pt:[U]}],pr:[{pr:[U]}],pb:[{pb:[U]}],pl:[{pl:[U]}],m:[{m:[M]}],mx:[{mx:[M]}],my:[{my:[M]}],ms:[{ms:[M]}],me:[{me:[M]}],mt:[{mt:[M]}],mr:[{mr:[M]}],mb:[{mb:[M]}],ml:[{ml:[M]}],"space-x":[{"space-x":[ne]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[ne]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",mn,e]}],"min-w":[{"min-w":[mn,e,"min","max","fit"]}],"max-w":[{"max-w":[mn,e,"none","full","min","max","fit","prose",{screen:[Lc]},Lc]}],h:[{h:[mn,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[mn,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[mn,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[mn,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Lc,Mc]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",yw]}],"font-family":[{font:[ev]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",mn]}],"line-clamp":[{"line-clamp":["none",up,yw]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",gu,mn]}],"list-image":[{"list-image":["none",mn]}],"list-style-type":[{list:["none","disc","decimal",mn]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[A]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[A]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Je(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",gu,Mc]}],"underline-offset":[{"underline-offset":["auto",gu,mn]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:J()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",mn]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",mn]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[A]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...Ge(),FW]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",UW]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},VW]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[E]}],"gradient-via-pos":[{via:[E]}],"gradient-to-pos":[{to:[E]}],"gradient-from":[{from:[T]}],"gradient-via":[{via:[T]}],"gradient-to":[{to:[T]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[c]}],"border-w-x":[{"border-x":[c]}],"border-w-y":[{"border-y":[c]}],"border-w-s":[{"border-s":[c]}],"border-w-e":[{"border-e":[c]}],"border-w-t":[{"border-t":[c]}],"border-w-r":[{"border-r":[c]}],"border-w-b":[{"border-b":[c]}],"border-w-l":[{"border-l":[c]}],"border-opacity":[{"border-opacity":[A]}],"border-style":[{border:[...Je(),"hidden"]}],"divide-x":[{"divide-x":[c]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[c]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[A]}],"divide-style":[{divide:Je()}],"border-color":[{border:[a]}],"border-color-x":[{"border-x":[a]}],"border-color-y":[{"border-y":[a]}],"border-color-s":[{"border-s":[a]}],"border-color-e":[{"border-e":[a]}],"border-color-t":[{"border-t":[a]}],"border-color-r":[{"border-r":[a]}],"border-color-b":[{"border-b":[a]}],"border-color-l":[{"border-l":[a]}],"divide-color":[{divide:[a]}],"outline-style":[{outline:["",...Je()]}],"outline-offset":[{"outline-offset":[gu,mn]}],"outline-w":[{outline:[gu,Mc]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:xe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[A]}],"ring-offset-w":[{"ring-offset":[gu,Mc]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Lc,zW]}],"shadow-color":[{shadow:[ev]}],opacity:[{opacity:[A]}],"mix-blend":[{"mix-blend":[...je(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":je()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[h]}],"drop-shadow":[{"drop-shadow":["","none",Lc,mn]}],grayscale:[{grayscale:[p]}],"hue-rotate":[{"hue-rotate":[v]}],invert:[{invert:[b]}],saturate:[{saturate:[V]}],sepia:[{sepia:[I]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[h]}],"backdrop-grayscale":[{"backdrop-grayscale":[p]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[v]}],"backdrop-invert":[{"backdrop-invert":[b]}],"backdrop-opacity":[{"backdrop-opacity":[A]}],"backdrop-saturate":[{"backdrop-saturate":[V]}],"backdrop-sepia":[{"backdrop-sepia":[I]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[l]}],"border-spacing-x":[{"border-spacing-x":[l]}],"border-spacing-y":[{"border-spacing-y":[l]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",mn]}],duration:[{duration:ee()}],ease:[{ease:["linear","in","out","in-out",mn]}],delay:[{delay:ee()}],animate:[{animate:["none","spin","ping","pulse","bounce",mn]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[j]}],"scale-x":[{"scale-x":[j]}],"scale-y":[{"scale-y":[j]}],rotate:[{rotate:[Jg,mn]}],"translate-x":[{"translate-x":[X]}],"translate-y":[{"translate-y":[X]}],"skew-x":[{"skew-x":[N]}],"skew-y":[{"skew-y":[N]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",mn]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",mn]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":J()}],"scroll-mx":[{"scroll-mx":J()}],"scroll-my":[{"scroll-my":J()}],"scroll-ms":[{"scroll-ms":J()}],"scroll-me":[{"scroll-me":J()}],"scroll-mt":[{"scroll-mt":J()}],"scroll-mr":[{"scroll-mr":J()}],"scroll-mb":[{"scroll-mb":J()}],"scroll-ml":[{"scroll-ml":J()}],"scroll-p":[{"scroll-p":J()}],"scroll-px":[{"scroll-px":J()}],"scroll-py":[{"scroll-py":J()}],"scroll-ps":[{"scroll-ps":J()}],"scroll-pe":[{"scroll-pe":J()}],"scroll-pt":[{"scroll-pt":J()}],"scroll-pr":[{"scroll-pr":J()}],"scroll-pb":[{"scroll-pb":J()}],"scroll-pl":[{"scroll-pl":J()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",mn]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[gu,Mc,yw]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});function xr(...t){return qW(KI(t))}const WW=t=>t.includes("agent")||t.includes("Agent");function bw(t,e,n){return{message:t.final?t.text:`${t.text} ...`,isSelf:n instanceof hb,timestamp:(e==null?void 0:e.timestamp)??Date.now(),name:n instanceof hb?"You":"Agent",...n instanceof hb?{}:{sourceUrl:(e==null?void 0:e.sourceUrl)||""}}}const GW=({callMode:t,isLoading:e,buttonConfig:n,isCalling:r,onCallTrigger:a})=>{var c,h,p;const s=Zo(),l=mw(s.buttonStyle);return W.jsx("button",{disabled:e,onClick:()=>a(t),className:xr("ringg_ai-h-12 ringg_ai-flex ringg_ai-items-center ringg_ai-justify-center ringg_ai-gap-2 ringg_ai-font-medium ringg_ai-transition-all","hover:ringg_ai-opacity-90 disabled:ringg_ai-opacity-50 disabled:ringg_ai-cursor-not-allowed","ringg_ai-call-btn",r?"ringg_ai-w-fit ringg_ai-px-6":"ringg_ai-w-full"),style:{backgroundColor:s.primaryColor,color:s.primaryTextColor,borderRadius:s.buttonStyle==="pill"?"9999px":l,...(c=n==null?void 0:n.call)==null?void 0:c.styles},children:e&&t==="audio"?W.jsxs(W.Fragment,{children:[W.jsx(Gb,{className:"ringg_ai-h-4 ringg_ai-w-4 ringg_ai-animate-spin"}),W.jsx("span",{children:"Connecting..."})]}):W.jsxs(W.Fragment,{children:[t==="audio"&&W.jsx(uW,{className:"ringg_ai-h-4 ringg_ai-w-4"}),t==="text"&&W.jsx($I,{className:"ringg_ai-h-4 ringg_ai-w-4"}),t==="audio"&&(((h=n==null?void 0:n.call)==null?void 0:h.textBeforeCall)||"Start Call"),t==="text"&&(((p=n==null?void 0:n.text)==null?void 0:p.textBeforeCall)||"Start Chat")]})})};var jn;(function(t){t.assertEqual=a=>a;function e(a){}t.assertIs=e;function n(a){throw new Error}t.assertNever=n,t.arrayToEnum=a=>{const s={};for(const l of a)s[l]=l;return s},t.getValidEnumValues=a=>{const s=t.objectKeys(a).filter(c=>typeof a[a[c]]!="number"),l={};for(const c of s)l[c]=a[c];return t.objectValues(l)},t.objectValues=a=>t.objectKeys(a).map(function(s){return a[s]}),t.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const s=[];for(const l in a)Object.prototype.hasOwnProperty.call(a,l)&&s.push(l);return s},t.find=(a,s)=>{for(const l of a)if(s(l))return l},t.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&isFinite(a)&&Math.floor(a)===a;function r(a,s=" | "){return a.map(l=>typeof l=="string"?`'${l}'`:l).join(s)}t.joinValues=r,t.jsonStringifyReplacer=(a,s)=>typeof s=="bigint"?s.toString():s})(jn||(jn={}));var Sw;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(Sw||(Sw={}));const St=jn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),vu=t=>{switch(typeof t){case"undefined":return St.undefined;case"string":return St.string;case"number":return isNaN(t)?St.nan:St.number;case"boolean":return St.boolean;case"function":return St.function;case"bigint":return St.bigint;case"symbol":return St.symbol;case"object":return Array.isArray(t)?St.array:t===null?St.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?St.promise:typeof Map<"u"&&t instanceof Map?St.map:typeof Set<"u"&&t instanceof Set?St.set:typeof Date<"u"&&t instanceof Date?St.date:St.object;default:return St.unknown}},We=jn.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),YW=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class Ao extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(s){return s.message},r={_errors:[]},a=s=>{for(const l of s.issues)if(l.code==="invalid_union")l.unionErrors.map(a);else if(l.code==="invalid_return_type")a(l.returnTypeError);else if(l.code==="invalid_arguments")a(l.argumentsError);else if(l.path.length===0)r._errors.push(n(l));else{let c=r,h=0;for(;h<l.path.length;){const p=l.path[h];h===l.path.length-1?(c[p]=c[p]||{_errors:[]},c[p]._errors.push(n(l))):c[p]=c[p]||{_errors:[]},c=c[p],h++}}};return a(this),r}static assert(e){if(!(e instanceof Ao))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,jn.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},r=[];for(const a of this.issues)a.path.length>0?(n[a.path[0]]=n[a.path[0]]||[],n[a.path[0]].push(e(a))):r.push(e(a));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Ao.create=t=>new Ao(t);const dp=(t,e)=>{let n;switch(t.code){case We.invalid_type:t.received===St.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case We.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,jn.jsonStringifyReplacer)}`;break;case We.unrecognized_keys:n=`Unrecognized key(s) in object: ${jn.joinValues(t.keys,", ")}`;break;case We.invalid_union:n="Invalid input";break;case We.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${jn.joinValues(t.options)}`;break;case We.invalid_enum_value:n=`Invalid enum value. Expected ${jn.joinValues(t.options)}, received '${t.received}'`;break;case We.invalid_arguments:n="Invalid function arguments";break;case We.invalid_return_type:n="Invalid function return type";break;case We.invalid_date:n="Invalid date";break;case We.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:jn.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case We.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case We.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case We.custom:n="Invalid input";break;case We.invalid_intersection_types:n="Intersection results could not be merged";break;case We.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case We.not_finite:n="Number must be finite";break;default:n=e.defaultError,jn.assertNever(t)}return{message:n}};let r3=dp;function KW(t){r3=t}function Yb(){return r3}const Kb=t=>{const{data:e,path:n,errorMaps:r,issueData:a}=t,s=[...n,...a.path||[]],l={...a,path:s};if(a.message!==void 0)return{...a,path:s,message:a.message};let c="";const h=r.filter(p=>!!p).slice().reverse();for(const p of h)c=p(l,{data:e,defaultError:c}).message;return{...a,path:s,message:c}},ZW=[];function lt(t,e){const n=Yb(),r=Kb({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===dp?void 0:dp].filter(a=>!!a)});t.common.issues.push(r)}class ya{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const a of n){if(a.status==="aborted")return Xt;a.status==="dirty"&&e.dirty(),r.push(a.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const a of n){const s=await a.key,l=await a.value;r.push({key:s,value:l})}return ya.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const a of n){const{key:s,value:l}=a;if(s.status==="aborted"||l.status==="aborted")return Xt;s.status==="dirty"&&e.dirty(),l.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof l.value<"u"||a.alwaysSet)&&(r[s.value]=l.value)}return{status:e.value,value:r}}}const Xt=Object.freeze({status:"aborted"}),fp=t=>({status:"dirty",value:t}),ja=t=>({status:"valid",value:t}),Cw=t=>t.status==="aborted",kw=t=>t.status==="dirty",sf=t=>t.status==="valid",tv=t=>typeof Promise<"u"&&t instanceof Promise;function Zb(t,e,n,r){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(t)}function i3(t,e,n,r,a){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,n),n}typeof SuppressedError=="function"&&SuppressedError;var Dt;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Dt||(Dt={}));var nv,rv;class gl{constructor(e,n,r,a){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=a}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const a3=(t,e)=>{if(sf(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Ao(t.common.issues);return this._error=n,this._error}}};function fn(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:a}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(l,c)=>{var h,p;const{message:v}=t;return l.code==="invalid_enum_value"?{message:v??c.defaultError}:typeof c.data>"u"?{message:(h=v??r)!==null&&h!==void 0?h:c.defaultError}:l.code!=="invalid_type"?{message:c.defaultError}:{message:(p=v??n)!==null&&p!==void 0?p:c.defaultError}},description:a}}class yn{get description(){return this._def.description}_getType(e){return vu(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:vu(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ya,ctx:{common:e.parent.common,data:e.data,parsedType:vu(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(tv(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){var r;const a={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:vu(e)},s=this._parseSync({data:e,path:a.path,parent:a});return a3(a,s)}"~validate"(e){var n,r;const a={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:vu(e)};if(!this["~standard"].async)try{const s=this._parseSync({data:e,path:[],parent:a});return sf(s)?{value:s.value}:{issues:a.common.issues}}catch(s){!((r=(n=s==null?void 0:s.message)===null||n===void 0?void 0:n.toLowerCase())===null||r===void 0)&&r.includes("encountered")&&(this["~standard"].async=!0),a.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:a}).then(s=>sf(s)?{value:s.value}:{issues:a.common.issues})}async parseAsync(e,n){const r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:vu(e)},a=this._parse({data:e,path:r.path,parent:r}),s=await(tv(a)?a:Promise.resolve(a));return a3(r,s)}refine(e,n){const r=a=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(a):n;return this._refinement((a,s)=>{const l=e(a),c=()=>s.addIssue({code:We.custom,...r(a)});return typeof Promise<"u"&&l instanceof Promise?l.then(h=>h?!0:(c(),!1)):l?!0:(c(),!1)})}refinement(e,n){return this._refinement((r,a)=>e(r)?!0:(a.addIssue(typeof n=="function"?n(r,a):n),!1))}_refinement(e){return new Ms({schema:this,typeName:Yt.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return yl.create(this,this._def)}nullable(){return Fc.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Os.create(this)}promise(){return gp.create(this,this._def)}or(e){return sv.create([this,e],this._def)}and(e){return lv.create(this,e,this._def)}transform(e){return new Ms({...fn(this._def),schema:this,typeName:Yt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new hv({...fn(this._def),innerType:this,defaultValue:n,typeName:Yt.ZodDefault})}brand(){return new ww({typeName:Yt.ZodBranded,type:this,...fn(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new pv({...fn(this._def),innerType:this,catchValue:n,typeName:Yt.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return mv.create(this,e)}readonly(){return gv.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const QW=/^c[^\s-]{8,}$/i,XW=/^[0-9a-z]+$/,JW=/^[0-9A-HJKMNP-TV-Z]{26}$/i,eG=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,tG=/^[a-z0-9_-]{21}$/i,nG=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,rG=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,iG=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,aG="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Tw;const oG=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,sG=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,lG=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,uG=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,cG=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,dG=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,o3="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",fG=new RegExp(`^${o3}$`);function s3(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function hG(t){return new RegExp(`^${s3(t)}$`)}function l3(t){let e=`${o3}T${s3(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function pG(t,e){return!!((e==="v4"||!e)&&oG.test(t)||(e==="v6"||!e)&&lG.test(t))}function mG(t,e){if(!nG.test(t))return!1;try{const[n]=t.split("."),r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),a=JSON.parse(atob(r));return!(typeof a!="object"||a===null||!a.typ||!a.alg||e&&a.alg!==e)}catch{return!1}}function gG(t,e){return!!((e==="v4"||!e)&&sG.test(t)||(e==="v6"||!e)&&uG.test(t))}class As extends yn{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==St.string){const s=this._getOrReturnCtx(e);return lt(s,{code:We.invalid_type,expected:St.string,received:s.parsedType}),Xt}const r=new ya;let a;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(a=this._getOrReturnCtx(e,a),lt(a,{code:We.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")e.data.length>s.value&&(a=this._getOrReturnCtx(e,a),lt(a,{code:We.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){const l=e.data.length>s.value,c=e.data.length<s.value;(l||c)&&(a=this._getOrReturnCtx(e,a),l?lt(a,{code:We.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):c&<(a,{code:We.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")iG.test(e.data)||(a=this._getOrReturnCtx(e,a),lt(a,{validation:"email",code:We.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")Tw||(Tw=new RegExp(aG,"u")),Tw.test(e.data)||(a=this._getOrReturnCtx(e,a),lt(a,{validation:"emoji",code:We.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")eG.test(e.data)||(a=this._getOrReturnCtx(e,a),lt(a,{validation:"uuid",code:We.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")tG.test(e.data)||(a=this._getOrReturnCtx(e,a),lt(a,{validation:"nanoid",code:We.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")QW.test(e.data)||(a=this._getOrReturnCtx(e,a),lt(a,{validation:"cuid",code:We.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")XW.test(e.data)||(a=this._getOrReturnCtx(e,a),lt(a,{validation:"cuid2",code:We.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")JW.test(e.data)||(a=this._getOrReturnCtx(e,a),lt(a,{validation:"ulid",code:We.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),lt(a,{validation:"url",code:We.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),lt(a,{validation:"regex",code:We.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(a=this._getOrReturnCtx(e,a),lt(a,{code:We.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(a=this._getOrReturnCtx(e,a),lt(a,{code:We.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(a=this._getOrReturnCtx(e,a),lt(a,{code:We.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?l3(s).test(e.data)||(a=this._getOrReturnCtx(e,a),lt(a,{code:We.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?fG.test(e.data)||(a=this._getOrReturnCtx(e,a),lt(a,{code:We.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?hG(s).test(e.data)||(a=this._getOrReturnCtx(e,a),lt(a,{code:We.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?rG.test(e.data)||(a=this._getOrReturnCtx(e,a),lt(a,{validation:"duration",code:We.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?pG(e.data,s.version)||(a=this._getOrReturnCtx(e,a),lt(a,{validation:"ip",code:We.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?mG(e.data,s.alg)||(a=this._getOrReturnCtx(e,a),lt(a,{validation:"jwt",code:We.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?gG(e.data,s.version)||(a=this._getOrReturnCtx(e,a),lt(a,{validation:"cidr",code:We.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?cG.test(e.data)||(a=this._getOrReturnCtx(e,a),lt(a,{validation:"base64",code:We.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?dG.test(e.data)||(a=this._getOrReturnCtx(e,a),lt(a,{validation:"base64url",code:We.invalid_string,message:s.message}),r.dirty()):jn.assertNever(s);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(a=>e.test(a),{validation:n,code:We.invalid_string,...Dt.errToObj(r)})}_addCheck(e){return new As({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Dt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Dt.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Dt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Dt.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Dt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Dt.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Dt.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Dt.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Dt.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Dt.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Dt.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Dt.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Dt.errToObj(e)})}datetime(e){var n,r;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(n=e==null?void 0:e.offset)!==null&&n!==void 0?n:!1,local:(r=e==null?void 0:e.local)!==null&&r!==void 0?r:!1,...Dt.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...Dt.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Dt.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...Dt.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...Dt.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...Dt.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...Dt.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...Dt.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...Dt.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...Dt.errToObj(n)})}nonempty(e){return this.min(1,Dt.errToObj(e))}trim(){return new As({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new As({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new As({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}As.create=t=>{var e;return new As({checks:[],typeName:Yt.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...fn(t)})};function vG(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,a=n>r?n:r,s=parseInt(t.toFixed(a).replace(".","")),l=parseInt(e.toFixed(a).replace(".",""));return s%l/Math.pow(10,a)}class Nc extends yn{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==St.number){const s=this._getOrReturnCtx(e);return lt(s,{code:We.invalid_type,expected:St.number,received:s.parsedType}),Xt}let r;const a=new ya;for(const s of this._def.checks)s.kind==="int"?jn.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),lt(r,{code:We.invalid_type,expected:"integer",received:"float",message:s.message}),a.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),lt(r,{code:We.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),lt(r,{code:We.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="multipleOf"?vG(e.data,s.value)!==0&&(r=this._getOrReturnCtx(e,r),lt(r,{code:We.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),lt(r,{code:We.not_finite,message:s.message}),a.dirty()):jn.assertNever(s);return{status:a.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,Dt.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Dt.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Dt.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Dt.toString(n))}setLimit(e,n,r,a){return new Nc({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Dt.toString(a)}]})}_addCheck(e){return new Nc({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Dt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Dt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Dt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Dt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Dt.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Dt.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:Dt.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Dt.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Dt.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&jn.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}}Nc.create=t=>new Nc({checks:[],typeName:Yt.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...fn(t)});class Ic extends yn{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==St.bigint)return this._getInvalidInput(e);let r;const a=new ya;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),lt(r,{code:We.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),lt(r,{code:We.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),lt(r,{code:We.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):jn.assertNever(s);return{status:a.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return lt(n,{code:We.invalid_type,expected:St.bigint,received:n.parsedType}),Xt}gte(e,n){return this.setLimit("min",e,!0,Dt.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Dt.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Dt.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Dt.toString(n))}setLimit(e,n,r,a){return new Ic({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Dt.toString(a)}]})}_addCheck(e){return new Ic({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Dt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Dt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Dt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Dt.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Dt.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}Ic.create=t=>{var e;return new Ic({checks:[],typeName:Yt.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...fn(t)})};class iv extends yn{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==St.boolean){const r=this._getOrReturnCtx(e);return lt(r,{code:We.invalid_type,expected:St.boolean,received:r.parsedType}),Xt}return ja(e.data)}}iv.create=t=>new iv({typeName:Yt.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...fn(t)});class lf extends yn{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==St.date){const s=this._getOrReturnCtx(e);return lt(s,{code:We.invalid_type,expected:St.date,received:s.parsedType}),Xt}if(isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return lt(s,{code:We.invalid_date}),Xt}const r=new ya;let a;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(a=this._getOrReturnCtx(e,a),lt(a,{code:We.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(a=this._getOrReturnCtx(e,a),lt(a,{code:We.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):jn.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new lf({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:Dt.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:Dt.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}lf.create=t=>new lf({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:Yt.ZodDate,...fn(t)});class Qb extends yn{_parse(e){if(this._getType(e)!==St.symbol){const r=this._getOrReturnCtx(e);return lt(r,{code:We.invalid_type,expected:St.symbol,received:r.parsedType}),Xt}return ja(e.data)}}Qb.create=t=>new Qb({typeName:Yt.ZodSymbol,...fn(t)});class av extends yn{_parse(e){if(this._getType(e)!==St.undefined){const r=this._getOrReturnCtx(e);return lt(r,{code:We.invalid_type,expected:St.undefined,received:r.parsedType}),Xt}return ja(e.data)}}av.create=t=>new av({typeName:Yt.ZodUndefined,...fn(t)});class ov extends yn{_parse(e){if(this._getType(e)!==St.null){const r=this._getOrReturnCtx(e);return lt(r,{code:We.invalid_type,expected:St.null,received:r.parsedType}),Xt}return ja(e.data)}}ov.create=t=>new ov({typeName:Yt.ZodNull,...fn(t)});class hp extends yn{constructor(){super(...arguments),this._any=!0}_parse(e){return ja(e.data)}}hp.create=t=>new hp({typeName:Yt.ZodAny,...fn(t)});class uf extends yn{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ja(e.data)}}uf.create=t=>new uf({typeName:Yt.ZodUnknown,...fn(t)});class yu extends yn{_parse(e){const n=this._getOrReturnCtx(e);return lt(n,{code:We.invalid_type,expected:St.never,received:n.parsedType}),Xt}}yu.create=t=>new yu({typeName:Yt.ZodNever,...fn(t)});class Xb extends yn{_parse(e){if(this._getType(e)!==St.undefined){const r=this._getOrReturnCtx(e);return lt(r,{code:We.invalid_type,expected:St.void,received:r.parsedType}),Xt}return ja(e.data)}}Xb.create=t=>new Xb({typeName:Yt.ZodVoid,...fn(t)});class Os extends yn{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),a=this._def;if(n.parsedType!==St.array)return lt(n,{code:We.invalid_type,expected:St.array,received:n.parsedType}),Xt;if(a.exactLength!==null){const l=n.data.length>a.exactLength.value,c=n.data.length<a.exactLength.value;(l||c)&&(lt(n,{code:l?We.too_big:We.too_small,minimum:c?a.exactLength.value:void 0,maximum:l?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(a.minLength!==null&&n.data.length<a.minLength.value&&(lt(n,{code:We.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),a.maxLength!==null&&n.data.length>a.maxLength.value&&(lt(n,{code:We.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((l,c)=>a.type._parseAsync(new gl(n,l,n.path,c)))).then(l=>ya.mergeArray(r,l));const s=[...n.data].map((l,c)=>a.type._parseSync(new gl(n,l,n.path,c)));return ya.mergeArray(r,s)}get element(){return this._def.type}min(e,n){return new Os({...this._def,minLength:{value:e,message:Dt.toString(n)}})}max(e,n){return new Os({...this._def,maxLength:{value:e,message:Dt.toString(n)}})}length(e,n){return new Os({...this._def,exactLength:{value:e,message:Dt.toString(n)}})}nonempty(e){return this.min(1,e)}}Os.create=(t,e)=>new Os({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Yt.ZodArray,...fn(e)});function pp(t){if(t instanceof $r){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=yl.create(pp(r))}return new $r({...t._def,shape:()=>e})}else return t instanceof Os?new Os({...t._def,type:pp(t.element)}):t instanceof yl?yl.create(pp(t.unwrap())):t instanceof Fc?Fc.create(pp(t.unwrap())):t instanceof vl?vl.create(t.items.map(e=>pp(e))):t}class $r extends yn{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=jn.objectKeys(e);return this._cached={shape:e,keys:n}}_parse(e){if(this._getType(e)!==St.object){const p=this._getOrReturnCtx(e);return lt(p,{code:We.invalid_type,expected:St.object,received:p.parsedType}),Xt}const{status:r,ctx:a}=this._processInputParams(e),{shape:s,keys:l}=this._getCached(),c=[];if(!(this._def.catchall instanceof yu&&this._def.unknownKeys==="strip"))for(const p in a.data)l.includes(p)||c.push(p);const h=[];for(const p of l){const v=s[p],b=a.data[p];h.push({key:{status:"valid",value:p},value:v._parse(new gl(a,b,a.path,p)),alwaysSet:p in a.data})}if(this._def.catchall instanceof yu){const p=this._def.unknownKeys;if(p==="passthrough")for(const v of c)h.push({key:{status:"valid",value:v},value:{status:"valid",value:a.data[v]}});else if(p==="strict")c.length>0&&(lt(a,{code:We.unrecognized_keys,keys:c}),r.dirty());else if(p!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const p=this._def.catchall;for(const v of c){const b=a.data[v];h.push({key:{status:"valid",value:v},value:p._parse(new gl(a,b,a.path,v)),alwaysSet:v in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const p=[];for(const v of h){const b=await v.key,k=await v.value;p.push({key:b,value:k,alwaysSet:v.alwaysSet})}return p}).then(p=>ya.mergeObjectSync(r,p)):ya.mergeObjectSync(r,h)}get shape(){return this._def.shape()}strict(e){return Dt.errToObj,new $r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{var a,s,l,c;const h=(l=(s=(a=this._def).errorMap)===null||s===void 0?void 0:s.call(a,n,r).message)!==null&&l!==void 0?l:r.defaultError;return n.code==="unrecognized_keys"?{message:(c=Dt.errToObj(e).message)!==null&&c!==void 0?c:h}:{message:h}}}:{}})}strip(){return new $r({...this._def,unknownKeys:"strip"})}passthrough(){return new $r({...this._def,unknownKeys:"passthrough"})}extend(e){return new $r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new $r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Yt.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new $r({...this._def,catchall:e})}pick(e){const n={};return jn.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new $r({...this._def,shape:()=>n})}omit(e){const n={};return jn.objectKeys(this.shape).forEach(r=>{e[r]||(n[r]=this.shape[r])}),new $r({...this._def,shape:()=>n})}deepPartial(){return pp(this)}partial(e){const n={};return jn.objectKeys(this.shape).forEach(r=>{const a=this.shape[r];e&&!e[r]?n[r]=a:n[r]=a.optional()}),new $r({...this._def,shape:()=>n})}required(e){const n={};return jn.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof yl;)s=s._def.innerType;n[r]=s}}),new $r({...this._def,shape:()=>n})}keyof(){return u3(jn.objectKeys(this.shape))}}$r.create=(t,e)=>new $r({shape:()=>t,unknownKeys:"strip",catchall:yu.create(),typeName:Yt.ZodObject,...fn(e)}),$r.strictCreate=(t,e)=>new $r({shape:()=>t,unknownKeys:"strict",catchall:yu.create(),typeName:Yt.ZodObject,...fn(e)}),$r.lazycreate=(t,e)=>new $r({shape:t,unknownKeys:"strip",catchall:yu.create(),typeName:Yt.ZodObject,...fn(e)});class sv extends yn{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function a(s){for(const c of s)if(c.result.status==="valid")return c.result;for(const c of s)if(c.result.status==="dirty")return n.common.issues.push(...c.ctx.common.issues),c.result;const l=s.map(c=>new Ao(c.ctx.common.issues));return lt(n,{code:We.invalid_union,unionErrors:l}),Xt}if(n.common.async)return Promise.all(r.map(async s=>{const l={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:l}),ctx:l}})).then(a);{let s;const l=[];for(const h of r){const p={...n,common:{...n.common,issues:[]},parent:null},v=h._parseSync({data:n.data,path:n.path,parent:p});if(v.status==="valid")return v;v.status==="dirty"&&!s&&(s={result:v,ctx:p}),p.common.issues.length&&l.push(p.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const c=l.map(h=>new Ao(h));return lt(n,{code:We.invalid_union,unionErrors:c}),Xt}}get options(){return this._def.options}}sv.create=(t,e)=>new sv({options:t,typeName:Yt.ZodUnion,...fn(e)});const bu=t=>t instanceof cv?bu(t.schema):t instanceof Ms?bu(t.innerType()):t instanceof dv?[t.value]:t instanceof Uc?t.options:t instanceof fv?jn.objectValues(t.enum):t instanceof hv?bu(t._def.innerType):t instanceof av?[void 0]:t instanceof ov?[null]:t instanceof yl?[void 0,...bu(t.unwrap())]:t instanceof Fc?[null,...bu(t.unwrap())]:t instanceof ww||t instanceof gv?bu(t.unwrap()):t instanceof pv?bu(t._def.innerType):[];class Jb extends yn{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==St.object)return lt(n,{code:We.invalid_type,expected:St.object,received:n.parsedType}),Xt;const r=this.discriminator,a=n.data[r],s=this.optionsMap.get(a);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(lt(n,{code:We.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Xt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){const a=new Map;for(const s of n){const l=bu(s.shape[e]);if(!l.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const c of l){if(a.has(c))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(c)}`);a.set(c,s)}}return new Jb({typeName:Yt.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:a,...fn(r)})}}function xw(t,e){const n=vu(t),r=vu(e);if(t===e)return{valid:!0,data:t};if(n===St.object&&r===St.object){const a=jn.objectKeys(e),s=jn.objectKeys(t).filter(c=>a.indexOf(c)!==-1),l={...t,...e};for(const c of s){const h=xw(t[c],e[c]);if(!h.valid)return{valid:!1};l[c]=h.data}return{valid:!0,data:l}}else if(n===St.array&&r===St.array){if(t.length!==e.length)return{valid:!1};const a=[];for(let s=0;s<t.length;s++){const l=t[s],c=e[s],h=xw(l,c);if(!h.valid)return{valid:!1};a.push(h.data)}return{valid:!0,data:a}}else return n===St.date&&r===St.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class lv extends yn{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),a=(s,l)=>{if(Cw(s)||Cw(l))return Xt;const c=xw(s.value,l.value);return c.valid?((kw(s)||kw(l))&&n.dirty(),{status:n.value,value:c.data}):(lt(r,{code:We.invalid_intersection_types}),Xt)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,l])=>a(s,l)):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}lv.create=(t,e,n)=>new lv({left:t,right:e,typeName:Yt.ZodIntersection,...fn(n)});class vl extends yn{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==St.array)return lt(r,{code:We.invalid_type,expected:St.array,received:r.parsedType}),Xt;if(r.data.length<this._def.items.length)return lt(r,{code:We.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Xt;!this._def.rest&&r.data.length>this._def.items.length&&(lt(r,{code:We.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((l,c)=>{const h=this._def.items[c]||this._def.rest;return h?h._parse(new gl(r,l,r.path,c)):null}).filter(l=>!!l);return r.common.async?Promise.all(s).then(l=>ya.mergeArray(n,l)):ya.mergeArray(n,s)}get items(){return this._def.items}rest(e){return new vl({...this._def,rest:e})}}vl.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new vl({items:t,typeName:Yt.ZodTuple,rest:null,...fn(e)})};class uv extends yn{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==St.object)return lt(r,{code:We.invalid_type,expected:St.object,received:r.parsedType}),Xt;const a=[],s=this._def.keyType,l=this._def.valueType;for(const c in r.data)a.push({key:s._parse(new gl(r,c,r.path,c)),value:l._parse(new gl(r,r.data[c],r.path,c)),alwaysSet:c in r.data});return r.common.async?ya.mergeObjectAsync(n,a):ya.mergeObjectSync(n,a)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof yn?new uv({keyType:e,valueType:n,typeName:Yt.ZodRecord,...fn(r)}):new uv({keyType:As.create(),valueType:e,typeName:Yt.ZodRecord,...fn(n)})}}class eS extends yn{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==St.map)return lt(r,{code:We.invalid_type,expected:St.map,received:r.parsedType}),Xt;const a=this._def.keyType,s=this._def.valueType,l=[...r.data.entries()].map(([c,h],p)=>({key:a._parse(new gl(r,c,r.path,[p,"key"])),value:s._parse(new gl(r,h,r.path,[p,"value"]))}));if(r.common.async){const c=new Map;return Promise.resolve().then(async()=>{for(const h of l){const p=await h.key,v=await h.value;if(p.status==="aborted"||v.status==="aborted")return Xt;(p.status==="dirty"||v.status==="dirty")&&n.dirty(),c.set(p.value,v.value)}return{status:n.value,value:c}})}else{const c=new Map;for(const h of l){const p=h.key,v=h.value;if(p.status==="aborted"||v.status==="aborted")return Xt;(p.status==="dirty"||v.status==="dirty")&&n.dirty(),c.set(p.value,v.value)}return{status:n.value,value:c}}}}eS.create=(t,e,n)=>new eS({valueType:e,keyType:t,typeName:Yt.ZodMap,...fn(n)});class cf extends yn{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==St.set)return lt(r,{code:We.invalid_type,expected:St.set,received:r.parsedType}),Xt;const a=this._def;a.minSize!==null&&r.data.size<a.minSize.value&&(lt(r,{code:We.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),n.dirty()),a.maxSize!==null&&r.data.size>a.maxSize.value&&(lt(r,{code:We.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),n.dirty());const s=this._def.valueType;function l(h){const p=new Set;for(const v of h){if(v.status==="aborted")return Xt;v.status==="dirty"&&n.dirty(),p.add(v.value)}return{status:n.value,value:p}}const c=[...r.data.values()].map((h,p)=>s._parse(new gl(r,h,r.path,p)));return r.common.async?Promise.all(c).then(h=>l(h)):l(c)}min(e,n){return new cf({...this._def,minSize:{value:e,message:Dt.toString(n)}})}max(e,n){return new cf({...this._def,maxSize:{value:e,message:Dt.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}cf.create=(t,e)=>new cf({valueType:t,minSize:null,maxSize:null,typeName:Yt.ZodSet,...fn(e)});class mp extends yn{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==St.function)return lt(n,{code:We.invalid_type,expected:St.function,received:n.parsedType}),Xt;function r(c,h){return Kb({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Yb(),dp].filter(p=>!!p),issueData:{code:We.invalid_arguments,argumentsError:h}})}function a(c,h){return Kb({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Yb(),dp].filter(p=>!!p),issueData:{code:We.invalid_return_type,returnTypeError:h}})}const s={errorMap:n.common.contextualErrorMap},l=n.data;if(this._def.returns instanceof gp){const c=this;return ja(async function(...h){const p=new Ao([]),v=await c._def.args.parseAsync(h,s).catch(T=>{throw p.addIssue(r(h,T)),p}),b=await Reflect.apply(l,this,v);return await c._def.returns._def.type.parseAsync(b,s).catch(T=>{throw p.addIssue(a(b,T)),p})})}else{const c=this;return ja(function(...h){const p=c._def.args.safeParse(h,s);if(!p.success)throw new Ao([r(h,p.error)]);const v=Reflect.apply(l,this,p.data),b=c._def.returns.safeParse(v,s);if(!b.success)throw new Ao([a(v,b.error)]);return b.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new mp({...this._def,args:vl.create(e).rest(uf.create())})}returns(e){return new mp({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new mp({args:e||vl.create([]).rest(uf.create()),returns:n||uf.create(),typeName:Yt.ZodFunction,...fn(r)})}}class cv extends yn{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}cv.create=(t,e)=>new cv({getter:t,typeName:Yt.ZodLazy,...fn(e)});class dv extends yn{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return lt(n,{received:n.data,code:We.invalid_literal,expected:this._def.value}),Xt}return{status:"valid",value:e.data}}get value(){return this._def.value}}dv.create=(t,e)=>new dv({value:t,typeName:Yt.ZodLiteral,...fn(e)});function u3(t,e){return new Uc({values:t,typeName:Yt.ZodEnum,...fn(e)})}class Uc extends yn{constructor(){super(...arguments),nv.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return lt(n,{expected:jn.joinValues(r),received:n.parsedType,code:We.invalid_type}),Xt}if(Zb(this,nv)||i3(this,nv,new Set(this._def.values)),!Zb(this,nv).has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return lt(n,{received:n.data,code:We.invalid_enum_value,options:r}),Xt}return ja(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return Uc.create(e,{...this._def,...n})}exclude(e,n=this._def){return Uc.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}}nv=new WeakMap,Uc.create=u3;class fv extends yn{constructor(){super(...arguments),rv.set(this,void 0)}_parse(e){const n=jn.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==St.string&&r.parsedType!==St.number){const a=jn.objectValues(n);return lt(r,{expected:jn.joinValues(a),received:r.parsedType,code:We.invalid_type}),Xt}if(Zb(this,rv)||i3(this,rv,new Set(jn.getValidEnumValues(this._def.values))),!Zb(this,rv).has(e.data)){const a=jn.objectValues(n);return lt(r,{received:r.data,code:We.invalid_enum_value,options:a}),Xt}return ja(e.data)}get enum(){return this._def.values}}rv=new WeakMap,fv.create=(t,e)=>new fv({values:t,typeName:Yt.ZodNativeEnum,...fn(e)});class gp extends yn{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==St.promise&&n.common.async===!1)return lt(n,{code:We.invalid_type,expected:St.promise,received:n.parsedType}),Xt;const r=n.parsedType===St.promise?n.data:Promise.resolve(n.data);return ja(r.then(a=>this._def.type.parseAsync(a,{path:n.path,errorMap:n.common.contextualErrorMap})))}}gp.create=(t,e)=>new gp({type:t,typeName:Yt.ZodPromise,...fn(e)});class Ms extends yn{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Yt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),a=this._def.effect||null,s={addIssue:l=>{lt(r,l),l.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),a.type==="preprocess"){const l=a.transform(r.data,s);if(r.common.async)return Promise.resolve(l).then(async c=>{if(n.value==="aborted")return Xt;const h=await this._def.schema._parseAsync({data:c,path:r.path,parent:r});return h.status==="aborted"?Xt:h.status==="dirty"||n.value==="dirty"?fp(h.value):h});{if(n.value==="aborted")return Xt;const c=this._def.schema._parseSync({data:l,path:r.path,parent:r});return c.status==="aborted"?Xt:c.status==="dirty"||n.value==="dirty"?fp(c.value):c}}if(a.type==="refinement"){const l=c=>{const h=a.refinement(c,s);if(r.common.async)return Promise.resolve(h);if(h instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(r.common.async===!1){const c=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return c.status==="aborted"?Xt:(c.status==="dirty"&&n.dirty(),l(c.value),{status:n.value,value:c.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(c=>c.status==="aborted"?Xt:(c.status==="dirty"&&n.dirty(),l(c.value).then(()=>({status:n.value,value:c.value}))))}if(a.type==="transform")if(r.common.async===!1){const l=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!sf(l))return l;const c=a.transform(l.value,s);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:c}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(l=>sf(l)?Promise.resolve(a.transform(l.value,s)).then(c=>({status:n.value,value:c})):l);jn.assertNever(a)}}Ms.create=(t,e,n)=>new Ms({schema:t,typeName:Yt.ZodEffects,effect:e,...fn(n)}),Ms.createWithPreprocess=(t,e,n)=>new Ms({schema:e,effect:{type:"preprocess",transform:t},typeName:Yt.ZodEffects,...fn(n)});class yl extends yn{_parse(e){return this._getType(e)===St.undefined?ja(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}yl.create=(t,e)=>new yl({innerType:t,typeName:Yt.ZodOptional,...fn(e)});class Fc extends yn{_parse(e){return this._getType(e)===St.null?ja(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Fc.create=(t,e)=>new Fc({innerType:t,typeName:Yt.ZodNullable,...fn(e)});class hv extends yn{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===St.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}hv.create=(t,e)=>new hv({innerType:t,typeName:Yt.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...fn(e)});class pv extends yn{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return tv(a)?a.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ao(r.common.issues)},input:r.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Ao(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}pv.create=(t,e)=>new pv({innerType:t,typeName:Yt.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...fn(e)});class tS extends yn{_parse(e){if(this._getType(e)!==St.nan){const r=this._getOrReturnCtx(e);return lt(r,{code:We.invalid_type,expected:St.nan,received:r.parsedType}),Xt}return{status:"valid",value:e.data}}}tS.create=t=>new tS({typeName:Yt.ZodNaN,...fn(t)});const yG=Symbol("zod_brand");class ww extends yn{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class mv extends yn{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Xt:s.status==="dirty"?(n.dirty(),fp(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{const a=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?Xt:a.status==="dirty"?(n.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:r.path,parent:r})}}static create(e,n){return new mv({in:e,out:n,typeName:Yt.ZodPipeline})}}class gv extends yn{_parse(e){const n=this._def.innerType._parse(e),r=a=>(sf(a)&&(a.value=Object.freeze(a.value)),a);return tv(n)?n.then(a=>r(a)):r(n)}unwrap(){return this._def.innerType}}gv.create=(t,e)=>new gv({innerType:t,typeName:Yt.ZodReadonly,...fn(e)});function c3(t,e={},n){return t?hp.create().superRefine((r,a)=>{var s,l;if(!t(r)){const c=typeof e=="function"?e(r):typeof e=="string"?{message:e}:e,h=(l=(s=c.fatal)!==null&&s!==void 0?s:n)!==null&&l!==void 0?l:!0,p=typeof c=="string"?{message:c}:c;a.addIssue({code:"custom",...p,fatal:h})}}):hp.create()}const bG={object:$r.lazycreate};var Yt;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Yt||(Yt={}));const SG=(t,e={message:`Input not instance of ${t.name}`})=>c3(n=>n instanceof t,e),d3=As.create,f3=Nc.create,CG=tS.create,kG=Ic.create,h3=iv.create,TG=lf.create,xG=Qb.create,wG=av.create,_G=ov.create,EG=hp.create,RG=uf.create,PG=yu.create,DG=Xb.create,AG=Os.create,OG=$r.create,MG=$r.strictCreate,LG=sv.create,NG=Jb.create,IG=lv.create,UG=vl.create,FG=uv.create,jG=eS.create,VG=cf.create,zG=mp.create,BG=cv.create,HG=dv.create,$G=Uc.create,qG=fv.create,WG=gp.create,p3=Ms.create,GG=yl.create,YG=Fc.create,KG=Ms.createWithPreprocess,ZG=mv.create;var m3=Object.freeze({__proto__:null,defaultErrorMap:dp,setErrorMap:KW,getErrorMap:Yb,makeIssue:Kb,EMPTY_PATH:ZW,addIssueToContext:lt,ParseStatus:ya,INVALID:Xt,DIRTY:fp,OK:ja,isAborted:Cw,isDirty:kw,isValid:sf,isAsync:tv,get util(){return jn},get objectUtil(){return Sw},ZodParsedType:St,getParsedType:vu,ZodType:yn,datetimeRegex:l3,ZodString:As,ZodNumber:Nc,ZodBigInt:Ic,ZodBoolean:iv,ZodDate:lf,ZodSymbol:Qb,ZodUndefined:av,ZodNull:ov,ZodAny:hp,ZodUnknown:uf,ZodNever:yu,ZodVoid:Xb,ZodArray:Os,ZodObject:$r,ZodUnion:sv,ZodDiscriminatedUnion:Jb,ZodIntersection:lv,ZodTuple:vl,ZodRecord:uv,ZodMap:eS,ZodSet:cf,ZodFunction:mp,ZodLazy:cv,ZodLiteral:dv,ZodEnum:Uc,ZodNativeEnum:fv,ZodPromise:gp,ZodEffects:Ms,ZodTransformer:Ms,ZodOptional:yl,ZodNullable:Fc,ZodDefault:hv,ZodCatch:pv,ZodNaN:tS,BRAND:yG,ZodBranded:ww,ZodPipeline:mv,ZodReadonly:gv,custom:c3,Schema:yn,ZodSchema:yn,late:bG,get ZodFirstPartyTypeKind(){return Yt},coerce:{string:t=>As.create({...t,coerce:!0}),number:t=>Nc.create({...t,coerce:!0}),boolean:t=>iv.create({...t,coerce:!0}),bigint:t=>Ic.create({...t,coerce:!0}),date:t=>lf.create({...t,coerce:!0})},any:EG,array:AG,bigint:kG,boolean:h3,date:TG,discriminatedUnion:NG,effect:p3,enum:$G,function:zG,instanceof:SG,intersection:IG,lazy:BG,literal:HG,map:jG,nan:CG,nativeEnum:qG,never:PG,null:_G,nullable:YG,number:f3,object:OG,oboolean:()=>h3().optional(),onumber:()=>f3().optional(),optional:GG,ostring:()=>d3().optional(),pipeline:ZG,preprocess:KG,promise:WG,record:FG,set:VG,strictObject:MG,string:d3,symbol:xG,transformer:p3,tuple:UG,undefined:wG,union:LG,unknown:RG,void:DG,NEVER:Xt,ZodIssueCode:We,quotelessJson:YW,ZodError:Ao});const QG=m3.object({message:m3.string().min(1,{message:"Please enter a message."})}),XG=[{id:"text",label:"Chat",icon:$I},{id:"audio",label:"Voice Call",icon:cW}];var vv=t=>t.type==="checkbox",df=t=>t instanceof Date,Va=t=>t==null;const g3=t=>typeof t=="object";var ui=t=>!Va(t)&&!Array.isArray(t)&&g3(t)&&!df(t),v3=t=>ui(t)&&t.target?vv(t.target)?t.target.checked:t.target.value:t,JG=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,y3=(t,e)=>t.has(JG(e)),eY=t=>{const e=t.constructor&&t.constructor.prototype;return ui(e)&&e.hasOwnProperty("isPrototypeOf")},_w=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function so(t){let e;const n=Array.isArray(t),r=typeof FileList<"u"?t instanceof FileList:!1;if(t instanceof Date)e=new Date(t);else if(t instanceof Set)e=new Set(t);else if(!(_w&&(t instanceof Blob||r))&&(n||ui(t)))if(e=n?[]:{},!n&&!eY(t))e=t;else for(const a in t)t.hasOwnProperty(a)&&(e[a]=so(t[a]));else return t;return e}var nS=t=>Array.isArray(t)?t.filter(Boolean):[],ci=t=>t===void 0,rt=(t,e,n)=>{if(!e||!ui(t))return n;const r=nS(e.split(/[,[\].]+?/)).reduce((a,s)=>Va(a)?a:a[s],t);return ci(r)||r===t?ci(t[e])?n:t[e]:r},Qo=t=>typeof t=="boolean",Ew=t=>/^\w*$/.test(t),b3=t=>nS(t.replace(/["|']|\]/g,"").split(/\.|\[/)),or=(t,e,n)=>{let r=-1;const a=Ew(e)?[e]:b3(e),s=a.length,l=s-1;for(;++r<s;){const c=a[r];let h=n;if(r!==l){const p=t[c];h=ui(p)||Array.isArray(p)?p:isNaN(+a[r+1])?{}:[]}if(c==="__proto__"||c==="constructor"||c==="prototype")return;t[c]=h,t=t[c]}return t};const rS={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Ls={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Su={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},S3=ir.createContext(null),iS=()=>ir.useContext(S3),tY=t=>{const{children:e,...n}=t;return ir.createElement(S3.Provider,{value:n},e)};var C3=(t,e,n,r=!0)=>{const a={defaultValues:e._defaultValues};for(const s in t)Object.defineProperty(a,s,{get:()=>{const l=s;return e._proxyFormState[l]!==Ls.all&&(e._proxyFormState[l]=!r||Ls.all),n&&(n[l]=!0),t[l]}});return a},lo=t=>ui(t)&&!Object.keys(t).length,k3=(t,e,n,r)=>{n(t);const{name:a,...s}=t;return lo(s)||Object.keys(s).length>=Object.keys(e).length||Object.keys(s).find(l=>e[l]===(!r||Ls.all))},yv=t=>Array.isArray(t)?t:[t],T3=(t,e,n)=>!t||!e||t===e||yv(t).some(r=>r&&(n?r===e:r.startsWith(e)||e.startsWith(r)));function Rw(t){const e=ir.useRef(t);e.current=t,ir.useEffect(()=>{const n=!t.disabled&&e.current.subject&&e.current.subject.subscribe({next:e.current.next});return()=>{n&&n.unsubscribe()}},[t.disabled])}function nY(t){const e=iS(),{control:n=e.control,disabled:r,name:a,exact:s}=t||{},[l,c]=ir.useState(n._formState),h=ir.useRef(!0),p=ir.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),v=ir.useRef(a);return v.current=a,Rw({disabled:r,next:b=>h.current&&T3(v.current,b.name,s)&&k3(b,p.current,n._updateFormState)&&c({...n._formState,...b}),subject:n._subjects.state}),ir.useEffect(()=>(h.current=!0,p.current.isValid&&n._updateValid(!0),()=>{h.current=!1}),[n]),ir.useMemo(()=>C3(l,n,p.current,!1),[l,n])}var bl=t=>typeof t=="string",x3=(t,e,n,r,a)=>bl(t)?(r&&e.watch.add(t),rt(n,t,a)):Array.isArray(t)?t.map(s=>(r&&e.watch.add(s),rt(n,s))):(r&&(e.watchAll=!0),n);function rY(t){const e=iS(),{control:n=e.control,name:r,defaultValue:a,disabled:s,exact:l}=t||{},c=ir.useRef(r);c.current=r,Rw({disabled:s,subject:n._subjects.values,next:v=>{T3(c.current,v.name,l)&&p(so(x3(c.current,n._names,v.values||n._formValues,!1,a)))}});const[h,p]=ir.useState(n._getWatch(r,a));return ir.useEffect(()=>n._removeUnmounted()),h}function iY(t){const e=iS(),{name:n,disabled:r,control:a=e.control,shouldUnregister:s}=t,l=y3(a._names.array,n),c=rY({control:a,name:n,defaultValue:rt(a._formValues,n,rt(a._defaultValues,n,t.defaultValue)),exact:!0}),h=nY({control:a,name:n,exact:!0}),p=ir.useRef(a.register(n,{...t.rules,value:c,...Qo(t.disabled)?{disabled:t.disabled}:{}})),v=ir.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!rt(h.errors,n)},isDirty:{enumerable:!0,get:()=>!!rt(h.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!rt(h.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!rt(h.validatingFields,n)},error:{enumerable:!0,get:()=>rt(h.errors,n)}}),[h,n]),b=ir.useMemo(()=>({name:n,value:c,...Qo(r)||h.disabled?{disabled:h.disabled||r}:{},onChange:k=>p.current.onChange({target:{value:v3(k),name:n},type:rS.CHANGE}),onBlur:()=>p.current.onBlur({target:{value:rt(a._formValues,n),name:n},type:rS.BLUR}),ref:k=>{const T=rt(a._fields,n);T&&k&&(T._f.ref={focus:()=>k.focus(),select:()=>k.select(),setCustomValidity:E=>k.setCustomValidity(E),reportValidity:()=>k.reportValidity()})}}),[n,a._formValues,r,h.disabled,c,a._fields]);return ir.useEffect(()=>{const k=a._options.shouldUnregister||s,T=(E,R)=>{const M=rt(a._fields,E);M&&M._f&&(M._f.mount=R)};if(T(n,!0),k){const E=so(rt(a._options.defaultValues,n));or(a._defaultValues,n,E),ci(rt(a._formValues,n))&&or(a._formValues,n,E)}return!l&&a.register(n),()=>{(l?k&&!a._state.action:k)?a.unregister(n):T(n,!1)}},[n,a,l,s]),ir.useEffect(()=>{a._updateDisabledField({disabled:r,fields:a._fields,name:n})},[r,n,a]),ir.useMemo(()=>({field:b,formState:h,fieldState:v}),[b,h,v])}const aY=t=>t.render(iY(t));var w3=(t,e,n,r,a)=>e?{...n[t],types:{...n[t]&&n[t].types?n[t].types:{},[r]:a||!0}}:{},_3=t=>({isOnSubmit:!t||t===Ls.onSubmit,isOnBlur:t===Ls.onBlur,isOnChange:t===Ls.onChange,isOnAll:t===Ls.all,isOnTouch:t===Ls.onTouched}),E3=(t,e,n)=>!n&&(e.watchAll||e.watch.has(t)||[...e.watch].some(r=>t.startsWith(r)&&/^\.\w+/.test(t.slice(r.length))));const bv=(t,e,n,r)=>{for(const a of n||Object.keys(t)){const s=rt(t,a);if(s){const{_f:l,...c}=s;if(l){if(l.refs&&l.refs[0]&&e(l.refs[0],a)&&!r)return!0;if(l.ref&&e(l.ref,l.name)&&!r)return!0;if(bv(c,e))break}else if(ui(c)&&bv(c,e))break}}};var oY=(t,e,n)=>{const r=yv(rt(t,n));return or(r,"root",e[n]),or(t,n,r),t},Pw=t=>t.type==="file",Sl=t=>typeof t=="function",aS=t=>{if(!_w)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},oS=t=>bl(t),Dw=t=>t.type==="radio",sS=t=>t instanceof RegExp;const R3={value:!1,isValid:!1},P3={value:!0,isValid:!0};var D3=t=>{if(Array.isArray(t)){if(t.length>1){const e=t.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:e,isValid:!!e.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!ci(t[0].attributes.value)?ci(t[0].value)||t[0].value===""?P3:{value:t[0].value,isValid:!0}:P3:R3}return R3};const A3={isValid:!1,value:null};var O3=t=>Array.isArray(t)?t.reduce((e,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:e,A3):A3;function M3(t,e,n="validate"){if(oS(t)||Array.isArray(t)&&t.every(oS)||Qo(t)&&!t)return{type:n,message:oS(t)?t:"",ref:e}}var vp=t=>ui(t)&&!sS(t)?t:{value:t,message:""},L3=async(t,e,n,r,a,s)=>{const{ref:l,refs:c,required:h,maxLength:p,minLength:v,min:b,max:k,pattern:T,validate:E,name:R,valueAsNumber:M,mount:A}=t._f,U=rt(n,R);if(!A||e.has(R))return{};const V=c?c[0]:l,j=J=>{a&&V.reportValidity&&(V.setCustomValidity(Qo(J)?"":J||""),V.reportValidity())},I={},N=Dw(l),ne=vv(l),X=N||ne,se=(M||Pw(l))&&ci(l.value)&&ci(U)||aS(l)&&l.value===""||U===""||Array.isArray(U)&&!U.length,$=w3.bind(null,R,r,I),oe=(J,xe,ke,Ge=Su.maxLength,Je=Su.minLength)=>{const je=J?xe:ke;I[R]={type:J?Ge:Je,message:je,ref:l,...$(J?Ge:Je,je)}};if(s?!Array.isArray(U)||!U.length:h&&(!X&&(se||Va(U))||Qo(U)&&!U||ne&&!D3(c).isValid||N&&!O3(c).isValid)){const{value:J,message:xe}=oS(h)?{value:!!h,message:h}:vp(h);if(J&&(I[R]={type:Su.required,message:xe,ref:V,...$(Su.required,xe)},!r))return j(xe),I}if(!se&&(!Va(b)||!Va(k))){let J,xe;const ke=vp(k),Ge=vp(b);if(!Va(U)&&!isNaN(U)){const Je=l.valueAsNumber||U&&+U;Va(ke.value)||(J=Je>ke.value),Va(Ge.value)||(xe=Je<Ge.value)}else{const Je=l.valueAsDate||new Date(U),je=z=>new Date(new Date().toDateString()+" "+z),ve=l.type=="time",He=l.type=="week";bl(ke.value)&&U&&(J=ve?je(U)>je(ke.value):He?U>ke.value:Je>new Date(ke.value)),bl(Ge.value)&&U&&(xe=ve?je(U)<je(Ge.value):He?U<Ge.value:Je<new Date(Ge.value))}if((J||xe)&&(oe(!!J,ke.message,Ge.message,Su.max,Su.min),!r))return j(I[R].message),I}if((p||v)&&!se&&(bl(U)||s&&Array.isArray(U))){const J=vp(p),xe=vp(v),ke=!Va(J.value)&&U.length>+J.value,Ge=!Va(xe.value)&&U.length<+xe.value;if((ke||Ge)&&(oe(ke,J.message,xe.message),!r))return j(I[R].message),I}if(T&&!se&&bl(U)){const{value:J,message:xe}=vp(T);if(sS(J)&&!U.match(J)&&(I[R]={type:Su.pattern,message:xe,ref:l,...$(Su.pattern,xe)},!r))return j(xe),I}if(E){if(Sl(E)){const J=await E(U,n),xe=M3(J,V);if(xe&&(I[R]={...xe,...$(Su.validate,xe.message)},!r))return j(xe.message),I}else if(ui(E)){let J={};for(const xe in E){if(!lo(J)&&!r)break;const ke=M3(await E[xe](U,n),V,xe);ke&&(J={...ke,...$(xe,ke.message)},j(ke.message),r&&(I[R]=J))}if(!lo(J)&&(I[R]={ref:V,...J},!r))return I}}return j(!0),I};function sY(t,e){const n=e.slice(0,-1).length;let r=0;for(;r<n;)t=ci(t)?r++:t[e[r++]];return t}function lY(t){for(const e in t)if(t.hasOwnProperty(e)&&!ci(t[e]))return!1;return!0}function Ei(t,e){const n=Array.isArray(e)?e:Ew(e)?[e]:b3(e),r=n.length===1?t:sY(t,n),a=n.length-1,s=n[a];return r&&delete r[s],a!==0&&(ui(r)&&lo(r)||Array.isArray(r)&&lY(r))&&Ei(t,n.slice(0,-1)),t}var Aw=()=>{let t=[];return{get observers(){return t},next:a=>{for(const s of t)s.next&&s.next(a)},subscribe:a=>(t.push(a),{unsubscribe:()=>{t=t.filter(s=>s!==a)}}),unsubscribe:()=>{t=[]}}},Ow=t=>Va(t)||!g3(t);function jc(t,e){if(Ow(t)||Ow(e))return t===e;if(df(t)&&df(e))return t.getTime()===e.getTime();const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(const a of n){const s=t[a];if(!r.includes(a))return!1;if(a!=="ref"){const l=e[a];if(df(s)&&df(l)||ui(s)&&ui(l)||Array.isArray(s)&&Array.isArray(l)?!jc(s,l):s!==l)return!1}}return!0}var N3=t=>t.type==="select-multiple",uY=t=>Dw(t)||vv(t),Mw=t=>aS(t)&&t.isConnected,I3=t=>{for(const e in t)if(Sl(t[e]))return!0;return!1};function lS(t,e={}){const n=Array.isArray(t);if(ui(t)||n)for(const r in t)Array.isArray(t[r])||ui(t[r])&&!I3(t[r])?(e[r]=Array.isArray(t[r])?[]:{},lS(t[r],e[r])):Va(t[r])||(e[r]=!0);return e}function U3(t,e,n){const r=Array.isArray(t);if(ui(t)||r)for(const a in t)Array.isArray(t[a])||ui(t[a])&&!I3(t[a])?ci(e)||Ow(n[a])?n[a]=Array.isArray(t[a])?lS(t[a],[]):{...lS(t[a])}:U3(t[a],Va(e)?{}:e[a],n[a]):n[a]=!jc(t[a],e[a]);return n}var Sv=(t,e)=>U3(t,e,lS(e)),F3=(t,{valueAsNumber:e,valueAsDate:n,setValueAs:r})=>ci(t)?t:e?t===""?NaN:t&&+t:n&&bl(t)?new Date(t):r?r(t):t;function Lw(t){const e=t.ref;return Pw(e)?e.files:Dw(e)?O3(t.refs).value:N3(e)?[...e.selectedOptions].map(({value:n})=>n):vv(e)?D3(t.refs).value:F3(ci(e.value)?t.ref.value:e.value,t)}var cY=(t,e,n,r)=>{const a={};for(const s of t){const l=rt(e,s);l&&or(a,s,l._f)}return{criteriaMode:n,names:[...t],fields:a,shouldUseNativeValidation:r}},Cv=t=>ci(t)?t:sS(t)?t.source:ui(t)?sS(t.value)?t.value.source:t.value:t;const j3="AsyncFunction";var dY=t=>!!t&&!!t.validate&&!!(Sl(t.validate)&&t.validate.constructor.name===j3||ui(t.validate)&&Object.values(t.validate).find(e=>e.constructor.name===j3)),fY=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate);function V3(t,e,n){const r=rt(t,n);if(r||Ew(n))return{error:r,name:n};const a=n.split(".");for(;a.length;){const s=a.join("."),l=rt(e,s),c=rt(t,s);if(l&&!Array.isArray(l)&&n!==s)return{name:n};if(c&&c.type)return{name:s,error:c};a.pop()}return{name:n}}var hY=(t,e,n,r,a)=>a.isOnAll?!1:!n&&a.isOnTouch?!(e||t):(n?r.isOnBlur:a.isOnBlur)?!t:(n?r.isOnChange:a.isOnChange)?t:!0,pY=(t,e)=>!nS(rt(t,e)).length&&Ei(t,e);const mY={mode:Ls.onSubmit,reValidateMode:Ls.onChange,shouldFocusError:!0};function gY(t={}){let e={...mY,...t},n={submitCount:0,isDirty:!1,isLoading:Sl(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1},r={},a=ui(e.defaultValues)||ui(e.values)?so(e.defaultValues||e.values)||{}:{},s=e.shouldUnregister?{}:so(a),l={action:!1,mount:!1,watch:!1},c={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},h,p=0;const v={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},b={values:Aw(),array:Aw(),state:Aw()},k=_3(e.mode),T=_3(e.reValidateMode),E=e.criteriaMode===Ls.all,R=Z=>le=>{clearTimeout(p),p=setTimeout(Z,le)},M=async Z=>{if(!e.disabled&&(v.isValid||Z)){const le=e.resolver?lo((await X()).errors):await $(r,!0);le!==n.isValid&&b.state.next({isValid:le})}},A=(Z,le)=>{!e.disabled&&(v.isValidating||v.validatingFields)&&((Z||Array.from(c.mount)).forEach(me=>{me&&(le?or(n.validatingFields,me,le):Ei(n.validatingFields,me))}),b.state.next({validatingFields:n.validatingFields,isValidating:!lo(n.validatingFields)}))},U=(Z,le=[],me,Ve,ze=!0,Oe=!0)=>{if(Ve&&me&&!e.disabled){if(l.action=!0,Oe&&Array.isArray(rt(r,Z))){const ut=me(rt(r,Z),Ve.argA,Ve.argB);ze&&or(r,Z,ut)}if(Oe&&Array.isArray(rt(n.errors,Z))){const ut=me(rt(n.errors,Z),Ve.argA,Ve.argB);ze&&or(n.errors,Z,ut),pY(n.errors,Z)}if(v.touchedFields&&Oe&&Array.isArray(rt(n.touchedFields,Z))){const ut=me(rt(n.touchedFields,Z),Ve.argA,Ve.argB);ze&&or(n.touchedFields,Z,ut)}v.dirtyFields&&(n.dirtyFields=Sv(a,s)),b.state.next({name:Z,isDirty:J(Z,le),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else or(s,Z,le)},V=(Z,le)=>{or(n.errors,Z,le),b.state.next({errors:n.errors})},j=Z=>{n.errors=Z,b.state.next({errors:n.errors,isValid:!1})},I=(Z,le,me,Ve)=>{const ze=rt(r,Z);if(ze){const Oe=rt(s,Z,ci(me)?rt(a,Z):me);ci(Oe)||Ve&&Ve.defaultChecked||le?or(s,Z,le?Oe:Lw(ze._f)):Ge(Z,Oe),l.mount&&M()}},N=(Z,le,me,Ve,ze)=>{let Oe=!1,ut=!1;const Nt={name:Z};if(!e.disabled){const fe=!!(rt(r,Z)&&rt(r,Z)._f&&rt(r,Z)._f.disabled);if(!me||Ve){v.isDirty&&(ut=n.isDirty,n.isDirty=Nt.isDirty=J(),Oe=ut!==Nt.isDirty);const Re=fe||jc(rt(a,Z),le);ut=!!(!fe&&rt(n.dirtyFields,Z)),Re||fe?Ei(n.dirtyFields,Z):or(n.dirtyFields,Z,!0),Nt.dirtyFields=n.dirtyFields,Oe=Oe||v.dirtyFields&&ut!==!Re}if(me){const Re=rt(n.touchedFields,Z);Re||(or(n.touchedFields,Z,me),Nt.touchedFields=n.touchedFields,Oe=Oe||v.touchedFields&&Re!==me)}Oe&&ze&&b.state.next(Nt)}return Oe?Nt:{}},ne=(Z,le,me,Ve)=>{const ze=rt(n.errors,Z),Oe=v.isValid&&Qo(le)&&n.isValid!==le;if(e.delayError&&me?(h=R(()=>V(Z,me)),h(e.delayError)):(clearTimeout(p),h=null,me?or(n.errors,Z,me):Ei(n.errors,Z)),(me?!jc(ze,me):ze)||!lo(Ve)||Oe){const ut={...Ve,...Oe&&Qo(le)?{isValid:le}:{},errors:n.errors,name:Z};n={...n,...ut},b.state.next(ut)}},X=async Z=>{A(Z,!0);const le=await e.resolver(s,e.context,cY(Z||c.mount,r,e.criteriaMode,e.shouldUseNativeValidation));return A(Z),le},se=async Z=>{const{errors:le}=await X(Z);if(Z)for(const me of Z){const Ve=rt(le,me);Ve?or(n.errors,me,Ve):Ei(n.errors,me)}else n.errors=le;return le},$=async(Z,le,me={valid:!0})=>{for(const Ve in Z){const ze=Z[Ve];if(ze){const{_f:Oe,...ut}=ze;if(Oe){const Nt=c.array.has(Oe.name),fe=ze._f&&dY(ze._f);fe&&v.validatingFields&&A([Ve],!0);const Re=await L3(ze,c.disabled,s,E,e.shouldUseNativeValidation&&!le,Nt);if(fe&&v.validatingFields&&A([Ve]),Re[Oe.name]&&(me.valid=!1,le))break;!le&&(rt(Re,Oe.name)?Nt?oY(n.errors,Re,Oe.name):or(n.errors,Oe.name,Re[Oe.name]):Ei(n.errors,Oe.name))}!lo(ut)&&await $(ut,le,me)}}return me.valid},oe=()=>{for(const Z of c.unMount){const le=rt(r,Z);le&&(le._f.refs?le._f.refs.every(me=>!Mw(me)):!Mw(le._f.ref))&&ht(Z)}c.unMount=new Set},J=(Z,le)=>!e.disabled&&(Z&&le&&or(s,Z,le),!jc(ee(),a)),xe=(Z,le,me)=>x3(Z,c,{...l.mount?s:ci(le)?a:bl(Z)?{[Z]:le}:le},me,le),ke=Z=>nS(rt(l.mount?s:a,Z,e.shouldUnregister?rt(a,Z,[]):[])),Ge=(Z,le,me={})=>{const Ve=rt(r,Z);let ze=le;if(Ve){const Oe=Ve._f;Oe&&(!Oe.disabled&&or(s,Z,F3(le,Oe)),ze=aS(Oe.ref)&&Va(le)?"":le,N3(Oe.ref)?[...Oe.ref.options].forEach(ut=>ut.selected=ze.includes(ut.value)):Oe.refs?vv(Oe.ref)?Oe.refs.length>1?Oe.refs.forEach(ut=>(!ut.defaultChecked||!ut.disabled)&&(ut.checked=Array.isArray(ze)?!!ze.find(Nt=>Nt===ut.value):ze===ut.value)):Oe.refs[0]&&(Oe.refs[0].checked=!!ze):Oe.refs.forEach(ut=>ut.checked=ut.value===ze):Pw(Oe.ref)?Oe.ref.value="":(Oe.ref.value=ze,Oe.ref.type||b.values.next({name:Z,values:{...s}})))}(me.shouldDirty||me.shouldTouch)&&N(Z,ze,me.shouldTouch,me.shouldDirty,!0),me.shouldValidate&&z(Z)},Je=(Z,le,me)=>{for(const Ve in le){const ze=le[Ve],Oe=`${Z}.${Ve}`,ut=rt(r,Oe);(c.array.has(Z)||ui(ze)||ut&&!ut._f)&&!df(ze)?Je(Oe,ze,me):Ge(Oe,ze,me)}},je=(Z,le,me={})=>{const Ve=rt(r,Z),ze=c.array.has(Z),Oe=so(le);or(s,Z,Oe),ze?(b.array.next({name:Z,values:{...s}}),(v.isDirty||v.dirtyFields)&&me.shouldDirty&&b.state.next({name:Z,dirtyFields:Sv(a,s),isDirty:J(Z,Oe)})):Ve&&!Ve._f&&!Va(Oe)?Je(Z,Oe,me):Ge(Z,Oe,me),E3(Z,c)&&b.state.next({...n}),b.values.next({name:l.mount?Z:void 0,values:{...s}})},ve=async Z=>{l.mount=!0;const le=Z.target;let me=le.name,Ve=!0;const ze=rt(r,me),Oe=()=>le.type?Lw(ze._f):v3(Z),ut=Nt=>{Ve=Number.isNaN(Nt)||df(Nt)&&isNaN(Nt.getTime())||jc(Nt,rt(s,me,Nt))};if(ze){let Nt,fe;const Re=Oe(),vt=Z.type===rS.BLUR||Z.type===rS.FOCUS_OUT,Ft=!fY(ze._f)&&!e.resolver&&!rt(n.errors,me)&&!ze._f.deps||hY(vt,rt(n.touchedFields,me),n.isSubmitted,T,k),Kt=E3(me,c,vt);or(s,me,Re),vt?(ze._f.onBlur&&ze._f.onBlur(Z),h&&h(0)):ze._f.onChange&&ze._f.onChange(Z);const Be=N(me,Re,vt,!1),ct=!lo(Be)||Kt;if(!vt&&b.values.next({name:me,type:Z.type,values:{...s}}),Ft)return v.isValid&&(e.mode==="onBlur"&&vt?M():vt||M()),ct&&b.state.next({name:me,...Kt?{}:Be});if(!vt&&Kt&&b.state.next({...n}),e.resolver){const{errors:At}=await X([me]);if(ut(Re),Ve){const ln=V3(n.errors,r,me),En=V3(At,r,ln.name||me);Nt=En.error,me=En.name,fe=lo(At)}}else A([me],!0),Nt=(await L3(ze,c.disabled,s,E,e.shouldUseNativeValidation))[me],A([me]),ut(Re),Ve&&(Nt?fe=!1:v.isValid&&(fe=await $(r,!0)));Ve&&(ze._f.deps&&z(ze._f.deps),ne(me,fe,Nt,Be))}},He=(Z,le)=>{if(rt(n.errors,le)&&Z.focus)return Z.focus(),1},z=async(Z,le={})=>{let me,Ve;const ze=yv(Z);if(e.resolver){const Oe=await se(ci(Z)?Z:ze);me=lo(Oe),Ve=Z?!ze.some(ut=>rt(Oe,ut)):me}else Z?(Ve=(await Promise.all(ze.map(async Oe=>{const ut=rt(r,Oe);return await $(ut&&ut._f?{[Oe]:ut}:ut)}))).every(Boolean),!(!Ve&&!n.isValid)&&M()):Ve=me=await $(r);return b.state.next({...!bl(Z)||v.isValid&&me!==n.isValid?{}:{name:Z},...e.resolver||!Z?{isValid:me}:{},errors:n.errors}),le.shouldFocus&&!Ve&&bv(r,He,Z?ze:c.mount),Ve},ee=Z=>{const le={...l.mount?s:a};return ci(Z)?le:bl(Z)?rt(le,Z):Z.map(me=>rt(le,me))},Ce=(Z,le)=>({invalid:!!rt((le||n).errors,Z),isDirty:!!rt((le||n).dirtyFields,Z),error:rt((le||n).errors,Z),isValidating:!!rt(n.validatingFields,Z),isTouched:!!rt((le||n).touchedFields,Z)}),H=Z=>{Z&&yv(Z).forEach(le=>Ei(n.errors,le)),b.state.next({errors:Z?n.errors:{}})},Ct=(Z,le,me)=>{const Ve=(rt(r,Z,{_f:{}})._f||{}).ref,ze=rt(n.errors,Z)||{},{ref:Oe,message:ut,type:Nt,...fe}=ze;or(n.errors,Z,{...fe,...le,ref:Ve}),b.state.next({name:Z,errors:n.errors,isValid:!1}),me&&me.shouldFocus&&Ve&&Ve.focus&&Ve.focus()},Rt=(Z,le)=>Sl(Z)?b.values.subscribe({next:me=>Z(xe(void 0,le),me)}):xe(Z,le,!0),ht=(Z,le={})=>{for(const me of Z?yv(Z):c.mount)c.mount.delete(me),c.array.delete(me),le.keepValue||(Ei(r,me),Ei(s,me)),!le.keepError&&Ei(n.errors,me),!le.keepDirty&&Ei(n.dirtyFields,me),!le.keepTouched&&Ei(n.touchedFields,me),!le.keepIsValidating&&Ei(n.validatingFields,me),!e.shouldUnregister&&!le.keepDefaultValue&&Ei(a,me);b.values.next({values:{...s}}),b.state.next({...n,...le.keepDirty?{isDirty:J()}:{}}),!le.keepIsValid&&M()},bt=({disabled:Z,name:le,field:me,fields:Ve})=>{(Qo(Z)&&l.mount||Z||c.disabled.has(le))&&(Z?c.disabled.add(le):c.disabled.delete(le),N(le,Lw(me?me._f:rt(Ve,le)._f),!1,!1,!0))},it=(Z,le={})=>{let me=rt(r,Z);const Ve=Qo(le.disabled)||Qo(e.disabled);return or(r,Z,{...me||{},_f:{...me&&me._f?me._f:{ref:{name:Z}},name:Z,mount:!0,...le}}),c.mount.add(Z),me?bt({field:me,disabled:Qo(le.disabled)?le.disabled:e.disabled,name:Z}):I(Z,!0,le.value),{...Ve?{disabled:le.disabled||e.disabled}:{},...e.progressive?{required:!!le.required,min:Cv(le.min),max:Cv(le.max),minLength:Cv(le.minLength),maxLength:Cv(le.maxLength),pattern:Cv(le.pattern)}:{},name:Z,onChange:ve,onBlur:ve,ref:ze=>{if(ze){it(Z,le),me=rt(r,Z);const Oe=ci(ze.value)&&ze.querySelectorAll&&ze.querySelectorAll("input,select,textarea")[0]||ze,ut=uY(Oe),Nt=me._f.refs||[];if(ut?Nt.find(fe=>fe===Oe):Oe===me._f.ref)return;or(r,Z,{_f:{...me._f,...ut?{refs:[...Nt.filter(Mw),Oe,...Array.isArray(rt(a,Z))?[{}]:[]],ref:{type:Oe.type,name:Z}}:{ref:Oe}}}),I(Z,!1,void 0,Oe)}else me=rt(r,Z,{}),me._f&&(me._f.mount=!1),(e.shouldUnregister||le.shouldUnregister)&&!(y3(c.array,Z)&&l.action)&&c.unMount.add(Z)}}},xt=()=>e.shouldFocusError&&bv(r,He,c.mount),tn=Z=>{Qo(Z)&&(b.state.next({disabled:Z}),bv(r,(le,me)=>{const Ve=rt(r,me);Ve&&(le.disabled=Ve._f.disabled||Z,Array.isArray(Ve._f.refs)&&Ve._f.refs.forEach(ze=>{ze.disabled=Ve._f.disabled||Z}))},0,!1))},qn=(Z,le)=>async me=>{let Ve;me&&(me.preventDefault&&me.preventDefault(),me.persist&&me.persist());let ze=so(s);if(c.disabled.size)for(const Oe of c.disabled)or(ze,Oe,void 0);if(b.state.next({isSubmitting:!0}),e.resolver){const{errors:Oe,values:ut}=await X();n.errors=Oe,ze=ut}else await $(r);if(Ei(n.errors,"root"),lo(n.errors)){b.state.next({errors:{}});try{await Z(ze,me)}catch(Oe){Ve=Oe}}else le&&await le({...n.errors},me),xt(),setTimeout(xt);if(b.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:lo(n.errors)&&!Ve,submitCount:n.submitCount+1,errors:n.errors}),Ve)throw Ve},_r=(Z,le={})=>{rt(r,Z)&&(ci(le.defaultValue)?je(Z,so(rt(a,Z))):(je(Z,le.defaultValue),or(a,Z,so(le.defaultValue))),le.keepTouched||Ei(n.touchedFields,Z),le.keepDirty||(Ei(n.dirtyFields,Z),n.isDirty=le.defaultValue?J(Z,so(rt(a,Z))):J()),le.keepError||(Ei(n.errors,Z),v.isValid&&M()),b.state.next({...n}))},vr=(Z,le={})=>{const me=Z?so(Z):a,Ve=so(me),ze=lo(Z),Oe=ze?a:Ve;if(le.keepDefaultValues||(a=me),!le.keepValues){if(le.keepDirtyValues){const ut=new Set([...c.mount,...Object.keys(Sv(a,s))]);for(const Nt of Array.from(ut))rt(n.dirtyFields,Nt)?or(Oe,Nt,rt(s,Nt)):je(Nt,rt(Oe,Nt))}else{if(_w&&ci(Z))for(const ut of c.mount){const Nt=rt(r,ut);if(Nt&&Nt._f){const fe=Array.isArray(Nt._f.refs)?Nt._f.refs[0]:Nt._f.ref;if(aS(fe)){const Re=fe.closest("form");if(Re){Re.reset();break}}}}r={}}s=e.shouldUnregister?le.keepDefaultValues?so(a):{}:so(Oe),b.array.next({values:{...Oe}}),b.values.next({values:{...Oe}})}c={mount:le.keepDirtyValues?c.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},l.mount=!v.isValid||!!le.keepIsValid||!!le.keepDirtyValues,l.watch=!!e.shouldUnregister,b.state.next({submitCount:le.keepSubmitCount?n.submitCount:0,isDirty:ze?!1:le.keepDirty?n.isDirty:!!(le.keepDefaultValues&&!jc(Z,a)),isSubmitted:le.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:ze?{}:le.keepDirtyValues?le.keepDefaultValues&&s?Sv(a,s):n.dirtyFields:le.keepDefaultValues&&Z?Sv(a,Z):le.keepDirty?n.dirtyFields:{},touchedFields:le.keepTouched?n.touchedFields:{},errors:le.keepErrors?n.errors:{},isSubmitSuccessful:le.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},Xn=(Z,le)=>vr(Sl(Z)?Z(s):Z,le);return{control:{register:it,unregister:ht,getFieldState:Ce,handleSubmit:qn,setError:Ct,_executeSchema:X,_getWatch:xe,_getDirty:J,_updateValid:M,_removeUnmounted:oe,_updateFieldArray:U,_updateDisabledField:bt,_getFieldArray:ke,_reset:vr,_resetDefaultValues:()=>Sl(e.defaultValues)&&e.defaultValues().then(Z=>{Xn(Z,e.resetOptions),b.state.next({isLoading:!1})}),_updateFormState:Z=>{n={...n,...Z}},_disableForm:tn,_subjects:b,_proxyFormState:v,_setErrors:j,get _fields(){return r},get _formValues(){return s},get _state(){return l},set _state(Z){l=Z},get _defaultValues(){return a},get _names(){return c},set _names(Z){c=Z},get _formState(){return n},set _formState(Z){n=Z},get _options(){return e},set _options(Z){e={...e,...Z}}},trigger:z,register:it,handleSubmit:qn,watch:Rt,setValue:je,getValues:ee,reset:Xn,resetField:_r,clearErrors:H,unregister:ht,setError:Ct,setFocus:(Z,le={})=>{const me=rt(r,Z),Ve=me&&me._f;if(Ve){const ze=Ve.refs?Ve.refs[0]:Ve.ref;ze.focus&&(ze.focus(),le.shouldSelect&&Sl(ze.select)&&ze.select())}},getFieldState:Ce}}function vY(t={}){const e=ir.useRef(void 0),n=ir.useRef(void 0),[r,a]=ir.useState({isDirty:!1,isValidating:!1,isLoading:Sl(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1,defaultValues:Sl(t.defaultValues)?void 0:t.defaultValues});e.current||(e.current={...gY(t),formState:r});const s=e.current.control;return s._options=t,Rw({subject:s._subjects.state,next:l=>{k3(l,s._proxyFormState,s._updateFormState,!0)&&a({...s._formState})}}),ir.useEffect(()=>s._disableForm(t.disabled),[s,t.disabled]),ir.useEffect(()=>{if(s._proxyFormState.isDirty){const l=s._getDirty();l!==r.isDirty&&s._subjects.state.next({isDirty:l})}},[s,r.isDirty]),ir.useEffect(()=>{t.values&&!jc(t.values,n.current)?(s._reset(t.values,s._options.resetOptions),n.current=t.values,a(l=>({...l}))):s._resetDefaultValues()},[t.values,s]),ir.useEffect(()=>{t.errors&&s._setErrors(t.errors)},[t.errors,s]),ir.useEffect(()=>{s._state.mount||(s._updateValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),ir.useEffect(()=>{t.shouldUnregister&&s._subjects.values.next({values:s._getWatch()})},[t.shouldUnregister,s]),e.current.formState=C3(r,s),e.current}const z3=(t,e,n)=>{if(t&&"reportValidity"in t){const r=rt(n,e);t.setCustomValidity(r&&r.message||""),t.reportValidity()}},B3=(t,e)=>{for(const n in e.fields){const r=e.fields[n];r&&r.ref&&"reportValidity"in r.ref?z3(r.ref,n,t):r.refs&&r.refs.forEach(a=>z3(a,n,t))}},yY=(t,e)=>{e.shouldUseNativeValidation&&B3(t,e);const n={};for(const r in t){const a=rt(e.fields,r),s=Object.assign(t[r]||{},{ref:a&&a.ref});if(bY(e.names||Object.keys(t),r)){const l=Object.assign({},rt(n,r));or(l,"root",s),or(n,r,l)}else or(n,r,s)}return n},bY=(t,e)=>t.some(n=>n.startsWith(e+"."));var SY=function(t,e){for(var n={};t.length;){var r=t[0],a=r.code,s=r.message,l=r.path.join(".");if(!n[l])if("unionErrors"in r){var c=r.unionErrors[0].errors[0];n[l]={message:c.message,type:c.code}}else n[l]={message:s,type:a};if("unionErrors"in r&&r.unionErrors.forEach(function(v){return v.errors.forEach(function(b){return t.push(b)})}),e){var h=n[l].types,p=h&&h[r.code];n[l]=w3(l,e,n,a,p?[].concat(p,r.message):r.message)}t.shift()}return n},CY=function(t,e,n){return n===void 0&&(n={}),function(r,a,s){try{return Promise.resolve(function(l,c){try{var h=Promise.resolve(t[n.mode==="sync"?"parse":"parseAsync"](r,e)).then(function(p){return s.shouldUseNativeValidation&&B3({},s),{errors:{},values:n.raw?r:p}})}catch(p){return c(p)}return h&&h.then?h.then(void 0,c):h}(0,function(l){if(function(c){return Array.isArray(c==null?void 0:c.errors)}(l))return{values:{},errors:yY(SY(l.errors,!s.shouldUseNativeValidation&&s.criteriaMode==="all"),s)};throw l}))}catch(l){return Promise.reject(l)}}};function H3(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function kY(...t){return e=>{let n=!1;const r=t.map(a=>{const s=H3(a,e);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let a=0;a<r.length;a++){const s=r[a];typeof s=="function"?s():H3(t[a],null)}}}}var uS=G.forwardRef((t,e)=>{const{children:n,...r}=t,a=G.Children.toArray(n),s=a.find(xY);if(s){const l=s.props.children,c=a.map(h=>h===s?G.Children.count(l)>1?G.Children.only(null):G.isValidElement(l)?l.props.children:null:h);return W.jsx(Nw,{...r,ref:e,children:G.isValidElement(l)?G.cloneElement(l,void 0,c):null})}return W.jsx(Nw,{...r,ref:e,children:n})});uS.displayName="Slot";var Nw=G.forwardRef((t,e)=>{const{children:n,...r}=t;if(G.isValidElement(n)){const a=_Y(n);return G.cloneElement(n,{...wY(r,n.props),ref:e?kY(e,a):a})}return G.Children.count(n)>1?G.Children.only(null):null});Nw.displayName="SlotClone";var TY=({children:t})=>W.jsx(W.Fragment,{children:t});function xY(t){return G.isValidElement(t)&&t.type===TY}function wY(t,e){const n={...e};for(const r in e){const a=t[r],s=e[r];/^on[A-Z]/.test(r)?a&&s?n[r]=(...c)=>{s(...c),a(...c)}:a&&(n[r]=a):r==="style"?n[r]={...a,...s}:r==="className"&&(n[r]=[a,s].filter(Boolean).join(" "))}return{...t,...n}}function _Y(t){var r,a;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(a=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:a.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var EY=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],RY=EY.reduce((t,e)=>{const n=G.forwardRef((r,a)=>{const{asChild:s,...l}=r,c=s?uS:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),W.jsx(c,{...l,ref:a})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{}),PY="Label",$3=G.forwardRef((t,e)=>W.jsx(RY.label,{...t,ref:e,onMouseDown:n=>{var a;n.target.closest("button, input, select, textarea")||((a=t.onMouseDown)==null||a.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));$3.displayName=PY;var q3=$3;const W3=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,G3=KI,Y3=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return G3(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:a,defaultVariants:s}=e,l=Object.keys(a).map(p=>{const v=n==null?void 0:n[p],b=s==null?void 0:s[p];if(v===null)return null;const k=W3(v)||W3(b);return a[p][k]}),c=n&&Object.entries(n).reduce((p,v)=>{let[b,k]=v;return k===void 0||(p[b]=k),p},{}),h=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((p,v)=>{let{class:b,className:k,...T}=v;return Object.entries(T).every(E=>{let[R,M]=E;return Array.isArray(M)?M.includes({...s,...c}[R]):{...s,...c}[R]===M})?[...p,b,k]:p},[]);return G3(t,l,h,n==null?void 0:n.class,n==null?void 0:n.className)},DY=Y3("ringg_ai-text-sm ringg_ai-font-medium ringg_ai-leading-none peer-disabled:ringg_ai-cursor-not-allowed peer-disabled:ringg_ai-opacity-70"),K3=G.forwardRef(({className:t,...e},n)=>W.jsx(q3,{ref:n,className:xr(DY(),t),...e}));K3.displayName=q3.displayName;const AY=tY,Z3=G.createContext({}),OY=({...t})=>W.jsx(Z3.Provider,{value:{name:t.name},children:W.jsx(aY,{...t})}),cS=()=>{const t=G.useContext(Z3),e=G.useContext(Q3),{getFieldState:n,formState:r}=iS(),a=n(t.name,r);if(!t)throw new Error("useFormField should be used within <FormField>");const{id:s}=e;return{id:s,name:t.name,formItemId:`${s}-form-item`,formDescriptionId:`${s}-form-item-description`,formMessageId:`${s}-form-item-message`,...a}},Q3=G.createContext({}),X3=G.forwardRef(({className:t,...e},n)=>{const r=G.useId();return W.jsx(Q3.Provider,{value:{id:r},children:W.jsx("div",{ref:n,className:xr("ringg_ai-space-y-2",t),...e})})});X3.displayName="FormItem";const MY=G.forwardRef(({className:t,...e},n)=>{const{error:r,formItemId:a}=cS();return W.jsx(K3,{ref:n,className:xr(r&&"ringg_ai-text-destructive",t),htmlFor:a,...e})});MY.displayName="FormLabel";const J3=G.forwardRef(({...t},e)=>{const{error:n,formItemId:r,formDescriptionId:a,formMessageId:s}=cS();return W.jsx(uS,{ref:e,id:r,"aria-describedby":n?`${a} ${s}`:`${a}`,"aria-invalid":!!n,...t})});J3.displayName="FormControl";const LY=G.forwardRef(({className:t,...e},n)=>{const{formDescriptionId:r}=cS();return W.jsx("p",{ref:n,id:r,className:xr("ringg_ai-text-[0.8rem] ringg_ai-text-muted-foreground",t),...e})});LY.displayName="FormDescription";const e4=G.forwardRef(({className:t,children:e,...n},r)=>{const{error:a,formMessageId:s}=cS(),l=a?String((a==null?void 0:a.message)??""):e;return l?W.jsx("p",{ref:r,id:s,className:xr("ringg_ai-text-[0.8rem] ringg_ai-font-medium ringg_ai-text-destructive",t),...n,children:l}):null});e4.displayName="FormMessage";const NY=({isSending:t,onMessageSubmit:e})=>{const n=Zo(),r=vY({defaultValues:{message:""},resolver:CY(QG),mode:"onSubmit"}),a=s=>{console.log("%c[Message Sent] User:","background: #3b82f6; color: white; padding: 2px 6px; border-radius: 3px;",s.message),e==null||e(s.message),r.reset()};return W.jsx(AY,{...r,children:W.jsx("form",{onSubmit:r.handleSubmit(a),children:W.jsx(OY,{control:r.control,name:"message",render:({field:s})=>W.jsxs(X3,{children:[W.jsxs("div",{className:"ringg_ai-relative",children:[W.jsx(J3,{children:W.jsx("input",{placeholder:"Type here",autoComplete:"off",className:"ringg_ai-w-full ringg_ai-rounded-full ringg_ai-h-12 ringg_ai-px-4 ringg_ai-pr-14 ringg_ai-text-sm ringg_ai-border focus:ringg_ai-outline-none focus:ringg_ai-ring-2",style:{backgroundColor:n.surfaceColor,color:n.textColor,borderColor:n.borderColor,"--tw-ring-color":n.primaryColor},...s})}),W.jsxs("button",{type:"submit",disabled:t,className:"ringg_ai-absolute ringg_ai-right-1 ringg_ai-top-1/2 ringg_ai-transform -ringg_ai-translate-y-1/2 ringg_ai-rounded-full ringg_ai-h-10 ringg_ai-w-10 ringg_ai-flex ringg_ai-items-center ringg_ai-justify-center ringg_ai-transition-opacity hover:ringg_ai-opacity-80 disabled:ringg_ai-opacity-50",style:{backgroundColor:n.primaryColor,color:n.primaryTextColor},children:[W.jsx(hW,{className:"ringg_ai-h-4 ringg_ai-w-4"}),W.jsx("span",{className:"ringg_ai-sr-only",children:"Send message"})]})]}),W.jsx(e4,{})]})})})})},IY=({isCalling:t,callMode:e,buttonConfig:n,onCallEnd:r})=>{var v,b;const a=Zo(),s=JT(),{send:l,isSending:c}=$M(),h=async()=>s.localParticipant.setMicrophoneEnabled(!s.localParticipant.isMicrophoneEnabled),p=()=>r==null?void 0:r();return t&&e==="text"?W.jsx(NY,{isSending:c,onMessageSubmit:l}):t&&e==="audio"?W.jsxs("div",{className:"ringg_ai-flex ringg_ai-flex-row ringg_ai-w-full ringg_ai-justify-between ringg_ai-items-center",children:[W.jsxs("div",{className:"ringg_ai-flex ringg_ai-flex-col ringg_ai-gap-1",children:[W.jsx("button",{onClick:h,className:xr("ringg_ai-rounded-full ringg_ai-h-12 ringg_ai-w-12 ringg_ai-flex ringg_ai-items-center ringg_ai-justify-center ringg_ai-transition-opacity hover:ringg_ai-opacity-80"),style:{backgroundColor:a.surfaceColor,...(v=n==null?void 0:n.mic)==null?void 0:v.styles},children:s.localParticipant.isMicrophoneEnabled?W.jsx(fW,{className:"ringg_ai-h-4 ringg_ai-w-4",style:{color:a.textColor}}):W.jsx(rW,{className:"ringg_ai-h-4 ringg_ai-w-4",style:{color:a.textColor}})}),W.jsx("p",{className:"ringg_ai-text-sm ringg_ai-text-center ringg_ai-font-normal",style:{color:a.mutedTextColor},children:s.localParticipant.isMicrophoneEnabled?"Mute":"Un-Mute"})]}),W.jsxs("div",{className:"ringg_ai-flex ringg_ai-flex-col ringg_ai-gap-1",children:[W.jsx("button",{onClick:p,className:xr("ringg_ai-rounded-full ringg_ai-h-12 ringg_ai-w-12 ringg_ai-flex ringg_ai-items-center ringg_ai-justify-center ringg_ai-transition-opacity hover:ringg_ai-opacity-80"),style:{backgroundColor:a.errorColor,...(b=n==null?void 0:n.mic)==null?void 0:b.styles},children:W.jsx(dW,{className:"ringg_ai-h-4 ringg_ai-w-4 ringg_ai-text-white"})}),W.jsx("p",{className:"ringg_ai-text-sm ringg_ai-text-center ringg_ai-font-normal",style:{color:a.mutedTextColor},children:"End Call"})]})]}):null},UY=({children:t,open:e,containerRef:n})=>{const r=Zo();return!e||!n.current?null:aD.createPortal(W.jsx("div",{className:"ringg_ai-absolute ringg_ai-inset-0 ringg_ai-z-[9999] ringg_ai-flex ringg_ai-items-center ringg_ai-justify-center ringg_ai-bg-black/50",children:W.jsx("div",{className:"ringg_ai-relative ringg_ai-shadow-lg ringg_ai-max-w-md ringg_ai-w-full ringg_ai-mx-4 ringg_ai-p-6",style:{backgroundColor:r.backgroundColor,borderRadius:r.borderRadius,color:r.textColor},children:t})}),n.current)},FY=({children:t,className:e=""})=>W.jsx("div",{className:xr("ringg_ai-space-y-4",e),children:t}),jY=({children:t})=>W.jsx("div",{className:"ringg_ai-space-y-2",children:t}),VY=({children:t})=>{const e=Zo();return W.jsx("h2",{className:"ringg_ai-text-md ringg_ai-font-medium",style:{color:e.textColor},children:t})},zY=({children:t})=>{const e=Zo();return W.jsx("p",{className:"ringg_ai-text-sm",style:{color:e.mutedTextColor},children:t})},BY=({children:t})=>W.jsx("div",{className:"ringg_ai-flex ringg_ai-justify-center ringg_ai-space-x-2 ringg_ai-pt-4",children:t}),HY=({filled:t,onClick:e,onMouseEnter:n,onMouseLeave:r,starsStyles:a})=>{const s=(a==null?void 0:a.filledColor)??"#FBBF24",l=(a==null?void 0:a.emptyColor)??"#D1D5DB";return W.jsx("button",{type:"button",onClick:e,onMouseEnter:n,onMouseLeave:r,className:"ringg_ai-p-1 ringg_ai-transition-transform hover:ringg_ai-scale-110",children:W.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:t?s:"none",stroke:t?s:l,strokeWidth:"2",className:"ringg_ai-w-8 ringg_ai-h-8 ringg_ai-cursor-pointer ringg_ai-transition-colors",children:W.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.48 3.499a.562.562 0 011.04 0l2.125 5.111a.563.563 0 00.475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 00-.182.557l1.285 5.385a.562.562 0 01-.84.61l-4.725-2.885a.563.563 0 00-.586 0L6.982 20.54a.562.562 0 01-.84-.61l1.285-5.386a.562.562 0 00-.182-.557l-4.204-3.602a.563.563 0 01.321-.988l5.518-.442a.563.563 0 00.475-.345L11.48 3.5z"})})})},$Y=({callMode:t,isSubmitting:e,feedbackScreenConfig:n,onSubmit:r,onSkip:a})=>{const s=Zo(),l=mw(s.buttonStyle),[c,h]=G.useState(0),[p,v]=G.useState(0),[b,k]=G.useState(""),T=()=>{c>0&&r(c,b)},E=p||c,R=(n==null?void 0:n.starsCount)??5,M=Array.from({length:R},(A,U)=>U+1);return W.jsxs("div",{className:"ringg_ai-flex ringg_ai-flex-col ringg_ai-items-center ringg_ai-justify-center ringg_ai-p-6 ringg_ai-h-full ringg_ai-gap-4",children:[W.jsxs("div",{className:"ringg_ai-text-center",children:[W.jsx("h3",{className:"ringg_ai-text-lg ringg_ai-font-semibold ringg_ai-mb-1",style:{color:s.textColor},children:(n==null?void 0:n.title)??`How was your ${t==="text"?"chat":"call"}?`}),W.jsx("p",{className:"ringg_ai-text-sm",style:{color:s.mutedTextColor},children:(n==null?void 0:n.description)??"Your feedback helps us improve!"})]}),W.jsx("div",{className:"ringg_ai-flex ringg_ai-gap-1 ringg_ai-my-2",children:M.map(A=>W.jsx(HY,{filled:A<=E,onClick:()=>h(A),onMouseEnter:()=>v(A),onMouseLeave:()=>v(0),starsStyles:n==null?void 0:n.starsStyles},A))}),W.jsx("textarea",{value:b,onChange:A=>k(A.target.value),placeholder:(n==null?void 0:n.placeholder)??"We'd love to hear more...",className:xr("ringg_ai-w-full ringg_ai-min-h-[80px] ringg_ai-p-3 ringg_ai-text-sm ringg_ai-border ringg_ai-resize-none focus:ringg_ai-outline-none focus:ringg_ai-ring-2"),style:{backgroundColor:s.surfaceColor,color:s.textColor,borderColor:s.borderColor,borderRadius:l,"--tw-ring-color":s.primaryColor},maxLength:500}),W.jsxs("div",{className:"ringg_ai-flex ringg_ai-w-full ringg_ai-flex-col ringg_ai-gap-3 ringg_ai-mt-2",children:[W.jsx("button",{onClick:T,disabled:c===0||e,className:xr("ringg_ai-w-full ringg_ai-py-2.5 ringg_ai-font-medium ringg_ai-transition-all","hover:ringg_ai-opacity-90 disabled:ringg_ai-opacity-50 disabled:ringg_ai-cursor-not-allowed"),style:{backgroundColor:s.primaryColor,color:s.primaryTextColor,borderRadius:l,...n==null?void 0:n.submitBtnStyles},children:(n==null?void 0:n.submitBtnCTA)??"Submit Feedback"}),W.jsx("button",{type:"button",onClick:a,disabled:e,className:"ringg_ai-text-sm ringg_ai-w-full ringg_ai-transition-colors hover:ringg_ai-opacity-80",style:{color:s.mutedTextColor},children:"Skip"})]})]})},qY=({isCalling:t,isLoading:e,title:n,description:r,logoUrl:a="https://assets.ringg.ai/images/logo/logo-dark.png",logoStyles:s})=>{const l=Zo();if(!t)return W.jsxs(W.Fragment,{children:[W.jsx("div",{className:"ringg_ai-mx-auto ringg_ai-overflow-clip ringg_ai-w-[70px] ringg_ai-h-[70px] ringg_ai-rounded-full ringg_ai-flex ringg_ai-items-center ringg_ai-justify-center",style:{backgroundColor:l.primaryColor,...s},children:W.jsx("img",{src:a,alt:"Logo"})}),W.jsxs("div",{className:"ringg_ai-flex ringg_ai-gap-1 ringg_ai-flex-col",children:[W.jsx("h2",{className:"ringg_ai-text-xl ringg_ai-text-center ringg_ai-font-medium",style:{color:l.textColor},children:n}),!e&&W.jsxs("p",{className:"ringg_ai-text-sm ringg_ai-text-center ringg_ai-font-normal",style:{color:l.mutedTextColor},children:[r,"."]}),e&&W.jsx("p",{className:"ringg_ai-text-sm ringg_ai-text-yellow-500 ringg_ai-text-center ringg_ai-font-normal",children:"Connecting.."})]})]});if(t)return W.jsxs("div",{className:"ringg_ai-absolute ringg_ai-overflow-clip ringg_ai-border-b ringg_ai-w-full ringg_ai-top-0 ringg_ai-left-0 ringg_ai-p-4 ringg_ai-flex ringg_ai-flex-row ringg_ai-gap-2 ringg_ai-justify-start ringg_ai-items-center",style:{backgroundColor:l.backgroundColor,borderColor:l.borderColor},children:[W.jsx("div",{className:"ringg_ai-w-[48px] ringg_ai-h-[48px] ringg_ai-rounded-full ringg_ai-flex ringg_ai-items-center ringg_ai-justify-center",style:{backgroundColor:l.primaryColor,...s},children:W.jsx("img",{src:a,alt:"Logo"})}),W.jsxs("div",{className:"ringg_ai-w-fit ringg_ai-flex ringg_ai-flex-col",children:[W.jsx("h2",{className:"ringg_ai-text-xl ringg_ai-text-start ringg_ai-font-medium",style:{color:l.textColor},children:n}),W.jsx("p",{className:"ringg_ai-text-sm ringg_ai-text-start ringg_ai-font-normal",style:{color:l.successColor},children:e?"Calling...":t?"Call in Progress":""})]})]})};function WY(t){const e=new Map;return t.forEach(n=>{const a=new Date(n.datetime).toISOString().split("T")[0];e.has(a)||e.set(a,[]),e.get(a).push(n)}),Array.from(e.entries()).sort(([n],[r])=>n.localeCompare(r)).map(([n,r])=>{const a=new Date(n);return{date:n,dateLabel:a.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"}),slots:r.sort((s,l)=>new Date(s.datetime).getTime()-new Date(l.datetime).getTime())}})}function t4(t,e){return new Date(t).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0,timeZone:e})}function GY(t){return new Date(t).toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})}function Iw(t,e){const n={};for(const[r,a]of Object.entries(t))if(typeof a=="string"&&a.startsWith("{")&&a.endsWith("}")){const s=a.slice(1,-1);n[r]=e[s]??a}else n[r]=a;return n}function n4(t){return t.component_type==="calendar_booking"}function r4(t){return t.component_type==="form"}function YY(t){return t.component_type==="buttons"}function KY(t){return t.component_type==="confirmation"}const ZY={primaryColor:"#313335",primaryTextColor:"#ffffff",backgroundColor:"#F3F3F5",surfaceColor:"#ffffff",textColor:"#212121",mutedTextColor:"#11111180",borderColor:"#e5e5e5",errorColor:"#ef4444",successColor:"#10b981",fontFamily:"inherit",fontSize:"14px",borderRadius:"12px",padding:"16px",buttonStyle:"rounded",buttonSize:"md"};function Uw(t){return{...ZY,...t}}function Fw(t){switch(t){case"pill":return"9999px";case"square":return"4px";case"rounded":default:return"8px"}}const i4=G.createContext(null),dS=()=>{const t=G.useContext(i4);let e;try{e=Zo()}catch{e=null}return t||Uw(e?{primaryColor:e.primaryColor,primaryTextColor:e.primaryTextColor,backgroundColor:e.surfaceColor,textColor:e.textColor,mutedTextColor:e.mutedTextColor,borderColor:e.borderColor,errorColor:e.errorColor,successColor:e.successColor,buttonStyle:e.buttonStyle}:{})},QY=({payload:t,isProcessing:e,onComplete:n})=>{var T;const r=dS(),a=Fw(r.buttonStyle),{data:s}=t,l=G.useMemo(()=>WY(s.available_slots),[s.available_slots]),[c,h]=G.useState(((T=l[0])==null?void 0:T.date)||""),[p,v]=G.useState(null),b=l.find(E=>E.date===c),k=()=>{p&&n(p.id,p.datetime)};return W.jsxs("div",{children:[W.jsxs("div",{className:"ringg_ai-flex ringg_ai-items-center ringg_ai-gap-2 ringg_ai-mb-3",children:[W.jsx(jI,{className:"ringg_ai-w-4 ringg_ai-h-4",style:{color:r.primaryColor}}),W.jsx("p",{className:"ringg_ai-text-sm ringg_ai-font-medium",style:{color:r.textColor},children:s.title})]}),W.jsxs("p",{className:"ringg_ai-text-xs ringg_ai-mb-3",style:{color:r.mutedTextColor},children:["Timezone: ",s.timezone]}),W.jsxs("div",{className:"ringg_ai-mb-3",children:[W.jsx("p",{className:"ringg_ai-text-xs ringg_ai-font-semibold ringg_ai-uppercase ringg_ai-tracking-wide ringg_ai-mb-2",style:{color:r.mutedTextColor},children:"Select Date"}),W.jsx("div",{className:"ringg_ai-flex ringg_ai-gap-2 ringg_ai-flex-wrap",children:l.map(E=>W.jsx("button",{onClick:()=>{h(E.date),v(null)},className:xr("ringg_ai-px-3 ringg_ai-py-2 ringg_ai-text-xs ringg_ai-font-semibold ringg_ai-transition-all ringg_ai-duration-200","hover:ringg_ai-opacity-90 focus:ringg_ai-outline-none focus:ringg_ai-ring-2 focus:ringg_ai-ring-offset-1"),style:{borderRadius:a,backgroundColor:c===E.date?r.primaryColor:"white",color:c===E.date?r.primaryTextColor:r.textColor,border:c===E.date?"none":`1px solid ${r.borderColor}`,boxShadow:c===E.date?"0 2px 4px rgba(0,0,0,0.1)":"none","--tw-ring-color":r.primaryColor},children:E.dateLabel},E.date))})]}),W.jsx(sx,{mode:"wait",children:b&&W.jsxs(mu.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"ringg_ai-mb-3",children:[W.jsxs("p",{className:"ringg_ai-text-xs ringg_ai-font-semibold ringg_ai-uppercase ringg_ai-tracking-wide ringg_ai-mb-2 ringg_ai-flex ringg_ai-items-center ringg_ai-gap-1",style:{color:r.mutedTextColor},children:[W.jsx(zI,{className:"ringg_ai-w-3 ringg_ai-h-3"}),"Select Time"]}),W.jsx("div",{className:"ringg_ai-grid ringg_ai-grid-cols-3 ringg_ai-gap-1.5",children:b.slots.map(E=>W.jsx("button",{onClick:()=>v(E),className:xr("ringg_ai-px-2 ringg_ai-py-2 ringg_ai-text-xs ringg_ai-font-medium ringg_ai-transition-all ringg_ai-duration-200","hover:ringg_ai-opacity-90 focus:ringg_ai-outline-none focus:ringg_ai-ring-2 focus:ringg_ai-ring-offset-1"),style:{borderRadius:a,backgroundColor:(p==null?void 0:p.id)===E.id?r.primaryColor:"white",color:(p==null?void 0:p.id)===E.id?r.primaryTextColor:r.textColor,border:`1px solid ${(p==null?void 0:p.id)===E.id?r.primaryColor:r.borderColor}`,boxShadow:(p==null?void 0:p.id)===E.id?"0 2px 4px rgba(0,0,0,0.1)":"none","--tw-ring-color":r.primaryColor},children:t4(E.datetime,s.timezone)},E.id))})]},c)}),W.jsx("button",{onClick:k,disabled:!p||e,className:xr("ringg_ai-w-full ringg_ai-h-9 ringg_ai-text-sm ringg_ai-font-semibold ringg_ai-transition-all ringg_ai-duration-200","hover:ringg_ai-opacity-90 focus:ringg_ai-outline-none focus:ringg_ai-ring-2 focus:ringg_ai-ring-offset-2","disabled:ringg_ai-opacity-50 disabled:ringg_ai-cursor-not-allowed disabled:hover:ringg_ai-opacity-50"),style:{borderRadius:a,backgroundColor:!p||e?r.borderColor:r.primaryColor,color:!p||e?r.mutedTextColor:r.primaryTextColor,"--tw-ring-color":r.primaryColor},children:e?W.jsxs("span",{className:"ringg_ai-flex ringg_ai-items-center ringg_ai-justify-center ringg_ai-gap-2",children:[W.jsx(Gb,{className:"ringg_ai-w-4 ringg_ai-h-4 ringg_ai-animate-spin"}),"Processing..."]}):"Next"})]})},XY={text:pw,email:HI,tel:aW,number:pw,select:VI,textarea:BI},JY=({payload:t,isProcessing:e,onComplete:n})=>{const r=dS(),a=Fw(r.buttonStyle),{data:s}=t,[l,c]=G.useState({}),[h,p]=G.useState({}),v=(U,V)=>{if(U.required&&!V.trim())return`${U.label} is required`;if(V&&U.validation){if(U.validation.minLength&&V.length<U.validation.minLength)return U.validation.message||`${U.label} must be at least ${U.validation.minLength} characters`;if(U.validation.maxLength&&V.length>U.validation.maxLength)return U.validation.message||`${U.label} must be at most ${U.validation.maxLength} characters`;if(U.validation.pattern&&!new RegExp(U.validation.pattern).test(V))return U.validation.message||`${U.label} is invalid`}return U.type==="email"&&V&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(V)?"Please enter a valid email address":U.type==="tel"&&V&&!/^[\d\s\-+()]{7,}$/.test(V)?"Please enter a valid phone number":null},b=()=>{const U={};let V=!0;return s.fields.forEach(j=>{const I=v(j,l[j.name]||"");I&&(U[j.name]=I,V=!1)}),p(U),V},k=(U,V)=>{c(j=>({...j,[U]:V})),h[U]&&p(j=>{const I={...j};return delete I[U],I})},T=()=>{b()&&n(l)},E=U=>typeof U=="string"?U:U.label,R=U=>typeof U=="string"?U:U.value,M=U=>({backgroundColor:"white",color:r.textColor,borderColor:U?r.errorColor:r.borderColor,borderRadius:a}),A="focus:ringg_ai-outline-none focus:ringg_ai-ring-2";return W.jsxs("div",{children:[W.jsxs("div",{className:"ringg_ai-flex ringg_ai-items-center ringg_ai-gap-2 ringg_ai-mb-2",children:[W.jsx(BI,{className:"ringg_ai-w-4 ringg_ai-h-4",style:{color:r.primaryColor}}),W.jsx("p",{className:"ringg_ai-text-sm ringg_ai-font-medium",style:{color:r.textColor},children:s.title})]}),s.description&&W.jsx("p",{className:"ringg_ai-text-xs ringg_ai-mb-3",style:{color:r.mutedTextColor},children:s.description}),W.jsx("div",{className:"ringg_ai-space-y-2.5 ringg_ai-mb-3",children:s.fields.map(U=>{const V=XY[U.type]||pw,j=!!h[U.name];return W.jsxs("div",{children:[W.jsxs("label",{className:"ringg_ai-text-xs ringg_ai-font-medium ringg_ai-mb-1 ringg_ai-flex ringg_ai-items-center ringg_ai-gap-1",style:{color:r.mutedTextColor},children:[W.jsx(V,{className:"ringg_ai-w-3 ringg_ai-h-3"}),U.label,U.required&&W.jsx("span",{style:{color:r.errorColor},children:"*"})]}),U.type==="select"&&U.options&&W.jsxs("div",{className:"ringg_ai-relative",children:[W.jsxs("select",{value:l[U.name]||"",onChange:I=>k(U.name,I.target.value),className:xr("ringg_ai-w-full ringg_ai-px-3 ringg_ai-py-2 ringg_ai-text-xs ringg_ai-border ringg_ai-transition-colors ringg_ai-appearance-none",A),style:{...M(j),"--tw-ring-color":r.primaryColor},children:[W.jsx("option",{value:"",children:U.placeholder||`Select ${U.label.toLowerCase()}`}),U.options.map((I,N)=>W.jsx("option",{value:R(I),children:E(I)},N))]}),W.jsx(VI,{className:"ringg_ai-absolute ringg_ai-right-3 ringg_ai-top-1/2 -ringg_ai-translate-y-1/2 ringg_ai-w-3.5 ringg_ai-h-3.5 ringg_ai-pointer-events-none",style:{color:r.mutedTextColor}})]}),U.type==="textarea"&&W.jsx("textarea",{placeholder:U.placeholder||`Enter ${U.label.toLowerCase()}`,value:l[U.name]||"",onChange:I=>k(U.name,I.target.value),rows:2,className:xr("ringg_ai-w-full ringg_ai-px-3 ringg_ai-py-2 ringg_ai-text-xs ringg_ai-border ringg_ai-transition-colors ringg_ai-resize-none",A),style:{...M(j),"--tw-ring-color":r.primaryColor}}),U.type!=="select"&&U.type!=="textarea"&&W.jsx("input",{type:U.type,placeholder:U.placeholder||`Enter ${U.label.toLowerCase()}`,value:l[U.name]||"",onChange:I=>k(U.name,I.target.value),className:xr("ringg_ai-w-full ringg_ai-px-3 ringg_ai-py-2 ringg_ai-text-xs ringg_ai-border ringg_ai-transition-colors",A),style:{...M(j),"--tw-ring-color":r.primaryColor}}),j&&W.jsx("p",{className:"ringg_ai-text-xs ringg_ai-mt-0.5",style:{color:r.errorColor},children:h[U.name]})]},U.name)})}),W.jsx("button",{onClick:T,disabled:e,className:xr("ringg_ai-w-full ringg_ai-h-9 ringg_ai-text-sm ringg_ai-font-semibold ringg_ai-transition-all ringg_ai-duration-200","hover:ringg_ai-opacity-90 focus:ringg_ai-outline-none focus:ringg_ai-ring-2 focus:ringg_ai-ring-offset-2","disabled:ringg_ai-opacity-50 disabled:ringg_ai-cursor-not-allowed disabled:hover:ringg_ai-opacity-50"),style:{borderRadius:a,backgroundColor:e?r.borderColor:r.primaryColor,color:e?r.mutedTextColor:r.primaryTextColor,"--tw-ring-color":r.primaryColor},children:e?W.jsxs("span",{className:"ringg_ai-flex ringg_ai-items-center ringg_ai-justify-center ringg_ai-gap-2",children:[W.jsx(Gb,{className:"ringg_ai-w-4 ringg_ai-h-4 ringg_ai-animate-spin"}),"Submitting..."]}):s.submit_label||"Next"})]})},eK=({payload:t,isProcessing:e,onButtonClick:n})=>{const r=dS(),a=Fw(r.buttonStyle),{data:s}=t,[l,c]=G.useState(null),h=async v=>{if(v.action.type==="navigate"){n(v.id,v.action);return}c(v.id);try{await n(v.id,v.action)}finally{c(null)}},p=v=>{const b={borderRadius:a};switch(v){case"primary":return{...b,backgroundColor:r.primaryColor,color:r.primaryTextColor};case"secondary":return{...b,backgroundColor:r.surfaceColor,color:r.textColor,border:`1px solid ${r.borderColor}`};case"outline":return{...b,backgroundColor:"transparent",color:r.primaryColor,border:`2px solid ${r.primaryColor}`};case"destructive":return{...b,backgroundColor:r.errorColor,color:r.primaryTextColor};default:return{...b,backgroundColor:r.primaryColor,color:r.primaryTextColor}}};return W.jsxs("div",{children:[s.title&&W.jsx("p",{className:"ringg_ai-text-sm ringg_ai-font-medium ringg_ai-mb-3",style:{color:r.textColor},children:s.title}),W.jsx("div",{className:"ringg_ai-flex ringg_ai-flex-col ringg_ai-gap-2",children:s.buttons.map(v=>{const b=l===v.id||e&&l===v.id,k=v.action.type==="navigate",T=b||e;return W.jsx("button",{onClick:()=>h(v),disabled:T,className:xr("ringg_ai-w-full ringg_ai-h-9 ringg_ai-text-sm ringg_ai-font-semibold ringg_ai-transition-all ringg_ai-duration-200 ringg_ai-flex ringg_ai-items-center ringg_ai-justify-center ringg_ai-gap-2","hover:ringg_ai-opacity-90 focus:ringg_ai-outline-none focus:ringg_ai-ring-2 focus:ringg_ai-ring-offset-2",T&&"ringg_ai-opacity-50 ringg_ai-cursor-not-allowed hover:ringg_ai-opacity-50"),style:{...p(v.style),"--tw-ring-color":r.primaryColor},children:b?W.jsxs(W.Fragment,{children:[W.jsx(Gb,{className:"ringg_ai-w-4 ringg_ai-h-4 ringg_ai-animate-spin"}),"Loading..."]}):W.jsxs(W.Fragment,{children:[v.label,k&&W.jsx(tW,{className:"ringg_ai-w-3.5 ringg_ai-h-3.5"})]})},v.id)})})]})},a4=({data:t,collectedData:e})=>{const n=dS(),r=t.icon||"success",a=()=>{switch(r){case"success":return{icon:hw,bgColor:n.successColor};case"info":return{icon:nW,bgColor:n.primaryColor};case"warning":return{icon:oW,bgColor:"#f59e0b"};case"error":return{icon:eW,bgColor:n.errorColor};default:return{icon:hw,bgColor:n.successColor}}},{icon:s,bgColor:l}=a(),c=t.details||[],h=["slot_date","slot_time","name","email","phone"],p=e?Object.entries(e).filter(([k])=>h.includes(k)).sort((k,T)=>h.indexOf(k[0])-h.indexOf(T[0])).map(([k,T])=>({key:k,label:k.replace(/slot_/g,"").replace(/_/g," ").replace(/\b\w/g,E=>E.toUpperCase()),value:T})):[],v=c.length>0?c:p,b=k=>k?k.includes("date")?jI:k.includes("time")?zI:k.includes("email")?HI:k.includes("name")?sW:null:null;return W.jsxs(mu.div,{initial:{opacity:0},animate:{opacity:1},className:"ringg_ai-py-2",children:[W.jsxs("div",{className:"ringg_ai-flex ringg_ai-items-start ringg_ai-gap-3 ringg_ai-mb-4",children:[W.jsx(mu.div,{initial:{scale:0},animate:{scale:1},transition:{type:"spring",stiffness:400,damping:15},className:"ringg_ai-w-9 ringg_ai-h-9 ringg_ai-rounded-full ringg_ai-flex ringg_ai-items-center ringg_ai-justify-center ringg_ai-flex-shrink-0",style:{backgroundColor:l},children:W.jsx(s,{className:"ringg_ai-w-4.5 ringg_ai-h-4.5 ringg_ai-text-white"})}),W.jsxs(mu.div,{initial:{opacity:0,x:-8},animate:{opacity:1,x:0},transition:{delay:.1},className:"ringg_ai-flex-1 ringg_ai-min-w-0 ringg_ai-pt-0.5",children:[W.jsx("h3",{className:"ringg_ai-text-sm ringg_ai-font-semibold ringg_ai-leading-tight",style:{color:n.textColor},children:t.title}),t.message&&W.jsx("p",{className:"ringg_ai-text-xs ringg_ai-mt-1 ringg_ai-leading-relaxed",style:{color:n.mutedTextColor},children:t.message})]})]}),v.length>0&&W.jsx(mu.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:.15},className:"ringg_ai-rounded-lg ringg_ai-divide-y",style:{backgroundColor:n.surfaceColor,borderColor:n.borderColor},children:v.slice(0,4).map((k,T)=>{const E=k.key?b(k.key):null;return W.jsxs("div",{className:"ringg_ai-flex ringg_ai-items-center ringg_ai-gap-2.5 ringg_ai-px-3 ringg_ai-py-2.5",style:{borderColor:n.borderColor},children:[E&&W.jsx(E,{className:"ringg_ai-w-3.5 ringg_ai-h-3.5 ringg_ai-flex-shrink-0",style:{color:n.mutedTextColor}}),W.jsx("span",{className:"ringg_ai-text-xs ringg_ai-flex-shrink-0",style:{color:n.mutedTextColor},children:k.label}),W.jsx("span",{className:"ringg_ai-text-xs ringg_ai-font-medium ringg_ai-ml-auto ringg_ai-truncate",style:{color:n.textColor},title:k.value,children:k.value})]},T)})})]})};function tK(t){return t.component_type==="interactive_flow"}const nK=({initialComponent:t,onApiCall:e,onComplete:n,onSendResponse:r})=>{const a=tK(t),s=Zo(),l=G.useMemo(()=>{const X=t.theme||{};return Uw({primaryColor:s.primaryColor,primaryTextColor:s.primaryTextColor,backgroundColor:s.surfaceColor,surfaceColor:s.backgroundColor,textColor:s.textColor,mutedTextColor:s.mutedTextColor,borderColor:s.borderColor,...X})},[t.theme,s]),c=a?t.data.steps:[{id:"single",title:"",component:t}],h=c.length,[p,v]=G.useState(0),[b,k]=G.useState(!1),[T,E]=G.useState({}),[R,M]=G.useState(null),[A,U]=G.useState(new Array(h).fill(!1)),V=c[p],j=h>1,I=G.useCallback(()=>{p>0&&v(X=>X-1)},[p]),N=G.useCallback(async X=>{k(!0);const se={...T,...X};E(se),U($=>{const oe=[...$];return oe[p]=!0,oe});try{const $=p===h-1;if(r)await r(t.component_id,{step_index:p,step_data:X,all_data:se,is_final_step:$}),$?(M({title:"Success!",message:"Your selection has been submitted.",icon:"success"}),n==null||n(se)):v(oe=>oe+1);else if($)if(a){const{on_complete:oe}=t.data,J=Iw(oe.payload,{...se,all_data:JSON.stringify(se)}),xe=await e(oe.method,oe.endpoint,J);if(xe.success)M(xe.confirmation||{title:"Success!",message:xe.message,icon:"success"}),n==null||n(se);else throw new Error(xe.message||"Failed to complete")}else{const oe=V.component;let J=null;if(n4(oe)){const xe=Iw(oe.actions.on_select.payload,{...se,selected_slot_id:X.slot_id||""});J=await e(oe.actions.on_select.method,oe.actions.on_select.endpoint,xe)}else if(r4(oe)){const xe=Iw(oe.actions.on_submit.payload,{...se,user_input:JSON.stringify(X),form_data:JSON.stringify(X)});J=await e(oe.actions.on_submit.method,oe.actions.on_submit.endpoint,xe)}if(J!=null&&J.success)M(J.confirmation||{title:"Success!",message:J.message,icon:"success"}),n==null||n(se);else if(J)throw new Error(J.message||"Failed")}else v(oe=>oe+1)}catch($){console.error("Error processing step:",$),M({title:"Something went wrong",message:$.message||"Please try again.",icon:"error"})}finally{k(!1)}},[T,p,h,a,t,V,e,n,r]),ne=G.useCallback(async(X,se)=>{if(se.type==="navigate"&&se.url){window.open(se.url,"_blank","noopener,noreferrer");return}if(r){N({selected_button:X});return}if(se.type==="api_call"&&se.endpoint){k(!0);try{(await e(se.method||"POST",se.endpoint,se.payload||{})).success&&N({selected_button:X})}catch($){console.error("Error in button action:",$)}finally{k(!1)}}else N({selected_button:X})},[e,N,r]);return W.jsx(i4.Provider,{value:l,children:W.jsxs(mu.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"ringg_ai-w-full ringg_ai-rounded-xl ringg_ai-overflow-hidden",style:{backgroundColor:l.backgroundColor,color:l.textColor,fontFamily:l.fontFamily,fontSize:l.fontSize,borderRadius:l.borderRadius},children:[j&&!R&&W.jsxs("div",{className:"ringg_ai-px-4 ringg_ai-pt-4 ringg_ai-pb-3",children:[W.jsx("div",{className:"ringg_ai-flex ringg_ai-items-center ringg_ai-gap-2",children:c.map((X,se)=>W.jsxs("div",{className:"ringg_ai-flex ringg_ai-items-center ringg_ai-gap-2 ringg_ai-flex-1 ringg_ai-min-w-0",children:[W.jsx("div",{className:"ringg_ai-w-7 ringg_ai-h-7 ringg_ai-rounded-full ringg_ai-text-xs ringg_ai-font-semibold ringg_ai-flex ringg_ai-items-center ringg_ai-justify-center ringg_ai-flex-shrink-0 ringg_ai-transition-all",style:{backgroundColor:A[se]?l.successColor:se===p?l.primaryColor:l.borderColor,color:A[se]||se===p?l.primaryTextColor:l.mutedTextColor},children:A[se]?W.jsx(hw,{className:"ringg_ai-w-3.5 ringg_ai-h-3.5"}):se+1}),se<c.length-1&&W.jsx("div",{className:"ringg_ai-flex-1 ringg_ai-h-[2px] ringg_ai-rounded-full ringg_ai-transition-all",style:{backgroundColor:A[se]?l.successColor:l.borderColor}})]},X.id))}),W.jsx("p",{className:"ringg_ai-text-xs ringg_ai-font-medium ringg_ai-mt-3 ringg_ai-truncate",style:{color:l.textColor},children:V.title||`Step ${p+1} of ${h}`})]}),W.jsxs("div",{className:xr("ringg_ai-px-4 ringg_ai-pb-4",!j&&"ringg_ai-pt-4"),children:[p>0&&!R&&W.jsxs("button",{onClick:I,className:"ringg_ai-flex ringg_ai-items-center ringg_ai-gap-1 ringg_ai-text-xs ringg_ai-mb-3 ringg_ai-transition-colors hover:ringg_ai-opacity-80",style:{color:l.mutedTextColor},children:[W.jsx(Jq,{className:"ringg_ai-w-3.5 ringg_ai-h-3.5"}),"Back"]}),W.jsx(sx,{mode:"wait",children:R?W.jsx(a4,{data:R,collectedData:T},"confirmation"):W.jsxs(mu.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},transition:{duration:.2},children:[n4(V.component)&&W.jsx(QY,{payload:V.component,isProcessing:b,onComplete:(X,se)=>N({slot_id:X,slot_datetime:se,slot_time:t4(se),slot_date:GY(se)})}),r4(V.component)&&W.jsx(JY,{payload:V.component,isProcessing:b,onComplete:X=>N(X)}),YY(V.component)&&W.jsx(eK,{payload:V.component,isProcessing:b,onButtonClick:ne}),KY(V.component)&&W.jsx(a4,{data:V.component.data})]},p)})]})]})})};function zse(){}function Bse(){}function rK(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const iK=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,aK=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,oK={};function o4(t,e){return(oK.jsx?aK:iK).test(t)}const sK=/[ \t\n\f\r]/g;function lK(t){return typeof t=="object"?t.type==="text"?s4(t.value):!1:s4(t)}function s4(t){return t.replace(sK,"")===""}class kv{constructor(e,n,r){this.property=e,this.normal=n,r&&(this.space=r)}}kv.prototype.property={},kv.prototype.normal={},kv.prototype.space=null;function l4(t,e){const n={},r={};let a=-1;for(;++a<t.length;)Object.assign(n,t[a].property),Object.assign(r,t[a].normal);return new kv(n,r,e)}function jw(t){return t.toLowerCase()}class Xo{constructor(e,n){this.property=e,this.attribute=n}}Xo.prototype.space=null,Xo.prototype.boolean=!1,Xo.prototype.booleanish=!1,Xo.prototype.overloadedBoolean=!1,Xo.prototype.number=!1,Xo.prototype.commaSeparated=!1,Xo.prototype.spaceSeparated=!1,Xo.prototype.commaOrSpaceSeparated=!1,Xo.prototype.mustUseProperty=!1,Xo.prototype.defined=!1;let uK=0;const hn=ff(),vi=ff(),u4=ff(),Ye=ff(),wr=ff(),yp=ff(),Oo=ff();function ff(){return 2**++uK}const Vw=Object.freeze(Object.defineProperty({__proto__:null,boolean:hn,booleanish:vi,commaOrSpaceSeparated:Oo,commaSeparated:yp,number:Ye,overloadedBoolean:u4,spaceSeparated:wr},Symbol.toStringTag,{value:"Module"})),zw=Object.keys(Vw);class Bw extends Xo{constructor(e,n,r,a){let s=-1;if(super(e,n),c4(this,"space",a),typeof r=="number")for(;++s<zw.length;){const l=zw[s];c4(this,zw[s],(r&Vw[l])===Vw[l])}}}Bw.prototype.defined=!0;function c4(t,e,n){n&&(t[e]=n)}const cK={}.hasOwnProperty;function bp(t){const e={},n={};let r;for(r in t.properties)if(cK.call(t.properties,r)){const a=t.properties[r],s=new Bw(r,t.transform(t.attributes||{},r),a,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),e[r]=s,n[jw(r)]=r,n[jw(s.attribute)]=r}return new kv(e,n,t.space)}const d4=bp({space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()},properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}}),f4=bp({space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()},properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function h4(t,e){return e in t?t[e]:e}function p4(t,e){return h4(t,e.toLowerCase())}const m4=bp({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:p4,properties:{xmlns:null,xmlnsXLink:null}}),g4=bp({transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()},properties:{ariaActiveDescendant:null,ariaAtomic:vi,ariaAutoComplete:null,ariaBusy:vi,ariaChecked:vi,ariaColCount:Ye,ariaColIndex:Ye,ariaColSpan:Ye,ariaControls:wr,ariaCurrent:null,ariaDescribedBy:wr,ariaDetails:null,ariaDisabled:vi,ariaDropEffect:wr,ariaErrorMessage:null,ariaExpanded:vi,ariaFlowTo:wr,ariaGrabbed:vi,ariaHasPopup:null,ariaHidden:vi,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:wr,ariaLevel:Ye,ariaLive:null,ariaModal:vi,ariaMultiLine:vi,ariaMultiSelectable:vi,ariaOrientation:null,ariaOwns:wr,ariaPlaceholder:null,ariaPosInSet:Ye,ariaPressed:vi,ariaReadOnly:vi,ariaRelevant:null,ariaRequired:vi,ariaRoleDescription:wr,ariaRowCount:Ye,ariaRowIndex:Ye,ariaRowSpan:Ye,ariaSelected:vi,ariaSetSize:Ye,ariaSort:null,ariaValueMax:Ye,ariaValueMin:Ye,ariaValueNow:Ye,ariaValueText:null,role:null}}),dK=bp({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:p4,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:yp,acceptCharset:wr,accessKey:wr,action:null,allow:null,allowFullScreen:hn,allowPaymentRequest:hn,allowUserMedia:hn,alt:null,as:null,async:hn,autoCapitalize:null,autoComplete:wr,autoFocus:hn,autoPlay:hn,blocking:wr,capture:null,charSet:null,checked:hn,cite:null,className:wr,cols:Ye,colSpan:null,content:null,contentEditable:vi,controls:hn,controlsList:wr,coords:Ye|yp,crossOrigin:null,data:null,dateTime:null,decoding:null,default:hn,defer:hn,dir:null,dirName:null,disabled:hn,download:u4,draggable:vi,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:hn,formTarget:null,headers:wr,height:Ye,hidden:hn,high:Ye,href:null,hrefLang:null,htmlFor:wr,httpEquiv:wr,id:null,imageSizes:null,imageSrcSet:null,inert:hn,inputMode:null,integrity:null,is:null,isMap:hn,itemId:null,itemProp:wr,itemRef:wr,itemScope:hn,itemType:wr,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:hn,low:Ye,manifest:null,max:null,maxLength:Ye,media:null,method:null,min:null,minLength:Ye,multiple:hn,muted:hn,name:null,nonce:null,noModule:hn,noValidate:hn,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:hn,optimum:Ye,pattern:null,ping:wr,placeholder:null,playsInline:hn,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:hn,referrerPolicy:null,rel:wr,required:hn,reversed:hn,rows:Ye,rowSpan:Ye,sandbox:wr,scope:null,scoped:hn,seamless:hn,selected:hn,shadowRootClonable:hn,shadowRootDelegatesFocus:hn,shadowRootMode:null,shape:null,size:Ye,sizes:null,slot:null,span:Ye,spellCheck:vi,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ye,step:null,style:null,tabIndex:Ye,target:null,title:null,translate:null,type:null,typeMustMatch:hn,useMap:null,value:vi,width:Ye,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:wr,axis:null,background:null,bgColor:null,border:Ye,borderColor:null,bottomMargin:Ye,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:hn,declare:hn,event:null,face:null,frame:null,frameBorder:null,hSpace:Ye,leftMargin:Ye,link:null,longDesc:null,lowSrc:null,marginHeight:Ye,marginWidth:Ye,noResize:hn,noHref:hn,noShade:hn,noWrap:hn,object:null,profile:null,prompt:null,rev:null,rightMargin:Ye,rules:null,scheme:null,scrolling:vi,standby:null,summary:null,text:null,topMargin:Ye,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ye,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:hn,disableRemotePlayback:hn,prefix:null,property:null,results:Ye,security:null,unselectable:null}}),fK=bp({space:"svg",attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},transform:h4,properties:{about:Oo,accentHeight:Ye,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ye,amplitude:Ye,arabicForm:null,ascent:Ye,attributeName:null,attributeType:null,azimuth:Ye,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ye,by:null,calcMode:null,capHeight:Ye,className:wr,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Ye,diffuseConstant:Ye,direction:null,display:null,dur:null,divisor:Ye,dominantBaseline:null,download:hn,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ye,enableBackground:null,end:null,event:null,exponent:Ye,externalResourcesRequired:null,fill:null,fillOpacity:Ye,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:yp,g2:yp,glyphName:yp,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ye,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ye,horizOriginX:Ye,horizOriginY:Ye,id:null,ideographic:Ye,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ye,k:Ye,k1:Ye,k2:Ye,k3:Ye,k4:Ye,kernelMatrix:Oo,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ye,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Ye,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Ye,overlineThickness:Ye,paintOrder:null,panose1:null,path:null,pathLength:Ye,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:wr,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ye,pointsAtY:Ye,pointsAtZ:Ye,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Oo,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Oo,rev:Oo,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Oo,requiredFeatures:Oo,requiredFonts:Oo,requiredFormats:Oo,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Ye,specularExponent:Ye,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ye,strikethroughThickness:Ye,string:null,stroke:null,strokeDashArray:Oo,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ye,strokeOpacity:Ye,strokeWidth:null,style:null,surfaceScale:Ye,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Oo,tabIndex:Ye,tableValues:null,target:null,targetX:Ye,targetY:Ye,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Oo,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ye,underlineThickness:Ye,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ye,values:null,vAlphabetic:Ye,vMathematical:Ye,vectorEffect:null,vHanging:Ye,vIdeographic:Ye,version:null,vertAdvY:Ye,vertOriginX:Ye,vertOriginY:Ye,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ye,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null}}),hK=/^data[-\w.:]+$/i,v4=/-[a-z]/g,pK=/[A-Z]/g;function mK(t,e){const n=jw(e);let r=e,a=Xo;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&hK.test(e)){if(e.charAt(4)==="-"){const s=e.slice(5).replace(v4,vK);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=e.slice(4);if(!v4.test(s)){let l=s.replace(pK,gK);l.charAt(0)!=="-"&&(l="-"+l),e="data"+l}}a=Bw}return new a(r,e)}function gK(t){return"-"+t.toLowerCase()}function vK(t){return t.charAt(1).toUpperCase()}const yK={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},bK=l4([f4,d4,m4,g4,dK],"html"),Hw=l4([f4,d4,m4,g4,fK],"svg");function SK(t){return t.join(" ").trim()}var y4={},b4=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,CK=/\n/g,kK=/^\s*/,TK=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,xK=/^:\s*/,wK=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,_K=/^[;\s]*/,EK=/^\s+|\s+$/g,RK=`
|
|
399
399
|
`,S4="/",C4="*",hf="",PK="comment",DK="declaration",AK=function(t,e){if(typeof t!="string")throw new TypeError("First argument must be a string");if(!t)return[];e=e||{};var n=1,r=1;function a(E){var R=E.match(CK);R&&(n+=R.length);var M=E.lastIndexOf(RK);r=~M?E.length-M:r+E.length}function s(){var E={line:n,column:r};return function(R){return R.position=new l(E),p(),R}}function l(E){this.start=E,this.end={line:n,column:r},this.source=e.source}l.prototype.content=t;function c(E){var R=new Error(e.source+":"+n+":"+r+": "+E);if(R.reason=E,R.filename=e.source,R.line=n,R.column=r,R.source=t,!e.silent)throw R}function h(E){var R=E.exec(t);if(R){var M=R[0];return a(M),t=t.slice(M.length),R}}function p(){h(kK)}function v(E){var R;for(E=E||[];R=b();)R!==!1&&E.push(R);return E}function b(){var E=s();if(!(S4!=t.charAt(0)||C4!=t.charAt(1))){for(var R=2;hf!=t.charAt(R)&&(C4!=t.charAt(R)||S4!=t.charAt(R+1));)++R;if(R+=2,hf===t.charAt(R-1))return c("End of comment missing");var M=t.slice(2,R-2);return r+=2,a(M),t=t.slice(R),r+=2,E({type:PK,comment:M})}}function k(){var E=s(),R=h(TK);if(R){if(b(),!h(xK))return c("property missing ':'");var M=h(wK),A=E({type:DK,property:k4(R[0].replace(b4,hf)),value:M?k4(M[0].replace(b4,hf)):hf});return h(_K),A}}function T(){var E=[];v(E);for(var R;R=k();)R!==!1&&(E.push(R),v(E));return E}return p(),T()};function k4(t){return t?t.replace(EK,hf):hf}var OK=pg&&pg.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(y4,"__esModule",{value:!0});var T4=y4.default=LK,MK=OK(AK);function LK(t,e){var n=null;if(!t||typeof t!="string")return n;var r=(0,MK.default)(t),a=typeof e=="function";return r.forEach(function(s){if(s.type==="declaration"){var l=s.property,c=s.value;a?e(l,c,s):c&&(n=n||{},n[l]=c)}}),n}const NK=T4.default||T4,x4=w4("end"),$w=w4("start");function w4(t){return e;function e(n){const r=n&&n.position&&n.position[t]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function IK(t){const e=$w(t),n=x4(t);if(e&&n)return{start:e,end:n}}function Tv(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?_4(t.position):"start"in t||"end"in t?_4(t):"line"in t||"column"in t?qw(t):""}function qw(t){return E4(t&&t.line)+":"+E4(t&&t.column)}function _4(t){return qw(t&&t.start)+"-"+qw(t&&t.end)}function E4(t){return t&&typeof t=="number"?t:1}class ba extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let a="",s={},l=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof e=="string"?a=e:!s.cause&&e&&(l=!0,a=e.message,s.cause=e),!s.ruleId&&!s.source&&typeof r=="string"){const h=r.indexOf(":");h===-1?s.ruleId=r:(s.source=r.slice(0,h),s.ruleId=r.slice(h+1))}if(!s.place&&s.ancestors&&s.ancestors){const h=s.ancestors[s.ancestors.length-1];h&&(s.place=h.position)}const c=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=c?c.column:void 0,this.fatal=void 0,this.file,this.message=a,this.line=c?c.line:void 0,this.name=Tv(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=l&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual,this.expected,this.note,this.url}}ba.prototype.file="",ba.prototype.name="",ba.prototype.reason="",ba.prototype.message="",ba.prototype.stack="",ba.prototype.column=void 0,ba.prototype.line=void 0,ba.prototype.ancestors=void 0,ba.prototype.cause=void 0,ba.prototype.fatal=void 0,ba.prototype.place=void 0,ba.prototype.ruleId=void 0,ba.prototype.source=void 0;const Ww={}.hasOwnProperty,UK=new Map,FK=/[A-Z]/g,jK=/-([a-z])/g,VK=new Set(["table","tbody","thead","tfoot","tr"]),zK=new Set(["td","th"]),R4="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function BK(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let r;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=ZK(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=KK(n,e.jsx,e.jsxs)}const a={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:r,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?Hw:bK,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=P4(a,t,void 0);return s&&typeof s!="string"?s:a.create(t,a.Fragment,{children:s||void 0},void 0)}function P4(t,e,n){if(e.type==="element")return HK(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return $K(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return WK(t,e,n);if(e.type==="mdxjsEsm")return qK(t,e);if(e.type==="root")return GK(t,e,n);if(e.type==="text")return YK(t,e)}function HK(t,e,n){const r=t.schema;let a=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(a=Hw,t.schema=a),t.ancestors.push(e);const s=A4(t,e.tagName,!1),l=QK(t,e);let c=Yw(t,e);return VK.has(e.tagName)&&(c=c.filter(function(h){return typeof h=="string"?!lK(h):!0})),D4(t,l,s,e),Gw(l,c),t.ancestors.pop(),t.schema=r,t.create(e,s,l,n)}function $K(t,e){if(e.data&&e.data.estree&&t.evaluater){const r=e.data.estree.body[0];return r.type,t.evaluater.evaluateExpression(r.expression)}xv(t,e.position)}function qK(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);xv(t,e.position)}function WK(t,e,n){const r=t.schema;let a=r;e.name==="svg"&&r.space==="html"&&(a=Hw,t.schema=a),t.ancestors.push(e);const s=e.name===null?t.Fragment:A4(t,e.name,!0),l=XK(t,e),c=Yw(t,e);return D4(t,l,s,e),Gw(l,c),t.ancestors.pop(),t.schema=r,t.create(e,s,l,n)}function GK(t,e,n){const r={};return Gw(r,Yw(t,e)),t.create(e,t.Fragment,r,n)}function YK(t,e){return e.value}function D4(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function Gw(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function KK(t,e,n){return r;function r(a,s,l,c){const p=Array.isArray(l.children)?n:e;return c?p(s,l,c):p(s,l)}}function ZK(t,e){return n;function n(r,a,s,l){const c=Array.isArray(s.children),h=$w(r);return e(a,s,l,c,{columnNumber:h?h.column-1:void 0,fileName:t,lineNumber:h?h.line:void 0},void 0)}}function QK(t,e){const n={};let r,a;for(a in e.properties)if(a!=="children"&&Ww.call(e.properties,a)){const s=JK(t,a,e.properties[a]);if(s){const[l,c]=s;t.tableCellAlignToStyle&&l==="align"&&typeof c=="string"&&zK.has(e.tagName)?r=c:n[l]=c}}if(r){const s=n.style||(n.style={});s[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function XK(t,e){const n={};for(const r of e.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&t.evaluater){const s=r.data.estree.body[0];s.type;const l=s.expression;l.type;const c=l.properties[0];c.type,Object.assign(n,t.evaluater.evaluateExpression(c.argument))}else xv(t,e.position);else{const a=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&t.evaluater){const c=r.value.data.estree.body[0];c.type,s=t.evaluater.evaluateExpression(c.expression)}else xv(t,e.position);else s=r.value===null?!0:r.value;n[a]=s}return n}function Yw(t,e){const n=[];let r=-1;const a=t.passKeys?new Map:UK;for(;++r<e.children.length;){const s=e.children[r];let l;if(t.passKeys){const h=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(h){const p=a.get(h)||0;l=h+"-"+p,a.set(h,p+1)}}const c=P4(t,s,l);c!==void 0&&n.push(c)}return n}function JK(t,e,n){const r=mK(t.schema,e);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?rK(n):SK(n)),r.property==="style"){let a=typeof n=="object"?n:eZ(t,String(n));return t.stylePropertyNameCase==="css"&&(a=tZ(a)),["style",a]}return[t.elementAttributeNameCase==="react"&&r.space?yK[r.property]||r.property:r.attribute,n]}}function eZ(t,e){const n={};try{NK(e,r)}catch(a){if(!t.ignoreInvalidStyle){const s=a,l=new ba("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw l.file=t.filePath||void 0,l.url=R4+"#cannot-parse-style-attribute",l}}return n;function r(a,s){let l=a;l.slice(0,2)!=="--"&&(l.slice(0,4)==="-ms-"&&(l="ms-"+l.slice(4)),l=l.replace(jK,rZ)),n[l]=s}}function A4(t,e,n){let r;if(!n)r={type:"Literal",value:e};else if(e.includes(".")){const a=e.split(".");let s=-1,l;for(;++s<a.length;){const c=o4(a[s])?{type:"Identifier",name:a[s]}:{type:"Literal",value:a[s]};l=l?{type:"MemberExpression",object:l,property:c,computed:!!(s&&c.type==="Literal"),optional:!1}:c}r=l}else r=o4(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(r.type==="Literal"){const a=r.value;return Ww.call(t.components,a)?t.components[a]:a}if(t.evaluater)return t.evaluater.evaluateExpression(r);xv(t)}function xv(t,e){const n=new ba("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:e,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=t.filePath||void 0,n.url=R4+"#cannot-handle-mdx-estrees-without-createevaluater",n}function tZ(t){const e={};let n;for(n in t)Ww.call(t,n)&&(e[nZ(n)]=t[n]);return e}function nZ(t){let e=t.replace(FK,iZ);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function rZ(t,e){return e.toUpperCase()}function iZ(t){return"-"+t.toLowerCase()}const Kw={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},aZ={};function Zw(t,e){const n=aZ,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return O4(t,r,a)}function O4(t,e,n){if(oZ(t)){if("value"in t)return t.type==="html"&&!n?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return M4(t.children,e,n)}return Array.isArray(t)?M4(t,e,n):""}function M4(t,e,n){const r=[];let a=-1;for(;++a<t.length;)r[a]=O4(t[a],e,n);return r.join("")}function oZ(t){return!!(t&&typeof t=="object")}const L4=document.createElement("i");function Qw(t){const e="&"+t+";";L4.innerHTML=e;const n=L4.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}function Mo(t,e,n,r){const a=t.length;let s=0,l;if(e<0?e=-e>a?0:a+e:e=e>a?a:e,n=n>0?n:0,r.length<1e4)l=Array.from(r),l.unshift(e,n),t.splice(...l);else for(n&&t.splice(e,n);s<r.length;)l=r.slice(s,s+1e4),l.unshift(e,0),t.splice(...l),s+=1e4,e+=1e4}function Jo(t,e){return t.length>0?(Mo(t,t.length,0,e),t):e}const N4={}.hasOwnProperty;function I4(t){const e={};let n=-1;for(;++n<t.length;)sZ(e,t[n]);return e}function sZ(t,e){let n;for(n in e){const a=(N4.call(t,n)?t[n]:void 0)||(t[n]={}),s=e[n];let l;if(s)for(l in s){N4.call(a,l)||(a[l]=[]);const c=s[l];lZ(a[l],Array.isArray(c)?c:c?[c]:[])}}}function lZ(t,e){let n=-1;const r=[];for(;++n<e.length;)(e[n].add==="after"?t:r).push(e[n]);Mo(t,0,0,r)}function U4(t,e){const n=Number.parseInt(t,e);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Ns(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const za=Vc(/[A-Za-z]/),Sa=Vc(/[\dA-Za-z]/),uZ=Vc(/[#-'*+\--9=?A-Z^-~]/);function fS(t){return t!==null&&(t<32||t===127)}const Xw=Vc(/\d/),cZ=Vc(/[\dA-Fa-f]/),dZ=Vc(/[!-/:-@[-`{-~]/);function Bt(t){return t!==null&&t<-2}function Sr(t){return t!==null&&(t<0||t===32)}function Pn(t){return t===-2||t===-1||t===32}const hS=Vc(new RegExp("\\p{P}|\\p{S}","u")),pf=Vc(/\s/);function Vc(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function Sp(t){const e=[];let n=-1,r=0,a=0;for(;++n<t.length;){const s=t.charCodeAt(n);let l="";if(s===37&&Sa(t.charCodeAt(n+1))&&Sa(t.charCodeAt(n+2)))a=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(l=String.fromCharCode(s));else if(s>55295&&s<57344){const c=t.charCodeAt(n+1);s<56320&&c>56319&&c<57344?(l=String.fromCharCode(s,c),a=1):l="�"}else l=String.fromCharCode(s);l&&(e.push(t.slice(r,n),encodeURIComponent(l)),r=n+a+1,l=""),a&&(n+=a,a=0)}return e.join("")+t.slice(r)}function Vn(t,e,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let s=0;return l;function l(h){return Pn(h)?(t.enter(n),c(h)):e(h)}function c(h){return Pn(h)&&s++<a?(t.consume(h),c):(t.exit(n),e(h))}}const fZ={tokenize:hZ};function hZ(t){const e=t.attempt(this.parser.constructs.contentInitial,r,a);let n;return e;function r(c){if(c===null){t.consume(c);return}return t.enter("lineEnding"),t.consume(c),t.exit("lineEnding"),Vn(t,e,"linePrefix")}function a(c){return t.enter("paragraph"),s(c)}function s(c){const h=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=h),n=h,l(c)}function l(c){if(c===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(c);return}return Bt(c)?(t.consume(c),t.exit("chunkText"),s):(t.consume(c),l)}}const pZ={tokenize:mZ},F4={tokenize:gZ};function mZ(t){const e=this,n=[];let r=0,a,s,l;return c;function c(V){if(r<n.length){const j=n[r];return e.containerState=j[1],t.attempt(j[0].continuation,h,p)(V)}return p(V)}function h(V){if(r++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,a&&U();const j=e.events.length;let I=j,N;for(;I--;)if(e.events[I][0]==="exit"&&e.events[I][1].type==="chunkFlow"){N=e.events[I][1].end;break}A(r);let ne=j;for(;ne<e.events.length;)e.events[ne][1].end={...N},ne++;return Mo(e.events,I+1,0,e.events.slice(j)),e.events.length=ne,p(V)}return c(V)}function p(V){if(r===n.length){if(!a)return k(V);if(a.currentConstruct&&a.currentConstruct.concrete)return E(V);e.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(F4,v,b)(V)}function v(V){return a&&U(),A(r),k(V)}function b(V){return e.parser.lazy[e.now().line]=r!==n.length,l=e.now().offset,E(V)}function k(V){return e.containerState={},t.attempt(F4,T,E)(V)}function T(V){return r++,n.push([e.currentConstruct,e.containerState]),k(V)}function E(V){if(V===null){a&&U(),A(0),t.consume(V);return}return a=a||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:s}),R(V)}function R(V){if(V===null){M(t.exit("chunkFlow"),!0),A(0),t.consume(V);return}return Bt(V)?(t.consume(V),M(t.exit("chunkFlow")),r=0,e.interrupt=void 0,c):(t.consume(V),R)}function M(V,j){const I=e.sliceStream(V);if(j&&I.push(null),V.previous=s,s&&(s.next=V),s=V,a.defineSkip(V.start),a.write(I),e.parser.lazy[V.start.line]){let N=a.events.length;for(;N--;)if(a.events[N][1].start.offset<l&&(!a.events[N][1].end||a.events[N][1].end.offset>l))return;const ne=e.events.length;let X=ne,se,$;for(;X--;)if(e.events[X][0]==="exit"&&e.events[X][1].type==="chunkFlow"){if(se){$=e.events[X][1].end;break}se=!0}for(A(r),N=ne;N<e.events.length;)e.events[N][1].end={...$},N++;Mo(e.events,X+1,0,e.events.slice(ne)),e.events.length=N}}function A(V){let j=n.length;for(;j-- >V;){const I=n[j];e.containerState=I[1],I[0].exit.call(e,t)}n.length=V}function U(){a.write([null]),s=void 0,a=void 0,e.containerState._closeFlow=void 0}}function gZ(t,e,n){return Vn(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Cp(t){if(t===null||Sr(t)||pf(t))return 1;if(hS(t))return 2}function pS(t,e,n){const r=[];let a=-1;for(;++a<t.length;){const s=t[a].resolveAll;s&&!r.includes(s)&&(e=s(e,n),r.push(s))}return e}const Jw={name:"attention",resolveAll:vZ,tokenize:yZ};function vZ(t,e){let n=-1,r,a,s,l,c,h,p,v;for(;++n<t.length;)if(t[n][0]==="enter"&&t[n][1].type==="attentionSequence"&&t[n][1]._close){for(r=n;r--;)if(t[r][0]==="exit"&&t[r][1].type==="attentionSequence"&&t[r][1]._open&&e.sliceSerialize(t[r][1]).charCodeAt(0)===e.sliceSerialize(t[n][1]).charCodeAt(0)){if((t[r][1]._close||t[n][1]._open)&&(t[n][1].end.offset-t[n][1].start.offset)%3&&!((t[r][1].end.offset-t[r][1].start.offset+t[n][1].end.offset-t[n][1].start.offset)%3))continue;h=t[r][1].end.offset-t[r][1].start.offset>1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const b={...t[r][1].end},k={...t[n][1].start};j4(b,-h),j4(k,h),l={type:h>1?"strongSequence":"emphasisSequence",start:b,end:{...t[r][1].end}},c={type:h>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:k},s={type:h>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},a={type:h>1?"strong":"emphasis",start:{...l.start},end:{...c.end}},t[r][1].end={...l.start},t[n][1].start={...c.end},p=[],t[r][1].end.offset-t[r][1].start.offset&&(p=Jo(p,[["enter",t[r][1],e],["exit",t[r][1],e]])),p=Jo(p,[["enter",a,e],["enter",l,e],["exit",l,e],["enter",s,e]]),p=Jo(p,pS(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),p=Jo(p,[["exit",s,e],["enter",c,e],["exit",c,e],["exit",a,e]]),t[n][1].end.offset-t[n][1].start.offset?(v=2,p=Jo(p,[["enter",t[n][1],e],["exit",t[n][1],e]])):v=0,Mo(t,r-1,n-r+3,p),n=r+p.length-v-2;break}}for(n=-1;++n<t.length;)t[n][1].type==="attentionSequence"&&(t[n][1].type="data");return t}function yZ(t,e){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=Cp(r);let s;return l;function l(h){return s=h,t.enter("attentionSequence"),c(h)}function c(h){if(h===s)return t.consume(h),c;const p=t.exit("attentionSequence"),v=Cp(h),b=!v||v===2&&a||n.includes(h),k=!a||a===2&&v||n.includes(r);return p._open=!!(s===42?b:b&&(a||!k)),p._close=!!(s===42?k:k&&(v||!b)),e(h)}}function j4(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const bZ={name:"autolink",tokenize:SZ};function SZ(t,e,n){let r=0;return a;function a(T){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(T),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),s}function s(T){return za(T)?(t.consume(T),l):T===64?n(T):p(T)}function l(T){return T===43||T===45||T===46||Sa(T)?(r=1,c(T)):p(T)}function c(T){return T===58?(t.consume(T),r=0,h):(T===43||T===45||T===46||Sa(T))&&r++<32?(t.consume(T),c):(r=0,p(T))}function h(T){return T===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(T),t.exit("autolinkMarker"),t.exit("autolink"),e):T===null||T===32||T===60||fS(T)?n(T):(t.consume(T),h)}function p(T){return T===64?(t.consume(T),v):uZ(T)?(t.consume(T),p):n(T)}function v(T){return Sa(T)?b(T):n(T)}function b(T){return T===46?(t.consume(T),r=0,v):T===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(T),t.exit("autolinkMarker"),t.exit("autolink"),e):k(T)}function k(T){if((T===45||Sa(T))&&r++<63){const E=T===45?k:b;return t.consume(T),E}return n(T)}}const wv={partial:!0,tokenize:CZ};function CZ(t,e,n){return r;function r(s){return Pn(s)?Vn(t,a,"linePrefix")(s):a(s)}function a(s){return s===null||Bt(s)?e(s):n(s)}}const V4={continuation:{tokenize:TZ},exit:xZ,name:"blockQuote",tokenize:kZ};function kZ(t,e,n){const r=this;return a;function a(l){if(l===62){const c=r.containerState;return c.open||(t.enter("blockQuote",{_container:!0}),c.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(l),t.exit("blockQuoteMarker"),s}return n(l)}function s(l){return Pn(l)?(t.enter("blockQuotePrefixWhitespace"),t.consume(l),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(l))}}function TZ(t,e,n){const r=this;return a;function a(l){return Pn(l)?Vn(t,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):s(l)}function s(l){return t.attempt(V4,e,n)(l)}}function xZ(t){t.exit("blockQuote")}const z4={name:"characterEscape",tokenize:wZ};function wZ(t,e,n){return r;function r(s){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(s),t.exit("escapeMarker"),a}function a(s){return dZ(s)?(t.enter("characterEscapeValue"),t.consume(s),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(s)}}const B4={name:"characterReference",tokenize:_Z};function _Z(t,e,n){const r=this;let a=0,s,l;return c;function c(b){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(b),t.exit("characterReferenceMarker"),h}function h(b){return b===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(b),t.exit("characterReferenceMarkerNumeric"),p):(t.enter("characterReferenceValue"),s=31,l=Sa,v(b))}function p(b){return b===88||b===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(b),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),s=6,l=cZ,v):(t.enter("characterReferenceValue"),s=7,l=Xw,v(b))}function v(b){if(b===59&&a){const k=t.exit("characterReferenceValue");return l===Sa&&!Qw(r.sliceSerialize(k))?n(b):(t.enter("characterReferenceMarker"),t.consume(b),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return l(b)&&a++<s?(t.consume(b),v):n(b)}}const H4={partial:!0,tokenize:RZ},$4={concrete:!0,name:"codeFenced",tokenize:EZ};function EZ(t,e,n){const r=this,a={partial:!0,tokenize:I};let s=0,l=0,c;return h;function h(N){return p(N)}function p(N){const ne=r.events[r.events.length-1];return s=ne&&ne[1].type==="linePrefix"?ne[2].sliceSerialize(ne[1],!0).length:0,c=N,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),v(N)}function v(N){return N===c?(l++,t.consume(N),v):l<3?n(N):(t.exit("codeFencedFenceSequence"),Pn(N)?Vn(t,b,"whitespace")(N):b(N))}function b(N){return N===null||Bt(N)?(t.exit("codeFencedFence"),r.interrupt?e(N):t.check(H4,R,j)(N)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),k(N))}function k(N){return N===null||Bt(N)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),b(N)):Pn(N)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),Vn(t,T,"whitespace")(N)):N===96&&N===c?n(N):(t.consume(N),k)}function T(N){return N===null||Bt(N)?b(N):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),E(N))}function E(N){return N===null||Bt(N)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),b(N)):N===96&&N===c?n(N):(t.consume(N),E)}function R(N){return t.attempt(a,j,M)(N)}function M(N){return t.enter("lineEnding"),t.consume(N),t.exit("lineEnding"),A}function A(N){return s>0&&Pn(N)?Vn(t,U,"linePrefix",s+1)(N):U(N)}function U(N){return N===null||Bt(N)?t.check(H4,R,j)(N):(t.enter("codeFlowValue"),V(N))}function V(N){return N===null||Bt(N)?(t.exit("codeFlowValue"),U(N)):(t.consume(N),V)}function j(N){return t.exit("codeFenced"),e(N)}function I(N,ne,X){let se=0;return $;function $(Ge){return N.enter("lineEnding"),N.consume(Ge),N.exit("lineEnding"),oe}function oe(Ge){return N.enter("codeFencedFence"),Pn(Ge)?Vn(N,J,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(Ge):J(Ge)}function J(Ge){return Ge===c?(N.enter("codeFencedFenceSequence"),xe(Ge)):X(Ge)}function xe(Ge){return Ge===c?(se++,N.consume(Ge),xe):se>=l?(N.exit("codeFencedFenceSequence"),Pn(Ge)?Vn(N,ke,"whitespace")(Ge):ke(Ge)):X(Ge)}function ke(Ge){return Ge===null||Bt(Ge)?(N.exit("codeFencedFence"),ne(Ge)):X(Ge)}}}function RZ(t,e,n){const r=this;return a;function a(l){return l===null?n(l):(t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),s)}function s(l){return r.parser.lazy[r.now().line]?n(l):e(l)}}const e_={name:"codeIndented",tokenize:DZ},PZ={partial:!0,tokenize:AZ};function DZ(t,e,n){const r=this;return a;function a(p){return t.enter("codeIndented"),Vn(t,s,"linePrefix",5)(p)}function s(p){const v=r.events[r.events.length-1];return v&&v[1].type==="linePrefix"&&v[2].sliceSerialize(v[1],!0).length>=4?l(p):n(p)}function l(p){return p===null?h(p):Bt(p)?t.attempt(PZ,l,h)(p):(t.enter("codeFlowValue"),c(p))}function c(p){return p===null||Bt(p)?(t.exit("codeFlowValue"),l(p)):(t.consume(p),c)}function h(p){return t.exit("codeIndented"),e(p)}}function AZ(t,e,n){const r=this;return a;function a(l){return r.parser.lazy[r.now().line]?n(l):Bt(l)?(t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),a):Vn(t,s,"linePrefix",5)(l)}function s(l){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?e(l):Bt(l)?a(l):n(l)}}const OZ={name:"codeText",previous:LZ,resolve:MZ,tokenize:NZ};function MZ(t){let e=t.length-4,n=3,r,a;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r<e;)if(t[r][1].type==="codeTextData"){t[n][1].type="codeTextPadding",t[e][1].type="codeTextPadding",n+=2,e-=2;break}}for(r=n-1,e++;++r<=e;)a===void 0?r!==e&&t[r][1].type!=="lineEnding"&&(a=r):(r===e||t[r][1].type==="lineEnding")&&(t[a][1].type="codeTextData",r!==a+2&&(t[a][1].end=t[r-1][1].end,t.splice(a+2,r-a-2),e-=r-a-2,r=a+2),a=void 0);return t}function LZ(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function NZ(t,e,n){let r=0,a,s;return l;function l(b){return t.enter("codeText"),t.enter("codeTextSequence"),c(b)}function c(b){return b===96?(t.consume(b),r++,c):(t.exit("codeTextSequence"),h(b))}function h(b){return b===null?n(b):b===32?(t.enter("space"),t.consume(b),t.exit("space"),h):b===96?(s=t.enter("codeTextSequence"),a=0,v(b)):Bt(b)?(t.enter("lineEnding"),t.consume(b),t.exit("lineEnding"),h):(t.enter("codeTextData"),p(b))}function p(b){return b===null||b===32||b===96||Bt(b)?(t.exit("codeTextData"),h(b)):(t.consume(b),p)}function v(b){return b===96?(t.consume(b),a++,v):a===r?(t.exit("codeTextSequence"),t.exit("codeText"),e(b)):(s.type="codeTextData",p(b))}}class IZ{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(e,r):e>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,n,r){const a=n||0;this.setCursor(Math.trunc(e));const s=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return r&&_v(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),_v(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),_v(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const n=this.left.splice(e,Number.POSITIVE_INFINITY);_v(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);_v(this.left,n.reverse())}}}function _v(t,e){let n=0;if(e.length<1e4)t.push(...e);else for(;n<e.length;)t.push(...e.slice(n,n+1e4)),n+=1e4}function q4(t){const e={};let n=-1,r,a,s,l,c,h,p;const v=new IZ(t);for(;++n<v.length;){for(;n in e;)n=e[n];if(r=v.get(n),n&&r[1].type==="chunkFlow"&&v.get(n-1)[1].type==="listItemPrefix"&&(h=r[1]._tokenizer.events,s=0,s<h.length&&h[s][1].type==="lineEndingBlank"&&(s+=2),s<h.length&&h[s][1].type==="content"))for(;++s<h.length&&h[s][1].type!=="content";)h[s][1].type==="chunkText"&&(h[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(e,UZ(v,n)),n=e[n],p=!0);else if(r[1]._container){for(s=n,a=void 0;s--&&(l=v.get(s),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank");)l[0]==="enter"&&(a&&(v.get(a)[1].type="lineEndingBlank"),l[1].type="lineEnding",a=s);a&&(r[1].end={...v.get(a)[1].start},c=v.slice(a,n),c.unshift(r),v.splice(a,n-a+1,c))}}return Mo(t,0,Number.POSITIVE_INFINITY,v.slice(0)),!p}function UZ(t,e){const n=t.get(e)[1],r=t.get(e)[2];let a=e-1;const s=[],l=n._tokenizer||r.parser[n.contentType](n.start),c=l.events,h=[],p={};let v,b,k=-1,T=n,E=0,R=0;const M=[R];for(;T;){for(;t.get(++a)[1]!==T;);s.push(a),T._tokenizer||(v=r.sliceStream(T),T.next||v.push(null),b&&l.defineSkip(T.start),T._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(v),T._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),b=T,T=T.next}for(T=n;++k<c.length;)c[k][0]==="exit"&&c[k-1][0]==="enter"&&c[k][1].type===c[k-1][1].type&&c[k][1].start.line!==c[k][1].end.line&&(R=k+1,M.push(R),T._tokenizer=void 0,T.previous=void 0,T=T.next);for(l.events=[],T?(T._tokenizer=void 0,T.previous=void 0):M.pop(),k=M.length;k--;){const A=c.slice(M[k],M[k+1]),U=s.pop();h.push([U,U+A.length-1]),t.splice(U,2,A)}for(h.reverse(),k=-1;++k<h.length;)p[E+h[k][0]]=E+h[k][1],E+=h[k][1]-h[k][0]-1;return p}const FZ={resolve:VZ,tokenize:zZ},jZ={partial:!0,tokenize:BZ};function VZ(t){return q4(t),t}function zZ(t,e){let n;return r;function r(c){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),a(c)}function a(c){return c===null?s(c):Bt(c)?t.check(jZ,l,s)(c):(t.consume(c),a)}function s(c){return t.exit("chunkContent"),t.exit("content"),e(c)}function l(c){return t.consume(c),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function BZ(t,e,n){const r=this;return a;function a(l){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),Vn(t,s,"linePrefix")}function s(l){if(l===null||Bt(l))return n(l);const c=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?e(l):t.interrupt(r.parser.constructs.flow,n,e)(l)}}function W4(t,e,n,r,a,s,l,c,h){const p=h||Number.POSITIVE_INFINITY;let v=0;return b;function b(A){return A===60?(t.enter(r),t.enter(a),t.enter(s),t.consume(A),t.exit(s),k):A===null||A===32||A===41||fS(A)?n(A):(t.enter(r),t.enter(l),t.enter(c),t.enter("chunkString",{contentType:"string"}),R(A))}function k(A){return A===62?(t.enter(s),t.consume(A),t.exit(s),t.exit(a),t.exit(r),e):(t.enter(c),t.enter("chunkString",{contentType:"string"}),T(A))}function T(A){return A===62?(t.exit("chunkString"),t.exit(c),k(A)):A===null||A===60||Bt(A)?n(A):(t.consume(A),A===92?E:T)}function E(A){return A===60||A===62||A===92?(t.consume(A),T):T(A)}function R(A){return!v&&(A===null||A===41||Sr(A))?(t.exit("chunkString"),t.exit(c),t.exit(l),t.exit(r),e(A)):v<p&&A===40?(t.consume(A),v++,R):A===41?(t.consume(A),v--,R):A===null||A===32||A===40||fS(A)?n(A):(t.consume(A),A===92?M:R)}function M(A){return A===40||A===41||A===92?(t.consume(A),R):R(A)}}function G4(t,e,n,r,a,s){const l=this;let c=0,h;return p;function p(T){return t.enter(r),t.enter(a),t.consume(T),t.exit(a),t.enter(s),v}function v(T){return c>999||T===null||T===91||T===93&&!h||T===94&&!c&&"_hiddenFootnoteSupport"in l.parser.constructs?n(T):T===93?(t.exit(s),t.enter(a),t.consume(T),t.exit(a),t.exit(r),e):Bt(T)?(t.enter("lineEnding"),t.consume(T),t.exit("lineEnding"),v):(t.enter("chunkString",{contentType:"string"}),b(T))}function b(T){return T===null||T===91||T===93||Bt(T)||c++>999?(t.exit("chunkString"),v(T)):(t.consume(T),h||(h=!Pn(T)),T===92?k:b)}function k(T){return T===91||T===92||T===93?(t.consume(T),c++,b):b(T)}}function Y4(t,e,n,r,a,s){let l;return c;function c(k){return k===34||k===39||k===40?(t.enter(r),t.enter(a),t.consume(k),t.exit(a),l=k===40?41:k,h):n(k)}function h(k){return k===l?(t.enter(a),t.consume(k),t.exit(a),t.exit(r),e):(t.enter(s),p(k))}function p(k){return k===l?(t.exit(s),h(l)):k===null?n(k):Bt(k)?(t.enter("lineEnding"),t.consume(k),t.exit("lineEnding"),Vn(t,p,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),v(k))}function v(k){return k===l||k===null||Bt(k)?(t.exit("chunkString"),p(k)):(t.consume(k),k===92?b:v)}function b(k){return k===l||k===92?(t.consume(k),v):v(k)}}function Ev(t,e){let n;return r;function r(a){return Bt(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),n=!0,r):Pn(a)?Vn(t,r,n?"linePrefix":"lineSuffix")(a):e(a)}}const HZ={name:"definition",tokenize:qZ},$Z={partial:!0,tokenize:WZ};function qZ(t,e,n){const r=this;let a;return s;function s(T){return t.enter("definition"),l(T)}function l(T){return G4.call(r,t,c,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(T)}function c(T){return a=Ns(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),T===58?(t.enter("definitionMarker"),t.consume(T),t.exit("definitionMarker"),h):n(T)}function h(T){return Sr(T)?Ev(t,p)(T):p(T)}function p(T){return W4(t,v,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(T)}function v(T){return t.attempt($Z,b,b)(T)}function b(T){return Pn(T)?Vn(t,k,"whitespace")(T):k(T)}function k(T){return T===null||Bt(T)?(t.exit("definition"),r.parser.defined.push(a),e(T)):n(T)}}function WZ(t,e,n){return r;function r(c){return Sr(c)?Ev(t,a)(c):n(c)}function a(c){return Y4(t,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function s(c){return Pn(c)?Vn(t,l,"whitespace")(c):l(c)}function l(c){return c===null||Bt(c)?e(c):n(c)}}const GZ={name:"hardBreakEscape",tokenize:YZ};function YZ(t,e,n){return r;function r(s){return t.enter("hardBreakEscape"),t.consume(s),a}function a(s){return Bt(s)?(t.exit("hardBreakEscape"),e(s)):n(s)}}const KZ={name:"headingAtx",resolve:ZZ,tokenize:QZ};function ZZ(t,e){let n=t.length-2,r=3,a,s;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(a={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},s={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},Mo(t,r,n-r+1,[["enter",a,e],["enter",s,e],["exit",s,e],["exit",a,e]])),t}function QZ(t,e,n){let r=0;return a;function a(v){return t.enter("atxHeading"),s(v)}function s(v){return t.enter("atxHeadingSequence"),l(v)}function l(v){return v===35&&r++<6?(t.consume(v),l):v===null||Sr(v)?(t.exit("atxHeadingSequence"),c(v)):n(v)}function c(v){return v===35?(t.enter("atxHeadingSequence"),h(v)):v===null||Bt(v)?(t.exit("atxHeading"),e(v)):Pn(v)?Vn(t,c,"whitespace")(v):(t.enter("atxHeadingText"),p(v))}function h(v){return v===35?(t.consume(v),h):(t.exit("atxHeadingSequence"),c(v))}function p(v){return v===null||v===35||Sr(v)?(t.exit("atxHeadingText"),c(v)):(t.consume(v),p)}}const XZ=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],K4=["pre","script","style","textarea"],JZ={concrete:!0,name:"htmlFlow",resolveTo:nQ,tokenize:rQ},eQ={partial:!0,tokenize:aQ},tQ={partial:!0,tokenize:iQ};function nQ(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function rQ(t,e,n){const r=this;let a,s,l,c,h;return p;function p(H){return v(H)}function v(H){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(H),b}function b(H){return H===33?(t.consume(H),k):H===47?(t.consume(H),s=!0,R):H===63?(t.consume(H),a=3,r.interrupt?e:z):za(H)?(t.consume(H),l=String.fromCharCode(H),M):n(H)}function k(H){return H===45?(t.consume(H),a=2,T):H===91?(t.consume(H),a=5,c=0,E):za(H)?(t.consume(H),a=4,r.interrupt?e:z):n(H)}function T(H){return H===45?(t.consume(H),r.interrupt?e:z):n(H)}function E(H){const Ct="CDATA[";return H===Ct.charCodeAt(c++)?(t.consume(H),c===Ct.length?r.interrupt?e:J:E):n(H)}function R(H){return za(H)?(t.consume(H),l=String.fromCharCode(H),M):n(H)}function M(H){if(H===null||H===47||H===62||Sr(H)){const Ct=H===47,Rt=l.toLowerCase();return!Ct&&!s&&K4.includes(Rt)?(a=1,r.interrupt?e(H):J(H)):XZ.includes(l.toLowerCase())?(a=6,Ct?(t.consume(H),A):r.interrupt?e(H):J(H)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(H):s?U(H):V(H))}return H===45||Sa(H)?(t.consume(H),l+=String.fromCharCode(H),M):n(H)}function A(H){return H===62?(t.consume(H),r.interrupt?e:J):n(H)}function U(H){return Pn(H)?(t.consume(H),U):$(H)}function V(H){return H===47?(t.consume(H),$):H===58||H===95||za(H)?(t.consume(H),j):Pn(H)?(t.consume(H),V):$(H)}function j(H){return H===45||H===46||H===58||H===95||Sa(H)?(t.consume(H),j):I(H)}function I(H){return H===61?(t.consume(H),N):Pn(H)?(t.consume(H),I):V(H)}function N(H){return H===null||H===60||H===61||H===62||H===96?n(H):H===34||H===39?(t.consume(H),h=H,ne):Pn(H)?(t.consume(H),N):X(H)}function ne(H){return H===h?(t.consume(H),h=null,se):H===null||Bt(H)?n(H):(t.consume(H),ne)}function X(H){return H===null||H===34||H===39||H===47||H===60||H===61||H===62||H===96||Sr(H)?I(H):(t.consume(H),X)}function se(H){return H===47||H===62||Pn(H)?V(H):n(H)}function $(H){return H===62?(t.consume(H),oe):n(H)}function oe(H){return H===null||Bt(H)?J(H):Pn(H)?(t.consume(H),oe):n(H)}function J(H){return H===45&&a===2?(t.consume(H),Je):H===60&&a===1?(t.consume(H),je):H===62&&a===4?(t.consume(H),ee):H===63&&a===3?(t.consume(H),z):H===93&&a===5?(t.consume(H),He):Bt(H)&&(a===6||a===7)?(t.exit("htmlFlowData"),t.check(eQ,Ce,xe)(H)):H===null||Bt(H)?(t.exit("htmlFlowData"),xe(H)):(t.consume(H),J)}function xe(H){return t.check(tQ,ke,Ce)(H)}function ke(H){return t.enter("lineEnding"),t.consume(H),t.exit("lineEnding"),Ge}function Ge(H){return H===null||Bt(H)?xe(H):(t.enter("htmlFlowData"),J(H))}function Je(H){return H===45?(t.consume(H),z):J(H)}function je(H){return H===47?(t.consume(H),l="",ve):J(H)}function ve(H){if(H===62){const Ct=l.toLowerCase();return K4.includes(Ct)?(t.consume(H),ee):J(H)}return za(H)&&l.length<8?(t.consume(H),l+=String.fromCharCode(H),ve):J(H)}function He(H){return H===93?(t.consume(H),z):J(H)}function z(H){return H===62?(t.consume(H),ee):H===45&&a===2?(t.consume(H),z):J(H)}function ee(H){return H===null||Bt(H)?(t.exit("htmlFlowData"),Ce(H)):(t.consume(H),ee)}function Ce(H){return t.exit("htmlFlow"),e(H)}}function iQ(t,e,n){const r=this;return a;function a(l){return Bt(l)?(t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),s):n(l)}function s(l){return r.parser.lazy[r.now().line]?n(l):e(l)}}function aQ(t,e,n){return r;function r(a){return t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),t.attempt(wv,e,n)}}const oQ={name:"htmlText",tokenize:sQ};function sQ(t,e,n){const r=this;let a,s,l;return c;function c(z){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(z),h}function h(z){return z===33?(t.consume(z),p):z===47?(t.consume(z),I):z===63?(t.consume(z),V):za(z)?(t.consume(z),X):n(z)}function p(z){return z===45?(t.consume(z),v):z===91?(t.consume(z),s=0,E):za(z)?(t.consume(z),U):n(z)}function v(z){return z===45?(t.consume(z),T):n(z)}function b(z){return z===null?n(z):z===45?(t.consume(z),k):Bt(z)?(l=b,je(z)):(t.consume(z),b)}function k(z){return z===45?(t.consume(z),T):b(z)}function T(z){return z===62?Je(z):z===45?k(z):b(z)}function E(z){const ee="CDATA[";return z===ee.charCodeAt(s++)?(t.consume(z),s===ee.length?R:E):n(z)}function R(z){return z===null?n(z):z===93?(t.consume(z),M):Bt(z)?(l=R,je(z)):(t.consume(z),R)}function M(z){return z===93?(t.consume(z),A):R(z)}function A(z){return z===62?Je(z):z===93?(t.consume(z),A):R(z)}function U(z){return z===null||z===62?Je(z):Bt(z)?(l=U,je(z)):(t.consume(z),U)}function V(z){return z===null?n(z):z===63?(t.consume(z),j):Bt(z)?(l=V,je(z)):(t.consume(z),V)}function j(z){return z===62?Je(z):V(z)}function I(z){return za(z)?(t.consume(z),N):n(z)}function N(z){return z===45||Sa(z)?(t.consume(z),N):ne(z)}function ne(z){return Bt(z)?(l=ne,je(z)):Pn(z)?(t.consume(z),ne):Je(z)}function X(z){return z===45||Sa(z)?(t.consume(z),X):z===47||z===62||Sr(z)?se(z):n(z)}function se(z){return z===47?(t.consume(z),Je):z===58||z===95||za(z)?(t.consume(z),$):Bt(z)?(l=se,je(z)):Pn(z)?(t.consume(z),se):Je(z)}function $(z){return z===45||z===46||z===58||z===95||Sa(z)?(t.consume(z),$):oe(z)}function oe(z){return z===61?(t.consume(z),J):Bt(z)?(l=oe,je(z)):Pn(z)?(t.consume(z),oe):se(z)}function J(z){return z===null||z===60||z===61||z===62||z===96?n(z):z===34||z===39?(t.consume(z),a=z,xe):Bt(z)?(l=J,je(z)):Pn(z)?(t.consume(z),J):(t.consume(z),ke)}function xe(z){return z===a?(t.consume(z),a=void 0,Ge):z===null?n(z):Bt(z)?(l=xe,je(z)):(t.consume(z),xe)}function ke(z){return z===null||z===34||z===39||z===60||z===61||z===96?n(z):z===47||z===62||Sr(z)?se(z):(t.consume(z),ke)}function Ge(z){return z===47||z===62||Sr(z)?se(z):n(z)}function Je(z){return z===62?(t.consume(z),t.exit("htmlTextData"),t.exit("htmlText"),e):n(z)}function je(z){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(z),t.exit("lineEnding"),ve}function ve(z){return Pn(z)?Vn(t,He,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):He(z)}function He(z){return t.enter("htmlTextData"),l(z)}}const t_={name:"labelEnd",resolveAll:dQ,resolveTo:fQ,tokenize:hQ},lQ={tokenize:pQ},uQ={tokenize:mQ},cQ={tokenize:gQ};function dQ(t){let e=-1;const n=[];for(;++e<t.length;){const r=t[e][1];if(n.push(t[e]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const a=r.type==="labelImage"?4:2;r.type="data",e+=a}}return t.length!==n.length&&Mo(t,0,t.length,n),t}function fQ(t,e){let n=t.length,r=0,a,s,l,c;for(;n--;)if(a=t[n][1],s){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;t[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(l){if(t[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(s=n,a.type!=="labelLink")){r=2;break}}else a.type==="labelEnd"&&(l=n);const h={type:t[s][1].type==="labelLink"?"link":"image",start:{...t[s][1].start},end:{...t[t.length-1][1].end}},p={type:"label",start:{...t[s][1].start},end:{...t[l][1].end}},v={type:"labelText",start:{...t[s+r+2][1].end},end:{...t[l-2][1].start}};return c=[["enter",h,e],["enter",p,e]],c=Jo(c,t.slice(s+1,s+r+3)),c=Jo(c,[["enter",v,e]]),c=Jo(c,pS(e.parser.constructs.insideSpan.null,t.slice(s+r+4,l-3),e)),c=Jo(c,[["exit",v,e],t[l-2],t[l-1],["exit",p,e]]),c=Jo(c,t.slice(l+1)),c=Jo(c,[["exit",h,e]]),Mo(t,s,t.length,c),t}function hQ(t,e,n){const r=this;let a=r.events.length,s,l;for(;a--;)if((r.events[a][1].type==="labelImage"||r.events[a][1].type==="labelLink")&&!r.events[a][1]._balanced){s=r.events[a][1];break}return c;function c(k){return s?s._inactive?b(k):(l=r.parser.defined.includes(Ns(r.sliceSerialize({start:s.end,end:r.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(k),t.exit("labelMarker"),t.exit("labelEnd"),h):n(k)}function h(k){return k===40?t.attempt(lQ,v,l?v:b)(k):k===91?t.attempt(uQ,v,l?p:b)(k):l?v(k):b(k)}function p(k){return t.attempt(cQ,v,b)(k)}function v(k){return e(k)}function b(k){return s._balanced=!0,n(k)}}function pQ(t,e,n){return r;function r(b){return t.enter("resource"),t.enter("resourceMarker"),t.consume(b),t.exit("resourceMarker"),a}function a(b){return Sr(b)?Ev(t,s)(b):s(b)}function s(b){return b===41?v(b):W4(t,l,c,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(b)}function l(b){return Sr(b)?Ev(t,h)(b):v(b)}function c(b){return n(b)}function h(b){return b===34||b===39||b===40?Y4(t,p,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(b):v(b)}function p(b){return Sr(b)?Ev(t,v)(b):v(b)}function v(b){return b===41?(t.enter("resourceMarker"),t.consume(b),t.exit("resourceMarker"),t.exit("resource"),e):n(b)}}function mQ(t,e,n){const r=this;return a;function a(c){return G4.call(r,t,s,l,"reference","referenceMarker","referenceString")(c)}function s(c){return r.parser.defined.includes(Ns(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?e(c):n(c)}function l(c){return n(c)}}function gQ(t,e,n){return r;function r(s){return t.enter("reference"),t.enter("referenceMarker"),t.consume(s),t.exit("referenceMarker"),a}function a(s){return s===93?(t.enter("referenceMarker"),t.consume(s),t.exit("referenceMarker"),t.exit("reference"),e):n(s)}}const vQ={name:"labelStartImage",resolveAll:t_.resolveAll,tokenize:yQ};function yQ(t,e,n){const r=this;return a;function a(c){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(c),t.exit("labelImageMarker"),s}function s(c){return c===91?(t.enter("labelMarker"),t.consume(c),t.exit("labelMarker"),t.exit("labelImage"),l):n(c)}function l(c){return c===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(c):e(c)}}const bQ={name:"labelStartLink",resolveAll:t_.resolveAll,tokenize:SQ};function SQ(t,e,n){const r=this;return a;function a(l){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(l),t.exit("labelMarker"),t.exit("labelLink"),s}function s(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):e(l)}}const n_={name:"lineEnding",tokenize:CQ};function CQ(t,e){return n;function n(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),Vn(t,e,"linePrefix")}}const mS={name:"thematicBreak",tokenize:kQ};function kQ(t,e,n){let r=0,a;return s;function s(p){return t.enter("thematicBreak"),l(p)}function l(p){return a=p,c(p)}function c(p){return p===a?(t.enter("thematicBreakSequence"),h(p)):r>=3&&(p===null||Bt(p))?(t.exit("thematicBreak"),e(p)):n(p)}function h(p){return p===a?(t.consume(p),r++,h):(t.exit("thematicBreakSequence"),Pn(p)?Vn(t,c,"whitespace")(p):c(p))}}const uo={continuation:{tokenize:_Q},exit:RQ,name:"list",tokenize:wQ},TQ={partial:!0,tokenize:PQ},xQ={partial:!0,tokenize:EQ};function wQ(t,e,n){const r=this,a=r.events[r.events.length-1];let s=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,l=0;return c;function c(T){const E=r.containerState.type||(T===42||T===43||T===45?"listUnordered":"listOrdered");if(E==="listUnordered"?!r.containerState.marker||T===r.containerState.marker:Xw(T)){if(r.containerState.type||(r.containerState.type=E,t.enter(E,{_container:!0})),E==="listUnordered")return t.enter("listItemPrefix"),T===42||T===45?t.check(mS,n,p)(T):p(T);if(!r.interrupt||T===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),h(T)}return n(T)}function h(T){return Xw(T)&&++l<10?(t.consume(T),h):(!r.interrupt||l<2)&&(r.containerState.marker?T===r.containerState.marker:T===41||T===46)?(t.exit("listItemValue"),p(T)):n(T)}function p(T){return t.enter("listItemMarker"),t.consume(T),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||T,t.check(wv,r.interrupt?n:v,t.attempt(TQ,k,b))}function v(T){return r.containerState.initialBlankLine=!0,s++,k(T)}function b(T){return Pn(T)?(t.enter("listItemPrefixWhitespace"),t.consume(T),t.exit("listItemPrefixWhitespace"),k):n(T)}function k(T){return r.containerState.size=s+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(T)}}function _Q(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(wv,a,s);function a(c){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Vn(t,e,"listItemIndent",r.containerState.size+1)(c)}function s(c){return r.containerState.furtherBlankLines||!Pn(c)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,l(c)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(xQ,e,l)(c))}function l(c){return r.containerState._closeFlow=!0,r.interrupt=void 0,Vn(t,t.attempt(uo,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function EQ(t,e,n){const r=this;return Vn(t,a,"listItemIndent",r.containerState.size+1);function a(s){const l=r.events[r.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===r.containerState.size?e(s):n(s)}}function RQ(t){t.exit(this.containerState.type)}function PQ(t,e,n){const r=this;return Vn(t,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(s){const l=r.events[r.events.length-1];return!Pn(s)&&l&&l[1].type==="listItemPrefixWhitespace"?e(s):n(s)}}const Z4={name:"setextUnderline",resolveTo:DQ,tokenize:AQ};function DQ(t,e){let n=t.length,r,a,s;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(a=n)}else t[n][1].type==="content"&&t.splice(n,1),!s&&t[n][1].type==="definition"&&(s=n);const l={type:"setextHeading",start:{...t[a][1].start},end:{...t[t.length-1][1].end}};return t[a][1].type="setextHeadingText",s?(t.splice(a,0,["enter",l,e]),t.splice(s+1,0,["exit",t[r][1],e]),t[r][1].end={...t[s][1].end}):t[r][1]=l,t.push(["exit",l,e]),t}function AQ(t,e,n){const r=this;let a;return s;function s(p){let v=r.events.length,b;for(;v--;)if(r.events[v][1].type!=="lineEnding"&&r.events[v][1].type!=="linePrefix"&&r.events[v][1].type!=="content"){b=r.events[v][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||b)?(t.enter("setextHeadingLine"),a=p,l(p)):n(p)}function l(p){return t.enter("setextHeadingLineSequence"),c(p)}function c(p){return p===a?(t.consume(p),c):(t.exit("setextHeadingLineSequence"),Pn(p)?Vn(t,h,"lineSuffix")(p):h(p))}function h(p){return p===null||Bt(p)?(t.exit("setextHeadingLine"),e(p)):n(p)}}const OQ={tokenize:MQ};function MQ(t){const e=this,n=t.attempt(wv,r,t.attempt(this.parser.constructs.flowInitial,a,Vn(t,t.attempt(this.parser.constructs.flow,a,t.attempt(FZ,a)),"linePrefix")));return n;function r(s){if(s===null){t.consume(s);return}return t.enter("lineEndingBlank"),t.consume(s),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function a(s){if(s===null){t.consume(s);return}return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const LQ={resolveAll:X4()},NQ=Q4("string"),IQ=Q4("text");function Q4(t){return{resolveAll:X4(t==="text"?UQ:void 0),tokenize:e};function e(n){const r=this,a=this.parser.constructs[t],s=n.attempt(a,l,c);return l;function l(v){return p(v)?s(v):c(v)}function c(v){if(v===null){n.consume(v);return}return n.enter("data"),n.consume(v),h}function h(v){return p(v)?(n.exit("data"),s(v)):(n.consume(v),h)}function p(v){if(v===null)return!0;const b=a[v];let k=-1;if(b)for(;++k<b.length;){const T=b[k];if(!T.previous||T.previous.call(r,r.previous))return!0}return!1}}}function X4(t){return e;function e(n,r){let a=-1,s;for(;++a<=n.length;)s===void 0?n[a]&&n[a][1].type==="data"&&(s=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==s+2&&(n[s][1].end=n[a-1][1].end,n.splice(s+2,a-s-2),a=s+2),s=void 0);return t?t(n,r):n}}function UQ(t,e){let n=0;for(;++n<=t.length;)if((n===t.length||t[n][1].type==="lineEnding")&&t[n-1][1].type==="data"){const r=t[n-1][1],a=e.sliceStream(r);let s=a.length,l=-1,c=0,h;for(;s--;){const p=a[s];if(typeof p=="string"){for(l=p.length;p.charCodeAt(l-1)===32;)c++,l--;if(l)break;l=-1}else if(p===-2)h=!0,c++;else if(p!==-1){s++;break}}if(c){const p={type:n===t.length||h||c<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?l:r.start._bufferIndex+l,_index:r.start._index+s,line:r.end.line,column:r.end.column-c,offset:r.end.offset-c},end:{...r.end}};r.end={...p.start},r.start.offset===r.end.offset?Object.assign(r,p):(t.splice(n,0,["enter",p,e],["exit",p,e]),n+=2)}n++}return t}const FQ=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:{null:[42,95]},contentInitial:{91:HZ},disable:{null:[]},document:{42:uo,43:uo,45:uo,48:uo,49:uo,50:uo,51:uo,52:uo,53:uo,54:uo,55:uo,56:uo,57:uo,62:V4},flow:{35:KZ,42:mS,45:[Z4,mS],60:JZ,61:Z4,95:mS,96:$4,126:$4},flowInitial:{[-2]:e_,[-1]:e_,32:e_},insideSpan:{null:[Jw,LQ]},string:{38:B4,92:z4},text:{[-5]:n_,[-4]:n_,[-3]:n_,33:vQ,38:B4,42:Jw,60:[bZ,oQ],91:bQ,92:[GZ,z4],93:t_,95:Jw,96:OZ}},Symbol.toStringTag,{value:"Module"}));function jQ(t,e,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},s=[];let l=[],c=[];const h={attempt:ne(I),check:ne(N),consume:U,enter:V,exit:j,interrupt:ne(N,{interrupt:!0})},p={code:null,containerState:{},defineSkip:R,events:[],now:E,parser:t,previous:null,sliceSerialize:k,sliceStream:T,write:b};let v=e.tokenize.call(p,h);return e.resolveAll&&s.push(e),p;function b(oe){return l=Jo(l,oe),M(),l[l.length-1]!==null?[]:(X(e,0),p.events=pS(s,p.events,p),p.events)}function k(oe,J){return zQ(T(oe),J)}function T(oe){return VQ(l,oe)}function E(){const{_bufferIndex:oe,_index:J,line:xe,column:ke,offset:Ge}=r;return{_bufferIndex:oe,_index:J,line:xe,column:ke,offset:Ge}}function R(oe){a[oe.line]=oe.column,$()}function M(){let oe;for(;r._index<l.length;){const J=l[r._index];if(typeof J=="string")for(oe=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===oe&&r._bufferIndex<J.length;)A(J.charCodeAt(r._bufferIndex));else A(J)}}function A(oe){v=v(oe)}function U(oe){Bt(oe)?(r.line++,r.column=1,r.offset+=oe===-3?2:1,$()):oe!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===l[r._index].length&&(r._bufferIndex=-1,r._index++)),p.previous=oe}function V(oe,J){const xe=J||{};return xe.type=oe,xe.start=E(),p.events.push(["enter",xe,p]),c.push(xe),xe}function j(oe){const J=c.pop();return J.end=E(),p.events.push(["exit",J,p]),J}function I(oe,J){X(oe,J.from)}function N(oe,J){J.restore()}function ne(oe,J){return xe;function xe(ke,Ge,Je){let je,ve,He,z;return Array.isArray(ke)?Ce(ke):"tokenize"in ke?Ce([ke]):ee(ke);function ee(ht){return bt;function bt(it){const xt=it!==null&&ht[it],tn=it!==null&&ht.null,qn=[...Array.isArray(xt)?xt:xt?[xt]:[],...Array.isArray(tn)?tn:tn?[tn]:[]];return Ce(qn)(it)}}function Ce(ht){return je=ht,ve=0,ht.length===0?Je:H(ht[ve])}function H(ht){return bt;function bt(it){return z=se(),He=ht,ht.partial||(p.currentConstruct=ht),ht.name&&p.parser.constructs.disable.null.includes(ht.name)?Rt():ht.tokenize.call(J?Object.assign(Object.create(p),J):p,h,Ct,Rt)(it)}}function Ct(ht){return oe(He,z),Ge}function Rt(ht){return z.restore(),++ve<je.length?H(je[ve]):Je}}}function X(oe,J){oe.resolveAll&&!s.includes(oe)&&s.push(oe),oe.resolve&&Mo(p.events,J,p.events.length-J,oe.resolve(p.events.slice(J),p)),oe.resolveTo&&(p.events=oe.resolveTo(p.events,p))}function se(){const oe=E(),J=p.previous,xe=p.currentConstruct,ke=p.events.length,Ge=Array.from(c);return{from:ke,restore:Je};function Je(){r=oe,p.previous=J,p.currentConstruct=xe,p.events.length=ke,c=Ge,$()}}function $(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function VQ(t,e){const n=e.start._index,r=e.start._bufferIndex,a=e.end._index,s=e.end._bufferIndex;let l;if(n===a)l=[t[n].slice(r,s)];else{if(l=t.slice(n,a),r>-1){const c=l[0];typeof c=="string"?l[0]=c.slice(r):l.shift()}s>0&&l.push(t[a].slice(0,s))}return l}function zQ(t,e){let n=-1;const r=[];let a;for(;++n<t.length;){const s=t[n];let l;if(typeof s=="string")l=s;else switch(s){case-5:{l="\r";break}case-4:{l=`
|
|
400
400
|
`;break}case-3:{l=`\r
|
|
401
401
|
`;break}case-2:{l=e?" ":" ";break}case-1:{if(!e&&a)continue;l=" ";break}default:l=String.fromCharCode(s)}a=s===-2,r.push(l)}return r.join("")}function BQ(t){const r={constructs:I4([FQ,...(t||{}).extensions||[]]),content:a(fZ),defined:[],document:a(pZ),flow:a(OQ),lazy:{},string:a(NQ),text:a(IQ)};return r;function a(s){return l;function l(c){return jQ(r,s,c)}}}function HQ(t){for(;!q4(t););return t}const J4=/[\0\t\n\r]/g;function $Q(){let t=1,e="",n=!0,r;return a;function a(s,l,c){const h=[];let p,v,b,k,T;for(s=e+(typeof s=="string"?s.toString():new TextDecoder(l||void 0).decode(s)),b=0,e="",n&&(s.charCodeAt(0)===65279&&b++,n=void 0);b<s.length;){if(J4.lastIndex=b,p=J4.exec(s),k=p&&p.index!==void 0?p.index:s.length,T=s.charCodeAt(k),!p){e=s.slice(b);break}if(T===10&&b===k&&r)h.push(-3),r=void 0;else switch(r&&(h.push(-5),r=void 0),b<k&&(h.push(s.slice(b,k)),t+=k-b),T){case 0:{h.push(65533),t++;break}case 9:{for(v=Math.ceil(t/4)*4,h.push(-2);t++<v;)h.push(-1);break}case 10:{h.push(-4),t=1;break}default:r=!0,t=1}b=k+1}return c&&(r&&h.push(-5),e&&h.push(e),h.push(null)),h}}const qQ=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function WQ(t){return t.replace(qQ,GQ)}function GQ(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),s=a===120||a===88;return U4(n.slice(s?2:1),s?16:10)}return Qw(n)||t}const e5={}.hasOwnProperty;function YQ(t,e,n){return typeof e!="string"&&(n=e,e=void 0),KQ(n)(HQ(BQ(n).document().write($Q()(t,e,!0))))}function KQ(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(le),autolinkProtocol:se,autolinkEmail:se,atxHeading:s(Nr),blockQuote:s(tn),characterEscape:se,characterReference:se,codeFenced:s(qn),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:s(qn,l),codeText:s(_r,l),codeTextData:se,data:se,codeFlowValue:se,definition:s(vr),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:s(Xn),hardBreakEscape:s(bn),hardBreakTrailing:s(bn),htmlFlow:s(Lt,l),htmlFlowData:se,htmlText:s(Lt,l),htmlTextData:se,image:s(Z),label:l,link:s(le),listItem:s(Ve),listItemValue:k,listOrdered:s(me,b),listUnordered:s(me),paragraph:s(ze),reference:H,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:s(Nr),strong:s(Oe),thematicBreak:s(Nt)},exit:{atxHeading:h(),atxHeadingSequence:I,autolink:h(),autolinkEmail:xt,autolinkProtocol:it,blockQuote:h(),characterEscapeValue:$,characterReferenceMarkerHexadecimal:Rt,characterReferenceMarkerNumeric:Rt,characterReferenceValue:ht,characterReference:bt,codeFenced:h(M),codeFencedFence:R,codeFencedFenceInfo:T,codeFencedFenceMeta:E,codeFlowValue:$,codeIndented:h(A),codeText:h(Ge),codeTextData:$,data:$,definition:h(),definitionDestinationString:j,definitionLabelString:U,definitionTitleString:V,emphasis:h(),hardBreakEscape:h(J),hardBreakTrailing:h(J),htmlFlow:h(xe),htmlFlowData:$,htmlText:h(ke),htmlTextData:$,image:h(je),label:He,labelText:ve,lineEnding:oe,link:h(Je),listItem:h(),listOrdered:h(),listUnordered:h(),paragraph:h(),referenceString:Ct,resourceDestinationString:z,resourceTitleString:ee,resource:Ce,setextHeading:h(X),setextHeadingLineSequence:ne,setextHeadingText:N,strong:h(),thematicBreak:h()}};t5(e,(t||{}).mdastExtensions||[]);const n={};return r;function r(fe){let Re={type:"root",children:[]};const vt={stack:[Re],tokenStack:[],config:e,enter:c,exit:p,buffer:l,resume:v,data:n},Ft=[];let Kt=-1;for(;++Kt<fe.length;)if(fe[Kt][1].type==="listOrdered"||fe[Kt][1].type==="listUnordered")if(fe[Kt][0]==="enter")Ft.push(Kt);else{const Be=Ft.pop();Kt=a(fe,Be,Kt)}for(Kt=-1;++Kt<fe.length;){const Be=e[fe[Kt][0]];e5.call(Be,fe[Kt][1].type)&&Be[fe[Kt][1].type].call(Object.assign({sliceSerialize:fe[Kt][2].sliceSerialize},vt),fe[Kt][1])}if(vt.tokenStack.length>0){const Be=vt.tokenStack[vt.tokenStack.length-1];(Be[1]||n5).call(vt,void 0,Be[0])}for(Re.position={start:zc(fe.length>0?fe[0][1].start:{line:1,column:1,offset:0}),end:zc(fe.length>0?fe[fe.length-2][1].end:{line:1,column:1,offset:0})},Kt=-1;++Kt<e.transforms.length;)Re=e.transforms[Kt](Re)||Re;return Re}function a(fe,Re,vt){let Ft=Re-1,Kt=-1,Be=!1,ct,At,ln,En;for(;++Ft<=vt;){const un=fe[Ft];switch(un[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{un[0]==="enter"?Kt++:Kt--,En=void 0;break}case"lineEndingBlank":{un[0]==="enter"&&(ct&&!En&&!Kt&&!ln&&(ln=Ft),En=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:En=void 0}if(!Kt&&un[0]==="enter"&&un[1].type==="listItemPrefix"||Kt===-1&&un[0]==="exit"&&(un[1].type==="listUnordered"||un[1].type==="listOrdered")){if(ct){let Dn=Ft;for(At=void 0;Dn--;){const Wn=fe[Dn];if(Wn[1].type==="lineEnding"||Wn[1].type==="lineEndingBlank"){if(Wn[0]==="exit")continue;At&&(fe[At][1].type="lineEndingBlank",Be=!0),Wn[1].type="lineEnding",At=Dn}else if(!(Wn[1].type==="linePrefix"||Wn[1].type==="blockQuotePrefix"||Wn[1].type==="blockQuotePrefixWhitespace"||Wn[1].type==="blockQuoteMarker"||Wn[1].type==="listItemIndent"))break}ln&&(!At||ln<At)&&(ct._spread=!0),ct.end=Object.assign({},At?fe[At][1].start:un[1].end),fe.splice(At||Ft,0,["exit",ct,un[2]]),Ft++,vt++}if(un[1].type==="listItemPrefix"){const Dn={type:"listItem",_spread:!1,start:Object.assign({},un[1].start),end:void 0};ct=Dn,fe.splice(Ft,0,["enter",Dn,un[2]]),Ft++,vt++,ln=void 0,En=!0}}}return fe[Re][1]._spread=Be,vt}function s(fe,Re){return vt;function vt(Ft){c.call(this,fe(Ft),Ft),Re&&Re.call(this,Ft)}}function l(){this.stack.push({type:"fragment",children:[]})}function c(fe,Re,vt){this.stack[this.stack.length-1].children.push(fe),this.stack.push(fe),this.tokenStack.push([Re,vt||void 0]),fe.position={start:zc(Re.start),end:void 0}}function h(fe){return Re;function Re(vt){fe&&fe.call(this,vt),p.call(this,vt)}}function p(fe,Re){const vt=this.stack.pop(),Ft=this.tokenStack.pop();if(Ft)Ft[0].type!==fe.type&&(Re?Re.call(this,fe,Ft[0]):(Ft[1]||n5).call(this,fe,Ft[0]));else throw new Error("Cannot close `"+fe.type+"` ("+Tv({start:fe.start,end:fe.end})+"): it’s not open");vt.position.end=zc(fe.end)}function v(){return Zw(this.stack.pop())}function b(){this.data.expectingFirstListItemValue=!0}function k(fe){if(this.data.expectingFirstListItemValue){const Re=this.stack[this.stack.length-2];Re.start=Number.parseInt(this.sliceSerialize(fe),10),this.data.expectingFirstListItemValue=void 0}}function T(){const fe=this.resume(),Re=this.stack[this.stack.length-1];Re.lang=fe}function E(){const fe=this.resume(),Re=this.stack[this.stack.length-1];Re.meta=fe}function R(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function M(){const fe=this.resume(),Re=this.stack[this.stack.length-1];Re.value=fe.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function A(){const fe=this.resume(),Re=this.stack[this.stack.length-1];Re.value=fe.replace(/(\r?\n|\r)$/g,"")}function U(fe){const Re=this.resume(),vt=this.stack[this.stack.length-1];vt.label=Re,vt.identifier=Ns(this.sliceSerialize(fe)).toLowerCase()}function V(){const fe=this.resume(),Re=this.stack[this.stack.length-1];Re.title=fe}function j(){const fe=this.resume(),Re=this.stack[this.stack.length-1];Re.url=fe}function I(fe){const Re=this.stack[this.stack.length-1];if(!Re.depth){const vt=this.sliceSerialize(fe).length;Re.depth=vt}}function N(){this.data.setextHeadingSlurpLineEnding=!0}function ne(fe){const Re=this.stack[this.stack.length-1];Re.depth=this.sliceSerialize(fe).codePointAt(0)===61?1:2}function X(){this.data.setextHeadingSlurpLineEnding=void 0}function se(fe){const vt=this.stack[this.stack.length-1].children;let Ft=vt[vt.length-1];(!Ft||Ft.type!=="text")&&(Ft=ut(),Ft.position={start:zc(fe.start),end:void 0},vt.push(Ft)),this.stack.push(Ft)}function $(fe){const Re=this.stack.pop();Re.value+=this.sliceSerialize(fe),Re.position.end=zc(fe.end)}function oe(fe){const Re=this.stack[this.stack.length-1];if(this.data.atHardBreak){const vt=Re.children[Re.children.length-1];vt.position.end=zc(fe.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(Re.type)&&(se.call(this,fe),$.call(this,fe))}function J(){this.data.atHardBreak=!0}function xe(){const fe=this.resume(),Re=this.stack[this.stack.length-1];Re.value=fe}function ke(){const fe=this.resume(),Re=this.stack[this.stack.length-1];Re.value=fe}function Ge(){const fe=this.resume(),Re=this.stack[this.stack.length-1];Re.value=fe}function Je(){const fe=this.stack[this.stack.length-1];if(this.data.inReference){const Re=this.data.referenceType||"shortcut";fe.type+="Reference",fe.referenceType=Re,delete fe.url,delete fe.title}else delete fe.identifier,delete fe.label;this.data.referenceType=void 0}function je(){const fe=this.stack[this.stack.length-1];if(this.data.inReference){const Re=this.data.referenceType||"shortcut";fe.type+="Reference",fe.referenceType=Re,delete fe.url,delete fe.title}else delete fe.identifier,delete fe.label;this.data.referenceType=void 0}function ve(fe){const Re=this.sliceSerialize(fe),vt=this.stack[this.stack.length-2];vt.label=WQ(Re),vt.identifier=Ns(Re).toLowerCase()}function He(){const fe=this.stack[this.stack.length-1],Re=this.resume(),vt=this.stack[this.stack.length-1];if(this.data.inReference=!0,vt.type==="link"){const Ft=fe.children;vt.children=Ft}else vt.alt=Re}function z(){const fe=this.resume(),Re=this.stack[this.stack.length-1];Re.url=fe}function ee(){const fe=this.resume(),Re=this.stack[this.stack.length-1];Re.title=fe}function Ce(){this.data.inReference=void 0}function H(){this.data.referenceType="collapsed"}function Ct(fe){const Re=this.resume(),vt=this.stack[this.stack.length-1];vt.label=Re,vt.identifier=Ns(this.sliceSerialize(fe)).toLowerCase(),this.data.referenceType="full"}function Rt(fe){this.data.characterReferenceType=fe.type}function ht(fe){const Re=this.sliceSerialize(fe),vt=this.data.characterReferenceType;let Ft;vt?(Ft=U4(Re,vt==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ft=Qw(Re);const Kt=this.stack[this.stack.length-1];Kt.value+=Ft}function bt(fe){const Re=this.stack.pop();Re.position.end=zc(fe.end)}function it(fe){$.call(this,fe);const Re=this.stack[this.stack.length-1];Re.url=this.sliceSerialize(fe)}function xt(fe){$.call(this,fe);const Re=this.stack[this.stack.length-1];Re.url="mailto:"+this.sliceSerialize(fe)}function tn(){return{type:"blockquote",children:[]}}function qn(){return{type:"code",lang:null,meta:null,value:""}}function _r(){return{type:"inlineCode",value:""}}function vr(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Xn(){return{type:"emphasis",children:[]}}function Nr(){return{type:"heading",depth:0,children:[]}}function bn(){return{type:"break"}}function Lt(){return{type:"html",value:""}}function Z(){return{type:"image",title:null,url:"",alt:null}}function le(){return{type:"link",title:null,url:"",children:[]}}function me(fe){return{type:"list",ordered:fe.type==="listOrdered",start:null,spread:fe._spread,children:[]}}function Ve(fe){return{type:"listItem",spread:fe._spread,checked:null,children:[]}}function ze(){return{type:"paragraph",children:[]}}function Oe(){return{type:"strong",children:[]}}function ut(){return{type:"text",value:""}}function Nt(){return{type:"thematicBreak"}}}function zc(t){return{line:t.line,column:t.column,offset:t.offset}}function t5(t,e){let n=-1;for(;++n<e.length;){const r=e[n];Array.isArray(r)?t5(t,r):ZQ(t,r)}}function ZQ(t,e){let n;for(n in e)if(e5.call(e,n))switch(n){case"canContainEols":{const r=e[n];r&&t[n].push(...r);break}case"transforms":{const r=e[n];r&&t[n].push(...r);break}case"enter":case"exit":{const r=e[n];r&&Object.assign(t[n],r);break}}}function n5(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+Tv({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+Tv({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+Tv({start:e.start,end:e.end})+") is still open")}function QQ(t){const e=this;e.parser=n;function n(r){return YQ(r,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function XQ(t,e){const n={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,n),t.applyData(e,n)}function JQ(t,e){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:`
|
|
@@ -404,7 +404,7 @@ a=extmap-allow-mixed`)!==-1){const s=a.sdp.split(`
|
|
|
404
404
|
`}),v.type==="element"&&v.tagName==="p"&&!a?l.push(...v.children):l.push(v)}const h=r[r.length-1];h&&(a||h.type!=="element"||h.tagName!=="p")&&l.push({type:"text",value:`
|
|
405
405
|
`});const p={type:"element",tagName:"li",properties:s,children:l};return t.patch(e,p),t.applyData(e,p)}function fX(t){let e=!1;if(t.type==="list"){e=t.spread||!1;const n=t.children;let r=-1;for(;!e&&++r<n.length;)e=i5(n[r])}return e}function i5(t){const e=t.spread;return e??t.children.length>1}function hX(t,e){const n={},r=t.all(e);let a=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++a<r.length;){const l=r[a];if(l.type==="element"&&l.tagName==="li"&&l.properties&&Array.isArray(l.properties.className)&&l.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const s={type:"element",tagName:e.ordered?"ol":"ul",properties:n,children:t.wrap(r,!0)};return t.patch(e,s),t.applyData(e,s)}function pX(t,e){const n={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function mX(t,e){const n={type:"root",children:t.wrap(t.all(e))};return t.patch(e,n),t.applyData(e,n)}function gX(t,e){const n={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function vX(t,e){const n=t.all(e),r=n.shift(),a=[];if(r){const l={type:"element",tagName:"thead",properties:{},children:t.wrap([r],!0)};t.patch(e.children[0],l),a.push(l)}if(n.length>0){const l={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},c=$w(e.children[1]),h=x4(e.children[e.children.length-1]);c&&h&&(l.position={start:c,end:h}),a.push(l)}const s={type:"element",tagName:"table",properties:{},children:t.wrap(a,!0)};return t.patch(e,s),t.applyData(e,s)}function yX(t,e,n){const r=n?n.children:void 0,s=(r?r.indexOf(e):1)===0?"th":"td",l=n&&n.type==="table"?n.align:void 0,c=l?l.length:e.children.length;let h=-1;const p=[];for(;++h<c;){const b=e.children[h],k={},T=l?l[h]:void 0;T&&(k.align=T);let E={type:"element",tagName:s,properties:k,children:[]};b&&(E.children=t.all(b),t.patch(b,E),E=t.applyData(b,E)),p.push(E)}const v={type:"element",tagName:"tr",properties:{},children:t.wrap(p,!0)};return t.patch(e,v),t.applyData(e,v)}function bX(t,e){const n={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}const a5=9,o5=32;function SX(t){const e=String(t),n=/\r?\n|\r/g;let r=n.exec(e),a=0;const s=[];for(;r;)s.push(s5(e.slice(a,r.index),a>0,!0),r[0]),a=r.index+r[0].length,r=n.exec(e);return s.push(s5(e.slice(a),a>0,!1)),s.join("")}function s5(t,e,n){let r=0,a=t.length;if(e){let s=t.codePointAt(r);for(;s===a5||s===o5;)r++,s=t.codePointAt(r)}if(n){let s=t.codePointAt(a-1);for(;s===a5||s===o5;)a--,s=t.codePointAt(a-1)}return a>r?t.slice(r,a):""}function CX(t,e){const n={type:"text",value:SX(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function kX(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const TX={blockquote:XQ,break:JQ,code:eX,delete:tX,emphasis:nX,footnoteReference:rX,heading:iX,html:aX,imageReference:oX,image:sX,inlineCode:lX,linkReference:uX,link:cX,listItem:dX,list:hX,paragraph:pX,root:mX,strong:gX,table:vX,tableCell:bX,tableRow:yX,text:CX,thematicBreak:kX,toml:gS,yaml:gS,definition:gS,footnoteDefinition:gS};function gS(){}const l5=-1,vS=0,yS=1,bS=2,r_=3,i_=4,a_=5,o_=6,u5=7,c5=8,d5=typeof self=="object"?self:globalThis,xX=(t,e)=>{const n=(a,s)=>(t.set(s,a),a),r=a=>{if(t.has(a))return t.get(a);const[s,l]=e[a];switch(s){case vS:case l5:return n(l,a);case yS:{const c=n([],a);for(const h of l)c.push(r(h));return c}case bS:{const c=n({},a);for(const[h,p]of l)c[r(h)]=r(p);return c}case r_:return n(new Date(l),a);case i_:{const{source:c,flags:h}=l;return n(new RegExp(c,h),a)}case a_:{const c=n(new Map,a);for(const[h,p]of l)c.set(r(h),r(p));return c}case o_:{const c=n(new Set,a);for(const h of l)c.add(r(h));return c}case u5:{const{name:c,message:h}=l;return n(new d5[c](h),a)}case c5:return n(BigInt(l),a);case"BigInt":return n(Object(BigInt(l)),a)}return n(new d5[s](l),a)};return r},f5=t=>xX(new Map,t)(0),kp="",{toString:wX}={},{keys:_X}=Object,Rv=t=>{const e=typeof t;if(e!=="object"||!t)return[vS,e];const n=wX.call(t).slice(8,-1);switch(n){case"Array":return[yS,kp];case"Object":return[bS,kp];case"Date":return[r_,kp];case"RegExp":return[i_,kp];case"Map":return[a_,kp];case"Set":return[o_,kp]}return n.includes("Array")?[yS,n]:n.includes("Error")?[u5,n]:[bS,n]},SS=([t,e])=>t===vS&&(e==="function"||e==="symbol"),EX=(t,e,n,r)=>{const a=(l,c)=>{const h=r.push(l)-1;return n.set(c,h),h},s=l=>{if(n.has(l))return n.get(l);let[c,h]=Rv(l);switch(c){case vS:{let v=l;switch(h){case"bigint":c=c5,v=l.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+h);v=null;break;case"undefined":return a([l5],l)}return a([c,v],l)}case yS:{if(h)return a([h,[...l]],l);const v=[],b=a([c,v],l);for(const k of l)v.push(s(k));return b}case bS:{if(h)switch(h){case"BigInt":return a([h,l.toString()],l);case"Boolean":case"Number":case"String":return a([h,l.valueOf()],l)}if(e&&"toJSON"in l)return s(l.toJSON());const v=[],b=a([c,v],l);for(const k of _X(l))(t||!SS(Rv(l[k])))&&v.push([s(k),s(l[k])]);return b}case r_:return a([c,l.toISOString()],l);case i_:{const{source:v,flags:b}=l;return a([c,{source:v,flags:b}],l)}case a_:{const v=[],b=a([c,v],l);for(const[k,T]of l)(t||!(SS(Rv(k))||SS(Rv(T))))&&v.push([s(k),s(T)]);return b}case o_:{const v=[],b=a([c,v],l);for(const k of l)(t||!SS(Rv(k)))&&v.push(s(k));return b}}const{message:p}=l;return a([c,{name:h,message:p}],l)};return s},h5=(t,{json:e,lossy:n}={})=>{const r=[];return EX(!(e||n),!!e,new Map,r)(t),r},CS=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?f5(h5(t,e)):structuredClone(t):(t,e)=>f5(h5(t,e));function RX(t,e){const n=[{type:"text",value:"↩"}];return e>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),n}function PX(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function DX(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||RX,r=t.options.footnoteBackLabel||PX,a=t.options.footnoteLabel||"Footnotes",s=t.options.footnoteLabelTagName||"h2",l=t.options.footnoteLabelProperties||{className:["sr-only"]},c=[];let h=-1;for(;++h<t.footnoteOrder.length;){const p=t.footnoteById.get(t.footnoteOrder[h]);if(!p)continue;const v=t.all(p),b=String(p.identifier).toUpperCase(),k=Sp(b.toLowerCase());let T=0;const E=[],R=t.footnoteCounts.get(b);for(;R!==void 0&&++T<=R;){E.length>0&&E.push({type:"text",value:" "});let U=typeof n=="string"?n:n(h,T);typeof U=="string"&&(U={type:"text",value:U}),E.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+k+(T>1?"-"+T:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(h,T),className:["data-footnote-backref"]},children:Array.isArray(U)?U:[U]})}const M=v[v.length-1];if(M&&M.type==="element"&&M.tagName==="p"){const U=M.children[M.children.length-1];U&&U.type==="text"?U.value+=" ":M.children.push({type:"text",value:" "}),M.children.push(...E)}else v.push(...E);const A={type:"element",tagName:"li",properties:{id:e+"fn-"+k},children:t.wrap(v,!0)};t.patch(p,A),c.push(A)}if(c.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...CS(l),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:`
|
|
406
406
|
`},{type:"element",tagName:"ol",properties:{},children:t.wrap(c,!0)},{type:"text",value:`
|
|
407
|
-
`}]}}const kS=function(t){if(t==null)return LX;if(typeof t=="function")return TS(t);if(typeof t=="object")return Array.isArray(t)?AX(t):OX(t);if(typeof t=="string")return MX(t);throw new Error("Expected function, string, or object as test")};function AX(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=kS(t[n]);return TS(r);function r(...a){let s=-1;for(;++s<e.length;)if(e[s].apply(this,a))return!0;return!1}}function OX(t){const e=t;return TS(n);function n(r){const a=r;let s;for(s in t)if(a[s]!==e[s])return!1;return!0}}function MX(t){return TS(e);function e(n){return n&&n.type===t}}function TS(t){return e;function e(n,r,a){return!!(NX(n)&&t.call(this,n,typeof r=="number"?r:void 0,a||void 0))}}function LX(){return!0}function NX(t){return t!==null&&typeof t=="object"&&"type"in t}function
|
|
407
|
+
`}]}}const kS=function(t){if(t==null)return LX;if(typeof t=="function")return TS(t);if(typeof t=="object")return Array.isArray(t)?AX(t):OX(t);if(typeof t=="string")return MX(t);throw new Error("Expected function, string, or object as test")};function AX(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=kS(t[n]);return TS(r);function r(...a){let s=-1;for(;++s<e.length;)if(e[s].apply(this,a))return!0;return!1}}function OX(t){const e=t;return TS(n);function n(r){const a=r;let s;for(s in t)if(a[s]!==e[s])return!1;return!0}}function MX(t){return TS(e);function e(n){return n&&n.type===t}}function TS(t){return e;function e(n,r,a){return!!(NX(n)&&t.call(this,n,typeof r=="number"?r:void 0,a||void 0))}}function LX(){return!0}function NX(t){return t!==null&&typeof t=="object"&&"type"in t}function Xse(t){return t}const p5=[],IX=!0,s_=!1,UX="skip";function m5(t,e,n,r){let a;typeof e=="function"&&typeof n!="function"?(r=n,n=e):a=e;const s=kS(a),l=r?-1:1;c(t,void 0,[])();function c(h,p,v){const b=h&&typeof h=="object"?h:{};if(typeof b.type=="string"){const T=typeof b.tagName=="string"?b.tagName:typeof b.name=="string"?b.name:void 0;Object.defineProperty(k,"name",{value:"node ("+(h.type+(T?"<"+T+">":""))+")"})}return k;function k(){let T=p5,E,R,M;if((!e||s(h,p,v[v.length-1]||void 0))&&(T=FX(n(h,v)),T[0]===s_))return T;if("children"in h&&h.children){const A=h;if(A.children&&T[0]!==UX)for(R=(r?A.children.length:-1)+l,M=v.concat(A);R>-1&&R<A.children.length;){const U=A.children[R];if(E=c(U,R,M)(),E[0]===s_)return E;R=typeof E[1]=="number"?E[1]:R+l}}return T}}}function FX(t){return Array.isArray(t)?t:typeof t=="number"?[IX,t]:t==null?p5:[t]}function l_(t,e,n,r){let a,s,l;typeof e=="function"&&typeof n!="function"?(s=void 0,l=e,a=n):(s=e,l=n,a=r),m5(t,s,c,a);function c(h,p){const v=p[p.length-1],b=v?v.children.indexOf(h):void 0;return l(h,b,v)}}const u_={}.hasOwnProperty,jX={};function VX(t,e){const n=e||jX,r=new Map,a=new Map,s=new Map,l={...TX,...n.handlers},c={all:p,applyData:BX,definitionById:r,footnoteById:a,footnoteCounts:s,footnoteOrder:[],handlers:l,one:h,options:n,patch:zX,wrap:$X};return l_(t,function(v){if(v.type==="definition"||v.type==="footnoteDefinition"){const b=v.type==="definition"?r:a,k=String(v.identifier).toUpperCase();b.has(k)||b.set(k,v)}}),c;function h(v,b){const k=v.type,T=c.handlers[k];if(u_.call(c.handlers,k)&&T)return T(c,v,b);if(c.options.passThrough&&c.options.passThrough.includes(k)){if("children"in v){const{children:R,...M}=v,A=CS(M);return A.children=c.all(v),A}return CS(v)}return(c.options.unknownHandler||HX)(c,v,b)}function p(v){const b=[];if("children"in v){const k=v.children;let T=-1;for(;++T<k.length;){const E=c.one(k[T],v);if(E){if(T&&k[T-1].type==="break"&&(!Array.isArray(E)&&E.type==="text"&&(E.value=g5(E.value)),!Array.isArray(E)&&E.type==="element")){const R=E.children[0];R&&R.type==="text"&&(R.value=g5(R.value))}Array.isArray(E)?b.push(...E):b.push(E)}}}return b}}function zX(t,e){t.position&&(e.position=IK(t))}function BX(t,e){let n=e;if(t&&t.data){const r=t.data.hName,a=t.data.hChildren,s=t.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const l="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:l}}n.type==="element"&&s&&Object.assign(n.properties,CS(s)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function HX(t,e){const n=e.data||{},r="value"in e&&!(u_.call(n,"hProperties")||u_.call(n,"hChildren"))?{type:"text",value:e.value}:{type:"element",tagName:"div",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function $X(t,e){const n=[];let r=-1;for(e&&n.push({type:"text",value:`
|
|
408
408
|
`});++r<t.length;)r&&n.push({type:"text",value:`
|
|
409
409
|
`}),n.push(t[r]);return e&&t.length>0&&n.push({type:"text",value:`
|
|
410
410
|
`}),n}function g5(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function v5(t,e){const n=VX(t,e),r=n.one(t,void 0),a=DX(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return a&&s.children.push({type:"text",value:`
|
|
@@ -422,5 +422,5 @@ a=extmap-allow-mixed`)!==-1){const s=a.sdp.split(`
|
|
|
422
422
|
`))+1))}const l="#".repeat(a),c=n.enter("headingAtx"),h=n.enter("phrasing");s.move(l+" ");let p=n.containerPhrasing(t,{before:"# ",after:`
|
|
423
423
|
`,...s.current()});return/^[\t ]/.test(p)&&(p=Dv(p.charCodeAt(0))+p.slice(1)),p=p?l+" "+p:l,n.options.closeAtx&&(p+=" "+l),h(),c(),p}V5.peek=yee;function V5(t){return t.value||""}function yee(){return"<"}z5.peek=bee;function z5(t,e,n,r){const a=T_(n),s=a==='"'?"Quote":"Apostrophe",l=n.enter("image");let c=n.enter("label");const h=n.createTracker(r);let p=h.move("![");return p+=h.move(n.safe(t.alt,{before:p,after:"]",...h.current()})),p+=h.move("]("),c(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(c=n.enter("destinationLiteral"),p+=h.move("<"),p+=h.move(n.safe(t.url,{before:p,after:">",...h.current()})),p+=h.move(">")):(c=n.enter("destinationRaw"),p+=h.move(n.safe(t.url,{before:p,after:t.title?" ":")",...h.current()}))),c(),t.title&&(c=n.enter(`title${s}`),p+=h.move(" "+a),p+=h.move(n.safe(t.title,{before:p,after:a,...h.current()})),p+=h.move(a),c()),p+=h.move(")"),l(),p}function bee(){return"!"}B5.peek=See;function B5(t,e,n,r){const a=t.referenceType,s=n.enter("imageReference");let l=n.enter("label");const c=n.createTracker(r);let h=c.move("![");const p=n.safe(t.alt,{before:h,after:"]",...c.current()});h+=c.move(p+"]["),l();const v=n.stack;n.stack=[],l=n.enter("reference");const b=n.safe(n.associationId(t),{before:h,after:"]",...c.current()});return l(),n.stack=v,s(),a==="full"||!p||p!==b?h+=c.move(b+"]"):a==="shortcut"?h=h.slice(0,-1):h+=c.move("]"),h}function See(){return"!"}H5.peek=Cee;function H5(t,e,n){let r=t.value||"",a="`",s=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(r);)a+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s<n.unsafe.length;){const l=n.unsafe[s],c=n.compilePattern(l);let h;if(l.atBreak)for(;h=c.exec(r);){let p=h.index;r.charCodeAt(p)===10&&r.charCodeAt(p-1)===13&&p--,r=r.slice(0,p)+" "+r.slice(h.index+1)}}return a+r+a}function Cee(){return"`"}function $5(t,e){const n=Zw(t);return!!(!e.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(n===t.url||"mailto:"+n===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}q5.peek=kee;function q5(t,e,n,r){const a=T_(n),s=a==='"'?"Quote":"Apostrophe",l=n.createTracker(r);let c,h;if($5(t,n)){const v=n.stack;n.stack=[],c=n.enter("autolink");let b=l.move("<");return b+=l.move(n.containerPhrasing(t,{before:b,after:">",...l.current()})),b+=l.move(">"),c(),n.stack=v,b}c=n.enter("link"),h=n.enter("label");let p=l.move("[");return p+=l.move(n.containerPhrasing(t,{before:p,after:"](",...l.current()})),p+=l.move("]("),h(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(h=n.enter("destinationLiteral"),p+=l.move("<"),p+=l.move(n.safe(t.url,{before:p,after:">",...l.current()})),p+=l.move(">")):(h=n.enter("destinationRaw"),p+=l.move(n.safe(t.url,{before:p,after:t.title?" ":")",...l.current()}))),h(),t.title&&(h=n.enter(`title${s}`),p+=l.move(" "+a),p+=l.move(n.safe(t.title,{before:p,after:a,...l.current()})),p+=l.move(a),h()),p+=l.move(")"),c(),p}function kee(t,e,n){return $5(t,n)?"<":"["}W5.peek=Tee;function W5(t,e,n,r){const a=t.referenceType,s=n.enter("linkReference");let l=n.enter("label");const c=n.createTracker(r);let h=c.move("[");const p=n.containerPhrasing(t,{before:h,after:"]",...c.current()});h+=c.move(p+"]["),l();const v=n.stack;n.stack=[],l=n.enter("reference");const b=n.safe(n.associationId(t),{before:h,after:"]",...c.current()});return l(),n.stack=v,s(),a==="full"||!p||p!==b?h+=c.move(b+"]"):a==="shortcut"?h=h.slice(0,-1):h+=c.move("]"),h}function Tee(){return"["}function x_(t){const e=t.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}function xee(t){const e=x_(t),n=t.options.bulletOther;if(!n)return e==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+n+"`) to be different");return n}function wee(t){const e=t.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}function G5(t){const e=t.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}function _ee(t,e,n,r){const a=n.enter("list"),s=n.bulletCurrent;let l=t.ordered?wee(n):x_(n);const c=t.ordered?l==="."?")":".":xee(n);let h=e&&n.bulletLastUsed?l===n.bulletLastUsed:!1;if(!t.ordered){const v=t.children?t.children[0]:void 0;if((l==="*"||l==="-")&&v&&(!v.children||!v.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(h=!0),G5(n)===l&&v){let b=-1;for(;++b<t.children.length;){const k=t.children[b];if(k&&k.type==="listItem"&&k.children&&k.children[0]&&k.children[0].type==="thematicBreak"){h=!0;break}}}}h&&(l=c),n.bulletCurrent=l;const p=n.containerFlow(t,r);return n.bulletLastUsed=l,n.bulletCurrent=s,a(),p}function Eee(t){const e=t.options.listItemIndent||"one";if(e!=="tab"&&e!=="one"&&e!=="mixed")throw new Error("Cannot serialize items with `"+e+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return e}function Ree(t,e,n,r){const a=Eee(n);let s=n.bulletCurrent||x_(n);e&&e.type==="list"&&e.ordered&&(s=(typeof e.start=="number"&&e.start>-1?e.start:1)+(n.options.incrementListMarker===!1?0:e.children.indexOf(t))+s);let l=s.length+1;(a==="tab"||a==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(l=Math.ceil(l/4)*4);const c=n.createTracker(r);c.move(s+" ".repeat(l-s.length)),c.shift(l);const h=n.enter("listItem"),p=n.indentLines(n.containerFlow(t,c.current()),v);return h(),p;function v(b,k,T){return k?(T?"":" ".repeat(l))+b:(T?s:s+" ".repeat(l-s.length))+b}}function Pee(t,e,n,r){const a=n.enter("paragraph"),s=n.enter("phrasing"),l=n.containerPhrasing(t,r);return s(),a(),l}const Dee=kS(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Aee(t,e,n,r){return(t.children.some(function(l){return Dee(l)})?n.containerPhrasing:n.containerFlow).call(n,t,r)}function Oee(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}Y5.peek=Mee;function Y5(t,e,n,r){const a=Oee(n),s=n.enter("strong"),l=n.createTracker(r),c=l.move(a+a);let h=l.move(n.containerPhrasing(t,{after:a,before:c,...l.current()}));const p=h.charCodeAt(0),v=_S(r.before.charCodeAt(r.before.length-1),p,a);v.inside&&(h=Dv(p)+h.slice(1));const b=h.charCodeAt(h.length-1),k=_S(r.after.charCodeAt(0),b,a);k.inside&&(h=h.slice(0,-1)+Dv(b));const T=l.move(a+a);return s(),n.attentionEncodeSurroundingInfo={after:k.outside,before:v.outside},c+h+T}function Mee(t,e,n){return n.options.strong||"*"}function Lee(t,e,n,r){return n.safe(t.value,r)}function Nee(t){const e=t.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}function Iee(t,e,n){const r=(G5(n)+(n.options.ruleSpaces?" ":"")).repeat(Nee(n));return n.options.ruleSpaces?r.slice(0,-1):r}const K5={blockquote:aee,break:F5,code:dee,definition:hee,emphasis:j5,hardBreak:F5,heading:vee,html:V5,image:z5,imageReference:B5,inlineCode:H5,link:q5,linkReference:W5,list:_ee,listItem:Ree,paragraph:Pee,root:Aee,strong:Y5,text:Lee,thematicBreak:Iee};function Uee(){return{enter:{table:Fee,tableData:Z5,tableHeader:Z5,tableRow:Vee},exit:{codeText:zee,table:jee,tableData:w_,tableHeader:w_,tableRow:w_}}}function Fee(t){const e=t._align;this.enter({type:"table",align:e.map(function(n){return n==="none"?null:n}),children:[]},t),this.data.inTable=!0}function jee(t){this.exit(t),this.data.inTable=void 0}function Vee(t){this.enter({type:"tableRow",children:[]},t)}function w_(t){this.exit(t)}function Z5(t){this.enter({type:"tableCell",children:[]},t)}function zee(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,Bee));const n=this.stack[this.stack.length-1];n.type,n.value=e,this.exit(t)}function Bee(t,e){return e==="|"?e:t}function Hee(t){const e=t||{},n=e.tableCellPadding,r=e.tablePipeAlign,a=e.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
424
424
|
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:k,table:l,tableCell:h,tableRow:c}};function l(T,E,R,M){return p(v(T,R,M),T.align)}function c(T,E,R,M){const A=b(T,R,M),U=p([A]);return U.slice(0,U.indexOf(`
|
|
425
|
-
`))}function h(T,E,R,M){const A=R.enter("tableCell"),U=R.enter("phrasing"),V=R.containerPhrasing(T,{...M,before:s,after:s});return U(),A(),V}function p(T,E){return ree(T,{align:E,alignDelimiters:r,padding:n,stringLength:a})}function v(T,E,R){const M=T.children;let A=-1;const U=[],V=E.enter("table");for(;++A<M.length;)U[A]=b(M[A],E,R);return V(),U}function b(T,E,R){const M=T.children;let A=-1;const U=[],V=E.enter("tableRow");for(;++A<M.length;)U[A]=h(M[A],T,E,R);return V(),U}function k(T,E,R){let M=K5.inlineCode(T,E,R);return R.stack.includes("tableCell")&&(M=M.replace(/\|/g,"\\$&")),M}}function $ee(){return{exit:{taskListCheckValueChecked:Q5,taskListCheckValueUnchecked:Q5,paragraph:Wee}}}function qee(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Gee}}}function Q5(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function Wee(t){const e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const a=e.children;let s=-1,l;for(;++s<a.length;){const c=a[s];if(c.type==="paragraph"){l=c;break}}l===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(t)}function Gee(t,e,n,r){const a=t.children[0],s=typeof t.checked=="boolean"&&a&&a.type==="paragraph",l="["+(t.checked?"x":" ")+"] ",c=n.createTracker(r);s&&c.move(l);let h=K5.listItem(t,e,n,{...r,...c.current()});return s&&(h=h.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,p)),h;function p(v){return v+l}}function Yee(){return[wJ(),UJ(),QJ(),Uee(),$ee()]}function Kee(t){return{extensions:[_J(),FJ(),XJ(),Hee(t),qee()]}}const Zee={tokenize:nte,partial:!0},X5={tokenize:rte,partial:!0},J5={tokenize:ite,partial:!0},eU={tokenize:ate,partial:!0},Qee={tokenize:ote,partial:!0},tU={name:"wwwAutolink",tokenize:ete,previous:rU},nU={name:"protocolAutolink",tokenize:tte,previous:iU},Cu={name:"emailAutolink",tokenize:Jee,previous:aU},kl={};function Xee(){return{text:kl}}let mf=48;for(;mf<123;)kl[mf]=Cu,mf++,mf===58?mf=65:mf===91&&(mf=97);kl[43]=Cu,kl[45]=Cu,kl[46]=Cu,kl[95]=Cu,kl[72]=[Cu,nU],kl[104]=[Cu,nU],kl[87]=[Cu,tU],kl[119]=[Cu,tU];function Jee(t,e,n){const r=this;let a,s;return l;function l(b){return!__(b)||!aU.call(r,r.previous)||E_(r.events)?n(b):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),c(b))}function c(b){return __(b)?(t.consume(b),c):b===64?(t.consume(b),h):n(b)}function h(b){return b===46?t.check(Qee,v,p)(b):b===45||b===95||Sa(b)?(s=!0,t.consume(b),h):v(b)}function p(b){return t.consume(b),a=!0,h}function v(b){return s&&a&&za(r.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(b)):n(b)}}function ete(t,e,n){const r=this;return a;function a(l){return l!==87&&l!==119||!rU.call(r,r.previous)||E_(r.events)?n(l):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(Zee,t.attempt(X5,t.attempt(J5,s),n),n)(l))}function s(l){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(l)}}function tte(t,e,n){const r=this;let a="",s=!1;return l;function l(b){return(b===72||b===104)&&iU.call(r,r.previous)&&!E_(r.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),a+=String.fromCodePoint(b),t.consume(b),c):n(b)}function c(b){if(za(b)&&a.length<5)return a+=String.fromCodePoint(b),t.consume(b),c;if(b===58){const k=a.toLowerCase();if(k==="http"||k==="https")return t.consume(b),h}return n(b)}function h(b){return b===47?(t.consume(b),s?p:(s=!0,h)):n(b)}function p(b){return b===null||fS(b)||Sr(b)||pf(b)||hS(b)?n(b):t.attempt(X5,t.attempt(J5,v),n)(b)}function v(b){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(b)}}function nte(t,e,n){let r=0;return a;function a(l){return(l===87||l===119)&&r<3?(r++,t.consume(l),a):l===46&&r===3?(t.consume(l),s):n(l)}function s(l){return l===null?n(l):e(l)}}function rte(t,e,n){let r,a,s;return l;function l(p){return p===46||p===95?t.check(eU,h,c)(p):p===null||Sr(p)||pf(p)||p!==45&&hS(p)?h(p):(s=!0,t.consume(p),l)}function c(p){return p===95?r=!0:(a=r,r=void 0),t.consume(p),l}function h(p){return a||r||!s?n(p):e(p)}}function ite(t,e){let n=0,r=0;return a;function a(l){return l===40?(n++,t.consume(l),a):l===41&&r<n?s(l):l===33||l===34||l===38||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===60||l===63||l===93||l===95||l===126?t.check(eU,e,s)(l):l===null||Sr(l)||pf(l)?e(l):(t.consume(l),a)}function s(l){return l===41&&r++,t.consume(l),a}}function ate(t,e,n){return r;function r(c){return c===33||c===34||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===63||c===95||c===126?(t.consume(c),r):c===38?(t.consume(c),s):c===93?(t.consume(c),a):c===60||c===null||Sr(c)||pf(c)?e(c):n(c)}function a(c){return c===null||c===40||c===91||Sr(c)||pf(c)?e(c):r(c)}function s(c){return za(c)?l(c):n(c)}function l(c){return c===59?(t.consume(c),r):za(c)?(t.consume(c),l):n(c)}}function ote(t,e,n){return r;function r(s){return t.consume(s),a}function a(s){return Sa(s)?n(s):e(s)}}function rU(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||Sr(t)}function iU(t){return!za(t)}function aU(t){return!(t===47||__(t))}function __(t){return t===43||t===45||t===46||t===95||Sa(t)}function E_(t){let e=t.length,n=!1;for(;e--;){const r=t[e][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return t.length>0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const ste={tokenize:mte,partial:!0};function lte(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:fte,continuation:{tokenize:hte},exit:pte}},text:{91:{name:"gfmFootnoteCall",tokenize:dte},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:ute,resolveTo:cte}}}}function ute(t,e,n){const r=this;let a=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l;for(;a--;){const h=r.events[a][1];if(h.type==="labelImage"){l=h;break}if(h.type==="gfmFootnoteCall"||h.type==="labelLink"||h.type==="label"||h.type==="image"||h.type==="link")break}return c;function c(h){if(!l||!l._balanced)return n(h);const p=Ns(r.sliceSerialize({start:l.end,end:r.now()}));return p.codePointAt(0)!==94||!s.includes(p.slice(1))?n(h):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(h),t.exit("gfmFootnoteCallLabelMarker"),e(h))}}function cte(t,e){let n=t.length;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},t[t.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},c=[t[n+1],t[n+2],["enter",r,e],t[n+3],t[n+4],["enter",a,e],["exit",a,e],["enter",s,e],["enter",l,e],["exit",l,e],["exit",s,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...c),t}function dte(t,e,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,l;return c;function c(b){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(b),t.exit("gfmFootnoteCallLabelMarker"),h}function h(b){return b!==94?n(b):(t.enter("gfmFootnoteCallMarker"),t.consume(b),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",p)}function p(b){if(s>999||b===93&&!l||b===null||b===91||Sr(b))return n(b);if(b===93){t.exit("chunkString");const k=t.exit("gfmFootnoteCallString");return a.includes(Ns(r.sliceSerialize(k)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(b),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(b)}return Sr(b)||(l=!0),s++,t.consume(b),b===92?v:p}function v(b){return b===91||b===92||b===93?(t.consume(b),s++,p):p(b)}}function fte(t,e,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,l=0,c;return h;function h(E){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(E),t.exit("gfmFootnoteDefinitionLabelMarker"),p}function p(E){return E===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(E),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",v):n(E)}function v(E){if(l>999||E===93&&!c||E===null||E===91||Sr(E))return n(E);if(E===93){t.exit("chunkString");const R=t.exit("gfmFootnoteDefinitionLabelString");return s=Ns(r.sliceSerialize(R)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(E),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),k}return Sr(E)||(c=!0),l++,t.consume(E),E===92?b:v}function b(E){return E===91||E===92||E===93?(t.consume(E),l++,v):v(E)}function k(E){return E===58?(t.enter("definitionMarker"),t.consume(E),t.exit("definitionMarker"),a.includes(s)||a.push(s),Vn(t,T,"gfmFootnoteDefinitionWhitespace")):n(E)}function T(E){return e(E)}}function hte(t,e,n){return t.check(wv,e,t.attempt(ste,e,n))}function pte(t){t.exit("gfmFootnoteDefinition")}function mte(t,e,n){const r=this;return Vn(t,a,"gfmFootnoteDefinitionIndent",5);function a(s){const l=r.events[r.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?e(s):n(s)}}function gte(t){let n=(t||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:a};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function a(l,c){let h=-1;for(;++h<l.length;)if(l[h][0]==="enter"&&l[h][1].type==="strikethroughSequenceTemporary"&&l[h][1]._close){let p=h;for(;p--;)if(l[p][0]==="exit"&&l[p][1].type==="strikethroughSequenceTemporary"&&l[p][1]._open&&l[h][1].end.offset-l[h][1].start.offset===l[p][1].end.offset-l[p][1].start.offset){l[h][1].type="strikethroughSequence",l[p][1].type="strikethroughSequence";const v={type:"strikethrough",start:Object.assign({},l[p][1].start),end:Object.assign({},l[h][1].end)},b={type:"strikethroughText",start:Object.assign({},l[p][1].end),end:Object.assign({},l[h][1].start)},k=[["enter",v,c],["enter",l[p][1],c],["exit",l[p][1],c],["enter",b,c]],T=c.parser.constructs.insideSpan.null;T&&Mo(k,k.length,0,pS(T,l.slice(p+1,h),c)),Mo(k,k.length,0,[["exit",b,c],["enter",l[h][1],c],["exit",l[h][1],c],["exit",v,c]]),Mo(l,p-1,h-p+3,k),h=p+k.length-2;break}}for(h=-1;++h<l.length;)l[h][1].type==="strikethroughSequenceTemporary"&&(l[h][1].type="data");return l}function s(l,c,h){const p=this.previous,v=this.events;let b=0;return k;function k(E){return p===126&&v[v.length-1][1].type!=="characterEscape"?h(E):(l.enter("strikethroughSequenceTemporary"),T(E))}function T(E){const R=Cp(p);if(E===126)return b>1?h(E):(l.consume(E),b++,T);if(b<2&&!n)return h(E);const M=l.exit("strikethroughSequenceTemporary"),A=Cp(E);return M._open=!A||A===2&&!!R,M._close=!R||R===2&&!!A,c(E)}}}class vte{constructor(){this.map=[]}add(e,n,r){yte(this,e,n,r)}consume(e){if(this.map.sort(function(s,l){return s[0]-l[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(e.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),e.length=this.map[n][0];r.push([...e]),e.length=0;let a=r.pop();for(;a;)e.push(...a),a=r.pop();this.map.length=0}}function yte(t,e,n,r){let a=0;if(!(n===0&&r.length===0)){for(;a<t.map.length;){if(t.map[a][0]===e){t.map[a][1]+=n,t.map[a][2].push(...r);return}a+=1}t.map.push([e,n,r])}}function bte(t,e){let n=!1;const r=[];for(;e<t.length;){const a=t[e];if(n){if(a[0]==="enter")a[1].type==="tableContent"&&r.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(a[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){const s=r.length-1;r[s]=r[s]==="left"?"center":"right"}}else if(a[1].type==="tableDelimiterRow")break}else a[0]==="enter"&&a[1].type==="tableDelimiterRow"&&(n=!0);e+=1}return r}function Ste(){return{flow:{null:{name:"table",tokenize:Cte,resolveAll:kte}}}}function Cte(t,e,n){const r=this;let a=0,s=0,l;return c;function c($){let oe=r.events.length-1;for(;oe>-1;){const ke=r.events[oe][1].type;if(ke==="lineEnding"||ke==="linePrefix")oe--;else break}const J=oe>-1?r.events[oe][1].type:null,xe=J==="tableHead"||J==="tableRow"?N:h;return xe===N&&r.parser.lazy[r.now().line]?n($):xe($)}function h($){return t.enter("tableHead"),t.enter("tableRow"),p($)}function p($){return $===124||(l=!0,s+=1),v($)}function v($){return $===null?n($):Bt($)?s>1?(s=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume($),t.exit("lineEnding"),T):n($):Pn($)?Vn(t,v,"whitespace")($):(s+=1,l&&(l=!1,a+=1),$===124?(t.enter("tableCellDivider"),t.consume($),t.exit("tableCellDivider"),l=!0,v):(t.enter("data"),b($)))}function b($){return $===null||$===124||Sr($)?(t.exit("data"),v($)):(t.consume($),$===92?k:b)}function k($){return $===92||$===124?(t.consume($),b):b($)}function T($){return r.interrupt=!1,r.parser.lazy[r.now().line]?n($):(t.enter("tableDelimiterRow"),l=!1,Pn($)?Vn(t,E,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):E($))}function E($){return $===45||$===58?M($):$===124?(l=!0,t.enter("tableCellDivider"),t.consume($),t.exit("tableCellDivider"),R):I($)}function R($){return Pn($)?Vn(t,M,"whitespace")($):M($)}function M($){return $===58?(s+=1,l=!0,t.enter("tableDelimiterMarker"),t.consume($),t.exit("tableDelimiterMarker"),A):$===45?(s+=1,A($)):$===null||Bt($)?j($):I($)}function A($){return $===45?(t.enter("tableDelimiterFiller"),U($)):I($)}function U($){return $===45?(t.consume($),U):$===58?(l=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume($),t.exit("tableDelimiterMarker"),V):(t.exit("tableDelimiterFiller"),V($))}function V($){return Pn($)?Vn(t,j,"whitespace")($):j($)}function j($){return $===124?E($):$===null||Bt($)?!l||a!==s?I($):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e($)):I($)}function I($){return n($)}function N($){return t.enter("tableRow"),ne($)}function ne($){return $===124?(t.enter("tableCellDivider"),t.consume($),t.exit("tableCellDivider"),ne):$===null||Bt($)?(t.exit("tableRow"),e($)):Pn($)?Vn(t,ne,"whitespace")($):(t.enter("data"),X($))}function X($){return $===null||$===124||Sr($)?(t.exit("data"),ne($)):(t.consume($),$===92?se:X)}function se($){return $===92||$===124?(t.consume($),X):X($)}}function kte(t,e){let n=-1,r=!0,a=0,s=[0,0,0,0],l=[0,0,0,0],c=!1,h=0,p,v,b;const k=new vte;for(;++n<t.length;){const T=t[n],E=T[1];T[0]==="enter"?E.type==="tableHead"?(c=!1,h!==0&&(oU(k,e,h,p,v),v=void 0,h=0),p={type:"table",start:Object.assign({},E.start),end:Object.assign({},E.end)},k.add(n,0,[["enter",p,e]])):E.type==="tableRow"||E.type==="tableDelimiterRow"?(r=!0,b=void 0,s=[0,0,0,0],l=[0,n+1,0,0],c&&(c=!1,v={type:"tableBody",start:Object.assign({},E.start),end:Object.assign({},E.end)},k.add(n,0,[["enter",v,e]])),a=E.type==="tableDelimiterRow"?2:v?3:1):a&&(E.type==="data"||E.type==="tableDelimiterMarker"||E.type==="tableDelimiterFiller")?(r=!1,l[2]===0&&(s[1]!==0&&(l[0]=l[1],b=ES(k,e,s,a,void 0,b),s=[0,0,0,0]),l[2]=n)):E.type==="tableCellDivider"&&(r?r=!1:(s[1]!==0&&(l[0]=l[1],b=ES(k,e,s,a,void 0,b)),s=l,l=[s[1],n,0,0])):E.type==="tableHead"?(c=!0,h=n):E.type==="tableRow"||E.type==="tableDelimiterRow"?(h=n,s[1]!==0?(l[0]=l[1],b=ES(k,e,s,a,n,b)):l[1]!==0&&(b=ES(k,e,l,a,n,b)),a=0):a&&(E.type==="data"||E.type==="tableDelimiterMarker"||E.type==="tableDelimiterFiller")&&(l[3]=n)}for(h!==0&&oU(k,e,h,p,v),k.consume(e.events),n=-1;++n<e.events.length;){const T=e.events[n];T[0]==="enter"&&T[1].type==="table"&&(T[1]._align=bte(e.events,n))}return t}function ES(t,e,n,r,a,s){const l=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",c="tableContent";n[0]!==0&&(s.end=Object.assign({},Tp(e.events,n[0])),t.add(n[0],0,[["exit",s,e]]));const h=Tp(e.events,n[1]);if(s={type:l,start:Object.assign({},h),end:Object.assign({},h)},t.add(n[1],0,[["enter",s,e]]),n[2]!==0){const p=Tp(e.events,n[2]),v=Tp(e.events,n[3]),b={type:c,start:Object.assign({},p),end:Object.assign({},v)};if(t.add(n[2],0,[["enter",b,e]]),r!==2){const k=e.events[n[2]],T=e.events[n[3]];if(k[1].end=Object.assign({},T[1].end),k[1].type="chunkText",k[1].contentType="text",n[3]>n[2]+1){const E=n[2]+1,R=n[3]-n[2]-1;t.add(E,R,[])}}t.add(n[3]+1,0,[["exit",b,e]])}return a!==void 0&&(s.end=Object.assign({},Tp(e.events,a)),t.add(a,0,[["exit",s,e]]),s=void 0),s}function oU(t,e,n,r,a){const s=[],l=Tp(e.events,n);a&&(a.end=Object.assign({},l),s.push(["exit",a,e])),r.end=Object.assign({},l),s.push(["exit",r,e]),t.add(n+1,0,s)}function Tp(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const Tte={name:"tasklistCheck",tokenize:wte};function xte(){return{text:{91:Tte}}}function wte(t,e,n){const r=this;return a;function a(h){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(h):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(h),t.exit("taskListCheckMarker"),s)}function s(h){return Sr(h)?(t.enter("taskListCheckValueUnchecked"),t.consume(h),t.exit("taskListCheckValueUnchecked"),l):h===88||h===120?(t.enter("taskListCheckValueChecked"),t.consume(h),t.exit("taskListCheckValueChecked"),l):n(h)}function l(h){return h===93?(t.enter("taskListCheckMarker"),t.consume(h),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),c):n(h)}function c(h){return Bt(h)?e(h):Pn(h)?t.check({tokenize:_te},e,n)(h):n(h)}}function _te(t,e,n){return Vn(t,r,"whitespace");function r(a){return a===null?n(a):e(a)}}function Ete(t){return I4([Xee(),lte(),gte(t),Ste(),xte()])}const Rte={};function Pte(t){const e=this,n=t||Rte,r=e.data(),a=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),l=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);a.push(Ete(n)),s.push(Yee()),l.push(Kee(n))}const Dte=({itemIndex:t,message:e})=>{const n=Zo(),r=WW(e.name),a=r?n.textColor:n.primaryTextColor;return W.jsx("div",{className:xr("ringg_ai-flex ringg_ai-flex-col ringg_ai-items-start ringg_ai-gap-1 ringg_ai-justify-start",r?"ringg_ai-flex-row":"ringg_ai-flex-row-reverse"),children:W.jsx("div",{className:xr("ringg_ai-flex ringg_ai-items-center ringg_ai-justify-start ringg_ai-gap-2 ringg_ai-px-4 ringg_ai-py-2 ringg_ai-rounded-xl ringg_ai-max-w-[90%]",r?"ringg_ai-mr-auto ringg_ai-text-left ringg_ai-rounded-bl-none":"ringg_ai-ml-auto ringg_ai-text-right ringg_ai-rounded-br-none"),style:{backgroundColor:r?n.surfaceColor:n.primaryColor,color:a},children:W.jsxs("div",{className:"ringg_ai-flex ringg_ai-flex-col ringg_ai-gap-2.5 ringg_ai-w-full ringg_ai-overflow-x-auto",children:[W.jsx("div",{className:"ringg_ai-prose ringg_ai-prose-sm ringg_ai-max-w-none [&_p]:ringg_ai-text-sm [&_li]:ringg_ai-text-sm [&_table]:ringg_ai-w-max",style:{"--tw-prose-body":a,"--tw-prose-headings":a,"--tw-prose-bold":a,"--tw-prose-counters":a,"--tw-prose-bullets":a,"--tw-prose-quotes":a,"--tw-prose-code":a,"--tw-prose-th-borders":n.borderColor,"--tw-prose-td-borders":n.borderColor,color:a},children:W.jsx(mJ,{remarkPlugins:[Pte],children:e.message})}),(e==null?void 0:e.sourceUrl)&&W.jsxs("a",{href:e.sourceUrl,target:"_blank",rel:"noopener noreferrer",className:"ringg_ai-text-sm ringg_ai-break-all ringg_ai-w-fit ringg_ai-hover:underline",style:{color:r?n.primaryColor:n.primaryTextColor},children:["Source: ",e.sourceUrl]})]})},`${e.name}__${t}`)},`${e.timestamp}__${t}`)};function Ate({tabs:t=[],activeTab:e="voice-call",onTabChange:n}){const r=Zo(),[a,s]=G.useState(e),l=c=>{s(c),n==null||n(c)};return W.jsx("div",{className:"ringg_ai-w-full ringg_ai-border-t",style:{backgroundColor:r.backgroundColor,borderColor:r.borderColor},children:W.jsx("div",{className:"ringg_ai-flex ringg_ai-items-center ringg_ai-px-0",children:t.map(c=>{const h=c.icon,p=a===c.id,v=p?r.primaryColor:r.mutedTextColor;return W.jsxs("button",{onClick:()=>l(c.id),className:xr("ringg_ai-flex ringg_ai-flex-col ringg_ai-items-center ringg_ai-gap-1 ringg_ai-border-t-2 ringg_ai-py-3 ringg_ai-transition-all ringg_ai-duration-200 ringg_ai-flex-1"),style:{borderTopColor:p?r.primaryColor:"transparent"},children:[W.jsx(h,{className:"ringg_ai-w-5 ringg_ai-h-5 ringg_ai-transition-colors",fill:v,style:{color:v}}),W.jsx("span",{className:"ringg_ai-text-xs ringg_ai-font-medium ringg_ai-transition-colors",style:{color:v},children:c.label})]},c.id)})})})}const Ote=Y3("ringg_ai-inline-flex ringg_ai-items-center ringg_ai-justify-center ringg_ai-gap-2 ringg_ai-whitespace-nowrap ringg_ai-rounded-md ringg_ai-text-sm ringg_ai-font-medium ringg_ai-ring-offset-background ringg_ai-transition-colors focus-visible:ringg_ai-outline-none focus-visible:ringg_ai-ring-2 focus-visible:ringg_ai-ring-ring focus-visible:ringg_ai-ring-offset-2 disabled:ringg_ai-pointer-events-none disabled:ringg_ai-opacity-50 [&_svg]:ringg_ai-pointer-events-none [&_svg]:ringg_ai-size-4 [&_svg]:ringg_ai-shrink-0",{variants:{variant:{default:"ringg_ai-bg-primary ringg_ai-text-primary-foreground ringg_ai-shadow hover:ringg_ai-bg-primary/90",destructive:"ringg_ai-bg-destructive ringg_ai-text-destructive-foreground ringg_ai-shadow-sm hover:ringg_ai-bg-destructive/90",outline:"ringg_ai-border ringg_ai-border-input ringg_ai-bg-background ringg_ai-shadow-sm hover:ringg_ai-bg-accent hover:ringg_ai-text-accent-foreground",secondary:"ringg_ai-bg-secondary ringg_ai-text-secondary-foreground ringg_ai-shadow-sm hover:ringg_ai-bg-secondary/80",ghost:"hover:ringg_ai-bg-accent hover:ringg_ai-text-accent-foreground",link:"ringg_ai-text-primary ringg_ai-underline-offset-4 hover:ringg_ai-underline"},size:{default:"ringg_ai-h-9 ringg_ai-px-4 ringg_ai-py-2",sm:"ringg_ai-h-8 ringg_ai-rounded-md ringg_ai-px-3 ringg_ai-text-xs",lg:"ringg_ai-h-10 ringg_ai-rounded-md ringg_ai-px-8",icon:"ringg_ai-h-9 ringg_ai-w-9"}},defaultVariants:{variant:"default",size:"default"}}),Av=G.forwardRef(({className:t,variant:e,size:n,asChild:r=!1,...a},s)=>{const l=r?uS:"button";return W.jsx(l,{className:xr(Ote({variant:e,size:n,className:t})),ref:s,...a})});Av.displayName="Button";function Bc(t,e){typeof window<"u"&&window.dispatchEvent(new CustomEvent(t,{detail:e}))}function Mte({callMode:t}){const[e,n]=G.useState(!1),[r,a]=G.useState(!1),[s,l]=G.useState(null),c=G.useRef(!1),h=G.useRef(t);h.current=t;const p=G.useCallback(()=>{c.current||(c.current=!0,n(!0),Bc("ringg:widget_status",{status:"maximised",mode:h.current}))},[]),v=G.useCallback(()=>{c.current=!1,n(!1),Bc("ringg:widget_status",{status:"minimised",mode:h.current})},[]),b=G.useCallback(()=>{a(!1),l(null),v()},[v]),k=G.useCallback(()=>{c.current?v():p()},[p,v]);return G.useMemo(()=>({isOpen:e,showFeedback:r,currentCallId:s,setShowFeedback:a,setCurrentCallId:l,open:p,minimize:v,close:b,toggle:k}),[e,r,s,p,v,b,k])}function Lte({room:t,onError:e}){const[n,r]=G.useState("unknown"),a=G.useRef(e);a.current=e;const s=G.useCallback(async()=>{var h;try{if((h=navigator.permissions)!=null&&h.query){const p=await navigator.permissions.query({name:"microphone"});r(p.state),p.onchange=()=>{r(p.state)}}else try{await navigator.mediaDevices.getUserMedia({audio:!0}),r("granted")}catch{r("denied")}}catch(p){console.error("Error checking microphone permission:",p),r("unknown")}},[]),l=G.useCallback(async()=>{var h;try{const p=await navigator.mediaDevices.getUserMedia({audio:!0});return r("granted"),p.getTracks().forEach(v=>v.stop()),!0}catch(p){return console.error("Error requesting microphone permission:",p),r("denied"),(h=a.current)==null||h.call(a,"Microphone access was denied. Please enable it in your browser settings."),!1}},[]);G.useEffect(()=>{s();const h=()=>{var p;(p=a.current)==null||p.call(a,"Error acquiring microphone permission. Please make sure you grant the necessary permissions in your browser and reload the tab"),r("denied")};return t.on(Ee.MediaDevicesError,h),()=>{t.off(Ee.MediaDevicesError,h)}},[t,s]);const c=n==="granted";return G.useMemo(()=>({state:n,isGranted:c,check:s,request:l}),[n,c,s,l])}function Nte({containerRef:t,enabled:e}){G.useEffect(()=>{const n=t.current;if(!n||!e)return;const r=c=>{const h=n.querySelector('[data-scrollable="true"]');if(!h){c.preventDefault();return}const{scrollTop:p,scrollHeight:v,clientHeight:b}=h,k=p===0&&c.deltaY<0,T=p+b>=v-1&&c.deltaY>0;(k||T)&&c.preventDefault()};let a=0;const s=c=>{a=c.touches[0].clientY},l=c=>{const h=n.querySelector('[data-scrollable="true"]'),p=c.touches[0].clientY,v=a-p;if(!h){c.preventDefault();return}const{scrollTop:b,scrollHeight:k,clientHeight:T}=h,E=b===0&&v<0,R=b+T>=k-1&&v>0;(E||R)&&c.preventDefault()};return n.addEventListener("wheel",r,{passive:!1}),n.addEventListener("touchstart",s,{passive:!0}),n.addEventListener("touchmove",l,{passive:!1}),()=>{n.removeEventListener("wheel",r),n.removeEventListener("touchstart",s),n.removeEventListener("touchmove",l)}},[e])}const xp={mode:"prod",title:"Ringg AI Support",description:"Ringg AI offers 24/7 voice support to handle your business calls efficiently and professionally",defaultTab:"audio",hideTabSelector:!1,notificationTuneUrl:"https://assets.ringg.ai/audios/misc/widget_notification.mp3"};function R_(t){switch(t){case"dev":return"https://calling-dev.ringg.ai/ca/api/v0";case"stage":return"https://stage-api2.desivocal.com/ca/api/v0";default:return"https://prod-api.ringg.ai/ca/api/v0"}}function Ite(t){switch(t){case"dev":return"wss://ringg-ai-dev-92tubwpz.livekit.cloud";case"stage":return"wss://ringg-ai-ujrjmhgy.livekit.cloud";default:return"wss://ringg-ai-prod-r0vhjzhs.livekit.cloud"}}function Xse(t){return t}const sU={center:{top:0,left:0,right:0,bottom:0,margin:"auto"},"top-left":{top:"2%",left:"2%"},"top-right":{top:"2%",right:"2%"},"bottom-left":{bottom:"2%",left:"2%"},"bottom-right":{bottom:"2%",right:"2%"},"bottom-center":{bottom:"2%",left:"50%"}};function Ute(t){return sU[t]??sU["bottom-right"]}function Fte(t){return t==="bottom-center"?{left:"50%"}:t==="bottom-left"?{left:"2%"}:{right:"2%"}}function RS(t){if(t!==void 0)return typeof t=="number"?`${t}px`:t}function jte(t){return t?{width:RS(t.width),height:RS(t.height),borderRadius:RS(t.borderRadius)}:{}}function Vte(t,e){if(!e)return t;let n=[t];return Object.entries(e).forEach(([r,a])=>{n=n.flatMap((s,l)=>{if(typeof s!="string")return s;const c=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),h=new RegExp(`\\b(${c})\\b`,"g");return s.split(h).map((p,v)=>p===r?W.jsx("a",{target:"_blank",rel:"noopener noreferrer",className:"ringg_ai-text-blue-500 hover:ringg_ai-underline",href:a,children:r},`${l}-${v}`):p)})}),n}const zte=({room:t,config:e})=>{var Hi,Ji,ea,co,es,ts,fo;const[n,r]=G.useState({}),a=e,{mode:s=xp.mode,title:l=xp.title,description:c=xp.description,agentId:h,variables:p,buttons:v,xApiKey:b="",defaultTab:k=xp.defaultTab,hideTabSelector:T=xp.hideTabSelector,innerWindowProps:E,logoUrl:R,logoStyles:M,legalDisclaimer:A,feedbackScreen:U,notificationTuneUrl:V=xp.notificationTuneUrl,widgetPosition:j,theme:I}=a,N=WI(I),ne=mw(N.buttonStyle),X=(j==null?void 0:j.triggerPlacement)??"fixed",se=(j==null?void 0:j.triggerAlignment)??"bottom-right",$=(j==null?void 0:j.hideTriggerOnExpand)??!0,oe=(j==null?void 0:j.widgetAlignment)??"bottom-right",J=Ute(se),xe=jte(E),[ke,Ge]=G.useState(k),[Je,je]=G.useState(!1),[ve,He]=G.useState(!1),[z,ee]=G.useState({hasError:!1,message:""}),[Ce,H]=G.useState([]),[Ct,Rt]=G.useState(new Map),ht=G.useRef(null),bt=G.useRef(null),it=G.useRef(null),xt=G.useRef(""),tn=G.useRef(),qn=G.useRef(new Set),_r=G.useRef(null),vr=G.useRef(!1),Xn=G.useRef(new Map),Nr=ex(t),bn=Nr==="connected",Lt=Mte({callMode:ke}),Z=Lte({room:t,onError:et=>ee({hasError:!0,message:et})});Nte({containerRef:bt,enabled:Lt.isOpen});const{chatMessages:le}=$M(),me=hB(),Ve=aB(),ze=HM(),Oe=tx(me.audioTrack||void 0),ut=tx({publication:Ve.microphoneTrack,source:De.Source.Microphone,participant:Ve.localParticipant}),Nt=G.useMemo(()=>ze.find(et=>{var Me;return(Me=et.identity)==null?void 0:Me.includes("agent")}),[ze]),fe=G.useCallback((et,Me)=>{vr.current=!1,console.log("%c[Conversation Started]","background: #22c55e; color: white; padding: 2px 6px; border-radius: 3px;",{mode:et,callId:Me}),Bc("ringg:conversation_status",{status:"started",mode:et,callId:Me})},[]),Re=G.useCallback((et,Me)=>{vr.current||(vr.current=!0,console.log("%c[Conversation Ended]","background: #ef4444; color: white; padding: 2px 6px; border-radius: 3px;",{mode:et,callId:Me}),Bc("ringg:conversation_status",{status:"ended",mode:et,callId:Me}))},[]),vt=G.useCallback(async et=>{if(!(et==="audio"&&!Z.isGranted&&!await Z.request())){je(!0),Ge(et);try{const Me=await fetch(`${R_(s)}/calling/webcall`,{method:"POST",body:JSON.stringify({agent_id:h,custom_args_values:p,media_type:et}),headers:{"Content-Type":"application/json","X-API-KEY":b}}),It=await Me.json();if(!Me.ok)throw new Error((It==null?void 0:It.message)||"Failed to make call");It!=null&&It.call_id&&Lt.setCurrentCallId(It.call_id),await t.connect(Ite(s),It==null?void 0:It.user_token),et==="audio"&&await t.localParticipant.setMicrophoneEnabled(!0),fe(et,It.call_id),ee({hasError:!1,message:""})}catch(Me){ee({hasError:!0,message:Me.message})}finally{je(!1)}}},[t,s,h,p,b,Z,Lt,fe]),Ft=G.useCallback(async()=>{je(!0);try{Lt.currentCallId&&Re(ke,Lt.currentCallId),H([]),Rt(new Map),qn.current=new Set,xt.current="",tn.current=void 0,t.disconnect(),He(!1),Lt.setShowFeedback(!0),Lt.open()}catch(et){ee({hasError:!0,message:"Error ending call: "+et.message})}finally{je(!1)}},[t,ke,Lt,Re]),Kt=G.useCallback(async(et,Me)=>{if(!Lt.currentCallId){Lt.close();return}je(!0);try{await fetch(`${R_(s)}/calling/${Lt.currentCallId}/feedback`,{method:"POST",body:JSON.stringify({rating:et,comment:Me}),headers:{"Content-Type":"application/json","X-API-KEY":b}}),Bc("ringg:feedback_status",{status:"submitted",callId:Lt.currentCallId,rating:et})}catch(It){console.error("Error submitting feedback:",It)}finally{je(!1),Lt.close()}},[s,b,Lt]),Be=G.useCallback(()=>{Lt.currentCallId&&Bc("ringg:feedback_status",{status:"skipped",callId:Lt.currentCallId}),Lt.close()},[Lt]),ct=G.useCallback(et=>{var It;const Me={name:"Agent",message:"",isSelf:!1,timestamp:Date.now()+Math.random(),componentType:et.component_type,componentData:et};H(Ht=>[...Ht,Me]),Bc("ringg:calendar_booking",{status:"shown",componentId:et.component_id}),(It=it.current)==null||It.play().catch(()=>{}),Lt.open()},[Lt]),At=G.useCallback(et=>{qn.current.add(et),Bc("ringg:calendar_booking",{status:"confirmed",componentId:et,message:"Flow completed"})},[]),ln=G.useCallback(async(et,Me)=>{const It=Xn.current.get(et);if(!It){console.warn(`[RPC] No pending response found for component: ${et}`);return}if(!Nt){console.warn("[RPC] No agent participant found to send response to");return}const{name:Ht,originalConfig:Sn}=It,jt="receive_dynamic_data";let Cn;if(Ht==="calendar"){const Er=Me.step_data&&Me.step_data.slot_id;Cn=(Array.isArray(Sn)?Sn:[]).find(Xe=>Xe.id===Er)||{id:Er,datetime:Me.step_data&&Me.step_data.slot_datetime}}else if(Ht==="form")Cn=Me.step_data||Me.all_data;else if(Ht==="buttons"){const Er=Me.step_data&&Me.step_data.selected_button;Cn=(Array.isArray(Sn)?Sn:[]).find(Xe=>Xe.id===Er)||{id:Er}}else Cn=Me;const er=JSON.stringify({componant_type:`receive_component_${Ht}`,component_id:et,componant_data:Cn});try{console.log(`[RPC] Sending ${jt}:`,er);const Er=await Ve.localParticipant.performRpc({destinationIdentity:Nt.identity,method:jt,payload:er});console.log(`[RPC] Response from ${jt}:`,Er),Xn.current.delete(et)}catch(Er){console.error(`[RPC] Error sending ${jt}:`,Er)}},[Nt,Ve.localParticipant]),En=G.useMemo(()=>null,[]),un=G.useCallback(async(et,Me,It)=>(await fetch(Me.startsWith("http")?Me:`${R_(s)}${Me}`,{method:et,body:JSON.stringify(It),headers:{"Content-Type":"application/json","X-API-KEY":b}})).json(),[s,b,bn,En]),Dn=G.useCallback(async et=>{try{const Me=JSON.parse(et.payload);return Array.isArray(Me.source_urls)?xt.current=Me.source_urls.join(", "):Me.source_url&&(xt.current=Me.source_url),JSON.stringify({status:"received"})}catch(Me){throw console.error("Failed to parse RPC payload:",Me),new Error("Invalid payload for send_source_urls")}},[]),Wn=G.useCallback(async et=>{try{console.log("Received dynamic data:",et.payload);const Me=JSON.parse(et.payload);return Me.component_type&&Me.component_id&&ct(Me),JSON.stringify({status:"received"})}catch(Me){throw console.error("Failed to parse component payload:",Me),new Error("Invalid component payload")}},[ct]),Jn=G.useCallback((et,Me)=>{const It=`${et}_${Date.now()}`,Ht=Me.componant_config||Me.component_config;if(et==="calendar"){const Sn=Array.isArray(Ht)?Ht:[];return{component_type:"calendar_booking",component_id:It,data:{available_slots:Sn.map(jt=>({id:jt.id,datetime:jt.datetime})),timezone:Me.timezone||"UTC",title:Me.title||"Select a time slot"},actions:{on_select:{method:"POST",endpoint:"/mock/calendar",payload:{selected_slot_id:"{slot_id}"}}}}}return et==="form"?{component_type:"form",component_id:It,data:{title:Me.title||"Form",description:Me.description,fields:Array.isArray(Ht)?Ht:[],submit_label:Me.submit_label},actions:{on_submit:{method:"POST",endpoint:"/mock/form",payload:{form_data:"{form_data}"}}}}:et==="buttons"?{component_type:"buttons",component_id:It,data:{title:Me.title,buttons:Array.isArray(Ht)?Ht:[]}}:et==="confirmation"?{component_type:"confirmation",component_id:It,data:{title:Me.title||"Confirmed",message:Me.message||"",icon:Me.icon||"success",details:Me.details}}:Me.component_type&&Me.component_id?Me:null},[]),Gn=G.useCallback(async et=>{try{const Me=JSON.parse(et.payload);console.log("[RPC] Received send_dynamic_data:",Me);const It=Me.componant_type||Me.component_type;if(!It)return console.warn("[RPC] No componant_type in payload"),JSON.stringify({status:"error",message:"No componant_type provided"});const Ht=It.replace("render_component_","");console.log(`[RPC] Routing to component: ${Ht}`);const Sn=Jn(Ht,Me);return Sn?(Xn.current.set(Sn.component_id,{name:Ht,originalConfig:Me.componant_config||Me.component_config}),ct(Sn),JSON.stringify({status:"received",component_id:Sn.component_id})):(console.warn(`[RPC] Unknown component type: ${Ht}`),JSON.stringify({status:"error",message:`Unknown component type: ${Ht}`}))}catch(Me){throw console.error("[RPC] Failed to parse send_dynamic_data payload:",Me),new Error("Invalid send_dynamic_data payload")}},[ct,Jn]);G.useEffect(()=>{_r.current=ct},[ct]);const In=G.useRef(Lt.open);return In.current=Lt.open,G.useEffect(()=>{},[]),G.useEffect(()=>{var Ht,Sn;if(!t||ke!=="audio")return;const et=new Map(Ct);me.audioTrack&&Oe.segments.forEach(jt=>{const Cn=et.get(jt.id),er=bw(jt,Cn,me.audioTrack.participant);et.set(jt.id,er),jt.text&&jt.text!==(Cn==null?void 0:Cn.message)&&(jt.final?console.log("%c[Agent Message Complete]","background: #22c55e; color: white; padding: 2px 6px; border-radius: 3px;",jt.text):console.log("%c[Agent Speaking...]","color: #22c55e;",jt.text))}),ut.segments.forEach(jt=>{const Cn=et.get(jt.id),er=bw(jt,Cn,Ve.localParticipant);et.set(jt.id,er),jt.text&&jt.text!==(Cn==null?void 0:Cn.message)&&(jt.final?console.log("%c[User Message Sent]","background: #3b82f6; color: white; padding: 2px 6px; border-radius: 3px;",jt.text):console.log("%c[User Speaking...]","color: #3b82f6;",jt.text))});const Me=Array.from(et.values()).sort((jt,Cn)=>jt.timestamp-Cn.timestamp),It=xt.current&&((Ht=Me[Me.length-1])==null?void 0:Ht.name.includes("Agent"))&&!((Sn=Me[Me.length-1])!=null&&Sn.sourceUrl)&&tn.current!==Me.length-1;if(It){tn.current=Me.length,Me[Me.length-1]={...Me[Me.length-1],sourceUrl:xt.current};const jt=Me.filter(er=>!er.isSelf).length-1,Cn=et.get(Oe.segments[jt].id);et.set(Oe.segments[jt].id,bw(Oe.segments[jt],{...Cn,sourceUrl:xt.current},me.audioTrack.participant))}H(Me),Rt(et),It||(xt.current="")},[ke,le,Oe.segments,ut.segments,me.audioTrack,Ve.localParticipant]),G.useEffect(()=>{if(!t||ke!=="text")return;const et=async(It,Ht)=>{var Sn,jt;try{const Cn=await It.readAll(),er=(Sn=Ht.identity)==null?void 0:Sn.includes("agent");console.log(`%c[Transcript - Text] ${er?"Agent":"User"}:`,`color: ${er?"#22c55e":"#3b82f6"}; font-weight: bold;`,Cn),er&&((jt=it.current)==null||jt.play().catch(()=>{}),Lt.open());const Er={message:Cn,isSelf:!er,name:er?"Agent":"You",timestamp:Date.now()+performance.now()%1,...er&&xt.current&&{sourceUrl:xt.current}};xt.current&&(xt.current=""),H(K=>{const Le=new Set;return[...K,Er].filter(Xe=>!Le.has(Xe.timestamp)&&Le.add(Xe.timestamp)).sort((Xe,ot)=>Xe.timestamp-ot.timestamp)})}catch(Cn){console.error("Error reading text stream",Cn)}},Me=le.map(It=>{var jt,Cn,er,Er;const Ht=((jt=It.from)==null?void 0:jt.identity)===Ve.localParticipant.identity,Sn=me.audioTrack?((Cn=It.from)==null?void 0:Cn.identity)===((er=me.audioTrack.participant)==null?void 0:er.identity):!Ht;return{name:((Er=It.from)==null?void 0:Er.name)||(Sn?"Agent":Ht?"You":"Unknown"),isSelf:Ht,message:It.message,timestamp:It.timestamp}});return H(It=>{const Ht=new Set;return[...It,...Me].filter(Sn=>!Ht.has(Sn.timestamp)&&Ht.add(Sn.timestamp)).sort((Sn,jt)=>Sn.timestamp-jt.timestamp)}),t.registerTextStreamHandler("lk.transcription",et),()=>{t.unregisterTextStreamHandler("lk.transcription")}},[t,ke,le,Lt,Ve.localParticipant,me.audioTrack]),G.useEffect(()=>{if(t)return console.log("[RPC] Registering handlers on room connect"),t.registerRpcMethod("send_source_urls",Dn),t.registerRpcMethod("render_component",Wn),t.registerRpcMethod("send_dynamic_data",Gn),console.log("[RPC] Registered: send_source_urls, render_component, send_dynamic_data"),()=>{t.unregisterRpcMethod("send_source_urls"),t.unregisterRpcMethod("render_component"),t.unregisterRpcMethod("send_dynamic_data")}},[t,Dn,Wn,Gn]),G.useEffect(()=>{if(t)return t.on(Ee.ParticipantDisconnected,Ft),t.on(Ee.Disconnected,Ft),()=>{t.off(Ee.ParticipantDisconnected,Ft),t.off(Ee.Disconnected,Ft)}},[Ft,t]),G.useEffect(()=>{if(ht.current&&(ht.current.scrollTop=ht.current.scrollHeight),Ce.length>0){const et=Ce.filter(Me=>Me.message&&!Me.componentType).map(Me=>`${Me.isSelf?"User":"Agent"}: ${Me.message}`).join(`
|
|
426
|
-
`);console.groupCollapsed(`%c[Transcript Summary] ${Ce.filter(Me=>Me.message).length} messages`,"color: #8b5cf6; font-weight: bold;"),console.log(et),console.groupEnd()}},[Ce]),G.useEffect(()=>(it.current=new Audio(V),it.current.preload="auto",()=>{it.current&&(it.current.pause(),it.current.src="",it.current=null)}),[V]),W.jsxs(pW,{theme:I,children:[W.jsxs(sx,{children:[(!$||!Lt.isOpen)&&W.jsx(mu.button,{initial:{scale:.8,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.8,opacity:0},transition:{type:"spring",stiffness:400,damping:25},"aria-label":"Open call widget",onClick:Lt.toggle,style:{position:X,...J,backgroundColor:N.primaryColor,color:N.primaryTextColor,...(Hi=v==null?void 0:v.modalTrigger)==null?void 0:Hi.styles},className:"ringg_ai-h-14 ringg_ai-w-14 !ringg_ai-rounded-full ringg_ai-flex ringg_ai-items-center ringg_ai-justify-center ringg_ai-shadow ringg_ai-trigger-btn !ringg_ai-z-[9999] hover:ringg_ai-opacity-90 ringg_ai-transition-opacity",children:W.jsx("img",{src:((ea=(Ji=v==null?void 0:v.modalTrigger)==null?void 0:Ji.icon)==null?void 0:ea.url)??"https://assets.ringg.ai/images/icons/widget-phone.svg",alt:"Widget trigger",style:{width:((es=(co=v==null?void 0:v.modalTrigger)==null?void 0:co.icon)==null?void 0:es.size)??25,height:((fo=(ts=v==null?void 0:v.modalTrigger)==null?void 0:ts.icon)==null?void 0:fo.size)??25}})},"trigger-button"),Lt.isOpen&&W.jsxs(mu.div,{ref:bt,initial:{y:"100%",opacity:0,x:oe==="bottom-center"?"-50%":0},animate:{y:0,opacity:1,x:oe==="bottom-center"?"-50%":0},exit:{y:"100%",opacity:0,x:oe==="bottom-center"?"-50%":0},transition:{type:"spring",stiffness:300,damping:28},className:xr("ringg_ai-relative ringg_ai-border ringg_ai-overflow-hidden ringg_ai-shadow-xl !ringg_ai-z-[9999] ringg_ai-w-[95vw] md:ringg_ai-w-[360px]",bn&&"ringg_ai-h-[24.5rem]"),style:{position:"fixed",bottom:"2%",...Fte(oe),...bn?xe:{},maxWidth:"96dvw",maxHeight:"96dvh",backgroundColor:N.backgroundColor,borderColor:N.borderColor,borderRadius:RS(E==null?void 0:E.borderRadius)??N.borderRadius,fontFamily:N.fontFamily,"--widget-primary":N.primaryColor,"--widget-primary-text":N.primaryTextColor,"--widget-bg":N.backgroundColor,"--widget-surface":N.surfaceColor,"--widget-text":N.textColor,"--widget-muted":N.mutedTextColor,"--widget-border":N.borderColor,"--widget-button-radius":ne},children:[bn&&W.jsx(Av,{size:"icon",variant:"ghost","aria-label":"Minimize widget",onClick:Lt.minimize,className:"ringg_ai-absolute !ringg_ai-z-[9999] ringg_ai-top-2.5 ringg_ai-right-12 !ringg_ai-rounded-full ringg_ai-text-gray-500 hover:ringg_ai-text-gray-700",children:W.jsx(iW,{size:20})}),W.jsx(Av,{size:"icon",variant:"ghost","aria-label":bn?"End call":"Close widget",onClick:()=>bn?He(!0):Lt.showFeedback?Be():Lt.minimize(),className:"ringg_ai-absolute !ringg_ai-z-[9999] ringg_ai-top-2.5 ringg_ai-right-2.5 !ringg_ai-rounded-full ringg_ai-text-gray-500 hover:ringg_ai-text-gray-700",children:W.jsx(lW,{size:20})}),W.jsx(UY,{open:ve,onOpenChange:He,containerRef:bt,children:W.jsxs(FY,{children:[W.jsxs(jY,{children:[W.jsxs(VY,{children:["Are you sure you want to end ",ke==="text"?"chat":"call","?"]}),W.jsx(zY,{children:"Your current conversation will be closed and cannot be accessed later."})]}),W.jsxs(BY,{children:[W.jsx(Av,{variant:"outline",onClick:()=>He(!1),style:{borderRadius:ne,borderColor:N.borderColor,backgroundColor:N.surfaceColor,color:N.textColor},children:"Cancel"}),W.jsxs(Av,{onClick:Ft,style:{borderRadius:ne,backgroundColor:N.primaryColor,color:N.primaryTextColor},children:["End ",ke==="text"?"Chat":"Call"]})]})]})}),Lt.showFeedback?W.jsx($Y,{callMode:ke,isSubmitting:Je,feedbackScreenConfig:U,onSubmit:Kt,onSkip:Be}):W.jsxs("div",{className:"ringg_ai-flex ringg_ai-h-full ringg_ai-flex-col",children:[W.jsxs("div",{className:xr("ringg_ai-relative ringg_ai-p-5 ringg_ai-h-full ringg_ai-mb-2 ringg_ai-flex ringg_ai-gap-5 ringg_ai-flex-col",!bn&&"ringg_ai-mt-2"),children:[W.jsx(qY,{isCalling:bn,isLoading:Je,title:l,description:c,logoUrl:R,logoStyles:M}),Ce.length===0&&bn&&W.jsx("div",{className:"ringg_ai-mt-20 ringg_ai-h-full"}),Ce.length>0&&bn&&W.jsx("div",{"data-scrollable":"true",ref:ht,className:"ringg_ai-mt-20 ringg_ai-h-full ringg_ai-overflow-y-auto ringg_ai-flex ringg_ai-flex-col",children:W.jsx("div",{className:"ringg_ai-mt-auto md:ringg_ai-mt-0 ringg_ai-flex ringg_ai-flex-col ringg_ai-gap-2.5",children:Ce.sort((et,Me)=>et.timestamp-Me.timestamp).map((et,Me)=>et.componentType&&et.componentData?W.jsx(nK,{initialComponent:et.componentData,onApiCall:un,onComplete:()=>At(et.componentData.component_id),onSendResponse:ln},`flow_${et.componentData.component_id}_${Me}`):W.jsx(Dte,{itemIndex:Me,message:et},`${et.timestamp}__${Me}`))})}),W.jsx(IY,{buttonConfig:v,callMode:ke,isCalling:bn,onCallEnd:Ft}),z.hasError&&W.jsx("div",{className:"ringg_ai-text-center ringg_ai-text-sm ringg_ai-text-red-500 -ringg_ai-mt-3 -ringg_ai-mb-2",children:z.message}),Nr==="disconnected"&&W.jsx(GW,{callMode:ke,buttonConfig:v,isCalling:bn,isLoading:Je,onCallTrigger:vt}),!bn&&W.jsx("p",{className:"ringg_ai-text-xs ringg_ai-text-center",style:{color:N.mutedTextColor},children:A?Vte(A.text,A.links):W.jsxs(W.Fragment,{children:["By starting call you agree to ",W.jsx("a",{target:"_blank",rel:"noopener noreferrer",className:"hover:ringg_ai-underline",style:{color:N.primaryColor},href:"https://www.ringg.ai/privacy",children:"Privacy policy"})," & ",W.jsx("a",{target:"_blank",rel:"noopener noreferrer",className:"hover:ringg_ai-underline",style:{color:N.primaryColor},href:"https://www.ringg.ai/terms",children:"T&C"})]})})]}),!bn&&!T&&W.jsx(Ate,{tabs:XG,activeTab:ke,onTabChange:et=>Ge(et)})]})]},"chat-widget")]}),W.jsx(vB,{}),!1]})},
|
|
425
|
+
`))}function h(T,E,R,M){const A=R.enter("tableCell"),U=R.enter("phrasing"),V=R.containerPhrasing(T,{...M,before:s,after:s});return U(),A(),V}function p(T,E){return ree(T,{align:E,alignDelimiters:r,padding:n,stringLength:a})}function v(T,E,R){const M=T.children;let A=-1;const U=[],V=E.enter("table");for(;++A<M.length;)U[A]=b(M[A],E,R);return V(),U}function b(T,E,R){const M=T.children;let A=-1;const U=[],V=E.enter("tableRow");for(;++A<M.length;)U[A]=h(M[A],T,E,R);return V(),U}function k(T,E,R){let M=K5.inlineCode(T,E,R);return R.stack.includes("tableCell")&&(M=M.replace(/\|/g,"\\$&")),M}}function $ee(){return{exit:{taskListCheckValueChecked:Q5,taskListCheckValueUnchecked:Q5,paragraph:Wee}}}function qee(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Gee}}}function Q5(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function Wee(t){const e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const a=e.children;let s=-1,l;for(;++s<a.length;){const c=a[s];if(c.type==="paragraph"){l=c;break}}l===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(t)}function Gee(t,e,n,r){const a=t.children[0],s=typeof t.checked=="boolean"&&a&&a.type==="paragraph",l="["+(t.checked?"x":" ")+"] ",c=n.createTracker(r);s&&c.move(l);let h=K5.listItem(t,e,n,{...r,...c.current()});return s&&(h=h.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,p)),h;function p(v){return v+l}}function Yee(){return[wJ(),UJ(),QJ(),Uee(),$ee()]}function Kee(t){return{extensions:[_J(),FJ(),XJ(),Hee(t),qee()]}}const Zee={tokenize:nte,partial:!0},X5={tokenize:rte,partial:!0},J5={tokenize:ite,partial:!0},eU={tokenize:ate,partial:!0},Qee={tokenize:ote,partial:!0},tU={name:"wwwAutolink",tokenize:ete,previous:rU},nU={name:"protocolAutolink",tokenize:tte,previous:iU},Cu={name:"emailAutolink",tokenize:Jee,previous:aU},kl={};function Xee(){return{text:kl}}let mf=48;for(;mf<123;)kl[mf]=Cu,mf++,mf===58?mf=65:mf===91&&(mf=97);kl[43]=Cu,kl[45]=Cu,kl[46]=Cu,kl[95]=Cu,kl[72]=[Cu,nU],kl[104]=[Cu,nU],kl[87]=[Cu,tU],kl[119]=[Cu,tU];function Jee(t,e,n){const r=this;let a,s;return l;function l(b){return!__(b)||!aU.call(r,r.previous)||E_(r.events)?n(b):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),c(b))}function c(b){return __(b)?(t.consume(b),c):b===64?(t.consume(b),h):n(b)}function h(b){return b===46?t.check(Qee,v,p)(b):b===45||b===95||Sa(b)?(s=!0,t.consume(b),h):v(b)}function p(b){return t.consume(b),a=!0,h}function v(b){return s&&a&&za(r.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(b)):n(b)}}function ete(t,e,n){const r=this;return a;function a(l){return l!==87&&l!==119||!rU.call(r,r.previous)||E_(r.events)?n(l):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(Zee,t.attempt(X5,t.attempt(J5,s),n),n)(l))}function s(l){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(l)}}function tte(t,e,n){const r=this;let a="",s=!1;return l;function l(b){return(b===72||b===104)&&iU.call(r,r.previous)&&!E_(r.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),a+=String.fromCodePoint(b),t.consume(b),c):n(b)}function c(b){if(za(b)&&a.length<5)return a+=String.fromCodePoint(b),t.consume(b),c;if(b===58){const k=a.toLowerCase();if(k==="http"||k==="https")return t.consume(b),h}return n(b)}function h(b){return b===47?(t.consume(b),s?p:(s=!0,h)):n(b)}function p(b){return b===null||fS(b)||Sr(b)||pf(b)||hS(b)?n(b):t.attempt(X5,t.attempt(J5,v),n)(b)}function v(b){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(b)}}function nte(t,e,n){let r=0;return a;function a(l){return(l===87||l===119)&&r<3?(r++,t.consume(l),a):l===46&&r===3?(t.consume(l),s):n(l)}function s(l){return l===null?n(l):e(l)}}function rte(t,e,n){let r,a,s;return l;function l(p){return p===46||p===95?t.check(eU,h,c)(p):p===null||Sr(p)||pf(p)||p!==45&&hS(p)?h(p):(s=!0,t.consume(p),l)}function c(p){return p===95?r=!0:(a=r,r=void 0),t.consume(p),l}function h(p){return a||r||!s?n(p):e(p)}}function ite(t,e){let n=0,r=0;return a;function a(l){return l===40?(n++,t.consume(l),a):l===41&&r<n?s(l):l===33||l===34||l===38||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===60||l===63||l===93||l===95||l===126?t.check(eU,e,s)(l):l===null||Sr(l)||pf(l)?e(l):(t.consume(l),a)}function s(l){return l===41&&r++,t.consume(l),a}}function ate(t,e,n){return r;function r(c){return c===33||c===34||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===63||c===95||c===126?(t.consume(c),r):c===38?(t.consume(c),s):c===93?(t.consume(c),a):c===60||c===null||Sr(c)||pf(c)?e(c):n(c)}function a(c){return c===null||c===40||c===91||Sr(c)||pf(c)?e(c):r(c)}function s(c){return za(c)?l(c):n(c)}function l(c){return c===59?(t.consume(c),r):za(c)?(t.consume(c),l):n(c)}}function ote(t,e,n){return r;function r(s){return t.consume(s),a}function a(s){return Sa(s)?n(s):e(s)}}function rU(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||Sr(t)}function iU(t){return!za(t)}function aU(t){return!(t===47||__(t))}function __(t){return t===43||t===45||t===46||t===95||Sa(t)}function E_(t){let e=t.length,n=!1;for(;e--;){const r=t[e][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return t.length>0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const ste={tokenize:mte,partial:!0};function lte(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:fte,continuation:{tokenize:hte},exit:pte}},text:{91:{name:"gfmFootnoteCall",tokenize:dte},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:ute,resolveTo:cte}}}}function ute(t,e,n){const r=this;let a=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l;for(;a--;){const h=r.events[a][1];if(h.type==="labelImage"){l=h;break}if(h.type==="gfmFootnoteCall"||h.type==="labelLink"||h.type==="label"||h.type==="image"||h.type==="link")break}return c;function c(h){if(!l||!l._balanced)return n(h);const p=Ns(r.sliceSerialize({start:l.end,end:r.now()}));return p.codePointAt(0)!==94||!s.includes(p.slice(1))?n(h):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(h),t.exit("gfmFootnoteCallLabelMarker"),e(h))}}function cte(t,e){let n=t.length;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},t[t.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},c=[t[n+1],t[n+2],["enter",r,e],t[n+3],t[n+4],["enter",a,e],["exit",a,e],["enter",s,e],["enter",l,e],["exit",l,e],["exit",s,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...c),t}function dte(t,e,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,l;return c;function c(b){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(b),t.exit("gfmFootnoteCallLabelMarker"),h}function h(b){return b!==94?n(b):(t.enter("gfmFootnoteCallMarker"),t.consume(b),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",p)}function p(b){if(s>999||b===93&&!l||b===null||b===91||Sr(b))return n(b);if(b===93){t.exit("chunkString");const k=t.exit("gfmFootnoteCallString");return a.includes(Ns(r.sliceSerialize(k)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(b),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(b)}return Sr(b)||(l=!0),s++,t.consume(b),b===92?v:p}function v(b){return b===91||b===92||b===93?(t.consume(b),s++,p):p(b)}}function fte(t,e,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,l=0,c;return h;function h(E){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(E),t.exit("gfmFootnoteDefinitionLabelMarker"),p}function p(E){return E===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(E),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",v):n(E)}function v(E){if(l>999||E===93&&!c||E===null||E===91||Sr(E))return n(E);if(E===93){t.exit("chunkString");const R=t.exit("gfmFootnoteDefinitionLabelString");return s=Ns(r.sliceSerialize(R)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(E),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),k}return Sr(E)||(c=!0),l++,t.consume(E),E===92?b:v}function b(E){return E===91||E===92||E===93?(t.consume(E),l++,v):v(E)}function k(E){return E===58?(t.enter("definitionMarker"),t.consume(E),t.exit("definitionMarker"),a.includes(s)||a.push(s),Vn(t,T,"gfmFootnoteDefinitionWhitespace")):n(E)}function T(E){return e(E)}}function hte(t,e,n){return t.check(wv,e,t.attempt(ste,e,n))}function pte(t){t.exit("gfmFootnoteDefinition")}function mte(t,e,n){const r=this;return Vn(t,a,"gfmFootnoteDefinitionIndent",5);function a(s){const l=r.events[r.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?e(s):n(s)}}function gte(t){let n=(t||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:a};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function a(l,c){let h=-1;for(;++h<l.length;)if(l[h][0]==="enter"&&l[h][1].type==="strikethroughSequenceTemporary"&&l[h][1]._close){let p=h;for(;p--;)if(l[p][0]==="exit"&&l[p][1].type==="strikethroughSequenceTemporary"&&l[p][1]._open&&l[h][1].end.offset-l[h][1].start.offset===l[p][1].end.offset-l[p][1].start.offset){l[h][1].type="strikethroughSequence",l[p][1].type="strikethroughSequence";const v={type:"strikethrough",start:Object.assign({},l[p][1].start),end:Object.assign({},l[h][1].end)},b={type:"strikethroughText",start:Object.assign({},l[p][1].end),end:Object.assign({},l[h][1].start)},k=[["enter",v,c],["enter",l[p][1],c],["exit",l[p][1],c],["enter",b,c]],T=c.parser.constructs.insideSpan.null;T&&Mo(k,k.length,0,pS(T,l.slice(p+1,h),c)),Mo(k,k.length,0,[["exit",b,c],["enter",l[h][1],c],["exit",l[h][1],c],["exit",v,c]]),Mo(l,p-1,h-p+3,k),h=p+k.length-2;break}}for(h=-1;++h<l.length;)l[h][1].type==="strikethroughSequenceTemporary"&&(l[h][1].type="data");return l}function s(l,c,h){const p=this.previous,v=this.events;let b=0;return k;function k(E){return p===126&&v[v.length-1][1].type!=="characterEscape"?h(E):(l.enter("strikethroughSequenceTemporary"),T(E))}function T(E){const R=Cp(p);if(E===126)return b>1?h(E):(l.consume(E),b++,T);if(b<2&&!n)return h(E);const M=l.exit("strikethroughSequenceTemporary"),A=Cp(E);return M._open=!A||A===2&&!!R,M._close=!R||R===2&&!!A,c(E)}}}class vte{constructor(){this.map=[]}add(e,n,r){yte(this,e,n,r)}consume(e){if(this.map.sort(function(s,l){return s[0]-l[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(e.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),e.length=this.map[n][0];r.push([...e]),e.length=0;let a=r.pop();for(;a;)e.push(...a),a=r.pop();this.map.length=0}}function yte(t,e,n,r){let a=0;if(!(n===0&&r.length===0)){for(;a<t.map.length;){if(t.map[a][0]===e){t.map[a][1]+=n,t.map[a][2].push(...r);return}a+=1}t.map.push([e,n,r])}}function bte(t,e){let n=!1;const r=[];for(;e<t.length;){const a=t[e];if(n){if(a[0]==="enter")a[1].type==="tableContent"&&r.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(a[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){const s=r.length-1;r[s]=r[s]==="left"?"center":"right"}}else if(a[1].type==="tableDelimiterRow")break}else a[0]==="enter"&&a[1].type==="tableDelimiterRow"&&(n=!0);e+=1}return r}function Ste(){return{flow:{null:{name:"table",tokenize:Cte,resolveAll:kte}}}}function Cte(t,e,n){const r=this;let a=0,s=0,l;return c;function c($){let oe=r.events.length-1;for(;oe>-1;){const ke=r.events[oe][1].type;if(ke==="lineEnding"||ke==="linePrefix")oe--;else break}const J=oe>-1?r.events[oe][1].type:null,xe=J==="tableHead"||J==="tableRow"?N:h;return xe===N&&r.parser.lazy[r.now().line]?n($):xe($)}function h($){return t.enter("tableHead"),t.enter("tableRow"),p($)}function p($){return $===124||(l=!0,s+=1),v($)}function v($){return $===null?n($):Bt($)?s>1?(s=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume($),t.exit("lineEnding"),T):n($):Pn($)?Vn(t,v,"whitespace")($):(s+=1,l&&(l=!1,a+=1),$===124?(t.enter("tableCellDivider"),t.consume($),t.exit("tableCellDivider"),l=!0,v):(t.enter("data"),b($)))}function b($){return $===null||$===124||Sr($)?(t.exit("data"),v($)):(t.consume($),$===92?k:b)}function k($){return $===92||$===124?(t.consume($),b):b($)}function T($){return r.interrupt=!1,r.parser.lazy[r.now().line]?n($):(t.enter("tableDelimiterRow"),l=!1,Pn($)?Vn(t,E,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):E($))}function E($){return $===45||$===58?M($):$===124?(l=!0,t.enter("tableCellDivider"),t.consume($),t.exit("tableCellDivider"),R):I($)}function R($){return Pn($)?Vn(t,M,"whitespace")($):M($)}function M($){return $===58?(s+=1,l=!0,t.enter("tableDelimiterMarker"),t.consume($),t.exit("tableDelimiterMarker"),A):$===45?(s+=1,A($)):$===null||Bt($)?j($):I($)}function A($){return $===45?(t.enter("tableDelimiterFiller"),U($)):I($)}function U($){return $===45?(t.consume($),U):$===58?(l=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume($),t.exit("tableDelimiterMarker"),V):(t.exit("tableDelimiterFiller"),V($))}function V($){return Pn($)?Vn(t,j,"whitespace")($):j($)}function j($){return $===124?E($):$===null||Bt($)?!l||a!==s?I($):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e($)):I($)}function I($){return n($)}function N($){return t.enter("tableRow"),ne($)}function ne($){return $===124?(t.enter("tableCellDivider"),t.consume($),t.exit("tableCellDivider"),ne):$===null||Bt($)?(t.exit("tableRow"),e($)):Pn($)?Vn(t,ne,"whitespace")($):(t.enter("data"),X($))}function X($){return $===null||$===124||Sr($)?(t.exit("data"),ne($)):(t.consume($),$===92?se:X)}function se($){return $===92||$===124?(t.consume($),X):X($)}}function kte(t,e){let n=-1,r=!0,a=0,s=[0,0,0,0],l=[0,0,0,0],c=!1,h=0,p,v,b;const k=new vte;for(;++n<t.length;){const T=t[n],E=T[1];T[0]==="enter"?E.type==="tableHead"?(c=!1,h!==0&&(oU(k,e,h,p,v),v=void 0,h=0),p={type:"table",start:Object.assign({},E.start),end:Object.assign({},E.end)},k.add(n,0,[["enter",p,e]])):E.type==="tableRow"||E.type==="tableDelimiterRow"?(r=!0,b=void 0,s=[0,0,0,0],l=[0,n+1,0,0],c&&(c=!1,v={type:"tableBody",start:Object.assign({},E.start),end:Object.assign({},E.end)},k.add(n,0,[["enter",v,e]])),a=E.type==="tableDelimiterRow"?2:v?3:1):a&&(E.type==="data"||E.type==="tableDelimiterMarker"||E.type==="tableDelimiterFiller")?(r=!1,l[2]===0&&(s[1]!==0&&(l[0]=l[1],b=ES(k,e,s,a,void 0,b),s=[0,0,0,0]),l[2]=n)):E.type==="tableCellDivider"&&(r?r=!1:(s[1]!==0&&(l[0]=l[1],b=ES(k,e,s,a,void 0,b)),s=l,l=[s[1],n,0,0])):E.type==="tableHead"?(c=!0,h=n):E.type==="tableRow"||E.type==="tableDelimiterRow"?(h=n,s[1]!==0?(l[0]=l[1],b=ES(k,e,s,a,n,b)):l[1]!==0&&(b=ES(k,e,l,a,n,b)),a=0):a&&(E.type==="data"||E.type==="tableDelimiterMarker"||E.type==="tableDelimiterFiller")&&(l[3]=n)}for(h!==0&&oU(k,e,h,p,v),k.consume(e.events),n=-1;++n<e.events.length;){const T=e.events[n];T[0]==="enter"&&T[1].type==="table"&&(T[1]._align=bte(e.events,n))}return t}function ES(t,e,n,r,a,s){const l=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",c="tableContent";n[0]!==0&&(s.end=Object.assign({},Tp(e.events,n[0])),t.add(n[0],0,[["exit",s,e]]));const h=Tp(e.events,n[1]);if(s={type:l,start:Object.assign({},h),end:Object.assign({},h)},t.add(n[1],0,[["enter",s,e]]),n[2]!==0){const p=Tp(e.events,n[2]),v=Tp(e.events,n[3]),b={type:c,start:Object.assign({},p),end:Object.assign({},v)};if(t.add(n[2],0,[["enter",b,e]]),r!==2){const k=e.events[n[2]],T=e.events[n[3]];if(k[1].end=Object.assign({},T[1].end),k[1].type="chunkText",k[1].contentType="text",n[3]>n[2]+1){const E=n[2]+1,R=n[3]-n[2]-1;t.add(E,R,[])}}t.add(n[3]+1,0,[["exit",b,e]])}return a!==void 0&&(s.end=Object.assign({},Tp(e.events,a)),t.add(a,0,[["exit",s,e]]),s=void 0),s}function oU(t,e,n,r,a){const s=[],l=Tp(e.events,n);a&&(a.end=Object.assign({},l),s.push(["exit",a,e])),r.end=Object.assign({},l),s.push(["exit",r,e]),t.add(n+1,0,s)}function Tp(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const Tte={name:"tasklistCheck",tokenize:wte};function xte(){return{text:{91:Tte}}}function wte(t,e,n){const r=this;return a;function a(h){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(h):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(h),t.exit("taskListCheckMarker"),s)}function s(h){return Sr(h)?(t.enter("taskListCheckValueUnchecked"),t.consume(h),t.exit("taskListCheckValueUnchecked"),l):h===88||h===120?(t.enter("taskListCheckValueChecked"),t.consume(h),t.exit("taskListCheckValueChecked"),l):n(h)}function l(h){return h===93?(t.enter("taskListCheckMarker"),t.consume(h),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),c):n(h)}function c(h){return Bt(h)?e(h):Pn(h)?t.check({tokenize:_te},e,n)(h):n(h)}}function _te(t,e,n){return Vn(t,r,"whitespace");function r(a){return a===null?n(a):e(a)}}function Ete(t){return I4([Xee(),lte(),gte(t),Ste(),xte()])}const Rte={};function Pte(t){const e=this,n=t||Rte,r=e.data(),a=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),l=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);a.push(Ete(n)),s.push(Yee()),l.push(Kee(n))}const Dte=({itemIndex:t,message:e})=>{const n=Zo(),r=WW(e.name),a=r?n.textColor:n.primaryTextColor;return W.jsx("div",{className:xr("ringg_ai-flex ringg_ai-flex-col ringg_ai-items-start ringg_ai-gap-1 ringg_ai-justify-start",r?"ringg_ai-flex-row":"ringg_ai-flex-row-reverse"),children:W.jsx("div",{className:xr("ringg_ai-flex ringg_ai-items-center ringg_ai-justify-start ringg_ai-gap-2 ringg_ai-px-4 ringg_ai-py-2 ringg_ai-rounded-xl ringg_ai-max-w-[90%]",r?"ringg_ai-mr-auto ringg_ai-text-left ringg_ai-rounded-bl-none":"ringg_ai-ml-auto ringg_ai-text-right ringg_ai-rounded-br-none"),style:{backgroundColor:r?n.surfaceColor:n.primaryColor,color:a},children:W.jsxs("div",{className:"ringg_ai-flex ringg_ai-flex-col ringg_ai-gap-2.5 ringg_ai-w-full ringg_ai-overflow-x-auto",children:[W.jsx("div",{className:"ringg_ai-prose ringg_ai-prose-sm ringg_ai-max-w-none [&_p]:ringg_ai-text-sm [&_li]:ringg_ai-text-sm [&_table]:ringg_ai-w-max",style:{"--tw-prose-body":a,"--tw-prose-headings":a,"--tw-prose-bold":a,"--tw-prose-counters":a,"--tw-prose-bullets":a,"--tw-prose-quotes":a,"--tw-prose-code":a,"--tw-prose-th-borders":n.borderColor,"--tw-prose-td-borders":n.borderColor,color:a},children:W.jsx(mJ,{remarkPlugins:[Pte],children:e.message})}),(e==null?void 0:e.sourceUrl)&&W.jsxs("a",{href:e.sourceUrl,target:"_blank",rel:"noopener noreferrer",className:"ringg_ai-text-sm ringg_ai-break-all ringg_ai-w-fit ringg_ai-hover:underline",style:{color:r?n.primaryColor:n.primaryTextColor},children:["Source: ",e.sourceUrl]})]})},`${e.name}__${t}`)},`${e.timestamp}__${t}`)};function Ate({tabs:t=[],activeTab:e="voice-call",onTabChange:n}){const r=Zo(),[a,s]=G.useState(e),l=c=>{s(c),n==null||n(c)};return W.jsx("div",{className:"ringg_ai-w-full ringg_ai-border-t",style:{backgroundColor:r.backgroundColor,borderColor:r.borderColor},children:W.jsx("div",{className:"ringg_ai-flex ringg_ai-items-center ringg_ai-px-0",children:t.map(c=>{const h=c.icon,p=a===c.id,v=p?r.primaryColor:r.mutedTextColor;return W.jsxs("button",{onClick:()=>l(c.id),className:xr("ringg_ai-flex ringg_ai-flex-col ringg_ai-items-center ringg_ai-gap-1 ringg_ai-border-t-2 ringg_ai-py-3 ringg_ai-transition-all ringg_ai-duration-200 ringg_ai-flex-1"),style:{borderTopColor:p?r.primaryColor:"transparent"},children:[W.jsx(h,{className:"ringg_ai-w-5 ringg_ai-h-5 ringg_ai-transition-colors",fill:v,style:{color:v}}),W.jsx("span",{className:"ringg_ai-text-xs ringg_ai-font-medium ringg_ai-transition-colors",style:{color:v},children:c.label})]},c.id)})})})}const Ote=Y3("ringg_ai-inline-flex ringg_ai-items-center ringg_ai-justify-center ringg_ai-gap-2 ringg_ai-whitespace-nowrap ringg_ai-rounded-md ringg_ai-text-sm ringg_ai-font-medium ringg_ai-ring-offset-background ringg_ai-transition-colors focus-visible:ringg_ai-outline-none focus-visible:ringg_ai-ring-2 focus-visible:ringg_ai-ring-ring focus-visible:ringg_ai-ring-offset-2 disabled:ringg_ai-pointer-events-none disabled:ringg_ai-opacity-50 [&_svg]:ringg_ai-pointer-events-none [&_svg]:ringg_ai-size-4 [&_svg]:ringg_ai-shrink-0",{variants:{variant:{default:"ringg_ai-bg-primary ringg_ai-text-primary-foreground ringg_ai-shadow hover:ringg_ai-bg-primary/90",destructive:"ringg_ai-bg-destructive ringg_ai-text-destructive-foreground ringg_ai-shadow-sm hover:ringg_ai-bg-destructive/90",outline:"ringg_ai-border ringg_ai-border-input ringg_ai-bg-background ringg_ai-shadow-sm hover:ringg_ai-bg-accent hover:ringg_ai-text-accent-foreground",secondary:"ringg_ai-bg-secondary ringg_ai-text-secondary-foreground ringg_ai-shadow-sm hover:ringg_ai-bg-secondary/80",ghost:"hover:ringg_ai-bg-accent hover:ringg_ai-text-accent-foreground",link:"ringg_ai-text-primary ringg_ai-underline-offset-4 hover:ringg_ai-underline"},size:{default:"ringg_ai-h-9 ringg_ai-px-4 ringg_ai-py-2",sm:"ringg_ai-h-8 ringg_ai-rounded-md ringg_ai-px-3 ringg_ai-text-xs",lg:"ringg_ai-h-10 ringg_ai-rounded-md ringg_ai-px-8",icon:"ringg_ai-h-9 ringg_ai-w-9"}},defaultVariants:{variant:"default",size:"default"}}),Av=G.forwardRef(({className:t,variant:e,size:n,asChild:r=!1,...a},s)=>{const l=r?uS:"button";return W.jsx(l,{className:xr(Ote({variant:e,size:n,className:t})),ref:s,...a})});Av.displayName="Button";function Bc(t,e){typeof window<"u"&&window.dispatchEvent(new CustomEvent(t,{detail:e}))}function Mte({callMode:t}){const[e,n]=G.useState(!1),[r,a]=G.useState(!1),[s,l]=G.useState(null),c=G.useRef(!1),h=G.useRef(t);h.current=t;const p=G.useCallback(()=>{c.current||(c.current=!0,n(!0),Bc("ringg:widget_status",{status:"maximised",mode:h.current}))},[]),v=G.useCallback(()=>{c.current=!1,n(!1),Bc("ringg:widget_status",{status:"minimised",mode:h.current})},[]),b=G.useCallback(()=>{a(!1),l(null),v()},[v]),k=G.useCallback(()=>{c.current?v():p()},[p,v]);return G.useMemo(()=>({isOpen:e,showFeedback:r,currentCallId:s,setShowFeedback:a,setCurrentCallId:l,open:p,minimize:v,close:b,toggle:k}),[e,r,s,p,v,b,k])}function Lte({room:t,onError:e}){const[n,r]=G.useState("unknown"),a=G.useRef(e);a.current=e;const s=G.useCallback(async()=>{var h;try{if((h=navigator.permissions)!=null&&h.query){const p=await navigator.permissions.query({name:"microphone"});r(p.state),p.onchange=()=>{r(p.state)}}else try{await navigator.mediaDevices.getUserMedia({audio:!0}),r("granted")}catch{r("denied")}}catch(p){console.error("Error checking microphone permission:",p),r("unknown")}},[]),l=G.useCallback(async()=>{var h;try{const p=await navigator.mediaDevices.getUserMedia({audio:!0});return r("granted"),p.getTracks().forEach(v=>v.stop()),!0}catch(p){return console.error("Error requesting microphone permission:",p),r("denied"),(h=a.current)==null||h.call(a,"Microphone access was denied. Please enable it in your browser settings."),!1}},[]);G.useEffect(()=>{s();const h=()=>{var p;(p=a.current)==null||p.call(a,"Error acquiring microphone permission. Please make sure you grant the necessary permissions in your browser and reload the tab"),r("denied")};return t.on(Ee.MediaDevicesError,h),()=>{t.off(Ee.MediaDevicesError,h)}},[t,s]);const c=n==="granted";return G.useMemo(()=>({state:n,isGranted:c,check:s,request:l}),[n,c,s,l])}function Nte({containerRef:t,enabled:e}){G.useEffect(()=>{const n=t.current;if(!n||!e)return;const r=c=>{const h=n.querySelector('[data-scrollable="true"]');if(!h){c.preventDefault();return}const{scrollTop:p,scrollHeight:v,clientHeight:b}=h,k=p===0&&c.deltaY<0,T=p+b>=v-1&&c.deltaY>0;(k||T)&&c.preventDefault()};let a=0;const s=c=>{a=c.touches[0].clientY},l=c=>{const h=n.querySelector('[data-scrollable="true"]'),p=c.touches[0].clientY,v=a-p;if(!h){c.preventDefault();return}const{scrollTop:b,scrollHeight:k,clientHeight:T}=h,E=b===0&&v<0,R=b+T>=k-1&&v>0;(E||R)&&c.preventDefault()};return n.addEventListener("wheel",r,{passive:!1}),n.addEventListener("touchstart",s,{passive:!0}),n.addEventListener("touchmove",l,{passive:!1}),()=>{n.removeEventListener("wheel",r),n.removeEventListener("touchstart",s),n.removeEventListener("touchmove",l)}},[e])}const xp={mode:"prod",title:"Ringg AI Support",description:"Ringg AI offers 24/7 voice support to handle your business calls efficiently and professionally",defaultTab:"audio",hideTabSelector:!1,notificationTuneUrl:"https://assets.ringg.ai/audios/misc/widget_notification.mp3"};function R_(t){switch(t){case"dev":return"https://calling-dev.ringg.ai/ca/api/v0";case"stage":return"https://stage-api2.desivocal.com/ca/api/v0";default:return"https://prod-api.ringg.ai/ca/api/v0"}}function Ite(t){switch(t){case"dev":return"wss://ringg-ai-dev-92tubwpz.livekit.cloud";case"stage":return"wss://ringg-ai-ujrjmhgy.livekit.cloud";default:return"wss://ringg-ai-prod-r0vhjzhs.livekit.cloud"}}function Jse(t){return t}const sU={center:{top:0,left:0,right:0,bottom:0,margin:"auto"},"top-left":{top:"2%",left:"2%"},"top-right":{top:"2%",right:"2%"},"bottom-left":{bottom:"2%",left:"2%"},"bottom-right":{bottom:"2%",right:"2%"},"bottom-center":{bottom:"2%",left:"50%"}};function Ute(t){return sU[t]??sU["bottom-right"]}function Fte(t){return t==="bottom-center"?{left:"50%"}:t==="bottom-left"?{left:"2%"}:{right:"2%"}}function RS(t){if(t!==void 0)return typeof t=="number"?`${t}px`:t}function jte(t){return t?{width:RS(t.width),height:RS(t.height),borderRadius:RS(t.borderRadius)}:{}}function Vte(t,e){if(!e)return t;let n=[t];return Object.entries(e).forEach(([r,a])=>{n=n.flatMap((s,l)=>{if(typeof s!="string")return s;const c=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),h=new RegExp(`\\b(${c})\\b`,"g");return s.split(h).map((p,v)=>p===r?W.jsx("a",{target:"_blank",rel:"noopener noreferrer",className:"ringg_ai-text-blue-500 hover:ringg_ai-underline",href:a,children:r},`${l}-${v}`):p)})}),n}const zte="1.0.20-alpha.4",Bte=({room:t,config:e})=>{var Hi,Ji,ea,co,es,ts,fo;console.log(`[Ringg CDN] Version: ${zte}`);const[n,r]=G.useState({}),a=e,{mode:s=xp.mode,title:l=xp.title,description:c=xp.description,agentId:h,variables:p,buttons:v,xApiKey:b="",defaultTab:k=xp.defaultTab,hideTabSelector:T=xp.hideTabSelector,innerWindowProps:E,logoUrl:R,logoStyles:M,legalDisclaimer:A,feedbackScreen:U,notificationTuneUrl:V=xp.notificationTuneUrl,widgetPosition:j,theme:I}=a,N=WI(I),ne=mw(N.buttonStyle),X=(j==null?void 0:j.triggerPlacement)??"fixed",se=(j==null?void 0:j.triggerAlignment)??"bottom-right",$=(j==null?void 0:j.hideTriggerOnExpand)??!0,oe=(j==null?void 0:j.widgetAlignment)??"bottom-right",J=Ute(se),xe=jte(E),[ke,Ge]=G.useState(k),[Je,je]=G.useState(!1),[ve,He]=G.useState(!1),[z,ee]=G.useState({hasError:!1,message:""}),[Ce,H]=G.useState([]),[Ct,Rt]=G.useState(new Map),ht=G.useRef(null),bt=G.useRef(null),it=G.useRef(null),xt=G.useRef(""),tn=G.useRef(),qn=G.useRef(new Set),_r=G.useRef(null),vr=G.useRef(!1),Xn=G.useRef(new Map),Nr=ex(t),bn=Nr==="connected",Lt=Mte({callMode:ke}),Z=Lte({room:t,onError:et=>ee({hasError:!0,message:et})});Nte({containerRef:bt,enabled:Lt.isOpen});const{chatMessages:le}=$M(),me=hB(),Ve=aB(),ze=HM(),Oe=tx(me.audioTrack||void 0),ut=tx({publication:Ve.microphoneTrack,source:De.Source.Microphone,participant:Ve.localParticipant}),Nt=G.useMemo(()=>ze.find(et=>{var Me;return(Me=et.identity)==null?void 0:Me.includes("agent")}),[ze]),fe=G.useCallback((et,Me)=>{vr.current=!1,console.log("%c[Conversation Started]","background: #22c55e; color: white; padding: 2px 6px; border-radius: 3px;",{mode:et,callId:Me}),Bc("ringg:conversation_status",{status:"started",mode:et,callId:Me})},[]),Re=G.useCallback((et,Me)=>{vr.current||(vr.current=!0,console.log("%c[Conversation Ended]","background: #ef4444; color: white; padding: 2px 6px; border-radius: 3px;",{mode:et,callId:Me}),Bc("ringg:conversation_status",{status:"ended",mode:et,callId:Me}))},[]),vt=G.useCallback(async et=>{if(!(et==="audio"&&!Z.isGranted&&!await Z.request())){je(!0),Ge(et);try{const Me=await fetch(`${R_(s)}/calling/webcall`,{method:"POST",body:JSON.stringify({agent_id:h,custom_args_values:p,media_type:et}),headers:{"Content-Type":"application/json","X-API-KEY":b}}),It=await Me.json();if(!Me.ok)throw new Error((It==null?void 0:It.message)||"Failed to make call");It!=null&&It.call_id&&Lt.setCurrentCallId(It.call_id),await t.connect(Ite(s),It==null?void 0:It.user_token),et==="audio"&&await t.localParticipant.setMicrophoneEnabled(!0),fe(et,It.call_id),ee({hasError:!1,message:""})}catch(Me){ee({hasError:!0,message:Me.message})}finally{je(!1)}}},[t,s,h,p,b,Z,Lt,fe]),Ft=G.useCallback(async()=>{je(!0);try{Lt.currentCallId&&Re(ke,Lt.currentCallId),H([]),Rt(new Map),qn.current=new Set,xt.current="",tn.current=void 0,t.disconnect(),He(!1),Lt.setShowFeedback(!0),Lt.open()}catch(et){ee({hasError:!0,message:"Error ending call: "+et.message})}finally{je(!1)}},[t,ke,Lt,Re]),Kt=G.useCallback(async(et,Me)=>{if(!Lt.currentCallId){Lt.close();return}je(!0);try{await fetch(`${R_(s)}/calling/${Lt.currentCallId}/feedback`,{method:"POST",body:JSON.stringify({rating:et,comment:Me}),headers:{"Content-Type":"application/json","X-API-KEY":b}}),Bc("ringg:feedback_status",{status:"submitted",callId:Lt.currentCallId,rating:et})}catch(It){console.error("Error submitting feedback:",It)}finally{je(!1),Lt.close()}},[s,b,Lt]),Be=G.useCallback(()=>{Lt.currentCallId&&Bc("ringg:feedback_status",{status:"skipped",callId:Lt.currentCallId}),Lt.close()},[Lt]),ct=G.useCallback(et=>{var It;const Me={name:"Agent",message:"",isSelf:!1,timestamp:Date.now()+Math.random(),componentType:et.component_type,componentData:et};H(Ht=>[...Ht,Me]),Bc("ringg:calendar_booking",{status:"shown",componentId:et.component_id}),(It=it.current)==null||It.play().catch(()=>{}),Lt.open()},[Lt]),At=G.useCallback(et=>{qn.current.add(et),Bc("ringg:calendar_booking",{status:"confirmed",componentId:et,message:"Flow completed"})},[]),ln=G.useCallback(async(et,Me)=>{const It=Xn.current.get(et);if(!It){console.warn(`[RPC] No pending response found for component: ${et}`);return}if(!Nt){console.warn("[RPC] No agent participant found to send response to");return}const{name:Ht,originalConfig:Sn}=It,jt="receive_dynamic_data";let Cn;if(Ht==="calendar"){const Er=Me.step_data&&Me.step_data.slot_id;Cn=(Array.isArray(Sn)?Sn:[]).find(Xe=>Xe.id===Er)||{id:Er,datetime:Me.step_data&&Me.step_data.slot_datetime}}else if(Ht==="form")Cn=Me.step_data||Me.all_data;else if(Ht==="buttons"){const Er=Me.step_data&&Me.step_data.selected_button;Cn=(Array.isArray(Sn)?Sn:[]).find(Xe=>Xe.id===Er)||{id:Er}}else Cn=Me;const er=JSON.stringify({componant_type:`receive_component_${Ht}`,component_id:et,componant_data:Cn});try{console.log(`[RPC] Sending ${jt}:`,er);const Er=await Ve.localParticipant.performRpc({destinationIdentity:Nt.identity,method:jt,payload:er});console.log(`[RPC] Response from ${jt}:`,Er),Xn.current.delete(et)}catch(Er){console.error(`[RPC] Error sending ${jt}:`,Er)}},[Nt,Ve.localParticipant]),En=G.useMemo(()=>null,[]),un=G.useCallback(async(et,Me,It)=>(await fetch(Me.startsWith("http")?Me:`${R_(s)}${Me}`,{method:et,body:JSON.stringify(It),headers:{"Content-Type":"application/json","X-API-KEY":b}})).json(),[s,b,bn,En]),Dn=G.useCallback(async et=>{try{const Me=JSON.parse(et.payload);return Array.isArray(Me.source_urls)?xt.current=Me.source_urls.join(", "):Me.source_url&&(xt.current=Me.source_url),JSON.stringify({status:"received"})}catch(Me){throw console.error("Failed to parse RPC payload:",Me),new Error("Invalid payload for send_source_urls")}},[]),Wn=G.useCallback(async et=>{try{console.log("Received dynamic data:",et.payload);const Me=JSON.parse(et.payload);return Me.component_type&&Me.component_id&&ct(Me),JSON.stringify({status:"received"})}catch(Me){throw console.error("Failed to parse component payload:",Me),new Error("Invalid component payload")}},[ct]),Jn=G.useCallback((et,Me)=>{const It=`${et}_${Date.now()}`,Ht=Me.componant_config||Me.component_config;if(et==="calendar"){const Sn=Array.isArray(Ht)?Ht:[];return{component_type:"calendar_booking",component_id:It,data:{available_slots:Sn.map(jt=>({id:jt.id,datetime:jt.datetime})),timezone:Me.timezone||"UTC",title:Me.title||"Select a time slot"},actions:{on_select:{method:"POST",endpoint:"/mock/calendar",payload:{selected_slot_id:"{slot_id}"}}}}}return et==="form"?{component_type:"form",component_id:It,data:{title:Me.title||"Form",description:Me.description,fields:Array.isArray(Ht)?Ht:[],submit_label:Me.submit_label},actions:{on_submit:{method:"POST",endpoint:"/mock/form",payload:{form_data:"{form_data}"}}}}:et==="buttons"?{component_type:"buttons",component_id:It,data:{title:Me.title,buttons:Array.isArray(Ht)?Ht:[]}}:et==="confirmation"?{component_type:"confirmation",component_id:It,data:{title:Me.title||"Confirmed",message:Me.message||"",icon:Me.icon||"success",details:Me.details}}:Me.component_type&&Me.component_id?Me:null},[]),Gn=G.useCallback(async et=>{try{const Me=JSON.parse(et.payload);console.log("[RPC] Received send_dynamic_data:",Me);const It=Me.componant_type||Me.component_type;if(!It)return console.warn("[RPC] No componant_type in payload"),JSON.stringify({status:"error",message:"No componant_type provided"});const Ht=It.replace("render_component_","");console.log(`[RPC] Routing to component: ${Ht}`);const Sn=Jn(Ht,Me);return Sn?(Xn.current.set(Sn.component_id,{name:Ht,originalConfig:Me.componant_config||Me.component_config}),ct(Sn),JSON.stringify({status:"received",component_id:Sn.component_id})):(console.warn(`[RPC] Unknown component type: ${Ht}`),JSON.stringify({status:"error",message:`Unknown component type: ${Ht}`}))}catch(Me){throw console.error("[RPC] Failed to parse send_dynamic_data payload:",Me),new Error("Invalid send_dynamic_data payload")}},[ct,Jn]);G.useEffect(()=>{_r.current=ct},[ct]);const In=G.useRef(Lt.open);return In.current=Lt.open,G.useEffect(()=>{},[]),G.useEffect(()=>{var Ht,Sn;if(!t||ke!=="audio")return;const et=new Map(Ct);me.audioTrack&&Oe.segments.forEach(jt=>{const Cn=et.get(jt.id),er=bw(jt,Cn,me.audioTrack.participant);et.set(jt.id,er),jt.text&&jt.text!==(Cn==null?void 0:Cn.message)&&(jt.final?console.log("%c[Agent Message Complete]","background: #22c55e; color: white; padding: 2px 6px; border-radius: 3px;",jt.text):console.log("%c[Agent Speaking...]","color: #22c55e;",jt.text))}),ut.segments.forEach(jt=>{const Cn=et.get(jt.id),er=bw(jt,Cn,Ve.localParticipant);et.set(jt.id,er),jt.text&&jt.text!==(Cn==null?void 0:Cn.message)&&(jt.final?console.log("%c[User Message Sent]","background: #3b82f6; color: white; padding: 2px 6px; border-radius: 3px;",jt.text):console.log("%c[User Speaking...]","color: #3b82f6;",jt.text))});const Me=Array.from(et.values()).sort((jt,Cn)=>jt.timestamp-Cn.timestamp),It=xt.current&&((Ht=Me[Me.length-1])==null?void 0:Ht.name.includes("Agent"))&&!((Sn=Me[Me.length-1])!=null&&Sn.sourceUrl)&&tn.current!==Me.length-1;if(It){tn.current=Me.length,Me[Me.length-1]={...Me[Me.length-1],sourceUrl:xt.current};const jt=Me.filter(er=>!er.isSelf).length-1,Cn=et.get(Oe.segments[jt].id);et.set(Oe.segments[jt].id,bw(Oe.segments[jt],{...Cn,sourceUrl:xt.current},me.audioTrack.participant))}H(Me),Rt(et),It||(xt.current="")},[ke,le,Oe.segments,ut.segments,me.audioTrack,Ve.localParticipant]),G.useEffect(()=>{if(!t||ke!=="text")return;const et=async(It,Ht)=>{var Sn,jt;try{const Cn=await It.readAll(),er=(Sn=Ht.identity)==null?void 0:Sn.includes("agent");console.log(`%c[Transcript - Text] ${er?"Agent":"User"}:`,`color: ${er?"#22c55e":"#3b82f6"}; font-weight: bold;`,Cn),er&&((jt=it.current)==null||jt.play().catch(()=>{}),Lt.open());const Er={message:Cn,isSelf:!er,name:er?"Agent":"You",timestamp:Date.now()+performance.now()%1,...er&&xt.current&&{sourceUrl:xt.current}};xt.current&&(xt.current=""),H(K=>{const Le=new Set;return[...K,Er].filter(Xe=>!Le.has(Xe.timestamp)&&Le.add(Xe.timestamp)).sort((Xe,ot)=>Xe.timestamp-ot.timestamp)})}catch(Cn){console.error("Error reading text stream",Cn)}},Me=le.map(It=>{var jt,Cn,er,Er;const Ht=((jt=It.from)==null?void 0:jt.identity)===Ve.localParticipant.identity,Sn=me.audioTrack?((Cn=It.from)==null?void 0:Cn.identity)===((er=me.audioTrack.participant)==null?void 0:er.identity):!Ht;return{name:((Er=It.from)==null?void 0:Er.name)||(Sn?"Agent":Ht?"You":"Unknown"),isSelf:Ht,message:It.message,timestamp:It.timestamp}});return H(It=>{const Ht=new Set;return[...It,...Me].filter(Sn=>!Ht.has(Sn.timestamp)&&Ht.add(Sn.timestamp)).sort((Sn,jt)=>Sn.timestamp-jt.timestamp)}),t.registerTextStreamHandler("lk.transcription",et),()=>{t.unregisterTextStreamHandler("lk.transcription")}},[t,ke,le,Lt,Ve.localParticipant,me.audioTrack]),G.useEffect(()=>{if(t)return console.log("[RPC] Registering handlers on room connect"),t.registerRpcMethod("send_source_urls",Dn),t.registerRpcMethod("render_component",Wn),t.registerRpcMethod("send_dynamic_data",Gn),console.log("[RPC] Registered: send_source_urls, render_component, send_dynamic_data"),()=>{t.unregisterRpcMethod("send_source_urls"),t.unregisterRpcMethod("render_component"),t.unregisterRpcMethod("send_dynamic_data")}},[t,Dn,Wn,Gn]),G.useEffect(()=>{if(t)return t.on(Ee.ParticipantDisconnected,Ft),t.on(Ee.Disconnected,Ft),()=>{t.off(Ee.ParticipantDisconnected,Ft),t.off(Ee.Disconnected,Ft)}},[Ft,t]),G.useEffect(()=>{if(ht.current&&(ht.current.scrollTop=ht.current.scrollHeight),Ce.length>0){const et=Ce.filter(Me=>Me.message&&!Me.componentType).map(Me=>`${Me.isSelf?"User":"Agent"}: ${Me.message}`).join(`
|
|
426
|
+
`);console.groupCollapsed(`%c[Transcript Summary] ${Ce.filter(Me=>Me.message).length} messages`,"color: #8b5cf6; font-weight: bold;"),console.log(et),console.groupEnd()}},[Ce]),G.useEffect(()=>(it.current=new Audio(V),it.current.preload="auto",()=>{it.current&&(it.current.pause(),it.current.src="",it.current=null)}),[V]),W.jsxs(pW,{theme:I,children:[W.jsxs(sx,{children:[(!$||!Lt.isOpen)&&W.jsx(mu.button,{initial:{scale:.8,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.8,opacity:0},transition:{type:"spring",stiffness:400,damping:25},"aria-label":"Open call widget",onClick:Lt.toggle,style:{position:X,...J,backgroundColor:N.primaryColor,color:N.primaryTextColor,...(Hi=v==null?void 0:v.modalTrigger)==null?void 0:Hi.styles},className:"ringg_ai-h-14 ringg_ai-w-14 !ringg_ai-rounded-full ringg_ai-flex ringg_ai-items-center ringg_ai-justify-center ringg_ai-shadow ringg_ai-trigger-btn !ringg_ai-z-[9999] hover:ringg_ai-opacity-90 ringg_ai-transition-opacity",children:W.jsx("img",{src:((ea=(Ji=v==null?void 0:v.modalTrigger)==null?void 0:Ji.icon)==null?void 0:ea.url)??"https://assets.ringg.ai/images/icons/widget-phone.svg",alt:"Widget trigger",style:{width:((es=(co=v==null?void 0:v.modalTrigger)==null?void 0:co.icon)==null?void 0:es.size)??25,height:((fo=(ts=v==null?void 0:v.modalTrigger)==null?void 0:ts.icon)==null?void 0:fo.size)??25}})},"trigger-button"),Lt.isOpen&&W.jsxs(mu.div,{ref:bt,initial:{y:"100%",opacity:0,x:oe==="bottom-center"?"-50%":0},animate:{y:0,opacity:1,x:oe==="bottom-center"?"-50%":0},exit:{y:"100%",opacity:0,x:oe==="bottom-center"?"-50%":0},transition:{type:"spring",stiffness:300,damping:28},className:xr("ringg_ai-relative ringg_ai-border ringg_ai-overflow-hidden ringg_ai-shadow-xl !ringg_ai-z-[9999] ringg_ai-w-[95vw] md:ringg_ai-w-[360px]",bn&&"ringg_ai-h-[24.5rem]"),style:{position:"fixed",bottom:"2%",...Fte(oe),...bn?xe:{},maxWidth:"96dvw",maxHeight:"96dvh",backgroundColor:N.backgroundColor,borderColor:N.borderColor,borderRadius:RS(E==null?void 0:E.borderRadius)??N.borderRadius,fontFamily:N.fontFamily,"--widget-primary":N.primaryColor,"--widget-primary-text":N.primaryTextColor,"--widget-bg":N.backgroundColor,"--widget-surface":N.surfaceColor,"--widget-text":N.textColor,"--widget-muted":N.mutedTextColor,"--widget-border":N.borderColor,"--widget-button-radius":ne},children:[bn&&W.jsx(Av,{size:"icon",variant:"ghost","aria-label":"Minimize widget",onClick:Lt.minimize,className:"ringg_ai-absolute !ringg_ai-z-[9999] ringg_ai-top-2.5 ringg_ai-right-12 !ringg_ai-rounded-full ringg_ai-text-gray-500 hover:ringg_ai-text-gray-700",children:W.jsx(iW,{size:20})}),W.jsx(Av,{size:"icon",variant:"ghost","aria-label":bn?"End call":"Close widget",onClick:()=>bn?He(!0):Lt.showFeedback?Be():Lt.minimize(),className:"ringg_ai-absolute !ringg_ai-z-[9999] ringg_ai-top-2.5 ringg_ai-right-2.5 !ringg_ai-rounded-full ringg_ai-text-gray-500 hover:ringg_ai-text-gray-700",children:W.jsx(lW,{size:20})}),W.jsx(UY,{open:ve,onOpenChange:He,containerRef:bt,children:W.jsxs(FY,{children:[W.jsxs(jY,{children:[W.jsxs(VY,{children:["Are you sure you want to end ",ke==="text"?"chat":"call","?"]}),W.jsx(zY,{children:"Your current conversation will be closed and cannot be accessed later."})]}),W.jsxs(BY,{children:[W.jsx(Av,{variant:"outline",onClick:()=>He(!1),style:{borderRadius:ne,borderColor:N.borderColor,backgroundColor:N.surfaceColor,color:N.textColor},children:"Cancel"}),W.jsxs(Av,{onClick:Ft,style:{borderRadius:ne,backgroundColor:N.primaryColor,color:N.primaryTextColor},children:["End ",ke==="text"?"Chat":"Call"]})]})]})}),Lt.showFeedback?W.jsx($Y,{callMode:ke,isSubmitting:Je,feedbackScreenConfig:U,onSubmit:Kt,onSkip:Be}):W.jsxs("div",{className:"ringg_ai-flex ringg_ai-h-full ringg_ai-flex-col",children:[W.jsxs("div",{className:xr("ringg_ai-relative ringg_ai-p-5 ringg_ai-h-full ringg_ai-mb-2 ringg_ai-flex ringg_ai-gap-5 ringg_ai-flex-col",!bn&&"ringg_ai-mt-2"),children:[W.jsx(qY,{isCalling:bn,isLoading:Je,title:l,description:c,logoUrl:R,logoStyles:M}),Ce.length===0&&bn&&W.jsx("div",{className:"ringg_ai-mt-20 ringg_ai-h-full"}),Ce.length>0&&bn&&W.jsx("div",{"data-scrollable":"true",ref:ht,className:"ringg_ai-mt-20 ringg_ai-h-full ringg_ai-overflow-y-auto ringg_ai-flex ringg_ai-flex-col",children:W.jsx("div",{className:"ringg_ai-mt-auto md:ringg_ai-mt-0 ringg_ai-flex ringg_ai-flex-col ringg_ai-gap-2.5",children:Ce.sort((et,Me)=>et.timestamp-Me.timestamp).map((et,Me)=>et.componentType&&et.componentData?W.jsx(nK,{initialComponent:et.componentData,onApiCall:un,onComplete:()=>At(et.componentData.component_id),onSendResponse:ln},`flow_${et.componentData.component_id}_${Me}`):W.jsx(Dte,{itemIndex:Me,message:et},`${et.timestamp}__${Me}`))})}),W.jsx(IY,{buttonConfig:v,callMode:ke,isCalling:bn,onCallEnd:Ft}),z.hasError&&W.jsx("div",{className:"ringg_ai-text-center ringg_ai-text-sm ringg_ai-text-red-500 -ringg_ai-mt-3 -ringg_ai-mb-2",children:z.message}),Nr==="disconnected"&&W.jsx(GW,{callMode:ke,buttonConfig:v,isCalling:bn,isLoading:Je,onCallTrigger:vt}),!bn&&W.jsx("p",{className:"ringg_ai-text-xs ringg_ai-text-center",style:{color:N.mutedTextColor},children:A?Vte(A.text,A.links):W.jsxs(W.Fragment,{children:["By starting call you agree to ",W.jsx("a",{target:"_blank",rel:"noopener noreferrer",className:"hover:ringg_ai-underline",style:{color:N.primaryColor},href:"https://www.ringg.ai/privacy",children:"Privacy policy"})," & ",W.jsx("a",{target:"_blank",rel:"noopener noreferrer",className:"hover:ringg_ai-underline",style:{color:N.primaryColor},href:"https://www.ringg.ai/terms",children:"T&C"})]})})]}),!bn&&!T&&W.jsx(Ate,{tabs:XG,activeTab:ke,onTabChange:et=>Ge(et)})]})]},"chat-widget")]}),W.jsx(vB,{}),!1]})},Hte=({config:t})=>{const[e]=G.useState(()=>new Gh({dynacast:!0,adaptiveStream:!0}));return W.jsx(XT.Provider,{value:e,children:W.jsx(Bte,{config:t,room:e})})};{const t="ringg_ai_container";(function(e,n){function r(a){let s=n.getElementById(t);s||(s=n.createElement("div"),s.id=t,n.body.appendChild(s)),yg.createRoot(s).render(W.jsx(ir.StrictMode,{children:W.jsx(Hte,{config:a})}))}e.loadAgent=r})(window,document)}});
|