@yang__yj/pixelstreaming-core 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("sdp")):"function"==typeof define&&define.amd?define(["sdp"],t):"object"==typeof exports?exports["lib-pixelstreamingfrontend"]=t(require("sdp")):e["lib-pixelstreamingfrontend"]=t(e.sdp)}(this,(e=>(()=>{"use strict";var t={366:t=>{t.exports=e}},s={};function n(e){var r=s[e];if(void 0!==r)return r.exports;var i=s[e]={exports:{}};return t[e](i,i.exports,n),i.exports}n.d=(e,t)=>{for(var s in t)n.o(t,s)&&!n.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{n.r(r),n.d(r,{AfkLogic:()=>Te,AfkTimedOutEvent:()=>A,AfkWarningActivateEvent:()=>k,AfkWarningDeactivateEvent:()=>x,AfkWarningUpdateEvent:()=>L,AggregatedStats:()=>xe,CandidatePairStats:()=>Re,CandidateStat:()=>be,Config:()=>Ce,ControlSchemeType:()=>fe,DataChannelCloseEvent:()=>_,DataChannelErrorEvent:()=>H,DataChannelLatencyTestResponseEvent:()=>te,DataChannelLatencyTestResultEvent:()=>se,DataChannelOpenEvent:()=>B,DataChannelStats:()=>we,EncoderSettings:()=>Be,EventEmitter:()=>de,Flags:()=>ce,HideFreezeFrameEvent:()=>J,InboundAudioStats:()=>ye,InboundVideoStats:()=>Me,InitialSettings:()=>Ue,InitialSettingsEvent:()=>ne,LatencyTestResultEvent:()=>ee,LatencyTestResults:()=>He,LoadFreezeFrameEvent:()=>j,Logger:()=>e,MessageDirection:()=>Oe,MessageRecv:()=>p,MessageSend:()=>i,MessageStreamerList:()=>v,NumericParameters:()=>ge,OptionParameters:()=>pe,OutBoundVideoStats:()=>Pe,PixelStreaming:()=>yt,PlayStreamErrorEvent:()=>q,PlayStreamEvent:()=>$,PlayStreamRejectedEvent:()=>X,PlayerCountEvent:()=>le,SettingBase:()=>M,SettingFlag:()=>w,SettingNumber:()=>b,SettingOption:()=>P,SettingText:()=>R,SettingsChangedEvent:()=>re,SignallingProtocol:()=>C,StatsReceivedEvent:()=>Y,StreamLoadingEvent:()=>V,StreamPreConnectEvent:()=>N,StreamPreDisconnectEvent:()=>K,StreamReconnectEvent:()=>Q,StreamerListMessageEvent:()=>Z,TextParameters:()=>me,UnquantizedAndDenormalizeUnsigned:()=>gt,VideoEncoderAvgQPEvent:()=>F,VideoInitializedEvent:()=>W,WebRTCSettings:()=>_e,WebRtcAutoConnectEvent:()=>O,WebRtcConnectedEvent:()=>G,WebRtcConnectingEvent:()=>I,WebRtcDisconnectedEvent:()=>z,WebRtcFailedEvent:()=>U,WebRtcPlayerController:()=>mt,WebRtcSdpEvent:()=>D,WebSocketController:()=>f,WebXRController:()=>Ct,XrFrameEvent:()=>ae,XrSessionEndedEvent:()=>oe,XrSessionStartedEvent:()=>ie});class e{static GetStackTrace(){const e=new Error;let t="No Stack Available for this browser";return e.stack&&(t=e.stack.toString().replace(/Error/g,"")),t}static SetLoggerVerbosity(e){null!=this.verboseLogLevel&&(this.verboseLogLevel=e)}static Log(e,t,s){if(s>this.verboseLogLevel)return;const n=`Level: Log\nMsg: ${t}\nCaller: ${e}`;console.log(n)}static Info(e,t,s){if(s>this.verboseLogLevel)return;const n=`Level: Info\nMsg: ${t}`;console.info(n)}static Error(e,t){const s=`Level: Error\nMsg: ${t}\nCaller: ${e}`;console.error(s)}static Warning(e,t){const s=`Level: Warning\nCaller: ${e}\nMsg: ${t}`;console.warn(s)}}var t,s;e.verboseLogLevel=5,function(e){e.LIST_STREAMERS="listStreamers",e.SUBSCRIBE="subscribe",e.UNSUBSCRIBE="unsubscribe",e.ICE_CANDIDATE="iceCandidate",e.OFFER="offer",e.ANSWER="answer",e.DATACHANNELREQUEST="dataChannelRequest",e.SFURECVDATACHANNELREADY="peerDataChannelsReady",e.PONG="pong"}(t||(t={}));class i{payload(){return e.Log(e.GetStackTrace(),"Sending => \n"+JSON.stringify(this,void 0,4),6),JSON.stringify(this)}}class o extends i{constructor(){super(),this.type=t.LIST_STREAMERS}}class a extends i{constructor(e){super(),this.type=t.LIST_STREAMERS,this.streamerName=e}}class l extends i{constructor(e){super(),this.type=t.SUBSCRIBE,this.streamerId=e}}class d extends i{constructor(){super(),this.type=t.UNSUBSCRIBE}}class c extends i{constructor(e){super(),this.type=t.PONG,this.time=e}}class h extends i{constructor(e){super(),this.type=t.OFFER,e&&(this.type=e.type,this.sdp=e.sdp)}}class g extends i{constructor(e){super(),this.type=t.ANSWER,e&&(this.type=e.type,this.sdp=e.sdp)}}class u extends i{constructor(){super(),this.type=t.DATACHANNELREQUEST}}class m extends i{constructor(){super(),this.type=t.SFURECVDATACHANNELREADY}}class S{constructor(e){this.type=t.ICE_CANDIDATE,this.candidate=e}payload(){return e.Log(e.GetStackTrace(),"Sending => \n"+JSON.stringify(this,void 0,4),6),JSON.stringify(this)}}!function(e){e.CONFIG="config",e.STREAMER_LIST="streamerList",e.PLAYER_COUNT="playerCount",e.OFFER="offer",e.ANSWER="answer",e.ICE_CANDIDATE="iceCandidate",e.PEER_DATA_CHANNELS="peerDataChannels",e.PING="ping",e.WARNING="warning"}(s||(s={}));class p{}class v extends p{}class C{constructor(){this.FromUEMessageHandlers=new Map}addMessageHandler(e,t){this.FromUEMessageHandlers.set(e,t)}handleMessage(t,s){this.FromUEMessageHandlers.has(t)?this.FromUEMessageHandlers.get(t)(s):e.Error(e.GetStackTrace(),`Message type of ${t} does not have a message handler registered on the frontend - ignoring message.`)}static setupDefaultHandlers(t){t.signallingProtocol.addMessageHandler(s.PING,(n=>{const r=new c((new Date).getTime()).payload();e.Log(e.GetStackTrace(),s.PING+": "+n,6),t.webSocket.send(r)})),t.signallingProtocol.addMessageHandler(s.CONFIG,(n=>{e.Log(e.GetStackTrace(),s.CONFIG,6);const r=JSON.parse(n);t.onConfig(r)})),t.signallingProtocol.addMessageHandler(s.STREAMER_LIST,(n=>{e.Log(e.GetStackTrace(),s.STREAMER_LIST,6);const r=JSON.parse(n);t.onStreamerList(r)})),t.signallingProtocol.addMessageHandler(s.PLAYER_COUNT,(n=>{e.Log(e.GetStackTrace(),s.PLAYER_COUNT,6);const r=JSON.parse(n);e.Log(e.GetStackTrace(),"Player Count: "+r.count,6),t.onPlayerCount(r)})),t.signallingProtocol.addMessageHandler(s.ANSWER,(n=>{e.Log(e.GetStackTrace(),s.ANSWER,6);const r=JSON.parse(n);t.onWebRtcAnswer(r)})),t.signallingProtocol.addMessageHandler(s.OFFER,(n=>{e.Log(e.GetStackTrace(),s.OFFER,6);const r=JSON.parse(n);t.onWebRtcOffer(r)})),t.signallingProtocol.addMessageHandler(s.ICE_CANDIDATE,(n=>{e.Log(e.GetStackTrace(),s.ICE_CANDIDATE,6);const r=JSON.parse(n);t.onIceCandidate(r.candidate)})),t.signallingProtocol.addMessageHandler(s.WARNING,(t=>{e.Warning(e.GetStackTrace(),`Warning received: ${t}`)})),t.signallingProtocol.addMessageHandler(s.PEER_DATA_CHANNELS,(n=>{e.Log(e.GetStackTrace(),s.PEER_DATA_CHANNELS,6);const r=JSON.parse(n);t.onWebRtcPeerDataChannels(r)}))}}class f{constructor(){this.WS_OPEN_STATE=1,this.onOpen=new EventTarget,this.onClose=new EventTarget,this.signallingProtocol=new C,C.setupDefaultHandlers(this)}connect(t){e.Log(e.GetStackTrace(),t,6);try{return this.webSocket=new WebSocket(t),this.webSocket.onopen=e=>this.handleOnOpen(e),this.webSocket.onerror=()=>this.handleOnError(),this.webSocket.onclose=e=>this.handleOnClose(e),this.webSocket.onmessage=e=>this.handleOnMessage(e),this.webSocket.onmessagebinary=e=>this.handleOnMessageBinary(e),!0}catch(t){return e.Error(t,t),!1}}handleOnMessageBinary(t){t&&t.data&&t.data.text().then((e=>{const t=new MessageEvent("messageFromBinary",{data:e});this.handleOnMessage(t)})).catch((t=>{e.Error(e.GetStackTrace(),`从websocket解析二进制blob失败,原因: ${t}`)}))}handleOnMessage(t){if(t.data&&t.data instanceof Blob)return void this.handleOnMessageBinary(t);const s=JSON.parse(t.data);e.Log(e.GetStackTrace(),"received => \n"+JSON.stringify(JSON.parse(t.data),void 0,4),6),this.signallingProtocol.handleMessage(s.type,t.data)}handleOnOpen(t){e.Log(e.GetStackTrace(),"通过WebSocket连接到信令服务器",6),this.onOpen.dispatchEvent(new Event("open"))}handleOnError(){e.Error(e.GetStackTrace(),"WebSocket error")}handleOnClose(t){console.log(t),e.Log(e.GetStackTrace(),"通过WebSocket与信令服务器断开连接: "+JSON.stringify(t.code)+" - "+t.reason),4004==t.code&&(this.onOpen.dispatchEvent(new Event("close",t)),this.onClose.dispatchEvent(new CustomEvent("close",{detail:t})))}requestStreamerList(){const e=new o;this.webSocket.send(e.payload())}requestStreamerObject(e){const t=new a(e);this.webSocket.send(t.payload())}sendSubscribe(e){const t=new l(e);this.webSocket.send(t.payload())}sendUnsubscribe(){const e=new d;this.webSocket.send(e.payload())}sendWebRtcOffer(e){const t=new h(e);this.webSocket.send(t.payload())}sendWebRtcAnswer(e){const t=new g(e);this.webSocket.send(t.payload())}sendWebRtcDatachannelRequest(){const e=new u;this.webSocket.send(e.payload())}sendSFURecvDataChannelReady(){const e=new m;this.webSocket.send(e.payload())}sendIceCandidate(t){if(e.Log(e.GetStackTrace(),"Sending Ice Candidate(发送Ice候选人)"),this.webSocket&&this.webSocket.readyState===this.WS_OPEN_STATE){const e=new S(t);this.webSocket.send(e.payload())}}close(){var e;null===(e=this.webSocket)||void 0===e||e.close()}onConfig(e){}onStreamerList(e){}onIceCandidate(e){}onWebRtcAnswer(e){}onWebRtcOffer(e){}onWebRtcPeerDataChannels(e){}onPlayerCount(e){}}class T{constructor(e){this.videoElementProvider=e,this.audioElement=document.createElement("Audio"),this.videoElementProvider.setAudioElement(this.audioElement)}handleOnTrack(t){e.Log(e.GetStackTrace(),"handleOnTrack "+JSON.stringify(t.streams),6);const s=this.videoElementProvider.getVideoElement();if(t.track&&e.Log(e.GetStackTrace(),"Got track - "+t.track.kind+" id="+t.track.id+" readyState="+t.track.readyState,6),"audio"!=t.track.kind)return"video"==t.track.kind&&s.srcObject!==t.streams[0]?(s.srcObject=t.streams[0],void e.Log(e.GetStackTrace(),"Set video source from video track ontrack.")):void 0;this.CreateAudioTrack(t.streams[0])}CreateAudioTrack(t){const s=this.videoElementProvider.getVideoElement();s.srcObject!=t&&s.srcObject&&s.srcObject!==t&&(this.audioElement.srcObject=t,e.Log(e.GetStackTrace(),"Created new audio element to play separate audio stream."))}}class E{constructor(e){this.freezeFrameHeight=0,this.freezeFrameWidth=0,this.rootDiv=e,this.rootElement=document.createElement("div"),this.rootElement.id="freezeFrame",this.rootElement.style.display="none",this.rootElement.style.pointerEvents="none",this.rootElement.style.position="absolute",this.rootElement.style.zIndex="20",this.imageElement=document.createElement("img"),this.imageElement.style.position="absolute",this.rootElement.appendChild(this.imageElement),this.rootDiv.appendChild(this.rootElement)}setElementForShow(){this.rootElement.style.display="block"}setElementForHide(){this.rootElement.style.display="none"}updateImageElementSource(e){const t=btoa(e.reduce(((e,t)=>e+String.fromCharCode(t)),""));this.imageElement.src="data:image/jpeg;base64,"+t}setDimensionsFromElementAndResize(){this.freezeFrameHeight=this.imageElement.naturalHeight,this.freezeFrameWidth=this.imageElement.naturalWidth,this.resize()}resize(){if(0!==this.freezeFrameWidth&&0!==this.freezeFrameHeight){let e=0,t=0,s=0,n=0;const r=this.rootDiv.clientWidth/this.rootDiv.clientHeight,i=this.freezeFrameWidth/this.freezeFrameHeight;r<i?(e=this.rootDiv.clientWidth,t=Math.floor(this.rootDiv.clientWidth/i),s=Math.floor(.5*(this.rootDiv.clientHeight-t)),n=0):(e=Math.floor(this.rootDiv.clientHeight*i),t=this.rootDiv.clientHeight,s=0,n=Math.floor(.5*(this.rootDiv.clientWidth-e))),this.rootElement.style.width=this.rootDiv.offsetWidth+"px",this.rootElement.style.height=this.rootDiv.offsetHeight+"px",this.rootElement.style.left="0px",this.rootElement.style.top="0px",this.imageElement.style.width=e+"px",this.imageElement.style.height=t+"px",this.imageElement.style.left=n+"px",this.imageElement.style.top=s+"px"}}}class y{constructor(e){this.receiving=!1,this.size=0,this.jpeg=void 0,this.valid=!1,this.freezeFrameDelay=50,this.freezeFrame=new E(e)}showFreezeFrame(){this.valid&&this.freezeFrame.setElementForShow()}hideFreezeFrame(){this.valid=!1,this.freezeFrame.setElementForHide()}updateFreezeFrameAndShow(e,t){this.freezeFrame.updateImageElementSource(e),this.freezeFrame.imageElement.onload=()=>{this.freezeFrame.setDimensionsFromElementAndResize(),t()}}processFreezeFrameMessage(t,s){this.receiving||(this.receiving=!0,this.valid=!1,this.size=0,this.jpeg=void 0),this.size=new DataView(t.slice(1,5).buffer).getInt32(0,!0);const n=t.slice(5);if(this.jpeg){const e=new Uint8Array(this.jpeg.length+n.length);e.set(this.jpeg,0),e.set(n,this.jpeg.length),this.jpeg=e}else this.jpeg=n,this.receiving=!0,e.Log(e.GetStackTrace(),`received first chunk of freeze frame: ${this.jpeg.length}/${this.size}`,6);this.jpeg.length===this.size?(this.receiving=!1,this.valid=!0,e.Log(e.GetStackTrace(),`received complete freeze frame ${this.size}`,6),this.updateFreezeFrameAndShow(this.jpeg,s)):this.jpeg.length>this.size&&(e.Error(e.GetStackTrace(),`received bigger freeze frame than advertised: ${this.jpeg.length}/${this.size}`),this.jpeg=void 0,this.receiving=!1)}}class M{constructor(e,t,s,n,r=(()=>{})){this.onChange=r,this.onChangeEmit=()=>{},this.id=e,this.description=s,this.label=t,this.value=n}set label(e){this._label=e,this.onChangeEmit(this._value)}get label(){return this._label}get value(){return this._value}set value(e){this._value=e,this.onChange(this._value,this),this.onChangeEmit(this._value)}}class w extends M{constructor(e,t,s,n,r,i=(()=>{})){super(e,t,s,n,i);const o=new URLSearchParams(window.location.search);if(r&&o.has(this.id)){const e=this.getUrlParamFlag();this.flag=e}else this.flag=n;this.useUrlParams=r}getUrlParamFlag(){const e=new URLSearchParams(window.location.search);return!!e.has(this.id)&&"false"!==e.get(this.id)&&"False"!==e.get(this.id)}updateURLParams(){if(this.useUrlParams){const e=new URLSearchParams(window.location.search);!0===this.flag?e.set(this.id,"true"):e.set(this.id,"false"),window.history.replaceState({},"",""!==e.toString()?`${location.pathname}?${e}`:`${location.pathname}`)}}enable(){this.flag=!0}get flag(){return!!this.value}set flag(e){this.value=e}}class b extends M{constructor(e,t,s,n,r,i,o,a=(()=>{})){super(e,t,s,i,a),this._min=n,this._max=r;const l=new URLSearchParams(window.location.search);if(o&&l.has(this.id)){const e=Number.parseInt(l.get(this.id));this.number=Number.isNaN(e)?i:e}else this.number=i;this.useUrlParams=o}updateURLParams(){if(this.useUrlParams){const e=new URLSearchParams(window.location.search);e.set(this.id,this.number.toString()),window.history.replaceState({},"",""!==e.toString()?`${location.pathname}?${e}`:`${location.pathname}`)}}set number(e){this.value=this.clamp(e)}get number(){return this.value}clamp(e){return Math.max(Math.min(this._max,e),this._min)}get min(){return this._min}get max(){return this._max}addOnChangedListener(e){this.onChange=e}}class R extends M{constructor(e,t,s,n,r,i=(()=>{})){super(e,t,s,n,i);const o=new URLSearchParams(window.location.search);if(r&&o.has(this.id)){const e=this.getUrlParamText();this.text=e}else this.text=n;this.useUrlParams=r}getUrlParamText(){var e;const t=new URLSearchParams(window.location.search);return t.has(this.id)&&null!==(e=t.get(this.id))&&void 0!==e?e:""}updateURLParams(){if(this.useUrlParams){const e=new URLSearchParams(window.location.search);e.set(this.id,this.text),window.history.replaceState({},"",""!==e.toString()?`${location.pathname}?${e}`:`${location.pathname}`)}}get text(){return this.value}set text(e){this.value=e}}class P extends M{constructor(e,t,s,n,r,i,o=(()=>{})){super(e,t,s,[n,n],o),this.options=r;const a=new URLSearchParams(window.location.search),l=i&&a.has(this.id)?this.getUrlParamText():n;this.selected=l,this.useUrlParams=i}getUrlParamText(){var e;const t=new URLSearchParams(window.location.search);return t.has(this.id)&&null!==(e=t.get(this.id))&&void 0!==e?e:""}updateURLParams(){if(this.useUrlParams){const e=new URLSearchParams(window.location.search);e.set(this.id,this.selected),window.history.replaceState({},"",""!==e.toString()?`${location.pathname}?${e}`:`${location.pathname}`)}}addOnChangedListener(e){this.onChange=e}get options(){return this._options}set options(e){this._options=e,this.onChangeEmit(this.selected)}get selected(){return this.value}set selected(e){let t=this.options.filter((t=>-1!==t.indexOf(e)));t.length?this.value=t[0]:(t=this.options.filter((t=>-1!==t.indexOf(e.split(" ")[0]))),t.length&&(this.value=t[0]))}}class k extends Event{constructor(e){super("afkWarningActivate"),this.data=e}}class L extends Event{constructor(e){super("afkWarningUpdate"),this.data=e}}class x extends Event{constructor(){super("afkWarningDeactivate")}}class A extends Event{constructor(){super("afkTimedOut")}}class F extends Event{constructor(e){super("videoEncoderAvgQP"),this.data=e}}class D extends Event{constructor(){super("webRtcSdp")}}class O extends Event{constructor(){super("webRtcAutoConnect")}}class I extends Event{constructor(){super("webRtcConnecting")}}class G extends Event{constructor(){super("webRtcConnected")}}class U extends Event{constructor(){super("webRtcFailed")}}class z extends Event{constructor(e){super("webRtcDisconnected"),this.data=e}}class B extends Event{constructor(e){super("dataChannelOpen"),this.data=e}}class _ extends Event{constructor(e){super("dataChannelClose"),this.data=e}}class H extends Event{constructor(e){super("dataChannelError"),this.data=e}}class W extends Event{constructor(){super("videoInitialized")}}class V extends Event{constructor(){super("streamLoading")}}class N extends Event{constructor(){super("streamConnect")}}class K extends Event{constructor(){super("streamDisconnect")}}class Q extends Event{constructor(){super("streamReconnect")}}class q extends Event{constructor(e){super("playStreamError"),this.data=e}}class $ extends Event{constructor(){super("playStream")}}class X extends Event{constructor(e){super("playStreamRejected"),this.data=e}}class j extends Event{constructor(e){super("loadFreezeFrame"),this.data=e}}class J extends Event{constructor(){super("hideFreezeFrame")}}class Y extends Event{constructor(e){super("statsReceived"),this.data=e}}class Z extends Event{constructor(e){super("streamerListMessage"),this.data=e}}class ee extends Event{constructor(e){super("latencyTestResult"),this.data=e}}class te extends Event{constructor(e){super("dataChannelLatencyTestResponse"),this.data=e}}class se extends Event{constructor(e){super("dataChannelLatencyTestResult"),this.data=e}}class ne extends Event{constructor(e){super("initialSettings"),this.data=e}}class re extends Event{constructor(e){super("settingsChanged"),this.data=e}}class ie extends Event{constructor(){super("xrSessionStarted")}}class oe extends Event{constructor(){super("xrSessionEnded")}}class ae extends Event{constructor(e){super("xrFrame"),this.data=e}}class le extends Event{constructor(e){super("playerCount"),this.data=e}}class de extends EventTarget{dispatchEvent(e){return super.dispatchEvent(e)}addEventListener(e,t){super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}}class ce{}ce.AutoConnect="AutoConnect",ce.AutoPlayVideo="AutoPlayVideo",ce.AFKDetection="TimeoutIfIdle",ce.BrowserSendOffer="OfferToReceive",ce.HoveringMouseMode="HoveringMouse",ce.ForceMonoAudio="ForceMonoAudio",ce.ForceTURN="ForceTURN",ce.FakeMouseWithTouches="FakeMouseWithTouches",ce.IsQualityController="ControlsQuality",ce.MatchViewportResolution="MatchViewportRes",ce.StartVideoMuted="StartVideoMuted",ce.SuppressBrowserKeys="SuppressBrowserKeys",ce.UseMic="UseMic",ce.KeyboardInput="KeyboardInput",ce.MouseInput="MouseInput",ce.TouchInput="TouchInput",ce.GamepadInput="GamepadInput",ce.XRControllerInput="XRControllerInput",ce.WaitForStreamer="WaitForStreamer";const he=e=>Object.getOwnPropertyNames(ce).some((t=>ce[t]===e));class ge{}ge.AFKTimeoutSecs="AFKTimeout",ge.MinQP="MinQP",ge.MaxQP="MaxQP",ge.WebRTCFPS="WebRTCFPS",ge.WebRTCMinBitrate="WebRTCMinBitrate",ge.WebRTCMaxBitrate="WebRTCMaxBitrate",ge.MaxReconnectAttempts="MaxReconnectAttempts",ge.StreamerAutoJoinInterval="StreamerAutoJoinInterval";const ue=e=>Object.getOwnPropertyNames(ge).some((t=>ge[t]===e));class me{}me.SignallingServerUrl="ss";const Se=e=>Object.getOwnPropertyNames(me).some((t=>me[t]===e));class pe{}pe.PreferredCodec="PreferredCodec",pe.StreamerId="StreamerId";const ve=e=>Object.getOwnPropertyNames(pe).some((t=>pe[t]===e));class Ce{constructor(e={}){this.flags=new Map,this.numericParameters=new Map,this.textParameters=new Map,this.optionParameters=new Map;const{initialSettings:t,useUrlParams:s}=e;this._useUrlParams=!!s,this.populateDefaultSettings(this._useUrlParams),t&&this.setSettings(t)}get useUrlParams(){return this._useUrlParams}populateDefaultSettings(e){this.textParameters.set(me.SignallingServerUrl,new R(me.SignallingServerUrl,"Signalling url","Url of the signalling server",("https:"===location.protocol?"wss://":"ws://")+window.location.hostname+("80"===window.location.port||""===window.location.port?"":`:${window.location.port}`),e)),this.optionParameters.set(pe.StreamerId,new P(pe.StreamerId,"Streamer ID","The ID of the streamer to stream.","",[],e)),this.optionParameters.set(pe.PreferredCodec,new P(pe.PreferredCodec,"Preferred Codec","The preferred codec to be used during codec negotiation","H264 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f",function(){const e=[];if(!RTCRtpReceiver.getCapabilities)return e.push("Only available on Chrome"),e;const t=/(VP\d|H26\d|AV1).*/;return RTCRtpReceiver.getCapabilities("video").codecs.forEach((s=>{const n=s.mimeType.split("/")[1]+" "+(s.sdpFmtpLine||"");null!==t.exec(n)&&e.push(n)})),e}(),e)),this.flags.set(ce.AutoConnect,new w(ce.AutoConnect,"Auto connect to stream","Whether we should attempt to auto connect to the signalling server or show a click to start prompt.",!1,e)),this.flags.set(ce.AutoPlayVideo,new w(ce.AutoPlayVideo,"Auto play video","When video is ready automatically start playing it as opposed to showing a play button.",!0,e)),this.flags.set(ce.BrowserSendOffer,new w(ce.BrowserSendOffer,"Browser send offer","Browser will initiate the WebRTC handshake by sending the offer to the streamer",!1,e)),this.flags.set(ce.UseMic,new w(ce.UseMic,"Use microphone","Make browser request microphone access and open an input audio track.",!1,e)),this.flags.set(ce.StartVideoMuted,new w(ce.StartVideoMuted,"Start video muted","Video will start muted if true.",!1,e)),this.flags.set(ce.SuppressBrowserKeys,new w(ce.SuppressBrowserKeys,"Suppress browser keys","Suppress certain browser keys that we use in UE, for example F5 to show shader complexity instead of refresh the page.",!0,e)),this.flags.set(ce.IsQualityController,new w(ce.IsQualityController,"Is quality controller?","True if this peer controls stream quality",!0,e)),this.flags.set(ce.ForceMonoAudio,new w(ce.ForceMonoAudio,"Force mono audio","Force browser to request mono audio in the SDP",!1,e)),this.flags.set(ce.ForceTURN,new w(ce.ForceTURN,"Force TURN","Only generate TURN/Relayed ICE candidates.",!1,e)),this.flags.set(ce.AFKDetection,new w(ce.AFKDetection,"AFK if idle","Timeout the experience if user is AFK for a period.",!1,e)),this.flags.set(ce.MatchViewportResolution,new w(ce.MatchViewportResolution,"Match viewport resolution","Pixel Streaming will be instructed to dynamically resize the video stream to match the size of the video element.",!1,e)),this.flags.set(ce.HoveringMouseMode,new w(ce.HoveringMouseMode,"Control Scheme: Locked Mouse","Either locked mouse, where the pointer is consumed by the video and locked to it, or hovering mouse, where the mouse is not consumed.",!1,e,((e,t)=>{t.label=`Control Scheme: ${e?"Hovering":"Locked"} Mouse`}))),this.flags.set(ce.FakeMouseWithTouches,new w(ce.FakeMouseWithTouches,"Fake mouse with touches","A single finger touch is converted into a mouse event. This allows a non-touch application to be controlled partially via a touch device.",!1,e)),this.flags.set(ce.KeyboardInput,new w(ce.KeyboardInput,"Keyboard input","If enabled, send keyboard events to streamer",!0,e)),this.flags.set(ce.MouseInput,new w(ce.MouseInput,"Mouse input","If enabled, send mouse events to streamer",!0,e)),this.flags.set(ce.TouchInput,new w(ce.TouchInput,"Touch input","If enabled, send touch events to streamer",!0,e)),this.flags.set(ce.GamepadInput,new w(ce.GamepadInput,"Gamepad input","If enabled, send gamepad events to streamer",!0,e)),this.flags.set(ce.XRControllerInput,new w(ce.XRControllerInput,"XR controller input","If enabled, send XR controller events to streamer",!0,e)),this.flags.set(ce.WaitForStreamer,new w(ce.WaitForStreamer,"等待拖缆","将继续尝试连接到第一个可用的流媒体.",!0,e)),this.numericParameters.set(ge.AFKTimeoutSecs,new b(ge.AFKTimeoutSecs,"AFK timeout","The time (in seconds) it takes for the application to time out if AFK timeout is enabled.",0,600,120,e)),this.numericParameters.set(ge.MaxReconnectAttempts,new b(ge.MaxReconnectAttempts,"Max Reconnects","Maximum number of reconnects the application will attempt when a streamer disconnects.",0,999,3,e)),this.numericParameters.set(ge.MinQP,new b(ge.MinQP,"Min QP","The lower bound for the quantization parameter (QP) of the encoder. 0 = Best quality, 51 = worst quality.",0,51,0,e)),this.numericParameters.set(ge.MaxQP,new b(ge.MaxQP,"Max QP","The upper bound for the quantization parameter (QP) of the encoder. 0 = Best quality, 51 = worst quality.",0,51,51,e)),this.numericParameters.set(ge.WebRTCFPS,new b(ge.WebRTCFPS,"Max FPS","The maximum FPS that WebRTC will try to transmit frames at.",1,999,60,e)),this.numericParameters.set(ge.WebRTCMinBitrate,new b(ge.WebRTCMinBitrate,"Min Bitrate (kbps)","The minimum bitrate that WebRTC should use.",0,5e5,0,e)),this.numericParameters.set(ge.WebRTCMaxBitrate,new b(ge.WebRTCMaxBitrate,"Max Bitrate (kbps)","The maximum bitrate that WebRTC should use.",0,5e5,0,e)),this.numericParameters.set(ge.StreamerAutoJoinInterval,new b(ge.StreamerAutoJoinInterval,"Streamer Auto Join Interval (ms)","Delay between retries when waiting for an available streamer.",500,9e5,3e3,e))}_addOnNumericSettingChangedListener(e,t){this.numericParameters.has(e)&&this.numericParameters.get(e).addOnChangedListener(t)}_addOnOptionSettingChangedListener(e,t){this.optionParameters.has(e)&&this.optionParameters.get(e).addOnChangedListener(t)}getNumericSettingValue(e){if(this.numericParameters.has(e))return this.numericParameters.get(e).number;throw new Error(`There is no numeric setting with the id of ${e}`)}getTextSettingValue(e){if(this.textParameters.has(e))return this.textParameters.get(e).value;throw new Error(`There is no numeric setting with the id of ${e}`)}setNumericSetting(e,t){if(!this.numericParameters.has(e))throw new Error(`There is no numeric setting with the id of ${e}`);this.numericParameters.get(e).number=t}_addOnSettingChangedListener(e,t){this.flags.has(e)&&(this.flags.get(e).onChange=t)}_addOnTextSettingChangedListener(e,t){this.textParameters.has(e)&&(this.textParameters.get(e).onChange=t)}getSettingOption(e){return this.optionParameters.get(e)}isFlagEnabled(e){return this.flags.get(e).flag}setFlagEnabled(t,s){this.flags.has(t)?this.flags.get(t).flag=s:e.Warning(e.GetStackTrace(),`Cannot toggle flag called ${t} - it does not exist in the Config.flags map.`)}setTextSetting(t,s){this.textParameters.has(t)?this.textParameters.get(t).text=s:e.Warning(e.GetStackTrace(),`Cannot set text setting called ${t} - it does not exist in the Config.textParameters map.`)}setOptionSettingOptions(t,s){this.optionParameters.has(t)?(console.log(s),this.optionParameters.get(t).options=s):e.Warning(e.GetStackTrace(),`Cannot set text setting called ${t} - it does not exist in the Config.optionParameters map.`)}setOptionSettingValue(t,s){this.optionParameters.has(t)?this.optionParameters.get(t).selected=s:e.Warning(e.GetStackTrace(),`Cannot set text setting called ${t} - it does not exist in the Config.enumParameters map.`)}setFlagLabel(t,s){this.flags.has(t)?this.flags.get(t).label=s:e.Warning(e.GetStackTrace(),`Cannot set label for flag called ${t} - it does not exist in the Config.flags map.`)}setSettings(e){for(const t of Object.keys(e))he(t)?this.setFlagEnabled(t,e[t]):ue(t)?this.setNumericSetting(t,e[t]):Se(t)?this.setTextSetting(t,e[t]):ve(t)&&this.setOptionSettingValue(t,e[t])}getSettings(){const e={};for(const[t,s]of this.flags.entries())e[t]=s.flag;for(const[t,s]of this.numericParameters.entries())e[t]=s.number;for(const[t,s]of this.textParameters.entries())e[t]=s.text;for(const[t,s]of this.optionParameters.entries())e[t]=s.selected;return e}getFlags(){return Array.from(this.flags.values())}getTextSettings(){return Array.from(this.textParameters.values())}getNumericSettings(){return Array.from(this.numericParameters.values())}getOptionSettings(){return Array.from(this.optionParameters.values())}_registerOnChangeEvents(e){for(const t of this.flags.keys()){const s=this.flags.get(t);s&&(s.onChangeEmit=t=>e.dispatchEvent(new re({id:s.id,type:"flag",value:t,target:s})))}for(const t of this.numericParameters.keys()){const s=this.numericParameters.get(t);s&&(s.onChangeEmit=t=>e.dispatchEvent(new re({id:s.id,type:"number",value:t,target:s})))}for(const t of this.textParameters.keys()){const s=this.textParameters.get(t);s&&(s.onChangeEmit=t=>e.dispatchEvent(new re({id:s.id,type:"text",value:t,target:s})))}for(const t of this.optionParameters.keys()){const s=this.optionParameters.get(t);s&&(s.onChangeEmit=t=>e.dispatchEvent(new re({id:s.id,type:"option",value:t,target:s})))}}}var fe;!function(e){e[e.LockedMouse=0]="LockedMouse",e[e.HoveringMouse=1]="HoveringMouse"}(fe||(fe={}));class Te{constructor(e,t,s){this.closeTimeout=10,this.active=!1,this.countdownActive=!1,this.warnTimer=void 0,this.countDown=0,this.countDownTimer=void 0,this.config=e,this.pixelStreaming=t,this.onDismissAfk=s,this.onAFKTimedOutCallback=()=>{console.log("AFK timed out, did you want to override this callback?")}}onAfkClick(){clearInterval(this.countDownTimer),(this.active||this.countdownActive)&&(this.startAfkWarningTimer(),this.pixelStreaming.dispatchEvent(new x))}startAfkWarningTimer(){this.config.getNumericSettingValue(ge.AFKTimeoutSecs)>0&&this.config.isFlagEnabled(ce.AFKDetection)?this.active=!0:this.active=!1,this.resetAfkWarningTimer()}stopAfkWarningTimer(){this.active=!1,this.countdownActive=!1,clearTimeout(this.warnTimer),clearInterval(this.countDownTimer)}pauseAfkWarningTimer(){this.active=!1}resetAfkWarningTimer(){this.active&&this.config.isFlagEnabled(ce.AFKDetection)&&(clearTimeout(this.warnTimer),this.warnTimer=setTimeout((()=>this.activateAfkEvent()),1e3*this.config.getNumericSettingValue(ge.AFKTimeoutSecs)))}activateAfkEvent(){this.pauseAfkWarningTimer(),this.pixelStreaming.dispatchEvent(new k({countDown:this.countDown,dismissAfk:this.onDismissAfk})),this.countDown=this.closeTimeout,this.countdownActive=!0,this.pixelStreaming.dispatchEvent(new L({countDown:this.countDown})),this.config.isFlagEnabled(ce.HoveringMouseMode)||document.exitPointerLock&&document.exitPointerLock(),this.countDownTimer=setInterval((()=>{this.countDown--,0==this.countDown?(this.pixelStreaming.dispatchEvent(new A),this.onAFKTimedOutCallback(),e.Log(e.GetStackTrace(),"You have been disconnected due to inactivity"),this.stopAfkWarningTimer()):this.pixelStreaming.dispatchEvent(new L({countDown:this.countDown}))}),1e3)}}class Ee{constructor(){this.isReceivingFreezeFrame=!1}getDataChannelInstance(){return this}createDataChannel(e,t,s){this.peerConnection=e,this.label=t,this.datachannelOptions=s,null==s&&(this.datachannelOptions={},this.datachannelOptions.ordered=!0),this.dataChannel=this.peerConnection.createDataChannel(this.label,this.datachannelOptions),this.setupDataChannel()}setupDataChannel(){this.dataChannel.binaryType="arraybuffer",this.dataChannel.onopen=e=>this.handleOnOpen(e),this.dataChannel.onclose=e=>this.handleOnClose(e),this.dataChannel.onmessage=e=>this.handleOnMessage(e),this.dataChannel.onerror=e=>this.handleOnError(e)}handleOnOpen(t){var s;e.Log(e.GetStackTrace(),`Data Channel (${this.label}) opened.`,7),this.onOpen(null===(s=this.dataChannel)||void 0===s?void 0:s.label,t)}handleOnClose(t){var s;e.Log(e.GetStackTrace(),`Data Channel (${this.label}) closed.`,7),this.onClose(null===(s=this.dataChannel)||void 0===s?void 0:s.label,t)}handleOnMessage(t){e.Log(e.GetStackTrace(),`Data Channel (${this.label}) message: ${t}`,8)}handleOnError(t){var s;e.Log(e.GetStackTrace(),`Data Channel (${this.label}) error: ${t}`,7),this.onError(null===(s=this.dataChannel)||void 0===s?void 0:s.label,t)}onOpen(e,t){}onClose(e,t){}onError(e,t){}}class ye{}class Me{}class we{}class be{}class Re{}class Pe{}class ke{}class Le{}class xe{constructor(){this.inboundVideoStats=new Me,this.inboundAudioStats=new ye,this.candidatePair=new Re,this.DataChannelStats=new we,this.outBoundVideoStats=new Pe,this.sessionStats=new ke,this.streamStats=new Le,this.codecs=new Map}processStats(t){this.localCandidates=new Array,this.remoteCandidates=new Array,t.forEach((t=>{switch(t.type){case"candidate-pair":this.handleCandidatePair(t);break;case"certificate":case"media-source":case"media-playout":case"outbound-rtp":case"peer-connection":case"remote-inbound-rtp":case"transport":break;case"codec":this.handleCodec(t);break;case"data-channel":this.handleDataChannel(t);break;case"inbound-rtp":this.handleInBoundRTP(t);break;case"local-candidate":this.handleLocalCandidate(t);break;case"remote-candidate":this.handleRemoteCandidate(t);break;case"remote-outbound-rtp":this.handleRemoteOutBound(t);break;case"track":this.handleTrack(t);break;case"stream":this.handleStream(t);break;default:e.Error(e.GetStackTrace(),"unhandled Stat Type"),e.Log(e.GetStackTrace(),t)}}))}handleStream(e){this.streamStats=e}handleCandidatePair(e){this.candidatePair.bytesReceived=e.bytesReceived,this.candidatePair.bytesSent=e.bytesSent,this.candidatePair.localCandidateId=e.localCandidateId,this.candidatePair.remoteCandidateId=e.remoteCandidateId,this.candidatePair.nominated=e.nominated,this.candidatePair.readable=e.readable,this.candidatePair.selected=e.selected,this.candidatePair.writable=e.writable,this.candidatePair.state=e.state,this.candidatePair.currentRoundTripTime=e.currentRoundTripTime}handleDataChannel(e){this.DataChannelStats.bytesReceived=e.bytesReceived,this.DataChannelStats.bytesSent=e.bytesSent,this.DataChannelStats.dataChannelIdentifier=e.dataChannelIdentifier,this.DataChannelStats.id=e.id,this.DataChannelStats.label=e.label,this.DataChannelStats.messagesReceived=e.messagesReceived,this.DataChannelStats.messagesSent=e.messagesSent,this.DataChannelStats.protocol=e.protocol,this.DataChannelStats.state=e.state,this.DataChannelStats.timestamp=e.timestamp}handleLocalCandidate(e){const t=new be;t.label="local-candidate",t.address=e.address,t.port=e.port,t.protocol=e.protocol,t.candidateType=e.candidateType,t.id=e.id,this.localCandidates.push(t)}handleRemoteCandidate(e){const t=new be;t.label="local-candidate",t.address=e.address,t.port=e.port,t.protocol=e.protocol,t.id=e.id,t.candidateType=e.candidateType,this.remoteCandidates.push(t)}handleInBoundRTP(t){switch(t.kind){case"video":this.inboundVideoStats=t,null!=this.lastVideoStats&&(this.inboundVideoStats.bitrate=8*(this.inboundVideoStats.bytesReceived-this.lastVideoStats.bytesReceived)/(this.inboundVideoStats.timestamp-this.lastVideoStats.timestamp),this.inboundVideoStats.bitrate=Math.floor(this.inboundVideoStats.bitrate)),this.lastVideoStats=Object.assign({},this.inboundVideoStats);break;case"audio":this.inboundAudioStats=t,null!=this.lastAudioStats&&(this.inboundAudioStats.bitrate=8*(this.inboundAudioStats.bytesReceived-this.lastAudioStats.bytesReceived)/(this.inboundAudioStats.timestamp-this.lastAudioStats.timestamp),this.inboundAudioStats.bitrate=Math.floor(this.inboundAudioStats.bitrate)),this.lastAudioStats=Object.assign({},this.inboundAudioStats);break;default:e.Log(e.GetStackTrace(),"Kind is not handled")}}handleRemoteOutBound(e){"video"===e.kind&&(this.outBoundVideoStats.bytesSent=e.bytesSent,this.outBoundVideoStats.id=e.id,this.outBoundVideoStats.localId=e.localId,this.outBoundVideoStats.packetsSent=e.packetsSent,this.outBoundVideoStats.remoteTimestamp=e.remoteTimestamp,this.outBoundVideoStats.timestamp=e.timestamp)}handleTrack(e){"track"!==e.type||"video_label"!==e.trackIdentifier&&"video"!==e.kind||(this.inboundVideoStats.framesDropped=e.framesDropped,this.inboundVideoStats.framesReceived=e.framesReceived,this.inboundVideoStats.frameHeight=e.frameHeight,this.inboundVideoStats.frameWidth=e.frameWidth)}handleCodec(e){const t=e.id,s=`${e.mimeType.replace("video/","").replace("audio/","")}${e.sdpFmtpLine?` ${e.sdpFmtpLine}`:""}`;this.codecs.set(t,s)}handleSessionStatistics(e,t,s){const n=Date.now()-e;this.sessionStats.runTime=new Date(n).toISOString().substr(11,8).toString();const r=null===t?"Not sent yet":t?"true":"false";this.sessionStats.controlsStreamInput=r,this.sessionStats.videoEncoderAvgQP=s}isNumber(e){return"number"==typeof e&&isFinite(e)}}var Ae=n(366);class Fe{static isVideoTransciever(e){return this.canTransceiverReceiveVideo(e)||this.canTransceiverSendVideo(e)}static canTransceiverReceiveVideo(e){return!!e&&("sendrecv"===e.direction||"recvonly"===e.direction)&&e.receiver&&e.receiver.track&&"video"===e.receiver.track.kind}static canTransceiverSendVideo(e){return!!e&&("sendrecv"===e.direction||"sendonly"===e.direction)&&e.sender&&e.sender.track&&"video"===e.sender.track.kind}static isAudioTransciever(e){return this.canTransceiverReceiveAudio(e)||this.canTransceiverSendAudio(e)}static canTransceiverReceiveAudio(e){return!!e&&("sendrecv"===e.direction||"recvonly"===e.direction)&&e.receiver&&e.receiver.track&&"audio"===e.receiver.track.kind}static canTransceiverSendAudio(e){return!!e&&("sendrecv"===e.direction||"sendonly"===e.direction)&&e.sender&&e.sender.track&&"audio"===e.sender.track.kind}}var De,Oe,Ie=function(e,t,s,n){return new(s||(s=Promise))((function(r,i){function o(e){try{l(n.next(e))}catch(e){i(e)}}function a(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}l((n=n.apply(e,t||[])).next())}))};class Ge{constructor(e,t,s){this.config=t,this.createPeerConnection(e,s)}createPeerConnection(t,s){this.config.isFlagEnabled(ce.ForceTURN)&&(t.iceTransportPolicy="relay",e.Log(e.GetStackTrace(),"Forcing TURN usage by setting ICE Transport Policy in peer connection config.")),this.peerConnection=new RTCPeerConnection(t),this.peerConnection.onsignalingstatechange=e=>this.handleSignalStateChange(e),this.peerConnection.oniceconnectionstatechange=e=>this.handleIceConnectionStateChange(e),this.peerConnection.onicegatheringstatechange=e=>this.handleIceGatheringStateChange(e),this.peerConnection.ontrack=e=>this.handleOnTrack(e),this.peerConnection.onicecandidate=e=>this.handleIceCandidate(e),this.peerConnection.ondatachannel=e=>this.handleDataChannel(e),this.aggregatedStats=new xe,this.preferredCodec=s,this.updateCodecSelection=!0}createOffer(t,s){return Ie(this,void 0,void 0,(function*(){e.Log(e.GetStackTrace(),"Create Offer",6);const n="localhost"===location.hostname||"127.0.0.1"===location.hostname,r="https:"===location.protocol;let i=s.isFlagEnabled(ce.UseMic);!i||n||r||(i=!1,e.Error(e.GetStackTrace(),"Microphone access in the browser will not work if you are not on HTTPS or localhost. Disabling mic access."),e.Error(e.GetStackTrace(),"For testing you can enable HTTP microphone access Chrome by visiting chrome://flags/ and enabling 'unsafely-treat-insecure-origin-as-secure'")),this.setupTransceiversAsync(i).finally((()=>{var e;null===(e=this.peerConnection)||void 0===e||e.createOffer(t).then((e=>{var t;this.showTextOverlayConnecting(),e.sdp=this.mungeSDP(e.sdp,i),null===(t=this.peerConnection)||void 0===t||t.setLocalDescription(e),this.onSendWebRTCOffer(e)})).catch((()=>{this.showTextOverlaySetupFailure()}))}))}))}receiveOffer(t,s){var n;return Ie(this,void 0,void 0,(function*(){e.Log(e.GetStackTrace(),"Receive Offer",6),null===(n=this.peerConnection)||void 0===n||n.setRemoteDescription(t).then((()=>{const t="localhost"===location.hostname||"127.0.0.1"===location.hostname,n="https:"===location.protocol;let r=s.isFlagEnabled(ce.UseMic);!r||t||n||(r=!1,e.Error(e.GetStackTrace(),"Microphone access in the browser will not work if you are not on HTTPS or localhost. Disabling mic access."),e.Error(e.GetStackTrace(),"For testing you can enable HTTP microphone access Chrome by visiting chrome://flags/ and enabling 'unsafely-treat-insecure-origin-as-secure'")),this.setupTransceiversAsync(r).finally((()=>{var t;null===(t=this.peerConnection)||void 0===t||t.createAnswer().then((e=>{var t;return e.sdp=this.mungeSDP(e.sdp,r),null===(t=this.peerConnection)||void 0===t?void 0:t.setLocalDescription(e)})).then((()=>{var e;this.onSendWebRTCAnswer(null===(e=this.peerConnection)||void 0===e?void 0:e.currentLocalDescription)})).catch((()=>{e.Error(e.GetStackTrace(),"createAnswer() failed")}))}))})),this.config.setOptionSettingOptions(pe.PreferredCodec,this.parseAvailableCodecs(t).filter((e=>this.config.getSettingOption(pe.PreferredCodec).options.includes(e))))}))}receiveAnswer(e){var t;null===(t=this.peerConnection)||void 0===t||t.setRemoteDescription(e),this.config.setOptionSettingOptions(pe.PreferredCodec,this.parseAvailableCodecs(e).filter((e=>this.config.getSettingOption(pe.PreferredCodec).options.includes(e))))}generateStats(){var e;null===(e=this.peerConnection)||void 0===e||e.getStats(null).then((e=>{this.aggregatedStats.processStats(e),this.onVideoStats(this.aggregatedStats),this.updateCodecSelection&&this.config.setOptionSettingValue(pe.PreferredCodec,this.aggregatedStats.codecs.get(this.aggregatedStats.inboundVideoStats.codecId))}))}close(){this.peerConnection&&(this.peerConnection.close(),this.peerConnection=null)}mungeSDP(e,t){let s=e.replace(/(a=fmtp:\d+ .*level-asymmetry-allowed=.*)\r\n/gm,"$1;x-google-start-bitrate=10000;x-google-max-bitrate=100000\r\n"),n="maxaveragebitrate=510000;";return t&&(n+="sprop-maxcapturerate=48000;"),n+=this.config.isFlagEnabled(ce.ForceMonoAudio)?"stereo=0;":"stereo=1;",n+="useinbandfec=1",s=s.replace("useinbandfec=1",n),s}handleOnIce(t){var s;e.Log(e.GetStackTrace(),"peerconnection handleOnIce",6),this.config.isFlagEnabled(ce.ForceTURN)&&t.candidate.indexOf("relay")<0?e.Info(e.GetStackTrace(),`Dropping candidate because it was not TURN relay. | Type= ${t.type} | Protocol= ${t.protocol} | Address=${t.address} | Port=${t.port} |`,6):null===(s=this.peerConnection)||void 0===s||s.addIceCandidate(t)}handleSignalStateChange(t){e.Log(e.GetStackTrace(),"signaling state change: "+t,6)}handleIceConnectionStateChange(t){e.Log(e.GetStackTrace(),"ice connection state change: "+t,6),this.onIceConnectionStateChange(t)}handleIceGatheringStateChange(t){e.Log(e.GetStackTrace(),"ice gathering state change: "+JSON.stringify(t),6)}handleOnTrack(e){this.onTrack(e)}handleIceCandidate(e){this.onPeerIceCandidate(e)}handleDataChannel(e){this.onDataChannel(e)}onTrack(e){}onIceConnectionStateChange(e){}onPeerIceCandidate(e){}onDataChannel(e){}setupTransceiversAsync(e){var t,s,n,r,i,o,a,l,d;return Ie(this,void 0,void 0,(function*(){const c=(null===(t=this.peerConnection)||void 0===t?void 0:t.getTransceivers().length)>0;if(null===(s=this.peerConnection)||void 0===s||s.addTransceiver("video",{direction:"recvonly"}),RTCRtpReceiver.getCapabilities&&""!=this.preferredCodec)for(const e of null!==(r=null===(n=this.peerConnection)||void 0===n?void 0:n.getTransceivers())&&void 0!==r?r:[])if(e&&e.receiver&&e.receiver.track&&"video"===e.receiver.track.kind&&e.setCodecPreferences){const t=this.preferredCodec.split(" "),s=[{mimeType:"video/"+t[0],clockRate:9e4,sdpFmtpLine:t[1]?t[1]:""}];this.config.getSettingOption(pe.PreferredCodec).options.filter((e=>e!=this.preferredCodec)).forEach((e=>{const t=e.split(" ");s.push({mimeType:"video/"+t[0],clockRate:9e4,sdpFmtpLine:t[1]?t[1]:""})}));for(const e of s)""===e.sdpFmtpLine&&delete e.sdpFmtpLine;e.setCodecPreferences(s)}if(e){const e={video:!1,audio:{autoGainControl:!1,channelCount:1,echoCancellation:!1,latency:0,noiseSuppression:!1,sampleRate:48e3,sampleSize:16,volume:1}},t=yield navigator.mediaDevices.getUserMedia(e);if(t)if(c){for(const e of null!==(a=null===(o=this.peerConnection)||void 0===o?void 0:o.getTransceivers())&&void 0!==a?a:[])if(Fe.canTransceiverReceiveAudio(e))for(const s of t.getTracks())s.kind&&"audio"==s.kind&&(e.sender.replaceTrack(s),e.direction="sendrecv")}else for(const e of t.getTracks())e.kind&&"audio"==e.kind&&(null===(l=this.peerConnection)||void 0===l||l.addTransceiver(e,{direction:"sendrecv"}));else null===(d=this.peerConnection)||void 0===d||d.addTransceiver("audio",{direction:"recvonly"})}else null===(i=this.peerConnection)||void 0===i||i.addTransceiver("audio",{direction:"recvonly"})}))}onVideoStats(e){}onSendWebRTCOffer(e){}onSendWebRTCAnswer(e){}showTextOverlayConnecting(){}showTextOverlaySetupFailure(){}parseAvailableCodecs(e){if(!RTCRtpReceiver.getCapabilities)return["Only available on Chrome"];const t=[],s=(0,Ae.splitSections)(e.sdp);return s.shift(),s.forEach((e=>{const{codecs:s}=(0,Ae.parseRtpParameters)(e),n=/(VP\d|H26\d|AV1).*/;s.forEach((e=>{const s=e.name+" "+Object.keys(e.parameters||{}).map((t=>t+"="+e.parameters[t])).join(";");if(null!==n.exec(s)){"VP9"==e.name&&(e.parameters={"profile-id":"0"});const s=e.name+" "+Object.keys(e.parameters||{}).map((t=>t+"="+e.parameters[t])).join(";");t.push(s)}}))})),t}}class Ue{constructor(){this.PixelStreamingSettings=new ze,this.EncoderSettings=new Be,this.WebRTCSettings=new _e}ueCompatible(){null!=this.WebRTCSettings.MaxFPS&&(this.WebRTCSettings.FPS=this.WebRTCSettings.MaxFPS)}}class ze{}class Be{}class _e{}class He{constructor(){this.ReceiptTimeMs=null,this.TransmissionTimeMs=null,this.PreCaptureTimeMs=null,this.PostCaptureTimeMs=null,this.PreEncodeTimeMs=null,this.PostEncodeTimeMs=null,this.EncodeMs=null,this.CaptureToSendMs=null,this.testStartTimeMs=0,this.browserReceiptTimeMs=0,this.latencyExcludingDecode=0,this.testDuration=0,this.networkLatency=0,this.browserSendLatency=0,this.frameDisplayDeltaTimeMs=0,this.endToEndLatency=0,this.encodeLatency=0}setFrameDisplayDeltaTime(e){0==this.frameDisplayDeltaTimeMs&&(this.frameDisplayDeltaTimeMs=Math.round(e))}processFields(){null!=this.EncodeMs||null==this.PreEncodeTimeMs&&null==this.PostEncodeTimeMs||(e.Log(e.GetStackTrace(),`Setting Encode Ms \n ${this.PostEncodeTimeMs} \n ${this.PreEncodeTimeMs}`,6),this.EncodeMs=this.PostEncodeTimeMs-this.PreEncodeTimeMs),null!=this.CaptureToSendMs||null==this.PreCaptureTimeMs&&null==this.PostCaptureTimeMs||(e.Log(e.GetStackTrace(),`Setting CaptureToSendMs Ms \n ${this.PostCaptureTimeMs} \n ${this.PreCaptureTimeMs}`,6),this.CaptureToSendMs=this.PostCaptureTimeMs-this.PreCaptureTimeMs)}}class We{static setExtensionFromBytes(t,s){s.receiving||(s.mimetype="",s.extension="",s.receiving=!0,s.valid=!1,s.size=0,s.data=[],s.timestampStart=(new Date).getTime(),e.Log(e.GetStackTrace(),"Received first chunk of file",6));const n=new TextDecoder("utf-16").decode(t.slice(1));e.Log(e.GetStackTrace(),n,6),s.extension=n}static setMimeTypeFromBytes(t,s){s.receiving||(s.mimetype="",s.extension="",s.receiving=!0,s.valid=!1,s.size=0,s.data=[],s.timestampStart=(new Date).getTime(),e.Log(e.GetStackTrace(),"Received first chunk of file",6));const n=new TextDecoder("utf-16").decode(t.slice(1));e.Log(e.GetStackTrace(),n,6),s.mimetype=n}static setContentsFromBytes(t,s){if(!s.receiving)return;s.size=Math.ceil(new DataView(t.slice(1,5).buffer).getInt32(0,!0)/16379);const n=t.slice(5);if(s.data.push(n),e.Log(e.GetStackTrace(),`Received file chunk: ${s.data.length}/${s.size}`,6),s.data.length===s.size){s.receiving=!1,s.valid=!0,e.Log(e.GetStackTrace(),"Received complete file",6);const t=(new Date).getTime()-s.timestampStart,n=Math.round(16*s.size*1024/t);e.Log(e.GetStackTrace(),`Average transfer bitrate: ${n}kb/s over ${t/1e3} seconds`,6);const r=new Blob(s.data,{type:s.mimetype}),i=document.createElement("a");i.setAttribute("href",URL.createObjectURL(r)),i.setAttribute("download",`transfer.${s.extension}`),document.body.append(i),i.remove()}else s.data.length>s.size&&(s.receiving=!1,e.Error(e.GetStackTrace(),`Received bigger file than advertised: ${s.data.length}/${s.size}`))}}class Ve{constructor(){this.mimetype="",this.extension="",this.receiving=!1,this.size=0,this.data=[],this.valid=!1}}class Ne{}Ne.mainButton=0,Ne.auxiliaryButton=1,Ne.secondaryButton=2,Ne.fourthButton=3,Ne.fifthButton=4;class Ke{}Ke.primaryButton=1,Ke.secondaryButton=2,Ke.auxiliaryButton=4,Ke.fourthButton=8,Ke.fifthButton=16;class Qe{constructor(){this.unregisterCallbacks=[]}addUnregisterCallback(e){this.unregisterCallbacks.push(e)}unregisterAll(){for(const e of this.unregisterCallbacks)e();this.unregisterCallbacks=[]}}class qe{constructor(e,t,s){this.touchEventListenerTracker=new Qe,this.toStreamerMessagesProvider=e,this.videoElementProvider=t,this.coordinateConverter=s;const n=e=>this.onTouchStart(e),r=e=>this.onTouchEnd(e),i=e=>this.onTouchMove(e);document.addEventListener("touchstart",n,{passive:!1}),document.addEventListener("touchend",r,{passive:!1}),document.addEventListener("touchmove",i,{passive:!1}),this.touchEventListenerTracker.addUnregisterCallback((()=>document.removeEventListener("touchstart",n))),this.touchEventListenerTracker.addUnregisterCallback((()=>document.removeEventListener("touchend",r))),this.touchEventListenerTracker.addUnregisterCallback((()=>document.removeEventListener("touchmove",i)))}unregisterTouchEvents(){this.touchEventListenerTracker.unregisterAll()}setVideoElementParentClientRect(e){this.videoElementParentClientRect=e}onTouchStart(e){if(this.videoElementProvider.isVideoReady()){if(null==this.fakeTouchFinger){const t=e.changedTouches[0];this.fakeTouchFinger=new $e(t.identifier,t.clientX-this.videoElementParentClientRect.left,t.clientY-this.videoElementParentClientRect.top);const s=this.videoElementProvider.getVideoParentElement(),n=new MouseEvent("mouseenter",t);s.dispatchEvent(n);const r=this.coordinateConverter.normalizeAndQuantizeUnsigned(this.fakeTouchFinger.x,this.fakeTouchFinger.y);this.toStreamerMessagesProvider.toStreamerHandlers.get("MouseDown")([Ne.mainButton,r.x,r.y])}e.preventDefault()}}onTouchEnd(e){if(!this.videoElementProvider.isVideoReady())return;const t=this.videoElementProvider.getVideoParentElement(),s=this.toStreamerMessagesProvider.toStreamerHandlers;for(let n=0;n<e.changedTouches.length;n++){const r=e.changedTouches[n];if(r.identifier===this.fakeTouchFinger.id){const e=r.clientX-this.videoElementParentClientRect.left,n=r.clientY-this.videoElementParentClientRect.top,i=this.coordinateConverter.normalizeAndQuantizeUnsigned(e,n);s.get("MouseUp")([Ne.mainButton,i.x,i.y]);const o=new MouseEvent("mouseleave",r);t.dispatchEvent(o),this.fakeTouchFinger=null;break}}e.preventDefault()}onTouchMove(e){if(!this.videoElementProvider.isVideoReady())return;const t=this.toStreamerMessagesProvider.toStreamerHandlers;for(let s=0;s<e.touches.length;s++){const n=e.touches[s];if(n.identifier===this.fakeTouchFinger.id){const e=n.clientX-this.videoElementParentClientRect.left,s=n.clientY-this.videoElementParentClientRect.top,r=this.coordinateConverter.normalizeAndQuantizeUnsigned(e,s),i=this.coordinateConverter.normalizeAndQuantizeSigned(e-this.fakeTouchFinger.x,s-this.fakeTouchFinger.y);t.get("MouseMove")([r.x,r.y,i.x,i.y]),this.fakeTouchFinger.x=e,this.fakeTouchFinger.y=s;break}}e.preventDefault()}}class $e{constructor(e,t,s){this.id=e,this.x=t,this.y=s}}class Xe{}Xe.backSpace=8,Xe.shift=16,Xe.control=17,Xe.alt=18,Xe.rightShift=253,Xe.rightControl=254,Xe.rightAlt=255;class je{constructor(e,t,s){this.keyboardEventListenerTracker=new Qe,this.CodeToKeyCode={Escape:27,Digit0:48,Digit1:49,Digit2:50,Digit3:51,Digit4:52,Digit5:53,Digit6:54,Digit7:55,Digit8:56,Digit9:57,Minus:173,Equal:187,Backspace:8,Tab:9,KeyQ:81,KeyW:87,KeyE:69,KeyR:82,KeyT:84,KeyY:89,KeyU:85,KeyI:73,KeyO:79,KeyP:80,BracketLeft:219,BracketRight:221,Enter:13,ControlLeft:17,KeyA:65,KeyS:83,KeyD:68,KeyF:70,KeyG:71,KeyH:72,KeyJ:74,KeyK:75,KeyL:76,Semicolon:186,Quote:222,Backquote:192,ShiftLeft:16,Backslash:220,KeyZ:90,KeyX:88,KeyC:67,KeyV:86,KeyB:66,KeyN:78,KeyM:77,Comma:188,Period:190,Slash:191,ShiftRight:253,AltLeft:18,Space:32,CapsLock:20,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,Pause:19,ScrollLock:145,NumpadDivide:111,NumpadMultiply:106,NumpadSubtract:109,NumpadAdd:107,NumpadDecimal:110,Numpad9:105,Numpad8:104,Numpad7:103,Numpad6:102,Numpad5:101,Numpad4:100,Numpad3:99,Numpad2:98,Numpad1:97,Numpad0:96,NumLock:144,ControlRight:254,AltRight:255,Home:36,End:35,ArrowUp:38,ArrowLeft:37,ArrowRight:39,ArrowDown:40,PageUp:33,PageDown:34,Insert:45,Delete:46,ContextMenu:93},this.toStreamerMessagesProvider=e,this.config=t,this.activeKeysProvider=s}registerKeyBoardEvents(){const e=e=>this.handleOnKeyDown(e),t=e=>this.handleOnKeyUp(e),s=e=>this.handleOnKeyPress(e);document.addEventListener("keydown",e),document.addEventListener("keyup",t),document.addEventListener("keypress",s),this.keyboardEventListenerTracker.addUnregisterCallback((()=>document.removeEventListener("keydown",e))),this.keyboardEventListenerTracker.addUnregisterCallback((()=>document.removeEventListener("keyup",t))),this.keyboardEventListenerTracker.addUnregisterCallback((()=>document.removeEventListener("keypress",s)))}unregisterKeyBoardEvents(){this.keyboardEventListenerTracker.unregisterAll()}handleOnKeyDown(t){const s=this.getKeycode(t);s&&(e.Log(e.GetStackTrace(),`key down ${s}, repeat = ${t.repeat}`,6),this.toStreamerMessagesProvider.toStreamerHandlers.get("KeyDown")([this.getKeycode(t),t.repeat?1:0]),this.activeKeysProvider.getActiveKeys().push(s),s===Xe.backSpace&&document.dispatchEvent(new KeyboardEvent("keypress",{charCode:Xe.backSpace})),this.config.isFlagEnabled(ce.SuppressBrowserKeys)&&this.isKeyCodeBrowserKey(s)&&t.preventDefault())}handleOnKeyUp(t){const s=this.getKeycode(t);s&&(e.Log(e.GetStackTrace(),`key up ${s}`,6),this.toStreamerMessagesProvider.toStreamerHandlers.get("KeyUp")([s]),this.config.isFlagEnabled(ce.SuppressBrowserKeys)&&this.isKeyCodeBrowserKey(s)&&t.preventDefault())}handleOnKeyPress(t){if(!("charCode"in t))return void e.Warning(e.GetStackTrace(),"KeyboardEvent.charCode is deprecated in this browser, cannot send key press.");const s=t.charCode;e.Log(e.GetStackTrace(),`key press ${s}`,6),this.toStreamerMessagesProvider.toStreamerHandlers.get("KeyPress")([s])}getKeycode(t){if(!("keyCode"in t)){const s=t;return s.code in this.CodeToKeyCode?this.CodeToKeyCode[s.code]:(e.Warning(e.GetStackTrace(),`Keyboard code of ${s.code} is not supported in our mapping, ignoring this key.`),null)}return t.keyCode===Xe.shift&&"ShiftRight"===t.code?Xe.rightShift:t.keyCode===Xe.control&&"ControlRight"===t.code?Xe.rightControl:t.keyCode===Xe.alt&&"AltRight"===t.code?Xe.rightAlt:t.keyCode}isKeyCodeBrowserKey(e){return e>=112&&e<=123||9===e}}class Je{constructor(e,t,s){this.x=0,this.y=0,this.updateMouseMovePositionEvent=e=>{this.updateMouseMovePosition(e)},this.mouseEventListenerTracker=new Qe,this.videoElementProvider=e,this.mouseController=t,this.activeKeysProvider=s;const n=this.videoElementProvider.getVideoParentElement();this.x=n.getBoundingClientRect().width/2,this.y=n.getBoundingClientRect().height/2,this.coord=this.mouseController.coordinateConverter.normalizeAndQuantizeUnsigned(this.x,this.y)}unregisterMouseEvents(){this.mouseEventListenerTracker.unregisterAll()}lockStateChange(){const t=this.videoElementProvider.getVideoParentElement(),s=this.mouseController.toStreamerMessagesProvider.toStreamerHandlers;if(document.pointerLockElement===t||document.mozPointerLockElement===t)e.Log(e.GetStackTrace(),"Pointer locked",6),document.addEventListener("mousemove",this.updateMouseMovePositionEvent,!1),this.mouseEventListenerTracker.addUnregisterCallback((()=>document.removeEventListener("mousemove",this.updateMouseMovePositionEvent,!1)));else{e.Log(e.GetStackTrace(),"The pointer lock status is now unlocked",6),document.removeEventListener("mousemove",this.updateMouseMovePositionEvent,!1);let t=this.activeKeysProvider.getActiveKeys();const n=new Set(t),r=[];n.forEach((e=>{r[e]})),r.forEach((e=>{s.get("KeyUp")([e])})),t=[]}}updateMouseMovePosition(e){if(!this.videoElementProvider.isVideoReady())return;const t=this.mouseController.toStreamerMessagesProvider.toStreamerHandlers,s=this.videoElementProvider.getVideoParentElement().clientWidth,n=this.videoElementProvider.getVideoParentElement().clientHeight;this.x+=e.movementX,this.y+=e.movementY,this.x>s&&(this.x-=s),this.y>n&&(this.y-=n),this.x<0&&(this.x=s+this.x),this.y<0&&(this.y=n-this.y),this.coord=this.mouseController.coordinateConverter.normalizeAndQuantizeUnsigned(this.x,this.y);const r=this.mouseController.coordinateConverter.normalizeAndQuantizeSigned(e.movementX,e.movementY);t.get("MouseMove")([this.coord.x,this.coord.y,r.x,r.y])}handleMouseDown(e){this.videoElementProvider.isVideoReady()&&this.mouseController.toStreamerMessagesProvider.toStreamerHandlers.get("MouseDown")([e.button,this.coord.x,this.coord.y])}handleMouseUp(e){this.videoElementProvider.isVideoReady()&&this.mouseController.toStreamerMessagesProvider.toStreamerHandlers.get("MouseUp")([e.button,this.coord.x,this.coord.y])}handleMouseWheel(e){this.videoElementProvider.isVideoReady()&&this.mouseController.toStreamerMessagesProvider.toStreamerHandlers.get("MouseWheel")([e.wheelDelta,this.coord.x,this.coord.y])}handleMouseDouble(e){this.videoElementProvider.isVideoReady()&&this.mouseController.toStreamerMessagesProvider.toStreamerHandlers.get("MouseDouble")([e.button,this.coord.x,this.coord.y])}handlePressMouseButtons(e){this.videoElementProvider.isVideoReady()&&this.mouseController.pressMouseButtons(e.buttons,this.x,this.y)}handleReleaseMouseButtons(e){this.videoElementProvider.isVideoReady()&&this.mouseController.releaseMouseButtons(e.buttons,this.x,this.y)}}class Ye{constructor(e){this.mouseController=e}unregisterMouseEvents(){}updateMouseMovePosition(t){if(!this.mouseController.videoElementProvider.isVideoReady())return;e.Log(e.GetStackTrace(),"MouseMove",6);const s=this.mouseController.coordinateConverter.normalizeAndQuantizeUnsigned(t.offsetX,t.offsetY),n=this.mouseController.coordinateConverter.normalizeAndQuantizeSigned(t.movementX,t.movementY);this.mouseController.toStreamerMessagesProvider.toStreamerHandlers.get("MouseMove")([s.x,s.y,n.x,n.y]),t.preventDefault()}handleMouseDown(t){if(!this.mouseController.videoElementProvider.isVideoReady())return;e.Log(e.GetStackTrace(),"onMouse Down",6);const s=this.mouseController.coordinateConverter.normalizeAndQuantizeUnsigned(t.offsetX,t.offsetY);this.mouseController.toStreamerMessagesProvider.toStreamerHandlers.get("MouseDown")([t.button,s.x,s.y]),t.preventDefault()}handleMouseUp(t){if(!this.mouseController.videoElementProvider.isVideoReady())return;e.Log(e.GetStackTrace(),"onMouse Up",6);const s=this.mouseController.coordinateConverter.normalizeAndQuantizeUnsigned(t.offsetX,t.offsetY);this.mouseController.toStreamerMessagesProvider.toStreamerHandlers.get("MouseUp")([t.button,s.x,s.y]),t.preventDefault()}handleContextMenu(e){this.mouseController.videoElementProvider.isVideoReady()&&e.preventDefault()}handleMouseWheel(e){if(!this.mouseController.videoElementProvider.isVideoReady())return;const t=this.mouseController.coordinateConverter.normalizeAndQuantizeUnsigned(e.offsetX,e.offsetY);this.mouseController.toStreamerMessagesProvider.toStreamerHandlers.get("MouseWheel")([e.wheelDelta,t.x,t.y]),e.preventDefault()}handleMouseDouble(e){if(!this.mouseController.videoElementProvider.isVideoReady())return;const t=this.mouseController.coordinateConverter.normalizeAndQuantizeUnsigned(e.offsetX,e.offsetY);this.mouseController.toStreamerMessagesProvider.toStreamerHandlers.get("MouseDouble")([e.button,t.x,t.y])}handlePressMouseButtons(t){this.mouseController.videoElementProvider.isVideoReady()&&(e.Log(e.GetStackTrace(),"onMouse press",6),this.mouseController.pressMouseButtons(t.buttons,t.offsetX,t.offsetY))}handleReleaseMouseButtons(t){this.mouseController.videoElementProvider.isVideoReady()&&(e.Log(e.GetStackTrace(),"onMouse release",6),this.mouseController.releaseMouseButtons(t.buttons,t.offsetX,t.offsetY))}}class Ze{constructor(e,t,s,n){this.mouseEventListenerTracker=new Qe,this.toStreamerMessagesProvider=e,this.coordinateConverter=s,this.videoElementProvider=t,this.activeKeysProvider=n,this.registerMouseEnterAndLeaveEvents()}unregisterMouseEvents(){this.mouseEventListenerTracker.unregisterAll()}registerLockedMouseEvents(e){const t=this.videoElementProvider.getVideoParentElement(),s=new Je(this.videoElementProvider,e,this.activeKeysProvider);if(t.requestPointerLock=t.requestPointerLock||t.mozRequestPointerLock,document.exitPointerLock=document.exitPointerLock||document.mozExitPointerLock,t.requestPointerLock){const e=()=>{t.requestPointerLock()};t.addEventListener("click",e),this.mouseEventListenerTracker.addUnregisterCallback((()=>t.removeEventListener("click",e)))}const n=()=>s.lockStateChange();document.addEventListener("pointerlockchange",n,!1),document.addEventListener("mozpointerlockchange",n,!1),this.mouseEventListenerTracker.addUnregisterCallback((()=>document.removeEventListener("pointerlockchange",n,!1))),this.mouseEventListenerTracker.addUnregisterCallback((()=>document.removeEventListener("mozpointerlockchange",n,!1)));const r=e=>s.handleMouseDown(e),i=e=>s.handleMouseUp(e),o=e=>s.handleMouseWheel(e),a=e=>s.handleMouseDouble(e);t.addEventListener("mousedown",r),t.addEventListener("mouseup",i),t.addEventListener("wheel",o),t.addEventListener("dblclick",a),this.mouseEventListenerTracker.addUnregisterCallback((()=>t.removeEventListener("mousedown",r))),this.mouseEventListenerTracker.addUnregisterCallback((()=>t.removeEventListener("mouseup",i))),this.mouseEventListenerTracker.addUnregisterCallback((()=>t.removeEventListener("wheel",o))),this.mouseEventListenerTracker.addUnregisterCallback((()=>t.removeEventListener("dblclick",a))),this.mouseEventListenerTracker.addUnregisterCallback((()=>s.unregisterMouseEvents())),this.mouseEventListenerTracker.addUnregisterCallback((()=>{!document.exitPointerLock||document.pointerLockElement!==t&&document.mozPointerLockElement!==t||document.exitPointerLock()}))}registerHoveringMouseEvents(e){const t=this.videoElementProvider.getVideoParentElement(),s=new Ye(e),n=e=>s.updateMouseMovePosition(e),r=e=>s.handleMouseDown(e),i=e=>s.handleMouseUp(e),o=e=>s.handleContextMenu(e),a=e=>s.handleMouseWheel(e),l=e=>s.handleMouseDouble(e);t.addEventListener("mousemove",n),t.addEventListener("mousedown",r),t.addEventListener("mouseup",i),t.addEventListener("contextmenu",o),t.addEventListener("wheel",a),t.addEventListener("dblclick",l),this.mouseEventListenerTracker.addUnregisterCallback((()=>t.removeEventListener("mousemove",n))),this.mouseEventListenerTracker.addUnregisterCallback((()=>t.removeEventListener("mousedown",r))),this.mouseEventListenerTracker.addUnregisterCallback((()=>t.removeEventListener("mouseup",i))),this.mouseEventListenerTracker.addUnregisterCallback((()=>t.removeEventListener("contextmenu",o))),this.mouseEventListenerTracker.addUnregisterCallback((()=>t.removeEventListener("wheel",a))),this.mouseEventListenerTracker.addUnregisterCallback((()=>t.removeEventListener("dblclick",l))),this.mouseEventListenerTracker.addUnregisterCallback((()=>s.unregisterMouseEvents()))}registerMouseEnterAndLeaveEvents(){const t=this.videoElementProvider.getVideoParentElement(),s=t=>{this.videoElementProvider.isVideoReady()&&(e.Log(e.GetStackTrace(),"Mouse Entered",6),this.sendMouseEnter(),this.pressMouseButtons(t.buttons,t.x,t.y))},n=t=>{this.videoElementProvider.isVideoReady()&&(e.Log(e.GetStackTrace(),"Mouse Left",6),this.sendMouseLeave(),this.releaseMouseButtons(t.buttons,t.x,t.y))};t.addEventListener("mouseenter",s),t.addEventListener("mouseleave",n),this.mouseEventListenerTracker.addUnregisterCallback((()=>t.removeEventListener("mouseenter",s))),this.mouseEventListenerTracker.addUnregisterCallback((()=>t.removeEventListener("mouseleave",n)))}releaseMouseButtons(e,t,s){const n=this.coordinateConverter.normalizeAndQuantizeUnsigned(t,s);e&Ke.primaryButton&&this.sendMouseUp(Ne.mainButton,n.x,n.y),e&Ke.secondaryButton&&this.sendMouseUp(Ne.secondaryButton,n.x,n.y),e&Ke.auxiliaryButton&&this.sendMouseUp(Ne.auxiliaryButton,n.x,n.y),e&Ke.fourthButton&&this.sendMouseUp(Ne.fourthButton,n.x,n.y),e&Ke.fifthButton&&this.sendMouseUp(Ne.fifthButton,n.x,n.y)}pressMouseButtons(e,t,s){if(!this.videoElementProvider.isVideoReady())return;const n=this.coordinateConverter.normalizeAndQuantizeUnsigned(t,s);e&Ke.primaryButton&&this.sendMouseDown(Ne.mainButton,n.x,n.y),e&Ke.secondaryButton&&this.sendMouseDown(Ne.secondaryButton,n.x,n.y),e&Ke.auxiliaryButton&&this.sendMouseDown(Ne.auxiliaryButton,n.x,n.y),e&Ke.fourthButton&&this.sendMouseDown(Ne.fourthButton,n.x,n.y),e&Ke.fifthButton&&this.sendMouseDown(Ne.fifthButton,n.x,n.y)}sendMouseEnter(){this.videoElementProvider.isVideoReady()&&this.toStreamerMessagesProvider.toStreamerHandlers.get("MouseEnter")()}sendMouseLeave(){this.videoElementProvider.isVideoReady()&&this.toStreamerMessagesProvider.toStreamerHandlers.get("MouseLeave")()}sendMouseDown(t,s,n){this.videoElementProvider.isVideoReady()&&(e.Log(e.GetStackTrace(),`mouse button ${t} down at (${s}, ${n})`,6),this.toStreamerMessagesProvider.toStreamerHandlers.get("MouseDown")([t,s,n]))}sendMouseUp(t,s,n){if(!this.videoElementProvider.isVideoReady())return;e.Log(e.GetStackTrace(),`mouse button ${t} up at (${s}, ${n})`,6);const r=this.coordinateConverter.normalizeAndQuantizeUnsigned(s,n);this.toStreamerMessagesProvider.toStreamerHandlers.get("MouseUp")([t,r.x,r.y])}}class et{constructor(t,s,n){this.fingers=[9,8,7,6,5,4,3,2,1,0],this.fingerIds=new Map,this.maxByteValue=255,this.touchEventListenerTracker=new Qe,this.toStreamerMessagesProvider=t,this.videoElementProvider=s,this.coordinateConverter=n,this.videoElementParent=s.getVideoElement();const r=e=>this.onTouchStart(e),i=e=>this.onTouchEnd(e),o=e=>this.onTouchMove(e);this.videoElementParent.addEventListener("touchstart",r),this.videoElementParent.addEventListener("touchend",i),this.videoElementParent.addEventListener("touchmove",o),this.touchEventListenerTracker.addUnregisterCallback((()=>this.videoElementParent.removeEventListener("touchstart",r))),this.touchEventListenerTracker.addUnregisterCallback((()=>this.videoElementParent.removeEventListener("touchend",i))),this.touchEventListenerTracker.addUnregisterCallback((()=>this.videoElementParent.removeEventListener("touchmove",o))),e.Log(e.GetStackTrace(),"Touch Events Registered",6);const a=e=>{e.preventDefault()};document.addEventListener("touchmove",a),this.touchEventListenerTracker.addUnregisterCallback((()=>document.removeEventListener("touchmove",a)))}unregisterTouchEvents(){this.touchEventListenerTracker.unregisterAll()}rememberTouch(t){const s=this.fingers.pop();void 0===s&&e.Log(e.GetStackTrace(),"exhausted touch identifiers",6),this.fingerIds.set(t.identifier,s)}forgetTouch(e){this.fingers.push(this.fingerIds.get(e.identifier)),this.fingers.sort((function(e,t){return t-e})),this.fingerIds.delete(e.identifier)}onTouchStart(t){if(this.videoElementProvider.isVideoReady()){for(let e=0;e<t.changedTouches.length;e++)this.rememberTouch(t.changedTouches[e]);e.Log(e.GetStackTrace(),"touch start",6),this.emitTouchData("TouchStart",t.changedTouches),t.preventDefault()}}onTouchEnd(t){if(this.videoElementProvider.isVideoReady()){e.Log(e.GetStackTrace(),"touch end",6),this.emitTouchData("TouchEnd",t.changedTouches);for(let e=0;e<t.changedTouches.length;e++)this.forgetTouch(t.changedTouches[e]);t.preventDefault()}}onTouchMove(t){this.videoElementProvider.isVideoReady()&&(e.Log(e.GetStackTrace(),"touch move",6),this.emitTouchData("TouchMove",t.touches),t.preventDefault())}emitTouchData(t,s){let n=document.querySelector(".screen"),r=Math.floor(n.getBoundingClientRect().width*window.devicePixelRatio),i=Math.floor(n.getBoundingClientRect().height*window.devicePixelRatio),o=Math.floor(window.screen.width*window.devicePixelRatio),a=Math.floor(window.screen.height*window.devicePixelRatio),l=(Math.floor(document.documentElement.clientWidth*window.devicePixelRatio),a-Math.floor(document.documentElement.clientHeight*window.devicePixelRatio)),d=document.querySelector(".screen").clientWidth/i,c=document.querySelector(".screen").clientHeight/r;if(!this.videoElementProvider.isVideoReady())return;this.videoElementProvider.getVideoParentElement().getBoundingClientRect();const h=this.toStreamerMessagesProvider.toStreamerHandlers;for(let n=0;n<s.length;n++){const g=1,u=s[n];let m,S;m=c*(Math.floor(u.clientY*window.devicePixelRatio)-Math.floor((a-l-i)/2)),S=d*(r-(Math.floor(u.clientX*window.devicePixelRatio)-Math.floor((o-r)/2))),e.Log(e.GetStackTrace(),`F${this.fingerIds.get(u.identifier)}=(${m}, ${S})`,6);const p=this.coordinateConverter.normalizeAndQuantizeUnsigned(m,S);switch(t){case"TouchStart":h.get("TouchStart")([g,p.x,p.y,this.fingerIds.get(u.identifier),this.maxByteValue*u.force,p.inRange?1:0]);break;case"TouchEnd":h.get("TouchEnd")([g,p.x,p.y,this.fingerIds.get(u.identifier),this.maxByteValue*u.force,p.inRange?1:0]);break;case"TouchMove":h.get("TouchMove")([g,p.x,p.y,this.fingerIds.get(u.identifier),this.maxByteValue*u.force,p.inRange?1:0])}}}}class tt{constructor(e){this.gamePadEventListenerTracker=new Qe,this.toStreamerMessagesProvider=e,this.requestAnimationFrame=(window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.requestAnimationFrame).bind(window);const t=window;if("GamepadEvent"in t){const e=e=>this.gamePadConnectHandler(e),t=e=>this.gamePadDisconnectHandler(e);window.addEventListener("gamepadconnected",e),window.addEventListener("gamepaddisconnected",t),this.gamePadEventListenerTracker.addUnregisterCallback((()=>window.removeEventListener("gamepadconnected",e))),this.gamePadEventListenerTracker.addUnregisterCallback((()=>window.removeEventListener("gamepaddisconnected",t)))}else if("WebKitGamepadEvent"in t){const e=e=>this.gamePadConnectHandler(e),t=e=>this.gamePadDisconnectHandler(e);window.addEventListener("webkitgamepadconnected",e),window.addEventListener("webkitgamepaddisconnected",t),this.gamePadEventListenerTracker.addUnregisterCallback((()=>window.removeEventListener("webkitgamepadconnected",e))),this.gamePadEventListenerTracker.addUnregisterCallback((()=>window.removeEventListener("webkitgamepaddisconnected",t)))}if(this.controllers=[],navigator.getGamepads)for(const e of navigator.getGamepads())e&&this.gamePadConnectHandler(new GamepadEvent("gamepadconnected",{gamepad:e}))}unregisterGamePadEvents(){this.gamePadEventListenerTracker.unregisterAll();for(const e of this.controllers)void 0!==e.id&&this.onGamepadDisconnected(e.id);this.controllers=[],this.onGamepadConnected=()=>{},this.onGamepadDisconnected=()=>{}}gamePadConnectHandler(t){e.Log(e.GetStackTrace(),"Gamepad connect handler",6);const s=t.gamepad,n={currentState:s,prevState:s,id:void 0};this.controllers.push(n),this.controllers[s.index].currentState=s,this.controllers[s.index].prevState=s,e.Log(e.GetStackTrace(),"gamepad: "+s.id+" connected",6),window.requestAnimationFrame((()=>this.updateStatus())),this.onGamepadConnected()}gamePadDisconnectHandler(t){e.Log(e.GetStackTrace(),"Gamepad disconnect handler",6),e.Log(e.GetStackTrace(),"gamepad: "+t.gamepad.id+" disconnected",6);const s=this.controllers[t.gamepad.index];delete this.controllers[t.gamepad.index],this.controllers=this.controllers.filter((e=>void 0!==e)),this.onGamepadDisconnected(s.id)}scanGamePads(){const e=navigator.getGamepads?navigator.getGamepads():navigator.webkitGetGamepads?navigator.webkitGetGamepads():[];for(let t=0;t<e.length;t++)e[t]&&e[t].index in this.controllers&&(this.controllers[e[t].index].currentState=e[t])}updateStatus(){this.scanGamePads();const e=this.toStreamerMessagesProvider.toStreamerHandlers;for(const t of this.controllers){const s=void 0===t.id?this.controllers.indexOf(t):t.id,n=t.currentState;for(let n=0;n<t.currentState.buttons.length;n++){const r=t.currentState.buttons[n],i=t.prevState.buttons[n];r.pressed?n==De.LeftTrigger?e.get("GamepadAnalog")([s,5,r.value]):n==De.RightTrigger?e.get("GamepadAnalog")([s,6,r.value]):e.get("GamepadButtonPressed")([s,n,i.pressed?1:0]):!r.pressed&&i.pressed&&(n==De.LeftTrigger?e.get("GamepadAnalog")([s,5,0]):n==De.RightTrigger?e.get("GamepadAnalog")([s,6,0]):e.get("GamepadButtonReleased")([s,n]))}for(let t=0;t<n.axes.length;t+=2){const r=parseFloat(n.axes[t].toFixed(4)),i=-parseFloat(n.axes[t+1].toFixed(4));e.get("GamepadAnalog")([s,t+1,r]),e.get("GamepadAnalog")([s,t+2,i])}this.controllers[s].prevState=n}this.controllers.length>0&&this.requestAnimationFrame((()=>this.updateStatus()))}onGamepadResponseReceived(e){for(const t of this.controllers)if(void 0===t.id){t.id=e;break}}onGamepadConnected(){}onGamepadDisconnected(e){}}!function(e){e[e.RightClusterBottomButton=0]="RightClusterBottomButton",e[e.RightClusterRightButton=1]="RightClusterRightButton",e[e.RightClusterLeftButton=2]="RightClusterLeftButton",e[e.RightClusterTopButton=3]="RightClusterTopButton",e[e.LeftShoulder=4]="LeftShoulder",e[e.RightShoulder=5]="RightShoulder",e[e.LeftTrigger=6]="LeftTrigger",e[e.RightTrigger=7]="RightTrigger",e[e.SelectOrBack=8]="SelectOrBack",e[e.StartOrForward=9]="StartOrForward",e[e.LeftAnalogPress=10]="LeftAnalogPress",e[e.RightAnalogPress=11]="RightAnalogPress",e[e.LeftClusterTopButton=12]="LeftClusterTopButton",e[e.LeftClusterBottomButton=13]="LeftClusterBottomButton",e[e.LeftClusterLeftButton=14]="LeftClusterLeftButton",e[e.LeftClusterRightButton=15]="LeftClusterRightButton",e[e.CentreButton=16]="CentreButton",e[e.LeftStickHorizontal=0]="LeftStickHorizontal",e[e.LeftStickVertical=1]="LeftStickVertical",e[e.RightStickHorizontal=2]="RightStickHorizontal",e[e.RightStickVertical=3]="RightStickVertical"}(De||(De={}));class st{constructor(e,t,s){this.activeKeys=new nt,this.toStreamerMessagesProvider=e,this.videoElementProvider=t,this.coordinateConverter=s}registerKeyBoard(t){e.Log(e.GetStackTrace(),"Register Keyboard Events",7);const s=new je(this.toStreamerMessagesProvider,t,this.activeKeys);return s.registerKeyBoardEvents(),s}registerMouse(t){e.Log(e.GetStackTrace(),"Register Mouse Events",7);const s=new Ze(this.toStreamerMessagesProvider,this.videoElementProvider,this.coordinateConverter,this.activeKeys);switch(t){case fe.LockedMouse:s.registerLockedMouseEvents(s);break;case fe.HoveringMouse:s.registerHoveringMouseEvents(s);break;default:e.Info(e.GetStackTrace(),"unknown Control Scheme Type Defaulting to Locked Mouse Events"),s.registerLockedMouseEvents(s)}return s}registerTouch(t,s){if(e.Log(e.GetStackTrace(),"Registering Touch",6),t){const e=new qe(this.toStreamerMessagesProvider,this.videoElementProvider,this.coordinateConverter);return e.setVideoElementParentClientRect(s),e}return new et(this.toStreamerMessagesProvider,this.videoElementProvider,this.coordinateConverter)}registerGamePad(){return e.Log(e.GetStackTrace(),"Register Game Pad",7),new tt(this.toStreamerMessagesProvider)}}class nt{constructor(){this.activeKeys=[],this.activeKeys=[]}getActiveKeys(){return this.activeKeys}}class rt{constructor(e,t){this.lastTimeResized=(new Date).getTime(),this.videoElement=document.createElement("video"),this.config=t,this.videoElement.id="streamingVideo",this.videoElement.disablePictureInPicture=!0,this.videoElement.playsInline=!0,this.videoElement.style.width="100%",this.videoElement.style.height="100%",this.videoElement.style.position="absolute",this.videoElement.style.pointerEvents="all",e.appendChild(this.videoElement),this.onResizePlayerCallback=()=>{console.log("Resolution changed, restyling player, did you forget to override this function?")},this.onMatchViewportResolutionCallback=()=>{console.log("Resolution changed and match viewport resolution is turned on, did you forget to override this function?")},this.videoElement.onclick=()=>{null!=this.audioElement&&this.audioElement.paused&&this.audioElement.play(),this.videoElement.paused&&this.videoElement.play()},this.videoElement.onloadedmetadata=()=>{this.onVideoInitialized()},window.addEventListener("resize",(()=>this.resizePlayerStyle()),!0),window.addEventListener("orientationchange",(()=>this.onOrientationChange()))}setAudioElement(e){this.audioElement=e}play(){return this.videoElement.muted=this.config.isFlagEnabled(ce.StartVideoMuted),this.videoElement.autoplay=this.config.isFlagEnabled(ce.AutoPlayVideo),this.videoElement.play()}isPaused(){return this.videoElement.paused}isVideoReady(){return void 0!==this.videoElement.readyState&&this.videoElement.readyState>0}hasVideoSource(){return void 0!==this.videoElement.srcObject&&null!==this.videoElement.srcObject}getVideoElement(){return this.videoElement}getVideoParentElement(){return this.videoElement.parentElement}setVideoEnabled(e){this.videoElement.srcObject.getTracks().forEach((t=>t.enabled=e))}onVideoInitialized(){}onOrientationChange(){clearTimeout(this.orientationChangeTimeout),this.orientationChangeTimeout=window.setTimeout((()=>{this.resizePlayerStyle()}),500)}resizePlayerStyle(){const e=this.getVideoParentElement();e&&(this.updateVideoStreamSize(),e.classList.contains("fixed-size")||this.resizePlayerStyleToFillParentElement(),this.onResizePlayerCallback())}resizePlayerStyleToFillParentElement(){this.getVideoParentElement().setAttribute("style","top: 0px; left: 0px; width: 100%; height: 100%; cursor: default;")}updateVideoStreamSize(){if(this.config.isFlagEnabled(ce.MatchViewportResolution))if((new Date).getTime()-this.lastTimeResized>300){const e=this.getVideoParentElement();if(!e)return;this.onMatchViewportResolutionCallback(e.clientWidth,e.clientHeight),this.lastTimeResized=(new Date).getTime()}else e.Log(e.GetStackTrace(),"Resizing too often - skipping",6),clearTimeout(this.resizeTimeoutHandle),this.resizeTimeoutHandle=window.setTimeout((()=>this.updateVideoStreamSize()),100)}}class it{constructor(){this.toStreamerHandlers=new Map,this.fromStreamerHandlers=new Map,this.toStreamerMessages=new Map,this.fromStreamerMessages=new Map}populateDefaultProtocol(){this.toStreamerMessages.set("IFrameRequest",{id:0,structure:[]}),this.toStreamerMessages.set("RequestQualityControl",{id:1,structure:[]}),this.toStreamerMessages.set("FpsRequest",{id:2,structure:[]}),this.toStreamerMessages.set("AverageBitrateRequest",{id:3,structure:[]}),this.toStreamerMessages.set("StartStreaming",{id:4,structure:[]}),this.toStreamerMessages.set("StopStreaming",{id:5,structure:[]}),this.toStreamerMessages.set("LatencyTest",{id:6,structure:["string"]}),this.toStreamerMessages.set("RequestInitialSettings",{id:7,structure:[]}),this.toStreamerMessages.set("TestEcho",{id:8,structure:[]}),this.toStreamerMessages.set("DataChannelLatencyTest",{id:9,structure:[]}),this.toStreamerMessages.set("UIInteraction",{id:50,structure:["string"]}),this.toStreamerMessages.set("Command",{id:51,structure:["string"]}),this.toStreamerMessages.set("KeyDown",{id:60,structure:["uint8","uint8"]}),this.toStreamerMessages.set("KeyUp",{id:61,structure:["uint8"]}),this.toStreamerMessages.set("KeyPress",{id:62,structure:["uint16"]}),this.toStreamerMessages.set("MouseEnter",{id:70,structure:[]}),this.toStreamerMessages.set("MouseLeave",{id:71,structure:[]}),this.toStreamerMessages.set("MouseDown",{id:72,structure:["uint8","uint16","uint16"]}),this.toStreamerMessages.set("MouseUp",{id:73,structure:["uint8","uint16","uint16"]}),this.toStreamerMessages.set("MouseMove",{id:74,structure:["uint16","uint16","int16","int16"]}),this.toStreamerMessages.set("MouseWheel",{id:75,structure:["int16","uint16","uint16"]}),this.toStreamerMessages.set("MouseDouble",{id:76,structure:["uint8","uint16","uint16"]}),this.toStreamerMessages.set("TouchStart",{id:80,structure:["uint8","uint16","uint16","uint8","uint8","uint8"]}),this.toStreamerMessages.set("TouchEnd",{id:81,structure:["uint8","uint16","uint16","uint8","uint8","uint8"]}),this.toStreamerMessages.set("TouchMove",{id:82,structure:["uint8","uint16","uint16","uint8","uint8","uint8"]}),this.toStreamerMessages.set("GamepadConnected",{id:93,structure:[]}),this.toStreamerMessages.set("GamepadButtonPressed",{id:90,structure:["uint8","uint8","uint8"]}),this.toStreamerMessages.set("GamepadButtonReleased",{id:91,structure:["uint8","uint8","uint8"]}),this.toStreamerMessages.set("GamepadAnalog",{id:92,structure:["uint8","uint8","double"]}),this.toStreamerMessages.set("GamepadDisconnected",{id:94,structure:["uint8"]}),this.fromStreamerMessages.set(0,"QualityControlOwnership"),this.fromStreamerMessages.set(1,"Response"),this.fromStreamerMessages.set(2,"Command"),this.fromStreamerMessages.set(3,"FreezeFrame"),this.fromStreamerMessages.set(4,"UnfreezeFrame"),this.fromStreamerMessages.set(5,"VideoEncoderAvgQP"),this.fromStreamerMessages.set(6,"LatencyTest"),this.fromStreamerMessages.set(7,"InitialSettings"),this.fromStreamerMessages.set(8,"FileExtension"),this.fromStreamerMessages.set(9,"FileMimeType"),this.fromStreamerMessages.set(10,"FileContents"),this.fromStreamerMessages.set(11,"TestEcho"),this.fromStreamerMessages.set(12,"InputControlOwnership"),this.fromStreamerMessages.set(13,"GamepadResponse"),this.fromStreamerMessages.set(14,"DataChannelLatencyTest"),this.fromStreamerMessages.set(255,"Protocol")}registerMessageHandler(t,s,n){switch(t){case Oe.ToStreamer:this.toStreamerHandlers.set(s,n);break;case Oe.FromStreamer:this.fromStreamerHandlers.set(s,n);break;default:e.Log(e.GetStackTrace(),`Unknown message direction ${t}`)}}}!function(e){e[e.ToStreamer=0]="ToStreamer",e[e.FromStreamer=1]="FromStreamer"}(Oe||(Oe={}));class ot{constructor(){this.responseEventListeners=new Map}addResponseEventListener(e,t){this.responseEventListeners.set(e,t)}removeResponseEventListener(e){this.responseEventListeners.delete(e)}onResponse(t){e.Log(e.GetStackTrace(),"DataChannelReceiveMessageType.Response",6);const s=new TextDecoder("utf-16").decode(t.slice(1));e.Log(e.GetStackTrace(),s,6),this.responseEventListeners.forEach((e=>{e(s)}))}}class at{constructor(e,t){this.dataChannelSender=e,this.toStreamerMessagesMapProvider=t}sendMessageToStreamer(t,s){void 0===s&&(s=[]);const n=this.toStreamerMessagesMapProvider.toStreamerMessages.get(t);if(void 0===n)return void e.Error(e.GetStackTrace(),`Attempted to send a message to the streamer with message type: ${t}, but the frontend hasn't been configured to send such a message. Check you've added the message type in your cpp`);if(n.structure&&s&&n.structure.length!==s.length)return void e.Error(e.GetStackTrace(),`Provided message data doesn't match expected layout. Expected [ ${n.structure.map((e=>{switch(e){case"uint8":case"uint16":case"int16":case"float":case"double":return"number";case"string":return"string"}})).toString()} ] but received [ ${s.map((e=>typeof e)).toString()} ]`);let r=0;const i=new TextEncoder;s.forEach(((e,t)=>{switch(n.structure[t]){case"uint8":r+=1;break;case"uint16":case"int16":r+=2;break;case"float":r+=4;break;case"double":r+=8;break;case"string":r+=2,r+=2*i.encode(e).length}}));const o=new DataView(new ArrayBuffer(r+1));o.setUint8(0,n.id);let a=1;s.forEach(((e,t)=>{switch(n.structure[t]){case"uint8":o.setUint8(a,e),a+=1;break;case"uint16":o.setUint16(a,e,!0),a+=2;break;case"int16":o.setInt16(a,e,!0),a+=2;break;case"float":o.setFloat32(a,e,!0),a+=4;break;case"double":o.setFloat64(a,e,!0),a+=8;break;case"string":o.setUint16(a,e.length,!0),a+=2;for(let t=0;t<e.length;t++)o.setUint16(a,e.charCodeAt(t),!0),a+=2}})),this.dataChannelSender.canSend()?this.dataChannelSender.sendData(o.buffer):e.Info(e.GetStackTrace(),`Data channel cannot send yet, skipping sending message: ${t} - ${new Uint8Array(o.buffer)}`)}}class lt{constructor(e){this.sendMessageController=e}SendRequestQualityControl(){this.sendMessageController.sendMessageToStreamer("RequestQualityControl")}SendMaxFpsRequest(){this.sendMessageController.sendMessageToStreamer("FpsRequest")}SendAverageBitrateRequest(){this.sendMessageController.sendMessageToStreamer("AverageBitrateRequest")}SendStartStreaming(){this.sendMessageController.sendMessageToStreamer("StartStreaming")}SendStopStreaming(){this.sendMessageController.sendMessageToStreamer("StopStreaming")}SendRequestInitialSettings(){this.sendMessageController.sendMessageToStreamer("RequestInitialSettings")}}class dt{constructor(e){this.dataChannelProvider=e}canSend(){return void 0!==this.dataChannelProvider.getDataChannelInstance().dataChannel&&"open"==this.dataChannelProvider.getDataChannelInstance().dataChannel.readyState}sendData(t){const s=this.dataChannelProvider.getDataChannelInstance();"open"==s.dataChannel.readyState?(s.dataChannel.send(t),e.Log(e.GetStackTrace(),`Message Sent: ${new Uint8Array(t)}`,6),this.resetAfkWarningTimerOnDataSend()):e.Error(e.GetStackTrace(),`Message Failed: ${new Uint8Array(t)}`)}resetAfkWarningTimerOnDataSend(){}}class ct{constructor(e){this.videoElementProvider=e,this.normalizeAndQuantizeUnsignedFunc=()=>{throw new Error("Normalize and quantize unsigned, method not implemented.")},this.normalizeAndQuantizeSignedFunc=()=>{throw new Error("Normalize and unquantize signed, method not implemented.")},this.denormalizeAndUnquantizeUnsignedFunc=()=>{throw new Error("Denormalize and unquantize unsigned, method not implemented.")}}normalizeAndQuantizeUnsigned(e,t){return this.normalizeAndQuantizeUnsignedFunc(e,t)}unquantizeAndDenormalizeUnsigned(e,t){return this.denormalizeAndUnquantizeUnsignedFunc(e,t)}normalizeAndQuantizeSigned(e,t){return this.normalizeAndQuantizeSignedFunc(e,t)}setupNormalizeAndQuantize(){if(this.videoElementParent=this.videoElementProvider.getVideoParentElement(),this.videoElement=this.videoElementProvider.getVideoElement(),this.videoElementParent&&this.videoElement){const t=this.videoElementParent.clientHeight/this.videoElementParent.clientWidth,s=this.videoElement.videoHeight/this.videoElement.videoWidth;t>s?(e.Log(e.GetStackTrace(),"Setup Normalize and Quantize for playerAspectRatio > videoAspectRatio",6),this.ratio=t/s,this.normalizeAndQuantizeUnsignedFunc=(e,t)=>this.normalizeAndQuantizeUnsignedPlayerBigger(e,t),this.normalizeAndQuantizeSignedFunc=(e,t)=>this.normalizeAndQuantizeSignedPlayerBigger(e,t),this.denormalizeAndUnquantizeUnsignedFunc=(e,t)=>this.denormalizeAndUnquantizeUnsignedPlayerBigger(e,t)):(e.Log(e.GetStackTrace(),"Setup Normalize and Quantize for playerAspectRatio <= videoAspectRatio",6),this.ratio=s/t,this.normalizeAndQuantizeUnsignedFunc=(e,t)=>this.normalizeAndQuantizeUnsignedPlayerSmaller(e,t),this.normalizeAndQuantizeSignedFunc=(e,t)=>this.normalizeAndQuantizeSignedPlayerSmaller(e,t),this.denormalizeAndUnquantizeUnsignedFunc=(e,t)=>this.denormalizeAndUnquantizeUnsignedPlayerSmaller(e,t))}}normalizeAndQuantizeUnsignedPlayerBigger(e,t){const s=e/this.videoElementParent.clientWidth,n=this.ratio*(t/this.videoElementParent.clientHeight-.5)+.5;return s<0||s>1||n<0||n>1?new ht(!1,65535,65535):new ht(!0,65536*s,65536*n)}denormalizeAndUnquantizeUnsignedPlayerBigger(e,t){const s=e/65536,n=(t/65536-.5)/this.ratio+.5;return new gt(s*this.videoElementParent.clientWidth,n*this.videoElementParent.clientHeight)}normalizeAndQuantizeSignedPlayerBigger(e,t){const s=e/(.5*this.videoElementParent.clientWidth),n=this.ratio*t/(.5*this.videoElementParent.clientHeight);return new ut(32767*s,32767*n)}normalizeAndQuantizeUnsignedPlayerSmaller(e,t){const s=this.ratio*(e/this.videoElementParent.clientWidth-.5)+.5,n=t/this.videoElementParent.clientHeight;return s<0||s>1||n<0||n>1?new ht(!1,65535,65535):new ht(!0,65536*s,65536*n)}denormalizeAndUnquantizeUnsignedPlayerSmaller(e,t){const s=(e/65536-.5)/this.ratio+.5,n=t/65536;return new gt(s*this.videoElementParent.clientWidth,n*this.videoElementParent.clientHeight)}normalizeAndQuantizeSignedPlayerSmaller(e,t){const s=this.ratio*e/(.5*this.videoElementParent.clientWidth),n=t/(.5*this.videoElementParent.clientHeight);return new ut(32767*s,32767*n)}}class ht{constructor(e,t,s){this.inRange=e,this.x=t,this.y=s}}class gt{constructor(e,t){this.x=e,this.y=t}}class ut{constructor(e,t){this.x=e,this.y=t}}class mt{constructor(e,t){this.shouldShowPlayOverlay=!0,this.autoJoinTimer=void 0,this.config=e,this.pixelStreaming=t,this.responseController=new ot,this.file=new Ve,this.sdpConstraints={offerToReceiveAudio:!0,offerToReceiveVideo:!0},this.afkController=new Te(this.config,this.pixelStreaming,this.onAfkTriggered.bind(this)),this.afkController.onAFKTimedOutCallback=()=>{this.closeSignalingServer("You have been disconnected due to inactivity")},this.freezeFrameController=new y(this.pixelStreaming.videoElementParent),this.videoPlayer=new rt(this.pixelStreaming.videoElementParent,this.config),this.videoPlayer.onVideoInitialized=()=>this.handleVideoInitialized(),this.videoPlayer.onMatchViewportResolutionCallback=(e,t)=>{const s={"Resolution.Width":e,"Resolution.Height":t};this.streamMessageController.toStreamerHandlers.get("Command")([JSON.stringify(s)])},this.videoPlayer.onResizePlayerCallback=()=>{this.setUpMouseAndFreezeFrame()},this.streamController=new T(this.videoPlayer),this.coordinateConverter=new ct(this.videoPlayer),this.sendrecvDataChannelController=new Ee,this.recvDataChannelController=new Ee,this.registerDataChannelEventEmitters(this.sendrecvDataChannelController),this.registerDataChannelEventEmitters(this.recvDataChannelController),this.dataChannelSender=new dt(this.sendrecvDataChannelController),this.dataChannelSender.resetAfkWarningTimerOnDataSend=()=>this.afkController.resetAfkWarningTimer(),this.streamMessageController=new it,this.webSocketController=new f,this.webSocketController.onConfig=e=>this.handleOnConfigMessage(e),this.webSocketController.onStreamerList=e=>this.handleStreamerListMessage(e),this.webSocketController.onPlayerCount=e=>{this.pixelStreaming._onPlayerCount(e.count)},this.webSocketController.onOpen.addEventListener("open",(()=>{this.config.isFlagEnabled(ce.BrowserSendOffer)||this.webSocketController.requestStreamerObject(sessionStorage.getItem("streamerName"))})),this.webSocketController.onClose.addEventListener("close",(e=>{const t=this.shouldReconnect&&1001!=e.detail.code&&this.config.getNumericSettingValue(ge.MaxReconnectAttempts)>0,s=this.disconnectMessage?this.disconnectMessage:e.detail.reason;this.pixelStreaming._onDisconnect(s,!t&&!this.isReconnecting),this.afkController.stopAfkWarningTimer(),this.statsTimerHandle&&void 0!==this.statsTimerHandle&&window.clearInterval(this.statsTimerHandle),this.setVideoEncoderAvgQP(0),this.setTouchInputEnabled(!1),this.setMouseInputEnabled(!1),this.setKeyboardInputEnabled(!1),this.setGamePadInputEnabled(!1),t&&setTimeout((()=>{this.isReconnecting=!0,this.reconnectAttempt++,this.tryReconnect(e.detail.reason)}),2e3)})),this.sendMessageController=new at(this.dataChannelSender,this.streamMessageController),this.toStreamerMessagesController=new lt(this.sendMessageController),this.registerMessageHandlers(),this.streamMessageController.populateDefaultProtocol(),this.inputClassesFactory=new st(this.streamMessageController,this.videoPlayer,this.coordinateConverter),this.isUsingSFU=!1,this.isQualityController=!1,this.preferredCodec="",this.shouldReconnect=!0,this.isReconnecting=!1,this.reconnectAttempt=0,this.config._addOnOptionSettingChangedListener(pe.StreamerId,(e=>{""!==e&&(this.peerConnectionController.peerConnection.close(),this.peerConnectionController.createPeerConnection(this.peerConfig,this.preferredCodec),this.subscribedStream=e,this.webSocketController.sendSubscribe(e))})),this.setVideoEncoderAvgQP(-1),this.signallingUrlBuilder=()=>{let e=this.config.getTextSettingValue(me.SignallingServerUrl);return this.config.isFlagEnabled(ce.BrowserSendOffer)&&(e+="?"+ce.BrowserSendOffer+"=true"),e}}requestUnquantizedAndDenormalizeUnsigned(e,t){return this.coordinateConverter.unquantizeAndDenormalizeUnsigned(e,t)}handleOnMessage(t){const s=new Uint8Array(t.data);e.Log(e.GetStackTrace(),"Message incoming:"+s,6);const n=this.streamMessageController.fromStreamerMessages.get(s[0]);this.streamMessageController.fromStreamerHandlers.get(n)(t.data)}registerMessageHandlers(){this.streamMessageController.registerMessageHandler(Oe.FromStreamer,"QualityControlOwnership",(e=>this.onQualityControlOwnership(e))),this.streamMessageController.registerMessageHandler(Oe.FromStreamer,"Response",(e=>this.responseController.onResponse(e))),this.streamMessageController.registerMessageHandler(Oe.FromStreamer,"Command",(e=>{this.onCommand(e)})),this.streamMessageController.registerMessageHandler(Oe.FromStreamer,"FreezeFrame",(e=>this.onFreezeFrameMessage(e))),this.streamMessageController.registerMessageHandler(Oe.FromStreamer,"UnfreezeFrame",(()=>this.invalidateFreezeFrameAndEnableVideo())),this.streamMessageController.registerMessageHandler(Oe.FromStreamer,"VideoEncoderAvgQP",(e=>this.handleVideoEncoderAvgQP(e))),this.streamMessageController.registerMessageHandler(Oe.FromStreamer,"LatencyTest",(e=>this.handleLatencyTestResult(e))),this.streamMessageController.registerMessageHandler(Oe.FromStreamer,"DataChannelLatencyTest",(e=>this.handleDataChannelLatencyTestResponse(e))),this.streamMessageController.registerMessageHandler(Oe.FromStreamer,"InitialSettings",(e=>this.handleInitialSettings(e))),this.streamMessageController.registerMessageHandler(Oe.FromStreamer,"FileExtension",(e=>this.onFileExtension(e))),this.streamMessageController.registerMessageHandler(Oe.FromStreamer,"FileMimeType",(e=>this.onFileMimeType(e))),this.streamMessageController.registerMessageHandler(Oe.FromStreamer,"FileContents",(e=>this.onFileContents(e))),this.streamMessageController.registerMessageHandler(Oe.FromStreamer,"TestEcho",(()=>{})),this.streamMessageController.registerMessageHandler(Oe.FromStreamer,"InputControlOwnership",(e=>this.onInputControlOwnership(e))),this.streamMessageController.registerMessageHandler(Oe.FromStreamer,"GamepadResponse",(e=>this.onGamepadResponse(e))),this.streamMessageController.registerMessageHandler(Oe.FromStreamer,"Protocol",(e=>this.onProtocolMessage(e))),this.streamMessageController.registerMessageHandler(Oe.ToStreamer,"IFrameRequest",(()=>this.sendMessageController.sendMessageToStreamer("IFrameRequest"))),this.streamMessageController.registerMessageHandler(Oe.ToStreamer,"RequestQualityControl",(()=>this.sendMessageController.sendMessageToStreamer("RequestQualityControl"))),this.streamMessageController.registerMessageHandler(Oe.ToStreamer,"FpsRequest",(()=>this.sendMessageController.sendMessageToStreamer("FpsRequest"))),this.streamMessageController.registerMessageHandler(Oe.ToStreamer,"AverageBitrateRequest",(()=>this.sendMessageController.sendMessageToStreamer("AverageBitrateRequest"))),this.streamMessageController.registerMessageHandler(Oe.ToStreamer,"StartStreaming",(()=>this.sendMessageController.sendMessageToStreamer("StartStreaming"))),this.streamMessageController.registerMessageHandler(Oe.ToStreamer,"StopStreaming",(()=>this.sendMessageController.sendMessageToStreamer("StopStreaming"))),this.streamMessageController.registerMessageHandler(Oe.ToStreamer,"LatencyTest",(e=>this.sendMessageController.sendMessageToStreamer("LatencyTest",e))),this.streamMessageController.registerMessageHandler(Oe.ToStreamer,"RequestInitialSettings",(()=>this.sendMessageController.sendMessageToStreamer("RequestInitialSettings"))),this.streamMessageController.registerMessageHandler(Oe.ToStreamer,"TestEcho",(()=>{})),this.streamMessageController.registerMessageHandler(Oe.ToStreamer,"UIInteraction",(e=>this.sendMessageController.sendMessageToStreamer("UIInteraction",e))),this.streamMessageController.registerMessageHandler(Oe.ToStreamer,"Command",(e=>this.sendMessageController.sendMessageToStreamer("Command",e))),this.streamMessageController.registerMessageHandler(Oe.ToStreamer,"TextboxEntry",(e=>this.sendMessageController.sendMessageToStreamer("TextboxEntry",e))),this.streamMessageController.registerMessageHandler(Oe.ToStreamer,"KeyDown",(e=>this.sendMessageController.sendMessageToStreamer("KeyDown",e))),this.streamMessageController.registerMessageHandler(Oe.ToStreamer,"KeyUp",(e=>this.sendMessageController.sendMessageToStreamer("KeyUp",e))),this.streamMessageController.registerMessageHandler(Oe.ToStreamer,"KeyPress",(e=>this.sendMessageController.sendMessageToStreamer("KeyPress",e))),this.streamMessageController.registerMessageHandler(Oe.ToStreamer,"MouseEnter",(e=>this.sendMessageController.sendMessageToStreamer("MouseEnter",e))),this.streamMessageController.registerMessageHandler(Oe.ToStreamer,"MouseLeave",(e=>this.sendMessageController.sendMessageToStreamer("MouseLeave",e))),this.streamMessageController.registerMessageHandler(Oe.ToStreamer,"MouseDown",(e=>this.sendMessageController.sendMessageToStreamer("MouseDown",e))),this.streamMessageController.registerMessageHandler(Oe.ToStreamer,"MouseUp",(e=>this.sendMessageController.sendMessageToStreamer("MouseUp",e))),this.streamMessageController.registerMessageHandler(Oe.ToStreamer,"MouseMove",(e=>this.sendMessageController.sendMessageToStreamer("MouseMove",e))),this.streamMessageController.registerMessageHandler(Oe.ToStreamer,"MouseWheel",(e=>this.sendMessageController.sendMessageToStreamer("MouseWheel",e))),this.streamMessageController.registerMessageHandler(Oe.ToStreamer,"MouseDouble",(e=>this.sendMessageController.sendMessageToStreamer("MouseDouble",e))),this.streamMessageController.registerMessageHandler(Oe.ToStreamer,"TouchStart",(e=>this.sendMessageController.sendMessageToStreamer("TouchStart",e))),this.streamMessageController.registerMessageHandler(Oe.ToStreamer,"TouchEnd",(e=>this.sendMessageController.sendMessageToStreamer("TouchEnd",e))),this.streamMessageController.registerMessageHandler(Oe.ToStreamer,"TouchMove",(e=>this.sendMessageController.sendMessageToStreamer("TouchMove",e))),this.streamMessageController.registerMessageHandler(Oe.ToStreamer,"GamepadConnected",(()=>this.sendMessageController.sendMessageToStreamer("GamepadConnected"))),this.streamMessageController.registerMessageHandler(Oe.ToStreamer,"GamepadButtonPressed",(e=>this.sendMessageController.sendMessageToStreamer("GamepadButtonPressed",e))),this.streamMessageController.registerMessageHandler(Oe.ToStreamer,"GamepadButtonReleased",(e=>this.sendMessageController.sendMessageToStreamer("GamepadButtonReleased",e))),this.streamMessageController.registerMessageHandler(Oe.ToStreamer,"GamepadAnalog",(e=>this.sendMessageController.sendMessageToStreamer("GamepadAnalog",e))),this.streamMessageController.registerMessageHandler(Oe.ToStreamer,"GamepadDisconnected",(e=>this.sendMessageController.sendMessageToStreamer("GamepadDisconnected",e))),this.streamMessageController.registerMessageHandler(Oe.ToStreamer,"XRHMDTransform",(e=>this.sendMessageController.sendMessageToStreamer("XRHMDTransform",e))),this.streamMessageController.registerMessageHandler(Oe.ToStreamer,"XRControllerTransform",(e=>this.sendMessageController.sendMessageToStreamer("XRControllerTransform",e))),this.streamMessageController.registerMessageHandler(Oe.ToStreamer,"XRSystem",(e=>this.sendMessageController.sendMessageToStreamer("XRSystem",e))),this.streamMessageController.registerMessageHandler(Oe.ToStreamer,"XRButtonTouched",(e=>this.sendMessageController.sendMessageToStreamer("XRButtonTouched",e))),this.streamMessageController.registerMessageHandler(Oe.ToStreamer,"XRButtonPressed",(e=>this.sendMessageController.sendMessageToStreamer("XRButtonPressed",e))),this.streamMessageController.registerMessageHandler(Oe.ToStreamer,"XRButtonReleased",(e=>this.sendMessageController.sendMessageToStreamer("XRButtonReleased",e))),this.streamMessageController.registerMessageHandler(Oe.ToStreamer,"XRAnalog",(e=>this.sendMessageController.sendMessageToStreamer("XRAnalog",e)))}onCommand(t){e.Log(e.GetStackTrace(),"DataChannelReceiveMessageType.Command",6);const s=new TextDecoder("utf-16").decode(t.slice(1));e.Log(e.GetStackTrace(),"Data Channel Command: "+s,6);const n=JSON.parse(s);"onScreenKeyboard"===n.command&&this.pixelStreaming._activateOnScreenKeyboard(n)}onProtocolMessage(t){try{const s=new TextDecoder("utf-16").decode(t.slice(1)),n=JSON.parse(s);Object.prototype.hasOwnProperty.call(n,"Direction")||e.Error(e.GetStackTrace(),"Malformed protocol received. Ensure the protocol message contains a direction");const r=n.Direction;delete n.Direction,e.Log(e.GetStackTrace(),`Received new ${r==Oe.FromStreamer?"FromStreamer":"ToStreamer"} protocol. Updating existing protocol...(更新现有协议)`),Object.keys(n).forEach((t=>{const s=n[t];switch(r){case Oe.ToStreamer:if(!Object.prototype.hasOwnProperty.call(s,"id"))return void e.Error(e.GetStackTrace(),`ToStreamer->${t} protocol definition was malformed as it didn't contain at least an id\n\n Definition was: ${JSON.stringify(s,null,2)}`);if("UIInteraction"===t||"Command"===t||"LatencyTest"===t)return;this.streamMessageController.toStreamerHandlers.get(t)?this.streamMessageController.toStreamerMessages.set(t,s):e.Error(e.GetStackTrace(),`There was no registered handler for "${t}" - try adding one using registerMessageHandler(MessageDirection.ToStreamer, "${t}", myHandler)`);break;case Oe.FromStreamer:if(!Object.prototype.hasOwnProperty.call(s,"id"))return void e.Error(e.GetStackTrace(),`FromStreamer->${t} protocol definition was malformed as it didn't contain at least an id\n\n Definition was: ${JSON.stringify(s,null,2)}`);this.streamMessageController.fromStreamerHandlers.get(t)?this.streamMessageController.fromStreamerMessages.set(s.id,t):e.Error(e.GetStackTrace(),`There was no registered handler for "${s}" - try adding one using registerMessageHandler(MessageDirection.FromStreamer, "${t}", myHandler)`);break;default:e.Error(e.GetStackTrace(),`Unknown direction: ${r}`)}})),this.toStreamerMessagesController.SendRequestInitialSettings(),this.toStreamerMessagesController.SendRequestQualityControl()}catch(t){e.Log(e.GetStackTrace(),t)}}onInputControlOwnership(t){const s=new Uint8Array(t);e.Log(e.GetStackTrace(),"DataChannelReceiveMessageType.InputControlOwnership",6);const n=new Boolean(s[1]).valueOf();e.Log(e.GetStackTrace(),`Received input controller message - will your input control the stream: ${n}`),this.pixelStreaming._onInputControlOwnership(n)}onGamepadResponse(e){const t=new TextDecoder("utf-16").decode(e.slice(1)),s=JSON.parse(t);this.gamePadController.onGamepadResponseReceived(s.controllerId)}onAfkTriggered(){this.afkController.onAfkClick(),this.videoPlayer.isPaused()&&this.videoPlayer.hasVideoSource()&&this.playStream()}setAfkEnabled(e){e?this.onAfkTriggered():this.afkController.stopAfkWarningTimer()}tryReconnect(t){this.webSocketController?(this.isReconnecting=!0,this.webSocketController.webSocket&&this.webSocketController.webSocket.readyState!=WebSocket.CLOSED?(this.closeSignalingServer(`${t} Restarting stream...`),setTimeout((()=>{this.tryReconnect(t)}),3e3)):(this.pixelStreaming._onWebRtcAutoConnect(),this.connectToSignallingServer())):e.Log(e.GetStackTrace(),"The Web Socket Controller does not exist so this will not work right now.")}loadFreezeFrameOrShowPlayOverlay(){this.pixelStreaming.dispatchEvent(new j({shouldShowPlayOverlay:this.shouldShowPlayOverlay,isValid:this.freezeFrameController.valid,jpegData:this.freezeFrameController.jpeg})),!0===this.shouldShowPlayOverlay?(e.Log(e.GetStackTrace(),"showing play overlay"),this.resizePlayerStyle()):(e.Log(e.GetStackTrace(),"showing freeze frame"),this.freezeFrameController.showFreezeFrame()),setTimeout((()=>{this.videoPlayer.setVideoEnabled(!1)}),this.freezeFrameController.freezeFrameDelay)}onFreezeFrameMessage(t){e.Log(e.GetStackTrace(),"DataChannelReceiveMessageType.FreezeFrame",6);const s=new Uint8Array(t);this.freezeFrameController.processFreezeFrameMessage(s,(()=>this.loadFreezeFrameOrShowPlayOverlay()))}invalidateFreezeFrameAndEnableVideo(){e.Log(e.GetStackTrace(),"DataChannelReceiveMessageType.FreezeFrame",6),setTimeout((()=>{this.pixelStreaming.dispatchEvent(new J),this.freezeFrameController.hideFreezeFrame()}),this.freezeFrameController.freezeFrameDelay),this.videoPlayer.getVideoElement()&&this.videoPlayer.setVideoEnabled(!0)}onFileExtension(e){const t=new Uint8Array(e);We.setExtensionFromBytes(t,this.file)}onFileMimeType(e){const t=new Uint8Array(e);We.setMimeTypeFromBytes(t,this.file)}onFileContents(e){const t=new Uint8Array(e);We.setContentsFromBytes(t,this.file)}playStream(){if(!this.videoPlayer.getVideoElement()){const t="Could not play video stream because the video player was not initialized correctly.";return this.pixelStreaming.dispatchEvent(new q({message:t})),e.Error(e.GetStackTrace(),t),void this.closeSignalingServer("Stream not initialized correctly")}if(this.videoPlayer.hasVideoSource()){if(this.setTouchInputEnabled(this.config.isFlagEnabled(ce.TouchInput)),this.pixelStreaming.dispatchEvent(new $),this.streamController.audioElement.srcObject){const t=this.config.isFlagEnabled(ce.StartVideoMuted);this.streamController.audioElement.muted=t,t?this.playVideo():this.streamController.audioElement.play().then((()=>{this.playVideo()})).catch((t=>{e.Log(e.GetStackTrace(),t),e.Log(e.GetStackTrace(),"Browser does not support autoplaying video without interaction - to resolve this we are going to show the play button overlay."),this.pixelStreaming.dispatchEvent(new X({reason:t}))}))}else this.playVideo();this.shouldShowPlayOverlay=!1,this.freezeFrameController.showFreezeFrame()}else e.Warning(e.GetStackTrace(),"Cannot play stream, the video element has no srcObject to play.")}playVideo(){this.videoPlayer.play().catch((t=>{this.streamController.audioElement.srcObject&&this.streamController.audioElement.pause(),e.Log(e.GetStackTrace(),t),e.Log(e.GetStackTrace(),"Browser does not support autoplaying video without interaction - to resolve this we are going to show the play button overlay."),this.pixelStreaming.dispatchEvent(new X({reason:t}))}))}autoPlayVideoOrSetUpPlayOverlay(){this.config.isFlagEnabled(ce.AutoPlayVideo)&&this.playStream(),this.resizePlayerStyle()}connectToSignallingServer(){this.locallyClosed=!1,this.shouldReconnect=!0,this.disconnectMessage=null;const e=this.signallingUrlBuilder();this.webSocketController.connect(e)}startSession(t){if(this.peerConfig=t,this.config.isFlagEnabled(ce.ForceTURN)&&!this.checkTurnServerAvailability(t))return e.Info(e.GetStackTrace(),"No turn server was found in the Peer Connection Options. TURN cannot be forced, closing connection. Please use STUN instead"),void this.closeSignalingServer("TURN cannot be forced, closing connection. Please use STUN instead.");this.peerConnectionController=new Ge(this.peerConfig,this.config,this.preferredCodec),this.peerConnectionController.onVideoStats=e=>this.handleVideoStats(e),this.peerConnectionController.onSendWebRTCOffer=e=>this.handleSendWebRTCOffer(e),this.peerConnectionController.onSendWebRTCAnswer=e=>this.handleSendWebRTCAnswer(e),this.peerConnectionController.onPeerIceCandidate=e=>this.handleSendIceCandidate(e),this.peerConnectionController.onDataChannel=e=>this.handleDataChannel(e),this.peerConnectionController.showTextOverlayConnecting=()=>this.pixelStreaming._onWebRtcConnecting(),this.peerConnectionController.showTextOverlaySetupFailure=()=>this.pixelStreaming._onWebRtcFailed();let s=!1;this.peerConnectionController.onIceConnectionStateChange=()=>{!s&&["connected","completed"].includes(this.peerConnectionController.peerConnection.iceConnectionState)&&(this.pixelStreaming._onWebRtcConnected(),s=!0)},this.peerConnectionController.onTrack=e=>this.streamController.handleOnTrack(e),this.config.isFlagEnabled(ce.BrowserSendOffer)&&(this.sendrecvDataChannelController.createDataChannel(this.peerConnectionController.peerConnection,"cirrus",this.datachannelOptions),this.sendrecvDataChannelController.handleOnMessage=e=>this.handleOnMessage(e),this.peerConnectionController.createOffer(this.sdpConstraints,this.config))}checkTurnServerAvailability(t){if(!t.iceServers)return e.Info(e.GetStackTrace(),"A turn sever was not found"),!1;for(const s of t.iceServers)for(const t of s.urls)if(t.includes("turn"))return e.Log(e.GetStackTrace(),`A turn sever was found at ${t}`),!0;return e.Info(e.GetStackTrace(),"A turn sever was not found"),!1}handleOnConfigMessage(e){this.resizePlayerStyle(),this.startSession(e.peerConnectionOptions),this.webSocketController.onWebRtcAnswer=e=>this.handleWebRtcAnswer(e),this.webSocketController.onWebRtcOffer=e=>this.handleWebRtcOffer(e),this.webSocketController.onWebRtcPeerDataChannels=e=>this.handleWebRtcSFUPeerDatachannels(e),this.webSocketController.onIceCandidate=e=>this.handleIceCandidate(e)}handleStreamerListMessage(t){var s;console.log(t,"====="),e.Log(e.GetStackTrace(),`Got streamer list ${t.ids}`,6);const n=null!==(s=t.streamerBusyList)&&void 0!==s?s:[];if(n.length>0){if(console.log(window.location.href,"======"),-1!==window.location.href.indexOf("home"))return;window.confirm("监测到当前窗口有人在使用,是否强制进入?")&&this.webSocketController.sendSubscribe(n[0].streamerId)}const r=[...t.ids];console.log(r),this.config.setOptionSettingOptions(pe.StreamerId,r);let i=null,o=null;const a=this.config.isFlagEnabled(ce.WaitForStreamer),l=this.config.getNumericSettingValue(ge.MaxReconnectAttempts),d=this.config.getNumericSettingValue(ge.StreamerAutoJoinInterval),c=new URLSearchParams(window.location.search);c.has(pe.StreamerId)?i=c.get(pe.StreamerId):this.subscribedStream&&(i=this.subscribedStream),i&&t.ids.includes(i)?o=i:i&&a||1!=t.ids.length||(o=t.ids[0]),o?(this.isReconnecting=!1,this.reconnectAttempt=0,this.config.setOptionSettingValue(pe.StreamerId,o)):a&&(this.reconnectAttempt<l?(this.isReconnecting=!0,this.reconnectAttempt++,setTimeout((()=>{this.webSocketController.requestStreamerList()}),d)):(this.reconnectAttempt=0,this.isReconnecting=!1,this.shouldReconnect=!1)),this.pixelStreaming.dispatchEvent(new Z({messageStreamerList:t,autoSelectedStreamerId:o,wantedStreamerId:i}))}handleWebRtcAnswer(t){e.Log(e.GetStackTrace(),`Got answer sdp ${t.sdp}`,6);const s={sdp:t.sdp,type:"answer"};this.peerConnectionController.receiveAnswer(s),this.handlePostWebrtcNegotiation()}handleWebRtcOffer(t){e.Log(e.GetStackTrace(),`Got offer sdp ${t.sdp}`,6),this.isUsingSFU=!!t.sfu&&t.sfu,this.isUsingSFU&&(this.peerConnectionController.preferredCodec="");const s={sdp:t.sdp,type:"offer"};this.peerConnectionController.receiveOffer(s,this.config),this.handlePostWebrtcNegotiation()}handleWebRtcSFUPeerDatachannels(e){const t={ordered:!0,negotiated:!0,id:e.sendStreamId},s=e.sendStreamId!=e.recvStreamId;if(this.sendrecvDataChannelController.createDataChannel(this.peerConnectionController.peerConnection,s?"send-datachannel":"datachannel",t),s){const t={ordered:!0,negotiated:!0,id:e.recvStreamId};this.recvDataChannelController.createDataChannel(this.peerConnectionController.peerConnection,"recv-datachannel",t),this.recvDataChannelController.handleOnOpen=()=>this.webSocketController.sendSFURecvDataChannelReady(),this.recvDataChannelController.handleOnMessage=e=>this.handleOnMessage(e)}else this.sendrecvDataChannelController.handleOnMessage=e=>this.handleOnMessage(e)}handlePostWebrtcNegotiation(){this.afkController.startAfkWarningTimer(),this.pixelStreaming._onWebRtcSdp(),this.statsTimerHandle&&void 0!==this.statsTimerHandle&&window.clearInterval(this.statsTimerHandle),this.statsTimerHandle=window.setInterval((()=>this.getStats()),1e3),this.setMouseInputEnabled(this.config.isFlagEnabled(ce.MouseInput)),this.setKeyboardInputEnabled(this.config.isFlagEnabled(ce.KeyboardInput)),this.setGamePadInputEnabled(this.config.isFlagEnabled(ce.GamepadInput))}handleIceCandidate(t){e.Log(e.GetStackTrace(),"Web RTC Controller: onWebRtcIce",6);const s=new RTCIceCandidate(t);this.peerConnectionController.handleOnIce(s)}handleSendIceCandidate(t){e.Log(e.GetStackTrace(),"OnIceCandidate",6),t.candidate&&t.candidate.candidate&&this.webSocketController.sendIceCandidate(t.candidate)}handleDataChannel(t){e.Log(e.GetStackTrace(),"Data channel created for us by browser as we are a receiving peer.",6),this.sendrecvDataChannelController.dataChannel=t.channel,this.sendrecvDataChannelController.setupDataChannel(),this.sendrecvDataChannelController.handleOnMessage=e=>this.handleOnMessage(e)}handleSendWebRTCOffer(t){e.Log(e.GetStackTrace(),"Sending the offer to the Server",6),this.webSocketController.sendWebRtcOffer(t)}handleSendWebRTCAnswer(t){e.Log(e.GetStackTrace(),"Sending the answer to the Server",6),this.webSocketController.sendWebRtcAnswer(t),this.isUsingSFU&&this.webSocketController.sendWebRtcDatachannelRequest()}setUpMouseAndFreezeFrame(){this.videoElementParentClientRect=this.videoPlayer.getVideoParentElement().getBoundingClientRect(),this.coordinateConverter.setupNormalizeAndQuantize(),this.freezeFrameController.freezeFrame.resize()}closeSignalingServer(e){var t;this.locallyClosed=!0,this.shouldReconnect=!1,this.disconnectMessage=e,null===(t=this.webSocketController)||void 0===t||t.close()}closePeerConnection(){var e;null===(e=this.peerConnectionController)||void 0===e||e.close()}close(){this.closeSignalingServer(""),this.closePeerConnection()}getStats(){this.peerConnectionController.generateStats()}sendLatencyTest(){this.latencyStartTime=Date.now(),this.streamMessageController.toStreamerHandlers.get("LatencyTest")([JSON.stringify({StartTime:this.latencyStartTime})])}sendDataChannelLatencyTest(e){this.streamMessageController.toStreamerHandlers.get("DataChannelLatencyTest")([JSON.stringify(e)])}sendEncoderMinQP(t){e.Log(e.GetStackTrace(),`MinQP=${t}\n`,6),null!=t&&this.streamMessageController.toStreamerHandlers.get("Command")([JSON.stringify({"Encoder.MinQP":t})])}sendEncoderMaxQP(t){e.Log(e.GetStackTrace(),`MaxQP=${t}\n`,6),null!=t&&this.streamMessageController.toStreamerHandlers.get("Command")([JSON.stringify({"Encoder.MaxQP":t})])}sendWebRTCMinBitrate(t){e.Log(e.GetStackTrace(),`WebRTC Min Bitrate=${t}`,6),null!=t&&this.streamMessageController.toStreamerHandlers.get("Command")([JSON.stringify({"WebRTC.MinBitrate":t})])}sendWebRTCMaxBitrate(t){e.Log(e.GetStackTrace(),`WebRTC Max Bitrate=${t}`,6),null!=t&&this.streamMessageController.toStreamerHandlers.get("Command")([JSON.stringify({"WebRTC.MaxBitrate":t})])}sendWebRTCFps(t){e.Log(e.GetStackTrace(),`WebRTC FPS=${t}`,6),null!=t&&(this.streamMessageController.toStreamerHandlers.get("Command")([JSON.stringify({"WebRTC.Fps":t})]),this.streamMessageController.toStreamerHandlers.get("Command")([JSON.stringify({"WebRTC.MaxFps":t})]))}sendShowFps(){e.Log(e.GetStackTrace(),"---- Sending show stat to UE ----",6),this.streamMessageController.toStreamerHandlers.get("Command")([JSON.stringify({"stat.fps":""})])}sendIframeRequest(){e.Log(e.GetStackTrace(),"---- Sending Request for an IFrame ----",6),this.streamMessageController.toStreamerHandlers.get("IFrameRequest")()}emitUIInteraction(t){e.Log(e.GetStackTrace(),"---- Sending custom UIInteraction message ----",6),this.streamMessageController.toStreamerHandlers.get("UIInteraction")([JSON.stringify(t)])}emitCommand(t){e.Log(e.GetStackTrace(),"---- Sending custom Command message ----",6),this.streamMessageController.toStreamerHandlers.get("Command")([JSON.stringify(t)])}emitConsoleCommand(t){e.Log(e.GetStackTrace(),"---- Sending custom Command:ConsoleCommand message ----",6),this.streamMessageController.toStreamerHandlers.get("Command")([JSON.stringify({ConsoleCommand:t})])}sendRequestQualityControlOwnership(){e.Log(e.GetStackTrace(),"---- Sending Request to Control Quality ----",6),this.toStreamerMessagesController.SendRequestQualityControl()}handleLatencyTestResult(t){e.Log(e.GetStackTrace(),"DataChannelReceiveMessageType.latencyTest",6);const s=new TextDecoder("utf-16").decode(t.slice(1)),n=new He;Object.assign(n,JSON.parse(s)),n.processFields(),n.testStartTimeMs=this.latencyStartTime,n.browserReceiptTimeMs=Date.now(),n.latencyExcludingDecode=~~(n.browserReceiptTimeMs-n.testStartTimeMs),n.testDuration=~~(n.TransmissionTimeMs-n.ReceiptTimeMs),n.networkLatency=~~(n.latencyExcludingDecode-n.testDuration),n.frameDisplayDeltaTimeMs&&n.browserReceiptTimeMs&&(n.endToEndLatency=(n.frameDisplayDeltaTimeMs,n.networkLatency,~~+n.CaptureToSendMs)),this.pixelStreaming._onLatencyTestResult(n)}handleDataChannelLatencyTestResponse(t){e.Log(e.GetStackTrace(),"DataChannelReceiveMessageType.dataChannelLatencyResponse",6);const s=new TextDecoder("utf-16").decode(t.slice(1)),n=JSON.parse(s);this.pixelStreaming._onDataChannelLatencyTestResponse(n)}handleInitialSettings(t){e.Log(e.GetStackTrace(),"DataChannelReceiveMessageType.InitialSettings",6);const s=new TextDecoder("utf-16").decode(t.slice(1)),n=JSON.parse(s),r=new Ue;n.Encoder&&(r.EncoderSettings=n.Encoder),n.WebRTC&&(r.WebRTCSettings=n.WebRTC),n.PixelStreaming&&(r.PixelStreamingSettings=n.PixelStreaming),n.ConfigOptions&&void 0!==n.ConfigOptions.DefaultToHover&&this.config.setFlagEnabled(ce.HoveringMouseMode,!!n.ConfigOptions.DefaultToHover),r.ueCompatible(),e.Log(e.GetStackTrace(),s,6),this.pixelStreaming._onInitialSettings(r)}handleVideoEncoderAvgQP(t){e.Log(e.GetStackTrace(),"DataChannelReceiveMessageType.VideoEncoderAvgQP",6);const s=Number(new TextDecoder("utf-16").decode(t.slice(1)));this.setVideoEncoderAvgQP(s)}handleVideoInitialized(){this.pixelStreaming._onVideoInitialized(),this.autoPlayVideoOrSetUpPlayOverlay(),this.resizePlayerStyle(),this.videoPlayer.updateVideoStreamSize()}onQualityControlOwnership(t){const s=new Uint8Array(t);e.Log(e.GetStackTrace(),"DataChannelReceiveMessageType.QualityControlOwnership",6),this.isQualityController=new Boolean(s[1]).valueOf(),e.Log(e.GetStackTrace(),`Received quality controller message, will control quality: ${this.isQualityController}`),this.pixelStreaming._onQualityControlOwnership(this.isQualityController)}handleVideoStats(e){this.pixelStreaming._onVideoStats(e)}resizePlayerStyle(){this.videoPlayer.resizePlayerStyle()}setPreferredCodec(e){this.preferredCodec=e,this.peerConnectionController&&(this.peerConnectionController.preferredCodec=e,this.peerConnectionController.updateCodecSelection=!1)}setVideoEncoderAvgQP(e){this.videoAvgQp=e,this.pixelStreaming._onVideoEncoderAvgQP(this.videoAvgQp)}setKeyboardInputEnabled(e){var t;null===(t=this.keyboardController)||void 0===t||t.unregisterKeyBoardEvents(),e&&(this.keyboardController=this.inputClassesFactory.registerKeyBoard(this.config))}setMouseInputEnabled(e){var t;if(null===(t=this.mouseController)||void 0===t||t.unregisterMouseEvents(),e){const e=this.config.isFlagEnabled(ce.HoveringMouseMode)?fe.HoveringMouse:fe.LockedMouse;this.mouseController=this.inputClassesFactory.registerMouse(e)}}setTouchInputEnabled(e){var t;null===(t=this.touchController)||void 0===t||t.unregisterTouchEvents(),e&&(this.touchController=this.inputClassesFactory.registerTouch(this.config.isFlagEnabled(ce.FakeMouseWithTouches),this.videoElementParentClientRect))}setGamePadInputEnabled(e){var t;null===(t=this.gamePadController)||void 0===t||t.unregisterGamePadEvents(),e&&(this.gamePadController=this.inputClassesFactory.registerGamePad(),this.gamePadController.onGamepadConnected=()=>{this.streamMessageController.toStreamerHandlers.get("GamepadConnected")()},this.gamePadController.onGamepadDisconnected=e=>{this.streamMessageController.toStreamerHandlers.get("GamepadDisconnected")([e])})}registerDataChannelEventEmitters(e){e.onOpen=(e,t)=>this.pixelStreaming.dispatchEvent(new B({label:e,event:t})),e.onClose=(e,t)=>this.pixelStreaming.dispatchEvent(new _({label:e,event:t})),e.onError=(e,t)=>this.pixelStreaming.dispatchEvent(new H({label:e,event:t}))}registerMessageHandler(t,s,n){s===Oe.FromStreamer&&void 0===n&&e.Warning(e.GetStackTrace(),`Unable to register handler for ${t} as no handler was passed`),this.streamMessageController.registerMessageHandler(s,t,(e=>void 0===n&&s===Oe.ToStreamer?this.sendMessageController.sendMessageToStreamer(t,e):n(e)))}}class St{static vertexShader(){return"\n\t\tattribute vec2 a_position;\n\t\tattribute vec2 a_texCoord;\n\n\t\t// input\n\t\tuniform vec2 u_resolution;\n\t\tuniform vec4 u_offset;\n\n\t\t//\n\t\tvarying vec2 v_texCoord;\n\n\t\tvoid main() {\n\t\t // convert the rectangle from pixels to 0.0 to 1.0\n\t\t vec2 zeroToOne = a_position / u_resolution;\n\n\t\t // convert from 0->1 to 0->2\n\t\t vec2 zeroToTwo = zeroToOne * 2.0;\n\n\t\t // convert from 0->2 to -1->+1 (clipspace)\n\t\t vec2 clipSpace = zeroToTwo - 1.0;\n\n\t\t gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1);\n\t\t // pass the texCoord to the fragment shader\n\t\t // The GPU will interpolate this value between points.\n\t\t v_texCoord = (a_texCoord * u_offset.xy) + u_offset.zw;\n\t\t}\n\t\t"}static fragmentShader(){return"\n\t\tprecision mediump float;\n\n\t\t// our texture\n\t\tuniform sampler2D u_image;\n\n\t\t// the texCoords passed in from the vertex shader.\n\t\tvarying vec2 v_texCoord;\n\n\t\tvoid main() {\n\t\t gl_FragColor = texture2D(u_image, v_texCoord);\n\t\t}\n\t\t"}}class pt{static deepCopyGamepad(e){return JSON.parse(JSON.stringify({buttons:e.buttons.map((e=>JSON.parse(JSON.stringify({pressed:e.pressed,touched:e.touched})))),axes:e.axes}))}}class vt{constructor(e){this.toStreamerMessagesProvider=e,this.controllers=[]}updateStatus(e,t,s){if(e.gamepad){const n=t.getPose(e.gripSpace,s);if(!n)return;let r=0;e.profiles.includes("htc-vive")?r=1:e.profiles.includes("oculus-touch")&&(r=2),this.toStreamerMessagesProvider.toStreamerHandlers.get("XRSystem")([r]);let i=2;switch(e.handedness){case"left":i=0;break;case"right":i=1}const o=n.transform.matrix,a=[];for(let e=0;e<16;e++)a[e]=new Float32Array([o[e]])[0];this.toStreamerMessagesProvider.toStreamerHandlers.get("XRControllerTransform")([a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15],i]),void 0===this.controllers[i]&&(this.controllers[i]={prevState:void 0,currentState:void 0,id:void 0},this.controllers[i].prevState=pt.deepCopyGamepad(e.gamepad)),this.controllers[i].currentState=pt.deepCopyGamepad(e.gamepad);const l=this.controllers[i],d=l.currentState,c=l.prevState;for(let e=0;e<d.buttons.length;e++){const t=d.buttons[e],s=c.buttons[e];t.pressed?this.toStreamerMessagesProvider.toStreamerHandlers.get("XRButtonPressed")([i,e,s.pressed?1:0]):!t.pressed&&s.pressed&&this.toStreamerMessagesProvider.toStreamerHandlers.get("XRButtonReleased")([i,e,0]),t.touched&&!t.pressed?this.toStreamerMessagesProvider.toStreamerHandlers.get("XRButtonPressed")([i,3,s.touched?1:0]):!t.touched&&s.touched&&this.toStreamerMessagesProvider.toStreamerHandlers.get("XRButtonReleased")([i,3,0])}for(let e=0;e<d.axes.length;e++)this.toStreamerMessagesProvider.toStreamerHandlers.get("XRAnalog")([i,e,d.axes[e]]);this.controllers[i].prevState=d}}}class Ct{constructor(e){this.xrSession=null,this.webRtcController=e,this.xrControllers=[],this.xrGamepadController=new vt(this.webRtcController.streamMessageController),this.onSessionEnded=new EventTarget,this.onSessionStarted=new EventTarget,this.onFrame=new EventTarget}xrClicked(){this.xrSession?this.xrSession.end():navigator.xr.requestSession("immersive-vr").then((e=>{this.onXrSessionStarted(e)}))}onXrSessionEnded(){e.Log(e.GetStackTrace(),"XR Session ended"),this.xrSession=null,this.onSessionEnded.dispatchEvent(new Event("xrSessionEnded"))}onXrSessionStarted(t){e.Log(e.GetStackTrace(),"XR Session started"),this.xrSession=t,this.xrSession.addEventListener("end",(()=>{this.onXrSessionEnded()}));const s=document.createElement("canvas");this.gl=s.getContext("webgl2",{xrCompatible:!0}),this.xrSession.updateRenderState({baseLayer:new XRWebGLLayer(this.xrSession,this.gl)});const n=this.gl.createShader(this.gl.VERTEX_SHADER);this.gl.shaderSource(n,St.vertexShader()),this.gl.compileShader(n);const r=this.gl.createShader(this.gl.FRAGMENT_SHADER);this.gl.shaderSource(r,St.fragmentShader()),this.gl.compileShader(r);const i=this.gl.createProgram();this.gl.attachShader(i,n),this.gl.attachShader(i,r),this.gl.linkProgram(i),this.gl.useProgram(i),this.positionLocation=this.gl.getAttribLocation(i,"a_position"),this.texcoordLocation=this.gl.getAttribLocation(i,"a_texCoord"),this.positionBuffer=this.gl.createBuffer(),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.positionBuffer),this.gl.enableVertexAttribArray(this.positionLocation);const o=this.gl.createTexture();this.gl.bindTexture(this.gl.TEXTURE_2D,o),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.NEAREST),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.NEAREST),this.texcoordBuffer=this.gl.createBuffer(),this.resolutionLocation=this.gl.getUniformLocation(i,"u_resolution"),this.offsetLocation=this.gl.getUniformLocation(i,"u_offset"),t.requestReferenceSpace("local").then((e=>{this.xrRefSpace=e,this.xrSession.requestAnimationFrame(((e,t)=>this.onXrFrame(e,t)))})),this.onSessionStarted.dispatchEvent(new Event("xrSessionStarted"))}onXrFrame(e,t){const s=t.getViewerPose(this.xrRefSpace);if(s){const e=s.transform.matrix,t=[];for(let s=0;s<16;s++)t[s]=new Float32Array([e[s]])[0];this.webRtcController.streamMessageController.toStreamerHandlers.get("XRHMDTransform")([t[0],t[4],t[8],t[12],t[1],t[5],t[9],t[13],t[2],t[6],t[10],t[14],t[3],t[7],t[11],t[15]]);const n=this.xrSession.renderState.baseLayer;this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,n.framebuffer),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,this.webRtcController.videoPlayer.getVideoElement()),this.render(this.webRtcController.videoPlayer.getVideoElement())}this.webRtcController.config.isFlagEnabled(ce.XRControllerInput)&&this.xrSession.inputSources.forEach(((e,s,n)=>{this.xrGamepadController.updateStatus(e,t,this.xrRefSpace)}),this),this.xrSession.requestAnimationFrame(((e,t)=>this.onXrFrame(e,t))),this.onFrame.dispatchEvent(new ae({time:e,frame:t}))}render(e){if(!this.gl)return;const t=this.xrSession.renderState.baseLayer;let s,n,r,i,o;this.gl.viewport(0,0,t.framebufferWidth,t.framebufferHeight),this.gl.uniform4f(this.offsetLocation,1,1,0,0),this.gl.bufferData(this.gl.ARRAY_BUFFER,new Float32Array([0,0,e.videoWidth,0,0,e.videoHeight,0,e.videoHeight,e.videoWidth,0,e.videoWidth,e.videoHeight]),this.gl.STATIC_DRAW),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.texcoordBuffer),this.gl.bufferData(this.gl.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]),this.gl.STATIC_DRAW),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.positionBuffer),s=2,n=this.gl.FLOAT,r=!1,i=0,o=0,this.gl.vertexAttribPointer(this.positionLocation,s,n,r,i,o),this.gl.enableVertexAttribArray(this.texcoordLocation),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.texcoordBuffer),s=2,n=this.gl.FLOAT,r=!1,i=0,o=0,this.gl.vertexAttribPointer(this.texcoordLocation,s,n,r,i,o),this.gl.uniform2f(this.resolutionLocation,e.videoWidth,e.videoHeight);const a=this.gl.TRIANGLES;o=0,this.gl.drawArrays(a,o,6)}static isSessionSupported(e){return navigator.xr?navigator.xr.isSessionSupported(e):new Promise((()=>!1))}}class ft{constructor(e){this.editTextButton=null,this.hiddenInput=null,"ontouchstart"in document.documentElement&&this.createOnScreenKeyboardHelpers(e)}unquantizeAndDenormalizeUnsigned(e,t){return null}createOnScreenKeyboardHelpers(e){this.hiddenInput||(this.hiddenInput=document.createElement("input"),this.hiddenInput.id="hiddenInput",this.hiddenInput.maxLength=0,e.appendChild(this.hiddenInput)),this.editTextButton||(this.editTextButton=document.createElement("button"),this.editTextButton.id="editTextButton",this.editTextButton.innerHTML="edit text",e.appendChild(this.editTextButton),this.editTextButton.classList.add("hiddenState"),this.editTextButton.addEventListener("touchend",(e=>{this.hiddenInput.focus(),e.preventDefault()})))}showOnScreenKeyboard(e){if(e.showOnScreenKeyboard){this.editTextButton.classList.remove("hiddenState");const t=this.unquantizeAndDenormalizeUnsigned(e.x,e.y);this.editTextButton.style.top=t.y.toString()+"px",this.editTextButton.style.left=(t.x-40).toString()+"px"}else this.editTextButton.classList.add("hiddenState"),this.hiddenInput.blur()}}class Tt{constructor(e){this.seq=e.Seq,this.playerSentTimestamp=Date.now(),this.requestFillerSize=e.Filler?e.Filler.length:0}update(e){this.playerReceivedTimestamp=Date.now(),this.streamerReceivedTimestamp=e.ReceivedTimestamp,this.streamerSentTimestamp=e.SentTimestamp,this.responseFillerSize=e.Filler?e.Filler.length:0}}class Et{constructor(e,t){this.sink=e,this.callback=t,this.records=new Map,this.seq=0}start(e){return!this.isRunning()&&(this.startTime=Date.now(),this.records.clear(),this.interval=setInterval((()=>{Date.now()-this.startTime>=e.duration?this.stop():this.sendRequest(e.requestSize,e.responseSize)}).bind(this),Math.floor(1e3/e.rps)),!0)}stop(){this.interval&&(clearInterval(this.interval),this.interval=void 0,this.callback(this.produceResult()))}produceResult(){const e=new Map(this.records);return{records:e,dataChannelRtt:Math.ceil(Array.from(this.records.values()).reduce(((e,t)=>e+(t.playerReceivedTimestamp-t.playerSentTimestamp)),0)/this.records.size),playerToStreamerTime:Math.ceil(Array.from(this.records.values()).reduce(((e,t)=>e+(t.streamerReceivedTimestamp-t.playerSentTimestamp)),0)/this.records.size),streamerToPlayerTime:Math.ceil(Array.from(this.records.values()).reduce(((e,t)=>e+(t.playerReceivedTimestamp-t.streamerSentTimestamp)),0)/this.records.size),exportLatencyAsCSV:()=>{let t="Timestamp;RTT;PlayerToStreamer;StreamerToPlayer;\n";return e.forEach((e=>{t+=e.playerSentTimestamp+";",t+=e.playerReceivedTimestamp-e.playerSentTimestamp+";",t+=e.streamerReceivedTimestamp-e.playerSentTimestamp+";",t+=e.playerReceivedTimestamp-e.streamerSentTimestamp+";",t+="\n"})),t}}}isRunning(){return!!this.interval}receive(t){if(!this.isRunning())return;if(!t)return void e.Error(e.GetStackTrace(),"Undefined response from server");let s=this.records.get(t.Seq);s&&s.update(t)}sendRequest(e,t){let s=this.createRequest(e,t),n=new Tt(s);this.records.set(n.seq,n),this.sink(s)}createRequest(e,t){return{Seq:this.seq++,FillResponseSize:t,Filler:e?"A".repeat(e):""}}}class yt{constructor(e,t){this.allowConsoleCommands=!1,this.config=e,(null==t?void 0:t.videoElementParent)&&(this._videoElementParent=t.videoElementParent),this._eventEmitter=new de,this.configureSettings(),this.setWebRtcPlayerController(new mt(this.config,this)),this.onScreenKeyboardHelper=new ft(this.videoElementParent),this.onScreenKeyboardHelper.unquantizeAndDenormalizeUnsigned=(e,t)=>this._webRtcController.requestUnquantizedAndDenormalizeUnsigned(e,t),this._activateOnScreenKeyboard=e=>this.onScreenKeyboardHelper.showOnScreenKeyboard(e),this._webXrController=new Ct(this._webRtcController)}get videoElementParent(){return this._videoElementParent||(this._videoElementParent=document.createElement("div"),this._videoElementParent.id="videoElementParent"),this._videoElementParent}configureSettings(){this.config._addOnSettingChangedListener(ce.IsQualityController,(e=>{!0!==e||this._webRtcController.isQualityController||this._webRtcController.sendRequestQualityControlOwnership()})),this.config._addOnSettingChangedListener(ce.AFKDetection,(e=>{this._webRtcController.setAfkEnabled(e)})),this.config._addOnSettingChangedListener(ce.MatchViewportResolution,(()=>{this._webRtcController.videoPlayer.updateVideoStreamSize()})),this.config._addOnSettingChangedListener(ce.HoveringMouseMode,(e=>{this.config.setFlagLabel(ce.HoveringMouseMode,`Control Scheme: ${e?"Hovering":"Locked"} Mouse`),this._webRtcController.setMouseInputEnabled(this.config.isFlagEnabled(ce.MouseInput))})),this.config._addOnSettingChangedListener(ce.KeyboardInput,(e=>{this._webRtcController.setKeyboardInputEnabled(e)})),this.config._addOnSettingChangedListener(ce.MouseInput,(e=>{this._webRtcController.setMouseInputEnabled(e)})),this.config._addOnSettingChangedListener(ce.TouchInput,(e=>{this._webRtcController.setTouchInputEnabled(e)})),this.config._addOnSettingChangedListener(ce.GamepadInput,(e=>{this._webRtcController.setGamePadInputEnabled(e)})),this.config._addOnNumericSettingChangedListener(ge.MinQP,(t=>{e.Log(e.GetStackTrace(),"-------- Sending MinQP --------",7),this._webRtcController.sendEncoderMinQP(t),e.Log(e.GetStackTrace(),"-------------------------------------------",7)})),this.config._addOnNumericSettingChangedListener(ge.MaxQP,(t=>{e.Log(e.GetStackTrace(),"-------- Sending encoder settings --------",7),this._webRtcController.sendEncoderMaxQP(t),e.Log(e.GetStackTrace(),"-------------------------------------------",7)})),this.config._addOnNumericSettingChangedListener(ge.WebRTCMinBitrate,(t=>{e.Log(e.GetStackTrace(),"-------- Sending web rtc settings --------",7),this._webRtcController.sendWebRTCMinBitrate(1e3*t),e.Log(e.GetStackTrace(),"-------------------------------------------",7)})),this.config._addOnNumericSettingChangedListener(ge.WebRTCMaxBitrate,(t=>{e.Log(e.GetStackTrace(),"-------- Sending web rtc settings --------",7),this._webRtcController.sendWebRTCMaxBitrate(1e3*t),e.Log(e.GetStackTrace(),"-------------------------------------------",7)})),this.config._addOnNumericSettingChangedListener(ge.WebRTCFPS,(t=>{e.Log(e.GetStackTrace(),"-------- Sending web rtc settings --------",7),this._webRtcController.sendWebRTCFps(t),e.Log(e.GetStackTrace(),"-------------------------------------------",7)})),this.config._addOnOptionSettingChangedListener(pe.PreferredCodec,(e=>{this._webRtcController&&this._webRtcController.setPreferredCodec(e)})),this.config._registerOnChangeEvents(this._eventEmitter)}_activateOnScreenKeyboard(e){throw new Error("Method not implemented.")}_onInputControlOwnership(e){this._inputController=e}setWebRtcPlayerController(e){this._webRtcController=e,this._webRtcController.setPreferredCodec(this.config.getSettingOption(pe.PreferredCodec).selected),this._webRtcController.resizePlayerStyle(),this.checkForAutoConnect()}connect(){this._eventEmitter.dispatchEvent(new N),this._webRtcController.connectToSignallingServer()}reconnect(){this._eventEmitter.dispatchEvent(new Q),this._webRtcController.tryReconnect("Reconnecting...")}disconnect(){this._eventEmitter.dispatchEvent(new K),this._webRtcController.close()}play(){this._onStreamLoading(),this._webRtcController.playStream()}checkForAutoConnect(){console.log(this.config.isFlagEnabled(ce.AutoConnect),"====ssss"),this.config.isFlagEnabled(ce.AutoConnect)&&(this._onWebRtcAutoConnect(),this._webRtcController.connectToSignallingServer())}unmuteMicrophone(t=!1){if(!this.config.isFlagEnabled("UseMic"))return t?(this.config.setFlagEnabled("UseMic",!0),void this.reconnect()):void e.Warning(e.GetStackTrace(),"Trying to unmute mic, but PixelStreaming was initialized with no microphone track. Call with forceEnable == true to re-connect with a mic track.");this.setMicrophoneMuted(!1)}muteMicrophone(){this.config.isFlagEnabled("UseMic")?this.setMicrophoneMuted(!0):e.Info(e.GetStackTrace(),"Trying to mute mic, but PixelStreaming has no microphone track, so sending sound is already disabled.")}setMicrophoneMuted(e){var t,s,n,r;for(const i of null!==(r=null===(n=null===(s=null===(t=this._webRtcController)||void 0===t?void 0:t.peerConnectionController)||void 0===s?void 0:s.peerConnection)||void 0===n?void 0:n.getTransceivers())&&void 0!==r?r:[])Fe.canTransceiverSendAudio(i)&&(i.sender.track.enabled=!e)}_onWebRtcAutoConnect(){this._eventEmitter.dispatchEvent(new O)}_onWebRtcSdp(){this._eventEmitter.dispatchEvent(new D)}_onStreamLoading(){this._eventEmitter.dispatchEvent(new V)}_onDisconnect(e,t){this._eventEmitter.dispatchEvent(new z({eventString:e,allowClickToReconnect:t}))}_onWebRtcConnecting(){this._eventEmitter.dispatchEvent(new I)}_onWebRtcConnected(){this._eventEmitter.dispatchEvent(new G)}_onWebRtcFailed(){this._eventEmitter.dispatchEvent(new U)}_onVideoInitialized(){this._eventEmitter.dispatchEvent(new W),this._videoStartTime=Date.now()}_onLatencyTestResult(e){this._eventEmitter.dispatchEvent(new ee({latencyTimings:e}))}_onDataChannelLatencyTestResponse(e){this._eventEmitter.dispatchEvent(new te({response:e}))}_onVideoStats(e){this._videoStartTime&&void 0!==this._videoStartTime||(this._videoStartTime=Date.now()),e.handleSessionStatistics(this._videoStartTime,this._inputController,this._webRtcController.videoAvgQp),this._eventEmitter.dispatchEvent(new Y({aggregatedStats:e}))}_onVideoEncoderAvgQP(e){this._eventEmitter.dispatchEvent(new F({avgQP:e}))}_onInitialSettings(t){var s;this._eventEmitter.dispatchEvent(new ne({settings:t})),t.PixelStreamingSettings&&(this.allowConsoleCommands=null!==(s=t.PixelStreamingSettings.AllowPixelStreamingCommands)&&void 0!==s&&s,!1===this.allowConsoleCommands&&e.Info(e.GetStackTrace(),"-AllowPixelStreamingCommands=false, sending arbitrary console commands from browser to UE is disabled."));const n=this.config.useUrlParams,r=new URLSearchParams(window.location.search);t.EncoderSettings&&(this.config.setNumericSetting(ge.MinQP,n&&r.has(ge.MinQP)?Number.parseInt(r.get(ge.MinQP)):t.EncoderSettings.MinQP),this.config.setNumericSetting(ge.MaxQP,n&&r.has(ge.MaxQP)?Number.parseInt(r.get(ge.MaxQP)):t.EncoderSettings.MaxQP)),t.WebRTCSettings&&(this.config.setNumericSetting(ge.WebRTCMinBitrate,n&&r.has(ge.WebRTCMinBitrate)?Number.parseInt(r.get(ge.WebRTCMinBitrate)):t.WebRTCSettings.MinBitrate/1e3),this.config.setNumericSetting(ge.WebRTCMaxBitrate,n&&r.has(ge.WebRTCMaxBitrate)?Number.parseInt(r.get(ge.WebRTCMaxBitrate)):t.WebRTCSettings.MaxBitrate/1e3),this.config.setNumericSetting(ge.WebRTCFPS,n&&r.has(ge.WebRTCFPS)?Number.parseInt(r.get(ge.WebRTCFPS)):t.WebRTCSettings.FPS))}_onQualityControlOwnership(e){this.config.setFlagEnabled(ce.IsQualityController,e)}_onPlayerCount(e){this._eventEmitter.dispatchEvent(new le({count:e}))}requestLatencyTest(){return!!this._webRtcController.videoPlayer.isVideoReady()&&(this._webRtcController.sendLatencyTest(),!0)}requestDataChannelLatencyTest(e){return!!this._webRtcController.videoPlayer.isVideoReady()&&(this._dataChannelLatencyTestController||(this._dataChannelLatencyTestController=new Et(this._webRtcController.sendDataChannelLatencyTest.bind(this._webRtcController),(e=>{this._eventEmitter.dispatchEvent(new se({result:e}))})),this.addEventListener("dataChannelLatencyTestResponse",(({data:{response:e}})=>{this._dataChannelLatencyTestController.receive(e)}))),this._dataChannelLatencyTestController.start(e))}requestShowFps(){return!!this._webRtcController.videoPlayer.isVideoReady()&&(this._webRtcController.sendShowFps(),!0)}requestIframe(){return!!this._webRtcController.videoPlayer.isVideoReady()&&(this._webRtcController.sendIframeRequest(),!0)}emitUIInteraction(e){return!!this._webRtcController.videoPlayer.isVideoReady()&&(this._webRtcController.emitUIInteraction(e),!0)}emitCommand(e){return!(!this._webRtcController.videoPlayer.isVideoReady()||!this.allowConsoleCommands&&"ConsoleCommand"in e||(this._webRtcController.emitCommand(e),0))}emitConsoleCommand(e){return!(!this.allowConsoleCommands||!this._webRtcController.videoPlayer.isVideoReady()||(this._webRtcController.emitConsoleCommand(e),0))}addResponseEventListener(e,t){this._webRtcController.responseController.addResponseEventListener(e,t)}removeResponseEventListener(e){this._webRtcController.responseController.removeResponseEventListener(e)}dispatchEvent(e){return this._eventEmitter.dispatchEvent(e)}addEventListener(e,t){this._eventEmitter.addEventListener(e,t)}removeEventListener(e,t){this._eventEmitter.removeEventListener(e,t)}toggleXR(){this.webXrController.xrClicked()}setSignallingUrlBuilder(e){this._webRtcController.signallingUrlBuilder=e}get webSocketController(){return this._webRtcController.webSocketController}get webXrController(){return this._webXrController}registerMessageHandler(t,s,n){s!==Oe.FromStreamer||void 0!==n?s===Oe.ToStreamer&&void 0===n?this._webRtcController.streamMessageController.registerMessageHandler(s,t,(e=>this._webRtcController.sendMessageController.sendMessageToStreamer(t,e))):this._webRtcController.streamMessageController.registerMessageHandler(s,t,(e=>n(e))):e.Warning(e.GetStackTrace(),`Unable to register an undefined handler for ${t}`)}get toStreamerHandlers(){return this._webRtcController.streamMessageController.toStreamerHandlers}isReconnecting(){return this._webRtcController.isReconnecting}}})(),r})()));
1
+ /*! For license information please see lib-pixelstreamingfrontend.js.LICENSE.txt */
2
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("sdp")):"function"==typeof define&&define.amd?define(["sdp"],t):"object"==typeof exports?exports["lib-pixelstreamingfrontend"]=t(require("sdp")):e["lib-pixelstreamingfrontend"]=t(e.sdp)}(this,(e=>(()=>{"use strict";var t={366:t=>{t.exports=e}},n={};function s(e){var r=n[e];if(void 0!==r)return r.exports;var o=n[e]={exports:{}};return t[e](o,o.exports,s),o.exports}s.d=(e,t)=>{for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{function e(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return e=>e in t}s.r(r),s.d(r,{AfkLogic:()=>Th,AfkTimedOutEvent:()=>Iu,AfkWarningActivateEvent:()=>Au,AfkWarningDeactivateEvent:()=>Fu,AfkWarningUpdateEvent:()=>Ou,AggregatedStats:()=>Fh,CandidatePairStats:()=>Rh,CandidateStat:()=>Ph,Config:()=>wh,ControlSchemeType:()=>Eh,DataChannelCloseEvent:()=>$u,DataChannelErrorEvent:()=>Wu,DataChannelLatencyTestResponseEvent:()=>oh,DataChannelLatencyTestResultEvent:()=>ih,DataChannelOpenEvent:()=>Gu,DataChannelStats:()=>xh,EncoderSettings:()=>Gh,EventEmitter:()=>gh,Flags:()=>ph,HideFreezeFrameEvent:()=>th,InboundAudioStats:()=>_h,InboundVideoStats:()=>kh,InitialSettings:()=>Nh,InitialSettingsEvent:()=>ah,LatencyTestResultEvent:()=>rh,LatencyTestResults:()=>Wh,LoadFreezeFrameEvent:()=>eh,Logger:()=>iu,MessageDirection:()=>zh,MessageRecv:()=>bu,MessageSend:()=>cu,MessageStreamerList:()=>Cu,NumericParameters:()=>fh,OptionParameters:()=>bh,OutBoundVideoStats:()=>Lh,PixelStreaming:()=>_g,PlayStreamErrorEvent:()=>Ju,PlayStreamEvent:()=>Yu,PlayStreamRejectedEvent:()=>Zu,PlayerCountEvent:()=>hh,SettingBase:()=>ku,SettingFlag:()=>xu,SettingNumber:()=>Pu,SettingOption:()=>Lu,SettingText:()=>Ru,SettingsChangedEvent:()=>lh,SignallingProtocol:()=>wu,StatsReceivedEvent:()=>nh,StreamLoadingEvent:()=>Ku,StreamPreConnectEvent:()=>qu,StreamPreDisconnectEvent:()=>Qu,StreamReconnectEvent:()=>Xu,StreamerListMessageEvent:()=>sh,TextParameters:()=>Sh,UnquantizedAndDenormalizeUnsigned:()=>fg,VideoEncoderAvgQPEvent:()=>Du,VideoInitializedEvent:()=>ju,WebRTCSettings:()=>$h,WebRtcAutoConnectEvent:()=>zu,WebRtcConnectedEvent:()=>Vu,WebRtcConnectingEvent:()=>Uu,WebRtcDisconnectedEvent:()=>Hu,WebRtcFailedEvent:()=>Nu,WebRtcPlayerController:()=>Sg,WebRtcSdpEvent:()=>Bu,WebSocketController:()=>Eu,WebXRController:()=>wg,XrFrameEvent:()=>uh,XrSessionEndedEvent:()=>dh,XrSessionStartedEvent:()=>ch});const t={},n=[],o=()=>{},i=()=>!1,a=e=>111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),l=e=>e.startsWith("onUpdate:"),c=Object.assign,d=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},u=Object.prototype.hasOwnProperty,h=(e,t)=>u.call(e,t),g=Array.isArray,p=e=>"[object Map]"===E(e),m=e=>"[object Set]"===E(e),f=e=>"[object Date]"===E(e),v=e=>"function"==typeof e,S=e=>"string"==typeof e,y=e=>"symbol"==typeof e,b=e=>null!==e&&"object"==typeof e,C=e=>(b(e)||v(e))&&v(e.then)&&v(e.catch),w=Object.prototype.toString,E=e=>w.call(e),T=e=>"[object Object]"===E(e),M=e=>S(e)&&"NaN"!==e&&"-"!==e[0]&&""+parseInt(e,10)===e,_=e(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),k=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},x=/-\w/g,P=k((e=>e.replace(x,(e=>e.slice(1).toUpperCase())))),R=/\B([A-Z])/g,L=k((e=>e.replace(R,"-$1").toLowerCase())),A=k((e=>e.charAt(0).toUpperCase()+e.slice(1))),O=k((e=>e?`on${A(e)}`:"")),F=(e,t)=>!Object.is(e,t),I=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},D=(e,t,n,s=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:s,value:n})},B=e=>{const t=parseFloat(e);return isNaN(t)?e:t};let z;const U=()=>z||(z="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==s.g?s.g:{});function V(e){if(g(e)){const t={};for(let n=0;n<e.length;n++){const s=e[n],r=S(s)?$(s):V(s);if(r)for(const e in r)t[e]=r[e]}return t}if(S(e)||b(e))return e}const N=/;(?![^(]*\))/g,H=/:([^]+)/,G=/\/\*[^]*?\*\//g;function $(e){const t={};return e.replace(G,"").split(N).forEach((e=>{if(e){const n=e.split(H);n.length>1&&(t[n[0].trim()]=n[1].trim())}})),t}function W(e){let t="";if(S(e))t=e;else if(g(e))for(let n=0;n<e.length;n++){const s=W(e[n]);s&&(t+=s+" ")}else if(b(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const j=e("itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly");function K(e){return!!e||""===e}function q(e,t){if(e===t)return!0;let n=f(e),s=f(t);if(n||s)return!(!n||!s)&&e.getTime()===t.getTime();if(n=y(e),s=y(t),n||s)return e===t;if(n=g(e),s=g(t),n||s)return!(!n||!s)&&function(e,t){if(e.length!==t.length)return!1;let n=!0;for(let s=0;n&&s<e.length;s++)n=q(e[s],t[s]);return n}(e,t);if(n=b(e),s=b(t),n||s){if(!n||!s)return!1;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e){const s=e.hasOwnProperty(n),r=t.hasOwnProperty(n);if(s&&!r||!s&&r||!q(e[n],t[n]))return!1}}return String(e)===String(t)}const Q=e=>!(!e||!0!==e.__v_isRef),X=e=>S(e)?e:null==e?"":g(e)||b(e)&&(e.toString===w||!v(e.toString))?Q(e)?X(e.value):JSON.stringify(e,J,2):String(e),J=(e,t)=>Q(t)?J(e,t.value):p(t)?{[`Map(${t.size})`]:[...t.entries()].reduce(((e,[t,n],s)=>(e[Y(t,s)+" =>"]=n,e)),{})}:m(t)?{[`Set(${t.size})`]:[...t.values()].map((e=>Y(e)))}:y(t)?Y(t):!b(t)||g(t)||T(t)?t:String(t),Y=(e,t="")=>{var n;return y(e)?`Symbol(${null!=(n=e.description)?n:t})`:e};let Z,ee;class te{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!e&&Z&&(Z.active?(this.parent=Z,this.index=(Z.scopes||(Z.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){let e,t;if(this._isPaused=!0,this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].pause();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){let e,t;if(this._isPaused=!1,this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].resume();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].resume()}}run(e){if(this._active){const t=Z;try{return Z=this,e()}finally{Z=t}}}on(){1==++this._on&&(this.prevScope=Z,Z=this)}off(){if(this._on>0&&0==--this._on){if(Z===this)Z=this.prevScope;else{let e=Z;for(;e;){if(e.prevScope===this){e.prevScope=this.prevScope;break}e=e.prevScope}}this.prevScope=void 0}}stop(e){if(this._active){let t,n;for(this._active=!1,t=0,n=this.effects.length;t<n;t++)this.effects[t].stop();for(this.effects.length=0,t=0,n=this.cleanups.length;t<n;t++)this.cleanups[t]();if(this.cleanups.length=0,this.scopes){for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){const e=this.parent.scopes.pop();e&&e!==this&&(this.parent.scopes[this.index]=e,e.index=this.index)}this.parent=void 0}}}function ne(){return Z}function se(e,t=!1){Z&&Z.cleanups.push(e)}const re=new WeakSet;class oe{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,Z&&(Z.active?Z.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){64&this.flags&&(this.flags&=-65,re.has(this)&&(re.delete(this),this.trigger()))}notify(){2&this.flags&&!(32&this.flags)||8&this.flags||ce(this)}run(){if(!(1&this.flags))return this.fn();this.flags|=2,we(this),he(this);const e=ee,t=Se;ee=this,Se=!0;try{return this.fn()}finally{ge(this),ee=e,Se=t,this.flags&=-3}}stop(){if(1&this.flags){for(let e=this.deps;e;e=e.nextDep)fe(e);this.deps=this.depsTail=void 0,we(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){64&this.flags?re.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){pe(this)&&this.run()}get dirty(){return pe(this)}}let ie,ae,le=0;function ce(e,t=!1){if(e.flags|=8,t)return e.next=ae,void(ae=e);e.next=ie,ie=e}function de(){le++}function ue(){if(--le>0)return;if(ae){let e=ae;for(ae=void 0;e;){const t=e.next;e.next=void 0,e.flags&=-9,e=t}}let e;for(;ie;){let t=ie;for(ie=void 0;t;){const n=t.next;if(t.next=void 0,t.flags&=-9,1&t.flags)try{t.trigger()}catch(t){e||(e=t)}t=n}}if(e)throw e}function he(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function ge(e){let t,n=e.depsTail,s=n;for(;s;){const e=s.prevDep;-1===s.version?(s===n&&(n=e),fe(s),ve(s)):t=s,s.dep.activeLink=s.prevActiveLink,s.prevActiveLink=void 0,s=e}e.deps=t,e.depsTail=n}function pe(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(me(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function me(e){if(4&e.flags&&!(16&e.flags))return;if(e.flags&=-17,e.globalVersion===Ee)return;if(e.globalVersion=Ee,!e.isSSR&&128&e.flags&&(!e.deps&&!e._dirty||!pe(e)))return;e.flags|=2;const t=e.dep,n=ee,s=Se;ee=e,Se=!0;try{he(e);const r=e.fn(e._value);(0===t.version||F(r,e._value))&&(e.flags|=128,e._value=r,t.version++)}catch(e){throw t.version++,e}finally{ee=n,Se=s,ge(e),e.flags&=-3}}function fe(e,t=!1){const{dep:n,prevSub:s,nextSub:r}=e;if(s&&(s.nextSub=r,e.prevSub=void 0),r&&(r.prevSub=s,e.nextSub=void 0),n.subs===e&&(n.subs=s,!s&&n.computed)){n.computed.flags&=-5;for(let e=n.computed.deps;e;e=e.nextDep)fe(e,!0)}t||--n.sc||!n.map||n.map.delete(n.key)}function ve(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let Se=!0;const ye=[];function be(){ye.push(Se),Se=!1}function Ce(){const e=ye.pop();Se=void 0===e||e}function we(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const e=ee;ee=void 0;try{t()}finally{ee=e}}}let Ee=0;class Te{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class Me{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!ee||!Se||ee===this.computed)return;let t=this.activeLink;if(void 0===t||t.sub!==ee)t=this.activeLink=new Te(ee,this),ee.deps?(t.prevDep=ee.depsTail,ee.depsTail.nextDep=t,ee.depsTail=t):ee.deps=ee.depsTail=t,_e(t);else if(-1===t.version&&(t.version=this.version,t.nextDep)){const e=t.nextDep;e.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=e),t.prevDep=ee.depsTail,t.nextDep=void 0,ee.depsTail.nextDep=t,ee.depsTail=t,ee.deps===t&&(ee.deps=e)}return t}trigger(e){this.version++,Ee++,this.notify(e)}notify(e){de();try{for(let e=this.subs;e;e=e.prevSub)e.sub.notify()&&e.sub.dep.notify()}finally{ue()}}}function _e(e){if(e.dep.sc++,4&e.sub.flags){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let e=t.deps;e;e=e.nextDep)_e(e)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const ke=new WeakMap,xe=Symbol(""),Pe=Symbol(""),Re=Symbol("");function Le(e,t,n){if(Se&&ee){let t=ke.get(e);t||ke.set(e,t=new Map);let s=t.get(n);s||(t.set(n,s=new Me),s.map=t,s.key=n),s.track()}}function Ae(e,t,n,s,r,o){const i=ke.get(e);if(!i)return void Ee++;const a=e=>{e&&e.trigger()};if(de(),"clear"===t)i.forEach(a);else{const r=g(e),o=r&&M(n);if(r&&"length"===n){const e=Number(s);i.forEach(((t,n)=>{("length"===n||n===Re||!y(n)&&n>=e)&&a(t)}))}else switch((void 0!==n||i.has(void 0))&&a(i.get(n)),o&&a(i.get(Re)),t){case"add":r?o&&a(i.get("length")):(a(i.get(xe)),p(e)&&a(i.get(Pe)));break;case"delete":r||(a(i.get(xe)),p(e)&&a(i.get(Pe)));break;case"set":p(e)&&a(i.get(xe))}}ue()}function Oe(e){const t=ft(e);return t===e?t:(Le(t,0,Re),pt(e)?t:t.map(St))}function Fe(e){return Le(e=ft(e),0,Re),e}function Ie(e,t){return gt(e)?ht(e)?yt(St(t)):yt(t):St(t)}const De={__proto__:null,[Symbol.iterator](){return Be(this,Symbol.iterator,(e=>Ie(this,e)))},concat(...e){return Oe(this).concat(...e.map((e=>g(e)?Oe(e):e)))},entries(){return Be(this,"entries",(e=>(e[1]=Ie(this,e[1]),e)))},every(e,t){return Ue(this,"every",e,t,void 0,arguments)},filter(e,t){return Ue(this,"filter",e,t,(e=>e.map((e=>Ie(this,e)))),arguments)},find(e,t){return Ue(this,"find",e,t,(e=>Ie(this,e)),arguments)},findIndex(e,t){return Ue(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return Ue(this,"findLast",e,t,(e=>Ie(this,e)),arguments)},findLastIndex(e,t){return Ue(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return Ue(this,"forEach",e,t,void 0,arguments)},includes(...e){return Ne(this,"includes",e)},indexOf(...e){return Ne(this,"indexOf",e)},join(e){return Oe(this).join(e)},lastIndexOf(...e){return Ne(this,"lastIndexOf",e)},map(e,t){return Ue(this,"map",e,t,void 0,arguments)},pop(){return He(this,"pop")},push(...e){return He(this,"push",e)},reduce(e,...t){return Ve(this,"reduce",e,t)},reduceRight(e,...t){return Ve(this,"reduceRight",e,t)},shift(){return He(this,"shift")},some(e,t){return Ue(this,"some",e,t,void 0,arguments)},splice(...e){return He(this,"splice",e)},toReversed(){return Oe(this).toReversed()},toSorted(e){return Oe(this).toSorted(e)},toSpliced(...e){return Oe(this).toSpliced(...e)},unshift(...e){return He(this,"unshift",e)},values(){return Be(this,"values",(e=>Ie(this,e)))}};function Be(e,t,n){const s=Fe(e),r=s[t]();return s===e||pt(e)||(r._next=r.next,r.next=()=>{const e=r._next();return e.done||(e.value=n(e.value)),e}),r}const ze=Array.prototype;function Ue(e,t,n,s,r,o){const i=Fe(e),a=i!==e&&!pt(e),l=i[t];if(l!==ze[t]){const t=l.apply(e,o);return a?St(t):t}let c=n;i!==e&&(a?c=function(t,s){return n.call(this,Ie(e,t),s,e)}:n.length>2&&(c=function(t,s){return n.call(this,t,s,e)}));const d=l.call(i,c,s);return a&&r?r(d):d}function Ve(e,t,n,s){const r=Fe(e),o=r!==e&&!pt(e);let i=n,a=!1;r!==e&&(o?(a=0===s.length,i=function(t,s,r){return a&&(a=!1,t=Ie(e,t)),n.call(this,t,Ie(e,s),r,e)}):n.length>3&&(i=function(t,s,r){return n.call(this,t,s,r,e)}));const l=r[t](i,...s);return a?Ie(e,l):l}function Ne(e,t,n){const s=ft(e);Le(s,0,Re);const r=s[t](...n);return-1!==r&&!1!==r||!mt(n[0])?r:(n[0]=ft(n[0]),s[t](...n))}function He(e,t,n=[]){be(),de();const s=ft(e)[t].apply(e,n);return ue(),Ce(),s}const Ge=e("__proto__,__v_isRef,__isVue"),$e=new Set(Object.getOwnPropertyNames(Symbol).filter((e=>"arguments"!==e&&"caller"!==e)).map((e=>Symbol[e])).filter(y));function We(e){y(e)||(e=String(e));const t=ft(this);return Le(t,0,e),t.hasOwnProperty(e)}class je{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,n){if("__v_skip"===t)return e.__v_skip;const s=this._isReadonly,r=this._isShallow;if("__v_isReactive"===t)return!s;if("__v_isReadonly"===t)return s;if("__v_isShallow"===t)return r;if("__v_raw"===t)return n===(s?r?lt:at:r?it:ot).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;const o=g(e);if(!s){let e;if(o&&(e=De[t]))return e;if("hasOwnProperty"===t)return We}const i=Reflect.get(e,t,bt(e)?e:n);if(y(t)?$e.has(t):Ge(t))return i;if(s||Le(e,0,t),r)return i;if(bt(i)){const e=o&&M(t)?i:i.value;return s&&b(e)?dt(e):e}return b(i)?s?dt(i):ct(i):i}}class Ke extends je{constructor(e=!1){super(!1,e)}set(e,t,n,s){let r=e[t];const o=g(e)&&M(t);if(!this._isShallow){const e=gt(r);if(pt(n)||gt(n)||(r=ft(r),n=ft(n)),!o&&bt(r)&&!bt(n))return e||(r.value=n),!0}const i=o?Number(t)<e.length:h(e,t),a=Reflect.set(e,t,n,bt(e)?e:s);return e===ft(s)&&(i?F(n,r)&&Ae(e,"set",t,n):Ae(e,"add",t,n)),a}deleteProperty(e,t){const n=h(e,t),s=(e[t],Reflect.deleteProperty(e,t));return s&&n&&Ae(e,"delete",t,void 0),s}has(e,t){const n=Reflect.has(e,t);return y(t)&&$e.has(t)||Le(e,0,t),n}ownKeys(e){return Le(e,0,g(e)?"length":xe),Reflect.ownKeys(e)}}class qe extends je{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}}const Qe=new Ke,Xe=new qe,Je=new Ke(!0),Ye=e=>e,Ze=e=>Reflect.getPrototypeOf(e);function et(e){return function(...t){return"delete"!==e&&("clear"===e?void 0:this)}}function tt(e,t){const n=function(e,t){const n={get(n){const s=this.__v_raw,r=ft(s),o=ft(n);e||(F(n,o)&&Le(r,0,n),Le(r,0,o));const{has:i}=Ze(r),a=t?Ye:e?yt:St;return i.call(r,n)?a(s.get(n)):i.call(r,o)?a(s.get(o)):void(s!==r&&s.get(n))},get size(){const t=this.__v_raw;return!e&&Le(ft(t),0,xe),t.size},has(t){const n=this.__v_raw,s=ft(n),r=ft(t);return e||(F(t,r)&&Le(s,0,t),Le(s,0,r)),t===r?n.has(t):n.has(t)||n.has(r)},forEach(n,s){const r=this,o=r.__v_raw,i=ft(o),a=t?Ye:e?yt:St;return!e&&Le(i,0,xe),o.forEach(((e,t)=>n.call(s,a(e),a(t),r)))}};return c(n,e?{add:et("add"),set:et("set"),delete:et("delete"),clear:et("clear")}:{add(e){const n=ft(this),s=Ze(n),r=ft(e),o=t||pt(e)||gt(e)?e:r;return s.has.call(n,o)||F(e,o)&&s.has.call(n,e)||F(r,o)&&s.has.call(n,r)||(n.add(o),Ae(n,"add",o,o)),this},set(e,n){t||pt(n)||gt(n)||(n=ft(n));const s=ft(this),{has:r,get:o}=Ze(s);let i=r.call(s,e);i||(e=ft(e),i=r.call(s,e));const a=o.call(s,e);return s.set(e,n),i?F(n,a)&&Ae(s,"set",e,n):Ae(s,"add",e,n),this},delete(e){const t=ft(this),{has:n,get:s}=Ze(t);let r=n.call(t,e);r||(e=ft(e),r=n.call(t,e)),s&&s.call(t,e);const o=t.delete(e);return r&&Ae(t,"delete",e,void 0),o},clear(){const e=ft(this),t=0!==e.size,n=e.clear();return t&&Ae(e,"clear",void 0,void 0),n}}),["keys","values","entries",Symbol.iterator].forEach((s=>{n[s]=function(e,t,n){return function(...s){const r=this.__v_raw,o=ft(r),i=p(o),a="entries"===e||e===Symbol.iterator&&i,l="keys"===e&&i,d=r[e](...s),u=n?Ye:t?yt:St;return!t&&Le(o,0,l?Pe:xe),c(Object.create(d),{next(){const{value:e,done:t}=d.next();return t?{value:e,done:t}:{value:a?[u(e[0]),u(e[1])]:u(e),done:t}}})}}(s,e,t)})),n}(e,t);return(t,s,r)=>"__v_isReactive"===s?!e:"__v_isReadonly"===s?e:"__v_raw"===s?t:Reflect.get(h(n,s)&&s in t?n:t,s,r)}const nt={get:tt(!1,!1)},st={get:tt(!1,!0)},rt={get:tt(!0,!1)},ot=new WeakMap,it=new WeakMap,at=new WeakMap,lt=new WeakMap;function ct(e){return gt(e)?e:ut(e,!1,Qe,nt,ot)}function dt(e){return ut(e,!0,Xe,rt,at)}function ut(e,t,n,s,r){if(!b(e))return e;if(e.__v_raw&&(!t||!e.__v_isReactive))return e;if(e.__v_skip||!Object.isExtensible(e))return e;const o=r.get(e);if(o)return o;const i=function(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}(E(e).slice(8,-1));if(0===i)return e;const a=new Proxy(e,2===i?s:n);return r.set(e,a),a}function ht(e){return gt(e)?ht(e.__v_raw):!(!e||!e.__v_isReactive)}function gt(e){return!(!e||!e.__v_isReadonly)}function pt(e){return!(!e||!e.__v_isShallow)}function mt(e){return!!e&&!!e.__v_raw}function ft(e){const t=e&&e.__v_raw;return t?ft(t):e}function vt(e){return!h(e,"__v_skip")&&Object.isExtensible(e)&&D(e,"__v_skip",!0),e}const St=e=>b(e)?ct(e):e,yt=e=>b(e)?dt(e):e;function bt(e){return!!e&&!0===e.__v_isRef}function Ct(e){return Et(e,!1)}function wt(e){return Et(e,!0)}function Et(e,t){return bt(e)?e:new Tt(e,t)}class Tt{constructor(e,t){this.dep=new Me,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:ft(e),this._value=t?e:St(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){const t=this._rawValue,n=this.__v_isShallow||pt(e)||gt(e);e=n?e:ft(e),F(e,t)&&(this._rawValue=e,this._value=n?e:St(e),this.dep.trigger())}}function Mt(e){return bt(e)?e.value:e}function _t(e){return v(e)?e():Mt(e)}const kt={get:(e,t,n)=>"__v_raw"===t?e:Mt(Reflect.get(e,t,n)),set:(e,t,n,s)=>{const r=e[t];return bt(r)&&!bt(n)?(r.value=n,!0):Reflect.set(e,t,n,s)}};function xt(e){return ht(e)?e:new Proxy(e,kt)}function Pt(e){const t=g(e)?new Array(e.length):{};for(const n in e)t[n]=Ot(e,n);return t}class Rt{constructor(e,t,n){this._object=e,this._defaultValue=n,this.__v_isRef=!0,this._value=void 0,this._key=y(t)?t:String(t),this._raw=ft(e);let s=!0,r=e;if(!g(e)||y(this._key)||!M(this._key))do{s=!mt(r)||pt(r)}while(s&&(r=r.__v_raw));this._shallow=s}get value(){let e=this._object[this._key];return this._shallow&&(e=Mt(e)),this._value=void 0===e?this._defaultValue:e}set value(e){if(this._shallow&&bt(this._raw[this._key])){const t=this._object[this._key];if(bt(t))return void(t.value=e)}this._object[this._key]=e}get dep(){return function(e,t){const n=ke.get(e);return n&&n.get(t)}(this._raw,this._key)}}class Lt{constructor(e){this._getter=e,this.__v_isRef=!0,this.__v_isReadonly=!0,this._value=void 0}get value(){return this._value=this._getter()}}function At(e,t,n){return bt(e)?e:v(e)?new Lt(e):b(e)&&arguments.length>1?Ot(e,t,n):Ct(e)}function Ot(e,t,n){return new Rt(e,t,n)}class Ft{constructor(e,t,n){this.fn=e,this.setter=t,this._value=void 0,this.dep=new Me(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Ee-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=n}notify(){if(this.flags|=16,!(8&this.flags||ee===this))return ce(this,!0),!0}get value(){const e=this.dep.track();return me(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}const It={},Dt=new WeakMap;let Bt;function zt(e,t=1/0,n){if(t<=0||!b(e)||e.__v_skip)return e;if(((n=n||new Map).get(e)||0)>=t)return e;if(n.set(e,t),t--,bt(e))zt(e.value,t,n);else if(g(e))for(let s=0;s<e.length;s++)zt(e[s],t,n);else if(m(e)||p(e))e.forEach((e=>{zt(e,t,n)}));else if(T(e)){for(const s in e)zt(e[s],t,n);for(const s of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,s)&&zt(e[s],t,n)}return e}function Ut(e,t,n,s){try{return s?e(...s):e()}catch(e){Nt(e,t,n)}}function Vt(e,t,n,s){if(v(e)){const r=Ut(e,t,n,s);return r&&C(r)&&r.catch((e=>{Nt(e,t,n)})),r}if(g(e)){const r=[];for(let o=0;o<e.length;o++)r.push(Vt(e[o],t,n,s));return r}}function Nt(e,n,s,r=!0){n&&n.vnode;const{errorHandler:o,throwUnhandledErrorInProduction:i}=n&&n.appContext.config||t;if(n){let t=n.parent;const r=n.proxy,i=`https://vuejs.org/error-reference/#runtime-${s}`;for(;t;){const n=t.ec;if(n)for(let t=0;t<n.length;t++)if(!1===n[t](e,r,i))return;t=t.parent}if(o)return be(),Ut(o,null,10,[e,r,i]),void Ce()}!function(e,t,n,s=!0,r=!1){if(r)throw e;console.error(e)}(e,0,0,r,i)}const Ht=[];let Gt=-1;const $t=[];let Wt=null,jt=0;const Kt=Promise.resolve();let qt=null;function Qt(e){const t=qt||Kt;return e?t.then(this?e.bind(this):e):t}function Xt(e){if(!(1&e.flags)){const t=en(e),n=Ht[Ht.length-1];!n||!(2&e.flags)&&t>=en(n)?Ht.push(e):Ht.splice(function(e){let t=Gt+1,n=Ht.length;for(;t<n;){const s=t+n>>>1,r=Ht[s],o=en(r);o<e||o===e&&2&r.flags?t=s+1:n=s}return t}(t),0,e),e.flags|=1,Jt()}}function Jt(){qt||(qt=Kt.then(tn))}function Yt(e,t,n=Gt+1){for(;n<Ht.length;n++){const t=Ht[n];if(t&&2&t.flags){if(e&&t.id!==e.uid)continue;Ht.splice(n,1),n--,4&t.flags&&(t.flags&=-2),t(),4&t.flags||(t.flags&=-2)}}}function Zt(e){if($t.length){const e=[...new Set($t)].sort(((e,t)=>en(e)-en(t)));if($t.length=0,Wt)return void Wt.push(...e);for(Wt=e,jt=0;jt<Wt.length;jt++){const e=Wt[jt];4&e.flags&&(e.flags&=-2),8&e.flags||e(),e.flags&=-2}Wt=null,jt=0}}const en=e=>null==e.id?2&e.flags?-1:1/0:e.id;function tn(e){try{for(Gt=0;Gt<Ht.length;Gt++){const e=Ht[Gt];!e||8&e.flags||(4&e.flags&&(e.flags&=-2),Ut(e,e.i,e.i?15:14),4&e.flags||(e.flags&=-2))}}finally{for(;Gt<Ht.length;Gt++){const e=Ht[Gt];e&&(e.flags&=-2)}Gt=-1,Ht.length=0,Zt(),qt=null,(Ht.length||$t.length)&&tn(e)}}let nn,sn=[],rn=!1;function on(e,...t){nn?nn.emit(e,...t):rn||sn.push({event:e,args:t})}function an(e,t){var n,s;nn=e,nn?(nn.enabled=!0,sn.forEach((({event:e,args:t})=>nn.emit(e,...t))),sn=[]):"undefined"!=typeof window&&window.HTMLElement&&!(null==(s=null==(n=window.navigator)?void 0:n.userAgent)?void 0:s.includes("jsdom"))?((t.__VUE_DEVTOOLS_HOOK_REPLAY__=t.__VUE_DEVTOOLS_HOOK_REPLAY__||[]).push((e=>{an(e,t)})),setTimeout((()=>{nn||(t.__VUE_DEVTOOLS_HOOK_REPLAY__=null,rn=!0,sn=[])}),3e3)):(rn=!0,sn=[])}const ln=un("component:added"),cn=un("component:updated"),dn=un("component:removed");function un(e){return t=>{on(e,t.appContext.app,t.uid,t.parent?t.parent.uid:void 0,t)}}let hn=null,gn=null;function pn(e){const t=hn;return hn=e,gn=e&&e.type.__scopeId||null,t}function mn(e,t=hn,n){if(!t)return e;if(e._n)return e;const s=(...n)=>{s._d&&kr(-1);const r=pn(t);let o;try{o=e(...n)}finally{pn(r),s._d&&kr(1)}return __VUE_PROD_DEVTOOLS__&&cn(t),o};return s._n=!0,s._c=!0,s._d=!0,s}function fn(e,n){if(null===hn)return e;const s=oo(hn),r=e.dirs||(e.dirs=[]);for(let e=0;e<n.length;e++){let[o,i,a,l=t]=n[e];o&&(v(o)&&(o={mounted:o,updated:o}),o.deep&&zt(i),r.push({dir:o,instance:s,value:i,oldValue:void 0,arg:a,modifiers:l}))}return e}function vn(e,t,n,s){const r=e.dirs,o=t&&t.dirs;for(let i=0;i<r.length;i++){const a=r[i];o&&(a.oldValue=o[i].value);let l=a.dir[s];l&&(be(),Vt(l,n,8,[e.el,a,e,t]),Ce())}}function Sn(e,t){if(Kr){let n=Kr.provides;const s=Kr.parent&&Kr.parent.provides;s===n&&(n=Kr.provides=Object.create(s)),n[e]=t}}function yn(e,t,n=!1){const s=qr();if(s||Vs){let r=Vs?Vs._context.provides:s?null==s.parent||s.ce?s.vnode.appContext&&s.vnode.appContext.provides:s.parent.provides:void 0;if(r&&e in r)return r[e];if(arguments.length>1)return n&&v(t)?t.call(s&&s.proxy):t}}const bn=Symbol.for("v-scx");function Cn(e,t){return En(e,null,t)}function wn(e,t,n){return En(e,t,n)}function En(e,n,s=t){const{immediate:r,deep:i,flush:a,once:l}=s,u=c({},s),h=n&&r||!n&&"post"!==a;let p;if(eo)if("sync"===a){const e=yn(bn);p=e.__watcherHandles||(e.__watcherHandles=[])}else if(!h){const e=()=>{};return e.stop=o,e.resume=o,e.pause=o,e}const m=Kr;u.call=(e,t,n)=>Vt(e,m,t,n);let f=!1;"post"===a?u.scheduler=e=>{dr(e,m&&m.suspense)}:"sync"!==a&&(f=!0,u.scheduler=(e,t)=>{t?e():Xt(e)}),u.augmentJob=e=>{n&&(e.flags|=4),f&&(e.flags|=2,m&&(e.id=m.uid,e.i=m))};const S=function(e,n,s=t){const{immediate:r,deep:i,once:a,scheduler:l,augmentJob:c,call:u}=s,h=e=>i?e:pt(e)||!1===i||0===i?zt(e,1):zt(e);let p,m,f,S,y=!1,b=!1;if(bt(e)?(m=()=>e.value,y=pt(e)):ht(e)?(m=()=>h(e),y=!0):g(e)?(b=!0,y=e.some((e=>ht(e)||pt(e))),m=()=>e.map((e=>bt(e)?e.value:ht(e)?h(e):v(e)?u?u(e,2):e():void 0))):m=v(e)?n?u?()=>u(e,2):e:()=>{if(f){be();try{f()}finally{Ce()}}const t=Bt;Bt=p;try{return u?u(e,3,[S]):e(S)}finally{Bt=t}}:o,n&&i){const e=m,t=!0===i?1/0:i;m=()=>zt(e(),t)}const C=ne(),w=()=>{p.stop(),C&&C.active&&d(C.effects,p)};if(a&&n){const e=n;n=(...t)=>{const n=e(...t);return w(),n}}let E=b?new Array(e.length).fill(It):It;const T=e=>{if(1&p.flags&&(p.dirty||e))if(n){const t=p.run();if(e||i||y||(b?t.some(((e,t)=>F(e,E[t]))):F(t,E))){f&&f();const e=Bt;Bt=p;try{const s=[t,E===It?void 0:b&&E[0]===It?[]:E,S];E=t,u?u(n,3,s):n(...s)}finally{Bt=e}}}else p.run()};return c&&c(T),p=new oe(m),p.scheduler=l?()=>l(T,!1):T,S=e=>function(e,t=!1,n=Bt){if(n){let t=Dt.get(n);t||Dt.set(n,t=[]),t.push(e)}}(e,!1,p),f=p.onStop=()=>{const e=Dt.get(p);if(e){if(u)u(e,4);else for(const t of e)t();Dt.delete(p)}},n?r?T(!0):E=p.run():l?l(T.bind(null,!0),!0):p.run(),w.pause=p.pause.bind(p),w.resume=p.resume.bind(p),w.stop=w,w}(e,n,u);return eo&&(p?p.push(S):h&&S()),S}function Tn(e,t,n){const s=this.proxy,r=S(e)?e.includes(".")?Mn(s,e):()=>s[e]:e.bind(s,s);let o;v(t)?o=t:(o=t.handler,n=t);const i=Jr(this),a=En(r,o.bind(s),n);return i(),a}function Mn(e,t){const n=t.split(".");return()=>{let t=e;for(let e=0;e<n.length&&t;e++)t=t[n[e]];return t}}const _n=Symbol("_vte"),kn=e=>e.__isTeleport,xn=Symbol("_leaveCb"),Pn=Symbol("_enterCb");const Rn=[Function,Array],Ln={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Rn,onEnter:Rn,onAfterEnter:Rn,onEnterCancelled:Rn,onBeforeLeave:Rn,onLeave:Rn,onAfterLeave:Rn,onLeaveCancelled:Rn,onBeforeAppear:Rn,onAppear:Rn,onAfterAppear:Rn,onAppearCancelled:Rn},An=e=>{const t=e.subTree;return t.component?An(t.component):t};function On(e){let t=e[0];if(e.length>1){let n=!1;for(const s of e)if(s.type!==Cr){t=s,n=!0;break}}return t}const Fn={name:"BaseTransition",props:Ln,setup(e,{slots:t}){const n=qr(),s=function(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return ns((()=>{e.isMounted=!0})),os((()=>{e.isUnmounting=!0})),e}();return()=>{const r=t.default&&Vn(t.default(),!0),o=r&&r.length?On(r):n.subTree?Ur():void 0;if(!o)return;const i=ft(e),{mode:a}=i;if(s.isLeaving)return Bn(o);const l=zn(o);if(!l)return Bn(o);let c=Dn(l,i,s,n,(e=>c=e));l.type!==Cr&&Un(l,c);let d=n.subTree&&zn(n.subTree);if(d&&d.type!==Cr&&!Ar(d,l)&&An(n).type!==Cr){let e=Dn(d,i,s,n);if(Un(d,e),"out-in"===a&&l.type!==Cr)return s.isLeaving=!0,e.afterLeave=()=>{s.isLeaving=!1,8&n.job.flags||n.update(),delete e.afterLeave,d=void 0},Bn(o);"in-out"===a&&l.type!==Cr?e.delayLeave=(e,t,n)=>{In(s,d)[String(d.key)]=d,e[xn]=()=>{t(),e[xn]=void 0,delete c.delayedLeave,d=void 0},c.delayedLeave=()=>{n(),delete c.delayedLeave,d=void 0}}:d=void 0}else d&&(d=void 0);return o}}};function In(e,t){const{leavingVNodes:n}=e;let s=n.get(t.type);return s||(s=Object.create(null),n.set(t.type,s)),s}function Dn(e,t,n,s,r){const{appear:o,mode:i,persisted:a=!1,onBeforeEnter:l,onEnter:c,onAfterEnter:d,onEnterCancelled:u,onBeforeLeave:h,onLeave:p,onAfterLeave:m,onLeaveCancelled:f,onBeforeAppear:v,onAppear:S,onAfterAppear:y,onAppearCancelled:b}=t,C=String(e.key),w=In(n,e),E=(e,t)=>{e&&Vt(e,s,9,t)},T=(e,t)=>{const n=t[1];E(e,t),g(e)?e.every((e=>e.length<=1))&&n():e.length<=1&&n()},M={mode:i,persisted:a,beforeEnter(t){let s=l;if(!n.isMounted){if(!o)return;s=v||l}t[xn]&&t[xn](!0);const r=w[C];r&&Ar(e,r)&&r.el[xn]&&r.el[xn](),E(s,[t])},enter(t){if(w[C]===e)return;let s=c,r=d,i=u;if(!n.isMounted){if(!o)return;s=S||c,r=y||d,i=b||u}let a=!1;t[Pn]=e=>{a||(a=!0,E(e?i:r,[t]),M.delayedLeave&&M.delayedLeave(),t[Pn]=void 0)};const l=t[Pn].bind(null,!1);s?T(s,[t,l]):l()},leave(t,s){const r=String(e.key);if(t[Pn]&&t[Pn](!0),n.isUnmounting)return s();E(h,[t]);let o=!1;t[xn]=n=>{o||(o=!0,s(),E(n?f:m,[t]),t[xn]=void 0,w[r]===e&&delete w[r])};const i=t[xn].bind(null,!1);w[r]=e,p?T(p,[t,i]):i()},clone(e){const o=Dn(e,t,n,s,r);return r&&r(o),o}};return M}function Bn(e){if(qn(e))return(e=Br(e)).children=null,e}function zn(e){if(!qn(e))return kn(e.type)&&e.children?On(e.children):e;if(e.component)return e.component.subTree;const{shapeFlag:t,children:n}=e;if(n){if(16&t)return n[0];if(32&t&&v(n.default))return n.default()}}function Un(e,t){6&e.shapeFlag&&e.component?(e.transition=t,Un(e.component.subTree,t)):128&e.shapeFlag?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function Vn(e,t=!1,n){let s=[],r=0;for(let o=0;o<e.length;o++){let i=e[o];const a=null==n?i.key:String(n)+String(null!=i.key?i.key:o);i.type===yr?(128&i.patchFlag&&r++,s=s.concat(Vn(i.children,t,a))):(t||i.type!==Cr)&&s.push(null!=a?Br(i,{key:a}):i)}if(r>1)for(let e=0;e<s.length;e++)s[e].patchFlag=-2;return s}function Nn(e,t){return v(e)?(()=>c({name:e.name},t,{setup:e}))():e}function Hn(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function Gn(e,t){let n;return!(!(n=Object.getOwnPropertyDescriptor(e,t))||n.configurable)}const $n=new WeakMap;function Wn(e,n,s,r,o=!1){if(g(e))return void e.forEach(((e,t)=>Wn(e,n&&(g(n)?n[t]:n),s,r,o)));if(Kn(r)&&!o)return void(512&r.shapeFlag&&r.type.__asyncResolved&&r.component.subTree.component&&Wn(e,n,s,r.component.subTree));const a=4&r.shapeFlag?oo(r.component):r.el,l=o?null:a,{i:c,r:u}=e,p=n&&n.r,m=c.refs===t?c.refs={}:c.refs,f=c.setupState,y=ft(f),b=f===t?i:e=>!Gn(m,e)&&h(y,e),C=(e,t)=>!t||!Gn(m,t);if(null!=p&&p!==u)if(jn(n),S(p))m[p]=null,b(p)&&(f[p]=null);else if(bt(p)){const e=n;C(0,e.k)&&(p.value=null),e.k&&(m[e.k]=null)}if(v(u))Ut(u,c,12,[l,m]);else{const t=S(u),n=bt(u);if(t||n){const r=()=>{if(e.f){const n=t?b(u)?f[u]:m[u]:C()||!e.k?u.value:m[e.k];if(o)g(n)&&d(n,a);else if(g(n))n.includes(a)||n.push(a);else if(t)m[u]=[a],b(u)&&(f[u]=m[u]);else{const t=[a];C(0,e.k)&&(u.value=t),e.k&&(m[e.k]=t)}}else t?(m[u]=l,b(u)&&(f[u]=l)):n&&(C(0,e.k)&&(u.value=l),e.k&&(m[e.k]=l))};if(l){const t=()=>{r(),$n.delete(e)};t.id=-1,$n.set(e,t),dr(t,s)}else jn(e),r()}}}function jn(e){const t=$n.get(e);t&&(t.flags|=8,$n.delete(e))}U().requestIdleCallback,U().cancelIdleCallback;const Kn=e=>!!e.type.__asyncLoader,qn=e=>e.type.__isKeepAlive;function Qn(e,t){Jn(e,"a",t)}function Xn(e,t){Jn(e,"da",t)}function Jn(e,t,n=Kr){const s=e.__wdc||(e.__wdc=()=>{let t=n;for(;t;){if(t.isDeactivated)return;t=t.parent}return e()});if(Zn(t,s,n),n){let e=n.parent;for(;e&&e.parent;)qn(e.parent.vnode)&&Yn(s,t,n,e),e=e.parent}}function Yn(e,t,n,s){const r=Zn(t,e,s,!0);is((()=>{d(s[t],r)}),n)}function Zn(e,t,n=Kr,s=!1){if(n){const r=n[e]||(n[e]=[]),o=t.__weh||(t.__weh=(...s)=>{be();const r=Jr(n),o=Vt(t,n,e,s);return r(),Ce(),o});return s?r.unshift(o):r.push(o),o}}RegExp,RegExp;const es=e=>(t,n=Kr)=>{eo&&"sp"!==e||Zn(e,((...e)=>t(...e)),n)},ts=es("bm"),ns=es("m"),ss=es("bu"),rs=es("u"),os=es("bum"),is=es("um"),as=es("sp"),ls=es("rtg"),cs=es("rtc");function ds(e,t=Kr){Zn("ec",e,t)}const us="components";function hs(e,t){return ms(us,e,!0,t)||e}const gs=Symbol.for("v-ndc");function ps(e){return S(e)?ms(us,e,!1)||e:e||gs}function ms(e,t,n=!0,s=!1){const r=hn||Kr;if(r){const n=r.type;if(e===us){const e=function(e,t=!0){return v(e)?e.displayName||e.name:e.name||t&&e.__name}(n,!1);if(e&&(e===t||e===P(t)||e===A(P(t))))return n}const o=fs(r[e]||n[e],t)||fs(r.appContext[e],t);return!o&&s?n:o}}function fs(e,t){return e&&(e[t]||e[P(t)]||e[A(P(t))])}function vs(e,t,n={},s,r){if(hn.ce||hn.parent&&Kn(hn.parent)&&hn.parent.ce){const e=Object.keys(n).length>0;return"default"!==t&&(n.name=t),Mr(),Rr(yr,null,[Dr("slot",n,s&&s())],e?-2:64)}let o=e[t];o&&o._c&&(o._d=!1),Mr();const i=o&&Ss(o(n)),a=n.key||i&&i.key,l=Rr(yr,{key:(a&&!y(a)?a:`_${t}`)+(!i&&s?"_fb":"")},i||(s?s():[]),i&&1===e._?64:-2);return!r&&l.scopeId&&(l.slotScopeIds=[l.scopeId+"-s"]),o&&o._c&&(o._d=!0),l}function Ss(e){return e.some((e=>!Lr(e)||e.type!==Cr&&!(e.type===yr&&!Ss(e.children))))?e:null}const ys=e=>e?Zr(e)?oo(e):ys(e.parent):null,bs=c(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>ys(e.parent),$root:e=>ys(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>__VUE_OPTIONS_API__?Ps(e):e.type,$forceUpdate:e=>e.f||(e.f=()=>{Xt(e.update)}),$nextTick:e=>e.n||(e.n=Qt.bind(e.proxy)),$watch:e=>__VUE_OPTIONS_API__?Tn.bind(e):o}),Cs=(e,n)=>e!==t&&!e.__isScriptSetup&&h(e,n),ws={get({_:e},n){if("__v_skip"===n)return!0;const{ctx:s,setupState:r,data:o,props:i,accessCache:a,type:l,appContext:c}=e;if("$"!==n[0]){const e=a[n];if(void 0!==e)switch(e){case 1:return r[n];case 2:return o[n];case 4:return s[n];case 3:return i[n]}else{if(Cs(r,n))return a[n]=1,r[n];if(__VUE_OPTIONS_API__&&o!==t&&h(o,n))return a[n]=2,o[n];if(h(i,n))return a[n]=3,i[n];if(s!==t&&h(s,n))return a[n]=4,s[n];__VUE_OPTIONS_API__&&!_s||(a[n]=0)}}const d=bs[n];let u,g;return d?("$attrs"===n&&Le(e.attrs,0,""),d(e)):(u=l.__cssModules)&&(u=u[n])?u:s!==t&&h(s,n)?(a[n]=4,s[n]):(g=c.config.globalProperties,h(g,n)?g[n]:void 0)},set({_:e},n,s){const{data:r,setupState:o,ctx:i}=e;return Cs(o,n)?(o[n]=s,!0):__VUE_OPTIONS_API__&&r!==t&&h(r,n)?(r[n]=s,!0):!(h(e.props,n)||"$"===n[0]&&n.slice(1)in e||(i[n]=s,0))},has({_:{data:e,setupState:n,accessCache:s,ctx:r,appContext:o,props:i,type:a}},l){let c;return!!(s[l]||__VUE_OPTIONS_API__&&e!==t&&"$"!==l[0]&&h(e,l)||Cs(n,l)||h(i,l)||h(r,l)||h(bs,l)||h(o.config.globalProperties,l)||(c=a.__cssModules)&&c[l])},defineProperty(e,t,n){return null!=n.get?e._.accessCache[t]=0:h(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function Es(){return Ts().slots}function Ts(e){const t=qr();return t.setupContext||(t.setupContext=ro(t))}function Ms(e){return g(e)?e.reduce(((e,t)=>(e[t]=null,e)),{}):e}let _s=!0;function ks(e,t,n){Vt(g(e)?e.map((e=>e.bind(t.proxy))):e.bind(t.proxy),t,n)}function xs(e,t,n,s){let r=s.includes(".")?Mn(n,s):()=>n[s];if(S(e)){const n=t[e];v(n)&&wn(r,n)}else if(v(e))wn(r,e.bind(n));else if(b(e))if(g(e))e.forEach((e=>xs(e,t,n,s)));else{const s=v(e.handler)?e.handler.bind(n):t[e.handler];v(s)&&wn(r,s,e)}}function Ps(e){const t=e.type,{mixins:n,extends:s}=t,{mixins:r,optionsCache:o,config:{optionMergeStrategies:i}}=e.appContext,a=o.get(t);let l;return a?l=a:r.length||n||s?(l={},r.length&&r.forEach((e=>Rs(l,e,i,!0))),Rs(l,t,i)):l=t,b(t)&&o.set(t,l),l}function Rs(e,t,n,s=!1){const{mixins:r,extends:o}=t;o&&Rs(e,o,n,!0),r&&r.forEach((t=>Rs(e,t,n,!0)));for(const r in t)if(s&&"expose"===r);else{const s=Ls[r]||n&&n[r];e[r]=s?s(e[r],t[r]):t[r]}return e}const Ls={data:As,props:Ds,emits:Ds,methods:Is,computed:Is,beforeCreate:Fs,created:Fs,beforeMount:Fs,mounted:Fs,beforeUpdate:Fs,updated:Fs,beforeDestroy:Fs,beforeUnmount:Fs,destroyed:Fs,unmounted:Fs,activated:Fs,deactivated:Fs,errorCaptured:Fs,serverPrefetch:Fs,components:Is,directives:Is,watch:function(e,t){if(!e)return t;if(!t)return e;const n=c(Object.create(null),e);for(const s in t)n[s]=Fs(e[s],t[s]);return n},provide:As,inject:function(e,t){return Is(Os(e),Os(t))}};function As(e,t){return t?e?function(){return c(v(e)?e.call(this,this):e,v(t)?t.call(this,this):t)}:t:e}function Os(e){if(g(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function Fs(e,t){return e?[...new Set([].concat(e,t))]:t}function Is(e,t){return e?c(Object.create(null),e,t):t}function Ds(e,t){return e?g(e)&&g(t)?[...new Set([...e,...t])]:c(Object.create(null),Ms(e),Ms(null!=t?t:{})):t}function Bs(){return{app:null,config:{isNativeTag:i,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let zs=0;function Us(e,t){return function(n,s=null){v(n)||(n=c({},n)),null==s||b(s)||(s=null);const r=Bs(),o=new WeakSet,i=[];let a=!1;const l=r.app={_uid:zs++,_component:n,_props:s,_container:null,_context:r,_instance:null,version:lo,get config(){return r.config},set config(e){},use:(e,...t)=>(o.has(e)||(e&&v(e.install)?(o.add(e),e.install(l,...t)):v(e)&&(o.add(e),e(l,...t))),l),mixin:e=>(__VUE_OPTIONS_API__&&(r.mixins.includes(e)||r.mixins.push(e)),l),component:(e,t)=>t?(r.components[e]=t,l):r.components[e],directive:(e,t)=>t?(r.directives[e]=t,l):r.directives[e],mount(o,i,c){if(!a){const d=l._ceVNode||Dr(n,s);return d.appContext=r,!0===c?c="svg":!1===c&&(c=void 0),i&&t?t(d,o):e(d,o,c),a=!0,l._container=o,o.__vue_app__=l,__VUE_PROD_DEVTOOLS__&&(l._instance=d.component,function(e,t){on("app:init",e,t,{Fragment:yr,Text:br,Comment:Cr,Static:wr})}(l,lo)),oo(d.component)}},onUnmount(e){i.push(e)},unmount(){a&&(Vt(i,l._instance,16),e(null,l._container),__VUE_PROD_DEVTOOLS__&&(l._instance=null,function(e){on("app:unmount",e)}(l)),delete l._container.__vue_app__)},provide:(e,t)=>(r.provides[e]=t,l),runWithContext(e){const t=Vs;Vs=l;try{return e()}finally{Vs=t}}};return l}}let Vs=null;function Ns(e,n,...s){if(e.isUnmounted)return;const r=e.vnode.props||t;let o=s;const i=n.startsWith("update:"),a=i&&((e,t)=>"modelValue"===t||"model-value"===t?e.modelModifiers:e[`${t}Modifiers`]||e[`${P(t)}Modifiers`]||e[`${L(t)}Modifiers`])(r,n.slice(7));let l;a&&(a.trim&&(o=s.map((e=>S(e)?e.trim():e))),a.number&&(o=s.map(B))),__VUE_PROD_DEVTOOLS__&&function(e,t,n){on("component:emit",e.appContext.app,e,t,n)}(e,n,o);let c=r[l=O(n)]||r[l=O(P(n))];!c&&i&&(c=r[l=O(L(n))]),c&&Vt(c,e,6,o);const d=r[l+"Once"];if(d){if(e.emitted){if(e.emitted[l])return}else e.emitted={};e.emitted[l]=!0,Vt(d,e,6,o)}}const Hs=new WeakMap;function Gs(e,t,n=!1){const s=__VUE_OPTIONS_API__&&n?Hs:t.emitsCache,r=s.get(e);if(void 0!==r)return r;const o=e.emits;let i={},a=!1;if(__VUE_OPTIONS_API__&&!v(e)){const s=e=>{const n=Gs(e,t,!0);n&&(a=!0,c(i,n))};!n&&t.mixins.length&&t.mixins.forEach(s),e.extends&&s(e.extends),e.mixins&&e.mixins.forEach(s)}return o||a?(g(o)?o.forEach((e=>i[e]=null)):c(i,o),b(e)&&s.set(e,i),i):(b(e)&&s.set(e,null),null)}function $s(e,t){return!(!e||!a(t))&&(t=t.slice(2).replace(/Once$/,""),h(e,t[0].toLowerCase()+t.slice(1))||h(e,L(t))||h(e,t))}function Ws(e){const{type:t,vnode:n,proxy:s,withProxy:r,propsOptions:[o],slots:i,attrs:a,emit:c,render:d,renderCache:u,props:h,data:g,setupState:p,ctx:m,inheritAttrs:f}=e,v=pn(e);let S,y;try{if(4&n.shapeFlag){const e=r||s,t=e;S=Vr(d.call(t,e,u,h,p,g,m)),y=a}else{const e=t;S=Vr(e.length>1?e(h,{attrs:a,slots:i,emit:c}):e(h,null)),y=t.props?a:js(a)}}catch(t){Er.length=0,Nt(t,e,1),S=Dr(Cr)}let b=S;if(y&&!1!==f){const e=Object.keys(y),{shapeFlag:t}=b;e.length&&7&t&&(o&&e.some(l)&&(y=Ks(y,o)),b=Br(b,y,!1,!0))}return n.dirs&&(b=Br(b,null,!1,!0),b.dirs=b.dirs?b.dirs.concat(n.dirs):n.dirs),n.transition&&Un(b,n.transition),S=b,pn(v),S}const js=e=>{let t;for(const n in e)("class"===n||"style"===n||a(n))&&((t||(t={}))[n]=e[n]);return t},Ks=(e,t)=>{const n={};for(const s in e)l(s)&&s.slice(9)in t||(n[s]=e[s]);return n};function qs(e,t,n){const s=Object.keys(t);if(s.length!==Object.keys(e).length)return!0;for(let r=0;r<s.length;r++){const o=s[r];if(Qs(t,e,o)&&!$s(n,o))return!0}return!1}function Qs(e,t,n){const s=e[n],r=t[n];return"style"===n&&b(s)&&b(r)?!q(s,r):s!==r}const Xs={},Js=()=>Object.create(Xs),Ys=e=>Object.getPrototypeOf(e)===Xs;function Zs(e,n,s,r){const[o,i]=e.propsOptions;let a,l=!1;if(n)for(let t in n){if(_(t))continue;const c=n[t];let d;o&&h(o,d=P(t))?i&&i.includes(d)?(a||(a={}))[d]=c:s[d]=c:$s(e.emitsOptions,t)||t in r&&c===r[t]||(r[t]=c,l=!0)}if(i){const n=ft(s),r=a||t;for(let t=0;t<i.length;t++){const a=i[t];s[a]=er(o,n,a,r[a],e,!h(r,a))}}return l}function er(e,t,n,s,r,o){const i=e[n];if(null!=i){const e=h(i,"default");if(e&&void 0===s){const e=i.default;if(i.type!==Function&&!i.skipFactory&&v(e)){const{propsDefaults:o}=r;if(n in o)s=o[n];else{const i=Jr(r);s=o[n]=e.call(null,t),i()}}else s=e;r.ce&&r.ce._setProp(n,s)}i[0]&&(o&&!e?s=!1:!i[1]||""!==s&&s!==L(n)||(s=!0))}return s}const tr=new WeakMap;function nr(e,s,r=!1){const o=__VUE_OPTIONS_API__&&r?tr:s.propsCache,i=o.get(e);if(i)return i;const a=e.props,l={},d=[];let u=!1;if(__VUE_OPTIONS_API__&&!v(e)){const t=e=>{u=!0;const[t,n]=nr(e,s,!0);c(l,t),n&&d.push(...n)};!r&&s.mixins.length&&s.mixins.forEach(t),e.extends&&t(e.extends),e.mixins&&e.mixins.forEach(t)}if(!a&&!u)return b(e)&&o.set(e,n),n;if(g(a))for(let e=0;e<a.length;e++){const n=P(a[e]);sr(n)&&(l[n]=t)}else if(a)for(const e in a){const t=P(e);if(sr(t)){const n=a[e],s=l[t]=g(n)||v(n)?{type:n}:c({},n),r=s.type;let o=!1,i=!0;if(g(r))for(let e=0;e<r.length;++e){const t=r[e],n=v(t)&&t.name;if("Boolean"===n){o=!0;break}"String"===n&&(i=!1)}else o=v(r)&&"Boolean"===r.name;s[0]=o,s[1]=i,(o||h(s,"default"))&&d.push(t)}}const p=[l,d];return b(e)&&o.set(e,p),p}function sr(e){return"$"!==e[0]&&!_(e)}const rr=e=>"_"===e||"_ctx"===e||"$stable"===e,or=e=>g(e)?e.map(Vr):[Vr(e)],ir=(e,t,n)=>{if(t._n)return t;const s=mn(((...e)=>or(t(...e))),n);return s._c=!1,s},ar=(e,t,n)=>{const s=e._ctx;for(const n in e){if(rr(n))continue;const r=e[n];if(v(r))t[n]=ir(0,r,s);else if(null!=r){const e=or(r);t[n]=()=>e}}},lr=(e,t)=>{const n=or(t);e.slots.default=()=>n},cr=(e,t,n)=>{for(const s in t)!n&&rr(s)||(e[s]=t[s])},dr=function(e,t){t&&t.pendingBranch?g(e)?t.effects.push(...e):t.effects.push(e):(n=e,g(n)?$t.push(...n):Wt&&-1===n.id?Wt.splice(jt+1,0,n):1&n.flags||($t.push(n),n.flags|=1),Jt());var n};function ur(e,s){"boolean"!=typeof __VUE_OPTIONS_API__&&(U().__VUE_OPTIONS_API__=!0),"boolean"!=typeof __VUE_PROD_DEVTOOLS__&&(U().__VUE_PROD_DEVTOOLS__=!1),"boolean"!=typeof __VUE_PROD_HYDRATION_MISMATCH_DETAILS__&&(U().__VUE_PROD_HYDRATION_MISMATCH_DETAILS__=!1);const r=U();r.__VUE__=!0,__VUE_PROD_DEVTOOLS__&&an(r.__VUE_DEVTOOLS_GLOBAL_HOOK__,r);const{insert:i,remove:a,patchProp:l,createElement:c,createText:d,createComment:u,setText:g,setElementText:p,parentNode:m,nextSibling:f,setScopeId:v=o,insertStaticContent:S}=e,y=(e,t,n,s=null,r=null,o=null,i,a=null,l=!!t.dynamicChildren)=>{if(e===t)return;e&&!Ar(e,t)&&(s=Y(e),K(e,r,o,!0),e=null),-2===t.patchFlag&&(l=!1,t.dynamicChildren=null);const{type:c,ref:d,shapeFlag:u}=t;switch(c){case br:b(e,t,n,s);break;case Cr:w(e,t,n,s);break;case wr:null==e&&E(t,n,s,i);break;case yr:F(e,t,n,s,r,o,i,a,l);break;default:1&u?T(e,t,n,s,r,o,i,a,l):6&u?B(e,t,n,s,r,o,i,a,l):(64&u||128&u)&&c.process(e,t,n,s,r,o,i,a,l,ne)}null!=d&&r?Wn(d,e&&e.ref,o,t||e,!t):null==d&&e&&null!=e.ref&&Wn(e.ref,null,o,e,!0)},b=(e,t,n,s)=>{if(null==e)i(t.el=d(t.children),n,s);else{const n=t.el=e.el;t.children!==e.children&&g(n,t.children)}},w=(e,t,n,s)=>{null==e?i(t.el=u(t.children||""),n,s):t.el=e.el},E=(e,t,n,s)=>{[e.el,e.anchor]=S(e.children,t,n,s,e.el,e.anchor)},T=(e,t,n,s,r,o,i,a,l)=>{if("svg"===t.type?i="svg":"math"===t.type&&(i="mathml"),null==e)M(t,n,s,r,o,i,a,l);else{const n=e.el&&e.el._isVueCE?e.el:null;try{n&&n._beginPatch(),R(e,t,r,o,i,a,l)}finally{n&&n._endPatch()}}},M=(e,t,n,s,r,o,a,d)=>{let u,h;const{props:g,shapeFlag:m,transition:f,dirs:v}=e;if(u=e.el=c(e.type,o,g&&g.is,g),8&m?p(u,e.children):16&m&&x(e.children,u,null,s,r,hr(e,o),a,d),v&&vn(e,null,s,"created"),k(u,e,e.scopeId,a,s),g){for(const e in g)"value"===e||_(e)||l(u,e,null,g[e],o,s);"value"in g&&l(u,"value",null,g.value,o),(h=g.onVnodeBeforeMount)&&$r(h,s,e)}__VUE_PROD_DEVTOOLS__&&(D(u,"__vnode",e,!0),D(u,"__vueParentComponent",s,!0)),v&&vn(e,null,s,"beforeMount");const S=function(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}(r,f);S&&f.beforeEnter(u),i(u,t,n),((h=g&&g.onVnodeMounted)||S||v)&&dr((()=>{try{h&&$r(h,s,e),S&&f.enter(u),v&&vn(e,null,s,"mounted")}finally{}}),r)},k=(e,t,n,s,r)=>{if(n&&v(e,n),s)for(let t=0;t<s.length;t++)v(e,s[t]);if(r){let n=r.subTree;if(t===n||Sr(n.type)&&(n.ssContent===t||n.ssFallback===t)){const t=r.vnode;k(e,t,t.scopeId,t.slotScopeIds,r.parent)}}},x=(e,t,n,s,r,o,i,a,l=0)=>{for(let c=l;c<e.length;c++){const l=e[c]=a?Nr(e[c]):Vr(e[c]);y(null,l,t,n,s,r,o,i,a)}},R=(e,n,s,r,o,i,a)=>{const c=n.el=e.el;__VUE_PROD_DEVTOOLS__&&(c.__vnode=n);let{patchFlag:d,dynamicChildren:u,dirs:h}=n;d|=16&e.patchFlag;const g=e.props||t,m=n.props||t;let f;if(s&&gr(s,!1),(f=m.onVnodeBeforeUpdate)&&$r(f,s,n,e),h&&vn(n,e,s,"beforeUpdate"),s&&gr(s,!0),(g.innerHTML&&null==m.innerHTML||g.textContent&&null==m.textContent)&&p(c,""),u?A(e.dynamicChildren,u,c,s,r,hr(n,o),i):a||G(e,n,c,null,s,r,hr(n,o),i,!1),d>0){if(16&d)O(c,g,m,s,o);else if(2&d&&g.class!==m.class&&l(c,"class",null,m.class,o),4&d&&l(c,"style",g.style,m.style,o),8&d){const e=n.dynamicProps;for(let t=0;t<e.length;t++){const n=e[t],r=g[n],i=m[n];i===r&&"value"!==n||l(c,n,r,i,o,s)}}1&d&&e.children!==n.children&&p(c,n.children)}else a||null!=u||O(c,g,m,s,o);((f=m.onVnodeUpdated)||h)&&dr((()=>{f&&$r(f,s,n,e),h&&vn(n,e,s,"updated")}),r)},A=(e,t,n,s,r,o,i)=>{for(let a=0;a<t.length;a++){const l=e[a],c=t[a],d=l.el&&(l.type===yr||!Ar(l,c)||198&l.shapeFlag)?m(l.el):n;y(l,c,d,null,s,r,o,i,!0)}},O=(e,n,s,r,o)=>{if(n!==s){if(n!==t)for(const t in n)_(t)||t in s||l(e,t,n[t],null,o,r);for(const t in s){if(_(t))continue;const i=s[t],a=n[t];i!==a&&"value"!==t&&l(e,t,a,i,o,r)}"value"in s&&l(e,"value",n.value,s.value,o)}},F=(e,t,n,s,r,o,a,l,c)=>{const u=t.el=e?e.el:d(""),h=t.anchor=e?e.anchor:d("");let{patchFlag:g,dynamicChildren:p,slotScopeIds:m}=t;m&&(l=l?l.concat(m):m),null==e?(i(u,n,s),i(h,n,s),x(t.children||[],n,h,r,o,a,l,c)):g>0&&64&g&&p&&e.dynamicChildren&&e.dynamicChildren.length===p.length?(A(e.dynamicChildren,p,n,r,o,a,l),(null!=t.key||r&&t===r.subTree)&&pr(e,t,!0)):G(e,t,n,h,r,o,a,l,c)},B=(e,t,n,s,r,o,i,a,l)=>{t.slotScopeIds=a,null==e?512&t.shapeFlag?r.ctx.activate(t,n,s,i,l):z(t,n,s,r,o,i,l):V(e,t,l)},z=(e,n,s,r,o,i,a)=>{const l=e.component=function(e,n,s){const r=e.type,o=(n?n.appContext:e.appContext)||Wr,i={uid:jr++,vnode:e,type:r,parent:n,appContext:o,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new te(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:n?n.provides:Object.create(o.provides),ids:n?n.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:nr(r,o),emitsOptions:Gs(r,o),emit:null,emitted:null,propsDefaults:t,inheritAttrs:r.inheritAttrs,ctx:t,data:t,props:t,attrs:t,slots:t,refs:t,setupState:t,setupContext:null,suspense:s,suspenseId:s?s.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return i.ctx={_:i},i.root=n?n.root:i,i.emit=Ns.bind(null,i),e.ce&&e.ce(i),i}(e,r,o);if(qn(e)&&(l.ctx.renderer=ne),function(e,t=!1,n=!1){t&&Xr(t);const{props:s,children:r}=e.vnode,o=Zr(e);(function(e,t,n,s=!1){const r={},o=Js();e.propsDefaults=Object.create(null),Zs(e,t,r,o);for(const t in e.propsOptions[0])t in r||(r[t]=void 0);n?e.props=s?r:ut(r,!1,Je,st,it):e.type.props?e.props=r:e.props=o,e.attrs=o})(e,s,o,t),((e,t,n)=>{const s=e.slots=Js();if(32&e.vnode.shapeFlag){const e=t._;e?(cr(s,t,n),n&&D(s,"_",e,!0)):ar(t,s)}else t&&lr(e,t)})(e,r,n||t);const i=o?function(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,ws);const{setup:s}=n;if(s){be();const n=e.setupContext=s.length>1?ro(e):null,r=Jr(e),o=Ut(s,e,0,[e.props,n]),i=C(o);if(Ce(),r(),!i&&!e.sp||Kn(e)||Hn(e),i){if(o.then(Yr,Yr),t)return o.then((n=>{to(e,n,t)})).catch((t=>{Nt(t,e,0)}));e.asyncDep=o}else to(e,o,t)}else no(e,t)}(e,t):void 0;t&&Xr(!1)}(l,!1,a),l.asyncDep){if(o&&o.registerDep(l,N,a),!e.el){const t=l.subTree=Dr(Cr);w(null,t,n,s),e.placeholder=t.el}}else N(l,e,n,s,o,i,a)},V=(e,t,n)=>{const s=t.component=e.component;if(function(e,t,n){const{props:s,children:r,component:o}=e,{props:i,children:a,patchFlag:l}=t,c=o.emitsOptions;if(t.dirs||t.transition)return!0;if(!(n&&l>=0))return!(!r&&!a||a&&a.$stable)||s!==i&&(s?!i||qs(s,i,c):!!i);if(1024&l)return!0;if(16&l)return s?qs(s,i,c):!!i;if(8&l){const e=t.dynamicProps;for(let t=0;t<e.length;t++){const n=e[t];if(Qs(i,s,n)&&!$s(c,n))return!0}}return!1}(e,t,n)){if(s.asyncDep&&!s.asyncResolved)return void H(s,t,n);s.next=t,s.update()}else t.el=e.el,s.vnode=t},N=(e,t,n,s,r,o,i)=>{e.scope.on();const a=e.effect=new oe((()=>{if(e.isMounted){let{next:t,bu:n,u:s,parent:a,vnode:c}=e;{const n=mr(e);if(n)return t&&(t.el=c.el,H(e,t,i)),void n.asyncDep.then((()=>{dr((()=>{e.isUnmounted||l()}),r)}))}let d,u=t;gr(e,!1),t?(t.el=c.el,H(e,t,i)):t=c,n&&I(n),(d=t.props&&t.props.onVnodeBeforeUpdate)&&$r(d,a,t,c),gr(e,!0);const h=Ws(e),g=e.subTree;e.subTree=h,y(g,h,m(g.el),Y(g),e,r,o),t.el=h.el,null===u&&function({vnode:e,parent:t,suspense:n},s){for(;t;){const n=t.subTree;if(n.suspense&&n.suspense.activeBranch===e&&(n.suspense.vnode.el=n.el=s,e=n),n!==e)break;(e=t.vnode).el=s,t=t.parent}n&&n.activeBranch===e&&(n.vnode.el=s)}(e,h.el),s&&dr(s,r),(d=t.props&&t.props.onVnodeUpdated)&&dr((()=>$r(d,a,t,c)),r),__VUE_PROD_DEVTOOLS__&&cn(e)}else{let i;const{el:a,props:l}=t,{bm:c,m:d,parent:u,root:h,type:g}=e,p=Kn(t);if(gr(e,!1),c&&I(c),!p&&(i=l&&l.onVnodeBeforeMount)&&$r(i,u,t),gr(e,!0),a&&re){const t=()=>{e.subTree=Ws(e),re(a,e.subTree,e,r,null)};p&&g.__asyncHydrate?g.__asyncHydrate(a,e,t):t()}else{h.ce&&h.ce._hasShadowRoot()&&h.ce._injectChildStyle(g,e.parent?e.parent.type:void 0);const i=e.subTree=Ws(e);y(null,i,n,s,e,r,o),t.el=i.el}if(d&&dr(d,r),!p&&(i=l&&l.onVnodeMounted)){const e=t;dr((()=>$r(i,u,e)),r)}(256&t.shapeFlag||u&&Kn(u.vnode)&&256&u.vnode.shapeFlag)&&e.a&&dr(e.a,r),e.isMounted=!0,__VUE_PROD_DEVTOOLS__&&ln(e),t=n=s=null}}));e.scope.off();const l=e.update=a.run.bind(a),c=e.job=a.runIfDirty.bind(a);c.i=e,c.id=e.uid,a.scheduler=()=>Xt(c),gr(e,!0),l()},H=(e,n,s)=>{n.component=e;const r=e.vnode.props;e.vnode=n,e.next=null,function(e,t,n,s){const{props:r,attrs:o,vnode:{patchFlag:i}}=e,a=ft(r),[l]=e.propsOptions;let c=!1;if(!(s||i>0)||16&i){let s;Zs(e,t,r,o)&&(c=!0);for(const o in a)t&&(h(t,o)||(s=L(o))!==o&&h(t,s))||(l?!n||void 0===n[o]&&void 0===n[s]||(r[o]=er(l,a,o,void 0,e,!0)):delete r[o]);if(o!==a)for(const e in o)t&&h(t,e)||(delete o[e],c=!0)}else if(8&i){const n=e.vnode.dynamicProps;for(let s=0;s<n.length;s++){let i=n[s];if($s(e.emitsOptions,i))continue;const d=t[i];if(l)if(h(o,i))d!==o[i]&&(o[i]=d,c=!0);else{const t=P(i);r[t]=er(l,a,t,d,e,!1)}else d!==o[i]&&(o[i]=d,c=!0)}}c&&Ae(e.attrs,"set","")}(e,n.props,r,s),((e,n,s)=>{const{vnode:r,slots:o}=e;let i=!0,a=t;if(32&r.shapeFlag){const e=n._;e?s&&1===e?i=!1:cr(o,n,s):(i=!n.$stable,ar(n,o)),a=n}else n&&(lr(e,n),a={default:1});if(i)for(const e in o)rr(e)||null!=a[e]||delete o[e]})(e,n.children,s),be(),Yt(e),Ce()},G=(e,t,n,s,r,o,i,a,l=!1)=>{const c=e&&e.children,d=e?e.shapeFlag:0,u=t.children,{patchFlag:h,shapeFlag:g}=t;if(h>0){if(128&h)return void W(c,u,n,s,r,o,i,a,l);if(256&h)return void $(c,u,n,s,r,o,i,a,l)}8&g?(16&d&&J(c,r,o),u!==c&&p(n,u)):16&d?16&g?W(c,u,n,s,r,o,i,a,l):J(c,r,o,!0):(8&d&&p(n,""),16&g&&x(u,n,s,r,o,i,a,l))},$=(e,t,s,r,o,i,a,l,c)=>{t=t||n;const d=(e=e||n).length,u=t.length,h=Math.min(d,u);let g;for(g=0;g<h;g++){const n=t[g]=c?Nr(t[g]):Vr(t[g]);y(e[g],n,s,null,o,i,a,l,c)}d>u?J(e,o,i,!0,!1,h):x(t,s,r,o,i,a,l,c,h)},W=(e,t,s,r,o,i,a,l,c)=>{let d=0;const u=t.length;let h=e.length-1,g=u-1;for(;d<=h&&d<=g;){const n=e[d],r=t[d]=c?Nr(t[d]):Vr(t[d]);if(!Ar(n,r))break;y(n,r,s,null,o,i,a,l,c),d++}for(;d<=h&&d<=g;){const n=e[h],r=t[g]=c?Nr(t[g]):Vr(t[g]);if(!Ar(n,r))break;y(n,r,s,null,o,i,a,l,c),h--,g--}if(d>h){if(d<=g){const e=g+1,n=e<u?t[e].el:r;for(;d<=g;)y(null,t[d]=c?Nr(t[d]):Vr(t[d]),s,n,o,i,a,l,c),d++}}else if(d>g)for(;d<=h;)K(e[d],o,i,!0),d++;else{const p=d,m=d,f=new Map;for(d=m;d<=g;d++){const e=t[d]=c?Nr(t[d]):Vr(t[d]);null!=e.key&&f.set(e.key,d)}let v,S=0;const b=g-m+1;let C=!1,w=0;const E=new Array(b);for(d=0;d<b;d++)E[d]=0;for(d=p;d<=h;d++){const n=e[d];if(S>=b){K(n,o,i,!0);continue}let r;if(null!=n.key)r=f.get(n.key);else for(v=m;v<=g;v++)if(0===E[v-m]&&Ar(n,t[v])){r=v;break}void 0===r?K(n,o,i,!0):(E[r-m]=d+1,r>=w?w=r:C=!0,y(n,t[r],s,null,o,i,a,l,c),S++)}const T=C?function(e){const t=e.slice(),n=[0];let s,r,o,i,a;const l=e.length;for(s=0;s<l;s++){const l=e[s];if(0!==l){if(r=n[n.length-1],e[r]<l){t[s]=r,n.push(s);continue}for(o=0,i=n.length-1;o<i;)a=o+i>>1,e[n[a]]<l?o=a+1:i=a;l<e[n[o]]&&(o>0&&(t[s]=n[o-1]),n[o]=s)}}for(o=n.length,i=n[o-1];o-- >0;)n[o]=i,i=t[i];return n}(E):n;for(v=T.length-1,d=b-1;d>=0;d--){const e=m+d,n=t[e],h=t[e+1],g=e+1<u?h.el||vr(h):r;0===E[d]?y(null,n,s,g,o,i,a,l,c):C&&(v<0||d!==T[v]?j(n,s,g,2):v--)}}},j=(e,t,n,s,r=null)=>{const{el:o,type:l,transition:c,children:d,shapeFlag:u}=e;if(6&u)j(e.component.subTree,t,n,s);else if(128&u)e.suspense.move(t,n,s);else if(64&u)l.move(e,t,n,ne);else if(l!==yr)if(l!==wr)if(2!==s&&1&u&&c)if(0===s)c.persisted&&!o[xn]?i(o,t,n):(c.beforeEnter(o),i(o,t,n),dr((()=>c.enter(o)),r));else{const{leave:s,delayLeave:r,afterLeave:l}=c,d=()=>{e.ctx.isUnmounted?a(o):i(o,t,n)},u=()=>{const e=o._isLeaving||!!o[xn];o._isLeaving&&o[xn](!0),c.persisted&&!e?d():s(o,(()=>{d(),l&&l()}))};r?r(o,d,u):u()}else i(o,t,n);else(({el:e,anchor:t},n,s)=>{let r;for(;e&&e!==t;)r=f(e),i(e,n,s),e=r;i(t,n,s)})(e,t,n);else{i(o,t,n);for(let e=0;e<d.length;e++)j(d[e],t,n,s);i(e.anchor,t,n)}},K=(e,t,n,s=!1,r=!1)=>{const{type:o,props:i,ref:a,children:l,dynamicChildren:c,shapeFlag:d,patchFlag:u,dirs:h,cacheIndex:g,memo:p}=e;if(-2===u&&(r=!1),null!=a&&(be(),Wn(a,null,n,e,!0),Ce()),null!=g&&(t.renderCache[g]=void 0),256&d)return void t.ctx.deactivate(e);const m=1&d&&h,f=!Kn(e);let v;if(f&&(v=i&&i.onVnodeBeforeUnmount)&&$r(v,t,e),6&d)X(e.component,n,s);else{if(128&d)return void e.suspense.unmount(n,s);m&&vn(e,null,t,"beforeUnmount"),64&d?e.type.remove(e,t,n,ne,s):c&&!c.hasOnce&&(o!==yr||u>0&&64&u)?J(c,t,n,!1,!0):(o===yr&&384&u||!r&&16&d)&&J(l,t,n),s&&q(e)}const S=null!=p&&null==g;(f&&(v=i&&i.onVnodeUnmounted)||m||S)&&dr((()=>{v&&$r(v,t,e),m&&vn(e,null,t,"unmounted"),S&&(e.el=null)}),n)},q=e=>{const{type:t,el:n,anchor:s,transition:r}=e;if(t===yr)return void Q(n,s);if(t===wr)return void(({el:e,anchor:t})=>{let n;for(;e&&e!==t;)n=f(e),a(e),e=n;a(t)})(e);const o=()=>{a(n),r&&!r.persisted&&r.afterLeave&&r.afterLeave()};if(1&e.shapeFlag&&r&&!r.persisted){const{leave:t,delayLeave:s}=r,i=()=>t(n,o);s?s(e.el,o,i):i()}else o()},Q=(e,t)=>{let n;for(;e!==t;)n=f(e),a(e),e=n;a(t)},X=(e,t,n)=>{const{bum:s,scope:r,job:o,subTree:i,um:a,m:l,a:c}=e;var d;fr(l),fr(c),s&&I(s),r.stop(),o&&(o.flags|=8,K(i,e,t,n)),a&&dr(a,t),dr((()=>{e.isUnmounted=!0}),t),__VUE_PROD_DEVTOOLS__&&(d=e,nn&&"function"==typeof nn.cleanupBuffer&&!nn.cleanupBuffer(d)&&dn(d))},J=(e,t,n,s=!1,r=!1,o=0)=>{for(let i=o;i<e.length;i++)K(e[i],t,n,s,r)},Y=e=>{if(6&e.shapeFlag)return Y(e.component.subTree);if(128&e.shapeFlag)return e.suspense.next();const t=f(e.anchor||e.el),n=t&&t[_n];return n?f(n):t};let Z=!1;const ee=(e,t,n)=>{let s;null==e?t._vnode&&(K(t._vnode,null,null,!0),s=t._vnode.component):y(t._vnode||null,e,t,null,null,null,n),t._vnode=e,Z||(Z=!0,Yt(s),Zt(),Z=!1)},ne={p:y,um:K,m:j,r:q,mt:z,mc:x,pc:G,pbc:A,n:Y,o:e};let se,re;return s&&([se,re]=s(ne)),{render:ee,hydrate:se,createApp:Us(ee,se)}}function hr({type:e,props:t},n){return"svg"===n&&"foreignObject"===e||"mathml"===n&&"annotation-xml"===e&&t&&t.encoding&&t.encoding.includes("html")?void 0:n}function gr({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function pr(e,t,n=!1){const s=e.children,r=t.children;if(g(s)&&g(r))for(let e=0;e<s.length;e++){const t=s[e];let o=r[e];1&o.shapeFlag&&!o.dynamicChildren&&((o.patchFlag<=0||32===o.patchFlag)&&(o=r[e]=Nr(r[e]),o.el=t.el),n||-2===o.patchFlag||pr(t,o)),o.type===br&&(-1===o.patchFlag&&(o=r[e]=Nr(o)),o.el=t.el),o.type!==Cr||o.el||(o.el=t.el)}}function mr(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:mr(t)}function fr(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function vr(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?vr(t.subTree):null}const Sr=e=>e.__isSuspense;const yr=Symbol.for("v-fgt"),br=Symbol.for("v-txt"),Cr=Symbol.for("v-cmt"),wr=Symbol.for("v-stc"),Er=[];let Tr=null;function Mr(e=!1){Er.push(Tr=e?null:[])}let _r=1;function kr(e,t=!1){_r+=e,e<0&&Tr&&t&&(Tr.hasOnce=!0)}function xr(e){return e.dynamicChildren=_r>0?Tr||n:null,Er.pop(),Tr=Er[Er.length-1]||null,_r>0&&Tr&&Tr.push(e),e}function Pr(e,t,n,s,r,o){return xr(Ir(e,t,n,s,r,o,!0))}function Rr(e,t,n,s,r){return xr(Dr(e,t,n,s,r,!0))}function Lr(e){return!!e&&!0===e.__v_isVNode}function Ar(e,t){return e.type===t.type&&e.key===t.key}const Or=({key:e})=>null!=e?e:null,Fr=({ref:e,ref_key:t,ref_for:n})=>("number"==typeof e&&(e=""+e),null!=e?S(e)||bt(e)||v(e)?{i:hn,r:e,k:t,f:!!n}:e:null);function Ir(e,t=null,n=null,s=0,r=null,o=(e===yr?0:1),i=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Or(t),ref:t&&Fr(t),scopeId:gn,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:o,patchFlag:s,dynamicProps:r,dynamicChildren:null,appContext:null,ctx:hn};return a?(Hr(l,n),128&o&&e.normalize(l)):n&&(l.shapeFlag|=S(n)?8:16),_r>0&&!i&&Tr&&(l.patchFlag>0||6&o)&&32!==l.patchFlag&&Tr.push(l),l}const Dr=function(e,t=null,n=null,s=0,r=null,o=!1){if(e&&e!==gs||(e=Cr),Lr(e)){const s=Br(e,t,!0);return n&&Hr(s,n),_r>0&&!o&&Tr&&(6&s.shapeFlag?Tr[Tr.indexOf(e)]=s:Tr.push(s)),s.patchFlag=-2,s}if(i=e,v(i)&&"__vccOpts"in i&&(e=e.__vccOpts),t){t=function(e){return e?mt(e)||Ys(e)?c({},e):e:null}(t);let{class:e,style:n}=t;e&&!S(e)&&(t.class=W(e)),b(n)&&(mt(n)&&!g(n)&&(n=c({},n)),t.style=V(n))}var i;return Ir(e,t,n,s,r,S(e)?1:Sr(e)?128:kn(e)?64:b(e)?4:v(e)?2:0,o,!0)};function Br(e,t,n=!1,s=!1){const{props:r,ref:o,patchFlag:i,children:a,transition:l}=e,c=t?Gr(r||{},t):r,d={__v_isVNode:!0,__v_skip:!0,type:e.type,props:c,key:c&&Or(c),ref:t&&t.ref?n&&o?g(o)?o.concat(Fr(t)):[o,Fr(t)]:Fr(t):o,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:a,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==yr?-1===i?16:16|i:i,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:l,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&Br(e.ssContent),ssFallback:e.ssFallback&&Br(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&s&&Un(d,l.clone(d)),d}function zr(e=" ",t=0){return Dr(br,null,e,t)}function Ur(e="",t=!1){return t?(Mr(),Rr(Cr,null,e)):Dr(Cr,null,e)}function Vr(e){return null==e||"boolean"==typeof e?Dr(Cr):g(e)?Dr(yr,null,e.slice()):Lr(e)?Nr(e):Dr(br,null,String(e))}function Nr(e){return null===e.el&&-1!==e.patchFlag||e.memo?e:Br(e)}function Hr(e,t){let n=0;const{shapeFlag:s}=e;if(null==t)t=null;else if(g(t))n=16;else if("object"==typeof t){if(65&s){const n=t.default;return void(n&&(n._c&&(n._d=!1),Hr(e,n()),n._c&&(n._d=!0)))}{n=32;const s=t._;s||Ys(t)?3===s&&hn&&(1===hn.slots._?t._=1:(t._=2,e.patchFlag|=1024)):t._ctx=hn}}else v(t)?(t={default:t,_ctx:hn},n=32):(t=String(t),64&s?(n=16,t=[zr(t)]):n=8);e.children=t,e.shapeFlag|=n}function Gr(...e){const t={};for(let n=0;n<e.length;n++){const s=e[n];for(const e in s)if("class"===e)t.class!==s.class&&(t.class=W([t.class,s.class]));else if("style"===e)t.style=V([t.style,s.style]);else if(a(e)){const n=t[e],r=s[e];!r||n===r||g(n)&&n.includes(r)?null!=r||null!=n||l(e)||(t[e]=r):t[e]=n?[].concat(n,r):r}else""!==e&&(t[e]=s[e])}return t}function $r(e,t,n,s=null){Vt(e,t,7,[n,s])}const Wr=Bs();let jr=0;let Kr=null;const qr=()=>Kr||hn;let Qr,Xr;{const e=U(),t=(t,n)=>{let s;return(s=e[t])||(s=e[t]=[]),s.push(n),e=>{s.length>1?s.forEach((t=>t(e))):s[0](e)}};Qr=t("__VUE_INSTANCE_SETTERS__",(e=>Kr=e)),Xr=t("__VUE_SSR_SETTERS__",(e=>eo=e))}const Jr=e=>{const t=Kr;return Qr(e),e.scope.on(),()=>{e.scope.off(),Qr(t)}},Yr=()=>{Kr&&Kr.scope.off(),Qr(null)};function Zr(e){return 4&e.vnode.shapeFlag}let eo=!1;function to(e,t,n){v(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:b(t)&&(__VUE_PROD_DEVTOOLS__&&(e.devtoolsRawSetupState=t),e.setupState=xt(t)),no(e,n)}function no(e,t,n){const s=e.type;if(e.render||(e.render=s.render||o),__VUE_OPTIONS_API__){const t=Jr(e);be();try{!function(e){const t=Ps(e),n=e.proxy,s=e.ctx;_s=!1,t.beforeCreate&&ks(t.beforeCreate,e,"bc");const{data:r,computed:i,methods:a,watch:l,provide:c,inject:d,created:u,beforeMount:h,mounted:p,beforeUpdate:m,updated:f,activated:S,deactivated:y,beforeDestroy:C,beforeUnmount:w,destroyed:E,unmounted:T,render:M,renderTracked:_,renderTriggered:k,errorCaptured:x,serverPrefetch:P,expose:R,inheritAttrs:L,components:A,directives:O,filters:F}=t;if(d&&function(e,t,n=o){g(e)&&(e=Os(e));for(const n in e){const s=e[n];let r;r=b(s)?"default"in s?yn(s.from||n,s.default,!0):yn(s.from||n):yn(s),bt(r)?Object.defineProperty(t,n,{enumerable:!0,configurable:!0,get:()=>r.value,set:e=>r.value=e}):t[n]=r}}(d,s,null),a)for(const e in a){const t=a[e];v(t)&&(s[e]=t.bind(n))}if(r){const t=r.call(n,n);b(t)&&(e.data=ct(t))}if(_s=!0,i)for(const e in i){const t=i[e],r=v(t)?t.bind(n,n):v(t.get)?t.get.bind(n,n):o,a=!v(t)&&v(t.set)?t.set.bind(n):o,l=io({get:r,set:a});Object.defineProperty(s,e,{enumerable:!0,configurable:!0,get:()=>l.value,set:e=>l.value=e})}if(l)for(const e in l)xs(l[e],s,n,e);if(c){const e=v(c)?c.call(n):c;Reflect.ownKeys(e).forEach((t=>{Sn(t,e[t])}))}function I(e,t){g(t)?t.forEach((t=>e(t.bind(n)))):t&&e(t.bind(n))}if(u&&ks(u,e,"c"),I(ts,h),I(ns,p),I(ss,m),I(rs,f),I(Qn,S),I(Xn,y),I(ds,x),I(cs,_),I(ls,k),I(os,w),I(is,T),I(as,P),g(R))if(R.length){const t=e.exposed||(e.exposed={});R.forEach((e=>{Object.defineProperty(t,e,{get:()=>n[e],set:t=>n[e]=t,enumerable:!0})}))}else e.exposed||(e.exposed={});M&&e.render===o&&(e.render=M),null!=L&&(e.inheritAttrs=L),A&&(e.components=A),O&&(e.directives=O),P&&Hn(e)}(e)}finally{Ce(),t()}}}const so={get:(e,t)=>(Le(e,0,""),e[t])};function ro(e){return{attrs:new Proxy(e.attrs,so),slots:e.slots,emit:e.emit,expose:t=>{e.exposed=t||{}}}}function oo(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(xt(vt(e.exposed)),{get:(t,n)=>n in t?t[n]:n in bs?bs[n](e):void 0,has:(e,t)=>t in e||t in bs})):e.proxy}const io=(e,t)=>{const n=function(e,t,n=!1){let s,r;return v(e)?s=e:(s=e.get,r=e.set),new Ft(s,r,n)}(e,0,eo);return n};function ao(e,t,n){try{kr(-1);const s=arguments.length;return 2===s?b(t)&&!g(t)?Lr(t)?Dr(e,null,[t]):Dr(e,t):Dr(e,null,t):(s>3?n=Array.prototype.slice.call(arguments,2):3===s&&Lr(n)&&(n=[n]),Dr(e,t,n))}finally{kr(1)}}const lo="3.5.38",co=o;const uo="undefined"!=typeof window&&"undefined"!=typeof document,ho=("undefined"!=typeof WorkerGlobalScope&&(globalThis,WorkerGlobalScope),Object.prototype.toString);function go(e){return Array.isArray(e)?e:[e]}function po(e){const t=Object.create(null);return n=>t[n]||(t[n]=e(n))}const mo=/\B([A-Z])/g,fo=(po((e=>e.replace(mo,"-$1").toLowerCase())),/-(\w)/g);po((e=>e.replace(fo,((e,t)=>t?t.toUpperCase():""))));const vo=e=>"number"==typeof e,So=e=>"undefined"!=typeof Element&&e instanceof Element;var yo=class extends Error{constructor(e){super(e),this.name="ElementPlusError"}};function bo(e,t){{const n=S(e)?new yo(`[${e}] ${t}`):e;console.warn(n)}}var Co=(e,t)=>{const n=e.__vccOpts||e;for(const[e,s]of t)n[e]=s;return n};const wo="object"==typeof global&&global&&global.Object===Object&&global;var Eo="object"==typeof self&&self&&self.Object===Object&&self;const To=wo||Eo||Function("return this")(),Mo=To.Symbol;var _o=Object.prototype,ko=_o.hasOwnProperty,xo=_o.toString,Po=Mo?Mo.toStringTag:void 0;var Ro=Object.prototype.toString;var Lo=Mo?Mo.toStringTag:void 0;const Ao=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Lo&&Lo in Object(e)?function(e){var t=ko.call(e,Po),n=e[Po];try{e[Po]=void 0;var s=!0}catch(e){}var r=xo.call(e);return s&&(t?e[Po]=n:delete e[Po]),r}(e):function(e){return Ro.call(e)}(e)},Oo=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},Fo=To["__core-js_shared__"];var Io=function(){var e=/[^.]+$/.exec(Fo&&Fo.keys&&Fo.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();var Do=Function.prototype.toString;var Bo=/^\[object .+?Constructor\]$/,zo=Function.prototype,Uo=Object.prototype,Vo=zo.toString,No=Uo.hasOwnProperty,Ho=RegExp("^"+Vo.call(No).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");const Go=function(e){return!(!Oo(e)||(t=e,Io&&Io in t))&&(function(e){if(!Oo(e))return!1;var t=Ao(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}(e)?Ho:Bo).test(function(e){if(null!=e){try{return Do.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e));var t},$o=function(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Go(n)?n:void 0},Wo=function(){try{var e=$o(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),jo=function(e,t,n){"__proto__"==t&&Wo?Wo(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},Ko=function(e){for(var t=-1,n=null==e?0:e.length,s={};++t<n;){var r=e[t];jo(s,r[0],r[1])}return s},qo=(e,t)=>{if(!b(e)||b(n=e)&&n.__epPropKey)return e;var n;const{values:s,required:r,default:o,type:i,validator:a}=e,l={type:i,required:!!r,validator:s||a?n=>{let r=!1,i=[];if(s&&(i=Array.from(s),h(e,"default")&&i.push(o),r||=i.includes(n)),a&&(r||=a(n)),!r&&i.length>0){const e=[...new Set(i)].map((e=>JSON.stringify(e))).join(", ");co(`Invalid prop: validation failed${t?` for prop "${t}"`:""}. Expected one of [${e}], got value ${JSON.stringify(n)}.`)}return r}:void 0,__epPropKey:!0};return h(e,"default")&&(l.default=o),l},Qo=e=>Ko(Object.entries(e).map((([e,t])=>[e,qo(t,e)])));var Xo=Nn({name:"CircleCheck",__name:"circle-check",setup:e=>(e,t)=>(Mr(),Pr("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[Ir("path",{fill:"currentColor",d:"M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"}),Ir("path",{fill:"currentColor",d:"M745.344 361.344a32 32 0 0 1 45.312 45.312l-288 288a32 32 0 0 1-45.312 0l-160-160a32 32 0 1 1 45.312-45.312L480 626.752z"})]))}),Jo=Nn({name:"CircleCloseFilled",__name:"circle-close-filled",setup:e=>(e,t)=>(Mr(),Pr("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[Ir("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 393.664L407.936 353.6a38.4 38.4 0 1 0-54.336 54.336L457.664 512 353.6 616.064a38.4 38.4 0 1 0 54.336 54.336L512 566.336 616.064 670.4a38.4 38.4 0 1 0 54.336-54.336L566.336 512 670.4 407.936a38.4 38.4 0 1 0-54.336-54.336z"})]))}),Yo=Nn({name:"CircleClose",__name:"circle-close",setup:e=>(e,t)=>(Mr(),Pr("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[Ir("path",{fill:"currentColor",d:"m466.752 512-90.496-90.496a32 32 0 0 1 45.248-45.248L512 466.752l90.496-90.496a32 32 0 1 1 45.248 45.248L557.248 512l90.496 90.496a32 32 0 1 1-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 0 1-45.248-45.248z"}),Ir("path",{fill:"currentColor",d:"M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"})]))}),Zo=Nn({name:"Close",__name:"close",setup:e=>(e,t)=>(Mr(),Pr("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[Ir("path",{fill:"currentColor",d:"M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"})]))}),ei=Nn({name:"Hide",__name:"hide",setup:e=>(e,t)=>(Mr(),Pr("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[Ir("path",{fill:"currentColor",d:"M876.8 156.8c0-9.6-3.2-16-9.6-22.4s-12.8-9.6-22.4-9.6-16 3.2-22.4 9.6L736 220.8c-64-32-137.6-51.2-224-60.8-160 16-288 73.6-377.6 176S0 496 0 512s48 73.6 134.4 176c22.4 25.6 44.8 48 73.6 67.2l-86.4 89.6c-6.4 6.4-9.6 12.8-9.6 22.4s3.2 16 9.6 22.4 12.8 9.6 22.4 9.6 16-3.2 22.4-9.6l704-710.4c3.2-6.4 6.4-12.8 6.4-22.4m-646.4 528Q115.2 579.2 76.8 512q43.2-72 153.6-172.8C304 272 400 230.4 512 224c64 3.2 124.8 19.2 176 44.8l-54.4 54.4C598.4 300.8 560 288 512 288c-64 0-115.2 22.4-160 64s-64 96-64 160c0 48 12.8 89.6 35.2 124.8L256 707.2c-9.6-6.4-19.2-16-25.6-22.4m140.8-96Q352 555.2 352 512c0-44.8 16-83.2 48-112s67.2-48 112-48c28.8 0 54.4 6.4 73.6 19.2zM889.599 336c-12.8-16-28.8-28.8-41.6-41.6l-48 48c73.6 67.2 124.8 124.8 150.4 169.6q-43.2 72-153.6 172.8c-73.6 67.2-172.8 108.8-284.8 115.2-51.2-3.2-99.2-12.8-140.8-28.8l-48 48c57.6 22.4 118.4 38.4 188.8 44.8 160-16 288-73.6 377.6-176S1024 528 1024 512s-48.001-73.6-134.401-176"}),Ir("path",{fill:"currentColor",d:"M511.998 672c-12.8 0-25.6-3.2-38.4-6.4l-51.2 51.2c28.8 12.8 57.6 19.2 89.6 19.2 64 0 115.2-22.4 160-64 41.6-41.6 64-96 64-160 0-32-6.4-64-19.2-89.6l-51.2 51.2c3.2 12.8 6.4 25.6 6.4 38.4 0 44.8-16 83.2-48 112s-67.2 48-112 48"})]))}),ti=Nn({name:"InfoFilled",__name:"info-filled",setup:e=>(e,t)=>(Mr(),Pr("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[Ir("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896.064A448 448 0 0 1 512 64m67.2 275.072c33.28 0 60.288-23.104 60.288-57.344s-27.072-57.344-60.288-57.344c-33.28 0-60.16 23.104-60.16 57.344s26.88 57.344 60.16 57.344M590.912 699.2c0-6.848 2.368-24.64 1.024-34.752l-52.608 60.544c-10.88 11.456-24.512 19.392-30.912 17.28a12.99 12.99 0 0 1-8.256-14.72l87.68-276.992c7.168-35.136-12.544-67.2-54.336-71.296-44.096 0-108.992 44.736-148.48 101.504 0 6.784-1.28 23.68.064 33.792l52.544-60.608c10.88-11.328 23.552-19.328 29.952-17.152a12.8 12.8 0 0 1 7.808 16.128L388.48 728.576c-10.048 32.256 8.96 63.872 55.04 71.04 67.84 0 107.904-43.648 147.456-100.416z"})]))}),ni=Nn({name:"Loading",__name:"loading",setup:e=>(e,t)=>(Mr(),Pr("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[Ir("path",{fill:"currentColor",d:"M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32m0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32m448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32m-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32M195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248m452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248M828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0m-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0"})]))}),si=Nn({name:"SuccessFilled",__name:"success-filled",setup:e=>(e,t)=>(Mr(),Pr("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[Ir("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m-55.808 536.384-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.27 38.27 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336z"})]))}),ri=Nn({name:"View",__name:"view",setup:e=>(e,t)=>(Mr(),Pr("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[Ir("path",{fill:"currentColor",d:"M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352m0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288m0 64a224 224 0 1 1 0 448 224 224 0 0 1 0-448m0 64a160.19 160.19 0 0 0-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160"})]))}),oi=Nn({name:"WarningFilled",__name:"warning-filled",setup:e=>(e,t)=>(Mr(),Pr("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[Ir("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 192a58.43 58.43 0 0 0-58.24 63.744l23.36 256.384a35.072 35.072 0 0 0 69.76 0l23.296-256.384A58.43 58.43 0 0 0 512 256m0 512a51.2 51.2 0 1 0 0-102.4 51.2 51.2 0 0 0 0 102.4"})]))});const ii=[String,Object,Function],ai={Close:Zo,SuccessFilled:si,InfoFilled:ti,WarningFilled:oi,CircleCloseFilled:Jo},li={primary:ti,success:si,warning:oi,error:Jo,info:ti},ci={validating:ni,success:Xo,error:Yo},di=["","default","small","large"],ui=e=>"undefined"!=typeof Element&&e instanceof Element,hi=e=>Array.from(e.querySelectorAll('a[href],button:not([disabled]),button:not([hidden]),:not([tabindex="-1"]),input:not([disabled]),input:not([type="hidden"]),select:not([disabled]),textarea:not([disabled])')).filter((e=>gi(e)&&(e=>"fixed"!==getComputedStyle(e).position&&null!==e.offsetParent)(e))),gi=e=>{if(e.tabIndex>0||0===e.tabIndex&&null!==e.getAttribute("tabIndex"))return!0;if(e.tabIndex<0||e.hasAttribute("disabled")||"true"===e.getAttribute("aria-disabled"))return!1;switch(e.nodeName){case"A":return!!e.href&&"ignore"!==e.rel;case"INPUT":return!("hidden"===e.type||"file"===e.type);case"BUTTON":case"SELECT":case"TEXTAREA":return!0;default:return!1}},pi=(e="")=>e.split(" ").filter((e=>!!e.trim()));function mi(e,t="px"){return e||0===e?vo(e)||S(n=e)&&!Number.isNaN(Number(n))?`${e}${t}`:S(e)?e:void bo("utils/dom/style","binding value must be a string or number"):"";var n}var fi=/\s/;var vi=/^\s+/;const Si=function(e){return e?e.slice(0,function(e){for(var t=e.length;t--&&fi.test(e.charAt(t)););return t}(e)+1).replace(vi,""):e},yi=function(e){return null!=e&&"object"==typeof e},bi=function(e){return"symbol"==typeof e||yi(e)&&"[object Symbol]"==Ao(e)};var Ci=/^[-+]0x[0-9a-f]+$/i,wi=/^0b[01]+$/i,Ei=/^0o[0-7]+$/i,Ti=parseInt;const Mi=function(e){if("number"==typeof e)return e;if(bi(e))return NaN;if(Oo(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Oo(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Si(e);var n=wi.test(e);return n||Ei.test(e)?Ti(e.slice(2),n?2:8):Ci.test(e)?NaN:+e},_i=function(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=Mi(n))==n?n:0),void 0!==t&&(t=(t=Mi(t))==t?t:0),function(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}(Mi(e),t,n)};let ki;const xi=e=>{if(!uo)return 0;if(void 0!==ki)return ki;const t=document.createElement("div");t.className=`${e}-scrollbar__wrap`,t.style.visibility="hidden",t.style.width="100px",t.style.position="absolute",t.style.top="-9999px",document.body.appendChild(t);const n=t.offsetWidth;t.style.overflow="scroll";const s=document.createElement("div");s.style.width="100%",t.appendChild(s);const r=s.offsetWidth;return t.parentNode?.removeChild(t),ki=n-r,ki},Pi=(e,t,n,s,r)=>{let o=`${e}-${t}`;return n&&(o+=`-${n}`),s&&(o+=`__${s}`),r&&(o+=`--${r}`),o},Ri=Symbol("namespaceContextKey"),Li=e=>{const t=e||(qr()?yn(Ri,Ct("el")):Ct("el"));return io((()=>Mt(t)||"el"))},Ai=(e,t)=>{const n=Li(t);return{namespace:n,b:(t="")=>Pi(n.value,e,t,"",""),e:t=>t?Pi(n.value,e,"",t,""):"",m:t=>t?Pi(n.value,e,"","",t):"",be:(t,s)=>t&&s?Pi(n.value,e,t,s,""):"",em:(t,s)=>t&&s?Pi(n.value,e,"",t,s):"",bm:(t,s)=>t&&s?Pi(n.value,e,t,"",s):"",bem:(t,s,r)=>t&&s&&r?Pi(n.value,e,t,s,r):"",is:(e,...t)=>{const n=!(t.length>=1)||t[0];return e&&n?`is-${e}`:""},cssVar:e=>{const t={};for(const s in e)e[s]&&(t[`--${n.value}-${s}`]=e[s]);return t},cssVarName:e=>`--${n.value}-${e}`,cssVarBlock:t=>{const s={};for(const r in t)t[r]&&(s[`--${n.value}-${e}-${r}`]=t[r]);return s},cssVarBlockName:t=>`--${n.value}-${e}-${t}`}},Oi=(e,t={})=>{bt(e)||function(e,t){throw new yo("[[useLockscreen]] You need to pass a ref param to this function")}();const n=t.ns||Ai("popup"),s=io((()=>n.bm("parent","hidden")));let r=0,o=!1,i="0",a=!1;const l=()=>{a||(a=!0,setTimeout((()=>{var e,t;"undefined"!=typeof document&&o&&document&&(document.body.style.width=i,e=document.body,t=s.value,e&&t.trim()&&e.classList.remove(...pi(t)))}),200))};wn(e,(e=>{if(!e)return void l();var t,c;a=!1,o=!((e,t)=>{if(!e||!t)return!1;if(t.includes(" "))throw new Error("className should not contain space.");return e.classList.contains(t)})(document.body,s.value),o&&(i=document.body.style.width,t=document.body,c=s.value,t&&c.trim()&&t.classList.add(...pi(c))),r=xi(n.namespace.value);const d=document.documentElement.clientHeight<document.body.scrollHeight,u=((e,t)=>{if(!uo||!e||!t||"undefined"!=typeof ShadowRoot&&e instanceof ShadowRoot)return"";let n=P(t);"float"===n&&(n="cssFloat");try{const t=e.style[n];if(t)return t;const s=document.defaultView?.getComputedStyle(e,"");return s?s[n]:""}catch{return e.style[n]}})(document.body,"overflowY");r>0&&(d||"scroll"===u)&&o&&(document.body.style.width=`calc(100% - ${r}px)`)})),se((()=>l()))},Fi=e=>{if(!e)return{onClick:o,onMousedown:o,onMouseup:o};let t=!1,n=!1;return{onClick:s=>{t&&n&&e(s),t=n=!1},onMousedown:e=>{t=e.target===e.currentTarget},onMouseup:e=>{n=e.target===e.currentTarget}}},Ii={prefix:Math.floor(1e4*Math.random()),current:0},Di=Symbol("elIdInjection"),Bi=e=>{const t=qr()?yn(Di,Ii):Ii;uo||t!==Ii||bo("IdInjection","Looks like you are using server rendering, you must provide a id provider to ensure the hydration process to be succeed\nusage: app.provide(ID_INJECTION_KEY, {\n prefix: number,\n current: number,\n})");const n=Li();return function(e,t){var n;const s=wt();return Cn((()=>{s.value=e()}),{...t,flush:null!==(n=null==t?void 0:t.flush)&&void 0!==n?n:"sync"}),dt(s)}((()=>Mt(e)||`${n.value}-id-${t.prefix}-${t.current++}`))},zi=(Ui=Object.getPrototypeOf,Vi=Object,function(e){return Ui(Vi(e))});var Ui,Vi,Ni=Function.prototype,Hi=Object.prototype,Gi=Ni.toString,$i=Hi.hasOwnProperty,Wi=Gi.call(Object);const ji=function(e){if(!yi(e)||"[object Object]"!=Ao(e))return!1;var t=zi(e);if(null===t)return!0;var n=$i.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Gi.call(n)==Wi},Ki=e=>{const t=e.props,n=g(t)?Ko(t.map((e=>[e,{}]))):t;e.setPropsDefaults=t=>{if(n){for(const[e,s]of Object.entries(t)){const t=n[e];h(n,e)&&(ji(t)?n[e]={...t,default:s}:n[e]={type:t,default:s})}e.props=n}}},qi=(e,t)=>{if(e.install=n=>{for(const s of[e,...Object.values(t??{})])n.component(s.name,s)},t)for(const[n,s]of Object.entries(t))e[n]=s;return Ki(e),e},Qi=qi(Nn({name:"ElIcon",inheritAttrs:!1,__name:"icon",props:Qo({size:{type:[Number,String]},color:{type:String}}),setup(e){const t=e,n=Ai("icon"),s=io((()=>{const{size:e,color:n}=t,s=mi(e);return s||n?{fontSize:s,"--color":n}:{}}));return(e,t)=>(Mr(),Pr("i",Gr({class:Mt(n).b(),style:s.value},e.$attrs),[vs(e.$slots,"default")],16))}})),Xi={tab:"Tab",enter:"Enter",space:"Space",left:"ArrowLeft",up:"ArrowUp",right:"ArrowRight",down:"ArrowDown",esc:"Escape",delete:"Delete",backspace:"Backspace",numpadEnter:"NumpadEnter",pageUp:"PageUp",pageDown:"PageDown",home:"Home",end:"End"},Ji=()=>uo&&/firefox/i.test(window.navigator.userAgent),Yi=e=>{if(e.code&&"Unidentified"!==e.code)return e.code;const t=Zi(e);return t?Object.values(Xi).includes(t)?t:" "===t?Xi.space:"":""},Zi=e=>{let t=e.key&&"Unidentified"!==e.key?e.key:"";if(!t&&"keyup"===e.type&&uo&&/android/i.test(window.navigator.userAgent)){const n=e.target;t=n.value.charAt(n.selectionStart-1)}return t};let ea=[];const ta=e=>{Yi(e)===Xi.esc&&ea.forEach((t=>t(e)))},na="focus-trap.focus-after-trapped",sa="focus-trap.focus-after-released",ra={cancelable:!0,bubbles:!1},oa={cancelable:!0,bubbles:!1},ia="focusAfterTrapped",aa="focusAfterReleased",la=Symbol("elFocusTrap"),ca=Ct(),da=Ct(0),ua=Ct(0);let ha=0;const ga=e=>{const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{const t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0||e===document.activeElement?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t},pa=(e,t)=>{for(const n of e)if(!ma(n,t))return n},ma=(e,t)=>{if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(t&&e===t)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1},fa=(e,t)=>{if(e){const n=document.activeElement;((e,t)=>{if(!e||!e.focus)return;let n=!1;!ui(e)||gi(e)||e.getAttribute("tabindex")||(e.setAttribute("tabindex","-1"),n=!0),e.focus(t),ui(e)&&n&&e.removeAttribute("tabindex")})(e,{preventScroll:!0}),ua.value=window.performance.now(),e!==n&&(e=>e instanceof HTMLInputElement&&"select"in e)(e)&&t&&e.select()}};function va(e,t){const n=[...e],s=e.indexOf(t);return-1!==s&&n.splice(s,1),n}const Sa=(()=>{let e=[];return{push:t=>{const n=e[0];n&&t!==n&&n.pause(),e=va(e,t),e.unshift(t)},remove:t=>{e=va(e,t),e[0]?.resume?.()}}})(),ya=()=>{ca.value="pointer",da.value=window.performance.now()},ba=()=>{ca.value="keyboard",da.value=window.performance.now()},Ca=()=>(ns((()=>{0===ha&&(document.addEventListener("mousedown",ya),document.addEventListener("touchstart",ya),document.addEventListener("keydown",ba)),ha++})),os((()=>{ha--,ha<=0&&(document.removeEventListener("mousedown",ya),document.removeEventListener("touchstart",ya),document.removeEventListener("keydown",ba))})),{focusReason:ca,lastUserFocusTimestamp:da,lastAutomatedFocusTimestamp:ua}),wa=e=>new CustomEvent("focus-trap.focusout-prevented",{...oa,detail:e}),Ea=function(e){return null==e};var Ta=Nn({name:"ElFocusTrap",inheritAttrs:!1,props:{loop:Boolean,trapped:Boolean,focusTrapEl:Object,focusStartEl:{type:[Object,String],default:"first"}},emits:[ia,aa,"focusin","focusout","focusout-prevented","release-requested"],setup(e,{emit:t}){const n=Ct();let s,r;const{focusReason:o}=Ca();var i;i=n=>{e.trapped&&!a.paused&&t("release-requested",n)},ns((()=>{0===ea.length&&document.addEventListener("keydown",ta),uo&&ea.push(i)})),os((()=>{ea=ea.filter((e=>e!==i)),0===ea.length&&uo&&document.removeEventListener("keydown",ta)}));const a={paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}},l=n=>{if(!e.loop&&!e.trapped)return;if(a.paused)return;const{altKey:s,ctrlKey:r,metaKey:i,currentTarget:l,shiftKey:c}=n,{loop:d}=e,u=Yi(n)===Xi.tab&&!s&&!r&&!i,h=document.activeElement;if(u&&h){const e=l,[s,r]=(e=>{const t=ga(e);return[pa(t,e),pa(t.reverse(),e)]})(e);if(s&&r)if(c||h!==r){if(c&&[s,e].includes(h)){const e=wa({focusReason:o.value});t("focusout-prevented",e),e.defaultPrevented||(n.preventDefault(),d&&fa(r,!0))}}else{const e=wa({focusReason:o.value});t("focusout-prevented",e),e.defaultPrevented||(n.preventDefault(),d&&fa(s,!0))}else if(h===e){const e=wa({focusReason:o.value});t("focusout-prevented",e),e.defaultPrevented||n.preventDefault()}}};Sn(la,{focusTrapRef:n,onKeydown:l}),wn((()=>e.focusTrapEl),(e=>{e&&(n.value=e)}),{immediate:!0}),wn([n],(([e],[t])=>{e&&(e.addEventListener("keydown",l),e.addEventListener("focusin",u),e.addEventListener("focusout",h)),t&&(t.removeEventListener("keydown",l),t.removeEventListener("focusin",u),t.removeEventListener("focusout",h))}));const c=e=>{t(ia,e)},d=e=>t(aa,e),u=o=>{const i=Mt(n);if(!i)return;const l=o.target,c=o.relatedTarget,d=l&&i.contains(l);e.trapped||c&&i.contains(c)||(s=c),d&&t("focusin",o),a.paused||e.trapped&&(d?r=l:fa(r,!0))},h=s=>{const i=Mt(n);if(!a.paused&&i)if(e.trapped){const n=s.relatedTarget;Ea(n)||i.contains(n)||setTimeout((()=>{if(!a.paused&&e.trapped){const e=wa({focusReason:o.value});t("focusout-prevented",e),e.defaultPrevented||fa(r,!0)}}),0)}else{const e=s.target;e&&i.contains(e)||t("focusout",s)}};async function g(){await Qt();const t=Mt(n);if(t){Sa.push(a);const n=t.contains(document.activeElement)?s:document.activeElement;if(s=n,!t.contains(n)){const s=new Event(na,ra);t.addEventListener(na,c),t.dispatchEvent(s),s.defaultPrevented||Qt((()=>{let s=e.focusStartEl;S(s)||(fa(s),document.activeElement!==s&&(s="first")),"first"===s&&((e,t=!1)=>{const n=document.activeElement;for(const s of e)if(fa(s,t),document.activeElement!==n)return})(ga(t),!0),document.activeElement!==n&&"container"!==s||fa(t)}))}}}function p(){const e=Mt(n);if(e){e.removeEventListener(na,c);const t=new CustomEvent(sa,{...ra,detail:{focusReason:o.value}});e.addEventListener(sa,d),e.dispatchEvent(t),t.defaultPrevented||"keyboard"!=o.value&&da.value>ua.value&&!e.contains(document.activeElement)||fa(s??document.body),e.removeEventListener(sa,d),Sa.remove(a),s=null,r=null}}return ns((()=>{e.trapped&&g(),wn((()=>e.trapped),(e=>{e?g():p()}))})),os((()=>{e.trapped&&p(),n.value&&(n.value.removeEventListener("keydown",l),n.value.removeEventListener("focusin",u),n.value.removeEventListener("focusout",h),n.value=void 0),s=null,r=null})),{onKeydown:l}}}),Ma=Co(Ta,[["render",function(e,t,n,s,r,o){return vs(e.$slots,"default",{handleKeydown:e.onKeydown})}]]);const _a="update:modelValue",ka="change",xa="input",Pa=e=>uo?window.cancelAnimationFrame(e):clearTimeout(e),Ra=["class","style"],La=/^on[A-Z]/,Aa=uo?window:void 0;function Oa(e){var t;const n=_t(e);return null!==(t=null==n?void 0:n.$el)&&void 0!==t?t:n}function Fa(...e){const t=io((()=>{const t=go(_t(e[0])).filter((e=>null!=e));return t.every((e=>"string"!=typeof e))?t:void 0}));return n=([e,t,n,s],r,o)=>{if(!(null==e?void 0:e.length)||!(null==t?void 0:t.length)||!(null==n?void 0:n.length))return;const i=(l=s,"[object Object]"===ho.call(l)?{...s}:s),a=e.flatMap((e=>t.flatMap((t=>n.map((n=>((e,t,n,s)=>(e.addEventListener(t,n,s),()=>e.removeEventListener(t,n,s)))(e,t,n,i)))))));var l;o((()=>{a.forEach((e=>e()))}))},s={flush:"post"},wn((()=>{var n,s;return[null!==(n=null===(s=t.value)||void 0===s?void 0:s.map((e=>Oa(e))))&&void 0!==n?n:[Aa].filter((e=>null!=e)),go(_t(t.value?e[1]:e[0])),go(Mt(t.value?e[2]:e[1])),_t(t.value?e[3]:e[2])]}),n,{...s,immediate:!0});var n,s}function Ia(e){const t=function(){const e=wt(!1),t=qr();return t&&ns((()=>{e.value=!0}),t),e}();return io((()=>(t.value,Boolean(e()))))}function Da(e,t,n={}){const{window:s=Aa,...r}=n;let o;const i=Ia((()=>s&&"ResizeObserver"in s)),a=()=>{o&&(o.disconnect(),o=void 0)},l=wn(io((()=>{const t=_t(e);return Array.isArray(t)?t.map((e=>Oa(e))):[Oa(t)]})),(e=>{if(a(),i.value&&s){o=new ResizeObserver(t);for(const t of e)t&&o.observe(t,r)}}),{immediate:!0,flush:"post"}),c=()=>{a(),l()};return d=c,!!ne()&&se(d,u),{isSupported:i,stop:c};var d,u}uo&&window.document,uo&&window.navigator,uo&&window.location,Symbol("vueuse-ssr-width"),"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self,Number.POSITIVE_INFINITY;const Ba=e=>{const t=qr();return io((()=>t?.proxy?.$props?.[e]))},za=qo({type:String,values:di,required:!1}),Ua=Symbol("size"),Va=Symbol("formContextKey"),Na=Symbol("formItemContextKey"),Ha=(e,t={})=>{const n=Ct(void 0),s=t.prop?n:Ba("size"),r=t.global?n:(()=>{const e=yn(Ua,{});return io((()=>Mt(e.size)||""))})(),o=t.form?{size:void 0}:yn(Va,void 0),i=t.formItem?{size:void 0}:yn(Na,void 0);return io((()=>s.value||Mt(e)||i?.size||o?.size||r.value||""))},Ga=e=>{const t=Ba("disabled"),n=yn(Va,void 0);return io((()=>t.value??Mt(e)??n?.disabled??!1))},$a=()=>({form:yn(Va,void 0),formItem:yn(Na,void 0)}),Wa=Array.isArray;var ja=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ka=/^\w*$/;const qa=$o(Object,"create");var Qa=Object.prototype.hasOwnProperty;var Xa=Object.prototype.hasOwnProperty;function Ja(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var s=e[t];this.set(s[0],s[1])}}Ja.prototype.clear=function(){this.__data__=qa?qa(null):{},this.size=0},Ja.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Ja.prototype.get=function(e){var t=this.__data__;if(qa){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return Qa.call(t,e)?t[e]:void 0},Ja.prototype.has=function(e){var t=this.__data__;return qa?void 0!==t[e]:Xa.call(t,e)},Ja.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=qa&&void 0===t?"__lodash_hash_undefined__":t,this};const Ya=Ja,Za=function(e,t){return e===t||e!=e&&t!=t},el=function(e,t){for(var n=e.length;n--;)if(Za(e[n][0],t))return n;return-1};var tl=Array.prototype.splice;function nl(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var s=e[t];this.set(s[0],s[1])}}nl.prototype.clear=function(){this.__data__=[],this.size=0},nl.prototype.delete=function(e){var t=this.__data__,n=el(t,e);return!(n<0||(n==t.length-1?t.pop():tl.call(t,n,1),--this.size,0))},nl.prototype.get=function(e){var t=this.__data__,n=el(t,e);return n<0?void 0:t[n][1]},nl.prototype.has=function(e){return el(this.__data__,e)>-1},nl.prototype.set=function(e,t){var n=this.__data__,s=el(n,e);return s<0?(++this.size,n.push([e,t])):n[s][1]=t,this};const sl=nl,rl=$o(To,"Map"),ol=function(e,t){var n,s,r=e.__data__;return("string"==(s=typeof(n=t))||"number"==s||"symbol"==s||"boolean"==s?"__proto__"!==n:null===n)?r["string"==typeof t?"string":"hash"]:r.map};function il(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var s=e[t];this.set(s[0],s[1])}}il.prototype.clear=function(){this.size=0,this.__data__={hash:new Ya,map:new(rl||sl),string:new Ya}},il.prototype.delete=function(e){var t=ol(this,e).delete(e);return this.size-=t?1:0,t},il.prototype.get=function(e){return ol(this,e).get(e)},il.prototype.has=function(e){return ol(this,e).has(e)},il.prototype.set=function(e,t){var n=ol(this,e),s=n.size;return n.set(e,t),this.size+=n.size==s?0:1,this};const al=il;function ll(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var s=arguments,r=t?t.apply(this,s):s[0],o=n.cache;if(o.has(r))return o.get(r);var i=e.apply(this,s);return n.cache=o.set(r,i)||o,i};return n.cache=new(ll.Cache||al),n}ll.Cache=al;var cl=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,dl=/\\(\\)?/g;const ul=(hl=ll((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(cl,(function(e,n,s,r){t.push(s?r.replace(dl,"$1"):n||e)})),t}),(function(e){return 500===gl.size&&gl.clear(),e})),gl=hl.cache,hl);var hl,gl;var pl=Mo?Mo.prototype:void 0,ml=pl?pl.toString:void 0;const fl=function e(t){if("string"==typeof t)return t;if(Wa(t))return function(e,t){for(var n=-1,s=null==e?0:e.length,r=Array(s);++n<s;)r[n]=t(e[n],n,e);return r}(t,e)+"";if(bi(t))return ml?ml.call(t):"";var n=t+"";return"0"==n&&1/t==-1/0?"-0":n},vl=function(e,t){return Wa(e)?e:function(e,t){if(Wa(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!bi(e))||Ka.test(e)||!ja.test(e)||null!=t&&e in Object(t)}(e,t)?[e]:ul(function(e){return null==e?"":fl(e)}(e))},Sl=function(e){if("string"==typeof e||bi(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t},yl=function(e,t){for(var n=0,s=(t=vl(t,e)).length;null!=e&&n<s;)e=e[Sl(t[n++])];return n&&n==s?e:void 0};var bl=Object.prototype.hasOwnProperty;const Cl=function(e,t,n){var s=e[t];bl.call(e,t)&&Za(s,n)&&(void 0!==n||t in e)||jo(e,t,n)};var wl=/^(?:0|[1-9]\d*)$/;const El=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&wl.test(e))&&e>-1&&e%1==0&&e<t},Tl=function(e,t,n,s){if(!Oo(e))return e;for(var r=-1,o=(t=vl(t,e)).length,i=o-1,a=e;null!=a&&++r<o;){var l=Sl(t[r]),c=n;if("__proto__"===l||"constructor"===l||"prototype"===l)return e;if(r!=i){var d=a[l];void 0===(c=s?s(d,l,a):void 0)&&(c=Oo(d)?d:El(t[r+1])?[]:{})}Cl(a,l,c),a=a[l]}return e},Ml=function(e,t){return null!=e&&t in Object(e)},_l=function(e){return yi(e)&&"[object Arguments]"==Ao(e)};var kl=Object.prototype,xl=kl.hasOwnProperty,Pl=kl.propertyIsEnumerable;const Rl=_l(function(){return arguments}())?_l:function(e){return yi(e)&&xl.call(e,"callee")&&!Pl.call(e,"callee")},Ll=function(e,t){return null!=e&&function(e,t,n){for(var s=-1,r=(t=vl(t,e)).length,o=!1;++s<r;){var i=Sl(t[s]);if(!(o=null!=e&&n(e,i)))break;e=e[i]}return o||++s!=r?o:!!(r=null==e?0:e.length)&&"number"==typeof(a=r)&&a>-1&&a%1==0&&a<=9007199254740991&&El(i,r)&&(Wa(e)||Rl(e));var a}(e,t,Ml)},Al=function(e,t){return function(e,t,n){for(var s=-1,r=t.length,o={};++s<r;){var i=t[s],a=yl(e,i);n(a,i)&&Tl(o,vl(i,e),a)}return o}(e,t,(function(t,n){return Ll(e,n)}))},Ol=function(e,t){for(var n=-1,s=t.length,r=e.length;++n<s;)e[r+n]=t[n];return e};var Fl=Mo?Mo.isConcatSpreadable:void 0;const Il=function(e){return Wa(e)||Rl(e)||!!(Fl&&e&&e[Fl])},Dl=function e(t,n,s,r,o){var i=-1,a=t.length;for(s||(s=Il),o||(o=[]);++i<a;){var l=t[i];n>0&&s(l)?n>1?e(l,n-1,s,r,o):Ol(o,l):r||(o[o.length]=l)}return o},Bl=function(e){return null!=e&&e.length?Dl(e,1):[]},zl=function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)};var Ul=Math.max;const Vl=Wo?function(e,t){return Wo(e,"toString",{configurable:!0,enumerable:!1,value:(n=t,function(){return n}),writable:!0});var n}:function(e){return e};var Nl=Date.now;const Hl=function(e){var t=0,n=0;return function(){var s=Nl(),r=16-(s-n);if(n=s,r>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(Vl),Gl=function(e){return Hl(function(e,t,n){return t=Ul(void 0===t?e.length-1:t,0),function(){for(var s=arguments,r=-1,o=Ul(s.length-t,0),i=Array(o);++r<o;)i[r]=s[t+r];r=-1;for(var a=Array(t+1);++r<t;)a[r]=s[r];return a[t]=n(i),zl(e,this,a)}}(e,void 0,Bl),e+"")}((function(e,t){return null==e?{}:Al(e,t)})),$l=Qo({ariaLabel:String,ariaOrientation:{type:String,values:["horizontal","vertical","undefined"]},ariaControls:String}),Wl=Qo({id:{type:String,default:void 0},size:za,disabled:{type:Boolean,default:void 0},modelValue:{type:[String,Number,Object],default:""},modelModifiers:{type:Object,default:()=>({})},maxlength:{type:[String,Number]},minlength:{type:[String,Number]},type:{type:String,default:"text"},resize:{type:String,values:["none","both","horizontal","vertical"]},autosize:{type:[Boolean,Object],default:!1},autocomplete:{type:String,default:"off"},formatter:{type:Function},parser:{type:Function},placeholder:{type:String},form:{type:String},readonly:Boolean,clearable:Boolean,clearIcon:{type:ii,default:Yo},showPassword:Boolean,showWordLimit:Boolean,wordLimitPosition:{type:String,values:["inside","outside"],default:"inside"},suffixIcon:{type:ii},prefixIcon:{type:ii},containerRole:{type:String,default:void 0},tabindex:{type:[String,Number],default:0},validateEvent:{type:Boolean,default:!0},inputStyle:{type:[Object,Array,String,Boolean],default:()=>({})},countGraphemes:{type:Function},autofocus:Boolean,rows:{type:Number,default:2},...(jl=["ariaLabel"],Gl($l,jl)),inputmode:{type:String,default:void 0},name:String});var jl;const Kl={[_a]:e=>S(e),input:e=>S(e),change:(e,t)=>S(e)&&(t instanceof Event||void 0===t),focus:e=>e instanceof FocusEvent,blur:e=>e instanceof FocusEvent,clear:e=>void 0===e||e instanceof MouseEvent,mouseleave:e=>e instanceof MouseEvent,mouseenter:e=>e instanceof MouseEvent,keydown:e=>e instanceof Event,compositionstart:e=>e instanceof CompositionEvent,compositionupdate:e=>e instanceof CompositionEvent,compositionend:e=>e instanceof CompositionEvent};let ql;vt(Yo);const Ql={height:"0",visibility:"hidden",overflow:Ji()?"":"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0"},Xl=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],Jl=e=>{const t=Number.parseFloat(e);return Number.isNaN(t)?e:t};function Yl(e,t=1,n){if(!ql){ql=document.createElement("textarea");let t=document.body;!Ji()&&e.parentNode&&(t=e.parentNode),t.appendChild(ql)}const{paddingSize:s,borderSize:r,boxSizing:o,contextStyle:i}=function(e){const t=window.getComputedStyle(e),n=t.getPropertyValue("box-sizing"),s=Number.parseFloat(t.getPropertyValue("padding-bottom"))+Number.parseFloat(t.getPropertyValue("padding-top")),r=Number.parseFloat(t.getPropertyValue("border-bottom-width"))+Number.parseFloat(t.getPropertyValue("border-top-width"));return{contextStyle:Xl.map((e=>[e,t.getPropertyValue(e)])),paddingSize:s,borderSize:r,boxSizing:n}}(e);i.forEach((([e,t])=>ql?.style.setProperty(e,t))),Object.entries(Ql).forEach((([e,t])=>ql?.style.setProperty(e,t,"important"))),ql.value=e.value||e.placeholder||"";let a=ql.scrollHeight;const l={};"border-box"===o?a+=r:"content-box"===o&&(a-=s),ql.value="";const c=ql.scrollHeight-s;if(vo(t)){let e=c*t;"border-box"===o&&(e=e+s+r),a=Math.max(e,a),l.minHeight=`${e}px`}if(vo(n)){let e=c*n;"border-box"===o&&(e=e+s+r),a=Math.min(e,a)}return l.height=`${a}px`,ql.parentNode?.removeChild(ql),ql=void 0,l}let Zl;const ec="undefined"!=typeof window&&window.trustedTypes;if(ec)try{Zl=ec.createPolicy("vue",{createHTML:e=>e})}catch(e){}const tc=Zl?e=>Zl.createHTML(e):e=>e,nc="undefined"!=typeof document?document:null,sc=nc&&nc.createElement("template"),rc={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,s)=>{const r="svg"===t?nc.createElementNS("http://www.w3.org/2000/svg",e):"mathml"===t?nc.createElementNS("http://www.w3.org/1998/Math/MathML",e):n?nc.createElement(e,{is:n}):nc.createElement(e);return"select"===e&&s&&null!=s.multiple&&r.setAttribute("multiple",s.multiple),r},createText:e=>nc.createTextNode(e),createComment:e=>nc.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>nc.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,s,r,o){const i=n?n.previousSibling:t.lastChild;if(r&&(r===o||r.nextSibling))for(;t.insertBefore(r.cloneNode(!0),n),r!==o&&(r=r.nextSibling););else{sc.innerHTML=tc("svg"===s?`<svg>${e}</svg>`:"mathml"===s?`<math>${e}</math>`:e);const r=sc.content;if("svg"===s||"mathml"===s){const e=r.firstChild;for(;e.firstChild;)r.appendChild(e.firstChild);r.removeChild(e)}t.insertBefore(r,n)}return[i?i.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},oc="transition",ic="animation",ac=Symbol("_vtc"),lc={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},cc=c({},Ln,lc),dc=(e=>(e.displayName="Transition",e.props=cc,e))(((e,{slots:t})=>ao(Fn,function(e){const t={};for(const n in e)n in lc||(t[n]=e[n]);if(!1===e.css)return t;const{name:n="v",type:s,duration:r,enterFromClass:o=`${n}-enter-from`,enterActiveClass:i=`${n}-enter-active`,enterToClass:a=`${n}-enter-to`,appearFromClass:l=o,appearActiveClass:d=i,appearToClass:u=a,leaveFromClass:h=`${n}-leave-from`,leaveActiveClass:g=`${n}-leave-active`,leaveToClass:p=`${n}-leave-to`}=e,m=function(e){if(null==e)return null;if(b(e))return[gc(e.enter),gc(e.leave)];{const t=gc(e);return[t,t]}}(r),f=m&&m[0],v=m&&m[1],{onBeforeEnter:S,onEnter:y,onEnterCancelled:C,onLeave:w,onLeaveCancelled:E,onBeforeAppear:T=S,onAppear:M=y,onAppearCancelled:_=C}=t,k=(e,t,n,s)=>{e._enterCancelled=s,mc(e,t?u:a),mc(e,t?d:i),n&&n()},x=(e,t)=>{e._isLeaving=!1,mc(e,h),mc(e,p),mc(e,g),t&&t()},P=e=>(t,n)=>{const r=e?M:y,i=()=>k(t,e,n);uc(r,[t,i]),fc((()=>{mc(t,e?l:o),pc(t,e?u:a),hc(r)||Sc(t,s,f,i)}))};return c(t,{onBeforeEnter(e){uc(S,[e]),pc(e,o),pc(e,i)},onBeforeAppear(e){uc(T,[e]),pc(e,l),pc(e,d)},onEnter:P(!1),onAppear:P(!0),onLeave(e,t){e._isLeaving=!0;const n=()=>x(e,t);pc(e,h),e._enterCancelled?(pc(e,g),Cc(e)):(Cc(e),pc(e,g)),fc((()=>{e._isLeaving&&(mc(e,h),pc(e,p),hc(w)||Sc(e,s,v,n))})),uc(w,[e,n])},onEnterCancelled(e){k(e,!1,void 0,!0),uc(C,[e])},onAppearCancelled(e){k(e,!0,void 0,!0),uc(_,[e])},onLeaveCancelled(e){x(e),uc(E,[e])}})}(e),t))),uc=(e,t=[])=>{g(e)?e.forEach((e=>e(...t))):e&&e(...t)},hc=e=>!!e&&(g(e)?e.some((e=>e.length>1)):e.length>1);function gc(e){return(e=>{const t=S(e)?Number(e):NaN;return isNaN(t)?e:t})(e)}function pc(e,t){t.split(/\s+/).forEach((t=>t&&e.classList.add(t))),(e[ac]||(e[ac]=new Set)).add(t)}function mc(e,t){t.split(/\s+/).forEach((t=>t&&e.classList.remove(t)));const n=e[ac];n&&(n.delete(t),n.size||(e[ac]=void 0))}function fc(e){requestAnimationFrame((()=>{requestAnimationFrame(e)}))}let vc=0;function Sc(e,t,n,s){const r=e._endId=++vc,o=()=>{r===e._endId&&s()};if(null!=n)return setTimeout(o,n);const{type:i,timeout:a,propCount:l}=function(e,t){const n=window.getComputedStyle(e),s=e=>(n[e]||"").split(", "),r=s(`${oc}Delay`),o=s(`${oc}Duration`),i=yc(r,o),a=s(`${ic}Delay`),l=s(`${ic}Duration`),c=yc(a,l);let d=null,u=0,h=0;return t===oc?i>0&&(d=oc,u=i,h=o.length):t===ic?c>0&&(d=ic,u=c,h=l.length):(u=Math.max(i,c),d=u>0?i>c?oc:ic:null,h=d?d===oc?o.length:l.length:0),{type:d,timeout:u,propCount:h,hasTransform:d===oc&&/\b(?:transform|all)(?:,|$)/.test(s(`${oc}Property`).toString())}}(e,t);if(!i)return s();const c=i+"end";let d=0;const u=()=>{e.removeEventListener(c,h),o()},h=t=>{t.target===e&&++d>=l&&u()};setTimeout((()=>{d<l&&u()}),a+1),e.addEventListener(c,h)}function yc(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map(((t,n)=>bc(t)+bc(e[n]))))}function bc(e){return"auto"===e?0:1e3*Number(e.slice(0,-1).replace(",","."))}function Cc(e){return(e?e.ownerDocument:document).body.offsetHeight}const wc=Symbol("_vod"),Ec=Symbol("_vsh"),Tc={name:"show",beforeMount(e,{value:t},{transition:n}){e[wc]="none"===e.style.display?"":e.style.display,n&&t?n.beforeEnter(e):Mc(e,t)},mounted(e,{value:t},{transition:n}){n&&t&&n.enter(e)},updated(e,{value:t,oldValue:n},{transition:s}){!t!=!n&&(s?t?(s.beforeEnter(e),Mc(e,!0),s.enter(e)):s.leave(e,(()=>{Mc(e,!1)})):Mc(e,t))},beforeUnmount(e,{value:t}){Mc(e,t)}};function Mc(e,t){e.style.display=t?e[wc]:"none",e[Ec]=!t}const _c=Symbol(""),kc=/(?:^|;)\s*display\s*:/,xc=/\s*!important$/;function Pc(e,t,n){if(g(n))n.forEach((n=>Pc(e,t,n)));else if(null==n&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const s=function(e,t){const n=Lc[t];if(n)return n;let s=P(t);if("filter"!==s&&s in e)return Lc[t]=s;s=A(s);for(let n=0;n<Rc.length;n++){const r=Rc[n]+s;if(r in e)return Lc[t]=r}return t}(e,t);xc.test(n)?e.setProperty(L(s),n.replace(xc,""),"important"):e[s]=n}}const Rc=["Webkit","Moz","ms"],Lc={};function Ac(e,t,n,s){return"TEXTAREA"===e.tagName&&("width"===t||"height"===t)&&S(s)&&n===s}const Oc="http://www.w3.org/1999/xlink";function Fc(e,t,n,s,r,o=j(t)){s&&t.startsWith("xlink:")?null==n?e.removeAttributeNS(Oc,t.slice(6,t.length)):e.setAttributeNS(Oc,t,n):null==n||o&&!K(n)?e.removeAttribute(t):e.setAttribute(t,o?"":y(n)?String(n):n)}function Ic(e,t,n,s,r){if("innerHTML"===t||"textContent"===t)return void(null!=n&&(e[t]="innerHTML"===t?tc(n):n));const o=e.tagName;if("value"===t&&"PROGRESS"!==o&&!o.includes("-")){const s="OPTION"===o?e.getAttribute("value")||"":e.value,r=null==n?"checkbox"===e.type?"on":"":String(n);return s===r&&"_value"in e||(e.value=r),null==n&&e.removeAttribute(t),void(e._value=n)}let i=!1;if(""===n||null==n){const s=typeof e[t];"boolean"===s?n=K(n):null==n&&"string"===s?(n="",i=!0):"number"===s&&(n=0,i=!0)}try{e[t]=n}catch(e){}i&&e.removeAttribute(r||t)}const Dc=Symbol("_vei");const Bc=/(?:Once|Passive|Capture)$/;let zc=0;const Uc=Promise.resolve(),Vc=e=>111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123;"undefined"!=typeof HTMLElement&&HTMLElement;const Nc=["ctrl","shift","alt","meta"],Hc={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&0!==e.button,middle:e=>"button"in e&&1!==e.button,right:e=>"button"in e&&2!==e.button,exact:(e,t)=>Nc.some((n=>e[`${n}Key`]&&!t.includes(n)))},Gc=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),s=t.join(".");return n[s]||(n[s]=(n,...s)=>{for(let e=0;e<t.length;e++){const s=Hc[t[e]];if(s&&s(n,t))return}return e(n,...s)})},$c={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},Wc=(e,t)=>{const n=e._withKeys||(e._withKeys={}),s=t.join(".");return n[s]||(n[s]=n=>{if(!("key"in n))return;const s=L(n.key);return t.some((e=>e===s||$c[e]===s))?e(n):void 0})},jc=c({patchProp:(e,t,n,s,r,o)=>{const i="svg"===r;"class"===t?function(e,t,n){const s=e[ac];s&&(t=(t?[t,...s]:[...s]).join(" ")),null==t?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}(e,s,i):"style"===t?function(e,t,n){const s=e.style,r=S(n);let o=!1;if(n&&!r){if(t)if(S(t))for(const e of t.split(";")){const t=e.slice(0,e.indexOf(":")).trim();null==n[t]&&Pc(s,t,"")}else for(const e in t)null==n[e]&&Pc(s,e,"");for(const r in n){"display"===r&&(o=!0);const i=n[r];null!=i?Ac(e,r,!S(t)&&t?t[r]:void 0,i)||Pc(s,r,i):Pc(s,r,"")}}else if(r){if(t!==n){const e=s[_c];e&&(n+=";"+e),s.cssText=n,o=kc.test(n)}}else t&&e.removeAttribute("style");wc in e&&(e[wc]=o?s.display:"",e[Ec]&&(s.display="none"))}(e,n,s):a(t)?l(t)||function(e,t,n,s,r=null){const o=e[Dc]||(e[Dc]={}),i=o[t];if(s&&i)i.value=s;else{const[n,a]=function(e){let t;if(Bc.test(e)){let n;for(t={};n=e.match(Bc);)e=e.slice(0,e.length-n[0].length),t[n[0].toLowerCase()]=!0}return[":"===e[2]?e.slice(3):L(e.slice(2)),t]}(t);if(s){const i=o[t]=function(e,t){const n=e=>{if(e._vts){if(e._vts<=n.attached)return}else e._vts=Date.now();const s=n.value;if(g(s)){const n=e.stopImmediatePropagation;e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0};const r=s.slice(),o=[e];for(let n=0;n<r.length&&!e._stopped;n++){const e=r[n];e&&Vt(e,t,5,o)}}else Vt(s,t,5,[e])};return n.value=e,n.attached=zc||(Uc.then((()=>zc=0)),zc=Date.now()),n}(s,r);!function(e,t,n,s){e.addEventListener(t,n,s)}(e,n,i,a)}else i&&(function(e,t,n,s){e.removeEventListener(t,n,s)}(e,n,i,a),o[t]=void 0)}}(e,t,0,s,o):("."===t[0]?(t=t.slice(1),1):"^"===t[0]?(t=t.slice(1),0):function(e,t,n,s){if(s)return"innerHTML"===t||"textContent"===t||!!(t in e&&Vc(t)&&v(n));if("spellcheck"===t||"draggable"===t||"translate"===t||"autocorrect"===t)return!1;if("sandbox"===t&&"IFRAME"===e.tagName)return!1;if("form"===t)return!1;if("list"===t&&"INPUT"===e.tagName)return!1;if("type"===t&&"TEXTAREA"===e.tagName)return!1;if("width"===t||"height"===t){const t=e.tagName;if("IMG"===t||"VIDEO"===t||"CANVAS"===t||"SOURCE"===t)return!1}return(!Vc(t)||!S(n))&&t in e}(e,t,s,i))?(Ic(e,t,s),e.tagName.includes("-")||"value"!==t&&"checked"!==t&&"selected"!==t||Fc(e,t,s,i,0,"value"!==t)):e._isVueCE&&(function(e,t){const n=e._def.props;if(!n)return!1;const s=P(t);return Array.isArray(n)?n.some((e=>P(e)===s)):Object.keys(n).some((e=>P(e)===s))}(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!S(s)))?Ic(e,P(t),s,0,t):("true-value"===t?e._trueValue=s:"false-value"===t&&(e._falseValue=s),Fc(e,t,s,i))}},rc);let Kc;const qc=(...e)=>{(Kc||(Kc=ur(jc))).render(...e)},Qc=["id","name","minlength","maxlength","type","disabled","readonly","autocomplete","tabindex","aria-label","placeholder","form","autofocus","role","inputmode"],Xc=["id","name","minlength","maxlength","tabindex","disabled","readonly","autocomplete","aria-label","placeholder","form","autofocus","rows","role","inputmode"],Jc="ElInput";var Yc=Nn({name:Jc,inheritAttrs:!1,__name:"input",props:Wl,emits:Kl,setup(e,{expose:t,emit:n}){const s=e,r=n,i=Ts().attrs,a=Es(),l=io((()=>["textarea"===s.type?y.b():S.b(),S.m(m.value),S.is("disabled",f.value),S.is("exceed",Q.value),{[S.b("group")]:a.prepend||a.append,[S.m("prefix")]:a.prefix||s.prefixIcon,[S.m("suffix")]:a.suffix||s.suffixIcon||s.clearable||s.showPassword,[S.bm("suffix","password-clear")]:$.value&&j.value,[S.b("hidden")]:"hidden"===s.type},i.class])),c=io((()=>[S.e("wrapper"),S.is("focus",A.value)])),d=((e={})=>{const{excludeListeners:t=!1,excludeKeys:n}=e,s=io((()=>(n?.value||[]).concat(Ra))),r=qr();return r?io((()=>Ko(Object.entries(r.proxy?.$attrs).filter((([e])=>!(s.value.includes(e)||t&&La.test(e))))))):(bo("use-attrs","getCurrentInstance() returned null. useAttrs() must be called at the top of a setup function"),io((()=>({}))))})(),u=io((()=>s.maxlength?.toString())),{form:h,formItem:g}=$a(),{inputId:p}=((e,{formItemContext:t,disableIdGeneration:n,disableIdManagement:s})=>{n||(n=Ct(!1)),s||(s=Ct(!1));const r=qr(),o=Ct();let i;const a=io((()=>!!(!e.label&&!e.ariaLabel&&t&&t.inputIds&&t.inputIds?.length<=1)));return ns((()=>{i=wn([At(e,"id"),n],(([e,n])=>{const i=e??(n?void 0:Bi().value);i!==o.value&&(t?.removeInputId&&!(()=>{let e=r?.parent;for(;e;){if("ElFormItem"===e.type.name)return!1;if("ElLabelWrap"===e.type.name)return!0;e=e.parent}return!1})()&&(o.value&&t.removeInputId(o.value),s?.value||n||!i||t.addInputId(i)),o.value=i)}),{immediate:!0})})),is((()=>{i&&i(),t?.removeInputId&&o.value&&t.removeInputId(o.value)})),{isLabeledByFormItem:a,inputId:o}})(s,{formItemContext:g}),m=Ha(),f=Ga(),S=Ai("input"),y=Ai("textarea"),C=wt(),w=wt(),E=Ct(!1),T=Ct(!1),M=Ct(),_=Ct(),k=wt(s.inputStyle),x=Ct(""),P=Ct(),R=io((()=>C.value||w.value)),{wrapperRef:L,isFocused:A,handleFocus:O,handleBlur:F}=function(e,{disabled:t,beforeFocus:n,afterFocus:s,beforeBlur:r,afterBlur:o}={}){const{emit:i}=qr(),a=wt(),l=Ct(!1),c=e=>{const r=!!v(n)&&n(e);Mt(t)||l.value||r||(l.value=!0,i("focus",e),s?.())},d=e=>{const n=!!v(r)&&r(e);Mt(t)||e.relatedTarget&&a.value?.contains(e.relatedTarget)||n||(l.value=!1,i("blur",e),o?.())};return wn([a,()=>Mt(t)],(([e,t])=>{e&&(t?e.removeAttribute("tabindex"):e.setAttribute("tabindex","-1"))})),Fa(a,"focus",c,!0),Fa(a,"blur",d,!0),Fa(a,"click",(n=>{Mt(t)||gi(n.target)||a.value?.contains(document.activeElement)&&a.value!==document.activeElement||e.value?.focus()}),!0),{isFocused:l,wrapperRef:a,handleFocus:c,handleBlur:d}}(R,{disabled:f,afterBlur(){s.validateEvent&&g?.validate?.("blur").catch(o)}}),I=io((()=>h?.statusIcon??!1)),D=io((()=>g?.validateState||"")),B=io((()=>D.value&&ci[D.value])),z=io((()=>T.value?ri:ei)),U=io((()=>[i.style])),N=io((()=>[s.inputStyle,k.value,{resize:s.resize},P.value?{height:P.value}:void 0])),H=io((()=>Ea(s.modelValue)?"":String(s.modelValue))),G=io((()=>s.clearable&&!f.value&&!s.readonly)),$=io((()=>G.value&&!!H.value&&(A.value||E.value))),j=io((()=>s.showPassword&&!f.value&&!!H.value)),K=io((()=>s.showWordLimit&&!!u.value&&("text"===s.type||"textarea"===s.type)&&!f.value&&!s.readonly&&!s.showPassword)),q=io((()=>s.countGraphemes&&s.showWordLimit?s.countGraphemes(H.value):H.value.length)),Q=io((()=>!!K.value&&q.value>Number(u.value))),J=io((()=>!!a.suffix||!!s.suffixIcon||s.clearable||s.showPassword||K.value||!!D.value&&I.value)),Y=io((()=>!!Object.keys(s.modelModifiers).length)),[Z,ee]=function(e){let t;return[function(){if(null==e.value)return;const{selectionStart:n,selectionEnd:s,value:r}=e.value;null!=n&&null!=s&&(t={selectionStart:n,selectionEnd:s,value:r,beforeTxt:r.slice(0,Math.max(0,n)),afterTxt:r.slice(Math.max(0,s))})},function(){if(null==e.value||null==t)return;const{value:n}=e.value,{beforeTxt:s,afterTxt:r,selectionStart:o}=t;if(null==s||null==r||null==o)return;let i=n.length;if(n.endsWith(r))i=n.length-r.length;else if(n.startsWith(s))i=s.length;else{const e=s[o-1],t=n.indexOf(e,o-1);-1!==t&&(i=t+1)}e.value.setSelectionRange(i,i)}]}(C);let te;Da(w,(e=>{if(se(),!K.value&&!G.value||"both"!==s.resize&&"horizontal"!==s.resize)return;const{width:t}=e[0].target.getBoundingClientRect();var n;te&&Pa(te),n=()=>{te=void 0,M.value={right:`calc(100% - ${t-10}px)`},_.value={right:`calc(100% - ${t-11}px)`}},te=uo?window.requestAnimationFrame(n):setTimeout(n,16)}));const ne=()=>{const{type:e,autosize:t}=s;if(uo&&"textarea"===e&&w.value)if(t){const e=b(t)?t.minRows:void 0,n=b(t)?t.maxRows:void 0,s=Yl(w.value,e,n);k.value={overflowY:"hidden",...s},Qt((()=>{w.value.offsetHeight,k.value=s}))}else k.value={minHeight:Yl(w.value).minHeight}},se=(e=>{let t=!1;return()=>{!t&&s.autosize?null!==w.value?.offsetParent&&(setTimeout(e),t=!0):"none"!==s.resize&&setTimeout((()=>{P.value=w.value?.style.height}))}})(ne),re=()=>{const e=R.value,t=s.formatter?s.formatter(H.value):H.value;e&&e.value!==t&&"file"!==s.type&&(e.value=t)},oe=e=>{const{trim:t,number:n}=s.modelModifiers;return t&&(e=e.trim()),n&&(e=`${Jl(e)}`),s.formatter&&s.parser&&(e=s.parser(e)),e},ie=async e=>{if(le.value)return;const{lazy:t}=s.modelModifiers;let{value:n}=e.target,o=!1;if(t)r(xa,n);else{if(n=oe(n),s.countGraphemes&&null!=u.value){const e=Number(u.value),t=s.countGraphemes(n),r=s.countGraphemes(x.value);if(t>e&&t>r)if(r>e)n=x.value,o=!0;else{const t=x.value,i=n;let a=0;for(;a<t.length&&a<i.length&&t[a]===i[a];)a++;let l=t.length,c=i.length;for(;l>a&&c>a&&t[l-1]===i[c-1];)l--,c--;const d=i.slice(0,a),u=t.slice(a,l),h=i.slice(a,c),g=i.slice(c),p=r-s.countGraphemes(u),m=Math.max(0,e-p);let f="";if(m>0)if("undefined"!=typeof Intl&&"Segmenter"in Intl){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"});for(const{segment:t}of e.segment(h)){const e=f+t;if(s.countGraphemes(e)>m)break;f=e}}else for(const e of Array.from(h)){const t=f+e;if(s.countGraphemes(t)>m)break;f=t}n=d+f+g,o=!0}}if(String(n)!==H.value)x.value=n,Z(),r(_a,n),r(xa,n),await Qt(),(s.formatter&&s.parser||!Y.value)&&re(),ee();else if(s.formatter||o){const t=e.target,n=t.value,s=t.selectionStart,r=t.selectionEnd;if(re(),o&&R.value&&null!=s&&null!=r){const e=R.value.value,t=n.slice(Math.max(0,r));let o=Math.min(s,e.length);t&&e.endsWith(t)&&(o=e.length-t.length),R.value.setSelectionRange(o,o)}}}},ae=async e=>{let{value:t}=e.target;t=oe(t),s.modelModifiers.lazy&&r(_a,t),r(ka,t,e),await Qt(),re()},{isComposing:le,handleCompositionStart:ce,handleCompositionUpdate:de,handleCompositionEnd:ue}=function({afterComposition:e,emit:t}){const n=Ct(!1),s=e=>{t?.("compositionupdate",e),n.value=!0},r=s=>{t?.("compositionend",s),n.value&&(n.value=!1,Qt((()=>e(s))))};return{isComposing:n,handleComposition:e=>{"compositionend"===e.type?r(e):s(e)},handleCompositionStart:e=>{t?.("compositionstart",e),n.value=!0},handleCompositionUpdate:s,handleCompositionEnd:r}}({emit:r,afterComposition:ie}),he=()=>{T.value=!T.value},ge=e=>{E.value=!1,r("mouseleave",e)},pe=e=>{E.value=!0,r("mouseenter",e)},me=e=>{r("keydown",e)},fe=e=>{r(_a,""),r(ka,""),r("clear",e),r(xa,"")};return wn((()=>s.modelValue),(()=>{Qt((()=>{ne(),s.autosize&&(P.value=void 0)})),s.validateEvent&&g?.validate?.("change").catch(o)})),wn((()=>H.value),(e=>{x.value=e}),{immediate:!0}),wn(H,(e=>{if(!R.value)return;const{trim:t,number:n}=s.modelModifiers,r=R.value.value,o=!n&&"number"!==s.type||/^0\d/.test(r)?r:`${Jl(r)}`;o!==e&&(document.activeElement===R.value&&"range"!==R.value.type&&t&&o.trim()===e||re())})),wn((()=>s.type),(async()=>{await Qt(),re(),ne()})),ns((()=>{!s.formatter&&s.parser&&bo(Jc,"If you set the parser, you also need to set the formatter."),re(),Qt(ne)})),os((()=>{te&&Pa(te)})),t({input:C,textarea:w,ref:R,textareaStyle:N,autosize:At(s,"autosize"),isComposing:le,passwordVisible:T,focus:()=>R.value?.focus(),blur:()=>R.value?.blur(),select:()=>{R.value?.select()},clear:fe,resizeTextarea:ne}),(t,n)=>(Mr(),Pr("div",{class:W([l.value,{[Mt(S).bm("group","append")]:t.$slots.append,[Mt(S).bm("group","prepend")]:t.$slots.prepend}]),style:V(U.value),onMouseenter:pe,onMouseleave:ge},[Ur(" input "),"textarea"!==e.type?(Mr(),Pr(yr,{key:0},[Ur(" prepend slot "),t.$slots.prepend?(Mr(),Pr("div",{key:0,class:W(Mt(S).be("group","prepend"))},[vs(t.$slots,"prepend")],2)):Ur("v-if",!0),Ir("div",{ref_key:"wrapperRef",ref:L,class:W(c.value)},[Ur(" prefix slot "),t.$slots.prefix||e.prefixIcon?(Mr(),Pr("span",{key:0,class:W(Mt(S).e("prefix"))},[Ir("span",{class:W(Mt(S).e("prefix-inner"))},[vs(t.$slots,"prefix"),e.prefixIcon?(Mr(),Rr(Mt(Qi),{key:0,class:W(Mt(S).e("icon"))},{default:mn((()=>[(Mr(),Rr(ps(e.prefixIcon)))])),_:1},8,["class"])):Ur("v-if",!0)],2)],2)):Ur("v-if",!0),Ir("input",Gr({id:Mt(p),ref_key:"input",ref:C,class:Mt(S).e("inner")},Mt(d),{name:e.name,minlength:e.countGraphemes?void 0:e.minlength,maxlength:e.countGraphemes?void 0:u.value,type:e.showPassword?T.value?"text":"password":e.type,disabled:Mt(f),readonly:e.readonly,autocomplete:e.autocomplete,tabindex:e.tabindex,"aria-label":e.ariaLabel,placeholder:e.placeholder,style:e.inputStyle,form:e.form,autofocus:e.autofocus,role:e.containerRole,inputmode:e.inputmode,onCompositionstart:n[0]||(n[0]=(...e)=>Mt(ce)&&Mt(ce)(...e)),onCompositionupdate:n[1]||(n[1]=(...e)=>Mt(de)&&Mt(de)(...e)),onCompositionend:n[2]||(n[2]=(...e)=>Mt(ue)&&Mt(ue)(...e)),onInput:ie,onChange:ae,onKeydown:me}),null,16,Qc),Ur(" suffix slot "),J.value?(Mr(),Pr("span",{key:1,class:W(Mt(S).e("suffix"))},[Ir("span",{class:W(Mt(S).e("suffix-inner"))},[G.value?(Mr(),Rr(Mt(Qi),{key:0,class:W([Mt(S).e("icon"),Mt(S).e("clear")]),style:V({visibility:$.value?"visible":"hidden"}),onMousedown:Gc(Mt(o),["prevent"]),onClick:fe},{default:mn((()=>[(Mr(),Rr(ps(e.clearIcon)))])),_:1},8,["class","style","onMousedown"])):Ur("v-if",!0),$.value&&j.value&&K.value?Ur("v-if",!0):(Mr(),Pr(yr,{key:1},[vs(t.$slots,"suffix"),e.suffixIcon?(Mr(),Rr(Mt(Qi),{key:0,class:W(Mt(S).e("icon"))},{default:mn((()=>[(Mr(),Rr(ps(e.suffixIcon)))])),_:1},8,["class"])):Ur("v-if",!0)],64)),j.value?(Mr(),Rr(Mt(Qi),{key:2,class:W([Mt(S).e("icon"),Mt(S).e("password")]),onClick:he,onMousedown:Gc(Mt(o),["prevent"]),onMouseup:Gc(Mt(o),["prevent"])},{default:mn((()=>[vs(t.$slots,"password-icon",{visible:T.value},(()=>[(Mr(),Rr(ps(z.value)))]))])),_:3},8,["class","onMousedown","onMouseup"])):Ur("v-if",!0),K.value?(Mr(),Pr("span",{key:3,class:W([Mt(S).e("count"),Mt(S).is("outside","outside"===e.wordLimitPosition)])},[Ir("span",{class:W(Mt(S).e("count-inner"))},X(q.value)+" / "+X(u.value),3)],2)):Ur("v-if",!0),D.value&&B.value&&I.value?(Mr(),Rr(Mt(Qi),{key:4,class:W([Mt(S).e("icon"),Mt(S).e("validateIcon"),Mt(S).is("loading","validating"===D.value)])},{default:mn((()=>[(Mr(),Rr(ps(B.value)))])),_:1},8,["class"])):Ur("v-if",!0)],2)],2)):Ur("v-if",!0)],2),Ur(" append slot "),t.$slots.append?(Mr(),Pr("div",{key:1,class:W(Mt(S).be("group","append"))},[vs(t.$slots,"append")],2)):Ur("v-if",!0)],64)):(Mr(),Pr(yr,{key:1},[Ur(" textarea "),Ir("textarea",Gr({id:Mt(p),ref_key:"textarea",ref:w,class:[Mt(y).e("inner"),Mt(S).is("focus",Mt(A)),Mt(y).is("clearable",e.clearable)]},Mt(d),{name:e.name,minlength:e.countGraphemes?void 0:e.minlength,maxlength:e.countGraphemes?void 0:u.value,tabindex:e.tabindex,disabled:Mt(f),readonly:e.readonly,autocomplete:e.autocomplete,style:N.value,"aria-label":e.ariaLabel,placeholder:e.placeholder,form:e.form,autofocus:e.autofocus,rows:e.rows,role:e.containerRole,inputmode:e.inputmode,onCompositionstart:n[3]||(n[3]=(...e)=>Mt(ce)&&Mt(ce)(...e)),onCompositionupdate:n[4]||(n[4]=(...e)=>Mt(de)&&Mt(de)(...e)),onCompositionend:n[5]||(n[5]=(...e)=>Mt(ue)&&Mt(ue)(...e)),onInput:ie,onFocus:n[6]||(n[6]=(...e)=>Mt(O)&&Mt(O)(...e)),onBlur:n[7]||(n[7]=(...e)=>Mt(F)&&Mt(F)(...e)),onChange:ae,onKeydown:me}),null,16,Xc),$.value?(Mr(),Rr(Mt(Qi),{key:0,class:W([Mt(y).e("icon"),Mt(y).e("clear")]),style:V(_.value),onMousedown:Gc(Mt(o),["prevent"]),onClick:fe},{default:mn((()=>[(Mr(),Rr(ps(e.clearIcon)))])),_:1},8,["class","style","onMousedown"])):Ur("v-if",!0),K.value?(Mr(),Pr("span",{key:1,style:V(M.value),class:W([Mt(S).e("count"),Mt(S).is("outside","outside"===e.wordLimitPosition)])},X(q.value)+" / "+X(u.value),7)):Ur("v-if",!0)],64))],38))}});const Zc=qi(Yc),ed=e=>Object.keys(e);var td={name:"en",el:{breadcrumb:{label:"Breadcrumb"},colorpicker:{confirm:"OK",clear:"Clear",defaultLabel:"color picker",description:"current color is {color}. press enter to select a new color.",alphaLabel:"pick alpha value",alphaDescription:"alpha {alpha}, current color is {color}",hueLabel:"pick hue value",hueDescription:"hue {hue}, current color is {color}",svLabel:"pick saturation and brightness value",svDescription:"saturation {saturation}, brightness {brightness}, current color is {color}",predefineDescription:"select {value} as the color"},datepicker:{now:"Now",today:"Today",cancel:"Cancel",clear:"Clear",confirm:"OK",dateTablePrompt:"Use the arrow keys and enter to select the day of the month",monthTablePrompt:"Use the arrow keys and enter to select the month",yearTablePrompt:"Use the arrow keys and enter to select the year",selectedDate:"Selected date",selectDate:"Select date",selectTime:"Select time",startDate:"Start Date",startTime:"Start Time",endDate:"End Date",endTime:"End Time",prevYear:"Previous Year",nextYear:"Next Year",prevMonth:"Previous Month",nextMonth:"Next Month",year:"",month1:"January",month2:"February",month3:"March",month4:"April",month5:"May",month6:"June",month7:"July",month8:"August",month9:"September",month10:"October",month11:"November",month12:"December",weeks:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weeksFull:{sun:"Sunday",mon:"Monday",tue:"Tuesday",wed:"Wednesday",thu:"Thursday",fri:"Friday",sat:"Saturday"},months:{jan:"Jan",feb:"Feb",mar:"Mar",apr:"Apr",may:"May",jun:"Jun",jul:"Jul",aug:"Aug",sep:"Sep",oct:"Oct",nov:"Nov",dec:"Dec"}},inputNumber:{decrease:"decrease number",increase:"increase number"},select:{loading:"Loading",noMatch:"No matching data",noData:"No data",placeholder:"Select"},mention:{loading:"Loading"},dropdown:{toggleDropdown:"Toggle Dropdown"},cascader:{noMatch:"No matching data",loading:"Loading",placeholder:"Select",noData:"No data"},pagination:{goto:"Go to",pagesize:"/page",total:"Total {total}",pageClassifier:"",page:"Page",prev:"Go to previous page",next:"Go to next page",currentPage:"page {pager}",prevPages:"Previous {pager} pages",nextPages:"Next {pager} pages",deprecationWarning:"Deprecated usages detected, please refer to the el-pagination documentation for more details"},dialog:{close:"Close this dialog"},drawer:{close:"Close this dialog"},messagebox:{title:"Message",confirm:"OK",cancel:"Cancel",error:"Illegal input",close:"Close this dialog"},upload:{deleteTip:"press delete to remove",delete:"Delete",preview:"Preview",continue:"Continue"},slider:{defaultLabel:"slider between {min} and {max}",defaultRangeStartLabel:"pick start value",defaultRangeEndLabel:"pick end value"},table:{emptyText:"No Data",confirmFilter:"Confirm",resetFilter:"Reset",clearFilter:"All",sumText:"Sum",selectAllLabel:"Select all rows",selectRowLabel:"Select this row",expandRowLabel:"Expand this row",collapseRowLabel:"Collapse this row",sortLabel:"Sort by {column}",filterLabel:"Filter by {column}"},tag:{close:"Close this tag"},tour:{next:"Next",previous:"Previous",finish:"Finish",close:"Close this dialog"},tree:{emptyText:"No Data"},transfer:{noMatch:"No matching data",noData:"No data",titles:["List 1","List 2"],filterPlaceholder:"Enter keyword",noCheckedFormat:"{total} items",hasCheckedFormat:"{checked}/{total} checked"},image:{error:"FAILED"},pageHeader:{title:"Back"},popconfirm:{confirmButtonText:"Yes",cancelButtonText:"No"},carousel:{leftArrow:"Carousel arrow left",rightArrow:"Carousel arrow right",indicator:"Carousel switch to index {index}"},inputOTP:{groupLabel:"OTP Input",defaultLabel:"Please enter OTP character {index}"}}};const nd=e=>(t,n)=>sd(t,n,Mt(e)),sd=(e,t,n)=>function(e,t,n){var s=null==e?void 0:yl(e,t);return void 0===s?n:s}(n,e,e).replace(/\{(\w+)\}/g,((e,n)=>`${t?.[n]??`{${n}}`}`)),rd=Symbol("localeContextKey"),od={current:0},id=Ct(0),ad=Symbol("elZIndexContextKey"),ld=Symbol("zIndexContextKey"),cd=e=>{const t=qr()?yn(ad,od):od,n=e||(qr()?yn(ld,void 0):void 0),s=io((()=>{const e=Mt(n);return vo(e)?e:2e3})),r=io((()=>s.value+id.value));return uo||yn(ad)||bo("ZIndexInjection","Looks like you are using server rendering, you must provide a z-index provider to ensure the hydration process to be succeed\nusage: app.provide(ZINDEX_INJECTION_KEY, { current: 0 })"),{initialZIndex:s,currentZIndex:r,nextZIndex:()=>(t.current++,id.value=t.current,r.value)}},dd=Symbol("emptyValuesContextKey"),ud=(Qo({emptyValues:Array,valueOnClear:{type:[String,Number,Boolean,Function],default:void 0,validator:e=>(e=v(e)?e():e,g(e)?e.every((e=>!e)):!e)}}),Symbol()),hd=Ct();function gd(e,t){const n=qr()?yn(ud,hd):hd;return e?io((()=>n.value?.[e]??t)):n}const pd=(e,t)=>{const n=[...new Set([...ed(e),...ed(t)])],s={};for(const r of n)s[r]=void 0!==t[r]?t[r]:e[r];return s},md=Qo({size:za,disabled:{type:Boolean,default:void 0},type:{type:String,values:["default","primary","success","warning","info","danger","text",""],default:""},icon:{type:ii},nativeType:{type:String,values:["button","submit","reset"],default:"button"},loading:Boolean,loadingIcon:{type:ii,default:()=>ni},plain:{type:Boolean,default:void 0},text:{type:Boolean,default:void 0},link:Boolean,bg:Boolean,autofocus:Boolean,round:{type:Boolean,default:void 0},circle:Boolean,dashed:{type:Boolean,default:void 0},color:String,dark:Boolean,autoInsertSpace:{type:Boolean,default:void 0},tag:{type:[String,Object],default:"button"}}),fd={click:e=>e instanceof MouseEvent},vd=Symbol("buttonGroupContextKey");function Sd(e,t){(function(e){return"string"==typeof e&&-1!==e.indexOf(".")&&1===parseFloat(e)})(e)&&(e="100%");const n=function(e){return"string"==typeof e&&-1!==e.indexOf("%")}(e);return e=360===t?e:Math.min(t,Math.max(0,parseFloat(e))),n&&(e=parseInt(String(e*t),10)/100),Math.abs(e-t)<1e-6?1:e=360===t?(e<0?e%t+t:e%t)/parseFloat(String(t)):e%t/parseFloat(String(t))}function yd(e){return Math.min(1,Math.max(0,e))}function bd(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function Cd(e){return Number(e)<=1?100*Number(e)+"%":e}function wd(e){return 1===e.length?"0"+e:String(e)}function Ed(e,t,n){e=Sd(e,255),t=Sd(t,255),n=Sd(n,255);const s=Math.max(e,t,n),r=Math.min(e,t,n);let o=0,i=0;const a=(s+r)/2;if(s===r)i=0,o=0;else{const l=s-r;switch(i=a>.5?l/(2-s-r):l/(s+r),s){case e:o=(t-n)/l+(t<n?6:0);break;case t:o=(n-e)/l+2;break;case n:o=(e-t)/l+4}o/=6}return{h:o,s:i,l:a}}function Td(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*n*(t-e):n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function Md(e,t,n){e=Sd(e,255),t=Sd(t,255),n=Sd(n,255);const s=Math.max(e,t,n),r=Math.min(e,t,n);let o=0;const i=s,a=s-r,l=0===s?0:a/s;if(s===r)o=0;else{switch(s){case e:o=(t-n)/a+(t<n?6:0);break;case t:o=(n-e)/a+2;break;case n:o=(e-t)/a+4}o/=6}return{h:o,s:l,v:i}}function _d(e,t,n,s){const r=[wd(Math.round(e).toString(16)),wd(Math.round(t).toString(16)),wd(Math.round(n).toString(16))];return s&&r[0].startsWith(r[0].charAt(1))&&r[1].startsWith(r[1].charAt(1))&&r[2].startsWith(r[2].charAt(1))?r[0].charAt(0)+r[1].charAt(0)+r[2].charAt(0):r.join("")}function kd(e,t,n){let s=1-e/255,r=1-t/255,o=1-n/255,i=Math.min(s,r,o);return 1===i?(s=0,r=0,o=0):(s=(s-i)/(1-i)*100,r=(r-i)/(1-i)*100,o=(o-i)/(1-i)*100),i*=100,{c:Math.round(s),m:Math.round(r),y:Math.round(o),k:Math.round(i)}}function xd(e){return Pd(e)/255}function Pd(e){return parseInt(e,16)}const Rd={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",goldenrod:"#daa520",gold:"#ffd700",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavenderblush:"#fff0f5",lavender:"#e6e6fa",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};const Ld="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)",Ad="[\\s|\\(]+("+Ld+")[,|\\s]+("+Ld+")[,|\\s]+("+Ld+")\\s*\\)?",Od="[\\s|\\(]+("+Ld+")[,|\\s]+("+Ld+")[,|\\s]+("+Ld+")[,|\\s]+("+Ld+")\\s*\\)?",Fd={CSS_UNIT:new RegExp(Ld),rgb:new RegExp("rgb"+Ad),rgba:new RegExp("rgba"+Od),hsl:new RegExp("hsl"+Ad),hsla:new RegExp("hsla"+Od),hsv:new RegExp("hsv"+Ad),hsva:new RegExp("hsva"+Od),cmyk:new RegExp("cmyk"+Od),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/};function Id(e){return"number"==typeof e?!Number.isNaN(e):Fd.CSS_UNIT.test(e)}class Dd{constructor(e="",t={}){if(e instanceof Dd)return e;"number"==typeof e&&(e=function(e){return{r:e>>16,g:(65280&e)>>8,b:255&e}}(e)),this.originalInput=e;const n=function(e){let t={r:0,g:0,b:0},n=1,s=null,r=null,o=null,i=!1,a=!1;var l,c,d;return"string"==typeof e&&(e=function(e){if(0===(e=e.trim().toLowerCase()).length)return!1;let t=!1;if(Rd[e])e=Rd[e],t=!0;else if("transparent"===e)return{r:0,g:0,b:0,a:0,format:"name"};let n=Fd.rgb.exec(e);return n?{r:n[1],g:n[2],b:n[3]}:(n=Fd.rgba.exec(e),n?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=Fd.hsl.exec(e),n?{h:n[1],s:n[2],l:n[3]}:(n=Fd.hsla.exec(e),n?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=Fd.hsv.exec(e),n?{h:n[1],s:n[2],v:n[3]}:(n=Fd.hsva.exec(e),n?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=Fd.cmyk.exec(e),n?{c:n[1],m:n[2],y:n[3],k:n[4]}:(n=Fd.hex8.exec(e),n?{r:Pd(n[1]),g:Pd(n[2]),b:Pd(n[3]),a:xd(n[4]),format:t?"name":"hex8"}:(n=Fd.hex6.exec(e),n?{r:Pd(n[1]),g:Pd(n[2]),b:Pd(n[3]),format:t?"name":"hex"}:(n=Fd.hex4.exec(e),n?{r:Pd(n[1]+n[1]),g:Pd(n[2]+n[2]),b:Pd(n[3]+n[3]),a:xd(n[4]+n[4]),format:t?"name":"hex8"}:(n=Fd.hex3.exec(e),!!n&&{r:Pd(n[1]+n[1]),g:Pd(n[2]+n[2]),b:Pd(n[3]+n[3]),format:t?"name":"hex"}))))))))))}(e)),"object"==typeof e&&(Id(e.r)&&Id(e.g)&&Id(e.b)?(l=e.r,c=e.g,d=e.b,t={r:255*Sd(l,255),g:255*Sd(c,255),b:255*Sd(d,255)},i=!0,a="%"===String(e.r).substr(-1)?"prgb":"rgb"):Id(e.h)&&Id(e.s)&&Id(e.v)?(s=Cd(e.s),r=Cd(e.v),t=function(e,t,n){e=6*Sd(e,360),t=Sd(t,100),n=Sd(n,100);const s=Math.floor(e),r=e-s,o=n*(1-t),i=n*(1-r*t),a=n*(1-(1-r)*t),l=s%6;return{r:255*[n,i,o,o,a,n][l],g:255*[a,n,n,i,o,o][l],b:255*[o,o,a,n,n,i][l]}}(e.h,s,r),i=!0,a="hsv"):Id(e.h)&&Id(e.s)&&Id(e.l)?(s=Cd(e.s),o=Cd(e.l),t=function(e,t,n){let s,r,o;if(e=Sd(e,360),t=Sd(t,100),n=Sd(n,100),0===t)r=n,o=n,s=n;else{const i=n<.5?n*(1+t):n+t-n*t,a=2*n-i;s=Td(a,i,e+1/3),r=Td(a,i,e),o=Td(a,i,e-1/3)}return{r:255*s,g:255*r,b:255*o}}(e.h,s,o),i=!0,a="hsl"):Id(e.c)&&Id(e.m)&&Id(e.y)&&Id(e.k)&&(t=function(e,t,n,s){const r=s/100;return{r:255*(1-e/100)*(1-r),g:255*(1-t/100)*(1-r),b:255*(1-n/100)*(1-r)}}(e.c,e.m,e.y,e.k),i=!0,a="cmyk"),Object.prototype.hasOwnProperty.call(e,"a")&&(n=e.a)),n=bd(n),{ok:i,format:e.format||a,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:n}}(e);this.originalInput=e,this.r=n.r,this.g=n.g,this.b=n.b,this.a=n.a,this.roundA=Math.round(100*this.a)/100,this.format=t.format??n.format,this.gradientType=t.gradientType,this.r<1&&(this.r=Math.round(this.r)),this.g<1&&(this.g=Math.round(this.g)),this.b<1&&(this.b=Math.round(this.b)),this.isValid=n.ok}isDark(){return this.getBrightness()<128}isLight(){return!this.isDark()}getBrightness(){const e=this.toRgb();return(299*e.r+587*e.g+114*e.b)/1e3}getLuminance(){const e=this.toRgb();let t,n,s;const r=e.r/255,o=e.g/255,i=e.b/255;return t=r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4),n=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),s=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*t+.7152*n+.0722*s}getAlpha(){return this.a}setAlpha(e){return this.a=bd(e),this.roundA=Math.round(100*this.a)/100,this}isMonochrome(){const{s:e}=this.toHsl();return 0===e}toHsv(){const e=Md(this.r,this.g,this.b);return{h:360*e.h,s:e.s,v:e.v,a:this.a}}toHsvString(){const e=Md(this.r,this.g,this.b),t=Math.round(360*e.h),n=Math.round(100*e.s),s=Math.round(100*e.v);return 1===this.a?`hsv(${t}, ${n}%, ${s}%)`:`hsva(${t}, ${n}%, ${s}%, ${this.roundA})`}toHsl(){const e=Ed(this.r,this.g,this.b);return{h:360*e.h,s:e.s,l:e.l,a:this.a}}toHslString(){const e=Ed(this.r,this.g,this.b),t=Math.round(360*e.h),n=Math.round(100*e.s),s=Math.round(100*e.l);return 1===this.a?`hsl(${t}, ${n}%, ${s}%)`:`hsla(${t}, ${n}%, ${s}%, ${this.roundA})`}toHex(e=!1){return _d(this.r,this.g,this.b,e)}toHexString(e=!1){return"#"+this.toHex(e)}toHex8(e=!1){return function(e,t,n,s,r){const o=[wd(Math.round(e).toString(16)),wd(Math.round(t).toString(16)),wd(Math.round(n).toString(16)),wd((i=s,Math.round(255*parseFloat(i)).toString(16)))];var i;return r&&o[0].startsWith(o[0].charAt(1))&&o[1].startsWith(o[1].charAt(1))&&o[2].startsWith(o[2].charAt(1))&&o[3].startsWith(o[3].charAt(1))?o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0)+o[3].charAt(0):o.join("")}(this.r,this.g,this.b,this.a,e)}toHex8String(e=!1){return"#"+this.toHex8(e)}toHexShortString(e=!1){return 1===this.a?this.toHexString(e):this.toHex8String(e)}toRgb(){return{r:Math.round(this.r),g:Math.round(this.g),b:Math.round(this.b),a:this.a}}toRgbString(){const e=Math.round(this.r),t=Math.round(this.g),n=Math.round(this.b);return 1===this.a?`rgb(${e}, ${t}, ${n})`:`rgba(${e}, ${t}, ${n}, ${this.roundA})`}toPercentageRgb(){const e=e=>`${Math.round(100*Sd(e,255))}%`;return{r:e(this.r),g:e(this.g),b:e(this.b),a:this.a}}toPercentageRgbString(){const e=e=>Math.round(100*Sd(e,255));return 1===this.a?`rgb(${e(this.r)}%, ${e(this.g)}%, ${e(this.b)}%)`:`rgba(${e(this.r)}%, ${e(this.g)}%, ${e(this.b)}%, ${this.roundA})`}toCmyk(){return{...kd(this.r,this.g,this.b)}}toCmykString(){const{c:e,m:t,y:n,k:s}=kd(this.r,this.g,this.b);return`cmyk(${e}, ${t}, ${n}, ${s})`}toName(){if(0===this.a)return"transparent";if(this.a<1)return!1;const e="#"+_d(this.r,this.g,this.b,!1);for(const[t,n]of Object.entries(Rd))if(e===n)return t;return!1}toString(e){const t=Boolean(e);e=e??this.format;let n=!1;const s=this.a<1&&this.a>=0;return t||!s||!e.startsWith("hex")&&"name"!==e?("rgb"===e&&(n=this.toRgbString()),"prgb"===e&&(n=this.toPercentageRgbString()),"hex"!==e&&"hex6"!==e||(n=this.toHexString()),"hex3"===e&&(n=this.toHexString(!0)),"hex4"===e&&(n=this.toHex8String(!0)),"hex8"===e&&(n=this.toHex8String()),"name"===e&&(n=this.toName()),"hsl"===e&&(n=this.toHslString()),"hsv"===e&&(n=this.toHsvString()),"cmyk"===e&&(n=this.toCmykString()),n||this.toHexString()):"name"===e&&0===this.a?this.toName():this.toRgbString()}toNumber(){return(Math.round(this.r)<<16)+(Math.round(this.g)<<8)+Math.round(this.b)}clone(){return new Dd(this.toString())}lighten(e=10){const t=this.toHsl();return t.l+=e/100,t.l=yd(t.l),new Dd(t)}brighten(e=10){const t=this.toRgb();return t.r=Math.max(0,Math.min(255,t.r-Math.round(-e/100*255))),t.g=Math.max(0,Math.min(255,t.g-Math.round(-e/100*255))),t.b=Math.max(0,Math.min(255,t.b-Math.round(-e/100*255))),new Dd(t)}darken(e=10){const t=this.toHsl();return t.l-=e/100,t.l=yd(t.l),new Dd(t)}tint(e=10){return this.mix("white",e)}shade(e=10){return this.mix("black",e)}desaturate(e=10){const t=this.toHsl();return t.s-=e/100,t.s=yd(t.s),new Dd(t)}saturate(e=10){const t=this.toHsl();return t.s+=e/100,t.s=yd(t.s),new Dd(t)}greyscale(){return this.desaturate(100)}spin(e){const t=this.toHsl(),n=(t.h+e)%360;return t.h=n<0?360+n:n,new Dd(t)}mix(e,t=50){const n=this.toRgb(),s=new Dd(e).toRgb(),r=t/100,o={r:(s.r-n.r)*r+n.r,g:(s.g-n.g)*r+n.g,b:(s.b-n.b)*r+n.b,a:(s.a-n.a)*r+n.a};return new Dd(o)}analogous(e=6,t=30){const n=this.toHsl(),s=360/t,r=[this];for(n.h=(n.h-(s*e>>1)+720)%360;--e;)n.h=(n.h+s)%360,r.push(new Dd(n));return r}complement(){const e=this.toHsl();return e.h=(e.h+180)%360,new Dd(e)}monochromatic(e=6){const t=this.toHsv(),{h:n}=t,{s}=t;let{v:r}=t;const o=[],i=1/e;for(;e--;)o.push(new Dd({h:n,s,v:r})),r=(r+i)%1;return o}splitcomplement(){const e=this.toHsl(),{h:t}=e;return[this,new Dd({h:(t+72)%360,s:e.s,l:e.l}),new Dd({h:(t+216)%360,s:e.s,l:e.l})]}onBackground(e){const t=this.toRgb(),n=new Dd(e).toRgb(),s=t.a+n.a*(1-t.a);return new Dd({r:(t.r*t.a+n.r*n.a*(1-t.a))/s,g:(t.g*t.a+n.g*n.a*(1-t.a))/s,b:(t.b*t.a+n.b*n.a*(1-t.a))/s,a:s})}triad(){return this.polyad(3)}tetrad(){return this.polyad(4)}polyad(e){const t=this.toHsl(),{h:n}=t,s=[this],r=360/e;for(let o=1;o<e;o++)s.push(new Dd({h:(n+o*r)%360,s:t.s,l:t.l}));return s}equals(e){const t=new Dd(e);return"cmyk"===this.format||"cmyk"===t.format?this.toCmykString()===t.toCmykString():this.toRgbString()===t.toRgbString()}}function Bd(e,t=20){return e.mix("#141414",t).toString()}var zd=Nn({name:"ElButton",__name:"button",props:md,emits:fd,setup(e,{expose:t,emit:n}){const s=e,r=n,o=function(e){const t=Ga(),n=Ai("button");return io((()=>{let s={},r=e.color;if(r){const o=r.match(/var\((.*?)\)/);o&&(r=window.getComputedStyle(window.document.documentElement).getPropertyValue(o[1]));const i=new Dd(r),a=e.dark?i.tint(20).toString():Bd(i,20);if(e.plain)s=n.cssVarBlock({"bg-color":e.dark?Bd(i,90):i.tint(90).toString(),"text-color":r,"border-color":e.dark?Bd(i,50):i.tint(50).toString(),"hover-text-color":`var(${n.cssVarName("color-white")})`,"hover-bg-color":r,"hover-border-color":r,"active-bg-color":a,"active-text-color":`var(${n.cssVarName("color-white")})`,"active-border-color":a}),t.value&&(s[n.cssVarBlockName("disabled-bg-color")]=e.dark?Bd(i,90):i.tint(90).toString(),s[n.cssVarBlockName("disabled-text-color")]=e.dark?Bd(i,50):i.tint(50).toString(),s[n.cssVarBlockName("disabled-border-color")]=e.dark?Bd(i,80):i.tint(80).toString());else if(e.link||e.text){const o=e.dark?Bd(i,30):i.tint(30).toString();if(s=n.cssVarBlock({"text-color":r,"hover-text-color":o,"active-text-color":a}),e.link&&(s[n.cssVarBlockName("hover-link-text-color")]=o,s[n.cssVarBlockName("active-color")]=a),t.value){const t=e.dark?Bd(i,50):i.tint(50).toString();s[n.cssVarBlockName("disabled-bg-color")]="transparent",s[n.cssVarBlockName("disabled-text-color")]=t,s[n.cssVarBlockName("disabled-border-color")]="transparent"}}else{const o=e.dark?Bd(i,30):i.tint(30).toString(),l=i.isDark()?`var(${n.cssVarName("color-white")})`:`var(${n.cssVarName("color-black")})`;if(s=n.cssVarBlock({"bg-color":r,"text-color":l,"border-color":r,"hover-bg-color":o,"hover-text-color":l,"hover-border-color":o,"active-bg-color":a,"active-border-color":a}),t.value){const t=e.dark?Bd(i,50):i.tint(50).toString();s[n.cssVarBlockName("disabled-bg-color")]=t,s[n.cssVarBlockName("disabled-text-color")]=e.dark?"rgba(255, 255, 255, 0.5)":`var(${n.cssVarName("color-white")})`,s[n.cssVarBlockName("disabled-border-color")]=t}}}return s}))}(s),i=Ai("button"),{_ref:a,_size:l,_type:c,_disabled:d,_props:u,_plain:h,_round:g,_text:p,_dashed:m,shouldAddSpace:f,handleClick:v}=((e,t)=>{(({from:e,replacement:t,scope:n,version:s,ref:r,type:o="API"},i)=>{wn((()=>Mt(i)),(i=>{i&&bo(n,`[${o}] ${e} is about to be deprecated in version ${s}, please use ${t} instead.\nFor more detail, please visit: ${r}\n`)}),{immediate:!0})})({from:"type.text",replacement:"link",version:"3.0.0",scope:"props",ref:"https://element-plus.org/en-US/component/button.html#button-attributes"},io((()=>"text"===e.type)));const n=yn(vd,void 0),s=gd("button"),{form:r}=$a(),o=Ha(io((()=>n?.size))),i=Ga(),a=Ct(),l=Es(),c=io((()=>e.type||n?.type||s.value?.type||"")),d=io((()=>e.autoInsertSpace??s.value?.autoInsertSpace??!1)),u=io((()=>e.plain??s.value?.plain??!1)),h=io((()=>e.round??s.value?.round??!1)),g=io((()=>e.text??s.value?.text??!1)),p=io((()=>e.dashed??s.value?.dashed??!1)),m=io((()=>"button"===e.tag?{ariaDisabled:i.value||e.loading,disabled:i.value||e.loading,autofocus:e.autofocus,type:e.nativeType}:{})),f=io((()=>{const e=l.default?.();if(d.value&&1===e?.length){const t=e[0];if(t?.type===br){const e=t.children;return/^\p{Unified_Ideograph}{2}$/u.test(e.trim())}}return!1}));return{_disabled:i,_size:o,_type:c,_ref:a,_props:m,_plain:u,_round:h,_text:g,_dashed:p,shouldAddSpace:f,handleClick:n=>{i.value||e.loading?n.stopPropagation():("reset"===e.nativeType&&r?.resetFields(),t("click",n))}}})(s,r),S=io((()=>[i.b(),i.m(c.value),i.m(l.value),i.is("disabled",d.value),i.is("loading",s.loading),i.is("plain",h.value),i.is("round",g.value),i.is("circle",s.circle),i.is("text",p.value),i.is("dashed",m.value),i.is("link",s.link),i.is("has-bg",s.bg)]));return t({ref:a,size:l,type:c,disabled:d,shouldAddSpace:f}),(t,n)=>(Mr(),Rr(ps(e.tag),Gr({ref_key:"_ref",ref:a},Mt(u),{class:S.value,style:Mt(o),onClick:Mt(v)}),{default:mn((()=>[e.loading?(Mr(),Pr(yr,{key:0},[t.$slots.loading?vs(t.$slots,"loading",{key:0}):(Mr(),Rr(Mt(Qi),{key:1,class:W(Mt(i).is("loading"))},{default:mn((()=>[(Mr(),Rr(ps(e.loadingIcon)))])),_:1},8,["class"]))],64)):e.icon||t.$slots.icon?(Mr(),Rr(Mt(Qi),{key:1},{default:mn((()=>[e.icon?(Mr(),Rr(ps(e.icon),{key:0})):vs(t.$slots,"icon",{key:1})])),_:3})):Ur("v-if",!0),t.$slots.default?(Mr(),Pr("span",{key:2,class:W({[Mt(i).em("text","expand")]:Mt(f)})},[vs(t.$slots,"default")],2)):Ur("v-if",!0)])),_:3},16,["class","style","onClick"]))}}),Ud=zd,Vd=Nn({name:"ElButtonGroup",__name:"button-group",props:{size:md.size,type:md.type,direction:{type:String,values:["horizontal","vertical"],default:"horizontal"}},setup(e){const t=e;Sn(vd,ct({size:At(t,"size"),type:At(t,"type")}));const n=Ai("button");return(e,s)=>(Mr(),Pr("div",{class:W([Mt(n).b("group"),Mt(n).bm("group",t.direction)])},[vs(e.$slots,"default")],2))}});const Nd=qi(Ud,{ButtonGroup:Vd});var Hd;(Hd=Vd).install=o,Ki(Hd);const Gd="_trap-focus-children",$d=[],Wd=e=>{if(0===$d.length)return;const t=Yi(e),n=$d[$d.length-1][Gd];if(n.length>0&&t===Xi.tab){if(1===n.length)return e.preventDefault(),void(document.activeElement!==n[0]&&n[0].focus());const t=e.shiftKey,s=e.target===n[0],r=e.target===n[n.length-1];s&&t&&(e.preventDefault(),n[n.length-1].focus()),r&&!t&&(e.preventDefault(),n[0].focus())}},jd={beforeMount(e){e[Gd]=hi(e),$d.push(e),$d.length<=1&&document.addEventListener("keydown",Wd)},updated(e){Qt((()=>{e[Gd]=hi(e)}))},unmounted(){$d.shift(),0===$d.length&&document.removeEventListener("keydown",Wd)}};var Kd=Nn({name:"ElOverlay",props:Qo({mask:{type:Boolean,default:!0},customMaskEvent:Boolean,overlayClass:{type:[String,Array,Object]},zIndex:{type:[String,Number]}}),emits:{click:e=>e instanceof MouseEvent},setup(e,{slots:t,emit:n}){const s=Ai("overlay"),{onClick:r,onMousedown:o,onMouseup:i}=Fi(e.customMaskEvent?void 0:e=>{n("click",e)});return()=>e.mask?Dr("div",{class:[s.b(),e.overlayClass],style:{zIndex:e.zIndex},onClick:r,onMousedown:o,onMouseup:i},[vs(t,"default")],14,["onClick","onMouseup","onMousedown"]):ao("div",{class:e.overlayClass,style:{zIndex:e.zIndex,position:"fixed",top:"0px",right:"0px",bottom:"0px",left:"0px"}},[vs(t,"default")])}}),qd=Nn({name:"ElMessageBox",directives:{TrapFocus:jd},components:{ElButton:Nd,ElFocusTrap:Ma,ElInput:Zc,ElOverlay:Kd,ElIcon:Qi,...ai},inheritAttrs:!1,props:{buttonSize:{type:String,validator:e=>["",...di].includes(e)},modal:{type:Boolean,default:!0},lockScroll:{type:Boolean,default:!0},showClose:{type:Boolean,default:!0},closeOnClickModal:{type:Boolean,default:!0},closeOnPressEscape:{type:Boolean,default:!0},closeOnHashChange:{type:Boolean,default:!0},center:Boolean,draggable:Boolean,overflow:Boolean,roundButton:Boolean,container:{type:String,default:"body"},boxType:{type:String,default:""}},emits:["vanish","action"],setup(e,{emit:t}){const{locale:n,zIndex:s,ns:r,size:o}=function(e,t){const n=gd(),s=Ai("message-box",io((()=>n.value?.namespace||"el"))),r=(e=>{const t=e||yn(rd,Ct());return(e=>({lang:io((()=>Mt(e).name)),locale:bt(e)?e:Ct(e),t:nd(e)}))(io((()=>t.value||td)))})(io((()=>n.value?.locale))),o=cd(io((()=>{const e=n.value?.zIndex;return Ea(e)||Number.isNaN(e)?2e3:e}))),i=io((()=>Mt(t)||n.value?.size||""));return((e,t,n=!1)=>{const s=!!qr(),r=s?gd():void 0,o=t?.provide??(s?Sn:void 0);if(!o)return void bo("provideGlobalConfig","provideGlobalConfig() can only be used inside setup().");const i=io((()=>{const t=Mt(e);return r?.value?pd(r.value,t):t}));o(ud,i),o(rd,io((()=>i.value.locale))),o(Ri,io((()=>i.value.namespace))),o(ld,io((()=>i.value.zIndex))),o(Ua,{size:io((()=>i.value.size||""))}),o(dd,io((()=>({emptyValues:i.value.emptyValues,valueOnClear:i.value.valueOnClear})))),!n&&hd.value||(hd.value=i.value)})(io((()=>Mt(n)||{}))),{ns:s,locale:r,zIndex:o,size:i}}(0,io((()=>e.buttonSize))),{t:i}=n,{nextZIndex:a}=s,l=Ct(!1),c=ct({autofocus:!0,beforeClose:null,callback:null,cancelButtonText:"",cancelButtonClass:"",confirmButtonText:"",confirmButtonClass:"",cancelButtonType:"",confirmButtonType:"primary",customClass:"",customStyle:{},dangerouslyUseHTMLString:!1,distinguishCancelAndClose:!1,icon:"",closeIcon:"",inputPattern:null,inputPlaceholder:"",inputType:"text",inputValue:"",inputValidator:void 0,inputErrorMessage:"",message:"",modalFade:!0,modalClass:"",showCancelButton:!1,showConfirmButton:!0,type:"",title:void 0,showInput:!1,action:"",confirmButtonLoading:!1,cancelButtonLoading:!1,confirmButtonLoadingIcon:vt(ni),cancelButtonLoadingIcon:vt(ni),confirmButtonDisabled:!1,editorErrorMessage:"",validateError:!1,zIndex:a()}),d=io((()=>{const e=c.type;return{[r.bm("icon",e)]:e&&li[e]}})),u=Bi(),h=Bi(),g=io((()=>{const e=c.type;return c.icon||e&&li[e]||""})),p=io((()=>!!c.message)),m=Ct(),f=Ct(),y=Ct(),b=Ct(),C=Ct(),w=io((()=>c.confirmButtonClass));wn((()=>c.inputValue),(async t=>{await Qt(),"prompt"===e.boxType&&t&&x()}),{immediate:!0}),wn((()=>l.value),(t=>{t&&("prompt"!==e.boxType&&(c.autofocus?y.value=C.value?.$el??m.value:y.value=m.value),c.zIndex=a()),"prompt"===e.boxType&&(t?Qt().then((()=>{b.value&&b.value.$el&&(c.autofocus?y.value=P()??m.value:y.value=m.value)})):(c.editorErrorMessage="",c.validateError=!1))}));const{isDragging:E}=((e,t,n,s)=>{const r={offsetX:0,offsetY:0},o=Ct(!1),i=(t,n)=>{if(e.value){const{offsetX:o,offsetY:i}=r,a=e.value.getBoundingClientRect(),l=Math.max(a.left,0),c=Math.max(a.top,0),d=a.width,u=a.height,h=document.documentElement.clientWidth,g=document.documentElement.clientHeight,p=-l+o,m=-c+i,f=h-l-d+o,v=g-c-(u<g?u:0)+i;s?.value||(t=_i(t,p,f),n=_i(n,m,v)),r.offsetX=t,r.offsetY=n,e.value.style.transform=`translate(${mi(t)}, ${mi(n)})`}},a=e=>{const t=e.clientX,n=e.clientY,{offsetX:s,offsetY:a}=r,l=e=>{o.value||(o.value=!0),i(s+e.clientX-t,a+e.clientY-n)},c=()=>{o.value=!1,document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",c)};document.addEventListener("mousemove",l),document.addEventListener("mouseup",c)},l=()=>{t.value&&e.value&&(t.value.removeEventListener("mousedown",a),window.removeEventListener("resize",c))},c=()=>{const{offsetX:e,offsetY:t}=r;i(e,t)};return ns((()=>{Cn((()=>{n.value?t.value&&e.value&&(t.value.addEventListener("mousedown",a),window.addEventListener("resize",c)):l()}))})),os((()=>{l()})),{isDragging:o,resetPosition:()=>{r.offsetX=0,r.offsetY=0,e.value&&(e.value.style.transform="")},updatePosition:c}})(m,f,io((()=>e.draggable)),io((()=>e.overflow)));function T(){l.value&&(l.value=!1,Qt((()=>{c.action&&t("action",c.action)})))}ns((async()=>{await Qt(),e.closeOnHashChange&&window.addEventListener("hashchange",T)})),os((()=>{e.closeOnHashChange&&window.removeEventListener("hashchange",T)}));const M=()=>{e.closeOnClickModal&&k(c.distinguishCancelAndClose?"close":"cancel")},_=Fi(M),k=t=>{("prompt"!==e.boxType||"confirm"!==t||x())&&(c.action=t,c.beforeClose?c.beforeClose?.(t,c,T):T())},x=()=>{if("prompt"===e.boxType){const e=c.inputPattern;if(e&&!e.test(c.inputValue||""))return c.editorErrorMessage=c.inputErrorMessage||i("el.messagebox.error"),c.validateError=!0,!1;const t=c.inputValidator;if(v(t)){const e=t(c.inputValue);if(!1===e)return c.editorErrorMessage=c.inputErrorMessage||i("el.messagebox.error"),c.validateError=!0,!1;if(S(e))return c.editorErrorMessage=e,c.validateError=!0,!1}}return c.editorErrorMessage="",c.validateError=!1,!0},P=()=>{const e=b.value?.$refs;return e?.input??e?.textarea},R=()=>{k("close")};return e.lockScroll&&Oi(l,{ns:r}),{...Pt(c),ns:r,overlayEvent:_,visible:l,hasMessage:p,typeClass:d,contentId:u,inputId:h,btnSize:o,iconComponent:g,confirmButtonClasses:w,rootRef:m,focusStartRef:y,headerRef:f,inputRef:b,isDragging:E,confirmRef:C,doClose:T,handleClose:R,onCloseRequested:()=>{e.closeOnPressEscape&&R()},handleWrapperClick:M,handleInputEnter:e=>{if("textarea"!==c.inputType&&!b.value?.isComposing)return e.preventDefault(),k("confirm")},handleAction:k,t:i}}});const Qd=["aria-label","aria-describedby"],Xd=["aria-label"],Jd=["id"];var Yd=Co(qd,[["render",function(e,t,n,s,r,o){const i=hs("el-icon"),a=hs("el-input"),l=hs("el-button"),c=hs("el-focus-trap"),d=hs("el-overlay");return Mr(),Rr(dc,{name:"fade-in-linear",onAfterLeave:t[11]||(t[11]=t=>e.$emit("vanish")),persisted:""},{default:mn((()=>[fn(Dr(d,{"z-index":e.zIndex,"overlay-class":[e.ns.is("message-box"),e.modalClass],mask:e.modal},{default:mn((()=>[Ir("div",{role:"dialog","aria-label":e.title,"aria-modal":"true","aria-describedby":e.showInput?void 0:e.contentId,class:W(`${e.ns.namespace.value}-overlay-message-box`),onClick:t[8]||(t[8]=(...t)=>e.overlayEvent.onClick&&e.overlayEvent.onClick(...t)),onMousedown:t[9]||(t[9]=(...t)=>e.overlayEvent.onMousedown&&e.overlayEvent.onMousedown(...t)),onMouseup:t[10]||(t[10]=(...t)=>e.overlayEvent.onMouseup&&e.overlayEvent.onMouseup(...t))},[Dr(c,{loop:"",trapped:e.visible,"focus-trap-el":e.rootRef,"focus-start-el":e.focusStartRef,onReleaseRequested:e.onCloseRequested},{default:mn((()=>[Ir("div",{ref:"rootRef",class:W([e.ns.b(),e.customClass,e.ns.is("draggable",e.draggable),e.ns.is("dragging",e.isDragging),{[e.ns.m("center")]:e.center}]),style:V(e.customStyle),tabindex:"-1",onClick:t[7]||(t[7]=Gc((()=>{}),["stop"]))},[null!==e.title&&void 0!==e.title?(Mr(),Pr("div",{key:0,ref:"headerRef",class:W([e.ns.e("header"),{"show-close":e.showClose}])},[Ir("div",{class:W(e.ns.e("title"))},[e.iconComponent&&e.center?(Mr(),Rr(i,{key:0,class:W([e.ns.e("status"),e.typeClass])},{default:mn((()=>[(Mr(),Rr(ps(e.iconComponent)))])),_:1},8,["class"])):Ur("v-if",!0),Ir("span",null,X(e.title),1)],2),e.showClose?(Mr(),Pr("button",{key:0,type:"button",class:W(e.ns.e("headerbtn")),"aria-label":e.t("el.messagebox.close"),onClick:t[0]||(t[0]=t=>e.handleAction(e.distinguishCancelAndClose?"close":"cancel")),onKeydown:t[1]||(t[1]=Wc(Gc((t=>e.handleAction(e.distinguishCancelAndClose?"close":"cancel")),["prevent"]),["enter"]))},[Dr(i,{class:W(e.ns.e("close"))},{default:mn((()=>[(Mr(),Rr(ps(e.closeIcon||"close")))])),_:1},8,["class"])],42,Xd)):Ur("v-if",!0)],2)):Ur("v-if",!0),Ir("div",{id:e.contentId,class:W(e.ns.e("content"))},[Ir("div",{class:W(e.ns.e("container"))},[e.iconComponent&&!e.center&&e.hasMessage?(Mr(),Rr(i,{key:0,class:W([e.ns.e("status"),e.typeClass])},{default:mn((()=>[(Mr(),Rr(ps(e.iconComponent)))])),_:1},8,["class"])):Ur("v-if",!0),e.hasMessage?(Mr(),Pr("div",{key:1,class:W(e.ns.e("message"))},[vs(e.$slots,"default",{},(()=>[e.dangerouslyUseHTMLString?(Mr(),Rr(ps(e.showInput?"label":"p"),{key:1,for:e.showInput?e.inputId:void 0,innerHTML:e.message},null,8,["for","innerHTML"])):(Mr(),Rr(ps(e.showInput?"label":"p"),{key:0,for:e.showInput?e.inputId:void 0,textContent:X(e.message)},null,8,["for","textContent"]))]))],2)):Ur("v-if",!0)],2),fn(Ir("div",{class:W(e.ns.e("input"))},[Dr(a,{id:e.inputId,ref:"inputRef",modelValue:e.inputValue,"onUpdate:modelValue":t[2]||(t[2]=t=>e.inputValue=t),type:e.inputType,placeholder:e.inputPlaceholder,"aria-invalid":e.validateError,class:W({invalid:e.validateError}),onKeydown:Wc(e.handleInputEnter,["enter"])},null,8,["id","modelValue","type","placeholder","aria-invalid","class","onKeydown"]),Ir("div",{class:W(e.ns.e("errormsg")),style:V({visibility:e.editorErrorMessage?"visible":"hidden"})},X(e.editorErrorMessage),7)],2),[[Tc,e.showInput]])],10,Jd),e.showCancelButton||e.showConfirmButton?(Mr(),Pr("div",{key:1,class:W(e.ns.e("btns"))},[e.showCancelButton?(Mr(),Rr(l,{key:0,type:"text"===e.cancelButtonType?"":e.cancelButtonType,text:"text"===e.cancelButtonType,loading:e.cancelButtonLoading,"loading-icon":e.cancelButtonLoadingIcon,class:W([e.cancelButtonClass]),round:e.roundButton,size:e.btnSize,onClick:t[3]||(t[3]=t=>e.handleAction("cancel")),onKeydown:t[4]||(t[4]=Wc(Gc((t=>e.handleAction("cancel")),["prevent"]),["enter"]))},{default:mn((()=>[zr(X(e.cancelButtonText||e.t("el.messagebox.cancel")),1)])),_:1},8,["type","text","loading","loading-icon","class","round","size"])):Ur("v-if",!0),fn(Dr(l,{ref:"confirmRef",type:"text"===e.confirmButtonType?"":e.confirmButtonType,text:"text"===e.confirmButtonType,loading:e.confirmButtonLoading,"loading-icon":e.confirmButtonLoadingIcon,class:W([e.confirmButtonClasses]),round:e.roundButton,disabled:e.confirmButtonDisabled,size:e.btnSize,onClick:t[5]||(t[5]=t=>e.handleAction("confirm")),onKeydown:t[6]||(t[6]=Wc(Gc((t=>e.handleAction("confirm")),["prevent"]),["enter"]))},{default:mn((()=>[zr(X(e.confirmButtonText||e.t("el.messagebox.confirm")),1)])),_:1},8,["type","text","loading","loading-icon","class","round","disabled","size"]),[[Tc,e.showConfirmButton]])],2)):Ur("v-if",!0)],6)])),_:3},8,["trapped","focus-trap-el","focus-start-el","onReleaseRequested"])],42,Qd)])),_:3},8,["z-index","overlay-class","mask"]),[[Tc,e.visible]])])),_:3})}]]);const Zd=new Map,eu=(e,t)=>{const n=e.component?.proxy;return()=>n.handleAction(t)},tu=(e,t)=>{const n=document.createElement("div");e.onVanish=()=>{qc(null,n),Zd.delete(r)},e.onAction=t=>{const n=Zd.get(r);let o;o=e.showInput?{value:r.inputValue,action:t}:t,e.callback?e.callback(o,s.proxy):"cancel"===t||"close"===t?e.distinguishCancelAndClose&&"cancel"!==t?n.reject("close"):n.reject("cancel"):n.resolve(o)};const s=((e,t,n=null)=>{const s=Dr(Yd,e,v(e.message)||Lr(e.message)?{default:v(e.message)?()=>e.message({confirm:eu(s,"confirm"),cancel:eu(s,"cancel"),close:eu(s,"close")}):()=>e.message}:null);return s.appContext=n,qc(s,t),(e=>{let t=document.body;return e.appendTo&&(S(e.appendTo)&&(t=document.querySelector(e.appendTo)),So(e.appendTo)&&(t=e.appendTo),So(t)||(bo("ElMessageBox","the appendTo option is not an HTMLElement. Falling back to document.body."),t=document.body)),t})(e).appendChild(t.firstElementChild),s.component})(e,n,t),r=s.proxy;for(const t in e)h(e,t)&&!h(r.$props,t)&&("closeIcon"===t&&b(e[t])?r[t]=vt(e[t]):r[t]=e[t]);return r.visible=!0,r};function nu(e,t=null){if(!uo)return Promise.reject();let n;return S(e)||Lr(e)?e={message:e}:n=e.callback,new Promise(((s,r)=>{const o=tu(e,t??nu._context);Zd.set(o,{options:e,callback:n,resolve:s,reject:r})}))}const su={alert:{closeOnPressEscape:!1,closeOnClickModal:!1},confirm:{showCancelButton:!0},prompt:{showCancelButton:!0,showInput:!0}};["alert","confirm","prompt"].forEach((e=>{nu[e]=function(e){return(t,n,s,r)=>{let o="";return b(n)?(s=n,o=""):o=void 0===n?"":n,nu(Object.assign({title:o,message:t,type:"",...su[e]},s,{boxType:e}),r)}}(e)})),nu.close=()=>{Zd.forEach(((e,t)=>{t.doClose()})),Zd.clear()},nu._context=null;const ru=nu;ru.install=e=>{ru._context=e._context,e.config.globalProperties.$msgbox=ru,e.config.globalProperties.$messageBox=ru,e.config.globalProperties.$alert=ru.alert,e.config.globalProperties.$confirm=ru.confirm,e.config.globalProperties.$prompt=ru.prompt};const ou=ru;class iu{static GetStackTrace(){const e=new Error;let t="No Stack Available for this browser";return e.stack&&(t=e.stack.toString().replace(/Error/g,"")),t}static SetLoggerVerbosity(e){null!=this.verboseLogLevel&&(this.verboseLogLevel=e)}static Log(e,t,n){if(n>this.verboseLogLevel)return;const s=`Level: Log\nMsg: ${t}\nCaller: ${e}`;console.log(s)}static Info(e,t,n){if(n>this.verboseLogLevel)return;const s=`Level: Info\nMsg: ${t}`;console.info(s)}static Error(e,t){const n=`Level: Error\nMsg: ${t}\nCaller: ${e}`;console.error(n)}static Warning(e,t){const n=`Level: Warning\nCaller: ${e}\nMsg: ${t}`;console.warn(n)}}var au,lu;iu.verboseLogLevel=5,function(e){e.LIST_STREAMERS="listStreamers",e.SUBSCRIBE="subscribe",e.UNSUBSCRIBE="unsubscribe",e.ICE_CANDIDATE="iceCandidate",e.OFFER="offer",e.ANSWER="answer",e.DATACHANNELREQUEST="dataChannelRequest",e.SFURECVDATACHANNELREADY="peerDataChannelsReady",e.PONG="pong"}(au||(au={}));class cu{payload(){return iu.Log(iu.GetStackTrace(),"Sending => \n"+JSON.stringify(this,void 0,4),6),JSON.stringify(this)}}class du extends cu{constructor(){super(),this.type=au.LIST_STREAMERS}}class uu extends cu{constructor(e){super(),this.type=au.LIST_STREAMERS,this.streamerName=e}}class hu extends cu{constructor(e){super(),this.type=au.SUBSCRIBE,this.streamerId=e}}class gu extends cu{constructor(){super(),this.type=au.UNSUBSCRIBE}}class pu extends cu{constructor(e){super(),this.type=au.PONG,this.time=e}}class mu extends cu{constructor(e){super(),this.type=au.OFFER,e&&(this.type=e.type,this.sdp=e.sdp)}}class fu extends cu{constructor(e){super(),this.type=au.ANSWER,e&&(this.type=e.type,this.sdp=e.sdp)}}class vu extends cu{constructor(){super(),this.type=au.DATACHANNELREQUEST}}class Su extends cu{constructor(){super(),this.type=au.SFURECVDATACHANNELREADY}}class yu{constructor(e){this.type=au.ICE_CANDIDATE,this.candidate=e}payload(){return iu.Log(iu.GetStackTrace(),"Sending => \n"+JSON.stringify(this,void 0,4),6),JSON.stringify(this)}}!function(e){e.CONFIG="config",e.STREAMER_LIST="streamerList",e.PLAYER_COUNT="playerCount",e.OFFER="offer",e.ANSWER="answer",e.ICE_CANDIDATE="iceCandidate",e.PEER_DATA_CHANNELS="peerDataChannels",e.PING="ping",e.WARNING="warning"}(lu||(lu={}));class bu{}class Cu extends bu{}class wu{constructor(){this.FromUEMessageHandlers=new Map}addMessageHandler(e,t){this.FromUEMessageHandlers.set(e,t)}handleMessage(e,t){this.FromUEMessageHandlers.has(e)?this.FromUEMessageHandlers.get(e)(t):iu.Error(iu.GetStackTrace(),`Message type of ${e} does not have a message handler registered on the frontend - ignoring message.`)}static setupDefaultHandlers(e){e.signallingProtocol.addMessageHandler(lu.PING,(t=>{const n=new pu((new Date).getTime()).payload();iu.Log(iu.GetStackTrace(),lu.PING+": "+t,6),e.webSocket.send(n)})),e.signallingProtocol.addMessageHandler(lu.CONFIG,(t=>{iu.Log(iu.GetStackTrace(),lu.CONFIG,6);const n=JSON.parse(t);e.onConfig(n)})),e.signallingProtocol.addMessageHandler(lu.STREAMER_LIST,(t=>{iu.Log(iu.GetStackTrace(),lu.STREAMER_LIST,6);const n=JSON.parse(t);e.onStreamerList(n)})),e.signallingProtocol.addMessageHandler(lu.PLAYER_COUNT,(t=>{iu.Log(iu.GetStackTrace(),lu.PLAYER_COUNT,6);const n=JSON.parse(t);iu.Log(iu.GetStackTrace(),"Player Count: "+n.count,6),e.onPlayerCount(n)})),e.signallingProtocol.addMessageHandler(lu.ANSWER,(t=>{iu.Log(iu.GetStackTrace(),lu.ANSWER,6);const n=JSON.parse(t);e.onWebRtcAnswer(n)})),e.signallingProtocol.addMessageHandler(lu.OFFER,(t=>{iu.Log(iu.GetStackTrace(),lu.OFFER,6);const n=JSON.parse(t);e.onWebRtcOffer(n)})),e.signallingProtocol.addMessageHandler(lu.ICE_CANDIDATE,(t=>{iu.Log(iu.GetStackTrace(),lu.ICE_CANDIDATE,6);const n=JSON.parse(t);e.onIceCandidate(n.candidate)})),e.signallingProtocol.addMessageHandler(lu.WARNING,(e=>{iu.Warning(iu.GetStackTrace(),`Warning received: ${e}`)})),e.signallingProtocol.addMessageHandler(lu.PEER_DATA_CHANNELS,(t=>{iu.Log(iu.GetStackTrace(),lu.PEER_DATA_CHANNELS,6);const n=JSON.parse(t);e.onWebRtcPeerDataChannels(n)}))}}class Eu{constructor(){this.WS_OPEN_STATE=1,this.onOpen=new EventTarget,this.onClose=new EventTarget,this.signallingProtocol=new wu,wu.setupDefaultHandlers(this)}connect(e){iu.Log(iu.GetStackTrace(),e,6);try{return this.webSocket=new WebSocket(e),this.webSocket.onopen=e=>this.handleOnOpen(e),this.webSocket.onerror=()=>this.handleOnError(),this.webSocket.onclose=e=>this.handleOnClose(e),this.webSocket.onmessage=e=>this.handleOnMessage(e),this.webSocket.onmessagebinary=e=>this.handleOnMessageBinary(e),!0}catch(e){return iu.Error(e,e),!1}}handleOnMessageBinary(e){e&&e.data&&e.data.text().then((e=>{const t=new MessageEvent("messageFromBinary",{data:e});this.handleOnMessage(t)})).catch((e=>{iu.Error(iu.GetStackTrace(),`从websocket解析二进制blob失败,原因: ${e}`)}))}handleOnMessage(e){if(e.data&&e.data instanceof Blob)return void this.handleOnMessageBinary(e);const t=JSON.parse(e.data);iu.Log(iu.GetStackTrace(),"received => \n"+JSON.stringify(JSON.parse(e.data),void 0,4),6),this.signallingProtocol.handleMessage(t.type,e.data)}handleOnOpen(e){iu.Log(iu.GetStackTrace(),"通过WebSocket连接到信令服务器",6),this.onOpen.dispatchEvent(new Event("open"))}handleOnError(){iu.Error(iu.GetStackTrace(),"WebSocket error")}handleOnClose(e){console.log(e),iu.Log(iu.GetStackTrace(),"通过WebSocket与信令服务器断开连接: "+JSON.stringify(e.code)+" - "+e.reason),4004==e.code&&(this.onOpen.dispatchEvent(new Event("close",e)),this.onClose.dispatchEvent(new CustomEvent("close",{detail:e})))}requestStreamerList(){const e=new du;this.webSocket.send(e.payload())}requestStreamerObject(e){const t=new uu(e);this.webSocket.send(t.payload())}sendSubscribe(e){const t=new hu(e);this.webSocket.send(t.payload())}sendUnsubscribe(){const e=new gu;this.webSocket.send(e.payload())}sendWebRtcOffer(e){const t=new mu(e);this.webSocket.send(t.payload())}sendWebRtcAnswer(e){const t=new fu(e);this.webSocket.send(t.payload())}sendWebRtcDatachannelRequest(){const e=new vu;this.webSocket.send(e.payload())}sendSFURecvDataChannelReady(){const e=new Su;this.webSocket.send(e.payload())}sendIceCandidate(e){if(iu.Log(iu.GetStackTrace(),"Sending Ice Candidate(发送Ice候选人)"),this.webSocket&&this.webSocket.readyState===this.WS_OPEN_STATE){const t=new yu(e);this.webSocket.send(t.payload())}}close(){var e;null===(e=this.webSocket)||void 0===e||e.close()}onConfig(e){}onStreamerList(e){}onIceCandidate(e){}onWebRtcAnswer(e){}onWebRtcOffer(e){}onWebRtcPeerDataChannels(e){}onPlayerCount(e){}}class Tu{constructor(e){this.videoElementProvider=e,this.audioElement=document.createElement("Audio"),this.videoElementProvider.setAudioElement(this.audioElement)}handleOnTrack(e){iu.Log(iu.GetStackTrace(),"handleOnTrack "+JSON.stringify(e.streams),6);const t=this.videoElementProvider.getVideoElement();if(e.track&&iu.Log(iu.GetStackTrace(),"Got track - "+e.track.kind+" id="+e.track.id+" readyState="+e.track.readyState,6),"audio"!=e.track.kind)return"video"==e.track.kind&&t.srcObject!==e.streams[0]?(t.srcObject=e.streams[0],void iu.Log(iu.GetStackTrace(),"Set video source from video track ontrack.")):void 0;this.CreateAudioTrack(e.streams[0])}CreateAudioTrack(e){const t=this.videoElementProvider.getVideoElement();t.srcObject!=e&&t.srcObject&&t.srcObject!==e&&(this.audioElement.srcObject=e,iu.Log(iu.GetStackTrace(),"Created new audio element to play separate audio stream."))}}class Mu{constructor(e){this.freezeFrameHeight=0,this.freezeFrameWidth=0,this.rootDiv=e,this.rootElement=document.createElement("div"),this.rootElement.id="freezeFrame",this.rootElement.style.display="none",this.rootElement.style.pointerEvents="none",this.rootElement.style.position="absolute",this.rootElement.style.zIndex="20",this.imageElement=document.createElement("img"),this.imageElement.style.position="absolute",this.rootElement.appendChild(this.imageElement),this.rootDiv.appendChild(this.rootElement)}setElementForShow(){this.rootElement.style.display="block"}setElementForHide(){this.rootElement.style.display="none"}updateImageElementSource(e){const t=btoa(e.reduce(((e,t)=>e+String.fromCharCode(t)),""));this.imageElement.src="data:image/jpeg;base64,"+t}setDimensionsFromElementAndResize(){this.freezeFrameHeight=this.imageElement.naturalHeight,this.freezeFrameWidth=this.imageElement.naturalWidth,this.resize()}resize(){if(0!==this.freezeFrameWidth&&0!==this.freezeFrameHeight){let e=0,t=0,n=0,s=0;const r=this.rootDiv.clientWidth/this.rootDiv.clientHeight,o=this.freezeFrameWidth/this.freezeFrameHeight;r<o?(e=this.rootDiv.clientWidth,t=Math.floor(this.rootDiv.clientWidth/o),n=Math.floor(.5*(this.rootDiv.clientHeight-t)),s=0):(e=Math.floor(this.rootDiv.clientHeight*o),t=this.rootDiv.clientHeight,n=0,s=Math.floor(.5*(this.rootDiv.clientWidth-e))),this.rootElement.style.width=this.rootDiv.offsetWidth+"px",this.rootElement.style.height=this.rootDiv.offsetHeight+"px",this.rootElement.style.left="0px",this.rootElement.style.top="0px",this.imageElement.style.width=e+"px",this.imageElement.style.height=t+"px",this.imageElement.style.left=s+"px",this.imageElement.style.top=n+"px"}}}class _u{constructor(e){this.receiving=!1,this.size=0,this.jpeg=void 0,this.valid=!1,this.freezeFrameDelay=50,this.freezeFrame=new Mu(e)}showFreezeFrame(){this.valid&&this.freezeFrame.setElementForShow()}hideFreezeFrame(){this.valid=!1,this.freezeFrame.setElementForHide()}updateFreezeFrameAndShow(e,t){this.freezeFrame.updateImageElementSource(e),this.freezeFrame.imageElement.onload=()=>{this.freezeFrame.setDimensionsFromElementAndResize(),t()}}processFreezeFrameMessage(e,t){this.receiving||(this.receiving=!0,this.valid=!1,this.size=0,this.jpeg=void 0),this.size=new DataView(e.slice(1,5).buffer).getInt32(0,!0);const n=e.slice(5);if(this.jpeg){const e=new Uint8Array(this.jpeg.length+n.length);e.set(this.jpeg,0),e.set(n,this.jpeg.length),this.jpeg=e}else this.jpeg=n,this.receiving=!0,iu.Log(iu.GetStackTrace(),`received first chunk of freeze frame: ${this.jpeg.length}/${this.size}`,6);this.jpeg.length===this.size?(this.receiving=!1,this.valid=!0,iu.Log(iu.GetStackTrace(),`received complete freeze frame ${this.size}`,6),this.updateFreezeFrameAndShow(this.jpeg,t)):this.jpeg.length>this.size&&(iu.Error(iu.GetStackTrace(),`received bigger freeze frame than advertised: ${this.jpeg.length}/${this.size}`),this.jpeg=void 0,this.receiving=!1)}}class ku{constructor(e,t,n,s,r=(()=>{})){this.onChange=r,this.onChangeEmit=()=>{},this.id=e,this.description=n,this.label=t,this.value=s}set label(e){this._label=e,this.onChangeEmit(this._value)}get label(){return this._label}get value(){return this._value}set value(e){this._value=e,this.onChange(this._value,this),this.onChangeEmit(this._value)}}class xu extends ku{constructor(e,t,n,s,r,o=(()=>{})){super(e,t,n,s,o);const i=new URLSearchParams(window.location.search);if(r&&i.has(this.id)){const e=this.getUrlParamFlag();this.flag=e}else this.flag=s;this.useUrlParams=r}getUrlParamFlag(){const e=new URLSearchParams(window.location.search);return!!e.has(this.id)&&"false"!==e.get(this.id)&&"False"!==e.get(this.id)}updateURLParams(){if(this.useUrlParams){const e=new URLSearchParams(window.location.search);!0===this.flag?e.set(this.id,"true"):e.set(this.id,"false"),window.history.replaceState({},"",""!==e.toString()?`${location.pathname}?${e}`:`${location.pathname}`)}}enable(){this.flag=!0}get flag(){return!!this.value}set flag(e){this.value=e}}class Pu extends ku{constructor(e,t,n,s,r,o,i,a=(()=>{})){super(e,t,n,o,a),this._min=s,this._max=r;const l=new URLSearchParams(window.location.search);if(i&&l.has(this.id)){const e=Number.parseInt(l.get(this.id));this.number=Number.isNaN(e)?o:e}else this.number=o;this.useUrlParams=i}updateURLParams(){if(this.useUrlParams){const e=new URLSearchParams(window.location.search);e.set(this.id,this.number.toString()),window.history.replaceState({},"",""!==e.toString()?`${location.pathname}?${e}`:`${location.pathname}`)}}set number(e){this.value=this.clamp(e)}get number(){return this.value}clamp(e){return Math.max(Math.min(this._max,e),this._min)}get min(){return this._min}get max(){return this._max}addOnChangedListener(e){this.onChange=e}}class Ru extends ku{constructor(e,t,n,s,r,o=(()=>{})){super(e,t,n,s,o);const i=new URLSearchParams(window.location.search);if(r&&i.has(this.id)){const e=this.getUrlParamText();this.text=e}else this.text=s;this.useUrlParams=r}getUrlParamText(){var e;const t=new URLSearchParams(window.location.search);return t.has(this.id)&&null!==(e=t.get(this.id))&&void 0!==e?e:""}updateURLParams(){if(this.useUrlParams){const e=new URLSearchParams(window.location.search);e.set(this.id,this.text),window.history.replaceState({},"",""!==e.toString()?`${location.pathname}?${e}`:`${location.pathname}`)}}get text(){return this.value}set text(e){this.value=e}}class Lu extends ku{constructor(e,t,n,s,r,o,i=(()=>{})){super(e,t,n,[s,s],i),this.options=r;const a=new URLSearchParams(window.location.search),l=o&&a.has(this.id)?this.getUrlParamText():s;this.selected=l,this.useUrlParams=o}getUrlParamText(){var e;const t=new URLSearchParams(window.location.search);return t.has(this.id)&&null!==(e=t.get(this.id))&&void 0!==e?e:""}updateURLParams(){if(this.useUrlParams){const e=new URLSearchParams(window.location.search);e.set(this.id,this.selected),window.history.replaceState({},"",""!==e.toString()?`${location.pathname}?${e}`:`${location.pathname}`)}}addOnChangedListener(e){this.onChange=e}get options(){return this._options}set options(e){this._options=e,this.onChangeEmit(this.selected)}get selected(){return this.value}set selected(e){let t=this.options.filter((t=>-1!==t.indexOf(e)));t.length?this.value=t[0]:(t=this.options.filter((t=>-1!==t.indexOf(e.split(" ")[0]))),t.length&&(this.value=t[0]))}}class Au extends Event{constructor(e){super("afkWarningActivate"),this.data=e}}class Ou extends Event{constructor(e){super("afkWarningUpdate"),this.data=e}}class Fu extends Event{constructor(){super("afkWarningDeactivate")}}class Iu extends Event{constructor(){super("afkTimedOut")}}class Du extends Event{constructor(e){super("videoEncoderAvgQP"),this.data=e}}class Bu extends Event{constructor(){super("webRtcSdp")}}class zu extends Event{constructor(){super("webRtcAutoConnect")}}class Uu extends Event{constructor(){super("webRtcConnecting")}}class Vu extends Event{constructor(){super("webRtcConnected")}}class Nu extends Event{constructor(){super("webRtcFailed")}}class Hu extends Event{constructor(e){super("webRtcDisconnected"),this.data=e}}class Gu extends Event{constructor(e){super("dataChannelOpen"),this.data=e}}class $u extends Event{constructor(e){super("dataChannelClose"),this.data=e}}class Wu extends Event{constructor(e){super("dataChannelError"),this.data=e}}class ju extends Event{constructor(){super("videoInitialized")}}class Ku extends Event{constructor(){super("streamLoading")}}class qu extends Event{constructor(){super("streamConnect")}}class Qu extends Event{constructor(){super("streamDisconnect")}}class Xu extends Event{constructor(){super("streamReconnect")}}class Ju extends Event{constructor(e){super("playStreamError"),this.data=e}}class Yu extends Event{constructor(){super("playStream")}}class Zu extends Event{constructor(e){super("playStreamRejected"),this.data=e}}class eh extends Event{constructor(e){super("loadFreezeFrame"),this.data=e}}class th extends Event{constructor(){super("hideFreezeFrame")}}class nh extends Event{constructor(e){super("statsReceived"),this.data=e}}class sh extends Event{constructor(e){super("streamerListMessage"),this.data=e}}class rh extends Event{constructor(e){super("latencyTestResult"),this.data=e}}class oh extends Event{constructor(e){super("dataChannelLatencyTestResponse"),this.data=e}}class ih extends Event{constructor(e){super("dataChannelLatencyTestResult"),this.data=e}}class ah extends Event{constructor(e){super("initialSettings"),this.data=e}}class lh extends Event{constructor(e){super("settingsChanged"),this.data=e}}class ch extends Event{constructor(){super("xrSessionStarted")}}class dh extends Event{constructor(){super("xrSessionEnded")}}class uh extends Event{constructor(e){super("xrFrame"),this.data=e}}class hh extends Event{constructor(e){super("playerCount"),this.data=e}}class gh extends EventTarget{dispatchEvent(e){return super.dispatchEvent(e)}addEventListener(e,t){super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}}class ph{}ph.AutoConnect="AutoConnect",ph.AutoPlayVideo="AutoPlayVideo",ph.AFKDetection="TimeoutIfIdle",ph.BrowserSendOffer="OfferToReceive",ph.HoveringMouseMode="HoveringMouse",ph.ForceMonoAudio="ForceMonoAudio",ph.ForceTURN="ForceTURN",ph.FakeMouseWithTouches="FakeMouseWithTouches",ph.IsQualityController="ControlsQuality",ph.MatchViewportResolution="MatchViewportRes",ph.StartVideoMuted="StartVideoMuted",ph.SuppressBrowserKeys="SuppressBrowserKeys",ph.UseMic="UseMic",ph.KeyboardInput="KeyboardInput",ph.MouseInput="MouseInput",ph.TouchInput="TouchInput",ph.GamepadInput="GamepadInput",ph.XRControllerInput="XRControllerInput",ph.WaitForStreamer="WaitForStreamer";const mh=e=>Object.getOwnPropertyNames(ph).some((t=>ph[t]===e));class fh{}fh.AFKTimeoutSecs="AFKTimeout",fh.MinQP="MinQP",fh.MaxQP="MaxQP",fh.WebRTCFPS="WebRTCFPS",fh.WebRTCMinBitrate="WebRTCMinBitrate",fh.WebRTCMaxBitrate="WebRTCMaxBitrate",fh.MaxReconnectAttempts="MaxReconnectAttempts",fh.StreamerAutoJoinInterval="StreamerAutoJoinInterval";const vh=e=>Object.getOwnPropertyNames(fh).some((t=>fh[t]===e));class Sh{}Sh.SignallingServerUrl="ss";const yh=e=>Object.getOwnPropertyNames(Sh).some((t=>Sh[t]===e));class bh{}bh.PreferredCodec="PreferredCodec",bh.StreamerId="StreamerId";const Ch=e=>Object.getOwnPropertyNames(bh).some((t=>bh[t]===e));class wh{constructor(e={}){this.flags=new Map,this.numericParameters=new Map,this.textParameters=new Map,this.optionParameters=new Map;const{initialSettings:t,useUrlParams:n}=e;this._useUrlParams=!!n,this.populateDefaultSettings(this._useUrlParams),t&&this.setSettings(t)}get useUrlParams(){return this._useUrlParams}populateDefaultSettings(e){this.textParameters.set(Sh.SignallingServerUrl,new Ru(Sh.SignallingServerUrl,"Signalling url","Url of the signalling server",("https:"===location.protocol?"wss://":"ws://")+window.location.hostname+("80"===window.location.port||""===window.location.port?"":`:${window.location.port}`),e)),this.optionParameters.set(bh.StreamerId,new Lu(bh.StreamerId,"Streamer ID","The ID of the streamer to stream.","",[],e)),this.optionParameters.set(bh.PreferredCodec,new Lu(bh.PreferredCodec,"Preferred Codec","The preferred codec to be used during codec negotiation","H264 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f",function(){const e=[];if(!RTCRtpReceiver.getCapabilities)return e.push("Only available on Chrome"),e;const t=/(VP\d|H26\d|AV1).*/;return RTCRtpReceiver.getCapabilities("video").codecs.forEach((n=>{const s=n.mimeType.split("/")[1]+" "+(n.sdpFmtpLine||"");null!==t.exec(s)&&e.push(s)})),e}(),e)),this.flags.set(ph.AutoConnect,new xu(ph.AutoConnect,"Auto connect to stream","Whether we should attempt to auto connect to the signalling server or show a click to start prompt.",!1,e)),this.flags.set(ph.AutoPlayVideo,new xu(ph.AutoPlayVideo,"Auto play video","When video is ready automatically start playing it as opposed to showing a play button.",!0,e)),this.flags.set(ph.BrowserSendOffer,new xu(ph.BrowserSendOffer,"Browser send offer","Browser will initiate the WebRTC handshake by sending the offer to the streamer",!1,e)),this.flags.set(ph.UseMic,new xu(ph.UseMic,"Use microphone","Make browser request microphone access and open an input audio track.",!1,e)),this.flags.set(ph.StartVideoMuted,new xu(ph.StartVideoMuted,"Start video muted","Video will start muted if true.",!1,e)),this.flags.set(ph.SuppressBrowserKeys,new xu(ph.SuppressBrowserKeys,"Suppress browser keys","Suppress certain browser keys that we use in UE, for example F5 to show shader complexity instead of refresh the page.",!0,e)),this.flags.set(ph.IsQualityController,new xu(ph.IsQualityController,"Is quality controller?","True if this peer controls stream quality",!0,e)),this.flags.set(ph.ForceMonoAudio,new xu(ph.ForceMonoAudio,"Force mono audio","Force browser to request mono audio in the SDP",!1,e)),this.flags.set(ph.ForceTURN,new xu(ph.ForceTURN,"Force TURN","Only generate TURN/Relayed ICE candidates.",!1,e)),this.flags.set(ph.AFKDetection,new xu(ph.AFKDetection,"AFK if idle","Timeout the experience if user is AFK for a period.",!1,e)),this.flags.set(ph.MatchViewportResolution,new xu(ph.MatchViewportResolution,"Match viewport resolution","Pixel Streaming will be instructed to dynamically resize the video stream to match the size of the video element.",!1,e)),this.flags.set(ph.HoveringMouseMode,new xu(ph.HoveringMouseMode,"Control Scheme: Locked Mouse","Either locked mouse, where the pointer is consumed by the video and locked to it, or hovering mouse, where the mouse is not consumed.",!1,e,((e,t)=>{t.label=`Control Scheme: ${e?"Hovering":"Locked"} Mouse`}))),this.flags.set(ph.FakeMouseWithTouches,new xu(ph.FakeMouseWithTouches,"Fake mouse with touches","A single finger touch is converted into a mouse event. This allows a non-touch application to be controlled partially via a touch device.",!1,e)),this.flags.set(ph.KeyboardInput,new xu(ph.KeyboardInput,"Keyboard input","If enabled, send keyboard events to streamer",!0,e)),this.flags.set(ph.MouseInput,new xu(ph.MouseInput,"Mouse input","If enabled, send mouse events to streamer",!0,e)),this.flags.set(ph.TouchInput,new xu(ph.TouchInput,"Touch input","If enabled, send touch events to streamer",!0,e)),this.flags.set(ph.GamepadInput,new xu(ph.GamepadInput,"Gamepad input","If enabled, send gamepad events to streamer",!0,e)),this.flags.set(ph.XRControllerInput,new xu(ph.XRControllerInput,"XR controller input","If enabled, send XR controller events to streamer",!0,e)),this.flags.set(ph.WaitForStreamer,new xu(ph.WaitForStreamer,"等待拖缆","将继续尝试连接到第一个可用的流媒体.",!0,e)),this.numericParameters.set(fh.AFKTimeoutSecs,new Pu(fh.AFKTimeoutSecs,"AFK timeout","The time (in seconds) it takes for the application to time out if AFK timeout is enabled.",0,600,120,e)),this.numericParameters.set(fh.MaxReconnectAttempts,new Pu(fh.MaxReconnectAttempts,"Max Reconnects","Maximum number of reconnects the application will attempt when a streamer disconnects.",0,999,3,e)),this.numericParameters.set(fh.MinQP,new Pu(fh.MinQP,"Min QP","The lower bound for the quantization parameter (QP) of the encoder. 0 = Best quality, 51 = worst quality.",0,51,0,e)),this.numericParameters.set(fh.MaxQP,new Pu(fh.MaxQP,"Max QP","The upper bound for the quantization parameter (QP) of the encoder. 0 = Best quality, 51 = worst quality.",0,51,51,e)),this.numericParameters.set(fh.WebRTCFPS,new Pu(fh.WebRTCFPS,"Max FPS","The maximum FPS that WebRTC will try to transmit frames at.",1,999,60,e)),this.numericParameters.set(fh.WebRTCMinBitrate,new Pu(fh.WebRTCMinBitrate,"Min Bitrate (kbps)","The minimum bitrate that WebRTC should use.",0,5e5,0,e)),this.numericParameters.set(fh.WebRTCMaxBitrate,new Pu(fh.WebRTCMaxBitrate,"Max Bitrate (kbps)","The maximum bitrate that WebRTC should use.",0,5e5,0,e)),this.numericParameters.set(fh.StreamerAutoJoinInterval,new Pu(fh.StreamerAutoJoinInterval,"Streamer Auto Join Interval (ms)","Delay between retries when waiting for an available streamer.",500,9e5,3e3,e))}_addOnNumericSettingChangedListener(e,t){this.numericParameters.has(e)&&this.numericParameters.get(e).addOnChangedListener(t)}_addOnOptionSettingChangedListener(e,t){this.optionParameters.has(e)&&this.optionParameters.get(e).addOnChangedListener(t)}getNumericSettingValue(e){if(this.numericParameters.has(e))return this.numericParameters.get(e).number;throw new Error(`There is no numeric setting with the id of ${e}`)}getTextSettingValue(e){if(this.textParameters.has(e))return this.textParameters.get(e).value;throw new Error(`There is no numeric setting with the id of ${e}`)}setNumericSetting(e,t){if(!this.numericParameters.has(e))throw new Error(`There is no numeric setting with the id of ${e}`);this.numericParameters.get(e).number=t}_addOnSettingChangedListener(e,t){this.flags.has(e)&&(this.flags.get(e).onChange=t)}_addOnTextSettingChangedListener(e,t){this.textParameters.has(e)&&(this.textParameters.get(e).onChange=t)}getSettingOption(e){return this.optionParameters.get(e)}isFlagEnabled(e){return this.flags.get(e).flag}setFlagEnabled(e,t){this.flags.has(e)?this.flags.get(e).flag=t:iu.Warning(iu.GetStackTrace(),`Cannot toggle flag called ${e} - it does not exist in the Config.flags map.`)}setTextSetting(e,t){this.textParameters.has(e)?this.textParameters.get(e).text=t:iu.Warning(iu.GetStackTrace(),`Cannot set text setting called ${e} - it does not exist in the Config.textParameters map.`)}setOptionSettingOptions(e,t){this.optionParameters.has(e)?(console.log(t),this.optionParameters.get(e).options=t):iu.Warning(iu.GetStackTrace(),`Cannot set text setting called ${e} - it does not exist in the Config.optionParameters map.`)}setOptionSettingValue(e,t){this.optionParameters.has(e)?this.optionParameters.get(e).selected=t:iu.Warning(iu.GetStackTrace(),`Cannot set text setting called ${e} - it does not exist in the Config.enumParameters map.`)}setFlagLabel(e,t){this.flags.has(e)?this.flags.get(e).label=t:iu.Warning(iu.GetStackTrace(),`Cannot set label for flag called ${e} - it does not exist in the Config.flags map.`)}setSettings(e){for(const t of Object.keys(e))mh(t)?this.setFlagEnabled(t,e[t]):vh(t)?this.setNumericSetting(t,e[t]):yh(t)?this.setTextSetting(t,e[t]):Ch(t)&&this.setOptionSettingValue(t,e[t])}getSettings(){const e={};for(const[t,n]of this.flags.entries())e[t]=n.flag;for(const[t,n]of this.numericParameters.entries())e[t]=n.number;for(const[t,n]of this.textParameters.entries())e[t]=n.text;for(const[t,n]of this.optionParameters.entries())e[t]=n.selected;return e}getFlags(){return Array.from(this.flags.values())}getTextSettings(){return Array.from(this.textParameters.values())}getNumericSettings(){return Array.from(this.numericParameters.values())}getOptionSettings(){return Array.from(this.optionParameters.values())}_registerOnChangeEvents(e){for(const t of this.flags.keys()){const n=this.flags.get(t);n&&(n.onChangeEmit=t=>e.dispatchEvent(new lh({id:n.id,type:"flag",value:t,target:n})))}for(const t of this.numericParameters.keys()){const n=this.numericParameters.get(t);n&&(n.onChangeEmit=t=>e.dispatchEvent(new lh({id:n.id,type:"number",value:t,target:n})))}for(const t of this.textParameters.keys()){const n=this.textParameters.get(t);n&&(n.onChangeEmit=t=>e.dispatchEvent(new lh({id:n.id,type:"text",value:t,target:n})))}for(const t of this.optionParameters.keys()){const n=this.optionParameters.get(t);n&&(n.onChangeEmit=t=>e.dispatchEvent(new lh({id:n.id,type:"option",value:t,target:n})))}}}var Eh;!function(e){e[e.LockedMouse=0]="LockedMouse",e[e.HoveringMouse=1]="HoveringMouse"}(Eh||(Eh={}));class Th{constructor(e,t,n){this.closeTimeout=10,this.active=!1,this.countdownActive=!1,this.warnTimer=void 0,this.countDown=0,this.countDownTimer=void 0,this.config=e,this.pixelStreaming=t,this.onDismissAfk=n,this.onAFKTimedOutCallback=()=>{console.log("AFK timed out, did you want to override this callback?")}}onAfkClick(){clearInterval(this.countDownTimer),(this.active||this.countdownActive)&&(this.startAfkWarningTimer(),this.pixelStreaming.dispatchEvent(new Fu))}startAfkWarningTimer(){this.config.getNumericSettingValue(fh.AFKTimeoutSecs)>0&&this.config.isFlagEnabled(ph.AFKDetection)?this.active=!0:this.active=!1,this.resetAfkWarningTimer()}stopAfkWarningTimer(){this.active=!1,this.countdownActive=!1,clearTimeout(this.warnTimer),clearInterval(this.countDownTimer)}pauseAfkWarningTimer(){this.active=!1}resetAfkWarningTimer(){this.active&&this.config.isFlagEnabled(ph.AFKDetection)&&(clearTimeout(this.warnTimer),this.warnTimer=setTimeout((()=>this.activateAfkEvent()),1e3*this.config.getNumericSettingValue(fh.AFKTimeoutSecs)))}activateAfkEvent(){this.pauseAfkWarningTimer(),this.pixelStreaming.dispatchEvent(new Au({countDown:this.countDown,dismissAfk:this.onDismissAfk})),this.countDown=this.closeTimeout,this.countdownActive=!0,this.pixelStreaming.dispatchEvent(new Ou({countDown:this.countDown})),this.config.isFlagEnabled(ph.HoveringMouseMode)||document.exitPointerLock&&document.exitPointerLock(),this.countDownTimer=setInterval((()=>{this.countDown--,0==this.countDown?(this.pixelStreaming.dispatchEvent(new Iu),this.onAFKTimedOutCallback(),iu.Log(iu.GetStackTrace(),"You have been disconnected due to inactivity"),this.stopAfkWarningTimer()):this.pixelStreaming.dispatchEvent(new Ou({countDown:this.countDown}))}),1e3)}}class Mh{constructor(){this.isReceivingFreezeFrame=!1}getDataChannelInstance(){return this}createDataChannel(e,t,n){this.peerConnection=e,this.label=t,this.datachannelOptions=n,null==n&&(this.datachannelOptions={},this.datachannelOptions.ordered=!0),this.dataChannel=this.peerConnection.createDataChannel(this.label,this.datachannelOptions),this.setupDataChannel()}setupDataChannel(){this.dataChannel.binaryType="arraybuffer",this.dataChannel.onopen=e=>this.handleOnOpen(e),this.dataChannel.onclose=e=>this.handleOnClose(e),this.dataChannel.onmessage=e=>this.handleOnMessage(e),this.dataChannel.onerror=e=>this.handleOnError(e)}handleOnOpen(e){var t;iu.Log(iu.GetStackTrace(),`Data Channel (${this.label}) opened.`,7),this.onOpen(null===(t=this.dataChannel)||void 0===t?void 0:t.label,e)}handleOnClose(e){var t;iu.Log(iu.GetStackTrace(),`Data Channel (${this.label}) closed.`,7),this.onClose(null===(t=this.dataChannel)||void 0===t?void 0:t.label,e)}handleOnMessage(e){iu.Log(iu.GetStackTrace(),`Data Channel (${this.label}) message: ${e}`,8)}handleOnError(e){var t;iu.Log(iu.GetStackTrace(),`Data Channel (${this.label}) error: ${e}`,7),this.onError(null===(t=this.dataChannel)||void 0===t?void 0:t.label,e)}onOpen(e,t){}onClose(e,t){}onError(e,t){}}class _h{}class kh{}class xh{}class Ph{}class Rh{}class Lh{}class Ah{}class Oh{}class Fh{constructor(){this.inboundVideoStats=new kh,this.inboundAudioStats=new _h,this.candidatePair=new Rh,this.DataChannelStats=new xh,this.outBoundVideoStats=new Lh,this.sessionStats=new Ah,this.streamStats=new Oh,this.codecs=new Map}processStats(e){this.localCandidates=new Array,this.remoteCandidates=new Array,e.forEach((e=>{switch(e.type){case"candidate-pair":this.handleCandidatePair(e);break;case"certificate":case"media-source":case"media-playout":case"outbound-rtp":case"peer-connection":case"remote-inbound-rtp":case"transport":break;case"codec":this.handleCodec(e);break;case"data-channel":this.handleDataChannel(e);break;case"inbound-rtp":this.handleInBoundRTP(e);break;case"local-candidate":this.handleLocalCandidate(e);break;case"remote-candidate":this.handleRemoteCandidate(e);break;case"remote-outbound-rtp":this.handleRemoteOutBound(e);break;case"track":this.handleTrack(e);break;case"stream":this.handleStream(e);break;default:iu.Error(iu.GetStackTrace(),"unhandled Stat Type"),iu.Log(iu.GetStackTrace(),e)}}))}handleStream(e){this.streamStats=e}handleCandidatePair(e){this.candidatePair.bytesReceived=e.bytesReceived,this.candidatePair.bytesSent=e.bytesSent,this.candidatePair.localCandidateId=e.localCandidateId,this.candidatePair.remoteCandidateId=e.remoteCandidateId,this.candidatePair.nominated=e.nominated,this.candidatePair.readable=e.readable,this.candidatePair.selected=e.selected,this.candidatePair.writable=e.writable,this.candidatePair.state=e.state,this.candidatePair.currentRoundTripTime=e.currentRoundTripTime}handleDataChannel(e){this.DataChannelStats.bytesReceived=e.bytesReceived,this.DataChannelStats.bytesSent=e.bytesSent,this.DataChannelStats.dataChannelIdentifier=e.dataChannelIdentifier,this.DataChannelStats.id=e.id,this.DataChannelStats.label=e.label,this.DataChannelStats.messagesReceived=e.messagesReceived,this.DataChannelStats.messagesSent=e.messagesSent,this.DataChannelStats.protocol=e.protocol,this.DataChannelStats.state=e.state,this.DataChannelStats.timestamp=e.timestamp}handleLocalCandidate(e){const t=new Ph;t.label="local-candidate",t.address=e.address,t.port=e.port,t.protocol=e.protocol,t.candidateType=e.candidateType,t.id=e.id,this.localCandidates.push(t)}handleRemoteCandidate(e){const t=new Ph;t.label="local-candidate",t.address=e.address,t.port=e.port,t.protocol=e.protocol,t.id=e.id,t.candidateType=e.candidateType,this.remoteCandidates.push(t)}handleInBoundRTP(e){switch(e.kind){case"video":this.inboundVideoStats=e,null!=this.lastVideoStats&&(this.inboundVideoStats.bitrate=8*(this.inboundVideoStats.bytesReceived-this.lastVideoStats.bytesReceived)/(this.inboundVideoStats.timestamp-this.lastVideoStats.timestamp),this.inboundVideoStats.bitrate=Math.floor(this.inboundVideoStats.bitrate)),this.lastVideoStats=Object.assign({},this.inboundVideoStats);break;case"audio":this.inboundAudioStats=e,null!=this.lastAudioStats&&(this.inboundAudioStats.bitrate=8*(this.inboundAudioStats.bytesReceived-this.lastAudioStats.bytesReceived)/(this.inboundAudioStats.timestamp-this.lastAudioStats.timestamp),this.inboundAudioStats.bitrate=Math.floor(this.inboundAudioStats.bitrate)),this.lastAudioStats=Object.assign({},this.inboundAudioStats);break;default:iu.Log(iu.GetStackTrace(),"Kind is not handled")}}handleRemoteOutBound(e){"video"===e.kind&&(this.outBoundVideoStats.bytesSent=e.bytesSent,this.outBoundVideoStats.id=e.id,this.outBoundVideoStats.localId=e.localId,this.outBoundVideoStats.packetsSent=e.packetsSent,this.outBoundVideoStats.remoteTimestamp=e.remoteTimestamp,this.outBoundVideoStats.timestamp=e.timestamp)}handleTrack(e){"track"!==e.type||"video_label"!==e.trackIdentifier&&"video"!==e.kind||(this.inboundVideoStats.framesDropped=e.framesDropped,this.inboundVideoStats.framesReceived=e.framesReceived,this.inboundVideoStats.frameHeight=e.frameHeight,this.inboundVideoStats.frameWidth=e.frameWidth)}handleCodec(e){const t=e.id,n=`${e.mimeType.replace("video/","").replace("audio/","")}${e.sdpFmtpLine?` ${e.sdpFmtpLine}`:""}`;this.codecs.set(t,n)}handleSessionStatistics(e,t,n){const s=Date.now()-e;this.sessionStats.runTime=new Date(s).toISOString().substr(11,8).toString();const r=null===t?"Not sent yet":t?"true":"false";this.sessionStats.controlsStreamInput=r,this.sessionStats.videoEncoderAvgQP=n}isNumber(e){return"number"==typeof e&&isFinite(e)}}var Ih=s(366);class Dh{static isVideoTransciever(e){return this.canTransceiverReceiveVideo(e)||this.canTransceiverSendVideo(e)}static canTransceiverReceiveVideo(e){return!!e&&("sendrecv"===e.direction||"recvonly"===e.direction)&&e.receiver&&e.receiver.track&&"video"===e.receiver.track.kind}static canTransceiverSendVideo(e){return!!e&&("sendrecv"===e.direction||"sendonly"===e.direction)&&e.sender&&e.sender.track&&"video"===e.sender.track.kind}static isAudioTransciever(e){return this.canTransceiverReceiveAudio(e)||this.canTransceiverSendAudio(e)}static canTransceiverReceiveAudio(e){return!!e&&("sendrecv"===e.direction||"recvonly"===e.direction)&&e.receiver&&e.receiver.track&&"audio"===e.receiver.track.kind}static canTransceiverSendAudio(e){return!!e&&("sendrecv"===e.direction||"sendonly"===e.direction)&&e.sender&&e.sender.track&&"audio"===e.sender.track.kind}}var Bh,zh,Uh=function(e,t,n,s){return new(n||(n=Promise))((function(r,o){function i(e){try{l(s.next(e))}catch(e){o(e)}}function a(e){try{l(s.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,a)}l((s=s.apply(e,t||[])).next())}))};class Vh{constructor(e,t,n){this.config=t,this.createPeerConnection(e,n)}createPeerConnection(e,t){this.config.isFlagEnabled(ph.ForceTURN)&&(e.iceTransportPolicy="relay",iu.Log(iu.GetStackTrace(),"Forcing TURN usage by setting ICE Transport Policy in peer connection config.")),this.peerConnection=new RTCPeerConnection(e),this.peerConnection.onsignalingstatechange=e=>this.handleSignalStateChange(e),this.peerConnection.oniceconnectionstatechange=e=>this.handleIceConnectionStateChange(e),this.peerConnection.onicegatheringstatechange=e=>this.handleIceGatheringStateChange(e),this.peerConnection.ontrack=e=>this.handleOnTrack(e),this.peerConnection.onicecandidate=e=>this.handleIceCandidate(e),this.peerConnection.ondatachannel=e=>this.handleDataChannel(e),this.aggregatedStats=new Fh,this.preferredCodec=t,this.updateCodecSelection=!0}createOffer(e,t){return Uh(this,void 0,void 0,(function*(){iu.Log(iu.GetStackTrace(),"Create Offer",6);const n="localhost"===location.hostname||"127.0.0.1"===location.hostname,s="https:"===location.protocol;let r=t.isFlagEnabled(ph.UseMic);!r||n||s||(r=!1,iu.Error(iu.GetStackTrace(),"Microphone access in the browser will not work if you are not on HTTPS or localhost. Disabling mic access."),iu.Error(iu.GetStackTrace(),"For testing you can enable HTTP microphone access Chrome by visiting chrome://flags/ and enabling 'unsafely-treat-insecure-origin-as-secure'")),this.setupTransceiversAsync(r).finally((()=>{var t;null===(t=this.peerConnection)||void 0===t||t.createOffer(e).then((e=>{var t;this.showTextOverlayConnecting(),e.sdp=this.mungeSDP(e.sdp,r),null===(t=this.peerConnection)||void 0===t||t.setLocalDescription(e),this.onSendWebRTCOffer(e)})).catch((()=>{this.showTextOverlaySetupFailure()}))}))}))}receiveOffer(e,t){var n;return Uh(this,void 0,void 0,(function*(){iu.Log(iu.GetStackTrace(),"Receive Offer",6),null===(n=this.peerConnection)||void 0===n||n.setRemoteDescription(e).then((()=>{const e="localhost"===location.hostname||"127.0.0.1"===location.hostname,n="https:"===location.protocol;let s=t.isFlagEnabled(ph.UseMic);!s||e||n||(s=!1,iu.Error(iu.GetStackTrace(),"Microphone access in the browser will not work if you are not on HTTPS or localhost. Disabling mic access."),iu.Error(iu.GetStackTrace(),"For testing you can enable HTTP microphone access Chrome by visiting chrome://flags/ and enabling 'unsafely-treat-insecure-origin-as-secure'")),this.setupTransceiversAsync(s).finally((()=>{var e;null===(e=this.peerConnection)||void 0===e||e.createAnswer().then((e=>{var t;return e.sdp=this.mungeSDP(e.sdp,s),null===(t=this.peerConnection)||void 0===t?void 0:t.setLocalDescription(e)})).then((()=>{var e;this.onSendWebRTCAnswer(null===(e=this.peerConnection)||void 0===e?void 0:e.currentLocalDescription)})).catch((()=>{iu.Error(iu.GetStackTrace(),"createAnswer() failed")}))}))})),this.config.setOptionSettingOptions(bh.PreferredCodec,this.parseAvailableCodecs(e).filter((e=>this.config.getSettingOption(bh.PreferredCodec).options.includes(e))))}))}receiveAnswer(e){var t;null===(t=this.peerConnection)||void 0===t||t.setRemoteDescription(e),this.config.setOptionSettingOptions(bh.PreferredCodec,this.parseAvailableCodecs(e).filter((e=>this.config.getSettingOption(bh.PreferredCodec).options.includes(e))))}generateStats(){var e;null===(e=this.peerConnection)||void 0===e||e.getStats(null).then((e=>{this.aggregatedStats.processStats(e),this.onVideoStats(this.aggregatedStats),this.updateCodecSelection&&this.config.setOptionSettingValue(bh.PreferredCodec,this.aggregatedStats.codecs.get(this.aggregatedStats.inboundVideoStats.codecId))}))}close(){this.peerConnection&&(this.peerConnection.close(),this.peerConnection=null)}mungeSDP(e,t){let n=e.replace(/(a=fmtp:\d+ .*level-asymmetry-allowed=.*)\r\n/gm,"$1;x-google-start-bitrate=10000;x-google-max-bitrate=100000\r\n"),s="maxaveragebitrate=510000;";return t&&(s+="sprop-maxcapturerate=48000;"),s+=this.config.isFlagEnabled(ph.ForceMonoAudio)?"stereo=0;":"stereo=1;",s+="useinbandfec=1",n=n.replace("useinbandfec=1",s),n}handleOnIce(e){var t;iu.Log(iu.GetStackTrace(),"peerconnection handleOnIce",6),this.config.isFlagEnabled(ph.ForceTURN)&&e.candidate.indexOf("relay")<0?iu.Info(iu.GetStackTrace(),`Dropping candidate because it was not TURN relay. | Type= ${e.type} | Protocol= ${e.protocol} | Address=${e.address} | Port=${e.port} |`,6):null===(t=this.peerConnection)||void 0===t||t.addIceCandidate(e)}handleSignalStateChange(e){iu.Log(iu.GetStackTrace(),"signaling state change: "+e,6)}handleIceConnectionStateChange(e){iu.Log(iu.GetStackTrace(),"ice connection state change: "+e,6),this.onIceConnectionStateChange(e)}handleIceGatheringStateChange(e){iu.Log(iu.GetStackTrace(),"ice gathering state change: "+JSON.stringify(e),6)}handleOnTrack(e){this.onTrack(e)}handleIceCandidate(e){this.onPeerIceCandidate(e)}handleDataChannel(e){this.onDataChannel(e)}onTrack(e){}onIceConnectionStateChange(e){}onPeerIceCandidate(e){}onDataChannel(e){}setupTransceiversAsync(e){var t,n,s,r,o,i,a,l,c;return Uh(this,void 0,void 0,(function*(){const d=(null===(t=this.peerConnection)||void 0===t?void 0:t.getTransceivers().length)>0;if(null===(n=this.peerConnection)||void 0===n||n.addTransceiver("video",{direction:"recvonly"}),RTCRtpReceiver.getCapabilities&&""!=this.preferredCodec)for(const e of null!==(r=null===(s=this.peerConnection)||void 0===s?void 0:s.getTransceivers())&&void 0!==r?r:[])if(e&&e.receiver&&e.receiver.track&&"video"===e.receiver.track.kind&&e.setCodecPreferences){const t=this.preferredCodec.split(" "),n=[{mimeType:"video/"+t[0],clockRate:9e4,sdpFmtpLine:t[1]?t[1]:""}];this.config.getSettingOption(bh.PreferredCodec).options.filter((e=>e!=this.preferredCodec)).forEach((e=>{const t=e.split(" ");n.push({mimeType:"video/"+t[0],clockRate:9e4,sdpFmtpLine:t[1]?t[1]:""})}));for(const e of n)""===e.sdpFmtpLine&&delete e.sdpFmtpLine;e.setCodecPreferences(n)}if(e){const e={video:!1,audio:{autoGainControl:!1,channelCount:1,echoCancellation:!1,latency:0,noiseSuppression:!1,sampleRate:48e3,sampleSize:16,volume:1}},t=yield navigator.mediaDevices.getUserMedia(e);if(t)if(d){for(const e of null!==(a=null===(i=this.peerConnection)||void 0===i?void 0:i.getTransceivers())&&void 0!==a?a:[])if(Dh.canTransceiverReceiveAudio(e))for(const n of t.getTracks())n.kind&&"audio"==n.kind&&(e.sender.replaceTrack(n),e.direction="sendrecv")}else for(const e of t.getTracks())e.kind&&"audio"==e.kind&&(null===(l=this.peerConnection)||void 0===l||l.addTransceiver(e,{direction:"sendrecv"}));else null===(c=this.peerConnection)||void 0===c||c.addTransceiver("audio",{direction:"recvonly"})}else null===(o=this.peerConnection)||void 0===o||o.addTransceiver("audio",{direction:"recvonly"})}))}onVideoStats(e){}onSendWebRTCOffer(e){}onSendWebRTCAnswer(e){}showTextOverlayConnecting(){}showTextOverlaySetupFailure(){}parseAvailableCodecs(e){if(!RTCRtpReceiver.getCapabilities)return["Only available on Chrome"];const t=[],n=(0,Ih.splitSections)(e.sdp);return n.shift(),n.forEach((e=>{const{codecs:n}=(0,Ih.parseRtpParameters)(e),s=/(VP\d|H26\d|AV1).*/;n.forEach((e=>{const n=e.name+" "+Object.keys(e.parameters||{}).map((t=>t+"="+e.parameters[t])).join(";");if(null!==s.exec(n)){"VP9"==e.name&&(e.parameters={"profile-id":"0"});const n=e.name+" "+Object.keys(e.parameters||{}).map((t=>t+"="+e.parameters[t])).join(";");t.push(n)}}))})),t}}class Nh{constructor(){this.PixelStreamingSettings=new Hh,this.EncoderSettings=new Gh,this.WebRTCSettings=new $h}ueCompatible(){null!=this.WebRTCSettings.MaxFPS&&(this.WebRTCSettings.FPS=this.WebRTCSettings.MaxFPS)}}class Hh{}class Gh{}class $h{}class Wh{constructor(){this.ReceiptTimeMs=null,this.TransmissionTimeMs=null,this.PreCaptureTimeMs=null,this.PostCaptureTimeMs=null,this.PreEncodeTimeMs=null,this.PostEncodeTimeMs=null,this.EncodeMs=null,this.CaptureToSendMs=null,this.testStartTimeMs=0,this.browserReceiptTimeMs=0,this.latencyExcludingDecode=0,this.testDuration=0,this.networkLatency=0,this.browserSendLatency=0,this.frameDisplayDeltaTimeMs=0,this.endToEndLatency=0,this.encodeLatency=0}setFrameDisplayDeltaTime(e){0==this.frameDisplayDeltaTimeMs&&(this.frameDisplayDeltaTimeMs=Math.round(e))}processFields(){null!=this.EncodeMs||null==this.PreEncodeTimeMs&&null==this.PostEncodeTimeMs||(iu.Log(iu.GetStackTrace(),`Setting Encode Ms \n ${this.PostEncodeTimeMs} \n ${this.PreEncodeTimeMs}`,6),this.EncodeMs=this.PostEncodeTimeMs-this.PreEncodeTimeMs),null!=this.CaptureToSendMs||null==this.PreCaptureTimeMs&&null==this.PostCaptureTimeMs||(iu.Log(iu.GetStackTrace(),`Setting CaptureToSendMs Ms \n ${this.PostCaptureTimeMs} \n ${this.PreCaptureTimeMs}`,6),this.CaptureToSendMs=this.PostCaptureTimeMs-this.PreCaptureTimeMs)}}class jh{static setExtensionFromBytes(e,t){t.receiving||(t.mimetype="",t.extension="",t.receiving=!0,t.valid=!1,t.size=0,t.data=[],t.timestampStart=(new Date).getTime(),iu.Log(iu.GetStackTrace(),"Received first chunk of file",6));const n=new TextDecoder("utf-16").decode(e.slice(1));iu.Log(iu.GetStackTrace(),n,6),t.extension=n}static setMimeTypeFromBytes(e,t){t.receiving||(t.mimetype="",t.extension="",t.receiving=!0,t.valid=!1,t.size=0,t.data=[],t.timestampStart=(new Date).getTime(),iu.Log(iu.GetStackTrace(),"Received first chunk of file",6));const n=new TextDecoder("utf-16").decode(e.slice(1));iu.Log(iu.GetStackTrace(),n,6),t.mimetype=n}static setContentsFromBytes(e,t){if(!t.receiving)return;t.size=Math.ceil(new DataView(e.slice(1,5).buffer).getInt32(0,!0)/16379);const n=e.slice(5);if(t.data.push(n),iu.Log(iu.GetStackTrace(),`Received file chunk: ${t.data.length}/${t.size}`,6),t.data.length===t.size){t.receiving=!1,t.valid=!0,iu.Log(iu.GetStackTrace(),"Received complete file",6);const e=(new Date).getTime()-t.timestampStart,n=Math.round(16*t.size*1024/e);iu.Log(iu.GetStackTrace(),`Average transfer bitrate: ${n}kb/s over ${e/1e3} seconds`,6);const s=new Blob(t.data,{type:t.mimetype}),r=document.createElement("a");r.setAttribute("href",URL.createObjectURL(s)),r.setAttribute("download",`transfer.${t.extension}`),document.body.append(r),r.remove()}else t.data.length>t.size&&(t.receiving=!1,iu.Error(iu.GetStackTrace(),`Received bigger file than advertised: ${t.data.length}/${t.size}`))}}class Kh{constructor(){this.mimetype="",this.extension="",this.receiving=!1,this.size=0,this.data=[],this.valid=!1}}class qh{}qh.mainButton=0,qh.auxiliaryButton=1,qh.secondaryButton=2,qh.fourthButton=3,qh.fifthButton=4;class Qh{}Qh.primaryButton=1,Qh.secondaryButton=2,Qh.auxiliaryButton=4,Qh.fourthButton=8,Qh.fifthButton=16;class Xh{constructor(){this.unregisterCallbacks=[]}addUnregisterCallback(e){this.unregisterCallbacks.push(e)}unregisterAll(){for(const e of this.unregisterCallbacks)e();this.unregisterCallbacks=[]}}class Jh{constructor(e,t,n){this.touchEventListenerTracker=new Xh,this.toStreamerMessagesProvider=e,this.videoElementProvider=t,this.coordinateConverter=n;const s=e=>this.onTouchStart(e),r=e=>this.onTouchEnd(e),o=e=>this.onTouchMove(e);document.addEventListener("touchstart",s,{passive:!1}),document.addEventListener("touchend",r,{passive:!1}),document.addEventListener("touchmove",o,{passive:!1}),this.touchEventListenerTracker.addUnregisterCallback((()=>document.removeEventListener("touchstart",s))),this.touchEventListenerTracker.addUnregisterCallback((()=>document.removeEventListener("touchend",r))),this.touchEventListenerTracker.addUnregisterCallback((()=>document.removeEventListener("touchmove",o)))}unregisterTouchEvents(){this.touchEventListenerTracker.unregisterAll()}setVideoElementParentClientRect(e){this.videoElementParentClientRect=e}onTouchStart(e){if(this.videoElementProvider.isVideoReady()){if(null==this.fakeTouchFinger){const t=e.changedTouches[0];this.fakeTouchFinger=new Yh(t.identifier,t.clientX-this.videoElementParentClientRect.left,t.clientY-this.videoElementParentClientRect.top);const n=this.videoElementProvider.getVideoParentElement(),s=new MouseEvent("mouseenter",t);n.dispatchEvent(s);const r=this.coordinateConverter.normalizeAndQuantizeUnsigned(this.fakeTouchFinger.x,this.fakeTouchFinger.y);this.toStreamerMessagesProvider.toStreamerHandlers.get("MouseDown")([qh.mainButton,r.x,r.y])}e.preventDefault()}}onTouchEnd(e){if(!this.videoElementProvider.isVideoReady())return;const t=this.videoElementProvider.getVideoParentElement(),n=this.toStreamerMessagesProvider.toStreamerHandlers;for(let s=0;s<e.changedTouches.length;s++){const r=e.changedTouches[s];if(r.identifier===this.fakeTouchFinger.id){const e=r.clientX-this.videoElementParentClientRect.left,s=r.clientY-this.videoElementParentClientRect.top,o=this.coordinateConverter.normalizeAndQuantizeUnsigned(e,s);n.get("MouseUp")([qh.mainButton,o.x,o.y]);const i=new MouseEvent("mouseleave",r);t.dispatchEvent(i),this.fakeTouchFinger=null;break}}e.preventDefault()}onTouchMove(e){if(!this.videoElementProvider.isVideoReady())return;const t=this.toStreamerMessagesProvider.toStreamerHandlers;for(let n=0;n<e.touches.length;n++){const s=e.touches[n];if(s.identifier===this.fakeTouchFinger.id){const e=s.clientX-this.videoElementParentClientRect.left,n=s.clientY-this.videoElementParentClientRect.top,r=this.coordinateConverter.normalizeAndQuantizeUnsigned(e,n),o=this.coordinateConverter.normalizeAndQuantizeSigned(e-this.fakeTouchFinger.x,n-this.fakeTouchFinger.y);t.get("MouseMove")([r.x,r.y,o.x,o.y]),this.fakeTouchFinger.x=e,this.fakeTouchFinger.y=n;break}}e.preventDefault()}}class Yh{constructor(e,t,n){this.id=e,this.x=t,this.y=n}}class Zh{}Zh.backSpace=8,Zh.shift=16,Zh.control=17,Zh.alt=18,Zh.rightShift=253,Zh.rightControl=254,Zh.rightAlt=255;class eg{constructor(e,t,n){this.keyboardEventListenerTracker=new Xh,this.CodeToKeyCode={Escape:27,Digit0:48,Digit1:49,Digit2:50,Digit3:51,Digit4:52,Digit5:53,Digit6:54,Digit7:55,Digit8:56,Digit9:57,Minus:173,Equal:187,Backspace:8,Tab:9,KeyQ:81,KeyW:87,KeyE:69,KeyR:82,KeyT:84,KeyY:89,KeyU:85,KeyI:73,KeyO:79,KeyP:80,BracketLeft:219,BracketRight:221,Enter:13,ControlLeft:17,KeyA:65,KeyS:83,KeyD:68,KeyF:70,KeyG:71,KeyH:72,KeyJ:74,KeyK:75,KeyL:76,Semicolon:186,Quote:222,Backquote:192,ShiftLeft:16,Backslash:220,KeyZ:90,KeyX:88,KeyC:67,KeyV:86,KeyB:66,KeyN:78,KeyM:77,Comma:188,Period:190,Slash:191,ShiftRight:253,AltLeft:18,Space:32,CapsLock:20,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,Pause:19,ScrollLock:145,NumpadDivide:111,NumpadMultiply:106,NumpadSubtract:109,NumpadAdd:107,NumpadDecimal:110,Numpad9:105,Numpad8:104,Numpad7:103,Numpad6:102,Numpad5:101,Numpad4:100,Numpad3:99,Numpad2:98,Numpad1:97,Numpad0:96,NumLock:144,ControlRight:254,AltRight:255,Home:36,End:35,ArrowUp:38,ArrowLeft:37,ArrowRight:39,ArrowDown:40,PageUp:33,PageDown:34,Insert:45,Delete:46,ContextMenu:93},this.toStreamerMessagesProvider=e,this.config=t,this.activeKeysProvider=n}registerKeyBoardEvents(){const e=e=>this.handleOnKeyDown(e),t=e=>this.handleOnKeyUp(e),n=e=>this.handleOnKeyPress(e);document.addEventListener("keydown",e),document.addEventListener("keyup",t),document.addEventListener("keypress",n),this.keyboardEventListenerTracker.addUnregisterCallback((()=>document.removeEventListener("keydown",e))),this.keyboardEventListenerTracker.addUnregisterCallback((()=>document.removeEventListener("keyup",t))),this.keyboardEventListenerTracker.addUnregisterCallback((()=>document.removeEventListener("keypress",n)))}unregisterKeyBoardEvents(){this.keyboardEventListenerTracker.unregisterAll()}handleOnKeyDown(e){const t=this.getKeycode(e);t&&(iu.Log(iu.GetStackTrace(),`key down ${t}, repeat = ${e.repeat}`,6),this.toStreamerMessagesProvider.toStreamerHandlers.get("KeyDown")([this.getKeycode(e),e.repeat?1:0]),this.activeKeysProvider.getActiveKeys().push(t),t===Zh.backSpace&&document.dispatchEvent(new KeyboardEvent("keypress",{charCode:Zh.backSpace})),this.config.isFlagEnabled(ph.SuppressBrowserKeys)&&this.isKeyCodeBrowserKey(t)&&e.preventDefault())}handleOnKeyUp(e){const t=this.getKeycode(e);t&&(iu.Log(iu.GetStackTrace(),`key up ${t}`,6),this.toStreamerMessagesProvider.toStreamerHandlers.get("KeyUp")([t]),this.config.isFlagEnabled(ph.SuppressBrowserKeys)&&this.isKeyCodeBrowserKey(t)&&e.preventDefault())}handleOnKeyPress(e){if(!("charCode"in e))return void iu.Warning(iu.GetStackTrace(),"KeyboardEvent.charCode is deprecated in this browser, cannot send key press.");const t=e.charCode;iu.Log(iu.GetStackTrace(),`key press ${t}`,6),this.toStreamerMessagesProvider.toStreamerHandlers.get("KeyPress")([t])}getKeycode(e){if(!("keyCode"in e)){const t=e;return t.code in this.CodeToKeyCode?this.CodeToKeyCode[t.code]:(iu.Warning(iu.GetStackTrace(),`Keyboard code of ${t.code} is not supported in our mapping, ignoring this key.`),null)}return e.keyCode===Zh.shift&&"ShiftRight"===e.code?Zh.rightShift:e.keyCode===Zh.control&&"ControlRight"===e.code?Zh.rightControl:e.keyCode===Zh.alt&&"AltRight"===e.code?Zh.rightAlt:e.keyCode}isKeyCodeBrowserKey(e){return e>=112&&e<=123||9===e}}class tg{constructor(e,t,n){this.x=0,this.y=0,this.updateMouseMovePositionEvent=e=>{this.updateMouseMovePosition(e)},this.mouseEventListenerTracker=new Xh,this.videoElementProvider=e,this.mouseController=t,this.activeKeysProvider=n;const s=this.videoElementProvider.getVideoParentElement();this.x=s.getBoundingClientRect().width/2,this.y=s.getBoundingClientRect().height/2,this.coord=this.mouseController.coordinateConverter.normalizeAndQuantizeUnsigned(this.x,this.y)}unregisterMouseEvents(){this.mouseEventListenerTracker.unregisterAll()}lockStateChange(){const e=this.videoElementProvider.getVideoParentElement(),t=this.mouseController.toStreamerMessagesProvider.toStreamerHandlers;if(document.pointerLockElement===e||document.mozPointerLockElement===e)iu.Log(iu.GetStackTrace(),"Pointer locked",6),document.addEventListener("mousemove",this.updateMouseMovePositionEvent,!1),this.mouseEventListenerTracker.addUnregisterCallback((()=>document.removeEventListener("mousemove",this.updateMouseMovePositionEvent,!1)));else{iu.Log(iu.GetStackTrace(),"The pointer lock status is now unlocked",6),document.removeEventListener("mousemove",this.updateMouseMovePositionEvent,!1);let e=this.activeKeysProvider.getActiveKeys();const n=new Set(e),s=[];n.forEach((e=>{s[e]})),s.forEach((e=>{t.get("KeyUp")([e])})),e=[]}}updateMouseMovePosition(e){if(!this.videoElementProvider.isVideoReady())return;const t=this.mouseController.toStreamerMessagesProvider.toStreamerHandlers,n=this.videoElementProvider.getVideoParentElement().clientWidth,s=this.videoElementProvider.getVideoParentElement().clientHeight;this.x+=e.movementX,this.y+=e.movementY,this.x>n&&(this.x-=n),this.y>s&&(this.y-=s),this.x<0&&(this.x=n+this.x),this.y<0&&(this.y=s-this.y),this.coord=this.mouseController.coordinateConverter.normalizeAndQuantizeUnsigned(this.x,this.y);const r=this.mouseController.coordinateConverter.normalizeAndQuantizeSigned(e.movementX,e.movementY);t.get("MouseMove")([this.coord.x,this.coord.y,r.x,r.y])}handleMouseDown(e){this.videoElementProvider.isVideoReady()&&this.mouseController.toStreamerMessagesProvider.toStreamerHandlers.get("MouseDown")([e.button,this.coord.x,this.coord.y])}handleMouseUp(e){this.videoElementProvider.isVideoReady()&&this.mouseController.toStreamerMessagesProvider.toStreamerHandlers.get("MouseUp")([e.button,this.coord.x,this.coord.y])}handleMouseWheel(e){this.videoElementProvider.isVideoReady()&&this.mouseController.toStreamerMessagesProvider.toStreamerHandlers.get("MouseWheel")([e.wheelDelta,this.coord.x,this.coord.y])}handleMouseDouble(e){this.videoElementProvider.isVideoReady()&&this.mouseController.toStreamerMessagesProvider.toStreamerHandlers.get("MouseDouble")([e.button,this.coord.x,this.coord.y])}handlePressMouseButtons(e){this.videoElementProvider.isVideoReady()&&this.mouseController.pressMouseButtons(e.buttons,this.x,this.y)}handleReleaseMouseButtons(e){this.videoElementProvider.isVideoReady()&&this.mouseController.releaseMouseButtons(e.buttons,this.x,this.y)}}class ng{constructor(e){this.mouseController=e}unregisterMouseEvents(){}updateMouseMovePosition(e){if(!this.mouseController.videoElementProvider.isVideoReady())return;iu.Log(iu.GetStackTrace(),"MouseMove",6);const t=this.mouseController.coordinateConverter.normalizeAndQuantizeUnsigned(e.offsetX,e.offsetY),n=this.mouseController.coordinateConverter.normalizeAndQuantizeSigned(e.movementX,e.movementY);this.mouseController.toStreamerMessagesProvider.toStreamerHandlers.get("MouseMove")([t.x,t.y,n.x,n.y]),e.preventDefault()}handleMouseDown(e){if(!this.mouseController.videoElementProvider.isVideoReady())return;iu.Log(iu.GetStackTrace(),"onMouse Down",6);const t=this.mouseController.coordinateConverter.normalizeAndQuantizeUnsigned(e.offsetX,e.offsetY);this.mouseController.toStreamerMessagesProvider.toStreamerHandlers.get("MouseDown")([e.button,t.x,t.y]),e.preventDefault()}handleMouseUp(e){if(!this.mouseController.videoElementProvider.isVideoReady())return;iu.Log(iu.GetStackTrace(),"onMouse Up",6);const t=this.mouseController.coordinateConverter.normalizeAndQuantizeUnsigned(e.offsetX,e.offsetY);this.mouseController.toStreamerMessagesProvider.toStreamerHandlers.get("MouseUp")([e.button,t.x,t.y]),e.preventDefault()}handleContextMenu(e){this.mouseController.videoElementProvider.isVideoReady()&&e.preventDefault()}handleMouseWheel(e){if(!this.mouseController.videoElementProvider.isVideoReady())return;const t=this.mouseController.coordinateConverter.normalizeAndQuantizeUnsigned(e.offsetX,e.offsetY);this.mouseController.toStreamerMessagesProvider.toStreamerHandlers.get("MouseWheel")([e.wheelDelta,t.x,t.y]),e.preventDefault()}handleMouseDouble(e){if(!this.mouseController.videoElementProvider.isVideoReady())return;const t=this.mouseController.coordinateConverter.normalizeAndQuantizeUnsigned(e.offsetX,e.offsetY);this.mouseController.toStreamerMessagesProvider.toStreamerHandlers.get("MouseDouble")([e.button,t.x,t.y])}handlePressMouseButtons(e){this.mouseController.videoElementProvider.isVideoReady()&&(iu.Log(iu.GetStackTrace(),"onMouse press",6),this.mouseController.pressMouseButtons(e.buttons,e.offsetX,e.offsetY))}handleReleaseMouseButtons(e){this.mouseController.videoElementProvider.isVideoReady()&&(iu.Log(iu.GetStackTrace(),"onMouse release",6),this.mouseController.releaseMouseButtons(e.buttons,e.offsetX,e.offsetY))}}class sg{constructor(e,t,n,s){this.mouseEventListenerTracker=new Xh,this.toStreamerMessagesProvider=e,this.coordinateConverter=n,this.videoElementProvider=t,this.activeKeysProvider=s,this.registerMouseEnterAndLeaveEvents()}unregisterMouseEvents(){this.mouseEventListenerTracker.unregisterAll()}registerLockedMouseEvents(e){const t=this.videoElementProvider.getVideoParentElement(),n=new tg(this.videoElementProvider,e,this.activeKeysProvider);if(t.requestPointerLock=t.requestPointerLock||t.mozRequestPointerLock,document.exitPointerLock=document.exitPointerLock||document.mozExitPointerLock,t.requestPointerLock){const e=()=>{t.requestPointerLock()};t.addEventListener("click",e),this.mouseEventListenerTracker.addUnregisterCallback((()=>t.removeEventListener("click",e)))}const s=()=>n.lockStateChange();document.addEventListener("pointerlockchange",s,!1),document.addEventListener("mozpointerlockchange",s,!1),this.mouseEventListenerTracker.addUnregisterCallback((()=>document.removeEventListener("pointerlockchange",s,!1))),this.mouseEventListenerTracker.addUnregisterCallback((()=>document.removeEventListener("mozpointerlockchange",s,!1)));const r=e=>n.handleMouseDown(e),o=e=>n.handleMouseUp(e),i=e=>n.handleMouseWheel(e),a=e=>n.handleMouseDouble(e);t.addEventListener("mousedown",r),t.addEventListener("mouseup",o),t.addEventListener("wheel",i),t.addEventListener("dblclick",a),this.mouseEventListenerTracker.addUnregisterCallback((()=>t.removeEventListener("mousedown",r))),this.mouseEventListenerTracker.addUnregisterCallback((()=>t.removeEventListener("mouseup",o))),this.mouseEventListenerTracker.addUnregisterCallback((()=>t.removeEventListener("wheel",i))),this.mouseEventListenerTracker.addUnregisterCallback((()=>t.removeEventListener("dblclick",a))),this.mouseEventListenerTracker.addUnregisterCallback((()=>n.unregisterMouseEvents())),this.mouseEventListenerTracker.addUnregisterCallback((()=>{!document.exitPointerLock||document.pointerLockElement!==t&&document.mozPointerLockElement!==t||document.exitPointerLock()}))}registerHoveringMouseEvents(e){const t=this.videoElementProvider.getVideoParentElement(),n=new ng(e),s=e=>n.updateMouseMovePosition(e),r=e=>n.handleMouseDown(e),o=e=>n.handleMouseUp(e),i=e=>n.handleContextMenu(e),a=e=>n.handleMouseWheel(e),l=e=>n.handleMouseDouble(e);t.addEventListener("mousemove",s),t.addEventListener("mousedown",r),t.addEventListener("mouseup",o),t.addEventListener("contextmenu",i),t.addEventListener("wheel",a),t.addEventListener("dblclick",l),this.mouseEventListenerTracker.addUnregisterCallback((()=>t.removeEventListener("mousemove",s))),this.mouseEventListenerTracker.addUnregisterCallback((()=>t.removeEventListener("mousedown",r))),this.mouseEventListenerTracker.addUnregisterCallback((()=>t.removeEventListener("mouseup",o))),this.mouseEventListenerTracker.addUnregisterCallback((()=>t.removeEventListener("contextmenu",i))),this.mouseEventListenerTracker.addUnregisterCallback((()=>t.removeEventListener("wheel",a))),this.mouseEventListenerTracker.addUnregisterCallback((()=>t.removeEventListener("dblclick",l))),this.mouseEventListenerTracker.addUnregisterCallback((()=>n.unregisterMouseEvents()))}registerMouseEnterAndLeaveEvents(){const e=this.videoElementProvider.getVideoParentElement(),t=e=>{this.videoElementProvider.isVideoReady()&&(iu.Log(iu.GetStackTrace(),"Mouse Entered",6),this.sendMouseEnter(),this.pressMouseButtons(e.buttons,e.x,e.y))},n=e=>{this.videoElementProvider.isVideoReady()&&(iu.Log(iu.GetStackTrace(),"Mouse Left",6),this.sendMouseLeave(),this.releaseMouseButtons(e.buttons,e.x,e.y))};e.addEventListener("mouseenter",t),e.addEventListener("mouseleave",n),this.mouseEventListenerTracker.addUnregisterCallback((()=>e.removeEventListener("mouseenter",t))),this.mouseEventListenerTracker.addUnregisterCallback((()=>e.removeEventListener("mouseleave",n)))}releaseMouseButtons(e,t,n){const s=this.coordinateConverter.normalizeAndQuantizeUnsigned(t,n);e&Qh.primaryButton&&this.sendMouseUp(qh.mainButton,s.x,s.y),e&Qh.secondaryButton&&this.sendMouseUp(qh.secondaryButton,s.x,s.y),e&Qh.auxiliaryButton&&this.sendMouseUp(qh.auxiliaryButton,s.x,s.y),e&Qh.fourthButton&&this.sendMouseUp(qh.fourthButton,s.x,s.y),e&Qh.fifthButton&&this.sendMouseUp(qh.fifthButton,s.x,s.y)}pressMouseButtons(e,t,n){if(!this.videoElementProvider.isVideoReady())return;const s=this.coordinateConverter.normalizeAndQuantizeUnsigned(t,n);e&Qh.primaryButton&&this.sendMouseDown(qh.mainButton,s.x,s.y),e&Qh.secondaryButton&&this.sendMouseDown(qh.secondaryButton,s.x,s.y),e&Qh.auxiliaryButton&&this.sendMouseDown(qh.auxiliaryButton,s.x,s.y),e&Qh.fourthButton&&this.sendMouseDown(qh.fourthButton,s.x,s.y),e&Qh.fifthButton&&this.sendMouseDown(qh.fifthButton,s.x,s.y)}sendMouseEnter(){this.videoElementProvider.isVideoReady()&&this.toStreamerMessagesProvider.toStreamerHandlers.get("MouseEnter")()}sendMouseLeave(){this.videoElementProvider.isVideoReady()&&this.toStreamerMessagesProvider.toStreamerHandlers.get("MouseLeave")()}sendMouseDown(e,t,n){this.videoElementProvider.isVideoReady()&&(iu.Log(iu.GetStackTrace(),`mouse button ${e} down at (${t}, ${n})`,6),this.toStreamerMessagesProvider.toStreamerHandlers.get("MouseDown")([e,t,n]))}sendMouseUp(e,t,n){if(!this.videoElementProvider.isVideoReady())return;iu.Log(iu.GetStackTrace(),`mouse button ${e} up at (${t}, ${n})`,6);const s=this.coordinateConverter.normalizeAndQuantizeUnsigned(t,n);this.toStreamerMessagesProvider.toStreamerHandlers.get("MouseUp")([e,s.x,s.y])}}class rg{constructor(e,t,n){this.fingers=[9,8,7,6,5,4,3,2,1,0],this.fingerIds=new Map,this.maxByteValue=255,this.touchEventListenerTracker=new Xh,this.toStreamerMessagesProvider=e,this.videoElementProvider=t,this.coordinateConverter=n,this.videoElementParent=t.getVideoElement();const s=e=>this.onTouchStart(e),r=e=>this.onTouchEnd(e),o=e=>this.onTouchMove(e);this.videoElementParent.addEventListener("touchstart",s),this.videoElementParent.addEventListener("touchend",r),this.videoElementParent.addEventListener("touchmove",o),this.touchEventListenerTracker.addUnregisterCallback((()=>this.videoElementParent.removeEventListener("touchstart",s))),this.touchEventListenerTracker.addUnregisterCallback((()=>this.videoElementParent.removeEventListener("touchend",r))),this.touchEventListenerTracker.addUnregisterCallback((()=>this.videoElementParent.removeEventListener("touchmove",o))),iu.Log(iu.GetStackTrace(),"Touch Events Registered",6);const i=e=>{e.preventDefault()};document.addEventListener("touchmove",i),this.touchEventListenerTracker.addUnregisterCallback((()=>document.removeEventListener("touchmove",i)))}unregisterTouchEvents(){this.touchEventListenerTracker.unregisterAll()}rememberTouch(e){const t=this.fingers.pop();void 0===t&&iu.Log(iu.GetStackTrace(),"exhausted touch identifiers",6),this.fingerIds.set(e.identifier,t)}forgetTouch(e){this.fingers.push(this.fingerIds.get(e.identifier)),this.fingers.sort((function(e,t){return t-e})),this.fingerIds.delete(e.identifier)}onTouchStart(e){if(this.videoElementProvider.isVideoReady()){for(let t=0;t<e.changedTouches.length;t++)this.rememberTouch(e.changedTouches[t]);iu.Log(iu.GetStackTrace(),"touch start",6),this.emitTouchData("TouchStart",e.changedTouches),e.preventDefault()}}onTouchEnd(e){if(this.videoElementProvider.isVideoReady()){iu.Log(iu.GetStackTrace(),"touch end",6),this.emitTouchData("TouchEnd",e.changedTouches);for(let t=0;t<e.changedTouches.length;t++)this.forgetTouch(e.changedTouches[t]);e.preventDefault()}}onTouchMove(e){this.videoElementProvider.isVideoReady()&&(iu.Log(iu.GetStackTrace(),"touch move",6),this.emitTouchData("TouchMove",e.touches),e.preventDefault())}emitTouchData(e,t){let n=document.querySelector(".screen"),s=Math.floor(n.getBoundingClientRect().width*window.devicePixelRatio),r=Math.floor(n.getBoundingClientRect().height*window.devicePixelRatio),o=Math.floor(window.screen.width*window.devicePixelRatio),i=Math.floor(window.screen.height*window.devicePixelRatio),a=(Math.floor(document.documentElement.clientWidth*window.devicePixelRatio),i-Math.floor(document.documentElement.clientHeight*window.devicePixelRatio)),l=document.querySelector(".screen").clientWidth/r,c=document.querySelector(".screen").clientHeight/s;if(!this.videoElementProvider.isVideoReady())return;this.videoElementProvider.getVideoParentElement().getBoundingClientRect();const d=this.toStreamerMessagesProvider.toStreamerHandlers;for(let n=0;n<t.length;n++){const u=1,h=t[n];let g,p;g=c*(Math.floor(h.clientY*window.devicePixelRatio)-Math.floor((i-a-r)/2)),p=l*(s-(Math.floor(h.clientX*window.devicePixelRatio)-Math.floor((o-s)/2))),iu.Log(iu.GetStackTrace(),`F${this.fingerIds.get(h.identifier)}=(${g}, ${p})`,6);const m=this.coordinateConverter.normalizeAndQuantizeUnsigned(g,p);switch(e){case"TouchStart":d.get("TouchStart")([u,m.x,m.y,this.fingerIds.get(h.identifier),this.maxByteValue*h.force,m.inRange?1:0]);break;case"TouchEnd":d.get("TouchEnd")([u,m.x,m.y,this.fingerIds.get(h.identifier),this.maxByteValue*h.force,m.inRange?1:0]);break;case"TouchMove":d.get("TouchMove")([u,m.x,m.y,this.fingerIds.get(h.identifier),this.maxByteValue*h.force,m.inRange?1:0])}}}}class og{constructor(e){this.gamePadEventListenerTracker=new Xh,this.toStreamerMessagesProvider=e,this.requestAnimationFrame=(window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.requestAnimationFrame).bind(window);const t=window;if("GamepadEvent"in t){const e=e=>this.gamePadConnectHandler(e),t=e=>this.gamePadDisconnectHandler(e);window.addEventListener("gamepadconnected",e),window.addEventListener("gamepaddisconnected",t),this.gamePadEventListenerTracker.addUnregisterCallback((()=>window.removeEventListener("gamepadconnected",e))),this.gamePadEventListenerTracker.addUnregisterCallback((()=>window.removeEventListener("gamepaddisconnected",t)))}else if("WebKitGamepadEvent"in t){const e=e=>this.gamePadConnectHandler(e),t=e=>this.gamePadDisconnectHandler(e);window.addEventListener("webkitgamepadconnected",e),window.addEventListener("webkitgamepaddisconnected",t),this.gamePadEventListenerTracker.addUnregisterCallback((()=>window.removeEventListener("webkitgamepadconnected",e))),this.gamePadEventListenerTracker.addUnregisterCallback((()=>window.removeEventListener("webkitgamepaddisconnected",t)))}if(this.controllers=[],navigator.getGamepads)for(const e of navigator.getGamepads())e&&this.gamePadConnectHandler(new GamepadEvent("gamepadconnected",{gamepad:e}))}unregisterGamePadEvents(){this.gamePadEventListenerTracker.unregisterAll();for(const e of this.controllers)void 0!==e.id&&this.onGamepadDisconnected(e.id);this.controllers=[],this.onGamepadConnected=()=>{},this.onGamepadDisconnected=()=>{}}gamePadConnectHandler(e){iu.Log(iu.GetStackTrace(),"Gamepad connect handler",6);const t=e.gamepad,n={currentState:t,prevState:t,id:void 0};this.controllers.push(n),this.controllers[t.index].currentState=t,this.controllers[t.index].prevState=t,iu.Log(iu.GetStackTrace(),"gamepad: "+t.id+" connected",6),window.requestAnimationFrame((()=>this.updateStatus())),this.onGamepadConnected()}gamePadDisconnectHandler(e){iu.Log(iu.GetStackTrace(),"Gamepad disconnect handler",6),iu.Log(iu.GetStackTrace(),"gamepad: "+e.gamepad.id+" disconnected",6);const t=this.controllers[e.gamepad.index];delete this.controllers[e.gamepad.index],this.controllers=this.controllers.filter((e=>void 0!==e)),this.onGamepadDisconnected(t.id)}scanGamePads(){const e=navigator.getGamepads?navigator.getGamepads():navigator.webkitGetGamepads?navigator.webkitGetGamepads():[];for(let t=0;t<e.length;t++)e[t]&&e[t].index in this.controllers&&(this.controllers[e[t].index].currentState=e[t])}updateStatus(){this.scanGamePads();const e=this.toStreamerMessagesProvider.toStreamerHandlers;for(const t of this.controllers){const n=void 0===t.id?this.controllers.indexOf(t):t.id,s=t.currentState;for(let s=0;s<t.currentState.buttons.length;s++){const r=t.currentState.buttons[s],o=t.prevState.buttons[s];r.pressed?s==Bh.LeftTrigger?e.get("GamepadAnalog")([n,5,r.value]):s==Bh.RightTrigger?e.get("GamepadAnalog")([n,6,r.value]):e.get("GamepadButtonPressed")([n,s,o.pressed?1:0]):!r.pressed&&o.pressed&&(s==Bh.LeftTrigger?e.get("GamepadAnalog")([n,5,0]):s==Bh.RightTrigger?e.get("GamepadAnalog")([n,6,0]):e.get("GamepadButtonReleased")([n,s]))}for(let t=0;t<s.axes.length;t+=2){const r=parseFloat(s.axes[t].toFixed(4)),o=-parseFloat(s.axes[t+1].toFixed(4));e.get("GamepadAnalog")([n,t+1,r]),e.get("GamepadAnalog")([n,t+2,o])}this.controllers[n].prevState=s}this.controllers.length>0&&this.requestAnimationFrame((()=>this.updateStatus()))}onGamepadResponseReceived(e){for(const t of this.controllers)if(void 0===t.id){t.id=e;break}}onGamepadConnected(){}onGamepadDisconnected(e){}}!function(e){e[e.RightClusterBottomButton=0]="RightClusterBottomButton",e[e.RightClusterRightButton=1]="RightClusterRightButton",e[e.RightClusterLeftButton=2]="RightClusterLeftButton",e[e.RightClusterTopButton=3]="RightClusterTopButton",e[e.LeftShoulder=4]="LeftShoulder",e[e.RightShoulder=5]="RightShoulder",e[e.LeftTrigger=6]="LeftTrigger",e[e.RightTrigger=7]="RightTrigger",e[e.SelectOrBack=8]="SelectOrBack",e[e.StartOrForward=9]="StartOrForward",e[e.LeftAnalogPress=10]="LeftAnalogPress",e[e.RightAnalogPress=11]="RightAnalogPress",e[e.LeftClusterTopButton=12]="LeftClusterTopButton",e[e.LeftClusterBottomButton=13]="LeftClusterBottomButton",e[e.LeftClusterLeftButton=14]="LeftClusterLeftButton",e[e.LeftClusterRightButton=15]="LeftClusterRightButton",e[e.CentreButton=16]="CentreButton",e[e.LeftStickHorizontal=0]="LeftStickHorizontal",e[e.LeftStickVertical=1]="LeftStickVertical",e[e.RightStickHorizontal=2]="RightStickHorizontal",e[e.RightStickVertical=3]="RightStickVertical"}(Bh||(Bh={}));class ig{constructor(e,t,n){this.activeKeys=new ag,this.toStreamerMessagesProvider=e,this.videoElementProvider=t,this.coordinateConverter=n}registerKeyBoard(e){iu.Log(iu.GetStackTrace(),"Register Keyboard Events",7);const t=new eg(this.toStreamerMessagesProvider,e,this.activeKeys);return t.registerKeyBoardEvents(),t}registerMouse(e){iu.Log(iu.GetStackTrace(),"Register Mouse Events",7);const t=new sg(this.toStreamerMessagesProvider,this.videoElementProvider,this.coordinateConverter,this.activeKeys);switch(e){case Eh.LockedMouse:t.registerLockedMouseEvents(t);break;case Eh.HoveringMouse:t.registerHoveringMouseEvents(t);break;default:iu.Info(iu.GetStackTrace(),"unknown Control Scheme Type Defaulting to Locked Mouse Events"),t.registerLockedMouseEvents(t)}return t}registerTouch(e,t){if(iu.Log(iu.GetStackTrace(),"Registering Touch",6),e){const e=new Jh(this.toStreamerMessagesProvider,this.videoElementProvider,this.coordinateConverter);return e.setVideoElementParentClientRect(t),e}return new rg(this.toStreamerMessagesProvider,this.videoElementProvider,this.coordinateConverter)}registerGamePad(){return iu.Log(iu.GetStackTrace(),"Register Game Pad",7),new og(this.toStreamerMessagesProvider)}}class ag{constructor(){this.activeKeys=[],this.activeKeys=[]}getActiveKeys(){return this.activeKeys}}class lg{constructor(e,t){this.lastTimeResized=(new Date).getTime(),this.videoElement=document.createElement("video"),this.config=t,this.videoElement.id="streamingVideo",this.videoElement.disablePictureInPicture=!0,this.videoElement.playsInline=!0,this.videoElement.style.width="100%",this.videoElement.style.height="100%",this.videoElement.style.position="absolute",this.videoElement.style.pointerEvents="all",e.appendChild(this.videoElement),this.onResizePlayerCallback=()=>{console.log("Resolution changed, restyling player, did you forget to override this function?")},this.onMatchViewportResolutionCallback=()=>{console.log("Resolution changed and match viewport resolution is turned on, did you forget to override this function?")},this.videoElement.onclick=()=>{null!=this.audioElement&&this.audioElement.paused&&this.audioElement.play(),this.videoElement.paused&&this.videoElement.play()},this.videoElement.onloadedmetadata=()=>{this.onVideoInitialized()},window.addEventListener("resize",(()=>this.resizePlayerStyle()),!0),window.addEventListener("orientationchange",(()=>this.onOrientationChange()))}setAudioElement(e){this.audioElement=e}play(){return this.videoElement.muted=this.config.isFlagEnabled(ph.StartVideoMuted),this.videoElement.autoplay=this.config.isFlagEnabled(ph.AutoPlayVideo),this.videoElement.play()}isPaused(){return this.videoElement.paused}isVideoReady(){return void 0!==this.videoElement.readyState&&this.videoElement.readyState>0}hasVideoSource(){return void 0!==this.videoElement.srcObject&&null!==this.videoElement.srcObject}getVideoElement(){return this.videoElement}getVideoParentElement(){return this.videoElement.parentElement}setVideoEnabled(e){this.videoElement.srcObject.getTracks().forEach((t=>t.enabled=e))}onVideoInitialized(){}onOrientationChange(){clearTimeout(this.orientationChangeTimeout),this.orientationChangeTimeout=window.setTimeout((()=>{this.resizePlayerStyle()}),500)}resizePlayerStyle(){const e=this.getVideoParentElement();e&&(this.updateVideoStreamSize(),e.classList.contains("fixed-size")||this.resizePlayerStyleToFillParentElement(),this.onResizePlayerCallback())}resizePlayerStyleToFillParentElement(){this.getVideoParentElement().setAttribute("style","top: 0px; left: 0px; width: 100%; height: 100%; cursor: default;")}updateVideoStreamSize(){if(this.config.isFlagEnabled(ph.MatchViewportResolution))if((new Date).getTime()-this.lastTimeResized>300){const e=this.getVideoParentElement();if(!e)return;this.onMatchViewportResolutionCallback(e.clientWidth,e.clientHeight),this.lastTimeResized=(new Date).getTime()}else iu.Log(iu.GetStackTrace(),"Resizing too often - skipping",6),clearTimeout(this.resizeTimeoutHandle),this.resizeTimeoutHandle=window.setTimeout((()=>this.updateVideoStreamSize()),100)}}class cg{constructor(){this.toStreamerHandlers=new Map,this.fromStreamerHandlers=new Map,this.toStreamerMessages=new Map,this.fromStreamerMessages=new Map}populateDefaultProtocol(){this.toStreamerMessages.set("IFrameRequest",{id:0,structure:[]}),this.toStreamerMessages.set("RequestQualityControl",{id:1,structure:[]}),this.toStreamerMessages.set("FpsRequest",{id:2,structure:[]}),this.toStreamerMessages.set("AverageBitrateRequest",{id:3,structure:[]}),this.toStreamerMessages.set("StartStreaming",{id:4,structure:[]}),this.toStreamerMessages.set("StopStreaming",{id:5,structure:[]}),this.toStreamerMessages.set("LatencyTest",{id:6,structure:["string"]}),this.toStreamerMessages.set("RequestInitialSettings",{id:7,structure:[]}),this.toStreamerMessages.set("TestEcho",{id:8,structure:[]}),this.toStreamerMessages.set("DataChannelLatencyTest",{id:9,structure:[]}),this.toStreamerMessages.set("UIInteraction",{id:50,structure:["string"]}),this.toStreamerMessages.set("Command",{id:51,structure:["string"]}),this.toStreamerMessages.set("KeyDown",{id:60,structure:["uint8","uint8"]}),this.toStreamerMessages.set("KeyUp",{id:61,structure:["uint8"]}),this.toStreamerMessages.set("KeyPress",{id:62,structure:["uint16"]}),this.toStreamerMessages.set("MouseEnter",{id:70,structure:[]}),this.toStreamerMessages.set("MouseLeave",{id:71,structure:[]}),this.toStreamerMessages.set("MouseDown",{id:72,structure:["uint8","uint16","uint16"]}),this.toStreamerMessages.set("MouseUp",{id:73,structure:["uint8","uint16","uint16"]}),this.toStreamerMessages.set("MouseMove",{id:74,structure:["uint16","uint16","int16","int16"]}),this.toStreamerMessages.set("MouseWheel",{id:75,structure:["int16","uint16","uint16"]}),this.toStreamerMessages.set("MouseDouble",{id:76,structure:["uint8","uint16","uint16"]}),this.toStreamerMessages.set("TouchStart",{id:80,structure:["uint8","uint16","uint16","uint8","uint8","uint8"]}),this.toStreamerMessages.set("TouchEnd",{id:81,structure:["uint8","uint16","uint16","uint8","uint8","uint8"]}),this.toStreamerMessages.set("TouchMove",{id:82,structure:["uint8","uint16","uint16","uint8","uint8","uint8"]}),this.toStreamerMessages.set("GamepadConnected",{id:93,structure:[]}),this.toStreamerMessages.set("GamepadButtonPressed",{id:90,structure:["uint8","uint8","uint8"]}),this.toStreamerMessages.set("GamepadButtonReleased",{id:91,structure:["uint8","uint8","uint8"]}),this.toStreamerMessages.set("GamepadAnalog",{id:92,structure:["uint8","uint8","double"]}),this.toStreamerMessages.set("GamepadDisconnected",{id:94,structure:["uint8"]}),this.fromStreamerMessages.set(0,"QualityControlOwnership"),this.fromStreamerMessages.set(1,"Response"),this.fromStreamerMessages.set(2,"Command"),this.fromStreamerMessages.set(3,"FreezeFrame"),this.fromStreamerMessages.set(4,"UnfreezeFrame"),this.fromStreamerMessages.set(5,"VideoEncoderAvgQP"),this.fromStreamerMessages.set(6,"LatencyTest"),this.fromStreamerMessages.set(7,"InitialSettings"),this.fromStreamerMessages.set(8,"FileExtension"),this.fromStreamerMessages.set(9,"FileMimeType"),this.fromStreamerMessages.set(10,"FileContents"),this.fromStreamerMessages.set(11,"TestEcho"),this.fromStreamerMessages.set(12,"InputControlOwnership"),this.fromStreamerMessages.set(13,"GamepadResponse"),this.fromStreamerMessages.set(14,"DataChannelLatencyTest"),this.fromStreamerMessages.set(255,"Protocol")}registerMessageHandler(e,t,n){switch(e){case zh.ToStreamer:this.toStreamerHandlers.set(t,n);break;case zh.FromStreamer:this.fromStreamerHandlers.set(t,n);break;default:iu.Log(iu.GetStackTrace(),`Unknown message direction ${e}`)}}}!function(e){e[e.ToStreamer=0]="ToStreamer",e[e.FromStreamer=1]="FromStreamer"}(zh||(zh={}));class dg{constructor(){this.responseEventListeners=new Map}addResponseEventListener(e,t){this.responseEventListeners.set(e,t)}removeResponseEventListener(e){this.responseEventListeners.delete(e)}onResponse(e){iu.Log(iu.GetStackTrace(),"DataChannelReceiveMessageType.Response",6);const t=new TextDecoder("utf-16").decode(e.slice(1));iu.Log(iu.GetStackTrace(),t,6),this.responseEventListeners.forEach((e=>{e(t)}))}}class ug{constructor(e,t){this.dataChannelSender=e,this.toStreamerMessagesMapProvider=t}sendMessageToStreamer(e,t){void 0===t&&(t=[]);const n=this.toStreamerMessagesMapProvider.toStreamerMessages.get(e);if(void 0===n)return void iu.Error(iu.GetStackTrace(),`Attempted to send a message to the streamer with message type: ${e}, but the frontend hasn't been configured to send such a message. Check you've added the message type in your cpp`);if(n.structure&&t&&n.structure.length!==t.length)return void iu.Error(iu.GetStackTrace(),`Provided message data doesn't match expected layout. Expected [ ${n.structure.map((e=>{switch(e){case"uint8":case"uint16":case"int16":case"float":case"double":return"number";case"string":return"string"}})).toString()} ] but received [ ${t.map((e=>typeof e)).toString()} ]`);let s=0;const r=new TextEncoder;t.forEach(((e,t)=>{switch(n.structure[t]){case"uint8":s+=1;break;case"uint16":case"int16":s+=2;break;case"float":s+=4;break;case"double":s+=8;break;case"string":s+=2,s+=2*r.encode(e).length}}));const o=new DataView(new ArrayBuffer(s+1));o.setUint8(0,n.id);let i=1;t.forEach(((e,t)=>{switch(n.structure[t]){case"uint8":o.setUint8(i,e),i+=1;break;case"uint16":o.setUint16(i,e,!0),i+=2;break;case"int16":o.setInt16(i,e,!0),i+=2;break;case"float":o.setFloat32(i,e,!0),i+=4;break;case"double":o.setFloat64(i,e,!0),i+=8;break;case"string":o.setUint16(i,e.length,!0),i+=2;for(let t=0;t<e.length;t++)o.setUint16(i,e.charCodeAt(t),!0),i+=2}})),this.dataChannelSender.canSend()?this.dataChannelSender.sendData(o.buffer):iu.Info(iu.GetStackTrace(),`Data channel cannot send yet, skipping sending message: ${e} - ${new Uint8Array(o.buffer)}`)}}class hg{constructor(e){this.sendMessageController=e}SendRequestQualityControl(){this.sendMessageController.sendMessageToStreamer("RequestQualityControl")}SendMaxFpsRequest(){this.sendMessageController.sendMessageToStreamer("FpsRequest")}SendAverageBitrateRequest(){this.sendMessageController.sendMessageToStreamer("AverageBitrateRequest")}SendStartStreaming(){this.sendMessageController.sendMessageToStreamer("StartStreaming")}SendStopStreaming(){this.sendMessageController.sendMessageToStreamer("StopStreaming")}SendRequestInitialSettings(){this.sendMessageController.sendMessageToStreamer("RequestInitialSettings")}}class gg{constructor(e){this.dataChannelProvider=e}canSend(){return void 0!==this.dataChannelProvider.getDataChannelInstance().dataChannel&&"open"==this.dataChannelProvider.getDataChannelInstance().dataChannel.readyState}sendData(e){const t=this.dataChannelProvider.getDataChannelInstance();"open"==t.dataChannel.readyState?(t.dataChannel.send(e),iu.Log(iu.GetStackTrace(),`Message Sent: ${new Uint8Array(e)}`,6),this.resetAfkWarningTimerOnDataSend()):iu.Error(iu.GetStackTrace(),`Message Failed: ${new Uint8Array(e)}`)}resetAfkWarningTimerOnDataSend(){}}class pg{constructor(e){this.videoElementProvider=e,this.normalizeAndQuantizeUnsignedFunc=()=>{throw new Error("Normalize and quantize unsigned, method not implemented.")},this.normalizeAndQuantizeSignedFunc=()=>{throw new Error("Normalize and unquantize signed, method not implemented.")},this.denormalizeAndUnquantizeUnsignedFunc=()=>{throw new Error("Denormalize and unquantize unsigned, method not implemented.")}}normalizeAndQuantizeUnsigned(e,t){return this.normalizeAndQuantizeUnsignedFunc(e,t)}unquantizeAndDenormalizeUnsigned(e,t){return this.denormalizeAndUnquantizeUnsignedFunc(e,t)}normalizeAndQuantizeSigned(e,t){return this.normalizeAndQuantizeSignedFunc(e,t)}setupNormalizeAndQuantize(){if(this.videoElementParent=this.videoElementProvider.getVideoParentElement(),this.videoElement=this.videoElementProvider.getVideoElement(),this.videoElementParent&&this.videoElement){const e=this.videoElementParent.clientHeight/this.videoElementParent.clientWidth,t=this.videoElement.videoHeight/this.videoElement.videoWidth;e>t?(iu.Log(iu.GetStackTrace(),"Setup Normalize and Quantize for playerAspectRatio > videoAspectRatio",6),this.ratio=e/t,this.normalizeAndQuantizeUnsignedFunc=(e,t)=>this.normalizeAndQuantizeUnsignedPlayerBigger(e,t),this.normalizeAndQuantizeSignedFunc=(e,t)=>this.normalizeAndQuantizeSignedPlayerBigger(e,t),this.denormalizeAndUnquantizeUnsignedFunc=(e,t)=>this.denormalizeAndUnquantizeUnsignedPlayerBigger(e,t)):(iu.Log(iu.GetStackTrace(),"Setup Normalize and Quantize for playerAspectRatio <= videoAspectRatio",6),this.ratio=t/e,this.normalizeAndQuantizeUnsignedFunc=(e,t)=>this.normalizeAndQuantizeUnsignedPlayerSmaller(e,t),this.normalizeAndQuantizeSignedFunc=(e,t)=>this.normalizeAndQuantizeSignedPlayerSmaller(e,t),this.denormalizeAndUnquantizeUnsignedFunc=(e,t)=>this.denormalizeAndUnquantizeUnsignedPlayerSmaller(e,t))}}normalizeAndQuantizeUnsignedPlayerBigger(e,t){const n=e/this.videoElementParent.clientWidth,s=this.ratio*(t/this.videoElementParent.clientHeight-.5)+.5;return n<0||n>1||s<0||s>1?new mg(!1,65535,65535):new mg(!0,65536*n,65536*s)}denormalizeAndUnquantizeUnsignedPlayerBigger(e,t){const n=e/65536,s=(t/65536-.5)/this.ratio+.5;return new fg(n*this.videoElementParent.clientWidth,s*this.videoElementParent.clientHeight)}normalizeAndQuantizeSignedPlayerBigger(e,t){const n=e/(.5*this.videoElementParent.clientWidth),s=this.ratio*t/(.5*this.videoElementParent.clientHeight);return new vg(32767*n,32767*s)}normalizeAndQuantizeUnsignedPlayerSmaller(e,t){const n=this.ratio*(e/this.videoElementParent.clientWidth-.5)+.5,s=t/this.videoElementParent.clientHeight;return n<0||n>1||s<0||s>1?new mg(!1,65535,65535):new mg(!0,65536*n,65536*s)}denormalizeAndUnquantizeUnsignedPlayerSmaller(e,t){const n=(e/65536-.5)/this.ratio+.5,s=t/65536;return new fg(n*this.videoElementParent.clientWidth,s*this.videoElementParent.clientHeight)}normalizeAndQuantizeSignedPlayerSmaller(e,t){const n=this.ratio*e/(.5*this.videoElementParent.clientWidth),s=t/(.5*this.videoElementParent.clientHeight);return new vg(32767*n,32767*s)}}class mg{constructor(e,t,n){this.inRange=e,this.x=t,this.y=n}}class fg{constructor(e,t){this.x=e,this.y=t}}class vg{constructor(e,t){this.x=e,this.y=t}}class Sg{constructor(e,t){this.shouldShowPlayOverlay=!0,this.autoJoinTimer=void 0,this.config=e,this.pixelStreaming=t,this.responseController=new dg,this.file=new Kh,this.sdpConstraints={offerToReceiveAudio:!0,offerToReceiveVideo:!0},this.afkController=new Th(this.config,this.pixelStreaming,this.onAfkTriggered.bind(this)),this.afkController.onAFKTimedOutCallback=()=>{this.closeSignalingServer("You have been disconnected due to inactivity")},this.freezeFrameController=new _u(this.pixelStreaming.videoElementParent),this.videoPlayer=new lg(this.pixelStreaming.videoElementParent,this.config),this.videoPlayer.onVideoInitialized=()=>this.handleVideoInitialized(),this.videoPlayer.onMatchViewportResolutionCallback=(e,t)=>{const n={"Resolution.Width":e,"Resolution.Height":t};this.streamMessageController.toStreamerHandlers.get("Command")([JSON.stringify(n)])},this.videoPlayer.onResizePlayerCallback=()=>{this.setUpMouseAndFreezeFrame()},this.streamController=new Tu(this.videoPlayer),this.coordinateConverter=new pg(this.videoPlayer),this.sendrecvDataChannelController=new Mh,this.recvDataChannelController=new Mh,this.registerDataChannelEventEmitters(this.sendrecvDataChannelController),this.registerDataChannelEventEmitters(this.recvDataChannelController),this.dataChannelSender=new gg(this.sendrecvDataChannelController),this.dataChannelSender.resetAfkWarningTimerOnDataSend=()=>this.afkController.resetAfkWarningTimer(),this.streamMessageController=new cg,this.webSocketController=new Eu,this.webSocketController.onConfig=e=>this.handleOnConfigMessage(e),this.webSocketController.onStreamerList=e=>this.handleStreamerListMessage(e),this.webSocketController.onPlayerCount=e=>{this.pixelStreaming._onPlayerCount(e.count)},this.webSocketController.onOpen.addEventListener("open",(()=>{this.config.isFlagEnabled(ph.BrowserSendOffer)||this.webSocketController.requestStreamerObject(sessionStorage.getItem("streamerName"))})),this.webSocketController.onClose.addEventListener("close",(e=>{const t=this.shouldReconnect&&1001!=e.detail.code&&this.config.getNumericSettingValue(fh.MaxReconnectAttempts)>0,n=this.disconnectMessage?this.disconnectMessage:e.detail.reason;this.pixelStreaming._onDisconnect(n,!t&&!this.isReconnecting),this.afkController.stopAfkWarningTimer(),this.statsTimerHandle&&void 0!==this.statsTimerHandle&&window.clearInterval(this.statsTimerHandle),this.setVideoEncoderAvgQP(0),this.setTouchInputEnabled(!1),this.setMouseInputEnabled(!1),this.setKeyboardInputEnabled(!1),this.setGamePadInputEnabled(!1),t&&setTimeout((()=>{this.isReconnecting=!0,this.reconnectAttempt++,this.tryReconnect(e.detail.reason)}),2e3)})),this.sendMessageController=new ug(this.dataChannelSender,this.streamMessageController),this.toStreamerMessagesController=new hg(this.sendMessageController),this.registerMessageHandlers(),this.streamMessageController.populateDefaultProtocol(),this.inputClassesFactory=new ig(this.streamMessageController,this.videoPlayer,this.coordinateConverter),this.isUsingSFU=!1,this.isQualityController=!1,this.preferredCodec="",this.shouldReconnect=!0,this.isReconnecting=!1,this.reconnectAttempt=0,this.config._addOnOptionSettingChangedListener(bh.StreamerId,(e=>{""!==e&&(this.peerConnectionController.peerConnection.close(),this.peerConnectionController.createPeerConnection(this.peerConfig,this.preferredCodec),this.subscribedStream=e,this.webSocketController.sendSubscribe(e))})),this.setVideoEncoderAvgQP(-1),this.signallingUrlBuilder=()=>{let e=this.config.getTextSettingValue(Sh.SignallingServerUrl);return this.config.isFlagEnabled(ph.BrowserSendOffer)&&(e+="?"+ph.BrowserSendOffer+"=true"),e}}requestUnquantizedAndDenormalizeUnsigned(e,t){return this.coordinateConverter.unquantizeAndDenormalizeUnsigned(e,t)}handleOnMessage(e){const t=new Uint8Array(e.data);iu.Log(iu.GetStackTrace(),"Message incoming:"+t,6);const n=this.streamMessageController.fromStreamerMessages.get(t[0]);this.streamMessageController.fromStreamerHandlers.get(n)(e.data)}registerMessageHandlers(){this.streamMessageController.registerMessageHandler(zh.FromStreamer,"QualityControlOwnership",(e=>this.onQualityControlOwnership(e))),this.streamMessageController.registerMessageHandler(zh.FromStreamer,"Response",(e=>this.responseController.onResponse(e))),this.streamMessageController.registerMessageHandler(zh.FromStreamer,"Command",(e=>{this.onCommand(e)})),this.streamMessageController.registerMessageHandler(zh.FromStreamer,"FreezeFrame",(e=>this.onFreezeFrameMessage(e))),this.streamMessageController.registerMessageHandler(zh.FromStreamer,"UnfreezeFrame",(()=>this.invalidateFreezeFrameAndEnableVideo())),this.streamMessageController.registerMessageHandler(zh.FromStreamer,"VideoEncoderAvgQP",(e=>this.handleVideoEncoderAvgQP(e))),this.streamMessageController.registerMessageHandler(zh.FromStreamer,"LatencyTest",(e=>this.handleLatencyTestResult(e))),this.streamMessageController.registerMessageHandler(zh.FromStreamer,"DataChannelLatencyTest",(e=>this.handleDataChannelLatencyTestResponse(e))),this.streamMessageController.registerMessageHandler(zh.FromStreamer,"InitialSettings",(e=>this.handleInitialSettings(e))),this.streamMessageController.registerMessageHandler(zh.FromStreamer,"FileExtension",(e=>this.onFileExtension(e))),this.streamMessageController.registerMessageHandler(zh.FromStreamer,"FileMimeType",(e=>this.onFileMimeType(e))),this.streamMessageController.registerMessageHandler(zh.FromStreamer,"FileContents",(e=>this.onFileContents(e))),this.streamMessageController.registerMessageHandler(zh.FromStreamer,"TestEcho",(()=>{})),this.streamMessageController.registerMessageHandler(zh.FromStreamer,"InputControlOwnership",(e=>this.onInputControlOwnership(e))),this.streamMessageController.registerMessageHandler(zh.FromStreamer,"GamepadResponse",(e=>this.onGamepadResponse(e))),this.streamMessageController.registerMessageHandler(zh.FromStreamer,"Protocol",(e=>this.onProtocolMessage(e))),this.streamMessageController.registerMessageHandler(zh.ToStreamer,"IFrameRequest",(()=>this.sendMessageController.sendMessageToStreamer("IFrameRequest"))),this.streamMessageController.registerMessageHandler(zh.ToStreamer,"RequestQualityControl",(()=>this.sendMessageController.sendMessageToStreamer("RequestQualityControl"))),this.streamMessageController.registerMessageHandler(zh.ToStreamer,"FpsRequest",(()=>this.sendMessageController.sendMessageToStreamer("FpsRequest"))),this.streamMessageController.registerMessageHandler(zh.ToStreamer,"AverageBitrateRequest",(()=>this.sendMessageController.sendMessageToStreamer("AverageBitrateRequest"))),this.streamMessageController.registerMessageHandler(zh.ToStreamer,"StartStreaming",(()=>this.sendMessageController.sendMessageToStreamer("StartStreaming"))),this.streamMessageController.registerMessageHandler(zh.ToStreamer,"StopStreaming",(()=>this.sendMessageController.sendMessageToStreamer("StopStreaming"))),this.streamMessageController.registerMessageHandler(zh.ToStreamer,"LatencyTest",(e=>this.sendMessageController.sendMessageToStreamer("LatencyTest",e))),this.streamMessageController.registerMessageHandler(zh.ToStreamer,"RequestInitialSettings",(()=>this.sendMessageController.sendMessageToStreamer("RequestInitialSettings"))),this.streamMessageController.registerMessageHandler(zh.ToStreamer,"TestEcho",(()=>{})),this.streamMessageController.registerMessageHandler(zh.ToStreamer,"UIInteraction",(e=>this.sendMessageController.sendMessageToStreamer("UIInteraction",e))),this.streamMessageController.registerMessageHandler(zh.ToStreamer,"Command",(e=>this.sendMessageController.sendMessageToStreamer("Command",e))),this.streamMessageController.registerMessageHandler(zh.ToStreamer,"TextboxEntry",(e=>this.sendMessageController.sendMessageToStreamer("TextboxEntry",e))),this.streamMessageController.registerMessageHandler(zh.ToStreamer,"KeyDown",(e=>this.sendMessageController.sendMessageToStreamer("KeyDown",e))),this.streamMessageController.registerMessageHandler(zh.ToStreamer,"KeyUp",(e=>this.sendMessageController.sendMessageToStreamer("KeyUp",e))),this.streamMessageController.registerMessageHandler(zh.ToStreamer,"KeyPress",(e=>this.sendMessageController.sendMessageToStreamer("KeyPress",e))),this.streamMessageController.registerMessageHandler(zh.ToStreamer,"MouseEnter",(e=>this.sendMessageController.sendMessageToStreamer("MouseEnter",e))),this.streamMessageController.registerMessageHandler(zh.ToStreamer,"MouseLeave",(e=>this.sendMessageController.sendMessageToStreamer("MouseLeave",e))),this.streamMessageController.registerMessageHandler(zh.ToStreamer,"MouseDown",(e=>this.sendMessageController.sendMessageToStreamer("MouseDown",e))),this.streamMessageController.registerMessageHandler(zh.ToStreamer,"MouseUp",(e=>this.sendMessageController.sendMessageToStreamer("MouseUp",e))),this.streamMessageController.registerMessageHandler(zh.ToStreamer,"MouseMove",(e=>this.sendMessageController.sendMessageToStreamer("MouseMove",e))),this.streamMessageController.registerMessageHandler(zh.ToStreamer,"MouseWheel",(e=>this.sendMessageController.sendMessageToStreamer("MouseWheel",e))),this.streamMessageController.registerMessageHandler(zh.ToStreamer,"MouseDouble",(e=>this.sendMessageController.sendMessageToStreamer("MouseDouble",e))),this.streamMessageController.registerMessageHandler(zh.ToStreamer,"TouchStart",(e=>this.sendMessageController.sendMessageToStreamer("TouchStart",e))),this.streamMessageController.registerMessageHandler(zh.ToStreamer,"TouchEnd",(e=>this.sendMessageController.sendMessageToStreamer("TouchEnd",e))),this.streamMessageController.registerMessageHandler(zh.ToStreamer,"TouchMove",(e=>this.sendMessageController.sendMessageToStreamer("TouchMove",e))),this.streamMessageController.registerMessageHandler(zh.ToStreamer,"GamepadConnected",(()=>this.sendMessageController.sendMessageToStreamer("GamepadConnected"))),this.streamMessageController.registerMessageHandler(zh.ToStreamer,"GamepadButtonPressed",(e=>this.sendMessageController.sendMessageToStreamer("GamepadButtonPressed",e))),this.streamMessageController.registerMessageHandler(zh.ToStreamer,"GamepadButtonReleased",(e=>this.sendMessageController.sendMessageToStreamer("GamepadButtonReleased",e))),this.streamMessageController.registerMessageHandler(zh.ToStreamer,"GamepadAnalog",(e=>this.sendMessageController.sendMessageToStreamer("GamepadAnalog",e))),this.streamMessageController.registerMessageHandler(zh.ToStreamer,"GamepadDisconnected",(e=>this.sendMessageController.sendMessageToStreamer("GamepadDisconnected",e))),this.streamMessageController.registerMessageHandler(zh.ToStreamer,"XRHMDTransform",(e=>this.sendMessageController.sendMessageToStreamer("XRHMDTransform",e))),this.streamMessageController.registerMessageHandler(zh.ToStreamer,"XRControllerTransform",(e=>this.sendMessageController.sendMessageToStreamer("XRControllerTransform",e))),this.streamMessageController.registerMessageHandler(zh.ToStreamer,"XRSystem",(e=>this.sendMessageController.sendMessageToStreamer("XRSystem",e))),this.streamMessageController.registerMessageHandler(zh.ToStreamer,"XRButtonTouched",(e=>this.sendMessageController.sendMessageToStreamer("XRButtonTouched",e))),this.streamMessageController.registerMessageHandler(zh.ToStreamer,"XRButtonPressed",(e=>this.sendMessageController.sendMessageToStreamer("XRButtonPressed",e))),this.streamMessageController.registerMessageHandler(zh.ToStreamer,"XRButtonReleased",(e=>this.sendMessageController.sendMessageToStreamer("XRButtonReleased",e))),this.streamMessageController.registerMessageHandler(zh.ToStreamer,"XRAnalog",(e=>this.sendMessageController.sendMessageToStreamer("XRAnalog",e)))}onCommand(e){iu.Log(iu.GetStackTrace(),"DataChannelReceiveMessageType.Command",6);const t=new TextDecoder("utf-16").decode(e.slice(1));iu.Log(iu.GetStackTrace(),"Data Channel Command: "+t,6);const n=JSON.parse(t);"onScreenKeyboard"===n.command&&this.pixelStreaming._activateOnScreenKeyboard(n)}onProtocolMessage(e){try{const t=new TextDecoder("utf-16").decode(e.slice(1)),n=JSON.parse(t);Object.prototype.hasOwnProperty.call(n,"Direction")||iu.Error(iu.GetStackTrace(),"Malformed protocol received. Ensure the protocol message contains a direction");const s=n.Direction;delete n.Direction,iu.Log(iu.GetStackTrace(),`Received new ${s==zh.FromStreamer?"FromStreamer":"ToStreamer"} protocol. Updating existing protocol...(更新现有协议)`),Object.keys(n).forEach((e=>{const t=n[e];switch(s){case zh.ToStreamer:if(!Object.prototype.hasOwnProperty.call(t,"id"))return void iu.Error(iu.GetStackTrace(),`ToStreamer->${e} protocol definition was malformed as it didn't contain at least an id\n\n Definition was: ${JSON.stringify(t,null,2)}`);if("UIInteraction"===e||"Command"===e||"LatencyTest"===e)return;this.streamMessageController.toStreamerHandlers.get(e)?this.streamMessageController.toStreamerMessages.set(e,t):iu.Error(iu.GetStackTrace(),`There was no registered handler for "${e}" - try adding one using registerMessageHandler(MessageDirection.ToStreamer, "${e}", myHandler)`);break;case zh.FromStreamer:if(!Object.prototype.hasOwnProperty.call(t,"id"))return void iu.Error(iu.GetStackTrace(),`FromStreamer->${e} protocol definition was malformed as it didn't contain at least an id\n\n Definition was: ${JSON.stringify(t,null,2)}`);this.streamMessageController.fromStreamerHandlers.get(e)?this.streamMessageController.fromStreamerMessages.set(t.id,e):iu.Error(iu.GetStackTrace(),`There was no registered handler for "${t}" - try adding one using registerMessageHandler(MessageDirection.FromStreamer, "${e}", myHandler)`);break;default:iu.Error(iu.GetStackTrace(),`Unknown direction: ${s}`)}})),this.toStreamerMessagesController.SendRequestInitialSettings(),this.toStreamerMessagesController.SendRequestQualityControl()}catch(e){iu.Log(iu.GetStackTrace(),e)}}onInputControlOwnership(e){const t=new Uint8Array(e);iu.Log(iu.GetStackTrace(),"DataChannelReceiveMessageType.InputControlOwnership",6);const n=new Boolean(t[1]).valueOf();iu.Log(iu.GetStackTrace(),`Received input controller message - will your input control the stream: ${n}`),this.pixelStreaming._onInputControlOwnership(n)}onGamepadResponse(e){const t=new TextDecoder("utf-16").decode(e.slice(1)),n=JSON.parse(t);this.gamePadController.onGamepadResponseReceived(n.controllerId)}onAfkTriggered(){this.afkController.onAfkClick(),this.videoPlayer.isPaused()&&this.videoPlayer.hasVideoSource()&&this.playStream()}setAfkEnabled(e){e?this.onAfkTriggered():this.afkController.stopAfkWarningTimer()}tryReconnect(e){this.webSocketController?(this.isReconnecting=!0,this.webSocketController.webSocket&&this.webSocketController.webSocket.readyState!=WebSocket.CLOSED?(this.closeSignalingServer(`${e} Restarting stream...`),setTimeout((()=>{this.tryReconnect(e)}),3e3)):(this.pixelStreaming._onWebRtcAutoConnect(),this.connectToSignallingServer())):iu.Log(iu.GetStackTrace(),"The Web Socket Controller does not exist so this will not work right now.")}loadFreezeFrameOrShowPlayOverlay(){this.pixelStreaming.dispatchEvent(new eh({shouldShowPlayOverlay:this.shouldShowPlayOverlay,isValid:this.freezeFrameController.valid,jpegData:this.freezeFrameController.jpeg})),!0===this.shouldShowPlayOverlay?(iu.Log(iu.GetStackTrace(),"showing play overlay"),this.resizePlayerStyle()):(iu.Log(iu.GetStackTrace(),"showing freeze frame"),this.freezeFrameController.showFreezeFrame()),setTimeout((()=>{this.videoPlayer.setVideoEnabled(!1)}),this.freezeFrameController.freezeFrameDelay)}onFreezeFrameMessage(e){iu.Log(iu.GetStackTrace(),"DataChannelReceiveMessageType.FreezeFrame",6);const t=new Uint8Array(e);this.freezeFrameController.processFreezeFrameMessage(t,(()=>this.loadFreezeFrameOrShowPlayOverlay()))}invalidateFreezeFrameAndEnableVideo(){iu.Log(iu.GetStackTrace(),"DataChannelReceiveMessageType.FreezeFrame",6),setTimeout((()=>{this.pixelStreaming.dispatchEvent(new th),this.freezeFrameController.hideFreezeFrame()}),this.freezeFrameController.freezeFrameDelay),this.videoPlayer.getVideoElement()&&this.videoPlayer.setVideoEnabled(!0)}onFileExtension(e){const t=new Uint8Array(e);jh.setExtensionFromBytes(t,this.file)}onFileMimeType(e){const t=new Uint8Array(e);jh.setMimeTypeFromBytes(t,this.file)}onFileContents(e){const t=new Uint8Array(e);jh.setContentsFromBytes(t,this.file)}playStream(){if(!this.videoPlayer.getVideoElement()){const e="Could not play video stream because the video player was not initialized correctly.";return this.pixelStreaming.dispatchEvent(new Ju({message:e})),iu.Error(iu.GetStackTrace(),e),void this.closeSignalingServer("Stream not initialized correctly")}if(this.videoPlayer.hasVideoSource()){if(this.setTouchInputEnabled(this.config.isFlagEnabled(ph.TouchInput)),this.pixelStreaming.dispatchEvent(new Yu),this.streamController.audioElement.srcObject){const e=this.config.isFlagEnabled(ph.StartVideoMuted);this.streamController.audioElement.muted=e,e?this.playVideo():this.streamController.audioElement.play().then((()=>{this.playVideo()})).catch((e=>{iu.Log(iu.GetStackTrace(),e),iu.Log(iu.GetStackTrace(),"Browser does not support autoplaying video without interaction - to resolve this we are going to show the play button overlay."),this.pixelStreaming.dispatchEvent(new Zu({reason:e}))}))}else this.playVideo();this.shouldShowPlayOverlay=!1,this.freezeFrameController.showFreezeFrame()}else iu.Warning(iu.GetStackTrace(),"Cannot play stream, the video element has no srcObject to play.")}playVideo(){this.videoPlayer.play().catch((e=>{this.streamController.audioElement.srcObject&&this.streamController.audioElement.pause(),iu.Log(iu.GetStackTrace(),e),iu.Log(iu.GetStackTrace(),"Browser does not support autoplaying video without interaction - to resolve this we are going to show the play button overlay."),this.pixelStreaming.dispatchEvent(new Zu({reason:e}))}))}autoPlayVideoOrSetUpPlayOverlay(){this.config.isFlagEnabled(ph.AutoPlayVideo)&&this.playStream(),this.resizePlayerStyle()}connectToSignallingServer(){this.locallyClosed=!1,this.shouldReconnect=!0,this.disconnectMessage=null;const e=this.signallingUrlBuilder();this.webSocketController.connect(e)}startSession(e){if(this.peerConfig=e,this.config.isFlagEnabled(ph.ForceTURN)&&!this.checkTurnServerAvailability(e))return iu.Info(iu.GetStackTrace(),"No turn server was found in the Peer Connection Options. TURN cannot be forced, closing connection. Please use STUN instead"),void this.closeSignalingServer("TURN cannot be forced, closing connection. Please use STUN instead.");this.peerConnectionController=new Vh(this.peerConfig,this.config,this.preferredCodec),this.peerConnectionController.onVideoStats=e=>this.handleVideoStats(e),this.peerConnectionController.onSendWebRTCOffer=e=>this.handleSendWebRTCOffer(e),this.peerConnectionController.onSendWebRTCAnswer=e=>this.handleSendWebRTCAnswer(e),this.peerConnectionController.onPeerIceCandidate=e=>this.handleSendIceCandidate(e),this.peerConnectionController.onDataChannel=e=>this.handleDataChannel(e),this.peerConnectionController.showTextOverlayConnecting=()=>this.pixelStreaming._onWebRtcConnecting(),this.peerConnectionController.showTextOverlaySetupFailure=()=>this.pixelStreaming._onWebRtcFailed();let t=!1;this.peerConnectionController.onIceConnectionStateChange=()=>{!t&&["connected","completed"].includes(this.peerConnectionController.peerConnection.iceConnectionState)&&(this.pixelStreaming._onWebRtcConnected(),t=!0)},this.peerConnectionController.onTrack=e=>this.streamController.handleOnTrack(e),this.config.isFlagEnabled(ph.BrowserSendOffer)&&(this.sendrecvDataChannelController.createDataChannel(this.peerConnectionController.peerConnection,"cirrus",this.datachannelOptions),this.sendrecvDataChannelController.handleOnMessage=e=>this.handleOnMessage(e),this.peerConnectionController.createOffer(this.sdpConstraints,this.config))}checkTurnServerAvailability(e){if(!e.iceServers)return iu.Info(iu.GetStackTrace(),"A turn sever was not found"),!1;for(const t of e.iceServers)for(const e of t.urls)if(e.includes("turn"))return iu.Log(iu.GetStackTrace(),`A turn sever was found at ${e}`),!0;return iu.Info(iu.GetStackTrace(),"A turn sever was not found"),!1}handleOnConfigMessage(e){this.resizePlayerStyle(),this.startSession(e.peerConnectionOptions),this.webSocketController.onWebRtcAnswer=e=>this.handleWebRtcAnswer(e),this.webSocketController.onWebRtcOffer=e=>this.handleWebRtcOffer(e),this.webSocketController.onWebRtcPeerDataChannels=e=>this.handleWebRtcSFUPeerDatachannels(e),this.webSocketController.onIceCandidate=e=>this.handleIceCandidate(e)}handleStreamerListMessage(e){var t;console.log(e,"====="),iu.Log(iu.GetStackTrace(),`Got streamer list ${e.ids}`,6);const n=null!==(t=e.streamerBusyList)&&void 0!==t?t:[];n.length>0&&(console.log(window.location.href,"======"),ou.confirm("监测到当前窗口有人在使用,是否强制进入?","警告",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((()=>{this.webSocketController.sendSubscribe(n[0].streamerId)})).catch((()=>{})));const s=[...e.ids];console.log(s),this.config.setOptionSettingOptions(bh.StreamerId,s);let r=null,o=null;const i=this.config.isFlagEnabled(ph.WaitForStreamer),a=this.config.getNumericSettingValue(fh.MaxReconnectAttempts),l=this.config.getNumericSettingValue(fh.StreamerAutoJoinInterval),c=new URLSearchParams(window.location.search);c.has(bh.StreamerId)?r=c.get(bh.StreamerId):this.subscribedStream&&(r=this.subscribedStream),r&&e.ids.includes(r)?o=r:r&&i||1!=e.ids.length||(o=e.ids[0]),o?(this.isReconnecting=!1,this.reconnectAttempt=0,this.config.setOptionSettingValue(bh.StreamerId,o)):i&&(this.reconnectAttempt<a?(this.isReconnecting=!0,this.reconnectAttempt++,setTimeout((()=>{this.webSocketController.requestStreamerList()}),l)):(this.reconnectAttempt=0,this.isReconnecting=!1,this.shouldReconnect=!1)),this.pixelStreaming.dispatchEvent(new sh({messageStreamerList:e,autoSelectedStreamerId:o,wantedStreamerId:r}))}handleWebRtcAnswer(e){iu.Log(iu.GetStackTrace(),`Got answer sdp ${e.sdp}`,6);const t={sdp:e.sdp,type:"answer"};this.peerConnectionController.receiveAnswer(t),this.handlePostWebrtcNegotiation()}handleWebRtcOffer(e){iu.Log(iu.GetStackTrace(),`Got offer sdp ${e.sdp}`,6),this.isUsingSFU=!!e.sfu&&e.sfu,this.isUsingSFU&&(this.peerConnectionController.preferredCodec="");const t={sdp:e.sdp,type:"offer"};this.peerConnectionController.receiveOffer(t,this.config),this.handlePostWebrtcNegotiation()}handleWebRtcSFUPeerDatachannels(e){const t={ordered:!0,negotiated:!0,id:e.sendStreamId},n=e.sendStreamId!=e.recvStreamId;if(this.sendrecvDataChannelController.createDataChannel(this.peerConnectionController.peerConnection,n?"send-datachannel":"datachannel",t),n){const t={ordered:!0,negotiated:!0,id:e.recvStreamId};this.recvDataChannelController.createDataChannel(this.peerConnectionController.peerConnection,"recv-datachannel",t),this.recvDataChannelController.handleOnOpen=()=>this.webSocketController.sendSFURecvDataChannelReady(),this.recvDataChannelController.handleOnMessage=e=>this.handleOnMessage(e)}else this.sendrecvDataChannelController.handleOnMessage=e=>this.handleOnMessage(e)}handlePostWebrtcNegotiation(){this.afkController.startAfkWarningTimer(),this.pixelStreaming._onWebRtcSdp(),this.statsTimerHandle&&void 0!==this.statsTimerHandle&&window.clearInterval(this.statsTimerHandle),this.statsTimerHandle=window.setInterval((()=>this.getStats()),1e3),this.setMouseInputEnabled(this.config.isFlagEnabled(ph.MouseInput)),this.setKeyboardInputEnabled(this.config.isFlagEnabled(ph.KeyboardInput)),this.setGamePadInputEnabled(this.config.isFlagEnabled(ph.GamepadInput))}handleIceCandidate(e){iu.Log(iu.GetStackTrace(),"Web RTC Controller: onWebRtcIce",6);const t=new RTCIceCandidate(e);this.peerConnectionController.handleOnIce(t)}handleSendIceCandidate(e){iu.Log(iu.GetStackTrace(),"OnIceCandidate",6),e.candidate&&e.candidate.candidate&&this.webSocketController.sendIceCandidate(e.candidate)}handleDataChannel(e){iu.Log(iu.GetStackTrace(),"Data channel created for us by browser as we are a receiving peer.",6),this.sendrecvDataChannelController.dataChannel=e.channel,this.sendrecvDataChannelController.setupDataChannel(),this.sendrecvDataChannelController.handleOnMessage=e=>this.handleOnMessage(e)}handleSendWebRTCOffer(e){iu.Log(iu.GetStackTrace(),"Sending the offer to the Server",6),this.webSocketController.sendWebRtcOffer(e)}handleSendWebRTCAnswer(e){iu.Log(iu.GetStackTrace(),"Sending the answer to the Server",6),this.webSocketController.sendWebRtcAnswer(e),this.isUsingSFU&&this.webSocketController.sendWebRtcDatachannelRequest()}setUpMouseAndFreezeFrame(){this.videoElementParentClientRect=this.videoPlayer.getVideoParentElement().getBoundingClientRect(),this.coordinateConverter.setupNormalizeAndQuantize(),this.freezeFrameController.freezeFrame.resize()}closeSignalingServer(e){var t;this.locallyClosed=!0,this.shouldReconnect=!1,this.disconnectMessage=e,null===(t=this.webSocketController)||void 0===t||t.close()}closePeerConnection(){var e;null===(e=this.peerConnectionController)||void 0===e||e.close()}close(){this.closeSignalingServer(""),this.closePeerConnection()}getStats(){this.peerConnectionController.generateStats()}sendLatencyTest(){this.latencyStartTime=Date.now(),this.streamMessageController.toStreamerHandlers.get("LatencyTest")([JSON.stringify({StartTime:this.latencyStartTime})])}sendDataChannelLatencyTest(e){this.streamMessageController.toStreamerHandlers.get("DataChannelLatencyTest")([JSON.stringify(e)])}sendEncoderMinQP(e){iu.Log(iu.GetStackTrace(),`MinQP=${e}\n`,6),null!=e&&this.streamMessageController.toStreamerHandlers.get("Command")([JSON.stringify({"Encoder.MinQP":e})])}sendEncoderMaxQP(e){iu.Log(iu.GetStackTrace(),`MaxQP=${e}\n`,6),null!=e&&this.streamMessageController.toStreamerHandlers.get("Command")([JSON.stringify({"Encoder.MaxQP":e})])}sendWebRTCMinBitrate(e){iu.Log(iu.GetStackTrace(),`WebRTC Min Bitrate=${e}`,6),null!=e&&this.streamMessageController.toStreamerHandlers.get("Command")([JSON.stringify({"WebRTC.MinBitrate":e})])}sendWebRTCMaxBitrate(e){iu.Log(iu.GetStackTrace(),`WebRTC Max Bitrate=${e}`,6),null!=e&&this.streamMessageController.toStreamerHandlers.get("Command")([JSON.stringify({"WebRTC.MaxBitrate":e})])}sendWebRTCFps(e){iu.Log(iu.GetStackTrace(),`WebRTC FPS=${e}`,6),null!=e&&(this.streamMessageController.toStreamerHandlers.get("Command")([JSON.stringify({"WebRTC.Fps":e})]),this.streamMessageController.toStreamerHandlers.get("Command")([JSON.stringify({"WebRTC.MaxFps":e})]))}sendShowFps(){iu.Log(iu.GetStackTrace(),"---- Sending show stat to UE ----",6),this.streamMessageController.toStreamerHandlers.get("Command")([JSON.stringify({"stat.fps":""})])}sendIframeRequest(){iu.Log(iu.GetStackTrace(),"---- Sending Request for an IFrame ----",6),this.streamMessageController.toStreamerHandlers.get("IFrameRequest")()}emitUIInteraction(e){iu.Log(iu.GetStackTrace(),"---- Sending custom UIInteraction message ----",6),this.streamMessageController.toStreamerHandlers.get("UIInteraction")([JSON.stringify(e)])}emitCommand(e){iu.Log(iu.GetStackTrace(),"---- Sending custom Command message ----",6),this.streamMessageController.toStreamerHandlers.get("Command")([JSON.stringify(e)])}emitConsoleCommand(e){iu.Log(iu.GetStackTrace(),"---- Sending custom Command:ConsoleCommand message ----",6),this.streamMessageController.toStreamerHandlers.get("Command")([JSON.stringify({ConsoleCommand:e})])}sendRequestQualityControlOwnership(){iu.Log(iu.GetStackTrace(),"---- Sending Request to Control Quality ----",6),this.toStreamerMessagesController.SendRequestQualityControl()}handleLatencyTestResult(e){iu.Log(iu.GetStackTrace(),"DataChannelReceiveMessageType.latencyTest",6);const t=new TextDecoder("utf-16").decode(e.slice(1)),n=new Wh;Object.assign(n,JSON.parse(t)),n.processFields(),n.testStartTimeMs=this.latencyStartTime,n.browserReceiptTimeMs=Date.now(),n.latencyExcludingDecode=~~(n.browserReceiptTimeMs-n.testStartTimeMs),n.testDuration=~~(n.TransmissionTimeMs-n.ReceiptTimeMs),n.networkLatency=~~(n.latencyExcludingDecode-n.testDuration),n.frameDisplayDeltaTimeMs&&n.browserReceiptTimeMs&&(n.endToEndLatency=(n.frameDisplayDeltaTimeMs,n.networkLatency,~~+n.CaptureToSendMs)),this.pixelStreaming._onLatencyTestResult(n)}handleDataChannelLatencyTestResponse(e){iu.Log(iu.GetStackTrace(),"DataChannelReceiveMessageType.dataChannelLatencyResponse",6);const t=new TextDecoder("utf-16").decode(e.slice(1)),n=JSON.parse(t);this.pixelStreaming._onDataChannelLatencyTestResponse(n)}handleInitialSettings(e){iu.Log(iu.GetStackTrace(),"DataChannelReceiveMessageType.InitialSettings",6);const t=new TextDecoder("utf-16").decode(e.slice(1)),n=JSON.parse(t),s=new Nh;n.Encoder&&(s.EncoderSettings=n.Encoder),n.WebRTC&&(s.WebRTCSettings=n.WebRTC),n.PixelStreaming&&(s.PixelStreamingSettings=n.PixelStreaming),n.ConfigOptions&&void 0!==n.ConfigOptions.DefaultToHover&&this.config.setFlagEnabled(ph.HoveringMouseMode,!!n.ConfigOptions.DefaultToHover),s.ueCompatible(),iu.Log(iu.GetStackTrace(),t,6),this.pixelStreaming._onInitialSettings(s)}handleVideoEncoderAvgQP(e){iu.Log(iu.GetStackTrace(),"DataChannelReceiveMessageType.VideoEncoderAvgQP",6);const t=Number(new TextDecoder("utf-16").decode(e.slice(1)));this.setVideoEncoderAvgQP(t)}handleVideoInitialized(){this.pixelStreaming._onVideoInitialized(),this.autoPlayVideoOrSetUpPlayOverlay(),this.resizePlayerStyle(),this.videoPlayer.updateVideoStreamSize()}onQualityControlOwnership(e){const t=new Uint8Array(e);iu.Log(iu.GetStackTrace(),"DataChannelReceiveMessageType.QualityControlOwnership",6),this.isQualityController=new Boolean(t[1]).valueOf(),iu.Log(iu.GetStackTrace(),`Received quality controller message, will control quality: ${this.isQualityController}`),this.pixelStreaming._onQualityControlOwnership(this.isQualityController)}handleVideoStats(e){this.pixelStreaming._onVideoStats(e)}resizePlayerStyle(){this.videoPlayer.resizePlayerStyle()}setPreferredCodec(e){this.preferredCodec=e,this.peerConnectionController&&(this.peerConnectionController.preferredCodec=e,this.peerConnectionController.updateCodecSelection=!1)}setVideoEncoderAvgQP(e){this.videoAvgQp=e,this.pixelStreaming._onVideoEncoderAvgQP(this.videoAvgQp)}setKeyboardInputEnabled(e){var t;null===(t=this.keyboardController)||void 0===t||t.unregisterKeyBoardEvents(),e&&(this.keyboardController=this.inputClassesFactory.registerKeyBoard(this.config))}setMouseInputEnabled(e){var t;if(null===(t=this.mouseController)||void 0===t||t.unregisterMouseEvents(),e){const e=this.config.isFlagEnabled(ph.HoveringMouseMode)?Eh.HoveringMouse:Eh.LockedMouse;this.mouseController=this.inputClassesFactory.registerMouse(e)}}setTouchInputEnabled(e){var t;null===(t=this.touchController)||void 0===t||t.unregisterTouchEvents(),e&&(this.touchController=this.inputClassesFactory.registerTouch(this.config.isFlagEnabled(ph.FakeMouseWithTouches),this.videoElementParentClientRect))}setGamePadInputEnabled(e){var t;null===(t=this.gamePadController)||void 0===t||t.unregisterGamePadEvents(),e&&(this.gamePadController=this.inputClassesFactory.registerGamePad(),this.gamePadController.onGamepadConnected=()=>{this.streamMessageController.toStreamerHandlers.get("GamepadConnected")()},this.gamePadController.onGamepadDisconnected=e=>{this.streamMessageController.toStreamerHandlers.get("GamepadDisconnected")([e])})}registerDataChannelEventEmitters(e){e.onOpen=(e,t)=>this.pixelStreaming.dispatchEvent(new Gu({label:e,event:t})),e.onClose=(e,t)=>this.pixelStreaming.dispatchEvent(new $u({label:e,event:t})),e.onError=(e,t)=>this.pixelStreaming.dispatchEvent(new Wu({label:e,event:t}))}registerMessageHandler(e,t,n){t===zh.FromStreamer&&void 0===n&&iu.Warning(iu.GetStackTrace(),`Unable to register handler for ${e} as no handler was passed`),this.streamMessageController.registerMessageHandler(t,e,(s=>void 0===n&&t===zh.ToStreamer?this.sendMessageController.sendMessageToStreamer(e,s):n(s)))}}class yg{static vertexShader(){return"\n\t\tattribute vec2 a_position;\n\t\tattribute vec2 a_texCoord;\n\n\t\t// input\n\t\tuniform vec2 u_resolution;\n\t\tuniform vec4 u_offset;\n\n\t\t//\n\t\tvarying vec2 v_texCoord;\n\n\t\tvoid main() {\n\t\t // convert the rectangle from pixels to 0.0 to 1.0\n\t\t vec2 zeroToOne = a_position / u_resolution;\n\n\t\t // convert from 0->1 to 0->2\n\t\t vec2 zeroToTwo = zeroToOne * 2.0;\n\n\t\t // convert from 0->2 to -1->+1 (clipspace)\n\t\t vec2 clipSpace = zeroToTwo - 1.0;\n\n\t\t gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1);\n\t\t // pass the texCoord to the fragment shader\n\t\t // The GPU will interpolate this value between points.\n\t\t v_texCoord = (a_texCoord * u_offset.xy) + u_offset.zw;\n\t\t}\n\t\t"}static fragmentShader(){return"\n\t\tprecision mediump float;\n\n\t\t// our texture\n\t\tuniform sampler2D u_image;\n\n\t\t// the texCoords passed in from the vertex shader.\n\t\tvarying vec2 v_texCoord;\n\n\t\tvoid main() {\n\t\t gl_FragColor = texture2D(u_image, v_texCoord);\n\t\t}\n\t\t"}}class bg{static deepCopyGamepad(e){return JSON.parse(JSON.stringify({buttons:e.buttons.map((e=>JSON.parse(JSON.stringify({pressed:e.pressed,touched:e.touched})))),axes:e.axes}))}}class Cg{constructor(e){this.toStreamerMessagesProvider=e,this.controllers=[]}updateStatus(e,t,n){if(e.gamepad){const s=t.getPose(e.gripSpace,n);if(!s)return;let r=0;e.profiles.includes("htc-vive")?r=1:e.profiles.includes("oculus-touch")&&(r=2),this.toStreamerMessagesProvider.toStreamerHandlers.get("XRSystem")([r]);let o=2;switch(e.handedness){case"left":o=0;break;case"right":o=1}const i=s.transform.matrix,a=[];for(let e=0;e<16;e++)a[e]=new Float32Array([i[e]])[0];this.toStreamerMessagesProvider.toStreamerHandlers.get("XRControllerTransform")([a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15],o]),void 0===this.controllers[o]&&(this.controllers[o]={prevState:void 0,currentState:void 0,id:void 0},this.controllers[o].prevState=bg.deepCopyGamepad(e.gamepad)),this.controllers[o].currentState=bg.deepCopyGamepad(e.gamepad);const l=this.controllers[o],c=l.currentState,d=l.prevState;for(let e=0;e<c.buttons.length;e++){const t=c.buttons[e],n=d.buttons[e];t.pressed?this.toStreamerMessagesProvider.toStreamerHandlers.get("XRButtonPressed")([o,e,n.pressed?1:0]):!t.pressed&&n.pressed&&this.toStreamerMessagesProvider.toStreamerHandlers.get("XRButtonReleased")([o,e,0]),t.touched&&!t.pressed?this.toStreamerMessagesProvider.toStreamerHandlers.get("XRButtonPressed")([o,3,n.touched?1:0]):!t.touched&&n.touched&&this.toStreamerMessagesProvider.toStreamerHandlers.get("XRButtonReleased")([o,3,0])}for(let e=0;e<c.axes.length;e++)this.toStreamerMessagesProvider.toStreamerHandlers.get("XRAnalog")([o,e,c.axes[e]]);this.controllers[o].prevState=c}}}class wg{constructor(e){this.xrSession=null,this.webRtcController=e,this.xrControllers=[],this.xrGamepadController=new Cg(this.webRtcController.streamMessageController),this.onSessionEnded=new EventTarget,this.onSessionStarted=new EventTarget,this.onFrame=new EventTarget}xrClicked(){this.xrSession?this.xrSession.end():navigator.xr.requestSession("immersive-vr").then((e=>{this.onXrSessionStarted(e)}))}onXrSessionEnded(){iu.Log(iu.GetStackTrace(),"XR Session ended"),this.xrSession=null,this.onSessionEnded.dispatchEvent(new Event("xrSessionEnded"))}onXrSessionStarted(e){iu.Log(iu.GetStackTrace(),"XR Session started"),this.xrSession=e,this.xrSession.addEventListener("end",(()=>{this.onXrSessionEnded()}));const t=document.createElement("canvas");this.gl=t.getContext("webgl2",{xrCompatible:!0}),this.xrSession.updateRenderState({baseLayer:new XRWebGLLayer(this.xrSession,this.gl)});const n=this.gl.createShader(this.gl.VERTEX_SHADER);this.gl.shaderSource(n,yg.vertexShader()),this.gl.compileShader(n);const s=this.gl.createShader(this.gl.FRAGMENT_SHADER);this.gl.shaderSource(s,yg.fragmentShader()),this.gl.compileShader(s);const r=this.gl.createProgram();this.gl.attachShader(r,n),this.gl.attachShader(r,s),this.gl.linkProgram(r),this.gl.useProgram(r),this.positionLocation=this.gl.getAttribLocation(r,"a_position"),this.texcoordLocation=this.gl.getAttribLocation(r,"a_texCoord"),this.positionBuffer=this.gl.createBuffer(),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.positionBuffer),this.gl.enableVertexAttribArray(this.positionLocation);const o=this.gl.createTexture();this.gl.bindTexture(this.gl.TEXTURE_2D,o),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.NEAREST),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.NEAREST),this.texcoordBuffer=this.gl.createBuffer(),this.resolutionLocation=this.gl.getUniformLocation(r,"u_resolution"),this.offsetLocation=this.gl.getUniformLocation(r,"u_offset"),e.requestReferenceSpace("local").then((e=>{this.xrRefSpace=e,this.xrSession.requestAnimationFrame(((e,t)=>this.onXrFrame(e,t)))})),this.onSessionStarted.dispatchEvent(new Event("xrSessionStarted"))}onXrFrame(e,t){const n=t.getViewerPose(this.xrRefSpace);if(n){const e=n.transform.matrix,t=[];for(let n=0;n<16;n++)t[n]=new Float32Array([e[n]])[0];this.webRtcController.streamMessageController.toStreamerHandlers.get("XRHMDTransform")([t[0],t[4],t[8],t[12],t[1],t[5],t[9],t[13],t[2],t[6],t[10],t[14],t[3],t[7],t[11],t[15]]);const s=this.xrSession.renderState.baseLayer;this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,s.framebuffer),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,this.webRtcController.videoPlayer.getVideoElement()),this.render(this.webRtcController.videoPlayer.getVideoElement())}this.webRtcController.config.isFlagEnabled(ph.XRControllerInput)&&this.xrSession.inputSources.forEach(((e,n,s)=>{this.xrGamepadController.updateStatus(e,t,this.xrRefSpace)}),this),this.xrSession.requestAnimationFrame(((e,t)=>this.onXrFrame(e,t))),this.onFrame.dispatchEvent(new uh({time:e,frame:t}))}render(e){if(!this.gl)return;const t=this.xrSession.renderState.baseLayer;let n,s,r,o,i;this.gl.viewport(0,0,t.framebufferWidth,t.framebufferHeight),this.gl.uniform4f(this.offsetLocation,1,1,0,0),this.gl.bufferData(this.gl.ARRAY_BUFFER,new Float32Array([0,0,e.videoWidth,0,0,e.videoHeight,0,e.videoHeight,e.videoWidth,0,e.videoWidth,e.videoHeight]),this.gl.STATIC_DRAW),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.texcoordBuffer),this.gl.bufferData(this.gl.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]),this.gl.STATIC_DRAW),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.positionBuffer),n=2,s=this.gl.FLOAT,r=!1,o=0,i=0,this.gl.vertexAttribPointer(this.positionLocation,n,s,r,o,i),this.gl.enableVertexAttribArray(this.texcoordLocation),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.texcoordBuffer),n=2,s=this.gl.FLOAT,r=!1,o=0,i=0,this.gl.vertexAttribPointer(this.texcoordLocation,n,s,r,o,i),this.gl.uniform2f(this.resolutionLocation,e.videoWidth,e.videoHeight);const a=this.gl.TRIANGLES;i=0,this.gl.drawArrays(a,i,6)}static isSessionSupported(e){return navigator.xr?navigator.xr.isSessionSupported(e):new Promise((()=>!1))}}class Eg{constructor(e){this.editTextButton=null,this.hiddenInput=null,"ontouchstart"in document.documentElement&&this.createOnScreenKeyboardHelpers(e)}unquantizeAndDenormalizeUnsigned(e,t){return null}createOnScreenKeyboardHelpers(e){this.hiddenInput||(this.hiddenInput=document.createElement("input"),this.hiddenInput.id="hiddenInput",this.hiddenInput.maxLength=0,e.appendChild(this.hiddenInput)),this.editTextButton||(this.editTextButton=document.createElement("button"),this.editTextButton.id="editTextButton",this.editTextButton.innerHTML="edit text",e.appendChild(this.editTextButton),this.editTextButton.classList.add("hiddenState"),this.editTextButton.addEventListener("touchend",(e=>{this.hiddenInput.focus(),e.preventDefault()})))}showOnScreenKeyboard(e){if(e.showOnScreenKeyboard){this.editTextButton.classList.remove("hiddenState");const t=this.unquantizeAndDenormalizeUnsigned(e.x,e.y);this.editTextButton.style.top=t.y.toString()+"px",this.editTextButton.style.left=(t.x-40).toString()+"px"}else this.editTextButton.classList.add("hiddenState"),this.hiddenInput.blur()}}class Tg{constructor(e){this.seq=e.Seq,this.playerSentTimestamp=Date.now(),this.requestFillerSize=e.Filler?e.Filler.length:0}update(e){this.playerReceivedTimestamp=Date.now(),this.streamerReceivedTimestamp=e.ReceivedTimestamp,this.streamerSentTimestamp=e.SentTimestamp,this.responseFillerSize=e.Filler?e.Filler.length:0}}class Mg{constructor(e,t){this.sink=e,this.callback=t,this.records=new Map,this.seq=0}start(e){return!this.isRunning()&&(this.startTime=Date.now(),this.records.clear(),this.interval=setInterval((()=>{Date.now()-this.startTime>=e.duration?this.stop():this.sendRequest(e.requestSize,e.responseSize)}).bind(this),Math.floor(1e3/e.rps)),!0)}stop(){this.interval&&(clearInterval(this.interval),this.interval=void 0,this.callback(this.produceResult()))}produceResult(){const e=new Map(this.records);return{records:e,dataChannelRtt:Math.ceil(Array.from(this.records.values()).reduce(((e,t)=>e+(t.playerReceivedTimestamp-t.playerSentTimestamp)),0)/this.records.size),playerToStreamerTime:Math.ceil(Array.from(this.records.values()).reduce(((e,t)=>e+(t.streamerReceivedTimestamp-t.playerSentTimestamp)),0)/this.records.size),streamerToPlayerTime:Math.ceil(Array.from(this.records.values()).reduce(((e,t)=>e+(t.playerReceivedTimestamp-t.streamerSentTimestamp)),0)/this.records.size),exportLatencyAsCSV:()=>{let t="Timestamp;RTT;PlayerToStreamer;StreamerToPlayer;\n";return e.forEach((e=>{t+=e.playerSentTimestamp+";",t+=e.playerReceivedTimestamp-e.playerSentTimestamp+";",t+=e.streamerReceivedTimestamp-e.playerSentTimestamp+";",t+=e.playerReceivedTimestamp-e.streamerSentTimestamp+";",t+="\n"})),t}}}isRunning(){return!!this.interval}receive(e){if(!this.isRunning())return;if(!e)return void iu.Error(iu.GetStackTrace(),"Undefined response from server");let t=this.records.get(e.Seq);t&&t.update(e)}sendRequest(e,t){let n=this.createRequest(e,t),s=new Tg(n);this.records.set(s.seq,s),this.sink(n)}createRequest(e,t){return{Seq:this.seq++,FillResponseSize:t,Filler:e?"A".repeat(e):""}}}class _g{constructor(e,t){this.allowConsoleCommands=!1,this.config=e,(null==t?void 0:t.videoElementParent)&&(this._videoElementParent=t.videoElementParent),this._eventEmitter=new gh,this.configureSettings(),this.setWebRtcPlayerController(new Sg(this.config,this)),this.onScreenKeyboardHelper=new Eg(this.videoElementParent),this.onScreenKeyboardHelper.unquantizeAndDenormalizeUnsigned=(e,t)=>this._webRtcController.requestUnquantizedAndDenormalizeUnsigned(e,t),this._activateOnScreenKeyboard=e=>this.onScreenKeyboardHelper.showOnScreenKeyboard(e),this._webXrController=new wg(this._webRtcController)}get videoElementParent(){return this._videoElementParent||(this._videoElementParent=document.createElement("div"),this._videoElementParent.id="videoElementParent"),this._videoElementParent}configureSettings(){this.config._addOnSettingChangedListener(ph.IsQualityController,(e=>{!0!==e||this._webRtcController.isQualityController||this._webRtcController.sendRequestQualityControlOwnership()})),this.config._addOnSettingChangedListener(ph.AFKDetection,(e=>{this._webRtcController.setAfkEnabled(e)})),this.config._addOnSettingChangedListener(ph.MatchViewportResolution,(()=>{this._webRtcController.videoPlayer.updateVideoStreamSize()})),this.config._addOnSettingChangedListener(ph.HoveringMouseMode,(e=>{this.config.setFlagLabel(ph.HoveringMouseMode,`Control Scheme: ${e?"Hovering":"Locked"} Mouse`),this._webRtcController.setMouseInputEnabled(this.config.isFlagEnabled(ph.MouseInput))})),this.config._addOnSettingChangedListener(ph.KeyboardInput,(e=>{this._webRtcController.setKeyboardInputEnabled(e)})),this.config._addOnSettingChangedListener(ph.MouseInput,(e=>{this._webRtcController.setMouseInputEnabled(e)})),this.config._addOnSettingChangedListener(ph.TouchInput,(e=>{this._webRtcController.setTouchInputEnabled(e)})),this.config._addOnSettingChangedListener(ph.GamepadInput,(e=>{this._webRtcController.setGamePadInputEnabled(e)})),this.config._addOnNumericSettingChangedListener(fh.MinQP,(e=>{iu.Log(iu.GetStackTrace(),"-------- Sending MinQP --------",7),this._webRtcController.sendEncoderMinQP(e),iu.Log(iu.GetStackTrace(),"-------------------------------------------",7)})),this.config._addOnNumericSettingChangedListener(fh.MaxQP,(e=>{iu.Log(iu.GetStackTrace(),"-------- Sending encoder settings --------",7),this._webRtcController.sendEncoderMaxQP(e),iu.Log(iu.GetStackTrace(),"-------------------------------------------",7)})),this.config._addOnNumericSettingChangedListener(fh.WebRTCMinBitrate,(e=>{iu.Log(iu.GetStackTrace(),"-------- Sending web rtc settings --------",7),this._webRtcController.sendWebRTCMinBitrate(1e3*e),iu.Log(iu.GetStackTrace(),"-------------------------------------------",7)})),this.config._addOnNumericSettingChangedListener(fh.WebRTCMaxBitrate,(e=>{iu.Log(iu.GetStackTrace(),"-------- Sending web rtc settings --------",7),this._webRtcController.sendWebRTCMaxBitrate(1e3*e),iu.Log(iu.GetStackTrace(),"-------------------------------------------",7)})),this.config._addOnNumericSettingChangedListener(fh.WebRTCFPS,(e=>{iu.Log(iu.GetStackTrace(),"-------- Sending web rtc settings --------",7),this._webRtcController.sendWebRTCFps(e),iu.Log(iu.GetStackTrace(),"-------------------------------------------",7)})),this.config._addOnOptionSettingChangedListener(bh.PreferredCodec,(e=>{this._webRtcController&&this._webRtcController.setPreferredCodec(e)})),this.config._registerOnChangeEvents(this._eventEmitter)}_activateOnScreenKeyboard(e){throw new Error("Method not implemented.")}_onInputControlOwnership(e){this._inputController=e}setWebRtcPlayerController(e){this._webRtcController=e,this._webRtcController.setPreferredCodec(this.config.getSettingOption(bh.PreferredCodec).selected),this._webRtcController.resizePlayerStyle(),this.checkForAutoConnect()}connect(){this._eventEmitter.dispatchEvent(new qu),this._webRtcController.connectToSignallingServer()}reconnect(){this._eventEmitter.dispatchEvent(new Xu),this._webRtcController.tryReconnect("Reconnecting...")}disconnect(){this._eventEmitter.dispatchEvent(new Qu),this._webRtcController.close()}play(){this._onStreamLoading(),this._webRtcController.playStream()}checkForAutoConnect(){console.log(this.config.isFlagEnabled(ph.AutoConnect),"====ssss"),this.config.isFlagEnabled(ph.AutoConnect)&&(this._onWebRtcAutoConnect(),this._webRtcController.connectToSignallingServer())}unmuteMicrophone(e=!1){if(!this.config.isFlagEnabled("UseMic"))return e?(this.config.setFlagEnabled("UseMic",!0),void this.reconnect()):void iu.Warning(iu.GetStackTrace(),"Trying to unmute mic, but PixelStreaming was initialized with no microphone track. Call with forceEnable == true to re-connect with a mic track.");this.setMicrophoneMuted(!1)}muteMicrophone(){this.config.isFlagEnabled("UseMic")?this.setMicrophoneMuted(!0):iu.Info(iu.GetStackTrace(),"Trying to mute mic, but PixelStreaming has no microphone track, so sending sound is already disabled.")}setMicrophoneMuted(e){var t,n,s,r;for(const o of null!==(r=null===(s=null===(n=null===(t=this._webRtcController)||void 0===t?void 0:t.peerConnectionController)||void 0===n?void 0:n.peerConnection)||void 0===s?void 0:s.getTransceivers())&&void 0!==r?r:[])Dh.canTransceiverSendAudio(o)&&(o.sender.track.enabled=!e)}_onWebRtcAutoConnect(){this._eventEmitter.dispatchEvent(new zu)}_onWebRtcSdp(){this._eventEmitter.dispatchEvent(new Bu)}_onStreamLoading(){this._eventEmitter.dispatchEvent(new Ku)}_onDisconnect(e,t){this._eventEmitter.dispatchEvent(new Hu({eventString:e,allowClickToReconnect:t}))}_onWebRtcConnecting(){this._eventEmitter.dispatchEvent(new Uu)}_onWebRtcConnected(){this._eventEmitter.dispatchEvent(new Vu)}_onWebRtcFailed(){this._eventEmitter.dispatchEvent(new Nu)}_onVideoInitialized(){this._eventEmitter.dispatchEvent(new ju),this._videoStartTime=Date.now()}_onLatencyTestResult(e){this._eventEmitter.dispatchEvent(new rh({latencyTimings:e}))}_onDataChannelLatencyTestResponse(e){this._eventEmitter.dispatchEvent(new oh({response:e}))}_onVideoStats(e){this._videoStartTime&&void 0!==this._videoStartTime||(this._videoStartTime=Date.now()),e.handleSessionStatistics(this._videoStartTime,this._inputController,this._webRtcController.videoAvgQp),this._eventEmitter.dispatchEvent(new nh({aggregatedStats:e}))}_onVideoEncoderAvgQP(e){this._eventEmitter.dispatchEvent(new Du({avgQP:e}))}_onInitialSettings(e){var t;this._eventEmitter.dispatchEvent(new ah({settings:e})),e.PixelStreamingSettings&&(this.allowConsoleCommands=null!==(t=e.PixelStreamingSettings.AllowPixelStreamingCommands)&&void 0!==t&&t,!1===this.allowConsoleCommands&&iu.Info(iu.GetStackTrace(),"-AllowPixelStreamingCommands=false, sending arbitrary console commands from browser to UE is disabled."));const n=this.config.useUrlParams,s=new URLSearchParams(window.location.search);e.EncoderSettings&&(this.config.setNumericSetting(fh.MinQP,n&&s.has(fh.MinQP)?Number.parseInt(s.get(fh.MinQP)):e.EncoderSettings.MinQP),this.config.setNumericSetting(fh.MaxQP,n&&s.has(fh.MaxQP)?Number.parseInt(s.get(fh.MaxQP)):e.EncoderSettings.MaxQP)),e.WebRTCSettings&&(this.config.setNumericSetting(fh.WebRTCMinBitrate,n&&s.has(fh.WebRTCMinBitrate)?Number.parseInt(s.get(fh.WebRTCMinBitrate)):e.WebRTCSettings.MinBitrate/1e3),this.config.setNumericSetting(fh.WebRTCMaxBitrate,n&&s.has(fh.WebRTCMaxBitrate)?Number.parseInt(s.get(fh.WebRTCMaxBitrate)):e.WebRTCSettings.MaxBitrate/1e3),this.config.setNumericSetting(fh.WebRTCFPS,n&&s.has(fh.WebRTCFPS)?Number.parseInt(s.get(fh.WebRTCFPS)):e.WebRTCSettings.FPS))}_onQualityControlOwnership(e){this.config.setFlagEnabled(ph.IsQualityController,e)}_onPlayerCount(e){this._eventEmitter.dispatchEvent(new hh({count:e}))}requestLatencyTest(){return!!this._webRtcController.videoPlayer.isVideoReady()&&(this._webRtcController.sendLatencyTest(),!0)}requestDataChannelLatencyTest(e){return!!this._webRtcController.videoPlayer.isVideoReady()&&(this._dataChannelLatencyTestController||(this._dataChannelLatencyTestController=new Mg(this._webRtcController.sendDataChannelLatencyTest.bind(this._webRtcController),(e=>{this._eventEmitter.dispatchEvent(new ih({result:e}))})),this.addEventListener("dataChannelLatencyTestResponse",(({data:{response:e}})=>{this._dataChannelLatencyTestController.receive(e)}))),this._dataChannelLatencyTestController.start(e))}requestShowFps(){return!!this._webRtcController.videoPlayer.isVideoReady()&&(this._webRtcController.sendShowFps(),!0)}requestIframe(){return!!this._webRtcController.videoPlayer.isVideoReady()&&(this._webRtcController.sendIframeRequest(),!0)}emitUIInteraction(e){return!!this._webRtcController.videoPlayer.isVideoReady()&&(this._webRtcController.emitUIInteraction(e),!0)}emitCommand(e){return!(!this._webRtcController.videoPlayer.isVideoReady()||!this.allowConsoleCommands&&"ConsoleCommand"in e||(this._webRtcController.emitCommand(e),0))}emitConsoleCommand(e){return!(!this.allowConsoleCommands||!this._webRtcController.videoPlayer.isVideoReady()||(this._webRtcController.emitConsoleCommand(e),0))}addResponseEventListener(e,t){this._webRtcController.responseController.addResponseEventListener(e,t)}removeResponseEventListener(e){this._webRtcController.responseController.removeResponseEventListener(e)}dispatchEvent(e){return this._eventEmitter.dispatchEvent(e)}addEventListener(e,t){this._eventEmitter.addEventListener(e,t)}removeEventListener(e,t){this._eventEmitter.removeEventListener(e,t)}toggleXR(){this.webXrController.xrClicked()}setSignallingUrlBuilder(e){this._webRtcController.signallingUrlBuilder=e}get webSocketController(){return this._webRtcController.webSocketController}get webXrController(){return this._webXrController}registerMessageHandler(e,t,n){t!==zh.FromStreamer||void 0!==n?t===zh.ToStreamer&&void 0===n?this._webRtcController.streamMessageController.registerMessageHandler(t,e,(t=>this._webRtcController.sendMessageController.sendMessageToStreamer(e,t))):this._webRtcController.streamMessageController.registerMessageHandler(t,e,(e=>n(e))):iu.Warning(iu.GetStackTrace(),`Unable to register an undefined handler for ${e}`)}get toStreamerHandlers(){return this._webRtcController.streamMessageController.toStreamerHandlers}isReconnecting(){return this._webRtcController.isReconnecting}}})(),r})()));