this.handleRemoteTrack(a, e), o.onicecandidate = (a) => {
a.candidate?.candidate && this.handleLocalCandidate(a.candidate, e);
}, o.onconnectionstatechange = () => this.handleConnectionState(e);
- const s = o.addTransceiver("audio", {
+ const n = o.addTransceiver("audio", {
direction: "sendrecv"
});
- this.audioSender = s.sender, o.addTransceiver("video", { direction: "recvonly" });
- const n = await o.createOffer();
- if (await o.setLocalDescription(n), e !== this.connectionToken || !o.localDescription?.sdp) return;
+ this.audioSender = n.sender, o.addTransceiver("video", { direction: "recvonly" });
+ const s = await o.createOffer();
+ if (await o.setLocalDescription(s), e !== this.connectionToken || !o.localDescription?.sdp) return;
this.unsubscribePromise = Promise.resolve(
t.subscribeMessage(
(a) => {
@@ -3111,7 +3135,7 @@ let y = class extends x {
})
), e && (this.statusMessageTimeout = window.setTimeout(() => {
this.statusMessageTimeout = void 0, this.showStatusMessage("");
- }, _o));
+ }, So));
}
dispatchTalkbackState() {
const e = {
@@ -3158,7 +3182,7 @@ let y = class extends x {
return h`
`;
}
};
-y.styles = F`
+y.styles = N`
:host {
position: absolute;
inset: 0;
@@ -3327,13 +3351,13 @@ k([
u()
], y.prototype, "readyDispatched", 2);
y = k([
- N("ring-view-ring-webrtc-player")
+ q("ring-view-ring-webrtc-player")
], y);
-const wo = /* @__PURE__ */ new Set(["unknown", "unavailable"]);
-function xt(e, t, i) {
- return !i || t === void 0 || wo.has(i.state) ? !1 : e.startsWith("binary_sensor.") ? t === "off" && i.state === "on" : e.startsWith("event.") && t !== "unavailable" && t !== i.state && (i.attributes.event_type === void 0 || i.attributes.event_type === "ring");
+const To = /* @__PURE__ */ new Set(["unknown", "unavailable"]);
+function Mt(e, t, i) {
+ return !i || t === void 0 || To.has(i.state) ? !1 : e.startsWith("binary_sensor.") ? t === "off" && i.state === "on" : e.startsWith("event.") && t !== "unavailable" && t !== i.state && (i.attributes.event_type === void 0 || i.attributes.event_type === "ring");
}
-class yo {
+class Co {
constructor() {
this.generation = 0;
}
@@ -3357,19 +3381,19 @@ class yo {
this.clearTimeout(), this.generation += 1;
}
}
-var ko = Object.defineProperty, Ao = Object.getOwnPropertyDescriptor, m = (e, t, i, o) => {
- for (var s = o > 1 ? void 0 : o ? Ao(t, i) : t, n = e.length - 1, a; n >= 0; n--)
- (a = e[n]) && (s = (o ? a(t, i, s) : a(s)) || s);
- return o && s && ko(t, i, s), s;
+var xo = Object.defineProperty, Ro = Object.getOwnPropertyDescriptor, m = (e, t, i, o) => {
+ for (var n = o > 1 ? void 0 : o ? Ro(t, i) : t, s = e.length - 1, a; s >= 0; s--)
+ (a = e[s]) && (n = (o ? a(t, i, n) : a(n)) || n);
+ return o && n && xo(t, i, n), n;
};
-const So = 20, $o = 2500, To = 2500, Co = 900, xo = 2e3, Ro = 3e3, Eo = 2e3, Lo = 3e3;
-function Po(e) {
+const Eo = 20, Lo = 2500, Po = 2500, Mo = 900, Do = 2e3, Io = 3e3, Vo = 2e3, Ho = 3e3;
+function Oo(e) {
const t = e instanceof Error ? e.message.toLowerCase() : String(e).toLowerCase();
return /timeout|timed out/.test(t) ? "snapshot.timeout" : /unauthorized|forbidden|permission denied/.test(t) ? "snapshot.permission_failed" : /cannot write|can't write|no access to path|read-only|readonly/.test(t) ? "snapshot.write_failed" : /connection|websocket|service api unavailable/.test(t) ? "snapshot.connection_failed" : /no image|could not provide|not supported|snapshot unavailable/.test(t) ? "snapshot.camera_failed" : "snapshot.failed";
}
-let f = class extends x {
+let g = class extends x {
constructor() {
- super(...arguments), this.open = !1, this.inline = !1, this.ringing = !1, this.mode = "last_recording", this.mediaStatus = "idle", this.session = 0, this.suspended = !1, this.recordingMuted = !1, this.recordingStarted = !0, this.recordingControlsVisible = !0, this.recordingEnded = !1, this.liveMuted = !0, this.recordingVideoFailed = !1, this.retryCount = 0, this.statusAnnouncement = "", this.talkbackReady = !1, this.talkbackRequesting = !1, this.talkbackTalking = !1, this.doorActionStatus = "idle", this.snapshotActionStatus = "idle", this.inlineStarted = !0, this.lifecycle = new yo(), this.recordingPlayback = /* @__PURE__ */ new WeakSet(), this.recordingPaused = !1, this.automaticLiveRetry = !0, this.pageUnloading = !1, this.talkKeyboardPressed = !1, this.doorKeyboardPressed = !1, this.doorActionToken = 0, this.snapshotActionToken = 0, this.inlineVisible = !1, this.inlineActive = !1, this.takeSnapshot = async () => {
+ super(...arguments), this.open = !1, this.inline = !1, this.ringing = !1, this.mode = "last_recording", this.mediaStatus = "idle", this.session = 0, this.suspended = !1, this.recordingMuted = !1, this.recordingStarted = !0, this.recordingControlsVisible = !0, this.recordingEnded = !1, this.liveMuted = !0, this.recordingVideoFailed = !1, this.retryCount = 0, this.statusAnnouncement = "", this.talkbackReady = !1, this.talkbackRequesting = !1, this.talkbackTalking = !1, this.doorActionStatus = "idle", this.snapshotActionStatus = "idle", this.inlineStarted = !0, this.lifecycle = new Co(), this.recordingPlayback = /* @__PURE__ */ new WeakSet(), this.recordingPaused = !1, this.automaticLiveRetry = !0, this.pageUnloading = !1, this.talkKeyboardPressed = !1, this.doorKeyboardPressed = !1, this.doorActionToken = 0, this.snapshotActionToken = 0, this.inlineVisible = !1, this.inlineActive = !1, this.takeSnapshot = async () => {
const e = this.hass, t = this.config, i = this.snapshotEntityId();
if (!e || !t || !i || !this.shouldShowSnapshotAction() || this.snapshotActionStatus === "working")
return;
@@ -3381,19 +3405,19 @@ let f = class extends x {
if (await e.callService(
"camera",
"snapshot",
- { filename: Di(e, t) },
+ { filename: zi(e, t) },
{ entity_id: i }
), o !== this.snapshotActionToken || !this.open) return;
- const s = r(this.hass, "snapshot.saved");
- this.snapshotActionStatus = "success", this.snapshotFeedbackMessage = s, this.clearViewerFeedback("snapshot"), this.statusAnnouncement = s, this.snapshotFeedbackTimer = window.setTimeout(() => {
+ const n = r(this.hass, "snapshot.saved");
+ this.snapshotActionStatus = "success", this.snapshotFeedbackMessage = n, this.clearViewerFeedback("snapshot"), this.statusAnnouncement = n, this.snapshotFeedbackTimer = window.setTimeout(() => {
o === this.snapshotActionToken && (this.snapshotFeedbackTimer = void 0, this.snapshotFeedbackMessage = void 0, this.snapshotActionStatus = "idle");
- }, Eo);
- } catch (s) {
+ }, Vo);
+ } catch (n) {
if (o !== this.snapshotActionToken || !this.open) return;
- const n = r(this.hass, Po(s));
- this.snapshotActionStatus = "error", this.snapshotFeedbackMessage = n, this.setViewerFeedback("snapshot", n, "error"), this.statusAnnouncement = n, this.snapshotFeedbackTimer = window.setTimeout(() => {
+ const s = r(this.hass, Oo(n));
+ this.snapshotActionStatus = "error", this.snapshotFeedbackMessage = s, this.setViewerFeedback("snapshot", s, "error"), this.statusAnnouncement = s, this.snapshotFeedbackTimer = window.setTimeout(() => {
o === this.snapshotActionToken && (this.snapshotFeedbackTimer = void 0, this.snapshotFeedbackMessage = void 0, this.snapshotActionStatus = "idle");
- }, Lo);
+ }, Ho);
}
}, this.handleTalkbackState = (e) => {
e.currentTarget === this.renderRoot.querySelector("ring-view-ring-webrtc-player") && (e.detail.ready || this.cancelTalkPress(e.currentTarget), this.talkbackReady = e.detail.ready, this.talkbackRequesting = e.detail.requesting, this.talkbackTalking = e.detail.talking);
@@ -3505,9 +3529,9 @@ let f = class extends x {
const t = this.focusableElements();
if (t.length === 0) return;
const i = t[0], o = t[t.length - 1];
- let s = this.shadowRoot?.activeElement;
- for (; s?.shadowRoot?.activeElement; ) s = s.shadowRoot.activeElement;
- e.shiftKey && s === i ? (e.preventDefault(), o.focus()) : !e.shiftKey && s === o && (e.preventDefault(), i.focus());
+ let n = this.shadowRoot?.activeElement;
+ for (; n?.shadowRoot?.activeElement; ) n = n.shadowRoot.activeElement;
+ e.shiftKey && n === i ? (e.preventDefault(), o.focus()) : !e.shiftKey && n === o && (e.preventDefault(), i.focus());
}, this.handleTabKeyDown = (e) => {
if (!["ArrowLeft", "ArrowRight", "Home", "End"].includes(e.key)) return;
e.preventDefault();
@@ -3561,7 +3585,7 @@ let f = class extends x {
this.adoptRestoredDialog(e), this.syncUrl();
return;
}
- this.open && this.finishClose(!1, !1), this.inline = !1, this.config = e.config, this.opener = e.opener, this.returnUrl = e.returnUrl ?? St(At()), this.mode = e.mode, this.liveMuted = e.restored && this.mode === "live" ? !0 : this.config.live_muted, this.recordingStarted = this.mode === "live" || this.config.autoplay_recording, this.resetMediaAttempt(), this.automaticLiveRetry = !e.restored, this.pageUnloading = !1, this.suspended = !1, this.statusAnnouncement = "", this.resetVisitorActions(), this.resetSnapshotAction(), this.lastDoorbellState = this.config.doorbell_entity ? this.hass.states[this.config.doorbell_entity]?.state : void 0, this.setRingingUntil(e.ringingUntil), this.open = !0, Yi(this), this.syncUrl(), this.attachGlobalListeners(), e.restored && this.mode === "live" ? this.prepareAutomaticLiveResume() : this.startMedia(), this.updateComplete.then(() => this.focusInitialControl());
+ this.open && this.finishClose(!1, !1), this.inline = !1, this.config = e.config, this.opener = e.opener, this.returnUrl = e.returnUrl ?? Rt(xt()), this.mode = e.mode, this.liveMuted = e.restored && this.mode === "live" ? !0 : this.config.live_muted, this.recordingStarted = this.mode === "live" || this.config.autoplay_recording, this.resetMediaAttempt(), this.automaticLiveRetry = !e.restored, this.pageUnloading = !1, this.suspended = !1, this.statusAnnouncement = "", this.resetVisitorActions(), this.resetSnapshotAction(), this.lastDoorbellState = this.config.doorbell_entity ? this.hass.states[this.config.doorbell_entity]?.state : void 0, this.setRingingUntil(e.ringingUntil), this.open = !0, io(this), this.syncUrl(), this.attachGlobalListeners(), e.restored && this.mode === "live" ? this.prepareAutomaticLiveResume() : this.startMedia(), this.updateComplete.then(() => this.focusInitialControl());
}
}
showInline(e) {
@@ -3602,9 +3626,7 @@ let f = class extends x {
}
render() {
if (!this.open || !this.hass || !this.config) return c;
- const e = this.dialogTitle(), t = this.config.show_name, i = Z(
- this.config.last_activity_entity ? this.hass.states[this.config.last_activity_entity] : void 0
- ) !== void 0, o = this.config.aspect_ratio, s = {
+ const e = this.dialogTitle(), t = this.config.show_name, i = this.config.last_activity_entity ? H(this.hass, this.config.last_activity_entity) !== void 0 : !1, o = this.config.aspect_ratio, n = {
"--ring-view-aspect-ratio": o === "auto" ? "16 / 9" : o.replace(":", " / "),
"--ring-view-fit-mode": this.config.fit_mode
};
@@ -3612,7 +3634,7 @@ let f = class extends x {
${this.inline ? c : h`
`}
- ${this.icon(this.inline ? Mt : Et)}
+ ${this.icon(this.inline ? Ot : It)}
${this.renderModeSwitch()}
@@ -3673,7 +3695,7 @@ let f = class extends x {
aria-label=${e}
title=${e}
>
- ${this.icon(nt)}
+ ${this.icon(dt)}