diff --git a/index.1fa1a322.js b/index.7aa41aa8.js similarity index 99% rename from index.1fa1a322.js rename to index.7aa41aa8.js index e0da38c95..f08a6ac99 100644 --- a/index.1fa1a322.js +++ b/index.7aa41aa8.js @@ -913,7 +913,7 @@ t=0 0\r `},t.getDirection=function(i,a){const r=t.splitLines(i);for(let n=0;n(i.candidate&&Object.defineProperty(i,"candidate",{value:new e.RTCIceCandidate(i.candidate),writable:"false"}),i))}function _f(e){!e.RTCIceCandidate||e.RTCIceCandidate&&"relayProtocol"in e.RTCIceCandidate.prototype||kn(e,"icecandidate",t=>{if(t.candidate){const i=$6.parseCandidate(t.candidate.candidate);i.type==="relay"&&(t.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[i.priority>>24])}return t})}function lc(e,t){if(!e.RTCPeerConnection)return;"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get(){return typeof this._sctp>"u"?null:this._sctp}});const i=function(s){if(!s||!s.sdp)return!1;const l=$6.splitSections(s.sdp);return l.shift(),l.some(d=>{const C=$6.parseMLine(d);return C&&C.kind==="application"&&C.protocol.indexOf("SCTP")!==-1})},a=function(s){const l=s.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(l===null||l.length<2)return-1;const d=parseInt(l[1],10);return d!==d?-1:d},r=function(s){let l=65536;return t.browser==="firefox"&&(t.version<57?s===-1?l=16384:l=2147483637:t.version<60?l=t.version===57?65535:65536:l=2147483637),l},n=function(s,l){let d=65536;t.browser==="firefox"&&t.version===57&&(d=65535);const C=$6.matchPrefix(s.sdp,"a=max-message-size:");return C.length>0?d=parseInt(C[0].substring(19),10):t.browser==="firefox"&&l!==-1&&(d=2147483637),d},o=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,t.browser==="chrome"&&t.version>=76){const{sdpSemantics:l}=this.getConfiguration();l==="plan-b"&&Object.defineProperty(this,"sctp",{get(){return typeof this._sctp>"u"?null:this._sctp},enumerable:!0,configurable:!0})}if(i(arguments[0])){const l=a(arguments[0]),d=r(l),C=n(arguments[0],l);let m;d===0&&C===0?m=Number.POSITIVE_INFINITY:d===0||C===0?m=Math.max(d,C):m=Math.min(d,C);const u={};Object.defineProperty(u,"maxMessageSize",{get(){return m}}),this._sctp=u}return o.apply(this,arguments)}}function cc(e){if(!(e.RTCPeerConnection&&"createDataChannel"in e.RTCPeerConnection.prototype))return;function t(a,r){const n=a.send;a.send=function(){const s=arguments[0],l=s.length||s.size||s.byteLength;if(a.readyState==="open"&&r.sctp&&l>r.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+r.sctp.maxMessageSize+" bytes)");return n.apply(a,arguments)}}const i=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){const r=i.apply(this,arguments);return t(r,this),r},kn(e,"datachannel",a=>(t(a.channel,a.target),a))}function Sf(e){if(!e.RTCPeerConnection||"connectionState"in e.RTCPeerConnection.prototype)return;const t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(i){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),i&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=i)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(i=>{const a=t[i];t[i]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=r=>{const n=r.target;if(n._lastConnectionState!==n.connectionState){n._lastConnectionState=n.connectionState;const o=new Event("connectionstatechange",r);n.dispatchEvent(o)}return r},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),a.apply(this,arguments)}})}function Df(e,t){if(!e.RTCPeerConnection||t.browser==="chrome"&&t.version>=71||t.browser==="safari"&&t.version>=605)return;const i=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(r){if(r&&r.sdp&&r.sdp.indexOf(` a=extmap-allow-mixed`)!==-1){const n=r.sdp.split(` `).filter(o=>o.trim()!=="a=extmap-allow-mixed").join(` -`);e.RTCSessionDescription&&r instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:r.type,sdp:n}):r.sdp=n}return i.apply(this,arguments)}}function dc(e,t){if(!(e.RTCPeerConnection&&e.RTCPeerConnection.prototype))return;const i=e.RTCPeerConnection.prototype.addIceCandidate;!i||i.length===0||(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?(t.browser==="chrome"&&t.version<78||t.browser==="firefox"&&t.version<68||t.browser==="safari")&&arguments[0]&&arguments[0].candidate===""?Promise.resolve():i.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function Cc(e,t){if(!(e.RTCPeerConnection&&e.RTCPeerConnection.prototype))return;const i=e.RTCPeerConnection.prototype.setLocalDescription;!i||i.length===0||(e.RTCPeerConnection.prototype.setLocalDescription=function(){let r=arguments[0]||{};if(typeof r!="object"||r.type&&r.sdp)return i.apply(this,arguments);if(r={type:r.type,sdp:r.sdp},!r.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":r.type="offer";break;default:r.type="answer";break}return r.sdp||r.type!=="offer"&&r.type!=="answer"?i.apply(this,[r]):(r.type==="offer"?this.createOffer:this.createAnswer).apply(this).then(o=>i.apply(this,[o]))})}const le2=Object.freeze(Object.defineProperty({__proto__:null,shimRTCIceCandidate:sc,shimRTCIceCandidateRelayProtocol:_f,shimMaxMessageSize:lc,shimSendThrowTypeError:cc,shimConnectionState:Sf,removeExtmapAllowMixed:Df,shimAddIceCandidateNullOrEmpty:dc,shimParameterlessSetLocalDescription:Cc},Symbol.toStringTag,{value:"Module"}));function ce2({window:e}={},t={shimChrome:!0,shimFirefox:!0,shimSafari:!0}){const i=Ft1,a=re2(e),r={browserDetails:a,commonShim:le2,extractVersion:oc,disableLog:ie2,disableWarnings:ae2,sdp:se2};switch(a.browser){case"chrome":if(!TD||!Af||!t.shimChrome)return i("Chrome shim is not included in this adapter release."),r;if(a.version===null)return i("Chrome shim can not determine version, not shimming."),r;i("adapter.js shimming chrome."),r.browserShim=TD,dc(e,a),Cc(e),Bt1(e,a),zt1(e),Af(e,a),Zt1(e),$t1(e,a),Gt1(e),Wt1(e),Xt1(e),qt1(e,a),sc(e),_f(e),Sf(e),lc(e,a),cc(e),Df(e,a);break;case"firefox":if(!ED||!vf||!t.shimFirefox)return i("Firefox shim is not included in this adapter release."),r;i("adapter.js shimming firefox."),r.browserShim=ED,dc(e,a),Cc(e),Kt1(e,a),vf(e,a),jt1(e),e01(e),Qt1(e),Jt1(e),t01(e),i01(e),a01(e),r01(e),n01(e),sc(e),Sf(e),lc(e,a),cc(e);break;case"safari":if(!PD||!t.shimSafari)return i("Safari shim is not included in this adapter release."),r;i("adapter.js shimming safari."),r.browserShim=PD,dc(e,a),Cc(e),C01(e),u01(e),l01(e),o01(e),s01(e),m01(e),c01(e),h01(e),sc(e),_f(e),lc(e,a),cc(e),Df(e,a);break;default:i("Unsupported browser!");break}return r}const de2=ce2({window:typeof window>"u"?void 0:window});class Ce2{constructor(t,i,a,r,n,o=[],s,l,d){S1(this,"id");S1(this,"consumerId");S1(this,"stream");S1(this,"status");S1(this,"ended");S1(this,"signaller");S1(this,"peerConnection");S1(this,"availableICEIPs");S1(this,"selectedICEIPs");S1(this,"rtcConfiguration");S1(this,"onTrackAdded");S1(this,"onNewIceRemoteAddress");S1(this,"onClose");this.id=t,this.consumerId=i,this.stream=a,this.onTrackAdded=s,this.onNewIceRemoteAddress=l,this.onClose=d,this.status="",this.signaller=r,this.rtcConfiguration=n,this.ended=!1,this.availableICEIPs=[],this.selectedICEIPs=o,this.peerConnection=this.createRTCPeerConnection(n),this.updateStatus("[WebRTC] [Session] Creating Session...")}hasEnded(){return this.ended}isConnected(){return this.peerConnection.connectionState=="connected"}updateStatus(t){this.status=t}createRTCPeerConnection(t){console.debug("[WebRTC] [Session] Creating RTCPeerConnection");const i=new RTCPeerConnection(t);return i.addTransceiver("video",{direction:"recvonly"}),this.ended=!1,i.addEventListener("negotiationneeded",this.onNegotiationNeeded.bind(this)),i.addEventListener("track",this.onTrackAddedCallback.bind(this)),i.addEventListener("icecandidate",this.onIceCandidate.bind(this)),i.addEventListener("icecandidateerror",this.onIceCandidateError.bind(this)),i.addEventListener("iceconnectionstatechange",this.onIceConnectionStateChange.bind(this)),i.addEventListener("connectionstatechange",this.onConnectionStateChange.bind(this)),i.addEventListener("signalingstatechange",this.onSignalingStateChange.bind(this)),i.addEventListener("icegatheringstatechange",this.onIceGatheringStateChange.bind(this)),i}onIncomingSDP(t){this.peerConnection.setRemoteDescription(t).then(()=>{console.debug(`[WebRTC] [Session] Remote description set to ${JSON.stringify(t,null,4)}`),this.onRemoteDescriptionSet()}).catch(i=>console.error(`[WebRTC] [Session] Failed setting remote description ${t}. Reason: ${i}`))}onRemoteDescriptionSet(){this.peerConnection.createAnswer().then(t=>{console.debug(`[WebRTC] [Session] SDP Answer created as: ${JSON.stringify(t,null,4)}`),this.onAnswerCreated(t)}).catch(t=>console.error(`[WebRTC] [Session] Failed creating description answer. Reason: ${t}`))}onAnswerCreated(t){this.peerConnection.setLocalDescription(t).then(()=>{console.debug(`[WebRTC] [Session] Local description set as${JSON.stringify(t,null,4)}`),this.onLocalDescriptionSet()}).catch(function(i){console.error(`[WebRTC] [Session] Failed setting local description. Reason: ${i}`)})}onLocalDescriptionSet(){this.peerConnection.localDescription!==null&&this.signaller.sendMediaNegotiation(this.id,this.consumerId,this.stream.id,this.peerConnection.localDescription)}onIncomingICE(t){const i=/\b(?:\d{1,3}\.){3}\d{1,3}\b/g,r=(n=>{const o=n.match(i);return o==null?void 0:o.find(s=>!s.includes(":"))})(t.candidate);if(r&&!this.availableICEIPs.includes(r)&&this.onNewIceRemoteAddress&&(this.availableICEIPs.push(r),this.onNewIceRemoteAddress(this.availableICEIPs)),t.candidate&&Array.isArray(this.selectedICEIPs)&&!this.selectedICEIPs.isEmpty()&&!this.selectedICEIPs.some(n=>t.candidate.includes(n))){console.debug(`[WebRTC] [Session] ICE candidate ignored: ${JSON.stringify(t,null,4)}`);return}this.peerConnection.addIceCandidate(t).then(()=>console.debug(`[WebRTC] [Session] ICE candidate added: ${JSON.stringify(t,null,4)}`)).catch(n=>console.error(`[WebRTC] [Session] Failed adding ICE candidate ${t}. Reason: ${n}`))}onIceCandidate(t){!t.candidate||this.signaller.sendIceNegotiation(this.id,this.consumerId,this.stream.id,t.candidate)}onIceCandidateError(t){console.debug(`[WebRTC] [Session] ICE Candidate "${t.url}" negotiation failed`)}onTrackAddedCallback(t){var i;(i=this.onTrackAdded)==null||i.call(this,t)}onNegotiationNeeded(t){console.debug("[WebRTC] [Session] Peer Connection is waiting for negotiation...")}onIceConnectionStateChange(){const t=`ICEConnection state changed to "${this.peerConnection.iceConnectionState}"`;console.debug("[WebRTC] [Session] "+t),this.peerConnection.iceConnectionState==="failed"&&this.peerConnection.restartIce()}onConnectionStateChange(){var i;const t=`RTCPeerConnection state changed to "${this.peerConnection.connectionState}"`;console.debug("[WebRTC] [Session] "+t),this.peerConnection.connectionState==="failed"&&((i=this.onClose)==null||i.call(this,this.id,"PeerConnection failed"),this.end())}onSignalingStateChange(){const t=`Signalling state changed to "${this.peerConnection.iceConnectionState}"`;console.debug("[WebRTC] [Session] "+t)}onIceGatheringStateChange(){this.peerConnection.iceGatheringState==="complete"&&console.debug(`[WebRTC] [Session] ICE gathering completed for session ${this.id}`)}end(){this.endPeerConnection(),this.onTrackAdded=void 0,this.onNewIceRemoteAddress=void 0,this.onClose=void 0,this.ended=!0,console.debug(`[WebRTC] [Session] Session ${this.id} ended.`)}endPeerConnection(){this.peerConnection.removeEventListener("negotiationneeded",this.onNegotiationNeeded.bind(this)),this.peerConnection.removeEventListener("track",this.onTrackAddedCallback.bind(this)),this.peerConnection.removeEventListener("icecandidate",this.onIceCandidate.bind(this)),this.peerConnection.removeEventListener("icecandidateerror",this.onIceCandidateError.bind(this)),this.peerConnection.removeEventListener("iceconnectionstatechange",this.onIceConnectionStateChange.bind(this)),this.peerConnection.removeEventListener("connectionstatechange",this.onConnectionStateChange.bind(this)),this.peerConnection.removeEventListener("signalingstatechange",this.onSignalingStateChange.bind(this)),this.peerConnection.removeEventListener("icegatheringstatechange",this.onIceGatheringStateChange.bind(this)),this.peerConnection.close()}}class me2{constructor(t,i,a,r){S1(this,"ws");S1(this,"onOpen");S1(this,"onStatusChange");S1(this,"url");S1(this,"listeners");S1(this,"shouldReconnect");var o;this.onOpen=a,this.onStatusChange=r,this.listeners=new Map,this.shouldReconnect=i,this.url=t;const n=`Connecting to signalling server on ${t}`;console.debug("[WebRTC] [Signaller] "+n),(o=this.onStatusChange)==null||o.call(this,n);try{this.ws=this.connect()}catch(s){console.error(`Could not establish initial connection. ${s}`)}}addEventListener(t,i,a){this.listeners.has(t)||this.listeners.set(t,new Map),this.listeners.get(t).set(i,a),this.ws.addEventListener(t,i,a)}removeEventListener(t,i,a){if(this.ws.removeEventListener(t,i,a),!this.listeners.has(t))return;const r=this.listeners.get(t);if(!r.has(i)){console.warn(`[WebRTC] [Signaller] Failed removing listener named ${i.name} of type "${t}". Reason: not found`);return}const n=r.get(i);a&&n&&a!==n||r.delete(i)}removeAllListeners(t,i){if(!(!this.listeners.size||!this.listeners.has(t))){for(const[a,r]of this.listeners.get(t))this.ws.removeEventListener(t,a,r);i&&this.listeners.delete(t)}}requestConsumerId(t,i){const a=this;this.addEventListener("message",function n(o){try{const s=JSON.parse(o.data);if(s.type!=="answer")return;const l=s.content;if(l.type!=="peerId")return;console.debug("[WebRTC] [Signaller] Message accepted from requestConsumerId:",s),a.removeEventListener("message",n);const d=l.content.id;i==null||i(`Consumer Id arrived: ${d}`),t(d)}catch(s){const l=`Failed receiving PeerId Answer Message. Error: ${s}. Data: ${o.data}`;console.error("[WebRTC] [Signaller] "+l),i==null||i(l)}});const r={type:"question",content:{type:"peerId"}};try{this.ws.send(JSON.stringify(r)),console.debug("[WebRTC] [Signaller] Message sent:",r),i==null||i("Consumer Id requested, waiting answer...")}catch(n){const o=`Failed requesting peer id. Reason: ${n}`;console.error("[WebRTC] [Signaller] "+o),i==null||i(o)}}isConnected(){return this.ws.readyState===this.ws.OPEN}requestStreams(t){const i={type:"question",content:{type:"availableStreams"}};try{if(this.ws.readyState!==this.ws.OPEN)return;this.ws.send(JSON.stringify(i)),console.debug("[WebRTC] [Signaller] Message sent:",i),t==null||t("StreamsAvailable requested")}catch(a){const r=`Failed requesting available streams. Reason: ${a}`;console.error("[WebRTC] [Signaller] "+r),t==null||t(r)}}requestSessionId(t,i,a,r){const n=this;n.addEventListener("message",function s(l){try{const d=JSON.parse(l.data);if(d.type!=="answer")return;const C=d.content;if(C.type!=="startSession")return;console.debug("[WebRTC] [Signaller] Message accepted from requestSessionId:",d);const m=C.content.session_id;if(m===void 0)return;n.removeEventListener("message",s),r==null||r(`Session Id arrived: ${m}`),a(m)}catch(d){const C=`Failed receiving StartSession Answer Message. Error: ${d}. Data: ${l.data}`;console.error("[WebRTC] [Signaller] "+C),r==null||r(C);return}});const o={type:"question",content:{type:"startSession",content:{consumer_id:t,producer_id:i}}};try{this.ws.send(JSON.stringify(o)),console.debug("[WebRTC] [Signaller] Message sent:",o),r==null||r("Session Id requested, waiting answer...")}catch(s){const l=`Failed requesting Session Id. Reason: ${s}`;console.error("[WebRTC] [Signaller] "+l),r==null||r(l)}}sendIceNegotiation(t,i,a,r,n){const o={type:"negotiation",content:{type:"iceNegotiation",content:{session_id:t,consumer_id:i,producer_id:a,ice:r.toJSON()}}};console.debug(`[WebRTC] [Signaller] Sending ICE answer: ${JSON.stringify(o,null,4)}`);try{this.ws.send(JSON.stringify(o)),console.debug("[WebRTC] [Signaller] Message sent:",o),n==null||n("ICE Candidate sent")}catch(s){const l=`Failed sending ICE Candidate. Reason: ${s}`;console.error("[WebRTC] [Signaller] "+l),n==null||n(l)}}sendMediaNegotiation(t,i,a,r,n){const o={type:"negotiation",content:{type:"mediaNegotiation",content:{session_id:t,consumer_id:i,producer_id:a,sdp:r.toJSON()}}};try{this.ws.send(JSON.stringify(o)),console.debug("[WebRTC] [Signaller] Message sent:",o),n==null||n("ICE Candidate sent")}catch(s){const l=`Failed sending SDP. Reason: ${s}`;console.error("[WebRTC] [Signaller] "+l),n==null||n(l)}}parseSessionStartAnswer(t){const i=JSON.parse(t.data);if(i.type!=="answer")return;const a=i.content;if(a.type==="startSession")return a.content.session_id}parseEndSessionQuestion(t,i,a,r,n){console.debug(`[WebRTC] [Signaller] Registering parseEndSessionQuestion for Consumer "${t}", Producer "${i}", Session "${a}", with callbacks:`,r,n);const o=this;this.addEventListener("message",function s(l){try{const d=JSON.parse(l.data);if(d.type!=="question")return;const C=d.content;if(C.type!=="endSession")return;console.debug("[WebRTC] [Signaller] Message accepted from parseEndSessionQuestion:",d);const m=C.content;if(m.consumer_id!==t||m.producer_id!==i||m.session_id!==a)return;o.removeEventListener("message",s);const u=m.reason;n==null||n("EndSession arrived"),r==null||r(a,u)}catch(d){const C=`Failed parsing received Message. Error: ${d}. Data: ${l.data}`;console.error("[WebRTC] [Signaller] "+C),n==null||n(C);return}})}parseNegotiation(t,i,a,r,n,o){console.debug(`[WebRTC] [Signaller] Registering parseNegotiation for Consumer "${t}", Producer "${i}", Session "${a}", with callbacks:`,r,n,o),this.addEventListener("message",s=>{try{const l=JSON.parse(s.data);if(l.type!=="negotiation")return;console.debug("[WebRTC] [Signaller] Message accepted from parseNegotiation:",l);const d=l.content;if(d.content.consumer_id!==t||d.content.producer_id!==i||d.content.session_id!==a)return;switch(d.type){case"iceNegotiation":o==null||o("iceNegotiation arrived"),r==null||r(d.content.ice);break;case"mediaNegotiation":o==null||o("mediaNegotiation arrived"),n==null||n(d.content.sdp);break}}catch(l){const d=`Failed parsing received Message. Error: ${l}. Data: ${s.data}`;console.error("[WebRTC] [Signaller] "+d),o==null||o(d);return}})}parseAvailableStreamsAnswer(t,i){console.debug("[WebRTC] [Signaller] Registering parseAvailableStreamsAnswer with callbacks:",t,i);const a=this;this.addEventListener("message",function r(n){try{const o=JSON.parse(n.data);if(o.type!=="answer")return;const s=o.content;if(s.type!=="availableStreams")return;console.debug("[WebRTC] [Signaller] Message accepted from parseAvailableStreamsAnswer:",o),a.removeEventListener("message",r);const l=s.content;i==null||i("Available Streams arrived"),t==null||t(l)}catch(o){const s=`Failed parsing received Message. Error: ${o}. Data: ${n.data}`;console.error("[WebRTC] [Signaller] "+s),i==null||i(s);return}})}end(t){this.ws.removeEventListener("open",this.onOpenCallback.bind(this)),this.ws.removeEventListener("error",this.onErrorCallback.bind(this)),this.ws.removeEventListener("close",this.onCloseCallback.bind(this)),this.removeAllListeners("open",!1),this.removeAllListeners("error",!1),this.removeAllListeners("close",!1),this.removeAllListeners("message",!1),this.ws.readyState===this.ws.OPEN&&(console.debug(`[WebRTC] [Signaller] Closing WebSocket. Reason: ${t}`),this.ws.close())}connect(){const t=new WebSocket(this.url.toString());t.addEventListener("open",this.onOpenCallback.bind(this)),t.addEventListener("error",this.onErrorCallback.bind(this)),t.addEventListener("close",this.onCloseCallback.bind(this));for(const[i,a]of this.listeners)for(const[r,n]of a)t.addEventListener(i,r,n);return t}reconnect(){var a;const t="Reconnecting to signalling";console.debug("[WebRTC] [Signaller] "+t),(a=this.onStatusChange)==null||a.call(this,t),this.end("reconnect");const i=this.ws;i.onclose=null,i.onopen=null,i.onmessage=null,i.onerror=null;try{this.ws=this.connect()}catch(r){console.error(`[WebRTC] [Signaller] Could not reconnect. ${r}`)}}onOpenCallback(t){var a,r;const i="Signaller Connected";console.debug("[WebRTC] [Signaller] "+i,t),(a=this.onStatusChange)==null||a.call(this,i),(r=this.onOpen)==null||r.call(this,t)}onCloseCallback(t){var a;const i="Signaller connection closed";console.debug("[WebRTC] [Signaller] "+i,t),(a=this.onStatusChange)==null||a.call(this,i),this.shouldReconnect&&setTimeout(()=>{(this.ws.readyState===this.ws.CLOSED||this.ws.readyState===this.ws.CLOSING)&&this.reconnect()},1e3)}onErrorCallback(t){var a;const i="Signaller connection Error";console.debug("[WebRTC] [Signaller] "+i,t),(a=this.onStatusChange)==null||a.call(this,i)}}class ID{constructor(t,i){S1(this,"availableStreams",a1(new Array));S1(this,"availableICEIPs",a1(new Array));S1(this,"mediaStream",a1());S1(this,"signallerStatus",a1("waiting..."));S1(this,"streamStatus",a1("waiting..."));S1(this,"consumerId");S1(this,"streamName");S1(this,"session");S1(this,"rtcConfiguration");S1(this,"selectedICEIPs",[]);S1(this,"hasEnded",!1);S1(this,"signaller");S1(this,"waitingForAvailableStreamsAnswer",!1);S1(this,"waitingForSessionStart",!1);console.debug("[WebRTC] Trying to connect to signalling server."),this.rtcConfiguration=i,this.signaller=new me2(t,!0,()=>{this.startConsumer()},a=>this.updateSignallerStatus(a))}close(t){this.stopSession(t),this.signaller.end(t),this.hasEnded=!0}startStream(t,i){return this.selectedICEIPs=i.value,T1(t,(a,r)=>{if((a==null?void 0:a.id)===(r==null?void 0:r.id))return;const n=`Selected stream changed from "${r==null?void 0:r.id}" to "${a==null?void 0:a.id}".`;console.debug("[WebRTC] "+n),r!==void 0&&this.stopSession(n),a!==void 0&&(this.streamName=a.name,this.startSession())}),T1(i,(a,r)=>{if(a===r)return;const n=`Selected IPs changed from "${r}" to "${a}".`;console.debug("[WebRTC] "+n),this.selectedICEIPs=a,this.streamName!==void 0&&this.stopSession(n),this.streamName!==void 0&&this.startSession()}),{availableStreams:this.availableStreams,availableICEIPs:this.availableICEIPs,mediaStream:this.mediaStream,signallerStatus:this.signallerStatus,streamStatus:this.streamStatus}}updateStreamStatus(t){console.debug(`[WebRTC] Stream status updated from "${this.streamStatus.value}" to "${t}"`);const i=new Date().toTimeString().split(" ").first();this.streamStatus.value=`${t} (${i})`}updateSignallerStatus(t){console.debug(`[WebRTC] Signaller status updated from "${this.signallerStatus.value}" to "${t}"`);const i=new Date().toTimeString().split(" ").first();this.signallerStatus.value=`${t} (${i})`}startConsumer(){this.hasEnded=!1,this.consumerId===void 0&&this.signaller.requestConsumerId(t=>{this.consumerId=t},t=>this.updateStreamStatus(t)),this.availableStreams.value=[],this.updateStreamsAvailable()}updateStreamsAvailable(){if(this.waitingForAvailableStreamsAnswer){this.signaller.requestStreams();return}if(this.hasEnded){this.waitingForAvailableStreamsAnswer=!1;return}this.waitingForAvailableStreamsAnswer=!0,window.setTimeout(()=>{!this.waitingForAvailableStreamsAnswer||(this.signaller.parseAvailableStreamsAnswer(t=>{!this.waitingForAvailableStreamsAnswer||(this.waitingForAvailableStreamsAnswer=!1,this.availableStreams.value=t,this.updateStreamsAvailable())}),this.signaller.requestStreams())},1e3)}onTrackAdded(t){var r,n,o,s,l,d;const[i]=t.streams;this.mediaStream.value=i,this.mediaStream.value.getVideoTracks().filter(C=>C.kind==="video").forEach(C=>{if(!("contentHint"in C)){console.error("MediaStreamTrack contentHint attribute not supported.");return}C.contentHint="motion"}),console.debug("[WebRTC] Track added"),console.debug("Event:",t),console.debug("Settings:",(n=(r=t.track).getSettings)==null?void 0:n.call(r)),console.debug("Constraints:",(s=(o=t.track).getConstraints)==null?void 0:s.call(o)),console.debug("Capabilities:",(d=(l=t.track).getCapabilities)==null?void 0:d.call(l))}requestSession(t,i){console.debug("[WebRTC] Requesting stream:",t),this.signaller.requestSessionId(i,t.id,a=>{this.onSessionIdReceived(t,t.id,a)},a=>this.updateStreamStatus(a)),this.hasEnded=!1}startSession(){this.waitingForSessionStart||(this.waitingForSessionStart=!0,window.setTimeout(()=>{if(!this.waitingForSessionStart)return;const t=this.availableStreams.value.find(a=>a.name===this.streamName);if(t===void 0){const a=`Failed to start a new Session with "${this.streamName}". Reason: not available`;console.error("[WebRTC] "+a),this.updateStreamStatus(a),this.waitingForSessionStart=!1,this.startSession();return}const i=`Starting session with producer "${t.id}" ("${this.streamName}")`;if(this.updateStreamStatus(i),console.debug("[WebRTC] "+i),this.consumerId===void 0){const a=`Failed to start a new Session with producer"${t.id}" ("${this.streamName}"). Reason: undefined consumerId`;console.error("[WebRTC] "+a),this.updateStreamStatus(a),this.startConsumer(),this.startSession();return}this.requestSession(t,this.consumerId),this.waitingForSessionStart=!1},1e3))}onSessionClosed(t){this.stopSession(t),this.consumerId=void 0,this.startConsumer(),this.startSession()}onSessionIdReceived(t,i,a){this.session=new Ce2(a,this.consumerId,t,this.signaller,this.rtcConfiguration,this.selectedICEIPs,n=>this.onTrackAdded(n),n=>this.availableICEIPs.value=n,(n,o)=>this.onSessionClosed(o)),this.signaller.parseEndSessionQuestion(this.consumerId,i,this.session.id,(n,o)=>{console.debug(`[WebRTC] Session ${n} ended. Reason: ${o}`),this.session=void 0,this.hasEnded=!0},n=>this.updateSignallerStatus(n)),this.signaller.parseNegotiation(this.consumerId,i,this.session.id,this.session.onIncomingICE.bind(this.session),this.session.onIncomingSDP.bind(this.session),n=>this.updateSignallerStatus(n));const r=`Session ${this.session.id} successfully started`;console.debug("[WebRTC] "+r),this.updateStreamStatus(r)}stopSession(t){if(this.session===void 0){console.debug("[WebRTC] Stopping an undefined session, probably it was already stopped?");return}const i=`Stopping session ${this.session.id}. Reason: ${t}`;this.updateStreamStatus(i),console.debug("[WebRTC] "+i),this.session.end(),this.session=void 0,this.hasEnded=!0}}const gm=Q4("mission",()=>{const e=a1(""),t=Y5("cockpit-last-mission-name",""),i=Y5("cockpit-mission-start-time",new Date);T1(e,()=>t.value=e.value);const a=$2([]);return{missionName:e,lastMissionName:t,missionStartTime:i,currentPlanningWaypoints:a,moveWaypoint:(n,o)=>{if(a.find(l=>l.id===n)===void 0)throw Error(`Could not move waypoint. No waypoint with id ${n} was found.`);Object.assign(a,a.map(l=>l.id===n?{...l,coordinates:o}:l))}}}),uM=Q4("video",()=>{const e=gm(),t=qC(),{globalAddress:i,rtcConfiguration:a,webRTCSignallingURI:r}=c5();console.debug("[WebRTC] Using webrtc-adapter for",de2.browserDetails);const n=Y5("cockpit-allowed-stream-ips",[]),o=a1({}),s=new ID(r.val,a),{availableStreams:l}=s.startStream(a1(void 0),n),d=a1([]),C=Y5("video-recovery-warning-already-shown",!1),m=q(()=>l.value.map(E=>E.name));T1(n,()=>{Object.keys(o.value).forEach(E=>o.value[E]=void 0)}),setInterval(()=>{Object.keys(o.value).forEach(E=>{if(o.value[E]===void 0)return;const O=o.value[E].webRtcManager.availableICEIPs.filter(F=>!d.value.includes(F));d.value=[...d.value,...O];const z=l.value.find(F=>F.name===E);Xs(z,o.value[E].stream)||(console.log(`New stream for '${E}':`),console.log(JSON.stringify(z,null,2)),u(E),o.value[E].stream=z)})},300);const u=E=>{const O=a1(),z=new ID(r.val,a),{mediaStream:F}=z.startStream(O,n);o.value[E]={stream:O,webRtcManager:z,mediaStream:F,mediaRecorder:void 0,timeRecordingStart:void 0},console.debug(`Activated stream '${E}'.`)},p=E=>(o.value[E]===void 0&&u(E),o.value[E]),V=E=>(o.value[E]===void 0&&u(E),o.value[E].mediaStream),f=E=>(o.value[E]===void 0&&u(E),o.value[E].mediaRecorder!==void 0&&o.value[E].mediaRecorder.state==="recording"),M=E=>{o.value[E]===void 0&&u(E),o.value[E].mediaRecorder.stop(),t.pushAlert(new ii(_e.Success,`Stopped recording stream ${E}.`))},H=E=>{if(o.value[E]===void 0&&u(E),m.value.isEmpty()){O2.fire({text:"No streams available.",icon:"error"});return}if(o.value[E].mediaStream===void 0){O2.fire({text:"Media stream not defined.",icon:"error"});return}if(!o.value[E].mediaStream.active){O2.fire({text:"Media stream not yet active. Wait a second and try again.",icon:"error"});return}o.value[E].timeRecordingStart=new Date;const O=o.value[E],z=ht().slice(0,6),F=Cn(O.timeRecordingStart,"LLL dd, yyyy - HH\uA789mm\uA789ss O"),J=`${e.missionName||"Cockpit"} (${F}) #${z}`;o.value[E].mediaRecorder=new MediaRecorder(O.mediaStream),A5.logging()||A5.startLogging();const W=O.mediaStream.getVideoTracks()[0],n1=W.getSettings().width||1920,$=W.getSettings().height||1080;o.value[E].mediaRecorder.start(1e3);let i1=0;o.value[E].mediaRecorder.ondataavailable=async l1=>{const f1=`${z}_${i1}`;if(await D.getItem(f1)){M(E);return}await D.setItem(f1,l1.data),i1++},o.value[E].mediaRecorder.onstop=async()=>{const l1=[];if(await D.iterate((C1,g1)=>{g1.includes(z)&&l1.push({blob:C1,name:g1})}),l1.length===0){O2.fire({text:"No video recording data found.",icon:"error"});return}const M1=l1.sort((C1,g1)=>{const A1=C1.name.split("_"),e1=g1.name.split("_");return Number(A1[A1.length-1])-Number(e1[e1.length-1])}).map(C1=>C1.blob).reduce((C1,g1)=>new Blob([C1,g1],{type:"video/webm"})),o1=await te2(M1,Date.now()-O.timeRecordingStart.getTime());R.setItem(`${J}.webm`,o1);const H1=A5.getSlice(A5.currentCockpitLog,O.timeRecordingStart,new Date),X=A5.toAssOverlay(H1,n1,$,O.timeRecordingStart.getTime()),t1=new Blob([X],{type:"text/plain"});R.setItem(`${J}.ass`,t1),o.value[E].mediaRecorder=void 0},t.pushAlert(new ii(_e.Success,`Started recording stream ${E}.`))},g=async E=>{console.debug(`Discarding files from the video recovery database: ${E.join(", ")}`);for(const O of E)await R.removeItem(O)},_=async E=>{if(console.debug(`Downloading files from the video recovery database: ${E.join(", ")}`),E.length===1){const W=await R.getItem(E[0]);if(!W){O2.fire({text:"File not found.",icon:"error"});return}va.exports.saveAs(W,E[0]);return}const O=new Z22(new Dt1("application/zip")),z=E.filter(async W=>await R.getItem(W)).map(async W=>{const n1=await R.getItem(W);return{filename:W,file:n1}}),F=await Promise.all(z);for(const{filename:W,file:n1}of F)await O.add(W,new A22(n1));const J=await O.close();va.exports.saveAs(J,"Cockpit-Video-Recovery.zip")},v=async()=>{const E=[];await R.iterate((O,z)=>{E.push(z)});for(const O of E)await R.removeItem(O)},S=async()=>{let E=0;return await R.iterate(O=>{E+=O.size}),E},y=async E=>{const O=await R.getItem(E);return O?O.size:void 0},D=L4.createInstance({driver:L4.INDEXEDDB,name:"Cockpit - Temporary Video",storeName:"cockpit-temp-video-db",version:1,description:"Database for storing the chunks of an ongoing recording, to be merged afterwards."}),R=L4.createInstance({driver:L4.INDEXEDDB,name:"Cockpit - Video Recovery",storeName:"cockpit-video-recovery-db",version:1,description:"Local backups of Cockpit video recordings to be retrieved in case of failure."});R.length().then(E=>{E!==0&&(C.value||(O2.fire({title:"Download of video recordings",text:`Cockpit has video recordings waiting on the disk storage. +`);e.RTCSessionDescription&&r instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:r.type,sdp:n}):r.sdp=n}return i.apply(this,arguments)}}function dc(e,t){if(!(e.RTCPeerConnection&&e.RTCPeerConnection.prototype))return;const i=e.RTCPeerConnection.prototype.addIceCandidate;!i||i.length===0||(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?(t.browser==="chrome"&&t.version<78||t.browser==="firefox"&&t.version<68||t.browser==="safari")&&arguments[0]&&arguments[0].candidate===""?Promise.resolve():i.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function Cc(e,t){if(!(e.RTCPeerConnection&&e.RTCPeerConnection.prototype))return;const i=e.RTCPeerConnection.prototype.setLocalDescription;!i||i.length===0||(e.RTCPeerConnection.prototype.setLocalDescription=function(){let r=arguments[0]||{};if(typeof r!="object"||r.type&&r.sdp)return i.apply(this,arguments);if(r={type:r.type,sdp:r.sdp},!r.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":r.type="offer";break;default:r.type="answer";break}return r.sdp||r.type!=="offer"&&r.type!=="answer"?i.apply(this,[r]):(r.type==="offer"?this.createOffer:this.createAnswer).apply(this).then(o=>i.apply(this,[o]))})}const le2=Object.freeze(Object.defineProperty({__proto__:null,shimRTCIceCandidate:sc,shimRTCIceCandidateRelayProtocol:_f,shimMaxMessageSize:lc,shimSendThrowTypeError:cc,shimConnectionState:Sf,removeExtmapAllowMixed:Df,shimAddIceCandidateNullOrEmpty:dc,shimParameterlessSetLocalDescription:Cc},Symbol.toStringTag,{value:"Module"}));function ce2({window:e}={},t={shimChrome:!0,shimFirefox:!0,shimSafari:!0}){const i=Ft1,a=re2(e),r={browserDetails:a,commonShim:le2,extractVersion:oc,disableLog:ie2,disableWarnings:ae2,sdp:se2};switch(a.browser){case"chrome":if(!TD||!Af||!t.shimChrome)return i("Chrome shim is not included in this adapter release."),r;if(a.version===null)return i("Chrome shim can not determine version, not shimming."),r;i("adapter.js shimming chrome."),r.browserShim=TD,dc(e,a),Cc(e),Bt1(e,a),zt1(e),Af(e,a),Zt1(e),$t1(e,a),Gt1(e),Wt1(e),Xt1(e),qt1(e,a),sc(e),_f(e),Sf(e),lc(e,a),cc(e),Df(e,a);break;case"firefox":if(!ED||!vf||!t.shimFirefox)return i("Firefox shim is not included in this adapter release."),r;i("adapter.js shimming firefox."),r.browserShim=ED,dc(e,a),Cc(e),Kt1(e,a),vf(e,a),jt1(e),e01(e),Qt1(e),Jt1(e),t01(e),i01(e),a01(e),r01(e),n01(e),sc(e),Sf(e),lc(e,a),cc(e);break;case"safari":if(!PD||!t.shimSafari)return i("Safari shim is not included in this adapter release."),r;i("adapter.js shimming safari."),r.browserShim=PD,dc(e,a),Cc(e),C01(e),u01(e),l01(e),o01(e),s01(e),m01(e),c01(e),h01(e),sc(e),_f(e),lc(e,a),cc(e),Df(e,a);break;default:i("Unsupported browser!");break}return r}const de2=ce2({window:typeof window>"u"?void 0:window});class Ce2{constructor(t,i,a,r,n,o=[],s,l,d){S1(this,"id");S1(this,"consumerId");S1(this,"stream");S1(this,"status");S1(this,"ended");S1(this,"signaller");S1(this,"peerConnection");S1(this,"availableICEIPs");S1(this,"selectedICEIPs");S1(this,"rtcConfiguration");S1(this,"onTrackAdded");S1(this,"onNewIceRemoteAddress");S1(this,"onClose");this.id=t,this.consumerId=i,this.stream=a,this.onTrackAdded=s,this.onNewIceRemoteAddress=l,this.onClose=d,this.status="",this.signaller=r,this.rtcConfiguration=n,this.ended=!1,this.availableICEIPs=[],this.selectedICEIPs=o,this.peerConnection=this.createRTCPeerConnection(n),this.updateStatus("[WebRTC] [Session] Creating Session...")}hasEnded(){return this.ended}isConnected(){return this.peerConnection.connectionState=="connected"}updateStatus(t){this.status=t}createRTCPeerConnection(t){console.debug("[WebRTC] [Session] Creating RTCPeerConnection");const i=new RTCPeerConnection(t);return i.addTransceiver("video",{direction:"recvonly"}),this.ended=!1,i.addEventListener("negotiationneeded",this.onNegotiationNeeded.bind(this)),i.addEventListener("track",this.onTrackAddedCallback.bind(this)),i.addEventListener("icecandidate",this.onIceCandidate.bind(this)),i.addEventListener("icecandidateerror",this.onIceCandidateError.bind(this)),i.addEventListener("iceconnectionstatechange",this.onIceConnectionStateChange.bind(this)),i.addEventListener("connectionstatechange",this.onConnectionStateChange.bind(this)),i.addEventListener("signalingstatechange",this.onSignalingStateChange.bind(this)),i.addEventListener("icegatheringstatechange",this.onIceGatheringStateChange.bind(this)),i}onIncomingSDP(t){this.peerConnection.setRemoteDescription(t).then(()=>{console.debug(`[WebRTC] [Session] Remote description set to ${JSON.stringify(t,null,4)}`),this.onRemoteDescriptionSet()}).catch(i=>console.error(`[WebRTC] [Session] Failed setting remote description ${t}. Reason: ${i}`))}onRemoteDescriptionSet(){this.peerConnection.createAnswer().then(t=>{console.debug(`[WebRTC] [Session] SDP Answer created as: ${JSON.stringify(t,null,4)}`),this.onAnswerCreated(t)}).catch(t=>console.error(`[WebRTC] [Session] Failed creating description answer. Reason: ${t}`))}onAnswerCreated(t){this.peerConnection.setLocalDescription(t).then(()=>{console.debug(`[WebRTC] [Session] Local description set as${JSON.stringify(t,null,4)}`),this.onLocalDescriptionSet()}).catch(function(i){console.error(`[WebRTC] [Session] Failed setting local description. Reason: ${i}`)})}onLocalDescriptionSet(){this.peerConnection.localDescription!==null&&this.signaller.sendMediaNegotiation(this.id,this.consumerId,this.stream.id,this.peerConnection.localDescription)}onIncomingICE(t){const i=/\b(?:\d{1,3}\.){3}\d{1,3}\b/g,r=(n=>{const o=n.match(i);return o==null?void 0:o.find(s=>!s.includes(":"))})(t.candidate);if(r&&!this.availableICEIPs.includes(r)&&this.onNewIceRemoteAddress&&(this.availableICEIPs.push(r),this.onNewIceRemoteAddress(this.availableICEIPs)),t.candidate&&Array.isArray(this.selectedICEIPs)&&!this.selectedICEIPs.isEmpty()&&!this.selectedICEIPs.some(n=>t.candidate.includes(n))){console.debug(`[WebRTC] [Session] ICE candidate ignored: ${JSON.stringify(t,null,4)}`);return}this.peerConnection.addIceCandidate(t).then(()=>console.debug(`[WebRTC] [Session] ICE candidate added: ${JSON.stringify(t,null,4)}`)).catch(n=>console.error(`[WebRTC] [Session] Failed adding ICE candidate ${t}. Reason: ${n}`))}onIceCandidate(t){!t.candidate||this.signaller.sendIceNegotiation(this.id,this.consumerId,this.stream.id,t.candidate)}onIceCandidateError(t){console.debug(`[WebRTC] [Session] ICE Candidate "${t.url}" negotiation failed`)}onTrackAddedCallback(t){var i;(i=this.onTrackAdded)==null||i.call(this,t)}onNegotiationNeeded(t){console.debug("[WebRTC] [Session] Peer Connection is waiting for negotiation...")}onIceConnectionStateChange(){const t=`ICEConnection state changed to "${this.peerConnection.iceConnectionState}"`;console.debug("[WebRTC] [Session] "+t),this.peerConnection.iceConnectionState==="failed"&&this.peerConnection.restartIce()}onConnectionStateChange(){var i;const t=`RTCPeerConnection state changed to "${this.peerConnection.connectionState}"`;console.debug("[WebRTC] [Session] "+t),this.peerConnection.connectionState==="failed"&&((i=this.onClose)==null||i.call(this,this.id,"PeerConnection failed"),this.end())}onSignalingStateChange(){const t=`Signalling state changed to "${this.peerConnection.iceConnectionState}"`;console.debug("[WebRTC] [Session] "+t)}onIceGatheringStateChange(){this.peerConnection.iceGatheringState==="complete"&&console.debug(`[WebRTC] [Session] ICE gathering completed for session ${this.id}`)}end(){this.endPeerConnection(),this.onTrackAdded=void 0,this.onNewIceRemoteAddress=void 0,this.onClose=void 0,this.ended=!0,console.debug(`[WebRTC] [Session] Session ${this.id} ended.`)}endPeerConnection(){this.peerConnection.removeEventListener("negotiationneeded",this.onNegotiationNeeded.bind(this)),this.peerConnection.removeEventListener("track",this.onTrackAddedCallback.bind(this)),this.peerConnection.removeEventListener("icecandidate",this.onIceCandidate.bind(this)),this.peerConnection.removeEventListener("icecandidateerror",this.onIceCandidateError.bind(this)),this.peerConnection.removeEventListener("iceconnectionstatechange",this.onIceConnectionStateChange.bind(this)),this.peerConnection.removeEventListener("connectionstatechange",this.onConnectionStateChange.bind(this)),this.peerConnection.removeEventListener("signalingstatechange",this.onSignalingStateChange.bind(this)),this.peerConnection.removeEventListener("icegatheringstatechange",this.onIceGatheringStateChange.bind(this)),this.peerConnection.close()}}class me2{constructor(t,i,a,r){S1(this,"ws");S1(this,"onOpen");S1(this,"onStatusChange");S1(this,"url");S1(this,"listeners");S1(this,"shouldReconnect");var o;this.onOpen=a,this.onStatusChange=r,this.listeners=new Map,this.shouldReconnect=i,this.url=t;const n=`Connecting to signalling server on ${t}`;console.debug("[WebRTC] [Signaller] "+n),(o=this.onStatusChange)==null||o.call(this,n);try{this.ws=this.connect()}catch(s){console.error(`Could not establish initial connection. ${s}`)}}addEventListener(t,i,a){this.listeners.has(t)||this.listeners.set(t,new Map),this.listeners.get(t).set(i,a),this.ws.addEventListener(t,i,a)}removeEventListener(t,i,a){if(this.ws.removeEventListener(t,i,a),!this.listeners.has(t))return;const r=this.listeners.get(t);if(!r.has(i)){console.warn(`[WebRTC] [Signaller] Failed removing listener named ${i.name} of type "${t}". Reason: not found`);return}const n=r.get(i);a&&n&&a!==n||r.delete(i)}removeAllListeners(t,i){if(!(!this.listeners.size||!this.listeners.has(t))){for(const[a,r]of this.listeners.get(t))this.ws.removeEventListener(t,a,r);i&&this.listeners.delete(t)}}requestConsumerId(t,i){const a=this;this.addEventListener("message",function n(o){try{const s=JSON.parse(o.data);if(s.type!=="answer")return;const l=s.content;if(l.type!=="peerId")return;console.debug("[WebRTC] [Signaller] Message accepted from requestConsumerId:",s),a.removeEventListener("message",n);const d=l.content.id;i==null||i(`Consumer Id arrived: ${d}`),t(d)}catch(s){const l=`Failed receiving PeerId Answer Message. Error: ${s}. Data: ${o.data}`;console.error("[WebRTC] [Signaller] "+l),i==null||i(l)}});const r={type:"question",content:{type:"peerId"}};try{this.ws.send(JSON.stringify(r)),console.debug("[WebRTC] [Signaller] Message sent:",r),i==null||i("Consumer Id requested, waiting answer...")}catch(n){const o=`Failed requesting peer id. Reason: ${n}`;console.error("[WebRTC] [Signaller] "+o),i==null||i(o)}}isConnected(){return this.ws.readyState===this.ws.OPEN}requestStreams(t){const i={type:"question",content:{type:"availableStreams"}};try{if(this.ws.readyState!==this.ws.OPEN)return;this.ws.send(JSON.stringify(i)),console.debug("[WebRTC] [Signaller] Message sent:",i),t==null||t("StreamsAvailable requested")}catch(a){const r=`Failed requesting available streams. Reason: ${a}`;console.error("[WebRTC] [Signaller] "+r),t==null||t(r)}}requestSessionId(t,i,a,r){const n=this;n.addEventListener("message",function s(l){try{const d=JSON.parse(l.data);if(d.type!=="answer")return;const C=d.content;if(C.type!=="startSession")return;console.debug("[WebRTC] [Signaller] Message accepted from requestSessionId:",d);const m=C.content.session_id;if(m===void 0)return;n.removeEventListener("message",s),r==null||r(`Session Id arrived: ${m}`),a(m)}catch(d){const C=`Failed receiving StartSession Answer Message. Error: ${d}. Data: ${l.data}`;console.error("[WebRTC] [Signaller] "+C),r==null||r(C);return}});const o={type:"question",content:{type:"startSession",content:{consumer_id:t,producer_id:i}}};try{this.ws.send(JSON.stringify(o)),console.debug("[WebRTC] [Signaller] Message sent:",o),r==null||r("Session Id requested, waiting answer...")}catch(s){const l=`Failed requesting Session Id. Reason: ${s}`;console.error("[WebRTC] [Signaller] "+l),r==null||r(l)}}sendIceNegotiation(t,i,a,r,n){const o={type:"negotiation",content:{type:"iceNegotiation",content:{session_id:t,consumer_id:i,producer_id:a,ice:r.toJSON()}}};console.debug(`[WebRTC] [Signaller] Sending ICE answer: ${JSON.stringify(o,null,4)}`);try{this.ws.send(JSON.stringify(o)),console.debug("[WebRTC] [Signaller] Message sent:",o),n==null||n("ICE Candidate sent")}catch(s){const l=`Failed sending ICE Candidate. Reason: ${s}`;console.error("[WebRTC] [Signaller] "+l),n==null||n(l)}}sendMediaNegotiation(t,i,a,r,n){const o={type:"negotiation",content:{type:"mediaNegotiation",content:{session_id:t,consumer_id:i,producer_id:a,sdp:r.toJSON()}}};try{this.ws.send(JSON.stringify(o)),console.debug("[WebRTC] [Signaller] Message sent:",o),n==null||n("ICE Candidate sent")}catch(s){const l=`Failed sending SDP. Reason: ${s}`;console.error("[WebRTC] [Signaller] "+l),n==null||n(l)}}parseSessionStartAnswer(t){const i=JSON.parse(t.data);if(i.type!=="answer")return;const a=i.content;if(a.type==="startSession")return a.content.session_id}parseEndSessionQuestion(t,i,a,r,n){console.debug(`[WebRTC] [Signaller] Registering parseEndSessionQuestion for Consumer "${t}", Producer "${i}", Session "${a}", with callbacks:`,r,n);const o=this;this.addEventListener("message",function s(l){try{const d=JSON.parse(l.data);if(d.type!=="question")return;const C=d.content;if(C.type!=="endSession")return;console.debug("[WebRTC] [Signaller] Message accepted from parseEndSessionQuestion:",d);const m=C.content;if(m.consumer_id!==t||m.producer_id!==i||m.session_id!==a)return;o.removeEventListener("message",s);const u=m.reason;n==null||n("EndSession arrived"),r==null||r(a,u)}catch(d){const C=`Failed parsing received Message. Error: ${d}. Data: ${l.data}`;console.error("[WebRTC] [Signaller] "+C),n==null||n(C);return}})}parseNegotiation(t,i,a,r,n,o){console.debug(`[WebRTC] [Signaller] Registering parseNegotiation for Consumer "${t}", Producer "${i}", Session "${a}", with callbacks:`,r,n,o),this.addEventListener("message",s=>{try{const l=JSON.parse(s.data);if(l.type!=="negotiation")return;console.debug("[WebRTC] [Signaller] Message accepted from parseNegotiation:",l);const d=l.content;if(d.content.consumer_id!==t||d.content.producer_id!==i||d.content.session_id!==a)return;switch(d.type){case"iceNegotiation":o==null||o("iceNegotiation arrived"),r==null||r(d.content.ice);break;case"mediaNegotiation":o==null||o("mediaNegotiation arrived"),n==null||n(d.content.sdp);break}}catch(l){const d=`Failed parsing received Message. Error: ${l}. Data: ${s.data}`;console.error("[WebRTC] [Signaller] "+d),o==null||o(d);return}})}parseAvailableStreamsAnswer(t,i){console.debug("[WebRTC] [Signaller] Registering parseAvailableStreamsAnswer with callbacks:",t,i);const a=this;this.addEventListener("message",function r(n){try{const o=JSON.parse(n.data);if(o.type!=="answer")return;const s=o.content;if(s.type!=="availableStreams")return;console.debug("[WebRTC] [Signaller] Message accepted from parseAvailableStreamsAnswer:",o),a.removeEventListener("message",r);const l=s.content;i==null||i("Available Streams arrived"),t==null||t(l)}catch(o){const s=`Failed parsing received Message. Error: ${o}. Data: ${n.data}`;console.error("[WebRTC] [Signaller] "+s),i==null||i(s);return}})}end(t){this.ws.removeEventListener("open",this.onOpenCallback.bind(this)),this.ws.removeEventListener("error",this.onErrorCallback.bind(this)),this.ws.removeEventListener("close",this.onCloseCallback.bind(this)),this.removeAllListeners("open",!1),this.removeAllListeners("error",!1),this.removeAllListeners("close",!1),this.removeAllListeners("message",!1),this.ws.readyState===this.ws.OPEN&&(console.debug(`[WebRTC] [Signaller] Closing WebSocket. Reason: ${t}`),this.ws.close())}connect(){const t=new WebSocket(this.url.toString());t.addEventListener("open",this.onOpenCallback.bind(this)),t.addEventListener("error",this.onErrorCallback.bind(this)),t.addEventListener("close",this.onCloseCallback.bind(this));for(const[i,a]of this.listeners)for(const[r,n]of a)t.addEventListener(i,r,n);return t}reconnect(){var a;const t="Reconnecting to signalling";console.debug("[WebRTC] [Signaller] "+t),(a=this.onStatusChange)==null||a.call(this,t),this.end("reconnect");const i=this.ws;i.onclose=null,i.onopen=null,i.onmessage=null,i.onerror=null;try{this.ws=this.connect()}catch(r){console.error(`[WebRTC] [Signaller] Could not reconnect. ${r}`)}}onOpenCallback(t){var a,r;const i="Signaller Connected";console.debug("[WebRTC] [Signaller] "+i,t),(a=this.onStatusChange)==null||a.call(this,i),(r=this.onOpen)==null||r.call(this,t)}onCloseCallback(t){var a;const i="Signaller connection closed";console.debug("[WebRTC] [Signaller] "+i,t),(a=this.onStatusChange)==null||a.call(this,i),this.shouldReconnect&&setTimeout(()=>{(this.ws.readyState===this.ws.CLOSED||this.ws.readyState===this.ws.CLOSING)&&this.reconnect()},1e3)}onErrorCallback(t){var a;const i="Signaller connection Error";console.debug("[WebRTC] [Signaller] "+i,t),(a=this.onStatusChange)==null||a.call(this,i)}}class ID{constructor(t,i){S1(this,"availableStreams",a1(new Array));S1(this,"availableICEIPs",a1(new Array));S1(this,"mediaStream",a1());S1(this,"signallerStatus",a1("waiting..."));S1(this,"streamStatus",a1("waiting..."));S1(this,"consumerId");S1(this,"streamName");S1(this,"session");S1(this,"rtcConfiguration");S1(this,"selectedICEIPs",[]);S1(this,"hasEnded",!1);S1(this,"signaller");S1(this,"waitingForAvailableStreamsAnswer",!1);S1(this,"waitingForSessionStart",!1);console.debug("[WebRTC] Trying to connect to signalling server."),this.rtcConfiguration=i,this.signaller=new me2(t,!0,()=>{this.startConsumer()},a=>this.updateSignallerStatus(a))}close(t){this.stopSession(t),this.signaller.end(t),this.hasEnded=!0}startStream(t,i){return this.selectedICEIPs=i.value,T1(t,(a,r)=>{if((a==null?void 0:a.id)===(r==null?void 0:r.id))return;const n=`Selected stream changed from "${r==null?void 0:r.id}" to "${a==null?void 0:a.id}".`;console.debug("[WebRTC] "+n),r!==void 0&&this.stopSession(n),a!==void 0&&(this.streamName=a.name,this.startSession())}),T1(i,(a,r)=>{if(a===r)return;const n=`Selected IPs changed from "${r}" to "${a}".`;console.debug("[WebRTC] "+n),this.selectedICEIPs=a,this.streamName!==void 0&&this.stopSession(n),this.streamName!==void 0&&this.startSession()}),{availableStreams:this.availableStreams,availableICEIPs:this.availableICEIPs,mediaStream:this.mediaStream,signallerStatus:this.signallerStatus,streamStatus:this.streamStatus}}updateStreamStatus(t){console.debug(`[WebRTC] Stream status updated from "${this.streamStatus.value}" to "${t}"`);const i=new Date().toTimeString().split(" ").first();this.streamStatus.value=`${t} (${i})`}updateSignallerStatus(t){console.debug(`[WebRTC] Signaller status updated from "${this.signallerStatus.value}" to "${t}"`);const i=new Date().toTimeString().split(" ").first();this.signallerStatus.value=`${t} (${i})`}startConsumer(){this.hasEnded=!1,this.consumerId===void 0&&this.signaller.requestConsumerId(t=>{this.consumerId=t},t=>this.updateStreamStatus(t)),this.availableStreams.value=[],this.updateStreamsAvailable()}updateStreamsAvailable(){if(this.waitingForAvailableStreamsAnswer){this.signaller.requestStreams();return}if(this.hasEnded){this.waitingForAvailableStreamsAnswer=!1;return}this.waitingForAvailableStreamsAnswer=!0,window.setTimeout(()=>{!this.waitingForAvailableStreamsAnswer||(this.signaller.parseAvailableStreamsAnswer(t=>{!this.waitingForAvailableStreamsAnswer||(this.waitingForAvailableStreamsAnswer=!1,this.availableStreams.value=t,this.updateStreamsAvailable())}),this.signaller.requestStreams())},1e3)}onTrackAdded(t){var r,n,o,s,l,d;const[i]=t.streams;this.mediaStream.value=i,this.mediaStream.value.getVideoTracks().filter(C=>C.kind==="video").forEach(C=>{if(!("contentHint"in C)){console.error("MediaStreamTrack contentHint attribute not supported.");return}C.contentHint="motion"}),console.debug("[WebRTC] Track added"),console.debug("Event:",t),console.debug("Settings:",(n=(r=t.track).getSettings)==null?void 0:n.call(r)),console.debug("Constraints:",(s=(o=t.track).getConstraints)==null?void 0:s.call(o)),console.debug("Capabilities:",(d=(l=t.track).getCapabilities)==null?void 0:d.call(l))}requestSession(t,i){console.debug("[WebRTC] Requesting stream:",t),this.signaller.requestSessionId(i,t.id,a=>{this.onSessionIdReceived(t,t.id,a)},a=>this.updateStreamStatus(a)),this.hasEnded=!1}startSession(){this.waitingForSessionStart||(this.waitingForSessionStart=!0,window.setTimeout(()=>{if(!this.waitingForSessionStart)return;const t=this.availableStreams.value.find(a=>a.name===this.streamName);if(t===void 0){const a=`Failed to start a new Session with "${this.streamName}". Reason: not available`;console.error("[WebRTC] "+a),this.updateStreamStatus(a),this.waitingForSessionStart=!1,this.startSession();return}const i=`Starting session with producer "${t.id}" ("${this.streamName}")`;if(this.updateStreamStatus(i),console.debug("[WebRTC] "+i),this.consumerId===void 0){const a=`Failed to start a new Session with producer"${t.id}" ("${this.streamName}"). Reason: undefined consumerId`;console.error("[WebRTC] "+a),this.updateStreamStatus(a),this.startConsumer(),this.startSession();return}this.requestSession(t,this.consumerId),this.waitingForSessionStart=!1},1e3))}onSessionClosed(t){this.stopSession(t),this.consumerId=void 0,this.startConsumer(),this.startSession()}onSessionIdReceived(t,i,a){this.session=new Ce2(a,this.consumerId,t,this.signaller,this.rtcConfiguration,this.selectedICEIPs,n=>this.onTrackAdded(n),n=>this.availableICEIPs.value=n,(n,o)=>this.onSessionClosed(o)),this.signaller.parseEndSessionQuestion(this.consumerId,i,this.session.id,(n,o)=>{console.debug(`[WebRTC] Session ${n} ended. Reason: ${o}`),this.session=void 0,this.hasEnded=!0},n=>this.updateSignallerStatus(n)),this.signaller.parseNegotiation(this.consumerId,i,this.session.id,this.session.onIncomingICE.bind(this.session),this.session.onIncomingSDP.bind(this.session),n=>this.updateSignallerStatus(n));const r=`Session ${this.session.id} successfully started`;console.debug("[WebRTC] "+r),this.updateStreamStatus(r)}stopSession(t){if(this.session===void 0){console.debug("[WebRTC] Stopping an undefined session, probably it was already stopped?");return}const i=`Stopping session ${this.session.id}. Reason: ${t}`;this.updateStreamStatus(i),console.debug("[WebRTC] "+i),this.session.end(),this.session=void 0,this.hasEnded=!0}}const gm=Q4("mission",()=>{const e=a1(""),t=Y5("cockpit-last-mission-name",""),i=Y5("cockpit-mission-start-time",new Date);T1(e,()=>t.value=e.value);const a=$2([]);return{missionName:e,lastMissionName:t,missionStartTime:i,currentPlanningWaypoints:a,moveWaypoint:(n,o)=>{if(a.find(l=>l.id===n)===void 0)throw Error(`Could not move waypoint. No waypoint with id ${n} was found.`);Object.assign(a,a.map(l=>l.id===n?{...l,coordinates:o}:l))}}}),uM=Q4("video",()=>{const e=gm(),t=qC(),{globalAddress:i,rtcConfiguration:a,webRTCSignallingURI:r}=c5();console.debug("[WebRTC] Using webrtc-adapter for",de2.browserDetails);const n=Y5("cockpit-allowed-stream-ips",[]),o=a1({}),s=new ID(r.val,a),{availableStreams:l}=s.startStream(a1(void 0),n),d=a1([]),C=Y5("video-recovery-warning-already-shown",!1),m=q(()=>l.value.map(E=>E.name));T1(n,()=>{Object.keys(o.value).forEach(E=>o.value[E]=void 0)}),setInterval(()=>{Object.keys(o.value).forEach(E=>{if(o.value[E]===void 0)return;const O=o.value[E].webRtcManager.availableICEIPs.filter(F=>!d.value.includes(F));d.value=[...d.value,...O];const z=l.value.find(F=>F.name===E);Xs(z,o.value[E].stream)||(console.log(`New stream for '${E}':`),console.log(JSON.stringify(z,null,2)),u(E),o.value[E].stream=z)})},300);const u=E=>{const O=a1(),z=new ID(r.val,a),{mediaStream:F}=z.startStream(O,n);o.value[E]={stream:O,webRtcManager:z,mediaStream:F,mediaRecorder:void 0,timeRecordingStart:void 0},console.debug(`Activated stream '${E}'.`)},p=E=>(o.value[E]===void 0&&u(E),o.value[E]),V=E=>(o.value[E]===void 0&&u(E),o.value[E].mediaStream),f=E=>(o.value[E]===void 0&&u(E),o.value[E].mediaRecorder!==void 0&&o.value[E].mediaRecorder.state==="recording"),M=E=>{o.value[E]===void 0&&u(E),o.value[E].mediaRecorder.stop(),t.pushAlert(new ii(_e.Success,`Stopped recording stream ${E}.`))},H=E=>{if(o.value[E]===void 0&&u(E),m.value.isEmpty()){O2.fire({text:"No streams available.",icon:"error"});return}if(o.value[E].mediaStream===void 0){O2.fire({text:"Media stream not defined.",icon:"error"});return}if(!o.value[E].mediaStream.active){O2.fire({text:"Media stream not yet active. Wait a second and try again.",icon:"error"});return}o.value[E].timeRecordingStart=new Date;const O=o.value[E],z=ht().slice(0,6),F=Cn(O.timeRecordingStart,"LLL dd, yyyy - HH\uA789mm\uA789ss O"),J=`${e.missionName||"Cockpit"} (${F}) #${z}`;o.value[E].mediaRecorder=new MediaRecorder(O.mediaStream),A5.logging()||A5.startLogging();const W=O.mediaStream.getVideoTracks()[0],n1=W.getSettings().width||1920,$=W.getSettings().height||1080;o.value[E].mediaRecorder.start(1e3);let i1=0;o.value[E].mediaRecorder.ondataavailable=async l1=>{const f1=`${z}_${i1}`;if(await D.getItem(f1)){M(E);return}await D.setItem(f1,l1.data),i1++},o.value[E].mediaRecorder.onstop=async()=>{const l1=[];if(await D.iterate((C1,g1)=>{g1.includes(z)&&l1.push({blob:C1,name:g1})}),l1.length===0){O2.fire({text:"No video recording data found.",icon:"error"});return}const M1=l1.sort((C1,g1)=>{const A1=C1.name.split("_"),e1=g1.name.split("_");return Number(A1[A1.length-1])-Number(e1[e1.length-1])}).map(C1=>C1.blob).reduce((C1,g1)=>new Blob([C1,g1],{type:"video/webm"})),o1=await te2(M1,Date.now()-O.timeRecordingStart.getTime());R.setItem(`${J}.webm`,o1);const H1=A5.getSlice(A5.currentCockpitLog,O.timeRecordingStart,new Date),X=A5.toAssOverlay(H1,n1,$,O.timeRecordingStart.getTime()),t1=new Blob([X],{type:"text/plain"});R.setItem(`${J}.ass`,t1),o.value[E].mediaRecorder=void 0},t.pushAlert(new ii(_e.Success,`Started recording stream ${E}.`))},g=async E=>{console.debug(`Discarding files from the video recovery database: ${E.join(", ")}`);for(const O of E)await R.removeItem(O)},_=async E=>{if(console.debug(`Downloading files from the video recovery database: ${E.join(", ")}`),E.length===1){const W=await R.getItem(E[0]);if(!W){O2.fire({text:"File not found.",icon:"error"});return}va.exports.saveAs(W,E[0]);return}const O=new Z22(new Dt1("application/zip")),z=E.filter(async W=>await R.getItem(W)).map(async W=>{const n1=await R.getItem(W);return{filename:W,file:n1}}),F=await Promise.all(z);for(const{filename:W,file:n1}of F)await O.add(W,new A22(n1));const J=await O.close();va.exports.saveAs(J,"Cockpit-Video-Recovery.zip")},v=async()=>{const E=[];await D.iterate((O,z)=>{E.push(z)});for(const O of E)await D.removeItem(O)},S=async()=>{let E=0;return await D.iterate(O=>{E+=O.size}),E},y=async E=>{const O=await R.getItem(E);return O?O.size:void 0},D=L4.createInstance({driver:L4.INDEXEDDB,name:"Cockpit - Temporary Video",storeName:"cockpit-temp-video-db",version:1,description:"Database for storing the chunks of an ongoing recording, to be merged afterwards."}),R=L4.createInstance({driver:L4.INDEXEDDB,name:"Cockpit - Video Recovery",storeName:"cockpit-video-recovery-db",version:1,description:"Local backups of Cockpit video recordings to be retrieved in case of failure."});R.length().then(E=>{E!==0&&(C.value||(O2.fire({title:"Download of video recordings",text:`Cockpit has video recordings waiting on the disk storage. To download or discard those, please go to the video page, in the configuration menu. Remember that those recordings are only available on the device you used to record the videos, and that they take disk space. If you don't need them anymore, you can discard them. @@ -926,7 +926,7 @@ a=extmap-allow-mixed`)!==-1){const n=r.sdp.split(`
  • 1. Open the video configuration page (Main-menu > Configuration > Video).
  • 2. Select the IP address that should be used for the video streaming.
  • - `,icon:"warning",customClass:{htmlContainer:"text-left"}}),clearInterval(w)},5e3)}}},5e3),x=()=>{const E=[];if(m.value.forEach(O=>{f(O)||(H(O),E.push(O))}),E.isEmpty()){t.pushAlert(new ii(_e.Error,"No streams available to be recorded."));return}t.pushAlert(new ii(_e.Success,`Started recording streams: ${E.join(", ")}.`))},U=()=>{const E=[];if(m.value.forEach(O=>{f(O)&&(M(O),E.push(O))}),E.isEmpty()){t.pushAlert(new ii(_e.Error,"No streams were being recorded."));return}t.pushAlert(new ii(_e.Success,`Stopped recording streams: ${E.join(", ")}.`))};return W4(it.start_recording_all_streams,Fg(x,3e3)),W4(it.stop_recording_all_streams,Fg(U,3e3)),{availableIceIps:d,allowedIceIps:n,namesAvailableStreams:m,videoStoringDB:R,tempVideoChunksDB:D,discardFilesFromVideoDB:g,downloadFilesFromVideoDB:_,clearTemporaryVideoDB:v,temporaryVideoDBSize:S,videoStorageFileSize:y,getMediaStream:V,getStreamData:p,isRecording:f,stopRecording:M,startRecording:H}});function ue2(e,t,i){if(t==null)return e;if(Array.isArray(t))throw new Error("Multiple matches is not implemented");return typeof t=="number"&&~t?P(Y1,null,[P("span",{class:"v-combobox__unmask"},[e.substr(0,t)]),P("span",{class:"v-combobox__mask"},[e.substr(t,i)]),P("span",{class:"v-combobox__unmask"},[e.substr(t+i)])]):e}const he2=k1({autoSelectFirst:{type:[Boolean,String]},delimiters:Array,...r51({filterKeys:["title"]}),...xe1({hideNoData:!0,returnObject:!0}),...wa(PH({modelValue:null,role:"combobox"}),["validationValue","dirty","appendInnerIcon"]),...wo({transition:!1})},"VCombobox"),pe2=h2()({name:"VCombobox",props:he2(),emits:{"update:focused":e=>!0,"update:modelValue":e=>!0,"update:search":e=>!0,"update:menu":e=>!0},setup(e,t){var C1,g1;let{emit:i,slots:a}=t;const{t:r}=er(),n=a1(),o=g2(!1),s=g2(!0),l=g2(!1),d=a1(),C=a1(),m=me(e,"menu"),u=q({get:()=>m.value,set:A1=>{var e1;m.value&&!A1&&((e1=d.value)==null?void 0:e1.\u03A8openChildren)||(m.value=A1)}}),p=g2(-1);let V=!1;const f=q(()=>{var A1;return(A1=n.value)==null?void 0:A1.color}),M=q(()=>u.value?e.closeText:e.openText),{items:H,transformIn:g,transformOut:_}=Se1(e),{textColorClasses:v,textColorStyles:S}=Bi(f),y=me(e,"modelValue",[],A1=>g(Ut(A1)),A1=>{var Y;const e1=_(A1);return e.multiple?e1:(Y=e1[0])!=null?Y:null}),D=AH(),R=g2(e.multiple?"":(g1=(C1=y.value[0])==null?void 0:C1.title)!=null?g1:""),N=q({get:()=>R.value,set:A1=>{var e1;if(R.value=A1!=null?A1:"",e.multiple||(y.value=[$r(e,A1)]),A1&&e.multiple&&((e1=e.delimiters)==null?void 0:e1.length)){const Y=A1.split(new RegExp(`(?:${e.delimiters.join("|")})+`));Y.length>1&&(Y.forEach(r1=>{r1=r1.trim(),r1&&o1($r(e,r1))}),R.value="")}A1||(p.value=-1),s.value=!A1}}),w=q(()=>typeof e.counterValue=="function"?e.counterValue(y.value):typeof e.counterValue=="number"?e.counterValue:e.multiple?y.value.length:N.value.length);T1(R,A1=>{V?k2(()=>V=!1):o.value&&!u.value&&(u.value=!0),i("update:search",A1)}),T1(y,A1=>{var e1,Y;e.multiple||(R.value=(Y=(e1=A1[0])==null?void 0:e1.title)!=null?Y:"")});const{filteredItems:x,getMatches:U}=n51(e,H,()=>s.value?"":N.value),E=q(()=>e.hideSelected?x.value.filter(A1=>!y.value.some(e1=>e1.value===A1.value)):x.value),O=q(()=>y.value.map(A1=>A1.value)),z=q(()=>{var e1;return(e.autoSelectFirst===!0||e.autoSelectFirst==="exact"&&N.value===((e1=E.value[0])==null?void 0:e1.title))&&E.value.length>0&&!s.value&&!l.value}),F=q(()=>e.hideNoData&&!H.value.length||e.readonly||(D==null?void 0:D.isReadonly.value)),J=a1(),{onListScroll:W,onListKeydown:n1}=Ue1(J,n);function $(A1){V=!0,e.openOnClear&&(u.value=!0)}function i1(){F.value||(u.value=!0)}function l1(A1){F.value||(o.value&&(A1.preventDefault(),A1.stopPropagation()),u.value=!u.value)}function f1(A1){var r1;if(Ox1(A1)||e.readonly||(D==null?void 0:D.isReadonly.value))return;const e1=n.value.selectionStart,Y=y.value.length;if((p.value>-1||["Enter","ArrowDown","ArrowUp"].includes(A1.key))&&A1.preventDefault(),["Enter","ArrowDown"].includes(A1.key)&&(u.value=!0),["Escape"].includes(A1.key)&&(u.value=!1),["Enter","Escape","Tab"].includes(A1.key)&&(z.value&&["Enter","Tab"].includes(A1.key)&&o1(x.value[0]),s.value=!0),A1.key==="ArrowDown"&&z.value&&((r1=J.value)==null||r1.focus("next")),!!e.multiple){if(["Backspace","Delete"].includes(A1.key)){if(p.value<0){A1.key==="Backspace"&&!N.value&&(p.value=Y-1);return}const c1=p.value,V1=y.value[p.value];V1&&!V1.props.disabled&&o1(V1,!1),p.value=c1>=Y-1?Y-2:c1}if(A1.key==="ArrowLeft"){if(p.value<0&&e1>0)return;const c1=p.value>-1?p.value-1:Y-1;y.value[c1]?p.value=c1:(p.value=-1,n.value.setSelectionRange(N.value.length,N.value.length))}if(A1.key==="ArrowRight"){if(p.value<0)return;const c1=p.value+1;y.value[c1]?p.value=c1:(p.value=-1,n.value.setSelectionRange(0,0))}A1.key==="Enter"&&N.value&&(o1($r(e,N.value)),N.value="")}}function M1(){var A1;o.value&&(s.value=!0,(A1=n.value)==null||A1.focus())}function o1(A1){let e1=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e.multiple){const Y=y.value.findIndex(c1=>e.valueComparator(c1.value,A1.value)),r1=e1==null?!~Y:e1;if(~Y){const c1=r1?[...y.value,A1]:[...y.value];c1.splice(Y,1),y.value=c1}else r1&&(y.value=[...y.value,A1]);N.value=""}else{const Y=e1!==!1;y.value=Y?[A1]:[],R.value=Y?A1.title:"",k2(()=>{u.value=!1,s.value=!0})}}function H1(A1){o.value=!0,setTimeout(()=>{l.value=!0})}function X(A1){l.value=!1}function t1(A1){(A1==null||A1===""&&!e.multiple)&&(y.value=[])}return T1(x,A1=>{!A1.length&&e.hideNoData&&(u.value=!1)}),T1(o,(A1,e1)=>{A1||A1===e1||(p.value=-1,u.value=!1,z.value&&!l.value&&!y.value.some(Y=>{let{value:r1}=Y;return r1===E.value[0].value})?o1(E.value[0]):e.multiple&&N.value&&o1($r(e,N.value)))}),T1(u,()=>{if(!e.hideSelected&&u.value&&y.value.length){const A1=E.value.findIndex(e1=>y.value.some(Y=>e.valueComparator(Y.value,e1.value)));ze&&window.requestAnimationFrame(()=>{var e1;A1>=0&&((e1=C.value)==null||e1.scrollToIndex(A1))})}}),H2(()=>{const A1=!!(e.chips||a.chip),e1=!!(!e.hideNoData||E.value.length||a["prepend-item"]||a["append-item"]||a["no-data"]),Y=y.value.length>0,r1=Ft.filterProps(e);return P(Ft,V2({ref:n},r1,{modelValue:N.value,"onUpdate:modelValue":[c1=>N.value=c1,t1],focused:o.value,"onUpdate:focused":c1=>o.value=c1,validationValue:y.externalValue,counterValue:w.value,dirty:Y,class:["v-combobox",{"v-combobox--active-menu":u.value,"v-combobox--chips":!!e.chips,"v-combobox--selection-slot":!!a.selection,"v-combobox--selecting-index":p.value>-1,[`v-combobox--${e.multiple?"multiple":"single"}`]:!0},e.class],style:e.style,readonly:e.readonly,placeholder:Y?void 0:e.placeholder,"onClick:clear":$,"onMousedown:control":i1,onKeydown:f1}),{...a,default:()=>P(Y1,null,[P(Ee1,V2({ref:d,modelValue:u.value,"onUpdate:modelValue":c1=>u.value=c1,activator:"parent",contentClass:"v-combobox__content",disabled:F.value,eager:e.eager,maxHeight:310,openOnClick:!1,closeOnContentClick:!1,transition:e.transition,onAfterLeave:M1},e.menuProps),{default:()=>{var c1;return[e1&&P(pd,{ref:J,selected:O.value,selectStrategy:e.multiple?"independent":"single-independent",onMousedown:V1=>V1.preventDefault(),onKeydown:n1,onFocusin:H1,onFocusout:X,onScrollPassive:W,tabindex:"-1",color:(c1=e.itemColor)!=null?c1:e.color},{default:()=>{var V1,_1,P1,O1;return[(V1=a["prepend-item"])==null?void 0:V1.call(a),!E.value.length&&!e.hideNoData&&((P1=(_1=a["no-data"])==null?void 0:_1.call(a))!=null?P1:P(ua,{title:r(e.noDataText)},null)),P(Oe1,{ref:C,renderless:!0,items:E.value},{default:x1=>{var u2,v2;let{item:y1,index:X1,itemRef:j1}=x1;const n2=V2(y1.props,{ref:j1,key:X1,active:z.value&&X1===0?!0:void 0,onClick:()=>o1(y1,null)});return(v2=(u2=a.item)==null?void 0:u2.call(a,{item:y1,index:X1,props:n2}))!=null?v2:P(ua,n2,{prepend:d2=>{let{isSelected:D2}=d2;return P(Y1,null,[e.multiple&&!e.hideSelected?P(vn,{key:y1.value,modelValue:D2,ripple:!1,tabindex:"-1"},null):void 0,y1.props.prependIcon&&P(Ze,{icon:y1.props.prependIcon},null)])},title:()=>{var d2,D2,y2;return s.value?y1.title:ue2(y1.title,(d2=U(y1))==null?void 0:d2.title,(y2=(D2=N.value)==null?void 0:D2.length)!=null?y2:0)}})}}),(O1=a["append-item"])==null?void 0:O1.call(a)]}})]}}),y.value.map((c1,V1)=>{function _1(y1){y1.stopPropagation(),y1.preventDefault(),o1(c1,!1)}const P1={"onClick:close":_1,onMousedown(y1){y1.preventDefault(),y1.stopPropagation()},modelValue:!0,"onUpdate:modelValue":void 0},O1=A1?!!a.chip:!!a.selection,x1=O1?sH(A1?a.chip({item:c1,index:V1,props:P1}):a.selection({item:c1,index:V1})):void 0;if(!(O1&&!x1))return P("div",{key:c1.value,class:["v-combobox__selection",V1===p.value&&["v-combobox__selection--selected",v.value]],style:V1===p.value?S.value:{}},[A1?a.chip?P(ot,{key:"chip-defaults",defaults:{VChip:{closable:e.closableChips,size:"small",text:c1.title}}},{default:()=>[x1]}):P(pe1,V2({key:"chip",closable:e.closableChips,size:"small",text:c1.title,disabled:c1.props.disabled},P1),null):x1!=null?x1:P("span",{class:"v-combobox__selection-text"},[c1.title,e.multiple&&V1{await s(),await l()});const s=async()=>{var p;const u=[];await t.videoStoringDB.iterate((V,f)=>{u.push({filename:f,size:0})});for(const V of u)V.size=(p=await t.videoStorageFileSize(V.filename))!=null?p:0;r.value=u},l=async()=>{const u=await t.temporaryVideoDBSize();n.value=u},d=async u=>{await t.discardFilesFromVideoDB(u),await s(),o.value=[]},C=async u=>{await t.downloadFilesFromVideoDB(u),await s(),o.value=[]},m=async()=>{t.clearTemporaryVideoDB(),await l()};return(u,p)=>{const V=F5("tooltip");return m1(),J1(To,null,{title:v1(()=>[M2("Video configuration")]),content:v1(()=>[fe2,K("div",Ve2,[P(pe2,{modelValue:B(i),"onUpdate:modelValue":p[0]||(p[0]=f=>ce(i)?i.value=f:null),multiple:"",items:B(a),label:"Allowed WebRTC remote IP Addresses",class:"w-full my-3 uri-input",variant:"outlined",chips:"",clearable:"",hint:"IP Addresses of the Vehicle allowed to be used for the WebRTC ICE Routing. Usually, the IP of the tether/cabled interface. Blank means any route. E.g: 192.168.2.2"},null,8,["modelValue","items"])]),r.value.isEmpty()?(m1(),N1("div",Le2,ge2)):(m1(),J1(B(rQ1),{key:1,hoverable:""},{default:v1(()=>[P(B(hQ1),null,{default:v1(()=>[P(B(_7)),P(B(_7),null,{default:v1(()=>[M2("Filename")]),_:1}),P(B(_7),null,{default:v1(()=>[M2("Size")]),_:1}),P(B(_7),null,{default:v1(()=>[o.value.isEmpty()?a2("",!0):(m1(),N1("span",{key:0,class:"text-base rounded-md cursor-pointer hover:text-slate-500/50 mdi mdi-trash-can",onClick:p[1]||(p[1]=f=>d(o.value))}))]),_:1}),P(B(_7),null,{default:v1(()=>[o.value.isEmpty()?a2("",!0):(m1(),N1("span",{key:0,class:"text-base rounded-md cursor-pointer hover:text-slate-500/50 mdi mdi-download",onClick:p[2]||(p[2]=f=>C(o.value))}))]),_:1})]),_:1}),P(B(sQ1),null,{default:v1(()=>[(m1(!0),N1(Y1,null,Me(r.value,f=>(m1(),J1(B(AQ1),{key:f.filename},{default:v1(()=>[P(B(v7),null,{default:v1(()=>[N2(K("input",{"onUpdate:modelValue":p[3]||(p[3]=M=>o.value=M),value:f.filename,type:"checkbox",class:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"},null,8,Ae2),[[CC,o.value]])]),_:2},1024),P(B(v7),null,{default:v1(()=>[M2(q1(f.filename),1)]),_:2},1024),P(B(v7),null,{default:v1(()=>[M2(q1(B(a_)(f.size)),1)]),_:2},1024),P(B(v7),null,{default:v1(()=>[o.value.isEmpty()?(m1(),N1("span",{key:0,class:"rounded-md cursor-pointer hover:text-slate-500/50 mdi mdi-trash-can",onClick:M=>d([f.filename])},null,8,ve2)):a2("",!0)]),_:2},1024),P(B(v7),null,{default:v1(()=>[o.value.isEmpty()?(m1(),N1("span",{key:0,class:"rounded-md cursor-pointer hover:text-slate-500/50 mdi mdi-download",onClick:M=>C([f.filename])},null,8,_e2)):a2("",!0)]),_:2},1024)]),_:2},1024))),128))]),_:1})]),_:1})),n.value>0?N2((m1(),N1("div",{key:2,class:"flex flex-col items-center justify-center p-4 m-4 transition-all rounded-md cursor-pointer bg-slate-600 text-slate-50 hover:bg-slate-500/80",onClick:p[4]||(p[4]=f=>m())},[Se2,K("span",De2,"Current size: "+q1(B(a_)(n.value)),1)])),[[V,"Remove video files used during the recording. This will not affect already saved videos.",void 0,{bottom:!0}]]):a2("",!0)]),_:1})}}});const Re2=k1({...F2(),...Pk()},"VLayout"),be2=h2()({name:"VLayout",props:Re2(),setup(e,t){let{slots:i}=t;const{layoutClasses:a,layoutStyles:r,getLayoutItem:n,items:o,layoutRef:s}=Ik(e);return H2(()=>{var l;return P("div",{ref:s,class:[a.value,e.class],style:[r.value,e.style]},[(l=i.default)==null?void 0:l.call(i)])}),{getLayoutItem:n,items:o}}});const Ne2=k1({scrollable:Boolean,...F2(),...w5({tag:"main"})},"VMain"),p01=h2()({name:"VMain",props:Ne2(),setup(e,t){let{slots:i}=t;const{mainStyles:a}=dk1(),{ssrBootStyles:r}=wH();return H2(()=>P(e.tag,{class:["v-main",{"v-main--scrollable":e.scrollable},e.class],style:[a.value,r.value,e.style]},{default:()=>{var n,o;return[e.scrollable?P("div",{class:"v-main__scroller"},[(n=i.default)==null?void 0:n.call(i)]):(o=i.default)==null?void 0:o.call(i)]}})),{}}});function we2(e){let{rootEl:t,isSticky:i,layoutItemStyles:a}=e;const r=g2(!1),n=g2(0),o=q(()=>{const d=typeof r.value=="boolean"?"top":r.value;return[i.value?{top:"auto",bottom:"auto",height:void 0}:void 0,r.value?{[d]:f2(n.value)}:{top:a.value.top}]});ee(()=>{T1(i,d=>{d?window.addEventListener("scroll",l,{passive:!0}):window.removeEventListener("scroll",l)},{immediate:!0})}),xe(()=>{window.removeEventListener("scroll",l)});let s=0;function l(){var f;const d=s>window.scrollY?"up":"down",C=t.value.getBoundingClientRect(),m=parseFloat((f=a.value.top)!=null?f:0),u=window.scrollY-Math.max(0,n.value-m),p=C.height+Math.max(n.value,m)-window.scrollY-window.innerHeight,V=parseFloat(getComputedStyle(t.value).getPropertyValue("--v-body-scroll-y"))||0;C.height0;i--){if(e[i].t===e[i-1].t)continue;const a=OD(t),r=(e[i].d-e[i-1].d)/(e[i].t-e[i-1].t);t+=(r-a)*Math.abs(r),i===e.length-1&&(t*=.5)}return OD(t)*1e3}function Pe2(){const e={};function t(r){Array.from(r.changedTouches).forEach(n=>{var s;((s=e[n.identifier])!=null?s:e[n.identifier]=new Fx1(Ee2)).push([r.timeStamp,n])})}function i(r){Array.from(r.changedTouches).forEach(n=>{delete e[n.identifier]})}function a(r){var d;const n=(d=e[r])==null?void 0:d.values().reverse();if(!n)throw new Error(`No samples for touch id ${r}`);const o=n[0],s=[],l=[];for(const C of n){if(o[0]-C[0]>Te2)break;s.push({t:C[0],d:C[1].clientX}),l.push({t:C[0],d:C[1].clientY})}return{x:UD(s),y:UD(l),get direction(){const{x:C,y:m}=this,[u,p]=[Math.abs(C),Math.abs(m)];return u>p&&C>=0?"right":u>p&&C<=0?"left":p>u&&m>=0?"down":p>u&&m<=0?"up":Ie2()}}}return{addMovement:t,endTouch:i,getVelocity:a}}function Ie2(){throw new Error}function Oe2(e){let{isActive:t,isTemporary:i,width:a,touchless:r,position:n}=e;ee(()=>{window.addEventListener("touchstart",H,{passive:!0}),window.addEventListener("touchmove",g,{passive:!1}),window.addEventListener("touchend",_,{passive:!0})}),xe(()=>{window.removeEventListener("touchstart",H),window.removeEventListener("touchmove",g),window.removeEventListener("touchend",_)});const o=q(()=>["left","right"].includes(n.value)),{addMovement:s,endTouch:l,getVelocity:d}=Pe2();let C=!1;const m=g2(!1),u=g2(0),p=g2(0);let V;function f(S,y){return(n.value==="left"?S:n.value==="right"?document.documentElement.clientWidth-S:n.value==="top"?S:n.value==="bottom"?document.documentElement.clientHeight-S:H6())-(y?a.value:0)}function M(S){let y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;const D=n.value==="left"?(S-p.value)/a.value:n.value==="right"?(document.documentElement.clientWidth-S-p.value)/a.value:n.value==="top"?(S-p.value)/a.value:n.value==="bottom"?(document.documentElement.clientHeight-S-p.value)/a.value:H6();return y?Math.max(0,Math.min(1,D)):D}function H(S){if(r.value)return;const y=S.changedTouches[0].clientX,D=S.changedTouches[0].clientY,R=25,N=n.value==="left"?ydocument.documentElement.clientWidth-R:n.value==="top"?Ddocument.documentElement.clientHeight-R:H6(),w=t.value&&(n.value==="left"?ydocument.documentElement.clientWidth-a.value:n.value==="top"?Ddocument.documentElement.clientHeight-a.value:H6());(N||w||t.value&&i.value)&&(C=!0,V=[y,D],p.value=f(o.value?y:D,t.value),u.value=M(o.value?y:D),l(S),s(S))}function g(S){const y=S.changedTouches[0].clientX,D=S.changedTouches[0].clientY;if(C){if(!S.cancelable){C=!1;return}const N=Math.abs(y-V[0]),w=Math.abs(D-V[1]);(o.value?N>w&&N>3:w>N&&w>3)?(m.value=!0,C=!1):(o.value?w:N)>3&&(C=!1)}if(!m.value)return;S.preventDefault(),s(S);const R=M(o.value?y:D,!1);u.value=Math.max(0,Math.min(1,R)),R>1?p.value=f(o.value?y:D,!0):R<0&&(p.value=f(o.value?y:D,!1))}function _(S){if(C=!1,!m.value)return;s(S),m.value=!1;const y=d(S.changedTouches[0].identifier),D=Math.abs(y.x),R=Math.abs(y.y);(o.value?D>R&&D>400:R>D&&R>3)?t.value=y.direction===({left:"right",right:"left",top:"down",bottom:"up"}[n.value]||H6()):t.value=u.value>.5}const v=q(()=>m.value?{transform:n.value==="left"?`translateX(calc(-100% + ${u.value*a.value}px))`:n.value==="right"?`translateX(calc(100% - ${u.value*a.value}px))`:n.value==="top"?`translateY(calc(-100% + ${u.value*a.value}px))`:n.value==="bottom"?`translateY(calc(100% - ${u.value*a.value}px))`:H6(),transition:"none"}:void 0);return{isDragging:m,dragProgress:u,dragStyles:v}}function H6(){throw new Error}const Ue2=["start","end","left","right","top","bottom"],xe2=k1({color:String,disableResizeWatcher:Boolean,disableRouteWatcher:Boolean,expandOnHover:Boolean,floating:Boolean,modelValue:{type:Boolean,default:null},permanent:Boolean,rail:{type:Boolean,default:null},railWidth:{type:[Number,String],default:56},scrim:{type:[Boolean,String],default:!0},image:String,temporary:Boolean,touchless:Boolean,width:{type:[Number,String],default:256},location:{type:String,default:"start",validator:e=>Ue2.includes(e)},sticky:Boolean,...Ea(),...F2(),...tk1(),...Xi(),...ck1(),...p0(),...w5({tag:"nav"}),...p5()},"VNavigationDrawer"),Fe2=h2()({name:"VNavigationDrawer",props:xe2(),emits:{"update:modelValue":e=>!0,"update:rail":e=>!0},setup(e,t){let{attrs:i,emit:a,slots:r}=t;const{isRtl:n}=pi(),{themeClasses:o}=b5(e),{borderClasses:s}=ar(e),{backgroundColorClasses:l,backgroundColorStyles:d}=d0(t2(e,"color")),{elevationClasses:C}=O3(e),{displayClasses:m,mobile:u}=T8(e),{roundedClasses:p}=F0(e),V=W21(),f=me(e,"modelValue",null,$=>!!$),{ssrBootStyles:M}=wH(),{scopeId:H}=am(),g=a1(),_=g2(!1),v=q(()=>e.rail&&e.expandOnHover&&_.value?Number(e.width):Number(e.rail?e.railWidth:e.width)),S=q(()=>Ip(e.location,n.value)),y=q(()=>!e.permanent&&(u.value||e.temporary)),D=q(()=>e.sticky&&!y.value&&S.value!=="bottom");M3(()=>e.expandOnHover&&e.rail!=null,()=>{T1(_,$=>a("update:rail",!$))}),M3(()=>!e.disableResizeWatcher,()=>{T1(y,$=>!e.permanent&&k2(()=>f.value=!$))}),M3(()=>!e.disableRouteWatcher&&!!V,()=>{T1(V.currentRoute,()=>y.value&&(f.value=!1))}),T1(()=>e.permanent,$=>{$&&(f.value=!0)}),k5(()=>{e.modelValue!=null||y.value||(f.value=e.permanent||!u.value)});const{isDragging:R,dragProgress:N,dragStyles:w}=Oe2({isActive:f,isTemporary:y,width:v,touchless:t2(e,"touchless"),position:S}),x=q(()=>{const $=y.value?0:e.rail&&e.expandOnHover?Number(e.railWidth):v.value;return R.value?$*N.value:$}),{layoutItemStyles:U,layoutItemScrimStyles:E}=Ck1({id:e.name,order:q(()=>parseInt(e.order,10)),position:S,layoutSize:x,elementSize:v,active:q(()=>f.value||R.value),disableTransitions:q(()=>R.value),absolute:q(()=>e.absolute||D.value&&typeof O.value!="string")}),{isStuck:O,stickyStyles:z}=we2({rootEl:g,isSticky:D,layoutItemStyles:U}),F=d0(q(()=>typeof e.scrim=="string"?e.scrim:null)),J=q(()=>({...R.value?{opacity:N.value*.2,transition:"none"}:void 0,...E.value}));I0({VList:{bgColor:"transparent"}});function W(){_.value=!0}function n1(){_.value=!1}return H2(()=>{const $=r.image||e.image;return P(Y1,null,[P(e.tag,V2({ref:g,onMouseenter:W,onMouseleave:n1,class:["v-navigation-drawer",`v-navigation-drawer--${S.value}`,{"v-navigation-drawer--expand-on-hover":e.expandOnHover,"v-navigation-drawer--floating":e.floating,"v-navigation-drawer--is-hovering":_.value,"v-navigation-drawer--rail":e.rail,"v-navigation-drawer--temporary":y.value,"v-navigation-drawer--active":f.value,"v-navigation-drawer--sticky":D.value},o.value,l.value,s.value,m.value,C.value,p.value,e.class],style:[d.value,U.value,w.value,M.value,z.value,e.style]},H,i),{default:()=>{var i1,l1,f1,M1;return[$&&P("div",{key:"image",class:"v-navigation-drawer__img"},[r.image?(i1=r.image)==null?void 0:i1.call(r,{image:e.image}):P("img",{src:e.image,alt:""},null)]),r.prepend&&P("div",{class:"v-navigation-drawer__prepend"},[(l1=r.prepend)==null?void 0:l1.call(r)]),P("div",{class:"v-navigation-drawer__content"},[(f1=r.default)==null?void 0:f1.call(r)]),r.append&&P("div",{class:"v-navigation-drawer__append"},[(M1=r.append)==null?void 0:M1.call(r)])]}}),P(q5,{name:"fade-transition"},{default:()=>[y.value&&(R.value||f.value)&&!!e.scrim&&P("div",V2({class:["v-navigation-drawer__scrim",F.backgroundColorClasses.value],style:[J.value,F.backgroundColorStyles.value],onClick:()=>f.value=!1},H),null)]})])}),{isStuck:O}}}),ke2=s2({__name:"ConfigurationMenu",setup(e){const t=c5(),i=a1([D_]),{mdAndDown:a}=T8(),r=[{icon:"mdi-book-open-blank-variant",title:"General",component:D_},{icon:"mdi-controller",title:"Joystick",component:aq1},{icon:"mdi-video",title:"Video",component:ye2},{icon:"mdi-script",title:"Logs",component:sq1},{icon:"mdi-bell-ring",title:"Alerts",component:Oz1},{icon:"mdi-dev-to",title:"Development",component:JG1}],n=q(()=>t==null?void 0:t.configurationPages);return(o,s)=>(m1(),J1(st,{width:"100%",height:"100%"},{default:v1(()=>[P(be2,null,{default:v1(()=>[P(Fe2,{permanent:"",rail:B(a),"expand-on-hover":B(a),elevation:B(a)?5:0},{default:v1(()=>[P(pd,{selected:i.value,"onUpdate:selected":s[0]||(s[0]=l=>i.value=l)},{default:v1(()=>[P(ua,{"prepend-icon":"mdi-view-dashboard",title:"Configuration menu"}),P(qs),(m1(),N1(Y1,null,Me(r,(l,d)=>P(ua,{key:d,"prepend-icon":l.icon,title:l.title,value:l.component},null,8,["prepend-icon","title","value"])),64))]),_:1},8,["selected"]),P(qs),P(pd,{selected:i.value,"onUpdate:selected":s[1]||(s[1]=l=>i.value=l)},{default:v1(()=>[(m1(!0),N1(Y1,null,Me(n.value,(l,d)=>(m1(),J1(ua,{key:d,"prepend-icon":l.icon,title:l.title,value:l.component},null,8,["prepend-icon","title","value"]))),128))]),_:1},8,["selected"])]),_:1},8,["rail","expand-on-hover","elevation"]),P(p01,{scrollable:""},{default:v1(()=>[(m1(),J1(un(i.value[0])))]),_:1})]),_:1})]),_:1}))}});var f01={exports:{}};const Be2=za1(Fn1);(function(e){e.exports=function(t){var i={};function a(r){if(i[r])return i[r].exports;var n=i[r]={i:r,l:!1,exports:{}};return t[r].call(n.exports,n,n.exports,a),n.l=!0,n.exports}return a.m=t,a.c=i,a.d=function(r,n,o){a.o(r,n)||Object.defineProperty(r,n,{enumerable:!0,get:o})},a.r=function(r){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},a.t=function(r,n){if(n&1&&(r=a(r)),n&8||n&4&&typeof r=="object"&&r&&r.__esModule)return r;var o=Object.create(null);if(a.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:r}),n&2&&typeof r!="string")for(var s in r)a.d(o,s,function(l){return r[l]}.bind(null,s));return o},a.n=function(r){var n=r&&r.__esModule?function(){return r.default}:function(){return r};return a.d(n,"a",n),n},a.o=function(r,n){return Object.prototype.hasOwnProperty.call(r,n)},a.p="",a(a.s="fb15")}({"24fb":function(t,i,a){t.exports=function(o){var s=[];return s.toString=function(){return this.map(function(d){var C=r(d,o);return d[2]?"@media ".concat(d[2]," {").concat(C,"}"):C}).join("")},s.i=function(l,d,C){typeof l=="string"&&(l=[[null,l,""]]);var m={};if(C)for(var u=0;u{const E=[];if(m.value.forEach(O=>{f(O)||(H(O),E.push(O))}),E.isEmpty()){t.pushAlert(new ii(_e.Error,"No streams available to be recorded."));return}t.pushAlert(new ii(_e.Success,`Started recording streams: ${E.join(", ")}.`))},U=()=>{const E=[];if(m.value.forEach(O=>{f(O)&&(M(O),E.push(O))}),E.isEmpty()){t.pushAlert(new ii(_e.Error,"No streams were being recorded."));return}t.pushAlert(new ii(_e.Success,`Stopped recording streams: ${E.join(", ")}.`))};return W4(it.start_recording_all_streams,Fg(x,3e3)),W4(it.stop_recording_all_streams,Fg(U,3e3)),{availableIceIps:d,allowedIceIps:n,namesAvailableStreams:m,videoStoringDB:R,tempVideoChunksDB:D,discardFilesFromVideoDB:g,downloadFilesFromVideoDB:_,clearTemporaryVideoDB:v,temporaryVideoDBSize:S,videoStorageFileSize:y,getMediaStream:V,getStreamData:p,isRecording:f,stopRecording:M,startRecording:H}});function ue2(e,t,i){if(t==null)return e;if(Array.isArray(t))throw new Error("Multiple matches is not implemented");return typeof t=="number"&&~t?P(Y1,null,[P("span",{class:"v-combobox__unmask"},[e.substr(0,t)]),P("span",{class:"v-combobox__mask"},[e.substr(t,i)]),P("span",{class:"v-combobox__unmask"},[e.substr(t+i)])]):e}const he2=k1({autoSelectFirst:{type:[Boolean,String]},delimiters:Array,...r51({filterKeys:["title"]}),...xe1({hideNoData:!0,returnObject:!0}),...wa(PH({modelValue:null,role:"combobox"}),["validationValue","dirty","appendInnerIcon"]),...wo({transition:!1})},"VCombobox"),pe2=h2()({name:"VCombobox",props:he2(),emits:{"update:focused":e=>!0,"update:modelValue":e=>!0,"update:search":e=>!0,"update:menu":e=>!0},setup(e,t){var C1,g1;let{emit:i,slots:a}=t;const{t:r}=er(),n=a1(),o=g2(!1),s=g2(!0),l=g2(!1),d=a1(),C=a1(),m=me(e,"menu"),u=q({get:()=>m.value,set:A1=>{var e1;m.value&&!A1&&((e1=d.value)==null?void 0:e1.\u03A8openChildren)||(m.value=A1)}}),p=g2(-1);let V=!1;const f=q(()=>{var A1;return(A1=n.value)==null?void 0:A1.color}),M=q(()=>u.value?e.closeText:e.openText),{items:H,transformIn:g,transformOut:_}=Se1(e),{textColorClasses:v,textColorStyles:S}=Bi(f),y=me(e,"modelValue",[],A1=>g(Ut(A1)),A1=>{var Y;const e1=_(A1);return e.multiple?e1:(Y=e1[0])!=null?Y:null}),D=AH(),R=g2(e.multiple?"":(g1=(C1=y.value[0])==null?void 0:C1.title)!=null?g1:""),N=q({get:()=>R.value,set:A1=>{var e1;if(R.value=A1!=null?A1:"",e.multiple||(y.value=[$r(e,A1)]),A1&&e.multiple&&((e1=e.delimiters)==null?void 0:e1.length)){const Y=A1.split(new RegExp(`(?:${e.delimiters.join("|")})+`));Y.length>1&&(Y.forEach(r1=>{r1=r1.trim(),r1&&o1($r(e,r1))}),R.value="")}A1||(p.value=-1),s.value=!A1}}),w=q(()=>typeof e.counterValue=="function"?e.counterValue(y.value):typeof e.counterValue=="number"?e.counterValue:e.multiple?y.value.length:N.value.length);T1(R,A1=>{V?k2(()=>V=!1):o.value&&!u.value&&(u.value=!0),i("update:search",A1)}),T1(y,A1=>{var e1,Y;e.multiple||(R.value=(Y=(e1=A1[0])==null?void 0:e1.title)!=null?Y:"")});const{filteredItems:x,getMatches:U}=n51(e,H,()=>s.value?"":N.value),E=q(()=>e.hideSelected?x.value.filter(A1=>!y.value.some(e1=>e1.value===A1.value)):x.value),O=q(()=>y.value.map(A1=>A1.value)),z=q(()=>{var e1;return(e.autoSelectFirst===!0||e.autoSelectFirst==="exact"&&N.value===((e1=E.value[0])==null?void 0:e1.title))&&E.value.length>0&&!s.value&&!l.value}),F=q(()=>e.hideNoData&&!H.value.length||e.readonly||(D==null?void 0:D.isReadonly.value)),J=a1(),{onListScroll:W,onListKeydown:n1}=Ue1(J,n);function $(A1){V=!0,e.openOnClear&&(u.value=!0)}function i1(){F.value||(u.value=!0)}function l1(A1){F.value||(o.value&&(A1.preventDefault(),A1.stopPropagation()),u.value=!u.value)}function f1(A1){var r1;if(Ox1(A1)||e.readonly||(D==null?void 0:D.isReadonly.value))return;const e1=n.value.selectionStart,Y=y.value.length;if((p.value>-1||["Enter","ArrowDown","ArrowUp"].includes(A1.key))&&A1.preventDefault(),["Enter","ArrowDown"].includes(A1.key)&&(u.value=!0),["Escape"].includes(A1.key)&&(u.value=!1),["Enter","Escape","Tab"].includes(A1.key)&&(z.value&&["Enter","Tab"].includes(A1.key)&&o1(x.value[0]),s.value=!0),A1.key==="ArrowDown"&&z.value&&((r1=J.value)==null||r1.focus("next")),!!e.multiple){if(["Backspace","Delete"].includes(A1.key)){if(p.value<0){A1.key==="Backspace"&&!N.value&&(p.value=Y-1);return}const c1=p.value,V1=y.value[p.value];V1&&!V1.props.disabled&&o1(V1,!1),p.value=c1>=Y-1?Y-2:c1}if(A1.key==="ArrowLeft"){if(p.value<0&&e1>0)return;const c1=p.value>-1?p.value-1:Y-1;y.value[c1]?p.value=c1:(p.value=-1,n.value.setSelectionRange(N.value.length,N.value.length))}if(A1.key==="ArrowRight"){if(p.value<0)return;const c1=p.value+1;y.value[c1]?p.value=c1:(p.value=-1,n.value.setSelectionRange(0,0))}A1.key==="Enter"&&N.value&&(o1($r(e,N.value)),N.value="")}}function M1(){var A1;o.value&&(s.value=!0,(A1=n.value)==null||A1.focus())}function o1(A1){let e1=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e.multiple){const Y=y.value.findIndex(c1=>e.valueComparator(c1.value,A1.value)),r1=e1==null?!~Y:e1;if(~Y){const c1=r1?[...y.value,A1]:[...y.value];c1.splice(Y,1),y.value=c1}else r1&&(y.value=[...y.value,A1]);N.value=""}else{const Y=e1!==!1;y.value=Y?[A1]:[],R.value=Y?A1.title:"",k2(()=>{u.value=!1,s.value=!0})}}function H1(A1){o.value=!0,setTimeout(()=>{l.value=!0})}function X(A1){l.value=!1}function t1(A1){(A1==null||A1===""&&!e.multiple)&&(y.value=[])}return T1(x,A1=>{!A1.length&&e.hideNoData&&(u.value=!1)}),T1(o,(A1,e1)=>{A1||A1===e1||(p.value=-1,u.value=!1,z.value&&!l.value&&!y.value.some(Y=>{let{value:r1}=Y;return r1===E.value[0].value})?o1(E.value[0]):e.multiple&&N.value&&o1($r(e,N.value)))}),T1(u,()=>{if(!e.hideSelected&&u.value&&y.value.length){const A1=E.value.findIndex(e1=>y.value.some(Y=>e.valueComparator(Y.value,e1.value)));ze&&window.requestAnimationFrame(()=>{var e1;A1>=0&&((e1=C.value)==null||e1.scrollToIndex(A1))})}}),H2(()=>{const A1=!!(e.chips||a.chip),e1=!!(!e.hideNoData||E.value.length||a["prepend-item"]||a["append-item"]||a["no-data"]),Y=y.value.length>0,r1=Ft.filterProps(e);return P(Ft,V2({ref:n},r1,{modelValue:N.value,"onUpdate:modelValue":[c1=>N.value=c1,t1],focused:o.value,"onUpdate:focused":c1=>o.value=c1,validationValue:y.externalValue,counterValue:w.value,dirty:Y,class:["v-combobox",{"v-combobox--active-menu":u.value,"v-combobox--chips":!!e.chips,"v-combobox--selection-slot":!!a.selection,"v-combobox--selecting-index":p.value>-1,[`v-combobox--${e.multiple?"multiple":"single"}`]:!0},e.class],style:e.style,readonly:e.readonly,placeholder:Y?void 0:e.placeholder,"onClick:clear":$,"onMousedown:control":i1,onKeydown:f1}),{...a,default:()=>P(Y1,null,[P(Ee1,V2({ref:d,modelValue:u.value,"onUpdate:modelValue":c1=>u.value=c1,activator:"parent",contentClass:"v-combobox__content",disabled:F.value,eager:e.eager,maxHeight:310,openOnClick:!1,closeOnContentClick:!1,transition:e.transition,onAfterLeave:M1},e.menuProps),{default:()=>{var c1;return[e1&&P(pd,{ref:J,selected:O.value,selectStrategy:e.multiple?"independent":"single-independent",onMousedown:V1=>V1.preventDefault(),onKeydown:n1,onFocusin:H1,onFocusout:X,onScrollPassive:W,tabindex:"-1",color:(c1=e.itemColor)!=null?c1:e.color},{default:()=>{var V1,_1,P1,O1;return[(V1=a["prepend-item"])==null?void 0:V1.call(a),!E.value.length&&!e.hideNoData&&((P1=(_1=a["no-data"])==null?void 0:_1.call(a))!=null?P1:P(ua,{title:r(e.noDataText)},null)),P(Oe1,{ref:C,renderless:!0,items:E.value},{default:x1=>{var u2,v2;let{item:y1,index:X1,itemRef:j1}=x1;const n2=V2(y1.props,{ref:j1,key:X1,active:z.value&&X1===0?!0:void 0,onClick:()=>o1(y1,null)});return(v2=(u2=a.item)==null?void 0:u2.call(a,{item:y1,index:X1,props:n2}))!=null?v2:P(ua,n2,{prepend:d2=>{let{isSelected:D2}=d2;return P(Y1,null,[e.multiple&&!e.hideSelected?P(vn,{key:y1.value,modelValue:D2,ripple:!1,tabindex:"-1"},null):void 0,y1.props.prependIcon&&P(Ze,{icon:y1.props.prependIcon},null)])},title:()=>{var d2,D2,y2;return s.value?y1.title:ue2(y1.title,(d2=U(y1))==null?void 0:d2.title,(y2=(D2=N.value)==null?void 0:D2.length)!=null?y2:0)}})}}),(O1=a["append-item"])==null?void 0:O1.call(a)]}})]}}),y.value.map((c1,V1)=>{function _1(y1){y1.stopPropagation(),y1.preventDefault(),o1(c1,!1)}const P1={"onClick:close":_1,onMousedown(y1){y1.preventDefault(),y1.stopPropagation()},modelValue:!0,"onUpdate:modelValue":void 0},O1=A1?!!a.chip:!!a.selection,x1=O1?sH(A1?a.chip({item:c1,index:V1,props:P1}):a.selection({item:c1,index:V1})):void 0;if(!(O1&&!x1))return P("div",{key:c1.value,class:["v-combobox__selection",V1===p.value&&["v-combobox__selection--selected",v.value]],style:V1===p.value?S.value:{}},[A1?a.chip?P(ot,{key:"chip-defaults",defaults:{VChip:{closable:e.closableChips,size:"small",text:c1.title}}},{default:()=>[x1]}):P(pe1,V2({key:"chip",closable:e.closableChips,size:"small",text:c1.title,disabled:c1.props.disabled},P1),null):x1!=null?x1:P("span",{class:"v-combobox__selection-text"},[c1.title,e.multiple&&V1{await s(),await l()});const s=async()=>{var p;const u=[];await t.videoStoringDB.iterate((V,f)=>{u.push({filename:f,size:0})});for(const V of u)V.size=(p=await t.videoStorageFileSize(V.filename))!=null?p:0;r.value=u},l=async()=>{const u=await t.temporaryVideoDBSize();n.value=u},d=async u=>{await t.discardFilesFromVideoDB(u),await s(),o.value=[]},C=async u=>{await t.downloadFilesFromVideoDB(u),await s(),o.value=[]},m=async()=>{await t.clearTemporaryVideoDB(),await l()};return(u,p)=>{const V=F5("tooltip");return m1(),J1(To,null,{title:v1(()=>[M2("Video configuration")]),content:v1(()=>[fe2,K("div",Ve2,[P(pe2,{modelValue:B(i),"onUpdate:modelValue":p[0]||(p[0]=f=>ce(i)?i.value=f:null),multiple:"",items:B(a),label:"Allowed WebRTC remote IP Addresses",class:"w-full my-3 uri-input",variant:"outlined",chips:"",clearable:"",hint:"IP Addresses of the Vehicle allowed to be used for the WebRTC ICE Routing. Usually, the IP of the tether/cabled interface. Blank means any route. E.g: 192.168.2.2"},null,8,["modelValue","items"])]),r.value.isEmpty()?(m1(),N1("div",Le2,ge2)):(m1(),J1(B(rQ1),{key:1,hoverable:""},{default:v1(()=>[P(B(hQ1),null,{default:v1(()=>[P(B(_7)),P(B(_7),null,{default:v1(()=>[M2("Filename")]),_:1}),P(B(_7),null,{default:v1(()=>[M2("Size")]),_:1}),P(B(_7),null,{default:v1(()=>[o.value.isEmpty()?a2("",!0):(m1(),N1("span",{key:0,class:"text-base rounded-md cursor-pointer hover:text-slate-500/50 mdi mdi-trash-can",onClick:p[1]||(p[1]=f=>d(o.value))}))]),_:1}),P(B(_7),null,{default:v1(()=>[o.value.isEmpty()?a2("",!0):(m1(),N1("span",{key:0,class:"text-base rounded-md cursor-pointer hover:text-slate-500/50 mdi mdi-download",onClick:p[2]||(p[2]=f=>C(o.value))}))]),_:1})]),_:1}),P(B(sQ1),null,{default:v1(()=>[(m1(!0),N1(Y1,null,Me(r.value,f=>(m1(),J1(B(AQ1),{key:f.filename},{default:v1(()=>[P(B(v7),null,{default:v1(()=>[N2(K("input",{"onUpdate:modelValue":p[3]||(p[3]=M=>o.value=M),value:f.filename,type:"checkbox",class:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"},null,8,Ae2),[[CC,o.value]])]),_:2},1024),P(B(v7),null,{default:v1(()=>[M2(q1(f.filename),1)]),_:2},1024),P(B(v7),null,{default:v1(()=>[M2(q1(B(a_)(f.size)),1)]),_:2},1024),P(B(v7),null,{default:v1(()=>[o.value.isEmpty()?(m1(),N1("span",{key:0,class:"rounded-md cursor-pointer hover:text-slate-500/50 mdi mdi-trash-can",onClick:M=>d([f.filename])},null,8,ve2)):a2("",!0)]),_:2},1024),P(B(v7),null,{default:v1(()=>[o.value.isEmpty()?(m1(),N1("span",{key:0,class:"rounded-md cursor-pointer hover:text-slate-500/50 mdi mdi-download",onClick:M=>C([f.filename])},null,8,_e2)):a2("",!0)]),_:2},1024)]),_:2},1024))),128))]),_:1})]),_:1})),n.value>0?N2((m1(),N1("div",{key:2,class:"flex flex-col items-center justify-center p-4 m-4 transition-all rounded-md cursor-pointer bg-slate-600 text-slate-50 hover:bg-slate-500/80",onClick:p[4]||(p[4]=f=>m())},[Se2,K("span",De2,"Current size: "+q1(B(a_)(n.value)),1)])),[[V,"Remove video files used during the recording. This will not affect already saved videos.",void 0,{bottom:!0}]]):a2("",!0)]),_:1})}}});const Re2=k1({...F2(),...Pk()},"VLayout"),be2=h2()({name:"VLayout",props:Re2(),setup(e,t){let{slots:i}=t;const{layoutClasses:a,layoutStyles:r,getLayoutItem:n,items:o,layoutRef:s}=Ik(e);return H2(()=>{var l;return P("div",{ref:s,class:[a.value,e.class],style:[r.value,e.style]},[(l=i.default)==null?void 0:l.call(i)])}),{getLayoutItem:n,items:o}}});const Ne2=k1({scrollable:Boolean,...F2(),...w5({tag:"main"})},"VMain"),p01=h2()({name:"VMain",props:Ne2(),setup(e,t){let{slots:i}=t;const{mainStyles:a}=dk1(),{ssrBootStyles:r}=wH();return H2(()=>P(e.tag,{class:["v-main",{"v-main--scrollable":e.scrollable},e.class],style:[a.value,r.value,e.style]},{default:()=>{var n,o;return[e.scrollable?P("div",{class:"v-main__scroller"},[(n=i.default)==null?void 0:n.call(i)]):(o=i.default)==null?void 0:o.call(i)]}})),{}}});function we2(e){let{rootEl:t,isSticky:i,layoutItemStyles:a}=e;const r=g2(!1),n=g2(0),o=q(()=>{const d=typeof r.value=="boolean"?"top":r.value;return[i.value?{top:"auto",bottom:"auto",height:void 0}:void 0,r.value?{[d]:f2(n.value)}:{top:a.value.top}]});ee(()=>{T1(i,d=>{d?window.addEventListener("scroll",l,{passive:!0}):window.removeEventListener("scroll",l)},{immediate:!0})}),xe(()=>{window.removeEventListener("scroll",l)});let s=0;function l(){var f;const d=s>window.scrollY?"up":"down",C=t.value.getBoundingClientRect(),m=parseFloat((f=a.value.top)!=null?f:0),u=window.scrollY-Math.max(0,n.value-m),p=C.height+Math.max(n.value,m)-window.scrollY-window.innerHeight,V=parseFloat(getComputedStyle(t.value).getPropertyValue("--v-body-scroll-y"))||0;C.height0;i--){if(e[i].t===e[i-1].t)continue;const a=OD(t),r=(e[i].d-e[i-1].d)/(e[i].t-e[i-1].t);t+=(r-a)*Math.abs(r),i===e.length-1&&(t*=.5)}return OD(t)*1e3}function Pe2(){const e={};function t(r){Array.from(r.changedTouches).forEach(n=>{var s;((s=e[n.identifier])!=null?s:e[n.identifier]=new Fx1(Ee2)).push([r.timeStamp,n])})}function i(r){Array.from(r.changedTouches).forEach(n=>{delete e[n.identifier]})}function a(r){var d;const n=(d=e[r])==null?void 0:d.values().reverse();if(!n)throw new Error(`No samples for touch id ${r}`);const o=n[0],s=[],l=[];for(const C of n){if(o[0]-C[0]>Te2)break;s.push({t:C[0],d:C[1].clientX}),l.push({t:C[0],d:C[1].clientY})}return{x:UD(s),y:UD(l),get direction(){const{x:C,y:m}=this,[u,p]=[Math.abs(C),Math.abs(m)];return u>p&&C>=0?"right":u>p&&C<=0?"left":p>u&&m>=0?"down":p>u&&m<=0?"up":Ie2()}}}return{addMovement:t,endTouch:i,getVelocity:a}}function Ie2(){throw new Error}function Oe2(e){let{isActive:t,isTemporary:i,width:a,touchless:r,position:n}=e;ee(()=>{window.addEventListener("touchstart",H,{passive:!0}),window.addEventListener("touchmove",g,{passive:!1}),window.addEventListener("touchend",_,{passive:!0})}),xe(()=>{window.removeEventListener("touchstart",H),window.removeEventListener("touchmove",g),window.removeEventListener("touchend",_)});const o=q(()=>["left","right"].includes(n.value)),{addMovement:s,endTouch:l,getVelocity:d}=Pe2();let C=!1;const m=g2(!1),u=g2(0),p=g2(0);let V;function f(S,y){return(n.value==="left"?S:n.value==="right"?document.documentElement.clientWidth-S:n.value==="top"?S:n.value==="bottom"?document.documentElement.clientHeight-S:H6())-(y?a.value:0)}function M(S){let y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;const D=n.value==="left"?(S-p.value)/a.value:n.value==="right"?(document.documentElement.clientWidth-S-p.value)/a.value:n.value==="top"?(S-p.value)/a.value:n.value==="bottom"?(document.documentElement.clientHeight-S-p.value)/a.value:H6();return y?Math.max(0,Math.min(1,D)):D}function H(S){if(r.value)return;const y=S.changedTouches[0].clientX,D=S.changedTouches[0].clientY,R=25,N=n.value==="left"?ydocument.documentElement.clientWidth-R:n.value==="top"?Ddocument.documentElement.clientHeight-R:H6(),w=t.value&&(n.value==="left"?ydocument.documentElement.clientWidth-a.value:n.value==="top"?Ddocument.documentElement.clientHeight-a.value:H6());(N||w||t.value&&i.value)&&(C=!0,V=[y,D],p.value=f(o.value?y:D,t.value),u.value=M(o.value?y:D),l(S),s(S))}function g(S){const y=S.changedTouches[0].clientX,D=S.changedTouches[0].clientY;if(C){if(!S.cancelable){C=!1;return}const N=Math.abs(y-V[0]),w=Math.abs(D-V[1]);(o.value?N>w&&N>3:w>N&&w>3)?(m.value=!0,C=!1):(o.value?w:N)>3&&(C=!1)}if(!m.value)return;S.preventDefault(),s(S);const R=M(o.value?y:D,!1);u.value=Math.max(0,Math.min(1,R)),R>1?p.value=f(o.value?y:D,!0):R<0&&(p.value=f(o.value?y:D,!1))}function _(S){if(C=!1,!m.value)return;s(S),m.value=!1;const y=d(S.changedTouches[0].identifier),D=Math.abs(y.x),R=Math.abs(y.y);(o.value?D>R&&D>400:R>D&&R>3)?t.value=y.direction===({left:"right",right:"left",top:"down",bottom:"up"}[n.value]||H6()):t.value=u.value>.5}const v=q(()=>m.value?{transform:n.value==="left"?`translateX(calc(-100% + ${u.value*a.value}px))`:n.value==="right"?`translateX(calc(100% - ${u.value*a.value}px))`:n.value==="top"?`translateY(calc(-100% + ${u.value*a.value}px))`:n.value==="bottom"?`translateY(calc(100% - ${u.value*a.value}px))`:H6(),transition:"none"}:void 0);return{isDragging:m,dragProgress:u,dragStyles:v}}function H6(){throw new Error}const Ue2=["start","end","left","right","top","bottom"],xe2=k1({color:String,disableResizeWatcher:Boolean,disableRouteWatcher:Boolean,expandOnHover:Boolean,floating:Boolean,modelValue:{type:Boolean,default:null},permanent:Boolean,rail:{type:Boolean,default:null},railWidth:{type:[Number,String],default:56},scrim:{type:[Boolean,String],default:!0},image:String,temporary:Boolean,touchless:Boolean,width:{type:[Number,String],default:256},location:{type:String,default:"start",validator:e=>Ue2.includes(e)},sticky:Boolean,...Ea(),...F2(),...tk1(),...Xi(),...ck1(),...p0(),...w5({tag:"nav"}),...p5()},"VNavigationDrawer"),Fe2=h2()({name:"VNavigationDrawer",props:xe2(),emits:{"update:modelValue":e=>!0,"update:rail":e=>!0},setup(e,t){let{attrs:i,emit:a,slots:r}=t;const{isRtl:n}=pi(),{themeClasses:o}=b5(e),{borderClasses:s}=ar(e),{backgroundColorClasses:l,backgroundColorStyles:d}=d0(t2(e,"color")),{elevationClasses:C}=O3(e),{displayClasses:m,mobile:u}=T8(e),{roundedClasses:p}=F0(e),V=W21(),f=me(e,"modelValue",null,$=>!!$),{ssrBootStyles:M}=wH(),{scopeId:H}=am(),g=a1(),_=g2(!1),v=q(()=>e.rail&&e.expandOnHover&&_.value?Number(e.width):Number(e.rail?e.railWidth:e.width)),S=q(()=>Ip(e.location,n.value)),y=q(()=>!e.permanent&&(u.value||e.temporary)),D=q(()=>e.sticky&&!y.value&&S.value!=="bottom");M3(()=>e.expandOnHover&&e.rail!=null,()=>{T1(_,$=>a("update:rail",!$))}),M3(()=>!e.disableResizeWatcher,()=>{T1(y,$=>!e.permanent&&k2(()=>f.value=!$))}),M3(()=>!e.disableRouteWatcher&&!!V,()=>{T1(V.currentRoute,()=>y.value&&(f.value=!1))}),T1(()=>e.permanent,$=>{$&&(f.value=!0)}),k5(()=>{e.modelValue!=null||y.value||(f.value=e.permanent||!u.value)});const{isDragging:R,dragProgress:N,dragStyles:w}=Oe2({isActive:f,isTemporary:y,width:v,touchless:t2(e,"touchless"),position:S}),x=q(()=>{const $=y.value?0:e.rail&&e.expandOnHover?Number(e.railWidth):v.value;return R.value?$*N.value:$}),{layoutItemStyles:U,layoutItemScrimStyles:E}=Ck1({id:e.name,order:q(()=>parseInt(e.order,10)),position:S,layoutSize:x,elementSize:v,active:q(()=>f.value||R.value),disableTransitions:q(()=>R.value),absolute:q(()=>e.absolute||D.value&&typeof O.value!="string")}),{isStuck:O,stickyStyles:z}=we2({rootEl:g,isSticky:D,layoutItemStyles:U}),F=d0(q(()=>typeof e.scrim=="string"?e.scrim:null)),J=q(()=>({...R.value?{opacity:N.value*.2,transition:"none"}:void 0,...E.value}));I0({VList:{bgColor:"transparent"}});function W(){_.value=!0}function n1(){_.value=!1}return H2(()=>{const $=r.image||e.image;return P(Y1,null,[P(e.tag,V2({ref:g,onMouseenter:W,onMouseleave:n1,class:["v-navigation-drawer",`v-navigation-drawer--${S.value}`,{"v-navigation-drawer--expand-on-hover":e.expandOnHover,"v-navigation-drawer--floating":e.floating,"v-navigation-drawer--is-hovering":_.value,"v-navigation-drawer--rail":e.rail,"v-navigation-drawer--temporary":y.value,"v-navigation-drawer--active":f.value,"v-navigation-drawer--sticky":D.value},o.value,l.value,s.value,m.value,C.value,p.value,e.class],style:[d.value,U.value,w.value,M.value,z.value,e.style]},H,i),{default:()=>{var i1,l1,f1,M1;return[$&&P("div",{key:"image",class:"v-navigation-drawer__img"},[r.image?(i1=r.image)==null?void 0:i1.call(r,{image:e.image}):P("img",{src:e.image,alt:""},null)]),r.prepend&&P("div",{class:"v-navigation-drawer__prepend"},[(l1=r.prepend)==null?void 0:l1.call(r)]),P("div",{class:"v-navigation-drawer__content"},[(f1=r.default)==null?void 0:f1.call(r)]),r.append&&P("div",{class:"v-navigation-drawer__append"},[(M1=r.append)==null?void 0:M1.call(r)])]}}),P(q5,{name:"fade-transition"},{default:()=>[y.value&&(R.value||f.value)&&!!e.scrim&&P("div",V2({class:["v-navigation-drawer__scrim",F.backgroundColorClasses.value],style:[J.value,F.backgroundColorStyles.value],onClick:()=>f.value=!1},H),null)]})])}),{isStuck:O}}}),ke2=s2({__name:"ConfigurationMenu",setup(e){const t=c5(),i=a1([D_]),{mdAndDown:a}=T8(),r=[{icon:"mdi-book-open-blank-variant",title:"General",component:D_},{icon:"mdi-controller",title:"Joystick",component:aq1},{icon:"mdi-video",title:"Video",component:ye2},{icon:"mdi-script",title:"Logs",component:sq1},{icon:"mdi-bell-ring",title:"Alerts",component:Oz1},{icon:"mdi-dev-to",title:"Development",component:JG1}],n=q(()=>t==null?void 0:t.configurationPages);return(o,s)=>(m1(),J1(st,{width:"100%",height:"100%"},{default:v1(()=>[P(be2,null,{default:v1(()=>[P(Fe2,{permanent:"",rail:B(a),"expand-on-hover":B(a),elevation:B(a)?5:0},{default:v1(()=>[P(pd,{selected:i.value,"onUpdate:selected":s[0]||(s[0]=l=>i.value=l)},{default:v1(()=>[P(ua,{"prepend-icon":"mdi-view-dashboard",title:"Configuration menu"}),P(qs),(m1(),N1(Y1,null,Me(r,(l,d)=>P(ua,{key:d,"prepend-icon":l.icon,title:l.title,value:l.component},null,8,["prepend-icon","title","value"])),64))]),_:1},8,["selected"]),P(qs),P(pd,{selected:i.value,"onUpdate:selected":s[1]||(s[1]=l=>i.value=l)},{default:v1(()=>[(m1(!0),N1(Y1,null,Me(n.value,(l,d)=>(m1(),J1(ua,{key:d,"prepend-icon":l.icon,title:l.title,value:l.component},null,8,["prepend-icon","title","value"]))),128))]),_:1},8,["selected"])]),_:1},8,["rail","expand-on-hover","elevation"]),P(p01,{scrollable:""},{default:v1(()=>[(m1(),J1(un(i.value[0])))]),_:1})]),_:1})]),_:1}))}});var f01={exports:{}};const Be2=za1(Fn1);(function(e){e.exports=function(t){var i={};function a(r){if(i[r])return i[r].exports;var n=i[r]={i:r,l:!1,exports:{}};return t[r].call(n.exports,n,n.exports,a),n.l=!0,n.exports}return a.m=t,a.c=i,a.d=function(r,n,o){a.o(r,n)||Object.defineProperty(r,n,{enumerable:!0,get:o})},a.r=function(r){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},a.t=function(r,n){if(n&1&&(r=a(r)),n&8||n&4&&typeof r=="object"&&r&&r.__esModule)return r;var o=Object.create(null);if(a.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:r}),n&2&&typeof r!="string")for(var s in r)a.d(o,s,function(l){return r[l]}.bind(null,s));return o},a.n=function(r){var n=r&&r.__esModule?function(){return r.default}:function(){return r};return a.d(n,"a",n),n},a.o=function(r,n){return Object.prototype.hasOwnProperty.call(r,n)},a.p="",a(a.s="fb15")}({"24fb":function(t,i,a){t.exports=function(o){var s=[];return s.toString=function(){return this.map(function(d){var C=r(d,o);return d[2]?"@media ".concat(d[2]," {").concat(C,"}"):C}).join("")},s.i=function(l,d,C){typeof l=="string"&&(l=[[null,l,""]]);var m={};if(C)for(var u=0;uR.parts.length&&(N.parts.length=R.parts.length)}else{for(var x=[],w=0;w Cockpit - + diff --git a/sw.js b/sw.js index a977c0fdd..d86308264 100644 --- a/sw.js +++ b/sw.js @@ -1 +1 @@ -if(!self.define){let e,r={};const i=(i,n)=>(i=new URL(i+".js",n).href,r[i]||new Promise((r=>{if("document"in self){const e=document.createElement("script");e.src=i,e.onload=r,document.head.appendChild(e)}else e=i,importScripts(i),r()})).then((()=>{let e=r[i];if(!e)throw new Error(`Module ${i} didn’t register its module`);return e})));self.define=(n,s)=>{const l=e||("document"in self?document.currentScript.src:"")||location.href;if(r[l])return;let o={};const t=e=>i(e,l),c={module:{uri:l},exports:o,require:t};r[l]=Promise.all(n.map((e=>c[e]||t(e)))).then((e=>(s(...e),o)))}}define(["./workbox-06233651"],(function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"electron/main.js",revision:"79f3bbfb05e945b35c338b1d717f0adf"},{url:"index.html",revision:"7cfff93b06fd62317be8f802ac612f80"},{url:"leaflet-src.esm.13473dcf.js",revision:null},{url:"marker-icon-2x.68378269.js",revision:null},{url:"marker-icon.753d5637.js",revision:null},{url:"marker-shadow.40fd21b3.js",revision:null},{url:"registerSW.js",revision:"402b66900e731ca748771b6fc5e7a068"},{url:"style.d3035219.css",revision:null},{url:"webfontloader.3696e2c4.js",revision:null},{url:"favicon.ico",revision:"b54531a824aa22f592590e347be8347c"},{url:"apple-touch-icon.png",revision:"4d6428d260d0f769a26ed6ce0387d0c1"},{url:"manifest.webmanifest",revision:"a28c2c0a5d92b960e17dd3757933e534"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html")))})); +if(!self.define){let e,r={};const i=(i,n)=>(i=new URL(i+".js",n).href,r[i]||new Promise((r=>{if("document"in self){const e=document.createElement("script");e.src=i,e.onload=r,document.head.appendChild(e)}else e=i,importScripts(i),r()})).then((()=>{let e=r[i];if(!e)throw new Error(`Module ${i} didn’t register its module`);return e})));self.define=(n,s)=>{const l=e||("document"in self?document.currentScript.src:"")||location.href;if(r[l])return;let o={};const t=e=>i(e,l),c={module:{uri:l},exports:o,require:t};r[l]=Promise.all(n.map((e=>c[e]||t(e)))).then((e=>(s(...e),o)))}}define(["./workbox-06233651"],(function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"electron/main.js",revision:"79f3bbfb05e945b35c338b1d717f0adf"},{url:"index.html",revision:"3ddc57274fd2b9430b07d294281a9abd"},{url:"leaflet-src.esm.13473dcf.js",revision:null},{url:"marker-icon-2x.68378269.js",revision:null},{url:"marker-icon.753d5637.js",revision:null},{url:"marker-shadow.40fd21b3.js",revision:null},{url:"registerSW.js",revision:"402b66900e731ca748771b6fc5e7a068"},{url:"style.d3035219.css",revision:null},{url:"webfontloader.3696e2c4.js",revision:null},{url:"favicon.ico",revision:"b54531a824aa22f592590e347be8347c"},{url:"apple-touch-icon.png",revision:"4d6428d260d0f769a26ed6ce0387d0c1"},{url:"manifest.webmanifest",revision:"a28c2c0a5d92b960e17dd3757933e534"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html")))}));