New Update Of Course

This commit is contained in:
CCOSTAN 2024-12-24 20:38:19 +00:00
parent 224c0ff8af
commit 1dd9c9f714
72 changed files with 2005 additions and 2 deletions

View File

@ -1 +1 @@
2024.12.4 2024.12.5

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,15 @@
import{_ as e,n as t,t as n,a as i,cL as a,x as r,l,cP as s,cW as c,r as o,db as p}from"./card-e5d55e5b.js";let u=class extends i{constructor(){super(...arguments),this._refInput=a()}get value(){return this._refInput.value?.value?new Date(this._refInput.value.value):null}reset(){this._refInput.value&&(this._refInput.value.value="")}render(){const e=()=>{const e=this._refInput.value?.value;p(this,"date-picker:change",{date:e?new Date(e):null})};return r`<input
aria-label="${l("timeline.select_date")}"
title="${l("timeline.select_date")}"
${s(this._refInput)}
type="datetime-local"
@input=${()=>e()}
@change=${()=>e()}
/>
<frigate-card-icon
aria-label="${l("timeline.select_date")}"
title="${l("timeline.select_date")}"
.icon=${{icon:this.icon??"mdi:calendar-search"}}
@click=${e=>{c(e),this._refInput.value?.showPicker()}}
>
</frigate-card-icon>`}static get styles(){return o(":host {\n display: inline-block;\n position: relative;\n width: var(--mdc-icon-size, 24px);\n height: var(--mdc-icon-size, 24px);\n}\n\ninput {\n display: block;\n height: 100%;\n width: 100%;\n position: absolute;\n padding: 0px;\n border: 0px;\n}\n\n/**\n * Hack warning: Safari on iOS does not support showPicker with\n * datetime-local:\n * https://caniuse.com/mdn-api_htmlinputelement_showpicker_datetime_local_input\n *\n * The hack is to render the input element in front of the icon, with an\n * opacity of 0. This only works if the underlying input element accepts the\n * click at the exact place the user happens to click. From trial and error,\n * this seems to work better than expected / quite reliably, but had the user\n * manually changed icon sizes with Safari iOS their experience may vary.\n */\n@supports (-webkit-touch-callout: none) {\n input {\n opacity: 0;\n z-index: 1;\n }\n}\n@supports not (-webkit-touch-callout: none) {\n input {\n visibility: hidden;\n }\n}\nfrigate-card-icon {\n display: block;\n height: 100%;\n width: 100%;\n position: absolute;\n}")}};e([t({attribute:!1})],u.prototype,"icon",void 0),u=e([n("frigate-card-date-picker")],u);export{u as F};

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
import{c_ as r}from"./card-e5d55e5b.js";function o(o){const s=r(o);return s.setHours(23,59,59,999),s}export{o as e};

View File

@ -0,0 +1 @@
import{dp as t,d6 as n}from"./card-e5d55e5b.js";const r=async(r,a,e)=>{if(!a.sign)return a.endpoint;let s;try{s=await t(r,a.endpoint,e)}catch(t){n(t)}return s?s.replace(/^http/i,"ws"):null};export{r as c};

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
import{eu as e,ev as t,l as i,e3 as a,e2 as n,e1 as s,d$ as r,j as c}from"./card-e5d55e5b.js";class l{constructor(t,i,a){this._destroyCallbacks=[],this._stateChangeHandler=t=>{this._eventCallback?.({cameraID:this.getID(),type:e(t.newState.state)?"new":"end"})},this._config=t,this._engine=i,this._capabilities=a?.capabilities,this._eventCallback=a?.eventCallback}async initialize(e){return e.stateWatcher.subscribe(this._stateChangeHandler,this._config.triggers.entities),this._onDestroy((()=>e.stateWatcher.unsubscribe(this._stateChangeHandler))),this}async destroy(){this._destroyCallbacks.forEach((e=>e()))}getConfig(){return this._config}setID(e){this._config.id=e}getID(){if(this._config.id)return this._config.id;throw new t(i("error.no_camera_id"))}getEngine(){return this._engine}getCapabilities(){return this._capabilities??null}getProxyConfig(){return{dynamic:this._config.proxy.dynamic,media:"auto"!==this._config.proxy.media&&this._config.proxy.media,ssl_verification:!1!==this._config.proxy.ssl_verification,ssl_ciphers:"auto"===this._config.proxy.ssl_ciphers?"default":this._config.proxy.ssl_ciphers}}_onDestroy(e){this._destroyCallbacks.push(e)}}const o=(e,t)=>{const i=t?.url??e.go2rtc?.url,a=t?.stream??e.go2rtc?.stream;if(!i||!a)return null;const n=`${i}/api/ws?src=${a}`;return{endpoint:n,sign:n.startsWith("/")}};class u{constructor(e,t){this._stateWatcher=e,this._eventCallback=t}getEngineType(){return a.Generic}async createCamera(e,t){return await new l(t,this,{capabilities:new n({"favorite-events":!1,"favorite-recordings":!1,clips:!1,live:!0,menu:!0,recordings:!1,seek:!1,snapshots:!1,substream:!0,ptz:s(t)??void 0},{disable:t.capabilities?.disable,disableExcept:t.capabilities?.disable_except}),eventCallback:this._eventCallback}).initialize({stateWatcher:this._stateWatcher})}generateDefaultEventQuery(e,t,i){return null}generateDefaultRecordingQuery(e,t,i){return null}generateDefaultRecordingSegmentsQuery(e,t,i){return null}async getEvents(e,t,i,a){return null}async getRecordings(e,t,i,a){return null}async getRecordingSegments(e,t,i,a){return null}generateMediaFromEvents(e,t,i,a){return null}generateMediaFromRecordings(e,t,i,a){return null}async getMediaDownloadPath(e,t,i){return null}async favoriteMedia(e,t,i,a){}getQueryResultMaxAge(e){return null}async getMediaSeekTime(e,t,i,a,n){return null}async getMediaMetadata(e,t,i,a){return null}getCameraMetadata(e,t){const i=r(t);return{title:t.title??c(e,t.camera_entity)??c(e,t.webrtc_card?.entity)??t.id??"",icon:{entity:i??void 0,icon:t.icon,fallback:"mdi:video"}}}getMediaCapabilities(e){return null}getCameraEndpoints(e,t){const i=o(e);return i?{go2rtc:i}:null}async executePTZAction(e,t,i,a){}}var g=Object.freeze({__proto__:null,GenericCameraManagerEngine:u});export{l as C,u as G,g as e,o as g};

View File

@ -0,0 +1 @@
import{e7 as e,e3 as t,e2 as a,e1 as s,e8 as i,c$ as n,e5 as r,e6 as o,dM as c,e9 as d,ea as m,eb as l,d7 as h,d9 as u}from"./card-e5d55e5b.js";import{B as y,a as g,g as p,i as _}from"./within-dates-446c6430.js";import{C as M}from"./engine-86b0096c.js";import{p as f}from"./parse-214d78af.js";import{e as C}from"./endOfDay-cfc9c86c.js";import"./engine-generic-93cdbee6.js";import"./media-c9012082.js";class w extends y{getProxyConfig(){return{...super.getProxyConfig(),media:"auto"===this._config.proxy.media||this._config.proxy.media}}}class D{static isMotionEyeEventQueryResults(e){return e.engine===t.MotionEye&&e.type===o.Event}}const E={"%Y":"yyyy","%m":"MM","%d":"dd","%H":"HH","%M":"mm","%S":"ss"},v=new RegExp(/(%Y|%m|%d|%H|%M|%S)/g);class x extends g{constructor(){super(...arguments),this._directoryCache=new e,this._fileCache=new e}getEngineType(){return t.MotionEye}async createCamera(e,t){const i=new w(t,this,{capabilities:new a({"favorite-events":!1,"favorite-recordings":!1,clips:!0,live:!0,menu:!0,recordings:!1,seek:!1,snapshots:!0,substream:!0,ptz:s(t)??void 0},{disable:t.capabilities?.disable,disableExcept:t.capabilities?.disable_except}),eventCallback:this._eventCallback});return await i.initialize({entityRegistryManager:this._entityRegistryManager,hass:e,stateWatcher:this._stateWatcher})}_convertMotionEyeTimeFormatToDateFNS(e){return e.replace(v,((e,t)=>E[t]))}_motionEyeMetadataGeneratorFile(e,t,a,s){let n=s?._metadata?.startDate??new Date;if(t){const e=a.title.replace(/\.[^/.]+$/,"");if(n=f(e,t,n),!i(n))return null}return{cameraID:e,startDate:n,endDate:n}}_motionEyeMetadataGeneratorDirectory(e,t,a,s){let r=s?._metadata?.startDate??new Date;if(t){const e=f(a.title,t,r);if(!i(e))return null;r=n(e)}return{cameraID:e,startDate:r,endDate:s?._metadata?.endDate??C(r)}}async _getMatchingDirectories(e,t,a,s,i){const n=t.getCamera(a),r=n?.getConfig();if(!(n instanceof y&&r))return null;const o=n.getEntity(),c=o?.config_entry_id,d=o?.device_id;if(!c||!d)return null;const m=(e,t)=>{const i=e.shift();if(!i)return[];const n=i.includes("%")?this._convertMotionEyeTimeFormatToDateFNS(i):null;return[{targets:t,metadataGenerator:(e,t)=>this._motionEyeMetadataGeneratorDirectory(a,n,e,t),matcher:e=>e.can_expand&&(!!n||e.title===i)&&_(e,s?.start,s?.end),advance:t=>m(e,t)}]};return await this._browseMediaManager.walkBrowseMedias(e,[...!1===s?.hasClip||s?.hasSnapshot?[]:m(r.motioneye.movies.directory_pattern.split("/"),[`media-source://motioneye/${c}#${d}#movies`]),...!1===s?.hasSnapshot||s?.hasClip?[]:m(r.motioneye.images.directory_pattern.split("/"),[`media-source://motioneye/${c}#${d}#images`])],{...!1!==i?.useCache&&{cache:this._directoryCache}})}async getEvents(e,a,s,i){if(s.favorite||s.tags?.size||s.what?.size||s.where?.size)return null;const n=new Map,c=async r=>{const c={...s,cameraIDs:new Set([r])},d=i?.useCache??1?this._requestCache.get(c):null;if(d)return void n.set(c,d);const u=a.getCameraConfig(r);if(!u)return;const y=await this._getMatchingDirectories(e,a,r,c,i);if(!y||!y.length)return;const g=this._convertMotionEyeTimeFormatToDateFNS(u.motioneye.movies.file_pattern),p=this._convertMotionEyeTimeFormatToDateFNS(u.motioneye.images.file_pattern),f=c.limit??M,C=await this._browseMediaManager.walkBrowseMedias(e,[{targets:y,metadataGenerator:(e,t)=>e.media_class===m||e.media_class===l?this._motionEyeMetadataGeneratorFile(r,e.media_class===m?p:g,e,t):null,earlyExit:e=>e.length>=f,matcher:e=>!e.can_expand&&_(e,c.start,c.end)}],{...!1!==i?.useCache&&{cache:this._fileCache}}),w=h(C,(e=>e._metadata?.startDate),"desc").slice(0,c.limit??M),D={type:o.Event,engine:t.MotionEye,browseMedia:w};(i?.useCache??1)&&this._requestCache.set(c,{...D,cached:!0},D.expiry),n.set(c,D)};return await r(s.cameraIDs,(e=>c(e))),n.size?n:null}generateMediaFromEvents(e,t,a,s){return D.isMotionEyeEventQueryResults(s)?p(s.browseMedia):null}async getMediaMetadata(e,a,s,i){const n=new Map;if((i?.useCache??1)&&this._requestCache.has(s)){const e=this._requestCache.get(s);if(e)return n.set(s,e),n}const m=new Set,l=async t=>{const s=await this._getMatchingDirectories(e,a,t,null,i);for(const e of s??[])e._metadata&&m.add(u(e._metadata?.startDate))};await r(s.cameraIDs,(e=>l(e)));const h={type:o.MediaMetadata,engine:t.MotionEye,metadata:{...m.size&&{days:m}},expiry:c(new Date,{seconds:d}),cached:!1};return(i?.useCache??1)&&this._requestCache.set(s,{...h,cached:!0},h.expiry),n.set(s,h),n}getCameraMetadata(e,t){return{...super.getCameraMetadata(e,t),engineIcon:"motioneye"}}getCameraEndpoints(e,t){const a=e.motioneye?.url?{endpoint:e.motioneye.url}:null;return{...super.getCameraEndpoints(e,t),...a&&{ui:a}}}}export{x as MotionEyeCameraManagerEngine};

View File

@ -0,0 +1,8 @@
import{l as e,e0 as t,e7 as a,e3 as n,eb as s,e8 as i,dM as r,c$ as o,e2 as c,e1 as l,ec as u,e5 as h,e6 as d,e9 as g,d7 as m,d9 as _}from"./card-e5d55e5b.js";import{B as p,a as y,i as f,g as w}from"./within-dates-446c6430.js";import{C}from"./engine-86b0096c.js";import{p as M}from"./parse-214d78af.js";import{e as k}from"./endOfDay-cfc9c86c.js";import"./engine-generic-93cdbee6.js";import"./media-c9012082.js";class D extends t{}class b extends p{constructor(){super(...arguments),this._channel=null}async initialize(e){return await super.initialize(e),this._initializeChannel(),this}_initializeChannel(){const t=this._entity?.unique_id,a=t?String(t).match(/(.*)_(?<channel>\d+)/):null,n=a&&a.groups?.channel?Number(a.groups.channel):null;if(null===n)throw new D(e("error.camera_initialization_reolink"),this.getConfig());this._channel=n}getChannel(){return this._channel}getProxyConfig(){return{...super.getProxyConfig(),media:"auto"===this._config.proxy.media||this._config.proxy.media,ssl_verification:"auto"!==this._config.proxy.ssl_verification&&this._config.proxy.ssl_verification,ssl_ciphers:"auto"===this._config.proxy.ssl_ciphers?"intermediate":this._config.proxy.ssl_ciphers}}}class x{static isReolinkEventQueryResults(e){return e.engine===n.Reolink&&e.type===d.Event}}class v extends y{constructor(){super(...arguments),this._cache=new a}getEngineType(){return n.Reolink}_reolinkFileMetadataGenerator(e,t,a){
/* istanbul ignore next: This situation cannot happen as the directory would
be rejected by _reolinkDirectoryMetadataGenerator if there was no start date
-- @preserve */
if(!a?._metadata?.startDate||t.media_class!==s)return null;const n=t.title.split(/ +/);if(2!==n.length)return null;const o=M(n[0],"HH:mm:ss",a._metadata.startDate);if(!i(o))return null;const c=n[1].match(/(?<hours>\d+):(?<minutes>\d+):(?<seconds>\d+)/),l=c?.groups?{hours:Number(c.groups.hours),minutes:Number(c.groups.minutes),seconds:Number(c.groups.seconds)}:null;return{cameraID:e,startDate:o,endDate:l?r(o,l):o}}_reolinkDirectoryMetadataGenerator(e,t){const a=M(t.title,"yyyy/M/d",new Date);return i(a)?{cameraID:e,startDate:o(a),endDate:k(a)}:null}_reolinkCameraMetadataGenerator(e){const t=e.media_content_id.match(/^media-source:\/\/reolink\/CAM\|(?<configEntryID>.+)\|(?<channel>\d+)$/);return t?.groups?{configEntryID:t.groups.configEntryID,channel:Number(t.groups.channel)}:null}async createCamera(e,t){const a=new b(t,this,{capabilities:new c({"favorite-events":!1,"favorite-recordings":!1,clips:!0,live:!0,menu:!0,recordings:!1,seek:!1,snapshots:!1,substream:!0,ptz:l(t)??void 0},{disable:t.capabilities?.disable,disableExcept:t.capabilities?.disable_except}),eventCallback:this._eventCallback});return await a.initialize({entityRegistryManager:this._entityRegistryManager,hass:e,stateWatcher:this._stateWatcher})}async _getMatchingDirectories(e,t,a,n){const s=t.getConfig(),i=t.getEntity(),r=i?.config_entry_id;if(null===t.getChannel()||!r)return null;const o=await this._browseMediaManager.walkBrowseMedias(e,[{targets:["media-source://reolink"],metadataGenerator:(e,t)=>this._reolinkCameraMetadataGenerator(e),matcher:e=>e._metadata?.channel===t.getChannel()&&e._metadata?.configEntryID===r}],{...!1!==n?.useCache&&{cache:this._cache}});return o?.length?await this._browseMediaManager.walkBrowseMedias(e,[{targets:[`media-source://reolink/RES|${r}|${t.getChannel()}|`+("low"===s.reolink?.media_resolution?"sub":"main")],metadataGenerator:(e,a)=>this._reolinkDirectoryMetadataGenerator(t.getID(),e),matcher:e=>e.can_expand&&f(e,a?.start,a?.end),sorter:e=>u(e)}],{...!1!==n?.useCache&&{cache:this._cache}}):null}async getEvents(e,t,a,s){if(a.favorite||a.tags?.size||a.what?.size||a.where?.size||a.hasSnapshot)return null;const i=new Map,r=async r=>{const o={...a,cameraIDs:new Set([r])},c=s?.useCache??1?this._requestCache.get(o):null;if(c)return void i.set(o,c);const l=t.getCamera(r),h=l&&l instanceof b?await this._getMatchingDirectories(e,l,o,s):null,g=o.limit??C;let _=[];h?.length&&(_=await this._browseMediaManager.walkBrowseMedias(e,[{targets:h,concurrency:1,metadataGenerator:(e,t)=>this._reolinkFileMetadataGenerator(r,e,t),earlyExit:e=>e.length>=g,matcher:e=>!e.can_expand&&f(e,o.start,o.end),sorter:e=>u(e)}],{...!1!==s?.useCache&&{cache:this._cache}}));const p=m(_,(e=>e._metadata?.startDate),"desc").slice(0,g),y={type:d.Event,engine:n.Reolink,browseMedia:p};(s?.useCache??1)&&this._requestCache.set(o,{...y,cached:!0},y.expiry),i.set(o,y)};return await h(a.cameraIDs,(e=>r(e))),i}generateMediaFromEvents(e,t,a,n){return x.isReolinkEventQueryResults(n)?w(n.browseMedia):null}async getMediaMetadata(e,t,a,s){const i=new Map,o=s?.useCache??1?this._requestCache.get(a):null;if(o)return i.set(a,o),i;const c=new Set,l=async a=>{const n=t.getCamera(a);if(!(n&&n instanceof b))return;const i=await this._getMatchingDirectories(e,n,null,s);for(const e of i??[])
/* istanbul ignore next: This situation cannot happen as the directory
will not match without metadata -- @preserve */
e._metadata&&c.add(_(e._metadata?.startDate))};await h(a.cameraIDs,(e=>l(e)));const u={type:d.MediaMetadata,engine:n.Reolink,metadata:{...c.size&&{days:c}},expiry:r(new Date,{seconds:g}),cached:!1};return(s?.useCache??1)&&this._requestCache.set(a,{...u,cached:!0},u.expiry),i.set(a,u),i}getCameraMetadata(e,t){return{...super.getCameraMetadata(e,t),engineIcon:"reolink"}}getCameraEndpoints(e,t){const a=e.reolink?.url?{endpoint:e.reolink.url}:null;return{...super.getCameraEndpoints(e,t),...a&&{ui:a}}}}export{v as ReolinkCameraManagerEngine,x as ReolinkQueryResultsClassifier};

View File

@ -1 +1 @@
import"./card-320adb66.js"; import"./card-e5d55e5b.js";

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,68 @@
import{dh as e,cO as t,x as s,cY as a,ds as i,dt as r,du as o,dr as d,r as h,eE as n,_ as l,t as c,eH as p,eI as u,cK as y,a as m,cL as _,cP as f,n as v}from"./card-e5d55e5b.js";import{c as g,e as $}from"./ha-hls-player-1787796f.js";import{s as b,d as w,h as L,c as R}from"./media-921a03ae.js";import{m as I}from"./audio-cf3a75aa.js";customElements.whenDefined("ha-web-rtc-player").then((()=>{let p=class extends(customElements.get("ha-web-rtc-player")){async play(){return this._video?.play()}async pause(){this._video?.pause()}async mute(){this._video&&(this._video.muted=!0)}async unmute(){this._video&&(this._video.muted=!1)}isMuted(){return this._video?.muted??!0}async seek(e){this._video&&(this._video.currentTime=e)}async setControls(e){this._video&&b(this._video,e??this.controls)}isPaused(){return this._video?.paused??!0}async getScreenshotURL(){return this._video?e(this._video):null}render(){return this._error?(w(this),t({type:"error",message:this._error,context:{entity_id:this.entityid}})):s`
<video
id="remote-stream"
?autoplay=${this.autoPlay}
.muted=${this.muted}
?playsinline=${this.playsInline}
?controls=${this.controls}
poster=${a(this.posterUrl)}
@loadedmetadata=${()=>{this.controls&&L(this._video,R)}}
@loadeddata=${e=>this._loadedDataHandler(e)}
@volumechange=${()=>i(this)}
@play=${()=>r(this)}
@pause=${()=>o(this)}
></video>
`}_loadedDataHandler(e){super._loadedData(),d(this,e,{player:this,capabilities:{supportsPause:!0,hasAudio:I(this._video)},technology:["webrtc"]})}static get styles(){return[super.styles,h(g),n`
:host {
width: 100%;
height: 100%;
}
video {
width: 100%;
height: 100%;
}
`]}};l([$("#remote-stream")],p.prototype,"_video",void 0),p=l([c("frigate-card-ha-web-rtc-player")],p)})),customElements.whenDefined("ha-camera-stream").then((()=>{const e="web_rtc",t="mjpeg";let a=class extends(customElements.get("ha-camera-stream")){constructor(){super(...arguments),this._mediaLoadedInfoPerStream={},this._mediaLoadedInfoDispatched=null}async play(){return this._player?.play()}async pause(){this._player?.pause()}async mute(){this._player?.mute()}async unmute(){this._player?.unmute()}isMuted(){return this._player?.isMuted()??!0}async seek(e){this._player?.seek(e)}async setControls(e){this._player&&this._player.setControls(e??this.controls)}isPaused(){return this._player?.isPaused()??!0}async getScreenshotURL(){return this._player?await this._player.getScreenshotURL():null}_storeMediaLoadedInfoHandler(e,t){this._storeMediaLoadedInfo(e,t.detail),t.stopPropagation()}_storeMediaLoadedInfo(e,t){this._mediaLoadedInfoPerStream[e]=t,this.requestUpdate()}_renderStream(a){return this.stateObj?a.type===t?s`
<img
@load=${e=>this._storeMediaLoadedInfo(t,u(e,{player:this,technology:["mjpeg"]}))}
.src=${void 0===this._connected||this._connected?(i=this.stateObj,`/api/camera_proxy_stream/${i.entity_id}?token=${i.attributes.access_token}`):this._posterUrl||""}
/>
`:"hls"===a.type?s` <frigate-card-ha-hls-player
?autoplay=${!1}
playsinline
.allowExoPlayer=${this.allowExoPlayer}
.muted=${this.muted}
.controls=${this.controls}
.hass=${this.hass}
.entityid=${this.stateObj.entity_id}
.posterUrl=${this._posterUrl}
@frigate-card:media:loaded=${e=>this._storeMediaLoadedInfoHandler("hls",e)}
@streams=${this._handleHlsStreams}
class="player ${a.visible?"":"hidden"}"
></frigate-card-ha-hls-player>`:a.type===e?s`<frigate-card-ha-web-rtc-player
?autoplay=${!1}
playsinline
.muted=${this.muted}
.controls=${this.controls}
.hass=${this.hass}
.entityid=${this.stateObj.entity_id}
.posterUrl=${this._posterUrl}
@frigate-card:media:loaded=${t=>this._storeMediaLoadedInfoHandler(e,t)}
@streams=${this._handleWebRtcStreams}
class="player ${a.visible?"":"hidden"}"
></frigate-card-ha-web-rtc-player>`:p:p;var i}updated(e){super.updated(e);const t=this._streams(this._capabilities?.frontend_stream_types,this._hlsStreams,this._webRtcStreams).find((e=>e.visible))??null;if(t){const e=this._mediaLoadedInfoPerStream[t.type];e&&e!==this._mediaLoadedInfoDispatched&&(this._mediaLoadedInfoDispatched=e,y(this,e))}}static get styles(){return[super.styles,h(g),n`
:host {
width: 100%;
height: 100%;
}
img {
width: 100%;
height: 100%;
}
`]}};l([$(".player:not(.hidden)")],a.prototype,"_player",void 0),a=l([c("frigate-card-ha-camera-stream")],a)}));let P=class extends m{constructor(){super(...arguments),this.controls=!1,this._playerRef=_()}async play(){return this._playerRef.value?.play()}async pause(){this._playerRef.value?.pause()}async mute(){this._playerRef.value?.mute()}async unmute(){this._playerRef.value?.unmute()}isMuted(){return this._playerRef.value?.isMuted()??!0}async seek(e){this._playerRef.value?.seek(e)}async setControls(e){this._playerRef.value?.setControls(e??this.controls)}isPaused(){return this._playerRef.value?.isPaused()??!0}async getScreenshotURL(){return await(this._playerRef.value?.getScreenshotURL())??null}render(){if(this.hass)return s` <frigate-card-ha-camera-stream
${f(this._playerRef)}
.hass=${this.hass}
.stateObj=${this.cameraConfig?.camera_entity?this.hass.states[this.cameraConfig.camera_entity]:void 0}
.controls=${this.controls}
.muted=${!0}
>
</frigate-card-ha-camera-stream>`}static get styles(){return h(":host {\n width: 100%;\n height: 100%;\n display: block;\n}")}};l([v({attribute:!1})],P.prototype,"hass",void 0),l([v({attribute:!1})],P.prototype,"cameraConfig",void 0),l([v({attribute:!0,type:Boolean})],P.prototype,"controls",void 0),P=l([c("frigate-card-live-ha")],P);export{P as FrigateCardLiveHA};

View File

@ -0,0 +1,34 @@
import{dh as t,cO as e,d6 as i,x as s,ds as a,dt as o,du as r,dr as d,r as n,eE as h,_ as l,t as u}from"./card-e5d55e5b.js";import{h as c,s as v,d as y,c as p}from"./media-921a03ae.js";import{m}from"./audio-cf3a75aa.js";
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const _=(t,e,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&"object"!=typeof e&&Object.defineProperty(t,e,i),i)
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/;function f(t,e){return(i,s,a)=>{const o=e=>e.renderRoot?.querySelector(t)??null;if(e){const{get:t,set:e}="object"==typeof s?i:a??(()=>{const t=Symbol();return{get(){return this[t]},set(e){this[t]=e}}})();return _(i,s,{get(){let i=t.call(this);return void 0===i&&(i=o(this),(null!==i||this.hasUpdated)&&e.call(this,i)),i}})}return _(i,s,{get(){return o(this)}})}}var g="img,\nvideo {\n object-fit: var(--frigate-card-media-layout-fit, contain);\n object-position: var(--frigate-card-media-layout-position-x, 50%) var(--frigate-card-media-layout-position-y, 50%);\n object-view-box: inset(var(--frigate-card-media-layout-view-box-top, 0%) var(--frigate-card-media-layout-view-box-right, 0%) var(--frigate-card-media-layout-view-box-bottom, 0%) var(--frigate-card-media-layout-view-box-left, 0%));\n}";customElements.whenDefined("ha-hls-player").then((()=>{let _=class extends(customElements.get("ha-hls-player")){async play(){return this._video?.play()}async pause(){this._video?.pause()}async mute(){this._video&&(this._video.muted=!0)}async unmute(){this._video&&(this._video.muted=!1)}isMuted(){return this._video?.muted??!0}async seek(t){this._video&&(c(this._video),this._video.currentTime=t)}async setControls(t){this._video&&v(this._video,t??this.controls)}isPaused(){return this._video?.paused??!0}async getScreenshotURL(){return this._video?t(this._video):null}render(){if(this._error){if(this._errorIsFatal)return y(this),e({type:"error",message:this._error,context:{entity_id:this.entityid}});i(this._error,console.error)}return s`
<video
id="video"
.poster=${this.posterUrl}
?autoplay=${this.autoPlay}
.muted=${this.muted}
?playsinline=${this.playsInline}
?controls=${this.controls}
@loadedmetadata=${()=>{this.controls&&c(this._video,p)}}
@loadeddata=${t=>this._loadedDataHandler(t)}
@volumechange=${()=>a(this)}
@play=${()=>o(this)}
@pause=${()=>r(this)}
></video>
`}_loadedDataHandler(t){super._loadedData(),d(this,t,{player:this,capabilities:{supportsPause:!0,hasAudio:m(this._video)},technology:["hls"]})}static get styles(){return[super.styles,n(g),h`
:host {
width: 100%;
height: 100%;
}
video {
width: 100%;
height: 100%;
}
`]}};l([f("#video")],_.prototype,"_video",void 0),_=l([u("frigate-card-ha-hls-player")],_)}));export{g as c,f as e};

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,9 @@
import{a as e,cL as a,x as t,cP as s,r as i,cZ as r,_ as u,n as g,t as m}from"./card-e5d55e5b.js";import"./image-04d4df35.js";let n=class extends e{constructor(){super(...arguments),this._refImage=a()}async play(){await(this._refImage.value?.play())}async pause(){await(this._refImage.value?.pause())}async mute(){await(this._refImage.value?.mute())}async unmute(){await(this._refImage.value?.unmute())}isMuted(){return!!this._refImage.value?.isMuted()}async seek(e){await(this._refImage.value?.seek(e))}async setControls(e){await(this._refImage.value?.setControls(e))}isPaused(){return this._refImage.value?.isPaused()??!0}async getScreenshotURL(){return await(this._refImage.value?.getScreenshotURL())??null}render(){if(this.hass&&this.cameraConfig)return t`
<frigate-card-image
${s(this._refImage)}
.hass=${this.hass}
.imageConfig=${this.cameraConfig.image}
.cameraConfig=${this.cameraConfig}
>
</frigate-card-image>
`}static get styles(){return i(r)}};u([g({attribute:!1})],n.prototype,"hass",void 0),u([g({attribute:!1})],n.prototype,"cameraConfig",void 0),n=u([m("frigate-card-live-image")],n);export{n as FrigateCardLiveImage};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
import{c_ as t}from"./card-e5d55e5b.js";function s(s){const n=t(s);return n.setMinutes(59,59,999),n}function n(s){const n=t(s);return n.setMinutes(0,0,0),n}export{s as e,n as s};

View File

@ -0,0 +1,13 @@
import{_ as i,n as t,t as e,a,x as r,r as o,cZ as s}from"./card-e5d55e5b.js";import"./timeline-core-14147786.js";import"./startOfHour-34edc6a8.js";import"./endOfDay-cfc9c86c.js";import"./date-picker-d9927b87.js";let n=class extends a{render(){return this.timelineConfig?r`
<frigate-card-timeline-core
.hass=${this.hass}
.viewManagerEpoch=${this.viewManagerEpoch}
.timelineConfig=${this.timelineConfig}
.thumbnailConfig=${this.timelineConfig.controls.thumbnails}
.cameraManager=${this.cameraManager}
.cameraIDs=${this.cameraManager?.getStore().getCameraIDsWithCapability({anyCapabilities:["clips","snapshots","recordings"]})}
.cardWideConfig=${this.cardWideConfig}
.itemClickAction=${"none"===this.timelineConfig.controls.thumbnails.mode?"play":"select"}
>
</frigate-card-timeline-core>
`:r``}static get styles(){return o(s)}};i([t({attribute:!1})],n.prototype,"hass",void 0),i([t({attribute:!1})],n.prototype,"viewManagerEpoch",void 0),i([t({attribute:!1})],n.prototype,"timelineConfig",void 0),i([t({attribute:!1})],n.prototype,"cameraManager",void 0),i([t({attribute:!1})],n.prototype,"cardWideConfig",void 0),n=i([e("frigate-card-timeline")],n);export{n as FrigateCardTimeline};

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
import{a as e,eJ as t,dh as a,cO as r,dC as s,dg as i,l as o,dr as n,dt as c,du as d,ds as l,r as u,_ as h,n as g,b as m,t as p,d_ as y,x as b}from"./card-e5d55e5b.js";import{s as _,h as f,c as w,d as v}from"./media-921a03ae.js";import{g as C}from"./get-technology-for-video-rtc-778a0c05.js";import{m as x}from"./audio-cf3a75aa.js";let P=class extends e{constructor(){super(...arguments),this.controls=!1,this._message=null,this._webrtcTask=new t(this,this._getWebRTCCardElement,(()=>[1]))}async play(){return this._getPlayer()?.play()}async pause(){this._getPlayer()?.pause()}async mute(){const e=this._getPlayer();e&&(e.muted=!0)}async unmute(){const e=this._getPlayer();e&&(e.muted=!1)}isMuted(){return this._getPlayer()?.muted??!0}async seek(e){const t=this._getPlayer();t&&(t.currentTime=e)}async setControls(e){const t=this._getPlayer();t&&_(t,e??this.controls)}isPaused(){return this._getPlayer()?.paused??!0}async getScreenshotURL(){const e=this._getPlayer();return e?a(e):null}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._message=null,super.disconnectedCallback()}willUpdate(e){["cameraConfig","cameraEndpoints"].some((t=>e.has(t)))&&(this._message=null)}_getVideoRTC(){return this.renderRoot?.querySelector("#webrtc")??null}_getPlayer(){return this._getVideoRTC()?.video??null}async _getWebRTCCardElement(){return await customElements.whenDefined("webrtc-camera"),customElements.get("webrtc-camera")}_createWebRTC(){const e=this._webrtcTask.value;if(e&&this.hass&&this.cameraConfig){const t=new e,a={intersection:0,muted:!0,...this.cameraConfig.webrtc_card};return a.url||a.entity||!this.cameraEndpoints?.webrtcCard||(a.url=this.cameraEndpoints.webrtcCard.endpoint),t.setConfig(a),t.hass=this.hass,t}return null}render(){if(this._message)return r(this._message);return s(this._webrtcTask,(()=>{let e;try{e=this._createWebRTC()}catch(e){return this._message={type:"error",message:e instanceof y?e.message:o("error.webrtc_card_reported_error")+": "+e.message,context:e.context},void v(this)}return e&&(e.id="webrtc"),b`${e}`}),{inProgressFunc:()=>i({message:o("error.webrtc_card_waiting"),cardWideConfig:this.cardWideConfig})})}updated(){this.updateComplete.then((()=>{const e=this._getVideoRTC(),t=this._getPlayer();t&&(_(t,this.controls),t.onloadeddata=()=>{this.controls&&f(t,w),n(this,t,{player:this,capabilities:{supportsPause:!0,hasAudio:x(t)},...e&&{technology:C(e)}})},t.onplay=()=>c(this),t.onpause=()=>d(this),t.onvolumechange=()=>l(this))}))}static get styles(){return u(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\n/* Don't drop shadow or have radius for nested webrtc card */\n#webrtc ha-card {\n border-radius: 0px;\n margin: 0px;\n box-shadow: none;\n}\n\nha-card,\ndiv.fix-safari,\n#video {\n background: unset;\n background-color: unset;\n}\n\n#webrtc #video {\n object-fit: var(--frigate-card-media-layout-fit, contain);\n object-position: var(--frigate-card-media-layout-position-x, 50%) var(--frigate-card-media-layout-position-y, 50%);\n object-view-box: inset(var(--frigate-card-media-layout-view-box-top, 0%) var(--frigate-card-media-layout-view-box-right, 0%) var(--frigate-card-media-layout-view-box-bottom, 0%) var(--frigate-card-media-layout-view-box-left, 0%));\n}")}};h([g({attribute:!1})],P.prototype,"cameraConfig",void 0),h([g({attribute:!1})],P.prototype,"cameraEndpoints",void 0),h([g({attribute:!1})],P.prototype,"cardWideConfig",void 0),h([g({attribute:!0,type:Boolean})],P.prototype,"controls",void 0),h([m()],P.prototype,"_message",void 0),P=h([p("frigate-card-live-webrtc-card")],P);export{P as FrigateCardLiveWebRTCCard};

View File

@ -0,0 +1 @@
import{e0 as t,l as e,d2 as a,dj as s,dl as n,e9 as r,d8 as i,dP as d,i as o,eb as u,ea as c,dV as l}from"./card-e5d55e5b.js";import{C as g,G as h}from"./engine-generic-93cdbee6.js";import{a as _,V as m}from"./media-c9012082.js";class y extends g{constructor(){super(...arguments),this._entity=null}async initialize(a){const s=this.getConfig(),n=s.camera_entity?await a.entityRegistryManager.getEntity(a.hass,s.camera_entity):null;if(!n||!s.camera_entity)throw new t(e("error.no_camera_entity"),s);return this._entity=n,this}getEntity(){return this._entity}}class M extends h{constructor(t,e,a,s,n,r){super(e,r),this._entityRegistryManager=t,this._browseMediaManager=a,this._resolvedMediaCache=s,this._requestCache=n}generateDefaultEventQuery(t,e,s){return[{type:a.Event,cameraIDs:e,...s}]}async getMediaDownloadPath(t,e,a){const r=a.getContentID();if(!r)return null;const i=await s(t,r,this._resolvedMediaCache);return i?{endpoint:n(t,i.url)}:null}getQueryResultMaxAge(t){return t.type===a.Event?r:null}getMediaCapabilities(t){return{canFavorite:!1,canDownload:!0}}}class p extends _{constructor(t,e,a){super(t,e),this._browseMedia=a,a._metadata?.startDate?this._id=`${e}/${i(a._metadata.startDate,"yyyy-MM-dd HH:mm:ss")}`:this._id=a.media_content_id}getStartTime(){return this._browseMedia._metadata?.startDate??null}getEndTime(){return this._browseMedia._metadata?.endDate??null}getVideoContentType(){return m.MP4}getID(){return this._id}getContentID(){return this._browseMedia.media_content_id}getTitle(){const t=this.getStartTime();return t?d(t):this._browseMedia.title}getThumbnail(){return this._browseMedia.thumbnail}getWhat(){return null}getScore(){return null}getTags(){return null}isGroupableWith(t){return this.getMediaType()===t.getMediaType()&&o(this.getWhere(),t.getWhere())&&o(this.getWhat(),t.getWhat())}}class w{static createEventViewMedia(t,e,a){return new p(t,a,e)}}const D=t=>{const e=new Map;for(const a of t){const t=a._metadata?.cameraID;if(!t)continue;const s=a.media_class===u?"clip":a.media_class===c?"snapshot":null;if(!s)continue;const n=w.createEventViewMedia(s,a,t),r=n.getID(),i=e.get(r);(!i||"snapshot"===i.getMediaType()&&"clip"===n.getMediaType())&&e.set(r,n)}return[...e.values()]},b=(t,e,a)=>!!t._metadata&&(e&&a?l({start:t._metadata.startDate,end:t._metadata.endDate},{start:e,end:a}):!e&&a?t._metadata.startDate<=a:!(e&&!a)||t._metadata.startDate>=e);export{y as B,M as a,D as g,b as i};

File diff suppressed because one or more lines are too long