streamlit-webrtc 0.57.0__py3-none-any.whl → 0.60.0__py3-none-any.whl

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.
@@ -103,6 +103,12 @@ except ImportError:
103
103
  # streamlit < 1.27.0
104
104
  from streamlit import experimental_rerun as rerun # type: ignore
105
105
 
106
+ try:
107
+ from streamlit import cache_data # type: ignore
108
+ except ImportError:
109
+ # streamlit < 1.18.0
110
+ from streamlit import experimental_memo as cache_data # type: ignore
111
+
106
112
 
107
113
  __all__ = [
108
114
  "VER_GTE_1_12_0",
@@ -114,4 +120,5 @@ __all__ = [
114
120
  "SessionInfo",
115
121
  "get_script_run_ctx",
116
122
  "rerun",
123
+ "cache_data",
117
124
  ]
@@ -30,11 +30,16 @@ import urllib.error
30
30
  import urllib.request
31
31
  from typing import List, Optional
32
32
 
33
+ from ._compat import cache_data
33
34
  from .config import RTCIceServer
34
35
 
35
36
  LOGGER = logging.getLogger(__name__)
36
37
 
37
38
 
39
+ HF_ICE_SERVER_TTL = 3600 # 1 hour. Not sure if this is the best value.
40
+
41
+
42
+ @cache_data(ttl=HF_ICE_SERVER_TTL)
38
43
  def get_hf_ice_servers(token: Optional[str] = None) -> List[RTCIceServer]:
39
44
  if token is None:
40
45
  token = os.getenv("HF_TOKEN")
@@ -61,6 +66,10 @@ def get_hf_ice_servers(token: Optional[str] = None) -> List[RTCIceServer]:
61
66
  raise ValueError("Failed to get credentials from HF turn server")
62
67
 
63
68
 
69
+ TWILIO_CRED_TTL = 3600 # 1 hour. Twilio's default is 1 day. Shorter TTL should be ok for this library's use case.
70
+
71
+
72
+ @cache_data(ttl=TWILIO_CRED_TTL)
64
73
  def get_twilio_ice_servers(
65
74
  twilio_sid: Optional[str] = None, twilio_token: Optional[str] = None
66
75
  ) -> List[RTCIceServer]:
@@ -78,7 +87,7 @@ def get_twilio_ice_servers(
78
87
 
79
88
  client = Client(twilio_sid, twilio_token)
80
89
 
81
- token = client.tokens.create()
90
+ token = client.tokens.create(ttl=TWILIO_CRED_TTL)
82
91
 
83
92
  return token.ice_servers
84
93
 
@@ -221,7 +221,7 @@ export default theme;`}function hh(t={},...e){const{breakpoints:n,mixins:r={},sp
221
221
  `:null,c5=typeof Ih!="string"?Sm`
222
222
  animation: ${Ih} 1.4s ease-in-out infinite;
223
223
  `:null,u5=t=>{const{classes:e,variant:n,color:r,disableShrink:s}=t,a={root:["root",n,`color${Oe(r)}`],svg:["svg"],circle:["circle",`circle${Oe(n)}`,s&&"circleDisableShrink"]};return yn(a,a5,e)},d5=Fe("span",{name:"MuiCircularProgress",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,e[n.variant],e[`color${Oe(n.color)}`]]}})(On(({theme:t})=>({display:"inline-block",variants:[{props:{variant:"determinate"},style:{transition:t.transitions.create("transform")}},{props:{variant:"indeterminate"},style:l5||{animation:`${xh} 1.4s linear infinite`}},...Object.entries(t.palette).filter(Ii()).map(([e])=>({props:{color:e},style:{color:(t.vars||t).palette[e].main}}))]}))),f5=Fe("svg",{name:"MuiCircularProgress",slot:"Svg",overridesResolver:(t,e)=>e.svg})({display:"block"}),p5=Fe("circle",{name:"MuiCircularProgress",slot:"Circle",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.circle,e[`circle${Oe(n.variant)}`],n.disableShrink&&e.circleDisableShrink]}})(On(({theme:t})=>({stroke:"currentColor",variants:[{props:{variant:"determinate"},style:{transition:t.transitions.create("stroke-dashoffset")}},{props:{variant:"indeterminate"},style:{strokeDasharray:"80px, 200px",strokeDashoffset:0}},{props:({ownerState:e})=>e.variant==="indeterminate"&&!e.disableShrink,style:c5||{animation:`${Ih} 1.4s ease-in-out infinite`}}]}))),Wm=T.forwardRef(function(e,n){const r=sn({props:e,name:"MuiCircularProgress"}),{className:s,color:a="primary",disableShrink:c=!1,size:u=40,style:f,thickness:h=3.6,value:y=0,variant:g="indeterminate",...v}=r,C={...r,color:a,disableShrink:c,size:u,thickness:h,value:y,variant:g},w=u5(C),_={},I={},P={};if(g==="determinate"){const L=2*Math.PI*((Qi-h)/2);_.strokeDasharray=L.toFixed(3),P["aria-valuenow"]=Math.round(y),_.strokeDashoffset=`${((100-y)/100*L).toFixed(3)}px`,I.transform="rotate(-90deg)"}return $.jsx(d5,{className:ot(w.root,s),style:{width:u,height:u,...I,...f},ownerState:C,ref:n,role:"progressbar",...P,...v,children:$.jsx(f5,{className:w.svg,ownerState:C,viewBox:`${Qi/2} ${Qi/2} ${Qi} ${Qi}`,children:$.jsx(p5,{className:w.circle,style:_,ownerState:C,cx:Qi,cy:Qi,r:(Qi-h)/2,fill:"none",strokeWidth:h})})})});function h5(t){return hn("MuiIconButton",t)}const l1=mn("MuiIconButton",["root","disabled","colorInherit","colorPrimary","colorSecondary","colorError","colorInfo","colorSuccess","colorWarning","edgeStart","edgeEnd","sizeSmall","sizeMedium","sizeLarge","loading","loadingIndicator","loadingWrapper"]),m5=t=>{const{classes:e,disabled:n,color:r,edge:s,size:a,loading:c}=t,u={root:["root",c&&"loading",n&&"disabled",r!=="default"&&`color${Oe(r)}`,s&&`edge${Oe(s)}`,`size${Oe(a)}`],loadingIndicator:["loadingIndicator"],loadingWrapper:["loadingWrapper"]};return yn(u,h5,e)},y5=Fe(j2,{name:"MuiIconButton",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,n.loading&&e.loading,n.color!=="default"&&e[`color${Oe(n.color)}`],n.edge&&e[`edge${Oe(n.edge)}`],e[`size${Oe(n.size)}`]]}})(On(({theme:t})=>({textAlign:"center",flex:"0 0 auto",fontSize:t.typography.pxToRem(24),padding:8,borderRadius:"50%",color:(t.vars||t).palette.action.active,transition:t.transitions.create("background-color",{duration:t.transitions.duration.shortest}),variants:[{props:e=>!e.disableRipple,style:{"--IconButton-hoverBg":t.vars?`rgba(${t.vars.palette.action.activeChannel} / ${t.vars.palette.action.hoverOpacity})`:Hr(t.palette.action.active,t.palette.action.hoverOpacity),"&:hover":{backgroundColor:"var(--IconButton-hoverBg)","@media (hover: none)":{backgroundColor:"transparent"}}}},{props:{edge:"start"},style:{marginLeft:-12}},{props:{edge:"start",size:"small"},style:{marginLeft:-3}},{props:{edge:"end"},style:{marginRight:-12}},{props:{edge:"end",size:"small"},style:{marginRight:-3}}]})),On(({theme:t})=>({variants:[{props:{color:"inherit"},style:{color:"inherit"}},...Object.entries(t.palette).filter(Ii()).map(([e])=>({props:{color:e},style:{color:(t.vars||t).palette[e].main}})),...Object.entries(t.palette).filter(Ii()).map(([e])=>({props:{color:e},style:{"--IconButton-hoverBg":t.vars?`rgba(${(t.vars||t).palette[e].mainChannel} / ${t.vars.palette.action.hoverOpacity})`:Hr((t.vars||t).palette[e].main,t.palette.action.hoverOpacity)}})),{props:{size:"small"},style:{padding:5,fontSize:t.typography.pxToRem(18)}},{props:{size:"large"},style:{padding:12,fontSize:t.typography.pxToRem(28)}}],[`&.${l1.disabled}`]:{backgroundColor:"transparent",color:(t.vars||t).palette.action.disabled},[`&.${l1.loading}`]:{color:"transparent"}}))),g5=Fe("span",{name:"MuiIconButton",slot:"LoadingIndicator",overridesResolver:(t,e)=>e.loadingIndicator})(({theme:t})=>({display:"none",position:"absolute",visibility:"visible",top:"50%",left:"50%",transform:"translate(-50%, -50%)",color:(t.vars||t).palette.action.disabled,variants:[{props:{loading:!0},style:{display:"flex"}}]})),v5=T.forwardRef(function(e,n){const r=sn({props:e,name:"MuiIconButton"}),{edge:s=!1,children:a,className:c,color:u="default",disabled:f=!1,disableFocusRipple:h=!1,size:y="medium",id:g,loading:v=null,loadingIndicator:C,...w}=r,_=XS(g),I=C??$.jsx(Wm,{"aria-labelledby":_,color:"inherit",size:16}),P={...r,edge:s,color:u,disabled:f,disableFocusRipple:h,loading:v,loadingIndicator:I,size:y},L=m5(P);return $.jsxs(y5,{id:v?_:g,className:ot(L.root,c),centerRipple:!0,focusRipple:!h,disabled:f||v,ref:n,...w,ownerState:P,children:[typeof v=="boolean"&&$.jsx("span",{className:L.loadingWrapper,style:{display:"contents"},children:$.jsx(g5,{className:L.loadingIndicator,ownerState:P,children:v&&I})}),a]})}),b5=po($.jsx("path",{d:"M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2, 4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0, 0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z"}),"SuccessOutlined"),S5=po($.jsx("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),_5=po($.jsx("path",{d:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),"ErrorOutline"),C5=po($.jsx("path",{d:"M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20, 12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10, 10 0 0,0 12,2M11,17H13V11H11V17Z"}),"InfoOutlined"),w5=po($.jsx("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close"),x5=t=>{const{variant:e,color:n,severity:r,classes:s}=t,a={root:["root",`color${Oe(n||r)}`,`${e}${Oe(n||r)}`,`${e}`],icon:["icon"],message:["message"],action:["action"]};return yn(a,NP,s)},I5=Fe(_d,{name:"MuiAlert",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,e[n.variant],e[`${n.variant}${Oe(n.color||n.severity)}`]]}})(On(({theme:t})=>{const e=t.palette.mode==="light"?fl:pl,n=t.palette.mode==="light"?pl:fl;return{...t.typography.body2,backgroundColor:"transparent",display:"flex",padding:"6px 16px",variants:[...Object.entries(t.palette).filter(Ii(["light"])).map(([r])=>({props:{colorSeverity:r,variant:"standard"},style:{color:t.vars?t.vars.palette.Alert[`${r}Color`]:e(t.palette[r].light,.6),backgroundColor:t.vars?t.vars.palette.Alert[`${r}StandardBg`]:n(t.palette[r].light,.9),[`& .${s1.icon}`]:t.vars?{color:t.vars.palette.Alert[`${r}IconColor`]}:{color:t.palette[r].main}}})),...Object.entries(t.palette).filter(Ii(["light"])).map(([r])=>({props:{colorSeverity:r,variant:"outlined"},style:{color:t.vars?t.vars.palette.Alert[`${r}Color`]:e(t.palette[r].light,.6),border:`1px solid ${(t.vars||t).palette[r].light}`,[`& .${s1.icon}`]:t.vars?{color:t.vars.palette.Alert[`${r}IconColor`]}:{color:t.palette[r].main}}})),...Object.entries(t.palette).filter(Ii(["dark"])).map(([r])=>({props:{colorSeverity:r,variant:"filled"},style:{fontWeight:t.typography.fontWeightMedium,...t.vars?{color:t.vars.palette.Alert[`${r}FilledColor`],backgroundColor:t.vars.palette.Alert[`${r}FilledBg`]}:{backgroundColor:t.palette.mode==="dark"?t.palette[r].dark:t.palette[r].main,color:t.palette.getContrastText(t.palette[r].main)}}}))]}})),k5=Fe("div",{name:"MuiAlert",slot:"Icon",overridesResolver:(t,e)=>e.icon})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),T5=Fe("div",{name:"MuiAlert",slot:"Message",overridesResolver:(t,e)=>e.message})({padding:"8px 0",minWidth:0,overflow:"auto"}),R5=Fe("div",{name:"MuiAlert",slot:"Action",overridesResolver:(t,e)=>e.action})({display:"flex",alignItems:"flex-start",padding:"4px 0 0 16px",marginLeft:"auto",marginRight:-8}),c1={success:$.jsx(b5,{fontSize:"inherit"}),warning:$.jsx(S5,{fontSize:"inherit"}),error:$.jsx(_5,{fontSize:"inherit"}),info:$.jsx(C5,{fontSize:"inherit"})},U2=T.forwardRef(function(e,n){const r=sn({props:e,name:"MuiAlert"}),{action:s,children:a,className:c,closeText:u="Close",color:f,components:h={},componentsProps:y={},icon:g,iconMapping:v=c1,onClose:C,role:w="alert",severity:_="success",slotProps:I={},slots:P={},variant:L="standard",...N}=r,E={...r,color:f,severity:_,variant:L,colorSeverity:f||_},O=x5(E),z={slots:{closeButton:h.CloseButton,closeIcon:h.CloseIcon,...P},slotProps:{...y,...I}},[M,V]=ws("root",{ref:n,shouldForwardComponentProp:!0,className:ot(O.root,c),elementType:I5,externalForwardedProps:{...z,...N},ownerState:E,additionalProps:{role:w,elevation:0}}),[Y,S]=ws("icon",{className:O.icon,elementType:k5,externalForwardedProps:z,ownerState:E}),[j,W]=ws("message",{className:O.message,elementType:T5,externalForwardedProps:z,ownerState:E}),[X,ae]=ws("action",{className:O.action,elementType:R5,externalForwardedProps:z,ownerState:E}),[ce,de]=ws("closeButton",{elementType:v5,externalForwardedProps:z,ownerState:E}),[fe,q]=ws("closeIcon",{elementType:w5,externalForwardedProps:z,ownerState:E});return $.jsxs(M,{...V,children:[g!==!1?$.jsx(Y,{...S,children:g||v[_]||c1[_]}):null,$.jsx(j,{...W,children:a}),s!=null?$.jsx(X,{...ae,children:s}):null,s==null&&C?$.jsx(X,{...ae,children:$.jsx(ce,{size:"small","aria-label":u,title:u,color:"inherit",onClick:C,...de,children:$.jsx(fe,{fontSize:"small",...q})})}):null]})});function E5(t){return hn("MuiButton",t)}const Eo=mn("MuiButton",["root","text","textInherit","textPrimary","textSecondary","textSuccess","textError","textInfo","textWarning","outlined","outlinedInherit","outlinedPrimary","outlinedSecondary","outlinedSuccess","outlinedError","outlinedInfo","outlinedWarning","contained","containedInherit","containedPrimary","containedSecondary","containedSuccess","containedError","containedInfo","containedWarning","disableElevation","focusVisible","disabled","colorInherit","colorPrimary","colorSecondary","colorSuccess","colorError","colorInfo","colorWarning","textSizeSmall","textSizeMedium","textSizeLarge","outlinedSizeSmall","outlinedSizeMedium","outlinedSizeLarge","containedSizeSmall","containedSizeMedium","containedSizeLarge","sizeMedium","sizeSmall","sizeLarge","fullWidth","startIcon","endIcon","icon","iconSizeSmall","iconSizeMedium","iconSizeLarge","loading","loadingWrapper","loadingIconPlaceholder","loadingIndicator","loadingPositionCenter","loadingPositionStart","loadingPositionEnd"]),A5=T.createContext({}),P5=T.createContext(void 0),O5=t=>{const{color:e,disableElevation:n,fullWidth:r,size:s,variant:a,loading:c,loadingPosition:u,classes:f}=t,h={root:["root",c&&"loading",a,`${a}${Oe(e)}`,`size${Oe(s)}`,`${a}Size${Oe(s)}`,`color${Oe(e)}`,n&&"disableElevation",r&&"fullWidth",c&&`loadingPosition${Oe(u)}`],startIcon:["icon","startIcon",`iconSize${Oe(s)}`],endIcon:["icon","endIcon",`iconSize${Oe(s)}`],loadingIndicator:["loadingIndicator"],loadingWrapper:["loadingWrapper"]},y=yn(h,E5,f);return{...f,...y}},V2=[{props:{size:"small"},style:{"& > *:nth-of-type(1)":{fontSize:18}}},{props:{size:"medium"},style:{"& > *:nth-of-type(1)":{fontSize:20}}},{props:{size:"large"},style:{"& > *:nth-of-type(1)":{fontSize:22}}}],M5=Fe(j2,{shouldForwardProp:t=>Al(t)||t==="classes",name:"MuiButton",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,e[n.variant],e[`${n.variant}${Oe(n.color)}`],e[`size${Oe(n.size)}`],e[`${n.variant}Size${Oe(n.size)}`],n.color==="inherit"&&e.colorInherit,n.disableElevation&&e.disableElevation,n.fullWidth&&e.fullWidth,n.loading&&e.loading]}})(On(({theme:t})=>{const e=t.palette.mode==="light"?t.palette.grey[300]:t.palette.grey[800],n=t.palette.mode==="light"?t.palette.grey.A100:t.palette.grey[700];return{...t.typography.button,minWidth:64,padding:"6px 16px",border:0,borderRadius:(t.vars||t).shape.borderRadius,transition:t.transitions.create(["background-color","box-shadow","border-color","color"],{duration:t.transitions.duration.short}),"&:hover":{textDecoration:"none"},[`&.${Eo.disabled}`]:{color:(t.vars||t).palette.action.disabled},variants:[{props:{variant:"contained"},style:{color:"var(--variant-containedColor)",backgroundColor:"var(--variant-containedBg)",boxShadow:(t.vars||t).shadows[2],"&:hover":{boxShadow:(t.vars||t).shadows[4],"@media (hover: none)":{boxShadow:(t.vars||t).shadows[2]}},"&:active":{boxShadow:(t.vars||t).shadows[8]},[`&.${Eo.focusVisible}`]:{boxShadow:(t.vars||t).shadows[6]},[`&.${Eo.disabled}`]:{color:(t.vars||t).palette.action.disabled,boxShadow:(t.vars||t).shadows[0],backgroundColor:(t.vars||t).palette.action.disabledBackground}}},{props:{variant:"outlined"},style:{padding:"5px 15px",border:"1px solid currentColor",borderColor:"var(--variant-outlinedBorder, currentColor)",backgroundColor:"var(--variant-outlinedBg)",color:"var(--variant-outlinedColor)",[`&.${Eo.disabled}`]:{border:`1px solid ${(t.vars||t).palette.action.disabledBackground}`}}},{props:{variant:"text"},style:{padding:"6px 8px",color:"var(--variant-textColor)",backgroundColor:"var(--variant-textBg)"}},...Object.entries(t.palette).filter(Ii()).map(([r])=>({props:{color:r},style:{"--variant-textColor":(t.vars||t).palette[r].main,"--variant-outlinedColor":(t.vars||t).palette[r].main,"--variant-outlinedBorder":t.vars?`rgba(${t.vars.palette[r].mainChannel} / 0.5)`:Hr(t.palette[r].main,.5),"--variant-containedColor":(t.vars||t).palette[r].contrastText,"--variant-containedBg":(t.vars||t).palette[r].main,"@media (hover: hover)":{"&:hover":{"--variant-containedBg":(t.vars||t).palette[r].dark,"--variant-textBg":t.vars?`rgba(${t.vars.palette[r].mainChannel} / ${t.vars.palette.action.hoverOpacity})`:Hr(t.palette[r].main,t.palette.action.hoverOpacity),"--variant-outlinedBorder":(t.vars||t).palette[r].main,"--variant-outlinedBg":t.vars?`rgba(${t.vars.palette[r].mainChannel} / ${t.vars.palette.action.hoverOpacity})`:Hr(t.palette[r].main,t.palette.action.hoverOpacity)}}}})),{props:{color:"inherit"},style:{color:"inherit",borderColor:"currentColor","--variant-containedBg":t.vars?t.vars.palette.Button.inheritContainedBg:e,"@media (hover: hover)":{"&:hover":{"--variant-containedBg":t.vars?t.vars.palette.Button.inheritContainedHoverBg:n,"--variant-textBg":t.vars?`rgba(${t.vars.palette.text.primaryChannel} / ${t.vars.palette.action.hoverOpacity})`:Hr(t.palette.text.primary,t.palette.action.hoverOpacity),"--variant-outlinedBg":t.vars?`rgba(${t.vars.palette.text.primaryChannel} / ${t.vars.palette.action.hoverOpacity})`:Hr(t.palette.text.primary,t.palette.action.hoverOpacity)}}}},{props:{size:"small",variant:"text"},style:{padding:"4px 5px",fontSize:t.typography.pxToRem(13)}},{props:{size:"large",variant:"text"},style:{padding:"8px 11px",fontSize:t.typography.pxToRem(15)}},{props:{size:"small",variant:"outlined"},style:{padding:"3px 9px",fontSize:t.typography.pxToRem(13)}},{props:{size:"large",variant:"outlined"},style:{padding:"7px 21px",fontSize:t.typography.pxToRem(15)}},{props:{size:"small",variant:"contained"},style:{padding:"4px 10px",fontSize:t.typography.pxToRem(13)}},{props:{size:"large",variant:"contained"},style:{padding:"8px 22px",fontSize:t.typography.pxToRem(15)}},{props:{disableElevation:!0},style:{boxShadow:"none","&:hover":{boxShadow:"none"},[`&.${Eo.focusVisible}`]:{boxShadow:"none"},"&:active":{boxShadow:"none"},[`&.${Eo.disabled}`]:{boxShadow:"none"}}},{props:{fullWidth:!0},style:{width:"100%"}},{props:{loadingPosition:"center"},style:{transition:t.transitions.create(["background-color","box-shadow","border-color"],{duration:t.transitions.duration.short}),[`&.${Eo.loading}`]:{color:"transparent"}}}]}})),D5=Fe("span",{name:"MuiButton",slot:"StartIcon",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.startIcon,n.loading&&e.startIconLoadingStart,e[`iconSize${Oe(n.size)}`]]}})(({theme:t})=>({display:"inherit",marginRight:8,marginLeft:-4,variants:[{props:{size:"small"},style:{marginLeft:-2}},{props:{loadingPosition:"start",loading:!0},style:{transition:t.transitions.create(["opacity"],{duration:t.transitions.duration.short}),opacity:0}},{props:{loadingPosition:"start",loading:!0,fullWidth:!0},style:{marginRight:-8}},...V2]})),N5=Fe("span",{name:"MuiButton",slot:"EndIcon",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.endIcon,n.loading&&e.endIconLoadingEnd,e[`iconSize${Oe(n.size)}`]]}})(({theme:t})=>({display:"inherit",marginRight:-4,marginLeft:8,variants:[{props:{size:"small"},style:{marginRight:-2}},{props:{loadingPosition:"end",loading:!0},style:{transition:t.transitions.create(["opacity"],{duration:t.transitions.duration.short}),opacity:0}},{props:{loadingPosition:"end",loading:!0,fullWidth:!0},style:{marginLeft:-8}},...V2]})),B5=Fe("span",{name:"MuiButton",slot:"LoadingIndicator",overridesResolver:(t,e)=>e.loadingIndicator})(({theme:t})=>({display:"none",position:"absolute",visibility:"visible",variants:[{props:{loading:!0},style:{display:"flex"}},{props:{loadingPosition:"start"},style:{left:14}},{props:{loadingPosition:"start",size:"small"},style:{left:10}},{props:{variant:"text",loadingPosition:"start"},style:{left:6}},{props:{loadingPosition:"center"},style:{left:"50%",transform:"translate(-50%)",color:(t.vars||t).palette.action.disabled}},{props:{loadingPosition:"end"},style:{right:14}},{props:{loadingPosition:"end",size:"small"},style:{right:10}},{props:{variant:"text",loadingPosition:"end"},style:{right:6}},{props:{loadingPosition:"start",fullWidth:!0},style:{position:"relative",left:-10}},{props:{loadingPosition:"end",fullWidth:!0},style:{position:"relative",right:-10}}]})),u1=Fe("span",{name:"MuiButton",slot:"LoadingIconPlaceholder",overridesResolver:(t,e)=>e.loadingIconPlaceholder})({display:"inline-block",width:"1em",height:"1em"}),W2=T.forwardRef(function(e,n){const r=T.useContext(A5),s=T.useContext(P5),a=dl(r,e),c=sn({props:a,name:"MuiButton"}),{children:u,color:f="primary",component:h="button",className:y,disabled:g=!1,disableElevation:v=!1,disableFocusRipple:C=!1,endIcon:w,focusVisibleClassName:_,fullWidth:I=!1,id:P,loading:L=null,loadingIndicator:N,loadingPosition:E="center",size:O="medium",startIcon:z,type:M,variant:V="text",...Y}=c,S=XS(P),j=N??$.jsx(Wm,{"aria-labelledby":S,color:"inherit",size:16}),W={...c,color:f,component:h,disabled:g,disableElevation:v,disableFocusRipple:C,fullWidth:I,loading:L,loadingIndicator:j,loadingPosition:E,size:O,type:M,variant:V},X=O5(W),ae=(z||L&&E==="start")&&$.jsx(D5,{className:X.startIcon,ownerState:W,children:z||$.jsx(u1,{className:X.loadingIconPlaceholder,ownerState:W})}),ce=(w||L&&E==="end")&&$.jsx(N5,{className:X.endIcon,ownerState:W,children:w||$.jsx(u1,{className:X.loadingIconPlaceholder,ownerState:W})}),de=s||"",fe=typeof L=="boolean"?$.jsx("span",{className:X.loadingWrapper,style:{display:"contents"},children:L&&$.jsx(B5,{className:X.loadingIndicator,ownerState:W,children:j})}):null;return $.jsxs(M5,{ownerState:W,className:ot(r.className,X.root,y,de),component:h,disabled:g||L,focusRipple:!C,focusVisibleClassName:ot(X.focusVisible,_),ref:n,type:M,id:L?S:P,...Y,classes:X,children:[ae,E!=="end"&&fe,u,E==="end"&&fe,ce]})}),Hm=NR({createStyledComponent:Fe("div",{name:"MuiStack",slot:"Root",overridesResolver:(t,e)=>e.root}),useThemeProps:t=>sn({props:t,name:"MuiStack"})});function H2(t){return hn("MuiNativeSelect",t)}const Gm=mn("MuiNativeSelect",["root","select","multiple","filled","outlined","standard","disabled","icon","iconOpen","iconFilled","iconOutlined","iconStandard","nativeInput","error"]),L5=t=>{const{classes:e,variant:n,disabled:r,multiple:s,open:a,error:c}=t,u={select:["select",n,r&&"disabled",s&&"multiple",c&&"error"],icon:["icon",`icon${Oe(n)}`,a&&"iconOpen",r&&"disabled"]};return yn(u,H2,e)},F5=Fe("select")(({theme:t})=>({MozAppearance:"none",WebkitAppearance:"none",userSelect:"none",borderRadius:0,cursor:"pointer","&:focus":{borderRadius:0},[`&.${Gm.disabled}`]:{cursor:"default"},"&[multiple]":{height:"auto"},"&:not([multiple]) option, &:not([multiple]) optgroup":{backgroundColor:(t.vars||t).palette.background.paper},variants:[{props:({ownerState:e})=>e.variant!=="filled"&&e.variant!=="outlined",style:{"&&&":{paddingRight:24,minWidth:16}}},{props:{variant:"filled"},style:{"&&&":{paddingRight:32}}},{props:{variant:"outlined"},style:{borderRadius:(t.vars||t).shape.borderRadius,"&:focus":{borderRadius:(t.vars||t).shape.borderRadius},"&&&":{paddingRight:32}}}]})),$5=Fe(F5,{name:"MuiNativeSelect",slot:"Select",shouldForwardProp:Al,overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.select,e[n.variant],n.error&&e.error,{[`&.${Gm.multiple}`]:e.multiple}]}})({}),z5=Fe("svg")(({theme:t})=>({position:"absolute",right:0,top:"calc(50% - .5em)",pointerEvents:"none",color:(t.vars||t).palette.action.active,[`&.${Gm.disabled}`]:{color:(t.vars||t).palette.action.disabled},variants:[{props:({ownerState:e})=>e.open,style:{transform:"rotate(180deg)"}},{props:{variant:"filled"},style:{right:7}},{props:{variant:"outlined"},style:{right:7}}]})),j5=Fe(z5,{name:"MuiNativeSelect",slot:"Icon",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.icon,n.variant&&e[`icon${Oe(n.variant)}`],n.open&&e.iconOpen]}})({}),U5=T.forwardRef(function(e,n){const{className:r,disabled:s,error:a,IconComponent:c,inputRef:u,variant:f="standard",...h}=e,y={...e,disabled:s,variant:f,error:a},g=L5(y);return $.jsxs(T.Fragment,{children:[$.jsx($5,{ownerState:y,className:ot(g.select,r),disabled:s,ref:u||n,...h}),e.multiple?null:$.jsx(j5,{as:c,ownerState:y,className:g.icon})]})});function Cd({props:t,states:e,muiFormControl:n}){return e.reduce((r,s)=>(r[s]=t[s],n&&typeof t[s]>"u"&&(r[s]=n[s]),r),{})}const Ym=T.createContext(void 0);function wd(){return T.useContext(Ym)}const V5=po($.jsx("path",{d:"M7 10l5 5 5-5z"}),"ArrowDropDown");function qc(t){return parseInt(t,10)||0}const W5={shadow:{visibility:"hidden",position:"absolute",overflow:"hidden",height:0,top:0,left:0,transform:"translateZ(0)"}};function H5(t){for(const e in t)return!1;return!0}function d1(t){return H5(t)||t.outerHeightStyle===0&&!t.overflowing}const G5=T.forwardRef(function(e,n){const{onChange:r,maxRows:s,minRows:a=1,style:c,value:u,...f}=e,{current:h}=T.useRef(u!=null),y=T.useRef(null),g=hl(n,y),v=T.useRef(null),C=T.useRef(null),w=T.useCallback(()=>{const N=y.current,E=C.current;if(!N||!E)return;const z=Av(N).getComputedStyle(N);if(z.width==="0px")return{outerHeightStyle:0,overflowing:!1};E.style.width=z.width,E.value=N.value||e.placeholder||"x",E.value.slice(-1)===`
224
- `&&(E.value+=" ");const M=z.boxSizing,V=qc(z.paddingBottom)+qc(z.paddingTop),Y=qc(z.borderBottomWidth)+qc(z.borderTopWidth),S=E.scrollHeight;E.value="x";const j=E.scrollHeight;let W=S;a&&(W=Math.max(Number(a)*j,W)),s&&(W=Math.min(Number(s)*j,W)),W=Math.max(W,j);const X=W+(M==="border-box"?V+Y:0),ae=Math.abs(W-S)<=1;return{outerHeightStyle:X,overflowing:ae}},[s,a,e.placeholder]),_=Za(()=>{const N=y.current,E=w();if(!N||!E||d1(E))return!1;const O=E.outerHeightStyle;return v.current!=null&&v.current!==O}),I=T.useCallback(()=>{const N=y.current,E=w();if(!N||!E||d1(E))return;const O=E.outerHeightStyle;v.current!==O&&(v.current=O,N.style.height=`${O}px`),N.style.overflow=E.overflowing?"hidden":""},[w]),P=T.useRef(-1);Ys(()=>{const N=Y3(I),E=y==null?void 0:y.current;if(!E)return;const O=Av(E);O.addEventListener("resize",N);let z;return typeof ResizeObserver<"u"&&(z=new ResizeObserver(()=>{_()&&(z.unobserve(E),cancelAnimationFrame(P.current),I(),P.current=requestAnimationFrame(()=>{z.observe(E)}))}),z.observe(E)),()=>{N.clear(),cancelAnimationFrame(P.current),O.removeEventListener("resize",N),z&&z.disconnect()}},[w,I,_]),Ys(()=>{I()});const L=N=>{h||I(),r&&r(N)};return $.jsxs(T.Fragment,{children:[$.jsx("textarea",{value:u,onChange:L,ref:g,rows:a,style:c,...f}),$.jsx("textarea",{"aria-hidden":!0,className:e.className,readOnly:!0,ref:C,tabIndex:-1,style:{...W5.shadow,...c,paddingTop:0,paddingBottom:0}})]})});function f1(t){return typeof t=="string"}function p1(t){return t!=null&&!(Array.isArray(t)&&t.length===0)}function kh(t,e=!1){return t&&(p1(t.value)&&t.value!==""||e&&p1(t.defaultValue)&&t.defaultValue!=="")}function Y5(t){return t.startAdornment}function K5(t){return hn("MuiInputBase",t)}const Zu=mn("MuiInputBase",["root","formControl","focused","disabled","adornedStart","adornedEnd","error","sizeSmall","multiline","colorSecondary","fullWidth","hiddenLabel","readOnly","input","inputSizeSmall","inputMultiline","inputTypeSearch","inputAdornedStart","inputAdornedEnd","inputHiddenLabel"]);var h1;const G2=(t,e)=>{const{ownerState:n}=t;return[e.root,n.formControl&&e.formControl,n.startAdornment&&e.adornedStart,n.endAdornment&&e.adornedEnd,n.error&&e.error,n.size==="small"&&e.sizeSmall,n.multiline&&e.multiline,n.color&&e[`color${Oe(n.color)}`],n.fullWidth&&e.fullWidth,n.hiddenLabel&&e.hiddenLabel]},Y2=(t,e)=>{const{ownerState:n}=t;return[e.input,n.size==="small"&&e.inputSizeSmall,n.multiline&&e.inputMultiline,n.type==="search"&&e.inputTypeSearch,n.startAdornment&&e.inputAdornedStart,n.endAdornment&&e.inputAdornedEnd,n.hiddenLabel&&e.inputHiddenLabel]},Q5=t=>{const{classes:e,color:n,disabled:r,error:s,endAdornment:a,focused:c,formControl:u,fullWidth:f,hiddenLabel:h,multiline:y,readOnly:g,size:v,startAdornment:C,type:w}=t,_={root:["root",`color${Oe(n)}`,r&&"disabled",s&&"error",f&&"fullWidth",c&&"focused",u&&"formControl",v&&v!=="medium"&&`size${Oe(v)}`,y&&"multiline",C&&"adornedStart",a&&"adornedEnd",h&&"hiddenLabel",g&&"readOnly"],input:["input",r&&"disabled",w==="search"&&"inputTypeSearch",y&&"inputMultiline",v==="small"&&"inputSizeSmall",h&&"inputHiddenLabel",C&&"inputAdornedStart",a&&"inputAdornedEnd",g&&"readOnly"]};return yn(_,K5,e)},K2=Fe("div",{name:"MuiInputBase",slot:"Root",overridesResolver:G2})(On(({theme:t})=>({...t.typography.body1,color:(t.vars||t).palette.text.primary,lineHeight:"1.4375em",boxSizing:"border-box",position:"relative",cursor:"text",display:"inline-flex",alignItems:"center",[`&.${Zu.disabled}`]:{color:(t.vars||t).palette.text.disabled,cursor:"default"},variants:[{props:({ownerState:e})=>e.multiline,style:{padding:"4px 0 5px"}},{props:({ownerState:e,size:n})=>e.multiline&&n==="small",style:{paddingTop:1}},{props:({ownerState:e})=>e.fullWidth,style:{width:"100%"}}]}))),Q2=Fe("input",{name:"MuiInputBase",slot:"Input",overridesResolver:Y2})(On(({theme:t})=>{const e=t.palette.mode==="light",n={color:"currentColor",...t.vars?{opacity:t.vars.opacity.inputPlaceholder}:{opacity:e?.42:.5},transition:t.transitions.create("opacity",{duration:t.transitions.duration.shorter})},r={opacity:"0 !important"},s=t.vars?{opacity:t.vars.opacity.inputPlaceholder}:{opacity:e?.42:.5};return{font:"inherit",letterSpacing:"inherit",color:"currentColor",padding:"4px 0 5px",border:0,boxSizing:"content-box",background:"none",height:"1.4375em",margin:0,WebkitTapHighlightColor:"transparent",display:"block",minWidth:0,width:"100%","&::-webkit-input-placeholder":n,"&::-moz-placeholder":n,"&::-ms-input-placeholder":n,"&:focus":{outline:0},"&:invalid":{boxShadow:"none"},"&::-webkit-search-decoration":{WebkitAppearance:"none"},[`label[data-shrink=false] + .${Zu.formControl} &`]:{"&::-webkit-input-placeholder":r,"&::-moz-placeholder":r,"&::-ms-input-placeholder":r,"&:focus::-webkit-input-placeholder":s,"&:focus::-moz-placeholder":s,"&:focus::-ms-input-placeholder":s},[`&.${Zu.disabled}`]:{opacity:1,WebkitTextFillColor:(t.vars||t).palette.text.disabled},variants:[{props:({ownerState:a})=>!a.disableInjectingGlobalStyles,style:{animationName:"mui-auto-fill-cancel",animationDuration:"10ms","&:-webkit-autofill":{animationDuration:"5000s",animationName:"mui-auto-fill"}}},{props:{size:"small"},style:{paddingTop:1}},{props:({ownerState:a})=>a.multiline,style:{height:"auto",resize:"none",padding:0,paddingTop:0}},{props:{type:"search"},style:{MozAppearance:"textfield"}}]}})),m1=jm({"@keyframes mui-auto-fill":{from:{display:"block"}},"@keyframes mui-auto-fill-cancel":{from:{display:"block"}}}),X5=T.forwardRef(function(e,n){const r=sn({props:e,name:"MuiInputBase"}),{"aria-describedby":s,autoComplete:a,autoFocus:c,className:u,color:f,components:h={},componentsProps:y={},defaultValue:g,disabled:v,disableInjectingGlobalStyles:C,endAdornment:w,error:_,fullWidth:I=!1,id:P,inputComponent:L="input",inputProps:N={},inputRef:E,margin:O,maxRows:z,minRows:M,multiline:V=!1,name:Y,onBlur:S,onChange:j,onClick:W,onFocus:X,onKeyDown:ae,onKeyUp:ce,placeholder:de,readOnly:fe,renderSuffix:q,rows:te,size:ne,slotProps:R={},slots:G={},startAdornment:ue,type:ge="text",value:De,...xe}=r,$e=N.value!=null?N.value:De,{current:Ne}=T.useRef($e!=null),je=T.useRef(),Bt=T.useCallback(He=>{},[]),ur=hl(je,E,N.ref,Bt),[dr,Dn]=T.useState(!1),Je=wd(),jt=Cd({props:r,muiFormControl:Je,states:["color","disabled","error","hiddenLabel","size","required","filled"]});jt.focused=Je?Je.focused:dr,T.useEffect(()=>{!Je&&v&&dr&&(Dn(!1),S&&S())},[Je,v,dr,S]);const fr=Je&&Je.onFilled,Qt=Je&&Je.onEmpty,st=T.useCallback(He=>{kh(He)?fr&&fr():Qt&&Qt()},[fr,Qt]);Ys(()=>{Ne&&st({value:$e})},[$e,st,Ne]);const Nn=He=>{X&&X(He),N.onFocus&&N.onFocus(He),Je&&Je.onFocus?Je.onFocus(He):Dn(!0)},Xt=He=>{S&&S(He),N.onBlur&&N.onBlur(He),Je&&Je.onBlur?Je.onBlur(He):Dn(!1)},Yn=(He,...Jt)=>{if(!Ne){const ln=He.target||je.current;if(ln==null)throw new Error(io(1));st({value:ln.value})}N.onChange&&N.onChange(He,...Jt),j&&j(He,...Jt)};T.useEffect(()=>{st(je.current)},[]);const me=He=>{je.current&&He.currentTarget===He.target&&je.current.focus(),W&&W(He)};let Zr=L,an=N;V&&Zr==="input"&&(te?an={type:void 0,minRows:te,maxRows:te,...an}:an={type:void 0,maxRows:z,minRows:M,...an},Zr=G5);const ho=He=>{st(He.animationName==="mui-auto-fill-cancel"?je.current:{value:"x"})};T.useEffect(()=>{Je&&Je.setAdornedStart(!!ue)},[Je,ue]);const ei={...r,color:jt.color||"primary",disabled:jt.disabled,endAdornment:w,error:jt.error,focused:jt.focused,formControl:Je,fullWidth:I,hiddenLabel:jt.hiddenLabel,multiline:V,size:jt.size,startAdornment:ue,type:ge},ti=Q5(ei),vt=G.root||h.Root||K2,Tt=R.root||y.root||{},wt=G.input||h.Input||Q2;return an={...an,...R.input??y.input},$.jsxs(T.Fragment,{children:[!C&&typeof m1=="function"&&(h1||(h1=$.jsx(m1,{}))),$.jsxs(vt,{...Tt,ref:n,onClick:me,...xe,...!f1(vt)&&{ownerState:{...ei,...Tt.ownerState}},className:ot(ti.root,Tt.className,u,fe&&"MuiInputBase-readOnly"),children:[ue,$.jsx(Ym.Provider,{value:null,children:$.jsx(wt,{"aria-invalid":jt.error,"aria-describedby":s,autoComplete:a,autoFocus:c,defaultValue:g,disabled:jt.disabled,id:P,onAnimationStart:ho,name:Y,placeholder:de,readOnly:fe,required:jt.required,rows:te,value:$e,onKeyDown:ae,onKeyUp:ce,type:ge,...an,...!f1(wt)&&{as:Zr,ownerState:{...ei,...an.ownerState}},ref:ur,className:ot(ti.input,an.className,fe&&"MuiInputBase-readOnly"),onBlur:Xt,onChange:Yn,onFocus:Nn})}),w,q?q({...jt,startAdornment:ue}):null]})]})});function J5(t){return hn("MuiInput",t)}const Wa={...Zu,...mn("MuiInput",["root","underline","input"])},q5=t=>{const{classes:e,disableUnderline:n}=t,s=yn({root:["root",!n&&"underline"],input:["input"]},J5,e);return{...e,...s}},Z5=Fe(K2,{shouldForwardProp:t=>Al(t)||t==="classes",name:"MuiInput",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[...G2(t,e),!n.disableUnderline&&e.underline]}})(On(({theme:t})=>{let n=t.palette.mode==="light"?"rgba(0, 0, 0, 0.42)":"rgba(255, 255, 255, 0.7)";return t.vars&&(n=`rgba(${t.vars.palette.common.onBackgroundChannel} / ${t.vars.opacity.inputUnderline})`),{position:"relative",variants:[{props:({ownerState:r})=>r.formControl,style:{"label + &":{marginTop:16}}},{props:({ownerState:r})=>!r.disableUnderline,style:{"&::after":{left:0,bottom:0,content:'""',position:"absolute",right:0,transform:"scaleX(0)",transition:t.transitions.create("transform",{duration:t.transitions.duration.shorter,easing:t.transitions.easing.easeOut}),pointerEvents:"none"},[`&.${Wa.focused}:after`]:{transform:"scaleX(1) translateX(0)"},[`&.${Wa.error}`]:{"&::before, &::after":{borderBottomColor:(t.vars||t).palette.error.main}},"&::before":{borderBottom:`1px solid ${n}`,left:0,bottom:0,content:'"\\00a0"',position:"absolute",right:0,transition:t.transitions.create("border-bottom-color",{duration:t.transitions.duration.shorter}),pointerEvents:"none"},[`&:hover:not(.${Wa.disabled}, .${Wa.error}):before`]:{borderBottom:`2px solid ${(t.vars||t).palette.text.primary}`,"@media (hover: none)":{borderBottom:`1px solid ${n}`}},[`&.${Wa.disabled}:before`]:{borderBottomStyle:"dotted"}}},...Object.entries(t.palette).filter(Ii()).map(([r])=>({props:{color:r,disableUnderline:!1},style:{"&::after":{borderBottom:`2px solid ${(t.vars||t).palette[r].main}`}}}))]}})),e4=Fe(Q2,{name:"MuiInput",slot:"Input",overridesResolver:Y2})({}),X2=T.forwardRef(function(e,n){const r=sn({props:e,name:"MuiInput"}),{disableUnderline:s=!1,components:a={},componentsProps:c,fullWidth:u=!1,inputComponent:f="input",multiline:h=!1,slotProps:y,slots:g={},type:v="text",...C}=r,w=q5(r),I={root:{ownerState:{disableUnderline:s}}},P=y??c?on(y??c,I):I,L=g.root??a.Root??Z5,N=g.input??a.Input??e4;return $.jsx(X5,{slots:{root:L,input:N},slotProps:P,fullWidth:u,inputComponent:f,multiline:h,ref:n,type:v,...C,classes:w})});X2.muiName="Input";const t4=t=>{const{classes:e}=t;return yn({root:["root"]},H2,e)},n4=$.jsx(X2,{}),Th=T.forwardRef(function(e,n){const r=sn({name:"MuiNativeSelect",props:e}),{className:s,children:a,classes:c={},IconComponent:u=V5,input:f=n4,inputProps:h,variant:y,...g}=r,v=wd(),C=Cd({props:r,muiFormControl:v,states:["variant"]}),w={...r,classes:c},_=t4(w),{root:I,...P}=c;return $.jsx(T.Fragment,{children:T.cloneElement(f,{inputComponent:U5,inputProps:{children:a,classes:P,IconComponent:u,variant:C.variant,type:void 0,...h,...f?f.props.inputProps:{}},ref:n,...g,className:ot(_.root,f.props.className,s)})})});Th.muiName="Select";function r4(t){return hn("MuiFormLabel",t)}const el=mn("MuiFormLabel",["root","colorSecondary","focused","disabled","error","filled","required","asterisk"]),i4=t=>{const{classes:e,color:n,focused:r,disabled:s,error:a,filled:c,required:u}=t,f={root:["root",`color${Oe(n)}`,s&&"disabled",a&&"error",c&&"filled",r&&"focused",u&&"required"],asterisk:["asterisk",a&&"error"]};return yn(f,r4,e)},o4=Fe("label",{name:"MuiFormLabel",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,n.color==="secondary"&&e.colorSecondary,n.filled&&e.filled]}})(On(({theme:t})=>({color:(t.vars||t).palette.text.secondary,...t.typography.body1,lineHeight:"1.4375em",padding:0,position:"relative",variants:[...Object.entries(t.palette).filter(Ii()).map(([e])=>({props:{color:e},style:{[`&.${el.focused}`]:{color:(t.vars||t).palette[e].main}}})),{props:{},style:{[`&.${el.disabled}`]:{color:(t.vars||t).palette.text.disabled},[`&.${el.error}`]:{color:(t.vars||t).palette.error.main}}}]}))),s4=Fe("span",{name:"MuiFormLabel",slot:"Asterisk",overridesResolver:(t,e)=>e.asterisk})(On(({theme:t})=>({[`&.${el.error}`]:{color:(t.vars||t).palette.error.main}}))),a4=T.forwardRef(function(e,n){const r=sn({props:e,name:"MuiFormLabel"}),{children:s,className:a,color:c,component:u="label",disabled:f,error:h,filled:y,focused:g,required:v,...C}=r,w=wd(),_=Cd({props:r,muiFormControl:w,states:["color","required","focused","disabled","error","filled"]}),I={...r,color:_.color||"primary",component:u,disabled:_.disabled,error:_.error,filled:_.filled,focused:_.focused,required:_.required},P=i4(I);return $.jsxs(o4,{as:u,ownerState:I,className:ot(P.root,a),ref:n,...C,children:[s,_.required&&$.jsxs(s4,{ownerState:I,"aria-hidden":!0,className:P.asterisk,children:[" ","*"]})]})});function l4(t){return hn("MuiInputLabel",t)}mn("MuiInputLabel",["root","focused","disabled","error","required","asterisk","formControl","sizeSmall","shrink","animated","standard","filled","outlined"]);const c4=t=>{const{classes:e,formControl:n,size:r,shrink:s,disableAnimation:a,variant:c,required:u}=t,f={root:["root",n&&"formControl",!a&&"animated",s&&"shrink",r&&r!=="normal"&&`size${Oe(r)}`,c],asterisk:[u&&"asterisk"]},h=yn(f,l4,e);return{...e,...h}},u4=Fe(a4,{shouldForwardProp:t=>Al(t)||t==="classes",name:"MuiInputLabel",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[{[`& .${el.asterisk}`]:e.asterisk},e.root,n.formControl&&e.formControl,n.size==="small"&&e.sizeSmall,n.shrink&&e.shrink,!n.disableAnimation&&e.animated,n.focused&&e.focused,e[n.variant]]}})(On(({theme:t})=>({display:"block",transformOrigin:"top left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%",variants:[{props:({ownerState:e})=>e.formControl,style:{position:"absolute",left:0,top:0,transform:"translate(0, 20px) scale(1)"}},{props:{size:"small"},style:{transform:"translate(0, 17px) scale(1)"}},{props:({ownerState:e})=>e.shrink,style:{transform:"translate(0, -1.5px) scale(0.75)",transformOrigin:"top left",maxWidth:"133%"}},{props:({ownerState:e})=>!e.disableAnimation,style:{transition:t.transitions.create(["color","transform","max-width"],{duration:t.transitions.duration.shorter,easing:t.transitions.easing.easeOut})}},{props:{variant:"filled"},style:{zIndex:1,pointerEvents:"none",transform:"translate(12px, 16px) scale(1)",maxWidth:"calc(100% - 24px)"}},{props:{variant:"filled",size:"small"},style:{transform:"translate(12px, 13px) scale(1)"}},{props:({variant:e,ownerState:n})=>e==="filled"&&n.shrink,style:{userSelect:"none",pointerEvents:"auto",transform:"translate(12px, 7px) scale(0.75)",maxWidth:"calc(133% - 24px)"}},{props:({variant:e,ownerState:n,size:r})=>e==="filled"&&n.shrink&&r==="small",style:{transform:"translate(12px, 4px) scale(0.75)"}},{props:{variant:"outlined"},style:{zIndex:1,pointerEvents:"none",transform:"translate(14px, 16px) scale(1)",maxWidth:"calc(100% - 24px)"}},{props:{variant:"outlined",size:"small"},style:{transform:"translate(14px, 9px) scale(1)"}},{props:({variant:e,ownerState:n})=>e==="outlined"&&n.shrink,style:{userSelect:"none",pointerEvents:"auto",maxWidth:"calc(133% - 32px)",transform:"translate(14px, -9px) scale(0.75)"}}]}))),y1=T.forwardRef(function(e,n){const r=sn({name:"MuiInputLabel",props:e}),{disableAnimation:s=!1,margin:a,shrink:c,variant:u,className:f,...h}=r,y=wd();let g=c;typeof g>"u"&&y&&(g=y.filled||y.focused||y.adornedStart);const v=Cd({props:r,muiFormControl:y,states:["size","variant","required","focused"]}),C={...r,disableAnimation:s,formControl:y,shrink:g,size:v.size,variant:v.variant,required:v.required,focused:v.focused},w=c4(C);return $.jsx(u4,{"data-shrink":g,ref:n,className:ot(w.root,f),...h,ownerState:C,classes:w})});function d4(t){return hn("MuiFormControl",t)}mn("MuiFormControl",["root","marginNone","marginNormal","marginDense","fullWidth","disabled"]);const f4=t=>{const{classes:e,margin:n,fullWidth:r}=t,s={root:["root",n!=="none"&&`margin${Oe(n)}`,r&&"fullWidth"]};return yn(s,d4,e)},p4=Fe("div",{name:"MuiFormControl",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,e[`margin${Oe(n.margin)}`],n.fullWidth&&e.fullWidth]}})({display:"inline-flex",flexDirection:"column",position:"relative",minWidth:0,padding:0,margin:0,border:0,verticalAlign:"top",variants:[{props:{margin:"normal"},style:{marginTop:16,marginBottom:8}},{props:{margin:"dense"},style:{marginTop:8,marginBottom:4}},{props:{fullWidth:!0},style:{width:"100%"}}]}),g1=T.forwardRef(function(e,n){const r=sn({props:e,name:"MuiFormControl"}),{children:s,className:a,color:c="primary",component:u="div",disabled:f=!1,error:h=!1,focused:y,fullWidth:g=!1,hiddenLabel:v=!1,margin:C="none",required:w=!1,size:_="medium",variant:I="outlined",...P}=r,L={...r,color:c,component:u,disabled:f,error:h,fullWidth:g,hiddenLabel:v,margin:C,required:w,size:_,variant:I},N=f4(L),[E,O]=T.useState(()=>{let ce=!1;return s&&T.Children.forEach(s,de=>{if(!Pp(de,["Input","Select"]))return;const fe=Pp(de,["Select"])?de.props.input:de;fe&&Y5(fe.props)&&(ce=!0)}),ce}),[z,M]=T.useState(()=>{let ce=!1;return s&&T.Children.forEach(s,de=>{Pp(de,["Input","Select"])&&(kh(de.props,!0)||kh(de.props.inputProps,!0))&&(ce=!0)}),ce}),[V,Y]=T.useState(!1);f&&V&&Y(!1);const S=y!==void 0&&!f?y:V;let j;T.useRef(!1);const W=T.useCallback(()=>{M(!0)},[]),X=T.useCallback(()=>{M(!1)},[]),ae=T.useMemo(()=>({adornedStart:E,setAdornedStart:O,color:c,disabled:f,error:h,filled:z,focused:S,fullWidth:g,hiddenLabel:v,size:_,onBlur:()=>{Y(!1)},onFocus:()=>{Y(!0)},onEmpty:X,onFilled:W,registerEffect:j,required:w,variant:I}),[E,c,f,h,z,S,g,v,j,X,W,w,_,I]);return $.jsx(Ym.Provider,{value:ae,children:$.jsx(p4,{as:u,ownerState:L,className:ot(N.root,a),ref:n,...P,children:s})})}),h4=KS({themeId:Cr});function m4(t){const e=l2(),n=h4(e.breakpoints.down("sm"));return T.useEffect(()=>{Tn.setFrameHeight()},[n]),$.jsx(Hm,{direction:n?"column":"row",spacing:2,children:t.children})}const y4=Fe(Ls)(({theme:t})=>({position:"relative",[t.breakpoints.down("sm")]:{width:"100%"},width:t.spacing(24),height:t.spacing(16),maxHeight:t.spacing(16),display:"flex",justifyContent:"center",alignItems:"center"})),g4=y4,v4=Fe(_d)(({theme:t})=>({display:"flex",justifyContent:"center",alignItems:"center",width:"100%",height:"100%",padding:t.spacing(2),boxSizing:"border-box"})),Ol=v4;function b4(){return $.jsx(Ol,{children:Pl("media_api_not_available")||"Media API not available"})}function S4(){return $.jsx(Ol,{children:Pl("device_ask_permission")||"Please allow the app to use your media devices"})}function _4(t){return $.jsxs(Ol,{children:[Pl("device_access_denied")||"Access denied"," (",t.error.message,")"]})}function C4(t){return $.jsxs(Ol,{children:[Pl("device_not_available")||"Device not available"," (",t.error.message,")"]})}const w4=po($.jsx("path",{d:"m21 6.5-4 4V7c0-.55-.45-1-1-1H9.82L21 17.18zM3.27 2 2 3.27 4.73 6H4c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h12c.21 0 .39-.08.54-.18L19.73 21 21 19.73z"}),"VideocamOff"),x4=Fe(_d)({display:"flex",justifyContent:"center",alignItems:"center",width:"100%",height:"100%"});function I4(){return $.jsx(x4,{children:$.jsx(w4,{fontSize:"large"})})}const k4=Kt.memo(I4),T4=Fe(Ls,{shouldForwardProp:t=>t!=="$transparent"})(({theme:t,$transparent:e})=>({margin:0,padding:0,position:"relative","&:before":{position:"absolute",content:'""',width:"100%",height:"100%",opacity:e?0:1,backgroundColor:t.palette.background.default,transition:"opacity 0.3s"}}));function R4(t){const[e,n]=T.useState(!1);return T.useEffect(()=>{const r=setTimeout(()=>{n(!0)},t.time);return()=>clearTimeout(r)},[t.time]),$.jsx(T4,{$transparent:e,children:t.children})}const E4=Fe("video")({maxWidth:"100%",maxHeight:"100%"}),A4=E4;function Rh(t){t.getVideoTracks().forEach(e=>e.stop()),t.getAudioTracks().forEach(e=>e.stop())}function P4(t){const e=T.useRef(null);return T.useEffect(()=>{if(t.deviceId==null)return;let n=null,r=!1;return navigator.mediaDevices.getUserMedia({video:{deviceId:t.deviceId},audio:!1}).then(s=>{if(n=s,r){Rh(n);return}e.current&&(e.current.srcObject=n)}),()=>{r=!0,n&&Rh(n)}},[t.deviceId]),$.jsx(A4,{ref:e,autoPlay:!0,muted:!0})}const O4=Kt.memo(P4);function v1(t,e){const n=t.map(r=>r.deviceId);if(e&&n.includes(e))return e;if(n.length>0)return n[0]}const M4=(t,e)=>{switch(e.type){case"SET_UNAVAILABLE":return{unavailable:!0,videoInputs:[],audioInputs:[],audioOutputs:[],selectedVideoInputDeviceId:void 0,selectedAudioInputDeviceId:void 0};case"UPDATE_DEVICES":{const n=e.devices,r=n.filter(f=>f.kind==="videoinput"),s=n.filter(f=>f.kind==="audioinput"),a=n.filter(f=>f.kind==="audiooutput"),c=v1(r,t.selectedVideoInputDeviceId),u=v1(s,t.selectedAudioInputDeviceId);return{...t,videoInputs:r,audioInputs:s,audioOutputs:a,selectedVideoInputDeviceId:c,selectedAudioInputDeviceId:u}}case"UPDATE_SELECTED_DEVICE_ID":return{...t,...e.payload}}};function D4(t){const{video:e,audio:n,defaultVideoDeviceId:r,defaultAudioDeviceId:s,onSelect:a}=t,[c,u]=T.useState("WAITING"),[{unavailable:f,videoInputs:h,selectedVideoInputDeviceId:y,audioInputs:g,selectedAudioInputDeviceId:v},C]=T.useReducer(M4,{unavailable:!1,videoInputs:[],audioInputs:[],audioOutputs:[],selectedVideoInputDeviceId:r,selectedAudioInputDeviceId:s}),w=T.useCallback(()=>{var L;if(typeof((L=navigator==null?void 0:navigator.mediaDevices)==null?void 0:L.enumerateDevices)!="function"){C({type:"SET_UNAVAILABLE"});return}return navigator.mediaDevices.enumerateDevices().then(N=>{C({type:"UPDATE_DEVICES",devices:N})})},[]),_=T.useRef({video:r,audio:s});_.current={video:r,audio:s},T.useEffect(()=>{var E;if(typeof((E=navigator==null?void 0:navigator.mediaDevices)==null?void 0:E.getUserMedia)!="function"){C({type:"SET_UNAVAILABLE"});return}u("WAITING");const{video:L,audio:N}=_.current;navigator.mediaDevices.getUserMedia({video:e&&L?{deviceId:L}:e,audio:n&&N?{deviceId:N}:n}).then(async O=>{Rh(O),await w(),u("ALLOWED")}).catch(O=>{u(O)})},[e,n,w]),T.useEffect(()=>{const L=()=>w();return navigator.mediaDevices.ondevicechange=L,()=>{navigator.mediaDevices.ondevicechange===L&&(navigator.mediaDevices.ondevicechange=null)}},[w]);const I=T.useCallback(L=>{C({type:"UPDATE_SELECTED_DEVICE_ID",payload:{selectedVideoInputDeviceId:L.target.value}})},[]),P=T.useCallback(L=>{C({type:"UPDATE_SELECTED_DEVICE_ID",payload:{selectedAudioInputDeviceId:L.target.value}})},[]);if(T.useEffect(()=>{const L=e?h.find(E=>E.deviceId===y):null,N=n?g.find(E=>E.deviceId===v):null;a({video:L==null?void 0:L.deviceId,audio:N==null?void 0:N.deviceId})},[e,n,a,h,g,y,v]),T.useEffect(()=>{setTimeout(()=>Tn.setFrameHeight())}),f)return $.jsx(b4,{});if(c==="WAITING")return $.jsx(R4,{time:1e3,children:$.jsx(S4,{})});if(c instanceof Error){const L=c;return L instanceof DOMException&&(L.name==="NotReadableError"||L.name==="NotFoundError")?$.jsx(C4,{error:L}):L instanceof DOMException&&L.name==="NotAllowedError"?$.jsx(_4,{error:L}):$.jsx(Ol,{children:$.jsxs(U2,{severity:"error",children:[L.name,": ",L.message]})})}return $.jsxs(m4,{children:[$.jsx(g4,{children:e&&y?$.jsx(O4,{deviceId:y}):$.jsx(k4,{})}),$.jsxs(Hm,{spacing:2,justifyContent:"center",children:[e&&y&&$.jsxs(g1,{fullWidth:!0,children:[$.jsx(y1,{htmlFor:"device-select-video-input",children:"Video Input"}),$.jsx(Th,{inputProps:{name:"video-input",id:"device-select-video-input"},value:y,onChange:I,children:h.map(L=>$.jsx("option",{value:L.deviceId,children:L.label},L.deviceId))})]}),n&&v&&$.jsxs(g1,{fullWidth:!0,children:[$.jsx(y1,{htmlFor:"device-select-audio-input",children:"Audio Input"}),$.jsx(Th,{inputProps:{name:"audio-input",id:"device-select-audio-input"},value:v,onChange:P,children:g.map(L=>$.jsx("option",{value:L.deviceId,children:L.label},L.deviceId))})]})]})]})}function N4({onClose:t,...e}){return $.jsxs(Hm,{spacing:2,children:[$.jsx(D4,{...e}),$.jsx(Ls,{children:$.jsx(W2,{variant:"contained",color:"primary",onClick:t,children:"Done"})})]})}function B4(t){var s,a,c,u,f,h,y,g,v,C,w,_,I,P,L,N,E,O,z,M,V,Y,S,j,W,X,ae;T.useEffect(()=>{Tn.setFrameHeight()});const e=t.stream.getVideoTracks().length>0,n=T.useCallback(ce=>{ce&&(ce.srcObject=t.stream)},[t.stream]),r=T.useCallback(()=>Tn.setFrameHeight(),[]);if(e){const ce={hidden:(s=t.userDefinedVideoAttrs)==null?void 0:s.hidden,style:(a=t.userDefinedVideoAttrs)==null?void 0:a.style,autoPlay:(c=t.userDefinedVideoAttrs)==null?void 0:c.autoPlay,controls:(u=t.userDefinedVideoAttrs)==null?void 0:u.controls,controlsList:(f=t.userDefinedVideoAttrs)==null?void 0:f.controlsList,crossOrigin:(h=t.userDefinedVideoAttrs)==null?void 0:h.crossOrigin,loop:(y=t.userDefinedVideoAttrs)==null?void 0:y.loop,mediaGroup:(g=t.userDefinedVideoAttrs)==null?void 0:g.mediaGroup,muted:(v=t.userDefinedVideoAttrs)==null?void 0:v.muted,playsInline:(C=t.userDefinedVideoAttrs)==null?void 0:C.playsInline,preload:(w=t.userDefinedVideoAttrs)==null?void 0:w.preload,height:(_=t.userDefinedVideoAttrs)==null?void 0:_.height,poster:(I=t.userDefinedVideoAttrs)==null?void 0:I.poster,width:(P=t.userDefinedVideoAttrs)==null?void 0:P.width,disablePictureInPicture:(L=t.userDefinedVideoAttrs)==null?void 0:L.disablePictureInPicture,disableRemotePlayback:(N=t.userDefinedVideoAttrs)==null?void 0:N.disableRemotePlayback};return $.jsx("video",{...ce,ref:n,onCanPlay:r})}else{const ce={hidden:(E=t.userDefinedAudioAttrs)==null?void 0:E.hidden,style:(O=t.userDefinedAudioAttrs)==null?void 0:O.style,autoPlay:(z=t.userDefinedAudioAttrs)==null?void 0:z.autoPlay,controls:(M=t.userDefinedAudioAttrs)==null?void 0:M.controls,controlsList:(V=t.userDefinedAudioAttrs)==null?void 0:V.controlsList,crossOrigin:(Y=t.userDefinedAudioAttrs)==null?void 0:Y.crossOrigin,loop:(S=t.userDefinedAudioAttrs)==null?void 0:S.loop,mediaGroup:(j=t.userDefinedAudioAttrs)==null?void 0:j.mediaGroup,muted:(W=t.userDefinedAudioAttrs)==null?void 0:W.muted,playsInline:(X=t.userDefinedAudioAttrs)==null?void 0:X.playsInline,preload:(ae=t.userDefinedAudioAttrs)==null?void 0:ae.preload};return $.jsx("audio",{ref:n,...ce})}}const L4=Kt.memo(B4),F4=po($.jsx("path",{d:"M21 3H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m0 13H3V5h18z"}),"VideoLabel"),$4=Fe(_d)(({theme:t})=>({padding:t.spacing(4),display:"flex",justifyContent:"center",alignItems:"center",width:"100%"}));function z4(t){return T.useEffect(()=>{Tn.setFrameHeight()}),$.jsx($4,{elevation:0,children:t.loading?$.jsx(Wm,{}):$.jsx(F4,{fontSize:"large"})})}const j4=Kt.memo(z4);function U4(t,e,n){const r=t||{};return e&&(r.video===!0?r.video={deviceId:e}:(typeof r.video=="object"||r.video==null)&&(r.video={...r.video,deviceId:e})),n&&(r.audio===!0?r.audio={deviceId:n}:(typeof r.audio=="object"||r.audio==null)&&(r.audio={...r.audio,deviceId:n})),r}function V4(t){const e=t?!!t.video:!0,n=t?!!t.audio:!0;return{videoEnabled:e,audioEnabled:n}}const W4={webRtcState:"STOPPED",sdpOffer:null,iceCandidates:{},stream:null,error:null},b1=new Set;function H4(){let t;do t=Math.random().toString(36).substring(2,15);while(b1.has(t));return b1.add(t),t}const G4=(t,e)=>{switch(e.type){case"SIGNALLING_START":return{...t,webRtcState:"SIGNALLING",stream:null,error:null};case"SET_STREAM":return{...t,stream:e.stream};case"SET_OFFER":return{...t,sdpOffer:e.offer};case"ADD_ICE_CANDIDATE":{const n=H4();return{...t,iceCandidates:{...t.iceCandidates,[n]:e.candidate}}}case"STOPPING":return{...t,webRtcState:"STOPPING",sdpOffer:null,iceCandidates:{}};case"STOPPED":return{...t,webRtcState:"STOPPED",sdpOffer:null,iceCandidates:{},stream:null};case"START_PLAYING":return{...t,webRtcState:"PLAYING",sdpOffer:null,iceCandidates:{}};case"SET_OFFER_ERROR":return{...t,webRtcState:"STOPPED",sdpOffer:null,iceCandidates:{},error:e.error};case"PROCESS_ANSWER_ERROR":return{...t,webRtcState:"STOPPED",sdpOffer:null,iceCandidates:{},error:e.error};case"ERROR":return{...t,webRtcState:"STOPPED",sdpOffer:null,iceCandidates:{},error:e.error}}},Y4=t=>(n,r)=>{const s=G4(n,r),a=s.webRtcState==="PLAYING",c=n.webRtcState==="PLAYING",u=a!==c,f=s.sdpOffer,h=n.sdpOffer,y=f!==h,g=s.iceCandidates,v=n.iceCandidates,C=Object.keys(g).length!==Object.keys(v).length;if(u||y||C){const w=Object.fromEntries(Object.entries(g).map(([I,P])=>[I,P.toJSON()])),_={playing:a,sdpOffer:f?f.toJSON():"",iceCandidates:w};console.debug("set component value",_),t(_)}return s},Eh=t=>t==="RECVONLY"||t==="SENDONLY"||t==="SENDRECV",K4=t=>t==="SENDRECV"||t==="RECVONLY",Q4=t=>t==="SENDRECV"||t==="SENDONLY",X4=(t,e,n,r,s)=>{T.useEffect(()=>r({playing:!1,sdpOffer:"",iceCandidates:{}}),[]);const a=T.useRef(),c=T.useMemo(()=>Y4(r),[r]),[u,f]=T.useReducer(c,W4),h=T.useCallback(()=>{(async()=>{if(u.webRtcState==="STOPPING")return;const C=a.current;if(a.current=void 0,f({type:"STOPPING"}),C!=null)return C.getTransceivers&&C.getTransceivers().forEach(function(w){w.stop&&w.stop()}),C.getSenders().forEach(function(w){var _;(_=w.track)==null||_.stop()}),new Promise(w=>{setTimeout(()=>{C.close(),w()},500)})})().catch(C=>f({type:"ERROR",error:C})).finally(()=>{f({type:"STOPPED"})})},[u.webRtcState]),y=T.useRef(h);y.current=h;const g=T.useCallback(()=>u.webRtcState!=="STOPPED"?Promise.reject(new Error("WebRTC is already started")):(async()=>{f({type:"SIGNALLING_START"});const C=t.mode,w=t.rtcConfiguration||{};console.debug("RTCConfiguration:",w);const _=new RTCPeerConnection(w);if((C==="SENDRECV"||C==="RECVONLY")&&_.addEventListener("track",I=>{const P=I.streams[0];f({type:"SET_STREAM",stream:P})}),C==="SENDRECV"||C==="SENDONLY"){const I=U4(t.mediaStreamConstraints,e,n);if(console.debug("MediaStreamConstraints:",I),I.audio||I.video){if(navigator.mediaDevices==null)throw new Error("navigator.mediaDevices is undefined. It seems the current document is not loaded securely.");if(navigator.mediaDevices.getUserMedia==null)throw new Error("getUserMedia is not implemented in this browser");const P={},L=await navigator.mediaDevices.getUserMedia(I);L.getTracks().forEach(N=>{_.addTrack(N,L);const E=N.kind;if(E!=="video"&&E!=="audio")return;const O=N.getSettings().deviceId;O!=null&&(P[E]=O)}),Object.keys(P).length>0&&s(P)}if(C==="SENDONLY")for(const P of _.getTransceivers())P.direction="sendonly"}else C==="RECVONLY"&&(_.addTransceiver("video",{direction:"recvonly"}),_.addTransceiver("audio",{direction:"recvonly"}));console.debug("transceivers",_.getTransceivers()),_.addEventListener("iceconnectionstatechange",()=>{console.debug("iceconnectionstatechange",_.iceConnectionState),(_.iceConnectionState==="disconnected"||_.iceConnectionState==="failed"||_.iceConnectionState==="closed")&&y.current()}),_.addEventListener("connectionstatechange",()=>{console.debug("connectionstatechange",_.connectionState),_.connectionState==="connected"?f({type:"START_PLAYING"}):(_.connectionState==="disconnected"||_.connectionState==="closed"||_.connectionState==="failed")&&y.current()}),a.current=_,_.addEventListener("icecandidate",I=>{I.candidate&&(console.debug("icecandidate",I.candidate),f({type:"ADD_ICE_CANDIDATE",candidate:I.candidate}))}),_.createOffer().then(I=>_.setLocalDescription(I).then(()=>{const P=_.localDescription;if(P==null)throw new Error("Failed to create an offer SDP");f({type:"SET_OFFER",offer:P})})).catch(I=>{f({type:"SET_OFFER_ERROR",error:I})})})().catch(C=>f({type:"ERROR",error:C})),[n,e,t.mediaStreamConstraints,t.mode,t.rtcConfiguration,u.webRtcState,s]);return T.useEffect(()=>{const v=a.current;if(v==null)return;const C=t.sdpAnswerJson;if(v.remoteDescription==null&&C&&u.webRtcState==="SIGNALLING"){const w=JSON.parse(C);console.debug("Receive answer SDP",w),v.setRemoteDescription(w).catch(_=>{f({type:"PROCESS_ANSWER_ERROR",error:_}),h()})}},[t.sdpAnswerJson,u.webRtcState,h]),T.useEffect(()=>{const v=t.desiredPlayingState;v!=null&&(v===!0&&u.webRtcState==="STOPPED"?g():v===!1&&(u.webRtcState==="SIGNALLING"||u.webRtcState==="PLAYING")&&h())},[t.desiredPlayingState,g,u.webRtcState,h]),{start:g,stop:h,state:u}};function J4(){const[t,e]=T.useState(!1),n=T.useRef(void 0),r=T.useCallback(a=>{n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{e(!0)},a)},[]),s=T.useCallback(()=>{n.current&&clearTimeout(n.current),e(!1)},[]);return T.useEffect(()=>()=>{s()},[s]),{start:r,clear:s,isTimedOut:t}}function q4(t){return Tn.setComponentValue(t)}function Gp({translationKey:t,defaultText:e,...n}){return $.jsx(W2,{...n,children:Pl(t)||e})}let J2=!0,q2=!0;function du(t,e,n){const r=t.match(e);return r&&r.length>=n&&parseInt(r[n],10)}function Vo(t,e,n){if(!t.RTCPeerConnection)return;const r=t.RTCPeerConnection.prototype,s=r.addEventListener;r.addEventListener=function(c,u){if(c!==e)return s.apply(this,arguments);const f=h=>{const y=n(h);y&&(u.handleEvent?u.handleEvent(y):u(y))};return this._eventMap=this._eventMap||{},this._eventMap[e]||(this._eventMap[e]=new Map),this._eventMap[e].set(u,f),s.apply(this,[c,f])};const a=r.removeEventListener;r.removeEventListener=function(c,u){if(c!==e||!this._eventMap||!this._eventMap[e])return a.apply(this,arguments);if(!this._eventMap[e].has(u))return a.apply(this,arguments);const f=this._eventMap[e].get(u);return this._eventMap[e].delete(u),this._eventMap[e].size===0&&delete this._eventMap[e],Object.keys(this._eventMap).length===0&&delete this._eventMap,a.apply(this,[c,f])},Object.defineProperty(r,"on"+e,{get(){return this["_on"+e]},set(c){this["_on"+e]&&(this.removeEventListener(e,this["_on"+e]),delete this["_on"+e]),c&&this.addEventListener(e,this["_on"+e]=c)},enumerable:!0,configurable:!0})}function Z4(t){return typeof t!="boolean"?new Error("Argument type: "+typeof t+". Please use a boolean."):(J2=t,t?"adapter.js logging disabled":"adapter.js logging enabled")}function eO(t){return typeof t!="boolean"?new Error("Argument type: "+typeof t+". Please use a boolean."):(q2=!t,"adapter.js deprecation warnings "+(t?"disabled":"enabled"))}function Z2(){if(typeof window=="object"){if(J2)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function Km(t,e){q2&&console.warn(t+" is deprecated, please use "+e+" instead.")}function tO(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(s=>s.brand==="Chromium");if(r)return{browser:"chrome",version:parseInt(r.version,10)}}if(n.mozGetUserMedia)e.browser="firefox",e.version=du(n.userAgent,/Firefox\/(\d+)\./,1);else if(n.webkitGetUserMedia||t.isSecureContext===!1&&t.webkitRTCPeerConnection)e.browser="chrome",e.version=du(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(t.RTCPeerConnection&&n.userAgent.match(/AppleWebKit\/(\d+)\./))e.browser="safari",e.version=du(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 S1(t){return Object.prototype.toString.call(t)==="[object Object]"}function e_(t){return S1(t)?Object.keys(t).reduce(function(e,n){const r=S1(t[n]),s=r?e_(t[n]):t[n],a=r&&!Object.keys(s).length;return s===void 0||a?e:Object.assign(e,{[n]:s})},{}):t}function Ah(t,e,n){!e||n.has(e.id)||(n.set(e.id,e),Object.keys(e).forEach(r=>{r.endsWith("Id")?Ah(t,t.get(e[r]),n):r.endsWith("Ids")&&e[r].forEach(s=>{Ah(t,t.get(s),n)})}))}function _1(t,e,n){const r=n?"outbound-rtp":"inbound-rtp",s=new Map;if(e===null)return s;const a=[];return t.forEach(c=>{c.type==="track"&&c.trackIdentifier===e.id&&a.push(c)}),a.forEach(c=>{t.forEach(u=>{u.type===r&&u.trackId===c.id&&Ah(t,u,s)})}),s}const C1=Z2;function t_(t,e){const n=t&&t.navigator;if(!n.mediaDevices)return;const r=function(u){if(typeof u!="object"||u.mandatory||u.optional)return u;const f={};return Object.keys(u).forEach(h=>{if(h==="require"||h==="advanced"||h==="mediaSource")return;const y=typeof u[h]=="object"?u[h]:{ideal:u[h]};y.exact!==void 0&&typeof y.exact=="number"&&(y.min=y.max=y.exact);const g=function(v,C){return v?v+C.charAt(0).toUpperCase()+C.slice(1):C==="deviceId"?"sourceId":C};if(y.ideal!==void 0){f.optional=f.optional||[];let v={};typeof y.ideal=="number"?(v[g("min",h)]=y.ideal,f.optional.push(v),v={},v[g("max",h)]=y.ideal,f.optional.push(v)):(v[g("",h)]=y.ideal,f.optional.push(v))}y.exact!==void 0&&typeof y.exact!="number"?(f.mandatory=f.mandatory||{},f.mandatory[g("",h)]=y.exact):["min","max"].forEach(v=>{y[v]!==void 0&&(f.mandatory=f.mandatory||{},f.mandatory[g(v,h)]=y[v])})}),u.advanced&&(f.optional=(f.optional||[]).concat(u.advanced)),f},s=function(u,f){if(e.version>=61)return f(u);if(u=JSON.parse(JSON.stringify(u)),u&&typeof u.audio=="object"){const h=function(y,g,v){g in y&&!(v in y)&&(y[v]=y[g],delete y[g])};u=JSON.parse(JSON.stringify(u)),h(u.audio,"autoGainControl","googAutoGainControl"),h(u.audio,"noiseSuppression","googNoiseSuppression"),u.audio=r(u.audio)}if(u&&typeof u.video=="object"){let h=u.video.facingMode;h=h&&(typeof h=="object"?h:{ideal:h});const y=e.version<66;if(h&&(h.exact==="user"||h.exact==="environment"||h.ideal==="user"||h.ideal==="environment")&&!(n.mediaDevices.getSupportedConstraints&&n.mediaDevices.getSupportedConstraints().facingMode&&!y)){delete u.video.facingMode;let g;if(h.exact==="environment"||h.ideal==="environment"?g=["back","rear"]:(h.exact==="user"||h.ideal==="user")&&(g=["front"]),g)return n.mediaDevices.enumerateDevices().then(v=>{v=v.filter(w=>w.kind==="videoinput");let C=v.find(w=>g.some(_=>w.label.toLowerCase().includes(_)));return!C&&v.length&&g.includes("back")&&(C=v[v.length-1]),C&&(u.video.deviceId=h.exact?{exact:C.deviceId}:{ideal:C.deviceId}),u.video=r(u.video),C1("chrome: "+JSON.stringify(u)),f(u)})}u.video=r(u.video)}return C1("chrome: "+JSON.stringify(u)),f(u)},a=function(u){return e.version>=64?u:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[u.name]||u.name,message:u.message,constraint:u.constraint||u.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}},c=function(u,f,h){s(u,y=>{n.webkitGetUserMedia(y,f,g=>{h&&h(a(g))})})};if(n.getUserMedia=c.bind(n),n.mediaDevices.getUserMedia){const u=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(f){return s(f,h=>u(h).then(y=>{if(h.audio&&!y.getAudioTracks().length||h.video&&!y.getVideoTracks().length)throw y.getTracks().forEach(g=>{g.stop()}),new DOMException("","NotFoundError");return y},y=>Promise.reject(a(y))))}}}function n_(t){t.MediaStream=t.MediaStream||t.webkitMediaStream}function r_(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",s=>{let a;t.RTCPeerConnection.prototype.getReceivers?a=this.getReceivers().find(u=>u.track&&u.track.id===s.track.id):a={track:s.track};const c=new Event("track");c.track=s.track,c.receiver=a,c.transceiver={receiver:a},c.streams=[r.stream],this.dispatchEvent(c)}),r.stream.getTracks().forEach(s=>{let a;t.RTCPeerConnection.prototype.getReceivers?a=this.getReceivers().find(u=>u.track&&u.track.id===s.id):a={track:s};const c=new Event("track");c.track=s,c.receiver=a,c.transceiver={receiver:a},c.streams=[r.stream],this.dispatchEvent(c)})},this.addEventListener("addstream",this._ontrackpoly)),e.apply(this,arguments)}}else Vo(t,"track",e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e))}function i_(t){if(typeof t=="object"&&t.RTCPeerConnection&&!("getSenders"in t.RTCPeerConnection.prototype)&&"createDTMFSender"in t.RTCPeerConnection.prototype){const e=function(s,a){return{track:a,get dtmf(){return this._dtmf===void 0&&(a.kind==="audio"?this._dtmf=s.createDTMFSender(a):this._dtmf=null),this._dtmf},_pc:s}};if(!t.RTCPeerConnection.prototype.getSenders){t.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const s=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(u,f){let h=s.apply(this,arguments);return h||(h=e(this,u),this._senders.push(h)),h};const a=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(u){a.apply(this,arguments);const f=this._senders.indexOf(u);f!==-1&&this._senders.splice(f,1)}}const n=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(a){this._senders=this._senders||[],n.apply(this,[a]),a.getTracks().forEach(c=>{this._senders.push(e(this,c))})};const r=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(a){this._senders=this._senders||[],r.apply(this,[a]),a.getTracks().forEach(c=>{const u=this._senders.find(f=>f.track===c);u&&this._senders.splice(this._senders.indexOf(u),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(s=>s._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 o_(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 a=n.apply(this,[]);return a.forEach(c=>c._pc=this),a});const r=t.RTCPeerConnection.prototype.addTrack;r&&(t.RTCPeerConnection.prototype.addTrack=function(){const a=r.apply(this,arguments);return a._pc=this,a}),t.RTCRtpSender.prototype.getStats=function(){const a=this;return this._pc.getStats().then(c=>_1(c,a.track,!0))}}if(!("getStats"in t.RTCRtpReceiver.prototype)){const n=t.RTCPeerConnection.prototype.getReceivers;n&&(t.RTCPeerConnection.prototype.getReceivers=function(){const s=n.apply(this,[]);return s.forEach(a=>a._pc=this),s}),Vo(t,"track",r=>(r.receiver._pc=r.srcElement,r)),t.RTCRtpReceiver.prototype.getStats=function(){const s=this;return this._pc.getStats().then(a=>_1(a,s.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 s,a,c;return this.getSenders().forEach(u=>{u.track===r&&(s?c=!0:s=u)}),this.getReceivers().forEach(u=>(u.track===r&&(a?c=!0:a=u),u.track===r)),c||s&&a?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):s?s.getStats():a?a.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return e.apply(this,arguments)}}function s_(t){t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(c=>this._shimmedLocalStreams[c][0])};const e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(c,u){if(!u)return e.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const f=e.apply(this,arguments);return this._shimmedLocalStreams[u.id]?this._shimmedLocalStreams[u.id].indexOf(f)===-1&&this._shimmedLocalStreams[u.id].push(f):this._shimmedLocalStreams[u.id]=[u,f],f};const n=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(c){this._shimmedLocalStreams=this._shimmedLocalStreams||{},c.getTracks().forEach(h=>{if(this.getSenders().find(g=>g.track===h))throw new DOMException("Track already exists.","InvalidAccessError")});const u=this.getSenders();n.apply(this,arguments);const f=this.getSenders().filter(h=>u.indexOf(h)===-1);this._shimmedLocalStreams[c.id]=[c].concat(f)};const r=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(c){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[c.id],r.apply(this,arguments)};const s=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(c){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},c&&Object.keys(this._shimmedLocalStreams).forEach(u=>{const f=this._shimmedLocalStreams[u].indexOf(c);f!==-1&&this._shimmedLocalStreams[u].splice(f,1),this._shimmedLocalStreams[u].length===1&&delete this._shimmedLocalStreams[u]}),s.apply(this,arguments)}}function a_(t,e){if(!t.RTCPeerConnection)return;if(t.RTCPeerConnection.prototype.addTrack&&e.version>=65)return s_(t);const n=t.RTCPeerConnection.prototype.getLocalStreams;t.RTCPeerConnection.prototype.getLocalStreams=function(){const y=n.apply(this);return this._reverseStreams=this._reverseStreams||{},y.map(g=>this._reverseStreams[g.id])};const r=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(y){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},y.getTracks().forEach(g=>{if(this.getSenders().find(C=>C.track===g))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[y.id]){const g=new t.MediaStream(y.getTracks());this._streams[y.id]=g,this._reverseStreams[g.id]=y,y=g}r.apply(this,[y])};const s=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(y){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},s.apply(this,[this._streams[y.id]||y]),delete this._reverseStreams[this._streams[y.id]?this._streams[y.id].id:y.id],delete this._streams[y.id]},t.RTCPeerConnection.prototype.addTrack=function(y,g){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const v=[].slice.call(arguments,1);if(v.length!==1||!v[0].getTracks().find(_=>_===y))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(_=>_.track===y))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const w=this._streams[g.id];if(w)w.addTrack(y),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const _=new t.MediaStream([y]);this._streams[g.id]=_,this._reverseStreams[_.id]=g,this.addStream(_)}return this.getSenders().find(_=>_.track===y)};function a(h,y){let g=y.sdp;return Object.keys(h._reverseStreams||[]).forEach(v=>{const C=h._reverseStreams[v],w=h._streams[C.id];g=g.replace(new RegExp(w.id,"g"),C.id)}),new RTCSessionDescription({type:y.type,sdp:g})}function c(h,y){let g=y.sdp;return Object.keys(h._reverseStreams||[]).forEach(v=>{const C=h._reverseStreams[v],w=h._streams[C.id];g=g.replace(new RegExp(C.id,"g"),w.id)}),new RTCSessionDescription({type:y.type,sdp:g})}["createOffer","createAnswer"].forEach(function(h){const y=t.RTCPeerConnection.prototype[h],g={[h](){const v=arguments;return arguments.length&&typeof arguments[0]=="function"?y.apply(this,[w=>{const _=a(this,w);v[0].apply(null,[_])},w=>{v[1]&&v[1].apply(null,w)},arguments[2]]):y.apply(this,arguments).then(w=>a(this,w))}};t.RTCPeerConnection.prototype[h]=g[h]});const u=t.RTCPeerConnection.prototype.setLocalDescription;t.RTCPeerConnection.prototype.setLocalDescription=function(){return!arguments.length||!arguments[0].type?u.apply(this,arguments):(arguments[0]=c(this,arguments[0]),u.apply(this,arguments))};const f=Object.getOwnPropertyDescriptor(t.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(t.RTCPeerConnection.prototype,"localDescription",{get(){const h=f.get.apply(this);return h.type===""?h:a(this,h)}}),t.RTCPeerConnection.prototype.removeTrack=function(y){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!y._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(y._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{};let v;Object.keys(this._streams).forEach(C=>{this._streams[C].getTracks().find(_=>y.track===_)&&(v=this._streams[C])}),v&&(v.getTracks().length===1?this.removeStream(this._reverseStreams[v.id]):v.removeTrack(y.track),this.dispatchEvent(new Event("negotiationneeded")))}}function Ph(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],s={[n](){return arguments[0]=new(n==="addIceCandidate"?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};t.RTCPeerConnection.prototype[n]=s[n]})}function l_(t,e){Vo(t,"negotiationneeded",n=>{const r=n.target;if(!((e.version<72||r.getConfiguration&&r.getConfiguration().sdpSemantics==="plan-b")&&r.signalingState!=="stable"))return n})}const w1=Object.freeze(Object.defineProperty({__proto__:null,fixNegotiationNeeded:l_,shimAddTrackRemoveTrack:a_,shimAddTrackRemoveTrackWithNative:s_,shimGetSendersWithDtmf:i_,shimGetUserMedia:t_,shimMediaStream:n_,shimOnTrack:r_,shimPeerConnection:Ph,shimSenderReceiverGetStats:o_},Symbol.toStringTag,{value:"Module"}));function c_(t,e){const n=t&&t.navigator,r=t&&t.MediaStreamTrack;if(n.getUserMedia=function(s,a,c){Km("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),n.mediaDevices.getUserMedia(s).then(a,c)},!(e.version>55&&"autoGainControl"in n.mediaDevices.getSupportedConstraints())){const s=function(c,u,f){u in c&&!(f in c)&&(c[f]=c[u],delete c[u])},a=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(c){return typeof c=="object"&&typeof c.audio=="object"&&(c=JSON.parse(JSON.stringify(c)),s(c.audio,"autoGainControl","mozAutoGainControl"),s(c.audio,"noiseSuppression","mozNoiseSuppression")),a(c)},r&&r.prototype.getSettings){const c=r.prototype.getSettings;r.prototype.getSettings=function(){const u=c.apply(this,arguments);return s(u,"mozAutoGainControl","autoGainControl"),s(u,"mozNoiseSuppression","noiseSuppression"),u}}if(r&&r.prototype.applyConstraints){const c=r.prototype.applyConstraints;r.prototype.applyConstraints=function(u){return this.kind==="audio"&&typeof u=="object"&&(u=JSON.parse(JSON.stringify(u)),s(u,"autoGainControl","mozAutoGainControl"),s(u,"noiseSuppression","mozNoiseSuppression")),c.apply(this,[u])}}}}function nO(t,e){t.navigator.mediaDevices&&"getDisplayMedia"in t.navigator.mediaDevices||t.navigator.mediaDevices&&(t.navigator.mediaDevices.getDisplayMedia=function(r){if(!(r&&r.video)){const s=new DOMException("getDisplayMedia without video constraints is undefined");return s.name="NotFoundError",s.code=8,Promise.reject(s)}return r.video===!0?r.video={mediaSource:e}:r.video.mediaSource=e,t.navigator.mediaDevices.getUserMedia(r)})}function u_(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 Oh(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(s){const a=t.RTCPeerConnection.prototype[s],c={[s](){return arguments[0]=new(s==="addIceCandidate"?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),a.apply(this,arguments)}};t.RTCPeerConnection.prototype[s]=c[s]});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[a,c,u]=arguments;return r.apply(this,[a||null]).then(f=>{if(e.version<53&&!c)try{f.forEach(h=>{h.type=n[h.type]||h.type})}catch(h){if(h.name!=="TypeError")throw h;f.forEach((y,g)=>{f.set(g,Object.assign({},y,{type:n[y.type]||y.type}))})}return f}).then(c,u)}}function d_(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 s=e.apply(this,[]);return s.forEach(a=>a._pc=this),s});const n=t.RTCPeerConnection.prototype.addTrack;n&&(t.RTCPeerConnection.prototype.addTrack=function(){const s=n.apply(this,arguments);return s._pc=this,s}),t.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function f_(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(s=>s._pc=this),r}),Vo(t,"track",n=>(n.receiver._pc=n.srcElement,n)),t.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function p_(t){!t.RTCPeerConnection||"removeStream"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.removeStream=function(n){Km("removeStream","removeTrack"),this.getSenders().forEach(r=>{r.track&&n.getTracks().includes(r.track)&&this.removeTrack(r)})})}function h_(t){t.DataChannel&&!t.RTCDataChannel&&(t.RTCDataChannel=t.DataChannel)}function m_(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 s=r.length>0;s&&r.forEach(c=>{if("rid"in c&&!/^[a-z0-9]{0,16}$/i.test(c.rid))throw new TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in c&&!(parseFloat(c.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in c&&!(parseFloat(c.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});const a=e.apply(this,arguments);if(s){const{sender:c}=a,u=c.getParameters();(!("encodings"in u)||u.encodings.length===1&&Object.keys(u.encodings[0]).length===0)&&(u.encodings=r,c.sendEncodings=r,this.setParametersPromises.push(c.setParameters(u).then(()=>{delete c.sendEncodings}).catch(()=>{delete c.sendEncodings})))}return a})}function y_(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 g_(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 v_(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)}}const x1=Object.freeze(Object.defineProperty({__proto__:null,shimAddTransceiver:m_,shimCreateAnswer:v_,shimCreateOffer:g_,shimGetDisplayMedia:nO,shimGetParameters:y_,shimGetUserMedia:c_,shimOnTrack:u_,shimPeerConnection:Oh,shimRTCDataChannel:h_,shimReceiverGetStats:f_,shimRemoveStream:p_,shimSenderGetStats:d_},Symbol.toStringTag,{value:"Module"}));function b_(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(s=>e.call(this,s,r)),r.getVideoTracks().forEach(s=>e.call(this,s,r))},t.RTCPeerConnection.prototype.addTrack=function(r,...s){return s&&s.forEach(a=>{this._localStreams?this._localStreams.includes(a)||this._localStreams.push(a):this._localStreams=[a]}),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 s=n.getTracks();this.getSenders().forEach(a=>{s.includes(a.track)&&this.removeTrack(a)})})}}function S_(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(s=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(s))return;this._remoteStreams.push(s);const a=new Event("addstream");a.stream=s,this.dispatchEvent(a)})})}});const e=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){const r=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(s){s.streams.forEach(a=>{if(r._remoteStreams||(r._remoteStreams=[]),r._remoteStreams.indexOf(a)>=0)return;r._remoteStreams.push(a);const c=new Event("addstream");c.stream=a,r.dispatchEvent(c)})}),e.apply(r,arguments)}}}function __(t){if(typeof t!="object"||!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype,n=e.createOffer,r=e.createAnswer,s=e.setLocalDescription,a=e.setRemoteDescription,c=e.addIceCandidate;e.createOffer=function(h,y){const g=arguments.length>=2?arguments[2]:arguments[0],v=n.apply(this,[g]);return y?(v.then(h,y),Promise.resolve()):v},e.createAnswer=function(h,y){const g=arguments.length>=2?arguments[2]:arguments[0],v=r.apply(this,[g]);return y?(v.then(h,y),Promise.resolve()):v};let u=function(f,h,y){const g=s.apply(this,[f]);return y?(g.then(h,y),Promise.resolve()):g};e.setLocalDescription=u,u=function(f,h,y){const g=a.apply(this,[f]);return y?(g.then(h,y),Promise.resolve()):g},e.setRemoteDescription=u,u=function(f,h,y){const g=c.apply(this,[f]);return y?(g.then(h,y),Promise.resolve()):g},e.addIceCandidate=u}function C_(t){const e=t&&t.navigator;if(e.mediaDevices&&e.mediaDevices.getUserMedia){const n=e.mediaDevices,r=n.getUserMedia.bind(n);e.mediaDevices.getUserMedia=s=>r(w_(s))}!e.getUserMedia&&e.mediaDevices&&e.mediaDevices.getUserMedia&&(e.getUserMedia=(function(r,s,a){e.mediaDevices.getUserMedia(r).then(s,a)}).bind(e))}function w_(t){return t&&t.video!==void 0?Object.assign({},t,{video:e_(t.video)}):t}function x_(t){if(!t.RTCPeerConnection)return;const e=t.RTCPeerConnection;t.RTCPeerConnection=function(r,s){if(r&&r.iceServers){const a=[];for(let c=0;c<r.iceServers.length;c++){let u=r.iceServers[c];u.urls===void 0&&u.url?(Km("RTCIceServer.url","RTCIceServer.urls"),u=JSON.parse(JSON.stringify(u)),u.urls=u.url,delete u.url,a.push(u)):a.push(r.iceServers[c])}r.iceServers=a}return new e(r,s)},t.RTCPeerConnection.prototype=e.prototype,"generateCertificate"in e&&Object.defineProperty(t.RTCPeerConnection,"generateCertificate",{get(){return e.generateCertificate}})}function I_(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 k_(t){const e=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function(r){if(r){typeof r.offerToReceiveAudio<"u"&&(r.offerToReceiveAudio=!!r.offerToReceiveAudio);const s=this.getTransceivers().find(c=>c.receiver.track.kind==="audio");r.offerToReceiveAudio===!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.offerToReceiveAudio===!0&&!s&&this.addTransceiver("audio",{direction:"recvonly"}),typeof r.offerToReceiveVideo<"u"&&(r.offerToReceiveVideo=!!r.offerToReceiveVideo);const a=this.getTransceivers().find(c=>c.receiver.track.kind==="video");r.offerToReceiveVideo===!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.offerToReceiveVideo===!0&&!a&&this.addTransceiver("video",{direction:"recvonly"})}return e.apply(this,arguments)}}function T_(t){typeof t!="object"||t.AudioContext||(t.AudioContext=t.webkitAudioContext)}const I1=Object.freeze(Object.defineProperty({__proto__:null,shimAudioContext:T_,shimCallbacksAPI:__,shimConstraints:w_,shimCreateOfferLegacy:k_,shimGetUserMedia:C_,shimLocalStreamsAPI:b_,shimRTCIceServerUrls:x_,shimRemoteStreamsAPI:S_,shimTrackEventTransceiver:I_},Symbol.toStringTag,{value:"Module"}));var Yp={exports:{}},k1;function rO(){return k1||(k1=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(`
224
+ `&&(E.value+=" ");const M=z.boxSizing,V=qc(z.paddingBottom)+qc(z.paddingTop),Y=qc(z.borderBottomWidth)+qc(z.borderTopWidth),S=E.scrollHeight;E.value="x";const j=E.scrollHeight;let W=S;a&&(W=Math.max(Number(a)*j,W)),s&&(W=Math.min(Number(s)*j,W)),W=Math.max(W,j);const X=W+(M==="border-box"?V+Y:0),ae=Math.abs(W-S)<=1;return{outerHeightStyle:X,overflowing:ae}},[s,a,e.placeholder]),_=Za(()=>{const N=y.current,E=w();if(!N||!E||d1(E))return!1;const O=E.outerHeightStyle;return v.current!=null&&v.current!==O}),I=T.useCallback(()=>{const N=y.current,E=w();if(!N||!E||d1(E))return;const O=E.outerHeightStyle;v.current!==O&&(v.current=O,N.style.height=`${O}px`),N.style.overflow=E.overflowing?"hidden":""},[w]),P=T.useRef(-1);Ys(()=>{const N=Y3(I),E=y==null?void 0:y.current;if(!E)return;const O=Av(E);O.addEventListener("resize",N);let z;return typeof ResizeObserver<"u"&&(z=new ResizeObserver(()=>{_()&&(z.unobserve(E),cancelAnimationFrame(P.current),I(),P.current=requestAnimationFrame(()=>{z.observe(E)}))}),z.observe(E)),()=>{N.clear(),cancelAnimationFrame(P.current),O.removeEventListener("resize",N),z&&z.disconnect()}},[w,I,_]),Ys(()=>{I()});const L=N=>{h||I(),r&&r(N)};return $.jsxs(T.Fragment,{children:[$.jsx("textarea",{value:u,onChange:L,ref:g,rows:a,style:c,...f}),$.jsx("textarea",{"aria-hidden":!0,className:e.className,readOnly:!0,ref:C,tabIndex:-1,style:{...W5.shadow,...c,paddingTop:0,paddingBottom:0}})]})});function f1(t){return typeof t=="string"}function p1(t){return t!=null&&!(Array.isArray(t)&&t.length===0)}function kh(t,e=!1){return t&&(p1(t.value)&&t.value!==""||e&&p1(t.defaultValue)&&t.defaultValue!=="")}function Y5(t){return t.startAdornment}function K5(t){return hn("MuiInputBase",t)}const Zu=mn("MuiInputBase",["root","formControl","focused","disabled","adornedStart","adornedEnd","error","sizeSmall","multiline","colorSecondary","fullWidth","hiddenLabel","readOnly","input","inputSizeSmall","inputMultiline","inputTypeSearch","inputAdornedStart","inputAdornedEnd","inputHiddenLabel"]);var h1;const G2=(t,e)=>{const{ownerState:n}=t;return[e.root,n.formControl&&e.formControl,n.startAdornment&&e.adornedStart,n.endAdornment&&e.adornedEnd,n.error&&e.error,n.size==="small"&&e.sizeSmall,n.multiline&&e.multiline,n.color&&e[`color${Oe(n.color)}`],n.fullWidth&&e.fullWidth,n.hiddenLabel&&e.hiddenLabel]},Y2=(t,e)=>{const{ownerState:n}=t;return[e.input,n.size==="small"&&e.inputSizeSmall,n.multiline&&e.inputMultiline,n.type==="search"&&e.inputTypeSearch,n.startAdornment&&e.inputAdornedStart,n.endAdornment&&e.inputAdornedEnd,n.hiddenLabel&&e.inputHiddenLabel]},Q5=t=>{const{classes:e,color:n,disabled:r,error:s,endAdornment:a,focused:c,formControl:u,fullWidth:f,hiddenLabel:h,multiline:y,readOnly:g,size:v,startAdornment:C,type:w}=t,_={root:["root",`color${Oe(n)}`,r&&"disabled",s&&"error",f&&"fullWidth",c&&"focused",u&&"formControl",v&&v!=="medium"&&`size${Oe(v)}`,y&&"multiline",C&&"adornedStart",a&&"adornedEnd",h&&"hiddenLabel",g&&"readOnly"],input:["input",r&&"disabled",w==="search"&&"inputTypeSearch",y&&"inputMultiline",v==="small"&&"inputSizeSmall",h&&"inputHiddenLabel",C&&"inputAdornedStart",a&&"inputAdornedEnd",g&&"readOnly"]};return yn(_,K5,e)},K2=Fe("div",{name:"MuiInputBase",slot:"Root",overridesResolver:G2})(On(({theme:t})=>({...t.typography.body1,color:(t.vars||t).palette.text.primary,lineHeight:"1.4375em",boxSizing:"border-box",position:"relative",cursor:"text",display:"inline-flex",alignItems:"center",[`&.${Zu.disabled}`]:{color:(t.vars||t).palette.text.disabled,cursor:"default"},variants:[{props:({ownerState:e})=>e.multiline,style:{padding:"4px 0 5px"}},{props:({ownerState:e,size:n})=>e.multiline&&n==="small",style:{paddingTop:1}},{props:({ownerState:e})=>e.fullWidth,style:{width:"100%"}}]}))),Q2=Fe("input",{name:"MuiInputBase",slot:"Input",overridesResolver:Y2})(On(({theme:t})=>{const e=t.palette.mode==="light",n={color:"currentColor",...t.vars?{opacity:t.vars.opacity.inputPlaceholder}:{opacity:e?.42:.5},transition:t.transitions.create("opacity",{duration:t.transitions.duration.shorter})},r={opacity:"0 !important"},s=t.vars?{opacity:t.vars.opacity.inputPlaceholder}:{opacity:e?.42:.5};return{font:"inherit",letterSpacing:"inherit",color:"currentColor",padding:"4px 0 5px",border:0,boxSizing:"content-box",background:"none",height:"1.4375em",margin:0,WebkitTapHighlightColor:"transparent",display:"block",minWidth:0,width:"100%","&::-webkit-input-placeholder":n,"&::-moz-placeholder":n,"&::-ms-input-placeholder":n,"&:focus":{outline:0},"&:invalid":{boxShadow:"none"},"&::-webkit-search-decoration":{WebkitAppearance:"none"},[`label[data-shrink=false] + .${Zu.formControl} &`]:{"&::-webkit-input-placeholder":r,"&::-moz-placeholder":r,"&::-ms-input-placeholder":r,"&:focus::-webkit-input-placeholder":s,"&:focus::-moz-placeholder":s,"&:focus::-ms-input-placeholder":s},[`&.${Zu.disabled}`]:{opacity:1,WebkitTextFillColor:(t.vars||t).palette.text.disabled},variants:[{props:({ownerState:a})=>!a.disableInjectingGlobalStyles,style:{animationName:"mui-auto-fill-cancel",animationDuration:"10ms","&:-webkit-autofill":{animationDuration:"5000s",animationName:"mui-auto-fill"}}},{props:{size:"small"},style:{paddingTop:1}},{props:({ownerState:a})=>a.multiline,style:{height:"auto",resize:"none",padding:0,paddingTop:0}},{props:{type:"search"},style:{MozAppearance:"textfield"}}]}})),m1=jm({"@keyframes mui-auto-fill":{from:{display:"block"}},"@keyframes mui-auto-fill-cancel":{from:{display:"block"}}}),X5=T.forwardRef(function(e,n){const r=sn({props:e,name:"MuiInputBase"}),{"aria-describedby":s,autoComplete:a,autoFocus:c,className:u,color:f,components:h={},componentsProps:y={},defaultValue:g,disabled:v,disableInjectingGlobalStyles:C,endAdornment:w,error:_,fullWidth:I=!1,id:P,inputComponent:L="input",inputProps:N={},inputRef:E,margin:O,maxRows:z,minRows:M,multiline:V=!1,name:Y,onBlur:S,onChange:j,onClick:W,onFocus:X,onKeyDown:ae,onKeyUp:ce,placeholder:de,readOnly:fe,renderSuffix:q,rows:te,size:ne,slotProps:R={},slots:G={},startAdornment:ue,type:ge="text",value:De,...xe}=r,$e=N.value!=null?N.value:De,{current:Ne}=T.useRef($e!=null),je=T.useRef(),Bt=T.useCallback(He=>{},[]),ur=hl(je,E,N.ref,Bt),[dr,Dn]=T.useState(!1),Je=wd(),jt=Cd({props:r,muiFormControl:Je,states:["color","disabled","error","hiddenLabel","size","required","filled"]});jt.focused=Je?Je.focused:dr,T.useEffect(()=>{!Je&&v&&dr&&(Dn(!1),S&&S())},[Je,v,dr,S]);const fr=Je&&Je.onFilled,Qt=Je&&Je.onEmpty,st=T.useCallback(He=>{kh(He)?fr&&fr():Qt&&Qt()},[fr,Qt]);Ys(()=>{Ne&&st({value:$e})},[$e,st,Ne]);const Nn=He=>{X&&X(He),N.onFocus&&N.onFocus(He),Je&&Je.onFocus?Je.onFocus(He):Dn(!0)},Xt=He=>{S&&S(He),N.onBlur&&N.onBlur(He),Je&&Je.onBlur?Je.onBlur(He):Dn(!1)},Yn=(He,...Jt)=>{if(!Ne){const ln=He.target||je.current;if(ln==null)throw new Error(io(1));st({value:ln.value})}N.onChange&&N.onChange(He,...Jt),j&&j(He,...Jt)};T.useEffect(()=>{st(je.current)},[]);const me=He=>{je.current&&He.currentTarget===He.target&&je.current.focus(),W&&W(He)};let Zr=L,an=N;V&&Zr==="input"&&(te?an={type:void 0,minRows:te,maxRows:te,...an}:an={type:void 0,maxRows:z,minRows:M,...an},Zr=G5);const ho=He=>{st(He.animationName==="mui-auto-fill-cancel"?je.current:{value:"x"})};T.useEffect(()=>{Je&&Je.setAdornedStart(!!ue)},[Je,ue]);const ei={...r,color:jt.color||"primary",disabled:jt.disabled,endAdornment:w,error:jt.error,focused:jt.focused,formControl:Je,fullWidth:I,hiddenLabel:jt.hiddenLabel,multiline:V,size:jt.size,startAdornment:ue,type:ge},ti=Q5(ei),vt=G.root||h.Root||K2,Tt=R.root||y.root||{},wt=G.input||h.Input||Q2;return an={...an,...R.input??y.input},$.jsxs(T.Fragment,{children:[!C&&typeof m1=="function"&&(h1||(h1=$.jsx(m1,{}))),$.jsxs(vt,{...Tt,ref:n,onClick:me,...xe,...!f1(vt)&&{ownerState:{...ei,...Tt.ownerState}},className:ot(ti.root,Tt.className,u,fe&&"MuiInputBase-readOnly"),children:[ue,$.jsx(Ym.Provider,{value:null,children:$.jsx(wt,{"aria-invalid":jt.error,"aria-describedby":s,autoComplete:a,autoFocus:c,defaultValue:g,disabled:jt.disabled,id:P,onAnimationStart:ho,name:Y,placeholder:de,readOnly:fe,required:jt.required,rows:te,value:$e,onKeyDown:ae,onKeyUp:ce,type:ge,...an,...!f1(wt)&&{as:Zr,ownerState:{...ei,...an.ownerState}},ref:ur,className:ot(ti.input,an.className,fe&&"MuiInputBase-readOnly"),onBlur:Xt,onChange:Yn,onFocus:Nn})}),w,q?q({...jt,startAdornment:ue}):null]})]})});function J5(t){return hn("MuiInput",t)}const Wa={...Zu,...mn("MuiInput",["root","underline","input"])},q5=t=>{const{classes:e,disableUnderline:n}=t,s=yn({root:["root",!n&&"underline"],input:["input"]},J5,e);return{...e,...s}},Z5=Fe(K2,{shouldForwardProp:t=>Al(t)||t==="classes",name:"MuiInput",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[...G2(t,e),!n.disableUnderline&&e.underline]}})(On(({theme:t})=>{let n=t.palette.mode==="light"?"rgba(0, 0, 0, 0.42)":"rgba(255, 255, 255, 0.7)";return t.vars&&(n=`rgba(${t.vars.palette.common.onBackgroundChannel} / ${t.vars.opacity.inputUnderline})`),{position:"relative",variants:[{props:({ownerState:r})=>r.formControl,style:{"label + &":{marginTop:16}}},{props:({ownerState:r})=>!r.disableUnderline,style:{"&::after":{left:0,bottom:0,content:'""',position:"absolute",right:0,transform:"scaleX(0)",transition:t.transitions.create("transform",{duration:t.transitions.duration.shorter,easing:t.transitions.easing.easeOut}),pointerEvents:"none"},[`&.${Wa.focused}:after`]:{transform:"scaleX(1) translateX(0)"},[`&.${Wa.error}`]:{"&::before, &::after":{borderBottomColor:(t.vars||t).palette.error.main}},"&::before":{borderBottom:`1px solid ${n}`,left:0,bottom:0,content:'"\\00a0"',position:"absolute",right:0,transition:t.transitions.create("border-bottom-color",{duration:t.transitions.duration.shorter}),pointerEvents:"none"},[`&:hover:not(.${Wa.disabled}, .${Wa.error}):before`]:{borderBottom:`2px solid ${(t.vars||t).palette.text.primary}`,"@media (hover: none)":{borderBottom:`1px solid ${n}`}},[`&.${Wa.disabled}:before`]:{borderBottomStyle:"dotted"}}},...Object.entries(t.palette).filter(Ii()).map(([r])=>({props:{color:r,disableUnderline:!1},style:{"&::after":{borderBottom:`2px solid ${(t.vars||t).palette[r].main}`}}}))]}})),e4=Fe(Q2,{name:"MuiInput",slot:"Input",overridesResolver:Y2})({}),X2=T.forwardRef(function(e,n){const r=sn({props:e,name:"MuiInput"}),{disableUnderline:s=!1,components:a={},componentsProps:c,fullWidth:u=!1,inputComponent:f="input",multiline:h=!1,slotProps:y,slots:g={},type:v="text",...C}=r,w=q5(r),I={root:{ownerState:{disableUnderline:s}}},P=y??c?on(y??c,I):I,L=g.root??a.Root??Z5,N=g.input??a.Input??e4;return $.jsx(X5,{slots:{root:L,input:N},slotProps:P,fullWidth:u,inputComponent:f,multiline:h,ref:n,type:v,...C,classes:w})});X2.muiName="Input";const t4=t=>{const{classes:e}=t;return yn({root:["root"]},H2,e)},n4=$.jsx(X2,{}),Th=T.forwardRef(function(e,n){const r=sn({name:"MuiNativeSelect",props:e}),{className:s,children:a,classes:c={},IconComponent:u=V5,input:f=n4,inputProps:h,variant:y,...g}=r,v=wd(),C=Cd({props:r,muiFormControl:v,states:["variant"]}),w={...r,classes:c},_=t4(w),{root:I,...P}=c;return $.jsx(T.Fragment,{children:T.cloneElement(f,{inputComponent:U5,inputProps:{children:a,classes:P,IconComponent:u,variant:C.variant,type:void 0,...h,...f?f.props.inputProps:{}},ref:n,...g,className:ot(_.root,f.props.className,s)})})});Th.muiName="Select";function r4(t){return hn("MuiFormLabel",t)}const el=mn("MuiFormLabel",["root","colorSecondary","focused","disabled","error","filled","required","asterisk"]),i4=t=>{const{classes:e,color:n,focused:r,disabled:s,error:a,filled:c,required:u}=t,f={root:["root",`color${Oe(n)}`,s&&"disabled",a&&"error",c&&"filled",r&&"focused",u&&"required"],asterisk:["asterisk",a&&"error"]};return yn(f,r4,e)},o4=Fe("label",{name:"MuiFormLabel",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,n.color==="secondary"&&e.colorSecondary,n.filled&&e.filled]}})(On(({theme:t})=>({color:(t.vars||t).palette.text.secondary,...t.typography.body1,lineHeight:"1.4375em",padding:0,position:"relative",variants:[...Object.entries(t.palette).filter(Ii()).map(([e])=>({props:{color:e},style:{[`&.${el.focused}`]:{color:(t.vars||t).palette[e].main}}})),{props:{},style:{[`&.${el.disabled}`]:{color:(t.vars||t).palette.text.disabled},[`&.${el.error}`]:{color:(t.vars||t).palette.error.main}}}]}))),s4=Fe("span",{name:"MuiFormLabel",slot:"Asterisk",overridesResolver:(t,e)=>e.asterisk})(On(({theme:t})=>({[`&.${el.error}`]:{color:(t.vars||t).palette.error.main}}))),a4=T.forwardRef(function(e,n){const r=sn({props:e,name:"MuiFormLabel"}),{children:s,className:a,color:c,component:u="label",disabled:f,error:h,filled:y,focused:g,required:v,...C}=r,w=wd(),_=Cd({props:r,muiFormControl:w,states:["color","required","focused","disabled","error","filled"]}),I={...r,color:_.color||"primary",component:u,disabled:_.disabled,error:_.error,filled:_.filled,focused:_.focused,required:_.required},P=i4(I);return $.jsxs(o4,{as:u,ownerState:I,className:ot(P.root,a),ref:n,...C,children:[s,_.required&&$.jsxs(s4,{ownerState:I,"aria-hidden":!0,className:P.asterisk,children:[" ","*"]})]})});function l4(t){return hn("MuiInputLabel",t)}mn("MuiInputLabel",["root","focused","disabled","error","required","asterisk","formControl","sizeSmall","shrink","animated","standard","filled","outlined"]);const c4=t=>{const{classes:e,formControl:n,size:r,shrink:s,disableAnimation:a,variant:c,required:u}=t,f={root:["root",n&&"formControl",!a&&"animated",s&&"shrink",r&&r!=="normal"&&`size${Oe(r)}`,c],asterisk:[u&&"asterisk"]},h=yn(f,l4,e);return{...e,...h}},u4=Fe(a4,{shouldForwardProp:t=>Al(t)||t==="classes",name:"MuiInputLabel",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[{[`& .${el.asterisk}`]:e.asterisk},e.root,n.formControl&&e.formControl,n.size==="small"&&e.sizeSmall,n.shrink&&e.shrink,!n.disableAnimation&&e.animated,n.focused&&e.focused,e[n.variant]]}})(On(({theme:t})=>({display:"block",transformOrigin:"top left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%",variants:[{props:({ownerState:e})=>e.formControl,style:{position:"absolute",left:0,top:0,transform:"translate(0, 20px) scale(1)"}},{props:{size:"small"},style:{transform:"translate(0, 17px) scale(1)"}},{props:({ownerState:e})=>e.shrink,style:{transform:"translate(0, -1.5px) scale(0.75)",transformOrigin:"top left",maxWidth:"133%"}},{props:({ownerState:e})=>!e.disableAnimation,style:{transition:t.transitions.create(["color","transform","max-width"],{duration:t.transitions.duration.shorter,easing:t.transitions.easing.easeOut})}},{props:{variant:"filled"},style:{zIndex:1,pointerEvents:"none",transform:"translate(12px, 16px) scale(1)",maxWidth:"calc(100% - 24px)"}},{props:{variant:"filled",size:"small"},style:{transform:"translate(12px, 13px) scale(1)"}},{props:({variant:e,ownerState:n})=>e==="filled"&&n.shrink,style:{userSelect:"none",pointerEvents:"auto",transform:"translate(12px, 7px) scale(0.75)",maxWidth:"calc(133% - 24px)"}},{props:({variant:e,ownerState:n,size:r})=>e==="filled"&&n.shrink&&r==="small",style:{transform:"translate(12px, 4px) scale(0.75)"}},{props:{variant:"outlined"},style:{zIndex:1,pointerEvents:"none",transform:"translate(14px, 16px) scale(1)",maxWidth:"calc(100% - 24px)"}},{props:{variant:"outlined",size:"small"},style:{transform:"translate(14px, 9px) scale(1)"}},{props:({variant:e,ownerState:n})=>e==="outlined"&&n.shrink,style:{userSelect:"none",pointerEvents:"auto",maxWidth:"calc(133% - 32px)",transform:"translate(14px, -9px) scale(0.75)"}}]}))),y1=T.forwardRef(function(e,n){const r=sn({name:"MuiInputLabel",props:e}),{disableAnimation:s=!1,margin:a,shrink:c,variant:u,className:f,...h}=r,y=wd();let g=c;typeof g>"u"&&y&&(g=y.filled||y.focused||y.adornedStart);const v=Cd({props:r,muiFormControl:y,states:["size","variant","required","focused"]}),C={...r,disableAnimation:s,formControl:y,shrink:g,size:v.size,variant:v.variant,required:v.required,focused:v.focused},w=c4(C);return $.jsx(u4,{"data-shrink":g,ref:n,className:ot(w.root,f),...h,ownerState:C,classes:w})});function d4(t){return hn("MuiFormControl",t)}mn("MuiFormControl",["root","marginNone","marginNormal","marginDense","fullWidth","disabled"]);const f4=t=>{const{classes:e,margin:n,fullWidth:r}=t,s={root:["root",n!=="none"&&`margin${Oe(n)}`,r&&"fullWidth"]};return yn(s,d4,e)},p4=Fe("div",{name:"MuiFormControl",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,e[`margin${Oe(n.margin)}`],n.fullWidth&&e.fullWidth]}})({display:"inline-flex",flexDirection:"column",position:"relative",minWidth:0,padding:0,margin:0,border:0,verticalAlign:"top",variants:[{props:{margin:"normal"},style:{marginTop:16,marginBottom:8}},{props:{margin:"dense"},style:{marginTop:8,marginBottom:4}},{props:{fullWidth:!0},style:{width:"100%"}}]}),g1=T.forwardRef(function(e,n){const r=sn({props:e,name:"MuiFormControl"}),{children:s,className:a,color:c="primary",component:u="div",disabled:f=!1,error:h=!1,focused:y,fullWidth:g=!1,hiddenLabel:v=!1,margin:C="none",required:w=!1,size:_="medium",variant:I="outlined",...P}=r,L={...r,color:c,component:u,disabled:f,error:h,fullWidth:g,hiddenLabel:v,margin:C,required:w,size:_,variant:I},N=f4(L),[E,O]=T.useState(()=>{let ce=!1;return s&&T.Children.forEach(s,de=>{if(!Pp(de,["Input","Select"]))return;const fe=Pp(de,["Select"])?de.props.input:de;fe&&Y5(fe.props)&&(ce=!0)}),ce}),[z,M]=T.useState(()=>{let ce=!1;return s&&T.Children.forEach(s,de=>{Pp(de,["Input","Select"])&&(kh(de.props,!0)||kh(de.props.inputProps,!0))&&(ce=!0)}),ce}),[V,Y]=T.useState(!1);f&&V&&Y(!1);const S=y!==void 0&&!f?y:V;let j;T.useRef(!1);const W=T.useCallback(()=>{M(!0)},[]),X=T.useCallback(()=>{M(!1)},[]),ae=T.useMemo(()=>({adornedStart:E,setAdornedStart:O,color:c,disabled:f,error:h,filled:z,focused:S,fullWidth:g,hiddenLabel:v,size:_,onBlur:()=>{Y(!1)},onFocus:()=>{Y(!0)},onEmpty:X,onFilled:W,registerEffect:j,required:w,variant:I}),[E,c,f,h,z,S,g,v,j,X,W,w,_,I]);return $.jsx(Ym.Provider,{value:ae,children:$.jsx(p4,{as:u,ownerState:L,className:ot(N.root,a),ref:n,...P,children:s})})}),h4=KS({themeId:Cr});function m4(t){const e=l2(),n=h4(e.breakpoints.down("sm"));return T.useEffect(()=>{Tn.setFrameHeight()},[n]),$.jsx(Hm,{direction:n?"column":"row",spacing:2,children:t.children})}const y4=Fe(Ls)(({theme:t})=>({position:"relative",[t.breakpoints.down("sm")]:{width:"100%"},width:t.spacing(24),height:t.spacing(16),maxHeight:t.spacing(16),display:"flex",justifyContent:"center",alignItems:"center"})),g4=y4,v4=Fe(_d)(({theme:t})=>({display:"flex",justifyContent:"center",alignItems:"center",width:"100%",height:"100%",padding:t.spacing(2),boxSizing:"border-box"})),Ol=v4;function b4(){return $.jsx(Ol,{children:Pl("media_api_not_available")||"Media API not available"})}function S4(){return $.jsx(Ol,{children:Pl("device_ask_permission")||"Please allow the app to use your media devices"})}function _4(t){return $.jsxs(Ol,{children:[Pl("device_access_denied")||"Access denied"," (",t.error.message,")"]})}function C4(t){return $.jsxs(Ol,{children:[Pl("device_not_available")||"Device not available"," (",t.error.message,")"]})}const w4=po($.jsx("path",{d:"m21 6.5-4 4V7c0-.55-.45-1-1-1H9.82L21 17.18zM3.27 2 2 3.27 4.73 6H4c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h12c.21 0 .39-.08.54-.18L19.73 21 21 19.73z"}),"VideocamOff"),x4=Fe(_d)({display:"flex",justifyContent:"center",alignItems:"center",width:"100%",height:"100%"});function I4(){return $.jsx(x4,{children:$.jsx(w4,{fontSize:"large"})})}const k4=Kt.memo(I4),T4=Fe(Ls,{shouldForwardProp:t=>t!=="$transparent"})(({theme:t,$transparent:e})=>({margin:0,padding:0,position:"relative","&:before":{position:"absolute",content:'""',width:"100%",height:"100%",opacity:e?0:1,backgroundColor:t.palette.background.default,transition:"opacity 0.3s"}}));function R4(t){const[e,n]=T.useState(!1);return T.useEffect(()=>{const r=setTimeout(()=>{n(!0)},t.time);return()=>clearTimeout(r)},[t.time]),$.jsx(T4,{$transparent:e,children:t.children})}const E4=Fe("video")({maxWidth:"100%",maxHeight:"100%"}),A4=E4;function Rh(t){t.getVideoTracks().forEach(e=>e.stop()),t.getAudioTracks().forEach(e=>e.stop())}function P4(t){const e=T.useRef(null);return T.useEffect(()=>{if(t.deviceId==null)return;let n=null,r=!1;return navigator.mediaDevices.getUserMedia({video:{deviceId:t.deviceId},audio:!1}).then(s=>{if(n=s,r){Rh(n);return}e.current&&(e.current.srcObject=n)}),()=>{r=!0,n&&Rh(n)}},[t.deviceId]),$.jsx(A4,{ref:e,autoPlay:!0,muted:!0})}const O4=Kt.memo(P4);function v1(t,e){const n=t.map(r=>r.deviceId);if(e&&n.includes(e))return e;if(n.length>0)return n[0]}const M4=(t,e)=>{switch(e.type){case"SET_UNAVAILABLE":return{unavailable:!0,videoInputs:[],audioInputs:[],audioOutputs:[],selectedVideoInputDeviceId:void 0,selectedAudioInputDeviceId:void 0};case"UPDATE_DEVICES":{const n=e.devices,r=n.filter(f=>f.kind==="videoinput"),s=n.filter(f=>f.kind==="audioinput"),a=n.filter(f=>f.kind==="audiooutput"),c=v1(r,t.selectedVideoInputDeviceId),u=v1(s,t.selectedAudioInputDeviceId);return{...t,videoInputs:r,audioInputs:s,audioOutputs:a,selectedVideoInputDeviceId:c,selectedAudioInputDeviceId:u}}case"UPDATE_SELECTED_DEVICE_ID":return{...t,...e.payload}}};function D4(t){const{video:e,audio:n,defaultVideoDeviceId:r,defaultAudioDeviceId:s,onSelect:a}=t,[c,u]=T.useState("WAITING"),[{unavailable:f,videoInputs:h,selectedVideoInputDeviceId:y,audioInputs:g,selectedAudioInputDeviceId:v},C]=T.useReducer(M4,{unavailable:!1,videoInputs:[],audioInputs:[],audioOutputs:[],selectedVideoInputDeviceId:r,selectedAudioInputDeviceId:s}),w=T.useCallback(()=>{var L;if(typeof((L=navigator==null?void 0:navigator.mediaDevices)==null?void 0:L.enumerateDevices)!="function"){C({type:"SET_UNAVAILABLE"});return}return navigator.mediaDevices.enumerateDevices().then(N=>{C({type:"UPDATE_DEVICES",devices:N})})},[]),_=T.useRef({video:r,audio:s});_.current={video:r,audio:s},T.useEffect(()=>{var E;if(typeof((E=navigator==null?void 0:navigator.mediaDevices)==null?void 0:E.getUserMedia)!="function"){C({type:"SET_UNAVAILABLE"});return}u("WAITING");const{video:L,audio:N}=_.current;navigator.mediaDevices.getUserMedia({video:e&&L?{deviceId:L}:e,audio:n&&N?{deviceId:N}:n}).then(async O=>{Rh(O),await w(),u("ALLOWED")}).catch(O=>{u(O)})},[e,n,w]),T.useEffect(()=>{const L=()=>w();return navigator.mediaDevices.ondevicechange=L,()=>{navigator.mediaDevices.ondevicechange===L&&(navigator.mediaDevices.ondevicechange=null)}},[w]);const I=T.useCallback(L=>{C({type:"UPDATE_SELECTED_DEVICE_ID",payload:{selectedVideoInputDeviceId:L.target.value}})},[]),P=T.useCallback(L=>{C({type:"UPDATE_SELECTED_DEVICE_ID",payload:{selectedAudioInputDeviceId:L.target.value}})},[]);if(T.useEffect(()=>{const L=e?h.find(E=>E.deviceId===y):null,N=n?g.find(E=>E.deviceId===v):null;a({video:L==null?void 0:L.deviceId,audio:N==null?void 0:N.deviceId})},[e,n,a,h,g,y,v]),T.useEffect(()=>{setTimeout(()=>Tn.setFrameHeight())}),f)return $.jsx(b4,{});if(c==="WAITING")return $.jsx(R4,{time:1e3,children:$.jsx(S4,{})});if(c instanceof Error){const L=c;return L instanceof DOMException&&(L.name==="NotReadableError"||L.name==="NotFoundError")?$.jsx(C4,{error:L}):L instanceof DOMException&&L.name==="NotAllowedError"?$.jsx(_4,{error:L}):$.jsx(Ol,{children:$.jsxs(U2,{severity:"error",children:[L.name,": ",L.message]})})}return $.jsxs(m4,{children:[$.jsx(g4,{children:e&&y?$.jsx(O4,{deviceId:y}):$.jsx(k4,{})}),$.jsxs(Hm,{spacing:2,justifyContent:"center",children:[e&&y&&$.jsxs(g1,{fullWidth:!0,children:[$.jsx(y1,{htmlFor:"device-select-video-input",children:"Video Input"}),$.jsx(Th,{inputProps:{name:"video-input",id:"device-select-video-input"},value:y,onChange:I,children:h.map(L=>$.jsx("option",{value:L.deviceId,children:L.label},L.deviceId))})]}),n&&v&&$.jsxs(g1,{fullWidth:!0,children:[$.jsx(y1,{htmlFor:"device-select-audio-input",children:"Audio Input"}),$.jsx(Th,{inputProps:{name:"audio-input",id:"device-select-audio-input"},value:v,onChange:P,children:g.map(L=>$.jsx("option",{value:L.deviceId,children:L.label},L.deviceId))})]})]})]})}function N4({onClose:t,...e}){return $.jsxs(Hm,{spacing:2,children:[$.jsx(D4,{...e}),$.jsx(Ls,{children:$.jsx(W2,{variant:"contained",color:"primary",onClick:t,children:"Done"})})]})}function B4(t){var s,a,c,u,f,h,y,g,v,C,w,_,I,P,L,N,E,O,z,M,V,Y,S,j,W,X,ae;T.useEffect(()=>{Tn.setFrameHeight()});const e=t.stream.getVideoTracks().length>0,n=T.useCallback(ce=>{ce&&(ce.srcObject=t.stream)},[t.stream]),r=T.useCallback(()=>Tn.setFrameHeight(),[]);if(e){const ce={hidden:(s=t.userDefinedVideoAttrs)==null?void 0:s.hidden,style:(a=t.userDefinedVideoAttrs)==null?void 0:a.style,autoPlay:(c=t.userDefinedVideoAttrs)==null?void 0:c.autoPlay,controls:(u=t.userDefinedVideoAttrs)==null?void 0:u.controls,controlsList:(f=t.userDefinedVideoAttrs)==null?void 0:f.controlsList,crossOrigin:(h=t.userDefinedVideoAttrs)==null?void 0:h.crossOrigin,loop:(y=t.userDefinedVideoAttrs)==null?void 0:y.loop,mediaGroup:(g=t.userDefinedVideoAttrs)==null?void 0:g.mediaGroup,muted:(v=t.userDefinedVideoAttrs)==null?void 0:v.muted,playsInline:(C=t.userDefinedVideoAttrs)==null?void 0:C.playsInline,preload:(w=t.userDefinedVideoAttrs)==null?void 0:w.preload,height:(_=t.userDefinedVideoAttrs)==null?void 0:_.height,poster:(I=t.userDefinedVideoAttrs)==null?void 0:I.poster,width:(P=t.userDefinedVideoAttrs)==null?void 0:P.width,disablePictureInPicture:(L=t.userDefinedVideoAttrs)==null?void 0:L.disablePictureInPicture,disableRemotePlayback:(N=t.userDefinedVideoAttrs)==null?void 0:N.disableRemotePlayback};return $.jsx("video",{...ce,ref:n,onCanPlay:r})}else{const ce={hidden:(E=t.userDefinedAudioAttrs)==null?void 0:E.hidden,style:(O=t.userDefinedAudioAttrs)==null?void 0:O.style,autoPlay:(z=t.userDefinedAudioAttrs)==null?void 0:z.autoPlay,controls:(M=t.userDefinedAudioAttrs)==null?void 0:M.controls,controlsList:(V=t.userDefinedAudioAttrs)==null?void 0:V.controlsList,crossOrigin:(Y=t.userDefinedAudioAttrs)==null?void 0:Y.crossOrigin,loop:(S=t.userDefinedAudioAttrs)==null?void 0:S.loop,mediaGroup:(j=t.userDefinedAudioAttrs)==null?void 0:j.mediaGroup,muted:(W=t.userDefinedAudioAttrs)==null?void 0:W.muted,playsInline:(X=t.userDefinedAudioAttrs)==null?void 0:X.playsInline,preload:(ae=t.userDefinedAudioAttrs)==null?void 0:ae.preload};return $.jsx("audio",{ref:n,...ce})}}const L4=Kt.memo(B4),F4=po($.jsx("path",{d:"M21 3H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m0 13H3V5h18z"}),"VideoLabel"),$4=Fe(_d)(({theme:t})=>({padding:t.spacing(4),display:"flex",justifyContent:"center",alignItems:"center",width:"100%"}));function z4(t){return T.useEffect(()=>{Tn.setFrameHeight()}),$.jsx($4,{elevation:0,children:t.loading?$.jsx(Wm,{}):$.jsx(F4,{fontSize:"large"})})}const j4=Kt.memo(z4);function U4(t,e,n){const r=t||{};return e&&(r.video===!0?r.video={deviceId:e}:(typeof r.video=="object"||r.video==null)&&(r.video={...r.video,deviceId:e})),n&&(r.audio===!0?r.audio={deviceId:n}:(typeof r.audio=="object"||r.audio==null)&&(r.audio={...r.audio,deviceId:n})),r}function V4(t){const e=t?!!t.video:!0,n=t?!!t.audio:!0;return{videoEnabled:e,audioEnabled:n}}const W4={webRtcState:"STOPPED",sdpOffer:null,iceCandidates:{},stream:null,error:null},b1=new Set;function H4(){let t;do t=Math.random().toString(36).substring(2,15);while(b1.has(t));return b1.add(t),t}const G4=(t,e)=>{switch(e.type){case"SIGNALLING_START":return{...t,webRtcState:"SIGNALLING",stream:null,error:null};case"SET_STREAM":return{...t,stream:e.stream};case"SET_OFFER":return{...t,sdpOffer:e.offer};case"ADD_ICE_CANDIDATE":{const n=H4();return{...t,iceCandidates:{...t.iceCandidates,[n]:e.candidate}}}case"STOPPING":return{...t,webRtcState:"STOPPING",sdpOffer:null,iceCandidates:{}};case"STOPPED":return{...t,webRtcState:"STOPPED",sdpOffer:null,iceCandidates:{},stream:null};case"START_PLAYING":return{...t,webRtcState:"PLAYING",sdpOffer:null,iceCandidates:{}};case"SET_OFFER_ERROR":return{...t,webRtcState:"STOPPED",sdpOffer:null,iceCandidates:{},error:e.error};case"PROCESS_ANSWER_ERROR":return{...t,webRtcState:"STOPPED",sdpOffer:null,iceCandidates:{},error:e.error};case"ERROR":return{...t,webRtcState:"STOPPED",sdpOffer:null,iceCandidates:{},error:e.error}}},Y4=t=>(n,r)=>{const s=G4(n,r),a=s.webRtcState==="PLAYING",c=n.webRtcState==="PLAYING",u=a!==c,f=s.sdpOffer,h=n.sdpOffer,y=f!==h,g=s.iceCandidates,v=n.iceCandidates,C=Object.keys(g).length!==Object.keys(v).length;if(u||y||C){const w=Object.fromEntries(Object.entries(g).map(([I,P])=>[I,P.toJSON()])),_={playing:a,sdpOffer:f?f.toJSON():"",iceCandidates:w};console.debug("set component value",_),t(_)}return s},Eh=t=>t==="RECVONLY"||t==="SENDONLY"||t==="SENDRECV",K4=t=>t==="SENDRECV"||t==="RECVONLY",Q4=t=>t==="SENDRECV"||t==="SENDONLY",X4=(t,e,n,r,s)=>{T.useEffect(()=>r({playing:!1,sdpOffer:"",iceCandidates:{}}),[]);const a=T.useRef(),c=T.useMemo(()=>Y4(r),[r]),[u,f]=T.useReducer(c,W4),h=T.useCallback(()=>{(async()=>{if(u.webRtcState==="STOPPING")return;const C=a.current;if(a.current=void 0,f({type:"STOPPING"}),C!=null)return C.getTransceivers&&C.getTransceivers().forEach(function(w){w.stop&&w.stop()}),C.getSenders().forEach(function(w){var _;(_=w.track)==null||_.stop()}),new Promise(w=>{setTimeout(()=>{C.close(),w()},500)})})().catch(C=>f({type:"ERROR",error:C})).finally(()=>{f({type:"STOPPED"})})},[u.webRtcState]),y=T.useRef(h);y.current=h;const g=T.useCallback(()=>u.webRtcState!=="STOPPED"?Promise.reject(new Error("WebRTC is already started")):(async()=>{f({type:"SIGNALLING_START"});const C=t.mode,w=t.rtcConfiguration||{};console.debug("RTCConfiguration:",w);const _=new RTCPeerConnection(w);if((C==="SENDRECV"||C==="RECVONLY")&&_.addEventListener("track",I=>{const P=I.streams[0];f({type:"SET_STREAM",stream:P})}),C==="SENDRECV"||C==="SENDONLY"){const I=U4(t.mediaStreamConstraints,e,n);if(console.debug("MediaStreamConstraints:",I),I.audio||I.video){if(navigator.mediaDevices==null)throw new Error("navigator.mediaDevices is undefined. It seems the current document is not loaded securely.");if(navigator.mediaDevices.getUserMedia==null)throw new Error("getUserMedia is not implemented in this browser");const P={},L=await navigator.mediaDevices.getUserMedia(I);L.getTracks().forEach(N=>{_.addTrack(N,L);const E=N.kind;if(E!=="video"&&E!=="audio")return;const O=N.getSettings().deviceId;O!=null&&(P[E]=O)}),Object.keys(P).length>0&&s(P)}if(C==="SENDONLY")for(const P of _.getTransceivers())P.direction="sendonly"}else C==="RECVONLY"&&(_.addTransceiver("video",{direction:"recvonly"}),_.addTransceiver("audio",{direction:"recvonly"}));console.debug("transceivers",_.getTransceivers()),_.addEventListener("connectionstatechange",()=>{console.debug("connectionstatechange",_.connectionState),_.connectionState==="connected"?f({type:"START_PLAYING"}):(_.connectionState==="disconnected"||_.connectionState==="closed"||_.connectionState==="failed")&&y.current()}),a.current=_,_.addEventListener("icecandidate",I=>{I.candidate&&(console.debug("icecandidate",I.candidate),f({type:"ADD_ICE_CANDIDATE",candidate:I.candidate}))}),_.createOffer().then(I=>_.setLocalDescription(I).then(()=>{const P=_.localDescription;if(P==null)throw new Error("Failed to create an offer SDP");f({type:"SET_OFFER",offer:P})})).catch(I=>{f({type:"SET_OFFER_ERROR",error:I})})})().catch(C=>f({type:"ERROR",error:C})),[n,e,t.mediaStreamConstraints,t.mode,t.rtcConfiguration,u.webRtcState,s]);return T.useEffect(()=>{const v=a.current;if(v==null)return;const C=t.sdpAnswerJson;if(v.remoteDescription==null&&C&&u.webRtcState==="SIGNALLING"){const w=JSON.parse(C);console.debug("Receive answer SDP",w),v.setRemoteDescription(w).catch(_=>{f({type:"PROCESS_ANSWER_ERROR",error:_}),h()})}},[t.sdpAnswerJson,u.webRtcState,h]),T.useEffect(()=>{const v=t.desiredPlayingState;v!=null&&(v===!0&&u.webRtcState==="STOPPED"?g():v===!1&&(u.webRtcState==="SIGNALLING"||u.webRtcState==="PLAYING")&&h())},[t.desiredPlayingState,g,u.webRtcState,h]),{start:g,stop:h,state:u}};function J4(){const[t,e]=T.useState(!1),n=T.useRef(void 0),r=T.useCallback(a=>{n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{e(!0)},a)},[]),s=T.useCallback(()=>{n.current&&clearTimeout(n.current),e(!1)},[]);return T.useEffect(()=>()=>{s()},[s]),{start:r,clear:s,isTimedOut:t}}function q4(t){return Tn.setComponentValue(t)}function Gp({translationKey:t,defaultText:e,...n}){return $.jsx(W2,{...n,children:Pl(t)||e})}let J2=!0,q2=!0;function du(t,e,n){const r=t.match(e);return r&&r.length>=n&&parseInt(r[n],10)}function Vo(t,e,n){if(!t.RTCPeerConnection)return;const r=t.RTCPeerConnection.prototype,s=r.addEventListener;r.addEventListener=function(c,u){if(c!==e)return s.apply(this,arguments);const f=h=>{const y=n(h);y&&(u.handleEvent?u.handleEvent(y):u(y))};return this._eventMap=this._eventMap||{},this._eventMap[e]||(this._eventMap[e]=new Map),this._eventMap[e].set(u,f),s.apply(this,[c,f])};const a=r.removeEventListener;r.removeEventListener=function(c,u){if(c!==e||!this._eventMap||!this._eventMap[e])return a.apply(this,arguments);if(!this._eventMap[e].has(u))return a.apply(this,arguments);const f=this._eventMap[e].get(u);return this._eventMap[e].delete(u),this._eventMap[e].size===0&&delete this._eventMap[e],Object.keys(this._eventMap).length===0&&delete this._eventMap,a.apply(this,[c,f])},Object.defineProperty(r,"on"+e,{get(){return this["_on"+e]},set(c){this["_on"+e]&&(this.removeEventListener(e,this["_on"+e]),delete this["_on"+e]),c&&this.addEventListener(e,this["_on"+e]=c)},enumerable:!0,configurable:!0})}function Z4(t){return typeof t!="boolean"?new Error("Argument type: "+typeof t+". Please use a boolean."):(J2=t,t?"adapter.js logging disabled":"adapter.js logging enabled")}function eO(t){return typeof t!="boolean"?new Error("Argument type: "+typeof t+". Please use a boolean."):(q2=!t,"adapter.js deprecation warnings "+(t?"disabled":"enabled"))}function Z2(){if(typeof window=="object"){if(J2)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function Km(t,e){q2&&console.warn(t+" is deprecated, please use "+e+" instead.")}function tO(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(s=>s.brand==="Chromium");if(r)return{browser:"chrome",version:parseInt(r.version,10)}}if(n.mozGetUserMedia)e.browser="firefox",e.version=du(n.userAgent,/Firefox\/(\d+)\./,1);else if(n.webkitGetUserMedia||t.isSecureContext===!1&&t.webkitRTCPeerConnection)e.browser="chrome",e.version=du(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(t.RTCPeerConnection&&n.userAgent.match(/AppleWebKit\/(\d+)\./))e.browser="safari",e.version=du(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 S1(t){return Object.prototype.toString.call(t)==="[object Object]"}function e_(t){return S1(t)?Object.keys(t).reduce(function(e,n){const r=S1(t[n]),s=r?e_(t[n]):t[n],a=r&&!Object.keys(s).length;return s===void 0||a?e:Object.assign(e,{[n]:s})},{}):t}function Ah(t,e,n){!e||n.has(e.id)||(n.set(e.id,e),Object.keys(e).forEach(r=>{r.endsWith("Id")?Ah(t,t.get(e[r]),n):r.endsWith("Ids")&&e[r].forEach(s=>{Ah(t,t.get(s),n)})}))}function _1(t,e,n){const r=n?"outbound-rtp":"inbound-rtp",s=new Map;if(e===null)return s;const a=[];return t.forEach(c=>{c.type==="track"&&c.trackIdentifier===e.id&&a.push(c)}),a.forEach(c=>{t.forEach(u=>{u.type===r&&u.trackId===c.id&&Ah(t,u,s)})}),s}const C1=Z2;function t_(t,e){const n=t&&t.navigator;if(!n.mediaDevices)return;const r=function(u){if(typeof u!="object"||u.mandatory||u.optional)return u;const f={};return Object.keys(u).forEach(h=>{if(h==="require"||h==="advanced"||h==="mediaSource")return;const y=typeof u[h]=="object"?u[h]:{ideal:u[h]};y.exact!==void 0&&typeof y.exact=="number"&&(y.min=y.max=y.exact);const g=function(v,C){return v?v+C.charAt(0).toUpperCase()+C.slice(1):C==="deviceId"?"sourceId":C};if(y.ideal!==void 0){f.optional=f.optional||[];let v={};typeof y.ideal=="number"?(v[g("min",h)]=y.ideal,f.optional.push(v),v={},v[g("max",h)]=y.ideal,f.optional.push(v)):(v[g("",h)]=y.ideal,f.optional.push(v))}y.exact!==void 0&&typeof y.exact!="number"?(f.mandatory=f.mandatory||{},f.mandatory[g("",h)]=y.exact):["min","max"].forEach(v=>{y[v]!==void 0&&(f.mandatory=f.mandatory||{},f.mandatory[g(v,h)]=y[v])})}),u.advanced&&(f.optional=(f.optional||[]).concat(u.advanced)),f},s=function(u,f){if(e.version>=61)return f(u);if(u=JSON.parse(JSON.stringify(u)),u&&typeof u.audio=="object"){const h=function(y,g,v){g in y&&!(v in y)&&(y[v]=y[g],delete y[g])};u=JSON.parse(JSON.stringify(u)),h(u.audio,"autoGainControl","googAutoGainControl"),h(u.audio,"noiseSuppression","googNoiseSuppression"),u.audio=r(u.audio)}if(u&&typeof u.video=="object"){let h=u.video.facingMode;h=h&&(typeof h=="object"?h:{ideal:h});const y=e.version<66;if(h&&(h.exact==="user"||h.exact==="environment"||h.ideal==="user"||h.ideal==="environment")&&!(n.mediaDevices.getSupportedConstraints&&n.mediaDevices.getSupportedConstraints().facingMode&&!y)){delete u.video.facingMode;let g;if(h.exact==="environment"||h.ideal==="environment"?g=["back","rear"]:(h.exact==="user"||h.ideal==="user")&&(g=["front"]),g)return n.mediaDevices.enumerateDevices().then(v=>{v=v.filter(w=>w.kind==="videoinput");let C=v.find(w=>g.some(_=>w.label.toLowerCase().includes(_)));return!C&&v.length&&g.includes("back")&&(C=v[v.length-1]),C&&(u.video.deviceId=h.exact?{exact:C.deviceId}:{ideal:C.deviceId}),u.video=r(u.video),C1("chrome: "+JSON.stringify(u)),f(u)})}u.video=r(u.video)}return C1("chrome: "+JSON.stringify(u)),f(u)},a=function(u){return e.version>=64?u:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[u.name]||u.name,message:u.message,constraint:u.constraint||u.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}},c=function(u,f,h){s(u,y=>{n.webkitGetUserMedia(y,f,g=>{h&&h(a(g))})})};if(n.getUserMedia=c.bind(n),n.mediaDevices.getUserMedia){const u=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(f){return s(f,h=>u(h).then(y=>{if(h.audio&&!y.getAudioTracks().length||h.video&&!y.getVideoTracks().length)throw y.getTracks().forEach(g=>{g.stop()}),new DOMException("","NotFoundError");return y},y=>Promise.reject(a(y))))}}}function n_(t){t.MediaStream=t.MediaStream||t.webkitMediaStream}function r_(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",s=>{let a;t.RTCPeerConnection.prototype.getReceivers?a=this.getReceivers().find(u=>u.track&&u.track.id===s.track.id):a={track:s.track};const c=new Event("track");c.track=s.track,c.receiver=a,c.transceiver={receiver:a},c.streams=[r.stream],this.dispatchEvent(c)}),r.stream.getTracks().forEach(s=>{let a;t.RTCPeerConnection.prototype.getReceivers?a=this.getReceivers().find(u=>u.track&&u.track.id===s.id):a={track:s};const c=new Event("track");c.track=s,c.receiver=a,c.transceiver={receiver:a},c.streams=[r.stream],this.dispatchEvent(c)})},this.addEventListener("addstream",this._ontrackpoly)),e.apply(this,arguments)}}else Vo(t,"track",e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e))}function i_(t){if(typeof t=="object"&&t.RTCPeerConnection&&!("getSenders"in t.RTCPeerConnection.prototype)&&"createDTMFSender"in t.RTCPeerConnection.prototype){const e=function(s,a){return{track:a,get dtmf(){return this._dtmf===void 0&&(a.kind==="audio"?this._dtmf=s.createDTMFSender(a):this._dtmf=null),this._dtmf},_pc:s}};if(!t.RTCPeerConnection.prototype.getSenders){t.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const s=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(u,f){let h=s.apply(this,arguments);return h||(h=e(this,u),this._senders.push(h)),h};const a=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(u){a.apply(this,arguments);const f=this._senders.indexOf(u);f!==-1&&this._senders.splice(f,1)}}const n=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(a){this._senders=this._senders||[],n.apply(this,[a]),a.getTracks().forEach(c=>{this._senders.push(e(this,c))})};const r=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(a){this._senders=this._senders||[],r.apply(this,[a]),a.getTracks().forEach(c=>{const u=this._senders.find(f=>f.track===c);u&&this._senders.splice(this._senders.indexOf(u),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(s=>s._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 o_(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 a=n.apply(this,[]);return a.forEach(c=>c._pc=this),a});const r=t.RTCPeerConnection.prototype.addTrack;r&&(t.RTCPeerConnection.prototype.addTrack=function(){const a=r.apply(this,arguments);return a._pc=this,a}),t.RTCRtpSender.prototype.getStats=function(){const a=this;return this._pc.getStats().then(c=>_1(c,a.track,!0))}}if(!("getStats"in t.RTCRtpReceiver.prototype)){const n=t.RTCPeerConnection.prototype.getReceivers;n&&(t.RTCPeerConnection.prototype.getReceivers=function(){const s=n.apply(this,[]);return s.forEach(a=>a._pc=this),s}),Vo(t,"track",r=>(r.receiver._pc=r.srcElement,r)),t.RTCRtpReceiver.prototype.getStats=function(){const s=this;return this._pc.getStats().then(a=>_1(a,s.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 s,a,c;return this.getSenders().forEach(u=>{u.track===r&&(s?c=!0:s=u)}),this.getReceivers().forEach(u=>(u.track===r&&(a?c=!0:a=u),u.track===r)),c||s&&a?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):s?s.getStats():a?a.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return e.apply(this,arguments)}}function s_(t){t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(c=>this._shimmedLocalStreams[c][0])};const e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(c,u){if(!u)return e.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const f=e.apply(this,arguments);return this._shimmedLocalStreams[u.id]?this._shimmedLocalStreams[u.id].indexOf(f)===-1&&this._shimmedLocalStreams[u.id].push(f):this._shimmedLocalStreams[u.id]=[u,f],f};const n=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(c){this._shimmedLocalStreams=this._shimmedLocalStreams||{},c.getTracks().forEach(h=>{if(this.getSenders().find(g=>g.track===h))throw new DOMException("Track already exists.","InvalidAccessError")});const u=this.getSenders();n.apply(this,arguments);const f=this.getSenders().filter(h=>u.indexOf(h)===-1);this._shimmedLocalStreams[c.id]=[c].concat(f)};const r=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(c){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[c.id],r.apply(this,arguments)};const s=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(c){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},c&&Object.keys(this._shimmedLocalStreams).forEach(u=>{const f=this._shimmedLocalStreams[u].indexOf(c);f!==-1&&this._shimmedLocalStreams[u].splice(f,1),this._shimmedLocalStreams[u].length===1&&delete this._shimmedLocalStreams[u]}),s.apply(this,arguments)}}function a_(t,e){if(!t.RTCPeerConnection)return;if(t.RTCPeerConnection.prototype.addTrack&&e.version>=65)return s_(t);const n=t.RTCPeerConnection.prototype.getLocalStreams;t.RTCPeerConnection.prototype.getLocalStreams=function(){const y=n.apply(this);return this._reverseStreams=this._reverseStreams||{},y.map(g=>this._reverseStreams[g.id])};const r=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(y){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},y.getTracks().forEach(g=>{if(this.getSenders().find(C=>C.track===g))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[y.id]){const g=new t.MediaStream(y.getTracks());this._streams[y.id]=g,this._reverseStreams[g.id]=y,y=g}r.apply(this,[y])};const s=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(y){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},s.apply(this,[this._streams[y.id]||y]),delete this._reverseStreams[this._streams[y.id]?this._streams[y.id].id:y.id],delete this._streams[y.id]},t.RTCPeerConnection.prototype.addTrack=function(y,g){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const v=[].slice.call(arguments,1);if(v.length!==1||!v[0].getTracks().find(_=>_===y))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(_=>_.track===y))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const w=this._streams[g.id];if(w)w.addTrack(y),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const _=new t.MediaStream([y]);this._streams[g.id]=_,this._reverseStreams[_.id]=g,this.addStream(_)}return this.getSenders().find(_=>_.track===y)};function a(h,y){let g=y.sdp;return Object.keys(h._reverseStreams||[]).forEach(v=>{const C=h._reverseStreams[v],w=h._streams[C.id];g=g.replace(new RegExp(w.id,"g"),C.id)}),new RTCSessionDescription({type:y.type,sdp:g})}function c(h,y){let g=y.sdp;return Object.keys(h._reverseStreams||[]).forEach(v=>{const C=h._reverseStreams[v],w=h._streams[C.id];g=g.replace(new RegExp(C.id,"g"),w.id)}),new RTCSessionDescription({type:y.type,sdp:g})}["createOffer","createAnswer"].forEach(function(h){const y=t.RTCPeerConnection.prototype[h],g={[h](){const v=arguments;return arguments.length&&typeof arguments[0]=="function"?y.apply(this,[w=>{const _=a(this,w);v[0].apply(null,[_])},w=>{v[1]&&v[1].apply(null,w)},arguments[2]]):y.apply(this,arguments).then(w=>a(this,w))}};t.RTCPeerConnection.prototype[h]=g[h]});const u=t.RTCPeerConnection.prototype.setLocalDescription;t.RTCPeerConnection.prototype.setLocalDescription=function(){return!arguments.length||!arguments[0].type?u.apply(this,arguments):(arguments[0]=c(this,arguments[0]),u.apply(this,arguments))};const f=Object.getOwnPropertyDescriptor(t.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(t.RTCPeerConnection.prototype,"localDescription",{get(){const h=f.get.apply(this);return h.type===""?h:a(this,h)}}),t.RTCPeerConnection.prototype.removeTrack=function(y){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!y._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(y._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{};let v;Object.keys(this._streams).forEach(C=>{this._streams[C].getTracks().find(_=>y.track===_)&&(v=this._streams[C])}),v&&(v.getTracks().length===1?this.removeStream(this._reverseStreams[v.id]):v.removeTrack(y.track),this.dispatchEvent(new Event("negotiationneeded")))}}function Ph(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],s={[n](){return arguments[0]=new(n==="addIceCandidate"?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};t.RTCPeerConnection.prototype[n]=s[n]})}function l_(t,e){Vo(t,"negotiationneeded",n=>{const r=n.target;if(!((e.version<72||r.getConfiguration&&r.getConfiguration().sdpSemantics==="plan-b")&&r.signalingState!=="stable"))return n})}const w1=Object.freeze(Object.defineProperty({__proto__:null,fixNegotiationNeeded:l_,shimAddTrackRemoveTrack:a_,shimAddTrackRemoveTrackWithNative:s_,shimGetSendersWithDtmf:i_,shimGetUserMedia:t_,shimMediaStream:n_,shimOnTrack:r_,shimPeerConnection:Ph,shimSenderReceiverGetStats:o_},Symbol.toStringTag,{value:"Module"}));function c_(t,e){const n=t&&t.navigator,r=t&&t.MediaStreamTrack;if(n.getUserMedia=function(s,a,c){Km("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),n.mediaDevices.getUserMedia(s).then(a,c)},!(e.version>55&&"autoGainControl"in n.mediaDevices.getSupportedConstraints())){const s=function(c,u,f){u in c&&!(f in c)&&(c[f]=c[u],delete c[u])},a=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(c){return typeof c=="object"&&typeof c.audio=="object"&&(c=JSON.parse(JSON.stringify(c)),s(c.audio,"autoGainControl","mozAutoGainControl"),s(c.audio,"noiseSuppression","mozNoiseSuppression")),a(c)},r&&r.prototype.getSettings){const c=r.prototype.getSettings;r.prototype.getSettings=function(){const u=c.apply(this,arguments);return s(u,"mozAutoGainControl","autoGainControl"),s(u,"mozNoiseSuppression","noiseSuppression"),u}}if(r&&r.prototype.applyConstraints){const c=r.prototype.applyConstraints;r.prototype.applyConstraints=function(u){return this.kind==="audio"&&typeof u=="object"&&(u=JSON.parse(JSON.stringify(u)),s(u,"autoGainControl","mozAutoGainControl"),s(u,"noiseSuppression","mozNoiseSuppression")),c.apply(this,[u])}}}}function nO(t,e){t.navigator.mediaDevices&&"getDisplayMedia"in t.navigator.mediaDevices||t.navigator.mediaDevices&&(t.navigator.mediaDevices.getDisplayMedia=function(r){if(!(r&&r.video)){const s=new DOMException("getDisplayMedia without video constraints is undefined");return s.name="NotFoundError",s.code=8,Promise.reject(s)}return r.video===!0?r.video={mediaSource:e}:r.video.mediaSource=e,t.navigator.mediaDevices.getUserMedia(r)})}function u_(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 Oh(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(s){const a=t.RTCPeerConnection.prototype[s],c={[s](){return arguments[0]=new(s==="addIceCandidate"?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),a.apply(this,arguments)}};t.RTCPeerConnection.prototype[s]=c[s]});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[a,c,u]=arguments;return r.apply(this,[a||null]).then(f=>{if(e.version<53&&!c)try{f.forEach(h=>{h.type=n[h.type]||h.type})}catch(h){if(h.name!=="TypeError")throw h;f.forEach((y,g)=>{f.set(g,Object.assign({},y,{type:n[y.type]||y.type}))})}return f}).then(c,u)}}function d_(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 s=e.apply(this,[]);return s.forEach(a=>a._pc=this),s});const n=t.RTCPeerConnection.prototype.addTrack;n&&(t.RTCPeerConnection.prototype.addTrack=function(){const s=n.apply(this,arguments);return s._pc=this,s}),t.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function f_(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(s=>s._pc=this),r}),Vo(t,"track",n=>(n.receiver._pc=n.srcElement,n)),t.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function p_(t){!t.RTCPeerConnection||"removeStream"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.removeStream=function(n){Km("removeStream","removeTrack"),this.getSenders().forEach(r=>{r.track&&n.getTracks().includes(r.track)&&this.removeTrack(r)})})}function h_(t){t.DataChannel&&!t.RTCDataChannel&&(t.RTCDataChannel=t.DataChannel)}function m_(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 s=r.length>0;s&&r.forEach(c=>{if("rid"in c&&!/^[a-z0-9]{0,16}$/i.test(c.rid))throw new TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in c&&!(parseFloat(c.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in c&&!(parseFloat(c.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});const a=e.apply(this,arguments);if(s){const{sender:c}=a,u=c.getParameters();(!("encodings"in u)||u.encodings.length===1&&Object.keys(u.encodings[0]).length===0)&&(u.encodings=r,c.sendEncodings=r,this.setParametersPromises.push(c.setParameters(u).then(()=>{delete c.sendEncodings}).catch(()=>{delete c.sendEncodings})))}return a})}function y_(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 g_(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 v_(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)}}const x1=Object.freeze(Object.defineProperty({__proto__:null,shimAddTransceiver:m_,shimCreateAnswer:v_,shimCreateOffer:g_,shimGetDisplayMedia:nO,shimGetParameters:y_,shimGetUserMedia:c_,shimOnTrack:u_,shimPeerConnection:Oh,shimRTCDataChannel:h_,shimReceiverGetStats:f_,shimRemoveStream:p_,shimSenderGetStats:d_},Symbol.toStringTag,{value:"Module"}));function b_(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(s=>e.call(this,s,r)),r.getVideoTracks().forEach(s=>e.call(this,s,r))},t.RTCPeerConnection.prototype.addTrack=function(r,...s){return s&&s.forEach(a=>{this._localStreams?this._localStreams.includes(a)||this._localStreams.push(a):this._localStreams=[a]}),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 s=n.getTracks();this.getSenders().forEach(a=>{s.includes(a.track)&&this.removeTrack(a)})})}}function S_(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(s=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(s))return;this._remoteStreams.push(s);const a=new Event("addstream");a.stream=s,this.dispatchEvent(a)})})}});const e=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){const r=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(s){s.streams.forEach(a=>{if(r._remoteStreams||(r._remoteStreams=[]),r._remoteStreams.indexOf(a)>=0)return;r._remoteStreams.push(a);const c=new Event("addstream");c.stream=a,r.dispatchEvent(c)})}),e.apply(r,arguments)}}}function __(t){if(typeof t!="object"||!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype,n=e.createOffer,r=e.createAnswer,s=e.setLocalDescription,a=e.setRemoteDescription,c=e.addIceCandidate;e.createOffer=function(h,y){const g=arguments.length>=2?arguments[2]:arguments[0],v=n.apply(this,[g]);return y?(v.then(h,y),Promise.resolve()):v},e.createAnswer=function(h,y){const g=arguments.length>=2?arguments[2]:arguments[0],v=r.apply(this,[g]);return y?(v.then(h,y),Promise.resolve()):v};let u=function(f,h,y){const g=s.apply(this,[f]);return y?(g.then(h,y),Promise.resolve()):g};e.setLocalDescription=u,u=function(f,h,y){const g=a.apply(this,[f]);return y?(g.then(h,y),Promise.resolve()):g},e.setRemoteDescription=u,u=function(f,h,y){const g=c.apply(this,[f]);return y?(g.then(h,y),Promise.resolve()):g},e.addIceCandidate=u}function C_(t){const e=t&&t.navigator;if(e.mediaDevices&&e.mediaDevices.getUserMedia){const n=e.mediaDevices,r=n.getUserMedia.bind(n);e.mediaDevices.getUserMedia=s=>r(w_(s))}!e.getUserMedia&&e.mediaDevices&&e.mediaDevices.getUserMedia&&(e.getUserMedia=(function(r,s,a){e.mediaDevices.getUserMedia(r).then(s,a)}).bind(e))}function w_(t){return t&&t.video!==void 0?Object.assign({},t,{video:e_(t.video)}):t}function x_(t){if(!t.RTCPeerConnection)return;const e=t.RTCPeerConnection;t.RTCPeerConnection=function(r,s){if(r&&r.iceServers){const a=[];for(let c=0;c<r.iceServers.length;c++){let u=r.iceServers[c];u.urls===void 0&&u.url?(Km("RTCIceServer.url","RTCIceServer.urls"),u=JSON.parse(JSON.stringify(u)),u.urls=u.url,delete u.url,a.push(u)):a.push(r.iceServers[c])}r.iceServers=a}return new e(r,s)},t.RTCPeerConnection.prototype=e.prototype,"generateCertificate"in e&&Object.defineProperty(t.RTCPeerConnection,"generateCertificate",{get(){return e.generateCertificate}})}function I_(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 k_(t){const e=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function(r){if(r){typeof r.offerToReceiveAudio<"u"&&(r.offerToReceiveAudio=!!r.offerToReceiveAudio);const s=this.getTransceivers().find(c=>c.receiver.track.kind==="audio");r.offerToReceiveAudio===!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.offerToReceiveAudio===!0&&!s&&this.addTransceiver("audio",{direction:"recvonly"}),typeof r.offerToReceiveVideo<"u"&&(r.offerToReceiveVideo=!!r.offerToReceiveVideo);const a=this.getTransceivers().find(c=>c.receiver.track.kind==="video");r.offerToReceiveVideo===!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.offerToReceiveVideo===!0&&!a&&this.addTransceiver("video",{direction:"recvonly"})}return e.apply(this,arguments)}}function T_(t){typeof t!="object"||t.AudioContext||(t.AudioContext=t.webkitAudioContext)}const I1=Object.freeze(Object.defineProperty({__proto__:null,shimAudioContext:T_,shimCallbacksAPI:__,shimConstraints:w_,shimCreateOfferLegacy:k_,shimGetUserMedia:C_,shimLocalStreamsAPI:b_,shimRTCIceServerUrls:x_,shimRemoteStreamsAPI:S_,shimTrackEventTransceiver:I_},Symbol.toStringTag,{value:"Module"}));var Yp={exports:{}},k1;function rO(){return k1||(k1=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(`
225
225
  `).map(r=>r.trim())},e.splitSections=function(n){return n.split(`
226
226
  m=`).map((s,a)=>(a>0?"m="+s:s).trim()+`\r
227
227
  `)},e.getDescription=function(n){const r=e.splitSections(n);return r&&r[0]},e.getMediaSections=function(n){const r=e.splitSections(n);return r.shift(),r},e.matchPrefix=function(n,r){return e.splitLines(n).filter(s=>s.indexOf(r)===0)},e.parseCandidate=function(n){let r;n.indexOf("a=candidate:")===0?r=n.substring(12).split(" "):r=n.substring(10).split(" ");const s={foundation:r[0],component:{1:"rtp",2:"rtcp"}[r[1]]||r[1],protocol:r[2].toLowerCase(),priority:parseInt(r[3],10),ip:r[4],address:r[4],port:parseInt(r[5],10),type:r[7]};for(let a=8;a<r.length;a+=2)switch(r[a]){case"raddr":s.relatedAddress=r[a+1];break;case"rport":s.relatedPort=parseInt(r[a+1],10);break;case"tcptype":s.tcpType=r[a+1];break;case"ufrag":s.ufrag=r[a+1],s.usernameFragment=r[a+1];break;default:s[r[a]]===void 0&&(s[r[a]]=r[a+1]);break}return s},e.writeCandidate=function(n){const r=[];r.push(n.foundation);const s=n.component;s==="rtp"?r.push(1):s==="rtcp"?r.push(2):r.push(s),r.push(n.protocol.toUpperCase()),r.push(n.priority),r.push(n.address||n.ip),r.push(n.port);const a=n.type;return r.push("typ"),r.push(a),a!=="host"&&n.relatedAddress&&n.relatedPort&&(r.push("raddr"),r.push(n.relatedAddress),r.push("rport"),r.push(n.relatedPort)),n.tcpType&&n.protocol.toLowerCase()==="tcp"&&(r.push("tcptype"),r.push(n.tcpType)),(n.usernameFragment||n.ufrag)&&(r.push("ufrag"),r.push(n.usernameFragment||n.ufrag)),"candidate:"+r.join(" ")},e.parseIceOptions=function(n){return n.substring(14).split(" ")},e.parseRtpMap=function(n){let r=n.substring(9).split(" ");const s={payloadType:parseInt(r.shift(),10)};return r=r[0].split("/"),s.name=r[0],s.clockRate=parseInt(r[1],10),s.channels=r.length===3?parseInt(r[2],10):1,s.numChannels=s.channels,s},e.writeRtpMap=function(n){let r=n.payloadType;n.preferredPayloadType!==void 0&&(r=n.preferredPayloadType);const s=n.channels||n.numChannels||1;return"a=rtpmap:"+r+" "+n.name+"/"+n.clockRate+(s!==1?"/"+s:"")+`\r
@@ -6,7 +6,7 @@
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1" />
7
7
  <meta name="theme-color" content="#000000" />
8
8
  <meta name="description" content="Streamlit WebRTC Component" />
9
- <script type="module" crossorigin src="./assets/index-D0wGDB0z.js"></script>
9
+ <script type="module" crossorigin src="./assets/index-DV2u3ooX.js"></script>
10
10
  </head>
11
11
  <body>
12
12
  <noscript>You need to enable JavaScript to run this app.</noscript>
@@ -106,6 +106,7 @@ async def _process_offer_coro(
106
106
  sendback_video: bool,
107
107
  sendback_audio: bool,
108
108
  on_track_created: Callable[[TrackType, MediaStreamTrack], None],
109
+ remote_description_set_event: asyncio.Event,
109
110
  ):
110
111
  AudioTrack = AsyncAudioProcessTrack if async_processing else AudioProcessTrack
111
112
  VideoTrack = AsyncVideoProcessTrack if async_processing else VideoProcessTrack
@@ -256,6 +257,8 @@ async def _process_offer_coro(
256
257
  await in_recorder.stop()
257
258
 
258
259
  await pc.setRemoteDescription(offer)
260
+ remote_description_set_event.set()
261
+
259
262
  if mode == WebRtcMode.RECVONLY:
260
263
  for t in pc.getTransceivers():
261
264
  output_track: Optional[MediaStreamTrack] = None
@@ -380,6 +383,7 @@ class WebRtcWorker(Generic[VideoProcessorT, AudioProcessorT]):
380
383
  ) -> None:
381
384
  self._process_offer_thread: Union[threading.Thread, None] = None
382
385
  self.pc = RTCPeerConnection(rtc_configuration)
386
+ self._remote_description_set: asyncio.Event = asyncio.Event()
383
387
  self._answer_queue: queue.Queue = queue.Queue()
384
388
 
385
389
  self.mode = mode
@@ -559,6 +563,7 @@ class WebRtcWorker(Generic[VideoProcessorT, AudioProcessorT]):
559
563
  sendback_video=self.sendback_video,
560
564
  sendback_audio=self.sendback_audio,
561
565
  on_track_created=on_track_created,
566
+ remote_description_set_event=self._remote_description_set,
562
567
  ),
563
568
  loop=loop,
564
569
  )
@@ -618,13 +623,23 @@ class WebRtcWorker(Generic[VideoProcessorT, AudioProcessorT]):
618
623
  candidate.sdpMLineIndex = candidate_dict.get("sdpMLineIndex")
619
624
  # candidate.usernameFragment = candidate_dict.get("usernameFragment")
620
625
 
621
- self.add_ice_candidate_from_offerer(candidate)
626
+ self.add_ice_candidate(candidate)
622
627
  self._added_ice_candidate_ids.add(candidate_id)
623
628
 
624
- def add_ice_candidate_from_offerer(self, candidate: RTCIceCandidate):
625
- logger.info("Adding ICE candidate from offerer: %s", candidate)
629
+ def add_ice_candidate(self, candidate: RTCIceCandidate):
630
+ logger.info("Adding ICE candidate: %s", candidate)
626
631
  loop = get_global_event_loop()
627
- asyncio.run_coroutine_threadsafe(self.pc.addIceCandidate(candidate), loop=loop)
632
+ asyncio.run_coroutine_threadsafe(self._add_ice_candidate(candidate), loop=loop)
633
+
634
+ async def _add_ice_candidate(self, candidate: RTCIceCandidate):
635
+ # Wait until `setRemoteDescription` is called which sets up the transceiver
636
+ # that `addIceCandidate` will add an ICE candidate to.
637
+ try:
638
+ await asyncio.wait_for(self._remote_description_set.wait(), timeout=10)
639
+ except asyncio.TimeoutError:
640
+ logger.error("Timeout while waiting for the remote description to be set.")
641
+ raise
642
+ await self.pc.addIceCandidate(candidate)
628
643
 
629
644
  def update_video_callbacks(
630
645
  self,
@@ -1,15 +1,16 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: streamlit-webrtc
3
- Version: 0.57.0
3
+ Version: 0.60.0
4
4
  Summary: Real-time video and audio processing on Streamlit
5
5
  Project-URL: Repository, https://github.com/whitphx/streamlit-webrtc
6
6
  Author-email: "Yuichiro Tachibana (Tsuchiya)" <t.yic.yt@gmail.com>
7
7
  License-Expression: MIT
8
8
  License-File: LICENSE
9
9
  Requires-Python: !=3.9.7,>=3.9
10
+ Requires-Dist: aioice>=0.9.0
10
11
  Requires-Dist: aiortc>=1.11.0
11
12
  Requires-Dist: packaging>=20.0
12
- Requires-Dist: streamlit>=0.84.1
13
+ Requires-Dist: streamlit>=0.89.0
13
14
  Description-Content-Type: text/markdown
14
15
 
15
16
  # streamlit-webrtc
@@ -1,9 +1,9 @@
1
1
  streamlit_webrtc/__init__.py,sha256=jMWwXoQ9hVyYXPD4Vrps7MyiR9goyC-n7LtkZNFBOxU,2273
2
- streamlit_webrtc/_compat.py,sha256=YQdkF6Qsl_1WO_HIS4tydx2L0jNB3H0C7YnvWDS9mmA,4188
2
+ streamlit_webrtc/_compat.py,sha256=AVRcUGdgWDQcCE7-ufhGr6Hb5P6EHLgejUAA72ArJmg,4384
3
3
  streamlit_webrtc/component.py,sha256=1RHnnoGdWkEoKUWyvVTMe-oAa0h0kF93y29jNn_jg9M,26378
4
4
  streamlit_webrtc/components_callbacks.py,sha256=tdrj2TlV8qcexFEdjm4PVkz8JwHffo4A8imoXOtjNHA,2401
5
5
  streamlit_webrtc/config.py,sha256=yKFIVjIoX2F62_G2qcDrNYm2Qe_qx1E9E0YqAnAibMo,5544
6
- streamlit_webrtc/credentials.py,sha256=5T8qXq1pVmXYbEOt6jNGM9rRAe0PhkZth7CQeosPn7g,4252
6
+ streamlit_webrtc/credentials.py,sha256=3IOk7w1JLQ2Qs6XFP9dxsF81lpjLL2kdRe2ZIhHvaj4,4562
7
7
  streamlit_webrtc/eventloop.py,sha256=AFmxGlRRxVdl0cTS9pKpRZR2Mnq6v6DgudVZZ425IVw,1333
8
8
  streamlit_webrtc/factory.py,sha256=T35kCwNU8Vm4KL6KJ5HbNVtaouNw13Ilew49XSnm6X8,6820
9
9
  streamlit_webrtc/mix.py,sha256=Uh9gJviP3VLxwBQ-i3RftJ8GQ5qDPGqJKgm2M-vQYo4,8775
@@ -16,10 +16,10 @@ streamlit_webrtc/server.py,sha256=5o9E2MRIPoS18lfGPJkyhbd23RWyTwblNVVuAA2kKrA,14
16
16
  streamlit_webrtc/session_info.py,sha256=V1EdzD2I8dWANXdC84EKSz8XgPM-zugtkYsb4hJm8Qo,2313
17
17
  streamlit_webrtc/shutdown.py,sha256=PUjMoNZcTRGzZCooCmjWARpeVs5EG_9JXAf1Iay7dBM,2353
18
18
  streamlit_webrtc/source.py,sha256=haPqMZ50Xh8tg7Z1yN8Frfk8v7D3oOuKteaD59asbzs,2263
19
- streamlit_webrtc/webrtc.py,sha256=G-QdeKyDEuV_kliA6yjL9LW-6ZLNcjphQoByPQTCjxk,28706
20
- streamlit_webrtc/frontend/dist/index.html,sha256=IOj27wnMH6-vS7cwR6NJVj0zbv-e2i_Q7zpGRwnBS00,527
21
- streamlit_webrtc/frontend/dist/assets/index-D0wGDB0z.js,sha256=P4XZoEO7AnXSSI3Qyb8xEV___KJaiq7kBlqJlGJdPfg,584027
22
- streamlit_webrtc-0.57.0.dist-info/METADATA,sha256=e_Jm5utxj5ZmM_GDLeUANUlhkYKgoj5u1nU6Cw1do_E,18641
23
- streamlit_webrtc-0.57.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
24
- streamlit_webrtc-0.57.0.dist-info/licenses/LICENSE,sha256=pwccNHVA7r4rYofGlMU10aKEU90GLUlQr8uY80PR0NQ,1081
25
- streamlit_webrtc-0.57.0.dist-info/RECORD,,
19
+ streamlit_webrtc/webrtc.py,sha256=etDct0ONUDe-A02tv1la2VV2eqViafwuk3JPy1gALsk,29406
20
+ streamlit_webrtc/frontend/dist/index.html,sha256=Iw2ulM_HTlCdchAUJLCBiZQk6FboupXx3g-5Zf4MrUQ,527
21
+ streamlit_webrtc/frontend/dist/assets/index-DV2u3ooX.js,sha256=HpCe_touce0s9XRRQEB9PvmcIz5705ePMym6FB8sLFg,583792
22
+ streamlit_webrtc-0.60.0.dist-info/METADATA,sha256=4_ZLBC8eJWAgyEZFV4B0KZFjkfOyaHuTPFM9NEFSGx8,18670
23
+ streamlit_webrtc-0.60.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
24
+ streamlit_webrtc-0.60.0.dist-info/licenses/LICENSE,sha256=pwccNHVA7r4rYofGlMU10aKEU90GLUlQr8uY80PR0NQ,1081
25
+ streamlit_webrtc-0.60.0.dist-info/RECORD,,