diff --git a/config/automation/away.yaml b/config/automation/away.yaml index 886e0d9c..f4f440f2 100755 --- a/config/automation/away.yaml +++ b/config/automation/away.yaml @@ -1,41 +1,32 @@ ###################################################################### ## Shut it all down. No one is here +# @CCOSTAN +# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig ###################################################################### # Define an alias for this automation - alias: 'Away Mode' - # Give the automation a unique ID id: 712e845a-9d72-4993-b8af-890b167c807b - # Set the mode to "single" mode: single - # Set the trigger for the automation trigger: - # The automation will also be triggered when the state of the "group.family" entity changes to "not_home" - platform: state entity_id: group.family to: 'not_home' - # Set the conditions for the automation to run condition: - # The automation will only run if the state of the "group.family" entity is "not_home" - condition: state entity_id: group.family state: 'not_home' - # The automation will also only run if the state of the "input_boolean.guest_mode" entity is "off" + - condition: state entity_id: input_boolean.guest_mode state: 'off' - # Set the actions to be performed by the automation action: - # Lock the front door - service: lock.lock entity_id: lock.front_door - - # Turn off all interior lights and devices - - service: script.interior_off - # Turn off the back landscaping lights + - service: script.interior_off - service: switch.turn_off entity_id: switch.back_landscaping diff --git a/config/automation/late_night_helper.yaml b/config/automation/late_night_helper.yaml index 5d30afa9..683e2897 100755 --- a/config/automation/late_night_helper.yaml +++ b/config/automation/late_night_helper.yaml @@ -38,6 +38,7 @@ entity_id: - group.kitchen_Accents - switch.front_office_lamp + - switch.living_room_outlet - delay: '00:05:00' - service: light.turn_off entity_id: diff --git a/config/group/Indoor_Outdoor.yaml b/config/group/Indoor_Outdoor.yaml index 2c4ca4f6..6a749c84 100755 --- a/config/group/Indoor_Outdoor.yaml +++ b/config/group/Indoor_Outdoor.yaml @@ -4,7 +4,8 @@ Interior_Lights: - group.kitchen_accents - light.bedroom - light.bedroom_lights - - light.den_lights + - light.den_2 + - light.den1 - light.dinette_lights - light.dining_room_lights - light.foyer_lights diff --git a/config/packages/phynplus.yaml b/config/packages/phynplus.yaml index cd2ca7e1..4f667627 100755 --- a/config/packages/phynplus.yaml +++ b/config/packages/phynplus.yaml @@ -19,6 +19,11 @@ automation: entity_id: switch.phyn_shutoff_valve to: 'off' + condition: + - condition: time + after: '05:00' + before: '04:00' + action: - service: script.notify_engine_two_button data: diff --git a/config/script/interior_off.yaml b/config/script/interior_off.yaml index c1169ffe..2f247cb6 100755 --- a/config/script/interior_off.yaml +++ b/config/script/interior_off.yaml @@ -10,7 +10,8 @@ interior_off: - service: homeassistant.turn_off entity_id: - group.interior_lights - - service: script.switch_turn_off_all + - group.interior_switches + - switch.lr_amp - service: script.paige_lights_off # C by GE Lights (https://amzn.to/30w3UWy) - service: script.garage_lights_off # C by GE Lights (https://amzn.to/30w3UWy) # - service: script.noon_lights_off # Noon Home Smart Lights (https://amzn.to/3fOIPx6) diff --git a/config/script/notify_engine.yaml b/config/script/notify_engine.yaml index eb188c1c..d34ef12c 100755 --- a/config/script/notify_engine.yaml +++ b/config/script/notify_engine.yaml @@ -56,7 +56,7 @@ notify_engine: group: "{{ group|default('information'),true }}" push: interuption_level: "{{ level|default('active'),true }}" - entity_id: "{{ camera_entity }}" + entity_id: "{{ camera_entity|default('', true) }}" notify_engine_two_button: sequence: diff --git a/config/script/switch_turn_off_all.yaml b/config/script/switch_turn_off_all.yaml deleted file mode 100755 index 6d95a7e4..00000000 --- a/config/script/switch_turn_off_all.yaml +++ /dev/null @@ -1,13 +0,0 @@ -###################################################################################################### -###Script to shut switches with a 30 second delay to not trample codes -### Sample Call -# action: -# - service: script.switch_turn_off_all -###################################################################################################### - -switch_turn_off_all: - sequence: - - service: switch.turn_off - entity_id: group.interior_switches - - service: switch.turn_off - entity_id: switch.lr_amp diff --git a/config/www/community/Bubble-Card/bubble-card.js b/config/www/community/Bubble-Card/bubble-card.js new file mode 100644 index 00000000..920c205d --- /dev/null +++ b/config/www/community/Bubble-Card/bubble-card.js @@ -0,0 +1,1441 @@ +(()=>{"use strict";var __webpack_modules__={946:(e,t,n)=>{function o(e,t=40){if(Array.isArray(e)&&3===e.length){for(let t=0;t<3;t++)if(e[t]<0||e[t]>255)return;return e.every((e=>Math.abs(e-255)<=t))}}let a;function i(e,t,n=1){if(e.startsWith("#"))if(4===e.length){let o=Math.min(255,parseInt(e.charAt(1).repeat(2),16)*n),i=Math.min(255,parseInt(e.charAt(2).repeat(2),16)*n),r=Math.min(255,parseInt(e.charAt(3).repeat(2),16)*n);a="rgba("+o+", "+i+", "+r+", "+t+")"}else{let o=Math.min(255,parseInt(e.slice(1,3),16)*n),i=Math.min(255,parseInt(e.slice(3,5),16)*n),r=Math.min(255,parseInt(e.slice(5,7),16)*n);a="rgba("+o+", "+i+", "+r+", "+t+")"}else if(e.startsWith("rgb")){let o=e.match(/\d+/g);a="rgba("+Math.min(255,o[0]*n)+", "+Math.min(255,o[1]*n)+", "+Math.min(255,o[2]*n)+", "+t+")"}else if(e.startsWith("var(--")){let o=e.slice(4,-1),r=window.getComputedStyle(document.documentElement).getPropertyValue(o);(r.startsWith("#")||r.startsWith("rgb"))&&(a=i(r,t,n))}return a}n.d(t,{_k:()=>i,wW:()=>o})},191:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{BX:()=>fireEvent,GP:()=>applyScrollingEffect,IL:()=>getAttribute,Jn:()=>tapFeedback,OC:()=>isEntityType,P2:()=>throttle,Vv:()=>isColorLight,X:()=>getWeatherIcon,az:()=>createElement,gJ:()=>getImage,jk:()=>forwardHaptic,jx:()=>setLayout,mk:()=>getIconColor,o0:()=>formatDateTime,oY:()=>getName,pr:()=>isStateOn,q7:()=>getIcon,y0:()=>getState});var _style_ts__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(946);function hasStateChanged(e,t,n){if(e.hasState=t.states[n],e.hasState)return e.newState=[e.hasState.state,e.hasState.attributes.rgb_color],e.oldState&&e.newState[0]===e.oldState[0]&&e.newState[1]===e.oldState[1]?e.stateChanged=!1:(e.oldState=e.newState,e.stateChanged=!0),e.stateChanged}function configChanged(e,t){return!(!t.classList.contains("editor")||e.config===e.previousConfig||(e.previousConfig=e.config,0))}const fireEvent=(e,t,n,o)=>{o=o||{},n=null==n?{}:n;const a=new Event(t,{bubbles:void 0===o.bubbles||o.bubbles,cancelable:Boolean(o.cancelable),composed:void 0===o.composed||o.composed});return a.detail=n,e.dispatchEvent(a),a},forwardHaptic=e=>{fireEvent(window,"haptic",e)},navigate=(e,t,n=!1)=>{n?history.replaceState(null,"",t):history.pushState(null,"",t),fireEvent(window,"location-changed",{replace:n})};function toggleEntity(e,t){e.callService("homeassistant","toggle",{entity_id:t})}function tapFeedback(e){void 0!==e&&(e.style.display="",e.style.animation="tap-feedback .3s",setTimeout((()=>{e.style.animation="none",e.style.display="none"}),500))}function getIcon(e,t=e.config.entity,n=e.config.icon){const o=t?.split(".")[0],a=getAttribute(e,"device_class",t),i=getAttribute(e,"icon",t),r=n,s=getState(e,t),l={alarm_control_panel:"mdi:shield",alert:"mdi:alert",automation:"mdi:playlist-play",binary_sensor:function(){const n="off"===s;switch(getAttribute(e,"device_class",t)){case"battery":return n?"mdi:battery":"mdi:battery-outline";case"battery_charging":return n?"mdi:battery":"mdi:battery-charging";case"cold":return n?"mdi:thermometer":"mdi:snowflake";case"connectivity":return n?"mdi:server-network-off":"mdi:server-network";case"door":return n?"mdi:door-closed":"mdi:door-open";case"garage_door":return n?"mdi:garage":"mdi:garage-open";case"heat":return n?"mdi:thermometer":"mdi:fire";case"light":return n?"mdi:brightness-5":"mdi:brightness-7";case"lock":return n?"mdi:lock":"mdi:lock-open";case"moisture":return n?"mdi:water-off":"mdi:water";case"motion":return n?"mdi:motion-sensor-off":"mdi:motion-sensor";case"occupancy":case"presence":return n?"mdi:home-outline":"mdi:home";case"opening":return n?"mdi:square":"mdi:square-outline";case"plug":case"power":return n?"mdi:power-plug-off":"mdi:power-plug";case"running":return n?"mdi:stop":"mdi:play";case"safety":case"tamper":return n?"mdi:check-circle":"mdi:alert-circle";case"smoke":return n?"mdi:check-circle":"mdi:smoke";case"sound":return n?"mdi:music-note-off":"mdi:music-note";case"update":return n?"mdi:package":"mdi:package-up";case"vibration":return n?"mdi:crop-portrait":"mdi:vibrate";case"window":return n?"mdi:window-closed":"mdi:window-open";default:return n?"mdi:radiobox-blank":"mdi:checkbox-marked-circle"}}(),calendar:"mdi:calendar",camera:"mdi:video",climate:"mdi:thermostat",configurator:"mdi:settings",conversation:"mdi:text-to-speech",cover:function(){const n="closed"!==s;switch(getAttribute(e,"device_class",t)){case"awning":return n?"mdi:awning-outline":"mdi:awning";case"blind":return n?"mdi:blinds-open":"mdi:blinds";case"curtain":return n?"mdi:curtains-open":"mdi:curtains";case"damper":case"shutter":default:return n?"mdi:window-shutter-open":"mdi:window-shutter";case"door":return n?"mdi:door-open":"mdi:door-closed";case"garage":return n?"mdi:garage-open":"mdi:garage";case"gate":return n?"mdi:gate-open":"mdi:gate";case"shade":return n?"mdi:roller-shade":"mdi:roller-shade-closed";case"window":return n?"mdi:window-open":"mdi:window-closed"}}(),device_tracker:"mdi:account",fan:"mdi:fan",group:"mdi:google-circles-communities",history_graph:"mdi:chart-line",homeassistant:"mdi:home-assistant",homekit:"mdi:home-automation",image_processing:"mdi:image-filter-frames",input_boolean:"mdi:drawing",input_datetime:"mdi:calendar-clock",input_number:"mdi:ray-vertex",input_select:"mdi:format-list-bulleted",input_text:"mdi:textbox",light:"mdi:lightbulb",lock:"mdi:lock",mailbox:"mdi:mailbox",media_player:"mdi:speaker",mower:"mdi:robot-mower",notify:"mdi:comment-alert",person:"mdi:account",plant:"mdi:flower",proximity:"mdi:apple-safari",remote:"mdi:remote",scene:"mdi:palette",script:"mdi:file-document",sensor:function(){switch(getAttribute(e,"device_class",t)){case"battery":return 100==s?"mdi:battery":s>=90?"mdi:battery-90":s>=80?"mdi:battery-80":s>=70?"mdi:battery-70":s>=60?"mdi:battery-60":s>=50?"mdi:battery-50":s>=40?"mdi:battery-40":s>=30?"mdi:battery-30":s>=20?"mdi:battery-20":s>=10?"mdi:battery-10":"mdi:battery-alert";case"humidity":return"mdi:water-percent";case"illuminance":return"mdi:brightness-5";case"temperature":return"mdi:thermometer";case"pressure":return"mdi:gauge";case"power":return"mdi:flash";case"signal_strength":return"mdi:wifi";case"energy":return"mdi:lightning-bolt";default:return"mdi:eye"}}(),simple_alarm:"mdi:bell",sun:"mdi:white-balance-sunny",switch:"mdi:flash",timer:"mdi:timer",updater:"mdi:cloud-upload",vacuum:"mdi:robot-vacuum",water_heater:"mdi:thermometer",weather:function(n=getState(e,t)){switch(n){case"cloudy":default:return"mdi:weather-cloudy";case"partlycloudy":return"mdi:weather-partly-cloudy";case"rainy":return"mdi:weather-rainy";case"snowy":return"mdi:weather-snowy";case"sunny":return"mdi:weather-sunny";case"clear-night":return"mdi:weather-night";case"fog":return"mdi:weather-fog";case"hail":return"mdi:weather-hail";case"lightning":return"mdi:weather-lightning";case"lightning-rainy":return"mdi:weather-lightning-rainy";case"pouring":return"mdi:weather-pouring";case"windy":return"mdi:weather-windy";case"windy-variant":return"mdi:weather-windy-variant";case"exceptional":return"mdi:alert-circle-outline"}}(),weblink:"mdi:open-in-new"};return r||i||(l[o]?l[o]:l[a]?l[a]:"")}function getWeatherIcon(e){switch(e){case"cloudy":default:return"mdi:weather-cloudy";case"partlycloudy":return"mdi:weather-partly-cloudy";case"rainy":return"mdi:weather-rainy";case"snowy":return"mdi:weather-snowy";case"sunny":return"mdi:weather-sunny";case"clear-night":return"mdi:weather-night";case"fog":return"mdi:weather-fog";case"hail":return"mdi:weather-hail";case"lightning":return"mdi:weather-lightning";case"lightning-rainy":return"mdi:weather-lightning-rainy";case"pouring":return"mdi:weather-pouring";case"windy":return"mdi:weather-windy";case"windy-variant":return"mdi:weather-windy-variant";case"exceptional":return"mdi:alert-circle-outline"}}let cachedColor=null,cachedResult=null;function resolveCssVariable(e){const t=getComputedStyle(document.body);let n=e;for(;n.startsWith("var(");){const e=n.match(/var\((--[^,]+),?\s*(.*)?\)/);if(!e)break;const o=t.getPropertyValue(e[1]).trim();if(o)n=o;else{if(!e[2])break;n=e[2].trim()}}return n}function isColorLight(e){const t=resolveCssVariable(e);if(!t)return!1;if(t===cachedColor)return cachedResult;cachedColor=t;const n=t.match(/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);let o,a,i;if(n)o=parseInt(n[1],16),a=parseInt(n[2],16),i=parseInt(n[3],16);else{const e=t.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)/i);if(!e)return cachedResult=!1,cachedResult;o=parseInt(e[1],10),a=parseInt(e[2],10),i=parseInt(e[3],10)}return cachedResult=(.2126*o+.7152*a+.0722*i)/255>.5,cachedResult}function getIconColor(e,t=e.config.entity,n=1){const o=e.config.card_type,a=e.config.use_accent_color,i="var(--bubble-accent-color, var(--accent-color))",r=getAttribute(e,"rgb_color",t),s=isColorLight("var(--bubble-button-icon-background-color, var(--bubble-icon-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background)))))");if(n=s?n-.2:n,!t)return i;if(isEntityType(e,"light")&&!a?"button"===o?e.card.classList.add("is-light"):"pop-up"===o&&e.elements.headerContainer.classList.add("is-light"):"button"===o?e.card.classList.remove("is-light"):"pop-up"===o&&e.elements.headerContainer.classList.remove("is-light"),!1===t.startsWith("light.")||a)return i;const l=[225,225,210];if(!r)return`var(--bubble-light-color, rgba(${l.map((e=>Math.min(255,e*n))).join(", ")}))`;const c=r.map((e=>Math.min(255,e*n)));return(0,_style_ts__WEBPACK_IMPORTED_MODULE_0__.wW)(r)?`var(--bubble-light-color, rgba(${l.map((e=>Math.min(255,e*n))).join(", ")}))`:`var(--bubble-light-color, rgba(${c.join(", ")}))`}function getImage(e,t=e.config.entity){if(e.config.force_icon)return"";const n=e._hass.states[t],o=n.attributes.entity_picture_local||n.attributes.entity_picture;return o?e._hass.hassUrl(o):""}function getName(e){const t=e.config.name,n=getAttribute(e,"friendly_name");return e.name||t||n||""}function getState(e,t=e.config.entity){return e._hass.states[t]?.state??""}function getAttribute(context,attribute,entity=context.config.entity){return attribute?eval(`context._hass.states['${entity}']?.attributes.${attribute}`)??"":""}function isEntityType(e,t){return e.config.entity?.startsWith(t+".")??!1}function isStateOn(e,t=e.config.entity){const n=getState(e,t).toLowerCase(),o=Number(n);return!!(["on","open","opening","closing","cleaning","true","idle","home","playing","paused","locked","occupied","available","running","active","connected","online","mowing","starting","heat","cool","dry","heat_cool","fan_only","auto","alarm"].includes(n)||o>0)}function createElement(e,t=""){const n=document.createElement(e);return""!==t&&t.split(" ").forEach((e=>{n.classList.add(e)})),n}function debounce(e,t){let n;return function(...o){clearTimeout(n),n=setTimeout((()=>e.apply(this,o)),t)}}function applyScrollingEffect(e,t,n){const o=e.config.scrolling_effect??!0;if(!o)return void applyNonScrollingStyle(t,n);if(t.previousText===n)return;const a=t.className.split(" ").find((e=>e.startsWith("bubble-")));function i(){t.innerHTML=`
${n}
`,t.style="";const e=t.scrollWidth,i=t.parentNode?.offsetWidth||0;o&&e>i?(function(e,t,n){const o=' | ',a=`${t+o+t+o}`;e.innerHTML=`
${a}
`;const i=function(e){return`\n .${e} .scrolling-container {\n width: 100%;\n white-space: nowrap;\n mask-image: linear-gradient(to right, transparent, black calc(0% + 8px), black calc(100% - 8px), transparent);\n mask-image: linear-gradient(to left, transparent, black calc(0% + 8px), black calc(100% - 8px), transparent);\n }\n .${e} .scrolling-container span {\n display: inline-block;\n animation: scroll 14s linear infinite;\n }\n\n .bubble-scroll-separator {\n opacity: .3;\n margin: 0 6px 0 8px;\n }\n\n @keyframes scroll {\n from { transform: translateX(0%); }\n to { transform: translateX(-50%); }\n }\n `}(n);e.styleElement=document.createElement("style"),e.appendChild(e.styleElement),e.styleElement.innerHTML=i}(t,n,a),t.previousText=n):t.previousText=n}requestAnimationFrame(i),t.eventAdded||(window.addEventListener("resize",debounce(i,300)),t.eventAdded=!0)}function applyNonScrollingStyle(e,t){e.innerHTML=t,e.previousText=t,e.style.whiteSpace="normal",e.style.display="-webkit-box",e.style.webkitLineClamp="2",e.style.webkitBoxOrient="vertical",e.style.textOverflow="ellipsis"}function formatDateTime(e,t){if(!e)return"";const n=new Date(e),o=new Date;let a,i,r=Math.floor((o-n)/1e3);return isNaN(r)?"":(r<60?(a="second",i=r+1):r<3600?(a="minute",i=Math.floor(r/60)):r<86400?(a="hour",i=Math.floor(r/3600)):(a="day",i=Math.floor(r/86400)),new Intl.RelativeTimeFormat(t,{numeric:"auto"}).format(-i,a))}function setLayout(e){const t=e.config.card_layout,n="large"===t||"large-2-rows"===t,o="large-2-rows"===t;n!==e.content.classList.contains("large")&&e.content.classList.toggle("large",n),o!==e.content.classList.contains("rows-2")&&e.content.classList.toggle("rows-2",o)}function throttle(e,t=300){let n;return(...o)=>{void 0===n&&(e(...o),n=setTimeout((()=>{n=void 0}),t))}}}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var n=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](n,n.exports,__webpack_require__),n.exports}__webpack_require__.d=(e,t)=>{for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var __webpack_exports__={};(()=>{let e="v2.3.3";var t=__webpack_require__(946),n=__webpack_require__(191);function o(e,t,n){setTimeout((()=>{const o=new Event("hass-action",{bubbles:!0,composed:!0}),a={...t};!a.entity_id&&this?.config?.entity&&(a.entity_id=this.config.entity),"tap"===n||"double_tap"===n||"hold"===n?o.detail={config:a,action:n}:(e.modifiedConfig={...a,tap_action:{...a[n]}},delete e.modifiedConfig[n],o.detail={config:e.modifiedConfig,action:"tap"}),e.dispatchEvent(o)}),10)}function a(e,t,n,o){e.classList.add("bubble-action"),e.dataset.entity=t?.entity||n,e.dataset.tapAction=JSON.stringify(t?.tap_action||o?.tap_action||{action:"more-info"}),e.dataset.doubleTapAction=JSON.stringify(t?.double_tap_action||o?.double_tap_action||{action:"toggle"}),e.dataset.holdAction=JSON.stringify(t?.hold_action||o?.hold_action||{action:"toggle"});const a=JSON.parse(e.dataset.tapAction),i=JSON.parse(e.dataset.doubleTapAction),r=JSON.parse(e.dataset.holdAction);e.style.cursor="none"===a.action&&"none"===i.action&&"none"===r.action?"":"pointer"}window.isScrolling=!1,document.addEventListener("scroll",(function(){window.isScrolling=!0,setTimeout((()=>{window.isScrolling=!1}),150)}),{passive:!0}),document.body.addEventListener("pointerdown",(e=>{if(window.isScrolling)return;const t=e.composedPath();let n=null;for(const e of t)if(e.classList&&e.classList.contains("bubble-action")){n=e;break}if(n){const t={tap_action:JSON.parse(n.dataset.tapAction),double_tap_action:JSON.parse(n.dataset.doubleTapAction),hold_action:JSON.parse(n.dataset.holdAction),entity:n.dataset.entity};n.actionHandler||(n.actionHandler=new i(n,t,r)),n.actionHandler.handleStart(e),n.addEventListener("pointerup",n.actionHandler.handleEnd.bind(n.actionHandler),{once:!0}),document.addEventListener("scroll",n.actionHandler.handleScroll.bind(n.actionHandler),{once:!0})}}),{passive:!0});class i{constructor(e,t,n){this.element=e,this.config=t,this.sendActionEvent=n,this.tapTimeout=null,this.holdTimeout=null,this.startX=0,this.startY=0,this.holdFired=!1,this.pointerMoveListener=this.detectScrollLikeMove.bind(this)}handleStart(e){window.isScrolling||this.isDisconnected||(this.startX=e.clientX,this.startY=e.clientY,this.holdFired=!1,document.addEventListener("pointermove",this.pointerMoveListener),this.holdTimeout=setTimeout((()=>{"none"===(this.config.hold_action||{action:"none"}).action||window.isScrolling||(this.sendActionEvent(this.element,this.config,"hold"),this.holdFired=!0)}),400))}detectScrollLikeMove(e){const t=Math.abs(e.clientX-this.startX),n=Math.abs(e.clientY-this.startY);(t>5||n>5)&&(clearTimeout(this.holdTimeout),this.holdTimeout=null,document.removeEventListener("pointermove",this.pointerMoveListener))}handleEnd(e){if(window.isScrolling||this.isDisconnected)return;if(clearTimeout(this.holdTimeout),this.holdTimeout=null,document.removeEventListener("pointermove",this.pointerMoveListener),this.holdFired)return;const t=Date.now(),n=this.config.double_tap_action||{action:"none"},o=this.config.tap_action||{action:"none"};this.lastTap&&t-this.lastTap<200&&"none"!==n.action?(clearTimeout(this.tapTimeout),this.sendActionEvent(this.element,this.config,"double_tap")):"none"!==o.action&&(this.tapTimeout=setTimeout((()=>{this.sendActionEvent(this.element,this.config,"tap")}),200)),this.lastTap=t}handleScroll(){clearTimeout(this.holdTimeout),this.holdTimeout=null,document.removeEventListener("pointermove",this.pointerMoveListener)}}function r(e,t,n){const a=t.tap_action||{action:"more-info"},i=t.double_tap_action||{action:"toggle"},r=t.hold_action||{action:"toggle"},s=t.entity||this.config?.entity,l=e=>e.service&&"entity"===e.target?.entity_id&&s?{...e,target:{...e.target,entity_id:s}}:e,c=l(a),d=l(i),u=l(r);let b;switch(n){case"tap":default:b=c;break;case"double_tap":b=d;break;case"hold":b=u}o(e,{entity:s,tap_action:c,double_tap_action:d,hold_action:u},n)}function s(e,t){e.addEventListener("click",(()=>{(0,n.jk)("selection"),(0,n.Jn)(t)}))}let l=!1;function c(){!l&&location.hash&&setTimeout((()=>{const e=window.location.href.split("#")[0];history.replaceState(null,"",e),window.dispatchEvent(new Event("location-changed"))}),50)}function d(e){const t=e.startsWith("#")?window.location.href.split("#")[0]+e:e;history.pushState(null,"",t),window.dispatchEvent(new Event("location-changed"))}function u(e,t){e.editor||(e.hideContentTimeout=setTimeout((()=>{const{sectionRow:t,sectionRowContainer:n}=e;"hui-card"===t?.tagName.toLowerCase()&&(t.hidden=!0,t.style.display="none",n?.classList.contains("card")&&(n.style.display="none"))}),t))}function b(e,t){const{showBackdrop:n,hideBackdrop:o}=L(e);t?n():o()}function p(e,t){if(e.config.background_update)return;const n=t?"appendChild":"removeChild";requestAnimationFrame((()=>{e.verticalStack[n](e.popUp)}))}function h(e,t){requestAnimationFrame((()=>{e.classList.toggle("is-popup-opened",t),e.classList.toggle("is-popup-closed",!t)}))}function m(e,t){e.boundClickOutside||(e.boundClickOutside=t=>function(e,t){(t.config.close_by_clicking_outside??1)&&(e.composedPath().find((e=>e.classList?.contains("bubble-pop-up")||["HA-DIALOG","HA-MORE-INFO-DIALOG","HA-DIALOG-DATE-PICKER"].includes(e.nodeName)))||c())}(t,e)),t?(e.listenersAdded||(e.popUp.addEventListener("touchstart",e.resetCloseTimeout,{passive:!0}),e.listenersAdded=!0),window.clickOutsideListenerAdded||(window.addEventListener("click",e.boundClickOutside,{passive:!0}),window.clickOutsideListenerAdded=!0)):e.listenersAdded&&(e.popUp.removeEventListener("touchstart",e.resetCloseTimeout),e.listenersAdded=!1,!location.hash&&window.clickOutsideListenerAdded&&(window.removeEventListener("click",e.boundClickOutside),window.clickOutsideListenerAdded=!1))}function g(e){document.body.style.overflow=e}function f(e){["hideContentTimeout","removeDomTimeout","closeTimeout"].forEach((t=>clearTimeout(e[t])))}const _="\n .bubble-backdrop {\n position: fixed;\n background-color: var(--bubble-backdrop-background-color);\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 4;\n opacity: 0;\n transition: opacity 0.3s;\n transition-delay: .1s;\n display: flex;\n backdrop-filter: var(--custom-backdrop-filter);\n -webkit-backdrop-filter: var(--custom-backdrop-filter);\n transform: translate3d(0, 0, 0);\n }\n\n .bubble-backdrop.is-visible {\n opacity: 1;\n }\n\n .bubble-backdrop.is-hidden {\n opacity: 0;\n pointer-events: none;\n }\n";let y,v,w,x,k=!1;const C=window.matchMedia("(prefers-color-scheme: dark)"),$=(0,n.az)("style");function S(){x=getComputedStyle(document.body).getPropertyValue("--ha-card-background")||getComputedStyle(document.body).getPropertyValue("--card-background-color"),document.body.style.setProperty("--bubble-backdrop-background-color",(0,t._k)(x,.8,.6))}function L(e){const t=e.config.hide_backdrop??!1;if(y)return y;$.innerHTML=_,document.head.appendChild($);const o=(0,n.az)("style");document.head.appendChild(o);const a=(0,n.az)("div","bubble-backdrop backdrop is-hidden");return t&&(a.style.display="none",a.style.pointerEvents="none"),document.body.appendChild(a),a.style.setProperty("--custom-backdrop-filter",`blur(${e.config.backdrop_blur??0}px)`),y={hideBackdrop:function(){a.classList.add("is-hidden"),a.classList.remove("is-visible")},showBackdrop:function(){requestAnimationFrame((()=>{a.classList.add("is-visible"),a.classList.remove("is-hidden")}))},backdropElement:a,backdropCustomStyle:o},y}function T(e,t,n,o){let a;switch(n){case"hvac_modes":a=document.createElement("ha-icon"),a.slot="graphic",a.icon=function(e){switch(e){case"auto":return"mdi:thermostat-auto";case"cool":return"mdi:snowflake";case"heat":return"mdi:fire";case"heat_cool":return"mdi:sun-snowflake-variant";case"dry":return"mdi:water-percent";case"fan_only":default:return"mdi:fan";case"off":return"mdi:power"}}(o);break;case"fan_modes":if(!t.attributes.fan_modes)return null;a=document.createElement("ha-attribute-icon"),a.slot="graphic",a.attribute="fan_mode",a.attributeValue=o,a.hass=e._hass,a.stateObj=t;break;case"swing_modes":a=document.createElement("ha-attribute-icon"),a.slot="graphic",a.attribute="swing_mode",a.attributeValue=o,a.hass=e._hass,a.stateObj=t;break;case"preset_modes":a=document.createElement("ha-attribute-icon"),a.slot="graphic",a.attribute="preset_mode",a.attributeValue=o,a.hass=e._hass,a.stateObj=t;break;default:a=!1}return a}C.addEventListener("change",S),S();const O="\n * {\n -webkit-tap-highlight-color: transparent !important;\n }\n ha-card {\n margin-top: 0;\n background: none;\n opacity: 1;\n }\n mwc-list-item {\n border-radius: var(--bubble-select-list-border-radius, var(--bubble-border-radius, 24px));\n margin: 0 8px;\n }\n mwc-list-item[selected] {\n color: var(--primary-text-color) !important;\n background-color: var(--bubble-list-item-accent-color, var(--bubble-accent-color, var(--accent-color)));\n }\n ha-select {\n --mdc-shape-medium: var(--bubble-select-list-border-radius, var(--bubble-border-radius, 32px));\n --mdc-theme-surface: var(--bubble-select-list-background-color, var(--bubble-select-main-background-color, var(--bubble-main-background-color, var(--card-background-color, var(--secondary-background-color)))));\n --mdc-shape-large: 32px;\n --mdc-shape-small: 64px;\n --mdc-menu-max-width: min-content;\n --mdc-menu-min-width: var(--bubble-select-list-width, 200px);\n --mdc-select-max-width: min-content;\n --mdc-select-outlined-hover-border-color: transparent;\n --mdc-select-outlined-idle-border-color: transparent;\n --mdc-theme-primary: transparent;\n --right-value: calc(var(--mdc-menu-min-width) - 154px);\n }\n .mdc-select {\n color: transparent !important;\n width: 150px !important;\n position: absolute !important;\n pointer-events: none;\n right: var(--right-value, 46px);\n top: -28px;\n }\n .mdc-menu, mwc-list, .mdc-list-item {\n pointer-events: auto;\n }\n .mdc-select__dropdown-icon {\n display: none !important;\n }\n .mdc-select__selected-text {\n color: transparent !important;\n }\n .mdc-select__anchor {\n width: 100%;\n pointer-events: none;\n }\n .bubble-dropdown-container {\n display: flex !important;\n width: auto;\n height: 100%;\n align-items: center;\n }\n .bubble-dropdown-arrow {\n display: flex;\n position: absolute;\n background: var(--bubble-select-arrow-background-color, var(--bubble-icon-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background)))));\n height: 36px;\n width: 36px;\n right: 6px;\n pointer-events: none;\n border-radius: var(--bubble-select-button-border-radius, var(--bubble-border-radius, 20px));\n align-items: center;\n justify-content: center;\n transition: background 0.2s, transform 0.2s;\n pointer-events: none;\n }\n .bubble-dropdown-select {\n position: relative;\n width: 42px;\n }\n .is-unavailable {\n opacity: 0.5;\n }\n .bubble-select-card-container {\n position: relative;\n width: 100%;\n height: 50px;\n background-color: var(--bubble-select-main-background-color, var(--bubble-main-background-color, var(--background-color-2, var(--secondary-background-color))));\n border-radius: var(--bubble-select-border-radius, var(--bubble-border-radius, 32px));\n box-shadow: var(--bubble-select-box-shadow, var(--bubble-box-shadow, none));\n touch-action: pan-y;\n box-sizing: border-box;\n border: solid 2px transparent;\n transition: all 0.15s;\n cursor: pointer;\n }\n .bubble-select-card,\n .bubble-select-background {\n display: flex;\n position: absolute;\n justify-content: space-between;\n align-items: center;\n height: 100%;\n width: 100%;\n transition: background-color 1.5s;\n }\n .bubble-select-background {\n background-color: var(--bubble-select-background-color);\n opacity: .5;\n overflow: hidden !important;\n border-radius: var(--bubble-select-border-radius, var(--bubble-border-radius, 32px));\n }\n .is-unavailable .bubble-select-card {\n cursor: not-allowed;\n }\n .bubble-icon-container {\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n justify-content: center;\n min-width: 38px;\n min-height: 38px;\n margin: 6px;\n border-radius: var(--bubble-select-icon-border-radius, var(--bubble-icon-border-radius, var(--bubble-border-radius, 50%)));\n background-color: var(--bubble-select-icon-background-color, var(--bubble-icon-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background)))));\n overflow: hidden;\n position: relative;\n cursor: pointer;\n }\n .bubble-icon-container::after {\n content: '';\n background-color: currentColor;\n position: absolute;\n display: block;\n width: 100%;\n height: 100%;\n transition: all 1s;\n left: 0;\n right: 0;\n opacity: 0;\n pointer-events: none;\n }\n\n .bubble-icon {\n display: flex;\n opacity: 0.6;\n }\n\n .bubble-entity-picture {\n background-size: cover;\n background-position: center;\n height: 100%;\n width: 100%;\n position: absolute;\n }\n\n .bubble-name,\n .bubble-state {\n display: flex;\n position: relative;\n white-space: nowrap;\n }\n\n .bubble-name-container {\n display: flex;\n line-height: 18px;\n flex-direction: column;\n justify-content: center;\n flex-grow: 1;\n margin: 0 16px 0 4px;\n pointer-events: none;\n position: relative;\n overflow: hidden;\n }\n\n .bubble-name {\n font-weight: 600;\n }\n\n .bubble-state {\n font-size: 12px;\n font-weight: normal;\n opacity: 0.7;\n }\n\n .bubble-feedback-element {\n position: absolute;\n top: 0;\n left: 0;\n opacity: 0;\n width: 100%;\n height: 100%;\n background-color: rgb(0,0,0);\n pointer-events: none;\n }\n\n @keyframes tap-feedback {\n 0% {transform: translateX(-100%); opacity: 0;}\n 64% {transform: translateX(0); opacity: 0.1;}\n 100% {transform: translateX(100%); opacity: 0;}\n }\n\n .large .bubble-select-card-container {\n height: 56px;\n border-radius: var(--bubble-select-border-radius, var(--bubble-border-radius, 32px));\n }\n\n .large .bubble-icon-container {\n --mdc-icon-size: 24px;\n min-width: 42px !important;\n min-height: 42px !important;\n margin-left: 6px;\n }\n\n .rows-2 .bubble-sub-button-container {\n flex-direction: column;\n gap: 4px !important;\n display: grid !important;\n grid-template-columns: repeat(2, min-content);\n grid-template-rows: repeat(2, 1fr);\n grid-auto-flow: column;\n width: auto;\n }\n\n .rows-2 .bubble-sub-button {\n height: 20px !important;\n }\n";function z(e,t=e.elements,o){t.dropdownContainer=(0,n.az)("div","bubble-dropdown-container"),t.dropdownSelect=(0,n.az)("ha-select","bubble-dropdown-select"),t.dropdownSelect.setAttribute("outlined",""),t.dropdownArrow=(0,n.az)("ha-icon","bubble-dropdown-arrow"),t.dropdownArrow.setAttribute("icon","mdi:chevron-down"),t.dropdownContainer.appendChild(t.dropdownArrow),t.dropdownStyleElement=(0,n.az)("style"),t.dropdownCustomStyleElement=(0,n.az)("style"),t.dropdownStyleElement.textContent=O,t.dropdownSelect.updateComplete.then((()=>{!function(){if(t.dropdownSelect.shadowRoot)if(t!==e.elements){t.dropdownSelectStyleElement=(0,n.az)("style"),t.dropdownSelectStyleElement.textContent=O,t.dropdownSelect.shadowRoot.appendChild(t.dropdownSelectStyleElement),t.dropdownContainer.appendChild(t.dropdownStyleElement),o&&(t.dropdownContainer.style.width="24px"),t.dropdownArrow.style.height="20px",t.dropdownArrow.style.width="20px",t.mainContainer=t.parentElement.parentElement.parentElement;let e=t.dropdownSelect.shadowRoot.querySelector("mwc-menu");e&&(e.style.position="relative",e.style.right="138px")}else t.dropdownSelect.shadowRoot.appendChild(t.dropdownStyleElement),t.dropdownSelect.shadowRoot.appendChild(t.dropdownCustomStyleElement)}()})),t===e.elements?t.selectCard.appendChild(t.dropdownContainer):t.appendChild(t.dropdownContainer)}function E(e,t=e.elements,n=e.config.entity,o=e.config){const{dropdownArrow:a,dropdownSelect:i,selectCardContainer:r,selectBackground:s}=t,l=t===e.elements?r:t,c=t===e.elements?s:t;t!==e.elements&&(l.style.border="solid 2px rgba(0,0,0,0)");let d=!0;c.addEventListener("click",(e=>{if("mwc-list-item"===e.target.tagName.toLowerCase())return;const n=i.shadowRoot.querySelector("mwc-menu"),o=()=>{a.style.transform="rotate(180deg)",t.dropdownArrow.style.background="var(--accent-color)",l.style.border="var(--bubble-select-border, solid 2px var(--accent-color))",t.mainContainer&&(t.mainContainer.style.overflow="visible")};d?(d=!1,a.style.transition="none",n.setAttribute("open",""),requestAnimationFrame((()=>{n.removeAttribute("open"),setTimeout((()=>{a.style.transition="",o()}),140)}))):(n.hasAttribute("open")||(n.removeAttribute("mdc-menu-surface--is-open-below"),n.setAttribute("mdc-menu-surface--is-open-above",""),n.setAttribute("open","")),o())})),i.addEventListener("closed",(e=>{e.stopPropagation(),e.preventDefault(),a.style.transform="rotate(0deg)",l.style.border="solid 2px rgba(0,0,0,0)",t.dropdownArrow.style.background="",t.mainContainer&&(t.mainContainer.style.overflow="")})),t.dropdownSelect.addEventListener("click",(t=>{const a=t.target.value;!function(e,t,n,o){const a=t?.split(".")[0];switch(a){case"input_select":e._hass.callService("input_select","select_option",{entity_id:t,option:n});break;case"select":e._hass.callService("select","select_option",{entity_id:t,option:n});break;case"climate":switch(o.select_attribute){case"hvac_modes":e._hass.callService("climate","set_hvac_mode",{entity_id:t,hvac_mode:n});break;case"fan_modes":e._hass.callService("climate","set_fan_mode",{entity_id:t,fan_mode:n});break;case"swing_modes":e._hass.callService("climate","set_swing_mode",{entity_id:t,swing_mode:n});break;case"preset_modes":e._hass.callService("climate","set_preset_mode",{entity_id:t,preset_mode:n})}break;case"fan":"preset_modes"===o.select_attribute&&e._hass.callService("fan","set_preset_mode",{entity_id:t,preset_mode:n});break;case"light":"effect_list"===o.select_attribute&&e._hass.callService("light","turn_on",{entity_id:t,effect:n});break;case"media_player":switch(o.select_attribute){case"source_list":e._hass.callService("media_player","select_source",{entity_id:t,source:n});break;case"sound_mode_list":e._hass.callService("media_player","select_sound_mode",{entity_id:t,sound_mode:n})}break;default:console.warn(`Unsupported entity type: ${a}`)}}(e,n,a,o)}))}function B(e,t=e.elements,n=e.config.entity,o){if(t.currentState=e._hass.states[n]?.state,!t.currentState)return;if(t.currentList=n?.startsWith("input_select")||n?.startsWith("select")?e._hass.states[n].attributes.options:e._hass.states[n].attributes[o.select_attribute],t.previousList===t.currentList&&t.previousState===t.currentState)return;let a=t.currentList;for(t.currentState;t.dropdownSelect.firstChild;)t.dropdownSelect.removeChild(t.dropdownSelect.firstChild);a.forEach((a=>{const i=document.createElement("mwc-list-item");i.value=a;const r=T(e,e._hass.states[n],o.select_attribute,a);r&&(i.graphic="icon",i.appendChild(r));const s=function(e,t,n,o){switch(n){case"fan_modes":return e._hass.formatEntityAttributeValue(t,"fan_mode",o);case"hvac_modes":return e._hass.formatEntityState(t,o);case"swing_modes":return e._hass.formatEntityAttributeValue(t,"swing_mode",o);case"preset_modes":return e._hass.formatEntityAttributeValue(t,"preset_mode",o);default:return function(e){const t=e.replace(/_/g," ");return t.charAt(0).toUpperCase()+t.slice(1)}(o)}}(e,e._hass.states[n],o.select_attribute,a);i.appendChild(document.createTextNode(s)),a===function(e,t){switch(t){case"fan_modes":return e.attributes.fan_mode||null;case"swing_modes":return e.attributes.swing_mode||null;case"preset_modes":return e.attributes.preset_mode||null;case"effect_list":return e.attributes.effect||null;case"source_list":return e.attributes.source||null;case"sound_mode_list":return e.attributes.sound_mode||null;default:return e.state}}(e._hass.states[n],o.select_attribute)&&i.setAttribute("selected",""),t.dropdownSelect.appendChild(i),t.previousList=t.currentList,t.previousState=t.currentState})),t.dropdownContainer.appendChild(t.dropdownSelect)}function A(e,t){try{if(e.states[t])return e.states[t]?.state}catch{}}function I(e,t){const n=e.entity&&t.states[e.entity]?t.states[e.entity].state:"unavailable";let o=e.state??e.state_not;if(Array.isArray(o)){const e=o.map((e=>A(t,e))).filter((e=>void 0!==e));o=[...o,...e]}else if("string"==typeof o){const e=A(t,o);o=[o],e&&o.push(e)}return null!=e.state?V(o).includes(n):!V(o).includes(n)}function V(e){return void 0===e||Array.isArray(e)?e:[e]}function P(e,t){return e.every((e=>{if("condition"in e)switch(e.condition){case"screen":return!!(n=e).media_query&&matchMedia(n.media_query).matches;case"user":return function(e,t){return!(!e.users||!t.user?.id)&&e.users.includes(t.user.id)}(e,t);case"numeric_state":return function(e,t){const n=(e.entity?t.states[e.entity]:void 0)?.state;let o=e.above,a=e.below;"string"==typeof o&&(o=A(t,o)??o),"string"==typeof a&&(a=A(t,a)??a);const i=Number(n),r=Number(o),s=Number(a);return!isNaN(i)&&(null==e.above||isNaN(r)||ri)}(e,t);case"and":return function(e,t){return!e.conditions||P(e.conditions,t)}(e,t);case"or":return function(e,t){return!e.conditions||e.conditions.some((e=>P([e],t)))}(e,t);default:return I(e,t)}var n;return I(e,t)}))}function D(e){return null!=e.entity&&(null!=e.state||null!=e.state_not)}function U(e){return e.every((e=>{if("condition"in e)switch(e.condition){case"screen":return null!=e.media_query;case"user":return null!=e.users;case"numeric_state":return function(e){return null!=e.entity&&(null!=e.above||null!=e.below)}(e);case"and":case"or":return function(e){return null!=e.conditions}(e);default:return D(e)}return D(e)}))}function H(e){const t=e._hass.states[e.config.entity],o=(0,n.IL)(e,e.config.attribute,e.config.entity),a=t?.last_changed,i="state"===e.config.button_type,r=e.config.show_name??!0,s=e.config.show_icon??!0,l=e.config.show_state??i,c=e.config.show_attribute??i,d=e.config.show_last_changed??e.config.show_last_updated??!1,u=e.config.scrolling_effect??!0,b=e.previousConfig||{};if(e.previousState===t&&e.previousAttribute===o&&e.previousLastChanged===a&&b.showName===r&&b.showIcon===s&&b.showState===l&&b.showAttribute===c&&b.showLastChanged===d&&b.scrollingEffect===u)return;let p=t&&l?e._hass.formatEntityState(t):"",h="",m="",g="";var f;c&&o&&(h=t?e._hass.formatEntityAttributeValue(t,e.config.attribute)??o:""),d&&t&&(m=t?(f=(0,n.o0)(a,e._hass.locale.language)).charAt(0).toUpperCase()+f.slice(1):""),e.elements.stateStyles||(e.elements.stateStyles=(0,n.az)("style"),e.elements.stateStyles.innerText=M,e.content.appendChild(e.elements.stateStyles),"pop-up"===e.config.card_type&&e.elements.buttonContainer.appendChild(e.elements.stateStyles)),g=[p,h,m].filter((e=>e)).join(" • "),r?e.elements.name.classList.remove("hidden"):e.elements.name.classList.add("hidden"),s?(e.elements.iconContainer.classList.remove("hidden"),e.elements.nameContainer.classList.remove("name-without-icon")):(e.elements.iconContainer.classList.add("hidden"),e.elements.nameContainer.classList.add("name-without-icon")),(l||d||c)&&!r?e.elements.state.classList.add("state-without-name"):e.elements.state.classList.remove("state-without-name"),l||d||c?(e.elements.state.classList.add("display-state"),e.elements.state.classList.remove("hidden")):(e.elements.state.classList.remove("display-state"),e.elements.state.classList.add("hidden")),(0,n.GP)(e,e.elements.state,g),e.previousState=t,e.previousAttribute=o,e.previousConfig={showName:r,showIcon:s,showState:l,showAttribute:c,showLastChanged:d,scrollingEffect:u}}const M="\n .hidden {\n display: none !important;\n }\n\n .state-without-name {\n opacity: 1;\n font-size: 14px;\n }\n\n .name-without-icon {\n margin-left: 16px;\n }\n\n .display-state {\n display: flex;\n }\n";function N(e,t=e.content,o=t.firstChild.firstChild,i=!1){const r=e.config.sub_button;if(!r)return;e.previousValues=e.previousValues||{};let l=[...e.previousValues.subButtons||[]];e.elements=e.elements||{};const c=e.elements.subButtonContainer??(0,n.az)("div","bubble-sub-button-container");if(!e.elements.subButtonContainer&&e.config.sub_button){const t=(0,n.az)("style");t.innerText=j,c.appendChild(t),i?o.prepend(c):o.appendChild(c),e.elements.subButtonContainer=c}r.forEach(((t,o)=>{if(!t)return;const i=o+1,r=t.entity??e.config.entity,l=e._hass.states[r],d=t.name??(0,n.IL)(e,"friendly_name",r)??"",u=t.attribute??"",b=(0,n.IL)(e,u,r),p=(0,n.pr)(e,r);if("fan_modes"===u&&null==b)return void(e.elements[i]||(0,n.az)("div","bubble-sub-button bubble-sub-button-"+i)).classList.add("hidden");const h=t.show_name??!1,m=t.show_state??!1,g=t.show_attribute??!1,f=(t.show_last_changed||t.show_last_updated)??!1,_=t.show_icon??!0,y=t.show_background??!0,v=t.state_background??!0,w=t.light_background??!0,x=t.show_arrow??!0,k=r?.startsWith("input_select")||r?.startsWith("select")||t.select_attribute,C=(0,n.q7)(e,t.entity,t.icon??"");let $=e.elements[i]||(0,n.az)("div","bubble-sub-button bubble-sub-button-"+i);if(!e.elements[i]||k&&!$.contains($.dropdownContainer)){let o=Array.prototype.indexOf.call(c.children,$);k&&!$.contains($.dropdownContainer)&&c.contains($)&&(c.removeChild($),$=(0,n.az)("div","bubble-sub-button bubble-sub-button-"+i)),$.nameContainer=(0,n.az)("div","bubble-sub-button-name-container"),$.feedbackContainer=(0,n.az)("div","bubble-feedback-container"),$.feedback=(0,n.az)("div","bubble-feedback-element feedback-element"),$.appendChild($.feedbackContainer),$.feedbackContainer.appendChild($.feedback),k&&(z(e,$,x),$.dropdownContainer.style.display="none",E(e,$,r,t)),$.appendChild($.nameContainer),o>=0&&oe.hasAttribute("selected")))?.value;if(_&&C){let o=$.icon;if(o||(o=(0,n.az)("ha-icon","bubble-sub-button-icon"),o.classList.add("show-icon"),$.appendChild(o),$.icon=o),S){const n=T(e,l,t.select_attribute,S);n&&!t.icon?(o.tagName!==n.tagName||o.icon!==n.icon||o.attribute!==n.attribute||o.attributeValue!==n.attributeValue)&&($.replaceChild(n,o),$.icon=n,o=n):o.icon!==C&&o.setAttribute("icon",C)}else o.icon!==C&&o.setAttribute("icon",C);$.icon.classList.remove("hidden"),$.icon.classList.add("bubble-sub-button-icon","show-icon")}else $.icon&&($.icon.classList.remove("show-icon"),$.icon.classList.add("hidden"));if(y)if(p&&v){const t=(0,n.Vv)("var(--bubble-button-icon-background-color, var(--bubble-icon-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background)))))");w&&$.style.setProperty("--bubble-sub-button-light-background-color",(0,n.mk)(e,r,t?1:.8)),$.classList.add("background-on"),$.classList.remove("background-off")}else $.classList.add("background-off"),$.classList.remove("background-on");else $.classList.remove("background-on"),$.classList.remove("background-off");"none"===t.tap_action?.action&&"none"===t.double_tap_action?.action&&"none"===t.hold_action?.action||$.actionAdded||(a($,k?"":t,r,{tap_action:{action:k?"none":"more-info"},double_tap_action:{action:"none"},hold_action:{action:"none"}}),s($,$.feedback),k&&($.style.pointerEvents="auto",$.style.cursor="pointer"),$.actionAdded=!0);let L="";const O=l&&m?e._hass.formatEntityState(l):"",A=l&&""!==b&&g?e._hass.formatEntityAttributeValue(l,u)??b:"",I=l&&f?(0,n.o0)(l.last_changed,e._hass.locale.language):"";h&&""!==d&&(L+=d),""!==O&&(L+=(L?" · ":"")+O),""!==I&&(L+=(L?" · ":"")+I),""!==A&&(L+=(L?" · ":"")+A),L=L.charAt(0).toUpperCase()+L.slice(1),L||_||k?($.classList.remove("hidden"),$.nameContainer.innerText!==L&&($.nameContainer.innerText=L),_&&$.icon&&(L?($.icon.classList.add("icon-with-state"),$.icon.classList.remove("icon-without-state")):($.icon.classList.add("icon-without-state"),$.icon.classList.remove("icon-with-state"))),L||_||!k?k&&($.dropdownContainer.classList.remove("no-icon-select-container"),$.dropdownArrow.classList.remove("no-icon-select-arrow")):($.dropdownContainer.classList.add("no-icon-select-container"),$.dropdownArrow.classList.add("no-icon-select-arrow"))):($.classList.add("hidden"),$.dropdownContainer&&($.dropdownContainer.classList.remove("no-icon-select-container"),$.dropdownArrow.classList.remove("no-icon-select-arrow")));const D=t.visibility;if(null!=D){const t=V(D);U(t)&&(P(t,e._hass)?$.classList.remove("hidden"):$.classList.add("hidden"))}})),e.previousValues.subButtons=r.slice();for(let t=l.length;t>0;t--)if(t>r.length){let n=e.elements[t];n&&(c.removeChild(n),delete e.elements[t])}}const j="\n .bubble-sub-button-container {\n position: relative;\n display: flex;\n justify-content: end;\n right: 8px;\n align-content: center;\n gap: 8px;\n align-items: center;\n }\n .bubble-sub-button {\n display: flex;\n flex-wrap: nowrap;\n flex-direction: row-reverse;\n align-items: center;\n justify-content: center;\n position: relative;\n right: 0;\n box-sizing: border-box;\n width: min-content;\n min-width: 36px;\n height: 36px;\n vertical-align: middle;\n font-size: 12px;\n border-radius: var(--bubble-sub-button-border-radius, var(--bubble-border-radius, 32px));\n padding: 0 8px;\n white-space: nowrap;\n transition: all 0.5s ease-in-out;\n color: var(--primary-text-color);\n }\n .bubble-feedback-container {\n display: flex;\n width: 100%;\n height: 100%;\n position: absolute;\n border-radius: var(--bubble-sub-button-border-radius, var(--bubble-border-radius, 32px));\n overflow: hidden;\n pointer-events: none;\n }\n .bubble-sub-button-name-container {\n display: flex;\n }\n .show-icon {\n display: flex;\n --mdc-icon-size: 16px;\n }\n .background-on {\n background-color: var(--bubble-sub-button-light-background-color, var(--accent-color));\n }\n .background-off {\n background-color: var(--bubble-sub-button-background-color, var(--bubble-icon-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background)))));\n }\n .hidden {\n display: none;\n }\n .icon-with-state {\n margin-right: 4px;\n --mdc-icon-size: 16px;\n }\n .icon-without-state {\n margin-right: 0;\n --mdc-icon-size: 20px;\n }\n .no-icon-select-arrow {\n width: 28px !important;\n height: 28px !important;\n right: 2px !important; \n }\n .no-icon-select-container {\n width: 16px !important;\n }\n .bubble-dropdown-arrow {\n background: var(--bubble-select-arrow-background-color) !important;\n }\n";function q(e){Array.isArray(e.subButtonIcon)||(e.subButtonIcon=[]),"pop-up"===e.config.card_type?e.popUp.querySelectorAll(".bubble-sub-button-icon").forEach(((t,n)=>{e.subButtonIcon[n]=t})):e.content.querySelectorAll(".bubble-sub-button-icon").forEach(((t,n)=>{e.subButtonIcon[n]=t}))}function F(e){let t=e.config.button_type;return"custom"===t&&(console.error('Buttons "custom" have been removed. Use either "switch", "slider", "state" or "name"'),t=""),e.config.entity?t||"switch":t||"name"}function X(e,t){const o=e._hass.states[e.config.entity];if((0,n.OC)(e,"light"))e._hass.callService("light","turn_on",{entity_id:e.config.entity,brightness:Math.round(255*t/100)});else if((0,n.OC)(e,"media_player"))e._hass.callService("media_player","volume_set",{entity_id:e.config.entity,volume_level:(t/100).toFixed(2)});else if((0,n.OC)(e,"cover"))e._hass.callService("cover","set_cover_position",{entity_id:e.config.entity,position:Math.round(t)});else if((0,n.OC)(e,"input_number")){const a=o.attributes.min??0,i=o.attributes.max??100,r=(0,n.IL)(e,"step")??1;let s=(i-a)*t/100+a,l=Math.round(s/r)*r;e._hass.callService("input_number","set_value",{entity_id:e.config.entity,value:l})}else if((0,n.OC)(e,"fan")){const n=o.attributes.percentage_step??1;let a=Math.round(t/n)*n;e._hass.callService("fan","set_percentage",{entity_id:e.config.entity,percentage:a})}else if((0,n.OC)(e,"climate")){const n=o.attributes.min_temp??0,a=o.attributes.max_temp??1e4,i="°C"===e._hass.config.unit_system.temperature,r=o.attributes.target_temp_step?o.attributes.target_temp_step:i?.5:1;let s=(a-n)*t/100+n,l=Math.round(s/r)*r;l=parseFloat(l.toFixed(1)),e._hass.callService("climate","set_temperature",{entity_id:e.config.entity,temperature:l})}else if((0,n.OC)(e,"number")){const n=o.attributes.min??0,a=o.attributes.max??100,i=o.attributes.step??1;let r=(a-n)*t/100+n,s=Math.round(r/i)*i;e._hass.callService("number","set_value",{entity_id:e.config.entity,value:s})}}function W(e,t){const n=e.elements.rangeSlider.getBoundingClientRect(),o=100*(t-n.left)/n.width,a=Math.min(100,Math.max(0,o));return e.elements.rangeFill.style.transform=`translateX(${a}%)`,a}const R="\n * {\n -webkit-tap-highlight-color: transparent !important;\n -ms-overflow-style: none; /* for Internet Explorer, Edge */\n scrollbar-width: none; /* for Firefox */\n }\n *::-webkit-scrollbar {\n display: none; /* for Chrome, Safari, and Opera */\n }\n ha-card {\n margin-top: 0;\n background: none;\n opacity: 1;\n }\n .is-unavailable {\n opacity: 0.5;\n }\n\n .bubble-button-card-container {\n position: relative;\n width: 100%;\n height: 50px;\n background-color: var(--bubble-button-main-background-color, var(--bubble-main-background-color, var(--background-color-2, var(--secondary-background-color))));\n border-radius: var(--bubble-button-border-radius, var(--bubble-border-radius, 32px));\n box-shadow: var(--bubble-button-box-shadow, var(--bubble-box-shadow, none));\n overflow: scroll;\n touch-action: pan-y;\n }\n\n .bubble-button-card,\n .bubble-range-slider,\n .bubble-button-background {\n display: flex;\n position: absolute;\n justify-content: space-between;\n align-items: center;\n height: 100%;\n width: 100%;\n transition: background-color 1.5s;\n }\n .bubble-button-background {\n background-color: var(--bubble-button-background-color);\n opacity: .5;\n border-radius: var(--bubble-button-border-radius, var(--bubble-border-radius, 32px));\n }\n .bubble-range-fill {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n width: 100%;\n left: -100%;\n transition: all .3s;\n z-index: 0;\n }\n .is-dragging .bubble-range-fill {\n transition: none;\n }\n .is-light .bubble-range-fill {\n opacity: 0.5;\n }\n .is-unavailable .bubble-button-card,\n .is-unavailable .bubble-range-slider {\n cursor: not-allowed;\n }\n .bubble-range-slider {\n cursor: ew-resize;\n border-radius: var(--bubble-button-border-radius, var(--bubble-border-radius, 32px));\n overflow: hidden;\n mask-image: radial-gradient(white, black);\n -webkit-mask-image: -webkit-radial-gradient(white, black);\n }\n .bubble-icon-container {\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n justify-content: center;\n min-width: 38px;\n min-height: 38px;\n margin: 6px;\n border-radius: var(--bubble-button-icon-border-radius, var(--bubble-icon-border-radius, var(--bubble-border-radius, 50%)));\n background-color: var(--bubble-button-icon-background-color, var(--bubble-icon-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background)))));\n overflow: hidden;\n position: relative;\n cursor: pointer;\n }\n\n .bubble-icon {\n display: flex;\n opacity: 0.6;\n }\n\n .is-on .bubble-icon {\n filter: brightness(1.1);\n opacity: 1;\n }\n\n .bubble-entity-picture {\n background-size: cover;\n background-position: center;\n height: 100%;\n width: 100%;\n position: absolute;\n }\n\n .bubble-name,\n .bubble-state {\n display: flex;\n position: relative;\n white-space: nowrap;\n }\n\n .bubble-name-container {\n display: flex;\n line-height: 18px;\n flex-direction: column;\n justify-content: center;\n flex-grow: 1;\n margin: 0 16px 0 4px;\n pointer-events: none;\n position: relative;\n overflow: hidden;\n }\n\n .bubble-name {\n font-size: 13px;\n font-weight: 600;\n }\n\n .bubble-state {\n font-size: 12px;\n font-weight: normal;\n opacity: 0.7;\n }\n\n .bubble-feedback-element {\n position: absolute;\n top: 0;\n left: 0;\n opacity: 0;\n width: 100%;\n height: 100%;\n background-color: rgb(0,0,0);\n pointer-events: none;\n }\n\n @keyframes tap-feedback {\n 0% {transform: translateX(-100%); opacity: 0;}\n 64% {transform: translateX(0); opacity: 0.1;}\n 100% {transform: translateX(100%); opacity: 0;}\n }\n\n .large .bubble-button-card-container {\n height: 56px;\n border-radius: var(--bubble-button-border-radius, var(--bubble-border-radius, 32px));\n }\n\n .large .bubble-icon-container {\n --mdc-icon-size: 24px;\n min-width: 42px !important;\n min-height: 42px !important;\n margin-left: 8px;\n }\n\n .rows-2 .bubble-sub-button-container {\n flex-direction: column;\n gap: 4px !important;\n display: grid !important;\n grid-template-columns: repeat(2, min-content);\n grid-template-rows: repeat(2, 1fr);\n grid-auto-flow: column;\n width: auto;\n padding-right: 14px;\n }\n\n .rows-2 .bubble-sub-button {\n height: 20px !important;\n }\n";function Y(e,t=e.content,o=t){const i=F(e);e.cardType!==`button-${i}`&&e.buttonType!==i&&(function(e,t=e.content,o=t){const a=F(e);e.dragging=!1,e.elements||(e.elements={}),e.elements.buttonCardContainer=(0,n.az)("div","bubble-button-card-container button-container"),e.elements.buttonCard=(0,n.az)("div","bubble-button-card switch-button"),e.elements.buttonBackground=(0,n.az)("div","bubble-button-background"),e.elements.nameContainer=(0,n.az)("div","bubble-name-container name-container"),e.elements.iconContainer=(0,n.az)("div","bubble-icon-container icon-container"),e.elements.name=(0,n.az)("div","bubble-name name"),e.elements.state=(0,n.az)("div","bubble-state state"),e.elements.feedback=(0,n.az)("div","bubble-feedback-element feedback-element"),e.elements.icon=(0,n.az)("ha-icon","bubble-icon icon"),e.elements.image=(0,n.az)("div","bubble-entity-picture entity-picture"),e.elements.style=(0,n.az)("style"),e.elements.customStyle=(0,n.az)("style"),e.elements.feedback.style.display="none",e.elements.style.innerText=R,e.elements.iconContainer.appendChild(e.elements.icon),e.elements.iconContainer.appendChild(e.elements.image),e.elements.nameContainer.appendChild(e.elements.name),"name"!==a&&e.elements.nameContainer.appendChild(e.elements.state),e.elements.buttonCard.appendChild(e.elements.buttonBackground),e.elements.buttonCard.appendChild(e.elements.iconContainer),e.elements.buttonCard.appendChild(e.elements.nameContainer),e.elements.buttonCard.appendChild(e.elements.feedback),e.elements.buttonCardContainer.appendChild(e.elements.buttonCard),t.innerHTML="",o===t&&t.appendChild(e.elements.buttonCardContainer),t.appendChild(e.elements.style),t.appendChild(e.elements.customStyle),o!==t?(o.innerHTML="",e.elements.buttonCardContainer.appendChild(t),o.appendChild(e.elements.buttonCardContainer),e.buttonType=a):e.cardType=`button-${a}`}(e,t,o),"switch"===i?function(e){a(e.elements.iconContainer,e.config),a(e.elements.buttonBackground,e.config.button_action,e.config.entity,{tap_action:{action:"toggle"},double_tap_action:{action:"toggle"},hold_action:{action:"more-info"}}),s(e.elements.buttonBackground,e.elements.feedback)}(e):"slider"===i?function(e){a(e.elements.iconContainer,e.config);let t=0,o=null;e.elements.rangeFill=(0,n.az)("div","bubble-range-fill range-fill"),e.elements.rangeSlider=(0,n.az)("div","bubble-range-slider range-slider"),e.elements.rangeSlider.appendChild(e.elements.rangeFill),e.elements.buttonCardContainer.appendChild(e.elements.rangeSlider),e.elements.buttonCardContainer.insertBefore(e.elements.rangeSlider,e.elements.buttonCard),e.elements.buttonCard.style.cursor="ew-resize",e.elements.buttonCardContainer.addEventListener("pointercancel",(function(){clearTimeout(o),e.dragging=!1,e.elements.buttonCardContainer.classList.remove("is-dragging"),e.elements.buttonCardContainer.removeEventListener("pointermove",r),window.removeEventListener("pointerup",s)})),e.elements.buttonCardContainer.addEventListener("pointerdown",(n=>{n.target.closest(".bubble-action")||(e.elements.buttonCardContainer.setPointerCapture(n.pointerId),e.card.classList.contains("is-unavailable")||(e.dragging=!0,t=n.pageX||(n.touches?n.touches[0].pageX:0),e.elements.buttonCardContainer.classList.add("is-dragging"),e.elements.buttonCardContainer.addEventListener("pointermove",r),window.addEventListener("pointerup",s)))}));const i=(0,n.P2)(X,200);function r(t){if(t.stopPropagation(),t.target.closest(".bubble-action"))return;const n=t.pageX||(t.touches?t.touches[0].pageX:0),o=W(e,n);e.config.slider_live_update&&i(e,o)}function s(t){t.stopPropagation(),clearTimeout(o),o=setTimeout((()=>{e.dragging=!1}),1400);const a=t.pageX||(t.touches?t.touches[0].pageX:0),i=W(e,a);e.config.slider_live_update||X(e,i),(0,n.jk)("selection"),e.elements.buttonCardContainer.classList.remove("is-dragging"),e.elements.buttonCardContainer.removeEventListener("pointermove",r),window.removeEventListener("pointerup",s)}}(e):"state"===i?function(e){a(e.elements.buttonCardContainer,e.config),a(e.elements.buttonBackground,e.config.button_action,e.config.entity,{tap_action:{action:"more-info"},double_tap_action:{action:"more-info"},hold_action:{action:"more-info"}}),s(e.elements.buttonBackground,e.elements.feedback)}(e):"name"===i&&function(e){const t={tap_action:{action:"none"},double_tap_action:{action:"none"},hold_action:{action:"none"}};a(e.elements.iconContainer,e.config,e.config.entity,t),a(e.elements.buttonBackground,e.config.button_action,e.config.entity,t),s(e.elements.buttonBackground,e.elements.feedback)}(e)),"name"!==i&&(function(e){const t=(0,n.y0)(e),o=e.config.card_type;"unavailable"===t?"button"===o?e.card.classList.add("is-unavailable"):"pop-up"===o&&e.elements.headerContainer.classList.add("is-unavailable"):"button"===o?e.card.classList.remove("is-unavailable"):"pop-up"===o&&e.elements.headerContainer.classList.remove("is-unavailable"),(0,n.pr)(e)?"button"===o?e.card.classList.add("is-on"):"pop-up"===o&&e.elements.headerContainer.classList.add("is-on"):"button"===o?e.card.classList.remove("is-on"):"pop-up"===o&&e.elements.headerContainer.classList.remove("is-on")}(e),function(e){const t=e.config.card_type,o=F(e),a=(0,n.OC)(e,"light"),i=(0,n.pr)(e),r=(0,n.mk)(e),s="button"===t?e.card.style.getPropertyValue("--bubble-button-background-color"):e.popUp.style.getPropertyValue("--bubble-button-background-color"),l=e.elements.buttonBackground.style.opacity;let c="",d="";"switch"===o&&i?r&&a?(c=(0,n.mk)(e),d=".5"):(c="var(--bubble-button-accent-color, var(--bubble-accent-color, var(--accent-color)))",d="1"):(c="rgba(0, 0, 0, 0)",d=".5"),s!==c&&("button"===t?e.card.style.setProperty("--bubble-button-background-color",c):"pop-up"===t&&e.popUp.style.setProperty("--bubble-button-background-color",c)),l!==d&&(e.elements.buttonBackground.style.opacity=d)}(e),function(e){if("slider"===F(e)){if(e.elements.rangeFill.style.backgroundColor=(0,n.mk)(e),e.dragging)return;let t=0;if((0,n.OC)(e,"light"))t=100*(0,n.IL)(e,"brightness")/255;else if((0,n.OC)(e,"media_player"))t=(0,n.pr)(e)?100*(0,n.IL)(e,"volume_level"):0;else if((0,n.OC)(e,"cover"))t=(0,n.IL)(e,"current_position");else if((0,n.OC)(e,"input_number")){const o=(0,n.IL)(e,"min"),a=(0,n.IL)(e,"max");t=100*((0,n.y0)(e)-o)/(a-o)}else if((0,n.OC)(e,"fan"))t=(0,n.pr)(e)?(0,n.IL)(e,"percentage"):0;else if((0,n.OC)(e,"climate")){const o=(0,n.IL)(e,"min_temp"),a=(0,n.IL)(e,"max_temp");t=100*((0,n.IL)(e,"temperature")-o)/(a-o)}else if((0,n.OC)(e,"number")){const o=(0,n.IL)(e,"min"),a=(0,n.IL)(e,"max");t=100*((0,n.y0)(e)-o)/(a-o)}e.elements.rangeFill.style.transform=`translateX(${t}%)`}}(e)),function(e){const t=F(e),o="name"!==t&&(0,n.pr)(e),a="name"!==t?(0,n.q7)(e):e.config.icon,i="name"!==t?(0,n.gJ)(e):"",r="name"!==t&&(0,n.OC)(e,"light"),s=e.elements.iconContainer.style.color,l=e.elements.image.style.backgroundImage,c=e.elements.icon.icon,d=e.elements.icon.style.display,u=e.elements.image.style.display;if(r&&o){const t=`var(--bubble-icon-background-color, ${(0,n.mk)(e)})`;s!==t&&(e.elements.iconContainer.style.color=t)}else""!==s&&(e.elements.iconContainer.style.color="");if(""!==i){const t="url("+i+")";l!==t&&(e.elements.image.style.backgroundImage=t),"none"!==d&&(e.elements.icon.style.display="none"),""!==u&&(e.elements.image.style.display="")}else if(""!==a){c!==a&&(e.elements.icon.icon=a);const i=o&&"state"!==t?(0,n.mk)(e):"inherit";e.elements.icon.style.color!==i&&(e.elements.icon.style.color=i),""!==d&&(e.elements.icon.style.display=""),"none"!==u&&(e.elements.image.style.display="none")}else"none"!==d&&(e.elements.icon.style.display="none"),"none"!==u&&(e.elements.image.style.display="none")}(e),H(e),N(e,t,e.elements.buttonCard),"pop-up"!==e.cardType&&function(e){if(q(e),(0,n.jx)(e),!e.config.styles)return;const t=(0,n.y0)(e);let o="";try{o=e.config.styles?Function("hass","entity","state","icon","subButtonIcon","getWeatherIcon","card","name",`return \`${e.config.styles}\`;`)(e._hass,e.config.entity,t,e.elements.icon,e.subButtonIcon,n.X,e.card,e.card.name):""}catch(e){throw new Error(`Error in generating button custom templates: ${e.message}`)}e.elements.customStyle&&(e.elements.customStyle.innerText=o)}(e),function(e){if(e.config.styles?.includes("card.querySelector('.bubble-name').innerText"))return;const t="name"!==F(e)?(0,n.oY)(e):e.config.name;t!==e.elements.previousName&&((0,n.GP)(e,e.elements.name,t),e.elements.previousName=t)}(e)}async function J(e){if("pop-up"!==e.cardType){if(e.getRootNode()instanceof ShadowRoot==0)return;!function(e){try{e.cardType="pop-up",e.verticalStack=e.getRootNode(),e.sectionRow=e.verticalStack.host.parentElement,e.sectionRowContainer=e.sectionRow?.parentElement,e.popUp=e.verticalStack.querySelector("#root"),e.popUp.classList.add("bubble-pop-up","pop-up","is-popup-closed"),e.editor||e.config.background_update||e.verticalStack.removeChild(e.popUp),e.elements={},L(e),e.cardTitle&&(e.cardTitle.style.display="none"),k=k||(e.config.hide_backdrop??!0),e.popUp.style.setProperty("--custom-height-offset-desktop",e.config.margin_top_desktop??"0px"),e.popUp.style.setProperty("--custom-height-offset-mobile",e.config.margin_top_mobile??"0px"),e.popUp.style.setProperty("--custom-margin",`-${e.config.margin??"7px"}`),e.popUp.style.setProperty("--custom-popup-filter",e.config.backdrop_blur&&"0"!==e.config.backdrop_blur?"none":`blur(${e.config.bg_blur??10}px)`),e.popUp.style.setProperty("--custom-shadow-opacity",(e.config.shadow_opacity??0)/100);const t=function(e){return()=>{e.config.hash===location.hash?(l=!0,setTimeout((()=>{l=!1}),100),function(e){e.popUp.classList.contains("is-popup-opened")||(f(e),p(e,!0),requestAnimationFrame((()=>{b(e,!0),h(e.popUp,!0),function(e){const{sectionRow:t,sectionRowContainer:n,popUp:o}=e;o.style.transform="","hui-card"===t?.tagName.toLowerCase()&&(t.hidden=!1,t.style.display="",n?.classList.contains("card")&&(n.style.display=""))}(e)})),m(e,!0),e.config.auto_close>0&&(e.closeTimeout=setTimeout(c,e.config.auto_close)),g("hidden"),e.config.open_action&&o(e.popUp,e.config,"open_action"))}(e)):function(e){e.popUp.classList.contains("is-popup-opened")&&(f(e),h(e.popUp,!1),b(e,!1),e.removeDomTimeout=setTimeout((()=>{p(e,!1),u(e,0)}),300),m(e,!1),g(""),e.config.close_action&&o(e,e.config,"close_action"))}(e)}}(e);window.addEventListener("location-changed",t),window.addEventListener("popstate",t)}catch(e){console.error(e)}}(e),function(e){e.elements={closeIcon:(0,n.az)("ha-icon","bubble-close-icon"),closeButton:(0,n.az)("button","bubble-close-button close-pop-up"),buttonContainer:(0,n.az)("div","bubble-button-container"),header:(0,n.az)("div","bubble-header")},e.elements.closeIcon.icon="mdi:close",e.elements.closeButton.appendChild(e.elements.closeIcon),e.elements.closeButton.addEventListener("click",(()=>{c(),(0,n.jk)("selection")}));const t=e.popUp.querySelector(".bubble-header-container");t?Object.assign(e.elements,{headerContainer:t,closeIcon:t.querySelector(".bubble-close-icon"),closeButton:t.querySelector(".bubble-close-button"),buttonContainer:t.querySelector(".bubble-button-container"),header:t.querySelector(".bubble-header")}):(e.elements.headerContainer=(0,n.az)("div","bubble-header-container"),e.elements.headerContainer.setAttribute("id","header-container"),e.elements.headerContainer.appendChild(e.elements.header),e.elements.headerContainer.appendChild(e.elements.closeButton),e.elements.header.appendChild(e.elements.buttonContainer)),e.popUp.addEventListener("touchstart",(e=>{v=e.touches[0].clientY}),{passive:!0}),e.elements.header.addEventListener("touchmove",(t=>{const n=t.touches[0].clientY-v;n>0&&(e.popUp.style.transform=`translateY(${n}px)`)}),{passive:!0}),e.elements.header.addEventListener("touchend",(t=>{t.changedTouches[0].clientY-v>50?c():e.popUp.style.transform=""}),{passive:!0})}(e),function(e){try{e.elements.style=(0,n.az)("style"),e.elements.style.innerText="\n .bubble-pop-up-container {\n display: flex;\n flex-direction: column;\n height: 100%;\n margin-top: -50px;\n max-width: 100%;\n padding-top: 40px;\n padding-bottom: 80px;\n grid-gap: 14px;\n gap: 14px;\n column-gap: 14px;\n --grid-gap: 14px;\n --vertical-stack-card-gap: 14px;\n --horizontal-stack-card-gap: 14px;\n --stack-card-gap: 14px;\n -ms-overflow-style: none; /* for Internet Explorer, Edge */\n scrollbar-width: none; /* for Firefox */\n overflow-y: auto; \n overflow-x: hidden; \n grid-auto-rows: min-content;\n mask-image: linear-gradient(to bottom, transparent 0px, black 24px, black calc(100% - 40px), transparent 100%);\n -webkit-mask-image: linear-gradient(to bottom, transparent 0px, black 24px, black calc(100% - 40px), transparent 100%);\n padding: 18px 18px calc(140px + var(--custom-height-offset-mobile)) 18px;\n }\n .bubble-pop-up-container > * {\n flex-shrink: 0 !important;\n }\n .bubble-pop-up.card-content {\n width: 100% !important;\n padding: 0 !important;\n }\n .bubble-pop-up {\n transition: transform 0.3s ease;\n position: fixed;\n width: 100%;\n max-width: 100%;\n border-radius: var(--bubble-pop-up-border-radius, var(--bubble-border-radius, 42px)) var(--bubble-pop-up-border-radius, var(--bubble-border-radius, 42px)) 0 0;\n box-sizing: border-box;\n margin-left: var(--custom-margin);\n left: 7px;\n z-index: 5 !important;\n bottom: calc(-56px - var(--custom-height-offset-mobile));\n }\n .bubble-pop-up-background {\n width: 100%;\n height: 100%;\n display: flex;\n top: 0;\n left: 0;\n position: absolute;\n background-color: var(--bubble-pop-up-main-background-color, var(--bubble-pop-up-background-color, var(--bubble-secondary-background-color, var(--background-color, var(--secondary-background-color)))));\n border-radius: var(--bubble-pop-up-border-radius, var(--bubble-border-radius, 42px)) var(--bubble-pop-up-border-radius, var(--bubble-border-radius, 42px)) 0 0;\n backdrop-filter: var(--custom-popup-filter);\n -webkit-backdrop-filter: var(--custom-popup-filter);\n }\n .bubble-pop-up-container::-webkit-scrollbar {\n display: none; /* for Chrome, Safari, and Opera */\n }\n .is-popup-opened {\n box-shadow: 0px 0px 50px rgba(0, 0, 0, var(--custom-shadow-opacity));\n }\n .is-popup-closed { \n transform: translateY(100%);\n box-shadow: none !important;\n }\n\n @media only screen and (min-width: 600px) {\n .bubble-pop-up {\n margin-left: 0 !important;\n bottom: calc(-56px - var(--custom-height-offset-desktop));\n min-width: var(--desktop-width, 540px);\n max-width: var(--desktop-width, 540px);\n left: calc(50% - (var(--desktop-width, 540px) / 2));\n }\n .bubble-pop-up-container {\n padding: 18px 18px calc(140px + var(--custom-height-offset-desktop)) 18px;\n }\n }\n @media only screen and (min-width: 768px) {\n .bubble-pop-up {\n left: calc(var(--mdc-drawer-width, 0px) / 2 + 50% - (var(--desktop-width, 540px) / 2));\n }\n }\n .bubble-pop-up.editor {\n transition: none !important;\n position: relative !important;\n top: 0;\n left: 0;\n width: 100% !important;\n backdrop-filter: none !important;\n display: flex !important;\n transform: none !important;\n height: auto !important;\n min-width: auto;\n z-index: 0 !important;\n }\n .bubble-header-container {\n display: inline-flex;\n height: 50px;\n margin: 0;\n padding: 0;\n z-index: 3;\n padding: 18px 18px 22px;\n position: sticky;\n top: 0;\n background: none !important;\n overflow: visible;\n }\n .bubble-header {\n display: inline-flex;\n flex-grow: 1;\n margin-right: 14px;\n color: var(--primary-text-color);\n }\n .bubble-name {\n font-size: 14px;\n font-weight: heavy;\n }\n .bubble-close-button {\n height: 50px;\n width: 50px;\n border: none;\n border-radius: var(--bubble-pop-up-border-radius, var(--bubble-border-radius, 42px));\n z-index: 1;\n background: var(--bubble-pop-up-main-background-color, var(--bubble-secondary-background-color, var(--background-color, var(--secondary-background-color))));\n color: var(--primary-text-color);\n flex-shrink: 0;\n cursor: pointer;\n }\n .bubble-button-card-container {\n background: var(--bubble-pop-up-main-background-color, var(--bubble-secondary-background-color, var(--background-color, var(--secondary-background-color))));\n }\n .bubble-pop-up-container.editor-cropped {\n height: 122px !important;\n mask-image: linear-gradient(to bottom, transparent 0px, black 40px, black calc(100% - 40px), transparent 100%) !important;\n -webkit-mask-image: linear-gradient(to bottom, transparent 0px, black 40px, black calc(100% - 40px), transparent 100%) !important; \n }\n .bubble-pop-up.editor > .bubble-pop-up-container {\n padding-bottom: 18px !important;\n mask-image: none;\n -webkit-mask-image: none; \n overflow: hidden; \n }\n .editor .bubble-pop-up-background {\n width: 100%;\n height: 100%;\n left: 0px;\n top: 0px;\n z-index: -1;\n display: flex;\n position: absolute;\n background-color: var(--bubble-pop-up-main-background-color, var(--bubble-pop-up-background-color, var(--bubble-secondary-background-color, var(--background-color, var(--secondary-background-color)))));\n border-radius: var(--bubble-pop-up-border-radius, var(--bubble-border-radius, 42px)) var(--bubble-pop-up-border-radius, var(--bubble-border-radius, 42px)) !important;\n backdrop-filter: none;\n -webkit-backdrop-filter: none;\n }\n\n .no-header .bubble-header-container {\n visibility: hidden !important;\n height: 0px !important;\n }\n .no-header .bubble-pop-up-container {\n padding-top: 4px !important;\n mask-image: linear-gradient(to bottom, transparent 0px, black 24px, black calc(100% - 24px), transparent 100%) !important;\n -webkit-mask-image: linear-gradient(to bottom, transparent 0px, black 24px, black calc(100% - 24px), transparent 100%) !important;\n }\n\n .large .bubble-button-card-container {\n height: 56px;\n border-radius: var(--bubble-button-border-radius, var(--bubble-border-radius, 36px));\n }\n .large .bubble-pop-up-container {\n margin-top: -36px;\n }\n .large .bubble-icon-container {\n --mdc-icon-size: 24px;\n min-width: 42px !important;\n min-height: 42px !important;\n margin-left: 8px;\n }\n .large .bubble-close-button {\n height: 56px;\n width: 56px;\n border: none;\n border-radius: var(--bubble-pop-up-border-radius, var(--bubble-border-radius, 42px));\n z-index: 1;\n --mdc-icon-size: 28px !important;\n }\n\n .rows-2 .bubble-sub-button-container {\n flex-direction: column;\n gap: 4px !important;\n display: grid !important;\n grid-template-columns: repeat(2, min-content);\n grid-template-rows: repeat(2, 1fr);\n grid-auto-flow: column;\n width: auto;\n padding-right: 14px;\n }\n .rows-2 .bubble-sub-button {\n height: 20px !important;\n }\n";let o,a=e.popUp.querySelector("style");e.stylesAdded&&a?e.elements.customStyle=a:(e.elements.customStyle=(0,n.az)("style"),e.popUp.appendChild(e.elements.customStyle),e.popUp.appendChild(e.elements.style),e.stylesAdded=!0);const i=e.config.bg_opacity??88;function r(){o=getComputedStyle(document.body).getPropertyValue("--ha-card-background")||getComputedStyle(document.body).getPropertyValue("--card-background-color");const n=e.config.bg_color?e.config.bg_color:o,a=(0,t._k)(n,i/100,1.02);e.popUp.style.setProperty("--bubble-pop-up-background-color",a)}C.addEventListener("change",(()=>{r()}),{passive:!0}),r(),e.popUp.style.setProperty("--desktop-width",e.config.width_desktop??"540px"),e.config.close_on_click&&e.popUp.addEventListener("click",c,{passive:!0}),window.addEventListener("keydown",(t=>{"Escape"===t.key&&e.config.hash===location.hash&&c()}),{passive:!0});let s=e.config.slide_to_close_distance??400;e.popUp.addEventListener("touchmove",(e=>{e.touches[0].clientY-v>s&&e.touches[0].clientY>w&&c(),w=e.touches[0].clientY}),{passive:!0});const l=e.popUp.querySelector(".bubble-pop-up-container");if(null===l){e.elements.popUpContainer=(0,n.az)("div"),e.elements.popUpContainer.classList.add("bubble-pop-up-container");let d=e.popUp.firstChild;for(;d;)e.elements.popUpContainer.appendChild(d),d=e.popUp.firstChild}else e.elements.popUpContainer=l;e.popUpBackground=(0,n.az)("div","bubble-pop-up-background"),e.popUp.appendChild(e.popUpBackground),e.popUp.appendChild(e.elements.headerContainer),e.popUp.appendChild(e.elements.popUpContainer),e.config.hash!==location.hash&&u(e,0),window.dispatchEvent(new Event("location-changed"))}catch(b){console.error(b)}}(e)}else e.popUp&&e.elements&&(e.config.hash!==location.hash&&e.config===e.previousConfig||((e.config.entity||e.config.name)&&Y(e,e.elements.buttonContainer,e.elements.header),requestAnimationFrame((()=>{!function(e){q(e);const t=e.config.card_layout,o="large"===t||"large-2-rows"===t,a="large-2-rows"===t;o!==e.popUp.classList.contains("large")&&e.popUp.classList.toggle("large",o),a!==e.popUp.classList.contains("rows-2")&&e.popUp.classList.toggle("rows-2",a);const i=e.config.show_header??!0;if(e.popUp.classList.contains("no-header")===i&&e.popUp.classList.toggle("no-header",!i),!e.config.styles)return;const r=(0,n.y0)(e),{backdropCustomStyle:s}=L(e);let l="";try{l=e.config.styles?Function("hass","entity","state","icon","subButtonIcon","getWeatherIcon","card",`return \`${e.config.styles}\`;`)(e._hass,e.config.entity,r,e.elements.icon,e.subButtonIcon,n.X,e.popUp):""}catch(e){throw new Error(`Error in generating pop-up custom templates: ${e.message}`)}e.elements.customStyle&&(e.elements.customStyle.innerText=l),s.innerText=l}(e)})),e.previousConfig=e.config),e.editor||function(e){const t=e.config.trigger;if(t){const n=!e.hasPageLoaded;e.hasPageLoaded=!0;const o=V(t);if(U(o)){const t=P(o,e._hass);if(t===e.previousTrigger)return;e.config.hash===location.hash?t||n||c():t&&d(e.config.hash),e.previousTrigger=t}}else{let t=e.config.trigger_entity??"";if(""===t)return;let n=e.config.trigger_state??"",o=e.config.trigger_close??!1,a=e._hass.states[t]?.state;if(!t)return;if(!n)return;if(e.oldTriggerEntityState===a)return;const i=!e.hasPageLoaded;e.hasPageLoaded=!0,e.config.hash===location.hash?o&&n!==a&&(i||c()):a===n&&d(e.config.hash),e.oldTriggerEntityState=a}}(e),function(e){if(!e.verticalStack)return;const{host:t}=e.verticalStack,{popUp:n,sectionRow:o,sectionRowContainer:a,elements:i}=e,r=e._cachedDetectedEditor??=t?.closest("hui-card-preview")||t?.closest("hui-card[preview][class]")||t?.getRootNode().host?.closest("hui-section[preview][class]"),s=n?.classList.contains("is-popup-opened"),l="hui-card"===o?.tagName.toLowerCase();if(e.previousEditorState??=null,e.previousDetectedEditor??=null,!s&&l){const{editor:t,editorAccess:n}=e;t||!n||r||o?.hasAttribute("hidden")?a?.classList.contains("card")&&t&&"none"===a.style.display&&(a.style.display=""):(o.setAttribute("hidden",""),o.style.display="none")}const c=n?.classList;if(e.editor||r){c?.contains("editor")||(document.body.style.overflow="",c?.remove("is-popup-opened"),c?.add("is-popup-closed","editor")),e.editorAccess=!0;const t=null===r;i?.popUpContainer?.classList.contains("editor-cropped")!==t&&i.popUpContainer.classList.toggle("editor-cropped",t)}else c?.contains("editor")&&c.remove("editor"),i?.popUpContainer?.classList.remove("editor-cropped");e.editor===e.previousEditorState&&r===e.previousDetectedEditor||(function(e){const{hideBackdrop:t}=L(e),n=e.verticalStack.host,o=n?.closest("hui-card-preview");(e.editor||o)&&(t(),clearTimeout(e.removeDomTimeout),o||e.verticalStack.contains(e.popUp)||e.verticalStack.appendChild(e.popUp))}(e),e.previousEditorState=e.editor,e.previousDetectedEditor=r)}(e))}let G=!1;function K(e,t){const o=e.config[`${t}_name`]??"",a=e.config[`${t}_icon`]??"",i=e.config[`${t}_pir_sensor`],r=e.config[`${t}_link`],s=e.config[`${t}_entity`];G=G||location.hash===r;const l=(0,n.az)("ha-icon","bubble-icon icon");l.icon=a;const u=(0,n.az)("div","bubble-name name");u.innerText=o;const b=(0,n.az)("div","bubble-background-color background-color"),p=(0,n.az)("div","bubble-background background"),h=(0,n.az)("div",`bubble-button bubble-button-${t} button ${r.substring(1)}`);let m=localStorage.getItem(`bubbleButtonWidth-${r}`);return h.style.width=`${m}px`,h.appendChild(l),h.appendChild(u),h.appendChild(b),h.appendChild(p),h.addEventListener("click",(()=>{location.hash!==r&&(G=!1),G?c():d(r),G=!G,(0,n.jk)("light")})),h.icon=l,h.name=u,h.backgroundColor=b,h.background=p,h.pirSensor=i,h.lightEntity=s,h.link=r,h.index=t,window.addEventListener("location-changed",(function(){e.config.highlight_current_view&&(location.pathname===r||location.hash===r?h.classList.add("highlight"):h.classList.remove("highlight"))})),e.elements.buttons.push(h),h}const Z=1,Q=2,ee=8;function te(e,t){return function(e,t){return!(!e||void 0===e.supported_features)&&0!=(e.supported_features&t)}(e.attributes,t)}function ne(e,t){(0,n.OC)(e,"media_player")&&e._hass.callService("media_player","volume_set",{entity_id:e.config.entity,volume_level:(t/100).toFixed(2)})}function oe(e,t,n=!1){const o=e.elements.rangeSlider.getBoundingClientRect(),a=100*(t-o.left)/o.width,i=Math.round(Math.min(100,Math.max(0,a)));if(e.elements.rangeFill.style.transform=`translateX(${i}%)`,n){if(e.dragging)return;ne(e,i)}else ne(e,i)}(0,n.P2)(ne);const ae="\n * {\n -webkit-tap-highlight-color: transparent !important;\n }\n\n ha-card {\n margin-top: 0;\n background: none;\n opacity: 1;\n overflow: visible !important;\n }\n .is-unavailable {\n opacity: 0.5;\n }\n\n .bubble-media-player-container {\n position: relative;\n width: 100%;\n height: 50px;\n background-color: var(--bubble-media-player-main-background-color, var(--bubble-main-background-color, var(--background-color-2, var(--secondary-background-color))));\n touch-action: pan-y;\n border-radius: var(--bubble-media-player-border-radius, var(--bubble-border-radius, 32px));\n box-shadow: var(--bubble-media-player-box-shadow, var(--bubble-box-shadow, none));\n }\n\n .bubble-media-player {\n display: flex;\n position: absolute;\n justify-content: space-between;\n align-items: center;\n height: 100%;\n width: 100%;\n transition: background-color 1.5s;\n border-radius: var(--bubble-media-player-border-radius, var(--bubble-border-radius, 32px));\n background-color: rgba(0,0,0,0);\n }\n\n .bubble-button-container {\n display: inline-grid;\n grid-auto-flow: column;\n gap: 10px;\n align-self: center;\n margin-right: 8px;\n }\n\n .bubble-play-pause-button,\n .bubble-previous-button,\n .bubble-next-button,\n .bubble-volume-button,\n .bubble-power-button {\n background: none;\n border: none;\n cursor: pointer;\n border-radius: var(--bubble-media-player-buttons-border-radius, var(--bubble-border-radius, 32px));\n padding: 6px;\n height: 24px;\n width: 24px;\n transition: background 0.3s ease;\n align-self: center;\n }\n\n .bubble-play-pause-button {\n background-color: var(--bubble-accent-color, var(--accent-color));\n }\n\n .bubble-volume-slider {\n position: absolute;\n width: calc(100% - 150px);\n height: 38px;\n left: 50px;\n overflow: hidden;\n border-radius: var(--bubble-media-player-border-radius, var(--bubble-border-radius, 32px));\n z-index: 1;\n background-color: var(--bubble-media-player-slider-background-color, var(--bubble-icon-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background)))));\n opacity: 1;\n transition: opacity .2s, transform .2s;\n transform: translateX(0);\n }\n\n .bubble-range-value {\n display: flex;\n justify-content: flex-end;\n height: 38px;\n align-items: center;\n padding-right: 14px;\n font-size: 12px;\n opacity: 0.8;\n }\n\n .bubble-mute-button {\n opacity: 1;\n transition: opacity .2s, transform .2s;\n transform: translateX(0);\n }\n\n .is-hidden {\n opacity: 0 !important;\n pointer-events: none;\n transform: translateX(14px);\n }\n\n .bubble-range-fill {\n z-index: -1;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n width: 100%;\n left: -100%;\n transition: all .3s;\n background-color: var(--accent-color);\n }\n\n .is-dragging .bubble-range-fill {\n transition: none;\n }\n\n .is-light .bubble-range-fill {\n opacity: 0.5;\n }\n\n .is-unavailable .bubble-button-card {\n cursor: not-allowed;\n }\n\n .bubble-range-slider {\n cursor: ew-resize;\n }\n .is-unavailable .bubble-range-slider {\n cursor: not-allowed;\n }\n\n .bubble-icon-container {\n display: flex;\n flex-wrap: wrap;\n width: 38px;\n height: 38px;\n min-width: 38px;\n min-height: 38px;\n align-items: center;\n justify-content: center;\n margin: 6px;\n border-radius: var(--bubble-media-player-icon-border-radius, var(--bubble-icon-border-radius, var(--bubble-border-radius, 50%)));\n background-color: var(--bubble-media-player-icon-background-color, var(--bubble-icon-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background)))));;\n overflow: hidden;\n position: relative;\n cursor: pointer;\n pointer-events: auto;\n }\n\n .bubble-icon {\n opacity: 0.6;\n }\n\n .is-on .bubble-icon {\n filter: brightness(1.1);\n opacity: 1;\n }\n\n .bubble-icon,\n .bubble-mute-button {\n display: flex;\n position: absolute;\n height: 38px;\n width: 38px;\n justify-content: center;\n align-items: center;\n }\n\n .bubble-entity-picture {\n background-size: cover;\n background-position: center;\n height: 100%;\n width: 100%;\n position: absolute;\n }\n\n .bubble-media-info-container {\n display: flex;\n line-height: 14px;\n font-size: 12px;\n flex-direction: column;\n justify-content: center;\n flex-grow: 1;\n margin-left: 4px;\n pointer-events: none;\n position: relative;\n overflow: hidden;\n }\n\n .bubble-title,\n .bubble-name,\n .bubble-state,\n .bubble-artist {\n display: flex;\n margin: 2px 0;\n position: relative;\n white-space: nowrap;\n }\n\n .bubble-title {\n font-weight: 600;\n }\n\n .bubble-name-container {\n display: flex;\n line-height: 1em;\n flex-direction: column;\n justify-content: center;\n flex-grow: 1;\n font-weight: 600;\n margin-left: 4px;\n pointer-events: none;\n position: relative;\n overflow: hidden;\n }\n\n .bubble-name {\n font-size: 13px;\n margin: 2px 0;\n }\n\n .bubble-state {\n font-size: 12px;\n opacity: 0.7;\n margin: 2px 0;\n font-weight: normal;\n }\n\n .bubble-sub-button-container {\n right: 0 !important;\n }\n\n .bubble-background-container {\n display: flex;\n position: absolute;\n height: 100%;\n width: 100%;\n border-radius: inherit;\n overflow: hidden;\n }\n\n .bubble-cover-background {\n display: flex;\n position: absolute;\n height: 100%;\n width: 100%;\n background-size: cover;\n background-position: 50%;\n filter: blur(50px);\n opacity: 0.5;\n }\n\n @media screen and (max-width: 250px) {\n .bubble-previous-button {\n display: none;\n }\n }\n\n @media screen and (max-width: 206px) {\n .bubble-next-button {\n display: none;\n }\n }\n\n @media screen and (max-width: 160px) {\n .bubble-volume-button {\n display: none;\n }\n }\n\n @keyframes tap-feedback {\n 0% {transform: translateX(-100%); opacity: 0;}\n 64% {transform: translateX(0); opacity: 0.1;}\n 100% {transform: translateX(100%); opacity: 0;}\n }\n\n .large .bubble-media-player-container {\n height: 56px;\n border-radius: var(--bubble-media-player-border-radius, var(--bubble-border-radius, 32px));\n }\n\n .large .bubble-icon-container {\n --mdc-icon-size: 24px;\n min-width: 42px !important;\n min-height: 42px !important;\n margin-left: 8px;\n }\n \n .large .bubble-play-pause-button {\n display: flex;\n height: 42px;\n width: 42px;\n padding: 0;\n align-items: center;\n justify-content: center;\n }\n\n .large .bubble-volume-slider {\n height: 42px;\n border-radius: var(--bubble-media-player-border-radius, var(--bubble-border-radius, 32px));\n left: 60px;\n width: calc(100% - 168px);\n }\n\n .large .bubble-range-value {\n place-items: center;\n height: 42px;\n }\n\n .large .bubble-button-container {\n align-items: center;\n }\n\n .rows-2 .bubble-sub-button-container {\n flex-direction: column;\n gap: 4px !important;\n display: grid !important;\n grid-template-columns: repeat(2, 1fr);\n grid-template-rows: repeat(2, minmax(auto, max-content));\n grid-auto-flow: column;\n width: auto;\n }\n\n .rows-2 .bubble-sub-button {\n height: 20px !important;\n }\n";let ie;function re(e){"media-player"!==e.cardType&&function(e){e.dragging=!1,e.elements={},e.elements.mediaPlayerContainer=(0,n.az)("div","bubble-media-player-container"),e.elements.mediaPlayerCard=(0,n.az)("div","bubble-media-player"),e.elements.mediaInfoContainer=(0,n.az)("div","bubble-media-info-container"),e.elements.nameContainer=(0,n.az)("div","bubble-name-container"),e.elements.buttonContainer=(0,n.az)("div","bubble-button-container"),e.elements.iconContainer=(0,n.az)("div","bubble-icon-container"),e.elements.backgroundContainer=(0,n.az)("div","bubble-background-container"),e.elements.coverBackground=(0,n.az)("div","bubble-cover-background"),e.elements.playPauseButton=(0,n.az)("ha-icon","bubble-play-pause-button"),e.elements.previousButton=(0,n.az)("ha-icon","bubble-previous-button"),e.elements.previousButton.setAttribute("icon","mdi:skip-previous"),e.elements.nextButton=(0,n.az)("ha-icon","bubble-next-button"),e.elements.nextButton.setAttribute("icon","mdi:skip-next"),e.elements.volumeButton=(0,n.az)("ha-icon","bubble-volume-button"),e.elements.volumeButton.setAttribute("icon","mdi:volume-high"),e.elements.powerButton=(0,n.az)("ha-icon","bubble-power-button"),e.elements.powerButton.setAttribute("icon","mdi:power-standby"),e.elements.muteButton=(0,n.az)("ha-icon","bubble-mute-button is-hidden"),e.elements.muteButton.setAttribute("icon","mdi:volume-off"),e.elements.title=(0,n.az)("div","bubble-title"),e.elements.artist=(0,n.az)("div","bubble-artist"),e.elements.name=(0,n.az)("div","bubble-name"),e.elements.state=(0,n.az)("div","bubble-state"),e.elements.icon=(0,n.az)("ha-icon","bubble-icon"),e.elements.image=(0,n.az)("div","bubble-entity-picture"),e.elements.style=(0,n.az)("style"),e.elements.customStyle=(0,n.az)("style"),e.elements.style.innerText=ae,e.elements.iconContainer.appendChild(e.elements.icon),e.elements.iconContainer.appendChild(e.elements.image),e.elements.iconContainer.appendChild(e.elements.muteButton),e.elements.nameContainer.appendChild(e.elements.name),e.elements.nameContainer.appendChild(e.elements.state),e.elements.mediaInfoContainer.appendChild(e.elements.title),e.elements.mediaInfoContainer.appendChild(e.elements.artist),e.elements.buttonContainer.appendChild(e.elements.powerButton),e.elements.buttonContainer.appendChild(e.elements.previousButton),e.elements.buttonContainer.appendChild(e.elements.nextButton),e.elements.buttonContainer.appendChild(e.elements.volumeButton),e.elements.buttonContainer.appendChild(e.elements.playPauseButton),e.elements.mediaPlayerCard.appendChild(e.elements.iconContainer),e.elements.mediaPlayerCard.appendChild(e.elements.mediaInfoContainer),e.elements.mediaPlayerCard.appendChild(e.elements.nameContainer),e.elements.mediaPlayerCard.appendChild(e.elements.buttonContainer),e.elements.backgroundContainer.appendChild(e.elements.coverBackground),e.elements.mediaPlayerContainer.appendChild(e.elements.backgroundContainer),e.content.innerHTML="",e.content.appendChild(e.elements.mediaPlayerContainer),e.content.appendChild(e.elements.style),e.content.appendChild(e.elements.customStyle),e.elements.mediaPlayerContainer.appendChild(e.elements.mediaPlayerCard),a(e.elements.icon,e.config,e.config.entity),a(e.elements.image,e.config,e.config.entity),e.elements.volumeSliderContainer=(0,n.az)("div","bubble-volume-slider is-hidden"),function(e,t){let o=0;function a(t){t.stopPropagation();const n=t.pageX||(t.touches?t.touches[0].pageX:0);Math.abs(o-n)>10&&oe(e,n,!0);const a=e.elements.rangeSlider.getBoundingClientRect(),i=100*(n-a.left)/a.width,r=Math.min(100,Math.max(0,i));e.elements.rangeValue.innerText=Math.round(r)+"%"}function i(n){n.stopPropagation(),e.dragging=!1;const o=n.pageX||(n.touches?n.touches[0].pageX:0);oe(e,o),t.classList.remove("is-dragging"),t.removeEventListener("pointermove",a),t.removeEventListener("pointerup",i);const r=e.elements.rangeSlider.getBoundingClientRect(),s=100*(o-r.left)/r.width,l=Math.min(100,Math.max(0,s));e.elements.rangeValue.innerText=Math.round(l)+"%"}ie=Math.round(100*(0,n.IL)(e,"volume_level"))+"%",e.elements.rangeFill=(0,n.az)("div","bubble-range-fill range-fill"),e.elements.rangeSlider=(0,n.az)("div","bubble-range-slider range-slider"),e.elements.rangeValue=(0,n.az)("div","bubble-range-value"),e.elements.rangeSlider.appendChild(e.elements.rangeValue),e.elements.rangeSlider.appendChild(e.elements.rangeFill),t.appendChild(e.elements.rangeSlider),t.addEventListener("pointercancel",(function(){e.dragging=!1,t.classList.remove("is-dragging"),t.removeEventListener("pointermove",a),t.removeEventListener("pointerup",i)})),t.addEventListener("pointerdown",(n=>{t.setPointerCapture(n.pointerId),e.card.classList.contains("is-unavailable")||(e.dragging=!0,o=n.pageX||(n.touches?n.touches[0].pageX:0),t.classList.add("is-dragging"),t.addEventListener("pointermove",a),t.addEventListener("pointerup",i))})),e.elements.rangeValue.innerText=ie}(e,e.elements.volumeSliderContainer),e.elements.mediaPlayerCard.appendChild(e.elements.volumeSliderContainer),e.elements.volumeButton.addEventListener("click",(()=>{e.elements.volumeSliderContainer.classList.toggle("is-hidden"),e.elements.muteButton.classList.toggle("is-hidden"),e.elements.icon.classList.toggle("is-hidden"),e.elements.image.classList.toggle("is-hidden"),function(e){const t=e.elements.volumeButton.isHidden,n=t?"1":"0",o=t?"mdi:volume-high":"mdi:close";e.elements.volumeButton.setAttribute("icon",o),e.elements.mediaInfoContainer.style.opacity=n,e.elements.nameContainer.style.opacity=n,e.elements.subButtonContainer&&(e.elements.subButtonContainer.style.opacity=n),e.elements.previousButton.style.opacity=n,e.elements.nextButton.style.opacity=n,e.elements.powerButton.style.opacity=n,e.elements.volumeButton.isHidden=!t}(e),ie=Math.round(100*(0,n.IL)(e,"volume_level"))+"%"})),e.elements.powerButton.addEventListener("click",(()=>{const t=(0,n.pr)(e);e._hass.callService("media_player",t?"turn_off":"turn_on",{entity_id:e.config.entity})})),e.elements.muteButton.addEventListener("click",(()=>{const t=!0===(0,n.IL)(e,"is_volume_muted");e._hass.callService("media_player","volume_mute",{entity_id:e.config.entity,is_volume_muted:!t}),e.elements.muteButton.clicked=!0})),e.elements.previousButton.addEventListener("click",(()=>{e._hass.callService("media_player","media_previous_track",{entity_id:e.config.entity})})),e.elements.nextButton.addEventListener("click",(()=>{e._hass.callService("media_player","media_next_track",{entity_id:e.config.entity})})),e.elements.playPauseButton.addEventListener("click",(()=>{e._hass.callService("media_player","media_play_pause",{entity_id:e.config.entity}),e.elements.playPauseButton.clicked=!0})),e.elements.mediaPlayerContainer.addEventListener("click",(()=>(0,n.jk)("selection"))),e.cardType="media-player"}(e),function(e){"unavailable"===(0,n.y0)(e)?e.card.classList.add("is-unavailable"):e.card.classList.remove("is-unavailable"),(0,n.pr)(e)?e.card.classList.add("is-on"):e.card.classList.remove("is-on")}(e),function(e){if(e.config.styles?.includes("card.querySelector('.bubble-name').innerText"))return;const t=(0,n.oY)(e);t!==e.previousName&&(e.elements.name.innerText=t,e.previousName=t,(0,n.GP)(e,e.elements.name,t))}(e),function(e){const t=(0,n.IL)(e,"media_title"),o=(0,n.IL)(e,"media_artist"),a=t+o;a!==e.previousMediaState&&(e.elements.artist.style.display=""===o?"none":"flex",e.previousMediaState=a,(0,n.GP)(e,e.elements.title,t),(0,n.GP)(e,e.elements.artist,o))}(e),function(e){(0,n.IL)(e,"media_title");const t=""===(0,n.IL)(e,"media_artist");e.elements.mediaInfoContainer.style.display=t?"none":"",e.elements.nameContainer.style.display=t?"":"none"}(e),function(e){const t=(0,n.pr)(e),o=(0,n.q7)(e),a=(0,n.gJ)(e),i=e.elements.image.style.backgroundImage,r=e.elements.icon.icon,s=e.elements.icon.style.color;if(""!==a){const t="url("+a+")";i!==t&&(e.elements.image.style.backgroundImage=t),"none"!==e.elements.icon.style.display&&(e.elements.icon.style.display="none"),""!==e.elements.image.style.display&&(e.elements.image.style.display="")}else if(""!==o){r!==o&&(e.elements.icon.icon=o);const n=t?"var(--accent-color)":"inherit";s!==n&&(e.elements.icon.style.color=n),""!==e.elements.icon.style.display&&(e.elements.icon.style.display=""),"none"!==e.elements.image.style.display&&(e.elements.image.style.display="none")}else"none"!==e.elements.icon.style.display&&(e.elements.icon.style.display="none"),"none"!==e.elements.image.style.display&&(e.elements.image.style.display="none")}(e),function(e){const t=(0,n.pr)(e),o=(0,n.gJ)(e),a=e.config.cover_background,i=e.elements.coverBackground.style.backgroundImage;if(a&&t&&o){const t="url("+o+")";i!==t&&(e.elements.coverBackground.style.backgroundImage=t)}else""!==i&&(e.elements.coverBackground.style.backgroundImage="")}(e),H(e),function(e){if((0,n.OC)(e,"media_player")&&!1===e.dragging&&e.elements.rangeFill){const t=100*(0,n.IL)(e,"volume_level");e.elements.rangeFill.style.transform=`translateX(${t}%)`}}(e),function(e){const t="playing"===(0,n.y0)(e),o=e.elements.playPauseButton.clicked;t?e.elements.playPauseButton.setAttribute("icon",o?"mdi:play":"mdi:pause"):e.elements.playPauseButton.setAttribute("icon",o?"mdi:pause":"mdi:play"),e.elements.playPauseButton.clicked=!1}(e),function(e){const t=!0===(0,n.IL)(e,"is_volume_muted"),o=e.elements.muteButton.clicked;e.elements.muteButton.style.color=t?o?"":"var(--accent-color)":o?"var(--accent-color)":"",e.elements.muteButton.clicked=!1}(e),function(e){const t=(0,n.pr)(e);e.elements.powerButton.style.color=t?"var(--accent-color)":""}(e),N(e,e.content,e.elements.buttonContainer,!0),function(e){q(e),(0,n.jx)(e);const t=(0,n.y0)(e),o="off"!==t&&"unknown"!==t;if(e.config.hide?.power_button&&"none"!==e.elements.powerButton.style.display?e.elements.powerButton.style.display="none":e.config.hide?.power_button||"none"!==e.elements.powerButton.style.display||(e.elements.powerButton.style.display=""),!e.config.hide?.previous_button&&(e.editor||o)||"none"===e.elements.previousButton.style.display?e.config.hide?.previous_button||!e.editor&&!o||"none"!==e.elements.previousButton.style.display||(e.elements.previousButton.style.display=""):e.elements.previousButton.style.display="none",!e.config.hide?.next_button&&(e.editor||o)||"none"===e.elements.nextButton.style.display?e.config.hide?.next_button||!e.editor&&!o||"none"!==e.elements.nextButton.style.display||(e.elements.nextButton.style.display=""):e.elements.nextButton.style.display="none",!e.config.hide?.volume_button&&(e.editor||o)||"none"===e.elements.volumeButton.style.display?e.config.hide?.volume_button||!e.editor&&!o||"none"!==e.elements.volumeButton.style.display||(e.elements.volumeButton.style.display=""):e.elements.volumeButton.style.display="none",!e.config.hide?.play_pause_button&&(e.editor||o)||"none"===e.elements.playPauseButton.style.display?e.config.hide?.play_pause_button||!e.editor&&!o||"none"!==e.elements.playPauseButton.style.display||(e.elements.playPauseButton.style.display=""):e.elements.playPauseButton.style.display="none",!e.config.styles)return;let a="";try{a=e.config.styles?Function("hass","entity","state","icon","subButtonIcon","getWeatherIcon","card",`return \`${e.config.styles}\`;`)(e._hass,e.config.entity,t,e.elements.icon,e.subButtonIcon,n.X,e.card):""}catch(e){throw new Error(`Error in generating media player custom templates: ${e.message}`)}e.elements.customStyle&&(e.elements.customStyle.innerText=a)}(e)}function se(e){let t="";const n=e._hass.states[e.config.entity],o=(n.attributes.current_temperature,n.attributes.hvac_action),a=n.state,i="heating"===o||"heat"===a&&e.config.state_color,r="cooling"===o||"cool"===a&&e.config.state_color,s="off"!==a&&"unknown"!==a;switch(a){case"fan_only":t="var(--bubble-state-climate-fan-only-color, var(--state-climate-fan-only-color, var(--state-climate-active-color, var(--state-active-color))))";break;case"dry":t="var(--bubble-state-climate-dry-color, var(--state-climate-dry-color, var(--state-climate-active-color, var(--state-active-color))))";break;default:t=r?"var(--bubble-state-climate-cool-color, var(--state-climate-cool-color, var(--state-climate-active-color, var(--state-active-color))))":i?"var(--bubble-state-climate-heat-color, var(--state-climate-heat-color, var(--state-climate-active-color, var(--state-active-color))))":s&&e.config.state_color?"auto"===a?"var(--bubble-state-climate-auto-color, var(--state-climate-auto-color, var(--state-climate-active-color, var(--state-active-color))))":"heat_cool"===a?"var(--bubble-state-climate-heat-cool-color, var(--state-climate-heat-cool-color, var(--state-climate-active-color, var(--state-active-color))))":"var(--bubble-climate-accent-color, var(--bubble-accent-color, var(--accent-color)))":""}return t}let le,ce,de;class ue extends HTMLElement{editor=!1;isConnected=!1;connectedCallback(){this.isConnected=!0,this._hass&&this.updateBubbleCard()}disconnectedCallback(){this.isConnected=!1}set editMode(e){this.editor!==e&&(this.editor=e,this._hass&&this.updateBubbleCard())}set hass(e){!function(e){if(!e.content){let t=e.shadowRoot||e.attachShadow({mode:"open"}),n=document.createElement("ha-card");n.style.cssText="background: none; border: none; box-shadow: none; border-radius: 16px;";let o=document.createElement("div");o.className="card-content",o.style.padding="0",n.appendChild(o),t.appendChild(n),e.card=n,e.content=o}}(this),this._hass=e,this.editor||(this.isConnected||"pop-up"===this.config.card_type)&&this.updateBubbleCard()}updateBubbleCard(){switch(this.config.card_type){case"pop-up":J(this);break;case"button":Y(this);break;case"separator":"separator"!==(e=this).cardType&&function(e){e.elements={},e.elements.separatorCard=(0,n.az)("div","bubble-separator separator-container"),e.elements.icon=(0,n.az)("ha-icon","bubble-icon"),e.elements.name=(0,n.az)("h4","bubble-name"),e.elements.line=(0,n.az)("div","bubble-line"),e.elements.style=(0,n.az)("style"),e.elements.style.innerText="\n .bubble-separator {\n display: flex;\n width: 100%;\n \n align-items: center;\n z-index: 1;\n }\n .bubble-icon {\n display: inline-flex;\n height: auto;\n width: auto;\n margin: 0 22px 0 8px;\n }\n .bubble-name {\n margin: 0 30px 0 0;\n font-size: 16px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n .bubble-name:empty {\n display: none;\n }\n .bubble-line {\n border-radius: 6px;\n opacity: 0.5;\n flex-grow: 1;\n height: 6px;\n background-color: var(--bubble-line-background-color, var(--background-color, var(--secondary-background-color)));\n margin-right: 14px;\n }\n .bubble-sub-button-container {\n margin: 0 8px;\n right: 0 !important;\n }\n\n .large .bubble-separator {\n height: 56px;\n }\n\n .rows-2 .bubble-sub-button-container {\n flex-direction: column;\n gap: 4px !important;\n display: grid !important;\n grid-template-columns: repeat(2, min-content);\n grid-template-rows: repeat(2, 1fr);\n grid-auto-flow: column;\n width: auto;\n }\n\n .rows-2 .bubble-sub-button {\n height: 20px !important;\n }\n",e.elements.customStyle=(0,n.az)("style"),e.elements.separatorCard.appendChild(e.elements.icon),e.elements.separatorCard.appendChild(e.elements.name),e.elements.separatorCard.appendChild(e.elements.line),e.content.innerHTML="",e.content.appendChild(e.elements.separatorCard),e.content.appendChild(e.elements.style),e.content.appendChild(e.elements.customStyle),e.cardType="separator"}(e),function(e){e.elements.icon.icon=(0,n.q7)(e),""===e.elements.icon.icon&&""===e.elements.icon.style.margin?(e.elements.icon.style.margin="0px 8px",e.elements.icon.style.width="0px"):""!==e.elements.icon.icon&&"0px 8px"===e.elements.icon.style.margin&&(e.elements.icon.style.margin="",e.elements.icon.style.width="")}(e),function(e){if(e.config.styles?.includes("card.querySelector('.bubble-name').innerText"))return;const t=(0,n.oY)(e);t!==e.elements.name.innerText&&(e.elements.name.innerText=t)}(e),N(e,e.content,e.elements.separatorCard),function(e){q(e),(0,n.jx)(e);const t=(0,n.y0)(e);let o="";try{o=e.config.styles?Function("hass","entity","state","icon","subButtonIcon","getWeatherIcon","card",`return \`${e.config.styles}\`;`)(e._hass,e.config.entity,t,e.elements.icon,e.subButtonIcon,n.X,e.card):""}catch(e){throw new Error(`Error in generating separator custom templates: ${e.message}`)}e.elements.customStyle&&(e.elements.customStyle.innerText=o)}(e);break;case"cover":!function(e){"cover"!==e.cardType&&function(e){e.elements={},e.elements.coverCardContainer=(0,n.az)("div","bubble-cover-card-container cover-container"),e.elements.headerContainer=(0,n.az)("div","bubble-header header-container"),e.elements.buttonsContainer=(0,n.az)("div","bubble-buttons buttons-container"),e.elements.iconContainer=(0,n.az)("div","bubble-icon-container icon-container"),e.elements.icon=(0,n.az)("ha-icon","bubble-icon"),e.elements.nameContainer=(0,n.az)("div","bubble-name-container name-container"),e.elements.name=(0,n.az)("div","bubble-name name"),e.elements.state=(0,n.az)("div","bubble-state state"),e.elements.buttonOpen=(0,n.az)("div","bubble-button bubble-open button open"),e.elements.buttonStop=(0,n.az)("div","bubble-button bubble-stop button stop"),e.elements.buttonClose=(0,n.az)("div","bubble-button bubble-close button close"),e.elements.iconOpen=(0,n.az)("ha-icon","bubble-icon bubble-icon-open"),e.elements.iconStop=(0,n.az)("ha-icon","bubble-icon bubble-icon-stop"),e.elements.iconStop.icon="mdi:stop",e.elements.iconClose=(0,n.az)("ha-icon","bubble-icon bubble-icon-close"),e.elements.style=(0,n.az)("style"),e.elements.style.innerText="\n * {\n -webkit-tap-highlight-color: transparent !important;\n }\n ha-card {\n margin-top: 0 !important;\n background: none !important;\n }\n\n .bubble-cover-card-container {\n display: grid;\n gap: 10px;\n overflow: hidden;\n }\n\n .bubble-header {\n display: flex;\n align-items: center;\n }\n\n .bubble-icon-container {\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n justify-content: center;\n min-width: 38px;\n min-height: 38px;\n border-radius: var(--bubble-cover-icon-border-radius, var(--bubble-icon-border-radius, var(--bubble-border-radius, 50%)));\n background-color: var(--bubble-cover-icon-background-color, var(--bubble-icon-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background)))));\n border: 6px solid var(--bubble-cover-main-background-color, var(--bubble-main-background-color, var(--background-color-2, var(--secondary-background-color))));\n cursor: pointer;\n }\n\n .bubble-name-container {\n display: flex;\n line-height: 1em;\n flex-direction: column;\n justify-content: center;\n flex-grow: 1;\n font-weight: 600;\n margin-left: 4px;\n margin-right: 16px;\n pointer-events: none;\n position: relative;\n overflow: hidden;\n }\n\n .bubble-name {\n font-size: 13px;\n margin: 2px 0;\n white-space: nowrap;\n display: flex;\n position: relative;\n overflow: hidden;\n }\n\n .bubble-state {\n font-size: 12px;\n opacity: 0.7;\n margin: 2px 0;\n font-weight: normal;\n white-space: nowrap;\n display: flex;\n position: relative;\n overflow: hidden;\n }\n\n .bubble-buttons {\n display: grid;\n align-self: center;\n grid-auto-flow: column;\n grid-gap: 18px;\n }\n\n .bubble-icon {\n display: flex; \n height: 24px; \n width: 24px; \n color: var(--primary-text-color);\n }\n\n .bubble-button.disabled {\n opacity: 0.3 !important;\n pointer-events: none !important;\n cursor: none !important;\n }\n\n .bubble-button {\n display: flex;\n background: var(--bubble-cover-main-background-color, var(--bubble-main-background-color, var(--background-color-2, var(--secondary-background-color))));\n height: 42px;\n border-radius: var(--bubble-cover-border-radius, var(--bubble-border-radius, 32px));\n box-shadow: var(--bubble-cover-box-shadow, var(--bubble-button-box-shadow, var(--bubble-box-shadow, none)));\n align-items: center;\n justify-content: center;\n cursor: pointer;\n border: none;\n }\n\n .large .bubble-cover-card-container {\n height: 56px;\n display: flex;\n background: var(--bubble-cover-main-background-color, var(--bubble-main-background-color, var(--background-color-2, var(--secondary-background-color))));\n border-radius: var(--bubble-cover-border-radius, var(--bubble-border-radius, 32px));\n box-shadow: var(--bubble-cover-box-shadow, var(--bubble-button-box-shadow, var(--bubble-box-shadow, none)));\n }\n\n .large .bubble-buttons .bubble-icon {\n color: var(--primary-text-color) !important;\n opacity: 1;\n }\n\n .large .bubble-header-container {\n height: 56px;\n }\n\n .large .bubble-header {\n width: 100%;\n }\n\n .large .bubble-icon-container {\n --mdc-icon-size: 24px;\n min-width: 42px !important;\n min-height: 42px !important;\n align-content: center;\n border: none;\n margin: 8px 6px 8px 8px;\n }\n\n .large .bubble-icon {\n align-items: center;\n }\n\n .large .bubble-buttons {\n display: flex;\n position: relative;\n right: 18px;\n align-self: center;\n grid-gap: 18px;\n }\n\n .large .bubble-button,\n .large .bubble-sub-button {\n box-shadow: none;\n }\n\n .large .bubble-sub-button-container {\n margin-right: 14px;\n }\n\n .rows-2 .bubble-sub-button-container {\n flex-direction: column;\n gap: 4px !important;\n display: grid !important;\n grid-template-columns: repeat(2, min-content);\n grid-template-rows: repeat(2, 1fr);\n grid-auto-flow: column;\n width: auto;\n padding-right: 14px;\n }\n\n .rows-2 .bubble-sub-button {\n height: 20px !important;\n }\n",e.elements.customStyle=(0,n.az)("style"),e.elements.iconContainer.appendChild(e.elements.icon),e.elements.headerContainer.appendChild(e.elements.iconContainer),e.elements.headerContainer.appendChild(e.elements.nameContainer),e.elements.nameContainer.appendChild(e.elements.name),e.elements.nameContainer.appendChild(e.elements.state),e.elements.buttonsContainer.appendChild(e.elements.buttonOpen),e.elements.buttonsContainer.appendChild(e.elements.buttonStop),e.elements.buttonsContainer.appendChild(e.elements.buttonClose),e.elements.buttonOpen.appendChild(e.elements.iconOpen),e.elements.buttonOpen.addEventListener("click",(()=>{const t=e.config.open_service??"cover.open_cover",[n,o]=t.split(".");e._hass.callService(n,o,{entity_id:e.config.entity})})),e.elements.buttonStop.appendChild(e.elements.iconStop),e.elements.buttonStop.addEventListener("click",(()=>{const t=e.config.stop_service??"cover.stop_cover",[n,o]=t.split(".");e._hass.callService(n,o,{entity_id:e.config.entity})})),e.elements.buttonClose.appendChild(e.elements.iconClose),e.elements.buttonClose.addEventListener("click",(()=>{const t=e.config.close_service??"cover.close_cover",[n,o]=t.split(".");e._hass.callService(n,o,{entity_id:e.config.entity})})),a(e.elements.iconContainer,e.config),e.content.innerHTML="",e.content.appendChild(e.elements.coverCardContainer),e.content.appendChild(e.elements.style),e.content.appendChild(e.elements.customStyle),e.elements.coverCardContainer.appendChild(e.elements.headerContainer),e.elements.coverCardContainer.appendChild(e.elements.buttonsContainer),e.elements.coverCardContainer.addEventListener("click",(()=>(0,n.jk)("selection"))),e.cardType="cover"}(e),function(e){const t=e._hass.states[e.config.entity],{current_position:o,assumed_state:a}=t.attributes,i=te(t,Z),r=te(t,Q),s=te(t,ee),l=function(e){return void 0!==e.attributes.current_position?100===e.attributes.current_position:"open"===e.state}(t),c=function(e){return void 0!==e.attributes.current_position?0===e.attributes.current_position:"closed"===e.state}(t),d="curtain"===(0,n.IL)(e,"device_class");e.elements.icon.icon=l?(0,n.q7)(e,e.config.entity,e.config.icon_open):(0,n.q7)(e,e.config.entity,e.config.icon_close),e.elements.iconOpen.icon=e.config.icon_up||(d?"mdi:arrow-expand-horizontal":"mdi:arrow-up"),e.elements.iconClose.icon=e.config.icon_down||(d?"mdi:arrow-collapse-horizontal":"mdi:arrow-down"),void 0!==o?(l?e.elements.buttonOpen.classList.add("disabled"):i&&e.elements.buttonOpen.classList.remove("disabled"),c?e.elements.buttonClose.classList.add("disabled"):r&&e.elements.buttonClose.classList.remove("disabled")):(e.elements.buttonOpen.classList.remove("disabled"),e.elements.buttonClose.classList.remove("disabled")),e.elements.buttonStop.style.display=s?"":"none"}(e),function(e){if(e.config.styles?.includes("card.querySelector('.bubble-name').innerText"))return;const t=(0,n.oY)(e);t!==e.elements.previousName&&(e.elements.name.innerText=t,(0,n.GP)(e,e.elements.name,t),e.elements.previousName=t)}(e),H(e),N(e,e.content,e.elements.headerContainer),function(e){if(q(e),(0,n.jx)(e),!e.config.styles)return;const t=(0,n.y0)(e);let o="";try{o=e.config.styles?Function("hass","entity","state","icon","subButtonIcon","getWeatherIcon","card",`return \`${e.config.styles}\`;`)(e._hass,e.config.entity,t,e.elements.icon,e.subButtonIcon,n.X,e.card):""}catch(e){throw new Error(`Error in generating cover custom templates: ${e.message}`)}e.elements.customStyle&&(e.elements.customStyle.innerText=o)}(e)}(this);break;case"empty-column":!function(e){"empty-column"!==e.cardType&&function(e){e.elements={},e.elements.emptyColumnCard=(0,n.az)("div","bubble-empty-column empty-column"),e.elements.style=(0,n.az)("style"),e.elements.style.innerText="\n .empty-column {\n display: flex;\n width: 100%;\n }\n",e.elements.customStyle=(0,n.az)("style"),e.content.innerHTML="",e.content.appendChild(e.elements.emptyColumnCard),e.content.appendChild(e.elements.style),e.content.appendChild(e.elements.customStyle),e.cardType="empty-column"}(e)}(this);break;case"horizontal-buttons-stack":!function(e){"horizontal-buttons-stack"!==e.cardType&&function(e){e.elements={},e.elements.buttons=[],e.elements.cardContainer=(0,n.az)("div","bubble-horizontal-buttons-stack-card-container horizontal-buttons-stack-container");let t=1;for(;e.config[t+"_link"];)e.elements.cardContainer.appendChild(K(e,t)),t++;e.elements.style=(0,n.az)("style"),e.elements.style.innerText="\n @keyframes from-bottom {\n 0% { transform: translate(-50%, 100px); }\n 26% { transform: translate(-50%, -8px); }\n 46% { transform: translate(-50%, 1px); }\n 62% { transform: translate(-50%, -2px); }\n 70% { transform: translate(-50%, 0); }\n 100% { transform: translate(-50%, 0); }\n }\n @keyframes pulse {\n 0% { filter: brightness(0.7); }\n 100% { filter: brightness(1.3); }\n }\n ha-card {\n border-radius: 0;\n }\n .horizontal-buttons-stack-card {\n bottom: 16px;\n height: 51px;\n margin-top: 0;\n position: fixed;\n width: calc(100% - var(--mdc-drawer-width, 0px) - 8px);\n left: calc(var(--mdc-drawer-width, 0px) + 4px);\n z-index: 6; /* Higher value hide the more-info panel */\n }\n @media only screen and (max-width: 870px) {\n .horizontal-buttons-stack-card {\n width: calc(100% - 16px);\n left: 8px;\n }\n\n .horizontal-buttons-stack-card::before {\n left: -10px;\n }\n }\n .horizontal-buttons-stack-card::before {\n content: '';\n position: absolute;\n top: -32px;\n display: none;\n background: linear-gradient(0deg, var(--background-color, var(--primary-background-color)) 50%, rgba(79, 69, 87, 0));\n width: 200%;\n height: 100px;\n pointer-events: none;\n }\n .has-gradient.horizontal-buttons-stack-card::before {\n display: block;\n }\n\n .card-content {\n width: calc(100% + 36px);\n padding: 0 !important;\n max-width: calc(var(--desktop-width) - 8px);\n box-sizing: border-box;\n overflow: scroll;\n position: absolute;\n left: 50%;\n transform: translateX(-50%);\n -ms-overflow-style: none;\n scrollbar-width: none;\n -webkit-mask-image: linear-gradient(\n 90deg,\n #000000 0%,\n #000000 calc(0% + 28px),\n #000000 calc(100% - 28px),\n transparent 100%\n );\n }\n .is-scrollable.card-content {\n padding: 0 !important;\n width: 100%;\n }\n .is-scrolled.card-content {\n padding: 0 !important;\n width: 100%;\n -webkit-mask-image: linear-gradient(\n 90deg,\n transparent 0%,\n #000000 calc(0% + 28px),\n #000000 calc(100% - 28px),\n transparent 100%\n );\n }\n .is-maxed-scroll.card-content {\n -webkit-mask-image: linear-gradient(\n 90deg,\n transparent 0%,\n #000000 calc(0% + 28px),\n #000000 calc(100% - 28px),\n #000000 100%\n );\n }\n .card-content::-webkit-scrollbar {\n display: none;\n }\n\n .bubble-horizontal-buttons-stack-card-container {\n height: 51px;\n position: relative;\n margin: auto;\n }\n\n .bubble-button {\n align-items: center;\n border-radius: var(--bubble-horizontal-buttons-stack-border-radius, var(--bubble-border-radius, 32px));\n color: var(--primary-text-color);\n cursor: pointer;\n display: inline-flex;\n height: 50px;\n left: 0;\n padding: 0 16px;\n position: absolute;\n white-space: nowrap;\n z-index: 1;\n transition: transform 1s;\n box-sizing: border-box;\n }\n .bubble-button.highlight {\n animation: pulse 1.4s infinite alternate;\n }\n .bubble-background-color {\n border: 1px solid var(--primary-text-color);\n border-radius: var(--bubble-horizontal-buttons-stack-border-radius, var(--bubble-border-radius, 32px));\n box-sizing: border-box;\n height: 100%;\n left: 0;\n position: absolute;\n top: 0;\n transition: background-color 1s;\n width: 100%;\n z-index: -1;\n }\n .bubble-background {\n opacity: 0.8;\n border-radius: var(--bubble-horizontal-buttons-stack-border-radius, var(--bubble-border-radius, 32px));\n width: 100%;\n height: 100%;\n box-sizing: border-box !important;\n position: absolute;\n left: 0;\n z-index: -2;\n background-color: var(--background-color,var(--primary-background-color));\n }\n .bubble-icon {\n height: 24px;\n width: 24px;\n }\n .bubble-icon + .bubble-name {\n margin-left: 8px;\n }\n\n\n .horizontal-buttons-stack-card.editor {\n position: relative;\n width: 100%;\n left: 0;\n bottom: 0;\n }\n .horizontal-buttons-stack-card.editor::before {\n background: none;\n }\n\n",e.elements.customStyle=(0,n.az)("style"),e.card.classList.add("horizontal-buttons-stack-card"),e.card.style.marginLeft=e.config.margin??"",e.config.hide_gradient||e.card.classList.add("has-gradient"),e.card.style.setProperty("--desktop-width",e.config.width_desktop??"500px"),e.elements.cardContainer.appendChild(e.elements.style),e.elements.cardContainer.appendChild(e.elements.customStyle),e.content.appendChild(e.elements.cardContainer),e.content.addEventListener("scroll",(()=>{e.content.scrollLeft>0?e.content.classList.add("is-scrolled"):e.content.classList.remove("is-scrolled"),e.content.scrollWidth-12{e.content.style.animation="none"}),1500));let o=e.card.parentNode.host;o&&!e.editor&&"hui-card"!==o.parentElement.tagName.toLowerCase()?o.style.padding="0 0 80px":o.parentElement&&!e.editor&&"hui-card"===o.parentElement.tagName.toLowerCase()&&(o.parentElement.style.padding="0 0 80px"),e.cardType="horizontal-buttons-stack"}(e),function(e){if(!e.config.styles)return;let t="";try{t=e.config.styles?Function("hass","card",`return \`${e.config.styles}\`;`)(e._hass,e.card):""}catch(e){throw new Error(`Error in generating horizontal buttons stack custom templates: ${e.message}`)}e.elements.customStyle&&(e.elements.customStyle.innerText=t)}(e),function(e){if(!e.config.auto_order)return;const t=e._hass.states;e.elements.buttons.sort(((e,n)=>{if(!t[e.pirSensor])return 1;if(!t[e.pirSensor])return-1;const o=t[e.pirSensor]?.last_updated,a=t[n.pirSensor]?.last_updated;return"on"===t[e.pirSensor]?.state&&"on"===t[n.pirSensor]?.state?o>a?-1:o===a?0:1:"on"===t[e.pirSensor]?.state?-1:"on"===t[n.pirSensor]?.state?1:o>a?-1:o===a?0:1}))}(e),function(e){e.elements.buttons.forEach((t=>{const n=t.index,o=e.config[`${n}_name`]??"",a=e.config[`${n}_icon`]??"",i=e.config[`${n}_pir_sensor`],r=e.config[`${n}_link`],s=e.config[`${n}_entity`];t.pirSensor=i,t.lightEntity=s,t.link=r,o?(t.name.innerText=o,t.name.style.display=""):t.name.style.display="none",a?(t.icon.icon=a,t.icon.style.display=""):t.icon.style.display="none",void 0===r&&(t.remove(),e.elements.buttons=e.elements.buttons.filter((e=>e!==t)),e.elements.buttons.forEach(((e,t)=>{e.index=t+1})))}));let t=e.elements.buttons.length+1;for(;void 0!==e.config[`${t}_link`];){if(!e.elements.buttons.find((e=>e.index===t))){const n=K(e,t);e.elements.buttons.push(n)}t++}}(e),function(e){const t=e.shadowRoot.host.closest("hui-card-preview, hui-card-options");e.editor||null!==t?(e.elements.cardContainer.classList.add("editor"),e.card.classList.add("editor")):(e.elements.cardContainer.classList.remove("editor"),e.card.classList.remove("editor"))}(e),function(e){let t=0;for(let n=0;n0&&(o=a,localStorage.setItem(`bubbleButtonWidth-${e.elements.buttons[n].link}`,`${a}`)),null!==o&&(e.elements.buttons[n].style.transform=`translateX(${t}px)`,e.elements.buttons[n].style.width="",t+=+o+12)}e.elements.cardContainer.style.width=`${t}px`}(e),function(e){e.elements.buttons.forEach((n=>{const o=e._hass.states[n.lightEntity],a=o?.attributes.rgb_color,i=o?.state;if(a){const e=(0,t.wW)(a)?"rgba(255, 220, 200, 0.5)":`rgba(${a}, 0.5)`;n.backgroundColor.style.backgroundColor=e,n.backgroundColor.style.borderColor="rgba(0, 0, 0, 0)"}else"on"==i?(n.backgroundColor.style.backgroundColor="rgba(255, 255, 255, 0.5)",n.backgroundColor.style.borderColor="rgba(0, 0, 0, 0)"):(n.backgroundColor.style.backgroundColor="rgba(0, 0, 0, 0)",n.backgroundColor.style.borderColor="var(--primary-text-color)")}))}(e),function(e){e.content.scrollWidth>=e.content.offsetWidth?e.content.classList.add("is-scrollable"):e.content.classList.remove("is-scrollable")}(e)}(this);break;case"media-player":re(this);break;case"select":!function(e){e.cardType,"select"!==e.cardType&&(function(e){e.elements||(e.elements={});let t=e.content;e.elements.selectCardContainer=(0,n.az)("div","bubble-select-card-container"),e.elements.selectCard=(0,n.az)("div","bubble-select-card"),e.elements.selectBackground=(0,n.az)("div","bubble-select-background"),e.elements.nameContainer=(0,n.az)("div","bubble-name-container"),e.elements.iconContainer=(0,n.az)("div","bubble-icon-container"),e.elements.name=(0,n.az)("div","bubble-name"),e.elements.state=(0,n.az)("div","bubble-state"),e.elements.feedback=(0,n.az)("div","bubble-feedback-element"),e.elements.icon=(0,n.az)("ha-icon","bubble-icon"),e.elements.image=(0,n.az)("div","bubble-entity-picture"),e.elements.style=(0,n.az)("style"),e.elements.customStyle=(0,n.az)("style"),e.elements.feedback.style.display="none",e.elements.style.innerText=O,s(e.elements.selectBackground,e.elements.feedback),a(e.elements.iconContainer,e.config,e.config.entity),e.elements.iconContainer.appendChild(e.elements.icon),e.elements.iconContainer.appendChild(e.elements.image),e.elements.nameContainer.appendChild(e.elements.name),e.elements.nameContainer.appendChild(e.elements.state),e.elements.selectCard.appendChild(e.elements.selectBackground),e.elements.selectCard.appendChild(e.elements.iconContainer),e.elements.selectCard.appendChild(e.elements.nameContainer),e.elements.selectCardContainer.appendChild(e.elements.selectCard),e.elements.selectBackground.appendChild(e.elements.feedback),t.innerHTML="",t.appendChild(e.elements.selectCardContainer),t.appendChild(e.elements.style),t.appendChild(e.elements.customStyle),e.cardType="select"}(e),z(e),E(e)),B(e,e.elements,e.config.entity,e.config),function(e){"unavailable"===(0,n.y0)(e)?e.card.classList.add("is-unavailable"):e.card.classList.remove("is-unavailable")}(e),function(e){const t=(0,n.q7)(e),o=(0,n.gJ)(e);""!==o?(e.elements.image.style.backgroundImage="url("+o+")",e.elements.icon.style.display="none",e.elements.image.style.display=""):""!==t?(e.elements.icon.icon=t,e.elements.icon.style.color="inherit",e.elements.icon.style.display="",e.elements.image.style.display="none"):(e.elements.icon.style.display="none",e.elements.image.style.display="none")}(e),function(e){if(e.config.styles?.includes("card.querySelector('.bubble-name').innerText"))return;const t=(0,n.oY)(e);t!==e.elements.previousName&&((0,n.GP)(e,e.elements.name,t),e.elements.previousName=t)}(e),H(e),N(e,e.content,e.elements.dropdownContainer,!0),function(e){q(e),(0,n.jx)(e);const t=(0,n.y0)(e);let o="";try{o=e.config.styles?Function("hass","entity","state","icon","subButtonIcon","getWeatherIcon","card",`return \`${e.config.styles}\`;`)(e._hass,e.config.entity,t,e.elements.icon,e.subButtonIcon,n.X,e.card):""}catch(e){throw new Error(`Error in generating select custom templates: ${e.message}`)}e.elements.customStyle&&(e.elements.customStyle.innerText=o,e.elements.dropdownCustomStyleElement.innerText=o)}(e)}(this);break;case"climate":!function(e){"climate"!==e.cardType&&function(e){e.dragging=!1,e.elements={};const t=e.config.entity,o=e._hass.states[t],i="°C"===e._hass.config.unit_system.temperature,r=o.attributes.target_temp_step?o.attributes.target_temp_step:i?.5:1;function l(t,o,a){const i=(0,n.az)("div","bubble-climate-minus-button"),r=(0,n.az)("div","bubble-climate-plus-button"),l=(0,n.az)("ha-icon","bubble-climate-minus-button-icon");l.setAttribute("icon","mdi:minus"),i.appendChild(l),s(i);const c=(0,n.az)("ha-icon","bubble-climate-plus-button-icon");let d,u;c.setAttribute("icon","mdi:plus"),r.appendChild(c),s(r),"temperature"===o?(e.elements.tempDisplay=(0,n.az)("div","bubble-temperature-display"),d=e.elements.tempDisplay):"target_temp_low"===o?(e.elements.lowTempDisplay=(0,n.az)("div","bubble-low-temperature-display"),d=e.elements.lowTempDisplay):"target_temp_high"===o&&(e.elements.highTempDisplay=(0,n.az)("div","bubble-high-temperature-display"),d=e.elements.highTempDisplay),t.appendChild(i),t.appendChild(d),t.appendChild(r);let b=parseFloat((0,n.IL)(e,o))||0,p=b;function h(t){"temperature"===o?e.elements.tempDisplay.innerText=t.toFixed(1):"target_temp_low"===o?e.elements.lowTempDisplay.innerText=t.toFixed(1):"target_temp_high"===o&&(e.elements.highTempDisplay.innerText=t.toFixed(1))}function m(){const t=parseFloat((0,n.IL)(e,o))||0;t!==p&&(b=t,p=t)}function g(){m();const t={entity_id:e.config.entity};"target_temp_low"===o?(t.target_temp_low=b,t.target_temp_high=(0,n.IL)(e,"target_temp_high")):"target_temp_high"===o?(t.target_temp_high=b,t.target_temp_low=(0,n.IL)(e,"target_temp_low")):t[o]=b,e._hass.callService("climate","set_temperature",t)}i.addEventListener("click",(()=>{m(),b=parseFloat((b-a).toFixed(1)),h(b),clearTimeout(u),u=setTimeout(g,700)})),r.addEventListener("click",(()=>{m(),b=parseFloat((b+a).toFixed(1)),h(b),clearTimeout(u),u=setTimeout(g,700)}))}e.elements.climateContainer=(0,n.az)("div","bubble-climate-container"),e.elements.climateCard=(0,n.az)("div","bubble-climate"),e.elements.buttonContainer=(0,n.az)("div","bubble-button-container"),e.elements.nameContainer=(0,n.az)("div","bubble-name-container"),e.elements.iconContainer=(0,n.az)("div","bubble-icon-container"),e.elements.name=(0,n.az)("div","bubble-name"),e.elements.state=(0,n.az)("div","bubble-state"),e.elements.icon=(0,n.az)("ha-icon","bubble-icon"),e.elements.image=(0,n.az)("div","bubble-entity-picture entity-picture"),e.elements.colorBackground=(0,n.az)("div","bubble-color-background"),e.elements.style=(0,n.az)("style"),e.elements.customStyle=(0,n.az)("style"),e.elements.style.innerText="\n * {\n -webkit-tap-highlight-color: transparent !important;\n }\n\n ha-card {\n margin-top: 0;\n background: none;\n opacity: 1;\n }\n .is-unavailable {\n opacity: 0.5;\n }\n\n .bubble-climate-container {\n position: relative;\n width: 100%;\n height: 50px;\n background-color: var(--bubble-climate-main-background-color, var(--bubble-main-background-color, var(--background-color-2, var(--secondary-background-color))));\n border-radius: var(--bubble-climate-border-radius, var(--bubble-border-radius, 32px));\n box-shadow: var(--bubble-climate-box-shadow, var(--bubble-box-shadow, none));\n overflow: visible;\n touch-action: pan-y;\n }\n\n .bubble-climate {\n display: flex;\n position: absolute;\n justify-content: space-between;\n align-items: center;\n height: 100%;\n width: 100%;\n transition: background-color 1.5s;\n background-color: rgba(0,0,0,0);\n }\n\n .bubble-button-container {\n display: inline-grid;\n grid-auto-flow: column;\n gap: 10px;\n align-self: center;\n align-items: center;\n margin-right: 8px;\n }\n\n .bubble-temperature-container, .bubble-low-temp-container, .bubble-high-temp-container {\n display: inline-flex;\n position: relative;\n font-size: 12px;\n white-space: nowrap;\n justify-content: center;\n align-items: center;\n width: auto;\n height: 100%;\n border-radius: var(--bubble-sub-button-border-radius, var(--bubble-border-radius, 32px));\n background-color: var(--bubble-climate-button-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background))));\n }\n\n .bubble-low-temp-container {\n color: var(--state-climate-heat-color, var(--state-climate-active-color, var(--state-active-color)));\n }\n\n .bubble-high-temp-container {\n color: var(--state-climate-cool-color, var(--state-climate-active-color, var(--state-active-color)));\n }\n\n .bubble-target-temperature-container {\n display: flex;\n gap: 10px;\n }\n\n .bubble-climate-minus-button,\n .bubble-climate-plus-button {\n display: flex;\n position: relative;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n width: 36px;\n height: 36px;\n vertical-align: middle;\n font-size: 18px;\n color: var(--primary-text-color);\n cursor: pointer;\n }\n\n .bubble-climate-minus-button-icon,\n .bubble-climate-plus-button-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n --mdc-icon-size: 16px;\n }\n\n .bubble-feedback-container {\n display: flex;\n width: 100%;\n height: 100%;\n position: absolute;\n border-radius: var(--bubble-sub-button-border-radius, var(--bubble-border-radius, 32px));\n overflow: hidden;\n pointer-events: none;\n }\n\n .bubble-feedback-element {\n position: absolute;\n top: 0;\n left: 0;\n opacity: 0;\n width: 100%;\n height: 100%;\n background-color: rgb(0,0,0);\n pointer-events: none;\n }\n\n .bubble-color-background {\n display: flex;\n width: 100%;\n height: 100%;\n position: absolute;\n border-radius: var(--bubble-climate-border-radius, var(--bubble-border-radius, 32px));\n opacity: 0.7;\n transition: background-color 2s ease;\n }\n\n .is-unavailable .bubble-climate {\n cursor: not-allowed;\n }\n\n .bubble-icon-container {\n display: flex;\n flex-wrap: wrap;\n width: 38px;\n height: 38px;\n min-width: 38px;\n min-height: 38px;\n align-items: center;\n justify-content: center;\n margin: 6px;\n border-radius: var(--bubble-climate-icon-border-radius, var(--bubble-icon-border-radius, var(--bubble-border-radius, 50%)));\n background-color: var(--bubble-climate-icon-background-color, var(--bubble-icon-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background)))));\n overflow: hidden;\n position: relative;\n cursor: pointer;\n pointer-events: auto;\n }\n\n .bubble-icon {\n opacity: 0.6;\n }\n\n .is-on .bubble-icon {\n filter: brightness(1.1);\n opacity: 1;\n }\n\n .bubble-icon {\n display: flex;\n position: absolute;\n height: 38px;\n width: 38px;\n justify-content: center;\n align-items: center;\n transition: all 2s;\n }\n\n .bubble-entity-picture {\n background-size: cover;\n background-position: center;\n height: 100%;\n width: 100%;\n position: absolute;\n }\n\n .bubble-name,\n .bubble-state {\n display: flex;\n margin: 2px 0;\n position: relative;\n white-space: nowrap;\n }\n\n .bubble-name-container {\n display: flex;\n line-height: 1em;\n flex-direction: column;\n justify-content: center;\n flex-grow: 1;\n font-weight: 600;\n margin-left: 4px;\n pointer-events: none;\n position: relative;\n overflow: hidden;\n }\n\n .bubble-name {\n font-size: 13px;\n margin: 2px 0;\n }\n\n .bubble-state {\n font-size: 12px;\n opacity: 0.7;\n margin: 2px 0;\n font-weight: normal;\n }\n\n .bubble-sub-button-container {\n right: 0 !important;\n }\n\n .hidden {\n display: none !important;\n }\n\n @keyframes tap-feedback {\n 0% {transform: translateX(-100%); opacity: 0;}\n 64% {transform: translateX(0); opacity: 0.1;}\n 100% {transform: translateX(100%); opacity: 0;}\n }\n\n .large .bubble-climate-container {\n height: 56px;\n border-radius: var(--bubble-climate-border-radius, var(--bubble-border-radius, 32px));\n }\n\n .large .bubble-icon-container {\n --mdc-icon-size: 24px;\n min-width: 42px !important;\n min-height: 42px !important;\n margin-left: 8px;\n }\n\n .rows-2 .bubble-sub-button-container {\n flex-direction: column;\n gap: 4px !important;\n display: grid !important;\n grid-template-columns: repeat(2, min-content);\n grid-template-rows: repeat(2, 1fr);\n grid-auto-flow: column;\n width: auto;\n }\n\n .rows-2 .bubble-sub-button {\n height: 20px !important;\n }\n",e.elements.iconContainer.appendChild(e.elements.icon),e.elements.iconContainer.appendChild(e.elements.image),e.elements.nameContainer.appendChild(e.elements.name),e.elements.nameContainer.appendChild(e.elements.state);const c=void 0!==o?.attributes?.target_temp_low,d=void 0!==o?.attributes?.target_temp_high;void 0!==o?.attributes?.temperature&&(e.elements.temperatureContainer=(0,n.az)("div","bubble-temperature-container"),l(e.elements.temperatureContainer,"temperature",r),e.elements.buttonContainer.appendChild(e.elements.temperatureContainer)),(c||d)&&(e.elements.targetTemperatureContainer=(0,n.az)("div","bubble-target-temperature-container"),c&&(e.elements.lowTempContainer=(0,n.az)("div","bubble-low-temp-container"),l(e.elements.lowTempContainer,"target_temp_low",r),e.elements.targetTemperatureContainer.appendChild(e.elements.lowTempContainer)),d&&(e.elements.highTempContainer=(0,n.az)("div","bubble-high-temp-container"),l(e.elements.highTempContainer,"target_temp_high",r),e.elements.targetTemperatureContainer.appendChild(e.elements.highTempContainer)),e.elements.buttonContainer.appendChild(e.elements.targetTemperatureContainer)),e.elements.climateCard.appendChild(e.elements.iconContainer),e.elements.climateCard.appendChild(e.elements.nameContainer),e.elements.climateCard.appendChild(e.elements.buttonContainer),e.elements.climateContainer.appendChild(e.elements.colorBackground),e.elements.climateContainer.appendChild(e.elements.climateCard),e.content.innerHTML="",e.content.appendChild(e.elements.climateContainer),e.content.appendChild(e.elements.style),e.content.appendChild(e.elements.customStyle),a(e.elements.iconContainer,e.config),e.cardType="climate"}(e),function(e){"unavailable"===(0,n.y0)(e)?e.card.classList.add("is-unavailable"):e.card.classList.remove("is-unavailable"),(0,n.pr)(e)?e.card.classList.add("is-on"):e.card.classList.remove("is-on")}(e),function(e){if(e.config.styles?.includes("card.querySelector('.bubble-name').innerText"))return;const t=(0,n.oY)(e);t!==e.previousName&&e.elements.name&&(e.elements.name.innerText=t,e.previousName=t,(0,n.GP)(e,e.elements.name,t))}(e),function(e){const t=(0,n.pr)(e),o=(0,n.q7)(e),a=(0,n.gJ)(e),i=e.elements.image.style.backgroundImage,r=e.elements.icon.icon,s=e.elements.icon.style.color;if(""!==a){const t="url("+a+")";i!==t&&(e.elements.image.style.backgroundImage=t),"none"!==e.elements.icon.style.display&&(e.elements.icon.style.display="none"),""!==e.elements.image.style.display&&(e.elements.image.style.display="")}else if(""!==o){r!==o&&(e.elements.icon.icon=o);const n=t?`var(--bubble-icon-background-color, ${se(e)})`:"inherit";s!==n&&(e.elements.icon.style.color=n),""!==e.elements.icon.style.display&&(e.elements.icon.style.display=""),"none"!==e.elements.image.style.display&&(e.elements.image.style.display="none")}else"none"!==e.elements.icon.style.display&&(e.elements.icon.style.display="none"),"none"!==e.elements.image.style.display&&(e.elements.image.style.display="none")}(e),H(e),function(e){const t=(0,n.IL)(e,"temperature");""===t?e.elements.temperatureContainer?.classList.add("hidden"):e.elements.temperatureContainer?.classList.remove("hidden"),t!==e.previousTemp&&(e.previousTemp=t,e.elements.tempDisplay&&(e.elements.tempDisplay.innerText=parseFloat(t).toFixed(1)))}(e),function(e){const t=(0,n.IL)(e,"target_temp_low"),o=e.config.hide_target_temp_low;""===t?e.elements.targetTemperatureContainer?.classList.add("hidden"):e.elements.targetTemperatureContainer?.classList.remove("hidden"),o?e.elements.lowTempContainer?.classList.add("hidden"):e.elements.lowTempContainer?.classList.remove("hidden"),t!==e.previousTargetTempLow&&(e.previousTargetTempLow=t,e.elements.lowTempDisplay&&(e.elements.lowTempDisplay.innerText=parseFloat(t).toFixed(1)))}(e),function(e){const t=(0,n.IL)(e,"target_temp_high");e.config.hide_target_temp_high?e.elements.highTempContainer?.classList.add("hidden"):e.elements.highTempContainer?.classList.remove("hidden"),t!==e.previousTargetTempHigh&&(e.previousTargetTempHigh=t,e.elements.highTempDisplay&&(e.elements.highTempDisplay.innerText=parseFloat(t).toFixed(1)))}(e),N(e,e.content,e.elements.buttonContainer,!0),function(e){q(e),(0,n.jx)(e);const t=(0,n.y0)(e);if(e.previousState!==t&&(e.previousState=t,e.elements.colorBackground.style.backgroundColor=`var(--bubble-climate-background-color, ${se(e)})`),e.config.card_layout,e.elements.hvacModeDropdown,!e.config.styles)return;let o="";try{o=e.config.styles?Function("hass","entity","state","icon","subButtonIcon","getWeatherIcon","card",`return \`${e.config.styles}\`;`)(e._hass,e.config.entity,t,e.elements.icon,e.subButtonIcon,n.X,e.card):""}catch(e){throw new Error(`Error in generating climate custom templates: ${e.message}`)}e.elements.customStyle&&(e.elements.customStyle.innerText=o)}(e)}(this)}var e}setConfig(e){if(e.error)throw new Error(e.error);if("pop-up"===e.card_type){if(!e.hash)throw new Error("You need to define an hash. Please note that this card must be placed inside a vertical_stack to work as a pop-up.")}else if("horizontal-buttons-stack"===e.card_type){var t={};for(var n in e)if(n.match(/^\d+_icon$/)){var o=n.replace("_icon","_link");if(void 0===e[o])throw new Error("You need to define "+o);if(t[e[o]])throw new Error("You can't use "+e[o]+" twice");t[e[o]]=!0}}else if(["button","cover","climate","select","media-player"].includes(e.card_type)&&!e.entity&&"name"!==e.button_type)throw new Error("You need to define an entity");if("select"===e.card_type&&e.entity&&!e.select_attribute&&!e.entity?.startsWith("input_select")&&!e.entity?.startsWith("select"))throw new Error('"Select menu (from attributes)" missing');if(window.entityError)throw new Error("You need to define a valid entity");if("button"===e.card_type){const t={...e},n=t.button_type||"switch";t.tap_action=t.tap_action??{action:"more-info"},t.double_tap_action=t.double_tap_action??{action:"state"===n?"more-info":"toggle"},t.hold_action=t.hold_action??{action:"state"===n?"more-info":"toggle"},this.config=t}else this.config=e;this._hass&&this.updateBubbleCard()}getCardSize(){switch(this.config.card_type){case"pop-up":return-1e5;case"button":case"separator":case"empty-column":case"media-player":case"select":case"climate":return 1;case"cover":return 2;case"horizontal-buttons-stack":return 0}}static getConfigElement(){return function(){if(!le)try{le=Object.getPrototypeOf(customElements.get("ha-panel-lovelace")),ce=le.prototype?.html,de=le.prototype?.css}catch(e){return void console.error(e.message)}customElements.get("bubble-card-editor")||customElements.define("bubble-card-editor",class extends le{setConfig(e){this._config={...e}}static get properties(){return{hass:{},_config:{}}}get _card_type(){return this._config?.card_type||""}get _button_type(){return this._config?.button_type||("pop-up"===this._config?.card_type?"":"switch")}get _entity(){return this._config?.entity||""}get _name(){return this._config?.name||""}get _icon(){return this._config?.icon||""}get _state(){return this._config?.state||""}get _text(){return this._config?.text||""}get _hash(){return this._config?.hash||"#pop-up-name"}get _trigger_entity(){return this._config?.trigger_entity||""}get _trigger_state(){return this._config?.trigger_state||""}get _trigger_close(){return this._config?.trigger_close||!1}get _margin(){return this._config?.margin||"7px"}get _margin_top_mobile(){return this._config?.margin_top_mobile||"0px"}get _margin_top_desktop(){return this._config?.margin_top_desktop||"0px"}get _width_desktop(){return this._config?.width_desktop||"540px"}get _bg_color(){return this._config?.bg_color||""}get _bg_opacity(){return void 0!==this._config?.bg_opacity?this._config?.bg_opacity:"88"}get _bg_blur(){return void 0!==this._config?.bg_blur?this._config?.bg_blur:"10"}get _backdrop_blur(){return void 0!==this._config?.backdrop_blur?this._config?.backdrop_blur:"0"}get _shadow_opacity(){return void 0!==this._config?.shadow_opacity?this._config?.shadow_opacity:"0"}get _rise_animation(){return void 0===this._config?.rise_animation||this._config?.rise_animation}get _auto_close(){return this._config?.auto_close||""}get _close_on_click(){return this._config?.close_on_click||!1}get _close_by_clicking_outside(){return this._config?.close_by_clicking_outside??!0}get _background_update(){return this._config?.background_update||!1}get _icon_open(){return this._config?.icon_open||""}get _icon_close(){return this._config?.icon_close||""}get _icon_down(){return this._config?.icon_down||""}get _icon_up(){return this._config?.icon_up||""}get _open_service(){return this._config?.open_service||"cover.open_cover"}get _close_service(){return this._config?.close_service||"cover.close_cover"}get _stop_service(){return this._config?.stop_service||"cover.stop_cover"}get _auto_order(){return this._config?.auto_order||!1}get _highlight_current_view(){return this._config?.highlight_current_view||!1}get _show_state(){const e="state"===this._config?.card_type;return this._config?.show_state||e}get _show_attribute(){const e="state"===this._config.card_type;return this._config.show_attribute||e}get _show_last_changed(){const e="state"===this._config.card_type;return this._config.show_last_changed||this._config.show_last_updated||e}get _attribute(){return this._config.attribute||!1}get _hide_backdrop(){return this._config.hide_backdrop??!1}get _hide_gradient(){return this._config.hide_gradient||!1}get _hide_play_pause_button(){return this._config.hide?.play_pause_button||!1}get _hide_next_button(){return this._config.hide?.next_button||!1}get _hide_previous_button(){return this._config.hide?.previous_button||!1}get _hide_volume_button(){return this._config.hide?.volume_button||!1}get _hide_power_button(){return this._config.hide?.power_button||!1}get _sub_button(){return this._config.sub_button||""}get _button_action(){return this._config.button_action||""}get _open_action(){return this._config.open_action||""}get _close_action(){return this._config.close_action||""}get _show_header(){return this._config.show_header??!0}get _slide_to_close_distance(){return this._config.slide_to_close_distance??400}get _slider_live_update(){return this._config.slider_live_update??!1}get _cover_background(){return this._config.cover_background??!1}get _tap_action(){return{action:this._config.tap_action?.action||"more-info",navigation_path:this._config.tap_action?.navigation_path||"",url_path:this._config.tap_action?.url_path||"",service:this._config.tap_action?.service||"",target_entity:this._config.tap_action?.target?.entity_id||"",data:this._config.tap_action?.data||""}}get _double_tap_action(){return{action:this._config.double_tap_action?.action||"toggle",navigation_path:this._config.double_tap_action?.navigation_path||"",url_path:this._config.double_tap_action?.url_path||"",service:this._config.double_tap_action?.service||"",target_entity:this._config.double_tap_action?.target?.entity_id||"",data:this._config.double_tap_action?.data||""}}get _hold_action(){return{action:this._config.hold_action?.action||"toggle",navigation_path:this._config.hold_action?.navigation_path||"",url_path:this._config.hold_action?.url_path||"",service:this._config.hold_action?.service||"",target_entity:this._config.hold_action?.target?.entity_id||"",data:this._config.hold_action?.data||""}}get _selectable_attributes(){return["source_list","sound_mode_list","hvac_modes","fan_modes","swing_modes","preset_modes","effect_list"]}render(){if(!this.hass)return ce``;const t=document.querySelector("body > home-assistant").shadowRoot.querySelector("hui-dialog-edit-card").shadowRoot.querySelector("ha-dialog > div.content > div.element-preview");if("sticky"!==t.style.position&&(t.style.position="sticky",t.style.top="0"),!this.listsUpdated){const s=e=>({label:e,value:e});this.allEntitiesList=Object.keys(this.hass.states).map(s),this.lightList=Object.keys(this.hass.states).filter((e=>"light"===e.substr(0,e.indexOf(".")))).map(s),this.sensorList=Object.keys(this.hass.states).filter((e=>"sensor"===e.substr(0,e.indexOf(".")))).map(s),this.binarySensorList=Object.keys(this.hass.states).filter((e=>"binary_sensor"===e.substr(0,e.indexOf(".")))).map(s),this.coverList=Object.keys(this.hass.states).filter((e=>"cover"===e.substr(0,e.indexOf(".")))).map(s),this.mediaPlayerList=Object.keys(this.hass.states).filter((e=>"media_player"===e.substr(0,e.indexOf(".")))).map(s),this.climateList=Object.keys(this.hass.states).filter((e=>"climate"===e.substr(0,e.indexOf(".")))).map(s),this.inputSelectList=Object.keys(this.hass.states).filter((e=>{const t=this.hass.states[e],n=e.substr(0,e.indexOf(".")),o="input_select"===n||"select"===n,a=this._selectable_attributes.some((e=>t.attributes?.[e]));return o||a})).map(s),this.attributeList=Object.keys(this.hass.states[this._entity]?.attributes||{}).map((e=>{let t=this.hass.states[this._entity];return{label:this.hass.formatEntityAttributeName(t,e),value:e}})),this.cardTypeList=[{label:"Button (Switch, slider, ...)",value:"button"},{label:"Cover",value:"cover"},{label:"Climate",value:"climate"},{label:"Empty column",value:"empty-column"},{label:"Horizontal buttons stack",value:"horizontal-buttons-stack"},{label:"Media player",value:"media-player"},{label:"Pop-up",value:"pop-up"},{label:"Select",value:"select"},{label:"Separator",value:"separator"}],this.buttonTypeList=[{label:"Switch",value:"switch"},{label:"Slider",value:"slider"},{label:"State",value:"state"},{label:"Name / Text",value:"name"}],this.tapActionTypeList=[{label:"More info",value:"more-info"},{label:"Toggle",value:"toggle"},{label:"Navigate",value:"navigate"},{label:"URL",value:"url"},{label:"Call service",value:"call-service"},{label:"Assist",value:"assist"},{label:"No action",value:"none"}],this.listsUpdated=!0}const n=this.allEntitiesList,o=(this.lightList,this.sensorList,this.coverList),a=this.cardTypeList,i=this.buttonTypeList,r="name"===this._config?.button_type;if("pop-up"===this._config?.card_type){const l=this._config?.trigger??[];return ce` +
+ ${this.makeDropdown("Card type","card_type",a)} + + +

+ + Header settings +

+
+ + +
+ +
+
+ You can completely hide the pop-up header, including the close button. To close it when hidden, either make a long swipe within the pop-up or click outside of it. +
+
+ ${this.makeDropdown("Button type","button_type",i)} + ${this.makeDropdown("Optional - Entity","entity",n,r)} + + ${this.makeDropdown("Optional - Icon","icon")} + ${this.makeShowState()} +
+ +

+ + Tap action on icon +

+
+ ${this.makeTapActionPanel("Tap action")} + ${this.makeTapActionPanel("Double tap action")} + ${this.makeTapActionPanel("Hold action")} +
+
+ +

+ + Tap action on button +

+
+ ${this.makeTapActionPanel("Tap action",this._button_action,"name"!==this._config.button_type?"state"===this._config.button_type?"more-info":"toggle":"none","button_action")} + ${this.makeTapActionPanel("Double tap action",this._button_action,"name"!==this._config.button_type?"state"===this._config.button_type?"more-info":"toggle":"none","button_action")} + ${this.makeTapActionPanel("Hold action",this._button_action,"name"!==this._config.button_type?"more-info":"none","button_action")} +
+
+ ${this.makeSubButtonPanel()} +
+
+
+ +

+ + Pop-up settings +

+
+ + + + +
+ +
+
+ + +
+ +
+
+ + +
+ +
+
+ Background updates are only recommended if you encounter issues with certain cards within your pop-up. +
+
+ +

+ + Pop-up trigger +

+
+ this._conditionChanged(e)} + > + + + The pop-up will be opened when ALL conditions are fulfilled. For example you can open a "Security" pop-up with a camera when a person is in front of your house. You can also create a toggle helper (input_boolean) and trigger its opening/closing in an automation. + +
+
+ +

+ + Pop-up open/close action +

+
+ ${this.makeTapActionPanel("Open action",this._config,"none")} + ${this.makeTapActionPanel("Close action",this._config,"none")} + This allows you to trigger an action on pop-up open/close. +
+
+ +

+ + Styling options +

+
+ ${this.makeLayoutOptions()} + +

+ + Pop-up styling +

+
+ + + + + + + + + + + +
+ +
+
+ Set this toggle to true on the first pop-up of your main dashboard to hide the darker backdrop behind all pop-ups. You can add a blurred effect to it by changing Optional - Backdrop blur just below, but be aware that this can slow down your dashboard when opening pop-ups. It is now set to 0 for that reason. +
+
+ ${this.makeStyleEditor()} +
+
+ + This card allows you to convert any vertical stack into a pop-up. Each pop-up is hidden by default and can be opened by targeting its link (e.g., '#pop-up-name'), with any card that supports the navigate action, or with the horizontal buttons stack that is included. +

Important: This card must be placed within a vertical stack card at the topmost position to function properly. To avoid misalignment with your view, place vertical stacks/pop-ups after all other dashboard cards. It should be called from the same view to work. +

You can also watch this video that explains how to create your first pop-up. +
+ Since v1.7.0, the optimized mode has been removed to ensure stability and to simplify updates for everyone. However, if your pop-up content still appears on the screen during page loading, you can install this similar fix. + ${this.makeVersion()} +
+ `}if("button"===this._config?.card_type)return ce` +
+ ${this.makeDropdown("Card type","card_type",a)} + ${this.makeDropdown("Button type","button_type",i)} + ${this.makeDropdown("slider"!==this._button_type?"Entity (toggle)":"Entity (light, media_player, cover or input_number)","entity",n,r)} + +

+ + Button settings +

+
+ + ${this.makeDropdown("Optional - Icon","icon")} + ${this.makeShowState()} + + +
+ +
+
+ By default, sliders are updated only on release. You can toggle this option to enable live updates while sliding. +
+
+ +

+ + Tap action on icon +

+
+ ${this.makeTapActionPanel("Tap action")} + ${this.makeTapActionPanel("Double tap action")} + ${this.makeTapActionPanel("Hold action")} +
+
+ +

+ + Tap action on button +

+
+ ${this.makeTapActionPanel("Tap action",this._button_action,"name"!==this._config.button_type?"state"===this._config.button_type?"more-info":"toggle":"none","button_action")} + ${this.makeTapActionPanel("Double tap action",this._button_action,"name"!==this._config.button_type?"state"===this._config.button_type?"more-info":"toggle":"none","button_action")} + ${this.makeTapActionPanel("Hold action",this._button_action,"name"!==this._config.button_type?"more-info":"none","button_action")} +
+
+ +

+ + Styling options +

+
+ ${this.makeLayoutOptions()} + ${this.makeStyleEditor()} +
+
+ ${this.makeSubButtonPanel()} + This card allows you to control your entities. ${"slider"===this._config.button_type?"Supported entities: Light (brightness), media player (volume), cover (position), fan (percentage), climate (temperature), input number and number (value). To access color / control of an entity, simply tap on the icon.":""} + ${this.makeVersion()} +
+ `;if("separator"===this._config?.card_type)return ce` +
+ ${this.makeDropdown("Card type","card_type",a)} + + ${this.makeDropdown("Icon","icon")} + +

+ + Styling options +

+
+ ${this.makeLayoutOptions()} + ${this.makeStyleEditor()} +
+
+ ${this.makeSubButtonPanel()} + This card is a simple separator for dividing your pop-up into categories / sections. e.g. Lights, Devices, Covers, Settings, Automations... + ${this.makeVersion()} +
+ `;if("horizontal-buttons-stack"===this._config?.card_type){if(!this.buttonAdded)for(this.buttonAdded=!0,this.buttonIndex=0;this._config[this.buttonIndex+1+"_link"];)this.buttonIndex++;function c(){this.buttonIndex++,this.requestUpdate()}return ce` +
+ ${this.makeDropdown("Card type","card_type",a)} +
+ ${this.makeButton()} +
+ + + +
+ +
+
+ +

+ + Styling options +

+
+ +

+ + Horizontal buttons stack styling +

+
+ + + + +
+ +
+
+ + +
+ +
+
+ + +
+ +
+
+
+
+ ${this.makeStyleEditor()} +
+
+ This card is the companion to the pop-up card, allowing you to open the corresponding pop-ups. It also allows you to open any page of your dashboard. In addition, you can add your motion sensors so that the order of the buttons adapts according to the room you just entered. This card is scrollable, remains visible and acts as a footer. + ${this.makeVersion()} +
+ `}if("cover"===this._config?.card_type)return ce` +
+ ${this.makeDropdown("Card type","card_type",a)} + ${this.makeDropdown("Entity","entity",o)} + +

+ + Cover settings +

+
+ + ${this.makeDropdown("Optional - Open icon","icon_open")} + ${this.makeDropdown("Optional - Closed icon","icon_close")} + ${this.makeShowState()} +
+
+ +

+ + Custom services +

+
+ + + +
+
+ +

+ + Tap action on icon +

+
+ ${this.makeTapActionPanel("Tap action")} + ${this.makeTapActionPanel("Double tap action")} + ${this.makeTapActionPanel("Hold action")} +
+
+ +

+ + Styling options +

+
+ ${this.makeLayoutOptions()} + +

+ + Cover styling +

+
+ ${this.makeDropdown("Optional - Arrow down icon","icon_down")} + ${this.makeDropdown("Optional - Arrow up icon","icon_up")} +
+
+ ${this.makeStyleEditor()} +
+
+ ${this.makeSubButtonPanel()} + This card allows you to control your covers. + ${this.makeVersion()} +
+ `;if("media-player"===this._config?.card_type)return ce` +
+ ${this.makeDropdown("Card type","card_type",a)} + ${this.makeDropdown("Entity","entity",this.mediaPlayerList)} + +

+ + Media player settings +

+
+ + ${this.makeDropdown("Optional - Icon","icon")} + ${this.makeShowState()} +
+
+ +

+ + Display/hide buttons +

+
+ + +
+ +
+
+ + +
+ +
+
+ + +
+ +
+
+ + +
+ +
+
+ + +
+ +
+
+
+
+ +

+ + Tap action on icon +

+
+ ${this.makeTapActionPanel("Tap action")} + ${this.makeTapActionPanel("Double tap action")} + ${this.makeTapActionPanel("Hold action")} +
+
+ +

+ + Styling options +

+
+ ${this.makeLayoutOptions()} + +

+ + Media player styling +

+
+ + +
+ +
+
+
+
+ ${this.makeStyleEditor()} +
+
+ ${this.makeSubButtonPanel()} + This card allows you to control a media player. You can tap on the icon to get more control. + ${this.makeVersion()} +
+ `;if("empty-column"===this._config?.card_type)return ce` +
+ ${this.makeDropdown("Card type","card_type",a)} + +

+ + Styling options +

+
+ ${this.makeLayoutOptions()} +
+
+ Just an empty card to fill any empty column. + ${this.makeVersion()} +
+ `;if("select"===this._config?.card_type){const d=this._config.entity,u=(d?.startsWith("input_select")||d?.startsWith("select")||this._config.select_attribute,this.hass.states[d]?.attributes),b=this._selectable_attributes.some((e=>u?.[e])),p=Object.keys(this.hass.states[d]?.attributes||{}).map((e=>{let t=this.hass.states[d];return{label:this.hass.formatEntityAttributeName(t,e),value:e}})).filter((e=>this._selectable_attributes.includes(e.value)));return ce` +
+ ${this.makeDropdown("Card type","card_type",a)} + ${this.makeDropdown("Entity","entity",this.inputSelectList)} + ${b?ce` +
+ +
+ `:""} + +

+ + Button settings +

+
+ + ${this.makeDropdown("Optional - Icon","icon")} + ${this.makeShowState()} +
+
+ +

+ + Tap action on icon +

+
+ ${this.makeTapActionPanel("Tap action")} + ${this.makeTapActionPanel("Double tap action")} + ${this.makeTapActionPanel("Hold action")} +
+
+ +

+ + Styling options +

+
+ ${this.makeLayoutOptions()} + ${this.makeStyleEditor()} +
+
+ ${this.makeSubButtonPanel()} + + This card allows you to have a select menu for your + input_select, select entities, and + any other entities that have attribute lists like + source_list, sound_mode_list, + hvac_modes, fan_modes, + swing_modes, preset_modes, or + effect_list. + + ${this.makeVersion()} +
+ `}if("climate"===this._config?.card_type){if("climate"===this._config.card_type&&!this.climateSubButtonsAdded&&this._config.entity){const h=this.hass.states[this._config.entity]?.attributes?.hvac_modes;this._config.sub_button&&0!==this._config.sub_button.length||(this._config.sub_button=[h?{name:"HVAC modes menu",select_attribute:"hvac_modes",state_background:!1,show_arrow:!1}:null].filter(Boolean)),this.climateSubButtonsAdded=!0}return ce` +
+ ${this.makeDropdown("Card type","card_type",a)} + ${this.makeDropdown("Entity","entity",this.climateList)} + +

+ + Climate settings +

+
+ + ${this.makeDropdown("Optional - Icon","icon")} + ${this.makeShowState()} + ${this.hass.states[this._config.entity]?.attributes?.target_temp_low?ce` + + +
+ +
+
+ `:""} + ${this.hass.states[this._config.entity]?.attributes?.target_temp_high?ce` + + +
+ +
+
+ `:""} + + +
+ +
+
+
+
+ +

+ + Tap action on icon +

+
+ ${this.makeTapActionPanel("Tap action")} + ${this.makeTapActionPanel("Double tap action")} + ${this.makeTapActionPanel("Hold action")} +
+
+ +

+ + Styling options +

+
+ ${this.makeLayoutOptions()} + ${this.makeStyleEditor()} +
+
+ ${this.makeSubButtonPanel()} + This card allows you to control your climate entities. You can also add a sub-button that display a select menu for your climate modes (check if you have "Select menu" available when you create a new sub-button). + ${this.makeVersion()} +
+ `}return this._config?.card_type?void 0:ce` +
+ ${this.makeDropdown("Card type","card_type",a)} + You need to add a card type first. Please note that in some cases, a page refresh might be needed after exiting the editor. + +

The Bubble Card ${e} changelog is available here.

+
+

If you have an issue or a question you can find more details in the GitHub documentation. You can also find useful resources and help in these links.

+
+ + + + +
+
+

I dedicate most of my spare time to making this project the best it can be. So if you appreciate my work, any donation would be a great way to show your support.

+
+ + +
+

Looking for more advanced examples? Check out my Patreon for exclusive custom styles and templates!

+ +

Thank you! 🍻

+ ${this.makeVersion()} +
+ `}makeLayoutOptions(){return ce` + + +

+ + Layout options for sections +

+
+ + +
+
+ `}makeShowState(e=this._config,t="",n=!1,o){const a=e?.entity??this._config.entity??"",i="name"===this._config.button_type,r=a?.startsWith("input_select")||a?.startsWith("select")||e.select_attribute,s=Object.keys(this.hass.states[a]?.attributes||{}).map((e=>{let t=this.hass.states[a];return{label:this.hass.formatEntityAttributeName(t,e),value:e}}));return ce` + ${"sub_button"!==n?ce` + + +
+ +
+
+ `:""} + ${"sub_button"===n?ce` + + +
+ +
+
+ `:""} + ${"sub_button"===n&&(e?.show_background??1)?ce` + + +
+ +
+
+ `:""} + ${"sub_button"===n&&(e?.state_background??1)&&a.startsWith("light")?ce` + + +
+ +
+
+ `:""} + ${"sub_button"!==n&&a.startsWith("light")?ce` + + +
+ +
+
+ `:""} + + +
+ +
+
+ ${"sub_button"!==n?ce` + + +
+ +
+
+ `:""} + + +
+ +
+
+ + +
+ +
+
+ + +
+ +
+
+ + +
+ +
+
+ ${e?.show_attribute?ce` +
+ +
+ `:""} + ${"sub_button"===n&&r?ce` + + +
+ +
+
+ `:""} + `}makeDropdown(e,t,n,o){return e.includes("icon")||e.includes("Icon")?ce` +
+ +
+ `:ce` +
+ +
+ `}makeTapActionPanel(e,t=this._config,n,o,a=this._config){this.hass;const i="Tap action"===e?"mdi:gesture-tap":"Double tap action"===e?"mdi:gesture-double-tap":"Hold action"===e?"mdi:gesture-tap-hold":"mdi:gesture-tap",r="Tap action"===e?t.tap_action:"Double tap action"===e?t.double_tap_action:"Hold action"===e?t.hold_action:"Open action"===e?t.open_action:t.close_action,s="Tap action"===e?"tap_action":"Double tap action"===e?"double_tap_action":"Hold action"===e?"hold_action":"Open action"===e?"open_action":"close_action",l=t===this._config;return n||(n=l&&"Tap action"===e?"name"!==this._config.button_type?"more-info":"none":l?"name"!==this._config.button_type?"toggle":"none":""),ce` + +

+ + ${e} +

+
+
+ +
+ ${"navigate"===r?.action?ce` +
+ +
+ `:""} + ${"url"===r?.action?ce` +
+ +
+ `:""} + ${"call-service"===r?.action?ce` +
+ +
+
+ {this._tapActionValueChange(a,{[s]:{target:{entity_id:e.detail.value}}},o)}:""}" + > +
+ + +
+ +
+
+ `:""} + ${"call-service"===r?.action&&r?.service?ce` + For now, you still need to switch to the YAML editor if you want to add data: to your service. + `:""} +
+
+ `}makeSubButtonPanel(){const e=this._config?.sub_button?.map(((e,t)=>{if(!e)return;const n="sub_button."+t+".",o=e.entity??this._config.entity,a=o?.startsWith("input_select")||o?.startsWith("select")||e.select_attribute,i=this.hass.states[o]?.attributes,r=this._selectable_attributes.some((e=>i?.[e])),s=Object.keys(this.hass.states[o]?.attributes||{}).map((e=>{let t=this.hass.states[o];return{label:this.hass.formatEntityAttributeName(t,e),value:e}})).filter((e=>this._selectable_attributes.includes(e.value))),l=e.visibility??[];return ce` + +

+ + ${this._config.sub_button[t]?"Button "+(t+1)+(e.name?" - "+e.name:""):"New button"} + + ${t>0?ce``:""} + ${t + + `:""} +

+
+ +

+ + Button settings +

+
+
+ +
+ ${r?ce` +
+ +
+ `:""} +
+ +
+
+ +
+ ${this.makeShowState(e,n,"sub_button",t)} +
+
+ +

+ + Tap action on button +

+
+ ${this.makeTapActionPanel("Tap action",e,"more-info","sub_button",t)} + ${this.makeTapActionPanel("Double tap action",e,"none","sub_button",t)} + ${this.makeTapActionPanel("Hold action",e,"none","sub_button",t)} +
+
+ +

+ + Visibility +

+
+ this._conditionChanged(e,t,"sub_button")} + > + + + The sub-button will be shown when ALL conditions are fulfilled. If no conditions are set, the sub-button will always be shown. + +
+
+
+
+ `}));return ce` + +

+ + Sub-buttons editor +

+
+ ${e} + + + Add new customized buttons fixed to the right. + These buttons can also display a select menu for your + input_select, select entities, and + any other entities that have attribute lists like + source_list, sound_mode_list, + hvac_modes, fan_modes, + swing_modes, preset_modes, or + effect_list. + +
+
+ `}makeButton(){let e=[];for(let t=1;t<=this.buttonIndex;t++)e.push(ce` +
+ +

+ + Button ${t} ${this._config[t+"_name"]?"- "+this._config[t+"_name"]:""} + +

+
+ + + + + + In fact you can also get the auto order with any entity type, for example you can add light groups to these fields and the order will change based on the last changed states. +
+
+
+ `);return e}makeVersion(){return ce` +

+ Bubble Card + + ${e} + +

+ `}removeButton(e){delete this._config[e+"_name"],delete this._config[e+"_icon"],delete this._config[e+"_link"],delete this._config[e+"_entity"],delete this._config[e+"_pir_sensor"];for(let t=e;t +

+ + Custom styles / Templates +

+
+
+ +
+ + For advanced users, you can edit the CSS style of this card in this editor. More information here. You don't need to add styles: |, it will be added automatically. You can also add templates. +

Looking for more advanced examples? Check out my Patreon for exclusive custom styles and advanced templates, this is also the best way to show your support to my project! +
+
+ + `}_valueChanged(e){const t=e.target,o=e.detail;let a;if("HA-SWITCH"===t.tagName?a=t.checked:void 0!==t.value&&(a="string"==typeof t.value?t.value.replace(",","."):t.value),"string"==typeof a&&(a.endsWith(".")||"-"===a))return;const{configValue:i,checked:r}=t;if(i){const n=i.split(".");let r=this._config;for(let e=0;ethis._arrayValueChange(e,t,o)),10);this._config[o]=this._config[o]||[];let a=[...this._config[o]];a[e]=a[e]||{},a[e]={...a[e],...t},this._config[o]=a,(0,n.BX)(this,"config-changed",{config:this._config}),this.requestUpdate()}_tapActionValueChange(e,t,o){if(void 0===o)for(let e in t)this._config[e]={...this._config[e],...t[e]};else{this._config[o]=this._config[o]||(o?{}:[]);let n=Array.isArray(this._config[o])?[...this._config[o]]:{...this._config[o]};if(Array.isArray(n)){n[e]=n[e]||{};let o={...n[e]};for(let e in t)o[e]=e in o?{...o[e],...t[e]}:t[e];n[e]=o}else for(let e in t)n.hasOwnProperty(e)?n[e]={...n[e],...t[e]}:n[e]=t[e];this._config[o]=n}(0,n.BX)(this,"config-changed",{config:this._config}),this.requestUpdate()}_conditionChanged(e,t,o){if(e.stopPropagation(),o){this._config[o]=this._config[o]||[];let n=[...this._config[o]];n[t]=n[t]||{};const a=e.detail.value;n[t]={...n[t],visibility:a},this._config[o]=n}else if("pop-up"===this._config.card_type){const t=e.detail.value;this._config={...this._config,trigger:t}}(0,n.BX)(this,"config-changed",{config:this._config}),this.requestUpdate()}static get styles(){return de` + div { + display: grid; + grid-gap: 12px; + } + + ha-combo-box[label="Card type"]::after { + content: ""; + position: relative; + background-color: var(--background-color, var(--secondary-background-color)); + display: block; + width: 100%; + height: 1px; + top: 12px; + margin-bottom: 12px !important; + opacity: 0.6; + } + + #add-button { + margin: 0 0 14px 0; + color: var(--text-primary-color); + width: 100%; + height: 32px; + border-radius: 16px; + border: none; + background-color: var(--accent-color); + cursor: pointer; + } + + p { + margin-bottom: 4px; + } + + ha-icon, a, p, button, h4 { + color: var(--primary-text-color) !important; + } + + hr { + display: inline-block; + width: 100%; + border: 1px solid var(--background-color, var(--secondary-background-color)); + opacity: 0.6; + margin: 8px 0 0 0; + } + + code { + background: var(--accent-color); + background-blend-mode: darken; + padding: 2px 4px; + border-radius: 6px; + } + + .button-header { + height: auto; + width: 100%; + display: inline-flex; + align-items: center; + margin: 0 8px; + } + + .button-number { + display: inline-flex; + width: auto; + } + + .remove-button { + display: inline-flex; + border-radius: 50%; + width: 24px; + height: 24px; + text-align: center; + line-height: 24px; + vertical-align: middle; + cursor: pointer; + } + + .content { + margin: 12px 4px 14px 4px; + } + + h4 > ha-icon { + margin: 8px; + } + + ha-textfield { + width: 100%; + } + + h3 { + margin: 4px 0; + } + + .code-editor { + overflow: scroll; + } + + .icon-button { + background: var(--accent-color); + border: none; + cursor: pointer; + padding: 8px; + margin: 0; + border-radius: 32px; + font-weight: bold; + } + + .icon-button.header { + background: none; + float: right; + padding: 0; + margin: 0 8px; + } + + ha-card-conditions-editor { + margin-top: -12px; + } + `}})}(),document.createElement("bubble-card-editor")}getLayoutOptions(){let e=1;"pop-up"===this.config.card_type?e=0:"horizontal-buttons-stack"===this.config.card_type?e=1:["cover"].includes(this.config.card_type)&&(e=2);let t=4;return"pop-up"===this.config.card_type?t=0:"horizontal-buttons-stack"===this.config.card_type&&(t=4),{grid_columns:this.config.columns??t,grid_rows:this.config.rows??e}}}customElements.define("bubble-card",ue),window.customCards=window.customCards||[],window.customCards.push({type:"bubble-card",name:"Bubble Card",preview:!1,description:"A minimalist card collection with a nice pop-up touch.",documentationURL:"https://github.com/Clooos/Bubble-Card/"}),console.info(`%c Bubble Card %c ${e} `,"background-color: #555;color: #fff;padding: 3px 2px 3px 3px;border-radius: 14px 0 0 14px;font-family: DejaVu Sans,Verdana,Geneva,sans-serif;text-shadow: 0 1px 0 rgba(1, 1, 1, 0.3)","background-color: #506eac;color: #fff;padding: 3px 3px 3px 2px;border-radius: 0 14px 14px 0;font-family: DejaVu Sans,Verdana,Geneva,sans-serif;text-shadow: 0 1px 0 rgba(1, 1, 1, 0.3)")})()})(); \ No newline at end of file diff --git a/config/www/community/Bubble-Card/bubble-card.js.gz b/config/www/community/Bubble-Card/bubble-card.js.gz new file mode 100644 index 00000000..24798767 Binary files /dev/null and b/config/www/community/Bubble-Card/bubble-card.js.gz differ diff --git a/config/www/community/Bubble-Card/bubble-pop-up-fix.js b/config/www/community/Bubble-Card/bubble-pop-up-fix.js new file mode 100644 index 00000000..93bed4f8 --- /dev/null +++ b/config/www/community/Bubble-Card/bubble-pop-up-fix.js @@ -0,0 +1 @@ +!function(){const e=document.querySelector("body");let a=customElements.get("bubble-card");const t=setInterval((function(){a=customElements.get("bubble-card"),a?(clearInterval(t),e.style.transition="opacity 0.5s",e.style.opacity="1"):e.style.opacity="0"}),0);setTimeout((function(){clearInterval(t),e.style.transition="opacity 0.5s",e.style.opacity="1"}),1500)}(),console.info("%c Bubble Card %c Pop-up fix","background-color: #555;color: #fff;padding: 3px 2px 3px 3px;border-radius: 14px 0 0 14px;font-family: DejaVu Sans,Verdana,Geneva,sans-serif;text-shadow: 0 1px 0 rgba(1, 1, 1, 0.3)","background-color: #506eac;color: #fff;padding: 3px 3px 3px 2px;border-radius: 0 14px 14px 0;font-family: DejaVu Sans,Verdana,Geneva,sans-serif;text-shadow: 0 1px 0 rgba(1, 1, 1, 0.3)"); \ No newline at end of file diff --git a/config/www/community/Bubble-Card/bubble-pop-up-fix.js.gz b/config/www/community/Bubble-Card/bubble-pop-up-fix.js.gz new file mode 100644 index 00000000..1117c29d Binary files /dev/null and b/config/www/community/Bubble-Card/bubble-pop-up-fix.js.gz differ diff --git a/config/www/community/frigate-hass-card/audio-cf3a75aa.js b/config/www/community/frigate-hass-card/audio-cf3a75aa.js new file mode 100644 index 00000000..268044d1 --- /dev/null +++ b/config/www/community/frigate-hass-card/audio-cf3a75aa.js @@ -0,0 +1 @@ +const o=o=>void 0!==o.mozHasAudio?o.mozHasAudio:void 0===o.audioTracks||Boolean(o.audioTracks?.length);export{o as m}; diff --git a/config/www/community/frigate-hass-card/audio-cf3a75aa.js.gz b/config/www/community/frigate-hass-card/audio-cf3a75aa.js.gz new file mode 100644 index 00000000..892aa7da Binary files /dev/null and b/config/www/community/frigate-hass-card/audio-cf3a75aa.js.gz differ diff --git a/config/www/community/frigate-hass-card/card-09c4bade.js b/config/www/community/frigate-hass-card/card-09c4bade.js new file mode 100644 index 00000000..0d54082a --- /dev/null +++ b/config/www/community/frigate-hass-card/card-09c4bade.js @@ -0,0 +1,650 @@ +function e(e,t,n,a){var i,r=arguments.length,o=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,n):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,a);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(r<3?i(o):r>3?i(t,n,o):i(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o}"function"==typeof SuppressedError&&SuppressedError; +/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const t=globalThis,n=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,a=Symbol(),i=new WeakMap;let r=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==a)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(n&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=i.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&i.set(t,e))}return e}toString(){return this.cssText}};const o=e=>new r("string"==typeof e?e:e+"",void 0,a),s=(e,...t)=>{const n=1===e.length?e[0]:t.reduce(((t,n,a)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+e[a+1]),e[0]);return new r(n,e,a)},c=(e,a)=>{if(n)e.adoptedStyleSheets=a.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(const n of a){const a=document.createElement("style"),i=t.litNonce;void 0!==i&&a.setAttribute("nonce",i),a.textContent=n.cssText,e.appendChild(a)}},l=n?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return o(t)})(e):e +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,{is:d,defineProperty:u,getOwnPropertyDescriptor:h,getOwnPropertyNames:p,getOwnPropertySymbols:m,getPrototypeOf:g}=Object,f=globalThis,_=f.trustedTypes,v=_?_.emptyScript:"",y=f.reactiveElementPolyfillSupport,b=(e,t)=>e,w={toAttribute(e,t){switch(t){case Boolean:e=e?v:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},x=(e,t)=>!d(e,t),C={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:x};Symbol.metadata??=Symbol("metadata"),f.litPropertyMetadata??=new WeakMap;class M extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=C){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){const n=Symbol(),a=this.getPropertyDescriptor(e,n,t);void 0!==a&&u(this.prototype,e,a)}}static getPropertyDescriptor(e,t,n){const{get:a,set:i}=h(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get(){return a?.call(this)},set(t){const r=a?.call(this);i.call(this,t),this.requestUpdate(e,r,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??C}static _$Ei(){if(this.hasOwnProperty(b("elementProperties")))return;const e=g(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(b("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(b("properties"))){const e=this.properties,t=[...p(e),...m(e)];for(const n of t)this.createProperty(n,e[n])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const n=this._$Eu(e,t);void 0!==n&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(l(e))}else void 0!==e&&t.push(l(e));return t}static _$Eu(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((e=>e(this)))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return c(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((e=>e.hostConnected?.()))}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach((e=>e.hostDisconnected?.()))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EC(e,t){const n=this.constructor.elementProperties.get(e),a=this.constructor._$Eu(e,n);if(void 0!==a&&!0===n.reflect){const i=(void 0!==n.converter?.toAttribute?n.converter:w).toAttribute(t,n.type);this._$Em=e,null==i?this.removeAttribute(a):this.setAttribute(a,i),this._$Em=null}}_$AK(e,t){const n=this.constructor,a=n._$Eh.get(e);if(void 0!==a&&this._$Em!==a){const e=n.getPropertyOptions(a),i="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:w;this._$Em=a,this[a]=i.fromAttribute(t,e.type),this._$Em=null}}requestUpdate(e,t,n){if(void 0!==e){if(n??=this.constructor.getPropertyOptions(e),!(n.hasChanged??x)(this[e],t))return;this.P(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(e,t,n){this._$AL.has(e)||this._$AL.set(e,t),!0===n.reflect&&this._$Em!==e&&(this._$Ej??=new Set).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,n]of e)!0!==n.wrapped||this._$AL.has(t)||void 0===this[t]||this.P(t,this[t],n)}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach((e=>e.hostUpdate?.())),this.update(t)):this._$EU()}catch(t){throw e=!1,this._$EU(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&=this._$Ej.forEach((e=>this._$EC(e,this[e]))),this._$EU()}updated(e){}firstUpdated(e){}}M.elementStyles=[],M.shadowRootOptions={mode:"open"},M[b("elementProperties")]=new Map,M[b("finalized")]=new Map,y?.({ReactiveElement:M}),(f.reactiveElementVersions??=[]).push("2.0.4"); +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const k=globalThis,S=k.trustedTypes,E=S?S.createPolicy("lit-html",{createHTML:e=>e}):void 0,$="$lit$",A=`lit$${(Math.random()+"").slice(9)}$`,z="?"+A,I=`<${z}>`,T=document,j=()=>T.createComment(""),O=e=>null===e||"object"!=typeof e&&"function"!=typeof e,D=Array.isArray,R="[ \t\n\f\r]",P=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,L=/-->/g,N=/>/g,F=RegExp(`>|${R}(?:([^\\s"'>=/]+)(${R}*=${R}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),V=/'/g,H=/"/g,B=/^(?:script|style|textarea|title)$/i,q=(e=>(t,...n)=>({_$litType$:e,strings:t,values:n}))(1),U=Symbol.for("lit-noChange"),W=Symbol.for("lit-nothing"),Z=new WeakMap,Q=T.createTreeWalker(T,129);function G(e,t){if(!Array.isArray(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==E?E.createHTML(t):t}const Y=(e,t)=>{const n=e.length-1,a=[];let i,r=2===t?"":"",o=P;for(let t=0;t"===c[0]?(o=i??P,l=-1):void 0===c[1]?l=-2:(l=o.lastIndex-c[2].length,s=c[1],o=void 0===c[3]?F:'"'===c[3]?H:V):o===H||o===V?o=F:o===L||o===N?o=P:(o=F,i=void 0);const u=o===F&&e[t+1].startsWith("/>")?" ":"";r+=o===P?n+I:l>=0?(a.push(s),n.slice(0,l)+$+n.slice(l)+A+u):n+A+(-2===l?t:u)}return[G(e,r+(e[n]||"")+(2===t?"":"")),a]};class K{constructor({strings:e,_$litType$:t},n){let a;this.parts=[];let i=0,r=0;const o=e.length-1,s=this.parts,[c,l]=Y(e,t);if(this.el=K.createElement(c,n),Q.currentNode=this.el.content,2===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(a=Q.nextNode())&&s.length0){a.textContent=S?S.emptyScript:"";for(let n=0;nD(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}S(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.S(e))}_(e){this._$AH!==W&&O(this._$AH)?this._$AA.nextSibling.data=e:this.T(T.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:n}=e,a="number"==typeof n?this._$AC(e):(void 0===n.el&&(n.el=K.createElement(G(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===a)this._$AH.p(t);else{const e=new J(a,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=Z.get(e.strings);return void 0===t&&Z.set(e.strings,t=new K(e)),t}k(e){D(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,a=0;for(const i of e)a===t.length?t.push(n=new ee(this.S(j()),this.S(j()),this,this.options)):n=t[a],n._$AI(i),a++;a2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=W}_$AI(e,t=this,n,a){const i=this.strings;let r=!1;if(void 0===i)e=X(this,e,t,0),r=!O(e)||e!==this._$AH&&e!==U,r&&(this._$AH=e);else{const a=e;let o,s;for(e=i[0],o=0;o{const a=n?.renderBefore??t;let i=a._$litPart$;if(void 0===i){const e=n?.renderBefore??null;a._$litPart$=i=new ee(t.insertBefore(j(),e),e,void 0,n??{})}return i._$AI(e),i})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return U}};se._$litElement$=!0,se.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:se});const ce=globalThis.litElementPolyfillSupport;ce?.({LitElement:se}),(globalThis.litElementVersions??=[]).push("4.0.4"); +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const le=e=>(t,n)=>{void 0!==n?n.addInitializer((()=>{customElements.define(e,t)})):customElements.define(e,t)} +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,de={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:x},ue=(e=de,t,n)=>{const{kind:a,metadata:i}=n;let r=globalThis.litPropertyMetadata.get(i);if(void 0===r&&globalThis.litPropertyMetadata.set(i,r=new Map),r.set(n.name,e),"accessor"===a){const{name:a}=n;return{set(n){const i=t.get.call(this);t.set.call(this,n),this.requestUpdate(a,i,e)},init(t){return void 0!==t&&this.P(a,void 0,e),t}}}if("setter"===a){const{name:a}=n;return function(n){const i=this[a];t.call(this,n),this.requestUpdate(a,i,e)}}throw Error("Unsupported decorator location: "+a)};function he(e){return(t,n)=>"object"==typeof n?ue(e,t,n):((e,t,n)=>{const a=t.hasOwnProperty(n);return t.constructor.createProperty(n,a?{...e,wrapped:!0}:e),a?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n) +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */}function pe(e){return he({...e,state:!0,attribute:!1})} +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const me={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},ge=e=>(...t)=>({_$litDirective$:e,values:t});let fe=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}; +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const _e=ge(class extends fe{constructor(e){if(super(e),e.type!==me.ATTRIBUTE||"class"!==e.name||e.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter((t=>e[t])).join(" ")+" "}update(e,[t]){if(void 0===this.st){this.st=new Set,void 0!==e.strings&&(this.nt=new Set(e.strings.join(" ").split(/\s/).filter((e=>""!==e))));for(const e in t)t[e]&&!this.nt?.has(e)&&this.st.add(e);return this.render(t)}const n=e.element.classList;for(const e of this.st)e in t||(n.remove(e),this.st.delete(e));for(const e in t){const a=!!t[e];a===this.st.has(e)||this.nt?.has(e)||(a?(n.add(e),this.st.add(e)):(n.remove(e),this.st.delete(e)))}return U}}),ve=e=>e??W +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,ye=e=>null===e||"object"!=typeof e&&"function"!=typeof e,be=e=>void 0===e.strings,we={},xe=(e,t=we)=>e._$AH=t +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,Ce=(e,t)=>{const n=e._$AN;if(void 0===n)return!1;for(const e of n)e._$AO?.(t,!1),Ce(e,t);return!0},Me=e=>{let t,n;do{if(void 0===(t=e._$AM))break;n=t._$AN,n.delete(e),e=t}while(0===n?.size)},ke=e=>{for(let t;t=e._$AM;e=t){let n=t._$AN;if(void 0===n)t._$AN=n=new Set;else if(n.has(e))break;n.add(e),$e(t)}}; +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */function Se(e){void 0!==this._$AN?(Me(this),this._$AM=e,ke(this)):this._$AM=e}function Ee(e,t=!1,n=0){const a=this._$AH,i=this._$AN;if(void 0!==i&&0!==i.size)if(t)if(Array.isArray(a))for(let e=n;e{e.type==me.CHILD&&(e._$AP??=Ee,e._$AQ??=Se)};class Ae extends fe{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,n){super._$AT(e,t,n),ke(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(Ce(this,e),Me(this))}setValue(e){if(be(this._$Ct))this._$Ct._$AI(e,this);else{const t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}} +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const ze=()=>new Ie;let Ie=class{};const Te=new WeakMap,je=ge(class extends Ae{render(e){return W}update(e,[t]){const n=t!==this.Y;return n&&void 0!==this.Y&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.Y=t,this.ht=e.options?.host,this.rt(this.ct=e.element)),W}rt(e){if("function"==typeof this.Y){const t=this.ht??globalThis;let n=Te.get(t);void 0===n&&(n=new WeakMap,Te.set(t,n)),void 0!==n.get(this.Y)&&this.Y.call(this.ht,void 0),n.set(this.Y,e),void 0!==e&&this.Y.call(this.ht,e)}else this.Y.value=e}get lt(){return"function"==typeof this.Y?Te.get(this.ht??globalThis)?.get(this.Y):this.Y?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}}),Oe="important",De=" !"+Oe,Re=ge(class extends fe{constructor(e){if(super(e),e.type!==me.ATTRIBUTE||"style"!==e.name||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce(((t,n)=>{const a=e[n];return null==a?t:t+`${n=n.includes("-")?n:n.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${a};`}),"")}update(e,[t]){const{style:n}=e.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(t)),this.render(t);for(const e of this.ft)null==t[e]&&(this.ft.delete(e),e.includes("-")?n.removeProperty(e):n[e]=null);for(const e in t){const a=t[e];if(null!=a){this.ft.add(e);const t="string"==typeof a&&a.endsWith(De);e.includes("-")||t?n.setProperty(e,t?a.slice(0,-11):a,t?Oe:""):n[e]=a}}return U}}); +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */function Pe(e,t,n,a=20,i=0){let r=[];if(i>=a)return r;const o=e=>{const r=e.assignedNodes().filter((e=>1===e.nodeType));return r.length>0?Pe(r[0].parentElement,t,n,a,i+1):[]},s=Array.from(e.children||[]);for(const e of s)t(e)||(n(e)&&r.push(e),null!=e.shadowRoot?r.push(...Pe(e.shadowRoot,t,n,a,i+1)):"SLOT"===e.tagName?r.push(...o(e)):r.push(...Pe(e,t,n,a,i+1)));return r}function Le(e){return e.hasAttribute("hidden")||e.hasAttribute("aria-hidden")&&"false"!==e.getAttribute("aria-hidden")||"none"===e.style.display||"0"===e.style.opacity||"hidden"===e.style.visibility||"collapse"===e.style.visibility}function Ne(e){return"-1"!==e.getAttribute("tabindex")&&!Le(e)&&!function(e){return e.hasAttribute("disabled")||e.hasAttribute("aria-disabled")&&"false"!==e.getAttribute("aria-disabled")}(e)&&(e.hasAttribute("tabindex")||(e instanceof HTMLAnchorElement||e instanceof HTMLAreaElement)&&e.hasAttribute("href")||e instanceof HTMLButtonElement||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e instanceof HTMLIFrameElement)}const Fe=new Map;const Ve=document.createElement("template");Ve.innerHTML='\n\t
\n\t
\n\t\n\t
\n';class He extends HTMLElement{constructor(){super(),this.debounceId=Math.random().toString(),this._focused=!1;const e=this.attachShadow({mode:"open"});e.appendChild(Ve.content.cloneNode(!0)),this.$backup=e.querySelector("#backup"),this.$start=e.querySelector("#start"),this.$end=e.querySelector("#end"),this.focusLastElement=this.focusLastElement.bind(this),this.focusFirstElement=this.focusFirstElement.bind(this),this.onFocusIn=this.onFocusIn.bind(this),this.onFocusOut=this.onFocusOut.bind(this)}static get observedAttributes(){return["inactive"]}get inactive(){return this.hasAttribute("inactive")}set inactive(e){e?this.setAttribute("inactive",""):this.removeAttribute("inactive")}get focused(){return this._focused}connectedCallback(){this.$start.addEventListener("focus",this.focusLastElement),this.$end.addEventListener("focus",this.focusFirstElement),this.addEventListener("focusin",this.onFocusIn),this.addEventListener("focusout",this.onFocusOut),this.render()}disconnectedCallback(){this.$start.removeEventListener("focus",this.focusLastElement),this.$end.removeEventListener("focus",this.focusFirstElement),this.removeEventListener("focusin",this.onFocusIn),this.removeEventListener("focusout",this.onFocusOut)}attributeChangedCallback(){this.render()}focusFirstElement(){this.trapFocus()}focusLastElement(){this.trapFocus(!0)}getFocusableElements(){return Pe(this,Le,Ne)}trapFocus(e){if(this.inactive)return;let t=this.getFocusableElements();t.length>0?(e?t[t.length-1].focus():t[0].focus(),this.$backup.setAttribute("tabindex","-1")):(this.$backup.setAttribute("tabindex","0"),this.$backup.focus())}onFocusIn(){this.updateFocused(!0)}onFocusOut(){this.updateFocused(!1)}updateFocused(e){!function(e,t,n){const a=Fe.get(n);null!=a&&window.clearTimeout(a),Fe.set(n,window.setTimeout((()=>{e(),Fe.delete(n)}),t))}((()=>{this.focused!==e&&(this._focused=e,this.render())}),0,this.debounceId)}render(){this.$start.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.$end.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.focused?this.setAttribute("focused",""):this.removeAttribute("focused")}}function Be(e){return Number(e.getAttribute("data-dialog-count"))||0}function qe(e,t){e.setAttribute("data-dialog-count",t.toString())}function Ue(e=document.activeElement){return null!=e&&null!=e.shadowRoot&&null!=e.shadowRoot.activeElement?Ue(e.shadowRoot.activeElement):e}window.customElements.define("focus-trap",He);const We=document.createElement("template");We.innerHTML='\n \n
\n \n \n \n';class Ze extends HTMLElement{constructor(){super(),this.$scrollContainer=document.documentElement,this.$previousActiveElement=null;const e=this.attachShadow({mode:"open"});e.appendChild(We.content.cloneNode(!0)),this.$dialog=e.querySelector("#dialog"),this.$backdrop=e.querySelector("#backdrop"),this.onBackdropClick=this.onBackdropClick.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.setAttribute("aria-modal","true"),this.$dialog.setAttribute("role","alertdialog")}static get observedAttributes(){return["open","center"]}get open(){return this.hasAttribute("open")}set open(e){e?this.setAttribute("open",""):this.removeAttribute("open")}get center(){return this.hasAttribute("center")}set center(e){e?this.setAttribute("center",""):this.removeAttribute("center")}connectedCallback(){this.$backdrop.addEventListener("click",this.onBackdropClick)}disconnectedCallback(){this.$backdrop.removeEventListener("click",this.onBackdropClick),this.open&&this.didClose()}show(){this.open=!0}close(e){this.result=e,this.open=!1}onBackdropClick(){this.assertClosing()&&this.close()}onKeyDown(e){if("Escape"===e.code)this.assertClosing()&&(this.close(),e.stopImmediatePropagation())}assertClosing(){return this.dispatchEvent(new CustomEvent("closing",{cancelable:!0}))}didOpen(){this.$previousActiveElement=Ue(document.activeElement),requestAnimationFrame((()=>{this.$dialog.focusFirstElement()})),this.tabIndex=0,this.$scrollContainer.style.overflow="hidden",this.addEventListener("keydown",this.onKeyDown,{capture:!0,passive:!0}),qe(this.$scrollContainer,Be(this.$scrollContainer)+1),this.dispatchEvent(new CustomEvent("open"))}didClose(){this.removeEventListener("keydown",this.onKeyDown,{capture:!0}),qe(this.$scrollContainer,Math.max(0,Be(this.$scrollContainer)-1)),Be(this.$scrollContainer)<=0&&(this.$scrollContainer.style.overflow=""),this.tabIndex=-1,null!=this.$previousActiveElement&&(this.$previousActiveElement.focus(),this.$previousActiveElement=null),this.dispatchEvent(new CustomEvent("close",{detail:this.result}))}attributeChangedCallback(e,t,n){if("open"===e)this.open?this.didOpen():this.didClose()}}var Qe,Ge;function Ye(e){return e.substr(0,e.indexOf("."))}customElements.define("web-dialog",Ze),function(e){e.language="language",e.system="system",e.comma_decimal="comma_decimal",e.decimal_comma="decimal_comma",e.space_comma="space_comma",e.none="none"}(Qe||(Qe={})),function(e){e.language="language",e.system="system",e.am_pm="12",e.twenty_four="24"}(Ge||(Ge={}));var Ke,Xe,Je=["closed","locked","off"],et=function(e,t,n,a){a=a||{},n=null==n?{}:n;var i=new Event(t,{bubbles:void 0===a.bubbles||a.bubbles,cancelable:Boolean(a.cancelable),composed:void 0===a.composed||a.composed});return i.detail=n,e.dispatchEvent(i),i},tt=function(e){et(window,"haptic",e)},nt=function(e,t){return function(e,t,n){void 0===n&&(n=!0);var a,i=Ye(t),r="group"===i?"homeassistant":i;switch(i){case"lock":a=n?"unlock":"lock";break;case"cover":a=n?"open_cover":"close_cover";break;default:a=n?"turn_on":"turn_off"}return e.callService(r,a,{entity_id:t})}(e,t,Je.includes(e.states[t].state))},at=function(e,t,n,a){if(a||(a={action:"more-info"}),!a.confirmation||a.confirmation.exemptions&&a.confirmation.exemptions.some((function(e){return e.user===t.user.id}))||(tt("warning"),confirm(a.confirmation.text||"Are you sure you want to "+a.action+"?")))switch(a.action){case"more-info":(n.entity||n.camera_image)&&et(e,"hass-more-info",{entityId:n.entity?n.entity:n.camera_image});break;case"navigate":a.navigation_path&&function(e,t,n){void 0===n&&(n=!1),n?history.replaceState(null,"",t):history.pushState(null,"",t),et(window,"location-changed",{replace:n})}(0,a.navigation_path);break;case"url":a.url_path&&window.open(a.url_path);break;case"toggle":n.entity&&(nt(t,n.entity),tt("success"));break;case"perform-action":if(!a.perform_action)return void tt("failure");var i=a.perform_action.split(".",2);t.callService(i[0],i[1],a.data,a.target),tt("success");break;case"call-service":if(!a.service)return void tt("failure");var r=a.service.split(".",2);t.callService(r[0],r[1],a.data,a.target),tt("success");break;case"fire-dom-event":et(e,"ll-custom",a)}};!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},e.getValidEnumValues=t=>{const n=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),a={};for(const e of n)a[e]=t[e];return e.objectValues(a)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(const n of e)if(t(n))return n},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(Ke||(Ke={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(Xe||(Xe={}));const it=Ke.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),rt=e=>{switch(typeof e){case"undefined":return it.undefined;case"string":return it.string;case"number":return isNaN(e)?it.nan:it.number;case"boolean":return it.boolean;case"function":return it.function;case"bigint":return it.bigint;case"symbol":return it.symbol;case"object":return Array.isArray(e)?it.array:null===e?it.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?it.promise:"undefined"!=typeof Map&&e instanceof Map?it.map:"undefined"!=typeof Set&&e instanceof Set?it.set:"undefined"!=typeof Date&&e instanceof Date?it.date:it.object;default:return it.unknown}},ot=Ke.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class st extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},n={_errors:[]},a=e=>{for(const i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(a);else if("invalid_return_type"===i.code)a(i.returnTypeError);else if("invalid_arguments"===i.code)a(i.argumentsError);else if(0===i.path.length)n._errors.push(t(i));else{let e=n,a=0;for(;ae.message)){const t={},n=[];for(const a of this.issues)a.path.length>0?(t[a.path[0]]=t[a.path[0]]||[],t[a.path[0]].push(e(a))):n.push(e(a));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}st.create=e=>new st(e);const ct=(e,t)=>{let n;switch(e.code){case ot.invalid_type:n=e.received===it.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case ot.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Ke.jsonStringifyReplacer)}`;break;case ot.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ke.joinValues(e.keys,", ")}`;break;case ot.invalid_union:n="Invalid input";break;case ot.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ke.joinValues(e.options)}`;break;case ot.invalid_enum_value:n=`Invalid enum value. Expected ${Ke.joinValues(e.options)}, received '${e.received}'`;break;case ot.invalid_arguments:n="Invalid function arguments";break;case ot.invalid_return_type:n="Invalid function return type";break;case ot.invalid_date:n="Invalid date";break;case ot.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Ke.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case ot.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case ot.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case ot.custom:n="Invalid input";break;case ot.invalid_intersection_types:n="Intersection results could not be merged";break;case ot.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case ot.not_finite:n="Number must be finite";break;default:n=t.defaultError,Ke.assertNever(e)}return{message:n}};let lt=ct;function dt(){return lt}const ut=e=>{const{data:t,path:n,errorMaps:a,issueData:i}=e,r=[...n,...i.path||[]],o={...i,path:r};if(void 0!==i.message)return{...i,path:r,message:i.message};let s="";const c=a.filter((e=>!!e)).slice().reverse();for(const e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:r,message:s}};function ht(e,t){const n=dt(),a=ut({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===ct?void 0:ct].filter((e=>!!e))});e.common.issues.push(a)}class pt{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const a of t){if("aborted"===a.status)return mt;"dirty"===a.status&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const e of t){const t=await e.key,a=await e.value;n.push({key:t,value:a})}return pt.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const a of t){const{key:t,value:i}=a;if("aborted"===t.status)return mt;if("aborted"===i.status)return mt;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"===t.value||void 0===i.value&&!a.alwaysSet||(n[t.value]=i.value)}return{status:e.value,value:n}}}const mt=Object.freeze({status:"aborted"}),gt=e=>({status:"dirty",value:e}),ft=e=>({status:"valid",value:e}),_t=e=>"aborted"===e.status,vt=e=>"dirty"===e.status,yt=e=>"valid"===e.status,bt=e=>"undefined"!=typeof Promise&&e instanceof Promise;function wt(e,t,n,a){if("a"===n&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?a:"a"===n?a.call(e):a?a.value:t.get(e)}function xt(e,t,n,a,i){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?i.call(e,n):i?i.value=n:t.set(e,n),n}var Ct,Mt,kt;"function"==typeof SuppressedError&&SuppressedError,function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(Ct||(Ct={}));class St{constructor(e,t,n,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=a}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Et=(e,t)=>{if(yt(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new st(e.common.issues);return this._error=t,this._error}}};function $t(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:a,description:i}=e;if(t&&(n||a))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:i};return{errorMap:(t,i)=>{var r,o;const{message:s}=e;return"invalid_enum_value"===t.code?{message:null!=s?s:i.defaultError}:void 0===i.data?{message:null!==(r=null!=s?s:a)&&void 0!==r?r:i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:null!==(o=null!=s?s:n)&&void 0!==o?o:i.defaultError}},description:i}}class At{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return rt(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:rt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new pt,ctx:{common:e.parent.common,data:e.data,parsedType:rt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(bt(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const a={common:{issues:[],async:null!==(n=null==t?void 0:t.async)&&void 0!==n&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rt(e)},i=this._parseSync({data:e,path:a.path,parent:a});return Et(a,i)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rt(e)},a=this._parse({data:e,path:n.path,parent:n}),i=await(bt(a)?a:Promise.resolve(a));return Et(n,i)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,a)=>{const i=e(t),r=()=>a.addIssue({code:ot.custom,...n(t)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then((e=>!!e||(r(),!1))):!!i||(r(),!1)}))}refinement(e,t){return this._refinement(((n,a)=>!!e(n)||(a.addIssue("function"==typeof t?t(n,a):t),!1)))}_refinement(e){return new kn({schema:this,typeName:Pn.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Sn.create(this,this._def)}nullable(){return En.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return on.create(this,this._def)}promise(){return Mn.create(this,this._def)}or(e){return ln.create([this,e],this._def)}and(e){return pn.create(this,e,this._def)}transform(e){return new kn({...$t(this._def),schema:this,typeName:Pn.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new $n({...$t(this._def),innerType:this,defaultValue:t,typeName:Pn.ZodDefault})}brand(){return new Tn({typeName:Pn.ZodBranded,type:this,...$t(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new An({...$t(this._def),innerType:this,catchValue:t,typeName:Pn.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return jn.create(this,e)}readonly(){return On.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const zt=/^c[^\s-]{8,}$/i,It=/^[0-9a-z]+$/,Tt=/^[0-9A-HJKMNP-TV-Z]{26}$/,jt=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ot=/^[a-z0-9_-]{21}$/i,Dt=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Rt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let Pt;const Lt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Nt=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Ft=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Vt="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Ht=new RegExp(`^${Vt}$`);function Bt(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function qt(e){let t=`${Vt}T${Bt(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function Ut(e,t){return!("v4"!==t&&t||!Lt.test(e))||!("v6"!==t&&t||!Nt.test(e))}class Wt extends At{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==it.string){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.string,received:t.parsedType}),mt}const t=new pt;let n;for(const a of this._def.checks)if("min"===a.kind)e.data.lengtha.value&&(n=this._getOrReturnCtx(e,n),ht(n,{code:ot.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("length"===a.kind){const i=e.data.length>a.value,r=e.data.lengthe.test(t)),{validation:t,code:ot.invalid_string,...Ct.errToObj(n)})}_addCheck(e){return new Wt({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ct.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ct.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ct.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ct.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ct.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ct.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ct.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ct.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ct.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ct.errToObj(e)})}datetime(e){var t,n;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(n=null==e?void 0:e.local)&&void 0!==n&&n,...Ct.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...Ct.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Ct.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Ct.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...Ct.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Ct.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Ct.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Ct.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Ct.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Ct.errToObj(t)})}nonempty(e){return this.min(1,Ct.errToObj(e))}trim(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.valuea?n:a;return parseInt(e.toFixed(i).replace(".",""))%parseInt(t.toFixed(i).replace(".",""))/Math.pow(10,i)}Wt.create=e=>{var t;return new Wt({checks:[],typeName:Pn.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...$t(e)})};class Qt extends At{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==it.number){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.number,received:t.parsedType}),mt}let t;const n=new pt;for(const a of this._def.checks)if("int"===a.kind)Ke.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty());else if("min"===a.kind){(a.inclusive?e.dataa.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty())}else"multipleOf"===a.kind?0!==Zt(e.data,a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.not_finite,message:a.message}),n.dirty()):Ke.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ct.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ct.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ct.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ct.toString(t))}setLimit(e,t,n,a){return new Qt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Ct.toString(a)}]})}_addCheck(e){return new Qt({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ct.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ct.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ct.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ct.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ct.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ct.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Ct.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ct.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ct.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value"int"===e.kind||"multipleOf"===e.kind&&Ke.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.valuenew Qt({checks:[],typeName:Pn.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...$t(e)});class Gt extends At{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){this._def.coerce&&(e.data=BigInt(e.data));if(this._getType(e)!==it.bigint){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.bigint,received:t.parsedType}),mt}let t;const n=new pt;for(const a of this._def.checks)if("min"===a.kind){(a.inclusive?e.dataa.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty())}else"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):Ke.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ct.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ct.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ct.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ct.toString(t))}setLimit(e,t,n,a){return new Gt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Ct.toString(a)}]})}_addCheck(e){return new Gt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ct.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ct.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ct.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ct.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ct.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value{var t;return new Gt({checks:[],typeName:Pn.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...$t(e)})};class Yt extends At{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==it.boolean){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.boolean,received:t.parsedType}),mt}return ft(e.data)}}Yt.create=e=>new Yt({typeName:Pn.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...$t(e)});class Kt extends At{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==it.date){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.date,received:t.parsedType}),mt}if(isNaN(e.data.getTime())){return ht(this._getOrReturnCtx(e),{code:ot.invalid_date}),mt}const t=new pt;let n;for(const a of this._def.checks)"min"===a.kind?e.data.getTime()a.value&&(n=this._getOrReturnCtx(e,n),ht(n,{code:ot.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),t.dirty()):Ke.assertNever(a);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Kt({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Ct.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Ct.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.valuenew Kt({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Pn.ZodDate,...$t(e)});class Xt extends At{_parse(e){if(this._getType(e)!==it.symbol){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.symbol,received:t.parsedType}),mt}return ft(e.data)}}Xt.create=e=>new Xt({typeName:Pn.ZodSymbol,...$t(e)});class Jt extends At{_parse(e){if(this._getType(e)!==it.undefined){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.undefined,received:t.parsedType}),mt}return ft(e.data)}}Jt.create=e=>new Jt({typeName:Pn.ZodUndefined,...$t(e)});class en extends At{_parse(e){if(this._getType(e)!==it.null){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.null,received:t.parsedType}),mt}return ft(e.data)}}en.create=e=>new en({typeName:Pn.ZodNull,...$t(e)});class tn extends At{constructor(){super(...arguments),this._any=!0}_parse(e){return ft(e.data)}}tn.create=e=>new tn({typeName:Pn.ZodAny,...$t(e)});class nn extends At{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ft(e.data)}}nn.create=e=>new nn({typeName:Pn.ZodUnknown,...$t(e)});class an extends At{_parse(e){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.never,received:t.parsedType}),mt}}an.create=e=>new an({typeName:Pn.ZodNever,...$t(e)});class rn extends At{_parse(e){if(this._getType(e)!==it.undefined){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.void,received:t.parsedType}),mt}return ft(e.data)}}rn.create=e=>new rn({typeName:Pn.ZodVoid,...$t(e)});class on extends At{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),a=this._def;if(t.parsedType!==it.array)return ht(t,{code:ot.invalid_type,expected:it.array,received:t.parsedType}),mt;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,i=t.data.lengtha.maxLength.value&&(ht(t,{code:ot.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map(((e,n)=>a.type._parseAsync(new St(t,e,t.path,n))))).then((e=>pt.mergeArray(n,e)));const i=[...t.data].map(((e,n)=>a.type._parseSync(new St(t,e,t.path,n))));return pt.mergeArray(n,i)}get element(){return this._def.type}min(e,t){return new on({...this._def,minLength:{value:e,message:Ct.toString(t)}})}max(e,t){return new on({...this._def,maxLength:{value:e,message:Ct.toString(t)}})}length(e,t){return new on({...this._def,exactLength:{value:e,message:Ct.toString(t)}})}nonempty(e){return this.min(1,e)}}function sn(e){if(e instanceof cn){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=Sn.create(sn(a))}return new cn({...e._def,shape:()=>t})}return e instanceof on?new on({...e._def,type:sn(e.element)}):e instanceof Sn?Sn.create(sn(e.unwrap())):e instanceof En?En.create(sn(e.unwrap())):e instanceof mn?mn.create(e.items.map((e=>sn(e)))):e}on.create=(e,t)=>new on({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Pn.ZodArray,...$t(t)});class cn extends At{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=Ke.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==it.object){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.object,received:t.parsedType}),mt}const{status:t,ctx:n}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),r=[];if(!(this._def.catchall instanceof an&&"strip"===this._def.unknownKeys))for(const e in n.data)i.includes(e)||r.push(e);const o=[];for(const e of i){const t=a[e],i=n.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new St(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof an){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of r)o.push({key:{status:"valid",value:e},value:{status:"valid",value:n.data[e]}});else if("strict"===e)r.length>0&&(ht(n,{code:ot.unrecognized_keys,keys:r}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of r){const a=n.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new St(n,a,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of o){const n=await t.key,a=await t.value;e.push({key:n,value:a,alwaysSet:t.alwaysSet})}return e})).then((e=>pt.mergeObjectSync(t,e))):pt.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return Ct.errToObj,new cn({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var a,i,r,o;const s=null!==(r=null===(i=(a=this._def).errorMap)||void 0===i?void 0:i.call(a,t,n).message)&&void 0!==r?r:n.defaultError;return"unrecognized_keys"===t.code?{message:null!==(o=Ct.errToObj(e).message)&&void 0!==o?o:s}:{message:s}}}:{}})}strip(){return new cn({...this._def,unknownKeys:"strip"})}passthrough(){return new cn({...this._def,unknownKeys:"passthrough"})}extend(e){return new cn({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new cn({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Pn.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new cn({...this._def,catchall:e})}pick(e){const t={};return Ke.objectKeys(e).forEach((n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])})),new cn({...this._def,shape:()=>t})}omit(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{e[n]||(t[n]=this.shape[n])})),new cn({...this._def,shape:()=>t})}deepPartial(){return sn(this)}partial(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{const a=this.shape[n];e&&!e[n]?t[n]=a:t[n]=a.optional()})),new cn({...this._def,shape:()=>t})}required(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof Sn;)e=e._def.innerType;t[n]=e}})),new cn({...this._def,shape:()=>t})}keyof(){return wn(Ke.objectKeys(this.shape))}}cn.create=(e,t)=>new cn({shape:()=>e,unknownKeys:"strip",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)}),cn.strictCreate=(e,t)=>new cn({shape:()=>e,unknownKeys:"strict",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)}),cn.lazycreate=(e,t)=>new cn({shape:e,unknownKeys:"strip",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)});class ln extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map((async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;const n=e.map((e=>new st(e.ctx.common.issues)));return ht(t,{code:ot.invalid_union,unionErrors:n}),mt}));{let e;const a=[];for(const i of n){const n={...t,common:{...t.common,issues:[]},parent:null},r=i._parseSync({data:t.data,path:t.path,parent:n});if("valid"===r.status)return r;"dirty"!==r.status||e||(e={result:r,ctx:n}),n.common.issues.length&&a.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const i=a.map((e=>new st(e)));return ht(t,{code:ot.invalid_union,unionErrors:i}),mt}}get options(){return this._def.options}}ln.create=(e,t)=>new ln({options:e,typeName:Pn.ZodUnion,...$t(t)});const dn=e=>e instanceof yn?dn(e.schema):e instanceof kn?dn(e.innerType()):e instanceof bn?[e.value]:e instanceof xn?e.options:e instanceof Cn?Ke.objectValues(e.enum):e instanceof $n?dn(e._def.innerType):e instanceof Jt?[void 0]:e instanceof en?[null]:e instanceof Sn?[void 0,...dn(e.unwrap())]:e instanceof En?[null,...dn(e.unwrap())]:e instanceof Tn||e instanceof On?dn(e.unwrap()):e instanceof An?dn(e._def.innerType):[];class un extends At{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.object)return ht(t,{code:ot.invalid_type,expected:it.object,received:t.parsedType}),mt;const n=this.discriminator,a=t.data[n],i=this.optionsMap.get(a);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(ht(t,{code:ot.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),mt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const a=new Map;for(const n of t){const t=dn(n.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const i of t){if(a.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);a.set(i,n)}}return new un({typeName:Pn.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...$t(n)})}}function hn(e,t){const n=rt(e),a=rt(t);if(e===t)return{valid:!0,data:e};if(n===it.object&&a===it.object){const n=Ke.objectKeys(t),a=Ke.objectKeys(e).filter((e=>-1!==n.indexOf(e))),i={...e,...t};for(const n of a){const a=hn(e[n],t[n]);if(!a.valid)return{valid:!1};i[n]=a.data}return{valid:!0,data:i}}if(n===it.array&&a===it.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let a=0;a{if(_t(e)||_t(a))return mt;const i=hn(e.value,a.value);return i.valid?((vt(e)||vt(a))&&t.dirty(),{status:t.value,value:i.data}):(ht(n,{code:ot.invalid_intersection_types}),mt)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then((([e,t])=>a(e,t))):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}pn.create=(e,t,n)=>new pn({left:e,right:t,typeName:Pn.ZodIntersection,...$t(n)});class mn extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.array)return ht(n,{code:ot.invalid_type,expected:it.array,received:n.parsedType}),mt;if(n.data.lengththis._def.items.length&&(ht(n,{code:ot.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map(((e,t)=>{const a=this._def.items[t]||this._def.rest;return a?a._parse(new St(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(a).then((e=>pt.mergeArray(t,e))):pt.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new mn({...this._def,rest:e})}}mn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new mn({items:e,typeName:Pn.ZodTuple,rest:null,...$t(t)})};class gn extends At{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.object)return ht(n,{code:ot.invalid_type,expected:it.object,received:n.parsedType}),mt;const a=[],i=this._def.keyType,r=this._def.valueType;for(const e in n.data)a.push({key:i._parse(new St(n,e,n.path,e)),value:r._parse(new St(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?pt.mergeObjectAsync(t,a):pt.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,n){return new gn(t instanceof At?{keyType:e,valueType:t,typeName:Pn.ZodRecord,...$t(n)}:{keyType:Wt.create(),valueType:e,typeName:Pn.ZodRecord,...$t(t)})}}class fn extends At{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.map)return ht(n,{code:ot.invalid_type,expected:it.map,received:n.parsedType}),mt;const a=this._def.keyType,i=this._def.valueType,r=[...n.data.entries()].map((([e,t],r)=>({key:a._parse(new St(n,e,n.path,[r,"key"])),value:i._parse(new St(n,t,n.path,[r,"value"]))})));if(n.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const n of r){const a=await n.key,i=await n.value;if("aborted"===a.status||"aborted"===i.status)return mt;"dirty"!==a.status&&"dirty"!==i.status||t.dirty(),e.set(a.value,i.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const n of r){const a=n.key,i=n.value;if("aborted"===a.status||"aborted"===i.status)return mt;"dirty"!==a.status&&"dirty"!==i.status||t.dirty(),e.set(a.value,i.value)}return{status:t.value,value:e}}}}fn.create=(e,t,n)=>new fn({valueType:t,keyType:e,typeName:Pn.ZodMap,...$t(n)});class _n extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.set)return ht(n,{code:ot.invalid_type,expected:it.set,received:n.parsedType}),mt;const a=this._def;null!==a.minSize&&n.data.sizea.maxSize.value&&(ht(n,{code:ot.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const i=this._def.valueType;function r(e){const n=new Set;for(const a of e){if("aborted"===a.status)return mt;"dirty"===a.status&&t.dirty(),n.add(a.value)}return{status:t.value,value:n}}const o=[...n.data.values()].map(((e,t)=>i._parse(new St(n,e,n.path,t))));return n.common.async?Promise.all(o).then((e=>r(e))):r(o)}min(e,t){return new _n({...this._def,minSize:{value:e,message:Ct.toString(t)}})}max(e,t){return new _n({...this._def,maxSize:{value:e,message:Ct.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}_n.create=(e,t)=>new _n({valueType:e,minSize:null,maxSize:null,typeName:Pn.ZodSet,...$t(t)});class vn extends At{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.function)return ht(t,{code:ot.invalid_type,expected:it.function,received:t.parsedType}),mt;function n(e,n){return ut({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,dt(),ct].filter((e=>!!e)),issueData:{code:ot.invalid_arguments,argumentsError:n}})}function a(e,n){return ut({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,dt(),ct].filter((e=>!!e)),issueData:{code:ot.invalid_return_type,returnTypeError:n}})}const i={errorMap:t.common.contextualErrorMap},r=t.data;if(this._def.returns instanceof Mn){const e=this;return ft((async function(...t){const o=new st([]),s=await e._def.args.parseAsync(t,i).catch((e=>{throw o.addIssue(n(t,e)),o})),c=await Reflect.apply(r,this,s),l=await e._def.returns._def.type.parseAsync(c,i).catch((e=>{throw o.addIssue(a(c,e)),o}));return l}))}{const e=this;return ft((function(...t){const o=e._def.args.safeParse(t,i);if(!o.success)throw new st([n(t,o.error)]);const s=Reflect.apply(r,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new st([a(s,c.error)]);return c.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new vn({...this._def,args:mn.create(e).rest(nn.create())})}returns(e){return new vn({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new vn({args:e||mn.create([]).rest(nn.create()),returns:t||nn.create(),typeName:Pn.ZodFunction,...$t(n)})}}class yn extends At{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}yn.create=(e,t)=>new yn({getter:e,typeName:Pn.ZodLazy,...$t(t)});class bn extends At{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return ht(t,{received:t.data,code:ot.invalid_literal,expected:this._def.value}),mt}return{status:"valid",value:e.data}}get value(){return this._def.value}}function wn(e,t){return new xn({values:e,typeName:Pn.ZodEnum,...$t(t)})}bn.create=(e,t)=>new bn({value:e,typeName:Pn.ZodLiteral,...$t(t)});class xn extends At{constructor(){super(...arguments),Mt.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return ht(t,{expected:Ke.joinValues(n),received:t.parsedType,code:ot.invalid_type}),mt}if(wt(this,Mt,"f")||xt(this,Mt,new Set(this._def.values),"f"),!wt(this,Mt,"f").has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return ht(t,{received:t.data,code:ot.invalid_enum_value,options:n}),mt}return ft(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return xn.create(e,{...this._def,...t})}exclude(e,t=this._def){return xn.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}Mt=new WeakMap,xn.create=wn;class Cn extends At{constructor(){super(...arguments),kt.set(this,void 0)}_parse(e){const t=Ke.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==it.string&&n.parsedType!==it.number){const e=Ke.objectValues(t);return ht(n,{expected:Ke.joinValues(e),received:n.parsedType,code:ot.invalid_type}),mt}if(wt(this,kt,"f")||xt(this,kt,new Set(Ke.getValidEnumValues(this._def.values)),"f"),!wt(this,kt,"f").has(e.data)){const e=Ke.objectValues(t);return ht(n,{received:n.data,code:ot.invalid_enum_value,options:e}),mt}return ft(e.data)}get enum(){return this._def.values}}kt=new WeakMap,Cn.create=(e,t)=>new Cn({values:e,typeName:Pn.ZodNativeEnum,...$t(t)});class Mn extends At{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.promise&&!1===t.common.async)return ht(t,{code:ot.invalid_type,expected:it.promise,received:t.parsedType}),mt;const n=t.parsedType===it.promise?t.data:Promise.resolve(t.data);return ft(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}Mn.create=(e,t)=>new Mn({type:e,typeName:Pn.ZodPromise,...$t(t)});class kn extends At{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Pn.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),a=this._def.effect||null,i={addIssue:e=>{ht(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===a.type){const e=a.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return mt;const a=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===a.status?mt:"dirty"===a.status||"dirty"===t.value?gt(a.value):a}));{if("aborted"===t.value)return mt;const a=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===a.status?mt:"dirty"===a.status||"dirty"===t.value?gt(a.value):a}}if("refinement"===a.type){const e=e=>{const t=a.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===n.common.async){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===a.status?mt:("dirty"===a.status&&t.dirty(),e(a.value),{status:t.value,value:a.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((n=>"aborted"===n.status?mt:("dirty"===n.status&&t.dirty(),e(n.value).then((()=>({status:t.value,value:n.value}))))))}if("transform"===a.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!yt(e))return e;const r=a.transform(e.value,i);if(r instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:r}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((e=>yt(e)?Promise.resolve(a.transform(e.value,i)).then((e=>({status:t.value,value:e}))):e))}Ke.assertNever(a)}}kn.create=(e,t,n)=>new kn({schema:e,typeName:Pn.ZodEffects,effect:t,...$t(n)}),kn.createWithPreprocess=(e,t,n)=>new kn({schema:t,effect:{type:"preprocess",transform:e},typeName:Pn.ZodEffects,...$t(n)});class Sn extends At{_parse(e){return this._getType(e)===it.undefined?ft(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Sn.create=(e,t)=>new Sn({innerType:e,typeName:Pn.ZodOptional,...$t(t)});class En extends At{_parse(e){return this._getType(e)===it.null?ft(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}En.create=(e,t)=>new En({innerType:e,typeName:Pn.ZodNullable,...$t(t)});class $n extends At{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===it.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}$n.create=(e,t)=>new $n({innerType:e,typeName:Pn.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...$t(t)});class An extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return bt(a)?a.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new st(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new st(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}An.create=(e,t)=>new An({innerType:e,typeName:Pn.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...$t(t)});class zn extends At{_parse(e){if(this._getType(e)!==it.nan){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.nan,received:t.parsedType}),mt}return{status:"valid",value:e.data}}}zn.create=e=>new zn({typeName:Pn.ZodNaN,...$t(e)});const In=Symbol("zod_brand");class Tn extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class jn extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?mt:"dirty"===e.status?(t.dirty(),gt(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})()}{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?mt:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new jn({in:e,out:t,typeName:Pn.ZodPipeline})}}class On extends At{_parse(e){const t=this._def.innerType._parse(e),n=e=>(yt(e)&&(e.value=Object.freeze(e.value)),e);return bt(t)?t.then((e=>n(e))):n(t)}unwrap(){return this._def.innerType}}function Dn(e,t={},n){return e?tn.create().superRefine(((a,i)=>{var r,o;if(!e(a)){const e="function"==typeof t?t(a):"string"==typeof t?{message:t}:t,s=null===(o=null!==(r=e.fatal)&&void 0!==r?r:n)||void 0===o||o,c="string"==typeof e?{message:e}:e;i.addIssue({code:"custom",...c,fatal:s})}})):tn.create()}On.create=(e,t)=>new On({innerType:e,typeName:Pn.ZodReadonly,...$t(t)});const Rn={object:cn.lazycreate};var Pn;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(Pn||(Pn={}));const Ln=Wt.create,Nn=Qt.create,Fn=zn.create,Vn=Gt.create,Hn=Yt.create,Bn=Kt.create,qn=Xt.create,Un=Jt.create,Wn=en.create,Zn=tn.create,Qn=nn.create,Gn=an.create,Yn=rn.create,Kn=on.create,Xn=cn.create,Jn=cn.strictCreate,ea=ln.create,ta=un.create,na=pn.create,aa=mn.create,ia=gn.create,ra=fn.create,oa=_n.create,sa=vn.create,ca=yn.create,la=bn.create,da=xn.create,ua=Cn.create,ha=Mn.create,pa=kn.create,ma=Sn.create,ga=En.create,fa=kn.createWithPreprocess,_a=jn.create,va={string:e=>Wt.create({...e,coerce:!0}),number:e=>Qt.create({...e,coerce:!0}),boolean:e=>Yt.create({...e,coerce:!0}),bigint:e=>Gt.create({...e,coerce:!0}),date:e=>Kt.create({...e,coerce:!0})},ya=mt;var ba=Object.freeze({__proto__:null,defaultErrorMap:ct,setErrorMap:function(e){lt=e},getErrorMap:dt,makeIssue:ut,EMPTY_PATH:[],addIssueToContext:ht,ParseStatus:pt,INVALID:mt,DIRTY:gt,OK:ft,isAborted:_t,isDirty:vt,isValid:yt,isAsync:bt,get util(){return Ke},get objectUtil(){return Xe},ZodParsedType:it,getParsedType:rt,ZodType:At,datetimeRegex:qt,ZodString:Wt,ZodNumber:Qt,ZodBigInt:Gt,ZodBoolean:Yt,ZodDate:Kt,ZodSymbol:Xt,ZodUndefined:Jt,ZodNull:en,ZodAny:tn,ZodUnknown:nn,ZodNever:an,ZodVoid:rn,ZodArray:on,ZodObject:cn,ZodUnion:ln,ZodDiscriminatedUnion:un,ZodIntersection:pn,ZodTuple:mn,ZodRecord:gn,ZodMap:fn,ZodSet:_n,ZodFunction:vn,ZodLazy:yn,ZodLiteral:bn,ZodEnum:xn,ZodNativeEnum:Cn,ZodPromise:Mn,ZodEffects:kn,ZodTransformer:kn,ZodOptional:Sn,ZodNullable:En,ZodDefault:$n,ZodCatch:An,ZodNaN:zn,BRAND:In,ZodBranded:Tn,ZodPipeline:jn,ZodReadonly:On,custom:Dn,Schema:At,ZodSchema:At,late:Rn,get ZodFirstPartyTypeKind(){return Pn},coerce:va,any:Zn,array:Kn,bigint:Vn,boolean:Hn,date:Bn,discriminatedUnion:ta,effect:pa,enum:da,function:sa,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>Dn((t=>t instanceof e),t),intersection:na,lazy:ca,literal:la,map:ra,nan:Fn,nativeEnum:ua,never:Gn,null:Wn,nullable:ga,number:Nn,object:Xn,oboolean:()=>Hn().optional(),onumber:()=>Nn().optional(),optional:ma,ostring:()=>Ln().optional(),pipeline:_a,preprocess:fa,promise:ha,record:ia,set:oa,strictObject:Jn,string:Ln,symbol:qn,transformer:pa,tuple:aa,undefined:Un,union:ea,unknown:Qn,void:Yn,NEVER:ya,ZodIssueCode:ot,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:st});const wa="https://github.com/dermotduffy/frigate-hass-card",xa=`${wa}#troubleshooting`,Ca="cameras",Ma=`${Ca}.#.camera_entity`,ka=`${Ca}.#.frigate.camera_name`,Sa=`${Ca}.#.capabilities.disable`,Ea=`${Ca}.#.capabilities.disable_except`,$a=`${Ca}.#.cast.method`,Aa=`${Ca}.#.cast.dashboard.dashboard_path`,za=`${Ca}.#.cast.dashboard.view_path`,Ia=`${Ca}.#.dimensions.aspect_ratio`,Ta=`${Ca}.#.frigate.client_id`,ja=`${Ca}.#.frigate.labels`,Oa=`${Ca}.#.frigate.url`,Da=`${Ca}.#.frigate.zones`,Ra=`${Ca}.#.go2rtc.modes`,Pa=`${Ca}.#.go2rtc.stream`,La=`${Ca}.#.icon`,Na=`${Ca}.#.id`,Fa=`${Ca}.#.image.entity`,Va=`${Ca}.#.image.entity_parameters`,Ha=`${Ca}.#.image.mode`,Ba=`${Ca}.#.image.refresh_seconds`,qa=`${Ca}.#.image.url`,Ua=`${Ca}.#.motioneye.images.directory_pattern`,Wa=`${Ca}.#.motioneye.images.file_pattern`,Za=`${Ca}.#.motioneye.movies.directory_pattern`,Qa=`${Ca}.#.motioneye.movies.file_pattern`,Ga=`${Ca}.#.motioneye.url`,Ya=`${Ca}.#.title`,Ka=`${Ca}.#.webrtc_card.entity`,Xa=`${Ca}.#.webrtc_card.url`,Ja=`${Ca}.#.live_provider`,ei=`${Ca}.#.dependencies.cameras`,ti=`${Ca}.#.dependencies.all_cameras`,ni=`${Ca}.#.dimensions.layout.fit`,ai=`${Ca}.#.dimensions.layout.pan.x`,ii=`${Ca}.#.dimensions.layout.pan.y`,ri=`${Ca}.#.dimensions.layout.position.x`,oi=`${Ca}.#.dimensions.layout.position.y`,si=`${Ca}.#.dimensions.layout.view_box.top`,ci=`${Ca}.#.dimensions.layout.view_box.bottom`,li=`${Ca}.#.dimensions.layout.view_box.left`,di=`${Ca}.#.dimensions.layout.view_box.right`,ui=`${Ca}.#.dimensions.layout.zoom`,hi=`${Ca}.#.proxy.dynamic`,pi=`${Ca}.#.proxy.media`,mi=`${Ca}.#.proxy.ssl_ciphers`,gi=`${Ca}.#.proxy.ssl_verification`,fi=`${Ca}.#.reolink.media_resolution`,_i=`${Ca}.#.reolink.url`,vi=`${Ca}.#.triggers.motion`,yi=`${Ca}.#.triggers.occupancy`,bi=`${Ca}.#.triggers.entities`,wi=`${Ca}.#.triggers.events`,xi="cameras_global",Ci=`${xi}.image`,Mi=`${xi}.live_provider`,ki=`${xi}.jsmpeg`,Si=`${xi}.webrtc_card`,Ei=`${xi}.triggers.occupancy`,$i=`${xi}.image.refresh_seconds`,Ai=`${xi}.dimensions.layout`,zi=`${xi}.ptz`,Ii="elements",Ti="view",ji=`${Ti}.camera_select`,Oi=`${Ti}.dark_mode`,Di=`${Ti}.default`,Ri=`${Ti}.interaction_seconds`,Pi=`${Ti}.keyboard_shortcuts`,Li=`${Ti}.keyboard_shortcuts.enabled`,Ni=`${Pi}.ptz_left`,Fi=`${Pi}.ptz_right`,Vi=`${Pi}.ptz_up`,Hi=`${Pi}.ptz_down`,Bi=`${Pi}.ptz_zoom_in`,qi=`${Pi}.ptz_zoom_out`,Ui=`${Pi}.ptz_home`,Wi=`${Ti}.default_cycle_camera`,Zi=`${Ti}.default_reset`,Qi=`${Zi}.interaction_mode`,Gi=`${Zi}.every_seconds`,Yi=`${Zi}.entities`,Ki=`${Zi}.after_interaction`,Xi=`${Ti}.triggers`,Ji=`${Xi}.show_trigger_status`,er=`${Xi}.filter_selected_camera`,tr=`${Xi}.untrigger_seconds`,nr=`${Xi}.actions`,ar=`${nr}.trigger`,ir=`${nr}.untrigger`,rr=`${nr}.interaction_mode`,or="media_gallery",sr=`${or}.controls.filter.mode`,cr=`${or}.controls.thumbnails.show_details`,lr=`${or}.controls.thumbnails.show_download_control`,dr=`${or}.controls.thumbnails.show_favorite_control`,ur=`${or}.controls.thumbnails.show_timeline_control`,hr=`${or}.controls.thumbnails.size`,pr="media_viewer",mr=`${pr}.auto_play`,gr=`${pr}.auto_pause`,fr=`${pr}.auto_mute`,_r=`${pr}.auto_unmute`,vr=`${pr}.display.mode`,yr=`${pr}.display.grid_columns`,br=`${pr}.display.grid_max_columns`,wr=`${pr}.display.grid_selected_width_factor`,xr=`${pr}.draggable`,Cr=`${pr}.lazy_load`,Mr=`${pr}.snapshot_click_plays_clip`,kr=`${pr}.transition_effect`,Sr=`${pr}.controls.builtin`,Er=`${pr}.controls.next_previous.style`,$r=`${pr}.controls.next_previous.size`,Ar=`${pr}.controls.thumbnails.mode`,zr=`${pr}.controls.thumbnails.show_details`,Ir=`${pr}.controls.thumbnails.show_download_control`,Tr=`${pr}.controls.thumbnails.show_favorite_control`,jr=`${pr}.controls.thumbnails.show_timeline_control`,Or=`${pr}.controls.thumbnails.size`,Dr=`${pr}.controls.timeline.clustering_threshold`,Rr=`${pr}.controls.timeline.events_media_type`,Pr=`${pr}.controls.timeline.mode`,Lr=`${pr}.controls.timeline.pan_mode`,Nr=`${pr}.controls.timeline.show_recordings`,Fr=`${pr}.controls.timeline.style`,Vr=`${pr}.controls.timeline.window_seconds`,Hr=`${pr}.zoomable`,Br="live",qr=`${Br}.auto_play`,Ur=`${Br}.auto_pause`,Wr=`${Br}.auto_mute`,Zr=`${Br}.auto_unmute`,Qr=`${Br}.controls.builtin`,Gr=`${Br}.controls.next_previous.style`,Yr=`${Br}.controls.next_previous.size`,Kr=`${Br}.controls.ptz.hide_home`,Xr=`${Br}.controls.ptz.hide_pan_tilt`,Jr=`${Br}.controls.ptz.hide_zoom`,eo=`${Br}.controls.ptz.mode`,to=`${Br}.controls.ptz.orientation`,no=`${Br}.controls.ptz.position`,ao=`${Br}.controls.thumbnails.media_type`,io=`${Br}.controls.thumbnails.events_media_type`,ro=`${Br}.controls.thumbnails.mode`,oo=`${Br}.controls.thumbnails.size`,so=`${Br}.controls.thumbnails.show_details`,co=`${Br}.controls.thumbnails.show_download_control`,lo=`${Br}.controls.thumbnails.show_favorite_control`,uo=`${Br}.controls.thumbnails.show_timeline_control`,ho=`${Br}.controls.timeline.clustering_threshold`,po=`${Br}.controls.timeline.events_media_type`,mo=`${Br}.controls.timeline.mode`,go=`${Br}.controls.timeline.pan_mode`,fo=`${Br}.controls.timeline.show_recordings`,_o=`${Br}.controls.timeline.style`,vo=`${Br}.controls.timeline.window_seconds`,yo=`${Br}.display.mode`,bo=`${Br}.display.grid_columns`,wo=`${Br}.display.grid_max_columns`,xo=`${Br}.display.grid_selected_width_factor`,Co=`${Br}.draggable`,Mo=`${Br}.lazy_load`,ko=`${Br}.lazy_unload`,So=`${Br}.preload`,Eo=`${Br}.transition_effect`,$o=`${Br}.show_image_during_load`,Ao=`${Br}.microphone.disconnect_seconds`,zo=`${Br}.microphone.mute_after_microphone_mute_seconds`,Io=`${Br}.microphone.always_connected`,To=`${Br}.zoomable`,jo="image",Oo=`${jo}.entity`,Do=`${jo}.entity_parameters`,Ro=`${jo}.mode`,Po=`${jo}.refresh_seconds`,Lo=`${jo}.url`,No="timeline",Fo=`${No}.window_seconds`,Vo=`${No}.clustering_threshold`,Ho=`${No}.events_media_type`,Bo=`${No}.show_recordings`,qo=`${No}.style`,Uo=`${No}.controls.thumbnails.mode`,Wo=`${No}.controls.thumbnails.size`,Zo=`${No}.controls.thumbnails.show_details`,Qo=`${No}.controls.thumbnails.show_download_control`,Go=`${No}.controls.thumbnails.show_favorite_control`,Yo=`${No}.controls.thumbnails.show_timeline_control`,Ko="menu",Xo=`${Ko}.alignment`,Jo=`${Ko}.position`,es=`${Ko}.style`,ts=`${Ko}.button_size`,ns=`${Ko}.buttons`,as=`${ns}.frigate`,is=`${ns}.camera_ui`,rs=`${ns}.fullscreen`,os=`${ns}.play`,ss=`${ns}.mute`,cs=`${ns}.media_player`,ls=`${ns}.timeline`,ds="status_bar",us=`${ds}.position`,hs=`${ds}.style`,ps=`${ds}.popup_seconds`,ms=`${ds}.height`,gs=`${ds}.items`,fs="dimensions",_s=`${fs}.aspect_ratio`,vs=`${fs}.aspect_ratio_mode`,ys=`${fs}.height`,bs="overrides",ws="performance",xs=`${ws}.features.animated_progress_indicator`,Cs=`${ws}.features.media_chunk_size`,Ms=`${ws}.features.max_simultaneous_engine_requests`,ks=`${ws}.profile`,Ss=`${ws}.style.box_shadow`,Es=`${ws}.style.border_radius`,$s="profiles",As=1e3;class zs extends Error{constructor(e,t){super(e),this.context=t}}const Is={info:10,error:20,connection:30,diagnostics:40},Ts=["clips","favorite-events","favorite-recordings","live","menu","ptz","recordings","seek","snapshots","substream"],js=ba.object({url:ba.string(),mime_type:ba.string()}),Os=ba.object({path:ba.string()});function Ds(e){if(e instanceof ba.ZodDefault)return Ds(e.removeDefault());if(e instanceof ba.ZodObject){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=ba.ZodOptional.create(Ds(a))}return new ba.ZodObject({...e._def,shape:()=>t})}return e instanceof ba.ZodArray?ba.ZodArray.create(Ds(e.element)).min(e._def.minLength?.value,e._def.minLength?.message).max(e._def.maxLength?.value,e._def.maxLength?.message).length(e._def.exactLength?.value,e._def.exactLength?.message):e instanceof ba.ZodOptional?ba.ZodOptional.create(Ds(e.unwrap())):e instanceof ba.ZodNullable?ba.ZodNullable.create(Ds(e.unwrap())):e instanceof ba.ZodTuple?ba.ZodTuple.create(e.items.map((e=>Ds(e)))):e}function Rs(e){const t=e.format();return Object.keys(t).filter((e=>!e.startsWith("_")))}const Ps=e=>{const t=new Set;if(e.issues.length)for(const n of e.issues)if("invalid_union"===n.code){const e=n.unionErrors;for(const n of e)Ps(n).forEach(t.add,t)}else t.add(Ls(n.path));return t},Ls=e=>{let t="";for(let n=0;n"fire-dom-event")).or(ba.literal("fire-dom-event")),card_id:ba.string().regex(tc,"card_id parameter can only contain [a-z][A-Z][0-9_]-").optional()}),_c=fc.extend({frigate_card_action:ba.enum(Zs)}),vc=fc.extend({frigate_card_action:ba.enum(["camera_ui","default","download","expand","fullscreen","live_substream_off","live_substream_on","menu_toggle","microphone_connect","microphone_disconnect","microphone_mute","microphone_unmute","mute","pause","play","screenshot","unmute"])}),yc=fc.extend({frigate_card_action:ba.literal("camera_select"),camera:ba.string().optional(),triggered:ba.boolean().optional()}),bc=fc.extend({frigate_card_action:ba.literal("live_substream_select"),camera:ba.string()}),wc=fc.extend({frigate_card_action:ba.literal("media_player"),media_player:ba.string(),media_player_action:ba.enum(["play","stop"])}),xc=fc.extend({frigate_card_action:ba.literal("display_mode_select"),display_mode:ic}),Cc=fc.extend({frigate_card_action:ba.literal("ptz"),camera:ba.string().optional(),ptz_action:ba.enum(Hs).optional(),ptz_phase:ba.enum(Js).optional(),ptz_preset:ba.string().optional()}),Mc=fc.extend({frigate_card_action:ba.literal("ptz_digital"),target_id:ba.string().optional(),absolute:ba.object({zoom:ac.optional(),pan:nc.optional()}).optional(),ptz_action:ba.enum(Hs).optional(),ptz_phase:ba.enum(Js).optional()}),kc=fc.extend({frigate_card_action:ba.literal("ptz_multi"),target_id:ba.string().optional(),ptz_action:ba.enum(Hs).optional(),ptz_phase:ba.enum(Js).optional(),ptz_preset:ba.string().optional()}),Sc=fc.extend({frigate_card_action:ba.literal("ptz_controls"),enabled:ba.boolean()}),Ec=ba.object({ms:ba.number().optional(),s:ba.number().optional(),m:ba.number().optional(),h:ba.number().optional()}),$c=fc.extend({frigate_card_action:ba.literal("sleep"),duration:Ec.optional().default({s:1})}),Ac=fc.extend({frigate_card_action:ba.literal("status_bar"),status_bar_action:ba.enum(["add","remove","reset"]),items:ba.lazy((()=>ol)).array().optional()}),zc=fc.extend({frigate_card_action:ba.literal("log"),message:ba.string(),level:ba.enum(["debug","info","warn","error"]).default("info")}),Ic=ba.union([yc,vc,bc,zc,wc,Cc,Mc,kc,Sc,_c,xc,$c,Ac]),Tc=ba.union([sc,dc,lc,uc,hc,pc,gc,mc,Ic]),jc=ba.object({tap_action:Tc.or(Tc.array()).optional(),hold_action:Tc.or(Tc.array()).optional(),double_tap_action:Tc.or(Tc.array()).optional(),start_tap_action:Tc.or(Tc.array()).optional(),end_tap_action:Tc.or(Tc.array()).optional()}).passthrough(),Oc=ba.object({actions:jc.optional()}),Dc=jc.extend({style:ba.record(ba.string().nullable().or(ba.undefined()).or(ba.number())).optional(),title:ba.string().nullable().optional()}),Rc=Dc.extend({type:ba.literal("state-badge"),entity:ba.string()}),Pc=Dc.extend({type:ba.literal("state-icon"),entity:ba.string(),icon:ba.string().optional(),state_color:ba.boolean().default(!0)}),Lc=Dc.extend({type:ba.literal("state-label"),entity:ba.string(),attribute:ba.string().optional(),prefix:ba.string().optional(),suffix:ba.string().optional()}),Nc=Dc.extend({type:ba.literal("service-button"),title:ba.string(),service:ba.string(),service_data:ba.object({}).passthrough().optional()}),Fc=Dc.extend({type:ba.literal("icon"),icon:ba.string(),entity:ba.string().optional()}),Vc=Dc.extend({type:ba.literal("image"),entity:ba.string().optional(),image:ba.string().optional(),camera_image:ba.string().optional(),camera_view:ba.string().optional(),state_image:ba.object({}).passthrough().optional(),filter:ba.string().optional(),state_filter:ba.object({}).passthrough().optional(),aspect_ratio:ba.string().optional()}),Hc=ba.object({condition:ba.literal("state").optional(),entity:ba.string(),state:ba.string().or(ba.string().array()).optional(),state_not:ba.string().or(ba.string().array()).optional()}),Bc=ba.object({condition:ba.literal("numeric_state"),entity:ba.string(),above:ba.number().optional(),below:ba.number().optional()}),qc=ba.object({condition:ba.literal("screen"),media_query:ba.string()}),Uc=ba.object({condition:ba.literal("user"),users:ba.string().array().min(1)}),Wc=ba.discriminatedUnion("condition",[Hc,Bc,qc,Uc]),Zc=ba.object({type:ba.literal("conditional"),conditions:Wc.array(),elements:ba.lazy((()=>yl))}),Qc=ba.object({type:ba.string().superRefine(((e,t)=>{e.match(/^custom:(?!frigate-card).+/)||t.addIssue({code:ba.ZodIssueCode.custom,message:"Frigate-card custom elements must match specific schemas",fatal:!0})}))}).passthrough(),Gc=ba.object({enabled:ba.boolean().default(!0).optional(),priority:ba.number().min(0).max(Us).default(50).optional(),alignment:ba.enum(["matching","opposing"]).default("matching").optional(),icon:ba.string().optional(),permanent:ba.boolean().default(!1).optional()}),Yc=Gc.merge(Fc).extend({type:ba.literal("custom:frigate-card-menu-icon")}),Kc=Gc.merge(Pc).extend({type:ba.literal("custom:frigate-card-menu-state-icon")}).merge(Gc),Xc=Dc.extend({entity:ba.string().optional(),icon:ba.string().optional(),state_color:ba.boolean().default(!0),selected:ba.boolean().default(!1),subtitle:ba.string().optional(),enabled:ba.boolean().default(!0)}),Jc=Gc.merge(Fc).extend({type:ba.literal("custom:frigate-card-menu-submenu"),items:Xc.array()}),el=Gc.merge(Pc).extend({type:ba.literal("custom:frigate-card-menu-submenu-select"),options:ba.record(Xc.deepPartial()).optional()}),tl=ba.object({enabled:ba.boolean().default(!0).optional(),priority:ba.number().min(0).max(100).default(50).optional()}),nl=tl.extend({sufficient:ba.boolean().default(!1).optional(),exclusive:ba.boolean().default(!1).optional(),expand:ba.boolean().default(!1).optional(),actions:jc.optional()}),al=nl.extend({type:ba.literal("custom:frigate-card-status-bar-icon"),icon:ba.string()}),il=nl.extend({type:ba.literal("custom:frigate-card-status-bar-image"),image:ba.string()}),rl=nl.extend({type:ba.literal("custom:frigate-card-status-bar-string"),string:ba.string()}),ol=ba.union([al,il,rl]),sl=ba.object({condition:ba.literal("view"),views:ba.string().array()}),cl=ba.object({condition:ba.literal("fullscreen"),fullscreen:ba.boolean()}),ll=ba.object({condition:ba.literal("expand"),expand:ba.boolean()}),dl=ba.object({condition:ba.literal("camera"),cameras:ba.string().array()}),ul=ba.object({condition:ba.literal("media_loaded"),media_loaded:ba.boolean()}),hl=ba.object({condition:ba.literal("display_mode"),display_mode:ic}),pl=ba.object({condition:ba.literal("triggered"),triggered:ba.string().array()}),ml=ba.object({condition:ba.literal("interaction"),interaction:ba.boolean()}),gl=ba.object({condition:ba.literal("microphone"),connected:ba.boolean().optional(),muted:ba.boolean().optional()}),fl=ba.object({condition:ba.literal("key"),key:ba.string(),state:ba.enum(["down","up"]).optional(),ctrl:ba.boolean().optional(),shift:ba.boolean().optional(),alt:ba.boolean().optional(),meta:ba.boolean().optional()}),_l=ba.discriminatedUnion("condition",[Hc,Bc,qc,Uc,sl,cl,ll,dl,ul,hl,pl,ml,gl,fl]),vl=ba.object({type:ba.literal("custom:frigate-card-conditional"),conditions:_l.array(),elements:ba.lazy((()=>yl))}),yl=ba.union([Zc,Qc,vl,Fc,Vc,Yc,Kc,Jc,el,Nc,Rc,Pc,Lc,al,il,rl]).array().optional(),bl=ba.object({fit:ba.enum(["contain","cover","fill"]).optional(),position:ba.object({x:ba.number().min(0).max(100).optional(),y:ba.number().min(0).max(100).optional()}).optional(),view_box:ba.object({bottom:ba.number().min(0).max(100).optional().default(0),left:ba.number().min(0).max(100).optional().default(0),right:ba.number().min(0).max(100).optional().default(0),top:ba.number().min(0).max(100).optional().default(0)}).optional(),pan:nc.optional(),zoom:ac.optional()}),wl=ba.number().array().length(2).or(ba.string().regex(/^\s*\d+\.?\d*\s*[:/]\s*\d+\.?\d*\s*$/).transform((e=>e.split(/[:\/]/).map((e=>Number(e)))))),xl={r2c_delay_between_calls_seconds:.5,c2r_delay_between_calls_seconds:.2},Cl=function(e){return t=>{if(!t||"object"!=typeof t||!t.service)return t;const n={...t};return Object.keys(t).forEach((a=>{const i=a.match(/^data_(.+)$/),r=i?.[1];r&&!(`${e}${r}`in t)&&(n[`${e}${r}`]={action:"perform-action",perform_action:t.service,data:t[a]},delete n[a],delete n.service)})),n}},Ml=ba.preprocess(Cl("actions_"),ba.object({actions_left:lc.optional(),actions_left_start:lc.optional(),actions_left_stop:lc.optional(),actions_right:lc.optional(),actions_right_start:lc.optional(),actions_right_stop:lc.optional(),actions_up:lc.optional(),actions_up_start:lc.optional(),actions_up_stop:lc.optional(),actions_down:lc.optional(),actions_down_start:lc.optional(),actions_down_stop:lc.optional(),actions_zoom_in:lc.optional(),actions_zoom_in_start:lc.optional(),actions_zoom_in_stop:lc.optional(),actions_zoom_out:lc.optional(),actions_zoom_out_start:lc.optional(),actions_zoom_out_stop:lc.optional(),r2c_delay_between_calls_seconds:ba.number().default(xl.r2c_delay_between_calls_seconds),c2r_delay_between_calls_seconds:ba.number().default(xl.c2r_delay_between_calls_seconds),presets:ba.preprocess(Cl(""),ba.union([ba.record(lc),ba.object({service:ba.string().optional()})])).optional(),service:ba.string().optional()}).passthrough()),kl={orientation:"horizontal",mode:"auto",hide_pan_tilt:!1,hide_zoom:!1,hide_home:!1,position:"bottom-right"},Sl=ba.object({mode:ba.enum(["off","auto","on"]).default(kl.mode),position:ba.enum(["top-left","top-right","bottom-left","bottom-right"]).default(kl.position),orientation:ba.enum(["vertical","horizontal"]).default(kl.orientation),hide_pan_tilt:ba.boolean().default(kl.hide_pan_tilt),hide_zoom:ba.boolean().default(kl.hide_zoom),hide_home:ba.boolean().default(kl.hide_home),style:ba.object({}).passthrough().optional()}),El={mode:"auto",refresh_seconds:1},$l=ba.object({mode:ba.enum(["auto","camera","entity","screensaver","url"]).default(El.mode),refresh_seconds:ba.number().min(0).default(El.refresh_seconds),url:ba.string().optional(),entity:ba.string().optional(),entity_parameters:ba.string().optional()}),Al=$l.merge(Oc).default(El),zl=75,Il=300,Tl={size:100,show_details:!0,show_favorite_control:!0,show_timeline_control:!0,show_download_control:!0},jl=ba.object({size:ba.number().min(75).max(300).default(Tl.size),show_details:ba.boolean().default(Tl.show_details),show_favorite_control:ba.boolean().default(Tl.show_favorite_control),show_timeline_control:ba.boolean().default(Tl.show_timeline_control),show_download_control:ba.boolean().default(Tl.show_download_control)}),Ol={...Tl,mode:"right"},Dl=jl.extend({mode:ba.enum(["none","above","below","left","right"]).default(Ol.mode)}),Rl=ba.enum(["all","clips","snapshots"]),Pl={clustering_threshold:3,events_media_type:"all",window_seconds:3600,show_recordings:!0,style:"stack",pan_mode:"pan"},Ll=ba.enum(["pan","seek","seek-in-media","seek-in-camera"]),Nl=ba.object({clustering_threshold:ba.number().optional().default(Pl.clustering_threshold),events_media_type:Rl.optional().default(Pl.events_media_type),window_seconds:ba.number().min(60).max(86400).optional().default(Pl.window_seconds),show_recordings:ba.boolean().optional().default(Pl.show_recordings),style:ba.enum(["stack","ribbon"]).optional().default(Pl.style),pan_mode:Ll.optional().default(Pl.pan_mode)}),Fl={...Pl,mode:"none",style:"ribbon"},Vl=Nl.extend({mode:ba.enum(["none","above","below"]).default(Fl.mode),style:Nl.shape.style.default(Fl.style)}),Hl={...Pl,controls:{thumbnails:Ol}},Bl=Nl.extend({controls:ba.object({thumbnails:Dl.default(Hl.controls.thumbnails)}).default(Hl.controls)}).default(Hl),ql=ba.object({style:ba.enum(["none","chevrons","icons","thumbnails"]),size:ba.number().min(20)}),Ul=ba.enum(["none","slide"]),Wl={always_connected:!1,disconnect_seconds:90,mute_after_microphone_mute_seconds:60},Zl=ba.object({always_connected:ba.boolean().default(Wl.always_connected),disconnect_seconds:ba.number().min(0).default(Wl.disconnect_seconds),mute_after_microphone_mute_seconds:ba.number().min(0).default(Wl.mute_after_microphone_mute_seconds)}).default(Wl),Ql=ba.object({url:ba.string().transform((e=>e.replace(/\/+$/,""))).optional(),host:ba.string().optional(),modes:ba.enum(["webrtc","mse","mp4","mjpeg"]).array().optional(),stream:ba.string().optional()}),Gl=ba.object({entity:ba.string().optional(),url:ba.string().optional()}).passthrough(),Yl=ba.object({options:ba.object({audio:ba.boolean().optional(),video:ba.boolean().optional(),pauseWhenHidden:ba.boolean().optional(),disableGl:ba.boolean().optional(),disableWebAssembly:ba.boolean().optional(),preserveDrawingBuffer:ba.boolean().optional(),progressive:ba.boolean().optional(),throttled:ba.boolean().optional(),chunkSize:ba.number().optional(),maxAudioLag:ba.number().optional(),videoBufferSize:ba.number().optional(),audioBufferSize:ba.number().optional()}).optional()}),Kl={...Ol,media_type:"events",events_media_type:"all"},Xl={auto_play:[...Ys],auto_pause:[],auto_mute:[...Xs],auto_unmute:["microphone"],preload:!1,lazy_load:!0,lazy_unload:[],draggable:!0,zoomable:!0,transition_effect:"slide",show_image_during_load:!0,mode:"single",controls:{builtin:!0,next_previous:{size:48,style:"chevrons"},ptz:kl,thumbnails:Kl,timeline:Fl},microphone:{...Wl}},Jl=Dl.extend({media_type:ba.enum(["events","recordings"]).default(Xl.controls.thumbnails.media_type),events_media_type:Rl.default(Xl.controls.thumbnails.events_media_type)}),ed=ba.object({auto_pause:ba.enum(Gs).array().default(Xl.auto_pause),auto_play:ba.enum(Ys).array().default(Xl.auto_play),auto_mute:ba.enum(Xs).array().default(Xl.auto_mute),auto_unmute:ba.enum(Ks).array().default(Xl.auto_unmute),controls:ba.object({builtin:ba.boolean().default(Xl.controls.builtin),next_previous:ql.extend({style:ba.enum(["none","chevrons","icons"]).default(Xl.controls.next_previous.style),size:ql.shape.size.default(Xl.controls.next_previous.size)}).default(Xl.controls.next_previous),ptz:Sl.default(Xl.controls.ptz),thumbnails:Jl.default(Xl.controls.thumbnails),timeline:Vl.default(Xl.controls.timeline)}).default(Xl.controls),display:rc,draggable:ba.boolean().default(Xl.draggable),lazy_load:ba.boolean().default(Xl.lazy_load),lazy_unload:ba.enum(Gs).array().default(Xl.lazy_unload),microphone:Zl.default(Xl.microphone),preload:ba.boolean().default(Xl.preload),show_image_during_load:ba.boolean().default(Xl.show_image_during_load),transition_effect:Ul.default(Xl.transition_effect),zoomable:ba.boolean().default(Xl.zoomable)}).merge(Oc).default(Xl),td=ba.object({live:ed}),nd=ba.object({method:ba.enum(["standard","dashboard"]).default("standard").optional(),dashboard:ba.object({dashboard_path:ba.string().optional(),view_path:ba.string().optional()}).optional()}),ad={dependencies:{all_cameras:!1,cameras:[]},engine:"auto",frigate:{client_id:"frigate"},live_provider:"auto",motioneye:{images:{directory_pattern:"%Y-%m-%d",file_pattern:"%H-%M-%S"},movies:{directory_pattern:"%Y-%m-%d",file_pattern:"%H-%M-%S"}},reolink:{media_resolution:"low"},ptz:xl,triggers:{motion:!1,occupancy:!1,events:[...ec],entities:[]},proxy:{media:"auto",dynamic:!0,ssl_verification:"auto",ssl_ciphers:"auto"}},id=ba.object({media:ba.boolean().or(ba.literal("auto")).default(ad.proxy.media),dynamic:ba.boolean().default(ad.proxy.dynamic),ssl_verification:ba.boolean().or(ba.literal("auto")).default(ad.proxy.ssl_verification),ssl_ciphers:ba.enum(["default","insecure","intermediate","modern"]).or(ba.literal("auto")).default(ad.proxy.ssl_ciphers)}),rd=ba.object({camera_entity:ba.string().optional(),icon:ba.string().optional(),title:ba.string().optional(),capabilities:ba.object({disable:ba.enum(Ts).array().optional(),disable_except:ba.enum(Ts).array().optional()}).optional(),id:ba.string().optional(),dependencies:ba.object({all_cameras:ba.boolean().default(ad.dependencies.all_cameras),cameras:ba.string().array().default(ad.dependencies.cameras)}).default(ad.dependencies),triggers:ba.object({motion:ba.boolean().default(ad.triggers.motion),occupancy:ba.boolean().default(ad.triggers.occupancy),entities:ba.string().array().default(ad.triggers.entities),events:ba.enum(ec).array().default(ad.triggers.events)}).default(ad.triggers),engine:ba.enum(["auto","frigate","generic","motioneye","reolink"]).default("auto"),frigate:ba.object({url:ba.string().optional(),client_id:ba.string().default(ad.frigate.client_id),camera_name:ba.string().optional(),labels:ba.string().array().optional(),zones:ba.string().array().optional()}).default(ad.frigate),motioneye:ba.object({url:ba.string().optional(),images:ba.object({directory_pattern:ba.string().includes("%").default(ad.motioneye.images.directory_pattern),file_pattern:ba.string().includes("%").default(ad.motioneye.images.file_pattern)}).default(ad.motioneye.images),movies:ba.object({directory_pattern:ba.string().includes("%").default(ad.motioneye.movies.directory_pattern),file_pattern:ba.string().includes("%").default(ad.motioneye.movies.file_pattern)}).default(ad.motioneye.movies)}).default(ad.motioneye),reolink:ba.object({url:ba.string().optional(),media_resolution:ba.enum(["high","low"]).default(ad.reolink.media_resolution)}).default(ad.reolink),live_provider:ba.enum(["auto","image","ha","jsmpeg","go2rtc","webrtc-card"]).default(ad.live_provider),go2rtc:Ql.optional(),image:$l.optional().default(El),jsmpeg:Yl.optional(),webrtc_card:Gl.optional(),cast:nd.optional(),ptz:Ml.default(ad.ptz),dimensions:ba.object({aspect_ratio:wl.optional(),layout:bl.optional()}).optional(),proxy:id.default(ad.proxy)}).default(ad),od=rd.array().min(1),sd={default:Qs,camera_select:"current",interaction_seconds:300,default_reset:{every_seconds:0,after_interaction:!1,entities:[],interaction_mode:"inactive"},default_cycle_camera:!1,dark_mode:"off",triggers:{show_trigger_status:!1,filter_selected_camera:!0,actions:{trigger:"update",untrigger:"none"},untrigger_seconds:0},keyboard_shortcuts:Fs},cd=ba.enum(["all","inactive","active"]).default("inactive"),ld=ba.object({actions:ba.object({interaction_mode:cd,trigger:ba.enum(["default","live","media","none","update"]).default(sd.triggers.actions.trigger),untrigger:ba.enum(["default","none"]).default(sd.triggers.actions.untrigger)}).default(sd.triggers.actions),filter_selected_camera:ba.boolean().default(sd.triggers.filter_selected_camera),show_trigger_status:ba.boolean().default(sd.triggers.show_trigger_status),untrigger_seconds:ba.number().default(sd.triggers.untrigger_seconds)}),dd=ba.object({default:ba.enum(Zs).default(sd.default),camera_select:ba.enum([...Zs,"current"]).default(sd.camera_select),interaction_seconds:ba.number().default(sd.interaction_seconds),default_cycle_camera:ba.boolean().default(sd.default_cycle_camera),default_reset:ba.object({after_interaction:ba.boolean().default(sd.default_reset.after_interaction),every_seconds:ba.number().default(sd.default_reset.every_seconds),entities:ba.string().array().default(sd.default_reset.entities),interaction_mode:cd.default(sd.default_reset.interaction_mode)}).default(sd.default_reset),render_entities:ba.string().array().optional(),dark_mode:ba.enum(["on","off","auto"]).optional(),triggers:ld.default(sd.triggers),keyboard_shortcuts:Vs.default(sd.keyboard_shortcuts)}).merge(Oc).default(sd),ud=["left","right","top","bottom"],hd=ud,pd={priority:50,enabled:!0},md={priority:50,enabled:!1},gd={alignment:"left",button_size:40,buttons:{camera_ui:pd,cameras:pd,clips:pd,ptz_home:md,display_mode:pd,download:pd,expand:md,frigate:pd,fullscreen:pd,image:md,live:pd,media_player:pd,microphone:{...md,type:"momentary"},mute:md,play:md,ptz_controls:md,recordings:md,screenshot:md,snapshots:pd,substreams:pd,timeline:pd},position:"top",style:"hidden"},fd=Gc.extend({enabled:Gc.shape.enabled.default(pd.enabled),priority:Gc.shape.priority.default(pd.priority)}),_d=Gc.extend({enabled:Gc.shape.enabled.default(md.enabled),priority:Gc.shape.priority.default(md.priority)}),vd=ba.object({style:ba.enum(["none","hidden","overlay","hover","hover-card","outside"]).default(gd.style),position:ba.enum(ud).default(gd.position),alignment:ba.enum(hd).default(gd.alignment),buttons:ba.object({camera_ui:fd.default(gd.buttons.camera_ui),cameras:fd.default(gd.buttons.cameras),clips:fd.default(gd.buttons.clips),ptz_home:_d.default(gd.buttons.ptz_home),display_mode:fd.default(gd.buttons.display_mode),download:fd.default(gd.buttons.download),expand:_d.default(gd.buttons.expand),frigate:fd.default(gd.buttons.frigate),fullscreen:fd.default(gd.buttons.fullscreen),image:_d.default(gd.buttons.image),live:fd.default(gd.buttons.live),media_player:fd.default(gd.buttons.media_player),microphone:_d.extend({type:ba.enum(["momentary","toggle"]).default(gd.buttons.microphone.type)}).default(gd.buttons.microphone),mute:_d.default(gd.buttons.mute),play:_d.default(gd.buttons.play),ptz_controls:_d.default(gd.buttons.ptz_controls),recordings:_d.default(gd.buttons.recordings),screenshot:_d.default(gd.buttons.screenshot),snapshots:fd.default(gd.buttons.snapshots),substreams:fd.default(gd.buttons.substreams),timeline:fd.default(gd.buttons.timeline)}).default(gd.buttons),button_size:ba.number().min(20).default(gd.button_size)}).default(gd),yd={priority:50,enabled:!0},bd={height:46,items:{engine:yd,resolution:yd,technology:yd,title:yd},position:"bottom",style:"popup",popup_seconds:3},wd=ba.object({position:ba.enum(["top","bottom"]).default(bd.position),style:ba.enum(["none","overlay","hover","hover-card","outside","popup"]).default(bd.style),popup_seconds:ba.number().min(0).max(60).default(bd.popup_seconds),height:ba.number().min(20).default(bd.height),items:ba.object({engine:tl.default(bd.items.engine),technology:tl.default(bd.items.technology),resolution:tl.default(bd.items.resolution),title:tl.default(bd.items.title)}).default(bd.items)}).default(bd),xd={auto_play:[...Ys],auto_pause:[...Gs],auto_mute:[...Gs],auto_unmute:[],lazy_load:!0,draggable:!0,zoomable:!0,transition_effect:"slide",snapshot_click_plays_clip:!0,display_mode:"single",controls:{builtin:!0,next_previous:{size:48,style:"thumbnails"},thumbnails:Ol,timeline:Fl,ptz:{...kl,mode:"off"}}},Cd=ql.extend({style:ba.enum(["none","thumbnails","chevrons"]).default(xd.controls.next_previous.style),size:ql.shape.size.default(xd.controls.next_previous.size)}),Md=ba.object({auto_play:ba.enum(Ys).array().default(xd.auto_play),auto_pause:ba.enum(Gs).array().default(xd.auto_pause),auto_mute:ba.enum(Gs).array().default(xd.auto_mute),auto_unmute:ba.enum(Ys).array().default(xd.auto_unmute),lazy_load:ba.boolean().default(xd.lazy_load),draggable:ba.boolean().default(xd.draggable),zoomable:ba.boolean().default(xd.zoomable),transition_effect:Ul.default(xd.transition_effect),snapshot_click_plays_clip:ba.boolean().default(xd.snapshot_click_plays_clip),display:rc,controls:ba.object({builtin:ba.boolean().default(xd.controls.builtin),next_previous:Cd.default(xd.controls.next_previous),ptz:Sl.extend({mode:ba.enum(["off","on"]).default(xd.controls.ptz.mode)}).default(xd.controls.ptz),thumbnails:Dl.default(xd.controls.thumbnails),timeline:Vl.default(xd.controls.timeline)}).default(xd.controls)}).merge(Oc).default(xd),kd={...Ol,show_details:!1},Sd={controls:{thumbnails:kd,filter:{mode:"right"}}},Ed=Dl.extend({show_details:ba.boolean().default(kd.show_details)}),$d=ba.object({controls:ba.object({thumbnails:Ed.default(Sd.controls.thumbnails),filter:ba.object({mode:ba.enum(["none","left","right"]).default(Sd.controls.filter.mode)}).default(Sd.controls.filter)}).default(Sd.controls)}).merge(Oc).default(Sd),Ad={aspect_ratio_mode:"dynamic",aspect_ratio:[16,9],height:"auto"},zd=ba.object({aspect_ratio_mode:ba.enum(["dynamic","static","unconstrained"]).default(Ad.aspect_ratio_mode),aspect_ratio:wl.default(Ad.aspect_ratio),height:ba.string().default(Ad.height)}).default(Ad),Id=ba.object({conditions:_l.array(),merge:ba.object({}).passthrough().optional(),set:ba.object({}).passthrough().optional(),delete:ba.string().array().optional()}).array().optional(),Td=Tc.array(),jd=ba.object({conditions:_l.array(),actions:Td.optional(),actions_not:Td.optional()}).refine((e=>e.actions?.length||e.actions_not?.length),"Automations must include at least one action").array(),Od={features:{animated_progress_indicator:!0,media_chunk_size:50},style:{border_radius:!0,box_shadow:!0}},Dd=ba.object({features:ba.object({animated_progress_indicator:ba.boolean().default(Od.features.animated_progress_indicator),media_chunk_size:ba.number().min(0).max(1e3).default(Od.features.media_chunk_size),max_simultaneous_engine_requests:ba.number().min(1).optional()}).default(Od.features),style:ba.object({border_radius:ba.boolean().default(Od.style.border_radius),box_shadow:ba.boolean().default(Od.style.box_shadow)}).default(Od.style)}).default(Od),Rd={logging:!1},Pd=ba.object({logging:ba.boolean().default(Rd.logging)}).default(Rd),Ld=ba.enum(["casting","low-performance","scrubbing"]).array().optional(),Nd=ba.object({cameras:Ds(od),cameras_global:rd,view:dd,menu:vd,status_bar:wd,live:ed,media_gallery:$d,media_viewer:Md,image:Al,elements:yl,dimensions:zd,timeline:Bl,performance:Dd,debug:Pd,automations:jd.optional(),profiles:Ld,overrides:Id,card_mod:ba.unknown(),card_id:ba.string().regex(tc).optional(),type:ba.string()}),Fd={cameras:ad,view:sd,menu:gd,status_bar:bd,live:Xl,media_gallery:Sd,media_viewer:xd,image:El,timeline:Hl,performance:Od,debug:Rd};function Vd(e){const t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new e.constructor(+e):"number"==typeof e||"[object Number]"===t||"string"==typeof e||"[object String]"===t?new Date(e):new Date(NaN)}function Hd(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function Bd(e,t){const n=Vd(e);return isNaN(t)?Hd(e,NaN):t?(n.setDate(n.getDate()+t),n):n}function qd(e,t){const n=Vd(e);if(isNaN(t))return Hd(e,NaN);if(!t)return n;const a=n.getDate(),i=Hd(e,n.getTime());i.setMonth(n.getMonth()+t+1,0);return a>=i.getDate()?i:(n.setFullYear(i.getFullYear(),i.getMonth(),a),n)}function Ud(e,t){const{years:n=0,months:a=0,weeks:i=0,days:r=0,hours:o=0,minutes:s=0,seconds:c=0}=t,l=Vd(e),d=a||n?qd(l,a+12*n):l,u=1e3*(c+60*(s+60*o));return Hd(e,(r||i?Bd(d,r+7*i):d).getTime()+u)}const Wd=6048e5,Zd=864e5,Qd=6e4,Gd=36e5,Yd=1e3;let Kd={};function Xd(){return Kd}function Jd(e,t){const n=Xd(),a=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=Vd(e),r=i.getDay(),o=(r=i.getTime()?n+1:t.getTime()>=o.getTime()?n:n-1}function nu(e){const t=Vd(e);return t.setHours(0,0,0,0),t}function au(e){const t=Vd(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function iu(e){if(!(t=e,t instanceof Date||"object"==typeof t&&"[object Date]"===Object.prototype.toString.call(t)||"number"==typeof e))return!1;var t;const n=Vd(e);return!isNaN(Number(n))}function ru(e){return t=>{const n=(e?Math[e]:Math.trunc)(t);return 0===n?0:n}}function ou(e,t){return+Vd(e)-+Vd(t)}function su(e,t,n){const a=ou(e,t)/1e3;return ru(n?.roundingMethod)(a)}const cu={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function lu(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const du={date:lu({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:lu({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:lu({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},uu={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function hu(e){return(t,n)=>{let a;if("formatting"===(n?.context?String(n.context):"standalone")&&e.formattingValues){const t=e.defaultFormattingWidth||e.defaultWidth,i=n?.width?String(n.width):t;a=e.formattingValues[i]||e.formattingValues[t]}else{const t=e.defaultWidth,i=n?.width?String(n.width):e.defaultWidth;a=e.values[i]||e.values[t]}return a[e.argumentCallback?e.argumentCallback(t):t]}}function pu(e){return(t,n={})=>{const a=n.width,i=a&&e.matchPatterns[a]||e.matchPatterns[e.defaultMatchWidth],r=t.match(i);if(!r)return null;const o=r[0],s=a&&e.parsePatterns[a]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?function(e,t){for(let n=0;ne.test(o))):function(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n;return}(s,(e=>e.test(o)));let l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;return{value:l,rest:t.slice(o.length)}}}var mu;const gu={code:"en-US",formatDistance:(e,t,n)=>{let a;const i=cu[e];return a="string"==typeof i?i:1===t?i.one:i.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+a:a+" ago":a},formatLong:du,formatRelative:(e,t,n,a)=>uu[e],localize:{ordinalNumber:(e,t)=>{const n=Number(e),a=n%100;if(a>20||a<10)switch(a%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:hu({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:hu({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:hu({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:hu({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:hu({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(mu={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)},(e,t={})=>{const n=e.match(mu.matchPattern);if(!n)return null;const a=n[0],i=e.match(mu.parsePattern);if(!i)return null;let r=mu.valueCallback?mu.valueCallback(i[0]):i[0];return r=t.valueCallback?t.valueCallback(r):r,{value:r,rest:e.slice(a.length)}}),era:pu({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:pu({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:pu({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:pu({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:pu({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function fu(e){const t=Vd(e),n=function(e,t){const n=nu(e),a=nu(t),i=+n-au(n),r=+a-au(a);return Math.round((i-r)/Zd)}(t,function(e){const t=Vd(e),n=Hd(e,0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}(t));return n+1}function _u(e){const t=Vd(e),n=+eu(t)-+function(e){const t=tu(e),n=Hd(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),eu(n)}(t);return Math.round(n/Wd)+1}function vu(e,t){const n=Vd(e),a=n.getFullYear(),i=Xd(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=Hd(e,0);o.setFullYear(a+1,0,r),o.setHours(0,0,0,0);const s=Jd(o,t),c=Hd(e,0);c.setFullYear(a,0,r),c.setHours(0,0,0,0);const l=Jd(c,t);return n.getTime()>=s.getTime()?a+1:n.getTime()>=l.getTime()?a:a-1}function yu(e,t){const n=Vd(e),a=+Jd(n,t)-+function(e,t){const n=Xd(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=vu(e,t),r=Hd(e,0);return r.setFullYear(i,0,a),r.setHours(0,0,0,0),Jd(r,t)}(n,t);return Math.round(a/Wd)+1}function bu(e,t){return(e<0?"-":"")+Math.abs(e).toString().padStart(t,"0")}const wu={y(e,t){const n=e.getFullYear(),a=n>0?n:1-n;return bu("yy"===t?a%100:a,t.length)},M(e,t){const n=e.getMonth();return"M"===t?String(n+1):bu(n+1,2)},d:(e,t)=>bu(e.getDate(),t.length),a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return"am"===n?"a.m.":"p.m."}},h:(e,t)=>bu(e.getHours()%12||12,t.length),H:(e,t)=>bu(e.getHours(),t.length),m:(e,t)=>bu(e.getMinutes(),t.length),s:(e,t)=>bu(e.getSeconds(),t.length),S(e,t){const n=t.length,a=e.getMilliseconds();return bu(Math.trunc(a*Math.pow(10,n-3)),t.length)}},xu="midnight",Cu="noon",Mu="morning",ku="afternoon",Su="evening",Eu="night",$u={G:function(e,t,n){const a=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(a,{width:"abbreviated"});case"GGGGG":return n.era(a,{width:"narrow"});default:return n.era(a,{width:"wide"})}},y:function(e,t,n){if("yo"===t){const t=e.getFullYear(),a=t>0?t:1-t;return n.ordinalNumber(a,{unit:"year"})}return wu.y(e,t)},Y:function(e,t,n,a){const i=vu(e,a),r=i>0?i:1-i;if("YY"===t){return bu(r%100,2)}return"Yo"===t?n.ordinalNumber(r,{unit:"year"}):bu(r,t.length)},R:function(e,t){return bu(tu(e),t.length)},u:function(e,t){return bu(e.getFullYear(),t.length)},Q:function(e,t,n){const a=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(a);case"QQ":return bu(a,2);case"Qo":return n.ordinalNumber(a,{unit:"quarter"});case"QQQ":return n.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(a,{width:"narrow",context:"formatting"});default:return n.quarter(a,{width:"wide",context:"formatting"})}},q:function(e,t,n){const a=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(a);case"qq":return bu(a,2);case"qo":return n.ordinalNumber(a,{unit:"quarter"});case"qqq":return n.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(a,{width:"narrow",context:"standalone"});default:return n.quarter(a,{width:"wide",context:"standalone"})}},M:function(e,t,n){const a=e.getMonth();switch(t){case"M":case"MM":return wu.M(e,t);case"Mo":return n.ordinalNumber(a+1,{unit:"month"});case"MMM":return n.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(a,{width:"narrow",context:"formatting"});default:return n.month(a,{width:"wide",context:"formatting"})}},L:function(e,t,n){const a=e.getMonth();switch(t){case"L":return String(a+1);case"LL":return bu(a+1,2);case"Lo":return n.ordinalNumber(a+1,{unit:"month"});case"LLL":return n.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(a,{width:"narrow",context:"standalone"});default:return n.month(a,{width:"wide",context:"standalone"})}},w:function(e,t,n,a){const i=yu(e,a);return"wo"===t?n.ordinalNumber(i,{unit:"week"}):bu(i,t.length)},I:function(e,t,n){const a=_u(e);return"Io"===t?n.ordinalNumber(a,{unit:"week"}):bu(a,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getDate(),{unit:"date"}):wu.d(e,t)},D:function(e,t,n){const a=fu(e);return"Do"===t?n.ordinalNumber(a,{unit:"dayOfYear"}):bu(a,t.length)},E:function(e,t,n){const a=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(a,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(a,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},e:function(e,t,n,a){const i=e.getDay(),r=(i-a.weekStartsOn+8)%7||7;switch(t){case"e":return String(r);case"ee":return bu(r,2);case"eo":return n.ordinalNumber(r,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(e,t,n,a){const i=e.getDay(),r=(i-a.weekStartsOn+8)%7||7;switch(t){case"c":return String(r);case"cc":return bu(r,t.length);case"co":return n.ordinalNumber(r,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(e,t,n){const a=e.getDay(),i=0===a?7:a;switch(t){case"i":return String(i);case"ii":return bu(i,t.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},a:function(e,t,n){const a=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(e,t,n){const a=e.getHours();let i;switch(i=12===a?Cu:0===a?xu:a/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(e,t,n){const a=e.getHours();let i;switch(i=a>=17?Su:a>=12?ku:a>=4?Mu:Eu,t){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){let t=e.getHours()%12;return 0===t&&(t=12),n.ordinalNumber(t,{unit:"hour"})}return wu.h(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getHours(),{unit:"hour"}):wu.H(e,t)},K:function(e,t,n){const a=e.getHours()%12;return"Ko"===t?n.ordinalNumber(a,{unit:"hour"}):bu(a,t.length)},k:function(e,t,n){let a=e.getHours();return 0===a&&(a=24),"ko"===t?n.ordinalNumber(a,{unit:"hour"}):bu(a,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):wu.m(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getSeconds(),{unit:"second"}):wu.s(e,t)},S:function(e,t){return wu.S(e,t)},X:function(e,t,n){const a=e.getTimezoneOffset();if(0===a)return"Z";switch(t){case"X":return zu(a);case"XXXX":case"XX":return Iu(a);default:return Iu(a,":")}},x:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"x":return zu(a);case"xxxx":case"xx":return Iu(a);default:return Iu(a,":")}},O:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Au(a,":");default:return"GMT"+Iu(a,":")}},z:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Au(a,":");default:return"GMT"+Iu(a,":")}},t:function(e,t,n){return bu(Math.trunc(e.getTime()/1e3),t.length)},T:function(e,t,n){return bu(e.getTime(),t.length)}};function Au(e,t=""){const n=e>0?"-":"+",a=Math.abs(e),i=Math.trunc(a/60),r=a%60;return 0===r?n+String(i):n+String(i)+t+bu(r,2)}function zu(e,t){if(e%60==0){return(e>0?"-":"+")+bu(Math.abs(e)/60,2)}return Iu(e,t)}function Iu(e,t=""){const n=e>0?"-":"+",a=Math.abs(e);return n+bu(Math.trunc(a/60),2)+t+bu(a%60,2)}const Tu=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},ju=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},Ou={p:ju,P:(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],a=n[1],i=n[2];if(!i)return Tu(e,t);let r;switch(a){case"P":r=t.dateTime({width:"short"});break;case"PP":r=t.dateTime({width:"medium"});break;case"PPP":r=t.dateTime({width:"long"});break;default:r=t.dateTime({width:"full"})}return r.replace("{{date}}",Tu(a,t)).replace("{{time}}",ju(i,t))}},Du=/^D+$/,Ru=/^Y+$/,Pu=["D","DD","YY","YYYY"];function Lu(e){return Du.test(e)}function Nu(e){return Ru.test(e)}function Fu(e,t,n){const a=function(e,t,n){const a="Y"===e[0]?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${a} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}(e,t,n);if(console.warn(a),Pu.includes(e))throw new RangeError(a)}const Vu=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Hu=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Bu=/^'([^]*?)'?$/,qu=/''/g,Uu=/[a-zA-Z]/;function Wu(e,t,n){const a=Xd(),i=n?.locale??a.locale??gu,r=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??a.weekStartsOn??a.locale?.options?.weekStartsOn??0,s=Vd(e);if(!iu(s))throw new RangeError("Invalid time value");let c=t.match(Hu).map((e=>{const t=e[0];if("p"===t||"P"===t){return(0,Ou[t])(e,i.formatLong)}return e})).join("").match(Vu).map((e=>{if("''"===e)return{isToken:!1,value:"'"};const t=e[0];if("'"===t)return{isToken:!1,value:Zu(e)};if($u[t])return{isToken:!0,value:e};if(t.match(Uu))throw new RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}}));i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));const l={firstWeekContainsDate:r,weekStartsOn:o,locale:i};return c.map((a=>{if(!a.isToken)return a.value;const r=a.value;(!n?.useAdditionalWeekYearTokens&&Nu(r)||!n?.useAdditionalDayOfYearTokens&&Lu(r))&&Fu(r,t,String(e));return(0,$u[r[0]])(s,r,i.localize,l)})).join("")}function Zu(e){const t=e.match(Bu);return t?t[1].replace(qu,"'"):e}function Qu(e,t){const{years:n=0,months:a=0,weeks:i=0,days:r=0,hours:o=0,minutes:s=0,seconds:c=0}=t,l=function(e,t){return qd(e,-t)}(e,a+12*n),d=function(e,t){return Bd(e,-t)}(l,r+7*i),u=1e3*(c+60*(s+60*o));return Hd(e,d.getTime()-u)}function Gu(e,t){return e===t||e!=e&&t!=t}function Yu(e,t){for(var n=e.length;n--;)if(Gu(e[n][0],t))return n;return-1}var Ku=Array.prototype.splice;function Xu(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1},Xu.prototype.set=function(e,t){var n=this.__data__,a=Yu(n,e);return a<0?(++this.size,n.push([e,t])):n[a][1]=t,this};var Ju="object"==typeof global&&global&&global.Object===Object&&global,eh="object"==typeof self&&self&&self.Object===Object&&self,th=Ju||eh||Function("return this")(),nh=th.Symbol,ah=Object.prototype,ih=ah.hasOwnProperty,rh=ah.toString,oh=nh?nh.toStringTag:void 0;var sh=Object.prototype.toString;var ch="[object Null]",lh="[object Undefined]",dh=nh?nh.toStringTag:void 0;function uh(e){return null==e?void 0===e?lh:ch:dh&&dh in Object(e)?function(e){var t=ih.call(e,oh),n=e[oh];try{e[oh]=void 0;var a=!0}catch(e){}var i=rh.call(e);return a&&(t?e[oh]=n:delete e[oh]),i}(e):function(e){return sh.call(e)}(e)}function hh(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var ph="[object AsyncFunction]",mh="[object Function]",gh="[object GeneratorFunction]",fh="[object Proxy]";function _h(e){if(!hh(e))return!1;var t=uh(e);return t==mh||t==gh||t==ph||t==fh}var vh,yh=th["__core-js_shared__"],bh=(vh=/[^.]+$/.exec(yh&&yh.keys&&yh.keys.IE_PROTO||""))?"Symbol(src)_1."+vh:"";var wh=Function.prototype.toString;function xh(e){if(null!=e){try{return wh.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var Ch=/^\[object .+?Constructor\]$/,Mh=Function.prototype,kh=Object.prototype,Sh=Mh.toString,Eh=kh.hasOwnProperty,$h=RegExp("^"+Sh.call(Eh).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ah(e){return!(!hh(e)||(t=e,bh&&bh in t))&&(_h(e)?$h:Ch).test(xh(e));var t}function zh(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Ah(n)?n:void 0}var Ih=zh(th,"Map"),Th=zh(Object,"create");var jh=Object.prototype.hasOwnProperty;var Oh=Object.prototype.hasOwnProperty;function Dh(e){var t=-1,n=null==e?0:e.length;for(this.clear();++ts))return!1;var l=r.get(e),d=r.get(t);if(l&&d)return l==t&&d==e;var u=-1,h=!0,p=n&Bh?new Nh:void 0;for(r.set(e,t),r.set(t,e);++u-1&&e%1==0&&e-1&&e%1==0&&e<=Ap}var Ip={};function Tp(e){return function(t){return e(t)}}Ip["[object Float32Array]"]=Ip["[object Float64Array]"]=Ip["[object Int8Array]"]=Ip["[object Int16Array]"]=Ip["[object Int32Array]"]=Ip["[object Uint8Array]"]=Ip["[object Uint8ClampedArray]"]=Ip["[object Uint16Array]"]=Ip["[object Uint32Array]"]=!0,Ip["[object Arguments]"]=Ip["[object Array]"]=Ip["[object ArrayBuffer]"]=Ip["[object Boolean]"]=Ip["[object DataView]"]=Ip["[object Date]"]=Ip["[object Error]"]=Ip["[object Function]"]=Ip["[object Map]"]=Ip["[object Number]"]=Ip["[object Object]"]=Ip["[object RegExp]"]=Ip["[object Set]"]=Ip["[object String]"]=Ip["[object WeakMap]"]=!1;var jp="object"==typeof exports&&exports&&!exports.nodeType&&exports,Op=jp&&"object"==typeof module&&module&&!module.nodeType&&module,Dp=Op&&Op.exports===jp&&Ju.process,Rp=function(){try{var e=Op&&Op.require&&Op.require("util").types;return e||Dp&&Dp.binding&&Dp.binding("util")}catch(e){}}(),Pp=Rp,Lp=Pp&&Pp.isTypedArray,Np=Lp?Tp(Lp):function(e){return fp(e)&&zp(e.length)&&!!Ip[uh(e)]},Fp=Object.prototype.hasOwnProperty;function Vp(e,t){var n=dp(e),a=!n&&wp(e),i=!n&&!a&&kp(e),r=!n&&!a&&!i&&Np(e),o=n||a||i||r,s=o?function(e,t){for(var n=-1,a=Array(e);++n0){if(++og>=800)return arguments[0]}else og=0;return rg.apply(void 0,arguments)});function lg(e,t){return cg(function(e,t,n){return t=tg(void 0===t?e.length-1:t,0),function(){for(var a=arguments,i=-1,r=tg(a.length-t,0),o=Array(r);++i1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(r=e.length>3&&"function"==typeof r?(i--,r):void 0,o&&dg(n[0],n[1],o)&&(r=i<3?void 0:r,i=1),t=Object(t);++a-1}function Ng(e,t,n){for(var a=-1,i=null==e?0:e.length;++a=Vg){var l=t?null:Fg(e);if(l)return Zh(l);o=!1,i=Vh,c=new Nh}else c=t?[]:s;e:for(;++ae[0].toUpperCase()+e.substring(1))).join(" ")}function Ug(e,t,n){const a=e[t];return e.splice(t,1),e.splice(n,0,a),e}const Wg=e=>Array.isArray(e)?e:[e],Zg=e=>e instanceof Set?e:new Set(Wg(e));function Qg(e,t,n){return!function(e,t,n){var a=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===a?bm(e,t,void 0,n):!!a}(e,t,n)}function Gg(e,t=console.warn){e instanceof zs&&e.context?t(e,e.context):t("object"==typeof e&&"message"in e?e.message:e)}const Yg=()=>window.matchMedia("(hover: hover) and (pointer: fine)").matches,Kg=(e,t)=>Wu(e,"yyyy-MM-dd HH:mm"+(t?":ss":"")),Xg=e=>Wu(e,"yyyy-MM-dd"),Jg=(e,t)=>{window.requestIdleCallback?window.requestIdleCallback(e,{...t&&{timeout:t}}):e()};function ef(e,t){const n=function(e,t,n){const a=ou(e,t)/Gd;return ru(n?.roundingMethod)(a)}(t,e),a=function(e,t,n){const a=ou(e,t)/Qd;return ru(n?.roundingMethod)(a)}(t,e)-60*n;let i="";return n&&(i+=`${n}h `),a&&(i+=`${a}m `),i+=`${su(t,e)-60*n*60-60*a}s`,i}const tf=async(e,t)=>await Promise.all(Array.from(e).map((e=>t(e)))),nf=e=>new Date(`${e}T00:00:00`),af=async e=>{await new Promise((t=>setTimeout(t,1e3*e)))},rf=e=>!isNaN(e.getTime()),of=(e,t,n,a)=>{t?e.setAttribute(n,a??""):e.removeAttribute(n)},sf=e=>!!e,cf=e=>e instanceof HTMLElement,lf=e=>(e instanceof HTMLSlotElement?e.assignedElements({flatten:!0}):[...e.children]).filter(cf),df=e=>e?.ratio&&2===e.ratio.length?`${e.ratio[0]} / ${e.ratio[1]}`:e?.defaultStatic?"16 / 9":"auto",uf=e=>({"aspect-ratio":df(e)}),hf=e=>{if(Array.isArray(e))return e.filter((e=>void 0!==e)).map((e=>hf(e)));if("object"==typeof e&&null!==e){const t={};for(const n in e)t[n]=hf(e[n]);return t}return e},pf=(e,t,n)=>Rg(e,n)===Rg(t,n);function mf(e){if(!e)return null;const t=Ic.safeParse(e);return t.success?t.data:null}function gf(e,t){return{action:"fire-dom-event",frigate_card_action:e,...t?.cardID&&{card_id:t.cardID}}}function ff(e,t,n){return{action:"fire-dom-event",frigate_card_action:e,camera:t,...n?.cardID&&{card_id:n.cardID}}}function _f(e,t,n){return{action:"fire-dom-event",frigate_card_action:"media_player",media_player:e,media_player_action:t,...n?.cardID&&{card_id:n.cardID}}}function vf(e){return{action:"fire-dom-event",frigate_card_action:"ptz_multi",...e?.cardID&&{card_id:e.cardID},...e?.ptzAction&&{ptz_action:e.ptzAction},...e?.ptzPhase&&{ptz_phase:e.ptzPhase},...e?.ptzPreset&&{ptz_preset:e.ptzPreset},...e?.targetID&&{target_id:e.targetID}}}function yf(e,t){return e&&t?"tap"===e&&t.tap_action?t.tap_action:"hold"===e&&t.hold_action?t.hold_action:"double_tap"===e&&t.double_tap_action?t.double_tap_action:"end_tap"===e&&t.end_tap_action?t.end_tap_action:"start_tap"===e&&t.start_tap_action?t.start_tap_action:null:null}const bf=e=>Wg(e).some((e=>function(e){return void 0!==e&&"none"!==e.action}(e))),wf=e=>{e.stopPropagation()};class xf{constructor(){this._timer=null,this._repeated=!1}stop(){this._timer&&(this._repeated?window.clearInterval(this._timer):window.clearTimeout(this._timer),this._timer=null)}isRunning(){return null!==this._timer}start(e,t){this.stop(),this._timer=window.setTimeout((()=>{this._timer=null,t()}),1e3*e),this._repeated=!1}startRepeated(e,t){this.stop(),this._timer=window.setInterval((()=>{t()}),1e3*e),this._repeated=!0}}class Cf extends HTMLElement{constructor(){super(...arguments),this.holdTime=.4,this.holdTimer=new xf,this.doubleClickTimer=new xf,this.held=!1,this.started=!1}connectedCallback(){["touchcancel","mouseout","mouseup","touchmove","mousewheel","wheel","scroll"].forEach((e=>{document.addEventListener(e,(()=>{this.holdTimer.stop()}),{passive:!0})}))}bind(e,t){if(e.actionHandlerOptions)return void(e.actionHandlerOptions=t);e.actionHandlerOptions=t,e.addEventListener("contextmenu",(e=>{const t=e||window.event;return t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.cancelBubble=!0,t.returnValue=!1,!1}));const n=()=>{this.held=!1,this.holdTimer.start(this.holdTime,(()=>{this.held=!0})),this.started||(this.started=!0,et(e,"action",{action:"start_tap"}))},a=t=>{this.holdTimer.stop(),this.started&&(this.started=!1,et(e,"action",{action:"end_tap"}))},i=t=>{const n=e.actionHandlerOptions;n?.allowPropagation||wf(t),["touchend","touchcancel"].includes(t.type)&&!this.held||(a(),n?.hasHold&&this.held?et(e,"action",{action:"hold"}):n?.hasDoubleClick?"click"===t.type&&t.detail<2||!this.doubleClickTimer.isRunning()?this.doubleClickTimer.start(.25,(()=>et(e,"action",{action:"tap"}))):(this.doubleClickTimer.stop(),et(e,"action",{action:"double_tap"})):et(e,"action",{action:"tap"}))};e.addEventListener("touchstart",n,{passive:!0}),e.addEventListener("touchend",i),e.addEventListener("touchcancel",i),e.addEventListener("mousedown",n,{passive:!0}),e.addEventListener("click",i),e.addEventListener("keyup",(e=>{"Enter"===e.key&&i(e)})),e.addEventListener("mouseleave",a)}}customElements.define("action-handler-frigate-card",Cf);const Mf=(e,t)=>{const n=(()=>{const e=document.body;if(e.querySelector("action-handler-frigate-card"))return e.querySelector("action-handler-frigate-card");const t=document.createElement("action-handler-frigate-card");return e.appendChild(t),t})();n&&n.bind(e,t)},kf=ge(class extends fe{update(e,[t]){return Mf(e.element,t),U}render(e){}});var Sf=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)lp(t,gp(e)),e=Pm(e);return t}:hp;function Ef(e){return up(e,Km,Sf)}var $f=Object.prototype.hasOwnProperty;var Af=/\w*$/;var zf=nh?nh.prototype:void 0,If=zf?zf.valueOf:void 0;var Tf="[object Boolean]",jf="[object Date]",Of="[object Map]",Df="[object Number]",Rf="[object RegExp]",Pf="[object Set]",Lf="[object String]",Nf="[object Symbol]",Ff="[object ArrayBuffer]",Vf="[object DataView]",Hf="[object Float32Array]",Bf="[object Float64Array]",qf="[object Int8Array]",Uf="[object Int16Array]",Wf="[object Int32Array]",Zf="[object Uint8Array]",Qf="[object Uint8ClampedArray]",Gf="[object Uint16Array]",Yf="[object Uint32Array]";function Kf(e,t,n){var a,i,r,o=e.constructor;switch(t){case Ff:return Tm(e);case Tf:case jf:return new o(+e);case Vf:return function(e,t){var n=t?Tm(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case Hf:case Bf:case qf:case Uf:case Wf:case Zf:case Qf:case Gf:case Yf:return jm(e,n);case Of:return new o;case Df:case Lf:return new o(e);case Rf:return(r=new(i=e).constructor(i.source,Af.exec(i))).lastIndex=i.lastIndex,r;case Pf:return new o;case Nf:return a=e,If?Object(If.call(a)):{}}}var Xf=Pp&&Pp.isMap,Jf=Xf?Tp(Xf):function(e){return fp(e)&&"[object Map]"==pm(e)};var e_=Pp&&Pp.isSet,t_=e_?Tp(e_):function(e){return fp(e)&&"[object Set]"==pm(e)},n_=1,a_=2,i_=4,r_="[object Arguments]",o_="[object Function]",s_="[object GeneratorFunction]",c_="[object Object]",l_={};function d_(e,t,n,a,i,r){var o,s=t&n_,c=t&a_,l=t&i_;if(n&&(o=i?n(e,a,i,r):n(e)),void 0!==o)return o;if(!hh(e))return e;var d=dp(e);if(d){if(o=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&$f.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!s)return Om(e,o)}else{var u=pm(e),h=u==o_||u==s_;if(kp(e))return Im(e,s);if(u==c_||u==r_||h&&!i){if(o=c||h?{}:Lm(e),!s)return c?function(e,t){return Qm(e,Sf(e),t)}(e,function(e,t){return e&&Qm(t,Km(t),e)}(o,e)):function(e,t){return Qm(e,gp(e),t)}(e,function(e,t){return e&&Qm(t,Qp(t),e)}(o,e))}else{if(!l_[u])return i?e:{};o=Kf(e,u,s)}}r||(r=new Lh);var p=r.get(e);if(p)return p;r.set(e,o),t_(e)?e.forEach((function(a){o.add(d_(a,t,n,a,e,r))})):Jf(e)&&e.forEach((function(a,i){o.set(i,d_(a,t,n,i,e,r))}));var m=d?void 0:(l?c?Ef:Gp:c?Km:Qp)(e);return function(e,t){for(var n=-1,a=null==e?0:e.length;++nvoid 0===globalThis.DOMException?new __(e):new DOMException(e),y_=e=>{const t=void 0===e.reason?v_("This operation was aborted."):e.reason;return t instanceof Error?t:v_(t)};class b_{#e=[];enqueue(e,t){const n={priority:(t={priority:0,...t}).priority,run:e};if(this.size&&this.#e[this.size-1].priority>=t.priority)return void this.#e.push(n);const a=function(e,t,n){let a=0,i=e.length;for(;i>0;){const r=Math.trunc(i/2);let o=a+r;n(e[o],t)<=0?(a=++o,i-=r+1):i=r}return a}(this.#e,n,((e,t)=>t.priority-e.priority));this.#e.splice(a,0,n)}dequeue(){const e=this.#e.shift();return e?.run}filter(e){return this.#e.filter((t=>t.priority===e.priority)).map((e=>e.run))}get size(){return this.#e.length}}class w_ extends g_{#t;#n;#a=0;#i;#r;#o=0;#s;#c;#e;#l;#d=0;#u;#h;#p;timeout;constructor(e){if(super(),!("number"==typeof(e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:b_,...e}).intervalCap&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??""}\` (${typeof e.intervalCap})`);if(void 0===e.interval||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??""}\` (${typeof e.interval})`);this.#t=e.carryoverConcurrencyCount,this.#n=e.intervalCap===Number.POSITIVE_INFINITY||0===e.interval,this.#i=e.intervalCap,this.#r=e.interval,this.#e=new e.queueClass,this.#l=e.queueClass,this.concurrency=e.concurrency,this.timeout=e.timeout,this.#p=!0===e.throwOnTimeout,this.#h=!1===e.autoStart}get#m(){return this.#n||this.#a{this.#v()}),t)),!0;this.#a=this.#t?this.#d:0}return!1}#_(){if(0===this.#e.size)return this.#s&&clearInterval(this.#s),this.#s=void 0,this.emit("empty"),0===this.#d&&this.emit("idle"),!1;if(!this.#h){const e=!this.#w;if(this.#m&&this.#g){const t=this.#e.dequeue();return!!t&&(this.emit("active"),t(),e&&this.#b(),!0)}}return!1}#b(){this.#n||void 0!==this.#s||(this.#s=setInterval((()=>{this.#y()}),this.#r),this.#o=Date.now()+this.#r)}#y(){0===this.#a&&0===this.#d&&this.#s&&(clearInterval(this.#s),this.#s=void 0),this.#a=this.#t?this.#d:0,this.#x()}#x(){for(;this.#_(););}get concurrency(){return this.#u}set concurrency(e){if(!("number"==typeof e&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this.#u=e,this.#x()}async#C(e){return new Promise(((t,n)=>{e.addEventListener("abort",(()=>{n(e.reason)}),{once:!0})}))}async add(e,t={}){return t={timeout:this.timeout,throwOnTimeout:this.#p,...t},new Promise(((n,a)=>{this.#e.enqueue((async()=>{this.#d++,this.#a++;try{t.signal?.throwIfAborted();let a=e({signal:t.signal});t.timeout&&(a=function(e,t){const{milliseconds:n,fallback:a,message:i,customTimers:r={setTimeout:setTimeout,clearTimeout:clearTimeout}}=t;let o;const s=new Promise(((s,c)=>{if("number"!=typeof n||1!==Math.sign(n))throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${n}\``);if(t.signal){const{signal:e}=t;e.aborted&&c(y_(e)),e.addEventListener("abort",(()=>{c(y_(e))}))}if(n===Number.POSITIVE_INFINITY)return void e.then(s,c);const l=new f_;o=r.setTimeout.call(void 0,(()=>{if(a)try{s(a())}catch(e){c(e)}else"function"==typeof e.cancel&&e.cancel(),!1===i?s():i instanceof Error?c(i):(l.message=i??`Promise timed out after ${n} milliseconds`,c(l))}),n),(async()=>{try{s(await e)}catch(e){c(e)}})()})),c=s.finally((()=>{c.clear()}));return c.clear=()=>{r.clearTimeout.call(void 0,o),o=void 0},c}(Promise.resolve(a),{milliseconds:t.timeout})),t.signal&&(a=Promise.race([a,this.#C(t.signal)]));const i=await a;n(i),this.emit("completed",i)}catch(e){if(e instanceof f_&&!t.throwOnTimeout)return void n();a(e),this.emit("error",e)}finally{this.#f()}}),t),this.emit("add"),this.#_()}))}async addAll(e,t){return Promise.all(e.map((async e=>this.add(e,t))))}start(){return this.#h?(this.#h=!1,this.#x(),this):this}pause(){this.#h=!0}clear(){this.#e=new this.#l}async onEmpty(){0!==this.#e.size&&await this.#M("empty")}async onSizeLessThan(e){this.#e.sizethis.#e.size{const a=()=>{t&&!t()||(this.off(e,a),n())};this.on(e,a)}))}get size(){return this.#e.size}sizeBy(e){return this.#e.filter(e).length}get pending(){return this.#d}get isPaused(){return this.#h}}var x_={frigate_card:"Frigate card",frigate_card_description:"A Lovelace card for use with Frigate",live:"Live",no_media:"No media to display",recordings:"Recordings",version:"Version"},C_={cameras:{camera_entity:"Camera Entity",capabilities:{capabilities:{clips:"Clips","favorite-events":"Favorite Events","favorite-recordings":"Favorite Recordings",live:"Live",menu:"Menu",ptz:"PTZ",recordings:"Recordings",seek:"Seeking",snapshots:"Snapshots",substream:"Substream"},disable:"Disable",disable_except:"Disable except",editor_label:"Camera capabilities"},cast:{dashboard:{dashboard_path:"Dashboard path",view_path:"View path"},editor_label:"Cast options",method:"Cast method",methods:{dashboard:"Dashboard",standard:"Standard"}},dependencies:{all_cameras:"Show events for all cameras with this camera",cameras:"Show events for specific cameras with this camera",editor_label:"Dependency options"},dimensions:{aspect_ratio:"Static aspect ratio",editor_label:"Camera dimensions",layout:{editor_label:"Camera Layout",fit:"Layout fit",fits:{contain:"Media is contained/letterboxed",cover:"Media expands proportionally to cover the card",fill:"Media is stretched to fill the card"},pan:{x:"Pan horizontal percentage",y:"Pan vertical percentage"},position:{editor_label:"Layout Cover Position",x:"Horizontal placement percentage",y:"Vertical placement percentage"},view_box:{bottom:"Bottom inset percentage",editor_label:"Layout View Box",left:"Left inset percentage",right:"Right inset percentage",top:"Top inset percentage"},zoom:"Zoom factor"}},engines:{editor_label:"Camera engine options"},frigate:{camera_name:"Frigate camera name (Autodetected from entity)",client_id:"Frigate client id (For >1 Frigate server)",editor_label:"Frigate options",labels:"Frigate labels/object filters",url:"Frigate server URL",zones:"Frigate zones"},go2rtc:{editor_label:"go2rtc Options",modes:{editor_label:"go2rtc Modes",mjpeg:"Motion JPEG (MJPEG)",mp4:"MPEG-4 (MP4)",mse:"Media Source Extensions (MSE)",webrtc:"Web Real-Time Communication (WebRTC)"},stream:"go2rtc stream name"},icon:"Icon for this camera (Autodetected from entity)",id:"Unique id for this camera in this card",image:{editor_label:"Image Options",refresh_seconds:"Number of seconds after which to refresh live image (0=never)",url:"Image URL to use instead of camera entity snapshot"},live_provider:"Live view provider for this camera",live_provider_options:{editor_label:"Live provider options"},live_providers:{auto:"Automatic",go2rtc:"go2rtc",ha:"Home Assistant video stream (i.e. HLS, LL-HLS, WebRTC via HA)",image:"Home Assistant images",jsmpeg:"JSMpeg","webrtc-card":"WebRTC Card (i.e. AlexxIT's WebRTC Card)"},motioneye:{editor_label:"MotionEye options",images:{directory_pattern:"Images directory pattern",file_pattern:"Images file pattern"},movies:{directory_pattern:"Movies directory pattern",file_pattern:"Movies file pattern"},url:"MotionEye UI URL"},proxy:{dynamic:"Dynamic proxying",editor_label:"Camera proxying",media:{auto:"Media proxying automatically configured",editor_label:"Media proxying",false:"Media proxying disabled",true:"Media proxying enabled"},ssl_ciphers:{auto:"SSL ciphers automatically configured",default:"Default SSL ciphers",editor_label:"SSL ciphers",insecure:"Insecure SSL ciphers",intermediate:"Intermediate SSL ciphers",modern:"Modern SSL ciphers"},ssl_verification:{auto:"SSL verification automatically configured",editor_label:"SSL verification",false:"SSL verification disabled",true:"SSL verification enabled"}},reolink:{editor_label:"Reolink options",media_resolution:{editor_label:"Media Resolution",high:"High Resolution",low:"Low Resolution"},url:"Reolink UI URL"},title:"Title for this camera (Autodetected from entity)",triggers:{editor_label:"Trigger options",entities:"Trigger from other entities",events:{clips:"Events with new clips",editor_label:"Trigger Events",events:"All events",snapshots:"Events with new snapshots"},motion:"Trigger by auto-detecting the motion sensor",occupancy:"Trigger by auto-detecting the occupancy sensor"},webrtc_card:{editor_label:"WebRTC Card Options",entity:"WebRTC Card Camera Entity (Not a Frigate camera)",url:"WebRTC Card Camera URL"}},common:{controls:{builtin:"Built-in video controls",filter:{editor_label:"Media Filter",mode:"Filter mode",modes:{left:"Media filter in a drawer to the left",none:"No media filter",right:"Media filter in a drawer to the right"}},next_previous:{editor_label:"Next & Previous",size:"Next & previous control size in pixels",style:"Next & previous control style",styles:{chevrons:"Chevrons",icons:"Icons",none:"None",thumbnails:"Thumbnails"}},thumbnails:{editor_label:"Thumbnails",events_media_type:"Whether to show event thumbnails of clips or snapshots",events_media_types:{clips:"Clip thumbnails",snapshots:"Snapshot thumbnails"},media_type:"Whether to show thumnails of events or recordings",media_types:{events:"Events",recordings:"Recordings"},mode:"Thumbnails mode",modes:{above:"Thumbnails above",below:"Thumbnails below",left:"Thumbnails in a drawer to the left",none:"No thumbnails",right:"Thumbnails in a drawer to the right"},show_details:"Show details with thumbnails",show_download_control:"Show download control on thumbnails",show_favorite_control:"Show favorite control on thumbnails",show_timeline_control:"Show timeline control on thumbnails",size:"Thumbnails size in pixels"},timeline:{editor_label:"Mini Timeline",mode:"Mode",modes:{above:"Above",below:"Below",none:"None"},pan_mode:"Default pan mode",pan_modes:{pan:"Pan",seek:"Pan seeks across all media","seek-in-camera":"Pan seeks within selected camera only","seek-in-media":"Pan seeks within selected media item only"}}},display:{editor_label:"Display",grid_columns:"Exact number of grid columns",grid_max_columns:"Maximum number of grid columns",grid_selected_width_factor:"Increase selected media width by this factor",mode:"Mode"},image:{entity:"Entity for use with entity mode",entity_parameters:"Query parameters added to the entity-based picture URLs (e.g. width=1920&height=1080)",mode:"Image mode",modes:{camera:"Home Assistant camera snapshot of camera entity",entity:"Entity with entity_picture attribute",screensaver:"Embedded Frigate logo",url:"Arbitrary image specified by URL"},refresh_seconds:"Number of seconds after which to refresh (0=never)",url:"Static image URL"},media_action_conditions:{all:"All opportunities",hidden:"On browser/tab hiding",microphone_mute:"On microphone mute",microphone_unmute:"On microphone unmute",never:"Never",selected:"On selection",unselected:"On unselection",visible:"On browser/tab visibility"},timeline:{clustering_threshold:"The count of events at which they are clustered (0=no clustering)",events_media_type:"The events media the timeline displays",events_media_types:{all:"All event media types",clips:"Clips",snapshots:"Snapshots"},show_recordings:"Show recordings",style:"Timeline style",styles:{ribbon:"Events on a single ribbon",stack:"Stacked & clustered events"},window_seconds:"The default length of the timeline view in seconds"}},dimensions:{aspect_ratio:"Default aspect ratio (e.g. '16:9')",aspect_ratio_mode:"Aspect ratio mode",aspect_ratio_modes:{dynamic:"Aspect ratio adjusts to media",static:"Static aspect ratio",unconstrained:"Unconstrained aspect ratio"},height:"Card height in CSS units (e.g. '500px')"},live:{auto_mute:"Automatically mute live cameras",auto_pause:"Automatically pause live cameras",auto_play:"Automatically play live cameras",auto_unmute:"Automatically unmute live cameras",controls:{editor_label:"Live Controls",ptz:{editor_label:"PTZ",hide_home:"Hide home control",hide_pan_tilt:"Hide pan & tilt control",hide_zoom:"Hide zoom control",mode:"Mode",modes:{off:"Off",on:"On"},orientation:"Orientation",orientations:{horizontal:"Horizontal",vertical:"Vertical"},position:"Position",positions:{"bottom-left":"Bottom left","bottom-right":"Bottom right","top-left":"Top left","top-right":"Top right"}}},draggable:"Live cameras view can be dragged/swiped",lazy_load:"Live cameras are lazily loaded",lazy_unload:"Live cameras are lazily unloaded",microphone:{always_connected:"Always keep the microphone connected",disconnect_seconds:"Seconds after which to disconnect microphone (0=never)",editor_label:"Microphone",enabled:"Microphone enabled",mute_after_microphone_mute_seconds:"Seconds after microphone mute to mute inbound audio"},preload:"Preload live view in the background",show_image_during_load:"Show still image while the live stream is loading",transition_effect:"Live camera transition effect",zoomable:"Live cameras can be zoomed/panned"},media_viewer:{auto_mute:"Automatically mute media",auto_pause:"Automatically pause media",auto_play:"Automatically play media",auto_unmute:"Automatically unmute media",controls:{editor_label:"Media Viewer Controls"},draggable:"Media Viewer can be dragged/swiped",lazy_load:"Media Viewer media is lazily loaded in carousel",snapshot_click_plays_clip:"Clicking on a snapshot plays a related clip",transition_effect:"Media Viewer transition effect",transition_effects:{none:"No transition",slide:"Slide transition"},zoomable:"Media Viewer can be zoomed/panned"},menu:{alignment:"Menu alignment",alignments:{bottom:"Aligned to the bottom",left:"Aligned to the left",right:"Aligned to the right",top:"Aligned to the top"},button_size:"Menu button size in pixels",buttons:{alignment:"Button alignment",alignments:{matching:"Matching the menu alignment",opposing:"Opposing the menu alignment"},camera_ui:"Camera user interface",cameras:"Cameras",clips:"Clips",display_mode:"Display mode",download:"Download",enabled:"Button enabled",expand:"Expand",frigate:"Frigate menu / Default view",fullscreen:"Fullscreen",icon:"Icon",image:"Image",live:"Live",media_player:"Send to media player",microphone:"Microphone",mute:"Mute / Unmute",permanent:"Show when the menu is hidden",play:"Play / Pause",priority:"Priority",ptz_controls:"Show PTZ controls",ptz_home:"PTZ Home",recordings:"Recordings",screenshot:"Screenshot",snapshots:"Snapshots",substreams:"Substream(s)",timeline:"Timeline",type:"Button type",types:{momentary:"Momentary",toggle:"Toggle"}},position:"Menu position",positions:{bottom:"Positioned on the bottom",left:"Positioned on the left",right:"Positioned on the right",top:"Positioned on the top"},style:"Menu style",styles:{hidden:"Hidden menu",hover:"Hover menu","hover-card":"Hover menu (card-wide)",none:"No menu",outside:"Outside menu",overlay:"Overlay menu"}},overrides:{info:"This card configuration has manually specified overrides configured which may override values shown in the visual editor, please consult the code editor to view/modify these overrides"},performance:{features:{animated_progress_indicator:"Animated Progress Indicator",editor_label:"Feature Options",max_simultaneous_engine_requests:"Max simultaneous camera engine requests",media_chunk_size:"Media chunk size"},style:{border_radius:"Curves",box_shadow:"Shadows",editor_label:"Style Options"},warning:"This card is in low profile mode so defaults have changed to optimize performance"},profiles:{casting:"Casting",editor_label:"Configuration profiles","low-performance":"Low performance",scrubbing:"Video scrubbing"},status_bar:{height:"Status bar height in pixels",items:{enabled:"Item enabled",engine:"Camera engine",live_provider:"Live provider",priority:"Item priority",resolution:"Resolution",technology:"Technology",title:"Title"},popup_seconds:"Status bar popup seconds",position:"Status bar position",positions:{bottom:"Positioned on the bottom",top:"Positioned on the top"},style:"Status bar style",styles:{hover:"Hover status bar","hover-card":"Hover status bar (card-wide)",none:"No status bar",outside:"Outside status bar",overlay:"Overlay status bar",popup:"Popup status bar"}},view:{camera_select:"View for newly selected cameras",dark_mode:"Dark mode",dark_modes:{auto:"Auto",off:"Off",on:"On"},default:"Default view",default_cycle_camera:"Cycle through cameras when default view updates",default_reset:{after_interaction:"Reset to the default view after user interaction ends",editor_label:"Default view reset behavior",entities:"Reset to the default view on entity state change",every_seconds:"Reset to default view every X seconds (0=never)",interaction_mode:"How default reset behaves when the card has human interaction",interaction_modes:{active:"Only allow reset when card has active human interaction",all:"Reset regardless of human interaction",inactive:"Only reset when card has no human interaction"}},interaction_seconds:"Seconds after user action to remain interacted with (0=never)",keyboard_shortcuts:{editor_label:"Keyboard shortcuts",enabled:"Keyboard shortcuts enabled",ptz_down:"PTZ Down",ptz_home:"PTZ Home",ptz_left:"PTZ Left",ptz_right:"PTZ Right",ptz_up:"PTZ Up",ptz_zoom_in:"PTZ Zoom In",ptz_zoom_out:"PTZ Zoom Out"},triggers:{actions:{editor_label:"Trigger actions",interaction_mode:"How to handle actions when the card has human interaction",interaction_modes:{active:"Only trigger actions when card has human interaction",all:"Trigger actions regardless of human interaction",inactive:"Only trigger actions when card has no human interaction"},trigger:"Trigger action",triggers:{default:"Change to or update default view",live:"Change to or update live view",media:"Change to the relevant media view for new media",none:"No action"},untrigger:"Untrigger action",untriggers:{default:"Change to default view/camera",none:"No action"}},editor_label:"Trigger behavior",filter_selected_camera:"Only trigger on selected camera",show_trigger_status:"Show pulsing border when triggered",untrigger_seconds:"Seconds after inactive state change to untrigger"},views:{clip:"Most recent clip",clips:"Clips gallery",current:"Current view",image:"Static image",live:"Live view",recording:"Most recent recording",recordings:"Recordings gallery",snapshot:"Most recent snapshot",snapshots:"Snapshots gallery",timeline:"Timeline view"}}},M_={grid:"Show media viewer for each camera in a grid",single:"Show single media viewer"},k_={add_new_camera:"Add new camera",button:"Button",camera:"Camera",cameras:"Cameras",cameras_secondary:"What cameras to render on this card",delete:"Delete",dimensions:"Card dimensions",dimensions_secondary:"Card dimensions & shape options",image:"Image",image_secondary:"Static image view options",live:"Live",live_secondary:"Live camera view options",media_gallery:"Media gallery",media_gallery_secondary:"Media gallery options",media_viewer:"Media viewer",media_viewer_secondary:"Viewer for static media (clips, snapshots or recordings)",menu:"Menu",menu_secondary:"Menu look & feel options",move_down:"Move down",move_up:"Move up",overrides:"Overrides are active",overrides_secondary:"Dynamic configuration overrides detected",performance:"Performance",performance_secondary:"Card performance options",profiles:"Configuration profiles",profiles_secondary:"Choose pre-configured sets of defaults",status_bar:"Status bar",status_bar_secondary:"Status bar look & feel options",timeline:"Timeline",timeline_secondary:"Event timeline options",upgrade:"Upgrade",upgrade_available:"An automatic card configuration upgrade is available",view:"View",view_secondary:"What the card should show and how to show it"},S_={ptz:{down:"Down",home:"Home",left:"Left",right:"Right",up:"Up",zoom_in:"Zoom In",zoom_out:"Zoom Out"}},E_={awaiting_live:"Waiting for live stream to load ...",awaiting_media:"Waiting for media to load",camera_initialization:"Camera initialization failed",camera_initialization_reolink:"Could not initialize Reolink camera",could_not_render_elements:"Could not render picture elements",could_not_resolve:"Could not resolve media URL",diagnostics:"Card diagnostics. Please review for confidential information prior to sharing",download_no_media:"No media to download",download_sign_failed:"Could not sign media URL for download",duplicate_camera_id:"Duplicate Frigate camera id for the following camera, use the 'id' parameter to uniquely identify cameras",empty_response:"Received empty response from Home Assistant for request",failed_response:"Failed to receive response from Home Assistant for request",failed_retain:"Could not retain event",failed_sign:"Could not sign Home Assistant URL",image_load_error:"The image could not be loaded",invalid_configuration:"Invalid configuration",invalid_configuration_no_hint:"No location hint available (bad or missing type?)",invalid_configuration_override:"Invalid override configuration",invalid_elements_config:"Invalid picture elements configuration",invalid_response:"Received invalid response from Home Assistant for request",jsmpeg_no_player:"Could not start JSMPEG player",live_camera_no_endpoint:"Could not get camera endpoint for this live provider (incomplete configuration?)",live_camera_not_found:"The configured camera_entity was not found",live_camera_unavailable:"Camera unavailable",no_camera_engine:"Could not determine suitable engine for camera",no_camera_entity:"Could not find camera entity",no_camera_entity_for_triggers:"A camera entity is required in order to autodetect triggers",no_camera_id:"Could not determine camera id for the following camera, may need to set 'id' parameter manually",no_camera_name:"Could not determine a Frigate camera name for camera (or one of its dependents), please specify either 'camera_entity' or 'camera_name'",no_dashboard_or_view:"Both 'dashboard_path' and 'view_path' parameters are required for the 'dashboard' cast method",no_live_camera:"The camera_entity parameter must be set and valid for this live provider",no_supported_camera:"The selected camera does not support this view",no_supported_cameras:"No cameras support this view",reconnecting:"Reconnecting",too_many_automations:"Too many nested automation calls, please check your configuration for loops",troubleshooting:"Check troubleshooting",unknown:"Unknown error",upgrade_available:"An automated card configuration upgrade is available, please visit the visual card editor",webrtc_card_reported_error:"WebRTC Card reported an error",webrtc_card_waiting:"Waiting for WebRTC Card to load ..."},$_={camera:"Camera",duration:"Duration",in_progress:"In Progress",score:"Score",seek:"Seek",start:"Start",tag:"Tag",what:"What",where:"Where"},A_={assign:"Assign",assigning:"Assigning",modifiers:{alt:"Alt",ctrl:"Ctrl",meta:"Meta",shift:"Shift"},unassign:"Unassign"},z_={all:"All",camera:"Camera",favorite:"Favorite",media_type:"Media Type",media_types:{clips:"Clips",recordings:"Recordings",snapshots:"Snapshots"},not_favorite:"Not Favorite",select_camera:"Select camera...",select_favorite:"Select favorite...",select_media_type:"Select media type...",select_tag:"Select tag...",select_what:"Select what...",select_when:"Select when...",select_where:"Select where...",tag:"Tag",what:"What",when:"When",whens:{custom:"Custom",past_month:"Past Month",past_week:"Past Week",today:"Today",yesterday:"Yesterday"},where:"Where"},I_={unseekable:"Seek time not found in media"},T_={camera:"Camera",duration:"Duration",events:"Events",in_progress:"In Progress",seek:"Seek",start:"Start"},j_={download:"Download media",no_thumbnail:"No thumbnail available",retain_indefinitely:"Media will be indefinitely retained",timeline:"See media in timeline"},O_={select_date:"Choose date"},D_={common:x_,config:C_,display_modes:M_,editor:k_,elements:S_,error:E_,event:$_,key_assigner:A_,media_filter:z_,media_viewer:I_,recording:T_,thumbnail:j_,timeline:O_},R_=Object.freeze({__proto__:null,common:x_,config:C_,default:D_,display_modes:M_,editor:k_,elements:S_,error:E_,event:$_,key_assigner:A_,media_filter:z_,media_viewer:I_,recording:T_,thumbnail:j_,timeline:O_});const P_="en",L_={[P_]:R_};let N_;function F_(e){const t=e=>e.replace("-","_"),n=e?.language??e?.selectedLanguage;if(n)return t(n);const a=localStorage.getItem("selectedLanguage");if(a){const e=JSON.parse(a);if(e)return t(e)}for(const e of navigator.languages){const n=t(e);if(n&&n in L_)return n}return P_}function V_(e,t="",n=""){let a="";try{a=e.split(".").reduce(((e,t)=>e[t]),L_[N_??P_])}catch(e){}return a||(a=e.split(".").reduce(((e,t)=>e[t]),L_[P_])),""!==t&&""!==n&&(a=a.replace(t,n)),a}function H_(e){return"string"==typeof e?.id&&e.id||"string"==typeof e?.camera_entity&&e.camera_entity||"object"==typeof e?.webrtc_card&&e.webrtc_card&&("string"==typeof e.webrtc_card.entity&&e.webrtc_card.entity||"string"==typeof e.webrtc_card.url&&e.webrtc_card.url)||"object"==typeof e?.go2rtc&&e.go2rtc&&"string"==typeof e.go2rtc.url&&"string"==typeof e.go2rtc.stream&&`${e.go2rtc.url}#${e.go2rtc.stream}`||"object"==typeof e?.frigate&&e.frigate&&"string"==typeof e?.frigate.camera_name&&e.frigate.camera_name||""}const B_=(e,...t)=>{e?.debug?.logging&&console.debug(...t)},q_=(e,t,n)=>"preset"===t?(n?.preset?e.ptz.presets?.[n.preset]:null)??null:n?.phase?e.ptz[`actions_${t}_${n.phase}`]??null:e.ptz[`actions_${t}`]??null,U_=(e,t,n)=>!!q_(e,t,n),W_=(e,t)=>{const n=U_(e,t,{phase:"start"})&&U_(e,t,{phase:"stop"}),a=U_(e,t);return n||a?[...n?["continuous"]:[],...a?["relative"]:[]]:null},Z_=e=>{const t=W_(e,"left"),n=W_(e,"right"),a=W_(e,"up"),i=W_(e,"down"),r=W_(e,"zoom_in"),o=W_(e,"zoom_out"),s=e.ptz.presets?Object.keys(e.ptz.presets):void 0;return t?.length||n?.length||a?.length||i?.length||r?.length||o?.length||s?.length?{...t?{left:t}:{},...n?{right:n}:{},...a?{up:a}:{},...i?{down:i}:{},...r?{zoomIn:r}:{},...o?{zoomOut:o}:{},...s?{presets:s}:{}}:null};class Q_{constructor(e,t){this._capabilities=e;for(const e of t?.disable??[])this._disable(e);for(const e of Ts)t?.disableExcept?.length&&!t.disableExcept.includes(e)&&this._disable(e)}_disable(e){delete this._capabilities[e]}matches(e){let t=!0;return"string"==typeof e&&(t&&=this.has(e)),"object"==typeof e&&e.allCapabilities&&(t&&=e.allCapabilities.every((e=>this.has(e)))),"object"==typeof e&&e.anyCapabilities&&(t&&=e.anyCapabilities.some((e=>this.has(e)))),t}has(e){return!!this._capabilities[e]}getPTZCapabilities(){return this._capabilities.ptz??null}hasPTZCapability(){return!!(this._capabilities.ptz?.down?.length||this._capabilities.ptz?.up?.length||this._capabilities.ptz?.left?.length||this._capabilities.ptz?.right?.length||this._capabilities.ptz?.zoomIn?.length||this._capabilities.ptz?.zoomOut?.length||this._capabilities.ptz?.presets?.length)}getRawCapabilities(){return this._capabilities}}function G_(e,t,n){var a=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var r=Array(i);++at||r&&o&&c&&!s&&!l||a&&o&&c||!n&&c||!i)return 1;if(!a&&!r&&!l&&e=s?c:c*("desc"==n[a]?-1:1)}return e.index-t.index}(e,t,n)}))}function Ev(e,t,n,a){return null==e?[]:(dp(t)||(t=null==t?[]:[t]),dp(n=a?void 0:n)||(n=null==n?[]:[n]),Sv(e,t,n))}async function $v(e,t,n,a=!1){let i;try{i=await e.callWS(n)}catch(e){if(!(e instanceof Error))throw new zs(V_("error.failed_response"),{request:n,response:e});throw e}if(!i)throw new zs(V_("error.empty_response"),{request:n});const r=a?t.safeParse(JSON.parse(i)):t.safeParse(i);if(!r.success)throw new zs(V_("error.invalid_response"),{request:n,response:i,invalid_keys:Rs(r.error)});return r.data}const Av=ba.lazy((()=>ba.object({title:ba.string(),media_class:ba.string(),media_content_type:ba.string(),media_content_id:ba.string(),can_play:ba.boolean(),can_expand:ba.boolean(),children_media_class:ba.string().nullable().optional(),thumbnail:ba.string().nullable(),children:ba.array(Av).nullable().optional()}))),zv="video",Iv="image",Tv=60,jv=e=>Ev(e,(e=>e._metadata?.startDate),"desc");class Ov{async walkBrowseMedias(e,t,n){return t&&t.length?(await tf(t,(async t=>await this._walkBrowseMedia(e,t,n)))).flat():[]}async _walkBrowseMedia(e,t,n){let a=[];for(const i of function(e,t,n){t=(n?dg(e,t,n):void 0===t)?1:K_(Sg(t),0);var a=null==e?0:e.length;if(!a||t<1)return[];for(var i=0,r=0,o=Array(Y_(a/t));iawait this._browseMedia(e,a,{cache:n?.cache,metadataGenerator:t.metadataGenerator})));for(const e of r)for(const n of e.children??[])t.matcher(n)&&a.push(n);if(t.sorter&&(a=t.sorter(a)),t.earlyExit&&t.earlyExit(a))break}const i=t.advance?t.advance(a):null;return i?.length?await this.walkBrowseMedias(e,i,n):a}async _browseMedia(e,t,n){const a="object"==typeof t?t.media_content_id:t,i=n?.cache?n.cache.get(a):null;if(i)return i;const r={type:"media_source/browse_media",media_content_id:a},o=await $v(e,Av,r);if(n?.metadataGenerator)for(const e of o.children??[])e._metadata=n.metadataGenerator(e,"object"==typeof t?t:void 0)??void 0;return n?.cache&&n.cache.set(a,o,Ud(new Date,{seconds:60})),o}}function Dv(e,t){return bm(e,t)}function Rv(e,t){return e&&e.length?function(e,t){for(var n=-1,a=e.length,i=0,r=[];++nNv(t,e)))}add(e){this._ranges.push(e),this._ranges=Vv(this._ranges)}clear(){this._ranges=[]}}class Lv{constructor(e){this._ranges=e??[]}hasCoverage(e){const t=new Date;return this._ranges.some((n=>tet.start>=e.start&&t.end<=e.end,Fv=(e,t)=>e.start>=t.start&&e.start<=t.end||e.end>=t.start&&e.end<=t.end||e.start<=t.start&&e.end>=t.end,Vv=(e,t=0)=>{const n=[];e=Ev(e,(e=>e.start),"asc");let a=null;for(const i of e){const e=i.start instanceof Date?i.start.getTime():i.start;if(!a){a={...i};continue}(a.end instanceof Date?a.end.getTime():a.end)+1e3*t>=e?i.end>a.end&&(a.end=i.end):(n.push(a),a={...i})}return a&&n.push(a),n};class Hv{constructor(){this._data=[]}get(e){const t=new Date;for(const n of this._data)if((!n.expires||t<=n.expires)&&this._contains(e,n.request))return n.response;return null}clear(){this._data=[]}has(e){return!!this.get(e)}set(e,t,n){this._data.push({request:e,response:t,expires:n}),this._expireOldRequests()}_contains(e,t){return Dv(e,t)}_expireOldRequests(){const e=new Date;this._data=this._data.filter((t=>!t.expires||e=e.start.getTime()){if(a>e.end.getTime())break;t.push(n)}}return t}getSize(){return this._data.length}expireMatches(e){this._data=this._data.filter((t=>!e(t)))}}class Uv{constructor(){this._segments=new Map}add(e,t,n){let a=this._segments.get(e);a||(a=new qv((e=>1e3*e.start_time),(e=>e.id)),this._segments.set(e,a)),a.add(t,n)}clear(){this._segments.clear()}hasCoverage(e,t){return!!this._segments.get(e)?.hasCoverage(t)}get(e,t){return this._segments.get(e)?.get(t)??null}getSize(e){return this._segments.get(e)?.getSize()??null}getCameraIDs(){return[...this._segments.keys()]}expireMatches(e,t){this._segments.get(e)?.expireMatches(t)}}class Wv extends zs{}class Zv extends zs{}var Qv,Gv,Yv;!function(e){e.Event="event-query",e.Recording="recording-query",e.RecordingSegments="recording-segments-query",e.MediaMetadata="media-metadata"}(Qv||(Qv={})),function(e){e.Event="event-results",e.Recording="recording-results",e.RecordingSegments="recording-segments-results",e.MediaMetadata="media-metadata-results"}(Gv||(Gv={})),function(e){e.Frigate="frigate",e.Generic="generic",e.MotionEye="motioneye",e.Reolink="reolink"}(Yv||(Yv={}));const Kv=e=>e.camera_entity??e.webrtc_card?.entity??null;class Xv{constructor(e){this._entityRegistryManager=e}async createEngine(e,t){let n;switch(e){case Yv.Generic:const{GenericCameraManagerEngine:e}=await import("./engine-generic-458c9005.js").then((function(e){return e.e}));n=new e(t.stateWatcher,t.eventCallback);break;case Yv.Frigate:const{FrigateCameraManagerEngine:a}=await import("./engine-frigate-7cd5392b.js");n=new a(this._entityRegistryManager,t.stateWatcher,new Uv,new Bv,t.eventCallback);break;case Yv.MotionEye:const{MotionEyeCameraManagerEngine:i}=await import("./engine-motioneye-3521f17f.js");n=new i(this._entityRegistryManager,t.stateWatcher,new Ov,t.resolvedMediaCache,new Bv,t.eventCallback);break;case Yv.Reolink:const{ReolinkCameraManagerEngine:r}=await import("./engine-reolink-c0a1587c.js");n=new r(this._entityRegistryManager,t.stateWatcher,new Ov,t.resolvedMediaCache,new Bv,t.eventCallback)}return n}async getEngineForCamera(e,t){let n=null;if("frigate"===t.engine)n=Yv.Frigate;else if("motioneye"===t.engine)n=Yv.MotionEye;else if("generic"===t.engine)n=Yv.Generic;else if("reolink"===t.engine)n=Yv.Reolink;else{const a=Kv(t);if(a){const i=await this._entityRegistryManager.getEntity(e,a);if(!i){if(e.states[a])return Yv.Generic;throw new Wv(V_("error.no_camera_entity"),t)}switch(i?.platform){case"frigate":n=Yv.Frigate;break;case"motioneye":n=Yv.MotionEye;break;case"reolink":n=Yv.Reolink;break;default:n=Yv.Generic}}else t.frigate.camera_name?n=Yv.Frigate:(t.webrtc_card?.url||t.go2rtc?.url&&t.go2rtc?.stream)&&(n=Yv.Generic)}return n}}class Jv{constructor(){this._cameras=new Map,this._enginesByType=new Map}addCamera(e){this._cameras.set(e.getID(),e),this._enginesByType.set(e.getEngine().getEngineType(),e.getEngine())}async setCameras(e){for(const t of e){const e=this._cameras.get(t.getID());e!==t&&(this.addCamera(t),await(e?.destroy()))}for(const t of this._cameras.values())e.includes(t)||(await t.destroy(),this._cameras.delete(t.getID()))}async reset(){await tf(this._cameras.values(),(e=>e.destroy())),this._cameras.clear(),this._enginesByType.clear()}getCamera(e){return this._cameras.get(e)??null}getCameras(){return this._cameras}getCameraConfig(e){return this._cameras.get(e)?.getConfig()??null}hasCameraID(e){return this._cameras.has(e)}getCameraCount(){return this._cameras.size}getDefaultCameraID(){return this._cameras.keys().next().value??null}*getCameraConfigs(e){for(const[t,n]of this.getCameraConfigEntries(e))yield n}*getCameraConfigEntries(e){for(const t of e??this._cameras.keys()){const e=this.getCameraConfig(t);e&&(yield[t,e])}}getCameraIDs(){return new Set(this._cameras.keys())}getCameraIDsWithCapability(e){const t=new Set;for(const n of this._cameras.values())n.getCapabilities()?.matches(e)&&t.add(n.getID());return t}getCameraConfigForMedia(e){return this.getCameraConfig(e.getCameraID())}getEngineOfType(e){return this._enginesByType.get(e)??null}getEngineForCameraID(e){return this._cameras.get(e)?.getEngine()??null}getEnginesForCameraIDs(e){const t=new Map;for(const n of e){const e=this.getEngineForCameraID(n);e&&(t.has(e)||t.set(e,new Set),t.get(e)?.add(n))}return t.size?t:null}getEngineForMedia(e){return this.getEngineForCameraID(e.getCameraID())}getAllDependentCameras(e,t){const n=new Set,a=new Set,i=e=>{n.add(e);const r=this.getCamera(e),o=r?.getConfig();if(r&&o){t&&!r.getCapabilities()?.matches(t)||a.add(e);const s=new Set;o.dependencies.cameras.forEach((e=>s.add(e))),o.dependencies.all_cameras&&this.getCameraIDs().forEach((e=>s.add(e)));for(const e of s)n.has(e)||i(e)}};return i(e),a}}const ey=e=>{return Ev((n=e=>e.getID()??e,(t=e)&&t.length?Hg(t,xv(n)):[]),(e=>e.getStartTime()??e.getID()),"asc");var t,n};class ty{static isEventQuery(e){return e.type===Qv.Event}static isRecordingQuery(e){return e.type===Qv.Recording}static isRecordingSegmentsQuery(e){return e.type===Qv.RecordingSegments}static isMediaMetadataQuery(e){return e.type===Qv.MediaMetadata}}class ny{static isEventQueryResult(e){return e.type===Gv.Event}static isRecordingQueryResult(e){return e.type===Gv.Recording}static isRecordingSegmentsQueryResult(e){return e.type===Gv.RecordingSegments}static isMediaMetadataQueryResult(e){return e.type===Gv.MediaMetadata}}class ay{constructor(e,t){this._requestLimit=new w_,this._api=e,this._engineFactory=t?.factory??new Xv(this._api.getEntityRegistryManager()),this._store=t?.store??new Jv}async initializeCamerasFromConfig(){const e=this._api.getConfigManager().getConfig(),t=this._api.getHASSManager().getHASS();if(!e||!t)return!1;this._requestLimit.concurrency=e.performance.features.max_simultaneous_engine_requests??1/0;const n=e.cameras.map((t=>{return n={},a=u_(e?.cameras_global),hg(n,a,t,((e,t)=>Array.isArray(t)?t:void 0));var n,a}));try{await this._initializeCameras(n)}catch(e){return this._api.getMessageManager().setErrorIfHigherPriority(e,V_("error.camera_initialization")),!1}return!0}async reset(){await this._store.reset()}async _getEnginesForCameras(e){const t=new Map,n=new Map,a=this._api.getHASSManager().getHASS(); +/* istanbul ignore if: the if path cannot be reached -- @preserve */ +if(!a)return t;const i=await(async e=>await tf(e,(e=>this._engineFactory.getEngineForCamera(a,e))))(e);for(const[a,r]of e.entries()){const e=i[a],o=e?n.get(e)??await this._engineFactory.createEngine(e,{eventCallback:e=>this._api.getTriggersManager().handleCameraEvent(e),stateWatcher:this._api.getHASSManager().getStateWatcher(),resolvedMediaCache:this._api.getResolvedMediaCache()}):null;if(!o||!e)throw new Wv(V_("error.no_camera_engine"),u_(r));n.set(e,o),t.set(r,o)}return t}async _initializeCameras(e){const t=new Date,n=this._api.getHASSManager().getHASS(); +/* istanbul ignore if: the if path cannot be reached -- @preserve */ +if(!n)return;e.some((e=>(e=>e.triggers.motion||e.triggers.occupancy)(e)))&&await this._api.getEntityRegistryManager().fetchEntityList(n);const a=await this._getEnginesForCameras(e),i=await tf(a.entries(),(async([e,t])=>await t.createCamera(n,e))),r=async()=>{i.forEach((e=>e.destroy()))},o=new Set;for(const e of i){const t=H_(e.getConfig());if(!t)throw await r(),new Wv(V_("error.no_camera_id"),e.getConfig());if(o.has(t))throw await r(),new Wv(V_("error.duplicate_camera_id"),e.getConfig());e.setID(t),o.add(t)}await this._store.setCameras(i),B_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card CameraManager initialized (Cameras: ",this._store.getCameras(),`, Duration: ${((new Date).getTime()-t.getTime())/1e3}s,`,")")}isInitialized(){return this._store.getCameraCount()>0}getStore(){return this._store}generateDefaultEventQueries(e,t){return this._generateDefaultQueries(e,{type:Qv.Event,...t})}generateDefaultRecordingQueries(e,t){return this._generateDefaultQueries(e,{type:Qv.Recording,...t})}generateDefaultRecordingSegmentsQueries(e,t){return this._generateDefaultQueries(e,{type:Qv.RecordingSegments,...t})}_generateDefaultQueries(e,t){const n=[],a=Zg(e),i=this._store.getEnginesForCameraIDs(a);if(!i)return null;for(const[e,a]of i){let i=null; +/* istanbul ignore else: the else path cannot be reached -- @preserve */ty.isEventQuery(t)?i=e.generateDefaultEventQuery(this._store,a,t):ty.isRecordingQuery(t)?i=e.generateDefaultRecordingQuery(this._store,a,t):ty.isRecordingSegmentsQuery(t)&&(i=e.generateDefaultRecordingSegmentsQuery(this._store,a,t));for(const e of i??[])n.push(e)}return n.length?n:null}async getMediaMetadata(){const e=new Set,t=new Set,n=new Set,a=new Set,i={type:Qv.MediaMetadata,cameraIDs:this._store.getCameraIDs()},r=await this._handleQuery(i);for(const i of r.values())i.metadata.tags&&i.metadata.tags.forEach(e.add,e),i.metadata.what&&i.metadata.what.forEach(t.add,t),i.metadata.where&&i.metadata.where.forEach(n.add,n),i.metadata.days&&i.metadata.days.forEach(a.add,a);return t.size||n.size||a.size||e.size?{...e.size&&{tags:e},...t.size&&{what:t},...n.size&&{where:n},...a.size&&{days:a}}:null}async getEvents(e,t){return await this._handleQuery(e,t)}async getRecordings(e,t){return await this._handleQuery(e,t)}async getRecordingSegments(e,t){return await this._handleQuery(e,t)}async executeMediaQueries(e,t){return this._convertQueryResultsToMedia(await this._handleQuery(e,t))}async extendMediaQueries(e,t,n,a){if(!this._api.getHASSManager().getHASS())return null;const i=e=>{let n=null;for(const a of t){const t=a.getStartTime();t&&(!n||"earliest"===e&&tn)&&(n=t)}return n},r=this._api.getConfigManager().getCardWideConfig()?.performance?.features.media_chunk_size??50,o=[],s=[];for(const t of e){const e={...t}; +/* istanbul ignore else: the else path cannot be reached -- @preserve */if("later"===n){const t=i("latest");t&&(e.start=t,delete e.end)}else if("earlier"===n){const t=i("earliest");t&&(e.end=t,delete e.start)}e.limit=r,s.push({...t,limit:(t.limit??0)+r}),o.push(e)}const c=this._convertQueryResultsToMedia(await this._handleQuery(o,a));if(!c.length)return null;const l=ey(t.concat(c));return l.length===t.length?null:{queries:s,results:l}}async getMediaDownloadPath(e){const t=this._store.getCameraConfigForMedia(e),n=this._store.getEngineForMedia(e),a=this._api.getHASSManager().getHASS();return t&&n&&a?await n.getMediaDownloadPath(a,t,e):null}getMediaCapabilities(e){const t=this._store.getEngineForMedia(e);return t?t.getMediaCapabilities(e):null}async favoriteMedia(e,t){const n=this._store.getCameraConfigForMedia(e),a=this._store.getEngineForMedia(e),i=this._api.getHASSManager().getHASS();if(!n||!a||!i)return;const r=new Date;await this._requestLimit.add((()=>a.favoriteMedia(i,n,e,t))),B_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card CameraManager favorite request (",`Duration: ${((new Date).getTime()-r.getTime())/1e3}s,`,"Media:",e.getID(),", Favorite:",t,")")}areMediaQueriesResultsFresh(e,t){const n=new Date;for(const a of e){const e=this._store.getEnginesForCameraIDs(a.cameraIDs);for(const[i,r]of e??[]){const e=i.getQueryResultMaxAge({...a,cameraIDs:r});if(null!==e&&Ud(t,{seconds:e})a?null:await this._requestLimit.add((()=>i.getMediaSeekTime(r,this._store,e,t)))??null}async _handleQuery(e,t){const n=Wg(e),a=new Map,i=new Date,r=this._api.getHASSManager().getHASS();if(!r)return a;const o=async(e,n)=>{let i=null; +/* istanbul ignore else: the else path cannot be reached -- @preserve */ty.isEventQuery(n)?i=await e.getEvents(r,this._store,n,t):ty.isRecordingQuery(n)?i=await e.getRecordings(r,this._store,n,t):ty.isRecordingSegmentsQuery(n)?i=await e.getRecordingSegments(r,this._store,n,t):ty.isMediaMetadataQuery(n)&&(i=await e.getMediaMetadata(r,this._store,n,t)),i?.forEach(((e,t)=>a.set(t,e)))},s=async e=>{const t=this._store.getEnginesForCameraIDs(e.cameraIDs);t&&await Promise.all(Array.from(t.keys()).map((n=>this._requestLimit.add((()=>o(n,{...e,cameraIDs:t.get(n)}))))))};await Promise.all(n.map((e=>s(e))));const c=(l=Array.from(a.values()).map((e=>Number(e.cached??0))))&&l.length?function(e,t){for(var n,a=-1,i=e.length;++athis._store.getCamera(e))).filter(sf);return new Q_({live:t.some((e=>e.getCapabilities()?.has("live"))),clips:t.some((e=>e.getCapabilities()?.has("clips"))),recordings:t.some((e=>e.getCapabilities()?.has("recordings"))),snapshots:t.some((e=>e.getCapabilities()?.has("snapshots"))),"favorite-events":t.some((e=>e.getCapabilities()?.has("favorite-events"))),"favorite-recordings":t.some((e=>e.getCapabilities()?.has("favorite-recordings"))),seek:t.some((e=>e.getCapabilities()?.has("seek"))),menu:t.some((e=>e.getCapabilities()?.has("menu")))})}async executePTZAction(e,t,n){const a=this._store.getCameraConfig(e);if(!a)return;const i=q_(a,t,n);if(i)return await this._api.getActionsManager().executeActions(i);const r=this._api.getHASSManager().getHASS(),o=this._store.getEngineForCameraID(e);return o&&r?await this._requestLimit.add((()=>o.executePTZAction(r,a,t,n))):void 0}}class iy{constructor(e){this._cache=new Map,this._keyCallback=e}has(e){return this._cache.has(e)}getMatches(e){return[...this._cache.values()].filter(e)}get(e){return this._cache.get(e)??null}add(e){const t=e=>this._cache.set(this._keyCallback(e),e);Array.isArray(e)?e.forEach(t):t(e)}}const ry=ba.object({id:ba.string(),model:ba.string().nullable(),config_entries:ba.string().array(),manufacturer:ba.string().nullable()}).array();class oy{constructor(e){this._fetchedDeviceList=!1,this._cache=e}async getDevice(e,t){return this._cache.has(t)?this._cache.get(t):(await this._fetchDeviceList(e),this._cache.get(t)??null)}async getMatchingDevices(e,t){return await this._fetchDeviceList(e),this._cache.getMatches(t)}async _fetchDeviceList(e){if(this._fetchedDeviceList)return;let t=null;try{t=await $v(e,ry,{type:"config/device_registry/list"})}catch(e){return void Gg(e)}this._cache.add(t),this._fetchedDeviceList=!0}}const sy=ba.object({config_entry_id:ba.string().nullable(),device_id:ba.string().nullable(),disabled_by:ba.string().nullable(),entity_id:ba.string(),hidden_by:ba.string().nullable(),platform:ba.string(),translation_key:ba.string().nullable(),unique_id:ba.string().or(ba.number()).optional()}),cy=sy.array();class ly{constructor(e){this._fetchedEntityList=!1,this._cache=e}async getEntity(e,t){const n=this._cache.get(t);if(n)return n;let a=null;try{a=await $v(e,sy,{type:"config/entity_registry/get",entity_id:t})}catch(e){return Gg(e),null}return this._cache.add(a),a}async getMatchingEntities(e,t){return await this.fetchEntityList(e),this._cache.getMatches(t)}async getEntities(e,t){const n=new Map;return await Promise.all(t.map((async t=>{const a=await this.getEntity(e,t);a&&n.set(t,a)}))),n}async fetchEntityList(e){if(this._fetchedEntityList)return;let t=null;try{t=await $v(e,cy,{type:"config/entity_registry/list"})}catch(e){return void Gg(e)}this._cache.add(t),this._fetchedEntityList=!0}}class dy extends Map{constructor(e={}){if(super(),!(e.maxSize&&e.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");if("number"==typeof e.maxAge&&0===e.maxAge)throw new TypeError("`maxAge` must be a number greater than 0");this.maxSize=e.maxSize,this.maxAge=e.maxAge||Number.POSITIVE_INFINITY,this.onEviction=e.onEviction,this.cache=new Map,this.oldCache=new Map,this._size=0}_emitEvictions(e){if("function"==typeof this.onEviction)for(const[t,n]of e)this.onEviction(t,n.value)}_deleteIfExpired(e,t){return"number"==typeof t.expiry&&t.expiry<=Date.now()&&("function"==typeof this.onEviction&&this.onEviction(e,t.value),this.delete(e))}_getOrDeleteIfExpired(e,t){if(!1===this._deleteIfExpired(e,t))return t.value}_getItemValue(e,t){return t.expiry?this._getOrDeleteIfExpired(e,t):t.value}_peek(e,t){const n=t.get(e);return this._getItemValue(e,n)}_set(e,t){this.cache.set(e,t),this._size++,this._size>=this.maxSize&&(this._size=0,this._emitEvictions(this.oldCache),this.oldCache=this.cache,this.cache=new Map)}_moveToRecent(e,t){this.oldCache.delete(e),this._set(e,t)}*_entriesAscending(){for(const e of this.oldCache){const[t,n]=e;if(!this.cache.has(t)){!1===this._deleteIfExpired(t,n)&&(yield e)}}for(const e of this.cache){const[t,n]=e;!1===this._deleteIfExpired(t,n)&&(yield e)}}get(e){if(this.cache.has(e)){const t=this.cache.get(e);return this._getItemValue(e,t)}if(this.oldCache.has(e)){const t=this.oldCache.get(e);if(!1===this._deleteIfExpired(e,t))return this._moveToRecent(e,t),t.value}}set(e,t,{maxAge:n=this.maxAge}={}){const a="number"==typeof n&&n!==Number.POSITIVE_INFINITY?Date.now()+n:void 0;return this.cache.has(e)?this.cache.set(e,{value:t,expiry:a}):this._set(e,{value:t,expiry:a}),this}has(e){return this.cache.has(e)?!this._deleteIfExpired(e,this.cache.get(e)):!!this.oldCache.has(e)&&!this._deleteIfExpired(e,this.oldCache.get(e))}peek(e){return this.cache.has(e)?this._peek(e,this.cache):this.oldCache.has(e)?this._peek(e,this.oldCache):void 0}delete(e){const t=this.cache.delete(e);return t&&this._size--,this.oldCache.delete(e)||t}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}resize(e){if(!(e&&e>0))throw new TypeError("`maxSize` must be a number greater than 0");const t=[...this._entriesAscending()],n=t.length-e;n<0?(this.cache=new Map(t),this.oldCache=new Map,this._size=t.length):(n>0&&this._emitEvictions(t.slice(0,n)),this.oldCache=new Map(t.slice(n)),this.cache=new Map,this._size=0),this.maxSize=e}*keys(){for(const[e]of this)yield e}*values(){for(const[,e]of this)yield e}*[Symbol.iterator](){for(const e of this.cache){const[t,n]=e;!1===this._deleteIfExpired(t,n)&&(yield[t,n.value])}for(const e of this.oldCache){const[t,n]=e;if(!this.cache.has(t)){!1===this._deleteIfExpired(t,n)&&(yield[t,n.value])}}}*entriesDescending(){let e=[...this.cache];for(let t=e.length-1;t>=0;--t){const n=e[t],[a,i]=n;!1===this._deleteIfExpired(a,i)&&(yield[a,i.value])}e=[...this.oldCache];for(let t=e.length-1;t>=0;--t){const n=e[t],[a,i]=n;if(!this.cache.has(a)){!1===this._deleteIfExpired(a,i)&&(yield[a,i.value])}}}*entriesAscending(){for(const[e,t]of this._entriesAscending())yield[e,t.value]}get size(){if(!this._size)return this.oldCache.size;let e=0;for(const t of this.oldCache.keys())this.cache.has(t)||e++;return Math.min(this._size+e,this.maxSize)}entries(){return this.entriesAscending()}forEach(e,t=this){for(const[n,a]of this.entriesAscending())e.call(t,a,n,this)}get[Symbol.toStringTag](){return JSON.stringify([...this.entriesAscending()])}}class uy{constructor(){this._cache=new dy({maxSize:1e3})}has(e){return this._cache.has(e)}get(e){return this._cache.get(e)}set(e,t){this._cache.set(e,t)}}const hy=async(e,t,n)=>{const a=n?n.get(t):void 0;if(a)return a;const i={type:"media_source/resolve_media",media_content_id:t};let r=null;try{r=await $v(e,js,i)}catch(e){Gg(e)}return n&&r&&n.set(t,r),r};class py{constructor(e,t,n){this._context=e,this._action=t,this._config=n}async execute(e){}async stop(){}}class my extends py{}class gy extends my{async execute(e){const t=this._action.camera??(this._action.triggered?e.getTriggersManager().getMostRecentlyTriggeredCameraID():null),n=e.getViewManager().getView(),a=e.getConfigManager().getConfig();if(t&&n){const i=a?.view.camera_select??"current",r="current"===i?n.view:i;await e.getViewManager().setViewByParametersWithNewQuery({params:{view:r,camera:t},failSafe:!0})}}}class fy extends my{async execute(e){e.getCameraURLManager().openURL()}}class _y extends my{async execute(e){e.getViewManager().setViewDefault()}}class vy extends my{async execute(e){await e.getViewManager().setViewByParametersWithNewQuery({params:{displayMode:this._action.display_mode}})}}class yy extends my{async execute(e){await e.getDownloadManager().downloadViewerMedia()}}class by extends my{async execute(e){e.getExpandManager().toggleExpanded()}}class wy extends my{async execute(e){e.getFullscreenManager().toggleFullscreen()}}class xy extends py{async execute(e){const t=e.getHASSManager().getHASS();t&&at(e.getCardElementManager().getElement(),t,this._config??{},this._action)}}class Cy extends my{async execute(e){console[this._action.level](this._action.message)}}const My=(e,t)=>e.context?.live?.overrides?.get(t??e.camera)??t??e.camera,ky=e=>My(e)!==e.camera,Sy=(e,t)=>{const n=e.context?.live?.overrides??new Map;n.set(e.camera,t),e.mergeInContext({live:{overrides:n}})};class Ey extends my{async execute(e){const t=this._action.media_player,n=e.getMediaPlayerManager(),a=e.getViewManager().getView(),i=a?.queryResults?.getSelectedResult()??null;"stop"===this._action.media_player_action?await n.stop(t):a?.is("live")?await n.playLive(t,My(a)):a?.isViewerView()&&i&&await n.playMedia(t,i)}}class $y extends my{async execute(e){e.getCardElementManager().toggleMenu()}}class Ay extends my{async execute(e){await e.getMicrophoneManager().connect()}}class zy extends my{async execute(e){e.getMicrophoneManager().disconnect()}}class Iy extends my{async execute(e){e.getMicrophoneManager().mute()}}class Ty extends my{async execute(e){await e.getMicrophoneManager().unmute()}}class jy extends my{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.mute())}}class Oy extends my{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.pause())}}class Dy extends my{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.play())}}const Ry=(e,t)=>{if(e.isViewerView()){const n=e.queryResults?.getSelectedResult()?.getID()??null;return"ptz"!==t?.type&&n?{targetID:n,type:"digital"}:null}if(e.is("live")){const n=My(e);let a="digital";return"digital"!==t?.type&&t?.cameraManager&&(Py(t.cameraManager,n)&&(a="ptz"),"ptz"!==a&&"ptz"===t?.type)?null:{targetID:n,type:a}}return null},Py=(e,t)=>!!e.getStore().getCamera(t)?.getCapabilities()?.hasPTZCapability();var Ly=ug((function(e,t,n){Jm(e,t,n)}));const Ny=(e,t)=>{t?.[e]?.inProgressAction?.stop()},Fy=(e,t,n,a)=>{Ly(t,{[n]:{[e]:{inProgressAction:a}}})};class Vy extends my{constructor(){super(...arguments),this._timer=new xf}async stop(){this._timer.stop()}async execute(e){const t=e.getViewManager().getView();if(!t)return;const n=this._action.camera??Ry(t,{type:"ptz",cameraManager:e.getCameraManager()})?.targetID??null,a=n?e.getCameraManager().getCameraCapabilities(n)?.getPTZCapabilities():null,i=n?e.getCameraManager().getStore().getCameraConfig(n)?.ptz:null;if(!n||!a||!i)return;if(!this._action.ptz_action)return void(a.presets&&a.presets.length>=1&&await e.getCameraManager().executePTZAction(n,"preset",{phase:this._action.ptz_phase,preset:a.presets[0]}));const r=(e=>{switch(e){case"left":case"right":case"up":case"down":return e;case"zoom_in":return"zoomIn";case"zoom_out":return"zoomOut"}return null})(this._action.ptz_action);if(r&&a[r]?.includes(this._action.ptz_phase?"continuous":"relative")||"preset"===this._action.ptz_action)return await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{phase:this._action.ptz_phase,preset:this._action.ptz_preset});if("start"===this._action.ptz_phase){Ny(n,this._context.ptz),Fy(n,this._context,"ptz",this);const t=async()=>{this._action.ptz_action&&await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset}),this._timer.start(i.r2c_delay_between_calls_seconds,t)};await t()}else"stop"===this._action.ptz_phase?Ny(n,this._context.ptz):(await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset,phase:"start"}),this._timer.start(i.c2r_delay_between_calls_seconds,(async()=>{this._action.ptz_action&&await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset,phase:"stop"})})))}}class Hy extends my{async execute(e){e.getViewManager().setViewWithMergedContext({ptzControls:{enabled:this._action.enabled}})}}function By(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=Cg(n))==n?n:0),void 0!==t&&(t=(t=Cg(t))==t?t:0),function(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}(Cg(e),t,n)}const qy=50,Uy=50,Wy=1,Zy=4,Qy=e=>void 0===e?.pan?.x&&void 0===e?.pan?.y&&void 0===e?.zoom;class Gy{constructor(e){this._context=e}modify(e){e.mergeInContext(this._context)}}const Yy=(e,t)=>({zoom:{[e]:{observed:t?.observed??void 0,requested:t?.requested??null}}}),Ky=(e,t,n)=>{t&&n&&t.setViewByParameters({modifiers:[new Gy(Yy(n,{observed:e.detail}))]})};class Xy extends my{constructor(){super(...arguments),this._timer=new xf}async _stepChange(e,t){e.getViewManager().setViewWithMergedContext(Yy(t,{requested:this._convertActionToZoomSettings(e.getViewManager().getView()?.context?.zoom?.[t]?.observed)}))}async stop(){this._timer.stop()}async execute(e){const t=e.getViewManager().getView();if(!t)return;const n=this._action.target_id??Ry(t,{type:"digital",cameraManager:e.getCameraManager()})?.targetID;return n?this._action.absolute||!this._action.ptz_phase?await this._stepChange(e,n): +/* istanbul ignore else: the else path cannot be reached -- @preserve */ +void("start"===this._action.ptz_phase?(Ny(n,this._context.ptzDigital),Fy(n,this._context,"ptzDigital",this),await this._stepChange(e,n),this._timer.startRepeated(.1,(()=>this._stepChange(e,n)))):"stop"===this._action.ptz_phase&&(Ny(n,this._context.ptzDigital),delete this._context.ptzDigital?.[n])):void 0}_convertActionToZoomSettings(e){if(!this._action.absolute&&!this._action.ptz_action)return{};if(this._action.absolute)return this._action.absolute;const t=e?.zoom??1,n=e?.pan?.x??50,a=e?.pan?.y??50,i="zoom_in"===this._action.ptz_action?.1:"zoom_out"===this._action.ptz_action?-.1:0,r="left"===this._action.ptz_action?-5:"right"===this._action.ptz_action?5:0,o="up"===this._action.ptz_action?-5:"down"===this._action.ptz_action?5:0;return{zoom:By(t+i,1,10),pan:{x:By(n+r,0,100),y:By(a+o,0,100)}}}}class Jy extends my{async execute(e){const t=e.getViewManager().getView();let n=null,a=null;if(this._action.target_id)n=this._action.target_id,a=Py(e.getCameraManager(),n)?"ptz":"digital";else if(t){const i=Ry(t,{cameraManager:e.getCameraManager()});n=i?.targetID??null,a=i?.type??null}n&&null!==a&&("ptz"===a?this._toPTZAction(n):this._toPTZDigitalAction(n)).execute(e)}_toPTZAction(e){return new Vy(this._context,(t={cardID:this._action.card_id,cameraID:e,ptzAction:this._action.ptz_action,ptzPhase:this._action.ptz_phase,ptzPreset:this._action.ptz_preset},{action:"fire-dom-event",frigate_card_action:"ptz",...t?.cardID&&{card_id:t.cardID},...t?.ptzAction&&{ptz_action:t.ptzAction},...t?.ptzPhase&&{ptz_phase:t.ptzPhase},...t?.ptzPreset&&{ptz_preset:t.ptzPreset},...t?.cameraID&&{camera:t.cameraID}}),this._config);var t}_toPTZDigitalAction(e){return new Xy(this._context,(t={cardID:this._action.card_id,ptzPhase:this._action.ptz_phase,ptzAction:this._action.ptz_action,targetID:e},{action:"fire-dom-event",frigate_card_action:"ptz_digital",...t?.cardID&&{card_id:t.cardID},...t?.ptzAction&&{ptz_action:t.ptzAction},...t?.ptzPhase&&{ptz_phase:t.ptzPhase},...t?.absolute&&{absolute:t.absolute},...t?.targetID&&{target_id:t.targetID}}),this._config);var t}}class eb extends my{async execute(e){await e.getDownloadManager().downloadScreenshot()}}class tb extends my{async execute(e){var t;await af((t=this._action.duration,3600*(t.h??0)+60*(t.m??0)+(t.s??0)+(t.ms??0)/1e3))}}class nb extends my{async execute(e){switch(this._action.status_bar_action){case"reset":e.getStatusBarItemManager().removeAllDynamicStatusBarItems();break;case"add":this._action.items?.forEach((t=>e.getStatusBarItemManager().addDynamicStatusBarItem(t)));break;case"remove":this._action.items?.forEach((t=>e.getStatusBarItemManager().removeDynamicStatusBarItem(t)))}}}class ab{modify(e){(e=>{const t=e.context?.live?.overrides;t&&t.has(e.camera)&&e.context?.live?.overrides?.delete(e.camera)})(e)}}class ib extends my{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new ab]})}}class rb{constructor(e){this._api=e}modify(e){const t=[...this._api.getCameraManager().getStore().getAllDependentCameras(e.camera,"substream")];if(t.length<=1)return;const n=My(e),a=t.indexOf(n),i=a<0?0:(a+1)%t.length;Sy(e,t[i])}}class ob extends my{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new rb(e)]})}}class sb{constructor(e){this._substreamID=e}modify(e){Sy(e,this._substreamID)}}class cb extends my{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new sb(this._action.camera)]})}}class lb extends my{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.unmute())}}class db extends my{async execute(e){e.getViewManager().setViewByParametersWithNewQuery({params:{view:this._action.frigate_card_action}})}}class ub{createAction(e,t,n){const a=mf(t);if("fire-dom-event"!==t.action||!a)return new xy(e,t,n?.config);if(a.card_id&&a.card_id!==n?.cardID)return null;switch(a.frigate_card_action){case"default":return new _y(e,a,n?.config);case"clip":case"clips":case"image":case"live":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":case"diagnostics":return new db(e,a,n?.config);case"sleep":return new tb(e,a,n?.config);case"download":return new yy(e,a,n?.config);case"camera_ui":return new fy(e,a,n?.config);case"expand":return new by(e,a,n?.config);case"fullscreen":return new wy(e,a,n?.config);case"menu_toggle":return new $y(e,a,n?.config);case"camera_select":return new gy(e,a,n?.config);case"live_substream_select":return new cb(e,a,n?.config);case"live_substream_off":return new ib(e,a,n?.config);case"live_substream_on":return new ob(e,a,n?.config);case"media_player":return new Ey(e,a,n?.config);case"microphone_connect":return new Ay(e,a,n?.config);case"microphone_disconnect":return new zy(e,a,n?.config);case"microphone_mute":return new Iy(e,a,n?.config);case"microphone_unmute":return new Ty(e,a,n?.config);case"mute":return new jy(e,a,n?.config);case"unmute":return new lb(e,a,n?.config);case"play":return new Dy(e,a,n?.config);case"pause":return new Oy(e,a,n?.config);case"screenshot":return new eb(e,a,n?.config);case"display_mode_select":return new vy(e,a,n?.config);case"ptz":return new Vy(e,a,n?.config);case"ptz_digital":return new Xy(e,a,n?.config);case"ptz_multi":return new Jy(e,a,n?.config);case"ptz_controls":return new Hy(e,a,n?.config);case"log":return new Cy(e,a,n?.config);case"status_bar":return new nb(e,a,n?.config)} +/* istanbul ignore next: this path cannot be reached -- @preserve */ +/* istanbul ignore next: this path cannot be reached -- @preserve */ +return console.warn(`Frigate card received unknown card action: ${a.frigate_card_action}`),null}}class hb{constructor(e,t,n){this._actions=[],this._factory=new ub,this._stopped=!1,this._context=e;for(const a of Wg(t)){const t=this._factory.createAction(e,a,n);t&&this._actions.push(t)}}async execute(e){for(const t of this._actions){if(this._stopped)break;await t.execute(e)}}async stop(){this._stopped=!0}}const pb=ba.object({action:ba.enum(["tap","double_tap","hold","start_tap","end_tap"])}),mb=ba.object({detail:pb});class gb{constructor(e){this._actionsInFlight=[],this._actionContext={},this.handleInteractionEvent=e=>{const t=mb.safeParse(e);if(!t.success)return;const n=t.data.detail.action,a=this.getMergedActions(),i=yf(n,a);a&&n&&i&&this.executeActions(i,a)},this.handleCustomActionEvent=e=>{"detail"in e&&this.executeActions(e.detail)},this.handleActionExecutionRequestEvent=async e=>{await this.executeActions(e.detail.action,e.detail.config)},this._api=e}getMergedActions(){const e=this._api.getViewManager().getView();if(this._api.getMessageManager().hasMessage())return{};const t=this._api.getConfigManager().getConfig();let n;if(e?.is("live"))n=t?.live.actions;else if(e?.isGalleryView())n=t?.media_gallery?.actions;else if(e?.isViewerView())n=t?.media_viewer.actions;else{if(!e?.is("image"))return{};n=t?.image?.actions}return{...t?.view.actions,...n}}uninitialize(){this._actionsInFlight.forEach((e=>e.stop()))}async executeActions(e,t){const n=new hb(this._actionContext,e,{config:t,cardID:this._api.getConfigManager().getConfig()?.card_id});this._actionsInFlight.push(n),await n.execute(this._api),this._actionsInFlight=this._actionsInFlight.filter((e=>e!==n))}}class fb{constructor(e){this._automations=[],this._priorEvaluations=new Map,this._nestedAutomationExecutions=0,this._api=e}deleteAutomations(e){this._automations=this._automations.filter((t=>t.tag!==e))}addAutomations(e){this._automations.push(...e)}execute(){if(!this._api.getHASSManager().hasHASS()||!this._api.getInitializationManager().isInitializedMandatory()||this._api.getMessageManager().hasErrorMessage())return;const e=[];for(const t of this._automations){const n=this._api.getConditionsManager().evaluateConditions(t.conditions),a=n?t.actions:t.actions_not,i=this._priorEvaluations.get(t);this._priorEvaluations.set(t,n),n!==i&&a&&e.push(...a)}if(!e.length)return;(async e=>{++this._nestedAutomationExecutions,this._nestedAutomationExecutions>10?this._api.getMessageManager().setMessageIfHigherPriority({type:"error",message:V_("error.too_many_automations")}):(await this._api.getActionsManager().executeActions(e),--this._nestedAutomationExecutions)})(e)}}class _b{constructor(e){this._api=e}openURL(){const e=this.getCameraURL();e&&window.open(e)}hasCameraURL(){return!!this.getCameraURL()}getCameraURL(){const e=this._api.getViewManager().getView(),t=e?.queryResults?.getSelectedResult()??null,n=e?.camera?this._api.getCameraManager().getCameraEndpoints(e.camera,{view:e.view,...t&&{media:t}})??null:null;return n?.ui?.endpoint??null}}const vb=()=>!!navigator.userAgent.match(/CrKey\//),yb=(e,t)=>!!((e.attributes.supported_features??0)&t),bb=e=>(e=>yb(e,4)&&"number"==typeof e.attributes.in_progress)(e)||!!e.attributes.in_progress,wb=e=>{switch(e){case"armed_away":return"mdi:shield-lock";case"armed_vacation":return"mdi:shield-airplane";case"armed_home":return"mdi:shield-home";case"armed_night":return"mdi:shield-moon";case"armed_custom_bypass":return"mdi:security";case"pending":case"arming":return"mdi:shield-sync";case"triggered":return"mdi:bell-ring";case"disarmed":return"mdi:shield-off";default:return"mdi:shield"}},xb=(e,t)=>{const n="off"===e;switch(t?.attributes.device_class){case"battery":return n?"mdi:battery":"mdi:battery-outline";case"battery_charging":return n?"mdi:battery":"mdi:battery-charging";case"cold":return n?"mdi:thermometer":"mdi:snowflake";case"connectivity":return n?"mdi:close-network-outline":"mdi:check-network-outline";case"door":return n?"mdi:door-closed":"mdi:door-open";case"garage_door":return n?"mdi:garage":"mdi:garage-open";case"power":case"plug":return n?"mdi:power-plug-off":"mdi:power-plug";case"gas":case"problem":case"safety":case"tamper":return n?"mdi:check-circle":"mdi:alert-circle";case"smoke":return n?"mdi:check-circle":"mdi:smoke";case"heat":return n?"mdi:thermometer":"mdi:fire";case"light":return n?"mdi:brightness5":"mdi:brightness-7";case"lock":return n?"mdi:lock":"mdi:lock-open";case"moisture":return n?"mdi:water-off":"mdi:water";case"motion":return n?"mdi:motion-sensor-off":"mdi:motion-sensor";case"occupancy":case"presence":return n?"mdi:home-outline":"mdi:home";case"opening":return n?"mdi:square":"mdi:square-outline";case"running":return n?"mdi:stop":"mdi:play";case"sound":return n?"mdi:music-note-off":"mdi:music-note";case"update":return n?"mdi:package":"mdi:package-up";case"vibration":return n?"mdi:crop-portrait":"mdi:vibrate";case"window":return n?"mdi:window-closed":"mdi:window-open";default:return n?"mdi:radiobox-blank":"mdi:checkbox-marked-circle"}},Cb=(e,t)=>{const n="closed"!==e;switch(t?.attributes.device_class){case"garage":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:garage";default:return"mdi:garage-open"}case"gate":switch(e){case"opening":case"closing":return"mdi:gate-arrow-right";case"closed":return"mdi:gate";default:return"mdi:gate-open"}case"door":return n?"mdi:door-open":"mdi:door-closed";case"damper":return n?"md:circle":"mdi:circle-slice-8";case"shutter":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-shutter";default:return"mdi:window-shutter-open"}case"curtain":switch(e){case"opening":return"mdi:arrow-split-vertical";case"closing":return"mdi:arrow-collapse-horizontal";case"closed":return"mdi:curtains-closed";default:return"mdi:curtains"}case"blind":case"shade":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:blinds";default:return"mdi:blinds-open"}case"window":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-closed";default:return"mdi:window-open"}}switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-closed";default:return"mdi:window-open"}},Mb={apparent_power:"mdi:flash",aqi:"mdi:air-filter",carbon_dioxide:"mdi:molecule-co2",carbon_monoxide:"mdi:molecule-co",current:"mdi:current-ac",date:"mdi:calendar",energy:"mdi:lightning-bolt",frequency:"mdi:sine-wave",gas:"mdi:gas-cylinder",humidity:"mdi:water-percent",illuminance:"mdi:brightness-5",monetary:"mdi:cash",nitrogen_dioxide:"mdi:molecule",nitrogen_monoxide:"mdi:molecule",nitrous_oxide:"mdi:molecule",ozone:"mdi:molecule",pm1:"mdi:molecule",pm10:"mdi:molecule",pm25:"mdi:molecule",power:"mdi:flash",power_factor:"mdi:angle-acute",pressure:"mdi:gauge",reactive_power:"mdi:flash",signal_strength:"mdi:wifi",sulphur_dioxide:"mdi:molecule",temperature:"mdi:thermometer",timestamp:"mdi:clock",volatile_organic_compounds:"mdi:molecule",voltage:"mdi:sine-wave"},kb={10:"mdi:battery-10",20:"mdi:battery-20",30:"mdi:battery-30",40:"mdi:battery-40",50:"mdi:battery-50",60:"mdi:battery-60",70:"mdi:battery-70",80:"mdi:battery-80",90:"mdi:battery-90",100:"mdi:battery"},Sb={10:"mdi:battery-charging-10",20:"mdi:battery-charging-20",30:"mdi:battery-charging-30",40:"mdi:battery-charging-40",50:"mdi:battery-charging-50",60:"mdi:battery-charging-60",70:"mdi:battery-charging-70",80:"mdi:battery-charging-80",90:"mdi:battery-charging-90",100:"mdi:battery-charging"},Eb=(e,t)=>{const n=Number(e);if(isNaN(n))return"off"===e?"mdi:battery":"on"===e?"mdi:battery-alert":"mdi:battery-unknown";const a=10*Math.round(n/10);return t&&n>=10?Sb[a]:t?"mdi:battery-charging-outline":n<=5?"mdi:battery-alert-variant-outline":kb[a]},$b=e=>{const t=e?.attributes.device_class;if(t&&t in Mb)return Mb[t];if("battery"===t)return e?((e,t)=>{const n=e.state;return Eb(n,"on"===t?.state)})(e):"mdi:battery";const n=e?.attributes.unit_of_measurement;return"°C"===n||"°F"===n?"mdi:thermometer":void 0},Ab="mdi:bookmark",zb={alert:"mdi:alert",air_quality:"mdi:air-filter",automation:"mdi:robot",calendar:"mdi:calendar",camera:"mdi:video",climate:"mdi:thermostat",configurator:"mdi:cog",conversation:"mdi:text-to-speech",counter:"mdi:counter",fan:"mdi:fan",google_assistant:"mdi:google-assistant",group:"mdi:google-circles-communities",homeassistant:"mdi:home-assistant",homekit:"mdi:home-automation",image_processing:"mdi:image-filter-frames",input_button:"mdi:gesture-tap-button",input_datetime:"mdi:calendar-clock",input_number:"mdi:ray-vertex",input_select:"mdi:format-list-bulleted",input_text:"mdi:form-textbox",light:"mdi:lightbulb",mailbox:"mdi:mailbox",notify:"mdi:comment-alert",number:"mdi:ray-vertex",persistent_notification:"mdi:bell",person:"mdi:account",plant:"mdi:flower",proximity:"mdi:apple-safari",remote:"mdi:remote",scene:"mdi:palette",script:"mdi:script-text",select:"mdi:format-list-bulleted",sensor:"mdi:eye",siren:"mdi:bullhorn",simple_alarm:"mdi:bell",sun:"mdi:white-balance-sunny",timer:"mdi:timer-outline",updater:"mdi:cloud-upload",vacuum:"mdi:robot-vacuum",water_heater:"mdi:thermometer",weather:"mdi:weather-cloudy",zone:"mdi:map-marker-radius"};function Ib(e,t,n,a){switch(e){case"alarm_control_panel":return wb(n);case"binary_sensor":return xb(n,t);case"button":switch(t?.attributes.device_class){case"restart":return"mdi:restart";case"update":return"mdi:package-up";default:return"mdi:gesture-tap-button"}case"cover":return Cb(n,t);case"device_tracker":return"router"===t?.attributes.source_type?"home"===n?"mdi:lan-connect":"mdi:lan-disconnect":["bluetooth","bluetooth_le"].includes(t?.attributes.source_type)?"home"===n?"mdi:bluetooth-connect":"mdi:bluetooth":"not_home"===n?"mdi:account-arrow-right":"mdi:account";case"humidifier":return n&&"off"===n?"mdi:air-humidifier-off":"mdi:air-humidifier";case"input_boolean":return"on"===n?"mdi:check-circle-outline":"mdi:close-circle-outline";case"lock":switch(n){case"unlocked":return"mdi:lock-open";case"jammed":return"mdi:lock-alert";case"locking":case"unlocking":return"mdi:lock-clock";default:return"mdi:lock"}case"media_player":switch(t?.attributes.device_class){case"speaker":switch(n){case"playing":return"mdi:speaker-play";case"paused":return"mdi:speaker-pause";case"off":return"mdi:speaker-off";default:return"mdi:speaker"}case"tv":switch(n){case"playing":return"mdi:television-play";case"paused":return"mdi:television-pause";case"off":return"mdi:television-off";default:return"mdi:television"}default:switch(n){case"playing":case"paused":return"mdi:cast-connected";case"off":return"mdi:cast-off";default:return"mdi:cast"}}case"switch":switch(t?.attributes.device_class){case"outlet":return"on"===n?"mdi:power-plug":"mdi:power-plug-off";case"switch":return"on"===n?"mdi:toggle-switch":"mdi:toggle-switch-off";default:return"mdi:flash"}case"zwave":switch(n){case"dead":return"mdi:emoticon-dead";case"sleeping":return"mdi:sleep";case"initializing":return"mdi:timer-sand";default:return"mdi:z-wave"}case"sensor":{const e=$b(t);if(e)return e;break}case"input_datetime":if(!t?.attributes.has_date)return"mdi:clock";if(!t.attributes.has_time)return"mdi:calendar";break;case"sun":return"above_horizon"===t?.state?zb[e]:"mdi:weather-night";case"update":return"on"===t?.state?bb(t)?"mdi:package-down":"mdi:package-up":"mdi:package"}return e in zb?zb[e]:a??Ab}async function Tb(e,t,n){const a={type:"auth/sign_path",path:t,expires:n},i=await $v(e,Os,a);return i?e.hassUrl(i.path):null}function jb(e,t,n,a){if(!e||!n||!n.length)return[];const i=[];for(const r of n){const n=t?.states[r],o=e.states[r];if((a?.stateOnly&&n?.state!==o?.state||!a?.stateOnly&&n!==o)&&(i.push({entityID:r,oldState:n,newState:o}),a?.firstOnly))break}return i}function Ob(e,t,n,a){return!!jb(e,t,n,{...a,firstOnly:!0}).length}function Db(e){if("off"===e.state||!e.attributes.brightness)return"";return`brightness(${(e.attributes.brightness+245)/5}%)`}function Rb(e){return"off"===e.state?"":e.attributes.rgb_color?`rgb(${e.attributes.rgb_color.join(",")})`:""}function Pb(e){return{color:Rb(e),filter:Db(e)}}function Lb(e,t){if(!t.entity)return t;const n=e.states[t.entity];n&&t.state_color&&(t.style={...Pb(n),...t.style}),t.title=t.title??(n?.attributes?.friendly_name||t.entity),t.icon=t.icon??Fb(e,t.entity);const a=n?function(e){return Ye(e.entity_id)}(n):void 0;return t.data_domain=t.state_color||"light"===a&&!1!==t.state_color?a:void 0,n&&(t.data_state=(e=>{const t=e.entity_id.split(".")[0];let n=e.state;return"climate"===t&&(n=e.attributes.hvac_action),n})(n)),t}function Nb(e,t){return t?e?.states[t]?.attributes?.friendly_name:void 0}function Fb(e,t,n){const a=e.states[t];return a&&a.attributes.icon?a.attributes.icon:Ib(Ye(t),a,a?.state,n)}const Vb=async()=>{if(["ha-button-menu","ha-button","ha-camera-stream","ha-card","ha-circular-progress","ha-hls-player","ha-icon-button","ha-icon","ha-menu-button","ha-selector","ha-web-rtc-player"].every((e=>customElements.get(e))))return!0;const e=await window.loadCardHelpers();await e.createCardElement({type:"picture-glance",entities:[],camera_image:"dummy-to-load-editor-components"}),await customElements.whenDefined("hui-picture-glance-card");const t=customElements.get("hui-picture-glance-card");if(!t)return!1;const n=new t;return await n.constructor.getConfigElement(),!0},Hb=e=>!!e&&["on","open"].includes(e),Bb=(e,t)=>{if(!e)return[];const n=Object.keys(e.states).filter((e=>!t||e.substr(0,e.indexOf("."))===t));return n.sort(),n};function qb(e){return!!e?.startsWith("/")}function Ub(e,t){return qb(t)?e.hassUrl(t):t??null}class Wb{constructor(){this._initialized=new Set}async initializeMultipleIfNecessary(e){return(await tf(Object.entries(e),(async([e,t])=>await this.initializeIfNecessary(e,t)))).every(Boolean)}async initializeIfNecessary(e,t){return!!this._initialized.has(e)||(t?!!await t()&&(this._initialized.add(e),!0):(this._initialized.add(e),!0))}uninitialize(e){this._initialized.delete(e)}isInitialized(e){return this._initialized.has(e)}isInitializedMultiple(e){return e.every((e=>this.isInitialized(e)))}}var Zb;!function(e){e.LANGUAGES="languages",e.SIDE_LOAD_ELEMENTS="side-load-elements",e.CAMERAS="cameras",e.MICROPHONE_CONNECT="microphone-connect",e.VIEW="view"}(Zb||(Zb={}));class Qb{constructor(e,t){this._initializationQueue=new w_({concurrency:1}),this._everInitialized=!1,this._api=e,this._initializer=t??new Wb}wasEverInitialized(){return this._everInitialized}isInitializedMandatory(){return!!this._api.getConfigManager().getConfig()&&this._initializer.isInitializedMultiple([Zb.LANGUAGES,Zb.SIDE_LOAD_ELEMENTS,Zb.CAMERAS,...this._api.getMicrophoneManager().shouldConnectOnInitialization()?[Zb.MICROPHONE_CONNECT]:[],Zb.VIEW])}async initializeMandatory(){await this._initializationQueue.add((()=>this._initializeMandatory()))}async _initializeMandatory(){const e=this._api.getHASSManager().getHASS();if(!e||this.isInitializedMandatory())return;if(!await this._initializer.initializeMultipleIfNecessary({[Zb.LANGUAGES]:async()=>await(async e=>{const t=F_(e);return"ca"===t?L_[t]=await import("./lang-ca-449daa4a.js"):"it"===t?L_[t]=await import("./lang-it-2a20a319.js"):"pt"===t?L_[t]=await import("./lang-pt-PT-c4863423.js"):"pt_BR"===t?L_[t]=await import("./lang-pt-BR-83a703b9.js"):"fr"===t&&(L_[t]=await import("./lang-fr-674e5de5.js")),t&&(N_=t),!0})(e),[Zb.SIDE_LOAD_ELEMENTS]:async()=>await Vb()}))return;this._api.getConfigManager().getConfig()&&await this._initializer.initializeMultipleIfNecessary({[Zb.CAMERAS]:async()=>await this._api.getCameraManager().initializeCamerasFromConfig(),...this._api.getMicrophoneManager().shouldConnectOnInitialization()&&{[Zb.MICROPHONE_CONNECT]:async()=>await this._api.getMicrophoneManager().connect()}})&&!this._api.getMessageManager().hasMessage()&&await this._initializer.initializeIfNecessary(Zb.VIEW,this._api.getViewManager().initialize)&&(this._everInitialized=!0,this._api.getCardElementManager().update())}uninitialize(e){this._initializer.uninitialize(e)}}class Gb{constructor(e,t,n,a){this.update=()=>{this._element.requestUpdate()},this._api=e,this._element=t,this._scrollCallback=n,this._menuToggleCallback=a}getElement(){return this._element}scrollReset(){this._scrollCallback()}toggleMenu(){this._menuToggleCallback()}hasUpdated(){return this._element.hasUpdated}elementConnected(){this._api.getInteractionManager().initialize(),this._api.getFullscreenManager().initialize(),this._api.getExpandManager().initialize(),this._api.getMediaLoadedInfoManager().initialize(),this._api.getMicrophoneManager().initialize(),this._api.getKeyboardStateManager().initialize(),this._api.getDefaultManager().initialize(),this._api.getMediaPlayerManager().initialize(),this._api.getHASSManager().getStateWatcher()?.subscribe(this.update,[...this._api.getConfigManager().getConfig()?.view.render_entities??[],...this._api.getMediaPlayerManager().getMediaPlayers()??[]]),of(this._element,(e=>{const t=e.getRootNode();return!!(t&&t instanceof ShadowRoot&&"HUI-PANEL-VIEW"===t.host.tagName)})(this._element),"panel"),of(this._element,vb(),"casted"),this._api.getFullscreenManager().connect(),this._element.addEventListener("mousemove",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("wheel",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("ll-custom",this._api.getActionsManager().handleCustomActionEvent),this._element.addEventListener("action",this._api.getActionsManager().handleInteractionEvent),this._element.addEventListener("action",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("frigate-card:action:execution-request",this._api.getActionsManager().handleActionExecutionRequestEvent),window.addEventListener("location-changed",this._api.getQueryStringManager().requestExecution),window.addEventListener("popstate",this._api.getQueryStringManager().requestExecution),this._api.getQueryStringManager().requestExecution(),this._element.requestUpdate()}elementDisconnected(){of(this._element,!1,"panel"),of(this._element,!1,"tabindex"),of(this._element,!1,"casted"),this._api.getMediaLoadedInfoManager().clear(),this._api.getFullscreenManager().disconnect(),this._api.getKeyboardStateManager().uninitialize(),this._api.getActionsManager().uninitialize(),this._api.getDefaultManager().uninitialize(),this._api.getHASSManager().getStateWatcher()?.unsubscribe(this.update),this._api.getInitializationManager().uninitialize(Zb.CAMERAS),this._api.getCameraManager().reset(),this._element.removeEventListener("mousemove",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("wheel",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("ll-custom",this._api.getActionsManager().handleCustomActionEvent),this._element.removeEventListener("action",this._api.getActionsManager().handleInteractionEvent),this._element.removeEventListener("action",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("frigate-card:action:execution-request",this._api.getActionsManager().handleActionExecutionRequestEvent),window.removeEventListener("location-changed",this._api.getQueryStringManager().requestExecution),window.removeEventListener("popstate",this._api.getQueryStringManager().requestExecution)}}function Yb(e,t,n){return null==e?e:function(e,t,n,a){if(!hh(e))return e;for(var i=-1,r=(t=sv(t,e)).length,o=r-1,s=e;null!=s&&++i{Yb(e,t,n)},Jb=(e,t,n)=>fv(e,t,n),ew=(e,t)=>{!function(e,t){null==e||Kb(e,t)}(e,t)},tw=e=>u_(e),nw=(e,t)=>e.replace("#",`[${t.toString()}]`),aw=function(e){let t=!1;for(let n=0;n{const i=Jb(e,t);if(void 0===i)return!1;const r=a?.transform?a.transform(i):i;return!(t===n&&Dv(i,r)||(null===r?a?.keepOriginal||(ew(e,t),0):void 0===r||(a?.keepOriginal||ew(e,t),Xb(e,n,r),0)))})(a,e,t,n)}},ow=function(e,t,n){return function(a){let i=rw(e,t,n)(a);return i=lw(bs,rw(e,t,n),(e=>e.overrides))(a)||i,i}},sw=function(e,t){return ow(e,e,{transform:t})},cw=function(e){return ow(e,e,{transform:e=>null})},lw=function(e,t,n){return function(a){let i=!1;const r=Jb(a,e);return Array.isArray(r)&&r.forEach((e=>{const a=n?n(e):e;a&&"object"==typeof a&&(i=t(a)||i)})),i}},dw=(e,t)=>{const n=a=>{let i=!1;if(a&&"object"==typeof a){const r=t?t(a):a;r&&(i=e(r)||i),Array.isArray(a)?a.forEach((e=>{i=n(e)||i})):Object.keys(a).forEach((e=>{i=n(a[e])||i}))}return i};return n},uw=e=>!("object"!=typeof e||!e||void 0===e.mediaLoaded)&&(e.media_loaded=e.mediaLoaded,delete e.mediaLoaded,!0),hw=e=>{if("object"!=typeof e||!e||"object"!=typeof e.conditions||!e.conditions)return!1;const t=e.conditions,n=[];if(void 0!==t.view&&n.push({condition:"view",views:t.view}),void 0!==t.fullscreen&&n.push({condition:"fullscreen",fullscreen:t.fullscreen}),void 0!==t.expand&&n.push({condition:"expand",expand:t.expand}),void 0!==t.camera&&n.push({condition:"camera",cameras:t.camera}),void 0!==t.media_loaded&&n.push({condition:"media_loaded",media_loaded:t.media_loaded}),void 0!==t.state&&Array.isArray(t.state))for(const e of t.state)"object"!=typeof e||!e||void 0===e.state&&void 0===e.state_not&&void 0===e.entity||n.push({condition:"state",...e.state&&{state:e.state},...e.state_not&&{state_not:e.state_not},...e.entity&&{entity:e.entity}});return void 0!==t.media_query&&n.push({condition:"screen",media_query:t.media_query}),!!n.length&&(e.conditions=n,!0)},pw=e=>!("object"!=typeof e||!e||"call-service"!==e.action||"string"!=typeof e.service)&&(e.action="perform-action",e.perform_action=e.service,delete e.service,!0),mw=e=>!("object"!=typeof e||!e||"call-service"!==e.action||void 0===e.service||void 0===e.service_data||void 0!==e.data)&&(e.data=e.service_data,delete e.service_data,!0),gw=e=>!("object"!=typeof e||!e||"custom:frigate-card-action"!==e.action||"frigate_ui"!==e.frigate_card_action)&&(e.frigate_card_action="camera_ui",!0),fw=[lw(bs,uw,(e=>e.conditions)),e=>dw(uw,(e=>e.conditions))("object"==typeof e&&e?e[Ii]:{}),ow("event_gallery",or),ow("menu.buttons.frigate_ui",is),e=>dw(gw)("object"==typeof e&&e?e:{}),lw(Ca,sw("live_provider",(e=>"frigate-jsmpeg"===e?"jsmpeg":e))),ow("live.jsmpeg",ki),ow("live.image",Ci),ow("live.webrtc_card",Si),lw(Ca,ow("frigate.zone","frigate.zones",{transform:e=>Wg(e)})),lw(Ca,ow("frigate.label","frigate.labels",{transform:e=>Wg(e)})),e=>dw(mw)("object"==typeof e&&e?e:{}),function(e){if("object"!=typeof e||!e||!(Ii in e)||!Array.isArray(e[Ii]))return!1;let t=!1;const n=n=>{if(!t){if(!fv(e,"live.controls.ptz")){const{type:t,...a}=n;Yb(e,"live.controls.ptz",a)}t=!0}},a=e=>{const t=[];for(const i of e)if("custom:frigate-card-ptz"===i.type)n(i);else if("conditional"!==i.type&&"custom:frigate-card-conditional"!==i.type||!Array.isArray(i.elements))t.push(i);else{const e=a(i.elements);e.length&&(i.elements=e,t.push(i))}return t},i=a(e[Ii]);return t&&(i.length?e[Ii]=i:delete e[Ii]),t},ow("view.timeout_seconds",Ri),sw("live.lazy_unload",(e=>"all"===e?["unselected","hidden"]:"never"===e?null:Wg(e))),sw("live.auto_play",(e=>"all"===e?null:"never"===e?[]:Wg(e))),sw("live.auto_pause",(e=>"all"===e?["unselected","hidden"]:"never"===e?null:Wg(e))),sw("live.auto_mute",(e=>"all"===e?null:"never"===e?[]:Wg(e))),sw("live.auto_unmute",(e=>"all"===e?["selected","visible","microphone"]:"never"===e?null:Wg(e))),sw("media_viewer.auto_play",(e=>"all"===e?null:"never"===e?[]:Wg(e))),sw("media_viewer.auto_pause",(e=>"all"===e?null:"never"===e?[]:Wg(e))),sw("media_viewer.auto_mute",(e=>"all"===e?null:"never"===e?[]:Wg(e))),sw("media_viewer.auto_unmute",(e=>"all"===e?["selected","visible"]:"never"===e?null:Wg(e))),ow("live.controls.thumbnails.media",io),ow("timeline.media",Ho),ow("live.controls.timeline.media",po),ow("media_viewer.controls.timeline.media",Rr),ow("view.scan",Xi),ow("view.triggers.enabled",ar,{transform:e=>!0===e?"live":null,keepOriginal:!0}),ow("view.triggers.enabled",er,{transform:e=>!0!==e&&null}),ow("view.triggers.untrigger_reset",ir,{transform:e=>e?"default":null}),ow("live.layout",Ai),cw("media_viewer.layout"),cw("image.layout"),lw(bs,hw),e=>dw(hw)("object"==typeof e&&e?e[Ii]:{}),e=>dw(hw)("object"==typeof e&&e?e.automations:{}),lw(Ca,ow("hide","capabilities",{transform:e=>!0===e?{disable_except:["substream"]}:null})),ow("performance.profile",$s,{transform:e=>"low"===e?["low-performance"]:null}),lw(bs,rw("overrides","merge")),ow("live.controls.ptz",zi,{transform:e=>{if("object"!=typeof e||!e)return;const t=["data_left","data_right","data_up","data_down","data_zoom_in","data_zoom_out","service"],n=["actions_left","actions_right","actions_up","actions_down","actions_zoom_in","actions_zoom_out"],a=[...t,...n,"data_home","actions_home"];if(!Object.keys(e).some((e=>a.includes(e))))return;const i={};t.filter((t=>t in e)).reduce(((t,n)=>(t[n]=e[n],t)),i),n.filter((t=>t in e)).reduce(((t,n)=>("object"==typeof e[n]&&"tap_action"in e[n]&&(t[n]=e[n].tap_action),t)),i);const r=()=>{i.presets="presets"in e&&"object"==typeof e.presets&&e.presets?e.presets:{}};return"actions_home"in e&&"object"==typeof e.actions_home&&e.actions_home&&"tap_action"in e.actions_home?(r(),i.presets.home=e.actions_home.tap_action):"data_home"in e&&"object"==typeof e.data_home&&e.data_home&&"string"==typeof e.service&&(r(),i.presets.service=e.service,i.presets.data_home=e.data_home),i},keepOriginal:!0}),sw("live.controls.ptz",(e=>{if("object"!=typeof e||!e)return e;const t=["mode","position","orientation","hide_pan_tilt","hide_zoom","hide_home","style"],n=Object.keys(e);return n.some((e=>!t.includes(e)))?n.filter((e=>t.includes(e))).reduce(((t,n)=>(t[n]=e[n],t)),{}):void 0})),ow("view.update_cycle_camera",Wi),ow("view.update_force",Qi,{transform:e=>!0===e?"all":null}),ow("view.update_seconds",Gi),ow("view.update_entities",Yi),rw("live.controls.title",ds,{transform:e=>"object"==typeof e&&e&&"string"==typeof e.mode?"none"===e.mode?{style:"none"}:e.mode.includes("bottom")?{position:"bottom"}:e.mode.includes("top")?{position:"top"}:null:null}),cw("live.controls.title"),cw("media_viewer.controls.title"),e=>dw(pw)("object"==typeof e&&e?e:{}),ow("dimensions.max_height",ys),cw("dimensions.min_height")];class _w extends zs{}class vw extends Event{constructor(e,t){super("frigate-card:conditions:evaluate",t),this.conditions=e}}function yw(e,t,n){let a=tw(t),i=!1;if(n?.configOverrides)for(const t of n.configOverrides)e.evaluateConditions(t.conditions,n?.stateOverrides)&&(t.delete?.forEach((e=>{ew(a,e)})),Object.keys(t.set??{}).forEach((e=>{Xb(a,e,t.set?.[e])})),Object.keys(t.merge??{}).forEach((e=>{Xb(a,e,Ly({},Jb(a,e),t.merge?.[e]))})),i=!0);if(!i)return t;if(n?.configOverrides?.some((e=>e.delete?.length))&&(a=hf(a)),n?.schema){const e=n.schema.safeParse(a);if(!e.success)throw new _w(V_("error.invalid_configuration_override"),[e.error.errors,a]);return e.data}return a}class bw{constructor(e,t){this._state={},this._epoch=this._createEpoch(),this._hasHAStateConditions=!1,this._mediaQueries=[],this._mediaQueryTrigger=()=>this._triggerChange(),this._api=e,this._listeners=[()=>this._api.getConfigManager().computeOverrideConfig(),()=>this._api.getAutomationsManager().execute(),...t?[t]:[]]}removeConditions(){this._mediaQueries.forEach((e=>e.removeEventListener("change",this._mediaQueryTrigger))),this._mediaQueries=[]}setConditionsFromConfig(){this.removeConditions();const e=(()=>{const e=this._api.getConfigManager().getConfig(),t=[];e?.overrides?.forEach((e=>t.push(...e.conditions))),e?.automations?.forEach((e=>t.push(...e.conditions)));const n=e=>{const a=vl.safeParse(e);a.success?(t.push(...a.data.conditions),a.data.elements?.forEach(n)):e&&"object"==typeof e&&Object.keys(e).forEach((t=>n(e[t])))};return e?.elements?.forEach(n),t})();this._hasHAStateConditions=e.some((e=>!e.condition||["state","numeric_state","user"].includes(e.condition))),e.forEach((e=>{if("screen"===e.condition){const t=window.matchMedia(e.media_query);t.addEventListener("change",this._mediaQueryTrigger),this._mediaQueries.push(t)}}))}setState(e){Object.keys(e).every((t=>Dv(e[t],this._state[t])))||(this._state={...this._state,...e},this._triggerChange())}getState(){return this._state}hasHAStateConditions(){return this._hasHAStateConditions}getEpoch(){return this._epoch}evaluateConditions(e,t){return e.every((e=>this._evaluateCondition(e,t)))}_evaluateCondition(e,t){const n={...this._state,...t};switch(e.condition){case void 0:case"state":return!!n.state&&(!e.state&&!e.state_not||e.entity in n.state&&(!e.state||(Array.isArray(e.state)?e.state.includes(n.state[e.entity].state):e.state===n.state[e.entity].state))&&(!e.state_not||(Array.isArray(e.state_not)?!e.state_not.includes(n.state[e.entity].state):e.state_not!==n.state[e.entity].state)));case"view":return!!n?.view&&e.views.includes(n.view);case"fullscreen":return void 0!==n.fullscreen&&e.fullscreen===n.fullscreen;case"expand":return void 0!==n.expand&&e.expand===n.expand;case"camera":return!!n.camera&&e.cameras.includes(n.camera);case"numeric_state":return!!n.state&&e.entity in n.state&&void 0!==n.state[e.entity].state&&(void 0===e.above||Number(n.state[e.entity].state)>e.above)&&(void 0===e.below||Number(n.state[e.entity].state)n.triggered?.has(e)));case"interaction":return void 0!==n.interaction&&e.interaction===n.interaction;case"microphone":return!(void 0!==e.connected&&n.microphone?.connected!==e.connected||void 0!==e.muted&&n.microphone?.muted!==e.muted);case"key":return!(!n.keys||!(e.key in n.keys)||(e.state??"down")!==n.keys[e.key].state||void 0!==e.ctrl&&e.ctrl!==!!n.keys[e.key].ctrl||void 0!==e.alt&&e.alt!==!!n.keys[e.key].alt||void 0!==e.meta&&e.meta!==!!n.keys[e.key].meta||void 0!==e.shift&&e.shift!==!!n.keys[e.key].shift)}}_createEpoch(){return{manager:this}}_triggerChange(){this._epoch=this._createEpoch(),this._listeners.forEach((e=>e()))}}const ww={casting:{[Qr]:!1,[Sr]:!1,[es]:"none",[`${os}.enabled`]:!0,[`${ss}.enabled`]:!0,[`${rs}.enabled`]:!1,[`${cs}.enabled`]:!1,[Zr]:["selected","visible"],[vs]:"static",[_s]:"16:9",[$i]:1,[$o]:!0},"low-performance":{[ro]:"none",[Ar]:"none",[Uo]:"none",[fo]:!1,[Nr]:!1,[Bo]:!1,[Wr]:[],[mr]:[],[gr]:[],[fr]:[],[ko]:["unselected","hidden"],[Co]:!1,[xr]:!1,[Eo]:"none",[kr]:"none",[$o]:!1,[Er]:"chevrons",[hs]:"none",[es]:"outside",[`${as}.enabled`]:!1,[`${ls}.enabled`]:!1,[`${ls}.enabled`]:!1,[`${cs}.enabled`]:!1,[lr]:!1,[dr]:!1,[ur]:!1,[cr]:!1,[co]:!1,[lo]:!1,[uo]:!1,[so]:!1,[Ir]:!1,[Tr]:!1,[jr]:!1,[zr]:!1,[Qo]:!1,[Go]:!1,[Yo]:!1,[Zo]:!1,[xs]:!1,[Cs]:10,[Es]:!1,[Ss]:!1,[Mr]:!1,[Ei]:!1,[Mi]:"image",[$i]:10,[ar]:"none",[Ms]:1},scrubbing:{[mo]:"below",[_o]:"ribbon",[go]:"seek",[Pr]:"below",[Fr]:"ribbon",[Lr]:"seek"}},xw=(e,t,n)=>{const a=Ds(Nd).safeParse(e);if(!a.success)return t;const i=a.data;for(const e of n??[])e in ww&&Object.entries(ww[e]).forEach((([e,n])=>{return r=n,void(void 0===Jb(i,a=e)&&Xb(t,a,r));var a,r}));return t},Cw=e=>{switch(e){case"ptz_left":return"left";case"ptz_right":return"right";case"ptz_up":return"up";case"ptz_down":return"down";case"ptz_zoom_in":return"zoom_in";case"ptz_zoom_out":return"zoom_out"} +/* istanbul ignore next: No (current) way to reach this code -- @preserve */return null},Mw=(e,t)=>{if(!t.enabled)return[];const n=[];for(const a of["ptz_down","ptz_left","ptz_right","ptz_up","ptz_zoom_in","ptz_zoom_out"]){const i=t[a],r=Cw(a);i&&r&&(n.push({conditions:[{condition:"key",key:i.key,state:"down",shift:i.shift,ctrl:i.ctrl,alt:i.alt,meta:i.meta}],actions:[vf({ptzAction:r,ptzPhase:"start"})],tag:e}),n.push({conditions:[{condition:"key",key:i.key,state:"up"}],actions:[vf({ptzAction:r,ptzPhase:"stop"})],tag:e}))}const a=t.ptz_home;return a&&n.push({conditions:[{condition:"key",key:a.key,state:"down",shift:a.shift,ctrl:a.ctrl,alt:a.alt,meta:a.meta}],actions:[vf()],tag:e}),n};class kw{constructor(e){this._config=null,this._overriddenConfig=null,this._rawConfig=null,this._cardWideConfig=null,this._api=e}hasConfig(){return!!this.getConfig()}getConfig(){return this._overriddenConfig??this._config}getCardWideConfig(){return this._cardWideConfig}getNonOverriddenConfig(){return this._config}getRawConfig(){return this._rawConfig}setConfig(e){if(!e)throw new Error(V_("error.invalid_configuration"));const t=Nd.safeParse(e);if(!t.success){const n=iw(e),a=Ps(t.error);let i="";throw n&&(i=`${V_("error.upgrade_available")}. `),new Error(i+`${V_("error.invalid_configuration")}: `+(a&&a.size?JSON.stringify([...a],null," "):V_("error.invalid_configuration_no_hint")))}const n=xw(e,t.data,t.data.profiles);var a;(this._rawConfig=e,Dv(this._config,n))||(this._config=n,this._cardWideConfig={performance:n.performance,debug:n.debug},this._api.getConditionsManager().setConditionsFromConfig(),this._api.getConditionsManager().setState({view:void 0,displayMode:void 0,camera:void 0}),this._api.getMediaLoadedInfoManager().clear(),this._api.getInitializationManager().uninitialize(Zb.VIEW),this._api.getViewManager().reset(),this._api.getMessageManager().reset(),this._api.getStyleManager().setPerformance(),this._api.getStatusBarItemManager().removeAllDynamicStatusBarItems(),((e,t)=>{e.getAutomationsManager().deleteAutomations(t);const n=e.getConfigManager().getConfig()?.view.keyboard_shortcuts;if(!n)return;const a=Mw(t,n);a.length&&e.getAutomationsManager().addAutomations(a)})(this._api,this),(a=this._api).getAutomationsManager().deleteAutomations(),a.getAutomationsManager().addAutomations(a.getConfigManager().getNonOverriddenConfig()?.automations??[]),this.computeOverrideConfig(),this._api.getCardElementManager().update())}computeOverrideConfig(){const e=this._api.getConditionsManager();if(!this._config)return;let t=null;try{t=yw(e,this._config,{configOverrides:this._config.overrides,schema:Nd})}catch(e){return void this._api.getMessageManager().setErrorIfHigherPriority(e)}if(Dv(t,this._overriddenConfig))return;const n=this._overriddenConfig;this._overriddenConfig=t,this._api.getStyleManager().setMinMaxHeight(),!n||Dv(n?.cameras,this._overriddenConfig?.cameras)&&Dv(n?.cameras_global,this._overriddenConfig?.cameras_global)||this._api.getInitializationManager().uninitialize(Zb.CAMERAS),n&&n?.live.microphone.always_connected!==this._overriddenConfig?.live.microphone.always_connected&&this._api.getInitializationManager().uninitialize(Zb.MICROPHONE_CONNECT),this._initializeBackground(n)}async _initializeBackground(e){await this._api.getDefaultManager().initializeIfNecessary(e),await this._api.getMediaPlayerManager().initializeIfNecessary(e),this._api.getCardElementManager().update()}}class Sw{constructor(e){this._timer=new xf,this._stateChangeHandler=()=>{this._setToDefaultIfAllowed()},this._api=e}async initializeIfNecessary(e){Dv(e?.view.default_reset,this._api.getConfigManager().getConfig()?.view.default_reset)||await this.initialize()}async initialize(){this.uninitialize();const e=this._api.getConfigManager().getConfig()?.view.default_reset;e?.entities.length&&this._api.getHASSManager().getStateWatcher().subscribe(this._stateChangeHandler,e.entities);const t=this._api.getConfigManager().getConfig()?.view.default_reset.every_seconds;return t&&this._timer.startRepeated(t,(()=>this._setToDefaultIfAllowed())),this._api.getConfigManager().getConfig()?.view.default_reset.after_interaction&&this._api.getAutomationsManager().addAutomations([{actions:[gf("default")],conditions:[{condition:"interaction",interaction:!1}],tag:this}]),!0}uninitialize(){this._timer.stop(),this._api.getHASSManager().getStateWatcher().unsubscribe(this._stateChangeHandler),this._api.getAutomationsManager().deleteAutomations(this)}_setToDefaultIfAllowed(){this._isAutomatedUpdateAllowed()&&this._api.getViewManager().setViewDefault()}_isAutomatedUpdateAllowed(){const e=this._api.getConfigManager().getConfig()?.view.default_reset.interaction_mode;return!!e&&((e,t)=>{switch(e){case"all":return!0;case"active":return t;case"inactive":return!t}})(e,this._api.getInteractionManager().hasInteraction())}}const Ew=(e,t="download")=>{const n=new URL(e).origin===window.location.origin,a=e.startsWith("data:");if(navigator.userAgent.startsWith("Home Assistant/")||navigator.userAgent.startsWith("HomeAssistant/")||!n&&!a)window.open(e,"_blank");else{const n=document.createElement("a");n.setAttribute("download",t),n.href=e,n.click(),n.remove()}},$w=async(e,t,n)=>{const a=await t.getMediaDownloadPath(n);if(!a)throw new zs(V_("error.download_no_media"));let i=a.endpoint;if(a.sign){let t;try{t=await Tb(e,a.endpoint)}catch(e){Gg(e)}if(!t)throw new zs(V_("error.download_sign_failed"));i=t}Ew(i)},Aw=e=>{const t=document.createElement("canvas");t.width=e.videoWidth,t.height=e.videoHeight;const n=t.getContext("2d");return n?(n.drawImage(e,0,0,t.width,t.height),t.toDataURL("image/jpeg")):null};class zw{constructor(e){this._api=e}async downloadViewerMedia(){const e=this._api.getViewManager().getView()?.queryResults?.getSelectedResult(),t=this._api.getHASSManager().getHASS();if(!e||!t)return!1;try{await $w(t,this._api.getCameraManager(),e)}catch(e){return this._api.getMessageManager().setErrorIfHigherPriority(e),!1}return!0}async downloadScreenshot(){const e=await(this._api.getMediaLoadedInfoManager().get()?.player?.getScreenshotURL());e&&Ew(e,(e=>{if(e?.is("live")||e?.is("image"))return`${e.view}-${e.camera}-${Wu(new Date,"yyyy-MM-dd-HH-mm-ss")}.jpg`;if(e?.isViewerView()){const t=e.queryResults?.getSelectedResult(),n=t?.getID()??null;return`${e.view}-${e.camera}${n?`-${n}`:""}.jpg`}return"screenshot.jpg"})(this._api.getViewManager().getView()))}}class Iw{constructor(e){this._expanded=!1,this._api=e}initialize(){this._setConditionState()}isExpanded(){return this._expanded}toggleExpanded(){this.setExpanded(!this._expanded)}setExpanded(e){e&&this._api.getFullscreenManager().isInFullscreen()&&this._api.getFullscreenManager().stopFullscreen(),this._expanded=e,this._setConditionState(),this._api.getCardElementManager().update()}_setConditionState(){this._api.getConditionsManager()?.setState({expand:this._expanded})}}const Tw=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],jw=(()=>{if("undefined"==typeof document)return!1;const e=Tw[0],t={};for(const n of Tw){const a=n?.[1];if(a in document){for(const[a,i]of n.entries())t[e[a]]=i;return t}}return!1})(),Ow={change:jw.fullscreenchange,error:jw.fullscreenerror};let Dw={request:(e=document.documentElement,t)=>new Promise(((n,a)=>{const i=()=>{Dw.off("change",i),n()};Dw.on("change",i);const r=e[jw.requestFullscreen](t);r instanceof Promise&&r.then(i).catch(a)})),exit:()=>new Promise(((e,t)=>{if(!Dw.isFullscreen)return void e();const n=()=>{Dw.off("change",n),e()};Dw.on("change",n);const a=document[jw.exitFullscreen]();a instanceof Promise&&a.then(n).catch(t)})),toggle:(e,t)=>Dw.isFullscreen?Dw.exit():Dw.request(e,t),onchange(e){Dw.on("change",e)},onerror(e){Dw.on("error",e)},on(e,t){const n=Ow[e];n&&document.addEventListener(n,t,!1)},off(e,t){const n=Ow[e];n&&document.removeEventListener(n,t,!1)},raw:jw};Object.defineProperties(Dw,{isFullscreen:{get:()=>Boolean(document[jw.fullscreenElement])},element:{enumerable:!0,get:()=>document[jw.fullscreenElement]??void 0},isEnabled:{enumerable:!0,get:()=>Boolean(document[jw.fullscreenEnabled])}}),jw||(Dw={isEnabled:!1});var Rw=Dw;class Pw{constructor(e){this._fullscreenHandler=()=>{this._api.getExpandManager().setExpanded(!1),this._setConditionState(),this._api.getCardElementManager().update()},this._api=e}initialize(){this._setConditionState()}connect(){Rw.isEnabled&&Rw.on("change",this._fullscreenHandler)}disconnect(){Rw.isEnabled&&Rw.off("change",this._fullscreenHandler)}isInFullscreen(){return Rw.isEnabled&&Rw.isFullscreen}toggleFullscreen(){Rw.toggle(this._api.getCardElementManager().getElement())}stopFullscreen(){Rw.exit()}_setConditionState(){this._api.getConditionsManager()?.setState({fullscreen:this.isInFullscreen()})}}class Lw{constructor(){this._watcherCallbacks=new Map}setHASS(e,t){if(e)for(const[n,a]of this._watcherCallbacks.entries()){const i=jb(t,e,a,{stateOnly:!0,firstOnly:!0});i.length&&n(i[0])}}subscribe(e,t){return!!t.length&&(this._watcherCallbacks.has(e)?this._watcherCallbacks.get(e)?.push(...t):this._watcherCallbacks.set(e,t),!0)}unsubscribe(e){this._watcherCallbacks.delete(e)}}class Nw{constructor(e){this._hass=null,this._stateWatcher=new Lw,this._api=e}getHASS(){return this._hass}hasHASS(){return!!this._hass}getStateWatcher(){return this._stateWatcher}setHASS(e){if(((e,t)=>e?.connected!==t?.connected)(this._hass,e)&&(e?.connected?this._api.getMessageManager().resetType("connection"):this._api.getMessageManager().setMessageIfHigherPriority({message:V_("error.reconnecting"),icon:"mdi:lan-disconnect",type:"connection",dotdotdot:!0})),!e)return;const t=this._hass;this._hass=e,this._api.getConditionsManager().hasHAStateConditions()&&this._api.getConditionsManager().setState({state:this._hass.states,user:this._hass.user}),this._api.getStyleManager().setLightOrDarkMode(),this._stateWatcher.setHASS(t,e)}}var Fw=function(){return th.Date.now()},Vw="Expected a function",Hw=Math.max,Bw=Math.min;function qw(e,t,n){var a,i,r,o,s,c,l=0,d=!1,u=!1,h=!0;if("function"!=typeof e)throw new TypeError(Vw);function p(t){var n=a,r=i;return a=i=void 0,l=t,o=e.apply(r,n)}function m(e){var n=e-c;return void 0===c||n>=t||n<0||u&&e-l>=r}function g(){var e=Fw();if(m(e))return f(e);s=setTimeout(g,function(e){var n=t-(e-c);return u?Bw(n,r-(e-l)):n}(e))}function f(e){return s=void 0,h&&a?p(e):(a=i=void 0,o)}function _(){var e=Fw(),n=m(e);if(a=arguments,i=this,c=e,n){if(void 0===s)return function(e){return l=e,s=setTimeout(g,t),d?p(e):o}(c);if(u)return clearTimeout(s),s=setTimeout(g,t),p(c)}return void 0===s&&(s=setTimeout(g,t)),o}return t=Cg(t)||0,hh(n)&&(d=!!n.leading,r=(u="maxWait"in n)?Hw(Cg(n.maxWait)||0,t):r,h="trailing"in n?!!n.trailing:h),_.cancel=function(){void 0!==s&&clearTimeout(s),l=0,a=c=i=s=void 0},_.flush=function(){return void 0===s?o:f(Fw())},_}function Uw(e,t,n){var a=!0,i=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return hh(n)&&(a="leading"in n?!!n.leading:a,i="trailing"in n?!!n.trailing:i),qw(e,t,{leading:a,maxWait:t,trailing:i})}class Ww{constructor(e){this._timer=new xf,this.reportInteraction=Uw((()=>{this._reportInteraction()}),1e3),this._api=e}initialize(){this._api.getConditionsManager().setState({interaction:!1})}hasInteraction(){return this._timer.isRunning()}_reportInteraction(){this._timer.stop();const e=this._api.getConfigManager().getConfig()?.view.interaction_seconds;e&&(this._api.getConditionsManager().setState({interaction:!0}),this._timer.start(e,(()=>{this._api.getConditionsManager().setState({interaction:!1}),this._api.getStyleManager().setLightOrDarkMode()})))}}class Zw{constructor(e){this._state={},this._handleKeydown=e=>{const t={state:"down",ctrl:e.ctrlKey,alt:e.altKey,meta:e.metaKey,shift:e.shiftKey};Dv(this._state[e.key],t)||(this._state[e.key]=t,this._processStateChange())},this._handleKeyup=e=>{e.key in this._state&&"down"===this._state[e.key].state&&(this._state[e.key].state="up",this._processStateChange())},this._handleBlur=()=>{Object.keys(this._state).length&&(this._state={},this._processStateChange())},this._api=e}initialize(){const e=this._api.getCardElementManager().getElement();e.addEventListener("keydown",this._handleKeydown),e.addEventListener("keyup",this._handleKeyup),e.addEventListener("blur",this._handleBlur)}uninitialize(){const e=this._api.getCardElementManager().getElement();e.removeEventListener("keydown",this._handleKeydown),e.removeEventListener("keyup",this._handleKeyup),e.removeEventListener("blur",this._handleBlur)}_processStateChange(){this._api.getConditionsManager().setState({keys:this._state})}}function Qw(e,t){let n;return n=e instanceof Event?e.composedPath()[0]:e,n instanceof HTMLImageElement?{width:n.naturalWidth,height:n.naturalHeight,...t}:n instanceof HTMLVideoElement?{width:n.videoWidth,height:n.videoHeight,...t}:n instanceof HTMLCanvasElement?{width:n.width,height:n.height,player:t?.player,...t}:null}function Gw(e,t,n){const a=Qw(t,n);a&&Yw(e,a)}function Yw(e,t){Bg(e,"media:loaded",t)}function Kw(e){Bg(e,"media:unloaded")}function Xw(e){Bg(e,"media:volumechange")}function Jw(e){Bg(e,"media:play")}function ex(e){Bg(e,"media:pause")}class tx{constructor(e){this._current=null,this._lastKnown=null,this._api=e}initialize(){this.clear()}set(e){var t;(t=e).height>=50&&t.width>=50&&(B_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card media load: ",e),this._current=e,this._lastKnown=e,this._api.getConditionsManager().setState({media_loaded:!0}),this._api.getStyleManager().setExpandedMode(),this._api.getCardElementManager().update())}get(){return this._current}getLastKnown(){return this._lastKnown}clear(){this._current=null,this._api.getConditionsManager().setState({media_loaded:!1})}has(){return!!this._current}}class nx{static isEvent(e){return this.isClip(e)||this.isSnapshot(e)}static isRecording(e){return"recording"===e.getMediaType()}static isClip(e){return"clip"===e.getMediaType()}static isSnapshot(e){return"snapshot"===e.getMediaType()}static isVideo(e){return this.isClip(e)||this.isRecording(e)}}class ax{constructor(e){this._mediaPlayers=[],this._api=e}getMediaPlayers(){return this._mediaPlayers}hasMediaPlayers(){return this._mediaPlayers.length>0}async initializeIfNecessary(e){e?.menu.buttons.media_player.enabled!==this._api.getConfigManager().getConfig()?.menu.buttons.media_player.enabled&&await this.initialize()}async initialize(){const e=this._api.getHASSManager().getHASS();if(!e||!this._api.getConfigManager().getConfig()?.menu.buttons.media_player.enabled)return!1;const t=Object.keys(e.states).filter((t=>{if(t.startsWith("media_player.")){const n=e.states[t];if(n&&"unavailable"!==n.state&&yb(n,131072))return!0}return!1}));let n=null;try{n=await this._api.getEntityRegistryManager().getEntities(e,t)}catch(e){Gg(e)}return this._mediaPlayers=t.filter((e=>{const t=n?.get(e);return!t||!t.hidden_by})),!0}async stop(e){const t=this._api.getHASSManager().getHASS(),n=t?.states[e];if(!n)return;let a;if(yb(n,4096))a="media_stop";else{if(!yb(n,256))return;a="turn_off"}await t.callService("media_player",a,{entity_id:e})}async playLive(e,t){const n=this._api.getCameraManager().getStore().getCameraConfig(t);n&&("dashboard"===n.cast?.method?await this._playLiveDashboard(e,n):await this._playLiveStandard(e,t,n))}async _playLiveStandard(e,t,n){const a=this._api.getHASSManager().getHASS(),i=n?.camera_entity??null;if(!a||!i)return;const r=this._api.getCameraManager().getCameraMetadata(t)?.title??null,o=a.states[i]?.attributes?.entity_picture??null;await a.callService("media_player","play_media",{entity_id:e,media_content_id:`media-source://camera/${i}`,media_content_type:"application/vnd.apple.mpegurl",extra:{...r&&{title:r},...o&&{thumb:o}}})}async _playLiveDashboard(e,t){const n=this._api.getHASSManager().getHASS();if(!n)return;const a=t.cast?.dashboard;a?.dashboard_path&&a?.view_path?await n.callService("cast","show_lovelace_view",{entity_id:e,dashboard_path:a.dashboard_path,view_path:a.view_path}):this._api.getMessageManager().setMessageIfHigherPriority({type:"error",icon:"mdi:cast",message:V_("error.no_dashboard_or_view")})}async playMedia(e,t){const n=this._api.getHASSManager().getHASS();if(!n||!t)return;const a=t.getTitle(),i=t.getThumbnail();await n.callService("media_player","play_media",{entity_id:e,media_content_id:t.getContentID(),media_content_type:nx.isVideo(t)?"video":"image",extra:{...a&&{title:a},...i&&{thumb:i}}})}}class ix{constructor(e){this._message=null,this._api=e}getMessage(){return this._message}hasMessage(){return!!this._message}hasErrorMessage(){return"error"===this._message?.type}reset(){const e=this.hasMessage();this._message=null,e&&this._api.getCardElementManager().update()}resetType(e){this._message?.type===e&&this.reset()}setErrorIfHigherPriority(e,t){e&&"object"==typeof e&&"message"in e&&(Gg(e),this.setMessageIfHigherPriority({message:t?`${t}: ${e.message}`:e.message,type:"error",...e instanceof zs&&{context:e.context}}))}setMessageIfHigherPriority(e){const t=this._message?Is[this._message.type]:0,n=Is[e.type];return!(this._message&&ne.stop())),this._stream=void 0,this._setConditionState(),this._api.getCardElementManager().update()}getStream(){return this._stream??void 0}mute(){const e=this.isMuted();this._mute=!0,this._setMute(),this._setConditionState(),e||this._callListeners("muted")}async unmute(){if(!this.isSupported())return;const e=!this.isMuted(),t=()=>{this._mute=!1,this._setMute()};this.isConnected()||this.isForbidden()?this.isConnected()&&t():(t(),await this.connect()),this._setConditionState(),e||this._callListeners("unmuted")}isConnected(){return!!this._stream}isForbidden(){return null===this._stream}isMuted(){return!this._stream||this._stream.getTracks().every((e=>!e.enabled))}addListener(e){this._listeners.push(e)}removeListener(e){this._listeners=this._listeners.filter((t=>t!==e))}_callListeners(e){this._listeners.forEach((t=>t(e)))}_setMute(){this._stream?.getTracks().forEach((e=>{e.enabled=!this._mute})),this._startTimer(),this._api.getCardElementManager().update()}_startTimer(){const e=this._api.getConfigManager().getConfig()?.live.microphone;if(e?.always_connected)return;const t=e?.disconnect_seconds??0;t&&this._timer.start(t,(()=>{this.disconnect()}))}_setConditionState(){this._api.getConditionsManager().setState({microphone:{muted:this.isMuted(),connected:this.isConnected()}})}}class ox{constructor(e){this._shouldRun=!0,this.requestExecution=()=>{this._shouldRun=!0,this._api.getCardElementManager().update()},this.executeIfNecessary=async()=>{this._shouldRun&&(this._shouldRun=!1,await this._executeViewRelated(this._calculateIntent()),await this._executeNonViewRelated(this._calculateIntent()))},this._isViewAction=e=>{switch(e.frigate_card_action){case"clip":case"clips":case"diagnostics":case"image":case"live":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":return!0}return!1},this._api=e}hasViewRelatedActionsToRun(){return!!this._calculateIntent().view&&this._shouldRun}async _executeViewRelated(e){e.view&&(e.view.default?await this._api.getViewManager().setViewDefaultWithNewQuery({params:{camera:e.view.camera},...e.view.substream&&{modifiers:[new sb(e.view.substream)]}}):await this._api.getViewManager().setViewByParametersWithNewQuery({params:{...e.view.view&&{view:e.view.view},...e.view.camera&&{camera:e.view.camera}},...e.view.substream&&{modifiers:[new sb(e.view.substream)]}}))}async _executeNonViewRelated(e){e.other&&await this._api.getActionsManager().executeActions(e.other)}_calculateIntent(){const e={};for(const t of this._getActions())this._isViewAction(t)?((e.view??={}).view=t.frigate_card_action,(e.view??={}).default=void 0):"default"===t.frigate_card_action?((e.view??={}).default=!0,(e.view??={}).view=void 0):"camera_select"===t.frigate_card_action?(e.view??={}).camera=t.camera:"live_substream_select"===t.frigate_card_action?(e.view??={}).substream=t.camera:(e.other??=[]).push(t);return e}_getActions(){const e=new URLSearchParams(window.location.search),t=[],n=new RegExp(/^frigate-card-action([.:](?\w+))?[.:](?\w+)/);for(const[a,i]of e.entries()){const e=a.match(n);if(!e||!e.groups)continue;const r=e.groups.cardID,o=e.groups.action;let s=null;switch(o){case"camera_select":case"live_substream_select":i&&(s=ff(o,i,{cardID:r}));break;case"camera_ui":case"clip":case"clips":case"default":case"diagnostics":case"download":case"expand":case"image":case"live":case"menu_toggle":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":s=gf(o,{cardID:r});break;default:console.warn(`Frigate card received unknown card action in query string: ${o}`)}s&&t.push(s)}return t}}class sx{constructor(e){this._items=[],this._dynamicItems=[],this._api=e}addDynamicStatusBarItem(e){this._dynamicItems.includes(e)||this._dynamicItems.push(e),this._api.getCardElementManager().update()}removeDynamicStatusBarItem(e){this._dynamicItems=this._dynamicItems.filter((t=>!Dv(t,e))),this._api.getCardElementManager().update()}removeAllDynamicStatusBarItems(){this._dynamicItems=[],this._api.getCardElementManager().update()}calculateItems(e){const t=e?.view?e?.cameraManager?.getCameraMetadata(e?.view?.camera):null,n=t?.engineLogo??null,a=e?.view?.is("live")?t?.title??null:e?.view?.isViewerView()?e?.view.queryResults?.getSelectedResult()?.getTitle()??null:null,i=e?.mediaLoadedInfo?this._calculateResolution(e?.mediaLoadedInfo):null,r=e?.mediaLoadedInfo?.technology?.length?e?.mediaLoadedInfo.technology[0]:null;return[...a?[{type:"custom:frigate-card-status-bar-string",string:a,expand:!0,sufficient:!0,...e?.statusConfig?.items.title}]:[],...i?[{type:"custom:frigate-card-status-bar-string",string:i,...e?.statusConfig?.items.resolution}]:[],...r&&"webrtc"===r?[{type:"custom:frigate-card-status-bar-icon",icon:"mdi:webrtc",...e?.statusConfig?.items.technology}]:r?[{type:"custom:frigate-card-status-bar-string",string:r.toUpperCase(),...e?.statusConfig?.items.technology}]:[],...n?[{type:"custom:frigate-card-status-bar-image",image:n,...e?.statusConfig?.items.engine}]:[],...this._dynamicItems]}_matchesWidthHeight(e,t,n){const a=.99*t,i=1.01*t,r=.99*n,o=1.01*n,s=(e,t,n)=>e>=t&&e<=n;return!!e&&(s(e.width,a,i)&&s(e.height,r,o)||s(e.height,a,i)&&s(e.width,r,o))}_calculateResolution(e){return this._matchesWidthHeight(e,1920,1080)?"1080p":this._matchesWidthHeight(e,1280,720)?"720p":this._matchesWidthHeight(e,640,480)?"VGA":this._matchesWidthHeight(e,3840,2160)?"4K":this._matchesWidthHeight(e,720,480)?"480p":this._matchesWidthHeight(e,720,576)?"576p":this._matchesWidthHeight(e,7680,4320)?"8K":`${e.width}x${e.height}`}}class cx{constructor(e){this.setLightOrDarkMode=()=>{const e=this._api.getConfigManager().getConfig(),t="on"===e?.view.dark_mode||"auto"===e?.view.dark_mode&&(!this._api.getInteractionManager().hasInteraction()||!!this._api.getHASSManager().getHASS()?.themes.darkMode);of(this._api.getCardElementManager().getElement(),t,"dark")},this._api=e}setExpandedMode(){const e=this._api.getCardElementManager().getElement(),t=this._api.getViewManager().getView(),n=this._api.getMediaLoadedInfoManager().getLastKnown();e.style.setProperty("--frigate-card-expand-aspect-ratio",t?.isAnyMediaView()&&n?`${n.width} / ${n.height}`:"unset");const a=t?.isGrid();e.style.setProperty("--frigate-card-expand-width",!a&&t?.isAnyMediaView()?"none":"var(--frigate-card-expand-max-width)"),e.style.setProperty("--frigate-card-expand-height",!a&&t?.isAnyMediaView()?"none":"var(--frigate-card-expand-max-height)")}setMinMaxHeight(){const e=this._api.getConfigManager().getConfig();if(e){this._api.getCardElementManager().getElement().style.setProperty("--frigate-card-height",e.dimensions.height)}}setPerformance(){const e={box_shadow:"none",border_radius:"0px"},t=this._api.getCardElementManager().getElement(),n=this._api.getConfigManager().getCardWideConfig()?.performance,a=n?.style??{};for(const n of Object.keys(a)){const i=`--frigate-card-css-${n.replaceAll("_","-")}`;!1===a[n]?t.style.setProperty(i,e[n]):t.style.removeProperty(i)}}_isAspectRatioEnforced(e,t){const n=e.dimensions.aspect_ratio_mode;return!(this._api.getFullscreenManager().isInFullscreen()||this._api.getExpandManager().isExpanded()||"unconstrained"===n||"dynamic"===n&&(!t||t?.isAnyMediaView()||t?.is("timeline")||t?.is("diagnostics")))}getAspectRatioStyle(){const e=this._api.getConfigManager().getConfig(),t=this._api.getViewManager().getView();if(e){if(!this._isAspectRatioEnforced(e,t))return uf();const n=e.dimensions.aspect_ratio_mode,a=this._api.getMediaLoadedInfoManager().getLastKnown();return uf(a&&"dynamic"===n?{ratio:[a.width,a.height]}:{ratio:e.dimensions.aspect_ratio})}return uf({defaultStatic:!0})}}class lx{constructor(e){this._triggeredCameras=new Map,this._triggeredCameraTimers=new Map,this._throttledTriggerAction=Uw(this._triggerAction.bind(this),1e3,{trailing:!0}),this._api=e}getTriggeredCameraIDs(){return new Set(this._triggeredCameras.keys())}isTriggered(){return!!this._triggeredCameras.size}getMostRecentlyTriggeredCameraID(){const e=Ev([...this._triggeredCameras.entries()],(e=>e[1].getTime()),"desc");return e.length?e[0][0]:null}async handleCameraEvent(e){const t=this._api.getConfigManager().getConfig()?.view.triggers,n=this._api.getViewManager().getView()?.camera;if(!t||!n)return;const a=this._api.getCameraManager().getStore().getAllDependentCameras(n);t.filter_selected_camera&&!a.has(e.cameraID)||("end"!==e.type?(this._triggeredCameras.set(e.cameraID,new Date),this._setConditionStateIfNecessary(),await this._throttledTriggerAction(e)):this._startUntriggerTimer(e.cameraID))}_hasAllowableInteractionStateForAction(){const e=this._api.getConfigManager().getConfig()?.view.triggers,t=this._api.getInteractionManager().hasInteraction();return!!e&&("all"===e.actions.interaction_mode||"active"===e.actions.interaction_mode&&t||"inactive"===e.actions.interaction_mode&&!t)}async _triggerAction(e){const t=this._api.getConfigManager().getConfig()?.view.triggers.actions.trigger,n=this._api.getConfigManager().getConfig()?.view.default;("high"!==e.fidelity||e.snapshot||e.clip||"live"===t||"default"===t&&"live"===n)&&(this._hasAllowableInteractionStateForAction()&&("update"===t?await this._api.getViewManager().setViewByParametersWithNewQuery({queryExecutorOptions:{useCache:!1}}):"live"===t?await this._api.getViewManager().setViewByParametersWithNewQuery({params:{view:"live",camera:e.cameraID}}):"default"===t?await this._api.getViewManager().setViewDefaultWithNewQuery({params:{camera:e.cameraID}}):"high"===e.fidelity&&"media"===t&&await this._api.getViewManager().setViewByParametersWithNewQuery({params:{view:e.clip?"clip":"snapshot",camera:e.cameraID}})),this._api.getCardElementManager().update())}_setConditionStateIfNecessary(){const e=new Set(this._triggeredCameras.keys()),t=e.size?e:void 0;Dv(t,this._api.getConditionsManager().getState().triggered)||this._api.getConditionsManager().setState({triggered:t})}async _untriggerAction(e){const t=this._api.getConfigManager().getConfig()?.view.triggers.actions.untrigger;"default"===t&&this._hasAllowableInteractionStateForAction()&&await this._api.getViewManager().setViewDefaultWithNewQuery(),this._triggeredCameras.delete(e),this._deleteTimer(e),this._setConditionStateIfNecessary(),this._api.getCardElementManager().update()}_startUntriggerTimer(e){this._deleteTimer(e);const t=new xf;this._triggeredCameraTimers.set(e,t),t.start( +/* istanbul ignore next: the case of config being null here cannot be + reached, as there's no way to have the untrigger call happen without + a config. -- @preserve */ +this._api.getConfigManager().getConfig()?.view.triggers.untrigger_seconds??0,(async()=>{await this._untriggerAction(e)}))}_deleteTimer(e){this._triggeredCameraTimers.get(e)?.stop(),this._triggeredCameraTimers.delete(e)}}function dx(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Hg(e,void 0,t):[]}class ux{constructor(e){this._queries=null,e&&(this._queries=e)}clone(){return u_(this)}getQueries(){return this._queries}setQueries(e){return this._queries=e,this}getQueryCameraIDs(){if(!this._queries)return null;const e=new Set;return this._queries.forEach((t=>[...t.cameraIDs].forEach((t=>e.add(t))))),e}setQueryCameraIDs(e){if(!this._queries)return this;const t=[];return this._queries.forEach((n=>t.push({...n,cameraIDs:Zg(e)}))),this._queries=dx(t,Dv),this}hasQueriesForCameraIDs(e){for(const t of e)if(!this._queries?.some((e=>e.cameraIDs.has(t))))return!1;return!0}}class hx extends ux{convertToClipsQueries(){for(const e of this._queries??[])delete e.hasSnapshot,e.hasClip=!0;return this}}class px extends ux{}class mx{static areEventQueries(e){return e instanceof hx}static areRecordingQueries(e){return e instanceof px}static areClipsQueries(e){return this.areEventQueries(e)&&!!e?.getQueries()?.every((e=>e.hasClip))}static areSnapshotQueries(e){return this.areEventQueries(e)&&!!e?.getQueries()?.every((e=>e.hasSnapshot))}static getQueriesType(e){return this.areEventQueries(e)?"event":this.areRecordingQueries(e)?"recording":null}static getMediaType(e){return this.areClipsQueries(e)?"clips":this.areSnapshotQueries(e)?"snapshots":this.areRecordingQueries(e)?"recordings":null}}const gx=(e,t,n)=>{const a={anyCapabilities:["clips","snapshots","recordings"]};switch(t){case"image":case"diagnostics":return e.getStore().getCameraIDs();case"live":case"clip":case"clips":case"snapshot":case"snapshots":case"recording":case"recordings":const i="clip"===t?"clips":"snapshot"===t?"snapshots":"recording"===t?"recordings":t;return n?e.getStore().getAllDependentCameras(n,i):e.getStore().getCameraIDsWithCapability(i);case"timeline":return e.getStore().getCameraIDsWithCapability(a);case"media":return n?e.getStore().getAllDependentCameras(n,a):e.getStore().getCameraIDsWithCapability(a)}},fx=(e,t)=>Ly({},e,t);class _x{constructor(e){this.view=e.view,this.camera=e.camera,this.query=e.query??null,this.queryResults=e.queryResults??null,this.context=e.context??null,this.displayMode=e.displayMode??null}clone(){return new _x({view:this.view,camera:this.camera,query:this.query?.clone()??null,queryResults:this.queryResults?.clone()??null,context:this.context,displayMode:this.displayMode})}evolve(e){return new _x({view:void 0!==e.view?e.view:this.view,camera:void 0!==e.camera?e.camera:this.camera,query:void 0!==e.query?e.query:this.query?.clone()??null,queryResults:void 0!==e.queryResults?e.queryResults:this.queryResults?.clone()??null,context:void 0!==e.context?e.context:this.context,displayMode:void 0!==e.displayMode?e.displayMode:this.displayMode})}mergeInContext(e){return this.context=fx(this.context,e),this}removeContext(e){return this.context&&delete this.context[e],this}removeContextProperty(e,t){const n=this.context?.[e];return n&&delete n[t],this}is(e){return this.view==e}isGalleryView(){return["clips","snapshots","recordings"].includes(this.view)}isAnyMediaView(){return this.isViewerView()||this.is("live")||this.is("image")}isViewerView(){return["media","clip","snapshot","recording"].includes(this.view)}supportsMultipleDisplayModes(){return this.isViewerView()||this.is("live")}getDefaultMediaType(){return["clip","clips"].includes(this.view)?"clips":["snapshot","snapshots"].includes(this.view)?"snapshots":["recording","recordings"].includes(this.view)?"recordings":null}isGrid(){return"grid"===this.displayMode}}const vx=(e,t)=>{t?.forEach((t=>t.modify(e)))};class yx extends zs{}class bx extends zs{}class wx{constructor(e){this._api=e}getViewDefault(e){const t=this._api.getConfigManager().getConfig();if(!t)return null;let n=null;const a=e?.params?.view??t.view.default;if(e?.params?.camera)n=e.params.camera;else{const i=[...gx(this._api.getCameraManager(),a)];if(!i.length)return null;if(e?.baseView?.camera&&t.view.default_cycle_camera){const t=i.indexOf(e.baseView.camera);n=i[t+1>=i.length?0:t+1]}else n=i[0]}return this.getViewByParameters({params:{...e?.params,view:a,camera:n},baseView:e?.baseView})}getViewByParameters(e){const t=this._api.getConfigManager().getConfig();if(!t)return null;let n=e?.params?.camera??e?.baseView?.camera??null,a=e?.params?.view??e?.baseView?.view??t.view.default;const i=this._api.getCameraManager().getStore().getCameraIDs();if(!n||!i.has(n)){n=gx(this._api.getCameraManager(),a).keys().next().value??null}if(!n){const e=[...this._api.getCameraManager().getStore().getCameras()].reduce(((e,[t,n])=>{const a=n.getCapabilities()?.getRawCapabilities();return a&&(e[t]=a),e}),{});throw new yx(V_("error.no_supported_cameras"),{view:a,cameras_capabilities:e})}if(!this.isViewSupportedByCamera(n,a)){if(!e?.failSafe||!this.isViewSupportedByCamera(n,Qs)){const e=this._api.getCameraManager().getStore().getCamera(n)?.getCapabilities()?.getRawCapabilities();throw new bx(V_("error.no_supported_camera"),{view:a,camera:n,...e&&{camera_capabilities:e}})}a=Qs}const r=e?.params?.displayMode??e?.baseView?.displayMode??this._getDefaultDisplayModeForView(a,t),o={...e?.params,view:a,camera:n,displayMode:r},s=e?.baseView?e.baseView.evolve(o):new _x(o);return vx(s,e?.modifiers),s}isViewSupportedByCamera(e,t){return!!gx(this._api.getCameraManager(),t,e).size}_getDefaultDisplayModeForView(e,t){let n=null;switch(e){case"media":case"clip":case"recording":case"snapshot":n=t.media_viewer.display?.mode??null;break;case"live":n=t.live.display?.mode??null}return n??"single"}}class xx{constructor(e,t){this._key=e,this._property=t}modify(e){e.removeContextProperty(this._key,this._property)}}class Cx{constructor(e){this._query=e?.query,this._queryResults=e?.queryResults}modify(e){void 0!==this._query&&(e.query=this._query),void 0!==this._queryResults&&(e.queryResults=this._queryResults)}}const Mx=(e,t,n)=>{let a;for(const[i,r]of e.entries()){const e=r.getStartTime(),o=r.getUsableEndTime();if(r.includesTime(t)&&e&&o){const t=o.getTime()-e.getTime();(!a||n&&a.cameraID!==n&&r.getCameraID()===n||t>a.duration&&(!n||a.cameraID!==n||r.getCameraID()===n))&&(a={index:i,duration:t,cameraID:r.getCameraID()})}}return a?a.index:null};class kx{constructor(e){this._results=e?.results??[],this._selectedIndex=this._getInitialSelectedIndex(e)}_getInitialSelectedIndex(e){return null!=e?.selectedIndex?e.selectedIndex:e?.results&&e.results.length?e?.selectApproach&&"last"!==e?.selectApproach?0:e.results.length-1:null}clone(){return new kx({results:this._results,selectedIndex:this._selectedIndex})}getResults(){return this._results}getSelectedIndex(){return this._selectedIndex}getResultsCount(){return this.getResults().length}hasResults(){return 0!==this.getResultsCount()}getResult(e){return void 0===e?null:this._results[e]}getSelectedResult(){const e=this.getSelectedIndex();return null!==e?this.getResult(e):null}hasSelectedResult(){return null!==this.getSelectedResult()}resetSelectedResult(){this._selectedIndex=null}selectIndex(e){(null===e||e>=0&&ee.getID()))),n=new Set(e._main.getResults()?.map((e=>e.getID())));return!(!t.size||!n.size||t.has(null)||n.has(null))&&((e,t)=>{for(const n of t)if(!e.has(n))return!1;return!0})(t,n)}getCameraIDs(){return new Set(this._cameras.keys())}getSlice(e){return e?this._cameras.get(e)??null:this._main}getResults(e){return this.getSlice(e)?.getResults()??null}getResultsCount(e){return this.getSlice(e)?.getResultsCount()??0}hasResults(e){return 0!==this.getSlice(e)?.getResultsCount()}getResult(e,t){return this.getSlice(t)?.getResult(e)??null}getSelectedIndex(e){return this.getSlice(e)?.getSelectedIndex()??null}getSelectedResult(e){return this.getSlice(e)?.getSelectedResult()??null}getMultipleSelectedResults(e){const t=[];if(!e||e.main){const e=this.getSelectedResult();e&&t.push(e)}const n=this._getCameraIDsFromCriteria(e);for(const e of n??[]){const n=this.getSelectedResult(e);n&&t.push(n)}return t}hasSelectedResult(e){return this.getSlice(e)?.hasSelectedResult()??!1}resetSelectedResult(e){return this.getSlice(e)?.resetSelectedResult(),this}getResultsTimestamp(){return this._resultsTimestamp}selectIndex(e,t){return this.getSlice(t)?.selectIndex(e),t||this.demoteMainSelectionToCameraSelection(),this}demoteMainSelectionToCameraSelection(){const e=this.getSelectedResult();if(e){const t=e.getCameraID();this.resetSelectedResult(t),this.selectResultIfFound((t=>t===e),{cameraID:t})}return this}promoteCameraSelectionToMainSelection(e){const t=this.getSelectedResult(e);return this.resetSelectedResult(),this.selectResultIfFound((e=>e===t)),this}_getCameraIDsFromCriteria(e){return e?.allCameras?this.getCameraIDs():e?.cameraID?new Set([e.cameraID]):null}selectResultIfFound(e,t){t&&!t?.main||(this._main.selectResultIfFound(e),this.demoteMainSelectionToCameraSelection());const n=this._getCameraIDsFromCriteria(t);for(const t of n??[])this.getSlice(t)?.selectResultIfFound(e);return this}selectBestResult(e,t){t&&!t.main||(this._main.selectBestResult(e),this.demoteMainSelectionToCameraSelection());const n=this._getCameraIDsFromCriteria(t);for(const t of n??[])this.getSlice(t)?.selectBestResult(e);return this}}class Ex{constructor(e){this._api=e}async executeDefaultEventQuery(e){const t=e?.eventsMediaType&&"all"!==e?.eventsMediaType?e.eventsMediaType:{anyCapabilities:["clips","snapshots"]},n=this._api.getCameraManager(),a=e?.cameraID?n.getStore().getAllDependentCameras(e.cameraID,t):n.getStore().getCameraIDsWithCapability(t);if(!a.size)return null;const i=n.generateDefaultEventQueries(a,{limit:this._getChunkLimit(),..."clips"===e?.eventsMediaType&&{hasClip:!0},..."snapshots"===e?.eventsMediaType&&{hasSnapshot:!0}});if(!i)return null;const r=new hx(i),o=await this.execute(r,e?.executorOptions);return o?{query:r,queryResults:o}:null}async executeDefaultRecordingQuery(e){const t=this._api.getCameraManager(),n=e?.cameraID?t.getStore().getAllDependentCameras(e.cameraID,"recordings"):t.getStore().getCameraIDsWithCapability("recordings");if(!n.size)return null;const a=t.generateDefaultRecordingQueries(n,{limit:this._getChunkLimit()});if(!a)return null;const i=new px(a),r=await this.execute(i,e?.executorOptions);return r?{query:i,queryResults:r}:null}async execute(e,t){const n=e.getQueries();if(!n)return null;const a=await this._api.getCameraManager().executeMediaQueries(n,{useCache:t?.useCache});if(!a)return null;const i=new Sx({results:a});return t?.rejectResults?.(i)?null:(t?.selectResult?.id?i.selectBestResult((e=>e.findIndex((e=>e.getID()===t.selectResult?.id)))):t?.selectResult?.func?i.selectResultIfFound(t.selectResult.func):t?.selectResult?.time&&i.selectBestResult((e=>Mx(e,t.selectResult?.time?.time,t.selectResult?.time?.favorCameraID))),i)}_getChunkLimit(){const e=this._api.getConfigManager().getCardWideConfig();return e?.performance?.features.media_chunk_size??50}}class $x{constructor(e,t){this._api=e,this._executor=t??new Ex(e)}async getExistingQueryModifiers(e,t){return e.query?[new Cx({queryResults:await this._executor.execute(e.query,t)})]:[]}async getNewQueryModifiers(e,t){return await this._executeNewQuery(e,{useCache:!1,...t})}async _executeNewQuery(e,t){const n=this._api.getConfigManager().getConfig();if(!n)return null;const a=e?.getDefaultMediaType(),i=[],r=async n=>{ +/* istanbul ignore if: this path cannot be reached -- @preserve */ +if(!n)return[];const a="recordings"===n?await this._executor.executeDefaultRecordingQuery({...!e.isGrid()&&{cameraID:e.camera},executorOptions:t}):"clips"===n||"snapshots"===n||"all"===n?await this._executor.executeDefaultEventQuery({...!e.isGrid()&&{cameraID:e.camera},eventsMediaType:n,executorOptions:t}):/* istanbul ignore next -- @preserve */ +null;return a?[new Cx(a)]:[]};switch(e.view){case"live":"none"!==n.live.controls.thumbnails.mode&&i.push(...await r("recordings"===n.live.controls.thumbnails.media_type?"recordings":n.live.controls.thumbnails.events_media_type));break;case"media":i.push(...await r("clips"));break;case"clips":case"snapshots":case"recordings":i.push(...await r(a));break;case"clip":case"snapshot":case"recording":"none"!==n.media_viewer.controls.thumbnails.mode&&i.push(...await r(a))}return i.push(...this._getTimelineWindowViewModifier(e)),i.push(...this._getSeekTimeModifier(t?.selectResult?.time?.time)),i}_getTimelineWindowViewModifier(e){if(e.is("live")){const e=new Date,t=this._api.getConfigManager().getConfig()?.live; +/* istanbul ignore if: this if branch cannot be reached as if the config is + empty this function is never called -- @preserve */ +return t?[new Gy({timeline:{window:{start:Qu(e,{seconds:t.controls.timeline.window_seconds}),end:e}}})]:[]}return[new xx("timeline","window")]}_getSeekTimeModifier(e){return e?[new Gy({mediaViewer:{seek:e}})]:[new xx("mediaViewer","seek")]}}class Ax{constructor(e,t){this._view=null,this._epoch=this._createEpoch(),this._loadingIndex=1,this.setViewDefault=e=>this._setViewGeneric(this._viewFactory.getViewDefault.bind(this._viewFactory),e),this.setViewByParameters=e=>this._setViewGeneric(this._viewFactory.getViewByParameters.bind(this._viewFactory),e),this.setViewDefaultWithNewQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewDefault.bind(this._viewFactory),this._viewQueryExecutor.getNewQueryModifiers.bind(this._viewQueryExecutor),e),this.setViewByParametersWithNewQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewByParameters.bind(this._viewFactory),this._viewQueryExecutor.getNewQueryModifiers.bind(this._viewQueryExecutor),e),this.setViewByParametersWithExistingQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewByParameters.bind(this._viewFactory),this._viewQueryExecutor.getExistingQueryModifiers.bind(this._viewQueryExecutor),e),this.initialize=async()=>(this._api.getQueryStringManager().hasViewRelatedActionsToRun()||this.setViewDefaultWithNewQuery({failSafe:!0}),!0),this._api=e,this._viewFactory=t?.viewFactory??new wx(e),this._viewQueryExecutor=t?.viewQueryExecutor??new $x(e)}getEpoch(){return this._epoch}_createEpoch(e){return{manager:this,...e&&{oldView:e}}}getView(){return this._view}hasView(){return!!this.getView()}reset(){this._view&&this._setView(null)}_setViewGeneric(e,t){let n=null;try{n=e({baseView:this._view,...t})}catch(e){this._api.getMessageManager().setErrorIfHigherPriority(e)}n&&this._setView(n)}_markViewLoadingQuery(e,t){return e.mergeInContext({loading:{query:t}})}_markViewAsNotLoadingQuery(e){return e.removeContextProperty("loading","query")}async _setViewThenModifyAsync(e,t,n){let a=null;try{a=e({baseView:this._view,...n,params:{query:null,queryResults:null,...n?.params}})}catch(e){this._api.getMessageManager().setErrorIfHigherPriority(e)}if(!a)return;if(this._view&&this._shouldAdoptQueryAndResults(a))return a.query=this._view.query,a.queryResults=this._view.queryResults,this._markViewAsNotLoadingQuery(a),void this._setView(a);const i=this._loadingIndex++;this._markViewLoadingQuery(a,i),this._setView(a);let r=null,o=null;try{r=await t(a,n?.queryExecutorOptions)}catch(e){o=e}if(this._view&&this.hasMajorMediaChange(this._view,a))return void(this._view.context?.loading?.query===i&&this._setView(this._markViewAsNotLoadingQuery(this._view.clone())));if(o)return void this._api.getMessageManager().setErrorIfHigherPriority(o); +/* istanbul ignore if: the if path cannot be reached as the view is set + above -- @preserve */if(!this._view)return;const s=this._view.clone();this._view.context?.loading?.query===i&&this._markViewAsNotLoadingQuery(s),vx(s,r),this._setView(s)}_shouldAdoptQueryAndResults(e){const t=this._view?.isViewerView()&&e?.isGalleryView(),n=e?.getDefaultMediaType(),a=mx.getMediaType(this._view?.query)===n;return!!t&&a}setViewWithMergedContext(e){if(this._view)return this._setView(this._view?.clone().mergeInContext(e))}isViewSupportedByCamera(e,t){return!!gx(this._api.getCameraManager(),t,e).size}hasMajorMediaChange(e,t){const n=t??this._view;return!!e!=!!n||e?.view!==n?.view||e?.camera!==n?.camera||"live"===n?.view&&e&&My(e)!==My(n)||"live"!==n?.view&&e?.queryResults!==n?.queryResults}_setView(e){const t=this._view;B_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card view change: ",e),this._view=e,this._epoch=this._createEpoch(t),this.hasMajorMediaChange(t)&&this._api.getMediaLoadedInfoManager().clear(),t?.view!==e?.view&&this._api.getCardElementManager().scrollReset(),this._api.getMessageManager().reset(),this._api.getStyleManager().setExpandedMode(),this._api.getConditionsManager()?.setState({view:e?.view,camera:e?.camera,displayMode:e?.displayMode??void 0}),this._api.getCardElementManager().update()}}class zx{constructor(e,t,n,a){this._deviceRegistryManager=new oy(new iy((e=>e.id))),this._entityRegistryManager=new ly(new iy((e=>e.entity_id))),this._resolvedMediaCache=new uy,this._actionsManager=new gb(this),this._automationsManager=new fb(this),this._cameraManager=new ay(this),this._cameraURLManager=new _b(this),this._configManager=new kw(this),this._defaultManager=new Sw(this),this._downloadManager=new zw(this),this._expandManager=new Iw(this),this._fullscreenManager=new Pw(this),this._hassManager=new Nw(this),this._initializationManager=new Qb(this),this._interactionManager=new Ww(this),this._keyboardStateManager=new Zw(this),this._mediaLoadedInfoManager=new tx(this),this._mediaPlayerManager=new ax(this),this._messageManager=new ix(this),this._microphoneManager=new rx(this),this._queryStringManager=new ox(this),this._statusBarItemManager=new sx(this),this._styleManager=new cx(this),this._triggersManager=new lx(this),this._viewManager=new Ax(this),e.addController(this),this._conditionsManager=new bw(this,a),this._cardElementManager=new Gb(this,e,t,n)}getActionsManager(){return this._actionsManager}getAutomationsManager(){return this._automationsManager}getCameraManager(){return this._cameraManager}getCameraURLManager(){return this._cameraURLManager}getCardElementManager(){return this._cardElementManager}getConditionsManager(){return this._conditionsManager}static async getConfigElement(){return await import("./editor-837da8b4.js"),document.createElement("frigate-card-editor")}getConfigManager(){return this._configManager}getDefaultManager(){return this._defaultManager}getDeviceRegistryManager(){return this._deviceRegistryManager}getDownloadManager(){return this._downloadManager}getEntityRegistryManager(){return this._entityRegistryManager}getExpandManager(){return this._expandManager}getFullscreenManager(){return this._fullscreenManager}getHASSManager(){return this._hassManager}getInitializationManager(){return this._initializationManager}getInteractionManager(){return this._interactionManager}getKeyboardStateManager(){return this._keyboardStateManager}getMediaLoadedInfoManager(){return this._mediaLoadedInfoManager}getMediaPlayerManager(){return this._mediaPlayerManager}getMessageManager(){return this._messageManager}getMicrophoneManager(){return this._microphoneManager}getQueryStringManager(){return this._queryStringManager}getResolvedMediaCache(){return this._resolvedMediaCache}getStatusBarItemManager(){return this._statusBarItemManager}static getStubConfig(e){return{cameras:[{camera_entity:e.find((e=>e.startsWith("camera.")))??"camera.demo"}]}}getStyleManager(){return this._styleManager}getTriggersManager(){return this._triggersManager}getViewManager(){return this._viewManager}hostConnected(){this.getCardElementManager().elementConnected()}hostDisconnected(){this.getCardElementManager().elementDisconnected()}}class Ix{constructor(){this._dynamicMenuButtons=[]}addDynamicMenuButton(e){this._dynamicMenuButtons.includes(e)||this._dynamicMenuButtons.push(e)}removeDynamicMenuButton(e){this._dynamicMenuButtons=this._dynamicMenuButtons.filter((t=>t!=e))}calculateButtons(e,t,n,a){return[this._getDefaultButton(t),this._getCamerasButton(t,n,a?.view),this._getSubstreamsButton(t,n,a?.view),this._getLiveButton(t,a?.view,a?.viewManager),this._getClipsButton(t,a?.view,a?.viewManager),this._getSnapshotsButton(t,a?.view,a?.viewManager),this._getRecordingsButton(t,a?.view,a?.viewManager),this._getImageButton(t,a?.view,a?.viewManager),this._getTimelineButton(t,a?.view,a?.viewManager),this._getDownloadButton(t,n,a?.view),this._getCameraUIButton(t,a?.showCameraUIButton),this._getMicrophoneButton(t,a?.microphoneManager,a?.currentMediaLoadedInfo),this._getExpandButton(t,a?.inExpandedMode),this._getFullscreenButton(t,a?.inFullscreenMode),this._getCastButton(e,t,n,a?.view,a?.mediaPlayerController),this._getPlayPauseButton(t,a?.currentMediaLoadedInfo),this._getMuteUnmuteButton(t,a?.currentMediaLoadedInfo),this._getScreenshotButton(t,a?.currentMediaLoadedInfo),this._getDisplayModeButton(t,n,a?.view),this._getPTZControlsButton(t,n,a?.view),this._getPTZHomeButton(t,n,a?.view),...this._dynamicMenuButtons.map((e=>({style:this._getStyleFromActions(t,e,a),...e})))].filter(sf)}_getDefaultButton(e){return{icon:"frigate",...e.menu.buttons.frigate,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.frigate"),permanent:!0,tap_action:"hidden"===e.menu?.style?gf("menu_toggle"):gf("default"),hold_action:gf("diagnostics")}}_getCamerasButton(e,t,n){const a=t.getStore().getCameraIDsWithCapability("menu");if(a.size>1){const i=Array.from(t.getStore().getCameraConfigEntries(a),(([e,a])=>{const i=ff("camera_select",e),r=t.getCameraMetadata(e);return{enabled:!0,icon:r?.icon,entity:a.camera_entity,state_color:!0,title:r?.title,selected:n?.camera===e,...i&&{tap_action:i}}}));return{icon:"mdi:video-switch",...e.menu.buttons.cameras,type:"custom:frigate-card-menu-submenu",title:V_("config.menu.buttons.cameras"),items:i}}return null}_getSubstreamsButton(e,t,n){if(!n)return null;const a=t.getStore().getAllDependentCameras(n.camera,"substream");if(a.size&&n.is("live")){const i=[...a].filter((e=>e!==n.camera)),r=[n.camera,...i],o=My(n);if(2===r.length)return{icon:"mdi:video-input-component",style:o!==n.camera?this._getEmphasizedStyle():{},title:V_("config.menu.buttons.substreams"),...e.menu.buttons.substreams,type:"custom:frigate-card-menu-icon",tap_action:gf(ky(n)?"live_substream_off":"live_substream_on")};if(r.length>2){const a=Array.from(r,(e=>{const n=ff("live_substream_select",e),a=t.getCameraMetadata(e)??void 0,i=t.getStore().getCameraConfig(e);return{enabled:!0,icon:a?.icon,entity:i?.camera_entity,state_color:!0,title:a?.title,selected:o===e,...n&&{tap_action:n}}}));return{icon:"mdi:video-input-component",title:V_("config.menu.buttons.substreams"),style:o!==n.camera?this._getEmphasizedStyle():{},...e.menu.buttons.substreams,type:"custom:frigate-card-menu-submenu",items:a}}}return null}_getLiveButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"live")?{icon:"mdi:cctv",...e.menu.buttons.live,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.live"),style:t.is("live")?this._getEmphasizedStyle():{},tap_action:gf("live")}:null}_getClipsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"clips")?{icon:"mdi:filmstrip",...e.menu.buttons.clips,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.clips"),style:t?.is("clips")?this._getEmphasizedStyle():{},tap_action:gf("clips"),hold_action:gf("clip")}:null}_getSnapshotsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"snapshots")?{icon:"mdi:camera",...e.menu.buttons.snapshots,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.snapshots"),style:t?.is("snapshots")?this._getEmphasizedStyle():{},tap_action:gf("snapshots"),hold_action:gf("snapshot")}:null}_getRecordingsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"recordings")?{icon:"mdi:album",...e.menu.buttons.recordings,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.recordings"),style:t.is("recordings")?this._getEmphasizedStyle():{},tap_action:gf("recordings"),hold_action:gf("recording")}:null}_getImageButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"image")?{icon:"mdi:image",...e.menu.buttons.image,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.image"),style:t?.is("image")?this._getEmphasizedStyle():{},tap_action:gf("image")}:null}_getTimelineButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"timeline")?{icon:"mdi:chart-gantt",...e.menu.buttons.timeline,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.timeline"),style:t.is("timeline")?this._getEmphasizedStyle():{},tap_action:gf("timeline")}:null}_getDownloadButton(e,t,n){const a=n?.queryResults?.getSelectedResult(),i=a?t?.getMediaCapabilities(a):null;return n?.isViewerView()&&i?.canDownload&&!vb()?{icon:"mdi:download",...e.menu.buttons.download,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.download"),tap_action:gf("download")}:null}_getCameraUIButton(e,t){return t?{icon:"mdi:web",...e.menu.buttons.camera_ui,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.camera_ui"),tap_action:gf("camera_ui")}:null}_getMicrophoneButton(e,t,n){if(t&&n?.capabilities?.supports2WayAudio){const n=t.isForbidden()||!t.isSupported(),a=t.isMuted(),i=e.menu.buttons.microphone.type;return{icon:n?"mdi:microphone-message-off":a?"mdi:microphone-off":"mdi:microphone",...e.menu.buttons.microphone,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.microphone"),style:n||a?{}:this._getEmphasizedStyle(!0),...!n&&"momentary"===i&&{start_tap_action:gf("microphone_unmute"),end_tap_action:gf("microphone_mute")},...!n&&"toggle"===i&&{tap_action:gf(a?"microphone_unmute":"microphone_mute")}}}return null}_getExpandButton(e,t){return{icon:t?"mdi:arrow-collapse-all":"mdi:arrow-expand-all",...e.menu.buttons.expand,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.expand"),tap_action:gf("expand"),style:t?this._getEmphasizedStyle():{}}}_getFullscreenButton(e,t){return vb()?null:{icon:t?"mdi:fullscreen-exit":"mdi:fullscreen",...e.menu.buttons.fullscreen,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.fullscreen"),tap_action:gf("fullscreen"),style:t?this._getEmphasizedStyle():{}}}_getCastButton(e,t,n,a,i){if(!a)return null;const r=n.getStore().getCameraConfig(a.camera);if(i?.hasMediaPlayers()&&(a.isViewerView()||a.is("live")&&r?.camera_entity)){const n=i.getMediaPlayers().map((t=>{const n=Nb(e,t)||t,a=e.states[t],i=_f(t,"play"),r=_f(t,"stop"),o=!a||"unavailable"===a.state;return{enabled:!0,selected:!1,icon:Fb(e,t),entity:t,state_color:!1,title:n,disabled:o,...!o&&i&&{tap_action:i},...!o&&r&&{hold_action:r}}}));return{icon:"mdi:cast",...t.menu.buttons.media_player,type:"custom:frigate-card-menu-submenu",title:V_("config.menu.buttons.media_player"),items:n}}return null}_getPlayPauseButton(e,t){if(t&&t.player&&t.capabilities?.supportsPause){const n=t.player.isPaused();return{icon:n?"mdi:play":"mdi:pause",...e.menu.buttons.play,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.play"),tap_action:gf(n?"play":"pause")}}return null}_getMuteUnmuteButton(e,t){if(t&&t.player&&t?.capabilities?.hasAudio){const n=t.player.isMuted();return{icon:n?"mdi:volume-off":"mdi:volume-high",...e.menu.buttons.mute,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.mute"),tap_action:gf(n?"unmute":"mute")}}return null}_getScreenshotButton(e,t){return t&&t.player?{icon:"mdi:monitor-screenshot",...e.menu.buttons.screenshot,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.screenshot"),tap_action:gf("screenshot")}:null}_getDisplayModeButton(e,t,n){const a=n?gx(t,n.view):null;if(n?.supportsMultipleDisplayModes()&&a&&a.size>1){const t=n.isGrid();return{icon:t?"mdi:grid-off":"mdi:grid",...e.menu.buttons.display_mode,style:t?this._getEmphasizedStyle():{},type:"custom:frigate-card-menu-icon",title:V_(t?"display_modes.single":"display_modes.grid"),tap_action:(i=t?"single":"grid",{action:"fire-dom-event",frigate_card_action:"display_mode_select",display_mode:i,...r?.cardID&&{card_id:r.cardID}})}}var i,r;return null}_getPTZControlsButton(e,t,n){const a=n?.is("live")?e.live.controls.ptz:n?.isViewerView()?e.media_viewer.controls.ptz:null;if(!n||!a||"off"===a.mode)return null;const i=Ry(n,{cameraManager:t,..."auto"===a.mode&&{type:"ptz"}});if(i){const t=!1!==n.context?.ptzControls?.enabled&&("on"===a.mode||"auto"===a.mode&&"ptz"===i.type);return{icon:"mdi:pan",...e.menu.buttons.ptz_controls,style:t?this._getEmphasizedStyle():{},type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.ptz_controls"),tap_action:(r=!t,{action:"fire-dom-event",frigate_card_action:"ptz_controls",enabled:r,...o?.cardID&&{card_id:o.cardID}})}}var r,o;return null}_getPTZHomeButton(e,t,n){const a=n?Ry(n,{cameraManager:t}):null;return!a||(("digital"===a.type&&n?.context?.zoom?.[a.targetID]?.observed?.isDefault)??1)?null:{icon:"mdi:home",...e.menu.buttons.ptz_home,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.ptz_home"),tap_action:vf({targetID:a.targetID})}}_getEmphasizedStyle(e){return e?{animation:"pulse 3s infinite",color:"var(--error-color, white)"}:{color:"var(--primary-color, white)"}}_getStyleFromActions(e,t,n){for(const a of[t.tap_action,t.double_tap_action,t.hold_action,t.start_tap_action,t.end_tap_action]){const t=Array.isArray(a)?a:[a];for(const a of t){if(!a||"fire-dom-event"!==a.action||!("frigate_card_action"in a))continue;const t=a;if(Zs.some((e=>e===t.frigate_card_action&&n?.view?.is(t.frigate_card_action)))||"default"===t.frigate_card_action&&n?.view?.is(e.view.default)||"fullscreen"===t.frigate_card_action&&n?.inFullscreenMode||"camera_select"===t.frigate_card_action&&n?.view?.camera===t.camera)return this._getEmphasizedStyle()}}return{}}} +/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */ +function Tx(e){return null==e}var jx=function(e,t){var n,a="";for(n=0;ns&&(t=a-s+(r=" ... ").length),n-a>s&&(n=a+s-(o=" ...").length),{str:r+e.slice(t,n).replace(/\t/g,"→")+o,pos:a-t+r.length}}function Nx(e,t){return Ox.repeat(" ",t-e.length)+e}var Fx=function(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),"number"!=typeof t.indent&&(t.indent=1),"number"!=typeof t.linesBefore&&(t.linesBefore=3),"number"!=typeof t.linesAfter&&(t.linesAfter=2);for(var n,a=/\r?\n|\r|\0/g,i=[0],r=[],o=-1;n=a.exec(e.buffer);)r.push(n.index),i.push(n.index+n[0].length),e.position<=n.index&&o<0&&(o=i.length-2);o<0&&(o=i.length-1);var s,c,l="",d=Math.min(e.line+t.linesAfter,r.length).toString().length,u=t.maxLength-(t.indent+d+3);for(s=1;s<=t.linesBefore&&!(o-s<0);s++)c=Lx(e.buffer,i[o-s],r[o-s],e.position-(i[o]-i[o-s]),u),l=Ox.repeat(" ",t.indent)+Nx((e.line-s+1).toString(),d)+" | "+c.str+"\n"+l;for(c=Lx(e.buffer,i[o],r[o],e.position,u),l+=Ox.repeat(" ",t.indent)+Nx((e.line+1).toString(),d)+" | "+c.str+"\n",l+=Ox.repeat("-",t.indent+d+3+c.pos)+"^\n",s=1;s<=t.linesAfter&&!(o+s>=r.length);s++)c=Lx(e.buffer,i[o+s],r[o+s],e.position-(i[o]-i[o+s]),u),l+=Ox.repeat(" ",t.indent)+Nx((e.line+s+1).toString(),d)+" | "+c.str+"\n";return l.replace(/\n$/,"")},Vx=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],Hx=["scalar","sequence","mapping"];var Bx=function(e,t){if(t=t||{},Object.keys(t).forEach((function(t){if(-1===Vx.indexOf(t))throw new Px('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')})),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=function(e){var t={};return null!==e&&Object.keys(e).forEach((function(n){e[n].forEach((function(e){t[String(e)]=n}))})),t}(t.styleAliases||null),-1===Hx.indexOf(this.kind))throw new Px('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')};function qx(e,t){var n=[];return e[t].forEach((function(e){var t=n.length;n.forEach((function(n,a){n.tag===e.tag&&n.kind===e.kind&&n.multi===e.multi&&(t=a)})),n[t]=e})),n}function Ux(e){return this.extend(e)}Ux.prototype.extend=function(e){var t=[],n=[];if(e instanceof Bx)n.push(e);else if(Array.isArray(e))n=n.concat(e);else{if(!e||!Array.isArray(e.implicit)&&!Array.isArray(e.explicit))throw new Px("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit))}t.forEach((function(e){if(!(e instanceof Bx))throw new Px("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(e.loadKind&&"scalar"!==e.loadKind)throw new Px("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(e.multi)throw new Px("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")})),n.forEach((function(e){if(!(e instanceof Bx))throw new Px("Specified list of YAML types (or a single Type object) contains a non-Type object.")}));var a=Object.create(Ux.prototype);return a.implicit=(this.implicit||[]).concat(t),a.explicit=(this.explicit||[]).concat(n),a.compiledImplicit=qx(a,"implicit"),a.compiledExplicit=qx(a,"explicit"),a.compiledTypeMap=function(){var e,t,n={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function a(e){e.multi?(n.multi[e.kind].push(e),n.multi.fallback.push(e)):n[e.kind][e.tag]=n.fallback[e.tag]=e}for(e=0,t=arguments.length;e=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),aC=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var iC=/^[-+]?[0-9]+e/;var rC=new Bx("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!aC.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||Ox.isNegativeZero(e))},represent:function(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(Ox.isNegativeZero(e))return"-0.0";return n=e.toString(10),iC.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"}),oC=Yx.extend({implicit:[Kx,Xx,nC,rC]}),sC=oC,cC=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),lC=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");var dC=new Bx("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==cC.exec(e)||null!==lC.exec(e))},construct:function(e){var t,n,a,i,r,o,s,c,l=0,d=null;if(null===(t=cC.exec(e))&&(t=lC.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],a=+t[2]-1,i=+t[3],!t[4])return new Date(Date.UTC(n,a,i));if(r=+t[4],o=+t[5],s=+t[6],t[7]){for(l=t[7].slice(0,3);l.length<3;)l+="0";l=+l}return t[9]&&(d=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(d=-d)),c=new Date(Date.UTC(n,a,i,r,o,s,l)),d&&c.setTime(c.getTime()-d),c},instanceOf:Date,represent:function(e){return e.toISOString()}});var uC=new Bx("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}}),hC="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";var pC=new Bx("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,a=0,i=e.length,r=hC;for(n=0;n64)){if(t<0)return!1;a+=6}return a%8==0},construct:function(e){var t,n,a=e.replace(/[\r\n=]/g,""),i=a.length,r=hC,o=0,s=[];for(t=0;t>16&255),s.push(o>>8&255),s.push(255&o)),o=o<<6|r.indexOf(a.charAt(t));return 0===(n=i%4*6)?(s.push(o>>16&255),s.push(o>>8&255),s.push(255&o)):18===n?(s.push(o>>10&255),s.push(o>>2&255)):12===n&&s.push(o>>4&255),new Uint8Array(s)},predicate:function(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)},represent:function(e){var t,n,a="",i=0,r=e.length,o=hC;for(t=0;t>18&63],a+=o[i>>12&63],a+=o[i>>6&63],a+=o[63&i]),i=(i<<8)+e[t];return 0===(n=r%3)?(a+=o[i>>18&63],a+=o[i>>12&63],a+=o[i>>6&63],a+=o[63&i]):2===n?(a+=o[i>>10&63],a+=o[i>>4&63],a+=o[i<<2&63],a+=o[64]):1===n&&(a+=o[i>>2&63],a+=o[i<<4&63],a+=o[64],a+=o[64]),a}}),mC=Object.prototype.hasOwnProperty,gC=Object.prototype.toString;var fC=new Bx("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,a,i,r,o=[],s=e;for(t=0,n=s.length;t>10),56320+(e-65536&1023))}for(var UC=new Array(256),WC=new Array(256),ZC=0;ZC<256;ZC++)UC[ZC]=BC(ZC)?1:0,WC[ZC]=BC(ZC);function QC(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||wC,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function GC(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=Fx(n),new Px(t,n)}function YC(e,t){throw GC(e,t)}function KC(e,t){e.onWarning&&e.onWarning.call(null,GC(e,t))}var XC={YAML:function(e,t,n){var a,i,r;null!==e.version&&YC(e,"duplication of %YAML directive"),1!==n.length&&YC(e,"YAML directive accepts exactly one argument"),null===(a=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&YC(e,"ill-formed argument of the YAML directive"),i=parseInt(a[1],10),r=parseInt(a[2],10),1!==i&&YC(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=r<2,1!==r&&2!==r&&KC(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var a,i;2!==n.length&&YC(e,"TAG directive accepts exactly two arguments"),a=n[0],i=n[1],jC.test(a)||YC(e,"ill-formed tag handle (first argument) of the TAG directive"),xC.call(e.tagMap,a)&&YC(e,'there is a previously declared suffix for "'+a+'" tag handle'),OC.test(i)||YC(e,"ill-formed tag prefix (second argument) of the TAG directive");try{i=decodeURIComponent(i)}catch(t){YC(e,"tag prefix is malformed: "+i)}e.tagMap[a]=i}};function JC(e,t,n,a){var i,r,o,s;if(t1&&(e.result+=Ox.repeat("\n",t-1))}function oM(e,t){var n,a,i=e.tag,r=e.anchor,o=[],s=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=o),a=e.input.charCodeAt(e.position);0!==a&&(-1!==e.firstTabInLine&&(e.position=e.firstTabInLine,YC(e,"tab characters must not be used in indentation")),45===a)&&LC(e.input.charCodeAt(e.position+1));)if(s=!0,e.position++,aM(e,!0,-1)&&e.lineIndent<=t)o.push(null),a=e.input.charCodeAt(e.position);else if(n=e.line,lM(e,t,kC,!1,!0),o.push(e.result),aM(e,!0,-1),a=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==a)YC(e,"bad indentation of a sequence entry");else if(e.lineIndentt?m=1:e.lineIndent===t?m=0:e.lineIndentt?m=1:e.lineIndent===t?m=0:e.lineIndentt)&&(_&&(o=e.line,s=e.lineStart,c=e.position),lM(e,t,SC,!0,i)&&(_?g=e.result:f=e.result),_||(tM(e,h,p,m,g,f,o,s,c),m=g=f=null),aM(e,!0,-1),l=e.input.charCodeAt(e.position)),(e.line===r||e.lineIndent>t)&&0!==l)YC(e,"bad indentation of a mapping entry");else if(e.lineIndent=0))break;0===i?YC(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):c?YC(e,"repeat of an indentation width identifier"):(l=t+i-1,c=!0)}if(PC(r)){do{r=e.input.charCodeAt(++e.position)}while(PC(r));if(35===r)do{r=e.input.charCodeAt(++e.position)}while(!RC(r)&&0!==r)}for(;0!==r;){for(nM(e),e.lineIndent=0,r=e.input.charCodeAt(e.position);(!c||e.lineIndentl&&(l=e.lineIndent),RC(r))d++;else{if(e.lineIndent0){for(i=o,r=0;i>0;i--)(o=FC(s=e.input.charCodeAt(++e.position)))>=0?r=(r<<4)+o:YC(e,"expected hexadecimal character");e.result+=qC(r),e.position++}else YC(e,"unknown escape sequence");n=a=e.position}else RC(s)?(JC(e,n,a,!0),rM(e,aM(e,!1,t)),n=a=e.position):e.position===e.lineStart&&iM(e)?YC(e,"unexpected end of the document within a double quoted scalar"):(e.position++,a=e.position)}YC(e,"unexpected end of the stream within a double quoted scalar")}(e,h)?f=!0:!function(e){var t,n,a;if(42!==(a=e.input.charCodeAt(e.position)))return!1;for(a=e.input.charCodeAt(++e.position),t=e.position;0!==a&&!LC(a)&&!NC(a);)a=e.input.charCodeAt(++e.position);return e.position===t&&YC(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),xC.call(e.anchorMap,n)||YC(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],aM(e,!0,-1),!0}(e)?function(e,t,n){var a,i,r,o,s,c,l,d,u=e.kind,h=e.result;if(LC(d=e.input.charCodeAt(e.position))||NC(d)||35===d||38===d||42===d||33===d||124===d||62===d||39===d||34===d||37===d||64===d||96===d)return!1;if((63===d||45===d)&&(LC(a=e.input.charCodeAt(e.position+1))||n&&NC(a)))return!1;for(e.kind="scalar",e.result="",i=r=e.position,o=!1;0!==d;){if(58===d){if(LC(a=e.input.charCodeAt(e.position+1))||n&&NC(a))break}else if(35===d){if(LC(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&iM(e)||n&&NC(d))break;if(RC(d)){if(s=e.line,c=e.lineStart,l=e.lineIndent,aM(e,!1,-1),e.lineIndent>=t){o=!0,d=e.input.charCodeAt(e.position);continue}e.position=r,e.line=s,e.lineStart=c,e.lineIndent=l;break}}o&&(JC(e,i,r,!1),rM(e,e.line-s),i=r=e.position,o=!1),PC(d)||(r=e.position+1),d=e.input.charCodeAt(++e.position)}return JC(e,i,r,!1),!!e.result||(e.kind=u,e.result=h,!1)}(e,h,CC===n)&&(f=!0,null===e.tag&&(e.tag="?")):(f=!0,null===e.tag&&null===e.anchor||YC(e,"alias node should not have any properties")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===m&&(f=s&&oM(e,p))),null===e.tag)null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);else if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&YC(e,'unacceptable node kind for ! tag; it should be "scalar", not "'+e.kind+'"'),c=0,l=e.implicitTypes.length;c"),null!==e.result&&u.kind!==e.kind&&YC(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+u.kind+'", not "'+e.kind+'"'),u.resolve(e.result,e.tag)?(e.result=u.construct(e.result,e.tag),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):YC(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||f}function dM(e){var t,n,a,i,r=e.position,o=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);0!==(i=e.input.charCodeAt(e.position))&&(aM(e,!0,-1),i=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==i));){for(o=!0,i=e.input.charCodeAt(++e.position),t=e.position;0!==i&&!LC(i);)i=e.input.charCodeAt(++e.position);for(a=[],(n=e.input.slice(t,e.position)).length<1&&YC(e,"directive name must not be less than one character in length");0!==i;){for(;PC(i);)i=e.input.charCodeAt(++e.position);if(35===i){do{i=e.input.charCodeAt(++e.position)}while(0!==i&&!RC(i));break}if(RC(i))break;for(t=e.position;0!==i&&!LC(i);)i=e.input.charCodeAt(++e.position);a.push(e.input.slice(t,e.position))}0!==i&&nM(e),xC.call(XC,n)?XC[n](e,n,a):KC(e,'unknown document directive "'+n+'"')}aM(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,aM(e,!0,-1)):o&&YC(e,"directives end mark is expected"),lM(e,e.lineIndent-1,SC,!1,!0),aM(e,!0,-1),e.checkLineBreaks&&IC.test(e.input.slice(r,e.position))&&KC(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&iM(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,aM(e,!0,-1)):e.position=55296&&a<=56319&&t+1=56320&&n<=57343?1024*(a-55296)+n-56320+65536:a}function ek(e){return/^\n* /.test(e)}var tk=1,nk=2,ak=3,ik=4,rk=5;function ok(e,t,n,a,i,r,o,s){var c,l=0,d=null,u=!1,h=!1,p=-1!==a,m=-1,g=function(e){return YM(e)&&e!==gM&&!GM(e)&&e!==$M&&e!==TM&&e!==AM&&e!==EM&&e!==OM&&e!==DM&&e!==PM&&e!==NM&&e!==xM&&e!==MM&&e!==SM&&e!==bM&&e!==LM&&e!==zM&&e!==IM&&e!==kM&&e!==wM&&e!==CM&&e!==jM&&e!==RM}(JM(e,0))&&function(e){return!GM(e)&&e!==AM}(JM(e,e.length-1));if(t||o)for(c=0;c=65536?c+=2:c++){if(!YM(l=JM(e,c)))return rk;g=g&&XM(l,d,s),d=l}else{for(c=0;c=65536?c+=2:c++){if((l=JM(e,c))===_M)u=!0,p&&(h=h||c-m-1>a&&" "!==e[m+1],m=c);else if(!YM(l))return rk;g=g&&XM(l,d,s),d=l}h=h||p&&c-m-1>a&&" "!==e[m+1]}return u||h?n>9&&ek(e)?rk:o?r===UM?rk:nk:h?ik:ak:!g||o||i(e)?r===UM?rk:nk:tk}function sk(e,t,n,a,i){e.dump=function(){if(0===t.length)return e.quotingType===UM?'""':"''";if(!e.noCompatMode&&(-1!==VM.indexOf(t)||HM.test(t)))return e.quotingType===UM?'"'+t+'"':"'"+t+"'";var r=e.indent*Math.max(1,n),o=-1===e.lineWidth?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-r),s=a||e.flowLevel>-1&&n>=e.flowLevel;switch(ok(t,s,e.indent,o,(function(t){return function(e,t){var n,a;for(n=0,a=e.implicitTypes.length;n"+ck(t,e.indent)+lk(ZM(function(e,t){var n,a,i=/(\n+)([^\n]*)/g,r=(s=e.indexOf("\n"),s=-1!==s?s:e.length,i.lastIndex=s,dk(e.slice(0,s),t)),o="\n"===e[0]||" "===e[0];var s;for(;a=i.exec(e);){var c=a[1],l=a[2];n=" "===l[0],r+=c+(o||n||""===l?"":"\n")+dk(l,t),o=n}return r}(t,o),r));case rk:return'"'+function(e){for(var t,n="",a=0,i=0;i=65536?i+=2:i++)a=JM(e,i),!(t=FM[a])&&YM(a)?(n+=e[i],a>=65536&&(n+=e[i+1])):n+=t||BM(a);return n}(t)+'"';default:throw new Px("impossible error: invalid scalar style")}}()}function ck(e,t){var n=ek(e)?String(t):"",a="\n"===e[e.length-1];return n+(a&&("\n"===e[e.length-2]||"\n"===e)?"+":a?"":"-")+"\n"}function lk(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function dk(e,t){if(""===e||" "===e[0])return e;for(var n,a,i=/ [^ ]/g,r=0,o=0,s=0,c="";n=i.exec(e);)(s=n.index)-r>t&&(a=o>r?o:s,c+="\n"+e.slice(r,a),r=a+1),o=s;return c+="\n",e.length-r>t&&o>r?c+=e.slice(r,o)+"\n"+e.slice(o+1):c+=e.slice(r),c.slice(1)}function uk(e,t,n,a){var i,r,o,s="",c=e.tag;for(i=0,r=n.length;i tag resolver accepts not "'+c+'" style');a=s.represent[c](t,c)}e.dump=a}return!0}return!1}function pk(e,t,n,a,i,r,o){e.tag=null,e.dump=n,hk(e,n,!1)||hk(e,n,!0);var s,c=pM.call(e.dump),l=a;a&&(a=e.flowLevel<0||e.flowLevel>t);var d,u,h="[object Object]"===c||"[object Array]"===c;if(h&&(u=-1!==(d=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||u||2!==e.indent&&t>0)&&(i=!1),u&&e.usedDuplicates[d])e.dump="*ref_"+d;else{if(h&&u&&!e.usedDuplicates[d]&&(e.usedDuplicates[d]=!0),"[object Object]"===c)a&&0!==Object.keys(e.dump).length?(!function(e,t,n,a){var i,r,o,s,c,l,d="",u=e.tag,h=Object.keys(n);if(!0===e.sortKeys)h.sort();else if("function"==typeof e.sortKeys)h.sort(e.sortKeys);else if(e.sortKeys)throw new Px("sortKeys must be a boolean or a function");for(i=0,r=h.length;i1024)&&(e.dump&&_M===e.dump.charCodeAt(0)?l+="?":l+="? "),l+=e.dump,c&&(l+=QM(e,t)),pk(e,t+1,s,!0,c)&&(e.dump&&_M===e.dump.charCodeAt(0)?l+=":":l+=": ",d+=l+=e.dump));e.tag=u,e.dump=d||"{}"}(e,t,e.dump,i),u&&(e.dump="&ref_"+d+e.dump)):(!function(e,t,n){var a,i,r,o,s,c="",l=e.tag,d=Object.keys(n);for(a=0,i=d.length;a1024&&(s+="? "),s+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),pk(e,t,o,!1,!1)&&(c+=s+=e.dump));e.tag=l,e.dump="{"+c+"}"}(e,t,e.dump),u&&(e.dump="&ref_"+d+" "+e.dump));else if("[object Array]"===c)a&&0!==e.dump.length?(e.noArrayIndent&&!o&&t>0?uk(e,t-1,e.dump,i):uk(e,t,e.dump,i),u&&(e.dump="&ref_"+d+e.dump)):(!function(e,t,n){var a,i,r,o="",s=e.tag;for(a=0,i=n.length;a",e.dump=s+" "+e.dump)}return!0}function mk(e,t){var n,a,i=[],r=[];for(gk(e,i,r),n=0,a=r.length;nq`
${_k.dump(e)}
`;return q`
+
+
+ +
+
+ + ${this.message?q`${this.message}${this.context&&"string"==typeof this.context?": "+this.context:""}`:""} + + ${this.context&&Array.isArray(this.context)?this.context.map((e=>n(e))):"object"==typeof this.context?n(this.context):""} +
+
+
`}static get styles(){return o(vk)}};e([he({attribute:!1})],yk.prototype,"message",void 0),e([he({attribute:!1})],yk.prototype,"context",void 0),e([he({attribute:!1})],yk.prototype,"icon",void 0),e([he({attribute:!0,type:Boolean})],yk.prototype,"dotdotdot",void 0),yk=e([le("frigate-card-message")],yk);let bk=class extends se{render(){if(this.message)return q` ${V_("error.troubleshooting")}.`} + .icon=${this.message.icon??"mdi:alert-circle"} + .context=${this.message.context} + .dotdotdot=${this.message.dotdotdot} + > + `}static get styles(){return o(vk)}};e([he({attribute:!1})],bk.prototype,"message",void 0),bk=e([le("frigate-card-error-message")],bk);let wk=class extends se{constructor(){super(...arguments),this.message="",this.animated=!1,this.size="large"}render(){return q`
+ ${this.animated?q` + `:q``} + ${this.message?q`${this.message}`:q``} +
`}static get styles(){return o(vk)}};function xk(e){return"error"===e?.type?q` `:e?q` `:q``}function Ck(e){return q` + + + `}function Mk(e,t,n,a){Bg(e,"message",{message:t,type:n,icon:a?.icon,context:a?.context})}function kk(e,t,n){Mk(e,t,"error",{context:n?.context})}function Sk(e,t){t instanceof Error&&kk(e,t.message,{...t instanceof zs&&{context:t.context}})}e([he({attribute:!1})],wk.prototype,"message",void 0),e([he({attribute:!1})],wk.prototype,"animated",void 0),e([he({attribute:!1})],wk.prototype,"size",void 0),wk=e([le("frigate-card-progress-indicator")],wk);let Ek=class extends se{constructor(){super(...arguments),this._root=null}createRenderRoot(){return this}_createRoot(){const e=customElements.get("hui-conditional-element");if(!e||!this.hass)throw new Error(V_("error.could_not_render_elements"));const t=new e;t.hass=this.hass;const n={type:"conditional",conditions:[],elements:this.elements};try{t.setConfig(n)}catch(e){throw Gg(e,console.error),new zs(V_("error.invalid_elements_config"))}return t}willUpdate(e){try{!this.elements||this._root&&!e.has("elements")||(this._root=this._createRoot())}catch(e){return Sk(this,e)}}render(){return q`${this._root||""}`}updated(){this.hass&&this._root&&(this._root.hass=this.hass)}};e([he({attribute:!1})],Ek.prototype,"elements",void 0),e([he({attribute:!1})],Ek.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],Ek.prototype,"hass",void 0),Ek=e([le("frigate-card-elements-core")],Ek);let $k=class extends se{constructor(){super(...arguments),this._menuRemoveHandler=e=>{Bg(this,"menu:remove",e.detail)},this._statusBarRemoveHandler=e=>{Bg(this,"status-bar:remove",e.detail)},this._menuAddHandler=e=>{const t=e.composedPath();t.length&&this._addHandler(t[0],"frigate-card:menu:remove",this._menuRemoveHandler)},this._statusBarAddHandler=e=>{const t=e.composedPath();t.length&&this._addHandler(t[0],"frigate-card:status-bar:add",this._statusBarRemoveHandler)}}_addHandler(e,t,n){e.removeEventListener(t,n),e.addEventListener(t,n)}connectedCallback(){super.connectedCallback(),this.addEventListener("frigate-card:menu:add",this._menuAddHandler),this.addEventListener("frigate-card:status-bar:add",this._statusBarAddHandler)}disconnectedCallback(){this.removeEventListener("frigate-card:menu:add",this._menuAddHandler),this.addEventListener("frigate-card:status-bar:add",this._statusBarAddHandler),super.disconnectedCallback()}render(){return q` + `}static get styles(){return o(":host {\n position: absolute;\n inset: 0;\n overflow: hidden;\n pointer-events: none;\n}\n\n.element {\n position: absolute;\n transform: translate(-50%, -50%);\n pointer-events: auto;\n}\n\nhui-error-card.element {\n inset: 0px;\n transform: unset;\n}")}};e([he({attribute:!1})],$k.prototype,"hass",void 0),e([he({attribute:!1})],$k.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],$k.prototype,"elements",void 0),$k=e([le("frigate-card-elements")],$k);let Ak=class extends se{setConfig(e){this._config=e}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.className=""}render(){if(function(e,t){if(!t)return!0;const n=new vw(t,{bubbles:!0,composed:!0});return e.dispatchEvent(n),n.evaluation??!1}(this,this._config?.conditions))return q` + `}};e([he({attribute:!1,hasChanged:()=>!0})],Ak.prototype,"hass",void 0),Ak=e([le("frigate-card-conditional")],Ak);class zk extends se{constructor(e){super(),this._config=null,this._eventCategory=e}setConfig(e){this._config=e}connectedCallback(){super.connectedCallback(),this._config&&Bg(this,`${this._eventCategory}:add`,this._config)}disconnectedCallback(){this._config&&Bg(this,`${this._eventCategory}:remove`,this._config),super.disconnectedCallback()}}e([pe()],zk.prototype,"_config",void 0);class Ik extends zk{constructor(){super("menu")}}let Tk=class extends Ik{};Tk=e([le("frigate-card-menu-icon")],Tk);let jk=class extends Ik{};jk=e([le("frigate-card-menu-state-icon")],jk);let Ok=class extends Ik{};Ok=e([le("frigate-card-menu-submenu")],Ok);let Dk=class extends Ik{};Dk=e([le("frigate-card-menu-submenu-select")],Dk);class Rk extends zk{constructor(){super("status-bar")}}let Pk=class extends Rk{};Pk=e([le("frigate-card-status-bar-icon")],Pk);let Lk=class extends Rk{};Lk=e([le("frigate-card-status-bar-image")],Lk);let Nk=class extends Rk{};Nk=e([le("frigate-card-status-bar-string")],Nk);let Fk=class extends se{render(){return q` `}static get styles(){return o(":host {\n width: intrinsic;\n height: intrinsic;\n display: flex;\n justify-content: center;\n align-items: center;\n pointer-events: none;\n}\n\nimg {\n width: 10%;\n animation: rotate 8s linear infinite;\n}\n\n@keyframes rotate {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}")}};Fk=e([le("frigate-card-loading")],Fk);const Vk=(e,t)=>{Bg(e,"action:execution-request",t)};class Hk{constructor(e){this._config=null,this._buttons=[],this._expanded=!1,this._host=e}setMenuConfig(e){this._config=e,this._host.style.setProperty("--frigate-card-menu-button-size",`${e.button_size}px`),this._host.setAttribute("data-style",e.style),this._host.setAttribute("data-position",e.position),this._host.setAttribute("data-alignment",e.alignment),this._sortButtons(),this._host.requestUpdate()}getMenuConfig(){return this._config}isExpanded(){return this._expanded}setButtons(e){this._buttons=e,this._sortButtons(),this._host.requestUpdate()}getButtons(e){const t=e=>!this._isHidingMenu()||this._expanded||!!e.permanent;return this._buttons.filter((n=>(e=>!1!==e.enabled)(n)&&(t=>t.alignment===e||"matching"===e&&!t.alignment)(n)&&t(n)))}setExpanded(e){this._expanded=e,of(this._host,e,"expanded"),this._host.requestUpdate()}toggleExpanded(){this.setExpanded(!this._expanded)}actionHandler(e,t){if(e.stopPropagation(),e.detail.config&&(t=e.detail.config),!t)return;const n=e.detail.action,a=yf(n,t);if(!a)return;const i=Wg(a);let r=!1;const o=i.filter((e=>sf(e)&&!this._isUnknownActionMenuToggleAction(e)));if(o.length!=i.length&&(r=!0),o.length&&Vk(this._host,{action:i,config:t}),this._isHidingMenu())if(r)this.setExpanded(!this._expanded);else{const e=yf("hold",t),a=yf("double_tap",t),i=yf("tap",t),r=yf("end_tap",t);"end_tap"!==n&&("start_tap"!==n||e||a||i||r)&&("end_tap"===n||r)||this.setExpanded(!1)}}getFreshButtonState(e,t){const n={...t};return e&&"custom:frigate-card-menu-state-icon"===t.type?Lb(e,n):n}_sortButtons(){this._buttons=Ev(this._buttons,(e=>(e.priority??0)+(this._isHidingMenu()&&e.permanent?Us:0)),["desc"])}_isHidingMenu(){return"hidden"===this._config?.style}_isUnknownActionMenuToggleAction(e){const t=mf(e);return!!t&&"menu_toggle"==t.frigate_card_action}}var Bk="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' version='1.1' id='svg54' sodipodi:docname='frigate.svg' inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3e %3cdefs id='defs58' /%3e %3csodipodi:namedview id='namedview56' pagecolor='%23da4040' bordercolor='%23666666' borderopacity='1.0' inkscape:pageshadow='2' inkscape:pageopacity='0' inkscape:pagecheckerboard='0' showgrid='false' width='24px' inkscape:zoom='45.254834' inkscape:cx='-0.03314563' inkscape:cy='9.9768347' inkscape:window-width='3840' inkscape:window-height='1527' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='svg54' showguides='true' inkscape:showpageshadow='2' inkscape:deskcolor='%23d1d1d1' /%3e %3cpath d='m 4.8759466%2c22.743573 c 0.0866%2c0.69274 0.811811%2c1.16359 0.37885%2c1.27183 -0.43297%2c0.10824 -2.32718%2c-3.43665 -2.7601492%2c-4.95202 -0.4329602%2c-1.51538 -0.6764993%2c-3.22017 -0.5682593%2c-4.19434 0.1082301%2c-0.97417 5.7097085%2c-2.48955 5.7097085%2c-2.89545 0%2c-0.4059 -1.81304%2c-0.0271 -1.89422%2c-0.35178 -0.0812%2c-0.32472 1.36925%2c-0.12989 1.75892%2c-0.64945 0.60885%2c-0.81181 1.3800713%2c-0.6765 1.8671505%2c-1.1094696 0.4870902%2c-0.4329599 1.0824089%2c-2.0836399 1.1906589%2c-2.7871996 0.108241%2c-0.70357 -1.0824084%2c-1.51538 -1.4071389%2c-2.05658 -0.3247195%2c-0.54121 0.7035702%2c-0.92005 3.1931099%2c-1.94834 2.48954%2c-1.02829 10.39114%2c-3.30134994 10.49938%2c-3.03074994 0.10824%2c0.27061 -2.59779%2c1.40713994 -4.492%2c2.11069994 -1.89422%2c0.70357 -4.97909%2c2.05658 -4.97909%2c2.43542 0%2c0.37885 0.16236%2c0.67651 0.0541%2c1.54244 -0.10824%2c0.86593 -0.12123%2c1.2702597 -0.32472%2c1.8400997 -0.1353%2c0.37884 -0.2706%2c1.27183 0%2c2.0836295 0.21648%2c0.64945 0.92005%2c1.13653 1.24477%2c1.24478 0.2706%2c0.018 1.01746%2c0.0433 1.8401%2c0 1.02829%2c-0.0541 2.48954%2c0.0541 2.48954%2c0.32472 0%2c0.2706 -2.21894%2c0.10824 -2.21894%2c0.48708 0%2c0.37885 2.27306%2c-0.0541 2.21894%2c0.32473 -0.0541%2c0.37884 -1.89422%2c0.21648 -2.86839%2c0.21648 -0.77933%2c0 -1.93031%2c-0.0361 -2.43542%2c-0.21648 l -0.10824%2c0.37884 c -0.18038%2c0 -0.55744%2c0.10824 -0.94711%2c0.10824 -0.48708%2c0 -0.51414%2c0.16236 -1.40713%2c0.16236 -0.892989%2c0 -0.622391%2c-0.0541 -1.4341894%2c-0.10824 -0.81181%2c-0.0541 -3.842561%2c2.27306 -4.383761%2c3.03075 -0.54121%2c0.75768 -0.21649%2c2.59778 -0.21649%2c3.43665 0%2c0.75379 -0.10824%2c2.43542 0%2c3.30135 z' fill='black' id='path330' style='fill:white%3bfill-opacity:1%3bstroke:none%3bstroke-width:0.1%3bstroke-miterlimit:4%3bstroke-dasharray:none%3bstroke-opacity:1' sodipodi:nodetypes='csccscccccsscscccccsscsccssccscc' /%3e%3c/svg%3e",qk="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3c!-- Created with Inkscape (http://www.inkscape.org/) --%3e%3csvg id='svg2' version='1.1' inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' width='24' height='24' xml:space='preserve' sodipodi:docname='motioneye.svg' inkscape:export-filename='/home/ccrisan/projects/motioneye/static/img/motioneye-logo.png' inkscape:export-xdpi='960' inkscape:export-ydpi='960' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23' xmlns:cc='http://creativecommons.org/ns%23' xmlns:dc='http://purl.org/dc/elements/1.1/'%3e%3cmetadata id='metadata8'%3e%3crdf:RDF%3e%3ccc:Work rdf:about=''%3e%3cdc:format%3eimage/svg%2bxml%3c/dc:format%3e%3cdc:type rdf:resource='http://purl.org/dc/dcmitype/StillImage' /%3e%3c/cc:Work%3e%3c/rdf:RDF%3e%3c/metadata%3e%3cdefs id='defs6'%3e%3clinearGradient inkscape:collect='always' id='linearGradient2058'%3e%3cstop style='stop-color:white%3bstop-opacity:1%3b' offset='0' id='stop2054' /%3e%3cstop style='stop-color:%23585858%3bstop-opacity:1' offset='1' id='stop2056' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' id='linearGradient2005'%3e%3cstop style='stop-color:white%3bstop-opacity:1%3b' offset='0' id='stop2001' /%3e%3cstop style='stop-color:grey%3bstop-opacity:1%3b' offset='1' id='stop2003' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' id='linearGradient4205'%3e%3cstop style='stop-color:%234aa3e0%3bstop-opacity:1' offset='0' id='stop4207' /%3e%3cstop style='stop-color:%233096db%3bstop-opacity:1' offset='1' id='stop4209' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' id='linearGradient4197'%3e%3cstop style='stop-color:white%3bstop-opacity:1%3b' offset='0' id='stop4199' /%3e%3cstop style='stop-color:%23585858%3bstop-opacity:1' offset='1' id='stop4201' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient4205' id='linearGradient4211' x1='26.602072' y1='43.034946' x2='26.602072' y2='29.466328' gradientUnits='userSpaceOnUse' gradientTransform='matrix(0.96428571%2c0%2c0%2c0.96428571%2c0.91428571%2c0.91428571)' /%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4285'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4287' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4289' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.6' result='blur' id='feGaussianBlur4291' /%3e%3cfeOffset dx='0' dy='-1' result='offset' id='feOffset4293' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4295' /%3e%3c/filter%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient2005' id='linearGradient4309' gradientUnits='userSpaceOnUse' x1='26.445793' y1='47.517574' x2='26.445793' y2='3.8183768' /%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient4197' id='linearGradient4311' gradientUnits='userSpaceOnUse' x1='26.445793' y1='47.517574' x2='26.445793' y2='3.8183768' /%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient2058' id='linearGradient4313' gradientUnits='userSpaceOnUse' x1='26.445793' y1='47.517574' x2='26.445793' y2='3.8183768' /%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4315' x='-0.03618178' y='-0.20783284' width='1.0723636' height='1.3304883'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4317' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4319' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.6' result='blur' id='feGaussianBlur4321' /%3e%3cfeOffset dx='0' dy='-1' result='offset' id='feOffset4323' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4325' /%3e%3c/filter%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4327' x='-0.27857143' y='-0.4720238' width='1.5571429' height='1.7505952'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4329' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4331' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.6' result='blur' id='feGaussianBlur4333' /%3e%3cfeOffset dx='0' dy='-1' result='offset' id='feOffset4335' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4337' /%3e%3c/filter%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4339' x='-0.0202507' y='-0.13980794' width='1.0405014' height='1.2082853'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4341' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4343' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.2' result='blur' id='feGaussianBlur4345' /%3e%3cfeOffset dx='0' dy='-0.5' result='offset' id='feOffset4347' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4349' /%3e%3c/filter%3e%3c/defs%3e%3csodipodi:namedview pagecolor='%23ff0d0d' bordercolor='%23666666' borderopacity='1' objecttolerance='10' gridtolerance='10' guidetolerance='10' inkscape:pageopacity='0' inkscape:pageshadow='2' inkscape:window-width='3840' inkscape:window-height='1527' id='namedview4' showgrid='false' inkscape:zoom='29.890116' inkscape:cx='19.973158' inkscape:cy='16.577386' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='g10' showguides='true' inkscape:guide-bbox='true' inkscape:showpageshadow='true' inkscape:pagecheckerboard='false' inkscape:deskcolor='%23d1d1d1' /%3e%3cg id='g10' inkscape:groupmode='layer' inkscape:label='ink_ext_XXXXXX' transform='matrix(1.25%2c0%2c0%2c-1.25%2c0%2c64)'%3e%3cg id='g4823' transform='matrix(1.0344694%2c0%2c0%2c1.0344694%2c-3.551886%2c-0.86695248)'%3e%3cpath id='path4244' d='M 8.9346154%2c40.515385 C 5.3647588%2c36.547307 3.2%2c31.357779 3.2%2c25.6 3.2%2c13.228821 13.228821%2c3.2 25.6%2c3.2 37.971179%2c3.2 48%2c13.228821 48%2c25.6 c 0%2c5.736682 -2.161128%2c10.952493 -5.707692%2c14.915385 -1.695935%2c-0.623286 -3.387833%2c-1.349065 -5.061539%2c-2.288462 3.2394%2c-0.937363 5.6%2c-3.937988 5.6%2c-7.457692 0%2c-4.260339 -3.469626%2c-7.753846 -7.753846%2c-7.753846 -3.633936%2c0 -6.690552%2c2.51055 -7.538461%2c5.869231 h -3.876924 c -0.840685%2c-3.360193 -3.903443%2c-5.869231 -7.538461%2c-5.869231 -4.284219%2c0 -7.7807693%2c3.493507 -7.7807693%2c7.753846 0%2c3.56112 2.4570323%2c6.5856 5.7615383%2c7.484616 -1.676267%2c0.912203 -3.404813%2c1.620556 -5.1692306%2c2.261538 z M 25.6%2c26.461538 c 0.532632%2c-1.981435 1.101793%2c-3.947553 3.446154%2c-5.16923 L 25.6%2c16.123077 22.153846%2c21.292308 c 2.053593%2c1.454966 3.000771%2c3.237758 3.446154%2c5.16923 z' style='fill:url(%23linearGradient4309)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4327)' inkscape:connector-curvature='0' transform='matrix(0.38078533%2c0%2c0%2c0.38078533%2c2.9655495%2c31.335499)' /%3e%3cpath id='path4242' d='m 16.123077%2c33.353847 c -1.427443%2c0 -2.584616%2c-1.157173 -2.584616%2c-2.584616 0%2c-1.427444 1.157173%2c-2.584615 2.584616%2c-2.584615 1.427444%2c0 2.584615%2c1.157171 2.584615%2c2.584615 0%2c1.427443 -1.157171%2c2.584616 -2.584615%2c2.584616 z' style='fill:url(%23linearGradient4311)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4327)' inkscape:connector-curvature='0' transform='matrix(0.38078533%2c0%2c0%2c0.38078533%2c2.9655495%2c31.335499)' /%3e%3cpath id='path4240' d='m 35.076923%2c33.353847 c -1.427443%2c0 -2.584615%2c-1.157173 -2.584615%2c-2.584616 0%2c-1.427444 1.157172%2c-2.584615 2.584615%2c-2.584615 1.427443%2c0 2.584616%2c1.157171 2.584616%2c2.584615 0%2c1.427443 -1.157173%2c2.584616 -2.584616%2c2.584616 z' style='fill:url(%23linearGradient4313)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4327)' inkscape:connector-curvature='0' transform='matrix(0.38078533%2c0%2c0%2c0.38078533%2c2.9655495%2c31.335499)' /%3e%3cpath inkscape:connector-curvature='0' style='fill:%23d9d9d9%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4339)' d='m 25.6%2c47.2 c -4.373944%2c0 -8.437159%2c-1.399808 -11.838461%2c-3.634616 3.677605%2c-0.394237 7.305921%2c-1.342945 11.423077%2c-3.375 4.166157%2c2.122533 8.434154%2c3.008875 12.279808%2c3.452886 C 34.057131%2c45.890032 29.986674%2c47.2 25.6%2c47.2 Z' id='path4248' transform='matrix(0.39488848%2c0%2c0%2c0.39488848%2c2.6045087%2c30.974457)' /%3e%3cpath inkscape:connector-curvature='0' style='fill:url(%23linearGradient4211)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4315)' d='M 39.723077%2c42.552884 C 35.394064%2c42.5242 29.479588%2c40.397223 25.184616%2c38.432418 20.668821%2c40.064102 16.035448%2c42.649343 10.801923%2c42.526924 10.453022%2c42.51873 10.118061%2c42.50105 9.7634616%2c42.475 L 5.6615384%2c42.1375 9.5557693%2c40.839424 c 5.3417977%2c-1.74056 10.0398397%2c-2.851302 14.1749997%2c-10.025963 0.959101%2c0 2.845924%2c-4.15e-4 3.738462%2c-4.15e-4 4.11884%2c7.134039 9.059296%2c8.324614 14.149039%2c10.026378 L 45.460577%2c42.085577 41.4625%2c42.475 c -0.544847%2c0.05181 -1.120992%2c0.08198 -1.739423%2c0.07788 z' id='path4246' sodipodi:nodetypes='cccccccccccc' transform='matrix(0.39488848%2c0%2c0%2c0.39488848%2c2.6045087%2c30.974457)' /%3e%3c/g%3e%3c/g%3e%3c/svg%3e",Uk="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3c!-- Created with Inkscape (http://www.inkscape.org/) --%3e%3csvg version='1.1' id='svg62' width='24' height='24' viewBox='0 0 24 24' sodipodi:docname='reolink.svg' inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3e %3cdefs id='defs66' /%3e %3csodipodi:namedview id='namedview64' pagecolor='%23505050' bordercolor='%23eeeeee' borderopacity='1' inkscape:showpageshadow='0' inkscape:pageopacity='0' inkscape:pagecheckerboard='0' inkscape:deskcolor='%23505050' showgrid='true' inkscape:zoom='36.417984' inkscape:cx='18.191562' inkscape:cy='8.6633022' inkscape:window-width='3840' inkscape:window-height='1527' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='g68'%3e %3cinkscape:grid type='xygrid' id='grid1175' dotted='false' snapvisiblegridlinesonly='true' /%3e %3c/sodipodi:namedview%3e %3cg inkscape:groupmode='layer' inkscape:label='Reolink Logo' id='g68'%3e %3cpath style='fill:white%3bstroke-width:0.0393282%3bfill-opacity:1' d='M 17.037254%2c23.964909 C 16.764634%2c23.917573 16.561708%2c23.83617 16.325735%2c23.67954 16.196719%2c23.593913 14.543544%2c21.952905 12.217956%2c19.602014 10.077426%2c17.438191 8.2198993%2c15.582673 8.0901166%2c15.478642 7.6038998%2c15.088895 7.0877741%2c14.869424 6.4986827%2c14.801908 6.3140805%2c14.780765 5.079061%2c14.763305 3.7541964%2c14.763126 l -2.408845%2c-4.78e-4 0.00713%2c-7.3937713 v -7.3935985 l 6.2040046%2c3.536e-5 c 3.9799342%2c1.969e-5 6.3590882%2c0.01465833 6.6366112%2c0.0408227 2.331195%2c0.21982024 4.364771%2c1.49885914 5.578726%2c3.50085534 0.686043%2c1.1313823 1.020901%2c2.2783695 1.067186%2c3.6554196 0.06335%2c1.8844953 -0.57426%2c3.6597378 -1.831469%2c5.0992438 -0.756457%2c0.866146 -1.861127%2c1.62991 -2.928729%2c2.024919 l -0.319718%2c0.118287 -1.951287%2c-1.979284 -1.951286%2c-1.979278 1.046741%2c-0.02346 c 0.575706%2c-0.01291 1.099833%2c-0.03689 1.164724%2c-0.0533 0.596068%2c-0.150649 0.949703%2c-0.313968 1.322206%2c-0.6106282 0.643573%2c-0.5125401 1.046169%2c-1.2439257 1.137985%2c-2.0673522 0.167852%2c-1.505317 -0.771478%2c-2.8704888 -2.263547%2c-3.2897068 L 13.950001%2c4.3234481 9.7981831%2c4.3106846 5.6392389%2c4.29801 v 3.0692702 3.0692648 l 1.4185165%2c7.9e-4 c 1.6275801%2c8.87e-4 1.7789152%2c0.01912 2.3105245%2c0.27984 0.3095679%2c0.15183 0.389559%2c0.219499 1.0817441%2c0.915083 3.027399%2c3.042274 12.19404%2c12.30837 12.204589%2c12.337002 0.0161%2c0.04373 -5.364393%2c0.03953 -5.617359%2c-0.0045 z' id='path1173' inkscape:label='R' /%3e %3c/g%3e%3c/svg%3e";const Wk=e=>{switch(e){case"frigate":return Bk;case"motioneye":return qk;case"reolink":return Uk;default:return null}};const Zk=(e,t,n)=>{const a=e.states[t],i=n?.state?n.state:a?a.state:null;if(!i)return null;const r=Ye(t),o=a?a.attributes:null;return n?.entity?.translation_key&&e.localize(`component.${n.entity.platform}.entity.${r}.${n.entity.translation_key}.state.${i}`)||o?.device_class&&e.localize(`component.${r}.state.${o.device_class}.${i}`)||e.localize(`component.${r}.state._.${i}`)||i};let Qk=class extends se{_renderItem(e){if(!this.hass)return;const t=Lb(this.hass,{...e});return q` + {t.detail.config=e}} + .actionHandler=${kf({hasHold:bf(e.hold_action),hasDoubleClick:bf(e.double_tap_action)})} + > + ${t.title||""} + ${e.subtitle?q`${e.subtitle}`:""} + ${(e=>{if(e.icon){const t=Wk(e.icon);return t?q``:q` + `}return q``})(t)} + + `}render(){if(!this.submenu)return q``;const e=this.submenu.items;return q` + e.stopPropagation()} + @click=${e=>wf(e)} + > + + + + ${e.map(this._renderItem.bind(this))} + + `}static get styles(){return o("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n pointer-events: auto;\n}\n\nmwc-list-item {\n z-index: 20;\n}")}};e([he({attribute:!1})],Qk.prototype,"hass",void 0),e([he({attribute:!1})],Qk.prototype,"submenu",void 0),Qk=e([le("frigate-card-submenu")],Qk);let Gk=class extends se{shouldUpdate(e){const t=e.get("hass");return!e.has("hass")||!t||!this.submenuSelect||Ob(this.hass,t,[this.submenuSelect.entity])}async _refreshOptionTitles(){if(!this.hass||!this.submenuSelect)return;const e=this.submenuSelect.entity,t=this.hass.states[e],n=t?.attributes?.options,a=await(this.entityRegistryManager?.getEntity(this.hass,e))??null,i={};for(const t of n){const n=Zk(this.hass,e,{...a&&{entity:a},state:t});n&&(i[t]=n)}this._optionTitles=i}willUpdate(){if(!this.submenuSelect||!this.hass)return;this._optionTitles||this._refreshOptionTitles();const e=this.submenuSelect.entity,t=this.hass.states[e],n=t?.attributes?.options;if(!t||!n)return;const a={icon:Ib("select"),...Lb(this.hass,this.submenuSelect),...this.submenuSelect,type:"custom:frigate-card-menu-submenu",items:[]};delete a.options;const i=a.items;for(const a of n){const n=this._optionTitles?.[a]??a;i.push({state_color:!0,selected:t.state===a,enabled:!0,title:n||a,...(e.startsWith("select.")||e.startsWith("input_select."))&&{tap_action:{action:"perform-action",perform_action:e.startsWith("select.")?"select.select_option":"input_select.select_option",target:{entity_id:e},data:{option:a}}},...this.submenuSelect.options&&this.submenuSelect.options[a]})}this._generatedSubmenu=a}render(){return q` `}};e([he({attribute:!1})],Gk.prototype,"hass",void 0),e([he({attribute:!1})],Gk.prototype,"submenuSelect",void 0),e([he({attribute:!1})],Gk.prototype,"entityRegistryManager",void 0),e([pe()],Gk.prototype,"_optionTitles",void 0),Gk=e([le("frigate-card-submenu-select")],Gk);let Yk=class extends se{constructor(){super(...arguments),this._controller=new Hk(this)}set menuConfig(e){this._controller.setMenuConfig(e)}set buttons(e){this._controller.setButtons(e)}set expanded(e){this._controller.setExpanded(e)}toggleMenu(){this._controller.toggleExpanded()}_renderButton(e){if(!this.hass)return;if("custom:frigate-card-menu-submenu"===e.type)return q` this._controller.actionHandler(e)} + > + `;if("custom:frigate-card-menu-submenu-select"===e.type)return q` this._controller.actionHandler(e)} + > + `;const t=this._controller.getFreshButtonState(this.hass,e),n=Wk(t.icon);return q` this._controller.actionHandler(t,e)} + > + ${n?q``:q``} + `}render(){const e=this._controller.getMenuConfig(),t=e?.style;if(!e||"none"===t)return;const n=this._controller.getButtons("matching"),a=this._controller.getButtons("opposing");return q`
+ ${n.map((e=>this._renderButton(e)))} +
+
+ ${a.map((e=>this._renderButton(e)))} +
`}static get styles(){return o('ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n --frigate-card-menu-button-size: 40px;\n --mdc-icon-button-size: var(--frigate-card-menu-button-size);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n pointer-events: auto;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n}\n\n/*******************************************************\n * Non-hover styles should not interact with the pointer\n *******************************************************/\n:host(:not([data-style*=hover])) {\n pointer-events: none;\n}\n\n/***********************************\n * Aligned divs: matching & opposing\n ***********************************/\ndiv.matching,\ndiv.opposing {\n display: flex;\n flex-wrap: wrap;\n flex-direction: row;\n align-items: flex-start;\n min-width: 0px;\n min-height: 0px;\n}\n\ndiv.matching {\n justify-content: flex-start;\n}\n\ndiv.opposing {\n justify-content: flex-end;\n}\n\n/********************\n * Outside menu style\n ********************/\n:host([data-style=outside]) {\n width: 100%;\n background: var(--secondary-background-color);\n}\n\n/********************************************************\n * Hack: Ensure host & div expand for column flex layouts\n ********************************************************/\n:host(:not([data-style=outside])[data-position=left]) {\n writing-mode: vertical-lr;\n}\n\n:host(:not([data-style=outside])[data-position=right]) {\n writing-mode: vertical-rl;\n}\n\n:host(:not([data-style=outside])[data-style=overlay][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style=overlay][data-position=right]) div > *,\n:host(:not([data-style=outside])[data-style*=hover][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style*=hover][data-position=right]) div > *,\n:host(:not([data-style=outside])[data-style=hidden][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style=hidden][data-position=right]) div > * {\n writing-mode: horizontal-tb;\n}\n\n/**********************\n * "Reverse" alignments\n **********************/\n:host(:not([data-style=outside])[data-position=left][data-alignment=bottom]),\n:host(:not([data-style=outside])[data-position=right][data-alignment=bottom]),\n:host([data-position=top][data-alignment=right]),\n:host([data-position=bottom][data-alignment=right]),\n:host(:not([data-style=outside])[data-position=left][data-alignment=bottom]) div,\n:host(:not([data-style=outside])[data-position=right][data-alignment=bottom]) div,\n:host([data-position=top][data-alignment=right]) div,\n:host([data-position=bottom][data-alignment=right]) div {\n flex-direction: row-reverse;\n}\n\n/****************************\n * Wrap upwards on the bottom\n ****************************/\n:host(:not([data-style=outside])[data-position=bottom]) div {\n flex-wrap: wrap-reverse;\n}\n\n/********************************************\n * Positioning for absolute based menu styles\n ********************************************/\n:host([data-style=overlay]),\n:host([data-style*=hover]),\n:host([data-style=hidden]) {\n overflow: hidden;\n width: calc(var(--frigate-card-menu-button-size) + 6px);\n height: calc(var(--frigate-card-menu-button-size) + 6px);\n}\n\n:host([data-style=overlay]),\n:host([data-style*=hover]),\n:host([data-style=hidden][expanded]) {\n overflow: visible;\n}\n\n:host([data-style=overlay][data-position=top]),\n:host([data-style=overlay][data-position=bottom]),\n:host([data-style*=hover][data-position=top]),\n:host([data-style*=hover][data-position=bottom]),\n:host([data-style=hidden][data-position=top]),\n:host([data-style=hidden][data-position=bottom]) {\n width: 100%;\n height: auto;\n}\n\n:host([data-style=overlay][data-position=top][data-alignment=left]),\n:host([data-style=overlay][data-position=bottom][data-alignment=left]),\n:host([data-style*=hover][data-position=top][data-alignment=left]),\n:host([data-style*=hover][data-position=bottom][data-alignment=left]),\n:host([data-style=hidden][data-position=top][data-alignment=left][expanded]),\n:host([data-style=hidden][data-position=bottom][data-alignment=left][expanded]) {\n background: linear-gradient(90deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=top][data-alignment=right]),\n:host([data-style=overlay][data-position=bottom][data-alignment=right]),\n:host([data-style*=hover][data-position=top][data-alignment=right]),\n:host([data-style*=hover][data-position=bottom][data-alignment=right]),\n:host([data-style=hidden][data-position=top][data-alignment=right][expanded]),\n:host([data-style=hidden][data-position=bottom][data-alignment=right][expanded]) {\n background: linear-gradient(270deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=left]),\n:host([data-style=overlay][data-position=right]),\n:host([data-style*=hover][data-position=left]),\n:host([data-style*=hover][data-position=right]),\n:host([data-style=hidden][data-position=left]),\n:host([data-style=hidden][data-position=right]) {\n width: auto;\n height: 100%;\n}\n\n:host([data-style=overlay][data-position=left][data-alignment=top]),\n:host([data-style=overlay][data-position=right][data-alignment=top]),\n:host([data-style*=hover][data-position=left][data-alignment=top]),\n:host([data-style*=hover][data-position=right][data-alignment=top]),\n:host([data-style=hidden][data-position=left][data-alignment=top][expanded]),\n:host([data-style=hidden][data-position=right][data-alignment=top][expanded]) {\n background: linear-gradient(180deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=left][data-alignment=bottom]),\n:host([data-style=overlay][data-position=right][data-alignment=bottom]),\n:host([data-style*=hover][data-position=left][data-alignment=bottom]),\n:host([data-style*=hover][data-position=right][data-alignment=bottom]),\n:host([data-style=hidden][data-position=left][data-alignment=bottom][expanded]),\n:host([data-style=hidden][data-position=right][data-alignment=bottom][expanded]) {\n background: linear-gradient(0deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}')}};e([he({attribute:!1})],Yk.prototype,"entityRegistryManager",void 0),e([he({attribute:!1})],Yk.prototype,"hass",void 0),Yk=e([le("frigate-card-menu")],Yk);let Kk=class extends se{render(){return q` + + + + + `}static get styles(){return o("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n position: absolute;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n\nslot {\n position: absolute;\n display: flex;\n}\n\n/***************\n * Slot position\n ***************/\nslot[name=top] {\n top: 0px;\n}\n\nslot[name=bottom] {\n bottom: 0px;\n}\n\nslot[name=left] {\n left: 0px;\n}\n\nslot[name=right] {\n right: 0px;\n}\n\n/***********\n * Slot size\n ***********/\nslot[name=top],\nslot[name=bottom] {\n width: 100%;\n flex-direction: column;\n}\n\nslot[name=left],\nslot[name=right] {\n height: 100%;\n flex-direction: row;\n}\n\nslot[name=top],\nslot[name=left] {\n justify-content: flex-start;\n}\n\nslot[name=bottom],\nslot[name=right] {\n justify-content: flex-end;\n}\n\n/*******************************\n * Match rounded corners to card\n *******************************/\n::slotted([slot=top]:first-child),\n::slotted([slot=left]:first-child) {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=top]:first-child),\n::slotted([slot=right]:first-child) {\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=bottom]:last-child),\n::slotted([slot=left]:last-child) {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=bottom]:last-child),\n::slotted([slot=right]:last-child) {\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}")}};Kk=e([le("frigate-card-overlay")],Kk);class Xk{constructor(e){this._config=null,this._popupTimer=new xf,this._items=[],this._host=e}getRenderItems(){return this._items}setItems(e){const t=e.filter((e=>!!e.exclusive)),n=Ev(t.length?t:e,(e=>e.priority??50),"desc"),a=this._getSufficientValues(this._items),i=this._getSufficientValues(n);this._items=n,"popup"!==this._config?.style||Dv(a,i)||(this._show(),this._popupTimer.start(this._config.popup_seconds,(()=>this._hide()))),this._host.requestUpdate()}setConfig(e){this._config=e,this._host.style.setProperty("--frigate-card-status-bar-height",`${e.height}px`),this._host.setAttribute("data-style",e.style),this._host.setAttribute("data-position",e.position),"popup"!==this._config?.style&&this._show(),this._host.requestUpdate()}shouldRender(){return this._items.some((e=>!1!==e.enabled&&e.sufficient))}actionHandler(e,t){e.stopPropagation();const n=yf(e.detail.action,t);n&&Vk(this._host,{action:Wg(n),config:t})}_getSufficientValue(e){ +/* istanbul ignore else: cannot happen -- @preserve */ +return"custom:frigate-card-status-bar-icon"===e.type?e.icon:"custom:frigate-card-status-bar-string"===e.type?e.string:"custom:frigate-card-status-bar-image"===e.type?e.image:null}_getSufficientValues(e){return e.filter((e=>!1!==e.enabled&&e.sufficient)).map((e=>this._getSufficientValue(e)))}_show(){of(this._host,!1,"hide")}_hide(){of(this._host,!0,"hide")}}let Jk=class extends se{constructor(){super(...arguments),this._controller=new Xk(this)}willUpdate(e){e.has("config")&&this.config&&this._controller.setConfig(this.config),e.has("items")&&this._controller.setItems(this.items??[])}render(){if(this._controller.shouldRender())return q` +
+ ${this._controller.getRenderItems().map((e=>{if(!1===e.enabled)return;const t=_e({item:!0,expand:!!e.expand,action:!!Object.keys(e.actions??{}).length}),n=kf({hasHold:bf(e.actions?.hold_action),hasDoubleClick:bf(e.actions?.double_tap_action)});if("custom:frigate-card-status-bar-string"===e.type)return q`
this._controller.actionHandler(t,e.actions)} + > + ${e.string} +
`;if("custom:frigate-card-status-bar-icon"===e.type){const a=Wk(e.icon);return a?q`this._controller.actionHandler(t,e.actions)} + />`:q`this._controller.actionHandler(t,e.actions)} + >`}return"custom:frigate-card-status-bar-image"===e.type?q`this._controller.actionHandler(t,e.actions)} + />`:void 0}))} +
+ `}static get styles(){return o("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n --mdc-icon-button-size: calc(var(--frigate-card-status-bar-height) - 6px);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n display: block;\n width: 100%;\n pointer-events: auto;\n opacity: 1;\n transition: opacity 1s;\n}\n\n/*******************************************************\n * Non-hover styles should not interact with the pointer\n *******************************************************/\n:host(:not([data-style*=hover])) {\n pointer-events: none;\n}\n\n/***************\n * Outside style\n ***************/\n:host([data-style=outside]) {\n color: var(--primary-text-color);\n background: var(--secondary-background-color);\n}\n\n/*******************\n * Non-outside style\n *******************/\n:host(:not([data-style=outside])) {\n color: white;\n background: linear-gradient(90deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=popup][hide]) {\n opacity: 0;\n}\n\n/*********************\n * Status bar contents\n *********************/\n.status {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n overflow: hidden;\n width: 100%;\n height: var(--frigate-card-status-bar-height);\n}\n\n.item {\n display: inline-block;\n margin: 3px;\n padding: 3px;\n align-content: center;\n opacity: 0.7;\n}\n\n.item:first-child {\n margin-left: 10px;\n}\n\n.item:last-child {\n margin-right: 10px;\n}\n\n.item.expand {\n flex: 1;\n}\n\n.item.action {\n cursor: pointer;\n}\n\nimg.item {\n width: var(--mdc-icon-size, 24px);\n height: var(--mdc-icon-size, 24px);\n}")}};e([he({attribute:!1})],Jk.prototype,"items",void 0),e([he({attribute:!1})],Jk.prototype,"config",void 0),Jk=e([le("frigate-card-status-bar")],Jk);function eS(e){return"number"==typeof e}function tS(e){return"string"==typeof e}function nS(e){return"boolean"==typeof e}function aS(e){return"[object Object]"===Object.prototype.toString.call(e)}function iS(e){return Math.abs(e)}function rS(e){return Math.sign(e)}function oS(e,t){return iS(e-t)}function sS(e){return hS(e).map(Number)}function cS(e){return e[lS(e)]}function lS(e){return Math.max(0,e.length-1)}function dS(e,t){return t===lS(e)}function uS(e,t=0){return Array.from(Array(e),((e,n)=>t+n))}function hS(e){return Object.keys(e)}function pS(e,t){return[e,t].reduce(((e,t)=>(hS(t).forEach((n=>{const a=e[n],i=t[n],r=aS(a)&&aS(i);e[n]=r?pS(a,i):i})),e)),{})}function mS(e,t){return void 0!==t.MouseEvent&&e instanceof t.MouseEvent}function gS(){let e=[];const t={add:function(n,a,i,r={passive:!0}){let o;if("addEventListener"in n)n.addEventListener(a,i,r),o=()=>n.removeEventListener(a,i,r);else{const e=n;e.addListener(i),o=()=>e.removeListener(i)}return e.push(o),t},clear:function(){e=e.filter((e=>e()))}};return t}function fS(e,t,n,a){const i=gS(),r=1e3/60;let o=null,s=0,c=0;function l(e){if(!c)return;o||(o=e);const i=e-o;for(o=e,s+=i;s>=r;)n(r),s-=r;a(s/r),c&&t.requestAnimationFrame(l)}function d(){t.cancelAnimationFrame(c),o=null,s=0,c=0}return{init:function(){i.add(e,"visibilitychange",(()=>{e.hidden&&(o=null,s=0)}))},destroy:function(){d(),i.clear()},start:function(){c||(c=t.requestAnimationFrame(l))},stop:d,update:()=>n(r),render:a}}function _S(e=0,t=0){const n=iS(e-t);function a(t){return tt}function r(e){return a(e)||i(e)}const o={length:n,max:t,min:e,constrain:function(n){return r(n)?a(n)?e:t:n},reachedAny:r,reachedMax:i,reachedMin:a,removeOffset:function(e){return n?e-n*Math.ceil((e-t)/n):e}};return o}function vS(e,t,n){const{constrain:a}=_S(0,e),i=e+1;let r=o(t);function o(e){return n?iS((i+e)%i):a(e)}function s(){return r}function c(){return vS(e,s(),n)}const l={get:s,set:function(e){return r=o(e),l},add:function(e){return c().set(s()+e)},clone:c};return l}function yS(e,t,n,a,i,r,o,s,c,l,d,u,h,p,m,g,f,_,v){const{cross:y,direction:b}=e,w=["INPUT","SELECT","TEXTAREA"],x={passive:!1},C=gS(),M=gS(),k=_S(50,225).constrain(p.measure(20)),S={mouse:300,touch:400},E={mouse:500,touch:600},$=m?43:25;let A=!1,z=0,I=0,T=!1,j=!1,O=!1,D=!1;function R(e){if(!mS(e,a)&&e.touches.length>=2)return P(e);const t=r.readPoint(e),n=r.readPoint(e,y),o=oS(t,z),c=oS(n,I);if(!j&&!D){if(!e.cancelable)return P(e);if(j=o>c,!j)return P(e)}const d=r.pointerMove(e);o>g&&(O=!0),l.useFriction(.3).useDuration(.75),s.start(),i.add(b(d)),e.preventDefault()}function P(e){const t=d.byDistance(0,!1).index!==u.get(),n=r.pointerUp(e)*(m?E:S)[D?"mouse":"touch"],a=function(e,t){const n=u.add(-1*rS(e)),a=d.byDistance(e,!m).distance;return m||iS(e)=2,s&&0!==e.button)return;if(function(e){const t=e.nodeName||"";return w.includes(t)}(e.target))return;T=!0,r.pointerDown(e),l.useFriction(0).useDuration(0),i.set(o),function(){const e=D?n:t;M.add(e,"touchmove",R,x).add(e,"touchend",P).add(e,"mousemove",R,x).add(e,"mouseup",P)}(),z=r.readPoint(e),I=r.readPoint(e,y),h.emit("pointerDown")}(s)}const c=t;C.add(c,"dragstart",(e=>e.preventDefault()),x).add(c,"touchmove",(()=>{}),x).add(c,"touchend",(()=>{})).add(c,"touchstart",s).add(c,"mousedown",s).add(c,"touchcancel",P).add(c,"contextmenu",P).add(c,"click",L,!0)},destroy:function(){C.clear(),M.clear()},pointerDown:function(){return T}}}function bS(e,t){let n,a;function i(e){return e.timeStamp}function r(n,a){const i="client"+("x"===(a||e.scroll)?"X":"Y");return(mS(n,t)?n:n.touches[0])[i]}return{pointerDown:function(e){return n=e,a=e,r(e)},pointerMove:function(e){const t=r(e)-r(a),o=i(e)-i(n)>170;return a=e,o&&(n=e),t},pointerUp:function(e){if(!n||!a)return 0;const t=r(a)-r(n),o=i(e)-i(n),s=i(e)-i(a)>170,c=t/o;return o&&!s&&iS(c)>.1?c:0},readPoint:r}}function wS(e,t,n,a,i,r,o){const s=[e].concat(a);let c,l,d=[],u=!1;function h(e){return i.measureSize(o.measure(e))}return{init:function(i){r&&(l=h(e),d=a.map(h),c=new ResizeObserver((n=>{(nS(r)||r(i,n))&&function(n){for(const r of n){if(u)return;const n=r.target===e,o=a.indexOf(r.target),s=n?l:d[o];if(iS(h(n?e:a[o])-s)>=.5){i.reInit(),t.emit("resize");break}}}(n)})),n.requestAnimationFrame((()=>{s.forEach((e=>c.observe(e)))})))},destroy:function(){u=!0,c&&c.disconnect()}}}function xS(e,t,n,a,i){const r=i.measure(10),o=i.measure(50),s=_S(.1,.99);let c=!1;function l(){return!c&&(!!e.reachedAny(n.get())&&!!e.reachedAny(t.get()))}return{shouldConstrain:l,constrain:function(i){if(!l())return;const c=e.reachedMin(t.get())?"min":"max",d=iS(e[c]-t.get()),u=n.get()-t.get(),h=s.constrain(d/o);n.subtract(u*h),!i&&iS(u)e.add(i)))}};return c}function MS(e,t,n,a,i){const{reachedAny:r,removeOffset:o,constrain:s}=a;function c(e){return e.concat().sort(((e,t)=>iS(e)-iS(t)))[0]}function l(t,a){const i=[t,t+n,t-n];if(!e)return t;if(!a)return c(i);const r=i.filter((e=>rS(e)===a));return r.length?c(r):cS(i)-n}return{byDistance:function(n,a){const c=i.get()+n,{index:d,distance:u}=function(n){const a=e?o(n):s(n),i=t.map(((e,t)=>({diff:l(e-a,0),index:t}))).sort(((e,t)=>iS(e.diff)-iS(t.diff))),{index:r}=i[0];return{index:r,distance:a}}(c),h=!e&&r(c);return!a||h?{index:d,distance:n}:{index:d,distance:n+l(t[d]-u,0)}},byIndex:function(e,n){return{index:e,distance:l(t[e]-i.get(),n)}},shortcut:l}}function kS(e,t,n,a,i,r,o,s){const c={passive:!0,capture:!0};let l=0;function d(e){"Tab"===e.code&&(l=(new Date).getTime())}return{init:function(u){s&&(r.add(document,"keydown",d,!1),t.forEach(((t,d)=>{r.add(t,"focus",(t=>{(nS(s)||s(u,t))&&function(t){if((new Date).getTime()-l>10)return;o.emit("slideFocusStart"),e.scrollLeft=0;const r=n.findIndex((e=>e.includes(t)));eS(r)&&(i.useDuration(0),a.index(r,0),o.emit("slideFocus"))}(d)}),c)})))}}}function SS(e){let t=e;function n(e){return eS(e)?e:e.get()}const a={get:function(){return t},set:function(e){t=n(e)},add:function(e){t+=n(e)},subtract:function(e){t-=n(e)}};return a}function ES(e,t){const n="x"===e.scroll?function(e){return`translate3d(${e}px,0px,0px)`}:function(e){return`translate3d(0px,${e}px,0px)`},a=t.style;let i=!1;return{clear:function(){i||(a.transform="",t.getAttribute("style")||t.removeAttribute("style"))},to:function(t){i||(a.transform=n(e.direction(t)))},toggleActive:function(e){i=!e}}}function $S(e,t,n,a,i,r,o,s,c){const l=.5,d=sS(i),u=sS(i).reverse(),h=function(){const e=o[0];return g(m(u,e),n,!1)}().concat(function(){const e=t-o[0]-1;return g(m(d,e),-n,!0)}());function p(e,t){return e.reduce(((e,t)=>e-i[t]),t)}function m(e,t){return e.reduce(((e,n)=>p(e,t)>0?e.concat([n]):e),[])}function g(i,o,d){const u=function(e){return r.map(((n,i)=>({start:n-a[i]+l+e,end:n+t-l+e})))}(o);return i.map((t=>{const a=d?0:-n,i=d?n:0,r=d?"end":"start",o=u[t][r];return{index:t,loopPoint:o,slideLocation:SS(-1),translate:ES(e,c[t]),target:()=>s.get()>o?a:i}}))}const f={canLoop:function(){return h.every((({index:e})=>{const n=d.filter((t=>t!==e));return p(n,t)<=.1}))},clear:function(){h.forEach((e=>e.translate.clear()))},loop:function(){h.forEach((e=>{const{target:t,translate:n,slideLocation:a}=e,i=t();i!==a.get()&&(n.to(i),a.set(i))}))},loopPoints:h};return f}function AS(e,t,n){let a,i=!1;return{init:function(r){n&&(a=new MutationObserver((e=>{i||(nS(n)||n(r,e))&&function(e){for(const n of e)if("childList"===n.type){r.reInit(),t.emit("slidesChanged");break}}(e)})),a.observe(e,{childList:!0}))},destroy:function(){a&&a.disconnect(),i=!0}}}function zS(e,t,n,a){const i={};let r,o=null,s=null,c=!1;return{init:function(){r=new IntersectionObserver((e=>{c||(e.forEach((e=>{const n=t.indexOf(e.target);i[n]=e})),o=null,s=null,n.emit("slidesInView"))}),{root:e.parentElement,threshold:a}),t.forEach((e=>r.observe(e)))},destroy:function(){r&&r.disconnect(),c=!0},get:function(e=!0){if(e&&o)return o;if(!e&&s)return s;const t=function(e){return hS(i).reduce(((t,n)=>{const a=parseInt(n),{isIntersecting:r}=i[a];return(e&&r||!e&&!r)&&t.push(a),t}),[])}(e);return e&&(o=t),e||(s=t),t}}}function IS(e,t,n,a,i,r,o,s,c){const{startEdge:l,endEdge:d,direction:u}=e,h=eS(n);const p={groupSlides:function(e){return h?function(e,t){return sS(e).filter((e=>e%t==0)).map((n=>e.slice(n,n+t)))}(e,n):function(e){return e.length?sS(e).reduce(((n,h,p)=>{const m=cS(n)||0,g=0===m,f=h===lS(e),_=i[l]-r[m][l],v=i[l]-r[h][d],y=!a&&g?u(o):0,b=iS(v-(!a&&f?u(s):0)-(_+y));return p&&b>t+c&&n.push(h),f&&n.push(e.length),n}),[]).map(((t,n,a)=>{const i=Math.max(a[n-1]||0);return e.slice(i,t)})):[]}(e)}};return p}function TS(e,t,n,a,i,r,o){const{align:s,axis:c,direction:l,startIndex:d,loop:u,duration:h,dragFree:p,dragThreshold:m,inViewThreshold:g,slidesToScroll:f,skipSnaps:_,containScroll:v,watchResize:y,watchSlides:b,watchDrag:w,watchFocus:x}=r,C={measure:function(e){const{offsetTop:t,offsetLeft:n,offsetWidth:a,offsetHeight:i}=e;return{top:t,right:n+a,bottom:t+i,left:n,width:a,height:i}}},M=C.measure(t),k=n.map(C.measure),S=function(e,t){const n="rtl"===t,a="y"===e,i=!a&&n?-1:1,r={scroll:a?"y":"x",cross:a?"x":"y",startEdge:a?"top":n?"right":"left",endEdge:a?"bottom":n?"left":"right",measureSize:function(e){const{height:t,width:n}=e;return a?t:n},direction:function(e){return e*i}};return r}(c,l),E=S.measureSize(M),$=function(e){const t={measure:function(t){return e*(t/100)}};return t}(E),A=function(e,t){const n={start:function(){return 0},center:function(e){return a(e)/2},end:a};function a(e){return t-e}const i={measure:function(a,i){return tS(e)?n[e](a):e(t,a,i)}};return i}(s,E),z=!u&&!!v,I=u||!!v,{slideSizes:T,slideSizesWithGaps:j,startGap:O,endGap:D}=function(e,t,n,a,i,r){const{measureSize:o,startEdge:s,endEdge:c}=e,l=n[0]&&i,d=function(){if(!l)return 0;const e=n[0];return iS(t[s]-e[s])}(),u=function(){if(!l)return 0;const e=r.getComputedStyle(cS(a));return parseFloat(e.getPropertyValue(`margin-${c}`))}(),h=n.map(o),p=n.map(((e,t,n)=>{const a=!t,i=dS(n,t);return a?h[t]+d:i?h[t]+u:n[t+1][s]-e[s]})).map(iS);return{slideSizes:h,slideSizesWithGaps:p,startGap:d,endGap:u}}(S,M,k,n,I,i),R=IS(S,E,f,u,M,k,O,D,2),{snaps:P,snapsAligned:L}=function(e,t,n,a,i){const{startEdge:r,endEdge:o}=e,{groupSlides:s}=i,c=s(a).map((e=>cS(e)[o]-e[0][r])).map(iS).map(t.measure),l=a.map((e=>n[r]-e[r])).map((e=>-iS(e))),d=s(l).map((e=>e[0])).map(((e,t)=>e+c[t]));return{snaps:l,snapsAligned:d}}(S,A,M,k,R),N=-cS(P)+cS(j),{snapsContained:F,scrollContainLimit:V}=function(e,t,n,a,i){const r=_S(-t+e,0),o=n.map(((e,t)=>{const{min:a,max:i}=r,o=r.constrain(e),s=!t,l=dS(n,t);return s?i:l||c(a,o)?a:c(i,o)?i:o})).map((e=>parseFloat(e.toFixed(3)))),s=function(){const e=o[0],t=cS(o);return _S(o.lastIndexOf(e),o.indexOf(t)+1)}();function c(e,t){return oS(e,t)<1}return{snapsContained:function(){if(t<=e+i)return[r.max];if("keepSnaps"===a)return o;const{min:n,max:c}=s;return o.slice(n,c)}(),scrollContainLimit:s}}(E,N,L,v,2),H=z?F:L,{limit:B}=function(e,t,n){const a=t[0];return{limit:_S(n?a-e:cS(t),a)}}(N,H,u),q=vS(lS(H),d,u),U=q.clone(),W=sS(n),Z=fS(a,i,(e=>(({dragHandler:e,scrollBody:t,scrollBounds:n,options:{loop:a}},i)=>{a||n.constrain(e.pointerDown()),t.seek(i)})(se,e)),(e=>(({scrollBody:e,translate:t,location:n,offsetLocation:a,scrollLooper:i,slideLooper:r,dragHandler:o,animation:s,eventHandler:c,scrollBounds:l,options:{loop:d}},u)=>{const h=e.settled(),p=!l.shouldConstrain(),m=d?h:h&&p;m&&!o.pointerDown()&&(s.stop(),c.emit("settle")),m||c.emit("scroll");const g=n.get()*u+Y.get()*(1-u);a.set(g),d&&(i.loop(e.direction()),r.loop()),t.to(a.get())})(se,e))),Q=H[q.get()],G=SS(Q),Y=SS(Q),K=SS(Q),X=SS(Q),J=function(e,t,n,a,i,r){let o=0,s=0,c=i,l=r,d=e.get(),u=0;function h(e){return c=e,m}function p(e){return l=e,m}const m={direction:function(){return s},duration:function(){return c},velocity:function(){return o},seek:function(t){const i=t/1e3,r=c*i,h=a.get()-e.get();let p=0;return c?(n.set(e),o+=h/r,o*=l,d+=o,e.add(o*i),p=d-u):(o=0,n.set(a),e.set(a),p=h),s=rS(p),u=d,m},settled:function(){return iS(a.get()-t.get())<.001},useBaseFriction:function(){return p(r)},useBaseDuration:function(){return h(i)},useFriction:p,useDuration:h};return m}(G,K,Y,X,h,.68),ee=MS(u,H,N,B,X),te=function(e,t,n,a,i,r,o){function s(i){const s=i.distance,c=i.index!==t.get();r.add(s),s&&(a.duration()?e.start():(e.update(),e.render(1),e.update())),c&&(n.set(t.get()),t.set(i.index),o.emit("select"))}const c={distance:function(e,t){s(i.byDistance(e,t))},index:function(e,n){const a=t.clone().set(e);s(i.byIndex(a.get(),n))}};return c}(Z,q,U,J,ee,X,o),ne=function(e){const{max:t,length:n}=e,a={get:function(e){return n?(e-t)/-n:0}};return a}(B),ae=gS(),ie=zS(t,n,o,g),{slideRegistry:re}=function(e,t,n,a,i,r){const{groupSlides:o}=i,{min:s,max:c}=a;return{slideRegistry:function(){const a=o(r),i=!e||"keepSnaps"===t;return 1===n.length?[r]:i?a:a.slice(s,c).map(((e,t,n)=>{const a=!t,i=dS(n,t);return a?uS(cS(n[0])+1):i?uS(lS(r)-cS(n)[0]+1,cS(n)[0]):e}))}()}}(z,v,H,V,R,W),oe=kS(e,n,re,te,J,ae,o,x),se={ownerDocument:a,ownerWindow:i,eventHandler:o,containerRect:M,slideRects:k,animation:Z,axis:S,dragHandler:yS(S,e,a,i,X,bS(S,i),G,Z,te,J,ee,q,o,$,p,m,_,.68,w),eventStore:ae,percentOfView:$,index:q,indexPrevious:U,limit:B,location:G,offsetLocation:K,previousLocation:Y,options:r,resizeHandler:wS(t,o,i,n,S,y,C),scrollBody:J,scrollBounds:xS(B,K,X,J,$),scrollLooper:CS(N,B,K,[G,K,Y,X]),scrollProgress:ne,scrollSnapList:H.map(ne.get),scrollSnaps:H,scrollTarget:ee,scrollTo:te,slideLooper:$S(S,E,N,T,j,P,H,K,n),slideFocus:oe,slidesHandler:AS(t,o,b),slidesInView:ie,slideIndexes:W,slideRegistry:re,slidesToScroll:R,target:X,translate:ES(S,t)};return se}const jS={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0,watchFocus:!0};function OS(e){function t(e,t){return pS(e,t||{})}const n={mergeOptions:t,optionsAtMedia:function(n){const a=n.breakpoints||{},i=hS(a).filter((t=>e.matchMedia(t).matches)).map((e=>a[e])).reduce(((e,n)=>t(e,n)),{});return t(n,i)},optionsMediaQueries:function(t){return t.map((e=>hS(e.breakpoints||{}))).reduce(((e,t)=>e.concat(t)),[]).map(e.matchMedia)}};return n}function DS(e,t,n){const a=e.ownerDocument,i=a.defaultView,r=OS(i),o=function(e){let t=[];const n={init:function(n,a){return t=a.filter((({options:t})=>!1!==e.optionsAtMedia(t).active)),t.forEach((t=>t.init(n,e))),a.reduce(((e,t)=>Object.assign(e,{[t.name]:t})),{})},destroy:function(){t=t.filter((e=>e.destroy()))}};return n}(r),s=gS(),c=function(){let e,t={};function n(e){return t[e]||[]}const a={init:function(t){e=t},emit:function(t){return n(t).forEach((n=>n(e,t))),a},off:function(e,i){return t[e]=n(e).filter((e=>e!==i)),a},on:function(e,i){return t[e]=n(e).concat([i]),a},clear:function(){t={}}};return a}(),{mergeOptions:l,optionsAtMedia:d,optionsMediaQueries:u}=r,{on:h,off:p,emit:m}=c,g=S;let f,_,v,y,b=!1,w=l(jS,DS.globalOptions),x=l(w),C=[];function M(t){const n=TS(e,v,y,a,i,t,c);if(t.loop&&!n.slideLooper.canLoop()){return M(Object.assign({},t,{loop:!1}))}return n}function k(t,n){b||(w=l(w,t),x=d(w),C=n||C,function(){const{container:t,slides:n}=x,a=tS(t)?e.querySelector(t):t;v=a||e.children[0];const i=tS(n)?v.querySelectorAll(n):n;y=[].slice.call(i||v.children)}(),f=M(x),u([w,...C.map((({options:e})=>e))]).forEach((e=>s.add(e,"change",S))),x.active&&(f.translate.to(f.location.get()),f.animation.init(),f.slidesInView.init(),f.slideFocus.init(z),f.eventHandler.init(z),f.resizeHandler.init(z),f.slidesHandler.init(z),f.options.loop&&f.slideLooper.loop(),v.offsetParent&&y.length&&f.dragHandler.init(z),_=o.init(z,C)))}function S(e,t){const n=A();E(),k(l({startIndex:n},e),t),c.emit("reInit")}function E(){f.dragHandler.destroy(),f.eventStore.clear(),f.translate.clear(),f.slideLooper.clear(),f.resizeHandler.destroy(),f.slidesHandler.destroy(),f.slidesInView.destroy(),f.animation.destroy(),o.destroy(),s.clear()}function $(e,t,n){x.active&&!b&&(f.scrollBody.useBaseFriction().useDuration(!0===t?0:x.duration),f.scrollTo.index(e,n||0))}function A(){return f.index.get()}const z={canScrollNext:function(){return f.index.add(1).get()!==A()},canScrollPrev:function(){return f.index.add(-1).get()!==A()},containerNode:function(){return v},internalEngine:function(){return f},destroy:function(){b||(b=!0,s.clear(),E(),c.emit("destroy"),c.clear())},off:p,on:h,emit:m,plugins:function(){return _},previousScrollSnap:function(){return f.indexPrevious.get()},reInit:g,rootNode:function(){return e},scrollNext:function(e){$(f.index.add(1).get(),e,-1)},scrollPrev:function(e){$(f.index.add(-1).get(),e,1)},scrollProgress:function(){return f.scrollProgress.get(f.location.get())},scrollSnapList:function(){return f.scrollSnapList},scrollTo:$,selectedScrollSnap:A,slideNodes:function(){return y},slidesInView:function(){return f.slidesInView.get()},slidesNotInView:function(){return f.slidesInView.get(!1)}};return k(t,n),setTimeout((()=>c.emit("init")),0),z}function RS(){return RS=Object.assign||function(e){for(var t=1;t=e;case"y":return Math.abs(i)>=e;case"z":return Math.abs(r)>=e;default:return!1}}(r,a)&&e.preventDefault(),l.isStarted?l.isMomentum&&r>Math.max(2,2*l.lastAbsDelta)&&(M(!0),x()):x(),0===r&&Object.is&&Object.is(e.deltaX,-0)?d=!0:(t=e,l.axisMovement=LS(l.axisMovement,a),l.lastAbsDelta=r,l.scrollPointsToMerge.push({axisDelta:a,timeStamp:i}),g(),p({axisDelta:a,isStart:!l.isStartPublished}),l.isStartPublished=!0,C())},g=function(){var e;l.scrollPointsToMerge.length===WS?(l.scrollPoints.unshift({axisDeltaSum:l.scrollPointsToMerge.map((function(e){return e.axisDelta})).reduce(LS),timeStamp:(e=l.scrollPointsToMerge.map((function(e){return e.timeStamp})),e.reduce((function(e,t){return e+t}))/e.length)}),_(),l.scrollPointsToMerge.length=0,l.scrollPoints.length=1,l.isMomentum||b()):l.isStartPublished||f()},f=function(){var e;l.axisVelocity=(e=l.scrollPointsToMerge,e[e.length-1]).axisDelta.map((function(e){return e/l.willEndTimeout}))},_=function(){var e=l.scrollPoints,t=e[0],n=e[1];if(n&&t){var a=t.timeStamp-n.timeStamp;if(!(a<=0)){var i=t.axisDeltaSum.map((function(e){return e/a})),r=i.map((function(e,t){return e/(l.axisVelocity[t]||1)}));l.axisVelocity=i,l.accelerationFactors.push(r),v(a)}}},v=function(e){var t=10*Math.ceil(e/10)*1.2;l.isMomentum||(t=Math.max(100,2*t)),l.willEndTimeout=Math.min(1e3,Math.round(t))},y=function(e){return 0===e||e<=US&&e>=qS},b=function(){if(l.accelerationFactors.length>=ZS){if(d&&(d=!1,NS(l.axisVelocity)>=.2))return void w();var e=l.accelerationFactors.slice(-1*ZS);e.every((function(e){var t=!!e.reduce((function(e,t){return e&&e<1&&e===t?1:0})),n=e.filter(y).length===e.length;return t||n}))&&w(),l.accelerationFactors=e}},w=function(){l.isMomentum=!0},x=function(){(l=YS()).isStarted=!0,l.startTime=Date.now(),n=void 0,d=!1},C=function(){clearTimeout(a),a=setTimeout(M,l.willEndTimeout)},M=function(e){void 0===e&&(e=!1),l.isStarted&&(l.isMomentum&&e?p({isEnding:!0,isMomentumCancel:!0}):p({isEnding:!0}),l.isMomentum=!1,l.isStarted=!1)},k=function(e){var t=[],n=function(n){n.removeEventListener("wheel",e),t=t.filter((function(e){return e!==n}))};return FS({observe:function(a){return a.addEventListener("wheel",e,{passive:!1}),t.push(a),function(){return n(a)}},unobserve:n,disconnect:function(){t.forEach(n)}})}(u),S=k.observe,E=k.unobserve,$=k.disconnect;return h(e),FS({on:r,off:o,observe:S,unobserve:E,disconnect:$,feedWheel:u,updateOptions:h})}var XS={active:!0,breakpoints:{},wheelDraggingClass:"is-wheel-dragging",forceWheelAxis:void 0,target:void 0};function JS(e){var t;void 0===e&&(e={});var n=function(){};var a={name:"wheelGestures",options:e,init:function(a,i){var r,o,s=i.mergeOptions,c=i.optionsAtMedia,l=s(XS,JS.globalOptions),d=s(l,e);t=c(d);var u,h=a.internalEngine(),p=null!=(r=t.target)?r:a.containerNode().parentNode,m=null!=(o=t.forceWheelAxis)?o:h.options.axis,g=KS({preventWheelAction:m,reverseSign:[!0,!0,!1]}),f=g.observe(p),_=g.on("wheel",(function(e){var a=e.axisDelta,i=a[0],r=a[1],o="x"===m?i:r,s="x"===m?r:i,c=e.isMomentum&&e.previous&&!e.previous.isMomentum,l=e.isEnding&&!e.isMomentum||c;Math.abs(o)>Math.abs(s)&&!v&&!e.isMomentum&&function(e){try{x(u=new MouseEvent("mousedown",e.event))}catch(e){return n()}v=!0,document.documentElement.addEventListener("mousemove",b,!0),document.documentElement.addEventListener("mouseup",b,!0),void document.documentElement.addEventListener("mousedown",b,!0),t.wheelDraggingClass&&p.classList.add(t.wheelDraggingClass)}(e);if(!v)return;l?function(e){v=!1,x(w("mouseup",e)),y(),t.wheelDraggingClass&&p.classList.remove(t.wheelDraggingClass)}(e):x(w("mousemove",e))})),v=!1;function y(){document.documentElement.removeEventListener("mousemove",b,!0),document.documentElement.removeEventListener("mouseup",b,!0),document.documentElement.removeEventListener("mousedown",b,!0)}function b(e){v&&e.isTrusted&&e.stopImmediatePropagation()}function w(e,t){var n,a;if(m===h.options.axis){var i=t.axisMovement;n=i[0],a=i[1]}else{var r=t.axisMovement;a=r[0],n=r[1]}if(!h.options.skipSnaps&&!h.options.dragFree){var o=h.containerRect.width,s=h.containerRect.height;n=n<0?Math.max(n,-o):Math.min(n,o),a=a<0?Math.max(a,-s):Math.min(a,s)}return new MouseEvent(e,{clientX:u.clientX+n,clientY:u.clientY+a,screenX:u.screenX+n,screenY:u.screenY+a,movementX:n,movementY:a,button:0,bubbles:!0,cancelable:!0,composed:!0})}function x(e){a.containerNode().dispatchEvent(e)}n=function(){f(),_(),y()}},destroy:function(){return n()}};return a}JS.globalOptions=void 0;class eE{constructor(e,t,n){this._mutationObserver=new MutationObserver(((e,t)=>this._refreshCarouselContents())),this._refreshCarouselContents=()=>{const e=lf(this._parent);!Dv(this._carousel.slideNodes(),e)&&(this._carousel.destroy(),this._carousel=this._createCarousel(e))},this._root=e,this._parent=t,this._direction=n?.direction??"horizontal",this._transitionEffect=n?.transitionEffect??"slide",this._startIndex=n?.startIndex??0,this._dragFree=n?.dragFree??!1,this._loop=n?.loop??!1,this._draggable=n?.dragEnabled??!0,this._plugins=n?.plugins??[],this._carousel=this._createCarousel(lf(this._parent)),t instanceof HTMLSlotElement&&t.addEventListener("slotchange",this._refreshCarouselContents),this._mutationObserver.observe(this._parent,{childList:!0})}destroy(){this._parent instanceof HTMLSlotElement&&this._parent.removeEventListener("slotchange",this._refreshCarouselContents),this._mutationObserver.disconnect(),this._carousel.destroy()}getSlide(e){return this._carousel.slideNodes()[e]??null}getSelectedSlide(){return this.getSlide(this.getSelectedIndex())}getSelectedIndex(){return this._carousel.selectedScrollSnap()}selectSlide(e){this._carousel.scrollTo(e,"none"===this._transitionEffect);const t=this.getSlide(e);t&&Bg(this._parent,"carousel:force-select",{index:e,element:t})}_createCarousel(e){const t=DS(this._root,{slides:e,axis:"horizontal"===this._direction?"x":"y",duration:20,startIndex:this._startIndex,dragFree:this._dragFree,loop:this._loop,containScroll:"trimSnaps",watchSlides:!1,watchResize:!0,watchDrag:this._draggable},[...this._plugins,...e.length>1?[JS({forceWheelAxis:"y"})]:[]]),n=()=>{const e=(()=>{const e=t.selectedScrollSnap(),n=t.slideNodes()[e]??null;return n?{index:e,element:n}:null})();e&&Bg(this._parent,"carousel:select",e)};return t.on("select",(()=>n())),t}}let tE=class extends se{constructor(){super(...arguments),this.direction="horizontal",this.dragEnabled=!0,this.selected=0,this._refParent=ze(),this._refRoot=ze(),this._carousel=null}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._carousel?.destroy(),this._carousel=null,super.disconnectedCallback()}willUpdate(e){e.has("direction")&&this.setAttribute("direction",this.direction);["direction","dragEnabled","dragFree","loop","plugins","transitionEffect"].some((t=>e.has(t)))&&(this._carousel?.destroy(),this._carousel=null)}render(){return q`
+ +
+
+ +
+
+ +
`}updated(e){!this._carousel&&this._refRoot.value&&this._refParent.value?this._carousel=new eE(this._refRoot.value,this._refParent.value,{direction:this.direction,dragEnabled:this.dragEnabled,dragFree:this.dragFree,startIndex:this.selected,transitionEffect:this.transitionEffect,loop:this.loop,plugins:this.plugins}):e.has("selected")&&this._carousel?.selectSlide(this.selected)}static get styles(){return o(":host {\n display: block;\n height: 100%;\n width: 100%;\n position: relative;\n}\n\n.embla {\n width: 100%;\n height: 100%;\n margin-left: auto;\n margin-right: auto;\n}\n\n.embla__container {\n display: flex;\n width: 100%;\n height: 100%;\n user-select: none;\n -webkit-touch-callout: none;\n -khtml-user-select: none;\n -webkit-tap-highlight-color: transparent;\n}\n\n:host([direction=vertical]) .embla__container {\n flex-direction: column;\n}\n\n:host([direction=horizontal]) .embla__container {\n flex-direction: row;\n}\n\n.embla__viewport {\n width: 100%;\n height: 100%;\n overflow: hidden;\n display: flex;\n flex-direction: column;\n justify-content: center;\n}\n\n.embla__viewport.is-draggable {\n cursor: move;\n cursor: grab;\n}\n\n.embla__viewport.is-dragging {\n cursor: grabbing;\n}\n\n:host([direction=vertical]) ::slotted(.embla__slide) {\n margin-bottom: 5px;\n}\n\n:host([direction=horizontal]) ::slotted(.embla__slide) {\n margin-right: 5px;\n}")}};e([he({attribute:!0,reflect:!0})],tE.prototype,"direction",void 0),e([he({attribute:!0})],tE.prototype,"transitionEffect",void 0),e([he({attribute:!1})],tE.prototype,"loop",void 0),e([he({attribute:!1})],tE.prototype,"dragFree",void 0),e([he({attribute:!1})],tE.prototype,"dragEnabled",void 0),e([he({attribute:!1})],tE.prototype,"plugins",void 0),e([he({attribute:!1})],tE.prototype,"selected",void 0),tE=e([le("frigate-card-carousel")],tE); +/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const nE=window,aE=nE.ShadowRoot&&(void 0===nE.ShadyCSS||nE.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,iE=Symbol(),rE=new WeakMap;let oE=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==iE)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(aE&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=rE.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&rE.set(t,e))}return e}toString(){return this.cssText}};const sE=(e,t)=>{aE?e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):t.forEach((t=>{const n=document.createElement("style"),a=nE.litNonce;void 0!==a&&n.setAttribute("nonce",a),n.textContent=t.cssText,e.appendChild(n)}))},cE=aE?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return(e=>new oE("string"==typeof e?e:e+"",void 0,iE))(t)})(e):e +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */;var lE;const dE=window,uE=dE.trustedTypes,hE=uE?uE.emptyScript:"",pE=dE.reactiveElementPolyfillSupport,mE={toAttribute(e,t){switch(t){case Boolean:e=e?hE:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},gE=(e,t)=>t!==e&&(t==t||e==e),fE={attribute:!0,type:String,converter:mE,reflect:!1,hasChanged:gE},_E="finalized";class vE extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var t;this.finalize(),(null!==(t=this.h)&&void 0!==t?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach(((t,n)=>{const a=this._$Ep(n,t);void 0!==a&&(this._$Ev.set(a,n),e.push(a))})),e}static createProperty(e,t=fE){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){const n="symbol"==typeof e?Symbol():"__"+e,a=this.getPropertyDescriptor(e,n,t);void 0!==a&&Object.defineProperty(this.prototype,e,a)}}static getPropertyDescriptor(e,t,n){return{get(){return this[t]},set(a){const i=this[e];this[t]=a,this.requestUpdate(e,i,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||fE}static finalize(){if(this.hasOwnProperty(_E))return!1;this[_E]=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),void 0!==e.h&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const e=this.properties,t=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const n of t)this.createProperty(n,e[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(cE(e))}else void 0!==e&&t.push(cE(e));return t}static _$Ep(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(e=this.constructor.h)||void 0===e||e.forEach((e=>e(this)))}addController(e){var t,n;(null!==(t=this._$ES)&&void 0!==t?t:this._$ES=[]).push(e),void 0!==this.renderRoot&&this.isConnected&&(null===(n=e.hostConnected)||void 0===n||n.call(e))}removeController(e){var t;null===(t=this._$ES)||void 0===t||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])}))}createRenderRoot(){var e;const t=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return sE(t,this.constructor.elementStyles),t}connectedCallback(){var e;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostConnected)||void 0===t?void 0:t.call(e)}))}enableUpdating(e){}disconnectedCallback(){var e;null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostDisconnected)||void 0===t?void 0:t.call(e)}))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EO(e,t,n=fE){var a;const i=this.constructor._$Ep(e,n);if(void 0!==i&&!0===n.reflect){const r=(void 0!==(null===(a=n.converter)||void 0===a?void 0:a.toAttribute)?n.converter:mE).toAttribute(t,n.type);this._$El=e,null==r?this.removeAttribute(i):this.setAttribute(i,r),this._$El=null}}_$AK(e,t){var n;const a=this.constructor,i=a._$Ev.get(e);if(void 0!==i&&this._$El!==i){const e=a.getPropertyOptions(i),r="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==(null===(n=e.converter)||void 0===n?void 0:n.fromAttribute)?e.converter:mE;this._$El=i,this[i]=r.fromAttribute(t,e.type),this._$El=null}}requestUpdate(e,t,n){let a=!0;void 0!==e&&(((n=n||this.constructor.getPropertyOptions(e)).hasChanged||gE)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),!0===n.reflect&&this._$El!==e&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(e,n))):a=!1),!this.isUpdatePending&&a&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((e,t)=>this[t]=e)),this._$Ei=void 0);let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostUpdate)||void 0===t?void 0:t.call(e)})),this.update(n)):this._$Ek()}catch(e){throw t=!1,this._$Ek(),e}t&&this._$AE(n)}willUpdate(e){}_$AE(e){var t;null===(t=this._$ES)||void 0===t||t.forEach((e=>{var t;return null===(t=e.hostUpdated)||void 0===t?void 0:t.call(e)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){void 0!==this._$EC&&(this._$EC.forEach(((e,t)=>this._$EO(t,this[t],e))),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}}vE[_E]=!0,vE.elementProperties=new Map,vE.elementStyles=[],vE.shadowRootOptions={mode:"open"},null==pE||pE({ReactiveElement:vE}),(null!==(lE=dE.reactiveElementVersions)&&void 0!==lE?lE:dE.reactiveElementVersions=[]).push("1.6.3"); +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const yE=0,bE=Symbol();class wE{constructor(e,t,n){this.o=0,this.status=0,this.autoRun=!0,this.i=e,this.i.addController(this);const a="object"==typeof t?t:{task:t,args:n};this.t=a.task,this.h=a.args,void 0!==a.autoRun&&(this.autoRun=a.autoRun),this.taskComplete=new Promise(((e,t)=>{this.l=e,this.u=t}))}hostUpdated(){this.performTask()}async performTask(){var e;const t=null===(e=this.h)||void 0===e?void 0:e.call(this);this.shouldRun(t)&&this.run(t)}shouldRun(e){return this.autoRun&&this.v(e)}async run(e){var t;let n,a;null!=e||(e=null===(t=this.h)||void 0===t?void 0:t.call(this)),2!==this.status&&3!==this.status||(this.taskComplete=new Promise(((e,t)=>{this.l=e,this.u=t}))),this.status=1,this._=void 0,this.m=void 0,this.i.requestUpdate();const i=++this.o;try{n=await this.t(e)}catch(e){a=e}this.o===i&&(n===bE?this.status=0:(void 0===a?(this.status=2,this.l(n)):(this.status=3,this.u(a)),this.m=n,this._=a),this.i.requestUpdate())}get value(){return this.m}get error(){return this._}render(e){var t,n,a,i;switch(this.status){case 0:return null===(t=e.initial)||void 0===t?void 0:t.call(e);case 1:return null===(n=e.pending)||void 0===n?void 0:n.call(e);case 2:return null===(a=e.complete)||void 0===a?void 0:a.call(e,this.value);case 3:return null===(i=e.error)||void 0===i?void 0:i.call(e,this.error);default:this.status}}v(e){const t=this.T;return this.T=e,Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.some(((e,n)=>gE(e,t[n]))):e!==t}}class xE{constructor(e){this._keys=e}modify(e){this._keys.forEach((t=>e.removeContext(t)))}}var CE=":host {\n display: flex;\n flex-direction: column;\n width: 100%;\n margin-left: 5px;\n padding: 5px;\n color: var(--primary-text-color);\n overflow: hidden;\n column-gap: 5%;\n}\n\ndiv.title {\n font-size: 1.2rem;\n font-weight: bold;\n}\n\ndiv.details {\n flex: 1;\n justify-content: center;\n display: flex;\n flex-direction: column;\n flex-wrap: wrap;\n --mdc-icon-size: 16px;\n min-height: 0px;\n}";const ME=(e,t,n,a)=>{const i={...a?.cardWideConfig&&{cardWideConfig:a.cardWideConfig}};return q` ${t.render({initial:()=>a?.inProgressFunc?.()??Ck(i),pending:()=>a?.inProgressFunc?.()??Ck(i),error:t=>{Gg(t),Sk(e,t)},complete:n})}`},kE=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,SE=(e,t,n,a=!0)=>new wE(e,{args:()=>[!!t(),n()],task:async([e,n])=>{const a=t();return e&&a&&n?(async(e,t)=>e&&t?t.startsWith("data:")||t.match(kE)?t:new Promise(((n,a)=>{e?e.fetchWithAuth(t).then((e=>e.blob())).then((e=>{const t=new FileReader;t.onload=()=>{const e=t.result;n("string"==typeof e?e:null)},t.onerror=e=>a(e),t.readAsDataURL(e)})):a()})):null)(a,n):null},autoRun:a}),EE=300;let $E=class extends se{constructor(){super(),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}connectedCallback(){this._intersectionObserver.observe(this),super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._intersectionObserver.disconnect()}willUpdate(e){e.has("thumbnail")&&(this._embedThumbnailTask=SE(this,(()=>this.hass),(()=>this.thumbnail),!1),this._intersectionObserver.unobserve(this),this._intersectionObserver.observe(this))}_intersectionHandler(e){this._embedThumbnailTask?.status===yE&&e.some((e=>e.isIntersecting))&&this._embedThumbnailTask?.run()}render(){const e=q` `;return this._embedThumbnailTask?q`${this.thumbnail?ME(this,this._embedThumbnailTask,(e=>e?q``:q``),{inProgressFunc:()=>e}):e} `:e}static get styles(){return o(":host {\n display: block;\n overflow: hidden;\n aspect-ratio: 1/1;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\nimg {\n display: block;\n}\n\nimg,\nha-icon {\n display: inline-block;\n vertical-align: top;\n margin: 0;\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n width: var(--frigate-card-thumbnail-size);\n max-height: 100%;\n aspect-ratio: 1/1;\n object-fit: cover;\n}\n\nha-icon {\n --mdc-icon-size: 50%;\n color: var(--primary-text-color);\n display: flex;\n justify-content: center;\n align-items: center;\n border: 1px solid rgba(255, 255, 255, 0.3);\n box-sizing: border-box;\n opacity: 0.2;\n}")}};e([he({attribute:!1})],$E.prototype,"thumbnail",void 0),e([he({attribute:!1})],$E.prototype,"hass",void 0),$E=e([le("frigate-card-thumbnail-feature-thumbnail")],$E);let AE=class extends se{render(){if(this.date)return q` + ${this.cameraMetadata?.engineLogo?q``:""} +
+
${Wu(this.date,"HH:mm")}
+
${Wu(this.date,"MMM do")}
+ ${this.showCameraTitle&&this.cameraMetadata?.title?q`
${this.cameraMetadata.title}
`:q``} +
+ `}static get styles(){return o(":host {\n display: block;\n max-width: var(--frigate-card-thumbnail-size);\n max-height: var(--frigate-card-thumbnail-size);\n aspect-ratio: 1/1;\n border: 1px solid var(--secondary-color);\n background-color: var(--secondary-background-color);\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n overflow: hidden;\n padding: 10px;\n box-sizing: border-box;\n position: relative;\n}\n\nimg.background {\n display: block;\n width: 100%;\n height: 100%;\n position: absolute;\n inset: 0;\n padding: 10%;\n box-sizing: border-box;\n pointer-events: none;\n opacity: 0.1;\n}\n\ndiv.content {\n height: 100%;\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n color: var(--primary-text-color);\n}\n\ndiv {\n text-align: center;\n}\n\ndiv.title {\n font-size: 1.5rem;\n}\n\ndiv.camera {\n font-size: 0.7em;\n}")}};e([he({attribute:!1})],AE.prototype,"date",void 0),e([he({attribute:!1})],AE.prototype,"cameraMetadata",void 0),e([he({attribute:!1})],AE.prototype,"showCameraTitle",void 0),AE=e([le("frigate-card-thumbnail-feature-text")],AE);let zE=class extends se{render(){if(!this.media)return;const e=this.media.getScore(),t=e?(100*e).toFixed(2)+"%":null,n=this.media.getStartTime(),a=n?Kg(n):null,i=this.media.getEndTime(),r=n&&i?ef(n,i):null,o=this.media.inProgress()?V_("event.in_progress"):null,s=qg(this.media.getWhat()?.join(", "))??null,c=qg(this.media.getWhere()?.join(", "))??null,l=qg(this.media.getTags()?.join(", "))??null,d=s||l?(s??"")+(s&&l?": ":"")+(l??""):null,u=this.seek?Wu(this.seek,"HH:mm:ss"):null;return q` + ${d?q`
+ ${d} + ${t?q`${t}`:""} +
`:""} +
+ ${a?q`
+ + ${a} +
+ ${r||o?q`
+ + ${r?q`${r}`:""} + ${o?q`${o}`:""} +
`:""}`:""} + ${this.cameraTitle?q`
+ + ${this.cameraTitle} +
`:""} + ${c?q`
+ + ${c} +
`:q``} + ${l?q`
+ + ${l} +
`:q``} + ${u?q`
+ + ${u} +
`:q``} +
+ `}static get styles(){return o(CE)}};e([he({attribute:!1})],zE.prototype,"media",void 0),e([he({attribute:!1})],zE.prototype,"seek",void 0),e([he({attribute:!1})],zE.prototype,"cameraTitle",void 0),zE=e([le("frigate-card-thumbnail-details-event")],zE);let IE=class extends se{render(){if(!this.media)return;const e=this.media.getStartTime(),t=e?Kg(e):null,n=this.media.getEndTime(),a=e&&n?ef(e,n):null,i=this.media.inProgress()?V_("recording.in_progress"):null,r=this.seek?Wu(this.seek,"HH:mm:ss"):null,o=this.media.getEventCount();return q` + ${this.cameraTitle?q`
+ ${this.cameraTitle} +
`:""} +
+ ${t?q`
+ + ${t} +
+ ${a||i?q`
+ + ${a?q`${a}`:""} + ${i?q`${i}`:""} +
`:""}`:""} + ${r?q`
+ + ${r} +
`:q``} + ${null!==o?q`
+ + ${o} +
`:""} +
+ `}static get styles(){return o(CE)}};e([he({attribute:!1})],IE.prototype,"media",void 0),e([he({attribute:!1})],IE.prototype,"seek",void 0),e([he({attribute:!1})],IE.prototype,"cameraTitle",void 0),IE=e([le("frigate-card-thumbnail-details-recording")],IE);let TE=class extends se{constructor(){super(...arguments),this.details=!1,this.show_favorite_control=!1,this.show_timeline_control=!1,this.show_download_control=!1}render(){if(!this.media||!this.cameraManager||!this.hass)return;const e=this.media.getThumbnail(),t=this.media.getTitle()??"",n={star:!0,starred:!!this.media?.isFavorite()},a=this.show_timeline_control&&(!nx.isRecording(this.media)||this.media.getStartTime()&&this.media.getEndTime()),i=this.cameraManager?.getMediaCapabilities(this.media),r=this.show_favorite_control&&this.media&&this.hass&&i?.canFavorite,o=this.show_download_control&&this.hass&&this.media.getID()&&i?.canDownload,s=this.cameraManager.getCameraMetadata(this.media.getCameraID());return q` + ${nx.isEvent(this.media)&&e?q``:nx.isEvent(this.media)||nx.isRecording(this.media)?q``:q``} + ${r?q` {if(wf(e),this.hass&&this.media){try{await(this.cameraManager?.favoriteMedia(this.media,!this.media?.isFavorite()))}catch(e){return void Gg(e)}this.requestUpdate()}}} + />`:""} + ${this.details&&nx.isEvent(this.media)?q``:this.details&&nx.isRecording(this.media)?q``:q``} + ${a?q`{wf(e),this.viewManagerEpoch&&this.media&&this.viewManagerEpoch.manager.setViewByParameters({params:{view:"timeline",queryResults:this.viewManagerEpoch?.manager.getView()?.queryResults?.clone().selectResultIfFound((e=>e===this.media))},modifiers:[new xE(["timeline"])]})}} + >`:""} + ${o?q` {if(wf(e),this.hass&&this.cameraManager&&this.media)try{await $w(this.hass,this.cameraManager,this.media)}catch(e){Sk(this,e)}}} + >`:""} + `}static get styles(){return o(":host {\n display: flex;\n flex-direction: row;\n box-sizing: border-box;\n position: relative;\n overflow: hidden;\n transition: transform 0.2s linear;\n}\n\n:host(:not([details])) {\n aspect-ratio: 1/1;\n}\n\n:host([details]) {\n border: 1px solid var(--primary-color);\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n padding: 2px;\n background-color: var(--primary-background-color, black);\n}\n\n:host(:hover) {\n transform: scale(1.04);\n}\n\nha-icon {\n position: absolute;\n border-radius: 50%;\n opacity: 0.5;\n color: var(--primary-color);\n cursor: pointer;\n transition: opacity 0.2s ease-in-out, color 0.2s ease-in-out;\n}\n\nha-icon:hover {\n opacity: 1;\n}\n\nha-icon.star {\n top: 3px;\n left: 3px;\n}\n\nha-icon.star.starred {\n color: gold;\n}\n\nha-icon.timeline {\n top: 3px;\n right: 3px;\n}\n\nha-icon.download {\n right: 3px;\n bottom: 3px;\n}\n\nfrigate-card-thumbnail-details-event,\nfrigate-card-thumbnail-details-recording {\n flex: 1;\n}")}};e([he({attribute:!1})],TE.prototype,"cameraManager",void 0),e([he({attribute:!1})],TE.prototype,"media",void 0),e([he({attribute:!0,type:Boolean})],TE.prototype,"details",void 0),e([he({attribute:!0,type:Boolean})],TE.prototype,"show_favorite_control",void 0),e([he({attribute:!0,type:Boolean})],TE.prototype,"show_timeline_control",void 0),e([he({attribute:!0,type:Boolean})],TE.prototype,"show_download_control",void 0),e([he({attribute:!1})],TE.prototype,"seek",void 0),TE=e([le("frigate-card-thumbnail")],TE);let jE=class extends se{constructor(){super(...arguments),this.fadeThumbnails=!1,this._thumbnailSlides=[]}willUpdate(e){if(e.has("config")){this.config?.size&&this.style.setProperty("--frigate-card-thumbnail-size",`${this.config.size}px`);const e=this._getDirection();e?this.setAttribute("direction",e):this.removeAttribute("direction")}["cameraManager","config","transitionEffect","viewManagerEpoch"].some((t=>e.has(t)))&&(this._thumbnailSlides=this._renderSlides()),e.has("viewManagerEpoch")&&this.style.setProperty("--frigate-card-carousel-thumbnail-opacity",this.fadeThumbnails&&null!==this._getSelectedSlide()?"0.4":"1.0")}_getSelectedSlide(){return this.viewManagerEpoch?.manager.getView()?.queryResults?.getSelectedIndex()??null}_renderSlides(){const e=[],t=this.viewManagerEpoch?.manager.getView(),n=t?.context?.mediaViewer?.seek,a=this._getSelectedSlide();for(const i of t?.queryResults?.getResults()??[]){const t=e.length,r={embla__slide:!0,"slide-selected":a===t};e.push(q` {const n=this.viewManagerEpoch?.manager.getView();n&&n.queryResults&&Bg(this,"thumbnail-carousel:tap",{queryResults:n.queryResults.clone().selectIndex(t)}),wf(e)}} + > + `)}return e}_getDirection(){return"left"===this.config?.mode||"right"===this.config?.mode?"vertical":"above"===this.config?.mode||"below"===this.config?.mode?"horizontal":null}render(){const e=this._getDirection();if(this._thumbnailSlides.length&&this.config&&e)return q` + ${this._thumbnailSlides} + `}static get styles(){return o(":host {\n --frigate-card-thumbnail-size-max: 300px;\n --frigate-card-thumbnail-details-width: calc(\n var(--frigate-card-thumbnail-size) + 200px\n );\n}\n\n:host {\n display: block;\n width: 100%;\n height: 100%;\n --frigate-card-carousel-thumbnail-opacity: 1;\n}\n\n:host([direction=vertical]) {\n height: 100%;\n}\n\n:host([direction=horizontal]) {\n height: auto;\n}\n\n.embla__slide {\n flex: 0 0 auto;\n opacity: var(--frigate-card-carousel-thumbnail-opacity);\n}\n\n.embla__slide.slide-selected {\n opacity: 1;\n}\n\nfrigate-card-thumbnail {\n width: var(--frigate-card-thumbnail-size);\n height: var(--frigate-card-thumbnail-size);\n max-width: 100%;\n}\n\nfrigate-card-thumbnail[details] {\n width: var(--frigate-card-thumbnail-details-width);\n}")}};e([he({attribute:!1})],jE.prototype,"hass",void 0),e([he({attribute:!1})],jE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1})],jE.prototype,"cameraManager",void 0),e([he({attribute:!1})],jE.prototype,"config",void 0),e([he({attribute:!1})],jE.prototype,"fadeThumbnails",void 0),jE=e([le("frigate-card-thumbnail-carousel")],jE);var OE=":host {\n width: 100%;\n height: 100%;\n display: block;\n}";const DE=document.createElement("template");DE.innerHTML='\n
\n
\n';class RE extends HTMLElement{constructor(){super();const e=this.attachShadow({mode:"open"});e.appendChild(DE.content.cloneNode(!0)),this._freeSpaceDiv=e.getElementById("fs")}connectedCallback(){this._freeSpaceDiv&&this._freeSpaceDiv.addEventListener("click",this.handleFreeSpaceDivClick),this.upgradeProperty("open")}disconnectedCallback(){document.removeEventListener("keyup",this.handleKeyUp)}upgradeProperty(e){if(this.hasOwnProperty(e)){let t=this[e];delete this[e],this[e]=t}}handleKeyUp=e=>{if(!e.altKey&&"Escape"===e.key)e.preventDefault(),this.open=!1};get open(){return this.hasAttribute("open")}set open(e){e?this.hasAttribute("open")||this.setAttribute("open",""):this.hasAttribute("open")&&this.removeAttribute("open")}static get observedAttributes(){return["open"]}attributeChangedCallback(e,t,n){"open"===e&&(this.open?(this.setAttribute("tabindex","0"),this.setAttribute("aria-disabled","false"),this.focus({preventScroll:!0}),document.addEventListener("keyup",this.handleKeyUp),this.dispatchEvent(new CustomEvent("open",{bubbles:!0}))):(this.setAttribute("tabindex","-1"),this.setAttribute("aria-disabled","true"),document.removeEventListener("keyup",this.handleKeyUp),this.dispatchEvent(new CustomEvent("close",{bubbles:!0}))))}handleFreeSpaceDivClick=()=>{this.open=!1}}customElements.define("side-drawer",RE);let PE=class extends se{constructor(){super(...arguments),this.location="left",this.control=!0,this.open=!1,this.empty=!0,this._refDrawer=ze(),this._refSlot=ze(),this._resizeObserver=new ResizeObserver((()=>this._hideDrawerIfNecessary())),this._isHoverableDevice=Yg()}firstUpdated(e){super.firstUpdated(e);const t=document.createElement("style");t.innerHTML=":host {\n width: unset;\n}\n\n#fs {\n display: none;\n width: 100%;\n inset: 0;\n}\n\n#d,\n#fs {\n height: 100%;\n position: absolute;\n}\n\n#d {\n overflow: visible;\n max-width: 90%;\n z-index: 10;\n}\n\n:host([location=right]) #d {\n left: unset;\n right: 0;\n transform: translateX(100%);\n}\n\n:host([location=right][open]) #d {\n transform: none;\n box-shadow: var(--frigate-card-css-box-shadow, 0px 0px 25px 0px black);\n}\n\n#ifs {\n height: 100%;\n}",this._refDrawer.value?.shadowRoot?.appendChild(t)}_slotChanged(){const e=this._refSlot.value?lf(this._refSlot.value):[];this._resizeObserver.disconnect();for(const t of e)this._resizeObserver.observe(t);this._hideDrawerIfNecessary()}_hideDrawerIfNecessary(){if(!this._refDrawer.value)return;const e=this._refSlot.value?lf(this._refSlot.value):null;this.empty=!e||!e.length||e.every((e=>{const t=e.getBoundingClientRect();return!t.width||!t.height}))}render(){return q` + {this.open&&(this.open=!1)}} + > + ${this.control?q` +
{wf(e),this.open=!this.open}} + > + {this._isHoverableDevice&&!this.open&&(this.open=!0)}} + > + +
+ `:""} + this._slotChanged()}> +
+ `}static get styles(){return o("side-drawer {\n background-color: var(--card-background-color);\n}\n\ndiv.control-surround {\n position: absolute;\n bottom: 50%;\n transform: translateY(50%);\n z-index: 0;\n padding-top: 20px;\n padding-bottom: 20px;\n}\n\n:host([location=left]) div.control-surround {\n padding-right: 12px;\n left: 100%;\n}\n\n:host([location=right]) div.control-surround {\n padding-left: 12px;\n right: 100%;\n}\n\n:host([empty]),\n:host([empty]) > * {\n visibility: hidden;\n}\n\n:host(:not([empty])),\n:host(:not([empty])) > * {\n visibility: visible;\n}\n\nha-icon.control {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.7);\n opacity: 0.5;\n pointer-events: all;\n --mdc-icon-size: 20px;\n padding-top: 20px;\n padding-bottom: 20px;\n transition: opacity 0.5s ease;\n}\n\n:host([open]) ha-icon.control,\nha-icon.control:hover {\n opacity: 1;\n background-color: black;\n}\n\n:host([location=left]) ha-icon.control {\n border-top-right-radius: 20px;\n border-bottom-right-radius: 20px;\n}\n\n:host([location=right]) ha-icon.control {\n border-top-left-radius: 20px;\n border-bottom-left-radius: 20px;\n}")}};e([he({attribute:!0,reflect:!0})],PE.prototype,"location",void 0),e([he({attribute:!0,reflect:!0,type:Boolean})],PE.prototype,"control",void 0),e([he({type:Boolean,reflect:!0,attribute:!0})],PE.prototype,"open",void 0),e([he({attribute:!1})],PE.prototype,"icons",void 0),e([he({type:Boolean,reflect:!0,attribute:!0})],PE.prototype,"empty",void 0),PE=e([le("frigate-card-drawer")],PE);let LE=class extends se{constructor(){super(...arguments),this._refDrawerLeft=ze(),this._refDrawerRight=ze(),this._boundDrawerHandler=this._drawerHandler.bind(this)}connectedCallback(){super.connectedCallback(),this.addEventListener("frigate-card:drawer:open",this._boundDrawerHandler),this.addEventListener("frigate-card:drawer:close",this._boundDrawerHandler)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("frigate-card:drawer:open",this._boundDrawerHandler),this.removeEventListener("frigate-card:drawer:close",this._boundDrawerHandler)}_drawerHandler(e){const t=e.detail.drawer,n=e.type.endsWith(":open");"left"===t&&this._refDrawerLeft.value?this._refDrawerLeft.value.open=n:"right"===t&&this._refDrawerRight.value&&(this._refDrawerRight.value.open=n)}render(){return q` + + + + + + + + `}static get styles(){return o(":host {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n position: relative;\n overflow: hidden;\n}\n\n::slotted(:not([slot])) {\n flex: 1;\n min-height: 0px;\n}")}};e([he({attribute:!1})],LE.prototype,"drawerIcons",void 0),LE=e([le("frigate-card-surround-basic")],LE);let NE=class extends se{_hasDrawer(){return!!this.thumbnailConfig&&["left","right"].includes(this.thumbnailConfig.mode)}willUpdate(e){this.timelineConfig?.mode&&"none"!==this.timelineConfig.mode&&import("./timeline-core-b390cfa1.js");const t=this.viewManagerEpoch?.manager.getView();e.has("viewManagerEpoch")&&(this.viewManagerEpoch?.manager.hasMajorMediaChange(this.viewManagerEpoch?.oldView)||this.viewManagerEpoch?.oldView?.displayMode!==t?.displayMode)&&(this._cameraIDsForTimeline=this._getCameraIDsForTimeline()??void 0)}_getCameraIDsForTimeline(){const e=this.viewManagerEpoch?.manager.getView();if(!e||!this.cameraManager)return null;if(e.is("live")){const t={anyCapabilities:["clips","snapshots","recordings"]};return e.supportsMultipleDisplayModes()&&e.isGrid()?this.cameraManager.getStore().getCameraIDsWithCapability(t):this.cameraManager.getStore().getAllDependentCameras(e.camera,t)}return e.isViewerView()?e.query?.getQueryCameraIDs()??null:null}render(){const e=this.viewManagerEpoch?.manager.getView();if(!this.hass||!e)return;const t=(e,t)=>{this.thumbnailConfig&&this._hasDrawer()&&Bg(e.composedPath()[0],"drawer:"+t,{drawer:this.thumbnailConfig.mode})};return q` t(e,"open")} + @frigate-card:thumbnails:close=${e=>t(e,"close")} + > + ${this.thumbnailConfig&&"none"!==this.thumbnailConfig.mode?q` {const n=e.detail.queryResults.getSelectedResult();n&&(this.viewManagerEpoch?.manager.setViewByParameters({params:{view:"media",queryResults:e.detail.queryResults,...n.getCameraID()&&{camera:n.getCameraID()}},modifiers:[new xE(["timeline","mediaViewer"])]}),t(e,"close"))}} + > + `:""} + ${this.timelineConfig&&"none"!==this.timelineConfig.mode?q` + `:""} + + `}static get styles(){return o(OE)}};e([he({attribute:!1})],NE.prototype,"hass",void 0),e([he({attribute:!1})],NE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1,hasChanged:Qg})],NE.prototype,"thumbnailConfig",void 0),e([he({attribute:!1,hasChanged:Qg})],NE.prototype,"timelineConfig",void 0),e([he({attribute:!1})],NE.prototype,"cameraManager",void 0),e([he({attribute:!1})],NE.prototype,"cardWideConfig",void 0),NE=e([le("frigate-card-surround")],NE);var FE="Fri, 13 Dec 2024 16:12:40 GMT",VE="ed0bb99",HE="Fri, 13 Dec 2024 08:11:26 -0800";const BE=ba.object({domain:ba.string(),version:ba.string().optional()}).passthrough(),qE="hass_web_proxy",UE=(e,t)=>`/api/${qE}/v${t??0}/?url=${encodeURIComponent(e)}`,WE=(e,t,n="media")=>(e=>e.config.components.includes(qE))(e)&&!!t[n];async function ZE(e,t,n){await e.callService(qE,"create_proxied_url",{url_pattern:t,...n&&{url_id:n.urlID,ssl_verification:n.sslVerification,ssl_ciphers:n.sslCiphers,open_limit:n.openLimit,ttl:n.ttl,allow_unauthenticated:n.allowUnauthenticated}})}const QE=async(e,t)=>{let n=null;if(t)try{n=await(async(e,t)=>await $v(e,BE,{type:"manifest/get",integration:t}))(t,e)}catch(e){}return{detected:!!n,...n?.version&&{version:n.version}}};let GE=class extends se{constructor(){super(...arguments),this._diagnostics=null}async _fetchDiagnostics(){this._diagnostics=await(async(e,t,n)=>{const a=e&&t?await t.getMatchingDevices(e,(e=>"Frigate"===e.manufacturer)):[],i=new Map;return a?.forEach((e=>{e.config_entries.forEach((t=>{e.model&&i.set(t,e.model)}))})),{card_version:"6.0.6",browser:navigator.userAgent,date:new Date,lang:F_(),timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,git:{hash:VE,build_date:FE,commit_date:HE},...e&&{ha_version:e.config.version},integrations:{reolink:await QE("reolink",e),frigate:{...await QE("frigate",e),...i.size&&{devices:Object.fromEntries(i)}},hass_web_proxy:await QE(qE,e),motioneye:await QE("motioneye",e)},...n&&{config:n}}})(this.hass,this.deviceRegistryManager,this.rawConfig)}shouldUpdate(){return!!this._diagnostics||(this._fetchDiagnostics().then((()=>this.requestUpdate())),!1)}render(){return xk({message:V_("error.diagnostics"),type:"diagnostics",icon:"mdi:information",context:this._diagnostics})}static get styles(){return o(OE)}};e([he({attribute:!1})],GE.prototype,"hass",void 0),e([he({attribute:!1})],GE.prototype,"deviceRegistryManager",void 0),e([he({attribute:!1})],GE.prototype,"rawConfig",void 0),e([pe()],GE.prototype,"_diagnostics",void 0),GE=e([le("frigate-card-diagnostics")],GE);let YE=class extends se{willUpdate(e){if(e.has("viewManagerEpoch")||e.has("config")){const e=this.viewManagerEpoch?.manager.getView();(e?.is("live")||this._shouldLivePreload())&&import("./index-e610f971.js").then((function(e){return e.i})),e?.isGalleryView()?import("./gallery-9024cb87.js"):e?.isViewerView()?import("./index-76cab2a3.js"):e?.is("image")?import("./image-1c1ebdfa.js"):e?.is("timeline")&&import("./timeline-c3ef17c4.js")}e.has("hide")&&(this.hide?this.setAttribute("hidden",""):this.removeAttribute("hidden"))}shouldUpdate(e){return!0}_shouldLivePreload(){const e=this.viewManagerEpoch?.manager.getView();return!!this.overriddenConfig?.live.preload&&!e?.is("diagnostics")}render(){if(!(this.hass&&this.overriddenConfig&&this.nonOverriddenConfig&&this.cardWideConfig))return q``;const e=this.viewManagerEpoch?.manager.getView(),t={hidden:this._shouldLivePreload()&&!e?.is("live")},n={hidden:!!this.hide},a=e?.is("live")?this.overriddenConfig.live.controls.thumbnails:e?.isViewerView()?this.overriddenConfig.media_viewer.controls.thumbnails:e?.is("timeline")?this.overriddenConfig.timeline.controls.thumbnails:void 0,i=e?.is("live")?this.overriddenConfig.live.controls.timeline:e?.isViewerView()?this.overriddenConfig.media_viewer.controls.timeline:void 0,r=e?this.cameraManager?.getStore().getCameraConfig(e.camera)??null:null;return q` + ${!this.hide&&e?.is("image")&&r?q` + `:""} + ${!this.hide&&e?.isGalleryView()?q` + `:""} + ${!this.hide&&e?.isViewerView()?q` + + + `:""} + ${!this.hide&&e?.is("timeline")?q` + `:""} + ${!this.hide&&e?.is("diagnostics")?q` + `:""} + ${this._shouldLivePreload()||!this.hide&&e?.is("live")?q` + + + `:""} + `}static get styles(){return o(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\n:host([hidden]),\n.hidden {\n display: none;\n}")}};e([he({attribute:!1})],YE.prototype,"hass",void 0),e([he({attribute:!1})],YE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1})],YE.prototype,"cameraManager",void 0),e([he({attribute:!1})],YE.prototype,"nonOverriddenConfig",void 0),e([he({attribute:!1})],YE.prototype,"overriddenConfig",void 0),e([he({attribute:!1})],YE.prototype,"cardWideConfig",void 0),e([he({attribute:!1})],YE.prototype,"rawConfig",void 0),e([he({attribute:!1})],YE.prototype,"resolvedMediaCache",void 0),e([he({attribute:!1})],YE.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],YE.prototype,"hide",void 0),e([he({attribute:!1})],YE.prototype,"microphoneManager",void 0),e([he({attribute:!1})],YE.prototype,"triggeredCameraIDs",void 0),e([he({attribute:!1})],YE.prototype,"deviceRegistryManager",void 0),YE=e([le("frigate-card-views")],YE);console.info(`%c FRIGATE-HASS-CARD \n%c ${V_("common.version")} 6.0.6`,"color: pink; font-weight: bold; background: black","color: white; font-weight: bold; background: dimgray"),window.customCards=window.customCards||[],window.customCards.push({type:"frigate-card",name:V_("common.frigate_card"),description:V_("common.frigate_card_description"),preview:!0,documentationURL:wa});let KE=class extends se{constructor(){super(...arguments),this._controller=new zx(this,(()=>this._refMain.value?.scroll({top:0})),(()=>this._refMenu.value?.toggleMenu()),this._requestUpdateForComponentsThatUseConditions.bind(this)),this._menuButtonController=new Ix,this._refMenu=ze(),this._refOverlay=ze(),this._refMain=ze(),this._refElements=ze(),this._refViews=ze()}get _config(){return this._controller.getConfigManager().getConfig()}get _hass(){return this._controller.getHASSManager().getHASS()}set hass(e){this._controller.getHASSManager().setHASS(e),this._refMenu.value&&(this._refMenu.value.hass=e),this._refElements.value&&(this._refElements.value.hass=e),this._refViews.value&&(this._refViews.value.hass=e)}static async getConfigElement(){return await zx.getConfigElement()}static getStubConfig(e,t){return zx.getStubConfig(t)}_requestUpdateForComponentsThatUseConditions(){this._refViews.value&&(this._refViews.value.conditionsManagerEpoch=this._controller.getConditionsManager().getEpoch()??void 0),this._refElements.value&&(this._refElements.value.conditionsManagerEpoch=this._controller.getConditionsManager().getEpoch()??void 0)}setConfig(e){this._controller.getConfigManager().setConfig(e)}shouldUpdate(){return!!this.isConnected&&(this._controller.getMessageManager().hasMessage()||this._controller.getInitializationManager().isInitializedMandatory()||this._controller.getInitializationManager().initializeMandatory(),!0)}_renderMenuStatusContainer(e){if(!this._config)return;const t=this._config.menu.style,n=this._config.menu.position,a=this._config.status_bar.style,i=this._config.status_bar.position;if("none"===t&&"none"===a||"overlay"===e&&"outside"===t&&"outside"===a||"overlay"!==e&&("outside"!==t||n!==e)&&("outside"!==a||i!==e))return;const r=e=>{const r="none"!==t&&("outside"===t&&"outerlay"===e||"outside"!==t&&"overlay"===e),o="none"!==a&&("outside"===a&&"outerlay"===e||"outside"!==a&&"overlay"===e),s="left"===n||"right"===n||"bottom"===n&&"hidden"===t&&"popup"!==a||"top"===n&&("hidden"!==t||"popup"===a);return q` + ${r&&s?this._renderMenu(n):""} + ${o?this._renderStatusBar(i):""} + ${r&&!s?this._renderMenu(n):""} + `};return q` + ${"overlay"===e?q`${r("overlay")}`:q`
+ ${r("outerlay")} +
`} + `}_renderMenu(e){const t=this._controller.getViewManager().getView();if(this._hass&&this._config)return q` + + `}_renderStatusBar(e){if(this._config)return q` + + `}updated(){this._controller.getInitializationManager().isInitializedMandatory()&&this._controller.getQueryStringManager().executeIfNecessary()}_renderInDialogIfNecessary(e){return this._controller.getExpandManager().isExpanded()?q` {this._controller.getExpandManager().setExpanded(!1)}} + > + ${e} + `:e}render(){if(!this._hass)return;const e={main:!0,"curve-top":"outside"!==this._config?.menu.style||"top"!==this._config?.menu.position,"curve-bottom":"outside"!==this._config?.menu.style||"top"===this._config?.menu.position},t=this._controller.getActionsManager().getMergedActions(),n=this._controller.getCameraManager(),a=!1!==this._config?.performance?.features.animated_progress_indicator&&!this._controller.getInitializationManager().wasEverInitialized()&&!this._controller.getMessageManager().hasMessage();return this._renderInDialogIfNecessary(q` this._controller.getMessageManager().setMessageIfHigherPriority(e.detail)} + @frigate-card:media:loaded=${e=>this._controller.getMediaLoadedInfoManager().set(e.detail)} + @frigate-card:media:unloaded=${()=>this._controller.getMediaLoadedInfoManager().clear()} + @frigate-card:media:volumechange=${()=>this.requestUpdate()} + @frigate-card:media:play=${()=>this.requestUpdate()} + @frigate-card:media:pause=${()=>this.requestUpdate()} + @frigate-card:focus=${()=>this.focus()} + > + ${a?q``:""} + ${this._renderMenuStatusContainer("top")} + ${this._renderMenuStatusContainer("overlay")} +
+ + ${xk(this._controller.getMessageManager().getMessage())} +
+ ${this._renderMenuStatusContainer("bottom")} + ${this._config?.elements?q` {this._menuButtonController.addDynamicMenuButton(e.detail),this.requestUpdate()}} + @frigate-card:menu:remove=${e=>{this._menuButtonController.removeDynamicMenuButton(e.detail),this.requestUpdate()}} + @frigate-card:status-bar:add=${e=>{this._controller.getStatusBarItemManager().addDynamicStatusBarItem(e.detail)}} + @frigate-card:status-bar:remove=${e=>{this._controller.getStatusBarItemManager().removeDynamicStatusBarItem(e.detail)}} + @frigate-card:conditions:evaluate=${e=>{e.evaluation=this._controller.getConditionsManager()?.evaluateConditions(e.conditions)}} + > + `:""} +
`)}static get styles(){return o(':host {\n display: block;\n position: relative;\n background-color: var(--card-background-color);\n border-radius: var(--ha-card-border-radius, 4px);\n height: var(--frigate-card-height);\n min-height: 100px;\n pointer-events: all;\n --frigate-card-expand-max-height: calc((100vh - (2 * 56px)) * 0.85);\n --frigate-card-expand-max-width: 85vw;\n --frigate-card-expand-width: none;\n --frigate-card-expand-height: none;\n --frigate-card-expand-aspect-ratio: unset;\n --frigate-card-height: auto;\n}\n\nfrigate-card-loading {\n position: absolute;\n inset: 0;\n z-index: 1;\n}\n\n:host([dark]) {\n filter: brightness(75%);\n}\n\n:host([panel]:not([casted])) {\n height: calc(100vh - var(--header-height));\n}\n\n:host([panel][casted]) {\n height: 100%;\n}\n\ndiv.main {\n position: relative;\n overflow: auto;\n width: 100%;\n height: 100%;\n margin: auto;\n display: block;\n transform: translateZ(0);\n scrollbar-width: none;\n -ms-overflow-style: none;\n}\n\n/* Hide scrollbar for Chrome, Safari and Opera */\ndiv.main::-webkit-scrollbar {\n display: none;\n}\n\ndiv.main.curve-top {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\ndiv.main.curve-bottom {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}\n\nha-card {\n display: flex;\n flex-direction: column;\n margin: auto;\n border: 0px;\n overflow: visible;\n width: 100%;\n height: 100%;\n position: static;\n color: var(--secondary-text-color, white);\n}\n\n/************\n * Fullscreen\n *************/\n:host(:fullscreen) #ha-card {\n border-radius: 0px;\n box-shadow: none;\n margin: 0;\n}\n\n:host(:-webkit-full-screen) #ha-card {\n border-radius: 0px;\n box-shadow: none;\n margin: 0;\n}\n\n:host(:fullscreen) div.main,\n:host(:fullscreen) frigate-card-menu {\n border-radius: 0px;\n}\n\n:host(:-webkit-full-screen) div.main,\n:host(:-webkit-full-screen) frigate-card-menu {\n border-radius: 0px;\n}\n\n/***************\n * Expanded mode\n ***************/\nweb-dialog {\n --dialog-padding: 0px;\n --dialog-container-padding: 0px;\n --dialog-max-height: var(--frigate-card-expand-max-height);\n --dialog-max-width: var(--frigate-card-expand-max-width);\n --dialog-width: var(--frigate-card-expand-width);\n --dialog-height: var(--frigate-card-expand-height);\n --dialog-overflow-x: visible;\n --dialog-overflow-y: visible;\n max-height: 100vh;\n}\n\nweb-dialog::part(dialog) {\n aspect-ratio: var(--frigate-card-expand-aspect-ratio);\n border-radius: 0px;\n background: transparent;\n}\n\n/*************************************\n * "Outside" style for menu/status bar\n *************************************/\n.outerlay[data-position=top] > *:first-child {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n.outerlay[data-position=bottom] > *:last-child {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n/*******************\n * Menu hover styles\n *******************/\nfrigate-card-menu {\n z-index: 2;\n}\n\nfrigate-card-menu[data-style*=hover] {\n transition: opacity 0.5s ease;\n opacity: 0;\n}\n\nfrigate-card-menu[data-style*=hover]:hover,\nha-card:hover > frigate-card-overlay > frigate-card-menu[data-style=hover-card] {\n opacity: 1;\n}\n\n/*************************\n * Status bar hover styles\n *************************/\nfrigate-card-status-bar {\n z-index: 1;\n}\n\nfrigate-card-status-bar[data-style*=hover] {\n transition: opacity 0.5s ease;\n opacity: 0;\n}\n\nfrigate-card-status-bar[data-style*=hover]:hover,\nha-card:hover > frigate-card-overlay > frigate-card-status-bar[data-style=hover-card] {\n opacity: 1;\n}')}getCardSize(){return 6}};KE=e([le("frigate-card")],KE);export{Il as $,tr as A,nr as B,Zi as C,ar as D,ir as E,rr as F,Pi as G,Li as H,Ni as I,Fi as J,Vi as K,Hi as L,Bi as M,qi as N,Ui as O,gs as P,Ws as Q,ns as R,Us as S,qo as T,Fo as U,Vo as V,Ho as W,Bo as X,Bs as Y,zl as Z,e as _,se as a,dr as a$,H_ as a0,nw as a1,et as a2,aw as a3,$s as a4,Di as a5,ji as a6,Oi as a7,Ri as a8,Wi as a9,Yr as aA,oo as aB,so as aC,lo as aD,uo as aE,co as aF,ao as aG,io as aH,ro as aI,mo as aJ,_o as aK,vo as aL,ho as aM,po as aN,fo as aO,go as aP,eo as aQ,no as aR,to as aS,Xr as aT,Jr as aU,Kr as aV,Ao as aW,Io as aX,zo as aY,hr as aZ,cr as a_,es as aa,Jo as ab,Xo as ac,ts as ad,hs as ae,us as af,ms as ag,qs as ah,ps as ai,So as aj,Co as ak,To as al,Mo as am,ko as an,qr as ao,Ur as ap,Wr as aq,Zr as ar,Eo as as,$o as at,yo as au,xo as av,bo as aw,wo as ax,Qr as ay,Gr as az,pe as b,ja as b$,ur as b0,lr as b1,sr as b2,mr as b3,gr as b4,fr as b5,_r as b6,xr as b7,Hr as b8,Cr as b9,Po as bA,Wo as bB,Zo as bC,Go as bD,Yo as bE,Qo as bF,Uo as bG,vs as bH,_s as bI,ys as bJ,xs as bK,Cs as bL,As as bM,Ms as bN,Es as bO,Ss as bP,ew as bQ,Xb as bR,Wk as bS,Ug as bT,Ma as bU,Ja as bV,Ya as bW,La as bX,Na as bY,ka as bZ,Oa as b_,kr as ba,Mr as bb,vr as bc,wr as bd,yr as be,br as bf,Sr as bg,Er as bh,$r as bi,Or as bj,zr as bk,Tr as bl,jr as bm,Ir as bn,Ar as bo,Pr as bp,Fr as bq,Vr as br,Dr as bs,Rr as bt,Nr as bu,Lr as bv,Ro as bw,Lo as bx,Oo as by,Do as bz,tw as c,wf as c$,Da as c0,Ta as c1,Ga as c2,Ua as c3,Wa as c4,Za as c5,Qa as c6,_i as c7,fi as c8,Ra as c9,ai as cA,ii as cB,Sa as cC,Ea as cD,pi as cE,hi as cF,gi as cG,mi as cH,Fd as cI,Ca as cJ,ks as cK,ge as cL,fe as cM,W as cN,xe as cO,Yw as cP,kk as cQ,ze as cR,Kw as cS,df as cT,xk as cU,je as cV,Qg as cW,yw as cX,td as cY,Sk as cZ,Ky as c_,Pa as ca,Ha as cb,qa as cc,Fa as cd,Va as ce,Ba as cf,Ka as cg,Xa as ch,ti as ci,ei as cj,yi as ck,vi as cl,bi as cm,wi as cn,$a as co,Aa as cp,za as cq,Ia as cr,ni as cs,ri as ct,oi as cu,si as cv,ci as cw,li as cx,di as cy,ui as cz,iw as d,ba as d$,My as d0,ve as d1,OE as d2,Vd as d3,nu as d4,c as d5,hx as d6,Qv as d7,px as d8,dx as d9,xx as dA,Mk as dB,U as dC,xf as dD,qw as dE,SE as dF,ME as dG,yf as dH,Vk as dI,vf as dJ,kf as dK,bf as dL,p_ as dM,h_ as dN,Pv as dO,Lv as dP,Ud as dQ,Vv as dR,Yg as dS,Kg as dT,Mx as dU,Gy as dV,fx as dW,su as dX,sf as dY,Fv as dZ,Hg as d_,mx as da,Gg as db,Ev as dc,Wu as dd,Xg as de,Qu as df,Bg as dg,Uw as dh,af as di,EE as dj,Sx as dk,Ck as dl,Aw as dm,nx as dn,hy as dp,qb as dq,Ub as dr,WE as ds,ZE as dt,Tb as du,UE as dv,Gw as dw,Xw as dx,Jw as dy,ex as dz,_e as e,nf as e0,$v as e1,zs as e2,Kv as e3,Wv as e4,Z_ as e5,Q_ as e6,Yv as e7,Jg as e8,tf as e9,Lu as eA,Hb as eB,Zv as eC,Fb as eD,lf as eE,qy as eF,Uy as eG,Wy as eH,pf as eI,Qy as eJ,Rg as eK,Zy as eL,s as eM,Ae as eN,ye as eO,Qw as eP,wE as eQ,me as eR,be as eS,Ob as eT,Gv as ea,Bk as eb,Hv as ec,rf as ed,Tv as ee,qk as ef,Iv as eg,zv as eh,jv as ei,Uk as ej,Xd as ek,Hd as el,Gd as em,Qd as en,Yd as eo,vu as ep,Jd as eq,eu as er,yu as es,_u as et,Bd as eu,au as ev,gu as ew,Ou as ex,Nu as ey,Fu as ez,xw as f,Vb as g,Jb as h,Dv as i,Nb as j,qg as k,V_ as l,Ki as m,he as n,Gi as o,Ld as p,Qi as q,o as r,of as s,le as t,Yi as u,Bb as v,Xi as w,q as x,er as y,Ji as z}; diff --git a/config/www/community/frigate-hass-card/card-09c4bade.js.gz b/config/www/community/frigate-hass-card/card-09c4bade.js.gz new file mode 100644 index 00000000..04e91a72 Binary files /dev/null and b/config/www/community/frigate-hass-card/card-09c4bade.js.gz differ diff --git a/config/www/community/frigate-hass-card/card-320adb66.js b/config/www/community/frigate-hass-card/card-320adb66.js new file mode 100644 index 00000000..28d66bb8 --- /dev/null +++ b/config/www/community/frigate-hass-card/card-320adb66.js @@ -0,0 +1,650 @@ +function e(e,t,n,a){var i,r=arguments.length,o=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,n):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,a);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(r<3?i(o):r>3?i(t,n,o):i(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o}"function"==typeof SuppressedError&&SuppressedError; +/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const t=globalThis,n=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,a=Symbol(),i=new WeakMap;let r=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==a)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(n&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=i.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&i.set(t,e))}return e}toString(){return this.cssText}};const o=e=>new r("string"==typeof e?e:e+"",void 0,a),s=(e,...t)=>{const n=1===e.length?e[0]:t.reduce(((t,n,a)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+e[a+1]),e[0]);return new r(n,e,a)},c=(e,a)=>{if(n)e.adoptedStyleSheets=a.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(const n of a){const a=document.createElement("style"),i=t.litNonce;void 0!==i&&a.setAttribute("nonce",i),a.textContent=n.cssText,e.appendChild(a)}},l=n?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return o(t)})(e):e +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,{is:d,defineProperty:u,getOwnPropertyDescriptor:h,getOwnPropertyNames:p,getOwnPropertySymbols:m,getPrototypeOf:g}=Object,f=globalThis,_=f.trustedTypes,y=_?_.emptyScript:"",v=f.reactiveElementPolyfillSupport,b=(e,t)=>e,w={toAttribute(e,t){switch(t){case Boolean:e=e?y:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},x=(e,t)=>!d(e,t),C={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:x};Symbol.metadata??=Symbol("metadata"),f.litPropertyMetadata??=new WeakMap;class M extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=C){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){const n=Symbol(),a=this.getPropertyDescriptor(e,n,t);void 0!==a&&u(this.prototype,e,a)}}static getPropertyDescriptor(e,t,n){const{get:a,set:i}=h(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get(){return a?.call(this)},set(t){const r=a?.call(this);i.call(this,t),this.requestUpdate(e,r,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??C}static _$Ei(){if(this.hasOwnProperty(b("elementProperties")))return;const e=g(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(b("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(b("properties"))){const e=this.properties,t=[...p(e),...m(e)];for(const n of t)this.createProperty(n,e[n])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const n=this._$Eu(e,t);void 0!==n&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(l(e))}else void 0!==e&&t.push(l(e));return t}static _$Eu(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((e=>e(this)))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return c(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((e=>e.hostConnected?.()))}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach((e=>e.hostDisconnected?.()))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EC(e,t){const n=this.constructor.elementProperties.get(e),a=this.constructor._$Eu(e,n);if(void 0!==a&&!0===n.reflect){const i=(void 0!==n.converter?.toAttribute?n.converter:w).toAttribute(t,n.type);this._$Em=e,null==i?this.removeAttribute(a):this.setAttribute(a,i),this._$Em=null}}_$AK(e,t){const n=this.constructor,a=n._$Eh.get(e);if(void 0!==a&&this._$Em!==a){const e=n.getPropertyOptions(a),i="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:w;this._$Em=a,this[a]=i.fromAttribute(t,e.type),this._$Em=null}}requestUpdate(e,t,n){if(void 0!==e){if(n??=this.constructor.getPropertyOptions(e),!(n.hasChanged??x)(this[e],t))return;this.P(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(e,t,n){this._$AL.has(e)||this._$AL.set(e,t),!0===n.reflect&&this._$Em!==e&&(this._$Ej??=new Set).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,n]of e)!0!==n.wrapped||this._$AL.has(t)||void 0===this[t]||this.P(t,this[t],n)}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach((e=>e.hostUpdate?.())),this.update(t)):this._$EU()}catch(t){throw e=!1,this._$EU(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&=this._$Ej.forEach((e=>this._$EC(e,this[e]))),this._$EU()}updated(e){}firstUpdated(e){}}M.elementStyles=[],M.shadowRootOptions={mode:"open"},M[b("elementProperties")]=new Map,M[b("finalized")]=new Map,v?.({ReactiveElement:M}),(f.reactiveElementVersions??=[]).push("2.0.4"); +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const k=globalThis,S=k.trustedTypes,E=S?S.createPolicy("lit-html",{createHTML:e=>e}):void 0,$="$lit$",A=`lit$${(Math.random()+"").slice(9)}$`,I="?"+A,z=`<${I}>`,T=document,j=()=>T.createComment(""),O=e=>null===e||"object"!=typeof e&&"function"!=typeof e,D=Array.isArray,R="[ \t\n\f\r]",P=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,L=/-->/g,N=/>/g,F=RegExp(`>|${R}(?:([^\\s"'>=/]+)(${R}*=${R}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),V=/'/g,H=/"/g,B=/^(?:script|style|textarea|title)$/i,q=(e=>(t,...n)=>({_$litType$:e,strings:t,values:n}))(1),U=Symbol.for("lit-noChange"),W=Symbol.for("lit-nothing"),Z=new WeakMap,Q=T.createTreeWalker(T,129);function G(e,t){if(!Array.isArray(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==E?E.createHTML(t):t}const Y=(e,t)=>{const n=e.length-1,a=[];let i,r=2===t?"":"",o=P;for(let t=0;t"===c[0]?(o=i??P,l=-1):void 0===c[1]?l=-2:(l=o.lastIndex-c[2].length,s=c[1],o=void 0===c[3]?F:'"'===c[3]?H:V):o===H||o===V?o=F:o===L||o===N?o=P:(o=F,i=void 0);const u=o===F&&e[t+1].startsWith("/>")?" ":"";r+=o===P?n+z:l>=0?(a.push(s),n.slice(0,l)+$+n.slice(l)+A+u):n+A+(-2===l?t:u)}return[G(e,r+(e[n]||"")+(2===t?"":"")),a]};class K{constructor({strings:e,_$litType$:t},n){let a;this.parts=[];let i=0,r=0;const o=e.length-1,s=this.parts,[c,l]=Y(e,t);if(this.el=K.createElement(c,n),Q.currentNode=this.el.content,2===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(a=Q.nextNode())&&s.length0){a.textContent=S?S.emptyScript:"";for(let n=0;nD(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}S(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.S(e))}_(e){this._$AH!==W&&O(this._$AH)?this._$AA.nextSibling.data=e:this.T(T.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:n}=e,a="number"==typeof n?this._$AC(e):(void 0===n.el&&(n.el=K.createElement(G(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===a)this._$AH.p(t);else{const e=new J(a,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=Z.get(e.strings);return void 0===t&&Z.set(e.strings,t=new K(e)),t}k(e){D(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,a=0;for(const i of e)a===t.length?t.push(n=new ee(this.S(j()),this.S(j()),this,this.options)):n=t[a],n._$AI(i),a++;a2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=W}_$AI(e,t=this,n,a){const i=this.strings;let r=!1;if(void 0===i)e=X(this,e,t,0),r=!O(e)||e!==this._$AH&&e!==U,r&&(this._$AH=e);else{const a=e;let o,s;for(e=i[0],o=0;o{const a=n?.renderBefore??t;let i=a._$litPart$;if(void 0===i){const e=n?.renderBefore??null;a._$litPart$=i=new ee(t.insertBefore(j(),e),e,void 0,n??{})}return i._$AI(e),i})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return U}};se._$litElement$=!0,se.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:se});const ce=globalThis.litElementPolyfillSupport;ce?.({LitElement:se}),(globalThis.litElementVersions??=[]).push("4.0.4"); +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const le=e=>(t,n)=>{void 0!==n?n.addInitializer((()=>{customElements.define(e,t)})):customElements.define(e,t)} +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,de={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:x},ue=(e=de,t,n)=>{const{kind:a,metadata:i}=n;let r=globalThis.litPropertyMetadata.get(i);if(void 0===r&&globalThis.litPropertyMetadata.set(i,r=new Map),r.set(n.name,e),"accessor"===a){const{name:a}=n;return{set(n){const i=t.get.call(this);t.set.call(this,n),this.requestUpdate(a,i,e)},init(t){return void 0!==t&&this.P(a,void 0,e),t}}}if("setter"===a){const{name:a}=n;return function(n){const i=this[a];t.call(this,n),this.requestUpdate(a,i,e)}}throw Error("Unsupported decorator location: "+a)};function he(e){return(t,n)=>"object"==typeof n?ue(e,t,n):((e,t,n)=>{const a=t.hasOwnProperty(n);return t.constructor.createProperty(n,a?{...e,wrapped:!0}:e),a?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n) +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */}function pe(e){return he({...e,state:!0,attribute:!1})} +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const me={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},ge=e=>(...t)=>({_$litDirective$:e,values:t});let fe=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}; +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const _e=ge(class extends fe{constructor(e){if(super(e),e.type!==me.ATTRIBUTE||"class"!==e.name||e.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter((t=>e[t])).join(" ")+" "}update(e,[t]){if(void 0===this.st){this.st=new Set,void 0!==e.strings&&(this.nt=new Set(e.strings.join(" ").split(/\s/).filter((e=>""!==e))));for(const e in t)t[e]&&!this.nt?.has(e)&&this.st.add(e);return this.render(t)}const n=e.element.classList;for(const e of this.st)e in t||(n.remove(e),this.st.delete(e));for(const e in t){const a=!!t[e];a===this.st.has(e)||this.nt?.has(e)||(a?(n.add(e),this.st.add(e)):(n.remove(e),this.st.delete(e)))}return U}}),ye=e=>e??W +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,ve=e=>null===e||"object"!=typeof e&&"function"!=typeof e,be=e=>void 0===e.strings,we={},xe=(e,t=we)=>e._$AH=t +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,Ce=(e,t)=>{const n=e._$AN;if(void 0===n)return!1;for(const e of n)e._$AO?.(t,!1),Ce(e,t);return!0},Me=e=>{let t,n;do{if(void 0===(t=e._$AM))break;n=t._$AN,n.delete(e),e=t}while(0===n?.size)},ke=e=>{for(let t;t=e._$AM;e=t){let n=t._$AN;if(void 0===n)t._$AN=n=new Set;else if(n.has(e))break;n.add(e),$e(t)}}; +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */function Se(e){void 0!==this._$AN?(Me(this),this._$AM=e,ke(this)):this._$AM=e}function Ee(e,t=!1,n=0){const a=this._$AH,i=this._$AN;if(void 0!==i&&0!==i.size)if(t)if(Array.isArray(a))for(let e=n;e{e.type==me.CHILD&&(e._$AP??=Ee,e._$AQ??=Se)};class Ae extends fe{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,n){super._$AT(e,t,n),ke(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(Ce(this,e),Me(this))}setValue(e){if(be(this._$Ct))this._$Ct._$AI(e,this);else{const t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}} +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const Ie=()=>new ze;let ze=class{};const Te=new WeakMap,je=ge(class extends Ae{render(e){return W}update(e,[t]){const n=t!==this.Y;return n&&void 0!==this.Y&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.Y=t,this.ht=e.options?.host,this.rt(this.ct=e.element)),W}rt(e){if("function"==typeof this.Y){const t=this.ht??globalThis;let n=Te.get(t);void 0===n&&(n=new WeakMap,Te.set(t,n)),void 0!==n.get(this.Y)&&this.Y.call(this.ht,void 0),n.set(this.Y,e),void 0!==e&&this.Y.call(this.ht,e)}else this.Y.value=e}get lt(){return"function"==typeof this.Y?Te.get(this.ht??globalThis)?.get(this.Y):this.Y?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}}),Oe="important",De=" !"+Oe,Re=ge(class extends fe{constructor(e){if(super(e),e.type!==me.ATTRIBUTE||"style"!==e.name||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce(((t,n)=>{const a=e[n];return null==a?t:t+`${n=n.includes("-")?n:n.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${a};`}),"")}update(e,[t]){const{style:n}=e.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(t)),this.render(t);for(const e of this.ft)null==t[e]&&(this.ft.delete(e),e.includes("-")?n.removeProperty(e):n[e]=null);for(const e in t){const a=t[e];if(null!=a){this.ft.add(e);const t="string"==typeof a&&a.endsWith(De);e.includes("-")||t?n.setProperty(e,t?a.slice(0,-11):a,t?Oe:""):n[e]=a}}return U}}); +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */function Pe(e,t,n,a=20,i=0){let r=[];if(i>=a)return r;const o=e=>{const r=e.assignedNodes().filter((e=>1===e.nodeType));return r.length>0?Pe(r[0].parentElement,t,n,a,i+1):[]},s=Array.from(e.children||[]);for(const e of s)t(e)||(n(e)&&r.push(e),null!=e.shadowRoot?r.push(...Pe(e.shadowRoot,t,n,a,i+1)):"SLOT"===e.tagName?r.push(...o(e)):r.push(...Pe(e,t,n,a,i+1)));return r}function Le(e){return e.hasAttribute("hidden")||e.hasAttribute("aria-hidden")&&"false"!==e.getAttribute("aria-hidden")||"none"===e.style.display||"0"===e.style.opacity||"hidden"===e.style.visibility||"collapse"===e.style.visibility}function Ne(e){return"-1"!==e.getAttribute("tabindex")&&!Le(e)&&!function(e){return e.hasAttribute("disabled")||e.hasAttribute("aria-disabled")&&"false"!==e.getAttribute("aria-disabled")}(e)&&(e.hasAttribute("tabindex")||(e instanceof HTMLAnchorElement||e instanceof HTMLAreaElement)&&e.hasAttribute("href")||e instanceof HTMLButtonElement||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e instanceof HTMLIFrameElement)}const Fe=new Map;const Ve=document.createElement("template");Ve.innerHTML='\n\t
\n\t
\n\t\n\t
\n';class He extends HTMLElement{constructor(){super(),this.debounceId=Math.random().toString(),this._focused=!1;const e=this.attachShadow({mode:"open"});e.appendChild(Ve.content.cloneNode(!0)),this.$backup=e.querySelector("#backup"),this.$start=e.querySelector("#start"),this.$end=e.querySelector("#end"),this.focusLastElement=this.focusLastElement.bind(this),this.focusFirstElement=this.focusFirstElement.bind(this),this.onFocusIn=this.onFocusIn.bind(this),this.onFocusOut=this.onFocusOut.bind(this)}static get observedAttributes(){return["inactive"]}get inactive(){return this.hasAttribute("inactive")}set inactive(e){e?this.setAttribute("inactive",""):this.removeAttribute("inactive")}get focused(){return this._focused}connectedCallback(){this.$start.addEventListener("focus",this.focusLastElement),this.$end.addEventListener("focus",this.focusFirstElement),this.addEventListener("focusin",this.onFocusIn),this.addEventListener("focusout",this.onFocusOut),this.render()}disconnectedCallback(){this.$start.removeEventListener("focus",this.focusLastElement),this.$end.removeEventListener("focus",this.focusFirstElement),this.removeEventListener("focusin",this.onFocusIn),this.removeEventListener("focusout",this.onFocusOut)}attributeChangedCallback(){this.render()}focusFirstElement(){this.trapFocus()}focusLastElement(){this.trapFocus(!0)}getFocusableElements(){return Pe(this,Le,Ne)}trapFocus(e){if(this.inactive)return;let t=this.getFocusableElements();t.length>0?(e?t[t.length-1].focus():t[0].focus(),this.$backup.setAttribute("tabindex","-1")):(this.$backup.setAttribute("tabindex","0"),this.$backup.focus())}onFocusIn(){this.updateFocused(!0)}onFocusOut(){this.updateFocused(!1)}updateFocused(e){!function(e,t,n){const a=Fe.get(n);null!=a&&window.clearTimeout(a),Fe.set(n,window.setTimeout((()=>{e(),Fe.delete(n)}),t))}((()=>{this.focused!==e&&(this._focused=e,this.render())}),0,this.debounceId)}render(){this.$start.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.$end.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.focused?this.setAttribute("focused",""):this.removeAttribute("focused")}}function Be(e){return Number(e.getAttribute("data-dialog-count"))||0}function qe(e,t){e.setAttribute("data-dialog-count",t.toString())}function Ue(e=document.activeElement){return null!=e&&null!=e.shadowRoot&&null!=e.shadowRoot.activeElement?Ue(e.shadowRoot.activeElement):e}window.customElements.define("focus-trap",He);const We=document.createElement("template");We.innerHTML='\n \n
\n \n \n \n';class Ze extends HTMLElement{constructor(){super(),this.$scrollContainer=document.documentElement,this.$previousActiveElement=null;const e=this.attachShadow({mode:"open"});e.appendChild(We.content.cloneNode(!0)),this.$dialog=e.querySelector("#dialog"),this.$backdrop=e.querySelector("#backdrop"),this.onBackdropClick=this.onBackdropClick.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.setAttribute("aria-modal","true"),this.$dialog.setAttribute("role","alertdialog")}static get observedAttributes(){return["open","center"]}get open(){return this.hasAttribute("open")}set open(e){e?this.setAttribute("open",""):this.removeAttribute("open")}get center(){return this.hasAttribute("center")}set center(e){e?this.setAttribute("center",""):this.removeAttribute("center")}connectedCallback(){this.$backdrop.addEventListener("click",this.onBackdropClick)}disconnectedCallback(){this.$backdrop.removeEventListener("click",this.onBackdropClick),this.open&&this.didClose()}show(){this.open=!0}close(e){this.result=e,this.open=!1}onBackdropClick(){this.assertClosing()&&this.close()}onKeyDown(e){if("Escape"===e.code)this.assertClosing()&&(this.close(),e.stopImmediatePropagation())}assertClosing(){return this.dispatchEvent(new CustomEvent("closing",{cancelable:!0}))}didOpen(){this.$previousActiveElement=Ue(document.activeElement),requestAnimationFrame((()=>{this.$dialog.focusFirstElement()})),this.tabIndex=0,this.$scrollContainer.style.overflow="hidden",this.addEventListener("keydown",this.onKeyDown,{capture:!0,passive:!0}),qe(this.$scrollContainer,Be(this.$scrollContainer)+1),this.dispatchEvent(new CustomEvent("open"))}didClose(){this.removeEventListener("keydown",this.onKeyDown,{capture:!0}),qe(this.$scrollContainer,Math.max(0,Be(this.$scrollContainer)-1)),Be(this.$scrollContainer)<=0&&(this.$scrollContainer.style.overflow=""),this.tabIndex=-1,null!=this.$previousActiveElement&&(this.$previousActiveElement.focus(),this.$previousActiveElement=null),this.dispatchEvent(new CustomEvent("close",{detail:this.result}))}attributeChangedCallback(e,t,n){if("open"===e)this.open?this.didOpen():this.didClose()}}var Qe,Ge;function Ye(e){return e.substr(0,e.indexOf("."))}customElements.define("web-dialog",Ze),function(e){e.language="language",e.system="system",e.comma_decimal="comma_decimal",e.decimal_comma="decimal_comma",e.space_comma="space_comma",e.none="none"}(Qe||(Qe={})),function(e){e.language="language",e.system="system",e.am_pm="12",e.twenty_four="24"}(Ge||(Ge={}));var Ke,Xe,Je=["closed","locked","off"],et=function(e,t,n,a){a=a||{},n=null==n?{}:n;var i=new Event(t,{bubbles:void 0===a.bubbles||a.bubbles,cancelable:Boolean(a.cancelable),composed:void 0===a.composed||a.composed});return i.detail=n,e.dispatchEvent(i),i},tt=function(e){et(window,"haptic",e)},nt=function(e,t){return function(e,t,n){void 0===n&&(n=!0);var a,i=Ye(t),r="group"===i?"homeassistant":i;switch(i){case"lock":a=n?"unlock":"lock";break;case"cover":a=n?"open_cover":"close_cover";break;default:a=n?"turn_on":"turn_off"}return e.callService(r,a,{entity_id:t})}(e,t,Je.includes(e.states[t].state))},at=function(e,t,n,a){if(a||(a={action:"more-info"}),!a.confirmation||a.confirmation.exemptions&&a.confirmation.exemptions.some((function(e){return e.user===t.user.id}))||(tt("warning"),confirm(a.confirmation.text||"Are you sure you want to "+a.action+"?")))switch(a.action){case"more-info":(n.entity||n.camera_image)&&et(e,"hass-more-info",{entityId:n.entity?n.entity:n.camera_image});break;case"navigate":a.navigation_path&&function(e,t,n){void 0===n&&(n=!1),n?history.replaceState(null,"",t):history.pushState(null,"",t),et(window,"location-changed",{replace:n})}(0,a.navigation_path);break;case"url":a.url_path&&window.open(a.url_path);break;case"toggle":n.entity&&(nt(t,n.entity),tt("success"));break;case"perform-action":if(!a.perform_action)return void tt("failure");var i=a.perform_action.split(".",2);t.callService(i[0],i[1],a.data,a.target),tt("success");break;case"call-service":if(!a.service)return void tt("failure");var r=a.service.split(".",2);t.callService(r[0],r[1],a.data,a.target),tt("success");break;case"fire-dom-event":et(e,"ll-custom",a)}};!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},e.getValidEnumValues=t=>{const n=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),a={};for(const e of n)a[e]=t[e];return e.objectValues(a)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(const n of e)if(t(n))return n},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(Ke||(Ke={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(Xe||(Xe={}));const it=Ke.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),rt=e=>{switch(typeof e){case"undefined":return it.undefined;case"string":return it.string;case"number":return isNaN(e)?it.nan:it.number;case"boolean":return it.boolean;case"function":return it.function;case"bigint":return it.bigint;case"symbol":return it.symbol;case"object":return Array.isArray(e)?it.array:null===e?it.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?it.promise:"undefined"!=typeof Map&&e instanceof Map?it.map:"undefined"!=typeof Set&&e instanceof Set?it.set:"undefined"!=typeof Date&&e instanceof Date?it.date:it.object;default:return it.unknown}},ot=Ke.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class st extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},n={_errors:[]},a=e=>{for(const i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(a);else if("invalid_return_type"===i.code)a(i.returnTypeError);else if("invalid_arguments"===i.code)a(i.argumentsError);else if(0===i.path.length)n._errors.push(t(i));else{let e=n,a=0;for(;ae.message)){const t={},n=[];for(const a of this.issues)a.path.length>0?(t[a.path[0]]=t[a.path[0]]||[],t[a.path[0]].push(e(a))):n.push(e(a));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}st.create=e=>new st(e);const ct=(e,t)=>{let n;switch(e.code){case ot.invalid_type:n=e.received===it.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case ot.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Ke.jsonStringifyReplacer)}`;break;case ot.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ke.joinValues(e.keys,", ")}`;break;case ot.invalid_union:n="Invalid input";break;case ot.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ke.joinValues(e.options)}`;break;case ot.invalid_enum_value:n=`Invalid enum value. Expected ${Ke.joinValues(e.options)}, received '${e.received}'`;break;case ot.invalid_arguments:n="Invalid function arguments";break;case ot.invalid_return_type:n="Invalid function return type";break;case ot.invalid_date:n="Invalid date";break;case ot.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Ke.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case ot.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case ot.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case ot.custom:n="Invalid input";break;case ot.invalid_intersection_types:n="Intersection results could not be merged";break;case ot.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case ot.not_finite:n="Number must be finite";break;default:n=t.defaultError,Ke.assertNever(e)}return{message:n}};let lt=ct;function dt(){return lt}const ut=e=>{const{data:t,path:n,errorMaps:a,issueData:i}=e,r=[...n,...i.path||[]],o={...i,path:r};if(void 0!==i.message)return{...i,path:r,message:i.message};let s="";const c=a.filter((e=>!!e)).slice().reverse();for(const e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:r,message:s}};function ht(e,t){const n=dt(),a=ut({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===ct?void 0:ct].filter((e=>!!e))});e.common.issues.push(a)}class pt{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const a of t){if("aborted"===a.status)return mt;"dirty"===a.status&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const e of t){const t=await e.key,a=await e.value;n.push({key:t,value:a})}return pt.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const a of t){const{key:t,value:i}=a;if("aborted"===t.status)return mt;if("aborted"===i.status)return mt;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"===t.value||void 0===i.value&&!a.alwaysSet||(n[t.value]=i.value)}return{status:e.value,value:n}}}const mt=Object.freeze({status:"aborted"}),gt=e=>({status:"dirty",value:e}),ft=e=>({status:"valid",value:e}),_t=e=>"aborted"===e.status,yt=e=>"dirty"===e.status,vt=e=>"valid"===e.status,bt=e=>"undefined"!=typeof Promise&&e instanceof Promise;function wt(e,t,n,a){if("a"===n&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?a:"a"===n?a.call(e):a?a.value:t.get(e)}function xt(e,t,n,a,i){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?i.call(e,n):i?i.value=n:t.set(e,n),n}var Ct,Mt,kt;"function"==typeof SuppressedError&&SuppressedError,function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(Ct||(Ct={}));class St{constructor(e,t,n,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=a}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Et=(e,t)=>{if(vt(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new st(e.common.issues);return this._error=t,this._error}}};function $t(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:a,description:i}=e;if(t&&(n||a))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:i};return{errorMap:(t,i)=>{var r,o;const{message:s}=e;return"invalid_enum_value"===t.code?{message:null!=s?s:i.defaultError}:void 0===i.data?{message:null!==(r=null!=s?s:a)&&void 0!==r?r:i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:null!==(o=null!=s?s:n)&&void 0!==o?o:i.defaultError}},description:i}}class At{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return rt(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:rt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new pt,ctx:{common:e.parent.common,data:e.data,parsedType:rt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(bt(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const a={common:{issues:[],async:null!==(n=null==t?void 0:t.async)&&void 0!==n&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rt(e)},i=this._parseSync({data:e,path:a.path,parent:a});return Et(a,i)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rt(e)},a=this._parse({data:e,path:n.path,parent:n}),i=await(bt(a)?a:Promise.resolve(a));return Et(n,i)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,a)=>{const i=e(t),r=()=>a.addIssue({code:ot.custom,...n(t)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then((e=>!!e||(r(),!1))):!!i||(r(),!1)}))}refinement(e,t){return this._refinement(((n,a)=>!!e(n)||(a.addIssue("function"==typeof t?t(n,a):t),!1)))}_refinement(e){return new kn({schema:this,typeName:Pn.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Sn.create(this,this._def)}nullable(){return En.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return on.create(this,this._def)}promise(){return Mn.create(this,this._def)}or(e){return ln.create([this,e],this._def)}and(e){return pn.create(this,e,this._def)}transform(e){return new kn({...$t(this._def),schema:this,typeName:Pn.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new $n({...$t(this._def),innerType:this,defaultValue:t,typeName:Pn.ZodDefault})}brand(){return new Tn({typeName:Pn.ZodBranded,type:this,...$t(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new An({...$t(this._def),innerType:this,catchValue:t,typeName:Pn.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return jn.create(this,e)}readonly(){return On.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const It=/^c[^\s-]{8,}$/i,zt=/^[0-9a-z]+$/,Tt=/^[0-9A-HJKMNP-TV-Z]{26}$/,jt=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ot=/^[a-z0-9_-]{21}$/i,Dt=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Rt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let Pt;const Lt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Nt=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Ft=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Vt="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Ht=new RegExp(`^${Vt}$`);function Bt(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function qt(e){let t=`${Vt}T${Bt(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function Ut(e,t){return!("v4"!==t&&t||!Lt.test(e))||!("v6"!==t&&t||!Nt.test(e))}class Wt extends At{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==it.string){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.string,received:t.parsedType}),mt}const t=new pt;let n;for(const a of this._def.checks)if("min"===a.kind)e.data.lengtha.value&&(n=this._getOrReturnCtx(e,n),ht(n,{code:ot.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("length"===a.kind){const i=e.data.length>a.value,r=e.data.lengthe.test(t)),{validation:t,code:ot.invalid_string,...Ct.errToObj(n)})}_addCheck(e){return new Wt({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ct.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ct.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ct.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ct.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ct.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ct.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ct.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ct.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ct.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ct.errToObj(e)})}datetime(e){var t,n;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(n=null==e?void 0:e.local)&&void 0!==n&&n,...Ct.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...Ct.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Ct.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Ct.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...Ct.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Ct.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Ct.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Ct.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Ct.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Ct.errToObj(t)})}nonempty(e){return this.min(1,Ct.errToObj(e))}trim(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.valuea?n:a;return parseInt(e.toFixed(i).replace(".",""))%parseInt(t.toFixed(i).replace(".",""))/Math.pow(10,i)}Wt.create=e=>{var t;return new Wt({checks:[],typeName:Pn.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...$t(e)})};class Qt extends At{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==it.number){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.number,received:t.parsedType}),mt}let t;const n=new pt;for(const a of this._def.checks)if("int"===a.kind)Ke.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty());else if("min"===a.kind){(a.inclusive?e.dataa.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty())}else"multipleOf"===a.kind?0!==Zt(e.data,a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.not_finite,message:a.message}),n.dirty()):Ke.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ct.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ct.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ct.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ct.toString(t))}setLimit(e,t,n,a){return new Qt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Ct.toString(a)}]})}_addCheck(e){return new Qt({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ct.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ct.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ct.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ct.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ct.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ct.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Ct.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ct.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ct.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value"int"===e.kind||"multipleOf"===e.kind&&Ke.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.valuenew Qt({checks:[],typeName:Pn.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...$t(e)});class Gt extends At{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){this._def.coerce&&(e.data=BigInt(e.data));if(this._getType(e)!==it.bigint){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.bigint,received:t.parsedType}),mt}let t;const n=new pt;for(const a of this._def.checks)if("min"===a.kind){(a.inclusive?e.dataa.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty())}else"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):Ke.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ct.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ct.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ct.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ct.toString(t))}setLimit(e,t,n,a){return new Gt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Ct.toString(a)}]})}_addCheck(e){return new Gt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ct.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ct.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ct.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ct.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ct.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value{var t;return new Gt({checks:[],typeName:Pn.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...$t(e)})};class Yt extends At{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==it.boolean){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.boolean,received:t.parsedType}),mt}return ft(e.data)}}Yt.create=e=>new Yt({typeName:Pn.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...$t(e)});class Kt extends At{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==it.date){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.date,received:t.parsedType}),mt}if(isNaN(e.data.getTime())){return ht(this._getOrReturnCtx(e),{code:ot.invalid_date}),mt}const t=new pt;let n;for(const a of this._def.checks)"min"===a.kind?e.data.getTime()a.value&&(n=this._getOrReturnCtx(e,n),ht(n,{code:ot.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),t.dirty()):Ke.assertNever(a);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Kt({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Ct.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Ct.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.valuenew Kt({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Pn.ZodDate,...$t(e)});class Xt extends At{_parse(e){if(this._getType(e)!==it.symbol){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.symbol,received:t.parsedType}),mt}return ft(e.data)}}Xt.create=e=>new Xt({typeName:Pn.ZodSymbol,...$t(e)});class Jt extends At{_parse(e){if(this._getType(e)!==it.undefined){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.undefined,received:t.parsedType}),mt}return ft(e.data)}}Jt.create=e=>new Jt({typeName:Pn.ZodUndefined,...$t(e)});class en extends At{_parse(e){if(this._getType(e)!==it.null){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.null,received:t.parsedType}),mt}return ft(e.data)}}en.create=e=>new en({typeName:Pn.ZodNull,...$t(e)});class tn extends At{constructor(){super(...arguments),this._any=!0}_parse(e){return ft(e.data)}}tn.create=e=>new tn({typeName:Pn.ZodAny,...$t(e)});class nn extends At{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ft(e.data)}}nn.create=e=>new nn({typeName:Pn.ZodUnknown,...$t(e)});class an extends At{_parse(e){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.never,received:t.parsedType}),mt}}an.create=e=>new an({typeName:Pn.ZodNever,...$t(e)});class rn extends At{_parse(e){if(this._getType(e)!==it.undefined){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.void,received:t.parsedType}),mt}return ft(e.data)}}rn.create=e=>new rn({typeName:Pn.ZodVoid,...$t(e)});class on extends At{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),a=this._def;if(t.parsedType!==it.array)return ht(t,{code:ot.invalid_type,expected:it.array,received:t.parsedType}),mt;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,i=t.data.lengtha.maxLength.value&&(ht(t,{code:ot.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map(((e,n)=>a.type._parseAsync(new St(t,e,t.path,n))))).then((e=>pt.mergeArray(n,e)));const i=[...t.data].map(((e,n)=>a.type._parseSync(new St(t,e,t.path,n))));return pt.mergeArray(n,i)}get element(){return this._def.type}min(e,t){return new on({...this._def,minLength:{value:e,message:Ct.toString(t)}})}max(e,t){return new on({...this._def,maxLength:{value:e,message:Ct.toString(t)}})}length(e,t){return new on({...this._def,exactLength:{value:e,message:Ct.toString(t)}})}nonempty(e){return this.min(1,e)}}function sn(e){if(e instanceof cn){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=Sn.create(sn(a))}return new cn({...e._def,shape:()=>t})}return e instanceof on?new on({...e._def,type:sn(e.element)}):e instanceof Sn?Sn.create(sn(e.unwrap())):e instanceof En?En.create(sn(e.unwrap())):e instanceof mn?mn.create(e.items.map((e=>sn(e)))):e}on.create=(e,t)=>new on({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Pn.ZodArray,...$t(t)});class cn extends At{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=Ke.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==it.object){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.object,received:t.parsedType}),mt}const{status:t,ctx:n}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),r=[];if(!(this._def.catchall instanceof an&&"strip"===this._def.unknownKeys))for(const e in n.data)i.includes(e)||r.push(e);const o=[];for(const e of i){const t=a[e],i=n.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new St(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof an){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of r)o.push({key:{status:"valid",value:e},value:{status:"valid",value:n.data[e]}});else if("strict"===e)r.length>0&&(ht(n,{code:ot.unrecognized_keys,keys:r}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of r){const a=n.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new St(n,a,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of o){const n=await t.key,a=await t.value;e.push({key:n,value:a,alwaysSet:t.alwaysSet})}return e})).then((e=>pt.mergeObjectSync(t,e))):pt.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return Ct.errToObj,new cn({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var a,i,r,o;const s=null!==(r=null===(i=(a=this._def).errorMap)||void 0===i?void 0:i.call(a,t,n).message)&&void 0!==r?r:n.defaultError;return"unrecognized_keys"===t.code?{message:null!==(o=Ct.errToObj(e).message)&&void 0!==o?o:s}:{message:s}}}:{}})}strip(){return new cn({...this._def,unknownKeys:"strip"})}passthrough(){return new cn({...this._def,unknownKeys:"passthrough"})}extend(e){return new cn({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new cn({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Pn.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new cn({...this._def,catchall:e})}pick(e){const t={};return Ke.objectKeys(e).forEach((n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])})),new cn({...this._def,shape:()=>t})}omit(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{e[n]||(t[n]=this.shape[n])})),new cn({...this._def,shape:()=>t})}deepPartial(){return sn(this)}partial(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{const a=this.shape[n];e&&!e[n]?t[n]=a:t[n]=a.optional()})),new cn({...this._def,shape:()=>t})}required(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof Sn;)e=e._def.innerType;t[n]=e}})),new cn({...this._def,shape:()=>t})}keyof(){return wn(Ke.objectKeys(this.shape))}}cn.create=(e,t)=>new cn({shape:()=>e,unknownKeys:"strip",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)}),cn.strictCreate=(e,t)=>new cn({shape:()=>e,unknownKeys:"strict",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)}),cn.lazycreate=(e,t)=>new cn({shape:e,unknownKeys:"strip",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)});class ln extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map((async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;const n=e.map((e=>new st(e.ctx.common.issues)));return ht(t,{code:ot.invalid_union,unionErrors:n}),mt}));{let e;const a=[];for(const i of n){const n={...t,common:{...t.common,issues:[]},parent:null},r=i._parseSync({data:t.data,path:t.path,parent:n});if("valid"===r.status)return r;"dirty"!==r.status||e||(e={result:r,ctx:n}),n.common.issues.length&&a.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const i=a.map((e=>new st(e)));return ht(t,{code:ot.invalid_union,unionErrors:i}),mt}}get options(){return this._def.options}}ln.create=(e,t)=>new ln({options:e,typeName:Pn.ZodUnion,...$t(t)});const dn=e=>e instanceof vn?dn(e.schema):e instanceof kn?dn(e.innerType()):e instanceof bn?[e.value]:e instanceof xn?e.options:e instanceof Cn?Ke.objectValues(e.enum):e instanceof $n?dn(e._def.innerType):e instanceof Jt?[void 0]:e instanceof en?[null]:e instanceof Sn?[void 0,...dn(e.unwrap())]:e instanceof En?[null,...dn(e.unwrap())]:e instanceof Tn||e instanceof On?dn(e.unwrap()):e instanceof An?dn(e._def.innerType):[];class un extends At{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.object)return ht(t,{code:ot.invalid_type,expected:it.object,received:t.parsedType}),mt;const n=this.discriminator,a=t.data[n],i=this.optionsMap.get(a);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(ht(t,{code:ot.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),mt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const a=new Map;for(const n of t){const t=dn(n.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const i of t){if(a.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);a.set(i,n)}}return new un({typeName:Pn.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...$t(n)})}}function hn(e,t){const n=rt(e),a=rt(t);if(e===t)return{valid:!0,data:e};if(n===it.object&&a===it.object){const n=Ke.objectKeys(t),a=Ke.objectKeys(e).filter((e=>-1!==n.indexOf(e))),i={...e,...t};for(const n of a){const a=hn(e[n],t[n]);if(!a.valid)return{valid:!1};i[n]=a.data}return{valid:!0,data:i}}if(n===it.array&&a===it.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let a=0;a{if(_t(e)||_t(a))return mt;const i=hn(e.value,a.value);return i.valid?((yt(e)||yt(a))&&t.dirty(),{status:t.value,value:i.data}):(ht(n,{code:ot.invalid_intersection_types}),mt)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then((([e,t])=>a(e,t))):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}pn.create=(e,t,n)=>new pn({left:e,right:t,typeName:Pn.ZodIntersection,...$t(n)});class mn extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.array)return ht(n,{code:ot.invalid_type,expected:it.array,received:n.parsedType}),mt;if(n.data.lengththis._def.items.length&&(ht(n,{code:ot.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map(((e,t)=>{const a=this._def.items[t]||this._def.rest;return a?a._parse(new St(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(a).then((e=>pt.mergeArray(t,e))):pt.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new mn({...this._def,rest:e})}}mn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new mn({items:e,typeName:Pn.ZodTuple,rest:null,...$t(t)})};class gn extends At{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.object)return ht(n,{code:ot.invalid_type,expected:it.object,received:n.parsedType}),mt;const a=[],i=this._def.keyType,r=this._def.valueType;for(const e in n.data)a.push({key:i._parse(new St(n,e,n.path,e)),value:r._parse(new St(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?pt.mergeObjectAsync(t,a):pt.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,n){return new gn(t instanceof At?{keyType:e,valueType:t,typeName:Pn.ZodRecord,...$t(n)}:{keyType:Wt.create(),valueType:e,typeName:Pn.ZodRecord,...$t(t)})}}class fn extends At{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.map)return ht(n,{code:ot.invalid_type,expected:it.map,received:n.parsedType}),mt;const a=this._def.keyType,i=this._def.valueType,r=[...n.data.entries()].map((([e,t],r)=>({key:a._parse(new St(n,e,n.path,[r,"key"])),value:i._parse(new St(n,t,n.path,[r,"value"]))})));if(n.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const n of r){const a=await n.key,i=await n.value;if("aborted"===a.status||"aborted"===i.status)return mt;"dirty"!==a.status&&"dirty"!==i.status||t.dirty(),e.set(a.value,i.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const n of r){const a=n.key,i=n.value;if("aborted"===a.status||"aborted"===i.status)return mt;"dirty"!==a.status&&"dirty"!==i.status||t.dirty(),e.set(a.value,i.value)}return{status:t.value,value:e}}}}fn.create=(e,t,n)=>new fn({valueType:t,keyType:e,typeName:Pn.ZodMap,...$t(n)});class _n extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.set)return ht(n,{code:ot.invalid_type,expected:it.set,received:n.parsedType}),mt;const a=this._def;null!==a.minSize&&n.data.sizea.maxSize.value&&(ht(n,{code:ot.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const i=this._def.valueType;function r(e){const n=new Set;for(const a of e){if("aborted"===a.status)return mt;"dirty"===a.status&&t.dirty(),n.add(a.value)}return{status:t.value,value:n}}const o=[...n.data.values()].map(((e,t)=>i._parse(new St(n,e,n.path,t))));return n.common.async?Promise.all(o).then((e=>r(e))):r(o)}min(e,t){return new _n({...this._def,minSize:{value:e,message:Ct.toString(t)}})}max(e,t){return new _n({...this._def,maxSize:{value:e,message:Ct.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}_n.create=(e,t)=>new _n({valueType:e,minSize:null,maxSize:null,typeName:Pn.ZodSet,...$t(t)});class yn extends At{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.function)return ht(t,{code:ot.invalid_type,expected:it.function,received:t.parsedType}),mt;function n(e,n){return ut({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,dt(),ct].filter((e=>!!e)),issueData:{code:ot.invalid_arguments,argumentsError:n}})}function a(e,n){return ut({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,dt(),ct].filter((e=>!!e)),issueData:{code:ot.invalid_return_type,returnTypeError:n}})}const i={errorMap:t.common.contextualErrorMap},r=t.data;if(this._def.returns instanceof Mn){const e=this;return ft((async function(...t){const o=new st([]),s=await e._def.args.parseAsync(t,i).catch((e=>{throw o.addIssue(n(t,e)),o})),c=await Reflect.apply(r,this,s),l=await e._def.returns._def.type.parseAsync(c,i).catch((e=>{throw o.addIssue(a(c,e)),o}));return l}))}{const e=this;return ft((function(...t){const o=e._def.args.safeParse(t,i);if(!o.success)throw new st([n(t,o.error)]);const s=Reflect.apply(r,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new st([a(s,c.error)]);return c.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new yn({...this._def,args:mn.create(e).rest(nn.create())})}returns(e){return new yn({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new yn({args:e||mn.create([]).rest(nn.create()),returns:t||nn.create(),typeName:Pn.ZodFunction,...$t(n)})}}class vn extends At{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}vn.create=(e,t)=>new vn({getter:e,typeName:Pn.ZodLazy,...$t(t)});class bn extends At{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return ht(t,{received:t.data,code:ot.invalid_literal,expected:this._def.value}),mt}return{status:"valid",value:e.data}}get value(){return this._def.value}}function wn(e,t){return new xn({values:e,typeName:Pn.ZodEnum,...$t(t)})}bn.create=(e,t)=>new bn({value:e,typeName:Pn.ZodLiteral,...$t(t)});class xn extends At{constructor(){super(...arguments),Mt.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return ht(t,{expected:Ke.joinValues(n),received:t.parsedType,code:ot.invalid_type}),mt}if(wt(this,Mt,"f")||xt(this,Mt,new Set(this._def.values),"f"),!wt(this,Mt,"f").has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return ht(t,{received:t.data,code:ot.invalid_enum_value,options:n}),mt}return ft(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return xn.create(e,{...this._def,...t})}exclude(e,t=this._def){return xn.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}Mt=new WeakMap,xn.create=wn;class Cn extends At{constructor(){super(...arguments),kt.set(this,void 0)}_parse(e){const t=Ke.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==it.string&&n.parsedType!==it.number){const e=Ke.objectValues(t);return ht(n,{expected:Ke.joinValues(e),received:n.parsedType,code:ot.invalid_type}),mt}if(wt(this,kt,"f")||xt(this,kt,new Set(Ke.getValidEnumValues(this._def.values)),"f"),!wt(this,kt,"f").has(e.data)){const e=Ke.objectValues(t);return ht(n,{received:n.data,code:ot.invalid_enum_value,options:e}),mt}return ft(e.data)}get enum(){return this._def.values}}kt=new WeakMap,Cn.create=(e,t)=>new Cn({values:e,typeName:Pn.ZodNativeEnum,...$t(t)});class Mn extends At{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.promise&&!1===t.common.async)return ht(t,{code:ot.invalid_type,expected:it.promise,received:t.parsedType}),mt;const n=t.parsedType===it.promise?t.data:Promise.resolve(t.data);return ft(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}Mn.create=(e,t)=>new Mn({type:e,typeName:Pn.ZodPromise,...$t(t)});class kn extends At{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Pn.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),a=this._def.effect||null,i={addIssue:e=>{ht(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===a.type){const e=a.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return mt;const a=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===a.status?mt:"dirty"===a.status||"dirty"===t.value?gt(a.value):a}));{if("aborted"===t.value)return mt;const a=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===a.status?mt:"dirty"===a.status||"dirty"===t.value?gt(a.value):a}}if("refinement"===a.type){const e=e=>{const t=a.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===n.common.async){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===a.status?mt:("dirty"===a.status&&t.dirty(),e(a.value),{status:t.value,value:a.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((n=>"aborted"===n.status?mt:("dirty"===n.status&&t.dirty(),e(n.value).then((()=>({status:t.value,value:n.value}))))))}if("transform"===a.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!vt(e))return e;const r=a.transform(e.value,i);if(r instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:r}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((e=>vt(e)?Promise.resolve(a.transform(e.value,i)).then((e=>({status:t.value,value:e}))):e))}Ke.assertNever(a)}}kn.create=(e,t,n)=>new kn({schema:e,typeName:Pn.ZodEffects,effect:t,...$t(n)}),kn.createWithPreprocess=(e,t,n)=>new kn({schema:t,effect:{type:"preprocess",transform:e},typeName:Pn.ZodEffects,...$t(n)});class Sn extends At{_parse(e){return this._getType(e)===it.undefined?ft(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Sn.create=(e,t)=>new Sn({innerType:e,typeName:Pn.ZodOptional,...$t(t)});class En extends At{_parse(e){return this._getType(e)===it.null?ft(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}En.create=(e,t)=>new En({innerType:e,typeName:Pn.ZodNullable,...$t(t)});class $n extends At{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===it.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}$n.create=(e,t)=>new $n({innerType:e,typeName:Pn.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...$t(t)});class An extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return bt(a)?a.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new st(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new st(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}An.create=(e,t)=>new An({innerType:e,typeName:Pn.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...$t(t)});class In extends At{_parse(e){if(this._getType(e)!==it.nan){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.nan,received:t.parsedType}),mt}return{status:"valid",value:e.data}}}In.create=e=>new In({typeName:Pn.ZodNaN,...$t(e)});const zn=Symbol("zod_brand");class Tn extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class jn extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?mt:"dirty"===e.status?(t.dirty(),gt(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})()}{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?mt:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new jn({in:e,out:t,typeName:Pn.ZodPipeline})}}class On extends At{_parse(e){const t=this._def.innerType._parse(e),n=e=>(vt(e)&&(e.value=Object.freeze(e.value)),e);return bt(t)?t.then((e=>n(e))):n(t)}unwrap(){return this._def.innerType}}function Dn(e,t={},n){return e?tn.create().superRefine(((a,i)=>{var r,o;if(!e(a)){const e="function"==typeof t?t(a):"string"==typeof t?{message:t}:t,s=null===(o=null!==(r=e.fatal)&&void 0!==r?r:n)||void 0===o||o,c="string"==typeof e?{message:e}:e;i.addIssue({code:"custom",...c,fatal:s})}})):tn.create()}On.create=(e,t)=>new On({innerType:e,typeName:Pn.ZodReadonly,...$t(t)});const Rn={object:cn.lazycreate};var Pn;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(Pn||(Pn={}));const Ln=Wt.create,Nn=Qt.create,Fn=In.create,Vn=Gt.create,Hn=Yt.create,Bn=Kt.create,qn=Xt.create,Un=Jt.create,Wn=en.create,Zn=tn.create,Qn=nn.create,Gn=an.create,Yn=rn.create,Kn=on.create,Xn=cn.create,Jn=cn.strictCreate,ea=ln.create,ta=un.create,na=pn.create,aa=mn.create,ia=gn.create,ra=fn.create,oa=_n.create,sa=yn.create,ca=vn.create,la=bn.create,da=xn.create,ua=Cn.create,ha=Mn.create,pa=kn.create,ma=Sn.create,ga=En.create,fa=kn.createWithPreprocess,_a=jn.create,ya={string:e=>Wt.create({...e,coerce:!0}),number:e=>Qt.create({...e,coerce:!0}),boolean:e=>Yt.create({...e,coerce:!0}),bigint:e=>Gt.create({...e,coerce:!0}),date:e=>Kt.create({...e,coerce:!0})},va=mt;var ba=Object.freeze({__proto__:null,defaultErrorMap:ct,setErrorMap:function(e){lt=e},getErrorMap:dt,makeIssue:ut,EMPTY_PATH:[],addIssueToContext:ht,ParseStatus:pt,INVALID:mt,DIRTY:gt,OK:ft,isAborted:_t,isDirty:yt,isValid:vt,isAsync:bt,get util(){return Ke},get objectUtil(){return Xe},ZodParsedType:it,getParsedType:rt,ZodType:At,datetimeRegex:qt,ZodString:Wt,ZodNumber:Qt,ZodBigInt:Gt,ZodBoolean:Yt,ZodDate:Kt,ZodSymbol:Xt,ZodUndefined:Jt,ZodNull:en,ZodAny:tn,ZodUnknown:nn,ZodNever:an,ZodVoid:rn,ZodArray:on,ZodObject:cn,ZodUnion:ln,ZodDiscriminatedUnion:un,ZodIntersection:pn,ZodTuple:mn,ZodRecord:gn,ZodMap:fn,ZodSet:_n,ZodFunction:yn,ZodLazy:vn,ZodLiteral:bn,ZodEnum:xn,ZodNativeEnum:Cn,ZodPromise:Mn,ZodEffects:kn,ZodTransformer:kn,ZodOptional:Sn,ZodNullable:En,ZodDefault:$n,ZodCatch:An,ZodNaN:In,BRAND:zn,ZodBranded:Tn,ZodPipeline:jn,ZodReadonly:On,custom:Dn,Schema:At,ZodSchema:At,late:Rn,get ZodFirstPartyTypeKind(){return Pn},coerce:ya,any:Zn,array:Kn,bigint:Vn,boolean:Hn,date:Bn,discriminatedUnion:ta,effect:pa,enum:da,function:sa,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>Dn((t=>t instanceof e),t),intersection:na,lazy:ca,literal:la,map:ra,nan:Fn,nativeEnum:ua,never:Gn,null:Wn,nullable:ga,number:Nn,object:Xn,oboolean:()=>Hn().optional(),onumber:()=>Nn().optional(),optional:ma,ostring:()=>Ln().optional(),pipeline:_a,preprocess:fa,promise:ha,record:ia,set:oa,strictObject:Jn,string:Ln,symbol:qn,transformer:pa,tuple:aa,undefined:Un,union:ea,unknown:Qn,void:Yn,NEVER:va,ZodIssueCode:ot,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:st});const wa="cameras",xa=`${wa}.#.camera_entity`,Ca=`${wa}.#.frigate.camera_name`,Ma=`${wa}.#.capabilities.disable`,ka=`${wa}.#.capabilities.disable_except`,Sa=`${wa}.#.cast.method`,Ea=`${wa}.#.cast.dashboard.dashboard_path`,$a=`${wa}.#.cast.dashboard.view_path`,Aa=`${wa}.#.dimensions.aspect_ratio`,Ia=`${wa}.#.frigate.client_id`,za=`${wa}.#.frigate.labels`,Ta=`${wa}.#.frigate.url`,ja=`${wa}.#.frigate.zones`,Oa=`${wa}.#.go2rtc.modes`,Da=`${wa}.#.go2rtc.stream`,Ra=`${wa}.#.icon`,Pa=`${wa}.#.id`,La=`${wa}.#.image.entity`,Na=`${wa}.#.image.entity_parameters`,Fa=`${wa}.#.image.mode`,Va=`${wa}.#.image.refresh_seconds`,Ha=`${wa}.#.image.url`,Ba=`${wa}.#.motioneye.images.directory_pattern`,qa=`${wa}.#.motioneye.images.file_pattern`,Ua=`${wa}.#.motioneye.movies.directory_pattern`,Wa=`${wa}.#.motioneye.movies.file_pattern`,Za=`${wa}.#.motioneye.url`,Qa=`${wa}.#.title`,Ga=`${wa}.#.webrtc_card.entity`,Ya=`${wa}.#.webrtc_card.url`,Ka=`${wa}.#.live_provider`,Xa=`${wa}.#.dependencies.cameras`,Ja=`${wa}.#.dependencies.all_cameras`,ei=`${wa}.#.dimensions.layout.fit`,ti=`${wa}.#.dimensions.layout.pan.x`,ni=`${wa}.#.dimensions.layout.pan.y`,ai=`${wa}.#.dimensions.layout.position.x`,ii=`${wa}.#.dimensions.layout.position.y`,ri=`${wa}.#.dimensions.layout.view_box.top`,oi=`${wa}.#.dimensions.layout.view_box.bottom`,si=`${wa}.#.dimensions.layout.view_box.left`,ci=`${wa}.#.dimensions.layout.view_box.right`,li=`${wa}.#.dimensions.layout.zoom`,di=`${wa}.#.proxy.dynamic`,ui=`${wa}.#.proxy.media`,hi=`${wa}.#.proxy.ssl_ciphers`,pi=`${wa}.#.proxy.ssl_verification`,mi=`${wa}.#.reolink.media_resolution`,gi=`${wa}.#.reolink.url`,fi=`${wa}.#.triggers.motion`,_i=`${wa}.#.triggers.occupancy`,yi=`${wa}.#.triggers.entities`,vi=`${wa}.#.triggers.events`,bi="cameras_global",wi=`${bi}.image`,xi=`${bi}.live_provider`,Ci=`${bi}.jsmpeg`,Mi=`${bi}.webrtc_card`,ki=`${bi}.triggers.occupancy`,Si=`${bi}.image.refresh_seconds`,Ei=`${bi}.dimensions.layout`,$i=`${bi}.ptz`,Ai="elements",Ii="view",zi=`${Ii}.camera_select`,Ti=`${Ii}.dark_mode`,ji=`${Ii}.default`,Oi=`${Ii}.interaction_seconds`,Di=`${Ii}.keyboard_shortcuts`,Ri=`${Ii}.keyboard_shortcuts.enabled`,Pi=`${Di}.ptz_left`,Li=`${Di}.ptz_right`,Ni=`${Di}.ptz_up`,Fi=`${Di}.ptz_down`,Vi=`${Di}.ptz_zoom_in`,Hi=`${Di}.ptz_zoom_out`,Bi=`${Di}.ptz_home`,qi=`${Ii}.default_cycle_camera`,Ui=`${Ii}.default_reset`,Wi=`${Ui}.interaction_mode`,Zi=`${Ui}.every_seconds`,Qi=`${Ui}.entities`,Gi=`${Ui}.after_interaction`,Yi=`${Ii}.triggers`,Ki=`${Yi}.show_trigger_status`,Xi=`${Yi}.filter_selected_camera`,Ji=`${Yi}.untrigger_seconds`,er=`${Yi}.actions`,tr=`${er}.trigger`,nr=`${er}.untrigger`,ar=`${er}.interaction_mode`,ir="media_gallery",rr=`${ir}.controls.filter.mode`,or=`${ir}.controls.thumbnails.show_details`,sr=`${ir}.controls.thumbnails.show_download_control`,cr=`${ir}.controls.thumbnails.show_favorite_control`,lr=`${ir}.controls.thumbnails.show_timeline_control`,dr=`${ir}.controls.thumbnails.size`,ur="media_viewer",hr=`${ur}.auto_play`,pr=`${ur}.auto_pause`,mr=`${ur}.auto_mute`,gr=`${ur}.auto_unmute`,fr=`${ur}.display.mode`,_r=`${ur}.display.grid_columns`,yr=`${ur}.display.grid_max_columns`,vr=`${ur}.display.grid_selected_width_factor`,br=`${ur}.draggable`,wr=`${ur}.lazy_load`,xr=`${ur}.snapshot_click_plays_clip`,Cr=`${ur}.transition_effect`,Mr=`${ur}.controls.builtin`,kr=`${ur}.controls.next_previous.style`,Sr=`${ur}.controls.next_previous.size`,Er=`${ur}.controls.thumbnails.mode`,$r=`${ur}.controls.thumbnails.show_details`,Ar=`${ur}.controls.thumbnails.show_download_control`,Ir=`${ur}.controls.thumbnails.show_favorite_control`,zr=`${ur}.controls.thumbnails.show_timeline_control`,Tr=`${ur}.controls.thumbnails.size`,jr=`${ur}.controls.timeline.clustering_threshold`,Or=`${ur}.controls.timeline.events_media_type`,Dr=`${ur}.controls.timeline.mode`,Rr=`${ur}.controls.timeline.pan_mode`,Pr=`${ur}.controls.timeline.show_recordings`,Lr=`${ur}.controls.timeline.style`,Nr=`${ur}.controls.timeline.window_seconds`,Fr=`${ur}.zoomable`,Vr="live",Hr=`${Vr}.auto_play`,Br=`${Vr}.auto_pause`,qr=`${Vr}.auto_mute`,Ur=`${Vr}.auto_unmute`,Wr=`${Vr}.controls.builtin`,Zr=`${Vr}.controls.next_previous.style`,Qr=`${Vr}.controls.next_previous.size`,Gr=`${Vr}.controls.ptz.hide_home`,Yr=`${Vr}.controls.ptz.hide_pan_tilt`,Kr=`${Vr}.controls.ptz.hide_zoom`,Xr=`${Vr}.controls.ptz.mode`,Jr=`${Vr}.controls.ptz.orientation`,eo=`${Vr}.controls.ptz.position`,to=`${Vr}.controls.thumbnails.media_type`,no=`${Vr}.controls.thumbnails.events_media_type`,ao=`${Vr}.controls.thumbnails.mode`,io=`${Vr}.controls.thumbnails.size`,ro=`${Vr}.controls.thumbnails.show_details`,oo=`${Vr}.controls.thumbnails.show_download_control`,so=`${Vr}.controls.thumbnails.show_favorite_control`,co=`${Vr}.controls.thumbnails.show_timeline_control`,lo=`${Vr}.controls.timeline.clustering_threshold`,uo=`${Vr}.controls.timeline.events_media_type`,ho=`${Vr}.controls.timeline.mode`,po=`${Vr}.controls.timeline.pan_mode`,mo=`${Vr}.controls.timeline.show_recordings`,go=`${Vr}.controls.timeline.style`,fo=`${Vr}.controls.timeline.window_seconds`,_o=`${Vr}.display.mode`,yo=`${Vr}.display.grid_columns`,vo=`${Vr}.display.grid_max_columns`,bo=`${Vr}.display.grid_selected_width_factor`,wo=`${Vr}.draggable`,xo=`${Vr}.lazy_load`,Co=`${Vr}.lazy_unload`,Mo=`${Vr}.preload`,ko=`${Vr}.transition_effect`,So=`${Vr}.show_image_during_load`,Eo=`${Vr}.microphone.disconnect_seconds`,$o=`${Vr}.microphone.mute_after_microphone_mute_seconds`,Ao=`${Vr}.microphone.always_connected`,Io=`${Vr}.zoomable`,zo="image",To=`${zo}.entity`,jo=`${zo}.entity_parameters`,Oo=`${zo}.mode`,Do=`${zo}.refresh_seconds`,Ro=`${zo}.url`,Po="timeline",Lo=`${Po}.window_seconds`,No=`${Po}.clustering_threshold`,Fo=`${Po}.events_media_type`,Vo=`${Po}.show_recordings`,Ho=`${Po}.style`,Bo=`${Po}.controls.thumbnails.mode`,qo=`${Po}.controls.thumbnails.size`,Uo=`${Po}.controls.thumbnails.show_details`,Wo=`${Po}.controls.thumbnails.show_download_control`,Zo=`${Po}.controls.thumbnails.show_favorite_control`,Qo=`${Po}.controls.thumbnails.show_timeline_control`,Go="menu",Yo=`${Go}.alignment`,Ko=`${Go}.position`,Xo=`${Go}.style`,Jo=`${Go}.button_size`,es=`${Go}.buttons`,ts=`${es}.frigate`,ns=`${es}.camera_ui`,as=`${es}.fullscreen`,is=`${es}.play`,rs=`${es}.mute`,os=`${es}.media_player`,ss=`${es}.timeline`,cs="status_bar",ls=`${cs}.position`,ds=`${cs}.style`,us=`${cs}.popup_seconds`,hs=`${cs}.height`,ps=`${cs}.items`,ms="dimensions",gs=`${ms}.aspect_ratio`,fs=`${ms}.aspect_ratio_mode`,_s=`${ms}.height`,ys="overrides",vs="performance",bs=`${vs}.features.animated_progress_indicator`,ws=`${vs}.features.media_chunk_size`,xs=`${vs}.features.max_simultaneous_engine_requests`,Cs=`${vs}.profile`,Ms=`${vs}.style.box_shadow`,ks=`${vs}.style.border_radius`,Ss="profiles",Es=1e3;class $s extends Error{constructor(e,t){super(e),this.context=t}}const As={info:10,error:20,connection:30,diagnostics:40},Is=["clips","favorite-events","favorite-recordings","live","menu","ptz","recordings","seek","snapshots","substream"],zs=ba.object({url:ba.string(),mime_type:ba.string()}),Ts=ba.object({path:ba.string()});function js(e){if(e instanceof ba.ZodDefault)return js(e.removeDefault());if(e instanceof ba.ZodObject){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=ba.ZodOptional.create(js(a))}return new ba.ZodObject({...e._def,shape:()=>t})}return e instanceof ba.ZodArray?ba.ZodArray.create(js(e.element)).min(e._def.minLength?.value,e._def.minLength?.message).max(e._def.maxLength?.value,e._def.maxLength?.message).length(e._def.exactLength?.value,e._def.exactLength?.message):e instanceof ba.ZodOptional?ba.ZodOptional.create(js(e.unwrap())):e instanceof ba.ZodNullable?ba.ZodNullable.create(js(e.unwrap())):e instanceof ba.ZodTuple?ba.ZodTuple.create(e.items.map((e=>js(e)))):e}function Os(e){const t=e.format();return Object.keys(t).filter((e=>!e.startsWith("_")))}const Ds=e=>{const t=new Set;if(e.issues.length)for(const n of e.issues)if("invalid_union"===n.code){const e=n.unionErrors;for(const n of e)Ds(n).forEach(t.add,t)}else t.add(Rs(n.path));return t},Rs=e=>{let t="";for(let n=0;n"fire-dom-event")).or(ba.literal("fire-dom-event")),card_id:ba.string().regex(Js,"card_id parameter can only contain [a-z][A-Z][0-9_]-").optional()}),gc=mc.extend({frigate_card_action:ba.enum(Us)}),fc=mc.extend({frigate_card_action:ba.enum(["camera_ui","default","download","expand","fullscreen","live_substream_off","live_substream_on","menu_toggle","microphone_connect","microphone_disconnect","microphone_mute","microphone_unmute","mute","pause","play","screenshot","unmute"])}),_c=mc.extend({frigate_card_action:ba.literal("camera_select"),camera:ba.string().optional(),triggered:ba.boolean().optional()}),yc=mc.extend({frigate_card_action:ba.literal("live_substream_select"),camera:ba.string()}),vc=mc.extend({frigate_card_action:ba.literal("media_player"),media_player:ba.string(),media_player_action:ba.enum(["play","stop"])}),bc=mc.extend({frigate_card_action:ba.literal("display_mode_select"),display_mode:nc}),wc=mc.extend({frigate_card_action:ba.literal("ptz"),camera:ba.string().optional(),ptz_action:ba.enum(Fs).optional(),ptz_phase:ba.enum(Ks).optional(),ptz_preset:ba.string().optional()}),xc=mc.extend({frigate_card_action:ba.literal("ptz_digital"),target_id:ba.string().optional(),absolute:ba.object({zoom:tc.optional(),pan:ec.optional()}).optional(),ptz_action:ba.enum(Fs).optional(),ptz_phase:ba.enum(Ks).optional()}),Cc=mc.extend({frigate_card_action:ba.literal("ptz_multi"),target_id:ba.string().optional(),ptz_action:ba.enum(Fs).optional(),ptz_phase:ba.enum(Ks).optional(),ptz_preset:ba.string().optional()}),Mc=mc.extend({frigate_card_action:ba.literal("ptz_controls"),enabled:ba.boolean()}),kc=ba.object({ms:ba.number().optional(),s:ba.number().optional(),m:ba.number().optional(),h:ba.number().optional()}),Sc=mc.extend({frigate_card_action:ba.literal("sleep"),duration:kc.optional().default({s:1})}),Ec=mc.extend({frigate_card_action:ba.literal("status_bar"),status_bar_action:ba.enum(["add","remove","reset"]),items:ba.lazy((()=>il)).array().optional()}),$c=mc.extend({frigate_card_action:ba.literal("log"),message:ba.string(),level:ba.enum(["debug","info","warn","error"]).default("info")}),Ac=ba.union([_c,fc,yc,$c,vc,wc,xc,Cc,Mc,gc,bc,Sc,Ec]),Ic=ba.union([rc,cc,sc,lc,dc,uc,pc,hc,Ac]),zc=ba.object({tap_action:Ic.or(Ic.array()).optional(),hold_action:Ic.or(Ic.array()).optional(),double_tap_action:Ic.or(Ic.array()).optional(),start_tap_action:Ic.or(Ic.array()).optional(),end_tap_action:Ic.or(Ic.array()).optional()}).passthrough(),Tc=ba.object({actions:zc.optional()}),jc=zc.extend({style:ba.record(ba.string().nullable().or(ba.undefined()).or(ba.number())).optional(),title:ba.string().nullable().optional()}),Oc=jc.extend({type:ba.literal("state-badge"),entity:ba.string()}),Dc=jc.extend({type:ba.literal("state-icon"),entity:ba.string(),icon:ba.string().optional(),state_color:ba.boolean().default(!0)}),Rc=jc.extend({type:ba.literal("state-label"),entity:ba.string(),attribute:ba.string().optional(),prefix:ba.string().optional(),suffix:ba.string().optional()}),Pc=jc.extend({type:ba.literal("service-button"),title:ba.string(),service:ba.string(),service_data:ba.object({}).passthrough().optional()}),Lc=jc.extend({type:ba.literal("icon"),icon:ba.string(),entity:ba.string().optional()}),Nc=jc.extend({type:ba.literal("image"),entity:ba.string().optional(),image:ba.string().optional(),camera_image:ba.string().optional(),camera_view:ba.string().optional(),state_image:ba.object({}).passthrough().optional(),filter:ba.string().optional(),state_filter:ba.object({}).passthrough().optional(),aspect_ratio:ba.string().optional()}),Fc=ba.object({condition:ba.literal("state").optional(),entity:ba.string(),state:ba.string().or(ba.string().array()).optional(),state_not:ba.string().or(ba.string().array()).optional()}),Vc=ba.object({condition:ba.literal("numeric_state"),entity:ba.string(),above:ba.number().optional(),below:ba.number().optional()}),Hc=ba.object({condition:ba.literal("screen"),media_query:ba.string()}),Bc=ba.object({condition:ba.literal("user"),users:ba.string().array().min(1)}),qc=ba.discriminatedUnion("condition",[Fc,Vc,Hc,Bc]),Uc=ba.object({type:ba.literal("conditional"),conditions:qc.array(),elements:ba.lazy((()=>_l))}),Wc=ba.object({type:ba.string().superRefine(((e,t)=>{e.match(/^custom:(?!frigate-card).+/)||t.addIssue({code:ba.ZodIssueCode.custom,message:"Frigate-card custom elements must match specific schemas",fatal:!0})}))}).passthrough(),Zc=ba.object({enabled:ba.boolean().default(!0).optional(),priority:ba.number().min(0).max(Bs).default(50).optional(),alignment:ba.enum(["matching","opposing"]).default("matching").optional(),icon:ba.string().optional(),permanent:ba.boolean().default(!1).optional()}),Qc=Zc.merge(Lc).extend({type:ba.literal("custom:frigate-card-menu-icon")}),Gc=Zc.merge(Dc).extend({type:ba.literal("custom:frigate-card-menu-state-icon")}).merge(Zc),Yc=jc.extend({entity:ba.string().optional(),icon:ba.string().optional(),state_color:ba.boolean().default(!0),selected:ba.boolean().default(!1),subtitle:ba.string().optional(),enabled:ba.boolean().default(!0)}),Kc=Zc.merge(Lc).extend({type:ba.literal("custom:frigate-card-menu-submenu"),items:Yc.array()}),Xc=Zc.merge(Dc).extend({type:ba.literal("custom:frigate-card-menu-submenu-select"),options:ba.record(Yc.deepPartial()).optional()}),Jc=ba.object({enabled:ba.boolean().default(!0).optional(),priority:ba.number().min(0).max(100).default(50).optional()}),el=Jc.extend({sufficient:ba.boolean().default(!1).optional(),exclusive:ba.boolean().default(!1).optional(),expand:ba.boolean().default(!1).optional(),actions:zc.optional()}),tl=el.extend({type:ba.literal("custom:frigate-card-status-bar-icon"),icon:ba.string()}),nl=el.extend({type:ba.literal("custom:frigate-card-status-bar-image"),image:ba.string()}),al=el.extend({type:ba.literal("custom:frigate-card-status-bar-string"),string:ba.string()}),il=ba.union([tl,nl,al]),rl=ba.object({condition:ba.literal("view"),views:ba.string().array()}),ol=ba.object({condition:ba.literal("fullscreen"),fullscreen:ba.boolean()}),sl=ba.object({condition:ba.literal("expand"),expand:ba.boolean()}),cl=ba.object({condition:ba.literal("camera"),cameras:ba.string().array()}),ll=ba.object({condition:ba.literal("media_loaded"),media_loaded:ba.boolean()}),dl=ba.object({condition:ba.literal("display_mode"),display_mode:nc}),ul=ba.object({condition:ba.literal("triggered"),triggered:ba.string().array()}),hl=ba.object({condition:ba.literal("interaction"),interaction:ba.boolean()}),pl=ba.object({condition:ba.literal("microphone"),connected:ba.boolean().optional(),muted:ba.boolean().optional()}),ml=ba.object({condition:ba.literal("key"),key:ba.string(),state:ba.enum(["down","up"]).optional(),ctrl:ba.boolean().optional(),shift:ba.boolean().optional(),alt:ba.boolean().optional(),meta:ba.boolean().optional()}),gl=ba.discriminatedUnion("condition",[Fc,Vc,Hc,Bc,rl,ol,sl,cl,ll,dl,ul,hl,pl,ml]),fl=ba.object({type:ba.literal("custom:frigate-card-conditional"),conditions:gl.array(),elements:ba.lazy((()=>_l))}),_l=ba.union([Uc,Wc,fl,Lc,Nc,Qc,Gc,Kc,Xc,Pc,Oc,Dc,Rc,tl,nl,al]).array().optional(),yl=ba.object({fit:ba.enum(["contain","cover","fill"]).optional(),position:ba.object({x:ba.number().min(0).max(100).optional(),y:ba.number().min(0).max(100).optional()}).optional(),view_box:ba.object({bottom:ba.number().min(0).max(100).optional().default(0),left:ba.number().min(0).max(100).optional().default(0),right:ba.number().min(0).max(100).optional().default(0),top:ba.number().min(0).max(100).optional().default(0)}).optional(),pan:ec.optional(),zoom:tc.optional()}),vl=ba.number().array().length(2).or(ba.string().regex(/^\s*\d+\.?\d*\s*[:/]\s*\d+\.?\d*\s*$/).transform((e=>e.split(/[:\/]/).map((e=>Number(e)))))),bl={r2c_delay_between_calls_seconds:.5,c2r_delay_between_calls_seconds:.2},wl=function(e){return t=>{if(!t||"object"!=typeof t||!t.service)return t;const n={...t};return Object.keys(t).forEach((a=>{const i=a.match(/^data_(.+)$/),r=i?.[1];r&&!(`${e}${r}`in t)&&(n[`${e}${r}`]={action:"perform-action",perform_action:t.service,data:t[a]},delete n[a],delete n.service)})),n}},xl=ba.preprocess(wl("actions_"),ba.object({actions_left:sc.optional(),actions_left_start:sc.optional(),actions_left_stop:sc.optional(),actions_right:sc.optional(),actions_right_start:sc.optional(),actions_right_stop:sc.optional(),actions_up:sc.optional(),actions_up_start:sc.optional(),actions_up_stop:sc.optional(),actions_down:sc.optional(),actions_down_start:sc.optional(),actions_down_stop:sc.optional(),actions_zoom_in:sc.optional(),actions_zoom_in_start:sc.optional(),actions_zoom_in_stop:sc.optional(),actions_zoom_out:sc.optional(),actions_zoom_out_start:sc.optional(),actions_zoom_out_stop:sc.optional(),r2c_delay_between_calls_seconds:ba.number().default(bl.r2c_delay_between_calls_seconds),c2r_delay_between_calls_seconds:ba.number().default(bl.c2r_delay_between_calls_seconds),presets:ba.preprocess(wl(""),ba.union([ba.record(sc),ba.object({service:ba.string().optional()})])).optional(),service:ba.string().optional()}).passthrough()),Cl={orientation:"horizontal",mode:"auto",hide_pan_tilt:!1,hide_zoom:!1,hide_home:!1,position:"bottom-right"},Ml=ba.object({mode:ba.enum(["off","auto","on"]).default(Cl.mode),position:ba.enum(["top-left","top-right","bottom-left","bottom-right"]).default(Cl.position),orientation:ba.enum(["vertical","horizontal"]).default(Cl.orientation),hide_pan_tilt:ba.boolean().default(Cl.hide_pan_tilt),hide_zoom:ba.boolean().default(Cl.hide_zoom),hide_home:ba.boolean().default(Cl.hide_home),style:ba.object({}).passthrough().optional()}),kl={mode:"auto",refresh_seconds:1},Sl=ba.object({mode:ba.enum(["auto","camera","entity","screensaver","url"]).default(kl.mode),refresh_seconds:ba.number().min(0).default(kl.refresh_seconds),url:ba.string().optional(),entity:ba.string().optional(),entity_parameters:ba.string().optional()}),El=Sl.merge(Tc).default(kl),$l=75,Al=300,Il={size:100,show_details:!0,show_favorite_control:!0,show_timeline_control:!0,show_download_control:!0},zl=ba.object({size:ba.number().min(75).max(300).default(Il.size),show_details:ba.boolean().default(Il.show_details),show_favorite_control:ba.boolean().default(Il.show_favorite_control),show_timeline_control:ba.boolean().default(Il.show_timeline_control),show_download_control:ba.boolean().default(Il.show_download_control)}),Tl={...Il,mode:"right"},jl=zl.extend({mode:ba.enum(["none","above","below","left","right"]).default(Tl.mode)}),Ol=ba.enum(["all","clips","snapshots"]),Dl={clustering_threshold:3,events_media_type:"all",window_seconds:3600,show_recordings:!0,style:"stack",pan_mode:"pan"},Rl=ba.enum(["pan","seek","seek-in-media","seek-in-camera"]),Pl=ba.object({clustering_threshold:ba.number().optional().default(Dl.clustering_threshold),events_media_type:Ol.optional().default(Dl.events_media_type),window_seconds:ba.number().min(60).max(86400).optional().default(Dl.window_seconds),show_recordings:ba.boolean().optional().default(Dl.show_recordings),style:ba.enum(["stack","ribbon"]).optional().default(Dl.style),pan_mode:Rl.optional().default(Dl.pan_mode)}),Ll={...Dl,mode:"none",style:"ribbon"},Nl=Pl.extend({mode:ba.enum(["none","above","below"]).default(Ll.mode),style:Pl.shape.style.default(Ll.style)}),Fl={...Dl,controls:{thumbnails:Tl}},Vl=Pl.extend({controls:ba.object({thumbnails:jl.default(Fl.controls.thumbnails)}).default(Fl.controls)}).default(Fl),Hl=ba.object({style:ba.enum(["none","chevrons","icons","thumbnails"]),size:ba.number().min(20)}),Bl=ba.enum(["none","slide"]),ql={always_connected:!1,disconnect_seconds:90,mute_after_microphone_mute_seconds:60},Ul=ba.object({always_connected:ba.boolean().default(ql.always_connected),disconnect_seconds:ba.number().min(0).default(ql.disconnect_seconds),mute_after_microphone_mute_seconds:ba.number().min(0).default(ql.mute_after_microphone_mute_seconds)}).default(ql),Wl=ba.object({url:ba.string().transform((e=>e.replace(/\/+$/,""))).optional(),host:ba.string().optional(),modes:ba.enum(["webrtc","mse","mp4","mjpeg"]).array().optional(),stream:ba.string().optional()}),Zl=ba.object({entity:ba.string().optional(),url:ba.string().optional()}).passthrough(),Ql=ba.object({options:ba.object({audio:ba.boolean().optional(),video:ba.boolean().optional(),pauseWhenHidden:ba.boolean().optional(),disableGl:ba.boolean().optional(),disableWebAssembly:ba.boolean().optional(),preserveDrawingBuffer:ba.boolean().optional(),progressive:ba.boolean().optional(),throttled:ba.boolean().optional(),chunkSize:ba.number().optional(),maxAudioLag:ba.number().optional(),videoBufferSize:ba.number().optional(),audioBufferSize:ba.number().optional()}).optional()}),Gl={...Tl,media_type:"events",events_media_type:"all"},Yl={auto_play:[...Qs],auto_pause:[],auto_mute:[...Ys],auto_unmute:["microphone"],preload:!1,lazy_load:!0,lazy_unload:[],draggable:!0,zoomable:!0,transition_effect:"slide",show_image_during_load:!0,mode:"single",controls:{builtin:!0,next_previous:{size:48,style:"chevrons"},ptz:Cl,thumbnails:Gl,timeline:Ll},microphone:{...ql}},Kl=jl.extend({media_type:ba.enum(["events","recordings"]).default(Yl.controls.thumbnails.media_type),events_media_type:Ol.default(Yl.controls.thumbnails.events_media_type)}),Xl=ba.object({auto_pause:ba.enum(Zs).array().default(Yl.auto_pause),auto_play:ba.enum(Qs).array().default(Yl.auto_play),auto_mute:ba.enum(Ys).array().default(Yl.auto_mute),auto_unmute:ba.enum(Gs).array().default(Yl.auto_unmute),controls:ba.object({builtin:ba.boolean().default(Yl.controls.builtin),next_previous:Hl.extend({style:ba.enum(["none","chevrons","icons"]).default(Yl.controls.next_previous.style),size:Hl.shape.size.default(Yl.controls.next_previous.size)}).default(Yl.controls.next_previous),ptz:Ml.default(Yl.controls.ptz),thumbnails:Kl.default(Yl.controls.thumbnails),timeline:Nl.default(Yl.controls.timeline)}).default(Yl.controls),display:ac,draggable:ba.boolean().default(Yl.draggable),lazy_load:ba.boolean().default(Yl.lazy_load),lazy_unload:ba.enum(Zs).array().default(Yl.lazy_unload),microphone:Ul.default(Yl.microphone),preload:ba.boolean().default(Yl.preload),show_image_during_load:ba.boolean().default(Yl.show_image_during_load),transition_effect:Bl.default(Yl.transition_effect),zoomable:ba.boolean().default(Yl.zoomable)}).merge(Tc).default(Yl),Jl=ba.object({live:Xl}),ed=ba.object({method:ba.enum(["standard","dashboard"]).default("standard").optional(),dashboard:ba.object({dashboard_path:ba.string().optional(),view_path:ba.string().optional()}).optional()}),td={dependencies:{all_cameras:!1,cameras:[]},engine:"auto",frigate:{client_id:"frigate"},live_provider:"auto",motioneye:{images:{directory_pattern:"%Y-%m-%d",file_pattern:"%H-%M-%S"},movies:{directory_pattern:"%Y-%m-%d",file_pattern:"%H-%M-%S"}},reolink:{media_resolution:"low"},ptz:bl,triggers:{motion:!1,occupancy:!1,events:[...Xs],entities:[]},proxy:{media:"auto",dynamic:!0,ssl_verification:"auto",ssl_ciphers:"auto"},always_error_if_entity_unavailable:!1},nd=ba.object({media:ba.boolean().or(ba.literal("auto")).default(td.proxy.media),dynamic:ba.boolean().default(td.proxy.dynamic),ssl_verification:ba.boolean().or(ba.literal("auto")).default(td.proxy.ssl_verification),ssl_ciphers:ba.enum(["default","insecure","intermediate","modern"]).or(ba.literal("auto")).default(td.proxy.ssl_ciphers)}),ad=ba.object({camera_entity:ba.string().optional(),icon:ba.string().optional(),title:ba.string().optional(),capabilities:ba.object({disable:ba.enum(Is).array().optional(),disable_except:ba.enum(Is).array().optional()}).optional(),id:ba.string().optional(),dependencies:ba.object({all_cameras:ba.boolean().default(td.dependencies.all_cameras),cameras:ba.string().array().default(td.dependencies.cameras)}).default(td.dependencies),triggers:ba.object({motion:ba.boolean().default(td.triggers.motion),occupancy:ba.boolean().default(td.triggers.occupancy),entities:ba.string().array().default(td.triggers.entities),events:ba.enum(Xs).array().default(td.triggers.events)}).default(td.triggers),engine:ba.enum(["auto","frigate","generic","motioneye","reolink"]).default("auto"),frigate:ba.object({url:ba.string().optional(),client_id:ba.string().default(td.frigate.client_id),camera_name:ba.string().optional(),labels:ba.string().array().optional(),zones:ba.string().array().optional()}).default(td.frigate),motioneye:ba.object({url:ba.string().optional(),images:ba.object({directory_pattern:ba.string().includes("%").default(td.motioneye.images.directory_pattern),file_pattern:ba.string().includes("%").default(td.motioneye.images.file_pattern)}).default(td.motioneye.images),movies:ba.object({directory_pattern:ba.string().includes("%").default(td.motioneye.movies.directory_pattern),file_pattern:ba.string().includes("%").default(td.motioneye.movies.file_pattern)}).default(td.motioneye.movies)}).default(td.motioneye),reolink:ba.object({url:ba.string().optional(),media_resolution:ba.enum(["high","low"]).default(td.reolink.media_resolution)}).default(td.reolink),live_provider:ba.enum(["auto","image","ha","jsmpeg","go2rtc","webrtc-card"]).default(td.live_provider),go2rtc:Wl.optional(),image:Sl.optional().default(kl),jsmpeg:Ql.optional(),webrtc_card:Zl.optional(),cast:ed.optional(),ptz:xl.default(td.ptz),dimensions:ba.object({aspect_ratio:vl.optional(),layout:yl.optional()}).optional(),proxy:nd.default(td.proxy),always_error_if_entity_unavailable:ba.boolean().default(td.always_error_if_entity_unavailable)}).default(td),id=ad.array().min(1),rd={default:Ws,camera_select:"current",interaction_seconds:300,default_reset:{every_seconds:0,after_interaction:!1,entities:[],interaction_mode:"inactive"},default_cycle_camera:!1,dark_mode:"off",triggers:{show_trigger_status:!1,filter_selected_camera:!0,actions:{trigger:"update",untrigger:"none"},untrigger_seconds:0},keyboard_shortcuts:Ls},od=ba.enum(["all","inactive","active"]).default("inactive"),sd=ba.object({actions:ba.object({interaction_mode:od,trigger:ba.enum(["default","live","media","none","update"]).default(rd.triggers.actions.trigger),untrigger:ba.enum(["default","none"]).default(rd.triggers.actions.untrigger)}).default(rd.triggers.actions),filter_selected_camera:ba.boolean().default(rd.triggers.filter_selected_camera),show_trigger_status:ba.boolean().default(rd.triggers.show_trigger_status),untrigger_seconds:ba.number().default(rd.triggers.untrigger_seconds)}),cd=ba.object({default:ba.enum(Us).default(rd.default),camera_select:ba.enum([...Us,"current"]).default(rd.camera_select),interaction_seconds:ba.number().default(rd.interaction_seconds),default_cycle_camera:ba.boolean().default(rd.default_cycle_camera),default_reset:ba.object({after_interaction:ba.boolean().default(rd.default_reset.after_interaction),every_seconds:ba.number().default(rd.default_reset.every_seconds),entities:ba.string().array().default(rd.default_reset.entities),interaction_mode:od.default(rd.default_reset.interaction_mode)}).default(rd.default_reset),render_entities:ba.string().array().optional(),dark_mode:ba.enum(["on","off","auto"]).optional(),triggers:sd.default(rd.triggers),keyboard_shortcuts:Ns.default(rd.keyboard_shortcuts)}).merge(Tc).default(rd),ld=["left","right","top","bottom"],dd=ld,ud={priority:50,enabled:!0},hd={priority:50,enabled:!1},pd={alignment:"left",button_size:40,buttons:{camera_ui:ud,cameras:ud,clips:ud,ptz_home:hd,display_mode:ud,download:ud,expand:hd,frigate:ud,fullscreen:ud,image:hd,live:ud,media_player:ud,microphone:{...hd,type:"momentary"},mute:hd,play:hd,ptz_controls:hd,recordings:hd,screenshot:hd,snapshots:ud,substreams:ud,timeline:ud},position:"top",style:"hidden"},md=Zc.extend({enabled:Zc.shape.enabled.default(ud.enabled),priority:Zc.shape.priority.default(ud.priority)}),gd=Zc.extend({enabled:Zc.shape.enabled.default(hd.enabled),priority:Zc.shape.priority.default(hd.priority)}),fd=ba.object({style:ba.enum(["none","hidden","overlay","hover","hover-card","outside"]).default(pd.style),position:ba.enum(ld).default(pd.position),alignment:ba.enum(dd).default(pd.alignment),buttons:ba.object({camera_ui:md.default(pd.buttons.camera_ui),cameras:md.default(pd.buttons.cameras),clips:md.default(pd.buttons.clips),ptz_home:gd.default(pd.buttons.ptz_home),display_mode:md.default(pd.buttons.display_mode),download:md.default(pd.buttons.download),expand:gd.default(pd.buttons.expand),frigate:md.default(pd.buttons.frigate),fullscreen:md.default(pd.buttons.fullscreen),image:gd.default(pd.buttons.image),live:md.default(pd.buttons.live),media_player:md.default(pd.buttons.media_player),microphone:gd.extend({type:ba.enum(["momentary","toggle"]).default(pd.buttons.microphone.type)}).default(pd.buttons.microphone),mute:gd.default(pd.buttons.mute),play:gd.default(pd.buttons.play),ptz_controls:gd.default(pd.buttons.ptz_controls),recordings:gd.default(pd.buttons.recordings),screenshot:gd.default(pd.buttons.screenshot),snapshots:md.default(pd.buttons.snapshots),substreams:md.default(pd.buttons.substreams),timeline:md.default(pd.buttons.timeline)}).default(pd.buttons),button_size:ba.number().min(20).default(pd.button_size)}).default(pd),_d={priority:50,enabled:!0},yd={height:46,items:{engine:_d,resolution:_d,technology:_d,title:_d},position:"bottom",style:"popup",popup_seconds:3},vd=ba.object({position:ba.enum(["top","bottom"]).default(yd.position),style:ba.enum(["none","overlay","hover","hover-card","outside","popup"]).default(yd.style),popup_seconds:ba.number().min(0).max(60).default(yd.popup_seconds),height:ba.number().min(20).default(yd.height),items:ba.object({engine:Jc.default(yd.items.engine),technology:Jc.default(yd.items.technology),resolution:Jc.default(yd.items.resolution),title:Jc.default(yd.items.title)}).default(yd.items)}).default(yd),bd={auto_play:[...Qs],auto_pause:[...Zs],auto_mute:[...Zs],auto_unmute:[],lazy_load:!0,draggable:!0,zoomable:!0,transition_effect:"slide",snapshot_click_plays_clip:!0,display_mode:"single",controls:{builtin:!0,next_previous:{size:48,style:"thumbnails"},thumbnails:Tl,timeline:Ll,ptz:{...Cl,mode:"off"}}},wd=Hl.extend({style:ba.enum(["none","thumbnails","chevrons"]).default(bd.controls.next_previous.style),size:Hl.shape.size.default(bd.controls.next_previous.size)}),xd=ba.object({auto_play:ba.enum(Qs).array().default(bd.auto_play),auto_pause:ba.enum(Zs).array().default(bd.auto_pause),auto_mute:ba.enum(Zs).array().default(bd.auto_mute),auto_unmute:ba.enum(Qs).array().default(bd.auto_unmute),lazy_load:ba.boolean().default(bd.lazy_load),draggable:ba.boolean().default(bd.draggable),zoomable:ba.boolean().default(bd.zoomable),transition_effect:Bl.default(bd.transition_effect),snapshot_click_plays_clip:ba.boolean().default(bd.snapshot_click_plays_clip),display:ac,controls:ba.object({builtin:ba.boolean().default(bd.controls.builtin),next_previous:wd.default(bd.controls.next_previous),ptz:Ml.extend({mode:ba.enum(["off","on"]).default(bd.controls.ptz.mode)}).default(bd.controls.ptz),thumbnails:jl.default(bd.controls.thumbnails),timeline:Nl.default(bd.controls.timeline)}).default(bd.controls)}).merge(Tc).default(bd),Cd={...Tl,show_details:!1},Md={controls:{thumbnails:Cd,filter:{mode:"right"}}},kd=jl.extend({show_details:ba.boolean().default(Cd.show_details)}),Sd=ba.object({controls:ba.object({thumbnails:kd.default(Md.controls.thumbnails),filter:ba.object({mode:ba.enum(["none","left","right"]).default(Md.controls.filter.mode)}).default(Md.controls.filter)}).default(Md.controls)}).merge(Tc).default(Md),Ed={aspect_ratio_mode:"dynamic",aspect_ratio:[16,9],height:"auto"},$d=ba.object({aspect_ratio_mode:ba.enum(["dynamic","static","unconstrained"]).default(Ed.aspect_ratio_mode),aspect_ratio:vl.default(Ed.aspect_ratio),height:ba.string().default(Ed.height)}).default(Ed),Ad=ba.object({conditions:gl.array(),merge:ba.object({}).passthrough().optional(),set:ba.object({}).passthrough().optional(),delete:ba.string().array().optional()}).array().optional(),Id=Ic.array(),zd=ba.object({conditions:gl.array(),actions:Id.optional(),actions_not:Id.optional()}).refine((e=>e.actions?.length||e.actions_not?.length),"Automations must include at least one action").array(),Td={features:{animated_progress_indicator:!0,media_chunk_size:50},style:{border_radius:!0,box_shadow:!0}},jd=ba.object({features:ba.object({animated_progress_indicator:ba.boolean().default(Td.features.animated_progress_indicator),media_chunk_size:ba.number().min(0).max(1e3).default(Td.features.media_chunk_size),max_simultaneous_engine_requests:ba.number().min(1).optional()}).default(Td.features),style:ba.object({border_radius:ba.boolean().default(Td.style.border_radius),box_shadow:ba.boolean().default(Td.style.box_shadow)}).default(Td.style)}).default(Td),Od={logging:!1},Dd=ba.object({logging:ba.boolean().default(Od.logging)}).default(Od),Rd=ba.enum(["casting","low-performance","scrubbing"]).array().optional(),Pd=ba.object({cameras:js(id),cameras_global:ad,view:cd,menu:fd,status_bar:vd,live:Xl,media_gallery:Sd,media_viewer:xd,image:El,elements:_l,dimensions:$d,timeline:Vl,performance:jd,debug:Dd,automations:zd.optional(),profiles:Rd,overrides:Ad,card_mod:ba.unknown(),card_id:ba.string().regex(Js).optional(),type:ba.string()}),Ld={cameras:td,view:rd,menu:pd,status_bar:yd,live:Yl,media_gallery:Md,media_viewer:bd,image:kl,timeline:Fl,performance:Td,debug:Od};function Nd(e){const t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new e.constructor(+e):"number"==typeof e||"[object Number]"===t||"string"==typeof e||"[object String]"===t?new Date(e):new Date(NaN)}function Fd(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function Vd(e,t){const n=Nd(e);return isNaN(t)?Fd(e,NaN):t?(n.setDate(n.getDate()+t),n):n}function Hd(e,t){const n=Nd(e);if(isNaN(t))return Fd(e,NaN);if(!t)return n;const a=n.getDate(),i=Fd(e,n.getTime());i.setMonth(n.getMonth()+t+1,0);return a>=i.getDate()?i:(n.setFullYear(i.getFullYear(),i.getMonth(),a),n)}function Bd(e,t){const{years:n=0,months:a=0,weeks:i=0,days:r=0,hours:o=0,minutes:s=0,seconds:c=0}=t,l=Nd(e),d=a||n?Hd(l,a+12*n):l,u=1e3*(c+60*(s+60*o));return Fd(e,(r||i?Vd(d,r+7*i):d).getTime()+u)}const qd=6048e5,Ud=864e5,Wd=6e4,Zd=36e5,Qd=1e3;let Gd={};function Yd(){return Gd}function Kd(e,t){const n=Yd(),a=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=Nd(e),r=i.getDay(),o=(r=i.getTime()?n+1:t.getTime()>=o.getTime()?n:n-1}function eu(e){const t=Nd(e);return t.setHours(0,0,0,0),t}function tu(e){const t=Nd(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function nu(e){if(!(t=e,t instanceof Date||"object"==typeof t&&"[object Date]"===Object.prototype.toString.call(t)||"number"==typeof e))return!1;var t;const n=Nd(e);return!isNaN(Number(n))}function au(e){return t=>{const n=(e?Math[e]:Math.trunc)(t);return 0===n?0:n}}function iu(e,t){return+Nd(e)-+Nd(t)}function ru(e,t,n){const a=iu(e,t)/1e3;return au(n?.roundingMethod)(a)}const ou={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function su(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const cu={date:su({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:su({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:su({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},lu={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function du(e){return(t,n)=>{let a;if("formatting"===(n?.context?String(n.context):"standalone")&&e.formattingValues){const t=e.defaultFormattingWidth||e.defaultWidth,i=n?.width?String(n.width):t;a=e.formattingValues[i]||e.formattingValues[t]}else{const t=e.defaultWidth,i=n?.width?String(n.width):e.defaultWidth;a=e.values[i]||e.values[t]}return a[e.argumentCallback?e.argumentCallback(t):t]}}function uu(e){return(t,n={})=>{const a=n.width,i=a&&e.matchPatterns[a]||e.matchPatterns[e.defaultMatchWidth],r=t.match(i);if(!r)return null;const o=r[0],s=a&&e.parsePatterns[a]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?function(e,t){for(let n=0;ne.test(o))):function(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n;return}(s,(e=>e.test(o)));let l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;return{value:l,rest:t.slice(o.length)}}}var hu;const pu={code:"en-US",formatDistance:(e,t,n)=>{let a;const i=ou[e];return a="string"==typeof i?i:1===t?i.one:i.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+a:a+" ago":a},formatLong:cu,formatRelative:(e,t,n,a)=>lu[e],localize:{ordinalNumber:(e,t)=>{const n=Number(e),a=n%100;if(a>20||a<10)switch(a%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:du({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:du({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:du({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:du({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:du({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(hu={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)},(e,t={})=>{const n=e.match(hu.matchPattern);if(!n)return null;const a=n[0],i=e.match(hu.parsePattern);if(!i)return null;let r=hu.valueCallback?hu.valueCallback(i[0]):i[0];return r=t.valueCallback?t.valueCallback(r):r,{value:r,rest:e.slice(a.length)}}),era:uu({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:uu({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:uu({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:uu({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:uu({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function mu(e){const t=Nd(e),n=function(e,t){const n=eu(e),a=eu(t),i=+n-tu(n),r=+a-tu(a);return Math.round((i-r)/Ud)}(t,function(e){const t=Nd(e),n=Fd(e,0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}(t));return n+1}function gu(e){const t=Nd(e),n=+Xd(t)-+function(e){const t=Jd(e),n=Fd(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),Xd(n)}(t);return Math.round(n/qd)+1}function fu(e,t){const n=Nd(e),a=n.getFullYear(),i=Yd(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=Fd(e,0);o.setFullYear(a+1,0,r),o.setHours(0,0,0,0);const s=Kd(o,t),c=Fd(e,0);c.setFullYear(a,0,r),c.setHours(0,0,0,0);const l=Kd(c,t);return n.getTime()>=s.getTime()?a+1:n.getTime()>=l.getTime()?a:a-1}function _u(e,t){const n=Nd(e),a=+Kd(n,t)-+function(e,t){const n=Yd(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=fu(e,t),r=Fd(e,0);return r.setFullYear(i,0,a),r.setHours(0,0,0,0),Kd(r,t)}(n,t);return Math.round(a/qd)+1}function yu(e,t){return(e<0?"-":"")+Math.abs(e).toString().padStart(t,"0")}const vu={y(e,t){const n=e.getFullYear(),a=n>0?n:1-n;return yu("yy"===t?a%100:a,t.length)},M(e,t){const n=e.getMonth();return"M"===t?String(n+1):yu(n+1,2)},d:(e,t)=>yu(e.getDate(),t.length),a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return"am"===n?"a.m.":"p.m."}},h:(e,t)=>yu(e.getHours()%12||12,t.length),H:(e,t)=>yu(e.getHours(),t.length),m:(e,t)=>yu(e.getMinutes(),t.length),s:(e,t)=>yu(e.getSeconds(),t.length),S(e,t){const n=t.length,a=e.getMilliseconds();return yu(Math.trunc(a*Math.pow(10,n-3)),t.length)}},bu="midnight",wu="noon",xu="morning",Cu="afternoon",Mu="evening",ku="night",Su={G:function(e,t,n){const a=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(a,{width:"abbreviated"});case"GGGGG":return n.era(a,{width:"narrow"});default:return n.era(a,{width:"wide"})}},y:function(e,t,n){if("yo"===t){const t=e.getFullYear(),a=t>0?t:1-t;return n.ordinalNumber(a,{unit:"year"})}return vu.y(e,t)},Y:function(e,t,n,a){const i=fu(e,a),r=i>0?i:1-i;if("YY"===t){return yu(r%100,2)}return"Yo"===t?n.ordinalNumber(r,{unit:"year"}):yu(r,t.length)},R:function(e,t){return yu(Jd(e),t.length)},u:function(e,t){return yu(e.getFullYear(),t.length)},Q:function(e,t,n){const a=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(a);case"QQ":return yu(a,2);case"Qo":return n.ordinalNumber(a,{unit:"quarter"});case"QQQ":return n.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(a,{width:"narrow",context:"formatting"});default:return n.quarter(a,{width:"wide",context:"formatting"})}},q:function(e,t,n){const a=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(a);case"qq":return yu(a,2);case"qo":return n.ordinalNumber(a,{unit:"quarter"});case"qqq":return n.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(a,{width:"narrow",context:"standalone"});default:return n.quarter(a,{width:"wide",context:"standalone"})}},M:function(e,t,n){const a=e.getMonth();switch(t){case"M":case"MM":return vu.M(e,t);case"Mo":return n.ordinalNumber(a+1,{unit:"month"});case"MMM":return n.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(a,{width:"narrow",context:"formatting"});default:return n.month(a,{width:"wide",context:"formatting"})}},L:function(e,t,n){const a=e.getMonth();switch(t){case"L":return String(a+1);case"LL":return yu(a+1,2);case"Lo":return n.ordinalNumber(a+1,{unit:"month"});case"LLL":return n.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(a,{width:"narrow",context:"standalone"});default:return n.month(a,{width:"wide",context:"standalone"})}},w:function(e,t,n,a){const i=_u(e,a);return"wo"===t?n.ordinalNumber(i,{unit:"week"}):yu(i,t.length)},I:function(e,t,n){const a=gu(e);return"Io"===t?n.ordinalNumber(a,{unit:"week"}):yu(a,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getDate(),{unit:"date"}):vu.d(e,t)},D:function(e,t,n){const a=mu(e);return"Do"===t?n.ordinalNumber(a,{unit:"dayOfYear"}):yu(a,t.length)},E:function(e,t,n){const a=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(a,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(a,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},e:function(e,t,n,a){const i=e.getDay(),r=(i-a.weekStartsOn+8)%7||7;switch(t){case"e":return String(r);case"ee":return yu(r,2);case"eo":return n.ordinalNumber(r,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(e,t,n,a){const i=e.getDay(),r=(i-a.weekStartsOn+8)%7||7;switch(t){case"c":return String(r);case"cc":return yu(r,t.length);case"co":return n.ordinalNumber(r,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(e,t,n){const a=e.getDay(),i=0===a?7:a;switch(t){case"i":return String(i);case"ii":return yu(i,t.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},a:function(e,t,n){const a=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(e,t,n){const a=e.getHours();let i;switch(i=12===a?wu:0===a?bu:a/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(e,t,n){const a=e.getHours();let i;switch(i=a>=17?Mu:a>=12?Cu:a>=4?xu:ku,t){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){let t=e.getHours()%12;return 0===t&&(t=12),n.ordinalNumber(t,{unit:"hour"})}return vu.h(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getHours(),{unit:"hour"}):vu.H(e,t)},K:function(e,t,n){const a=e.getHours()%12;return"Ko"===t?n.ordinalNumber(a,{unit:"hour"}):yu(a,t.length)},k:function(e,t,n){let a=e.getHours();return 0===a&&(a=24),"ko"===t?n.ordinalNumber(a,{unit:"hour"}):yu(a,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):vu.m(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getSeconds(),{unit:"second"}):vu.s(e,t)},S:function(e,t){return vu.S(e,t)},X:function(e,t,n){const a=e.getTimezoneOffset();if(0===a)return"Z";switch(t){case"X":return $u(a);case"XXXX":case"XX":return Au(a);default:return Au(a,":")}},x:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"x":return $u(a);case"xxxx":case"xx":return Au(a);default:return Au(a,":")}},O:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Eu(a,":");default:return"GMT"+Au(a,":")}},z:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Eu(a,":");default:return"GMT"+Au(a,":")}},t:function(e,t,n){return yu(Math.trunc(e.getTime()/1e3),t.length)},T:function(e,t,n){return yu(e.getTime(),t.length)}};function Eu(e,t=""){const n=e>0?"-":"+",a=Math.abs(e),i=Math.trunc(a/60),r=a%60;return 0===r?n+String(i):n+String(i)+t+yu(r,2)}function $u(e,t){if(e%60==0){return(e>0?"-":"+")+yu(Math.abs(e)/60,2)}return Au(e,t)}function Au(e,t=""){const n=e>0?"-":"+",a=Math.abs(e);return n+yu(Math.trunc(a/60),2)+t+yu(a%60,2)}const Iu=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},zu=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},Tu={p:zu,P:(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],a=n[1],i=n[2];if(!i)return Iu(e,t);let r;switch(a){case"P":r=t.dateTime({width:"short"});break;case"PP":r=t.dateTime({width:"medium"});break;case"PPP":r=t.dateTime({width:"long"});break;default:r=t.dateTime({width:"full"})}return r.replace("{{date}}",Iu(a,t)).replace("{{time}}",zu(i,t))}},ju=/^D+$/,Ou=/^Y+$/,Du=["D","DD","YY","YYYY"];function Ru(e){return ju.test(e)}function Pu(e){return Ou.test(e)}function Lu(e,t,n){const a=function(e,t,n){const a="Y"===e[0]?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${a} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}(e,t,n);if(console.warn(a),Du.includes(e))throw new RangeError(a)}const Nu=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Fu=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Vu=/^'([^]*?)'?$/,Hu=/''/g,Bu=/[a-zA-Z]/;function qu(e,t,n){const a=Yd(),i=n?.locale??a.locale??pu,r=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??a.weekStartsOn??a.locale?.options?.weekStartsOn??0,s=Nd(e);if(!nu(s))throw new RangeError("Invalid time value");let c=t.match(Fu).map((e=>{const t=e[0];if("p"===t||"P"===t){return(0,Tu[t])(e,i.formatLong)}return e})).join("").match(Nu).map((e=>{if("''"===e)return{isToken:!1,value:"'"};const t=e[0];if("'"===t)return{isToken:!1,value:Uu(e)};if(Su[t])return{isToken:!0,value:e};if(t.match(Bu))throw new RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}}));i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));const l={firstWeekContainsDate:r,weekStartsOn:o,locale:i};return c.map((a=>{if(!a.isToken)return a.value;const r=a.value;(!n?.useAdditionalWeekYearTokens&&Pu(r)||!n?.useAdditionalDayOfYearTokens&&Ru(r))&&Lu(r,t,String(e));return(0,Su[r[0]])(s,r,i.localize,l)})).join("")}function Uu(e){const t=e.match(Vu);return t?t[1].replace(Hu,"'"):e}function Wu(e,t){const{years:n=0,months:a=0,weeks:i=0,days:r=0,hours:o=0,minutes:s=0,seconds:c=0}=t,l=function(e,t){return Hd(e,-t)}(e,a+12*n),d=function(e,t){return Vd(e,-t)}(l,r+7*i),u=1e3*(c+60*(s+60*o));return Fd(e,d.getTime()-u)}function Zu(e,t){return e===t||e!=e&&t!=t}function Qu(e,t){for(var n=e.length;n--;)if(Zu(e[n][0],t))return n;return-1}var Gu=Array.prototype.splice;function Yu(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1},Yu.prototype.set=function(e,t){var n=this.__data__,a=Qu(n,e);return a<0?(++this.size,n.push([e,t])):n[a][1]=t,this};var Ku="object"==typeof global&&global&&global.Object===Object&&global,Xu="object"==typeof self&&self&&self.Object===Object&&self,Ju=Ku||Xu||Function("return this")(),eh=Ju.Symbol,th=Object.prototype,nh=th.hasOwnProperty,ah=th.toString,ih=eh?eh.toStringTag:void 0;var rh=Object.prototype.toString;var oh="[object Null]",sh="[object Undefined]",ch=eh?eh.toStringTag:void 0;function lh(e){return null==e?void 0===e?sh:oh:ch&&ch in Object(e)?function(e){var t=nh.call(e,ih),n=e[ih];try{e[ih]=void 0;var a=!0}catch(e){}var i=ah.call(e);return a&&(t?e[ih]=n:delete e[ih]),i}(e):function(e){return rh.call(e)}(e)}function dh(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var uh="[object AsyncFunction]",hh="[object Function]",ph="[object GeneratorFunction]",mh="[object Proxy]";function gh(e){if(!dh(e))return!1;var t=lh(e);return t==hh||t==ph||t==uh||t==mh}var fh,_h=Ju["__core-js_shared__"],yh=(fh=/[^.]+$/.exec(_h&&_h.keys&&_h.keys.IE_PROTO||""))?"Symbol(src)_1."+fh:"";var vh=Function.prototype.toString;function bh(e){if(null!=e){try{return vh.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var wh=/^\[object .+?Constructor\]$/,xh=Function.prototype,Ch=Object.prototype,Mh=xh.toString,kh=Ch.hasOwnProperty,Sh=RegExp("^"+Mh.call(kh).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Eh(e){return!(!dh(e)||(t=e,yh&&yh in t))&&(gh(e)?Sh:wh).test(bh(e));var t}function $h(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Eh(n)?n:void 0}var Ah=$h(Ju,"Map"),Ih=$h(Object,"create");var zh=Object.prototype.hasOwnProperty;var Th=Object.prototype.hasOwnProperty;function jh(e){var t=-1,n=null==e?0:e.length;for(this.clear();++ts))return!1;var l=r.get(e),d=r.get(t);if(l&&d)return l==t&&d==e;var u=-1,h=!0,p=n&Vh?new Ph:void 0;for(r.set(e,t),r.set(t,e);++u-1&&e%1==0&&e-1&&e%1==0&&e<=Ep}var Ap={};function Ip(e){return function(t){return e(t)}}Ap["[object Float32Array]"]=Ap["[object Float64Array]"]=Ap["[object Int8Array]"]=Ap["[object Int16Array]"]=Ap["[object Int32Array]"]=Ap["[object Uint8Array]"]=Ap["[object Uint8ClampedArray]"]=Ap["[object Uint16Array]"]=Ap["[object Uint32Array]"]=!0,Ap["[object Arguments]"]=Ap["[object Array]"]=Ap["[object ArrayBuffer]"]=Ap["[object Boolean]"]=Ap["[object DataView]"]=Ap["[object Date]"]=Ap["[object Error]"]=Ap["[object Function]"]=Ap["[object Map]"]=Ap["[object Number]"]=Ap["[object Object]"]=Ap["[object RegExp]"]=Ap["[object Set]"]=Ap["[object String]"]=Ap["[object WeakMap]"]=!1;var zp="object"==typeof exports&&exports&&!exports.nodeType&&exports,Tp=zp&&"object"==typeof module&&module&&!module.nodeType&&module,jp=Tp&&Tp.exports===zp&&Ku.process,Op=function(){try{var e=Tp&&Tp.require&&Tp.require("util").types;return e||jp&&jp.binding&&jp.binding("util")}catch(e){}}(),Dp=Op,Rp=Dp&&Dp.isTypedArray,Pp=Rp?Ip(Rp):function(e){return mp(e)&&$p(e.length)&&!!Ap[lh(e)]},Lp=Object.prototype.hasOwnProperty;function Np(e,t){var n=cp(e),a=!n&&vp(e),i=!n&&!a&&Cp(e),r=!n&&!a&&!i&&Pp(e),o=n||a||i||r,s=o?function(e,t){for(var n=-1,a=Array(e);++n0){if(++ig>=800)return arguments[0]}else ig=0;return ag.apply(void 0,arguments)});function sg(e,t){return og(function(e,t,n){return t=Jm(void 0===t?e.length-1:t,0),function(){for(var a=arguments,i=-1,r=Jm(a.length-t,0),o=Array(r);++i1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(r=e.length>3&&"function"==typeof r?(i--,r):void 0,o&&cg(n[0],n[1],o)&&(r=i<3?void 0:r,i=1),t=Object(t);++a-1}function Pg(e,t,n){for(var a=-1,i=null==e?0:e.length;++a=Ng){var l=t?null:Lg(e);if(l)return Uh(l);o=!1,i=Nh,c=new Ph}else c=t?[]:s;e:for(;++ae[0].toUpperCase()+e.substring(1))).join(" ")}function Bg(e,t,n){const a=e[t];return e.splice(t,1),e.splice(n,0,a),e}const qg=e=>Array.isArray(e)?e:[e],Ug=e=>e instanceof Set?e:new Set(qg(e));function Wg(e,t,n){return!function(e,t,n){var a=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===a?ym(e,t,void 0,n):!!a}(e,t,n)}function Zg(e,t=console.warn){e instanceof $s&&e.context?t(e,e.context):t("object"==typeof e&&"message"in e?e.message:e)}const Qg=()=>window.matchMedia("(hover: hover) and (pointer: fine)").matches,Gg=(e,t)=>qu(e,"yyyy-MM-dd HH:mm"+(t?":ss":"")),Yg=e=>qu(e,"yyyy-MM-dd"),Kg=(e,t)=>{window.requestIdleCallback?window.requestIdleCallback(e,{...t&&{timeout:t}}):e()};function Xg(e,t){const n=function(e,t,n){const a=iu(e,t)/Zd;return au(n?.roundingMethod)(a)}(t,e),a=function(e,t,n){const a=iu(e,t)/Wd;return au(n?.roundingMethod)(a)}(t,e)-60*n;let i="";return n&&(i+=`${n}h `),a&&(i+=`${a}m `),i+=`${ru(t,e)-60*n*60-60*a}s`,i}const Jg=async(e,t)=>await Promise.all(Array.from(e).map((e=>t(e)))),ef=e=>new Date(`${e}T00:00:00`),tf=async e=>{await new Promise((t=>setTimeout(t,1e3*e)))},nf=e=>!isNaN(e.getTime()),af=(e,t,n,a)=>{t?e.setAttribute(n,a??""):e.removeAttribute(n)},rf=e=>!!e,of=e=>e instanceof HTMLElement,sf=e=>(e instanceof HTMLSlotElement?e.assignedElements({flatten:!0}):[...e.children]).filter(of),cf=e=>e?.ratio&&2===e.ratio.length?`${e.ratio[0]} / ${e.ratio[1]}`:e?.defaultStatic?"16 / 9":"auto",lf=e=>({"aspect-ratio":cf(e)}),df=e=>{if(Array.isArray(e))return e.filter((e=>void 0!==e)).map((e=>df(e)));if("object"==typeof e&&null!==e){const t={};for(const n in e)t[n]=df(e[n]);return t}return e},uf=(e,t,n)=>Og(e,n)===Og(t,n);function hf(e){if(!e)return null;const t=Ac.safeParse(e);return t.success?t.data:null}function pf(e,t){return{action:"fire-dom-event",frigate_card_action:e,...t?.cardID&&{card_id:t.cardID}}}function mf(e,t,n){return{action:"fire-dom-event",frigate_card_action:e,camera:t,...n?.cardID&&{card_id:n.cardID}}}function gf(e,t,n){return{action:"fire-dom-event",frigate_card_action:"media_player",media_player:e,media_player_action:t,...n?.cardID&&{card_id:n.cardID}}}function ff(e){return{action:"fire-dom-event",frigate_card_action:"ptz_multi",...e?.cardID&&{card_id:e.cardID},...e?.ptzAction&&{ptz_action:e.ptzAction},...e?.ptzPhase&&{ptz_phase:e.ptzPhase},...e?.ptzPreset&&{ptz_preset:e.ptzPreset},...e?.targetID&&{target_id:e.targetID}}}function _f(e,t){return e&&t?"tap"===e&&t.tap_action?t.tap_action:"hold"===e&&t.hold_action?t.hold_action:"double_tap"===e&&t.double_tap_action?t.double_tap_action:"end_tap"===e&&t.end_tap_action?t.end_tap_action:"start_tap"===e&&t.start_tap_action?t.start_tap_action:null:null}const yf=e=>qg(e).some((e=>function(e){return void 0!==e&&"none"!==e.action}(e))),vf=e=>{e.stopPropagation()};class bf{constructor(){this._timer=null,this._repeated=!1}stop(){this._timer&&(this._repeated?window.clearInterval(this._timer):window.clearTimeout(this._timer),this._timer=null)}isRunning(){return null!==this._timer}start(e,t){this.stop(),this._timer=window.setTimeout((()=>{this._timer=null,t()}),1e3*e),this._repeated=!1}startRepeated(e,t){this.stop(),this._timer=window.setInterval((()=>{t()}),1e3*e),this._repeated=!0}}class wf extends HTMLElement{constructor(){super(...arguments),this.holdTime=.4,this.holdTimer=new bf,this.doubleClickTimer=new bf,this.held=!1,this.started=!1}connectedCallback(){["touchcancel","mouseout","mouseup","touchmove","mousewheel","wheel","scroll"].forEach((e=>{document.addEventListener(e,(()=>{this.holdTimer.stop()}),{passive:!0})}))}bind(e,t){if(e.actionHandlerOptions)return void(e.actionHandlerOptions=t);e.actionHandlerOptions=t,e.addEventListener("contextmenu",(e=>{const t=e||window.event;return t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.cancelBubble=!0,t.returnValue=!1,!1}));const n=()=>{this.held=!1,this.holdTimer.start(this.holdTime,(()=>{this.held=!0})),this.started||(this.started=!0,et(e,"action",{action:"start_tap"}))},a=t=>{this.holdTimer.stop(),this.started&&(this.started=!1,et(e,"action",{action:"end_tap"}))},i=t=>{const n=e.actionHandlerOptions;n?.allowPropagation||vf(t),["touchend","touchcancel"].includes(t.type)&&!this.held||(a(),n?.hasHold&&this.held?et(e,"action",{action:"hold"}):n?.hasDoubleClick?"click"===t.type&&t.detail<2||!this.doubleClickTimer.isRunning()?this.doubleClickTimer.start(.25,(()=>et(e,"action",{action:"tap"}))):(this.doubleClickTimer.stop(),et(e,"action",{action:"double_tap"})):et(e,"action",{action:"tap"}))};e.addEventListener("touchstart",n,{passive:!0}),e.addEventListener("touchend",i),e.addEventListener("touchcancel",i),e.addEventListener("mousedown",n,{passive:!0}),e.addEventListener("click",i),e.addEventListener("keyup",(e=>{"Enter"===e.key&&i(e)})),e.addEventListener("mouseleave",a)}}customElements.define("action-handler-frigate-card",wf);const xf=(e,t)=>{const n=(()=>{const e=document.body;if(e.querySelector("action-handler-frigate-card"))return e.querySelector("action-handler-frigate-card");const t=document.createElement("action-handler-frigate-card");return e.appendChild(t),t})();n&&n.bind(e,t)},Cf=ge(class extends fe{update(e,[t]){return xf(e.element,t),U}render(e){}});var Mf=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)sp(t,pp(e)),e=Dm(e);return t}:dp;function kf(e){return lp(e,Gm,Mf)}var Sf=Object.prototype.hasOwnProperty;var Ef=/\w*$/;var $f=eh?eh.prototype:void 0,Af=$f?$f.valueOf:void 0;var If="[object Boolean]",zf="[object Date]",Tf="[object Map]",jf="[object Number]",Of="[object RegExp]",Df="[object Set]",Rf="[object String]",Pf="[object Symbol]",Lf="[object ArrayBuffer]",Nf="[object DataView]",Ff="[object Float32Array]",Vf="[object Float64Array]",Hf="[object Int8Array]",Bf="[object Int16Array]",qf="[object Int32Array]",Uf="[object Uint8Array]",Wf="[object Uint8ClampedArray]",Zf="[object Uint16Array]",Qf="[object Uint32Array]";function Gf(e,t,n){var a,i,r,o=e.constructor;switch(t){case Lf:return Im(e);case If:case zf:return new o(+e);case Nf:return function(e,t){var n=t?Im(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case Ff:case Vf:case Hf:case Bf:case qf:case Uf:case Wf:case Zf:case Qf:return zm(e,n);case Tf:return new o;case jf:case Rf:return new o(e);case Of:return(r=new(i=e).constructor(i.source,Ef.exec(i))).lastIndex=i.lastIndex,r;case Df:return new o;case Pf:return a=e,Af?Object(Af.call(a)):{}}}var Yf=Dp&&Dp.isMap,Kf=Yf?Ip(Yf):function(e){return mp(e)&&"[object Map]"==um(e)};var Xf=Dp&&Dp.isSet,Jf=Xf?Ip(Xf):function(e){return mp(e)&&"[object Set]"==um(e)},e_=1,t_=2,n_=4,a_="[object Arguments]",i_="[object Function]",r_="[object GeneratorFunction]",o_="[object Object]",s_={};function c_(e,t,n,a,i,r){var o,s=t&e_,c=t&t_,l=t&n_;if(n&&(o=i?n(e,a,i,r):n(e)),void 0!==o)return o;if(!dh(e))return e;var d=cp(e);if(d){if(o=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Sf.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!s)return Tm(e,o)}else{var u=um(e),h=u==i_||u==r_;if(Cp(e))return Am(e,s);if(u==o_||u==a_||h&&!i){if(o=c||h?{}:Rm(e),!s)return c?function(e,t){return Wm(e,Mf(e),t)}(e,function(e,t){return e&&Wm(t,Gm(t),e)}(o,e)):function(e,t){return Wm(e,pp(e),t)}(e,function(e,t){return e&&Wm(t,Wp(t),e)}(o,e))}else{if(!s_[u])return i?e:{};o=Gf(e,u,s)}}r||(r=new Rh);var p=r.get(e);if(p)return p;r.set(e,o),Jf(e)?e.forEach((function(a){o.add(c_(a,t,n,a,e,r))})):Kf(e)&&e.forEach((function(a,i){o.set(i,c_(a,t,n,i,e,r))}));var m=d?void 0:(l?c?kf:Zp:c?Gm:Wp)(e);return function(e,t){for(var n=-1,a=null==e?0:e.length;++nvoid 0===globalThis.DOMException?new g_(e):new DOMException(e),__=e=>{const t=void 0===e.reason?f_("This operation was aborted."):e.reason;return t instanceof Error?t:f_(t)};class y_{#e=[];enqueue(e,t){const n={priority:(t={priority:0,...t}).priority,run:e};if(this.size&&this.#e[this.size-1].priority>=t.priority)return void this.#e.push(n);const a=function(e,t,n){let a=0,i=e.length;for(;i>0;){const r=Math.trunc(i/2);let o=a+r;n(e[o],t)<=0?(a=++o,i-=r+1):i=r}return a}(this.#e,n,((e,t)=>t.priority-e.priority));this.#e.splice(a,0,n)}dequeue(){const e=this.#e.shift();return e?.run}filter(e){return this.#e.filter((t=>t.priority===e.priority)).map((e=>e.run))}get size(){return this.#e.length}}class v_ extends p_{#t;#n;#a=0;#i;#r;#o=0;#s;#c;#e;#l;#d=0;#u;#h;#p;timeout;constructor(e){if(super(),!("number"==typeof(e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:y_,...e}).intervalCap&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??""}\` (${typeof e.intervalCap})`);if(void 0===e.interval||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??""}\` (${typeof e.interval})`);this.#t=e.carryoverConcurrencyCount,this.#n=e.intervalCap===Number.POSITIVE_INFINITY||0===e.interval,this.#i=e.intervalCap,this.#r=e.interval,this.#e=new e.queueClass,this.#l=e.queueClass,this.concurrency=e.concurrency,this.timeout=e.timeout,this.#p=!0===e.throwOnTimeout,this.#h=!1===e.autoStart}get#m(){return this.#n||this.#a{this.#y()}),t)),!0;this.#a=this.#t?this.#d:0}return!1}#_(){if(0===this.#e.size)return this.#s&&clearInterval(this.#s),this.#s=void 0,this.emit("empty"),0===this.#d&&this.emit("idle"),!1;if(!this.#h){const e=!this.#w;if(this.#m&&this.#g){const t=this.#e.dequeue();return!!t&&(this.emit("active"),t(),e&&this.#b(),!0)}}return!1}#b(){this.#n||void 0!==this.#s||(this.#s=setInterval((()=>{this.#v()}),this.#r),this.#o=Date.now()+this.#r)}#v(){0===this.#a&&0===this.#d&&this.#s&&(clearInterval(this.#s),this.#s=void 0),this.#a=this.#t?this.#d:0,this.#x()}#x(){for(;this.#_(););}get concurrency(){return this.#u}set concurrency(e){if(!("number"==typeof e&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this.#u=e,this.#x()}async#C(e){return new Promise(((t,n)=>{e.addEventListener("abort",(()=>{n(e.reason)}),{once:!0})}))}async add(e,t={}){return t={timeout:this.timeout,throwOnTimeout:this.#p,...t},new Promise(((n,a)=>{this.#e.enqueue((async()=>{this.#d++,this.#a++;try{t.signal?.throwIfAborted();let a=e({signal:t.signal});t.timeout&&(a=function(e,t){const{milliseconds:n,fallback:a,message:i,customTimers:r={setTimeout:setTimeout,clearTimeout:clearTimeout}}=t;let o;const s=new Promise(((s,c)=>{if("number"!=typeof n||1!==Math.sign(n))throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${n}\``);if(t.signal){const{signal:e}=t;e.aborted&&c(__(e)),e.addEventListener("abort",(()=>{c(__(e))}))}if(n===Number.POSITIVE_INFINITY)return void e.then(s,c);const l=new m_;o=r.setTimeout.call(void 0,(()=>{if(a)try{s(a())}catch(e){c(e)}else"function"==typeof e.cancel&&e.cancel(),!1===i?s():i instanceof Error?c(i):(l.message=i??`Promise timed out after ${n} milliseconds`,c(l))}),n),(async()=>{try{s(await e)}catch(e){c(e)}})()})),c=s.finally((()=>{c.clear()}));return c.clear=()=>{r.clearTimeout.call(void 0,o),o=void 0},c}(Promise.resolve(a),{milliseconds:t.timeout})),t.signal&&(a=Promise.race([a,this.#C(t.signal)]));const i=await a;n(i),this.emit("completed",i)}catch(e){if(e instanceof m_&&!t.throwOnTimeout)return void n();a(e),this.emit("error",e)}finally{this.#f()}}),t),this.emit("add"),this.#_()}))}async addAll(e,t){return Promise.all(e.map((async e=>this.add(e,t))))}start(){return this.#h?(this.#h=!1,this.#x(),this):this}pause(){this.#h=!0}clear(){this.#e=new this.#l}async onEmpty(){0!==this.#e.size&&await this.#M("empty")}async onSizeLessThan(e){this.#e.sizethis.#e.size{const a=()=>{t&&!t()||(this.off(e,a),n())};this.on(e,a)}))}get size(){return this.#e.size}sizeBy(e){return this.#e.filter(e).length}get pending(){return this.#d}get isPaused(){return this.#h}}var b_={frigate_card:"Frigate card",frigate_card_description:"A Lovelace card for use with Frigate",live:"Live",no_media:"No media to display",recordings:"Recordings",version:"Version"},w_={cameras:{camera_entity:"Camera Entity",capabilities:{capabilities:{clips:"Clips","favorite-events":"Favorite Events","favorite-recordings":"Favorite Recordings",live:"Live",menu:"Menu",ptz:"PTZ",recordings:"Recordings",seek:"Seeking",snapshots:"Snapshots",substream:"Substream"},disable:"Disable",disable_except:"Disable except",editor_label:"Camera capabilities"},cast:{dashboard:{dashboard_path:"Dashboard path",view_path:"View path"},editor_label:"Cast options",method:"Cast method",methods:{dashboard:"Dashboard",standard:"Standard"}},dependencies:{all_cameras:"Show events for all cameras with this camera",cameras:"Show events for specific cameras with this camera",editor_label:"Dependency options"},dimensions:{aspect_ratio:"Static aspect ratio",editor_label:"Camera dimensions",layout:{editor_label:"Camera Layout",fit:"Layout fit",fits:{contain:"Media is contained/letterboxed",cover:"Media expands proportionally to cover the card",fill:"Media is stretched to fill the card"},pan:{x:"Pan horizontal percentage",y:"Pan vertical percentage"},position:{editor_label:"Layout Cover Position",x:"Horizontal placement percentage",y:"Vertical placement percentage"},view_box:{bottom:"Bottom inset percentage",editor_label:"Layout View Box",left:"Left inset percentage",right:"Right inset percentage",top:"Top inset percentage"},zoom:"Zoom factor"}},engines:{editor_label:"Camera engine options"},frigate:{camera_name:"Frigate camera name (Autodetected from entity)",client_id:"Frigate client id (For >1 Frigate server)",editor_label:"Frigate options",labels:"Frigate labels/object filters",url:"Frigate server URL",zones:"Frigate zones"},go2rtc:{editor_label:"go2rtc Options",modes:{editor_label:"go2rtc Modes",mjpeg:"Motion JPEG (MJPEG)",mp4:"MPEG-4 (MP4)",mse:"Media Source Extensions (MSE)",webrtc:"Web Real-Time Communication (WebRTC)"},stream:"go2rtc stream name"},icon:"Icon for this camera (Autodetected from entity)",id:"Unique id for this camera in this card",image:{editor_label:"Image Options",refresh_seconds:"Number of seconds after which to refresh live image (0=never)",url:"Image URL to use instead of camera entity snapshot"},live_provider:"Live view provider for this camera",live_provider_options:{editor_label:"Live provider options"},live_providers:{auto:"Automatic",go2rtc:"go2rtc",ha:"Home Assistant video stream (i.e. HLS, LL-HLS, WebRTC via HA)",image:"Home Assistant images",jsmpeg:"JSMpeg","webrtc-card":"WebRTC Card (i.e. AlexxIT's WebRTC Card)"},motioneye:{editor_label:"MotionEye options",images:{directory_pattern:"Images directory pattern",file_pattern:"Images file pattern"},movies:{directory_pattern:"Movies directory pattern",file_pattern:"Movies file pattern"},url:"MotionEye UI URL"},proxy:{dynamic:"Dynamic proxying",editor_label:"Camera proxying",media:{auto:"Media proxying automatically configured",editor_label:"Media proxying",false:"Media proxying disabled",true:"Media proxying enabled"},ssl_ciphers:{auto:"SSL ciphers automatically configured",default:"Default SSL ciphers",editor_label:"SSL ciphers",insecure:"Insecure SSL ciphers",intermediate:"Intermediate SSL ciphers",modern:"Modern SSL ciphers"},ssl_verification:{auto:"SSL verification automatically configured",editor_label:"SSL verification",false:"SSL verification disabled",true:"SSL verification enabled"}},reolink:{editor_label:"Reolink options",media_resolution:{editor_label:"Media Resolution",high:"High Resolution",low:"Low Resolution"},url:"Reolink UI URL"},title:"Title for this camera (Autodetected from entity)",triggers:{editor_label:"Trigger options",entities:"Trigger from other entities",events:{clips:"Events with new clips",editor_label:"Trigger Events",events:"All events",snapshots:"Events with new snapshots"},motion:"Trigger by auto-detecting the motion sensor",occupancy:"Trigger by auto-detecting the occupancy sensor"},webrtc_card:{editor_label:"WebRTC Card Options",entity:"WebRTC Card Camera Entity (Not a Frigate camera)",url:"WebRTC Card Camera URL"}},common:{controls:{builtin:"Built-in video controls",filter:{editor_label:"Media Filter",mode:"Filter mode",modes:{left:"Media filter in a drawer to the left",none:"No media filter",right:"Media filter in a drawer to the right"}},next_previous:{editor_label:"Next & Previous",size:"Next & previous control size in pixels",style:"Next & previous control style",styles:{chevrons:"Chevrons",icons:"Icons",none:"None",thumbnails:"Thumbnails"}},thumbnails:{editor_label:"Thumbnails",events_media_type:"Whether to show event thumbnails of clips or snapshots",events_media_types:{clips:"Clip thumbnails",snapshots:"Snapshot thumbnails"},media_type:"Whether to show thumnails of events or recordings",media_types:{events:"Events",recordings:"Recordings"},mode:"Thumbnails mode",modes:{above:"Thumbnails above",below:"Thumbnails below",left:"Thumbnails in a drawer to the left",none:"No thumbnails",right:"Thumbnails in a drawer to the right"},show_details:"Show details with thumbnails",show_download_control:"Show download control on thumbnails",show_favorite_control:"Show favorite control on thumbnails",show_timeline_control:"Show timeline control on thumbnails",size:"Thumbnails size in pixels"},timeline:{editor_label:"Mini Timeline",mode:"Mode",modes:{above:"Above",below:"Below",none:"None"},pan_mode:"Default pan mode",pan_modes:{pan:"Pan",seek:"Pan seeks across all media","seek-in-camera":"Pan seeks within selected camera only","seek-in-media":"Pan seeks within selected media item only"}}},display:{editor_label:"Display",grid_columns:"Exact number of grid columns",grid_max_columns:"Maximum number of grid columns",grid_selected_width_factor:"Increase selected media width by this factor",mode:"Mode"},image:{entity:"Entity for use with entity mode",entity_parameters:"Query parameters added to the entity-based picture URLs (e.g. width=1920&height=1080)",mode:"Image mode",modes:{camera:"Home Assistant camera snapshot of camera entity",entity:"Entity with entity_picture attribute",screensaver:"Embedded Frigate logo",url:"Arbitrary image specified by URL"},refresh_seconds:"Number of seconds after which to refresh (0=never)",url:"Static image URL"},media_action_conditions:{all:"All opportunities",hidden:"On browser/tab hiding",microphone_mute:"On microphone mute",microphone_unmute:"On microphone unmute",never:"Never",selected:"On selection",unselected:"On unselection",visible:"On browser/tab visibility"},timeline:{clustering_threshold:"The count of events at which they are clustered (0=no clustering)",events_media_type:"The events media the timeline displays",events_media_types:{all:"All event media types",clips:"Clips",snapshots:"Snapshots"},show_recordings:"Show recordings",style:"Timeline style",styles:{ribbon:"Events on a single ribbon",stack:"Stacked & clustered events"},window_seconds:"The default length of the timeline view in seconds"}},dimensions:{aspect_ratio:"Default aspect ratio (e.g. '16:9')",aspect_ratio_mode:"Aspect ratio mode",aspect_ratio_modes:{dynamic:"Aspect ratio adjusts to media",static:"Static aspect ratio",unconstrained:"Unconstrained aspect ratio"},height:"Card height in CSS units (e.g. '500px')"},live:{auto_mute:"Automatically mute live cameras",auto_pause:"Automatically pause live cameras",auto_play:"Automatically play live cameras",auto_unmute:"Automatically unmute live cameras",controls:{editor_label:"Live Controls",ptz:{editor_label:"PTZ",hide_home:"Hide home control",hide_pan_tilt:"Hide pan & tilt control",hide_zoom:"Hide zoom control",mode:"Mode",modes:{off:"Off",on:"On"},orientation:"Orientation",orientations:{horizontal:"Horizontal",vertical:"Vertical"},position:"Position",positions:{"bottom-left":"Bottom left","bottom-right":"Bottom right","top-left":"Top left","top-right":"Top right"}}},draggable:"Live cameras view can be dragged/swiped",lazy_load:"Live cameras are lazily loaded",lazy_unload:"Live cameras are lazily unloaded",microphone:{always_connected:"Always keep the microphone connected",disconnect_seconds:"Seconds after which to disconnect microphone (0=never)",editor_label:"Microphone",enabled:"Microphone enabled",mute_after_microphone_mute_seconds:"Seconds after microphone mute to mute inbound audio"},preload:"Preload live view in the background",show_image_during_load:"Show still image while the live stream is loading",transition_effect:"Live camera transition effect",zoomable:"Live cameras can be zoomed/panned"},media_viewer:{auto_mute:"Automatically mute media",auto_pause:"Automatically pause media",auto_play:"Automatically play media",auto_unmute:"Automatically unmute media",controls:{editor_label:"Media Viewer Controls"},draggable:"Media Viewer can be dragged/swiped",lazy_load:"Media Viewer media is lazily loaded in carousel",snapshot_click_plays_clip:"Clicking on a snapshot plays a related clip",transition_effect:"Media Viewer transition effect",transition_effects:{none:"No transition",slide:"Slide transition"},zoomable:"Media Viewer can be zoomed/panned"},menu:{alignment:"Menu alignment",alignments:{bottom:"Aligned to the bottom",left:"Aligned to the left",right:"Aligned to the right",top:"Aligned to the top"},button_size:"Menu button size in pixels",buttons:{alignment:"Button alignment",alignments:{matching:"Matching the menu alignment",opposing:"Opposing the menu alignment"},camera_ui:"Camera user interface",cameras:"Cameras",clips:"Clips",display_mode:"Display mode",download:"Download",enabled:"Button enabled",expand:"Expand",frigate:"Frigate menu / Default view",fullscreen:"Fullscreen",icon:"Icon",image:"Image",live:"Live",media_player:"Send to media player",microphone:"Microphone",mute:"Mute / Unmute",permanent:"Show when the menu is hidden",play:"Play / Pause",priority:"Priority",ptz_controls:"Show PTZ controls",ptz_home:"PTZ Home",recordings:"Recordings",screenshot:"Screenshot",snapshots:"Snapshots",substreams:"Substream(s)",timeline:"Timeline",type:"Button type",types:{momentary:"Momentary",toggle:"Toggle"}},position:"Menu position",positions:{bottom:"Positioned on the bottom",left:"Positioned on the left",right:"Positioned on the right",top:"Positioned on the top"},style:"Menu style",styles:{hidden:"Hidden menu",hover:"Hover menu","hover-card":"Hover menu (card-wide)",none:"No menu",outside:"Outside menu",overlay:"Overlay menu"}},overrides:{info:"This card configuration has manually specified overrides configured which may override values shown in the visual editor, please consult the code editor to view/modify these overrides"},performance:{features:{animated_progress_indicator:"Animated Progress Indicator",editor_label:"Feature Options",max_simultaneous_engine_requests:"Max simultaneous camera engine requests",media_chunk_size:"Media chunk size"},style:{border_radius:"Curves",box_shadow:"Shadows",editor_label:"Style Options"},warning:"This card is in low profile mode so defaults have changed to optimize performance"},profiles:{casting:"Casting",editor_label:"Configuration profiles","low-performance":"Low performance",scrubbing:"Video scrubbing"},status_bar:{height:"Status bar height in pixels",items:{enabled:"Item enabled",engine:"Camera engine",live_provider:"Live provider",priority:"Item priority",resolution:"Resolution",technology:"Technology",title:"Title"},popup_seconds:"Status bar popup seconds",position:"Status bar position",positions:{bottom:"Positioned on the bottom",top:"Positioned on the top"},style:"Status bar style",styles:{hover:"Hover status bar","hover-card":"Hover status bar (card-wide)",none:"No status bar",outside:"Outside status bar",overlay:"Overlay status bar",popup:"Popup status bar"}},view:{camera_select:"View for newly selected cameras",dark_mode:"Dark mode",dark_modes:{auto:"Auto",off:"Off",on:"On"},default:"Default view",default_cycle_camera:"Cycle through cameras when default view updates",default_reset:{after_interaction:"Reset to the default view after user interaction ends",editor_label:"Default view reset behavior",entities:"Reset to the default view on entity state change",every_seconds:"Reset to default view every X seconds (0=never)",interaction_mode:"How default reset behaves when the card has human interaction",interaction_modes:{active:"Only allow reset when card has active human interaction",all:"Reset regardless of human interaction",inactive:"Only reset when card has no human interaction"}},interaction_seconds:"Seconds after user action to remain interacted with (0=never)",keyboard_shortcuts:{editor_label:"Keyboard shortcuts",enabled:"Keyboard shortcuts enabled",ptz_down:"PTZ Down",ptz_home:"PTZ Home",ptz_left:"PTZ Left",ptz_right:"PTZ Right",ptz_up:"PTZ Up",ptz_zoom_in:"PTZ Zoom In",ptz_zoom_out:"PTZ Zoom Out"},triggers:{actions:{editor_label:"Trigger actions",interaction_mode:"How to handle actions when the card has human interaction",interaction_modes:{active:"Only trigger actions when card has human interaction",all:"Trigger actions regardless of human interaction",inactive:"Only trigger actions when card has no human interaction"},trigger:"Trigger action",triggers:{default:"Change to or update default view",live:"Change to or update live view",media:"Change to the relevant media view for new media",none:"No action"},untrigger:"Untrigger action",untriggers:{default:"Change to default view/camera",none:"No action"}},editor_label:"Trigger behavior",filter_selected_camera:"Only trigger on selected camera",show_trigger_status:"Show pulsing border when triggered",untrigger_seconds:"Seconds after inactive state change to untrigger"},views:{clip:"Most recent clip",clips:"Clips gallery",current:"Current view",image:"Static image",live:"Live view",recording:"Most recent recording",recordings:"Recordings gallery",snapshot:"Most recent snapshot",snapshots:"Snapshots gallery",timeline:"Timeline view"}}},x_={grid:"Show media viewer for each camera in a grid",single:"Show single media viewer"},C_={add_new_camera:"Add new camera",button:"Button",camera:"Camera",cameras:"Cameras",cameras_secondary:"What cameras to render on this card",delete:"Delete",dimensions:"Card dimensions",dimensions_secondary:"Card dimensions & shape options",image:"Image",image_secondary:"Static image view options",live:"Live",live_secondary:"Live camera view options",media_gallery:"Media gallery",media_gallery_secondary:"Media gallery options",media_viewer:"Media viewer",media_viewer_secondary:"Viewer for static media (clips, snapshots or recordings)",menu:"Menu",menu_secondary:"Menu look & feel options",move_down:"Move down",move_up:"Move up",overrides:"Overrides are active",overrides_secondary:"Dynamic configuration overrides detected",performance:"Performance",performance_secondary:"Card performance options",profiles:"Configuration profiles",profiles_secondary:"Choose pre-configured sets of defaults",status_bar:"Status bar",status_bar_secondary:"Status bar look & feel options",timeline:"Timeline",timeline_secondary:"Event timeline options",upgrade:"Upgrade",upgrade_available:"An automatic card configuration upgrade is available",view:"View",view_secondary:"What the card should show and how to show it"},M_={ptz:{down:"Down",home:"Home",left:"Left",right:"Right",up:"Up",zoom_in:"Zoom In",zoom_out:"Zoom Out"}},k_={awaiting_live:"Waiting for live stream to load ...",awaiting_media:"Waiting for media to load",camera_initialization:"Camera initialization failed",camera_initialization_reolink:"Could not initialize Reolink camera",could_not_render_elements:"Could not render picture elements",could_not_resolve:"Could not resolve media URL",diagnostics:"Card diagnostics. Please review for confidential information prior to sharing",download_no_media:"No media to download",download_sign_failed:"Could not sign media URL for download",duplicate_camera_id:"Duplicate Frigate camera id for the following camera, use the 'id' parameter to uniquely identify cameras",empty_response:"Received empty response from Home Assistant for request",failed_response:"Failed to receive response from Home Assistant for request",failed_retain:"Could not retain event",failed_sign:"Could not sign Home Assistant URL",image_load_error:"The image could not be loaded",invalid_configuration:"Invalid configuration",invalid_configuration_no_hint:"No location hint available (bad or missing type?)",invalid_configuration_override:"Invalid override configuration",invalid_elements_config:"Invalid picture elements configuration",invalid_response:"Received invalid response from Home Assistant for request",jsmpeg_no_player:"Could not start JSMPEG player",live_camera_no_endpoint:"Could not get camera endpoint for this live provider (incomplete configuration?)",live_camera_not_found:"The configured camera_entity was not found",live_camera_unavailable:"Camera unavailable",no_camera_engine:"Could not determine suitable engine for camera",no_camera_entity:"Could not find camera entity",no_camera_entity_for_triggers:"A camera entity is required in order to autodetect triggers",no_camera_id:"Could not determine camera id for the following camera, may need to set 'id' parameter manually",no_camera_name:"Could not determine a Frigate camera name for camera (or one of its dependents), please specify either 'camera_entity' or 'camera_name'",no_dashboard_or_view:"Both 'dashboard_path' and 'view_path' parameters are required for the 'dashboard' cast method",no_live_camera:"The camera_entity parameter must be set and valid for this live provider",no_supported_camera:"The selected camera does not support this view",no_supported_cameras:"No cameras support this view",reconnecting:"Reconnecting",too_many_automations:"Too many nested automation calls, please check your configuration for loops",troubleshooting:"Check troubleshooting",unknown:"Unknown error",upgrade_available:"An automated card configuration upgrade is available, please visit the visual card editor",webrtc_card_reported_error:"WebRTC Card reported an error",webrtc_card_waiting:"Waiting for WebRTC Card to load ..."},S_={camera:"Camera",duration:"Duration",in_progress:"In Progress",score:"Score",seek:"Seek",start:"Start",tag:"Tag",what:"What",where:"Where"},E_={assign:"Assign",assigning:"Assigning",modifiers:{alt:"Alt",ctrl:"Ctrl",meta:"Meta",shift:"Shift"},unassign:"Unassign"},$_={all:"All",camera:"Camera",favorite:"Favorite",media_type:"Media Type",media_types:{clips:"Clips",recordings:"Recordings",snapshots:"Snapshots"},not_favorite:"Not Favorite",select_camera:"Select camera...",select_favorite:"Select favorite...",select_media_type:"Select media type...",select_tag:"Select tag...",select_what:"Select what...",select_when:"Select when...",select_where:"Select where...",tag:"Tag",what:"What",when:"When",whens:{custom:"Custom",past_month:"Past Month",past_week:"Past Week",today:"Today",yesterday:"Yesterday"},where:"Where"},A_={unseekable:"Seek time not found in media"},I_={camera:"Camera",duration:"Duration",events:"Events",in_progress:"In Progress",seek:"Seek",start:"Start"},z_={download:"Download media",no_thumbnail:"No thumbnail available",retain_indefinitely:"Media will be indefinitely retained",timeline:"See media in timeline"},T_={select_date:"Choose date"},j_={common:b_,config:w_,display_modes:x_,editor:C_,elements:M_,error:k_,event:S_,key_assigner:E_,media_filter:$_,media_viewer:A_,recording:I_,thumbnail:z_,timeline:T_},O_=Object.freeze({__proto__:null,common:b_,config:w_,default:j_,display_modes:x_,editor:C_,elements:M_,error:k_,event:S_,key_assigner:E_,media_filter:$_,media_viewer:A_,recording:I_,thumbnail:z_,timeline:T_});const D_="en",R_={[D_]:O_};let P_;function L_(e){const t=e=>e.replace("-","_"),n=e?.language??e?.selectedLanguage;if(n)return t(n);const a=localStorage.getItem("selectedLanguage");if(a){const e=JSON.parse(a);if(e)return t(e)}for(const e of navigator.languages){const n=t(e);if(n&&n in R_)return n}return D_}function N_(e,t="",n=""){let a="";try{a=e.split(".").reduce(((e,t)=>e[t]),R_[P_??D_])}catch(e){}return a||(a=e.split(".").reduce(((e,t)=>e[t]),R_[D_])),""!==t&&""!==n&&(a=a.replace(t,n)),a}function F_(e){return"string"==typeof e?.id&&e.id||"string"==typeof e?.camera_entity&&e.camera_entity||"object"==typeof e?.webrtc_card&&e.webrtc_card&&("string"==typeof e.webrtc_card.entity&&e.webrtc_card.entity||"string"==typeof e.webrtc_card.url&&e.webrtc_card.url)||"object"==typeof e?.go2rtc&&e.go2rtc&&"string"==typeof e.go2rtc.url&&"string"==typeof e.go2rtc.stream&&`${e.go2rtc.url}#${e.go2rtc.stream}`||"object"==typeof e?.frigate&&e.frigate&&"string"==typeof e?.frigate.camera_name&&e.frigate.camera_name||""}const V_=(e,...t)=>{e?.debug?.logging&&console.debug(...t)},H_=(e,t,n)=>"preset"===t?(n?.preset?e.ptz.presets?.[n.preset]:null)??null:n?.phase?e.ptz[`actions_${t}_${n.phase}`]??null:e.ptz[`actions_${t}`]??null,B_=(e,t,n)=>!!H_(e,t,n),q_=(e,t)=>{const n=B_(e,t,{phase:"start"})&&B_(e,t,{phase:"stop"}),a=B_(e,t);return n||a?[...n?["continuous"]:[],...a?["relative"]:[]]:null},U_=e=>{const t=q_(e,"left"),n=q_(e,"right"),a=q_(e,"up"),i=q_(e,"down"),r=q_(e,"zoom_in"),o=q_(e,"zoom_out"),s=e.ptz.presets?Object.keys(e.ptz.presets):void 0;return t?.length||n?.length||a?.length||i?.length||r?.length||o?.length||s?.length?{...t?{left:t}:{},...n?{right:n}:{},...a?{up:a}:{},...i?{down:i}:{},...r?{zoomIn:r}:{},...o?{zoomOut:o}:{},...s?{presets:s}:{}}:null};class W_{constructor(e,t){this._capabilities=e;for(const e of t?.disable??[])this._disable(e);for(const e of Is)t?.disableExcept?.length&&!t.disableExcept.includes(e)&&this._disable(e)}_disable(e){delete this._capabilities[e]}matches(e){let t=!0;return"string"==typeof e&&(t&&=this.has(e)),"object"==typeof e&&e.allCapabilities&&(t&&=e.allCapabilities.every((e=>this.has(e)))),"object"==typeof e&&e.anyCapabilities&&(t&&=e.anyCapabilities.some((e=>this.has(e)))),t}has(e){return!!this._capabilities[e]}getPTZCapabilities(){return this._capabilities.ptz??null}hasPTZCapability(){return!!(this._capabilities.ptz?.down?.length||this._capabilities.ptz?.up?.length||this._capabilities.ptz?.left?.length||this._capabilities.ptz?.right?.length||this._capabilities.ptz?.zoomIn?.length||this._capabilities.ptz?.zoomOut?.length||this._capabilities.ptz?.presets?.length)}getRawCapabilities(){return this._capabilities}}function Z_(e,t,n){var a=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var r=Array(i);++at||r&&o&&c&&!s&&!l||a&&o&&c||!n&&c||!i)return 1;if(!a&&!r&&!l&&e=s?c:c*("desc"==n[a]?-1:1)}return e.index-t.index}(e,t,n)}))}function ky(e,t,n,a){return null==e?[]:(cp(t)||(t=null==t?[]:[t]),cp(n=a?void 0:n)||(n=null==n?[]:[n]),My(e,t,n))}async function Sy(e,t,n,a=!1){let i;try{i=await e.callWS(n)}catch(e){if(!(e instanceof Error))throw new $s(N_("error.failed_response"),{request:n,response:e});throw e}if(!i)throw new $s(N_("error.empty_response"),{request:n});const r=a?t.safeParse(JSON.parse(i)):t.safeParse(i);if(!r.success)throw new $s(N_("error.invalid_response"),{request:n,response:i,invalid_keys:Os(r.error)});return r.data}const Ey=ba.lazy((()=>ba.object({title:ba.string(),media_class:ba.string(),media_content_type:ba.string(),media_content_id:ba.string(),can_play:ba.boolean(),can_expand:ba.boolean(),children_media_class:ba.string().nullable().optional(),thumbnail:ba.string().nullable(),children:ba.array(Ey).nullable().optional()}))),$y="video",Ay="image",Iy=60,zy=e=>ky(e,(e=>e._metadata?.startDate),"desc");class Ty{async walkBrowseMedias(e,t,n){return t&&t.length?(await Jg(t,(async t=>await this._walkBrowseMedia(e,t,n)))).flat():[]}async _walkBrowseMedia(e,t,n){let a=[];for(const i of function(e,t,n){t=(n?cg(e,t,n):void 0===t)?1:G_(Mg(t),0);var a=null==e?0:e.length;if(!a||t<1)return[];for(var i=0,r=0,o=Array(Q_(a/t));iawait this._browseMedia(e,a,{cache:n?.cache,metadataGenerator:t.metadataGenerator})));for(const e of r)for(const n of e.children??[])t.matcher(n)&&a.push(n);if(t.sorter&&(a=t.sorter(a)),t.earlyExit&&t.earlyExit(a))break}const i=t.advance?t.advance(a):null;return i?.length?await this.walkBrowseMedias(e,i,n):a}async _browseMedia(e,t,n){const a="object"==typeof t?t.media_content_id:t,i=n?.cache?n.cache.get(a):null;if(i)return i;const r={type:"media_source/browse_media",media_content_id:a},o=await Sy(e,Ey,r);if(n?.metadataGenerator)for(const e of o.children??[])e._metadata=n.metadataGenerator(e,"object"==typeof t?t:void 0)??void 0;return n?.cache&&n.cache.set(a,o,Bd(new Date,{seconds:60})),o}}function jy(e,t){return ym(e,t)}function Oy(e,t){return e&&e.length?function(e,t){for(var n=-1,a=e.length,i=0,r=[];++nPy(t,e)))}add(e){this._ranges.push(e),this._ranges=Ny(this._ranges)}clear(){this._ranges=[]}}class Ry{constructor(e){this._ranges=e??[]}hasCoverage(e){const t=new Date;return this._ranges.some((n=>tet.start>=e.start&&t.end<=e.end,Ly=(e,t)=>e.start>=t.start&&e.start<=t.end||e.end>=t.start&&e.end<=t.end||e.start<=t.start&&e.end>=t.end,Ny=(e,t=0)=>{const n=[];e=ky(e,(e=>e.start),"asc");let a=null;for(const i of e){const e=i.start instanceof Date?i.start.getTime():i.start;if(!a){a={...i};continue}(a.end instanceof Date?a.end.getTime():a.end)+1e3*t>=e?i.end>a.end&&(a.end=i.end):(n.push(a),a={...i})}return a&&n.push(a),n};class Fy{constructor(){this._data=[]}get(e){const t=new Date;for(const n of this._data)if((!n.expires||t<=n.expires)&&this._contains(e,n.request))return n.response;return null}clear(){this._data=[]}has(e){return!!this.get(e)}set(e,t,n){this._data.push({request:e,response:t,expires:n}),this._expireOldRequests()}_contains(e,t){return jy(e,t)}_expireOldRequests(){const e=new Date;this._data=this._data.filter((t=>!t.expires||e=e.start.getTime()){if(a>e.end.getTime())break;t.push(n)}}return t}getSize(){return this._data.length}expireMatches(e){this._data=this._data.filter((t=>!e(t)))}}class By{constructor(){this._segments=new Map}add(e,t,n){let a=this._segments.get(e);a||(a=new Hy((e=>1e3*e.start_time),(e=>e.id)),this._segments.set(e,a)),a.add(t,n)}clear(){this._segments.clear()}hasCoverage(e,t){return!!this._segments.get(e)?.hasCoverage(t)}get(e,t){return this._segments.get(e)?.get(t)??null}getSize(e){return this._segments.get(e)?.getSize()??null}getCameraIDs(){return[...this._segments.keys()]}expireMatches(e,t){this._segments.get(e)?.expireMatches(t)}}class qy extends $s{}class Uy extends $s{}var Wy,Zy,Qy;!function(e){e.Event="event-query",e.Recording="recording-query",e.RecordingSegments="recording-segments-query",e.MediaMetadata="media-metadata"}(Wy||(Wy={})),function(e){e.Event="event-results",e.Recording="recording-results",e.RecordingSegments="recording-segments-results",e.MediaMetadata="media-metadata-results"}(Zy||(Zy={})),function(e){e.Frigate="frigate",e.Generic="generic",e.MotionEye="motioneye",e.Reolink="reolink"}(Qy||(Qy={}));const Gy=e=>e.camera_entity??e.webrtc_card?.entity??null;class Yy{constructor(e){this._entityRegistryManager=e}async createEngine(e,t){let n;switch(e){case Qy.Generic:const{GenericCameraManagerEngine:e}=await import("./engine-generic-39deaa91.js").then((function(e){return e.e}));n=new e(t.stateWatcher,t.eventCallback);break;case Qy.Frigate:const{FrigateCameraManagerEngine:a}=await import("./engine-frigate-69a32a9e.js");n=new a(this._entityRegistryManager,t.stateWatcher,new By,new Vy,t.eventCallback);break;case Qy.MotionEye:const{MotionEyeCameraManagerEngine:i}=await import("./engine-motioneye-205f9ce6.js");n=new i(this._entityRegistryManager,t.stateWatcher,new Ty,t.resolvedMediaCache,new Vy,t.eventCallback);break;case Qy.Reolink:const{ReolinkCameraManagerEngine:r}=await import("./engine-reolink-0f6e3569.js");n=new r(this._entityRegistryManager,t.stateWatcher,new Ty,t.resolvedMediaCache,new Vy,t.eventCallback)}return n}async getEngineForCamera(e,t){let n=null;if("frigate"===t.engine)n=Qy.Frigate;else if("motioneye"===t.engine)n=Qy.MotionEye;else if("generic"===t.engine)n=Qy.Generic;else if("reolink"===t.engine)n=Qy.Reolink;else{const a=Gy(t);if(a){const i=await this._entityRegistryManager.getEntity(e,a);if(!i){if(e.states[a])return Qy.Generic;throw new qy(N_("error.no_camera_entity"),t)}switch(i?.platform){case"frigate":n=Qy.Frigate;break;case"motioneye":n=Qy.MotionEye;break;case"reolink":n=Qy.Reolink;break;default:n=Qy.Generic}}else t.frigate.camera_name?n=Qy.Frigate:(t.webrtc_card?.url||t.go2rtc?.url&&t.go2rtc?.stream)&&(n=Qy.Generic)}return n}}class Ky{constructor(){this._cameras=new Map,this._enginesByType=new Map}addCamera(e){this._cameras.set(e.getID(),e),this._enginesByType.set(e.getEngine().getEngineType(),e.getEngine())}async setCameras(e){for(const t of e){const e=this._cameras.get(t.getID());e!==t&&(this.addCamera(t),await(e?.destroy()))}for(const t of this._cameras.values())e.includes(t)||(await t.destroy(),this._cameras.delete(t.getID()))}async reset(){await Jg(this._cameras.values(),(e=>e.destroy())),this._cameras.clear(),this._enginesByType.clear()}getCamera(e){return this._cameras.get(e)??null}getCameras(){return this._cameras}getCameraConfig(e){return this._cameras.get(e)?.getConfig()??null}hasCameraID(e){return this._cameras.has(e)}getCameraCount(){return this._cameras.size}getDefaultCameraID(){return this._cameras.keys().next().value??null}*getCameraConfigs(e){for(const[t,n]of this.getCameraConfigEntries(e))yield n}*getCameraConfigEntries(e){for(const t of e??this._cameras.keys()){const e=this.getCameraConfig(t);e&&(yield[t,e])}}getCameraIDs(){return new Set(this._cameras.keys())}getCameraIDsWithCapability(e){const t=new Set;for(const n of this._cameras.values())n.getCapabilities()?.matches(e)&&t.add(n.getID());return t}getCameraConfigForMedia(e){return this.getCameraConfig(e.getCameraID())}getEngineOfType(e){return this._enginesByType.get(e)??null}getEngineForCameraID(e){return this._cameras.get(e)?.getEngine()??null}getEnginesForCameraIDs(e){const t=new Map;for(const n of e){const e=this.getEngineForCameraID(n);e&&(t.has(e)||t.set(e,new Set),t.get(e)?.add(n))}return t.size?t:null}getEngineForMedia(e){return this.getEngineForCameraID(e.getCameraID())}getAllDependentCameras(e,t){const n=new Set,a=new Set,i=e=>{n.add(e);const r=this.getCamera(e),o=r?.getConfig();if(r&&o){t&&!r.getCapabilities()?.matches(t)||a.add(e);const s=new Set;o.dependencies.cameras.forEach((e=>s.add(e))),o.dependencies.all_cameras&&this.getCameraIDs().forEach((e=>s.add(e)));for(const e of s)n.has(e)||i(e)}};return i(e),a}}const Xy=e=>{return ky((n=e=>e.getID()??e,(t=e)&&t.length?Fg(t,by(n)):[]),(e=>e.getStartTime()??e.getID()),"asc");var t,n};class Jy{static isEventQuery(e){return e.type===Wy.Event}static isRecordingQuery(e){return e.type===Wy.Recording}static isRecordingSegmentsQuery(e){return e.type===Wy.RecordingSegments}static isMediaMetadataQuery(e){return e.type===Wy.MediaMetadata}}class ev{static isEventQueryResult(e){return e.type===Zy.Event}static isRecordingQueryResult(e){return e.type===Zy.Recording}static isRecordingSegmentsQueryResult(e){return e.type===Zy.RecordingSegments}static isMediaMetadataQueryResult(e){return e.type===Zy.MediaMetadata}}class tv{constructor(e,t){this._requestLimit=new v_,this._api=e,this._engineFactory=t?.factory??new Yy(this._api.getEntityRegistryManager()),this._store=t?.store??new Ky}async initializeCamerasFromConfig(){const e=this._api.getConfigManager().getConfig(),t=this._api.getHASSManager().getHASS();if(!e||!t)return!1;this._requestLimit.concurrency=e.performance.features.max_simultaneous_engine_requests??1/0;const n=e.cameras.map((t=>{return n={},a=l_(e?.cameras_global),dg(n,a,t,((e,t)=>Array.isArray(t)?t:void 0));var n,a}));try{await this._initializeCameras(n)}catch(e){return this._api.getMessageManager().setErrorIfHigherPriority(e,N_("error.camera_initialization")),!1}return!0}async reset(){await this._store.reset()}async _getEnginesForCameras(e){const t=new Map,n=new Map,a=this._api.getHASSManager().getHASS(); +/* istanbul ignore if: the if path cannot be reached -- @preserve */ +if(!a)return t;const i=await(async e=>await Jg(e,(e=>this._engineFactory.getEngineForCamera(a,e))))(e);for(const[a,r]of e.entries()){const e=i[a],o=e?n.get(e)??await this._engineFactory.createEngine(e,{eventCallback:e=>this._api.getTriggersManager().handleCameraEvent(e),stateWatcher:this._api.getHASSManager().getStateWatcher(),resolvedMediaCache:this._api.getResolvedMediaCache()}):null;if(!o||!e)throw new qy(N_("error.no_camera_engine"),l_(r));n.set(e,o),t.set(r,o)}return t}async _initializeCameras(e){const t=new Date,n=this._api.getHASSManager().getHASS(); +/* istanbul ignore if: the if path cannot be reached -- @preserve */ +if(!n)return;e.some((e=>(e=>e.triggers.motion||e.triggers.occupancy)(e)))&&await this._api.getEntityRegistryManager().fetchEntityList(n);const a=await this._getEnginesForCameras(e),i=await Jg(a.entries(),(async([e,t])=>await t.createCamera(n,e))),r=async()=>{i.forEach((e=>e.destroy()))},o=new Set;for(const e of i){const t=F_(e.getConfig());if(!t)throw await r(),new qy(N_("error.no_camera_id"),e.getConfig());if(o.has(t))throw await r(),new qy(N_("error.duplicate_camera_id"),e.getConfig());e.setID(t),o.add(t)}await this._store.setCameras(i),V_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card CameraManager initialized (Cameras: ",this._store.getCameras(),`, Duration: ${((new Date).getTime()-t.getTime())/1e3}s,`,")")}isInitialized(){return this._store.getCameraCount()>0}getStore(){return this._store}generateDefaultEventQueries(e,t){return this._generateDefaultQueries(e,{type:Wy.Event,...t})}generateDefaultRecordingQueries(e,t){return this._generateDefaultQueries(e,{type:Wy.Recording,...t})}generateDefaultRecordingSegmentsQueries(e,t){return this._generateDefaultQueries(e,{type:Wy.RecordingSegments,...t})}_generateDefaultQueries(e,t){const n=[],a=Ug(e),i=this._store.getEnginesForCameraIDs(a);if(!i)return null;for(const[e,a]of i){let i=null; +/* istanbul ignore else: the else path cannot be reached -- @preserve */Jy.isEventQuery(t)?i=e.generateDefaultEventQuery(this._store,a,t):Jy.isRecordingQuery(t)?i=e.generateDefaultRecordingQuery(this._store,a,t):Jy.isRecordingSegmentsQuery(t)&&(i=e.generateDefaultRecordingSegmentsQuery(this._store,a,t));for(const e of i??[])n.push(e)}return n.length?n:null}async getMediaMetadata(){const e=new Set,t=new Set,n=new Set,a=new Set,i={type:Wy.MediaMetadata,cameraIDs:this._store.getCameraIDs()},r=await this._handleQuery(i);for(const i of r.values())i.metadata.tags&&i.metadata.tags.forEach(e.add,e),i.metadata.what&&i.metadata.what.forEach(t.add,t),i.metadata.where&&i.metadata.where.forEach(n.add,n),i.metadata.days&&i.metadata.days.forEach(a.add,a);return t.size||n.size||a.size||e.size?{...e.size&&{tags:e},...t.size&&{what:t},...n.size&&{where:n},...a.size&&{days:a}}:null}async getEvents(e,t){return await this._handleQuery(e,t)}async getRecordings(e,t){return await this._handleQuery(e,t)}async getRecordingSegments(e,t){return await this._handleQuery(e,t)}async executeMediaQueries(e,t){return this._convertQueryResultsToMedia(await this._handleQuery(e,t))}async extendMediaQueries(e,t,n,a){if(!this._api.getHASSManager().getHASS())return null;const i=e=>{let n=null;for(const a of t){const t=a.getStartTime();t&&(!n||"earliest"===e&&tn)&&(n=t)}return n},r=this._api.getConfigManager().getCardWideConfig()?.performance?.features.media_chunk_size??50,o=[],s=[];for(const t of e){const e={...t}; +/* istanbul ignore else: the else path cannot be reached -- @preserve */if("later"===n){const t=i("latest");t&&(e.start=t,delete e.end)}else if("earlier"===n){const t=i("earliest");t&&(e.end=t,delete e.start)}e.limit=r,s.push({...t,limit:(t.limit??0)+r}),o.push(e)}const c=this._convertQueryResultsToMedia(await this._handleQuery(o,a));if(!c.length)return null;const l=Xy(t.concat(c));return l.length===t.length?null:{queries:s,results:l}}async getMediaDownloadPath(e){const t=this._store.getCameraConfigForMedia(e),n=this._store.getEngineForMedia(e),a=this._api.getHASSManager().getHASS();return t&&n&&a?await n.getMediaDownloadPath(a,t,e):null}getMediaCapabilities(e){const t=this._store.getEngineForMedia(e);return t?t.getMediaCapabilities(e):null}async favoriteMedia(e,t){const n=this._store.getCameraConfigForMedia(e),a=this._store.getEngineForMedia(e),i=this._api.getHASSManager().getHASS();if(!n||!a||!i)return;const r=new Date;await this._requestLimit.add((()=>a.favoriteMedia(i,n,e,t))),V_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card CameraManager favorite request (",`Duration: ${((new Date).getTime()-r.getTime())/1e3}s,`,"Media:",e.getID(),", Favorite:",t,")")}areMediaQueriesResultsFresh(e,t){const n=new Date;for(const a of e){const e=this._store.getEnginesForCameraIDs(a.cameraIDs);for(const[i,r]of e??[]){const e=i.getQueryResultMaxAge({...a,cameraIDs:r});if(null!==e&&Bd(t,{seconds:e})a?null:await this._requestLimit.add((()=>i.getMediaSeekTime(r,this._store,e,t)))??null}async _handleQuery(e,t){const n=qg(e),a=new Map,i=new Date,r=this._api.getHASSManager().getHASS();if(!r)return a;const o=async(e,n)=>{let i=null; +/* istanbul ignore else: the else path cannot be reached -- @preserve */Jy.isEventQuery(n)?i=await e.getEvents(r,this._store,n,t):Jy.isRecordingQuery(n)?i=await e.getRecordings(r,this._store,n,t):Jy.isRecordingSegmentsQuery(n)?i=await e.getRecordingSegments(r,this._store,n,t):Jy.isMediaMetadataQuery(n)&&(i=await e.getMediaMetadata(r,this._store,n,t)),i?.forEach(((e,t)=>a.set(t,e)))},s=async e=>{const t=this._store.getEnginesForCameraIDs(e.cameraIDs);t&&await Promise.all(Array.from(t.keys()).map((n=>this._requestLimit.add((()=>o(n,{...e,cameraIDs:t.get(n)}))))))};await Promise.all(n.map((e=>s(e))));const c=(l=Array.from(a.values()).map((e=>Number(e.cached??0))))&&l.length?function(e,t){for(var n,a=-1,i=e.length;++athis._store.getCamera(e))).filter(rf);return new W_({live:t.some((e=>e.getCapabilities()?.has("live"))),clips:t.some((e=>e.getCapabilities()?.has("clips"))),recordings:t.some((e=>e.getCapabilities()?.has("recordings"))),snapshots:t.some((e=>e.getCapabilities()?.has("snapshots"))),"favorite-events":t.some((e=>e.getCapabilities()?.has("favorite-events"))),"favorite-recordings":t.some((e=>e.getCapabilities()?.has("favorite-recordings"))),seek:t.some((e=>e.getCapabilities()?.has("seek"))),menu:t.some((e=>e.getCapabilities()?.has("menu")))})}async executePTZAction(e,t,n){const a=this._store.getCameraConfig(e);if(!a)return;const i=H_(a,t,n);if(i)return await this._api.getActionsManager().executeActions(i);const r=this._api.getHASSManager().getHASS(),o=this._store.getEngineForCameraID(e);return o&&r?await this._requestLimit.add((()=>o.executePTZAction(r,a,t,n))):void 0}}class nv{constructor(e){this._cache=new Map,this._keyCallback=e}has(e){return this._cache.has(e)}getMatches(e){return[...this._cache.values()].filter(e)}get(e){return this._cache.get(e)??null}add(e){const t=e=>this._cache.set(this._keyCallback(e),e);Array.isArray(e)?e.forEach(t):t(e)}}const av=ba.object({id:ba.string(),model:ba.string().nullable(),config_entries:ba.string().array(),manufacturer:ba.string().nullable()}).array();class iv{constructor(e){this._fetchedDeviceList=!1,this._cache=e}async getDevice(e,t){return this._cache.has(t)?this._cache.get(t):(await this._fetchDeviceList(e),this._cache.get(t)??null)}async getMatchingDevices(e,t){return await this._fetchDeviceList(e),this._cache.getMatches(t)}async _fetchDeviceList(e){if(this._fetchedDeviceList)return;let t=null;try{t=await Sy(e,av,{type:"config/device_registry/list"})}catch(e){return void Zg(e)}this._cache.add(t),this._fetchedDeviceList=!0}}const rv=ba.object({config_entry_id:ba.string().nullable(),device_id:ba.string().nullable(),disabled_by:ba.string().nullable(),entity_id:ba.string(),hidden_by:ba.string().nullable(),platform:ba.string(),translation_key:ba.string().nullable(),unique_id:ba.string().or(ba.number()).optional()}),ov=rv.array();class sv{constructor(e){this._fetchedEntityList=!1,this._cache=e}async getEntity(e,t){const n=this._cache.get(t);if(n)return n;let a=null;try{a=await Sy(e,rv,{type:"config/entity_registry/get",entity_id:t})}catch(e){return Zg(e),null}return this._cache.add(a),a}async getMatchingEntities(e,t){return await this.fetchEntityList(e),this._cache.getMatches(t)}async getEntities(e,t){const n=new Map;return await Promise.all(t.map((async t=>{const a=await this.getEntity(e,t);a&&n.set(t,a)}))),n}async fetchEntityList(e){if(this._fetchedEntityList)return;let t=null;try{t=await Sy(e,ov,{type:"config/entity_registry/list"})}catch(e){return void Zg(e)}this._cache.add(t),this._fetchedEntityList=!0}}class cv extends Map{constructor(e={}){if(super(),!(e.maxSize&&e.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");if("number"==typeof e.maxAge&&0===e.maxAge)throw new TypeError("`maxAge` must be a number greater than 0");this.maxSize=e.maxSize,this.maxAge=e.maxAge||Number.POSITIVE_INFINITY,this.onEviction=e.onEviction,this.cache=new Map,this.oldCache=new Map,this._size=0}_emitEvictions(e){if("function"==typeof this.onEviction)for(const[t,n]of e)this.onEviction(t,n.value)}_deleteIfExpired(e,t){return"number"==typeof t.expiry&&t.expiry<=Date.now()&&("function"==typeof this.onEviction&&this.onEviction(e,t.value),this.delete(e))}_getOrDeleteIfExpired(e,t){if(!1===this._deleteIfExpired(e,t))return t.value}_getItemValue(e,t){return t.expiry?this._getOrDeleteIfExpired(e,t):t.value}_peek(e,t){const n=t.get(e);return this._getItemValue(e,n)}_set(e,t){this.cache.set(e,t),this._size++,this._size>=this.maxSize&&(this._size=0,this._emitEvictions(this.oldCache),this.oldCache=this.cache,this.cache=new Map)}_moveToRecent(e,t){this.oldCache.delete(e),this._set(e,t)}*_entriesAscending(){for(const e of this.oldCache){const[t,n]=e;if(!this.cache.has(t)){!1===this._deleteIfExpired(t,n)&&(yield e)}}for(const e of this.cache){const[t,n]=e;!1===this._deleteIfExpired(t,n)&&(yield e)}}get(e){if(this.cache.has(e)){const t=this.cache.get(e);return this._getItemValue(e,t)}if(this.oldCache.has(e)){const t=this.oldCache.get(e);if(!1===this._deleteIfExpired(e,t))return this._moveToRecent(e,t),t.value}}set(e,t,{maxAge:n=this.maxAge}={}){const a="number"==typeof n&&n!==Number.POSITIVE_INFINITY?Date.now()+n:void 0;return this.cache.has(e)?this.cache.set(e,{value:t,expiry:a}):this._set(e,{value:t,expiry:a}),this}has(e){return this.cache.has(e)?!this._deleteIfExpired(e,this.cache.get(e)):!!this.oldCache.has(e)&&!this._deleteIfExpired(e,this.oldCache.get(e))}peek(e){return this.cache.has(e)?this._peek(e,this.cache):this.oldCache.has(e)?this._peek(e,this.oldCache):void 0}delete(e){const t=this.cache.delete(e);return t&&this._size--,this.oldCache.delete(e)||t}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}resize(e){if(!(e&&e>0))throw new TypeError("`maxSize` must be a number greater than 0");const t=[...this._entriesAscending()],n=t.length-e;n<0?(this.cache=new Map(t),this.oldCache=new Map,this._size=t.length):(n>0&&this._emitEvictions(t.slice(0,n)),this.oldCache=new Map(t.slice(n)),this.cache=new Map,this._size=0),this.maxSize=e}*keys(){for(const[e]of this)yield e}*values(){for(const[,e]of this)yield e}*[Symbol.iterator](){for(const e of this.cache){const[t,n]=e;!1===this._deleteIfExpired(t,n)&&(yield[t,n.value])}for(const e of this.oldCache){const[t,n]=e;if(!this.cache.has(t)){!1===this._deleteIfExpired(t,n)&&(yield[t,n.value])}}}*entriesDescending(){let e=[...this.cache];for(let t=e.length-1;t>=0;--t){const n=e[t],[a,i]=n;!1===this._deleteIfExpired(a,i)&&(yield[a,i.value])}e=[...this.oldCache];for(let t=e.length-1;t>=0;--t){const n=e[t],[a,i]=n;if(!this.cache.has(a)){!1===this._deleteIfExpired(a,i)&&(yield[a,i.value])}}}*entriesAscending(){for(const[e,t]of this._entriesAscending())yield[e,t.value]}get size(){if(!this._size)return this.oldCache.size;let e=0;for(const t of this.oldCache.keys())this.cache.has(t)||e++;return Math.min(this._size+e,this.maxSize)}entries(){return this.entriesAscending()}forEach(e,t=this){for(const[n,a]of this.entriesAscending())e.call(t,a,n,this)}get[Symbol.toStringTag](){return JSON.stringify([...this.entriesAscending()])}}class lv{constructor(){this._cache=new cv({maxSize:1e3})}has(e){return this._cache.has(e)}get(e){return this._cache.get(e)}set(e,t){this._cache.set(e,t)}}const dv=async(e,t,n)=>{const a=n?n.get(t):void 0;if(a)return a;const i={type:"media_source/resolve_media",media_content_id:t};let r=null;try{r=await Sy(e,zs,i)}catch(e){Zg(e)}return n&&r&&n.set(t,r),r};class uv{constructor(e,t,n){this._context=e,this._action=t,this._config=n}async execute(e){}async stop(){}}class hv extends uv{}class pv extends hv{async execute(e){const t=this._action.camera??(this._action.triggered?e.getTriggersManager().getMostRecentlyTriggeredCameraID():null),n=e.getViewManager().getView(),a=e.getConfigManager().getConfig();if(t&&n){const i=a?.view.camera_select??"current",r="current"===i?n.view:i;await e.getViewManager().setViewByParametersWithNewQuery({params:{view:r,camera:t},failSafe:!0})}}}class mv extends hv{async execute(e){e.getCameraURLManager().openURL()}}class gv extends hv{async execute(e){await e.getViewManager().setViewDefaultWithNewQuery()}}class fv extends hv{async execute(e){await e.getViewManager().setViewByParametersWithNewQuery({params:{displayMode:this._action.display_mode}})}}class _v extends hv{async execute(e){await e.getDownloadManager().downloadViewerMedia()}}class yv extends hv{async execute(e){e.getExpandManager().toggleExpanded()}}class vv extends hv{async execute(e){e.getFullscreenManager().toggleFullscreen()}}class bv extends uv{async execute(e){const t=e.getHASSManager().getHASS();t&&at(e.getCardElementManager().getElement(),t,this._config??{},this._action)}}class wv extends hv{async execute(e){console[this._action.level](this._action.message)}}const xv=(e,t)=>e.context?.live?.overrides?.get(t??e.camera)??t??e.camera,Cv=e=>xv(e)!==e.camera,Mv=(e,t)=>{const n=e.context?.live?.overrides??new Map;n.set(e.camera,t),e.mergeInContext({live:{overrides:n}})};class kv extends hv{async execute(e){const t=this._action.media_player,n=e.getMediaPlayerManager(),a=e.getViewManager().getView(),i=a?.queryResults?.getSelectedResult()??null;"stop"===this._action.media_player_action?await n.stop(t):a?.is("live")?await n.playLive(t,xv(a)):a?.isViewerView()&&i&&await n.playMedia(t,i)}}class Sv extends hv{async execute(e){e.getCardElementManager().toggleMenu()}}class Ev extends hv{async execute(e){await e.getMicrophoneManager().connect()}}class $v extends hv{async execute(e){e.getMicrophoneManager().disconnect()}}class Av extends hv{async execute(e){e.getMicrophoneManager().mute()}}class Iv extends hv{async execute(e){await e.getMicrophoneManager().unmute()}}class zv extends hv{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.mute())}}class Tv extends hv{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.pause())}}class jv extends hv{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.play())}}const Ov=(e,t)=>{if(e.isViewerView()){const n=e.queryResults?.getSelectedResult()?.getID()??null;return"ptz"!==t?.type&&n?{targetID:n,type:"digital"}:null}if(e.is("live")){const n=xv(e);let a="digital";return"digital"!==t?.type&&t?.cameraManager&&(Dv(t.cameraManager,n)&&(a="ptz"),"ptz"!==a&&"ptz"===t?.type)?null:{targetID:n,type:a}}return null},Dv=(e,t)=>!!e.getStore().getCamera(t)?.getCapabilities()?.hasPTZCapability();var Rv=lg((function(e,t,n){Km(e,t,n)}));const Pv=(e,t)=>{t?.[e]?.inProgressAction?.stop()},Lv=(e,t,n,a)=>{Rv(t,{[n]:{[e]:{inProgressAction:a}}})};class Nv extends hv{constructor(){super(...arguments),this._timer=new bf}async stop(){this._timer.stop()}async execute(e){const t=e.getViewManager().getView();if(!t)return;const n=this._action.camera??Ov(t,{type:"ptz",cameraManager:e.getCameraManager()})?.targetID??null,a=n?e.getCameraManager().getCameraCapabilities(n)?.getPTZCapabilities():null,i=n?e.getCameraManager().getStore().getCameraConfig(n)?.ptz:null;if(!n||!a||!i)return;if(!this._action.ptz_action)return void(a.presets&&a.presets.length>=1&&await e.getCameraManager().executePTZAction(n,"preset",{phase:this._action.ptz_phase,preset:a.presets[0]}));const r=(e=>{switch(e){case"left":case"right":case"up":case"down":return e;case"zoom_in":return"zoomIn";case"zoom_out":return"zoomOut"}return null})(this._action.ptz_action);if(r&&a[r]?.includes(this._action.ptz_phase?"continuous":"relative")||"preset"===this._action.ptz_action)return await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{phase:this._action.ptz_phase,preset:this._action.ptz_preset});if("start"===this._action.ptz_phase){Pv(n,this._context.ptz),Lv(n,this._context,"ptz",this);const t=async()=>{this._action.ptz_action&&await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset}),this._timer.start(i.r2c_delay_between_calls_seconds,t)};await t()}else"stop"===this._action.ptz_phase?Pv(n,this._context.ptz):(await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset,phase:"start"}),this._timer.start(i.c2r_delay_between_calls_seconds,(async()=>{this._action.ptz_action&&await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset,phase:"stop"})})))}}class Fv extends hv{async execute(e){e.getViewManager().setViewWithMergedContext({ptzControls:{enabled:this._action.enabled}})}}function Vv(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=wg(n))==n?n:0),void 0!==t&&(t=(t=wg(t))==t?t:0),function(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}(wg(e),t,n)}const Hv=50,Bv=50,qv=1,Uv=4,Wv=e=>void 0===e?.pan?.x&&void 0===e?.pan?.y&&void 0===e?.zoom;class Zv{constructor(e){this._context=e}modify(e){e.mergeInContext(this._context)}}const Qv=(e,t)=>({zoom:{[e]:{observed:t?.observed??void 0,requested:t?.requested??null}}}),Gv=(e,t,n)=>{t&&n&&t.setViewByParameters({modifiers:[new Zv(Qv(n,{observed:e.detail}))]})};class Yv extends hv{constructor(){super(...arguments),this._timer=new bf}async _stepChange(e,t){e.getViewManager().setViewWithMergedContext(Qv(t,{requested:this._convertActionToZoomSettings(e.getViewManager().getView()?.context?.zoom?.[t]?.observed)}))}async stop(){this._timer.stop()}async execute(e){const t=e.getViewManager().getView();if(!t)return;const n=this._action.target_id??Ov(t,{type:"digital",cameraManager:e.getCameraManager()})?.targetID;return n?this._action.absolute||!this._action.ptz_phase?await this._stepChange(e,n): +/* istanbul ignore else: the else path cannot be reached -- @preserve */ +void("start"===this._action.ptz_phase?(Pv(n,this._context.ptzDigital),Lv(n,this._context,"ptzDigital",this),await this._stepChange(e,n),this._timer.startRepeated(.1,(()=>this._stepChange(e,n)))):"stop"===this._action.ptz_phase&&(Pv(n,this._context.ptzDigital),delete this._context.ptzDigital?.[n])):void 0}_convertActionToZoomSettings(e){if(!this._action.absolute&&!this._action.ptz_action)return{};if(this._action.absolute)return this._action.absolute;const t=e?.zoom??1,n=e?.pan?.x??50,a=e?.pan?.y??50,i="zoom_in"===this._action.ptz_action?.1:"zoom_out"===this._action.ptz_action?-.1:0,r="left"===this._action.ptz_action?-5:"right"===this._action.ptz_action?5:0,o="up"===this._action.ptz_action?-5:"down"===this._action.ptz_action?5:0;return{zoom:Vv(t+i,1,10),pan:{x:Vv(n+r,0,100),y:Vv(a+o,0,100)}}}}class Kv extends hv{async execute(e){const t=e.getViewManager().getView();let n=null,a=null;if(this._action.target_id)n=this._action.target_id,a=Dv(e.getCameraManager(),n)?"ptz":"digital";else if(t){const i=Ov(t,{cameraManager:e.getCameraManager()});n=i?.targetID??null,a=i?.type??null}n&&null!==a&&("ptz"===a?this._toPTZAction(n):this._toPTZDigitalAction(n)).execute(e)}_toPTZAction(e){return new Nv(this._context,(t={cardID:this._action.card_id,cameraID:e,ptzAction:this._action.ptz_action,ptzPhase:this._action.ptz_phase,ptzPreset:this._action.ptz_preset},{action:"fire-dom-event",frigate_card_action:"ptz",...t?.cardID&&{card_id:t.cardID},...t?.ptzAction&&{ptz_action:t.ptzAction},...t?.ptzPhase&&{ptz_phase:t.ptzPhase},...t?.ptzPreset&&{ptz_preset:t.ptzPreset},...t?.cameraID&&{camera:t.cameraID}}),this._config);var t}_toPTZDigitalAction(e){return new Yv(this._context,(t={cardID:this._action.card_id,ptzPhase:this._action.ptz_phase,ptzAction:this._action.ptz_action,targetID:e},{action:"fire-dom-event",frigate_card_action:"ptz_digital",...t?.cardID&&{card_id:t.cardID},...t?.ptzAction&&{ptz_action:t.ptzAction},...t?.ptzPhase&&{ptz_phase:t.ptzPhase},...t?.absolute&&{absolute:t.absolute},...t?.targetID&&{target_id:t.targetID}}),this._config);var t}}class Xv extends hv{async execute(e){await e.getDownloadManager().downloadScreenshot()}}class Jv extends hv{async execute(e){var t;await tf((t=this._action.duration,3600*(t.h??0)+60*(t.m??0)+(t.s??0)+(t.ms??0)/1e3))}}class eb extends hv{async execute(e){switch(this._action.status_bar_action){case"reset":e.getStatusBarItemManager().removeAllDynamicStatusBarItems();break;case"add":this._action.items?.forEach((t=>e.getStatusBarItemManager().addDynamicStatusBarItem(t)));break;case"remove":this._action.items?.forEach((t=>e.getStatusBarItemManager().removeDynamicStatusBarItem(t)))}}}class tb{modify(e){(e=>{const t=e.context?.live?.overrides;t&&t.has(e.camera)&&e.context?.live?.overrides?.delete(e.camera)})(e)}}class nb extends hv{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new tb]})}}class ab{constructor(e){this._api=e}modify(e){const t=[...this._api.getCameraManager().getStore().getAllDependentCameras(e.camera,"substream")];if(t.length<=1)return;const n=xv(e),a=t.indexOf(n),i=a<0?0:(a+1)%t.length;Mv(e,t[i])}}class ib extends hv{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new ab(e)]})}}class rb{constructor(e){this._substreamID=e}modify(e){Mv(e,this._substreamID)}}class ob extends hv{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new rb(this._action.camera)]})}}class sb extends hv{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.unmute())}}class cb extends hv{async execute(e){await e.getViewManager().setViewByParametersWithNewQuery({params:{view:this._action.frigate_card_action}})}}class lb{createAction(e,t,n){const a=hf(t);if("fire-dom-event"!==t.action||!a)return new bv(e,t,n?.config);if(a.card_id&&a.card_id!==n?.cardID)return null;switch(a.frigate_card_action){case"default":return new gv(e,a,n?.config);case"clip":case"clips":case"image":case"live":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":case"diagnostics":return new cb(e,a,n?.config);case"sleep":return new Jv(e,a,n?.config);case"download":return new _v(e,a,n?.config);case"camera_ui":return new mv(e,a,n?.config);case"expand":return new yv(e,a,n?.config);case"fullscreen":return new vv(e,a,n?.config);case"menu_toggle":return new Sv(e,a,n?.config);case"camera_select":return new pv(e,a,n?.config);case"live_substream_select":return new ob(e,a,n?.config);case"live_substream_off":return new nb(e,a,n?.config);case"live_substream_on":return new ib(e,a,n?.config);case"media_player":return new kv(e,a,n?.config);case"microphone_connect":return new Ev(e,a,n?.config);case"microphone_disconnect":return new $v(e,a,n?.config);case"microphone_mute":return new Av(e,a,n?.config);case"microphone_unmute":return new Iv(e,a,n?.config);case"mute":return new zv(e,a,n?.config);case"unmute":return new sb(e,a,n?.config);case"play":return new jv(e,a,n?.config);case"pause":return new Tv(e,a,n?.config);case"screenshot":return new Xv(e,a,n?.config);case"display_mode_select":return new fv(e,a,n?.config);case"ptz":return new Nv(e,a,n?.config);case"ptz_digital":return new Yv(e,a,n?.config);case"ptz_multi":return new Kv(e,a,n?.config);case"ptz_controls":return new Fv(e,a,n?.config);case"log":return new wv(e,a,n?.config);case"status_bar":return new eb(e,a,n?.config)} +/* istanbul ignore next: this path cannot be reached -- @preserve */ +/* istanbul ignore next: this path cannot be reached -- @preserve */ +return console.warn(`Frigate card received unknown card action: ${a.frigate_card_action}`),null}}class db{constructor(e,t,n){this._actions=[],this._factory=new lb,this._stopped=!1,this._context=e;for(const a of qg(t)){const t=this._factory.createAction(e,a,n);t&&this._actions.push(t)}}async execute(e){for(const t of this._actions){if(this._stopped)break;await t.execute(e)}}async stop(){this._stopped=!0}}const ub=ba.object({action:ba.enum(["tap","double_tap","hold","start_tap","end_tap"])}),hb=ba.object({detail:ub});class pb{constructor(e){this._actionsInFlight=[],this._actionContext={},this.handleInteractionEvent=e=>{const t=hb.safeParse(e);if(!t.success)return;const n=t.data.detail.action,a=this.getMergedActions(),i=_f(n,a);a&&n&&i&&this.executeActions(i,a)},this.handleCustomActionEvent=e=>{"detail"in e&&this.executeActions(e.detail)},this.handleActionExecutionRequestEvent=async e=>{await this.executeActions(e.detail.action,e.detail.config)},this._api=e}getMergedActions(){const e=this._api.getViewManager().getView();if(this._api.getMessageManager().hasMessage())return{};const t=this._api.getConfigManager().getConfig();let n;if(e?.is("live"))n=t?.live.actions;else if(e?.isGalleryView())n=t?.media_gallery?.actions;else if(e?.isViewerView())n=t?.media_viewer.actions;else{if(!e?.is("image"))return{};n=t?.image?.actions}return{...t?.view.actions,...n}}uninitialize(){this._actionsInFlight.forEach((e=>e.stop()))}async executeActions(e,t){const n=new db(this._actionContext,e,{config:t,cardID:this._api.getConfigManager().getConfig()?.card_id});this._actionsInFlight.push(n),await n.execute(this._api),this._actionsInFlight=this._actionsInFlight.filter((e=>e!==n))}}class mb{constructor(e){this._automations=[],this._priorEvaluations=new Map,this._nestedAutomationExecutions=0,this._api=e}deleteAutomations(e){this._automations=this._automations.filter((t=>t.tag!==e))}addAutomations(e){this._automations.push(...e)}execute(){if(!this._api.getHASSManager().hasHASS()||!this._api.getInitializationManager().isInitializedMandatory()||this._api.getMessageManager().hasErrorMessage())return;const e=[];for(const t of this._automations){const n=this._api.getConditionsManager().evaluateConditions(t.conditions),a=n?t.actions:t.actions_not,i=this._priorEvaluations.get(t);this._priorEvaluations.set(t,n),n!==i&&a&&e.push(...a)}if(!e.length)return;(async e=>{++this._nestedAutomationExecutions,this._nestedAutomationExecutions>10?this._api.getMessageManager().setMessageIfHigherPriority({type:"error",message:N_("error.too_many_automations")}):(await this._api.getActionsManager().executeActions(e),--this._nestedAutomationExecutions)})(e)}}class gb{constructor(e){this._api=e}openURL(){const e=this.getCameraURL();e&&window.open(e)}hasCameraURL(){return!!this.getCameraURL()}getCameraURL(){const e=this._api.getViewManager().getView(),t=e?.queryResults?.getSelectedResult()??null,n=e?.camera?this._api.getCameraManager().getCameraEndpoints(e.camera,{view:e.view,...t&&{media:t}})??null:null;return n?.ui?.endpoint??null}}const fb=()=>!!navigator.userAgent.match(/CrKey\//),_b=(e,t)=>!!((e.attributes.supported_features??0)&t),yb=e=>(e=>_b(e,4)&&"number"==typeof e.attributes.in_progress)(e)||!!e.attributes.in_progress,vb=e=>{switch(e){case"armed_away":return"mdi:shield-lock";case"armed_vacation":return"mdi:shield-airplane";case"armed_home":return"mdi:shield-home";case"armed_night":return"mdi:shield-moon";case"armed_custom_bypass":return"mdi:security";case"pending":case"arming":return"mdi:shield-sync";case"triggered":return"mdi:bell-ring";case"disarmed":return"mdi:shield-off";default:return"mdi:shield"}},bb=(e,t)=>{const n="off"===e;switch(t?.attributes.device_class){case"battery":return n?"mdi:battery":"mdi:battery-outline";case"battery_charging":return n?"mdi:battery":"mdi:battery-charging";case"cold":return n?"mdi:thermometer":"mdi:snowflake";case"connectivity":return n?"mdi:close-network-outline":"mdi:check-network-outline";case"door":return n?"mdi:door-closed":"mdi:door-open";case"garage_door":return n?"mdi:garage":"mdi:garage-open";case"power":case"plug":return n?"mdi:power-plug-off":"mdi:power-plug";case"gas":case"problem":case"safety":case"tamper":return n?"mdi:check-circle":"mdi:alert-circle";case"smoke":return n?"mdi:check-circle":"mdi:smoke";case"heat":return n?"mdi:thermometer":"mdi:fire";case"light":return n?"mdi:brightness5":"mdi:brightness-7";case"lock":return n?"mdi:lock":"mdi:lock-open";case"moisture":return n?"mdi:water-off":"mdi:water";case"motion":return n?"mdi:motion-sensor-off":"mdi:motion-sensor";case"occupancy":case"presence":return n?"mdi:home-outline":"mdi:home";case"opening":return n?"mdi:square":"mdi:square-outline";case"running":return n?"mdi:stop":"mdi:play";case"sound":return n?"mdi:music-note-off":"mdi:music-note";case"update":return n?"mdi:package":"mdi:package-up";case"vibration":return n?"mdi:crop-portrait":"mdi:vibrate";case"window":return n?"mdi:window-closed":"mdi:window-open";default:return n?"mdi:radiobox-blank":"mdi:checkbox-marked-circle"}},wb=(e,t)=>{const n="closed"!==e;switch(t?.attributes.device_class){case"garage":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:garage";default:return"mdi:garage-open"}case"gate":switch(e){case"opening":case"closing":return"mdi:gate-arrow-right";case"closed":return"mdi:gate";default:return"mdi:gate-open"}case"door":return n?"mdi:door-open":"mdi:door-closed";case"damper":return n?"md:circle":"mdi:circle-slice-8";case"shutter":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-shutter";default:return"mdi:window-shutter-open"}case"curtain":switch(e){case"opening":return"mdi:arrow-split-vertical";case"closing":return"mdi:arrow-collapse-horizontal";case"closed":return"mdi:curtains-closed";default:return"mdi:curtains"}case"blind":case"shade":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:blinds";default:return"mdi:blinds-open"}case"window":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-closed";default:return"mdi:window-open"}}switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-closed";default:return"mdi:window-open"}},xb={apparent_power:"mdi:flash",aqi:"mdi:air-filter",carbon_dioxide:"mdi:molecule-co2",carbon_monoxide:"mdi:molecule-co",current:"mdi:current-ac",date:"mdi:calendar",energy:"mdi:lightning-bolt",frequency:"mdi:sine-wave",gas:"mdi:gas-cylinder",humidity:"mdi:water-percent",illuminance:"mdi:brightness-5",monetary:"mdi:cash",nitrogen_dioxide:"mdi:molecule",nitrogen_monoxide:"mdi:molecule",nitrous_oxide:"mdi:molecule",ozone:"mdi:molecule",pm1:"mdi:molecule",pm10:"mdi:molecule",pm25:"mdi:molecule",power:"mdi:flash",power_factor:"mdi:angle-acute",pressure:"mdi:gauge",reactive_power:"mdi:flash",signal_strength:"mdi:wifi",sulphur_dioxide:"mdi:molecule",temperature:"mdi:thermometer",timestamp:"mdi:clock",volatile_organic_compounds:"mdi:molecule",voltage:"mdi:sine-wave"},Cb={10:"mdi:battery-10",20:"mdi:battery-20",30:"mdi:battery-30",40:"mdi:battery-40",50:"mdi:battery-50",60:"mdi:battery-60",70:"mdi:battery-70",80:"mdi:battery-80",90:"mdi:battery-90",100:"mdi:battery"},Mb={10:"mdi:battery-charging-10",20:"mdi:battery-charging-20",30:"mdi:battery-charging-30",40:"mdi:battery-charging-40",50:"mdi:battery-charging-50",60:"mdi:battery-charging-60",70:"mdi:battery-charging-70",80:"mdi:battery-charging-80",90:"mdi:battery-charging-90",100:"mdi:battery-charging"},kb=(e,t)=>{const n=Number(e);if(isNaN(n))return"off"===e?"mdi:battery":"on"===e?"mdi:battery-alert":"mdi:battery-unknown";const a=10*Math.round(n/10);return t&&n>=10?Mb[a]:t?"mdi:battery-charging-outline":n<=5?"mdi:battery-alert-variant-outline":Cb[a]},Sb=e=>{const t=e?.attributes.device_class;if(t&&t in xb)return xb[t];if("battery"===t)return e?((e,t)=>{const n=e.state;return kb(n,"on"===t?.state)})(e):"mdi:battery";const n=e?.attributes.unit_of_measurement;return"°C"===n||"°F"===n?"mdi:thermometer":void 0},Eb="mdi:bookmark",$b={alert:"mdi:alert",air_quality:"mdi:air-filter",automation:"mdi:robot",calendar:"mdi:calendar",camera:"mdi:video",climate:"mdi:thermostat",configurator:"mdi:cog",conversation:"mdi:text-to-speech",counter:"mdi:counter",fan:"mdi:fan",google_assistant:"mdi:google-assistant",group:"mdi:google-circles-communities",homeassistant:"mdi:home-assistant",homekit:"mdi:home-automation",image_processing:"mdi:image-filter-frames",input_button:"mdi:gesture-tap-button",input_datetime:"mdi:calendar-clock",input_number:"mdi:ray-vertex",input_select:"mdi:format-list-bulleted",input_text:"mdi:form-textbox",light:"mdi:lightbulb",mailbox:"mdi:mailbox",notify:"mdi:comment-alert",number:"mdi:ray-vertex",persistent_notification:"mdi:bell",person:"mdi:account",plant:"mdi:flower",proximity:"mdi:apple-safari",remote:"mdi:remote",scene:"mdi:palette",script:"mdi:script-text",select:"mdi:format-list-bulleted",sensor:"mdi:eye",siren:"mdi:bullhorn",simple_alarm:"mdi:bell",sun:"mdi:white-balance-sunny",timer:"mdi:timer-outline",updater:"mdi:cloud-upload",vacuum:"mdi:robot-vacuum",water_heater:"mdi:thermometer",weather:"mdi:weather-cloudy",zone:"mdi:map-marker-radius"};function Ab(e,t,n,a){switch(e){case"alarm_control_panel":return vb(n);case"binary_sensor":return bb(n,t);case"button":switch(t?.attributes.device_class){case"restart":return"mdi:restart";case"update":return"mdi:package-up";default:return"mdi:gesture-tap-button"}case"cover":return wb(n,t);case"device_tracker":return"router"===t?.attributes.source_type?"home"===n?"mdi:lan-connect":"mdi:lan-disconnect":["bluetooth","bluetooth_le"].includes(t?.attributes.source_type)?"home"===n?"mdi:bluetooth-connect":"mdi:bluetooth":"not_home"===n?"mdi:account-arrow-right":"mdi:account";case"humidifier":return n&&"off"===n?"mdi:air-humidifier-off":"mdi:air-humidifier";case"input_boolean":return"on"===n?"mdi:check-circle-outline":"mdi:close-circle-outline";case"lock":switch(n){case"unlocked":return"mdi:lock-open";case"jammed":return"mdi:lock-alert";case"locking":case"unlocking":return"mdi:lock-clock";default:return"mdi:lock"}case"media_player":switch(t?.attributes.device_class){case"speaker":switch(n){case"playing":return"mdi:speaker-play";case"paused":return"mdi:speaker-pause";case"off":return"mdi:speaker-off";default:return"mdi:speaker"}case"tv":switch(n){case"playing":return"mdi:television-play";case"paused":return"mdi:television-pause";case"off":return"mdi:television-off";default:return"mdi:television"}default:switch(n){case"playing":case"paused":return"mdi:cast-connected";case"off":return"mdi:cast-off";default:return"mdi:cast"}}case"switch":switch(t?.attributes.device_class){case"outlet":return"on"===n?"mdi:power-plug":"mdi:power-plug-off";case"switch":return"on"===n?"mdi:toggle-switch":"mdi:toggle-switch-off";default:return"mdi:flash"}case"zwave":switch(n){case"dead":return"mdi:emoticon-dead";case"sleeping":return"mdi:sleep";case"initializing":return"mdi:timer-sand";default:return"mdi:z-wave"}case"sensor":{const e=Sb(t);if(e)return e;break}case"input_datetime":if(!t?.attributes.has_date)return"mdi:clock";if(!t.attributes.has_time)return"mdi:calendar";break;case"sun":return"above_horizon"===t?.state?$b[e]:"mdi:weather-night";case"update":return"on"===t?.state?yb(t)?"mdi:package-down":"mdi:package-up":"mdi:package"}return e in $b?$b[e]:a??Eb}async function Ib(e,t,n){const a={type:"auth/sign_path",path:t,expires:n},i=await Sy(e,Ts,a);return i?e.hassUrl(i.path):null}function zb(e,t,n,a){if(!e||!n||!n.length)return[];const i=[];for(const r of n){const n=t?.states[r],o=e.states[r];if((a?.stateOnly&&n?.state!==o?.state||!a?.stateOnly&&n!==o)&&(i.push({entityID:r,oldState:n,newState:o}),a?.firstOnly))break}return i}function Tb(e,t,n,a){return!!zb(e,t,n,{...a,firstOnly:!0}).length}function jb(e){if("off"===e.state||!e.attributes.brightness)return"";return`brightness(${(e.attributes.brightness+245)/5}%)`}function Ob(e){return"off"===e.state?"":e.attributes.rgb_color?`rgb(${e.attributes.rgb_color.join(",")})`:""}function Db(e){return{color:Ob(e),filter:jb(e)}}function Rb(e,t){if(!t.entity)return t;const n=e.states[t.entity];n&&t.state_color&&(t.style={...Db(n),...t.style}),t.title=t.title??(n?.attributes?.friendly_name||t.entity),t.icon=t.icon??Lb(e,t.entity);const a=n?function(e){return Ye(e.entity_id)}(n):void 0;return t.data_domain=t.state_color||"light"===a&&!1!==t.state_color?a:void 0,n&&(t.data_state=(e=>{const t=e.entity_id.split(".")[0];let n=e.state;return"climate"===t&&(n=e.attributes.hvac_action),n})(n)),t}function Pb(e,t){return t?e?.states[t]?.attributes?.friendly_name:void 0}function Lb(e,t,n){const a=e.states[t];return a&&a.attributes.icon?a.attributes.icon:Ab(Ye(t),a,a?.state,n)}const Nb=async()=>{if(["ha-button-menu","ha-button","ha-camera-stream","ha-card","ha-circular-progress","ha-hls-player","ha-icon-button","ha-icon","ha-menu-button","ha-selector","ha-web-rtc-player"].every((e=>customElements.get(e))))return!0;const e=await window.loadCardHelpers();await e.createCardElement({type:"picture-glance",entities:[],camera_image:"dummy-to-load-editor-components"}),await customElements.whenDefined("hui-picture-glance-card");const t=customElements.get("hui-picture-glance-card");if(!t)return!1;const n=new t;return await n.constructor.getConfigElement(),!0},Fb=e=>!!e&&["on","open"].includes(e),Vb=(e,t)=>{if(!e)return[];const n=Object.keys(e.states).filter((e=>!t||e.substr(0,e.indexOf("."))===t));return n.sort(),n};function Hb(e){return!!e?.startsWith("/")}function Bb(e,t){return Hb(t)?e.hassUrl(t):t??null}class qb{constructor(){this._initialized=new Set}async initializeMultipleIfNecessary(e){return(await Jg(Object.entries(e),(async([e,t])=>await this.initializeIfNecessary(e,t)))).every(Boolean)}async initializeIfNecessary(e,t){return!!this._initialized.has(e)||(t?!!await t()&&(this._initialized.add(e),!0):(this._initialized.add(e),!0))}uninitialize(e){this._initialized.delete(e)}isInitialized(e){return this._initialized.has(e)}isInitializedMultiple(e){return e.every((e=>this.isInitialized(e)))}}var Ub;!function(e){e.LANGUAGES="languages",e.SIDE_LOAD_ELEMENTS="side-load-elements",e.CAMERAS="cameras",e.MICROPHONE_CONNECT="microphone-connect",e.VIEW="view"}(Ub||(Ub={}));class Wb{constructor(e,t){this._initializationQueue=new v_({concurrency:1}),this._everInitialized=!1,this._api=e,this._initializer=t??new qb}wasEverInitialized(){return this._everInitialized}isInitializedMandatory(){return!!this._api.getConfigManager().getConfig()&&this._initializer.isInitializedMultiple([Ub.LANGUAGES,Ub.SIDE_LOAD_ELEMENTS,Ub.CAMERAS,...this._api.getMicrophoneManager().shouldConnectOnInitialization()?[Ub.MICROPHONE_CONNECT]:[],Ub.VIEW])}async initializeMandatory(){await this._initializationQueue.add((()=>this._initializeMandatory()))}async _initializeMandatory(){const e=this._api.getHASSManager().getHASS();if(!e||this.isInitializedMandatory())return;if(!await this._initializer.initializeMultipleIfNecessary({[Ub.LANGUAGES]:async()=>await(async e=>{const t=L_(e);return"ca"===t?R_[t]=await import("./lang-ca-449daa4a.js"):"it"===t?R_[t]=await import("./lang-it-2a20a319.js"):"pt"===t?R_[t]=await import("./lang-pt-PT-c4863423.js"):"pt_BR"===t?R_[t]=await import("./lang-pt-BR-83a703b9.js"):"fr"===t&&(R_[t]=await import("./lang-fr-ea16daba.js")),t&&(P_=t),!0})(e),[Ub.SIDE_LOAD_ELEMENTS]:async()=>await Nb()}))return;this._api.getConfigManager().getConfig()&&await this._initializer.initializeMultipleIfNecessary({[Ub.CAMERAS]:async()=>await this._api.getCameraManager().initializeCamerasFromConfig(),...this._api.getMicrophoneManager().shouldConnectOnInitialization()&&{[Ub.MICROPHONE_CONNECT]:async()=>await this._api.getMicrophoneManager().connect()}})&&!this._api.getMessageManager().hasMessage()&&await this._initializer.initializeIfNecessary(Ub.VIEW,this._api.getViewManager().initialize)&&(this._everInitialized=!0,this._api.getCardElementManager().update())}uninitialize(e){this._initializer.uninitialize(e)}}class Zb{constructor(e,t,n,a){this.update=()=>{this._element.requestUpdate()},this._api=e,this._element=t,this._scrollCallback=n,this._menuToggleCallback=a}getElement(){return this._element}scrollReset(){this._scrollCallback()}toggleMenu(){this._menuToggleCallback()}hasUpdated(){return this._element.hasUpdated}elementConnected(){this._api.getInteractionManager().initialize(),this._api.getFullscreenManager().initialize(),this._api.getExpandManager().initialize(),this._api.getMediaLoadedInfoManager().initialize(),this._api.getMicrophoneManager().initialize(),this._api.getKeyboardStateManager().initialize(),this._api.getDefaultManager().initialize(),this._api.getMediaPlayerManager().initialize(),this._api.getHASSManager().getStateWatcher()?.subscribe(this.update,[...this._api.getConfigManager().getConfig()?.view.render_entities??[],...this._api.getMediaPlayerManager().getMediaPlayers()??[]]),af(this._element,(e=>{const t=e.getRootNode();return!!(t&&t instanceof ShadowRoot&&"HUI-PANEL-VIEW"===t.host.tagName)})(this._element),"panel"),af(this._element,fb(),"casted"),this._api.getFullscreenManager().connect(),this._element.addEventListener("mousemove",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("wheel",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("ll-custom",this._api.getActionsManager().handleCustomActionEvent),this._element.addEventListener("action",this._api.getActionsManager().handleInteractionEvent),this._element.addEventListener("action",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("frigate-card:action:execution-request",this._api.getActionsManager().handleActionExecutionRequestEvent),window.addEventListener("location-changed",this._api.getQueryStringManager().requestExecution),window.addEventListener("popstate",this._api.getQueryStringManager().requestExecution),this._api.getQueryStringManager().requestExecution(),this._element.requestUpdate()}elementDisconnected(){af(this._element,!1,"panel"),af(this._element,!1,"tabindex"),af(this._element,!1,"casted"),this._api.getMediaLoadedInfoManager().clear(),this._api.getFullscreenManager().disconnect(),this._api.getKeyboardStateManager().uninitialize(),this._api.getActionsManager().uninitialize(),this._api.getDefaultManager().uninitialize(),this._api.getHASSManager().getStateWatcher()?.unsubscribe(this.update),this._api.getInitializationManager().uninitialize(Ub.CAMERAS),this._api.getCameraManager().reset(),this._element.removeEventListener("mousemove",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("wheel",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("ll-custom",this._api.getActionsManager().handleCustomActionEvent),this._element.removeEventListener("action",this._api.getActionsManager().handleInteractionEvent),this._element.removeEventListener("action",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("frigate-card:action:execution-request",this._api.getActionsManager().handleActionExecutionRequestEvent),window.removeEventListener("location-changed",this._api.getQueryStringManager().requestExecution),window.removeEventListener("popstate",this._api.getQueryStringManager().requestExecution)}}function Qb(e,t,n){return null==e?e:function(e,t,n,a){if(!dh(e))return e;for(var i=-1,r=(t=ry(t,e)).length,o=r-1,s=e;null!=s&&++i{Qb(e,t,n)},Kb=(e,t,n)=>my(e,t,n),Xb=(e,t)=>{!function(e,t){null==e||Gb(e,t)}(e,t)},Jb=e=>l_(e),ew=(e,t)=>e.replace("#",`[${t.toString()}]`),tw=function(e){let t=!1;for(let n=0;n{const i=Kb(e,t);if(void 0===i)return!1;const r=a?.transform?a.transform(i):i;return!(t===n&&jy(i,r)||(null===r?a?.keepOriginal||(Xb(e,t),0):void 0===r||(a?.keepOriginal||Xb(e,t),Yb(e,n,r),0)))})(a,e,t,n)}},iw=function(e,t,n){return function(a){let i=aw(e,t,n)(a);return i=sw(ys,aw(e,t,n),(e=>e.overrides))(a)||i,i}},rw=function(e,t){return iw(e,e,{transform:t})},ow=function(e){return iw(e,e,{transform:e=>null})},sw=function(e,t,n){return function(a){let i=!1;const r=Kb(a,e);return Array.isArray(r)&&r.forEach((e=>{const a=n?n(e):e;a&&"object"==typeof a&&(i=t(a)||i)})),i}},cw=(e,t)=>{const n=a=>{let i=!1;if(a&&"object"==typeof a){const r=t?t(a):a;r&&(i=e(r)||i),Array.isArray(a)?a.forEach((e=>{i=n(e)||i})):Object.keys(a).forEach((e=>{i=n(a[e])||i}))}return i};return n},lw=e=>!("object"!=typeof e||!e||void 0===e.mediaLoaded)&&(e.media_loaded=e.mediaLoaded,delete e.mediaLoaded,!0),dw=e=>{if("object"!=typeof e||!e||"object"!=typeof e.conditions||!e.conditions)return!1;const t=e.conditions,n=[];if(void 0!==t.view&&n.push({condition:"view",views:t.view}),void 0!==t.fullscreen&&n.push({condition:"fullscreen",fullscreen:t.fullscreen}),void 0!==t.expand&&n.push({condition:"expand",expand:t.expand}),void 0!==t.camera&&n.push({condition:"camera",cameras:t.camera}),void 0!==t.media_loaded&&n.push({condition:"media_loaded",media_loaded:t.media_loaded}),void 0!==t.state&&Array.isArray(t.state))for(const e of t.state)"object"!=typeof e||!e||void 0===e.state&&void 0===e.state_not&&void 0===e.entity||n.push({condition:"state",...e.state&&{state:e.state},...e.state_not&&{state_not:e.state_not},...e.entity&&{entity:e.entity}});return void 0!==t.media_query&&n.push({condition:"screen",media_query:t.media_query}),!!n.length&&(e.conditions=n,!0)},uw=e=>!("object"!=typeof e||!e||"call-service"!==e.action||"string"!=typeof e.service)&&(e.action="perform-action",e.perform_action=e.service,delete e.service,!0),hw=e=>!("object"!=typeof e||!e||"call-service"!==e.action||void 0===e.service||void 0===e.service_data||void 0!==e.data)&&(e.data=e.service_data,delete e.service_data,!0),pw=e=>!("object"!=typeof e||!e||"custom:frigate-card-action"!==e.action||"frigate_ui"!==e.frigate_card_action)&&(e.frigate_card_action="camera_ui",!0),mw=[sw(ys,lw,(e=>e.conditions)),e=>cw(lw,(e=>e.conditions))("object"==typeof e&&e?e[Ai]:{}),iw("event_gallery",ir),iw("menu.buttons.frigate_ui",ns),e=>cw(pw)("object"==typeof e&&e?e:{}),sw(wa,rw("live_provider",(e=>"frigate-jsmpeg"===e?"jsmpeg":e))),iw("live.jsmpeg",Ci),iw("live.image",wi),iw("live.webrtc_card",Mi),sw(wa,iw("frigate.zone","frigate.zones",{transform:e=>qg(e)})),sw(wa,iw("frigate.label","frigate.labels",{transform:e=>qg(e)})),e=>cw(hw)("object"==typeof e&&e?e:{}),function(e){if("object"!=typeof e||!e||!(Ai in e)||!Array.isArray(e[Ai]))return!1;let t=!1;const n=n=>{if(!t){if(!my(e,"live.controls.ptz")){const{type:t,...a}=n;Qb(e,"live.controls.ptz",a)}t=!0}},a=e=>{const t=[];for(const i of e)if("custom:frigate-card-ptz"===i.type)n(i);else if("conditional"!==i.type&&"custom:frigate-card-conditional"!==i.type||!Array.isArray(i.elements))t.push(i);else{const e=a(i.elements);e.length&&(i.elements=e,t.push(i))}return t},i=a(e[Ai]);return t&&(i.length?e[Ai]=i:delete e[Ai]),t},iw("view.timeout_seconds",Oi),rw("live.lazy_unload",(e=>"all"===e?["unselected","hidden"]:"never"===e?null:qg(e))),rw("live.auto_play",(e=>"all"===e?null:"never"===e?[]:qg(e))),rw("live.auto_pause",(e=>"all"===e?["unselected","hidden"]:"never"===e?null:qg(e))),rw("live.auto_mute",(e=>"all"===e?null:"never"===e?[]:qg(e))),rw("live.auto_unmute",(e=>"all"===e?["selected","visible","microphone"]:"never"===e?null:qg(e))),rw("media_viewer.auto_play",(e=>"all"===e?null:"never"===e?[]:qg(e))),rw("media_viewer.auto_pause",(e=>"all"===e?null:"never"===e?[]:qg(e))),rw("media_viewer.auto_mute",(e=>"all"===e?null:"never"===e?[]:qg(e))),rw("media_viewer.auto_unmute",(e=>"all"===e?["selected","visible"]:"never"===e?null:qg(e))),iw("live.controls.thumbnails.media",no),iw("timeline.media",Fo),iw("live.controls.timeline.media",uo),iw("media_viewer.controls.timeline.media",Or),iw("view.scan",Yi),iw("view.triggers.enabled",tr,{transform:e=>!0===e?"live":null,keepOriginal:!0}),iw("view.triggers.enabled",Xi,{transform:e=>!0!==e&&null}),iw("view.triggers.untrigger_reset",nr,{transform:e=>e?"default":null}),iw("live.layout",Ei),ow("media_viewer.layout"),ow("image.layout"),sw(ys,dw),e=>cw(dw)("object"==typeof e&&e?e[Ai]:{}),e=>cw(dw)("object"==typeof e&&e?e.automations:{}),sw(wa,iw("hide","capabilities",{transform:e=>!0===e?{disable_except:["substream"]}:null})),iw("performance.profile",Ss,{transform:e=>"low"===e?["low-performance"]:null}),sw(ys,aw("overrides","merge")),iw("live.controls.ptz",$i,{transform:e=>{if("object"!=typeof e||!e)return;const t=["data_left","data_right","data_up","data_down","data_zoom_in","data_zoom_out","service"],n=["actions_left","actions_right","actions_up","actions_down","actions_zoom_in","actions_zoom_out"],a=[...t,...n,"data_home","actions_home"];if(!Object.keys(e).some((e=>a.includes(e))))return;const i={};t.filter((t=>t in e)).reduce(((t,n)=>(t[n]=e[n],t)),i),n.filter((t=>t in e)).reduce(((t,n)=>("object"==typeof e[n]&&"tap_action"in e[n]&&(t[n]=e[n].tap_action),t)),i);const r=()=>{i.presets="presets"in e&&"object"==typeof e.presets&&e.presets?e.presets:{}};return"actions_home"in e&&"object"==typeof e.actions_home&&e.actions_home&&"tap_action"in e.actions_home?(r(),i.presets.home=e.actions_home.tap_action):"data_home"in e&&"object"==typeof e.data_home&&e.data_home&&"string"==typeof e.service&&(r(),i.presets.service=e.service,i.presets.data_home=e.data_home),i},keepOriginal:!0}),rw("live.controls.ptz",(e=>{if("object"!=typeof e||!e)return e;const t=["mode","position","orientation","hide_pan_tilt","hide_zoom","hide_home","style"],n=Object.keys(e);return n.some((e=>!t.includes(e)))?n.filter((e=>t.includes(e))).reduce(((t,n)=>(t[n]=e[n],t)),{}):void 0})),iw("view.update_cycle_camera",qi),iw("view.update_force",Wi,{transform:e=>!0===e?"all":null}),iw("view.update_seconds",Zi),iw("view.update_entities",Qi),aw("live.controls.title",cs,{transform:e=>"object"==typeof e&&e&&"string"==typeof e.mode?"none"===e.mode?{style:"none"}:e.mode.includes("bottom")?{position:"bottom"}:e.mode.includes("top")?{position:"top"}:null:null}),ow("live.controls.title"),ow("media_viewer.controls.title"),e=>cw(uw)("object"==typeof e&&e?e:{}),iw("dimensions.max_height",_s),ow("dimensions.min_height")];class gw extends $s{}class fw extends Event{constructor(e,t){super("frigate-card:conditions:evaluate",t),this.conditions=e}}function _w(e,t,n){let a=Jb(t),i=!1;if(n?.configOverrides)for(const t of n.configOverrides)e.evaluateConditions(t.conditions,n?.stateOverrides)&&(t.delete?.forEach((e=>{Xb(a,e)})),Object.keys(t.set??{}).forEach((e=>{Yb(a,e,t.set?.[e])})),Object.keys(t.merge??{}).forEach((e=>{Yb(a,e,Rv({},Kb(a,e),t.merge?.[e]))})),i=!0);if(!i)return t;if(n?.configOverrides?.some((e=>e.delete?.length))&&(a=df(a)),n?.schema){const e=n.schema.safeParse(a);if(!e.success)throw new gw(N_("error.invalid_configuration_override"),[e.error.errors,a]);return e.data}return a}class yw{constructor(e,t){this._state={},this._epoch=this._createEpoch(),this._hasHAStateConditions=!1,this._mediaQueries=[],this._mediaQueryTrigger=()=>this._triggerChange(),this._api=e,this._listeners=[()=>this._api.getConfigManager().computeOverrideConfig(),()=>this._api.getAutomationsManager().execute(),...t?[t]:[]]}removeConditions(){this._mediaQueries.forEach((e=>e.removeEventListener("change",this._mediaQueryTrigger))),this._mediaQueries=[]}setConditionsFromConfig(){this.removeConditions();const e=(()=>{const e=this._api.getConfigManager().getConfig(),t=[];e?.overrides?.forEach((e=>t.push(...e.conditions))),e?.automations?.forEach((e=>t.push(...e.conditions)));const n=e=>{const a=fl.safeParse(e);a.success?(t.push(...a.data.conditions),a.data.elements?.forEach(n)):e&&"object"==typeof e&&Object.keys(e).forEach((t=>n(e[t])))};return e?.elements?.forEach(n),t})();this._hasHAStateConditions=e.some((e=>!e.condition||["state","numeric_state","user"].includes(e.condition))),e.forEach((e=>{if("screen"===e.condition){const t=window.matchMedia(e.media_query);t.addEventListener("change",this._mediaQueryTrigger),this._mediaQueries.push(t)}}))}setState(e){Object.keys(e).every((t=>jy(e[t],this._state[t])))||(this._state={...this._state,...e},this._triggerChange())}getState(){return this._state}hasHAStateConditions(){return this._hasHAStateConditions}getEpoch(){return this._epoch}evaluateConditions(e,t){return e.every((e=>this._evaluateCondition(e,t)))}_evaluateCondition(e,t){const n={...this._state,...t};switch(e.condition){case void 0:case"state":return!!n.state&&(!e.state&&!e.state_not||e.entity in n.state&&(!e.state||(Array.isArray(e.state)?e.state.includes(n.state[e.entity].state):e.state===n.state[e.entity].state))&&(!e.state_not||(Array.isArray(e.state_not)?!e.state_not.includes(n.state[e.entity].state):e.state_not!==n.state[e.entity].state)));case"view":return!!n?.view&&e.views.includes(n.view);case"fullscreen":return void 0!==n.fullscreen&&e.fullscreen===n.fullscreen;case"expand":return void 0!==n.expand&&e.expand===n.expand;case"camera":return!!n.camera&&e.cameras.includes(n.camera);case"numeric_state":return!!n.state&&e.entity in n.state&&void 0!==n.state[e.entity].state&&(void 0===e.above||Number(n.state[e.entity].state)>e.above)&&(void 0===e.below||Number(n.state[e.entity].state)n.triggered?.has(e)));case"interaction":return void 0!==n.interaction&&e.interaction===n.interaction;case"microphone":return!(void 0!==e.connected&&n.microphone?.connected!==e.connected||void 0!==e.muted&&n.microphone?.muted!==e.muted);case"key":return!(!n.keys||!(e.key in n.keys)||(e.state??"down")!==n.keys[e.key].state||void 0!==e.ctrl&&e.ctrl!==!!n.keys[e.key].ctrl||void 0!==e.alt&&e.alt!==!!n.keys[e.key].alt||void 0!==e.meta&&e.meta!==!!n.keys[e.key].meta||void 0!==e.shift&&e.shift!==!!n.keys[e.key].shift)}}_createEpoch(){return{manager:this}}_triggerChange(){this._epoch=this._createEpoch(),this._listeners.forEach((e=>e()))}}const vw={casting:{[Wr]:!1,[Mr]:!1,[Xo]:"none",[`${is}.enabled`]:!0,[`${rs}.enabled`]:!0,[`${as}.enabled`]:!1,[`${os}.enabled`]:!1,[Ur]:["selected","visible"],[fs]:"static",[gs]:"16:9",[Si]:1,[So]:!0},"low-performance":{[ao]:"none",[Er]:"none",[Bo]:"none",[mo]:!1,[Pr]:!1,[Vo]:!1,[qr]:[],[hr]:[],[pr]:[],[mr]:[],[Co]:["unselected","hidden"],[wo]:!1,[br]:!1,[ko]:"none",[Cr]:"none",[So]:!1,[kr]:"chevrons",[ds]:"none",[Xo]:"outside",[`${ts}.enabled`]:!1,[`${ss}.enabled`]:!1,[`${ss}.enabled`]:!1,[`${os}.enabled`]:!1,[sr]:!1,[cr]:!1,[lr]:!1,[or]:!1,[oo]:!1,[so]:!1,[co]:!1,[ro]:!1,[Ar]:!1,[Ir]:!1,[zr]:!1,[$r]:!1,[Wo]:!1,[Zo]:!1,[Qo]:!1,[Uo]:!1,[bs]:!1,[ws]:10,[ks]:!1,[Ms]:!1,[xr]:!1,[ki]:!1,[xi]:"image",[Si]:10,[tr]:"none",[xs]:1},scrubbing:{[ho]:"below",[go]:"ribbon",[po]:"seek",[Dr]:"below",[Lr]:"ribbon",[Rr]:"seek"}},bw=(e,t,n)=>{const a=js(Pd).safeParse(e);if(!a.success)return t;const i=a.data;for(const e of n??[])e in vw&&Object.entries(vw[e]).forEach((([e,n])=>{return r=n,void(void 0===Kb(i,a=e)&&Yb(t,a,r));var a,r}));return t},ww=e=>{switch(e){case"ptz_left":return"left";case"ptz_right":return"right";case"ptz_up":return"up";case"ptz_down":return"down";case"ptz_zoom_in":return"zoom_in";case"ptz_zoom_out":return"zoom_out"} +/* istanbul ignore next: No (current) way to reach this code -- @preserve */return null},xw=(e,t)=>{if(!t.enabled)return[];const n=[];for(const a of["ptz_down","ptz_left","ptz_right","ptz_up","ptz_zoom_in","ptz_zoom_out"]){const i=t[a],r=ww(a);i&&r&&(n.push({conditions:[{condition:"key",key:i.key,state:"down",shift:i.shift,ctrl:i.ctrl,alt:i.alt,meta:i.meta}],actions:[ff({ptzAction:r,ptzPhase:"start"})],tag:e}),n.push({conditions:[{condition:"key",key:i.key,state:"up"}],actions:[ff({ptzAction:r,ptzPhase:"stop"})],tag:e}))}const a=t.ptz_home;return a&&n.push({conditions:[{condition:"key",key:a.key,state:"down",shift:a.shift,ctrl:a.ctrl,alt:a.alt,meta:a.meta}],actions:[ff()],tag:e}),n};class Cw{constructor(e){this._config=null,this._overriddenConfig=null,this._rawConfig=null,this._cardWideConfig=null,this._api=e}hasConfig(){return!!this.getConfig()}getConfig(){return this._overriddenConfig??this._config}getCardWideConfig(){return this._cardWideConfig}getNonOverriddenConfig(){return this._config}getRawConfig(){return this._rawConfig}setConfig(e){if(!e)throw new Error(N_("error.invalid_configuration"));const t=Pd.safeParse(e);if(!t.success){const n=nw(e),a=Ds(t.error);let i="";throw n&&(i=`${N_("error.upgrade_available")}. `),new Error(i+`${N_("error.invalid_configuration")}: `+(a&&a.size?JSON.stringify([...a],null," "):N_("error.invalid_configuration_no_hint")))}const n=bw(e,t.data,t.data.profiles);var a;(this._rawConfig=e,jy(this._config,n))||(this._config=n,this._cardWideConfig={performance:n.performance,debug:n.debug},this._api.getConditionsManager().setConditionsFromConfig(),this._api.getConditionsManager().setState({view:void 0,displayMode:void 0,camera:void 0}),this._api.getMediaLoadedInfoManager().clear(),this._api.getInitializationManager().uninitialize(Ub.VIEW),this._api.getViewManager().reset(),this._api.getMessageManager().reset(),this._api.getStyleManager().setPerformance(),this._api.getStatusBarItemManager().removeAllDynamicStatusBarItems(),((e,t)=>{e.getAutomationsManager().deleteAutomations(t);const n=e.getConfigManager().getConfig()?.view.keyboard_shortcuts;if(!n)return;const a=xw(t,n);a.length&&e.getAutomationsManager().addAutomations(a)})(this._api,this),(a=this._api).getAutomationsManager().deleteAutomations(),a.getAutomationsManager().addAutomations(a.getConfigManager().getNonOverriddenConfig()?.automations??[]),this.computeOverrideConfig(),this._api.getCardElementManager().update())}computeOverrideConfig(){const e=this._api.getConditionsManager();if(!this._config)return;let t=null;try{t=_w(e,this._config,{configOverrides:this._config.overrides,schema:Pd})}catch(e){return void this._api.getMessageManager().setErrorIfHigherPriority(e)}if(jy(t,this._overriddenConfig))return;const n=this._overriddenConfig;this._overriddenConfig=t,this._api.getStyleManager().setMinMaxHeight(),!n||jy(n?.cameras,this._overriddenConfig?.cameras)&&jy(n?.cameras_global,this._overriddenConfig?.cameras_global)||this._api.getInitializationManager().uninitialize(Ub.CAMERAS),n&&n?.live.microphone.always_connected!==this._overriddenConfig?.live.microphone.always_connected&&this._api.getInitializationManager().uninitialize(Ub.MICROPHONE_CONNECT),this._initializeBackground(n)}async _initializeBackground(e){await this._api.getDefaultManager().initializeIfNecessary(e),await this._api.getMediaPlayerManager().initializeIfNecessary(e),this._api.getCardElementManager().update()}}class Mw{constructor(e){this._timer=new bf,this._stateChangeHandler=()=>{this._setToDefaultIfAllowed()},this._api=e}async initializeIfNecessary(e){jy(e?.view.default_reset,this._api.getConfigManager().getConfig()?.view.default_reset)||await this.initialize()}async initialize(){this.uninitialize();const e=this._api.getConfigManager().getConfig()?.view.default_reset;e?.entities.length&&this._api.getHASSManager().getStateWatcher().subscribe(this._stateChangeHandler,e.entities);const t=this._api.getConfigManager().getConfig()?.view.default_reset.every_seconds;return t&&this._timer.startRepeated(t,(()=>this._setToDefaultIfAllowed())),this._api.getConfigManager().getConfig()?.view.default_reset.after_interaction&&this._api.getAutomationsManager().addAutomations([{actions:[pf("default")],conditions:[{condition:"interaction",interaction:!1}],tag:this}]),!0}uninitialize(){this._timer.stop(),this._api.getHASSManager().getStateWatcher().unsubscribe(this._stateChangeHandler),this._api.getAutomationsManager().deleteAutomations(this)}_setToDefaultIfAllowed(){this._isAutomatedUpdateAllowed()&&this._api.getViewManager().setViewDefault()}_isAutomatedUpdateAllowed(){const e=this._api.getConfigManager().getConfig()?.view.default_reset.interaction_mode;return!!e&&((e,t)=>{switch(e){case"all":return!0;case"active":return t;case"inactive":return!t}})(e,this._api.getInteractionManager().hasInteraction())}}const kw=(e,t="download")=>{const n=new URL(e).origin===window.location.origin,a=e.startsWith("data:");if(navigator.userAgent.startsWith("Home Assistant/")||navigator.userAgent.startsWith("HomeAssistant/")||!n&&!a)window.open(e,"_blank");else{const n=document.createElement("a");n.setAttribute("download",t),n.href=e,n.click(),n.remove()}},Sw=async(e,t,n)=>{const a=await t.getMediaDownloadPath(n);if(!a)throw new $s(N_("error.download_no_media"));let i=a.endpoint;if(a.sign){let t;try{t=await Ib(e,a.endpoint)}catch(e){Zg(e)}if(!t)throw new $s(N_("error.download_sign_failed"));i=t}kw(i)},Ew=e=>{const t=document.createElement("canvas");t.width=e.videoWidth,t.height=e.videoHeight;const n=t.getContext("2d");return n?(n.drawImage(e,0,0,t.width,t.height),t.toDataURL("image/jpeg")):null};class $w{constructor(e){this._api=e}async downloadViewerMedia(){const e=this._api.getViewManager().getView()?.queryResults?.getSelectedResult(),t=this._api.getHASSManager().getHASS();if(!e||!t)return!1;try{await Sw(t,this._api.getCameraManager(),e)}catch(e){return this._api.getMessageManager().setErrorIfHigherPriority(e),!1}return!0}async downloadScreenshot(){const e=await(this._api.getMediaLoadedInfoManager().get()?.player?.getScreenshotURL());e&&kw(e,(e=>{if(e?.is("live")||e?.is("image"))return`${e.view}-${e.camera}-${qu(new Date,"yyyy-MM-dd-HH-mm-ss")}.jpg`;if(e?.isViewerView()){const t=e.queryResults?.getSelectedResult(),n=t?.getID()??null;return`${e.view}-${e.camera}${n?`-${n}`:""}.jpg`}return"screenshot.jpg"})(this._api.getViewManager().getView()))}}class Aw{constructor(e){this._expanded=!1,this._api=e}initialize(){this._setConditionState()}isExpanded(){return this._expanded}toggleExpanded(){this.setExpanded(!this._expanded)}setExpanded(e){e&&this._api.getFullscreenManager().isInFullscreen()&&this._api.getFullscreenManager().stopFullscreen(),this._expanded=e,this._setConditionState(),this._api.getCardElementManager().update()}_setConditionState(){this._api.getConditionsManager()?.setState({expand:this._expanded})}}const Iw=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],zw=(()=>{if("undefined"==typeof document)return!1;const e=Iw[0],t={};for(const n of Iw){const a=n?.[1];if(a in document){for(const[a,i]of n.entries())t[e[a]]=i;return t}}return!1})(),Tw={change:zw.fullscreenchange,error:zw.fullscreenerror};let jw={request:(e=document.documentElement,t)=>new Promise(((n,a)=>{const i=()=>{jw.off("change",i),n()};jw.on("change",i);const r=e[zw.requestFullscreen](t);r instanceof Promise&&r.then(i).catch(a)})),exit:()=>new Promise(((e,t)=>{if(!jw.isFullscreen)return void e();const n=()=>{jw.off("change",n),e()};jw.on("change",n);const a=document[zw.exitFullscreen]();a instanceof Promise&&a.then(n).catch(t)})),toggle:(e,t)=>jw.isFullscreen?jw.exit():jw.request(e,t),onchange(e){jw.on("change",e)},onerror(e){jw.on("error",e)},on(e,t){const n=Tw[e];n&&document.addEventListener(n,t,!1)},off(e,t){const n=Tw[e];n&&document.removeEventListener(n,t,!1)},raw:zw};Object.defineProperties(jw,{isFullscreen:{get:()=>Boolean(document[zw.fullscreenElement])},element:{enumerable:!0,get:()=>document[zw.fullscreenElement]??void 0},isEnabled:{enumerable:!0,get:()=>Boolean(document[zw.fullscreenEnabled])}}),zw||(jw={isEnabled:!1});var Ow=jw;class Dw{constructor(e){this._fullscreenHandler=()=>{this._api.getExpandManager().setExpanded(!1),this._setConditionState(),this._api.getCardElementManager().update()},this._api=e}initialize(){this._setConditionState()}connect(){Ow.isEnabled&&Ow.on("change",this._fullscreenHandler)}disconnect(){Ow.isEnabled&&Ow.off("change",this._fullscreenHandler)}isInFullscreen(){return Ow.isEnabled&&Ow.isFullscreen}toggleFullscreen(){Ow.toggle(this._api.getCardElementManager().getElement())}stopFullscreen(){Ow.exit()}_setConditionState(){this._api.getConditionsManager()?.setState({fullscreen:this.isInFullscreen()})}}class Rw{constructor(){this._watcherCallbacks=new Map}setHASS(e,t){if(e)for(const[n,a]of this._watcherCallbacks.entries()){const i=zb(t,e,a,{stateOnly:!0,firstOnly:!0});i.length&&n(i[0])}}subscribe(e,t){return!!t.length&&(this._watcherCallbacks.has(e)?this._watcherCallbacks.get(e)?.push(...t):this._watcherCallbacks.set(e,t),!0)}unsubscribe(e){this._watcherCallbacks.delete(e)}}class Pw{constructor(e){this._hass=null,this._stateWatcher=new Rw,this._api=e}getHASS(){return this._hass}hasHASS(){return!!this._hass}getStateWatcher(){return this._stateWatcher}setHASS(e){if(((e,t)=>e?.connected!==t?.connected)(this._hass,e)&&(e?.connected?this._api.getMessageManager().resetType("connection"):this._api.getMessageManager().setMessageIfHigherPriority({message:N_("error.reconnecting"),icon:"mdi:lan-disconnect",type:"connection",dotdotdot:!0})),!e)return;const t=this._hass;this._hass=e,this._api.getConditionsManager().hasHAStateConditions()&&this._api.getConditionsManager().setState({state:this._hass.states,user:this._hass.user}),this._api.getStyleManager().setLightOrDarkMode(),this._stateWatcher.setHASS(t,e)}}var Lw=function(){return Ju.Date.now()},Nw="Expected a function",Fw=Math.max,Vw=Math.min;function Hw(e,t,n){var a,i,r,o,s,c,l=0,d=!1,u=!1,h=!0;if("function"!=typeof e)throw new TypeError(Nw);function p(t){var n=a,r=i;return a=i=void 0,l=t,o=e.apply(r,n)}function m(e){var n=e-c;return void 0===c||n>=t||n<0||u&&e-l>=r}function g(){var e=Lw();if(m(e))return f(e);s=setTimeout(g,function(e){var n=t-(e-c);return u?Vw(n,r-(e-l)):n}(e))}function f(e){return s=void 0,h&&a?p(e):(a=i=void 0,o)}function _(){var e=Lw(),n=m(e);if(a=arguments,i=this,c=e,n){if(void 0===s)return function(e){return l=e,s=setTimeout(g,t),d?p(e):o}(c);if(u)return clearTimeout(s),s=setTimeout(g,t),p(c)}return void 0===s&&(s=setTimeout(g,t)),o}return t=wg(t)||0,dh(n)&&(d=!!n.leading,r=(u="maxWait"in n)?Fw(wg(n.maxWait)||0,t):r,h="trailing"in n?!!n.trailing:h),_.cancel=function(){void 0!==s&&clearTimeout(s),l=0,a=c=i=s=void 0},_.flush=function(){return void 0===s?o:f(Lw())},_}function Bw(e,t,n){var a=!0,i=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return dh(n)&&(a="leading"in n?!!n.leading:a,i="trailing"in n?!!n.trailing:i),Hw(e,t,{leading:a,maxWait:t,trailing:i})}class qw{constructor(e){this._timer=new bf,this.reportInteraction=Bw((()=>{this._reportInteraction()}),1e3),this._api=e}initialize(){this._api.getConditionsManager().setState({interaction:!1})}hasInteraction(){return this._timer.isRunning()}_reportInteraction(){this._timer.stop();const e=this._api.getConfigManager().getConfig()?.view.interaction_seconds;e&&(this._api.getConditionsManager().setState({interaction:!0}),this._timer.start(e,(()=>{this._api.getConditionsManager().setState({interaction:!1}),this._api.getStyleManager().setLightOrDarkMode()})))}}class Uw{constructor(e){this._state={},this._handleKeydown=e=>{const t={state:"down",ctrl:e.ctrlKey,alt:e.altKey,meta:e.metaKey,shift:e.shiftKey};jy(this._state[e.key],t)||(this._state[e.key]=t,this._processStateChange())},this._handleKeyup=e=>{e.key in this._state&&"down"===this._state[e.key].state&&(this._state[e.key].state="up",this._processStateChange())},this._handleBlur=()=>{Object.keys(this._state).length&&(this._state={},this._processStateChange())},this._api=e}initialize(){const e=this._api.getCardElementManager().getElement();e.addEventListener("keydown",this._handleKeydown),e.addEventListener("keyup",this._handleKeyup),e.addEventListener("blur",this._handleBlur)}uninitialize(){const e=this._api.getCardElementManager().getElement();e.removeEventListener("keydown",this._handleKeydown),e.removeEventListener("keyup",this._handleKeyup),e.removeEventListener("blur",this._handleBlur)}_processStateChange(){this._api.getConditionsManager().setState({keys:this._state})}}function Ww(e,t){let n;return n=e instanceof Event?e.composedPath()[0]:e,n instanceof HTMLImageElement?{width:n.naturalWidth,height:n.naturalHeight,...t}:n instanceof HTMLVideoElement?{width:n.videoWidth,height:n.videoHeight,...t}:n instanceof HTMLCanvasElement?{width:n.width,height:n.height,player:t?.player,...t}:null}function Zw(e,t,n){const a=Ww(t,n);a&&Qw(e,a)}function Qw(e,t){Vg(e,"media:loaded",t)}function Gw(e){Vg(e,"media:unloaded")}function Yw(e){Vg(e,"media:volumechange")}function Kw(e){Vg(e,"media:play")}function Xw(e){Vg(e,"media:pause")}class Jw{constructor(e){this._current=null,this._lastKnown=null,this._api=e}initialize(){this.clear()}set(e){var t;(t=e).height>=50&&t.width>=50&&(V_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card media load: ",e),this._current=e,this._lastKnown=e,this._api.getConditionsManager().setState({media_loaded:!0}),this._api.getStyleManager().setExpandedMode(),this._api.getCardElementManager().update())}get(){return this._current}getLastKnown(){return this._lastKnown}clear(){this._current=null,this._api.getConditionsManager().setState({media_loaded:!1})}has(){return!!this._current}}class ex{static isEvent(e){return this.isClip(e)||this.isSnapshot(e)}static isRecording(e){return"recording"===e.getMediaType()}static isClip(e){return"clip"===e.getMediaType()}static isSnapshot(e){return"snapshot"===e.getMediaType()}static isVideo(e){return this.isClip(e)||this.isRecording(e)}}class tx{constructor(e){this._mediaPlayers=[],this._api=e}getMediaPlayers(){return this._mediaPlayers}hasMediaPlayers(){return this._mediaPlayers.length>0}async initializeIfNecessary(e){e?.menu.buttons.media_player.enabled!==this._api.getConfigManager().getConfig()?.menu.buttons.media_player.enabled&&await this.initialize()}async initialize(){const e=this._api.getHASSManager().getHASS();if(!e||!this._api.getConfigManager().getConfig()?.menu.buttons.media_player.enabled)return!1;const t=Object.keys(e.states).filter((t=>{if(t.startsWith("media_player.")){const n=e.states[t];if(n&&"unavailable"!==n.state&&_b(n,131072))return!0}return!1}));let n=null;try{n=await this._api.getEntityRegistryManager().getEntities(e,t)}catch(e){Zg(e)}return this._mediaPlayers=t.filter((e=>{const t=n?.get(e);return!t||!t.hidden_by})),!0}async stop(e){const t=this._api.getHASSManager().getHASS(),n=t?.states[e];if(!n)return;let a;if(_b(n,4096))a="media_stop";else{if(!_b(n,256))return;a="turn_off"}await t.callService("media_player",a,{entity_id:e})}async playLive(e,t){const n=this._api.getCameraManager().getStore().getCameraConfig(t);n&&("dashboard"===n.cast?.method?await this._playLiveDashboard(e,n):await this._playLiveStandard(e,t,n))}async _playLiveStandard(e,t,n){const a=this._api.getHASSManager().getHASS(),i=n?.camera_entity??null;if(!a||!i)return;const r=this._api.getCameraManager().getCameraMetadata(t)?.title??null,o=a.states[i]?.attributes?.entity_picture??null;await a.callService("media_player","play_media",{entity_id:e,media_content_id:`media-source://camera/${i}`,media_content_type:"application/vnd.apple.mpegurl",extra:{...r&&{title:r},...o&&{thumb:o}}})}async _playLiveDashboard(e,t){const n=this._api.getHASSManager().getHASS();if(!n)return;const a=t.cast?.dashboard;a?.dashboard_path&&a?.view_path?await n.callService("cast","show_lovelace_view",{entity_id:e,dashboard_path:a.dashboard_path,view_path:a.view_path}):this._api.getMessageManager().setMessageIfHigherPriority({type:"error",icon:"mdi:cast",message:N_("error.no_dashboard_or_view")})}async playMedia(e,t){const n=this._api.getHASSManager().getHASS();if(!n||!t)return;const a=t.getTitle(),i=t.getThumbnail();await n.callService("media_player","play_media",{entity_id:e,media_content_id:t.getContentID(),media_content_type:ex.isVideo(t)?"video":"image",extra:{...a&&{title:a},...i&&{thumb:i}}})}}class nx{constructor(e){this._message=null,this._api=e}getMessage(){return this._message}hasMessage(){return!!this._message}hasErrorMessage(){return"error"===this._message?.type}reset(){const e=this.hasMessage();this._message=null,e&&this._api.getCardElementManager().update()}resetType(e){this._message?.type===e&&this.reset()}setErrorIfHigherPriority(e,t){e&&"object"==typeof e&&"message"in e&&(Zg(e),this.setMessageIfHigherPriority({message:t?`${t}: ${e.message}`:e.message,type:"error",...e instanceof $s&&{context:e.context}}))}setMessageIfHigherPriority(e){const t=this._message?As[this._message.type]:0,n=As[e.type];return!(this._message&&ne.stop())),this._stream=void 0,this._setConditionState(),this._api.getCardElementManager().update()}getStream(){return this._stream??void 0}mute(){const e=this.isMuted();this._mute=!0,this._setMute(),this._setConditionState(),e||this._callListeners("muted")}async unmute(){if(!this.isSupported())return;const e=!this.isMuted(),t=()=>{this._mute=!1,this._setMute()};this.isConnected()||this.isForbidden()?this.isConnected()&&t():(t(),await this.connect()),this._setConditionState(),e||this._callListeners("unmuted")}isConnected(){return!!this._stream}isForbidden(){return null===this._stream}isMuted(){return!this._stream||this._stream.getTracks().every((e=>!e.enabled))}addListener(e){this._listeners.push(e)}removeListener(e){this._listeners=this._listeners.filter((t=>t!==e))}_callListeners(e){this._listeners.forEach((t=>t(e)))}_setMute(){this._stream?.getTracks().forEach((e=>{e.enabled=!this._mute})),this._startTimer(),this._api.getCardElementManager().update()}_startTimer(){const e=this._api.getConfigManager().getConfig()?.live.microphone;if(e?.always_connected)return;const t=e?.disconnect_seconds??0;t&&this._timer.start(t,(()=>{this.disconnect()}))}_setConditionState(){this._api.getConditionsManager().setState({microphone:{muted:this.isMuted(),connected:this.isConnected()}})}}class ix{constructor(e){this._shouldRun=!0,this.requestExecution=()=>{this._shouldRun=!0,this._api.getCardElementManager().update()},this.executeIfNecessary=async()=>{this._shouldRun&&(this._shouldRun=!1,await this._executeViewRelated(this._calculateIntent()),await this._executeNonViewRelated(this._calculateIntent()))},this._isViewAction=e=>{switch(e.frigate_card_action){case"clip":case"clips":case"diagnostics":case"image":case"live":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":return!0}return!1},this._api=e}hasViewRelatedActionsToRun(){return!!this._calculateIntent().view&&this._shouldRun}async _executeViewRelated(e){e.view&&(e.view.default?await this._api.getViewManager().setViewDefaultWithNewQuery({params:{camera:e.view.camera},...e.view.substream&&{modifiers:[new rb(e.view.substream)]}}):await this._api.getViewManager().setViewByParametersWithNewQuery({params:{...e.view.view&&{view:e.view.view},...e.view.camera&&{camera:e.view.camera}},...e.view.substream&&{modifiers:[new rb(e.view.substream)]}}))}async _executeNonViewRelated(e){e.other&&await this._api.getActionsManager().executeActions(e.other)}_calculateIntent(){const e={};for(const t of this._getActions())this._isViewAction(t)?((e.view??={}).view=t.frigate_card_action,(e.view??={}).default=void 0):"default"===t.frigate_card_action?((e.view??={}).default=!0,(e.view??={}).view=void 0):"camera_select"===t.frigate_card_action?(e.view??={}).camera=t.camera:"live_substream_select"===t.frigate_card_action?(e.view??={}).substream=t.camera:(e.other??=[]).push(t);return e}_getActions(){const e=new URLSearchParams(window.location.search),t=[],n=new RegExp(/^frigate-card-action([.:](?\w+))?[.:](?\w+)/);for(const[a,i]of e.entries()){const e=a.match(n);if(!e||!e.groups)continue;const r=e.groups.cardID,o=e.groups.action;let s=null;switch(o){case"camera_select":case"live_substream_select":i&&(s=mf(o,i,{cardID:r}));break;case"camera_ui":case"clip":case"clips":case"default":case"diagnostics":case"download":case"expand":case"image":case"live":case"menu_toggle":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":s=pf(o,{cardID:r});break;default:console.warn(`Frigate card received unknown card action in query string: ${o}`)}s&&t.push(s)}return t}}class rx{constructor(e){this._items=[],this._dynamicItems=[],this._api=e}addDynamicStatusBarItem(e){this._dynamicItems.includes(e)||this._dynamicItems.push(e),this._api.getCardElementManager().update()}removeDynamicStatusBarItem(e){this._dynamicItems=this._dynamicItems.filter((t=>!jy(t,e))),this._api.getCardElementManager().update()}removeAllDynamicStatusBarItems(){this._dynamicItems=[],this._api.getCardElementManager().update()}calculateItems(e){const t=e?.view?e?.cameraManager?.getCameraMetadata(e?.view?.camera):null,n=t?.engineLogo??null,a=e?.view?.is("live")?t?.title??null:e?.view?.isViewerView()?e?.view.queryResults?.getSelectedResult()?.getTitle()??null:null,i=e?.mediaLoadedInfo?this._calculateResolution(e?.mediaLoadedInfo):null,r=e?.mediaLoadedInfo?.technology?.length?e?.mediaLoadedInfo.technology[0]:null;return[...a?[{type:"custom:frigate-card-status-bar-string",string:a,expand:!0,sufficient:!0,...e?.statusConfig?.items.title}]:[],...i?[{type:"custom:frigate-card-status-bar-string",string:i,...e?.statusConfig?.items.resolution}]:[],...r&&"webrtc"===r?[{type:"custom:frigate-card-status-bar-icon",icon:"mdi:webrtc",...e?.statusConfig?.items.technology}]:r?[{type:"custom:frigate-card-status-bar-string",string:r.toUpperCase(),...e?.statusConfig?.items.technology}]:[],...n?[{type:"custom:frigate-card-status-bar-image",image:n,...e?.statusConfig?.items.engine}]:[],...this._dynamicItems]}_matchesWidthHeight(e,t,n){const a=.99*t,i=1.01*t,r=.99*n,o=1.01*n,s=(e,t,n)=>e>=t&&e<=n;return!!e&&(s(e.width,a,i)&&s(e.height,r,o)||s(e.height,a,i)&&s(e.width,r,o))}_calculateResolution(e){return this._matchesWidthHeight(e,1920,1080)?"1080p":this._matchesWidthHeight(e,1280,720)?"720p":this._matchesWidthHeight(e,640,480)?"VGA":this._matchesWidthHeight(e,3840,2160)?"4K":this._matchesWidthHeight(e,720,480)?"480p":this._matchesWidthHeight(e,720,576)?"576p":this._matchesWidthHeight(e,7680,4320)?"8K":`${e.width}x${e.height}`}}class ox{constructor(e){this.setLightOrDarkMode=()=>{const e=this._api.getConfigManager().getConfig(),t="on"===e?.view.dark_mode||"auto"===e?.view.dark_mode&&(!this._api.getInteractionManager().hasInteraction()||!!this._api.getHASSManager().getHASS()?.themes.darkMode);af(this._api.getCardElementManager().getElement(),t,"dark")},this._api=e}setExpandedMode(){const e=this._api.getCardElementManager().getElement(),t=this._api.getViewManager().getView(),n=this._api.getMediaLoadedInfoManager().getLastKnown();e.style.setProperty("--frigate-card-expand-aspect-ratio",t?.isAnyMediaView()&&n?`${n.width} / ${n.height}`:"unset");const a=t?.isGrid();e.style.setProperty("--frigate-card-expand-width",!a&&t?.isAnyMediaView()?"none":"var(--frigate-card-expand-max-width)"),e.style.setProperty("--frigate-card-expand-height",!a&&t?.isAnyMediaView()?"none":"var(--frigate-card-expand-max-height)")}setMinMaxHeight(){const e=this._api.getConfigManager().getConfig();if(e){this._api.getCardElementManager().getElement().style.setProperty("--frigate-card-height",e.dimensions.height)}}setPerformance(){const e={box_shadow:"none",border_radius:"0px"},t=this._api.getCardElementManager().getElement(),n=this._api.getConfigManager().getCardWideConfig()?.performance,a=n?.style??{};for(const n of Object.keys(a)){const i=`--frigate-card-css-${n.replaceAll("_","-")}`;!1===a[n]?t.style.setProperty(i,e[n]):t.style.removeProperty(i)}}_isAspectRatioEnforced(e,t){const n=e.dimensions.aspect_ratio_mode;return!(this._api.getFullscreenManager().isInFullscreen()||this._api.getExpandManager().isExpanded()||"unconstrained"===n||"dynamic"===n&&(!t||t?.isAnyMediaView()||t?.is("timeline")||t?.is("diagnostics")))}getAspectRatioStyle(){const e=this._api.getConfigManager().getConfig(),t=this._api.getViewManager().getView();if(e){if(!this._isAspectRatioEnforced(e,t))return lf();const n=e.dimensions.aspect_ratio_mode,a=this._api.getMediaLoadedInfoManager().getLastKnown();return lf(a&&"dynamic"===n?{ratio:[a.width,a.height]}:{ratio:e.dimensions.aspect_ratio})}return lf({defaultStatic:!0})}}class sx{constructor(e){this._triggeredCameras=new Map,this._triggeredCameraTimers=new Map,this._throttledTriggerAction=Bw(this._triggerAction.bind(this),1e3,{trailing:!0}),this._api=e}getTriggeredCameraIDs(){return new Set(this._triggeredCameras.keys())}isTriggered(){return!!this._triggeredCameras.size}getMostRecentlyTriggeredCameraID(){const e=ky([...this._triggeredCameras.entries()],(e=>e[1].getTime()),"desc");return e.length?e[0][0]:null}async handleCameraEvent(e){const t=this._api.getConfigManager().getConfig()?.view.triggers,n=this._api.getViewManager().getView()?.camera;if(!t||!n)return;const a=this._api.getCameraManager().getStore().getAllDependentCameras(n);t.filter_selected_camera&&!a.has(e.cameraID)||("end"!==e.type?(this._triggeredCameras.set(e.cameraID,new Date),this._setConditionStateIfNecessary(),await this._throttledTriggerAction(e)):this._startUntriggerTimer(e.cameraID))}_hasAllowableInteractionStateForAction(){const e=this._api.getConfigManager().getConfig()?.view.triggers,t=this._api.getInteractionManager().hasInteraction();return!!e&&("all"===e.actions.interaction_mode||"active"===e.actions.interaction_mode&&t||"inactive"===e.actions.interaction_mode&&!t)}async _triggerAction(e){const t=this._api.getConfigManager().getConfig()?.view.triggers.actions.trigger,n=this._api.getConfigManager().getConfig()?.view.default;("high"!==e.fidelity||e.snapshot||e.clip||"live"===t||"default"===t&&"live"===n)&&(this._hasAllowableInteractionStateForAction()&&("update"===t?await this._api.getViewManager().setViewByParametersWithNewQuery({queryExecutorOptions:{useCache:!1}}):"live"===t?await this._api.getViewManager().setViewByParametersWithNewQuery({params:{view:"live",camera:e.cameraID}}):"default"===t?await this._api.getViewManager().setViewDefaultWithNewQuery({params:{camera:e.cameraID}}):"high"===e.fidelity&&"media"===t&&await this._api.getViewManager().setViewByParametersWithNewQuery({params:{view:e.clip?"clip":"snapshot",camera:e.cameraID}})),this._api.getCardElementManager().update())}_setConditionStateIfNecessary(){const e=new Set(this._triggeredCameras.keys()),t=e.size?e:void 0;jy(t,this._api.getConditionsManager().getState().triggered)||this._api.getConditionsManager().setState({triggered:t})}async _untriggerAction(e){const t=this._api.getConfigManager().getConfig()?.view.triggers.actions.untrigger;"default"===t&&this._hasAllowableInteractionStateForAction()&&await this._api.getViewManager().setViewDefaultWithNewQuery(),this._triggeredCameras.delete(e),this._deleteTimer(e),this._setConditionStateIfNecessary(),this._api.getCardElementManager().update()}_startUntriggerTimer(e){this._deleteTimer(e);const t=new bf;this._triggeredCameraTimers.set(e,t),t.start( +/* istanbul ignore next: the case of config being null here cannot be + reached, as there's no way to have the untrigger call happen without + a config. -- @preserve */ +this._api.getConfigManager().getConfig()?.view.triggers.untrigger_seconds??0,(async()=>{await this._untriggerAction(e)}))}_deleteTimer(e){this._triggeredCameraTimers.get(e)?.stop(),this._triggeredCameraTimers.delete(e)}}function cx(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Fg(e,void 0,t):[]}class lx{constructor(e){this._queries=null,e&&(this._queries=e)}clone(){return l_(this)}getQueries(){return this._queries}setQueries(e){return this._queries=e,this}getQueryCameraIDs(){if(!this._queries)return null;const e=new Set;return this._queries.forEach((t=>[...t.cameraIDs].forEach((t=>e.add(t))))),e}setQueryCameraIDs(e){if(!this._queries)return this;const t=[];return this._queries.forEach((n=>t.push({...n,cameraIDs:Ug(e)}))),this._queries=cx(t,jy),this}hasQueriesForCameraIDs(e){for(const t of e)if(!this._queries?.some((e=>e.cameraIDs.has(t))))return!1;return!0}}class dx extends lx{convertToClipsQueries(){for(const e of this._queries??[])delete e.hasSnapshot,e.hasClip=!0;return this}}class ux extends lx{}class hx{static areEventQueries(e){return e instanceof dx}static areRecordingQueries(e){return e instanceof ux}static areClipsQueries(e){return this.areEventQueries(e)&&!!e?.getQueries()?.every((e=>e.hasClip))}static areSnapshotQueries(e){return this.areEventQueries(e)&&!!e?.getQueries()?.every((e=>e.hasSnapshot))}static getQueriesType(e){return this.areEventQueries(e)?"event":this.areRecordingQueries(e)?"recording":null}static getMediaType(e){return this.areClipsQueries(e)?"clips":this.areSnapshotQueries(e)?"snapshots":this.areRecordingQueries(e)?"recordings":null}}const px=(e,t,n)=>{const a={anyCapabilities:["clips","snapshots","recordings"]};switch(t){case"image":case"diagnostics":return e.getStore().getCameraIDs();case"live":case"clip":case"clips":case"snapshot":case"snapshots":case"recording":case"recordings":const i="clip"===t?"clips":"snapshot"===t?"snapshots":"recording"===t?"recordings":t;return n?e.getStore().getAllDependentCameras(n,i):e.getStore().getCameraIDsWithCapability(i);case"timeline":return e.getStore().getCameraIDsWithCapability(a);case"media":return n?e.getStore().getAllDependentCameras(n,a):e.getStore().getCameraIDsWithCapability(a)}},mx=(e,t)=>Rv({},e,t);class gx{constructor(e){this.view=e.view,this.camera=e.camera,this.query=e.query??null,this.queryResults=e.queryResults??null,this.context=e.context??null,this.displayMode=e.displayMode??null}clone(){return new gx({view:this.view,camera:this.camera,query:this.query?.clone()??null,queryResults:this.queryResults?.clone()??null,context:this.context,displayMode:this.displayMode})}evolve(e){return new gx({view:void 0!==e.view?e.view:this.view,camera:void 0!==e.camera?e.camera:this.camera,query:void 0!==e.query?e.query:this.query?.clone()??null,queryResults:void 0!==e.queryResults?e.queryResults:this.queryResults?.clone()??null,context:void 0!==e.context?e.context:this.context,displayMode:void 0!==e.displayMode?e.displayMode:this.displayMode})}mergeInContext(e){return this.context=mx(this.context,e),this}removeContext(e){return this.context&&delete this.context[e],this}removeContextProperty(e,t){const n=this.context?.[e];return n&&delete n[t],this}is(e){return this.view==e}isGalleryView(){return["clips","snapshots","recordings"].includes(this.view)}isAnyMediaView(){return this.isViewerView()||this.is("live")||this.is("image")}isViewerView(){return["media","clip","snapshot","recording"].includes(this.view)}supportsMultipleDisplayModes(){return this.isViewerView()||this.is("live")}getDefaultMediaType(){return["clip","clips"].includes(this.view)?"clips":["snapshot","snapshots"].includes(this.view)?"snapshots":["recording","recordings"].includes(this.view)?"recordings":null}isGrid(){return"grid"===this.displayMode}}const fx=(e,t)=>{t?.forEach((t=>t.modify(e)))};class _x extends $s{}class yx extends $s{}class vx{constructor(e){this._api=e}getViewDefault(e){const t=this._api.getConfigManager().getConfig();if(!t)return null;let n=null;const a=e?.params?.view??t.view.default;if(e?.params?.camera)n=e.params.camera;else{const i=[...px(this._api.getCameraManager(),a)];if(!i.length)return null;if(e?.baseView?.camera&&t.view.default_cycle_camera){const t=i.indexOf(e.baseView.camera);n=i[t+1>=i.length?0:t+1]}else n=i[0]}return this.getViewByParameters({params:{...e?.params,view:a,camera:n},baseView:e?.baseView})}getViewByParameters(e){const t=this._api.getConfigManager().getConfig();if(!t)return null;let n=e?.params?.camera??e?.baseView?.camera??null,a=e?.params?.view??e?.baseView?.view??t.view.default;const i=this._api.getCameraManager().getStore().getCameraIDs();if(!n||!i.has(n)){n=px(this._api.getCameraManager(),a).keys().next().value??null}if(!n){const e=[...this._api.getCameraManager().getStore().getCameras()].reduce(((e,[t,n])=>{const a=n.getCapabilities()?.getRawCapabilities();return a&&(e[t]=a),e}),{});throw new _x(N_("error.no_supported_cameras"),{view:a,cameras_capabilities:e})}if(!this.isViewSupportedByCamera(n,a)){if(!e?.failSafe||!this.isViewSupportedByCamera(n,Ws)){const e=this._api.getCameraManager().getStore().getCamera(n)?.getCapabilities()?.getRawCapabilities();throw new yx(N_("error.no_supported_camera"),{view:a,camera:n,...e&&{camera_capabilities:e}})}a=Ws}const r=e?.params?.displayMode??e?.baseView?.displayMode??this._getDefaultDisplayModeForView(a,t),o={...e?.params,view:a,camera:n,displayMode:r},s=e?.baseView?e.baseView.evolve(o):new gx(o);return fx(s,e?.modifiers),s}isViewSupportedByCamera(e,t){return!!px(this._api.getCameraManager(),t,e).size}_getDefaultDisplayModeForView(e,t){let n=null;switch(e){case"media":case"clip":case"recording":case"snapshot":n=t.media_viewer.display?.mode??null;break;case"live":n=t.live.display?.mode??null}return n??"single"}}class bx{constructor(e,t){this._key=e,this._property=t}modify(e){e.removeContextProperty(this._key,this._property)}}class wx{constructor(e){this._query=e?.query,this._queryResults=e?.queryResults}modify(e){void 0!==this._query&&(e.query=this._query),void 0!==this._queryResults&&(e.queryResults=this._queryResults)}}const xx=(e,t,n)=>{let a;for(const[i,r]of e.entries()){const e=r.getStartTime(),o=r.getUsableEndTime();if(r.includesTime(t)&&e&&o){const t=o.getTime()-e.getTime();(!a||n&&a.cameraID!==n&&r.getCameraID()===n||t>a.duration&&(!n||a.cameraID!==n||r.getCameraID()===n))&&(a={index:i,duration:t,cameraID:r.getCameraID()})}}return a?a.index:null};class Cx{constructor(e){this._results=e?.results??[],this._selectedIndex=this._getInitialSelectedIndex(e)}_getInitialSelectedIndex(e){return null!=e?.selectedIndex?e.selectedIndex:e?.results&&e.results.length?e?.selectApproach&&"last"!==e?.selectApproach?0:e.results.length-1:null}clone(){return new Cx({results:this._results,selectedIndex:this._selectedIndex})}getResults(){return this._results}getSelectedIndex(){return this._selectedIndex}getResultsCount(){return this.getResults().length}hasResults(){return 0!==this.getResultsCount()}getResult(e){return void 0===e?null:this._results[e]}getSelectedResult(){const e=this.getSelectedIndex();return null!==e?this.getResult(e):null}hasSelectedResult(){return null!==this.getSelectedResult()}resetSelectedResult(){this._selectedIndex=null}selectIndex(e){(null===e||e>=0&&ee.getID()))),n=new Set(e._main.getResults()?.map((e=>e.getID())));return!(!t.size||!n.size||t.has(null)||n.has(null))&&((e,t)=>{for(const n of t)if(!e.has(n))return!1;return!0})(t,n)}getCameraIDs(){return new Set(this._cameras.keys())}getSlice(e){return e?this._cameras.get(e)??null:this._main}getResults(e){return this.getSlice(e)?.getResults()??null}getResultsCount(e){return this.getSlice(e)?.getResultsCount()??0}hasResults(e){return 0!==this.getSlice(e)?.getResultsCount()}getResult(e,t){return this.getSlice(t)?.getResult(e)??null}getSelectedIndex(e){return this.getSlice(e)?.getSelectedIndex()??null}getSelectedResult(e){return this.getSlice(e)?.getSelectedResult()??null}getMultipleSelectedResults(e){const t=[];if(!e||e.main){const e=this.getSelectedResult();e&&t.push(e)}const n=this._getCameraIDsFromCriteria(e);for(const e of n??[]){const n=this.getSelectedResult(e);n&&t.push(n)}return t}hasSelectedResult(e){return this.getSlice(e)?.hasSelectedResult()??!1}resetSelectedResult(e){return this.getSlice(e)?.resetSelectedResult(),this}getResultsTimestamp(){return this._resultsTimestamp}selectIndex(e,t){return this.getSlice(t)?.selectIndex(e),t||this.demoteMainSelectionToCameraSelection(),this}demoteMainSelectionToCameraSelection(){const e=this.getSelectedResult();if(e){const t=e.getCameraID();this.resetSelectedResult(t),this.selectResultIfFound((t=>t===e),{cameraID:t})}return this}promoteCameraSelectionToMainSelection(e){const t=this.getSelectedResult(e);return this.resetSelectedResult(),this.selectResultIfFound((e=>e===t)),this}_getCameraIDsFromCriteria(e){return e?.allCameras?this.getCameraIDs():e?.cameraID?new Set([e.cameraID]):null}selectResultIfFound(e,t){t&&!t?.main||(this._main.selectResultIfFound(e),this.demoteMainSelectionToCameraSelection());const n=this._getCameraIDsFromCriteria(t);for(const t of n??[])this.getSlice(t)?.selectResultIfFound(e);return this}selectBestResult(e,t){t&&!t.main||(this._main.selectBestResult(e),this.demoteMainSelectionToCameraSelection());const n=this._getCameraIDsFromCriteria(t);for(const t of n??[])this.getSlice(t)?.selectBestResult(e);return this}}class kx{constructor(e){this._api=e}async executeDefaultEventQuery(e){const t=e?.eventsMediaType&&"all"!==e?.eventsMediaType?e.eventsMediaType:{anyCapabilities:["clips","snapshots"]},n=this._api.getCameraManager(),a=e?.cameraID?n.getStore().getAllDependentCameras(e.cameraID,t):n.getStore().getCameraIDsWithCapability(t);if(!a.size)return null;const i=n.generateDefaultEventQueries(a,{limit:this._getChunkLimit(),..."clips"===e?.eventsMediaType&&{hasClip:!0},..."snapshots"===e?.eventsMediaType&&{hasSnapshot:!0}});if(!i)return null;const r=new dx(i),o=await this.execute(r,e?.executorOptions);return o?{query:r,queryResults:o}:null}async executeDefaultRecordingQuery(e){const t=this._api.getCameraManager(),n=e?.cameraID?t.getStore().getAllDependentCameras(e.cameraID,"recordings"):t.getStore().getCameraIDsWithCapability("recordings");if(!n.size)return null;const a=t.generateDefaultRecordingQueries(n,{limit:this._getChunkLimit()});if(!a)return null;const i=new ux(a),r=await this.execute(i,e?.executorOptions);return r?{query:i,queryResults:r}:null}async execute(e,t){const n=e.getQueries();if(!n)return null;const a=await this._api.getCameraManager().executeMediaQueries(n,{useCache:t?.useCache});if(!a)return null;const i=new Mx({results:a});return t?.rejectResults?.(i)?null:(t?.selectResult?.id?i.selectBestResult((e=>e.findIndex((e=>e.getID()===t.selectResult?.id)))):t?.selectResult?.func?i.selectResultIfFound(t.selectResult.func):t?.selectResult?.time&&i.selectBestResult((e=>xx(e,t.selectResult?.time?.time,t.selectResult?.time?.favorCameraID))),i)}_getChunkLimit(){const e=this._api.getConfigManager().getCardWideConfig();return e?.performance?.features.media_chunk_size??50}}class Sx{constructor(e,t){this._api=e,this._executor=t??new kx(e)}async getExistingQueryModifiers(e,t){return e.query?[new wx({queryResults:await this._executor.execute(e.query,t)})]:[]}async getNewQueryModifiers(e,t){return await this._executeNewQuery(e,{useCache:!1,...t})}async _executeNewQuery(e,t){const n=this._api.getConfigManager().getConfig();if(!n)return null;const a=e?.getDefaultMediaType(),i=[],r=async n=>{ +/* istanbul ignore if: this path cannot be reached -- @preserve */ +if(!n)return[];const a="recordings"===n?await this._executor.executeDefaultRecordingQuery({...!e.isGrid()&&{cameraID:e.camera},executorOptions:t}):"clips"===n||"snapshots"===n||"all"===n?await this._executor.executeDefaultEventQuery({...!e.isGrid()&&{cameraID:e.camera},eventsMediaType:n,executorOptions:t}):/* istanbul ignore next -- @preserve */ +null;return a?[new wx(a)]:[]};switch(e.view){case"live":"none"!==n.live.controls.thumbnails.mode&&i.push(...await r("recordings"===n.live.controls.thumbnails.media_type?"recordings":n.live.controls.thumbnails.events_media_type));break;case"media":i.push(...await r("clips"));break;case"clips":case"snapshots":case"recordings":i.push(...await r(a));break;case"clip":case"snapshot":case"recording":"none"!==n.media_viewer.controls.thumbnails.mode&&i.push(...await r(a))}return i.push(...this._getTimelineWindowViewModifier(e)),i.push(...this._getSeekTimeModifier(t?.selectResult?.time?.time)),i}_getTimelineWindowViewModifier(e){if(e.is("live")){const e=new Date,t=this._api.getConfigManager().getConfig()?.live; +/* istanbul ignore if: this if branch cannot be reached as if the config is + empty this function is never called -- @preserve */ +return t?[new Zv({timeline:{window:{start:Wu(e,{seconds:t.controls.timeline.window_seconds}),end:e}}})]:[]}return[new bx("timeline","window")]}_getSeekTimeModifier(e){return e?[new Zv({mediaViewer:{seek:e}})]:[new bx("mediaViewer","seek")]}}class Ex{constructor(e,t){this._view=null,this._epoch=this._createEpoch(),this._loadingIndex=1,this.setViewDefault=e=>this._setViewGeneric(this._viewFactory.getViewDefault.bind(this._viewFactory),e),this.setViewByParameters=e=>this._setViewGeneric(this._viewFactory.getViewByParameters.bind(this._viewFactory),e),this.setViewDefaultWithNewQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewDefault.bind(this._viewFactory),this._viewQueryExecutor.getNewQueryModifiers.bind(this._viewQueryExecutor),e),this.setViewByParametersWithNewQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewByParameters.bind(this._viewFactory),this._viewQueryExecutor.getNewQueryModifiers.bind(this._viewQueryExecutor),e),this.setViewByParametersWithExistingQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewByParameters.bind(this._viewFactory),this._viewQueryExecutor.getExistingQueryModifiers.bind(this._viewQueryExecutor),e),this.initialize=async()=>(this._api.getQueryStringManager().hasViewRelatedActionsToRun()||this.setViewDefaultWithNewQuery({failSafe:!0}),!0),this._api=e,this._viewFactory=t?.viewFactory??new vx(e),this._viewQueryExecutor=t?.viewQueryExecutor??new Sx(e)}getEpoch(){return this._epoch}_createEpoch(e){return{manager:this,...e&&{oldView:e}}}getView(){return this._view}hasView(){return!!this.getView()}reset(){this._view&&this._setView(null)}_setViewGeneric(e,t){let n=null;try{n=e({baseView:this._view,...t})}catch(e){this._api.getMessageManager().setErrorIfHigherPriority(e)}n&&this._setView(n)}_markViewLoadingQuery(e,t){return e.mergeInContext({loading:{query:t}})}_markViewAsNotLoadingQuery(e){return e.removeContextProperty("loading","query")}async _setViewThenModifyAsync(e,t,n){let a=null;try{a=e({baseView:this._view,...n,params:{query:null,queryResults:null,...n?.params}})}catch(e){this._api.getMessageManager().setErrorIfHigherPriority(e)}if(!a)return;if(this._view&&this._shouldAdoptQueryAndResults(a))return a.query=this._view.query,a.queryResults=this._view.queryResults,this._markViewAsNotLoadingQuery(a),void this._setView(a);const i=this._loadingIndex++;this._markViewLoadingQuery(a,i),this._setView(a);let r=null,o=null;try{r=await t(a,n?.queryExecutorOptions)}catch(e){o=e}if(this._view&&this.hasMajorMediaChange(this._view,a))return void(this._view.context?.loading?.query===i&&this._setView(this._markViewAsNotLoadingQuery(this._view.clone())));if(o)return void this._api.getMessageManager().setErrorIfHigherPriority(o); +/* istanbul ignore if: the if path cannot be reached as the view is set + above -- @preserve */if(!this._view)return;const s=this._view.clone();this._view.context?.loading?.query===i&&this._markViewAsNotLoadingQuery(s),fx(s,r),this._setView(s)}_shouldAdoptQueryAndResults(e){const t=this._view?.isViewerView()&&e?.isGalleryView(),n=e?.getDefaultMediaType(),a=hx.getMediaType(this._view?.query)===n;return!!t&&a}setViewWithMergedContext(e){if(this._view)return this._setView(this._view?.clone().mergeInContext(e))}isViewSupportedByCamera(e,t){return!!px(this._api.getCameraManager(),t,e).size}hasMajorMediaChange(e,t){const n=t??this._view;return!!e!=!!n||e?.view!==n?.view||e?.camera!==n?.camera||"live"===n?.view&&e&&xv(e)!==xv(n)||"live"!==n?.view&&e?.queryResults!==n?.queryResults}_setView(e){const t=this._view;V_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card view change: ",e),this._view=e,this._epoch=this._createEpoch(t),this.hasMajorMediaChange(t)&&this._api.getMediaLoadedInfoManager().clear(),t?.view!==e?.view&&this._api.getCardElementManager().scrollReset(),this._api.getMessageManager().reset(),this._api.getStyleManager().setExpandedMode(),this._api.getConditionsManager()?.setState({view:e?.view,camera:e?.camera,displayMode:e?.displayMode??void 0}),this._api.getCardElementManager().update()}}class $x{constructor(e,t,n,a){this._deviceRegistryManager=new iv(new nv((e=>e.id))),this._entityRegistryManager=new sv(new nv((e=>e.entity_id))),this._resolvedMediaCache=new lv,this._actionsManager=new pb(this),this._automationsManager=new mb(this),this._cameraManager=new tv(this),this._cameraURLManager=new gb(this),this._configManager=new Cw(this),this._defaultManager=new Mw(this),this._downloadManager=new $w(this),this._expandManager=new Aw(this),this._fullscreenManager=new Dw(this),this._hassManager=new Pw(this),this._initializationManager=new Wb(this),this._interactionManager=new qw(this),this._keyboardStateManager=new Uw(this),this._mediaLoadedInfoManager=new Jw(this),this._mediaPlayerManager=new tx(this),this._messageManager=new nx(this),this._microphoneManager=new ax(this),this._queryStringManager=new ix(this),this._statusBarItemManager=new rx(this),this._styleManager=new ox(this),this._triggersManager=new sx(this),this._viewManager=new Ex(this),e.addController(this),this._conditionsManager=new yw(this,a),this._cardElementManager=new Zb(this,e,t,n)}getActionsManager(){return this._actionsManager}getAutomationsManager(){return this._automationsManager}getCameraManager(){return this._cameraManager}getCameraURLManager(){return this._cameraURLManager}getCardElementManager(){return this._cardElementManager}getConditionsManager(){return this._conditionsManager}static async getConfigElement(){return await import("./editor-0c0425c2.js"),document.createElement("frigate-card-editor")}getConfigManager(){return this._configManager}getDefaultManager(){return this._defaultManager}getDeviceRegistryManager(){return this._deviceRegistryManager}getDownloadManager(){return this._downloadManager}getEntityRegistryManager(){return this._entityRegistryManager}getExpandManager(){return this._expandManager}getFullscreenManager(){return this._fullscreenManager}getHASSManager(){return this._hassManager}getInitializationManager(){return this._initializationManager}getInteractionManager(){return this._interactionManager}getKeyboardStateManager(){return this._keyboardStateManager}getMediaLoadedInfoManager(){return this._mediaLoadedInfoManager}getMediaPlayerManager(){return this._mediaPlayerManager}getMessageManager(){return this._messageManager}getMicrophoneManager(){return this._microphoneManager}getQueryStringManager(){return this._queryStringManager}getResolvedMediaCache(){return this._resolvedMediaCache}getStatusBarItemManager(){return this._statusBarItemManager}static getStubConfig(e){return{cameras:[{camera_entity:e.find((e=>e.startsWith("camera.")))??"camera.demo"}]}}getStyleManager(){return this._styleManager}getTriggersManager(){return this._triggersManager}getViewManager(){return this._viewManager}hostConnected(){this.getCardElementManager().elementConnected()}hostDisconnected(){this.getCardElementManager().elementDisconnected()}}class Ax{constructor(){this._dynamicMenuButtons=[]}addDynamicMenuButton(e){this._dynamicMenuButtons.includes(e)||this._dynamicMenuButtons.push(e)}removeDynamicMenuButton(e){this._dynamicMenuButtons=this._dynamicMenuButtons.filter((t=>t!=e))}calculateButtons(e,t,n,a){return[this._getDefaultButton(t),this._getCamerasButton(t,n,a?.view),this._getSubstreamsButton(t,n,a?.view),this._getLiveButton(t,a?.view,a?.viewManager),this._getClipsButton(t,a?.view,a?.viewManager),this._getSnapshotsButton(t,a?.view,a?.viewManager),this._getRecordingsButton(t,a?.view,a?.viewManager),this._getImageButton(t,a?.view,a?.viewManager),this._getTimelineButton(t,a?.view,a?.viewManager),this._getDownloadButton(t,n,a?.view),this._getCameraUIButton(t,a?.showCameraUIButton),this._getMicrophoneButton(t,a?.microphoneManager,a?.currentMediaLoadedInfo),this._getExpandButton(t,a?.inExpandedMode),this._getFullscreenButton(t,a?.inFullscreenMode),this._getCastButton(e,t,n,a?.view,a?.mediaPlayerController),this._getPlayPauseButton(t,a?.currentMediaLoadedInfo),this._getMuteUnmuteButton(t,a?.currentMediaLoadedInfo),this._getScreenshotButton(t,a?.currentMediaLoadedInfo),this._getDisplayModeButton(t,n,a?.view),this._getPTZControlsButton(t,n,a?.view),this._getPTZHomeButton(t,n,a?.view),...this._dynamicMenuButtons.map((e=>({style:this._getStyleFromActions(t,e,a),...e})))].filter(rf)}_getDefaultButton(e){return{icon:"frigate",...e.menu.buttons.frigate,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.frigate"),permanent:!0,tap_action:"hidden"===e.menu?.style?pf("menu_toggle"):pf("default"),hold_action:pf("diagnostics")}}_getCamerasButton(e,t,n){const a=t.getStore().getCameraIDsWithCapability("menu");if(a.size>1){const i=Array.from(t.getStore().getCameraConfigEntries(a),(([e,a])=>{const i=mf("camera_select",e),r=t.getCameraMetadata(e);return{enabled:!0,icon:r?.icon,entity:a.camera_entity,state_color:!0,title:r?.title,selected:n?.camera===e,...i&&{tap_action:i}}}));return{icon:"mdi:video-switch",...e.menu.buttons.cameras,type:"custom:frigate-card-menu-submenu",title:N_("config.menu.buttons.cameras"),items:i}}return null}_getSubstreamsButton(e,t,n){if(!n)return null;const a=t.getStore().getAllDependentCameras(n.camera,"substream");if(a.size&&n.is("live")){const i=[...a].filter((e=>e!==n.camera)),r=[n.camera,...i],o=xv(n);if(2===r.length)return{icon:"mdi:video-input-component",style:o!==n.camera?this._getEmphasizedStyle():{},title:N_("config.menu.buttons.substreams"),...e.menu.buttons.substreams,type:"custom:frigate-card-menu-icon",tap_action:pf(Cv(n)?"live_substream_off":"live_substream_on")};if(r.length>2){const a=Array.from(r,(e=>{const n=mf("live_substream_select",e),a=t.getCameraMetadata(e)??void 0,i=t.getStore().getCameraConfig(e);return{enabled:!0,icon:a?.icon,entity:i?.camera_entity,state_color:!0,title:a?.title,selected:o===e,...n&&{tap_action:n}}}));return{icon:"mdi:video-input-component",title:N_("config.menu.buttons.substreams"),style:o!==n.camera?this._getEmphasizedStyle():{},...e.menu.buttons.substreams,type:"custom:frigate-card-menu-submenu",items:a}}}return null}_getLiveButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"live")?{icon:"mdi:cctv",...e.menu.buttons.live,type:"custom:frigate-card-menu-icon",title:N_("config.view.views.live"),style:t.is("live")?this._getEmphasizedStyle():{},tap_action:pf("live")}:null}_getClipsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"clips")?{icon:"mdi:filmstrip",...e.menu.buttons.clips,type:"custom:frigate-card-menu-icon",title:N_("config.view.views.clips"),style:t?.is("clips")?this._getEmphasizedStyle():{},tap_action:pf("clips"),hold_action:pf("clip")}:null}_getSnapshotsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"snapshots")?{icon:"mdi:camera",...e.menu.buttons.snapshots,type:"custom:frigate-card-menu-icon",title:N_("config.view.views.snapshots"),style:t?.is("snapshots")?this._getEmphasizedStyle():{},tap_action:pf("snapshots"),hold_action:pf("snapshot")}:null}_getRecordingsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"recordings")?{icon:"mdi:album",...e.menu.buttons.recordings,type:"custom:frigate-card-menu-icon",title:N_("config.view.views.recordings"),style:t.is("recordings")?this._getEmphasizedStyle():{},tap_action:pf("recordings"),hold_action:pf("recording")}:null}_getImageButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"image")?{icon:"mdi:image",...e.menu.buttons.image,type:"custom:frigate-card-menu-icon",title:N_("config.view.views.image"),style:t?.is("image")?this._getEmphasizedStyle():{},tap_action:pf("image")}:null}_getTimelineButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"timeline")?{icon:"mdi:chart-gantt",...e.menu.buttons.timeline,type:"custom:frigate-card-menu-icon",title:N_("config.view.views.timeline"),style:t.is("timeline")?this._getEmphasizedStyle():{},tap_action:pf("timeline")}:null}_getDownloadButton(e,t,n){const a=n?.queryResults?.getSelectedResult(),i=a?t?.getMediaCapabilities(a):null;return n?.isViewerView()&&i?.canDownload&&!fb()?{icon:"mdi:download",...e.menu.buttons.download,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.download"),tap_action:pf("download")}:null}_getCameraUIButton(e,t){return t?{icon:"mdi:web",...e.menu.buttons.camera_ui,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.camera_ui"),tap_action:pf("camera_ui")}:null}_getMicrophoneButton(e,t,n){if(t&&n?.capabilities?.supports2WayAudio){const n=t.isForbidden()||!t.isSupported(),a=t.isMuted(),i=e.menu.buttons.microphone.type;return{icon:n?"mdi:microphone-message-off":a?"mdi:microphone-off":"mdi:microphone",...e.menu.buttons.microphone,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.microphone"),style:n||a?{}:this._getEmphasizedStyle(!0),...!n&&"momentary"===i&&{start_tap_action:pf("microphone_unmute"),end_tap_action:pf("microphone_mute")},...!n&&"toggle"===i&&{tap_action:pf(a?"microphone_unmute":"microphone_mute")}}}return null}_getExpandButton(e,t){return{icon:t?"mdi:arrow-collapse-all":"mdi:arrow-expand-all",...e.menu.buttons.expand,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.expand"),tap_action:pf("expand"),style:t?this._getEmphasizedStyle():{}}}_getFullscreenButton(e,t){return fb()?null:{icon:t?"mdi:fullscreen-exit":"mdi:fullscreen",...e.menu.buttons.fullscreen,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.fullscreen"),tap_action:pf("fullscreen"),style:t?this._getEmphasizedStyle():{}}}_getCastButton(e,t,n,a,i){if(!a)return null;const r=n.getStore().getCameraConfig(a.camera);if(i?.hasMediaPlayers()&&(a.isViewerView()||a.is("live")&&r?.camera_entity)){const n=i.getMediaPlayers().map((t=>{const n=Pb(e,t)||t,a=e.states[t],i=gf(t,"play"),r=gf(t,"stop"),o=!a||"unavailable"===a.state;return{enabled:!0,selected:!1,icon:Lb(e,t),entity:t,state_color:!1,title:n,disabled:o,...!o&&i&&{tap_action:i},...!o&&r&&{hold_action:r}}}));return{icon:"mdi:cast",...t.menu.buttons.media_player,type:"custom:frigate-card-menu-submenu",title:N_("config.menu.buttons.media_player"),items:n}}return null}_getPlayPauseButton(e,t){if(t&&t.player&&t.capabilities?.supportsPause){const n=t.player.isPaused();return{icon:n?"mdi:play":"mdi:pause",...e.menu.buttons.play,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.play"),tap_action:pf(n?"play":"pause")}}return null}_getMuteUnmuteButton(e,t){if(t&&t.player&&t?.capabilities?.hasAudio){const n=t.player.isMuted();return{icon:n?"mdi:volume-off":"mdi:volume-high",...e.menu.buttons.mute,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.mute"),tap_action:pf(n?"unmute":"mute")}}return null}_getScreenshotButton(e,t){return t&&t.player?{icon:"mdi:monitor-screenshot",...e.menu.buttons.screenshot,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.screenshot"),tap_action:pf("screenshot")}:null}_getDisplayModeButton(e,t,n){const a=n?px(t,n.view):null;if(n?.supportsMultipleDisplayModes()&&a&&a.size>1){const t=n.isGrid();return{icon:t?"mdi:grid-off":"mdi:grid",...e.menu.buttons.display_mode,style:t?this._getEmphasizedStyle():{},type:"custom:frigate-card-menu-icon",title:N_(t?"display_modes.single":"display_modes.grid"),tap_action:(i=t?"single":"grid",{action:"fire-dom-event",frigate_card_action:"display_mode_select",display_mode:i,...r?.cardID&&{card_id:r.cardID}})}}var i,r;return null}_getPTZControlsButton(e,t,n){const a=n?.is("live")?e.live.controls.ptz:n?.isViewerView()?e.media_viewer.controls.ptz:null;if(!n||!a||"off"===a.mode)return null;const i=Ov(n,{cameraManager:t,..."auto"===a.mode&&{type:"ptz"}});if(i){const t=!1!==n.context?.ptzControls?.enabled&&("on"===a.mode||"auto"===a.mode&&"ptz"===i.type);return{icon:"mdi:pan",...e.menu.buttons.ptz_controls,style:t?this._getEmphasizedStyle():{},type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.ptz_controls"),tap_action:(r=!t,{action:"fire-dom-event",frigate_card_action:"ptz_controls",enabled:r,...o?.cardID&&{card_id:o.cardID}})}}var r,o;return null}_getPTZHomeButton(e,t,n){const a=n?Ov(n,{cameraManager:t}):null;return!a||(("digital"===a.type&&n?.context?.zoom?.[a.targetID]?.observed?.isDefault)??1)?null:{icon:"mdi:home",...e.menu.buttons.ptz_home,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.ptz_home"),tap_action:ff({targetID:a.targetID})}}_getEmphasizedStyle(e){return e?{animation:"pulse 3s infinite",color:"var(--error-color, white)"}:{color:"var(--primary-color, white)"}}_getStyleFromActions(e,t,n){for(const a of[t.tap_action,t.double_tap_action,t.hold_action,t.start_tap_action,t.end_tap_action]){const t=Array.isArray(a)?a:[a];for(const a of t){if(!a||"fire-dom-event"!==a.action||!("frigate_card_action"in a))continue;const t=a;if(Us.some((e=>e===t.frigate_card_action&&n?.view?.is(t.frigate_card_action)))||"default"===t.frigate_card_action&&n?.view?.is(e.view.default)||"fullscreen"===t.frigate_card_action&&n?.inFullscreenMode||"camera_select"===t.frigate_card_action&&n?.view?.camera===t.camera)return this._getEmphasizedStyle()}}return{}}} +/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */ +function Ix(e){return null==e}var zx=function(e,t){var n,a="";for(n=0;ns&&(t=a-s+(r=" ... ").length),n-a>s&&(n=a+s-(o=" ...").length),{str:r+e.slice(t,n).replace(/\t/g,"→")+o,pos:a-t+r.length}}function Px(e,t){return Tx.repeat(" ",t-e.length)+e}var Lx=function(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),"number"!=typeof t.indent&&(t.indent=1),"number"!=typeof t.linesBefore&&(t.linesBefore=3),"number"!=typeof t.linesAfter&&(t.linesAfter=2);for(var n,a=/\r?\n|\r|\0/g,i=[0],r=[],o=-1;n=a.exec(e.buffer);)r.push(n.index),i.push(n.index+n[0].length),e.position<=n.index&&o<0&&(o=i.length-2);o<0&&(o=i.length-1);var s,c,l="",d=Math.min(e.line+t.linesAfter,r.length).toString().length,u=t.maxLength-(t.indent+d+3);for(s=1;s<=t.linesBefore&&!(o-s<0);s++)c=Rx(e.buffer,i[o-s],r[o-s],e.position-(i[o]-i[o-s]),u),l=Tx.repeat(" ",t.indent)+Px((e.line-s+1).toString(),d)+" | "+c.str+"\n"+l;for(c=Rx(e.buffer,i[o],r[o],e.position,u),l+=Tx.repeat(" ",t.indent)+Px((e.line+1).toString(),d)+" | "+c.str+"\n",l+=Tx.repeat("-",t.indent+d+3+c.pos)+"^\n",s=1;s<=t.linesAfter&&!(o+s>=r.length);s++)c=Rx(e.buffer,i[o+s],r[o+s],e.position-(i[o]-i[o+s]),u),l+=Tx.repeat(" ",t.indent)+Px((e.line+s+1).toString(),d)+" | "+c.str+"\n";return l.replace(/\n$/,"")},Nx=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],Fx=["scalar","sequence","mapping"];var Vx=function(e,t){if(t=t||{},Object.keys(t).forEach((function(t){if(-1===Nx.indexOf(t))throw new Dx('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')})),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=function(e){var t={};return null!==e&&Object.keys(e).forEach((function(n){e[n].forEach((function(e){t[String(e)]=n}))})),t}(t.styleAliases||null),-1===Fx.indexOf(this.kind))throw new Dx('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')};function Hx(e,t){var n=[];return e[t].forEach((function(e){var t=n.length;n.forEach((function(n,a){n.tag===e.tag&&n.kind===e.kind&&n.multi===e.multi&&(t=a)})),n[t]=e})),n}function Bx(e){return this.extend(e)}Bx.prototype.extend=function(e){var t=[],n=[];if(e instanceof Vx)n.push(e);else if(Array.isArray(e))n=n.concat(e);else{if(!e||!Array.isArray(e.implicit)&&!Array.isArray(e.explicit))throw new Dx("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit))}t.forEach((function(e){if(!(e instanceof Vx))throw new Dx("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(e.loadKind&&"scalar"!==e.loadKind)throw new Dx("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(e.multi)throw new Dx("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")})),n.forEach((function(e){if(!(e instanceof Vx))throw new Dx("Specified list of YAML types (or a single Type object) contains a non-Type object.")}));var a=Object.create(Bx.prototype);return a.implicit=(this.implicit||[]).concat(t),a.explicit=(this.explicit||[]).concat(n),a.compiledImplicit=Hx(a,"implicit"),a.compiledExplicit=Hx(a,"explicit"),a.compiledTypeMap=function(){var e,t,n={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function a(e){e.multi?(n.multi[e.kind].push(e),n.multi.fallback.push(e)):n[e.kind][e.tag]=n.fallback[e.tag]=e}for(e=0,t=arguments.length;e=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),tC=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var nC=/^[-+]?[0-9]+e/;var aC=new Vx("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!tC.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||Tx.isNegativeZero(e))},represent:function(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(Tx.isNegativeZero(e))return"-0.0";return n=e.toString(10),nC.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"}),iC=Qx.extend({implicit:[Gx,Yx,eC,aC]}),rC=iC,oC=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),sC=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");var cC=new Vx("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==oC.exec(e)||null!==sC.exec(e))},construct:function(e){var t,n,a,i,r,o,s,c,l=0,d=null;if(null===(t=oC.exec(e))&&(t=sC.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],a=+t[2]-1,i=+t[3],!t[4])return new Date(Date.UTC(n,a,i));if(r=+t[4],o=+t[5],s=+t[6],t[7]){for(l=t[7].slice(0,3);l.length<3;)l+="0";l=+l}return t[9]&&(d=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(d=-d)),c=new Date(Date.UTC(n,a,i,r,o,s,l)),d&&c.setTime(c.getTime()-d),c},instanceOf:Date,represent:function(e){return e.toISOString()}});var lC=new Vx("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}}),dC="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";var uC=new Vx("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,a=0,i=e.length,r=dC;for(n=0;n64)){if(t<0)return!1;a+=6}return a%8==0},construct:function(e){var t,n,a=e.replace(/[\r\n=]/g,""),i=a.length,r=dC,o=0,s=[];for(t=0;t>16&255),s.push(o>>8&255),s.push(255&o)),o=o<<6|r.indexOf(a.charAt(t));return 0===(n=i%4*6)?(s.push(o>>16&255),s.push(o>>8&255),s.push(255&o)):18===n?(s.push(o>>10&255),s.push(o>>2&255)):12===n&&s.push(o>>4&255),new Uint8Array(s)},predicate:function(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)},represent:function(e){var t,n,a="",i=0,r=e.length,o=dC;for(t=0;t>18&63],a+=o[i>>12&63],a+=o[i>>6&63],a+=o[63&i]),i=(i<<8)+e[t];return 0===(n=r%3)?(a+=o[i>>18&63],a+=o[i>>12&63],a+=o[i>>6&63],a+=o[63&i]):2===n?(a+=o[i>>10&63],a+=o[i>>4&63],a+=o[i<<2&63],a+=o[64]):1===n&&(a+=o[i>>2&63],a+=o[i<<4&63],a+=o[64],a+=o[64]),a}}),hC=Object.prototype.hasOwnProperty,pC=Object.prototype.toString;var mC=new Vx("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,a,i,r,o=[],s=e;for(t=0,n=s.length;t>10),56320+(e-65536&1023))}for(var BC=new Array(256),qC=new Array(256),UC=0;UC<256;UC++)BC[UC]=VC(UC)?1:0,qC[UC]=VC(UC);function WC(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||vC,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function ZC(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=Lx(n),new Dx(t,n)}function QC(e,t){throw ZC(e,t)}function GC(e,t){e.onWarning&&e.onWarning.call(null,ZC(e,t))}var YC={YAML:function(e,t,n){var a,i,r;null!==e.version&&QC(e,"duplication of %YAML directive"),1!==n.length&&QC(e,"YAML directive accepts exactly one argument"),null===(a=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&QC(e,"ill-formed argument of the YAML directive"),i=parseInt(a[1],10),r=parseInt(a[2],10),1!==i&&QC(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=r<2,1!==r&&2!==r&&GC(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var a,i;2!==n.length&&QC(e,"TAG directive accepts exactly two arguments"),a=n[0],i=n[1],zC.test(a)||QC(e,"ill-formed tag handle (first argument) of the TAG directive"),bC.call(e.tagMap,a)&&QC(e,'there is a previously declared suffix for "'+a+'" tag handle'),TC.test(i)||QC(e,"ill-formed tag prefix (second argument) of the TAG directive");try{i=decodeURIComponent(i)}catch(t){QC(e,"tag prefix is malformed: "+i)}e.tagMap[a]=i}};function KC(e,t,n,a){var i,r,o,s;if(t1&&(e.result+=Tx.repeat("\n",t-1))}function iM(e,t){var n,a,i=e.tag,r=e.anchor,o=[],s=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=o),a=e.input.charCodeAt(e.position);0!==a&&(-1!==e.firstTabInLine&&(e.position=e.firstTabInLine,QC(e,"tab characters must not be used in indentation")),45===a)&&RC(e.input.charCodeAt(e.position+1));)if(s=!0,e.position++,tM(e,!0,-1)&&e.lineIndent<=t)o.push(null),a=e.input.charCodeAt(e.position);else if(n=e.line,sM(e,t,CC,!1,!0),o.push(e.result),tM(e,!0,-1),a=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==a)QC(e,"bad indentation of a sequence entry");else if(e.lineIndentt?m=1:e.lineIndent===t?m=0:e.lineIndentt?m=1:e.lineIndent===t?m=0:e.lineIndentt)&&(_&&(o=e.line,s=e.lineStart,c=e.position),sM(e,t,MC,!0,i)&&(_?g=e.result:f=e.result),_||(JC(e,h,p,m,g,f,o,s,c),m=g=f=null),tM(e,!0,-1),l=e.input.charCodeAt(e.position)),(e.line===r||e.lineIndent>t)&&0!==l)QC(e,"bad indentation of a mapping entry");else if(e.lineIndent=0))break;0===i?QC(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):c?QC(e,"repeat of an indentation width identifier"):(l=t+i-1,c=!0)}if(DC(r)){do{r=e.input.charCodeAt(++e.position)}while(DC(r));if(35===r)do{r=e.input.charCodeAt(++e.position)}while(!OC(r)&&0!==r)}for(;0!==r;){for(eM(e),e.lineIndent=0,r=e.input.charCodeAt(e.position);(!c||e.lineIndentl&&(l=e.lineIndent),OC(r))d++;else{if(e.lineIndent0){for(i=o,r=0;i>0;i--)(o=LC(s=e.input.charCodeAt(++e.position)))>=0?r=(r<<4)+o:QC(e,"expected hexadecimal character");e.result+=HC(r),e.position++}else QC(e,"unknown escape sequence");n=a=e.position}else OC(s)?(KC(e,n,a,!0),aM(e,tM(e,!1,t)),n=a=e.position):e.position===e.lineStart&&nM(e)?QC(e,"unexpected end of the document within a double quoted scalar"):(e.position++,a=e.position)}QC(e,"unexpected end of the stream within a double quoted scalar")}(e,h)?f=!0:!function(e){var t,n,a;if(42!==(a=e.input.charCodeAt(e.position)))return!1;for(a=e.input.charCodeAt(++e.position),t=e.position;0!==a&&!RC(a)&&!PC(a);)a=e.input.charCodeAt(++e.position);return e.position===t&&QC(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),bC.call(e.anchorMap,n)||QC(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],tM(e,!0,-1),!0}(e)?function(e,t,n){var a,i,r,o,s,c,l,d,u=e.kind,h=e.result;if(RC(d=e.input.charCodeAt(e.position))||PC(d)||35===d||38===d||42===d||33===d||124===d||62===d||39===d||34===d||37===d||64===d||96===d)return!1;if((63===d||45===d)&&(RC(a=e.input.charCodeAt(e.position+1))||n&&PC(a)))return!1;for(e.kind="scalar",e.result="",i=r=e.position,o=!1;0!==d;){if(58===d){if(RC(a=e.input.charCodeAt(e.position+1))||n&&PC(a))break}else if(35===d){if(RC(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&nM(e)||n&&PC(d))break;if(OC(d)){if(s=e.line,c=e.lineStart,l=e.lineIndent,tM(e,!1,-1),e.lineIndent>=t){o=!0,d=e.input.charCodeAt(e.position);continue}e.position=r,e.line=s,e.lineStart=c,e.lineIndent=l;break}}o&&(KC(e,i,r,!1),aM(e,e.line-s),i=r=e.position,o=!1),DC(d)||(r=e.position+1),d=e.input.charCodeAt(++e.position)}return KC(e,i,r,!1),!!e.result||(e.kind=u,e.result=h,!1)}(e,h,wC===n)&&(f=!0,null===e.tag&&(e.tag="?")):(f=!0,null===e.tag&&null===e.anchor||QC(e,"alias node should not have any properties")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===m&&(f=s&&iM(e,p))),null===e.tag)null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);else if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&QC(e,'unacceptable node kind for ! tag; it should be "scalar", not "'+e.kind+'"'),c=0,l=e.implicitTypes.length;c"),null!==e.result&&u.kind!==e.kind&&QC(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+u.kind+'", not "'+e.kind+'"'),u.resolve(e.result,e.tag)?(e.result=u.construct(e.result,e.tag),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):QC(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||f}function cM(e){var t,n,a,i,r=e.position,o=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);0!==(i=e.input.charCodeAt(e.position))&&(tM(e,!0,-1),i=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==i));){for(o=!0,i=e.input.charCodeAt(++e.position),t=e.position;0!==i&&!RC(i);)i=e.input.charCodeAt(++e.position);for(a=[],(n=e.input.slice(t,e.position)).length<1&&QC(e,"directive name must not be less than one character in length");0!==i;){for(;DC(i);)i=e.input.charCodeAt(++e.position);if(35===i){do{i=e.input.charCodeAt(++e.position)}while(0!==i&&!OC(i));break}if(OC(i))break;for(t=e.position;0!==i&&!RC(i);)i=e.input.charCodeAt(++e.position);a.push(e.input.slice(t,e.position))}0!==i&&eM(e),bC.call(YC,n)?YC[n](e,n,a):GC(e,'unknown document directive "'+n+'"')}tM(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,tM(e,!0,-1)):o&&QC(e,"directives end mark is expected"),sM(e,e.lineIndent-1,MC,!1,!0),tM(e,!0,-1),e.checkLineBreaks&&AC.test(e.input.slice(r,e.position))&&GC(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&nM(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,tM(e,!0,-1)):e.position=55296&&a<=56319&&t+1=56320&&n<=57343?1024*(a-55296)+n-56320+65536:a}function XM(e){return/^\n* /.test(e)}var JM=1,ek=2,tk=3,nk=4,ak=5;function ik(e,t,n,a,i,r,o,s){var c,l=0,d=null,u=!1,h=!1,p=-1!==a,m=-1,g=function(e){return QM(e)&&e!==pM&&!ZM(e)&&e!==SM&&e!==IM&&e!==EM&&e!==kM&&e!==TM&&e!==jM&&e!==DM&&e!==PM&&e!==bM&&e!==xM&&e!==MM&&e!==yM&&e!==RM&&e!==$M&&e!==AM&&e!==CM&&e!==vM&&e!==wM&&e!==zM&&e!==OM}(KM(e,0))&&function(e){return!ZM(e)&&e!==EM}(KM(e,e.length-1));if(t||o)for(c=0;c=65536?c+=2:c++){if(!QM(l=KM(e,c)))return ak;g=g&&YM(l,d,s),d=l}else{for(c=0;c=65536?c+=2:c++){if((l=KM(e,c))===gM)u=!0,p&&(h=h||c-m-1>a&&" "!==e[m+1],m=c);else if(!QM(l))return ak;g=g&&YM(l,d,s),d=l}h=h||p&&c-m-1>a&&" "!==e[m+1]}return u||h?n>9&&XM(e)?ak:o?r===BM?ak:ek:h?nk:tk:!g||o||i(e)?r===BM?ak:ek:JM}function rk(e,t,n,a,i){e.dump=function(){if(0===t.length)return e.quotingType===BM?'""':"''";if(!e.noCompatMode&&(-1!==NM.indexOf(t)||FM.test(t)))return e.quotingType===BM?'"'+t+'"':"'"+t+"'";var r=e.indent*Math.max(1,n),o=-1===e.lineWidth?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-r),s=a||e.flowLevel>-1&&n>=e.flowLevel;switch(ik(t,s,e.indent,o,(function(t){return function(e,t){var n,a;for(n=0,a=e.implicitTypes.length;n"+ok(t,e.indent)+sk(UM(function(e,t){var n,a,i=/(\n+)([^\n]*)/g,r=(s=e.indexOf("\n"),s=-1!==s?s:e.length,i.lastIndex=s,ck(e.slice(0,s),t)),o="\n"===e[0]||" "===e[0];var s;for(;a=i.exec(e);){var c=a[1],l=a[2];n=" "===l[0],r+=c+(o||n||""===l?"":"\n")+ck(l,t),o=n}return r}(t,o),r));case ak:return'"'+function(e){for(var t,n="",a=0,i=0;i=65536?i+=2:i++)a=KM(e,i),!(t=LM[a])&&QM(a)?(n+=e[i],a>=65536&&(n+=e[i+1])):n+=t||VM(a);return n}(t)+'"';default:throw new Dx("impossible error: invalid scalar style")}}()}function ok(e,t){var n=XM(e)?String(t):"",a="\n"===e[e.length-1];return n+(a&&("\n"===e[e.length-2]||"\n"===e)?"+":a?"":"-")+"\n"}function sk(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function ck(e,t){if(""===e||" "===e[0])return e;for(var n,a,i=/ [^ ]/g,r=0,o=0,s=0,c="";n=i.exec(e);)(s=n.index)-r>t&&(a=o>r?o:s,c+="\n"+e.slice(r,a),r=a+1),o=s;return c+="\n",e.length-r>t&&o>r?c+=e.slice(r,o)+"\n"+e.slice(o+1):c+=e.slice(r),c.slice(1)}function lk(e,t,n,a){var i,r,o,s="",c=e.tag;for(i=0,r=n.length;i tag resolver accepts not "'+c+'" style');a=s.represent[c](t,c)}e.dump=a}return!0}return!1}function uk(e,t,n,a,i,r,o){e.tag=null,e.dump=n,dk(e,n,!1)||dk(e,n,!0);var s,c=uM.call(e.dump),l=a;a&&(a=e.flowLevel<0||e.flowLevel>t);var d,u,h="[object Object]"===c||"[object Array]"===c;if(h&&(u=-1!==(d=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||u||2!==e.indent&&t>0)&&(i=!1),u&&e.usedDuplicates[d])e.dump="*ref_"+d;else{if(h&&u&&!e.usedDuplicates[d]&&(e.usedDuplicates[d]=!0),"[object Object]"===c)a&&0!==Object.keys(e.dump).length?(!function(e,t,n,a){var i,r,o,s,c,l,d="",u=e.tag,h=Object.keys(n);if(!0===e.sortKeys)h.sort();else if("function"==typeof e.sortKeys)h.sort(e.sortKeys);else if(e.sortKeys)throw new Dx("sortKeys must be a boolean or a function");for(i=0,r=h.length;i1024)&&(e.dump&&gM===e.dump.charCodeAt(0)?l+="?":l+="? "),l+=e.dump,c&&(l+=WM(e,t)),uk(e,t+1,s,!0,c)&&(e.dump&&gM===e.dump.charCodeAt(0)?l+=":":l+=": ",d+=l+=e.dump));e.tag=u,e.dump=d||"{}"}(e,t,e.dump,i),u&&(e.dump="&ref_"+d+e.dump)):(!function(e,t,n){var a,i,r,o,s,c="",l=e.tag,d=Object.keys(n);for(a=0,i=d.length;a1024&&(s+="? "),s+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),uk(e,t,o,!1,!1)&&(c+=s+=e.dump));e.tag=l,e.dump="{"+c+"}"}(e,t,e.dump),u&&(e.dump="&ref_"+d+" "+e.dump));else if("[object Array]"===c)a&&0!==e.dump.length?(e.noArrayIndent&&!o&&t>0?lk(e,t-1,e.dump,i):lk(e,t,e.dump,i),u&&(e.dump="&ref_"+d+e.dump)):(!function(e,t,n){var a,i,r,o="",s=e.tag;for(a=0,i=n.length;a",e.dump=s+" "+e.dump)}return!0}function hk(e,t){var n,a,i=[],r=[];for(pk(e,i,r),n=0,a=r.length;nq`
${gk.dump(e)}
`;return q`
+
+
+ +
+
+ + ${this.message?q`${this.message}${this.context&&"string"==typeof this.context?": "+this.context:""}`:""} + + ${this.context&&Array.isArray(this.context)?this.context.map((e=>n(e))):"object"==typeof this.context?n(this.context):""} +
+
+
`}static get styles(){return o(fk)}};e([he({attribute:!1})],_k.prototype,"message",void 0),e([he({attribute:!1})],_k.prototype,"context",void 0),e([he({attribute:!1})],_k.prototype,"icon",void 0),e([he({attribute:!0,type:Boolean})],_k.prototype,"dotdotdot",void 0),_k=e([le("frigate-card-message")],_k);let yk=class extends se{render(){if(this.message)return q` ${N_("error.troubleshooting")}.`} + .icon=${this.message.icon??"mdi:alert-circle"} + .context=${this.message.context} + .dotdotdot=${this.message.dotdotdot} + > + `}static get styles(){return o(fk)}};e([he({attribute:!1})],yk.prototype,"message",void 0),yk=e([le("frigate-card-error-message")],yk);let vk=class extends se{constructor(){super(...arguments),this.message="",this.animated=!1,this.size="large"}render(){return q`
+ ${this.animated?q` + `:q``} + ${this.message?q`${this.message}`:q``} +
`}static get styles(){return o(fk)}};function bk(e){return"error"===e?.type?q` `:e?q` `:q``}function wk(e){return q` + + + `}function xk(e,t,n){!function(e,t,n,a){Vg(e,"message",{message:t,type:n,icon:a?.icon,context:a?.context})}(e,t,"error",{context:n?.context})}function Ck(e,t){t instanceof Error&&xk(e,t.message,{...t instanceof $s&&{context:t.context}})}e([he({attribute:!1})],vk.prototype,"message",void 0),e([he({attribute:!1})],vk.prototype,"animated",void 0),e([he({attribute:!1})],vk.prototype,"size",void 0),vk=e([le("frigate-card-progress-indicator")],vk);let Mk=class extends se{constructor(){super(...arguments),this._root=null}createRenderRoot(){return this}_createRoot(){const e=customElements.get("hui-conditional-element");if(!e||!this.hass)throw new Error(N_("error.could_not_render_elements"));const t=new e;t.hass=this.hass;const n={type:"conditional",conditions:[],elements:this.elements};try{t.setConfig(n)}catch(e){throw Zg(e,console.error),new $s(N_("error.invalid_elements_config"))}return t}willUpdate(e){try{!this.elements||this._root&&!e.has("elements")||(this._root=this._createRoot())}catch(e){return Ck(this,e)}}render(){return q`${this._root||""}`}updated(){this.hass&&this._root&&(this._root.hass=this.hass)}};e([he({attribute:!1})],Mk.prototype,"elements",void 0),e([he({attribute:!1})],Mk.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],Mk.prototype,"hass",void 0),Mk=e([le("frigate-card-elements-core")],Mk);let kk=class extends se{constructor(){super(...arguments),this._menuRemoveHandler=e=>{Vg(this,"menu:remove",e.detail)},this._statusBarRemoveHandler=e=>{Vg(this,"status-bar:remove",e.detail)},this._menuAddHandler=e=>{const t=e.composedPath();t.length&&this._addHandler(t[0],"frigate-card:menu:remove",this._menuRemoveHandler)},this._statusBarAddHandler=e=>{const t=e.composedPath();t.length&&this._addHandler(t[0],"frigate-card:status-bar:add",this._statusBarRemoveHandler)}}_addHandler(e,t,n){e.removeEventListener(t,n),e.addEventListener(t,n)}connectedCallback(){super.connectedCallback(),this.addEventListener("frigate-card:menu:add",this._menuAddHandler),this.addEventListener("frigate-card:status-bar:add",this._statusBarAddHandler)}disconnectedCallback(){this.removeEventListener("frigate-card:menu:add",this._menuAddHandler),this.addEventListener("frigate-card:status-bar:add",this._statusBarAddHandler),super.disconnectedCallback()}render(){return q` + `}static get styles(){return o(":host {\n position: absolute;\n inset: 0;\n overflow: hidden;\n pointer-events: none;\n}\n\n.element {\n position: absolute;\n transform: translate(-50%, -50%);\n pointer-events: auto;\n}\n\nhui-error-card.element {\n inset: 0px;\n transform: unset;\n}")}};e([he({attribute:!1})],kk.prototype,"hass",void 0),e([he({attribute:!1})],kk.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],kk.prototype,"elements",void 0),kk=e([le("frigate-card-elements")],kk);let Sk=class extends se{setConfig(e){this._config=e}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.className=""}render(){if(function(e,t){if(!t)return!0;const n=new fw(t,{bubbles:!0,composed:!0});return e.dispatchEvent(n),n.evaluation??!1}(this,this._config?.conditions))return q` + `}};e([he({attribute:!1,hasChanged:()=>!0})],Sk.prototype,"hass",void 0),Sk=e([le("frigate-card-conditional")],Sk);class Ek extends se{constructor(e){super(),this._config=null,this._eventCategory=e}setConfig(e){this._config=e}connectedCallback(){super.connectedCallback(),this._config&&Vg(this,`${this._eventCategory}:add`,this._config)}disconnectedCallback(){this._config&&Vg(this,`${this._eventCategory}:remove`,this._config),super.disconnectedCallback()}}e([pe()],Ek.prototype,"_config",void 0);class $k extends Ek{constructor(){super("menu")}}let Ak=class extends $k{};Ak=e([le("frigate-card-menu-icon")],Ak);let Ik=class extends $k{};Ik=e([le("frigate-card-menu-state-icon")],Ik);let zk=class extends $k{};zk=e([le("frigate-card-menu-submenu")],zk);let Tk=class extends $k{};Tk=e([le("frigate-card-menu-submenu-select")],Tk);class jk extends Ek{constructor(){super("status-bar")}}let Ok=class extends jk{};Ok=e([le("frigate-card-status-bar-icon")],Ok);let Dk=class extends jk{};Dk=e([le("frigate-card-status-bar-image")],Dk);let Rk=class extends jk{};Rk=e([le("frigate-card-status-bar-string")],Rk);let Pk=class extends se{render(){return q` `}static get styles(){return o(":host {\n width: intrinsic;\n height: intrinsic;\n display: flex;\n justify-content: center;\n align-items: center;\n pointer-events: none;\n}\n\nimg {\n width: 10%;\n animation: rotate 8s linear infinite;\n}\n\n@keyframes rotate {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}")}};Pk=e([le("frigate-card-loading")],Pk);const Lk=(e,t)=>{Vg(e,"action:execution-request",t)};class Nk{constructor(e){this._config=null,this._buttons=[],this._expanded=!1,this._host=e}setMenuConfig(e){this._config=e,this._host.style.setProperty("--frigate-card-menu-button-size",`${e.button_size}px`),this._host.setAttribute("data-style",e.style),this._host.setAttribute("data-position",e.position),this._host.setAttribute("data-alignment",e.alignment),this._sortButtons(),this._host.requestUpdate()}getMenuConfig(){return this._config}isExpanded(){return this._expanded}setButtons(e){this._buttons=e,this._sortButtons(),this._host.requestUpdate()}getButtons(e){const t=e=>!this._isHidingMenu()||this._expanded||!!e.permanent;return this._buttons.filter((n=>(e=>!1!==e.enabled)(n)&&(t=>t.alignment===e||"matching"===e&&!t.alignment)(n)&&t(n)))}setExpanded(e){this._expanded=e,af(this._host,e,"expanded"),this._host.requestUpdate()}toggleExpanded(){this.setExpanded(!this._expanded)}actionHandler(e,t){if(e.stopPropagation(),e.detail.config&&(t=e.detail.config),!t)return;const n=e.detail.action,a=_f(n,t);if(!a)return;const i=qg(a);let r=!1;const o=i.filter((e=>rf(e)&&!this._isUnknownActionMenuToggleAction(e)));if(o.length!=i.length&&(r=!0),o.length&&Lk(this._host,{action:i,config:t}),this._isHidingMenu())if(r)this.setExpanded(!this._expanded);else{const e=_f("hold",t),a=_f("double_tap",t),i=_f("tap",t),r=_f("end_tap",t);"end_tap"!==n&&("start_tap"!==n||e||a||i||r)&&("end_tap"===n||r)||this.setExpanded(!1)}}getFreshButtonState(e,t){const n={...t};return e&&"custom:frigate-card-menu-state-icon"===t.type?Rb(e,n):n}_sortButtons(){this._buttons=ky(this._buttons,(e=>(e.priority??0)+(this._isHidingMenu()&&e.permanent?Bs:0)),["desc"])}_isHidingMenu(){return"hidden"===this._config?.style}_isUnknownActionMenuToggleAction(e){const t=hf(e);return!!t&&"menu_toggle"==t.frigate_card_action}}var Fk="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' version='1.1' id='svg54' sodipodi:docname='frigate.svg' inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3e %3cdefs id='defs58' /%3e %3csodipodi:namedview id='namedview56' pagecolor='%23da4040' bordercolor='%23666666' borderopacity='1.0' inkscape:pageshadow='2' inkscape:pageopacity='0' inkscape:pagecheckerboard='0' showgrid='false' width='24px' inkscape:zoom='45.254834' inkscape:cx='-0.03314563' inkscape:cy='9.9768347' inkscape:window-width='3840' inkscape:window-height='1527' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='svg54' showguides='true' inkscape:showpageshadow='2' inkscape:deskcolor='%23d1d1d1' /%3e %3cpath d='m 4.8759466%2c22.743573 c 0.0866%2c0.69274 0.811811%2c1.16359 0.37885%2c1.27183 -0.43297%2c0.10824 -2.32718%2c-3.43665 -2.7601492%2c-4.95202 -0.4329602%2c-1.51538 -0.6764993%2c-3.22017 -0.5682593%2c-4.19434 0.1082301%2c-0.97417 5.7097085%2c-2.48955 5.7097085%2c-2.89545 0%2c-0.4059 -1.81304%2c-0.0271 -1.89422%2c-0.35178 -0.0812%2c-0.32472 1.36925%2c-0.12989 1.75892%2c-0.64945 0.60885%2c-0.81181 1.3800713%2c-0.6765 1.8671505%2c-1.1094696 0.4870902%2c-0.4329599 1.0824089%2c-2.0836399 1.1906589%2c-2.7871996 0.108241%2c-0.70357 -1.0824084%2c-1.51538 -1.4071389%2c-2.05658 -0.3247195%2c-0.54121 0.7035702%2c-0.92005 3.1931099%2c-1.94834 2.48954%2c-1.02829 10.39114%2c-3.30134994 10.49938%2c-3.03074994 0.10824%2c0.27061 -2.59779%2c1.40713994 -4.492%2c2.11069994 -1.89422%2c0.70357 -4.97909%2c2.05658 -4.97909%2c2.43542 0%2c0.37885 0.16236%2c0.67651 0.0541%2c1.54244 -0.10824%2c0.86593 -0.12123%2c1.2702597 -0.32472%2c1.8400997 -0.1353%2c0.37884 -0.2706%2c1.27183 0%2c2.0836295 0.21648%2c0.64945 0.92005%2c1.13653 1.24477%2c1.24478 0.2706%2c0.018 1.01746%2c0.0433 1.8401%2c0 1.02829%2c-0.0541 2.48954%2c0.0541 2.48954%2c0.32472 0%2c0.2706 -2.21894%2c0.10824 -2.21894%2c0.48708 0%2c0.37885 2.27306%2c-0.0541 2.21894%2c0.32473 -0.0541%2c0.37884 -1.89422%2c0.21648 -2.86839%2c0.21648 -0.77933%2c0 -1.93031%2c-0.0361 -2.43542%2c-0.21648 l -0.10824%2c0.37884 c -0.18038%2c0 -0.55744%2c0.10824 -0.94711%2c0.10824 -0.48708%2c0 -0.51414%2c0.16236 -1.40713%2c0.16236 -0.892989%2c0 -0.622391%2c-0.0541 -1.4341894%2c-0.10824 -0.81181%2c-0.0541 -3.842561%2c2.27306 -4.383761%2c3.03075 -0.54121%2c0.75768 -0.21649%2c2.59778 -0.21649%2c3.43665 0%2c0.75379 -0.10824%2c2.43542 0%2c3.30135 z' fill='black' id='path330' style='fill:white%3bfill-opacity:1%3bstroke:none%3bstroke-width:0.1%3bstroke-miterlimit:4%3bstroke-dasharray:none%3bstroke-opacity:1' sodipodi:nodetypes='csccscccccsscscccccsscsccssccscc' /%3e%3c/svg%3e",Vk="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3c!-- Created with Inkscape (http://www.inkscape.org/) --%3e%3csvg id='svg2' version='1.1' inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' width='24' height='24' xml:space='preserve' sodipodi:docname='motioneye.svg' inkscape:export-filename='/home/ccrisan/projects/motioneye/static/img/motioneye-logo.png' inkscape:export-xdpi='960' inkscape:export-ydpi='960' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23' xmlns:cc='http://creativecommons.org/ns%23' xmlns:dc='http://purl.org/dc/elements/1.1/'%3e%3cmetadata id='metadata8'%3e%3crdf:RDF%3e%3ccc:Work rdf:about=''%3e%3cdc:format%3eimage/svg%2bxml%3c/dc:format%3e%3cdc:type rdf:resource='http://purl.org/dc/dcmitype/StillImage' /%3e%3c/cc:Work%3e%3c/rdf:RDF%3e%3c/metadata%3e%3cdefs id='defs6'%3e%3clinearGradient inkscape:collect='always' id='linearGradient2058'%3e%3cstop style='stop-color:white%3bstop-opacity:1%3b' offset='0' id='stop2054' /%3e%3cstop style='stop-color:%23585858%3bstop-opacity:1' offset='1' id='stop2056' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' id='linearGradient2005'%3e%3cstop style='stop-color:white%3bstop-opacity:1%3b' offset='0' id='stop2001' /%3e%3cstop style='stop-color:grey%3bstop-opacity:1%3b' offset='1' id='stop2003' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' id='linearGradient4205'%3e%3cstop style='stop-color:%234aa3e0%3bstop-opacity:1' offset='0' id='stop4207' /%3e%3cstop style='stop-color:%233096db%3bstop-opacity:1' offset='1' id='stop4209' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' id='linearGradient4197'%3e%3cstop style='stop-color:white%3bstop-opacity:1%3b' offset='0' id='stop4199' /%3e%3cstop style='stop-color:%23585858%3bstop-opacity:1' offset='1' id='stop4201' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient4205' id='linearGradient4211' x1='26.602072' y1='43.034946' x2='26.602072' y2='29.466328' gradientUnits='userSpaceOnUse' gradientTransform='matrix(0.96428571%2c0%2c0%2c0.96428571%2c0.91428571%2c0.91428571)' /%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4285'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4287' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4289' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.6' result='blur' id='feGaussianBlur4291' /%3e%3cfeOffset dx='0' dy='-1' result='offset' id='feOffset4293' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4295' /%3e%3c/filter%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient2005' id='linearGradient4309' gradientUnits='userSpaceOnUse' x1='26.445793' y1='47.517574' x2='26.445793' y2='3.8183768' /%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient4197' id='linearGradient4311' gradientUnits='userSpaceOnUse' x1='26.445793' y1='47.517574' x2='26.445793' y2='3.8183768' /%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient2058' id='linearGradient4313' gradientUnits='userSpaceOnUse' x1='26.445793' y1='47.517574' x2='26.445793' y2='3.8183768' /%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4315' x='-0.03618178' y='-0.20783284' width='1.0723636' height='1.3304883'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4317' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4319' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.6' result='blur' id='feGaussianBlur4321' /%3e%3cfeOffset dx='0' dy='-1' result='offset' id='feOffset4323' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4325' /%3e%3c/filter%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4327' x='-0.27857143' y='-0.4720238' width='1.5571429' height='1.7505952'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4329' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4331' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.6' result='blur' id='feGaussianBlur4333' /%3e%3cfeOffset dx='0' dy='-1' result='offset' id='feOffset4335' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4337' /%3e%3c/filter%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4339' x='-0.0202507' y='-0.13980794' width='1.0405014' height='1.2082853'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4341' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4343' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.2' result='blur' id='feGaussianBlur4345' /%3e%3cfeOffset dx='0' dy='-0.5' result='offset' id='feOffset4347' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4349' /%3e%3c/filter%3e%3c/defs%3e%3csodipodi:namedview pagecolor='%23ff0d0d' bordercolor='%23666666' borderopacity='1' objecttolerance='10' gridtolerance='10' guidetolerance='10' inkscape:pageopacity='0' inkscape:pageshadow='2' inkscape:window-width='3840' inkscape:window-height='1527' id='namedview4' showgrid='false' inkscape:zoom='29.890116' inkscape:cx='19.973158' inkscape:cy='16.577386' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='g10' showguides='true' inkscape:guide-bbox='true' inkscape:showpageshadow='true' inkscape:pagecheckerboard='false' inkscape:deskcolor='%23d1d1d1' /%3e%3cg id='g10' inkscape:groupmode='layer' inkscape:label='ink_ext_XXXXXX' transform='matrix(1.25%2c0%2c0%2c-1.25%2c0%2c64)'%3e%3cg id='g4823' transform='matrix(1.0344694%2c0%2c0%2c1.0344694%2c-3.551886%2c-0.86695248)'%3e%3cpath id='path4244' d='M 8.9346154%2c40.515385 C 5.3647588%2c36.547307 3.2%2c31.357779 3.2%2c25.6 3.2%2c13.228821 13.228821%2c3.2 25.6%2c3.2 37.971179%2c3.2 48%2c13.228821 48%2c25.6 c 0%2c5.736682 -2.161128%2c10.952493 -5.707692%2c14.915385 -1.695935%2c-0.623286 -3.387833%2c-1.349065 -5.061539%2c-2.288462 3.2394%2c-0.937363 5.6%2c-3.937988 5.6%2c-7.457692 0%2c-4.260339 -3.469626%2c-7.753846 -7.753846%2c-7.753846 -3.633936%2c0 -6.690552%2c2.51055 -7.538461%2c5.869231 h -3.876924 c -0.840685%2c-3.360193 -3.903443%2c-5.869231 -7.538461%2c-5.869231 -4.284219%2c0 -7.7807693%2c3.493507 -7.7807693%2c7.753846 0%2c3.56112 2.4570323%2c6.5856 5.7615383%2c7.484616 -1.676267%2c0.912203 -3.404813%2c1.620556 -5.1692306%2c2.261538 z M 25.6%2c26.461538 c 0.532632%2c-1.981435 1.101793%2c-3.947553 3.446154%2c-5.16923 L 25.6%2c16.123077 22.153846%2c21.292308 c 2.053593%2c1.454966 3.000771%2c3.237758 3.446154%2c5.16923 z' style='fill:url(%23linearGradient4309)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4327)' inkscape:connector-curvature='0' transform='matrix(0.38078533%2c0%2c0%2c0.38078533%2c2.9655495%2c31.335499)' /%3e%3cpath id='path4242' d='m 16.123077%2c33.353847 c -1.427443%2c0 -2.584616%2c-1.157173 -2.584616%2c-2.584616 0%2c-1.427444 1.157173%2c-2.584615 2.584616%2c-2.584615 1.427444%2c0 2.584615%2c1.157171 2.584615%2c2.584615 0%2c1.427443 -1.157171%2c2.584616 -2.584615%2c2.584616 z' style='fill:url(%23linearGradient4311)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4327)' inkscape:connector-curvature='0' transform='matrix(0.38078533%2c0%2c0%2c0.38078533%2c2.9655495%2c31.335499)' /%3e%3cpath id='path4240' d='m 35.076923%2c33.353847 c -1.427443%2c0 -2.584615%2c-1.157173 -2.584615%2c-2.584616 0%2c-1.427444 1.157172%2c-2.584615 2.584615%2c-2.584615 1.427443%2c0 2.584616%2c1.157171 2.584616%2c2.584615 0%2c1.427443 -1.157173%2c2.584616 -2.584616%2c2.584616 z' style='fill:url(%23linearGradient4313)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4327)' inkscape:connector-curvature='0' transform='matrix(0.38078533%2c0%2c0%2c0.38078533%2c2.9655495%2c31.335499)' /%3e%3cpath inkscape:connector-curvature='0' style='fill:%23d9d9d9%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4339)' d='m 25.6%2c47.2 c -4.373944%2c0 -8.437159%2c-1.399808 -11.838461%2c-3.634616 3.677605%2c-0.394237 7.305921%2c-1.342945 11.423077%2c-3.375 4.166157%2c2.122533 8.434154%2c3.008875 12.279808%2c3.452886 C 34.057131%2c45.890032 29.986674%2c47.2 25.6%2c47.2 Z' id='path4248' transform='matrix(0.39488848%2c0%2c0%2c0.39488848%2c2.6045087%2c30.974457)' /%3e%3cpath inkscape:connector-curvature='0' style='fill:url(%23linearGradient4211)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4315)' d='M 39.723077%2c42.552884 C 35.394064%2c42.5242 29.479588%2c40.397223 25.184616%2c38.432418 20.668821%2c40.064102 16.035448%2c42.649343 10.801923%2c42.526924 10.453022%2c42.51873 10.118061%2c42.50105 9.7634616%2c42.475 L 5.6615384%2c42.1375 9.5557693%2c40.839424 c 5.3417977%2c-1.74056 10.0398397%2c-2.851302 14.1749997%2c-10.025963 0.959101%2c0 2.845924%2c-4.15e-4 3.738462%2c-4.15e-4 4.11884%2c7.134039 9.059296%2c8.324614 14.149039%2c10.026378 L 45.460577%2c42.085577 41.4625%2c42.475 c -0.544847%2c0.05181 -1.120992%2c0.08198 -1.739423%2c0.07788 z' id='path4246' sodipodi:nodetypes='cccccccccccc' transform='matrix(0.39488848%2c0%2c0%2c0.39488848%2c2.6045087%2c30.974457)' /%3e%3c/g%3e%3c/g%3e%3c/svg%3e",Hk="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3c!-- Created with Inkscape (http://www.inkscape.org/) --%3e%3csvg version='1.1' id='svg62' width='24' height='24' viewBox='0 0 24 24' sodipodi:docname='reolink.svg' inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3e %3cdefs id='defs66' /%3e %3csodipodi:namedview id='namedview64' pagecolor='%23505050' bordercolor='%23eeeeee' borderopacity='1' inkscape:showpageshadow='0' inkscape:pageopacity='0' inkscape:pagecheckerboard='0' inkscape:deskcolor='%23505050' showgrid='true' inkscape:zoom='36.417984' inkscape:cx='18.191562' inkscape:cy='8.6633022' inkscape:window-width='3840' inkscape:window-height='1527' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='g68'%3e %3cinkscape:grid type='xygrid' id='grid1175' dotted='false' snapvisiblegridlinesonly='true' /%3e %3c/sodipodi:namedview%3e %3cg inkscape:groupmode='layer' inkscape:label='Reolink Logo' id='g68'%3e %3cpath style='fill:white%3bstroke-width:0.0393282%3bfill-opacity:1' d='M 17.037254%2c23.964909 C 16.764634%2c23.917573 16.561708%2c23.83617 16.325735%2c23.67954 16.196719%2c23.593913 14.543544%2c21.952905 12.217956%2c19.602014 10.077426%2c17.438191 8.2198993%2c15.582673 8.0901166%2c15.478642 7.6038998%2c15.088895 7.0877741%2c14.869424 6.4986827%2c14.801908 6.3140805%2c14.780765 5.079061%2c14.763305 3.7541964%2c14.763126 l -2.408845%2c-4.78e-4 0.00713%2c-7.3937713 v -7.3935985 l 6.2040046%2c3.536e-5 c 3.9799342%2c1.969e-5 6.3590882%2c0.01465833 6.6366112%2c0.0408227 2.331195%2c0.21982024 4.364771%2c1.49885914 5.578726%2c3.50085534 0.686043%2c1.1313823 1.020901%2c2.2783695 1.067186%2c3.6554196 0.06335%2c1.8844953 -0.57426%2c3.6597378 -1.831469%2c5.0992438 -0.756457%2c0.866146 -1.861127%2c1.62991 -2.928729%2c2.024919 l -0.319718%2c0.118287 -1.951287%2c-1.979284 -1.951286%2c-1.979278 1.046741%2c-0.02346 c 0.575706%2c-0.01291 1.099833%2c-0.03689 1.164724%2c-0.0533 0.596068%2c-0.150649 0.949703%2c-0.313968 1.322206%2c-0.6106282 0.643573%2c-0.5125401 1.046169%2c-1.2439257 1.137985%2c-2.0673522 0.167852%2c-1.505317 -0.771478%2c-2.8704888 -2.263547%2c-3.2897068 L 13.950001%2c4.3234481 9.7981831%2c4.3106846 5.6392389%2c4.29801 v 3.0692702 3.0692648 l 1.4185165%2c7.9e-4 c 1.6275801%2c8.87e-4 1.7789152%2c0.01912 2.3105245%2c0.27984 0.3095679%2c0.15183 0.389559%2c0.219499 1.0817441%2c0.915083 3.027399%2c3.042274 12.19404%2c12.30837 12.204589%2c12.337002 0.0161%2c0.04373 -5.364393%2c0.03953 -5.617359%2c-0.0045 z' id='path1173' inkscape:label='R' /%3e %3c/g%3e%3c/svg%3e";const Bk=e=>{switch(e){case"frigate":return Fk;case"motioneye":return Vk;case"reolink":return Hk;default:return null}};const qk=(e,t,n)=>{const a=e.states[t],i=n?.state?n.state:a?a.state:null;if(!i)return null;const r=Ye(t),o=a?a.attributes:null;return n?.entity?.translation_key&&e.localize(`component.${n.entity.platform}.entity.${r}.${n.entity.translation_key}.state.${i}`)||o?.device_class&&e.localize(`component.${r}.state.${o.device_class}.${i}`)||e.localize(`component.${r}.state._.${i}`)||i};let Uk=class extends se{_renderItem(e){if(!this.hass)return;const t=Rb(this.hass,{...e});return q` + {t.detail.config=e}} + .actionHandler=${Cf({hasHold:yf(e.hold_action),hasDoubleClick:yf(e.double_tap_action)})} + > + ${t.title||""} + ${e.subtitle?q`${e.subtitle}`:""} + ${(e=>{if(e.icon){const t=Bk(e.icon);return t?q``:q` + `}return q``})(t)} + + `}render(){if(!this.submenu)return q``;const e=this.submenu.items;return q` + e.stopPropagation()} + @click=${e=>vf(e)} + > + + + + ${e.map(this._renderItem.bind(this))} + + `}static get styles(){return o("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n pointer-events: auto;\n}\n\nmwc-list-item {\n z-index: 20;\n}")}};e([he({attribute:!1})],Uk.prototype,"hass",void 0),e([he({attribute:!1})],Uk.prototype,"submenu",void 0),Uk=e([le("frigate-card-submenu")],Uk);let Wk=class extends se{shouldUpdate(e){const t=e.get("hass");return!e.has("hass")||!t||!this.submenuSelect||Tb(this.hass,t,[this.submenuSelect.entity])}async _refreshOptionTitles(){if(!this.hass||!this.submenuSelect)return;const e=this.submenuSelect.entity,t=this.hass.states[e],n=t?.attributes?.options,a=await(this.entityRegistryManager?.getEntity(this.hass,e))??null,i={};for(const t of n){const n=qk(this.hass,e,{...a&&{entity:a},state:t});n&&(i[t]=n)}this._optionTitles=i}willUpdate(){if(!this.submenuSelect||!this.hass)return;this._optionTitles||this._refreshOptionTitles();const e=this.submenuSelect.entity,t=this.hass.states[e],n=t?.attributes?.options;if(!t||!n)return;const a={icon:Ab("select"),...Rb(this.hass,this.submenuSelect),...this.submenuSelect,type:"custom:frigate-card-menu-submenu",items:[]};delete a.options;const i=a.items;for(const a of n){const n=this._optionTitles?.[a]??a;i.push({state_color:!0,selected:t.state===a,enabled:!0,title:n||a,...(e.startsWith("select.")||e.startsWith("input_select."))&&{tap_action:{action:"perform-action",perform_action:e.startsWith("select.")?"select.select_option":"input_select.select_option",target:{entity_id:e},data:{option:a}}},...this.submenuSelect.options&&this.submenuSelect.options[a]})}this._generatedSubmenu=a}render(){return q` `}};e([he({attribute:!1})],Wk.prototype,"hass",void 0),e([he({attribute:!1})],Wk.prototype,"submenuSelect",void 0),e([he({attribute:!1})],Wk.prototype,"entityRegistryManager",void 0),e([pe()],Wk.prototype,"_optionTitles",void 0),Wk=e([le("frigate-card-submenu-select")],Wk);let Zk=class extends se{constructor(){super(...arguments),this._controller=new Nk(this)}set menuConfig(e){this._controller.setMenuConfig(e)}set buttons(e){this._controller.setButtons(e)}set expanded(e){this._controller.setExpanded(e)}toggleMenu(){this._controller.toggleExpanded()}_renderButton(e){if(!this.hass)return;if("custom:frigate-card-menu-submenu"===e.type)return q` this._controller.actionHandler(e)} + > + `;if("custom:frigate-card-menu-submenu-select"===e.type)return q` this._controller.actionHandler(e)} + > + `;const t=this._controller.getFreshButtonState(this.hass,e),n=Bk(t.icon);return q` this._controller.actionHandler(t,e)} + > + ${n?q``:q``} + `}render(){const e=this._controller.getMenuConfig(),t=e?.style;if(!e||"none"===t)return;const n=this._controller.getButtons("matching"),a=this._controller.getButtons("opposing");return q`
+ ${n.map((e=>this._renderButton(e)))} +
+
+ ${a.map((e=>this._renderButton(e)))} +
`}static get styles(){return o('ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n --frigate-card-menu-button-size: 40px;\n --mdc-icon-button-size: var(--frigate-card-menu-button-size);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n pointer-events: auto;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n overflow: visible;\n}\n\n/*******************************************************\n * Non-hover styles should not interact with the pointer\n *******************************************************/\n:host(:not([data-style*=hover])) {\n pointer-events: none;\n}\n\n/***********************************\n * Aligned divs: matching & opposing\n ***********************************/\ndiv.matching,\ndiv.opposing {\n display: flex;\n flex-wrap: wrap;\n flex-direction: row;\n align-items: flex-start;\n min-width: 0px;\n min-height: 0px;\n}\n\ndiv.matching {\n justify-content: flex-start;\n}\n\ndiv.opposing {\n justify-content: flex-end;\n}\n\n/********************\n * Outside menu style\n ********************/\n:host([data-style=outside]) {\n width: 100%;\n background: var(--secondary-background-color);\n}\n\n/********************************************************\n * Hack: Ensure host & div expand for column flex layouts\n ********************************************************/\n:host(:not([data-style=outside])[data-position=left]) {\n writing-mode: vertical-lr;\n}\n\n:host(:not([data-style=outside])[data-position=right]) {\n writing-mode: vertical-rl;\n}\n\n:host(:not([data-style=outside])[data-style=overlay][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style=overlay][data-position=right]) div > *,\n:host(:not([data-style=outside])[data-style*=hover][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style*=hover][data-position=right]) div > *,\n:host(:not([data-style=outside])[data-style=hidden][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style=hidden][data-position=right]) div > * {\n writing-mode: horizontal-tb;\n}\n\n/**********************\n * "Reverse" alignments\n **********************/\n:host(:not([data-style=outside])[data-position=left][data-alignment=bottom]),\n:host(:not([data-style=outside])[data-position=right][data-alignment=bottom]),\n:host([data-position=top][data-alignment=right]),\n:host([data-position=bottom][data-alignment=right]),\n:host(:not([data-style=outside])[data-position=left][data-alignment=bottom]) div,\n:host(:not([data-style=outside])[data-position=right][data-alignment=bottom]) div,\n:host([data-position=top][data-alignment=right]) div,\n:host([data-position=bottom][data-alignment=right]) div {\n flex-direction: row-reverse;\n}\n\n/****************************\n * Wrap upwards on the bottom\n ****************************/\n:host(:not([data-style=outside])[data-position=bottom]) div {\n flex-wrap: wrap-reverse;\n}\n\n/********************************************\n * Positioning for absolute based menu styles\n ********************************************/\n:host([data-style=overlay][data-position=top]),\n:host([data-style=overlay][data-position=bottom]),\n:host([data-style*=hover][data-position=top]),\n:host([data-style*=hover][data-position=bottom]),\n:host([data-style=hidden][data-position=top]),\n:host([data-style=hidden][data-position=bottom]) {\n width: 100%;\n height: auto;\n}\n\n:host([data-style=overlay][data-position=top][data-alignment=left]),\n:host([data-style=overlay][data-position=bottom][data-alignment=left]),\n:host([data-style*=hover][data-position=top][data-alignment=left]),\n:host([data-style*=hover][data-position=bottom][data-alignment=left]),\n:host([data-style=hidden][data-position=top][data-alignment=left][expanded]),\n:host([data-style=hidden][data-position=bottom][data-alignment=left][expanded]) {\n background: linear-gradient(90deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=top][data-alignment=right]),\n:host([data-style=overlay][data-position=bottom][data-alignment=right]),\n:host([data-style*=hover][data-position=top][data-alignment=right]),\n:host([data-style*=hover][data-position=bottom][data-alignment=right]),\n:host([data-style=hidden][data-position=top][data-alignment=right][expanded]),\n:host([data-style=hidden][data-position=bottom][data-alignment=right][expanded]) {\n background: linear-gradient(270deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=left]),\n:host([data-style=overlay][data-position=right]),\n:host([data-style*=hover][data-position=left]),\n:host([data-style*=hover][data-position=right]),\n:host([data-style=hidden][data-position=left]),\n:host([data-style=hidden][data-position=right]) {\n width: auto;\n height: 100%;\n}\n\n:host([data-style=overlay][data-position=left][data-alignment=top]),\n:host([data-style=overlay][data-position=right][data-alignment=top]),\n:host([data-style*=hover][data-position=left][data-alignment=top]),\n:host([data-style*=hover][data-position=right][data-alignment=top]),\n:host([data-style=hidden][data-position=left][data-alignment=top][expanded]),\n:host([data-style=hidden][data-position=right][data-alignment=top][expanded]) {\n background: linear-gradient(180deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=left][data-alignment=bottom]),\n:host([data-style=overlay][data-position=right][data-alignment=bottom]),\n:host([data-style*=hover][data-position=left][data-alignment=bottom]),\n:host([data-style*=hover][data-position=right][data-alignment=bottom]),\n:host([data-style=hidden][data-position=left][data-alignment=bottom][expanded]),\n:host([data-style=hidden][data-position=right][data-alignment=bottom][expanded]) {\n background: linear-gradient(0deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}')}};e([he({attribute:!1})],Zk.prototype,"entityRegistryManager",void 0),e([he({attribute:!1})],Zk.prototype,"hass",void 0),Zk=e([le("frigate-card-menu")],Zk);let Qk=class extends se{render(){return q` + + + + + `}static get styles(){return o("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n position: absolute;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n\nslot {\n position: absolute;\n display: flex;\n}\n\n/***************\n * Slot position\n ***************/\nslot[name=top] {\n top: 0px;\n}\n\nslot[name=bottom] {\n bottom: 0px;\n}\n\nslot[name=left] {\n left: 0px;\n}\n\nslot[name=right] {\n right: 0px;\n}\n\n/***********\n * Slot size\n ***********/\nslot[name=top],\nslot[name=bottom] {\n width: 100%;\n flex-direction: column;\n}\n\nslot[name=left],\nslot[name=right] {\n height: 100%;\n flex-direction: row;\n}\n\nslot[name=top],\nslot[name=left] {\n justify-content: flex-start;\n}\n\nslot[name=bottom],\nslot[name=right] {\n justify-content: flex-end;\n}\n\n/*******************************\n * Match rounded corners to card\n *******************************/\n::slotted([slot=top]:first-child),\n::slotted([slot=left]:first-child) {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=top]:first-child),\n::slotted([slot=right]:first-child) {\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=bottom]:last-child),\n::slotted([slot=left]:last-child) {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=bottom]:last-child),\n::slotted([slot=right]:last-child) {\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}")}};Qk=e([le("frigate-card-overlay")],Qk);class Gk{constructor(e){this._config=null,this._popupTimer=new bf,this._items=[],this._host=e}getRenderItems(){return this._items}setItems(e){const t=e.filter((e=>!!e.exclusive)),n=ky(t.length?t:e,(e=>e.priority??50),"desc"),a=this._getSufficientValues(this._items),i=this._getSufficientValues(n);this._items=n,"popup"!==this._config?.style||jy(a,i)||(this._show(),this._popupTimer.start(this._config.popup_seconds,(()=>this._hide()))),this._host.requestUpdate()}setConfig(e){this._config=e,this._host.style.setProperty("--frigate-card-status-bar-height",`${e.height}px`),this._host.setAttribute("data-style",e.style),this._host.setAttribute("data-position",e.position),"popup"!==this._config?.style&&this._show(),this._host.requestUpdate()}shouldRender(){return this._items.some((e=>!1!==e.enabled&&e.sufficient))}actionHandler(e,t){e.stopPropagation();const n=_f(e.detail.action,t);n&&Lk(this._host,{action:qg(n),config:t})}_getSufficientValue(e){ +/* istanbul ignore else: cannot happen -- @preserve */ +return"custom:frigate-card-status-bar-icon"===e.type?e.icon:"custom:frigate-card-status-bar-string"===e.type?e.string:"custom:frigate-card-status-bar-image"===e.type?e.image:null}_getSufficientValues(e){return e.filter((e=>!1!==e.enabled&&e.sufficient)).map((e=>this._getSufficientValue(e)))}_show(){af(this._host,!1,"hide")}_hide(){af(this._host,!0,"hide")}}let Yk=class extends se{constructor(){super(...arguments),this._controller=new Gk(this)}willUpdate(e){e.has("config")&&this.config&&this._controller.setConfig(this.config),e.has("items")&&this._controller.setItems(this.items??[])}render(){if(this._controller.shouldRender())return q` +
+ ${this._controller.getRenderItems().map((e=>{if(!1===e.enabled)return;const t=_e({item:!0,expand:!!e.expand,action:!!Object.keys(e.actions??{}).length}),n=Cf({hasHold:yf(e.actions?.hold_action),hasDoubleClick:yf(e.actions?.double_tap_action)});if("custom:frigate-card-status-bar-string"===e.type)return q`
this._controller.actionHandler(t,e.actions)} + > + ${e.string} +
`;if("custom:frigate-card-status-bar-icon"===e.type){const a=Bk(e.icon);return a?q`this._controller.actionHandler(t,e.actions)} + />`:q`this._controller.actionHandler(t,e.actions)} + >`}return"custom:frigate-card-status-bar-image"===e.type?q`this._controller.actionHandler(t,e.actions)} + />`:void 0}))} +
+ `}static get styles(){return o("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n --mdc-icon-button-size: calc(var(--frigate-card-status-bar-height) - 6px);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n display: block;\n width: 100%;\n pointer-events: auto;\n opacity: 1;\n transition: opacity 1s;\n}\n\n/*******************************************************\n * Non-hover styles should not interact with the pointer\n *******************************************************/\n:host(:not([data-style*=hover])) {\n pointer-events: none;\n}\n\n/***************\n * Outside style\n ***************/\n:host([data-style=outside]) {\n color: var(--primary-text-color);\n background: var(--secondary-background-color);\n}\n\n/*******************\n * Non-outside style\n *******************/\n:host(:not([data-style=outside])) {\n color: white;\n background: linear-gradient(90deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=popup][hide]) {\n opacity: 0;\n}\n\n/*********************\n * Status bar contents\n *********************/\n.status {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n overflow: hidden;\n width: 100%;\n height: var(--frigate-card-status-bar-height);\n}\n\n.item {\n display: inline-block;\n margin: 3px;\n padding: 3px;\n align-content: center;\n opacity: 0.7;\n}\n\n.item:first-child {\n margin-left: 10px;\n}\n\n.item:last-child {\n margin-right: 10px;\n}\n\n.item.expand {\n flex: 1;\n}\n\n.item.action {\n cursor: pointer;\n}\n\nimg.item {\n width: var(--mdc-icon-size, 24px);\n height: var(--mdc-icon-size, 24px);\n}")}};e([he({attribute:!1})],Yk.prototype,"items",void 0),e([he({attribute:!1})],Yk.prototype,"config",void 0),Yk=e([le("frigate-card-status-bar")],Yk);function Kk(e){return"number"==typeof e}function Xk(e){return"string"==typeof e}function Jk(e){return"boolean"==typeof e}function eS(e){return"[object Object]"===Object.prototype.toString.call(e)}function tS(e){return Math.abs(e)}function nS(e){return Math.sign(e)}function aS(e,t){return tS(e-t)}function iS(e){return lS(e).map(Number)}function rS(e){return e[oS(e)]}function oS(e){return Math.max(0,e.length-1)}function sS(e,t){return t===oS(e)}function cS(e,t=0){return Array.from(Array(e),((e,n)=>t+n))}function lS(e){return Object.keys(e)}function dS(e,t){return[e,t].reduce(((e,t)=>(lS(t).forEach((n=>{const a=e[n],i=t[n],r=eS(a)&&eS(i);e[n]=r?dS(a,i):i})),e)),{})}function uS(e,t){return void 0!==t.MouseEvent&&e instanceof t.MouseEvent}function hS(){let e=[];const t={add:function(n,a,i,r={passive:!0}){let o;if("addEventListener"in n)n.addEventListener(a,i,r),o=()=>n.removeEventListener(a,i,r);else{const e=n;e.addListener(i),o=()=>e.removeListener(i)}return e.push(o),t},clear:function(){e=e.filter((e=>e()))}};return t}function pS(e,t,n,a){const i=hS(),r=1e3/60;let o=null,s=0,c=0;function l(e){if(!c)return;o||(o=e);const i=e-o;for(o=e,s+=i;s>=r;)n(r),s-=r;a(s/r),c&&t.requestAnimationFrame(l)}function d(){t.cancelAnimationFrame(c),o=null,s=0,c=0}return{init:function(){i.add(e,"visibilitychange",(()=>{e.hidden&&(o=null,s=0)}))},destroy:function(){d(),i.clear()},start:function(){c||(c=t.requestAnimationFrame(l))},stop:d,update:()=>n(r),render:a}}function mS(e=0,t=0){const n=tS(e-t);function a(t){return tt}function r(e){return a(e)||i(e)}const o={length:n,max:t,min:e,constrain:function(n){return r(n)?a(n)?e:t:n},reachedAny:r,reachedMax:i,reachedMin:a,removeOffset:function(e){return n?e-n*Math.ceil((e-t)/n):e}};return o}function gS(e,t,n){const{constrain:a}=mS(0,e),i=e+1;let r=o(t);function o(e){return n?tS((i+e)%i):a(e)}function s(){return r}function c(){return gS(e,s(),n)}const l={get:s,set:function(e){return r=o(e),l},add:function(e){return c().set(s()+e)},clone:c};return l}function fS(e,t,n,a,i,r,o,s,c,l,d,u,h,p,m,g,f,_,y){const{cross:v,direction:b}=e,w=["INPUT","SELECT","TEXTAREA"],x={passive:!1},C=hS(),M=hS(),k=mS(50,225).constrain(p.measure(20)),S={mouse:300,touch:400},E={mouse:500,touch:600},$=m?43:25;let A=!1,I=0,z=0,T=!1,j=!1,O=!1,D=!1;function R(e){if(!uS(e,a)&&e.touches.length>=2)return P(e);const t=r.readPoint(e),n=r.readPoint(e,v),o=aS(t,I),c=aS(n,z);if(!j&&!D){if(!e.cancelable)return P(e);if(j=o>c,!j)return P(e)}const d=r.pointerMove(e);o>g&&(O=!0),l.useFriction(.3).useDuration(.75),s.start(),i.add(b(d)),e.preventDefault()}function P(e){const t=d.byDistance(0,!1).index!==u.get(),n=r.pointerUp(e)*(m?E:S)[D?"mouse":"touch"],a=function(e,t){const n=u.add(-1*nS(e)),a=d.byDistance(e,!m).distance;return m||tS(e)=2,s&&0!==e.button)return;if(function(e){const t=e.nodeName||"";return w.includes(t)}(e.target))return;T=!0,r.pointerDown(e),l.useFriction(0).useDuration(0),i.set(o),function(){const e=D?n:t;M.add(e,"touchmove",R,x).add(e,"touchend",P).add(e,"mousemove",R,x).add(e,"mouseup",P)}(),I=r.readPoint(e),z=r.readPoint(e,v),h.emit("pointerDown")}(s)}const c=t;C.add(c,"dragstart",(e=>e.preventDefault()),x).add(c,"touchmove",(()=>{}),x).add(c,"touchend",(()=>{})).add(c,"touchstart",s).add(c,"mousedown",s).add(c,"touchcancel",P).add(c,"contextmenu",P).add(c,"click",L,!0)},destroy:function(){C.clear(),M.clear()},pointerDown:function(){return T}}}function _S(e,t){let n,a;function i(e){return e.timeStamp}function r(n,a){const i="client"+("x"===(a||e.scroll)?"X":"Y");return(uS(n,t)?n:n.touches[0])[i]}return{pointerDown:function(e){return n=e,a=e,r(e)},pointerMove:function(e){const t=r(e)-r(a),o=i(e)-i(n)>170;return a=e,o&&(n=e),t},pointerUp:function(e){if(!n||!a)return 0;const t=r(a)-r(n),o=i(e)-i(n),s=i(e)-i(a)>170,c=t/o;return o&&!s&&tS(c)>.1?c:0},readPoint:r}}function yS(e,t,n,a,i,r,o){const s=[e].concat(a);let c,l,d=[],u=!1;function h(e){return i.measureSize(o.measure(e))}return{init:function(i){r&&(l=h(e),d=a.map(h),c=new ResizeObserver((n=>{(Jk(r)||r(i,n))&&function(n){for(const r of n){if(u)return;const n=r.target===e,o=a.indexOf(r.target),s=n?l:d[o];if(tS(h(n?e:a[o])-s)>=.5){i.reInit(),t.emit("resize");break}}}(n)})),n.requestAnimationFrame((()=>{s.forEach((e=>c.observe(e)))})))},destroy:function(){u=!0,c&&c.disconnect()}}}function vS(e,t,n,a,i){const r=i.measure(10),o=i.measure(50),s=mS(.1,.99);let c=!1;function l(){return!c&&(!!e.reachedAny(n.get())&&!!e.reachedAny(t.get()))}return{shouldConstrain:l,constrain:function(i){if(!l())return;const c=e.reachedMin(t.get())?"min":"max",d=tS(e[c]-t.get()),u=n.get()-t.get(),h=s.constrain(d/o);n.subtract(u*h),!i&&tS(u)e.add(i)))}};return c}function wS(e,t,n,a,i){const{reachedAny:r,removeOffset:o,constrain:s}=a;function c(e){return e.concat().sort(((e,t)=>tS(e)-tS(t)))[0]}function l(t,a){const i=[t,t+n,t-n];if(!e)return t;if(!a)return c(i);const r=i.filter((e=>nS(e)===a));return r.length?c(r):rS(i)-n}return{byDistance:function(n,a){const c=i.get()+n,{index:d,distance:u}=function(n){const a=e?o(n):s(n),i=t.map(((e,t)=>({diff:l(e-a,0),index:t}))).sort(((e,t)=>tS(e.diff)-tS(t.diff))),{index:r}=i[0];return{index:r,distance:a}}(c),h=!e&&r(c);return!a||h?{index:d,distance:n}:{index:d,distance:n+l(t[d]-u,0)}},byIndex:function(e,n){return{index:e,distance:l(t[e]-i.get(),n)}},shortcut:l}}function xS(e,t,n,a,i,r,o,s){const c={passive:!0,capture:!0};let l=0;function d(e){"Tab"===e.code&&(l=(new Date).getTime())}return{init:function(u){s&&(r.add(document,"keydown",d,!1),t.forEach(((t,d)=>{r.add(t,"focus",(t=>{(Jk(s)||s(u,t))&&function(t){if((new Date).getTime()-l>10)return;o.emit("slideFocusStart"),e.scrollLeft=0;const r=n.findIndex((e=>e.includes(t)));Kk(r)&&(i.useDuration(0),a.index(r,0),o.emit("slideFocus"))}(d)}),c)})))}}}function CS(e){let t=e;function n(e){return Kk(e)?e:e.get()}const a={get:function(){return t},set:function(e){t=n(e)},add:function(e){t+=n(e)},subtract:function(e){t-=n(e)}};return a}function MS(e,t){const n="x"===e.scroll?function(e){return`translate3d(${e}px,0px,0px)`}:function(e){return`translate3d(0px,${e}px,0px)`},a=t.style;let i=!1;return{clear:function(){i||(a.transform="",t.getAttribute("style")||t.removeAttribute("style"))},to:function(t){i||(a.transform=n(e.direction(t)))},toggleActive:function(e){i=!e}}}function kS(e,t,n,a,i,r,o,s,c){const l=.5,d=iS(i),u=iS(i).reverse(),h=function(){const e=o[0];return g(m(u,e),n,!1)}().concat(function(){const e=t-o[0]-1;return g(m(d,e),-n,!0)}());function p(e,t){return e.reduce(((e,t)=>e-i[t]),t)}function m(e,t){return e.reduce(((e,n)=>p(e,t)>0?e.concat([n]):e),[])}function g(i,o,d){const u=function(e){return r.map(((n,i)=>({start:n-a[i]+l+e,end:n+t-l+e})))}(o);return i.map((t=>{const a=d?0:-n,i=d?n:0,r=d?"end":"start",o=u[t][r];return{index:t,loopPoint:o,slideLocation:CS(-1),translate:MS(e,c[t]),target:()=>s.get()>o?a:i}}))}const f={canLoop:function(){return h.every((({index:e})=>{const n=d.filter((t=>t!==e));return p(n,t)<=.1}))},clear:function(){h.forEach((e=>e.translate.clear()))},loop:function(){h.forEach((e=>{const{target:t,translate:n,slideLocation:a}=e,i=t();i!==a.get()&&(n.to(i),a.set(i))}))},loopPoints:h};return f}function SS(e,t,n){let a,i=!1;return{init:function(r){n&&(a=new MutationObserver((e=>{i||(Jk(n)||n(r,e))&&function(e){for(const n of e)if("childList"===n.type){r.reInit(),t.emit("slidesChanged");break}}(e)})),a.observe(e,{childList:!0}))},destroy:function(){a&&a.disconnect(),i=!0}}}function ES(e,t,n,a){const i={};let r,o=null,s=null,c=!1;return{init:function(){r=new IntersectionObserver((e=>{c||(e.forEach((e=>{const n=t.indexOf(e.target);i[n]=e})),o=null,s=null,n.emit("slidesInView"))}),{root:e.parentElement,threshold:a}),t.forEach((e=>r.observe(e)))},destroy:function(){r&&r.disconnect(),c=!0},get:function(e=!0){if(e&&o)return o;if(!e&&s)return s;const t=function(e){return lS(i).reduce(((t,n)=>{const a=parseInt(n),{isIntersecting:r}=i[a];return(e&&r||!e&&!r)&&t.push(a),t}),[])}(e);return e&&(o=t),e||(s=t),t}}}function $S(e,t,n,a,i,r,o,s,c){const{startEdge:l,endEdge:d,direction:u}=e,h=Kk(n);const p={groupSlides:function(e){return h?function(e,t){return iS(e).filter((e=>e%t==0)).map((n=>e.slice(n,n+t)))}(e,n):function(e){return e.length?iS(e).reduce(((n,h,p)=>{const m=rS(n)||0,g=0===m,f=h===oS(e),_=i[l]-r[m][l],y=i[l]-r[h][d],v=!a&&g?u(o):0,b=tS(y-(!a&&f?u(s):0)-(_+v));return p&&b>t+c&&n.push(h),f&&n.push(e.length),n}),[]).map(((t,n,a)=>{const i=Math.max(a[n-1]||0);return e.slice(i,t)})):[]}(e)}};return p}function AS(e,t,n,a,i,r,o){const{align:s,axis:c,direction:l,startIndex:d,loop:u,duration:h,dragFree:p,dragThreshold:m,inViewThreshold:g,slidesToScroll:f,skipSnaps:_,containScroll:y,watchResize:v,watchSlides:b,watchDrag:w,watchFocus:x}=r,C={measure:function(e){const{offsetTop:t,offsetLeft:n,offsetWidth:a,offsetHeight:i}=e;return{top:t,right:n+a,bottom:t+i,left:n,width:a,height:i}}},M=C.measure(t),k=n.map(C.measure),S=function(e,t){const n="rtl"===t,a="y"===e,i=!a&&n?-1:1,r={scroll:a?"y":"x",cross:a?"x":"y",startEdge:a?"top":n?"right":"left",endEdge:a?"bottom":n?"left":"right",measureSize:function(e){const{height:t,width:n}=e;return a?t:n},direction:function(e){return e*i}};return r}(c,l),E=S.measureSize(M),$=function(e){const t={measure:function(t){return e*(t/100)}};return t}(E),A=function(e,t){const n={start:function(){return 0},center:function(e){return a(e)/2},end:a};function a(e){return t-e}const i={measure:function(a,i){return Xk(e)?n[e](a):e(t,a,i)}};return i}(s,E),I=!u&&!!y,z=u||!!y,{slideSizes:T,slideSizesWithGaps:j,startGap:O,endGap:D}=function(e,t,n,a,i,r){const{measureSize:o,startEdge:s,endEdge:c}=e,l=n[0]&&i,d=function(){if(!l)return 0;const e=n[0];return tS(t[s]-e[s])}(),u=function(){if(!l)return 0;const e=r.getComputedStyle(rS(a));return parseFloat(e.getPropertyValue(`margin-${c}`))}(),h=n.map(o),p=n.map(((e,t,n)=>{const a=!t,i=sS(n,t);return a?h[t]+d:i?h[t]+u:n[t+1][s]-e[s]})).map(tS);return{slideSizes:h,slideSizesWithGaps:p,startGap:d,endGap:u}}(S,M,k,n,z,i),R=$S(S,E,f,u,M,k,O,D,2),{snaps:P,snapsAligned:L}=function(e,t,n,a,i){const{startEdge:r,endEdge:o}=e,{groupSlides:s}=i,c=s(a).map((e=>rS(e)[o]-e[0][r])).map(tS).map(t.measure),l=a.map((e=>n[r]-e[r])).map((e=>-tS(e))),d=s(l).map((e=>e[0])).map(((e,t)=>e+c[t]));return{snaps:l,snapsAligned:d}}(S,A,M,k,R),N=-rS(P)+rS(j),{snapsContained:F,scrollContainLimit:V}=function(e,t,n,a,i){const r=mS(-t+e,0),o=n.map(((e,t)=>{const{min:a,max:i}=r,o=r.constrain(e),s=!t,l=sS(n,t);return s?i:l||c(a,o)?a:c(i,o)?i:o})).map((e=>parseFloat(e.toFixed(3)))),s=function(){const e=o[0],t=rS(o);return mS(o.lastIndexOf(e),o.indexOf(t)+1)}();function c(e,t){return aS(e,t)<1}return{snapsContained:function(){if(t<=e+i)return[r.max];if("keepSnaps"===a)return o;const{min:n,max:c}=s;return o.slice(n,c)}(),scrollContainLimit:s}}(E,N,L,y,2),H=I?F:L,{limit:B}=function(e,t,n){const a=t[0];return{limit:mS(n?a-e:rS(t),a)}}(N,H,u),q=gS(oS(H),d,u),U=q.clone(),W=iS(n),Z=pS(a,i,(e=>(({dragHandler:e,scrollBody:t,scrollBounds:n,options:{loop:a}},i)=>{a||n.constrain(e.pointerDown()),t.seek(i)})(se,e)),(e=>(({scrollBody:e,translate:t,location:n,offsetLocation:a,scrollLooper:i,slideLooper:r,dragHandler:o,animation:s,eventHandler:c,scrollBounds:l,options:{loop:d}},u)=>{const h=e.settled(),p=!l.shouldConstrain(),m=d?h:h&&p;m&&!o.pointerDown()&&(s.stop(),c.emit("settle")),m||c.emit("scroll");const g=n.get()*u+Y.get()*(1-u);a.set(g),d&&(i.loop(e.direction()),r.loop()),t.to(a.get())})(se,e))),Q=H[q.get()],G=CS(Q),Y=CS(Q),K=CS(Q),X=CS(Q),J=function(e,t,n,a,i,r){let o=0,s=0,c=i,l=r,d=e.get(),u=0;function h(e){return c=e,m}function p(e){return l=e,m}const m={direction:function(){return s},duration:function(){return c},velocity:function(){return o},seek:function(t){const i=t/1e3,r=c*i,h=a.get()-e.get();let p=0;return c?(n.set(e),o+=h/r,o*=l,d+=o,e.add(o*i),p=d-u):(o=0,n.set(a),e.set(a),p=h),s=nS(p),u=d,m},settled:function(){return tS(a.get()-t.get())<.001},useBaseFriction:function(){return p(r)},useBaseDuration:function(){return h(i)},useFriction:p,useDuration:h};return m}(G,K,Y,X,h,.68),ee=wS(u,H,N,B,X),te=function(e,t,n,a,i,r,o){function s(i){const s=i.distance,c=i.index!==t.get();r.add(s),s&&(a.duration()?e.start():(e.update(),e.render(1),e.update())),c&&(n.set(t.get()),t.set(i.index),o.emit("select"))}const c={distance:function(e,t){s(i.byDistance(e,t))},index:function(e,n){const a=t.clone().set(e);s(i.byIndex(a.get(),n))}};return c}(Z,q,U,J,ee,X,o),ne=function(e){const{max:t,length:n}=e,a={get:function(e){return n?(e-t)/-n:0}};return a}(B),ae=hS(),ie=ES(t,n,o,g),{slideRegistry:re}=function(e,t,n,a,i,r){const{groupSlides:o}=i,{min:s,max:c}=a;return{slideRegistry:function(){const a=o(r),i=!e||"keepSnaps"===t;return 1===n.length?[r]:i?a:a.slice(s,c).map(((e,t,n)=>{const a=!t,i=sS(n,t);return a?cS(rS(n[0])+1):i?cS(oS(r)-rS(n)[0]+1,rS(n)[0]):e}))}()}}(I,y,H,V,R,W),oe=xS(e,n,re,te,J,ae,o,x),se={ownerDocument:a,ownerWindow:i,eventHandler:o,containerRect:M,slideRects:k,animation:Z,axis:S,dragHandler:fS(S,e,a,i,X,_S(S,i),G,Z,te,J,ee,q,o,$,p,m,_,.68,w),eventStore:ae,percentOfView:$,index:q,indexPrevious:U,limit:B,location:G,offsetLocation:K,previousLocation:Y,options:r,resizeHandler:yS(t,o,i,n,S,v,C),scrollBody:J,scrollBounds:vS(B,K,X,J,$),scrollLooper:bS(N,B,K,[G,K,Y,X]),scrollProgress:ne,scrollSnapList:H.map(ne.get),scrollSnaps:H,scrollTarget:ee,scrollTo:te,slideLooper:kS(S,E,N,T,j,P,H,K,n),slideFocus:oe,slidesHandler:SS(t,o,b),slidesInView:ie,slideIndexes:W,slideRegistry:re,slidesToScroll:R,target:X,translate:MS(S,t)};return se}const IS={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0,watchFocus:!0};function zS(e){function t(e,t){return dS(e,t||{})}const n={mergeOptions:t,optionsAtMedia:function(n){const a=n.breakpoints||{},i=lS(a).filter((t=>e.matchMedia(t).matches)).map((e=>a[e])).reduce(((e,n)=>t(e,n)),{});return t(n,i)},optionsMediaQueries:function(t){return t.map((e=>lS(e.breakpoints||{}))).reduce(((e,t)=>e.concat(t)),[]).map(e.matchMedia)}};return n}function TS(e,t,n){const a=e.ownerDocument,i=a.defaultView,r=zS(i),o=function(e){let t=[];const n={init:function(n,a){return t=a.filter((({options:t})=>!1!==e.optionsAtMedia(t).active)),t.forEach((t=>t.init(n,e))),a.reduce(((e,t)=>Object.assign(e,{[t.name]:t})),{})},destroy:function(){t=t.filter((e=>e.destroy()))}};return n}(r),s=hS(),c=function(){let e,t={};function n(e){return t[e]||[]}const a={init:function(t){e=t},emit:function(t){return n(t).forEach((n=>n(e,t))),a},off:function(e,i){return t[e]=n(e).filter((e=>e!==i)),a},on:function(e,i){return t[e]=n(e).concat([i]),a},clear:function(){t={}}};return a}(),{mergeOptions:l,optionsAtMedia:d,optionsMediaQueries:u}=r,{on:h,off:p,emit:m}=c,g=S;let f,_,y,v,b=!1,w=l(IS,TS.globalOptions),x=l(w),C=[];function M(t){const n=AS(e,y,v,a,i,t,c);if(t.loop&&!n.slideLooper.canLoop()){return M(Object.assign({},t,{loop:!1}))}return n}function k(t,n){b||(w=l(w,t),x=d(w),C=n||C,function(){const{container:t,slides:n}=x,a=Xk(t)?e.querySelector(t):t;y=a||e.children[0];const i=Xk(n)?y.querySelectorAll(n):n;v=[].slice.call(i||y.children)}(),f=M(x),u([w,...C.map((({options:e})=>e))]).forEach((e=>s.add(e,"change",S))),x.active&&(f.translate.to(f.location.get()),f.animation.init(),f.slidesInView.init(),f.slideFocus.init(I),f.eventHandler.init(I),f.resizeHandler.init(I),f.slidesHandler.init(I),f.options.loop&&f.slideLooper.loop(),y.offsetParent&&v.length&&f.dragHandler.init(I),_=o.init(I,C)))}function S(e,t){const n=A();E(),k(l({startIndex:n},e),t),c.emit("reInit")}function E(){f.dragHandler.destroy(),f.eventStore.clear(),f.translate.clear(),f.slideLooper.clear(),f.resizeHandler.destroy(),f.slidesHandler.destroy(),f.slidesInView.destroy(),f.animation.destroy(),o.destroy(),s.clear()}function $(e,t,n){x.active&&!b&&(f.scrollBody.useBaseFriction().useDuration(!0===t?0:x.duration),f.scrollTo.index(e,n||0))}function A(){return f.index.get()}const I={canScrollNext:function(){return f.index.add(1).get()!==A()},canScrollPrev:function(){return f.index.add(-1).get()!==A()},containerNode:function(){return y},internalEngine:function(){return f},destroy:function(){b||(b=!0,s.clear(),E(),c.emit("destroy"),c.clear())},off:p,on:h,emit:m,plugins:function(){return _},previousScrollSnap:function(){return f.indexPrevious.get()},reInit:g,rootNode:function(){return e},scrollNext:function(e){$(f.index.add(1).get(),e,-1)},scrollPrev:function(e){$(f.index.add(-1).get(),e,1)},scrollProgress:function(){return f.scrollProgress.get(f.location.get())},scrollSnapList:function(){return f.scrollSnapList},scrollTo:$,selectedScrollSnap:A,slideNodes:function(){return v},slidesInView:function(){return f.slidesInView.get()},slidesNotInView:function(){return f.slidesInView.get(!1)}};return k(t,n),setTimeout((()=>c.emit("init")),0),I}function jS(){return jS=Object.assign||function(e){for(var t=1;t=e;case"y":return Math.abs(i)>=e;case"z":return Math.abs(r)>=e;default:return!1}}(r,a)&&e.preventDefault(),l.isStarted?l.isMomentum&&r>Math.max(2,2*l.lastAbsDelta)&&(M(!0),x()):x(),0===r&&Object.is&&Object.is(e.deltaX,-0)?d=!0:(t=e,l.axisMovement=DS(l.axisMovement,a),l.lastAbsDelta=r,l.scrollPointsToMerge.push({axisDelta:a,timeStamp:i}),g(),p({axisDelta:a,isStart:!l.isStartPublished}),l.isStartPublished=!0,C())},g=function(){var e;l.scrollPointsToMerge.length===BS?(l.scrollPoints.unshift({axisDeltaSum:l.scrollPointsToMerge.map((function(e){return e.axisDelta})).reduce(DS),timeStamp:(e=l.scrollPointsToMerge.map((function(e){return e.timeStamp})),e.reduce((function(e,t){return e+t}))/e.length)}),_(),l.scrollPointsToMerge.length=0,l.scrollPoints.length=1,l.isMomentum||b()):l.isStartPublished||f()},f=function(){var e;l.axisVelocity=(e=l.scrollPointsToMerge,e[e.length-1]).axisDelta.map((function(e){return e/l.willEndTimeout}))},_=function(){var e=l.scrollPoints,t=e[0],n=e[1];if(n&&t){var a=t.timeStamp-n.timeStamp;if(!(a<=0)){var i=t.axisDeltaSum.map((function(e){return e/a})),r=i.map((function(e,t){return e/(l.axisVelocity[t]||1)}));l.axisVelocity=i,l.accelerationFactors.push(r),y(a)}}},y=function(e){var t=10*Math.ceil(e/10)*1.2;l.isMomentum||(t=Math.max(100,2*t)),l.willEndTimeout=Math.min(1e3,Math.round(t))},v=function(e){return 0===e||e<=HS&&e>=VS},b=function(){if(l.accelerationFactors.length>=qS){if(d&&(d=!1,RS(l.axisVelocity)>=.2))return void w();var e=l.accelerationFactors.slice(-1*qS);e.every((function(e){var t=!!e.reduce((function(e,t){return e&&e<1&&e===t?1:0})),n=e.filter(v).length===e.length;return t||n}))&&w(),l.accelerationFactors=e}},w=function(){l.isMomentum=!0},x=function(){(l=ZS()).isStarted=!0,l.startTime=Date.now(),n=void 0,d=!1},C=function(){clearTimeout(a),a=setTimeout(M,l.willEndTimeout)},M=function(e){void 0===e&&(e=!1),l.isStarted&&(l.isMomentum&&e?p({isEnding:!0,isMomentumCancel:!0}):p({isEnding:!0}),l.isMomentum=!1,l.isStarted=!1)},k=function(e){var t=[],n=function(n){n.removeEventListener("wheel",e),t=t.filter((function(e){return e!==n}))};return PS({observe:function(a){return a.addEventListener("wheel",e,{passive:!1}),t.push(a),function(){return n(a)}},unobserve:n,disconnect:function(){t.forEach(n)}})}(u),S=k.observe,E=k.unobserve,$=k.disconnect;return h(e),PS({on:r,off:o,observe:S,unobserve:E,disconnect:$,feedWheel:u,updateOptions:h})}var GS={active:!0,breakpoints:{},wheelDraggingClass:"is-wheel-dragging",forceWheelAxis:void 0,target:void 0};function YS(e){var t;void 0===e&&(e={});var n=function(){};var a={name:"wheelGestures",options:e,init:function(a,i){var r,o,s=i.mergeOptions,c=i.optionsAtMedia,l=s(GS,YS.globalOptions),d=s(l,e);t=c(d);var u,h=a.internalEngine(),p=null!=(r=t.target)?r:a.containerNode().parentNode,m=null!=(o=t.forceWheelAxis)?o:h.options.axis,g=QS({preventWheelAction:m,reverseSign:[!0,!0,!1]}),f=g.observe(p),_=g.on("wheel",(function(e){var a=e.axisDelta,i=a[0],r=a[1],o="x"===m?i:r,s="x"===m?r:i,c=e.isMomentum&&e.previous&&!e.previous.isMomentum,l=e.isEnding&&!e.isMomentum||c;Math.abs(o)>Math.abs(s)&&!y&&!e.isMomentum&&function(e){try{x(u=new MouseEvent("mousedown",e.event))}catch(e){return n()}y=!0,document.documentElement.addEventListener("mousemove",b,!0),document.documentElement.addEventListener("mouseup",b,!0),void document.documentElement.addEventListener("mousedown",b,!0),t.wheelDraggingClass&&p.classList.add(t.wheelDraggingClass)}(e);if(!y)return;l?function(e){y=!1,x(w("mouseup",e)),v(),t.wheelDraggingClass&&p.classList.remove(t.wheelDraggingClass)}(e):x(w("mousemove",e))})),y=!1;function v(){document.documentElement.removeEventListener("mousemove",b,!0),document.documentElement.removeEventListener("mouseup",b,!0),document.documentElement.removeEventListener("mousedown",b,!0)}function b(e){y&&e.isTrusted&&e.stopImmediatePropagation()}function w(e,t){var n,a;if(m===h.options.axis){var i=t.axisMovement;n=i[0],a=i[1]}else{var r=t.axisMovement;a=r[0],n=r[1]}if(!h.options.skipSnaps&&!h.options.dragFree){var o=h.containerRect.width,s=h.containerRect.height;n=n<0?Math.max(n,-o):Math.min(n,o),a=a<0?Math.max(a,-s):Math.min(a,s)}return new MouseEvent(e,{clientX:u.clientX+n,clientY:u.clientY+a,screenX:u.screenX+n,screenY:u.screenY+a,movementX:n,movementY:a,button:0,bubbles:!0,cancelable:!0,composed:!0})}function x(e){a.containerNode().dispatchEvent(e)}n=function(){f(),_(),v()}},destroy:function(){return n()}};return a}YS.globalOptions=void 0;class KS{constructor(e,t,n){this._mutationObserver=new MutationObserver(((e,t)=>this._refreshCarouselContents())),this._refreshCarouselContents=()=>{const e=sf(this._parent);!jy(this._carousel.slideNodes(),e)&&(this._carousel.destroy(),this._carousel=this._createCarousel(e))},this._root=e,this._parent=t,this._direction=n?.direction??"horizontal",this._transitionEffect=n?.transitionEffect??"slide",this._startIndex=n?.startIndex??0,this._dragFree=n?.dragFree??!1,this._loop=n?.loop??!1,this._draggable=n?.dragEnabled??!0,this._plugins=n?.plugins??[],this._textDirection=n?.textDirection??"ltr",this._carousel=this._createCarousel(sf(this._parent)),t instanceof HTMLSlotElement&&t.addEventListener("slotchange",this._refreshCarouselContents),this._mutationObserver.observe(this._parent,{childList:!0})}destroy(){this._parent instanceof HTMLSlotElement&&this._parent.removeEventListener("slotchange",this._refreshCarouselContents),this._mutationObserver.disconnect(),this._carousel.destroy()}getSlide(e){return this._carousel.slideNodes()[e]??null}getSelectedSlide(){return this.getSlide(this.getSelectedIndex())}getSelectedIndex(){return this._carousel.selectedScrollSnap()}selectSlide(e){this._carousel.scrollTo(e,"none"===this._transitionEffect);const t=this.getSlide(e);t&&Vg(this._parent,"carousel:force-select",{index:e,element:t})}_createCarousel(e){const t=TS(this._root,{slides:e,axis:"horizontal"===this._direction?"x":"y",duration:20,startIndex:this._startIndex,dragFree:this._dragFree,loop:this._loop,containScroll:"trimSnaps",watchSlides:!1,watchResize:!0,watchDrag:this._draggable,direction:this._textDirection},[...this._plugins,...e.length>1?[YS({forceWheelAxis:"y"})]:[]]),n=()=>{const e=(()=>{const e=t.selectedScrollSnap(),n=t.slideNodes()[e]??null;return n?{index:e,element:n}:null})();e&&Vg(this._parent,"carousel:select",e)};return t.on("select",(()=>n())),t}}const XS=e=>"rtl"===getComputedStyle(e).direction?"rtl":"ltr";let JS=class extends se{constructor(){super(...arguments),this.direction="horizontal",this.dragEnabled=!0,this.selected=0,this._refParent=Ie(),this._refRoot=Ie(),this._carousel=null}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._carousel?.destroy(),this._carousel=null,super.disconnectedCallback()}willUpdate(e){e.has("direction")&&this.setAttribute("direction",this.direction);["direction","dragEnabled","dragFree","loop","plugins","transitionEffect"].some((t=>e.has(t)))&&(this._carousel?.destroy(),this._carousel=null)}render(){return q`
+ +
+
+ +
+
+ +
`}updated(e){!this._carousel&&this._refRoot.value&&this._refParent.value?this._carousel=new KS(this._refRoot.value,this._refParent.value,{direction:this.direction,dragEnabled:this.dragEnabled,dragFree:this.dragFree,startIndex:this.selected,transitionEffect:this.transitionEffect,loop:this.loop,plugins:this.plugins,textDirection:XS(this)}):e.has("selected")&&this._carousel?.selectSlide(this.selected)}static get styles(){return o(":host {\n display: block;\n height: 100%;\n width: 100%;\n position: relative;\n}\n\n.embla {\n width: 100%;\n height: 100%;\n margin-left: auto;\n margin-right: auto;\n}\n\n.embla__container {\n display: flex;\n width: 100%;\n height: 100%;\n user-select: none;\n -webkit-touch-callout: none;\n -khtml-user-select: none;\n -webkit-tap-highlight-color: transparent;\n}\n\n:host([direction=vertical]) .embla__container {\n flex-direction: column;\n}\n\n:host([direction=horizontal]) .embla__container {\n flex-direction: row;\n}\n\n.embla__viewport {\n width: 100%;\n height: 100%;\n overflow: hidden;\n display: flex;\n flex-direction: column;\n justify-content: center;\n}\n\n.embla__viewport.is-draggable {\n cursor: move;\n cursor: grab;\n}\n\n.embla__viewport.is-dragging {\n cursor: grabbing;\n}\n\n:host([direction=vertical]) ::slotted(.embla__slide) {\n margin-bottom: 5px;\n}\n\n:host([direction=horizontal]) ::slotted(.embla__slide) {\n margin-right: 5px;\n}")}};e([he({attribute:!0,reflect:!0})],JS.prototype,"direction",void 0),e([he({attribute:!0})],JS.prototype,"transitionEffect",void 0),e([he({attribute:!1})],JS.prototype,"loop",void 0),e([he({attribute:!1})],JS.prototype,"dragFree",void 0),e([he({attribute:!1})],JS.prototype,"dragEnabled",void 0),e([he({attribute:!1})],JS.prototype,"plugins",void 0),e([he({attribute:!1})],JS.prototype,"selected",void 0),JS=e([le("frigate-card-carousel")],JS); +/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const eE=window,tE=eE.ShadowRoot&&(void 0===eE.ShadyCSS||eE.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,nE=Symbol(),aE=new WeakMap;let iE=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==nE)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(tE&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=aE.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&aE.set(t,e))}return e}toString(){return this.cssText}};const rE=(e,t)=>{tE?e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):t.forEach((t=>{const n=document.createElement("style"),a=eE.litNonce;void 0!==a&&n.setAttribute("nonce",a),n.textContent=t.cssText,e.appendChild(n)}))},oE=tE?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return(e=>new iE("string"==typeof e?e:e+"",void 0,nE))(t)})(e):e +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */;var sE;const cE=window,lE=cE.trustedTypes,dE=lE?lE.emptyScript:"",uE=cE.reactiveElementPolyfillSupport,hE={toAttribute(e,t){switch(t){case Boolean:e=e?dE:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},pE=(e,t)=>t!==e&&(t==t||e==e),mE={attribute:!0,type:String,converter:hE,reflect:!1,hasChanged:pE},gE="finalized";class fE extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var t;this.finalize(),(null!==(t=this.h)&&void 0!==t?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach(((t,n)=>{const a=this._$Ep(n,t);void 0!==a&&(this._$Ev.set(a,n),e.push(a))})),e}static createProperty(e,t=mE){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){const n="symbol"==typeof e?Symbol():"__"+e,a=this.getPropertyDescriptor(e,n,t);void 0!==a&&Object.defineProperty(this.prototype,e,a)}}static getPropertyDescriptor(e,t,n){return{get(){return this[t]},set(a){const i=this[e];this[t]=a,this.requestUpdate(e,i,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||mE}static finalize(){if(this.hasOwnProperty(gE))return!1;this[gE]=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),void 0!==e.h&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const e=this.properties,t=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const n of t)this.createProperty(n,e[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(oE(e))}else void 0!==e&&t.push(oE(e));return t}static _$Ep(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(e=this.constructor.h)||void 0===e||e.forEach((e=>e(this)))}addController(e){var t,n;(null!==(t=this._$ES)&&void 0!==t?t:this._$ES=[]).push(e),void 0!==this.renderRoot&&this.isConnected&&(null===(n=e.hostConnected)||void 0===n||n.call(e))}removeController(e){var t;null===(t=this._$ES)||void 0===t||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])}))}createRenderRoot(){var e;const t=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return rE(t,this.constructor.elementStyles),t}connectedCallback(){var e;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostConnected)||void 0===t?void 0:t.call(e)}))}enableUpdating(e){}disconnectedCallback(){var e;null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostDisconnected)||void 0===t?void 0:t.call(e)}))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EO(e,t,n=mE){var a;const i=this.constructor._$Ep(e,n);if(void 0!==i&&!0===n.reflect){const r=(void 0!==(null===(a=n.converter)||void 0===a?void 0:a.toAttribute)?n.converter:hE).toAttribute(t,n.type);this._$El=e,null==r?this.removeAttribute(i):this.setAttribute(i,r),this._$El=null}}_$AK(e,t){var n;const a=this.constructor,i=a._$Ev.get(e);if(void 0!==i&&this._$El!==i){const e=a.getPropertyOptions(i),r="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==(null===(n=e.converter)||void 0===n?void 0:n.fromAttribute)?e.converter:hE;this._$El=i,this[i]=r.fromAttribute(t,e.type),this._$El=null}}requestUpdate(e,t,n){let a=!0;void 0!==e&&(((n=n||this.constructor.getPropertyOptions(e)).hasChanged||pE)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),!0===n.reflect&&this._$El!==e&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(e,n))):a=!1),!this.isUpdatePending&&a&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((e,t)=>this[t]=e)),this._$Ei=void 0);let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostUpdate)||void 0===t?void 0:t.call(e)})),this.update(n)):this._$Ek()}catch(e){throw t=!1,this._$Ek(),e}t&&this._$AE(n)}willUpdate(e){}_$AE(e){var t;null===(t=this._$ES)||void 0===t||t.forEach((e=>{var t;return null===(t=e.hostUpdated)||void 0===t?void 0:t.call(e)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){void 0!==this._$EC&&(this._$EC.forEach(((e,t)=>this._$EO(t,this[t],e))),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}}fE[gE]=!0,fE.elementProperties=new Map,fE.elementStyles=[],fE.shadowRootOptions={mode:"open"},null==uE||uE({ReactiveElement:fE}),(null!==(sE=cE.reactiveElementVersions)&&void 0!==sE?sE:cE.reactiveElementVersions=[]).push("1.6.3"); +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const _E=0,yE=Symbol();class vE{constructor(e,t,n){this.o=0,this.status=0,this.autoRun=!0,this.i=e,this.i.addController(this);const a="object"==typeof t?t:{task:t,args:n};this.t=a.task,this.h=a.args,void 0!==a.autoRun&&(this.autoRun=a.autoRun),this.taskComplete=new Promise(((e,t)=>{this.l=e,this.u=t}))}hostUpdated(){this.performTask()}async performTask(){var e;const t=null===(e=this.h)||void 0===e?void 0:e.call(this);this.shouldRun(t)&&this.run(t)}shouldRun(e){return this.autoRun&&this.v(e)}async run(e){var t;let n,a;null!=e||(e=null===(t=this.h)||void 0===t?void 0:t.call(this)),2!==this.status&&3!==this.status||(this.taskComplete=new Promise(((e,t)=>{this.l=e,this.u=t}))),this.status=1,this._=void 0,this.m=void 0,this.i.requestUpdate();const i=++this.o;try{n=await this.t(e)}catch(e){a=e}this.o===i&&(n===yE?this.status=0:(void 0===a?(this.status=2,this.l(n)):(this.status=3,this.u(a)),this.m=n,this._=a),this.i.requestUpdate())}get value(){return this.m}get error(){return this._}render(e){var t,n,a,i;switch(this.status){case 0:return null===(t=e.initial)||void 0===t?void 0:t.call(e);case 1:return null===(n=e.pending)||void 0===n?void 0:n.call(e);case 2:return null===(a=e.complete)||void 0===a?void 0:a.call(e,this.value);case 3:return null===(i=e.error)||void 0===i?void 0:i.call(e,this.error);default:this.status}}v(e){const t=this.T;return this.T=e,Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.some(((e,n)=>pE(e,t[n]))):e!==t}}class bE{constructor(e){this._keys=e}modify(e){this._keys.forEach((t=>e.removeContext(t)))}}var wE=":host {\n display: flex;\n flex-direction: column;\n width: 100%;\n margin-left: 5px;\n padding: 5px;\n color: var(--primary-text-color);\n overflow: hidden;\n column-gap: 5%;\n}\n\ndiv.title {\n font-size: 1.2rem;\n font-weight: bold;\n}\n\ndiv.details {\n flex: 1;\n justify-content: center;\n display: flex;\n flex-direction: column;\n flex-wrap: wrap;\n --mdc-icon-size: 16px;\n min-height: 0px;\n}";const xE=(e,t,n)=>{const a={...n?.cardWideConfig&&{cardWideConfig:n.cardWideConfig}};return q` ${e.render({initial:()=>n?.inProgressFunc?.()??wk(a),pending:()=>n?.inProgressFunc?.()??wk(a),error:e=>{Zg(e),n?.errorFunc&&n.errorFunc(e)},complete:t})}`},CE=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,ME=(e,t,n,a=!0)=>new vE(e,{args:()=>[!!t(),n()],task:async([e,n])=>{const a=t();return e&&a&&n?(async(e,t)=>e&&t?t.startsWith("data:")||t.match(CE)?t:new Promise(((n,a)=>{e?e.fetchWithAuth(t).then((e=>e.blob())).then((e=>{const t=new FileReader;t.onload=()=>{const e=t.result;n("string"==typeof e?e:null)},t.onerror=e=>a(e),t.readAsDataURL(e)})).catch((e=>a(e))):a()})):null)(a,n):null},autoRun:a}),kE=300;let SE=class extends se{constructor(){super(),this._thumbnailError=!1,this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}connectedCallback(){this._intersectionObserver.observe(this),super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._intersectionObserver.disconnect()}willUpdate(e){e.has("thumbnail")&&(this._embedThumbnailTask=ME(this,(()=>this.hass),(()=>this.thumbnail),!1),this._intersectionObserver.unobserve(this),this._intersectionObserver.observe(this))}_intersectionHandler(e){this._embedThumbnailTask?.status===_E&&e.some((e=>e.isIntersecting))&&this._embedThumbnailTask?.run()}render(){const e=q` `;return!this._embedThumbnailTask||this._thumbnailError?e:q`${this.thumbnail?xE(this._embedThumbnailTask,(e=>e?q``:q``),{inProgressFunc:()=>e,errorFunc:()=>{this._thumbnailError=!0}}):e} `}static get styles(){return o(":host {\n display: block;\n overflow: hidden;\n aspect-ratio: 1/1;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\nimg {\n display: block;\n}\n\nimg,\nha-icon {\n display: inline-block;\n vertical-align: top;\n margin: 0;\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n width: var(--frigate-card-thumbnail-size);\n max-height: 100%;\n aspect-ratio: 1/1;\n object-fit: cover;\n}\n\nha-icon {\n --mdc-icon-size: 50%;\n color: var(--primary-text-color);\n display: flex;\n justify-content: center;\n align-items: center;\n border: 1px solid rgba(255, 255, 255, 0.3);\n box-sizing: border-box;\n opacity: 0.2;\n}")}};e([he({attribute:!1})],SE.prototype,"thumbnail",void 0),e([he({attribute:!1})],SE.prototype,"hass",void 0),e([pe()],SE.prototype,"_thumbnailError",void 0),SE=e([le("frigate-card-thumbnail-feature-thumbnail")],SE);let EE=class extends se{render(){if(this.date)return q` + ${this.cameraMetadata?.engineLogo?q``:""} +
+
${qu(this.date,"HH:mm")}
+
${qu(this.date,"MMM do")}
+ ${this.showCameraTitle&&this.cameraMetadata?.title?q`
${this.cameraMetadata.title}
`:q``} +
+ `}static get styles(){return o(":host {\n display: block;\n max-width: var(--frigate-card-thumbnail-size);\n max-height: var(--frigate-card-thumbnail-size);\n aspect-ratio: 1/1;\n border: 1px solid var(--secondary-color);\n background-color: var(--secondary-background-color);\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n overflow: hidden;\n padding: 10px;\n box-sizing: border-box;\n position: relative;\n}\n\nimg.background {\n display: block;\n width: 100%;\n height: 100%;\n position: absolute;\n inset: 0;\n padding: 10%;\n box-sizing: border-box;\n pointer-events: none;\n opacity: 0.1;\n}\n\ndiv.content {\n height: 100%;\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n color: var(--primary-text-color);\n}\n\ndiv {\n text-align: center;\n}\n\ndiv.title {\n font-size: 1.5rem;\n}\n\ndiv.camera {\n font-size: 0.7em;\n}")}};e([he({attribute:!1})],EE.prototype,"date",void 0),e([he({attribute:!1})],EE.prototype,"cameraMetadata",void 0),e([he({attribute:!1})],EE.prototype,"showCameraTitle",void 0),EE=e([le("frigate-card-thumbnail-feature-text")],EE);let $E=class extends se{render(){if(!this.media)return;const e=this.media.getScore(),t=e?(100*e).toFixed(2)+"%":null,n=this.media.getStartTime(),a=n?Gg(n):null,i=this.media.getEndTime(),r=n&&i?Xg(n,i):null,o=this.media.inProgress()?N_("event.in_progress"):null,s=Hg(this.media.getWhat()?.join(", "))??null,c=Hg(this.media.getWhere()?.join(", "))??null,l=Hg(this.media.getTags()?.join(", "))??null,d=s||l?(s??"")+(s&&l?": ":"")+(l??""):null,u=this.seek?qu(this.seek,"HH:mm:ss"):null;return q` + ${d?q`
+ ${d} + ${t?q`${t}`:""} +
`:""} +
+ ${a?q`
+ + ${a} +
+ ${r||o?q`
+ + ${r?q`${r}`:""} + ${o?q`${o}`:""} +
`:""}`:""} + ${this.cameraTitle?q`
+ + ${this.cameraTitle} +
`:""} + ${c?q`
+ + ${c} +
`:q``} + ${l?q`
+ + ${l} +
`:q``} + ${u?q`
+ + ${u} +
`:q``} +
+ `}static get styles(){return o(wE)}};e([he({attribute:!1})],$E.prototype,"media",void 0),e([he({attribute:!1})],$E.prototype,"seek",void 0),e([he({attribute:!1})],$E.prototype,"cameraTitle",void 0),$E=e([le("frigate-card-thumbnail-details-event")],$E);let AE=class extends se{render(){if(!this.media)return;const e=this.media.getStartTime(),t=e?Gg(e):null,n=this.media.getEndTime(),a=e&&n?Xg(e,n):null,i=this.media.inProgress()?N_("recording.in_progress"):null,r=this.seek?qu(this.seek,"HH:mm:ss"):null,o=this.media.getEventCount();return q` + ${this.cameraTitle?q`
+ ${this.cameraTitle} +
`:""} +
+ ${t?q`
+ + ${t} +
+ ${a||i?q`
+ + ${a?q`${a}`:""} + ${i?q`${i}`:""} +
`:""}`:""} + ${r?q`
+ + ${r} +
`:q``} + ${null!==o?q`
+ + ${o} +
`:""} +
+ `}static get styles(){return o(wE)}};e([he({attribute:!1})],AE.prototype,"media",void 0),e([he({attribute:!1})],AE.prototype,"seek",void 0),e([he({attribute:!1})],AE.prototype,"cameraTitle",void 0),AE=e([le("frigate-card-thumbnail-details-recording")],AE);let IE=class extends se{constructor(){super(...arguments),this.details=!1,this.show_favorite_control=!1,this.show_timeline_control=!1,this.show_download_control=!1}render(){if(!this.media||!this.cameraManager||!this.hass)return;const e=this.media.getThumbnail(),t=this.media.getTitle()??"",n={star:!0,starred:!!this.media?.isFavorite()},a=this.show_timeline_control&&(!ex.isRecording(this.media)||this.media.getStartTime()&&this.media.getEndTime()),i=this.cameraManager?.getMediaCapabilities(this.media),r=this.show_favorite_control&&this.media&&this.hass&&i?.canFavorite,o=this.show_download_control&&this.hass&&this.media.getID()&&i?.canDownload,s=this.cameraManager.getCameraMetadata(this.media.getCameraID());return q` + ${ex.isEvent(this.media)&&e?q``:ex.isEvent(this.media)||ex.isRecording(this.media)?q``:q``} + ${r?q` {if(vf(e),this.hass&&this.media){try{await(this.cameraManager?.favoriteMedia(this.media,!this.media?.isFavorite()))}catch(e){return void Zg(e)}this.requestUpdate()}}} + />`:""} + ${this.details&&ex.isEvent(this.media)?q``:this.details&&ex.isRecording(this.media)?q``:q``} + ${a?q`{vf(e),this.viewManagerEpoch&&this.media&&this.viewManagerEpoch.manager.setViewByParameters({params:{view:"timeline",queryResults:this.viewManagerEpoch?.manager.getView()?.queryResults?.clone().selectResultIfFound((e=>e===this.media))},modifiers:[new bE(["timeline"])]})}} + >`:""} + ${o?q` {if(vf(e),this.hass&&this.cameraManager&&this.media)try{await Sw(this.hass,this.cameraManager,this.media)}catch(e){Ck(this,e)}}} + >`:""} + `}static get styles(){return o(":host {\n display: flex;\n flex-direction: row;\n box-sizing: border-box;\n position: relative;\n overflow: hidden;\n transition: transform 0.2s linear;\n}\n\n:host(:not([details])) {\n aspect-ratio: 1/1;\n}\n\n:host([details]) {\n border: 1px solid var(--primary-color);\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n padding: 2px;\n background-color: var(--primary-background-color, black);\n}\n\n:host(:hover) {\n transform: scale(1.04);\n}\n\nha-icon {\n position: absolute;\n border-radius: 50%;\n opacity: 0.5;\n color: var(--primary-color);\n cursor: pointer;\n transition: opacity 0.2s ease-in-out, color 0.2s ease-in-out;\n}\n\nha-icon:hover {\n opacity: 1;\n}\n\nha-icon.star {\n top: 3px;\n left: 3px;\n}\n\nha-icon.star.starred {\n color: gold;\n}\n\nha-icon.timeline {\n top: 3px;\n right: 3px;\n}\n\nha-icon.download {\n right: 3px;\n bottom: 3px;\n}\n\nfrigate-card-thumbnail-details-event,\nfrigate-card-thumbnail-details-recording {\n flex: 1;\n}")}};e([he({attribute:!1})],IE.prototype,"cameraManager",void 0),e([he({attribute:!1})],IE.prototype,"media",void 0),e([he({attribute:!0,type:Boolean})],IE.prototype,"details",void 0),e([he({attribute:!0,type:Boolean})],IE.prototype,"show_favorite_control",void 0),e([he({attribute:!0,type:Boolean})],IE.prototype,"show_timeline_control",void 0),e([he({attribute:!0,type:Boolean})],IE.prototype,"show_download_control",void 0),e([he({attribute:!1})],IE.prototype,"seek",void 0),IE=e([le("frigate-card-thumbnail")],IE);let zE=class extends se{constructor(){super(...arguments),this.fadeThumbnails=!1,this._thumbnailSlides=[]}willUpdate(e){if(e.has("config")){this.config?.size&&this.style.setProperty("--frigate-card-thumbnail-size",`${this.config.size}px`);const e=this._getDirection();e?this.setAttribute("direction",e):this.removeAttribute("direction")}["cameraManager","config","transitionEffect","viewManagerEpoch"].some((t=>e.has(t)))&&(this._thumbnailSlides=this._renderSlides()),e.has("viewManagerEpoch")&&this.style.setProperty("--frigate-card-carousel-thumbnail-opacity",this.fadeThumbnails&&null!==this._getSelectedSlide()?"0.4":"1.0")}_getSelectedSlide(){return this.viewManagerEpoch?.manager.getView()?.queryResults?.getSelectedIndex()??null}_renderSlides(){const e=[],t=this.viewManagerEpoch?.manager.getView(),n=t?.context?.mediaViewer?.seek,a=this._getSelectedSlide();for(const i of t?.queryResults?.getResults()??[]){const t=e.length,r={embla__slide:!0,"slide-selected":a===t};e.push(q` {const n=this.viewManagerEpoch?.manager.getView();n&&n.queryResults&&Vg(this,"thumbnail-carousel:tap",{queryResults:n.queryResults.clone().selectIndex(t)}),vf(e)}} + > + `)}return e}_getDirection(){return"left"===this.config?.mode||"right"===this.config?.mode?"vertical":"above"===this.config?.mode||"below"===this.config?.mode?"horizontal":null}render(){const e=this._getDirection();if(this._thumbnailSlides.length&&this.config&&e)return q` + ${this._thumbnailSlides} + `}static get styles(){return o(":host {\n --frigate-card-thumbnail-size-max: 300px;\n --frigate-card-thumbnail-details-width: calc(\n var(--frigate-card-thumbnail-size) + 200px\n );\n}\n\n:host {\n display: block;\n width: 100%;\n height: 100%;\n --frigate-card-carousel-thumbnail-opacity: 1;\n}\n\n:host([direction=vertical]) {\n height: 100%;\n}\n\n:host([direction=horizontal]) {\n height: auto;\n}\n\n.embla__slide {\n flex: 0 0 auto;\n opacity: var(--frigate-card-carousel-thumbnail-opacity);\n}\n\n.embla__slide.slide-selected {\n opacity: 1;\n}\n\nfrigate-card-thumbnail {\n width: var(--frigate-card-thumbnail-size);\n height: var(--frigate-card-thumbnail-size);\n max-width: 100%;\n}\n\nfrigate-card-thumbnail[details] {\n width: var(--frigate-card-thumbnail-details-width);\n}")}};e([he({attribute:!1})],zE.prototype,"hass",void 0),e([he({attribute:!1})],zE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1})],zE.prototype,"cameraManager",void 0),e([he({attribute:!1})],zE.prototype,"config",void 0),e([he({attribute:!1})],zE.prototype,"fadeThumbnails",void 0),zE=e([le("frigate-card-thumbnail-carousel")],zE);var TE=":host {\n width: 100%;\n height: 100%;\n display: block;\n}";const jE=document.createElement("template");jE.innerHTML='\n
\n
\n';class OE extends HTMLElement{constructor(){super();const e=this.attachShadow({mode:"open"});e.appendChild(jE.content.cloneNode(!0)),this._freeSpaceDiv=e.getElementById("fs")}connectedCallback(){this._freeSpaceDiv&&this._freeSpaceDiv.addEventListener("click",this.handleFreeSpaceDivClick),this.upgradeProperty("open")}disconnectedCallback(){document.removeEventListener("keyup",this.handleKeyUp)}upgradeProperty(e){if(this.hasOwnProperty(e)){let t=this[e];delete this[e],this[e]=t}}handleKeyUp=e=>{if(!e.altKey&&"Escape"===e.key)e.preventDefault(),this.open=!1};get open(){return this.hasAttribute("open")}set open(e){e?this.hasAttribute("open")||this.setAttribute("open",""):this.hasAttribute("open")&&this.removeAttribute("open")}static get observedAttributes(){return["open"]}attributeChangedCallback(e,t,n){"open"===e&&(this.open?(this.setAttribute("tabindex","0"),this.setAttribute("aria-disabled","false"),this.focus({preventScroll:!0}),document.addEventListener("keyup",this.handleKeyUp),this.dispatchEvent(new CustomEvent("open",{bubbles:!0}))):(this.setAttribute("tabindex","-1"),this.setAttribute("aria-disabled","true"),document.removeEventListener("keyup",this.handleKeyUp),this.dispatchEvent(new CustomEvent("close",{bubbles:!0}))))}handleFreeSpaceDivClick=()=>{this.open=!1}}customElements.define("side-drawer",OE);let DE=class extends se{constructor(){super(...arguments),this.location="left",this.control=!0,this.open=!1,this.empty=!0,this._refDrawer=Ie(),this._refSlot=Ie(),this._resizeObserver=new ResizeObserver((()=>this._hideDrawerIfNecessary())),this._isHoverableDevice=Qg()}firstUpdated(e){super.firstUpdated(e);const t=document.createElement("style");t.innerHTML=":host {\n width: unset;\n}\n\n#fs {\n display: none;\n width: 100%;\n inset: 0;\n}\n\n#d,\n#fs {\n height: 100%;\n position: absolute;\n}\n\n#d {\n overflow: visible;\n max-width: 90%;\n z-index: 10;\n}\n\n:host([location=right]) #d {\n left: unset;\n right: 0;\n transform: translateX(100%);\n}\n\n:host([location=right][open]) #d {\n transform: none;\n box-shadow: var(--frigate-card-css-box-shadow, 0px 0px 25px 0px black);\n}\n\n#ifs {\n height: 100%;\n}",this._refDrawer.value?.shadowRoot?.appendChild(t)}_slotChanged(){const e=this._refSlot.value?sf(this._refSlot.value):[];this._resizeObserver.disconnect();for(const t of e)this._resizeObserver.observe(t);this._hideDrawerIfNecessary()}_hideDrawerIfNecessary(){if(!this._refDrawer.value)return;const e=this._refSlot.value?sf(this._refSlot.value):null;this.empty=!e||!e.length||e.every((e=>{const t=e.getBoundingClientRect();return!t.width||!t.height}))}render(){return q` + {this.open&&(this.open=!1)}} + > + ${this.control?q` +
{vf(e),this.open=!this.open}} + > + {this._isHoverableDevice&&!this.open&&(this.open=!0)}} + > + +
+ `:""} + this._slotChanged()}> +
+ `}static get styles(){return o("side-drawer {\n background-color: var(--card-background-color);\n}\n\ndiv.control-surround {\n position: absolute;\n bottom: 50%;\n transform: translateY(50%);\n z-index: 0;\n padding-top: 20px;\n padding-bottom: 20px;\n}\n\n:host([location=left]) div.control-surround {\n padding-right: 12px;\n left: 100%;\n}\n\n:host([location=right]) div.control-surround {\n padding-left: 12px;\n right: 100%;\n}\n\n:host([empty]),\n:host([empty]) > * {\n visibility: hidden;\n}\n\n:host(:not([empty])),\n:host(:not([empty])) > * {\n visibility: visible;\n}\n\nha-icon.control {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.7);\n opacity: 0.5;\n pointer-events: all;\n --mdc-icon-size: 20px;\n padding-top: 20px;\n padding-bottom: 20px;\n transition: opacity 0.5s ease;\n}\n\n:host([open]) ha-icon.control,\nha-icon.control:hover {\n opacity: 1;\n background-color: black;\n}\n\n:host([location=left]) ha-icon.control {\n border-top-right-radius: 20px;\n border-bottom-right-radius: 20px;\n}\n\n:host([location=right]) ha-icon.control {\n border-top-left-radius: 20px;\n border-bottom-left-radius: 20px;\n}")}};e([he({attribute:!0,reflect:!0})],DE.prototype,"location",void 0),e([he({attribute:!0,reflect:!0,type:Boolean})],DE.prototype,"control",void 0),e([he({type:Boolean,reflect:!0,attribute:!0})],DE.prototype,"open",void 0),e([he({attribute:!1})],DE.prototype,"icons",void 0),e([he({type:Boolean,reflect:!0,attribute:!0})],DE.prototype,"empty",void 0),DE=e([le("frigate-card-drawer")],DE);let RE=class extends se{constructor(){super(...arguments),this._refDrawerLeft=Ie(),this._refDrawerRight=Ie(),this._boundDrawerHandler=this._drawerHandler.bind(this)}connectedCallback(){super.connectedCallback(),this.addEventListener("frigate-card:drawer:open",this._boundDrawerHandler),this.addEventListener("frigate-card:drawer:close",this._boundDrawerHandler)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("frigate-card:drawer:open",this._boundDrawerHandler),this.removeEventListener("frigate-card:drawer:close",this._boundDrawerHandler)}_drawerHandler(e){const t=e.detail.drawer,n=e.type.endsWith(":open");"left"===t&&this._refDrawerLeft.value?this._refDrawerLeft.value.open=n:"right"===t&&this._refDrawerRight.value&&(this._refDrawerRight.value.open=n)}render(){return q` + + + + + + + + `}static get styles(){return o(":host {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n position: relative;\n overflow: hidden;\n}\n\n::slotted(:not([slot])) {\n flex: 1;\n min-height: 0px;\n}")}};e([he({attribute:!1})],RE.prototype,"drawerIcons",void 0),RE=e([le("frigate-card-surround-basic")],RE);let PE=class extends se{_hasDrawer(){return!!this.thumbnailConfig&&["left","right"].includes(this.thumbnailConfig.mode)}willUpdate(e){this.timelineConfig?.mode&&"none"!==this.timelineConfig.mode&&import("./timeline-core-9cf72087.js");const t=this.viewManagerEpoch?.manager.getView();e.has("viewManagerEpoch")&&(this.viewManagerEpoch?.manager.hasMajorMediaChange(this.viewManagerEpoch?.oldView)||this.viewManagerEpoch?.oldView?.displayMode!==t?.displayMode)&&(this._cameraIDsForTimeline=this._getCameraIDsForTimeline()??void 0)}_getCameraIDsForTimeline(){const e=this.viewManagerEpoch?.manager.getView();if(!e||!this.cameraManager)return null;if(e.is("live")){const t={anyCapabilities:["clips","snapshots","recordings"]};return e.supportsMultipleDisplayModes()&&e.isGrid()?this.cameraManager.getStore().getCameraIDsWithCapability(t):this.cameraManager.getStore().getAllDependentCameras(e.camera,t)}return e.isViewerView()?e.query?.getQueryCameraIDs()??null:null}render(){const e=this.viewManagerEpoch?.manager.getView();if(!this.hass||!e)return;const t=(e,t)=>{this.thumbnailConfig&&this._hasDrawer()&&Vg(e.composedPath()[0],"drawer:"+t,{drawer:this.thumbnailConfig.mode})};return q` t(e,"open")} + @frigate-card:thumbnails:close=${e=>t(e,"close")} + > + ${this.thumbnailConfig&&"none"!==this.thumbnailConfig.mode?q` {const n=e.detail.queryResults.getSelectedResult();n&&(this.viewManagerEpoch?.manager.setViewByParameters({params:{view:"media",queryResults:e.detail.queryResults,...n.getCameraID()&&{camera:n.getCameraID()}},modifiers:[new bE(["timeline","mediaViewer"])]}),t(e,"close"))}} + > + `:""} + ${this.timelineConfig&&"none"!==this.timelineConfig.mode?q` + `:""} + + `}static get styles(){return o(TE)}};e([he({attribute:!1})],PE.prototype,"hass",void 0),e([he({attribute:!1})],PE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1,hasChanged:Wg})],PE.prototype,"thumbnailConfig",void 0),e([he({attribute:!1,hasChanged:Wg})],PE.prototype,"timelineConfig",void 0),e([he({attribute:!1})],PE.prototype,"cameraManager",void 0),e([he({attribute:!1})],PE.prototype,"cardWideConfig",void 0),PE=e([le("frigate-card-surround")],PE);var LE="Tue, 17 Dec 2024 05:06:29 GMT",NE="0b68140",FE="Mon, 16 Dec 2024 21:05:17 -0800";const VE=ba.object({domain:ba.string(),version:ba.string().optional()}).passthrough(),HE="hass_web_proxy",BE=(e,t)=>`/api/${HE}/v${t??0}/?url=${encodeURIComponent(e)}`,qE=(e,t,n="media")=>(e=>e.config.components.includes(HE))(e)&&!!t[n];async function UE(e,t,n){await e.callService(HE,"create_proxied_url",{url_pattern:t,...n&&{url_id:n.urlID,ssl_verification:n.sslVerification,ssl_ciphers:n.sslCiphers,open_limit:n.openLimit,ttl:n.ttl,allow_unauthenticated:n.allowUnauthenticated}})}const WE=async(e,t)=>{let n=null;if(t)try{n=await(async(e,t)=>await Sy(e,VE,{type:"manifest/get",integration:t}))(t,e)}catch(e){}return{detected:!!n,...n?.version&&{version:n.version}}};let ZE=class extends se{constructor(){super(...arguments),this._diagnostics=null}async _fetchDiagnostics(){this._diagnostics=await(async(e,t,n)=>{const a=e&&t?await t.getMatchingDevices(e,(e=>"Frigate"===e.manufacturer)):[],i=new Map;return a?.forEach((e=>{e.config_entries.forEach((t=>{e.model&&i.set(t,e.model)}))})),{card_version:"6.1.0",browser:navigator.userAgent,date:new Date,lang:L_(),timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,git:{hash:NE,build_date:LE,commit_date:FE},...e&&{ha_version:e.config.version},custom_integrations:{frigate:{...await WE("frigate",e),...i.size&&{devices:Object.fromEntries(i)}},hass_web_proxy:await WE(HE,e)},...n&&{config:n}}})(this.hass,this.deviceRegistryManager,this.rawConfig)}shouldUpdate(){return!!this._diagnostics||(this._fetchDiagnostics().then((()=>this.requestUpdate())),!1)}render(){return bk({message:N_("error.diagnostics"),type:"diagnostics",icon:"mdi:information",context:this._diagnostics})}static get styles(){return o(TE)}};e([he({attribute:!1})],ZE.prototype,"hass",void 0),e([he({attribute:!1})],ZE.prototype,"deviceRegistryManager",void 0),e([he({attribute:!1})],ZE.prototype,"rawConfig",void 0),e([pe()],ZE.prototype,"_diagnostics",void 0),ZE=e([le("frigate-card-diagnostics")],ZE);let QE=class extends se{willUpdate(e){if(e.has("viewManagerEpoch")||e.has("config")){const e=this.viewManagerEpoch?.manager.getView();(e?.is("live")||this._shouldLivePreload())&&import("./index-33db4eee.js"),e?.isGalleryView()?import("./gallery-bf3892f1.js"):e?.isViewerView()?import("./index-5de5f421.js"):e?.is("image")?import("./image-88fcb8ac.js"):e?.is("timeline")&&import("./timeline-3c6e5e5d.js")}e.has("hide")&&(this.hide?this.setAttribute("hidden",""):this.removeAttribute("hidden"))}shouldUpdate(e){return!0}_shouldLivePreload(){const e=this.viewManagerEpoch?.manager.getView();return!!this.overriddenConfig?.live.preload&&!e?.is("diagnostics")}render(){if(!(this.hass&&this.overriddenConfig&&this.nonOverriddenConfig&&this.cardWideConfig))return q``;const e=this.viewManagerEpoch?.manager.getView(),t={hidden:this._shouldLivePreload()&&!e?.is("live")},n={hidden:!!this.hide},a=e?.is("live")?this.overriddenConfig.live.controls.thumbnails:e?.isViewerView()?this.overriddenConfig.media_viewer.controls.thumbnails:e?.is("timeline")?this.overriddenConfig.timeline.controls.thumbnails:void 0,i=e?.is("live")?this.overriddenConfig.live.controls.timeline:e?.isViewerView()?this.overriddenConfig.media_viewer.controls.timeline:void 0,r=e?this.cameraManager?.getStore().getCameraConfig(e.camera)??null:null;return q` + ${!this.hide&&e?.is("image")&&r?q` + `:""} + ${!this.hide&&e?.isGalleryView()?q` + `:""} + ${!this.hide&&e?.isViewerView()?q` + + + `:""} + ${!this.hide&&e?.is("timeline")?q` + `:""} + ${!this.hide&&e?.is("diagnostics")?q` + `:""} + ${this._shouldLivePreload()||!this.hide&&e?.is("live")?q` + + + `:""} + `}static get styles(){return o(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\n:host([hidden]),\n.hidden {\n display: none;\n}")}};e([he({attribute:!1})],QE.prototype,"hass",void 0),e([he({attribute:!1})],QE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1})],QE.prototype,"cameraManager",void 0),e([he({attribute:!1})],QE.prototype,"nonOverriddenConfig",void 0),e([he({attribute:!1})],QE.prototype,"overriddenConfig",void 0),e([he({attribute:!1})],QE.prototype,"cardWideConfig",void 0),e([he({attribute:!1})],QE.prototype,"rawConfig",void 0),e([he({attribute:!1})],QE.prototype,"resolvedMediaCache",void 0),e([he({attribute:!1})],QE.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],QE.prototype,"hide",void 0),e([he({attribute:!1})],QE.prototype,"microphoneManager",void 0),e([he({attribute:!1})],QE.prototype,"triggeredCameraIDs",void 0),e([he({attribute:!1})],QE.prototype,"deviceRegistryManager",void 0),QE=e([le("frigate-card-views")],QE);console.info(`%c FRIGATE-HASS-CARD \n%c ${N_("common.version")} 6.1.0`,"color: pink; font-weight: bold; background: black","color: white; font-weight: bold; background: dimgray"),window.customCards=window.customCards||[],window.customCards.push({type:"frigate-card",name:N_("common.frigate_card"),description:N_("common.frigate_card_description"),preview:!0,documentationURL:"https://github.com/dermotduffy/frigate-hass-card"});let GE=class extends se{constructor(){super(...arguments),this._controller=new $x(this,(()=>this._refMain.value?.scroll({top:0})),(()=>this._refMenu.value?.toggleMenu()),this._requestUpdateForComponentsThatUseConditions.bind(this)),this._menuButtonController=new Ax,this._refMenu=Ie(),this._refOverlay=Ie(),this._refMain=Ie(),this._refElements=Ie(),this._refViews=Ie()}get _config(){return this._controller.getConfigManager().getConfig()}get _hass(){return this._controller.getHASSManager().getHASS()}set hass(e){this._controller.getHASSManager().setHASS(e),this._refMenu.value&&(this._refMenu.value.hass=e),this._refElements.value&&(this._refElements.value.hass=e),this._refViews.value&&(this._refViews.value.hass=e)}static async getConfigElement(){return await $x.getConfigElement()}static getStubConfig(e,t){return $x.getStubConfig(t)}_requestUpdateForComponentsThatUseConditions(){this._refViews.value&&(this._refViews.value.conditionsManagerEpoch=this._controller.getConditionsManager().getEpoch()??void 0),this._refElements.value&&(this._refElements.value.conditionsManagerEpoch=this._controller.getConditionsManager().getEpoch()??void 0)}setConfig(e){this._controller.getConfigManager().setConfig(e)}shouldUpdate(){return!!this.isConnected&&(this._controller.getMessageManager().hasMessage()||this._controller.getInitializationManager().isInitializedMandatory()||this._controller.getInitializationManager().initializeMandatory(),!0)}_renderMenuStatusContainer(e){if(!this._config)return;const t=this._config.menu.style,n=this._config.menu.position,a=this._config.status_bar.style,i=this._config.status_bar.position;if("none"===t&&"none"===a||"overlay"===e&&"outside"===t&&"outside"===a||"overlay"!==e&&("outside"!==t||n!==e)&&("outside"!==a||i!==e))return;const r=e=>{const r="none"!==t&&("outside"===t&&"outerlay"===e||"outside"!==t&&"overlay"===e),o="none"!==a&&("outside"===a&&"outerlay"===e||"outside"!==a&&"overlay"===e),s="left"===n||"right"===n||"bottom"===n&&"hidden"===t&&"popup"!==a||"top"===n&&("hidden"!==t||"popup"===a);return q` + ${r&&s?this._renderMenu(n):""} + ${o?this._renderStatusBar(i):""} + ${r&&!s?this._renderMenu(n):""} + `};return q` + ${"overlay"===e?q`${r("overlay")}`:q`
+ ${r("outerlay")} +
`} + `}_renderMenu(e){const t=this._controller.getViewManager().getView();if(this._hass&&this._config)return q` + + `}_renderStatusBar(e){if(this._config)return q` + + `}updated(){this._controller.getInitializationManager().isInitializedMandatory()&&this._controller.getQueryStringManager().executeIfNecessary()}_renderInDialogIfNecessary(e){return this._controller.getExpandManager().isExpanded()?q` {this._controller.getExpandManager().setExpanded(!1)}} + > + ${e} + `:e}render(){if(!this._hass)return;const e={main:!0,"curve-top":"outside"!==this._config?.menu.style||"top"!==this._config?.menu.position,"curve-bottom":"outside"!==this._config?.menu.style||"top"===this._config?.menu.position},t=this._controller.getActionsManager().getMergedActions(),n=this._controller.getCameraManager(),a=!1!==this._config?.performance?.features.animated_progress_indicator&&!this._controller.getInitializationManager().wasEverInitialized()&&!this._controller.getMessageManager().hasMessage();return this._renderInDialogIfNecessary(q` this._controller.getMessageManager().setMessageIfHigherPriority(e.detail)} + @frigate-card:media:loaded=${e=>this._controller.getMediaLoadedInfoManager().set(e.detail)} + @frigate-card:media:unloaded=${()=>this._controller.getMediaLoadedInfoManager().clear()} + @frigate-card:media:volumechange=${()=>this.requestUpdate()} + @frigate-card:media:play=${()=>this.requestUpdate()} + @frigate-card:media:pause=${()=>this.requestUpdate()} + @frigate-card:focus=${()=>this.focus()} + > + ${a?q``:""} + ${this._renderMenuStatusContainer("top")} + ${this._renderMenuStatusContainer("overlay")} +
+ + ${bk(this._controller.getMessageManager().getMessage())} +
+ ${this._renderMenuStatusContainer("bottom")} + ${this._config?.elements?q` {this._menuButtonController.addDynamicMenuButton(e.detail),this.requestUpdate()}} + @frigate-card:menu:remove=${e=>{this._menuButtonController.removeDynamicMenuButton(e.detail),this.requestUpdate()}} + @frigate-card:status-bar:add=${e=>{this._controller.getStatusBarItemManager().addDynamicStatusBarItem(e.detail)}} + @frigate-card:status-bar:remove=${e=>{this._controller.getStatusBarItemManager().removeDynamicStatusBarItem(e.detail)}} + @frigate-card:conditions:evaluate=${e=>{e.evaluation=this._controller.getConditionsManager()?.evaluateConditions(e.conditions)}} + > + `:""} +
`)}static get styles(){return o(':host {\n display: block;\n position: relative;\n background-color: var(--card-background-color);\n border-radius: var(--ha-card-border-radius, 4px);\n height: var(--frigate-card-height);\n min-height: 100px;\n pointer-events: all;\n --frigate-card-expand-max-height: calc((100vh - (2 * 56px)) * 0.85);\n --frigate-card-expand-max-width: 85vw;\n --frigate-card-expand-width: none;\n --frigate-card-expand-height: none;\n --frigate-card-expand-aspect-ratio: unset;\n --frigate-card-height: auto;\n}\n\nfrigate-card-loading {\n position: absolute;\n inset: 0;\n z-index: 1;\n}\n\n:host([dark]) {\n filter: brightness(75%);\n}\n\n:host([panel]:not([casted])) {\n height: calc(100vh - var(--header-height));\n}\n\n:host([panel][casted]) {\n height: 100%;\n}\n\ndiv.main {\n position: relative;\n overflow: auto;\n width: 100%;\n height: 100%;\n margin: auto;\n display: block;\n transform: translateZ(0);\n scrollbar-width: none;\n -ms-overflow-style: none;\n}\n\n/* Hide scrollbar for Chrome, Safari and Opera */\ndiv.main::-webkit-scrollbar {\n display: none;\n}\n\ndiv.main.curve-top {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\ndiv.main.curve-bottom {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}\n\nha-card {\n display: flex;\n flex-direction: column;\n margin: auto;\n border: 0px;\n overflow: visible;\n width: 100%;\n height: 100%;\n position: static;\n color: var(--secondary-text-color, white);\n}\n\n/************\n * Fullscreen\n *************/\n:host(:fullscreen) #ha-card {\n border-radius: 0px;\n box-shadow: none;\n margin: 0;\n}\n\n:host(:-webkit-full-screen) #ha-card {\n border-radius: 0px;\n box-shadow: none;\n margin: 0;\n}\n\n:host(:fullscreen) div.main,\n:host(:fullscreen) frigate-card-menu {\n border-radius: 0px;\n}\n\n:host(:-webkit-full-screen) div.main,\n:host(:-webkit-full-screen) frigate-card-menu {\n border-radius: 0px;\n}\n\n/***************\n * Expanded mode\n ***************/\nweb-dialog {\n --dialog-padding: 0px;\n --dialog-container-padding: 0px;\n --dialog-max-height: var(--frigate-card-expand-max-height);\n --dialog-max-width: var(--frigate-card-expand-max-width);\n --dialog-width: var(--frigate-card-expand-width);\n --dialog-height: var(--frigate-card-expand-height);\n --dialog-overflow-x: visible;\n --dialog-overflow-y: visible;\n max-height: 100vh;\n}\n\nweb-dialog::part(dialog) {\n aspect-ratio: var(--frigate-card-expand-aspect-ratio);\n border-radius: 0px;\n background: transparent;\n}\n\n/*************************************\n * "Outside" style for menu/status bar\n *************************************/\n.outerlay[data-position=top] > *:first-child {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n.outerlay[data-position=bottom] > *:last-child {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n/*******************\n * Menu hover styles\n *******************/\nfrigate-card-menu {\n z-index: 2;\n}\n\nfrigate-card-menu[data-style*=hover] {\n transition: opacity 0.5s ease;\n opacity: 0;\n}\n\nfrigate-card-menu[data-style*=hover]:hover,\nha-card:hover > frigate-card-overlay > frigate-card-menu[data-style=hover-card] {\n opacity: 1;\n}\n\n/*************************\n * Status bar hover styles\n *************************/\nfrigate-card-status-bar {\n z-index: 1;\n}\n\nfrigate-card-status-bar[data-style*=hover] {\n transition: opacity 0.5s ease;\n opacity: 0;\n}\n\nfrigate-card-status-bar[data-style*=hover]:hover,\nha-card:hover > frigate-card-overlay > frigate-card-status-bar[data-style=hover-card] {\n opacity: 1;\n}')}getCardSize(){return 6}};GE=e([le("frigate-card")],GE);export{Al as $,Ji as A,er as B,Ui as C,tr as D,nr as E,ar as F,Di as G,Ri as H,Pi as I,Li as J,Ni as K,Fi as L,Vi as M,Hi as N,Bi as O,ps as P,qs as Q,es as R,Bs as S,Ho as T,Lo as U,No as V,Fo as W,Vo as X,Vs as Y,$l as Z,e as _,se as a,cr as a$,F_ as a0,ew as a1,et as a2,tw as a3,Ss as a4,ji as a5,zi as a6,Ti as a7,Oi as a8,qi as a9,Qr as aA,io as aB,ro as aC,so as aD,co as aE,oo as aF,to as aG,no as aH,ao as aI,ho as aJ,go as aK,fo as aL,lo as aM,uo as aN,mo as aO,po as aP,Xr as aQ,eo as aR,Jr as aS,Yr as aT,Kr as aU,Gr as aV,Eo as aW,Ao as aX,$o as aY,dr as aZ,or as a_,Xo as aa,Ko as ab,Yo as ac,Jo as ad,ds as ae,ls as af,hs as ag,Hs as ah,us as ai,Mo as aj,wo as ak,Io as al,xo as am,Co as an,Hr as ao,Br as ap,qr as aq,Ur as ar,ko as as,So as at,_o as au,bo as av,yo as aw,vo as ax,Wr as ay,Zr as az,pe as b,za as b$,lr as b0,sr as b1,rr as b2,hr as b3,pr as b4,mr as b5,gr as b6,br as b7,Fr as b8,wr as b9,Do as bA,qo as bB,Uo as bC,Zo as bD,Qo as bE,Wo as bF,Bo as bG,fs as bH,gs as bI,_s as bJ,bs as bK,ws as bL,Es as bM,xs as bN,ks as bO,Ms as bP,Xb as bQ,Yb as bR,Bk as bS,Bg as bT,xa as bU,Ka as bV,Qa as bW,Ra as bX,Pa as bY,Ca as bZ,Ta as b_,Cr as ba,xr as bb,fr as bc,vr as bd,_r as be,yr as bf,Mr as bg,kr as bh,Sr as bi,Tr as bj,$r as bk,Ir as bl,zr as bm,Ar as bn,Er as bo,Dr as bp,Lr as bq,Nr as br,jr as bs,Or as bt,Pr as bu,Rr as bv,Oo as bw,Ro as bx,To as by,jo as bz,Jb as c,Nd as c$,ja as c0,Ia as c1,Za as c2,Ba as c3,qa as c4,Ua as c5,Wa as c6,gi as c7,mi as c8,Oa as c9,ti as cA,ni as cB,Ma as cC,ka as cD,ui as cE,di as cF,pi as cG,hi as cH,Ld as cI,wa as cJ,Cs as cK,Qw as cL,Ie as cM,Gw as cN,cf as cO,bk as cP,je as cQ,Wg as cR,_w as cS,Jl as cT,Ck as cU,Gv as cV,XS as cW,vf as cX,xv as cY,ye as cZ,TE as c_,Da as ca,Fa as cb,Ha as cc,La as cd,Na as ce,Va as cf,Ga as cg,Ya as ch,Ja as ci,Xa as cj,_i as ck,fi as cl,yi as cm,vi as cn,Sa as co,Ea as cp,$a as cq,Aa as cr,ei as cs,ai as ct,ii as cu,ri as cv,oi as cw,si as cx,ci as cy,li as cz,nw as d,$s as d$,eu as d0,c as d1,dx as d2,Wy as d3,ux as d4,cx as d5,hx as d6,Zg as d7,ky as d8,qu as d9,bf as dA,Hw as dB,ME as dC,xE as dD,_f as dE,Lk as dF,ff as dG,Cf as dH,yf as dI,u_ as dJ,d_ as dK,Dy as dL,Ry as dM,Bd as dN,Ny as dO,Qg as dP,Gg as dQ,xx as dR,Zv as dS,mx as dT,ru as dU,rf as dV,Ly as dW,Fg as dX,ba as dY,ef as dZ,Sy as d_,Yg as da,Wu as db,Vg as dc,Bw as dd,tf as de,kE as df,Mx as dg,wk as dh,Ew as di,ex as dj,dv as dk,Hb as dl,Bb as dm,qE as dn,UE as dp,Ib as dq,BE as dr,Zw as ds,Yw as dt,Kw as du,Xw as dv,bx as dw,ge as dx,fe as dy,U as dz,_e as e,Gy as e0,qy as e1,U_ as e2,W_ as e3,Qy as e4,Kg as e5,Jg as e6,Zy as e7,Fk as e8,Fy as e9,Lb as eA,sf as eB,Hv as eC,Bv as eD,qv as eE,uf as eF,Wv as eG,Og as eH,Uv as eI,s as eJ,Ae as eK,ve as eL,W as eM,Ww as eN,vE as eO,me as eP,be as eQ,xe as eR,Tb as eS,nf as ea,Iy as eb,Vk as ec,Ay as ed,$y as ee,zy as ef,Hk as eg,Yd as eh,Fd as ei,Zd as ej,Wd as ek,Qd as el,fu as em,Kd as en,Xd as eo,_u as ep,gu as eq,Vd as er,tu as es,pu as et,Tu as eu,Pu as ev,Lu as ew,Ru as ex,Fb as ey,Uy as ez,bw as f,Nb as g,Kb as h,jy as i,Pb as j,Hg as k,N_ as l,Gi as m,he as n,Zi as o,Rd as p,Wi as q,o as r,af as s,le as t,Qi as u,Vb as v,Yi as w,q as x,Xi as y,Ki as z}; diff --git a/config/www/community/frigate-hass-card/card-320adb66.js.gz b/config/www/community/frigate-hass-card/card-320adb66.js.gz new file mode 100644 index 00000000..055ac766 Binary files /dev/null and b/config/www/community/frigate-hass-card/card-320adb66.js.gz differ diff --git a/config/www/community/frigate-hass-card/card-45855f1f.js b/config/www/community/frigate-hass-card/card-45855f1f.js new file mode 100644 index 00000000..5ca7880a --- /dev/null +++ b/config/www/community/frigate-hass-card/card-45855f1f.js @@ -0,0 +1,650 @@ +function e(e,t,n,a){var i,r=arguments.length,o=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,n):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,a);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(r<3?i(o):r>3?i(t,n,o):i(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o}"function"==typeof SuppressedError&&SuppressedError; +/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const t=globalThis,n=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,a=Symbol(),i=new WeakMap;let r=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==a)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(n&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=i.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&i.set(t,e))}return e}toString(){return this.cssText}};const o=e=>new r("string"==typeof e?e:e+"",void 0,a),s=(e,...t)=>{const n=1===e.length?e[0]:t.reduce(((t,n,a)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+e[a+1]),e[0]);return new r(n,e,a)},c=(e,a)=>{if(n)e.adoptedStyleSheets=a.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(const n of a){const a=document.createElement("style"),i=t.litNonce;void 0!==i&&a.setAttribute("nonce",i),a.textContent=n.cssText,e.appendChild(a)}},l=n?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return o(t)})(e):e +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,{is:d,defineProperty:u,getOwnPropertyDescriptor:h,getOwnPropertyNames:p,getOwnPropertySymbols:m,getPrototypeOf:g}=Object,f=globalThis,_=f.trustedTypes,v=_?_.emptyScript:"",y=f.reactiveElementPolyfillSupport,b=(e,t)=>e,w={toAttribute(e,t){switch(t){case Boolean:e=e?v:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},x=(e,t)=>!d(e,t),C={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:x};Symbol.metadata??=Symbol("metadata"),f.litPropertyMetadata??=new WeakMap;class M extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=C){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){const n=Symbol(),a=this.getPropertyDescriptor(e,n,t);void 0!==a&&u(this.prototype,e,a)}}static getPropertyDescriptor(e,t,n){const{get:a,set:i}=h(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get(){return a?.call(this)},set(t){const r=a?.call(this);i.call(this,t),this.requestUpdate(e,r,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??C}static _$Ei(){if(this.hasOwnProperty(b("elementProperties")))return;const e=g(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(b("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(b("properties"))){const e=this.properties,t=[...p(e),...m(e)];for(const n of t)this.createProperty(n,e[n])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const n=this._$Eu(e,t);void 0!==n&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(l(e))}else void 0!==e&&t.push(l(e));return t}static _$Eu(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((e=>e(this)))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return c(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((e=>e.hostConnected?.()))}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach((e=>e.hostDisconnected?.()))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EC(e,t){const n=this.constructor.elementProperties.get(e),a=this.constructor._$Eu(e,n);if(void 0!==a&&!0===n.reflect){const i=(void 0!==n.converter?.toAttribute?n.converter:w).toAttribute(t,n.type);this._$Em=e,null==i?this.removeAttribute(a):this.setAttribute(a,i),this._$Em=null}}_$AK(e,t){const n=this.constructor,a=n._$Eh.get(e);if(void 0!==a&&this._$Em!==a){const e=n.getPropertyOptions(a),i="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:w;this._$Em=a,this[a]=i.fromAttribute(t,e.type),this._$Em=null}}requestUpdate(e,t,n){if(void 0!==e){if(n??=this.constructor.getPropertyOptions(e),!(n.hasChanged??x)(this[e],t))return;this.P(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(e,t,n){this._$AL.has(e)||this._$AL.set(e,t),!0===n.reflect&&this._$Em!==e&&(this._$Ej??=new Set).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,n]of e)!0!==n.wrapped||this._$AL.has(t)||void 0===this[t]||this.P(t,this[t],n)}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach((e=>e.hostUpdate?.())),this.update(t)):this._$EU()}catch(t){throw e=!1,this._$EU(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&=this._$Ej.forEach((e=>this._$EC(e,this[e]))),this._$EU()}updated(e){}firstUpdated(e){}}M.elementStyles=[],M.shadowRootOptions={mode:"open"},M[b("elementProperties")]=new Map,M[b("finalized")]=new Map,y?.({ReactiveElement:M}),(f.reactiveElementVersions??=[]).push("2.0.4"); +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const k=globalThis,S=k.trustedTypes,E=S?S.createPolicy("lit-html",{createHTML:e=>e}):void 0,$="$lit$",A=`lit$${(Math.random()+"").slice(9)}$`,z="?"+A,I=`<${z}>`,T=document,j=()=>T.createComment(""),O=e=>null===e||"object"!=typeof e&&"function"!=typeof e,D=Array.isArray,R="[ \t\n\f\r]",P=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,L=/-->/g,N=/>/g,F=RegExp(`>|${R}(?:([^\\s"'>=/]+)(${R}*=${R}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),V=/'/g,H=/"/g,B=/^(?:script|style|textarea|title)$/i,q=(e=>(t,...n)=>({_$litType$:e,strings:t,values:n}))(1),U=Symbol.for("lit-noChange"),W=Symbol.for("lit-nothing"),Z=new WeakMap,Q=T.createTreeWalker(T,129);function G(e,t){if(!Array.isArray(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==E?E.createHTML(t):t}const Y=(e,t)=>{const n=e.length-1,a=[];let i,r=2===t?"":"",o=P;for(let t=0;t"===c[0]?(o=i??P,l=-1):void 0===c[1]?l=-2:(l=o.lastIndex-c[2].length,s=c[1],o=void 0===c[3]?F:'"'===c[3]?H:V):o===H||o===V?o=F:o===L||o===N?o=P:(o=F,i=void 0);const u=o===F&&e[t+1].startsWith("/>")?" ":"";r+=o===P?n+I:l>=0?(a.push(s),n.slice(0,l)+$+n.slice(l)+A+u):n+A+(-2===l?t:u)}return[G(e,r+(e[n]||"")+(2===t?"":"")),a]};class K{constructor({strings:e,_$litType$:t},n){let a;this.parts=[];let i=0,r=0;const o=e.length-1,s=this.parts,[c,l]=Y(e,t);if(this.el=K.createElement(c,n),Q.currentNode=this.el.content,2===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(a=Q.nextNode())&&s.length0){a.textContent=S?S.emptyScript:"";for(let n=0;nD(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}S(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.S(e))}_(e){this._$AH!==W&&O(this._$AH)?this._$AA.nextSibling.data=e:this.T(T.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:n}=e,a="number"==typeof n?this._$AC(e):(void 0===n.el&&(n.el=K.createElement(G(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===a)this._$AH.p(t);else{const e=new J(a,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=Z.get(e.strings);return void 0===t&&Z.set(e.strings,t=new K(e)),t}k(e){D(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,a=0;for(const i of e)a===t.length?t.push(n=new ee(this.S(j()),this.S(j()),this,this.options)):n=t[a],n._$AI(i),a++;a2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=W}_$AI(e,t=this,n,a){const i=this.strings;let r=!1;if(void 0===i)e=X(this,e,t,0),r=!O(e)||e!==this._$AH&&e!==U,r&&(this._$AH=e);else{const a=e;let o,s;for(e=i[0],o=0;o{const a=n?.renderBefore??t;let i=a._$litPart$;if(void 0===i){const e=n?.renderBefore??null;a._$litPart$=i=new ee(t.insertBefore(j(),e),e,void 0,n??{})}return i._$AI(e),i})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return U}};se._$litElement$=!0,se.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:se});const ce=globalThis.litElementPolyfillSupport;ce?.({LitElement:se}),(globalThis.litElementVersions??=[]).push("4.0.4"); +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const le=e=>(t,n)=>{void 0!==n?n.addInitializer((()=>{customElements.define(e,t)})):customElements.define(e,t)} +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,de={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:x},ue=(e=de,t,n)=>{const{kind:a,metadata:i}=n;let r=globalThis.litPropertyMetadata.get(i);if(void 0===r&&globalThis.litPropertyMetadata.set(i,r=new Map),r.set(n.name,e),"accessor"===a){const{name:a}=n;return{set(n){const i=t.get.call(this);t.set.call(this,n),this.requestUpdate(a,i,e)},init(t){return void 0!==t&&this.P(a,void 0,e),t}}}if("setter"===a){const{name:a}=n;return function(n){const i=this[a];t.call(this,n),this.requestUpdate(a,i,e)}}throw Error("Unsupported decorator location: "+a)};function he(e){return(t,n)=>"object"==typeof n?ue(e,t,n):((e,t,n)=>{const a=t.hasOwnProperty(n);return t.constructor.createProperty(n,a?{...e,wrapped:!0}:e),a?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n) +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */}function pe(e){return he({...e,state:!0,attribute:!1})} +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const me={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},ge=e=>(...t)=>({_$litDirective$:e,values:t});let fe=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}; +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const _e=ge(class extends fe{constructor(e){if(super(e),e.type!==me.ATTRIBUTE||"class"!==e.name||e.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter((t=>e[t])).join(" ")+" "}update(e,[t]){if(void 0===this.st){this.st=new Set,void 0!==e.strings&&(this.nt=new Set(e.strings.join(" ").split(/\s/).filter((e=>""!==e))));for(const e in t)t[e]&&!this.nt?.has(e)&&this.st.add(e);return this.render(t)}const n=e.element.classList;for(const e of this.st)e in t||(n.remove(e),this.st.delete(e));for(const e in t){const a=!!t[e];a===this.st.has(e)||this.nt?.has(e)||(a?(n.add(e),this.st.add(e)):(n.remove(e),this.st.delete(e)))}return U}}),ve=e=>e??W +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,ye=e=>null===e||"object"!=typeof e&&"function"!=typeof e,be=e=>void 0===e.strings,we={},xe=(e,t=we)=>e._$AH=t +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,Ce=(e,t)=>{const n=e._$AN;if(void 0===n)return!1;for(const e of n)e._$AO?.(t,!1),Ce(e,t);return!0},Me=e=>{let t,n;do{if(void 0===(t=e._$AM))break;n=t._$AN,n.delete(e),e=t}while(0===n?.size)},ke=e=>{for(let t;t=e._$AM;e=t){let n=t._$AN;if(void 0===n)t._$AN=n=new Set;else if(n.has(e))break;n.add(e),$e(t)}}; +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */function Se(e){void 0!==this._$AN?(Me(this),this._$AM=e,ke(this)):this._$AM=e}function Ee(e,t=!1,n=0){const a=this._$AH,i=this._$AN;if(void 0!==i&&0!==i.size)if(t)if(Array.isArray(a))for(let e=n;e{e.type==me.CHILD&&(e._$AP??=Ee,e._$AQ??=Se)};class Ae extends fe{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,n){super._$AT(e,t,n),ke(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(Ce(this,e),Me(this))}setValue(e){if(be(this._$Ct))this._$Ct._$AI(e,this);else{const t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}} +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const ze=()=>new Ie;let Ie=class{};const Te=new WeakMap,je=ge(class extends Ae{render(e){return W}update(e,[t]){const n=t!==this.Y;return n&&void 0!==this.Y&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.Y=t,this.ht=e.options?.host,this.rt(this.ct=e.element)),W}rt(e){if("function"==typeof this.Y){const t=this.ht??globalThis;let n=Te.get(t);void 0===n&&(n=new WeakMap,Te.set(t,n)),void 0!==n.get(this.Y)&&this.Y.call(this.ht,void 0),n.set(this.Y,e),void 0!==e&&this.Y.call(this.ht,e)}else this.Y.value=e}get lt(){return"function"==typeof this.Y?Te.get(this.ht??globalThis)?.get(this.Y):this.Y?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}}),Oe="important",De=" !"+Oe,Re=ge(class extends fe{constructor(e){if(super(e),e.type!==me.ATTRIBUTE||"style"!==e.name||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce(((t,n)=>{const a=e[n];return null==a?t:t+`${n=n.includes("-")?n:n.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${a};`}),"")}update(e,[t]){const{style:n}=e.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(t)),this.render(t);for(const e of this.ft)null==t[e]&&(this.ft.delete(e),e.includes("-")?n.removeProperty(e):n[e]=null);for(const e in t){const a=t[e];if(null!=a){this.ft.add(e);const t="string"==typeof a&&a.endsWith(De);e.includes("-")||t?n.setProperty(e,t?a.slice(0,-11):a,t?Oe:""):n[e]=a}}return U}}); +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */function Pe(e,t,n,a=20,i=0){let r=[];if(i>=a)return r;const o=e=>{const r=e.assignedNodes().filter((e=>1===e.nodeType));return r.length>0?Pe(r[0].parentElement,t,n,a,i+1):[]},s=Array.from(e.children||[]);for(const e of s)t(e)||(n(e)&&r.push(e),null!=e.shadowRoot?r.push(...Pe(e.shadowRoot,t,n,a,i+1)):"SLOT"===e.tagName?r.push(...o(e)):r.push(...Pe(e,t,n,a,i+1)));return r}function Le(e){return e.hasAttribute("hidden")||e.hasAttribute("aria-hidden")&&"false"!==e.getAttribute("aria-hidden")||"none"===e.style.display||"0"===e.style.opacity||"hidden"===e.style.visibility||"collapse"===e.style.visibility}function Ne(e){return"-1"!==e.getAttribute("tabindex")&&!Le(e)&&!function(e){return e.hasAttribute("disabled")||e.hasAttribute("aria-disabled")&&"false"!==e.getAttribute("aria-disabled")}(e)&&(e.hasAttribute("tabindex")||(e instanceof HTMLAnchorElement||e instanceof HTMLAreaElement)&&e.hasAttribute("href")||e instanceof HTMLButtonElement||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e instanceof HTMLIFrameElement)}const Fe=new Map;const Ve=document.createElement("template");Ve.innerHTML='\n\t
\n\t
\n\t\n\t
\n';class He extends HTMLElement{constructor(){super(),this.debounceId=Math.random().toString(),this._focused=!1;const e=this.attachShadow({mode:"open"});e.appendChild(Ve.content.cloneNode(!0)),this.$backup=e.querySelector("#backup"),this.$start=e.querySelector("#start"),this.$end=e.querySelector("#end"),this.focusLastElement=this.focusLastElement.bind(this),this.focusFirstElement=this.focusFirstElement.bind(this),this.onFocusIn=this.onFocusIn.bind(this),this.onFocusOut=this.onFocusOut.bind(this)}static get observedAttributes(){return["inactive"]}get inactive(){return this.hasAttribute("inactive")}set inactive(e){e?this.setAttribute("inactive",""):this.removeAttribute("inactive")}get focused(){return this._focused}connectedCallback(){this.$start.addEventListener("focus",this.focusLastElement),this.$end.addEventListener("focus",this.focusFirstElement),this.addEventListener("focusin",this.onFocusIn),this.addEventListener("focusout",this.onFocusOut),this.render()}disconnectedCallback(){this.$start.removeEventListener("focus",this.focusLastElement),this.$end.removeEventListener("focus",this.focusFirstElement),this.removeEventListener("focusin",this.onFocusIn),this.removeEventListener("focusout",this.onFocusOut)}attributeChangedCallback(){this.render()}focusFirstElement(){this.trapFocus()}focusLastElement(){this.trapFocus(!0)}getFocusableElements(){return Pe(this,Le,Ne)}trapFocus(e){if(this.inactive)return;let t=this.getFocusableElements();t.length>0?(e?t[t.length-1].focus():t[0].focus(),this.$backup.setAttribute("tabindex","-1")):(this.$backup.setAttribute("tabindex","0"),this.$backup.focus())}onFocusIn(){this.updateFocused(!0)}onFocusOut(){this.updateFocused(!1)}updateFocused(e){!function(e,t,n){const a=Fe.get(n);null!=a&&window.clearTimeout(a),Fe.set(n,window.setTimeout((()=>{e(),Fe.delete(n)}),t))}((()=>{this.focused!==e&&(this._focused=e,this.render())}),0,this.debounceId)}render(){this.$start.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.$end.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.focused?this.setAttribute("focused",""):this.removeAttribute("focused")}}function Be(e){return Number(e.getAttribute("data-dialog-count"))||0}function qe(e,t){e.setAttribute("data-dialog-count",t.toString())}function Ue(e=document.activeElement){return null!=e&&null!=e.shadowRoot&&null!=e.shadowRoot.activeElement?Ue(e.shadowRoot.activeElement):e}window.customElements.define("focus-trap",He);const We=document.createElement("template");We.innerHTML='\n \n
\n \n \n \n';class Ze extends HTMLElement{constructor(){super(),this.$scrollContainer=document.documentElement,this.$previousActiveElement=null;const e=this.attachShadow({mode:"open"});e.appendChild(We.content.cloneNode(!0)),this.$dialog=e.querySelector("#dialog"),this.$backdrop=e.querySelector("#backdrop"),this.onBackdropClick=this.onBackdropClick.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.setAttribute("aria-modal","true"),this.$dialog.setAttribute("role","alertdialog")}static get observedAttributes(){return["open","center"]}get open(){return this.hasAttribute("open")}set open(e){e?this.setAttribute("open",""):this.removeAttribute("open")}get center(){return this.hasAttribute("center")}set center(e){e?this.setAttribute("center",""):this.removeAttribute("center")}connectedCallback(){this.$backdrop.addEventListener("click",this.onBackdropClick)}disconnectedCallback(){this.$backdrop.removeEventListener("click",this.onBackdropClick),this.open&&this.didClose()}show(){this.open=!0}close(e){this.result=e,this.open=!1}onBackdropClick(){this.assertClosing()&&this.close()}onKeyDown(e){if("Escape"===e.code)this.assertClosing()&&(this.close(),e.stopImmediatePropagation())}assertClosing(){return this.dispatchEvent(new CustomEvent("closing",{cancelable:!0}))}didOpen(){this.$previousActiveElement=Ue(document.activeElement),requestAnimationFrame((()=>{this.$dialog.focusFirstElement()})),this.tabIndex=0,this.$scrollContainer.style.overflow="hidden",this.addEventListener("keydown",this.onKeyDown,{capture:!0,passive:!0}),qe(this.$scrollContainer,Be(this.$scrollContainer)+1),this.dispatchEvent(new CustomEvent("open"))}didClose(){this.removeEventListener("keydown",this.onKeyDown,{capture:!0}),qe(this.$scrollContainer,Math.max(0,Be(this.$scrollContainer)-1)),Be(this.$scrollContainer)<=0&&(this.$scrollContainer.style.overflow=""),this.tabIndex=-1,null!=this.$previousActiveElement&&(this.$previousActiveElement.focus(),this.$previousActiveElement=null),this.dispatchEvent(new CustomEvent("close",{detail:this.result}))}attributeChangedCallback(e,t,n){if("open"===e)this.open?this.didOpen():this.didClose()}}var Qe,Ge;function Ye(e){return e.substr(0,e.indexOf("."))}customElements.define("web-dialog",Ze),function(e){e.language="language",e.system="system",e.comma_decimal="comma_decimal",e.decimal_comma="decimal_comma",e.space_comma="space_comma",e.none="none"}(Qe||(Qe={})),function(e){e.language="language",e.system="system",e.am_pm="12",e.twenty_four="24"}(Ge||(Ge={}));var Ke,Xe,Je=["closed","locked","off"],et=function(e,t,n,a){a=a||{},n=null==n?{}:n;var i=new Event(t,{bubbles:void 0===a.bubbles||a.bubbles,cancelable:Boolean(a.cancelable),composed:void 0===a.composed||a.composed});return i.detail=n,e.dispatchEvent(i),i},tt=function(e){et(window,"haptic",e)},nt=function(e,t){return function(e,t,n){void 0===n&&(n=!0);var a,i=Ye(t),r="group"===i?"homeassistant":i;switch(i){case"lock":a=n?"unlock":"lock";break;case"cover":a=n?"open_cover":"close_cover";break;default:a=n?"turn_on":"turn_off"}return e.callService(r,a,{entity_id:t})}(e,t,Je.includes(e.states[t].state))},at=function(e,t,n,a){if(a||(a={action:"more-info"}),!a.confirmation||a.confirmation.exemptions&&a.confirmation.exemptions.some((function(e){return e.user===t.user.id}))||(tt("warning"),confirm(a.confirmation.text||"Are you sure you want to "+a.action+"?")))switch(a.action){case"more-info":(n.entity||n.camera_image)&&et(e,"hass-more-info",{entityId:n.entity?n.entity:n.camera_image});break;case"navigate":a.navigation_path&&function(e,t,n){void 0===n&&(n=!1),n?history.replaceState(null,"",t):history.pushState(null,"",t),et(window,"location-changed",{replace:n})}(0,a.navigation_path);break;case"url":a.url_path&&window.open(a.url_path);break;case"toggle":n.entity&&(nt(t,n.entity),tt("success"));break;case"perform-action":if(!a.perform_action)return void tt("failure");var i=a.perform_action.split(".",2);t.callService(i[0],i[1],a.data,a.target),tt("success");break;case"call-service":if(!a.service)return void tt("failure");var r=a.service.split(".",2);t.callService(r[0],r[1],a.data,a.target),tt("success");break;case"fire-dom-event":et(e,"ll-custom",a)}};!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},e.getValidEnumValues=t=>{const n=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),a={};for(const e of n)a[e]=t[e];return e.objectValues(a)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(const n of e)if(t(n))return n},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(Ke||(Ke={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(Xe||(Xe={}));const it=Ke.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),rt=e=>{switch(typeof e){case"undefined":return it.undefined;case"string":return it.string;case"number":return isNaN(e)?it.nan:it.number;case"boolean":return it.boolean;case"function":return it.function;case"bigint":return it.bigint;case"symbol":return it.symbol;case"object":return Array.isArray(e)?it.array:null===e?it.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?it.promise:"undefined"!=typeof Map&&e instanceof Map?it.map:"undefined"!=typeof Set&&e instanceof Set?it.set:"undefined"!=typeof Date&&e instanceof Date?it.date:it.object;default:return it.unknown}},ot=Ke.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class st extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},n={_errors:[]},a=e=>{for(const i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(a);else if("invalid_return_type"===i.code)a(i.returnTypeError);else if("invalid_arguments"===i.code)a(i.argumentsError);else if(0===i.path.length)n._errors.push(t(i));else{let e=n,a=0;for(;ae.message)){const t={},n=[];for(const a of this.issues)a.path.length>0?(t[a.path[0]]=t[a.path[0]]||[],t[a.path[0]].push(e(a))):n.push(e(a));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}st.create=e=>new st(e);const ct=(e,t)=>{let n;switch(e.code){case ot.invalid_type:n=e.received===it.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case ot.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Ke.jsonStringifyReplacer)}`;break;case ot.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ke.joinValues(e.keys,", ")}`;break;case ot.invalid_union:n="Invalid input";break;case ot.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ke.joinValues(e.options)}`;break;case ot.invalid_enum_value:n=`Invalid enum value. Expected ${Ke.joinValues(e.options)}, received '${e.received}'`;break;case ot.invalid_arguments:n="Invalid function arguments";break;case ot.invalid_return_type:n="Invalid function return type";break;case ot.invalid_date:n="Invalid date";break;case ot.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Ke.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case ot.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case ot.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case ot.custom:n="Invalid input";break;case ot.invalid_intersection_types:n="Intersection results could not be merged";break;case ot.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case ot.not_finite:n="Number must be finite";break;default:n=t.defaultError,Ke.assertNever(e)}return{message:n}};let lt=ct;function dt(){return lt}const ut=e=>{const{data:t,path:n,errorMaps:a,issueData:i}=e,r=[...n,...i.path||[]],o={...i,path:r};if(void 0!==i.message)return{...i,path:r,message:i.message};let s="";const c=a.filter((e=>!!e)).slice().reverse();for(const e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:r,message:s}};function ht(e,t){const n=dt(),a=ut({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===ct?void 0:ct].filter((e=>!!e))});e.common.issues.push(a)}class pt{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const a of t){if("aborted"===a.status)return mt;"dirty"===a.status&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const e of t){const t=await e.key,a=await e.value;n.push({key:t,value:a})}return pt.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const a of t){const{key:t,value:i}=a;if("aborted"===t.status)return mt;if("aborted"===i.status)return mt;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"===t.value||void 0===i.value&&!a.alwaysSet||(n[t.value]=i.value)}return{status:e.value,value:n}}}const mt=Object.freeze({status:"aborted"}),gt=e=>({status:"dirty",value:e}),ft=e=>({status:"valid",value:e}),_t=e=>"aborted"===e.status,vt=e=>"dirty"===e.status,yt=e=>"valid"===e.status,bt=e=>"undefined"!=typeof Promise&&e instanceof Promise;function wt(e,t,n,a){if("a"===n&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?a:"a"===n?a.call(e):a?a.value:t.get(e)}function xt(e,t,n,a,i){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?i.call(e,n):i?i.value=n:t.set(e,n),n}var Ct,Mt,kt;"function"==typeof SuppressedError&&SuppressedError,function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(Ct||(Ct={}));class St{constructor(e,t,n,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=a}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Et=(e,t)=>{if(yt(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new st(e.common.issues);return this._error=t,this._error}}};function $t(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:a,description:i}=e;if(t&&(n||a))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:i};return{errorMap:(t,i)=>{var r,o;const{message:s}=e;return"invalid_enum_value"===t.code?{message:null!=s?s:i.defaultError}:void 0===i.data?{message:null!==(r=null!=s?s:a)&&void 0!==r?r:i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:null!==(o=null!=s?s:n)&&void 0!==o?o:i.defaultError}},description:i}}class At{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return rt(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:rt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new pt,ctx:{common:e.parent.common,data:e.data,parsedType:rt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(bt(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const a={common:{issues:[],async:null!==(n=null==t?void 0:t.async)&&void 0!==n&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rt(e)},i=this._parseSync({data:e,path:a.path,parent:a});return Et(a,i)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rt(e)},a=this._parse({data:e,path:n.path,parent:n}),i=await(bt(a)?a:Promise.resolve(a));return Et(n,i)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,a)=>{const i=e(t),r=()=>a.addIssue({code:ot.custom,...n(t)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then((e=>!!e||(r(),!1))):!!i||(r(),!1)}))}refinement(e,t){return this._refinement(((n,a)=>!!e(n)||(a.addIssue("function"==typeof t?t(n,a):t),!1)))}_refinement(e){return new kn({schema:this,typeName:Pn.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Sn.create(this,this._def)}nullable(){return En.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return on.create(this,this._def)}promise(){return Mn.create(this,this._def)}or(e){return ln.create([this,e],this._def)}and(e){return pn.create(this,e,this._def)}transform(e){return new kn({...$t(this._def),schema:this,typeName:Pn.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new $n({...$t(this._def),innerType:this,defaultValue:t,typeName:Pn.ZodDefault})}brand(){return new Tn({typeName:Pn.ZodBranded,type:this,...$t(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new An({...$t(this._def),innerType:this,catchValue:t,typeName:Pn.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return jn.create(this,e)}readonly(){return On.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const zt=/^c[^\s-]{8,}$/i,It=/^[0-9a-z]+$/,Tt=/^[0-9A-HJKMNP-TV-Z]{26}$/,jt=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ot=/^[a-z0-9_-]{21}$/i,Dt=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Rt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let Pt;const Lt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Nt=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Ft=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Vt="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Ht=new RegExp(`^${Vt}$`);function Bt(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function qt(e){let t=`${Vt}T${Bt(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function Ut(e,t){return!("v4"!==t&&t||!Lt.test(e))||!("v6"!==t&&t||!Nt.test(e))}class Wt extends At{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==it.string){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.string,received:t.parsedType}),mt}const t=new pt;let n;for(const a of this._def.checks)if("min"===a.kind)e.data.lengtha.value&&(n=this._getOrReturnCtx(e,n),ht(n,{code:ot.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("length"===a.kind){const i=e.data.length>a.value,r=e.data.lengthe.test(t)),{validation:t,code:ot.invalid_string,...Ct.errToObj(n)})}_addCheck(e){return new Wt({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ct.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ct.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ct.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ct.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ct.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ct.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ct.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ct.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ct.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ct.errToObj(e)})}datetime(e){var t,n;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(n=null==e?void 0:e.local)&&void 0!==n&&n,...Ct.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...Ct.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Ct.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Ct.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...Ct.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Ct.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Ct.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Ct.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Ct.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Ct.errToObj(t)})}nonempty(e){return this.min(1,Ct.errToObj(e))}trim(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.valuea?n:a;return parseInt(e.toFixed(i).replace(".",""))%parseInt(t.toFixed(i).replace(".",""))/Math.pow(10,i)}Wt.create=e=>{var t;return new Wt({checks:[],typeName:Pn.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...$t(e)})};class Qt extends At{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==it.number){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.number,received:t.parsedType}),mt}let t;const n=new pt;for(const a of this._def.checks)if("int"===a.kind)Ke.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty());else if("min"===a.kind){(a.inclusive?e.dataa.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty())}else"multipleOf"===a.kind?0!==Zt(e.data,a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.not_finite,message:a.message}),n.dirty()):Ke.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ct.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ct.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ct.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ct.toString(t))}setLimit(e,t,n,a){return new Qt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Ct.toString(a)}]})}_addCheck(e){return new Qt({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ct.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ct.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ct.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ct.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ct.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ct.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Ct.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ct.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ct.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value"int"===e.kind||"multipleOf"===e.kind&&Ke.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.valuenew Qt({checks:[],typeName:Pn.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...$t(e)});class Gt extends At{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){this._def.coerce&&(e.data=BigInt(e.data));if(this._getType(e)!==it.bigint){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.bigint,received:t.parsedType}),mt}let t;const n=new pt;for(const a of this._def.checks)if("min"===a.kind){(a.inclusive?e.dataa.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty())}else"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):Ke.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ct.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ct.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ct.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ct.toString(t))}setLimit(e,t,n,a){return new Gt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Ct.toString(a)}]})}_addCheck(e){return new Gt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ct.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ct.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ct.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ct.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ct.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value{var t;return new Gt({checks:[],typeName:Pn.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...$t(e)})};class Yt extends At{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==it.boolean){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.boolean,received:t.parsedType}),mt}return ft(e.data)}}Yt.create=e=>new Yt({typeName:Pn.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...$t(e)});class Kt extends At{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==it.date){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.date,received:t.parsedType}),mt}if(isNaN(e.data.getTime())){return ht(this._getOrReturnCtx(e),{code:ot.invalid_date}),mt}const t=new pt;let n;for(const a of this._def.checks)"min"===a.kind?e.data.getTime()a.value&&(n=this._getOrReturnCtx(e,n),ht(n,{code:ot.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),t.dirty()):Ke.assertNever(a);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Kt({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Ct.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Ct.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.valuenew Kt({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Pn.ZodDate,...$t(e)});class Xt extends At{_parse(e){if(this._getType(e)!==it.symbol){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.symbol,received:t.parsedType}),mt}return ft(e.data)}}Xt.create=e=>new Xt({typeName:Pn.ZodSymbol,...$t(e)});class Jt extends At{_parse(e){if(this._getType(e)!==it.undefined){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.undefined,received:t.parsedType}),mt}return ft(e.data)}}Jt.create=e=>new Jt({typeName:Pn.ZodUndefined,...$t(e)});class en extends At{_parse(e){if(this._getType(e)!==it.null){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.null,received:t.parsedType}),mt}return ft(e.data)}}en.create=e=>new en({typeName:Pn.ZodNull,...$t(e)});class tn extends At{constructor(){super(...arguments),this._any=!0}_parse(e){return ft(e.data)}}tn.create=e=>new tn({typeName:Pn.ZodAny,...$t(e)});class nn extends At{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ft(e.data)}}nn.create=e=>new nn({typeName:Pn.ZodUnknown,...$t(e)});class an extends At{_parse(e){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.never,received:t.parsedType}),mt}}an.create=e=>new an({typeName:Pn.ZodNever,...$t(e)});class rn extends At{_parse(e){if(this._getType(e)!==it.undefined){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.void,received:t.parsedType}),mt}return ft(e.data)}}rn.create=e=>new rn({typeName:Pn.ZodVoid,...$t(e)});class on extends At{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),a=this._def;if(t.parsedType!==it.array)return ht(t,{code:ot.invalid_type,expected:it.array,received:t.parsedType}),mt;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,i=t.data.lengtha.maxLength.value&&(ht(t,{code:ot.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map(((e,n)=>a.type._parseAsync(new St(t,e,t.path,n))))).then((e=>pt.mergeArray(n,e)));const i=[...t.data].map(((e,n)=>a.type._parseSync(new St(t,e,t.path,n))));return pt.mergeArray(n,i)}get element(){return this._def.type}min(e,t){return new on({...this._def,minLength:{value:e,message:Ct.toString(t)}})}max(e,t){return new on({...this._def,maxLength:{value:e,message:Ct.toString(t)}})}length(e,t){return new on({...this._def,exactLength:{value:e,message:Ct.toString(t)}})}nonempty(e){return this.min(1,e)}}function sn(e){if(e instanceof cn){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=Sn.create(sn(a))}return new cn({...e._def,shape:()=>t})}return e instanceof on?new on({...e._def,type:sn(e.element)}):e instanceof Sn?Sn.create(sn(e.unwrap())):e instanceof En?En.create(sn(e.unwrap())):e instanceof mn?mn.create(e.items.map((e=>sn(e)))):e}on.create=(e,t)=>new on({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Pn.ZodArray,...$t(t)});class cn extends At{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=Ke.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==it.object){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.object,received:t.parsedType}),mt}const{status:t,ctx:n}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),r=[];if(!(this._def.catchall instanceof an&&"strip"===this._def.unknownKeys))for(const e in n.data)i.includes(e)||r.push(e);const o=[];for(const e of i){const t=a[e],i=n.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new St(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof an){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of r)o.push({key:{status:"valid",value:e},value:{status:"valid",value:n.data[e]}});else if("strict"===e)r.length>0&&(ht(n,{code:ot.unrecognized_keys,keys:r}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of r){const a=n.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new St(n,a,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of o){const n=await t.key,a=await t.value;e.push({key:n,value:a,alwaysSet:t.alwaysSet})}return e})).then((e=>pt.mergeObjectSync(t,e))):pt.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return Ct.errToObj,new cn({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var a,i,r,o;const s=null!==(r=null===(i=(a=this._def).errorMap)||void 0===i?void 0:i.call(a,t,n).message)&&void 0!==r?r:n.defaultError;return"unrecognized_keys"===t.code?{message:null!==(o=Ct.errToObj(e).message)&&void 0!==o?o:s}:{message:s}}}:{}})}strip(){return new cn({...this._def,unknownKeys:"strip"})}passthrough(){return new cn({...this._def,unknownKeys:"passthrough"})}extend(e){return new cn({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new cn({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Pn.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new cn({...this._def,catchall:e})}pick(e){const t={};return Ke.objectKeys(e).forEach((n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])})),new cn({...this._def,shape:()=>t})}omit(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{e[n]||(t[n]=this.shape[n])})),new cn({...this._def,shape:()=>t})}deepPartial(){return sn(this)}partial(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{const a=this.shape[n];e&&!e[n]?t[n]=a:t[n]=a.optional()})),new cn({...this._def,shape:()=>t})}required(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof Sn;)e=e._def.innerType;t[n]=e}})),new cn({...this._def,shape:()=>t})}keyof(){return wn(Ke.objectKeys(this.shape))}}cn.create=(e,t)=>new cn({shape:()=>e,unknownKeys:"strip",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)}),cn.strictCreate=(e,t)=>new cn({shape:()=>e,unknownKeys:"strict",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)}),cn.lazycreate=(e,t)=>new cn({shape:e,unknownKeys:"strip",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)});class ln extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map((async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;const n=e.map((e=>new st(e.ctx.common.issues)));return ht(t,{code:ot.invalid_union,unionErrors:n}),mt}));{let e;const a=[];for(const i of n){const n={...t,common:{...t.common,issues:[]},parent:null},r=i._parseSync({data:t.data,path:t.path,parent:n});if("valid"===r.status)return r;"dirty"!==r.status||e||(e={result:r,ctx:n}),n.common.issues.length&&a.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const i=a.map((e=>new st(e)));return ht(t,{code:ot.invalid_union,unionErrors:i}),mt}}get options(){return this._def.options}}ln.create=(e,t)=>new ln({options:e,typeName:Pn.ZodUnion,...$t(t)});const dn=e=>e instanceof yn?dn(e.schema):e instanceof kn?dn(e.innerType()):e instanceof bn?[e.value]:e instanceof xn?e.options:e instanceof Cn?Ke.objectValues(e.enum):e instanceof $n?dn(e._def.innerType):e instanceof Jt?[void 0]:e instanceof en?[null]:e instanceof Sn?[void 0,...dn(e.unwrap())]:e instanceof En?[null,...dn(e.unwrap())]:e instanceof Tn||e instanceof On?dn(e.unwrap()):e instanceof An?dn(e._def.innerType):[];class un extends At{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.object)return ht(t,{code:ot.invalid_type,expected:it.object,received:t.parsedType}),mt;const n=this.discriminator,a=t.data[n],i=this.optionsMap.get(a);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(ht(t,{code:ot.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),mt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const a=new Map;for(const n of t){const t=dn(n.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const i of t){if(a.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);a.set(i,n)}}return new un({typeName:Pn.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...$t(n)})}}function hn(e,t){const n=rt(e),a=rt(t);if(e===t)return{valid:!0,data:e};if(n===it.object&&a===it.object){const n=Ke.objectKeys(t),a=Ke.objectKeys(e).filter((e=>-1!==n.indexOf(e))),i={...e,...t};for(const n of a){const a=hn(e[n],t[n]);if(!a.valid)return{valid:!1};i[n]=a.data}return{valid:!0,data:i}}if(n===it.array&&a===it.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let a=0;a{if(_t(e)||_t(a))return mt;const i=hn(e.value,a.value);return i.valid?((vt(e)||vt(a))&&t.dirty(),{status:t.value,value:i.data}):(ht(n,{code:ot.invalid_intersection_types}),mt)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then((([e,t])=>a(e,t))):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}pn.create=(e,t,n)=>new pn({left:e,right:t,typeName:Pn.ZodIntersection,...$t(n)});class mn extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.array)return ht(n,{code:ot.invalid_type,expected:it.array,received:n.parsedType}),mt;if(n.data.lengththis._def.items.length&&(ht(n,{code:ot.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map(((e,t)=>{const a=this._def.items[t]||this._def.rest;return a?a._parse(new St(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(a).then((e=>pt.mergeArray(t,e))):pt.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new mn({...this._def,rest:e})}}mn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new mn({items:e,typeName:Pn.ZodTuple,rest:null,...$t(t)})};class gn extends At{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.object)return ht(n,{code:ot.invalid_type,expected:it.object,received:n.parsedType}),mt;const a=[],i=this._def.keyType,r=this._def.valueType;for(const e in n.data)a.push({key:i._parse(new St(n,e,n.path,e)),value:r._parse(new St(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?pt.mergeObjectAsync(t,a):pt.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,n){return new gn(t instanceof At?{keyType:e,valueType:t,typeName:Pn.ZodRecord,...$t(n)}:{keyType:Wt.create(),valueType:e,typeName:Pn.ZodRecord,...$t(t)})}}class fn extends At{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.map)return ht(n,{code:ot.invalid_type,expected:it.map,received:n.parsedType}),mt;const a=this._def.keyType,i=this._def.valueType,r=[...n.data.entries()].map((([e,t],r)=>({key:a._parse(new St(n,e,n.path,[r,"key"])),value:i._parse(new St(n,t,n.path,[r,"value"]))})));if(n.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const n of r){const a=await n.key,i=await n.value;if("aborted"===a.status||"aborted"===i.status)return mt;"dirty"!==a.status&&"dirty"!==i.status||t.dirty(),e.set(a.value,i.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const n of r){const a=n.key,i=n.value;if("aborted"===a.status||"aborted"===i.status)return mt;"dirty"!==a.status&&"dirty"!==i.status||t.dirty(),e.set(a.value,i.value)}return{status:t.value,value:e}}}}fn.create=(e,t,n)=>new fn({valueType:t,keyType:e,typeName:Pn.ZodMap,...$t(n)});class _n extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.set)return ht(n,{code:ot.invalid_type,expected:it.set,received:n.parsedType}),mt;const a=this._def;null!==a.minSize&&n.data.sizea.maxSize.value&&(ht(n,{code:ot.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const i=this._def.valueType;function r(e){const n=new Set;for(const a of e){if("aborted"===a.status)return mt;"dirty"===a.status&&t.dirty(),n.add(a.value)}return{status:t.value,value:n}}const o=[...n.data.values()].map(((e,t)=>i._parse(new St(n,e,n.path,t))));return n.common.async?Promise.all(o).then((e=>r(e))):r(o)}min(e,t){return new _n({...this._def,minSize:{value:e,message:Ct.toString(t)}})}max(e,t){return new _n({...this._def,maxSize:{value:e,message:Ct.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}_n.create=(e,t)=>new _n({valueType:e,minSize:null,maxSize:null,typeName:Pn.ZodSet,...$t(t)});class vn extends At{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.function)return ht(t,{code:ot.invalid_type,expected:it.function,received:t.parsedType}),mt;function n(e,n){return ut({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,dt(),ct].filter((e=>!!e)),issueData:{code:ot.invalid_arguments,argumentsError:n}})}function a(e,n){return ut({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,dt(),ct].filter((e=>!!e)),issueData:{code:ot.invalid_return_type,returnTypeError:n}})}const i={errorMap:t.common.contextualErrorMap},r=t.data;if(this._def.returns instanceof Mn){const e=this;return ft((async function(...t){const o=new st([]),s=await e._def.args.parseAsync(t,i).catch((e=>{throw o.addIssue(n(t,e)),o})),c=await Reflect.apply(r,this,s),l=await e._def.returns._def.type.parseAsync(c,i).catch((e=>{throw o.addIssue(a(c,e)),o}));return l}))}{const e=this;return ft((function(...t){const o=e._def.args.safeParse(t,i);if(!o.success)throw new st([n(t,o.error)]);const s=Reflect.apply(r,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new st([a(s,c.error)]);return c.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new vn({...this._def,args:mn.create(e).rest(nn.create())})}returns(e){return new vn({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new vn({args:e||mn.create([]).rest(nn.create()),returns:t||nn.create(),typeName:Pn.ZodFunction,...$t(n)})}}class yn extends At{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}yn.create=(e,t)=>new yn({getter:e,typeName:Pn.ZodLazy,...$t(t)});class bn extends At{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return ht(t,{received:t.data,code:ot.invalid_literal,expected:this._def.value}),mt}return{status:"valid",value:e.data}}get value(){return this._def.value}}function wn(e,t){return new xn({values:e,typeName:Pn.ZodEnum,...$t(t)})}bn.create=(e,t)=>new bn({value:e,typeName:Pn.ZodLiteral,...$t(t)});class xn extends At{constructor(){super(...arguments),Mt.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return ht(t,{expected:Ke.joinValues(n),received:t.parsedType,code:ot.invalid_type}),mt}if(wt(this,Mt,"f")||xt(this,Mt,new Set(this._def.values),"f"),!wt(this,Mt,"f").has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return ht(t,{received:t.data,code:ot.invalid_enum_value,options:n}),mt}return ft(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return xn.create(e,{...this._def,...t})}exclude(e,t=this._def){return xn.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}Mt=new WeakMap,xn.create=wn;class Cn extends At{constructor(){super(...arguments),kt.set(this,void 0)}_parse(e){const t=Ke.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==it.string&&n.parsedType!==it.number){const e=Ke.objectValues(t);return ht(n,{expected:Ke.joinValues(e),received:n.parsedType,code:ot.invalid_type}),mt}if(wt(this,kt,"f")||xt(this,kt,new Set(Ke.getValidEnumValues(this._def.values)),"f"),!wt(this,kt,"f").has(e.data)){const e=Ke.objectValues(t);return ht(n,{received:n.data,code:ot.invalid_enum_value,options:e}),mt}return ft(e.data)}get enum(){return this._def.values}}kt=new WeakMap,Cn.create=(e,t)=>new Cn({values:e,typeName:Pn.ZodNativeEnum,...$t(t)});class Mn extends At{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.promise&&!1===t.common.async)return ht(t,{code:ot.invalid_type,expected:it.promise,received:t.parsedType}),mt;const n=t.parsedType===it.promise?t.data:Promise.resolve(t.data);return ft(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}Mn.create=(e,t)=>new Mn({type:e,typeName:Pn.ZodPromise,...$t(t)});class kn extends At{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Pn.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),a=this._def.effect||null,i={addIssue:e=>{ht(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===a.type){const e=a.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return mt;const a=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===a.status?mt:"dirty"===a.status||"dirty"===t.value?gt(a.value):a}));{if("aborted"===t.value)return mt;const a=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===a.status?mt:"dirty"===a.status||"dirty"===t.value?gt(a.value):a}}if("refinement"===a.type){const e=e=>{const t=a.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===n.common.async){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===a.status?mt:("dirty"===a.status&&t.dirty(),e(a.value),{status:t.value,value:a.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((n=>"aborted"===n.status?mt:("dirty"===n.status&&t.dirty(),e(n.value).then((()=>({status:t.value,value:n.value}))))))}if("transform"===a.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!yt(e))return e;const r=a.transform(e.value,i);if(r instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:r}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((e=>yt(e)?Promise.resolve(a.transform(e.value,i)).then((e=>({status:t.value,value:e}))):e))}Ke.assertNever(a)}}kn.create=(e,t,n)=>new kn({schema:e,typeName:Pn.ZodEffects,effect:t,...$t(n)}),kn.createWithPreprocess=(e,t,n)=>new kn({schema:t,effect:{type:"preprocess",transform:e},typeName:Pn.ZodEffects,...$t(n)});class Sn extends At{_parse(e){return this._getType(e)===it.undefined?ft(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Sn.create=(e,t)=>new Sn({innerType:e,typeName:Pn.ZodOptional,...$t(t)});class En extends At{_parse(e){return this._getType(e)===it.null?ft(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}En.create=(e,t)=>new En({innerType:e,typeName:Pn.ZodNullable,...$t(t)});class $n extends At{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===it.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}$n.create=(e,t)=>new $n({innerType:e,typeName:Pn.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...$t(t)});class An extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return bt(a)?a.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new st(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new st(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}An.create=(e,t)=>new An({innerType:e,typeName:Pn.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...$t(t)});class zn extends At{_parse(e){if(this._getType(e)!==it.nan){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.nan,received:t.parsedType}),mt}return{status:"valid",value:e.data}}}zn.create=e=>new zn({typeName:Pn.ZodNaN,...$t(e)});const In=Symbol("zod_brand");class Tn extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class jn extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?mt:"dirty"===e.status?(t.dirty(),gt(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})()}{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?mt:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new jn({in:e,out:t,typeName:Pn.ZodPipeline})}}class On extends At{_parse(e){const t=this._def.innerType._parse(e),n=e=>(yt(e)&&(e.value=Object.freeze(e.value)),e);return bt(t)?t.then((e=>n(e))):n(t)}unwrap(){return this._def.innerType}}function Dn(e,t={},n){return e?tn.create().superRefine(((a,i)=>{var r,o;if(!e(a)){const e="function"==typeof t?t(a):"string"==typeof t?{message:t}:t,s=null===(o=null!==(r=e.fatal)&&void 0!==r?r:n)||void 0===o||o,c="string"==typeof e?{message:e}:e;i.addIssue({code:"custom",...c,fatal:s})}})):tn.create()}On.create=(e,t)=>new On({innerType:e,typeName:Pn.ZodReadonly,...$t(t)});const Rn={object:cn.lazycreate};var Pn;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(Pn||(Pn={}));const Ln=Wt.create,Nn=Qt.create,Fn=zn.create,Vn=Gt.create,Hn=Yt.create,Bn=Kt.create,qn=Xt.create,Un=Jt.create,Wn=en.create,Zn=tn.create,Qn=nn.create,Gn=an.create,Yn=rn.create,Kn=on.create,Xn=cn.create,Jn=cn.strictCreate,ea=ln.create,ta=un.create,na=pn.create,aa=mn.create,ia=gn.create,ra=fn.create,oa=_n.create,sa=vn.create,ca=yn.create,la=bn.create,da=xn.create,ua=Cn.create,ha=Mn.create,pa=kn.create,ma=Sn.create,ga=En.create,fa=kn.createWithPreprocess,_a=jn.create,va={string:e=>Wt.create({...e,coerce:!0}),number:e=>Qt.create({...e,coerce:!0}),boolean:e=>Yt.create({...e,coerce:!0}),bigint:e=>Gt.create({...e,coerce:!0}),date:e=>Kt.create({...e,coerce:!0})},ya=mt;var ba=Object.freeze({__proto__:null,defaultErrorMap:ct,setErrorMap:function(e){lt=e},getErrorMap:dt,makeIssue:ut,EMPTY_PATH:[],addIssueToContext:ht,ParseStatus:pt,INVALID:mt,DIRTY:gt,OK:ft,isAborted:_t,isDirty:vt,isValid:yt,isAsync:bt,get util(){return Ke},get objectUtil(){return Xe},ZodParsedType:it,getParsedType:rt,ZodType:At,datetimeRegex:qt,ZodString:Wt,ZodNumber:Qt,ZodBigInt:Gt,ZodBoolean:Yt,ZodDate:Kt,ZodSymbol:Xt,ZodUndefined:Jt,ZodNull:en,ZodAny:tn,ZodUnknown:nn,ZodNever:an,ZodVoid:rn,ZodArray:on,ZodObject:cn,ZodUnion:ln,ZodDiscriminatedUnion:un,ZodIntersection:pn,ZodTuple:mn,ZodRecord:gn,ZodMap:fn,ZodSet:_n,ZodFunction:vn,ZodLazy:yn,ZodLiteral:bn,ZodEnum:xn,ZodNativeEnum:Cn,ZodPromise:Mn,ZodEffects:kn,ZodTransformer:kn,ZodOptional:Sn,ZodNullable:En,ZodDefault:$n,ZodCatch:An,ZodNaN:zn,BRAND:In,ZodBranded:Tn,ZodPipeline:jn,ZodReadonly:On,custom:Dn,Schema:At,ZodSchema:At,late:Rn,get ZodFirstPartyTypeKind(){return Pn},coerce:va,any:Zn,array:Kn,bigint:Vn,boolean:Hn,date:Bn,discriminatedUnion:ta,effect:pa,enum:da,function:sa,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>Dn((t=>t instanceof e),t),intersection:na,lazy:ca,literal:la,map:ra,nan:Fn,nativeEnum:ua,never:Gn,null:Wn,nullable:ga,number:Nn,object:Xn,oboolean:()=>Hn().optional(),onumber:()=>Nn().optional(),optional:ma,ostring:()=>Ln().optional(),pipeline:_a,preprocess:fa,promise:ha,record:ia,set:oa,strictObject:Jn,string:Ln,symbol:qn,transformer:pa,tuple:aa,undefined:Un,union:ea,unknown:Qn,void:Yn,NEVER:ya,ZodIssueCode:ot,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:st});const wa="https://github.com/dermotduffy/frigate-hass-card",xa=`${wa}#troubleshooting`,Ca="cameras",Ma=`${Ca}.#.camera_entity`,ka=`${Ca}.#.frigate.camera_name`,Sa=`${Ca}.#.capabilities.disable`,Ea=`${Ca}.#.capabilities.disable_except`,$a=`${Ca}.#.cast.method`,Aa=`${Ca}.#.cast.dashboard.dashboard_path`,za=`${Ca}.#.cast.dashboard.view_path`,Ia=`${Ca}.#.dimensions.aspect_ratio`,Ta=`${Ca}.#.frigate.client_id`,ja=`${Ca}.#.frigate.labels`,Oa=`${Ca}.#.frigate.url`,Da=`${Ca}.#.frigate.zones`,Ra=`${Ca}.#.go2rtc.modes`,Pa=`${Ca}.#.go2rtc.stream`,La=`${Ca}.#.icon`,Na=`${Ca}.#.id`,Fa=`${Ca}.#.image.entity`,Va=`${Ca}.#.image.entity_parameters`,Ha=`${Ca}.#.image.mode`,Ba=`${Ca}.#.image.refresh_seconds`,qa=`${Ca}.#.image.url`,Ua=`${Ca}.#.motioneye.images.directory_pattern`,Wa=`${Ca}.#.motioneye.images.file_pattern`,Za=`${Ca}.#.motioneye.movies.directory_pattern`,Qa=`${Ca}.#.motioneye.movies.file_pattern`,Ga=`${Ca}.#.motioneye.url`,Ya=`${Ca}.#.title`,Ka=`${Ca}.#.webrtc_card.entity`,Xa=`${Ca}.#.webrtc_card.url`,Ja=`${Ca}.#.live_provider`,ei=`${Ca}.#.dependencies.cameras`,ti=`${Ca}.#.dependencies.all_cameras`,ni=`${Ca}.#.dimensions.layout.fit`,ai=`${Ca}.#.dimensions.layout.pan.x`,ii=`${Ca}.#.dimensions.layout.pan.y`,ri=`${Ca}.#.dimensions.layout.position.x`,oi=`${Ca}.#.dimensions.layout.position.y`,si=`${Ca}.#.dimensions.layout.view_box.top`,ci=`${Ca}.#.dimensions.layout.view_box.bottom`,li=`${Ca}.#.dimensions.layout.view_box.left`,di=`${Ca}.#.dimensions.layout.view_box.right`,ui=`${Ca}.#.dimensions.layout.zoom`,hi=`${Ca}.#.proxy.dynamic`,pi=`${Ca}.#.proxy.media`,mi=`${Ca}.#.proxy.ssl_ciphers`,gi=`${Ca}.#.proxy.ssl_verification`,fi=`${Ca}.#.reolink.media_resolution`,_i=`${Ca}.#.reolink.url`,vi=`${Ca}.#.triggers.motion`,yi=`${Ca}.#.triggers.occupancy`,bi=`${Ca}.#.triggers.entities`,wi=`${Ca}.#.triggers.events`,xi="cameras_global",Ci=`${xi}.image`,Mi=`${xi}.live_provider`,ki=`${xi}.jsmpeg`,Si=`${xi}.webrtc_card`,Ei=`${xi}.triggers.occupancy`,$i=`${xi}.image.refresh_seconds`,Ai=`${xi}.dimensions.layout`,zi=`${xi}.ptz`,Ii="elements",Ti="view",ji=`${Ti}.camera_select`,Oi=`${Ti}.dark_mode`,Di=`${Ti}.default`,Ri=`${Ti}.interaction_seconds`,Pi=`${Ti}.keyboard_shortcuts`,Li=`${Ti}.keyboard_shortcuts.enabled`,Ni=`${Pi}.ptz_left`,Fi=`${Pi}.ptz_right`,Vi=`${Pi}.ptz_up`,Hi=`${Pi}.ptz_down`,Bi=`${Pi}.ptz_zoom_in`,qi=`${Pi}.ptz_zoom_out`,Ui=`${Pi}.ptz_home`,Wi=`${Ti}.default_cycle_camera`,Zi=`${Ti}.default_reset`,Qi=`${Zi}.interaction_mode`,Gi=`${Zi}.every_seconds`,Yi=`${Zi}.entities`,Ki=`${Zi}.after_interaction`,Xi=`${Ti}.triggers`,Ji=`${Xi}.show_trigger_status`,er=`${Xi}.filter_selected_camera`,tr=`${Xi}.untrigger_seconds`,nr=`${Xi}.actions`,ar=`${nr}.trigger`,ir=`${nr}.untrigger`,rr=`${nr}.interaction_mode`,or="media_gallery",sr=`${or}.controls.filter.mode`,cr=`${or}.controls.thumbnails.show_details`,lr=`${or}.controls.thumbnails.show_download_control`,dr=`${or}.controls.thumbnails.show_favorite_control`,ur=`${or}.controls.thumbnails.show_timeline_control`,hr=`${or}.controls.thumbnails.size`,pr="media_viewer",mr=`${pr}.auto_play`,gr=`${pr}.auto_pause`,fr=`${pr}.auto_mute`,_r=`${pr}.auto_unmute`,vr=`${pr}.display.mode`,yr=`${pr}.display.grid_columns`,br=`${pr}.display.grid_max_columns`,wr=`${pr}.display.grid_selected_width_factor`,xr=`${pr}.draggable`,Cr=`${pr}.lazy_load`,Mr=`${pr}.snapshot_click_plays_clip`,kr=`${pr}.transition_effect`,Sr=`${pr}.controls.builtin`,Er=`${pr}.controls.next_previous.style`,$r=`${pr}.controls.next_previous.size`,Ar=`${pr}.controls.thumbnails.mode`,zr=`${pr}.controls.thumbnails.show_details`,Ir=`${pr}.controls.thumbnails.show_download_control`,Tr=`${pr}.controls.thumbnails.show_favorite_control`,jr=`${pr}.controls.thumbnails.show_timeline_control`,Or=`${pr}.controls.thumbnails.size`,Dr=`${pr}.controls.timeline.clustering_threshold`,Rr=`${pr}.controls.timeline.events_media_type`,Pr=`${pr}.controls.timeline.mode`,Lr=`${pr}.controls.timeline.pan_mode`,Nr=`${pr}.controls.timeline.show_recordings`,Fr=`${pr}.controls.timeline.style`,Vr=`${pr}.controls.timeline.window_seconds`,Hr=`${pr}.zoomable`,Br="live",qr=`${Br}.auto_play`,Ur=`${Br}.auto_pause`,Wr=`${Br}.auto_mute`,Zr=`${Br}.auto_unmute`,Qr=`${Br}.controls.builtin`,Gr=`${Br}.controls.next_previous.style`,Yr=`${Br}.controls.next_previous.size`,Kr=`${Br}.controls.ptz.hide_home`,Xr=`${Br}.controls.ptz.hide_pan_tilt`,Jr=`${Br}.controls.ptz.hide_zoom`,eo=`${Br}.controls.ptz.mode`,to=`${Br}.controls.ptz.orientation`,no=`${Br}.controls.ptz.position`,ao=`${Br}.controls.thumbnails.media_type`,io=`${Br}.controls.thumbnails.events_media_type`,ro=`${Br}.controls.thumbnails.mode`,oo=`${Br}.controls.thumbnails.size`,so=`${Br}.controls.thumbnails.show_details`,co=`${Br}.controls.thumbnails.show_download_control`,lo=`${Br}.controls.thumbnails.show_favorite_control`,uo=`${Br}.controls.thumbnails.show_timeline_control`,ho=`${Br}.controls.timeline.clustering_threshold`,po=`${Br}.controls.timeline.events_media_type`,mo=`${Br}.controls.timeline.mode`,go=`${Br}.controls.timeline.pan_mode`,fo=`${Br}.controls.timeline.show_recordings`,_o=`${Br}.controls.timeline.style`,vo=`${Br}.controls.timeline.window_seconds`,yo=`${Br}.display.mode`,bo=`${Br}.display.grid_columns`,wo=`${Br}.display.grid_max_columns`,xo=`${Br}.display.grid_selected_width_factor`,Co=`${Br}.draggable`,Mo=`${Br}.lazy_load`,ko=`${Br}.lazy_unload`,So=`${Br}.preload`,Eo=`${Br}.transition_effect`,$o=`${Br}.show_image_during_load`,Ao=`${Br}.microphone.disconnect_seconds`,zo=`${Br}.microphone.mute_after_microphone_mute_seconds`,Io=`${Br}.microphone.always_connected`,To=`${Br}.zoomable`,jo="image",Oo=`${jo}.entity`,Do=`${jo}.entity_parameters`,Ro=`${jo}.mode`,Po=`${jo}.refresh_seconds`,Lo=`${jo}.url`,No="timeline",Fo=`${No}.window_seconds`,Vo=`${No}.clustering_threshold`,Ho=`${No}.events_media_type`,Bo=`${No}.show_recordings`,qo=`${No}.style`,Uo=`${No}.controls.thumbnails.mode`,Wo=`${No}.controls.thumbnails.size`,Zo=`${No}.controls.thumbnails.show_details`,Qo=`${No}.controls.thumbnails.show_download_control`,Go=`${No}.controls.thumbnails.show_favorite_control`,Yo=`${No}.controls.thumbnails.show_timeline_control`,Ko="menu",Xo=`${Ko}.alignment`,Jo=`${Ko}.position`,es=`${Ko}.style`,ts=`${Ko}.button_size`,ns=`${Ko}.buttons`,as=`${ns}.frigate`,is=`${ns}.camera_ui`,rs=`${ns}.fullscreen`,os=`${ns}.play`,ss=`${ns}.mute`,cs=`${ns}.media_player`,ls=`${ns}.timeline`,ds="status_bar",us=`${ds}.position`,hs=`${ds}.style`,ps=`${ds}.popup_seconds`,ms=`${ds}.height`,gs=`${ds}.items`,fs="dimensions",_s=`${fs}.aspect_ratio`,vs=`${fs}.aspect_ratio_mode`,ys=`${fs}.height`,bs="overrides",ws="performance",xs=`${ws}.features.animated_progress_indicator`,Cs=`${ws}.features.media_chunk_size`,Ms=`${ws}.features.max_simultaneous_engine_requests`,ks=`${ws}.profile`,Ss=`${ws}.style.box_shadow`,Es=`${ws}.style.border_radius`,$s="profiles",As=1e3;class zs extends Error{constructor(e,t){super(e),this.context=t}}const Is={info:10,error:20,connection:30,diagnostics:40},Ts=["clips","favorite-events","favorite-recordings","live","menu","ptz","recordings","seek","snapshots","substream"],js=ba.object({url:ba.string(),mime_type:ba.string()}),Os=ba.object({path:ba.string()});function Ds(e){if(e instanceof ba.ZodDefault)return Ds(e.removeDefault());if(e instanceof ba.ZodObject){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=ba.ZodOptional.create(Ds(a))}return new ba.ZodObject({...e._def,shape:()=>t})}return e instanceof ba.ZodArray?ba.ZodArray.create(Ds(e.element)).min(e._def.minLength?.value,e._def.minLength?.message).max(e._def.maxLength?.value,e._def.maxLength?.message).length(e._def.exactLength?.value,e._def.exactLength?.message):e instanceof ba.ZodOptional?ba.ZodOptional.create(Ds(e.unwrap())):e instanceof ba.ZodNullable?ba.ZodNullable.create(Ds(e.unwrap())):e instanceof ba.ZodTuple?ba.ZodTuple.create(e.items.map((e=>Ds(e)))):e}function Rs(e){const t=e.format();return Object.keys(t).filter((e=>!e.startsWith("_")))}const Ps=e=>{const t=new Set;if(e.issues.length)for(const n of e.issues)if("invalid_union"===n.code){const e=n.unionErrors;for(const n of e)Ps(n).forEach(t.add,t)}else t.add(Ls(n.path));return t},Ls=e=>{let t="";for(let n=0;n"fire-dom-event")).or(ba.literal("fire-dom-event")),card_id:ba.string().regex(tc,"card_id parameter can only contain [a-z][A-Z][0-9_]-").optional()}),_c=fc.extend({frigate_card_action:ba.enum(Zs)}),vc=fc.extend({frigate_card_action:ba.enum(["camera_ui","default","download","expand","fullscreen","live_substream_off","live_substream_on","menu_toggle","microphone_connect","microphone_disconnect","microphone_mute","microphone_unmute","mute","pause","play","screenshot","unmute"])}),yc=fc.extend({frigate_card_action:ba.literal("camera_select"),camera:ba.string().optional(),triggered:ba.boolean().optional()}),bc=fc.extend({frigate_card_action:ba.literal("live_substream_select"),camera:ba.string()}),wc=fc.extend({frigate_card_action:ba.literal("media_player"),media_player:ba.string(),media_player_action:ba.enum(["play","stop"])}),xc=fc.extend({frigate_card_action:ba.literal("display_mode_select"),display_mode:ic}),Cc=fc.extend({frigate_card_action:ba.literal("ptz"),camera:ba.string().optional(),ptz_action:ba.enum(Hs).optional(),ptz_phase:ba.enum(Js).optional(),ptz_preset:ba.string().optional()}),Mc=fc.extend({frigate_card_action:ba.literal("ptz_digital"),target_id:ba.string().optional(),absolute:ba.object({zoom:ac.optional(),pan:nc.optional()}).optional(),ptz_action:ba.enum(Hs).optional(),ptz_phase:ba.enum(Js).optional()}),kc=fc.extend({frigate_card_action:ba.literal("ptz_multi"),target_id:ba.string().optional(),ptz_action:ba.enum(Hs).optional(),ptz_phase:ba.enum(Js).optional(),ptz_preset:ba.string().optional()}),Sc=fc.extend({frigate_card_action:ba.literal("ptz_controls"),enabled:ba.boolean()}),Ec=ba.object({ms:ba.number().optional(),s:ba.number().optional(),m:ba.number().optional(),h:ba.number().optional()}),$c=fc.extend({frigate_card_action:ba.literal("sleep"),duration:Ec.optional().default({s:1})}),Ac=fc.extend({frigate_card_action:ba.literal("status_bar"),status_bar_action:ba.enum(["add","remove","reset"]),items:ba.lazy((()=>ol)).array().optional()}),zc=fc.extend({frigate_card_action:ba.literal("log"),message:ba.string(),level:ba.enum(["debug","info","warn","error"]).default("info")}),Ic=ba.union([yc,vc,bc,zc,wc,Cc,Mc,kc,Sc,_c,xc,$c,Ac]),Tc=ba.union([sc,dc,lc,uc,hc,pc,gc,mc,Ic]),jc=ba.object({tap_action:Tc.or(Tc.array()).optional(),hold_action:Tc.or(Tc.array()).optional(),double_tap_action:Tc.or(Tc.array()).optional(),start_tap_action:Tc.or(Tc.array()).optional(),end_tap_action:Tc.or(Tc.array()).optional()}).passthrough(),Oc=ba.object({actions:jc.optional()}),Dc=jc.extend({style:ba.record(ba.string().nullable().or(ba.undefined()).or(ba.number())).optional(),title:ba.string().nullable().optional()}),Rc=Dc.extend({type:ba.literal("state-badge"),entity:ba.string()}),Pc=Dc.extend({type:ba.literal("state-icon"),entity:ba.string(),icon:ba.string().optional(),state_color:ba.boolean().default(!0)}),Lc=Dc.extend({type:ba.literal("state-label"),entity:ba.string(),attribute:ba.string().optional(),prefix:ba.string().optional(),suffix:ba.string().optional()}),Nc=Dc.extend({type:ba.literal("service-button"),title:ba.string(),service:ba.string(),service_data:ba.object({}).passthrough().optional()}),Fc=Dc.extend({type:ba.literal("icon"),icon:ba.string(),entity:ba.string().optional()}),Vc=Dc.extend({type:ba.literal("image"),entity:ba.string().optional(),image:ba.string().optional(),camera_image:ba.string().optional(),camera_view:ba.string().optional(),state_image:ba.object({}).passthrough().optional(),filter:ba.string().optional(),state_filter:ba.object({}).passthrough().optional(),aspect_ratio:ba.string().optional()}),Hc=ba.object({condition:ba.literal("state").optional(),entity:ba.string(),state:ba.string().or(ba.string().array()).optional(),state_not:ba.string().or(ba.string().array()).optional()}),Bc=ba.object({condition:ba.literal("numeric_state"),entity:ba.string(),above:ba.number().optional(),below:ba.number().optional()}),qc=ba.object({condition:ba.literal("screen"),media_query:ba.string()}),Uc=ba.object({condition:ba.literal("user"),users:ba.string().array().min(1)}),Wc=ba.discriminatedUnion("condition",[Hc,Bc,qc,Uc]),Zc=ba.object({type:ba.literal("conditional"),conditions:Wc.array(),elements:ba.lazy((()=>yl))}),Qc=ba.object({type:ba.string().superRefine(((e,t)=>{e.match(/^custom:(?!frigate-card).+/)||t.addIssue({code:ba.ZodIssueCode.custom,message:"Frigate-card custom elements must match specific schemas",fatal:!0})}))}).passthrough(),Gc=ba.object({enabled:ba.boolean().default(!0).optional(),priority:ba.number().min(0).max(Us).default(50).optional(),alignment:ba.enum(["matching","opposing"]).default("matching").optional(),icon:ba.string().optional(),permanent:ba.boolean().default(!1).optional()}),Yc=Gc.merge(Fc).extend({type:ba.literal("custom:frigate-card-menu-icon")}),Kc=Gc.merge(Pc).extend({type:ba.literal("custom:frigate-card-menu-state-icon")}).merge(Gc),Xc=Dc.extend({entity:ba.string().optional(),icon:ba.string().optional(),state_color:ba.boolean().default(!0),selected:ba.boolean().default(!1),subtitle:ba.string().optional(),enabled:ba.boolean().default(!0)}),Jc=Gc.merge(Fc).extend({type:ba.literal("custom:frigate-card-menu-submenu"),items:Xc.array()}),el=Gc.merge(Pc).extend({type:ba.literal("custom:frigate-card-menu-submenu-select"),options:ba.record(Xc.deepPartial()).optional()}),tl=ba.object({enabled:ba.boolean().default(!0).optional(),priority:ba.number().min(0).max(100).default(50).optional()}),nl=tl.extend({sufficient:ba.boolean().default(!1).optional(),exclusive:ba.boolean().default(!1).optional(),expand:ba.boolean().default(!1).optional(),actions:jc.optional()}),al=nl.extend({type:ba.literal("custom:frigate-card-status-bar-icon"),icon:ba.string()}),il=nl.extend({type:ba.literal("custom:frigate-card-status-bar-image"),image:ba.string()}),rl=nl.extend({type:ba.literal("custom:frigate-card-status-bar-string"),string:ba.string()}),ol=ba.union([al,il,rl]),sl=ba.object({condition:ba.literal("view"),views:ba.string().array()}),cl=ba.object({condition:ba.literal("fullscreen"),fullscreen:ba.boolean()}),ll=ba.object({condition:ba.literal("expand"),expand:ba.boolean()}),dl=ba.object({condition:ba.literal("camera"),cameras:ba.string().array()}),ul=ba.object({condition:ba.literal("media_loaded"),media_loaded:ba.boolean()}),hl=ba.object({condition:ba.literal("display_mode"),display_mode:ic}),pl=ba.object({condition:ba.literal("triggered"),triggered:ba.string().array()}),ml=ba.object({condition:ba.literal("interaction"),interaction:ba.boolean()}),gl=ba.object({condition:ba.literal("microphone"),connected:ba.boolean().optional(),muted:ba.boolean().optional()}),fl=ba.object({condition:ba.literal("key"),key:ba.string(),state:ba.enum(["down","up"]).optional(),ctrl:ba.boolean().optional(),shift:ba.boolean().optional(),alt:ba.boolean().optional(),meta:ba.boolean().optional()}),_l=ba.discriminatedUnion("condition",[Hc,Bc,qc,Uc,sl,cl,ll,dl,ul,hl,pl,ml,gl,fl]),vl=ba.object({type:ba.literal("custom:frigate-card-conditional"),conditions:_l.array(),elements:ba.lazy((()=>yl))}),yl=ba.union([Zc,Qc,vl,Fc,Vc,Yc,Kc,Jc,el,Nc,Rc,Pc,Lc,al,il,rl]).array().optional(),bl=ba.object({fit:ba.enum(["contain","cover","fill"]).optional(),position:ba.object({x:ba.number().min(0).max(100).optional(),y:ba.number().min(0).max(100).optional()}).optional(),view_box:ba.object({bottom:ba.number().min(0).max(100).optional().default(0),left:ba.number().min(0).max(100).optional().default(0),right:ba.number().min(0).max(100).optional().default(0),top:ba.number().min(0).max(100).optional().default(0)}).optional(),pan:nc.optional(),zoom:ac.optional()}),wl=ba.number().array().length(2).or(ba.string().regex(/^\s*\d+\.?\d*\s*[:/]\s*\d+\.?\d*\s*$/).transform((e=>e.split(/[:\/]/).map((e=>Number(e)))))),xl={r2c_delay_between_calls_seconds:.5,c2r_delay_between_calls_seconds:.2},Cl=function(e){return t=>{if(!t||"object"!=typeof t||!t.service)return t;const n={...t};return Object.keys(t).forEach((a=>{const i=a.match(/^data_(.+)$/),r=i?.[1];r&&!(`${e}${r}`in t)&&(n[`${e}${r}`]={action:"perform-action",perform_action:t.service,data:t[a]},delete n[a],delete n.service)})),n}},Ml=ba.preprocess(Cl("actions_"),ba.object({actions_left:lc.optional(),actions_left_start:lc.optional(),actions_left_stop:lc.optional(),actions_right:lc.optional(),actions_right_start:lc.optional(),actions_right_stop:lc.optional(),actions_up:lc.optional(),actions_up_start:lc.optional(),actions_up_stop:lc.optional(),actions_down:lc.optional(),actions_down_start:lc.optional(),actions_down_stop:lc.optional(),actions_zoom_in:lc.optional(),actions_zoom_in_start:lc.optional(),actions_zoom_in_stop:lc.optional(),actions_zoom_out:lc.optional(),actions_zoom_out_start:lc.optional(),actions_zoom_out_stop:lc.optional(),r2c_delay_between_calls_seconds:ba.number().default(xl.r2c_delay_between_calls_seconds),c2r_delay_between_calls_seconds:ba.number().default(xl.c2r_delay_between_calls_seconds),presets:ba.preprocess(Cl(""),ba.union([ba.record(lc),ba.object({service:ba.string().optional()})])).optional(),service:ba.string().optional()}).passthrough()),kl={orientation:"horizontal",mode:"auto",hide_pan_tilt:!1,hide_zoom:!1,hide_home:!1,position:"bottom-right"},Sl=ba.object({mode:ba.enum(["off","auto","on"]).default(kl.mode),position:ba.enum(["top-left","top-right","bottom-left","bottom-right"]).default(kl.position),orientation:ba.enum(["vertical","horizontal"]).default(kl.orientation),hide_pan_tilt:ba.boolean().default(kl.hide_pan_tilt),hide_zoom:ba.boolean().default(kl.hide_zoom),hide_home:ba.boolean().default(kl.hide_home),style:ba.object({}).passthrough().optional()}),El={mode:"auto",refresh_seconds:1},$l=ba.object({mode:ba.enum(["auto","camera","entity","screensaver","url"]).default(El.mode),refresh_seconds:ba.number().min(0).default(El.refresh_seconds),url:ba.string().optional(),entity:ba.string().optional(),entity_parameters:ba.string().optional()}),Al=$l.merge(Oc).default(El),zl=75,Il=300,Tl={size:100,show_details:!0,show_favorite_control:!0,show_timeline_control:!0,show_download_control:!0},jl=ba.object({size:ba.number().min(75).max(300).default(Tl.size),show_details:ba.boolean().default(Tl.show_details),show_favorite_control:ba.boolean().default(Tl.show_favorite_control),show_timeline_control:ba.boolean().default(Tl.show_timeline_control),show_download_control:ba.boolean().default(Tl.show_download_control)}),Ol={...Tl,mode:"right"},Dl=jl.extend({mode:ba.enum(["none","above","below","left","right"]).default(Ol.mode)}),Rl=ba.enum(["all","clips","snapshots"]),Pl={clustering_threshold:3,events_media_type:"all",window_seconds:3600,show_recordings:!0,style:"stack",pan_mode:"pan"},Ll=ba.enum(["pan","seek","seek-in-media","seek-in-camera"]),Nl=ba.object({clustering_threshold:ba.number().optional().default(Pl.clustering_threshold),events_media_type:Rl.optional().default(Pl.events_media_type),window_seconds:ba.number().min(60).max(86400).optional().default(Pl.window_seconds),show_recordings:ba.boolean().optional().default(Pl.show_recordings),style:ba.enum(["stack","ribbon"]).optional().default(Pl.style),pan_mode:Ll.optional().default(Pl.pan_mode)}),Fl={...Pl,mode:"none",style:"ribbon"},Vl=Nl.extend({mode:ba.enum(["none","above","below"]).default(Fl.mode),style:Nl.shape.style.default(Fl.style)}),Hl={...Pl,controls:{thumbnails:Ol}},Bl=Nl.extend({controls:ba.object({thumbnails:Dl.default(Hl.controls.thumbnails)}).default(Hl.controls)}).default(Hl),ql=ba.object({style:ba.enum(["none","chevrons","icons","thumbnails"]),size:ba.number().min(20)}),Ul=ba.enum(["none","slide"]),Wl={always_connected:!1,disconnect_seconds:90,mute_after_microphone_mute_seconds:60},Zl=ba.object({always_connected:ba.boolean().default(Wl.always_connected),disconnect_seconds:ba.number().min(0).default(Wl.disconnect_seconds),mute_after_microphone_mute_seconds:ba.number().min(0).default(Wl.mute_after_microphone_mute_seconds)}).default(Wl),Ql=ba.object({url:ba.string().transform((e=>e.replace(/\/+$/,""))).optional(),host:ba.string().optional(),modes:ba.enum(["webrtc","mse","mp4","mjpeg"]).array().optional(),stream:ba.string().optional()}),Gl=ba.object({entity:ba.string().optional(),url:ba.string().optional()}).passthrough(),Yl=ba.object({options:ba.object({audio:ba.boolean().optional(),video:ba.boolean().optional(),pauseWhenHidden:ba.boolean().optional(),disableGl:ba.boolean().optional(),disableWebAssembly:ba.boolean().optional(),preserveDrawingBuffer:ba.boolean().optional(),progressive:ba.boolean().optional(),throttled:ba.boolean().optional(),chunkSize:ba.number().optional(),maxAudioLag:ba.number().optional(),videoBufferSize:ba.number().optional(),audioBufferSize:ba.number().optional()}).optional()}),Kl={...Ol,media_type:"events",events_media_type:"all"},Xl={auto_play:[...Ys],auto_pause:[],auto_mute:[...Xs],auto_unmute:["microphone"],preload:!1,lazy_load:!0,lazy_unload:[],draggable:!0,zoomable:!0,transition_effect:"slide",show_image_during_load:!0,mode:"single",controls:{builtin:!0,next_previous:{size:48,style:"chevrons"},ptz:kl,thumbnails:Kl,timeline:Fl},microphone:{...Wl}},Jl=Dl.extend({media_type:ba.enum(["events","recordings"]).default(Xl.controls.thumbnails.media_type),events_media_type:Rl.default(Xl.controls.thumbnails.events_media_type)}),ed=ba.object({auto_pause:ba.enum(Gs).array().default(Xl.auto_pause),auto_play:ba.enum(Ys).array().default(Xl.auto_play),auto_mute:ba.enum(Xs).array().default(Xl.auto_mute),auto_unmute:ba.enum(Ks).array().default(Xl.auto_unmute),controls:ba.object({builtin:ba.boolean().default(Xl.controls.builtin),next_previous:ql.extend({style:ba.enum(["none","chevrons","icons"]).default(Xl.controls.next_previous.style),size:ql.shape.size.default(Xl.controls.next_previous.size)}).default(Xl.controls.next_previous),ptz:Sl.default(Xl.controls.ptz),thumbnails:Jl.default(Xl.controls.thumbnails),timeline:Vl.default(Xl.controls.timeline)}).default(Xl.controls),display:rc,draggable:ba.boolean().default(Xl.draggable),lazy_load:ba.boolean().default(Xl.lazy_load),lazy_unload:ba.enum(Gs).array().default(Xl.lazy_unload),microphone:Zl.default(Xl.microphone),preload:ba.boolean().default(Xl.preload),show_image_during_load:ba.boolean().default(Xl.show_image_during_load),transition_effect:Ul.default(Xl.transition_effect),zoomable:ba.boolean().default(Xl.zoomable)}).merge(Oc).default(Xl),td=ba.object({live:ed}),nd=ba.object({method:ba.enum(["standard","dashboard"]).default("standard").optional(),dashboard:ba.object({dashboard_path:ba.string().optional(),view_path:ba.string().optional()}).optional()}),ad={dependencies:{all_cameras:!1,cameras:[]},engine:"auto",frigate:{client_id:"frigate"},live_provider:"auto",motioneye:{images:{directory_pattern:"%Y-%m-%d",file_pattern:"%H-%M-%S"},movies:{directory_pattern:"%Y-%m-%d",file_pattern:"%H-%M-%S"}},reolink:{media_resolution:"low"},ptz:xl,triggers:{motion:!1,occupancy:!1,events:[...ec],entities:[]},proxy:{media:"auto",dynamic:!0,ssl_verification:"auto",ssl_ciphers:"auto"}},id=ba.object({media:ba.boolean().or(ba.literal("auto")).default(ad.proxy.media),dynamic:ba.boolean().default(ad.proxy.dynamic),ssl_verification:ba.boolean().or(ba.literal("auto")).default(ad.proxy.ssl_verification),ssl_ciphers:ba.enum(["default","insecure","intermediate","modern"]).or(ba.literal("auto")).default(ad.proxy.ssl_ciphers)}),rd=ba.object({camera_entity:ba.string().optional(),icon:ba.string().optional(),title:ba.string().optional(),capabilities:ba.object({disable:ba.enum(Ts).array().optional(),disable_except:ba.enum(Ts).array().optional()}).optional(),id:ba.string().optional(),dependencies:ba.object({all_cameras:ba.boolean().default(ad.dependencies.all_cameras),cameras:ba.string().array().default(ad.dependencies.cameras)}).default(ad.dependencies),triggers:ba.object({motion:ba.boolean().default(ad.triggers.motion),occupancy:ba.boolean().default(ad.triggers.occupancy),entities:ba.string().array().default(ad.triggers.entities),events:ba.enum(ec).array().default(ad.triggers.events)}).default(ad.triggers),engine:ba.enum(["auto","frigate","generic","motioneye","reolink"]).default("auto"),frigate:ba.object({url:ba.string().optional(),client_id:ba.string().default(ad.frigate.client_id),camera_name:ba.string().optional(),labels:ba.string().array().optional(),zones:ba.string().array().optional()}).default(ad.frigate),motioneye:ba.object({url:ba.string().optional(),images:ba.object({directory_pattern:ba.string().includes("%").default(ad.motioneye.images.directory_pattern),file_pattern:ba.string().includes("%").default(ad.motioneye.images.file_pattern)}).default(ad.motioneye.images),movies:ba.object({directory_pattern:ba.string().includes("%").default(ad.motioneye.movies.directory_pattern),file_pattern:ba.string().includes("%").default(ad.motioneye.movies.file_pattern)}).default(ad.motioneye.movies)}).default(ad.motioneye),reolink:ba.object({url:ba.string().optional(),media_resolution:ba.enum(["high","low"]).default(ad.reolink.media_resolution)}).default(ad.reolink),live_provider:ba.enum(["auto","image","ha","jsmpeg","go2rtc","webrtc-card"]).default(ad.live_provider),go2rtc:Ql.optional(),image:$l.optional().default(El),jsmpeg:Yl.optional(),webrtc_card:Gl.optional(),cast:nd.optional(),ptz:Ml.default(ad.ptz),dimensions:ba.object({aspect_ratio:wl.optional(),layout:bl.optional()}).optional(),proxy:id.default(ad.proxy)}).default(ad),od=rd.array().min(1),sd={default:Qs,camera_select:"current",interaction_seconds:300,default_reset:{every_seconds:0,after_interaction:!1,entities:[],interaction_mode:"inactive"},default_cycle_camera:!1,dark_mode:"off",triggers:{show_trigger_status:!1,filter_selected_camera:!0,actions:{trigger:"update",untrigger:"none"},untrigger_seconds:0},keyboard_shortcuts:Fs},cd=ba.enum(["all","inactive","active"]).default("inactive"),ld=ba.object({actions:ba.object({interaction_mode:cd,trigger:ba.enum(["default","live","media","none","update"]).default(sd.triggers.actions.trigger),untrigger:ba.enum(["default","none"]).default(sd.triggers.actions.untrigger)}).default(sd.triggers.actions),filter_selected_camera:ba.boolean().default(sd.triggers.filter_selected_camera),show_trigger_status:ba.boolean().default(sd.triggers.show_trigger_status),untrigger_seconds:ba.number().default(sd.triggers.untrigger_seconds)}),dd=ba.object({default:ba.enum(Zs).default(sd.default),camera_select:ba.enum([...Zs,"current"]).default(sd.camera_select),interaction_seconds:ba.number().default(sd.interaction_seconds),default_cycle_camera:ba.boolean().default(sd.default_cycle_camera),default_reset:ba.object({after_interaction:ba.boolean().default(sd.default_reset.after_interaction),every_seconds:ba.number().default(sd.default_reset.every_seconds),entities:ba.string().array().default(sd.default_reset.entities),interaction_mode:cd.default(sd.default_reset.interaction_mode)}).default(sd.default_reset),render_entities:ba.string().array().optional(),dark_mode:ba.enum(["on","off","auto"]).optional(),triggers:ld.default(sd.triggers),keyboard_shortcuts:Vs.default(sd.keyboard_shortcuts)}).merge(Oc).default(sd),ud=["left","right","top","bottom"],hd=ud,pd={priority:50,enabled:!0},md={priority:50,enabled:!1},gd={alignment:"left",button_size:40,buttons:{camera_ui:pd,cameras:pd,clips:pd,ptz_home:md,display_mode:pd,download:pd,expand:md,frigate:pd,fullscreen:pd,image:md,live:pd,media_player:pd,microphone:{...md,type:"momentary"},mute:md,play:md,ptz_controls:md,recordings:md,screenshot:md,snapshots:pd,substreams:pd,timeline:pd},position:"top",style:"hidden"},fd=Gc.extend({enabled:Gc.shape.enabled.default(pd.enabled),priority:Gc.shape.priority.default(pd.priority)}),_d=Gc.extend({enabled:Gc.shape.enabled.default(md.enabled),priority:Gc.shape.priority.default(md.priority)}),vd=ba.object({style:ba.enum(["none","hidden","overlay","hover","hover-card","outside"]).default(gd.style),position:ba.enum(ud).default(gd.position),alignment:ba.enum(hd).default(gd.alignment),buttons:ba.object({camera_ui:fd.default(gd.buttons.camera_ui),cameras:fd.default(gd.buttons.cameras),clips:fd.default(gd.buttons.clips),ptz_home:_d.default(gd.buttons.ptz_home),display_mode:fd.default(gd.buttons.display_mode),download:fd.default(gd.buttons.download),expand:_d.default(gd.buttons.expand),frigate:fd.default(gd.buttons.frigate),fullscreen:fd.default(gd.buttons.fullscreen),image:_d.default(gd.buttons.image),live:fd.default(gd.buttons.live),media_player:fd.default(gd.buttons.media_player),microphone:_d.extend({type:ba.enum(["momentary","toggle"]).default(gd.buttons.microphone.type)}).default(gd.buttons.microphone),mute:_d.default(gd.buttons.mute),play:_d.default(gd.buttons.play),ptz_controls:_d.default(gd.buttons.ptz_controls),recordings:_d.default(gd.buttons.recordings),screenshot:_d.default(gd.buttons.screenshot),snapshots:fd.default(gd.buttons.snapshots),substreams:fd.default(gd.buttons.substreams),timeline:fd.default(gd.buttons.timeline)}).default(gd.buttons),button_size:ba.number().min(20).default(gd.button_size)}).default(gd),yd={priority:50,enabled:!0},bd={height:46,items:{engine:yd,resolution:yd,technology:yd,title:yd},position:"bottom",style:"popup",popup_seconds:3},wd=ba.object({position:ba.enum(["top","bottom"]).default(bd.position),style:ba.enum(["none","overlay","hover","hover-card","outside","popup"]).default(bd.style),popup_seconds:ba.number().min(0).max(60).default(bd.popup_seconds),height:ba.number().min(20).default(bd.height),items:ba.object({engine:tl.default(bd.items.engine),technology:tl.default(bd.items.technology),resolution:tl.default(bd.items.resolution),title:tl.default(bd.items.title)}).default(bd.items)}).default(bd),xd={auto_play:[...Ys],auto_pause:[...Gs],auto_mute:[...Gs],auto_unmute:[],lazy_load:!0,draggable:!0,zoomable:!0,transition_effect:"slide",snapshot_click_plays_clip:!0,display_mode:"single",controls:{builtin:!0,next_previous:{size:48,style:"thumbnails"},thumbnails:Ol,timeline:Fl,ptz:{...kl,mode:"off"}}},Cd=ql.extend({style:ba.enum(["none","thumbnails","chevrons"]).default(xd.controls.next_previous.style),size:ql.shape.size.default(xd.controls.next_previous.size)}),Md=ba.object({auto_play:ba.enum(Ys).array().default(xd.auto_play),auto_pause:ba.enum(Gs).array().default(xd.auto_pause),auto_mute:ba.enum(Gs).array().default(xd.auto_mute),auto_unmute:ba.enum(Ys).array().default(xd.auto_unmute),lazy_load:ba.boolean().default(xd.lazy_load),draggable:ba.boolean().default(xd.draggable),zoomable:ba.boolean().default(xd.zoomable),transition_effect:Ul.default(xd.transition_effect),snapshot_click_plays_clip:ba.boolean().default(xd.snapshot_click_plays_clip),display:rc,controls:ba.object({builtin:ba.boolean().default(xd.controls.builtin),next_previous:Cd.default(xd.controls.next_previous),ptz:Sl.extend({mode:ba.enum(["off","on"]).default(xd.controls.ptz.mode)}).default(xd.controls.ptz),thumbnails:Dl.default(xd.controls.thumbnails),timeline:Vl.default(xd.controls.timeline)}).default(xd.controls)}).merge(Oc).default(xd),kd={...Ol,show_details:!1},Sd={controls:{thumbnails:kd,filter:{mode:"right"}}},Ed=Dl.extend({show_details:ba.boolean().default(kd.show_details)}),$d=ba.object({controls:ba.object({thumbnails:Ed.default(Sd.controls.thumbnails),filter:ba.object({mode:ba.enum(["none","left","right"]).default(Sd.controls.filter.mode)}).default(Sd.controls.filter)}).default(Sd.controls)}).merge(Oc).default(Sd),Ad={aspect_ratio_mode:"dynamic",aspect_ratio:[16,9],height:"auto"},zd=ba.object({aspect_ratio_mode:ba.enum(["dynamic","static","unconstrained"]).default(Ad.aspect_ratio_mode),aspect_ratio:wl.default(Ad.aspect_ratio),height:ba.string().default(Ad.height)}).default(Ad),Id=ba.object({conditions:_l.array(),merge:ba.object({}).passthrough().optional(),set:ba.object({}).passthrough().optional(),delete:ba.string().array().optional()}).array().optional(),Td=Tc.array(),jd=ba.object({conditions:_l.array(),actions:Td.optional(),actions_not:Td.optional()}).refine((e=>e.actions?.length||e.actions_not?.length),"Automations must include at least one action").array(),Od={features:{animated_progress_indicator:!0,media_chunk_size:50},style:{border_radius:!0,box_shadow:!0}},Dd=ba.object({features:ba.object({animated_progress_indicator:ba.boolean().default(Od.features.animated_progress_indicator),media_chunk_size:ba.number().min(0).max(1e3).default(Od.features.media_chunk_size),max_simultaneous_engine_requests:ba.number().min(1).optional()}).default(Od.features),style:ba.object({border_radius:ba.boolean().default(Od.style.border_radius),box_shadow:ba.boolean().default(Od.style.box_shadow)}).default(Od.style)}).default(Od),Rd={logging:!1},Pd=ba.object({logging:ba.boolean().default(Rd.logging)}).default(Rd),Ld=ba.enum(["casting","low-performance","scrubbing"]).array().optional(),Nd=ba.object({cameras:Ds(od),cameras_global:rd,view:dd,menu:vd,status_bar:wd,live:ed,media_gallery:$d,media_viewer:Md,image:Al,elements:yl,dimensions:zd,timeline:Bl,performance:Dd,debug:Pd,automations:jd.optional(),profiles:Ld,overrides:Id,card_mod:ba.unknown(),card_id:ba.string().regex(tc).optional(),type:ba.string()}),Fd={cameras:ad,view:sd,menu:gd,status_bar:bd,live:Xl,media_gallery:Sd,media_viewer:xd,image:El,timeline:Hl,performance:Od,debug:Rd};function Vd(e){const t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new e.constructor(+e):"number"==typeof e||"[object Number]"===t||"string"==typeof e||"[object String]"===t?new Date(e):new Date(NaN)}function Hd(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function Bd(e,t){const n=Vd(e);return isNaN(t)?Hd(e,NaN):t?(n.setDate(n.getDate()+t),n):n}function qd(e,t){const n=Vd(e);if(isNaN(t))return Hd(e,NaN);if(!t)return n;const a=n.getDate(),i=Hd(e,n.getTime());i.setMonth(n.getMonth()+t+1,0);return a>=i.getDate()?i:(n.setFullYear(i.getFullYear(),i.getMonth(),a),n)}function Ud(e,t){const{years:n=0,months:a=0,weeks:i=0,days:r=0,hours:o=0,minutes:s=0,seconds:c=0}=t,l=Vd(e),d=a||n?qd(l,a+12*n):l,u=1e3*(c+60*(s+60*o));return Hd(e,(r||i?Bd(d,r+7*i):d).getTime()+u)}const Wd=6048e5,Zd=864e5,Qd=6e4,Gd=36e5,Yd=1e3;let Kd={};function Xd(){return Kd}function Jd(e,t){const n=Xd(),a=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=Vd(e),r=i.getDay(),o=(r=i.getTime()?n+1:t.getTime()>=o.getTime()?n:n-1}function nu(e){const t=Vd(e);return t.setHours(0,0,0,0),t}function au(e){const t=Vd(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function iu(e){if(!(t=e,t instanceof Date||"object"==typeof t&&"[object Date]"===Object.prototype.toString.call(t)||"number"==typeof e))return!1;var t;const n=Vd(e);return!isNaN(Number(n))}function ru(e){return t=>{const n=(e?Math[e]:Math.trunc)(t);return 0===n?0:n}}function ou(e,t){return+Vd(e)-+Vd(t)}function su(e,t,n){const a=ou(e,t)/1e3;return ru(n?.roundingMethod)(a)}const cu={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function lu(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const du={date:lu({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:lu({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:lu({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},uu={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function hu(e){return(t,n)=>{let a;if("formatting"===(n?.context?String(n.context):"standalone")&&e.formattingValues){const t=e.defaultFormattingWidth||e.defaultWidth,i=n?.width?String(n.width):t;a=e.formattingValues[i]||e.formattingValues[t]}else{const t=e.defaultWidth,i=n?.width?String(n.width):e.defaultWidth;a=e.values[i]||e.values[t]}return a[e.argumentCallback?e.argumentCallback(t):t]}}function pu(e){return(t,n={})=>{const a=n.width,i=a&&e.matchPatterns[a]||e.matchPatterns[e.defaultMatchWidth],r=t.match(i);if(!r)return null;const o=r[0],s=a&&e.parsePatterns[a]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?function(e,t){for(let n=0;ne.test(o))):function(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n;return}(s,(e=>e.test(o)));let l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;return{value:l,rest:t.slice(o.length)}}}var mu;const gu={code:"en-US",formatDistance:(e,t,n)=>{let a;const i=cu[e];return a="string"==typeof i?i:1===t?i.one:i.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+a:a+" ago":a},formatLong:du,formatRelative:(e,t,n,a)=>uu[e],localize:{ordinalNumber:(e,t)=>{const n=Number(e),a=n%100;if(a>20||a<10)switch(a%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:hu({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:hu({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:hu({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:hu({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:hu({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(mu={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)},(e,t={})=>{const n=e.match(mu.matchPattern);if(!n)return null;const a=n[0],i=e.match(mu.parsePattern);if(!i)return null;let r=mu.valueCallback?mu.valueCallback(i[0]):i[0];return r=t.valueCallback?t.valueCallback(r):r,{value:r,rest:e.slice(a.length)}}),era:pu({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:pu({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:pu({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:pu({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:pu({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function fu(e){const t=Vd(e),n=function(e,t){const n=nu(e),a=nu(t),i=+n-au(n),r=+a-au(a);return Math.round((i-r)/Zd)}(t,function(e){const t=Vd(e),n=Hd(e,0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}(t));return n+1}function _u(e){const t=Vd(e),n=+eu(t)-+function(e){const t=tu(e),n=Hd(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),eu(n)}(t);return Math.round(n/Wd)+1}function vu(e,t){const n=Vd(e),a=n.getFullYear(),i=Xd(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=Hd(e,0);o.setFullYear(a+1,0,r),o.setHours(0,0,0,0);const s=Jd(o,t),c=Hd(e,0);c.setFullYear(a,0,r),c.setHours(0,0,0,0);const l=Jd(c,t);return n.getTime()>=s.getTime()?a+1:n.getTime()>=l.getTime()?a:a-1}function yu(e,t){const n=Vd(e),a=+Jd(n,t)-+function(e,t){const n=Xd(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=vu(e,t),r=Hd(e,0);return r.setFullYear(i,0,a),r.setHours(0,0,0,0),Jd(r,t)}(n,t);return Math.round(a/Wd)+1}function bu(e,t){return(e<0?"-":"")+Math.abs(e).toString().padStart(t,"0")}const wu={y(e,t){const n=e.getFullYear(),a=n>0?n:1-n;return bu("yy"===t?a%100:a,t.length)},M(e,t){const n=e.getMonth();return"M"===t?String(n+1):bu(n+1,2)},d:(e,t)=>bu(e.getDate(),t.length),a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return"am"===n?"a.m.":"p.m."}},h:(e,t)=>bu(e.getHours()%12||12,t.length),H:(e,t)=>bu(e.getHours(),t.length),m:(e,t)=>bu(e.getMinutes(),t.length),s:(e,t)=>bu(e.getSeconds(),t.length),S(e,t){const n=t.length,a=e.getMilliseconds();return bu(Math.trunc(a*Math.pow(10,n-3)),t.length)}},xu="midnight",Cu="noon",Mu="morning",ku="afternoon",Su="evening",Eu="night",$u={G:function(e,t,n){const a=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(a,{width:"abbreviated"});case"GGGGG":return n.era(a,{width:"narrow"});default:return n.era(a,{width:"wide"})}},y:function(e,t,n){if("yo"===t){const t=e.getFullYear(),a=t>0?t:1-t;return n.ordinalNumber(a,{unit:"year"})}return wu.y(e,t)},Y:function(e,t,n,a){const i=vu(e,a),r=i>0?i:1-i;if("YY"===t){return bu(r%100,2)}return"Yo"===t?n.ordinalNumber(r,{unit:"year"}):bu(r,t.length)},R:function(e,t){return bu(tu(e),t.length)},u:function(e,t){return bu(e.getFullYear(),t.length)},Q:function(e,t,n){const a=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(a);case"QQ":return bu(a,2);case"Qo":return n.ordinalNumber(a,{unit:"quarter"});case"QQQ":return n.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(a,{width:"narrow",context:"formatting"});default:return n.quarter(a,{width:"wide",context:"formatting"})}},q:function(e,t,n){const a=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(a);case"qq":return bu(a,2);case"qo":return n.ordinalNumber(a,{unit:"quarter"});case"qqq":return n.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(a,{width:"narrow",context:"standalone"});default:return n.quarter(a,{width:"wide",context:"standalone"})}},M:function(e,t,n){const a=e.getMonth();switch(t){case"M":case"MM":return wu.M(e,t);case"Mo":return n.ordinalNumber(a+1,{unit:"month"});case"MMM":return n.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(a,{width:"narrow",context:"formatting"});default:return n.month(a,{width:"wide",context:"formatting"})}},L:function(e,t,n){const a=e.getMonth();switch(t){case"L":return String(a+1);case"LL":return bu(a+1,2);case"Lo":return n.ordinalNumber(a+1,{unit:"month"});case"LLL":return n.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(a,{width:"narrow",context:"standalone"});default:return n.month(a,{width:"wide",context:"standalone"})}},w:function(e,t,n,a){const i=yu(e,a);return"wo"===t?n.ordinalNumber(i,{unit:"week"}):bu(i,t.length)},I:function(e,t,n){const a=_u(e);return"Io"===t?n.ordinalNumber(a,{unit:"week"}):bu(a,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getDate(),{unit:"date"}):wu.d(e,t)},D:function(e,t,n){const a=fu(e);return"Do"===t?n.ordinalNumber(a,{unit:"dayOfYear"}):bu(a,t.length)},E:function(e,t,n){const a=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(a,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(a,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},e:function(e,t,n,a){const i=e.getDay(),r=(i-a.weekStartsOn+8)%7||7;switch(t){case"e":return String(r);case"ee":return bu(r,2);case"eo":return n.ordinalNumber(r,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(e,t,n,a){const i=e.getDay(),r=(i-a.weekStartsOn+8)%7||7;switch(t){case"c":return String(r);case"cc":return bu(r,t.length);case"co":return n.ordinalNumber(r,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(e,t,n){const a=e.getDay(),i=0===a?7:a;switch(t){case"i":return String(i);case"ii":return bu(i,t.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},a:function(e,t,n){const a=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(e,t,n){const a=e.getHours();let i;switch(i=12===a?Cu:0===a?xu:a/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(e,t,n){const a=e.getHours();let i;switch(i=a>=17?Su:a>=12?ku:a>=4?Mu:Eu,t){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){let t=e.getHours()%12;return 0===t&&(t=12),n.ordinalNumber(t,{unit:"hour"})}return wu.h(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getHours(),{unit:"hour"}):wu.H(e,t)},K:function(e,t,n){const a=e.getHours()%12;return"Ko"===t?n.ordinalNumber(a,{unit:"hour"}):bu(a,t.length)},k:function(e,t,n){let a=e.getHours();return 0===a&&(a=24),"ko"===t?n.ordinalNumber(a,{unit:"hour"}):bu(a,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):wu.m(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getSeconds(),{unit:"second"}):wu.s(e,t)},S:function(e,t){return wu.S(e,t)},X:function(e,t,n){const a=e.getTimezoneOffset();if(0===a)return"Z";switch(t){case"X":return zu(a);case"XXXX":case"XX":return Iu(a);default:return Iu(a,":")}},x:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"x":return zu(a);case"xxxx":case"xx":return Iu(a);default:return Iu(a,":")}},O:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Au(a,":");default:return"GMT"+Iu(a,":")}},z:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Au(a,":");default:return"GMT"+Iu(a,":")}},t:function(e,t,n){return bu(Math.trunc(e.getTime()/1e3),t.length)},T:function(e,t,n){return bu(e.getTime(),t.length)}};function Au(e,t=""){const n=e>0?"-":"+",a=Math.abs(e),i=Math.trunc(a/60),r=a%60;return 0===r?n+String(i):n+String(i)+t+bu(r,2)}function zu(e,t){if(e%60==0){return(e>0?"-":"+")+bu(Math.abs(e)/60,2)}return Iu(e,t)}function Iu(e,t=""){const n=e>0?"-":"+",a=Math.abs(e);return n+bu(Math.trunc(a/60),2)+t+bu(a%60,2)}const Tu=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},ju=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},Ou={p:ju,P:(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],a=n[1],i=n[2];if(!i)return Tu(e,t);let r;switch(a){case"P":r=t.dateTime({width:"short"});break;case"PP":r=t.dateTime({width:"medium"});break;case"PPP":r=t.dateTime({width:"long"});break;default:r=t.dateTime({width:"full"})}return r.replace("{{date}}",Tu(a,t)).replace("{{time}}",ju(i,t))}},Du=/^D+$/,Ru=/^Y+$/,Pu=["D","DD","YY","YYYY"];function Lu(e){return Du.test(e)}function Nu(e){return Ru.test(e)}function Fu(e,t,n){const a=function(e,t,n){const a="Y"===e[0]?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${a} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}(e,t,n);if(console.warn(a),Pu.includes(e))throw new RangeError(a)}const Vu=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Hu=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Bu=/^'([^]*?)'?$/,qu=/''/g,Uu=/[a-zA-Z]/;function Wu(e,t,n){const a=Xd(),i=n?.locale??a.locale??gu,r=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??a.weekStartsOn??a.locale?.options?.weekStartsOn??0,s=Vd(e);if(!iu(s))throw new RangeError("Invalid time value");let c=t.match(Hu).map((e=>{const t=e[0];if("p"===t||"P"===t){return(0,Ou[t])(e,i.formatLong)}return e})).join("").match(Vu).map((e=>{if("''"===e)return{isToken:!1,value:"'"};const t=e[0];if("'"===t)return{isToken:!1,value:Zu(e)};if($u[t])return{isToken:!0,value:e};if(t.match(Uu))throw new RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}}));i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));const l={firstWeekContainsDate:r,weekStartsOn:o,locale:i};return c.map((a=>{if(!a.isToken)return a.value;const r=a.value;(!n?.useAdditionalWeekYearTokens&&Nu(r)||!n?.useAdditionalDayOfYearTokens&&Lu(r))&&Fu(r,t,String(e));return(0,$u[r[0]])(s,r,i.localize,l)})).join("")}function Zu(e){const t=e.match(Bu);return t?t[1].replace(qu,"'"):e}function Qu(e,t){const{years:n=0,months:a=0,weeks:i=0,days:r=0,hours:o=0,minutes:s=0,seconds:c=0}=t,l=function(e,t){return qd(e,-t)}(e,a+12*n),d=function(e,t){return Bd(e,-t)}(l,r+7*i),u=1e3*(c+60*(s+60*o));return Hd(e,d.getTime()-u)}function Gu(e,t){return e===t||e!=e&&t!=t}function Yu(e,t){for(var n=e.length;n--;)if(Gu(e[n][0],t))return n;return-1}var Ku=Array.prototype.splice;function Xu(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1},Xu.prototype.set=function(e,t){var n=this.__data__,a=Yu(n,e);return a<0?(++this.size,n.push([e,t])):n[a][1]=t,this};var Ju="object"==typeof global&&global&&global.Object===Object&&global,eh="object"==typeof self&&self&&self.Object===Object&&self,th=Ju||eh||Function("return this")(),nh=th.Symbol,ah=Object.prototype,ih=ah.hasOwnProperty,rh=ah.toString,oh=nh?nh.toStringTag:void 0;var sh=Object.prototype.toString;var ch="[object Null]",lh="[object Undefined]",dh=nh?nh.toStringTag:void 0;function uh(e){return null==e?void 0===e?lh:ch:dh&&dh in Object(e)?function(e){var t=ih.call(e,oh),n=e[oh];try{e[oh]=void 0;var a=!0}catch(e){}var i=rh.call(e);return a&&(t?e[oh]=n:delete e[oh]),i}(e):function(e){return sh.call(e)}(e)}function hh(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var ph="[object AsyncFunction]",mh="[object Function]",gh="[object GeneratorFunction]",fh="[object Proxy]";function _h(e){if(!hh(e))return!1;var t=uh(e);return t==mh||t==gh||t==ph||t==fh}var vh,yh=th["__core-js_shared__"],bh=(vh=/[^.]+$/.exec(yh&&yh.keys&&yh.keys.IE_PROTO||""))?"Symbol(src)_1."+vh:"";var wh=Function.prototype.toString;function xh(e){if(null!=e){try{return wh.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var Ch=/^\[object .+?Constructor\]$/,Mh=Function.prototype,kh=Object.prototype,Sh=Mh.toString,Eh=kh.hasOwnProperty,$h=RegExp("^"+Sh.call(Eh).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ah(e){return!(!hh(e)||(t=e,bh&&bh in t))&&(_h(e)?$h:Ch).test(xh(e));var t}function zh(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Ah(n)?n:void 0}var Ih=zh(th,"Map"),Th=zh(Object,"create");var jh=Object.prototype.hasOwnProperty;var Oh=Object.prototype.hasOwnProperty;function Dh(e){var t=-1,n=null==e?0:e.length;for(this.clear();++ts))return!1;var l=r.get(e),d=r.get(t);if(l&&d)return l==t&&d==e;var u=-1,h=!0,p=n&Bh?new Nh:void 0;for(r.set(e,t),r.set(t,e);++u-1&&e%1==0&&e-1&&e%1==0&&e<=Ap}var Ip={};function Tp(e){return function(t){return e(t)}}Ip["[object Float32Array]"]=Ip["[object Float64Array]"]=Ip["[object Int8Array]"]=Ip["[object Int16Array]"]=Ip["[object Int32Array]"]=Ip["[object Uint8Array]"]=Ip["[object Uint8ClampedArray]"]=Ip["[object Uint16Array]"]=Ip["[object Uint32Array]"]=!0,Ip["[object Arguments]"]=Ip["[object Array]"]=Ip["[object ArrayBuffer]"]=Ip["[object Boolean]"]=Ip["[object DataView]"]=Ip["[object Date]"]=Ip["[object Error]"]=Ip["[object Function]"]=Ip["[object Map]"]=Ip["[object Number]"]=Ip["[object Object]"]=Ip["[object RegExp]"]=Ip["[object Set]"]=Ip["[object String]"]=Ip["[object WeakMap]"]=!1;var jp="object"==typeof exports&&exports&&!exports.nodeType&&exports,Op=jp&&"object"==typeof module&&module&&!module.nodeType&&module,Dp=Op&&Op.exports===jp&&Ju.process,Rp=function(){try{var e=Op&&Op.require&&Op.require("util").types;return e||Dp&&Dp.binding&&Dp.binding("util")}catch(e){}}(),Pp=Rp,Lp=Pp&&Pp.isTypedArray,Np=Lp?Tp(Lp):function(e){return fp(e)&&zp(e.length)&&!!Ip[uh(e)]},Fp=Object.prototype.hasOwnProperty;function Vp(e,t){var n=dp(e),a=!n&&wp(e),i=!n&&!a&&kp(e),r=!n&&!a&&!i&&Np(e),o=n||a||i||r,s=o?function(e,t){for(var n=-1,a=Array(e);++n0){if(++og>=800)return arguments[0]}else og=0;return rg.apply(void 0,arguments)});function lg(e,t){return cg(function(e,t,n){return t=tg(void 0===t?e.length-1:t,0),function(){for(var a=arguments,i=-1,r=tg(a.length-t,0),o=Array(r);++i1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(r=e.length>3&&"function"==typeof r?(i--,r):void 0,o&&dg(n[0],n[1],o)&&(r=i<3?void 0:r,i=1),t=Object(t);++a-1}function Ng(e,t,n){for(var a=-1,i=null==e?0:e.length;++a=Vg){var l=t?null:Fg(e);if(l)return Zh(l);o=!1,i=Vh,c=new Nh}else c=t?[]:s;e:for(;++ae[0].toUpperCase()+e.substring(1))).join(" ")}function Ug(e,t,n){const a=e[t];return e.splice(t,1),e.splice(n,0,a),e}const Wg=e=>Array.isArray(e)?e:[e],Zg=e=>e instanceof Set?e:new Set(Wg(e));function Qg(e,t,n){return!function(e,t,n){var a=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===a?bm(e,t,void 0,n):!!a}(e,t,n)}function Gg(e,t=console.warn){e instanceof zs&&e.context?t(e,e.context):t("object"==typeof e&&"message"in e?e.message:e)}const Yg=()=>window.matchMedia("(hover: hover) and (pointer: fine)").matches,Kg=(e,t)=>Wu(e,"yyyy-MM-dd HH:mm"+(t?":ss":"")),Xg=e=>Wu(e,"yyyy-MM-dd"),Jg=(e,t)=>{window.requestIdleCallback?window.requestIdleCallback(e,{...t&&{timeout:t}}):e()};function ef(e,t){const n=function(e,t,n){const a=ou(e,t)/Gd;return ru(n?.roundingMethod)(a)}(t,e),a=function(e,t,n){const a=ou(e,t)/Qd;return ru(n?.roundingMethod)(a)}(t,e)-60*n;let i="";return n&&(i+=`${n}h `),a&&(i+=`${a}m `),i+=`${su(t,e)-60*n*60-60*a}s`,i}const tf=async(e,t)=>await Promise.all(Array.from(e).map((e=>t(e)))),nf=e=>new Date(`${e}T00:00:00`),af=async e=>{await new Promise((t=>setTimeout(t,1e3*e)))},rf=e=>!isNaN(e.getTime()),of=(e,t,n,a)=>{t?e.setAttribute(n,a??""):e.removeAttribute(n)},sf=e=>!!e,cf=e=>e instanceof HTMLElement,lf=e=>(e instanceof HTMLSlotElement?e.assignedElements({flatten:!0}):[...e.children]).filter(cf),df=e=>e?.ratio&&2===e.ratio.length?`${e.ratio[0]} / ${e.ratio[1]}`:e?.defaultStatic?"16 / 9":"auto",uf=e=>({"aspect-ratio":df(e)}),hf=e=>{if(Array.isArray(e))return e.filter((e=>void 0!==e)).map((e=>hf(e)));if("object"==typeof e&&null!==e){const t={};for(const n in e)t[n]=hf(e[n]);return t}return e},pf=(e,t,n)=>Rg(e,n)===Rg(t,n);function mf(e){if(!e)return null;const t=Ic.safeParse(e);return t.success?t.data:null}function gf(e,t){return{action:"fire-dom-event",frigate_card_action:e,...t?.cardID&&{card_id:t.cardID}}}function ff(e,t,n){return{action:"fire-dom-event",frigate_card_action:e,camera:t,...n?.cardID&&{card_id:n.cardID}}}function _f(e,t,n){return{action:"fire-dom-event",frigate_card_action:"media_player",media_player:e,media_player_action:t,...n?.cardID&&{card_id:n.cardID}}}function vf(e){return{action:"fire-dom-event",frigate_card_action:"ptz_multi",...e?.cardID&&{card_id:e.cardID},...e?.ptzAction&&{ptz_action:e.ptzAction},...e?.ptzPhase&&{ptz_phase:e.ptzPhase},...e?.ptzPreset&&{ptz_preset:e.ptzPreset},...e?.targetID&&{target_id:e.targetID}}}function yf(e,t){return e&&t?"tap"===e&&t.tap_action?t.tap_action:"hold"===e&&t.hold_action?t.hold_action:"double_tap"===e&&t.double_tap_action?t.double_tap_action:"end_tap"===e&&t.end_tap_action?t.end_tap_action:"start_tap"===e&&t.start_tap_action?t.start_tap_action:null:null}const bf=e=>Wg(e).some((e=>function(e){return void 0!==e&&"none"!==e.action}(e))),wf=e=>{e.stopPropagation()};class xf{constructor(){this._timer=null,this._repeated=!1}stop(){this._timer&&(this._repeated?window.clearInterval(this._timer):window.clearTimeout(this._timer),this._timer=null)}isRunning(){return null!==this._timer}start(e,t){this.stop(),this._timer=window.setTimeout((()=>{this._timer=null,t()}),1e3*e),this._repeated=!1}startRepeated(e,t){this.stop(),this._timer=window.setInterval((()=>{t()}),1e3*e),this._repeated=!0}}class Cf extends HTMLElement{constructor(){super(...arguments),this.holdTime=.4,this.holdTimer=new xf,this.doubleClickTimer=new xf,this.held=!1,this.started=!1}connectedCallback(){["touchcancel","mouseout","mouseup","touchmove","mousewheel","wheel","scroll"].forEach((e=>{document.addEventListener(e,(()=>{this.holdTimer.stop()}),{passive:!0})}))}bind(e,t){if(e.actionHandlerOptions)return void(e.actionHandlerOptions=t);e.actionHandlerOptions=t,e.addEventListener("contextmenu",(e=>{const t=e||window.event;return t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.cancelBubble=!0,t.returnValue=!1,!1}));const n=()=>{this.held=!1,this.holdTimer.start(this.holdTime,(()=>{this.held=!0})),this.started||(this.started=!0,et(e,"action",{action:"start_tap"}))},a=t=>{this.holdTimer.stop(),this.started&&(this.started=!1,et(e,"action",{action:"end_tap"}))},i=t=>{const n=e.actionHandlerOptions;n?.allowPropagation||wf(t),["touchend","touchcancel"].includes(t.type)&&!this.held||(a(),n?.hasHold&&this.held?et(e,"action",{action:"hold"}):n?.hasDoubleClick?"click"===t.type&&t.detail<2||!this.doubleClickTimer.isRunning()?this.doubleClickTimer.start(.25,(()=>et(e,"action",{action:"tap"}))):(this.doubleClickTimer.stop(),et(e,"action",{action:"double_tap"})):et(e,"action",{action:"tap"}))};e.addEventListener("touchstart",n,{passive:!0}),e.addEventListener("touchend",i),e.addEventListener("touchcancel",i),e.addEventListener("mousedown",n,{passive:!0}),e.addEventListener("click",i),e.addEventListener("keyup",(e=>{"Enter"===e.key&&i(e)})),e.addEventListener("mouseleave",a)}}customElements.define("action-handler-frigate-card",Cf);const Mf=(e,t)=>{const n=(()=>{const e=document.body;if(e.querySelector("action-handler-frigate-card"))return e.querySelector("action-handler-frigate-card");const t=document.createElement("action-handler-frigate-card");return e.appendChild(t),t})();n&&n.bind(e,t)},kf=ge(class extends fe{update(e,[t]){return Mf(e.element,t),U}render(e){}});var Sf=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)lp(t,gp(e)),e=Pm(e);return t}:hp;function Ef(e){return up(e,Km,Sf)}var $f=Object.prototype.hasOwnProperty;var Af=/\w*$/;var zf=nh?nh.prototype:void 0,If=zf?zf.valueOf:void 0;var Tf="[object Boolean]",jf="[object Date]",Of="[object Map]",Df="[object Number]",Rf="[object RegExp]",Pf="[object Set]",Lf="[object String]",Nf="[object Symbol]",Ff="[object ArrayBuffer]",Vf="[object DataView]",Hf="[object Float32Array]",Bf="[object Float64Array]",qf="[object Int8Array]",Uf="[object Int16Array]",Wf="[object Int32Array]",Zf="[object Uint8Array]",Qf="[object Uint8ClampedArray]",Gf="[object Uint16Array]",Yf="[object Uint32Array]";function Kf(e,t,n){var a,i,r,o=e.constructor;switch(t){case Ff:return Tm(e);case Tf:case jf:return new o(+e);case Vf:return function(e,t){var n=t?Tm(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case Hf:case Bf:case qf:case Uf:case Wf:case Zf:case Qf:case Gf:case Yf:return jm(e,n);case Of:return new o;case Df:case Lf:return new o(e);case Rf:return(r=new(i=e).constructor(i.source,Af.exec(i))).lastIndex=i.lastIndex,r;case Pf:return new o;case Nf:return a=e,If?Object(If.call(a)):{}}}var Xf=Pp&&Pp.isMap,Jf=Xf?Tp(Xf):function(e){return fp(e)&&"[object Map]"==pm(e)};var e_=Pp&&Pp.isSet,t_=e_?Tp(e_):function(e){return fp(e)&&"[object Set]"==pm(e)},n_=1,a_=2,i_=4,r_="[object Arguments]",o_="[object Function]",s_="[object GeneratorFunction]",c_="[object Object]",l_={};function d_(e,t,n,a,i,r){var o,s=t&n_,c=t&a_,l=t&i_;if(n&&(o=i?n(e,a,i,r):n(e)),void 0!==o)return o;if(!hh(e))return e;var d=dp(e);if(d){if(o=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&$f.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!s)return Om(e,o)}else{var u=pm(e),h=u==o_||u==s_;if(kp(e))return Im(e,s);if(u==c_||u==r_||h&&!i){if(o=c||h?{}:Lm(e),!s)return c?function(e,t){return Qm(e,Sf(e),t)}(e,function(e,t){return e&&Qm(t,Km(t),e)}(o,e)):function(e,t){return Qm(e,gp(e),t)}(e,function(e,t){return e&&Qm(t,Qp(t),e)}(o,e))}else{if(!l_[u])return i?e:{};o=Kf(e,u,s)}}r||(r=new Lh);var p=r.get(e);if(p)return p;r.set(e,o),t_(e)?e.forEach((function(a){o.add(d_(a,t,n,a,e,r))})):Jf(e)&&e.forEach((function(a,i){o.set(i,d_(a,t,n,i,e,r))}));var m=d?void 0:(l?c?Ef:Gp:c?Km:Qp)(e);return function(e,t){for(var n=-1,a=null==e?0:e.length;++nvoid 0===globalThis.DOMException?new __(e):new DOMException(e),y_=e=>{const t=void 0===e.reason?v_("This operation was aborted."):e.reason;return t instanceof Error?t:v_(t)};class b_{#e=[];enqueue(e,t){const n={priority:(t={priority:0,...t}).priority,run:e};if(this.size&&this.#e[this.size-1].priority>=t.priority)return void this.#e.push(n);const a=function(e,t,n){let a=0,i=e.length;for(;i>0;){const r=Math.trunc(i/2);let o=a+r;n(e[o],t)<=0?(a=++o,i-=r+1):i=r}return a}(this.#e,n,((e,t)=>t.priority-e.priority));this.#e.splice(a,0,n)}dequeue(){const e=this.#e.shift();return e?.run}filter(e){return this.#e.filter((t=>t.priority===e.priority)).map((e=>e.run))}get size(){return this.#e.length}}class w_ extends g_{#t;#n;#a=0;#i;#r;#o=0;#s;#c;#e;#l;#d=0;#u;#h;#p;timeout;constructor(e){if(super(),!("number"==typeof(e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:b_,...e}).intervalCap&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??""}\` (${typeof e.intervalCap})`);if(void 0===e.interval||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??""}\` (${typeof e.interval})`);this.#t=e.carryoverConcurrencyCount,this.#n=e.intervalCap===Number.POSITIVE_INFINITY||0===e.interval,this.#i=e.intervalCap,this.#r=e.interval,this.#e=new e.queueClass,this.#l=e.queueClass,this.concurrency=e.concurrency,this.timeout=e.timeout,this.#p=!0===e.throwOnTimeout,this.#h=!1===e.autoStart}get#m(){return this.#n||this.#a{this.#v()}),t)),!0;this.#a=this.#t?this.#d:0}return!1}#_(){if(0===this.#e.size)return this.#s&&clearInterval(this.#s),this.#s=void 0,this.emit("empty"),0===this.#d&&this.emit("idle"),!1;if(!this.#h){const e=!this.#w;if(this.#m&&this.#g){const t=this.#e.dequeue();return!!t&&(this.emit("active"),t(),e&&this.#b(),!0)}}return!1}#b(){this.#n||void 0!==this.#s||(this.#s=setInterval((()=>{this.#y()}),this.#r),this.#o=Date.now()+this.#r)}#y(){0===this.#a&&0===this.#d&&this.#s&&(clearInterval(this.#s),this.#s=void 0),this.#a=this.#t?this.#d:0,this.#x()}#x(){for(;this.#_(););}get concurrency(){return this.#u}set concurrency(e){if(!("number"==typeof e&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this.#u=e,this.#x()}async#C(e){return new Promise(((t,n)=>{e.addEventListener("abort",(()=>{n(e.reason)}),{once:!0})}))}async add(e,t={}){return t={timeout:this.timeout,throwOnTimeout:this.#p,...t},new Promise(((n,a)=>{this.#e.enqueue((async()=>{this.#d++,this.#a++;try{t.signal?.throwIfAborted();let a=e({signal:t.signal});t.timeout&&(a=function(e,t){const{milliseconds:n,fallback:a,message:i,customTimers:r={setTimeout:setTimeout,clearTimeout:clearTimeout}}=t;let o;const s=new Promise(((s,c)=>{if("number"!=typeof n||1!==Math.sign(n))throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${n}\``);if(t.signal){const{signal:e}=t;e.aborted&&c(y_(e)),e.addEventListener("abort",(()=>{c(y_(e))}))}if(n===Number.POSITIVE_INFINITY)return void e.then(s,c);const l=new f_;o=r.setTimeout.call(void 0,(()=>{if(a)try{s(a())}catch(e){c(e)}else"function"==typeof e.cancel&&e.cancel(),!1===i?s():i instanceof Error?c(i):(l.message=i??`Promise timed out after ${n} milliseconds`,c(l))}),n),(async()=>{try{s(await e)}catch(e){c(e)}})()})),c=s.finally((()=>{c.clear()}));return c.clear=()=>{r.clearTimeout.call(void 0,o),o=void 0},c}(Promise.resolve(a),{milliseconds:t.timeout})),t.signal&&(a=Promise.race([a,this.#C(t.signal)]));const i=await a;n(i),this.emit("completed",i)}catch(e){if(e instanceof f_&&!t.throwOnTimeout)return void n();a(e),this.emit("error",e)}finally{this.#f()}}),t),this.emit("add"),this.#_()}))}async addAll(e,t){return Promise.all(e.map((async e=>this.add(e,t))))}start(){return this.#h?(this.#h=!1,this.#x(),this):this}pause(){this.#h=!0}clear(){this.#e=new this.#l}async onEmpty(){0!==this.#e.size&&await this.#M("empty")}async onSizeLessThan(e){this.#e.sizethis.#e.size{const a=()=>{t&&!t()||(this.off(e,a),n())};this.on(e,a)}))}get size(){return this.#e.size}sizeBy(e){return this.#e.filter(e).length}get pending(){return this.#d}get isPaused(){return this.#h}}var x_={frigate_card:"Frigate card",frigate_card_description:"A Lovelace card for use with Frigate",live:"Live",no_media:"No media to display",recordings:"Recordings",version:"Version"},C_={cameras:{camera_entity:"Camera Entity",capabilities:{capabilities:{clips:"Clips","favorite-events":"Favorite Events","favorite-recordings":"Favorite Recordings",live:"Live",menu:"Menu",ptz:"PTZ",recordings:"Recordings",seek:"Seeking",snapshots:"Snapshots",substream:"Substream"},disable:"Disable",disable_except:"Disable except",editor_label:"Camera capabilities"},cast:{dashboard:{dashboard_path:"Dashboard path",view_path:"View path"},editor_label:"Cast options",method:"Cast method",methods:{dashboard:"Dashboard",standard:"Standard"}},dependencies:{all_cameras:"Show events for all cameras with this camera",cameras:"Show events for specific cameras with this camera",editor_label:"Dependency options"},dimensions:{aspect_ratio:"Static aspect ratio",editor_label:"Camera dimensions",layout:{editor_label:"Camera Layout",fit:"Layout fit",fits:{contain:"Media is contained/letterboxed",cover:"Media expands proportionally to cover the card",fill:"Media is stretched to fill the card"},pan:{x:"Pan horizontal percentage",y:"Pan vertical percentage"},position:{editor_label:"Layout Cover Position",x:"Horizontal placement percentage",y:"Vertical placement percentage"},view_box:{bottom:"Bottom inset percentage",editor_label:"Layout View Box",left:"Left inset percentage",right:"Right inset percentage",top:"Top inset percentage"},zoom:"Zoom factor"}},engines:{editor_label:"Camera engine options"},frigate:{camera_name:"Frigate camera name (Autodetected from entity)",client_id:"Frigate client id (For >1 Frigate server)",editor_label:"Frigate options",labels:"Frigate labels/object filters",url:"Frigate server URL",zones:"Frigate zones"},go2rtc:{editor_label:"go2rtc Options",modes:{editor_label:"go2rtc Modes",mjpeg:"Motion JPEG (MJPEG)",mp4:"MPEG-4 (MP4)",mse:"Media Source Extensions (MSE)",webrtc:"Web Real-Time Communication (WebRTC)"},stream:"go2rtc stream name"},icon:"Icon for this camera (Autodetected from entity)",id:"Unique id for this camera in this card",image:{editor_label:"Image Options",refresh_seconds:"Number of seconds after which to refresh live image (0=never)",url:"Image URL to use instead of camera entity snapshot"},live_provider:"Live view provider for this camera",live_provider_options:{editor_label:"Live provider options"},live_providers:{auto:"Automatic",go2rtc:"go2rtc",ha:"Home Assistant video stream (i.e. HLS, LL-HLS, WebRTC via HA)",image:"Home Assistant images",jsmpeg:"JSMpeg","webrtc-card":"WebRTC Card (i.e. AlexxIT's WebRTC Card)"},motioneye:{editor_label:"MotionEye options",images:{directory_pattern:"Images directory pattern",file_pattern:"Images file pattern"},movies:{directory_pattern:"Movies directory pattern",file_pattern:"Movies file pattern"},url:"MotionEye UI URL"},proxy:{dynamic:"Dynamic proxying",editor_label:"Camera proxying",media:{auto:"Media proxying automatically configured",editor_label:"Media proxying",false:"Media proxying disabled",true:"Media proxying enabled"},ssl_ciphers:{auto:"SSL ciphers automatically configured",default:"Default SSL ciphers",editor_label:"SSL ciphers",insecure:"Insecure SSL ciphers",intermediate:"Intermediate SSL ciphers",modern:"Modern SSL ciphers"},ssl_verification:{auto:"SSL verification automatically configured",editor_label:"SSL verification",false:"SSL verification disabled",true:"SSL verification enabled"}},reolink:{editor_label:"Reolink options",media_resolution:{editor_label:"Media Resolution",high:"High Resolution",low:"Low Resolution"},url:"Reolink UI URL"},title:"Title for this camera (Autodetected from entity)",triggers:{editor_label:"Trigger options",entities:"Trigger from other entities",events:{clips:"Events with new clips",editor_label:"Trigger Events",events:"All events",snapshots:"Events with new snapshots"},motion:"Trigger by auto-detecting the motion sensor",occupancy:"Trigger by auto-detecting the occupancy sensor"},webrtc_card:{editor_label:"WebRTC Card Options",entity:"WebRTC Card Camera Entity (Not a Frigate camera)",url:"WebRTC Card Camera URL"}},common:{controls:{builtin:"Built-in video controls",filter:{editor_label:"Media Filter",mode:"Filter mode",modes:{left:"Media filter in a drawer to the left",none:"No media filter",right:"Media filter in a drawer to the right"}},next_previous:{editor_label:"Next & Previous",size:"Next & previous control size in pixels",style:"Next & previous control style",styles:{chevrons:"Chevrons",icons:"Icons",none:"None",thumbnails:"Thumbnails"}},thumbnails:{editor_label:"Thumbnails",events_media_type:"Whether to show event thumbnails of clips or snapshots",events_media_types:{clips:"Clip thumbnails",snapshots:"Snapshot thumbnails"},media_type:"Whether to show thumnails of events or recordings",media_types:{events:"Events",recordings:"Recordings"},mode:"Thumbnails mode",modes:{above:"Thumbnails above",below:"Thumbnails below",left:"Thumbnails in a drawer to the left",none:"No thumbnails",right:"Thumbnails in a drawer to the right"},show_details:"Show details with thumbnails",show_download_control:"Show download control on thumbnails",show_favorite_control:"Show favorite control on thumbnails",show_timeline_control:"Show timeline control on thumbnails",size:"Thumbnails size in pixels"},timeline:{editor_label:"Mini Timeline",mode:"Mode",modes:{above:"Above",below:"Below",none:"None"},pan_mode:"Default pan mode",pan_modes:{pan:"Pan",seek:"Pan seeks across all media","seek-in-camera":"Pan seeks within selected camera only","seek-in-media":"Pan seeks within selected media item only"}}},display:{editor_label:"Display",grid_columns:"Exact number of grid columns",grid_max_columns:"Maximum number of grid columns",grid_selected_width_factor:"Increase selected media width by this factor",mode:"Mode"},image:{entity:"Entity for use with entity mode",entity_parameters:"Query parameters added to the entity-based picture URLs (e.g. width=1920&height=1080)",mode:"Image mode",modes:{camera:"Home Assistant camera snapshot of camera entity",entity:"Entity with entity_picture attribute",screensaver:"Embedded Frigate logo",url:"Arbitrary image specified by URL"},refresh_seconds:"Number of seconds after which to refresh (0=never)",url:"Static image URL"},media_action_conditions:{all:"All opportunities",hidden:"On browser/tab hiding",microphone_mute:"On microphone mute",microphone_unmute:"On microphone unmute",never:"Never",selected:"On selection",unselected:"On unselection",visible:"On browser/tab visibility"},timeline:{clustering_threshold:"The count of events at which they are clustered (0=no clustering)",events_media_type:"The events media the timeline displays",events_media_types:{all:"All event media types",clips:"Clips",snapshots:"Snapshots"},show_recordings:"Show recordings",style:"Timeline style",styles:{ribbon:"Events on a single ribbon",stack:"Stacked & clustered events"},window_seconds:"The default length of the timeline view in seconds"}},dimensions:{aspect_ratio:"Default aspect ratio (e.g. '16:9')",aspect_ratio_mode:"Aspect ratio mode",aspect_ratio_modes:{dynamic:"Aspect ratio adjusts to media",static:"Static aspect ratio",unconstrained:"Unconstrained aspect ratio"},height:"Card height in CSS units (e.g. '500px')"},live:{auto_mute:"Automatically mute live cameras",auto_pause:"Automatically pause live cameras",auto_play:"Automatically play live cameras",auto_unmute:"Automatically unmute live cameras",controls:{editor_label:"Live Controls",ptz:{editor_label:"PTZ",hide_home:"Hide home control",hide_pan_tilt:"Hide pan & tilt control",hide_zoom:"Hide zoom control",mode:"Mode",modes:{off:"Off",on:"On"},orientation:"Orientation",orientations:{horizontal:"Horizontal",vertical:"Vertical"},position:"Position",positions:{"bottom-left":"Bottom left","bottom-right":"Bottom right","top-left":"Top left","top-right":"Top right"}}},draggable:"Live cameras view can be dragged/swiped",lazy_load:"Live cameras are lazily loaded",lazy_unload:"Live cameras are lazily unloaded",microphone:{always_connected:"Always keep the microphone connected",disconnect_seconds:"Seconds after which to disconnect microphone (0=never)",editor_label:"Microphone",enabled:"Microphone enabled",mute_after_microphone_mute_seconds:"Seconds after microphone mute to mute inbound audio"},preload:"Preload live view in the background",show_image_during_load:"Show still image while the live stream is loading",transition_effect:"Live camera transition effect",zoomable:"Live cameras can be zoomed/panned"},media_viewer:{auto_mute:"Automatically mute media",auto_pause:"Automatically pause media",auto_play:"Automatically play media",auto_unmute:"Automatically unmute media",controls:{editor_label:"Media Viewer Controls"},draggable:"Media Viewer can be dragged/swiped",lazy_load:"Media Viewer media is lazily loaded in carousel",snapshot_click_plays_clip:"Clicking on a snapshot plays a related clip",transition_effect:"Media Viewer transition effect",transition_effects:{none:"No transition",slide:"Slide transition"},zoomable:"Media Viewer can be zoomed/panned"},menu:{alignment:"Menu alignment",alignments:{bottom:"Aligned to the bottom",left:"Aligned to the left",right:"Aligned to the right",top:"Aligned to the top"},button_size:"Menu button size in pixels",buttons:{alignment:"Button alignment",alignments:{matching:"Matching the menu alignment",opposing:"Opposing the menu alignment"},camera_ui:"Camera user interface",cameras:"Cameras",clips:"Clips",display_mode:"Display mode",download:"Download",enabled:"Button enabled",expand:"Expand",frigate:"Frigate menu / Default view",fullscreen:"Fullscreen",icon:"Icon",image:"Image",live:"Live",media_player:"Send to media player",microphone:"Microphone",mute:"Mute / Unmute",permanent:"Show when the menu is hidden",play:"Play / Pause",priority:"Priority",ptz_controls:"Show PTZ controls",ptz_home:"PTZ Home",recordings:"Recordings",screenshot:"Screenshot",snapshots:"Snapshots",substreams:"Substream(s)",timeline:"Timeline",type:"Button type",types:{momentary:"Momentary",toggle:"Toggle"}},position:"Menu position",positions:{bottom:"Positioned on the bottom",left:"Positioned on the left",right:"Positioned on the right",top:"Positioned on the top"},style:"Menu style",styles:{hidden:"Hidden menu",hover:"Hover menu","hover-card":"Hover menu (card-wide)",none:"No menu",outside:"Outside menu",overlay:"Overlay menu"}},overrides:{info:"This card configuration has manually specified overrides configured which may override values shown in the visual editor, please consult the code editor to view/modify these overrides"},performance:{features:{animated_progress_indicator:"Animated Progress Indicator",editor_label:"Feature Options",max_simultaneous_engine_requests:"Max simultaneous camera engine requests",media_chunk_size:"Media chunk size"},style:{border_radius:"Curves",box_shadow:"Shadows",editor_label:"Style Options"},warning:"This card is in low profile mode so defaults have changed to optimize performance"},profiles:{casting:"Casting",editor_label:"Configuration profiles","low-performance":"Low performance",scrubbing:"Video scrubbing"},status_bar:{height:"Status bar height in pixels",items:{enabled:"Item enabled",engine:"Camera engine",live_provider:"Live provider",priority:"Item priority",resolution:"Resolution",technology:"Technology",title:"Title"},popup_seconds:"Status bar popup seconds",position:"Status bar position",positions:{bottom:"Positioned on the bottom",top:"Positioned on the top"},style:"Status bar style",styles:{hover:"Hover status bar","hover-card":"Hover status bar (card-wide)",none:"No status bar",outside:"Outside status bar",overlay:"Overlay status bar",popup:"Popup status bar"}},view:{camera_select:"View for newly selected cameras",dark_mode:"Dark mode",dark_modes:{auto:"Auto",off:"Off",on:"On"},default:"Default view",default_cycle_camera:"Cycle through cameras when default view updates",default_reset:{after_interaction:"Reset to the default view after user interaction ends",editor_label:"Default view reset behavior",entities:"Reset to the default view on entity state change",every_seconds:"Reset to default view every X seconds (0=never)",interaction_mode:"How default reset behaves when the card has human interaction",interaction_modes:{active:"Only allow reset when card has active human interaction",all:"Reset regardless of human interaction",inactive:"Only reset when card has no human interaction"}},interaction_seconds:"Seconds after user action to remain interacted with (0=never)",keyboard_shortcuts:{editor_label:"Keyboard shortcuts",enabled:"Keyboard shortcuts enabled",ptz_down:"PTZ Down",ptz_home:"PTZ Home",ptz_left:"PTZ Left",ptz_right:"PTZ Right",ptz_up:"PTZ Up",ptz_zoom_in:"PTZ Zoom In",ptz_zoom_out:"PTZ Zoom Out"},triggers:{actions:{editor_label:"Trigger actions",interaction_mode:"How to handle actions when the card has human interaction",interaction_modes:{active:"Only trigger actions when card has human interaction",all:"Trigger actions regardless of human interaction",inactive:"Only trigger actions when card has no human interaction"},trigger:"Trigger action",triggers:{default:"Change to or update default view",live:"Change to or update live view",media:"Change to the relevant media view for new media",none:"No action"},untrigger:"Untrigger action",untriggers:{default:"Change to default view/camera",none:"No action"}},editor_label:"Trigger behavior",filter_selected_camera:"Only trigger on selected camera",show_trigger_status:"Show pulsing border when triggered",untrigger_seconds:"Seconds after inactive state change to untrigger"},views:{clip:"Most recent clip",clips:"Clips gallery",current:"Current view",image:"Static image",live:"Live view",recording:"Most recent recording",recordings:"Recordings gallery",snapshot:"Most recent snapshot",snapshots:"Snapshots gallery",timeline:"Timeline view"}}},M_={grid:"Show media viewer for each camera in a grid",single:"Show single media viewer"},k_={add_new_camera:"Add new camera",button:"Button",camera:"Camera",cameras:"Cameras",cameras_secondary:"What cameras to render on this card",delete:"Delete",dimensions:"Card dimensions",dimensions_secondary:"Card dimensions & shape options",image:"Image",image_secondary:"Static image view options",live:"Live",live_secondary:"Live camera view options",media_gallery:"Media gallery",media_gallery_secondary:"Media gallery options",media_viewer:"Media viewer",media_viewer_secondary:"Viewer for static media (clips, snapshots or recordings)",menu:"Menu",menu_secondary:"Menu look & feel options",move_down:"Move down",move_up:"Move up",overrides:"Overrides are active",overrides_secondary:"Dynamic configuration overrides detected",performance:"Performance",performance_secondary:"Card performance options",profiles:"Configuration profiles",profiles_secondary:"Choose pre-configured sets of defaults",status_bar:"Status bar",status_bar_secondary:"Status bar look & feel options",timeline:"Timeline",timeline_secondary:"Event timeline options",upgrade:"Upgrade",upgrade_available:"An automatic card configuration upgrade is available",view:"View",view_secondary:"What the card should show and how to show it"},S_={ptz:{down:"Down",home:"Home",left:"Left",right:"Right",up:"Up",zoom_in:"Zoom In",zoom_out:"Zoom Out"}},E_={awaiting_live:"Waiting for live stream to load ...",awaiting_media:"Waiting for media to load",camera_initialization:"Camera initialization failed",camera_initialization_reolink:"Could not initialize Reolink camera",could_not_render_elements:"Could not render picture elements",could_not_resolve:"Could not resolve media URL",diagnostics:"Card diagnostics. Please review for confidential information prior to sharing",download_no_media:"No media to download",download_sign_failed:"Could not sign media URL for download",duplicate_camera_id:"Duplicate Frigate camera id for the following camera, use the 'id' parameter to uniquely identify cameras",empty_response:"Received empty response from Home Assistant for request",failed_response:"Failed to receive response from Home Assistant for request",failed_retain:"Could not retain event",failed_sign:"Could not sign Home Assistant URL",image_load_error:"The image could not be loaded",invalid_configuration:"Invalid configuration",invalid_configuration_no_hint:"No location hint available (bad or missing type?)",invalid_configuration_override:"Invalid override configuration",invalid_elements_config:"Invalid picture elements configuration",invalid_response:"Received invalid response from Home Assistant for request",jsmpeg_no_player:"Could not start JSMPEG player",live_camera_no_endpoint:"Could not get camera endpoint for this live provider (incomplete configuration?)",live_camera_not_found:"The configured camera_entity was not found",live_camera_unavailable:"Camera unavailable",no_camera_engine:"Could not determine suitable engine for camera",no_camera_entity:"Could not find camera entity",no_camera_entity_for_triggers:"A camera entity is required in order to autodetect triggers",no_camera_id:"Could not determine camera id for the following camera, may need to set 'id' parameter manually",no_camera_name:"Could not determine a Frigate camera name for camera (or one of its dependents), please specify either 'camera_entity' or 'camera_name'",no_dashboard_or_view:"Both 'dashboard_path' and 'view_path' parameters are required for the 'dashboard' cast method",no_live_camera:"The camera_entity parameter must be set and valid for this live provider",no_supported_camera:"The selected camera does not support this view",no_supported_cameras:"No cameras support this view",reconnecting:"Reconnecting",too_many_automations:"Too many nested automation calls, please check your configuration for loops",troubleshooting:"Check troubleshooting",unknown:"Unknown error",upgrade_available:"An automated card configuration upgrade is available, please visit the visual card editor",webrtc_card_reported_error:"WebRTC Card reported an error",webrtc_card_waiting:"Waiting for WebRTC Card to load ..."},$_={camera:"Camera",duration:"Duration",in_progress:"In Progress",score:"Score",seek:"Seek",start:"Start",tag:"Tag",what:"What",where:"Where"},A_={assign:"Assign",assigning:"Assigning",modifiers:{alt:"Alt",ctrl:"Ctrl",meta:"Meta",shift:"Shift"},unassign:"Unassign"},z_={all:"All",camera:"Camera",favorite:"Favorite",media_type:"Media Type",media_types:{clips:"Clips",recordings:"Recordings",snapshots:"Snapshots"},not_favorite:"Not Favorite",select_camera:"Select camera...",select_favorite:"Select favorite...",select_media_type:"Select media type...",select_tag:"Select tag...",select_what:"Select what...",select_when:"Select when...",select_where:"Select where...",tag:"Tag",what:"What",when:"When",whens:{custom:"Custom",past_month:"Past Month",past_week:"Past Week",today:"Today",yesterday:"Yesterday"},where:"Where"},I_={unseekable:"Seek time not found in media"},T_={camera:"Camera",duration:"Duration",events:"Events",in_progress:"In Progress",seek:"Seek",start:"Start"},j_={download:"Download media",no_thumbnail:"No thumbnail available",retain_indefinitely:"Media will be indefinitely retained",timeline:"See media in timeline"},O_={select_date:"Choose date"},D_={common:x_,config:C_,display_modes:M_,editor:k_,elements:S_,error:E_,event:$_,key_assigner:A_,media_filter:z_,media_viewer:I_,recording:T_,thumbnail:j_,timeline:O_},R_=Object.freeze({__proto__:null,common:x_,config:C_,default:D_,display_modes:M_,editor:k_,elements:S_,error:E_,event:$_,key_assigner:A_,media_filter:z_,media_viewer:I_,recording:T_,thumbnail:j_,timeline:O_});const P_="en",L_={[P_]:R_};let N_;function F_(e){const t=e=>e.replace("-","_"),n=e?.language??e?.selectedLanguage;if(n)return t(n);const a=localStorage.getItem("selectedLanguage");if(a){const e=JSON.parse(a);if(e)return t(e)}for(const e of navigator.languages){const n=t(e);if(n&&n in L_)return n}return P_}function V_(e,t="",n=""){let a="";try{a=e.split(".").reduce(((e,t)=>e[t]),L_[N_??P_])}catch(e){}return a||(a=e.split(".").reduce(((e,t)=>e[t]),L_[P_])),""!==t&&""!==n&&(a=a.replace(t,n)),a}function H_(e){return"string"==typeof e?.id&&e.id||"string"==typeof e?.camera_entity&&e.camera_entity||"object"==typeof e?.webrtc_card&&e.webrtc_card&&("string"==typeof e.webrtc_card.entity&&e.webrtc_card.entity||"string"==typeof e.webrtc_card.url&&e.webrtc_card.url)||"object"==typeof e?.go2rtc&&e.go2rtc&&"string"==typeof e.go2rtc.url&&"string"==typeof e.go2rtc.stream&&`${e.go2rtc.url}#${e.go2rtc.stream}`||"object"==typeof e?.frigate&&e.frigate&&"string"==typeof e?.frigate.camera_name&&e.frigate.camera_name||""}const B_=(e,...t)=>{e?.debug?.logging&&console.debug(...t)},q_=(e,t,n)=>"preset"===t?(n?.preset?e.ptz.presets?.[n.preset]:null)??null:n?.phase?e.ptz[`actions_${t}_${n.phase}`]??null:e.ptz[`actions_${t}`]??null,U_=(e,t,n)=>!!q_(e,t,n),W_=(e,t)=>{const n=U_(e,t,{phase:"start"})&&U_(e,t,{phase:"stop"}),a=U_(e,t);return n||a?[...n?["continuous"]:[],...a?["relative"]:[]]:null},Z_=e=>{const t=W_(e,"left"),n=W_(e,"right"),a=W_(e,"up"),i=W_(e,"down"),r=W_(e,"zoom_in"),o=W_(e,"zoom_out"),s=e.ptz.presets?Object.keys(e.ptz.presets):void 0;return t?.length||n?.length||a?.length||i?.length||r?.length||o?.length||s?.length?{...t?{left:t}:{},...n?{right:n}:{},...a?{up:a}:{},...i?{down:i}:{},...r?{zoomIn:r}:{},...o?{zoomOut:o}:{},...s?{presets:s}:{}}:null};class Q_{constructor(e,t){this._capabilities=e;for(const e of t?.disable??[])this._disable(e);for(const e of Ts)t?.disableExcept?.length&&!t.disableExcept.includes(e)&&this._disable(e)}_disable(e){delete this._capabilities[e]}matches(e){let t=!0;return"string"==typeof e&&(t&&=this.has(e)),"object"==typeof e&&e.allCapabilities&&(t&&=e.allCapabilities.every((e=>this.has(e)))),"object"==typeof e&&e.anyCapabilities&&(t&&=e.anyCapabilities.some((e=>this.has(e)))),t}has(e){return!!this._capabilities[e]}getPTZCapabilities(){return this._capabilities.ptz??null}hasPTZCapability(){return!!(this._capabilities.ptz?.down?.length||this._capabilities.ptz?.up?.length||this._capabilities.ptz?.left?.length||this._capabilities.ptz?.right?.length||this._capabilities.ptz?.zoomIn?.length||this._capabilities.ptz?.zoomOut?.length||this._capabilities.ptz?.presets?.length)}getRawCapabilities(){return this._capabilities}}function G_(e,t,n){var a=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var r=Array(i);++at||r&&o&&c&&!s&&!l||a&&o&&c||!n&&c||!i)return 1;if(!a&&!r&&!l&&e=s?c:c*("desc"==n[a]?-1:1)}return e.index-t.index}(e,t,n)}))}function Ev(e,t,n,a){return null==e?[]:(dp(t)||(t=null==t?[]:[t]),dp(n=a?void 0:n)||(n=null==n?[]:[n]),Sv(e,t,n))}async function $v(e,t,n,a=!1){let i;try{i=await e.callWS(n)}catch(e){if(!(e instanceof Error))throw new zs(V_("error.failed_response"),{request:n,response:e});throw e}if(!i)throw new zs(V_("error.empty_response"),{request:n});const r=a?t.safeParse(JSON.parse(i)):t.safeParse(i);if(!r.success)throw new zs(V_("error.invalid_response"),{request:n,response:i,invalid_keys:Rs(r.error)});return r.data}const Av=ba.lazy((()=>ba.object({title:ba.string(),media_class:ba.string(),media_content_type:ba.string(),media_content_id:ba.string(),can_play:ba.boolean(),can_expand:ba.boolean(),children_media_class:ba.string().nullable().optional(),thumbnail:ba.string().nullable(),children:ba.array(Av).nullable().optional()}))),zv="video",Iv="image",Tv=60,jv=e=>Ev(e,(e=>e._metadata?.startDate),"desc");class Ov{async walkBrowseMedias(e,t,n){return t&&t.length?(await tf(t,(async t=>await this._walkBrowseMedia(e,t,n)))).flat():[]}async _walkBrowseMedia(e,t,n){let a=[];for(const i of function(e,t,n){t=(n?dg(e,t,n):void 0===t)?1:K_(Sg(t),0);var a=null==e?0:e.length;if(!a||t<1)return[];for(var i=0,r=0,o=Array(Y_(a/t));iawait this._browseMedia(e,a,{cache:n?.cache,matcher:t.matcher,metadataGenerator:t.metadataGenerator})));for(const e of r)for(const n of e.children??[])t.matcher(n)&&a.push(n);if(t.sorter&&(a=t.sorter(a)),t.earlyExit&&t.earlyExit(a))break}const i=t.advance?t.advance(a):null;return i?.length?await this.walkBrowseMedias(e,i,n):a}async _browseMedia(e,t,n){const a="object"==typeof t?t.media_content_id:t,i=n?.cache?n.cache.get(a):null;if(i)return i;const r={type:"media_source/browse_media",media_content_id:a},o=await $v(e,Av,r);if(n?.metadataGenerator)for(const e of o.children??[])e._metadata=n.metadataGenerator(e,"object"==typeof t?t:void 0)??void 0;return n?.cache&&n.cache.set(a,o,Ud(new Date,{seconds:60})),o}}function Dv(e,t){return bm(e,t)}function Rv(e,t){return e&&e.length?function(e,t){for(var n=-1,a=e.length,i=0,r=[];++nNv(t,e)))}add(e){this._ranges.push(e),this._ranges=Vv(this._ranges)}clear(){this._ranges=[]}}class Lv{constructor(e){this._ranges=e??[]}hasCoverage(e){const t=new Date;return this._ranges.some((n=>tet.start>=e.start&&t.end<=e.end,Fv=(e,t)=>e.start>=t.start&&e.start<=t.end||e.end>=t.start&&e.end<=t.end||e.start<=t.start&&e.end>=t.end,Vv=(e,t=0)=>{const n=[];e=Ev(e,(e=>e.start),"asc");let a=null;for(const i of e){const e=i.start instanceof Date?i.start.getTime():i.start;if(!a){a={...i};continue}(a.end instanceof Date?a.end.getTime():a.end)+1e3*t>=e?i.end>a.end&&(a.end=i.end):(n.push(a),a={...i})}return a&&n.push(a),n};class Hv{constructor(){this._data=[]}get(e){const t=new Date;for(const n of this._data)if((!n.expires||t<=n.expires)&&this._contains(e,n.request))return n.response;return null}clear(){this._data=[]}has(e){return!!this.get(e)}set(e,t,n){this._data.push({request:e,response:t,expires:n}),this._expireOldRequests()}_contains(e,t){return Dv(e,t)}_expireOldRequests(){const e=new Date;this._data=this._data.filter((t=>!t.expires||e=e.start.getTime()){if(a>e.end.getTime())break;t.push(n)}}return t}getSize(){return this._data.length}expireMatches(e){this._data=this._data.filter((t=>!e(t)))}}class Uv{constructor(){this._segments=new Map}add(e,t,n){let a=this._segments.get(e);a||(a=new qv((e=>1e3*e.start_time),(e=>e.id)),this._segments.set(e,a)),a.add(t,n)}clear(){this._segments.clear()}hasCoverage(e,t){return!!this._segments.get(e)?.hasCoverage(t)}get(e,t){return this._segments.get(e)?.get(t)??null}getSize(e){return this._segments.get(e)?.getSize()??null}getCameraIDs(){return[...this._segments.keys()]}expireMatches(e,t){this._segments.get(e)?.expireMatches(t)}}class Wv extends zs{}class Zv extends zs{}var Qv,Gv,Yv;!function(e){e.Event="event-query",e.Recording="recording-query",e.RecordingSegments="recording-segments-query",e.MediaMetadata="media-metadata"}(Qv||(Qv={})),function(e){e.Event="event-results",e.Recording="recording-results",e.RecordingSegments="recording-segments-results",e.MediaMetadata="media-metadata-results"}(Gv||(Gv={})),function(e){e.Frigate="frigate",e.Generic="generic",e.MotionEye="motioneye",e.Reolink="reolink"}(Yv||(Yv={}));const Kv=e=>e.camera_entity??e.webrtc_card?.entity??null;class Xv{constructor(e){this._entityRegistryManager=e}async createEngine(e,t){let n;switch(e){case Yv.Generic:const{GenericCameraManagerEngine:e}=await import("./engine-generic-31c14ad9.js").then((function(e){return e.e}));n=new e(t.stateWatcher,t.eventCallback);break;case Yv.Frigate:const{FrigateCameraManagerEngine:a}=await import("./engine-frigate-3f150159.js");n=new a(this._entityRegistryManager,t.stateWatcher,new Uv,new Bv,t.eventCallback);break;case Yv.MotionEye:const{MotionEyeCameraManagerEngine:i}=await import("./engine-motioneye-fa799851.js");n=new i(this._entityRegistryManager,t.stateWatcher,new Ov,t.resolvedMediaCache,new Bv,t.eventCallback);break;case Yv.Reolink:const{ReolinkCameraManagerEngine:r}=await import("./engine-reolink-5d642010.js");n=new r(this._entityRegistryManager,t.stateWatcher,new Ov,t.resolvedMediaCache,new Bv,t.eventCallback)}return n}async getEngineForCamera(e,t){let n=null;if("frigate"===t.engine)n=Yv.Frigate;else if("motioneye"===t.engine)n=Yv.MotionEye;else if("generic"===t.engine)n=Yv.Generic;else if("reolink"===t.engine)n=Yv.Reolink;else{const a=Kv(t);if(a){const i=await this._entityRegistryManager.getEntity(e,a);if(!i){if(e.states[a])return Yv.Generic;throw new Wv(V_("error.no_camera_entity"),t)}switch(i?.platform){case"frigate":n=Yv.Frigate;break;case"motioneye":n=Yv.MotionEye;break;case"reolink":n=Yv.Reolink;break;default:n=Yv.Generic}}else t.frigate.camera_name?n=Yv.Frigate:(t.webrtc_card?.url||t.go2rtc?.url&&t.go2rtc?.stream)&&(n=Yv.Generic)}return n}}class Jv{constructor(){this._cameras=new Map,this._enginesByType=new Map}addCamera(e){this._cameras.set(e.getID(),e),this._enginesByType.set(e.getEngine().getEngineType(),e.getEngine())}async setCameras(e){for(const t of e){const e=this._cameras.get(t.getID());e!==t&&(this.addCamera(t),await(e?.destroy()))}for(const t of this._cameras.values())e.includes(t)||(await t.destroy(),this._cameras.delete(t.getID()))}async reset(){await tf(this._cameras.values(),(e=>e.destroy())),this._cameras.clear(),this._enginesByType.clear()}getCamera(e){return this._cameras.get(e)??null}getCameras(){return this._cameras}getCameraConfig(e){return this._cameras.get(e)?.getConfig()??null}hasCameraID(e){return this._cameras.has(e)}getCameraCount(){return this._cameras.size}getDefaultCameraID(){return this._cameras.keys().next().value??null}*getCameraConfigs(e){for(const[t,n]of this.getCameraConfigEntries(e))yield n}*getCameraConfigEntries(e){for(const t of e??this._cameras.keys()){const e=this.getCameraConfig(t);e&&(yield[t,e])}}getCameraIDs(){return new Set(this._cameras.keys())}getCameraIDsWithCapability(e){const t=new Set;for(const n of this._cameras.values())n.getCapabilities()?.matches(e)&&t.add(n.getID());return t}getCameraConfigForMedia(e){return this.getCameraConfig(e.getCameraID())}getEngineOfType(e){return this._enginesByType.get(e)??null}getEngineForCameraID(e){return this._cameras.get(e)?.getEngine()??null}getEnginesForCameraIDs(e){const t=new Map;for(const n of e){const e=this.getEngineForCameraID(n);e&&(t.has(e)||t.set(e,new Set),t.get(e)?.add(n))}return t.size?t:null}getEngineForMedia(e){return this.getEngineForCameraID(e.getCameraID())}getAllDependentCameras(e,t){const n=new Set,a=new Set,i=e=>{n.add(e);const r=this.getCamera(e),o=r?.getConfig();if(r&&o){t&&!r.getCapabilities()?.matches(t)||a.add(e);const s=new Set;o.dependencies.cameras.forEach((e=>s.add(e))),o.dependencies.all_cameras&&this.getCameraIDs().forEach((e=>s.add(e)));for(const e of s)n.has(e)||i(e)}};return i(e),a}}const ey=e=>{return Ev((n=e=>e.getID()??e,(t=e)&&t.length?Hg(t,xv(n)):[]),(e=>e.getStartTime()??e.getID()),"asc");var t,n};class ty{static isEventQuery(e){return e.type===Qv.Event}static isRecordingQuery(e){return e.type===Qv.Recording}static isRecordingSegmentsQuery(e){return e.type===Qv.RecordingSegments}static isMediaMetadataQuery(e){return e.type===Qv.MediaMetadata}}class ny{static isEventQueryResult(e){return e.type===Gv.Event}static isRecordingQueryResult(e){return e.type===Gv.Recording}static isRecordingSegmentsQueryResult(e){return e.type===Gv.RecordingSegments}static isMediaMetadataQueryResult(e){return e.type===Gv.MediaMetadata}}class ay{constructor(e,t){this._requestLimit=new w_,this._api=e,this._engineFactory=t?.factory??new Xv(this._api.getEntityRegistryManager()),this._store=t?.store??new Jv}async initializeCamerasFromConfig(){const e=this._api.getConfigManager().getConfig(),t=this._api.getHASSManager().getHASS();if(!e||!t)return!1;this._requestLimit.concurrency=e.performance.features.max_simultaneous_engine_requests??1/0;const n=e.cameras.map((t=>{return n={},a=u_(e?.cameras_global),hg(n,a,t,((e,t)=>Array.isArray(t)?t:void 0));var n,a}));try{await this._initializeCameras(n)}catch(e){return this._api.getMessageManager().setErrorIfHigherPriority(e,V_("error.camera_initialization")),!1}return!0}async reset(){await this._store.reset()}async _getEnginesForCameras(e){const t=new Map,n=new Map,a=this._api.getHASSManager().getHASS(); +/* istanbul ignore if: the if path cannot be reached -- @preserve */ +if(!a)return t;const i=await(async e=>await tf(e,(e=>this._engineFactory.getEngineForCamera(a,e))))(e);for(const[a,r]of e.entries()){const e=i[a],o=e?n.get(e)??await this._engineFactory.createEngine(e,{eventCallback:e=>this._api.getTriggersManager().handleCameraEvent(e),stateWatcher:this._api.getHASSManager().getStateWatcher(),resolvedMediaCache:this._api.getResolvedMediaCache()}):null;if(!o||!e)throw new Wv(V_("error.no_camera_engine"),u_(r));n.set(e,o),t.set(r,o)}return t}async _initializeCameras(e){const t=new Date,n=this._api.getHASSManager().getHASS(); +/* istanbul ignore if: the if path cannot be reached -- @preserve */ +if(!n)return;e.some((e=>(e=>e.triggers.motion||e.triggers.occupancy)(e)))&&await this._api.getEntityRegistryManager().fetchEntityList(n);const a=await this._getEnginesForCameras(e),i=await tf(a.entries(),(async([e,t])=>await t.createCamera(n,e))),r=async()=>{i.forEach((e=>e.destroy()))},o=new Set;for(const e of i){const t=H_(e.getConfig());if(!t)throw await r(),new Wv(V_("error.no_camera_id"),e.getConfig());if(o.has(t))throw await r(),new Wv(V_("error.duplicate_camera_id"),e.getConfig());e.setID(t),o.add(t)}await this._store.setCameras(i),B_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card CameraManager initialized (Cameras: ",this._store.getCameras(),`, Duration: ${((new Date).getTime()-t.getTime())/1e3}s,`,")")}isInitialized(){return this._store.getCameraCount()>0}getStore(){return this._store}generateDefaultEventQueries(e,t){return this._generateDefaultQueries(e,{type:Qv.Event,...t})}generateDefaultRecordingQueries(e,t){return this._generateDefaultQueries(e,{type:Qv.Recording,...t})}generateDefaultRecordingSegmentsQueries(e,t){return this._generateDefaultQueries(e,{type:Qv.RecordingSegments,...t})}_generateDefaultQueries(e,t){const n=[],a=Zg(e),i=this._store.getEnginesForCameraIDs(a);if(!i)return null;for(const[e,a]of i){let i=null; +/* istanbul ignore else: the else path cannot be reached -- @preserve */ty.isEventQuery(t)?i=e.generateDefaultEventQuery(this._store,a,t):ty.isRecordingQuery(t)?i=e.generateDefaultRecordingQuery(this._store,a,t):ty.isRecordingSegmentsQuery(t)&&(i=e.generateDefaultRecordingSegmentsQuery(this._store,a,t));for(const e of i??[])n.push(e)}return n.length?n:null}async getMediaMetadata(){const e=new Set,t=new Set,n=new Set,a=new Set,i={type:Qv.MediaMetadata,cameraIDs:this._store.getCameraIDs()},r=await this._handleQuery(i);for(const i of r.values())i.metadata.tags&&i.metadata.tags.forEach(e.add,e),i.metadata.what&&i.metadata.what.forEach(t.add,t),i.metadata.where&&i.metadata.where.forEach(n.add,n),i.metadata.days&&i.metadata.days.forEach(a.add,a);return t.size||n.size||a.size||e.size?{...e.size&&{tags:e},...t.size&&{what:t},...n.size&&{where:n},...a.size&&{days:a}}:null}async getEvents(e,t){return await this._handleQuery(e,t)}async getRecordings(e,t){return await this._handleQuery(e,t)}async getRecordingSegments(e,t){return await this._handleQuery(e,t)}async executeMediaQueries(e,t){return this._convertQueryResultsToMedia(await this._handleQuery(e,t))}async extendMediaQueries(e,t,n,a){if(!this._api.getHASSManager().getHASS())return null;const i=e=>{let n=null;for(const a of t){const t=a.getStartTime();t&&(!n||"earliest"===e&&tn)&&(n=t)}return n},r=this._api.getConfigManager().getCardWideConfig()?.performance?.features.media_chunk_size??50,o=[],s=[];for(const t of e){const e={...t}; +/* istanbul ignore else: the else path cannot be reached -- @preserve */if("later"===n){const t=i("latest");t&&(e.start=t,delete e.end)}else if("earlier"===n){const t=i("earliest");t&&(e.end=t,delete e.start)}e.limit=r,s.push({...t,limit:(t.limit??0)+r}),o.push(e)}const c=this._convertQueryResultsToMedia(await this._handleQuery(o,a));if(!c.length)return null;const l=ey(t.concat(c));return l.length===t.length?null:{queries:s,results:l}}async getMediaDownloadPath(e){const t=this._store.getCameraConfigForMedia(e),n=this._store.getEngineForMedia(e),a=this._api.getHASSManager().getHASS();return t&&n&&a?await n.getMediaDownloadPath(a,t,e):null}getMediaCapabilities(e){const t=this._store.getEngineForMedia(e);return t?t.getMediaCapabilities(e):null}async favoriteMedia(e,t){const n=this._store.getCameraConfigForMedia(e),a=this._store.getEngineForMedia(e),i=this._api.getHASSManager().getHASS();if(!n||!a||!i)return;const r=new Date;await this._requestLimit.add((()=>a.favoriteMedia(i,n,e,t))),B_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card CameraManager favorite request (",`Duration: ${((new Date).getTime()-r.getTime())/1e3}s,`,"Media:",e.getID(),", Favorite:",t,")")}areMediaQueriesResultsFresh(e,t){const n=new Date;for(const a of e){const e=this._store.getEnginesForCameraIDs(a.cameraIDs);for(const[i,r]of e??[]){const e=i.getQueryResultMaxAge({...a,cameraIDs:r});if(null!==e&&Ud(t,{seconds:e})a?null:await this._requestLimit.add((()=>i.getMediaSeekTime(r,this._store,e,t)))??null}async _handleQuery(e,t){const n=Wg(e),a=new Map,i=new Date,r=this._api.getHASSManager().getHASS();if(!r)return a;const o=async(e,n)=>{let i=null; +/* istanbul ignore else: the else path cannot be reached -- @preserve */ty.isEventQuery(n)?i=await e.getEvents(r,this._store,n,t):ty.isRecordingQuery(n)?i=await e.getRecordings(r,this._store,n,t):ty.isRecordingSegmentsQuery(n)?i=await e.getRecordingSegments(r,this._store,n,t):ty.isMediaMetadataQuery(n)&&(i=await e.getMediaMetadata(r,this._store,n,t)),i?.forEach(((e,t)=>a.set(t,e)))},s=async e=>{const t=this._store.getEnginesForCameraIDs(e.cameraIDs);t&&await Promise.all(Array.from(t.keys()).map((n=>this._requestLimit.add((()=>o(n,{...e,cameraIDs:t.get(n)}))))))};await Promise.all(n.map((e=>s(e))));const c=(l=Array.from(a.values()).map((e=>Number(e.cached??0))))&&l.length?function(e,t){for(var n,a=-1,i=e.length;++athis._store.getCamera(e))).filter(sf);return new Q_({live:t.some((e=>e.getCapabilities()?.has("live"))),clips:t.some((e=>e.getCapabilities()?.has("clips"))),recordings:t.some((e=>e.getCapabilities()?.has("recordings"))),snapshots:t.some((e=>e.getCapabilities()?.has("snapshots"))),"favorite-events":t.some((e=>e.getCapabilities()?.has("favorite-events"))),"favorite-recordings":t.some((e=>e.getCapabilities()?.has("favorite-recordings"))),seek:t.some((e=>e.getCapabilities()?.has("seek"))),menu:t.some((e=>e.getCapabilities()?.has("menu")))})}async executePTZAction(e,t,n){const a=this._store.getCameraConfig(e);if(!a)return;const i=q_(a,t,n);if(i)return await this._api.getActionsManager().executeActions(i);const r=this._api.getHASSManager().getHASS(),o=this._store.getEngineForCameraID(e);return o&&r?await this._requestLimit.add((()=>o.executePTZAction(r,a,t,n))):void 0}}class iy{constructor(e){this._cache=new Map,this._keyCallback=e}has(e){return this._cache.has(e)}getMatches(e){return[...this._cache.values()].filter(e)}get(e){return this._cache.get(e)??null}add(e){const t=e=>this._cache.set(this._keyCallback(e),e);Array.isArray(e)?e.forEach(t):t(e)}}const ry=ba.object({id:ba.string(),model:ba.string().nullable(),config_entries:ba.string().array(),manufacturer:ba.string().nullable()}).array();class oy{constructor(e){this._fetchedDeviceList=!1,this._cache=e}async getDevice(e,t){return this._cache.has(t)?this._cache.get(t):(await this._fetchDeviceList(e),this._cache.get(t)??null)}async getMatchingDevices(e,t){return await this._fetchDeviceList(e),this._cache.getMatches(t)}async _fetchDeviceList(e){if(this._fetchedDeviceList)return;let t=null;try{t=await $v(e,ry,{type:"config/device_registry/list"})}catch(e){return void Gg(e)}this._cache.add(t),this._fetchedDeviceList=!0}}const sy=ba.object({config_entry_id:ba.string().nullable(),device_id:ba.string().nullable(),disabled_by:ba.string().nullable(),entity_id:ba.string(),hidden_by:ba.string().nullable(),platform:ba.string(),translation_key:ba.string().nullable(),unique_id:ba.string().or(ba.number()).optional()}),cy=sy.array();class ly{constructor(e){this._fetchedEntityList=!1,this._cache=e}async getEntity(e,t){const n=this._cache.get(t);if(n)return n;let a=null;try{a=await $v(e,sy,{type:"config/entity_registry/get",entity_id:t})}catch(e){return Gg(e),null}return this._cache.add(a),a}async getMatchingEntities(e,t){return await this.fetchEntityList(e),this._cache.getMatches(t)}async getEntities(e,t){const n=new Map;return await Promise.all(t.map((async t=>{const a=await this.getEntity(e,t);a&&n.set(t,a)}))),n}async fetchEntityList(e){if(this._fetchedEntityList)return;let t=null;try{t=await $v(e,cy,{type:"config/entity_registry/list"})}catch(e){return void Gg(e)}this._cache.add(t),this._fetchedEntityList=!0}}class dy extends Map{constructor(e={}){if(super(),!(e.maxSize&&e.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");if("number"==typeof e.maxAge&&0===e.maxAge)throw new TypeError("`maxAge` must be a number greater than 0");this.maxSize=e.maxSize,this.maxAge=e.maxAge||Number.POSITIVE_INFINITY,this.onEviction=e.onEviction,this.cache=new Map,this.oldCache=new Map,this._size=0}_emitEvictions(e){if("function"==typeof this.onEviction)for(const[t,n]of e)this.onEviction(t,n.value)}_deleteIfExpired(e,t){return"number"==typeof t.expiry&&t.expiry<=Date.now()&&("function"==typeof this.onEviction&&this.onEviction(e,t.value),this.delete(e))}_getOrDeleteIfExpired(e,t){if(!1===this._deleteIfExpired(e,t))return t.value}_getItemValue(e,t){return t.expiry?this._getOrDeleteIfExpired(e,t):t.value}_peek(e,t){const n=t.get(e);return this._getItemValue(e,n)}_set(e,t){this.cache.set(e,t),this._size++,this._size>=this.maxSize&&(this._size=0,this._emitEvictions(this.oldCache),this.oldCache=this.cache,this.cache=new Map)}_moveToRecent(e,t){this.oldCache.delete(e),this._set(e,t)}*_entriesAscending(){for(const e of this.oldCache){const[t,n]=e;if(!this.cache.has(t)){!1===this._deleteIfExpired(t,n)&&(yield e)}}for(const e of this.cache){const[t,n]=e;!1===this._deleteIfExpired(t,n)&&(yield e)}}get(e){if(this.cache.has(e)){const t=this.cache.get(e);return this._getItemValue(e,t)}if(this.oldCache.has(e)){const t=this.oldCache.get(e);if(!1===this._deleteIfExpired(e,t))return this._moveToRecent(e,t),t.value}}set(e,t,{maxAge:n=this.maxAge}={}){const a="number"==typeof n&&n!==Number.POSITIVE_INFINITY?Date.now()+n:void 0;return this.cache.has(e)?this.cache.set(e,{value:t,expiry:a}):this._set(e,{value:t,expiry:a}),this}has(e){return this.cache.has(e)?!this._deleteIfExpired(e,this.cache.get(e)):!!this.oldCache.has(e)&&!this._deleteIfExpired(e,this.oldCache.get(e))}peek(e){return this.cache.has(e)?this._peek(e,this.cache):this.oldCache.has(e)?this._peek(e,this.oldCache):void 0}delete(e){const t=this.cache.delete(e);return t&&this._size--,this.oldCache.delete(e)||t}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}resize(e){if(!(e&&e>0))throw new TypeError("`maxSize` must be a number greater than 0");const t=[...this._entriesAscending()],n=t.length-e;n<0?(this.cache=new Map(t),this.oldCache=new Map,this._size=t.length):(n>0&&this._emitEvictions(t.slice(0,n)),this.oldCache=new Map(t.slice(n)),this.cache=new Map,this._size=0),this.maxSize=e}*keys(){for(const[e]of this)yield e}*values(){for(const[,e]of this)yield e}*[Symbol.iterator](){for(const e of this.cache){const[t,n]=e;!1===this._deleteIfExpired(t,n)&&(yield[t,n.value])}for(const e of this.oldCache){const[t,n]=e;if(!this.cache.has(t)){!1===this._deleteIfExpired(t,n)&&(yield[t,n.value])}}}*entriesDescending(){let e=[...this.cache];for(let t=e.length-1;t>=0;--t){const n=e[t],[a,i]=n;!1===this._deleteIfExpired(a,i)&&(yield[a,i.value])}e=[...this.oldCache];for(let t=e.length-1;t>=0;--t){const n=e[t],[a,i]=n;if(!this.cache.has(a)){!1===this._deleteIfExpired(a,i)&&(yield[a,i.value])}}}*entriesAscending(){for(const[e,t]of this._entriesAscending())yield[e,t.value]}get size(){if(!this._size)return this.oldCache.size;let e=0;for(const t of this.oldCache.keys())this.cache.has(t)||e++;return Math.min(this._size+e,this.maxSize)}entries(){return this.entriesAscending()}forEach(e,t=this){for(const[n,a]of this.entriesAscending())e.call(t,a,n,this)}get[Symbol.toStringTag](){return JSON.stringify([...this.entriesAscending()])}}class uy{constructor(){this._cache=new dy({maxSize:1e3})}has(e){return this._cache.has(e)}get(e){return this._cache.get(e)}set(e,t){this._cache.set(e,t)}}const hy=async(e,t,n)=>{const a=n?n.get(t):void 0;if(a)return a;const i={type:"media_source/resolve_media",media_content_id:t};let r=null;try{r=await $v(e,js,i)}catch(e){Gg(e)}return n&&r&&n.set(t,r),r};class py{constructor(e,t,n){this._context=e,this._action=t,this._config=n}async execute(e){}async stop(){}}class my extends py{}class gy extends my{async execute(e){const t=this._action.camera??(this._action.triggered?e.getTriggersManager().getMostRecentlyTriggeredCameraID():null),n=e.getViewManager().getView(),a=e.getConfigManager().getConfig();if(t&&n){const i=a?.view.camera_select??"current",r="current"===i?n.view:i;await e.getViewManager().setViewByParametersWithNewQuery({params:{view:r,camera:t},failSafe:!0})}}}class fy extends my{async execute(e){e.getCameraURLManager().openURL()}}class _y extends my{async execute(e){e.getViewManager().setViewDefault()}}class vy extends my{async execute(e){await e.getViewManager().setViewByParametersWithNewQuery({params:{displayMode:this._action.display_mode}})}}class yy extends my{async execute(e){await e.getDownloadManager().downloadViewerMedia()}}class by extends my{async execute(e){e.getExpandManager().toggleExpanded()}}class wy extends my{async execute(e){e.getFullscreenManager().toggleFullscreen()}}class xy extends py{async execute(e){const t=e.getHASSManager().getHASS();t&&at(e.getCardElementManager().getElement(),t,this._config??{},this._action)}}class Cy extends my{async execute(e){console[this._action.level](this._action.message)}}const My=(e,t)=>e.context?.live?.overrides?.get(t??e.camera)??t??e.camera,ky=e=>My(e)!==e.camera,Sy=(e,t)=>{const n=e.context?.live?.overrides??new Map;n.set(e.camera,t),e.mergeInContext({live:{overrides:n}})};class Ey extends my{async execute(e){const t=this._action.media_player,n=e.getMediaPlayerManager(),a=e.getViewManager().getView(),i=a?.queryResults?.getSelectedResult()??null;"stop"===this._action.media_player_action?await n.stop(t):a?.is("live")?await n.playLive(t,My(a)):a?.isViewerView()&&i&&await n.playMedia(t,i)}}class $y extends my{async execute(e){e.getCardElementManager().toggleMenu()}}class Ay extends my{async execute(e){await e.getMicrophoneManager().connect()}}class zy extends my{async execute(e){e.getMicrophoneManager().disconnect()}}class Iy extends my{async execute(e){e.getMicrophoneManager().mute()}}class Ty extends my{async execute(e){await e.getMicrophoneManager().unmute()}}class jy extends my{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.mute())}}class Oy extends my{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.pause())}}class Dy extends my{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.play())}}const Ry=(e,t)=>{if(e.isViewerView()){const n=e.queryResults?.getSelectedResult()?.getID()??null;return"ptz"!==t?.type&&n?{targetID:n,type:"digital"}:null}if(e.is("live")){const n=My(e);let a="digital";return"digital"!==t?.type&&t?.cameraManager&&(Py(t.cameraManager,n)&&(a="ptz"),"ptz"!==a&&"ptz"===t?.type)?null:{targetID:n,type:a}}return null},Py=(e,t)=>!!e.getStore().getCamera(t)?.getCapabilities()?.hasPTZCapability();var Ly=ug((function(e,t,n){Jm(e,t,n)}));const Ny=(e,t)=>{t?.[e]?.inProgressAction?.stop()},Fy=(e,t,n,a)=>{Ly(t,{[n]:{[e]:{inProgressAction:a}}})};class Vy extends my{constructor(){super(...arguments),this._timer=new xf}async stop(){this._timer.stop()}async execute(e){const t=e.getViewManager().getView();if(!t)return;const n=this._action.camera??Ry(t,{type:"ptz",cameraManager:e.getCameraManager()})?.targetID??null,a=n?e.getCameraManager().getCameraCapabilities(n)?.getPTZCapabilities():null,i=n?e.getCameraManager().getStore().getCameraConfig(n)?.ptz:null;if(!n||!a||!i)return;if(!this._action.ptz_action)return void(a.presets&&a.presets.length>=1&&await e.getCameraManager().executePTZAction(n,"preset",{phase:this._action.ptz_phase,preset:a.presets[0]}));const r=(e=>{switch(e){case"left":case"right":case"up":case"down":return e;case"zoom_in":return"zoomIn";case"zoom_out":return"zoomOut"}return null})(this._action.ptz_action);if(r&&a[r]?.includes(this._action.ptz_phase?"continuous":"relative")||"preset"===this._action.ptz_action)return await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{phase:this._action.ptz_phase,preset:this._action.ptz_preset});if("start"===this._action.ptz_phase){Ny(n,this._context.ptz),Fy(n,this._context,"ptz",this);const t=async()=>{this._action.ptz_action&&await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset}),this._timer.start(i.r2c_delay_between_calls_seconds,t)};await t()}else"stop"===this._action.ptz_phase?Ny(n,this._context.ptz):(await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset,phase:"start"}),this._timer.start(i.c2r_delay_between_calls_seconds,(async()=>{this._action.ptz_action&&await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset,phase:"stop"})})))}}class Hy extends my{async execute(e){e.getViewManager().setViewWithMergedContext({ptzControls:{enabled:this._action.enabled}})}}function By(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=Cg(n))==n?n:0),void 0!==t&&(t=(t=Cg(t))==t?t:0),function(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}(Cg(e),t,n)}const qy=50,Uy=50,Wy=1,Zy=4,Qy=e=>void 0===e?.pan?.x&&void 0===e?.pan?.y&&void 0===e?.zoom;class Gy{constructor(e){this._context=e}modify(e){e.mergeInContext(this._context)}}const Yy=(e,t)=>({zoom:{[e]:{observed:t?.observed??void 0,requested:t?.requested??null}}}),Ky=(e,t,n)=>{t&&n&&t.setViewByParameters({modifiers:[new Gy(Yy(n,{observed:e.detail}))]})};class Xy extends my{constructor(){super(...arguments),this._timer=new xf}async _stepChange(e,t){e.getViewManager().setViewWithMergedContext(Yy(t,{requested:this._convertActionToZoomSettings(e.getViewManager().getView()?.context?.zoom?.[t]?.observed)}))}async stop(){this._timer.stop()}async execute(e){const t=e.getViewManager().getView();if(!t)return;const n=this._action.target_id??Ry(t,{type:"digital",cameraManager:e.getCameraManager()})?.targetID;return n?this._action.absolute||!this._action.ptz_phase?await this._stepChange(e,n): +/* istanbul ignore else: the else path cannot be reached -- @preserve */ +void("start"===this._action.ptz_phase?(Ny(n,this._context.ptzDigital),Fy(n,this._context,"ptzDigital",this),await this._stepChange(e,n),this._timer.startRepeated(.1,(()=>this._stepChange(e,n)))):"stop"===this._action.ptz_phase&&(Ny(n,this._context.ptzDigital),delete this._context.ptzDigital?.[n])):void 0}_convertActionToZoomSettings(e){if(!this._action.absolute&&!this._action.ptz_action)return{};if(this._action.absolute)return this._action.absolute;const t=e?.zoom??1,n=e?.pan?.x??50,a=e?.pan?.y??50,i="zoom_in"===this._action.ptz_action?.1:"zoom_out"===this._action.ptz_action?-.1:0,r="left"===this._action.ptz_action?-5:"right"===this._action.ptz_action?5:0,o="up"===this._action.ptz_action?-5:"down"===this._action.ptz_action?5:0;return{zoom:By(t+i,1,10),pan:{x:By(n+r,0,100),y:By(a+o,0,100)}}}}class Jy extends my{async execute(e){const t=e.getViewManager().getView();let n=null,a=null;if(this._action.target_id)n=this._action.target_id,a=Py(e.getCameraManager(),n)?"ptz":"digital";else if(t){const i=Ry(t,{cameraManager:e.getCameraManager()});n=i?.targetID??null,a=i?.type??null}n&&null!==a&&("ptz"===a?this._toPTZAction(n):this._toPTZDigitalAction(n)).execute(e)}_toPTZAction(e){return new Vy(this._context,(t={cardID:this._action.card_id,cameraID:e,ptzAction:this._action.ptz_action,ptzPhase:this._action.ptz_phase,ptzPreset:this._action.ptz_preset},{action:"fire-dom-event",frigate_card_action:"ptz",...t?.cardID&&{card_id:t.cardID},...t?.ptzAction&&{ptz_action:t.ptzAction},...t?.ptzPhase&&{ptz_phase:t.ptzPhase},...t?.ptzPreset&&{ptz_preset:t.ptzPreset},...t?.cameraID&&{camera:t.cameraID}}),this._config);var t}_toPTZDigitalAction(e){return new Xy(this._context,(t={cardID:this._action.card_id,ptzPhase:this._action.ptz_phase,ptzAction:this._action.ptz_action,targetID:e},{action:"fire-dom-event",frigate_card_action:"ptz_digital",...t?.cardID&&{card_id:t.cardID},...t?.ptzAction&&{ptz_action:t.ptzAction},...t?.ptzPhase&&{ptz_phase:t.ptzPhase},...t?.absolute&&{absolute:t.absolute},...t?.targetID&&{target_id:t.targetID}}),this._config);var t}}class eb extends my{async execute(e){await e.getDownloadManager().downloadScreenshot()}}class tb extends my{async execute(e){var t;await af((t=this._action.duration,3600*(t.h??0)+60*(t.m??0)+(t.s??0)+(t.ms??0)/1e3))}}class nb extends my{async execute(e){switch(this._action.status_bar_action){case"reset":e.getStatusBarItemManager().removeAllDynamicStatusBarItems();break;case"add":this._action.items?.forEach((t=>e.getStatusBarItemManager().addDynamicStatusBarItem(t)));break;case"remove":this._action.items?.forEach((t=>e.getStatusBarItemManager().removeDynamicStatusBarItem(t)))}}}class ab{modify(e){(e=>{const t=e.context?.live?.overrides;t&&t.has(e.camera)&&e.context?.live?.overrides?.delete(e.camera)})(e)}}class ib extends my{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new ab]})}}class rb{constructor(e){this._api=e}modify(e){const t=[...this._api.getCameraManager().getStore().getAllDependentCameras(e.camera,"substream")];if(t.length<=1)return;const n=My(e),a=t.indexOf(n),i=a<0?0:(a+1)%t.length;Sy(e,t[i])}}class ob extends my{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new rb(e)]})}}class sb{constructor(e){this._substreamID=e}modify(e){Sy(e,this._substreamID)}}class cb extends my{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new sb(this._action.camera)]})}}class lb extends my{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.unmute())}}class db extends my{async execute(e){e.getViewManager().setViewByParametersWithNewQuery({params:{view:this._action.frigate_card_action}})}}class ub{createAction(e,t,n){const a=mf(t);if("fire-dom-event"!==t.action||!a)return new xy(e,t,n?.config);if(a.card_id&&a.card_id!==n?.cardID)return null;switch(a.frigate_card_action){case"default":return new _y(e,a,n?.config);case"clip":case"clips":case"image":case"live":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":case"diagnostics":return new db(e,a,n?.config);case"sleep":return new tb(e,a,n?.config);case"download":return new yy(e,a,n?.config);case"camera_ui":return new fy(e,a,n?.config);case"expand":return new by(e,a,n?.config);case"fullscreen":return new wy(e,a,n?.config);case"menu_toggle":return new $y(e,a,n?.config);case"camera_select":return new gy(e,a,n?.config);case"live_substream_select":return new cb(e,a,n?.config);case"live_substream_off":return new ib(e,a,n?.config);case"live_substream_on":return new ob(e,a,n?.config);case"media_player":return new Ey(e,a,n?.config);case"microphone_connect":return new Ay(e,a,n?.config);case"microphone_disconnect":return new zy(e,a,n?.config);case"microphone_mute":return new Iy(e,a,n?.config);case"microphone_unmute":return new Ty(e,a,n?.config);case"mute":return new jy(e,a,n?.config);case"unmute":return new lb(e,a,n?.config);case"play":return new Dy(e,a,n?.config);case"pause":return new Oy(e,a,n?.config);case"screenshot":return new eb(e,a,n?.config);case"display_mode_select":return new vy(e,a,n?.config);case"ptz":return new Vy(e,a,n?.config);case"ptz_digital":return new Xy(e,a,n?.config);case"ptz_multi":return new Jy(e,a,n?.config);case"ptz_controls":return new Hy(e,a,n?.config);case"log":return new Cy(e,a,n?.config);case"status_bar":return new nb(e,a,n?.config)} +/* istanbul ignore next: this path cannot be reached -- @preserve */ +/* istanbul ignore next: this path cannot be reached -- @preserve */ +return console.warn(`Frigate card received unknown card action: ${a.frigate_card_action}`),null}}class hb{constructor(e,t,n){this._actions=[],this._factory=new ub,this._stopped=!1,this._context=e;for(const a of Wg(t)){const t=this._factory.createAction(e,a,n);t&&this._actions.push(t)}}async execute(e){for(const t of this._actions){if(this._stopped)break;await t.execute(e)}}async stop(){this._stopped=!0}}const pb=ba.object({action:ba.enum(["tap","double_tap","hold","start_tap","end_tap"])}),mb=ba.object({detail:pb});class gb{constructor(e){this._actionsInFlight=[],this._actionContext={},this.handleInteractionEvent=e=>{const t=mb.safeParse(e);if(!t.success)return;const n=t.data.detail.action,a=this.getMergedActions(),i=yf(n,a);a&&n&&i&&this.executeActions(i,a)},this.handleCustomActionEvent=e=>{"detail"in e&&this.executeActions(e.detail)},this.handleActionExecutionRequestEvent=async e=>{await this.executeActions(e.detail.action,e.detail.config)},this._api=e}getMergedActions(){const e=this._api.getViewManager().getView();if(this._api.getMessageManager().hasMessage())return{};const t=this._api.getConfigManager().getConfig();let n;if(e?.is("live"))n=t?.live.actions;else if(e?.isGalleryView())n=t?.media_gallery?.actions;else if(e?.isViewerView())n=t?.media_viewer.actions;else{if(!e?.is("image"))return{};n=t?.image?.actions}return{...t?.view.actions,...n}}uninitialize(){this._actionsInFlight.forEach((e=>e.stop()))}async executeActions(e,t){const n=new hb(this._actionContext,e,{config:t,cardID:this._api.getConfigManager().getConfig()?.card_id});this._actionsInFlight.push(n),await n.execute(this._api),this._actionsInFlight=this._actionsInFlight.filter((e=>e!==n))}}class fb{constructor(e){this._automations=[],this._priorEvaluations=new Map,this._nestedAutomationExecutions=0,this._api=e}deleteAutomations(e){this._automations=this._automations.filter((t=>t.tag!==e))}addAutomations(e){this._automations.push(...e)}execute(){if(!this._api.getHASSManager().hasHASS()||!this._api.getInitializationManager().isInitializedMandatory()||this._api.getMessageManager().hasErrorMessage())return;const e=[];for(const t of this._automations){const n=this._api.getConditionsManager().evaluateConditions(t.conditions),a=n?t.actions:t.actions_not,i=this._priorEvaluations.get(t);this._priorEvaluations.set(t,n),n!==i&&a&&e.push(...a)}if(!e.length)return;(async e=>{++this._nestedAutomationExecutions,this._nestedAutomationExecutions>10?this._api.getMessageManager().setMessageIfHigherPriority({type:"error",message:V_("error.too_many_automations")}):(await this._api.getActionsManager().executeActions(e),--this._nestedAutomationExecutions)})(e)}}class _b{constructor(e){this._api=e}openURL(){const e=this.getCameraURL();e&&window.open(e)}hasCameraURL(){return!!this.getCameraURL()}getCameraURL(){const e=this._api.getViewManager().getView(),t=e?.queryResults?.getSelectedResult()??null,n=e?.camera?this._api.getCameraManager().getCameraEndpoints(e.camera,{view:e.view,...t&&{media:t}})??null:null;return n?.ui?.endpoint??null}}const vb=(e,t)=>!!((e.attributes.supported_features??0)&t),yb=e=>(e=>vb(e,4)&&"number"==typeof e.attributes.in_progress)(e)||!!e.attributes.in_progress,bb=e=>{switch(e){case"armed_away":return"mdi:shield-lock";case"armed_vacation":return"mdi:shield-airplane";case"armed_home":return"mdi:shield-home";case"armed_night":return"mdi:shield-moon";case"armed_custom_bypass":return"mdi:security";case"pending":case"arming":return"mdi:shield-sync";case"triggered":return"mdi:bell-ring";case"disarmed":return"mdi:shield-off";default:return"mdi:shield"}},wb=(e,t)=>{const n="off"===e;switch(t?.attributes.device_class){case"battery":return n?"mdi:battery":"mdi:battery-outline";case"battery_charging":return n?"mdi:battery":"mdi:battery-charging";case"cold":return n?"mdi:thermometer":"mdi:snowflake";case"connectivity":return n?"mdi:close-network-outline":"mdi:check-network-outline";case"door":return n?"mdi:door-closed":"mdi:door-open";case"garage_door":return n?"mdi:garage":"mdi:garage-open";case"power":case"plug":return n?"mdi:power-plug-off":"mdi:power-plug";case"gas":case"problem":case"safety":case"tamper":return n?"mdi:check-circle":"mdi:alert-circle";case"smoke":return n?"mdi:check-circle":"mdi:smoke";case"heat":return n?"mdi:thermometer":"mdi:fire";case"light":return n?"mdi:brightness5":"mdi:brightness-7";case"lock":return n?"mdi:lock":"mdi:lock-open";case"moisture":return n?"mdi:water-off":"mdi:water";case"motion":return n?"mdi:motion-sensor-off":"mdi:motion-sensor";case"occupancy":case"presence":return n?"mdi:home-outline":"mdi:home";case"opening":return n?"mdi:square":"mdi:square-outline";case"running":return n?"mdi:stop":"mdi:play";case"sound":return n?"mdi:music-note-off":"mdi:music-note";case"update":return n?"mdi:package":"mdi:package-up";case"vibration":return n?"mdi:crop-portrait":"mdi:vibrate";case"window":return n?"mdi:window-closed":"mdi:window-open";default:return n?"mdi:radiobox-blank":"mdi:checkbox-marked-circle"}},xb=(e,t)=>{const n="closed"!==e;switch(t?.attributes.device_class){case"garage":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:garage";default:return"mdi:garage-open"}case"gate":switch(e){case"opening":case"closing":return"mdi:gate-arrow-right";case"closed":return"mdi:gate";default:return"mdi:gate-open"}case"door":return n?"mdi:door-open":"mdi:door-closed";case"damper":return n?"md:circle":"mdi:circle-slice-8";case"shutter":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-shutter";default:return"mdi:window-shutter-open"}case"curtain":switch(e){case"opening":return"mdi:arrow-split-vertical";case"closing":return"mdi:arrow-collapse-horizontal";case"closed":return"mdi:curtains-closed";default:return"mdi:curtains"}case"blind":case"shade":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:blinds";default:return"mdi:blinds-open"}case"window":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-closed";default:return"mdi:window-open"}}switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-closed";default:return"mdi:window-open"}},Cb={apparent_power:"mdi:flash",aqi:"mdi:air-filter",carbon_dioxide:"mdi:molecule-co2",carbon_monoxide:"mdi:molecule-co",current:"mdi:current-ac",date:"mdi:calendar",energy:"mdi:lightning-bolt",frequency:"mdi:sine-wave",gas:"mdi:gas-cylinder",humidity:"mdi:water-percent",illuminance:"mdi:brightness-5",monetary:"mdi:cash",nitrogen_dioxide:"mdi:molecule",nitrogen_monoxide:"mdi:molecule",nitrous_oxide:"mdi:molecule",ozone:"mdi:molecule",pm1:"mdi:molecule",pm10:"mdi:molecule",pm25:"mdi:molecule",power:"mdi:flash",power_factor:"mdi:angle-acute",pressure:"mdi:gauge",reactive_power:"mdi:flash",signal_strength:"mdi:wifi",sulphur_dioxide:"mdi:molecule",temperature:"mdi:thermometer",timestamp:"mdi:clock",volatile_organic_compounds:"mdi:molecule",voltage:"mdi:sine-wave"},Mb={10:"mdi:battery-10",20:"mdi:battery-20",30:"mdi:battery-30",40:"mdi:battery-40",50:"mdi:battery-50",60:"mdi:battery-60",70:"mdi:battery-70",80:"mdi:battery-80",90:"mdi:battery-90",100:"mdi:battery"},kb={10:"mdi:battery-charging-10",20:"mdi:battery-charging-20",30:"mdi:battery-charging-30",40:"mdi:battery-charging-40",50:"mdi:battery-charging-50",60:"mdi:battery-charging-60",70:"mdi:battery-charging-70",80:"mdi:battery-charging-80",90:"mdi:battery-charging-90",100:"mdi:battery-charging"},Sb=(e,t)=>{const n=Number(e);if(isNaN(n))return"off"===e?"mdi:battery":"on"===e?"mdi:battery-alert":"mdi:battery-unknown";const a=10*Math.round(n/10);return t&&n>=10?kb[a]:t?"mdi:battery-charging-outline":n<=5?"mdi:battery-alert-variant-outline":Mb[a]},Eb=e=>{const t=e?.attributes.device_class;if(t&&t in Cb)return Cb[t];if("battery"===t)return e?((e,t)=>{const n=e.state;return Sb(n,"on"===t?.state)})(e):"mdi:battery";const n=e?.attributes.unit_of_measurement;return"°C"===n||"°F"===n?"mdi:thermometer":void 0},$b="mdi:bookmark",Ab={alert:"mdi:alert",air_quality:"mdi:air-filter",automation:"mdi:robot",calendar:"mdi:calendar",camera:"mdi:video",climate:"mdi:thermostat",configurator:"mdi:cog",conversation:"mdi:text-to-speech",counter:"mdi:counter",fan:"mdi:fan",google_assistant:"mdi:google-assistant",group:"mdi:google-circles-communities",homeassistant:"mdi:home-assistant",homekit:"mdi:home-automation",image_processing:"mdi:image-filter-frames",input_button:"mdi:gesture-tap-button",input_datetime:"mdi:calendar-clock",input_number:"mdi:ray-vertex",input_select:"mdi:format-list-bulleted",input_text:"mdi:form-textbox",light:"mdi:lightbulb",mailbox:"mdi:mailbox",notify:"mdi:comment-alert",number:"mdi:ray-vertex",persistent_notification:"mdi:bell",person:"mdi:account",plant:"mdi:flower",proximity:"mdi:apple-safari",remote:"mdi:remote",scene:"mdi:palette",script:"mdi:script-text",select:"mdi:format-list-bulleted",sensor:"mdi:eye",siren:"mdi:bullhorn",simple_alarm:"mdi:bell",sun:"mdi:white-balance-sunny",timer:"mdi:timer-outline",updater:"mdi:cloud-upload",vacuum:"mdi:robot-vacuum",water_heater:"mdi:thermometer",weather:"mdi:weather-cloudy",zone:"mdi:map-marker-radius"};function zb(e,t,n,a){switch(e){case"alarm_control_panel":return bb(n);case"binary_sensor":return wb(n,t);case"button":switch(t?.attributes.device_class){case"restart":return"mdi:restart";case"update":return"mdi:package-up";default:return"mdi:gesture-tap-button"}case"cover":return xb(n,t);case"device_tracker":return"router"===t?.attributes.source_type?"home"===n?"mdi:lan-connect":"mdi:lan-disconnect":["bluetooth","bluetooth_le"].includes(t?.attributes.source_type)?"home"===n?"mdi:bluetooth-connect":"mdi:bluetooth":"not_home"===n?"mdi:account-arrow-right":"mdi:account";case"humidifier":return n&&"off"===n?"mdi:air-humidifier-off":"mdi:air-humidifier";case"input_boolean":return"on"===n?"mdi:check-circle-outline":"mdi:close-circle-outline";case"lock":switch(n){case"unlocked":return"mdi:lock-open";case"jammed":return"mdi:lock-alert";case"locking":case"unlocking":return"mdi:lock-clock";default:return"mdi:lock"}case"media_player":switch(t?.attributes.device_class){case"speaker":switch(n){case"playing":return"mdi:speaker-play";case"paused":return"mdi:speaker-pause";case"off":return"mdi:speaker-off";default:return"mdi:speaker"}case"tv":switch(n){case"playing":return"mdi:television-play";case"paused":return"mdi:television-pause";case"off":return"mdi:television-off";default:return"mdi:television"}default:switch(n){case"playing":case"paused":return"mdi:cast-connected";case"off":return"mdi:cast-off";default:return"mdi:cast"}}case"switch":switch(t?.attributes.device_class){case"outlet":return"on"===n?"mdi:power-plug":"mdi:power-plug-off";case"switch":return"on"===n?"mdi:toggle-switch":"mdi:toggle-switch-off";default:return"mdi:flash"}case"zwave":switch(n){case"dead":return"mdi:emoticon-dead";case"sleeping":return"mdi:sleep";case"initializing":return"mdi:timer-sand";default:return"mdi:z-wave"}case"sensor":{const e=Eb(t);if(e)return e;break}case"input_datetime":if(!t?.attributes.has_date)return"mdi:clock";if(!t.attributes.has_time)return"mdi:calendar";break;case"sun":return"above_horizon"===t?.state?Ab[e]:"mdi:weather-night";case"update":return"on"===t?.state?yb(t)?"mdi:package-down":"mdi:package-up":"mdi:package"}return e in Ab?Ab[e]:a??$b}async function Ib(e,t,n){const a={type:"auth/sign_path",path:t,expires:n},i=await $v(e,Os,a);return i?e.hassUrl(i.path):null}function Tb(e,t,n,a){if(!e||!n||!n.length)return[];const i=[];for(const r of n){const n=t?.states[r],o=e.states[r];if((a?.stateOnly&&n?.state!==o?.state||!a?.stateOnly&&n!==o)&&(i.push({entityID:r,oldState:n,newState:o}),a?.firstOnly))break}return i}function jb(e,t,n,a){return!!Tb(e,t,n,{...a,firstOnly:!0}).length}function Ob(e){if("off"===e.state||!e.attributes.brightness)return"";return`brightness(${(e.attributes.brightness+245)/5}%)`}function Db(e){return"off"===e.state?"":e.attributes.rgb_color?`rgb(${e.attributes.rgb_color.join(",")})`:""}function Rb(e){return{color:Db(e),filter:Ob(e)}}function Pb(e,t){if(!t.entity)return t;const n=e.states[t.entity];n&&t.state_color&&(t.style={...Rb(n),...t.style}),t.title=t.title??(n?.attributes?.friendly_name||t.entity),t.icon=t.icon??Nb(e,t.entity);const a=n?function(e){return Ye(e.entity_id)}(n):void 0;return t.data_domain=t.state_color||"light"===a&&!1!==t.state_color?a:void 0,n&&(t.data_state=(e=>{const t=e.entity_id.split(".")[0];let n=e.state;return"climate"===t&&(n=e.attributes.hvac_action),n})(n)),t}function Lb(e,t){return t?e?.states[t]?.attributes?.friendly_name:void 0}function Nb(e,t,n){const a=e.states[t];return a&&a.attributes.icon?a.attributes.icon:zb(Ye(t),a,a?.state,n)}const Fb=async()=>{if(["ha-button-menu","ha-button","ha-camera-stream","ha-card","ha-circular-progress","ha-hls-player","ha-icon-button","ha-icon","ha-menu-button","ha-selector","ha-web-rtc-player"].every((e=>customElements.get(e))))return!0;const e=await window.loadCardHelpers();await e.createCardElement({type:"picture-glance",entities:[],camera_image:"dummy-to-load-editor-components"}),await customElements.whenDefined("hui-picture-glance-card");const t=customElements.get("hui-picture-glance-card");if(!t)return!1;const n=new t;return await n.constructor.getConfigElement(),!0},Vb=e=>!!e&&["on","open"].includes(e),Hb=(e,t)=>{if(!e)return[];const n=Object.keys(e.states).filter((e=>!t||e.substr(0,e.indexOf("."))===t));return n.sort(),n};function Bb(e){return!!e?.startsWith("/")}function qb(e,t){return Bb(t)?e.hassUrl(t):t??null}class Ub{constructor(){this._initialized=new Set}async initializeMultipleIfNecessary(e){return(await tf(Object.entries(e),(async([e,t])=>await this.initializeIfNecessary(e,t)))).every(Boolean)}async initializeIfNecessary(e,t){return!!this._initialized.has(e)||(t?!!await t()&&(this._initialized.add(e),!0):(this._initialized.add(e),!0))}uninitialize(e){this._initialized.delete(e)}isInitialized(e){return this._initialized.has(e)}isInitializedMultiple(e){return e.every((e=>this.isInitialized(e)))}}var Wb;!function(e){e.LANGUAGES="languages",e.SIDE_LOAD_ELEMENTS="side-load-elements",e.CAMERAS="cameras",e.MICROPHONE_CONNECT="microphone-connect",e.VIEW="view"}(Wb||(Wb={}));class Zb{constructor(e,t){this._initializationQueue=new w_({concurrency:1}),this._everInitialized=!1,this._api=e,this._initializer=t??new Ub}wasEverInitialized(){return this._everInitialized}isInitializedMandatory(){return!!this._api.getConfigManager().getConfig()&&this._initializer.isInitializedMultiple([Wb.LANGUAGES,Wb.SIDE_LOAD_ELEMENTS,Wb.CAMERAS,...this._api.getMicrophoneManager().shouldConnectOnInitialization()?[Wb.MICROPHONE_CONNECT]:[],Wb.VIEW])}async initializeMandatory(){await this._initializationQueue.add((()=>this._initializeMandatory()))}async _initializeMandatory(){const e=this._api.getHASSManager().getHASS();if(!e||this.isInitializedMandatory())return;if(!await this._initializer.initializeMultipleIfNecessary({[Wb.LANGUAGES]:async()=>await(async e=>{const t=F_(e);return"ca"===t?L_[t]=await import("./lang-ca-449daa4a.js"):"it"===t?L_[t]=await import("./lang-it-2a20a319.js"):"pt"===t?L_[t]=await import("./lang-pt-PT-c4863423.js"):"pt_BR"===t?L_[t]=await import("./lang-pt-BR-83a703b9.js"):"fr"===t&&(L_[t]=await import("./lang-fr-674e5de5.js")),t&&(N_=t),!0})(e),[Wb.SIDE_LOAD_ELEMENTS]:async()=>await Fb()}))return;this._api.getConfigManager().getConfig()&&await this._initializer.initializeMultipleIfNecessary({[Wb.CAMERAS]:async()=>await this._api.getCameraManager().initializeCamerasFromConfig(),...this._api.getMicrophoneManager().shouldConnectOnInitialization()&&{[Wb.MICROPHONE_CONNECT]:async()=>await this._api.getMicrophoneManager().connect()}})&&!this._api.getMessageManager().hasMessage()&&await this._initializer.initializeIfNecessary(Wb.VIEW,this._api.getViewManager().initialize)&&(this._everInitialized=!0,this._api.getCardElementManager().update())}uninitialize(e){this._initializer.uninitialize(e)}}class Qb{constructor(e,t,n,a){this.update=()=>{this._element.requestUpdate()},this._api=e,this._element=t,this._scrollCallback=n,this._menuToggleCallback=a}getElement(){return this._element}scrollReset(){this._scrollCallback()}toggleMenu(){this._menuToggleCallback()}hasUpdated(){return this._element.hasUpdated}elementConnected(){this._api.getInteractionManager().initialize(),this._api.getFullscreenManager().initialize(),this._api.getExpandManager().initialize(),this._api.getMediaLoadedInfoManager().initialize(),this._api.getMicrophoneManager().initialize(),this._api.getKeyboardStateManager().initialize(),this._api.getDefaultManager().initialize(),this._api.getMediaPlayerManager().initialize(),this._api.getHASSManager().getStateWatcher()?.subscribe(this.update,[...this._api.getConfigManager().getConfig()?.view.render_entities??[],...this._api.getMediaPlayerManager().getMediaPlayers()??[]]),of(this._element,(e=>{const t=e.getRootNode();return!!(t&&t instanceof ShadowRoot&&"HUI-PANEL-VIEW"===t.host.tagName)})(this._element),"panel"),of(this._element,!0,"tabindex","0"),this._api.getFullscreenManager().connect(),this._element.addEventListener("mousemove",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("wheel",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("ll-custom",this._api.getActionsManager().handleCustomActionEvent),this._element.addEventListener("action",this._api.getActionsManager().handleInteractionEvent),this._element.addEventListener("action",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("frigate-card:action:execution-request",this._api.getActionsManager().handleActionExecutionRequestEvent),window.addEventListener("location-changed",this._api.getQueryStringManager().requestExecution),window.addEventListener("popstate",this._api.getQueryStringManager().requestExecution),this._api.getQueryStringManager().requestExecution(),this._element.requestUpdate()}elementDisconnected(){of(this._element,!1,"panel"),of(this._element,!1,"tabindex"),this._api.getMediaLoadedInfoManager().clear(),this._api.getFullscreenManager().disconnect(),this._api.getKeyboardStateManager().uninitialize(),this._api.getActionsManager().uninitialize(),this._api.getDefaultManager().uninitialize(),this._api.getHASSManager().getStateWatcher()?.unsubscribe(this.update),this._api.getInitializationManager().uninitialize(Wb.CAMERAS),this._api.getCameraManager().reset(),this._element.removeEventListener("mousemove",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("wheel",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("ll-custom",this._api.getActionsManager().handleCustomActionEvent),this._element.removeEventListener("action",this._api.getActionsManager().handleInteractionEvent),this._element.removeEventListener("action",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("frigate-card:action:execution-request",this._api.getActionsManager().handleActionExecutionRequestEvent),window.removeEventListener("location-changed",this._api.getQueryStringManager().requestExecution),window.removeEventListener("popstate",this._api.getQueryStringManager().requestExecution)}}function Gb(e,t,n){return null==e?e:function(e,t,n,a){if(!hh(e))return e;for(var i=-1,r=(t=sv(t,e)).length,o=r-1,s=e;null!=s&&++i{Gb(e,t,n)},Xb=(e,t,n)=>fv(e,t,n),Jb=(e,t)=>{!function(e,t){null==e||Yb(e,t)}(e,t)},ew=e=>u_(e),tw=(e,t)=>e.replace("#",`[${t.toString()}]`),nw=function(e){let t=!1;for(let n=0;n{const i=Xb(e,t);if(void 0===i)return!1;const r=a?.transform?a.transform(i):i;return!(t===n&&Dv(i,r)||(null===r?a?.keepOriginal||(Jb(e,t),0):void 0===r||(a?.keepOriginal||Jb(e,t),Kb(e,n,r),0)))})(a,e,t,n)}},rw=function(e,t,n){return function(a){let i=iw(e,t,n)(a);return i=cw(bs,iw(e,t,n),(e=>e.overrides))(a)||i,i}},ow=function(e,t){return rw(e,e,{transform:t})},sw=function(e){return rw(e,e,{transform:e=>null})},cw=function(e,t,n){return function(a){let i=!1;const r=Xb(a,e);return Array.isArray(r)&&r.forEach((e=>{const a=n?n(e):e;a&&"object"==typeof a&&(i=t(a)||i)})),i}},lw=(e,t)=>{const n=a=>{let i=!1;if(a&&"object"==typeof a){const r=t?t(a):a;r&&(i=e(r)||i),Array.isArray(a)?a.forEach((e=>{i=n(e)||i})):Object.keys(a).forEach((e=>{i=n(a[e])||i}))}return i};return n},dw=e=>!("object"!=typeof e||!e||void 0===e.mediaLoaded)&&(e.media_loaded=e.mediaLoaded,delete e.mediaLoaded,!0),uw=e=>{if("object"!=typeof e||!e||"object"!=typeof e.conditions||!e.conditions)return!1;const t=e.conditions,n=[];if(void 0!==t.view&&n.push({condition:"view",views:t.view}),void 0!==t.fullscreen&&n.push({condition:"fullscreen",fullscreen:t.fullscreen}),void 0!==t.expand&&n.push({condition:"expand",expand:t.expand}),void 0!==t.camera&&n.push({condition:"camera",cameras:t.camera}),void 0!==t.media_loaded&&n.push({condition:"media_loaded",media_loaded:t.media_loaded}),void 0!==t.state&&Array.isArray(t.state))for(const e of t.state)"object"!=typeof e||!e||void 0===e.state&&void 0===e.state_not&&void 0===e.entity||n.push({condition:"state",...e.state&&{state:e.state},...e.state_not&&{state_not:e.state_not},...e.entity&&{entity:e.entity}});return void 0!==t.media_query&&n.push({condition:"screen",media_query:t.media_query}),!!n.length&&(e.conditions=n,!0)},hw=e=>!("object"!=typeof e||!e||"call-service"!==e.action||"string"!=typeof e.service)&&(e.action="perform-action",e.perform_action=e.service,delete e.service,!0),pw=e=>!("object"!=typeof e||!e||"call-service"!==e.action||void 0===e.service||void 0===e.service_data||void 0!==e.data)&&(e.data=e.service_data,delete e.service_data,!0),mw=e=>!("object"!=typeof e||!e||"custom:frigate-card-action"!==e.action||"frigate_ui"!==e.frigate_card_action)&&(e.frigate_card_action="camera_ui",!0),gw=[cw(bs,dw,(e=>e.conditions)),e=>lw(dw,(e=>e.conditions))("object"==typeof e&&e?e[Ii]:{}),rw("event_gallery",or),rw("menu.buttons.frigate_ui",is),e=>lw(mw)("object"==typeof e&&e?e:{}),cw(Ca,ow("live_provider",(e=>"frigate-jsmpeg"===e?"jsmpeg":e))),rw("live.jsmpeg",ki),rw("live.image",Ci),rw("live.webrtc_card",Si),cw(Ca,rw("frigate.zone","frigate.zones",{transform:e=>Wg(e)})),cw(Ca,rw("frigate.label","frigate.labels",{transform:e=>Wg(e)})),e=>lw(pw)("object"==typeof e&&e?e:{}),function(e){if("object"!=typeof e||!e||!(Ii in e)||!Array.isArray(e[Ii]))return!1;let t=!1;const n=n=>{if(!t){if(!fv(e,"live.controls.ptz")){const{type:t,...a}=n;Gb(e,"live.controls.ptz",a)}t=!0}},a=e=>{const t=[];for(const i of e)if("custom:frigate-card-ptz"===i.type)n(i);else if("conditional"!==i.type&&"custom:frigate-card-conditional"!==i.type||!Array.isArray(i.elements))t.push(i);else{const e=a(i.elements);e.length&&(i.elements=e,t.push(i))}return t},i=a(e[Ii]);return t&&(i.length?e[Ii]=i:delete e[Ii]),t},rw("view.timeout_seconds",Ri),ow("live.lazy_unload",(e=>"all"===e?["unselected","hidden"]:"never"===e?null:Wg(e))),ow("live.auto_play",(e=>"all"===e?null:"never"===e?[]:Wg(e))),ow("live.auto_pause",(e=>"all"===e?["unselected","hidden"]:"never"===e?null:Wg(e))),ow("live.auto_mute",(e=>"all"===e?null:"never"===e?[]:Wg(e))),ow("live.auto_unmute",(e=>"all"===e?["selected","visible","microphone"]:"never"===e?null:Wg(e))),ow("media_viewer.auto_play",(e=>"all"===e?null:"never"===e?[]:Wg(e))),ow("media_viewer.auto_pause",(e=>"all"===e?null:"never"===e?[]:Wg(e))),ow("media_viewer.auto_mute",(e=>"all"===e?null:"never"===e?[]:Wg(e))),ow("media_viewer.auto_unmute",(e=>"all"===e?["selected","visible"]:"never"===e?null:Wg(e))),rw("live.controls.thumbnails.media",io),rw("timeline.media",Ho),rw("live.controls.timeline.media",po),rw("media_viewer.controls.timeline.media",Rr),rw("view.scan",Xi),rw("view.triggers.enabled",ar,{transform:e=>!0===e?"live":null,keepOriginal:!0}),rw("view.triggers.enabled",er,{transform:e=>!0!==e&&null}),rw("view.triggers.untrigger_reset",ir,{transform:e=>e?"default":null}),rw("live.layout",Ai),sw("media_viewer.layout"),sw("image.layout"),cw(bs,uw),e=>lw(uw)("object"==typeof e&&e?e[Ii]:{}),e=>lw(uw)("object"==typeof e&&e?e.automations:{}),cw(Ca,rw("hide","capabilities",{transform:e=>!0===e?{disable_except:["substream"]}:null})),rw("performance.profile",$s,{transform:e=>"low"===e?["low-performance"]:null}),cw(bs,iw("overrides","merge")),rw("live.controls.ptz",zi,{transform:e=>{if("object"!=typeof e||!e)return;const t=["data_left","data_right","data_up","data_down","data_zoom_in","data_zoom_out","service"],n=["actions_left","actions_right","actions_up","actions_down","actions_zoom_in","actions_zoom_out"],a=[...t,...n,"data_home","actions_home"];if(!Object.keys(e).some((e=>a.includes(e))))return;const i={};t.filter((t=>t in e)).reduce(((t,n)=>(t[n]=e[n],t)),i),n.filter((t=>t in e)).reduce(((t,n)=>("object"==typeof e[n]&&"tap_action"in e[n]&&(t[n]=e[n].tap_action),t)),i);const r=()=>{i.presets="presets"in e&&"object"==typeof e.presets&&e.presets?e.presets:{}};return"actions_home"in e&&"object"==typeof e.actions_home&&e.actions_home&&"tap_action"in e.actions_home?(r(),i.presets.home=e.actions_home.tap_action):"data_home"in e&&"object"==typeof e.data_home&&e.data_home&&"string"==typeof e.service&&(r(),i.presets.service=e.service,i.presets.data_home=e.data_home),i},keepOriginal:!0}),ow("live.controls.ptz",(e=>{if("object"!=typeof e||!e)return e;const t=["mode","position","orientation","hide_pan_tilt","hide_zoom","hide_home","style"],n=Object.keys(e);return n.some((e=>!t.includes(e)))?n.filter((e=>t.includes(e))).reduce(((t,n)=>(t[n]=e[n],t)),{}):void 0})),rw("view.update_cycle_camera",Wi),rw("view.update_force",Qi,{transform:e=>!0===e?"all":null}),rw("view.update_seconds",Gi),rw("view.update_entities",Yi),iw("live.controls.title",ds,{transform:e=>"object"==typeof e&&e&&"string"==typeof e.mode?"none"===e.mode?{style:"none"}:e.mode.includes("bottom")?{position:"bottom"}:e.mode.includes("top")?{position:"top"}:null:null}),sw("live.controls.title"),sw("media_viewer.controls.title"),e=>lw(hw)("object"==typeof e&&e?e:{}),rw("dimensions.max_height",ys),sw("dimensions.min_height")];class fw extends zs{}class _w extends Event{constructor(e,t){super("frigate-card:conditions:evaluate",t),this.conditions=e}}function vw(e,t,n){let a=ew(t),i=!1;if(n?.configOverrides)for(const t of n.configOverrides)e.evaluateConditions(t.conditions,n?.stateOverrides)&&(t.delete?.forEach((e=>{Jb(a,e)})),Object.keys(t.set??{}).forEach((e=>{Kb(a,e,t.set?.[e])})),Object.keys(t.merge??{}).forEach((e=>{Kb(a,e,Ly({},Xb(a,e),t.merge?.[e]))})),i=!0);if(!i)return t;if(n?.configOverrides?.some((e=>e.delete?.length))&&(a=hf(a)),n?.schema){const e=n.schema.safeParse(a);if(!e.success)throw new fw(V_("error.invalid_configuration_override"),[e.error.errors,a]);return e.data}return a}class yw{constructor(e,t){this._state={},this._epoch=this._createEpoch(),this._hasHAStateConditions=!1,this._mediaQueries=[],this._mediaQueryTrigger=()=>this._triggerChange(),this._api=e,this._listeners=[()=>this._api.getConfigManager().computeOverrideConfig(),()=>this._api.getAutomationsManager().execute(),...t?[t]:[]]}removeConditions(){this._mediaQueries.forEach((e=>e.removeEventListener("change",this._mediaQueryTrigger))),this._mediaQueries=[]}setConditionsFromConfig(){this.removeConditions();const e=(()=>{const e=this._api.getConfigManager().getConfig(),t=[];e?.overrides?.forEach((e=>t.push(...e.conditions))),e?.automations?.forEach((e=>t.push(...e.conditions)));const n=e=>{const a=vl.safeParse(e);a.success?(t.push(...a.data.conditions),a.data.elements?.forEach(n)):e&&"object"==typeof e&&Object.keys(e).forEach((t=>n(e[t])))};return e?.elements?.forEach(n),t})();this._hasHAStateConditions=e.some((e=>!e.condition||["state","numeric_state","user"].includes(e.condition))),e.forEach((e=>{if("screen"===e.condition){const t=window.matchMedia(e.media_query);t.addEventListener("change",this._mediaQueryTrigger),this._mediaQueries.push(t)}}))}setState(e){Object.keys(e).every((t=>Dv(e[t],this._state[t])))||(this._state={...this._state,...e},this._triggerChange())}getState(){return this._state}hasHAStateConditions(){return this._hasHAStateConditions}getEpoch(){return this._epoch}evaluateConditions(e,t){return e.every((e=>this._evaluateCondition(e,t)))}_evaluateCondition(e,t){const n={...this._state,...t};switch(e.condition){case void 0:case"state":return!!n.state&&(!e.state&&!e.state_not||e.entity in n.state&&(!e.state||(Array.isArray(e.state)?e.state.includes(n.state[e.entity].state):e.state===n.state[e.entity].state))&&(!e.state_not||(Array.isArray(e.state_not)?!e.state_not.includes(n.state[e.entity].state):e.state_not!==n.state[e.entity].state)));case"view":return!!n?.view&&e.views.includes(n.view);case"fullscreen":return void 0!==n.fullscreen&&e.fullscreen===n.fullscreen;case"expand":return void 0!==n.expand&&e.expand===n.expand;case"camera":return!!n.camera&&e.cameras.includes(n.camera);case"numeric_state":return!!n.state&&e.entity in n.state&&void 0!==n.state[e.entity].state&&(void 0===e.above||Number(n.state[e.entity].state)>e.above)&&(void 0===e.below||Number(n.state[e.entity].state)n.triggered?.has(e)));case"interaction":return void 0!==n.interaction&&e.interaction===n.interaction;case"microphone":return!(void 0!==e.connected&&n.microphone?.connected!==e.connected||void 0!==e.muted&&n.microphone?.muted!==e.muted);case"key":return!(!n.keys||!(e.key in n.keys)||(e.state??"down")!==n.keys[e.key].state||void 0!==e.ctrl&&e.ctrl!==!!n.keys[e.key].ctrl||void 0!==e.alt&&e.alt!==!!n.keys[e.key].alt||void 0!==e.meta&&e.meta!==!!n.keys[e.key].meta||void 0!==e.shift&&e.shift!==!!n.keys[e.key].shift)}}_createEpoch(){return{manager:this}}_triggerChange(){this._epoch=this._createEpoch(),this._listeners.forEach((e=>e()))}}const bw={casting:{[Qr]:!1,[Sr]:!1,[es]:"none",[`${os}.enabled`]:!0,[`${ss}.enabled`]:!0,[`${rs}.enabled`]:!1,[`${cs}.enabled`]:!1,[Zr]:["selected","visible"],[vs]:"static",[_s]:"16:9",[$i]:1,[$o]:!0},"low-performance":{[ro]:"none",[Ar]:"none",[Uo]:"none",[fo]:!1,[Nr]:!1,[Bo]:!1,[Wr]:[],[mr]:[],[gr]:[],[fr]:[],[ko]:["unselected","hidden"],[Co]:!1,[xr]:!1,[Eo]:"none",[kr]:"none",[$o]:!1,[Er]:"chevrons",[hs]:"none",[es]:"outside",[`${as}.enabled`]:!1,[`${ls}.enabled`]:!1,[`${ls}.enabled`]:!1,[`${cs}.enabled`]:!1,[lr]:!1,[dr]:!1,[ur]:!1,[cr]:!1,[co]:!1,[lo]:!1,[uo]:!1,[so]:!1,[Ir]:!1,[Tr]:!1,[jr]:!1,[zr]:!1,[Qo]:!1,[Go]:!1,[Yo]:!1,[Zo]:!1,[xs]:!1,[Cs]:10,[Es]:!1,[Ss]:!1,[Mr]:!1,[Ei]:!1,[Mi]:"image",[$i]:10,[ar]:"none",[Ms]:1},scrubbing:{[mo]:"below",[_o]:"ribbon",[go]:"seek",[Pr]:"below",[Fr]:"ribbon",[Lr]:"seek"}},ww=(e,t,n)=>{const a=Ds(Nd).safeParse(e);if(!a.success)return t;const i=a.data;for(const e of n??[])e in bw&&Object.entries(bw[e]).forEach((([e,n])=>{return r=n,void(void 0===Xb(i,a=e)&&Kb(t,a,r));var a,r}));return t},xw=e=>{switch(e){case"ptz_left":return"left";case"ptz_right":return"right";case"ptz_up":return"up";case"ptz_down":return"down";case"ptz_zoom_in":return"zoom_in";case"ptz_zoom_out":return"zoom_out"} +/* istanbul ignore next: No (current) way to reach this code -- @preserve */return null},Cw=(e,t)=>{if(!t.enabled)return[];const n=[];for(const a of["ptz_down","ptz_left","ptz_right","ptz_up","ptz_zoom_in","ptz_zoom_out"]){const i=t[a],r=xw(a);i&&r&&(n.push({conditions:[{condition:"key",key:i.key,state:"down",shift:i.shift,ctrl:i.ctrl,alt:i.alt,meta:i.meta}],actions:[vf({ptzAction:r,ptzPhase:"start"})],tag:e}),n.push({conditions:[{condition:"key",key:i.key,state:"up"}],actions:[vf({ptzAction:r,ptzPhase:"stop"})],tag:e}))}const a=t.ptz_home;return a&&n.push({conditions:[{condition:"key",key:a.key,state:"down",shift:a.shift,ctrl:a.ctrl,alt:a.alt,meta:a.meta}],actions:[vf()],tag:e}),n};class Mw{constructor(e){this._config=null,this._overriddenConfig=null,this._rawConfig=null,this._cardWideConfig=null,this._api=e}hasConfig(){return!!this.getConfig()}getConfig(){return this._overriddenConfig??this._config}getCardWideConfig(){return this._cardWideConfig}getNonOverriddenConfig(){return this._config}getRawConfig(){return this._rawConfig}setConfig(e){if(!e)throw new Error(V_("error.invalid_configuration"));const t=Nd.safeParse(e);if(!t.success){const n=aw(e),a=Ps(t.error);let i="";throw n&&(i=`${V_("error.upgrade_available")}. `),new Error(i+`${V_("error.invalid_configuration")}: `+(a&&a.size?JSON.stringify([...a],null," "):V_("error.invalid_configuration_no_hint")))}const n=ww(e,t.data,t.data.profiles);var a;(this._rawConfig=e,Dv(this._config,n))||(this._config=n,this._cardWideConfig={performance:n.performance,debug:n.debug},this._api.getConditionsManager().setConditionsFromConfig(),this._api.getConditionsManager().setState({view:void 0,displayMode:void 0,camera:void 0}),this._api.getMediaLoadedInfoManager().clear(),this._api.getInitializationManager().uninitialize(Wb.VIEW),this._api.getViewManager().reset(),this._api.getMessageManager().reset(),this._api.getStyleManager().setPerformance(),this._api.getStatusBarItemManager().removeAllDynamicStatusBarItems(),((e,t)=>{e.getAutomationsManager().deleteAutomations(t);const n=e.getConfigManager().getConfig()?.view.keyboard_shortcuts;if(!n)return;const a=Cw(t,n);a.length&&e.getAutomationsManager().addAutomations(a)})(this._api,this),(a=this._api).getAutomationsManager().deleteAutomations(),a.getAutomationsManager().addAutomations(a.getConfigManager().getNonOverriddenConfig()?.automations??[]),this.computeOverrideConfig(),this._api.getCardElementManager().update())}computeOverrideConfig(){const e=this._api.getConditionsManager();if(!this._config)return;let t=null;try{t=vw(e,this._config,{configOverrides:this._config.overrides,schema:Nd})}catch(e){return void this._api.getMessageManager().setErrorIfHigherPriority(e)}if(Dv(t,this._overriddenConfig))return;const n=this._overriddenConfig;this._overriddenConfig=t,this._api.getStyleManager().setMinMaxHeight(),!n||Dv(n?.cameras,this._overriddenConfig?.cameras)&&Dv(n?.cameras_global,this._overriddenConfig?.cameras_global)||this._api.getInitializationManager().uninitialize(Wb.CAMERAS),n&&n?.live.microphone.always_connected!==this._overriddenConfig?.live.microphone.always_connected&&this._api.getInitializationManager().uninitialize(Wb.MICROPHONE_CONNECT),this._initializeBackground(n)}async _initializeBackground(e){await this._api.getDefaultManager().initializeIfNecessary(e),await this._api.getMediaPlayerManager().initializeIfNecessary(e),this._api.getCardElementManager().update()}}class kw{constructor(e){this._timer=new xf,this._stateChangeHandler=()=>{this._setToDefaultIfAllowed()},this._api=e}async initializeIfNecessary(e){Dv(e?.view.default_reset,this._api.getConfigManager().getConfig()?.view.default_reset)||await this.initialize()}async initialize(){this.uninitialize();const e=this._api.getConfigManager().getConfig()?.view.default_reset;e?.entities.length&&this._api.getHASSManager().getStateWatcher().subscribe(this._stateChangeHandler,e.entities);const t=this._api.getConfigManager().getConfig()?.view.default_reset.every_seconds;return t&&this._timer.startRepeated(t,(()=>this._setToDefaultIfAllowed())),this._api.getConfigManager().getConfig()?.view.default_reset.after_interaction&&this._api.getAutomationsManager().addAutomations([{actions:[gf("default")],conditions:[{condition:"interaction",interaction:!1}],tag:this}]),!0}uninitialize(){this._timer.stop(),this._api.getHASSManager().getStateWatcher().unsubscribe(this._stateChangeHandler),this._api.getAutomationsManager().deleteAutomations(this)}_setToDefaultIfAllowed(){this._isAutomatedUpdateAllowed()&&this._api.getViewManager().setViewDefault()}_isAutomatedUpdateAllowed(){const e=this._api.getConfigManager().getConfig()?.view.default_reset.interaction_mode;return!!e&&((e,t)=>{switch(e){case"all":return!0;case"active":return t;case"inactive":return!t}})(e,this._api.getInteractionManager().hasInteraction())}}const Sw=(e,t="download")=>{const n=new URL(e).origin===window.location.origin,a=e.startsWith("data:");if(navigator.userAgent.startsWith("Home Assistant/")||navigator.userAgent.startsWith("HomeAssistant/")||!n&&!a)window.open(e,"_blank");else{const n=document.createElement("a");n.setAttribute("download",t),n.href=e,n.click(),n.remove()}},Ew=async(e,t,n)=>{const a=await t.getMediaDownloadPath(n);if(!a)throw new zs(V_("error.download_no_media"));let i=a.endpoint;if(a.sign){let t;try{t=await Ib(e,a.endpoint)}catch(e){Gg(e)}if(!t)throw new zs(V_("error.download_sign_failed"));i=t}Sw(i)},$w=e=>{const t=document.createElement("canvas");t.width=e.videoWidth,t.height=e.videoHeight;const n=t.getContext("2d");return n?(n.drawImage(e,0,0,t.width,t.height),t.toDataURL("image/jpeg")):null};class Aw{constructor(e){this._api=e}async downloadViewerMedia(){const e=this._api.getViewManager().getView()?.queryResults?.getSelectedResult(),t=this._api.getHASSManager().getHASS();if(!e||!t)return!1;try{await Ew(t,this._api.getCameraManager(),e)}catch(e){return this._api.getMessageManager().setErrorIfHigherPriority(e),!1}return!0}async downloadScreenshot(){const e=await(this._api.getMediaLoadedInfoManager().get()?.player?.getScreenshotURL());e&&Sw(e,(e=>{if(e?.is("live")||e?.is("image"))return`${e.view}-${e.camera}-${Wu(new Date,"yyyy-MM-dd-HH-mm-ss")}.jpg`;if(e?.isViewerView()){const t=e.queryResults?.getSelectedResult(),n=t?.getID()??null;return`${e.view}-${e.camera}${n?`-${n}`:""}.jpg`}return"screenshot.jpg"})(this._api.getViewManager().getView()))}}class zw{constructor(e){this._expanded=!1,this._api=e}initialize(){this._setConditionState()}isExpanded(){return this._expanded}toggleExpanded(){this.setExpanded(!this._expanded)}setExpanded(e){e&&this._api.getFullscreenManager().isInFullscreen()&&this._api.getFullscreenManager().stopFullscreen(),this._expanded=e,this._setConditionState(),this._api.getCardElementManager().update()}_setConditionState(){this._api.getConditionsManager()?.setState({expand:this._expanded})}}const Iw=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],Tw=(()=>{if("undefined"==typeof document)return!1;const e=Iw[0],t={};for(const n of Iw){const a=n?.[1];if(a in document){for(const[a,i]of n.entries())t[e[a]]=i;return t}}return!1})(),jw={change:Tw.fullscreenchange,error:Tw.fullscreenerror};let Ow={request:(e=document.documentElement,t)=>new Promise(((n,a)=>{const i=()=>{Ow.off("change",i),n()};Ow.on("change",i);const r=e[Tw.requestFullscreen](t);r instanceof Promise&&r.then(i).catch(a)})),exit:()=>new Promise(((e,t)=>{if(!Ow.isFullscreen)return void e();const n=()=>{Ow.off("change",n),e()};Ow.on("change",n);const a=document[Tw.exitFullscreen]();a instanceof Promise&&a.then(n).catch(t)})),toggle:(e,t)=>Ow.isFullscreen?Ow.exit():Ow.request(e,t),onchange(e){Ow.on("change",e)},onerror(e){Ow.on("error",e)},on(e,t){const n=jw[e];n&&document.addEventListener(n,t,!1)},off(e,t){const n=jw[e];n&&document.removeEventListener(n,t,!1)},raw:Tw};Object.defineProperties(Ow,{isFullscreen:{get:()=>Boolean(document[Tw.fullscreenElement])},element:{enumerable:!0,get:()=>document[Tw.fullscreenElement]??void 0},isEnabled:{enumerable:!0,get:()=>Boolean(document[Tw.fullscreenEnabled])}}),Tw||(Ow={isEnabled:!1});var Dw=Ow;class Rw{constructor(e){this._fullscreenHandler=()=>{this._api.getExpandManager().setExpanded(!1),this._setConditionState(),this._api.getCardElementManager().update()},this._api=e}initialize(){this._setConditionState()}connect(){Dw.isEnabled&&Dw.on("change",this._fullscreenHandler)}disconnect(){Dw.isEnabled&&Dw.off("change",this._fullscreenHandler)}isInFullscreen(){return Dw.isEnabled&&Dw.isFullscreen}toggleFullscreen(){Dw.toggle(this._api.getCardElementManager().getElement())}stopFullscreen(){Dw.exit()}_setConditionState(){this._api.getConditionsManager()?.setState({fullscreen:this.isInFullscreen()})}}class Pw{constructor(){this._watcherCallbacks=new Map}setHASS(e,t){if(e)for(const[n,a]of this._watcherCallbacks.entries()){const i=Tb(t,e,a,{stateOnly:!0,firstOnly:!0});i.length&&n(i[0])}}subscribe(e,t){return!!t.length&&(this._watcherCallbacks.has(e)?this._watcherCallbacks.get(e)?.push(...t):this._watcherCallbacks.set(e,t),!0)}unsubscribe(e){this._watcherCallbacks.delete(e)}}class Lw{constructor(e){this._hass=null,this._stateWatcher=new Pw,this._api=e}getHASS(){return this._hass}hasHASS(){return!!this._hass}getStateWatcher(){return this._stateWatcher}setHASS(e){if(((e,t)=>e?.connected!==t?.connected)(this._hass,e)&&(e?.connected?this._api.getMessageManager().resetType("connection"):this._api.getMessageManager().setMessageIfHigherPriority({message:V_("error.reconnecting"),icon:"mdi:lan-disconnect",type:"connection",dotdotdot:!0})),!e)return;const t=this._hass;this._hass=e,this._api.getConditionsManager().hasHAStateConditions()&&this._api.getConditionsManager().setState({state:this._hass.states,user:this._hass.user}),this._api.getStyleManager().setLightOrDarkMode(),this._stateWatcher.setHASS(t,e)}}var Nw=function(){return th.Date.now()},Fw="Expected a function",Vw=Math.max,Hw=Math.min;function Bw(e,t,n){var a,i,r,o,s,c,l=0,d=!1,u=!1,h=!0;if("function"!=typeof e)throw new TypeError(Fw);function p(t){var n=a,r=i;return a=i=void 0,l=t,o=e.apply(r,n)}function m(e){var n=e-c;return void 0===c||n>=t||n<0||u&&e-l>=r}function g(){var e=Nw();if(m(e))return f(e);s=setTimeout(g,function(e){var n=t-(e-c);return u?Hw(n,r-(e-l)):n}(e))}function f(e){return s=void 0,h&&a?p(e):(a=i=void 0,o)}function _(){var e=Nw(),n=m(e);if(a=arguments,i=this,c=e,n){if(void 0===s)return function(e){return l=e,s=setTimeout(g,t),d?p(e):o}(c);if(u)return clearTimeout(s),s=setTimeout(g,t),p(c)}return void 0===s&&(s=setTimeout(g,t)),o}return t=Cg(t)||0,hh(n)&&(d=!!n.leading,r=(u="maxWait"in n)?Vw(Cg(n.maxWait)||0,t):r,h="trailing"in n?!!n.trailing:h),_.cancel=function(){void 0!==s&&clearTimeout(s),l=0,a=c=i=s=void 0},_.flush=function(){return void 0===s?o:f(Nw())},_}function qw(e,t,n){var a=!0,i=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return hh(n)&&(a="leading"in n?!!n.leading:a,i="trailing"in n?!!n.trailing:i),Bw(e,t,{leading:a,maxWait:t,trailing:i})}class Uw{constructor(e){this._timer=new xf,this.reportInteraction=qw((()=>{this._reportInteraction()}),1e3),this._api=e}initialize(){this._api.getConditionsManager().setState({interaction:!1})}hasInteraction(){return this._timer.isRunning()}_reportInteraction(){this._timer.stop();const e=this._api.getConfigManager().getConfig()?.view.interaction_seconds;e&&(this._api.getConditionsManager().setState({interaction:!0}),this._timer.start(e,(()=>{this._api.getConditionsManager().setState({interaction:!1}),this._api.getStyleManager().setLightOrDarkMode()})))}}class Ww{constructor(e){this._state={},this._handleKeydown=e=>{const t={state:"down",ctrl:e.ctrlKey,alt:e.altKey,meta:e.metaKey,shift:e.shiftKey};Dv(this._state[e.key],t)||(this._state[e.key]=t,this._processStateChange())},this._handleKeyup=e=>{e.key in this._state&&"down"===this._state[e.key].state&&(this._state[e.key].state="up",this._processStateChange())},this._handleBlur=()=>{Object.keys(this._state).length&&(this._state={},this._processStateChange())},this._api=e}initialize(){const e=this._api.getCardElementManager().getElement();e.addEventListener("keydown",this._handleKeydown),e.addEventListener("keyup",this._handleKeyup),e.addEventListener("blur",this._handleBlur)}uninitialize(){const e=this._api.getCardElementManager().getElement();e.removeEventListener("keydown",this._handleKeydown),e.removeEventListener("keyup",this._handleKeyup),e.removeEventListener("blur",this._handleBlur)}_processStateChange(){this._api.getConditionsManager().setState({keys:this._state})}}function Zw(e,t){let n;return n=e instanceof Event?e.composedPath()[0]:e,n instanceof HTMLImageElement?{width:n.naturalWidth,height:n.naturalHeight,...t}:n instanceof HTMLVideoElement?{width:n.videoWidth,height:n.videoHeight,...t}:n instanceof HTMLCanvasElement?{width:n.width,height:n.height,player:t?.player,...t}:null}function Qw(e,t,n){const a=Zw(t,n);a&&Gw(e,a)}function Gw(e,t){Bg(e,"media:loaded",t)}function Yw(e){Bg(e,"media:unloaded")}function Kw(e){Bg(e,"media:volumechange")}function Xw(e){Bg(e,"media:play")}function Jw(e){Bg(e,"media:pause")}class ex{constructor(e){this._current=null,this._lastKnown=null,this._api=e}initialize(){this.clear()}set(e){var t;(t=e).height>=50&&t.width>=50&&(B_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card media load: ",e),this._current=e,this._lastKnown=e,this._api.getConditionsManager().setState({media_loaded:!0}),this._api.getStyleManager().setExpandedMode(),this._api.getCardElementManager().update())}get(){return this._current}getLastKnown(){return this._lastKnown}clear(){this._current=null,this._api.getConditionsManager().setState({media_loaded:!1})}has(){return!!this._current}}class tx{static isEvent(e){return this.isClip(e)||this.isSnapshot(e)}static isRecording(e){return"recording"===e.getMediaType()}static isClip(e){return"clip"===e.getMediaType()}static isSnapshot(e){return"snapshot"===e.getMediaType()}static isVideo(e){return this.isClip(e)||this.isRecording(e)}}class nx{constructor(e){this._mediaPlayers=[],this._api=e}getMediaPlayers(){return this._mediaPlayers}hasMediaPlayers(){return this._mediaPlayers.length>0}async initializeIfNecessary(e){e?.menu.buttons.media_player.enabled!==this._api.getConfigManager().getConfig()?.menu.buttons.media_player.enabled&&await this.initialize()}async initialize(){const e=this._api.getHASSManager().getHASS();if(!e||!this._api.getConfigManager().getConfig()?.menu.buttons.media_player.enabled)return!1;const t=Object.keys(e.states).filter((t=>{if(t.startsWith("media_player.")){const n=e.states[t];if(n&&"unavailable"!==n.state&&vb(n,131072))return!0}return!1}));let n=null;try{n=await this._api.getEntityRegistryManager().getEntities(e,t)}catch(e){Gg(e)}return this._mediaPlayers=t.filter((e=>{const t=n?.get(e);return!t||!t.hidden_by})),!0}async stop(e){const t=this._api.getHASSManager().getHASS(),n=t?.states[e];if(!n)return;let a;if(vb(n,4096))a="media_stop";else{if(!vb(n,256))return;a="turn_off"}await t.callService("media_player",a,{entity_id:e})}async playLive(e,t){const n=this._api.getCameraManager().getStore().getCameraConfig(t);n&&("dashboard"===n.cast?.method?await this._playLiveDashboard(e,n):await this._playLiveStandard(e,t,n))}async _playLiveStandard(e,t,n){const a=this._api.getHASSManager().getHASS(),i=n?.camera_entity??null;if(!a||!i)return;const r=this._api.getCameraManager().getCameraMetadata(t)?.title??null,o=a.states[i]?.attributes?.entity_picture??null;await a.callService("media_player","play_media",{entity_id:e,media_content_id:`media-source://camera/${i}`,media_content_type:"application/vnd.apple.mpegurl",extra:{...r&&{title:r},...o&&{thumb:o}}})}async _playLiveDashboard(e,t){const n=this._api.getHASSManager().getHASS();if(!n)return;const a=t.cast?.dashboard;a?.dashboard_path&&a?.view_path?await n.callService("cast","show_lovelace_view",{entity_id:e,dashboard_path:a.dashboard_path,view_path:a.view_path}):this._api.getMessageManager().setMessageIfHigherPriority({type:"error",icon:"mdi:cast",message:V_("error.no_dashboard_or_view")})}async playMedia(e,t){const n=this._api.getHASSManager().getHASS();if(!n||!t)return;const a=t.getTitle(),i=t.getThumbnail();await n.callService("media_player","play_media",{entity_id:e,media_content_id:t.getContentID(),media_content_type:tx.isVideo(t)?"video":"image",extra:{...a&&{title:a},...i&&{thumb:i}}})}}class ax{constructor(e){this._message=null,this._api=e}getMessage(){return this._message}hasMessage(){return!!this._message}hasErrorMessage(){return"error"===this._message?.type}reset(){const e=this.hasMessage();this._message=null,e&&this._api.getCardElementManager().update()}resetType(e){this._message?.type===e&&this.reset()}setErrorIfHigherPriority(e,t){e&&"object"==typeof e&&"message"in e&&(Gg(e),this.setMessageIfHigherPriority({message:t?`${t}: ${e.message}`:e.message,type:"error",...e instanceof zs&&{context:e.context}}))}setMessageIfHigherPriority(e){const t=this._message?Is[this._message.type]:0,n=Is[e.type];return!(this._message&&ne.stop())),this._stream=void 0,this._setConditionState(),this._api.getCardElementManager().update()}getStream(){return this._stream??void 0}mute(){const e=this.isMuted();this._mute=!0,this._setMute(),this._setConditionState(),e||this._callListeners("muted")}async unmute(){if(!this.isSupported())return;const e=!this.isMuted(),t=()=>{this._mute=!1,this._setMute()};this.isConnected()||this.isForbidden()?this.isConnected()&&t():(t(),await this.connect()),this._setConditionState(),e||this._callListeners("unmuted")}isConnected(){return!!this._stream}isForbidden(){return null===this._stream}isMuted(){return!this._stream||this._stream.getTracks().every((e=>!e.enabled))}addListener(e){this._listeners.push(e)}removeListener(e){this._listeners=this._listeners.filter((t=>t!==e))}_callListeners(e){this._listeners.forEach((t=>t(e)))}_setMute(){this._stream?.getTracks().forEach((e=>{e.enabled=!this._mute})),this._startTimer(),this._api.getCardElementManager().update()}_startTimer(){const e=this._api.getConfigManager().getConfig()?.live.microphone;if(e?.always_connected)return;const t=e?.disconnect_seconds??0;t&&this._timer.start(t,(()=>{this.disconnect()}))}_setConditionState(){this._api.getConditionsManager().setState({microphone:{muted:this.isMuted(),connected:this.isConnected()}})}}class rx{constructor(e){this._shouldRun=!0,this.requestExecution=()=>{this._shouldRun=!0,this._api.getCardElementManager().update()},this.executeIfNecessary=async()=>{this._shouldRun&&(this._shouldRun=!1,await this._executeViewRelated(this._calculateIntent()),await this._executeNonViewRelated(this._calculateIntent()))},this._isViewAction=e=>{switch(e.frigate_card_action){case"clip":case"clips":case"diagnostics":case"image":case"live":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":return!0}return!1},this._api=e}hasViewRelatedActionsToRun(){return!!this._calculateIntent().view&&this._shouldRun}async _executeViewRelated(e){e.view&&(e.view.default?await this._api.getViewManager().setViewDefaultWithNewQuery({params:{camera:e.view.camera},...e.view.substream&&{modifiers:[new sb(e.view.substream)]}}):await this._api.getViewManager().setViewByParametersWithNewQuery({params:{...e.view.view&&{view:e.view.view},...e.view.camera&&{camera:e.view.camera}},...e.view.substream&&{modifiers:[new sb(e.view.substream)]}}))}async _executeNonViewRelated(e){e.other&&await this._api.getActionsManager().executeActions(e.other)}_calculateIntent(){const e={};for(const t of this._getActions())this._isViewAction(t)?((e.view??={}).view=t.frigate_card_action,(e.view??={}).default=void 0):"default"===t.frigate_card_action?((e.view??={}).default=!0,(e.view??={}).view=void 0):"camera_select"===t.frigate_card_action?(e.view??={}).camera=t.camera:"live_substream_select"===t.frigate_card_action?(e.view??={}).substream=t.camera:(e.other??=[]).push(t);return e}_getActions(){const e=new URLSearchParams(window.location.search),t=[],n=new RegExp(/^frigate-card-action([.:](?\w+))?[.:](?\w+)/);for(const[a,i]of e.entries()){const e=a.match(n);if(!e||!e.groups)continue;const r=e.groups.cardID,o=e.groups.action;let s=null;switch(o){case"camera_select":case"live_substream_select":i&&(s=ff(o,i,{cardID:r}));break;case"camera_ui":case"clip":case"clips":case"default":case"diagnostics":case"download":case"expand":case"image":case"live":case"menu_toggle":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":s=gf(o,{cardID:r});break;default:console.warn(`Frigate card received unknown card action in query string: ${o}`)}s&&t.push(s)}return t}}class ox{constructor(e){this._items=[],this._dynamicItems=[],this._api=e}addDynamicStatusBarItem(e){this._dynamicItems.includes(e)||this._dynamicItems.push(e),this._api.getCardElementManager().update()}removeDynamicStatusBarItem(e){this._dynamicItems=this._dynamicItems.filter((t=>!Dv(t,e))),this._api.getCardElementManager().update()}removeAllDynamicStatusBarItems(){this._dynamicItems=[],this._api.getCardElementManager().update()}calculateItems(e){const t=e?.view?e?.cameraManager?.getCameraMetadata(e?.view?.camera):null,n=t?.engineLogo??null,a=e?.view?.is("live")?t?.title??null:e?.view?.isViewerView()?e?.view.queryResults?.getSelectedResult()?.getTitle()??null:null,i=e?.mediaLoadedInfo?this._calculateResolution(e?.mediaLoadedInfo):null,r=e?.mediaLoadedInfo?.technology?.length?e?.mediaLoadedInfo.technology[0]:null;return[...a?[{type:"custom:frigate-card-status-bar-string",string:a,expand:!0,sufficient:!0,...e?.statusConfig?.items.title}]:[],...i?[{type:"custom:frigate-card-status-bar-string",string:i,...e?.statusConfig?.items.resolution}]:[],...r&&"webrtc"===r?[{type:"custom:frigate-card-status-bar-icon",icon:"mdi:webrtc",...e?.statusConfig?.items.technology}]:r?[{type:"custom:frigate-card-status-bar-string",string:r.toUpperCase(),...e?.statusConfig?.items.technology}]:[],...n?[{type:"custom:frigate-card-status-bar-image",image:n,...e?.statusConfig?.items.engine}]:[],...this._dynamicItems]}_matchesWidthHeight(e,t,n){const a=.99*t,i=1.01*t,r=.99*n,o=1.01*n,s=(e,t,n)=>e>=t&&e<=n;return!!e&&(s(e.width,a,i)&&s(e.height,r,o)||s(e.height,a,i)&&s(e.width,r,o))}_calculateResolution(e){return this._matchesWidthHeight(e,1920,1080)?"1080p":this._matchesWidthHeight(e,1280,720)?"720p":this._matchesWidthHeight(e,640,480)?"VGA":this._matchesWidthHeight(e,3840,2160)?"4K":this._matchesWidthHeight(e,720,480)?"480p":this._matchesWidthHeight(e,720,576)?"576p":this._matchesWidthHeight(e,7680,4320)?"8K":`${e.width}x${e.height}`}}class sx{constructor(e){this.setLightOrDarkMode=()=>{const e=this._api.getConfigManager().getConfig(),t="on"===e?.view.dark_mode||"auto"===e?.view.dark_mode&&(!this._api.getInteractionManager().hasInteraction()||!!this._api.getHASSManager().getHASS()?.themes.darkMode);of(this._api.getCardElementManager().getElement(),t,"dark")},this._api=e}setExpandedMode(){const e=this._api.getCardElementManager().getElement(),t=this._api.getViewManager().getView(),n=this._api.getMediaLoadedInfoManager().getLastKnown();e.style.setProperty("--frigate-card-expand-aspect-ratio",t?.isAnyMediaView()&&n?`${n.width} / ${n.height}`:"unset");const a=t?.isGrid();e.style.setProperty("--frigate-card-expand-width",!a&&t?.isAnyMediaView()?"none":"var(--frigate-card-expand-max-width)"),e.style.setProperty("--frigate-card-expand-height",!a&&t?.isAnyMediaView()?"none":"var(--frigate-card-expand-max-height)")}setMinMaxHeight(){const e=this._api.getConfigManager().getConfig();if(e){this._api.getCardElementManager().getElement().style.setProperty("--frigate-card-height",e.dimensions.height)}}setPerformance(){const e={box_shadow:"none",border_radius:"0px"},t=this._api.getCardElementManager().getElement(),n=this._api.getConfigManager().getCardWideConfig()?.performance,a=n?.style??{};for(const n of Object.keys(a)){const i=`--frigate-card-css-${n.replaceAll("_","-")}`;!1===a[n]?t.style.setProperty(i,e[n]):t.style.removeProperty(i)}}_isAspectRatioEnforced(e,t){const n=e.dimensions.aspect_ratio_mode;return!(this._api.getFullscreenManager().isInFullscreen()||this._api.getExpandManager().isExpanded()||"unconstrained"===n||"dynamic"===n&&(!t||t?.isAnyMediaView()||t?.is("timeline")||t?.is("diagnostics")))}getAspectRatioStyle(){const e=this._api.getConfigManager().getConfig(),t=this._api.getViewManager().getView();if(e){if(!this._isAspectRatioEnforced(e,t))return uf();const n=e.dimensions.aspect_ratio_mode,a=this._api.getMediaLoadedInfoManager().getLastKnown();return uf(a&&"dynamic"===n?{ratio:[a.width,a.height]}:{ratio:e.dimensions.aspect_ratio})}return uf({defaultStatic:!0})}}class cx{constructor(e){this._triggeredCameras=new Map,this._triggeredCameraTimers=new Map,this._throttledTriggerAction=qw(this._triggerAction.bind(this),1e3,{trailing:!0}),this._api=e}getTriggeredCameraIDs(){return new Set(this._triggeredCameras.keys())}isTriggered(){return!!this._triggeredCameras.size}getMostRecentlyTriggeredCameraID(){const e=Ev([...this._triggeredCameras.entries()],(e=>e[1].getTime()),"desc");return e.length?e[0][0]:null}async handleCameraEvent(e){const t=this._api.getConfigManager().getConfig()?.view.triggers,n=this._api.getViewManager().getView()?.camera;if(!t||!n)return;const a=this._api.getCameraManager().getStore().getAllDependentCameras(n);t.filter_selected_camera&&!a.has(e.cameraID)||("end"!==e.type?(this._triggeredCameras.set(e.cameraID,new Date),this._setConditionStateIfNecessary(),await this._throttledTriggerAction(e)):this._startUntriggerTimer(e.cameraID))}_hasAllowableInteractionStateForAction(){const e=this._api.getConfigManager().getConfig()?.view.triggers,t=this._api.getInteractionManager().hasInteraction();return!!e&&("all"===e.actions.interaction_mode||"active"===e.actions.interaction_mode&&t||"inactive"===e.actions.interaction_mode&&!t)}async _triggerAction(e){const t=this._api.getConfigManager().getConfig()?.view.triggers.actions.trigger,n=this._api.getConfigManager().getConfig()?.view.default;("high"!==e.fidelity||e.snapshot||e.clip||"live"===t||"default"===t&&"live"===n)&&(this._hasAllowableInteractionStateForAction()&&("update"===t?await this._api.getViewManager().setViewByParametersWithNewQuery({queryExecutorOptions:{useCache:!1}}):"live"===t?await this._api.getViewManager().setViewByParametersWithNewQuery({params:{view:"live",camera:e.cameraID}}):"default"===t?await this._api.getViewManager().setViewDefaultWithNewQuery({params:{camera:e.cameraID}}):"high"===e.fidelity&&"media"===t&&await this._api.getViewManager().setViewByParametersWithNewQuery({params:{view:e.clip?"clip":"snapshot",camera:e.cameraID}})),this._api.getCardElementManager().update())}_setConditionStateIfNecessary(){const e=new Set(this._triggeredCameras.keys()),t=e.size?e:void 0;Dv(t,this._api.getConditionsManager().getState().triggered)||this._api.getConditionsManager().setState({triggered:t})}async _untriggerAction(e){const t=this._api.getConfigManager().getConfig()?.view.triggers.actions.untrigger;"default"===t&&this._hasAllowableInteractionStateForAction()&&await this._api.getViewManager().setViewDefaultWithNewQuery(),this._triggeredCameras.delete(e),this._deleteTimer(e),this._setConditionStateIfNecessary(),this._api.getCardElementManager().update()}_startUntriggerTimer(e){this._deleteTimer(e);const t=new xf;this._triggeredCameraTimers.set(e,t),t.start( +/* istanbul ignore next: the case of config being null here cannot be + reached, as there's no way to have the untrigger call happen without + a config. -- @preserve */ +this._api.getConfigManager().getConfig()?.view.triggers.untrigger_seconds??0,(async()=>{await this._untriggerAction(e)}))}_deleteTimer(e){this._triggeredCameraTimers.get(e)?.stop(),this._triggeredCameraTimers.delete(e)}}function lx(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Hg(e,void 0,t):[]}class dx{constructor(e){this._queries=null,e&&(this._queries=e)}clone(){return u_(this)}getQueries(){return this._queries}setQueries(e){return this._queries=e,this}getQueryCameraIDs(){if(!this._queries)return null;const e=new Set;return this._queries.forEach((t=>[...t.cameraIDs].forEach((t=>e.add(t))))),e}setQueryCameraIDs(e){if(!this._queries)return this;const t=[];return this._queries.forEach((n=>t.push({...n,cameraIDs:Zg(e)}))),this._queries=lx(t,Dv),this}hasQueriesForCameraIDs(e){for(const t of e)if(!this._queries?.some((e=>e.cameraIDs.has(t))))return!1;return!0}}class ux extends dx{convertToClipsQueries(){for(const e of this._queries??[])delete e.hasSnapshot,e.hasClip=!0;return this}}class hx extends dx{}class px{static areEventQueries(e){return e instanceof ux}static areRecordingQueries(e){return e instanceof hx}static areClipsQueries(e){return this.areEventQueries(e)&&!!e?.getQueries()?.every((e=>e.hasClip))}static areSnapshotQueries(e){return this.areEventQueries(e)&&!!e?.getQueries()?.every((e=>e.hasSnapshot))}static getQueriesType(e){return this.areEventQueries(e)?"event":this.areRecordingQueries(e)?"recording":null}static getMediaType(e){return this.areClipsQueries(e)?"clips":this.areSnapshotQueries(e)?"snapshots":this.areRecordingQueries(e)?"recordings":null}}const mx=(e,t,n)=>{const a={anyCapabilities:["clips","snapshots","recordings"]};switch(t){case"image":case"diagnostics":return e.getStore().getCameraIDs();case"live":case"clip":case"clips":case"snapshot":case"snapshots":case"recording":case"recordings":const i="clip"===t?"clips":"snapshot"===t?"snapshots":"recording"===t?"recordings":t;return n?e.getStore().getAllDependentCameras(n,i):e.getStore().getCameraIDsWithCapability(i);case"timeline":return e.getStore().getCameraIDsWithCapability(a);case"media":return n?e.getStore().getAllDependentCameras(n,a):e.getStore().getCameraIDsWithCapability(a)}},gx=(e,t)=>Ly({},e,t);class fx{constructor(e){this.view=e.view,this.camera=e.camera,this.query=e.query??null,this.queryResults=e.queryResults??null,this.context=e.context??null,this.displayMode=e.displayMode??null}clone(){return new fx({view:this.view,camera:this.camera,query:this.query?.clone()??null,queryResults:this.queryResults?.clone()??null,context:this.context,displayMode:this.displayMode})}evolve(e){return new fx({view:void 0!==e.view?e.view:this.view,camera:void 0!==e.camera?e.camera:this.camera,query:void 0!==e.query?e.query:this.query?.clone()??null,queryResults:void 0!==e.queryResults?e.queryResults:this.queryResults?.clone()??null,context:void 0!==e.context?e.context:this.context,displayMode:void 0!==e.displayMode?e.displayMode:this.displayMode})}mergeInContext(e){return this.context=gx(this.context,e),this}removeContext(e){return this.context&&delete this.context[e],this}removeContextProperty(e,t){const n=this.context?.[e];return n&&delete n[t],this}is(e){return this.view==e}isGalleryView(){return["clips","snapshots","recordings"].includes(this.view)}isAnyMediaView(){return this.isViewerView()||this.is("live")||this.is("image")}isViewerView(){return["media","clip","snapshot","recording"].includes(this.view)}supportsMultipleDisplayModes(){return this.isViewerView()||this.is("live")}getDefaultMediaType(){return["clip","clips"].includes(this.view)?"clips":["snapshot","snapshots"].includes(this.view)?"snapshots":["recording","recordings"].includes(this.view)?"recordings":null}isGrid(){return"grid"===this.displayMode}}const _x=(e,t)=>{t?.forEach((t=>t.modify(e)))};class vx extends zs{}class yx extends zs{}class bx{constructor(e){this._api=e}getViewDefault(e){const t=this._api.getConfigManager().getConfig();if(!t)return null;let n=null;const a=e?.params?.view??t.view.default;if(e?.params?.camera)n=e.params.camera;else{const i=[...mx(this._api.getCameraManager(),a)];if(!i.length)return null;if(e?.baseView?.camera&&t.view.default_cycle_camera){const t=i.indexOf(e.baseView.camera);n=i[t+1>=i.length?0:t+1]}else n=i[0]}return this.getViewByParameters({params:{...e?.params,view:a,camera:n},baseView:e?.baseView})}getViewByParameters(e){const t=this._api.getConfigManager().getConfig();if(!t)return null;let n=e?.params?.camera??e?.baseView?.camera??null,a=e?.params?.view??e?.baseView?.view??t.view.default;const i=this._api.getCameraManager().getStore().getCameraIDs();if(!n||!i.has(n)){n=mx(this._api.getCameraManager(),a).keys().next().value??null}if(!n){const e=[...this._api.getCameraManager().getStore().getCameras()].reduce(((e,[t,n])=>{const a=n.getCapabilities()?.getRawCapabilities();return a&&(e[t]=a),e}),{});throw new vx(V_("error.no_supported_cameras"),{view:a,cameras_capabilities:e})}if(!this.isViewSupportedByCamera(n,a)){if(!e?.failSafe||!this.isViewSupportedByCamera(n,Qs)){const e=this._api.getCameraManager().getStore().getCamera(n)?.getCapabilities()?.getRawCapabilities();throw new yx(V_("error.no_supported_camera"),{view:a,camera:n,...e&&{camera_capabilities:e}})}a=Qs}const r=e?.params?.displayMode??e?.baseView?.displayMode??this._getDefaultDisplayModeForView(a,t),o={...e?.params,view:a,camera:n,displayMode:r},s=e?.baseView?e.baseView.evolve(o):new fx(o);return _x(s,e?.modifiers),s}isViewSupportedByCamera(e,t){return!!mx(this._api.getCameraManager(),t,e).size}_getDefaultDisplayModeForView(e,t){let n=null;switch(e){case"media":case"clip":case"recording":case"snapshot":n=t.media_viewer.display?.mode??null;break;case"live":n=t.live.display?.mode??null}return n??"single"}}class wx{constructor(e,t){this._key=e,this._property=t}modify(e){e.removeContextProperty(this._key,this._property)}}class xx{constructor(e){this._query=e?.query,this._queryResults=e?.queryResults}modify(e){void 0!==this._query&&(e.query=this._query),void 0!==this._queryResults&&(e.queryResults=this._queryResults)}}const Cx=(e,t,n)=>{let a;for(const[i,r]of e.entries()){const e=r.getStartTime(),o=r.getUsableEndTime();if(r.includesTime(t)&&e&&o){const t=o.getTime()-e.getTime();(!a||n&&a.cameraID!==n&&r.getCameraID()===n||t>a.duration&&(!n||a.cameraID!==n||r.getCameraID()===n))&&(a={index:i,duration:t,cameraID:r.getCameraID()})}}return a?a.index:null};class Mx{constructor(e){this._results=e?.results??[],this._selectedIndex=this._getInitialSelectedIndex(e)}_getInitialSelectedIndex(e){return null!=e?.selectedIndex?e.selectedIndex:e?.results&&e.results.length?e?.selectApproach&&"last"!==e?.selectApproach?0:e.results.length-1:null}clone(){return new Mx({results:this._results,selectedIndex:this._selectedIndex})}getResults(){return this._results}getSelectedIndex(){return this._selectedIndex}getResultsCount(){return this.getResults().length}hasResults(){return 0!==this.getResultsCount()}getResult(e){return void 0===e?null:this._results[e]}getSelectedResult(){const e=this.getSelectedIndex();return null!==e?this.getResult(e):null}hasSelectedResult(){return null!==this.getSelectedResult()}resetSelectedResult(){this._selectedIndex=null}selectIndex(e){(null===e||e>=0&&ee.getID()))),n=new Set(e._main.getResults()?.map((e=>e.getID())));return!(!t.size||!n.size||t.has(null)||n.has(null))&&((e,t)=>{for(const n of t)if(!e.has(n))return!1;return!0})(t,n)}getCameraIDs(){return new Set(this._cameras.keys())}getSlice(e){return e?this._cameras.get(e)??null:this._main}getResults(e){return this.getSlice(e)?.getResults()??null}getResultsCount(e){return this.getSlice(e)?.getResultsCount()??0}hasResults(e){return 0!==this.getSlice(e)?.getResultsCount()}getResult(e,t){return this.getSlice(t)?.getResult(e)??null}getSelectedIndex(e){return this.getSlice(e)?.getSelectedIndex()??null}getSelectedResult(e){return this.getSlice(e)?.getSelectedResult()??null}getMultipleSelectedResults(e){const t=[];if(!e||e.main){const e=this.getSelectedResult();e&&t.push(e)}const n=this._getCameraIDsFromCriteria(e);for(const e of n??[]){const n=this.getSelectedResult(e);n&&t.push(n)}return t}hasSelectedResult(e){return this.getSlice(e)?.hasSelectedResult()??!1}resetSelectedResult(e){return this.getSlice(e)?.resetSelectedResult(),this}getResultsTimestamp(){return this._resultsTimestamp}selectIndex(e,t){return this.getSlice(t)?.selectIndex(e),t||this.demoteMainSelectionToCameraSelection(),this}demoteMainSelectionToCameraSelection(){const e=this.getSelectedResult();if(e){const t=e.getCameraID();this.resetSelectedResult(t),this.selectResultIfFound((t=>t===e),{cameraID:t})}return this}promoteCameraSelectionToMainSelection(e){const t=this.getSelectedResult(e);return this.resetSelectedResult(),this.selectResultIfFound((e=>e===t)),this}_getCameraIDsFromCriteria(e){return e?.allCameras?this.getCameraIDs():e?.cameraID?new Set([e.cameraID]):null}selectResultIfFound(e,t){t&&!t?.main||(this._main.selectResultIfFound(e),this.demoteMainSelectionToCameraSelection());const n=this._getCameraIDsFromCriteria(t);for(const t of n??[])this.getSlice(t)?.selectResultIfFound(e);return this}selectBestResult(e,t){t&&!t.main||(this._main.selectBestResult(e),this.demoteMainSelectionToCameraSelection());const n=this._getCameraIDsFromCriteria(t);for(const t of n??[])this.getSlice(t)?.selectBestResult(e);return this}}class Sx{constructor(e){this._api=e}async executeDefaultEventQuery(e){const t=e?.eventsMediaType&&"all"!==e?.eventsMediaType?e.eventsMediaType:{anyCapabilities:["clips","snapshots"]},n=this._api.getCameraManager(),a=e?.cameraID?n.getStore().getAllDependentCameras(e.cameraID,t):n.getStore().getCameraIDsWithCapability(t);if(!a.size)return null;const i=n.generateDefaultEventQueries(a,{limit:this._getChunkLimit(),..."clips"===e?.eventsMediaType&&{hasClip:!0},..."snapshots"===e?.eventsMediaType&&{hasSnapshot:!0}});if(!i)return null;const r=new ux(i),o=await this.execute(r,e?.executorOptions);return o?{query:r,queryResults:o}:null}async executeDefaultRecordingQuery(e){const t=this._api.getCameraManager(),n=e?.cameraID?t.getStore().getAllDependentCameras(e.cameraID,"recordings"):t.getStore().getCameraIDsWithCapability("recordings");if(!n.size)return null;const a=t.generateDefaultRecordingQueries(n,{limit:this._getChunkLimit()});if(!a)return null;const i=new hx(a),r=await this.execute(i,e?.executorOptions);return r?{query:i,queryResults:r}:null}async execute(e,t){const n=e.getQueries();if(!n)return null;const a=await this._api.getCameraManager().executeMediaQueries(n,{useCache:t?.useCache});if(!a)return null;const i=new kx({results:a});return t?.rejectResults?.(i)?null:(t?.selectResult?.id?i.selectBestResult((e=>e.findIndex((e=>e.getID()===t.selectResult?.id)))):t?.selectResult?.func?i.selectResultIfFound(t.selectResult.func):t?.selectResult?.time&&i.selectBestResult((e=>Cx(e,t.selectResult?.time?.time,t.selectResult?.time?.favorCameraID))),i)}_getChunkLimit(){const e=this._api.getConfigManager().getCardWideConfig();return e?.performance?.features.media_chunk_size??50}}class Ex{constructor(e,t){this._api=e,this._executor=t??new Sx(e)}async getExistingQueryModifiers(e,t){return e.query?[new xx({queryResults:await this._executor.execute(e.query,t)})]:[]}async getNewQueryModifiers(e,t){return await this._executeNewQuery(e,{useCache:!1,...t})}async _executeNewQuery(e,t){const n=this._api.getConfigManager().getConfig();if(!n)return null;const a=e?.getDefaultMediaType(),i=[],r=async n=>{ +/* istanbul ignore if: this path cannot be reached -- @preserve */ +if(!n)return[];const a="recordings"===n?await this._executor.executeDefaultRecordingQuery({...!e.isGrid()&&{cameraID:e.camera},executorOptions:t}):"clips"===n||"snapshots"===n||"all"===n?await this._executor.executeDefaultEventQuery({...!e.isGrid()&&{cameraID:e.camera},eventsMediaType:n,executorOptions:t}):/* istanbul ignore next -- @preserve */ +null;return a?[new xx(a)]:[]};switch(e.view){case"live":"none"!==n.live.controls.thumbnails.mode&&i.push(...await r("recordings"===n.live.controls.thumbnails.media_type?"recordings":n.live.controls.thumbnails.events_media_type));break;case"media":i.push(...await r("clips"));break;case"clips":case"snapshots":case"recordings":i.push(...await r(a));break;case"clip":case"snapshot":case"recording":"none"!==n.media_viewer.controls.thumbnails.mode&&i.push(...await r(a))}return i.push(...this._getTimelineWindowViewModifier(e)),i.push(...this._getSeekTimeModifier(t?.selectResult?.time?.time)),i}_getTimelineWindowViewModifier(e){if(e.is("live")){const e=new Date,t=this._api.getConfigManager().getConfig()?.live; +/* istanbul ignore if: this if branch cannot be reached as if the config is + empty this function is never called -- @preserve */ +return t?[new Gy({timeline:{window:{start:Qu(e,{seconds:t.controls.timeline.window_seconds}),end:e}}})]:[]}return[new wx("timeline","window")]}_getSeekTimeModifier(e){return e?[new Gy({mediaViewer:{seek:e}})]:[new wx("mediaViewer","seek")]}}class $x{constructor(e,t){this._view=null,this._epoch=this._createEpoch(),this._loadingIndex=1,this.setViewDefault=e=>this._setViewGeneric(this._viewFactory.getViewDefault.bind(this._viewFactory),e),this.setViewByParameters=e=>this._setViewGeneric(this._viewFactory.getViewByParameters.bind(this._viewFactory),e),this.setViewDefaultWithNewQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewDefault.bind(this._viewFactory),this._viewQueryExecutor.getNewQueryModifiers.bind(this._viewQueryExecutor),e),this.setViewByParametersWithNewQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewByParameters.bind(this._viewFactory),this._viewQueryExecutor.getNewQueryModifiers.bind(this._viewQueryExecutor),e),this.setViewByParametersWithExistingQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewByParameters.bind(this._viewFactory),this._viewQueryExecutor.getExistingQueryModifiers.bind(this._viewQueryExecutor),e),this.initialize=async()=>(this._api.getQueryStringManager().hasViewRelatedActionsToRun()||this.setViewDefaultWithNewQuery({failSafe:!0}),!0),this._api=e,this._viewFactory=t?.viewFactory??new bx(e),this._viewQueryExecutor=t?.viewQueryExecutor??new Ex(e)}getEpoch(){return this._epoch}_createEpoch(e){return{manager:this,...e&&{oldView:e}}}getView(){return this._view}hasView(){return!!this.getView()}reset(){this._view&&this._setView(null)}_setViewGeneric(e,t){let n=null;try{n=e({baseView:this._view,...t})}catch(e){this._api.getMessageManager().setErrorIfHigherPriority(e)}n&&this._setView(n)}_markViewLoadingQuery(e,t){return e.mergeInContext({loading:{query:t}})}_markViewAsNotLoadingQuery(e){return e.removeContextProperty("loading","query")}async _setViewThenModifyAsync(e,t,n){let a=null;try{a=e({baseView:this._view,...n,params:{query:null,queryResults:null,...n?.params}})}catch(e){this._api.getMessageManager().setErrorIfHigherPriority(e)}if(!a)return;if(this._view&&this._shouldAdoptQueryAndResults(a))return a.query=this._view.query,a.queryResults=this._view.queryResults,this._markViewAsNotLoadingQuery(a),void this._setView(a);const i=this._loadingIndex++;this._markViewLoadingQuery(a,i),this._setView(a);let r=null,o=null;try{r=await t(a,n?.queryExecutorOptions)}catch(e){o=e}if(this._view&&this.hasMajorMediaChange(this._view,a))return void(this._view.context?.loading?.query===i&&this._setView(this._markViewAsNotLoadingQuery(this._view.clone())));if(o)return void this._api.getMessageManager().setErrorIfHigherPriority(o); +/* istanbul ignore if: the if path cannot be reached as the view is set + above -- @preserve */if(!this._view)return;const s=this._view.clone();this._view.context?.loading?.query===i&&this._markViewAsNotLoadingQuery(s),_x(s,r),this._setView(s)}_shouldAdoptQueryAndResults(e){const t=this._view?.isViewerView()&&e?.isGalleryView(),n=e?.getDefaultMediaType(),a=px.getMediaType(this._view?.query)===n;return!!t&&a}setViewWithMergedContext(e){if(this._view)return this._setView(this._view?.clone().mergeInContext(e))}isViewSupportedByCamera(e,t){return!!mx(this._api.getCameraManager(),t,e).size}hasMajorMediaChange(e,t){const n=t??this._view;return!!e!=!!n||e?.view!==n?.view||e?.camera!==n?.camera||"live"===n?.view&&e&&My(e)!==My(n)||"live"!==n?.view&&e?.queryResults!==n?.queryResults}_setView(e){const t=this._view;B_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card view change: ",e),this._view=e,this._epoch=this._createEpoch(t),this.hasMajorMediaChange(t)&&this._api.getMediaLoadedInfoManager().clear(),t?.view!==e?.view&&this._api.getCardElementManager().scrollReset(),this._api.getMessageManager().reset(),this._api.getStyleManager().setExpandedMode(),this._api.getConditionsManager()?.setState({view:e?.view,camera:e?.camera,displayMode:e?.displayMode??void 0}),this._api.getCardElementManager().update()}}class Ax{constructor(e,t,n,a){this._deviceRegistryManager=new oy(new iy((e=>e.id))),this._entityRegistryManager=new ly(new iy((e=>e.entity_id))),this._resolvedMediaCache=new uy,this._actionsManager=new gb(this),this._automationsManager=new fb(this),this._cameraManager=new ay(this),this._cameraURLManager=new _b(this),this._configManager=new Mw(this),this._defaultManager=new kw(this),this._downloadManager=new Aw(this),this._expandManager=new zw(this),this._fullscreenManager=new Rw(this),this._hassManager=new Lw(this),this._initializationManager=new Zb(this),this._interactionManager=new Uw(this),this._keyboardStateManager=new Ww(this),this._mediaLoadedInfoManager=new ex(this),this._mediaPlayerManager=new nx(this),this._messageManager=new ax(this),this._microphoneManager=new ix(this),this._queryStringManager=new rx(this),this._statusBarItemManager=new ox(this),this._styleManager=new sx(this),this._triggersManager=new cx(this),this._viewManager=new $x(this),e.addController(this),this._conditionsManager=new yw(this,a),this._cardElementManager=new Qb(this,e,t,n)}getActionsManager(){return this._actionsManager}getAutomationsManager(){return this._automationsManager}getCameraManager(){return this._cameraManager}getCameraURLManager(){return this._cameraURLManager}getCardElementManager(){return this._cardElementManager}getConditionsManager(){return this._conditionsManager}static async getConfigElement(){return await import("./editor-5368ad86.js"),document.createElement("frigate-card-editor")}getConfigManager(){return this._configManager}getDefaultManager(){return this._defaultManager}getDeviceRegistryManager(){return this._deviceRegistryManager}getDownloadManager(){return this._downloadManager}getEntityRegistryManager(){return this._entityRegistryManager}getExpandManager(){return this._expandManager}getFullscreenManager(){return this._fullscreenManager}getHASSManager(){return this._hassManager}getInitializationManager(){return this._initializationManager}getInteractionManager(){return this._interactionManager}getKeyboardStateManager(){return this._keyboardStateManager}getMediaLoadedInfoManager(){return this._mediaLoadedInfoManager}getMediaPlayerManager(){return this._mediaPlayerManager}getMessageManager(){return this._messageManager}getMicrophoneManager(){return this._microphoneManager}getQueryStringManager(){return this._queryStringManager}getResolvedMediaCache(){return this._resolvedMediaCache}getStatusBarItemManager(){return this._statusBarItemManager}static getStubConfig(e){return{cameras:[{camera_entity:e.find((e=>e.startsWith("camera.")))??"camera.demo"}]}}getStyleManager(){return this._styleManager}getTriggersManager(){return this._triggersManager}getViewManager(){return this._viewManager}hostConnected(){this.getCardElementManager().elementConnected()}hostDisconnected(){this.getCardElementManager().elementDisconnected()}}class zx{constructor(){this._dynamicMenuButtons=[]}addDynamicMenuButton(e){this._dynamicMenuButtons.includes(e)||this._dynamicMenuButtons.push(e)}removeDynamicMenuButton(e){this._dynamicMenuButtons=this._dynamicMenuButtons.filter((t=>t!=e))}calculateButtons(e,t,n,a){return[this._getDefaultButton(t),this._getCamerasButton(t,n,a?.view),this._getSubstreamsButton(t,n,a?.view),this._getLiveButton(t,a?.view,a?.viewManager),this._getClipsButton(t,a?.view,a?.viewManager),this._getSnapshotsButton(t,a?.view,a?.viewManager),this._getRecordingsButton(t,a?.view,a?.viewManager),this._getImageButton(t,a?.view,a?.viewManager),this._getTimelineButton(t,a?.view,a?.viewManager),this._getDownloadButton(t,n,a?.view),this._getCameraUIButton(t,a?.showCameraUIButton),this._getMicrophoneButton(t,a?.microphoneManager,a?.currentMediaLoadedInfo),this._getExpandButton(t,a?.inExpandedMode),this._getFullscreenButton(t,a?.inFullscreenMode),this._getCastButton(e,t,n,a?.view,a?.mediaPlayerController),this._getPlayPauseButton(t,a?.currentMediaLoadedInfo),this._getMuteUnmuteButton(t,a?.currentMediaLoadedInfo),this._getScreenshotButton(t,a?.currentMediaLoadedInfo),this._getDisplayModeButton(t,n,a?.view),this._getPTZControlsButton(t,n,a?.view),this._getPTZHomeButton(t,n,a?.view),...this._dynamicMenuButtons.map((e=>({style:this._getStyleFromActions(t,e,a),...e})))].filter(sf)}_getDefaultButton(e){return{icon:"frigate",...e.menu.buttons.frigate,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.frigate"),permanent:!0,tap_action:"hidden"===e.menu?.style?gf("menu_toggle"):gf("default"),hold_action:gf("diagnostics")}}_getCamerasButton(e,t,n){const a=t.getStore().getCameraIDsWithCapability("menu");if(a.size>1){const i=Array.from(t.getStore().getCameraConfigEntries(a),(([e,a])=>{const i=ff("camera_select",e),r=t.getCameraMetadata(e);return{enabled:!0,icon:r?.icon,entity:a.camera_entity,state_color:!0,title:r?.title,selected:n?.camera===e,...i&&{tap_action:i}}}));return{icon:"mdi:video-switch",...e.menu.buttons.cameras,type:"custom:frigate-card-menu-submenu",title:V_("config.menu.buttons.cameras"),items:i}}return null}_getSubstreamsButton(e,t,n){if(!n)return null;const a=t.getStore().getAllDependentCameras(n.camera,"substream");if(a.size&&n.is("live")){const i=[...a].filter((e=>e!==n.camera)),r=[n.camera,...i],o=My(n);if(2===r.length)return{icon:"mdi:video-input-component",style:o!==n.camera?this._getEmphasizedStyle():{},title:V_("config.menu.buttons.substreams"),...e.menu.buttons.substreams,type:"custom:frigate-card-menu-icon",tap_action:gf(ky(n)?"live_substream_off":"live_substream_on")};if(r.length>2){const a=Array.from(r,(e=>{const n=ff("live_substream_select",e),a=t.getCameraMetadata(e)??void 0,i=t.getStore().getCameraConfig(e);return{enabled:!0,icon:a?.icon,entity:i?.camera_entity,state_color:!0,title:a?.title,selected:o===e,...n&&{tap_action:n}}}));return{icon:"mdi:video-input-component",title:V_("config.menu.buttons.substreams"),style:o!==n.camera?this._getEmphasizedStyle():{},...e.menu.buttons.substreams,type:"custom:frigate-card-menu-submenu",items:a}}}return null}_getLiveButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"live")?{icon:"mdi:cctv",...e.menu.buttons.live,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.live"),style:t.is("live")?this._getEmphasizedStyle():{},tap_action:gf("live")}:null}_getClipsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"clips")?{icon:"mdi:filmstrip",...e.menu.buttons.clips,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.clips"),style:t?.is("clips")?this._getEmphasizedStyle():{},tap_action:gf("clips"),hold_action:gf("clip")}:null}_getSnapshotsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"snapshots")?{icon:"mdi:camera",...e.menu.buttons.snapshots,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.snapshots"),style:t?.is("snapshots")?this._getEmphasizedStyle():{},tap_action:gf("snapshots"),hold_action:gf("snapshot")}:null}_getRecordingsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"recordings")?{icon:"mdi:album",...e.menu.buttons.recordings,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.recordings"),style:t.is("recordings")?this._getEmphasizedStyle():{},tap_action:gf("recordings"),hold_action:gf("recording")}:null}_getImageButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"image")?{icon:"mdi:image",...e.menu.buttons.image,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.image"),style:t?.is("image")?this._getEmphasizedStyle():{},tap_action:gf("image")}:null}_getTimelineButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"timeline")?{icon:"mdi:chart-gantt",...e.menu.buttons.timeline,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.timeline"),style:t.is("timeline")?this._getEmphasizedStyle():{},tap_action:gf("timeline")}:null}_getDownloadButton(e,t,n){const a=n?.queryResults?.getSelectedResult(),i=a?t?.getMediaCapabilities(a):null;return n?.isViewerView()&&i?.canDownload&&!this._isBeingCasted()?{icon:"mdi:download",...e.menu.buttons.download,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.download"),tap_action:gf("download")}:null}_getCameraUIButton(e,t){return t?{icon:"mdi:web",...e.menu.buttons.camera_ui,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.camera_ui"),tap_action:gf("camera_ui")}:null}_getMicrophoneButton(e,t,n){if(t&&n?.capabilities?.supports2WayAudio){const n=t.isForbidden()||!t.isSupported(),a=t.isMuted(),i=e.menu.buttons.microphone.type;return{icon:n?"mdi:microphone-message-off":a?"mdi:microphone-off":"mdi:microphone",...e.menu.buttons.microphone,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.microphone"),style:n||a?{}:this._getEmphasizedStyle(!0),...!n&&"momentary"===i&&{start_tap_action:gf("microphone_unmute"),end_tap_action:gf("microphone_mute")},...!n&&"toggle"===i&&{tap_action:gf(a?"microphone_unmute":"microphone_mute")}}}return null}_getExpandButton(e,t){return{icon:t?"mdi:arrow-collapse-all":"mdi:arrow-expand-all",...e.menu.buttons.expand,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.expand"),tap_action:gf("expand"),style:t?this._getEmphasizedStyle():{}}}_getFullscreenButton(e,t){return this._isBeingCasted()?null:{icon:t?"mdi:fullscreen-exit":"mdi:fullscreen",...e.menu.buttons.fullscreen,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.fullscreen"),tap_action:gf("fullscreen"),style:t?this._getEmphasizedStyle():{}}}_getCastButton(e,t,n,a,i){if(!a)return null;const r=n.getStore().getCameraConfig(a.camera);if(i?.hasMediaPlayers()&&(a.isViewerView()||a.is("live")&&r?.camera_entity)){const n=i.getMediaPlayers().map((t=>{const n=Lb(e,t)||t,a=e.states[t],i=_f(t,"play"),r=_f(t,"stop"),o=!a||"unavailable"===a.state;return{enabled:!0,selected:!1,icon:Nb(e,t),entity:t,state_color:!1,title:n,disabled:o,...!o&&i&&{tap_action:i},...!o&&r&&{hold_action:r}}}));return{icon:"mdi:cast",...t.menu.buttons.media_player,type:"custom:frigate-card-menu-submenu",title:V_("config.menu.buttons.media_player"),items:n}}return null}_getPlayPauseButton(e,t){if(t&&t.player&&t.capabilities?.supportsPause){const n=t.player.isPaused();return{icon:n?"mdi:play":"mdi:pause",...e.menu.buttons.play,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.play"),tap_action:gf(n?"play":"pause")}}return null}_getMuteUnmuteButton(e,t){if(t&&t.player&&t?.capabilities?.hasAudio){const n=t.player.isMuted();return{icon:n?"mdi:volume-off":"mdi:volume-high",...e.menu.buttons.mute,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.mute"),tap_action:gf(n?"unmute":"mute")}}return null}_getScreenshotButton(e,t){return t&&t.player?{icon:"mdi:monitor-screenshot",...e.menu.buttons.screenshot,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.screenshot"),tap_action:gf("screenshot")}:null}_getDisplayModeButton(e,t,n){const a=n?mx(t,n.view):null;if(n?.supportsMultipleDisplayModes()&&a&&a.size>1){const t=n.isGrid();return{icon:t?"mdi:grid-off":"mdi:grid",...e.menu.buttons.display_mode,style:t?this._getEmphasizedStyle():{},type:"custom:frigate-card-menu-icon",title:V_(t?"display_modes.single":"display_modes.grid"),tap_action:(i=t?"single":"grid",{action:"fire-dom-event",frigate_card_action:"display_mode_select",display_mode:i,...r?.cardID&&{card_id:r.cardID}})}}var i,r;return null}_getPTZControlsButton(e,t,n){const a=n?.is("live")?e.live.controls.ptz:n?.isViewerView()?e.media_viewer.controls.ptz:null;if(!n||!a||"off"===a.mode)return null;const i=Ry(n,{cameraManager:t,..."auto"===a.mode&&{type:"ptz"}});if(i){const t=!1!==n.context?.ptzControls?.enabled&&("on"===a.mode||"auto"===a.mode&&"ptz"===i.type);return{icon:"mdi:pan",...e.menu.buttons.ptz_controls,style:t?this._getEmphasizedStyle():{},type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.ptz_controls"),tap_action:(r=!t,{action:"fire-dom-event",frigate_card_action:"ptz_controls",enabled:r,...o?.cardID&&{card_id:o.cardID}})}}var r,o;return null}_getPTZHomeButton(e,t,n){const a=n?Ry(n,{cameraManager:t}):null;return!a||(("digital"===a.type&&n?.context?.zoom?.[a.targetID]?.observed?.isDefault)??1)?null:{icon:"mdi:home",...e.menu.buttons.ptz_home,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.ptz_home"),tap_action:vf({targetID:a.targetID})}}_getEmphasizedStyle(e){return e?{animation:"pulse 3s infinite",color:"var(--error-color, white)"}:{color:"var(--primary-color, white)"}}_getStyleFromActions(e,t,n){for(const a of[t.tap_action,t.double_tap_action,t.hold_action,t.start_tap_action,t.end_tap_action]){const t=Array.isArray(a)?a:[a];for(const a of t){if(!a||"fire-dom-event"!==a.action||!("frigate_card_action"in a))continue;const t=a;if(Zs.some((e=>e===t.frigate_card_action&&n?.view?.is(t.frigate_card_action)))||"default"===t.frigate_card_action&&n?.view?.is(e.view.default)||"fullscreen"===t.frigate_card_action&&n?.inFullscreenMode||"camera_select"===t.frigate_card_action&&n?.view?.camera===t.camera)return this._getEmphasizedStyle()}}return{}}_isBeingCasted(){return!!navigator.userAgent.match(/CrKey\//)}} +/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */ +function Ix(e){return null==e}var Tx=function(e,t){var n,a="";for(n=0;ns&&(t=a-s+(r=" ... ").length),n-a>s&&(n=a+s-(o=" ...").length),{str:r+e.slice(t,n).replace(/\t/g,"→")+o,pos:a-t+r.length}}function Lx(e,t){return jx.repeat(" ",t-e.length)+e}var Nx=function(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),"number"!=typeof t.indent&&(t.indent=1),"number"!=typeof t.linesBefore&&(t.linesBefore=3),"number"!=typeof t.linesAfter&&(t.linesAfter=2);for(var n,a=/\r?\n|\r|\0/g,i=[0],r=[],o=-1;n=a.exec(e.buffer);)r.push(n.index),i.push(n.index+n[0].length),e.position<=n.index&&o<0&&(o=i.length-2);o<0&&(o=i.length-1);var s,c,l="",d=Math.min(e.line+t.linesAfter,r.length).toString().length,u=t.maxLength-(t.indent+d+3);for(s=1;s<=t.linesBefore&&!(o-s<0);s++)c=Px(e.buffer,i[o-s],r[o-s],e.position-(i[o]-i[o-s]),u),l=jx.repeat(" ",t.indent)+Lx((e.line-s+1).toString(),d)+" | "+c.str+"\n"+l;for(c=Px(e.buffer,i[o],r[o],e.position,u),l+=jx.repeat(" ",t.indent)+Lx((e.line+1).toString(),d)+" | "+c.str+"\n",l+=jx.repeat("-",t.indent+d+3+c.pos)+"^\n",s=1;s<=t.linesAfter&&!(o+s>=r.length);s++)c=Px(e.buffer,i[o+s],r[o+s],e.position-(i[o]-i[o+s]),u),l+=jx.repeat(" ",t.indent)+Lx((e.line+s+1).toString(),d)+" | "+c.str+"\n";return l.replace(/\n$/,"")},Fx=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],Vx=["scalar","sequence","mapping"];var Hx=function(e,t){if(t=t||{},Object.keys(t).forEach((function(t){if(-1===Fx.indexOf(t))throw new Rx('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')})),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=function(e){var t={};return null!==e&&Object.keys(e).forEach((function(n){e[n].forEach((function(e){t[String(e)]=n}))})),t}(t.styleAliases||null),-1===Vx.indexOf(this.kind))throw new Rx('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')};function Bx(e,t){var n=[];return e[t].forEach((function(e){var t=n.length;n.forEach((function(n,a){n.tag===e.tag&&n.kind===e.kind&&n.multi===e.multi&&(t=a)})),n[t]=e})),n}function qx(e){return this.extend(e)}qx.prototype.extend=function(e){var t=[],n=[];if(e instanceof Hx)n.push(e);else if(Array.isArray(e))n=n.concat(e);else{if(!e||!Array.isArray(e.implicit)&&!Array.isArray(e.explicit))throw new Rx("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit))}t.forEach((function(e){if(!(e instanceof Hx))throw new Rx("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(e.loadKind&&"scalar"!==e.loadKind)throw new Rx("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(e.multi)throw new Rx("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")})),n.forEach((function(e){if(!(e instanceof Hx))throw new Rx("Specified list of YAML types (or a single Type object) contains a non-Type object.")}));var a=Object.create(qx.prototype);return a.implicit=(this.implicit||[]).concat(t),a.explicit=(this.explicit||[]).concat(n),a.compiledImplicit=Bx(a,"implicit"),a.compiledExplicit=Bx(a,"explicit"),a.compiledTypeMap=function(){var e,t,n={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function a(e){e.multi?(n.multi[e.kind].push(e),n.multi.fallback.push(e)):n[e.kind][e.tag]=n.fallback[e.tag]=e}for(e=0,t=arguments.length;e=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),nC=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var aC=/^[-+]?[0-9]+e/;var iC=new Hx("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!nC.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||jx.isNegativeZero(e))},represent:function(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(jx.isNegativeZero(e))return"-0.0";return n=e.toString(10),aC.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"}),rC=Gx.extend({implicit:[Yx,Kx,tC,iC]}),oC=rC,sC=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),cC=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");var lC=new Hx("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==sC.exec(e)||null!==cC.exec(e))},construct:function(e){var t,n,a,i,r,o,s,c,l=0,d=null;if(null===(t=sC.exec(e))&&(t=cC.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],a=+t[2]-1,i=+t[3],!t[4])return new Date(Date.UTC(n,a,i));if(r=+t[4],o=+t[5],s=+t[6],t[7]){for(l=t[7].slice(0,3);l.length<3;)l+="0";l=+l}return t[9]&&(d=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(d=-d)),c=new Date(Date.UTC(n,a,i,r,o,s,l)),d&&c.setTime(c.getTime()-d),c},instanceOf:Date,represent:function(e){return e.toISOString()}});var dC=new Hx("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}}),uC="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";var hC=new Hx("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,a=0,i=e.length,r=uC;for(n=0;n64)){if(t<0)return!1;a+=6}return a%8==0},construct:function(e){var t,n,a=e.replace(/[\r\n=]/g,""),i=a.length,r=uC,o=0,s=[];for(t=0;t>16&255),s.push(o>>8&255),s.push(255&o)),o=o<<6|r.indexOf(a.charAt(t));return 0===(n=i%4*6)?(s.push(o>>16&255),s.push(o>>8&255),s.push(255&o)):18===n?(s.push(o>>10&255),s.push(o>>2&255)):12===n&&s.push(o>>4&255),new Uint8Array(s)},predicate:function(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)},represent:function(e){var t,n,a="",i=0,r=e.length,o=uC;for(t=0;t>18&63],a+=o[i>>12&63],a+=o[i>>6&63],a+=o[63&i]),i=(i<<8)+e[t];return 0===(n=r%3)?(a+=o[i>>18&63],a+=o[i>>12&63],a+=o[i>>6&63],a+=o[63&i]):2===n?(a+=o[i>>10&63],a+=o[i>>4&63],a+=o[i<<2&63],a+=o[64]):1===n&&(a+=o[i>>2&63],a+=o[i<<4&63],a+=o[64],a+=o[64]),a}}),pC=Object.prototype.hasOwnProperty,mC=Object.prototype.toString;var gC=new Hx("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,a,i,r,o=[],s=e;for(t=0,n=s.length;t>10),56320+(e-65536&1023))}for(var qC=new Array(256),UC=new Array(256),WC=0;WC<256;WC++)qC[WC]=HC(WC)?1:0,UC[WC]=HC(WC);function ZC(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||bC,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function QC(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=Nx(n),new Rx(t,n)}function GC(e,t){throw QC(e,t)}function YC(e,t){e.onWarning&&e.onWarning.call(null,QC(e,t))}var KC={YAML:function(e,t,n){var a,i,r;null!==e.version&&GC(e,"duplication of %YAML directive"),1!==n.length&&GC(e,"YAML directive accepts exactly one argument"),null===(a=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&GC(e,"ill-formed argument of the YAML directive"),i=parseInt(a[1],10),r=parseInt(a[2],10),1!==i&&GC(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=r<2,1!==r&&2!==r&&YC(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var a,i;2!==n.length&&GC(e,"TAG directive accepts exactly two arguments"),a=n[0],i=n[1],TC.test(a)||GC(e,"ill-formed tag handle (first argument) of the TAG directive"),wC.call(e.tagMap,a)&&GC(e,'there is a previously declared suffix for "'+a+'" tag handle'),jC.test(i)||GC(e,"ill-formed tag prefix (second argument) of the TAG directive");try{i=decodeURIComponent(i)}catch(t){GC(e,"tag prefix is malformed: "+i)}e.tagMap[a]=i}};function XC(e,t,n,a){var i,r,o,s;if(t1&&(e.result+=jx.repeat("\n",t-1))}function rM(e,t){var n,a,i=e.tag,r=e.anchor,o=[],s=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=o),a=e.input.charCodeAt(e.position);0!==a&&(-1!==e.firstTabInLine&&(e.position=e.firstTabInLine,GC(e,"tab characters must not be used in indentation")),45===a)&&PC(e.input.charCodeAt(e.position+1));)if(s=!0,e.position++,nM(e,!0,-1)&&e.lineIndent<=t)o.push(null),a=e.input.charCodeAt(e.position);else if(n=e.line,cM(e,t,MC,!1,!0),o.push(e.result),nM(e,!0,-1),a=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==a)GC(e,"bad indentation of a sequence entry");else if(e.lineIndentt?m=1:e.lineIndent===t?m=0:e.lineIndentt?m=1:e.lineIndent===t?m=0:e.lineIndentt)&&(_&&(o=e.line,s=e.lineStart,c=e.position),cM(e,t,kC,!0,i)&&(_?g=e.result:f=e.result),_||(eM(e,h,p,m,g,f,o,s,c),m=g=f=null),nM(e,!0,-1),l=e.input.charCodeAt(e.position)),(e.line===r||e.lineIndent>t)&&0!==l)GC(e,"bad indentation of a mapping entry");else if(e.lineIndent=0))break;0===i?GC(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):c?GC(e,"repeat of an indentation width identifier"):(l=t+i-1,c=!0)}if(RC(r)){do{r=e.input.charCodeAt(++e.position)}while(RC(r));if(35===r)do{r=e.input.charCodeAt(++e.position)}while(!DC(r)&&0!==r)}for(;0!==r;){for(tM(e),e.lineIndent=0,r=e.input.charCodeAt(e.position);(!c||e.lineIndentl&&(l=e.lineIndent),DC(r))d++;else{if(e.lineIndent0){for(i=o,r=0;i>0;i--)(o=NC(s=e.input.charCodeAt(++e.position)))>=0?r=(r<<4)+o:GC(e,"expected hexadecimal character");e.result+=BC(r),e.position++}else GC(e,"unknown escape sequence");n=a=e.position}else DC(s)?(XC(e,n,a,!0),iM(e,nM(e,!1,t)),n=a=e.position):e.position===e.lineStart&&aM(e)?GC(e,"unexpected end of the document within a double quoted scalar"):(e.position++,a=e.position)}GC(e,"unexpected end of the stream within a double quoted scalar")}(e,h)?f=!0:!function(e){var t,n,a;if(42!==(a=e.input.charCodeAt(e.position)))return!1;for(a=e.input.charCodeAt(++e.position),t=e.position;0!==a&&!PC(a)&&!LC(a);)a=e.input.charCodeAt(++e.position);return e.position===t&&GC(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),wC.call(e.anchorMap,n)||GC(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],nM(e,!0,-1),!0}(e)?function(e,t,n){var a,i,r,o,s,c,l,d,u=e.kind,h=e.result;if(PC(d=e.input.charCodeAt(e.position))||LC(d)||35===d||38===d||42===d||33===d||124===d||62===d||39===d||34===d||37===d||64===d||96===d)return!1;if((63===d||45===d)&&(PC(a=e.input.charCodeAt(e.position+1))||n&&LC(a)))return!1;for(e.kind="scalar",e.result="",i=r=e.position,o=!1;0!==d;){if(58===d){if(PC(a=e.input.charCodeAt(e.position+1))||n&&LC(a))break}else if(35===d){if(PC(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&aM(e)||n&&LC(d))break;if(DC(d)){if(s=e.line,c=e.lineStart,l=e.lineIndent,nM(e,!1,-1),e.lineIndent>=t){o=!0,d=e.input.charCodeAt(e.position);continue}e.position=r,e.line=s,e.lineStart=c,e.lineIndent=l;break}}o&&(XC(e,i,r,!1),iM(e,e.line-s),i=r=e.position,o=!1),RC(d)||(r=e.position+1),d=e.input.charCodeAt(++e.position)}return XC(e,i,r,!1),!!e.result||(e.kind=u,e.result=h,!1)}(e,h,xC===n)&&(f=!0,null===e.tag&&(e.tag="?")):(f=!0,null===e.tag&&null===e.anchor||GC(e,"alias node should not have any properties")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===m&&(f=s&&rM(e,p))),null===e.tag)null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);else if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&GC(e,'unacceptable node kind for ! tag; it should be "scalar", not "'+e.kind+'"'),c=0,l=e.implicitTypes.length;c"),null!==e.result&&u.kind!==e.kind&&GC(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+u.kind+'", not "'+e.kind+'"'),u.resolve(e.result,e.tag)?(e.result=u.construct(e.result,e.tag),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):GC(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||f}function lM(e){var t,n,a,i,r=e.position,o=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);0!==(i=e.input.charCodeAt(e.position))&&(nM(e,!0,-1),i=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==i));){for(o=!0,i=e.input.charCodeAt(++e.position),t=e.position;0!==i&&!PC(i);)i=e.input.charCodeAt(++e.position);for(a=[],(n=e.input.slice(t,e.position)).length<1&&GC(e,"directive name must not be less than one character in length");0!==i;){for(;RC(i);)i=e.input.charCodeAt(++e.position);if(35===i){do{i=e.input.charCodeAt(++e.position)}while(0!==i&&!DC(i));break}if(DC(i))break;for(t=e.position;0!==i&&!PC(i);)i=e.input.charCodeAt(++e.position);a.push(e.input.slice(t,e.position))}0!==i&&tM(e),wC.call(KC,n)?KC[n](e,n,a):YC(e,'unknown document directive "'+n+'"')}nM(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,nM(e,!0,-1)):o&&GC(e,"directives end mark is expected"),cM(e,e.lineIndent-1,kC,!1,!0),nM(e,!0,-1),e.checkLineBreaks&&zC.test(e.input.slice(r,e.position))&&YC(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&aM(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,nM(e,!0,-1)):e.position=55296&&a<=56319&&t+1=56320&&n<=57343?1024*(a-55296)+n-56320+65536:a}function JM(e){return/^\n* /.test(e)}var ek=1,tk=2,nk=3,ak=4,ik=5;function rk(e,t,n,a,i,r,o,s){var c,l=0,d=null,u=!1,h=!1,p=-1!==a,m=-1,g=function(e){return GM(e)&&e!==mM&&!QM(e)&&e!==EM&&e!==IM&&e!==$M&&e!==SM&&e!==jM&&e!==OM&&e!==RM&&e!==LM&&e!==wM&&e!==CM&&e!==kM&&e!==yM&&e!==PM&&e!==AM&&e!==zM&&e!==MM&&e!==bM&&e!==xM&&e!==TM&&e!==DM}(XM(e,0))&&function(e){return!QM(e)&&e!==$M}(XM(e,e.length-1));if(t||o)for(c=0;c=65536?c+=2:c++){if(!GM(l=XM(e,c)))return ik;g=g&&KM(l,d,s),d=l}else{for(c=0;c=65536?c+=2:c++){if((l=XM(e,c))===fM)u=!0,p&&(h=h||c-m-1>a&&" "!==e[m+1],m=c);else if(!GM(l))return ik;g=g&&KM(l,d,s),d=l}h=h||p&&c-m-1>a&&" "!==e[m+1]}return u||h?n>9&&JM(e)?ik:o?r===qM?ik:tk:h?ak:nk:!g||o||i(e)?r===qM?ik:tk:ek}function ok(e,t,n,a,i){e.dump=function(){if(0===t.length)return e.quotingType===qM?'""':"''";if(!e.noCompatMode&&(-1!==FM.indexOf(t)||VM.test(t)))return e.quotingType===qM?'"'+t+'"':"'"+t+"'";var r=e.indent*Math.max(1,n),o=-1===e.lineWidth?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-r),s=a||e.flowLevel>-1&&n>=e.flowLevel;switch(rk(t,s,e.indent,o,(function(t){return function(e,t){var n,a;for(n=0,a=e.implicitTypes.length;n"+sk(t,e.indent)+ck(WM(function(e,t){var n,a,i=/(\n+)([^\n]*)/g,r=(s=e.indexOf("\n"),s=-1!==s?s:e.length,i.lastIndex=s,lk(e.slice(0,s),t)),o="\n"===e[0]||" "===e[0];var s;for(;a=i.exec(e);){var c=a[1],l=a[2];n=" "===l[0],r+=c+(o||n||""===l?"":"\n")+lk(l,t),o=n}return r}(t,o),r));case ik:return'"'+function(e){for(var t,n="",a=0,i=0;i=65536?i+=2:i++)a=XM(e,i),!(t=NM[a])&&GM(a)?(n+=e[i],a>=65536&&(n+=e[i+1])):n+=t||HM(a);return n}(t)+'"';default:throw new Rx("impossible error: invalid scalar style")}}()}function sk(e,t){var n=JM(e)?String(t):"",a="\n"===e[e.length-1];return n+(a&&("\n"===e[e.length-2]||"\n"===e)?"+":a?"":"-")+"\n"}function ck(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function lk(e,t){if(""===e||" "===e[0])return e;for(var n,a,i=/ [^ ]/g,r=0,o=0,s=0,c="";n=i.exec(e);)(s=n.index)-r>t&&(a=o>r?o:s,c+="\n"+e.slice(r,a),r=a+1),o=s;return c+="\n",e.length-r>t&&o>r?c+=e.slice(r,o)+"\n"+e.slice(o+1):c+=e.slice(r),c.slice(1)}function dk(e,t,n,a){var i,r,o,s="",c=e.tag;for(i=0,r=n.length;i tag resolver accepts not "'+c+'" style');a=s.represent[c](t,c)}e.dump=a}return!0}return!1}function hk(e,t,n,a,i,r,o){e.tag=null,e.dump=n,uk(e,n,!1)||uk(e,n,!0);var s,c=hM.call(e.dump),l=a;a&&(a=e.flowLevel<0||e.flowLevel>t);var d,u,h="[object Object]"===c||"[object Array]"===c;if(h&&(u=-1!==(d=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||u||2!==e.indent&&t>0)&&(i=!1),u&&e.usedDuplicates[d])e.dump="*ref_"+d;else{if(h&&u&&!e.usedDuplicates[d]&&(e.usedDuplicates[d]=!0),"[object Object]"===c)a&&0!==Object.keys(e.dump).length?(!function(e,t,n,a){var i,r,o,s,c,l,d="",u=e.tag,h=Object.keys(n);if(!0===e.sortKeys)h.sort();else if("function"==typeof e.sortKeys)h.sort(e.sortKeys);else if(e.sortKeys)throw new Rx("sortKeys must be a boolean or a function");for(i=0,r=h.length;i1024)&&(e.dump&&fM===e.dump.charCodeAt(0)?l+="?":l+="? "),l+=e.dump,c&&(l+=ZM(e,t)),hk(e,t+1,s,!0,c)&&(e.dump&&fM===e.dump.charCodeAt(0)?l+=":":l+=": ",d+=l+=e.dump));e.tag=u,e.dump=d||"{}"}(e,t,e.dump,i),u&&(e.dump="&ref_"+d+e.dump)):(!function(e,t,n){var a,i,r,o,s,c="",l=e.tag,d=Object.keys(n);for(a=0,i=d.length;a1024&&(s+="? "),s+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),hk(e,t,o,!1,!1)&&(c+=s+=e.dump));e.tag=l,e.dump="{"+c+"}"}(e,t,e.dump),u&&(e.dump="&ref_"+d+" "+e.dump));else if("[object Array]"===c)a&&0!==e.dump.length?(e.noArrayIndent&&!o&&t>0?dk(e,t-1,e.dump,i):dk(e,t,e.dump,i),u&&(e.dump="&ref_"+d+e.dump)):(!function(e,t,n){var a,i,r,o="",s=e.tag;for(a=0,i=n.length;a",e.dump=s+" "+e.dump)}return!0}function pk(e,t){var n,a,i=[],r=[];for(mk(e,i,r),n=0,a=r.length;nq`
${fk.dump(e)}
`;return q`
+
+
+ +
+
+ + ${this.message?q`${this.message}${this.context&&"string"==typeof this.context?": "+this.context:""}`:""} + + ${this.context&&Array.isArray(this.context)?this.context.map((e=>n(e))):"object"==typeof this.context?n(this.context):""} +
+
+
`}static get styles(){return o(_k)}};e([he({attribute:!1})],vk.prototype,"message",void 0),e([he({attribute:!1})],vk.prototype,"context",void 0),e([he({attribute:!1})],vk.prototype,"icon",void 0),e([he({attribute:!0,type:Boolean})],vk.prototype,"dotdotdot",void 0),vk=e([le("frigate-card-message")],vk);let yk=class extends se{render(){if(this.message)return q` ${V_("error.troubleshooting")}.`} + .icon=${this.message.icon??"mdi:alert-circle"} + .context=${this.message.context} + .dotdotdot=${this.message.dotdotdot} + > + `}static get styles(){return o(_k)}};e([he({attribute:!1})],yk.prototype,"message",void 0),yk=e([le("frigate-card-error-message")],yk);let bk=class extends se{constructor(){super(...arguments),this.message="",this.animated=!1,this.size="large"}render(){return q`
+ ${this.animated?q` + `:q``} + ${this.message?q`${this.message}`:q``} +
`}static get styles(){return o(_k)}};function wk(e){return"error"===e?.type?q` `:e?q` `:q``}function xk(e){return q` + + + `}function Ck(e,t,n,a){Bg(e,"message",{message:t,type:n,icon:a?.icon,context:a?.context})}function Mk(e,t,n){Ck(e,t,"error",{context:n?.context})}function kk(e,t){t instanceof Error&&Mk(e,t.message,{...t instanceof zs&&{context:t.context}})}e([he({attribute:!1})],bk.prototype,"message",void 0),e([he({attribute:!1})],bk.prototype,"animated",void 0),e([he({attribute:!1})],bk.prototype,"size",void 0),bk=e([le("frigate-card-progress-indicator")],bk);let Sk=class extends se{constructor(){super(...arguments),this._root=null}createRenderRoot(){return this}_createRoot(){const e=customElements.get("hui-conditional-element");if(!e||!this.hass)throw new Error(V_("error.could_not_render_elements"));const t=new e;t.hass=this.hass;const n={type:"conditional",conditions:[],elements:this.elements};try{t.setConfig(n)}catch(e){throw Gg(e,console.error),new zs(V_("error.invalid_elements_config"))}return t}willUpdate(e){try{!this.elements||this._root&&!e.has("elements")||(this._root=this._createRoot())}catch(e){return kk(this,e)}}render(){return q`${this._root||""}`}updated(){this.hass&&this._root&&(this._root.hass=this.hass)}};e([he({attribute:!1})],Sk.prototype,"elements",void 0),e([he({attribute:!1})],Sk.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],Sk.prototype,"hass",void 0),Sk=e([le("frigate-card-elements-core")],Sk);let Ek=class extends se{constructor(){super(...arguments),this._menuRemoveHandler=e=>{Bg(this,"menu:remove",e.detail)},this._statusBarRemoveHandler=e=>{Bg(this,"status-bar:remove",e.detail)},this._menuAddHandler=e=>{const t=e.composedPath();t.length&&this._addHandler(t[0],"frigate-card:menu:remove",this._menuRemoveHandler)},this._statusBarAddHandler=e=>{const t=e.composedPath();t.length&&this._addHandler(t[0],"frigate-card:status-bar:add",this._statusBarRemoveHandler)}}_addHandler(e,t,n){e.removeEventListener(t,n),e.addEventListener(t,n)}connectedCallback(){super.connectedCallback(),this.addEventListener("frigate-card:menu:add",this._menuAddHandler),this.addEventListener("frigate-card:status-bar:add",this._statusBarAddHandler)}disconnectedCallback(){this.removeEventListener("frigate-card:menu:add",this._menuAddHandler),this.addEventListener("frigate-card:status-bar:add",this._statusBarAddHandler),super.disconnectedCallback()}render(){return q` + `}static get styles(){return o(":host {\n position: absolute;\n inset: 0;\n overflow: hidden;\n pointer-events: none;\n}\n\n.element {\n position: absolute;\n transform: translate(-50%, -50%);\n pointer-events: auto;\n}\n\nhui-error-card.element {\n inset: 0px;\n transform: unset;\n}")}};e([he({attribute:!1})],Ek.prototype,"hass",void 0),e([he({attribute:!1})],Ek.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],Ek.prototype,"elements",void 0),Ek=e([le("frigate-card-elements")],Ek);let $k=class extends se{setConfig(e){this._config=e}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.className=""}render(){if(function(e,t){if(!t)return!0;const n=new _w(t,{bubbles:!0,composed:!0});return e.dispatchEvent(n),n.evaluation??!1}(this,this._config?.conditions))return q` + `}};e([he({attribute:!1,hasChanged:()=>!0})],$k.prototype,"hass",void 0),$k=e([le("frigate-card-conditional")],$k);class Ak extends se{constructor(e){super(),this._config=null,this._eventCategory=e}setConfig(e){this._config=e}connectedCallback(){super.connectedCallback(),this._config&&Bg(this,`${this._eventCategory}:add`,this._config)}disconnectedCallback(){this._config&&Bg(this,`${this._eventCategory}:remove`,this._config),super.disconnectedCallback()}}e([pe()],Ak.prototype,"_config",void 0);class zk extends Ak{constructor(){super("menu")}}let Ik=class extends zk{};Ik=e([le("frigate-card-menu-icon")],Ik);let Tk=class extends zk{};Tk=e([le("frigate-card-menu-state-icon")],Tk);let jk=class extends zk{};jk=e([le("frigate-card-menu-submenu")],jk);let Ok=class extends zk{};Ok=e([le("frigate-card-menu-submenu-select")],Ok);class Dk extends Ak{constructor(){super("status-bar")}}let Rk=class extends Dk{};Rk=e([le("frigate-card-status-bar-icon")],Rk);let Pk=class extends Dk{};Pk=e([le("frigate-card-status-bar-image")],Pk);let Lk=class extends Dk{};Lk=e([le("frigate-card-status-bar-string")],Lk);let Nk=class extends se{render(){return q` `}static get styles(){return o(":host {\n width: intrinsic;\n height: intrinsic;\n display: flex;\n justify-content: center;\n align-items: center;\n pointer-events: none;\n}\n\nimg {\n width: 10%;\n animation: rotate 8s linear infinite;\n}\n\n@keyframes rotate {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}")}};Nk=e([le("frigate-card-loading")],Nk);const Fk=(e,t)=>{Bg(e,"action:execution-request",t)};class Vk{constructor(e){this._config=null,this._buttons=[],this._expanded=!1,this._host=e}setMenuConfig(e){this._config=e,this._host.style.setProperty("--frigate-card-menu-button-size",`${e.button_size}px`),this._host.setAttribute("data-style",e.style),this._host.setAttribute("data-position",e.position),this._host.setAttribute("data-alignment",e.alignment),this._sortButtons(),this._host.requestUpdate()}getMenuConfig(){return this._config}isExpanded(){return this._expanded}setButtons(e){this._buttons=e,this._sortButtons(),this._host.requestUpdate()}getButtons(e){const t=e=>!this._isHidingMenu()||this._expanded||!!e.permanent;return this._buttons.filter((n=>(e=>!1!==e.enabled)(n)&&(t=>t.alignment===e||"matching"===e&&!t.alignment)(n)&&t(n)))}setExpanded(e){this._expanded=e,of(this._host,e,"expanded"),this._host.requestUpdate()}toggleExpanded(){this.setExpanded(!this._expanded)}actionHandler(e,t){if(e.stopPropagation(),e.detail.config&&(t=e.detail.config),!t)return;const n=e.detail.action,a=yf(n,t);if(!a)return;const i=Wg(a);let r=!1;const o=i.filter((e=>sf(e)&&!this._isUnknownActionMenuToggleAction(e)));if(o.length!=i.length&&(r=!0),o.length&&Fk(this._host,{action:i,config:t}),this._isHidingMenu())if(r)this.setExpanded(!this._expanded);else{const e=yf("hold",t),a=yf("double_tap",t),i=yf("tap",t),r=yf("end_tap",t);"end_tap"!==n&&("start_tap"!==n||e||a||i||r)&&("end_tap"===n||r)||this.setExpanded(!1)}}getFreshButtonState(e,t){const n={...t};return e&&"custom:frigate-card-menu-state-icon"===t.type?Pb(e,n):n}_sortButtons(){this._buttons=Ev(this._buttons,(e=>(e.priority??0)+(this._isHidingMenu()&&e.permanent?Us:0)),["desc"])}_isHidingMenu(){return"hidden"===this._config?.style}_isUnknownActionMenuToggleAction(e){const t=mf(e);return!!t&&"menu_toggle"==t.frigate_card_action}}var Hk="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' version='1.1' id='svg54' sodipodi:docname='frigate.svg' inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3e %3cdefs id='defs58' /%3e %3csodipodi:namedview id='namedview56' pagecolor='%23da4040' bordercolor='%23666666' borderopacity='1.0' inkscape:pageshadow='2' inkscape:pageopacity='0' inkscape:pagecheckerboard='0' showgrid='false' width='24px' inkscape:zoom='45.254834' inkscape:cx='-0.03314563' inkscape:cy='9.9768347' inkscape:window-width='3840' inkscape:window-height='1527' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='svg54' showguides='true' inkscape:showpageshadow='2' inkscape:deskcolor='%23d1d1d1' /%3e %3cpath d='m 4.8759466%2c22.743573 c 0.0866%2c0.69274 0.811811%2c1.16359 0.37885%2c1.27183 -0.43297%2c0.10824 -2.32718%2c-3.43665 -2.7601492%2c-4.95202 -0.4329602%2c-1.51538 -0.6764993%2c-3.22017 -0.5682593%2c-4.19434 0.1082301%2c-0.97417 5.7097085%2c-2.48955 5.7097085%2c-2.89545 0%2c-0.4059 -1.81304%2c-0.0271 -1.89422%2c-0.35178 -0.0812%2c-0.32472 1.36925%2c-0.12989 1.75892%2c-0.64945 0.60885%2c-0.81181 1.3800713%2c-0.6765 1.8671505%2c-1.1094696 0.4870902%2c-0.4329599 1.0824089%2c-2.0836399 1.1906589%2c-2.7871996 0.108241%2c-0.70357 -1.0824084%2c-1.51538 -1.4071389%2c-2.05658 -0.3247195%2c-0.54121 0.7035702%2c-0.92005 3.1931099%2c-1.94834 2.48954%2c-1.02829 10.39114%2c-3.30134994 10.49938%2c-3.03074994 0.10824%2c0.27061 -2.59779%2c1.40713994 -4.492%2c2.11069994 -1.89422%2c0.70357 -4.97909%2c2.05658 -4.97909%2c2.43542 0%2c0.37885 0.16236%2c0.67651 0.0541%2c1.54244 -0.10824%2c0.86593 -0.12123%2c1.2702597 -0.32472%2c1.8400997 -0.1353%2c0.37884 -0.2706%2c1.27183 0%2c2.0836295 0.21648%2c0.64945 0.92005%2c1.13653 1.24477%2c1.24478 0.2706%2c0.018 1.01746%2c0.0433 1.8401%2c0 1.02829%2c-0.0541 2.48954%2c0.0541 2.48954%2c0.32472 0%2c0.2706 -2.21894%2c0.10824 -2.21894%2c0.48708 0%2c0.37885 2.27306%2c-0.0541 2.21894%2c0.32473 -0.0541%2c0.37884 -1.89422%2c0.21648 -2.86839%2c0.21648 -0.77933%2c0 -1.93031%2c-0.0361 -2.43542%2c-0.21648 l -0.10824%2c0.37884 c -0.18038%2c0 -0.55744%2c0.10824 -0.94711%2c0.10824 -0.48708%2c0 -0.51414%2c0.16236 -1.40713%2c0.16236 -0.892989%2c0 -0.622391%2c-0.0541 -1.4341894%2c-0.10824 -0.81181%2c-0.0541 -3.842561%2c2.27306 -4.383761%2c3.03075 -0.54121%2c0.75768 -0.21649%2c2.59778 -0.21649%2c3.43665 0%2c0.75379 -0.10824%2c2.43542 0%2c3.30135 z' fill='black' id='path330' style='fill:white%3bfill-opacity:1%3bstroke:none%3bstroke-width:0.1%3bstroke-miterlimit:4%3bstroke-dasharray:none%3bstroke-opacity:1' sodipodi:nodetypes='csccscccccsscscccccsscsccssccscc' /%3e%3c/svg%3e",Bk="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3c!-- Created with Inkscape (http://www.inkscape.org/) --%3e%3csvg id='svg2' version='1.1' inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' width='24' height='24' xml:space='preserve' sodipodi:docname='motioneye.svg' inkscape:export-filename='/home/ccrisan/projects/motioneye/static/img/motioneye-logo.png' inkscape:export-xdpi='960' inkscape:export-ydpi='960' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23' xmlns:cc='http://creativecommons.org/ns%23' xmlns:dc='http://purl.org/dc/elements/1.1/'%3e%3cmetadata id='metadata8'%3e%3crdf:RDF%3e%3ccc:Work rdf:about=''%3e%3cdc:format%3eimage/svg%2bxml%3c/dc:format%3e%3cdc:type rdf:resource='http://purl.org/dc/dcmitype/StillImage' /%3e%3c/cc:Work%3e%3c/rdf:RDF%3e%3c/metadata%3e%3cdefs id='defs6'%3e%3clinearGradient inkscape:collect='always' id='linearGradient2058'%3e%3cstop style='stop-color:white%3bstop-opacity:1%3b' offset='0' id='stop2054' /%3e%3cstop style='stop-color:%23585858%3bstop-opacity:1' offset='1' id='stop2056' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' id='linearGradient2005'%3e%3cstop style='stop-color:white%3bstop-opacity:1%3b' offset='0' id='stop2001' /%3e%3cstop style='stop-color:grey%3bstop-opacity:1%3b' offset='1' id='stop2003' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' id='linearGradient4205'%3e%3cstop style='stop-color:%234aa3e0%3bstop-opacity:1' offset='0' id='stop4207' /%3e%3cstop style='stop-color:%233096db%3bstop-opacity:1' offset='1' id='stop4209' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' id='linearGradient4197'%3e%3cstop style='stop-color:white%3bstop-opacity:1%3b' offset='0' id='stop4199' /%3e%3cstop style='stop-color:%23585858%3bstop-opacity:1' offset='1' id='stop4201' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient4205' id='linearGradient4211' x1='26.602072' y1='43.034946' x2='26.602072' y2='29.466328' gradientUnits='userSpaceOnUse' gradientTransform='matrix(0.96428571%2c0%2c0%2c0.96428571%2c0.91428571%2c0.91428571)' /%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4285'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4287' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4289' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.6' result='blur' id='feGaussianBlur4291' /%3e%3cfeOffset dx='0' dy='-1' result='offset' id='feOffset4293' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4295' /%3e%3c/filter%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient2005' id='linearGradient4309' gradientUnits='userSpaceOnUse' x1='26.445793' y1='47.517574' x2='26.445793' y2='3.8183768' /%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient4197' id='linearGradient4311' gradientUnits='userSpaceOnUse' x1='26.445793' y1='47.517574' x2='26.445793' y2='3.8183768' /%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient2058' id='linearGradient4313' gradientUnits='userSpaceOnUse' x1='26.445793' y1='47.517574' x2='26.445793' y2='3.8183768' /%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4315' x='-0.03618178' y='-0.20783284' width='1.0723636' height='1.3304883'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4317' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4319' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.6' result='blur' id='feGaussianBlur4321' /%3e%3cfeOffset dx='0' dy='-1' result='offset' id='feOffset4323' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4325' /%3e%3c/filter%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4327' x='-0.27857143' y='-0.4720238' width='1.5571429' height='1.7505952'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4329' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4331' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.6' result='blur' id='feGaussianBlur4333' /%3e%3cfeOffset dx='0' dy='-1' result='offset' id='feOffset4335' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4337' /%3e%3c/filter%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4339' x='-0.0202507' y='-0.13980794' width='1.0405014' height='1.2082853'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4341' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4343' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.2' result='blur' id='feGaussianBlur4345' /%3e%3cfeOffset dx='0' dy='-0.5' result='offset' id='feOffset4347' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4349' /%3e%3c/filter%3e%3c/defs%3e%3csodipodi:namedview pagecolor='%23ff0d0d' bordercolor='%23666666' borderopacity='1' objecttolerance='10' gridtolerance='10' guidetolerance='10' inkscape:pageopacity='0' inkscape:pageshadow='2' inkscape:window-width='3840' inkscape:window-height='1527' id='namedview4' showgrid='false' inkscape:zoom='29.890116' inkscape:cx='19.973158' inkscape:cy='16.577386' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='g10' showguides='true' inkscape:guide-bbox='true' inkscape:showpageshadow='true' inkscape:pagecheckerboard='false' inkscape:deskcolor='%23d1d1d1' /%3e%3cg id='g10' inkscape:groupmode='layer' inkscape:label='ink_ext_XXXXXX' transform='matrix(1.25%2c0%2c0%2c-1.25%2c0%2c64)'%3e%3cg id='g4823' transform='matrix(1.0344694%2c0%2c0%2c1.0344694%2c-3.551886%2c-0.86695248)'%3e%3cpath id='path4244' d='M 8.9346154%2c40.515385 C 5.3647588%2c36.547307 3.2%2c31.357779 3.2%2c25.6 3.2%2c13.228821 13.228821%2c3.2 25.6%2c3.2 37.971179%2c3.2 48%2c13.228821 48%2c25.6 c 0%2c5.736682 -2.161128%2c10.952493 -5.707692%2c14.915385 -1.695935%2c-0.623286 -3.387833%2c-1.349065 -5.061539%2c-2.288462 3.2394%2c-0.937363 5.6%2c-3.937988 5.6%2c-7.457692 0%2c-4.260339 -3.469626%2c-7.753846 -7.753846%2c-7.753846 -3.633936%2c0 -6.690552%2c2.51055 -7.538461%2c5.869231 h -3.876924 c -0.840685%2c-3.360193 -3.903443%2c-5.869231 -7.538461%2c-5.869231 -4.284219%2c0 -7.7807693%2c3.493507 -7.7807693%2c7.753846 0%2c3.56112 2.4570323%2c6.5856 5.7615383%2c7.484616 -1.676267%2c0.912203 -3.404813%2c1.620556 -5.1692306%2c2.261538 z M 25.6%2c26.461538 c 0.532632%2c-1.981435 1.101793%2c-3.947553 3.446154%2c-5.16923 L 25.6%2c16.123077 22.153846%2c21.292308 c 2.053593%2c1.454966 3.000771%2c3.237758 3.446154%2c5.16923 z' style='fill:url(%23linearGradient4309)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4327)' inkscape:connector-curvature='0' transform='matrix(0.38078533%2c0%2c0%2c0.38078533%2c2.9655495%2c31.335499)' /%3e%3cpath id='path4242' d='m 16.123077%2c33.353847 c -1.427443%2c0 -2.584616%2c-1.157173 -2.584616%2c-2.584616 0%2c-1.427444 1.157173%2c-2.584615 2.584616%2c-2.584615 1.427444%2c0 2.584615%2c1.157171 2.584615%2c2.584615 0%2c1.427443 -1.157171%2c2.584616 -2.584615%2c2.584616 z' style='fill:url(%23linearGradient4311)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4327)' inkscape:connector-curvature='0' transform='matrix(0.38078533%2c0%2c0%2c0.38078533%2c2.9655495%2c31.335499)' /%3e%3cpath id='path4240' d='m 35.076923%2c33.353847 c -1.427443%2c0 -2.584615%2c-1.157173 -2.584615%2c-2.584616 0%2c-1.427444 1.157172%2c-2.584615 2.584615%2c-2.584615 1.427443%2c0 2.584616%2c1.157171 2.584616%2c2.584615 0%2c1.427443 -1.157173%2c2.584616 -2.584616%2c2.584616 z' style='fill:url(%23linearGradient4313)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4327)' inkscape:connector-curvature='0' transform='matrix(0.38078533%2c0%2c0%2c0.38078533%2c2.9655495%2c31.335499)' /%3e%3cpath inkscape:connector-curvature='0' style='fill:%23d9d9d9%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4339)' d='m 25.6%2c47.2 c -4.373944%2c0 -8.437159%2c-1.399808 -11.838461%2c-3.634616 3.677605%2c-0.394237 7.305921%2c-1.342945 11.423077%2c-3.375 4.166157%2c2.122533 8.434154%2c3.008875 12.279808%2c3.452886 C 34.057131%2c45.890032 29.986674%2c47.2 25.6%2c47.2 Z' id='path4248' transform='matrix(0.39488848%2c0%2c0%2c0.39488848%2c2.6045087%2c30.974457)' /%3e%3cpath inkscape:connector-curvature='0' style='fill:url(%23linearGradient4211)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4315)' d='M 39.723077%2c42.552884 C 35.394064%2c42.5242 29.479588%2c40.397223 25.184616%2c38.432418 20.668821%2c40.064102 16.035448%2c42.649343 10.801923%2c42.526924 10.453022%2c42.51873 10.118061%2c42.50105 9.7634616%2c42.475 L 5.6615384%2c42.1375 9.5557693%2c40.839424 c 5.3417977%2c-1.74056 10.0398397%2c-2.851302 14.1749997%2c-10.025963 0.959101%2c0 2.845924%2c-4.15e-4 3.738462%2c-4.15e-4 4.11884%2c7.134039 9.059296%2c8.324614 14.149039%2c10.026378 L 45.460577%2c42.085577 41.4625%2c42.475 c -0.544847%2c0.05181 -1.120992%2c0.08198 -1.739423%2c0.07788 z' id='path4246' sodipodi:nodetypes='cccccccccccc' transform='matrix(0.39488848%2c0%2c0%2c0.39488848%2c2.6045087%2c30.974457)' /%3e%3c/g%3e%3c/g%3e%3c/svg%3e",qk="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3c!-- Created with Inkscape (http://www.inkscape.org/) --%3e%3csvg version='1.1' id='svg62' width='24' height='24' viewBox='0 0 24 24' sodipodi:docname='reolink.svg' inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3e %3cdefs id='defs66' /%3e %3csodipodi:namedview id='namedview64' pagecolor='%23505050' bordercolor='%23eeeeee' borderopacity='1' inkscape:showpageshadow='0' inkscape:pageopacity='0' inkscape:pagecheckerboard='0' inkscape:deskcolor='%23505050' showgrid='true' inkscape:zoom='36.417984' inkscape:cx='18.191562' inkscape:cy='8.6633022' inkscape:window-width='3840' inkscape:window-height='1527' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='g68'%3e %3cinkscape:grid type='xygrid' id='grid1175' dotted='false' snapvisiblegridlinesonly='true' /%3e %3c/sodipodi:namedview%3e %3cg inkscape:groupmode='layer' inkscape:label='Reolink Logo' id='g68'%3e %3cpath style='fill:white%3bstroke-width:0.0393282%3bfill-opacity:1' d='M 17.037254%2c23.964909 C 16.764634%2c23.917573 16.561708%2c23.83617 16.325735%2c23.67954 16.196719%2c23.593913 14.543544%2c21.952905 12.217956%2c19.602014 10.077426%2c17.438191 8.2198993%2c15.582673 8.0901166%2c15.478642 7.6038998%2c15.088895 7.0877741%2c14.869424 6.4986827%2c14.801908 6.3140805%2c14.780765 5.079061%2c14.763305 3.7541964%2c14.763126 l -2.408845%2c-4.78e-4 0.00713%2c-7.3937713 v -7.3935985 l 6.2040046%2c3.536e-5 c 3.9799342%2c1.969e-5 6.3590882%2c0.01465833 6.6366112%2c0.0408227 2.331195%2c0.21982024 4.364771%2c1.49885914 5.578726%2c3.50085534 0.686043%2c1.1313823 1.020901%2c2.2783695 1.067186%2c3.6554196 0.06335%2c1.8844953 -0.57426%2c3.6597378 -1.831469%2c5.0992438 -0.756457%2c0.866146 -1.861127%2c1.62991 -2.928729%2c2.024919 l -0.319718%2c0.118287 -1.951287%2c-1.979284 -1.951286%2c-1.979278 1.046741%2c-0.02346 c 0.575706%2c-0.01291 1.099833%2c-0.03689 1.164724%2c-0.0533 0.596068%2c-0.150649 0.949703%2c-0.313968 1.322206%2c-0.6106282 0.643573%2c-0.5125401 1.046169%2c-1.2439257 1.137985%2c-2.0673522 0.167852%2c-1.505317 -0.771478%2c-2.8704888 -2.263547%2c-3.2897068 L 13.950001%2c4.3234481 9.7981831%2c4.3106846 5.6392389%2c4.29801 v 3.0692702 3.0692648 l 1.4185165%2c7.9e-4 c 1.6275801%2c8.87e-4 1.7789152%2c0.01912 2.3105245%2c0.27984 0.3095679%2c0.15183 0.389559%2c0.219499 1.0817441%2c0.915083 3.027399%2c3.042274 12.19404%2c12.30837 12.204589%2c12.337002 0.0161%2c0.04373 -5.364393%2c0.03953 -5.617359%2c-0.0045 z' id='path1173' inkscape:label='R' /%3e %3c/g%3e%3c/svg%3e";const Uk=e=>{switch(e){case"frigate":return Hk;case"motioneye":return Bk;case"reolink":return qk;default:return null}};const Wk=(e,t,n)=>{const a=e.states[t],i=n?.state?n.state:a?a.state:null;if(!i)return null;const r=Ye(t),o=a?a.attributes:null;return n?.entity?.translation_key&&e.localize(`component.${n.entity.platform}.entity.${r}.${n.entity.translation_key}.state.${i}`)||o?.device_class&&e.localize(`component.${r}.state.${o.device_class}.${i}`)||e.localize(`component.${r}.state._.${i}`)||i};let Zk=class extends se{_renderItem(e){if(!this.hass)return;const t=Pb(this.hass,{...e});return q` + {t.detail.config=e}} + .actionHandler=${kf({hasHold:bf(e.hold_action),hasDoubleClick:bf(e.double_tap_action)})} + > + ${t.title||""} + ${e.subtitle?q`${e.subtitle}`:""} + ${(e=>{if(e.icon){const t=Uk(e.icon);return t?q``:q` + `}return q``})(t)} + + `}render(){if(!this.submenu)return q``;const e=this.submenu.items;return q` + e.stopPropagation()} + @click=${e=>wf(e)} + > + + + + ${e.map(this._renderItem.bind(this))} + + `}static get styles(){return o("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n pointer-events: auto;\n}\n\nmwc-list-item {\n z-index: 20;\n}")}};e([he({attribute:!1})],Zk.prototype,"hass",void 0),e([he({attribute:!1})],Zk.prototype,"submenu",void 0),Zk=e([le("frigate-card-submenu")],Zk);let Qk=class extends se{shouldUpdate(e){const t=e.get("hass");return!e.has("hass")||!t||!this.submenuSelect||jb(this.hass,t,[this.submenuSelect.entity])}async _refreshOptionTitles(){if(!this.hass||!this.submenuSelect)return;const e=this.submenuSelect.entity,t=this.hass.states[e],n=t?.attributes?.options,a=await(this.entityRegistryManager?.getEntity(this.hass,e))??null,i={};for(const t of n){const n=Wk(this.hass,e,{...a&&{entity:a},state:t});n&&(i[t]=n)}this._optionTitles=i}willUpdate(){if(!this.submenuSelect||!this.hass)return;this._optionTitles||this._refreshOptionTitles();const e=this.submenuSelect.entity,t=this.hass.states[e],n=t?.attributes?.options;if(!t||!n)return;const a={icon:zb("select"),...Pb(this.hass,this.submenuSelect),...this.submenuSelect,type:"custom:frigate-card-menu-submenu",items:[]};delete a.options;const i=a.items;for(const a of n){const n=this._optionTitles?.[a]??a;i.push({state_color:!0,selected:t.state===a,enabled:!0,title:n||a,...(e.startsWith("select.")||e.startsWith("input_select."))&&{tap_action:{action:"perform-action",perform_action:e.startsWith("select.")?"select.select_option":"input_select.select_option",target:{entity_id:e},data:{option:a}}},...this.submenuSelect.options&&this.submenuSelect.options[a]})}this._generatedSubmenu=a}render(){return q` `}};e([he({attribute:!1})],Qk.prototype,"hass",void 0),e([he({attribute:!1})],Qk.prototype,"submenuSelect",void 0),e([he({attribute:!1})],Qk.prototype,"entityRegistryManager",void 0),e([pe()],Qk.prototype,"_optionTitles",void 0),Qk=e([le("frigate-card-submenu-select")],Qk);let Gk=class extends se{constructor(){super(...arguments),this._controller=new Vk(this)}set menuConfig(e){this._controller.setMenuConfig(e)}set buttons(e){this._controller.setButtons(e)}set expanded(e){this._controller.setExpanded(e)}toggleMenu(){this._controller.toggleExpanded()}_renderButton(e){if(!this.hass)return;if("custom:frigate-card-menu-submenu"===e.type)return q` this._controller.actionHandler(e)} + > + `;if("custom:frigate-card-menu-submenu-select"===e.type)return q` this._controller.actionHandler(e)} + > + `;const t=this._controller.getFreshButtonState(this.hass,e),n=Uk(t.icon);return q` this._controller.actionHandler(t,e)} + > + ${n?q``:q``} + `}render(){const e=this._controller.getMenuConfig(),t=e?.style;if(!e||"none"===t)return;const n=this._controller.getButtons("matching"),a=this._controller.getButtons("opposing");return q`
+ ${n.map((e=>this._renderButton(e)))} +
+
+ ${a.map((e=>this._renderButton(e)))} +
`}static get styles(){return o('ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n --frigate-card-menu-button-size: 40px;\n --mdc-icon-button-size: var(--frigate-card-menu-button-size);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n pointer-events: auto;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n}\n\n/*******************************************************\n * Non-hover styles should not interact with the pointer\n *******************************************************/\n:host(:not([data-style*=hover])) {\n pointer-events: none;\n}\n\n/***********************************\n * Aligned divs: matching & opposing\n ***********************************/\ndiv.matching,\ndiv.opposing {\n display: flex;\n flex-wrap: wrap;\n flex-direction: row;\n align-items: flex-start;\n min-width: 0px;\n min-height: 0px;\n}\n\ndiv.matching {\n justify-content: flex-start;\n}\n\ndiv.opposing {\n justify-content: flex-end;\n}\n\n/********************\n * Outside menu style\n ********************/\n:host([data-style=outside]) {\n width: 100%;\n background: var(--secondary-background-color);\n}\n\n/********************************************************\n * Hack: Ensure host & div expand for column flex layouts\n ********************************************************/\n:host(:not([data-style=outside])[data-position=left]) {\n writing-mode: vertical-lr;\n}\n\n:host(:not([data-style=outside])[data-position=right]) {\n writing-mode: vertical-rl;\n}\n\n:host(:not([data-style=outside])[data-style=overlay][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style=overlay][data-position=right]) div > *,\n:host(:not([data-style=outside])[data-style*=hover][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style*=hover][data-position=right]) div > *,\n:host(:not([data-style=outside])[data-style=hidden][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style=hidden][data-position=right]) div > * {\n writing-mode: horizontal-tb;\n}\n\n/**********************\n * "Reverse" alignments\n **********************/\n:host(:not([data-style=outside])[data-position=left][data-alignment=bottom]),\n:host(:not([data-style=outside])[data-position=right][data-alignment=bottom]),\n:host([data-position=top][data-alignment=right]),\n:host([data-position=bottom][data-alignment=right]),\n:host(:not([data-style=outside])[data-position=left][data-alignment=bottom]) div,\n:host(:not([data-style=outside])[data-position=right][data-alignment=bottom]) div,\n:host([data-position=top][data-alignment=right]) div,\n:host([data-position=bottom][data-alignment=right]) div {\n flex-direction: row-reverse;\n}\n\n/****************************\n * Wrap upwards on the bottom\n ****************************/\n:host(:not([data-style=outside])[data-position=bottom]) div {\n flex-wrap: wrap-reverse;\n}\n\n/********************************************\n * Positioning for absolute based menu styles\n ********************************************/\n:host([data-style=overlay]),\n:host([data-style*=hover]),\n:host([data-style=hidden]) {\n overflow: hidden;\n width: calc(var(--frigate-card-menu-button-size) + 6px);\n height: calc(var(--frigate-card-menu-button-size) + 6px);\n}\n\n:host([data-style=overlay]),\n:host([data-style*=hover]),\n:host([data-style=hidden][expanded]) {\n overflow: visible;\n}\n\n:host([data-style=overlay][data-position=top]),\n:host([data-style=overlay][data-position=bottom]),\n:host([data-style*=hover][data-position=top]),\n:host([data-style*=hover][data-position=bottom]),\n:host([data-style=hidden][data-position=top]),\n:host([data-style=hidden][data-position=bottom]) {\n width: 100%;\n height: auto;\n}\n\n:host([data-style=overlay][data-position=top][data-alignment=left]),\n:host([data-style=overlay][data-position=bottom][data-alignment=left]),\n:host([data-style*=hover][data-position=top][data-alignment=left]),\n:host([data-style*=hover][data-position=bottom][data-alignment=left]),\n:host([data-style=hidden][data-position=top][data-alignment=left][expanded]),\n:host([data-style=hidden][data-position=bottom][data-alignment=left][expanded]) {\n background: linear-gradient(90deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=top][data-alignment=right]),\n:host([data-style=overlay][data-position=bottom][data-alignment=right]),\n:host([data-style*=hover][data-position=top][data-alignment=right]),\n:host([data-style*=hover][data-position=bottom][data-alignment=right]),\n:host([data-style=hidden][data-position=top][data-alignment=right][expanded]),\n:host([data-style=hidden][data-position=bottom][data-alignment=right][expanded]) {\n background: linear-gradient(270deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=left]),\n:host([data-style=overlay][data-position=right]),\n:host([data-style*=hover][data-position=left]),\n:host([data-style*=hover][data-position=right]),\n:host([data-style=hidden][data-position=left]),\n:host([data-style=hidden][data-position=right]) {\n width: auto;\n height: 100%;\n}\n\n:host([data-style=overlay][data-position=left][data-alignment=top]),\n:host([data-style=overlay][data-position=right][data-alignment=top]),\n:host([data-style*=hover][data-position=left][data-alignment=top]),\n:host([data-style*=hover][data-position=right][data-alignment=top]),\n:host([data-style=hidden][data-position=left][data-alignment=top][expanded]),\n:host([data-style=hidden][data-position=right][data-alignment=top][expanded]) {\n background: linear-gradient(180deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=left][data-alignment=bottom]),\n:host([data-style=overlay][data-position=right][data-alignment=bottom]),\n:host([data-style*=hover][data-position=left][data-alignment=bottom]),\n:host([data-style*=hover][data-position=right][data-alignment=bottom]),\n:host([data-style=hidden][data-position=left][data-alignment=bottom][expanded]),\n:host([data-style=hidden][data-position=right][data-alignment=bottom][expanded]) {\n background: linear-gradient(0deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}')}};e([he({attribute:!1})],Gk.prototype,"entityRegistryManager",void 0),e([he({attribute:!1})],Gk.prototype,"hass",void 0),Gk=e([le("frigate-card-menu")],Gk);let Yk=class extends se{render(){return q` + + + + + `}static get styles(){return o("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n position: absolute;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n\nslot {\n position: absolute;\n display: flex;\n}\n\n/***************\n * Slot position\n ***************/\nslot[name=top] {\n top: 0px;\n}\n\nslot[name=bottom] {\n bottom: 0px;\n}\n\nslot[name=left] {\n left: 0px;\n}\n\nslot[name=right] {\n right: 0px;\n}\n\n/***********\n * Slot size\n ***********/\nslot[name=top],\nslot[name=bottom] {\n width: 100%;\n flex-direction: column;\n}\n\nslot[name=left],\nslot[name=right] {\n height: 100%;\n flex-direction: row;\n}\n\nslot[name=top],\nslot[name=left] {\n justify-content: flex-start;\n}\n\nslot[name=bottom],\nslot[name=right] {\n justify-content: flex-end;\n}\n\n/*******************************\n * Match rounded corners to card\n *******************************/\n::slotted([slot=top]:first-child),\n::slotted([slot=left]:first-child) {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=top]:first-child),\n::slotted([slot=right]:first-child) {\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=bottom]:last-child),\n::slotted([slot=left]:last-child) {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=bottom]:last-child),\n::slotted([slot=right]:last-child) {\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}")}};Yk=e([le("frigate-card-overlay")],Yk);class Kk{constructor(e){this._config=null,this._popupTimer=new xf,this._items=[],this._host=e}getRenderItems(){return this._items}setItems(e){const t=e.filter((e=>!!e.exclusive)),n=Ev(t.length?t:e,(e=>e.priority??50),"desc"),a=this._getSufficientValues(this._items),i=this._getSufficientValues(n);this._items=n,"popup"!==this._config?.style||Dv(a,i)||(this._show(),this._popupTimer.start(this._config.popup_seconds,(()=>this._hide()))),this._host.requestUpdate()}setConfig(e){this._config=e,this._host.style.setProperty("--frigate-card-status-bar-height",`${e.height}px`),this._host.setAttribute("data-style",e.style),this._host.setAttribute("data-position",e.position),"popup"!==this._config?.style&&this._show(),this._host.requestUpdate()}shouldRender(){return this._items.some((e=>!1!==e.enabled&&e.sufficient))}actionHandler(e,t){e.stopPropagation();const n=yf(e.detail.action,t);n&&Fk(this._host,{action:Wg(n),config:t})}_getSufficientValue(e){ +/* istanbul ignore else: cannot happen -- @preserve */ +return"custom:frigate-card-status-bar-icon"===e.type?e.icon:"custom:frigate-card-status-bar-string"===e.type?e.string:"custom:frigate-card-status-bar-image"===e.type?e.image:null}_getSufficientValues(e){return e.filter((e=>!1!==e.enabled&&e.sufficient)).map((e=>this._getSufficientValue(e)))}_show(){of(this._host,!1,"hide")}_hide(){of(this._host,!0,"hide")}}let Xk=class extends se{constructor(){super(...arguments),this._controller=new Kk(this)}willUpdate(e){e.has("config")&&this.config&&this._controller.setConfig(this.config),e.has("items")&&this._controller.setItems(this.items??[])}render(){if(this._controller.shouldRender())return q` +
+ ${this._controller.getRenderItems().map((e=>{if(!1===e.enabled)return;const t=_e({item:!0,expand:!!e.expand,action:!!Object.keys(e.actions??{}).length}),n=kf({hasHold:bf(e.actions?.hold_action),hasDoubleClick:bf(e.actions?.double_tap_action)});if("custom:frigate-card-status-bar-string"===e.type)return q`
this._controller.actionHandler(t,e.actions)} + > + ${e.string} +
`;if("custom:frigate-card-status-bar-icon"===e.type){const a=Uk(e.icon);return a?q`this._controller.actionHandler(t,e.actions)} + />`:q`this._controller.actionHandler(t,e.actions)} + >`}return"custom:frigate-card-status-bar-image"===e.type?q`this._controller.actionHandler(t,e.actions)} + />`:void 0}))} +
+ `}static get styles(){return o("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n --mdc-icon-button-size: calc(var(--frigate-card-status-bar-height) - 6px);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n display: block;\n width: 100%;\n pointer-events: auto;\n opacity: 1;\n transition: opacity 1s;\n}\n\n/*******************************************************\n * Non-hover styles should not interact with the pointer\n *******************************************************/\n:host(:not([data-style*=hover])) {\n pointer-events: none;\n}\n\n/***************\n * Outside style\n ***************/\n:host([data-style=outside]) {\n color: var(--primary-text-color);\n background: var(--secondary-background-color);\n}\n\n/*******************\n * Non-outside style\n *******************/\n:host(:not([data-style=outside])) {\n color: white;\n background: linear-gradient(90deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=popup][hide]) {\n opacity: 0;\n}\n\n/*********************\n * Status bar contents\n *********************/\n.status {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n overflow: hidden;\n width: 100%;\n height: var(--frigate-card-status-bar-height);\n}\n\n.item {\n display: inline-block;\n margin: 3px;\n padding: 3px;\n align-content: center;\n opacity: 0.7;\n}\n\n.item:first-child {\n margin-left: 10px;\n}\n\n.item:last-child {\n margin-right: 10px;\n}\n\n.item.expand {\n flex: 1;\n}\n\n.item.action {\n cursor: pointer;\n}\n\nimg.item {\n width: var(--mdc-icon-size, 24px);\n height: var(--mdc-icon-size, 24px);\n}")}};e([he({attribute:!1})],Xk.prototype,"items",void 0),e([he({attribute:!1})],Xk.prototype,"config",void 0),Xk=e([le("frigate-card-status-bar")],Xk);function Jk(e){return"number"==typeof e}function eS(e){return"string"==typeof e}function tS(e){return"boolean"==typeof e}function nS(e){return"[object Object]"===Object.prototype.toString.call(e)}function aS(e){return Math.abs(e)}function iS(e){return Math.sign(e)}function rS(e,t){return aS(e-t)}function oS(e){return uS(e).map(Number)}function sS(e){return e[cS(e)]}function cS(e){return Math.max(0,e.length-1)}function lS(e,t){return t===cS(e)}function dS(e,t=0){return Array.from(Array(e),((e,n)=>t+n))}function uS(e){return Object.keys(e)}function hS(e,t){return[e,t].reduce(((e,t)=>(uS(t).forEach((n=>{const a=e[n],i=t[n],r=nS(a)&&nS(i);e[n]=r?hS(a,i):i})),e)),{})}function pS(e,t){return void 0!==t.MouseEvent&&e instanceof t.MouseEvent}function mS(){let e=[];const t={add:function(n,a,i,r={passive:!0}){let o;if("addEventListener"in n)n.addEventListener(a,i,r),o=()=>n.removeEventListener(a,i,r);else{const e=n;e.addListener(i),o=()=>e.removeListener(i)}return e.push(o),t},clear:function(){e=e.filter((e=>e()))}};return t}function gS(e,t,n,a){const i=mS(),r=1e3/60;let o=null,s=0,c=0;function l(e){if(!c)return;o||(o=e);const i=e-o;for(o=e,s+=i;s>=r;)n(r),s-=r;a(s/r),c&&t.requestAnimationFrame(l)}function d(){t.cancelAnimationFrame(c),o=null,s=0,c=0}return{init:function(){i.add(e,"visibilitychange",(()=>{e.hidden&&(o=null,s=0)}))},destroy:function(){d(),i.clear()},start:function(){c||(c=t.requestAnimationFrame(l))},stop:d,update:()=>n(r),render:a}}function fS(e=0,t=0){const n=aS(e-t);function a(t){return tt}function r(e){return a(e)||i(e)}const o={length:n,max:t,min:e,constrain:function(n){return r(n)?a(n)?e:t:n},reachedAny:r,reachedMax:i,reachedMin:a,removeOffset:function(e){return n?e-n*Math.ceil((e-t)/n):e}};return o}function _S(e,t,n){const{constrain:a}=fS(0,e),i=e+1;let r=o(t);function o(e){return n?aS((i+e)%i):a(e)}function s(){return r}function c(){return _S(e,s(),n)}const l={get:s,set:function(e){return r=o(e),l},add:function(e){return c().set(s()+e)},clone:c};return l}function vS(e,t,n,a,i,r,o,s,c,l,d,u,h,p,m,g,f,_,v){const{cross:y,direction:b}=e,w=["INPUT","SELECT","TEXTAREA"],x={passive:!1},C=mS(),M=mS(),k=fS(50,225).constrain(p.measure(20)),S={mouse:300,touch:400},E={mouse:500,touch:600},$=m?43:25;let A=!1,z=0,I=0,T=!1,j=!1,O=!1,D=!1;function R(e){if(!pS(e,a)&&e.touches.length>=2)return P(e);const t=r.readPoint(e),n=r.readPoint(e,y),o=rS(t,z),c=rS(n,I);if(!j&&!D){if(!e.cancelable)return P(e);if(j=o>c,!j)return P(e)}const d=r.pointerMove(e);o>g&&(O=!0),l.useFriction(.3).useDuration(.75),s.start(),i.add(b(d)),e.preventDefault()}function P(e){const t=d.byDistance(0,!1).index!==u.get(),n=r.pointerUp(e)*(m?E:S)[D?"mouse":"touch"],a=function(e,t){const n=u.add(-1*iS(e)),a=d.byDistance(e,!m).distance;return m||aS(e)=2,s&&0!==e.button)return;if(function(e){const t=e.nodeName||"";return w.includes(t)}(e.target))return;T=!0,r.pointerDown(e),l.useFriction(0).useDuration(0),i.set(o),function(){const e=D?n:t;M.add(e,"touchmove",R,x).add(e,"touchend",P).add(e,"mousemove",R,x).add(e,"mouseup",P)}(),z=r.readPoint(e),I=r.readPoint(e,y),h.emit("pointerDown")}(s)}const c=t;C.add(c,"dragstart",(e=>e.preventDefault()),x).add(c,"touchmove",(()=>{}),x).add(c,"touchend",(()=>{})).add(c,"touchstart",s).add(c,"mousedown",s).add(c,"touchcancel",P).add(c,"contextmenu",P).add(c,"click",L,!0)},destroy:function(){C.clear(),M.clear()},pointerDown:function(){return T}}}function yS(e,t){let n,a;function i(e){return e.timeStamp}function r(n,a){const i="client"+("x"===(a||e.scroll)?"X":"Y");return(pS(n,t)?n:n.touches[0])[i]}return{pointerDown:function(e){return n=e,a=e,r(e)},pointerMove:function(e){const t=r(e)-r(a),o=i(e)-i(n)>170;return a=e,o&&(n=e),t},pointerUp:function(e){if(!n||!a)return 0;const t=r(a)-r(n),o=i(e)-i(n),s=i(e)-i(a)>170,c=t/o;return o&&!s&&aS(c)>.1?c:0},readPoint:r}}function bS(e,t,n,a,i,r,o){const s=[e].concat(a);let c,l,d=[],u=!1;function h(e){return i.measureSize(o.measure(e))}return{init:function(i){r&&(l=h(e),d=a.map(h),c=new ResizeObserver((n=>{(tS(r)||r(i,n))&&function(n){for(const r of n){if(u)return;const n=r.target===e,o=a.indexOf(r.target),s=n?l:d[o];if(aS(h(n?e:a[o])-s)>=.5){i.reInit(),t.emit("resize");break}}}(n)})),n.requestAnimationFrame((()=>{s.forEach((e=>c.observe(e)))})))},destroy:function(){u=!0,c&&c.disconnect()}}}function wS(e,t,n,a,i){const r=i.measure(10),o=i.measure(50),s=fS(.1,.99);let c=!1;function l(){return!c&&(!!e.reachedAny(n.get())&&!!e.reachedAny(t.get()))}return{shouldConstrain:l,constrain:function(i){if(!l())return;const c=e.reachedMin(t.get())?"min":"max",d=aS(e[c]-t.get()),u=n.get()-t.get(),h=s.constrain(d/o);n.subtract(u*h),!i&&aS(u)e.add(i)))}};return c}function CS(e,t,n,a,i){const{reachedAny:r,removeOffset:o,constrain:s}=a;function c(e){return e.concat().sort(((e,t)=>aS(e)-aS(t)))[0]}function l(t,a){const i=[t,t+n,t-n];if(!e)return t;if(!a)return c(i);const r=i.filter((e=>iS(e)===a));return r.length?c(r):sS(i)-n}return{byDistance:function(n,a){const c=i.get()+n,{index:d,distance:u}=function(n){const a=e?o(n):s(n),i=t.map(((e,t)=>({diff:l(e-a,0),index:t}))).sort(((e,t)=>aS(e.diff)-aS(t.diff))),{index:r}=i[0];return{index:r,distance:a}}(c),h=!e&&r(c);return!a||h?{index:d,distance:n}:{index:d,distance:n+l(t[d]-u,0)}},byIndex:function(e,n){return{index:e,distance:l(t[e]-i.get(),n)}},shortcut:l}}function MS(e,t,n,a,i,r,o,s){const c={passive:!0,capture:!0};let l=0;function d(e){"Tab"===e.code&&(l=(new Date).getTime())}return{init:function(u){s&&(r.add(document,"keydown",d,!1),t.forEach(((t,d)=>{r.add(t,"focus",(t=>{(tS(s)||s(u,t))&&function(t){if((new Date).getTime()-l>10)return;o.emit("slideFocusStart"),e.scrollLeft=0;const r=n.findIndex((e=>e.includes(t)));Jk(r)&&(i.useDuration(0),a.index(r,0),o.emit("slideFocus"))}(d)}),c)})))}}}function kS(e){let t=e;function n(e){return Jk(e)?e:e.get()}const a={get:function(){return t},set:function(e){t=n(e)},add:function(e){t+=n(e)},subtract:function(e){t-=n(e)}};return a}function SS(e,t){const n="x"===e.scroll?function(e){return`translate3d(${e}px,0px,0px)`}:function(e){return`translate3d(0px,${e}px,0px)`},a=t.style;let i=!1;return{clear:function(){i||(a.transform="",t.getAttribute("style")||t.removeAttribute("style"))},to:function(t){i||(a.transform=n(e.direction(t)))},toggleActive:function(e){i=!e}}}function ES(e,t,n,a,i,r,o,s,c){const l=.5,d=oS(i),u=oS(i).reverse(),h=function(){const e=o[0];return g(m(u,e),n,!1)}().concat(function(){const e=t-o[0]-1;return g(m(d,e),-n,!0)}());function p(e,t){return e.reduce(((e,t)=>e-i[t]),t)}function m(e,t){return e.reduce(((e,n)=>p(e,t)>0?e.concat([n]):e),[])}function g(i,o,d){const u=function(e){return r.map(((n,i)=>({start:n-a[i]+l+e,end:n+t-l+e})))}(o);return i.map((t=>{const a=d?0:-n,i=d?n:0,r=d?"end":"start",o=u[t][r];return{index:t,loopPoint:o,slideLocation:kS(-1),translate:SS(e,c[t]),target:()=>s.get()>o?a:i}}))}const f={canLoop:function(){return h.every((({index:e})=>{const n=d.filter((t=>t!==e));return p(n,t)<=.1}))},clear:function(){h.forEach((e=>e.translate.clear()))},loop:function(){h.forEach((e=>{const{target:t,translate:n,slideLocation:a}=e,i=t();i!==a.get()&&(n.to(i),a.set(i))}))},loopPoints:h};return f}function $S(e,t,n){let a,i=!1;return{init:function(r){n&&(a=new MutationObserver((e=>{i||(tS(n)||n(r,e))&&function(e){for(const n of e)if("childList"===n.type){r.reInit(),t.emit("slidesChanged");break}}(e)})),a.observe(e,{childList:!0}))},destroy:function(){a&&a.disconnect(),i=!0}}}function AS(e,t,n,a){const i={};let r,o=null,s=null,c=!1;return{init:function(){r=new IntersectionObserver((e=>{c||(e.forEach((e=>{const n=t.indexOf(e.target);i[n]=e})),o=null,s=null,n.emit("slidesInView"))}),{root:e.parentElement,threshold:a}),t.forEach((e=>r.observe(e)))},destroy:function(){r&&r.disconnect(),c=!0},get:function(e=!0){if(e&&o)return o;if(!e&&s)return s;const t=function(e){return uS(i).reduce(((t,n)=>{const a=parseInt(n),{isIntersecting:r}=i[a];return(e&&r||!e&&!r)&&t.push(a),t}),[])}(e);return e&&(o=t),e||(s=t),t}}}function zS(e,t,n,a,i,r,o,s,c){const{startEdge:l,endEdge:d,direction:u}=e,h=Jk(n);const p={groupSlides:function(e){return h?function(e,t){return oS(e).filter((e=>e%t==0)).map((n=>e.slice(n,n+t)))}(e,n):function(e){return e.length?oS(e).reduce(((n,h,p)=>{const m=sS(n)||0,g=0===m,f=h===cS(e),_=i[l]-r[m][l],v=i[l]-r[h][d],y=!a&&g?u(o):0,b=aS(v-(!a&&f?u(s):0)-(_+y));return p&&b>t+c&&n.push(h),f&&n.push(e.length),n}),[]).map(((t,n,a)=>{const i=Math.max(a[n-1]||0);return e.slice(i,t)})):[]}(e)}};return p}function IS(e,t,n,a,i,r,o){const{align:s,axis:c,direction:l,startIndex:d,loop:u,duration:h,dragFree:p,dragThreshold:m,inViewThreshold:g,slidesToScroll:f,skipSnaps:_,containScroll:v,watchResize:y,watchSlides:b,watchDrag:w,watchFocus:x}=r,C={measure:function(e){const{offsetTop:t,offsetLeft:n,offsetWidth:a,offsetHeight:i}=e;return{top:t,right:n+a,bottom:t+i,left:n,width:a,height:i}}},M=C.measure(t),k=n.map(C.measure),S=function(e,t){const n="rtl"===t,a="y"===e,i=!a&&n?-1:1,r={scroll:a?"y":"x",cross:a?"x":"y",startEdge:a?"top":n?"right":"left",endEdge:a?"bottom":n?"left":"right",measureSize:function(e){const{height:t,width:n}=e;return a?t:n},direction:function(e){return e*i}};return r}(c,l),E=S.measureSize(M),$=function(e){const t={measure:function(t){return e*(t/100)}};return t}(E),A=function(e,t){const n={start:function(){return 0},center:function(e){return a(e)/2},end:a};function a(e){return t-e}const i={measure:function(a,i){return eS(e)?n[e](a):e(t,a,i)}};return i}(s,E),z=!u&&!!v,I=u||!!v,{slideSizes:T,slideSizesWithGaps:j,startGap:O,endGap:D}=function(e,t,n,a,i,r){const{measureSize:o,startEdge:s,endEdge:c}=e,l=n[0]&&i,d=function(){if(!l)return 0;const e=n[0];return aS(t[s]-e[s])}(),u=function(){if(!l)return 0;const e=r.getComputedStyle(sS(a));return parseFloat(e.getPropertyValue(`margin-${c}`))}(),h=n.map(o),p=n.map(((e,t,n)=>{const a=!t,i=lS(n,t);return a?h[t]+d:i?h[t]+u:n[t+1][s]-e[s]})).map(aS);return{slideSizes:h,slideSizesWithGaps:p,startGap:d,endGap:u}}(S,M,k,n,I,i),R=zS(S,E,f,u,M,k,O,D,2),{snaps:P,snapsAligned:L}=function(e,t,n,a,i){const{startEdge:r,endEdge:o}=e,{groupSlides:s}=i,c=s(a).map((e=>sS(e)[o]-e[0][r])).map(aS).map(t.measure),l=a.map((e=>n[r]-e[r])).map((e=>-aS(e))),d=s(l).map((e=>e[0])).map(((e,t)=>e+c[t]));return{snaps:l,snapsAligned:d}}(S,A,M,k,R),N=-sS(P)+sS(j),{snapsContained:F,scrollContainLimit:V}=function(e,t,n,a,i){const r=fS(-t+e,0),o=n.map(((e,t)=>{const{min:a,max:i}=r,o=r.constrain(e),s=!t,l=lS(n,t);return s?i:l||c(a,o)?a:c(i,o)?i:o})).map((e=>parseFloat(e.toFixed(3)))),s=function(){const e=o[0],t=sS(o);return fS(o.lastIndexOf(e),o.indexOf(t)+1)}();function c(e,t){return rS(e,t)<1}return{snapsContained:function(){if(t<=e+i)return[r.max];if("keepSnaps"===a)return o;const{min:n,max:c}=s;return o.slice(n,c)}(),scrollContainLimit:s}}(E,N,L,v,2),H=z?F:L,{limit:B}=function(e,t,n){const a=t[0];return{limit:fS(n?a-e:sS(t),a)}}(N,H,u),q=_S(cS(H),d,u),U=q.clone(),W=oS(n),Z=gS(a,i,(e=>(({dragHandler:e,scrollBody:t,scrollBounds:n,options:{loop:a}},i)=>{a||n.constrain(e.pointerDown()),t.seek(i)})(se,e)),(e=>(({scrollBody:e,translate:t,location:n,offsetLocation:a,scrollLooper:i,slideLooper:r,dragHandler:o,animation:s,eventHandler:c,scrollBounds:l,options:{loop:d}},u)=>{const h=e.settled(),p=!l.shouldConstrain(),m=d?h:h&&p;m&&!o.pointerDown()&&(s.stop(),c.emit("settle")),m||c.emit("scroll");const g=n.get()*u+Y.get()*(1-u);a.set(g),d&&(i.loop(e.direction()),r.loop()),t.to(a.get())})(se,e))),Q=H[q.get()],G=kS(Q),Y=kS(Q),K=kS(Q),X=kS(Q),J=function(e,t,n,a,i,r){let o=0,s=0,c=i,l=r,d=e.get(),u=0;function h(e){return c=e,m}function p(e){return l=e,m}const m={direction:function(){return s},duration:function(){return c},velocity:function(){return o},seek:function(t){const i=t/1e3,r=c*i,h=a.get()-e.get();let p=0;return c?(n.set(e),o+=h/r,o*=l,d+=o,e.add(o*i),p=d-u):(o=0,n.set(a),e.set(a),p=h),s=iS(p),u=d,m},settled:function(){return aS(a.get()-t.get())<.001},useBaseFriction:function(){return p(r)},useBaseDuration:function(){return h(i)},useFriction:p,useDuration:h};return m}(G,K,Y,X,h,.68),ee=CS(u,H,N,B,X),te=function(e,t,n,a,i,r,o){function s(i){const s=i.distance,c=i.index!==t.get();r.add(s),s&&(a.duration()?e.start():(e.update(),e.render(1),e.update())),c&&(n.set(t.get()),t.set(i.index),o.emit("select"))}const c={distance:function(e,t){s(i.byDistance(e,t))},index:function(e,n){const a=t.clone().set(e);s(i.byIndex(a.get(),n))}};return c}(Z,q,U,J,ee,X,o),ne=function(e){const{max:t,length:n}=e,a={get:function(e){return n?(e-t)/-n:0}};return a}(B),ae=mS(),ie=AS(t,n,o,g),{slideRegistry:re}=function(e,t,n,a,i,r){const{groupSlides:o}=i,{min:s,max:c}=a;return{slideRegistry:function(){const a=o(r),i=!e||"keepSnaps"===t;return 1===n.length?[r]:i?a:a.slice(s,c).map(((e,t,n)=>{const a=!t,i=lS(n,t);return a?dS(sS(n[0])+1):i?dS(cS(r)-sS(n)[0]+1,sS(n)[0]):e}))}()}}(z,v,H,V,R,W),oe=MS(e,n,re,te,J,ae,o,x),se={ownerDocument:a,ownerWindow:i,eventHandler:o,containerRect:M,slideRects:k,animation:Z,axis:S,dragHandler:vS(S,e,a,i,X,yS(S,i),G,Z,te,J,ee,q,o,$,p,m,_,.68,w),eventStore:ae,percentOfView:$,index:q,indexPrevious:U,limit:B,location:G,offsetLocation:K,previousLocation:Y,options:r,resizeHandler:bS(t,o,i,n,S,y,C),scrollBody:J,scrollBounds:wS(B,K,X,J,$),scrollLooper:xS(N,B,K,[G,K,Y,X]),scrollProgress:ne,scrollSnapList:H.map(ne.get),scrollSnaps:H,scrollTarget:ee,scrollTo:te,slideLooper:ES(S,E,N,T,j,P,H,K,n),slideFocus:oe,slidesHandler:$S(t,o,b),slidesInView:ie,slideIndexes:W,slideRegistry:re,slidesToScroll:R,target:X,translate:SS(S,t)};return se}const TS={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0,watchFocus:!0};function jS(e){function t(e,t){return hS(e,t||{})}const n={mergeOptions:t,optionsAtMedia:function(n){const a=n.breakpoints||{},i=uS(a).filter((t=>e.matchMedia(t).matches)).map((e=>a[e])).reduce(((e,n)=>t(e,n)),{});return t(n,i)},optionsMediaQueries:function(t){return t.map((e=>uS(e.breakpoints||{}))).reduce(((e,t)=>e.concat(t)),[]).map(e.matchMedia)}};return n}function OS(e,t,n){const a=e.ownerDocument,i=a.defaultView,r=jS(i),o=function(e){let t=[];const n={init:function(n,a){return t=a.filter((({options:t})=>!1!==e.optionsAtMedia(t).active)),t.forEach((t=>t.init(n,e))),a.reduce(((e,t)=>Object.assign(e,{[t.name]:t})),{})},destroy:function(){t=t.filter((e=>e.destroy()))}};return n}(r),s=mS(),c=function(){let e,t={};function n(e){return t[e]||[]}const a={init:function(t){e=t},emit:function(t){return n(t).forEach((n=>n(e,t))),a},off:function(e,i){return t[e]=n(e).filter((e=>e!==i)),a},on:function(e,i){return t[e]=n(e).concat([i]),a},clear:function(){t={}}};return a}(),{mergeOptions:l,optionsAtMedia:d,optionsMediaQueries:u}=r,{on:h,off:p,emit:m}=c,g=S;let f,_,v,y,b=!1,w=l(TS,OS.globalOptions),x=l(w),C=[];function M(t){const n=IS(e,v,y,a,i,t,c);if(t.loop&&!n.slideLooper.canLoop()){return M(Object.assign({},t,{loop:!1}))}return n}function k(t,n){b||(w=l(w,t),x=d(w),C=n||C,function(){const{container:t,slides:n}=x,a=eS(t)?e.querySelector(t):t;v=a||e.children[0];const i=eS(n)?v.querySelectorAll(n):n;y=[].slice.call(i||v.children)}(),f=M(x),u([w,...C.map((({options:e})=>e))]).forEach((e=>s.add(e,"change",S))),x.active&&(f.translate.to(f.location.get()),f.animation.init(),f.slidesInView.init(),f.slideFocus.init(z),f.eventHandler.init(z),f.resizeHandler.init(z),f.slidesHandler.init(z),f.options.loop&&f.slideLooper.loop(),v.offsetParent&&y.length&&f.dragHandler.init(z),_=o.init(z,C)))}function S(e,t){const n=A();E(),k(l({startIndex:n},e),t),c.emit("reInit")}function E(){f.dragHandler.destroy(),f.eventStore.clear(),f.translate.clear(),f.slideLooper.clear(),f.resizeHandler.destroy(),f.slidesHandler.destroy(),f.slidesInView.destroy(),f.animation.destroy(),o.destroy(),s.clear()}function $(e,t,n){x.active&&!b&&(f.scrollBody.useBaseFriction().useDuration(!0===t?0:x.duration),f.scrollTo.index(e,n||0))}function A(){return f.index.get()}const z={canScrollNext:function(){return f.index.add(1).get()!==A()},canScrollPrev:function(){return f.index.add(-1).get()!==A()},containerNode:function(){return v},internalEngine:function(){return f},destroy:function(){b||(b=!0,s.clear(),E(),c.emit("destroy"),c.clear())},off:p,on:h,emit:m,plugins:function(){return _},previousScrollSnap:function(){return f.indexPrevious.get()},reInit:g,rootNode:function(){return e},scrollNext:function(e){$(f.index.add(1).get(),e,-1)},scrollPrev:function(e){$(f.index.add(-1).get(),e,1)},scrollProgress:function(){return f.scrollProgress.get(f.location.get())},scrollSnapList:function(){return f.scrollSnapList},scrollTo:$,selectedScrollSnap:A,slideNodes:function(){return y},slidesInView:function(){return f.slidesInView.get()},slidesNotInView:function(){return f.slidesInView.get(!1)}};return k(t,n),setTimeout((()=>c.emit("init")),0),z}function DS(){return DS=Object.assign||function(e){for(var t=1;t=e;case"y":return Math.abs(i)>=e;case"z":return Math.abs(r)>=e;default:return!1}}(r,a)&&e.preventDefault(),l.isStarted?l.isMomentum&&r>Math.max(2,2*l.lastAbsDelta)&&(M(!0),x()):x(),0===r&&Object.is&&Object.is(e.deltaX,-0)?d=!0:(t=e,l.axisMovement=PS(l.axisMovement,a),l.lastAbsDelta=r,l.scrollPointsToMerge.push({axisDelta:a,timeStamp:i}),g(),p({axisDelta:a,isStart:!l.isStartPublished}),l.isStartPublished=!0,C())},g=function(){var e;l.scrollPointsToMerge.length===US?(l.scrollPoints.unshift({axisDeltaSum:l.scrollPointsToMerge.map((function(e){return e.axisDelta})).reduce(PS),timeStamp:(e=l.scrollPointsToMerge.map((function(e){return e.timeStamp})),e.reduce((function(e,t){return e+t}))/e.length)}),_(),l.scrollPointsToMerge.length=0,l.scrollPoints.length=1,l.isMomentum||b()):l.isStartPublished||f()},f=function(){var e;l.axisVelocity=(e=l.scrollPointsToMerge,e[e.length-1]).axisDelta.map((function(e){return e/l.willEndTimeout}))},_=function(){var e=l.scrollPoints,t=e[0],n=e[1];if(n&&t){var a=t.timeStamp-n.timeStamp;if(!(a<=0)){var i=t.axisDeltaSum.map((function(e){return e/a})),r=i.map((function(e,t){return e/(l.axisVelocity[t]||1)}));l.axisVelocity=i,l.accelerationFactors.push(r),v(a)}}},v=function(e){var t=10*Math.ceil(e/10)*1.2;l.isMomentum||(t=Math.max(100,2*t)),l.willEndTimeout=Math.min(1e3,Math.round(t))},y=function(e){return 0===e||e<=qS&&e>=BS},b=function(){if(l.accelerationFactors.length>=WS){if(d&&(d=!1,LS(l.axisVelocity)>=.2))return void w();var e=l.accelerationFactors.slice(-1*WS);e.every((function(e){var t=!!e.reduce((function(e,t){return e&&e<1&&e===t?1:0})),n=e.filter(y).length===e.length;return t||n}))&&w(),l.accelerationFactors=e}},w=function(){l.isMomentum=!0},x=function(){(l=GS()).isStarted=!0,l.startTime=Date.now(),n=void 0,d=!1},C=function(){clearTimeout(a),a=setTimeout(M,l.willEndTimeout)},M=function(e){void 0===e&&(e=!1),l.isStarted&&(l.isMomentum&&e?p({isEnding:!0,isMomentumCancel:!0}):p({isEnding:!0}),l.isMomentum=!1,l.isStarted=!1)},k=function(e){var t=[],n=function(n){n.removeEventListener("wheel",e),t=t.filter((function(e){return e!==n}))};return NS({observe:function(a){return a.addEventListener("wheel",e,{passive:!1}),t.push(a),function(){return n(a)}},unobserve:n,disconnect:function(){t.forEach(n)}})}(u),S=k.observe,E=k.unobserve,$=k.disconnect;return h(e),NS({on:r,off:o,observe:S,unobserve:E,disconnect:$,feedWheel:u,updateOptions:h})}var KS={active:!0,breakpoints:{},wheelDraggingClass:"is-wheel-dragging",forceWheelAxis:void 0,target:void 0};function XS(e){var t;void 0===e&&(e={});var n=function(){};var a={name:"wheelGestures",options:e,init:function(a,i){var r,o,s=i.mergeOptions,c=i.optionsAtMedia,l=s(KS,XS.globalOptions),d=s(l,e);t=c(d);var u,h=a.internalEngine(),p=null!=(r=t.target)?r:a.containerNode().parentNode,m=null!=(o=t.forceWheelAxis)?o:h.options.axis,g=YS({preventWheelAction:m,reverseSign:[!0,!0,!1]}),f=g.observe(p),_=g.on("wheel",(function(e){var a=e.axisDelta,i=a[0],r=a[1],o="x"===m?i:r,s="x"===m?r:i,c=e.isMomentum&&e.previous&&!e.previous.isMomentum,l=e.isEnding&&!e.isMomentum||c;Math.abs(o)>Math.abs(s)&&!v&&!e.isMomentum&&function(e){try{x(u=new MouseEvent("mousedown",e.event))}catch(e){return n()}v=!0,document.documentElement.addEventListener("mousemove",b,!0),document.documentElement.addEventListener("mouseup",b,!0),void document.documentElement.addEventListener("mousedown",b,!0),t.wheelDraggingClass&&p.classList.add(t.wheelDraggingClass)}(e);if(!v)return;l?function(e){v=!1,x(w("mouseup",e)),y(),t.wheelDraggingClass&&p.classList.remove(t.wheelDraggingClass)}(e):x(w("mousemove",e))})),v=!1;function y(){document.documentElement.removeEventListener("mousemove",b,!0),document.documentElement.removeEventListener("mouseup",b,!0),document.documentElement.removeEventListener("mousedown",b,!0)}function b(e){v&&e.isTrusted&&e.stopImmediatePropagation()}function w(e,t){var n,a;if(m===h.options.axis){var i=t.axisMovement;n=i[0],a=i[1]}else{var r=t.axisMovement;a=r[0],n=r[1]}if(!h.options.skipSnaps&&!h.options.dragFree){var o=h.containerRect.width,s=h.containerRect.height;n=n<0?Math.max(n,-o):Math.min(n,o),a=a<0?Math.max(a,-s):Math.min(a,s)}return new MouseEvent(e,{clientX:u.clientX+n,clientY:u.clientY+a,screenX:u.screenX+n,screenY:u.screenY+a,movementX:n,movementY:a,button:0,bubbles:!0,cancelable:!0,composed:!0})}function x(e){a.containerNode().dispatchEvent(e)}n=function(){f(),_(),y()}},destroy:function(){return n()}};return a}XS.globalOptions=void 0;class JS{constructor(e,t,n){this._mutationObserver=new MutationObserver(((e,t)=>this._refreshCarouselContents())),this._refreshCarouselContents=()=>{const e=lf(this._parent);!Dv(this._carousel.slideNodes(),e)&&(this._carousel.destroy(),this._carousel=this._createCarousel(e))},this._root=e,this._parent=t,this._direction=n?.direction??"horizontal",this._transitionEffect=n?.transitionEffect??"slide",this._startIndex=n?.startIndex??0,this._dragFree=n?.dragFree??!1,this._loop=n?.loop??!1,this._draggable=n?.dragEnabled??!0,this._plugins=n?.plugins??[],this._carousel=this._createCarousel(lf(this._parent)),t instanceof HTMLSlotElement&&t.addEventListener("slotchange",this._refreshCarouselContents),this._mutationObserver.observe(this._parent,{childList:!0})}destroy(){this._parent instanceof HTMLSlotElement&&this._parent.removeEventListener("slotchange",this._refreshCarouselContents),this._mutationObserver.disconnect(),this._carousel.destroy()}getSlide(e){return this._carousel.slideNodes()[e]??null}getSelectedSlide(){return this.getSlide(this.getSelectedIndex())}getSelectedIndex(){return this._carousel.selectedScrollSnap()}selectSlide(e){this._carousel.scrollTo(e,"none"===this._transitionEffect);const t=this.getSlide(e);t&&Bg(this._parent,"carousel:force-select",{index:e,element:t})}_createCarousel(e){const t=OS(this._root,{slides:e,axis:"horizontal"===this._direction?"x":"y",duration:20,startIndex:this._startIndex,dragFree:this._dragFree,loop:this._loop,containScroll:"trimSnaps",watchSlides:!1,watchResize:!0,watchDrag:this._draggable},[...this._plugins,...e.length>1?[XS({forceWheelAxis:"y"})]:[]]),n=()=>{const e=(()=>{const e=t.selectedScrollSnap(),n=t.slideNodes()[e]??null;return n?{index:e,element:n}:null})();e&&Bg(this._parent,"carousel:select",e)};return t.on("select",(()=>n())),t}}let eE=class extends se{constructor(){super(...arguments),this.direction="horizontal",this.dragEnabled=!0,this.selected=0,this._refParent=ze(),this._refRoot=ze(),this._carousel=null}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._carousel?.destroy(),this._carousel=null,super.disconnectedCallback()}willUpdate(e){e.has("direction")&&this.setAttribute("direction",this.direction);["direction","dragEnabled","dragFree","loop","plugins","transitionEffect"].some((t=>e.has(t)))&&(this._carousel?.destroy(),this._carousel=null)}render(){return q`
+ +
+
+ +
+
+ +
`}updated(e){!this._carousel&&this._refRoot.value&&this._refParent.value?this._carousel=new JS(this._refRoot.value,this._refParent.value,{direction:this.direction,dragEnabled:this.dragEnabled,dragFree:this.dragFree,startIndex:this.selected,transitionEffect:this.transitionEffect,loop:this.loop,plugins:this.plugins}):e.has("selected")&&this._carousel?.selectSlide(this.selected)}static get styles(){return o(":host {\n display: block;\n height: 100%;\n width: 100%;\n position: relative;\n}\n\n.embla {\n width: 100%;\n height: 100%;\n margin-left: auto;\n margin-right: auto;\n}\n\n.embla__container {\n display: flex;\n width: 100%;\n height: 100%;\n user-select: none;\n -webkit-touch-callout: none;\n -khtml-user-select: none;\n -webkit-tap-highlight-color: transparent;\n}\n\n:host([direction=vertical]) .embla__container {\n flex-direction: column;\n}\n\n:host([direction=horizontal]) .embla__container {\n flex-direction: row;\n}\n\n.embla__viewport {\n width: 100%;\n height: 100%;\n overflow: hidden;\n display: flex;\n flex-direction: column;\n justify-content: center;\n}\n\n.embla__viewport.is-draggable {\n cursor: move;\n cursor: grab;\n}\n\n.embla__viewport.is-dragging {\n cursor: grabbing;\n}\n\n:host([direction=vertical]) ::slotted(.embla__slide) {\n margin-bottom: 5px;\n}\n\n:host([direction=horizontal]) ::slotted(.embla__slide) {\n margin-right: 5px;\n}")}};e([he({attribute:!0,reflect:!0})],eE.prototype,"direction",void 0),e([he({attribute:!0})],eE.prototype,"transitionEffect",void 0),e([he({attribute:!1})],eE.prototype,"loop",void 0),e([he({attribute:!1})],eE.prototype,"dragFree",void 0),e([he({attribute:!1})],eE.prototype,"dragEnabled",void 0),e([he({attribute:!1})],eE.prototype,"plugins",void 0),e([he({attribute:!1})],eE.prototype,"selected",void 0),eE=e([le("frigate-card-carousel")],eE); +/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const tE=window,nE=tE.ShadowRoot&&(void 0===tE.ShadyCSS||tE.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,aE=Symbol(),iE=new WeakMap;let rE=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==aE)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(nE&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=iE.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&iE.set(t,e))}return e}toString(){return this.cssText}};const oE=(e,t)=>{nE?e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):t.forEach((t=>{const n=document.createElement("style"),a=tE.litNonce;void 0!==a&&n.setAttribute("nonce",a),n.textContent=t.cssText,e.appendChild(n)}))},sE=nE?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return(e=>new rE("string"==typeof e?e:e+"",void 0,aE))(t)})(e):e +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */;var cE;const lE=window,dE=lE.trustedTypes,uE=dE?dE.emptyScript:"",hE=lE.reactiveElementPolyfillSupport,pE={toAttribute(e,t){switch(t){case Boolean:e=e?uE:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},mE=(e,t)=>t!==e&&(t==t||e==e),gE={attribute:!0,type:String,converter:pE,reflect:!1,hasChanged:mE},fE="finalized";class _E extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var t;this.finalize(),(null!==(t=this.h)&&void 0!==t?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach(((t,n)=>{const a=this._$Ep(n,t);void 0!==a&&(this._$Ev.set(a,n),e.push(a))})),e}static createProperty(e,t=gE){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){const n="symbol"==typeof e?Symbol():"__"+e,a=this.getPropertyDescriptor(e,n,t);void 0!==a&&Object.defineProperty(this.prototype,e,a)}}static getPropertyDescriptor(e,t,n){return{get(){return this[t]},set(a){const i=this[e];this[t]=a,this.requestUpdate(e,i,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||gE}static finalize(){if(this.hasOwnProperty(fE))return!1;this[fE]=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),void 0!==e.h&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const e=this.properties,t=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const n of t)this.createProperty(n,e[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(sE(e))}else void 0!==e&&t.push(sE(e));return t}static _$Ep(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(e=this.constructor.h)||void 0===e||e.forEach((e=>e(this)))}addController(e){var t,n;(null!==(t=this._$ES)&&void 0!==t?t:this._$ES=[]).push(e),void 0!==this.renderRoot&&this.isConnected&&(null===(n=e.hostConnected)||void 0===n||n.call(e))}removeController(e){var t;null===(t=this._$ES)||void 0===t||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])}))}createRenderRoot(){var e;const t=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return oE(t,this.constructor.elementStyles),t}connectedCallback(){var e;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostConnected)||void 0===t?void 0:t.call(e)}))}enableUpdating(e){}disconnectedCallback(){var e;null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostDisconnected)||void 0===t?void 0:t.call(e)}))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EO(e,t,n=gE){var a;const i=this.constructor._$Ep(e,n);if(void 0!==i&&!0===n.reflect){const r=(void 0!==(null===(a=n.converter)||void 0===a?void 0:a.toAttribute)?n.converter:pE).toAttribute(t,n.type);this._$El=e,null==r?this.removeAttribute(i):this.setAttribute(i,r),this._$El=null}}_$AK(e,t){var n;const a=this.constructor,i=a._$Ev.get(e);if(void 0!==i&&this._$El!==i){const e=a.getPropertyOptions(i),r="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==(null===(n=e.converter)||void 0===n?void 0:n.fromAttribute)?e.converter:pE;this._$El=i,this[i]=r.fromAttribute(t,e.type),this._$El=null}}requestUpdate(e,t,n){let a=!0;void 0!==e&&(((n=n||this.constructor.getPropertyOptions(e)).hasChanged||mE)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),!0===n.reflect&&this._$El!==e&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(e,n))):a=!1),!this.isUpdatePending&&a&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((e,t)=>this[t]=e)),this._$Ei=void 0);let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostUpdate)||void 0===t?void 0:t.call(e)})),this.update(n)):this._$Ek()}catch(e){throw t=!1,this._$Ek(),e}t&&this._$AE(n)}willUpdate(e){}_$AE(e){var t;null===(t=this._$ES)||void 0===t||t.forEach((e=>{var t;return null===(t=e.hostUpdated)||void 0===t?void 0:t.call(e)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){void 0!==this._$EC&&(this._$EC.forEach(((e,t)=>this._$EO(t,this[t],e))),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}}_E[fE]=!0,_E.elementProperties=new Map,_E.elementStyles=[],_E.shadowRootOptions={mode:"open"},null==hE||hE({ReactiveElement:_E}),(null!==(cE=lE.reactiveElementVersions)&&void 0!==cE?cE:lE.reactiveElementVersions=[]).push("1.6.3"); +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const vE=0,yE=Symbol();class bE{constructor(e,t,n){this.o=0,this.status=0,this.autoRun=!0,this.i=e,this.i.addController(this);const a="object"==typeof t?t:{task:t,args:n};this.t=a.task,this.h=a.args,void 0!==a.autoRun&&(this.autoRun=a.autoRun),this.taskComplete=new Promise(((e,t)=>{this.l=e,this.u=t}))}hostUpdated(){this.performTask()}async performTask(){var e;const t=null===(e=this.h)||void 0===e?void 0:e.call(this);this.shouldRun(t)&&this.run(t)}shouldRun(e){return this.autoRun&&this.v(e)}async run(e){var t;let n,a;null!=e||(e=null===(t=this.h)||void 0===t?void 0:t.call(this)),2!==this.status&&3!==this.status||(this.taskComplete=new Promise(((e,t)=>{this.l=e,this.u=t}))),this.status=1,this._=void 0,this.m=void 0,this.i.requestUpdate();const i=++this.o;try{n=await this.t(e)}catch(e){a=e}this.o===i&&(n===yE?this.status=0:(void 0===a?(this.status=2,this.l(n)):(this.status=3,this.u(a)),this.m=n,this._=a),this.i.requestUpdate())}get value(){return this.m}get error(){return this._}render(e){var t,n,a,i;switch(this.status){case 0:return null===(t=e.initial)||void 0===t?void 0:t.call(e);case 1:return null===(n=e.pending)||void 0===n?void 0:n.call(e);case 2:return null===(a=e.complete)||void 0===a?void 0:a.call(e,this.value);case 3:return null===(i=e.error)||void 0===i?void 0:i.call(e,this.error);default:this.status}}v(e){const t=this.T;return this.T=e,Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.some(((e,n)=>mE(e,t[n]))):e!==t}}class wE{constructor(e){this._keys=e}modify(e){this._keys.forEach((t=>e.removeContext(t)))}}var xE=":host {\n display: flex;\n flex-direction: column;\n width: 100%;\n margin-left: 5px;\n padding: 5px;\n color: var(--primary-text-color);\n overflow: hidden;\n column-gap: 5%;\n}\n\ndiv.title {\n font-size: 1.2rem;\n font-weight: bold;\n}\n\ndiv.details {\n flex: 1;\n justify-content: center;\n display: flex;\n flex-direction: column;\n flex-wrap: wrap;\n --mdc-icon-size: 16px;\n min-height: 0px;\n}";const CE=(e,t,n,a)=>{const i={...a?.cardWideConfig&&{cardWideConfig:a.cardWideConfig}};return q` ${t.render({initial:()=>a?.inProgressFunc?.()??xk(i),pending:()=>a?.inProgressFunc?.()??xk(i),error:t=>{Gg(t),kk(e,t)},complete:n})}`},ME=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,kE=(e,t,n,a=!0)=>new bE(e,{args:()=>[!!t(),n()],task:async([e,n])=>{const a=t();return e&&a&&n?(async(e,t)=>e&&t?t.startsWith("data:")||t.match(ME)?t:new Promise(((n,a)=>{e?e.fetchWithAuth(t).then((e=>e.blob())).then((e=>{const t=new FileReader;t.onload=()=>{const e=t.result;n("string"==typeof e?e:null)},t.onerror=e=>a(e),t.readAsDataURL(e)})):a()})):null)(a,n):null},autoRun:a}),SE=300;let EE=class extends se{constructor(){super(),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}connectedCallback(){this._intersectionObserver.observe(this),super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._intersectionObserver.disconnect()}willUpdate(e){e.has("thumbnail")&&(this._embedThumbnailTask=kE(this,(()=>this.hass),(()=>this.thumbnail),!1),this._intersectionObserver.unobserve(this),this._intersectionObserver.observe(this))}_intersectionHandler(e){this._embedThumbnailTask?.status===vE&&e.some((e=>e.isIntersecting))&&this._embedThumbnailTask?.run()}render(){const e=q` `;return this._embedThumbnailTask?q`${this.thumbnail?CE(this,this._embedThumbnailTask,(e=>e?q``:q``),{inProgressFunc:()=>e}):e} `:e}static get styles(){return o(":host {\n display: block;\n overflow: hidden;\n aspect-ratio: 1/1;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\nimg {\n display: block;\n}\n\nimg,\nha-icon {\n display: inline-block;\n vertical-align: top;\n margin: 0;\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n width: var(--frigate-card-thumbnail-size);\n max-height: 100%;\n aspect-ratio: 1/1;\n object-fit: cover;\n}\n\nha-icon {\n --mdc-icon-size: 50%;\n color: var(--primary-text-color);\n display: flex;\n justify-content: center;\n align-items: center;\n border: 1px solid rgba(255, 255, 255, 0.3);\n box-sizing: border-box;\n opacity: 0.2;\n}")}};e([he({attribute:!1})],EE.prototype,"thumbnail",void 0),e([he({attribute:!1})],EE.prototype,"hass",void 0),EE=e([le("frigate-card-thumbnail-feature-thumbnail")],EE);let $E=class extends se{render(){if(this.date)return q` + ${this.cameraMetadata?.engineLogo?q``:""} +
+
${Wu(this.date,"HH:mm")}
+
${Wu(this.date,"MMM do")}
+ ${this.showCameraTitle&&this.cameraMetadata?.title?q`
${this.cameraMetadata.title}
`:q``} +
+ `}static get styles(){return o(":host {\n display: block;\n max-width: var(--frigate-card-thumbnail-size);\n max-height: var(--frigate-card-thumbnail-size);\n aspect-ratio: 1/1;\n border: 1px solid var(--secondary-color);\n background-color: var(--secondary-background-color);\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n overflow: hidden;\n padding: 10px;\n box-sizing: border-box;\n position: relative;\n}\n\nimg.background {\n display: block;\n width: 100%;\n height: 100%;\n position: absolute;\n inset: 0;\n padding: 10%;\n box-sizing: border-box;\n pointer-events: none;\n opacity: 0.1;\n}\n\ndiv.content {\n height: 100%;\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n color: var(--primary-text-color);\n}\n\ndiv {\n text-align: center;\n}\n\ndiv.title {\n font-size: 1.5rem;\n}\n\ndiv.camera {\n font-size: 0.7em;\n}")}};e([he({attribute:!1})],$E.prototype,"date",void 0),e([he({attribute:!1})],$E.prototype,"cameraMetadata",void 0),e([he({attribute:!1})],$E.prototype,"showCameraTitle",void 0),$E=e([le("frigate-card-thumbnail-feature-text")],$E);let AE=class extends se{render(){if(!this.media)return;const e=this.media.getScore(),t=e?(100*e).toFixed(2)+"%":null,n=this.media.getStartTime(),a=n?Kg(n):null,i=this.media.getEndTime(),r=n&&i?ef(n,i):null,o=this.media.inProgress()?V_("event.in_progress"):null,s=qg(this.media.getWhat()?.join(", "))??null,c=qg(this.media.getWhere()?.join(", "))??null,l=qg(this.media.getTags()?.join(", "))??null,d=s||l?(s??"")+(s&&l?": ":"")+(l??""):null,u=this.seek?Wu(this.seek,"HH:mm:ss"):null;return q` + ${d?q`
+ ${d} + ${t?q`${t}`:""} +
`:""} +
+ ${a?q`
+ + ${a} +
+ ${r||o?q`
+ + ${r?q`${r}`:""} + ${o?q`${o}`:""} +
`:""}`:""} + ${this.cameraTitle?q`
+ + ${this.cameraTitle} +
`:""} + ${c?q`
+ + ${c} +
`:q``} + ${l?q`
+ + ${l} +
`:q``} + ${u?q`
+ + ${u} +
`:q``} +
+ `}static get styles(){return o(xE)}};e([he({attribute:!1})],AE.prototype,"media",void 0),e([he({attribute:!1})],AE.prototype,"seek",void 0),e([he({attribute:!1})],AE.prototype,"cameraTitle",void 0),AE=e([le("frigate-card-thumbnail-details-event")],AE);let zE=class extends se{render(){if(!this.media)return;const e=this.media.getStartTime(),t=e?Kg(e):null,n=this.media.getEndTime(),a=e&&n?ef(e,n):null,i=this.media.inProgress()?V_("recording.in_progress"):null,r=this.seek?Wu(this.seek,"HH:mm:ss"):null,o=this.media.getEventCount();return q` + ${this.cameraTitle?q`
+ ${this.cameraTitle} +
`:""} +
+ ${t?q`
+ + ${t} +
+ ${a||i?q`
+ + ${a?q`${a}`:""} + ${i?q`${i}`:""} +
`:""}`:""} + ${r?q`
+ + ${r} +
`:q``} + ${null!==o?q`
+ + ${o} +
`:""} +
+ `}static get styles(){return o(xE)}};e([he({attribute:!1})],zE.prototype,"media",void 0),e([he({attribute:!1})],zE.prototype,"seek",void 0),e([he({attribute:!1})],zE.prototype,"cameraTitle",void 0),zE=e([le("frigate-card-thumbnail-details-recording")],zE);let IE=class extends se{constructor(){super(...arguments),this.details=!1,this.show_favorite_control=!1,this.show_timeline_control=!1,this.show_download_control=!1}render(){if(!this.media||!this.cameraManager||!this.hass)return;const e=this.media.getThumbnail(),t=this.media.getTitle()??"",n={star:!0,starred:!!this.media?.isFavorite()},a=this.show_timeline_control&&(!tx.isRecording(this.media)||this.media.getStartTime()&&this.media.getEndTime()),i=this.cameraManager?.getMediaCapabilities(this.media),r=this.show_favorite_control&&this.media&&this.hass&&i?.canFavorite,o=this.show_download_control&&this.hass&&this.media.getID()&&i?.canDownload,s=this.cameraManager.getCameraMetadata(this.media.getCameraID());return q` + ${tx.isEvent(this.media)&&e?q``:tx.isEvent(this.media)||tx.isRecording(this.media)?q``:q``} + ${r?q` {if(wf(e),this.hass&&this.media){try{await(this.cameraManager?.favoriteMedia(this.media,!this.media?.isFavorite()))}catch(e){return void Gg(e)}this.requestUpdate()}}} + />`:""} + ${this.details&&tx.isEvent(this.media)?q``:this.details&&tx.isRecording(this.media)?q``:q``} + ${a?q`{wf(e),this.viewManagerEpoch&&this.media&&this.viewManagerEpoch.manager.setViewByParameters({params:{view:"timeline",queryResults:this.viewManagerEpoch?.manager.getView()?.queryResults?.clone().selectResultIfFound((e=>e===this.media))},modifiers:[new wE(["timeline"])]})}} + >`:""} + ${o?q` {if(wf(e),this.hass&&this.cameraManager&&this.media)try{await Ew(this.hass,this.cameraManager,this.media)}catch(e){kk(this,e)}}} + >`:""} + `}static get styles(){return o(":host {\n display: flex;\n flex-direction: row;\n box-sizing: border-box;\n position: relative;\n overflow: hidden;\n transition: transform 0.2s linear;\n}\n\n:host(:not([details])) {\n aspect-ratio: 1/1;\n}\n\n:host([details]) {\n border: 1px solid var(--primary-color);\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n padding: 2px;\n background-color: var(--primary-background-color, black);\n}\n\n:host(:hover) {\n transform: scale(1.04);\n}\n\nha-icon {\n position: absolute;\n border-radius: 50%;\n opacity: 0.5;\n color: var(--primary-color);\n cursor: pointer;\n transition: opacity 0.2s ease-in-out, color 0.2s ease-in-out;\n}\n\nha-icon:hover {\n opacity: 1;\n}\n\nha-icon.star {\n top: 3px;\n left: 3px;\n}\n\nha-icon.star.starred {\n color: gold;\n}\n\nha-icon.timeline {\n top: 3px;\n right: 3px;\n}\n\nha-icon.download {\n right: 3px;\n bottom: 3px;\n}\n\nfrigate-card-thumbnail-details-event,\nfrigate-card-thumbnail-details-recording {\n flex: 1;\n}")}};e([he({attribute:!1})],IE.prototype,"cameraManager",void 0),e([he({attribute:!1})],IE.prototype,"media",void 0),e([he({attribute:!0,type:Boolean})],IE.prototype,"details",void 0),e([he({attribute:!0,type:Boolean})],IE.prototype,"show_favorite_control",void 0),e([he({attribute:!0,type:Boolean})],IE.prototype,"show_timeline_control",void 0),e([he({attribute:!0,type:Boolean})],IE.prototype,"show_download_control",void 0),e([he({attribute:!1})],IE.prototype,"seek",void 0),IE=e([le("frigate-card-thumbnail")],IE);let TE=class extends se{constructor(){super(...arguments),this.fadeThumbnails=!1,this._thumbnailSlides=[]}willUpdate(e){if(e.has("config")){this.config?.size&&this.style.setProperty("--frigate-card-thumbnail-size",`${this.config.size}px`);const e=this._getDirection();e?this.setAttribute("direction",e):this.removeAttribute("direction")}["cameraManager","config","transitionEffect","viewManagerEpoch"].some((t=>e.has(t)))&&(this._thumbnailSlides=this._renderSlides()),e.has("viewManagerEpoch")&&this.style.setProperty("--frigate-card-carousel-thumbnail-opacity",this.fadeThumbnails&&null!==this._getSelectedSlide()?"0.4":"1.0")}_getSelectedSlide(){return this.viewManagerEpoch?.manager.getView()?.queryResults?.getSelectedIndex()??null}_renderSlides(){const e=[],t=this.viewManagerEpoch?.manager.getView(),n=t?.context?.mediaViewer?.seek,a=this._getSelectedSlide();for(const i of t?.queryResults?.getResults()??[]){const t=e.length,r={embla__slide:!0,"slide-selected":a===t};e.push(q` {const n=this.viewManagerEpoch?.manager.getView();n&&n.queryResults&&Bg(this,"thumbnail-carousel:tap",{queryResults:n.queryResults.clone().selectIndex(t)}),wf(e)}} + > + `)}return e}_getDirection(){return"left"===this.config?.mode||"right"===this.config?.mode?"vertical":"above"===this.config?.mode||"below"===this.config?.mode?"horizontal":null}render(){const e=this._getDirection();if(this._thumbnailSlides.length&&this.config&&e)return q` + ${this._thumbnailSlides} + `}static get styles(){return o(":host {\n --frigate-card-thumbnail-size-max: 300px;\n --frigate-card-thumbnail-details-width: calc(\n var(--frigate-card-thumbnail-size) + 200px\n );\n}\n\n:host {\n display: block;\n width: 100%;\n height: 100%;\n --frigate-card-carousel-thumbnail-opacity: 1;\n}\n\n:host([direction=vertical]) {\n height: 100%;\n}\n\n:host([direction=horizontal]) {\n height: auto;\n}\n\n.embla__slide {\n flex: 0 0 auto;\n opacity: var(--frigate-card-carousel-thumbnail-opacity);\n}\n\n.embla__slide.slide-selected {\n opacity: 1;\n}\n\nfrigate-card-thumbnail {\n width: var(--frigate-card-thumbnail-size);\n height: var(--frigate-card-thumbnail-size);\n max-width: 100%;\n}\n\nfrigate-card-thumbnail[details] {\n width: var(--frigate-card-thumbnail-details-width);\n}")}};e([he({attribute:!1})],TE.prototype,"hass",void 0),e([he({attribute:!1})],TE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1})],TE.prototype,"cameraManager",void 0),e([he({attribute:!1})],TE.prototype,"config",void 0),e([he({attribute:!1})],TE.prototype,"fadeThumbnails",void 0),TE=e([le("frigate-card-thumbnail-carousel")],TE);var jE=":host {\n width: 100%;\n height: 100%;\n display: block;\n}";const OE=document.createElement("template");OE.innerHTML='\n
\n
\n';class DE extends HTMLElement{constructor(){super();const e=this.attachShadow({mode:"open"});e.appendChild(OE.content.cloneNode(!0)),this._freeSpaceDiv=e.getElementById("fs")}connectedCallback(){this._freeSpaceDiv&&this._freeSpaceDiv.addEventListener("click",this.handleFreeSpaceDivClick),this.upgradeProperty("open")}disconnectedCallback(){document.removeEventListener("keyup",this.handleKeyUp)}upgradeProperty(e){if(this.hasOwnProperty(e)){let t=this[e];delete this[e],this[e]=t}}handleKeyUp=e=>{if(!e.altKey&&"Escape"===e.key)e.preventDefault(),this.open=!1};get open(){return this.hasAttribute("open")}set open(e){e?this.hasAttribute("open")||this.setAttribute("open",""):this.hasAttribute("open")&&this.removeAttribute("open")}static get observedAttributes(){return["open"]}attributeChangedCallback(e,t,n){"open"===e&&(this.open?(this.setAttribute("tabindex","0"),this.setAttribute("aria-disabled","false"),this.focus({preventScroll:!0}),document.addEventListener("keyup",this.handleKeyUp),this.dispatchEvent(new CustomEvent("open",{bubbles:!0}))):(this.setAttribute("tabindex","-1"),this.setAttribute("aria-disabled","true"),document.removeEventListener("keyup",this.handleKeyUp),this.dispatchEvent(new CustomEvent("close",{bubbles:!0}))))}handleFreeSpaceDivClick=()=>{this.open=!1}}customElements.define("side-drawer",DE);let RE=class extends se{constructor(){super(...arguments),this.location="left",this.control=!0,this.open=!1,this.empty=!0,this._refDrawer=ze(),this._refSlot=ze(),this._resizeObserver=new ResizeObserver((()=>this._hideDrawerIfNecessary())),this._isHoverableDevice=Yg()}firstUpdated(e){super.firstUpdated(e);const t=document.createElement("style");t.innerHTML=":host {\n width: unset;\n}\n\n#fs {\n display: none;\n width: 100%;\n inset: 0;\n}\n\n#d,\n#fs {\n height: 100%;\n position: absolute;\n}\n\n#d {\n overflow: visible;\n max-width: 90%;\n z-index: 10;\n}\n\n:host([location=right]) #d {\n left: unset;\n right: 0;\n transform: translateX(100%);\n}\n\n:host([location=right][open]) #d {\n transform: none;\n box-shadow: var(--frigate-card-css-box-shadow, 0px 0px 25px 0px black);\n}\n\n#ifs {\n height: 100%;\n}",this._refDrawer.value?.shadowRoot?.appendChild(t)}_slotChanged(){const e=this._refSlot.value?lf(this._refSlot.value):[];this._resizeObserver.disconnect();for(const t of e)this._resizeObserver.observe(t);this._hideDrawerIfNecessary()}_hideDrawerIfNecessary(){if(!this._refDrawer.value)return;const e=this._refSlot.value?lf(this._refSlot.value):null;this.empty=!e||!e.length||e.every((e=>{const t=e.getBoundingClientRect();return!t.width||!t.height}))}render(){return q` + {this.open&&(this.open=!1)}} + > + ${this.control?q` +
{wf(e),this.open=!this.open}} + > + {this._isHoverableDevice&&!this.open&&(this.open=!0)}} + > + +
+ `:""} + this._slotChanged()}> +
+ `}static get styles(){return o("side-drawer {\n background-color: var(--card-background-color);\n}\n\ndiv.control-surround {\n position: absolute;\n bottom: 50%;\n transform: translateY(50%);\n z-index: 0;\n padding-top: 20px;\n padding-bottom: 20px;\n}\n\n:host([location=left]) div.control-surround {\n padding-right: 12px;\n left: 100%;\n}\n\n:host([location=right]) div.control-surround {\n padding-left: 12px;\n right: 100%;\n}\n\n:host([empty]),\n:host([empty]) > * {\n visibility: hidden;\n}\n\n:host(:not([empty])),\n:host(:not([empty])) > * {\n visibility: visible;\n}\n\nha-icon.control {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.7);\n opacity: 0.5;\n pointer-events: all;\n --mdc-icon-size: 20px;\n padding-top: 20px;\n padding-bottom: 20px;\n transition: opacity 0.5s ease;\n}\n\n:host([open]) ha-icon.control,\nha-icon.control:hover {\n opacity: 1;\n background-color: black;\n}\n\n:host([location=left]) ha-icon.control {\n border-top-right-radius: 20px;\n border-bottom-right-radius: 20px;\n}\n\n:host([location=right]) ha-icon.control {\n border-top-left-radius: 20px;\n border-bottom-left-radius: 20px;\n}")}};e([he({attribute:!0,reflect:!0})],RE.prototype,"location",void 0),e([he({attribute:!0,reflect:!0,type:Boolean})],RE.prototype,"control",void 0),e([he({type:Boolean,reflect:!0,attribute:!0})],RE.prototype,"open",void 0),e([he({attribute:!1})],RE.prototype,"icons",void 0),e([he({type:Boolean,reflect:!0,attribute:!0})],RE.prototype,"empty",void 0),RE=e([le("frigate-card-drawer")],RE);let PE=class extends se{constructor(){super(...arguments),this._refDrawerLeft=ze(),this._refDrawerRight=ze(),this._boundDrawerHandler=this._drawerHandler.bind(this)}connectedCallback(){super.connectedCallback(),this.addEventListener("frigate-card:drawer:open",this._boundDrawerHandler),this.addEventListener("frigate-card:drawer:close",this._boundDrawerHandler)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("frigate-card:drawer:open",this._boundDrawerHandler),this.removeEventListener("frigate-card:drawer:close",this._boundDrawerHandler)}_drawerHandler(e){const t=e.detail.drawer,n=e.type.endsWith(":open");"left"===t&&this._refDrawerLeft.value?this._refDrawerLeft.value.open=n:"right"===t&&this._refDrawerRight.value&&(this._refDrawerRight.value.open=n)}render(){return q` + + + + + + + + `}static get styles(){return o(":host {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n position: relative;\n overflow: hidden;\n}\n\n::slotted(:not([slot])) {\n flex: 1;\n min-height: 0px;\n}")}};e([he({attribute:!1})],PE.prototype,"drawerIcons",void 0),PE=e([le("frigate-card-surround-basic")],PE);let LE=class extends se{_hasDrawer(){return!!this.thumbnailConfig&&["left","right"].includes(this.thumbnailConfig.mode)}willUpdate(e){this.timelineConfig?.mode&&"none"!==this.timelineConfig.mode&&import("./timeline-core-91693473.js");const t=this.viewManagerEpoch?.manager.getView();e.has("viewManagerEpoch")&&(this.viewManagerEpoch?.manager.hasMajorMediaChange(this.viewManagerEpoch?.oldView)||this.viewManagerEpoch?.oldView?.displayMode!==t?.displayMode)&&(this._cameraIDsForTimeline=this._getCameraIDsForTimeline()??void 0)}_getCameraIDsForTimeline(){const e=this.viewManagerEpoch?.manager.getView();if(!e||!this.cameraManager)return null;if(e.is("live")){const t={anyCapabilities:["clips","snapshots","recordings"]};return e.supportsMultipleDisplayModes()&&e.isGrid()?this.cameraManager.getStore().getCameraIDsWithCapability(t):this.cameraManager.getStore().getAllDependentCameras(e.camera,t)}return e.isViewerView()?e.query?.getQueryCameraIDs()??null:null}render(){const e=this.viewManagerEpoch?.manager.getView();if(!this.hass||!e)return;const t=(e,t)=>{this.thumbnailConfig&&this._hasDrawer()&&Bg(e.composedPath()[0],"drawer:"+t,{drawer:this.thumbnailConfig.mode})};return q` t(e,"open")} + @frigate-card:thumbnails:close=${e=>t(e,"close")} + > + ${this.thumbnailConfig&&"none"!==this.thumbnailConfig.mode?q` {const n=e.detail.queryResults.getSelectedResult();n&&(this.viewManagerEpoch?.manager.setViewByParameters({params:{view:"media",queryResults:e.detail.queryResults,...n.getCameraID()&&{camera:n.getCameraID()}},modifiers:[new wE(["timeline","mediaViewer"])]}),t(e,"close"))}} + > + `:""} + ${this.timelineConfig&&"none"!==this.timelineConfig.mode?q` + `:""} + + `}static get styles(){return o(jE)}};e([he({attribute:!1})],LE.prototype,"hass",void 0),e([he({attribute:!1})],LE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1,hasChanged:Qg})],LE.prototype,"thumbnailConfig",void 0),e([he({attribute:!1,hasChanged:Qg})],LE.prototype,"timelineConfig",void 0),e([he({attribute:!1})],LE.prototype,"cameraManager",void 0),e([he({attribute:!1})],LE.prototype,"cardWideConfig",void 0),LE=e([le("frigate-card-surround")],LE);var NE="Tue, 10 Dec 2024 02:14:31 GMT",FE="216ded2",VE="Mon, 9 Dec 2024 18:13:23 -0800";const HE=ba.object({domain:ba.string(),version:ba.string().optional()}).passthrough(),BE="hass_web_proxy",qE=(e,t)=>`/api/${BE}/v${t??0}/?url=${encodeURIComponent(e)}`,UE=(e,t,n="media")=>(e=>e.config.components.includes(BE))(e)&&!!t[n];async function WE(e,t,n){await e.callService(BE,"create_proxied_url",{url_pattern:t,...n&&{url_id:n.urlID,ssl_verification:n.sslVerification,ssl_ciphers:n.sslCiphers,open_limit:n.openLimit,ttl:n.ttl,allow_unauthenticated:n.allowUnauthenticated}})}const ZE=async(e,t)=>{let n=null;if(t)try{n=await(async(e,t)=>await $v(e,HE,{type:"manifest/get",integration:t}))(t,e)}catch(e){}return{detected:!!n,...n?.version&&{version:n.version}}};let QE=class extends se{constructor(){super(...arguments),this._diagnostics=null}async _fetchDiagnostics(){this._diagnostics=await(async(e,t,n)=>{const a=e&&t?await t.getMatchingDevices(e,(e=>"Frigate"===e.manufacturer)):[],i=new Map;return a?.forEach((e=>{e.config_entries.forEach((t=>{e.model&&i.set(t,e.model)}))})),{card_version:"6.0.2",browser:navigator.userAgent,date:new Date,lang:F_(),timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,git:{hash:FE,build_date:NE,commit_date:VE},...e&&{ha_version:e.config.version},integrations:{reolink:await ZE("reolink",e),frigate:{...await ZE("frigate",e),...i.size&&{devices:Object.fromEntries(i)}},hass_web_proxy:await ZE(BE,e),motioneye:await ZE("motioneye",e)},...n&&{config:n}}})(this.hass,this.deviceRegistryManager,this.rawConfig)}shouldUpdate(){return!!this._diagnostics||(this._fetchDiagnostics().then((()=>this.requestUpdate())),!1)}render(){return wk({message:V_("error.diagnostics"),type:"diagnostics",icon:"mdi:information",context:this._diagnostics})}static get styles(){return o(jE)}};e([he({attribute:!1})],QE.prototype,"hass",void 0),e([he({attribute:!1})],QE.prototype,"deviceRegistryManager",void 0),e([he({attribute:!1})],QE.prototype,"rawConfig",void 0),e([pe()],QE.prototype,"_diagnostics",void 0),QE=e([le("frigate-card-diagnostics")],QE);let GE=class extends se{willUpdate(e){if(e.has("viewManagerEpoch")||e.has("config")){const e=this.viewManagerEpoch?.manager.getView();(e?.is("live")||this._shouldLivePreload())&&import("./index-9bf80040.js").then((function(e){return e.i})),e?.isGalleryView()?import("./gallery-1de615c4.js"):e?.isViewerView()?import("./index-25c40d01.js"):e?.is("image")?import("./image-1e2a0a79.js"):e?.is("timeline")&&import("./timeline-c30d9341.js")}e.has("hide")&&(this.hide?this.setAttribute("hidden",""):this.removeAttribute("hidden"))}shouldUpdate(e){return!0}_shouldLivePreload(){const e=this.viewManagerEpoch?.manager.getView();return!!this.overriddenConfig?.live.preload&&!e?.is("diagnostics")}render(){if(!(this.hass&&this.overriddenConfig&&this.nonOverriddenConfig&&this.cardWideConfig))return q``;const e=this.viewManagerEpoch?.manager.getView(),t={hidden:this._shouldLivePreload()&&!e?.is("live")},n={hidden:!!this.hide},a=e?.is("live")?this.overriddenConfig.live.controls.thumbnails:e?.isViewerView()?this.overriddenConfig.media_viewer.controls.thumbnails:e?.is("timeline")?this.overriddenConfig.timeline.controls.thumbnails:void 0,i=e?.is("live")?this.overriddenConfig.live.controls.timeline:e?.isViewerView()?this.overriddenConfig.media_viewer.controls.timeline:void 0,r=e?this.cameraManager?.getStore().getCameraConfig(e.camera)??null:null;return q` + ${!this.hide&&e?.is("image")&&r?q` + `:""} + ${!this.hide&&e?.isGalleryView()?q` + `:""} + ${!this.hide&&e?.isViewerView()?q` + + + `:""} + ${!this.hide&&e?.is("timeline")?q` + `:""} + ${!this.hide&&e?.is("diagnostics")?q` + `:""} + ${this._shouldLivePreload()||!this.hide&&e?.is("live")?q` + + + `:""} + `}static get styles(){return o(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\n:host([hidden]),\n.hidden {\n display: none;\n}")}};e([he({attribute:!1})],GE.prototype,"hass",void 0),e([he({attribute:!1})],GE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1})],GE.prototype,"cameraManager",void 0),e([he({attribute:!1})],GE.prototype,"nonOverriddenConfig",void 0),e([he({attribute:!1})],GE.prototype,"overriddenConfig",void 0),e([he({attribute:!1})],GE.prototype,"cardWideConfig",void 0),e([he({attribute:!1})],GE.prototype,"rawConfig",void 0),e([he({attribute:!1})],GE.prototype,"resolvedMediaCache",void 0),e([he({attribute:!1})],GE.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],GE.prototype,"hide",void 0),e([he({attribute:!1})],GE.prototype,"microphoneManager",void 0),e([he({attribute:!1})],GE.prototype,"triggeredCameraIDs",void 0),e([he({attribute:!1})],GE.prototype,"deviceRegistryManager",void 0),GE=e([le("frigate-card-views")],GE);console.info(`%c FRIGATE-HASS-CARD \n%c ${V_("common.version")} 6.0.2`,"color: pink; font-weight: bold; background: black","color: white; font-weight: bold; background: dimgray"),window.customCards=window.customCards||[],window.customCards.push({type:"frigate-card",name:V_("common.frigate_card"),description:V_("common.frigate_card_description"),preview:!0,documentationURL:wa});let YE=class extends se{constructor(){super(...arguments),this._controller=new Ax(this,(()=>this._refMain.value?.scroll({top:0})),(()=>this._refMenu.value?.toggleMenu()),this._requestUpdateForComponentsThatUseConditions.bind(this)),this._menuButtonController=new zx,this._refMenu=ze(),this._refOverlay=ze(),this._refMain=ze(),this._refElements=ze(),this._refViews=ze()}get _config(){return this._controller.getConfigManager().getConfig()}get _hass(){return this._controller.getHASSManager().getHASS()}set hass(e){this._controller.getHASSManager().setHASS(e),this._refMenu.value&&(this._refMenu.value.hass=e),this._refElements.value&&(this._refElements.value.hass=e),this._refViews.value&&(this._refViews.value.hass=e)}static async getConfigElement(){return await Ax.getConfigElement()}static getStubConfig(e,t){return Ax.getStubConfig(t)}_requestUpdateForComponentsThatUseConditions(){this._refViews.value&&(this._refViews.value.conditionsManagerEpoch=this._controller.getConditionsManager().getEpoch()??void 0),this._refElements.value&&(this._refElements.value.conditionsManagerEpoch=this._controller.getConditionsManager().getEpoch()??void 0)}setConfig(e){this._controller.getConfigManager().setConfig(e)}shouldUpdate(){return!!this.isConnected&&(this._controller.getMessageManager().hasMessage()||this._controller.getInitializationManager().isInitializedMandatory()||this._controller.getInitializationManager().initializeMandatory(),!0)}_renderMenuStatusContainer(e){if(!this._config)return;const t=this._config.menu.style,n=this._config.menu.position,a=this._config.status_bar.style,i=this._config.status_bar.position;if("none"===t&&"none"===a||"overlay"===e&&"outside"===t&&"outside"===a||"overlay"!==e&&("outside"!==t||n!==e)&&("outside"!==a||i!==e))return;const r=e=>{const r="none"!==t&&("outside"===t&&"outerlay"===e||"outside"!==t&&"overlay"===e),o="none"!==a&&("outside"===a&&"outerlay"===e||"outside"!==a&&"overlay"===e),s="left"===n||"right"===n||"bottom"===n&&"hidden"===t&&"popup"!==a||"top"===n&&("hidden"!==t||"popup"===a);return q` + ${r&&s?this._renderMenu(n):""} + ${o?this._renderStatusBar(i):""} + ${r&&!s?this._renderMenu(n):""} + `};return q` + ${"overlay"===e?q`${r("overlay")}`:q`
+ ${r("outerlay")} +
`} + `}_renderMenu(e){const t=this._controller.getViewManager().getView();if(this._hass&&this._config)return q` + + `}_renderStatusBar(e){if(this._config)return q` + + `}updated(){this._controller.getInitializationManager().isInitializedMandatory()&&this._controller.getQueryStringManager().executeIfNecessary()}_renderInDialogIfNecessary(e){return this._controller.getExpandManager().isExpanded()?q` {this._controller.getExpandManager().setExpanded(!1)}} + > + ${e} + `:e}render(){if(!this._hass)return;const e={main:!0,"curve-top":"outside"!==this._config?.menu.style||"top"!==this._config?.menu.position,"curve-bottom":"outside"!==this._config?.menu.style||"top"===this._config?.menu.position},t=this._controller.getActionsManager().getMergedActions(),n=this._controller.getCameraManager(),a=!1!==this._config?.performance?.features.animated_progress_indicator&&!this._controller.getInitializationManager().wasEverInitialized()&&!this._controller.getMessageManager().hasMessage();return this._renderInDialogIfNecessary(q` this._controller.getMessageManager().setMessageIfHigherPriority(e.detail)} + @frigate-card:media:loaded=${e=>this._controller.getMediaLoadedInfoManager().set(e.detail)} + @frigate-card:media:unloaded=${()=>this._controller.getMediaLoadedInfoManager().clear()} + @frigate-card:media:volumechange=${()=>this.requestUpdate()} + @frigate-card:media:play=${()=>this.requestUpdate()} + @frigate-card:media:pause=${()=>this.requestUpdate()} + @frigate-card:focus=${()=>this.focus()} + > + ${a?q``:""} + ${this._renderMenuStatusContainer("top")} + ${this._renderMenuStatusContainer("overlay")} +
+ + ${wk(this._controller.getMessageManager().getMessage())} +
+ ${this._renderMenuStatusContainer("bottom")} + ${this._config?.elements?q` {this._menuButtonController.addDynamicMenuButton(e.detail),this.requestUpdate()}} + @frigate-card:menu:remove=${e=>{this._menuButtonController.removeDynamicMenuButton(e.detail),this.requestUpdate()}} + @frigate-card:status-bar:add=${e=>{this._controller.getStatusBarItemManager().addDynamicStatusBarItem(e.detail)}} + @frigate-card:status-bar:remove=${e=>{this._controller.getStatusBarItemManager().removeDynamicStatusBarItem(e.detail)}} + @frigate-card:conditions:evaluate=${e=>{e.evaluation=this._controller.getConditionsManager()?.evaluateConditions(e.conditions)}} + > + `:""} +
`)}static get styles(){return o(':host {\n display: block;\n position: relative;\n background-color: var(--card-background-color);\n border-radius: var(--ha-card-border-radius, 4px);\n height: var(--frigate-card-height);\n min-height: 100px;\n pointer-events: all;\n --frigate-card-expand-max-height: calc((100vh - (2 * 56px)) * 0.85);\n --frigate-card-expand-max-width: 85vw;\n --frigate-card-expand-width: none;\n --frigate-card-expand-height: none;\n --frigate-card-expand-aspect-ratio: unset;\n --frigate-card-height: auto;\n}\n\nfrigate-card-loading {\n position: absolute;\n inset: 0;\n z-index: 1;\n}\n\n:host([dark]) {\n filter: brightness(75%);\n}\n\n:host([panel]) {\n height: 100%;\n}\n\ndiv.main {\n position: relative;\n overflow: auto;\n width: 100%;\n height: 100%;\n margin: auto;\n display: block;\n transform: translateZ(0);\n scrollbar-width: none;\n -ms-overflow-style: none;\n}\n\n/* Hide scrollbar for Chrome, Safari and Opera */\ndiv.main::-webkit-scrollbar {\n display: none;\n}\n\ndiv.main.curve-top {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\ndiv.main.curve-bottom {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}\n\nha-card {\n display: flex;\n flex-direction: column;\n margin: auto;\n border: 0px;\n overflow: visible;\n width: 100%;\n height: 100%;\n position: static;\n color: var(--secondary-text-color, white);\n}\n\n/************\n * Fullscreen\n *************/\n:host(:fullscreen) #ha-card {\n border-radius: 0px;\n box-shadow: none;\n margin: 0;\n}\n\n:host(:-webkit-full-screen) #ha-card {\n border-radius: 0px;\n box-shadow: none;\n margin: 0;\n}\n\n:host(:fullscreen) div.main,\n:host(:fullscreen) frigate-card-menu {\n border-radius: 0px;\n}\n\n:host(:-webkit-full-screen) div.main,\n:host(:-webkit-full-screen) frigate-card-menu {\n border-radius: 0px;\n}\n\n/***************\n * Expanded mode\n ***************/\nweb-dialog {\n --dialog-padding: 0px;\n --dialog-container-padding: 0px;\n --dialog-max-height: var(--frigate-card-expand-max-height);\n --dialog-max-width: var(--frigate-card-expand-max-width);\n --dialog-width: var(--frigate-card-expand-width);\n --dialog-height: var(--frigate-card-expand-height);\n --dialog-overflow-x: visible;\n --dialog-overflow-y: visible;\n max-height: 100vh;\n}\n\nweb-dialog::part(dialog) {\n aspect-ratio: var(--frigate-card-expand-aspect-ratio);\n border-radius: 0px;\n background: transparent;\n}\n\n/*************************************\n * "Outside" style for menu/status bar\n *************************************/\n.outerlay[data-position=top] > *:first-child {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n.outerlay[data-position=bottom] > *:last-child {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n/*******************\n * Menu hover styles\n *******************/\nfrigate-card-menu {\n z-index: 2;\n}\n\nfrigate-card-menu[data-style*=hover] {\n transition: opacity 0.5s ease;\n opacity: 0;\n}\n\nfrigate-card-menu[data-style*=hover]:hover,\nha-card:hover > frigate-card-overlay > frigate-card-menu[data-style=hover-card] {\n opacity: 1;\n}\n\n/*************************\n * Status bar hover styles\n *************************/\nfrigate-card-status-bar {\n z-index: 1;\n}\n\nfrigate-card-status-bar[data-style*=hover] {\n transition: opacity 0.5s ease;\n opacity: 0;\n}\n\nfrigate-card-status-bar[data-style*=hover]:hover,\nha-card:hover > frigate-card-overlay > frigate-card-status-bar[data-style=hover-card] {\n opacity: 1;\n}')}getCardSize(){return 6}};YE=e([le("frigate-card")],YE);export{Il as $,tr as A,nr as B,Zi as C,ar as D,ir as E,rr as F,Pi as G,Li as H,Ni as I,Fi as J,Vi as K,Hi as L,Bi as M,qi as N,Ui as O,gs as P,Ws as Q,ns as R,Us as S,qo as T,Fo as U,Vo as V,Ho as W,Bo as X,Bs as Y,zl as Z,e as _,se as a,dr as a$,H_ as a0,tw as a1,et as a2,nw as a3,$s as a4,Di as a5,ji as a6,Oi as a7,Ri as a8,Wi as a9,Yr as aA,oo as aB,so as aC,lo as aD,uo as aE,co as aF,ao as aG,io as aH,ro as aI,mo as aJ,_o as aK,vo as aL,ho as aM,po as aN,fo as aO,go as aP,eo as aQ,no as aR,to as aS,Xr as aT,Jr as aU,Kr as aV,Ao as aW,Io as aX,zo as aY,hr as aZ,cr as a_,es as aa,Jo as ab,Xo as ac,ts as ad,hs as ae,us as af,ms as ag,qs as ah,ps as ai,So as aj,Co as ak,To as al,Mo as am,ko as an,qr as ao,Ur as ap,Wr as aq,Zr as ar,Eo as as,$o as at,yo as au,xo as av,bo as aw,wo as ax,Qr as ay,Gr as az,pe as b,ja as b$,ur as b0,lr as b1,sr as b2,mr as b3,gr as b4,fr as b5,_r as b6,xr as b7,Hr as b8,Cr as b9,Po as bA,Wo as bB,Zo as bC,Go as bD,Yo as bE,Qo as bF,Uo as bG,vs as bH,_s as bI,ys as bJ,xs as bK,Cs as bL,As as bM,Ms as bN,Es as bO,Ss as bP,Jb as bQ,Kb as bR,Uk as bS,Ug as bT,Ma as bU,Ja as bV,Ya as bW,La as bX,Na as bY,ka as bZ,Oa as b_,kr as ba,Mr as bb,vr as bc,wr as bd,yr as be,br as bf,Sr as bg,Er as bh,$r as bi,Or as bj,zr as bk,Tr as bl,jr as bm,Ir as bn,Ar as bo,Pr as bp,Fr as bq,Vr as br,Dr as bs,Rr as bt,Nr as bu,Lr as bv,Ro as bw,Lo as bx,Oo as by,Do as bz,ew as c,wf as c$,Da as c0,Ta as c1,Ga as c2,Ua as c3,Wa as c4,Za as c5,Qa as c6,_i as c7,fi as c8,Ra as c9,ai as cA,ii as cB,Sa as cC,Ea as cD,pi as cE,hi as cF,gi as cG,mi as cH,Fd as cI,Ca as cJ,ks as cK,ge as cL,fe as cM,W as cN,xe as cO,Gw as cP,Mk as cQ,ze as cR,Yw as cS,df as cT,wk as cU,je as cV,Qg as cW,vw as cX,td as cY,kk as cZ,Ky as c_,Pa as ca,Ha as cb,qa as cc,Fa as cd,Va as ce,Ba as cf,Ka as cg,Xa as ch,ti as ci,ei as cj,yi as ck,vi as cl,bi as cm,wi as cn,$a as co,Aa as cp,za as cq,Ia as cr,ni as cs,ri as ct,oi as cu,si as cv,ci as cw,li as cx,di as cy,ui as cz,aw as d,ba as d$,My as d0,ve as d1,jE as d2,Vd as d3,nu as d4,c as d5,ux as d6,Qv as d7,hx as d8,lx as d9,wx as dA,Ck as dB,U as dC,xf as dD,Bw as dE,kE as dF,CE as dG,yf as dH,Fk as dI,vf as dJ,kf as dK,bf as dL,p_ as dM,h_ as dN,Pv as dO,Lv as dP,Ud as dQ,Vv as dR,Yg as dS,Kg as dT,Cx as dU,Gy as dV,gx as dW,su as dX,sf as dY,Fv as dZ,Hg as d_,px as da,Gg as db,Ev as dc,Wu as dd,Xg as de,Qu as df,Bg as dg,qw as dh,af as di,SE as dj,kx as dk,xk as dl,$w as dm,tx as dn,hy as dp,Bb as dq,qb as dr,UE as ds,WE as dt,Ib as du,qE as dv,Qw as dw,Kw as dx,Xw as dy,Jw as dz,_e as e,nf as e0,$v as e1,zs as e2,Kv as e3,Wv as e4,Z_ as e5,Q_ as e6,Yv as e7,Jg as e8,tf as e9,Lu as eA,Vb as eB,Zv as eC,Nb as eD,lf as eE,qy as eF,Uy as eG,Wy as eH,pf as eI,Qy as eJ,Rg as eK,Zy as eL,s as eM,Ae as eN,ye as eO,bE as eP,me as eQ,be as eR,jb as eS,Zw as eT,Gv as ea,Hk as eb,Hv as ec,rf as ed,Tv as ee,Bk as ef,Iv as eg,zv as eh,jv as ei,qk as ej,Xd as ek,Hd as el,Gd as em,Qd as en,Yd as eo,vu as ep,Jd as eq,eu as er,yu as es,_u as et,Bd as eu,au as ev,gu as ew,Ou as ex,Nu as ey,Fu as ez,ww as f,Fb as g,Xb as h,Dv as i,Lb as j,qg as k,V_ as l,Ki as m,he as n,Gi as o,Ld as p,Qi as q,o as r,of as s,le as t,Yi as u,Hb as v,Xi as w,q as x,er as y,Ji as z}; diff --git a/config/www/community/frigate-hass-card/card-45855f1f.js.gz b/config/www/community/frigate-hass-card/card-45855f1f.js.gz new file mode 100644 index 00000000..cd5fb1c7 Binary files /dev/null and b/config/www/community/frigate-hass-card/card-45855f1f.js.gz differ diff --git a/config/www/community/frigate-hass-card/card-769e2b91.js b/config/www/community/frigate-hass-card/card-769e2b91.js new file mode 100644 index 00000000..23db575d --- /dev/null +++ b/config/www/community/frigate-hass-card/card-769e2b91.js @@ -0,0 +1,650 @@ +function e(e,t,n,a){var i,r=arguments.length,o=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,n):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,a);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(r<3?i(o):r>3?i(t,n,o):i(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o}"function"==typeof SuppressedError&&SuppressedError; +/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const t=globalThis,n=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,a=Symbol(),i=new WeakMap;let r=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==a)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(n&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=i.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&i.set(t,e))}return e}toString(){return this.cssText}};const o=e=>new r("string"==typeof e?e:e+"",void 0,a),s=(e,...t)=>{const n=1===e.length?e[0]:t.reduce(((t,n,a)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+e[a+1]),e[0]);return new r(n,e,a)},c=(e,a)=>{if(n)e.adoptedStyleSheets=a.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(const n of a){const a=document.createElement("style"),i=t.litNonce;void 0!==i&&a.setAttribute("nonce",i),a.textContent=n.cssText,e.appendChild(a)}},l=n?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return o(t)})(e):e +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,{is:d,defineProperty:u,getOwnPropertyDescriptor:h,getOwnPropertyNames:p,getOwnPropertySymbols:m,getPrototypeOf:g}=Object,f=globalThis,_=f.trustedTypes,v=_?_.emptyScript:"",y=f.reactiveElementPolyfillSupport,b=(e,t)=>e,w={toAttribute(e,t){switch(t){case Boolean:e=e?v:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},x=(e,t)=>!d(e,t),C={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:x};Symbol.metadata??=Symbol("metadata"),f.litPropertyMetadata??=new WeakMap;class M extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=C){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){const n=Symbol(),a=this.getPropertyDescriptor(e,n,t);void 0!==a&&u(this.prototype,e,a)}}static getPropertyDescriptor(e,t,n){const{get:a,set:i}=h(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get(){return a?.call(this)},set(t){const r=a?.call(this);i.call(this,t),this.requestUpdate(e,r,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??C}static _$Ei(){if(this.hasOwnProperty(b("elementProperties")))return;const e=g(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(b("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(b("properties"))){const e=this.properties,t=[...p(e),...m(e)];for(const n of t)this.createProperty(n,e[n])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const n=this._$Eu(e,t);void 0!==n&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(l(e))}else void 0!==e&&t.push(l(e));return t}static _$Eu(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((e=>e(this)))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return c(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((e=>e.hostConnected?.()))}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach((e=>e.hostDisconnected?.()))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EC(e,t){const n=this.constructor.elementProperties.get(e),a=this.constructor._$Eu(e,n);if(void 0!==a&&!0===n.reflect){const i=(void 0!==n.converter?.toAttribute?n.converter:w).toAttribute(t,n.type);this._$Em=e,null==i?this.removeAttribute(a):this.setAttribute(a,i),this._$Em=null}}_$AK(e,t){const n=this.constructor,a=n._$Eh.get(e);if(void 0!==a&&this._$Em!==a){const e=n.getPropertyOptions(a),i="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:w;this._$Em=a,this[a]=i.fromAttribute(t,e.type),this._$Em=null}}requestUpdate(e,t,n){if(void 0!==e){if(n??=this.constructor.getPropertyOptions(e),!(n.hasChanged??x)(this[e],t))return;this.P(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(e,t,n){this._$AL.has(e)||this._$AL.set(e,t),!0===n.reflect&&this._$Em!==e&&(this._$Ej??=new Set).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,n]of e)!0!==n.wrapped||this._$AL.has(t)||void 0===this[t]||this.P(t,this[t],n)}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach((e=>e.hostUpdate?.())),this.update(t)):this._$EU()}catch(t){throw e=!1,this._$EU(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&=this._$Ej.forEach((e=>this._$EC(e,this[e]))),this._$EU()}updated(e){}firstUpdated(e){}}M.elementStyles=[],M.shadowRootOptions={mode:"open"},M[b("elementProperties")]=new Map,M[b("finalized")]=new Map,y?.({ReactiveElement:M}),(f.reactiveElementVersions??=[]).push("2.0.4"); +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const k=globalThis,S=k.trustedTypes,E=S?S.createPolicy("lit-html",{createHTML:e=>e}):void 0,$="$lit$",A=`lit$${(Math.random()+"").slice(9)}$`,z="?"+A,I=`<${z}>`,T=document,j=()=>T.createComment(""),O=e=>null===e||"object"!=typeof e&&"function"!=typeof e,D=Array.isArray,R="[ \t\n\f\r]",P=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,L=/-->/g,N=/>/g,F=RegExp(`>|${R}(?:([^\\s"'>=/]+)(${R}*=${R}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),V=/'/g,H=/"/g,B=/^(?:script|style|textarea|title)$/i,q=(e=>(t,...n)=>({_$litType$:e,strings:t,values:n}))(1),U=Symbol.for("lit-noChange"),W=Symbol.for("lit-nothing"),Z=new WeakMap,Q=T.createTreeWalker(T,129);function G(e,t){if(!Array.isArray(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==E?E.createHTML(t):t}const Y=(e,t)=>{const n=e.length-1,a=[];let i,r=2===t?"":"",o=P;for(let t=0;t"===c[0]?(o=i??P,l=-1):void 0===c[1]?l=-2:(l=o.lastIndex-c[2].length,s=c[1],o=void 0===c[3]?F:'"'===c[3]?H:V):o===H||o===V?o=F:o===L||o===N?o=P:(o=F,i=void 0);const u=o===F&&e[t+1].startsWith("/>")?" ":"";r+=o===P?n+I:l>=0?(a.push(s),n.slice(0,l)+$+n.slice(l)+A+u):n+A+(-2===l?t:u)}return[G(e,r+(e[n]||"")+(2===t?"":"")),a]};class K{constructor({strings:e,_$litType$:t},n){let a;this.parts=[];let i=0,r=0;const o=e.length-1,s=this.parts,[c,l]=Y(e,t);if(this.el=K.createElement(c,n),Q.currentNode=this.el.content,2===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(a=Q.nextNode())&&s.length0){a.textContent=S?S.emptyScript:"";for(let n=0;nD(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}S(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.S(e))}_(e){this._$AH!==W&&O(this._$AH)?this._$AA.nextSibling.data=e:this.T(T.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:n}=e,a="number"==typeof n?this._$AC(e):(void 0===n.el&&(n.el=K.createElement(G(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===a)this._$AH.p(t);else{const e=new J(a,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=Z.get(e.strings);return void 0===t&&Z.set(e.strings,t=new K(e)),t}k(e){D(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,a=0;for(const i of e)a===t.length?t.push(n=new ee(this.S(j()),this.S(j()),this,this.options)):n=t[a],n._$AI(i),a++;a2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=W}_$AI(e,t=this,n,a){const i=this.strings;let r=!1;if(void 0===i)e=X(this,e,t,0),r=!O(e)||e!==this._$AH&&e!==U,r&&(this._$AH=e);else{const a=e;let o,s;for(e=i[0],o=0;o{const a=n?.renderBefore??t;let i=a._$litPart$;if(void 0===i){const e=n?.renderBefore??null;a._$litPart$=i=new ee(t.insertBefore(j(),e),e,void 0,n??{})}return i._$AI(e),i})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return U}};se._$litElement$=!0,se.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:se});const ce=globalThis.litElementPolyfillSupport;ce?.({LitElement:se}),(globalThis.litElementVersions??=[]).push("4.0.4"); +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const le=e=>(t,n)=>{void 0!==n?n.addInitializer((()=>{customElements.define(e,t)})):customElements.define(e,t)} +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,de={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:x},ue=(e=de,t,n)=>{const{kind:a,metadata:i}=n;let r=globalThis.litPropertyMetadata.get(i);if(void 0===r&&globalThis.litPropertyMetadata.set(i,r=new Map),r.set(n.name,e),"accessor"===a){const{name:a}=n;return{set(n){const i=t.get.call(this);t.set.call(this,n),this.requestUpdate(a,i,e)},init(t){return void 0!==t&&this.P(a,void 0,e),t}}}if("setter"===a){const{name:a}=n;return function(n){const i=this[a];t.call(this,n),this.requestUpdate(a,i,e)}}throw Error("Unsupported decorator location: "+a)};function he(e){return(t,n)=>"object"==typeof n?ue(e,t,n):((e,t,n)=>{const a=t.hasOwnProperty(n);return t.constructor.createProperty(n,a?{...e,wrapped:!0}:e),a?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n) +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */}function pe(e){return he({...e,state:!0,attribute:!1})} +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const me={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},ge=e=>(...t)=>({_$litDirective$:e,values:t});let fe=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}; +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const _e=ge(class extends fe{constructor(e){if(super(e),e.type!==me.ATTRIBUTE||"class"!==e.name||e.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter((t=>e[t])).join(" ")+" "}update(e,[t]){if(void 0===this.st){this.st=new Set,void 0!==e.strings&&(this.nt=new Set(e.strings.join(" ").split(/\s/).filter((e=>""!==e))));for(const e in t)t[e]&&!this.nt?.has(e)&&this.st.add(e);return this.render(t)}const n=e.element.classList;for(const e of this.st)e in t||(n.remove(e),this.st.delete(e));for(const e in t){const a=!!t[e];a===this.st.has(e)||this.nt?.has(e)||(a?(n.add(e),this.st.add(e)):(n.remove(e),this.st.delete(e)))}return U}}),ve=e=>e??W +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,ye=e=>null===e||"object"!=typeof e&&"function"!=typeof e,be=e=>void 0===e.strings,we={},xe=(e,t=we)=>e._$AH=t +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,Ce=(e,t)=>{const n=e._$AN;if(void 0===n)return!1;for(const e of n)e._$AO?.(t,!1),Ce(e,t);return!0},Me=e=>{let t,n;do{if(void 0===(t=e._$AM))break;n=t._$AN,n.delete(e),e=t}while(0===n?.size)},ke=e=>{for(let t;t=e._$AM;e=t){let n=t._$AN;if(void 0===n)t._$AN=n=new Set;else if(n.has(e))break;n.add(e),$e(t)}}; +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */function Se(e){void 0!==this._$AN?(Me(this),this._$AM=e,ke(this)):this._$AM=e}function Ee(e,t=!1,n=0){const a=this._$AH,i=this._$AN;if(void 0!==i&&0!==i.size)if(t)if(Array.isArray(a))for(let e=n;e{e.type==me.CHILD&&(e._$AP??=Ee,e._$AQ??=Se)};class Ae extends fe{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,n){super._$AT(e,t,n),ke(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(Ce(this,e),Me(this))}setValue(e){if(be(this._$Ct))this._$Ct._$AI(e,this);else{const t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}} +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const ze=()=>new Ie;let Ie=class{};const Te=new WeakMap,je=ge(class extends Ae{render(e){return W}update(e,[t]){const n=t!==this.Y;return n&&void 0!==this.Y&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.Y=t,this.ht=e.options?.host,this.rt(this.ct=e.element)),W}rt(e){if("function"==typeof this.Y){const t=this.ht??globalThis;let n=Te.get(t);void 0===n&&(n=new WeakMap,Te.set(t,n)),void 0!==n.get(this.Y)&&this.Y.call(this.ht,void 0),n.set(this.Y,e),void 0!==e&&this.Y.call(this.ht,e)}else this.Y.value=e}get lt(){return"function"==typeof this.Y?Te.get(this.ht??globalThis)?.get(this.Y):this.Y?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}}),Oe="important",De=" !"+Oe,Re=ge(class extends fe{constructor(e){if(super(e),e.type!==me.ATTRIBUTE||"style"!==e.name||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce(((t,n)=>{const a=e[n];return null==a?t:t+`${n=n.includes("-")?n:n.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${a};`}),"")}update(e,[t]){const{style:n}=e.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(t)),this.render(t);for(const e of this.ft)null==t[e]&&(this.ft.delete(e),e.includes("-")?n.removeProperty(e):n[e]=null);for(const e in t){const a=t[e];if(null!=a){this.ft.add(e);const t="string"==typeof a&&a.endsWith(De);e.includes("-")||t?n.setProperty(e,t?a.slice(0,-11):a,t?Oe:""):n[e]=a}}return U}}); +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */function Pe(e,t,n,a=20,i=0){let r=[];if(i>=a)return r;const o=e=>{const r=e.assignedNodes().filter((e=>1===e.nodeType));return r.length>0?Pe(r[0].parentElement,t,n,a,i+1):[]},s=Array.from(e.children||[]);for(const e of s)t(e)||(n(e)&&r.push(e),null!=e.shadowRoot?r.push(...Pe(e.shadowRoot,t,n,a,i+1)):"SLOT"===e.tagName?r.push(...o(e)):r.push(...Pe(e,t,n,a,i+1)));return r}function Le(e){return e.hasAttribute("hidden")||e.hasAttribute("aria-hidden")&&"false"!==e.getAttribute("aria-hidden")||"none"===e.style.display||"0"===e.style.opacity||"hidden"===e.style.visibility||"collapse"===e.style.visibility}function Ne(e){return"-1"!==e.getAttribute("tabindex")&&!Le(e)&&!function(e){return e.hasAttribute("disabled")||e.hasAttribute("aria-disabled")&&"false"!==e.getAttribute("aria-disabled")}(e)&&(e.hasAttribute("tabindex")||(e instanceof HTMLAnchorElement||e instanceof HTMLAreaElement)&&e.hasAttribute("href")||e instanceof HTMLButtonElement||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e instanceof HTMLIFrameElement)}const Fe=new Map;const Ve=document.createElement("template");Ve.innerHTML='\n\t
\n\t
\n\t\n\t
\n';class He extends HTMLElement{constructor(){super(),this.debounceId=Math.random().toString(),this._focused=!1;const e=this.attachShadow({mode:"open"});e.appendChild(Ve.content.cloneNode(!0)),this.$backup=e.querySelector("#backup"),this.$start=e.querySelector("#start"),this.$end=e.querySelector("#end"),this.focusLastElement=this.focusLastElement.bind(this),this.focusFirstElement=this.focusFirstElement.bind(this),this.onFocusIn=this.onFocusIn.bind(this),this.onFocusOut=this.onFocusOut.bind(this)}static get observedAttributes(){return["inactive"]}get inactive(){return this.hasAttribute("inactive")}set inactive(e){e?this.setAttribute("inactive",""):this.removeAttribute("inactive")}get focused(){return this._focused}connectedCallback(){this.$start.addEventListener("focus",this.focusLastElement),this.$end.addEventListener("focus",this.focusFirstElement),this.addEventListener("focusin",this.onFocusIn),this.addEventListener("focusout",this.onFocusOut),this.render()}disconnectedCallback(){this.$start.removeEventListener("focus",this.focusLastElement),this.$end.removeEventListener("focus",this.focusFirstElement),this.removeEventListener("focusin",this.onFocusIn),this.removeEventListener("focusout",this.onFocusOut)}attributeChangedCallback(){this.render()}focusFirstElement(){this.trapFocus()}focusLastElement(){this.trapFocus(!0)}getFocusableElements(){return Pe(this,Le,Ne)}trapFocus(e){if(this.inactive)return;let t=this.getFocusableElements();t.length>0?(e?t[t.length-1].focus():t[0].focus(),this.$backup.setAttribute("tabindex","-1")):(this.$backup.setAttribute("tabindex","0"),this.$backup.focus())}onFocusIn(){this.updateFocused(!0)}onFocusOut(){this.updateFocused(!1)}updateFocused(e){!function(e,t,n){const a=Fe.get(n);null!=a&&window.clearTimeout(a),Fe.set(n,window.setTimeout((()=>{e(),Fe.delete(n)}),t))}((()=>{this.focused!==e&&(this._focused=e,this.render())}),0,this.debounceId)}render(){this.$start.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.$end.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.focused?this.setAttribute("focused",""):this.removeAttribute("focused")}}function Be(e){return Number(e.getAttribute("data-dialog-count"))||0}function qe(e,t){e.setAttribute("data-dialog-count",t.toString())}function Ue(e=document.activeElement){return null!=e&&null!=e.shadowRoot&&null!=e.shadowRoot.activeElement?Ue(e.shadowRoot.activeElement):e}window.customElements.define("focus-trap",He);const We=document.createElement("template");We.innerHTML='\n \n
\n \n \n \n';class Ze extends HTMLElement{constructor(){super(),this.$scrollContainer=document.documentElement,this.$previousActiveElement=null;const e=this.attachShadow({mode:"open"});e.appendChild(We.content.cloneNode(!0)),this.$dialog=e.querySelector("#dialog"),this.$backdrop=e.querySelector("#backdrop"),this.onBackdropClick=this.onBackdropClick.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.setAttribute("aria-modal","true"),this.$dialog.setAttribute("role","alertdialog")}static get observedAttributes(){return["open","center"]}get open(){return this.hasAttribute("open")}set open(e){e?this.setAttribute("open",""):this.removeAttribute("open")}get center(){return this.hasAttribute("center")}set center(e){e?this.setAttribute("center",""):this.removeAttribute("center")}connectedCallback(){this.$backdrop.addEventListener("click",this.onBackdropClick)}disconnectedCallback(){this.$backdrop.removeEventListener("click",this.onBackdropClick),this.open&&this.didClose()}show(){this.open=!0}close(e){this.result=e,this.open=!1}onBackdropClick(){this.assertClosing()&&this.close()}onKeyDown(e){if("Escape"===e.code)this.assertClosing()&&(this.close(),e.stopImmediatePropagation())}assertClosing(){return this.dispatchEvent(new CustomEvent("closing",{cancelable:!0}))}didOpen(){this.$previousActiveElement=Ue(document.activeElement),requestAnimationFrame((()=>{this.$dialog.focusFirstElement()})),this.tabIndex=0,this.$scrollContainer.style.overflow="hidden",this.addEventListener("keydown",this.onKeyDown,{capture:!0,passive:!0}),qe(this.$scrollContainer,Be(this.$scrollContainer)+1),this.dispatchEvent(new CustomEvent("open"))}didClose(){this.removeEventListener("keydown",this.onKeyDown,{capture:!0}),qe(this.$scrollContainer,Math.max(0,Be(this.$scrollContainer)-1)),Be(this.$scrollContainer)<=0&&(this.$scrollContainer.style.overflow=""),this.tabIndex=-1,null!=this.$previousActiveElement&&(this.$previousActiveElement.focus(),this.$previousActiveElement=null),this.dispatchEvent(new CustomEvent("close",{detail:this.result}))}attributeChangedCallback(e,t,n){if("open"===e)this.open?this.didOpen():this.didClose()}}var Qe,Ge;function Ye(e){return e.substr(0,e.indexOf("."))}customElements.define("web-dialog",Ze),function(e){e.language="language",e.system="system",e.comma_decimal="comma_decimal",e.decimal_comma="decimal_comma",e.space_comma="space_comma",e.none="none"}(Qe||(Qe={})),function(e){e.language="language",e.system="system",e.am_pm="12",e.twenty_four="24"}(Ge||(Ge={}));var Ke,Xe,Je=["closed","locked","off"],et=function(e,t,n,a){a=a||{},n=null==n?{}:n;var i=new Event(t,{bubbles:void 0===a.bubbles||a.bubbles,cancelable:Boolean(a.cancelable),composed:void 0===a.composed||a.composed});return i.detail=n,e.dispatchEvent(i),i},tt=function(e){et(window,"haptic",e)},nt=function(e,t){return function(e,t,n){void 0===n&&(n=!0);var a,i=Ye(t),r="group"===i?"homeassistant":i;switch(i){case"lock":a=n?"unlock":"lock";break;case"cover":a=n?"open_cover":"close_cover";break;default:a=n?"turn_on":"turn_off"}return e.callService(r,a,{entity_id:t})}(e,t,Je.includes(e.states[t].state))},at=function(e,t,n,a){if(a||(a={action:"more-info"}),!a.confirmation||a.confirmation.exemptions&&a.confirmation.exemptions.some((function(e){return e.user===t.user.id}))||(tt("warning"),confirm(a.confirmation.text||"Are you sure you want to "+a.action+"?")))switch(a.action){case"more-info":(n.entity||n.camera_image)&&et(e,"hass-more-info",{entityId:n.entity?n.entity:n.camera_image});break;case"navigate":a.navigation_path&&function(e,t,n){void 0===n&&(n=!1),n?history.replaceState(null,"",t):history.pushState(null,"",t),et(window,"location-changed",{replace:n})}(0,a.navigation_path);break;case"url":a.url_path&&window.open(a.url_path);break;case"toggle":n.entity&&(nt(t,n.entity),tt("success"));break;case"perform-action":if(!a.perform_action)return void tt("failure");var i=a.perform_action.split(".",2);t.callService(i[0],i[1],a.data,a.target),tt("success");break;case"call-service":if(!a.service)return void tt("failure");var r=a.service.split(".",2);t.callService(r[0],r[1],a.data,a.target),tt("success");break;case"fire-dom-event":et(e,"ll-custom",a)}};!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},e.getValidEnumValues=t=>{const n=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),a={};for(const e of n)a[e]=t[e];return e.objectValues(a)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(const n of e)if(t(n))return n},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(Ke||(Ke={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(Xe||(Xe={}));const it=Ke.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),rt=e=>{switch(typeof e){case"undefined":return it.undefined;case"string":return it.string;case"number":return isNaN(e)?it.nan:it.number;case"boolean":return it.boolean;case"function":return it.function;case"bigint":return it.bigint;case"symbol":return it.symbol;case"object":return Array.isArray(e)?it.array:null===e?it.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?it.promise:"undefined"!=typeof Map&&e instanceof Map?it.map:"undefined"!=typeof Set&&e instanceof Set?it.set:"undefined"!=typeof Date&&e instanceof Date?it.date:it.object;default:return it.unknown}},ot=Ke.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class st extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},n={_errors:[]},a=e=>{for(const i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(a);else if("invalid_return_type"===i.code)a(i.returnTypeError);else if("invalid_arguments"===i.code)a(i.argumentsError);else if(0===i.path.length)n._errors.push(t(i));else{let e=n,a=0;for(;ae.message)){const t={},n=[];for(const a of this.issues)a.path.length>0?(t[a.path[0]]=t[a.path[0]]||[],t[a.path[0]].push(e(a))):n.push(e(a));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}st.create=e=>new st(e);const ct=(e,t)=>{let n;switch(e.code){case ot.invalid_type:n=e.received===it.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case ot.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Ke.jsonStringifyReplacer)}`;break;case ot.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ke.joinValues(e.keys,", ")}`;break;case ot.invalid_union:n="Invalid input";break;case ot.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ke.joinValues(e.options)}`;break;case ot.invalid_enum_value:n=`Invalid enum value. Expected ${Ke.joinValues(e.options)}, received '${e.received}'`;break;case ot.invalid_arguments:n="Invalid function arguments";break;case ot.invalid_return_type:n="Invalid function return type";break;case ot.invalid_date:n="Invalid date";break;case ot.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Ke.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case ot.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case ot.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case ot.custom:n="Invalid input";break;case ot.invalid_intersection_types:n="Intersection results could not be merged";break;case ot.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case ot.not_finite:n="Number must be finite";break;default:n=t.defaultError,Ke.assertNever(e)}return{message:n}};let lt=ct;function dt(){return lt}const ut=e=>{const{data:t,path:n,errorMaps:a,issueData:i}=e,r=[...n,...i.path||[]],o={...i,path:r};if(void 0!==i.message)return{...i,path:r,message:i.message};let s="";const c=a.filter((e=>!!e)).slice().reverse();for(const e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:r,message:s}};function ht(e,t){const n=dt(),a=ut({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===ct?void 0:ct].filter((e=>!!e))});e.common.issues.push(a)}class pt{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const a of t){if("aborted"===a.status)return mt;"dirty"===a.status&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const e of t){const t=await e.key,a=await e.value;n.push({key:t,value:a})}return pt.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const a of t){const{key:t,value:i}=a;if("aborted"===t.status)return mt;if("aborted"===i.status)return mt;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"===t.value||void 0===i.value&&!a.alwaysSet||(n[t.value]=i.value)}return{status:e.value,value:n}}}const mt=Object.freeze({status:"aborted"}),gt=e=>({status:"dirty",value:e}),ft=e=>({status:"valid",value:e}),_t=e=>"aborted"===e.status,vt=e=>"dirty"===e.status,yt=e=>"valid"===e.status,bt=e=>"undefined"!=typeof Promise&&e instanceof Promise;function wt(e,t,n,a){if("a"===n&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?a:"a"===n?a.call(e):a?a.value:t.get(e)}function xt(e,t,n,a,i){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?i.call(e,n):i?i.value=n:t.set(e,n),n}var Ct,Mt,kt;"function"==typeof SuppressedError&&SuppressedError,function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(Ct||(Ct={}));class St{constructor(e,t,n,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=a}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Et=(e,t)=>{if(yt(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new st(e.common.issues);return this._error=t,this._error}}};function $t(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:a,description:i}=e;if(t&&(n||a))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:i};return{errorMap:(t,i)=>{var r,o;const{message:s}=e;return"invalid_enum_value"===t.code?{message:null!=s?s:i.defaultError}:void 0===i.data?{message:null!==(r=null!=s?s:a)&&void 0!==r?r:i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:null!==(o=null!=s?s:n)&&void 0!==o?o:i.defaultError}},description:i}}class At{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return rt(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:rt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new pt,ctx:{common:e.parent.common,data:e.data,parsedType:rt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(bt(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const a={common:{issues:[],async:null!==(n=null==t?void 0:t.async)&&void 0!==n&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rt(e)},i=this._parseSync({data:e,path:a.path,parent:a});return Et(a,i)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rt(e)},a=this._parse({data:e,path:n.path,parent:n}),i=await(bt(a)?a:Promise.resolve(a));return Et(n,i)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,a)=>{const i=e(t),r=()=>a.addIssue({code:ot.custom,...n(t)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then((e=>!!e||(r(),!1))):!!i||(r(),!1)}))}refinement(e,t){return this._refinement(((n,a)=>!!e(n)||(a.addIssue("function"==typeof t?t(n,a):t),!1)))}_refinement(e){return new kn({schema:this,typeName:Pn.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Sn.create(this,this._def)}nullable(){return En.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return on.create(this,this._def)}promise(){return Mn.create(this,this._def)}or(e){return ln.create([this,e],this._def)}and(e){return pn.create(this,e,this._def)}transform(e){return new kn({...$t(this._def),schema:this,typeName:Pn.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new $n({...$t(this._def),innerType:this,defaultValue:t,typeName:Pn.ZodDefault})}brand(){return new Tn({typeName:Pn.ZodBranded,type:this,...$t(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new An({...$t(this._def),innerType:this,catchValue:t,typeName:Pn.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return jn.create(this,e)}readonly(){return On.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const zt=/^c[^\s-]{8,}$/i,It=/^[0-9a-z]+$/,Tt=/^[0-9A-HJKMNP-TV-Z]{26}$/,jt=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ot=/^[a-z0-9_-]{21}$/i,Dt=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Rt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let Pt;const Lt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Nt=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Ft=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Vt="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Ht=new RegExp(`^${Vt}$`);function Bt(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function qt(e){let t=`${Vt}T${Bt(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function Ut(e,t){return!("v4"!==t&&t||!Lt.test(e))||!("v6"!==t&&t||!Nt.test(e))}class Wt extends At{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==it.string){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.string,received:t.parsedType}),mt}const t=new pt;let n;for(const a of this._def.checks)if("min"===a.kind)e.data.lengtha.value&&(n=this._getOrReturnCtx(e,n),ht(n,{code:ot.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("length"===a.kind){const i=e.data.length>a.value,r=e.data.lengthe.test(t)),{validation:t,code:ot.invalid_string,...Ct.errToObj(n)})}_addCheck(e){return new Wt({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ct.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ct.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ct.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ct.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ct.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ct.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ct.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ct.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ct.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ct.errToObj(e)})}datetime(e){var t,n;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(n=null==e?void 0:e.local)&&void 0!==n&&n,...Ct.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...Ct.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Ct.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Ct.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...Ct.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Ct.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Ct.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Ct.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Ct.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Ct.errToObj(t)})}nonempty(e){return this.min(1,Ct.errToObj(e))}trim(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.valuea?n:a;return parseInt(e.toFixed(i).replace(".",""))%parseInt(t.toFixed(i).replace(".",""))/Math.pow(10,i)}Wt.create=e=>{var t;return new Wt({checks:[],typeName:Pn.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...$t(e)})};class Qt extends At{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==it.number){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.number,received:t.parsedType}),mt}let t;const n=new pt;for(const a of this._def.checks)if("int"===a.kind)Ke.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty());else if("min"===a.kind){(a.inclusive?e.dataa.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty())}else"multipleOf"===a.kind?0!==Zt(e.data,a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.not_finite,message:a.message}),n.dirty()):Ke.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ct.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ct.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ct.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ct.toString(t))}setLimit(e,t,n,a){return new Qt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Ct.toString(a)}]})}_addCheck(e){return new Qt({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ct.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ct.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ct.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ct.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ct.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ct.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Ct.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ct.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ct.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value"int"===e.kind||"multipleOf"===e.kind&&Ke.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.valuenew Qt({checks:[],typeName:Pn.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...$t(e)});class Gt extends At{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){this._def.coerce&&(e.data=BigInt(e.data));if(this._getType(e)!==it.bigint){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.bigint,received:t.parsedType}),mt}let t;const n=new pt;for(const a of this._def.checks)if("min"===a.kind){(a.inclusive?e.dataa.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty())}else"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):Ke.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ct.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ct.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ct.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ct.toString(t))}setLimit(e,t,n,a){return new Gt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Ct.toString(a)}]})}_addCheck(e){return new Gt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ct.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ct.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ct.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ct.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ct.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value{var t;return new Gt({checks:[],typeName:Pn.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...$t(e)})};class Yt extends At{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==it.boolean){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.boolean,received:t.parsedType}),mt}return ft(e.data)}}Yt.create=e=>new Yt({typeName:Pn.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...$t(e)});class Kt extends At{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==it.date){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.date,received:t.parsedType}),mt}if(isNaN(e.data.getTime())){return ht(this._getOrReturnCtx(e),{code:ot.invalid_date}),mt}const t=new pt;let n;for(const a of this._def.checks)"min"===a.kind?e.data.getTime()a.value&&(n=this._getOrReturnCtx(e,n),ht(n,{code:ot.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),t.dirty()):Ke.assertNever(a);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Kt({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Ct.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Ct.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.valuenew Kt({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Pn.ZodDate,...$t(e)});class Xt extends At{_parse(e){if(this._getType(e)!==it.symbol){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.symbol,received:t.parsedType}),mt}return ft(e.data)}}Xt.create=e=>new Xt({typeName:Pn.ZodSymbol,...$t(e)});class Jt extends At{_parse(e){if(this._getType(e)!==it.undefined){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.undefined,received:t.parsedType}),mt}return ft(e.data)}}Jt.create=e=>new Jt({typeName:Pn.ZodUndefined,...$t(e)});class en extends At{_parse(e){if(this._getType(e)!==it.null){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.null,received:t.parsedType}),mt}return ft(e.data)}}en.create=e=>new en({typeName:Pn.ZodNull,...$t(e)});class tn extends At{constructor(){super(...arguments),this._any=!0}_parse(e){return ft(e.data)}}tn.create=e=>new tn({typeName:Pn.ZodAny,...$t(e)});class nn extends At{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ft(e.data)}}nn.create=e=>new nn({typeName:Pn.ZodUnknown,...$t(e)});class an extends At{_parse(e){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.never,received:t.parsedType}),mt}}an.create=e=>new an({typeName:Pn.ZodNever,...$t(e)});class rn extends At{_parse(e){if(this._getType(e)!==it.undefined){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.void,received:t.parsedType}),mt}return ft(e.data)}}rn.create=e=>new rn({typeName:Pn.ZodVoid,...$t(e)});class on extends At{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),a=this._def;if(t.parsedType!==it.array)return ht(t,{code:ot.invalid_type,expected:it.array,received:t.parsedType}),mt;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,i=t.data.lengtha.maxLength.value&&(ht(t,{code:ot.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map(((e,n)=>a.type._parseAsync(new St(t,e,t.path,n))))).then((e=>pt.mergeArray(n,e)));const i=[...t.data].map(((e,n)=>a.type._parseSync(new St(t,e,t.path,n))));return pt.mergeArray(n,i)}get element(){return this._def.type}min(e,t){return new on({...this._def,minLength:{value:e,message:Ct.toString(t)}})}max(e,t){return new on({...this._def,maxLength:{value:e,message:Ct.toString(t)}})}length(e,t){return new on({...this._def,exactLength:{value:e,message:Ct.toString(t)}})}nonempty(e){return this.min(1,e)}}function sn(e){if(e instanceof cn){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=Sn.create(sn(a))}return new cn({...e._def,shape:()=>t})}return e instanceof on?new on({...e._def,type:sn(e.element)}):e instanceof Sn?Sn.create(sn(e.unwrap())):e instanceof En?En.create(sn(e.unwrap())):e instanceof mn?mn.create(e.items.map((e=>sn(e)))):e}on.create=(e,t)=>new on({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Pn.ZodArray,...$t(t)});class cn extends At{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=Ke.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==it.object){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.object,received:t.parsedType}),mt}const{status:t,ctx:n}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),r=[];if(!(this._def.catchall instanceof an&&"strip"===this._def.unknownKeys))for(const e in n.data)i.includes(e)||r.push(e);const o=[];for(const e of i){const t=a[e],i=n.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new St(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof an){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of r)o.push({key:{status:"valid",value:e},value:{status:"valid",value:n.data[e]}});else if("strict"===e)r.length>0&&(ht(n,{code:ot.unrecognized_keys,keys:r}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of r){const a=n.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new St(n,a,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of o){const n=await t.key,a=await t.value;e.push({key:n,value:a,alwaysSet:t.alwaysSet})}return e})).then((e=>pt.mergeObjectSync(t,e))):pt.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return Ct.errToObj,new cn({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var a,i,r,o;const s=null!==(r=null===(i=(a=this._def).errorMap)||void 0===i?void 0:i.call(a,t,n).message)&&void 0!==r?r:n.defaultError;return"unrecognized_keys"===t.code?{message:null!==(o=Ct.errToObj(e).message)&&void 0!==o?o:s}:{message:s}}}:{}})}strip(){return new cn({...this._def,unknownKeys:"strip"})}passthrough(){return new cn({...this._def,unknownKeys:"passthrough"})}extend(e){return new cn({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new cn({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Pn.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new cn({...this._def,catchall:e})}pick(e){const t={};return Ke.objectKeys(e).forEach((n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])})),new cn({...this._def,shape:()=>t})}omit(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{e[n]||(t[n]=this.shape[n])})),new cn({...this._def,shape:()=>t})}deepPartial(){return sn(this)}partial(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{const a=this.shape[n];e&&!e[n]?t[n]=a:t[n]=a.optional()})),new cn({...this._def,shape:()=>t})}required(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof Sn;)e=e._def.innerType;t[n]=e}})),new cn({...this._def,shape:()=>t})}keyof(){return wn(Ke.objectKeys(this.shape))}}cn.create=(e,t)=>new cn({shape:()=>e,unknownKeys:"strip",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)}),cn.strictCreate=(e,t)=>new cn({shape:()=>e,unknownKeys:"strict",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)}),cn.lazycreate=(e,t)=>new cn({shape:e,unknownKeys:"strip",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)});class ln extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map((async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;const n=e.map((e=>new st(e.ctx.common.issues)));return ht(t,{code:ot.invalid_union,unionErrors:n}),mt}));{let e;const a=[];for(const i of n){const n={...t,common:{...t.common,issues:[]},parent:null},r=i._parseSync({data:t.data,path:t.path,parent:n});if("valid"===r.status)return r;"dirty"!==r.status||e||(e={result:r,ctx:n}),n.common.issues.length&&a.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const i=a.map((e=>new st(e)));return ht(t,{code:ot.invalid_union,unionErrors:i}),mt}}get options(){return this._def.options}}ln.create=(e,t)=>new ln({options:e,typeName:Pn.ZodUnion,...$t(t)});const dn=e=>e instanceof yn?dn(e.schema):e instanceof kn?dn(e.innerType()):e instanceof bn?[e.value]:e instanceof xn?e.options:e instanceof Cn?Ke.objectValues(e.enum):e instanceof $n?dn(e._def.innerType):e instanceof Jt?[void 0]:e instanceof en?[null]:e instanceof Sn?[void 0,...dn(e.unwrap())]:e instanceof En?[null,...dn(e.unwrap())]:e instanceof Tn||e instanceof On?dn(e.unwrap()):e instanceof An?dn(e._def.innerType):[];class un extends At{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.object)return ht(t,{code:ot.invalid_type,expected:it.object,received:t.parsedType}),mt;const n=this.discriminator,a=t.data[n],i=this.optionsMap.get(a);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(ht(t,{code:ot.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),mt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const a=new Map;for(const n of t){const t=dn(n.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const i of t){if(a.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);a.set(i,n)}}return new un({typeName:Pn.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...$t(n)})}}function hn(e,t){const n=rt(e),a=rt(t);if(e===t)return{valid:!0,data:e};if(n===it.object&&a===it.object){const n=Ke.objectKeys(t),a=Ke.objectKeys(e).filter((e=>-1!==n.indexOf(e))),i={...e,...t};for(const n of a){const a=hn(e[n],t[n]);if(!a.valid)return{valid:!1};i[n]=a.data}return{valid:!0,data:i}}if(n===it.array&&a===it.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let a=0;a{if(_t(e)||_t(a))return mt;const i=hn(e.value,a.value);return i.valid?((vt(e)||vt(a))&&t.dirty(),{status:t.value,value:i.data}):(ht(n,{code:ot.invalid_intersection_types}),mt)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then((([e,t])=>a(e,t))):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}pn.create=(e,t,n)=>new pn({left:e,right:t,typeName:Pn.ZodIntersection,...$t(n)});class mn extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.array)return ht(n,{code:ot.invalid_type,expected:it.array,received:n.parsedType}),mt;if(n.data.lengththis._def.items.length&&(ht(n,{code:ot.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map(((e,t)=>{const a=this._def.items[t]||this._def.rest;return a?a._parse(new St(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(a).then((e=>pt.mergeArray(t,e))):pt.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new mn({...this._def,rest:e})}}mn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new mn({items:e,typeName:Pn.ZodTuple,rest:null,...$t(t)})};class gn extends At{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.object)return ht(n,{code:ot.invalid_type,expected:it.object,received:n.parsedType}),mt;const a=[],i=this._def.keyType,r=this._def.valueType;for(const e in n.data)a.push({key:i._parse(new St(n,e,n.path,e)),value:r._parse(new St(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?pt.mergeObjectAsync(t,a):pt.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,n){return new gn(t instanceof At?{keyType:e,valueType:t,typeName:Pn.ZodRecord,...$t(n)}:{keyType:Wt.create(),valueType:e,typeName:Pn.ZodRecord,...$t(t)})}}class fn extends At{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.map)return ht(n,{code:ot.invalid_type,expected:it.map,received:n.parsedType}),mt;const a=this._def.keyType,i=this._def.valueType,r=[...n.data.entries()].map((([e,t],r)=>({key:a._parse(new St(n,e,n.path,[r,"key"])),value:i._parse(new St(n,t,n.path,[r,"value"]))})));if(n.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const n of r){const a=await n.key,i=await n.value;if("aborted"===a.status||"aborted"===i.status)return mt;"dirty"!==a.status&&"dirty"!==i.status||t.dirty(),e.set(a.value,i.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const n of r){const a=n.key,i=n.value;if("aborted"===a.status||"aborted"===i.status)return mt;"dirty"!==a.status&&"dirty"!==i.status||t.dirty(),e.set(a.value,i.value)}return{status:t.value,value:e}}}}fn.create=(e,t,n)=>new fn({valueType:t,keyType:e,typeName:Pn.ZodMap,...$t(n)});class _n extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.set)return ht(n,{code:ot.invalid_type,expected:it.set,received:n.parsedType}),mt;const a=this._def;null!==a.minSize&&n.data.sizea.maxSize.value&&(ht(n,{code:ot.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const i=this._def.valueType;function r(e){const n=new Set;for(const a of e){if("aborted"===a.status)return mt;"dirty"===a.status&&t.dirty(),n.add(a.value)}return{status:t.value,value:n}}const o=[...n.data.values()].map(((e,t)=>i._parse(new St(n,e,n.path,t))));return n.common.async?Promise.all(o).then((e=>r(e))):r(o)}min(e,t){return new _n({...this._def,minSize:{value:e,message:Ct.toString(t)}})}max(e,t){return new _n({...this._def,maxSize:{value:e,message:Ct.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}_n.create=(e,t)=>new _n({valueType:e,minSize:null,maxSize:null,typeName:Pn.ZodSet,...$t(t)});class vn extends At{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.function)return ht(t,{code:ot.invalid_type,expected:it.function,received:t.parsedType}),mt;function n(e,n){return ut({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,dt(),ct].filter((e=>!!e)),issueData:{code:ot.invalid_arguments,argumentsError:n}})}function a(e,n){return ut({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,dt(),ct].filter((e=>!!e)),issueData:{code:ot.invalid_return_type,returnTypeError:n}})}const i={errorMap:t.common.contextualErrorMap},r=t.data;if(this._def.returns instanceof Mn){const e=this;return ft((async function(...t){const o=new st([]),s=await e._def.args.parseAsync(t,i).catch((e=>{throw o.addIssue(n(t,e)),o})),c=await Reflect.apply(r,this,s),l=await e._def.returns._def.type.parseAsync(c,i).catch((e=>{throw o.addIssue(a(c,e)),o}));return l}))}{const e=this;return ft((function(...t){const o=e._def.args.safeParse(t,i);if(!o.success)throw new st([n(t,o.error)]);const s=Reflect.apply(r,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new st([a(s,c.error)]);return c.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new vn({...this._def,args:mn.create(e).rest(nn.create())})}returns(e){return new vn({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new vn({args:e||mn.create([]).rest(nn.create()),returns:t||nn.create(),typeName:Pn.ZodFunction,...$t(n)})}}class yn extends At{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}yn.create=(e,t)=>new yn({getter:e,typeName:Pn.ZodLazy,...$t(t)});class bn extends At{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return ht(t,{received:t.data,code:ot.invalid_literal,expected:this._def.value}),mt}return{status:"valid",value:e.data}}get value(){return this._def.value}}function wn(e,t){return new xn({values:e,typeName:Pn.ZodEnum,...$t(t)})}bn.create=(e,t)=>new bn({value:e,typeName:Pn.ZodLiteral,...$t(t)});class xn extends At{constructor(){super(...arguments),Mt.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return ht(t,{expected:Ke.joinValues(n),received:t.parsedType,code:ot.invalid_type}),mt}if(wt(this,Mt,"f")||xt(this,Mt,new Set(this._def.values),"f"),!wt(this,Mt,"f").has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return ht(t,{received:t.data,code:ot.invalid_enum_value,options:n}),mt}return ft(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return xn.create(e,{...this._def,...t})}exclude(e,t=this._def){return xn.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}Mt=new WeakMap,xn.create=wn;class Cn extends At{constructor(){super(...arguments),kt.set(this,void 0)}_parse(e){const t=Ke.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==it.string&&n.parsedType!==it.number){const e=Ke.objectValues(t);return ht(n,{expected:Ke.joinValues(e),received:n.parsedType,code:ot.invalid_type}),mt}if(wt(this,kt,"f")||xt(this,kt,new Set(Ke.getValidEnumValues(this._def.values)),"f"),!wt(this,kt,"f").has(e.data)){const e=Ke.objectValues(t);return ht(n,{received:n.data,code:ot.invalid_enum_value,options:e}),mt}return ft(e.data)}get enum(){return this._def.values}}kt=new WeakMap,Cn.create=(e,t)=>new Cn({values:e,typeName:Pn.ZodNativeEnum,...$t(t)});class Mn extends At{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.promise&&!1===t.common.async)return ht(t,{code:ot.invalid_type,expected:it.promise,received:t.parsedType}),mt;const n=t.parsedType===it.promise?t.data:Promise.resolve(t.data);return ft(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}Mn.create=(e,t)=>new Mn({type:e,typeName:Pn.ZodPromise,...$t(t)});class kn extends At{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Pn.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),a=this._def.effect||null,i={addIssue:e=>{ht(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===a.type){const e=a.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return mt;const a=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===a.status?mt:"dirty"===a.status||"dirty"===t.value?gt(a.value):a}));{if("aborted"===t.value)return mt;const a=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===a.status?mt:"dirty"===a.status||"dirty"===t.value?gt(a.value):a}}if("refinement"===a.type){const e=e=>{const t=a.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===n.common.async){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===a.status?mt:("dirty"===a.status&&t.dirty(),e(a.value),{status:t.value,value:a.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((n=>"aborted"===n.status?mt:("dirty"===n.status&&t.dirty(),e(n.value).then((()=>({status:t.value,value:n.value}))))))}if("transform"===a.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!yt(e))return e;const r=a.transform(e.value,i);if(r instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:r}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((e=>yt(e)?Promise.resolve(a.transform(e.value,i)).then((e=>({status:t.value,value:e}))):e))}Ke.assertNever(a)}}kn.create=(e,t,n)=>new kn({schema:e,typeName:Pn.ZodEffects,effect:t,...$t(n)}),kn.createWithPreprocess=(e,t,n)=>new kn({schema:t,effect:{type:"preprocess",transform:e},typeName:Pn.ZodEffects,...$t(n)});class Sn extends At{_parse(e){return this._getType(e)===it.undefined?ft(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Sn.create=(e,t)=>new Sn({innerType:e,typeName:Pn.ZodOptional,...$t(t)});class En extends At{_parse(e){return this._getType(e)===it.null?ft(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}En.create=(e,t)=>new En({innerType:e,typeName:Pn.ZodNullable,...$t(t)});class $n extends At{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===it.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}$n.create=(e,t)=>new $n({innerType:e,typeName:Pn.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...$t(t)});class An extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return bt(a)?a.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new st(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new st(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}An.create=(e,t)=>new An({innerType:e,typeName:Pn.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...$t(t)});class zn extends At{_parse(e){if(this._getType(e)!==it.nan){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.nan,received:t.parsedType}),mt}return{status:"valid",value:e.data}}}zn.create=e=>new zn({typeName:Pn.ZodNaN,...$t(e)});const In=Symbol("zod_brand");class Tn extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class jn extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?mt:"dirty"===e.status?(t.dirty(),gt(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})()}{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?mt:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new jn({in:e,out:t,typeName:Pn.ZodPipeline})}}class On extends At{_parse(e){const t=this._def.innerType._parse(e),n=e=>(yt(e)&&(e.value=Object.freeze(e.value)),e);return bt(t)?t.then((e=>n(e))):n(t)}unwrap(){return this._def.innerType}}function Dn(e,t={},n){return e?tn.create().superRefine(((a,i)=>{var r,o;if(!e(a)){const e="function"==typeof t?t(a):"string"==typeof t?{message:t}:t,s=null===(o=null!==(r=e.fatal)&&void 0!==r?r:n)||void 0===o||o,c="string"==typeof e?{message:e}:e;i.addIssue({code:"custom",...c,fatal:s})}})):tn.create()}On.create=(e,t)=>new On({innerType:e,typeName:Pn.ZodReadonly,...$t(t)});const Rn={object:cn.lazycreate};var Pn;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(Pn||(Pn={}));const Ln=Wt.create,Nn=Qt.create,Fn=zn.create,Vn=Gt.create,Hn=Yt.create,Bn=Kt.create,qn=Xt.create,Un=Jt.create,Wn=en.create,Zn=tn.create,Qn=nn.create,Gn=an.create,Yn=rn.create,Kn=on.create,Xn=cn.create,Jn=cn.strictCreate,ea=ln.create,ta=un.create,na=pn.create,aa=mn.create,ia=gn.create,ra=fn.create,oa=_n.create,sa=vn.create,ca=yn.create,la=bn.create,da=xn.create,ua=Cn.create,ha=Mn.create,pa=kn.create,ma=Sn.create,ga=En.create,fa=kn.createWithPreprocess,_a=jn.create,va={string:e=>Wt.create({...e,coerce:!0}),number:e=>Qt.create({...e,coerce:!0}),boolean:e=>Yt.create({...e,coerce:!0}),bigint:e=>Gt.create({...e,coerce:!0}),date:e=>Kt.create({...e,coerce:!0})},ya=mt;var ba=Object.freeze({__proto__:null,defaultErrorMap:ct,setErrorMap:function(e){lt=e},getErrorMap:dt,makeIssue:ut,EMPTY_PATH:[],addIssueToContext:ht,ParseStatus:pt,INVALID:mt,DIRTY:gt,OK:ft,isAborted:_t,isDirty:vt,isValid:yt,isAsync:bt,get util(){return Ke},get objectUtil(){return Xe},ZodParsedType:it,getParsedType:rt,ZodType:At,datetimeRegex:qt,ZodString:Wt,ZodNumber:Qt,ZodBigInt:Gt,ZodBoolean:Yt,ZodDate:Kt,ZodSymbol:Xt,ZodUndefined:Jt,ZodNull:en,ZodAny:tn,ZodUnknown:nn,ZodNever:an,ZodVoid:rn,ZodArray:on,ZodObject:cn,ZodUnion:ln,ZodDiscriminatedUnion:un,ZodIntersection:pn,ZodTuple:mn,ZodRecord:gn,ZodMap:fn,ZodSet:_n,ZodFunction:vn,ZodLazy:yn,ZodLiteral:bn,ZodEnum:xn,ZodNativeEnum:Cn,ZodPromise:Mn,ZodEffects:kn,ZodTransformer:kn,ZodOptional:Sn,ZodNullable:En,ZodDefault:$n,ZodCatch:An,ZodNaN:zn,BRAND:In,ZodBranded:Tn,ZodPipeline:jn,ZodReadonly:On,custom:Dn,Schema:At,ZodSchema:At,late:Rn,get ZodFirstPartyTypeKind(){return Pn},coerce:va,any:Zn,array:Kn,bigint:Vn,boolean:Hn,date:Bn,discriminatedUnion:ta,effect:pa,enum:da,function:sa,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>Dn((t=>t instanceof e),t),intersection:na,lazy:ca,literal:la,map:ra,nan:Fn,nativeEnum:ua,never:Gn,null:Wn,nullable:ga,number:Nn,object:Xn,oboolean:()=>Hn().optional(),onumber:()=>Nn().optional(),optional:ma,ostring:()=>Ln().optional(),pipeline:_a,preprocess:fa,promise:ha,record:ia,set:oa,strictObject:Jn,string:Ln,symbol:qn,transformer:pa,tuple:aa,undefined:Un,union:ea,unknown:Qn,void:Yn,NEVER:ya,ZodIssueCode:ot,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:st});const wa="https://github.com/dermotduffy/frigate-hass-card",xa=`${wa}#troubleshooting`,Ca="cameras",Ma=`${Ca}.#.camera_entity`,ka=`${Ca}.#.frigate.camera_name`,Sa=`${Ca}.#.capabilities.disable`,Ea=`${Ca}.#.capabilities.disable_except`,$a=`${Ca}.#.cast.method`,Aa=`${Ca}.#.cast.dashboard.dashboard_path`,za=`${Ca}.#.cast.dashboard.view_path`,Ia=`${Ca}.#.dimensions.aspect_ratio`,Ta=`${Ca}.#.frigate.client_id`,ja=`${Ca}.#.frigate.labels`,Oa=`${Ca}.#.frigate.url`,Da=`${Ca}.#.frigate.zones`,Ra=`${Ca}.#.go2rtc.modes`,Pa=`${Ca}.#.go2rtc.stream`,La=`${Ca}.#.icon`,Na=`${Ca}.#.id`,Fa=`${Ca}.#.image.entity`,Va=`${Ca}.#.image.entity_parameters`,Ha=`${Ca}.#.image.mode`,Ba=`${Ca}.#.image.refresh_seconds`,qa=`${Ca}.#.image.url`,Ua=`${Ca}.#.motioneye.images.directory_pattern`,Wa=`${Ca}.#.motioneye.images.file_pattern`,Za=`${Ca}.#.motioneye.movies.directory_pattern`,Qa=`${Ca}.#.motioneye.movies.file_pattern`,Ga=`${Ca}.#.motioneye.url`,Ya=`${Ca}.#.title`,Ka=`${Ca}.#.webrtc_card.entity`,Xa=`${Ca}.#.webrtc_card.url`,Ja=`${Ca}.#.live_provider`,ei=`${Ca}.#.dependencies.cameras`,ti=`${Ca}.#.dependencies.all_cameras`,ni=`${Ca}.#.dimensions.layout.fit`,ai=`${Ca}.#.dimensions.layout.pan.x`,ii=`${Ca}.#.dimensions.layout.pan.y`,ri=`${Ca}.#.dimensions.layout.position.x`,oi=`${Ca}.#.dimensions.layout.position.y`,si=`${Ca}.#.dimensions.layout.view_box.top`,ci=`${Ca}.#.dimensions.layout.view_box.bottom`,li=`${Ca}.#.dimensions.layout.view_box.left`,di=`${Ca}.#.dimensions.layout.view_box.right`,ui=`${Ca}.#.dimensions.layout.zoom`,hi=`${Ca}.#.proxy.dynamic`,pi=`${Ca}.#.proxy.media`,mi=`${Ca}.#.proxy.ssl_ciphers`,gi=`${Ca}.#.proxy.ssl_verification`,fi=`${Ca}.#.reolink.media_resolution`,_i=`${Ca}.#.reolink.url`,vi=`${Ca}.#.triggers.motion`,yi=`${Ca}.#.triggers.occupancy`,bi=`${Ca}.#.triggers.entities`,wi=`${Ca}.#.triggers.events`,xi="cameras_global",Ci=`${xi}.image`,Mi=`${xi}.live_provider`,ki=`${xi}.jsmpeg`,Si=`${xi}.webrtc_card`,Ei=`${xi}.triggers.occupancy`,$i=`${xi}.image.refresh_seconds`,Ai=`${xi}.dimensions.layout`,zi=`${xi}.ptz`,Ii="elements",Ti="view",ji=`${Ti}.camera_select`,Oi=`${Ti}.dark_mode`,Di=`${Ti}.default`,Ri=`${Ti}.interaction_seconds`,Pi=`${Ti}.keyboard_shortcuts`,Li=`${Ti}.keyboard_shortcuts.enabled`,Ni=`${Pi}.ptz_left`,Fi=`${Pi}.ptz_right`,Vi=`${Pi}.ptz_up`,Hi=`${Pi}.ptz_down`,Bi=`${Pi}.ptz_zoom_in`,qi=`${Pi}.ptz_zoom_out`,Ui=`${Pi}.ptz_home`,Wi=`${Ti}.default_cycle_camera`,Zi=`${Ti}.default_reset`,Qi=`${Zi}.interaction_mode`,Gi=`${Zi}.every_seconds`,Yi=`${Zi}.entities`,Ki=`${Zi}.after_interaction`,Xi=`${Ti}.triggers`,Ji=`${Xi}.show_trigger_status`,er=`${Xi}.filter_selected_camera`,tr=`${Xi}.untrigger_seconds`,nr=`${Xi}.actions`,ar=`${nr}.trigger`,ir=`${nr}.untrigger`,rr=`${nr}.interaction_mode`,or="media_gallery",sr=`${or}.controls.filter.mode`,cr=`${or}.controls.thumbnails.show_details`,lr=`${or}.controls.thumbnails.show_download_control`,dr=`${or}.controls.thumbnails.show_favorite_control`,ur=`${or}.controls.thumbnails.show_timeline_control`,hr=`${or}.controls.thumbnails.size`,pr="media_viewer",mr=`${pr}.auto_play`,gr=`${pr}.auto_pause`,fr=`${pr}.auto_mute`,_r=`${pr}.auto_unmute`,vr=`${pr}.display.mode`,yr=`${pr}.display.grid_columns`,br=`${pr}.display.grid_max_columns`,wr=`${pr}.display.grid_selected_width_factor`,xr=`${pr}.draggable`,Cr=`${pr}.lazy_load`,Mr=`${pr}.snapshot_click_plays_clip`,kr=`${pr}.transition_effect`,Sr=`${pr}.controls.builtin`,Er=`${pr}.controls.next_previous.style`,$r=`${pr}.controls.next_previous.size`,Ar=`${pr}.controls.thumbnails.mode`,zr=`${pr}.controls.thumbnails.show_details`,Ir=`${pr}.controls.thumbnails.show_download_control`,Tr=`${pr}.controls.thumbnails.show_favorite_control`,jr=`${pr}.controls.thumbnails.show_timeline_control`,Or=`${pr}.controls.thumbnails.size`,Dr=`${pr}.controls.timeline.clustering_threshold`,Rr=`${pr}.controls.timeline.events_media_type`,Pr=`${pr}.controls.timeline.mode`,Lr=`${pr}.controls.timeline.pan_mode`,Nr=`${pr}.controls.timeline.show_recordings`,Fr=`${pr}.controls.timeline.style`,Vr=`${pr}.controls.timeline.window_seconds`,Hr=`${pr}.zoomable`,Br="live",qr=`${Br}.auto_play`,Ur=`${Br}.auto_pause`,Wr=`${Br}.auto_mute`,Zr=`${Br}.auto_unmute`,Qr=`${Br}.controls.builtin`,Gr=`${Br}.controls.next_previous.style`,Yr=`${Br}.controls.next_previous.size`,Kr=`${Br}.controls.ptz.hide_home`,Xr=`${Br}.controls.ptz.hide_pan_tilt`,Jr=`${Br}.controls.ptz.hide_zoom`,eo=`${Br}.controls.ptz.mode`,to=`${Br}.controls.ptz.orientation`,no=`${Br}.controls.ptz.position`,ao=`${Br}.controls.thumbnails.media_type`,io=`${Br}.controls.thumbnails.events_media_type`,ro=`${Br}.controls.thumbnails.mode`,oo=`${Br}.controls.thumbnails.size`,so=`${Br}.controls.thumbnails.show_details`,co=`${Br}.controls.thumbnails.show_download_control`,lo=`${Br}.controls.thumbnails.show_favorite_control`,uo=`${Br}.controls.thumbnails.show_timeline_control`,ho=`${Br}.controls.timeline.clustering_threshold`,po=`${Br}.controls.timeline.events_media_type`,mo=`${Br}.controls.timeline.mode`,go=`${Br}.controls.timeline.pan_mode`,fo=`${Br}.controls.timeline.show_recordings`,_o=`${Br}.controls.timeline.style`,vo=`${Br}.controls.timeline.window_seconds`,yo=`${Br}.display.mode`,bo=`${Br}.display.grid_columns`,wo=`${Br}.display.grid_max_columns`,xo=`${Br}.display.grid_selected_width_factor`,Co=`${Br}.draggable`,Mo=`${Br}.lazy_load`,ko=`${Br}.lazy_unload`,So=`${Br}.preload`,Eo=`${Br}.transition_effect`,$o=`${Br}.show_image_during_load`,Ao=`${Br}.microphone.disconnect_seconds`,zo=`${Br}.microphone.mute_after_microphone_mute_seconds`,Io=`${Br}.microphone.always_connected`,To=`${Br}.zoomable`,jo="image",Oo=`${jo}.entity`,Do=`${jo}.entity_parameters`,Ro=`${jo}.mode`,Po=`${jo}.refresh_seconds`,Lo=`${jo}.url`,No="timeline",Fo=`${No}.window_seconds`,Vo=`${No}.clustering_threshold`,Ho=`${No}.events_media_type`,Bo=`${No}.show_recordings`,qo=`${No}.style`,Uo=`${No}.controls.thumbnails.mode`,Wo=`${No}.controls.thumbnails.size`,Zo=`${No}.controls.thumbnails.show_details`,Qo=`${No}.controls.thumbnails.show_download_control`,Go=`${No}.controls.thumbnails.show_favorite_control`,Yo=`${No}.controls.thumbnails.show_timeline_control`,Ko="menu",Xo=`${Ko}.alignment`,Jo=`${Ko}.position`,es=`${Ko}.style`,ts=`${Ko}.button_size`,ns=`${Ko}.buttons`,as=`${ns}.frigate`,is=`${ns}.camera_ui`,rs=`${ns}.fullscreen`,os=`${ns}.play`,ss=`${ns}.mute`,cs=`${ns}.media_player`,ls=`${ns}.timeline`,ds="status_bar",us=`${ds}.position`,hs=`${ds}.style`,ps=`${ds}.popup_seconds`,ms=`${ds}.height`,gs=`${ds}.items`,fs="dimensions",_s=`${fs}.aspect_ratio`,vs=`${fs}.aspect_ratio_mode`,ys=`${fs}.height`,bs="overrides",ws="performance",xs=`${ws}.features.animated_progress_indicator`,Cs=`${ws}.features.media_chunk_size`,Ms=`${ws}.features.max_simultaneous_engine_requests`,ks=`${ws}.profile`,Ss=`${ws}.style.box_shadow`,Es=`${ws}.style.border_radius`,$s="profiles",As=1e3;class zs extends Error{constructor(e,t){super(e),this.context=t}}const Is={info:10,error:20,connection:30,diagnostics:40},Ts=["clips","favorite-events","favorite-recordings","live","menu","ptz","recordings","seek","snapshots","substream"],js=ba.object({url:ba.string(),mime_type:ba.string()}),Os=ba.object({path:ba.string()});function Ds(e){if(e instanceof ba.ZodDefault)return Ds(e.removeDefault());if(e instanceof ba.ZodObject){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=ba.ZodOptional.create(Ds(a))}return new ba.ZodObject({...e._def,shape:()=>t})}return e instanceof ba.ZodArray?ba.ZodArray.create(Ds(e.element)).min(e._def.minLength?.value,e._def.minLength?.message).max(e._def.maxLength?.value,e._def.maxLength?.message).length(e._def.exactLength?.value,e._def.exactLength?.message):e instanceof ba.ZodOptional?ba.ZodOptional.create(Ds(e.unwrap())):e instanceof ba.ZodNullable?ba.ZodNullable.create(Ds(e.unwrap())):e instanceof ba.ZodTuple?ba.ZodTuple.create(e.items.map((e=>Ds(e)))):e}function Rs(e){const t=e.format();return Object.keys(t).filter((e=>!e.startsWith("_")))}const Ps=e=>{const t=new Set;if(e.issues.length)for(const n of e.issues)if("invalid_union"===n.code){const e=n.unionErrors;for(const n of e)Ps(n).forEach(t.add,t)}else t.add(Ls(n.path));return t},Ls=e=>{let t="";for(let n=0;n"fire-dom-event")).or(ba.literal("fire-dom-event")),card_id:ba.string().regex(tc,"card_id parameter can only contain [a-z][A-Z][0-9_]-").optional()}),_c=fc.extend({frigate_card_action:ba.enum(Zs)}),vc=fc.extend({frigate_card_action:ba.enum(["camera_ui","default","download","expand","fullscreen","live_substream_off","live_substream_on","menu_toggle","microphone_connect","microphone_disconnect","microphone_mute","microphone_unmute","mute","pause","play","screenshot","unmute"])}),yc=fc.extend({frigate_card_action:ba.literal("camera_select"),camera:ba.string().optional(),triggered:ba.boolean().optional()}),bc=fc.extend({frigate_card_action:ba.literal("live_substream_select"),camera:ba.string()}),wc=fc.extend({frigate_card_action:ba.literal("media_player"),media_player:ba.string(),media_player_action:ba.enum(["play","stop"])}),xc=fc.extend({frigate_card_action:ba.literal("display_mode_select"),display_mode:ic}),Cc=fc.extend({frigate_card_action:ba.literal("ptz"),camera:ba.string().optional(),ptz_action:ba.enum(Hs).optional(),ptz_phase:ba.enum(Js).optional(),ptz_preset:ba.string().optional()}),Mc=fc.extend({frigate_card_action:ba.literal("ptz_digital"),target_id:ba.string().optional(),absolute:ba.object({zoom:ac.optional(),pan:nc.optional()}).optional(),ptz_action:ba.enum(Hs).optional(),ptz_phase:ba.enum(Js).optional()}),kc=fc.extend({frigate_card_action:ba.literal("ptz_multi"),target_id:ba.string().optional(),ptz_action:ba.enum(Hs).optional(),ptz_phase:ba.enum(Js).optional(),ptz_preset:ba.string().optional()}),Sc=fc.extend({frigate_card_action:ba.literal("ptz_controls"),enabled:ba.boolean()}),Ec=ba.object({ms:ba.number().optional(),s:ba.number().optional(),m:ba.number().optional(),h:ba.number().optional()}),$c=fc.extend({frigate_card_action:ba.literal("sleep"),duration:Ec.optional().default({s:1})}),Ac=fc.extend({frigate_card_action:ba.literal("status_bar"),status_bar_action:ba.enum(["add","remove","reset"]),items:ba.lazy((()=>ol)).array().optional()}),zc=fc.extend({frigate_card_action:ba.literal("log"),message:ba.string(),level:ba.enum(["debug","info","warn","error"]).default("info")}),Ic=ba.union([yc,vc,bc,zc,wc,Cc,Mc,kc,Sc,_c,xc,$c,Ac]),Tc=ba.union([sc,dc,lc,uc,hc,pc,gc,mc,Ic]),jc=ba.object({tap_action:Tc.or(Tc.array()).optional(),hold_action:Tc.or(Tc.array()).optional(),double_tap_action:Tc.or(Tc.array()).optional(),start_tap_action:Tc.or(Tc.array()).optional(),end_tap_action:Tc.or(Tc.array()).optional()}).passthrough(),Oc=ba.object({actions:jc.optional()}),Dc=jc.extend({style:ba.record(ba.string().nullable().or(ba.undefined()).or(ba.number())).optional(),title:ba.string().nullable().optional()}),Rc=Dc.extend({type:ba.literal("state-badge"),entity:ba.string()}),Pc=Dc.extend({type:ba.literal("state-icon"),entity:ba.string(),icon:ba.string().optional(),state_color:ba.boolean().default(!0)}),Lc=Dc.extend({type:ba.literal("state-label"),entity:ba.string(),attribute:ba.string().optional(),prefix:ba.string().optional(),suffix:ba.string().optional()}),Nc=Dc.extend({type:ba.literal("service-button"),title:ba.string(),service:ba.string(),service_data:ba.object({}).passthrough().optional()}),Fc=Dc.extend({type:ba.literal("icon"),icon:ba.string(),entity:ba.string().optional()}),Vc=Dc.extend({type:ba.literal("image"),entity:ba.string().optional(),image:ba.string().optional(),camera_image:ba.string().optional(),camera_view:ba.string().optional(),state_image:ba.object({}).passthrough().optional(),filter:ba.string().optional(),state_filter:ba.object({}).passthrough().optional(),aspect_ratio:ba.string().optional()}),Hc=ba.object({condition:ba.literal("state").optional(),entity:ba.string(),state:ba.string().or(ba.string().array()).optional(),state_not:ba.string().or(ba.string().array()).optional()}),Bc=ba.object({condition:ba.literal("numeric_state"),entity:ba.string(),above:ba.number().optional(),below:ba.number().optional()}),qc=ba.object({condition:ba.literal("screen"),media_query:ba.string()}),Uc=ba.object({condition:ba.literal("user"),users:ba.string().array().min(1)}),Wc=ba.discriminatedUnion("condition",[Hc,Bc,qc,Uc]),Zc=ba.object({type:ba.literal("conditional"),conditions:Wc.array(),elements:ba.lazy((()=>yl))}),Qc=ba.object({type:ba.string().superRefine(((e,t)=>{e.match(/^custom:(?!frigate-card).+/)||t.addIssue({code:ba.ZodIssueCode.custom,message:"Frigate-card custom elements must match specific schemas",fatal:!0})}))}).passthrough(),Gc=ba.object({enabled:ba.boolean().default(!0).optional(),priority:ba.number().min(0).max(Us).default(50).optional(),alignment:ba.enum(["matching","opposing"]).default("matching").optional(),icon:ba.string().optional(),permanent:ba.boolean().default(!1).optional()}),Yc=Gc.merge(Fc).extend({type:ba.literal("custom:frigate-card-menu-icon")}),Kc=Gc.merge(Pc).extend({type:ba.literal("custom:frigate-card-menu-state-icon")}).merge(Gc),Xc=Dc.extend({entity:ba.string().optional(),icon:ba.string().optional(),state_color:ba.boolean().default(!0),selected:ba.boolean().default(!1),subtitle:ba.string().optional(),enabled:ba.boolean().default(!0)}),Jc=Gc.merge(Fc).extend({type:ba.literal("custom:frigate-card-menu-submenu"),items:Xc.array()}),el=Gc.merge(Pc).extend({type:ba.literal("custom:frigate-card-menu-submenu-select"),options:ba.record(Xc.deepPartial()).optional()}),tl=ba.object({enabled:ba.boolean().default(!0).optional(),priority:ba.number().min(0).max(100).default(50).optional()}),nl=tl.extend({sufficient:ba.boolean().default(!1).optional(),exclusive:ba.boolean().default(!1).optional(),expand:ba.boolean().default(!1).optional(),actions:jc.optional()}),al=nl.extend({type:ba.literal("custom:frigate-card-status-bar-icon"),icon:ba.string()}),il=nl.extend({type:ba.literal("custom:frigate-card-status-bar-image"),image:ba.string()}),rl=nl.extend({type:ba.literal("custom:frigate-card-status-bar-string"),string:ba.string()}),ol=ba.union([al,il,rl]),sl=ba.object({condition:ba.literal("view"),views:ba.string().array()}),cl=ba.object({condition:ba.literal("fullscreen"),fullscreen:ba.boolean()}),ll=ba.object({condition:ba.literal("expand"),expand:ba.boolean()}),dl=ba.object({condition:ba.literal("camera"),cameras:ba.string().array()}),ul=ba.object({condition:ba.literal("media_loaded"),media_loaded:ba.boolean()}),hl=ba.object({condition:ba.literal("display_mode"),display_mode:ic}),pl=ba.object({condition:ba.literal("triggered"),triggered:ba.string().array()}),ml=ba.object({condition:ba.literal("interaction"),interaction:ba.boolean()}),gl=ba.object({condition:ba.literal("microphone"),connected:ba.boolean().optional(),muted:ba.boolean().optional()}),fl=ba.object({condition:ba.literal("key"),key:ba.string(),state:ba.enum(["down","up"]).optional(),ctrl:ba.boolean().optional(),shift:ba.boolean().optional(),alt:ba.boolean().optional(),meta:ba.boolean().optional()}),_l=ba.discriminatedUnion("condition",[Hc,Bc,qc,Uc,sl,cl,ll,dl,ul,hl,pl,ml,gl,fl]),vl=ba.object({type:ba.literal("custom:frigate-card-conditional"),conditions:_l.array(),elements:ba.lazy((()=>yl))}),yl=ba.union([Zc,Qc,vl,Fc,Vc,Yc,Kc,Jc,el,Nc,Rc,Pc,Lc,al,il,rl]).array().optional(),bl=ba.object({fit:ba.enum(["contain","cover","fill"]).optional(),position:ba.object({x:ba.number().min(0).max(100).optional(),y:ba.number().min(0).max(100).optional()}).optional(),view_box:ba.object({bottom:ba.number().min(0).max(100).optional().default(0),left:ba.number().min(0).max(100).optional().default(0),right:ba.number().min(0).max(100).optional().default(0),top:ba.number().min(0).max(100).optional().default(0)}).optional(),pan:nc.optional(),zoom:ac.optional()}),wl=ba.number().array().length(2).or(ba.string().regex(/^\s*\d+\.?\d*\s*[:/]\s*\d+\.?\d*\s*$/).transform((e=>e.split(/[:\/]/).map((e=>Number(e)))))),xl={r2c_delay_between_calls_seconds:.5,c2r_delay_between_calls_seconds:.2},Cl=function(e){return t=>{if(!t||"object"!=typeof t||!t.service)return t;const n={...t};return Object.keys(t).forEach((a=>{const i=a.match(/^data_(.+)$/),r=i?.[1];r&&!(`${e}${r}`in t)&&(n[`${e}${r}`]={action:"perform-action",perform_action:t.service,data:t[a]},delete n[a],delete n.service)})),n}},Ml=ba.preprocess(Cl("actions_"),ba.object({actions_left:lc.optional(),actions_left_start:lc.optional(),actions_left_stop:lc.optional(),actions_right:lc.optional(),actions_right_start:lc.optional(),actions_right_stop:lc.optional(),actions_up:lc.optional(),actions_up_start:lc.optional(),actions_up_stop:lc.optional(),actions_down:lc.optional(),actions_down_start:lc.optional(),actions_down_stop:lc.optional(),actions_zoom_in:lc.optional(),actions_zoom_in_start:lc.optional(),actions_zoom_in_stop:lc.optional(),actions_zoom_out:lc.optional(),actions_zoom_out_start:lc.optional(),actions_zoom_out_stop:lc.optional(),r2c_delay_between_calls_seconds:ba.number().default(xl.r2c_delay_between_calls_seconds),c2r_delay_between_calls_seconds:ba.number().default(xl.c2r_delay_between_calls_seconds),presets:ba.preprocess(Cl(""),ba.union([ba.record(lc),ba.object({service:ba.string().optional()})])).optional(),service:ba.string().optional()}).passthrough()),kl={orientation:"horizontal",mode:"auto",hide_pan_tilt:!1,hide_zoom:!1,hide_home:!1,position:"bottom-right"},Sl=ba.object({mode:ba.enum(["off","auto","on"]).default(kl.mode),position:ba.enum(["top-left","top-right","bottom-left","bottom-right"]).default(kl.position),orientation:ba.enum(["vertical","horizontal"]).default(kl.orientation),hide_pan_tilt:ba.boolean().default(kl.hide_pan_tilt),hide_zoom:ba.boolean().default(kl.hide_zoom),hide_home:ba.boolean().default(kl.hide_home),style:ba.object({}).passthrough().optional()}),El={mode:"auto",refresh_seconds:1},$l=ba.object({mode:ba.enum(["auto","camera","entity","screensaver","url"]).default(El.mode),refresh_seconds:ba.number().min(0).default(El.refresh_seconds),url:ba.string().optional(),entity:ba.string().optional(),entity_parameters:ba.string().optional()}),Al=$l.merge(Oc).default(El),zl=75,Il=300,Tl={size:100,show_details:!0,show_favorite_control:!0,show_timeline_control:!0,show_download_control:!0},jl=ba.object({size:ba.number().min(75).max(300).default(Tl.size),show_details:ba.boolean().default(Tl.show_details),show_favorite_control:ba.boolean().default(Tl.show_favorite_control),show_timeline_control:ba.boolean().default(Tl.show_timeline_control),show_download_control:ba.boolean().default(Tl.show_download_control)}),Ol={...Tl,mode:"right"},Dl=jl.extend({mode:ba.enum(["none","above","below","left","right"]).default(Ol.mode)}),Rl=ba.enum(["all","clips","snapshots"]),Pl={clustering_threshold:3,events_media_type:"all",window_seconds:3600,show_recordings:!0,style:"stack",pan_mode:"pan"},Ll=ba.enum(["pan","seek","seek-in-media","seek-in-camera"]),Nl=ba.object({clustering_threshold:ba.number().optional().default(Pl.clustering_threshold),events_media_type:Rl.optional().default(Pl.events_media_type),window_seconds:ba.number().min(60).max(86400).optional().default(Pl.window_seconds),show_recordings:ba.boolean().optional().default(Pl.show_recordings),style:ba.enum(["stack","ribbon"]).optional().default(Pl.style),pan_mode:Ll.optional().default(Pl.pan_mode)}),Fl={...Pl,mode:"none",style:"ribbon"},Vl=Nl.extend({mode:ba.enum(["none","above","below"]).default(Fl.mode),style:Nl.shape.style.default(Fl.style)}),Hl={...Pl,controls:{thumbnails:Ol}},Bl=Nl.extend({controls:ba.object({thumbnails:Dl.default(Hl.controls.thumbnails)}).default(Hl.controls)}).default(Hl),ql=ba.object({style:ba.enum(["none","chevrons","icons","thumbnails"]),size:ba.number().min(20)}),Ul=ba.enum(["none","slide"]),Wl={always_connected:!1,disconnect_seconds:90,mute_after_microphone_mute_seconds:60},Zl=ba.object({always_connected:ba.boolean().default(Wl.always_connected),disconnect_seconds:ba.number().min(0).default(Wl.disconnect_seconds),mute_after_microphone_mute_seconds:ba.number().min(0).default(Wl.mute_after_microphone_mute_seconds)}).default(Wl),Ql=ba.object({url:ba.string().transform((e=>e.replace(/\/+$/,""))).optional(),host:ba.string().optional(),modes:ba.enum(["webrtc","mse","mp4","mjpeg"]).array().optional(),stream:ba.string().optional()}),Gl=ba.object({entity:ba.string().optional(),url:ba.string().optional()}).passthrough(),Yl=ba.object({options:ba.object({audio:ba.boolean().optional(),video:ba.boolean().optional(),pauseWhenHidden:ba.boolean().optional(),disableGl:ba.boolean().optional(),disableWebAssembly:ba.boolean().optional(),preserveDrawingBuffer:ba.boolean().optional(),progressive:ba.boolean().optional(),throttled:ba.boolean().optional(),chunkSize:ba.number().optional(),maxAudioLag:ba.number().optional(),videoBufferSize:ba.number().optional(),audioBufferSize:ba.number().optional()}).optional()}),Kl={...Ol,media_type:"events",events_media_type:"all"},Xl={auto_play:[...Ys],auto_pause:[],auto_mute:[...Xs],auto_unmute:["microphone"],preload:!1,lazy_load:!0,lazy_unload:[],draggable:!0,zoomable:!0,transition_effect:"slide",show_image_during_load:!0,mode:"single",controls:{builtin:!0,next_previous:{size:48,style:"chevrons"},ptz:kl,thumbnails:Kl,timeline:Fl},microphone:{...Wl}},Jl=Dl.extend({media_type:ba.enum(["events","recordings"]).default(Xl.controls.thumbnails.media_type),events_media_type:Rl.default(Xl.controls.thumbnails.events_media_type)}),ed=ba.object({auto_pause:ba.enum(Gs).array().default(Xl.auto_pause),auto_play:ba.enum(Ys).array().default(Xl.auto_play),auto_mute:ba.enum(Xs).array().default(Xl.auto_mute),auto_unmute:ba.enum(Ks).array().default(Xl.auto_unmute),controls:ba.object({builtin:ba.boolean().default(Xl.controls.builtin),next_previous:ql.extend({style:ba.enum(["none","chevrons","icons"]).default(Xl.controls.next_previous.style),size:ql.shape.size.default(Xl.controls.next_previous.size)}).default(Xl.controls.next_previous),ptz:Sl.default(Xl.controls.ptz),thumbnails:Jl.default(Xl.controls.thumbnails),timeline:Vl.default(Xl.controls.timeline)}).default(Xl.controls),display:rc,draggable:ba.boolean().default(Xl.draggable),lazy_load:ba.boolean().default(Xl.lazy_load),lazy_unload:ba.enum(Gs).array().default(Xl.lazy_unload),microphone:Zl.default(Xl.microphone),preload:ba.boolean().default(Xl.preload),show_image_during_load:ba.boolean().default(Xl.show_image_during_load),transition_effect:Ul.default(Xl.transition_effect),zoomable:ba.boolean().default(Xl.zoomable)}).merge(Oc).default(Xl),td=ba.object({live:ed}),nd=ba.object({method:ba.enum(["standard","dashboard"]).default("standard").optional(),dashboard:ba.object({dashboard_path:ba.string().optional(),view_path:ba.string().optional()}).optional()}),ad={dependencies:{all_cameras:!1,cameras:[]},engine:"auto",frigate:{client_id:"frigate"},live_provider:"auto",motioneye:{images:{directory_pattern:"%Y-%m-%d",file_pattern:"%H-%M-%S"},movies:{directory_pattern:"%Y-%m-%d",file_pattern:"%H-%M-%S"}},reolink:{media_resolution:"low"},ptz:xl,triggers:{motion:!1,occupancy:!1,events:[...ec],entities:[]},proxy:{media:"auto",dynamic:!0,ssl_verification:"auto",ssl_ciphers:"auto"}},id=ba.object({media:ba.boolean().or(ba.literal("auto")).default(ad.proxy.media),dynamic:ba.boolean().default(ad.proxy.dynamic),ssl_verification:ba.boolean().or(ba.literal("auto")).default(ad.proxy.ssl_verification),ssl_ciphers:ba.enum(["default","insecure","intermediate","modern"]).or(ba.literal("auto")).default(ad.proxy.ssl_ciphers)}),rd=ba.object({camera_entity:ba.string().optional(),icon:ba.string().optional(),title:ba.string().optional(),capabilities:ba.object({disable:ba.enum(Ts).array().optional(),disable_except:ba.enum(Ts).array().optional()}).optional(),id:ba.string().optional(),dependencies:ba.object({all_cameras:ba.boolean().default(ad.dependencies.all_cameras),cameras:ba.string().array().default(ad.dependencies.cameras)}).default(ad.dependencies),triggers:ba.object({motion:ba.boolean().default(ad.triggers.motion),occupancy:ba.boolean().default(ad.triggers.occupancy),entities:ba.string().array().default(ad.triggers.entities),events:ba.enum(ec).array().default(ad.triggers.events)}).default(ad.triggers),engine:ba.enum(["auto","frigate","generic","motioneye","reolink"]).default("auto"),frigate:ba.object({url:ba.string().optional(),client_id:ba.string().default(ad.frigate.client_id),camera_name:ba.string().optional(),labels:ba.string().array().optional(),zones:ba.string().array().optional()}).default(ad.frigate),motioneye:ba.object({url:ba.string().optional(),images:ba.object({directory_pattern:ba.string().includes("%").default(ad.motioneye.images.directory_pattern),file_pattern:ba.string().includes("%").default(ad.motioneye.images.file_pattern)}).default(ad.motioneye.images),movies:ba.object({directory_pattern:ba.string().includes("%").default(ad.motioneye.movies.directory_pattern),file_pattern:ba.string().includes("%").default(ad.motioneye.movies.file_pattern)}).default(ad.motioneye.movies)}).default(ad.motioneye),reolink:ba.object({url:ba.string().optional(),media_resolution:ba.enum(["high","low"]).default(ad.reolink.media_resolution)}).default(ad.reolink),live_provider:ba.enum(["auto","image","ha","jsmpeg","go2rtc","webrtc-card"]).default(ad.live_provider),go2rtc:Ql.optional(),image:$l.optional().default(El),jsmpeg:Yl.optional(),webrtc_card:Gl.optional(),cast:nd.optional(),ptz:Ml.default(ad.ptz),dimensions:ba.object({aspect_ratio:wl.optional(),layout:bl.optional()}).optional(),proxy:id.default(ad.proxy)}).default(ad),od=rd.array().min(1),sd={default:Qs,camera_select:"current",interaction_seconds:300,default_reset:{every_seconds:0,after_interaction:!1,entities:[],interaction_mode:"inactive"},default_cycle_camera:!1,dark_mode:"off",triggers:{show_trigger_status:!1,filter_selected_camera:!0,actions:{trigger:"update",untrigger:"none"},untrigger_seconds:0},keyboard_shortcuts:Fs},cd=ba.enum(["all","inactive","active"]).default("inactive"),ld=ba.object({actions:ba.object({interaction_mode:cd,trigger:ba.enum(["default","live","media","none","update"]).default(sd.triggers.actions.trigger),untrigger:ba.enum(["default","none"]).default(sd.triggers.actions.untrigger)}).default(sd.triggers.actions),filter_selected_camera:ba.boolean().default(sd.triggers.filter_selected_camera),show_trigger_status:ba.boolean().default(sd.triggers.show_trigger_status),untrigger_seconds:ba.number().default(sd.triggers.untrigger_seconds)}),dd=ba.object({default:ba.enum(Zs).default(sd.default),camera_select:ba.enum([...Zs,"current"]).default(sd.camera_select),interaction_seconds:ba.number().default(sd.interaction_seconds),default_cycle_camera:ba.boolean().default(sd.default_cycle_camera),default_reset:ba.object({after_interaction:ba.boolean().default(sd.default_reset.after_interaction),every_seconds:ba.number().default(sd.default_reset.every_seconds),entities:ba.string().array().default(sd.default_reset.entities),interaction_mode:cd.default(sd.default_reset.interaction_mode)}).default(sd.default_reset),render_entities:ba.string().array().optional(),dark_mode:ba.enum(["on","off","auto"]).optional(),triggers:ld.default(sd.triggers),keyboard_shortcuts:Vs.default(sd.keyboard_shortcuts)}).merge(Oc).default(sd),ud=["left","right","top","bottom"],hd=ud,pd={priority:50,enabled:!0},md={priority:50,enabled:!1},gd={alignment:"left",button_size:40,buttons:{camera_ui:pd,cameras:pd,clips:pd,ptz_home:md,display_mode:pd,download:pd,expand:md,frigate:pd,fullscreen:pd,image:md,live:pd,media_player:pd,microphone:{...md,type:"momentary"},mute:md,play:md,ptz_controls:md,recordings:md,screenshot:md,snapshots:pd,substreams:pd,timeline:pd},position:"top",style:"hidden"},fd=Gc.extend({enabled:Gc.shape.enabled.default(pd.enabled),priority:Gc.shape.priority.default(pd.priority)}),_d=Gc.extend({enabled:Gc.shape.enabled.default(md.enabled),priority:Gc.shape.priority.default(md.priority)}),vd=ba.object({style:ba.enum(["none","hidden","overlay","hover","hover-card","outside"]).default(gd.style),position:ba.enum(ud).default(gd.position),alignment:ba.enum(hd).default(gd.alignment),buttons:ba.object({camera_ui:fd.default(gd.buttons.camera_ui),cameras:fd.default(gd.buttons.cameras),clips:fd.default(gd.buttons.clips),ptz_home:_d.default(gd.buttons.ptz_home),display_mode:fd.default(gd.buttons.display_mode),download:fd.default(gd.buttons.download),expand:_d.default(gd.buttons.expand),frigate:fd.default(gd.buttons.frigate),fullscreen:fd.default(gd.buttons.fullscreen),image:_d.default(gd.buttons.image),live:fd.default(gd.buttons.live),media_player:fd.default(gd.buttons.media_player),microphone:_d.extend({type:ba.enum(["momentary","toggle"]).default(gd.buttons.microphone.type)}).default(gd.buttons.microphone),mute:_d.default(gd.buttons.mute),play:_d.default(gd.buttons.play),ptz_controls:_d.default(gd.buttons.ptz_controls),recordings:_d.default(gd.buttons.recordings),screenshot:_d.default(gd.buttons.screenshot),snapshots:fd.default(gd.buttons.snapshots),substreams:fd.default(gd.buttons.substreams),timeline:fd.default(gd.buttons.timeline)}).default(gd.buttons),button_size:ba.number().min(20).default(gd.button_size)}).default(gd),yd={priority:50,enabled:!0},bd={height:46,items:{engine:yd,resolution:yd,technology:yd,title:yd},position:"bottom",style:"popup",popup_seconds:3},wd=ba.object({position:ba.enum(["top","bottom"]).default(bd.position),style:ba.enum(["none","overlay","hover","hover-card","outside","popup"]).default(bd.style),popup_seconds:ba.number().min(0).max(60).default(bd.popup_seconds),height:ba.number().min(20).default(bd.height),items:ba.object({engine:tl.default(bd.items.engine),technology:tl.default(bd.items.technology),resolution:tl.default(bd.items.resolution),title:tl.default(bd.items.title)}).default(bd.items)}).default(bd),xd={auto_play:[...Ys],auto_pause:[...Gs],auto_mute:[...Gs],auto_unmute:[],lazy_load:!0,draggable:!0,zoomable:!0,transition_effect:"slide",snapshot_click_plays_clip:!0,display_mode:"single",controls:{builtin:!0,next_previous:{size:48,style:"thumbnails"},thumbnails:Ol,timeline:Fl,ptz:{...kl,mode:"off"}}},Cd=ql.extend({style:ba.enum(["none","thumbnails","chevrons"]).default(xd.controls.next_previous.style),size:ql.shape.size.default(xd.controls.next_previous.size)}),Md=ba.object({auto_play:ba.enum(Ys).array().default(xd.auto_play),auto_pause:ba.enum(Gs).array().default(xd.auto_pause),auto_mute:ba.enum(Gs).array().default(xd.auto_mute),auto_unmute:ba.enum(Ys).array().default(xd.auto_unmute),lazy_load:ba.boolean().default(xd.lazy_load),draggable:ba.boolean().default(xd.draggable),zoomable:ba.boolean().default(xd.zoomable),transition_effect:Ul.default(xd.transition_effect),snapshot_click_plays_clip:ba.boolean().default(xd.snapshot_click_plays_clip),display:rc,controls:ba.object({builtin:ba.boolean().default(xd.controls.builtin),next_previous:Cd.default(xd.controls.next_previous),ptz:Sl.extend({mode:ba.enum(["off","on"]).default(xd.controls.ptz.mode)}).default(xd.controls.ptz),thumbnails:Dl.default(xd.controls.thumbnails),timeline:Vl.default(xd.controls.timeline)}).default(xd.controls)}).merge(Oc).default(xd),kd={...Ol,show_details:!1},Sd={controls:{thumbnails:kd,filter:{mode:"right"}}},Ed=Dl.extend({show_details:ba.boolean().default(kd.show_details)}),$d=ba.object({controls:ba.object({thumbnails:Ed.default(Sd.controls.thumbnails),filter:ba.object({mode:ba.enum(["none","left","right"]).default(Sd.controls.filter.mode)}).default(Sd.controls.filter)}).default(Sd.controls)}).merge(Oc).default(Sd),Ad={aspect_ratio_mode:"dynamic",aspect_ratio:[16,9],height:"auto"},zd=ba.object({aspect_ratio_mode:ba.enum(["dynamic","static","unconstrained"]).default(Ad.aspect_ratio_mode),aspect_ratio:wl.default(Ad.aspect_ratio),height:ba.string().default(Ad.height)}).default(Ad),Id=ba.object({conditions:_l.array(),merge:ba.object({}).passthrough().optional(),set:ba.object({}).passthrough().optional(),delete:ba.string().array().optional()}).array().optional(),Td=Tc.array(),jd=ba.object({conditions:_l.array(),actions:Td.optional(),actions_not:Td.optional()}).refine((e=>e.actions?.length||e.actions_not?.length),"Automations must include at least one action").array(),Od={features:{animated_progress_indicator:!0,media_chunk_size:50},style:{border_radius:!0,box_shadow:!0}},Dd=ba.object({features:ba.object({animated_progress_indicator:ba.boolean().default(Od.features.animated_progress_indicator),media_chunk_size:ba.number().min(0).max(1e3).default(Od.features.media_chunk_size),max_simultaneous_engine_requests:ba.number().min(1).optional()}).default(Od.features),style:ba.object({border_radius:ba.boolean().default(Od.style.border_radius),box_shadow:ba.boolean().default(Od.style.box_shadow)}).default(Od.style)}).default(Od),Rd={logging:!1},Pd=ba.object({logging:ba.boolean().default(Rd.logging)}).default(Rd),Ld=ba.enum(["casting","low-performance","scrubbing"]).array().optional(),Nd=ba.object({cameras:Ds(od),cameras_global:rd,view:dd,menu:vd,status_bar:wd,live:ed,media_gallery:$d,media_viewer:Md,image:Al,elements:yl,dimensions:zd,timeline:Bl,performance:Dd,debug:Pd,automations:jd.optional(),profiles:Ld,overrides:Id,card_mod:ba.unknown(),card_id:ba.string().regex(tc).optional(),type:ba.string()}),Fd={cameras:ad,view:sd,menu:gd,status_bar:bd,live:Xl,media_gallery:Sd,media_viewer:xd,image:El,timeline:Hl,performance:Od,debug:Rd};function Vd(e){const t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new e.constructor(+e):"number"==typeof e||"[object Number]"===t||"string"==typeof e||"[object String]"===t?new Date(e):new Date(NaN)}function Hd(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function Bd(e,t){const n=Vd(e);return isNaN(t)?Hd(e,NaN):t?(n.setDate(n.getDate()+t),n):n}function qd(e,t){const n=Vd(e);if(isNaN(t))return Hd(e,NaN);if(!t)return n;const a=n.getDate(),i=Hd(e,n.getTime());i.setMonth(n.getMonth()+t+1,0);return a>=i.getDate()?i:(n.setFullYear(i.getFullYear(),i.getMonth(),a),n)}function Ud(e,t){const{years:n=0,months:a=0,weeks:i=0,days:r=0,hours:o=0,minutes:s=0,seconds:c=0}=t,l=Vd(e),d=a||n?qd(l,a+12*n):l,u=1e3*(c+60*(s+60*o));return Hd(e,(r||i?Bd(d,r+7*i):d).getTime()+u)}const Wd=6048e5,Zd=864e5,Qd=6e4,Gd=36e5,Yd=1e3;let Kd={};function Xd(){return Kd}function Jd(e,t){const n=Xd(),a=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=Vd(e),r=i.getDay(),o=(r=i.getTime()?n+1:t.getTime()>=o.getTime()?n:n-1}function nu(e){const t=Vd(e);return t.setHours(0,0,0,0),t}function au(e){const t=Vd(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function iu(e){if(!(t=e,t instanceof Date||"object"==typeof t&&"[object Date]"===Object.prototype.toString.call(t)||"number"==typeof e))return!1;var t;const n=Vd(e);return!isNaN(Number(n))}function ru(e){return t=>{const n=(e?Math[e]:Math.trunc)(t);return 0===n?0:n}}function ou(e,t){return+Vd(e)-+Vd(t)}function su(e,t,n){const a=ou(e,t)/1e3;return ru(n?.roundingMethod)(a)}const cu={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function lu(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const du={date:lu({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:lu({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:lu({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},uu={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function hu(e){return(t,n)=>{let a;if("formatting"===(n?.context?String(n.context):"standalone")&&e.formattingValues){const t=e.defaultFormattingWidth||e.defaultWidth,i=n?.width?String(n.width):t;a=e.formattingValues[i]||e.formattingValues[t]}else{const t=e.defaultWidth,i=n?.width?String(n.width):e.defaultWidth;a=e.values[i]||e.values[t]}return a[e.argumentCallback?e.argumentCallback(t):t]}}function pu(e){return(t,n={})=>{const a=n.width,i=a&&e.matchPatterns[a]||e.matchPatterns[e.defaultMatchWidth],r=t.match(i);if(!r)return null;const o=r[0],s=a&&e.parsePatterns[a]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?function(e,t){for(let n=0;ne.test(o))):function(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n;return}(s,(e=>e.test(o)));let l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;return{value:l,rest:t.slice(o.length)}}}var mu;const gu={code:"en-US",formatDistance:(e,t,n)=>{let a;const i=cu[e];return a="string"==typeof i?i:1===t?i.one:i.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+a:a+" ago":a},formatLong:du,formatRelative:(e,t,n,a)=>uu[e],localize:{ordinalNumber:(e,t)=>{const n=Number(e),a=n%100;if(a>20||a<10)switch(a%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:hu({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:hu({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:hu({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:hu({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:hu({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(mu={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)},(e,t={})=>{const n=e.match(mu.matchPattern);if(!n)return null;const a=n[0],i=e.match(mu.parsePattern);if(!i)return null;let r=mu.valueCallback?mu.valueCallback(i[0]):i[0];return r=t.valueCallback?t.valueCallback(r):r,{value:r,rest:e.slice(a.length)}}),era:pu({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:pu({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:pu({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:pu({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:pu({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function fu(e){const t=Vd(e),n=function(e,t){const n=nu(e),a=nu(t),i=+n-au(n),r=+a-au(a);return Math.round((i-r)/Zd)}(t,function(e){const t=Vd(e),n=Hd(e,0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}(t));return n+1}function _u(e){const t=Vd(e),n=+eu(t)-+function(e){const t=tu(e),n=Hd(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),eu(n)}(t);return Math.round(n/Wd)+1}function vu(e,t){const n=Vd(e),a=n.getFullYear(),i=Xd(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=Hd(e,0);o.setFullYear(a+1,0,r),o.setHours(0,0,0,0);const s=Jd(o,t),c=Hd(e,0);c.setFullYear(a,0,r),c.setHours(0,0,0,0);const l=Jd(c,t);return n.getTime()>=s.getTime()?a+1:n.getTime()>=l.getTime()?a:a-1}function yu(e,t){const n=Vd(e),a=+Jd(n,t)-+function(e,t){const n=Xd(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=vu(e,t),r=Hd(e,0);return r.setFullYear(i,0,a),r.setHours(0,0,0,0),Jd(r,t)}(n,t);return Math.round(a/Wd)+1}function bu(e,t){return(e<0?"-":"")+Math.abs(e).toString().padStart(t,"0")}const wu={y(e,t){const n=e.getFullYear(),a=n>0?n:1-n;return bu("yy"===t?a%100:a,t.length)},M(e,t){const n=e.getMonth();return"M"===t?String(n+1):bu(n+1,2)},d:(e,t)=>bu(e.getDate(),t.length),a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return"am"===n?"a.m.":"p.m."}},h:(e,t)=>bu(e.getHours()%12||12,t.length),H:(e,t)=>bu(e.getHours(),t.length),m:(e,t)=>bu(e.getMinutes(),t.length),s:(e,t)=>bu(e.getSeconds(),t.length),S(e,t){const n=t.length,a=e.getMilliseconds();return bu(Math.trunc(a*Math.pow(10,n-3)),t.length)}},xu="midnight",Cu="noon",Mu="morning",ku="afternoon",Su="evening",Eu="night",$u={G:function(e,t,n){const a=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(a,{width:"abbreviated"});case"GGGGG":return n.era(a,{width:"narrow"});default:return n.era(a,{width:"wide"})}},y:function(e,t,n){if("yo"===t){const t=e.getFullYear(),a=t>0?t:1-t;return n.ordinalNumber(a,{unit:"year"})}return wu.y(e,t)},Y:function(e,t,n,a){const i=vu(e,a),r=i>0?i:1-i;if("YY"===t){return bu(r%100,2)}return"Yo"===t?n.ordinalNumber(r,{unit:"year"}):bu(r,t.length)},R:function(e,t){return bu(tu(e),t.length)},u:function(e,t){return bu(e.getFullYear(),t.length)},Q:function(e,t,n){const a=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(a);case"QQ":return bu(a,2);case"Qo":return n.ordinalNumber(a,{unit:"quarter"});case"QQQ":return n.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(a,{width:"narrow",context:"formatting"});default:return n.quarter(a,{width:"wide",context:"formatting"})}},q:function(e,t,n){const a=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(a);case"qq":return bu(a,2);case"qo":return n.ordinalNumber(a,{unit:"quarter"});case"qqq":return n.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(a,{width:"narrow",context:"standalone"});default:return n.quarter(a,{width:"wide",context:"standalone"})}},M:function(e,t,n){const a=e.getMonth();switch(t){case"M":case"MM":return wu.M(e,t);case"Mo":return n.ordinalNumber(a+1,{unit:"month"});case"MMM":return n.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(a,{width:"narrow",context:"formatting"});default:return n.month(a,{width:"wide",context:"formatting"})}},L:function(e,t,n){const a=e.getMonth();switch(t){case"L":return String(a+1);case"LL":return bu(a+1,2);case"Lo":return n.ordinalNumber(a+1,{unit:"month"});case"LLL":return n.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(a,{width:"narrow",context:"standalone"});default:return n.month(a,{width:"wide",context:"standalone"})}},w:function(e,t,n,a){const i=yu(e,a);return"wo"===t?n.ordinalNumber(i,{unit:"week"}):bu(i,t.length)},I:function(e,t,n){const a=_u(e);return"Io"===t?n.ordinalNumber(a,{unit:"week"}):bu(a,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getDate(),{unit:"date"}):wu.d(e,t)},D:function(e,t,n){const a=fu(e);return"Do"===t?n.ordinalNumber(a,{unit:"dayOfYear"}):bu(a,t.length)},E:function(e,t,n){const a=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(a,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(a,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},e:function(e,t,n,a){const i=e.getDay(),r=(i-a.weekStartsOn+8)%7||7;switch(t){case"e":return String(r);case"ee":return bu(r,2);case"eo":return n.ordinalNumber(r,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(e,t,n,a){const i=e.getDay(),r=(i-a.weekStartsOn+8)%7||7;switch(t){case"c":return String(r);case"cc":return bu(r,t.length);case"co":return n.ordinalNumber(r,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(e,t,n){const a=e.getDay(),i=0===a?7:a;switch(t){case"i":return String(i);case"ii":return bu(i,t.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},a:function(e,t,n){const a=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(e,t,n){const a=e.getHours();let i;switch(i=12===a?Cu:0===a?xu:a/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(e,t,n){const a=e.getHours();let i;switch(i=a>=17?Su:a>=12?ku:a>=4?Mu:Eu,t){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){let t=e.getHours()%12;return 0===t&&(t=12),n.ordinalNumber(t,{unit:"hour"})}return wu.h(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getHours(),{unit:"hour"}):wu.H(e,t)},K:function(e,t,n){const a=e.getHours()%12;return"Ko"===t?n.ordinalNumber(a,{unit:"hour"}):bu(a,t.length)},k:function(e,t,n){let a=e.getHours();return 0===a&&(a=24),"ko"===t?n.ordinalNumber(a,{unit:"hour"}):bu(a,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):wu.m(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getSeconds(),{unit:"second"}):wu.s(e,t)},S:function(e,t){return wu.S(e,t)},X:function(e,t,n){const a=e.getTimezoneOffset();if(0===a)return"Z";switch(t){case"X":return zu(a);case"XXXX":case"XX":return Iu(a);default:return Iu(a,":")}},x:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"x":return zu(a);case"xxxx":case"xx":return Iu(a);default:return Iu(a,":")}},O:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Au(a,":");default:return"GMT"+Iu(a,":")}},z:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Au(a,":");default:return"GMT"+Iu(a,":")}},t:function(e,t,n){return bu(Math.trunc(e.getTime()/1e3),t.length)},T:function(e,t,n){return bu(e.getTime(),t.length)}};function Au(e,t=""){const n=e>0?"-":"+",a=Math.abs(e),i=Math.trunc(a/60),r=a%60;return 0===r?n+String(i):n+String(i)+t+bu(r,2)}function zu(e,t){if(e%60==0){return(e>0?"-":"+")+bu(Math.abs(e)/60,2)}return Iu(e,t)}function Iu(e,t=""){const n=e>0?"-":"+",a=Math.abs(e);return n+bu(Math.trunc(a/60),2)+t+bu(a%60,2)}const Tu=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},ju=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},Ou={p:ju,P:(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],a=n[1],i=n[2];if(!i)return Tu(e,t);let r;switch(a){case"P":r=t.dateTime({width:"short"});break;case"PP":r=t.dateTime({width:"medium"});break;case"PPP":r=t.dateTime({width:"long"});break;default:r=t.dateTime({width:"full"})}return r.replace("{{date}}",Tu(a,t)).replace("{{time}}",ju(i,t))}},Du=/^D+$/,Ru=/^Y+$/,Pu=["D","DD","YY","YYYY"];function Lu(e){return Du.test(e)}function Nu(e){return Ru.test(e)}function Fu(e,t,n){const a=function(e,t,n){const a="Y"===e[0]?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${a} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}(e,t,n);if(console.warn(a),Pu.includes(e))throw new RangeError(a)}const Vu=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Hu=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Bu=/^'([^]*?)'?$/,qu=/''/g,Uu=/[a-zA-Z]/;function Wu(e,t,n){const a=Xd(),i=n?.locale??a.locale??gu,r=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??a.weekStartsOn??a.locale?.options?.weekStartsOn??0,s=Vd(e);if(!iu(s))throw new RangeError("Invalid time value");let c=t.match(Hu).map((e=>{const t=e[0];if("p"===t||"P"===t){return(0,Ou[t])(e,i.formatLong)}return e})).join("").match(Vu).map((e=>{if("''"===e)return{isToken:!1,value:"'"};const t=e[0];if("'"===t)return{isToken:!1,value:Zu(e)};if($u[t])return{isToken:!0,value:e};if(t.match(Uu))throw new RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}}));i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));const l={firstWeekContainsDate:r,weekStartsOn:o,locale:i};return c.map((a=>{if(!a.isToken)return a.value;const r=a.value;(!n?.useAdditionalWeekYearTokens&&Nu(r)||!n?.useAdditionalDayOfYearTokens&&Lu(r))&&Fu(r,t,String(e));return(0,$u[r[0]])(s,r,i.localize,l)})).join("")}function Zu(e){const t=e.match(Bu);return t?t[1].replace(qu,"'"):e}function Qu(e,t){const{years:n=0,months:a=0,weeks:i=0,days:r=0,hours:o=0,minutes:s=0,seconds:c=0}=t,l=function(e,t){return qd(e,-t)}(e,a+12*n),d=function(e,t){return Bd(e,-t)}(l,r+7*i),u=1e3*(c+60*(s+60*o));return Hd(e,d.getTime()-u)}function Gu(e,t){return e===t||e!=e&&t!=t}function Yu(e,t){for(var n=e.length;n--;)if(Gu(e[n][0],t))return n;return-1}var Ku=Array.prototype.splice;function Xu(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1},Xu.prototype.set=function(e,t){var n=this.__data__,a=Yu(n,e);return a<0?(++this.size,n.push([e,t])):n[a][1]=t,this};var Ju="object"==typeof global&&global&&global.Object===Object&&global,eh="object"==typeof self&&self&&self.Object===Object&&self,th=Ju||eh||Function("return this")(),nh=th.Symbol,ah=Object.prototype,ih=ah.hasOwnProperty,rh=ah.toString,oh=nh?nh.toStringTag:void 0;var sh=Object.prototype.toString;var ch="[object Null]",lh="[object Undefined]",dh=nh?nh.toStringTag:void 0;function uh(e){return null==e?void 0===e?lh:ch:dh&&dh in Object(e)?function(e){var t=ih.call(e,oh),n=e[oh];try{e[oh]=void 0;var a=!0}catch(e){}var i=rh.call(e);return a&&(t?e[oh]=n:delete e[oh]),i}(e):function(e){return sh.call(e)}(e)}function hh(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var ph="[object AsyncFunction]",mh="[object Function]",gh="[object GeneratorFunction]",fh="[object Proxy]";function _h(e){if(!hh(e))return!1;var t=uh(e);return t==mh||t==gh||t==ph||t==fh}var vh,yh=th["__core-js_shared__"],bh=(vh=/[^.]+$/.exec(yh&&yh.keys&&yh.keys.IE_PROTO||""))?"Symbol(src)_1."+vh:"";var wh=Function.prototype.toString;function xh(e){if(null!=e){try{return wh.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var Ch=/^\[object .+?Constructor\]$/,Mh=Function.prototype,kh=Object.prototype,Sh=Mh.toString,Eh=kh.hasOwnProperty,$h=RegExp("^"+Sh.call(Eh).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ah(e){return!(!hh(e)||(t=e,bh&&bh in t))&&(_h(e)?$h:Ch).test(xh(e));var t}function zh(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Ah(n)?n:void 0}var Ih=zh(th,"Map"),Th=zh(Object,"create");var jh=Object.prototype.hasOwnProperty;var Oh=Object.prototype.hasOwnProperty;function Dh(e){var t=-1,n=null==e?0:e.length;for(this.clear();++ts))return!1;var l=r.get(e),d=r.get(t);if(l&&d)return l==t&&d==e;var u=-1,h=!0,p=n&Bh?new Nh:void 0;for(r.set(e,t),r.set(t,e);++u-1&&e%1==0&&e-1&&e%1==0&&e<=Ap}var Ip={};function Tp(e){return function(t){return e(t)}}Ip["[object Float32Array]"]=Ip["[object Float64Array]"]=Ip["[object Int8Array]"]=Ip["[object Int16Array]"]=Ip["[object Int32Array]"]=Ip["[object Uint8Array]"]=Ip["[object Uint8ClampedArray]"]=Ip["[object Uint16Array]"]=Ip["[object Uint32Array]"]=!0,Ip["[object Arguments]"]=Ip["[object Array]"]=Ip["[object ArrayBuffer]"]=Ip["[object Boolean]"]=Ip["[object DataView]"]=Ip["[object Date]"]=Ip["[object Error]"]=Ip["[object Function]"]=Ip["[object Map]"]=Ip["[object Number]"]=Ip["[object Object]"]=Ip["[object RegExp]"]=Ip["[object Set]"]=Ip["[object String]"]=Ip["[object WeakMap]"]=!1;var jp="object"==typeof exports&&exports&&!exports.nodeType&&exports,Op=jp&&"object"==typeof module&&module&&!module.nodeType&&module,Dp=Op&&Op.exports===jp&&Ju.process,Rp=function(){try{var e=Op&&Op.require&&Op.require("util").types;return e||Dp&&Dp.binding&&Dp.binding("util")}catch(e){}}(),Pp=Rp,Lp=Pp&&Pp.isTypedArray,Np=Lp?Tp(Lp):function(e){return fp(e)&&zp(e.length)&&!!Ip[uh(e)]},Fp=Object.prototype.hasOwnProperty;function Vp(e,t){var n=dp(e),a=!n&&wp(e),i=!n&&!a&&kp(e),r=!n&&!a&&!i&&Np(e),o=n||a||i||r,s=o?function(e,t){for(var n=-1,a=Array(e);++n0){if(++og>=800)return arguments[0]}else og=0;return rg.apply(void 0,arguments)});function lg(e,t){return cg(function(e,t,n){return t=tg(void 0===t?e.length-1:t,0),function(){for(var a=arguments,i=-1,r=tg(a.length-t,0),o=Array(r);++i1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(r=e.length>3&&"function"==typeof r?(i--,r):void 0,o&&dg(n[0],n[1],o)&&(r=i<3?void 0:r,i=1),t=Object(t);++a-1}function Ng(e,t,n){for(var a=-1,i=null==e?0:e.length;++a=Vg){var l=t?null:Fg(e);if(l)return Zh(l);o=!1,i=Vh,c=new Nh}else c=t?[]:s;e:for(;++ae[0].toUpperCase()+e.substring(1))).join(" ")}function Ug(e,t,n){const a=e[t];return e.splice(t,1),e.splice(n,0,a),e}const Wg=e=>Array.isArray(e)?e:[e],Zg=e=>e instanceof Set?e:new Set(Wg(e));function Qg(e,t,n){return!function(e,t,n){var a=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===a?bm(e,t,void 0,n):!!a}(e,t,n)}function Gg(e,t=console.warn){e instanceof zs&&e.context?t(e,e.context):t("object"==typeof e&&"message"in e?e.message:e)}const Yg=()=>window.matchMedia("(hover: hover) and (pointer: fine)").matches,Kg=(e,t)=>Wu(e,"yyyy-MM-dd HH:mm"+(t?":ss":"")),Xg=e=>Wu(e,"yyyy-MM-dd"),Jg=(e,t)=>{window.requestIdleCallback?window.requestIdleCallback(e,{...t&&{timeout:t}}):e()};function ef(e,t){const n=function(e,t,n){const a=ou(e,t)/Gd;return ru(n?.roundingMethod)(a)}(t,e),a=function(e,t,n){const a=ou(e,t)/Qd;return ru(n?.roundingMethod)(a)}(t,e)-60*n;let i="";return n&&(i+=`${n}h `),a&&(i+=`${a}m `),i+=`${su(t,e)-60*n*60-60*a}s`,i}const tf=async(e,t)=>await Promise.all(Array.from(e).map((e=>t(e)))),nf=e=>new Date(`${e}T00:00:00`),af=async e=>{await new Promise((t=>setTimeout(t,1e3*e)))},rf=e=>!isNaN(e.getTime()),of=(e,t,n,a)=>{t?e.setAttribute(n,a??""):e.removeAttribute(n)},sf=e=>!!e,cf=e=>e instanceof HTMLElement,lf=e=>(e instanceof HTMLSlotElement?e.assignedElements({flatten:!0}):[...e.children]).filter(cf),df=e=>e?.ratio&&2===e.ratio.length?`${e.ratio[0]} / ${e.ratio[1]}`:e?.defaultStatic?"16 / 9":"auto",uf=e=>({"aspect-ratio":df(e)}),hf=e=>{if(Array.isArray(e))return e.filter((e=>void 0!==e)).map((e=>hf(e)));if("object"==typeof e&&null!==e){const t={};for(const n in e)t[n]=hf(e[n]);return t}return e},pf=(e,t,n)=>Rg(e,n)===Rg(t,n);function mf(e){if(!e)return null;const t=Ic.safeParse(e);return t.success?t.data:null}function gf(e,t){return{action:"fire-dom-event",frigate_card_action:e,...t?.cardID&&{card_id:t.cardID}}}function ff(e,t,n){return{action:"fire-dom-event",frigate_card_action:e,camera:t,...n?.cardID&&{card_id:n.cardID}}}function _f(e,t,n){return{action:"fire-dom-event",frigate_card_action:"media_player",media_player:e,media_player_action:t,...n?.cardID&&{card_id:n.cardID}}}function vf(e){return{action:"fire-dom-event",frigate_card_action:"ptz_multi",...e?.cardID&&{card_id:e.cardID},...e?.ptzAction&&{ptz_action:e.ptzAction},...e?.ptzPhase&&{ptz_phase:e.ptzPhase},...e?.ptzPreset&&{ptz_preset:e.ptzPreset},...e?.targetID&&{target_id:e.targetID}}}function yf(e,t){return e&&t?"tap"===e&&t.tap_action?t.tap_action:"hold"===e&&t.hold_action?t.hold_action:"double_tap"===e&&t.double_tap_action?t.double_tap_action:"end_tap"===e&&t.end_tap_action?t.end_tap_action:"start_tap"===e&&t.start_tap_action?t.start_tap_action:null:null}const bf=e=>Wg(e).some((e=>function(e){return void 0!==e&&"none"!==e.action}(e))),wf=e=>{e.stopPropagation()};class xf{constructor(){this._timer=null,this._repeated=!1}stop(){this._timer&&(this._repeated?window.clearInterval(this._timer):window.clearTimeout(this._timer),this._timer=null)}isRunning(){return null!==this._timer}start(e,t){this.stop(),this._timer=window.setTimeout((()=>{this._timer=null,t()}),1e3*e),this._repeated=!1}startRepeated(e,t){this.stop(),this._timer=window.setInterval((()=>{t()}),1e3*e),this._repeated=!0}}class Cf extends HTMLElement{constructor(){super(...arguments),this.holdTime=.4,this.holdTimer=new xf,this.doubleClickTimer=new xf,this.held=!1,this.started=!1}connectedCallback(){["touchcancel","mouseout","mouseup","touchmove","mousewheel","wheel","scroll"].forEach((e=>{document.addEventListener(e,(()=>{this.holdTimer.stop()}),{passive:!0})}))}bind(e,t){if(e.actionHandlerOptions)return void(e.actionHandlerOptions=t);e.actionHandlerOptions=t,e.addEventListener("contextmenu",(e=>{const t=e||window.event;return t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.cancelBubble=!0,t.returnValue=!1,!1}));const n=()=>{this.held=!1,this.holdTimer.start(this.holdTime,(()=>{this.held=!0})),this.started||(this.started=!0,et(e,"action",{action:"start_tap"}))},a=t=>{this.holdTimer.stop(),this.started&&(this.started=!1,et(e,"action",{action:"end_tap"}))},i=t=>{const n=e.actionHandlerOptions;n?.allowPropagation||wf(t),["touchend","touchcancel"].includes(t.type)&&!this.held||(a(),n?.hasHold&&this.held?et(e,"action",{action:"hold"}):n?.hasDoubleClick?"click"===t.type&&t.detail<2||!this.doubleClickTimer.isRunning()?this.doubleClickTimer.start(.25,(()=>et(e,"action",{action:"tap"}))):(this.doubleClickTimer.stop(),et(e,"action",{action:"double_tap"})):et(e,"action",{action:"tap"}))};e.addEventListener("touchstart",n,{passive:!0}),e.addEventListener("touchend",i),e.addEventListener("touchcancel",i),e.addEventListener("mousedown",n,{passive:!0}),e.addEventListener("click",i),e.addEventListener("keyup",(e=>{"Enter"===e.key&&i(e)})),e.addEventListener("mouseleave",a)}}customElements.define("action-handler-frigate-card",Cf);const Mf=(e,t)=>{const n=(()=>{const e=document.body;if(e.querySelector("action-handler-frigate-card"))return e.querySelector("action-handler-frigate-card");const t=document.createElement("action-handler-frigate-card");return e.appendChild(t),t})();n&&n.bind(e,t)},kf=ge(class extends fe{update(e,[t]){return Mf(e.element,t),U}render(e){}});var Sf=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)lp(t,gp(e)),e=Pm(e);return t}:hp;function Ef(e){return up(e,Km,Sf)}var $f=Object.prototype.hasOwnProperty;var Af=/\w*$/;var zf=nh?nh.prototype:void 0,If=zf?zf.valueOf:void 0;var Tf="[object Boolean]",jf="[object Date]",Of="[object Map]",Df="[object Number]",Rf="[object RegExp]",Pf="[object Set]",Lf="[object String]",Nf="[object Symbol]",Ff="[object ArrayBuffer]",Vf="[object DataView]",Hf="[object Float32Array]",Bf="[object Float64Array]",qf="[object Int8Array]",Uf="[object Int16Array]",Wf="[object Int32Array]",Zf="[object Uint8Array]",Qf="[object Uint8ClampedArray]",Gf="[object Uint16Array]",Yf="[object Uint32Array]";function Kf(e,t,n){var a,i,r,o=e.constructor;switch(t){case Ff:return Tm(e);case Tf:case jf:return new o(+e);case Vf:return function(e,t){var n=t?Tm(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case Hf:case Bf:case qf:case Uf:case Wf:case Zf:case Qf:case Gf:case Yf:return jm(e,n);case Of:return new o;case Df:case Lf:return new o(e);case Rf:return(r=new(i=e).constructor(i.source,Af.exec(i))).lastIndex=i.lastIndex,r;case Pf:return new o;case Nf:return a=e,If?Object(If.call(a)):{}}}var Xf=Pp&&Pp.isMap,Jf=Xf?Tp(Xf):function(e){return fp(e)&&"[object Map]"==pm(e)};var e_=Pp&&Pp.isSet,t_=e_?Tp(e_):function(e){return fp(e)&&"[object Set]"==pm(e)},n_=1,a_=2,i_=4,r_="[object Arguments]",o_="[object Function]",s_="[object GeneratorFunction]",c_="[object Object]",l_={};function d_(e,t,n,a,i,r){var o,s=t&n_,c=t&a_,l=t&i_;if(n&&(o=i?n(e,a,i,r):n(e)),void 0!==o)return o;if(!hh(e))return e;var d=dp(e);if(d){if(o=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&$f.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!s)return Om(e,o)}else{var u=pm(e),h=u==o_||u==s_;if(kp(e))return Im(e,s);if(u==c_||u==r_||h&&!i){if(o=c||h?{}:Lm(e),!s)return c?function(e,t){return Qm(e,Sf(e),t)}(e,function(e,t){return e&&Qm(t,Km(t),e)}(o,e)):function(e,t){return Qm(e,gp(e),t)}(e,function(e,t){return e&&Qm(t,Qp(t),e)}(o,e))}else{if(!l_[u])return i?e:{};o=Kf(e,u,s)}}r||(r=new Lh);var p=r.get(e);if(p)return p;r.set(e,o),t_(e)?e.forEach((function(a){o.add(d_(a,t,n,a,e,r))})):Jf(e)&&e.forEach((function(a,i){o.set(i,d_(a,t,n,i,e,r))}));var m=d?void 0:(l?c?Ef:Gp:c?Km:Qp)(e);return function(e,t){for(var n=-1,a=null==e?0:e.length;++nvoid 0===globalThis.DOMException?new __(e):new DOMException(e),y_=e=>{const t=void 0===e.reason?v_("This operation was aborted."):e.reason;return t instanceof Error?t:v_(t)};class b_{#e=[];enqueue(e,t){const n={priority:(t={priority:0,...t}).priority,run:e};if(this.size&&this.#e[this.size-1].priority>=t.priority)return void this.#e.push(n);const a=function(e,t,n){let a=0,i=e.length;for(;i>0;){const r=Math.trunc(i/2);let o=a+r;n(e[o],t)<=0?(a=++o,i-=r+1):i=r}return a}(this.#e,n,((e,t)=>t.priority-e.priority));this.#e.splice(a,0,n)}dequeue(){const e=this.#e.shift();return e?.run}filter(e){return this.#e.filter((t=>t.priority===e.priority)).map((e=>e.run))}get size(){return this.#e.length}}class w_ extends g_{#t;#n;#a=0;#i;#r;#o=0;#s;#c;#e;#l;#d=0;#u;#h;#p;timeout;constructor(e){if(super(),!("number"==typeof(e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:b_,...e}).intervalCap&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??""}\` (${typeof e.intervalCap})`);if(void 0===e.interval||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??""}\` (${typeof e.interval})`);this.#t=e.carryoverConcurrencyCount,this.#n=e.intervalCap===Number.POSITIVE_INFINITY||0===e.interval,this.#i=e.intervalCap,this.#r=e.interval,this.#e=new e.queueClass,this.#l=e.queueClass,this.concurrency=e.concurrency,this.timeout=e.timeout,this.#p=!0===e.throwOnTimeout,this.#h=!1===e.autoStart}get#m(){return this.#n||this.#a{this.#v()}),t)),!0;this.#a=this.#t?this.#d:0}return!1}#_(){if(0===this.#e.size)return this.#s&&clearInterval(this.#s),this.#s=void 0,this.emit("empty"),0===this.#d&&this.emit("idle"),!1;if(!this.#h){const e=!this.#w;if(this.#m&&this.#g){const t=this.#e.dequeue();return!!t&&(this.emit("active"),t(),e&&this.#b(),!0)}}return!1}#b(){this.#n||void 0!==this.#s||(this.#s=setInterval((()=>{this.#y()}),this.#r),this.#o=Date.now()+this.#r)}#y(){0===this.#a&&0===this.#d&&this.#s&&(clearInterval(this.#s),this.#s=void 0),this.#a=this.#t?this.#d:0,this.#x()}#x(){for(;this.#_(););}get concurrency(){return this.#u}set concurrency(e){if(!("number"==typeof e&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this.#u=e,this.#x()}async#C(e){return new Promise(((t,n)=>{e.addEventListener("abort",(()=>{n(e.reason)}),{once:!0})}))}async add(e,t={}){return t={timeout:this.timeout,throwOnTimeout:this.#p,...t},new Promise(((n,a)=>{this.#e.enqueue((async()=>{this.#d++,this.#a++;try{t.signal?.throwIfAborted();let a=e({signal:t.signal});t.timeout&&(a=function(e,t){const{milliseconds:n,fallback:a,message:i,customTimers:r={setTimeout:setTimeout,clearTimeout:clearTimeout}}=t;let o;const s=new Promise(((s,c)=>{if("number"!=typeof n||1!==Math.sign(n))throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${n}\``);if(t.signal){const{signal:e}=t;e.aborted&&c(y_(e)),e.addEventListener("abort",(()=>{c(y_(e))}))}if(n===Number.POSITIVE_INFINITY)return void e.then(s,c);const l=new f_;o=r.setTimeout.call(void 0,(()=>{if(a)try{s(a())}catch(e){c(e)}else"function"==typeof e.cancel&&e.cancel(),!1===i?s():i instanceof Error?c(i):(l.message=i??`Promise timed out after ${n} milliseconds`,c(l))}),n),(async()=>{try{s(await e)}catch(e){c(e)}})()})),c=s.finally((()=>{c.clear()}));return c.clear=()=>{r.clearTimeout.call(void 0,o),o=void 0},c}(Promise.resolve(a),{milliseconds:t.timeout})),t.signal&&(a=Promise.race([a,this.#C(t.signal)]));const i=await a;n(i),this.emit("completed",i)}catch(e){if(e instanceof f_&&!t.throwOnTimeout)return void n();a(e),this.emit("error",e)}finally{this.#f()}}),t),this.emit("add"),this.#_()}))}async addAll(e,t){return Promise.all(e.map((async e=>this.add(e,t))))}start(){return this.#h?(this.#h=!1,this.#x(),this):this}pause(){this.#h=!0}clear(){this.#e=new this.#l}async onEmpty(){0!==this.#e.size&&await this.#M("empty")}async onSizeLessThan(e){this.#e.sizethis.#e.size{const a=()=>{t&&!t()||(this.off(e,a),n())};this.on(e,a)}))}get size(){return this.#e.size}sizeBy(e){return this.#e.filter(e).length}get pending(){return this.#d}get isPaused(){return this.#h}}var x_={frigate_card:"Frigate card",frigate_card_description:"A Lovelace card for use with Frigate",live:"Live",no_media:"No media to display",recordings:"Recordings",version:"Version"},C_={cameras:{camera_entity:"Camera Entity",capabilities:{capabilities:{clips:"Clips","favorite-events":"Favorite Events","favorite-recordings":"Favorite Recordings",live:"Live",menu:"Menu",ptz:"PTZ",recordings:"Recordings",seek:"Seeking",snapshots:"Snapshots",substream:"Substream"},disable:"Disable",disable_except:"Disable except",editor_label:"Camera capabilities"},cast:{dashboard:{dashboard_path:"Dashboard path",view_path:"View path"},editor_label:"Cast options",method:"Cast method",methods:{dashboard:"Dashboard",standard:"Standard"}},dependencies:{all_cameras:"Show events for all cameras with this camera",cameras:"Show events for specific cameras with this camera",editor_label:"Dependency options"},dimensions:{aspect_ratio:"Static aspect ratio",editor_label:"Camera dimensions",layout:{editor_label:"Camera Layout",fit:"Layout fit",fits:{contain:"Media is contained/letterboxed",cover:"Media expands proportionally to cover the card",fill:"Media is stretched to fill the card"},pan:{x:"Pan horizontal percentage",y:"Pan vertical percentage"},position:{editor_label:"Layout Cover Position",x:"Horizontal placement percentage",y:"Vertical placement percentage"},view_box:{bottom:"Bottom inset percentage",editor_label:"Layout View Box",left:"Left inset percentage",right:"Right inset percentage",top:"Top inset percentage"},zoom:"Zoom factor"}},engines:{editor_label:"Camera engine options"},frigate:{camera_name:"Frigate camera name (Autodetected from entity)",client_id:"Frigate client id (For >1 Frigate server)",editor_label:"Frigate options",labels:"Frigate labels/object filters",url:"Frigate server URL",zones:"Frigate zones"},go2rtc:{editor_label:"go2rtc Options",modes:{editor_label:"go2rtc Modes",mjpeg:"Motion JPEG (MJPEG)",mp4:"MPEG-4 (MP4)",mse:"Media Source Extensions (MSE)",webrtc:"Web Real-Time Communication (WebRTC)"},stream:"go2rtc stream name"},icon:"Icon for this camera (Autodetected from entity)",id:"Unique id for this camera in this card",image:{editor_label:"Image Options",refresh_seconds:"Number of seconds after which to refresh live image (0=never)",url:"Image URL to use instead of camera entity snapshot"},live_provider:"Live view provider for this camera",live_provider_options:{editor_label:"Live provider options"},live_providers:{auto:"Automatic",go2rtc:"go2rtc",ha:"Home Assistant video stream (i.e. HLS, LL-HLS, WebRTC via HA)",image:"Home Assistant images",jsmpeg:"JSMpeg","webrtc-card":"WebRTC Card (i.e. AlexxIT's WebRTC Card)"},motioneye:{editor_label:"MotionEye options",images:{directory_pattern:"Images directory pattern",file_pattern:"Images file pattern"},movies:{directory_pattern:"Movies directory pattern",file_pattern:"Movies file pattern"},url:"MotionEye UI URL"},proxy:{dynamic:"Dynamic proxying",editor_label:"Camera proxying",media:{auto:"Media proxying automatically configured",editor_label:"Media proxying",false:"Media proxying disabled",true:"Media proxying enabled"},ssl_ciphers:{auto:"SSL ciphers automatically configured",default:"Default SSL ciphers",editor_label:"SSL ciphers",insecure:"Insecure SSL ciphers",intermediate:"Intermediate SSL ciphers",modern:"Modern SSL ciphers"},ssl_verification:{auto:"SSL verification automatically configured",editor_label:"SSL verification",false:"SSL verification disabled",true:"SSL verification enabled"}},reolink:{editor_label:"Reolink options",media_resolution:{editor_label:"Media Resolution",high:"High Resolution",low:"Low Resolution"},url:"Reolink UI URL"},title:"Title for this camera (Autodetected from entity)",triggers:{editor_label:"Trigger options",entities:"Trigger from other entities",events:{clips:"Events with new clips",editor_label:"Trigger Events",events:"All events",snapshots:"Events with new snapshots"},motion:"Trigger by auto-detecting the motion sensor",occupancy:"Trigger by auto-detecting the occupancy sensor"},webrtc_card:{editor_label:"WebRTC Card Options",entity:"WebRTC Card Camera Entity (Not a Frigate camera)",url:"WebRTC Card Camera URL"}},common:{controls:{builtin:"Built-in video controls",filter:{editor_label:"Media Filter",mode:"Filter mode",modes:{left:"Media filter in a drawer to the left",none:"No media filter",right:"Media filter in a drawer to the right"}},next_previous:{editor_label:"Next & Previous",size:"Next & previous control size in pixels",style:"Next & previous control style",styles:{chevrons:"Chevrons",icons:"Icons",none:"None",thumbnails:"Thumbnails"}},thumbnails:{editor_label:"Thumbnails",events_media_type:"Whether to show event thumbnails of clips or snapshots",events_media_types:{clips:"Clip thumbnails",snapshots:"Snapshot thumbnails"},media_type:"Whether to show thumnails of events or recordings",media_types:{events:"Events",recordings:"Recordings"},mode:"Thumbnails mode",modes:{above:"Thumbnails above",below:"Thumbnails below",left:"Thumbnails in a drawer to the left",none:"No thumbnails",right:"Thumbnails in a drawer to the right"},show_details:"Show details with thumbnails",show_download_control:"Show download control on thumbnails",show_favorite_control:"Show favorite control on thumbnails",show_timeline_control:"Show timeline control on thumbnails",size:"Thumbnails size in pixels"},timeline:{editor_label:"Mini Timeline",mode:"Mode",modes:{above:"Above",below:"Below",none:"None"},pan_mode:"Default pan mode",pan_modes:{pan:"Pan",seek:"Pan seeks across all media","seek-in-camera":"Pan seeks within selected camera only","seek-in-media":"Pan seeks within selected media item only"}}},display:{editor_label:"Display",grid_columns:"Exact number of grid columns",grid_max_columns:"Maximum number of grid columns",grid_selected_width_factor:"Increase selected media width by this factor",mode:"Mode"},image:{entity:"Entity for use with entity mode",entity_parameters:"Query parameters added to the entity-based picture URLs (e.g. width=1920&height=1080)",mode:"Image mode",modes:{camera:"Home Assistant camera snapshot of camera entity",entity:"Entity with entity_picture attribute",screensaver:"Embedded Frigate logo",url:"Arbitrary image specified by URL"},refresh_seconds:"Number of seconds after which to refresh (0=never)",url:"Static image URL"},media_action_conditions:{all:"All opportunities",hidden:"On browser/tab hiding",microphone_mute:"On microphone mute",microphone_unmute:"On microphone unmute",never:"Never",selected:"On selection",unselected:"On unselection",visible:"On browser/tab visibility"},timeline:{clustering_threshold:"The count of events at which they are clustered (0=no clustering)",events_media_type:"The events media the timeline displays",events_media_types:{all:"All event media types",clips:"Clips",snapshots:"Snapshots"},show_recordings:"Show recordings",style:"Timeline style",styles:{ribbon:"Events on a single ribbon",stack:"Stacked & clustered events"},window_seconds:"The default length of the timeline view in seconds"}},dimensions:{aspect_ratio:"Default aspect ratio (e.g. '16:9')",aspect_ratio_mode:"Aspect ratio mode",aspect_ratio_modes:{dynamic:"Aspect ratio adjusts to media",static:"Static aspect ratio",unconstrained:"Unconstrained aspect ratio"},height:"Card height in CSS units (e.g. '500px')"},live:{auto_mute:"Automatically mute live cameras",auto_pause:"Automatically pause live cameras",auto_play:"Automatically play live cameras",auto_unmute:"Automatically unmute live cameras",controls:{editor_label:"Live Controls",ptz:{editor_label:"PTZ",hide_home:"Hide home control",hide_pan_tilt:"Hide pan & tilt control",hide_zoom:"Hide zoom control",mode:"Mode",modes:{off:"Off",on:"On"},orientation:"Orientation",orientations:{horizontal:"Horizontal",vertical:"Vertical"},position:"Position",positions:{"bottom-left":"Bottom left","bottom-right":"Bottom right","top-left":"Top left","top-right":"Top right"}}},draggable:"Live cameras view can be dragged/swiped",lazy_load:"Live cameras are lazily loaded",lazy_unload:"Live cameras are lazily unloaded",microphone:{always_connected:"Always keep the microphone connected",disconnect_seconds:"Seconds after which to disconnect microphone (0=never)",editor_label:"Microphone",enabled:"Microphone enabled",mute_after_microphone_mute_seconds:"Seconds after microphone mute to mute inbound audio"},preload:"Preload live view in the background",show_image_during_load:"Show still image while the live stream is loading",transition_effect:"Live camera transition effect",zoomable:"Live cameras can be zoomed/panned"},media_viewer:{auto_mute:"Automatically mute media",auto_pause:"Automatically pause media",auto_play:"Automatically play media",auto_unmute:"Automatically unmute media",controls:{editor_label:"Media Viewer Controls"},draggable:"Media Viewer can be dragged/swiped",lazy_load:"Media Viewer media is lazily loaded in carousel",snapshot_click_plays_clip:"Clicking on a snapshot plays a related clip",transition_effect:"Media Viewer transition effect",transition_effects:{none:"No transition",slide:"Slide transition"},zoomable:"Media Viewer can be zoomed/panned"},menu:{alignment:"Menu alignment",alignments:{bottom:"Aligned to the bottom",left:"Aligned to the left",right:"Aligned to the right",top:"Aligned to the top"},button_size:"Menu button size in pixels",buttons:{alignment:"Button alignment",alignments:{matching:"Matching the menu alignment",opposing:"Opposing the menu alignment"},camera_ui:"Camera user interface",cameras:"Cameras",clips:"Clips",display_mode:"Display mode",download:"Download",enabled:"Button enabled",expand:"Expand",frigate:"Frigate menu / Default view",fullscreen:"Fullscreen",icon:"Icon",image:"Image",live:"Live",media_player:"Send to media player",microphone:"Microphone",mute:"Mute / Unmute",permanent:"Show when the menu is hidden",play:"Play / Pause",priority:"Priority",ptz_controls:"Show PTZ controls",ptz_home:"PTZ Home",recordings:"Recordings",screenshot:"Screenshot",snapshots:"Snapshots",substreams:"Substream(s)",timeline:"Timeline",type:"Button type",types:{momentary:"Momentary",toggle:"Toggle"}},position:"Menu position",positions:{bottom:"Positioned on the bottom",left:"Positioned on the left",right:"Positioned on the right",top:"Positioned on the top"},style:"Menu style",styles:{hidden:"Hidden menu",hover:"Hover menu","hover-card":"Hover menu (card-wide)",none:"No menu",outside:"Outside menu",overlay:"Overlay menu"}},overrides:{info:"This card configuration has manually specified overrides configured which may override values shown in the visual editor, please consult the code editor to view/modify these overrides"},performance:{features:{animated_progress_indicator:"Animated Progress Indicator",editor_label:"Feature Options",max_simultaneous_engine_requests:"Max simultaneous camera engine requests",media_chunk_size:"Media chunk size"},style:{border_radius:"Curves",box_shadow:"Shadows",editor_label:"Style Options"},warning:"This card is in low profile mode so defaults have changed to optimize performance"},profiles:{casting:"Casting",editor_label:"Configuration profiles","low-performance":"Low performance",scrubbing:"Video scrubbing"},status_bar:{height:"Status bar height in pixels",items:{enabled:"Item enabled",engine:"Camera engine",live_provider:"Live provider",priority:"Item priority",resolution:"Resolution",technology:"Technology",title:"Title"},popup_seconds:"Status bar popup seconds",position:"Status bar position",positions:{bottom:"Positioned on the bottom",top:"Positioned on the top"},style:"Status bar style",styles:{hover:"Hover status bar","hover-card":"Hover status bar (card-wide)",none:"No status bar",outside:"Outside status bar",overlay:"Overlay status bar",popup:"Popup status bar"}},view:{camera_select:"View for newly selected cameras",dark_mode:"Dark mode",dark_modes:{auto:"Auto",off:"Off",on:"On"},default:"Default view",default_cycle_camera:"Cycle through cameras when default view updates",default_reset:{after_interaction:"Reset to the default view after user interaction ends",editor_label:"Default view reset behavior",entities:"Reset to the default view on entity state change",every_seconds:"Reset to default view every X seconds (0=never)",interaction_mode:"How default reset behaves when the card has human interaction",interaction_modes:{active:"Only allow reset when card has active human interaction",all:"Reset regardless of human interaction",inactive:"Only reset when card has no human interaction"}},interaction_seconds:"Seconds after user action to remain interacted with (0=never)",keyboard_shortcuts:{editor_label:"Keyboard shortcuts",enabled:"Keyboard shortcuts enabled",ptz_down:"PTZ Down",ptz_home:"PTZ Home",ptz_left:"PTZ Left",ptz_right:"PTZ Right",ptz_up:"PTZ Up",ptz_zoom_in:"PTZ Zoom In",ptz_zoom_out:"PTZ Zoom Out"},triggers:{actions:{editor_label:"Trigger actions",interaction_mode:"How to handle actions when the card has human interaction",interaction_modes:{active:"Only trigger actions when card has human interaction",all:"Trigger actions regardless of human interaction",inactive:"Only trigger actions when card has no human interaction"},trigger:"Trigger action",triggers:{default:"Change to or update default view",live:"Change to or update live view",media:"Change to the relevant media view for new media",none:"No action"},untrigger:"Untrigger action",untriggers:{default:"Change to default view/camera",none:"No action"}},editor_label:"Trigger behavior",filter_selected_camera:"Only trigger on selected camera",show_trigger_status:"Show pulsing border when triggered",untrigger_seconds:"Seconds after inactive state change to untrigger"},views:{clip:"Most recent clip",clips:"Clips gallery",current:"Current view",image:"Static image",live:"Live view",recording:"Most recent recording",recordings:"Recordings gallery",snapshot:"Most recent snapshot",snapshots:"Snapshots gallery",timeline:"Timeline view"}}},M_={grid:"Show media viewer for each camera in a grid",single:"Show single media viewer"},k_={add_new_camera:"Add new camera",button:"Button",camera:"Camera",cameras:"Cameras",cameras_secondary:"What cameras to render on this card",delete:"Delete",dimensions:"Card dimensions",dimensions_secondary:"Card dimensions & shape options",image:"Image",image_secondary:"Static image view options",live:"Live",live_secondary:"Live camera view options",media_gallery:"Media gallery",media_gallery_secondary:"Media gallery options",media_viewer:"Media viewer",media_viewer_secondary:"Viewer for static media (clips, snapshots or recordings)",menu:"Menu",menu_secondary:"Menu look & feel options",move_down:"Move down",move_up:"Move up",overrides:"Overrides are active",overrides_secondary:"Dynamic configuration overrides detected",performance:"Performance",performance_secondary:"Card performance options",profiles:"Configuration profiles",profiles_secondary:"Choose pre-configured sets of defaults",status_bar:"Status bar",status_bar_secondary:"Status bar look & feel options",timeline:"Timeline",timeline_secondary:"Event timeline options",upgrade:"Upgrade",upgrade_available:"An automatic card configuration upgrade is available",view:"View",view_secondary:"What the card should show and how to show it"},S_={ptz:{down:"Down",home:"Home",left:"Left",right:"Right",up:"Up",zoom_in:"Zoom In",zoom_out:"Zoom Out"}},E_={awaiting_live:"Waiting for live stream to load ...",awaiting_media:"Waiting for media to load",camera_initialization:"Camera initialization failed",camera_initialization_reolink:"Could not initialize Reolink camera",could_not_render_elements:"Could not render picture elements",could_not_resolve:"Could not resolve media URL",diagnostics:"Card diagnostics. Please review for confidential information prior to sharing",download_no_media:"No media to download",download_sign_failed:"Could not sign media URL for download",duplicate_camera_id:"Duplicate Frigate camera id for the following camera, use the 'id' parameter to uniquely identify cameras",empty_response:"Received empty response from Home Assistant for request",failed_response:"Failed to receive response from Home Assistant for request",failed_retain:"Could not retain event",failed_sign:"Could not sign Home Assistant URL",image_load_error:"The image could not be loaded",invalid_configuration:"Invalid configuration",invalid_configuration_no_hint:"No location hint available (bad or missing type?)",invalid_configuration_override:"Invalid override configuration",invalid_elements_config:"Invalid picture elements configuration",invalid_response:"Received invalid response from Home Assistant for request",jsmpeg_no_player:"Could not start JSMPEG player",live_camera_no_endpoint:"Could not get camera endpoint for this live provider (incomplete configuration?)",live_camera_not_found:"The configured camera_entity was not found",live_camera_unavailable:"Camera unavailable",no_camera_engine:"Could not determine suitable engine for camera",no_camera_entity:"Could not find camera entity",no_camera_entity_for_triggers:"A camera entity is required in order to autodetect triggers",no_camera_id:"Could not determine camera id for the following camera, may need to set 'id' parameter manually",no_camera_name:"Could not determine a Frigate camera name for camera (or one of its dependents), please specify either 'camera_entity' or 'camera_name'",no_dashboard_or_view:"Both 'dashboard_path' and 'view_path' parameters are required for the 'dashboard' cast method",no_live_camera:"The camera_entity parameter must be set and valid for this live provider",no_supported_camera:"The selected camera does not support this view",no_supported_cameras:"No cameras support this view",reconnecting:"Reconnecting",too_many_automations:"Too many nested automation calls, please check your configuration for loops",troubleshooting:"Check troubleshooting",unknown:"Unknown error",upgrade_available:"An automated card configuration upgrade is available, please visit the visual card editor",webrtc_card_reported_error:"WebRTC Card reported an error",webrtc_card_waiting:"Waiting for WebRTC Card to load ..."},$_={camera:"Camera",duration:"Duration",in_progress:"In Progress",score:"Score",seek:"Seek",start:"Start",tag:"Tag",what:"What",where:"Where"},A_={assign:"Assign",assigning:"Assigning",modifiers:{alt:"Alt",ctrl:"Ctrl",meta:"Meta",shift:"Shift"},unassign:"Unassign"},z_={all:"All",camera:"Camera",favorite:"Favorite",media_type:"Media Type",media_types:{clips:"Clips",recordings:"Recordings",snapshots:"Snapshots"},not_favorite:"Not Favorite",select_camera:"Select camera...",select_favorite:"Select favorite...",select_media_type:"Select media type...",select_tag:"Select tag...",select_what:"Select what...",select_when:"Select when...",select_where:"Select where...",tag:"Tag",what:"What",when:"When",whens:{custom:"Custom",past_month:"Past Month",past_week:"Past Week",today:"Today",yesterday:"Yesterday"},where:"Where"},I_={unseekable:"Seek time not found in media"},T_={camera:"Camera",duration:"Duration",events:"Events",in_progress:"In Progress",seek:"Seek",start:"Start"},j_={download:"Download media",no_thumbnail:"No thumbnail available",retain_indefinitely:"Media will be indefinitely retained",timeline:"See media in timeline"},O_={select_date:"Choose date"},D_={common:x_,config:C_,display_modes:M_,editor:k_,elements:S_,error:E_,event:$_,key_assigner:A_,media_filter:z_,media_viewer:I_,recording:T_,thumbnail:j_,timeline:O_},R_=Object.freeze({__proto__:null,common:x_,config:C_,default:D_,display_modes:M_,editor:k_,elements:S_,error:E_,event:$_,key_assigner:A_,media_filter:z_,media_viewer:I_,recording:T_,thumbnail:j_,timeline:O_});const P_="en",L_={[P_]:R_};let N_;function F_(e){const t=e=>e.replace("-","_"),n=e?.language??e?.selectedLanguage;if(n)return t(n);const a=localStorage.getItem("selectedLanguage");if(a){const e=JSON.parse(a);if(e)return t(e)}for(const e of navigator.languages){const n=t(e);if(n&&n in L_)return n}return P_}function V_(e,t="",n=""){let a="";try{a=e.split(".").reduce(((e,t)=>e[t]),L_[N_??P_])}catch(e){}return a||(a=e.split(".").reduce(((e,t)=>e[t]),L_[P_])),""!==t&&""!==n&&(a=a.replace(t,n)),a}function H_(e){return"string"==typeof e?.id&&e.id||"string"==typeof e?.camera_entity&&e.camera_entity||"object"==typeof e?.webrtc_card&&e.webrtc_card&&("string"==typeof e.webrtc_card.entity&&e.webrtc_card.entity||"string"==typeof e.webrtc_card.url&&e.webrtc_card.url)||"object"==typeof e?.go2rtc&&e.go2rtc&&"string"==typeof e.go2rtc.url&&"string"==typeof e.go2rtc.stream&&`${e.go2rtc.url}#${e.go2rtc.stream}`||"object"==typeof e?.frigate&&e.frigate&&"string"==typeof e?.frigate.camera_name&&e.frigate.camera_name||""}const B_=(e,...t)=>{e?.debug?.logging&&console.debug(...t)},q_=(e,t,n)=>"preset"===t?(n?.preset?e.ptz.presets?.[n.preset]:null)??null:n?.phase?e.ptz[`actions_${t}_${n.phase}`]??null:e.ptz[`actions_${t}`]??null,U_=(e,t,n)=>!!q_(e,t,n),W_=(e,t)=>{const n=U_(e,t,{phase:"start"})&&U_(e,t,{phase:"stop"}),a=U_(e,t);return n||a?[...n?["continuous"]:[],...a?["relative"]:[]]:null},Z_=e=>{const t=W_(e,"left"),n=W_(e,"right"),a=W_(e,"up"),i=W_(e,"down"),r=W_(e,"zoom_in"),o=W_(e,"zoom_out"),s=e.ptz.presets?Object.keys(e.ptz.presets):void 0;return t?.length||n?.length||a?.length||i?.length||r?.length||o?.length||s?.length?{...t?{left:t}:{},...n?{right:n}:{},...a?{up:a}:{},...i?{down:i}:{},...r?{zoomIn:r}:{},...o?{zoomOut:o}:{},...s?{presets:s}:{}}:null};class Q_{constructor(e,t){this._capabilities=e;for(const e of t?.disable??[])this._disable(e);for(const e of Ts)t?.disableExcept?.length&&!t.disableExcept.includes(e)&&this._disable(e)}_disable(e){delete this._capabilities[e]}matches(e){let t=!0;return"string"==typeof e&&(t&&=this.has(e)),"object"==typeof e&&e.allCapabilities&&(t&&=e.allCapabilities.every((e=>this.has(e)))),"object"==typeof e&&e.anyCapabilities&&(t&&=e.anyCapabilities.some((e=>this.has(e)))),t}has(e){return!!this._capabilities[e]}getPTZCapabilities(){return this._capabilities.ptz??null}hasPTZCapability(){return!!(this._capabilities.ptz?.down?.length||this._capabilities.ptz?.up?.length||this._capabilities.ptz?.left?.length||this._capabilities.ptz?.right?.length||this._capabilities.ptz?.zoomIn?.length||this._capabilities.ptz?.zoomOut?.length||this._capabilities.ptz?.presets?.length)}getRawCapabilities(){return this._capabilities}}function G_(e,t,n){var a=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var r=Array(i);++at||r&&o&&c&&!s&&!l||a&&o&&c||!n&&c||!i)return 1;if(!a&&!r&&!l&&e=s?c:c*("desc"==n[a]?-1:1)}return e.index-t.index}(e,t,n)}))}function Ev(e,t,n,a){return null==e?[]:(dp(t)||(t=null==t?[]:[t]),dp(n=a?void 0:n)||(n=null==n?[]:[n]),Sv(e,t,n))}async function $v(e,t,n,a=!1){let i;try{i=await e.callWS(n)}catch(e){if(!(e instanceof Error))throw new zs(V_("error.failed_response"),{request:n,response:e});throw e}if(!i)throw new zs(V_("error.empty_response"),{request:n});const r=a?t.safeParse(JSON.parse(i)):t.safeParse(i);if(!r.success)throw new zs(V_("error.invalid_response"),{request:n,response:i,invalid_keys:Rs(r.error)});return r.data}const Av=ba.lazy((()=>ba.object({title:ba.string(),media_class:ba.string(),media_content_type:ba.string(),media_content_id:ba.string(),can_play:ba.boolean(),can_expand:ba.boolean(),children_media_class:ba.string().nullable().optional(),thumbnail:ba.string().nullable(),children:ba.array(Av).nullable().optional()}))),zv="video",Iv="image",Tv=60,jv=e=>Ev(e,(e=>e._metadata?.startDate),"desc");class Ov{async walkBrowseMedias(e,t,n){return t&&t.length?(await tf(t,(async t=>await this._walkBrowseMedia(e,t,n)))).flat():[]}async _walkBrowseMedia(e,t,n){let a=[];for(const i of function(e,t,n){t=(n?dg(e,t,n):void 0===t)?1:K_(Sg(t),0);var a=null==e?0:e.length;if(!a||t<1)return[];for(var i=0,r=0,o=Array(Y_(a/t));iawait this._browseMedia(e,a,{cache:n?.cache,matcher:t.matcher,metadataGenerator:t.metadataGenerator})));for(const e of r)for(const n of e.children??[])t.matcher(n)&&a.push(n);if(t.sorter&&(a=t.sorter(a)),t.earlyExit&&t.earlyExit(a))break}const i=t.advance?t.advance(a):null;return i?.length?await this.walkBrowseMedias(e,i,n):a}async _browseMedia(e,t,n){const a="object"==typeof t?t.media_content_id:t,i=n?.cache?n.cache.get(a):null;if(i)return i;const r={type:"media_source/browse_media",media_content_id:a},o=await $v(e,Av,r);if(n?.metadataGenerator)for(const e of o.children??[])e._metadata=n.metadataGenerator(e,"object"==typeof t?t:void 0)??void 0;return n?.cache&&n.cache.set(a,o,Ud(new Date,{seconds:60})),o}}function Dv(e,t){return bm(e,t)}function Rv(e,t){return e&&e.length?function(e,t){for(var n=-1,a=e.length,i=0,r=[];++nNv(t,e)))}add(e){this._ranges.push(e),this._ranges=Vv(this._ranges)}clear(){this._ranges=[]}}class Lv{constructor(e){this._ranges=e??[]}hasCoverage(e){const t=new Date;return this._ranges.some((n=>tet.start>=e.start&&t.end<=e.end,Fv=(e,t)=>e.start>=t.start&&e.start<=t.end||e.end>=t.start&&e.end<=t.end||e.start<=t.start&&e.end>=t.end,Vv=(e,t=0)=>{const n=[];e=Ev(e,(e=>e.start),"asc");let a=null;for(const i of e){const e=i.start instanceof Date?i.start.getTime():i.start;if(!a){a={...i};continue}(a.end instanceof Date?a.end.getTime():a.end)+1e3*t>=e?i.end>a.end&&(a.end=i.end):(n.push(a),a={...i})}return a&&n.push(a),n};class Hv{constructor(){this._data=[]}get(e){const t=new Date;for(const n of this._data)if((!n.expires||t<=n.expires)&&this._contains(e,n.request))return n.response;return null}clear(){this._data=[]}has(e){return!!this.get(e)}set(e,t,n){this._data.push({request:e,response:t,expires:n}),this._expireOldRequests()}_contains(e,t){return Dv(e,t)}_expireOldRequests(){const e=new Date;this._data=this._data.filter((t=>!t.expires||e=e.start.getTime()){if(a>e.end.getTime())break;t.push(n)}}return t}getSize(){return this._data.length}expireMatches(e){this._data=this._data.filter((t=>!e(t)))}}class Uv{constructor(){this._segments=new Map}add(e,t,n){let a=this._segments.get(e);a||(a=new qv((e=>1e3*e.start_time),(e=>e.id)),this._segments.set(e,a)),a.add(t,n)}clear(){this._segments.clear()}hasCoverage(e,t){return!!this._segments.get(e)?.hasCoverage(t)}get(e,t){return this._segments.get(e)?.get(t)??null}getSize(e){return this._segments.get(e)?.getSize()??null}getCameraIDs(){return[...this._segments.keys()]}expireMatches(e,t){this._segments.get(e)?.expireMatches(t)}}class Wv extends zs{}class Zv extends zs{}var Qv,Gv,Yv;!function(e){e.Event="event-query",e.Recording="recording-query",e.RecordingSegments="recording-segments-query",e.MediaMetadata="media-metadata"}(Qv||(Qv={})),function(e){e.Event="event-results",e.Recording="recording-results",e.RecordingSegments="recording-segments-results",e.MediaMetadata="media-metadata-results"}(Gv||(Gv={})),function(e){e.Frigate="frigate",e.Generic="generic",e.MotionEye="motioneye",e.Reolink="reolink"}(Yv||(Yv={}));const Kv=e=>e.camera_entity??e.webrtc_card?.entity??null;class Xv{constructor(e){this._entityRegistryManager=e}async createEngine(e,t){let n;switch(e){case Yv.Generic:const{GenericCameraManagerEngine:e}=await import("./engine-generic-97fdd47e.js").then((function(e){return e.e}));n=new e(t.stateWatcher,t.eventCallback);break;case Yv.Frigate:const{FrigateCameraManagerEngine:a}=await import("./engine-frigate-f675aa79.js");n=new a(this._entityRegistryManager,t.stateWatcher,new Uv,new Bv,t.eventCallback);break;case Yv.MotionEye:const{MotionEyeCameraManagerEngine:i}=await import("./engine-motioneye-7a5554b3.js");n=new i(this._entityRegistryManager,t.stateWatcher,new Ov,t.resolvedMediaCache,new Bv,t.eventCallback);break;case Yv.Reolink:const{ReolinkCameraManagerEngine:r}=await import("./engine-reolink-13b9bf20.js");n=new r(this._entityRegistryManager,t.stateWatcher,new Ov,t.resolvedMediaCache,new Bv,t.eventCallback)}return n}async getEngineForCamera(e,t){let n=null;if("frigate"===t.engine)n=Yv.Frigate;else if("motioneye"===t.engine)n=Yv.MotionEye;else if("generic"===t.engine)n=Yv.Generic;else if("reolink"===t.engine)n=Yv.Reolink;else{const a=Kv(t);if(a){const i=await this._entityRegistryManager.getEntity(e,a);if(!i){if(e.states[a])return Yv.Generic;throw new Wv(V_("error.no_camera_entity"),t)}switch(i?.platform){case"frigate":n=Yv.Frigate;break;case"motioneye":n=Yv.MotionEye;break;case"reolink":n=Yv.Reolink;break;default:n=Yv.Generic}}else t.frigate.camera_name?n=Yv.Frigate:(t.webrtc_card?.url||t.go2rtc?.url&&t.go2rtc?.stream)&&(n=Yv.Generic)}return n}}class Jv{constructor(){this._cameras=new Map,this._enginesByType=new Map}addCamera(e){this._cameras.set(e.getID(),e),this._enginesByType.set(e.getEngine().getEngineType(),e.getEngine())}async setCameras(e){for(const t of e){const e=this._cameras.get(t.getID());e!==t&&(this.addCamera(t),await(e?.destroy()))}for(const t of this._cameras.values())e.includes(t)||(await t.destroy(),this._cameras.delete(t.getID()))}async reset(){await tf(this._cameras.values(),(e=>e.destroy())),this._cameras.clear(),this._enginesByType.clear()}getCamera(e){return this._cameras.get(e)??null}getCameras(){return this._cameras}getCameraConfig(e){return this._cameras.get(e)?.getConfig()??null}hasCameraID(e){return this._cameras.has(e)}getCameraCount(){return this._cameras.size}getDefaultCameraID(){return this._cameras.keys().next().value??null}*getCameraConfigs(e){for(const[t,n]of this.getCameraConfigEntries(e))yield n}*getCameraConfigEntries(e){for(const t of e??this._cameras.keys()){const e=this.getCameraConfig(t);e&&(yield[t,e])}}getCameraIDs(){return new Set(this._cameras.keys())}getCameraIDsWithCapability(e){const t=new Set;for(const n of this._cameras.values())n.getCapabilities()?.matches(e)&&t.add(n.getID());return t}getCameraConfigForMedia(e){return this.getCameraConfig(e.getCameraID())}getEngineOfType(e){return this._enginesByType.get(e)??null}getEngineForCameraID(e){return this._cameras.get(e)?.getEngine()??null}getEnginesForCameraIDs(e){const t=new Map;for(const n of e){const e=this.getEngineForCameraID(n);e&&(t.has(e)||t.set(e,new Set),t.get(e)?.add(n))}return t.size?t:null}getEngineForMedia(e){return this.getEngineForCameraID(e.getCameraID())}getAllDependentCameras(e,t){const n=new Set,a=new Set,i=e=>{n.add(e);const r=this.getCamera(e),o=r?.getConfig();if(r&&o){t&&!r.getCapabilities()?.matches(t)||a.add(e);const s=new Set;o.dependencies.cameras.forEach((e=>s.add(e))),o.dependencies.all_cameras&&this.getCameraIDs().forEach((e=>s.add(e)));for(const e of s)n.has(e)||i(e)}};return i(e),a}}const ey=e=>{return Ev((n=e=>e.getID()??e,(t=e)&&t.length?Hg(t,xv(n)):[]),(e=>e.getStartTime()??e.getID()),"asc");var t,n};class ty{static isEventQuery(e){return e.type===Qv.Event}static isRecordingQuery(e){return e.type===Qv.Recording}static isRecordingSegmentsQuery(e){return e.type===Qv.RecordingSegments}static isMediaMetadataQuery(e){return e.type===Qv.MediaMetadata}}class ny{static isEventQueryResult(e){return e.type===Gv.Event}static isRecordingQueryResult(e){return e.type===Gv.Recording}static isRecordingSegmentsQueryResult(e){return e.type===Gv.RecordingSegments}static isMediaMetadataQueryResult(e){return e.type===Gv.MediaMetadata}}class ay{constructor(e,t){this._requestLimit=new w_,this._api=e,this._engineFactory=t?.factory??new Xv(this._api.getEntityRegistryManager()),this._store=t?.store??new Jv}async initializeCamerasFromConfig(){const e=this._api.getConfigManager().getConfig(),t=this._api.getHASSManager().getHASS();if(!e||!t)return!1;this._requestLimit.concurrency=e.performance.features.max_simultaneous_engine_requests??1/0;const n=e.cameras.map((t=>{return n={},a=u_(e?.cameras_global),hg(n,a,t,((e,t)=>Array.isArray(t)?t:void 0));var n,a}));try{await this._initializeCameras(n)}catch(e){return this._api.getMessageManager().setErrorIfHigherPriority(e,V_("error.camera_initialization")),!1}return!0}async reset(){await this._store.reset()}async _getEnginesForCameras(e){const t=new Map,n=new Map,a=this._api.getHASSManager().getHASS(); +/* istanbul ignore if: the if path cannot be reached -- @preserve */ +if(!a)return t;const i=await(async e=>await tf(e,(e=>this._engineFactory.getEngineForCamera(a,e))))(e);for(const[a,r]of e.entries()){const e=i[a],o=e?n.get(e)??await this._engineFactory.createEngine(e,{eventCallback:e=>this._api.getTriggersManager().handleCameraEvent(e),stateWatcher:this._api.getHASSManager().getStateWatcher(),resolvedMediaCache:this._api.getResolvedMediaCache()}):null;if(!o||!e)throw new Wv(V_("error.no_camera_engine"),u_(r));n.set(e,o),t.set(r,o)}return t}async _initializeCameras(e){const t=new Date,n=this._api.getHASSManager().getHASS(); +/* istanbul ignore if: the if path cannot be reached -- @preserve */ +if(!n)return;e.some((e=>(e=>e.triggers.motion||e.triggers.occupancy)(e)))&&await this._api.getEntityRegistryManager().fetchEntityList(n);const a=await this._getEnginesForCameras(e),i=await tf(a.entries(),(async([e,t])=>await t.createCamera(n,e))),r=async()=>{i.forEach((e=>e.destroy()))},o=new Set;for(const e of i){const t=H_(e.getConfig());if(!t)throw await r(),new Wv(V_("error.no_camera_id"),e.getConfig());if(o.has(t))throw await r(),new Wv(V_("error.duplicate_camera_id"),e.getConfig());e.setID(t),o.add(t)}await this._store.setCameras(i),B_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card CameraManager initialized (Cameras: ",this._store.getCameras(),`, Duration: ${((new Date).getTime()-t.getTime())/1e3}s,`,")")}isInitialized(){return this._store.getCameraCount()>0}getStore(){return this._store}generateDefaultEventQueries(e,t){return this._generateDefaultQueries(e,{type:Qv.Event,...t})}generateDefaultRecordingQueries(e,t){return this._generateDefaultQueries(e,{type:Qv.Recording,...t})}generateDefaultRecordingSegmentsQueries(e,t){return this._generateDefaultQueries(e,{type:Qv.RecordingSegments,...t})}_generateDefaultQueries(e,t){const n=[],a=Zg(e),i=this._store.getEnginesForCameraIDs(a);if(!i)return null;for(const[e,a]of i){let i=null; +/* istanbul ignore else: the else path cannot be reached -- @preserve */ty.isEventQuery(t)?i=e.generateDefaultEventQuery(this._store,a,t):ty.isRecordingQuery(t)?i=e.generateDefaultRecordingQuery(this._store,a,t):ty.isRecordingSegmentsQuery(t)&&(i=e.generateDefaultRecordingSegmentsQuery(this._store,a,t));for(const e of i??[])n.push(e)}return n.length?n:null}async getMediaMetadata(){const e=new Set,t=new Set,n=new Set,a=new Set,i={type:Qv.MediaMetadata,cameraIDs:this._store.getCameraIDs()},r=await this._handleQuery(i);for(const i of r.values())i.metadata.tags&&i.metadata.tags.forEach(e.add,e),i.metadata.what&&i.metadata.what.forEach(t.add,t),i.metadata.where&&i.metadata.where.forEach(n.add,n),i.metadata.days&&i.metadata.days.forEach(a.add,a);return t.size||n.size||a.size||e.size?{...e.size&&{tags:e},...t.size&&{what:t},...n.size&&{where:n},...a.size&&{days:a}}:null}async getEvents(e,t){return await this._handleQuery(e,t)}async getRecordings(e,t){return await this._handleQuery(e,t)}async getRecordingSegments(e,t){return await this._handleQuery(e,t)}async executeMediaQueries(e,t){return this._convertQueryResultsToMedia(await this._handleQuery(e,t))}async extendMediaQueries(e,t,n,a){if(!this._api.getHASSManager().getHASS())return null;const i=e=>{let n=null;for(const a of t){const t=a.getStartTime();t&&(!n||"earliest"===e&&tn)&&(n=t)}return n},r=this._api.getConfigManager().getCardWideConfig()?.performance?.features.media_chunk_size??50,o=[],s=[];for(const t of e){const e={...t}; +/* istanbul ignore else: the else path cannot be reached -- @preserve */if("later"===n){const t=i("latest");t&&(e.start=t,delete e.end)}else if("earlier"===n){const t=i("earliest");t&&(e.end=t,delete e.start)}e.limit=r,s.push({...t,limit:(t.limit??0)+r}),o.push(e)}const c=this._convertQueryResultsToMedia(await this._handleQuery(o,a));if(!c.length)return null;const l=ey(t.concat(c));return l.length===t.length?null:{queries:s,results:l}}async getMediaDownloadPath(e){const t=this._store.getCameraConfigForMedia(e),n=this._store.getEngineForMedia(e),a=this._api.getHASSManager().getHASS();return t&&n&&a?await n.getMediaDownloadPath(a,t,e):null}getMediaCapabilities(e){const t=this._store.getEngineForMedia(e);return t?t.getMediaCapabilities(e):null}async favoriteMedia(e,t){const n=this._store.getCameraConfigForMedia(e),a=this._store.getEngineForMedia(e),i=this._api.getHASSManager().getHASS();if(!n||!a||!i)return;const r=new Date;await this._requestLimit.add((()=>a.favoriteMedia(i,n,e,t))),B_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card CameraManager favorite request (",`Duration: ${((new Date).getTime()-r.getTime())/1e3}s,`,"Media:",e.getID(),", Favorite:",t,")")}areMediaQueriesResultsFresh(e,t){const n=new Date;for(const a of e){const e=this._store.getEnginesForCameraIDs(a.cameraIDs);for(const[i,r]of e??[]){const e=i.getQueryResultMaxAge({...a,cameraIDs:r});if(null!==e&&Ud(t,{seconds:e})a?null:await this._requestLimit.add((()=>i.getMediaSeekTime(r,this._store,e,t)))??null}async _handleQuery(e,t){const n=Wg(e),a=new Map,i=new Date,r=this._api.getHASSManager().getHASS();if(!r)return a;const o=async(e,n)=>{let i=null; +/* istanbul ignore else: the else path cannot be reached -- @preserve */ty.isEventQuery(n)?i=await e.getEvents(r,this._store,n,t):ty.isRecordingQuery(n)?i=await e.getRecordings(r,this._store,n,t):ty.isRecordingSegmentsQuery(n)?i=await e.getRecordingSegments(r,this._store,n,t):ty.isMediaMetadataQuery(n)&&(i=await e.getMediaMetadata(r,this._store,n,t)),i?.forEach(((e,t)=>a.set(t,e)))},s=async e=>{const t=this._store.getEnginesForCameraIDs(e.cameraIDs);t&&await Promise.all(Array.from(t.keys()).map((n=>this._requestLimit.add((()=>o(n,{...e,cameraIDs:t.get(n)}))))))};await Promise.all(n.map((e=>s(e))));const c=(l=Array.from(a.values()).map((e=>Number(e.cached??0))))&&l.length?function(e,t){for(var n,a=-1,i=e.length;++athis._store.getCamera(e))).filter(sf);return new Q_({live:t.some((e=>e.getCapabilities()?.has("live"))),clips:t.some((e=>e.getCapabilities()?.has("clips"))),recordings:t.some((e=>e.getCapabilities()?.has("recordings"))),snapshots:t.some((e=>e.getCapabilities()?.has("snapshots"))),"favorite-events":t.some((e=>e.getCapabilities()?.has("favorite-events"))),"favorite-recordings":t.some((e=>e.getCapabilities()?.has("favorite-recordings"))),seek:t.some((e=>e.getCapabilities()?.has("seek"))),menu:t.some((e=>e.getCapabilities()?.has("menu")))})}async executePTZAction(e,t,n){const a=this._store.getCameraConfig(e);if(!a)return;const i=q_(a,t,n);if(i)return await this._api.getActionsManager().executeActions(i);const r=this._api.getHASSManager().getHASS(),o=this._store.getEngineForCameraID(e);return o&&r?await this._requestLimit.add((()=>o.executePTZAction(r,a,t,n))):void 0}}class iy{constructor(e){this._cache=new Map,this._keyCallback=e}has(e){return this._cache.has(e)}getMatches(e){return[...this._cache.values()].filter(e)}get(e){return this._cache.get(e)??null}add(e){const t=e=>this._cache.set(this._keyCallback(e),e);Array.isArray(e)?e.forEach(t):t(e)}}const ry=ba.object({id:ba.string(),model:ba.string().nullable(),config_entries:ba.string().array(),manufacturer:ba.string().nullable()}).array();class oy{constructor(e){this._fetchedDeviceList=!1,this._cache=e}async getDevice(e,t){return this._cache.has(t)?this._cache.get(t):(await this._fetchDeviceList(e),this._cache.get(t)??null)}async getMatchingDevices(e,t){return await this._fetchDeviceList(e),this._cache.getMatches(t)}async _fetchDeviceList(e){if(this._fetchedDeviceList)return;let t=null;try{t=await $v(e,ry,{type:"config/device_registry/list"})}catch(e){return void Gg(e)}this._cache.add(t),this._fetchedDeviceList=!0}}const sy=ba.object({config_entry_id:ba.string().nullable(),device_id:ba.string().nullable(),disabled_by:ba.string().nullable(),entity_id:ba.string(),hidden_by:ba.string().nullable(),platform:ba.string(),translation_key:ba.string().nullable(),unique_id:ba.string().or(ba.number()).optional()}),cy=sy.array();class ly{constructor(e){this._fetchedEntityList=!1,this._cache=e}async getEntity(e,t){const n=this._cache.get(t);if(n)return n;let a=null;try{a=await $v(e,sy,{type:"config/entity_registry/get",entity_id:t})}catch(e){return Gg(e),null}return this._cache.add(a),a}async getMatchingEntities(e,t){return await this.fetchEntityList(e),this._cache.getMatches(t)}async getEntities(e,t){const n=new Map;return await Promise.all(t.map((async t=>{const a=await this.getEntity(e,t);a&&n.set(t,a)}))),n}async fetchEntityList(e){if(this._fetchedEntityList)return;let t=null;try{t=await $v(e,cy,{type:"config/entity_registry/list"})}catch(e){return void Gg(e)}this._cache.add(t),this._fetchedEntityList=!0}}class dy extends Map{constructor(e={}){if(super(),!(e.maxSize&&e.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");if("number"==typeof e.maxAge&&0===e.maxAge)throw new TypeError("`maxAge` must be a number greater than 0");this.maxSize=e.maxSize,this.maxAge=e.maxAge||Number.POSITIVE_INFINITY,this.onEviction=e.onEviction,this.cache=new Map,this.oldCache=new Map,this._size=0}_emitEvictions(e){if("function"==typeof this.onEviction)for(const[t,n]of e)this.onEviction(t,n.value)}_deleteIfExpired(e,t){return"number"==typeof t.expiry&&t.expiry<=Date.now()&&("function"==typeof this.onEviction&&this.onEviction(e,t.value),this.delete(e))}_getOrDeleteIfExpired(e,t){if(!1===this._deleteIfExpired(e,t))return t.value}_getItemValue(e,t){return t.expiry?this._getOrDeleteIfExpired(e,t):t.value}_peek(e,t){const n=t.get(e);return this._getItemValue(e,n)}_set(e,t){this.cache.set(e,t),this._size++,this._size>=this.maxSize&&(this._size=0,this._emitEvictions(this.oldCache),this.oldCache=this.cache,this.cache=new Map)}_moveToRecent(e,t){this.oldCache.delete(e),this._set(e,t)}*_entriesAscending(){for(const e of this.oldCache){const[t,n]=e;if(!this.cache.has(t)){!1===this._deleteIfExpired(t,n)&&(yield e)}}for(const e of this.cache){const[t,n]=e;!1===this._deleteIfExpired(t,n)&&(yield e)}}get(e){if(this.cache.has(e)){const t=this.cache.get(e);return this._getItemValue(e,t)}if(this.oldCache.has(e)){const t=this.oldCache.get(e);if(!1===this._deleteIfExpired(e,t))return this._moveToRecent(e,t),t.value}}set(e,t,{maxAge:n=this.maxAge}={}){const a="number"==typeof n&&n!==Number.POSITIVE_INFINITY?Date.now()+n:void 0;return this.cache.has(e)?this.cache.set(e,{value:t,expiry:a}):this._set(e,{value:t,expiry:a}),this}has(e){return this.cache.has(e)?!this._deleteIfExpired(e,this.cache.get(e)):!!this.oldCache.has(e)&&!this._deleteIfExpired(e,this.oldCache.get(e))}peek(e){return this.cache.has(e)?this._peek(e,this.cache):this.oldCache.has(e)?this._peek(e,this.oldCache):void 0}delete(e){const t=this.cache.delete(e);return t&&this._size--,this.oldCache.delete(e)||t}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}resize(e){if(!(e&&e>0))throw new TypeError("`maxSize` must be a number greater than 0");const t=[...this._entriesAscending()],n=t.length-e;n<0?(this.cache=new Map(t),this.oldCache=new Map,this._size=t.length):(n>0&&this._emitEvictions(t.slice(0,n)),this.oldCache=new Map(t.slice(n)),this.cache=new Map,this._size=0),this.maxSize=e}*keys(){for(const[e]of this)yield e}*values(){for(const[,e]of this)yield e}*[Symbol.iterator](){for(const e of this.cache){const[t,n]=e;!1===this._deleteIfExpired(t,n)&&(yield[t,n.value])}for(const e of this.oldCache){const[t,n]=e;if(!this.cache.has(t)){!1===this._deleteIfExpired(t,n)&&(yield[t,n.value])}}}*entriesDescending(){let e=[...this.cache];for(let t=e.length-1;t>=0;--t){const n=e[t],[a,i]=n;!1===this._deleteIfExpired(a,i)&&(yield[a,i.value])}e=[...this.oldCache];for(let t=e.length-1;t>=0;--t){const n=e[t],[a,i]=n;if(!this.cache.has(a)){!1===this._deleteIfExpired(a,i)&&(yield[a,i.value])}}}*entriesAscending(){for(const[e,t]of this._entriesAscending())yield[e,t.value]}get size(){if(!this._size)return this.oldCache.size;let e=0;for(const t of this.oldCache.keys())this.cache.has(t)||e++;return Math.min(this._size+e,this.maxSize)}entries(){return this.entriesAscending()}forEach(e,t=this){for(const[n,a]of this.entriesAscending())e.call(t,a,n,this)}get[Symbol.toStringTag](){return JSON.stringify([...this.entriesAscending()])}}class uy{constructor(){this._cache=new dy({maxSize:1e3})}has(e){return this._cache.has(e)}get(e){return this._cache.get(e)}set(e,t){this._cache.set(e,t)}}const hy=async(e,t,n)=>{const a=n?n.get(t):void 0;if(a)return a;const i={type:"media_source/resolve_media",media_content_id:t};let r=null;try{r=await $v(e,js,i)}catch(e){Gg(e)}return n&&r&&n.set(t,r),r};class py{constructor(e,t,n){this._context=e,this._action=t,this._config=n}async execute(e){}async stop(){}}class my extends py{}class gy extends my{async execute(e){const t=this._action.camera??(this._action.triggered?e.getTriggersManager().getMostRecentlyTriggeredCameraID():null),n=e.getViewManager().getView(),a=e.getConfigManager().getConfig();if(t&&n){const i=a?.view.camera_select??"current",r="current"===i?n.view:i;await e.getViewManager().setViewByParametersWithNewQuery({params:{view:r,camera:t},failSafe:!0})}}}class fy extends my{async execute(e){e.getCameraURLManager().openURL()}}class _y extends my{async execute(e){e.getViewManager().setViewDefault()}}class vy extends my{async execute(e){await e.getViewManager().setViewByParametersWithNewQuery({params:{displayMode:this._action.display_mode}})}}class yy extends my{async execute(e){await e.getDownloadManager().downloadViewerMedia()}}class by extends my{async execute(e){e.getExpandManager().toggleExpanded()}}class wy extends my{async execute(e){e.getFullscreenManager().toggleFullscreen()}}class xy extends py{async execute(e){const t=e.getHASSManager().getHASS();t&&at(e.getCardElementManager().getElement(),t,this._config??{},this._action)}}class Cy extends my{async execute(e){console[this._action.level](this._action.message)}}const My=(e,t)=>e.context?.live?.overrides?.get(t??e.camera)??t??e.camera,ky=e=>My(e)!==e.camera,Sy=(e,t)=>{const n=e.context?.live?.overrides??new Map;n.set(e.camera,t),e.mergeInContext({live:{overrides:n}})};class Ey extends my{async execute(e){const t=this._action.media_player,n=e.getMediaPlayerManager(),a=e.getViewManager().getView(),i=a?.queryResults?.getSelectedResult()??null;"stop"===this._action.media_player_action?await n.stop(t):a?.is("live")?await n.playLive(t,My(a)):a?.isViewerView()&&i&&await n.playMedia(t,i)}}class $y extends my{async execute(e){e.getCardElementManager().toggleMenu()}}class Ay extends my{async execute(e){await e.getMicrophoneManager().connect()}}class zy extends my{async execute(e){e.getMicrophoneManager().disconnect()}}class Iy extends my{async execute(e){e.getMicrophoneManager().mute()}}class Ty extends my{async execute(e){await e.getMicrophoneManager().unmute()}}class jy extends my{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.mute())}}class Oy extends my{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.pause())}}class Dy extends my{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.play())}}const Ry=(e,t)=>{if(e.isViewerView()){const n=e.queryResults?.getSelectedResult()?.getID()??null;return"ptz"!==t?.type&&n?{targetID:n,type:"digital"}:null}if(e.is("live")){const n=My(e);let a="digital";return"digital"!==t?.type&&t?.cameraManager&&(Py(t.cameraManager,n)&&(a="ptz"),"ptz"!==a&&"ptz"===t?.type)?null:{targetID:n,type:a}}return null},Py=(e,t)=>!!e.getStore().getCamera(t)?.getCapabilities()?.hasPTZCapability();var Ly=ug((function(e,t,n){Jm(e,t,n)}));const Ny=(e,t)=>{t?.[e]?.inProgressAction?.stop()},Fy=(e,t,n,a)=>{Ly(t,{[n]:{[e]:{inProgressAction:a}}})};class Vy extends my{constructor(){super(...arguments),this._timer=new xf}async stop(){this._timer.stop()}async execute(e){const t=e.getViewManager().getView();if(!t)return;const n=this._action.camera??Ry(t,{type:"ptz",cameraManager:e.getCameraManager()})?.targetID??null,a=n?e.getCameraManager().getCameraCapabilities(n)?.getPTZCapabilities():null,i=n?e.getCameraManager().getStore().getCameraConfig(n)?.ptz:null;if(!n||!a||!i)return;if(!this._action.ptz_action)return void(a.presets&&a.presets.length>=1&&await e.getCameraManager().executePTZAction(n,"preset",{phase:this._action.ptz_phase,preset:a.presets[0]}));const r=(e=>{switch(e){case"left":case"right":case"up":case"down":return e;case"zoom_in":return"zoomIn";case"zoom_out":return"zoomOut"}return null})(this._action.ptz_action);if(r&&a[r]?.includes(this._action.ptz_phase?"continuous":"relative")||"preset"===this._action.ptz_action)return await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{phase:this._action.ptz_phase,preset:this._action.ptz_preset});if("start"===this._action.ptz_phase){Ny(n,this._context.ptz),Fy(n,this._context,"ptz",this);const t=async()=>{this._action.ptz_action&&await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset}),this._timer.start(i.r2c_delay_between_calls_seconds,t)};await t()}else"stop"===this._action.ptz_phase?Ny(n,this._context.ptz):(await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset,phase:"start"}),this._timer.start(i.c2r_delay_between_calls_seconds,(async()=>{this._action.ptz_action&&await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset,phase:"stop"})})))}}class Hy extends my{async execute(e){e.getViewManager().setViewWithMergedContext({ptzControls:{enabled:this._action.enabled}})}}function By(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=Cg(n))==n?n:0),void 0!==t&&(t=(t=Cg(t))==t?t:0),function(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}(Cg(e),t,n)}const qy=50,Uy=50,Wy=1,Zy=4,Qy=e=>void 0===e?.pan?.x&&void 0===e?.pan?.y&&void 0===e?.zoom;class Gy{constructor(e){this._context=e}modify(e){e.mergeInContext(this._context)}}const Yy=(e,t)=>({zoom:{[e]:{observed:t?.observed??void 0,requested:t?.requested??null}}}),Ky=(e,t,n)=>{t&&n&&t.setViewByParameters({modifiers:[new Gy(Yy(n,{observed:e.detail}))]})};class Xy extends my{constructor(){super(...arguments),this._timer=new xf}async _stepChange(e,t){e.getViewManager().setViewWithMergedContext(Yy(t,{requested:this._convertActionToZoomSettings(e.getViewManager().getView()?.context?.zoom?.[t]?.observed)}))}async stop(){this._timer.stop()}async execute(e){const t=e.getViewManager().getView();if(!t)return;const n=this._action.target_id??Ry(t,{type:"digital",cameraManager:e.getCameraManager()})?.targetID;return n?this._action.absolute||!this._action.ptz_phase?await this._stepChange(e,n): +/* istanbul ignore else: the else path cannot be reached -- @preserve */ +void("start"===this._action.ptz_phase?(Ny(n,this._context.ptzDigital),Fy(n,this._context,"ptzDigital",this),await this._stepChange(e,n),this._timer.startRepeated(.1,(()=>this._stepChange(e,n)))):"stop"===this._action.ptz_phase&&(Ny(n,this._context.ptzDigital),delete this._context.ptzDigital?.[n])):void 0}_convertActionToZoomSettings(e){if(!this._action.absolute&&!this._action.ptz_action)return{};if(this._action.absolute)return this._action.absolute;const t=e?.zoom??1,n=e?.pan?.x??50,a=e?.pan?.y??50,i="zoom_in"===this._action.ptz_action?.1:"zoom_out"===this._action.ptz_action?-.1:0,r="left"===this._action.ptz_action?-5:"right"===this._action.ptz_action?5:0,o="up"===this._action.ptz_action?-5:"down"===this._action.ptz_action?5:0;return{zoom:By(t+i,1,10),pan:{x:By(n+r,0,100),y:By(a+o,0,100)}}}}class Jy extends my{async execute(e){const t=e.getViewManager().getView();let n=null,a=null;if(this._action.target_id)n=this._action.target_id,a=Py(e.getCameraManager(),n)?"ptz":"digital";else if(t){const i=Ry(t,{cameraManager:e.getCameraManager()});n=i?.targetID??null,a=i?.type??null}n&&null!==a&&("ptz"===a?this._toPTZAction(n):this._toPTZDigitalAction(n)).execute(e)}_toPTZAction(e){return new Vy(this._context,(t={cardID:this._action.card_id,cameraID:e,ptzAction:this._action.ptz_action,ptzPhase:this._action.ptz_phase,ptzPreset:this._action.ptz_preset},{action:"fire-dom-event",frigate_card_action:"ptz",...t?.cardID&&{card_id:t.cardID},...t?.ptzAction&&{ptz_action:t.ptzAction},...t?.ptzPhase&&{ptz_phase:t.ptzPhase},...t?.ptzPreset&&{ptz_preset:t.ptzPreset},...t?.cameraID&&{camera:t.cameraID}}),this._config);var t}_toPTZDigitalAction(e){return new Xy(this._context,(t={cardID:this._action.card_id,ptzPhase:this._action.ptz_phase,ptzAction:this._action.ptz_action,targetID:e},{action:"fire-dom-event",frigate_card_action:"ptz_digital",...t?.cardID&&{card_id:t.cardID},...t?.ptzAction&&{ptz_action:t.ptzAction},...t?.ptzPhase&&{ptz_phase:t.ptzPhase},...t?.absolute&&{absolute:t.absolute},...t?.targetID&&{target_id:t.targetID}}),this._config);var t}}class eb extends my{async execute(e){await e.getDownloadManager().downloadScreenshot()}}class tb extends my{async execute(e){var t;await af((t=this._action.duration,3600*(t.h??0)+60*(t.m??0)+(t.s??0)+(t.ms??0)/1e3))}}class nb extends my{async execute(e){switch(this._action.status_bar_action){case"reset":e.getStatusBarItemManager().removeAllDynamicStatusBarItems();break;case"add":this._action.items?.forEach((t=>e.getStatusBarItemManager().addDynamicStatusBarItem(t)));break;case"remove":this._action.items?.forEach((t=>e.getStatusBarItemManager().removeDynamicStatusBarItem(t)))}}}class ab{modify(e){(e=>{const t=e.context?.live?.overrides;t&&t.has(e.camera)&&e.context?.live?.overrides?.delete(e.camera)})(e)}}class ib extends my{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new ab]})}}class rb{constructor(e){this._api=e}modify(e){const t=[...this._api.getCameraManager().getStore().getAllDependentCameras(e.camera,"substream")];if(t.length<=1)return;const n=My(e),a=t.indexOf(n),i=a<0?0:(a+1)%t.length;Sy(e,t[i])}}class ob extends my{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new rb(e)]})}}class sb{constructor(e){this._substreamID=e}modify(e){Sy(e,this._substreamID)}}class cb extends my{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new sb(this._action.camera)]})}}class lb extends my{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.unmute())}}class db extends my{async execute(e){e.getViewManager().setViewByParametersWithNewQuery({params:{view:this._action.frigate_card_action}})}}class ub{createAction(e,t,n){const a=mf(t);if("fire-dom-event"!==t.action||!a)return new xy(e,t,n?.config);if(a.card_id&&a.card_id!==n?.cardID)return null;switch(a.frigate_card_action){case"default":return new _y(e,a,n?.config);case"clip":case"clips":case"image":case"live":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":case"diagnostics":return new db(e,a,n?.config);case"sleep":return new tb(e,a,n?.config);case"download":return new yy(e,a,n?.config);case"camera_ui":return new fy(e,a,n?.config);case"expand":return new by(e,a,n?.config);case"fullscreen":return new wy(e,a,n?.config);case"menu_toggle":return new $y(e,a,n?.config);case"camera_select":return new gy(e,a,n?.config);case"live_substream_select":return new cb(e,a,n?.config);case"live_substream_off":return new ib(e,a,n?.config);case"live_substream_on":return new ob(e,a,n?.config);case"media_player":return new Ey(e,a,n?.config);case"microphone_connect":return new Ay(e,a,n?.config);case"microphone_disconnect":return new zy(e,a,n?.config);case"microphone_mute":return new Iy(e,a,n?.config);case"microphone_unmute":return new Ty(e,a,n?.config);case"mute":return new jy(e,a,n?.config);case"unmute":return new lb(e,a,n?.config);case"play":return new Dy(e,a,n?.config);case"pause":return new Oy(e,a,n?.config);case"screenshot":return new eb(e,a,n?.config);case"display_mode_select":return new vy(e,a,n?.config);case"ptz":return new Vy(e,a,n?.config);case"ptz_digital":return new Xy(e,a,n?.config);case"ptz_multi":return new Jy(e,a,n?.config);case"ptz_controls":return new Hy(e,a,n?.config);case"log":return new Cy(e,a,n?.config);case"status_bar":return new nb(e,a,n?.config)} +/* istanbul ignore next: this path cannot be reached -- @preserve */ +/* istanbul ignore next: this path cannot be reached -- @preserve */ +return console.warn(`Frigate card received unknown card action: ${a.frigate_card_action}`),null}}class hb{constructor(e,t,n){this._actions=[],this._factory=new ub,this._stopped=!1,this._context=e;for(const a of Wg(t)){const t=this._factory.createAction(e,a,n);t&&this._actions.push(t)}}async execute(e){for(const t of this._actions){if(this._stopped)break;await t.execute(e)}}async stop(){this._stopped=!0}}const pb=ba.object({action:ba.enum(["tap","double_tap","hold","start_tap","end_tap"])}),mb=ba.object({detail:pb});class gb{constructor(e){this._actionsInFlight=[],this._actionContext={},this.handleInteractionEvent=e=>{const t=mb.safeParse(e);if(!t.success)return;const n=t.data.detail.action,a=this.getMergedActions(),i=yf(n,a);a&&n&&i&&this.executeActions(i,a)},this.handleCustomActionEvent=e=>{"detail"in e&&this.executeActions(e.detail)},this.handleActionExecutionRequestEvent=async e=>{await this.executeActions(e.detail.action,e.detail.config)},this._api=e}getMergedActions(){const e=this._api.getViewManager().getView();if(this._api.getMessageManager().hasMessage())return{};const t=this._api.getConfigManager().getConfig();let n;if(e?.is("live"))n=t?.live.actions;else if(e?.isGalleryView())n=t?.media_gallery?.actions;else if(e?.isViewerView())n=t?.media_viewer.actions;else{if(!e?.is("image"))return{};n=t?.image?.actions}return{...t?.view.actions,...n}}uninitialize(){this._actionsInFlight.forEach((e=>e.stop()))}async executeActions(e,t){const n=new hb(this._actionContext,e,{config:t,cardID:this._api.getConfigManager().getConfig()?.card_id});this._actionsInFlight.push(n),await n.execute(this._api),this._actionsInFlight=this._actionsInFlight.filter((e=>e!==n))}}class fb{constructor(e){this._automations=[],this._priorEvaluations=new Map,this._nestedAutomationExecutions=0,this._api=e}deleteAutomations(e){this._automations=this._automations.filter((t=>t.tag!==e))}addAutomations(e){this._automations.push(...e)}execute(){if(!this._api.getHASSManager().hasHASS()||!this._api.getInitializationManager().isInitializedMandatory()||this._api.getMessageManager().hasErrorMessage())return;const e=[];for(const t of this._automations){const n=this._api.getConditionsManager().evaluateConditions(t.conditions),a=n?t.actions:t.actions_not,i=this._priorEvaluations.get(t);this._priorEvaluations.set(t,n),n!==i&&a&&e.push(...a)}if(!e.length)return;(async e=>{++this._nestedAutomationExecutions,this._nestedAutomationExecutions>10?this._api.getMessageManager().setMessageIfHigherPriority({type:"error",message:V_("error.too_many_automations")}):(await this._api.getActionsManager().executeActions(e),--this._nestedAutomationExecutions)})(e)}}class _b{constructor(e){this._api=e}openURL(){const e=this.getCameraURL();e&&window.open(e)}hasCameraURL(){return!!this.getCameraURL()}getCameraURL(){const e=this._api.getViewManager().getView(),t=e?.queryResults?.getSelectedResult()??null,n=e?.camera?this._api.getCameraManager().getCameraEndpoints(e.camera,{view:e.view,...t&&{media:t}})??null:null;return n?.ui?.endpoint??null}}const vb=(e,t)=>!!((e.attributes.supported_features??0)&t),yb=e=>(e=>vb(e,4)&&"number"==typeof e.attributes.in_progress)(e)||!!e.attributes.in_progress,bb=e=>{switch(e){case"armed_away":return"mdi:shield-lock";case"armed_vacation":return"mdi:shield-airplane";case"armed_home":return"mdi:shield-home";case"armed_night":return"mdi:shield-moon";case"armed_custom_bypass":return"mdi:security";case"pending":case"arming":return"mdi:shield-sync";case"triggered":return"mdi:bell-ring";case"disarmed":return"mdi:shield-off";default:return"mdi:shield"}},wb=(e,t)=>{const n="off"===e;switch(t?.attributes.device_class){case"battery":return n?"mdi:battery":"mdi:battery-outline";case"battery_charging":return n?"mdi:battery":"mdi:battery-charging";case"cold":return n?"mdi:thermometer":"mdi:snowflake";case"connectivity":return n?"mdi:close-network-outline":"mdi:check-network-outline";case"door":return n?"mdi:door-closed":"mdi:door-open";case"garage_door":return n?"mdi:garage":"mdi:garage-open";case"power":case"plug":return n?"mdi:power-plug-off":"mdi:power-plug";case"gas":case"problem":case"safety":case"tamper":return n?"mdi:check-circle":"mdi:alert-circle";case"smoke":return n?"mdi:check-circle":"mdi:smoke";case"heat":return n?"mdi:thermometer":"mdi:fire";case"light":return n?"mdi:brightness5":"mdi:brightness-7";case"lock":return n?"mdi:lock":"mdi:lock-open";case"moisture":return n?"mdi:water-off":"mdi:water";case"motion":return n?"mdi:motion-sensor-off":"mdi:motion-sensor";case"occupancy":case"presence":return n?"mdi:home-outline":"mdi:home";case"opening":return n?"mdi:square":"mdi:square-outline";case"running":return n?"mdi:stop":"mdi:play";case"sound":return n?"mdi:music-note-off":"mdi:music-note";case"update":return n?"mdi:package":"mdi:package-up";case"vibration":return n?"mdi:crop-portrait":"mdi:vibrate";case"window":return n?"mdi:window-closed":"mdi:window-open";default:return n?"mdi:radiobox-blank":"mdi:checkbox-marked-circle"}},xb=(e,t)=>{const n="closed"!==e;switch(t?.attributes.device_class){case"garage":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:garage";default:return"mdi:garage-open"}case"gate":switch(e){case"opening":case"closing":return"mdi:gate-arrow-right";case"closed":return"mdi:gate";default:return"mdi:gate-open"}case"door":return n?"mdi:door-open":"mdi:door-closed";case"damper":return n?"md:circle":"mdi:circle-slice-8";case"shutter":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-shutter";default:return"mdi:window-shutter-open"}case"curtain":switch(e){case"opening":return"mdi:arrow-split-vertical";case"closing":return"mdi:arrow-collapse-horizontal";case"closed":return"mdi:curtains-closed";default:return"mdi:curtains"}case"blind":case"shade":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:blinds";default:return"mdi:blinds-open"}case"window":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-closed";default:return"mdi:window-open"}}switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-closed";default:return"mdi:window-open"}},Cb={apparent_power:"mdi:flash",aqi:"mdi:air-filter",carbon_dioxide:"mdi:molecule-co2",carbon_monoxide:"mdi:molecule-co",current:"mdi:current-ac",date:"mdi:calendar",energy:"mdi:lightning-bolt",frequency:"mdi:sine-wave",gas:"mdi:gas-cylinder",humidity:"mdi:water-percent",illuminance:"mdi:brightness-5",monetary:"mdi:cash",nitrogen_dioxide:"mdi:molecule",nitrogen_monoxide:"mdi:molecule",nitrous_oxide:"mdi:molecule",ozone:"mdi:molecule",pm1:"mdi:molecule",pm10:"mdi:molecule",pm25:"mdi:molecule",power:"mdi:flash",power_factor:"mdi:angle-acute",pressure:"mdi:gauge",reactive_power:"mdi:flash",signal_strength:"mdi:wifi",sulphur_dioxide:"mdi:molecule",temperature:"mdi:thermometer",timestamp:"mdi:clock",volatile_organic_compounds:"mdi:molecule",voltage:"mdi:sine-wave"},Mb={10:"mdi:battery-10",20:"mdi:battery-20",30:"mdi:battery-30",40:"mdi:battery-40",50:"mdi:battery-50",60:"mdi:battery-60",70:"mdi:battery-70",80:"mdi:battery-80",90:"mdi:battery-90",100:"mdi:battery"},kb={10:"mdi:battery-charging-10",20:"mdi:battery-charging-20",30:"mdi:battery-charging-30",40:"mdi:battery-charging-40",50:"mdi:battery-charging-50",60:"mdi:battery-charging-60",70:"mdi:battery-charging-70",80:"mdi:battery-charging-80",90:"mdi:battery-charging-90",100:"mdi:battery-charging"},Sb=(e,t)=>{const n=Number(e);if(isNaN(n))return"off"===e?"mdi:battery":"on"===e?"mdi:battery-alert":"mdi:battery-unknown";const a=10*Math.round(n/10);return t&&n>=10?kb[a]:t?"mdi:battery-charging-outline":n<=5?"mdi:battery-alert-variant-outline":Mb[a]},Eb=e=>{const t=e?.attributes.device_class;if(t&&t in Cb)return Cb[t];if("battery"===t)return e?((e,t)=>{const n=e.state;return Sb(n,"on"===t?.state)})(e):"mdi:battery";const n=e?.attributes.unit_of_measurement;return"°C"===n||"°F"===n?"mdi:thermometer":void 0},$b="mdi:bookmark",Ab={alert:"mdi:alert",air_quality:"mdi:air-filter",automation:"mdi:robot",calendar:"mdi:calendar",camera:"mdi:video",climate:"mdi:thermostat",configurator:"mdi:cog",conversation:"mdi:text-to-speech",counter:"mdi:counter",fan:"mdi:fan",google_assistant:"mdi:google-assistant",group:"mdi:google-circles-communities",homeassistant:"mdi:home-assistant",homekit:"mdi:home-automation",image_processing:"mdi:image-filter-frames",input_button:"mdi:gesture-tap-button",input_datetime:"mdi:calendar-clock",input_number:"mdi:ray-vertex",input_select:"mdi:format-list-bulleted",input_text:"mdi:form-textbox",light:"mdi:lightbulb",mailbox:"mdi:mailbox",notify:"mdi:comment-alert",number:"mdi:ray-vertex",persistent_notification:"mdi:bell",person:"mdi:account",plant:"mdi:flower",proximity:"mdi:apple-safari",remote:"mdi:remote",scene:"mdi:palette",script:"mdi:script-text",select:"mdi:format-list-bulleted",sensor:"mdi:eye",siren:"mdi:bullhorn",simple_alarm:"mdi:bell",sun:"mdi:white-balance-sunny",timer:"mdi:timer-outline",updater:"mdi:cloud-upload",vacuum:"mdi:robot-vacuum",water_heater:"mdi:thermometer",weather:"mdi:weather-cloudy",zone:"mdi:map-marker-radius"};function zb(e,t,n,a){switch(e){case"alarm_control_panel":return bb(n);case"binary_sensor":return wb(n,t);case"button":switch(t?.attributes.device_class){case"restart":return"mdi:restart";case"update":return"mdi:package-up";default:return"mdi:gesture-tap-button"}case"cover":return xb(n,t);case"device_tracker":return"router"===t?.attributes.source_type?"home"===n?"mdi:lan-connect":"mdi:lan-disconnect":["bluetooth","bluetooth_le"].includes(t?.attributes.source_type)?"home"===n?"mdi:bluetooth-connect":"mdi:bluetooth":"not_home"===n?"mdi:account-arrow-right":"mdi:account";case"humidifier":return n&&"off"===n?"mdi:air-humidifier-off":"mdi:air-humidifier";case"input_boolean":return"on"===n?"mdi:check-circle-outline":"mdi:close-circle-outline";case"lock":switch(n){case"unlocked":return"mdi:lock-open";case"jammed":return"mdi:lock-alert";case"locking":case"unlocking":return"mdi:lock-clock";default:return"mdi:lock"}case"media_player":switch(t?.attributes.device_class){case"speaker":switch(n){case"playing":return"mdi:speaker-play";case"paused":return"mdi:speaker-pause";case"off":return"mdi:speaker-off";default:return"mdi:speaker"}case"tv":switch(n){case"playing":return"mdi:television-play";case"paused":return"mdi:television-pause";case"off":return"mdi:television-off";default:return"mdi:television"}default:switch(n){case"playing":case"paused":return"mdi:cast-connected";case"off":return"mdi:cast-off";default:return"mdi:cast"}}case"switch":switch(t?.attributes.device_class){case"outlet":return"on"===n?"mdi:power-plug":"mdi:power-plug-off";case"switch":return"on"===n?"mdi:toggle-switch":"mdi:toggle-switch-off";default:return"mdi:flash"}case"zwave":switch(n){case"dead":return"mdi:emoticon-dead";case"sleeping":return"mdi:sleep";case"initializing":return"mdi:timer-sand";default:return"mdi:z-wave"}case"sensor":{const e=Eb(t);if(e)return e;break}case"input_datetime":if(!t?.attributes.has_date)return"mdi:clock";if(!t.attributes.has_time)return"mdi:calendar";break;case"sun":return"above_horizon"===t?.state?Ab[e]:"mdi:weather-night";case"update":return"on"===t?.state?yb(t)?"mdi:package-down":"mdi:package-up":"mdi:package"}return e in Ab?Ab[e]:a??$b}async function Ib(e,t,n){const a={type:"auth/sign_path",path:t,expires:n},i=await $v(e,Os,a);return i?e.hassUrl(i.path):null}function Tb(e,t,n,a){if(!e||!n||!n.length)return[];const i=[];for(const r of n){const n=t?.states[r],o=e.states[r];if((a?.stateOnly&&n?.state!==o?.state||!a?.stateOnly&&n!==o)&&(i.push({entityID:r,oldState:n,newState:o}),a?.firstOnly))break}return i}function jb(e,t,n,a){return!!Tb(e,t,n,{...a,firstOnly:!0}).length}function Ob(e){if("off"===e.state||!e.attributes.brightness)return"";return`brightness(${(e.attributes.brightness+245)/5}%)`}function Db(e){return"off"===e.state?"":e.attributes.rgb_color?`rgb(${e.attributes.rgb_color.join(",")})`:""}function Rb(e){return{color:Db(e),filter:Ob(e)}}function Pb(e,t){if(!t.entity)return t;const n=e.states[t.entity];n&&t.state_color&&(t.style={...Rb(n),...t.style}),t.title=t.title??(n?.attributes?.friendly_name||t.entity),t.icon=t.icon??Nb(e,t.entity);const a=n?function(e){return Ye(e.entity_id)}(n):void 0;return t.data_domain=t.state_color||"light"===a&&!1!==t.state_color?a:void 0,n&&(t.data_state=(e=>{const t=e.entity_id.split(".")[0];let n=e.state;return"climate"===t&&(n=e.attributes.hvac_action),n})(n)),t}function Lb(e,t){return t?e?.states[t]?.attributes?.friendly_name:void 0}function Nb(e,t,n){const a=e.states[t];return a&&a.attributes.icon?a.attributes.icon:zb(Ye(t),a,a?.state,n)}const Fb=async()=>{if(["ha-button-menu","ha-button","ha-camera-stream","ha-card","ha-circular-progress","ha-hls-player","ha-icon-button","ha-icon","ha-menu-button","ha-selector","ha-web-rtc-player"].every((e=>customElements.get(e))))return!0;const e=await window.loadCardHelpers();await e.createCardElement({type:"picture-glance",entities:[],camera_image:"dummy-to-load-editor-components"}),await customElements.whenDefined("hui-picture-glance-card");const t=customElements.get("hui-picture-glance-card");if(!t)return!1;const n=new t;return await n.constructor.getConfigElement(),!0},Vb=e=>!!e&&["on","open"].includes(e),Hb=(e,t)=>{if(!e)return[];const n=Object.keys(e.states).filter((e=>!t||e.substr(0,e.indexOf("."))===t));return n.sort(),n};function Bb(e){return!!e?.startsWith("/")}function qb(e,t){return Bb(t)?e.hassUrl(t):t??null}class Ub{constructor(){this._initialized=new Set}async initializeMultipleIfNecessary(e){return(await tf(Object.entries(e),(async([e,t])=>await this.initializeIfNecessary(e,t)))).every(Boolean)}async initializeIfNecessary(e,t){return!!this._initialized.has(e)||(t?!!await t()&&(this._initialized.add(e),!0):(this._initialized.add(e),!0))}uninitialize(e){this._initialized.delete(e)}isInitialized(e){return this._initialized.has(e)}isInitializedMultiple(e){return e.every((e=>this.isInitialized(e)))}}var Wb;!function(e){e.LANGUAGES="languages",e.SIDE_LOAD_ELEMENTS="side-load-elements",e.CAMERAS="cameras",e.MICROPHONE_CONNECT="microphone-connect",e.VIEW="view"}(Wb||(Wb={}));class Zb{constructor(e,t){this._initializationQueue=new w_({concurrency:1}),this._everInitialized=!1,this._api=e,this._initializer=t??new Ub}wasEverInitialized(){return this._everInitialized}isInitializedMandatory(){return!!this._api.getConfigManager().getConfig()&&this._initializer.isInitializedMultiple([Wb.LANGUAGES,Wb.SIDE_LOAD_ELEMENTS,Wb.CAMERAS,...this._api.getMicrophoneManager().shouldConnectOnInitialization()?[Wb.MICROPHONE_CONNECT]:[],Wb.VIEW])}async initializeMandatory(){await this._initializationQueue.add((()=>this._initializeMandatory()))}async _initializeMandatory(){const e=this._api.getHASSManager().getHASS();if(!e||this.isInitializedMandatory())return;if(!await this._initializer.initializeMultipleIfNecessary({[Wb.LANGUAGES]:async()=>await(async e=>{const t=F_(e);return"ca"===t?L_[t]=await import("./lang-ca-449daa4a.js"):"it"===t?L_[t]=await import("./lang-it-2a20a319.js"):"pt"===t?L_[t]=await import("./lang-pt-PT-c4863423.js"):"pt_BR"===t?L_[t]=await import("./lang-pt-BR-83a703b9.js"):"fr"===t&&(L_[t]=await import("./lang-fr-674e5de5.js")),t&&(N_=t),!0})(e),[Wb.SIDE_LOAD_ELEMENTS]:async()=>await Fb()}))return;this._api.getConfigManager().getConfig()&&await this._initializer.initializeMultipleIfNecessary({[Wb.CAMERAS]:async()=>await this._api.getCameraManager().initializeCamerasFromConfig(),...this._api.getMicrophoneManager().shouldConnectOnInitialization()&&{[Wb.MICROPHONE_CONNECT]:async()=>await this._api.getMicrophoneManager().connect()}})&&!this._api.getMessageManager().hasMessage()&&await this._initializer.initializeIfNecessary(Wb.VIEW,this._api.getViewManager().initialize)&&(this._everInitialized=!0,this._api.getCardElementManager().update())}uninitialize(e){this._initializer.uninitialize(e)}}class Qb{constructor(e,t,n,a){this.update=()=>{this._element.requestUpdate()},this._api=e,this._element=t,this._scrollCallback=n,this._menuToggleCallback=a}getElement(){return this._element}scrollReset(){this._scrollCallback()}toggleMenu(){this._menuToggleCallback()}hasUpdated(){return this._element.hasUpdated}elementConnected(){this._api.getInteractionManager().initialize(),this._api.getFullscreenManager().initialize(),this._api.getExpandManager().initialize(),this._api.getMediaLoadedInfoManager().initialize(),this._api.getMicrophoneManager().initialize(),this._api.getKeyboardStateManager().initialize(),this._api.getDefaultManager().initialize(),this._api.getMediaPlayerManager().initialize(),this._api.getHASSManager().getStateWatcher()?.subscribe(this.update,[...this._api.getConfigManager().getConfig()?.view.render_entities??[],...this._api.getMediaPlayerManager().getMediaPlayers()??[]]),of(this._element,(e=>{const t=e.getRootNode();return!!(t&&t instanceof ShadowRoot&&"HUI-PANEL-VIEW"===t.host.tagName)})(this._element),"panel"),of(this._element,!0,"tabindex","0"),this._api.getFullscreenManager().connect(),this._element.addEventListener("mousemove",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("wheel",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("ll-custom",this._api.getActionsManager().handleCustomActionEvent),this._element.addEventListener("action",this._api.getActionsManager().handleInteractionEvent),this._element.addEventListener("action",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("frigate-card:action:execution-request",this._api.getActionsManager().handleActionExecutionRequestEvent),window.addEventListener("location-changed",this._api.getQueryStringManager().requestExecution),window.addEventListener("popstate",this._api.getQueryStringManager().requestExecution),this._api.getQueryStringManager().requestExecution(),this._element.requestUpdate()}elementDisconnected(){of(this._element,!1,"panel"),of(this._element,!1,"tabindex"),this._api.getMediaLoadedInfoManager().clear(),this._api.getFullscreenManager().disconnect(),this._api.getKeyboardStateManager().uninitialize(),this._api.getActionsManager().uninitialize(),this._api.getDefaultManager().uninitialize(),this._api.getHASSManager().getStateWatcher()?.unsubscribe(this.update),this._api.getInitializationManager().uninitialize(Wb.CAMERAS),this._api.getCameraManager().reset(),this._element.removeEventListener("mousemove",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("wheel",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("ll-custom",this._api.getActionsManager().handleCustomActionEvent),this._element.removeEventListener("action",this._api.getActionsManager().handleInteractionEvent),this._element.removeEventListener("action",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("frigate-card:action:execution-request",this._api.getActionsManager().handleActionExecutionRequestEvent),window.removeEventListener("location-changed",this._api.getQueryStringManager().requestExecution),window.removeEventListener("popstate",this._api.getQueryStringManager().requestExecution)}}function Gb(e,t,n){return null==e?e:function(e,t,n,a){if(!hh(e))return e;for(var i=-1,r=(t=sv(t,e)).length,o=r-1,s=e;null!=s&&++i{Gb(e,t,n)},Xb=(e,t,n)=>fv(e,t,n),Jb=(e,t)=>{!function(e,t){null==e||Yb(e,t)}(e,t)},ew=e=>u_(e),tw=(e,t)=>e.replace("#",`[${t.toString()}]`),nw=function(e){let t=!1;for(let n=0;n{const i=Xb(e,t);if(void 0===i)return!1;const r=a?.transform?a.transform(i):i;return!(t===n&&Dv(i,r)||(null===r?a?.keepOriginal||(Jb(e,t),0):void 0===r||(a?.keepOriginal||Jb(e,t),Kb(e,n,r),0)))})(a,e,t,n)}},rw=function(e,t,n){return function(a){let i=iw(e,t,n)(a);return i=cw(bs,iw(e,t,n),(e=>e.overrides))(a)||i,i}},ow=function(e,t){return rw(e,e,{transform:t})},sw=function(e){return rw(e,e,{transform:e=>null})},cw=function(e,t,n){return function(a){let i=!1;const r=Xb(a,e);return Array.isArray(r)&&r.forEach((e=>{const a=n?n(e):e;a&&"object"==typeof a&&(i=t(a)||i)})),i}},lw=(e,t)=>{const n=a=>{let i=!1;if(a&&"object"==typeof a){const r=t?t(a):a;r&&(i=e(r)||i),Array.isArray(a)?a.forEach((e=>{i=n(e)||i})):Object.keys(a).forEach((e=>{i=n(a[e])||i}))}return i};return n},dw=e=>!("object"!=typeof e||!e||void 0===e.mediaLoaded)&&(e.media_loaded=e.mediaLoaded,delete e.mediaLoaded,!0),uw=e=>{if("object"!=typeof e||!e||"object"!=typeof e.conditions||!e.conditions)return!1;const t=e.conditions,n=[];if(void 0!==t.view&&n.push({condition:"view",views:t.view}),void 0!==t.fullscreen&&n.push({condition:"fullscreen",fullscreen:t.fullscreen}),void 0!==t.expand&&n.push({condition:"expand",expand:t.expand}),void 0!==t.camera&&n.push({condition:"camera",cameras:t.camera}),void 0!==t.media_loaded&&n.push({condition:"media_loaded",media_loaded:t.media_loaded}),void 0!==t.state&&Array.isArray(t.state))for(const e of t.state)"object"!=typeof e||!e||void 0===e.state&&void 0===e.state_not&&void 0===e.entity||n.push({condition:"state",...e.state&&{state:e.state},...e.state_not&&{state_not:e.state_not},...e.entity&&{entity:e.entity}});return void 0!==t.media_query&&n.push({condition:"screen",media_query:t.media_query}),!!n.length&&(e.conditions=n,!0)},hw=e=>!("object"!=typeof e||!e||"call-service"!==e.action||"string"!=typeof e.service)&&(e.action="perform-action",e.perform_action=e.service,delete e.service,!0),pw=e=>!("object"!=typeof e||!e||"call-service"!==e.action||void 0===e.service||void 0===e.service_data||void 0!==e.data)&&(e.data=e.service_data,delete e.service_data,!0),mw=e=>!("object"!=typeof e||!e||"custom:frigate-card-action"!==e.action||"frigate_ui"!==e.frigate_card_action)&&(e.frigate_card_action="camera_ui",!0),gw=[cw(bs,dw,(e=>e.conditions)),e=>lw(dw,(e=>e.conditions))("object"==typeof e&&e?e[Ii]:{}),rw("event_gallery",or),rw("menu.buttons.frigate_ui",is),e=>lw(mw)("object"==typeof e&&e?e:{}),cw(Ca,ow("live_provider",(e=>"frigate-jsmpeg"===e?"jsmpeg":e))),rw("live.jsmpeg",ki),rw("live.image",Ci),rw("live.webrtc_card",Si),cw(Ca,rw("frigate.zone","frigate.zones",{transform:e=>Wg(e)})),cw(Ca,rw("frigate.label","frigate.labels",{transform:e=>Wg(e)})),e=>lw(pw)("object"==typeof e&&e?e:{}),function(e){if("object"!=typeof e||!e||!(Ii in e)||!Array.isArray(e[Ii]))return!1;let t=!1;const n=n=>{if(!t){if(!fv(e,"live.controls.ptz")){const{type:t,...a}=n;Gb(e,"live.controls.ptz",a)}t=!0}},a=e=>{const t=[];for(const i of e)if("custom:frigate-card-ptz"===i.type)n(i);else if("conditional"!==i.type&&"custom:frigate-card-conditional"!==i.type||!Array.isArray(i.elements))t.push(i);else{const e=a(i.elements);e.length&&(i.elements=e,t.push(i))}return t},i=a(e[Ii]);return t&&(i.length?e[Ii]=i:delete e[Ii]),t},rw("view.timeout_seconds",Ri),ow("live.lazy_unload",(e=>"all"===e?["unselected","hidden"]:"never"===e?null:Wg(e))),ow("live.auto_play",(e=>"all"===e?null:"never"===e?[]:Wg(e))),ow("live.auto_pause",(e=>"all"===e?["unselected","hidden"]:"never"===e?null:Wg(e))),ow("live.auto_mute",(e=>"all"===e?null:"never"===e?[]:Wg(e))),ow("live.auto_unmute",(e=>"all"===e?["selected","visible","microphone"]:"never"===e?null:Wg(e))),ow("media_viewer.auto_play",(e=>"all"===e?null:"never"===e?[]:Wg(e))),ow("media_viewer.auto_pause",(e=>"all"===e?null:"never"===e?[]:Wg(e))),ow("media_viewer.auto_mute",(e=>"all"===e?null:"never"===e?[]:Wg(e))),ow("media_viewer.auto_unmute",(e=>"all"===e?["selected","visible"]:"never"===e?null:Wg(e))),rw("live.controls.thumbnails.media",io),rw("timeline.media",Ho),rw("live.controls.timeline.media",po),rw("media_viewer.controls.timeline.media",Rr),rw("view.scan",Xi),rw("view.triggers.enabled",ar,{transform:e=>!0===e?"live":null,keepOriginal:!0}),rw("view.triggers.enabled",er,{transform:e=>!0!==e&&null}),rw("view.triggers.untrigger_reset",ir,{transform:e=>e?"default":null}),rw("live.layout",Ai),sw("media_viewer.layout"),sw("image.layout"),cw(bs,uw),e=>lw(uw)("object"==typeof e&&e?e[Ii]:{}),e=>lw(uw)("object"==typeof e&&e?e.automations:{}),cw(Ca,rw("hide","capabilities",{transform:e=>!0===e?{disable_except:["substream"]}:null})),rw("performance.profile",$s,{transform:e=>"low"===e?["low-performance"]:null}),cw(bs,iw("overrides","merge")),rw("live.controls.ptz",zi,{transform:e=>{if("object"!=typeof e||!e)return;const t=["data_left","data_right","data_up","data_down","data_zoom_in","data_zoom_out","service"],n=["actions_left","actions_right","actions_up","actions_down","actions_zoom_in","actions_zoom_out"],a=[...t,...n,"data_home","actions_home"];if(!Object.keys(e).some((e=>a.includes(e))))return;const i={};t.filter((t=>t in e)).reduce(((t,n)=>(t[n]=e[n],t)),i),n.filter((t=>t in e)).reduce(((t,n)=>("object"==typeof e[n]&&"tap_action"in e[n]&&(t[n]=e[n].tap_action),t)),i);const r=()=>{i.presets="presets"in e&&"object"==typeof e.presets&&e.presets?e.presets:{}};return"actions_home"in e&&"object"==typeof e.actions_home&&e.actions_home&&"tap_action"in e.actions_home?(r(),i.presets.home=e.actions_home.tap_action):"data_home"in e&&"object"==typeof e.data_home&&e.data_home&&"string"==typeof e.service&&(r(),i.presets.service=e.service,i.presets.data_home=e.data_home),i},keepOriginal:!0}),ow("live.controls.ptz",(e=>{if("object"!=typeof e||!e)return e;const t=["mode","position","orientation","hide_pan_tilt","hide_zoom","hide_home","style"],n=Object.keys(e);return n.some((e=>!t.includes(e)))?n.filter((e=>t.includes(e))).reduce(((t,n)=>(t[n]=e[n],t)),{}):void 0})),rw("view.update_cycle_camera",Wi),rw("view.update_force",Qi,{transform:e=>!0===e?"all":null}),rw("view.update_seconds",Gi),rw("view.update_entities",Yi),iw("live.controls.title",ds,{transform:e=>"object"==typeof e&&e&&"string"==typeof e.mode?"none"===e.mode?{style:"none"}:e.mode.includes("bottom")?{position:"bottom"}:e.mode.includes("top")?{position:"top"}:null:null}),sw("live.controls.title"),sw("media_viewer.controls.title"),e=>lw(hw)("object"==typeof e&&e?e:{}),rw("dimensions.max_height",ys),sw("dimensions.min_height")];class fw extends zs{}class _w extends Event{constructor(e,t){super("frigate-card:conditions:evaluate",t),this.conditions=e}}function vw(e,t,n){let a=ew(t),i=!1;if(n?.configOverrides)for(const t of n.configOverrides)e.evaluateConditions(t.conditions,n?.stateOverrides)&&(t.delete?.forEach((e=>{Jb(a,e)})),Object.keys(t.set??{}).forEach((e=>{Kb(a,e,t.set?.[e])})),Object.keys(t.merge??{}).forEach((e=>{Kb(a,e,Ly({},Xb(a,e),t.merge?.[e]))})),i=!0);if(!i)return t;if(n?.configOverrides?.some((e=>e.delete?.length))&&(a=hf(a)),n?.schema){const e=n.schema.safeParse(a);if(!e.success)throw new fw(V_("error.invalid_configuration_override"),[e.error.errors,a]);return e.data}return a}class yw{constructor(e,t){this._state={},this._epoch=this._createEpoch(),this._hasHAStateConditions=!1,this._mediaQueries=[],this._mediaQueryTrigger=()=>this._triggerChange(),this._api=e,this._listeners=[()=>this._api.getConfigManager().computeOverrideConfig(),()=>this._api.getAutomationsManager().execute(),...t?[t]:[]]}removeConditions(){this._mediaQueries.forEach((e=>e.removeEventListener("change",this._mediaQueryTrigger))),this._mediaQueries=[]}setConditionsFromConfig(){this.removeConditions();const e=(()=>{const e=this._api.getConfigManager().getConfig(),t=[];e?.overrides?.forEach((e=>t.push(...e.conditions))),e?.automations?.forEach((e=>t.push(...e.conditions)));const n=e=>{const a=vl.safeParse(e);a.success?(t.push(...a.data.conditions),a.data.elements?.forEach(n)):e&&"object"==typeof e&&Object.keys(e).forEach((t=>n(e[t])))};return e?.elements?.forEach(n),t})();this._hasHAStateConditions=e.some((e=>!e.condition||["state","numeric_state","user"].includes(e.condition))),e.forEach((e=>{if("screen"===e.condition){const t=window.matchMedia(e.media_query);t.addEventListener("change",this._mediaQueryTrigger),this._mediaQueries.push(t)}}))}setState(e){Object.keys(e).every((t=>Dv(e[t],this._state[t])))||(this._state={...this._state,...e},this._triggerChange())}getState(){return this._state}hasHAStateConditions(){return this._hasHAStateConditions}getEpoch(){return this._epoch}evaluateConditions(e,t){return e.every((e=>this._evaluateCondition(e,t)))}_evaluateCondition(e,t){const n={...this._state,...t};switch(e.condition){case void 0:case"state":return!!n.state&&(!e.state&&!e.state_not||e.entity in n.state&&(!e.state||(Array.isArray(e.state)?e.state.includes(n.state[e.entity].state):e.state===n.state[e.entity].state))&&(!e.state_not||(Array.isArray(e.state_not)?!e.state_not.includes(n.state[e.entity].state):e.state_not!==n.state[e.entity].state)));case"view":return!!n?.view&&e.views.includes(n.view);case"fullscreen":return void 0!==n.fullscreen&&e.fullscreen===n.fullscreen;case"expand":return void 0!==n.expand&&e.expand===n.expand;case"camera":return!!n.camera&&e.cameras.includes(n.camera);case"numeric_state":return!!n.state&&e.entity in n.state&&void 0!==n.state[e.entity].state&&(void 0===e.above||Number(n.state[e.entity].state)>e.above)&&(void 0===e.below||Number(n.state[e.entity].state)n.triggered?.has(e)));case"interaction":return void 0!==n.interaction&&e.interaction===n.interaction;case"microphone":return!(void 0!==e.connected&&n.microphone?.connected!==e.connected||void 0!==e.muted&&n.microphone?.muted!==e.muted);case"key":return!(!n.keys||!(e.key in n.keys)||(e.state??"down")!==n.keys[e.key].state||void 0!==e.ctrl&&e.ctrl!==!!n.keys[e.key].ctrl||void 0!==e.alt&&e.alt!==!!n.keys[e.key].alt||void 0!==e.meta&&e.meta!==!!n.keys[e.key].meta||void 0!==e.shift&&e.shift!==!!n.keys[e.key].shift)}}_createEpoch(){return{manager:this}}_triggerChange(){this._epoch=this._createEpoch(),this._listeners.forEach((e=>e()))}}const bw={casting:{[Qr]:!1,[Sr]:!1,[es]:"none",[`${os}.enabled`]:!0,[`${ss}.enabled`]:!0,[`${rs}.enabled`]:!1,[`${cs}.enabled`]:!1,[Zr]:["selected","visible"],[vs]:"static",[_s]:"16:9",[$i]:1,[$o]:!0},"low-performance":{[ro]:"none",[Ar]:"none",[Uo]:"none",[fo]:!1,[Nr]:!1,[Bo]:!1,[Wr]:[],[mr]:[],[gr]:[],[fr]:[],[ko]:["unselected","hidden"],[Co]:!1,[xr]:!1,[Eo]:"none",[kr]:"none",[$o]:!1,[Er]:"chevrons",[hs]:"none",[es]:"outside",[`${as}.enabled`]:!1,[`${ls}.enabled`]:!1,[`${ls}.enabled`]:!1,[`${cs}.enabled`]:!1,[lr]:!1,[dr]:!1,[ur]:!1,[cr]:!1,[co]:!1,[lo]:!1,[uo]:!1,[so]:!1,[Ir]:!1,[Tr]:!1,[jr]:!1,[zr]:!1,[Qo]:!1,[Go]:!1,[Yo]:!1,[Zo]:!1,[xs]:!1,[Cs]:10,[Es]:!1,[Ss]:!1,[Mr]:!1,[Ei]:!1,[Mi]:"image",[$i]:10,[ar]:"none",[Ms]:1},scrubbing:{[mo]:"below",[_o]:"ribbon",[go]:"seek",[Pr]:"below",[Fr]:"ribbon",[Lr]:"seek"}},ww=(e,t,n)=>{const a=Ds(Nd).safeParse(e);if(!a.success)return t;const i=a.data;for(const e of n??[])e in bw&&Object.entries(bw[e]).forEach((([e,n])=>{return r=n,void(void 0===Xb(i,a=e)&&Kb(t,a,r));var a,r}));return t},xw=e=>{switch(e){case"ptz_left":return"left";case"ptz_right":return"right";case"ptz_up":return"up";case"ptz_down":return"down";case"ptz_zoom_in":return"zoom_in";case"ptz_zoom_out":return"zoom_out"} +/* istanbul ignore next: No (current) way to reach this code -- @preserve */return null},Cw=(e,t)=>{if(!t.enabled)return[];const n=[];for(const a of["ptz_down","ptz_left","ptz_right","ptz_up","ptz_zoom_in","ptz_zoom_out"]){const i=t[a],r=xw(a);i&&r&&(n.push({conditions:[{condition:"key",key:i.key,state:"down",shift:i.shift,ctrl:i.ctrl,alt:i.alt,meta:i.meta}],actions:[vf({ptzAction:r,ptzPhase:"start"})],tag:e}),n.push({conditions:[{condition:"key",key:i.key,state:"up"}],actions:[vf({ptzAction:r,ptzPhase:"stop"})],tag:e}))}const a=t.ptz_home;return a&&n.push({conditions:[{condition:"key",key:a.key,state:"down",shift:a.shift,ctrl:a.ctrl,alt:a.alt,meta:a.meta}],actions:[vf()],tag:e}),n};class Mw{constructor(e){this._config=null,this._overriddenConfig=null,this._rawConfig=null,this._cardWideConfig=null,this._api=e}hasConfig(){return!!this.getConfig()}getConfig(){return this._overriddenConfig??this._config}getCardWideConfig(){return this._cardWideConfig}getNonOverriddenConfig(){return this._config}getRawConfig(){return this._rawConfig}setConfig(e){if(!e)throw new Error(V_("error.invalid_configuration"));const t=Nd.safeParse(e);if(!t.success){const n=aw(e),a=Ps(t.error);let i="";throw n&&(i=`${V_("error.upgrade_available")}. `),new Error(i+`${V_("error.invalid_configuration")}: `+(a&&a.size?JSON.stringify([...a],null," "):V_("error.invalid_configuration_no_hint")))}const n=ww(e,t.data,t.data.profiles);var a;(this._rawConfig=e,Dv(this._config,n))||(this._config=n,this._cardWideConfig={performance:n.performance,debug:n.debug},this._api.getConditionsManager().setConditionsFromConfig(),this._api.getConditionsManager().setState({view:void 0,displayMode:void 0,camera:void 0}),this._api.getMediaLoadedInfoManager().clear(),this._api.getInitializationManager().uninitialize(Wb.VIEW),this._api.getViewManager().reset(),this._api.getMessageManager().reset(),this._api.getStyleManager().setPerformance(),this._api.getStatusBarItemManager().removeAllDynamicStatusBarItems(),((e,t)=>{e.getAutomationsManager().deleteAutomations(t);const n=e.getConfigManager().getConfig()?.view.keyboard_shortcuts;if(!n)return;const a=Cw(t,n);a.length&&e.getAutomationsManager().addAutomations(a)})(this._api,this),(a=this._api).getAutomationsManager().deleteAutomations(),a.getAutomationsManager().addAutomations(a.getConfigManager().getNonOverriddenConfig()?.automations??[]),this.computeOverrideConfig(),this._api.getCardElementManager().update())}computeOverrideConfig(){const e=this._api.getConditionsManager();if(!this._config)return;let t=null;try{t=vw(e,this._config,{configOverrides:this._config.overrides,schema:Nd})}catch(e){return void this._api.getMessageManager().setErrorIfHigherPriority(e)}if(Dv(t,this._overriddenConfig))return;const n=this._overriddenConfig;this._overriddenConfig=t,this._api.getStyleManager().setMinMaxHeight(),!n||Dv(n?.cameras,this._overriddenConfig?.cameras)&&Dv(n?.cameras_global,this._overriddenConfig?.cameras_global)||this._api.getInitializationManager().uninitialize(Wb.CAMERAS),n&&n?.live.microphone.always_connected!==this._overriddenConfig?.live.microphone.always_connected&&this._api.getInitializationManager().uninitialize(Wb.MICROPHONE_CONNECT),this._initializeBackground(n)}async _initializeBackground(e){await this._api.getDefaultManager().initializeIfNecessary(e),await this._api.getMediaPlayerManager().initializeIfNecessary(e),this._api.getCardElementManager().update()}}class kw{constructor(e){this._timer=new xf,this._stateChangeHandler=()=>{this._setToDefaultIfAllowed()},this._api=e}async initializeIfNecessary(e){Dv(e?.view.default_reset,this._api.getConfigManager().getConfig()?.view.default_reset)||await this.initialize()}async initialize(){this.uninitialize();const e=this._api.getConfigManager().getConfig()?.view.default_reset;e?.entities.length&&this._api.getHASSManager().getStateWatcher().subscribe(this._stateChangeHandler,e.entities);const t=this._api.getConfigManager().getConfig()?.view.default_reset.every_seconds;return t&&this._timer.startRepeated(t,(()=>this._setToDefaultIfAllowed())),this._api.getConfigManager().getConfig()?.view.default_reset.after_interaction&&this._api.getAutomationsManager().addAutomations([{actions:[gf("default")],conditions:[{condition:"interaction",interaction:!1}],tag:this}]),!0}uninitialize(){this._timer.stop(),this._api.getHASSManager().getStateWatcher().unsubscribe(this._stateChangeHandler),this._api.getAutomationsManager().deleteAutomations(this)}_setToDefaultIfAllowed(){this._isAutomatedUpdateAllowed()&&this._api.getViewManager().setViewDefault()}_isAutomatedUpdateAllowed(){const e=this._api.getConfigManager().getConfig()?.view.default_reset.interaction_mode;return!!e&&((e,t)=>{switch(e){case"all":return!0;case"active":return t;case"inactive":return!t}})(e,this._api.getInteractionManager().hasInteraction())}}const Sw=(e,t="download")=>{const n=new URL(e).origin===window.location.origin,a=e.startsWith("data:");if(navigator.userAgent.startsWith("Home Assistant/")||navigator.userAgent.startsWith("HomeAssistant/")||!n&&!a)window.open(e,"_blank");else{const n=document.createElement("a");n.setAttribute("download",t),n.href=e,n.click(),n.remove()}},Ew=async(e,t,n)=>{const a=await t.getMediaDownloadPath(n);if(!a)throw new zs(V_("error.download_no_media"));let i=a.endpoint;if(a.sign){let t;try{t=await Ib(e,a.endpoint)}catch(e){Gg(e)}if(!t)throw new zs(V_("error.download_sign_failed"));i=t}Sw(i)},$w=e=>{const t=document.createElement("canvas");t.width=e.videoWidth,t.height=e.videoHeight;const n=t.getContext("2d");return n?(n.drawImage(e,0,0,t.width,t.height),t.toDataURL("image/jpeg")):null};class Aw{constructor(e){this._api=e}async downloadViewerMedia(){const e=this._api.getViewManager().getView()?.queryResults?.getSelectedResult(),t=this._api.getHASSManager().getHASS();if(!e||!t)return!1;try{await Ew(t,this._api.getCameraManager(),e)}catch(e){return this._api.getMessageManager().setErrorIfHigherPriority(e),!1}return!0}async downloadScreenshot(){const e=await(this._api.getMediaLoadedInfoManager().get()?.player?.getScreenshotURL());e&&Sw(e,(e=>{if(e?.is("live")||e?.is("image"))return`${e.view}-${e.camera}-${Wu(new Date,"yyyy-MM-dd-HH-mm-ss")}.jpg`;if(e?.isViewerView()){const t=e.queryResults?.getSelectedResult(),n=t?.getID()??null;return`${e.view}-${e.camera}${n?`-${n}`:""}.jpg`}return"screenshot.jpg"})(this._api.getViewManager().getView()))}}class zw{constructor(e){this._expanded=!1,this._api=e}initialize(){this._setConditionState()}isExpanded(){return this._expanded}toggleExpanded(){this.setExpanded(!this._expanded)}setExpanded(e){e&&this._api.getFullscreenManager().isInFullscreen()&&this._api.getFullscreenManager().stopFullscreen(),this._expanded=e,this._setConditionState(),this._api.getCardElementManager().update()}_setConditionState(){this._api.getConditionsManager()?.setState({expand:this._expanded})}}const Iw=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],Tw=(()=>{if("undefined"==typeof document)return!1;const e=Iw[0],t={};for(const n of Iw){const a=n?.[1];if(a in document){for(const[a,i]of n.entries())t[e[a]]=i;return t}}return!1})(),jw={change:Tw.fullscreenchange,error:Tw.fullscreenerror};let Ow={request:(e=document.documentElement,t)=>new Promise(((n,a)=>{const i=()=>{Ow.off("change",i),n()};Ow.on("change",i);const r=e[Tw.requestFullscreen](t);r instanceof Promise&&r.then(i).catch(a)})),exit:()=>new Promise(((e,t)=>{if(!Ow.isFullscreen)return void e();const n=()=>{Ow.off("change",n),e()};Ow.on("change",n);const a=document[Tw.exitFullscreen]();a instanceof Promise&&a.then(n).catch(t)})),toggle:(e,t)=>Ow.isFullscreen?Ow.exit():Ow.request(e,t),onchange(e){Ow.on("change",e)},onerror(e){Ow.on("error",e)},on(e,t){const n=jw[e];n&&document.addEventListener(n,t,!1)},off(e,t){const n=jw[e];n&&document.removeEventListener(n,t,!1)},raw:Tw};Object.defineProperties(Ow,{isFullscreen:{get:()=>Boolean(document[Tw.fullscreenElement])},element:{enumerable:!0,get:()=>document[Tw.fullscreenElement]??void 0},isEnabled:{enumerable:!0,get:()=>Boolean(document[Tw.fullscreenEnabled])}}),Tw||(Ow={isEnabled:!1});var Dw=Ow;class Rw{constructor(e){this._fullscreenHandler=()=>{this._api.getExpandManager().setExpanded(!1),this._setConditionState(),this._api.getCardElementManager().update()},this._api=e}initialize(){this._setConditionState()}connect(){Dw.isEnabled&&Dw.on("change",this._fullscreenHandler)}disconnect(){Dw.isEnabled&&Dw.off("change",this._fullscreenHandler)}isInFullscreen(){return Dw.isEnabled&&Dw.isFullscreen}toggleFullscreen(){Dw.toggle(this._api.getCardElementManager().getElement())}stopFullscreen(){Dw.exit()}_setConditionState(){this._api.getConditionsManager()?.setState({fullscreen:this.isInFullscreen()})}}class Pw{constructor(){this._watcherCallbacks=new Map}setHASS(e,t){if(e)for(const[n,a]of this._watcherCallbacks.entries()){const i=Tb(t,e,a,{stateOnly:!0,firstOnly:!0});i.length&&n(i[0])}}subscribe(e,t){return!!t.length&&(this._watcherCallbacks.has(e)?this._watcherCallbacks.get(e)?.push(...t):this._watcherCallbacks.set(e,t),!0)}unsubscribe(e){this._watcherCallbacks.delete(e)}}class Lw{constructor(e){this._hass=null,this._stateWatcher=new Pw,this._api=e}getHASS(){return this._hass}hasHASS(){return!!this._hass}getStateWatcher(){return this._stateWatcher}setHASS(e){if(((e,t)=>e?.connected!==t?.connected)(this._hass,e)&&(e?.connected?this._api.getMessageManager().resetType("connection"):this._api.getMessageManager().setMessageIfHigherPriority({message:V_("error.reconnecting"),icon:"mdi:lan-disconnect",type:"connection",dotdotdot:!0})),!e)return;const t=this._hass;this._hass=e,this._api.getConditionsManager().hasHAStateConditions()&&this._api.getConditionsManager().setState({state:this._hass.states,user:this._hass.user}),this._api.getStyleManager().setLightOrDarkMode(),this._stateWatcher.setHASS(t,e)}}var Nw=function(){return th.Date.now()},Fw="Expected a function",Vw=Math.max,Hw=Math.min;function Bw(e,t,n){var a,i,r,o,s,c,l=0,d=!1,u=!1,h=!0;if("function"!=typeof e)throw new TypeError(Fw);function p(t){var n=a,r=i;return a=i=void 0,l=t,o=e.apply(r,n)}function m(e){var n=e-c;return void 0===c||n>=t||n<0||u&&e-l>=r}function g(){var e=Nw();if(m(e))return f(e);s=setTimeout(g,function(e){var n=t-(e-c);return u?Hw(n,r-(e-l)):n}(e))}function f(e){return s=void 0,h&&a?p(e):(a=i=void 0,o)}function _(){var e=Nw(),n=m(e);if(a=arguments,i=this,c=e,n){if(void 0===s)return function(e){return l=e,s=setTimeout(g,t),d?p(e):o}(c);if(u)return clearTimeout(s),s=setTimeout(g,t),p(c)}return void 0===s&&(s=setTimeout(g,t)),o}return t=Cg(t)||0,hh(n)&&(d=!!n.leading,r=(u="maxWait"in n)?Vw(Cg(n.maxWait)||0,t):r,h="trailing"in n?!!n.trailing:h),_.cancel=function(){void 0!==s&&clearTimeout(s),l=0,a=c=i=s=void 0},_.flush=function(){return void 0===s?o:f(Nw())},_}function qw(e,t,n){var a=!0,i=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return hh(n)&&(a="leading"in n?!!n.leading:a,i="trailing"in n?!!n.trailing:i),Bw(e,t,{leading:a,maxWait:t,trailing:i})}class Uw{constructor(e){this._timer=new xf,this.reportInteraction=qw((()=>{this._reportInteraction()}),1e3),this._api=e}initialize(){this._api.getConditionsManager().setState({interaction:!1})}hasInteraction(){return this._timer.isRunning()}_reportInteraction(){this._timer.stop();const e=this._api.getConfigManager().getConfig()?.view.interaction_seconds;e&&(this._api.getConditionsManager().setState({interaction:!0}),this._timer.start(e,(()=>{this._api.getConditionsManager().setState({interaction:!1}),this._api.getStyleManager().setLightOrDarkMode()})))}}class Ww{constructor(e){this._state={},this._handleKeydown=e=>{const t={state:"down",ctrl:e.ctrlKey,alt:e.altKey,meta:e.metaKey,shift:e.shiftKey};Dv(this._state[e.key],t)||(this._state[e.key]=t,this._processStateChange())},this._handleKeyup=e=>{e.key in this._state&&"down"===this._state[e.key].state&&(this._state[e.key].state="up",this._processStateChange())},this._handleBlur=()=>{Object.keys(this._state).length&&(this._state={},this._processStateChange())},this._api=e}initialize(){const e=this._api.getCardElementManager().getElement();e.addEventListener("keydown",this._handleKeydown),e.addEventListener("keyup",this._handleKeyup),e.addEventListener("blur",this._handleBlur)}uninitialize(){const e=this._api.getCardElementManager().getElement();e.removeEventListener("keydown",this._handleKeydown),e.removeEventListener("keyup",this._handleKeyup),e.removeEventListener("blur",this._handleBlur)}_processStateChange(){this._api.getConditionsManager().setState({keys:this._state})}}function Zw(e,t){let n;return n=e instanceof Event?e.composedPath()[0]:e,n instanceof HTMLImageElement?{width:n.naturalWidth,height:n.naturalHeight,...t}:n instanceof HTMLVideoElement?{width:n.videoWidth,height:n.videoHeight,...t}:n instanceof HTMLCanvasElement?{width:n.width,height:n.height,player:t?.player,...t}:null}function Qw(e,t,n){const a=Zw(t,n);a&&Gw(e,a)}function Gw(e,t){Bg(e,"media:loaded",t)}function Yw(e){Bg(e,"media:unloaded")}function Kw(e){Bg(e,"media:volumechange")}function Xw(e){Bg(e,"media:play")}function Jw(e){Bg(e,"media:pause")}class ex{constructor(e){this._current=null,this._lastKnown=null,this._api=e}initialize(){this.clear()}set(e){var t;(t=e).height>=50&&t.width>=50&&(B_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card media load: ",e),this._current=e,this._lastKnown=e,this._api.getConditionsManager().setState({media_loaded:!0}),this._api.getStyleManager().setExpandedMode(),this._api.getCardElementManager().update())}get(){return this._current}getLastKnown(){return this._lastKnown}clear(){this._current=null,this._api.getConditionsManager().setState({media_loaded:!1})}has(){return!!this._current}}class tx{static isEvent(e){return this.isClip(e)||this.isSnapshot(e)}static isRecording(e){return"recording"===e.getMediaType()}static isClip(e){return"clip"===e.getMediaType()}static isSnapshot(e){return"snapshot"===e.getMediaType()}static isVideo(e){return this.isClip(e)||this.isRecording(e)}}class nx{constructor(e){this._mediaPlayers=[],this._api=e}getMediaPlayers(){return this._mediaPlayers}hasMediaPlayers(){return this._mediaPlayers.length>0}async initializeIfNecessary(e){e?.menu.buttons.media_player.enabled!==this._api.getConfigManager().getConfig()?.menu.buttons.media_player.enabled&&await this.initialize()}async initialize(){const e=this._api.getHASSManager().getHASS();if(!e||!this._api.getConfigManager().getConfig()?.menu.buttons.media_player.enabled)return!1;const t=Object.keys(e.states).filter((t=>{if(t.startsWith("media_player.")){const n=e.states[t];if(n&&"unavailable"!==n.state&&vb(n,131072))return!0}return!1}));let n=null;try{n=await this._api.getEntityRegistryManager().getEntities(e,t)}catch(e){Gg(e)}return this._mediaPlayers=t.filter((e=>{const t=n?.get(e);return!t||!t.hidden_by})),!0}async stop(e){const t=this._api.getHASSManager().getHASS(),n=t?.states[e];if(!n)return;let a;if(vb(n,4096))a="media_stop";else{if(!vb(n,256))return;a="turn_off"}await t.callService("media_player",a,{entity_id:e})}async playLive(e,t){const n=this._api.getCameraManager().getStore().getCameraConfig(t);n&&("dashboard"===n.cast?.method?await this._playLiveDashboard(e,n):await this._playLiveStandard(e,t,n))}async _playLiveStandard(e,t,n){const a=this._api.getHASSManager().getHASS(),i=n?.camera_entity??null;if(!a||!i)return;const r=this._api.getCameraManager().getCameraMetadata(t)?.title??null,o=a.states[i]?.attributes?.entity_picture??null;await a.callService("media_player","play_media",{entity_id:e,media_content_id:`media-source://camera/${i}`,media_content_type:"application/vnd.apple.mpegurl",extra:{...r&&{title:r},...o&&{thumb:o}}})}async _playLiveDashboard(e,t){const n=this._api.getHASSManager().getHASS();if(!n)return;const a=t.cast?.dashboard;a?.dashboard_path&&a?.view_path?await n.callService("cast","show_lovelace_view",{entity_id:e,dashboard_path:a.dashboard_path,view_path:a.view_path}):this._api.getMessageManager().setMessageIfHigherPriority({type:"error",icon:"mdi:cast",message:V_("error.no_dashboard_or_view")})}async playMedia(e,t){const n=this._api.getHASSManager().getHASS();if(!n||!t)return;const a=t.getTitle(),i=t.getThumbnail();await n.callService("media_player","play_media",{entity_id:e,media_content_id:t.getContentID(),media_content_type:tx.isVideo(t)?"video":"image",extra:{...a&&{title:a},...i&&{thumb:i}}})}}class ax{constructor(e){this._message=null,this._api=e}getMessage(){return this._message}hasMessage(){return!!this._message}hasErrorMessage(){return"error"===this._message?.type}reset(){const e=this.hasMessage();this._message=null,e&&this._api.getCardElementManager().update()}resetType(e){this._message?.type===e&&this.reset()}setErrorIfHigherPriority(e,t){e&&"object"==typeof e&&"message"in e&&(Gg(e),this.setMessageIfHigherPriority({message:t?`${t}: ${e.message}`:e.message,type:"error",...e instanceof zs&&{context:e.context}}))}setMessageIfHigherPriority(e){const t=this._message?Is[this._message.type]:0,n=Is[e.type];return!(this._message&&ne.stop())),this._stream=void 0,this._setConditionState(),this._api.getCardElementManager().update()}getStream(){return this._stream??void 0}mute(){const e=this.isMuted();this._mute=!0,this._setMute(),this._setConditionState(),e||this._callListeners("muted")}async unmute(){if(!this.isSupported())return;const e=!this.isMuted(),t=()=>{this._mute=!1,this._setMute()};this.isConnected()||this.isForbidden()?this.isConnected()&&t():(t(),await this.connect()),this._setConditionState(),e||this._callListeners("unmuted")}isConnected(){return!!this._stream}isForbidden(){return null===this._stream}isMuted(){return!this._stream||this._stream.getTracks().every((e=>!e.enabled))}addListener(e){this._listeners.push(e)}removeListener(e){this._listeners=this._listeners.filter((t=>t!==e))}_callListeners(e){this._listeners.forEach((t=>t(e)))}_setMute(){this._stream?.getTracks().forEach((e=>{e.enabled=!this._mute})),this._startTimer(),this._api.getCardElementManager().update()}_startTimer(){const e=this._api.getConfigManager().getConfig()?.live.microphone;if(e?.always_connected)return;const t=e?.disconnect_seconds??0;t&&this._timer.start(t,(()=>{this.disconnect()}))}_setConditionState(){this._api.getConditionsManager().setState({microphone:{muted:this.isMuted(),connected:this.isConnected()}})}}class rx{constructor(e){this._shouldRun=!0,this.requestExecution=()=>{this._shouldRun=!0,this._api.getCardElementManager().update()},this.executeIfNecessary=async()=>{this._shouldRun&&(this._shouldRun=!1,await this._executeViewRelated(this._calculateIntent()),await this._executeNonViewRelated(this._calculateIntent()))},this._isViewAction=e=>{switch(e.frigate_card_action){case"clip":case"clips":case"diagnostics":case"image":case"live":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":return!0}return!1},this._api=e}hasViewRelatedActionsToRun(){return!!this._calculateIntent().view&&this._shouldRun}async _executeViewRelated(e){e.view&&(e.view.default?await this._api.getViewManager().setViewDefaultWithNewQuery({params:{camera:e.view.camera},...e.view.substream&&{modifiers:[new sb(e.view.substream)]}}):await this._api.getViewManager().setViewByParametersWithNewQuery({params:{...e.view.view&&{view:e.view.view},...e.view.camera&&{camera:e.view.camera}},...e.view.substream&&{modifiers:[new sb(e.view.substream)]}}))}async _executeNonViewRelated(e){e.other&&await this._api.getActionsManager().executeActions(e.other)}_calculateIntent(){const e={};for(const t of this._getActions())this._isViewAction(t)?((e.view??={}).view=t.frigate_card_action,(e.view??={}).default=void 0):"default"===t.frigate_card_action?((e.view??={}).default=!0,(e.view??={}).view=void 0):"camera_select"===t.frigate_card_action?(e.view??={}).camera=t.camera:"live_substream_select"===t.frigate_card_action?(e.view??={}).substream=t.camera:(e.other??=[]).push(t);return e}_getActions(){const e=new URLSearchParams(window.location.search),t=[],n=new RegExp(/^frigate-card-action([.:](?\w+))?[.:](?\w+)/);for(const[a,i]of e.entries()){const e=a.match(n);if(!e||!e.groups)continue;const r=e.groups.cardID,o=e.groups.action;let s=null;switch(o){case"camera_select":case"live_substream_select":i&&(s=ff(o,i,{cardID:r}));break;case"camera_ui":case"clip":case"clips":case"default":case"diagnostics":case"download":case"expand":case"image":case"live":case"menu_toggle":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":s=gf(o,{cardID:r});break;default:console.warn(`Frigate card received unknown card action in query string: ${o}`)}s&&t.push(s)}return t}}class ox{constructor(e){this._items=[],this._dynamicItems=[],this._api=e}addDynamicStatusBarItem(e){this._dynamicItems.includes(e)||this._dynamicItems.push(e),this._api.getCardElementManager().update()}removeDynamicStatusBarItem(e){this._dynamicItems=this._dynamicItems.filter((t=>!Dv(t,e))),this._api.getCardElementManager().update()}removeAllDynamicStatusBarItems(){this._dynamicItems=[],this._api.getCardElementManager().update()}calculateItems(e){const t=e?.view?e?.cameraManager?.getCameraMetadata(e?.view?.camera):null,n=t?.engineLogo??null,a=e?.view?.is("live")?t?.title??null:e?.view?.isViewerView()?e?.view.queryResults?.getSelectedResult()?.getTitle()??null:null,i=e?.mediaLoadedInfo?this._calculateResolution(e?.mediaLoadedInfo):null,r=e?.mediaLoadedInfo?.technology?.length?e?.mediaLoadedInfo.technology[0]:null;return[...a?[{type:"custom:frigate-card-status-bar-string",string:a,expand:!0,sufficient:!0,...e?.statusConfig?.items.title}]:[],...i?[{type:"custom:frigate-card-status-bar-string",string:i,...e?.statusConfig?.items.resolution}]:[],...r&&"webrtc"===r?[{type:"custom:frigate-card-status-bar-icon",icon:"mdi:webrtc",...e?.statusConfig?.items.technology}]:r?[{type:"custom:frigate-card-status-bar-string",string:r.toUpperCase(),...e?.statusConfig?.items.technology}]:[],...n?[{type:"custom:frigate-card-status-bar-image",image:n,...e?.statusConfig?.items.engine}]:[],...this._dynamicItems]}_matchesWidthHeight(e,t,n){const a=.99*t,i=1.01*t,r=.99*n,o=1.01*n,s=(e,t,n)=>e>=t&&e<=n;return!!e&&(s(e.width,a,i)&&s(e.height,r,o)||s(e.height,a,i)&&s(e.width,r,o))}_calculateResolution(e){return this._matchesWidthHeight(e,1920,1080)?"1080p":this._matchesWidthHeight(e,1280,720)?"720p":this._matchesWidthHeight(e,640,480)?"VGA":this._matchesWidthHeight(e,3840,2160)?"4K":this._matchesWidthHeight(e,720,480)?"480p":this._matchesWidthHeight(e,720,576)?"576p":this._matchesWidthHeight(e,7680,4320)?"8K":`${e.width}x${e.height}`}}class sx{constructor(e){this.setLightOrDarkMode=()=>{const e=this._api.getConfigManager().getConfig(),t="on"===e?.view.dark_mode||"auto"===e?.view.dark_mode&&(!this._api.getInteractionManager().hasInteraction()||!!this._api.getHASSManager().getHASS()?.themes.darkMode);of(this._api.getCardElementManager().getElement(),t,"dark")},this._api=e}setExpandedMode(){const e=this._api.getCardElementManager().getElement(),t=this._api.getViewManager().getView(),n=this._api.getMediaLoadedInfoManager().getLastKnown();e.style.setProperty("--frigate-card-expand-aspect-ratio",t?.isAnyMediaView()&&n?`${n.width} / ${n.height}`:"unset");const a=t?.isGrid();e.style.setProperty("--frigate-card-expand-width",!a&&t?.isAnyMediaView()?"none":"var(--frigate-card-expand-max-width)"),e.style.setProperty("--frigate-card-expand-height",!a&&t?.isAnyMediaView()?"none":"var(--frigate-card-expand-max-height)")}setMinMaxHeight(){const e=this._api.getConfigManager().getConfig();if(e){this._api.getCardElementManager().getElement().style.setProperty("--frigate-card-height",e.dimensions.height)}}setPerformance(){const e={box_shadow:"none",border_radius:"0px"},t=this._api.getCardElementManager().getElement(),n=this._api.getConfigManager().getCardWideConfig()?.performance,a=n?.style??{};for(const n of Object.keys(a)){const i=`--frigate-card-css-${n.replaceAll("_","-")}`;!1===a[n]?t.style.setProperty(i,e[n]):t.style.removeProperty(i)}}_isAspectRatioEnforced(e,t){const n=e.dimensions.aspect_ratio_mode;return!(this._api.getFullscreenManager().isInFullscreen()||this._api.getExpandManager().isExpanded()||"unconstrained"===n||"dynamic"===n&&(!t||t?.isAnyMediaView()||t?.is("timeline")||t?.is("diagnostics")))}getAspectRatioStyle(){const e=this._api.getConfigManager().getConfig(),t=this._api.getViewManager().getView();if(e){if(!this._isAspectRatioEnforced(e,t))return uf();const n=e.dimensions.aspect_ratio_mode,a=this._api.getMediaLoadedInfoManager().getLastKnown();return uf(a&&"dynamic"===n?{ratio:[a.width,a.height]}:{ratio:e.dimensions.aspect_ratio})}return uf({defaultStatic:!0})}}class cx{constructor(e){this._triggeredCameras=new Map,this._triggeredCameraTimers=new Map,this._throttledTriggerAction=qw(this._triggerAction.bind(this),1e3,{trailing:!0}),this._api=e}getTriggeredCameraIDs(){return new Set(this._triggeredCameras.keys())}isTriggered(){return!!this._triggeredCameras.size}getMostRecentlyTriggeredCameraID(){const e=Ev([...this._triggeredCameras.entries()],(e=>e[1].getTime()),"desc");return e.length?e[0][0]:null}async handleCameraEvent(e){const t=this._api.getConfigManager().getConfig()?.view.triggers,n=this._api.getViewManager().getView()?.camera;if(!t||!n)return;const a=this._api.getCameraManager().getStore().getAllDependentCameras(n);t.filter_selected_camera&&!a.has(e.cameraID)||("end"!==e.type?(this._triggeredCameras.set(e.cameraID,new Date),this._setConditionStateIfNecessary(),await this._throttledTriggerAction(e)):this._startUntriggerTimer(e.cameraID))}_hasAllowableInteractionStateForAction(){const e=this._api.getConfigManager().getConfig()?.view.triggers,t=this._api.getInteractionManager().hasInteraction();return!!e&&("all"===e.actions.interaction_mode||"active"===e.actions.interaction_mode&&t||"inactive"===e.actions.interaction_mode&&!t)}async _triggerAction(e){const t=this._api.getConfigManager().getConfig()?.view.triggers.actions.trigger,n=this._api.getConfigManager().getConfig()?.view.default;("high"!==e.fidelity||e.snapshot||e.clip||"live"===t||"default"===t&&"live"===n)&&(this._hasAllowableInteractionStateForAction()&&("update"===t?await this._api.getViewManager().setViewByParametersWithNewQuery({queryExecutorOptions:{useCache:!1}}):"live"===t?await this._api.getViewManager().setViewByParametersWithNewQuery({params:{view:"live",camera:e.cameraID}}):"default"===t?await this._api.getViewManager().setViewDefaultWithNewQuery({params:{camera:e.cameraID}}):"high"===e.fidelity&&"media"===t&&await this._api.getViewManager().setViewByParametersWithNewQuery({params:{view:e.clip?"clip":"snapshot",camera:e.cameraID}})),this._api.getCardElementManager().update())}_setConditionStateIfNecessary(){const e=new Set(this._triggeredCameras.keys()),t=e.size?e:void 0;Dv(t,this._api.getConditionsManager().getState().triggered)||this._api.getConditionsManager().setState({triggered:t})}async _untriggerAction(e){const t=this._api.getConfigManager().getConfig()?.view.triggers.actions.untrigger;"default"===t&&this._hasAllowableInteractionStateForAction()&&await this._api.getViewManager().setViewDefaultWithNewQuery(),this._triggeredCameras.delete(e),this._deleteTimer(e),this._setConditionStateIfNecessary(),this._api.getCardElementManager().update()}_startUntriggerTimer(e){this._deleteTimer(e);const t=new xf;this._triggeredCameraTimers.set(e,t),t.start( +/* istanbul ignore next: the case of config being null here cannot be + reached, as there's no way to have the untrigger call happen without + a config. -- @preserve */ +this._api.getConfigManager().getConfig()?.view.triggers.untrigger_seconds??0,(async()=>{await this._untriggerAction(e)}))}_deleteTimer(e){this._triggeredCameraTimers.get(e)?.stop(),this._triggeredCameraTimers.delete(e)}}function lx(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Hg(e,void 0,t):[]}class dx{constructor(e){this._queries=null,e&&(this._queries=e)}clone(){return u_(this)}getQueries(){return this._queries}setQueries(e){return this._queries=e,this}getQueryCameraIDs(){if(!this._queries)return null;const e=new Set;return this._queries.forEach((t=>[...t.cameraIDs].forEach((t=>e.add(t))))),e}setQueryCameraIDs(e){if(!this._queries)return this;const t=[];return this._queries.forEach((n=>t.push({...n,cameraIDs:Zg(e)}))),this._queries=lx(t,Dv),this}hasQueriesForCameraIDs(e){for(const t of e)if(!this._queries?.some((e=>e.cameraIDs.has(t))))return!1;return!0}}class ux extends dx{convertToClipsQueries(){for(const e of this._queries??[])delete e.hasSnapshot,e.hasClip=!0;return this}}class hx extends dx{}class px{static areEventQueries(e){return e instanceof ux}static areRecordingQueries(e){return e instanceof hx}static areClipsQueries(e){return this.areEventQueries(e)&&!!e?.getQueries()?.every((e=>e.hasClip))}static areSnapshotQueries(e){return this.areEventQueries(e)&&!!e?.getQueries()?.every((e=>e.hasSnapshot))}static getQueriesType(e){return this.areEventQueries(e)?"event":this.areRecordingQueries(e)?"recording":null}static getMediaType(e){return this.areClipsQueries(e)?"clips":this.areSnapshotQueries(e)?"snapshots":this.areRecordingQueries(e)?"recordings":null}}const mx=(e,t,n)=>{const a={anyCapabilities:["clips","snapshots","recordings"]};switch(t){case"image":case"diagnostics":return e.getStore().getCameraIDs();case"live":case"clip":case"clips":case"snapshot":case"snapshots":case"recording":case"recordings":const i="clip"===t?"clips":"snapshot"===t?"snapshots":"recording"===t?"recordings":t;return n?e.getStore().getAllDependentCameras(n,i):e.getStore().getCameraIDsWithCapability(i);case"timeline":return e.getStore().getCameraIDsWithCapability(a);case"media":return n?e.getStore().getAllDependentCameras(n,a):e.getStore().getCameraIDsWithCapability(a)}},gx=(e,t)=>Ly({},e,t);class fx{constructor(e){this.view=e.view,this.camera=e.camera,this.query=e.query??null,this.queryResults=e.queryResults??null,this.context=e.context??null,this.displayMode=e.displayMode??null}clone(){return new fx({view:this.view,camera:this.camera,query:this.query?.clone()??null,queryResults:this.queryResults?.clone()??null,context:this.context,displayMode:this.displayMode})}evolve(e){return new fx({view:void 0!==e.view?e.view:this.view,camera:void 0!==e.camera?e.camera:this.camera,query:void 0!==e.query?e.query:this.query?.clone()??null,queryResults:void 0!==e.queryResults?e.queryResults:this.queryResults?.clone()??null,context:void 0!==e.context?e.context:this.context,displayMode:void 0!==e.displayMode?e.displayMode:this.displayMode})}mergeInContext(e){return this.context=gx(this.context,e),this}removeContext(e){return this.context&&delete this.context[e],this}removeContextProperty(e,t){const n=this.context?.[e];return n&&delete n[t],this}is(e){return this.view==e}isGalleryView(){return["clips","snapshots","recordings"].includes(this.view)}isAnyMediaView(){return this.isViewerView()||this.is("live")||this.is("image")}isViewerView(){return["media","clip","snapshot","recording"].includes(this.view)}supportsMultipleDisplayModes(){return this.isViewerView()||this.is("live")}getDefaultMediaType(){return["clip","clips"].includes(this.view)?"clips":["snapshot","snapshots"].includes(this.view)?"snapshots":["recording","recordings"].includes(this.view)?"recordings":null}isGrid(){return"grid"===this.displayMode}}const _x=(e,t)=>{t?.forEach((t=>t.modify(e)))};class vx extends zs{}class yx extends zs{}class bx{constructor(e){this._api=e}getViewDefault(e){const t=this._api.getConfigManager().getConfig();if(!t)return null;let n=null;const a=e?.params?.view??t.view.default;if(e?.params?.camera)n=e.params.camera;else{const i=[...mx(this._api.getCameraManager(),a)];if(!i.length)return null;if(e?.baseView?.camera&&t.view.default_cycle_camera){const t=i.indexOf(e.baseView.camera);n=i[t+1>=i.length?0:t+1]}else n=i[0]}return this.getViewByParameters({params:{...e?.params,view:a,camera:n},baseView:e?.baseView})}getViewByParameters(e){const t=this._api.getConfigManager().getConfig();if(!t)return null;let n=e?.params?.camera??e?.baseView?.camera??null,a=e?.params?.view??e?.baseView?.view??t.view.default;const i=this._api.getCameraManager().getStore().getCameraIDs();if(!n||!i.has(n)){n=mx(this._api.getCameraManager(),a).keys().next().value??null}if(!n){const e=[...this._api.getCameraManager().getStore().getCameras()].reduce(((e,[t,n])=>{const a=n.getCapabilities()?.getRawCapabilities();return a&&(e[t]=a),e}),{});throw new vx(V_("error.no_supported_cameras"),{view:a,cameras_capabilities:e})}if(!this.isViewSupportedByCamera(n,a)){if(!e?.failSafe||!this.isViewSupportedByCamera(n,Qs)){const e=this._api.getCameraManager().getStore().getCamera(n)?.getCapabilities()?.getRawCapabilities();throw new yx(V_("error.no_supported_camera"),{view:a,camera:n,...e&&{camera_capabilities:e}})}a=Qs}const r=e?.params?.displayMode??e?.baseView?.displayMode??this._getDefaultDisplayModeForView(a,t),o={...e?.params,view:a,camera:n,displayMode:r},s=e?.baseView?e.baseView.evolve(o):new fx(o);return _x(s,e?.modifiers),s}isViewSupportedByCamera(e,t){return!!mx(this._api.getCameraManager(),t,e).size}_getDefaultDisplayModeForView(e,t){let n=null;switch(e){case"media":case"clip":case"recording":case"snapshot":n=t.media_viewer.display?.mode??null;break;case"live":n=t.live.display?.mode??null}return n??"single"}}class wx{constructor(e,t){this._key=e,this._property=t}modify(e){e.removeContextProperty(this._key,this._property)}}class xx{constructor(e){this._query=e?.query,this._queryResults=e?.queryResults}modify(e){void 0!==this._query&&(e.query=this._query),void 0!==this._queryResults&&(e.queryResults=this._queryResults)}}const Cx=(e,t,n)=>{let a;for(const[i,r]of e.entries()){const e=r.getStartTime(),o=r.getUsableEndTime();if(r.includesTime(t)&&e&&o){const t=o.getTime()-e.getTime();(!a||n&&a.cameraID!==n&&r.getCameraID()===n||t>a.duration&&(!n||a.cameraID!==n||r.getCameraID()===n))&&(a={index:i,duration:t,cameraID:r.getCameraID()})}}return a?a.index:null};class Mx{constructor(e){this._results=e?.results??[],this._selectedIndex=this._getInitialSelectedIndex(e)}_getInitialSelectedIndex(e){return null!=e?.selectedIndex?e.selectedIndex:e?.results&&e.results.length?e?.selectApproach&&"last"!==e?.selectApproach?0:e.results.length-1:null}clone(){return new Mx({results:this._results,selectedIndex:this._selectedIndex})}getResults(){return this._results}getSelectedIndex(){return this._selectedIndex}getResultsCount(){return this.getResults().length}hasResults(){return 0!==this.getResultsCount()}getResult(e){return void 0===e?null:this._results[e]}getSelectedResult(){const e=this.getSelectedIndex();return null!==e?this.getResult(e):null}hasSelectedResult(){return null!==this.getSelectedResult()}resetSelectedResult(){this._selectedIndex=null}selectIndex(e){(null===e||e>=0&&ee.getID()))),n=new Set(e._main.getResults()?.map((e=>e.getID())));return!(!t.size||!n.size||t.has(null)||n.has(null))&&((e,t)=>{for(const n of t)if(!e.has(n))return!1;return!0})(t,n)}getCameraIDs(){return new Set(this._cameras.keys())}getSlice(e){return e?this._cameras.get(e)??null:this._main}getResults(e){return this.getSlice(e)?.getResults()??null}getResultsCount(e){return this.getSlice(e)?.getResultsCount()??0}hasResults(e){return 0!==this.getSlice(e)?.getResultsCount()}getResult(e,t){return this.getSlice(t)?.getResult(e)??null}getSelectedIndex(e){return this.getSlice(e)?.getSelectedIndex()??null}getSelectedResult(e){return this.getSlice(e)?.getSelectedResult()??null}getMultipleSelectedResults(e){const t=[];if(!e||e.main){const e=this.getSelectedResult();e&&t.push(e)}const n=this._getCameraIDsFromCriteria(e);for(const e of n??[]){const n=this.getSelectedResult(e);n&&t.push(n)}return t}hasSelectedResult(e){return this.getSlice(e)?.hasSelectedResult()??!1}resetSelectedResult(e){return this.getSlice(e)?.resetSelectedResult(),this}getResultsTimestamp(){return this._resultsTimestamp}selectIndex(e,t){return this.getSlice(t)?.selectIndex(e),t||this.demoteMainSelectionToCameraSelection(),this}demoteMainSelectionToCameraSelection(){const e=this.getSelectedResult();if(e){const t=e.getCameraID();this.resetSelectedResult(t),this.selectResultIfFound((t=>t===e),{cameraID:t})}return this}promoteCameraSelectionToMainSelection(e){const t=this.getSelectedResult(e);return this.resetSelectedResult(),this.selectResultIfFound((e=>e===t)),this}_getCameraIDsFromCriteria(e){return e?.allCameras?this.getCameraIDs():e?.cameraID?new Set([e.cameraID]):null}selectResultIfFound(e,t){t&&!t?.main||(this._main.selectResultIfFound(e),this.demoteMainSelectionToCameraSelection());const n=this._getCameraIDsFromCriteria(t);for(const t of n??[])this.getSlice(t)?.selectResultIfFound(e);return this}selectBestResult(e,t){t&&!t.main||(this._main.selectBestResult(e),this.demoteMainSelectionToCameraSelection());const n=this._getCameraIDsFromCriteria(t);for(const t of n??[])this.getSlice(t)?.selectBestResult(e);return this}}class Sx{constructor(e){this._api=e}async executeDefaultEventQuery(e){const t=e?.eventsMediaType&&"all"!==e?.eventsMediaType?e.eventsMediaType:{anyCapabilities:["clips","snapshots"]},n=this._api.getCameraManager(),a=e?.cameraID?n.getStore().getAllDependentCameras(e.cameraID,t):n.getStore().getCameraIDsWithCapability(t);if(!a.size)return null;const i=n.generateDefaultEventQueries(a,{limit:this._getChunkLimit(),..."clips"===e?.eventsMediaType&&{hasClip:!0},..."snapshots"===e?.eventsMediaType&&{hasSnapshot:!0}});if(!i)return null;const r=new ux(i),o=await this.execute(r,e?.executorOptions);return o?{query:r,queryResults:o}:null}async executeDefaultRecordingQuery(e){const t=this._api.getCameraManager(),n=e?.cameraID?t.getStore().getAllDependentCameras(e.cameraID,"recordings"):t.getStore().getCameraIDsWithCapability("recordings");if(!n.size)return null;const a=t.generateDefaultRecordingQueries(n,{limit:this._getChunkLimit()});if(!a)return null;const i=new hx(a),r=await this.execute(i,e?.executorOptions);return r?{query:i,queryResults:r}:null}async execute(e,t){const n=e.getQueries();if(!n)return null;const a=await this._api.getCameraManager().executeMediaQueries(n,{useCache:t?.useCache});if(!a)return null;const i=new kx({results:a});return t?.rejectResults?.(i)?null:(t?.selectResult?.id?i.selectBestResult((e=>e.findIndex((e=>e.getID()===t.selectResult?.id)))):t?.selectResult?.func?i.selectResultIfFound(t.selectResult.func):t?.selectResult?.time&&i.selectBestResult((e=>Cx(e,t.selectResult?.time?.time,t.selectResult?.time?.favorCameraID))),i)}_getChunkLimit(){const e=this._api.getConfigManager().getCardWideConfig();return e?.performance?.features.media_chunk_size??50}}class Ex{constructor(e,t){this._api=e,this._executor=t??new Sx(e)}async getExistingQueryModifiers(e,t){return e.query?[new xx({queryResults:await this._executor.execute(e.query,t)})]:[]}async getNewQueryModifiers(e,t){return await this._executeNewQuery(e,{useCache:!1,...t})}async _executeNewQuery(e,t){const n=this._api.getConfigManager().getConfig();if(!n)return null;const a=e?.getDefaultMediaType(),i=[],r=async n=>{ +/* istanbul ignore if: this path cannot be reached -- @preserve */ +if(!n)return[];const a="recordings"===n?await this._executor.executeDefaultRecordingQuery({...!e.isGrid()&&{cameraID:e.camera},executorOptions:t}):"clips"===n||"snapshots"===n||"all"===n?await this._executor.executeDefaultEventQuery({...!e.isGrid()&&{cameraID:e.camera},eventsMediaType:n,executorOptions:t}):/* istanbul ignore next -- @preserve */ +null;return a?[new xx(a)]:[]};switch(e.view){case"live":"none"!==n.live.controls.thumbnails.mode&&i.push(...await r("recordings"===n.live.controls.thumbnails.media_type?"recordings":n.live.controls.thumbnails.events_media_type));break;case"media":i.push(...await r("clips"));break;case"clips":case"snapshots":case"recordings":i.push(...await r(a));break;case"clip":case"snapshot":case"recording":"none"!==n.media_viewer.controls.thumbnails.mode&&i.push(...await r(a))}return i.push(...this._getTimelineWindowViewModifier(e)),i.push(...this._getSeekTimeModifier(t?.selectResult?.time?.time)),i}_getTimelineWindowViewModifier(e){if(e.is("live")){const e=new Date,t=this._api.getConfigManager().getConfig()?.live; +/* istanbul ignore if: this if branch cannot be reached as if the config is + empty this function is never called -- @preserve */ +return t?[new Gy({timeline:{window:{start:Qu(e,{seconds:t.controls.timeline.window_seconds}),end:e}}})]:[]}return[new wx("timeline","window")]}_getSeekTimeModifier(e){return e?[new Gy({mediaViewer:{seek:e}})]:[new wx("mediaViewer","seek")]}}class $x{constructor(e,t){this._view=null,this._epoch=this._createEpoch(),this._loadingIndex=1,this.setViewDefault=e=>this._setViewGeneric(this._viewFactory.getViewDefault.bind(this._viewFactory),e),this.setViewByParameters=e=>this._setViewGeneric(this._viewFactory.getViewByParameters.bind(this._viewFactory),e),this.setViewDefaultWithNewQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewDefault.bind(this._viewFactory),this._viewQueryExecutor.getNewQueryModifiers.bind(this._viewQueryExecutor),e),this.setViewByParametersWithNewQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewByParameters.bind(this._viewFactory),this._viewQueryExecutor.getNewQueryModifiers.bind(this._viewQueryExecutor),e),this.setViewByParametersWithExistingQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewByParameters.bind(this._viewFactory),this._viewQueryExecutor.getExistingQueryModifiers.bind(this._viewQueryExecutor),e),this.initialize=async()=>(this._api.getQueryStringManager().hasViewRelatedActionsToRun()||this.setViewDefaultWithNewQuery({failSafe:!0}),!0),this._api=e,this._viewFactory=t?.viewFactory??new bx(e),this._viewQueryExecutor=t?.viewQueryExecutor??new Ex(e)}getEpoch(){return this._epoch}_createEpoch(e){return{manager:this,...e&&{oldView:e}}}getView(){return this._view}hasView(){return!!this.getView()}reset(){this._view&&this._setView(null)}_setViewGeneric(e,t){let n=null;try{n=e({baseView:this._view,...t})}catch(e){this._api.getMessageManager().setErrorIfHigherPriority(e)}n&&this._setView(n)}_markViewLoadingQuery(e,t){return e.mergeInContext({loading:{query:t}})}_markViewAsNotLoadingQuery(e){return e.removeContextProperty("loading","query")}async _setViewThenModifyAsync(e,t,n){let a=null;try{a=e({baseView:this._view,...n,params:{query:null,queryResults:null,...n?.params}})}catch(e){this._api.getMessageManager().setErrorIfHigherPriority(e)}if(!a)return;if(this._view&&this._shouldAdoptQueryAndResults(a))return a.query=this._view.query,a.queryResults=this._view.queryResults,this._markViewAsNotLoadingQuery(a),void this._setView(a);const i=this._loadingIndex++;this._markViewLoadingQuery(a,i),this._setView(a);let r=null,o=null;try{r=await t(a,n?.queryExecutorOptions)}catch(e){o=e}if(this._view&&this.hasMajorMediaChange(this._view,a))return void(this._view.context?.loading?.query===i&&this._setView(this._markViewAsNotLoadingQuery(this._view.clone())));if(o)return void this._api.getMessageManager().setErrorIfHigherPriority(o); +/* istanbul ignore if: the if path cannot be reached as the view is set + above -- @preserve */if(!this._view)return;const s=this._view.clone();this._view.context?.loading?.query===i&&this._markViewAsNotLoadingQuery(s),_x(s,r),this._setView(s)}_shouldAdoptQueryAndResults(e){const t=this._view?.isViewerView()&&e?.isGalleryView(),n=e?.getDefaultMediaType(),a=px.getMediaType(this._view?.query)===n;return!!t&&a}setViewWithMergedContext(e){if(this._view)return this._setView(this._view?.clone().mergeInContext(e))}isViewSupportedByCamera(e,t){return!!mx(this._api.getCameraManager(),t,e).size}hasMajorMediaChange(e,t){const n=t??this._view;return!!e!=!!n||e?.view!==n?.view||e?.camera!==n?.camera||"live"===n?.view&&e&&My(e)!==My(n)||"live"!==n?.view&&e?.queryResults!==n?.queryResults}_setView(e){const t=this._view;B_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card view change: ",e),this._view=e,this._epoch=this._createEpoch(t),this.hasMajorMediaChange(t)&&this._api.getMediaLoadedInfoManager().clear(),t?.view!==e?.view&&this._api.getCardElementManager().scrollReset(),this._api.getMessageManager().reset(),this._api.getStyleManager().setExpandedMode(),this._api.getConditionsManager()?.setState({view:e?.view,camera:e?.camera,displayMode:e?.displayMode??void 0}),this._api.getCardElementManager().update()}}class Ax{constructor(e,t,n,a){this._deviceRegistryManager=new oy(new iy((e=>e.id))),this._entityRegistryManager=new ly(new iy((e=>e.entity_id))),this._resolvedMediaCache=new uy,this._actionsManager=new gb(this),this._automationsManager=new fb(this),this._cameraManager=new ay(this),this._cameraURLManager=new _b(this),this._configManager=new Mw(this),this._defaultManager=new kw(this),this._downloadManager=new Aw(this),this._expandManager=new zw(this),this._fullscreenManager=new Rw(this),this._hassManager=new Lw(this),this._initializationManager=new Zb(this),this._interactionManager=new Uw(this),this._keyboardStateManager=new Ww(this),this._mediaLoadedInfoManager=new ex(this),this._mediaPlayerManager=new nx(this),this._messageManager=new ax(this),this._microphoneManager=new ix(this),this._queryStringManager=new rx(this),this._statusBarItemManager=new ox(this),this._styleManager=new sx(this),this._triggersManager=new cx(this),this._viewManager=new $x(this),e.addController(this),this._conditionsManager=new yw(this,a),this._cardElementManager=new Qb(this,e,t,n)}getActionsManager(){return this._actionsManager}getAutomationsManager(){return this._automationsManager}getCameraManager(){return this._cameraManager}getCameraURLManager(){return this._cameraURLManager}getCardElementManager(){return this._cardElementManager}getConditionsManager(){return this._conditionsManager}static async getConfigElement(){return await import("./editor-13524f00.js"),document.createElement("frigate-card-editor")}getConfigManager(){return this._configManager}getDefaultManager(){return this._defaultManager}getDeviceRegistryManager(){return this._deviceRegistryManager}getDownloadManager(){return this._downloadManager}getEntityRegistryManager(){return this._entityRegistryManager}getExpandManager(){return this._expandManager}getFullscreenManager(){return this._fullscreenManager}getHASSManager(){return this._hassManager}getInitializationManager(){return this._initializationManager}getInteractionManager(){return this._interactionManager}getKeyboardStateManager(){return this._keyboardStateManager}getMediaLoadedInfoManager(){return this._mediaLoadedInfoManager}getMediaPlayerManager(){return this._mediaPlayerManager}getMessageManager(){return this._messageManager}getMicrophoneManager(){return this._microphoneManager}getQueryStringManager(){return this._queryStringManager}getResolvedMediaCache(){return this._resolvedMediaCache}getStatusBarItemManager(){return this._statusBarItemManager}static getStubConfig(e){return{cameras:[{camera_entity:e.find((e=>e.startsWith("camera.")))??"camera.demo"}]}}getStyleManager(){return this._styleManager}getTriggersManager(){return this._triggersManager}getViewManager(){return this._viewManager}hostConnected(){this.getCardElementManager().elementConnected()}hostDisconnected(){this.getCardElementManager().elementDisconnected()}}class zx{constructor(){this._dynamicMenuButtons=[]}addDynamicMenuButton(e){this._dynamicMenuButtons.includes(e)||this._dynamicMenuButtons.push(e)}removeDynamicMenuButton(e){this._dynamicMenuButtons=this._dynamicMenuButtons.filter((t=>t!=e))}calculateButtons(e,t,n,a){return[this._getDefaultButton(t),this._getCamerasButton(t,n,a?.view),this._getSubstreamsButton(t,n,a?.view),this._getLiveButton(t,a?.view,a?.viewManager),this._getClipsButton(t,a?.view,a?.viewManager),this._getSnapshotsButton(t,a?.view,a?.viewManager),this._getRecordingsButton(t,a?.view,a?.viewManager),this._getImageButton(t,a?.view,a?.viewManager),this._getTimelineButton(t,a?.view,a?.viewManager),this._getDownloadButton(t,n,a?.view),this._getCameraUIButton(t,a?.showCameraUIButton),this._getMicrophoneButton(t,a?.microphoneManager,a?.currentMediaLoadedInfo),this._getExpandButton(t,a?.inExpandedMode),this._getFullscreenButton(t,a?.inFullscreenMode),this._getCastButton(e,t,n,a?.view,a?.mediaPlayerController),this._getPlayPauseButton(t,a?.currentMediaLoadedInfo),this._getMuteUnmuteButton(t,a?.currentMediaLoadedInfo),this._getScreenshotButton(t,a?.currentMediaLoadedInfo),this._getDisplayModeButton(t,n,a?.view),this._getPTZControlsButton(t,n,a?.view),this._getPTZHomeButton(t,n,a?.view),...this._dynamicMenuButtons.map((e=>({style:this._getStyleFromActions(t,e,a),...e})))].filter(sf)}_getDefaultButton(e){return{icon:"frigate",...e.menu.buttons.frigate,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.frigate"),permanent:!0,tap_action:"hidden"===e.menu?.style?gf("menu_toggle"):gf("default"),hold_action:gf("diagnostics")}}_getCamerasButton(e,t,n){const a=t.getStore().getCameraIDsWithCapability("menu");if(a.size>1){const i=Array.from(t.getStore().getCameraConfigEntries(a),(([e,a])=>{const i=ff("camera_select",e),r=t.getCameraMetadata(e);return{enabled:!0,icon:r?.icon,entity:a.camera_entity,state_color:!0,title:r?.title,selected:n?.camera===e,...i&&{tap_action:i}}}));return{icon:"mdi:video-switch",...e.menu.buttons.cameras,type:"custom:frigate-card-menu-submenu",title:V_("config.menu.buttons.cameras"),items:i}}return null}_getSubstreamsButton(e,t,n){if(!n)return null;const a=t.getStore().getAllDependentCameras(n.camera,"substream");if(a.size&&n.is("live")){const i=[...a].filter((e=>e!==n.camera)),r=[n.camera,...i],o=My(n);if(2===r.length)return{icon:"mdi:video-input-component",style:o!==n.camera?this._getEmphasizedStyle():{},title:V_("config.menu.buttons.substreams"),...e.menu.buttons.substreams,type:"custom:frigate-card-menu-icon",tap_action:gf(ky(n)?"live_substream_off":"live_substream_on")};if(r.length>2){const a=Array.from(r,(e=>{const n=ff("live_substream_select",e),a=t.getCameraMetadata(e)??void 0,i=t.getStore().getCameraConfig(e);return{enabled:!0,icon:a?.icon,entity:i?.camera_entity,state_color:!0,title:a?.title,selected:o===e,...n&&{tap_action:n}}}));return{icon:"mdi:video-input-component",title:V_("config.menu.buttons.substreams"),style:o!==n.camera?this._getEmphasizedStyle():{},...e.menu.buttons.substreams,type:"custom:frigate-card-menu-submenu",items:a}}}return null}_getLiveButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"live")?{icon:"mdi:cctv",...e.menu.buttons.live,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.live"),style:t.is("live")?this._getEmphasizedStyle():{},tap_action:gf("live")}:null}_getClipsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"clips")?{icon:"mdi:filmstrip",...e.menu.buttons.clips,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.clips"),style:t?.is("clips")?this._getEmphasizedStyle():{},tap_action:gf("clips"),hold_action:gf("clip")}:null}_getSnapshotsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"snapshots")?{icon:"mdi:camera",...e.menu.buttons.snapshots,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.snapshots"),style:t?.is("snapshots")?this._getEmphasizedStyle():{},tap_action:gf("snapshots"),hold_action:gf("snapshot")}:null}_getRecordingsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"recordings")?{icon:"mdi:album",...e.menu.buttons.recordings,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.recordings"),style:t.is("recordings")?this._getEmphasizedStyle():{},tap_action:gf("recordings"),hold_action:gf("recording")}:null}_getImageButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"image")?{icon:"mdi:image",...e.menu.buttons.image,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.image"),style:t?.is("image")?this._getEmphasizedStyle():{},tap_action:gf("image")}:null}_getTimelineButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"timeline")?{icon:"mdi:chart-gantt",...e.menu.buttons.timeline,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.timeline"),style:t.is("timeline")?this._getEmphasizedStyle():{},tap_action:gf("timeline")}:null}_getDownloadButton(e,t,n){const a=n?.queryResults?.getSelectedResult(),i=a?t?.getMediaCapabilities(a):null;return n?.isViewerView()&&i?.canDownload&&!this._isBeingCasted()?{icon:"mdi:download",...e.menu.buttons.download,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.download"),tap_action:gf("download")}:null}_getCameraUIButton(e,t){return t?{icon:"mdi:web",...e.menu.buttons.camera_ui,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.camera_ui"),tap_action:gf("camera_ui")}:null}_getMicrophoneButton(e,t,n){if(t&&n?.capabilities?.supports2WayAudio){const n=t.isForbidden()||!t.isSupported(),a=t.isMuted(),i=e.menu.buttons.microphone.type;return{icon:n?"mdi:microphone-message-off":a?"mdi:microphone-off":"mdi:microphone",...e.menu.buttons.microphone,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.microphone"),style:n||a?{}:this._getEmphasizedStyle(!0),...!n&&"momentary"===i&&{start_tap_action:gf("microphone_unmute"),end_tap_action:gf("microphone_mute")},...!n&&"toggle"===i&&{tap_action:gf(a?"microphone_unmute":"microphone_mute")}}}return null}_getExpandButton(e,t){return{icon:t?"mdi:arrow-collapse-all":"mdi:arrow-expand-all",...e.menu.buttons.expand,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.expand"),tap_action:gf("expand"),style:t?this._getEmphasizedStyle():{}}}_getFullscreenButton(e,t){return this._isBeingCasted()?null:{icon:t?"mdi:fullscreen-exit":"mdi:fullscreen",...e.menu.buttons.fullscreen,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.fullscreen"),tap_action:gf("fullscreen"),style:t?this._getEmphasizedStyle():{}}}_getCastButton(e,t,n,a,i){if(!a)return null;const r=n.getStore().getCameraConfig(a.camera);if(i?.hasMediaPlayers()&&(a.isViewerView()||a.is("live")&&r?.camera_entity)){const n=i.getMediaPlayers().map((t=>{const n=Lb(e,t)||t,a=e.states[t],i=_f(t,"play"),r=_f(t,"stop"),o=!a||"unavailable"===a.state;return{enabled:!0,selected:!1,icon:Nb(e,t),entity:t,state_color:!1,title:n,disabled:o,...!o&&i&&{tap_action:i},...!o&&r&&{hold_action:r}}}));return{icon:"mdi:cast",...t.menu.buttons.media_player,type:"custom:frigate-card-menu-submenu",title:V_("config.menu.buttons.media_player"),items:n}}return null}_getPlayPauseButton(e,t){if(t&&t.player&&t.capabilities?.supportsPause){const n=t.player.isPaused();return{icon:n?"mdi:play":"mdi:pause",...e.menu.buttons.play,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.play"),tap_action:gf(n?"play":"pause")}}return null}_getMuteUnmuteButton(e,t){if(t&&t.player&&t?.capabilities?.hasAudio){const n=t.player.isMuted();return{icon:n?"mdi:volume-off":"mdi:volume-high",...e.menu.buttons.mute,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.mute"),tap_action:gf(n?"unmute":"mute")}}return null}_getScreenshotButton(e,t){return t&&t.player?{icon:"mdi:monitor-screenshot",...e.menu.buttons.screenshot,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.screenshot"),tap_action:gf("screenshot")}:null}_getDisplayModeButton(e,t,n){const a=n?mx(t,n.view):null;if(n?.supportsMultipleDisplayModes()&&a&&a.size>1){const t=n.isGrid();return{icon:t?"mdi:grid-off":"mdi:grid",...e.menu.buttons.display_mode,style:t?this._getEmphasizedStyle():{},type:"custom:frigate-card-menu-icon",title:V_(t?"display_modes.single":"display_modes.grid"),tap_action:(i=t?"single":"grid",{action:"fire-dom-event",frigate_card_action:"display_mode_select",display_mode:i,...r?.cardID&&{card_id:r.cardID}})}}var i,r;return null}_getPTZControlsButton(e,t,n){const a=n?.is("live")?e.live.controls.ptz:n?.isViewerView()?e.media_viewer.controls.ptz:null;if(!n||!a||"off"===a.mode)return null;const i=Ry(n,{cameraManager:t,..."auto"===a.mode&&{type:"ptz"}});if(i){const t=!1!==n.context?.ptzControls?.enabled&&("on"===a.mode||"auto"===a.mode&&"ptz"===i.type);return{icon:"mdi:pan",...e.menu.buttons.ptz_controls,style:t?this._getEmphasizedStyle():{},type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.ptz_controls"),tap_action:(r=!t,{action:"fire-dom-event",frigate_card_action:"ptz_controls",enabled:r,...o?.cardID&&{card_id:o.cardID}})}}var r,o;return null}_getPTZHomeButton(e,t,n){const a=n?Ry(n,{cameraManager:t}):null;return!a||(("digital"===a.type&&n?.context?.zoom?.[a.targetID]?.observed?.isDefault)??1)?null:{icon:"mdi:home",...e.menu.buttons.ptz_home,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.ptz_home"),tap_action:vf({targetID:a.targetID})}}_getEmphasizedStyle(e){return e?{animation:"pulse 3s infinite",color:"var(--error-color, white)"}:{color:"var(--primary-color, white)"}}_getStyleFromActions(e,t,n){for(const a of[t.tap_action,t.double_tap_action,t.hold_action,t.start_tap_action,t.end_tap_action]){const t=Array.isArray(a)?a:[a];for(const a of t){if(!a||"fire-dom-event"!==a.action||!("frigate_card_action"in a))continue;const t=a;if(Zs.some((e=>e===t.frigate_card_action&&n?.view?.is(t.frigate_card_action)))||"default"===t.frigate_card_action&&n?.view?.is(e.view.default)||"fullscreen"===t.frigate_card_action&&n?.inFullscreenMode||"camera_select"===t.frigate_card_action&&n?.view?.camera===t.camera)return this._getEmphasizedStyle()}}return{}}_isBeingCasted(){return!!navigator.userAgent.match(/CrKey\//)}} +/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */ +function Ix(e){return null==e}var Tx=function(e,t){var n,a="";for(n=0;ns&&(t=a-s+(r=" ... ").length),n-a>s&&(n=a+s-(o=" ...").length),{str:r+e.slice(t,n).replace(/\t/g,"→")+o,pos:a-t+r.length}}function Lx(e,t){return jx.repeat(" ",t-e.length)+e}var Nx=function(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),"number"!=typeof t.indent&&(t.indent=1),"number"!=typeof t.linesBefore&&(t.linesBefore=3),"number"!=typeof t.linesAfter&&(t.linesAfter=2);for(var n,a=/\r?\n|\r|\0/g,i=[0],r=[],o=-1;n=a.exec(e.buffer);)r.push(n.index),i.push(n.index+n[0].length),e.position<=n.index&&o<0&&(o=i.length-2);o<0&&(o=i.length-1);var s,c,l="",d=Math.min(e.line+t.linesAfter,r.length).toString().length,u=t.maxLength-(t.indent+d+3);for(s=1;s<=t.linesBefore&&!(o-s<0);s++)c=Px(e.buffer,i[o-s],r[o-s],e.position-(i[o]-i[o-s]),u),l=jx.repeat(" ",t.indent)+Lx((e.line-s+1).toString(),d)+" | "+c.str+"\n"+l;for(c=Px(e.buffer,i[o],r[o],e.position,u),l+=jx.repeat(" ",t.indent)+Lx((e.line+1).toString(),d)+" | "+c.str+"\n",l+=jx.repeat("-",t.indent+d+3+c.pos)+"^\n",s=1;s<=t.linesAfter&&!(o+s>=r.length);s++)c=Px(e.buffer,i[o+s],r[o+s],e.position-(i[o]-i[o+s]),u),l+=jx.repeat(" ",t.indent)+Lx((e.line+s+1).toString(),d)+" | "+c.str+"\n";return l.replace(/\n$/,"")},Fx=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],Vx=["scalar","sequence","mapping"];var Hx=function(e,t){if(t=t||{},Object.keys(t).forEach((function(t){if(-1===Fx.indexOf(t))throw new Rx('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')})),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=function(e){var t={};return null!==e&&Object.keys(e).forEach((function(n){e[n].forEach((function(e){t[String(e)]=n}))})),t}(t.styleAliases||null),-1===Vx.indexOf(this.kind))throw new Rx('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')};function Bx(e,t){var n=[];return e[t].forEach((function(e){var t=n.length;n.forEach((function(n,a){n.tag===e.tag&&n.kind===e.kind&&n.multi===e.multi&&(t=a)})),n[t]=e})),n}function qx(e){return this.extend(e)}qx.prototype.extend=function(e){var t=[],n=[];if(e instanceof Hx)n.push(e);else if(Array.isArray(e))n=n.concat(e);else{if(!e||!Array.isArray(e.implicit)&&!Array.isArray(e.explicit))throw new Rx("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit))}t.forEach((function(e){if(!(e instanceof Hx))throw new Rx("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(e.loadKind&&"scalar"!==e.loadKind)throw new Rx("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(e.multi)throw new Rx("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")})),n.forEach((function(e){if(!(e instanceof Hx))throw new Rx("Specified list of YAML types (or a single Type object) contains a non-Type object.")}));var a=Object.create(qx.prototype);return a.implicit=(this.implicit||[]).concat(t),a.explicit=(this.explicit||[]).concat(n),a.compiledImplicit=Bx(a,"implicit"),a.compiledExplicit=Bx(a,"explicit"),a.compiledTypeMap=function(){var e,t,n={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function a(e){e.multi?(n.multi[e.kind].push(e),n.multi.fallback.push(e)):n[e.kind][e.tag]=n.fallback[e.tag]=e}for(e=0,t=arguments.length;e=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),nC=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var aC=/^[-+]?[0-9]+e/;var iC=new Hx("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!nC.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||jx.isNegativeZero(e))},represent:function(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(jx.isNegativeZero(e))return"-0.0";return n=e.toString(10),aC.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"}),rC=Gx.extend({implicit:[Yx,Kx,tC,iC]}),oC=rC,sC=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),cC=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");var lC=new Hx("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==sC.exec(e)||null!==cC.exec(e))},construct:function(e){var t,n,a,i,r,o,s,c,l=0,d=null;if(null===(t=sC.exec(e))&&(t=cC.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],a=+t[2]-1,i=+t[3],!t[4])return new Date(Date.UTC(n,a,i));if(r=+t[4],o=+t[5],s=+t[6],t[7]){for(l=t[7].slice(0,3);l.length<3;)l+="0";l=+l}return t[9]&&(d=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(d=-d)),c=new Date(Date.UTC(n,a,i,r,o,s,l)),d&&c.setTime(c.getTime()-d),c},instanceOf:Date,represent:function(e){return e.toISOString()}});var dC=new Hx("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}}),uC="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";var hC=new Hx("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,a=0,i=e.length,r=uC;for(n=0;n64)){if(t<0)return!1;a+=6}return a%8==0},construct:function(e){var t,n,a=e.replace(/[\r\n=]/g,""),i=a.length,r=uC,o=0,s=[];for(t=0;t>16&255),s.push(o>>8&255),s.push(255&o)),o=o<<6|r.indexOf(a.charAt(t));return 0===(n=i%4*6)?(s.push(o>>16&255),s.push(o>>8&255),s.push(255&o)):18===n?(s.push(o>>10&255),s.push(o>>2&255)):12===n&&s.push(o>>4&255),new Uint8Array(s)},predicate:function(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)},represent:function(e){var t,n,a="",i=0,r=e.length,o=uC;for(t=0;t>18&63],a+=o[i>>12&63],a+=o[i>>6&63],a+=o[63&i]),i=(i<<8)+e[t];return 0===(n=r%3)?(a+=o[i>>18&63],a+=o[i>>12&63],a+=o[i>>6&63],a+=o[63&i]):2===n?(a+=o[i>>10&63],a+=o[i>>4&63],a+=o[i<<2&63],a+=o[64]):1===n&&(a+=o[i>>2&63],a+=o[i<<4&63],a+=o[64],a+=o[64]),a}}),pC=Object.prototype.hasOwnProperty,mC=Object.prototype.toString;var gC=new Hx("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,a,i,r,o=[],s=e;for(t=0,n=s.length;t>10),56320+(e-65536&1023))}for(var qC=new Array(256),UC=new Array(256),WC=0;WC<256;WC++)qC[WC]=HC(WC)?1:0,UC[WC]=HC(WC);function ZC(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||bC,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function QC(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=Nx(n),new Rx(t,n)}function GC(e,t){throw QC(e,t)}function YC(e,t){e.onWarning&&e.onWarning.call(null,QC(e,t))}var KC={YAML:function(e,t,n){var a,i,r;null!==e.version&&GC(e,"duplication of %YAML directive"),1!==n.length&&GC(e,"YAML directive accepts exactly one argument"),null===(a=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&GC(e,"ill-formed argument of the YAML directive"),i=parseInt(a[1],10),r=parseInt(a[2],10),1!==i&&GC(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=r<2,1!==r&&2!==r&&YC(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var a,i;2!==n.length&&GC(e,"TAG directive accepts exactly two arguments"),a=n[0],i=n[1],TC.test(a)||GC(e,"ill-formed tag handle (first argument) of the TAG directive"),wC.call(e.tagMap,a)&&GC(e,'there is a previously declared suffix for "'+a+'" tag handle'),jC.test(i)||GC(e,"ill-formed tag prefix (second argument) of the TAG directive");try{i=decodeURIComponent(i)}catch(t){GC(e,"tag prefix is malformed: "+i)}e.tagMap[a]=i}};function XC(e,t,n,a){var i,r,o,s;if(t1&&(e.result+=jx.repeat("\n",t-1))}function rM(e,t){var n,a,i=e.tag,r=e.anchor,o=[],s=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=o),a=e.input.charCodeAt(e.position);0!==a&&(-1!==e.firstTabInLine&&(e.position=e.firstTabInLine,GC(e,"tab characters must not be used in indentation")),45===a)&&PC(e.input.charCodeAt(e.position+1));)if(s=!0,e.position++,nM(e,!0,-1)&&e.lineIndent<=t)o.push(null),a=e.input.charCodeAt(e.position);else if(n=e.line,cM(e,t,MC,!1,!0),o.push(e.result),nM(e,!0,-1),a=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==a)GC(e,"bad indentation of a sequence entry");else if(e.lineIndentt?m=1:e.lineIndent===t?m=0:e.lineIndentt?m=1:e.lineIndent===t?m=0:e.lineIndentt)&&(_&&(o=e.line,s=e.lineStart,c=e.position),cM(e,t,kC,!0,i)&&(_?g=e.result:f=e.result),_||(eM(e,h,p,m,g,f,o,s,c),m=g=f=null),nM(e,!0,-1),l=e.input.charCodeAt(e.position)),(e.line===r||e.lineIndent>t)&&0!==l)GC(e,"bad indentation of a mapping entry");else if(e.lineIndent=0))break;0===i?GC(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):c?GC(e,"repeat of an indentation width identifier"):(l=t+i-1,c=!0)}if(RC(r)){do{r=e.input.charCodeAt(++e.position)}while(RC(r));if(35===r)do{r=e.input.charCodeAt(++e.position)}while(!DC(r)&&0!==r)}for(;0!==r;){for(tM(e),e.lineIndent=0,r=e.input.charCodeAt(e.position);(!c||e.lineIndentl&&(l=e.lineIndent),DC(r))d++;else{if(e.lineIndent0){for(i=o,r=0;i>0;i--)(o=NC(s=e.input.charCodeAt(++e.position)))>=0?r=(r<<4)+o:GC(e,"expected hexadecimal character");e.result+=BC(r),e.position++}else GC(e,"unknown escape sequence");n=a=e.position}else DC(s)?(XC(e,n,a,!0),iM(e,nM(e,!1,t)),n=a=e.position):e.position===e.lineStart&&aM(e)?GC(e,"unexpected end of the document within a double quoted scalar"):(e.position++,a=e.position)}GC(e,"unexpected end of the stream within a double quoted scalar")}(e,h)?f=!0:!function(e){var t,n,a;if(42!==(a=e.input.charCodeAt(e.position)))return!1;for(a=e.input.charCodeAt(++e.position),t=e.position;0!==a&&!PC(a)&&!LC(a);)a=e.input.charCodeAt(++e.position);return e.position===t&&GC(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),wC.call(e.anchorMap,n)||GC(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],nM(e,!0,-1),!0}(e)?function(e,t,n){var a,i,r,o,s,c,l,d,u=e.kind,h=e.result;if(PC(d=e.input.charCodeAt(e.position))||LC(d)||35===d||38===d||42===d||33===d||124===d||62===d||39===d||34===d||37===d||64===d||96===d)return!1;if((63===d||45===d)&&(PC(a=e.input.charCodeAt(e.position+1))||n&&LC(a)))return!1;for(e.kind="scalar",e.result="",i=r=e.position,o=!1;0!==d;){if(58===d){if(PC(a=e.input.charCodeAt(e.position+1))||n&&LC(a))break}else if(35===d){if(PC(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&aM(e)||n&&LC(d))break;if(DC(d)){if(s=e.line,c=e.lineStart,l=e.lineIndent,nM(e,!1,-1),e.lineIndent>=t){o=!0,d=e.input.charCodeAt(e.position);continue}e.position=r,e.line=s,e.lineStart=c,e.lineIndent=l;break}}o&&(XC(e,i,r,!1),iM(e,e.line-s),i=r=e.position,o=!1),RC(d)||(r=e.position+1),d=e.input.charCodeAt(++e.position)}return XC(e,i,r,!1),!!e.result||(e.kind=u,e.result=h,!1)}(e,h,xC===n)&&(f=!0,null===e.tag&&(e.tag="?")):(f=!0,null===e.tag&&null===e.anchor||GC(e,"alias node should not have any properties")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===m&&(f=s&&rM(e,p))),null===e.tag)null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);else if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&GC(e,'unacceptable node kind for ! tag; it should be "scalar", not "'+e.kind+'"'),c=0,l=e.implicitTypes.length;c"),null!==e.result&&u.kind!==e.kind&&GC(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+u.kind+'", not "'+e.kind+'"'),u.resolve(e.result,e.tag)?(e.result=u.construct(e.result,e.tag),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):GC(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||f}function lM(e){var t,n,a,i,r=e.position,o=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);0!==(i=e.input.charCodeAt(e.position))&&(nM(e,!0,-1),i=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==i));){for(o=!0,i=e.input.charCodeAt(++e.position),t=e.position;0!==i&&!PC(i);)i=e.input.charCodeAt(++e.position);for(a=[],(n=e.input.slice(t,e.position)).length<1&&GC(e,"directive name must not be less than one character in length");0!==i;){for(;RC(i);)i=e.input.charCodeAt(++e.position);if(35===i){do{i=e.input.charCodeAt(++e.position)}while(0!==i&&!DC(i));break}if(DC(i))break;for(t=e.position;0!==i&&!PC(i);)i=e.input.charCodeAt(++e.position);a.push(e.input.slice(t,e.position))}0!==i&&tM(e),wC.call(KC,n)?KC[n](e,n,a):YC(e,'unknown document directive "'+n+'"')}nM(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,nM(e,!0,-1)):o&&GC(e,"directives end mark is expected"),cM(e,e.lineIndent-1,kC,!1,!0),nM(e,!0,-1),e.checkLineBreaks&&zC.test(e.input.slice(r,e.position))&&YC(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&aM(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,nM(e,!0,-1)):e.position=55296&&a<=56319&&t+1=56320&&n<=57343?1024*(a-55296)+n-56320+65536:a}function JM(e){return/^\n* /.test(e)}var ek=1,tk=2,nk=3,ak=4,ik=5;function rk(e,t,n,a,i,r,o,s){var c,l=0,d=null,u=!1,h=!1,p=-1!==a,m=-1,g=function(e){return GM(e)&&e!==mM&&!QM(e)&&e!==EM&&e!==IM&&e!==$M&&e!==SM&&e!==jM&&e!==OM&&e!==RM&&e!==LM&&e!==wM&&e!==CM&&e!==kM&&e!==yM&&e!==PM&&e!==AM&&e!==zM&&e!==MM&&e!==bM&&e!==xM&&e!==TM&&e!==DM}(XM(e,0))&&function(e){return!QM(e)&&e!==$M}(XM(e,e.length-1));if(t||o)for(c=0;c=65536?c+=2:c++){if(!GM(l=XM(e,c)))return ik;g=g&&KM(l,d,s),d=l}else{for(c=0;c=65536?c+=2:c++){if((l=XM(e,c))===fM)u=!0,p&&(h=h||c-m-1>a&&" "!==e[m+1],m=c);else if(!GM(l))return ik;g=g&&KM(l,d,s),d=l}h=h||p&&c-m-1>a&&" "!==e[m+1]}return u||h?n>9&&JM(e)?ik:o?r===qM?ik:tk:h?ak:nk:!g||o||i(e)?r===qM?ik:tk:ek}function ok(e,t,n,a,i){e.dump=function(){if(0===t.length)return e.quotingType===qM?'""':"''";if(!e.noCompatMode&&(-1!==FM.indexOf(t)||VM.test(t)))return e.quotingType===qM?'"'+t+'"':"'"+t+"'";var r=e.indent*Math.max(1,n),o=-1===e.lineWidth?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-r),s=a||e.flowLevel>-1&&n>=e.flowLevel;switch(rk(t,s,e.indent,o,(function(t){return function(e,t){var n,a;for(n=0,a=e.implicitTypes.length;n"+sk(t,e.indent)+ck(WM(function(e,t){var n,a,i=/(\n+)([^\n]*)/g,r=(s=e.indexOf("\n"),s=-1!==s?s:e.length,i.lastIndex=s,lk(e.slice(0,s),t)),o="\n"===e[0]||" "===e[0];var s;for(;a=i.exec(e);){var c=a[1],l=a[2];n=" "===l[0],r+=c+(o||n||""===l?"":"\n")+lk(l,t),o=n}return r}(t,o),r));case ik:return'"'+function(e){for(var t,n="",a=0,i=0;i=65536?i+=2:i++)a=XM(e,i),!(t=NM[a])&&GM(a)?(n+=e[i],a>=65536&&(n+=e[i+1])):n+=t||HM(a);return n}(t)+'"';default:throw new Rx("impossible error: invalid scalar style")}}()}function sk(e,t){var n=JM(e)?String(t):"",a="\n"===e[e.length-1];return n+(a&&("\n"===e[e.length-2]||"\n"===e)?"+":a?"":"-")+"\n"}function ck(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function lk(e,t){if(""===e||" "===e[0])return e;for(var n,a,i=/ [^ ]/g,r=0,o=0,s=0,c="";n=i.exec(e);)(s=n.index)-r>t&&(a=o>r?o:s,c+="\n"+e.slice(r,a),r=a+1),o=s;return c+="\n",e.length-r>t&&o>r?c+=e.slice(r,o)+"\n"+e.slice(o+1):c+=e.slice(r),c.slice(1)}function dk(e,t,n,a){var i,r,o,s="",c=e.tag;for(i=0,r=n.length;i tag resolver accepts not "'+c+'" style');a=s.represent[c](t,c)}e.dump=a}return!0}return!1}function hk(e,t,n,a,i,r,o){e.tag=null,e.dump=n,uk(e,n,!1)||uk(e,n,!0);var s,c=hM.call(e.dump),l=a;a&&(a=e.flowLevel<0||e.flowLevel>t);var d,u,h="[object Object]"===c||"[object Array]"===c;if(h&&(u=-1!==(d=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||u||2!==e.indent&&t>0)&&(i=!1),u&&e.usedDuplicates[d])e.dump="*ref_"+d;else{if(h&&u&&!e.usedDuplicates[d]&&(e.usedDuplicates[d]=!0),"[object Object]"===c)a&&0!==Object.keys(e.dump).length?(!function(e,t,n,a){var i,r,o,s,c,l,d="",u=e.tag,h=Object.keys(n);if(!0===e.sortKeys)h.sort();else if("function"==typeof e.sortKeys)h.sort(e.sortKeys);else if(e.sortKeys)throw new Rx("sortKeys must be a boolean or a function");for(i=0,r=h.length;i1024)&&(e.dump&&fM===e.dump.charCodeAt(0)?l+="?":l+="? "),l+=e.dump,c&&(l+=ZM(e,t)),hk(e,t+1,s,!0,c)&&(e.dump&&fM===e.dump.charCodeAt(0)?l+=":":l+=": ",d+=l+=e.dump));e.tag=u,e.dump=d||"{}"}(e,t,e.dump,i),u&&(e.dump="&ref_"+d+e.dump)):(!function(e,t,n){var a,i,r,o,s,c="",l=e.tag,d=Object.keys(n);for(a=0,i=d.length;a1024&&(s+="? "),s+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),hk(e,t,o,!1,!1)&&(c+=s+=e.dump));e.tag=l,e.dump="{"+c+"}"}(e,t,e.dump),u&&(e.dump="&ref_"+d+" "+e.dump));else if("[object Array]"===c)a&&0!==e.dump.length?(e.noArrayIndent&&!o&&t>0?dk(e,t-1,e.dump,i):dk(e,t,e.dump,i),u&&(e.dump="&ref_"+d+e.dump)):(!function(e,t,n){var a,i,r,o="",s=e.tag;for(a=0,i=n.length;a",e.dump=s+" "+e.dump)}return!0}function pk(e,t){var n,a,i=[],r=[];for(mk(e,i,r),n=0,a=r.length;nq`
${fk.dump(e)}
`;return q`
+
+
+ +
+
+ + ${this.message?q`${this.message}${this.context&&"string"==typeof this.context?": "+this.context:""}`:""} + + ${this.context&&Array.isArray(this.context)?this.context.map((e=>n(e))):"object"==typeof this.context?n(this.context):""} +
+
+
`}static get styles(){return o(_k)}};e([he({attribute:!1})],vk.prototype,"message",void 0),e([he({attribute:!1})],vk.prototype,"context",void 0),e([he({attribute:!1})],vk.prototype,"icon",void 0),e([he({attribute:!0,type:Boolean})],vk.prototype,"dotdotdot",void 0),vk=e([le("frigate-card-message")],vk);let yk=class extends se{render(){if(this.message)return q` ${V_("error.troubleshooting")}.`} + .icon=${this.message.icon??"mdi:alert-circle"} + .context=${this.message.context} + .dotdotdot=${this.message.dotdotdot} + > + `}static get styles(){return o(_k)}};e([he({attribute:!1})],yk.prototype,"message",void 0),yk=e([le("frigate-card-error-message")],yk);let bk=class extends se{constructor(){super(...arguments),this.message="",this.animated=!1,this.size="large"}render(){return q`
+ ${this.animated?q` + `:q``} + ${this.message?q`${this.message}`:q``} +
`}static get styles(){return o(_k)}};function wk(e){return"error"===e?.type?q` `:e?q` `:q``}function xk(e){return q` + + + `}function Ck(e,t,n,a){Bg(e,"message",{message:t,type:n,icon:a?.icon,context:a?.context})}function Mk(e,t,n){Ck(e,t,"error",{context:n?.context})}function kk(e,t){t instanceof Error&&Mk(e,t.message,{...t instanceof zs&&{context:t.context}})}e([he({attribute:!1})],bk.prototype,"message",void 0),e([he({attribute:!1})],bk.prototype,"animated",void 0),e([he({attribute:!1})],bk.prototype,"size",void 0),bk=e([le("frigate-card-progress-indicator")],bk);let Sk=class extends se{constructor(){super(...arguments),this._root=null}createRenderRoot(){return this}_createRoot(){const e=customElements.get("hui-conditional-element");if(!e||!this.hass)throw new Error(V_("error.could_not_render_elements"));const t=new e;t.hass=this.hass;const n={type:"conditional",conditions:[],elements:this.elements};try{t.setConfig(n)}catch(e){throw Gg(e,console.error),new zs(V_("error.invalid_elements_config"))}return t}willUpdate(e){try{!this.elements||this._root&&!e.has("elements")||(this._root=this._createRoot())}catch(e){return kk(this,e)}}render(){return q`${this._root||""}`}updated(){this.hass&&this._root&&(this._root.hass=this.hass)}};e([he({attribute:!1})],Sk.prototype,"elements",void 0),e([he({attribute:!1})],Sk.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],Sk.prototype,"hass",void 0),Sk=e([le("frigate-card-elements-core")],Sk);let Ek=class extends se{constructor(){super(...arguments),this._menuRemoveHandler=e=>{Bg(this,"menu:remove",e.detail)},this._statusBarRemoveHandler=e=>{Bg(this,"status-bar:remove",e.detail)},this._menuAddHandler=e=>{const t=e.composedPath();t.length&&this._addHandler(t[0],"frigate-card:menu:remove",this._menuRemoveHandler)},this._statusBarAddHandler=e=>{const t=e.composedPath();t.length&&this._addHandler(t[0],"frigate-card:status-bar:add",this._statusBarRemoveHandler)}}_addHandler(e,t,n){e.removeEventListener(t,n),e.addEventListener(t,n)}connectedCallback(){super.connectedCallback(),this.addEventListener("frigate-card:menu:add",this._menuAddHandler),this.addEventListener("frigate-card:status-bar:add",this._statusBarAddHandler)}disconnectedCallback(){this.removeEventListener("frigate-card:menu:add",this._menuAddHandler),this.addEventListener("frigate-card:status-bar:add",this._statusBarAddHandler),super.disconnectedCallback()}render(){return q` + `}static get styles(){return o(":host {\n position: absolute;\n inset: 0;\n overflow: hidden;\n pointer-events: none;\n}\n\n.element {\n position: absolute;\n transform: translate(-50%, -50%);\n pointer-events: auto;\n}\n\nhui-error-card.element {\n inset: 0px;\n transform: unset;\n}")}};e([he({attribute:!1})],Ek.prototype,"hass",void 0),e([he({attribute:!1})],Ek.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],Ek.prototype,"elements",void 0),Ek=e([le("frigate-card-elements")],Ek);let $k=class extends se{setConfig(e){this._config=e}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.className=""}render(){if(function(e,t){if(!t)return!0;const n=new _w(t,{bubbles:!0,composed:!0});return e.dispatchEvent(n),n.evaluation??!1}(this,this._config?.conditions))return q` + `}};e([he({attribute:!1,hasChanged:()=>!0})],$k.prototype,"hass",void 0),$k=e([le("frigate-card-conditional")],$k);class Ak extends se{constructor(e){super(),this._config=null,this._eventCategory=e}setConfig(e){this._config=e}connectedCallback(){super.connectedCallback(),this._config&&Bg(this,`${this._eventCategory}:add`,this._config)}disconnectedCallback(){this._config&&Bg(this,`${this._eventCategory}:remove`,this._config),super.disconnectedCallback()}}e([pe()],Ak.prototype,"_config",void 0);class zk extends Ak{constructor(){super("menu")}}let Ik=class extends zk{};Ik=e([le("frigate-card-menu-icon")],Ik);let Tk=class extends zk{};Tk=e([le("frigate-card-menu-state-icon")],Tk);let jk=class extends zk{};jk=e([le("frigate-card-menu-submenu")],jk);let Ok=class extends zk{};Ok=e([le("frigate-card-menu-submenu-select")],Ok);class Dk extends Ak{constructor(){super("status-bar")}}let Rk=class extends Dk{};Rk=e([le("frigate-card-status-bar-icon")],Rk);let Pk=class extends Dk{};Pk=e([le("frigate-card-status-bar-image")],Pk);let Lk=class extends Dk{};Lk=e([le("frigate-card-status-bar-string")],Lk);let Nk=class extends se{render(){return q` `}static get styles(){return o(":host {\n width: intrinsic;\n height: intrinsic;\n display: flex;\n justify-content: center;\n align-items: center;\n pointer-events: none;\n}\n\nimg {\n width: 10%;\n animation: rotate 8s linear infinite;\n}\n\n@keyframes rotate {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}")}};Nk=e([le("frigate-card-loading")],Nk);const Fk=(e,t)=>{Bg(e,"action:execution-request",t)};class Vk{constructor(e){this._config=null,this._buttons=[],this._expanded=!1,this._host=e}setMenuConfig(e){this._config=e,this._host.style.setProperty("--frigate-card-menu-button-size",`${e.button_size}px`),this._host.setAttribute("data-style",e.style),this._host.setAttribute("data-position",e.position),this._host.setAttribute("data-alignment",e.alignment),this._sortButtons(),this._host.requestUpdate()}getMenuConfig(){return this._config}isExpanded(){return this._expanded}setButtons(e){this._buttons=e,this._sortButtons(),this._host.requestUpdate()}getButtons(e){const t=e=>!this._isHidingMenu()||this._expanded||!!e.permanent;return this._buttons.filter((n=>(e=>!1!==e.enabled)(n)&&(t=>t.alignment===e||"matching"===e&&!t.alignment)(n)&&t(n)))}setExpanded(e){this._expanded=e,of(this._host,e,"expanded"),this._host.requestUpdate()}toggleExpanded(){this.setExpanded(!this._expanded)}actionHandler(e,t){if(e.stopPropagation(),e.detail.config&&(t=e.detail.config),!t)return;const n=e.detail.action,a=yf(n,t);if(!a)return;const i=Wg(a);let r=!1;const o=i.filter((e=>sf(e)&&!this._isUnknownActionMenuToggleAction(e)));if(o.length!=i.length&&(r=!0),o.length&&Fk(this._host,{action:i,config:t}),this._isHidingMenu())if(r)this.setExpanded(!this._expanded);else{const e=yf("hold",t),a=yf("double_tap",t),i=yf("tap",t),r=yf("end_tap",t);"end_tap"!==n&&("start_tap"!==n||e||a||i||r)&&("end_tap"===n||r)||this.setExpanded(!1)}}getFreshButtonState(e,t){const n={...t};return e&&"custom:frigate-card-menu-state-icon"===t.type?Pb(e,n):n}_sortButtons(){this._buttons=Ev(this._buttons,(e=>(e.priority??0)+(this._isHidingMenu()&&e.permanent?Us:0)),["desc"])}_isHidingMenu(){return"hidden"===this._config?.style}_isUnknownActionMenuToggleAction(e){const t=mf(e);return!!t&&"menu_toggle"==t.frigate_card_action}}var Hk="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' version='1.1' id='svg54' sodipodi:docname='frigate.svg' inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3e %3cdefs id='defs58' /%3e %3csodipodi:namedview id='namedview56' pagecolor='%23da4040' bordercolor='%23666666' borderopacity='1.0' inkscape:pageshadow='2' inkscape:pageopacity='0' inkscape:pagecheckerboard='0' showgrid='false' width='24px' inkscape:zoom='45.254834' inkscape:cx='-0.03314563' inkscape:cy='9.9768347' inkscape:window-width='3840' inkscape:window-height='1527' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='svg54' showguides='true' inkscape:showpageshadow='2' inkscape:deskcolor='%23d1d1d1' /%3e %3cpath d='m 4.8759466%2c22.743573 c 0.0866%2c0.69274 0.811811%2c1.16359 0.37885%2c1.27183 -0.43297%2c0.10824 -2.32718%2c-3.43665 -2.7601492%2c-4.95202 -0.4329602%2c-1.51538 -0.6764993%2c-3.22017 -0.5682593%2c-4.19434 0.1082301%2c-0.97417 5.7097085%2c-2.48955 5.7097085%2c-2.89545 0%2c-0.4059 -1.81304%2c-0.0271 -1.89422%2c-0.35178 -0.0812%2c-0.32472 1.36925%2c-0.12989 1.75892%2c-0.64945 0.60885%2c-0.81181 1.3800713%2c-0.6765 1.8671505%2c-1.1094696 0.4870902%2c-0.4329599 1.0824089%2c-2.0836399 1.1906589%2c-2.7871996 0.108241%2c-0.70357 -1.0824084%2c-1.51538 -1.4071389%2c-2.05658 -0.3247195%2c-0.54121 0.7035702%2c-0.92005 3.1931099%2c-1.94834 2.48954%2c-1.02829 10.39114%2c-3.30134994 10.49938%2c-3.03074994 0.10824%2c0.27061 -2.59779%2c1.40713994 -4.492%2c2.11069994 -1.89422%2c0.70357 -4.97909%2c2.05658 -4.97909%2c2.43542 0%2c0.37885 0.16236%2c0.67651 0.0541%2c1.54244 -0.10824%2c0.86593 -0.12123%2c1.2702597 -0.32472%2c1.8400997 -0.1353%2c0.37884 -0.2706%2c1.27183 0%2c2.0836295 0.21648%2c0.64945 0.92005%2c1.13653 1.24477%2c1.24478 0.2706%2c0.018 1.01746%2c0.0433 1.8401%2c0 1.02829%2c-0.0541 2.48954%2c0.0541 2.48954%2c0.32472 0%2c0.2706 -2.21894%2c0.10824 -2.21894%2c0.48708 0%2c0.37885 2.27306%2c-0.0541 2.21894%2c0.32473 -0.0541%2c0.37884 -1.89422%2c0.21648 -2.86839%2c0.21648 -0.77933%2c0 -1.93031%2c-0.0361 -2.43542%2c-0.21648 l -0.10824%2c0.37884 c -0.18038%2c0 -0.55744%2c0.10824 -0.94711%2c0.10824 -0.48708%2c0 -0.51414%2c0.16236 -1.40713%2c0.16236 -0.892989%2c0 -0.622391%2c-0.0541 -1.4341894%2c-0.10824 -0.81181%2c-0.0541 -3.842561%2c2.27306 -4.383761%2c3.03075 -0.54121%2c0.75768 -0.21649%2c2.59778 -0.21649%2c3.43665 0%2c0.75379 -0.10824%2c2.43542 0%2c3.30135 z' fill='black' id='path330' style='fill:white%3bfill-opacity:1%3bstroke:none%3bstroke-width:0.1%3bstroke-miterlimit:4%3bstroke-dasharray:none%3bstroke-opacity:1' sodipodi:nodetypes='csccscccccsscscccccsscsccssccscc' /%3e%3c/svg%3e",Bk="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3c!-- Created with Inkscape (http://www.inkscape.org/) --%3e%3csvg id='svg2' version='1.1' inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' width='24' height='24' xml:space='preserve' sodipodi:docname='motioneye.svg' inkscape:export-filename='/home/ccrisan/projects/motioneye/static/img/motioneye-logo.png' inkscape:export-xdpi='960' inkscape:export-ydpi='960' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23' xmlns:cc='http://creativecommons.org/ns%23' xmlns:dc='http://purl.org/dc/elements/1.1/'%3e%3cmetadata id='metadata8'%3e%3crdf:RDF%3e%3ccc:Work rdf:about=''%3e%3cdc:format%3eimage/svg%2bxml%3c/dc:format%3e%3cdc:type rdf:resource='http://purl.org/dc/dcmitype/StillImage' /%3e%3c/cc:Work%3e%3c/rdf:RDF%3e%3c/metadata%3e%3cdefs id='defs6'%3e%3clinearGradient inkscape:collect='always' id='linearGradient2058'%3e%3cstop style='stop-color:white%3bstop-opacity:1%3b' offset='0' id='stop2054' /%3e%3cstop style='stop-color:%23585858%3bstop-opacity:1' offset='1' id='stop2056' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' id='linearGradient2005'%3e%3cstop style='stop-color:white%3bstop-opacity:1%3b' offset='0' id='stop2001' /%3e%3cstop style='stop-color:grey%3bstop-opacity:1%3b' offset='1' id='stop2003' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' id='linearGradient4205'%3e%3cstop style='stop-color:%234aa3e0%3bstop-opacity:1' offset='0' id='stop4207' /%3e%3cstop style='stop-color:%233096db%3bstop-opacity:1' offset='1' id='stop4209' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' id='linearGradient4197'%3e%3cstop style='stop-color:white%3bstop-opacity:1%3b' offset='0' id='stop4199' /%3e%3cstop style='stop-color:%23585858%3bstop-opacity:1' offset='1' id='stop4201' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient4205' id='linearGradient4211' x1='26.602072' y1='43.034946' x2='26.602072' y2='29.466328' gradientUnits='userSpaceOnUse' gradientTransform='matrix(0.96428571%2c0%2c0%2c0.96428571%2c0.91428571%2c0.91428571)' /%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4285'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4287' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4289' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.6' result='blur' id='feGaussianBlur4291' /%3e%3cfeOffset dx='0' dy='-1' result='offset' id='feOffset4293' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4295' /%3e%3c/filter%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient2005' id='linearGradient4309' gradientUnits='userSpaceOnUse' x1='26.445793' y1='47.517574' x2='26.445793' y2='3.8183768' /%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient4197' id='linearGradient4311' gradientUnits='userSpaceOnUse' x1='26.445793' y1='47.517574' x2='26.445793' y2='3.8183768' /%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient2058' id='linearGradient4313' gradientUnits='userSpaceOnUse' x1='26.445793' y1='47.517574' x2='26.445793' y2='3.8183768' /%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4315' x='-0.03618178' y='-0.20783284' width='1.0723636' height='1.3304883'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4317' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4319' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.6' result='blur' id='feGaussianBlur4321' /%3e%3cfeOffset dx='0' dy='-1' result='offset' id='feOffset4323' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4325' /%3e%3c/filter%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4327' x='-0.27857143' y='-0.4720238' width='1.5571429' height='1.7505952'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4329' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4331' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.6' result='blur' id='feGaussianBlur4333' /%3e%3cfeOffset dx='0' dy='-1' result='offset' id='feOffset4335' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4337' /%3e%3c/filter%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4339' x='-0.0202507' y='-0.13980794' width='1.0405014' height='1.2082853'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4341' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4343' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.2' result='blur' id='feGaussianBlur4345' /%3e%3cfeOffset dx='0' dy='-0.5' result='offset' id='feOffset4347' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4349' /%3e%3c/filter%3e%3c/defs%3e%3csodipodi:namedview pagecolor='%23ff0d0d' bordercolor='%23666666' borderopacity='1' objecttolerance='10' gridtolerance='10' guidetolerance='10' inkscape:pageopacity='0' inkscape:pageshadow='2' inkscape:window-width='3840' inkscape:window-height='1527' id='namedview4' showgrid='false' inkscape:zoom='29.890116' inkscape:cx='19.973158' inkscape:cy='16.577386' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='g10' showguides='true' inkscape:guide-bbox='true' inkscape:showpageshadow='true' inkscape:pagecheckerboard='false' inkscape:deskcolor='%23d1d1d1' /%3e%3cg id='g10' inkscape:groupmode='layer' inkscape:label='ink_ext_XXXXXX' transform='matrix(1.25%2c0%2c0%2c-1.25%2c0%2c64)'%3e%3cg id='g4823' transform='matrix(1.0344694%2c0%2c0%2c1.0344694%2c-3.551886%2c-0.86695248)'%3e%3cpath id='path4244' d='M 8.9346154%2c40.515385 C 5.3647588%2c36.547307 3.2%2c31.357779 3.2%2c25.6 3.2%2c13.228821 13.228821%2c3.2 25.6%2c3.2 37.971179%2c3.2 48%2c13.228821 48%2c25.6 c 0%2c5.736682 -2.161128%2c10.952493 -5.707692%2c14.915385 -1.695935%2c-0.623286 -3.387833%2c-1.349065 -5.061539%2c-2.288462 3.2394%2c-0.937363 5.6%2c-3.937988 5.6%2c-7.457692 0%2c-4.260339 -3.469626%2c-7.753846 -7.753846%2c-7.753846 -3.633936%2c0 -6.690552%2c2.51055 -7.538461%2c5.869231 h -3.876924 c -0.840685%2c-3.360193 -3.903443%2c-5.869231 -7.538461%2c-5.869231 -4.284219%2c0 -7.7807693%2c3.493507 -7.7807693%2c7.753846 0%2c3.56112 2.4570323%2c6.5856 5.7615383%2c7.484616 -1.676267%2c0.912203 -3.404813%2c1.620556 -5.1692306%2c2.261538 z M 25.6%2c26.461538 c 0.532632%2c-1.981435 1.101793%2c-3.947553 3.446154%2c-5.16923 L 25.6%2c16.123077 22.153846%2c21.292308 c 2.053593%2c1.454966 3.000771%2c3.237758 3.446154%2c5.16923 z' style='fill:url(%23linearGradient4309)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4327)' inkscape:connector-curvature='0' transform='matrix(0.38078533%2c0%2c0%2c0.38078533%2c2.9655495%2c31.335499)' /%3e%3cpath id='path4242' d='m 16.123077%2c33.353847 c -1.427443%2c0 -2.584616%2c-1.157173 -2.584616%2c-2.584616 0%2c-1.427444 1.157173%2c-2.584615 2.584616%2c-2.584615 1.427444%2c0 2.584615%2c1.157171 2.584615%2c2.584615 0%2c1.427443 -1.157171%2c2.584616 -2.584615%2c2.584616 z' style='fill:url(%23linearGradient4311)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4327)' inkscape:connector-curvature='0' transform='matrix(0.38078533%2c0%2c0%2c0.38078533%2c2.9655495%2c31.335499)' /%3e%3cpath id='path4240' d='m 35.076923%2c33.353847 c -1.427443%2c0 -2.584615%2c-1.157173 -2.584615%2c-2.584616 0%2c-1.427444 1.157172%2c-2.584615 2.584615%2c-2.584615 1.427443%2c0 2.584616%2c1.157171 2.584616%2c2.584615 0%2c1.427443 -1.157173%2c2.584616 -2.584616%2c2.584616 z' style='fill:url(%23linearGradient4313)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4327)' inkscape:connector-curvature='0' transform='matrix(0.38078533%2c0%2c0%2c0.38078533%2c2.9655495%2c31.335499)' /%3e%3cpath inkscape:connector-curvature='0' style='fill:%23d9d9d9%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4339)' d='m 25.6%2c47.2 c -4.373944%2c0 -8.437159%2c-1.399808 -11.838461%2c-3.634616 3.677605%2c-0.394237 7.305921%2c-1.342945 11.423077%2c-3.375 4.166157%2c2.122533 8.434154%2c3.008875 12.279808%2c3.452886 C 34.057131%2c45.890032 29.986674%2c47.2 25.6%2c47.2 Z' id='path4248' transform='matrix(0.39488848%2c0%2c0%2c0.39488848%2c2.6045087%2c30.974457)' /%3e%3cpath inkscape:connector-curvature='0' style='fill:url(%23linearGradient4211)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4315)' d='M 39.723077%2c42.552884 C 35.394064%2c42.5242 29.479588%2c40.397223 25.184616%2c38.432418 20.668821%2c40.064102 16.035448%2c42.649343 10.801923%2c42.526924 10.453022%2c42.51873 10.118061%2c42.50105 9.7634616%2c42.475 L 5.6615384%2c42.1375 9.5557693%2c40.839424 c 5.3417977%2c-1.74056 10.0398397%2c-2.851302 14.1749997%2c-10.025963 0.959101%2c0 2.845924%2c-4.15e-4 3.738462%2c-4.15e-4 4.11884%2c7.134039 9.059296%2c8.324614 14.149039%2c10.026378 L 45.460577%2c42.085577 41.4625%2c42.475 c -0.544847%2c0.05181 -1.120992%2c0.08198 -1.739423%2c0.07788 z' id='path4246' sodipodi:nodetypes='cccccccccccc' transform='matrix(0.39488848%2c0%2c0%2c0.39488848%2c2.6045087%2c30.974457)' /%3e%3c/g%3e%3c/g%3e%3c/svg%3e",qk="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3c!-- Created with Inkscape (http://www.inkscape.org/) --%3e%3csvg version='1.1' id='svg62' width='24' height='24' viewBox='0 0 24 24' sodipodi:docname='reolink.svg' inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3e %3cdefs id='defs66' /%3e %3csodipodi:namedview id='namedview64' pagecolor='%23505050' bordercolor='%23eeeeee' borderopacity='1' inkscape:showpageshadow='0' inkscape:pageopacity='0' inkscape:pagecheckerboard='0' inkscape:deskcolor='%23505050' showgrid='true' inkscape:zoom='36.417984' inkscape:cx='18.191562' inkscape:cy='8.6633022' inkscape:window-width='3840' inkscape:window-height='1527' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='g68'%3e %3cinkscape:grid type='xygrid' id='grid1175' dotted='false' snapvisiblegridlinesonly='true' /%3e %3c/sodipodi:namedview%3e %3cg inkscape:groupmode='layer' inkscape:label='Reolink Logo' id='g68'%3e %3cpath style='fill:white%3bstroke-width:0.0393282%3bfill-opacity:1' d='M 17.037254%2c23.964909 C 16.764634%2c23.917573 16.561708%2c23.83617 16.325735%2c23.67954 16.196719%2c23.593913 14.543544%2c21.952905 12.217956%2c19.602014 10.077426%2c17.438191 8.2198993%2c15.582673 8.0901166%2c15.478642 7.6038998%2c15.088895 7.0877741%2c14.869424 6.4986827%2c14.801908 6.3140805%2c14.780765 5.079061%2c14.763305 3.7541964%2c14.763126 l -2.408845%2c-4.78e-4 0.00713%2c-7.3937713 v -7.3935985 l 6.2040046%2c3.536e-5 c 3.9799342%2c1.969e-5 6.3590882%2c0.01465833 6.6366112%2c0.0408227 2.331195%2c0.21982024 4.364771%2c1.49885914 5.578726%2c3.50085534 0.686043%2c1.1313823 1.020901%2c2.2783695 1.067186%2c3.6554196 0.06335%2c1.8844953 -0.57426%2c3.6597378 -1.831469%2c5.0992438 -0.756457%2c0.866146 -1.861127%2c1.62991 -2.928729%2c2.024919 l -0.319718%2c0.118287 -1.951287%2c-1.979284 -1.951286%2c-1.979278 1.046741%2c-0.02346 c 0.575706%2c-0.01291 1.099833%2c-0.03689 1.164724%2c-0.0533 0.596068%2c-0.150649 0.949703%2c-0.313968 1.322206%2c-0.6106282 0.643573%2c-0.5125401 1.046169%2c-1.2439257 1.137985%2c-2.0673522 0.167852%2c-1.505317 -0.771478%2c-2.8704888 -2.263547%2c-3.2897068 L 13.950001%2c4.3234481 9.7981831%2c4.3106846 5.6392389%2c4.29801 v 3.0692702 3.0692648 l 1.4185165%2c7.9e-4 c 1.6275801%2c8.87e-4 1.7789152%2c0.01912 2.3105245%2c0.27984 0.3095679%2c0.15183 0.389559%2c0.219499 1.0817441%2c0.915083 3.027399%2c3.042274 12.19404%2c12.30837 12.204589%2c12.337002 0.0161%2c0.04373 -5.364393%2c0.03953 -5.617359%2c-0.0045 z' id='path1173' inkscape:label='R' /%3e %3c/g%3e%3c/svg%3e";const Uk=e=>{switch(e){case"frigate":return Hk;case"motioneye":return Bk;case"reolink":return qk;default:return null}};const Wk=(e,t,n)=>{const a=e.states[t],i=n?.state?n.state:a?a.state:null;if(!i)return null;const r=Ye(t),o=a?a.attributes:null;return n?.entity?.translation_key&&e.localize(`component.${n.entity.platform}.entity.${r}.${n.entity.translation_key}.state.${i}`)||o?.device_class&&e.localize(`component.${r}.state.${o.device_class}.${i}`)||e.localize(`component.${r}.state._.${i}`)||i};let Zk=class extends se{_renderItem(e){if(!this.hass)return;const t=Pb(this.hass,{...e});return q` + {t.detail.config=e}} + .actionHandler=${kf({hasHold:bf(e.hold_action),hasDoubleClick:bf(e.double_tap_action)})} + > + ${t.title||""} + ${e.subtitle?q`${e.subtitle}`:""} + ${(e=>{if(e.icon){const t=Uk(e.icon);return t?q``:q` + `}return q``})(t)} + + `}render(){if(!this.submenu)return q``;const e=this.submenu.items;return q` + e.stopPropagation()} + @click=${e=>wf(e)} + > + + + + ${e.map(this._renderItem.bind(this))} + + `}static get styles(){return o("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n pointer-events: auto;\n}\n\nmwc-list-item {\n z-index: 20;\n}")}};e([he({attribute:!1})],Zk.prototype,"hass",void 0),e([he({attribute:!1})],Zk.prototype,"submenu",void 0),Zk=e([le("frigate-card-submenu")],Zk);let Qk=class extends se{shouldUpdate(e){const t=e.get("hass");return!e.has("hass")||!t||!this.submenuSelect||jb(this.hass,t,[this.submenuSelect.entity])}async _refreshOptionTitles(){if(!this.hass||!this.submenuSelect)return;const e=this.submenuSelect.entity,t=this.hass.states[e],n=t?.attributes?.options,a=await(this.entityRegistryManager?.getEntity(this.hass,e))??null,i={};for(const t of n){const n=Wk(this.hass,e,{...a&&{entity:a},state:t});n&&(i[t]=n)}this._optionTitles=i}willUpdate(){if(!this.submenuSelect||!this.hass)return;this._optionTitles||this._refreshOptionTitles();const e=this.submenuSelect.entity,t=this.hass.states[e],n=t?.attributes?.options;if(!t||!n)return;const a={icon:zb("select"),...Pb(this.hass,this.submenuSelect),...this.submenuSelect,type:"custom:frigate-card-menu-submenu",items:[]};delete a.options;const i=a.items;for(const a of n){const n=this._optionTitles?.[a]??a;i.push({state_color:!0,selected:t.state===a,enabled:!0,title:n||a,...(e.startsWith("select.")||e.startsWith("input_select."))&&{tap_action:{action:"perform-action",perform_action:e.startsWith("select.")?"select.select_option":"input_select.select_option",target:{entity_id:e},data:{option:a}}},...this.submenuSelect.options&&this.submenuSelect.options[a]})}this._generatedSubmenu=a}render(){return q` `}};e([he({attribute:!1})],Qk.prototype,"hass",void 0),e([he({attribute:!1})],Qk.prototype,"submenuSelect",void 0),e([he({attribute:!1})],Qk.prototype,"entityRegistryManager",void 0),e([pe()],Qk.prototype,"_optionTitles",void 0),Qk=e([le("frigate-card-submenu-select")],Qk);let Gk=class extends se{constructor(){super(...arguments),this._controller=new Vk(this)}set menuConfig(e){this._controller.setMenuConfig(e)}set buttons(e){this._controller.setButtons(e)}set expanded(e){this._controller.setExpanded(e)}toggleMenu(){this._controller.toggleExpanded()}_renderButton(e){if(!this.hass)return;if("custom:frigate-card-menu-submenu"===e.type)return q` this._controller.actionHandler(e)} + > + `;if("custom:frigate-card-menu-submenu-select"===e.type)return q` this._controller.actionHandler(e)} + > + `;const t=this._controller.getFreshButtonState(this.hass,e),n=Uk(t.icon);return q` this._controller.actionHandler(t,e)} + > + ${n?q``:q``} + `}render(){const e=this._controller.getMenuConfig(),t=e?.style;if(!e||"none"===t)return;const n=this._controller.getButtons("matching"),a=this._controller.getButtons("opposing");return q`
+ ${n.map((e=>this._renderButton(e)))} +
+
+ ${a.map((e=>this._renderButton(e)))} +
`}static get styles(){return o('ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n --frigate-card-menu-button-size: 40px;\n --mdc-icon-button-size: var(--frigate-card-menu-button-size);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n pointer-events: auto;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n}\n\n/*******************************************************\n * Non-hover styles should not interact with the pointer\n *******************************************************/\n:host(:not([data-style*=hover])) {\n pointer-events: none;\n}\n\n/***********************************\n * Aligned divs: matching & opposing\n ***********************************/\ndiv.matching,\ndiv.opposing {\n display: flex;\n flex-wrap: wrap;\n flex-direction: row;\n align-items: flex-start;\n min-width: 0px;\n min-height: 0px;\n}\n\ndiv.matching {\n justify-content: flex-start;\n}\n\ndiv.opposing {\n justify-content: flex-end;\n}\n\n/********************\n * Outside menu style\n ********************/\n:host([data-style=outside]) {\n width: 100%;\n background: var(--secondary-background-color);\n}\n\n/********************************************************\n * Hack: Ensure host & div expand for column flex layouts\n ********************************************************/\n:host(:not([data-style=outside])[data-position=left]) {\n writing-mode: vertical-lr;\n}\n\n:host(:not([data-style=outside])[data-position=right]) {\n writing-mode: vertical-rl;\n}\n\n:host(:not([data-style=outside])[data-style=overlay][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style=overlay][data-position=right]) div > *,\n:host(:not([data-style=outside])[data-style*=hover][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style*=hover][data-position=right]) div > *,\n:host(:not([data-style=outside])[data-style=hidden][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style=hidden][data-position=right]) div > * {\n writing-mode: horizontal-tb;\n}\n\n/**********************\n * "Reverse" alignments\n **********************/\n:host(:not([data-style=outside])[data-position=left][data-alignment=bottom]),\n:host(:not([data-style=outside])[data-position=right][data-alignment=bottom]),\n:host([data-position=top][data-alignment=right]),\n:host([data-position=bottom][data-alignment=right]),\n:host(:not([data-style=outside])[data-position=left][data-alignment=bottom]) div,\n:host(:not([data-style=outside])[data-position=right][data-alignment=bottom]) div,\n:host([data-position=top][data-alignment=right]) div,\n:host([data-position=bottom][data-alignment=right]) div {\n flex-direction: row-reverse;\n}\n\n/****************************\n * Wrap upwards on the bottom\n ****************************/\n:host(:not([data-style=outside])[data-position=bottom]) div {\n flex-wrap: wrap-reverse;\n}\n\n/********************************************\n * Positioning for absolute based menu styles\n ********************************************/\n:host([data-style=overlay]),\n:host([data-style*=hover]),\n:host([data-style=hidden]) {\n overflow: hidden;\n width: calc(var(--frigate-card-menu-button-size) + 6px);\n height: calc(var(--frigate-card-menu-button-size) + 6px);\n}\n\n:host([data-style=overlay]),\n:host([data-style*=hover]),\n:host([data-style=hidden][expanded]) {\n overflow: visible;\n}\n\n:host([data-style=overlay][data-position=top]),\n:host([data-style=overlay][data-position=bottom]),\n:host([data-style*=hover][data-position=top]),\n:host([data-style*=hover][data-position=bottom]),\n:host([data-style=hidden][data-position=top]),\n:host([data-style=hidden][data-position=bottom]) {\n width: 100%;\n height: auto;\n}\n\n:host([data-style=overlay][data-position=top][data-alignment=left]),\n:host([data-style=overlay][data-position=bottom][data-alignment=left]),\n:host([data-style*=hover][data-position=top][data-alignment=left]),\n:host([data-style*=hover][data-position=bottom][data-alignment=left]),\n:host([data-style=hidden][data-position=top][data-alignment=left][expanded]),\n:host([data-style=hidden][data-position=bottom][data-alignment=left][expanded]) {\n background: linear-gradient(90deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=top][data-alignment=right]),\n:host([data-style=overlay][data-position=bottom][data-alignment=right]),\n:host([data-style*=hover][data-position=top][data-alignment=right]),\n:host([data-style*=hover][data-position=bottom][data-alignment=right]),\n:host([data-style=hidden][data-position=top][data-alignment=right][expanded]),\n:host([data-style=hidden][data-position=bottom][data-alignment=right][expanded]) {\n background: linear-gradient(270deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=left]),\n:host([data-style=overlay][data-position=right]),\n:host([data-style*=hover][data-position=left]),\n:host([data-style*=hover][data-position=right]),\n:host([data-style=hidden][data-position=left]),\n:host([data-style=hidden][data-position=right]) {\n width: auto;\n height: 100%;\n}\n\n:host([data-style=overlay][data-position=left][data-alignment=top]),\n:host([data-style=overlay][data-position=right][data-alignment=top]),\n:host([data-style*=hover][data-position=left][data-alignment=top]),\n:host([data-style*=hover][data-position=right][data-alignment=top]),\n:host([data-style=hidden][data-position=left][data-alignment=top][expanded]),\n:host([data-style=hidden][data-position=right][data-alignment=top][expanded]) {\n background: linear-gradient(180deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=left][data-alignment=bottom]),\n:host([data-style=overlay][data-position=right][data-alignment=bottom]),\n:host([data-style*=hover][data-position=left][data-alignment=bottom]),\n:host([data-style*=hover][data-position=right][data-alignment=bottom]),\n:host([data-style=hidden][data-position=left][data-alignment=bottom][expanded]),\n:host([data-style=hidden][data-position=right][data-alignment=bottom][expanded]) {\n background: linear-gradient(0deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}')}};e([he({attribute:!1})],Gk.prototype,"entityRegistryManager",void 0),e([he({attribute:!1})],Gk.prototype,"hass",void 0),Gk=e([le("frigate-card-menu")],Gk);let Yk=class extends se{render(){return q` + + + + + `}static get styles(){return o("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n position: absolute;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n\nslot {\n position: absolute;\n display: flex;\n}\n\n/***************\n * Slot position\n ***************/\nslot[name=top] {\n top: 0px;\n}\n\nslot[name=bottom] {\n bottom: 0px;\n}\n\nslot[name=left] {\n left: 0px;\n}\n\nslot[name=right] {\n right: 0px;\n}\n\n/***********\n * Slot size\n ***********/\nslot[name=top],\nslot[name=bottom] {\n width: 100%;\n flex-direction: column;\n}\n\nslot[name=left],\nslot[name=right] {\n height: 100%;\n flex-direction: row;\n}\n\nslot[name=top],\nslot[name=left] {\n justify-content: flex-start;\n}\n\nslot[name=bottom],\nslot[name=right] {\n justify-content: flex-end;\n}\n\n/*******************************\n * Match rounded corners to card\n *******************************/\n::slotted([slot=top]:first-child),\n::slotted([slot=left]:first-child) {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=top]:first-child),\n::slotted([slot=right]:first-child) {\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=bottom]:last-child),\n::slotted([slot=left]:last-child) {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=bottom]:last-child),\n::slotted([slot=right]:last-child) {\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}")}};Yk=e([le("frigate-card-overlay")],Yk);class Kk{constructor(e){this._config=null,this._popupTimer=new xf,this._items=[],this._host=e}getRenderItems(){return this._items}setItems(e){const t=e.filter((e=>!!e.exclusive)),n=Ev(t.length?t:e,(e=>e.priority??50),"desc"),a=this._getSufficientValues(this._items),i=this._getSufficientValues(n);this._items=n,"popup"!==this._config?.style||Dv(a,i)||(this._show(),this._popupTimer.start(this._config.popup_seconds,(()=>this._hide()))),this._host.requestUpdate()}setConfig(e){this._config=e,this._host.style.setProperty("--frigate-card-status-bar-height",`${e.height}px`),this._host.setAttribute("data-style",e.style),this._host.setAttribute("data-position",e.position),"popup"!==this._config?.style&&this._show(),this._host.requestUpdate()}shouldRender(){return this._items.some((e=>!1!==e.enabled&&e.sufficient))}actionHandler(e,t){e.stopPropagation();const n=yf(e.detail.action,t);n&&Fk(this._host,{action:Wg(n),config:t})}_getSufficientValue(e){ +/* istanbul ignore else: cannot happen -- @preserve */ +return"custom:frigate-card-status-bar-icon"===e.type?e.icon:"custom:frigate-card-status-bar-string"===e.type?e.string:"custom:frigate-card-status-bar-image"===e.type?e.image:null}_getSufficientValues(e){return e.filter((e=>!1!==e.enabled&&e.sufficient)).map((e=>this._getSufficientValue(e)))}_show(){of(this._host,!1,"hide")}_hide(){of(this._host,!0,"hide")}}let Xk=class extends se{constructor(){super(...arguments),this._controller=new Kk(this)}willUpdate(e){e.has("config")&&this.config&&this._controller.setConfig(this.config),e.has("items")&&this._controller.setItems(this.items??[])}render(){if(this._controller.shouldRender())return q` +
+ ${this._controller.getRenderItems().map((e=>{if(!1===e.enabled)return;const t=_e({item:!0,expand:!!e.expand,action:!!Object.keys(e.actions??{}).length}),n=kf({hasHold:bf(e.actions?.hold_action),hasDoubleClick:bf(e.actions?.double_tap_action)});if("custom:frigate-card-status-bar-string"===e.type)return q`
this._controller.actionHandler(t,e.actions)} + > + ${e.string} +
`;if("custom:frigate-card-status-bar-icon"===e.type){const a=Uk(e.icon);return a?q`this._controller.actionHandler(t,e.actions)} + />`:q`this._controller.actionHandler(t,e.actions)} + >`}return"custom:frigate-card-status-bar-image"===e.type?q`this._controller.actionHandler(t,e.actions)} + />`:void 0}))} +
+ `}static get styles(){return o("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n --mdc-icon-button-size: calc(var(--frigate-card-status-bar-height) - 6px);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n display: block;\n width: 100%;\n pointer-events: auto;\n opacity: 1;\n transition: opacity 1s;\n}\n\n/*******************************************************\n * Non-hover styles should not interact with the pointer\n *******************************************************/\n:host(:not([data-style*=hover])) {\n pointer-events: none;\n}\n\n/***************\n * Outside style\n ***************/\n:host([data-style=outside]) {\n color: var(--primary-text-color);\n background: var(--secondary-background-color);\n}\n\n/*******************\n * Non-outside style\n *******************/\n:host(:not([data-style=outside])) {\n color: white;\n background: linear-gradient(90deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=popup][hide]) {\n opacity: 0;\n}\n\n/*********************\n * Status bar contents\n *********************/\n.status {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n overflow: hidden;\n width: 100%;\n height: var(--frigate-card-status-bar-height);\n}\n\n.item {\n display: inline-block;\n margin: 3px;\n padding: 3px;\n align-content: center;\n opacity: 0.7;\n}\n\n.item:first-child {\n margin-left: 10px;\n}\n\n.item:last-child {\n margin-right: 10px;\n}\n\n.item.expand {\n flex: 1;\n}\n\n.item.action {\n cursor: pointer;\n}\n\nimg.item {\n width: var(--mdc-icon-size, 24px);\n height: var(--mdc-icon-size, 24px);\n}")}};e([he({attribute:!1})],Xk.prototype,"items",void 0),e([he({attribute:!1})],Xk.prototype,"config",void 0),Xk=e([le("frigate-card-status-bar")],Xk);function Jk(e){return"number"==typeof e}function eS(e){return"string"==typeof e}function tS(e){return"boolean"==typeof e}function nS(e){return"[object Object]"===Object.prototype.toString.call(e)}function aS(e){return Math.abs(e)}function iS(e){return Math.sign(e)}function rS(e,t){return aS(e-t)}function oS(e){return uS(e).map(Number)}function sS(e){return e[cS(e)]}function cS(e){return Math.max(0,e.length-1)}function lS(e,t){return t===cS(e)}function dS(e,t=0){return Array.from(Array(e),((e,n)=>t+n))}function uS(e){return Object.keys(e)}function hS(e,t){return[e,t].reduce(((e,t)=>(uS(t).forEach((n=>{const a=e[n],i=t[n],r=nS(a)&&nS(i);e[n]=r?hS(a,i):i})),e)),{})}function pS(e,t){return void 0!==t.MouseEvent&&e instanceof t.MouseEvent}function mS(){let e=[];const t={add:function(n,a,i,r={passive:!0}){let o;if("addEventListener"in n)n.addEventListener(a,i,r),o=()=>n.removeEventListener(a,i,r);else{const e=n;e.addListener(i),o=()=>e.removeListener(i)}return e.push(o),t},clear:function(){e=e.filter((e=>e()))}};return t}function gS(e,t,n,a){const i=mS(),r=1e3/60;let o=null,s=0,c=0;function l(e){if(!c)return;o||(o=e);const i=e-o;for(o=e,s+=i;s>=r;)n(r),s-=r;a(s/r),c&&t.requestAnimationFrame(l)}function d(){t.cancelAnimationFrame(c),o=null,s=0,c=0}return{init:function(){i.add(e,"visibilitychange",(()=>{e.hidden&&(o=null,s=0)}))},destroy:function(){d(),i.clear()},start:function(){c||(c=t.requestAnimationFrame(l))},stop:d,update:()=>n(r),render:a}}function fS(e=0,t=0){const n=aS(e-t);function a(t){return tt}function r(e){return a(e)||i(e)}const o={length:n,max:t,min:e,constrain:function(n){return r(n)?a(n)?e:t:n},reachedAny:r,reachedMax:i,reachedMin:a,removeOffset:function(e){return n?e-n*Math.ceil((e-t)/n):e}};return o}function _S(e,t,n){const{constrain:a}=fS(0,e),i=e+1;let r=o(t);function o(e){return n?aS((i+e)%i):a(e)}function s(){return r}function c(){return _S(e,s(),n)}const l={get:s,set:function(e){return r=o(e),l},add:function(e){return c().set(s()+e)},clone:c};return l}function vS(e,t,n,a,i,r,o,s,c,l,d,u,h,p,m,g,f,_,v){const{cross:y,direction:b}=e,w=["INPUT","SELECT","TEXTAREA"],x={passive:!1},C=mS(),M=mS(),k=fS(50,225).constrain(p.measure(20)),S={mouse:300,touch:400},E={mouse:500,touch:600},$=m?43:25;let A=!1,z=0,I=0,T=!1,j=!1,O=!1,D=!1;function R(e){if(!pS(e,a)&&e.touches.length>=2)return P(e);const t=r.readPoint(e),n=r.readPoint(e,y),o=rS(t,z),c=rS(n,I);if(!j&&!D){if(!e.cancelable)return P(e);if(j=o>c,!j)return P(e)}const d=r.pointerMove(e);o>g&&(O=!0),l.useFriction(.3).useDuration(.75),s.start(),i.add(b(d)),e.preventDefault()}function P(e){const t=d.byDistance(0,!1).index!==u.get(),n=r.pointerUp(e)*(m?E:S)[D?"mouse":"touch"],a=function(e,t){const n=u.add(-1*iS(e)),a=d.byDistance(e,!m).distance;return m||aS(e)=2,s&&0!==e.button)return;if(function(e){const t=e.nodeName||"";return w.includes(t)}(e.target))return;T=!0,r.pointerDown(e),l.useFriction(0).useDuration(0),i.set(o),function(){const e=D?n:t;M.add(e,"touchmove",R,x).add(e,"touchend",P).add(e,"mousemove",R,x).add(e,"mouseup",P)}(),z=r.readPoint(e),I=r.readPoint(e,y),h.emit("pointerDown")}(s)}const c=t;C.add(c,"dragstart",(e=>e.preventDefault()),x).add(c,"touchmove",(()=>{}),x).add(c,"touchend",(()=>{})).add(c,"touchstart",s).add(c,"mousedown",s).add(c,"touchcancel",P).add(c,"contextmenu",P).add(c,"click",L,!0)},destroy:function(){C.clear(),M.clear()},pointerDown:function(){return T}}}function yS(e,t){let n,a;function i(e){return e.timeStamp}function r(n,a){const i="client"+("x"===(a||e.scroll)?"X":"Y");return(pS(n,t)?n:n.touches[0])[i]}return{pointerDown:function(e){return n=e,a=e,r(e)},pointerMove:function(e){const t=r(e)-r(a),o=i(e)-i(n)>170;return a=e,o&&(n=e),t},pointerUp:function(e){if(!n||!a)return 0;const t=r(a)-r(n),o=i(e)-i(n),s=i(e)-i(a)>170,c=t/o;return o&&!s&&aS(c)>.1?c:0},readPoint:r}}function bS(e,t,n,a,i,r,o){const s=[e].concat(a);let c,l,d=[],u=!1;function h(e){return i.measureSize(o.measure(e))}return{init:function(i){r&&(l=h(e),d=a.map(h),c=new ResizeObserver((n=>{(tS(r)||r(i,n))&&function(n){for(const r of n){if(u)return;const n=r.target===e,o=a.indexOf(r.target),s=n?l:d[o];if(aS(h(n?e:a[o])-s)>=.5){i.reInit(),t.emit("resize");break}}}(n)})),n.requestAnimationFrame((()=>{s.forEach((e=>c.observe(e)))})))},destroy:function(){u=!0,c&&c.disconnect()}}}function wS(e,t,n,a,i){const r=i.measure(10),o=i.measure(50),s=fS(.1,.99);let c=!1;function l(){return!c&&(!!e.reachedAny(n.get())&&!!e.reachedAny(t.get()))}return{shouldConstrain:l,constrain:function(i){if(!l())return;const c=e.reachedMin(t.get())?"min":"max",d=aS(e[c]-t.get()),u=n.get()-t.get(),h=s.constrain(d/o);n.subtract(u*h),!i&&aS(u)e.add(i)))}};return c}function CS(e,t,n,a,i){const{reachedAny:r,removeOffset:o,constrain:s}=a;function c(e){return e.concat().sort(((e,t)=>aS(e)-aS(t)))[0]}function l(t,a){const i=[t,t+n,t-n];if(!e)return t;if(!a)return c(i);const r=i.filter((e=>iS(e)===a));return r.length?c(r):sS(i)-n}return{byDistance:function(n,a){const c=i.get()+n,{index:d,distance:u}=function(n){const a=e?o(n):s(n),i=t.map(((e,t)=>({diff:l(e-a,0),index:t}))).sort(((e,t)=>aS(e.diff)-aS(t.diff))),{index:r}=i[0];return{index:r,distance:a}}(c),h=!e&&r(c);return!a||h?{index:d,distance:n}:{index:d,distance:n+l(t[d]-u,0)}},byIndex:function(e,n){return{index:e,distance:l(t[e]-i.get(),n)}},shortcut:l}}function MS(e,t,n,a,i,r,o,s){const c={passive:!0,capture:!0};let l=0;function d(e){"Tab"===e.code&&(l=(new Date).getTime())}return{init:function(u){s&&(r.add(document,"keydown",d,!1),t.forEach(((t,d)=>{r.add(t,"focus",(t=>{(tS(s)||s(u,t))&&function(t){if((new Date).getTime()-l>10)return;o.emit("slideFocusStart"),e.scrollLeft=0;const r=n.findIndex((e=>e.includes(t)));Jk(r)&&(i.useDuration(0),a.index(r,0),o.emit("slideFocus"))}(d)}),c)})))}}}function kS(e){let t=e;function n(e){return Jk(e)?e:e.get()}const a={get:function(){return t},set:function(e){t=n(e)},add:function(e){t+=n(e)},subtract:function(e){t-=n(e)}};return a}function SS(e,t){const n="x"===e.scroll?function(e){return`translate3d(${e}px,0px,0px)`}:function(e){return`translate3d(0px,${e}px,0px)`},a=t.style;let i=!1;return{clear:function(){i||(a.transform="",t.getAttribute("style")||t.removeAttribute("style"))},to:function(t){i||(a.transform=n(e.direction(t)))},toggleActive:function(e){i=!e}}}function ES(e,t,n,a,i,r,o,s,c){const l=.5,d=oS(i),u=oS(i).reverse(),h=function(){const e=o[0];return g(m(u,e),n,!1)}().concat(function(){const e=t-o[0]-1;return g(m(d,e),-n,!0)}());function p(e,t){return e.reduce(((e,t)=>e-i[t]),t)}function m(e,t){return e.reduce(((e,n)=>p(e,t)>0?e.concat([n]):e),[])}function g(i,o,d){const u=function(e){return r.map(((n,i)=>({start:n-a[i]+l+e,end:n+t-l+e})))}(o);return i.map((t=>{const a=d?0:-n,i=d?n:0,r=d?"end":"start",o=u[t][r];return{index:t,loopPoint:o,slideLocation:kS(-1),translate:SS(e,c[t]),target:()=>s.get()>o?a:i}}))}const f={canLoop:function(){return h.every((({index:e})=>{const n=d.filter((t=>t!==e));return p(n,t)<=.1}))},clear:function(){h.forEach((e=>e.translate.clear()))},loop:function(){h.forEach((e=>{const{target:t,translate:n,slideLocation:a}=e,i=t();i!==a.get()&&(n.to(i),a.set(i))}))},loopPoints:h};return f}function $S(e,t,n){let a,i=!1;return{init:function(r){n&&(a=new MutationObserver((e=>{i||(tS(n)||n(r,e))&&function(e){for(const n of e)if("childList"===n.type){r.reInit(),t.emit("slidesChanged");break}}(e)})),a.observe(e,{childList:!0}))},destroy:function(){a&&a.disconnect(),i=!0}}}function AS(e,t,n,a){const i={};let r,o=null,s=null,c=!1;return{init:function(){r=new IntersectionObserver((e=>{c||(e.forEach((e=>{const n=t.indexOf(e.target);i[n]=e})),o=null,s=null,n.emit("slidesInView"))}),{root:e.parentElement,threshold:a}),t.forEach((e=>r.observe(e)))},destroy:function(){r&&r.disconnect(),c=!0},get:function(e=!0){if(e&&o)return o;if(!e&&s)return s;const t=function(e){return uS(i).reduce(((t,n)=>{const a=parseInt(n),{isIntersecting:r}=i[a];return(e&&r||!e&&!r)&&t.push(a),t}),[])}(e);return e&&(o=t),e||(s=t),t}}}function zS(e,t,n,a,i,r,o,s,c){const{startEdge:l,endEdge:d,direction:u}=e,h=Jk(n);const p={groupSlides:function(e){return h?function(e,t){return oS(e).filter((e=>e%t==0)).map((n=>e.slice(n,n+t)))}(e,n):function(e){return e.length?oS(e).reduce(((n,h,p)=>{const m=sS(n)||0,g=0===m,f=h===cS(e),_=i[l]-r[m][l],v=i[l]-r[h][d],y=!a&&g?u(o):0,b=aS(v-(!a&&f?u(s):0)-(_+y));return p&&b>t+c&&n.push(h),f&&n.push(e.length),n}),[]).map(((t,n,a)=>{const i=Math.max(a[n-1]||0);return e.slice(i,t)})):[]}(e)}};return p}function IS(e,t,n,a,i,r,o){const{align:s,axis:c,direction:l,startIndex:d,loop:u,duration:h,dragFree:p,dragThreshold:m,inViewThreshold:g,slidesToScroll:f,skipSnaps:_,containScroll:v,watchResize:y,watchSlides:b,watchDrag:w,watchFocus:x}=r,C={measure:function(e){const{offsetTop:t,offsetLeft:n,offsetWidth:a,offsetHeight:i}=e;return{top:t,right:n+a,bottom:t+i,left:n,width:a,height:i}}},M=C.measure(t),k=n.map(C.measure),S=function(e,t){const n="rtl"===t,a="y"===e,i=!a&&n?-1:1,r={scroll:a?"y":"x",cross:a?"x":"y",startEdge:a?"top":n?"right":"left",endEdge:a?"bottom":n?"left":"right",measureSize:function(e){const{height:t,width:n}=e;return a?t:n},direction:function(e){return e*i}};return r}(c,l),E=S.measureSize(M),$=function(e){const t={measure:function(t){return e*(t/100)}};return t}(E),A=function(e,t){const n={start:function(){return 0},center:function(e){return a(e)/2},end:a};function a(e){return t-e}const i={measure:function(a,i){return eS(e)?n[e](a):e(t,a,i)}};return i}(s,E),z=!u&&!!v,I=u||!!v,{slideSizes:T,slideSizesWithGaps:j,startGap:O,endGap:D}=function(e,t,n,a,i,r){const{measureSize:o,startEdge:s,endEdge:c}=e,l=n[0]&&i,d=function(){if(!l)return 0;const e=n[0];return aS(t[s]-e[s])}(),u=function(){if(!l)return 0;const e=r.getComputedStyle(sS(a));return parseFloat(e.getPropertyValue(`margin-${c}`))}(),h=n.map(o),p=n.map(((e,t,n)=>{const a=!t,i=lS(n,t);return a?h[t]+d:i?h[t]+u:n[t+1][s]-e[s]})).map(aS);return{slideSizes:h,slideSizesWithGaps:p,startGap:d,endGap:u}}(S,M,k,n,I,i),R=zS(S,E,f,u,M,k,O,D,2),{snaps:P,snapsAligned:L}=function(e,t,n,a,i){const{startEdge:r,endEdge:o}=e,{groupSlides:s}=i,c=s(a).map((e=>sS(e)[o]-e[0][r])).map(aS).map(t.measure),l=a.map((e=>n[r]-e[r])).map((e=>-aS(e))),d=s(l).map((e=>e[0])).map(((e,t)=>e+c[t]));return{snaps:l,snapsAligned:d}}(S,A,M,k,R),N=-sS(P)+sS(j),{snapsContained:F,scrollContainLimit:V}=function(e,t,n,a,i){const r=fS(-t+e,0),o=n.map(((e,t)=>{const{min:a,max:i}=r,o=r.constrain(e),s=!t,l=lS(n,t);return s?i:l||c(a,o)?a:c(i,o)?i:o})).map((e=>parseFloat(e.toFixed(3)))),s=function(){const e=o[0],t=sS(o);return fS(o.lastIndexOf(e),o.indexOf(t)+1)}();function c(e,t){return rS(e,t)<1}return{snapsContained:function(){if(t<=e+i)return[r.max];if("keepSnaps"===a)return o;const{min:n,max:c}=s;return o.slice(n,c)}(),scrollContainLimit:s}}(E,N,L,v,2),H=z?F:L,{limit:B}=function(e,t,n){const a=t[0];return{limit:fS(n?a-e:sS(t),a)}}(N,H,u),q=_S(cS(H),d,u),U=q.clone(),W=oS(n),Z=gS(a,i,(e=>(({dragHandler:e,scrollBody:t,scrollBounds:n,options:{loop:a}},i)=>{a||n.constrain(e.pointerDown()),t.seek(i)})(se,e)),(e=>(({scrollBody:e,translate:t,location:n,offsetLocation:a,scrollLooper:i,slideLooper:r,dragHandler:o,animation:s,eventHandler:c,scrollBounds:l,options:{loop:d}},u)=>{const h=e.settled(),p=!l.shouldConstrain(),m=d?h:h&&p;m&&!o.pointerDown()&&(s.stop(),c.emit("settle")),m||c.emit("scroll");const g=n.get()*u+Y.get()*(1-u);a.set(g),d&&(i.loop(e.direction()),r.loop()),t.to(a.get())})(se,e))),Q=H[q.get()],G=kS(Q),Y=kS(Q),K=kS(Q),X=kS(Q),J=function(e,t,n,a,i,r){let o=0,s=0,c=i,l=r,d=e.get(),u=0;function h(e){return c=e,m}function p(e){return l=e,m}const m={direction:function(){return s},duration:function(){return c},velocity:function(){return o},seek:function(t){const i=t/1e3,r=c*i,h=a.get()-e.get();let p=0;return c?(n.set(e),o+=h/r,o*=l,d+=o,e.add(o*i),p=d-u):(o=0,n.set(a),e.set(a),p=h),s=iS(p),u=d,m},settled:function(){return aS(a.get()-t.get())<.001},useBaseFriction:function(){return p(r)},useBaseDuration:function(){return h(i)},useFriction:p,useDuration:h};return m}(G,K,Y,X,h,.68),ee=CS(u,H,N,B,X),te=function(e,t,n,a,i,r,o){function s(i){const s=i.distance,c=i.index!==t.get();r.add(s),s&&(a.duration()?e.start():(e.update(),e.render(1),e.update())),c&&(n.set(t.get()),t.set(i.index),o.emit("select"))}const c={distance:function(e,t){s(i.byDistance(e,t))},index:function(e,n){const a=t.clone().set(e);s(i.byIndex(a.get(),n))}};return c}(Z,q,U,J,ee,X,o),ne=function(e){const{max:t,length:n}=e,a={get:function(e){return n?(e-t)/-n:0}};return a}(B),ae=mS(),ie=AS(t,n,o,g),{slideRegistry:re}=function(e,t,n,a,i,r){const{groupSlides:o}=i,{min:s,max:c}=a;return{slideRegistry:function(){const a=o(r),i=!e||"keepSnaps"===t;return 1===n.length?[r]:i?a:a.slice(s,c).map(((e,t,n)=>{const a=!t,i=lS(n,t);return a?dS(sS(n[0])+1):i?dS(cS(r)-sS(n)[0]+1,sS(n)[0]):e}))}()}}(z,v,H,V,R,W),oe=MS(e,n,re,te,J,ae,o,x),se={ownerDocument:a,ownerWindow:i,eventHandler:o,containerRect:M,slideRects:k,animation:Z,axis:S,dragHandler:vS(S,e,a,i,X,yS(S,i),G,Z,te,J,ee,q,o,$,p,m,_,.68,w),eventStore:ae,percentOfView:$,index:q,indexPrevious:U,limit:B,location:G,offsetLocation:K,previousLocation:Y,options:r,resizeHandler:bS(t,o,i,n,S,y,C),scrollBody:J,scrollBounds:wS(B,K,X,J,$),scrollLooper:xS(N,B,K,[G,K,Y,X]),scrollProgress:ne,scrollSnapList:H.map(ne.get),scrollSnaps:H,scrollTarget:ee,scrollTo:te,slideLooper:ES(S,E,N,T,j,P,H,K,n),slideFocus:oe,slidesHandler:$S(t,o,b),slidesInView:ie,slideIndexes:W,slideRegistry:re,slidesToScroll:R,target:X,translate:SS(S,t)};return se}const TS={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0,watchFocus:!0};function jS(e){function t(e,t){return hS(e,t||{})}const n={mergeOptions:t,optionsAtMedia:function(n){const a=n.breakpoints||{},i=uS(a).filter((t=>e.matchMedia(t).matches)).map((e=>a[e])).reduce(((e,n)=>t(e,n)),{});return t(n,i)},optionsMediaQueries:function(t){return t.map((e=>uS(e.breakpoints||{}))).reduce(((e,t)=>e.concat(t)),[]).map(e.matchMedia)}};return n}function OS(e,t,n){const a=e.ownerDocument,i=a.defaultView,r=jS(i),o=function(e){let t=[];const n={init:function(n,a){return t=a.filter((({options:t})=>!1!==e.optionsAtMedia(t).active)),t.forEach((t=>t.init(n,e))),a.reduce(((e,t)=>Object.assign(e,{[t.name]:t})),{})},destroy:function(){t=t.filter((e=>e.destroy()))}};return n}(r),s=mS(),c=function(){let e,t={};function n(e){return t[e]||[]}const a={init:function(t){e=t},emit:function(t){return n(t).forEach((n=>n(e,t))),a},off:function(e,i){return t[e]=n(e).filter((e=>e!==i)),a},on:function(e,i){return t[e]=n(e).concat([i]),a},clear:function(){t={}}};return a}(),{mergeOptions:l,optionsAtMedia:d,optionsMediaQueries:u}=r,{on:h,off:p,emit:m}=c,g=S;let f,_,v,y,b=!1,w=l(TS,OS.globalOptions),x=l(w),C=[];function M(t){const n=IS(e,v,y,a,i,t,c);if(t.loop&&!n.slideLooper.canLoop()){return M(Object.assign({},t,{loop:!1}))}return n}function k(t,n){b||(w=l(w,t),x=d(w),C=n||C,function(){const{container:t,slides:n}=x,a=eS(t)?e.querySelector(t):t;v=a||e.children[0];const i=eS(n)?v.querySelectorAll(n):n;y=[].slice.call(i||v.children)}(),f=M(x),u([w,...C.map((({options:e})=>e))]).forEach((e=>s.add(e,"change",S))),x.active&&(f.translate.to(f.location.get()),f.animation.init(),f.slidesInView.init(),f.slideFocus.init(z),f.eventHandler.init(z),f.resizeHandler.init(z),f.slidesHandler.init(z),f.options.loop&&f.slideLooper.loop(),v.offsetParent&&y.length&&f.dragHandler.init(z),_=o.init(z,C)))}function S(e,t){const n=A();E(),k(l({startIndex:n},e),t),c.emit("reInit")}function E(){f.dragHandler.destroy(),f.eventStore.clear(),f.translate.clear(),f.slideLooper.clear(),f.resizeHandler.destroy(),f.slidesHandler.destroy(),f.slidesInView.destroy(),f.animation.destroy(),o.destroy(),s.clear()}function $(e,t,n){x.active&&!b&&(f.scrollBody.useBaseFriction().useDuration(!0===t?0:x.duration),f.scrollTo.index(e,n||0))}function A(){return f.index.get()}const z={canScrollNext:function(){return f.index.add(1).get()!==A()},canScrollPrev:function(){return f.index.add(-1).get()!==A()},containerNode:function(){return v},internalEngine:function(){return f},destroy:function(){b||(b=!0,s.clear(),E(),c.emit("destroy"),c.clear())},off:p,on:h,emit:m,plugins:function(){return _},previousScrollSnap:function(){return f.indexPrevious.get()},reInit:g,rootNode:function(){return e},scrollNext:function(e){$(f.index.add(1).get(),e,-1)},scrollPrev:function(e){$(f.index.add(-1).get(),e,1)},scrollProgress:function(){return f.scrollProgress.get(f.location.get())},scrollSnapList:function(){return f.scrollSnapList},scrollTo:$,selectedScrollSnap:A,slideNodes:function(){return y},slidesInView:function(){return f.slidesInView.get()},slidesNotInView:function(){return f.slidesInView.get(!1)}};return k(t,n),setTimeout((()=>c.emit("init")),0),z}function DS(){return DS=Object.assign||function(e){for(var t=1;t=e;case"y":return Math.abs(i)>=e;case"z":return Math.abs(r)>=e;default:return!1}}(r,a)&&e.preventDefault(),l.isStarted?l.isMomentum&&r>Math.max(2,2*l.lastAbsDelta)&&(M(!0),x()):x(),0===r&&Object.is&&Object.is(e.deltaX,-0)?d=!0:(t=e,l.axisMovement=PS(l.axisMovement,a),l.lastAbsDelta=r,l.scrollPointsToMerge.push({axisDelta:a,timeStamp:i}),g(),p({axisDelta:a,isStart:!l.isStartPublished}),l.isStartPublished=!0,C())},g=function(){var e;l.scrollPointsToMerge.length===US?(l.scrollPoints.unshift({axisDeltaSum:l.scrollPointsToMerge.map((function(e){return e.axisDelta})).reduce(PS),timeStamp:(e=l.scrollPointsToMerge.map((function(e){return e.timeStamp})),e.reduce((function(e,t){return e+t}))/e.length)}),_(),l.scrollPointsToMerge.length=0,l.scrollPoints.length=1,l.isMomentum||b()):l.isStartPublished||f()},f=function(){var e;l.axisVelocity=(e=l.scrollPointsToMerge,e[e.length-1]).axisDelta.map((function(e){return e/l.willEndTimeout}))},_=function(){var e=l.scrollPoints,t=e[0],n=e[1];if(n&&t){var a=t.timeStamp-n.timeStamp;if(!(a<=0)){var i=t.axisDeltaSum.map((function(e){return e/a})),r=i.map((function(e,t){return e/(l.axisVelocity[t]||1)}));l.axisVelocity=i,l.accelerationFactors.push(r),v(a)}}},v=function(e){var t=10*Math.ceil(e/10)*1.2;l.isMomentum||(t=Math.max(100,2*t)),l.willEndTimeout=Math.min(1e3,Math.round(t))},y=function(e){return 0===e||e<=qS&&e>=BS},b=function(){if(l.accelerationFactors.length>=WS){if(d&&(d=!1,LS(l.axisVelocity)>=.2))return void w();var e=l.accelerationFactors.slice(-1*WS);e.every((function(e){var t=!!e.reduce((function(e,t){return e&&e<1&&e===t?1:0})),n=e.filter(y).length===e.length;return t||n}))&&w(),l.accelerationFactors=e}},w=function(){l.isMomentum=!0},x=function(){(l=GS()).isStarted=!0,l.startTime=Date.now(),n=void 0,d=!1},C=function(){clearTimeout(a),a=setTimeout(M,l.willEndTimeout)},M=function(e){void 0===e&&(e=!1),l.isStarted&&(l.isMomentum&&e?p({isEnding:!0,isMomentumCancel:!0}):p({isEnding:!0}),l.isMomentum=!1,l.isStarted=!1)},k=function(e){var t=[],n=function(n){n.removeEventListener("wheel",e),t=t.filter((function(e){return e!==n}))};return NS({observe:function(a){return a.addEventListener("wheel",e,{passive:!1}),t.push(a),function(){return n(a)}},unobserve:n,disconnect:function(){t.forEach(n)}})}(u),S=k.observe,E=k.unobserve,$=k.disconnect;return h(e),NS({on:r,off:o,observe:S,unobserve:E,disconnect:$,feedWheel:u,updateOptions:h})}var KS={active:!0,breakpoints:{},wheelDraggingClass:"is-wheel-dragging",forceWheelAxis:void 0,target:void 0};function XS(e){var t;void 0===e&&(e={});var n=function(){};var a={name:"wheelGestures",options:e,init:function(a,i){var r,o,s=i.mergeOptions,c=i.optionsAtMedia,l=s(KS,XS.globalOptions),d=s(l,e);t=c(d);var u,h=a.internalEngine(),p=null!=(r=t.target)?r:a.containerNode().parentNode,m=null!=(o=t.forceWheelAxis)?o:h.options.axis,g=YS({preventWheelAction:m,reverseSign:[!0,!0,!1]}),f=g.observe(p),_=g.on("wheel",(function(e){var a=e.axisDelta,i=a[0],r=a[1],o="x"===m?i:r,s="x"===m?r:i,c=e.isMomentum&&e.previous&&!e.previous.isMomentum,l=e.isEnding&&!e.isMomentum||c;Math.abs(o)>Math.abs(s)&&!v&&!e.isMomentum&&function(e){try{x(u=new MouseEvent("mousedown",e.event))}catch(e){return n()}v=!0,document.documentElement.addEventListener("mousemove",b,!0),document.documentElement.addEventListener("mouseup",b,!0),void document.documentElement.addEventListener("mousedown",b,!0),t.wheelDraggingClass&&p.classList.add(t.wheelDraggingClass)}(e);if(!v)return;l?function(e){v=!1,x(w("mouseup",e)),y(),t.wheelDraggingClass&&p.classList.remove(t.wheelDraggingClass)}(e):x(w("mousemove",e))})),v=!1;function y(){document.documentElement.removeEventListener("mousemove",b,!0),document.documentElement.removeEventListener("mouseup",b,!0),document.documentElement.removeEventListener("mousedown",b,!0)}function b(e){v&&e.isTrusted&&e.stopImmediatePropagation()}function w(e,t){var n,a;if(m===h.options.axis){var i=t.axisMovement;n=i[0],a=i[1]}else{var r=t.axisMovement;a=r[0],n=r[1]}if(!h.options.skipSnaps&&!h.options.dragFree){var o=h.containerRect.width,s=h.containerRect.height;n=n<0?Math.max(n,-o):Math.min(n,o),a=a<0?Math.max(a,-s):Math.min(a,s)}return new MouseEvent(e,{clientX:u.clientX+n,clientY:u.clientY+a,screenX:u.screenX+n,screenY:u.screenY+a,movementX:n,movementY:a,button:0,bubbles:!0,cancelable:!0,composed:!0})}function x(e){a.containerNode().dispatchEvent(e)}n=function(){f(),_(),y()}},destroy:function(){return n()}};return a}XS.globalOptions=void 0;class JS{constructor(e,t,n){this._mutationObserver=new MutationObserver(((e,t)=>this._refreshCarouselContents())),this._refreshCarouselContents=()=>{const e=lf(this._parent);!Dv(this._carousel.slideNodes(),e)&&(this._carousel.destroy(),this._carousel=this._createCarousel(e))},this._root=e,this._parent=t,this._direction=n?.direction??"horizontal",this._transitionEffect=n?.transitionEffect??"slide",this._startIndex=n?.startIndex??0,this._dragFree=n?.dragFree??!1,this._loop=n?.loop??!1,this._draggable=n?.dragEnabled??!0,this._plugins=n?.plugins??[],this._carousel=this._createCarousel(lf(this._parent)),t instanceof HTMLSlotElement&&t.addEventListener("slotchange",this._refreshCarouselContents),this._mutationObserver.observe(this._parent,{childList:!0})}destroy(){this._parent instanceof HTMLSlotElement&&this._parent.removeEventListener("slotchange",this._refreshCarouselContents),this._mutationObserver.disconnect(),this._carousel.destroy()}getSlide(e){return this._carousel.slideNodes()[e]??null}getSelectedSlide(){return this.getSlide(this.getSelectedIndex())}getSelectedIndex(){return this._carousel.selectedScrollSnap()}selectSlide(e){this._carousel.scrollTo(e,"none"===this._transitionEffect);const t=this.getSlide(e);t&&Bg(this._parent,"carousel:force-select",{index:e,element:t})}_createCarousel(e){const t=OS(this._root,{slides:e,axis:"horizontal"===this._direction?"x":"y",duration:20,startIndex:this._startIndex,dragFree:this._dragFree,loop:this._loop,containScroll:"trimSnaps",watchSlides:!1,watchResize:!0,watchDrag:this._draggable},[...this._plugins,...e.length>1?[XS({forceWheelAxis:"y"})]:[]]),n=()=>{const e=(()=>{const e=t.selectedScrollSnap(),n=t.slideNodes()[e]??null;return n?{index:e,element:n}:null})();e&&Bg(this._parent,"carousel:select",e)};return t.on("select",(()=>n())),t}}let eE=class extends se{constructor(){super(...arguments),this.direction="horizontal",this.dragEnabled=!0,this.selected=0,this._refParent=ze(),this._refRoot=ze(),this._carousel=null}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._carousel?.destroy(),this._carousel=null,super.disconnectedCallback()}willUpdate(e){e.has("direction")&&this.setAttribute("direction",this.direction);["direction","dragEnabled","dragFree","loop","plugins","transitionEffect"].some((t=>e.has(t)))&&(this._carousel?.destroy(),this._carousel=null)}render(){return q`
+ +
+
+ +
+
+ +
`}updated(e){!this._carousel&&this._refRoot.value&&this._refParent.value?this._carousel=new JS(this._refRoot.value,this._refParent.value,{direction:this.direction,dragEnabled:this.dragEnabled,dragFree:this.dragFree,startIndex:this.selected,transitionEffect:this.transitionEffect,loop:this.loop,plugins:this.plugins}):e.has("selected")&&this._carousel?.selectSlide(this.selected)}static get styles(){return o(":host {\n display: block;\n height: 100%;\n width: 100%;\n position: relative;\n}\n\n.embla {\n width: 100%;\n height: 100%;\n margin-left: auto;\n margin-right: auto;\n}\n\n.embla__container {\n display: flex;\n width: 100%;\n height: 100%;\n user-select: none;\n -webkit-touch-callout: none;\n -khtml-user-select: none;\n -webkit-tap-highlight-color: transparent;\n}\n\n:host([direction=vertical]) .embla__container {\n flex-direction: column;\n}\n\n:host([direction=horizontal]) .embla__container {\n flex-direction: row;\n}\n\n.embla__viewport {\n width: 100%;\n height: 100%;\n overflow: hidden;\n display: flex;\n flex-direction: column;\n justify-content: center;\n}\n\n.embla__viewport.is-draggable {\n cursor: move;\n cursor: grab;\n}\n\n.embla__viewport.is-dragging {\n cursor: grabbing;\n}\n\n:host([direction=vertical]) ::slotted(.embla__slide) {\n margin-bottom: 5px;\n}\n\n:host([direction=horizontal]) ::slotted(.embla__slide) {\n margin-right: 5px;\n}")}};e([he({attribute:!0,reflect:!0})],eE.prototype,"direction",void 0),e([he({attribute:!0})],eE.prototype,"transitionEffect",void 0),e([he({attribute:!1})],eE.prototype,"loop",void 0),e([he({attribute:!1})],eE.prototype,"dragFree",void 0),e([he({attribute:!1})],eE.prototype,"dragEnabled",void 0),e([he({attribute:!1})],eE.prototype,"plugins",void 0),e([he({attribute:!1})],eE.prototype,"selected",void 0),eE=e([le("frigate-card-carousel")],eE); +/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const tE=window,nE=tE.ShadowRoot&&(void 0===tE.ShadyCSS||tE.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,aE=Symbol(),iE=new WeakMap;let rE=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==aE)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(nE&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=iE.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&iE.set(t,e))}return e}toString(){return this.cssText}};const oE=(e,t)=>{nE?e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):t.forEach((t=>{const n=document.createElement("style"),a=tE.litNonce;void 0!==a&&n.setAttribute("nonce",a),n.textContent=t.cssText,e.appendChild(n)}))},sE=nE?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return(e=>new rE("string"==typeof e?e:e+"",void 0,aE))(t)})(e):e +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */;var cE;const lE=window,dE=lE.trustedTypes,uE=dE?dE.emptyScript:"",hE=lE.reactiveElementPolyfillSupport,pE={toAttribute(e,t){switch(t){case Boolean:e=e?uE:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},mE=(e,t)=>t!==e&&(t==t||e==e),gE={attribute:!0,type:String,converter:pE,reflect:!1,hasChanged:mE},fE="finalized";class _E extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var t;this.finalize(),(null!==(t=this.h)&&void 0!==t?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach(((t,n)=>{const a=this._$Ep(n,t);void 0!==a&&(this._$Ev.set(a,n),e.push(a))})),e}static createProperty(e,t=gE){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){const n="symbol"==typeof e?Symbol():"__"+e,a=this.getPropertyDescriptor(e,n,t);void 0!==a&&Object.defineProperty(this.prototype,e,a)}}static getPropertyDescriptor(e,t,n){return{get(){return this[t]},set(a){const i=this[e];this[t]=a,this.requestUpdate(e,i,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||gE}static finalize(){if(this.hasOwnProperty(fE))return!1;this[fE]=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),void 0!==e.h&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const e=this.properties,t=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const n of t)this.createProperty(n,e[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(sE(e))}else void 0!==e&&t.push(sE(e));return t}static _$Ep(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(e=this.constructor.h)||void 0===e||e.forEach((e=>e(this)))}addController(e){var t,n;(null!==(t=this._$ES)&&void 0!==t?t:this._$ES=[]).push(e),void 0!==this.renderRoot&&this.isConnected&&(null===(n=e.hostConnected)||void 0===n||n.call(e))}removeController(e){var t;null===(t=this._$ES)||void 0===t||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])}))}createRenderRoot(){var e;const t=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return oE(t,this.constructor.elementStyles),t}connectedCallback(){var e;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostConnected)||void 0===t?void 0:t.call(e)}))}enableUpdating(e){}disconnectedCallback(){var e;null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostDisconnected)||void 0===t?void 0:t.call(e)}))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EO(e,t,n=gE){var a;const i=this.constructor._$Ep(e,n);if(void 0!==i&&!0===n.reflect){const r=(void 0!==(null===(a=n.converter)||void 0===a?void 0:a.toAttribute)?n.converter:pE).toAttribute(t,n.type);this._$El=e,null==r?this.removeAttribute(i):this.setAttribute(i,r),this._$El=null}}_$AK(e,t){var n;const a=this.constructor,i=a._$Ev.get(e);if(void 0!==i&&this._$El!==i){const e=a.getPropertyOptions(i),r="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==(null===(n=e.converter)||void 0===n?void 0:n.fromAttribute)?e.converter:pE;this._$El=i,this[i]=r.fromAttribute(t,e.type),this._$El=null}}requestUpdate(e,t,n){let a=!0;void 0!==e&&(((n=n||this.constructor.getPropertyOptions(e)).hasChanged||mE)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),!0===n.reflect&&this._$El!==e&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(e,n))):a=!1),!this.isUpdatePending&&a&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((e,t)=>this[t]=e)),this._$Ei=void 0);let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostUpdate)||void 0===t?void 0:t.call(e)})),this.update(n)):this._$Ek()}catch(e){throw t=!1,this._$Ek(),e}t&&this._$AE(n)}willUpdate(e){}_$AE(e){var t;null===(t=this._$ES)||void 0===t||t.forEach((e=>{var t;return null===(t=e.hostUpdated)||void 0===t?void 0:t.call(e)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){void 0!==this._$EC&&(this._$EC.forEach(((e,t)=>this._$EO(t,this[t],e))),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}}_E[fE]=!0,_E.elementProperties=new Map,_E.elementStyles=[],_E.shadowRootOptions={mode:"open"},null==hE||hE({ReactiveElement:_E}),(null!==(cE=lE.reactiveElementVersions)&&void 0!==cE?cE:lE.reactiveElementVersions=[]).push("1.6.3"); +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const vE=0,yE=Symbol();class bE{constructor(e,t,n){this.o=0,this.status=0,this.autoRun=!0,this.i=e,this.i.addController(this);const a="object"==typeof t?t:{task:t,args:n};this.t=a.task,this.h=a.args,void 0!==a.autoRun&&(this.autoRun=a.autoRun),this.taskComplete=new Promise(((e,t)=>{this.l=e,this.u=t}))}hostUpdated(){this.performTask()}async performTask(){var e;const t=null===(e=this.h)||void 0===e?void 0:e.call(this);this.shouldRun(t)&&this.run(t)}shouldRun(e){return this.autoRun&&this.v(e)}async run(e){var t;let n,a;null!=e||(e=null===(t=this.h)||void 0===t?void 0:t.call(this)),2!==this.status&&3!==this.status||(this.taskComplete=new Promise(((e,t)=>{this.l=e,this.u=t}))),this.status=1,this._=void 0,this.m=void 0,this.i.requestUpdate();const i=++this.o;try{n=await this.t(e)}catch(e){a=e}this.o===i&&(n===yE?this.status=0:(void 0===a?(this.status=2,this.l(n)):(this.status=3,this.u(a)),this.m=n,this._=a),this.i.requestUpdate())}get value(){return this.m}get error(){return this._}render(e){var t,n,a,i;switch(this.status){case 0:return null===(t=e.initial)||void 0===t?void 0:t.call(e);case 1:return null===(n=e.pending)||void 0===n?void 0:n.call(e);case 2:return null===(a=e.complete)||void 0===a?void 0:a.call(e,this.value);case 3:return null===(i=e.error)||void 0===i?void 0:i.call(e,this.error);default:this.status}}v(e){const t=this.T;return this.T=e,Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.some(((e,n)=>mE(e,t[n]))):e!==t}}class wE{constructor(e){this._keys=e}modify(e){this._keys.forEach((t=>e.removeContext(t)))}}var xE=":host {\n display: flex;\n flex-direction: column;\n width: 100%;\n margin-left: 5px;\n padding: 5px;\n color: var(--primary-text-color);\n overflow: hidden;\n column-gap: 5%;\n}\n\ndiv.title {\n font-size: 1.2rem;\n font-weight: bold;\n}\n\ndiv.details {\n flex: 1;\n justify-content: center;\n display: flex;\n flex-direction: column;\n flex-wrap: wrap;\n --mdc-icon-size: 16px;\n min-height: 0px;\n}";const CE=(e,t,n,a)=>{const i={...a?.cardWideConfig&&{cardWideConfig:a.cardWideConfig}};return q` ${t.render({initial:()=>a?.inProgressFunc?.()??xk(i),pending:()=>a?.inProgressFunc?.()??xk(i),error:t=>{Gg(t),kk(e,t)},complete:n})}`},ME=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,kE=(e,t,n,a=!0)=>new bE(e,{args:()=>[!!t(),n()],task:async([e,n])=>{const a=t();return e&&a&&n?(async(e,t)=>e&&t?t.startsWith("data:")||t.match(ME)?t:new Promise(((n,a)=>{e?e.fetchWithAuth(t).then((e=>e.blob())).then((e=>{const t=new FileReader;t.onload=()=>{const e=t.result;n("string"==typeof e?e:null)},t.onerror=e=>a(e),t.readAsDataURL(e)})):a()})):null)(a,n):null},autoRun:a}),SE=300;let EE=class extends se{constructor(){super(),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}connectedCallback(){this._intersectionObserver.observe(this),super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._intersectionObserver.disconnect()}willUpdate(e){e.has("thumbnail")&&(this._embedThumbnailTask=kE(this,(()=>this.hass),(()=>this.thumbnail),!1),this._intersectionObserver.unobserve(this),this._intersectionObserver.observe(this))}_intersectionHandler(e){this._embedThumbnailTask?.status===vE&&e.some((e=>e.isIntersecting))&&this._embedThumbnailTask?.run()}render(){const e=q` `;return this._embedThumbnailTask?q`${this.thumbnail?CE(this,this._embedThumbnailTask,(e=>e?q``:q``),{inProgressFunc:()=>e}):e} `:e}static get styles(){return o(":host {\n display: block;\n overflow: hidden;\n aspect-ratio: 1/1;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\nimg {\n display: block;\n}\n\nimg,\nha-icon {\n display: inline-block;\n vertical-align: top;\n margin: 0;\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n width: var(--frigate-card-thumbnail-size);\n max-height: 100%;\n aspect-ratio: 1/1;\n object-fit: cover;\n}\n\nha-icon {\n --mdc-icon-size: 50%;\n color: var(--primary-text-color);\n display: flex;\n justify-content: center;\n align-items: center;\n border: 1px solid rgba(255, 255, 255, 0.3);\n box-sizing: border-box;\n opacity: 0.2;\n}")}};e([he({attribute:!1})],EE.prototype,"thumbnail",void 0),e([he({attribute:!1})],EE.prototype,"hass",void 0),EE=e([le("frigate-card-thumbnail-feature-thumbnail")],EE);let $E=class extends se{render(){if(this.date)return q` + ${this.cameraMetadata?.engineLogo?q``:""} +
+
${Wu(this.date,"HH:mm")}
+
${Wu(this.date,"MMM do")}
+ ${this.showCameraTitle&&this.cameraMetadata?.title?q`
${this.cameraMetadata.title}
`:q``} +
+ `}static get styles(){return o(":host {\n display: block;\n max-width: var(--frigate-card-thumbnail-size);\n max-height: var(--frigate-card-thumbnail-size);\n aspect-ratio: 1/1;\n border: 1px solid var(--secondary-color);\n background-color: var(--secondary-background-color);\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n overflow: hidden;\n padding: 10px;\n box-sizing: border-box;\n position: relative;\n}\n\nimg.background {\n display: block;\n width: 100%;\n height: 100%;\n position: absolute;\n inset: 0;\n padding: 10%;\n box-sizing: border-box;\n pointer-events: none;\n opacity: 0.1;\n}\n\ndiv.content {\n height: 100%;\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n color: var(--primary-text-color);\n}\n\ndiv {\n text-align: center;\n}\n\ndiv.title {\n font-size: 1.5rem;\n}\n\ndiv.camera {\n font-size: 0.7em;\n}")}};e([he({attribute:!1})],$E.prototype,"date",void 0),e([he({attribute:!1})],$E.prototype,"cameraMetadata",void 0),e([he({attribute:!1})],$E.prototype,"showCameraTitle",void 0),$E=e([le("frigate-card-thumbnail-feature-text")],$E);let AE=class extends se{render(){if(!this.media)return;const e=this.media.getScore(),t=e?(100*e).toFixed(2)+"%":null,n=this.media.getStartTime(),a=n?Kg(n):null,i=this.media.getEndTime(),r=n&&i?ef(n,i):null,o=this.media.inProgress()?V_("event.in_progress"):null,s=qg(this.media.getWhat()?.join(", "))??null,c=qg(this.media.getWhere()?.join(", "))??null,l=qg(this.media.getTags()?.join(", "))??null,d=s||l?(s??"")+(s&&l?": ":"")+(l??""):null,u=this.seek?Wu(this.seek,"HH:mm:ss"):null;return q` + ${d?q`
+ ${d} + ${t?q`${t}`:""} +
`:""} +
+ ${a?q`
+ + ${a} +
+ ${r||o?q`
+ + ${r?q`${r}`:""} + ${o?q`${o}`:""} +
`:""}`:""} + ${this.cameraTitle?q`
+ + ${this.cameraTitle} +
`:""} + ${c?q`
+ + ${c} +
`:q``} + ${l?q`
+ + ${l} +
`:q``} + ${u?q`
+ + ${u} +
`:q``} +
+ `}static get styles(){return o(xE)}};e([he({attribute:!1})],AE.prototype,"media",void 0),e([he({attribute:!1})],AE.prototype,"seek",void 0),e([he({attribute:!1})],AE.prototype,"cameraTitle",void 0),AE=e([le("frigate-card-thumbnail-details-event")],AE);let zE=class extends se{render(){if(!this.media)return;const e=this.media.getStartTime(),t=e?Kg(e):null,n=this.media.getEndTime(),a=e&&n?ef(e,n):null,i=this.media.inProgress()?V_("recording.in_progress"):null,r=this.seek?Wu(this.seek,"HH:mm:ss"):null,o=this.media.getEventCount();return q` + ${this.cameraTitle?q`
+ ${this.cameraTitle} +
`:""} +
+ ${t?q`
+ + ${t} +
+ ${a||i?q`
+ + ${a?q`${a}`:""} + ${i?q`${i}`:""} +
`:""}`:""} + ${r?q`
+ + ${r} +
`:q``} + ${null!==o?q`
+ + ${o} +
`:""} +
+ `}static get styles(){return o(xE)}};e([he({attribute:!1})],zE.prototype,"media",void 0),e([he({attribute:!1})],zE.prototype,"seek",void 0),e([he({attribute:!1})],zE.prototype,"cameraTitle",void 0),zE=e([le("frigate-card-thumbnail-details-recording")],zE);let IE=class extends se{constructor(){super(...arguments),this.details=!1,this.show_favorite_control=!1,this.show_timeline_control=!1,this.show_download_control=!1}render(){if(!this.media||!this.cameraManager||!this.hass)return;const e=this.media.getThumbnail(),t=this.media.getTitle()??"",n={star:!0,starred:!!this.media?.isFavorite()},a=this.show_timeline_control&&(!tx.isRecording(this.media)||this.media.getStartTime()&&this.media.getEndTime()),i=this.cameraManager?.getMediaCapabilities(this.media),r=this.show_favorite_control&&this.media&&this.hass&&i?.canFavorite,o=this.show_download_control&&this.hass&&this.media.getID()&&i?.canDownload,s=this.cameraManager.getCameraMetadata(this.media.getCameraID());return q` + ${tx.isEvent(this.media)&&e?q``:tx.isEvent(this.media)||tx.isRecording(this.media)?q``:q``} + ${r?q` {if(wf(e),this.hass&&this.media){try{await(this.cameraManager?.favoriteMedia(this.media,!this.media?.isFavorite()))}catch(e){return void Gg(e)}this.requestUpdate()}}} + />`:""} + ${this.details&&tx.isEvent(this.media)?q``:this.details&&tx.isRecording(this.media)?q``:q``} + ${a?q`{wf(e),this.viewManagerEpoch&&this.media&&this.viewManagerEpoch.manager.setViewByParameters({params:{view:"timeline",queryResults:this.viewManagerEpoch?.manager.getView()?.queryResults?.clone().selectResultIfFound((e=>e===this.media))},modifiers:[new wE(["timeline"])]})}} + >`:""} + ${o?q` {if(wf(e),this.hass&&this.cameraManager&&this.media)try{await Ew(this.hass,this.cameraManager,this.media)}catch(e){kk(this,e)}}} + >`:""} + `}static get styles(){return o(":host {\n display: flex;\n flex-direction: row;\n box-sizing: border-box;\n position: relative;\n overflow: hidden;\n transition: transform 0.2s linear;\n}\n\n:host(:not([details])) {\n aspect-ratio: 1/1;\n}\n\n:host([details]) {\n border: 1px solid var(--primary-color);\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n padding: 2px;\n background-color: var(--primary-background-color, black);\n}\n\n:host(:hover) {\n transform: scale(1.04);\n}\n\nha-icon {\n position: absolute;\n border-radius: 50%;\n opacity: 0.5;\n color: var(--primary-color);\n cursor: pointer;\n transition: opacity 0.2s ease-in-out, color 0.2s ease-in-out;\n}\n\nha-icon:hover {\n opacity: 1;\n}\n\nha-icon.star {\n top: 3px;\n left: 3px;\n}\n\nha-icon.star.starred {\n color: gold;\n}\n\nha-icon.timeline {\n top: 3px;\n right: 3px;\n}\n\nha-icon.download {\n right: 3px;\n bottom: 3px;\n}\n\nfrigate-card-thumbnail-details-event,\nfrigate-card-thumbnail-details-recording {\n flex: 1;\n}")}};e([he({attribute:!1})],IE.prototype,"cameraManager",void 0),e([he({attribute:!1})],IE.prototype,"media",void 0),e([he({attribute:!0,type:Boolean})],IE.prototype,"details",void 0),e([he({attribute:!0,type:Boolean})],IE.prototype,"show_favorite_control",void 0),e([he({attribute:!0,type:Boolean})],IE.prototype,"show_timeline_control",void 0),e([he({attribute:!0,type:Boolean})],IE.prototype,"show_download_control",void 0),e([he({attribute:!1})],IE.prototype,"seek",void 0),IE=e([le("frigate-card-thumbnail")],IE);let TE=class extends se{constructor(){super(...arguments),this.fadeThumbnails=!1,this._thumbnailSlides=[]}willUpdate(e){if(e.has("config")){this.config?.size&&this.style.setProperty("--frigate-card-thumbnail-size",`${this.config.size}px`);const e=this._getDirection();e?this.setAttribute("direction",e):this.removeAttribute("direction")}["cameraManager","config","transitionEffect","viewManagerEpoch"].some((t=>e.has(t)))&&(this._thumbnailSlides=this._renderSlides()),e.has("viewManagerEpoch")&&this.style.setProperty("--frigate-card-carousel-thumbnail-opacity",this.fadeThumbnails&&null!==this._getSelectedSlide()?"0.4":"1.0")}_getSelectedSlide(){return this.viewManagerEpoch?.manager.getView()?.queryResults?.getSelectedIndex()??null}_renderSlides(){const e=[],t=this.viewManagerEpoch?.manager.getView(),n=t?.context?.mediaViewer?.seek,a=this._getSelectedSlide();for(const i of t?.queryResults?.getResults()??[]){const t=e.length,r={embla__slide:!0,"slide-selected":a===t};e.push(q` {const n=this.viewManagerEpoch?.manager.getView();n&&n.queryResults&&Bg(this,"thumbnail-carousel:tap",{queryResults:n.queryResults.clone().selectIndex(t)}),wf(e)}} + > + `)}return e}_getDirection(){return"left"===this.config?.mode||"right"===this.config?.mode?"vertical":"above"===this.config?.mode||"below"===this.config?.mode?"horizontal":null}render(){const e=this._getDirection();if(this._thumbnailSlides.length&&this.config&&e)return q` + ${this._thumbnailSlides} + `}static get styles(){return o(":host {\n --frigate-card-thumbnail-size-max: 300px;\n --frigate-card-thumbnail-details-width: calc(\n var(--frigate-card-thumbnail-size) + 200px\n );\n}\n\n:host {\n display: block;\n width: 100%;\n height: 100%;\n --frigate-card-carousel-thumbnail-opacity: 1;\n}\n\n:host([direction=vertical]) {\n height: 100%;\n}\n\n:host([direction=horizontal]) {\n height: auto;\n}\n\n.embla__slide {\n flex: 0 0 auto;\n opacity: var(--frigate-card-carousel-thumbnail-opacity);\n}\n\n.embla__slide.slide-selected {\n opacity: 1;\n}\n\nfrigate-card-thumbnail {\n width: var(--frigate-card-thumbnail-size);\n height: var(--frigate-card-thumbnail-size);\n max-width: 100%;\n}\n\nfrigate-card-thumbnail[details] {\n width: var(--frigate-card-thumbnail-details-width);\n}")}};e([he({attribute:!1})],TE.prototype,"hass",void 0),e([he({attribute:!1})],TE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1})],TE.prototype,"cameraManager",void 0),e([he({attribute:!1})],TE.prototype,"config",void 0),e([he({attribute:!1})],TE.prototype,"fadeThumbnails",void 0),TE=e([le("frigate-card-thumbnail-carousel")],TE);var jE=":host {\n width: 100%;\n height: 100%;\n display: block;\n}";const OE=document.createElement("template");OE.innerHTML='\n
\n
\n';class DE extends HTMLElement{constructor(){super();const e=this.attachShadow({mode:"open"});e.appendChild(OE.content.cloneNode(!0)),this._freeSpaceDiv=e.getElementById("fs")}connectedCallback(){this._freeSpaceDiv&&this._freeSpaceDiv.addEventListener("click",this.handleFreeSpaceDivClick),this.upgradeProperty("open")}disconnectedCallback(){document.removeEventListener("keyup",this.handleKeyUp)}upgradeProperty(e){if(this.hasOwnProperty(e)){let t=this[e];delete this[e],this[e]=t}}handleKeyUp=e=>{if(!e.altKey&&"Escape"===e.key)e.preventDefault(),this.open=!1};get open(){return this.hasAttribute("open")}set open(e){e?this.hasAttribute("open")||this.setAttribute("open",""):this.hasAttribute("open")&&this.removeAttribute("open")}static get observedAttributes(){return["open"]}attributeChangedCallback(e,t,n){"open"===e&&(this.open?(this.setAttribute("tabindex","0"),this.setAttribute("aria-disabled","false"),this.focus({preventScroll:!0}),document.addEventListener("keyup",this.handleKeyUp),this.dispatchEvent(new CustomEvent("open",{bubbles:!0}))):(this.setAttribute("tabindex","-1"),this.setAttribute("aria-disabled","true"),document.removeEventListener("keyup",this.handleKeyUp),this.dispatchEvent(new CustomEvent("close",{bubbles:!0}))))}handleFreeSpaceDivClick=()=>{this.open=!1}}customElements.define("side-drawer",DE);let RE=class extends se{constructor(){super(...arguments),this.location="left",this.control=!0,this.open=!1,this.empty=!0,this._refDrawer=ze(),this._refSlot=ze(),this._resizeObserver=new ResizeObserver((()=>this._hideDrawerIfNecessary())),this._isHoverableDevice=Yg()}firstUpdated(e){super.firstUpdated(e);const t=document.createElement("style");t.innerHTML=":host {\n width: unset;\n}\n\n#fs {\n display: none;\n width: 100%;\n inset: 0;\n}\n\n#d,\n#fs {\n height: 100%;\n position: absolute;\n}\n\n#d {\n overflow: visible;\n max-width: 90%;\n z-index: 10;\n}\n\n:host([location=right]) #d {\n left: unset;\n right: 0;\n transform: translateX(100%);\n}\n\n:host([location=right][open]) #d {\n transform: none;\n box-shadow: var(--frigate-card-css-box-shadow, 0px 0px 25px 0px black);\n}\n\n#ifs {\n height: 100%;\n}",this._refDrawer.value?.shadowRoot?.appendChild(t)}_slotChanged(){const e=this._refSlot.value?lf(this._refSlot.value):[];this._resizeObserver.disconnect();for(const t of e)this._resizeObserver.observe(t);this._hideDrawerIfNecessary()}_hideDrawerIfNecessary(){if(!this._refDrawer.value)return;const e=this._refSlot.value?lf(this._refSlot.value):null;this.empty=!e||!e.length||e.every((e=>{const t=e.getBoundingClientRect();return!t.width||!t.height}))}render(){return q` + {this.open&&(this.open=!1)}} + > + ${this.control?q` +
{wf(e),this.open=!this.open}} + > + {this._isHoverableDevice&&!this.open&&(this.open=!0)}} + > + +
+ `:""} + this._slotChanged()}> +
+ `}static get styles(){return o("side-drawer {\n background-color: var(--card-background-color);\n}\n\ndiv.control-surround {\n position: absolute;\n bottom: 50%;\n transform: translateY(50%);\n z-index: 0;\n padding-top: 20px;\n padding-bottom: 20px;\n}\n\n:host([location=left]) div.control-surround {\n padding-right: 12px;\n left: 100%;\n}\n\n:host([location=right]) div.control-surround {\n padding-left: 12px;\n right: 100%;\n}\n\n:host([empty]),\n:host([empty]) > * {\n visibility: hidden;\n}\n\n:host(:not([empty])),\n:host(:not([empty])) > * {\n visibility: visible;\n}\n\nha-icon.control {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.7);\n opacity: 0.5;\n pointer-events: all;\n --mdc-icon-size: 20px;\n padding-top: 20px;\n padding-bottom: 20px;\n transition: opacity 0.5s ease;\n}\n\n:host([open]) ha-icon.control,\nha-icon.control:hover {\n opacity: 1;\n background-color: black;\n}\n\n:host([location=left]) ha-icon.control {\n border-top-right-radius: 20px;\n border-bottom-right-radius: 20px;\n}\n\n:host([location=right]) ha-icon.control {\n border-top-left-radius: 20px;\n border-bottom-left-radius: 20px;\n}")}};e([he({attribute:!0,reflect:!0})],RE.prototype,"location",void 0),e([he({attribute:!0,reflect:!0,type:Boolean})],RE.prototype,"control",void 0),e([he({type:Boolean,reflect:!0,attribute:!0})],RE.prototype,"open",void 0),e([he({attribute:!1})],RE.prototype,"icons",void 0),e([he({type:Boolean,reflect:!0,attribute:!0})],RE.prototype,"empty",void 0),RE=e([le("frigate-card-drawer")],RE);let PE=class extends se{constructor(){super(...arguments),this._refDrawerLeft=ze(),this._refDrawerRight=ze(),this._boundDrawerHandler=this._drawerHandler.bind(this)}connectedCallback(){super.connectedCallback(),this.addEventListener("frigate-card:drawer:open",this._boundDrawerHandler),this.addEventListener("frigate-card:drawer:close",this._boundDrawerHandler)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("frigate-card:drawer:open",this._boundDrawerHandler),this.removeEventListener("frigate-card:drawer:close",this._boundDrawerHandler)}_drawerHandler(e){const t=e.detail.drawer,n=e.type.endsWith(":open");"left"===t&&this._refDrawerLeft.value?this._refDrawerLeft.value.open=n:"right"===t&&this._refDrawerRight.value&&(this._refDrawerRight.value.open=n)}render(){return q` + + + + + + + + `}static get styles(){return o(":host {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n position: relative;\n overflow: hidden;\n}\n\n::slotted(:not([slot])) {\n flex: 1;\n min-height: 0px;\n}")}};e([he({attribute:!1})],PE.prototype,"drawerIcons",void 0),PE=e([le("frigate-card-surround-basic")],PE);let LE=class extends se{_hasDrawer(){return!!this.thumbnailConfig&&["left","right"].includes(this.thumbnailConfig.mode)}willUpdate(e){this.timelineConfig?.mode&&"none"!==this.timelineConfig.mode&&import("./timeline-core-744686a3.js");const t=this.viewManagerEpoch?.manager.getView();e.has("viewManagerEpoch")&&(this.viewManagerEpoch?.manager.hasMajorMediaChange(this.viewManagerEpoch?.oldView)||this.viewManagerEpoch?.oldView?.displayMode!==t?.displayMode)&&(this._cameraIDsForTimeline=this._getCameraIDsForTimeline()??void 0)}_getCameraIDsForTimeline(){const e=this.viewManagerEpoch?.manager.getView();if(!e||!this.cameraManager)return null;if(e.is("live")){const t={anyCapabilities:["clips","snapshots","recordings"]};return e.supportsMultipleDisplayModes()&&e.isGrid()?this.cameraManager.getStore().getCameraIDsWithCapability(t):this.cameraManager.getStore().getAllDependentCameras(e.camera,t)}return e.isViewerView()?e.query?.getQueryCameraIDs()??null:null}render(){const e=this.viewManagerEpoch?.manager.getView();if(!this.hass||!e)return;const t=(e,t)=>{this.thumbnailConfig&&this._hasDrawer()&&Bg(e.composedPath()[0],"drawer:"+t,{drawer:this.thumbnailConfig.mode})};return q` t(e,"open")} + @frigate-card:thumbnails:close=${e=>t(e,"close")} + > + ${this.thumbnailConfig&&"none"!==this.thumbnailConfig.mode?q` {const n=e.detail.queryResults.getSelectedResult();n&&(this.viewManagerEpoch?.manager.setViewByParameters({params:{view:"media",queryResults:e.detail.queryResults,...n.getCameraID()&&{camera:n.getCameraID()}},modifiers:[new wE(["timeline","mediaViewer"])]}),t(e,"close"))}} + > + `:""} + ${this.timelineConfig&&"none"!==this.timelineConfig.mode?q` + `:""} + + `}static get styles(){return o(jE)}};e([he({attribute:!1})],LE.prototype,"hass",void 0),e([he({attribute:!1})],LE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1,hasChanged:Qg})],LE.prototype,"thumbnailConfig",void 0),e([he({attribute:!1,hasChanged:Qg})],LE.prototype,"timelineConfig",void 0),e([he({attribute:!1})],LE.prototype,"cameraManager",void 0),e([he({attribute:!1})],LE.prototype,"cardWideConfig",void 0),LE=e([le("frigate-card-surround")],LE);var NE="Thu, 12 Dec 2024 04:43:25 GMT",FE="1992db2",VE="Wed, 11 Dec 2024 20:42:05 -0800";const HE=ba.object({domain:ba.string(),version:ba.string().optional()}).passthrough(),BE="hass_web_proxy",qE=(e,t)=>`/api/${BE}/v${t??0}/?url=${encodeURIComponent(e)}`,UE=(e,t,n="media")=>(e=>e.config.components.includes(BE))(e)&&!!t[n];async function WE(e,t,n){await e.callService(BE,"create_proxied_url",{url_pattern:t,...n&&{url_id:n.urlID,ssl_verification:n.sslVerification,ssl_ciphers:n.sslCiphers,open_limit:n.openLimit,ttl:n.ttl,allow_unauthenticated:n.allowUnauthenticated}})}const ZE=async(e,t)=>{let n=null;if(t)try{n=await(async(e,t)=>await $v(e,HE,{type:"manifest/get",integration:t}))(t,e)}catch(e){}return{detected:!!n,...n?.version&&{version:n.version}}};let QE=class extends se{constructor(){super(...arguments),this._diagnostics=null}async _fetchDiagnostics(){this._diagnostics=await(async(e,t,n)=>{const a=e&&t?await t.getMatchingDevices(e,(e=>"Frigate"===e.manufacturer)):[],i=new Map;return a?.forEach((e=>{e.config_entries.forEach((t=>{e.model&&i.set(t,e.model)}))})),{card_version:"6.0.4",browser:navigator.userAgent,date:new Date,lang:F_(),timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,git:{hash:FE,build_date:NE,commit_date:VE},...e&&{ha_version:e.config.version},integrations:{reolink:await ZE("reolink",e),frigate:{...await ZE("frigate",e),...i.size&&{devices:Object.fromEntries(i)}},hass_web_proxy:await ZE(BE,e),motioneye:await ZE("motioneye",e)},...n&&{config:n}}})(this.hass,this.deviceRegistryManager,this.rawConfig)}shouldUpdate(){return!!this._diagnostics||(this._fetchDiagnostics().then((()=>this.requestUpdate())),!1)}render(){return wk({message:V_("error.diagnostics"),type:"diagnostics",icon:"mdi:information",context:this._diagnostics})}static get styles(){return o(jE)}};e([he({attribute:!1})],QE.prototype,"hass",void 0),e([he({attribute:!1})],QE.prototype,"deviceRegistryManager",void 0),e([he({attribute:!1})],QE.prototype,"rawConfig",void 0),e([pe()],QE.prototype,"_diagnostics",void 0),QE=e([le("frigate-card-diagnostics")],QE);let GE=class extends se{willUpdate(e){if(e.has("viewManagerEpoch")||e.has("config")){const e=this.viewManagerEpoch?.manager.getView();(e?.is("live")||this._shouldLivePreload())&&import("./index-9b434861.js").then((function(e){return e.i})),e?.isGalleryView()?import("./gallery-15a600d2.js"):e?.isViewerView()?import("./index-37750213.js"):e?.is("image")?import("./image-632882b9.js"):e?.is("timeline")&&import("./timeline-116cbe0a.js")}e.has("hide")&&(this.hide?this.setAttribute("hidden",""):this.removeAttribute("hidden"))}shouldUpdate(e){return!0}_shouldLivePreload(){const e=this.viewManagerEpoch?.manager.getView();return!!this.overriddenConfig?.live.preload&&!e?.is("diagnostics")}render(){if(!(this.hass&&this.overriddenConfig&&this.nonOverriddenConfig&&this.cardWideConfig))return q``;const e=this.viewManagerEpoch?.manager.getView(),t={hidden:this._shouldLivePreload()&&!e?.is("live")},n={hidden:!!this.hide},a=e?.is("live")?this.overriddenConfig.live.controls.thumbnails:e?.isViewerView()?this.overriddenConfig.media_viewer.controls.thumbnails:e?.is("timeline")?this.overriddenConfig.timeline.controls.thumbnails:void 0,i=e?.is("live")?this.overriddenConfig.live.controls.timeline:e?.isViewerView()?this.overriddenConfig.media_viewer.controls.timeline:void 0,r=e?this.cameraManager?.getStore().getCameraConfig(e.camera)??null:null;return q` + ${!this.hide&&e?.is("image")&&r?q` + `:""} + ${!this.hide&&e?.isGalleryView()?q` + `:""} + ${!this.hide&&e?.isViewerView()?q` + + + `:""} + ${!this.hide&&e?.is("timeline")?q` + `:""} + ${!this.hide&&e?.is("diagnostics")?q` + `:""} + ${this._shouldLivePreload()||!this.hide&&e?.is("live")?q` + + + `:""} + `}static get styles(){return o(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\n:host([hidden]),\n.hidden {\n display: none;\n}")}};e([he({attribute:!1})],GE.prototype,"hass",void 0),e([he({attribute:!1})],GE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1})],GE.prototype,"cameraManager",void 0),e([he({attribute:!1})],GE.prototype,"nonOverriddenConfig",void 0),e([he({attribute:!1})],GE.prototype,"overriddenConfig",void 0),e([he({attribute:!1})],GE.prototype,"cardWideConfig",void 0),e([he({attribute:!1})],GE.prototype,"rawConfig",void 0),e([he({attribute:!1})],GE.prototype,"resolvedMediaCache",void 0),e([he({attribute:!1})],GE.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],GE.prototype,"hide",void 0),e([he({attribute:!1})],GE.prototype,"microphoneManager",void 0),e([he({attribute:!1})],GE.prototype,"triggeredCameraIDs",void 0),e([he({attribute:!1})],GE.prototype,"deviceRegistryManager",void 0),GE=e([le("frigate-card-views")],GE);console.info(`%c FRIGATE-HASS-CARD \n%c ${V_("common.version")} 6.0.4`,"color: pink; font-weight: bold; background: black","color: white; font-weight: bold; background: dimgray"),window.customCards=window.customCards||[],window.customCards.push({type:"frigate-card",name:V_("common.frigate_card"),description:V_("common.frigate_card_description"),preview:!0,documentationURL:wa});let YE=class extends se{constructor(){super(...arguments),this._controller=new Ax(this,(()=>this._refMain.value?.scroll({top:0})),(()=>this._refMenu.value?.toggleMenu()),this._requestUpdateForComponentsThatUseConditions.bind(this)),this._menuButtonController=new zx,this._refMenu=ze(),this._refOverlay=ze(),this._refMain=ze(),this._refElements=ze(),this._refViews=ze()}get _config(){return this._controller.getConfigManager().getConfig()}get _hass(){return this._controller.getHASSManager().getHASS()}set hass(e){this._controller.getHASSManager().setHASS(e),this._refMenu.value&&(this._refMenu.value.hass=e),this._refElements.value&&(this._refElements.value.hass=e),this._refViews.value&&(this._refViews.value.hass=e)}static async getConfigElement(){return await Ax.getConfigElement()}static getStubConfig(e,t){return Ax.getStubConfig(t)}_requestUpdateForComponentsThatUseConditions(){this._refViews.value&&(this._refViews.value.conditionsManagerEpoch=this._controller.getConditionsManager().getEpoch()??void 0),this._refElements.value&&(this._refElements.value.conditionsManagerEpoch=this._controller.getConditionsManager().getEpoch()??void 0)}setConfig(e){this._controller.getConfigManager().setConfig(e)}shouldUpdate(){return!!this.isConnected&&(this._controller.getMessageManager().hasMessage()||this._controller.getInitializationManager().isInitializedMandatory()||this._controller.getInitializationManager().initializeMandatory(),!0)}_renderMenuStatusContainer(e){if(!this._config)return;const t=this._config.menu.style,n=this._config.menu.position,a=this._config.status_bar.style,i=this._config.status_bar.position;if("none"===t&&"none"===a||"overlay"===e&&"outside"===t&&"outside"===a||"overlay"!==e&&("outside"!==t||n!==e)&&("outside"!==a||i!==e))return;const r=e=>{const r="none"!==t&&("outside"===t&&"outerlay"===e||"outside"!==t&&"overlay"===e),o="none"!==a&&("outside"===a&&"outerlay"===e||"outside"!==a&&"overlay"===e),s="left"===n||"right"===n||"bottom"===n&&"hidden"===t&&"popup"!==a||"top"===n&&("hidden"!==t||"popup"===a);return q` + ${r&&s?this._renderMenu(n):""} + ${o?this._renderStatusBar(i):""} + ${r&&!s?this._renderMenu(n):""} + `};return q` + ${"overlay"===e?q`${r("overlay")}`:q`
+ ${r("outerlay")} +
`} + `}_renderMenu(e){const t=this._controller.getViewManager().getView();if(this._hass&&this._config)return q` + + `}_renderStatusBar(e){if(this._config)return q` + + `}updated(){this._controller.getInitializationManager().isInitializedMandatory()&&this._controller.getQueryStringManager().executeIfNecessary()}_renderInDialogIfNecessary(e){return this._controller.getExpandManager().isExpanded()?q` {this._controller.getExpandManager().setExpanded(!1)}} + > + ${e} + `:e}render(){if(!this._hass)return;const e={main:!0,"curve-top":"outside"!==this._config?.menu.style||"top"!==this._config?.menu.position,"curve-bottom":"outside"!==this._config?.menu.style||"top"===this._config?.menu.position},t=this._controller.getActionsManager().getMergedActions(),n=this._controller.getCameraManager(),a=!1!==this._config?.performance?.features.animated_progress_indicator&&!this._controller.getInitializationManager().wasEverInitialized()&&!this._controller.getMessageManager().hasMessage();return this._renderInDialogIfNecessary(q` this._controller.getMessageManager().setMessageIfHigherPriority(e.detail)} + @frigate-card:media:loaded=${e=>this._controller.getMediaLoadedInfoManager().set(e.detail)} + @frigate-card:media:unloaded=${()=>this._controller.getMediaLoadedInfoManager().clear()} + @frigate-card:media:volumechange=${()=>this.requestUpdate()} + @frigate-card:media:play=${()=>this.requestUpdate()} + @frigate-card:media:pause=${()=>this.requestUpdate()} + @frigate-card:focus=${()=>this.focus()} + > + ${a?q``:""} + ${this._renderMenuStatusContainer("top")} + ${this._renderMenuStatusContainer("overlay")} +
+ + ${wk(this._controller.getMessageManager().getMessage())} +
+ ${this._renderMenuStatusContainer("bottom")} + ${this._config?.elements?q` {this._menuButtonController.addDynamicMenuButton(e.detail),this.requestUpdate()}} + @frigate-card:menu:remove=${e=>{this._menuButtonController.removeDynamicMenuButton(e.detail),this.requestUpdate()}} + @frigate-card:status-bar:add=${e=>{this._controller.getStatusBarItemManager().addDynamicStatusBarItem(e.detail)}} + @frigate-card:status-bar:remove=${e=>{this._controller.getStatusBarItemManager().removeDynamicStatusBarItem(e.detail)}} + @frigate-card:conditions:evaluate=${e=>{e.evaluation=this._controller.getConditionsManager()?.evaluateConditions(e.conditions)}} + > + `:""} +
`)}static get styles(){return o(':host {\n display: block;\n position: relative;\n background-color: var(--card-background-color);\n border-radius: var(--ha-card-border-radius, 4px);\n height: var(--frigate-card-height);\n min-height: 100px;\n pointer-events: all;\n --frigate-card-expand-max-height: calc((100vh - (2 * 56px)) * 0.85);\n --frigate-card-expand-max-width: 85vw;\n --frigate-card-expand-width: none;\n --frigate-card-expand-height: none;\n --frigate-card-expand-aspect-ratio: unset;\n --frigate-card-height: auto;\n}\n\nfrigate-card-loading {\n position: absolute;\n inset: 0;\n z-index: 1;\n}\n\n:host([dark]) {\n filter: brightness(75%);\n}\n\n:host([panel]) {\n height: calc(100vh - var(--header-height));\n}\n\ndiv.main {\n position: relative;\n overflow: auto;\n width: 100%;\n height: 100%;\n margin: auto;\n display: block;\n transform: translateZ(0);\n scrollbar-width: none;\n -ms-overflow-style: none;\n}\n\n/* Hide scrollbar for Chrome, Safari and Opera */\ndiv.main::-webkit-scrollbar {\n display: none;\n}\n\ndiv.main.curve-top {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\ndiv.main.curve-bottom {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}\n\nha-card {\n display: flex;\n flex-direction: column;\n margin: auto;\n border: 0px;\n overflow: visible;\n width: 100%;\n height: 100%;\n position: static;\n color: var(--secondary-text-color, white);\n}\n\n/************\n * Fullscreen\n *************/\n:host(:fullscreen) #ha-card {\n border-radius: 0px;\n box-shadow: none;\n margin: 0;\n}\n\n:host(:-webkit-full-screen) #ha-card {\n border-radius: 0px;\n box-shadow: none;\n margin: 0;\n}\n\n:host(:fullscreen) div.main,\n:host(:fullscreen) frigate-card-menu {\n border-radius: 0px;\n}\n\n:host(:-webkit-full-screen) div.main,\n:host(:-webkit-full-screen) frigate-card-menu {\n border-radius: 0px;\n}\n\n/***************\n * Expanded mode\n ***************/\nweb-dialog {\n --dialog-padding: 0px;\n --dialog-container-padding: 0px;\n --dialog-max-height: var(--frigate-card-expand-max-height);\n --dialog-max-width: var(--frigate-card-expand-max-width);\n --dialog-width: var(--frigate-card-expand-width);\n --dialog-height: var(--frigate-card-expand-height);\n --dialog-overflow-x: visible;\n --dialog-overflow-y: visible;\n max-height: 100vh;\n}\n\nweb-dialog::part(dialog) {\n aspect-ratio: var(--frigate-card-expand-aspect-ratio);\n border-radius: 0px;\n background: transparent;\n}\n\n/*************************************\n * "Outside" style for menu/status bar\n *************************************/\n.outerlay[data-position=top] > *:first-child {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n.outerlay[data-position=bottom] > *:last-child {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n/*******************\n * Menu hover styles\n *******************/\nfrigate-card-menu {\n z-index: 2;\n}\n\nfrigate-card-menu[data-style*=hover] {\n transition: opacity 0.5s ease;\n opacity: 0;\n}\n\nfrigate-card-menu[data-style*=hover]:hover,\nha-card:hover > frigate-card-overlay > frigate-card-menu[data-style=hover-card] {\n opacity: 1;\n}\n\n/*************************\n * Status bar hover styles\n *************************/\nfrigate-card-status-bar {\n z-index: 1;\n}\n\nfrigate-card-status-bar[data-style*=hover] {\n transition: opacity 0.5s ease;\n opacity: 0;\n}\n\nfrigate-card-status-bar[data-style*=hover]:hover,\nha-card:hover > frigate-card-overlay > frigate-card-status-bar[data-style=hover-card] {\n opacity: 1;\n}')}getCardSize(){return 6}};YE=e([le("frigate-card")],YE);export{Il as $,tr as A,nr as B,Zi as C,ar as D,ir as E,rr as F,Pi as G,Li as H,Ni as I,Fi as J,Vi as K,Hi as L,Bi as M,qi as N,Ui as O,gs as P,Ws as Q,ns as R,Us as S,qo as T,Fo as U,Vo as V,Ho as W,Bo as X,Bs as Y,zl as Z,e as _,se as a,dr as a$,H_ as a0,tw as a1,et as a2,nw as a3,$s as a4,Di as a5,ji as a6,Oi as a7,Ri as a8,Wi as a9,Yr as aA,oo as aB,so as aC,lo as aD,uo as aE,co as aF,ao as aG,io as aH,ro as aI,mo as aJ,_o as aK,vo as aL,ho as aM,po as aN,fo as aO,go as aP,eo as aQ,no as aR,to as aS,Xr as aT,Jr as aU,Kr as aV,Ao as aW,Io as aX,zo as aY,hr as aZ,cr as a_,es as aa,Jo as ab,Xo as ac,ts as ad,hs as ae,us as af,ms as ag,qs as ah,ps as ai,So as aj,Co as ak,To as al,Mo as am,ko as an,qr as ao,Ur as ap,Wr as aq,Zr as ar,Eo as as,$o as at,yo as au,xo as av,bo as aw,wo as ax,Qr as ay,Gr as az,pe as b,ja as b$,ur as b0,lr as b1,sr as b2,mr as b3,gr as b4,fr as b5,_r as b6,xr as b7,Hr as b8,Cr as b9,Po as bA,Wo as bB,Zo as bC,Go as bD,Yo as bE,Qo as bF,Uo as bG,vs as bH,_s as bI,ys as bJ,xs as bK,Cs as bL,As as bM,Ms as bN,Es as bO,Ss as bP,Jb as bQ,Kb as bR,Uk as bS,Ug as bT,Ma as bU,Ja as bV,Ya as bW,La as bX,Na as bY,ka as bZ,Oa as b_,kr as ba,Mr as bb,vr as bc,wr as bd,yr as be,br as bf,Sr as bg,Er as bh,$r as bi,Or as bj,zr as bk,Tr as bl,jr as bm,Ir as bn,Ar as bo,Pr as bp,Fr as bq,Vr as br,Dr as bs,Rr as bt,Nr as bu,Lr as bv,Ro as bw,Lo as bx,Oo as by,Do as bz,ew as c,wf as c$,Da as c0,Ta as c1,Ga as c2,Ua as c3,Wa as c4,Za as c5,Qa as c6,_i as c7,fi as c8,Ra as c9,ai as cA,ii as cB,Sa as cC,Ea as cD,pi as cE,hi as cF,gi as cG,mi as cH,Fd as cI,Ca as cJ,ks as cK,ge as cL,fe as cM,W as cN,xe as cO,Gw as cP,Mk as cQ,ze as cR,Yw as cS,df as cT,wk as cU,je as cV,Qg as cW,vw as cX,td as cY,kk as cZ,Ky as c_,Pa as ca,Ha as cb,qa as cc,Fa as cd,Va as ce,Ba as cf,Ka as cg,Xa as ch,ti as ci,ei as cj,yi as ck,vi as cl,bi as cm,wi as cn,$a as co,Aa as cp,za as cq,Ia as cr,ni as cs,ri as ct,oi as cu,si as cv,ci as cw,li as cx,di as cy,ui as cz,aw as d,ba as d$,My as d0,ve as d1,jE as d2,Vd as d3,nu as d4,c as d5,ux as d6,Qv as d7,hx as d8,lx as d9,wx as dA,Ck as dB,U as dC,xf as dD,Bw as dE,kE as dF,CE as dG,yf as dH,Fk as dI,vf as dJ,kf as dK,bf as dL,p_ as dM,h_ as dN,Pv as dO,Lv as dP,Ud as dQ,Vv as dR,Yg as dS,Kg as dT,Cx as dU,Gy as dV,gx as dW,su as dX,sf as dY,Fv as dZ,Hg as d_,px as da,Gg as db,Ev as dc,Wu as dd,Xg as de,Qu as df,Bg as dg,qw as dh,af as di,SE as dj,kx as dk,xk as dl,$w as dm,tx as dn,hy as dp,Bb as dq,qb as dr,UE as ds,WE as dt,Ib as du,qE as dv,Qw as dw,Kw as dx,Xw as dy,Jw as dz,_e as e,nf as e0,$v as e1,zs as e2,Kv as e3,Wv as e4,Z_ as e5,Q_ as e6,Yv as e7,Jg as e8,tf as e9,Lu as eA,Vb as eB,Zv as eC,Nb as eD,lf as eE,qy as eF,Uy as eG,Wy as eH,pf as eI,Qy as eJ,Rg as eK,Zy as eL,s as eM,Ae as eN,ye as eO,Zw as eP,bE as eQ,me as eR,be as eS,jb as eT,Gv as ea,Hk as eb,Hv as ec,rf as ed,Tv as ee,Bk as ef,Iv as eg,zv as eh,jv as ei,qk as ej,Xd as ek,Hd as el,Gd as em,Qd as en,Yd as eo,vu as ep,Jd as eq,eu as er,yu as es,_u as et,Bd as eu,au as ev,gu as ew,Ou as ex,Nu as ey,Fu as ez,ww as f,Fb as g,Xb as h,Dv as i,Lb as j,qg as k,V_ as l,Ki as m,he as n,Gi as o,Ld as p,Qi as q,o as r,of as s,le as t,Yi as u,Hb as v,Xi as w,q as x,er as y,Ji as z}; diff --git a/config/www/community/frigate-hass-card/card-769e2b91.js.gz b/config/www/community/frigate-hass-card/card-769e2b91.js.gz new file mode 100644 index 00000000..6d564222 Binary files /dev/null and b/config/www/community/frigate-hass-card/card-769e2b91.js.gz differ diff --git a/config/www/community/frigate-hass-card/card-7cd05290.js b/config/www/community/frigate-hass-card/card-7cd05290.js new file mode 100644 index 00000000..624bc399 --- /dev/null +++ b/config/www/community/frigate-hass-card/card-7cd05290.js @@ -0,0 +1,650 @@ +function e(e,t,n,a){var i,r=arguments.length,o=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,n):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,a);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(r<3?i(o):r>3?i(t,n,o):i(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o}"function"==typeof SuppressedError&&SuppressedError; +/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const t=globalThis,n=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,a=Symbol(),i=new WeakMap;let r=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==a)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(n&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=i.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&i.set(t,e))}return e}toString(){return this.cssText}};const o=e=>new r("string"==typeof e?e:e+"",void 0,a),s=(e,...t)=>{const n=1===e.length?e[0]:t.reduce(((t,n,a)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+e[a+1]),e[0]);return new r(n,e,a)},c=(e,a)=>{if(n)e.adoptedStyleSheets=a.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(const n of a){const a=document.createElement("style"),i=t.litNonce;void 0!==i&&a.setAttribute("nonce",i),a.textContent=n.cssText,e.appendChild(a)}},l=n?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return o(t)})(e):e +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,{is:d,defineProperty:u,getOwnPropertyDescriptor:h,getOwnPropertyNames:p,getOwnPropertySymbols:m,getPrototypeOf:g}=Object,f=globalThis,_=f.trustedTypes,v=_?_.emptyScript:"",y=f.reactiveElementPolyfillSupport,b=(e,t)=>e,w={toAttribute(e,t){switch(t){case Boolean:e=e?v:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},x=(e,t)=>!d(e,t),C={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:x};Symbol.metadata??=Symbol("metadata"),f.litPropertyMetadata??=new WeakMap;class M extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=C){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){const n=Symbol(),a=this.getPropertyDescriptor(e,n,t);void 0!==a&&u(this.prototype,e,a)}}static getPropertyDescriptor(e,t,n){const{get:a,set:i}=h(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get(){return a?.call(this)},set(t){const r=a?.call(this);i.call(this,t),this.requestUpdate(e,r,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??C}static _$Ei(){if(this.hasOwnProperty(b("elementProperties")))return;const e=g(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(b("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(b("properties"))){const e=this.properties,t=[...p(e),...m(e)];for(const n of t)this.createProperty(n,e[n])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const n=this._$Eu(e,t);void 0!==n&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(l(e))}else void 0!==e&&t.push(l(e));return t}static _$Eu(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((e=>e(this)))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return c(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((e=>e.hostConnected?.()))}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach((e=>e.hostDisconnected?.()))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EC(e,t){const n=this.constructor.elementProperties.get(e),a=this.constructor._$Eu(e,n);if(void 0!==a&&!0===n.reflect){const i=(void 0!==n.converter?.toAttribute?n.converter:w).toAttribute(t,n.type);this._$Em=e,null==i?this.removeAttribute(a):this.setAttribute(a,i),this._$Em=null}}_$AK(e,t){const n=this.constructor,a=n._$Eh.get(e);if(void 0!==a&&this._$Em!==a){const e=n.getPropertyOptions(a),i="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:w;this._$Em=a,this[a]=i.fromAttribute(t,e.type),this._$Em=null}}requestUpdate(e,t,n){if(void 0!==e){if(n??=this.constructor.getPropertyOptions(e),!(n.hasChanged??x)(this[e],t))return;this.P(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(e,t,n){this._$AL.has(e)||this._$AL.set(e,t),!0===n.reflect&&this._$Em!==e&&(this._$Ej??=new Set).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,n]of e)!0!==n.wrapped||this._$AL.has(t)||void 0===this[t]||this.P(t,this[t],n)}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach((e=>e.hostUpdate?.())),this.update(t)):this._$EU()}catch(t){throw e=!1,this._$EU(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&=this._$Ej.forEach((e=>this._$EC(e,this[e]))),this._$EU()}updated(e){}firstUpdated(e){}}M.elementStyles=[],M.shadowRootOptions={mode:"open"},M[b("elementProperties")]=new Map,M[b("finalized")]=new Map,y?.({ReactiveElement:M}),(f.reactiveElementVersions??=[]).push("2.0.4"); +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const k=globalThis,S=k.trustedTypes,E=S?S.createPolicy("lit-html",{createHTML:e=>e}):void 0,$="$lit$",A=`lit$${(Math.random()+"").slice(9)}$`,z="?"+A,I=`<${z}>`,T=document,j=()=>T.createComment(""),O=e=>null===e||"object"!=typeof e&&"function"!=typeof e,D=Array.isArray,R="[ \t\n\f\r]",P=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,L=/-->/g,N=/>/g,F=RegExp(`>|${R}(?:([^\\s"'>=/]+)(${R}*=${R}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),V=/'/g,H=/"/g,B=/^(?:script|style|textarea|title)$/i,q=(e=>(t,...n)=>({_$litType$:e,strings:t,values:n}))(1),U=Symbol.for("lit-noChange"),W=Symbol.for("lit-nothing"),Z=new WeakMap,Q=T.createTreeWalker(T,129);function G(e,t){if(!Array.isArray(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==E?E.createHTML(t):t}const Y=(e,t)=>{const n=e.length-1,a=[];let i,r=2===t?"":"",o=P;for(let t=0;t"===c[0]?(o=i??P,l=-1):void 0===c[1]?l=-2:(l=o.lastIndex-c[2].length,s=c[1],o=void 0===c[3]?F:'"'===c[3]?H:V):o===H||o===V?o=F:o===L||o===N?o=P:(o=F,i=void 0);const u=o===F&&e[t+1].startsWith("/>")?" ":"";r+=o===P?n+I:l>=0?(a.push(s),n.slice(0,l)+$+n.slice(l)+A+u):n+A+(-2===l?t:u)}return[G(e,r+(e[n]||"")+(2===t?"":"")),a]};class K{constructor({strings:e,_$litType$:t},n){let a;this.parts=[];let i=0,r=0;const o=e.length-1,s=this.parts,[c,l]=Y(e,t);if(this.el=K.createElement(c,n),Q.currentNode=this.el.content,2===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(a=Q.nextNode())&&s.length0){a.textContent=S?S.emptyScript:"";for(let n=0;nD(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}S(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.S(e))}_(e){this._$AH!==W&&O(this._$AH)?this._$AA.nextSibling.data=e:this.T(T.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:n}=e,a="number"==typeof n?this._$AC(e):(void 0===n.el&&(n.el=K.createElement(G(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===a)this._$AH.p(t);else{const e=new J(a,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=Z.get(e.strings);return void 0===t&&Z.set(e.strings,t=new K(e)),t}k(e){D(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,a=0;for(const i of e)a===t.length?t.push(n=new ee(this.S(j()),this.S(j()),this,this.options)):n=t[a],n._$AI(i),a++;a2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=W}_$AI(e,t=this,n,a){const i=this.strings;let r=!1;if(void 0===i)e=X(this,e,t,0),r=!O(e)||e!==this._$AH&&e!==U,r&&(this._$AH=e);else{const a=e;let o,s;for(e=i[0],o=0;o{const a=n?.renderBefore??t;let i=a._$litPart$;if(void 0===i){const e=n?.renderBefore??null;a._$litPart$=i=new ee(t.insertBefore(j(),e),e,void 0,n??{})}return i._$AI(e),i})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return U}};se._$litElement$=!0,se.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:se});const ce=globalThis.litElementPolyfillSupport;ce?.({LitElement:se}),(globalThis.litElementVersions??=[]).push("4.0.4"); +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const le=e=>(t,n)=>{void 0!==n?n.addInitializer((()=>{customElements.define(e,t)})):customElements.define(e,t)} +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,de={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:x},ue=(e=de,t,n)=>{const{kind:a,metadata:i}=n;let r=globalThis.litPropertyMetadata.get(i);if(void 0===r&&globalThis.litPropertyMetadata.set(i,r=new Map),r.set(n.name,e),"accessor"===a){const{name:a}=n;return{set(n){const i=t.get.call(this);t.set.call(this,n),this.requestUpdate(a,i,e)},init(t){return void 0!==t&&this.P(a,void 0,e),t}}}if("setter"===a){const{name:a}=n;return function(n){const i=this[a];t.call(this,n),this.requestUpdate(a,i,e)}}throw Error("Unsupported decorator location: "+a)};function he(e){return(t,n)=>"object"==typeof n?ue(e,t,n):((e,t,n)=>{const a=t.hasOwnProperty(n);return t.constructor.createProperty(n,a?{...e,wrapped:!0}:e),a?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n) +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */}function pe(e){return he({...e,state:!0,attribute:!1})} +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const me={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},ge=e=>(...t)=>({_$litDirective$:e,values:t});let fe=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}; +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const _e=ge(class extends fe{constructor(e){if(super(e),e.type!==me.ATTRIBUTE||"class"!==e.name||e.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter((t=>e[t])).join(" ")+" "}update(e,[t]){if(void 0===this.st){this.st=new Set,void 0!==e.strings&&(this.nt=new Set(e.strings.join(" ").split(/\s/).filter((e=>""!==e))));for(const e in t)t[e]&&!this.nt?.has(e)&&this.st.add(e);return this.render(t)}const n=e.element.classList;for(const e of this.st)e in t||(n.remove(e),this.st.delete(e));for(const e in t){const a=!!t[e];a===this.st.has(e)||this.nt?.has(e)||(a?(n.add(e),this.st.add(e)):(n.remove(e),this.st.delete(e)))}return U}}),ve=e=>e??W +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,ye=e=>null===e||"object"!=typeof e&&"function"!=typeof e,be=e=>void 0===e.strings,we={},xe=(e,t=we)=>e._$AH=t +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,Ce=(e,t)=>{const n=e._$AN;if(void 0===n)return!1;for(const e of n)e._$AO?.(t,!1),Ce(e,t);return!0},Me=e=>{let t,n;do{if(void 0===(t=e._$AM))break;n=t._$AN,n.delete(e),e=t}while(0===n?.size)},ke=e=>{for(let t;t=e._$AM;e=t){let n=t._$AN;if(void 0===n)t._$AN=n=new Set;else if(n.has(e))break;n.add(e),$e(t)}}; +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */function Se(e){void 0!==this._$AN?(Me(this),this._$AM=e,ke(this)):this._$AM=e}function Ee(e,t=!1,n=0){const a=this._$AH,i=this._$AN;if(void 0!==i&&0!==i.size)if(t)if(Array.isArray(a))for(let e=n;e{e.type==me.CHILD&&(e._$AP??=Ee,e._$AQ??=Se)};class Ae extends fe{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,n){super._$AT(e,t,n),ke(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(Ce(this,e),Me(this))}setValue(e){if(be(this._$Ct))this._$Ct._$AI(e,this);else{const t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}} +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const ze=()=>new Ie;let Ie=class{};const Te=new WeakMap,je=ge(class extends Ae{render(e){return W}update(e,[t]){const n=t!==this.Y;return n&&void 0!==this.Y&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.Y=t,this.ht=e.options?.host,this.rt(this.ct=e.element)),W}rt(e){if("function"==typeof this.Y){const t=this.ht??globalThis;let n=Te.get(t);void 0===n&&(n=new WeakMap,Te.set(t,n)),void 0!==n.get(this.Y)&&this.Y.call(this.ht,void 0),n.set(this.Y,e),void 0!==e&&this.Y.call(this.ht,e)}else this.Y.value=e}get lt(){return"function"==typeof this.Y?Te.get(this.ht??globalThis)?.get(this.Y):this.Y?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}}),Oe="important",De=" !"+Oe,Re=ge(class extends fe{constructor(e){if(super(e),e.type!==me.ATTRIBUTE||"style"!==e.name||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce(((t,n)=>{const a=e[n];return null==a?t:t+`${n=n.includes("-")?n:n.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${a};`}),"")}update(e,[t]){const{style:n}=e.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(t)),this.render(t);for(const e of this.ft)null==t[e]&&(this.ft.delete(e),e.includes("-")?n.removeProperty(e):n[e]=null);for(const e in t){const a=t[e];if(null!=a){this.ft.add(e);const t="string"==typeof a&&a.endsWith(De);e.includes("-")||t?n.setProperty(e,t?a.slice(0,-11):a,t?Oe:""):n[e]=a}}return U}}); +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */function Pe(e,t,n,a=20,i=0){let r=[];if(i>=a)return r;const o=e=>{const r=e.assignedNodes().filter((e=>1===e.nodeType));return r.length>0?Pe(r[0].parentElement,t,n,a,i+1):[]},s=Array.from(e.children||[]);for(const e of s)t(e)||(n(e)&&r.push(e),null!=e.shadowRoot?r.push(...Pe(e.shadowRoot,t,n,a,i+1)):"SLOT"===e.tagName?r.push(...o(e)):r.push(...Pe(e,t,n,a,i+1)));return r}function Le(e){return e.hasAttribute("hidden")||e.hasAttribute("aria-hidden")&&"false"!==e.getAttribute("aria-hidden")||"none"===e.style.display||"0"===e.style.opacity||"hidden"===e.style.visibility||"collapse"===e.style.visibility}function Ne(e){return"-1"!==e.getAttribute("tabindex")&&!Le(e)&&!function(e){return e.hasAttribute("disabled")||e.hasAttribute("aria-disabled")&&"false"!==e.getAttribute("aria-disabled")}(e)&&(e.hasAttribute("tabindex")||(e instanceof HTMLAnchorElement||e instanceof HTMLAreaElement)&&e.hasAttribute("href")||e instanceof HTMLButtonElement||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e instanceof HTMLIFrameElement)}const Fe=new Map;const Ve=document.createElement("template");Ve.innerHTML='\n\t
\n\t
\n\t\n\t
\n';class He extends HTMLElement{constructor(){super(),this.debounceId=Math.random().toString(),this._focused=!1;const e=this.attachShadow({mode:"open"});e.appendChild(Ve.content.cloneNode(!0)),this.$backup=e.querySelector("#backup"),this.$start=e.querySelector("#start"),this.$end=e.querySelector("#end"),this.focusLastElement=this.focusLastElement.bind(this),this.focusFirstElement=this.focusFirstElement.bind(this),this.onFocusIn=this.onFocusIn.bind(this),this.onFocusOut=this.onFocusOut.bind(this)}static get observedAttributes(){return["inactive"]}get inactive(){return this.hasAttribute("inactive")}set inactive(e){e?this.setAttribute("inactive",""):this.removeAttribute("inactive")}get focused(){return this._focused}connectedCallback(){this.$start.addEventListener("focus",this.focusLastElement),this.$end.addEventListener("focus",this.focusFirstElement),this.addEventListener("focusin",this.onFocusIn),this.addEventListener("focusout",this.onFocusOut),this.render()}disconnectedCallback(){this.$start.removeEventListener("focus",this.focusLastElement),this.$end.removeEventListener("focus",this.focusFirstElement),this.removeEventListener("focusin",this.onFocusIn),this.removeEventListener("focusout",this.onFocusOut)}attributeChangedCallback(){this.render()}focusFirstElement(){this.trapFocus()}focusLastElement(){this.trapFocus(!0)}getFocusableElements(){return Pe(this,Le,Ne)}trapFocus(e){if(this.inactive)return;let t=this.getFocusableElements();t.length>0?(e?t[t.length-1].focus():t[0].focus(),this.$backup.setAttribute("tabindex","-1")):(this.$backup.setAttribute("tabindex","0"),this.$backup.focus())}onFocusIn(){this.updateFocused(!0)}onFocusOut(){this.updateFocused(!1)}updateFocused(e){!function(e,t,n){const a=Fe.get(n);null!=a&&window.clearTimeout(a),Fe.set(n,window.setTimeout((()=>{e(),Fe.delete(n)}),t))}((()=>{this.focused!==e&&(this._focused=e,this.render())}),0,this.debounceId)}render(){this.$start.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.$end.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.focused?this.setAttribute("focused",""):this.removeAttribute("focused")}}function Be(e){return Number(e.getAttribute("data-dialog-count"))||0}function qe(e,t){e.setAttribute("data-dialog-count",t.toString())}function Ue(e=document.activeElement){return null!=e&&null!=e.shadowRoot&&null!=e.shadowRoot.activeElement?Ue(e.shadowRoot.activeElement):e}window.customElements.define("focus-trap",He);const We=document.createElement("template");We.innerHTML='\n \n
\n \n \n \n';class Ze extends HTMLElement{constructor(){super(),this.$scrollContainer=document.documentElement,this.$previousActiveElement=null;const e=this.attachShadow({mode:"open"});e.appendChild(We.content.cloneNode(!0)),this.$dialog=e.querySelector("#dialog"),this.$backdrop=e.querySelector("#backdrop"),this.onBackdropClick=this.onBackdropClick.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.setAttribute("aria-modal","true"),this.$dialog.setAttribute("role","alertdialog")}static get observedAttributes(){return["open","center"]}get open(){return this.hasAttribute("open")}set open(e){e?this.setAttribute("open",""):this.removeAttribute("open")}get center(){return this.hasAttribute("center")}set center(e){e?this.setAttribute("center",""):this.removeAttribute("center")}connectedCallback(){this.$backdrop.addEventListener("click",this.onBackdropClick)}disconnectedCallback(){this.$backdrop.removeEventListener("click",this.onBackdropClick),this.open&&this.didClose()}show(){this.open=!0}close(e){this.result=e,this.open=!1}onBackdropClick(){this.assertClosing()&&this.close()}onKeyDown(e){if("Escape"===e.code)this.assertClosing()&&(this.close(),e.stopImmediatePropagation())}assertClosing(){return this.dispatchEvent(new CustomEvent("closing",{cancelable:!0}))}didOpen(){this.$previousActiveElement=Ue(document.activeElement),requestAnimationFrame((()=>{this.$dialog.focusFirstElement()})),this.tabIndex=0,this.$scrollContainer.style.overflow="hidden",this.addEventListener("keydown",this.onKeyDown,{capture:!0,passive:!0}),qe(this.$scrollContainer,Be(this.$scrollContainer)+1),this.dispatchEvent(new CustomEvent("open"))}didClose(){this.removeEventListener("keydown",this.onKeyDown,{capture:!0}),qe(this.$scrollContainer,Math.max(0,Be(this.$scrollContainer)-1)),Be(this.$scrollContainer)<=0&&(this.$scrollContainer.style.overflow=""),this.tabIndex=-1,null!=this.$previousActiveElement&&(this.$previousActiveElement.focus(),this.$previousActiveElement=null),this.dispatchEvent(new CustomEvent("close",{detail:this.result}))}attributeChangedCallback(e,t,n){if("open"===e)this.open?this.didOpen():this.didClose()}}var Qe,Ge;function Ye(e){return e.substr(0,e.indexOf("."))}customElements.define("web-dialog",Ze),function(e){e.language="language",e.system="system",e.comma_decimal="comma_decimal",e.decimal_comma="decimal_comma",e.space_comma="space_comma",e.none="none"}(Qe||(Qe={})),function(e){e.language="language",e.system="system",e.am_pm="12",e.twenty_four="24"}(Ge||(Ge={}));var Ke,Xe,Je=["closed","locked","off"],et=function(e,t,n,a){a=a||{},n=null==n?{}:n;var i=new Event(t,{bubbles:void 0===a.bubbles||a.bubbles,cancelable:Boolean(a.cancelable),composed:void 0===a.composed||a.composed});return i.detail=n,e.dispatchEvent(i),i},tt=function(e){et(window,"haptic",e)},nt=function(e,t){return function(e,t,n){void 0===n&&(n=!0);var a,i=Ye(t),r="group"===i?"homeassistant":i;switch(i){case"lock":a=n?"unlock":"lock";break;case"cover":a=n?"open_cover":"close_cover";break;default:a=n?"turn_on":"turn_off"}return e.callService(r,a,{entity_id:t})}(e,t,Je.includes(e.states[t].state))},at=function(e,t,n,a){if(a||(a={action:"more-info"}),!a.confirmation||a.confirmation.exemptions&&a.confirmation.exemptions.some((function(e){return e.user===t.user.id}))||(tt("warning"),confirm(a.confirmation.text||"Are you sure you want to "+a.action+"?")))switch(a.action){case"more-info":(n.entity||n.camera_image)&&et(e,"hass-more-info",{entityId:n.entity?n.entity:n.camera_image});break;case"navigate":a.navigation_path&&function(e,t,n){void 0===n&&(n=!1),n?history.replaceState(null,"",t):history.pushState(null,"",t),et(window,"location-changed",{replace:n})}(0,a.navigation_path);break;case"url":a.url_path&&window.open(a.url_path);break;case"toggle":n.entity&&(nt(t,n.entity),tt("success"));break;case"perform-action":if(!a.perform_action)return void tt("failure");var i=a.perform_action.split(".",2);t.callService(i[0],i[1],a.data,a.target),tt("success");break;case"call-service":if(!a.service)return void tt("failure");var r=a.service.split(".",2);t.callService(r[0],r[1],a.data,a.target),tt("success");break;case"fire-dom-event":et(e,"ll-custom",a)}};!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},e.getValidEnumValues=t=>{const n=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),a={};for(const e of n)a[e]=t[e];return e.objectValues(a)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(const n of e)if(t(n))return n},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(Ke||(Ke={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(Xe||(Xe={}));const it=Ke.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),rt=e=>{switch(typeof e){case"undefined":return it.undefined;case"string":return it.string;case"number":return isNaN(e)?it.nan:it.number;case"boolean":return it.boolean;case"function":return it.function;case"bigint":return it.bigint;case"symbol":return it.symbol;case"object":return Array.isArray(e)?it.array:null===e?it.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?it.promise:"undefined"!=typeof Map&&e instanceof Map?it.map:"undefined"!=typeof Set&&e instanceof Set?it.set:"undefined"!=typeof Date&&e instanceof Date?it.date:it.object;default:return it.unknown}},ot=Ke.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class st extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},n={_errors:[]},a=e=>{for(const i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(a);else if("invalid_return_type"===i.code)a(i.returnTypeError);else if("invalid_arguments"===i.code)a(i.argumentsError);else if(0===i.path.length)n._errors.push(t(i));else{let e=n,a=0;for(;ae.message)){const t={},n=[];for(const a of this.issues)a.path.length>0?(t[a.path[0]]=t[a.path[0]]||[],t[a.path[0]].push(e(a))):n.push(e(a));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}st.create=e=>new st(e);const ct=(e,t)=>{let n;switch(e.code){case ot.invalid_type:n=e.received===it.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case ot.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Ke.jsonStringifyReplacer)}`;break;case ot.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ke.joinValues(e.keys,", ")}`;break;case ot.invalid_union:n="Invalid input";break;case ot.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ke.joinValues(e.options)}`;break;case ot.invalid_enum_value:n=`Invalid enum value. Expected ${Ke.joinValues(e.options)}, received '${e.received}'`;break;case ot.invalid_arguments:n="Invalid function arguments";break;case ot.invalid_return_type:n="Invalid function return type";break;case ot.invalid_date:n="Invalid date";break;case ot.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Ke.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case ot.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case ot.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case ot.custom:n="Invalid input";break;case ot.invalid_intersection_types:n="Intersection results could not be merged";break;case ot.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case ot.not_finite:n="Number must be finite";break;default:n=t.defaultError,Ke.assertNever(e)}return{message:n}};let lt=ct;function dt(){return lt}const ut=e=>{const{data:t,path:n,errorMaps:a,issueData:i}=e,r=[...n,...i.path||[]],o={...i,path:r};if(void 0!==i.message)return{...i,path:r,message:i.message};let s="";const c=a.filter((e=>!!e)).slice().reverse();for(const e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:r,message:s}};function ht(e,t){const n=dt(),a=ut({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===ct?void 0:ct].filter((e=>!!e))});e.common.issues.push(a)}class pt{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const a of t){if("aborted"===a.status)return mt;"dirty"===a.status&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const e of t){const t=await e.key,a=await e.value;n.push({key:t,value:a})}return pt.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const a of t){const{key:t,value:i}=a;if("aborted"===t.status)return mt;if("aborted"===i.status)return mt;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"===t.value||void 0===i.value&&!a.alwaysSet||(n[t.value]=i.value)}return{status:e.value,value:n}}}const mt=Object.freeze({status:"aborted"}),gt=e=>({status:"dirty",value:e}),ft=e=>({status:"valid",value:e}),_t=e=>"aborted"===e.status,vt=e=>"dirty"===e.status,yt=e=>"valid"===e.status,bt=e=>"undefined"!=typeof Promise&&e instanceof Promise;function wt(e,t,n,a){if("a"===n&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?a:"a"===n?a.call(e):a?a.value:t.get(e)}function xt(e,t,n,a,i){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?i.call(e,n):i?i.value=n:t.set(e,n),n}var Ct,Mt,kt;"function"==typeof SuppressedError&&SuppressedError,function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(Ct||(Ct={}));class St{constructor(e,t,n,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=a}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Et=(e,t)=>{if(yt(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new st(e.common.issues);return this._error=t,this._error}}};function $t(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:a,description:i}=e;if(t&&(n||a))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:i};return{errorMap:(t,i)=>{var r,o;const{message:s}=e;return"invalid_enum_value"===t.code?{message:null!=s?s:i.defaultError}:void 0===i.data?{message:null!==(r=null!=s?s:a)&&void 0!==r?r:i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:null!==(o=null!=s?s:n)&&void 0!==o?o:i.defaultError}},description:i}}class At{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return rt(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:rt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new pt,ctx:{common:e.parent.common,data:e.data,parsedType:rt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(bt(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const a={common:{issues:[],async:null!==(n=null==t?void 0:t.async)&&void 0!==n&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rt(e)},i=this._parseSync({data:e,path:a.path,parent:a});return Et(a,i)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rt(e)},a=this._parse({data:e,path:n.path,parent:n}),i=await(bt(a)?a:Promise.resolve(a));return Et(n,i)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,a)=>{const i=e(t),r=()=>a.addIssue({code:ot.custom,...n(t)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then((e=>!!e||(r(),!1))):!!i||(r(),!1)}))}refinement(e,t){return this._refinement(((n,a)=>!!e(n)||(a.addIssue("function"==typeof t?t(n,a):t),!1)))}_refinement(e){return new kn({schema:this,typeName:Pn.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Sn.create(this,this._def)}nullable(){return En.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return on.create(this,this._def)}promise(){return Mn.create(this,this._def)}or(e){return ln.create([this,e],this._def)}and(e){return pn.create(this,e,this._def)}transform(e){return new kn({...$t(this._def),schema:this,typeName:Pn.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new $n({...$t(this._def),innerType:this,defaultValue:t,typeName:Pn.ZodDefault})}brand(){return new Tn({typeName:Pn.ZodBranded,type:this,...$t(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new An({...$t(this._def),innerType:this,catchValue:t,typeName:Pn.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return jn.create(this,e)}readonly(){return On.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const zt=/^c[^\s-]{8,}$/i,It=/^[0-9a-z]+$/,Tt=/^[0-9A-HJKMNP-TV-Z]{26}$/,jt=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ot=/^[a-z0-9_-]{21}$/i,Dt=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Rt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let Pt;const Lt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Nt=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Ft=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Vt="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Ht=new RegExp(`^${Vt}$`);function Bt(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function qt(e){let t=`${Vt}T${Bt(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function Ut(e,t){return!("v4"!==t&&t||!Lt.test(e))||!("v6"!==t&&t||!Nt.test(e))}class Wt extends At{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==it.string){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.string,received:t.parsedType}),mt}const t=new pt;let n;for(const a of this._def.checks)if("min"===a.kind)e.data.lengtha.value&&(n=this._getOrReturnCtx(e,n),ht(n,{code:ot.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("length"===a.kind){const i=e.data.length>a.value,r=e.data.lengthe.test(t)),{validation:t,code:ot.invalid_string,...Ct.errToObj(n)})}_addCheck(e){return new Wt({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ct.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ct.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ct.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ct.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ct.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ct.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ct.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ct.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ct.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ct.errToObj(e)})}datetime(e){var t,n;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(n=null==e?void 0:e.local)&&void 0!==n&&n,...Ct.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...Ct.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Ct.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Ct.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...Ct.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Ct.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Ct.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Ct.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Ct.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Ct.errToObj(t)})}nonempty(e){return this.min(1,Ct.errToObj(e))}trim(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.valuea?n:a;return parseInt(e.toFixed(i).replace(".",""))%parseInt(t.toFixed(i).replace(".",""))/Math.pow(10,i)}Wt.create=e=>{var t;return new Wt({checks:[],typeName:Pn.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...$t(e)})};class Qt extends At{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==it.number){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.number,received:t.parsedType}),mt}let t;const n=new pt;for(const a of this._def.checks)if("int"===a.kind)Ke.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty());else if("min"===a.kind){(a.inclusive?e.dataa.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty())}else"multipleOf"===a.kind?0!==Zt(e.data,a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.not_finite,message:a.message}),n.dirty()):Ke.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ct.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ct.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ct.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ct.toString(t))}setLimit(e,t,n,a){return new Qt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Ct.toString(a)}]})}_addCheck(e){return new Qt({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ct.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ct.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ct.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ct.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ct.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ct.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Ct.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ct.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ct.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value"int"===e.kind||"multipleOf"===e.kind&&Ke.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.valuenew Qt({checks:[],typeName:Pn.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...$t(e)});class Gt extends At{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){this._def.coerce&&(e.data=BigInt(e.data));if(this._getType(e)!==it.bigint){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.bigint,received:t.parsedType}),mt}let t;const n=new pt;for(const a of this._def.checks)if("min"===a.kind){(a.inclusive?e.dataa.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty())}else"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):Ke.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ct.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ct.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ct.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ct.toString(t))}setLimit(e,t,n,a){return new Gt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Ct.toString(a)}]})}_addCheck(e){return new Gt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ct.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ct.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ct.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ct.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ct.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value{var t;return new Gt({checks:[],typeName:Pn.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...$t(e)})};class Yt extends At{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==it.boolean){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.boolean,received:t.parsedType}),mt}return ft(e.data)}}Yt.create=e=>new Yt({typeName:Pn.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...$t(e)});class Kt extends At{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==it.date){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.date,received:t.parsedType}),mt}if(isNaN(e.data.getTime())){return ht(this._getOrReturnCtx(e),{code:ot.invalid_date}),mt}const t=new pt;let n;for(const a of this._def.checks)"min"===a.kind?e.data.getTime()a.value&&(n=this._getOrReturnCtx(e,n),ht(n,{code:ot.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),t.dirty()):Ke.assertNever(a);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Kt({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Ct.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Ct.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.valuenew Kt({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Pn.ZodDate,...$t(e)});class Xt extends At{_parse(e){if(this._getType(e)!==it.symbol){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.symbol,received:t.parsedType}),mt}return ft(e.data)}}Xt.create=e=>new Xt({typeName:Pn.ZodSymbol,...$t(e)});class Jt extends At{_parse(e){if(this._getType(e)!==it.undefined){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.undefined,received:t.parsedType}),mt}return ft(e.data)}}Jt.create=e=>new Jt({typeName:Pn.ZodUndefined,...$t(e)});class en extends At{_parse(e){if(this._getType(e)!==it.null){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.null,received:t.parsedType}),mt}return ft(e.data)}}en.create=e=>new en({typeName:Pn.ZodNull,...$t(e)});class tn extends At{constructor(){super(...arguments),this._any=!0}_parse(e){return ft(e.data)}}tn.create=e=>new tn({typeName:Pn.ZodAny,...$t(e)});class nn extends At{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ft(e.data)}}nn.create=e=>new nn({typeName:Pn.ZodUnknown,...$t(e)});class an extends At{_parse(e){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.never,received:t.parsedType}),mt}}an.create=e=>new an({typeName:Pn.ZodNever,...$t(e)});class rn extends At{_parse(e){if(this._getType(e)!==it.undefined){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.void,received:t.parsedType}),mt}return ft(e.data)}}rn.create=e=>new rn({typeName:Pn.ZodVoid,...$t(e)});class on extends At{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),a=this._def;if(t.parsedType!==it.array)return ht(t,{code:ot.invalid_type,expected:it.array,received:t.parsedType}),mt;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,i=t.data.lengtha.maxLength.value&&(ht(t,{code:ot.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map(((e,n)=>a.type._parseAsync(new St(t,e,t.path,n))))).then((e=>pt.mergeArray(n,e)));const i=[...t.data].map(((e,n)=>a.type._parseSync(new St(t,e,t.path,n))));return pt.mergeArray(n,i)}get element(){return this._def.type}min(e,t){return new on({...this._def,minLength:{value:e,message:Ct.toString(t)}})}max(e,t){return new on({...this._def,maxLength:{value:e,message:Ct.toString(t)}})}length(e,t){return new on({...this._def,exactLength:{value:e,message:Ct.toString(t)}})}nonempty(e){return this.min(1,e)}}function sn(e){if(e instanceof cn){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=Sn.create(sn(a))}return new cn({...e._def,shape:()=>t})}return e instanceof on?new on({...e._def,type:sn(e.element)}):e instanceof Sn?Sn.create(sn(e.unwrap())):e instanceof En?En.create(sn(e.unwrap())):e instanceof mn?mn.create(e.items.map((e=>sn(e)))):e}on.create=(e,t)=>new on({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Pn.ZodArray,...$t(t)});class cn extends At{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=Ke.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==it.object){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.object,received:t.parsedType}),mt}const{status:t,ctx:n}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),r=[];if(!(this._def.catchall instanceof an&&"strip"===this._def.unknownKeys))for(const e in n.data)i.includes(e)||r.push(e);const o=[];for(const e of i){const t=a[e],i=n.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new St(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof an){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of r)o.push({key:{status:"valid",value:e},value:{status:"valid",value:n.data[e]}});else if("strict"===e)r.length>0&&(ht(n,{code:ot.unrecognized_keys,keys:r}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of r){const a=n.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new St(n,a,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of o){const n=await t.key,a=await t.value;e.push({key:n,value:a,alwaysSet:t.alwaysSet})}return e})).then((e=>pt.mergeObjectSync(t,e))):pt.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return Ct.errToObj,new cn({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var a,i,r,o;const s=null!==(r=null===(i=(a=this._def).errorMap)||void 0===i?void 0:i.call(a,t,n).message)&&void 0!==r?r:n.defaultError;return"unrecognized_keys"===t.code?{message:null!==(o=Ct.errToObj(e).message)&&void 0!==o?o:s}:{message:s}}}:{}})}strip(){return new cn({...this._def,unknownKeys:"strip"})}passthrough(){return new cn({...this._def,unknownKeys:"passthrough"})}extend(e){return new cn({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new cn({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Pn.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new cn({...this._def,catchall:e})}pick(e){const t={};return Ke.objectKeys(e).forEach((n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])})),new cn({...this._def,shape:()=>t})}omit(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{e[n]||(t[n]=this.shape[n])})),new cn({...this._def,shape:()=>t})}deepPartial(){return sn(this)}partial(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{const a=this.shape[n];e&&!e[n]?t[n]=a:t[n]=a.optional()})),new cn({...this._def,shape:()=>t})}required(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof Sn;)e=e._def.innerType;t[n]=e}})),new cn({...this._def,shape:()=>t})}keyof(){return wn(Ke.objectKeys(this.shape))}}cn.create=(e,t)=>new cn({shape:()=>e,unknownKeys:"strip",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)}),cn.strictCreate=(e,t)=>new cn({shape:()=>e,unknownKeys:"strict",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)}),cn.lazycreate=(e,t)=>new cn({shape:e,unknownKeys:"strip",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)});class ln extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map((async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;const n=e.map((e=>new st(e.ctx.common.issues)));return ht(t,{code:ot.invalid_union,unionErrors:n}),mt}));{let e;const a=[];for(const i of n){const n={...t,common:{...t.common,issues:[]},parent:null},r=i._parseSync({data:t.data,path:t.path,parent:n});if("valid"===r.status)return r;"dirty"!==r.status||e||(e={result:r,ctx:n}),n.common.issues.length&&a.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const i=a.map((e=>new st(e)));return ht(t,{code:ot.invalid_union,unionErrors:i}),mt}}get options(){return this._def.options}}ln.create=(e,t)=>new ln({options:e,typeName:Pn.ZodUnion,...$t(t)});const dn=e=>e instanceof yn?dn(e.schema):e instanceof kn?dn(e.innerType()):e instanceof bn?[e.value]:e instanceof xn?e.options:e instanceof Cn?Ke.objectValues(e.enum):e instanceof $n?dn(e._def.innerType):e instanceof Jt?[void 0]:e instanceof en?[null]:e instanceof Sn?[void 0,...dn(e.unwrap())]:e instanceof En?[null,...dn(e.unwrap())]:e instanceof Tn||e instanceof On?dn(e.unwrap()):e instanceof An?dn(e._def.innerType):[];class un extends At{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.object)return ht(t,{code:ot.invalid_type,expected:it.object,received:t.parsedType}),mt;const n=this.discriminator,a=t.data[n],i=this.optionsMap.get(a);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(ht(t,{code:ot.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),mt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const a=new Map;for(const n of t){const t=dn(n.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const i of t){if(a.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);a.set(i,n)}}return new un({typeName:Pn.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...$t(n)})}}function hn(e,t){const n=rt(e),a=rt(t);if(e===t)return{valid:!0,data:e};if(n===it.object&&a===it.object){const n=Ke.objectKeys(t),a=Ke.objectKeys(e).filter((e=>-1!==n.indexOf(e))),i={...e,...t};for(const n of a){const a=hn(e[n],t[n]);if(!a.valid)return{valid:!1};i[n]=a.data}return{valid:!0,data:i}}if(n===it.array&&a===it.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let a=0;a{if(_t(e)||_t(a))return mt;const i=hn(e.value,a.value);return i.valid?((vt(e)||vt(a))&&t.dirty(),{status:t.value,value:i.data}):(ht(n,{code:ot.invalid_intersection_types}),mt)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then((([e,t])=>a(e,t))):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}pn.create=(e,t,n)=>new pn({left:e,right:t,typeName:Pn.ZodIntersection,...$t(n)});class mn extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.array)return ht(n,{code:ot.invalid_type,expected:it.array,received:n.parsedType}),mt;if(n.data.lengththis._def.items.length&&(ht(n,{code:ot.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map(((e,t)=>{const a=this._def.items[t]||this._def.rest;return a?a._parse(new St(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(a).then((e=>pt.mergeArray(t,e))):pt.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new mn({...this._def,rest:e})}}mn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new mn({items:e,typeName:Pn.ZodTuple,rest:null,...$t(t)})};class gn extends At{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.object)return ht(n,{code:ot.invalid_type,expected:it.object,received:n.parsedType}),mt;const a=[],i=this._def.keyType,r=this._def.valueType;for(const e in n.data)a.push({key:i._parse(new St(n,e,n.path,e)),value:r._parse(new St(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?pt.mergeObjectAsync(t,a):pt.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,n){return new gn(t instanceof At?{keyType:e,valueType:t,typeName:Pn.ZodRecord,...$t(n)}:{keyType:Wt.create(),valueType:e,typeName:Pn.ZodRecord,...$t(t)})}}class fn extends At{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.map)return ht(n,{code:ot.invalid_type,expected:it.map,received:n.parsedType}),mt;const a=this._def.keyType,i=this._def.valueType,r=[...n.data.entries()].map((([e,t],r)=>({key:a._parse(new St(n,e,n.path,[r,"key"])),value:i._parse(new St(n,t,n.path,[r,"value"]))})));if(n.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const n of r){const a=await n.key,i=await n.value;if("aborted"===a.status||"aborted"===i.status)return mt;"dirty"!==a.status&&"dirty"!==i.status||t.dirty(),e.set(a.value,i.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const n of r){const a=n.key,i=n.value;if("aborted"===a.status||"aborted"===i.status)return mt;"dirty"!==a.status&&"dirty"!==i.status||t.dirty(),e.set(a.value,i.value)}return{status:t.value,value:e}}}}fn.create=(e,t,n)=>new fn({valueType:t,keyType:e,typeName:Pn.ZodMap,...$t(n)});class _n extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.set)return ht(n,{code:ot.invalid_type,expected:it.set,received:n.parsedType}),mt;const a=this._def;null!==a.minSize&&n.data.sizea.maxSize.value&&(ht(n,{code:ot.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const i=this._def.valueType;function r(e){const n=new Set;for(const a of e){if("aborted"===a.status)return mt;"dirty"===a.status&&t.dirty(),n.add(a.value)}return{status:t.value,value:n}}const o=[...n.data.values()].map(((e,t)=>i._parse(new St(n,e,n.path,t))));return n.common.async?Promise.all(o).then((e=>r(e))):r(o)}min(e,t){return new _n({...this._def,minSize:{value:e,message:Ct.toString(t)}})}max(e,t){return new _n({...this._def,maxSize:{value:e,message:Ct.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}_n.create=(e,t)=>new _n({valueType:e,minSize:null,maxSize:null,typeName:Pn.ZodSet,...$t(t)});class vn extends At{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.function)return ht(t,{code:ot.invalid_type,expected:it.function,received:t.parsedType}),mt;function n(e,n){return ut({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,dt(),ct].filter((e=>!!e)),issueData:{code:ot.invalid_arguments,argumentsError:n}})}function a(e,n){return ut({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,dt(),ct].filter((e=>!!e)),issueData:{code:ot.invalid_return_type,returnTypeError:n}})}const i={errorMap:t.common.contextualErrorMap},r=t.data;if(this._def.returns instanceof Mn){const e=this;return ft((async function(...t){const o=new st([]),s=await e._def.args.parseAsync(t,i).catch((e=>{throw o.addIssue(n(t,e)),o})),c=await Reflect.apply(r,this,s),l=await e._def.returns._def.type.parseAsync(c,i).catch((e=>{throw o.addIssue(a(c,e)),o}));return l}))}{const e=this;return ft((function(...t){const o=e._def.args.safeParse(t,i);if(!o.success)throw new st([n(t,o.error)]);const s=Reflect.apply(r,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new st([a(s,c.error)]);return c.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new vn({...this._def,args:mn.create(e).rest(nn.create())})}returns(e){return new vn({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new vn({args:e||mn.create([]).rest(nn.create()),returns:t||nn.create(),typeName:Pn.ZodFunction,...$t(n)})}}class yn extends At{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}yn.create=(e,t)=>new yn({getter:e,typeName:Pn.ZodLazy,...$t(t)});class bn extends At{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return ht(t,{received:t.data,code:ot.invalid_literal,expected:this._def.value}),mt}return{status:"valid",value:e.data}}get value(){return this._def.value}}function wn(e,t){return new xn({values:e,typeName:Pn.ZodEnum,...$t(t)})}bn.create=(e,t)=>new bn({value:e,typeName:Pn.ZodLiteral,...$t(t)});class xn extends At{constructor(){super(...arguments),Mt.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return ht(t,{expected:Ke.joinValues(n),received:t.parsedType,code:ot.invalid_type}),mt}if(wt(this,Mt,"f")||xt(this,Mt,new Set(this._def.values),"f"),!wt(this,Mt,"f").has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return ht(t,{received:t.data,code:ot.invalid_enum_value,options:n}),mt}return ft(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return xn.create(e,{...this._def,...t})}exclude(e,t=this._def){return xn.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}Mt=new WeakMap,xn.create=wn;class Cn extends At{constructor(){super(...arguments),kt.set(this,void 0)}_parse(e){const t=Ke.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==it.string&&n.parsedType!==it.number){const e=Ke.objectValues(t);return ht(n,{expected:Ke.joinValues(e),received:n.parsedType,code:ot.invalid_type}),mt}if(wt(this,kt,"f")||xt(this,kt,new Set(Ke.getValidEnumValues(this._def.values)),"f"),!wt(this,kt,"f").has(e.data)){const e=Ke.objectValues(t);return ht(n,{received:n.data,code:ot.invalid_enum_value,options:e}),mt}return ft(e.data)}get enum(){return this._def.values}}kt=new WeakMap,Cn.create=(e,t)=>new Cn({values:e,typeName:Pn.ZodNativeEnum,...$t(t)});class Mn extends At{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.promise&&!1===t.common.async)return ht(t,{code:ot.invalid_type,expected:it.promise,received:t.parsedType}),mt;const n=t.parsedType===it.promise?t.data:Promise.resolve(t.data);return ft(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}Mn.create=(e,t)=>new Mn({type:e,typeName:Pn.ZodPromise,...$t(t)});class kn extends At{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Pn.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),a=this._def.effect||null,i={addIssue:e=>{ht(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===a.type){const e=a.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return mt;const a=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===a.status?mt:"dirty"===a.status||"dirty"===t.value?gt(a.value):a}));{if("aborted"===t.value)return mt;const a=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===a.status?mt:"dirty"===a.status||"dirty"===t.value?gt(a.value):a}}if("refinement"===a.type){const e=e=>{const t=a.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===n.common.async){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===a.status?mt:("dirty"===a.status&&t.dirty(),e(a.value),{status:t.value,value:a.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((n=>"aborted"===n.status?mt:("dirty"===n.status&&t.dirty(),e(n.value).then((()=>({status:t.value,value:n.value}))))))}if("transform"===a.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!yt(e))return e;const r=a.transform(e.value,i);if(r instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:r}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((e=>yt(e)?Promise.resolve(a.transform(e.value,i)).then((e=>({status:t.value,value:e}))):e))}Ke.assertNever(a)}}kn.create=(e,t,n)=>new kn({schema:e,typeName:Pn.ZodEffects,effect:t,...$t(n)}),kn.createWithPreprocess=(e,t,n)=>new kn({schema:t,effect:{type:"preprocess",transform:e},typeName:Pn.ZodEffects,...$t(n)});class Sn extends At{_parse(e){return this._getType(e)===it.undefined?ft(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Sn.create=(e,t)=>new Sn({innerType:e,typeName:Pn.ZodOptional,...$t(t)});class En extends At{_parse(e){return this._getType(e)===it.null?ft(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}En.create=(e,t)=>new En({innerType:e,typeName:Pn.ZodNullable,...$t(t)});class $n extends At{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===it.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}$n.create=(e,t)=>new $n({innerType:e,typeName:Pn.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...$t(t)});class An extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return bt(a)?a.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new st(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new st(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}An.create=(e,t)=>new An({innerType:e,typeName:Pn.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...$t(t)});class zn extends At{_parse(e){if(this._getType(e)!==it.nan){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.nan,received:t.parsedType}),mt}return{status:"valid",value:e.data}}}zn.create=e=>new zn({typeName:Pn.ZodNaN,...$t(e)});const In=Symbol("zod_brand");class Tn extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class jn extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?mt:"dirty"===e.status?(t.dirty(),gt(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})()}{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?mt:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new jn({in:e,out:t,typeName:Pn.ZodPipeline})}}class On extends At{_parse(e){const t=this._def.innerType._parse(e),n=e=>(yt(e)&&(e.value=Object.freeze(e.value)),e);return bt(t)?t.then((e=>n(e))):n(t)}unwrap(){return this._def.innerType}}function Dn(e,t={},n){return e?tn.create().superRefine(((a,i)=>{var r,o;if(!e(a)){const e="function"==typeof t?t(a):"string"==typeof t?{message:t}:t,s=null===(o=null!==(r=e.fatal)&&void 0!==r?r:n)||void 0===o||o,c="string"==typeof e?{message:e}:e;i.addIssue({code:"custom",...c,fatal:s})}})):tn.create()}On.create=(e,t)=>new On({innerType:e,typeName:Pn.ZodReadonly,...$t(t)});const Rn={object:cn.lazycreate};var Pn;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(Pn||(Pn={}));const Ln=Wt.create,Nn=Qt.create,Fn=zn.create,Vn=Gt.create,Hn=Yt.create,Bn=Kt.create,qn=Xt.create,Un=Jt.create,Wn=en.create,Zn=tn.create,Qn=nn.create,Gn=an.create,Yn=rn.create,Kn=on.create,Xn=cn.create,Jn=cn.strictCreate,ea=ln.create,ta=un.create,na=pn.create,aa=mn.create,ia=gn.create,ra=fn.create,oa=_n.create,sa=vn.create,ca=yn.create,la=bn.create,da=xn.create,ua=Cn.create,ha=Mn.create,pa=kn.create,ma=Sn.create,ga=En.create,fa=kn.createWithPreprocess,_a=jn.create,va={string:e=>Wt.create({...e,coerce:!0}),number:e=>Qt.create({...e,coerce:!0}),boolean:e=>Yt.create({...e,coerce:!0}),bigint:e=>Gt.create({...e,coerce:!0}),date:e=>Kt.create({...e,coerce:!0})},ya=mt;var ba=Object.freeze({__proto__:null,defaultErrorMap:ct,setErrorMap:function(e){lt=e},getErrorMap:dt,makeIssue:ut,EMPTY_PATH:[],addIssueToContext:ht,ParseStatus:pt,INVALID:mt,DIRTY:gt,OK:ft,isAborted:_t,isDirty:vt,isValid:yt,isAsync:bt,get util(){return Ke},get objectUtil(){return Xe},ZodParsedType:it,getParsedType:rt,ZodType:At,datetimeRegex:qt,ZodString:Wt,ZodNumber:Qt,ZodBigInt:Gt,ZodBoolean:Yt,ZodDate:Kt,ZodSymbol:Xt,ZodUndefined:Jt,ZodNull:en,ZodAny:tn,ZodUnknown:nn,ZodNever:an,ZodVoid:rn,ZodArray:on,ZodObject:cn,ZodUnion:ln,ZodDiscriminatedUnion:un,ZodIntersection:pn,ZodTuple:mn,ZodRecord:gn,ZodMap:fn,ZodSet:_n,ZodFunction:vn,ZodLazy:yn,ZodLiteral:bn,ZodEnum:xn,ZodNativeEnum:Cn,ZodPromise:Mn,ZodEffects:kn,ZodTransformer:kn,ZodOptional:Sn,ZodNullable:En,ZodDefault:$n,ZodCatch:An,ZodNaN:zn,BRAND:In,ZodBranded:Tn,ZodPipeline:jn,ZodReadonly:On,custom:Dn,Schema:At,ZodSchema:At,late:Rn,get ZodFirstPartyTypeKind(){return Pn},coerce:va,any:Zn,array:Kn,bigint:Vn,boolean:Hn,date:Bn,discriminatedUnion:ta,effect:pa,enum:da,function:sa,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>Dn((t=>t instanceof e),t),intersection:na,lazy:ca,literal:la,map:ra,nan:Fn,nativeEnum:ua,never:Gn,null:Wn,nullable:ga,number:Nn,object:Xn,oboolean:()=>Hn().optional(),onumber:()=>Nn().optional(),optional:ma,ostring:()=>Ln().optional(),pipeline:_a,preprocess:fa,promise:ha,record:ia,set:oa,strictObject:Jn,string:Ln,symbol:qn,transformer:pa,tuple:aa,undefined:Un,union:ea,unknown:Qn,void:Yn,NEVER:ya,ZodIssueCode:ot,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:st});const wa="https://github.com/dermotduffy/frigate-hass-card",xa=`${wa}#troubleshooting`,Ca="cameras",Ma=`${Ca}.#.camera_entity`,ka=`${Ca}.#.frigate.camera_name`,Sa=`${Ca}.#.capabilities.disable`,Ea=`${Ca}.#.capabilities.disable_except`,$a=`${Ca}.#.cast.method`,Aa=`${Ca}.#.cast.dashboard.dashboard_path`,za=`${Ca}.#.cast.dashboard.view_path`,Ia=`${Ca}.#.dimensions.aspect_ratio`,Ta=`${Ca}.#.frigate.client_id`,ja=`${Ca}.#.frigate.labels`,Oa=`${Ca}.#.frigate.url`,Da=`${Ca}.#.frigate.zones`,Ra=`${Ca}.#.go2rtc.modes`,Pa=`${Ca}.#.go2rtc.stream`,La=`${Ca}.#.icon`,Na=`${Ca}.#.id`,Fa=`${Ca}.#.image.entity`,Va=`${Ca}.#.image.entity_parameters`,Ha=`${Ca}.#.image.mode`,Ba=`${Ca}.#.image.refresh_seconds`,qa=`${Ca}.#.image.url`,Ua=`${Ca}.#.motioneye.images.directory_pattern`,Wa=`${Ca}.#.motioneye.images.file_pattern`,Za=`${Ca}.#.motioneye.movies.directory_pattern`,Qa=`${Ca}.#.motioneye.movies.file_pattern`,Ga=`${Ca}.#.motioneye.url`,Ya=`${Ca}.#.title`,Ka=`${Ca}.#.webrtc_card.entity`,Xa=`${Ca}.#.webrtc_card.url`,Ja=`${Ca}.#.live_provider`,ei=`${Ca}.#.dependencies.cameras`,ti=`${Ca}.#.dependencies.all_cameras`,ni=`${Ca}.#.dimensions.layout.fit`,ai=`${Ca}.#.dimensions.layout.pan.x`,ii=`${Ca}.#.dimensions.layout.pan.y`,ri=`${Ca}.#.dimensions.layout.position.x`,oi=`${Ca}.#.dimensions.layout.position.y`,si=`${Ca}.#.dimensions.layout.view_box.top`,ci=`${Ca}.#.dimensions.layout.view_box.bottom`,li=`${Ca}.#.dimensions.layout.view_box.left`,di=`${Ca}.#.dimensions.layout.view_box.right`,ui=`${Ca}.#.dimensions.layout.zoom`,hi=`${Ca}.#.proxy.dynamic`,pi=`${Ca}.#.proxy.media`,mi=`${Ca}.#.proxy.ssl_ciphers`,gi=`${Ca}.#.proxy.ssl_verification`,fi=`${Ca}.#.reolink.media_resolution`,_i=`${Ca}.#.reolink.url`,vi=`${Ca}.#.triggers.motion`,yi=`${Ca}.#.triggers.occupancy`,bi=`${Ca}.#.triggers.entities`,wi=`${Ca}.#.triggers.events`,xi="cameras_global",Ci=`${xi}.image`,Mi=`${xi}.live_provider`,ki=`${xi}.jsmpeg`,Si=`${xi}.webrtc_card`,Ei=`${xi}.triggers.occupancy`,$i=`${xi}.image.refresh_seconds`,Ai=`${xi}.dimensions.layout`,zi=`${xi}.ptz`,Ii="elements",Ti="view",ji=`${Ti}.camera_select`,Oi=`${Ti}.dark_mode`,Di=`${Ti}.default`,Ri=`${Ti}.interaction_seconds`,Pi=`${Ti}.keyboard_shortcuts`,Li=`${Ti}.keyboard_shortcuts.enabled`,Ni=`${Pi}.ptz_left`,Fi=`${Pi}.ptz_right`,Vi=`${Pi}.ptz_up`,Hi=`${Pi}.ptz_down`,Bi=`${Pi}.ptz_zoom_in`,qi=`${Pi}.ptz_zoom_out`,Ui=`${Pi}.ptz_home`,Wi=`${Ti}.default_cycle_camera`,Zi=`${Ti}.default_reset`,Qi=`${Zi}.interaction_mode`,Gi=`${Zi}.every_seconds`,Yi=`${Zi}.entities`,Ki=`${Zi}.after_interaction`,Xi=`${Ti}.triggers`,Ji=`${Xi}.show_trigger_status`,er=`${Xi}.filter_selected_camera`,tr=`${Xi}.untrigger_seconds`,nr=`${Xi}.actions`,ar=`${nr}.trigger`,ir=`${nr}.untrigger`,rr=`${nr}.interaction_mode`,or="media_gallery",sr=`${or}.controls.filter.mode`,cr=`${or}.controls.thumbnails.show_details`,lr=`${or}.controls.thumbnails.show_download_control`,dr=`${or}.controls.thumbnails.show_favorite_control`,ur=`${or}.controls.thumbnails.show_timeline_control`,hr=`${or}.controls.thumbnails.size`,pr="media_viewer",mr=`${pr}.auto_play`,gr=`${pr}.auto_pause`,fr=`${pr}.auto_mute`,_r=`${pr}.auto_unmute`,vr=`${pr}.display.mode`,yr=`${pr}.display.grid_columns`,br=`${pr}.display.grid_max_columns`,wr=`${pr}.display.grid_selected_width_factor`,xr=`${pr}.draggable`,Cr=`${pr}.lazy_load`,Mr=`${pr}.snapshot_click_plays_clip`,kr=`${pr}.transition_effect`,Sr=`${pr}.controls.builtin`,Er=`${pr}.controls.next_previous.style`,$r=`${pr}.controls.next_previous.size`,Ar=`${pr}.controls.thumbnails.mode`,zr=`${pr}.controls.thumbnails.show_details`,Ir=`${pr}.controls.thumbnails.show_download_control`,Tr=`${pr}.controls.thumbnails.show_favorite_control`,jr=`${pr}.controls.thumbnails.show_timeline_control`,Or=`${pr}.controls.thumbnails.size`,Dr=`${pr}.controls.timeline.clustering_threshold`,Rr=`${pr}.controls.timeline.events_media_type`,Pr=`${pr}.controls.timeline.mode`,Lr=`${pr}.controls.timeline.pan_mode`,Nr=`${pr}.controls.timeline.show_recordings`,Fr=`${pr}.controls.timeline.style`,Vr=`${pr}.controls.timeline.window_seconds`,Hr=`${pr}.zoomable`,Br="live",qr=`${Br}.auto_play`,Ur=`${Br}.auto_pause`,Wr=`${Br}.auto_mute`,Zr=`${Br}.auto_unmute`,Qr=`${Br}.controls.builtin`,Gr=`${Br}.controls.next_previous.style`,Yr=`${Br}.controls.next_previous.size`,Kr=`${Br}.controls.ptz.hide_home`,Xr=`${Br}.controls.ptz.hide_pan_tilt`,Jr=`${Br}.controls.ptz.hide_zoom`,eo=`${Br}.controls.ptz.mode`,to=`${Br}.controls.ptz.orientation`,no=`${Br}.controls.ptz.position`,ao=`${Br}.controls.thumbnails.media_type`,io=`${Br}.controls.thumbnails.events_media_type`,ro=`${Br}.controls.thumbnails.mode`,oo=`${Br}.controls.thumbnails.size`,so=`${Br}.controls.thumbnails.show_details`,co=`${Br}.controls.thumbnails.show_download_control`,lo=`${Br}.controls.thumbnails.show_favorite_control`,uo=`${Br}.controls.thumbnails.show_timeline_control`,ho=`${Br}.controls.timeline.clustering_threshold`,po=`${Br}.controls.timeline.events_media_type`,mo=`${Br}.controls.timeline.mode`,go=`${Br}.controls.timeline.pan_mode`,fo=`${Br}.controls.timeline.show_recordings`,_o=`${Br}.controls.timeline.style`,vo=`${Br}.controls.timeline.window_seconds`,yo=`${Br}.display.mode`,bo=`${Br}.display.grid_columns`,wo=`${Br}.display.grid_max_columns`,xo=`${Br}.display.grid_selected_width_factor`,Co=`${Br}.draggable`,Mo=`${Br}.lazy_load`,ko=`${Br}.lazy_unload`,So=`${Br}.preload`,Eo=`${Br}.transition_effect`,$o=`${Br}.show_image_during_load`,Ao=`${Br}.microphone.disconnect_seconds`,zo=`${Br}.microphone.mute_after_microphone_mute_seconds`,Io=`${Br}.microphone.always_connected`,To=`${Br}.zoomable`,jo="image",Oo=`${jo}.entity`,Do=`${jo}.entity_parameters`,Ro=`${jo}.mode`,Po=`${jo}.refresh_seconds`,Lo=`${jo}.url`,No="timeline",Fo=`${No}.window_seconds`,Vo=`${No}.clustering_threshold`,Ho=`${No}.events_media_type`,Bo=`${No}.show_recordings`,qo=`${No}.style`,Uo=`${No}.controls.thumbnails.mode`,Wo=`${No}.controls.thumbnails.size`,Zo=`${No}.controls.thumbnails.show_details`,Qo=`${No}.controls.thumbnails.show_download_control`,Go=`${No}.controls.thumbnails.show_favorite_control`,Yo=`${No}.controls.thumbnails.show_timeline_control`,Ko="menu",Xo=`${Ko}.alignment`,Jo=`${Ko}.position`,es=`${Ko}.style`,ts=`${Ko}.button_size`,ns=`${Ko}.buttons`,as=`${ns}.frigate`,is=`${ns}.camera_ui`,rs=`${ns}.fullscreen`,os=`${ns}.play`,ss=`${ns}.mute`,cs=`${ns}.media_player`,ls=`${ns}.timeline`,ds="status_bar",us=`${ds}.position`,hs=`${ds}.style`,ps=`${ds}.popup_seconds`,ms=`${ds}.height`,gs=`${ds}.items`,fs="dimensions",_s=`${fs}.aspect_ratio`,vs=`${fs}.aspect_ratio_mode`,ys=`${fs}.height`,bs="overrides",ws="performance",xs=`${ws}.features.animated_progress_indicator`,Cs=`${ws}.features.media_chunk_size`,Ms=`${ws}.features.max_simultaneous_engine_requests`,ks=`${ws}.profile`,Ss=`${ws}.style.box_shadow`,Es=`${ws}.style.border_radius`,$s="profiles",As=1e3;class zs extends Error{constructor(e,t){super(e),this.context=t}}const Is={info:10,error:20,connection:30,diagnostics:40},Ts=["clips","favorite-events","favorite-recordings","live","menu","ptz","recordings","seek","snapshots","substream"],js=ba.object({url:ba.string(),mime_type:ba.string()}),Os=ba.object({path:ba.string()});function Ds(e){if(e instanceof ba.ZodDefault)return Ds(e.removeDefault());if(e instanceof ba.ZodObject){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=ba.ZodOptional.create(Ds(a))}return new ba.ZodObject({...e._def,shape:()=>t})}return e instanceof ba.ZodArray?ba.ZodArray.create(Ds(e.element)).min(e._def.minLength?.value,e._def.minLength?.message).max(e._def.maxLength?.value,e._def.maxLength?.message).length(e._def.exactLength?.value,e._def.exactLength?.message):e instanceof ba.ZodOptional?ba.ZodOptional.create(Ds(e.unwrap())):e instanceof ba.ZodNullable?ba.ZodNullable.create(Ds(e.unwrap())):e instanceof ba.ZodTuple?ba.ZodTuple.create(e.items.map((e=>Ds(e)))):e}function Rs(e){const t=e.format();return Object.keys(t).filter((e=>!e.startsWith("_")))}const Ps=e=>{const t=new Set;if(e.issues.length)for(const n of e.issues)if("invalid_union"===n.code){const e=n.unionErrors;for(const n of e)Ps(n).forEach(t.add,t)}else t.add(Ls(n.path));return t},Ls=e=>{let t="";for(let n=0;n"fire-dom-event")).or(ba.literal("fire-dom-event")),card_id:ba.string().regex(tc,"card_id parameter can only contain [a-z][A-Z][0-9_]-").optional()}),_c=fc.extend({frigate_card_action:ba.enum(Zs)}),vc=fc.extend({frigate_card_action:ba.enum(["camera_ui","default","download","expand","fullscreen","live_substream_off","live_substream_on","menu_toggle","microphone_connect","microphone_disconnect","microphone_mute","microphone_unmute","mute","pause","play","screenshot","unmute"])}),yc=fc.extend({frigate_card_action:ba.literal("camera_select"),camera:ba.string().optional(),triggered:ba.boolean().optional()}),bc=fc.extend({frigate_card_action:ba.literal("live_substream_select"),camera:ba.string()}),wc=fc.extend({frigate_card_action:ba.literal("media_player"),media_player:ba.string(),media_player_action:ba.enum(["play","stop"])}),xc=fc.extend({frigate_card_action:ba.literal("display_mode_select"),display_mode:ic}),Cc=fc.extend({frigate_card_action:ba.literal("ptz"),camera:ba.string().optional(),ptz_action:ba.enum(Hs).optional(),ptz_phase:ba.enum(Js).optional(),ptz_preset:ba.string().optional()}),Mc=fc.extend({frigate_card_action:ba.literal("ptz_digital"),target_id:ba.string().optional(),absolute:ba.object({zoom:ac.optional(),pan:nc.optional()}).optional(),ptz_action:ba.enum(Hs).optional(),ptz_phase:ba.enum(Js).optional()}),kc=fc.extend({frigate_card_action:ba.literal("ptz_multi"),target_id:ba.string().optional(),ptz_action:ba.enum(Hs).optional(),ptz_phase:ba.enum(Js).optional(),ptz_preset:ba.string().optional()}),Sc=fc.extend({frigate_card_action:ba.literal("ptz_controls"),enabled:ba.boolean()}),Ec=ba.object({ms:ba.number().optional(),s:ba.number().optional(),m:ba.number().optional(),h:ba.number().optional()}),$c=fc.extend({frigate_card_action:ba.literal("sleep"),duration:Ec.optional().default({s:1})}),Ac=fc.extend({frigate_card_action:ba.literal("status_bar"),status_bar_action:ba.enum(["add","remove","reset"]),items:ba.lazy((()=>ol)).array().optional()}),zc=fc.extend({frigate_card_action:ba.literal("log"),message:ba.string(),level:ba.enum(["debug","info","warn","error"]).default("info")}),Ic=ba.union([yc,vc,bc,zc,wc,Cc,Mc,kc,Sc,_c,xc,$c,Ac]),Tc=ba.union([sc,dc,lc,uc,hc,pc,gc,mc,Ic]),jc=ba.object({tap_action:Tc.or(Tc.array()).optional(),hold_action:Tc.or(Tc.array()).optional(),double_tap_action:Tc.or(Tc.array()).optional(),start_tap_action:Tc.or(Tc.array()).optional(),end_tap_action:Tc.or(Tc.array()).optional()}).passthrough(),Oc=ba.object({actions:jc.optional()}),Dc=jc.extend({style:ba.record(ba.string().nullable().or(ba.undefined()).or(ba.number())).optional(),title:ba.string().nullable().optional()}),Rc=Dc.extend({type:ba.literal("state-badge"),entity:ba.string()}),Pc=Dc.extend({type:ba.literal("state-icon"),entity:ba.string(),icon:ba.string().optional(),state_color:ba.boolean().default(!0)}),Lc=Dc.extend({type:ba.literal("state-label"),entity:ba.string(),attribute:ba.string().optional(),prefix:ba.string().optional(),suffix:ba.string().optional()}),Nc=Dc.extend({type:ba.literal("service-button"),title:ba.string(),service:ba.string(),service_data:ba.object({}).passthrough().optional()}),Fc=Dc.extend({type:ba.literal("icon"),icon:ba.string(),entity:ba.string().optional()}),Vc=Dc.extend({type:ba.literal("image"),entity:ba.string().optional(),image:ba.string().optional(),camera_image:ba.string().optional(),camera_view:ba.string().optional(),state_image:ba.object({}).passthrough().optional(),filter:ba.string().optional(),state_filter:ba.object({}).passthrough().optional(),aspect_ratio:ba.string().optional()}),Hc=ba.object({condition:ba.literal("state").optional(),entity:ba.string(),state:ba.string().or(ba.string().array()).optional(),state_not:ba.string().or(ba.string().array()).optional()}),Bc=ba.object({condition:ba.literal("numeric_state"),entity:ba.string(),above:ba.number().optional(),below:ba.number().optional()}),qc=ba.object({condition:ba.literal("screen"),media_query:ba.string()}),Uc=ba.object({condition:ba.literal("user"),users:ba.string().array().min(1)}),Wc=ba.discriminatedUnion("condition",[Hc,Bc,qc,Uc]),Zc=ba.object({type:ba.literal("conditional"),conditions:Wc.array(),elements:ba.lazy((()=>yl))}),Qc=ba.object({type:ba.string().superRefine(((e,t)=>{e.match(/^custom:(?!frigate-card).+/)||t.addIssue({code:ba.ZodIssueCode.custom,message:"Frigate-card custom elements must match specific schemas",fatal:!0})}))}).passthrough(),Gc=ba.object({enabled:ba.boolean().default(!0).optional(),priority:ba.number().min(0).max(Us).default(50).optional(),alignment:ba.enum(["matching","opposing"]).default("matching").optional(),icon:ba.string().optional(),permanent:ba.boolean().default(!1).optional()}),Yc=Gc.merge(Fc).extend({type:ba.literal("custom:frigate-card-menu-icon")}),Kc=Gc.merge(Pc).extend({type:ba.literal("custom:frigate-card-menu-state-icon")}).merge(Gc),Xc=Dc.extend({entity:ba.string().optional(),icon:ba.string().optional(),state_color:ba.boolean().default(!0),selected:ba.boolean().default(!1),subtitle:ba.string().optional(),enabled:ba.boolean().default(!0)}),Jc=Gc.merge(Fc).extend({type:ba.literal("custom:frigate-card-menu-submenu"),items:Xc.array()}),el=Gc.merge(Pc).extend({type:ba.literal("custom:frigate-card-menu-submenu-select"),options:ba.record(Xc.deepPartial()).optional()}),tl=ba.object({enabled:ba.boolean().default(!0).optional(),priority:ba.number().min(0).max(100).default(50).optional()}),nl=tl.extend({sufficient:ba.boolean().default(!1).optional(),exclusive:ba.boolean().default(!1).optional(),expand:ba.boolean().default(!1).optional(),actions:jc.optional()}),al=nl.extend({type:ba.literal("custom:frigate-card-status-bar-icon"),icon:ba.string()}),il=nl.extend({type:ba.literal("custom:frigate-card-status-bar-image"),image:ba.string()}),rl=nl.extend({type:ba.literal("custom:frigate-card-status-bar-string"),string:ba.string()}),ol=ba.union([al,il,rl]),sl=ba.object({condition:ba.literal("view"),views:ba.string().array()}),cl=ba.object({condition:ba.literal("fullscreen"),fullscreen:ba.boolean()}),ll=ba.object({condition:ba.literal("expand"),expand:ba.boolean()}),dl=ba.object({condition:ba.literal("camera"),cameras:ba.string().array()}),ul=ba.object({condition:ba.literal("media_loaded"),media_loaded:ba.boolean()}),hl=ba.object({condition:ba.literal("display_mode"),display_mode:ic}),pl=ba.object({condition:ba.literal("triggered"),triggered:ba.string().array()}),ml=ba.object({condition:ba.literal("interaction"),interaction:ba.boolean()}),gl=ba.object({condition:ba.literal("microphone"),connected:ba.boolean().optional(),muted:ba.boolean().optional()}),fl=ba.object({condition:ba.literal("key"),key:ba.string(),state:ba.enum(["down","up"]).optional(),ctrl:ba.boolean().optional(),shift:ba.boolean().optional(),alt:ba.boolean().optional(),meta:ba.boolean().optional()}),_l=ba.discriminatedUnion("condition",[Hc,Bc,qc,Uc,sl,cl,ll,dl,ul,hl,pl,ml,gl,fl]),vl=ba.object({type:ba.literal("custom:frigate-card-conditional"),conditions:_l.array(),elements:ba.lazy((()=>yl))}),yl=ba.union([Zc,Qc,vl,Fc,Vc,Yc,Kc,Jc,el,Nc,Rc,Pc,Lc,al,il,rl]).array().optional(),bl=ba.object({fit:ba.enum(["contain","cover","fill"]).optional(),position:ba.object({x:ba.number().min(0).max(100).optional(),y:ba.number().min(0).max(100).optional()}).optional(),view_box:ba.object({bottom:ba.number().min(0).max(100).optional().default(0),left:ba.number().min(0).max(100).optional().default(0),right:ba.number().min(0).max(100).optional().default(0),top:ba.number().min(0).max(100).optional().default(0)}).optional(),pan:nc.optional(),zoom:ac.optional()}),wl=ba.number().array().length(2).or(ba.string().regex(/^\s*\d+\.?\d*\s*[:/]\s*\d+\.?\d*\s*$/).transform((e=>e.split(/[:\/]/).map((e=>Number(e)))))),xl={r2c_delay_between_calls_seconds:.5,c2r_delay_between_calls_seconds:.2},Cl=function(e){return t=>{if(!t||"object"!=typeof t||!t.service)return t;const n={...t};return Object.keys(t).forEach((a=>{const i=a.match(/^data_(.+)$/),r=i?.[1];r&&!(`${e}${r}`in t)&&(n[`${e}${r}`]={action:"perform-action",perform_action:t.service,data:t[a]},delete n[a],delete n.service)})),n}},Ml=ba.preprocess(Cl("actions_"),ba.object({actions_left:lc.optional(),actions_left_start:lc.optional(),actions_left_stop:lc.optional(),actions_right:lc.optional(),actions_right_start:lc.optional(),actions_right_stop:lc.optional(),actions_up:lc.optional(),actions_up_start:lc.optional(),actions_up_stop:lc.optional(),actions_down:lc.optional(),actions_down_start:lc.optional(),actions_down_stop:lc.optional(),actions_zoom_in:lc.optional(),actions_zoom_in_start:lc.optional(),actions_zoom_in_stop:lc.optional(),actions_zoom_out:lc.optional(),actions_zoom_out_start:lc.optional(),actions_zoom_out_stop:lc.optional(),r2c_delay_between_calls_seconds:ba.number().default(xl.r2c_delay_between_calls_seconds),c2r_delay_between_calls_seconds:ba.number().default(xl.c2r_delay_between_calls_seconds),presets:ba.preprocess(Cl(""),ba.union([ba.record(lc),ba.object({service:ba.string().optional()})])).optional(),service:ba.string().optional()}).passthrough()),kl={orientation:"horizontal",mode:"auto",hide_pan_tilt:!1,hide_zoom:!1,hide_home:!1,position:"bottom-right"},Sl=ba.object({mode:ba.enum(["off","auto","on"]).default(kl.mode),position:ba.enum(["top-left","top-right","bottom-left","bottom-right"]).default(kl.position),orientation:ba.enum(["vertical","horizontal"]).default(kl.orientation),hide_pan_tilt:ba.boolean().default(kl.hide_pan_tilt),hide_zoom:ba.boolean().default(kl.hide_zoom),hide_home:ba.boolean().default(kl.hide_home),style:ba.object({}).passthrough().optional()}),El={mode:"auto",refresh_seconds:1},$l=ba.object({mode:ba.enum(["auto","camera","entity","screensaver","url"]).default(El.mode),refresh_seconds:ba.number().min(0).default(El.refresh_seconds),url:ba.string().optional(),entity:ba.string().optional(),entity_parameters:ba.string().optional()}),Al=$l.merge(Oc).default(El),zl=75,Il=300,Tl={size:100,show_details:!0,show_favorite_control:!0,show_timeline_control:!0,show_download_control:!0},jl=ba.object({size:ba.number().min(75).max(300).default(Tl.size),show_details:ba.boolean().default(Tl.show_details),show_favorite_control:ba.boolean().default(Tl.show_favorite_control),show_timeline_control:ba.boolean().default(Tl.show_timeline_control),show_download_control:ba.boolean().default(Tl.show_download_control)}),Ol={...Tl,mode:"right"},Dl=jl.extend({mode:ba.enum(["none","above","below","left","right"]).default(Ol.mode)}),Rl=ba.enum(["all","clips","snapshots"]),Pl={clustering_threshold:3,events_media_type:"all",window_seconds:3600,show_recordings:!0,style:"stack",pan_mode:"pan"},Ll=ba.enum(["pan","seek","seek-in-media","seek-in-camera"]),Nl=ba.object({clustering_threshold:ba.number().optional().default(Pl.clustering_threshold),events_media_type:Rl.optional().default(Pl.events_media_type),window_seconds:ba.number().min(60).max(86400).optional().default(Pl.window_seconds),show_recordings:ba.boolean().optional().default(Pl.show_recordings),style:ba.enum(["stack","ribbon"]).optional().default(Pl.style),pan_mode:Ll.optional().default(Pl.pan_mode)}),Fl={...Pl,mode:"none",style:"ribbon"},Vl=Nl.extend({mode:ba.enum(["none","above","below"]).default(Fl.mode),style:Nl.shape.style.default(Fl.style)}),Hl={...Pl,controls:{thumbnails:Ol}},Bl=Nl.extend({controls:ba.object({thumbnails:Dl.default(Hl.controls.thumbnails)}).default(Hl.controls)}).default(Hl),ql=ba.object({style:ba.enum(["none","chevrons","icons","thumbnails"]),size:ba.number().min(20)}),Ul=ba.enum(["none","slide"]),Wl={always_connected:!1,disconnect_seconds:90,mute_after_microphone_mute_seconds:60},Zl=ba.object({always_connected:ba.boolean().default(Wl.always_connected),disconnect_seconds:ba.number().min(0).default(Wl.disconnect_seconds),mute_after_microphone_mute_seconds:ba.number().min(0).default(Wl.mute_after_microphone_mute_seconds)}).default(Wl),Ql=ba.object({url:ba.string().transform((e=>e.replace(/\/+$/,""))).optional(),host:ba.string().optional(),modes:ba.enum(["webrtc","mse","mp4","mjpeg"]).array().optional(),stream:ba.string().optional()}),Gl=ba.object({entity:ba.string().optional(),url:ba.string().optional()}).passthrough(),Yl=ba.object({options:ba.object({audio:ba.boolean().optional(),video:ba.boolean().optional(),pauseWhenHidden:ba.boolean().optional(),disableGl:ba.boolean().optional(),disableWebAssembly:ba.boolean().optional(),preserveDrawingBuffer:ba.boolean().optional(),progressive:ba.boolean().optional(),throttled:ba.boolean().optional(),chunkSize:ba.number().optional(),maxAudioLag:ba.number().optional(),videoBufferSize:ba.number().optional(),audioBufferSize:ba.number().optional()}).optional()}),Kl={...Ol,media_type:"events",events_media_type:"all"},Xl={auto_play:[...Ys],auto_pause:[],auto_mute:[...Xs],auto_unmute:["microphone"],preload:!1,lazy_load:!0,lazy_unload:[],draggable:!0,zoomable:!0,transition_effect:"slide",show_image_during_load:!0,mode:"single",controls:{builtin:!0,next_previous:{size:48,style:"chevrons"},ptz:kl,thumbnails:Kl,timeline:Fl},microphone:{...Wl}},Jl=Dl.extend({media_type:ba.enum(["events","recordings"]).default(Xl.controls.thumbnails.media_type),events_media_type:Rl.default(Xl.controls.thumbnails.events_media_type)}),ed=ba.object({auto_pause:ba.enum(Gs).array().default(Xl.auto_pause),auto_play:ba.enum(Ys).array().default(Xl.auto_play),auto_mute:ba.enum(Xs).array().default(Xl.auto_mute),auto_unmute:ba.enum(Ks).array().default(Xl.auto_unmute),controls:ba.object({builtin:ba.boolean().default(Xl.controls.builtin),next_previous:ql.extend({style:ba.enum(["none","chevrons","icons"]).default(Xl.controls.next_previous.style),size:ql.shape.size.default(Xl.controls.next_previous.size)}).default(Xl.controls.next_previous),ptz:Sl.default(Xl.controls.ptz),thumbnails:Jl.default(Xl.controls.thumbnails),timeline:Vl.default(Xl.controls.timeline)}).default(Xl.controls),display:rc,draggable:ba.boolean().default(Xl.draggable),lazy_load:ba.boolean().default(Xl.lazy_load),lazy_unload:ba.enum(Gs).array().default(Xl.lazy_unload),microphone:Zl.default(Xl.microphone),preload:ba.boolean().default(Xl.preload),show_image_during_load:ba.boolean().default(Xl.show_image_during_load),transition_effect:Ul.default(Xl.transition_effect),zoomable:ba.boolean().default(Xl.zoomable)}).merge(Oc).default(Xl),td=ba.object({live:ed}),nd=ba.object({method:ba.enum(["standard","dashboard"]).default("standard").optional(),dashboard:ba.object({dashboard_path:ba.string().optional(),view_path:ba.string().optional()}).optional()}),ad={dependencies:{all_cameras:!1,cameras:[]},engine:"auto",frigate:{client_id:"frigate"},live_provider:"auto",motioneye:{images:{directory_pattern:"%Y-%m-%d",file_pattern:"%H-%M-%S"},movies:{directory_pattern:"%Y-%m-%d",file_pattern:"%H-%M-%S"}},reolink:{media_resolution:"low"},ptz:xl,triggers:{motion:!1,occupancy:!1,events:[...ec],entities:[]},proxy:{media:"auto",dynamic:!0,ssl_verification:"auto",ssl_ciphers:"auto"}},id=ba.object({media:ba.boolean().or(ba.literal("auto")).default(ad.proxy.media),dynamic:ba.boolean().default(ad.proxy.dynamic),ssl_verification:ba.boolean().or(ba.literal("auto")).default(ad.proxy.ssl_verification),ssl_ciphers:ba.enum(["default","insecure","intermediate","modern"]).or(ba.literal("auto")).default(ad.proxy.ssl_ciphers)}),rd=ba.object({camera_entity:ba.string().optional(),icon:ba.string().optional(),title:ba.string().optional(),capabilities:ba.object({disable:ba.enum(Ts).array().optional(),disable_except:ba.enum(Ts).array().optional()}).optional(),id:ba.string().optional(),dependencies:ba.object({all_cameras:ba.boolean().default(ad.dependencies.all_cameras),cameras:ba.string().array().default(ad.dependencies.cameras)}).default(ad.dependencies),triggers:ba.object({motion:ba.boolean().default(ad.triggers.motion),occupancy:ba.boolean().default(ad.triggers.occupancy),entities:ba.string().array().default(ad.triggers.entities),events:ba.enum(ec).array().default(ad.triggers.events)}).default(ad.triggers),engine:ba.enum(["auto","frigate","generic","motioneye","reolink"]).default("auto"),frigate:ba.object({url:ba.string().optional(),client_id:ba.string().default(ad.frigate.client_id),camera_name:ba.string().optional(),labels:ba.string().array().optional(),zones:ba.string().array().optional()}).default(ad.frigate),motioneye:ba.object({url:ba.string().optional(),images:ba.object({directory_pattern:ba.string().includes("%").default(ad.motioneye.images.directory_pattern),file_pattern:ba.string().includes("%").default(ad.motioneye.images.file_pattern)}).default(ad.motioneye.images),movies:ba.object({directory_pattern:ba.string().includes("%").default(ad.motioneye.movies.directory_pattern),file_pattern:ba.string().includes("%").default(ad.motioneye.movies.file_pattern)}).default(ad.motioneye.movies)}).default(ad.motioneye),reolink:ba.object({url:ba.string().optional(),media_resolution:ba.enum(["high","low"]).default(ad.reolink.media_resolution)}).default(ad.reolink),live_provider:ba.enum(["auto","image","ha","jsmpeg","go2rtc","webrtc-card"]).default(ad.live_provider),go2rtc:Ql.optional(),image:$l.optional().default(El),jsmpeg:Yl.optional(),webrtc_card:Gl.optional(),cast:nd.optional(),ptz:Ml.default(ad.ptz),dimensions:ba.object({aspect_ratio:wl.optional(),layout:bl.optional()}).optional(),proxy:id.default(ad.proxy)}).default(ad),od=rd.array().min(1),sd={default:Qs,camera_select:"current",interaction_seconds:300,default_reset:{every_seconds:0,after_interaction:!1,entities:[],interaction_mode:"inactive"},default_cycle_camera:!1,dark_mode:"off",triggers:{show_trigger_status:!1,filter_selected_camera:!0,actions:{trigger:"update",untrigger:"none"},untrigger_seconds:0},keyboard_shortcuts:Fs},cd=ba.enum(["all","inactive","active"]).default("inactive"),ld=ba.object({actions:ba.object({interaction_mode:cd,trigger:ba.enum(["default","live","media","none","update"]).default(sd.triggers.actions.trigger),untrigger:ba.enum(["default","none"]).default(sd.triggers.actions.untrigger)}).default(sd.triggers.actions),filter_selected_camera:ba.boolean().default(sd.triggers.filter_selected_camera),show_trigger_status:ba.boolean().default(sd.triggers.show_trigger_status),untrigger_seconds:ba.number().default(sd.triggers.untrigger_seconds)}),dd=ba.object({default:ba.enum(Zs).default(sd.default),camera_select:ba.enum([...Zs,"current"]).default(sd.camera_select),interaction_seconds:ba.number().default(sd.interaction_seconds),default_cycle_camera:ba.boolean().default(sd.default_cycle_camera),default_reset:ba.object({after_interaction:ba.boolean().default(sd.default_reset.after_interaction),every_seconds:ba.number().default(sd.default_reset.every_seconds),entities:ba.string().array().default(sd.default_reset.entities),interaction_mode:cd.default(sd.default_reset.interaction_mode)}).default(sd.default_reset),render_entities:ba.string().array().optional(),dark_mode:ba.enum(["on","off","auto"]).optional(),triggers:ld.default(sd.triggers),keyboard_shortcuts:Vs.default(sd.keyboard_shortcuts)}).merge(Oc).default(sd),ud=["left","right","top","bottom"],hd=ud,pd={priority:50,enabled:!0},md={priority:50,enabled:!1},gd={alignment:"left",button_size:40,buttons:{camera_ui:pd,cameras:pd,clips:pd,ptz_home:md,display_mode:pd,download:pd,expand:md,frigate:pd,fullscreen:pd,image:md,live:pd,media_player:pd,microphone:{...md,type:"momentary"},mute:md,play:md,ptz_controls:md,recordings:md,screenshot:md,snapshots:pd,substreams:pd,timeline:pd},position:"top",style:"hidden"},fd=Gc.extend({enabled:Gc.shape.enabled.default(pd.enabled),priority:Gc.shape.priority.default(pd.priority)}),_d=Gc.extend({enabled:Gc.shape.enabled.default(md.enabled),priority:Gc.shape.priority.default(md.priority)}),vd=ba.object({style:ba.enum(["none","hidden","overlay","hover","hover-card","outside"]).default(gd.style),position:ba.enum(ud).default(gd.position),alignment:ba.enum(hd).default(gd.alignment),buttons:ba.object({camera_ui:fd.default(gd.buttons.camera_ui),cameras:fd.default(gd.buttons.cameras),clips:fd.default(gd.buttons.clips),ptz_home:_d.default(gd.buttons.ptz_home),display_mode:fd.default(gd.buttons.display_mode),download:fd.default(gd.buttons.download),expand:_d.default(gd.buttons.expand),frigate:fd.default(gd.buttons.frigate),fullscreen:fd.default(gd.buttons.fullscreen),image:_d.default(gd.buttons.image),live:fd.default(gd.buttons.live),media_player:fd.default(gd.buttons.media_player),microphone:_d.extend({type:ba.enum(["momentary","toggle"]).default(gd.buttons.microphone.type)}).default(gd.buttons.microphone),mute:_d.default(gd.buttons.mute),play:_d.default(gd.buttons.play),ptz_controls:_d.default(gd.buttons.ptz_controls),recordings:_d.default(gd.buttons.recordings),screenshot:_d.default(gd.buttons.screenshot),snapshots:fd.default(gd.buttons.snapshots),substreams:fd.default(gd.buttons.substreams),timeline:fd.default(gd.buttons.timeline)}).default(gd.buttons),button_size:ba.number().min(20).default(gd.button_size)}).default(gd),yd={priority:50,enabled:!0},bd={height:46,items:{engine:yd,resolution:yd,technology:yd,title:yd},position:"bottom",style:"popup",popup_seconds:3},wd=ba.object({position:ba.enum(["top","bottom"]).default(bd.position),style:ba.enum(["none","overlay","hover","hover-card","outside","popup"]).default(bd.style),popup_seconds:ba.number().min(0).max(60).default(bd.popup_seconds),height:ba.number().min(20).default(bd.height),items:ba.object({engine:tl.default(bd.items.engine),technology:tl.default(bd.items.technology),resolution:tl.default(bd.items.resolution),title:tl.default(bd.items.title)}).default(bd.items)}).default(bd),xd={auto_play:[...Ys],auto_pause:[...Gs],auto_mute:[...Gs],auto_unmute:[],lazy_load:!0,draggable:!0,zoomable:!0,transition_effect:"slide",snapshot_click_plays_clip:!0,display_mode:"single",controls:{builtin:!0,next_previous:{size:48,style:"thumbnails"},thumbnails:Ol,timeline:Fl,ptz:{...kl,mode:"off"}}},Cd=ql.extend({style:ba.enum(["none","thumbnails","chevrons"]).default(xd.controls.next_previous.style),size:ql.shape.size.default(xd.controls.next_previous.size)}),Md=ba.object({auto_play:ba.enum(Ys).array().default(xd.auto_play),auto_pause:ba.enum(Gs).array().default(xd.auto_pause),auto_mute:ba.enum(Gs).array().default(xd.auto_mute),auto_unmute:ba.enum(Ys).array().default(xd.auto_unmute),lazy_load:ba.boolean().default(xd.lazy_load),draggable:ba.boolean().default(xd.draggable),zoomable:ba.boolean().default(xd.zoomable),transition_effect:Ul.default(xd.transition_effect),snapshot_click_plays_clip:ba.boolean().default(xd.snapshot_click_plays_clip),display:rc,controls:ba.object({builtin:ba.boolean().default(xd.controls.builtin),next_previous:Cd.default(xd.controls.next_previous),ptz:Sl.extend({mode:ba.enum(["off","on"]).default(xd.controls.ptz.mode)}).default(xd.controls.ptz),thumbnails:Dl.default(xd.controls.thumbnails),timeline:Vl.default(xd.controls.timeline)}).default(xd.controls)}).merge(Oc).default(xd),kd={...Ol,show_details:!1},Sd={controls:{thumbnails:kd,filter:{mode:"right"}}},Ed=Dl.extend({show_details:ba.boolean().default(kd.show_details)}),$d=ba.object({controls:ba.object({thumbnails:Ed.default(Sd.controls.thumbnails),filter:ba.object({mode:ba.enum(["none","left","right"]).default(Sd.controls.filter.mode)}).default(Sd.controls.filter)}).default(Sd.controls)}).merge(Oc).default(Sd),Ad={aspect_ratio_mode:"dynamic",aspect_ratio:[16,9],height:"auto"},zd=ba.object({aspect_ratio_mode:ba.enum(["dynamic","static","unconstrained"]).default(Ad.aspect_ratio_mode),aspect_ratio:wl.default(Ad.aspect_ratio),height:ba.string().default(Ad.height)}).default(Ad),Id=ba.object({conditions:_l.array(),merge:ba.object({}).passthrough().optional(),set:ba.object({}).passthrough().optional(),delete:ba.string().array().optional()}).array().optional(),Td=Tc.array(),jd=ba.object({conditions:_l.array(),actions:Td.optional(),actions_not:Td.optional()}).refine((e=>e.actions?.length||e.actions_not?.length),"Automations must include at least one action").array(),Od={features:{animated_progress_indicator:!0,media_chunk_size:50},style:{border_radius:!0,box_shadow:!0}},Dd=ba.object({features:ba.object({animated_progress_indicator:ba.boolean().default(Od.features.animated_progress_indicator),media_chunk_size:ba.number().min(0).max(1e3).default(Od.features.media_chunk_size),max_simultaneous_engine_requests:ba.number().min(1).optional()}).default(Od.features),style:ba.object({border_radius:ba.boolean().default(Od.style.border_radius),box_shadow:ba.boolean().default(Od.style.box_shadow)}).default(Od.style)}).default(Od),Rd={logging:!1},Pd=ba.object({logging:ba.boolean().default(Rd.logging)}).default(Rd),Ld=ba.enum(["casting","low-performance","scrubbing"]).array().optional(),Nd=ba.object({cameras:Ds(od),cameras_global:rd,view:dd,menu:vd,status_bar:wd,live:ed,media_gallery:$d,media_viewer:Md,image:Al,elements:yl,dimensions:zd,timeline:Bl,performance:Dd,debug:Pd,automations:jd.optional(),profiles:Ld,overrides:Id,card_mod:ba.unknown(),card_id:ba.string().regex(tc).optional(),type:ba.string()}),Fd={cameras:ad,view:sd,menu:gd,status_bar:bd,live:Xl,media_gallery:Sd,media_viewer:xd,image:El,timeline:Hl,performance:Od,debug:Rd};function Vd(e){const t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new e.constructor(+e):"number"==typeof e||"[object Number]"===t||"string"==typeof e||"[object String]"===t?new Date(e):new Date(NaN)}function Hd(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function Bd(e,t){const n=Vd(e);return isNaN(t)?Hd(e,NaN):t?(n.setDate(n.getDate()+t),n):n}function qd(e,t){const n=Vd(e);if(isNaN(t))return Hd(e,NaN);if(!t)return n;const a=n.getDate(),i=Hd(e,n.getTime());i.setMonth(n.getMonth()+t+1,0);return a>=i.getDate()?i:(n.setFullYear(i.getFullYear(),i.getMonth(),a),n)}function Ud(e,t){const{years:n=0,months:a=0,weeks:i=0,days:r=0,hours:o=0,minutes:s=0,seconds:c=0}=t,l=Vd(e),d=a||n?qd(l,a+12*n):l,u=1e3*(c+60*(s+60*o));return Hd(e,(r||i?Bd(d,r+7*i):d).getTime()+u)}const Wd=6048e5,Zd=864e5,Qd=6e4,Gd=36e5,Yd=1e3;let Kd={};function Xd(){return Kd}function Jd(e,t){const n=Xd(),a=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=Vd(e),r=i.getDay(),o=(r=i.getTime()?n+1:t.getTime()>=o.getTime()?n:n-1}function nu(e){const t=Vd(e);return t.setHours(0,0,0,0),t}function au(e){const t=Vd(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function iu(e){if(!(t=e,t instanceof Date||"object"==typeof t&&"[object Date]"===Object.prototype.toString.call(t)||"number"==typeof e))return!1;var t;const n=Vd(e);return!isNaN(Number(n))}function ru(e){return t=>{const n=(e?Math[e]:Math.trunc)(t);return 0===n?0:n}}function ou(e,t){return+Vd(e)-+Vd(t)}function su(e,t,n){const a=ou(e,t)/1e3;return ru(n?.roundingMethod)(a)}const cu={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function lu(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const du={date:lu({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:lu({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:lu({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},uu={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function hu(e){return(t,n)=>{let a;if("formatting"===(n?.context?String(n.context):"standalone")&&e.formattingValues){const t=e.defaultFormattingWidth||e.defaultWidth,i=n?.width?String(n.width):t;a=e.formattingValues[i]||e.formattingValues[t]}else{const t=e.defaultWidth,i=n?.width?String(n.width):e.defaultWidth;a=e.values[i]||e.values[t]}return a[e.argumentCallback?e.argumentCallback(t):t]}}function pu(e){return(t,n={})=>{const a=n.width,i=a&&e.matchPatterns[a]||e.matchPatterns[e.defaultMatchWidth],r=t.match(i);if(!r)return null;const o=r[0],s=a&&e.parsePatterns[a]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?function(e,t){for(let n=0;ne.test(o))):function(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n;return}(s,(e=>e.test(o)));let l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;return{value:l,rest:t.slice(o.length)}}}var mu;const gu={code:"en-US",formatDistance:(e,t,n)=>{let a;const i=cu[e];return a="string"==typeof i?i:1===t?i.one:i.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+a:a+" ago":a},formatLong:du,formatRelative:(e,t,n,a)=>uu[e],localize:{ordinalNumber:(e,t)=>{const n=Number(e),a=n%100;if(a>20||a<10)switch(a%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:hu({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:hu({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:hu({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:hu({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:hu({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(mu={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)},(e,t={})=>{const n=e.match(mu.matchPattern);if(!n)return null;const a=n[0],i=e.match(mu.parsePattern);if(!i)return null;let r=mu.valueCallback?mu.valueCallback(i[0]):i[0];return r=t.valueCallback?t.valueCallback(r):r,{value:r,rest:e.slice(a.length)}}),era:pu({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:pu({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:pu({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:pu({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:pu({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function fu(e){const t=Vd(e),n=function(e,t){const n=nu(e),a=nu(t),i=+n-au(n),r=+a-au(a);return Math.round((i-r)/Zd)}(t,function(e){const t=Vd(e),n=Hd(e,0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}(t));return n+1}function _u(e){const t=Vd(e),n=+eu(t)-+function(e){const t=tu(e),n=Hd(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),eu(n)}(t);return Math.round(n/Wd)+1}function vu(e,t){const n=Vd(e),a=n.getFullYear(),i=Xd(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=Hd(e,0);o.setFullYear(a+1,0,r),o.setHours(0,0,0,0);const s=Jd(o,t),c=Hd(e,0);c.setFullYear(a,0,r),c.setHours(0,0,0,0);const l=Jd(c,t);return n.getTime()>=s.getTime()?a+1:n.getTime()>=l.getTime()?a:a-1}function yu(e,t){const n=Vd(e),a=+Jd(n,t)-+function(e,t){const n=Xd(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=vu(e,t),r=Hd(e,0);return r.setFullYear(i,0,a),r.setHours(0,0,0,0),Jd(r,t)}(n,t);return Math.round(a/Wd)+1}function bu(e,t){return(e<0?"-":"")+Math.abs(e).toString().padStart(t,"0")}const wu={y(e,t){const n=e.getFullYear(),a=n>0?n:1-n;return bu("yy"===t?a%100:a,t.length)},M(e,t){const n=e.getMonth();return"M"===t?String(n+1):bu(n+1,2)},d:(e,t)=>bu(e.getDate(),t.length),a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return"am"===n?"a.m.":"p.m."}},h:(e,t)=>bu(e.getHours()%12||12,t.length),H:(e,t)=>bu(e.getHours(),t.length),m:(e,t)=>bu(e.getMinutes(),t.length),s:(e,t)=>bu(e.getSeconds(),t.length),S(e,t){const n=t.length,a=e.getMilliseconds();return bu(Math.trunc(a*Math.pow(10,n-3)),t.length)}},xu="midnight",Cu="noon",Mu="morning",ku="afternoon",Su="evening",Eu="night",$u={G:function(e,t,n){const a=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(a,{width:"abbreviated"});case"GGGGG":return n.era(a,{width:"narrow"});default:return n.era(a,{width:"wide"})}},y:function(e,t,n){if("yo"===t){const t=e.getFullYear(),a=t>0?t:1-t;return n.ordinalNumber(a,{unit:"year"})}return wu.y(e,t)},Y:function(e,t,n,a){const i=vu(e,a),r=i>0?i:1-i;if("YY"===t){return bu(r%100,2)}return"Yo"===t?n.ordinalNumber(r,{unit:"year"}):bu(r,t.length)},R:function(e,t){return bu(tu(e),t.length)},u:function(e,t){return bu(e.getFullYear(),t.length)},Q:function(e,t,n){const a=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(a);case"QQ":return bu(a,2);case"Qo":return n.ordinalNumber(a,{unit:"quarter"});case"QQQ":return n.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(a,{width:"narrow",context:"formatting"});default:return n.quarter(a,{width:"wide",context:"formatting"})}},q:function(e,t,n){const a=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(a);case"qq":return bu(a,2);case"qo":return n.ordinalNumber(a,{unit:"quarter"});case"qqq":return n.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(a,{width:"narrow",context:"standalone"});default:return n.quarter(a,{width:"wide",context:"standalone"})}},M:function(e,t,n){const a=e.getMonth();switch(t){case"M":case"MM":return wu.M(e,t);case"Mo":return n.ordinalNumber(a+1,{unit:"month"});case"MMM":return n.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(a,{width:"narrow",context:"formatting"});default:return n.month(a,{width:"wide",context:"formatting"})}},L:function(e,t,n){const a=e.getMonth();switch(t){case"L":return String(a+1);case"LL":return bu(a+1,2);case"Lo":return n.ordinalNumber(a+1,{unit:"month"});case"LLL":return n.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(a,{width:"narrow",context:"standalone"});default:return n.month(a,{width:"wide",context:"standalone"})}},w:function(e,t,n,a){const i=yu(e,a);return"wo"===t?n.ordinalNumber(i,{unit:"week"}):bu(i,t.length)},I:function(e,t,n){const a=_u(e);return"Io"===t?n.ordinalNumber(a,{unit:"week"}):bu(a,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getDate(),{unit:"date"}):wu.d(e,t)},D:function(e,t,n){const a=fu(e);return"Do"===t?n.ordinalNumber(a,{unit:"dayOfYear"}):bu(a,t.length)},E:function(e,t,n){const a=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(a,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(a,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},e:function(e,t,n,a){const i=e.getDay(),r=(i-a.weekStartsOn+8)%7||7;switch(t){case"e":return String(r);case"ee":return bu(r,2);case"eo":return n.ordinalNumber(r,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(e,t,n,a){const i=e.getDay(),r=(i-a.weekStartsOn+8)%7||7;switch(t){case"c":return String(r);case"cc":return bu(r,t.length);case"co":return n.ordinalNumber(r,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(e,t,n){const a=e.getDay(),i=0===a?7:a;switch(t){case"i":return String(i);case"ii":return bu(i,t.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},a:function(e,t,n){const a=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(e,t,n){const a=e.getHours();let i;switch(i=12===a?Cu:0===a?xu:a/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(e,t,n){const a=e.getHours();let i;switch(i=a>=17?Su:a>=12?ku:a>=4?Mu:Eu,t){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){let t=e.getHours()%12;return 0===t&&(t=12),n.ordinalNumber(t,{unit:"hour"})}return wu.h(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getHours(),{unit:"hour"}):wu.H(e,t)},K:function(e,t,n){const a=e.getHours()%12;return"Ko"===t?n.ordinalNumber(a,{unit:"hour"}):bu(a,t.length)},k:function(e,t,n){let a=e.getHours();return 0===a&&(a=24),"ko"===t?n.ordinalNumber(a,{unit:"hour"}):bu(a,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):wu.m(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getSeconds(),{unit:"second"}):wu.s(e,t)},S:function(e,t){return wu.S(e,t)},X:function(e,t,n){const a=e.getTimezoneOffset();if(0===a)return"Z";switch(t){case"X":return zu(a);case"XXXX":case"XX":return Iu(a);default:return Iu(a,":")}},x:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"x":return zu(a);case"xxxx":case"xx":return Iu(a);default:return Iu(a,":")}},O:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Au(a,":");default:return"GMT"+Iu(a,":")}},z:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Au(a,":");default:return"GMT"+Iu(a,":")}},t:function(e,t,n){return bu(Math.trunc(e.getTime()/1e3),t.length)},T:function(e,t,n){return bu(e.getTime(),t.length)}};function Au(e,t=""){const n=e>0?"-":"+",a=Math.abs(e),i=Math.trunc(a/60),r=a%60;return 0===r?n+String(i):n+String(i)+t+bu(r,2)}function zu(e,t){if(e%60==0){return(e>0?"-":"+")+bu(Math.abs(e)/60,2)}return Iu(e,t)}function Iu(e,t=""){const n=e>0?"-":"+",a=Math.abs(e);return n+bu(Math.trunc(a/60),2)+t+bu(a%60,2)}const Tu=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},ju=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},Ou={p:ju,P:(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],a=n[1],i=n[2];if(!i)return Tu(e,t);let r;switch(a){case"P":r=t.dateTime({width:"short"});break;case"PP":r=t.dateTime({width:"medium"});break;case"PPP":r=t.dateTime({width:"long"});break;default:r=t.dateTime({width:"full"})}return r.replace("{{date}}",Tu(a,t)).replace("{{time}}",ju(i,t))}},Du=/^D+$/,Ru=/^Y+$/,Pu=["D","DD","YY","YYYY"];function Lu(e){return Du.test(e)}function Nu(e){return Ru.test(e)}function Fu(e,t,n){const a=function(e,t,n){const a="Y"===e[0]?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${a} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}(e,t,n);if(console.warn(a),Pu.includes(e))throw new RangeError(a)}const Vu=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Hu=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Bu=/^'([^]*?)'?$/,qu=/''/g,Uu=/[a-zA-Z]/;function Wu(e,t,n){const a=Xd(),i=n?.locale??a.locale??gu,r=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??a.weekStartsOn??a.locale?.options?.weekStartsOn??0,s=Vd(e);if(!iu(s))throw new RangeError("Invalid time value");let c=t.match(Hu).map((e=>{const t=e[0];if("p"===t||"P"===t){return(0,Ou[t])(e,i.formatLong)}return e})).join("").match(Vu).map((e=>{if("''"===e)return{isToken:!1,value:"'"};const t=e[0];if("'"===t)return{isToken:!1,value:Zu(e)};if($u[t])return{isToken:!0,value:e};if(t.match(Uu))throw new RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}}));i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));const l={firstWeekContainsDate:r,weekStartsOn:o,locale:i};return c.map((a=>{if(!a.isToken)return a.value;const r=a.value;(!n?.useAdditionalWeekYearTokens&&Nu(r)||!n?.useAdditionalDayOfYearTokens&&Lu(r))&&Fu(r,t,String(e));return(0,$u[r[0]])(s,r,i.localize,l)})).join("")}function Zu(e){const t=e.match(Bu);return t?t[1].replace(qu,"'"):e}function Qu(e,t){const{years:n=0,months:a=0,weeks:i=0,days:r=0,hours:o=0,minutes:s=0,seconds:c=0}=t,l=function(e,t){return qd(e,-t)}(e,a+12*n),d=function(e,t){return Bd(e,-t)}(l,r+7*i),u=1e3*(c+60*(s+60*o));return Hd(e,d.getTime()-u)}function Gu(e,t){return e===t||e!=e&&t!=t}function Yu(e,t){for(var n=e.length;n--;)if(Gu(e[n][0],t))return n;return-1}var Ku=Array.prototype.splice;function Xu(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1},Xu.prototype.set=function(e,t){var n=this.__data__,a=Yu(n,e);return a<0?(++this.size,n.push([e,t])):n[a][1]=t,this};var Ju="object"==typeof global&&global&&global.Object===Object&&global,eh="object"==typeof self&&self&&self.Object===Object&&self,th=Ju||eh||Function("return this")(),nh=th.Symbol,ah=Object.prototype,ih=ah.hasOwnProperty,rh=ah.toString,oh=nh?nh.toStringTag:void 0;var sh=Object.prototype.toString;var ch="[object Null]",lh="[object Undefined]",dh=nh?nh.toStringTag:void 0;function uh(e){return null==e?void 0===e?lh:ch:dh&&dh in Object(e)?function(e){var t=ih.call(e,oh),n=e[oh];try{e[oh]=void 0;var a=!0}catch(e){}var i=rh.call(e);return a&&(t?e[oh]=n:delete e[oh]),i}(e):function(e){return sh.call(e)}(e)}function hh(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var ph="[object AsyncFunction]",mh="[object Function]",gh="[object GeneratorFunction]",fh="[object Proxy]";function _h(e){if(!hh(e))return!1;var t=uh(e);return t==mh||t==gh||t==ph||t==fh}var vh,yh=th["__core-js_shared__"],bh=(vh=/[^.]+$/.exec(yh&&yh.keys&&yh.keys.IE_PROTO||""))?"Symbol(src)_1."+vh:"";var wh=Function.prototype.toString;function xh(e){if(null!=e){try{return wh.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var Ch=/^\[object .+?Constructor\]$/,Mh=Function.prototype,kh=Object.prototype,Sh=Mh.toString,Eh=kh.hasOwnProperty,$h=RegExp("^"+Sh.call(Eh).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ah(e){return!(!hh(e)||(t=e,bh&&bh in t))&&(_h(e)?$h:Ch).test(xh(e));var t}function zh(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Ah(n)?n:void 0}var Ih=zh(th,"Map"),Th=zh(Object,"create");var jh=Object.prototype.hasOwnProperty;var Oh=Object.prototype.hasOwnProperty;function Dh(e){var t=-1,n=null==e?0:e.length;for(this.clear();++ts))return!1;var l=r.get(e),d=r.get(t);if(l&&d)return l==t&&d==e;var u=-1,h=!0,p=n&Bh?new Nh:void 0;for(r.set(e,t),r.set(t,e);++u-1&&e%1==0&&e-1&&e%1==0&&e<=Ap}var Ip={};function Tp(e){return function(t){return e(t)}}Ip["[object Float32Array]"]=Ip["[object Float64Array]"]=Ip["[object Int8Array]"]=Ip["[object Int16Array]"]=Ip["[object Int32Array]"]=Ip["[object Uint8Array]"]=Ip["[object Uint8ClampedArray]"]=Ip["[object Uint16Array]"]=Ip["[object Uint32Array]"]=!0,Ip["[object Arguments]"]=Ip["[object Array]"]=Ip["[object ArrayBuffer]"]=Ip["[object Boolean]"]=Ip["[object DataView]"]=Ip["[object Date]"]=Ip["[object Error]"]=Ip["[object Function]"]=Ip["[object Map]"]=Ip["[object Number]"]=Ip["[object Object]"]=Ip["[object RegExp]"]=Ip["[object Set]"]=Ip["[object String]"]=Ip["[object WeakMap]"]=!1;var jp="object"==typeof exports&&exports&&!exports.nodeType&&exports,Op=jp&&"object"==typeof module&&module&&!module.nodeType&&module,Dp=Op&&Op.exports===jp&&Ju.process,Rp=function(){try{var e=Op&&Op.require&&Op.require("util").types;return e||Dp&&Dp.binding&&Dp.binding("util")}catch(e){}}(),Pp=Rp,Lp=Pp&&Pp.isTypedArray,Np=Lp?Tp(Lp):function(e){return fp(e)&&zp(e.length)&&!!Ip[uh(e)]},Fp=Object.prototype.hasOwnProperty;function Vp(e,t){var n=dp(e),a=!n&&wp(e),i=!n&&!a&&kp(e),r=!n&&!a&&!i&&Np(e),o=n||a||i||r,s=o?function(e,t){for(var n=-1,a=Array(e);++n0){if(++og>=800)return arguments[0]}else og=0;return rg.apply(void 0,arguments)});function lg(e,t){return cg(function(e,t,n){return t=tg(void 0===t?e.length-1:t,0),function(){for(var a=arguments,i=-1,r=tg(a.length-t,0),o=Array(r);++i1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(r=e.length>3&&"function"==typeof r?(i--,r):void 0,o&&dg(n[0],n[1],o)&&(r=i<3?void 0:r,i=1),t=Object(t);++a-1}function Ng(e,t,n){for(var a=-1,i=null==e?0:e.length;++a=Vg){var l=t?null:Fg(e);if(l)return Zh(l);o=!1,i=Vh,c=new Nh}else c=t?[]:s;e:for(;++ae[0].toUpperCase()+e.substring(1))).join(" ")}function Ug(e,t,n){const a=e[t];return e.splice(t,1),e.splice(n,0,a),e}const Wg=e=>Array.isArray(e)?e:[e],Zg=e=>e instanceof Set?e:new Set(Wg(e));function Qg(e,t,n){return!function(e,t,n){var a=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===a?bm(e,t,void 0,n):!!a}(e,t,n)}function Gg(e,t=console.warn){e instanceof zs&&e.context?t(e,e.context):t("object"==typeof e&&"message"in e?e.message:e)}const Yg=()=>window.matchMedia("(hover: hover) and (pointer: fine)").matches,Kg=(e,t)=>Wu(e,"yyyy-MM-dd HH:mm"+(t?":ss":"")),Xg=e=>Wu(e,"yyyy-MM-dd"),Jg=(e,t)=>{window.requestIdleCallback?window.requestIdleCallback(e,{...t&&{timeout:t}}):e()};function ef(e,t){const n=function(e,t,n){const a=ou(e,t)/Gd;return ru(n?.roundingMethod)(a)}(t,e),a=function(e,t,n){const a=ou(e,t)/Qd;return ru(n?.roundingMethod)(a)}(t,e)-60*n;let i="";return n&&(i+=`${n}h `),a&&(i+=`${a}m `),i+=`${su(t,e)-60*n*60-60*a}s`,i}const tf=async(e,t)=>await Promise.all(Array.from(e).map((e=>t(e)))),nf=e=>new Date(`${e}T00:00:00`),af=async e=>{await new Promise((t=>setTimeout(t,1e3*e)))},rf=e=>!isNaN(e.getTime()),of=(e,t,n,a)=>{t?e.setAttribute(n,a??""):e.removeAttribute(n)},sf=e=>!!e,cf=e=>e instanceof HTMLElement,lf=e=>(e instanceof HTMLSlotElement?e.assignedElements({flatten:!0}):[...e.children]).filter(cf),df=e=>e?.ratio&&2===e.ratio.length?`${e.ratio[0]} / ${e.ratio[1]}`:e?.defaultStatic?"16 / 9":"auto",uf=e=>({"aspect-ratio":df(e)}),hf=e=>{if(Array.isArray(e))return e.filter((e=>void 0!==e)).map((e=>hf(e)));if("object"==typeof e&&null!==e){const t={};for(const n in e)t[n]=hf(e[n]);return t}return e},pf=(e,t,n)=>Rg(e,n)===Rg(t,n);function mf(e){if(!e)return null;const t=Ic.safeParse(e);return t.success?t.data:null}function gf(e,t){return{action:"fire-dom-event",frigate_card_action:e,...t?.cardID&&{card_id:t.cardID}}}function ff(e,t,n){return{action:"fire-dom-event",frigate_card_action:e,camera:t,...n?.cardID&&{card_id:n.cardID}}}function _f(e,t,n){return{action:"fire-dom-event",frigate_card_action:"media_player",media_player:e,media_player_action:t,...n?.cardID&&{card_id:n.cardID}}}function vf(e){return{action:"fire-dom-event",frigate_card_action:"ptz_multi",...e?.cardID&&{card_id:e.cardID},...e?.ptzAction&&{ptz_action:e.ptzAction},...e?.ptzPhase&&{ptz_phase:e.ptzPhase},...e?.ptzPreset&&{ptz_preset:e.ptzPreset},...e?.targetID&&{target_id:e.targetID}}}function yf(e,t){return e&&t?"tap"===e&&t.tap_action?t.tap_action:"hold"===e&&t.hold_action?t.hold_action:"double_tap"===e&&t.double_tap_action?t.double_tap_action:"end_tap"===e&&t.end_tap_action?t.end_tap_action:"start_tap"===e&&t.start_tap_action?t.start_tap_action:null:null}const bf=e=>Wg(e).some((e=>function(e){return void 0!==e&&"none"!==e.action}(e))),wf=e=>{e.stopPropagation()};class xf{constructor(){this._timer=null,this._repeated=!1}stop(){this._timer&&(this._repeated?window.clearInterval(this._timer):window.clearTimeout(this._timer),this._timer=null)}isRunning(){return null!==this._timer}start(e,t){this.stop(),this._timer=window.setTimeout((()=>{this._timer=null,t()}),1e3*e),this._repeated=!1}startRepeated(e,t){this.stop(),this._timer=window.setInterval((()=>{t()}),1e3*e),this._repeated=!0}}class Cf extends HTMLElement{constructor(){super(...arguments),this.holdTime=.4,this.holdTimer=new xf,this.doubleClickTimer=new xf,this.held=!1,this.started=!1}connectedCallback(){["touchcancel","mouseout","mouseup","touchmove","mousewheel","wheel","scroll"].forEach((e=>{document.addEventListener(e,(()=>{this.holdTimer.stop()}),{passive:!0})}))}bind(e,t){if(e.actionHandlerOptions)return void(e.actionHandlerOptions=t);e.actionHandlerOptions=t,e.addEventListener("contextmenu",(e=>{const t=e||window.event;return t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.cancelBubble=!0,t.returnValue=!1,!1}));const n=()=>{this.held=!1,this.holdTimer.start(this.holdTime,(()=>{this.held=!0})),this.started||(this.started=!0,et(e,"action",{action:"start_tap"}))},a=t=>{this.holdTimer.stop(),this.started&&(this.started=!1,et(e,"action",{action:"end_tap"}))},i=t=>{const n=e.actionHandlerOptions;n?.allowPropagation||wf(t),["touchend","touchcancel"].includes(t.type)&&!this.held||(a(),n?.hasHold&&this.held?et(e,"action",{action:"hold"}):n?.hasDoubleClick?"click"===t.type&&t.detail<2||!this.doubleClickTimer.isRunning()?this.doubleClickTimer.start(.25,(()=>et(e,"action",{action:"tap"}))):(this.doubleClickTimer.stop(),et(e,"action",{action:"double_tap"})):et(e,"action",{action:"tap"}))};e.addEventListener("touchstart",n,{passive:!0}),e.addEventListener("touchend",i),e.addEventListener("touchcancel",i),e.addEventListener("mousedown",n,{passive:!0}),e.addEventListener("click",i),e.addEventListener("keyup",(e=>{"Enter"===e.key&&i(e)})),e.addEventListener("mouseleave",a)}}customElements.define("action-handler-frigate-card",Cf);const Mf=(e,t)=>{const n=(()=>{const e=document.body;if(e.querySelector("action-handler-frigate-card"))return e.querySelector("action-handler-frigate-card");const t=document.createElement("action-handler-frigate-card");return e.appendChild(t),t})();n&&n.bind(e,t)},kf=ge(class extends fe{update(e,[t]){return Mf(e.element,t),U}render(e){}});var Sf=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)lp(t,gp(e)),e=Pm(e);return t}:hp;function Ef(e){return up(e,Km,Sf)}var $f=Object.prototype.hasOwnProperty;var Af=/\w*$/;var zf=nh?nh.prototype:void 0,If=zf?zf.valueOf:void 0;var Tf="[object Boolean]",jf="[object Date]",Of="[object Map]",Df="[object Number]",Rf="[object RegExp]",Pf="[object Set]",Lf="[object String]",Nf="[object Symbol]",Ff="[object ArrayBuffer]",Vf="[object DataView]",Hf="[object Float32Array]",Bf="[object Float64Array]",qf="[object Int8Array]",Uf="[object Int16Array]",Wf="[object Int32Array]",Zf="[object Uint8Array]",Qf="[object Uint8ClampedArray]",Gf="[object Uint16Array]",Yf="[object Uint32Array]";function Kf(e,t,n){var a,i,r,o=e.constructor;switch(t){case Ff:return Tm(e);case Tf:case jf:return new o(+e);case Vf:return function(e,t){var n=t?Tm(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case Hf:case Bf:case qf:case Uf:case Wf:case Zf:case Qf:case Gf:case Yf:return jm(e,n);case Of:return new o;case Df:case Lf:return new o(e);case Rf:return(r=new(i=e).constructor(i.source,Af.exec(i))).lastIndex=i.lastIndex,r;case Pf:return new o;case Nf:return a=e,If?Object(If.call(a)):{}}}var Xf=Pp&&Pp.isMap,Jf=Xf?Tp(Xf):function(e){return fp(e)&&"[object Map]"==pm(e)};var e_=Pp&&Pp.isSet,t_=e_?Tp(e_):function(e){return fp(e)&&"[object Set]"==pm(e)},n_=1,a_=2,i_=4,r_="[object Arguments]",o_="[object Function]",s_="[object GeneratorFunction]",c_="[object Object]",l_={};function d_(e,t,n,a,i,r){var o,s=t&n_,c=t&a_,l=t&i_;if(n&&(o=i?n(e,a,i,r):n(e)),void 0!==o)return o;if(!hh(e))return e;var d=dp(e);if(d){if(o=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&$f.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!s)return Om(e,o)}else{var u=pm(e),h=u==o_||u==s_;if(kp(e))return Im(e,s);if(u==c_||u==r_||h&&!i){if(o=c||h?{}:Lm(e),!s)return c?function(e,t){return Qm(e,Sf(e),t)}(e,function(e,t){return e&&Qm(t,Km(t),e)}(o,e)):function(e,t){return Qm(e,gp(e),t)}(e,function(e,t){return e&&Qm(t,Qp(t),e)}(o,e))}else{if(!l_[u])return i?e:{};o=Kf(e,u,s)}}r||(r=new Lh);var p=r.get(e);if(p)return p;r.set(e,o),t_(e)?e.forEach((function(a){o.add(d_(a,t,n,a,e,r))})):Jf(e)&&e.forEach((function(a,i){o.set(i,d_(a,t,n,i,e,r))}));var m=d?void 0:(l?c?Ef:Gp:c?Km:Qp)(e);return function(e,t){for(var n=-1,a=null==e?0:e.length;++nvoid 0===globalThis.DOMException?new __(e):new DOMException(e),y_=e=>{const t=void 0===e.reason?v_("This operation was aborted."):e.reason;return t instanceof Error?t:v_(t)};class b_{#e=[];enqueue(e,t){const n={priority:(t={priority:0,...t}).priority,run:e};if(this.size&&this.#e[this.size-1].priority>=t.priority)return void this.#e.push(n);const a=function(e,t,n){let a=0,i=e.length;for(;i>0;){const r=Math.trunc(i/2);let o=a+r;n(e[o],t)<=0?(a=++o,i-=r+1):i=r}return a}(this.#e,n,((e,t)=>t.priority-e.priority));this.#e.splice(a,0,n)}dequeue(){const e=this.#e.shift();return e?.run}filter(e){return this.#e.filter((t=>t.priority===e.priority)).map((e=>e.run))}get size(){return this.#e.length}}class w_ extends g_{#t;#n;#a=0;#i;#r;#o=0;#s;#c;#e;#l;#d=0;#u;#h;#p;timeout;constructor(e){if(super(),!("number"==typeof(e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:b_,...e}).intervalCap&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??""}\` (${typeof e.intervalCap})`);if(void 0===e.interval||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??""}\` (${typeof e.interval})`);this.#t=e.carryoverConcurrencyCount,this.#n=e.intervalCap===Number.POSITIVE_INFINITY||0===e.interval,this.#i=e.intervalCap,this.#r=e.interval,this.#e=new e.queueClass,this.#l=e.queueClass,this.concurrency=e.concurrency,this.timeout=e.timeout,this.#p=!0===e.throwOnTimeout,this.#h=!1===e.autoStart}get#m(){return this.#n||this.#a{this.#v()}),t)),!0;this.#a=this.#t?this.#d:0}return!1}#_(){if(0===this.#e.size)return this.#s&&clearInterval(this.#s),this.#s=void 0,this.emit("empty"),0===this.#d&&this.emit("idle"),!1;if(!this.#h){const e=!this.#w;if(this.#m&&this.#g){const t=this.#e.dequeue();return!!t&&(this.emit("active"),t(),e&&this.#b(),!0)}}return!1}#b(){this.#n||void 0!==this.#s||(this.#s=setInterval((()=>{this.#y()}),this.#r),this.#o=Date.now()+this.#r)}#y(){0===this.#a&&0===this.#d&&this.#s&&(clearInterval(this.#s),this.#s=void 0),this.#a=this.#t?this.#d:0,this.#x()}#x(){for(;this.#_(););}get concurrency(){return this.#u}set concurrency(e){if(!("number"==typeof e&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this.#u=e,this.#x()}async#C(e){return new Promise(((t,n)=>{e.addEventListener("abort",(()=>{n(e.reason)}),{once:!0})}))}async add(e,t={}){return t={timeout:this.timeout,throwOnTimeout:this.#p,...t},new Promise(((n,a)=>{this.#e.enqueue((async()=>{this.#d++,this.#a++;try{t.signal?.throwIfAborted();let a=e({signal:t.signal});t.timeout&&(a=function(e,t){const{milliseconds:n,fallback:a,message:i,customTimers:r={setTimeout:setTimeout,clearTimeout:clearTimeout}}=t;let o;const s=new Promise(((s,c)=>{if("number"!=typeof n||1!==Math.sign(n))throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${n}\``);if(t.signal){const{signal:e}=t;e.aborted&&c(y_(e)),e.addEventListener("abort",(()=>{c(y_(e))}))}if(n===Number.POSITIVE_INFINITY)return void e.then(s,c);const l=new f_;o=r.setTimeout.call(void 0,(()=>{if(a)try{s(a())}catch(e){c(e)}else"function"==typeof e.cancel&&e.cancel(),!1===i?s():i instanceof Error?c(i):(l.message=i??`Promise timed out after ${n} milliseconds`,c(l))}),n),(async()=>{try{s(await e)}catch(e){c(e)}})()})),c=s.finally((()=>{c.clear()}));return c.clear=()=>{r.clearTimeout.call(void 0,o),o=void 0},c}(Promise.resolve(a),{milliseconds:t.timeout})),t.signal&&(a=Promise.race([a,this.#C(t.signal)]));const i=await a;n(i),this.emit("completed",i)}catch(e){if(e instanceof f_&&!t.throwOnTimeout)return void n();a(e),this.emit("error",e)}finally{this.#f()}}),t),this.emit("add"),this.#_()}))}async addAll(e,t){return Promise.all(e.map((async e=>this.add(e,t))))}start(){return this.#h?(this.#h=!1,this.#x(),this):this}pause(){this.#h=!0}clear(){this.#e=new this.#l}async onEmpty(){0!==this.#e.size&&await this.#M("empty")}async onSizeLessThan(e){this.#e.sizethis.#e.size{const a=()=>{t&&!t()||(this.off(e,a),n())};this.on(e,a)}))}get size(){return this.#e.size}sizeBy(e){return this.#e.filter(e).length}get pending(){return this.#d}get isPaused(){return this.#h}}var x_={frigate_card:"Frigate card",frigate_card_description:"A Lovelace card for use with Frigate",live:"Live",no_media:"No media to display",recordings:"Recordings",version:"Version"},C_={cameras:{camera_entity:"Camera Entity",capabilities:{capabilities:{clips:"Clips","favorite-events":"Favorite Events","favorite-recordings":"Favorite Recordings",live:"Live",menu:"Menu",ptz:"PTZ",recordings:"Recordings",seek:"Seeking",snapshots:"Snapshots",substream:"Substream"},disable:"Disable",disable_except:"Disable except",editor_label:"Camera capabilities"},cast:{dashboard:{dashboard_path:"Dashboard path",view_path:"View path"},editor_label:"Cast options",method:"Cast method",methods:{dashboard:"Dashboard",standard:"Standard"}},dependencies:{all_cameras:"Show events for all cameras with this camera",cameras:"Show events for specific cameras with this camera",editor_label:"Dependency options"},dimensions:{aspect_ratio:"Static aspect ratio",editor_label:"Camera dimensions",layout:{editor_label:"Camera Layout",fit:"Layout fit",fits:{contain:"Media is contained/letterboxed",cover:"Media expands proportionally to cover the card",fill:"Media is stretched to fill the card"},pan:{x:"Pan horizontal percentage",y:"Pan vertical percentage"},position:{editor_label:"Layout Cover Position",x:"Horizontal placement percentage",y:"Vertical placement percentage"},view_box:{bottom:"Bottom inset percentage",editor_label:"Layout View Box",left:"Left inset percentage",right:"Right inset percentage",top:"Top inset percentage"},zoom:"Zoom factor"}},engines:{editor_label:"Camera engine options"},frigate:{camera_name:"Frigate camera name (Autodetected from entity)",client_id:"Frigate client id (For >1 Frigate server)",editor_label:"Frigate options",labels:"Frigate labels/object filters",url:"Frigate server URL",zones:"Frigate zones"},go2rtc:{editor_label:"go2rtc Options",modes:{editor_label:"go2rtc Modes",mjpeg:"Motion JPEG (MJPEG)",mp4:"MPEG-4 (MP4)",mse:"Media Source Extensions (MSE)",webrtc:"Web Real-Time Communication (WebRTC)"},stream:"go2rtc stream name"},icon:"Icon for this camera (Autodetected from entity)",id:"Unique id for this camera in this card",image:{editor_label:"Image Options",refresh_seconds:"Number of seconds after which to refresh live image (0=never)",url:"Image URL to use instead of camera entity snapshot"},live_provider:"Live view provider for this camera",live_provider_options:{editor_label:"Live provider options"},live_providers:{auto:"Automatic",go2rtc:"go2rtc",ha:"Home Assistant video stream (i.e. HLS, LL-HLS, WebRTC via HA)",image:"Home Assistant images",jsmpeg:"JSMpeg","webrtc-card":"WebRTC Card (i.e. AlexxIT's WebRTC Card)"},motioneye:{editor_label:"MotionEye options",images:{directory_pattern:"Images directory pattern",file_pattern:"Images file pattern"},movies:{directory_pattern:"Movies directory pattern",file_pattern:"Movies file pattern"},url:"MotionEye UI URL"},proxy:{dynamic:"Dynamic proxying",editor_label:"Camera proxying",media:{auto:"Media proxying automatically configured",editor_label:"Media proxying",false:"Media proxying disabled",true:"Media proxying enabled"},ssl_ciphers:{auto:"SSL ciphers automatically configured",default:"Default SSL ciphers",editor_label:"SSL ciphers",insecure:"Insecure SSL ciphers",intermediate:"Intermediate SSL ciphers",modern:"Modern SSL ciphers"},ssl_verification:{auto:"SSL verification automatically configured",editor_label:"SSL verification",false:"SSL verification disabled",true:"SSL verification enabled"}},reolink:{editor_label:"Reolink options",media_resolution:{editor_label:"Media Resolution",high:"High Resolution",low:"Low Resolution"},url:"Reolink UI URL"},title:"Title for this camera (Autodetected from entity)",triggers:{editor_label:"Trigger options",entities:"Trigger from other entities",events:{clips:"Events with new clips",editor_label:"Trigger Events",events:"All events",snapshots:"Events with new snapshots"},motion:"Trigger by auto-detecting the motion sensor",occupancy:"Trigger by auto-detecting the occupancy sensor"},webrtc_card:{editor_label:"WebRTC Card Options",entity:"WebRTC Card Camera Entity (Not a Frigate camera)",url:"WebRTC Card Camera URL"}},common:{controls:{builtin:"Built-in video controls",filter:{editor_label:"Media Filter",mode:"Filter mode",modes:{left:"Media filter in a drawer to the left",none:"No media filter",right:"Media filter in a drawer to the right"}},next_previous:{editor_label:"Next & Previous",size:"Next & previous control size in pixels",style:"Next & previous control style",styles:{chevrons:"Chevrons",icons:"Icons",none:"None",thumbnails:"Thumbnails"}},thumbnails:{editor_label:"Thumbnails",events_media_type:"Whether to show event thumbnails of clips or snapshots",events_media_types:{clips:"Clip thumbnails",snapshots:"Snapshot thumbnails"},media_type:"Whether to show thumnails of events or recordings",media_types:{events:"Events",recordings:"Recordings"},mode:"Thumbnails mode",modes:{above:"Thumbnails above",below:"Thumbnails below",left:"Thumbnails in a drawer to the left",none:"No thumbnails",right:"Thumbnails in a drawer to the right"},show_details:"Show details with thumbnails",show_download_control:"Show download control on thumbnails",show_favorite_control:"Show favorite control on thumbnails",show_timeline_control:"Show timeline control on thumbnails",size:"Thumbnails size in pixels"},timeline:{editor_label:"Mini Timeline",mode:"Mode",modes:{above:"Above",below:"Below",none:"None"},pan_mode:"Default pan mode",pan_modes:{pan:"Pan",seek:"Pan seeks across all media","seek-in-camera":"Pan seeks within selected camera only","seek-in-media":"Pan seeks within selected media item only"}}},display:{editor_label:"Display",grid_columns:"Exact number of grid columns",grid_max_columns:"Maximum number of grid columns",grid_selected_width_factor:"Increase selected media width by this factor",mode:"Mode"},image:{entity:"Entity for use with entity mode",entity_parameters:"Query parameters added to the entity-based picture URLs (e.g. width=1920&height=1080)",mode:"Image mode",modes:{camera:"Home Assistant camera snapshot of camera entity",entity:"Entity with entity_picture attribute",screensaver:"Embedded Frigate logo",url:"Arbitrary image specified by URL"},refresh_seconds:"Number of seconds after which to refresh (0=never)",url:"Static image URL"},media_action_conditions:{all:"All opportunities",hidden:"On browser/tab hiding",microphone_mute:"On microphone mute",microphone_unmute:"On microphone unmute",never:"Never",selected:"On selection",unselected:"On unselection",visible:"On browser/tab visibility"},timeline:{clustering_threshold:"The count of events at which they are clustered (0=no clustering)",events_media_type:"The events media the timeline displays",events_media_types:{all:"All event media types",clips:"Clips",snapshots:"Snapshots"},show_recordings:"Show recordings",style:"Timeline style",styles:{ribbon:"Events on a single ribbon",stack:"Stacked & clustered events"},window_seconds:"The default length of the timeline view in seconds"}},dimensions:{aspect_ratio:"Default aspect ratio (e.g. '16:9')",aspect_ratio_mode:"Aspect ratio mode",aspect_ratio_modes:{dynamic:"Aspect ratio adjusts to media",static:"Static aspect ratio",unconstrained:"Unconstrained aspect ratio"},height:"Card height in CSS units (e.g. '500px')"},live:{auto_mute:"Automatically mute live cameras",auto_pause:"Automatically pause live cameras",auto_play:"Automatically play live cameras",auto_unmute:"Automatically unmute live cameras",controls:{editor_label:"Live Controls",ptz:{editor_label:"PTZ",hide_home:"Hide home control",hide_pan_tilt:"Hide pan & tilt control",hide_zoom:"Hide zoom control",mode:"Mode",modes:{off:"Off",on:"On"},orientation:"Orientation",orientations:{horizontal:"Horizontal",vertical:"Vertical"},position:"Position",positions:{"bottom-left":"Bottom left","bottom-right":"Bottom right","top-left":"Top left","top-right":"Top right"}}},draggable:"Live cameras view can be dragged/swiped",lazy_load:"Live cameras are lazily loaded",lazy_unload:"Live cameras are lazily unloaded",microphone:{always_connected:"Always keep the microphone connected",disconnect_seconds:"Seconds after which to disconnect microphone (0=never)",editor_label:"Microphone",enabled:"Microphone enabled",mute_after_microphone_mute_seconds:"Seconds after microphone mute to mute inbound audio"},preload:"Preload live view in the background",show_image_during_load:"Show still image while the live stream is loading",transition_effect:"Live camera transition effect",zoomable:"Live cameras can be zoomed/panned"},media_viewer:{auto_mute:"Automatically mute media",auto_pause:"Automatically pause media",auto_play:"Automatically play media",auto_unmute:"Automatically unmute media",controls:{editor_label:"Media Viewer Controls"},draggable:"Media Viewer can be dragged/swiped",lazy_load:"Media Viewer media is lazily loaded in carousel",snapshot_click_plays_clip:"Clicking on a snapshot plays a related clip",transition_effect:"Media Viewer transition effect",transition_effects:{none:"No transition",slide:"Slide transition"},zoomable:"Media Viewer can be zoomed/panned"},menu:{alignment:"Menu alignment",alignments:{bottom:"Aligned to the bottom",left:"Aligned to the left",right:"Aligned to the right",top:"Aligned to the top"},button_size:"Menu button size in pixels",buttons:{alignment:"Button alignment",alignments:{matching:"Matching the menu alignment",opposing:"Opposing the menu alignment"},camera_ui:"Camera user interface",cameras:"Cameras",clips:"Clips",display_mode:"Display mode",download:"Download",enabled:"Button enabled",expand:"Expand",frigate:"Frigate menu / Default view",fullscreen:"Fullscreen",icon:"Icon",image:"Image",live:"Live",media_player:"Send to media player",microphone:"Microphone",mute:"Mute / Unmute",permanent:"Show when the menu is hidden",play:"Play / Pause",priority:"Priority",ptz_controls:"Show PTZ controls",ptz_home:"PTZ Home",recordings:"Recordings",screenshot:"Screenshot",snapshots:"Snapshots",substreams:"Substream(s)",timeline:"Timeline",type:"Button type",types:{momentary:"Momentary",toggle:"Toggle"}},position:"Menu position",positions:{bottom:"Positioned on the bottom",left:"Positioned on the left",right:"Positioned on the right",top:"Positioned on the top"},style:"Menu style",styles:{hidden:"Hidden menu",hover:"Hover menu","hover-card":"Hover menu (card-wide)",none:"No menu",outside:"Outside menu",overlay:"Overlay menu"}},overrides:{info:"This card configuration has manually specified overrides configured which may override values shown in the visual editor, please consult the code editor to view/modify these overrides"},performance:{features:{animated_progress_indicator:"Animated Progress Indicator",editor_label:"Feature Options",max_simultaneous_engine_requests:"Max simultaneous camera engine requests",media_chunk_size:"Media chunk size"},style:{border_radius:"Curves",box_shadow:"Shadows",editor_label:"Style Options"},warning:"This card is in low profile mode so defaults have changed to optimize performance"},profiles:{casting:"Casting",editor_label:"Configuration profiles","low-performance":"Low performance",scrubbing:"Video scrubbing"},status_bar:{height:"Status bar height in pixels",items:{enabled:"Item enabled",engine:"Camera engine",live_provider:"Live provider",priority:"Item priority",resolution:"Resolution",technology:"Technology",title:"Title"},popup_seconds:"Status bar popup seconds",position:"Status bar position",positions:{bottom:"Positioned on the bottom",top:"Positioned on the top"},style:"Status bar style",styles:{hover:"Hover status bar","hover-card":"Hover status bar (card-wide)",none:"No status bar",outside:"Outside status bar",overlay:"Overlay status bar",popup:"Popup status bar"}},view:{camera_select:"View for newly selected cameras",dark_mode:"Dark mode",dark_modes:{auto:"Auto",off:"Off",on:"On"},default:"Default view",default_cycle_camera:"Cycle through cameras when default view updates",default_reset:{after_interaction:"Reset to the default view after user interaction ends",editor_label:"Default view reset behavior",entities:"Reset to the default view on entity state change",every_seconds:"Reset to default view every X seconds (0=never)",interaction_mode:"How default reset behaves when the card has human interaction",interaction_modes:{active:"Only allow reset when card has active human interaction",all:"Reset regardless of human interaction",inactive:"Only reset when card has no human interaction"}},interaction_seconds:"Seconds after user action to remain interacted with (0=never)",keyboard_shortcuts:{editor_label:"Keyboard shortcuts",enabled:"Keyboard shortcuts enabled",ptz_down:"PTZ Down",ptz_home:"PTZ Home",ptz_left:"PTZ Left",ptz_right:"PTZ Right",ptz_up:"PTZ Up",ptz_zoom_in:"PTZ Zoom In",ptz_zoom_out:"PTZ Zoom Out"},triggers:{actions:{editor_label:"Trigger actions",interaction_mode:"How to handle actions when the card has human interaction",interaction_modes:{active:"Only trigger actions when card has human interaction",all:"Trigger actions regardless of human interaction",inactive:"Only trigger actions when card has no human interaction"},trigger:"Trigger action",triggers:{default:"Change to or update default view",live:"Change to or update live view",media:"Change to the relevant media view for new media",none:"No action"},untrigger:"Untrigger action",untriggers:{default:"Change to default view/camera",none:"No action"}},editor_label:"Trigger behavior",filter_selected_camera:"Only trigger on selected camera",show_trigger_status:"Show pulsing border when triggered",untrigger_seconds:"Seconds after inactive state change to untrigger"},views:{clip:"Most recent clip",clips:"Clips gallery",current:"Current view",image:"Static image",live:"Live view",recording:"Most recent recording",recordings:"Recordings gallery",snapshot:"Most recent snapshot",snapshots:"Snapshots gallery",timeline:"Timeline view"}}},M_={grid:"Show media viewer for each camera in a grid",single:"Show single media viewer"},k_={add_new_camera:"Add new camera",button:"Button",camera:"Camera",cameras:"Cameras",cameras_secondary:"What cameras to render on this card",delete:"Delete",dimensions:"Card dimensions",dimensions_secondary:"Card dimensions & shape options",image:"Image",image_secondary:"Static image view options",live:"Live",live_secondary:"Live camera view options",media_gallery:"Media gallery",media_gallery_secondary:"Media gallery options",media_viewer:"Media viewer",media_viewer_secondary:"Viewer for static media (clips, snapshots or recordings)",menu:"Menu",menu_secondary:"Menu look & feel options",move_down:"Move down",move_up:"Move up",overrides:"Overrides are active",overrides_secondary:"Dynamic configuration overrides detected",performance:"Performance",performance_secondary:"Card performance options",profiles:"Configuration profiles",profiles_secondary:"Choose pre-configured sets of defaults",status_bar:"Status bar",status_bar_secondary:"Status bar look & feel options",timeline:"Timeline",timeline_secondary:"Event timeline options",upgrade:"Upgrade",upgrade_available:"An automatic card configuration upgrade is available",view:"View",view_secondary:"What the card should show and how to show it"},S_={ptz:{down:"Down",home:"Home",left:"Left",right:"Right",up:"Up",zoom_in:"Zoom In",zoom_out:"Zoom Out"}},E_={awaiting_live:"Waiting for live stream to load ...",awaiting_media:"Waiting for media to load",camera_initialization:"Camera initialization failed",camera_initialization_reolink:"Could not initialize Reolink camera",could_not_render_elements:"Could not render picture elements",could_not_resolve:"Could not resolve media URL",diagnostics:"Card diagnostics. Please review for confidential information prior to sharing",download_no_media:"No media to download",download_sign_failed:"Could not sign media URL for download",duplicate_camera_id:"Duplicate Frigate camera id for the following camera, use the 'id' parameter to uniquely identify cameras",empty_response:"Received empty response from Home Assistant for request",failed_response:"Failed to receive response from Home Assistant for request",failed_retain:"Could not retain event",failed_sign:"Could not sign Home Assistant URL",image_load_error:"The image could not be loaded",invalid_configuration:"Invalid configuration",invalid_configuration_no_hint:"No location hint available (bad or missing type?)",invalid_configuration_override:"Invalid override configuration",invalid_elements_config:"Invalid picture elements configuration",invalid_response:"Received invalid response from Home Assistant for request",jsmpeg_no_player:"Could not start JSMPEG player",live_camera_no_endpoint:"Could not get camera endpoint for this live provider (incomplete configuration?)",live_camera_not_found:"The configured camera_entity was not found",live_camera_unavailable:"Camera unavailable",no_camera_engine:"Could not determine suitable engine for camera",no_camera_entity:"Could not find camera entity",no_camera_entity_for_triggers:"A camera entity is required in order to autodetect triggers",no_camera_id:"Could not determine camera id for the following camera, may need to set 'id' parameter manually",no_camera_name:"Could not determine a Frigate camera name for camera (or one of its dependents), please specify either 'camera_entity' or 'camera_name'",no_dashboard_or_view:"Both 'dashboard_path' and 'view_path' parameters are required for the 'dashboard' cast method",no_live_camera:"The camera_entity parameter must be set and valid for this live provider",no_supported_camera:"The selected camera does not support this view",no_supported_cameras:"No cameras support this view",reconnecting:"Reconnecting",too_many_automations:"Too many nested automation calls, please check your configuration for loops",troubleshooting:"Check troubleshooting",unknown:"Unknown error",upgrade_available:"An automated card configuration upgrade is available, please visit the visual card editor",webrtc_card_reported_error:"WebRTC Card reported an error",webrtc_card_waiting:"Waiting for WebRTC Card to load ..."},$_={camera:"Camera",duration:"Duration",in_progress:"In Progress",score:"Score",seek:"Seek",start:"Start",tag:"Tag",what:"What",where:"Where"},A_={assign:"Assign",assigning:"Assigning",modifiers:{alt:"Alt",ctrl:"Ctrl",meta:"Meta",shift:"Shift"},unassign:"Unassign"},z_={all:"All",camera:"Camera",favorite:"Favorite",media_type:"Media Type",media_types:{clips:"Clips",recordings:"Recordings",snapshots:"Snapshots"},not_favorite:"Not Favorite",select_camera:"Select camera...",select_favorite:"Select favorite...",select_media_type:"Select media type...",select_tag:"Select tag...",select_what:"Select what...",select_when:"Select when...",select_where:"Select where...",tag:"Tag",what:"What",when:"When",whens:{custom:"Custom",past_month:"Past Month",past_week:"Past Week",today:"Today",yesterday:"Yesterday"},where:"Where"},I_={unseekable:"Seek time not found in media"},T_={camera:"Camera",duration:"Duration",events:"Events",in_progress:"In Progress",seek:"Seek",start:"Start"},j_={download:"Download media",no_thumbnail:"No thumbnail available",retain_indefinitely:"Media will be indefinitely retained",timeline:"See media in timeline"},O_={select_date:"Choose date"},D_={common:x_,config:C_,display_modes:M_,editor:k_,elements:S_,error:E_,event:$_,key_assigner:A_,media_filter:z_,media_viewer:I_,recording:T_,thumbnail:j_,timeline:O_},R_=Object.freeze({__proto__:null,common:x_,config:C_,default:D_,display_modes:M_,editor:k_,elements:S_,error:E_,event:$_,key_assigner:A_,media_filter:z_,media_viewer:I_,recording:T_,thumbnail:j_,timeline:O_});const P_="en",L_={[P_]:R_};let N_;function F_(e){const t=e=>e.replace("-","_"),n=e?.language??e?.selectedLanguage;if(n)return t(n);const a=localStorage.getItem("selectedLanguage");if(a){const e=JSON.parse(a);if(e)return t(e)}for(const e of navigator.languages){const n=t(e);if(n&&n in L_)return n}return P_}function V_(e,t="",n=""){let a="";try{a=e.split(".").reduce(((e,t)=>e[t]),L_[N_??P_])}catch(e){}return a||(a=e.split(".").reduce(((e,t)=>e[t]),L_[P_])),""!==t&&""!==n&&(a=a.replace(t,n)),a}function H_(e){return"string"==typeof e?.id&&e.id||"string"==typeof e?.camera_entity&&e.camera_entity||"object"==typeof e?.webrtc_card&&e.webrtc_card&&("string"==typeof e.webrtc_card.entity&&e.webrtc_card.entity||"string"==typeof e.webrtc_card.url&&e.webrtc_card.url)||"object"==typeof e?.go2rtc&&e.go2rtc&&"string"==typeof e.go2rtc.url&&"string"==typeof e.go2rtc.stream&&`${e.go2rtc.url}#${e.go2rtc.stream}`||"object"==typeof e?.frigate&&e.frigate&&"string"==typeof e?.frigate.camera_name&&e.frigate.camera_name||""}const B_=(e,...t)=>{e?.debug?.logging&&console.debug(...t)},q_=(e,t,n)=>"preset"===t?(n?.preset?e.ptz.presets?.[n.preset]:null)??null:n?.phase?e.ptz[`actions_${t}_${n.phase}`]??null:e.ptz[`actions_${t}`]??null,U_=(e,t,n)=>!!q_(e,t,n),W_=(e,t)=>{const n=U_(e,t,{phase:"start"})&&U_(e,t,{phase:"stop"}),a=U_(e,t);return n||a?[...n?["continuous"]:[],...a?["relative"]:[]]:null},Z_=e=>{const t=W_(e,"left"),n=W_(e,"right"),a=W_(e,"up"),i=W_(e,"down"),r=W_(e,"zoom_in"),o=W_(e,"zoom_out"),s=e.ptz.presets?Object.keys(e.ptz.presets):void 0;return t?.length||n?.length||a?.length||i?.length||r?.length||o?.length||s?.length?{...t?{left:t}:{},...n?{right:n}:{},...a?{up:a}:{},...i?{down:i}:{},...r?{zoomIn:r}:{},...o?{zoomOut:o}:{},...s?{presets:s}:{}}:null};class Q_{constructor(e,t){this._capabilities=e;for(const e of t?.disable??[])this._disable(e);for(const e of Ts)t?.disableExcept?.length&&!t.disableExcept.includes(e)&&this._disable(e)}_disable(e){delete this._capabilities[e]}matches(e){let t=!0;return"string"==typeof e&&(t&&=this.has(e)),"object"==typeof e&&e.allCapabilities&&(t&&=e.allCapabilities.every((e=>this.has(e)))),"object"==typeof e&&e.anyCapabilities&&(t&&=e.anyCapabilities.some((e=>this.has(e)))),t}has(e){return!!this._capabilities[e]}getPTZCapabilities(){return this._capabilities.ptz??null}hasPTZCapability(){return!!(this._capabilities.ptz?.down?.length||this._capabilities.ptz?.up?.length||this._capabilities.ptz?.left?.length||this._capabilities.ptz?.right?.length||this._capabilities.ptz?.zoomIn?.length||this._capabilities.ptz?.zoomOut?.length||this._capabilities.ptz?.presets?.length)}getRawCapabilities(){return this._capabilities}}function G_(e,t,n){var a=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var r=Array(i);++at||r&&o&&c&&!s&&!l||a&&o&&c||!n&&c||!i)return 1;if(!a&&!r&&!l&&e=s?c:c*("desc"==n[a]?-1:1)}return e.index-t.index}(e,t,n)}))}function Ev(e,t,n,a){return null==e?[]:(dp(t)||(t=null==t?[]:[t]),dp(n=a?void 0:n)||(n=null==n?[]:[n]),Sv(e,t,n))}async function $v(e,t,n,a=!1){let i;try{i=await e.callWS(n)}catch(e){if(!(e instanceof Error))throw new zs(V_("error.failed_response"),{request:n,response:e});throw e}if(!i)throw new zs(V_("error.empty_response"),{request:n});const r=a?t.safeParse(JSON.parse(i)):t.safeParse(i);if(!r.success)throw new zs(V_("error.invalid_response"),{request:n,response:i,invalid_keys:Rs(r.error)});return r.data}const Av=ba.lazy((()=>ba.object({title:ba.string(),media_class:ba.string(),media_content_type:ba.string(),media_content_id:ba.string(),can_play:ba.boolean(),can_expand:ba.boolean(),children_media_class:ba.string().nullable().optional(),thumbnail:ba.string().nullable(),children:ba.array(Av).nullable().optional()}))),zv="video",Iv="image",Tv=60,jv=e=>Ev(e,(e=>e._metadata?.startDate),"desc");class Ov{async walkBrowseMedias(e,t,n){return t&&t.length?(await tf(t,(async t=>await this._walkBrowseMedia(e,t,n)))).flat():[]}async _walkBrowseMedia(e,t,n){let a=[];for(const i of function(e,t,n){t=(n?dg(e,t,n):void 0===t)?1:K_(Sg(t),0);var a=null==e?0:e.length;if(!a||t<1)return[];for(var i=0,r=0,o=Array(Y_(a/t));iawait this._browseMedia(e,a,{cache:n?.cache,matcher:t.matcher,metadataGenerator:t.metadataGenerator})));for(const e of r)for(const n of e.children??[])t.matcher(n)&&a.push(n);if(t.sorter&&(a=t.sorter(a)),t.earlyExit&&t.earlyExit(a))break}const i=t.advance?t.advance(a):null;return i?.length?await this.walkBrowseMedias(e,i,n):a}async _browseMedia(e,t,n){const a="object"==typeof t?t.media_content_id:t,i=n?.cache?n.cache.get(a):null;if(i)return i;const r={type:"media_source/browse_media",media_content_id:a},o=await $v(e,Av,r);if(n?.metadataGenerator)for(const e of o.children??[])e._metadata=n.metadataGenerator(e,"object"==typeof t?t:void 0)??void 0;return n?.cache&&n.cache.set(a,o,Ud(new Date,{seconds:60})),o}}function Dv(e,t){return bm(e,t)}function Rv(e,t){return e&&e.length?function(e,t){for(var n=-1,a=e.length,i=0,r=[];++nNv(t,e)))}add(e){this._ranges.push(e),this._ranges=Vv(this._ranges)}clear(){this._ranges=[]}}class Lv{constructor(e){this._ranges=e??[]}hasCoverage(e){const t=new Date;return this._ranges.some((n=>tet.start>=e.start&&t.end<=e.end,Fv=(e,t)=>e.start>=t.start&&e.start<=t.end||e.end>=t.start&&e.end<=t.end||e.start<=t.start&&e.end>=t.end,Vv=(e,t=0)=>{const n=[];e=Ev(e,(e=>e.start),"asc");let a=null;for(const i of e){const e=i.start instanceof Date?i.start.getTime():i.start;if(!a){a={...i};continue}(a.end instanceof Date?a.end.getTime():a.end)+1e3*t>=e?i.end>a.end&&(a.end=i.end):(n.push(a),a={...i})}return a&&n.push(a),n};class Hv{constructor(){this._data=[]}get(e){const t=new Date;for(const n of this._data)if((!n.expires||t<=n.expires)&&this._contains(e,n.request))return n.response;return null}clear(){this._data=[]}has(e){return!!this.get(e)}set(e,t,n){this._data.push({request:e,response:t,expires:n}),this._expireOldRequests()}_contains(e,t){return Dv(e,t)}_expireOldRequests(){const e=new Date;this._data=this._data.filter((t=>!t.expires||e=e.start.getTime()){if(a>e.end.getTime())break;t.push(n)}}return t}getSize(){return this._data.length}expireMatches(e){this._data=this._data.filter((t=>!e(t)))}}class Uv{constructor(){this._segments=new Map}add(e,t,n){let a=this._segments.get(e);a||(a=new qv((e=>1e3*e.start_time),(e=>e.id)),this._segments.set(e,a)),a.add(t,n)}clear(){this._segments.clear()}hasCoverage(e,t){return!!this._segments.get(e)?.hasCoverage(t)}get(e,t){return this._segments.get(e)?.get(t)??null}getSize(e){return this._segments.get(e)?.getSize()??null}getCameraIDs(){return[...this._segments.keys()]}expireMatches(e,t){this._segments.get(e)?.expireMatches(t)}}class Wv extends zs{}class Zv extends zs{}var Qv,Gv,Yv;!function(e){e.Event="event-query",e.Recording="recording-query",e.RecordingSegments="recording-segments-query",e.MediaMetadata="media-metadata"}(Qv||(Qv={})),function(e){e.Event="event-results",e.Recording="recording-results",e.RecordingSegments="recording-segments-results",e.MediaMetadata="media-metadata-results"}(Gv||(Gv={})),function(e){e.Frigate="frigate",e.Generic="generic",e.MotionEye="motioneye",e.Reolink="reolink"}(Yv||(Yv={}));const Kv=e=>e.camera_entity??e.webrtc_card?.entity??null;class Xv{constructor(e){this._entityRegistryManager=e}async createEngine(e,t){let n;switch(e){case Yv.Generic:const{GenericCameraManagerEngine:e}=await import("./engine-generic-96b32038.js").then((function(e){return e.e}));n=new e(t.stateWatcher,t.eventCallback);break;case Yv.Frigate:const{FrigateCameraManagerEngine:a}=await import("./engine-frigate-a6e3bd9e.js");n=new a(this._entityRegistryManager,t.stateWatcher,new Uv,new Bv,t.eventCallback);break;case Yv.MotionEye:const{MotionEyeCameraManagerEngine:i}=await import("./engine-motioneye-d04d1919.js");n=new i(this._entityRegistryManager,t.stateWatcher,new Ov,t.resolvedMediaCache,new Bv,t.eventCallback);break;case Yv.Reolink:const{ReolinkCameraManagerEngine:r}=await import("./engine-reolink-ec1b4246.js");n=new r(this._entityRegistryManager,t.stateWatcher,new Ov,t.resolvedMediaCache,new Bv,t.eventCallback)}return n}async getEngineForCamera(e,t){let n=null;if("frigate"===t.engine)n=Yv.Frigate;else if("motioneye"===t.engine)n=Yv.MotionEye;else if("generic"===t.engine)n=Yv.Generic;else if("reolink"===t.engine)n=Yv.Reolink;else{const a=Kv(t);if(a){const i=await this._entityRegistryManager.getEntity(e,a);if(!i){if(e.states[a])return Yv.Generic;throw new Wv(V_("error.no_camera_entity"),t)}switch(i?.platform){case"frigate":n=Yv.Frigate;break;case"motioneye":n=Yv.MotionEye;break;case"reolink":n=Yv.Reolink;break;default:n=Yv.Generic}}else t.frigate.camera_name?n=Yv.Frigate:(t.webrtc_card?.url||t.go2rtc?.url&&t.go2rtc?.stream)&&(n=Yv.Generic)}return n}}class Jv{constructor(){this._cameras=new Map,this._enginesByType=new Map}addCamera(e){this._cameras.set(e.getID(),e),this._enginesByType.set(e.getEngine().getEngineType(),e.getEngine())}async setCameras(e){for(const t of e){const e=this._cameras.get(t.getID());e!==t&&(this.addCamera(t),await(e?.destroy()))}for(const t of this._cameras.values())e.includes(t)||(await t.destroy(),this._cameras.delete(t.getID()))}async reset(){await tf(this._cameras.values(),(e=>e.destroy())),this._cameras.clear(),this._enginesByType.clear()}getCamera(e){return this._cameras.get(e)??null}getCameras(){return this._cameras}getCameraConfig(e){return this._cameras.get(e)?.getConfig()??null}hasCameraID(e){return this._cameras.has(e)}getCameraCount(){return this._cameras.size}getDefaultCameraID(){return this._cameras.keys().next().value??null}*getCameraConfigs(e){for(const[t,n]of this.getCameraConfigEntries(e))yield n}*getCameraConfigEntries(e){for(const t of e??this._cameras.keys()){const e=this.getCameraConfig(t);e&&(yield[t,e])}}getCameraIDs(){return new Set(this._cameras.keys())}getCameraIDsWithCapability(e){const t=new Set;for(const n of this._cameras.values())n.getCapabilities()?.matches(e)&&t.add(n.getID());return t}getCameraConfigForMedia(e){return this.getCameraConfig(e.getCameraID())}getEngineOfType(e){return this._enginesByType.get(e)??null}getEngineForCameraID(e){return this._cameras.get(e)?.getEngine()??null}getEnginesForCameraIDs(e){const t=new Map;for(const n of e){const e=this.getEngineForCameraID(n);e&&(t.has(e)||t.set(e,new Set),t.get(e)?.add(n))}return t.size?t:null}getEngineForMedia(e){return this.getEngineForCameraID(e.getCameraID())}getAllDependentCameras(e,t){const n=new Set,a=new Set,i=e=>{n.add(e);const r=this.getCamera(e),o=r?.getConfig();if(r&&o){t&&!r.getCapabilities()?.matches(t)||a.add(e);const s=new Set;o.dependencies.cameras.forEach((e=>s.add(e))),o.dependencies.all_cameras&&this.getCameraIDs().forEach((e=>s.add(e)));for(const e of s)n.has(e)||i(e)}};return i(e),a}}const ey=e=>{return Ev((n=e=>e.getID()??e,(t=e)&&t.length?Hg(t,xv(n)):[]),(e=>e.getStartTime()??e.getID()),"asc");var t,n};class ty{static isEventQuery(e){return e.type===Qv.Event}static isRecordingQuery(e){return e.type===Qv.Recording}static isRecordingSegmentsQuery(e){return e.type===Qv.RecordingSegments}static isMediaMetadataQuery(e){return e.type===Qv.MediaMetadata}}class ny{static isEventQueryResult(e){return e.type===Gv.Event}static isRecordingQueryResult(e){return e.type===Gv.Recording}static isRecordingSegmentsQueryResult(e){return e.type===Gv.RecordingSegments}static isMediaMetadataQueryResult(e){return e.type===Gv.MediaMetadata}}class ay{constructor(e,t){this._requestLimit=new w_,this._api=e,this._engineFactory=t?.factory??new Xv(this._api.getEntityRegistryManager()),this._store=t?.store??new Jv}async initializeCamerasFromConfig(){const e=this._api.getConfigManager().getConfig(),t=this._api.getHASSManager().getHASS();if(!e||!t)return!1;this._requestLimit.concurrency=e.performance.features.max_simultaneous_engine_requests??1/0;const n=e.cameras.map((t=>{return n={},a=u_(e?.cameras_global),hg(n,a,t,((e,t)=>Array.isArray(t)?t:void 0));var n,a}));try{await this._initializeCameras(n)}catch(e){return this._api.getMessageManager().setErrorIfHigherPriority(e,V_("error.camera_initialization")),!1}return!0}async reset(){await this._store.reset()}async _getEnginesForCameras(e){const t=new Map,n=new Map,a=this._api.getHASSManager().getHASS(); +/* istanbul ignore if: the if path cannot be reached -- @preserve */ +if(!a)return t;const i=await(async e=>await tf(e,(e=>this._engineFactory.getEngineForCamera(a,e))))(e);for(const[a,r]of e.entries()){const e=i[a],o=e?n.get(e)??await this._engineFactory.createEngine(e,{eventCallback:e=>this._api.getTriggersManager().handleCameraEvent(e),stateWatcher:this._api.getHASSManager().getStateWatcher(),resolvedMediaCache:this._api.getResolvedMediaCache()}):null;if(!o||!e)throw new Wv(V_("error.no_camera_engine"),u_(r));n.set(e,o),t.set(r,o)}return t}async _initializeCameras(e){const t=new Date,n=this._api.getHASSManager().getHASS(); +/* istanbul ignore if: the if path cannot be reached -- @preserve */ +if(!n)return;e.some((e=>(e=>e.triggers.motion||e.triggers.occupancy)(e)))&&await this._api.getEntityRegistryManager().fetchEntityList(n);const a=await this._getEnginesForCameras(e),i=await tf(a.entries(),(async([e,t])=>await t.createCamera(n,e))),r=async()=>{i.forEach((e=>e.destroy()))},o=new Set;for(const e of i){const t=H_(e.getConfig());if(!t)throw await r(),new Wv(V_("error.no_camera_id"),e.getConfig());if(o.has(t))throw await r(),new Wv(V_("error.duplicate_camera_id"),e.getConfig());e.setID(t),o.add(t)}await this._store.setCameras(i),B_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card CameraManager initialized (Cameras: ",this._store.getCameras(),`, Duration: ${((new Date).getTime()-t.getTime())/1e3}s,`,")")}isInitialized(){return this._store.getCameraCount()>0}getStore(){return this._store}generateDefaultEventQueries(e,t){return this._generateDefaultQueries(e,{type:Qv.Event,...t})}generateDefaultRecordingQueries(e,t){return this._generateDefaultQueries(e,{type:Qv.Recording,...t})}generateDefaultRecordingSegmentsQueries(e,t){return this._generateDefaultQueries(e,{type:Qv.RecordingSegments,...t})}_generateDefaultQueries(e,t){const n=[],a=Zg(e),i=this._store.getEnginesForCameraIDs(a);if(!i)return null;for(const[e,a]of i){let i=null; +/* istanbul ignore else: the else path cannot be reached -- @preserve */ty.isEventQuery(t)?i=e.generateDefaultEventQuery(this._store,a,t):ty.isRecordingQuery(t)?i=e.generateDefaultRecordingQuery(this._store,a,t):ty.isRecordingSegmentsQuery(t)&&(i=e.generateDefaultRecordingSegmentsQuery(this._store,a,t));for(const e of i??[])n.push(e)}return n.length?n:null}async getMediaMetadata(){const e=new Set,t=new Set,n=new Set,a=new Set,i={type:Qv.MediaMetadata,cameraIDs:this._store.getCameraIDs()},r=await this._handleQuery(i);for(const i of r.values())i.metadata.tags&&i.metadata.tags.forEach(e.add,e),i.metadata.what&&i.metadata.what.forEach(t.add,t),i.metadata.where&&i.metadata.where.forEach(n.add,n),i.metadata.days&&i.metadata.days.forEach(a.add,a);return t.size||n.size||a.size||e.size?{...e.size&&{tags:e},...t.size&&{what:t},...n.size&&{where:n},...a.size&&{days:a}}:null}async getEvents(e,t){return await this._handleQuery(e,t)}async getRecordings(e,t){return await this._handleQuery(e,t)}async getRecordingSegments(e,t){return await this._handleQuery(e,t)}async executeMediaQueries(e,t){return this._convertQueryResultsToMedia(await this._handleQuery(e,t))}async extendMediaQueries(e,t,n,a){if(!this._api.getHASSManager().getHASS())return null;const i=e=>{let n=null;for(const a of t){const t=a.getStartTime();t&&(!n||"earliest"===e&&tn)&&(n=t)}return n},r=this._api.getConfigManager().getCardWideConfig()?.performance?.features.media_chunk_size??50,o=[],s=[];for(const t of e){const e={...t}; +/* istanbul ignore else: the else path cannot be reached -- @preserve */if("later"===n){const t=i("latest");t&&(e.start=t,delete e.end)}else if("earlier"===n){const t=i("earliest");t&&(e.end=t,delete e.start)}e.limit=r,s.push({...t,limit:(t.limit??0)+r}),o.push(e)}const c=this._convertQueryResultsToMedia(await this._handleQuery(o,a));if(!c.length)return null;const l=ey(t.concat(c));return l.length===t.length?null:{queries:s,results:l}}async getMediaDownloadPath(e){const t=this._store.getCameraConfigForMedia(e),n=this._store.getEngineForMedia(e),a=this._api.getHASSManager().getHASS();return t&&n&&a?await n.getMediaDownloadPath(a,t,e):null}getMediaCapabilities(e){const t=this._store.getEngineForMedia(e);return t?t.getMediaCapabilities(e):null}async favoriteMedia(e,t){const n=this._store.getCameraConfigForMedia(e),a=this._store.getEngineForMedia(e),i=this._api.getHASSManager().getHASS();if(!n||!a||!i)return;const r=new Date;await this._requestLimit.add((()=>a.favoriteMedia(i,n,e,t))),B_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card CameraManager favorite request (",`Duration: ${((new Date).getTime()-r.getTime())/1e3}s,`,"Media:",e.getID(),", Favorite:",t,")")}areMediaQueriesResultsFresh(e,t){const n=new Date;for(const a of e){const e=this._store.getEnginesForCameraIDs(a.cameraIDs);for(const[i,r]of e??[]){const e=i.getQueryResultMaxAge({...a,cameraIDs:r});if(null!==e&&Ud(t,{seconds:e})a?null:await this._requestLimit.add((()=>i.getMediaSeekTime(r,this._store,e,t)))??null}async _handleQuery(e,t){const n=Wg(e),a=new Map,i=new Date,r=this._api.getHASSManager().getHASS();if(!r)return a;const o=async(e,n)=>{let i=null; +/* istanbul ignore else: the else path cannot be reached -- @preserve */ty.isEventQuery(n)?i=await e.getEvents(r,this._store,n,t):ty.isRecordingQuery(n)?i=await e.getRecordings(r,this._store,n,t):ty.isRecordingSegmentsQuery(n)?i=await e.getRecordingSegments(r,this._store,n,t):ty.isMediaMetadataQuery(n)&&(i=await e.getMediaMetadata(r,this._store,n,t)),i?.forEach(((e,t)=>a.set(t,e)))},s=async e=>{const t=this._store.getEnginesForCameraIDs(e.cameraIDs);t&&await Promise.all(Array.from(t.keys()).map((n=>this._requestLimit.add((()=>o(n,{...e,cameraIDs:t.get(n)}))))))};await Promise.all(n.map((e=>s(e))));const c=(l=Array.from(a.values()).map((e=>Number(e.cached??0))))&&l.length?function(e,t){for(var n,a=-1,i=e.length;++athis._store.getCamera(e))).filter(sf);return new Q_({live:t.some((e=>e.getCapabilities()?.has("live"))),clips:t.some((e=>e.getCapabilities()?.has("clips"))),recordings:t.some((e=>e.getCapabilities()?.has("recordings"))),snapshots:t.some((e=>e.getCapabilities()?.has("snapshots"))),"favorite-events":t.some((e=>e.getCapabilities()?.has("favorite-events"))),"favorite-recordings":t.some((e=>e.getCapabilities()?.has("favorite-recordings"))),seek:t.some((e=>e.getCapabilities()?.has("seek"))),menu:t.some((e=>e.getCapabilities()?.has("menu")))})}async executePTZAction(e,t,n){const a=this._store.getCameraConfig(e);if(!a)return;const i=q_(a,t,n);if(i)return await this._api.getActionsManager().executeActions(i);const r=this._api.getHASSManager().getHASS(),o=this._store.getEngineForCameraID(e);return o&&r?await this._requestLimit.add((()=>o.executePTZAction(r,a,t,n))):void 0}}class iy{constructor(e){this._cache=new Map,this._keyCallback=e}has(e){return this._cache.has(e)}getMatches(e){return[...this._cache.values()].filter(e)}get(e){return this._cache.get(e)??null}add(e){const t=e=>this._cache.set(this._keyCallback(e),e);Array.isArray(e)?e.forEach(t):t(e)}}const ry=ba.object({id:ba.string(),model:ba.string().nullable(),config_entries:ba.string().array(),manufacturer:ba.string().nullable()}).array();class oy{constructor(e){this._fetchedDeviceList=!1,this._cache=e}async getDevice(e,t){return this._cache.has(t)?this._cache.get(t):(await this._fetchDeviceList(e),this._cache.get(t)??null)}async getMatchingDevices(e,t){return await this._fetchDeviceList(e),this._cache.getMatches(t)}async _fetchDeviceList(e){if(this._fetchedDeviceList)return;let t=null;try{t=await $v(e,ry,{type:"config/device_registry/list"})}catch(e){return void Gg(e)}this._cache.add(t),this._fetchedDeviceList=!0}}const sy=ba.object({config_entry_id:ba.string().nullable(),device_id:ba.string().nullable(),disabled_by:ba.string().nullable(),entity_id:ba.string(),hidden_by:ba.string().nullable(),platform:ba.string(),translation_key:ba.string().nullable(),unique_id:ba.string().or(ba.number()).optional()}),cy=sy.array();class ly{constructor(e){this._fetchedEntityList=!1,this._cache=e}async getEntity(e,t){const n=this._cache.get(t);if(n)return n;let a=null;try{a=await $v(e,sy,{type:"config/entity_registry/get",entity_id:t})}catch(e){return Gg(e),null}return this._cache.add(a),a}async getMatchingEntities(e,t){return await this.fetchEntityList(e),this._cache.getMatches(t)}async getEntities(e,t){const n=new Map;return await Promise.all(t.map((async t=>{const a=await this.getEntity(e,t);a&&n.set(t,a)}))),n}async fetchEntityList(e){if(this._fetchedEntityList)return;let t=null;try{t=await $v(e,cy,{type:"config/entity_registry/list"})}catch(e){return void Gg(e)}this._cache.add(t),this._fetchedEntityList=!0}}class dy extends Map{constructor(e={}){if(super(),!(e.maxSize&&e.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");if("number"==typeof e.maxAge&&0===e.maxAge)throw new TypeError("`maxAge` must be a number greater than 0");this.maxSize=e.maxSize,this.maxAge=e.maxAge||Number.POSITIVE_INFINITY,this.onEviction=e.onEviction,this.cache=new Map,this.oldCache=new Map,this._size=0}_emitEvictions(e){if("function"==typeof this.onEviction)for(const[t,n]of e)this.onEviction(t,n.value)}_deleteIfExpired(e,t){return"number"==typeof t.expiry&&t.expiry<=Date.now()&&("function"==typeof this.onEviction&&this.onEviction(e,t.value),this.delete(e))}_getOrDeleteIfExpired(e,t){if(!1===this._deleteIfExpired(e,t))return t.value}_getItemValue(e,t){return t.expiry?this._getOrDeleteIfExpired(e,t):t.value}_peek(e,t){const n=t.get(e);return this._getItemValue(e,n)}_set(e,t){this.cache.set(e,t),this._size++,this._size>=this.maxSize&&(this._size=0,this._emitEvictions(this.oldCache),this.oldCache=this.cache,this.cache=new Map)}_moveToRecent(e,t){this.oldCache.delete(e),this._set(e,t)}*_entriesAscending(){for(const e of this.oldCache){const[t,n]=e;if(!this.cache.has(t)){!1===this._deleteIfExpired(t,n)&&(yield e)}}for(const e of this.cache){const[t,n]=e;!1===this._deleteIfExpired(t,n)&&(yield e)}}get(e){if(this.cache.has(e)){const t=this.cache.get(e);return this._getItemValue(e,t)}if(this.oldCache.has(e)){const t=this.oldCache.get(e);if(!1===this._deleteIfExpired(e,t))return this._moveToRecent(e,t),t.value}}set(e,t,{maxAge:n=this.maxAge}={}){const a="number"==typeof n&&n!==Number.POSITIVE_INFINITY?Date.now()+n:void 0;return this.cache.has(e)?this.cache.set(e,{value:t,expiry:a}):this._set(e,{value:t,expiry:a}),this}has(e){return this.cache.has(e)?!this._deleteIfExpired(e,this.cache.get(e)):!!this.oldCache.has(e)&&!this._deleteIfExpired(e,this.oldCache.get(e))}peek(e){return this.cache.has(e)?this._peek(e,this.cache):this.oldCache.has(e)?this._peek(e,this.oldCache):void 0}delete(e){const t=this.cache.delete(e);return t&&this._size--,this.oldCache.delete(e)||t}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}resize(e){if(!(e&&e>0))throw new TypeError("`maxSize` must be a number greater than 0");const t=[...this._entriesAscending()],n=t.length-e;n<0?(this.cache=new Map(t),this.oldCache=new Map,this._size=t.length):(n>0&&this._emitEvictions(t.slice(0,n)),this.oldCache=new Map(t.slice(n)),this.cache=new Map,this._size=0),this.maxSize=e}*keys(){for(const[e]of this)yield e}*values(){for(const[,e]of this)yield e}*[Symbol.iterator](){for(const e of this.cache){const[t,n]=e;!1===this._deleteIfExpired(t,n)&&(yield[t,n.value])}for(const e of this.oldCache){const[t,n]=e;if(!this.cache.has(t)){!1===this._deleteIfExpired(t,n)&&(yield[t,n.value])}}}*entriesDescending(){let e=[...this.cache];for(let t=e.length-1;t>=0;--t){const n=e[t],[a,i]=n;!1===this._deleteIfExpired(a,i)&&(yield[a,i.value])}e=[...this.oldCache];for(let t=e.length-1;t>=0;--t){const n=e[t],[a,i]=n;if(!this.cache.has(a)){!1===this._deleteIfExpired(a,i)&&(yield[a,i.value])}}}*entriesAscending(){for(const[e,t]of this._entriesAscending())yield[e,t.value]}get size(){if(!this._size)return this.oldCache.size;let e=0;for(const t of this.oldCache.keys())this.cache.has(t)||e++;return Math.min(this._size+e,this.maxSize)}entries(){return this.entriesAscending()}forEach(e,t=this){for(const[n,a]of this.entriesAscending())e.call(t,a,n,this)}get[Symbol.toStringTag](){return JSON.stringify([...this.entriesAscending()])}}class uy{constructor(){this._cache=new dy({maxSize:1e3})}has(e){return this._cache.has(e)}get(e){return this._cache.get(e)}set(e,t){this._cache.set(e,t)}}const hy=async(e,t,n)=>{const a=n?n.get(t):void 0;if(a)return a;const i={type:"media_source/resolve_media",media_content_id:t};let r=null;try{r=await $v(e,js,i)}catch(e){Gg(e)}return n&&r&&n.set(t,r),r};class py{constructor(e,t,n){this._context=e,this._action=t,this._config=n}async execute(e){}async stop(){}}class my extends py{}class gy extends my{async execute(e){const t=this._action.camera??(this._action.triggered?e.getTriggersManager().getMostRecentlyTriggeredCameraID():null),n=e.getViewManager().getView(),a=e.getConfigManager().getConfig();if(t&&n){const i=a?.view.camera_select??"current",r="current"===i?n.view:i;await e.getViewManager().setViewByParametersWithNewQuery({params:{view:r,camera:t},failSafe:!0})}}}class fy extends my{async execute(e){e.getCameraURLManager().openURL()}}class _y extends my{async execute(e){e.getViewManager().setViewDefault()}}class vy extends my{async execute(e){await e.getViewManager().setViewByParametersWithNewQuery({params:{displayMode:this._action.display_mode}})}}class yy extends my{async execute(e){await e.getDownloadManager().downloadViewerMedia()}}class by extends my{async execute(e){e.getExpandManager().toggleExpanded()}}class wy extends my{async execute(e){e.getFullscreenManager().toggleFullscreen()}}class xy extends py{async execute(e){const t=e.getHASSManager().getHASS();t&&at(e.getCardElementManager().getElement(),t,this._config??{},this._action)}}class Cy extends my{async execute(e){console[this._action.level](this._action.message)}}const My=(e,t)=>e.context?.live?.overrides?.get(t??e.camera)??t??e.camera,ky=e=>My(e)!==e.camera,Sy=(e,t)=>{const n=e.context?.live?.overrides??new Map;n.set(e.camera,t),e.mergeInContext({live:{overrides:n}})};class Ey extends my{async execute(e){const t=this._action.media_player,n=e.getMediaPlayerManager(),a=e.getViewManager().getView(),i=a?.queryResults?.getSelectedResult()??null;"stop"===this._action.media_player_action?await n.stop(t):a?.is("live")?await n.playLive(t,My(a)):a?.isViewerView()&&i&&await n.playMedia(t,i)}}class $y extends my{async execute(e){e.getCardElementManager().toggleMenu()}}class Ay extends my{async execute(e){await e.getMicrophoneManager().connect()}}class zy extends my{async execute(e){e.getMicrophoneManager().disconnect()}}class Iy extends my{async execute(e){e.getMicrophoneManager().mute()}}class Ty extends my{async execute(e){await e.getMicrophoneManager().unmute()}}class jy extends my{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.mute())}}class Oy extends my{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.pause())}}class Dy extends my{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.play())}}const Ry=(e,t)=>{if(e.isViewerView()){const n=e.queryResults?.getSelectedResult()?.getID()??null;return"ptz"!==t?.type&&n?{targetID:n,type:"digital"}:null}if(e.is("live")){const n=My(e);let a="digital";return"digital"!==t?.type&&t?.cameraManager&&(Py(t.cameraManager,n)&&(a="ptz"),"ptz"!==a&&"ptz"===t?.type)?null:{targetID:n,type:a}}return null},Py=(e,t)=>!!e.getStore().getCamera(t)?.getCapabilities()?.hasPTZCapability();var Ly=ug((function(e,t,n){Jm(e,t,n)}));const Ny=(e,t)=>{t?.[e]?.inProgressAction?.stop()},Fy=(e,t,n,a)=>{Ly(t,{[n]:{[e]:{inProgressAction:a}}})};class Vy extends my{constructor(){super(...arguments),this._timer=new xf}async stop(){this._timer.stop()}async execute(e){const t=e.getViewManager().getView();if(!t)return;const n=this._action.camera??Ry(t,{type:"ptz",cameraManager:e.getCameraManager()})?.targetID??null,a=n?e.getCameraManager().getCameraCapabilities(n)?.getPTZCapabilities():null,i=n?e.getCameraManager().getStore().getCameraConfig(n)?.ptz:null;if(!n||!a||!i)return;if(!this._action.ptz_action)return void(a.presets&&a.presets.length>=1&&await e.getCameraManager().executePTZAction(n,"preset",{phase:this._action.ptz_phase,preset:a.presets[0]}));const r=(e=>{switch(e){case"left":case"right":case"up":case"down":return e;case"zoom_in":return"zoomIn";case"zoom_out":return"zoomOut"}return null})(this._action.ptz_action);if(r&&a[r]?.includes(this._action.ptz_phase?"continuous":"relative")||"preset"===this._action.ptz_action)return await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{phase:this._action.ptz_phase,preset:this._action.ptz_preset});if("start"===this._action.ptz_phase){Ny(n,this._context.ptz),Fy(n,this._context,"ptz",this);const t=async()=>{this._action.ptz_action&&await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset}),this._timer.start(i.r2c_delay_between_calls_seconds,t)};await t()}else"stop"===this._action.ptz_phase?Ny(n,this._context.ptz):(await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset,phase:"start"}),this._timer.start(i.c2r_delay_between_calls_seconds,(async()=>{this._action.ptz_action&&await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset,phase:"stop"})})))}}class Hy extends my{async execute(e){e.getViewManager().setViewWithMergedContext({ptzControls:{enabled:this._action.enabled}})}}function By(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=Cg(n))==n?n:0),void 0!==t&&(t=(t=Cg(t))==t?t:0),function(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}(Cg(e),t,n)}const qy=50,Uy=50,Wy=1,Zy=4,Qy=e=>void 0===e?.pan?.x&&void 0===e?.pan?.y&&void 0===e?.zoom;class Gy{constructor(e){this._context=e}modify(e){e.mergeInContext(this._context)}}const Yy=(e,t)=>({zoom:{[e]:{observed:t?.observed??void 0,requested:t?.requested??null}}}),Ky=(e,t,n)=>{t&&n&&t.setViewByParameters({modifiers:[new Gy(Yy(n,{observed:e.detail}))]})};class Xy extends my{constructor(){super(...arguments),this._timer=new xf}async _stepChange(e,t){e.getViewManager().setViewWithMergedContext(Yy(t,{requested:this._convertActionToZoomSettings(e.getViewManager().getView()?.context?.zoom?.[t]?.observed)}))}async stop(){this._timer.stop()}async execute(e){const t=e.getViewManager().getView();if(!t)return;const n=this._action.target_id??Ry(t,{type:"digital",cameraManager:e.getCameraManager()})?.targetID;return n?this._action.absolute||!this._action.ptz_phase?await this._stepChange(e,n): +/* istanbul ignore else: the else path cannot be reached -- @preserve */ +void("start"===this._action.ptz_phase?(Ny(n,this._context.ptzDigital),Fy(n,this._context,"ptzDigital",this),await this._stepChange(e,n),this._timer.startRepeated(.1,(()=>this._stepChange(e,n)))):"stop"===this._action.ptz_phase&&(Ny(n,this._context.ptzDigital),delete this._context.ptzDigital?.[n])):void 0}_convertActionToZoomSettings(e){if(!this._action.absolute&&!this._action.ptz_action)return{};if(this._action.absolute)return this._action.absolute;const t=e?.zoom??1,n=e?.pan?.x??50,a=e?.pan?.y??50,i="zoom_in"===this._action.ptz_action?.1:"zoom_out"===this._action.ptz_action?-.1:0,r="left"===this._action.ptz_action?-5:"right"===this._action.ptz_action?5:0,o="up"===this._action.ptz_action?-5:"down"===this._action.ptz_action?5:0;return{zoom:By(t+i,1,10),pan:{x:By(n+r,0,100),y:By(a+o,0,100)}}}}class Jy extends my{async execute(e){const t=e.getViewManager().getView();let n=null,a=null;if(this._action.target_id)n=this._action.target_id,a=Py(e.getCameraManager(),n)?"ptz":"digital";else if(t){const i=Ry(t,{cameraManager:e.getCameraManager()});n=i?.targetID??null,a=i?.type??null}n&&null!==a&&("ptz"===a?this._toPTZAction(n):this._toPTZDigitalAction(n)).execute(e)}_toPTZAction(e){return new Vy(this._context,(t={cardID:this._action.card_id,cameraID:e,ptzAction:this._action.ptz_action,ptzPhase:this._action.ptz_phase,ptzPreset:this._action.ptz_preset},{action:"fire-dom-event",frigate_card_action:"ptz",...t?.cardID&&{card_id:t.cardID},...t?.ptzAction&&{ptz_action:t.ptzAction},...t?.ptzPhase&&{ptz_phase:t.ptzPhase},...t?.ptzPreset&&{ptz_preset:t.ptzPreset},...t?.cameraID&&{camera:t.cameraID}}),this._config);var t}_toPTZDigitalAction(e){return new Xy(this._context,(t={cardID:this._action.card_id,ptzPhase:this._action.ptz_phase,ptzAction:this._action.ptz_action,targetID:e},{action:"fire-dom-event",frigate_card_action:"ptz_digital",...t?.cardID&&{card_id:t.cardID},...t?.ptzAction&&{ptz_action:t.ptzAction},...t?.ptzPhase&&{ptz_phase:t.ptzPhase},...t?.absolute&&{absolute:t.absolute},...t?.targetID&&{target_id:t.targetID}}),this._config);var t}}class eb extends my{async execute(e){await e.getDownloadManager().downloadScreenshot()}}class tb extends my{async execute(e){var t;await af((t=this._action.duration,3600*(t.h??0)+60*(t.m??0)+(t.s??0)+(t.ms??0)/1e3))}}class nb extends my{async execute(e){switch(this._action.status_bar_action){case"reset":e.getStatusBarItemManager().removeAllDynamicStatusBarItems();break;case"add":this._action.items?.forEach((t=>e.getStatusBarItemManager().addDynamicStatusBarItem(t)));break;case"remove":this._action.items?.forEach((t=>e.getStatusBarItemManager().removeDynamicStatusBarItem(t)))}}}class ab{modify(e){(e=>{const t=e.context?.live?.overrides;t&&t.has(e.camera)&&e.context?.live?.overrides?.delete(e.camera)})(e)}}class ib extends my{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new ab]})}}class rb{constructor(e){this._api=e}modify(e){const t=[...this._api.getCameraManager().getStore().getAllDependentCameras(e.camera,"substream")];if(t.length<=1)return;const n=My(e),a=t.indexOf(n),i=a<0?0:(a+1)%t.length;Sy(e,t[i])}}class ob extends my{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new rb(e)]})}}class sb{constructor(e){this._substreamID=e}modify(e){Sy(e,this._substreamID)}}class cb extends my{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new sb(this._action.camera)]})}}class lb extends my{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.unmute())}}class db extends my{async execute(e){e.getViewManager().setViewByParametersWithNewQuery({params:{view:this._action.frigate_card_action}})}}class ub{createAction(e,t,n){const a=mf(t);if("fire-dom-event"!==t.action||!a)return new xy(e,t,n?.config);if(a.card_id&&a.card_id!==n?.cardID)return null;switch(a.frigate_card_action){case"default":return new _y(e,a,n?.config);case"clip":case"clips":case"image":case"live":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":case"diagnostics":return new db(e,a,n?.config);case"sleep":return new tb(e,a,n?.config);case"download":return new yy(e,a,n?.config);case"camera_ui":return new fy(e,a,n?.config);case"expand":return new by(e,a,n?.config);case"fullscreen":return new wy(e,a,n?.config);case"menu_toggle":return new $y(e,a,n?.config);case"camera_select":return new gy(e,a,n?.config);case"live_substream_select":return new cb(e,a,n?.config);case"live_substream_off":return new ib(e,a,n?.config);case"live_substream_on":return new ob(e,a,n?.config);case"media_player":return new Ey(e,a,n?.config);case"microphone_connect":return new Ay(e,a,n?.config);case"microphone_disconnect":return new zy(e,a,n?.config);case"microphone_mute":return new Iy(e,a,n?.config);case"microphone_unmute":return new Ty(e,a,n?.config);case"mute":return new jy(e,a,n?.config);case"unmute":return new lb(e,a,n?.config);case"play":return new Dy(e,a,n?.config);case"pause":return new Oy(e,a,n?.config);case"screenshot":return new eb(e,a,n?.config);case"display_mode_select":return new vy(e,a,n?.config);case"ptz":return new Vy(e,a,n?.config);case"ptz_digital":return new Xy(e,a,n?.config);case"ptz_multi":return new Jy(e,a,n?.config);case"ptz_controls":return new Hy(e,a,n?.config);case"log":return new Cy(e,a,n?.config);case"status_bar":return new nb(e,a,n?.config)} +/* istanbul ignore next: this path cannot be reached -- @preserve */ +/* istanbul ignore next: this path cannot be reached -- @preserve */ +return console.warn(`Frigate card received unknown card action: ${a.frigate_card_action}`),null}}class hb{constructor(e,t,n){this._actions=[],this._factory=new ub,this._stopped=!1,this._context=e;for(const a of Wg(t)){const t=this._factory.createAction(e,a,n);t&&this._actions.push(t)}}async execute(e){for(const t of this._actions){if(this._stopped)break;await t.execute(e)}}async stop(){this._stopped=!0}}const pb=ba.object({action:ba.enum(["tap","double_tap","hold","start_tap","end_tap"])}),mb=ba.object({detail:pb});class gb{constructor(e){this._actionsInFlight=[],this._actionContext={},this.handleInteractionEvent=e=>{const t=mb.safeParse(e);if(!t.success)return;const n=t.data.detail.action,a=this.getMergedActions(),i=yf(n,a);a&&n&&i&&this.executeActions(i,a)},this.handleCustomActionEvent=e=>{"detail"in e&&this.executeActions(e.detail)},this.handleActionExecutionRequestEvent=async e=>{await this.executeActions(e.detail.action,e.detail.config)},this._api=e}getMergedActions(){const e=this._api.getViewManager().getView();if(this._api.getMessageManager().hasMessage())return{};const t=this._api.getConfigManager().getConfig();let n;if(e?.is("live"))n=t?.live.actions;else if(e?.isGalleryView())n=t?.media_gallery?.actions;else if(e?.isViewerView())n=t?.media_viewer.actions;else{if(!e?.is("image"))return{};n=t?.image?.actions}return{...t?.view.actions,...n}}uninitialize(){this._actionsInFlight.forEach((e=>e.stop()))}async executeActions(e,t){const n=new hb(this._actionContext,e,{config:t,cardID:this._api.getConfigManager().getConfig()?.card_id});this._actionsInFlight.push(n),await n.execute(this._api),this._actionsInFlight=this._actionsInFlight.filter((e=>e!==n))}}class fb{constructor(e){this._automations=[],this._priorEvaluations=new Map,this._nestedAutomationExecutions=0,this._api=e}deleteAutomations(e){this._automations=this._automations.filter((t=>t.tag!==e))}addAutomations(e){this._automations.push(...e)}execute(){if(!this._api.getHASSManager().hasHASS()||!this._api.getInitializationManager().isInitializedMandatory()||this._api.getMessageManager().hasErrorMessage())return;const e=[];for(const t of this._automations){const n=this._api.getConditionsManager().evaluateConditions(t.conditions),a=n?t.actions:t.actions_not,i=this._priorEvaluations.get(t);this._priorEvaluations.set(t,n),n!==i&&a&&e.push(...a)}if(!e.length)return;(async e=>{++this._nestedAutomationExecutions,this._nestedAutomationExecutions>10?this._api.getMessageManager().setMessageIfHigherPriority({type:"error",message:V_("error.too_many_automations")}):(await this._api.getActionsManager().executeActions(e),--this._nestedAutomationExecutions)})(e)}}class _b{constructor(e){this._api=e}openURL(){const e=this.getCameraURL();e&&window.open(e)}hasCameraURL(){return!!this.getCameraURL()}getCameraURL(){const e=this._api.getViewManager().getView(),t=e?.queryResults?.getSelectedResult()??null,n=e?.camera?this._api.getCameraManager().getCameraEndpoints(e.camera,{view:e.view,...t&&{media:t}})??null:null;return n?.ui?.endpoint??null}}const vb=(e,t)=>!!((e.attributes.supported_features??0)&t),yb=e=>(e=>vb(e,4)&&"number"==typeof e.attributes.in_progress)(e)||!!e.attributes.in_progress,bb=e=>{switch(e){case"armed_away":return"mdi:shield-lock";case"armed_vacation":return"mdi:shield-airplane";case"armed_home":return"mdi:shield-home";case"armed_night":return"mdi:shield-moon";case"armed_custom_bypass":return"mdi:security";case"pending":case"arming":return"mdi:shield-sync";case"triggered":return"mdi:bell-ring";case"disarmed":return"mdi:shield-off";default:return"mdi:shield"}},wb=(e,t)=>{const n="off"===e;switch(t?.attributes.device_class){case"battery":return n?"mdi:battery":"mdi:battery-outline";case"battery_charging":return n?"mdi:battery":"mdi:battery-charging";case"cold":return n?"mdi:thermometer":"mdi:snowflake";case"connectivity":return n?"mdi:close-network-outline":"mdi:check-network-outline";case"door":return n?"mdi:door-closed":"mdi:door-open";case"garage_door":return n?"mdi:garage":"mdi:garage-open";case"power":case"plug":return n?"mdi:power-plug-off":"mdi:power-plug";case"gas":case"problem":case"safety":case"tamper":return n?"mdi:check-circle":"mdi:alert-circle";case"smoke":return n?"mdi:check-circle":"mdi:smoke";case"heat":return n?"mdi:thermometer":"mdi:fire";case"light":return n?"mdi:brightness5":"mdi:brightness-7";case"lock":return n?"mdi:lock":"mdi:lock-open";case"moisture":return n?"mdi:water-off":"mdi:water";case"motion":return n?"mdi:motion-sensor-off":"mdi:motion-sensor";case"occupancy":case"presence":return n?"mdi:home-outline":"mdi:home";case"opening":return n?"mdi:square":"mdi:square-outline";case"running":return n?"mdi:stop":"mdi:play";case"sound":return n?"mdi:music-note-off":"mdi:music-note";case"update":return n?"mdi:package":"mdi:package-up";case"vibration":return n?"mdi:crop-portrait":"mdi:vibrate";case"window":return n?"mdi:window-closed":"mdi:window-open";default:return n?"mdi:radiobox-blank":"mdi:checkbox-marked-circle"}},xb=(e,t)=>{const n="closed"!==e;switch(t?.attributes.device_class){case"garage":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:garage";default:return"mdi:garage-open"}case"gate":switch(e){case"opening":case"closing":return"mdi:gate-arrow-right";case"closed":return"mdi:gate";default:return"mdi:gate-open"}case"door":return n?"mdi:door-open":"mdi:door-closed";case"damper":return n?"md:circle":"mdi:circle-slice-8";case"shutter":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-shutter";default:return"mdi:window-shutter-open"}case"curtain":switch(e){case"opening":return"mdi:arrow-split-vertical";case"closing":return"mdi:arrow-collapse-horizontal";case"closed":return"mdi:curtains-closed";default:return"mdi:curtains"}case"blind":case"shade":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:blinds";default:return"mdi:blinds-open"}case"window":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-closed";default:return"mdi:window-open"}}switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-closed";default:return"mdi:window-open"}},Cb={apparent_power:"mdi:flash",aqi:"mdi:air-filter",carbon_dioxide:"mdi:molecule-co2",carbon_monoxide:"mdi:molecule-co",current:"mdi:current-ac",date:"mdi:calendar",energy:"mdi:lightning-bolt",frequency:"mdi:sine-wave",gas:"mdi:gas-cylinder",humidity:"mdi:water-percent",illuminance:"mdi:brightness-5",monetary:"mdi:cash",nitrogen_dioxide:"mdi:molecule",nitrogen_monoxide:"mdi:molecule",nitrous_oxide:"mdi:molecule",ozone:"mdi:molecule",pm1:"mdi:molecule",pm10:"mdi:molecule",pm25:"mdi:molecule",power:"mdi:flash",power_factor:"mdi:angle-acute",pressure:"mdi:gauge",reactive_power:"mdi:flash",signal_strength:"mdi:wifi",sulphur_dioxide:"mdi:molecule",temperature:"mdi:thermometer",timestamp:"mdi:clock",volatile_organic_compounds:"mdi:molecule",voltage:"mdi:sine-wave"},Mb={10:"mdi:battery-10",20:"mdi:battery-20",30:"mdi:battery-30",40:"mdi:battery-40",50:"mdi:battery-50",60:"mdi:battery-60",70:"mdi:battery-70",80:"mdi:battery-80",90:"mdi:battery-90",100:"mdi:battery"},kb={10:"mdi:battery-charging-10",20:"mdi:battery-charging-20",30:"mdi:battery-charging-30",40:"mdi:battery-charging-40",50:"mdi:battery-charging-50",60:"mdi:battery-charging-60",70:"mdi:battery-charging-70",80:"mdi:battery-charging-80",90:"mdi:battery-charging-90",100:"mdi:battery-charging"},Sb=(e,t)=>{const n=Number(e);if(isNaN(n))return"off"===e?"mdi:battery":"on"===e?"mdi:battery-alert":"mdi:battery-unknown";const a=10*Math.round(n/10);return t&&n>=10?kb[a]:t?"mdi:battery-charging-outline":n<=5?"mdi:battery-alert-variant-outline":Mb[a]},Eb=e=>{const t=e?.attributes.device_class;if(t&&t in Cb)return Cb[t];if("battery"===t)return e?((e,t)=>{const n=e.state;return Sb(n,"on"===t?.state)})(e):"mdi:battery";const n=e?.attributes.unit_of_measurement;return"°C"===n||"°F"===n?"mdi:thermometer":void 0},$b="mdi:bookmark",Ab={alert:"mdi:alert",air_quality:"mdi:air-filter",automation:"mdi:robot",calendar:"mdi:calendar",camera:"mdi:video",climate:"mdi:thermostat",configurator:"mdi:cog",conversation:"mdi:text-to-speech",counter:"mdi:counter",fan:"mdi:fan",google_assistant:"mdi:google-assistant",group:"mdi:google-circles-communities",homeassistant:"mdi:home-assistant",homekit:"mdi:home-automation",image_processing:"mdi:image-filter-frames",input_button:"mdi:gesture-tap-button",input_datetime:"mdi:calendar-clock",input_number:"mdi:ray-vertex",input_select:"mdi:format-list-bulleted",input_text:"mdi:form-textbox",light:"mdi:lightbulb",mailbox:"mdi:mailbox",notify:"mdi:comment-alert",number:"mdi:ray-vertex",persistent_notification:"mdi:bell",person:"mdi:account",plant:"mdi:flower",proximity:"mdi:apple-safari",remote:"mdi:remote",scene:"mdi:palette",script:"mdi:script-text",select:"mdi:format-list-bulleted",sensor:"mdi:eye",siren:"mdi:bullhorn",simple_alarm:"mdi:bell",sun:"mdi:white-balance-sunny",timer:"mdi:timer-outline",updater:"mdi:cloud-upload",vacuum:"mdi:robot-vacuum",water_heater:"mdi:thermometer",weather:"mdi:weather-cloudy",zone:"mdi:map-marker-radius"};function zb(e,t,n,a){switch(e){case"alarm_control_panel":return bb(n);case"binary_sensor":return wb(n,t);case"button":switch(t?.attributes.device_class){case"restart":return"mdi:restart";case"update":return"mdi:package-up";default:return"mdi:gesture-tap-button"}case"cover":return xb(n,t);case"device_tracker":return"router"===t?.attributes.source_type?"home"===n?"mdi:lan-connect":"mdi:lan-disconnect":["bluetooth","bluetooth_le"].includes(t?.attributes.source_type)?"home"===n?"mdi:bluetooth-connect":"mdi:bluetooth":"not_home"===n?"mdi:account-arrow-right":"mdi:account";case"humidifier":return n&&"off"===n?"mdi:air-humidifier-off":"mdi:air-humidifier";case"input_boolean":return"on"===n?"mdi:check-circle-outline":"mdi:close-circle-outline";case"lock":switch(n){case"unlocked":return"mdi:lock-open";case"jammed":return"mdi:lock-alert";case"locking":case"unlocking":return"mdi:lock-clock";default:return"mdi:lock"}case"media_player":switch(t?.attributes.device_class){case"speaker":switch(n){case"playing":return"mdi:speaker-play";case"paused":return"mdi:speaker-pause";case"off":return"mdi:speaker-off";default:return"mdi:speaker"}case"tv":switch(n){case"playing":return"mdi:television-play";case"paused":return"mdi:television-pause";case"off":return"mdi:television-off";default:return"mdi:television"}default:switch(n){case"playing":case"paused":return"mdi:cast-connected";case"off":return"mdi:cast-off";default:return"mdi:cast"}}case"switch":switch(t?.attributes.device_class){case"outlet":return"on"===n?"mdi:power-plug":"mdi:power-plug-off";case"switch":return"on"===n?"mdi:toggle-switch":"mdi:toggle-switch-off";default:return"mdi:flash"}case"zwave":switch(n){case"dead":return"mdi:emoticon-dead";case"sleeping":return"mdi:sleep";case"initializing":return"mdi:timer-sand";default:return"mdi:z-wave"}case"sensor":{const e=Eb(t);if(e)return e;break}case"input_datetime":if(!t?.attributes.has_date)return"mdi:clock";if(!t.attributes.has_time)return"mdi:calendar";break;case"sun":return"above_horizon"===t?.state?Ab[e]:"mdi:weather-night";case"update":return"on"===t?.state?yb(t)?"mdi:package-down":"mdi:package-up":"mdi:package"}return e in Ab?Ab[e]:a??$b}async function Ib(e,t,n){const a={type:"auth/sign_path",path:t,expires:n},i=await $v(e,Os,a);return i?e.hassUrl(i.path):null}function Tb(e,t,n,a){if(!e||!n||!n.length)return[];const i=[];for(const r of n){const n=t?.states[r],o=e.states[r];if((a?.stateOnly&&n?.state!==o?.state||!a?.stateOnly&&n!==o)&&(i.push({entityID:r,oldState:n,newState:o}),a?.firstOnly))break}return i}function jb(e,t,n,a){return!!Tb(e,t,n,{...a,firstOnly:!0}).length}function Ob(e){if("off"===e.state||!e.attributes.brightness)return"";return`brightness(${(e.attributes.brightness+245)/5}%)`}function Db(e){return"off"===e.state?"":e.attributes.rgb_color?`rgb(${e.attributes.rgb_color.join(",")})`:""}function Rb(e){return{color:Db(e),filter:Ob(e)}}function Pb(e,t){if(!t.entity)return t;const n=e.states[t.entity];n&&t.state_color&&(t.style={...Rb(n),...t.style}),t.title=t.title??(n?.attributes?.friendly_name||t.entity),t.icon=t.icon??Nb(e,t.entity);const a=n?function(e){return Ye(e.entity_id)}(n):void 0;return t.data_domain=t.state_color||"light"===a&&!1!==t.state_color?a:void 0,n&&(t.data_state=(e=>{const t=e.entity_id.split(".")[0];let n=e.state;return"climate"===t&&(n=e.attributes.hvac_action),n})(n)),t}function Lb(e,t){return t?e?.states[t]?.attributes?.friendly_name:void 0}function Nb(e,t,n){const a=e.states[t];return a&&a.attributes.icon?a.attributes.icon:zb(Ye(t),a,a?.state,n)}const Fb=async()=>{if(["ha-button-menu","ha-button","ha-camera-stream","ha-card","ha-circular-progress","ha-hls-player","ha-icon-button","ha-icon","ha-menu-button","ha-selector","ha-web-rtc-player"].every((e=>customElements.get(e))))return!0;const e=await window.loadCardHelpers();await e.createCardElement({type:"picture-glance",entities:[],camera_image:"dummy-to-load-editor-components"}),await customElements.whenDefined("hui-picture-glance-card");const t=customElements.get("hui-picture-glance-card");if(!t)return!1;const n=new t;return await n.constructor.getConfigElement(),!0},Vb=e=>!!e&&["on","open"].includes(e),Hb=(e,t)=>{if(!e)return[];const n=Object.keys(e.states).filter((e=>!t||e.substr(0,e.indexOf("."))===t));return n.sort(),n};function Bb(e){return!!e?.startsWith("/")}function qb(e,t){return Bb(t)?e.hassUrl(t):t??null}class Ub{constructor(){this._initialized=new Set}async initializeMultipleIfNecessary(e){return(await tf(Object.entries(e),(async([e,t])=>await this.initializeIfNecessary(e,t)))).every(Boolean)}async initializeIfNecessary(e,t){return!!this._initialized.has(e)||(t?!!await t()&&(this._initialized.add(e),!0):(this._initialized.add(e),!0))}uninitialize(e){this._initialized.delete(e)}isInitialized(e){return this._initialized.has(e)}isInitializedMultiple(e){return e.every((e=>this.isInitialized(e)))}}var Wb;!function(e){e.LANGUAGES="languages",e.SIDE_LOAD_ELEMENTS="side-load-elements",e.CAMERAS="cameras",e.MICROPHONE_CONNECT="microphone-connect",e.VIEW="view"}(Wb||(Wb={}));class Zb{constructor(e,t){this._initializationQueue=new w_({concurrency:1}),this._everInitialized=!1,this._api=e,this._initializer=t??new Ub}wasEverInitialized(){return this._everInitialized}isInitializedMandatory(){return!!this._api.getConfigManager().getConfig()&&this._initializer.isInitializedMultiple([Wb.LANGUAGES,Wb.SIDE_LOAD_ELEMENTS,Wb.CAMERAS,...this._api.getMicrophoneManager().shouldConnectOnInitialization()?[Wb.MICROPHONE_CONNECT]:[],Wb.VIEW])}async initializeMandatory(){await this._initializationQueue.add((()=>this._initializeMandatory()))}async _initializeMandatory(){const e=this._api.getHASSManager().getHASS();if(!e||this.isInitializedMandatory())return;if(!await this._initializer.initializeMultipleIfNecessary({[Wb.LANGUAGES]:async()=>await(async e=>{const t=F_(e);return"ca"===t?L_[t]=await import("./lang-ca-449daa4a.js"):"it"===t?L_[t]=await import("./lang-it-2a20a319.js"):"pt"===t?L_[t]=await import("./lang-pt-PT-c4863423.js"):"pt_BR"===t?L_[t]=await import("./lang-pt-BR-83a703b9.js"):"fr"===t&&(L_[t]=await import("./lang-fr-674e5de5.js")),t&&(N_=t),!0})(e),[Wb.SIDE_LOAD_ELEMENTS]:async()=>await Fb()}))return;this._api.getConfigManager().getConfig()&&await this._initializer.initializeMultipleIfNecessary({[Wb.CAMERAS]:async()=>await this._api.getCameraManager().initializeCamerasFromConfig(),...this._api.getMicrophoneManager().shouldConnectOnInitialization()&&{[Wb.MICROPHONE_CONNECT]:async()=>await this._api.getMicrophoneManager().connect()}})&&!this._api.getMessageManager().hasMessage()&&await this._initializer.initializeIfNecessary(Wb.VIEW,this._api.getViewManager().initialize)&&(this._everInitialized=!0,this._api.getCardElementManager().update())}uninitialize(e){this._initializer.uninitialize(e)}}class Qb{constructor(e,t,n,a){this.update=()=>{this._element.requestUpdate()},this._api=e,this._element=t,this._scrollCallback=n,this._menuToggleCallback=a}getElement(){return this._element}scrollReset(){this._scrollCallback()}toggleMenu(){this._menuToggleCallback()}hasUpdated(){return this._element.hasUpdated}elementConnected(){this._api.getInteractionManager().initialize(),this._api.getFullscreenManager().initialize(),this._api.getExpandManager().initialize(),this._api.getMediaLoadedInfoManager().initialize(),this._api.getMicrophoneManager().initialize(),this._api.getKeyboardStateManager().initialize(),this._api.getDefaultManager().initialize(),this._api.getMediaPlayerManager().initialize(),this._api.getHASSManager().getStateWatcher()?.subscribe(this.update,[...this._api.getConfigManager().getConfig()?.view.render_entities??[],...this._api.getMediaPlayerManager().getMediaPlayers()??[]]),of(this._element,(e=>{const t=e.getRootNode();return!!(t&&t instanceof ShadowRoot&&"HUI-PANEL-VIEW"===t.host.tagName)})(this._element),"panel"),of(this._element,!0,"tabindex","0"),this._api.getFullscreenManager().connect(),this._element.addEventListener("mousemove",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("wheel",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("ll-custom",this._api.getActionsManager().handleCustomActionEvent),this._element.addEventListener("action",this._api.getActionsManager().handleInteractionEvent),this._element.addEventListener("action",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("frigate-card:action:execution-request",this._api.getActionsManager().handleActionExecutionRequestEvent),window.addEventListener("location-changed",this._api.getQueryStringManager().requestExecution),window.addEventListener("popstate",this._api.getQueryStringManager().requestExecution),this._api.getQueryStringManager().requestExecution(),this._element.requestUpdate()}elementDisconnected(){of(this._element,!1,"panel"),of(this._element,!1,"tabindex"),this._api.getMediaLoadedInfoManager().clear(),this._api.getFullscreenManager().disconnect(),this._api.getKeyboardStateManager().uninitialize(),this._api.getActionsManager().uninitialize(),this._api.getDefaultManager().uninitialize(),this._api.getHASSManager().getStateWatcher()?.unsubscribe(this.update),this._api.getInitializationManager().uninitialize(Wb.CAMERAS),this._api.getCameraManager().reset(),this._element.removeEventListener("mousemove",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("wheel",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("ll-custom",this._api.getActionsManager().handleCustomActionEvent),this._element.removeEventListener("action",this._api.getActionsManager().handleInteractionEvent),this._element.removeEventListener("action",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("frigate-card:action:execution-request",this._api.getActionsManager().handleActionExecutionRequestEvent),window.removeEventListener("location-changed",this._api.getQueryStringManager().requestExecution),window.removeEventListener("popstate",this._api.getQueryStringManager().requestExecution)}}function Gb(e,t,n){return null==e?e:function(e,t,n,a){if(!hh(e))return e;for(var i=-1,r=(t=sv(t,e)).length,o=r-1,s=e;null!=s&&++i{Gb(e,t,n)},Xb=(e,t,n)=>fv(e,t,n),Jb=(e,t)=>{!function(e,t){null==e||Yb(e,t)}(e,t)},ew=e=>u_(e),tw=(e,t)=>e.replace("#",`[${t.toString()}]`),nw=function(e){let t=!1;for(let n=0;n{const i=Xb(e,t);if(void 0===i)return!1;const r=a?.transform?a.transform(i):i;return!(t===n&&Dv(i,r)||(null===r?a?.keepOriginal||(Jb(e,t),0):void 0===r||(a?.keepOriginal||Jb(e,t),Kb(e,n,r),0)))})(a,e,t,n)}},rw=function(e,t,n){return function(a){let i=iw(e,t,n)(a);return i=cw(bs,iw(e,t,n),(e=>e.overrides))(a)||i,i}},ow=function(e,t){return rw(e,e,{transform:t})},sw=function(e){return rw(e,e,{transform:e=>null})},cw=function(e,t,n){return function(a){let i=!1;const r=Xb(a,e);return Array.isArray(r)&&r.forEach((e=>{const a=n?n(e):e;a&&"object"==typeof a&&(i=t(a)||i)})),i}},lw=(e,t)=>{const n=a=>{let i=!1;if(a&&"object"==typeof a){const r=t?t(a):a;r&&(i=e(r)||i),Array.isArray(a)?a.forEach((e=>{i=n(e)||i})):Object.keys(a).forEach((e=>{i=n(a[e])||i}))}return i};return n},dw=e=>!("object"!=typeof e||!e||void 0===e.mediaLoaded)&&(e.media_loaded=e.mediaLoaded,delete e.mediaLoaded,!0),uw=e=>{if("object"!=typeof e||!e||"object"!=typeof e.conditions||!e.conditions)return!1;const t=e.conditions,n=[];if(void 0!==t.view&&n.push({condition:"view",views:t.view}),void 0!==t.fullscreen&&n.push({condition:"fullscreen",fullscreen:t.fullscreen}),void 0!==t.expand&&n.push({condition:"expand",expand:t.expand}),void 0!==t.camera&&n.push({condition:"camera",cameras:t.camera}),void 0!==t.media_loaded&&n.push({condition:"media_loaded",media_loaded:t.media_loaded}),void 0!==t.state&&Array.isArray(t.state))for(const e of t.state)"object"!=typeof e||!e||void 0===e.state&&void 0===e.state_not&&void 0===e.entity||n.push({condition:"state",...e.state&&{state:e.state},...e.state_not&&{state_not:e.state_not},...e.entity&&{entity:e.entity}});return void 0!==t.media_query&&n.push({condition:"screen",media_query:t.media_query}),!!n.length&&(e.conditions=n,!0)},hw=e=>!("object"!=typeof e||!e||"call-service"!==e.action||"string"!=typeof e.service)&&(e.action="perform-action",e.perform_action=e.service,delete e.service,!0),pw=e=>!("object"!=typeof e||!e||"call-service"!==e.action||void 0===e.service||void 0===e.service_data||void 0!==e.data)&&(e.data=e.service_data,delete e.service_data,!0),mw=e=>!("object"!=typeof e||!e||"custom:frigate-card-action"!==e.action||"frigate_ui"!==e.frigate_card_action)&&(e.frigate_card_action="camera_ui",!0),gw=[cw(bs,dw,(e=>e.conditions)),e=>lw(dw,(e=>e.conditions))("object"==typeof e&&e?e[Ii]:{}),rw("event_gallery",or),rw("menu.buttons.frigate_ui",is),e=>lw(mw)("object"==typeof e&&e?e:{}),cw(Ca,ow("live_provider",(e=>"frigate-jsmpeg"===e?"jsmpeg":e))),rw("live.jsmpeg",ki),rw("live.image",Ci),rw("live.webrtc_card",Si),cw(Ca,rw("frigate.zone","frigate.zones",{transform:e=>Wg(e)})),cw(Ca,rw("frigate.label","frigate.labels",{transform:e=>Wg(e)})),e=>lw(pw)("object"==typeof e&&e?e:{}),function(e){if("object"!=typeof e||!e||!(Ii in e)||!Array.isArray(e[Ii]))return!1;let t=!1;const n=n=>{if(!t){if(!fv(e,"live.controls.ptz")){const{type:t,...a}=n;Gb(e,"live.controls.ptz",a)}t=!0}},a=e=>{const t=[];for(const i of e)if("custom:frigate-card-ptz"===i.type)n(i);else if("conditional"!==i.type&&"custom:frigate-card-conditional"!==i.type||!Array.isArray(i.elements))t.push(i);else{const e=a(i.elements);e.length&&(i.elements=e,t.push(i))}return t},i=a(e[Ii]);return t&&(i.length?e[Ii]=i:delete e[Ii]),t},rw("view.timeout_seconds",Ri),ow("live.lazy_unload",(e=>"all"===e?["unselected","hidden"]:"never"===e?null:Wg(e))),ow("live.auto_play",(e=>"all"===e?null:"never"===e?[]:Wg(e))),ow("live.auto_pause",(e=>"all"===e?["unselected","hidden"]:"never"===e?null:Wg(e))),ow("live.auto_mute",(e=>"all"===e?null:"never"===e?[]:Wg(e))),ow("live.auto_unmute",(e=>"all"===e?["selected","visible","microphone"]:"never"===e?null:Wg(e))),ow("media_viewer.auto_play",(e=>"all"===e?null:"never"===e?[]:Wg(e))),ow("media_viewer.auto_pause",(e=>"all"===e?null:"never"===e?[]:Wg(e))),ow("media_viewer.auto_mute",(e=>"all"===e?null:"never"===e?[]:Wg(e))),ow("media_viewer.auto_unmute",(e=>"all"===e?["selected","visible"]:"never"===e?null:Wg(e))),rw("live.controls.thumbnails.media",io),rw("timeline.media",Ho),rw("live.controls.timeline.media",po),rw("media_viewer.controls.timeline.media",Rr),rw("view.scan",Xi),rw("view.triggers.enabled",ar,{transform:e=>!0===e?"live":null,keepOriginal:!0}),rw("view.triggers.enabled",er,{transform:e=>!0!==e&&null}),rw("view.triggers.untrigger_reset",ir,{transform:e=>e?"default":null}),rw("live.layout",Ai),sw("media_viewer.layout"),sw("image.layout"),cw(bs,uw),e=>lw(uw)("object"==typeof e&&e?e[Ii]:{}),e=>lw(uw)("object"==typeof e&&e?e.automations:{}),cw(Ca,rw("hide","capabilities",{transform:e=>!0===e?{disable_except:["substream"]}:null})),rw("performance.profile",$s,{transform:e=>"low"===e?["low-performance"]:null}),cw(bs,iw("overrides","merge")),rw("live.controls.ptz",zi,{transform:e=>{if("object"!=typeof e||!e)return;const t=["data_left","data_right","data_up","data_down","data_zoom_in","data_zoom_out","service"],n=["actions_left","actions_right","actions_up","actions_down","actions_zoom_in","actions_zoom_out"],a=[...t,...n,"data_home","actions_home"];if(!Object.keys(e).some((e=>a.includes(e))))return;const i={};t.filter((t=>t in e)).reduce(((t,n)=>(t[n]=e[n],t)),i),n.filter((t=>t in e)).reduce(((t,n)=>("object"==typeof e[n]&&"tap_action"in e[n]&&(t[n]=e[n].tap_action),t)),i);const r=()=>{i.presets="presets"in e&&"object"==typeof e.presets&&e.presets?e.presets:{}};return"actions_home"in e&&"object"==typeof e.actions_home&&e.actions_home&&"tap_action"in e.actions_home?(r(),i.presets.home=e.actions_home.tap_action):"data_home"in e&&"object"==typeof e.data_home&&e.data_home&&"string"==typeof e.service&&(r(),i.presets.service=e.service,i.presets.data_home=e.data_home),i},keepOriginal:!0}),ow("live.controls.ptz",(e=>{if("object"!=typeof e||!e)return e;const t=["mode","position","orientation","hide_pan_tilt","hide_zoom","hide_home","style"],n=Object.keys(e);return n.some((e=>!t.includes(e)))?n.filter((e=>t.includes(e))).reduce(((t,n)=>(t[n]=e[n],t)),{}):void 0})),rw("view.update_cycle_camera",Wi),rw("view.update_force",Qi,{transform:e=>!0===e?"all":null}),rw("view.update_seconds",Gi),rw("view.update_entities",Yi),iw("live.controls.title",ds,{transform:e=>"object"==typeof e&&e&&"string"==typeof e.mode?"none"===e.mode?{style:"none"}:e.mode.includes("bottom")?{position:"bottom"}:e.mode.includes("top")?{position:"top"}:null:null}),sw("live.controls.title"),sw("media_viewer.controls.title"),e=>lw(hw)("object"==typeof e&&e?e:{}),rw("dimensions.max_height",ys),sw("dimensions.min_height")];class fw extends zs{}class _w extends Event{constructor(e,t){super("frigate-card:conditions:evaluate",t),this.conditions=e}}function vw(e,t,n){let a=ew(t),i=!1;if(n?.configOverrides)for(const t of n.configOverrides)e.evaluateConditions(t.conditions,n?.stateOverrides)&&(t.delete?.forEach((e=>{Jb(a,e)})),Object.keys(t.set??{}).forEach((e=>{Kb(a,e,t.set?.[e])})),Object.keys(t.merge??{}).forEach((e=>{Kb(a,e,Ly({},Xb(a,e),t.merge?.[e]))})),i=!0);if(!i)return t;if(n?.configOverrides?.some((e=>e.delete?.length))&&(a=hf(a)),n?.schema){const e=n.schema.safeParse(a);if(!e.success)throw new fw(V_("error.invalid_configuration_override"),[e.error.errors,a]);return e.data}return a}class yw{constructor(e,t){this._state={},this._epoch=this._createEpoch(),this._hasHAStateConditions=!1,this._mediaQueries=[],this._mediaQueryTrigger=()=>this._triggerChange(),this._api=e,this._listeners=[()=>this._api.getConfigManager().computeOverrideConfig(),()=>this._api.getAutomationsManager().execute(),...t?[t]:[]]}removeConditions(){this._mediaQueries.forEach((e=>e.removeEventListener("change",this._mediaQueryTrigger))),this._mediaQueries=[]}setConditionsFromConfig(){this.removeConditions();const e=(()=>{const e=this._api.getConfigManager().getConfig(),t=[];e?.overrides?.forEach((e=>t.push(...e.conditions))),e?.automations?.forEach((e=>t.push(...e.conditions)));const n=e=>{const a=vl.safeParse(e);a.success?(t.push(...a.data.conditions),a.data.elements?.forEach(n)):e&&"object"==typeof e&&Object.keys(e).forEach((t=>n(e[t])))};return e?.elements?.forEach(n),t})();this._hasHAStateConditions=e.some((e=>!e.condition||["state","numeric_state","user"].includes(e.condition))),e.forEach((e=>{if("screen"===e.condition){const t=window.matchMedia(e.media_query);t.addEventListener("change",this._mediaQueryTrigger),this._mediaQueries.push(t)}}))}setState(e){Object.keys(e).every((t=>Dv(e[t],this._state[t])))||(this._state={...this._state,...e},this._triggerChange())}getState(){return this._state}hasHAStateConditions(){return this._hasHAStateConditions}getEpoch(){return this._epoch}evaluateConditions(e,t){return e.every((e=>this._evaluateCondition(e,t)))}_evaluateCondition(e,t){const n={...this._state,...t};switch(e.condition){case void 0:case"state":return!!n.state&&(!e.state&&!e.state_not||e.entity in n.state&&(!e.state||(Array.isArray(e.state)?e.state.includes(n.state[e.entity].state):e.state===n.state[e.entity].state))&&(!e.state_not||(Array.isArray(e.state_not)?!e.state_not.includes(n.state[e.entity].state):e.state_not!==n.state[e.entity].state)));case"view":return!!n?.view&&e.views.includes(n.view);case"fullscreen":return void 0!==n.fullscreen&&e.fullscreen===n.fullscreen;case"expand":return void 0!==n.expand&&e.expand===n.expand;case"camera":return!!n.camera&&e.cameras.includes(n.camera);case"numeric_state":return!!n.state&&e.entity in n.state&&void 0!==n.state[e.entity].state&&(void 0===e.above||Number(n.state[e.entity].state)>e.above)&&(void 0===e.below||Number(n.state[e.entity].state)n.triggered?.has(e)));case"interaction":return void 0!==n.interaction&&e.interaction===n.interaction;case"microphone":return!(void 0!==e.connected&&n.microphone?.connected!==e.connected||void 0!==e.muted&&n.microphone?.muted!==e.muted);case"key":return!(!n.keys||!(e.key in n.keys)||(e.state??"down")!==n.keys[e.key].state||void 0!==e.ctrl&&e.ctrl!==!!n.keys[e.key].ctrl||void 0!==e.alt&&e.alt!==!!n.keys[e.key].alt||void 0!==e.meta&&e.meta!==!!n.keys[e.key].meta||void 0!==e.shift&&e.shift!==!!n.keys[e.key].shift)}}_createEpoch(){return{manager:this}}_triggerChange(){this._epoch=this._createEpoch(),this._listeners.forEach((e=>e()))}}const bw={casting:{[Qr]:!1,[Sr]:!1,[es]:"none",[`${os}.enabled`]:!0,[`${ss}.enabled`]:!0,[`${rs}.enabled`]:!1,[`${cs}.enabled`]:!1,[Zr]:["selected","visible"],[vs]:"static",[_s]:"16:9",[$i]:1,[$o]:!0},"low-performance":{[ro]:"none",[Ar]:"none",[Uo]:"none",[fo]:!1,[Nr]:!1,[Bo]:!1,[Wr]:[],[mr]:[],[gr]:[],[fr]:[],[ko]:["unselected","hidden"],[Co]:!1,[xr]:!1,[Eo]:"none",[kr]:"none",[$o]:!1,[Er]:"chevrons",[hs]:"none",[es]:"outside",[`${as}.enabled`]:!1,[`${ls}.enabled`]:!1,[`${ls}.enabled`]:!1,[`${cs}.enabled`]:!1,[lr]:!1,[dr]:!1,[ur]:!1,[cr]:!1,[co]:!1,[lo]:!1,[uo]:!1,[so]:!1,[Ir]:!1,[Tr]:!1,[jr]:!1,[zr]:!1,[Qo]:!1,[Go]:!1,[Yo]:!1,[Zo]:!1,[xs]:!1,[Cs]:10,[Es]:!1,[Ss]:!1,[Mr]:!1,[Ei]:!1,[Mi]:"image",[$i]:10,[ar]:"none",[Ms]:1},scrubbing:{[mo]:"below",[_o]:"ribbon",[go]:"seek",[Pr]:"below",[Fr]:"ribbon",[Lr]:"seek"}},ww=(e,t,n)=>{const a=Ds(Nd).safeParse(e);if(!a.success)return t;const i=a.data;for(const e of n??[])e in bw&&Object.entries(bw[e]).forEach((([e,n])=>{return r=n,void(void 0===Xb(i,a=e)&&Kb(t,a,r));var a,r}));return t},xw=e=>{switch(e){case"ptz_left":return"left";case"ptz_right":return"right";case"ptz_up":return"up";case"ptz_down":return"down";case"ptz_zoom_in":return"zoom_in";case"ptz_zoom_out":return"zoom_out"} +/* istanbul ignore next: No (current) way to reach this code -- @preserve */return null},Cw=(e,t)=>{if(!t.enabled)return[];const n=[];for(const a of["ptz_down","ptz_left","ptz_right","ptz_up","ptz_zoom_in","ptz_zoom_out"]){const i=t[a],r=xw(a);i&&r&&(n.push({conditions:[{condition:"key",key:i.key,state:"down",shift:i.shift,ctrl:i.ctrl,alt:i.alt,meta:i.meta}],actions:[vf({ptzAction:r,ptzPhase:"start"})],tag:e}),n.push({conditions:[{condition:"key",key:i.key,state:"up"}],actions:[vf({ptzAction:r,ptzPhase:"stop"})],tag:e}))}const a=t.ptz_home;return a&&n.push({conditions:[{condition:"key",key:a.key,state:"down",shift:a.shift,ctrl:a.ctrl,alt:a.alt,meta:a.meta}],actions:[vf()],tag:e}),n};class Mw{constructor(e){this._config=null,this._overriddenConfig=null,this._rawConfig=null,this._cardWideConfig=null,this._api=e}hasConfig(){return!!this.getConfig()}getConfig(){return this._overriddenConfig??this._config}getCardWideConfig(){return this._cardWideConfig}getNonOverriddenConfig(){return this._config}getRawConfig(){return this._rawConfig}setConfig(e){if(!e)throw new Error(V_("error.invalid_configuration"));const t=Nd.safeParse(e);if(!t.success){const n=aw(e),a=Ps(t.error);let i="";throw n&&(i=`${V_("error.upgrade_available")}. `),new Error(i+`${V_("error.invalid_configuration")}: `+(a&&a.size?JSON.stringify([...a],null," "):V_("error.invalid_configuration_no_hint")))}const n=ww(e,t.data,t.data.profiles);var a;(this._rawConfig=e,Dv(this._config,n))||(this._config=n,this._cardWideConfig={performance:n.performance,debug:n.debug},this._api.getConditionsManager().setConditionsFromConfig(),this._api.getConditionsManager().setState({view:void 0,displayMode:void 0,camera:void 0}),this._api.getMediaLoadedInfoManager().clear(),this._api.getInitializationManager().uninitialize(Wb.VIEW),this._api.getViewManager().reset(),this._api.getMessageManager().reset(),this._api.getStyleManager().setPerformance(),this._api.getStatusBarItemManager().removeAllDynamicStatusBarItems(),((e,t)=>{e.getAutomationsManager().deleteAutomations(t);const n=e.getConfigManager().getConfig()?.view.keyboard_shortcuts;if(!n)return;const a=Cw(t,n);a.length&&e.getAutomationsManager().addAutomations(a)})(this._api,this),(a=this._api).getAutomationsManager().deleteAutomations(),a.getAutomationsManager().addAutomations(a.getConfigManager().getNonOverriddenConfig()?.automations??[]),this.computeOverrideConfig(),this._api.getCardElementManager().update())}computeOverrideConfig(){const e=this._api.getConditionsManager();if(!this._config)return;let t=null;try{t=vw(e,this._config,{configOverrides:this._config.overrides,schema:Nd})}catch(e){return void this._api.getMessageManager().setErrorIfHigherPriority(e)}if(Dv(t,this._overriddenConfig))return;const n=this._overriddenConfig;this._overriddenConfig=t,this._api.getStyleManager().setMinMaxHeight(),!n||Dv(n?.cameras,this._overriddenConfig?.cameras)&&Dv(n?.cameras_global,this._overriddenConfig?.cameras_global)||this._api.getInitializationManager().uninitialize(Wb.CAMERAS),n&&n?.live.microphone.always_connected!==this._overriddenConfig?.live.microphone.always_connected&&this._api.getInitializationManager().uninitialize(Wb.MICROPHONE_CONNECT),this._initializeBackground(n)}async _initializeBackground(e){await this._api.getDefaultManager().initializeIfNecessary(e),await this._api.getMediaPlayerManager().initializeIfNecessary(e),this._api.getCardElementManager().update()}}class kw{constructor(e){this._timer=new xf,this._stateChangeHandler=()=>{this._setToDefaultIfAllowed()},this._api=e}async initializeIfNecessary(e){Dv(e?.view.default_reset,this._api.getConfigManager().getConfig()?.view.default_reset)||await this.initialize()}async initialize(){this.uninitialize();const e=this._api.getConfigManager().getConfig()?.view.default_reset;e?.entities.length&&this._api.getHASSManager().getStateWatcher().subscribe(this._stateChangeHandler,e.entities);const t=this._api.getConfigManager().getConfig()?.view.default_reset.every_seconds;return t&&this._timer.startRepeated(t,(()=>this._setToDefaultIfAllowed())),this._api.getConfigManager().getConfig()?.view.default_reset.after_interaction&&this._api.getAutomationsManager().addAutomations([{actions:[gf("default")],conditions:[{condition:"interaction",interaction:!1}],tag:this}]),!0}uninitialize(){this._timer.stop(),this._api.getHASSManager().getStateWatcher().unsubscribe(this._stateChangeHandler),this._api.getAutomationsManager().deleteAutomations(this)}_setToDefaultIfAllowed(){this._isAutomatedUpdateAllowed()&&this._api.getViewManager().setViewDefault()}_isAutomatedUpdateAllowed(){const e=this._api.getConfigManager().getConfig()?.view.default_reset.interaction_mode;return!!e&&((e,t)=>{switch(e){case"all":return!0;case"active":return t;case"inactive":return!t}})(e,this._api.getInteractionManager().hasInteraction())}}const Sw=(e,t="download")=>{const n=new URL(e).origin===window.location.origin,a=e.startsWith("data:");if(navigator.userAgent.startsWith("Home Assistant/")||navigator.userAgent.startsWith("HomeAssistant/")||!n&&!a)window.open(e,"_blank");else{const n=document.createElement("a");n.setAttribute("download",t),n.href=e,n.click(),n.remove()}},Ew=async(e,t,n)=>{const a=await t.getMediaDownloadPath(n);if(!a)throw new zs(V_("error.download_no_media"));let i=a.endpoint;if(a.sign){let t;try{t=await Ib(e,a.endpoint)}catch(e){Gg(e)}if(!t)throw new zs(V_("error.download_sign_failed"));i=t}Sw(i)},$w=e=>{const t=document.createElement("canvas");t.width=e.videoWidth,t.height=e.videoHeight;const n=t.getContext("2d");return n?(n.drawImage(e,0,0,t.width,t.height),t.toDataURL("image/jpeg")):null};class Aw{constructor(e){this._api=e}async downloadViewerMedia(){const e=this._api.getViewManager().getView()?.queryResults?.getSelectedResult(),t=this._api.getHASSManager().getHASS();if(!e||!t)return!1;try{await Ew(t,this._api.getCameraManager(),e)}catch(e){return this._api.getMessageManager().setErrorIfHigherPriority(e),!1}return!0}async downloadScreenshot(){const e=await(this._api.getMediaLoadedInfoManager().get()?.player?.getScreenshotURL());e&&Sw(e,(e=>{if(e?.is("live")||e?.is("image"))return`${e.view}-${e.camera}-${Wu(new Date,"yyyy-MM-dd-HH-mm-ss")}.jpg`;if(e?.isViewerView()){const t=e.queryResults?.getSelectedResult(),n=t?.getID()??null;return`${e.view}-${e.camera}${n?`-${n}`:""}.jpg`}return"screenshot.jpg"})(this._api.getViewManager().getView()))}}class zw{constructor(e){this._expanded=!1,this._api=e}initialize(){this._setConditionState()}isExpanded(){return this._expanded}toggleExpanded(){this.setExpanded(!this._expanded)}setExpanded(e){e&&this._api.getFullscreenManager().isInFullscreen()&&this._api.getFullscreenManager().stopFullscreen(),this._expanded=e,this._setConditionState(),this._api.getCardElementManager().update()}_setConditionState(){this._api.getConditionsManager()?.setState({expand:this._expanded})}}const Iw=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],Tw=(()=>{if("undefined"==typeof document)return!1;const e=Iw[0],t={};for(const n of Iw){const a=n?.[1];if(a in document){for(const[a,i]of n.entries())t[e[a]]=i;return t}}return!1})(),jw={change:Tw.fullscreenchange,error:Tw.fullscreenerror};let Ow={request:(e=document.documentElement,t)=>new Promise(((n,a)=>{const i=()=>{Ow.off("change",i),n()};Ow.on("change",i);const r=e[Tw.requestFullscreen](t);r instanceof Promise&&r.then(i).catch(a)})),exit:()=>new Promise(((e,t)=>{if(!Ow.isFullscreen)return void e();const n=()=>{Ow.off("change",n),e()};Ow.on("change",n);const a=document[Tw.exitFullscreen]();a instanceof Promise&&a.then(n).catch(t)})),toggle:(e,t)=>Ow.isFullscreen?Ow.exit():Ow.request(e,t),onchange(e){Ow.on("change",e)},onerror(e){Ow.on("error",e)},on(e,t){const n=jw[e];n&&document.addEventListener(n,t,!1)},off(e,t){const n=jw[e];n&&document.removeEventListener(n,t,!1)},raw:Tw};Object.defineProperties(Ow,{isFullscreen:{get:()=>Boolean(document[Tw.fullscreenElement])},element:{enumerable:!0,get:()=>document[Tw.fullscreenElement]??void 0},isEnabled:{enumerable:!0,get:()=>Boolean(document[Tw.fullscreenEnabled])}}),Tw||(Ow={isEnabled:!1});var Dw=Ow;class Rw{constructor(e){this._fullscreenHandler=()=>{this._api.getExpandManager().setExpanded(!1),this._setConditionState(),this._api.getCardElementManager().update()},this._api=e}initialize(){this._setConditionState()}connect(){Dw.isEnabled&&Dw.on("change",this._fullscreenHandler)}disconnect(){Dw.isEnabled&&Dw.off("change",this._fullscreenHandler)}isInFullscreen(){return Dw.isEnabled&&Dw.isFullscreen}toggleFullscreen(){Dw.toggle(this._api.getCardElementManager().getElement())}stopFullscreen(){Dw.exit()}_setConditionState(){this._api.getConditionsManager()?.setState({fullscreen:this.isInFullscreen()})}}class Pw{constructor(){this._watcherCallbacks=new Map}setHASS(e,t){if(e)for(const[n,a]of this._watcherCallbacks.entries()){const i=Tb(t,e,a,{stateOnly:!0,firstOnly:!0});i.length&&n(i[0])}}subscribe(e,t){return!!t.length&&(this._watcherCallbacks.has(e)?this._watcherCallbacks.get(e)?.push(...t):this._watcherCallbacks.set(e,t),!0)}unsubscribe(e){this._watcherCallbacks.delete(e)}}class Lw{constructor(e){this._hass=null,this._stateWatcher=new Pw,this._api=e}getHASS(){return this._hass}hasHASS(){return!!this._hass}getStateWatcher(){return this._stateWatcher}setHASS(e){if(((e,t)=>e?.connected!==t?.connected)(this._hass,e)&&(e?.connected?this._api.getMessageManager().resetType("connection"):this._api.getMessageManager().setMessageIfHigherPriority({message:V_("error.reconnecting"),icon:"mdi:lan-disconnect",type:"connection",dotdotdot:!0})),!e)return;const t=this._hass;this._hass=e,this._api.getConditionsManager().hasHAStateConditions()&&this._api.getConditionsManager().setState({state:this._hass.states,user:this._hass.user}),this._api.getStyleManager().setLightOrDarkMode(),this._stateWatcher.setHASS(t,e)}}var Nw=function(){return th.Date.now()},Fw="Expected a function",Vw=Math.max,Hw=Math.min;function Bw(e,t,n){var a,i,r,o,s,c,l=0,d=!1,u=!1,h=!0;if("function"!=typeof e)throw new TypeError(Fw);function p(t){var n=a,r=i;return a=i=void 0,l=t,o=e.apply(r,n)}function m(e){var n=e-c;return void 0===c||n>=t||n<0||u&&e-l>=r}function g(){var e=Nw();if(m(e))return f(e);s=setTimeout(g,function(e){var n=t-(e-c);return u?Hw(n,r-(e-l)):n}(e))}function f(e){return s=void 0,h&&a?p(e):(a=i=void 0,o)}function _(){var e=Nw(),n=m(e);if(a=arguments,i=this,c=e,n){if(void 0===s)return function(e){return l=e,s=setTimeout(g,t),d?p(e):o}(c);if(u)return clearTimeout(s),s=setTimeout(g,t),p(c)}return void 0===s&&(s=setTimeout(g,t)),o}return t=Cg(t)||0,hh(n)&&(d=!!n.leading,r=(u="maxWait"in n)?Vw(Cg(n.maxWait)||0,t):r,h="trailing"in n?!!n.trailing:h),_.cancel=function(){void 0!==s&&clearTimeout(s),l=0,a=c=i=s=void 0},_.flush=function(){return void 0===s?o:f(Nw())},_}function qw(e,t,n){var a=!0,i=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return hh(n)&&(a="leading"in n?!!n.leading:a,i="trailing"in n?!!n.trailing:i),Bw(e,t,{leading:a,maxWait:t,trailing:i})}class Uw{constructor(e){this._timer=new xf,this.reportInteraction=qw((()=>{this._reportInteraction()}),1e3),this._api=e}initialize(){this._api.getConditionsManager().setState({interaction:!1})}hasInteraction(){return this._timer.isRunning()}_reportInteraction(){this._timer.stop();const e=this._api.getConfigManager().getConfig()?.view.interaction_seconds;e&&(this._api.getConditionsManager().setState({interaction:!0}),this._timer.start(e,(()=>{this._api.getConditionsManager().setState({interaction:!1}),this._api.getStyleManager().setLightOrDarkMode()})))}}class Ww{constructor(e){this._state={},this._handleKeydown=e=>{const t={state:"down",ctrl:e.ctrlKey,alt:e.altKey,meta:e.metaKey,shift:e.shiftKey};Dv(this._state[e.key],t)||(this._state[e.key]=t,this._processStateChange())},this._handleKeyup=e=>{e.key in this._state&&"down"===this._state[e.key].state&&(this._state[e.key].state="up",this._processStateChange())},this._handleBlur=()=>{Object.keys(this._state).length&&(this._state={},this._processStateChange())},this._api=e}initialize(){const e=this._api.getCardElementManager().getElement();e.addEventListener("keydown",this._handleKeydown),e.addEventListener("keyup",this._handleKeyup),e.addEventListener("blur",this._handleBlur)}uninitialize(){const e=this._api.getCardElementManager().getElement();e.removeEventListener("keydown",this._handleKeydown),e.removeEventListener("keyup",this._handleKeyup),e.removeEventListener("blur",this._handleBlur)}_processStateChange(){this._api.getConditionsManager().setState({keys:this._state})}}function Zw(e,t){let n;return n=e instanceof Event?e.composedPath()[0]:e,n instanceof HTMLImageElement?{width:n.naturalWidth,height:n.naturalHeight,...t}:n instanceof HTMLVideoElement?{width:n.videoWidth,height:n.videoHeight,...t}:n instanceof HTMLCanvasElement?{width:n.width,height:n.height,player:t?.player,...t}:null}function Qw(e,t,n){const a=Zw(t,n);a&&Gw(e,a)}function Gw(e,t){Bg(e,"media:loaded",t)}function Yw(e){Bg(e,"media:unloaded")}function Kw(e){Bg(e,"media:volumechange")}function Xw(e){Bg(e,"media:play")}function Jw(e){Bg(e,"media:pause")}class ex{constructor(e){this._current=null,this._lastKnown=null,this._api=e}initialize(){this.clear()}set(e){var t;(t=e).height>=50&&t.width>=50&&(B_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card media load: ",e),this._current=e,this._lastKnown=e,this._api.getConditionsManager().setState({media_loaded:!0}),this._api.getStyleManager().setExpandedMode(),this._api.getCardElementManager().update())}get(){return this._current}getLastKnown(){return this._lastKnown}clear(){this._current=null,this._api.getConditionsManager().setState({media_loaded:!1})}has(){return!!this._current}}class tx{static isEvent(e){return this.isClip(e)||this.isSnapshot(e)}static isRecording(e){return"recording"===e.getMediaType()}static isClip(e){return"clip"===e.getMediaType()}static isSnapshot(e){return"snapshot"===e.getMediaType()}static isVideo(e){return this.isClip(e)||this.isRecording(e)}}class nx{constructor(e){this._mediaPlayers=[],this._api=e}getMediaPlayers(){return this._mediaPlayers}hasMediaPlayers(){return this._mediaPlayers.length>0}async initializeIfNecessary(e){e?.menu.buttons.media_player.enabled!==this._api.getConfigManager().getConfig()?.menu.buttons.media_player.enabled&&await this.initialize()}async initialize(){const e=this._api.getHASSManager().getHASS();if(!e||!this._api.getConfigManager().getConfig()?.menu.buttons.media_player.enabled)return!1;const t=Object.keys(e.states).filter((t=>{if(t.startsWith("media_player.")){const n=e.states[t];if(n&&"unavailable"!==n.state&&vb(n,131072))return!0}return!1}));let n=null;try{n=await this._api.getEntityRegistryManager().getEntities(e,t)}catch(e){Gg(e)}return this._mediaPlayers=t.filter((e=>{const t=n?.get(e);return!t||!t.hidden_by})),!0}async stop(e){const t=this._api.getHASSManager().getHASS(),n=t?.states[e];if(!n)return;let a;if(vb(n,4096))a="media_stop";else{if(!vb(n,256))return;a="turn_off"}await t.callService("media_player",a,{entity_id:e})}async playLive(e,t){const n=this._api.getCameraManager().getStore().getCameraConfig(t);n&&("dashboard"===n.cast?.method?await this._playLiveDashboard(e,n):await this._playLiveStandard(e,t,n))}async _playLiveStandard(e,t,n){const a=this._api.getHASSManager().getHASS(),i=n?.camera_entity??null;if(!a||!i)return;const r=this._api.getCameraManager().getCameraMetadata(t)?.title??null,o=a.states[i]?.attributes?.entity_picture??null;await a.callService("media_player","play_media",{entity_id:e,media_content_id:`media-source://camera/${i}`,media_content_type:"application/vnd.apple.mpegurl",extra:{...r&&{title:r},...o&&{thumb:o}}})}async _playLiveDashboard(e,t){const n=this._api.getHASSManager().getHASS();if(!n)return;const a=t.cast?.dashboard;a?.dashboard_path&&a?.view_path?await n.callService("cast","show_lovelace_view",{entity_id:e,dashboard_path:a.dashboard_path,view_path:a.view_path}):this._api.getMessageManager().setMessageIfHigherPriority({type:"error",icon:"mdi:cast",message:V_("error.no_dashboard_or_view")})}async playMedia(e,t){const n=this._api.getHASSManager().getHASS();if(!n||!t)return;const a=t.getTitle(),i=t.getThumbnail();await n.callService("media_player","play_media",{entity_id:e,media_content_id:t.getContentID(),media_content_type:tx.isVideo(t)?"video":"image",extra:{...a&&{title:a},...i&&{thumb:i}}})}}class ax{constructor(e){this._message=null,this._api=e}getMessage(){return this._message}hasMessage(){return!!this._message}hasErrorMessage(){return"error"===this._message?.type}reset(){const e=this.hasMessage();this._message=null,e&&this._api.getCardElementManager().update()}resetType(e){this._message?.type===e&&this.reset()}setErrorIfHigherPriority(e,t){e&&"object"==typeof e&&"message"in e&&(Gg(e),this.setMessageIfHigherPriority({message:t?`${t}: ${e.message}`:e.message,type:"error",...e instanceof zs&&{context:e.context}}))}setMessageIfHigherPriority(e){const t=this._message?Is[this._message.type]:0,n=Is[e.type];return!(this._message&&ne.stop())),this._stream=void 0,this._setConditionState(),this._api.getCardElementManager().update()}getStream(){return this._stream??void 0}mute(){const e=this.isMuted();this._mute=!0,this._setMute(),this._setConditionState(),e||this._callListeners("muted")}async unmute(){if(!this.isSupported())return;const e=!this.isMuted(),t=()=>{this._mute=!1,this._setMute()};this.isConnected()||this.isForbidden()?this.isConnected()&&t():(t(),await this.connect()),this._setConditionState(),e||this._callListeners("unmuted")}isConnected(){return!!this._stream}isForbidden(){return null===this._stream}isMuted(){return!this._stream||this._stream.getTracks().every((e=>!e.enabled))}addListener(e){this._listeners.push(e)}removeListener(e){this._listeners=this._listeners.filter((t=>t!==e))}_callListeners(e){this._listeners.forEach((t=>t(e)))}_setMute(){this._stream?.getTracks().forEach((e=>{e.enabled=!this._mute})),this._startTimer(),this._api.getCardElementManager().update()}_startTimer(){const e=this._api.getConfigManager().getConfig()?.live.microphone;if(e?.always_connected)return;const t=e?.disconnect_seconds??0;t&&this._timer.start(t,(()=>{this.disconnect()}))}_setConditionState(){this._api.getConditionsManager().setState({microphone:{muted:this.isMuted(),connected:this.isConnected()}})}}class rx{constructor(e){this._shouldRun=!0,this.requestExecution=()=>{this._shouldRun=!0,this._api.getCardElementManager().update()},this.executeIfNecessary=async()=>{this._shouldRun&&(this._shouldRun=!1,await this._executeViewRelated(this._calculateIntent()),await this._executeNonViewRelated(this._calculateIntent()))},this._isViewAction=e=>{switch(e.frigate_card_action){case"clip":case"clips":case"diagnostics":case"image":case"live":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":return!0}return!1},this._api=e}hasViewRelatedActionsToRun(){return!!this._calculateIntent().view&&this._shouldRun}async _executeViewRelated(e){e.view&&(e.view.default?await this._api.getViewManager().setViewDefaultWithNewQuery({params:{camera:e.view.camera},...e.view.substream&&{modifiers:[new sb(e.view.substream)]}}):await this._api.getViewManager().setViewByParametersWithNewQuery({params:{...e.view.view&&{view:e.view.view},...e.view.camera&&{camera:e.view.camera}},...e.view.substream&&{modifiers:[new sb(e.view.substream)]}}))}async _executeNonViewRelated(e){e.other&&await this._api.getActionsManager().executeActions(e.other)}_calculateIntent(){const e={};for(const t of this._getActions())this._isViewAction(t)?((e.view??={}).view=t.frigate_card_action,(e.view??={}).default=void 0):"default"===t.frigate_card_action?((e.view??={}).default=!0,(e.view??={}).view=void 0):"camera_select"===t.frigate_card_action?(e.view??={}).camera=t.camera:"live_substream_select"===t.frigate_card_action?(e.view??={}).substream=t.camera:(e.other??=[]).push(t);return e}_getActions(){const e=new URLSearchParams(window.location.search),t=[],n=new RegExp(/^frigate-card-action([.:](?\w+))?[.:](?\w+)/);for(const[a,i]of e.entries()){const e=a.match(n);if(!e||!e.groups)continue;const r=e.groups.cardID,o=e.groups.action;let s=null;switch(o){case"camera_select":case"live_substream_select":i&&(s=ff(o,i,{cardID:r}));break;case"camera_ui":case"clip":case"clips":case"default":case"diagnostics":case"download":case"expand":case"image":case"live":case"menu_toggle":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":s=gf(o,{cardID:r});break;default:console.warn(`Frigate card received unknown card action in query string: ${o}`)}s&&t.push(s)}return t}}class ox{constructor(e){this._items=[],this._dynamicItems=[],this._api=e}addDynamicStatusBarItem(e){this._dynamicItems.includes(e)||this._dynamicItems.push(e),this._api.getCardElementManager().update()}removeDynamicStatusBarItem(e){this._dynamicItems=this._dynamicItems.filter((t=>!Dv(t,e))),this._api.getCardElementManager().update()}removeAllDynamicStatusBarItems(){this._dynamicItems=[],this._api.getCardElementManager().update()}calculateItems(e){const t=e?.view?e?.cameraManager?.getCameraMetadata(e?.view?.camera):null,n=t?.engineLogo??null,a=e?.view?.is("live")?t?.title??null:e?.view?.isViewerView()?e?.view.queryResults?.getSelectedResult()?.getTitle()??null:null,i=e?.mediaLoadedInfo?this._calculateResolution(e?.mediaLoadedInfo):null,r=e?.mediaLoadedInfo?.technology?.length?e?.mediaLoadedInfo.technology[0]:null;return[...a?[{type:"custom:frigate-card-status-bar-string",string:a,expand:!0,sufficient:!0,...e?.statusConfig?.items.title}]:[],...i?[{type:"custom:frigate-card-status-bar-string",string:i,...e?.statusConfig?.items.resolution}]:[],...r&&"webrtc"===r?[{type:"custom:frigate-card-status-bar-icon",icon:"mdi:webrtc",...e?.statusConfig?.items.technology}]:r?[{type:"custom:frigate-card-status-bar-string",string:r.toUpperCase(),...e?.statusConfig?.items.technology}]:[],...n?[{type:"custom:frigate-card-status-bar-image",image:n,...e?.statusConfig?.items.engine}]:[],...this._dynamicItems]}_matchesWidthHeight(e,t,n){const a=.99*t,i=1.01*t,r=.99*n,o=1.01*n,s=(e,t,n)=>e>=t&&e<=n;return!!e&&(s(e.width,a,i)&&s(e.height,r,o)||s(e.height,a,i)&&s(e.width,r,o))}_calculateResolution(e){return this._matchesWidthHeight(e,1920,1080)?"1080p":this._matchesWidthHeight(e,1280,720)?"720p":this._matchesWidthHeight(e,640,480)?"VGA":this._matchesWidthHeight(e,3840,2160)?"4K":this._matchesWidthHeight(e,720,480)?"480p":this._matchesWidthHeight(e,720,576)?"576p":this._matchesWidthHeight(e,7680,4320)?"8K":`${e.width}x${e.height}`}}class sx{constructor(e){this.setLightOrDarkMode=()=>{const e=this._api.getConfigManager().getConfig(),t="on"===e?.view.dark_mode||"auto"===e?.view.dark_mode&&(!this._api.getInteractionManager().hasInteraction()||!!this._api.getHASSManager().getHASS()?.themes.darkMode);of(this._api.getCardElementManager().getElement(),t,"dark")},this._api=e}setExpandedMode(){const e=this._api.getCardElementManager().getElement(),t=this._api.getViewManager().getView(),n=this._api.getMediaLoadedInfoManager().getLastKnown();e.style.setProperty("--frigate-card-expand-aspect-ratio",t?.isAnyMediaView()&&n?`${n.width} / ${n.height}`:"unset");const a=t?.isGrid();e.style.setProperty("--frigate-card-expand-width",!a&&t?.isAnyMediaView()?"none":"var(--frigate-card-expand-max-width)"),e.style.setProperty("--frigate-card-expand-height",!a&&t?.isAnyMediaView()?"none":"var(--frigate-card-expand-max-height)")}setMinMaxHeight(){const e=this._api.getConfigManager().getConfig();if(e){this._api.getCardElementManager().getElement().style.setProperty("--frigate-card-height",e.dimensions.height)}}setPerformance(){const e={box_shadow:"none",border_radius:"0px"},t=this._api.getCardElementManager().getElement(),n=this._api.getConfigManager().getCardWideConfig()?.performance,a=n?.style??{};for(const n of Object.keys(a)){const i=`--frigate-card-css-${n.replaceAll("_","-")}`;!1===a[n]?t.style.setProperty(i,e[n]):t.style.removeProperty(i)}}_isAspectRatioEnforced(e,t){const n=e.dimensions.aspect_ratio_mode;return!(this._api.getFullscreenManager().isInFullscreen()||this._api.getExpandManager().isExpanded()||"unconstrained"===n||"dynamic"===n&&(!t||t?.isAnyMediaView()||t?.is("timeline")||t?.is("diagnostics")))}getAspectRatioStyle(){const e=this._api.getConfigManager().getConfig(),t=this._api.getViewManager().getView();if(e){if(!this._isAspectRatioEnforced(e,t))return uf();const n=e.dimensions.aspect_ratio_mode,a=this._api.getMediaLoadedInfoManager().getLastKnown();return uf(a&&"dynamic"===n?{ratio:[a.width,a.height]}:{ratio:e.dimensions.aspect_ratio})}return uf({defaultStatic:!0})}}class cx{constructor(e){this._triggeredCameras=new Map,this._triggeredCameraTimers=new Map,this._throttledTriggerAction=qw(this._triggerAction.bind(this),1e3,{trailing:!0}),this._api=e}getTriggeredCameraIDs(){return new Set(this._triggeredCameras.keys())}isTriggered(){return!!this._triggeredCameras.size}getMostRecentlyTriggeredCameraID(){const e=Ev([...this._triggeredCameras.entries()],(e=>e[1].getTime()),"desc");return e.length?e[0][0]:null}async handleCameraEvent(e){const t=this._api.getConfigManager().getConfig()?.view.triggers,n=this._api.getViewManager().getView()?.camera;if(!t||!n)return;const a=this._api.getCameraManager().getStore().getAllDependentCameras(n);t.filter_selected_camera&&!a.has(e.cameraID)||("end"!==e.type?(this._triggeredCameras.set(e.cameraID,new Date),this._setConditionStateIfNecessary(),await this._throttledTriggerAction(e)):this._startUntriggerTimer(e.cameraID))}_hasAllowableInteractionStateForAction(){const e=this._api.getConfigManager().getConfig()?.view.triggers,t=this._api.getInteractionManager().hasInteraction();return!!e&&("all"===e.actions.interaction_mode||"active"===e.actions.interaction_mode&&t||"inactive"===e.actions.interaction_mode&&!t)}async _triggerAction(e){const t=this._api.getConfigManager().getConfig()?.view.triggers.actions.trigger,n=this._api.getConfigManager().getConfig()?.view.default;("high"!==e.fidelity||e.snapshot||e.clip||"live"===t||"default"===t&&"live"===n)&&(this._hasAllowableInteractionStateForAction()&&("update"===t?await this._api.getViewManager().setViewByParametersWithNewQuery({queryExecutorOptions:{useCache:!1}}):"live"===t?await this._api.getViewManager().setViewByParametersWithNewQuery({params:{view:"live",camera:e.cameraID}}):"default"===t?await this._api.getViewManager().setViewDefaultWithNewQuery({params:{camera:e.cameraID}}):"high"===e.fidelity&&"media"===t&&await this._api.getViewManager().setViewByParametersWithNewQuery({params:{view:e.clip?"clip":"snapshot",camera:e.cameraID}})),this._api.getCardElementManager().update())}_setConditionStateIfNecessary(){const e=new Set(this._triggeredCameras.keys()),t=e.size?e:void 0;Dv(t,this._api.getConditionsManager().getState().triggered)||this._api.getConditionsManager().setState({triggered:t})}async _untriggerAction(e){const t=this._api.getConfigManager().getConfig()?.view.triggers.actions.untrigger;"default"===t&&this._hasAllowableInteractionStateForAction()&&await this._api.getViewManager().setViewDefaultWithNewQuery(),this._triggeredCameras.delete(e),this._deleteTimer(e),this._setConditionStateIfNecessary(),this._api.getCardElementManager().update()}_startUntriggerTimer(e){this._deleteTimer(e);const t=new xf;this._triggeredCameraTimers.set(e,t),t.start( +/* istanbul ignore next: the case of config being null here cannot be + reached, as there's no way to have the untrigger call happen without + a config. -- @preserve */ +this._api.getConfigManager().getConfig()?.view.triggers.untrigger_seconds??0,(async()=>{await this._untriggerAction(e)}))}_deleteTimer(e){this._triggeredCameraTimers.get(e)?.stop(),this._triggeredCameraTimers.delete(e)}}function lx(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Hg(e,void 0,t):[]}class dx{constructor(e){this._queries=null,e&&(this._queries=e)}clone(){return u_(this)}getQueries(){return this._queries}setQueries(e){return this._queries=e,this}getQueryCameraIDs(){if(!this._queries)return null;const e=new Set;return this._queries.forEach((t=>[...t.cameraIDs].forEach((t=>e.add(t))))),e}setQueryCameraIDs(e){if(!this._queries)return this;const t=[];return this._queries.forEach((n=>t.push({...n,cameraIDs:Zg(e)}))),this._queries=lx(t,Dv),this}hasQueriesForCameraIDs(e){for(const t of e)if(!this._queries?.some((e=>e.cameraIDs.has(t))))return!1;return!0}}class ux extends dx{convertToClipsQueries(){for(const e of this._queries??[])delete e.hasSnapshot,e.hasClip=!0;return this}}class hx extends dx{}class px{static areEventQueries(e){return e instanceof ux}static areRecordingQueries(e){return e instanceof hx}static areClipsQueries(e){return this.areEventQueries(e)&&!!e?.getQueries()?.every((e=>e.hasClip))}static areSnapshotQueries(e){return this.areEventQueries(e)&&!!e?.getQueries()?.every((e=>e.hasSnapshot))}static getQueriesType(e){return this.areEventQueries(e)?"event":this.areRecordingQueries(e)?"recording":null}static getMediaType(e){return this.areClipsQueries(e)?"clips":this.areSnapshotQueries(e)?"snapshots":this.areRecordingQueries(e)?"recordings":null}}const mx=(e,t,n)=>{const a={anyCapabilities:["clips","snapshots","recordings"]};switch(t){case"image":case"diagnostics":return e.getStore().getCameraIDs();case"live":case"clip":case"clips":case"snapshot":case"snapshots":case"recording":case"recordings":const i="clip"===t?"clips":"snapshot"===t?"snapshots":"recording"===t?"recordings":t;return n?e.getStore().getAllDependentCameras(n,i):e.getStore().getCameraIDsWithCapability(i);case"timeline":return e.getStore().getCameraIDsWithCapability(a);case"media":return n?e.getStore().getAllDependentCameras(n,a):e.getStore().getCameraIDsWithCapability(a)}},gx=(e,t)=>Ly({},e,t);class fx{constructor(e){this.view=e.view,this.camera=e.camera,this.query=e.query??null,this.queryResults=e.queryResults??null,this.context=e.context??null,this.displayMode=e.displayMode??null}clone(){return new fx({view:this.view,camera:this.camera,query:this.query?.clone()??null,queryResults:this.queryResults?.clone()??null,context:this.context,displayMode:this.displayMode})}evolve(e){return new fx({view:void 0!==e.view?e.view:this.view,camera:void 0!==e.camera?e.camera:this.camera,query:void 0!==e.query?e.query:this.query?.clone()??null,queryResults:void 0!==e.queryResults?e.queryResults:this.queryResults?.clone()??null,context:void 0!==e.context?e.context:this.context,displayMode:void 0!==e.displayMode?e.displayMode:this.displayMode})}mergeInContext(e){return this.context=gx(this.context,e),this}removeContext(e){return this.context&&delete this.context[e],this}removeContextProperty(e,t){const n=this.context?.[e];return n&&delete n[t],this}is(e){return this.view==e}isGalleryView(){return["clips","snapshots","recordings"].includes(this.view)}isAnyMediaView(){return this.isViewerView()||this.is("live")||this.is("image")}isViewerView(){return["media","clip","snapshot","recording"].includes(this.view)}supportsMultipleDisplayModes(){return this.isViewerView()||this.is("live")}getDefaultMediaType(){return["clip","clips"].includes(this.view)?"clips":["snapshot","snapshots"].includes(this.view)?"snapshots":["recording","recordings"].includes(this.view)?"recordings":null}isGrid(){return"grid"===this.displayMode}}const _x=(e,t)=>{t?.forEach((t=>t.modify(e)))};class vx extends zs{}class yx extends zs{}class bx{constructor(e){this._api=e}getViewDefault(e){const t=this._api.getConfigManager().getConfig();if(!t)return null;let n=null;const a=e?.params?.view??t.view.default;if(e?.params?.camera)n=e.params.camera;else{const i=[...mx(this._api.getCameraManager(),a)];if(!i.length)return null;if(e?.baseView?.camera&&t.view.default_cycle_camera){const t=i.indexOf(e.baseView.camera);n=i[t+1>=i.length?0:t+1]}else n=i[0]}return this.getViewByParameters({params:{...e?.params,view:a,camera:n},baseView:e?.baseView})}getViewByParameters(e){const t=this._api.getConfigManager().getConfig();if(!t)return null;let n=e?.params?.camera??e?.baseView?.camera??null,a=e?.params?.view??e?.baseView?.view??t.view.default;const i=this._api.getCameraManager().getStore().getCameraIDs();if(!n||!i.has(n)){n=mx(this._api.getCameraManager(),a).keys().next().value??null}if(!n){const e=[...this._api.getCameraManager().getStore().getCameras()].reduce(((e,[t,n])=>{const a=n.getCapabilities()?.getRawCapabilities();return a&&(e[t]=a),e}),{});throw new vx(V_("error.no_supported_cameras"),{view:a,cameras_capabilities:e})}if(!this.isViewSupportedByCamera(n,a)){if(!e?.failSafe||!this.isViewSupportedByCamera(n,Qs)){const e=this._api.getCameraManager().getStore().getCamera(n)?.getCapabilities()?.getRawCapabilities();throw new yx(V_("error.no_supported_camera"),{view:a,camera:n,...e&&{camera_capabilities:e}})}a=Qs}const r=e?.params?.displayMode??e?.baseView?.displayMode??this._getDefaultDisplayModeForView(a,t),o={...e?.params,view:a,camera:n,displayMode:r},s=e?.baseView?e.baseView.evolve(o):new fx(o);return _x(s,e?.modifiers),s}isViewSupportedByCamera(e,t){return!!mx(this._api.getCameraManager(),t,e).size}_getDefaultDisplayModeForView(e,t){let n=null;switch(e){case"media":case"clip":case"recording":case"snapshot":n=t.media_viewer.display?.mode??null;break;case"live":n=t.live.display?.mode??null}return n??"single"}}class wx{constructor(e,t){this._key=e,this._property=t}modify(e){e.removeContextProperty(this._key,this._property)}}class xx{constructor(e){this._query=e?.query,this._queryResults=e?.queryResults}modify(e){void 0!==this._query&&(e.query=this._query),void 0!==this._queryResults&&(e.queryResults=this._queryResults)}}const Cx=(e,t,n)=>{let a;for(const[i,r]of e.entries()){const e=r.getStartTime(),o=r.getUsableEndTime();if(r.includesTime(t)&&e&&o){const t=o.getTime()-e.getTime();(!a||n&&a.cameraID!==n&&r.getCameraID()===n||t>a.duration&&(!n||a.cameraID!==n||r.getCameraID()===n))&&(a={index:i,duration:t,cameraID:r.getCameraID()})}}return a?a.index:null};class Mx{constructor(e){this._results=e?.results??[],this._selectedIndex=this._getInitialSelectedIndex(e)}_getInitialSelectedIndex(e){return null!=e?.selectedIndex?e.selectedIndex:e?.results&&e.results.length?e?.selectApproach&&"last"!==e?.selectApproach?0:e.results.length-1:null}clone(){return new Mx({results:this._results,selectedIndex:this._selectedIndex})}getResults(){return this._results}getSelectedIndex(){return this._selectedIndex}getResultsCount(){return this.getResults().length}hasResults(){return 0!==this.getResultsCount()}getResult(e){return void 0===e?null:this._results[e]}getSelectedResult(){const e=this.getSelectedIndex();return null!==e?this.getResult(e):null}hasSelectedResult(){return null!==this.getSelectedResult()}resetSelectedResult(){this._selectedIndex=null}selectIndex(e){(null===e||e>=0&&ee.getID()))),n=new Set(e._main.getResults()?.map((e=>e.getID())));return!(!t.size||!n.size||t.has(null)||n.has(null))&&((e,t)=>{for(const n of t)if(!e.has(n))return!1;return!0})(t,n)}getCameraIDs(){return new Set(this._cameras.keys())}getSlice(e){return e?this._cameras.get(e)??null:this._main}getResults(e){return this.getSlice(e)?.getResults()??null}getResultsCount(e){return this.getSlice(e)?.getResultsCount()??0}hasResults(e){return 0!==this.getSlice(e)?.getResultsCount()}getResult(e,t){return this.getSlice(t)?.getResult(e)??null}getSelectedIndex(e){return this.getSlice(e)?.getSelectedIndex()??null}getSelectedResult(e){return this.getSlice(e)?.getSelectedResult()??null}getMultipleSelectedResults(e){const t=[];if(!e||e.main){const e=this.getSelectedResult();e&&t.push(e)}const n=this._getCameraIDsFromCriteria(e);for(const e of n??[]){const n=this.getSelectedResult(e);n&&t.push(n)}return t}hasSelectedResult(e){return this.getSlice(e)?.hasSelectedResult()??!1}resetSelectedResult(e){return this.getSlice(e)?.resetSelectedResult(),this}getResultsTimestamp(){return this._resultsTimestamp}selectIndex(e,t){return this.getSlice(t)?.selectIndex(e),t||this.demoteMainSelectionToCameraSelection(),this}demoteMainSelectionToCameraSelection(){const e=this.getSelectedResult();if(e){const t=e.getCameraID();this.resetSelectedResult(t),this.selectResultIfFound((t=>t===e),{cameraID:t})}return this}promoteCameraSelectionToMainSelection(e){const t=this.getSelectedResult(e);return this.resetSelectedResult(),this.selectResultIfFound((e=>e===t)),this}_getCameraIDsFromCriteria(e){return e?.allCameras?this.getCameraIDs():e?.cameraID?new Set([e.cameraID]):null}selectResultIfFound(e,t){t&&!t?.main||(this._main.selectResultIfFound(e),this.demoteMainSelectionToCameraSelection());const n=this._getCameraIDsFromCriteria(t);for(const t of n??[])this.getSlice(t)?.selectResultIfFound(e);return this}selectBestResult(e,t){t&&!t.main||(this._main.selectBestResult(e),this.demoteMainSelectionToCameraSelection());const n=this._getCameraIDsFromCriteria(t);for(const t of n??[])this.getSlice(t)?.selectBestResult(e);return this}}class Sx{constructor(e){this._api=e}async executeDefaultEventQuery(e){const t=e?.eventsMediaType&&"all"!==e?.eventsMediaType?e.eventsMediaType:{anyCapabilities:["clips","snapshots"]},n=this._api.getCameraManager(),a=e?.cameraID?n.getStore().getAllDependentCameras(e.cameraID,t):n.getStore().getCameraIDsWithCapability(t);if(!a.size)return null;const i=n.generateDefaultEventQueries(a,{limit:this._getChunkLimit(),..."clips"===e?.eventsMediaType&&{hasClip:!0},..."snapshots"===e?.eventsMediaType&&{hasSnapshot:!0}});if(!i)return null;const r=new ux(i),o=await this.execute(r,e?.executorOptions);return o?{query:r,queryResults:o}:null}async executeDefaultRecordingQuery(e){const t=this._api.getCameraManager(),n=e?.cameraID?t.getStore().getAllDependentCameras(e.cameraID,"recordings"):t.getStore().getCameraIDsWithCapability("recordings");if(!n.size)return null;const a=t.generateDefaultRecordingQueries(n,{limit:this._getChunkLimit()});if(!a)return null;const i=new hx(a),r=await this.execute(i,e?.executorOptions);return r?{query:i,queryResults:r}:null}async execute(e,t){const n=e.getQueries();if(!n)return null;const a=await this._api.getCameraManager().executeMediaQueries(n,{useCache:t?.useCache});if(!a)return null;const i=new kx({results:a});return t?.rejectResults?.(i)?null:(t?.selectResult?.id?i.selectBestResult((e=>e.findIndex((e=>e.getID()===t.selectResult?.id)))):t?.selectResult?.func?i.selectResultIfFound(t.selectResult.func):t?.selectResult?.time&&i.selectBestResult((e=>Cx(e,t.selectResult?.time?.time,t.selectResult?.time?.favorCameraID))),i)}_getChunkLimit(){const e=this._api.getConfigManager().getCardWideConfig();return e?.performance?.features.media_chunk_size??50}}class Ex{constructor(e,t){this._api=e,this._executor=t??new Sx(e)}async getExistingQueryModifiers(e,t){return e.query?[new xx({queryResults:await this._executor.execute(e.query,t)})]:[]}async getNewQueryModifiers(e,t){return await this._executeNewQuery(e,{useCache:!1,...t})}async _executeNewQuery(e,t){const n=this._api.getConfigManager().getConfig();if(!n)return null;const a=e?.getDefaultMediaType(),i=[],r=async n=>{ +/* istanbul ignore if: this path cannot be reached -- @preserve */ +if(!n)return[];const a="recordings"===n?await this._executor.executeDefaultRecordingQuery({...!e.isGrid()&&{cameraID:e.camera},executorOptions:t}):"clips"===n||"snapshots"===n||"all"===n?await this._executor.executeDefaultEventQuery({...!e.isGrid()&&{cameraID:e.camera},eventsMediaType:n,executorOptions:t}):/* istanbul ignore next -- @preserve */ +null;return a?[new xx(a)]:[]};switch(e.view){case"live":"none"!==n.live.controls.thumbnails.mode&&i.push(...await r("recordings"===n.live.controls.thumbnails.media_type?"recordings":n.live.controls.thumbnails.events_media_type));break;case"media":i.push(...await r("clips"));break;case"clips":case"snapshots":case"recordings":i.push(...await r(a));break;case"clip":case"snapshot":case"recording":"none"!==n.media_viewer.controls.thumbnails.mode&&i.push(...await r(a))}return i.push(...this._getTimelineWindowViewModifier(e)),i.push(...this._getSeekTimeModifier(t?.selectResult?.time?.time)),i}_getTimelineWindowViewModifier(e){if(e.is("live")){const e=new Date,t=this._api.getConfigManager().getConfig()?.live; +/* istanbul ignore if: this if branch cannot be reached as if the config is + empty this function is never called -- @preserve */ +return t?[new Gy({timeline:{window:{start:Qu(e,{seconds:t.controls.timeline.window_seconds}),end:e}}})]:[]}return[new wx("timeline","window")]}_getSeekTimeModifier(e){return e?[new Gy({mediaViewer:{seek:e}})]:[new wx("mediaViewer","seek")]}}class $x{constructor(e,t){this._view=null,this._epoch=this._createEpoch(),this._loadingIndex=1,this.setViewDefault=e=>this._setViewGeneric(this._viewFactory.getViewDefault.bind(this._viewFactory),e),this.setViewByParameters=e=>this._setViewGeneric(this._viewFactory.getViewByParameters.bind(this._viewFactory),e),this.setViewDefaultWithNewQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewDefault.bind(this._viewFactory),this._viewQueryExecutor.getNewQueryModifiers.bind(this._viewQueryExecutor),e),this.setViewByParametersWithNewQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewByParameters.bind(this._viewFactory),this._viewQueryExecutor.getNewQueryModifiers.bind(this._viewQueryExecutor),e),this.setViewByParametersWithExistingQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewByParameters.bind(this._viewFactory),this._viewQueryExecutor.getExistingQueryModifiers.bind(this._viewQueryExecutor),e),this.initialize=async()=>(this._api.getQueryStringManager().hasViewRelatedActionsToRun()||this.setViewDefaultWithNewQuery({failSafe:!0}),!0),this._api=e,this._viewFactory=t?.viewFactory??new bx(e),this._viewQueryExecutor=t?.viewQueryExecutor??new Ex(e)}getEpoch(){return this._epoch}_createEpoch(e){return{manager:this,...e&&{oldView:e}}}getView(){return this._view}hasView(){return!!this.getView()}reset(){this._view&&this._setView(null)}_setViewGeneric(e,t){let n=null;try{n=e({baseView:this._view,...t})}catch(e){this._api.getMessageManager().setErrorIfHigherPriority(e)}n&&this._setView(n)}_markViewLoadingQuery(e,t){return e.mergeInContext({loading:{query:t}})}_markViewAsNotLoadingQuery(e){return e.removeContextProperty("loading","query")}async _setViewThenModifyAsync(e,t,n){let a=null;try{a=e({baseView:this._view,...n,params:{query:null,queryResults:null,...n?.params}})}catch(e){this._api.getMessageManager().setErrorIfHigherPriority(e)}if(!a)return;if(this._view&&this._shouldAdoptQueryAndResults(a))return a.query=this._view.query,a.queryResults=this._view.queryResults,this._markViewAsNotLoadingQuery(a),void this._setView(a);const i=this._loadingIndex++;this._markViewLoadingQuery(a,i),this._setView(a);let r=null,o=null;try{r=await t(a,n?.queryExecutorOptions)}catch(e){o=e}if(this._view&&this.hasMajorMediaChange(this._view,a))return void(this._view.context?.loading?.query===i&&this._setView(this._markViewAsNotLoadingQuery(this._view.clone())));if(o)return void this._api.getMessageManager().setErrorIfHigherPriority(o); +/* istanbul ignore if: the if path cannot be reached as the view is set + above -- @preserve */if(!this._view)return;const s=this._view.clone();this._view.context?.loading?.query===i&&this._markViewAsNotLoadingQuery(s),_x(s,r),this._setView(s)}_shouldAdoptQueryAndResults(e){const t=this._view?.isViewerView()&&e?.isGalleryView(),n=e?.getDefaultMediaType(),a=px.getMediaType(this._view?.query)===n;return!!t&&a}setViewWithMergedContext(e){if(this._view)return this._setView(this._view?.clone().mergeInContext(e))}isViewSupportedByCamera(e,t){return!!mx(this._api.getCameraManager(),t,e).size}hasMajorMediaChange(e,t){const n=t??this._view;return!!e!=!!n||e?.view!==n?.view||e?.camera!==n?.camera||"live"===n?.view&&e&&My(e)!==My(n)||"live"!==n?.view&&e?.queryResults!==n?.queryResults}_setView(e){const t=this._view;B_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card view change: ",e),this._view=e,this._epoch=this._createEpoch(t),this.hasMajorMediaChange(t)&&this._api.getMediaLoadedInfoManager().clear(),t?.view!==e?.view&&this._api.getCardElementManager().scrollReset(),this._api.getMessageManager().reset(),this._api.getStyleManager().setExpandedMode(),this._api.getConditionsManager()?.setState({view:e?.view,camera:e?.camera,displayMode:e?.displayMode??void 0}),this._api.getCardElementManager().update()}}class Ax{constructor(e,t,n,a){this._deviceRegistryManager=new oy(new iy((e=>e.id))),this._entityRegistryManager=new ly(new iy((e=>e.entity_id))),this._resolvedMediaCache=new uy,this._actionsManager=new gb(this),this._automationsManager=new fb(this),this._cameraManager=new ay(this),this._cameraURLManager=new _b(this),this._configManager=new Mw(this),this._defaultManager=new kw(this),this._downloadManager=new Aw(this),this._expandManager=new zw(this),this._fullscreenManager=new Rw(this),this._hassManager=new Lw(this),this._initializationManager=new Zb(this),this._interactionManager=new Uw(this),this._keyboardStateManager=new Ww(this),this._mediaLoadedInfoManager=new ex(this),this._mediaPlayerManager=new nx(this),this._messageManager=new ax(this),this._microphoneManager=new ix(this),this._queryStringManager=new rx(this),this._statusBarItemManager=new ox(this),this._styleManager=new sx(this),this._triggersManager=new cx(this),this._viewManager=new $x(this),e.addController(this),this._conditionsManager=new yw(this,a),this._cardElementManager=new Qb(this,e,t,n)}getActionsManager(){return this._actionsManager}getAutomationsManager(){return this._automationsManager}getCameraManager(){return this._cameraManager}getCameraURLManager(){return this._cameraURLManager}getCardElementManager(){return this._cardElementManager}getConditionsManager(){return this._conditionsManager}static async getConfigElement(){return await import("./editor-ce460dd0.js"),document.createElement("frigate-card-editor")}getConfigManager(){return this._configManager}getDefaultManager(){return this._defaultManager}getDeviceRegistryManager(){return this._deviceRegistryManager}getDownloadManager(){return this._downloadManager}getEntityRegistryManager(){return this._entityRegistryManager}getExpandManager(){return this._expandManager}getFullscreenManager(){return this._fullscreenManager}getHASSManager(){return this._hassManager}getInitializationManager(){return this._initializationManager}getInteractionManager(){return this._interactionManager}getKeyboardStateManager(){return this._keyboardStateManager}getMediaLoadedInfoManager(){return this._mediaLoadedInfoManager}getMediaPlayerManager(){return this._mediaPlayerManager}getMessageManager(){return this._messageManager}getMicrophoneManager(){return this._microphoneManager}getQueryStringManager(){return this._queryStringManager}getResolvedMediaCache(){return this._resolvedMediaCache}getStatusBarItemManager(){return this._statusBarItemManager}static getStubConfig(e){return{cameras:[{camera_entity:e.find((e=>e.startsWith("camera.")))??"camera.demo"}]}}getStyleManager(){return this._styleManager}getTriggersManager(){return this._triggersManager}getViewManager(){return this._viewManager}hostConnected(){this.getCardElementManager().elementConnected()}hostDisconnected(){this.getCardElementManager().elementDisconnected()}}class zx{constructor(){this._dynamicMenuButtons=[]}addDynamicMenuButton(e){this._dynamicMenuButtons.includes(e)||this._dynamicMenuButtons.push(e)}removeDynamicMenuButton(e){this._dynamicMenuButtons=this._dynamicMenuButtons.filter((t=>t!=e))}calculateButtons(e,t,n,a){return[this._getDefaultButton(t),this._getCamerasButton(t,n,a?.view),this._getSubstreamsButton(t,n,a?.view),this._getLiveButton(t,a?.view,a?.viewManager),this._getClipsButton(t,a?.view,a?.viewManager),this._getSnapshotsButton(t,a?.view,a?.viewManager),this._getRecordingsButton(t,a?.view,a?.viewManager),this._getImageButton(t,a?.view,a?.viewManager),this._getTimelineButton(t,a?.view,a?.viewManager),this._getDownloadButton(t,n,a?.view),this._getCameraUIButton(t,a?.showCameraUIButton),this._getMicrophoneButton(t,a?.microphoneManager,a?.currentMediaLoadedInfo),this._getExpandButton(t,a?.inExpandedMode),this._getFullscreenButton(t,a?.inFullscreenMode),this._getCastButton(e,t,n,a?.view,a?.mediaPlayerController),this._getPlayPauseButton(t,a?.currentMediaLoadedInfo),this._getMuteUnmuteButton(t,a?.currentMediaLoadedInfo),this._getScreenshotButton(t,a?.currentMediaLoadedInfo),this._getDisplayModeButton(t,n,a?.view),this._getPTZControlsButton(t,n,a?.view),this._getPTZHomeButton(t,n,a?.view),...this._dynamicMenuButtons.map((e=>({style:this._getStyleFromActions(t,e,a),...e})))].filter(sf)}_getDefaultButton(e){return{icon:"frigate",...e.menu.buttons.frigate,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.frigate"),permanent:!0,tap_action:"hidden"===e.menu?.style?gf("menu_toggle"):gf("default"),hold_action:gf("diagnostics")}}_getCamerasButton(e,t,n){const a=t.getStore().getCameraIDsWithCapability("menu");if(a.size>1){const i=Array.from(t.getStore().getCameraConfigEntries(a),(([e,a])=>{const i=ff("camera_select",e),r=t.getCameraMetadata(e);return{enabled:!0,icon:r?.icon,entity:a.camera_entity,state_color:!0,title:r?.title,selected:n?.camera===e,...i&&{tap_action:i}}}));return{icon:"mdi:video-switch",...e.menu.buttons.cameras,type:"custom:frigate-card-menu-submenu",title:V_("config.menu.buttons.cameras"),items:i}}return null}_getSubstreamsButton(e,t,n){if(!n)return null;const a=t.getStore().getAllDependentCameras(n.camera,"substream");if(a.size&&n.is("live")){const i=[...a].filter((e=>e!==n.camera)),r=[n.camera,...i],o=My(n);if(2===r.length)return{icon:"mdi:video-input-component",style:o!==n.camera?this._getEmphasizedStyle():{},title:V_("config.menu.buttons.substreams"),...e.menu.buttons.substreams,type:"custom:frigate-card-menu-icon",tap_action:gf(ky(n)?"live_substream_off":"live_substream_on")};if(r.length>2){const a=Array.from(r,(e=>{const n=ff("live_substream_select",e),a=t.getCameraMetadata(e)??void 0,i=t.getStore().getCameraConfig(e);return{enabled:!0,icon:a?.icon,entity:i?.camera_entity,state_color:!0,title:a?.title,selected:o===e,...n&&{tap_action:n}}}));return{icon:"mdi:video-input-component",title:V_("config.menu.buttons.substreams"),style:o!==n.camera?this._getEmphasizedStyle():{},...e.menu.buttons.substreams,type:"custom:frigate-card-menu-submenu",items:a}}}return null}_getLiveButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"live")?{icon:"mdi:cctv",...e.menu.buttons.live,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.live"),style:t.is("live")?this._getEmphasizedStyle():{},tap_action:gf("live")}:null}_getClipsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"clips")?{icon:"mdi:filmstrip",...e.menu.buttons.clips,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.clips"),style:t?.is("clips")?this._getEmphasizedStyle():{},tap_action:gf("clips"),hold_action:gf("clip")}:null}_getSnapshotsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"snapshots")?{icon:"mdi:camera",...e.menu.buttons.snapshots,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.snapshots"),style:t?.is("snapshots")?this._getEmphasizedStyle():{},tap_action:gf("snapshots"),hold_action:gf("snapshot")}:null}_getRecordingsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"recordings")?{icon:"mdi:album",...e.menu.buttons.recordings,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.recordings"),style:t.is("recordings")?this._getEmphasizedStyle():{},tap_action:gf("recordings"),hold_action:gf("recording")}:null}_getImageButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"image")?{icon:"mdi:image",...e.menu.buttons.image,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.image"),style:t?.is("image")?this._getEmphasizedStyle():{},tap_action:gf("image")}:null}_getTimelineButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"timeline")?{icon:"mdi:chart-gantt",...e.menu.buttons.timeline,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.timeline"),style:t.is("timeline")?this._getEmphasizedStyle():{},tap_action:gf("timeline")}:null}_getDownloadButton(e,t,n){const a=n?.queryResults?.getSelectedResult(),i=a?t?.getMediaCapabilities(a):null;return n?.isViewerView()&&i?.canDownload&&!this._isBeingCasted()?{icon:"mdi:download",...e.menu.buttons.download,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.download"),tap_action:gf("download")}:null}_getCameraUIButton(e,t){return t?{icon:"mdi:web",...e.menu.buttons.camera_ui,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.camera_ui"),tap_action:gf("camera_ui")}:null}_getMicrophoneButton(e,t,n){if(t&&n?.capabilities?.supports2WayAudio){const n=t.isForbidden()||!t.isSupported(),a=t.isMuted(),i=e.menu.buttons.microphone.type;return{icon:n?"mdi:microphone-message-off":a?"mdi:microphone-off":"mdi:microphone",...e.menu.buttons.microphone,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.microphone"),style:n||a?{}:this._getEmphasizedStyle(!0),...!n&&"momentary"===i&&{start_tap_action:gf("microphone_unmute"),end_tap_action:gf("microphone_mute")},...!n&&"toggle"===i&&{tap_action:gf(a?"microphone_unmute":"microphone_mute")}}}return null}_getExpandButton(e,t){return{icon:t?"mdi:arrow-collapse-all":"mdi:arrow-expand-all",...e.menu.buttons.expand,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.expand"),tap_action:gf("expand"),style:t?this._getEmphasizedStyle():{}}}_getFullscreenButton(e,t){return this._isBeingCasted()?null:{icon:t?"mdi:fullscreen-exit":"mdi:fullscreen",...e.menu.buttons.fullscreen,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.fullscreen"),tap_action:gf("fullscreen"),style:t?this._getEmphasizedStyle():{}}}_getCastButton(e,t,n,a,i){if(!a)return null;const r=n.getStore().getCameraConfig(a.camera);if(i?.hasMediaPlayers()&&(a.isViewerView()||a.is("live")&&r?.camera_entity)){const n=i.getMediaPlayers().map((t=>{const n=Lb(e,t)||t,a=e.states[t],i=_f(t,"play"),r=_f(t,"stop"),o=!a||"unavailable"===a.state;return{enabled:!0,selected:!1,icon:Nb(e,t),entity:t,state_color:!1,title:n,disabled:o,...!o&&i&&{tap_action:i},...!o&&r&&{hold_action:r}}}));return{icon:"mdi:cast",...t.menu.buttons.media_player,type:"custom:frigate-card-menu-submenu",title:V_("config.menu.buttons.media_player"),items:n}}return null}_getPlayPauseButton(e,t){if(t&&t.player&&t.capabilities?.supportsPause){const n=t.player.isPaused();return{icon:n?"mdi:play":"mdi:pause",...e.menu.buttons.play,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.play"),tap_action:gf(n?"play":"pause")}}return null}_getMuteUnmuteButton(e,t){if(t&&t.player&&t?.capabilities?.hasAudio){const n=t.player.isMuted();return{icon:n?"mdi:volume-off":"mdi:volume-high",...e.menu.buttons.mute,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.mute"),tap_action:gf(n?"unmute":"mute")}}return null}_getScreenshotButton(e,t){return t&&t.player?{icon:"mdi:monitor-screenshot",...e.menu.buttons.screenshot,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.screenshot"),tap_action:gf("screenshot")}:null}_getDisplayModeButton(e,t,n){const a=n?mx(t,n.view):null;if(n?.supportsMultipleDisplayModes()&&a&&a.size>1){const t=n.isGrid();return{icon:t?"mdi:grid-off":"mdi:grid",...e.menu.buttons.display_mode,style:t?this._getEmphasizedStyle():{},type:"custom:frigate-card-menu-icon",title:V_(t?"display_modes.single":"display_modes.grid"),tap_action:(i=t?"single":"grid",{action:"fire-dom-event",frigate_card_action:"display_mode_select",display_mode:i,...r?.cardID&&{card_id:r.cardID}})}}var i,r;return null}_getPTZControlsButton(e,t,n){const a=n?.is("live")?e.live.controls.ptz:n?.isViewerView()?e.media_viewer.controls.ptz:null;if(!n||!a||"off"===a.mode)return null;const i=Ry(n,{cameraManager:t,..."auto"===a.mode&&{type:"ptz"}});if(i){const t=!1!==n.context?.ptzControls?.enabled&&("on"===a.mode||"auto"===a.mode&&"ptz"===i.type);return{icon:"mdi:pan",...e.menu.buttons.ptz_controls,style:t?this._getEmphasizedStyle():{},type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.ptz_controls"),tap_action:(r=!t,{action:"fire-dom-event",frigate_card_action:"ptz_controls",enabled:r,...o?.cardID&&{card_id:o.cardID}})}}var r,o;return null}_getPTZHomeButton(e,t,n){const a=n?Ry(n,{cameraManager:t}):null;return!a||(("digital"===a.type&&n?.context?.zoom?.[a.targetID]?.observed?.isDefault)??1)?null:{icon:"mdi:home",...e.menu.buttons.ptz_home,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.ptz_home"),tap_action:vf({targetID:a.targetID})}}_getEmphasizedStyle(e){return e?{animation:"pulse 3s infinite",color:"var(--error-color, white)"}:{color:"var(--primary-color, white)"}}_getStyleFromActions(e,t,n){for(const a of[t.tap_action,t.double_tap_action,t.hold_action,t.start_tap_action,t.end_tap_action]){const t=Array.isArray(a)?a:[a];for(const a of t){if(!a||"fire-dom-event"!==a.action||!("frigate_card_action"in a))continue;const t=a;if(Zs.some((e=>e===t.frigate_card_action&&n?.view?.is(t.frigate_card_action)))||"default"===t.frigate_card_action&&n?.view?.is(e.view.default)||"fullscreen"===t.frigate_card_action&&n?.inFullscreenMode||"camera_select"===t.frigate_card_action&&n?.view?.camera===t.camera)return this._getEmphasizedStyle()}}return{}}_isBeingCasted(){return!!navigator.userAgent.match(/CrKey\//)}} +/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */ +function Ix(e){return null==e}var Tx=function(e,t){var n,a="";for(n=0;ns&&(t=a-s+(r=" ... ").length),n-a>s&&(n=a+s-(o=" ...").length),{str:r+e.slice(t,n).replace(/\t/g,"→")+o,pos:a-t+r.length}}function Lx(e,t){return jx.repeat(" ",t-e.length)+e}var Nx=function(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),"number"!=typeof t.indent&&(t.indent=1),"number"!=typeof t.linesBefore&&(t.linesBefore=3),"number"!=typeof t.linesAfter&&(t.linesAfter=2);for(var n,a=/\r?\n|\r|\0/g,i=[0],r=[],o=-1;n=a.exec(e.buffer);)r.push(n.index),i.push(n.index+n[0].length),e.position<=n.index&&o<0&&(o=i.length-2);o<0&&(o=i.length-1);var s,c,l="",d=Math.min(e.line+t.linesAfter,r.length).toString().length,u=t.maxLength-(t.indent+d+3);for(s=1;s<=t.linesBefore&&!(o-s<0);s++)c=Px(e.buffer,i[o-s],r[o-s],e.position-(i[o]-i[o-s]),u),l=jx.repeat(" ",t.indent)+Lx((e.line-s+1).toString(),d)+" | "+c.str+"\n"+l;for(c=Px(e.buffer,i[o],r[o],e.position,u),l+=jx.repeat(" ",t.indent)+Lx((e.line+1).toString(),d)+" | "+c.str+"\n",l+=jx.repeat("-",t.indent+d+3+c.pos)+"^\n",s=1;s<=t.linesAfter&&!(o+s>=r.length);s++)c=Px(e.buffer,i[o+s],r[o+s],e.position-(i[o]-i[o+s]),u),l+=jx.repeat(" ",t.indent)+Lx((e.line+s+1).toString(),d)+" | "+c.str+"\n";return l.replace(/\n$/,"")},Fx=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],Vx=["scalar","sequence","mapping"];var Hx=function(e,t){if(t=t||{},Object.keys(t).forEach((function(t){if(-1===Fx.indexOf(t))throw new Rx('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')})),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=function(e){var t={};return null!==e&&Object.keys(e).forEach((function(n){e[n].forEach((function(e){t[String(e)]=n}))})),t}(t.styleAliases||null),-1===Vx.indexOf(this.kind))throw new Rx('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')};function Bx(e,t){var n=[];return e[t].forEach((function(e){var t=n.length;n.forEach((function(n,a){n.tag===e.tag&&n.kind===e.kind&&n.multi===e.multi&&(t=a)})),n[t]=e})),n}function qx(e){return this.extend(e)}qx.prototype.extend=function(e){var t=[],n=[];if(e instanceof Hx)n.push(e);else if(Array.isArray(e))n=n.concat(e);else{if(!e||!Array.isArray(e.implicit)&&!Array.isArray(e.explicit))throw new Rx("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit))}t.forEach((function(e){if(!(e instanceof Hx))throw new Rx("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(e.loadKind&&"scalar"!==e.loadKind)throw new Rx("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(e.multi)throw new Rx("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")})),n.forEach((function(e){if(!(e instanceof Hx))throw new Rx("Specified list of YAML types (or a single Type object) contains a non-Type object.")}));var a=Object.create(qx.prototype);return a.implicit=(this.implicit||[]).concat(t),a.explicit=(this.explicit||[]).concat(n),a.compiledImplicit=Bx(a,"implicit"),a.compiledExplicit=Bx(a,"explicit"),a.compiledTypeMap=function(){var e,t,n={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function a(e){e.multi?(n.multi[e.kind].push(e),n.multi.fallback.push(e)):n[e.kind][e.tag]=n.fallback[e.tag]=e}for(e=0,t=arguments.length;e=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),nC=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var aC=/^[-+]?[0-9]+e/;var iC=new Hx("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!nC.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||jx.isNegativeZero(e))},represent:function(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(jx.isNegativeZero(e))return"-0.0";return n=e.toString(10),aC.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"}),rC=Gx.extend({implicit:[Yx,Kx,tC,iC]}),oC=rC,sC=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),cC=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");var lC=new Hx("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==sC.exec(e)||null!==cC.exec(e))},construct:function(e){var t,n,a,i,r,o,s,c,l=0,d=null;if(null===(t=sC.exec(e))&&(t=cC.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],a=+t[2]-1,i=+t[3],!t[4])return new Date(Date.UTC(n,a,i));if(r=+t[4],o=+t[5],s=+t[6],t[7]){for(l=t[7].slice(0,3);l.length<3;)l+="0";l=+l}return t[9]&&(d=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(d=-d)),c=new Date(Date.UTC(n,a,i,r,o,s,l)),d&&c.setTime(c.getTime()-d),c},instanceOf:Date,represent:function(e){return e.toISOString()}});var dC=new Hx("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}}),uC="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";var hC=new Hx("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,a=0,i=e.length,r=uC;for(n=0;n64)){if(t<0)return!1;a+=6}return a%8==0},construct:function(e){var t,n,a=e.replace(/[\r\n=]/g,""),i=a.length,r=uC,o=0,s=[];for(t=0;t>16&255),s.push(o>>8&255),s.push(255&o)),o=o<<6|r.indexOf(a.charAt(t));return 0===(n=i%4*6)?(s.push(o>>16&255),s.push(o>>8&255),s.push(255&o)):18===n?(s.push(o>>10&255),s.push(o>>2&255)):12===n&&s.push(o>>4&255),new Uint8Array(s)},predicate:function(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)},represent:function(e){var t,n,a="",i=0,r=e.length,o=uC;for(t=0;t>18&63],a+=o[i>>12&63],a+=o[i>>6&63],a+=o[63&i]),i=(i<<8)+e[t];return 0===(n=r%3)?(a+=o[i>>18&63],a+=o[i>>12&63],a+=o[i>>6&63],a+=o[63&i]):2===n?(a+=o[i>>10&63],a+=o[i>>4&63],a+=o[i<<2&63],a+=o[64]):1===n&&(a+=o[i>>2&63],a+=o[i<<4&63],a+=o[64],a+=o[64]),a}}),pC=Object.prototype.hasOwnProperty,mC=Object.prototype.toString;var gC=new Hx("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,a,i,r,o=[],s=e;for(t=0,n=s.length;t>10),56320+(e-65536&1023))}for(var qC=new Array(256),UC=new Array(256),WC=0;WC<256;WC++)qC[WC]=HC(WC)?1:0,UC[WC]=HC(WC);function ZC(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||bC,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function QC(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=Nx(n),new Rx(t,n)}function GC(e,t){throw QC(e,t)}function YC(e,t){e.onWarning&&e.onWarning.call(null,QC(e,t))}var KC={YAML:function(e,t,n){var a,i,r;null!==e.version&&GC(e,"duplication of %YAML directive"),1!==n.length&&GC(e,"YAML directive accepts exactly one argument"),null===(a=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&GC(e,"ill-formed argument of the YAML directive"),i=parseInt(a[1],10),r=parseInt(a[2],10),1!==i&&GC(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=r<2,1!==r&&2!==r&&YC(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var a,i;2!==n.length&&GC(e,"TAG directive accepts exactly two arguments"),a=n[0],i=n[1],TC.test(a)||GC(e,"ill-formed tag handle (first argument) of the TAG directive"),wC.call(e.tagMap,a)&&GC(e,'there is a previously declared suffix for "'+a+'" tag handle'),jC.test(i)||GC(e,"ill-formed tag prefix (second argument) of the TAG directive");try{i=decodeURIComponent(i)}catch(t){GC(e,"tag prefix is malformed: "+i)}e.tagMap[a]=i}};function XC(e,t,n,a){var i,r,o,s;if(t1&&(e.result+=jx.repeat("\n",t-1))}function rM(e,t){var n,a,i=e.tag,r=e.anchor,o=[],s=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=o),a=e.input.charCodeAt(e.position);0!==a&&(-1!==e.firstTabInLine&&(e.position=e.firstTabInLine,GC(e,"tab characters must not be used in indentation")),45===a)&&PC(e.input.charCodeAt(e.position+1));)if(s=!0,e.position++,nM(e,!0,-1)&&e.lineIndent<=t)o.push(null),a=e.input.charCodeAt(e.position);else if(n=e.line,cM(e,t,MC,!1,!0),o.push(e.result),nM(e,!0,-1),a=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==a)GC(e,"bad indentation of a sequence entry");else if(e.lineIndentt?m=1:e.lineIndent===t?m=0:e.lineIndentt?m=1:e.lineIndent===t?m=0:e.lineIndentt)&&(_&&(o=e.line,s=e.lineStart,c=e.position),cM(e,t,kC,!0,i)&&(_?g=e.result:f=e.result),_||(eM(e,h,p,m,g,f,o,s,c),m=g=f=null),nM(e,!0,-1),l=e.input.charCodeAt(e.position)),(e.line===r||e.lineIndent>t)&&0!==l)GC(e,"bad indentation of a mapping entry");else if(e.lineIndent=0))break;0===i?GC(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):c?GC(e,"repeat of an indentation width identifier"):(l=t+i-1,c=!0)}if(RC(r)){do{r=e.input.charCodeAt(++e.position)}while(RC(r));if(35===r)do{r=e.input.charCodeAt(++e.position)}while(!DC(r)&&0!==r)}for(;0!==r;){for(tM(e),e.lineIndent=0,r=e.input.charCodeAt(e.position);(!c||e.lineIndentl&&(l=e.lineIndent),DC(r))d++;else{if(e.lineIndent0){for(i=o,r=0;i>0;i--)(o=NC(s=e.input.charCodeAt(++e.position)))>=0?r=(r<<4)+o:GC(e,"expected hexadecimal character");e.result+=BC(r),e.position++}else GC(e,"unknown escape sequence");n=a=e.position}else DC(s)?(XC(e,n,a,!0),iM(e,nM(e,!1,t)),n=a=e.position):e.position===e.lineStart&&aM(e)?GC(e,"unexpected end of the document within a double quoted scalar"):(e.position++,a=e.position)}GC(e,"unexpected end of the stream within a double quoted scalar")}(e,h)?f=!0:!function(e){var t,n,a;if(42!==(a=e.input.charCodeAt(e.position)))return!1;for(a=e.input.charCodeAt(++e.position),t=e.position;0!==a&&!PC(a)&&!LC(a);)a=e.input.charCodeAt(++e.position);return e.position===t&&GC(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),wC.call(e.anchorMap,n)||GC(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],nM(e,!0,-1),!0}(e)?function(e,t,n){var a,i,r,o,s,c,l,d,u=e.kind,h=e.result;if(PC(d=e.input.charCodeAt(e.position))||LC(d)||35===d||38===d||42===d||33===d||124===d||62===d||39===d||34===d||37===d||64===d||96===d)return!1;if((63===d||45===d)&&(PC(a=e.input.charCodeAt(e.position+1))||n&&LC(a)))return!1;for(e.kind="scalar",e.result="",i=r=e.position,o=!1;0!==d;){if(58===d){if(PC(a=e.input.charCodeAt(e.position+1))||n&&LC(a))break}else if(35===d){if(PC(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&aM(e)||n&&LC(d))break;if(DC(d)){if(s=e.line,c=e.lineStart,l=e.lineIndent,nM(e,!1,-1),e.lineIndent>=t){o=!0,d=e.input.charCodeAt(e.position);continue}e.position=r,e.line=s,e.lineStart=c,e.lineIndent=l;break}}o&&(XC(e,i,r,!1),iM(e,e.line-s),i=r=e.position,o=!1),RC(d)||(r=e.position+1),d=e.input.charCodeAt(++e.position)}return XC(e,i,r,!1),!!e.result||(e.kind=u,e.result=h,!1)}(e,h,xC===n)&&(f=!0,null===e.tag&&(e.tag="?")):(f=!0,null===e.tag&&null===e.anchor||GC(e,"alias node should not have any properties")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===m&&(f=s&&rM(e,p))),null===e.tag)null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);else if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&GC(e,'unacceptable node kind for ! tag; it should be "scalar", not "'+e.kind+'"'),c=0,l=e.implicitTypes.length;c"),null!==e.result&&u.kind!==e.kind&&GC(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+u.kind+'", not "'+e.kind+'"'),u.resolve(e.result,e.tag)?(e.result=u.construct(e.result,e.tag),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):GC(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||f}function lM(e){var t,n,a,i,r=e.position,o=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);0!==(i=e.input.charCodeAt(e.position))&&(nM(e,!0,-1),i=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==i));){for(o=!0,i=e.input.charCodeAt(++e.position),t=e.position;0!==i&&!PC(i);)i=e.input.charCodeAt(++e.position);for(a=[],(n=e.input.slice(t,e.position)).length<1&&GC(e,"directive name must not be less than one character in length");0!==i;){for(;RC(i);)i=e.input.charCodeAt(++e.position);if(35===i){do{i=e.input.charCodeAt(++e.position)}while(0!==i&&!DC(i));break}if(DC(i))break;for(t=e.position;0!==i&&!PC(i);)i=e.input.charCodeAt(++e.position);a.push(e.input.slice(t,e.position))}0!==i&&tM(e),wC.call(KC,n)?KC[n](e,n,a):YC(e,'unknown document directive "'+n+'"')}nM(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,nM(e,!0,-1)):o&&GC(e,"directives end mark is expected"),cM(e,e.lineIndent-1,kC,!1,!0),nM(e,!0,-1),e.checkLineBreaks&&zC.test(e.input.slice(r,e.position))&&YC(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&aM(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,nM(e,!0,-1)):e.position=55296&&a<=56319&&t+1=56320&&n<=57343?1024*(a-55296)+n-56320+65536:a}function JM(e){return/^\n* /.test(e)}var ek=1,tk=2,nk=3,ak=4,ik=5;function rk(e,t,n,a,i,r,o,s){var c,l=0,d=null,u=!1,h=!1,p=-1!==a,m=-1,g=function(e){return GM(e)&&e!==mM&&!QM(e)&&e!==EM&&e!==IM&&e!==$M&&e!==SM&&e!==jM&&e!==OM&&e!==RM&&e!==LM&&e!==wM&&e!==CM&&e!==kM&&e!==yM&&e!==PM&&e!==AM&&e!==zM&&e!==MM&&e!==bM&&e!==xM&&e!==TM&&e!==DM}(XM(e,0))&&function(e){return!QM(e)&&e!==$M}(XM(e,e.length-1));if(t||o)for(c=0;c=65536?c+=2:c++){if(!GM(l=XM(e,c)))return ik;g=g&&KM(l,d,s),d=l}else{for(c=0;c=65536?c+=2:c++){if((l=XM(e,c))===fM)u=!0,p&&(h=h||c-m-1>a&&" "!==e[m+1],m=c);else if(!GM(l))return ik;g=g&&KM(l,d,s),d=l}h=h||p&&c-m-1>a&&" "!==e[m+1]}return u||h?n>9&&JM(e)?ik:o?r===qM?ik:tk:h?ak:nk:!g||o||i(e)?r===qM?ik:tk:ek}function ok(e,t,n,a,i){e.dump=function(){if(0===t.length)return e.quotingType===qM?'""':"''";if(!e.noCompatMode&&(-1!==FM.indexOf(t)||VM.test(t)))return e.quotingType===qM?'"'+t+'"':"'"+t+"'";var r=e.indent*Math.max(1,n),o=-1===e.lineWidth?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-r),s=a||e.flowLevel>-1&&n>=e.flowLevel;switch(rk(t,s,e.indent,o,(function(t){return function(e,t){var n,a;for(n=0,a=e.implicitTypes.length;n"+sk(t,e.indent)+ck(WM(function(e,t){var n,a,i=/(\n+)([^\n]*)/g,r=(s=e.indexOf("\n"),s=-1!==s?s:e.length,i.lastIndex=s,lk(e.slice(0,s),t)),o="\n"===e[0]||" "===e[0];var s;for(;a=i.exec(e);){var c=a[1],l=a[2];n=" "===l[0],r+=c+(o||n||""===l?"":"\n")+lk(l,t),o=n}return r}(t,o),r));case ik:return'"'+function(e){for(var t,n="",a=0,i=0;i=65536?i+=2:i++)a=XM(e,i),!(t=NM[a])&&GM(a)?(n+=e[i],a>=65536&&(n+=e[i+1])):n+=t||HM(a);return n}(t)+'"';default:throw new Rx("impossible error: invalid scalar style")}}()}function sk(e,t){var n=JM(e)?String(t):"",a="\n"===e[e.length-1];return n+(a&&("\n"===e[e.length-2]||"\n"===e)?"+":a?"":"-")+"\n"}function ck(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function lk(e,t){if(""===e||" "===e[0])return e;for(var n,a,i=/ [^ ]/g,r=0,o=0,s=0,c="";n=i.exec(e);)(s=n.index)-r>t&&(a=o>r?o:s,c+="\n"+e.slice(r,a),r=a+1),o=s;return c+="\n",e.length-r>t&&o>r?c+=e.slice(r,o)+"\n"+e.slice(o+1):c+=e.slice(r),c.slice(1)}function dk(e,t,n,a){var i,r,o,s="",c=e.tag;for(i=0,r=n.length;i tag resolver accepts not "'+c+'" style');a=s.represent[c](t,c)}e.dump=a}return!0}return!1}function hk(e,t,n,a,i,r,o){e.tag=null,e.dump=n,uk(e,n,!1)||uk(e,n,!0);var s,c=hM.call(e.dump),l=a;a&&(a=e.flowLevel<0||e.flowLevel>t);var d,u,h="[object Object]"===c||"[object Array]"===c;if(h&&(u=-1!==(d=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||u||2!==e.indent&&t>0)&&(i=!1),u&&e.usedDuplicates[d])e.dump="*ref_"+d;else{if(h&&u&&!e.usedDuplicates[d]&&(e.usedDuplicates[d]=!0),"[object Object]"===c)a&&0!==Object.keys(e.dump).length?(!function(e,t,n,a){var i,r,o,s,c,l,d="",u=e.tag,h=Object.keys(n);if(!0===e.sortKeys)h.sort();else if("function"==typeof e.sortKeys)h.sort(e.sortKeys);else if(e.sortKeys)throw new Rx("sortKeys must be a boolean or a function");for(i=0,r=h.length;i1024)&&(e.dump&&fM===e.dump.charCodeAt(0)?l+="?":l+="? "),l+=e.dump,c&&(l+=ZM(e,t)),hk(e,t+1,s,!0,c)&&(e.dump&&fM===e.dump.charCodeAt(0)?l+=":":l+=": ",d+=l+=e.dump));e.tag=u,e.dump=d||"{}"}(e,t,e.dump,i),u&&(e.dump="&ref_"+d+e.dump)):(!function(e,t,n){var a,i,r,o,s,c="",l=e.tag,d=Object.keys(n);for(a=0,i=d.length;a1024&&(s+="? "),s+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),hk(e,t,o,!1,!1)&&(c+=s+=e.dump));e.tag=l,e.dump="{"+c+"}"}(e,t,e.dump),u&&(e.dump="&ref_"+d+" "+e.dump));else if("[object Array]"===c)a&&0!==e.dump.length?(e.noArrayIndent&&!o&&t>0?dk(e,t-1,e.dump,i):dk(e,t,e.dump,i),u&&(e.dump="&ref_"+d+e.dump)):(!function(e,t,n){var a,i,r,o="",s=e.tag;for(a=0,i=n.length;a",e.dump=s+" "+e.dump)}return!0}function pk(e,t){var n,a,i=[],r=[];for(mk(e,i,r),n=0,a=r.length;nq`
${fk.dump(e)}
`;return q`
+
+
+ +
+
+ + ${this.message?q`${this.message}${this.context&&"string"==typeof this.context?": "+this.context:""}`:""} + + ${this.context&&Array.isArray(this.context)?this.context.map((e=>n(e))):"object"==typeof this.context?n(this.context):""} +
+
+
`}static get styles(){return o(_k)}};e([he({attribute:!1})],vk.prototype,"message",void 0),e([he({attribute:!1})],vk.prototype,"context",void 0),e([he({attribute:!1})],vk.prototype,"icon",void 0),e([he({attribute:!0,type:Boolean})],vk.prototype,"dotdotdot",void 0),vk=e([le("frigate-card-message")],vk);let yk=class extends se{render(){if(this.message)return q` ${V_("error.troubleshooting")}.`} + .icon=${this.message.icon??"mdi:alert-circle"} + .context=${this.message.context} + .dotdotdot=${this.message.dotdotdot} + > + `}static get styles(){return o(_k)}};e([he({attribute:!1})],yk.prototype,"message",void 0),yk=e([le("frigate-card-error-message")],yk);let bk=class extends se{constructor(){super(...arguments),this.message="",this.animated=!1,this.size="large"}render(){return q`
+ ${this.animated?q` + `:q``} + ${this.message?q`${this.message}`:q``} +
`}static get styles(){return o(_k)}};function wk(e){return"error"===e?.type?q` `:e?q` `:q``}function xk(e){return q` + + + `}function Ck(e,t,n,a){Bg(e,"message",{message:t,type:n,icon:a?.icon,context:a?.context})}function Mk(e,t,n){Ck(e,t,"error",{context:n?.context})}function kk(e,t){t instanceof Error&&Mk(e,t.message,{...t instanceof zs&&{context:t.context}})}e([he({attribute:!1})],bk.prototype,"message",void 0),e([he({attribute:!1})],bk.prototype,"animated",void 0),e([he({attribute:!1})],bk.prototype,"size",void 0),bk=e([le("frigate-card-progress-indicator")],bk);let Sk=class extends se{constructor(){super(...arguments),this._root=null}createRenderRoot(){return this}_createRoot(){const e=customElements.get("hui-conditional-element");if(!e||!this.hass)throw new Error(V_("error.could_not_render_elements"));const t=new e;t.hass=this.hass;const n={type:"conditional",conditions:[],elements:this.elements};try{t.setConfig(n)}catch(e){throw Gg(e,console.error),new zs(V_("error.invalid_elements_config"))}return t}willUpdate(e){try{!this.elements||this._root&&!e.has("elements")||(this._root=this._createRoot())}catch(e){return kk(this,e)}}render(){return q`${this._root||""}`}updated(){this.hass&&this._root&&(this._root.hass=this.hass)}};e([he({attribute:!1})],Sk.prototype,"elements",void 0),e([he({attribute:!1})],Sk.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],Sk.prototype,"hass",void 0),Sk=e([le("frigate-card-elements-core")],Sk);let Ek=class extends se{constructor(){super(...arguments),this._menuRemoveHandler=e=>{Bg(this,"menu:remove",e.detail)},this._statusBarRemoveHandler=e=>{Bg(this,"status-bar:remove",e.detail)},this._menuAddHandler=e=>{const t=e.composedPath();t.length&&this._addHandler(t[0],"frigate-card:menu:remove",this._menuRemoveHandler)},this._statusBarAddHandler=e=>{const t=e.composedPath();t.length&&this._addHandler(t[0],"frigate-card:status-bar:add",this._statusBarRemoveHandler)}}_addHandler(e,t,n){e.removeEventListener(t,n),e.addEventListener(t,n)}connectedCallback(){super.connectedCallback(),this.addEventListener("frigate-card:menu:add",this._menuAddHandler),this.addEventListener("frigate-card:status-bar:add",this._statusBarAddHandler)}disconnectedCallback(){this.removeEventListener("frigate-card:menu:add",this._menuAddHandler),this.addEventListener("frigate-card:status-bar:add",this._statusBarAddHandler),super.disconnectedCallback()}render(){return q` + `}static get styles(){return o(":host {\n position: absolute;\n inset: 0;\n overflow: hidden;\n pointer-events: none;\n}\n\n.element {\n position: absolute;\n transform: translate(-50%, -50%);\n pointer-events: auto;\n}\n\nhui-error-card.element {\n inset: 0px;\n transform: unset;\n}")}};e([he({attribute:!1})],Ek.prototype,"hass",void 0),e([he({attribute:!1})],Ek.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],Ek.prototype,"elements",void 0),Ek=e([le("frigate-card-elements")],Ek);let $k=class extends se{setConfig(e){this._config=e}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.className=""}render(){if(function(e,t){if(!t)return!0;const n=new _w(t,{bubbles:!0,composed:!0});return e.dispatchEvent(n),n.evaluation??!1}(this,this._config?.conditions))return q` + `}};e([he({attribute:!1,hasChanged:()=>!0})],$k.prototype,"hass",void 0),$k=e([le("frigate-card-conditional")],$k);class Ak extends se{constructor(e){super(),this._config=null,this._eventCategory=e}setConfig(e){this._config=e}connectedCallback(){super.connectedCallback(),this._config&&Bg(this,`${this._eventCategory}:add`,this._config)}disconnectedCallback(){this._config&&Bg(this,`${this._eventCategory}:remove`,this._config),super.disconnectedCallback()}}e([pe()],Ak.prototype,"_config",void 0);class zk extends Ak{constructor(){super("menu")}}let Ik=class extends zk{};Ik=e([le("frigate-card-menu-icon")],Ik);let Tk=class extends zk{};Tk=e([le("frigate-card-menu-state-icon")],Tk);let jk=class extends zk{};jk=e([le("frigate-card-menu-submenu")],jk);let Ok=class extends zk{};Ok=e([le("frigate-card-menu-submenu-select")],Ok);class Dk extends Ak{constructor(){super("status-bar")}}let Rk=class extends Dk{};Rk=e([le("frigate-card-status-bar-icon")],Rk);let Pk=class extends Dk{};Pk=e([le("frigate-card-status-bar-image")],Pk);let Lk=class extends Dk{};Lk=e([le("frigate-card-status-bar-string")],Lk);let Nk=class extends se{render(){return q` `}static get styles(){return o(":host {\n width: intrinsic;\n height: intrinsic;\n display: flex;\n justify-content: center;\n align-items: center;\n pointer-events: none;\n}\n\nimg {\n width: 10%;\n animation: rotate 8s linear infinite;\n}\n\n@keyframes rotate {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}")}};Nk=e([le("frigate-card-loading")],Nk);const Fk=(e,t)=>{Bg(e,"action:execution-request",t)};class Vk{constructor(e){this._config=null,this._buttons=[],this._expanded=!1,this._host=e}setMenuConfig(e){this._config=e,this._host.style.setProperty("--frigate-card-menu-button-size",`${e.button_size}px`),this._host.setAttribute("data-style",e.style),this._host.setAttribute("data-position",e.position),this._host.setAttribute("data-alignment",e.alignment),this._sortButtons(),this._host.requestUpdate()}getMenuConfig(){return this._config}isExpanded(){return this._expanded}setButtons(e){this._buttons=e,this._sortButtons(),this._host.requestUpdate()}getButtons(e){const t=e=>!this._isHidingMenu()||this._expanded||!!e.permanent;return this._buttons.filter((n=>(e=>!1!==e.enabled)(n)&&(t=>t.alignment===e||"matching"===e&&!t.alignment)(n)&&t(n)))}setExpanded(e){this._expanded=e,of(this._host,e,"expanded"),this._host.requestUpdate()}toggleExpanded(){this.setExpanded(!this._expanded)}actionHandler(e,t){if(e.stopPropagation(),e.detail.config&&(t=e.detail.config),!t)return;const n=e.detail.action,a=yf(n,t);if(!a)return;const i=Wg(a);let r=!1;const o=i.filter((e=>sf(e)&&!this._isUnknownActionMenuToggleAction(e)));if(o.length!=i.length&&(r=!0),o.length&&Fk(this._host,{action:i,config:t}),this._isHidingMenu())if(r)this.setExpanded(!this._expanded);else{const e=yf("hold",t),a=yf("double_tap",t),i=yf("tap",t),r=yf("end_tap",t);"end_tap"!==n&&("start_tap"!==n||e||a||i||r)&&("end_tap"===n||r)||this.setExpanded(!1)}}getFreshButtonState(e,t){const n={...t};return e&&"custom:frigate-card-menu-state-icon"===t.type?Pb(e,n):n}_sortButtons(){this._buttons=Ev(this._buttons,(e=>(e.priority??0)+(this._isHidingMenu()&&e.permanent?Us:0)),["desc"])}_isHidingMenu(){return"hidden"===this._config?.style}_isUnknownActionMenuToggleAction(e){const t=mf(e);return!!t&&"menu_toggle"==t.frigate_card_action}}var Hk="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' version='1.1' id='svg54' sodipodi:docname='frigate.svg' inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3e %3cdefs id='defs58' /%3e %3csodipodi:namedview id='namedview56' pagecolor='%23da4040' bordercolor='%23666666' borderopacity='1.0' inkscape:pageshadow='2' inkscape:pageopacity='0' inkscape:pagecheckerboard='0' showgrid='false' width='24px' inkscape:zoom='45.254834' inkscape:cx='-0.03314563' inkscape:cy='9.9768347' inkscape:window-width='3840' inkscape:window-height='1527' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='svg54' showguides='true' inkscape:showpageshadow='2' inkscape:deskcolor='%23d1d1d1' /%3e %3cpath d='m 4.8759466%2c22.743573 c 0.0866%2c0.69274 0.811811%2c1.16359 0.37885%2c1.27183 -0.43297%2c0.10824 -2.32718%2c-3.43665 -2.7601492%2c-4.95202 -0.4329602%2c-1.51538 -0.6764993%2c-3.22017 -0.5682593%2c-4.19434 0.1082301%2c-0.97417 5.7097085%2c-2.48955 5.7097085%2c-2.89545 0%2c-0.4059 -1.81304%2c-0.0271 -1.89422%2c-0.35178 -0.0812%2c-0.32472 1.36925%2c-0.12989 1.75892%2c-0.64945 0.60885%2c-0.81181 1.3800713%2c-0.6765 1.8671505%2c-1.1094696 0.4870902%2c-0.4329599 1.0824089%2c-2.0836399 1.1906589%2c-2.7871996 0.108241%2c-0.70357 -1.0824084%2c-1.51538 -1.4071389%2c-2.05658 -0.3247195%2c-0.54121 0.7035702%2c-0.92005 3.1931099%2c-1.94834 2.48954%2c-1.02829 10.39114%2c-3.30134994 10.49938%2c-3.03074994 0.10824%2c0.27061 -2.59779%2c1.40713994 -4.492%2c2.11069994 -1.89422%2c0.70357 -4.97909%2c2.05658 -4.97909%2c2.43542 0%2c0.37885 0.16236%2c0.67651 0.0541%2c1.54244 -0.10824%2c0.86593 -0.12123%2c1.2702597 -0.32472%2c1.8400997 -0.1353%2c0.37884 -0.2706%2c1.27183 0%2c2.0836295 0.21648%2c0.64945 0.92005%2c1.13653 1.24477%2c1.24478 0.2706%2c0.018 1.01746%2c0.0433 1.8401%2c0 1.02829%2c-0.0541 2.48954%2c0.0541 2.48954%2c0.32472 0%2c0.2706 -2.21894%2c0.10824 -2.21894%2c0.48708 0%2c0.37885 2.27306%2c-0.0541 2.21894%2c0.32473 -0.0541%2c0.37884 -1.89422%2c0.21648 -2.86839%2c0.21648 -0.77933%2c0 -1.93031%2c-0.0361 -2.43542%2c-0.21648 l -0.10824%2c0.37884 c -0.18038%2c0 -0.55744%2c0.10824 -0.94711%2c0.10824 -0.48708%2c0 -0.51414%2c0.16236 -1.40713%2c0.16236 -0.892989%2c0 -0.622391%2c-0.0541 -1.4341894%2c-0.10824 -0.81181%2c-0.0541 -3.842561%2c2.27306 -4.383761%2c3.03075 -0.54121%2c0.75768 -0.21649%2c2.59778 -0.21649%2c3.43665 0%2c0.75379 -0.10824%2c2.43542 0%2c3.30135 z' fill='black' id='path330' style='fill:white%3bfill-opacity:1%3bstroke:none%3bstroke-width:0.1%3bstroke-miterlimit:4%3bstroke-dasharray:none%3bstroke-opacity:1' sodipodi:nodetypes='csccscccccsscscccccsscsccssccscc' /%3e%3c/svg%3e",Bk="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3c!-- Created with Inkscape (http://www.inkscape.org/) --%3e%3csvg id='svg2' version='1.1' inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' width='24' height='24' xml:space='preserve' sodipodi:docname='motioneye.svg' inkscape:export-filename='/home/ccrisan/projects/motioneye/static/img/motioneye-logo.png' inkscape:export-xdpi='960' inkscape:export-ydpi='960' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23' xmlns:cc='http://creativecommons.org/ns%23' xmlns:dc='http://purl.org/dc/elements/1.1/'%3e%3cmetadata id='metadata8'%3e%3crdf:RDF%3e%3ccc:Work rdf:about=''%3e%3cdc:format%3eimage/svg%2bxml%3c/dc:format%3e%3cdc:type rdf:resource='http://purl.org/dc/dcmitype/StillImage' /%3e%3c/cc:Work%3e%3c/rdf:RDF%3e%3c/metadata%3e%3cdefs id='defs6'%3e%3clinearGradient inkscape:collect='always' id='linearGradient2058'%3e%3cstop style='stop-color:white%3bstop-opacity:1%3b' offset='0' id='stop2054' /%3e%3cstop style='stop-color:%23585858%3bstop-opacity:1' offset='1' id='stop2056' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' id='linearGradient2005'%3e%3cstop style='stop-color:white%3bstop-opacity:1%3b' offset='0' id='stop2001' /%3e%3cstop style='stop-color:grey%3bstop-opacity:1%3b' offset='1' id='stop2003' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' id='linearGradient4205'%3e%3cstop style='stop-color:%234aa3e0%3bstop-opacity:1' offset='0' id='stop4207' /%3e%3cstop style='stop-color:%233096db%3bstop-opacity:1' offset='1' id='stop4209' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' id='linearGradient4197'%3e%3cstop style='stop-color:white%3bstop-opacity:1%3b' offset='0' id='stop4199' /%3e%3cstop style='stop-color:%23585858%3bstop-opacity:1' offset='1' id='stop4201' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient4205' id='linearGradient4211' x1='26.602072' y1='43.034946' x2='26.602072' y2='29.466328' gradientUnits='userSpaceOnUse' gradientTransform='matrix(0.96428571%2c0%2c0%2c0.96428571%2c0.91428571%2c0.91428571)' /%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4285'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4287' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4289' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.6' result='blur' id='feGaussianBlur4291' /%3e%3cfeOffset dx='0' dy='-1' result='offset' id='feOffset4293' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4295' /%3e%3c/filter%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient2005' id='linearGradient4309' gradientUnits='userSpaceOnUse' x1='26.445793' y1='47.517574' x2='26.445793' y2='3.8183768' /%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient4197' id='linearGradient4311' gradientUnits='userSpaceOnUse' x1='26.445793' y1='47.517574' x2='26.445793' y2='3.8183768' /%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient2058' id='linearGradient4313' gradientUnits='userSpaceOnUse' x1='26.445793' y1='47.517574' x2='26.445793' y2='3.8183768' /%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4315' x='-0.03618178' y='-0.20783284' width='1.0723636' height='1.3304883'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4317' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4319' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.6' result='blur' id='feGaussianBlur4321' /%3e%3cfeOffset dx='0' dy='-1' result='offset' id='feOffset4323' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4325' /%3e%3c/filter%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4327' x='-0.27857143' y='-0.4720238' width='1.5571429' height='1.7505952'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4329' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4331' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.6' result='blur' id='feGaussianBlur4333' /%3e%3cfeOffset dx='0' dy='-1' result='offset' id='feOffset4335' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4337' /%3e%3c/filter%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4339' x='-0.0202507' y='-0.13980794' width='1.0405014' height='1.2082853'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4341' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4343' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.2' result='blur' id='feGaussianBlur4345' /%3e%3cfeOffset dx='0' dy='-0.5' result='offset' id='feOffset4347' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4349' /%3e%3c/filter%3e%3c/defs%3e%3csodipodi:namedview pagecolor='%23ff0d0d' bordercolor='%23666666' borderopacity='1' objecttolerance='10' gridtolerance='10' guidetolerance='10' inkscape:pageopacity='0' inkscape:pageshadow='2' inkscape:window-width='3840' inkscape:window-height='1527' id='namedview4' showgrid='false' inkscape:zoom='29.890116' inkscape:cx='19.973158' inkscape:cy='16.577386' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='g10' showguides='true' inkscape:guide-bbox='true' inkscape:showpageshadow='true' inkscape:pagecheckerboard='false' inkscape:deskcolor='%23d1d1d1' /%3e%3cg id='g10' inkscape:groupmode='layer' inkscape:label='ink_ext_XXXXXX' transform='matrix(1.25%2c0%2c0%2c-1.25%2c0%2c64)'%3e%3cg id='g4823' transform='matrix(1.0344694%2c0%2c0%2c1.0344694%2c-3.551886%2c-0.86695248)'%3e%3cpath id='path4244' d='M 8.9346154%2c40.515385 C 5.3647588%2c36.547307 3.2%2c31.357779 3.2%2c25.6 3.2%2c13.228821 13.228821%2c3.2 25.6%2c3.2 37.971179%2c3.2 48%2c13.228821 48%2c25.6 c 0%2c5.736682 -2.161128%2c10.952493 -5.707692%2c14.915385 -1.695935%2c-0.623286 -3.387833%2c-1.349065 -5.061539%2c-2.288462 3.2394%2c-0.937363 5.6%2c-3.937988 5.6%2c-7.457692 0%2c-4.260339 -3.469626%2c-7.753846 -7.753846%2c-7.753846 -3.633936%2c0 -6.690552%2c2.51055 -7.538461%2c5.869231 h -3.876924 c -0.840685%2c-3.360193 -3.903443%2c-5.869231 -7.538461%2c-5.869231 -4.284219%2c0 -7.7807693%2c3.493507 -7.7807693%2c7.753846 0%2c3.56112 2.4570323%2c6.5856 5.7615383%2c7.484616 -1.676267%2c0.912203 -3.404813%2c1.620556 -5.1692306%2c2.261538 z M 25.6%2c26.461538 c 0.532632%2c-1.981435 1.101793%2c-3.947553 3.446154%2c-5.16923 L 25.6%2c16.123077 22.153846%2c21.292308 c 2.053593%2c1.454966 3.000771%2c3.237758 3.446154%2c5.16923 z' style='fill:url(%23linearGradient4309)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4327)' inkscape:connector-curvature='0' transform='matrix(0.38078533%2c0%2c0%2c0.38078533%2c2.9655495%2c31.335499)' /%3e%3cpath id='path4242' d='m 16.123077%2c33.353847 c -1.427443%2c0 -2.584616%2c-1.157173 -2.584616%2c-2.584616 0%2c-1.427444 1.157173%2c-2.584615 2.584616%2c-2.584615 1.427444%2c0 2.584615%2c1.157171 2.584615%2c2.584615 0%2c1.427443 -1.157171%2c2.584616 -2.584615%2c2.584616 z' style='fill:url(%23linearGradient4311)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4327)' inkscape:connector-curvature='0' transform='matrix(0.38078533%2c0%2c0%2c0.38078533%2c2.9655495%2c31.335499)' /%3e%3cpath id='path4240' d='m 35.076923%2c33.353847 c -1.427443%2c0 -2.584615%2c-1.157173 -2.584615%2c-2.584616 0%2c-1.427444 1.157172%2c-2.584615 2.584615%2c-2.584615 1.427443%2c0 2.584616%2c1.157171 2.584616%2c2.584615 0%2c1.427443 -1.157173%2c2.584616 -2.584616%2c2.584616 z' style='fill:url(%23linearGradient4313)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4327)' inkscape:connector-curvature='0' transform='matrix(0.38078533%2c0%2c0%2c0.38078533%2c2.9655495%2c31.335499)' /%3e%3cpath inkscape:connector-curvature='0' style='fill:%23d9d9d9%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4339)' d='m 25.6%2c47.2 c -4.373944%2c0 -8.437159%2c-1.399808 -11.838461%2c-3.634616 3.677605%2c-0.394237 7.305921%2c-1.342945 11.423077%2c-3.375 4.166157%2c2.122533 8.434154%2c3.008875 12.279808%2c3.452886 C 34.057131%2c45.890032 29.986674%2c47.2 25.6%2c47.2 Z' id='path4248' transform='matrix(0.39488848%2c0%2c0%2c0.39488848%2c2.6045087%2c30.974457)' /%3e%3cpath inkscape:connector-curvature='0' style='fill:url(%23linearGradient4211)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4315)' d='M 39.723077%2c42.552884 C 35.394064%2c42.5242 29.479588%2c40.397223 25.184616%2c38.432418 20.668821%2c40.064102 16.035448%2c42.649343 10.801923%2c42.526924 10.453022%2c42.51873 10.118061%2c42.50105 9.7634616%2c42.475 L 5.6615384%2c42.1375 9.5557693%2c40.839424 c 5.3417977%2c-1.74056 10.0398397%2c-2.851302 14.1749997%2c-10.025963 0.959101%2c0 2.845924%2c-4.15e-4 3.738462%2c-4.15e-4 4.11884%2c7.134039 9.059296%2c8.324614 14.149039%2c10.026378 L 45.460577%2c42.085577 41.4625%2c42.475 c -0.544847%2c0.05181 -1.120992%2c0.08198 -1.739423%2c0.07788 z' id='path4246' sodipodi:nodetypes='cccccccccccc' transform='matrix(0.39488848%2c0%2c0%2c0.39488848%2c2.6045087%2c30.974457)' /%3e%3c/g%3e%3c/g%3e%3c/svg%3e",qk="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3c!-- Created with Inkscape (http://www.inkscape.org/) --%3e%3csvg version='1.1' id='svg62' width='24' height='24' viewBox='0 0 24 24' sodipodi:docname='reolink.svg' inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3e %3cdefs id='defs66' /%3e %3csodipodi:namedview id='namedview64' pagecolor='%23505050' bordercolor='%23eeeeee' borderopacity='1' inkscape:showpageshadow='0' inkscape:pageopacity='0' inkscape:pagecheckerboard='0' inkscape:deskcolor='%23505050' showgrid='true' inkscape:zoom='36.417984' inkscape:cx='18.191562' inkscape:cy='8.6633022' inkscape:window-width='3840' inkscape:window-height='1527' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='g68'%3e %3cinkscape:grid type='xygrid' id='grid1175' dotted='false' snapvisiblegridlinesonly='true' /%3e %3c/sodipodi:namedview%3e %3cg inkscape:groupmode='layer' inkscape:label='Reolink Logo' id='g68'%3e %3cpath style='fill:white%3bstroke-width:0.0393282%3bfill-opacity:1' d='M 17.037254%2c23.964909 C 16.764634%2c23.917573 16.561708%2c23.83617 16.325735%2c23.67954 16.196719%2c23.593913 14.543544%2c21.952905 12.217956%2c19.602014 10.077426%2c17.438191 8.2198993%2c15.582673 8.0901166%2c15.478642 7.6038998%2c15.088895 7.0877741%2c14.869424 6.4986827%2c14.801908 6.3140805%2c14.780765 5.079061%2c14.763305 3.7541964%2c14.763126 l -2.408845%2c-4.78e-4 0.00713%2c-7.3937713 v -7.3935985 l 6.2040046%2c3.536e-5 c 3.9799342%2c1.969e-5 6.3590882%2c0.01465833 6.6366112%2c0.0408227 2.331195%2c0.21982024 4.364771%2c1.49885914 5.578726%2c3.50085534 0.686043%2c1.1313823 1.020901%2c2.2783695 1.067186%2c3.6554196 0.06335%2c1.8844953 -0.57426%2c3.6597378 -1.831469%2c5.0992438 -0.756457%2c0.866146 -1.861127%2c1.62991 -2.928729%2c2.024919 l -0.319718%2c0.118287 -1.951287%2c-1.979284 -1.951286%2c-1.979278 1.046741%2c-0.02346 c 0.575706%2c-0.01291 1.099833%2c-0.03689 1.164724%2c-0.0533 0.596068%2c-0.150649 0.949703%2c-0.313968 1.322206%2c-0.6106282 0.643573%2c-0.5125401 1.046169%2c-1.2439257 1.137985%2c-2.0673522 0.167852%2c-1.505317 -0.771478%2c-2.8704888 -2.263547%2c-3.2897068 L 13.950001%2c4.3234481 9.7981831%2c4.3106846 5.6392389%2c4.29801 v 3.0692702 3.0692648 l 1.4185165%2c7.9e-4 c 1.6275801%2c8.87e-4 1.7789152%2c0.01912 2.3105245%2c0.27984 0.3095679%2c0.15183 0.389559%2c0.219499 1.0817441%2c0.915083 3.027399%2c3.042274 12.19404%2c12.30837 12.204589%2c12.337002 0.0161%2c0.04373 -5.364393%2c0.03953 -5.617359%2c-0.0045 z' id='path1173' inkscape:label='R' /%3e %3c/g%3e%3c/svg%3e";const Uk=e=>{switch(e){case"frigate":return Hk;case"motioneye":return Bk;case"reolink":return qk;default:return null}};const Wk=(e,t,n)=>{const a=e.states[t],i=n?.state?n.state:a?a.state:null;if(!i)return null;const r=Ye(t),o=a?a.attributes:null;return n?.entity?.translation_key&&e.localize(`component.${n.entity.platform}.entity.${r}.${n.entity.translation_key}.state.${i}`)||o?.device_class&&e.localize(`component.${r}.state.${o.device_class}.${i}`)||e.localize(`component.${r}.state._.${i}`)||i};let Zk=class extends se{_renderItem(e){if(!this.hass)return;const t=Pb(this.hass,{...e});return q` + {t.detail.config=e}} + .actionHandler=${kf({hasHold:bf(e.hold_action),hasDoubleClick:bf(e.double_tap_action)})} + > + ${t.title||""} + ${e.subtitle?q`${e.subtitle}`:""} + ${(e=>{if(e.icon){const t=Uk(e.icon);return t?q``:q` + `}return q``})(t)} + + `}render(){if(!this.submenu)return q``;const e=this.submenu.items;return q` + e.stopPropagation()} + @click=${e=>wf(e)} + > + + + + ${e.map(this._renderItem.bind(this))} + + `}static get styles(){return o("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n pointer-events: auto;\n}\n\nmwc-list-item {\n z-index: 20;\n}")}};e([he({attribute:!1})],Zk.prototype,"hass",void 0),e([he({attribute:!1})],Zk.prototype,"submenu",void 0),Zk=e([le("frigate-card-submenu")],Zk);let Qk=class extends se{shouldUpdate(e){const t=e.get("hass");return!e.has("hass")||!t||!this.submenuSelect||jb(this.hass,t,[this.submenuSelect.entity])}async _refreshOptionTitles(){if(!this.hass||!this.submenuSelect)return;const e=this.submenuSelect.entity,t=this.hass.states[e],n=t?.attributes?.options,a=await(this.entityRegistryManager?.getEntity(this.hass,e))??null,i={};for(const t of n){const n=Wk(this.hass,e,{...a&&{entity:a},state:t});n&&(i[t]=n)}this._optionTitles=i}willUpdate(){if(!this.submenuSelect||!this.hass)return;this._optionTitles||this._refreshOptionTitles();const e=this.submenuSelect.entity,t=this.hass.states[e],n=t?.attributes?.options;if(!t||!n)return;const a={icon:zb("select"),...Pb(this.hass,this.submenuSelect),...this.submenuSelect,type:"custom:frigate-card-menu-submenu",items:[]};delete a.options;const i=a.items;for(const a of n){const n=this._optionTitles?.[a]??a;i.push({state_color:!0,selected:t.state===a,enabled:!0,title:n||a,...(e.startsWith("select.")||e.startsWith("input_select."))&&{tap_action:{action:"perform-action",perform_action:e.startsWith("select.")?"select.select_option":"input_select.select_option",target:{entity_id:e},data:{option:a}}},...this.submenuSelect.options&&this.submenuSelect.options[a]})}this._generatedSubmenu=a}render(){return q` `}};e([he({attribute:!1})],Qk.prototype,"hass",void 0),e([he({attribute:!1})],Qk.prototype,"submenuSelect",void 0),e([he({attribute:!1})],Qk.prototype,"entityRegistryManager",void 0),e([pe()],Qk.prototype,"_optionTitles",void 0),Qk=e([le("frigate-card-submenu-select")],Qk);let Gk=class extends se{constructor(){super(...arguments),this._controller=new Vk(this)}set menuConfig(e){this._controller.setMenuConfig(e)}set buttons(e){this._controller.setButtons(e)}set expanded(e){this._controller.setExpanded(e)}toggleMenu(){this._controller.toggleExpanded()}_renderButton(e){if(!this.hass)return;if("custom:frigate-card-menu-submenu"===e.type)return q` this._controller.actionHandler(e)} + > + `;if("custom:frigate-card-menu-submenu-select"===e.type)return q` this._controller.actionHandler(e)} + > + `;const t=this._controller.getFreshButtonState(this.hass,e),n=Uk(t.icon);return q` this._controller.actionHandler(t,e)} + > + ${n?q``:q``} + `}render(){const e=this._controller.getMenuConfig(),t=e?.style;if(!e||"none"===t)return;const n=this._controller.getButtons("matching"),a=this._controller.getButtons("opposing");return q`
+ ${n.map((e=>this._renderButton(e)))} +
+
+ ${a.map((e=>this._renderButton(e)))} +
`}static get styles(){return o('ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n --frigate-card-menu-button-size: 40px;\n --mdc-icon-button-size: var(--frigate-card-menu-button-size);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n pointer-events: auto;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n}\n\n/*******************************************************\n * Non-hover styles should not interact with the pointer\n *******************************************************/\n:host(:not([data-style*=hover])) {\n pointer-events: none;\n}\n\n/***********************************\n * Aligned divs: matching & opposing\n ***********************************/\ndiv.matching,\ndiv.opposing {\n display: flex;\n flex-wrap: wrap;\n flex-direction: row;\n align-items: flex-start;\n min-width: 0px;\n min-height: 0px;\n}\n\ndiv.matching {\n justify-content: flex-start;\n}\n\ndiv.opposing {\n justify-content: flex-end;\n}\n\n/********************\n * Outside menu style\n ********************/\n:host([data-style=outside]) {\n width: 100%;\n background: var(--secondary-background-color);\n}\n\n/********************************************************\n * Hack: Ensure host & div expand for column flex layouts\n ********************************************************/\n:host(:not([data-style=outside])[data-position=left]) {\n writing-mode: vertical-lr;\n}\n\n:host(:not([data-style=outside])[data-position=right]) {\n writing-mode: vertical-rl;\n}\n\n:host(:not([data-style=outside])[data-style=overlay][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style=overlay][data-position=right]) div > *,\n:host(:not([data-style=outside])[data-style*=hover][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style*=hover][data-position=right]) div > *,\n:host(:not([data-style=outside])[data-style=hidden][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style=hidden][data-position=right]) div > * {\n writing-mode: horizontal-tb;\n}\n\n/**********************\n * "Reverse" alignments\n **********************/\n:host(:not([data-style=outside])[data-position=left][data-alignment=bottom]),\n:host(:not([data-style=outside])[data-position=right][data-alignment=bottom]),\n:host([data-position=top][data-alignment=right]),\n:host([data-position=bottom][data-alignment=right]),\n:host(:not([data-style=outside])[data-position=left][data-alignment=bottom]) div,\n:host(:not([data-style=outside])[data-position=right][data-alignment=bottom]) div,\n:host([data-position=top][data-alignment=right]) div,\n:host([data-position=bottom][data-alignment=right]) div {\n flex-direction: row-reverse;\n}\n\n/****************************\n * Wrap upwards on the bottom\n ****************************/\n:host(:not([data-style=outside])[data-position=bottom]) div {\n flex-wrap: wrap-reverse;\n}\n\n/********************************************\n * Positioning for absolute based menu styles\n ********************************************/\n:host([data-style=overlay]),\n:host([data-style*=hover]),\n:host([data-style=hidden]) {\n overflow: hidden;\n width: calc(var(--frigate-card-menu-button-size) + 6px);\n height: calc(var(--frigate-card-menu-button-size) + 6px);\n}\n\n:host([data-style=overlay]),\n:host([data-style*=hover]),\n:host([data-style=hidden][expanded]) {\n overflow: visible;\n}\n\n:host([data-style=overlay][data-position=top]),\n:host([data-style=overlay][data-position=bottom]),\n:host([data-style*=hover][data-position=top]),\n:host([data-style*=hover][data-position=bottom]),\n:host([data-style=hidden][data-position=top]),\n:host([data-style=hidden][data-position=bottom]) {\n width: 100%;\n height: auto;\n}\n\n:host([data-style=overlay][data-position=top][data-alignment=left]),\n:host([data-style=overlay][data-position=bottom][data-alignment=left]),\n:host([data-style*=hover][data-position=top][data-alignment=left]),\n:host([data-style*=hover][data-position=bottom][data-alignment=left]),\n:host([data-style=hidden][data-position=top][data-alignment=left][expanded]),\n:host([data-style=hidden][data-position=bottom][data-alignment=left][expanded]) {\n background: linear-gradient(90deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=top][data-alignment=right]),\n:host([data-style=overlay][data-position=bottom][data-alignment=right]),\n:host([data-style*=hover][data-position=top][data-alignment=right]),\n:host([data-style*=hover][data-position=bottom][data-alignment=right]),\n:host([data-style=hidden][data-position=top][data-alignment=right][expanded]),\n:host([data-style=hidden][data-position=bottom][data-alignment=right][expanded]) {\n background: linear-gradient(270deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=left]),\n:host([data-style=overlay][data-position=right]),\n:host([data-style*=hover][data-position=left]),\n:host([data-style*=hover][data-position=right]),\n:host([data-style=hidden][data-position=left]),\n:host([data-style=hidden][data-position=right]) {\n width: auto;\n height: 100%;\n}\n\n:host([data-style=overlay][data-position=left][data-alignment=top]),\n:host([data-style=overlay][data-position=right][data-alignment=top]),\n:host([data-style*=hover][data-position=left][data-alignment=top]),\n:host([data-style*=hover][data-position=right][data-alignment=top]),\n:host([data-style=hidden][data-position=left][data-alignment=top][expanded]),\n:host([data-style=hidden][data-position=right][data-alignment=top][expanded]) {\n background: linear-gradient(180deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=left][data-alignment=bottom]),\n:host([data-style=overlay][data-position=right][data-alignment=bottom]),\n:host([data-style*=hover][data-position=left][data-alignment=bottom]),\n:host([data-style*=hover][data-position=right][data-alignment=bottom]),\n:host([data-style=hidden][data-position=left][data-alignment=bottom][expanded]),\n:host([data-style=hidden][data-position=right][data-alignment=bottom][expanded]) {\n background: linear-gradient(0deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}')}};e([he({attribute:!1})],Gk.prototype,"entityRegistryManager",void 0),e([he({attribute:!1})],Gk.prototype,"hass",void 0),Gk=e([le("frigate-card-menu")],Gk);let Yk=class extends se{render(){return q` + + + + + `}static get styles(){return o("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n position: absolute;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n\nslot {\n position: absolute;\n display: flex;\n}\n\n/***************\n * Slot position\n ***************/\nslot[name=top] {\n top: 0px;\n}\n\nslot[name=bottom] {\n bottom: 0px;\n}\n\nslot[name=left] {\n left: 0px;\n}\n\nslot[name=right] {\n right: 0px;\n}\n\n/***********\n * Slot size\n ***********/\nslot[name=top],\nslot[name=bottom] {\n width: 100%;\n flex-direction: column;\n}\n\nslot[name=left],\nslot[name=right] {\n height: 100%;\n flex-direction: row;\n}\n\nslot[name=top],\nslot[name=left] {\n justify-content: flex-start;\n}\n\nslot[name=bottom],\nslot[name=right] {\n justify-content: flex-end;\n}\n\n/*******************************\n * Match rounded corners to card\n *******************************/\n::slotted([slot=top]:first-child),\n::slotted([slot=left]:first-child) {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=top]:first-child),\n::slotted([slot=right]:first-child) {\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=bottom]:last-child),\n::slotted([slot=left]:last-child) {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=bottom]:last-child),\n::slotted([slot=right]:last-child) {\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}")}};Yk=e([le("frigate-card-overlay")],Yk);class Kk{constructor(e){this._config=null,this._popupTimer=new xf,this._items=[],this._host=e}getRenderItems(){return this._items}setItems(e){const t=e.filter((e=>!!e.exclusive)),n=Ev(t.length?t:e,(e=>e.priority??50),"desc"),a=this._getSufficientValues(this._items),i=this._getSufficientValues(n);this._items=n,"popup"!==this._config?.style||Dv(a,i)||(this._show(),this._popupTimer.start(this._config.popup_seconds,(()=>this._hide()))),this._host.requestUpdate()}setConfig(e){this._config=e,this._host.style.setProperty("--frigate-card-status-bar-height",`${e.height}px`),this._host.setAttribute("data-style",e.style),this._host.setAttribute("data-position",e.position),"popup"!==this._config?.style&&this._show(),this._host.requestUpdate()}shouldRender(){return this._items.some((e=>!1!==e.enabled&&e.sufficient))}actionHandler(e,t){e.stopPropagation();const n=yf(e.detail.action,t);n&&Fk(this._host,{action:Wg(n),config:t})}_getSufficientValue(e){ +/* istanbul ignore else: cannot happen -- @preserve */ +return"custom:frigate-card-status-bar-icon"===e.type?e.icon:"custom:frigate-card-status-bar-string"===e.type?e.string:"custom:frigate-card-status-bar-image"===e.type?e.image:null}_getSufficientValues(e){return e.filter((e=>!1!==e.enabled&&e.sufficient)).map((e=>this._getSufficientValue(e)))}_show(){of(this._host,!1,"hide")}_hide(){of(this._host,!0,"hide")}}let Xk=class extends se{constructor(){super(...arguments),this._controller=new Kk(this)}willUpdate(e){e.has("config")&&this.config&&this._controller.setConfig(this.config),e.has("items")&&this._controller.setItems(this.items??[])}render(){if(this._controller.shouldRender())return q` +
+ ${this._controller.getRenderItems().map((e=>{if(!1===e.enabled)return;const t=_e({item:!0,expand:!!e.expand,action:!!Object.keys(e.actions??{}).length}),n=kf({hasHold:bf(e.actions?.hold_action),hasDoubleClick:bf(e.actions?.double_tap_action)});if("custom:frigate-card-status-bar-string"===e.type)return q`
this._controller.actionHandler(t,e.actions)} + > + ${e.string} +
`;if("custom:frigate-card-status-bar-icon"===e.type){const a=Uk(e.icon);return a?q`this._controller.actionHandler(t,e.actions)} + />`:q`this._controller.actionHandler(t,e.actions)} + >`}return"custom:frigate-card-status-bar-image"===e.type?q`this._controller.actionHandler(t,e.actions)} + />`:void 0}))} +
+ `}static get styles(){return o("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n --mdc-icon-button-size: calc(var(--frigate-card-status-bar-height) - 6px);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n display: block;\n width: 100%;\n pointer-events: auto;\n opacity: 1;\n transition: opacity 1s;\n}\n\n/*******************************************************\n * Non-hover styles should not interact with the pointer\n *******************************************************/\n:host(:not([data-style*=hover])) {\n pointer-events: none;\n}\n\n/***************\n * Outside style\n ***************/\n:host([data-style=outside]) {\n color: var(--primary-text-color);\n background: var(--secondary-background-color);\n}\n\n/*******************\n * Non-outside style\n *******************/\n:host(:not([data-style=outside])) {\n color: white;\n background: linear-gradient(90deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=popup][hide]) {\n opacity: 0;\n}\n\n/*********************\n * Status bar contents\n *********************/\n.status {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n overflow: hidden;\n width: 100%;\n height: var(--frigate-card-status-bar-height);\n}\n\n.item {\n display: inline-block;\n margin: 3px;\n padding: 3px;\n align-content: center;\n opacity: 0.7;\n}\n\n.item:first-child {\n margin-left: 10px;\n}\n\n.item:last-child {\n margin-right: 10px;\n}\n\n.item.expand {\n flex: 1;\n}\n\n.item.action {\n cursor: pointer;\n}\n\nimg.item {\n width: var(--mdc-icon-size, 24px);\n height: var(--mdc-icon-size, 24px);\n}")}};e([he({attribute:!1})],Xk.prototype,"items",void 0),e([he({attribute:!1})],Xk.prototype,"config",void 0),Xk=e([le("frigate-card-status-bar")],Xk);function Jk(e){return"number"==typeof e}function eS(e){return"string"==typeof e}function tS(e){return"boolean"==typeof e}function nS(e){return"[object Object]"===Object.prototype.toString.call(e)}function aS(e){return Math.abs(e)}function iS(e){return Math.sign(e)}function rS(e,t){return aS(e-t)}function oS(e){return uS(e).map(Number)}function sS(e){return e[cS(e)]}function cS(e){return Math.max(0,e.length-1)}function lS(e,t){return t===cS(e)}function dS(e,t=0){return Array.from(Array(e),((e,n)=>t+n))}function uS(e){return Object.keys(e)}function hS(e,t){return[e,t].reduce(((e,t)=>(uS(t).forEach((n=>{const a=e[n],i=t[n],r=nS(a)&&nS(i);e[n]=r?hS(a,i):i})),e)),{})}function pS(e,t){return void 0!==t.MouseEvent&&e instanceof t.MouseEvent}function mS(){let e=[];const t={add:function(n,a,i,r={passive:!0}){let o;if("addEventListener"in n)n.addEventListener(a,i,r),o=()=>n.removeEventListener(a,i,r);else{const e=n;e.addListener(i),o=()=>e.removeListener(i)}return e.push(o),t},clear:function(){e=e.filter((e=>e()))}};return t}function gS(e,t,n,a){const i=mS(),r=1e3/60;let o=null,s=0,c=0;function l(e){if(!c)return;o||(o=e);const i=e-o;for(o=e,s+=i;s>=r;)n(r),s-=r;a(s/r),c&&t.requestAnimationFrame(l)}function d(){t.cancelAnimationFrame(c),o=null,s=0,c=0}return{init:function(){i.add(e,"visibilitychange",(()=>{e.hidden&&(o=null,s=0)}))},destroy:function(){d(),i.clear()},start:function(){c||(c=t.requestAnimationFrame(l))},stop:d,update:()=>n(r),render:a}}function fS(e=0,t=0){const n=aS(e-t);function a(t){return tt}function r(e){return a(e)||i(e)}const o={length:n,max:t,min:e,constrain:function(n){return r(n)?a(n)?e:t:n},reachedAny:r,reachedMax:i,reachedMin:a,removeOffset:function(e){return n?e-n*Math.ceil((e-t)/n):e}};return o}function _S(e,t,n){const{constrain:a}=fS(0,e),i=e+1;let r=o(t);function o(e){return n?aS((i+e)%i):a(e)}function s(){return r}function c(){return _S(e,s(),n)}const l={get:s,set:function(e){return r=o(e),l},add:function(e){return c().set(s()+e)},clone:c};return l}function vS(e,t,n,a,i,r,o,s,c,l,d,u,h,p,m,g,f,_,v){const{cross:y,direction:b}=e,w=["INPUT","SELECT","TEXTAREA"],x={passive:!1},C=mS(),M=mS(),k=fS(50,225).constrain(p.measure(20)),S={mouse:300,touch:400},E={mouse:500,touch:600},$=m?43:25;let A=!1,z=0,I=0,T=!1,j=!1,O=!1,D=!1;function R(e){if(!pS(e,a)&&e.touches.length>=2)return P(e);const t=r.readPoint(e),n=r.readPoint(e,y),o=rS(t,z),c=rS(n,I);if(!j&&!D){if(!e.cancelable)return P(e);if(j=o>c,!j)return P(e)}const d=r.pointerMove(e);o>g&&(O=!0),l.useFriction(.3).useDuration(.75),s.start(),i.add(b(d)),e.preventDefault()}function P(e){const t=d.byDistance(0,!1).index!==u.get(),n=r.pointerUp(e)*(m?E:S)[D?"mouse":"touch"],a=function(e,t){const n=u.add(-1*iS(e)),a=d.byDistance(e,!m).distance;return m||aS(e)=2,s&&0!==e.button)return;if(function(e){const t=e.nodeName||"";return w.includes(t)}(e.target))return;T=!0,r.pointerDown(e),l.useFriction(0).useDuration(0),i.set(o),function(){const e=D?n:t;M.add(e,"touchmove",R,x).add(e,"touchend",P).add(e,"mousemove",R,x).add(e,"mouseup",P)}(),z=r.readPoint(e),I=r.readPoint(e,y),h.emit("pointerDown")}(s)}const c=t;C.add(c,"dragstart",(e=>e.preventDefault()),x).add(c,"touchmove",(()=>{}),x).add(c,"touchend",(()=>{})).add(c,"touchstart",s).add(c,"mousedown",s).add(c,"touchcancel",P).add(c,"contextmenu",P).add(c,"click",L,!0)},destroy:function(){C.clear(),M.clear()},pointerDown:function(){return T}}}function yS(e,t){let n,a;function i(e){return e.timeStamp}function r(n,a){const i="client"+("x"===(a||e.scroll)?"X":"Y");return(pS(n,t)?n:n.touches[0])[i]}return{pointerDown:function(e){return n=e,a=e,r(e)},pointerMove:function(e){const t=r(e)-r(a),o=i(e)-i(n)>170;return a=e,o&&(n=e),t},pointerUp:function(e){if(!n||!a)return 0;const t=r(a)-r(n),o=i(e)-i(n),s=i(e)-i(a)>170,c=t/o;return o&&!s&&aS(c)>.1?c:0},readPoint:r}}function bS(e,t,n,a,i,r,o){const s=[e].concat(a);let c,l,d=[],u=!1;function h(e){return i.measureSize(o.measure(e))}return{init:function(i){r&&(l=h(e),d=a.map(h),c=new ResizeObserver((n=>{(tS(r)||r(i,n))&&function(n){for(const r of n){if(u)return;const n=r.target===e,o=a.indexOf(r.target),s=n?l:d[o];if(aS(h(n?e:a[o])-s)>=.5){i.reInit(),t.emit("resize");break}}}(n)})),n.requestAnimationFrame((()=>{s.forEach((e=>c.observe(e)))})))},destroy:function(){u=!0,c&&c.disconnect()}}}function wS(e,t,n,a,i){const r=i.measure(10),o=i.measure(50),s=fS(.1,.99);let c=!1;function l(){return!c&&(!!e.reachedAny(n.get())&&!!e.reachedAny(t.get()))}return{shouldConstrain:l,constrain:function(i){if(!l())return;const c=e.reachedMin(t.get())?"min":"max",d=aS(e[c]-t.get()),u=n.get()-t.get(),h=s.constrain(d/o);n.subtract(u*h),!i&&aS(u)e.add(i)))}};return c}function CS(e,t,n,a,i){const{reachedAny:r,removeOffset:o,constrain:s}=a;function c(e){return e.concat().sort(((e,t)=>aS(e)-aS(t)))[0]}function l(t,a){const i=[t,t+n,t-n];if(!e)return t;if(!a)return c(i);const r=i.filter((e=>iS(e)===a));return r.length?c(r):sS(i)-n}return{byDistance:function(n,a){const c=i.get()+n,{index:d,distance:u}=function(n){const a=e?o(n):s(n),i=t.map(((e,t)=>({diff:l(e-a,0),index:t}))).sort(((e,t)=>aS(e.diff)-aS(t.diff))),{index:r}=i[0];return{index:r,distance:a}}(c),h=!e&&r(c);return!a||h?{index:d,distance:n}:{index:d,distance:n+l(t[d]-u,0)}},byIndex:function(e,n){return{index:e,distance:l(t[e]-i.get(),n)}},shortcut:l}}function MS(e,t,n,a,i,r,o,s){const c={passive:!0,capture:!0};let l=0;function d(e){"Tab"===e.code&&(l=(new Date).getTime())}return{init:function(u){s&&(r.add(document,"keydown",d,!1),t.forEach(((t,d)=>{r.add(t,"focus",(t=>{(tS(s)||s(u,t))&&function(t){if((new Date).getTime()-l>10)return;o.emit("slideFocusStart"),e.scrollLeft=0;const r=n.findIndex((e=>e.includes(t)));Jk(r)&&(i.useDuration(0),a.index(r,0),o.emit("slideFocus"))}(d)}),c)})))}}}function kS(e){let t=e;function n(e){return Jk(e)?e:e.get()}const a={get:function(){return t},set:function(e){t=n(e)},add:function(e){t+=n(e)},subtract:function(e){t-=n(e)}};return a}function SS(e,t){const n="x"===e.scroll?function(e){return`translate3d(${e}px,0px,0px)`}:function(e){return`translate3d(0px,${e}px,0px)`},a=t.style;let i=!1;return{clear:function(){i||(a.transform="",t.getAttribute("style")||t.removeAttribute("style"))},to:function(t){i||(a.transform=n(e.direction(t)))},toggleActive:function(e){i=!e}}}function ES(e,t,n,a,i,r,o,s,c){const l=.5,d=oS(i),u=oS(i).reverse(),h=function(){const e=o[0];return g(m(u,e),n,!1)}().concat(function(){const e=t-o[0]-1;return g(m(d,e),-n,!0)}());function p(e,t){return e.reduce(((e,t)=>e-i[t]),t)}function m(e,t){return e.reduce(((e,n)=>p(e,t)>0?e.concat([n]):e),[])}function g(i,o,d){const u=function(e){return r.map(((n,i)=>({start:n-a[i]+l+e,end:n+t-l+e})))}(o);return i.map((t=>{const a=d?0:-n,i=d?n:0,r=d?"end":"start",o=u[t][r];return{index:t,loopPoint:o,slideLocation:kS(-1),translate:SS(e,c[t]),target:()=>s.get()>o?a:i}}))}const f={canLoop:function(){return h.every((({index:e})=>{const n=d.filter((t=>t!==e));return p(n,t)<=.1}))},clear:function(){h.forEach((e=>e.translate.clear()))},loop:function(){h.forEach((e=>{const{target:t,translate:n,slideLocation:a}=e,i=t();i!==a.get()&&(n.to(i),a.set(i))}))},loopPoints:h};return f}function $S(e,t,n){let a,i=!1;return{init:function(r){n&&(a=new MutationObserver((e=>{i||(tS(n)||n(r,e))&&function(e){for(const n of e)if("childList"===n.type){r.reInit(),t.emit("slidesChanged");break}}(e)})),a.observe(e,{childList:!0}))},destroy:function(){a&&a.disconnect(),i=!0}}}function AS(e,t,n,a){const i={};let r,o=null,s=null,c=!1;return{init:function(){r=new IntersectionObserver((e=>{c||(e.forEach((e=>{const n=t.indexOf(e.target);i[n]=e})),o=null,s=null,n.emit("slidesInView"))}),{root:e.parentElement,threshold:a}),t.forEach((e=>r.observe(e)))},destroy:function(){r&&r.disconnect(),c=!0},get:function(e=!0){if(e&&o)return o;if(!e&&s)return s;const t=function(e){return uS(i).reduce(((t,n)=>{const a=parseInt(n),{isIntersecting:r}=i[a];return(e&&r||!e&&!r)&&t.push(a),t}),[])}(e);return e&&(o=t),e||(s=t),t}}}function zS(e,t,n,a,i,r,o,s,c){const{startEdge:l,endEdge:d,direction:u}=e,h=Jk(n);const p={groupSlides:function(e){return h?function(e,t){return oS(e).filter((e=>e%t==0)).map((n=>e.slice(n,n+t)))}(e,n):function(e){return e.length?oS(e).reduce(((n,h,p)=>{const m=sS(n)||0,g=0===m,f=h===cS(e),_=i[l]-r[m][l],v=i[l]-r[h][d],y=!a&&g?u(o):0,b=aS(v-(!a&&f?u(s):0)-(_+y));return p&&b>t+c&&n.push(h),f&&n.push(e.length),n}),[]).map(((t,n,a)=>{const i=Math.max(a[n-1]||0);return e.slice(i,t)})):[]}(e)}};return p}function IS(e,t,n,a,i,r,o){const{align:s,axis:c,direction:l,startIndex:d,loop:u,duration:h,dragFree:p,dragThreshold:m,inViewThreshold:g,slidesToScroll:f,skipSnaps:_,containScroll:v,watchResize:y,watchSlides:b,watchDrag:w,watchFocus:x}=r,C={measure:function(e){const{offsetTop:t,offsetLeft:n,offsetWidth:a,offsetHeight:i}=e;return{top:t,right:n+a,bottom:t+i,left:n,width:a,height:i}}},M=C.measure(t),k=n.map(C.measure),S=function(e,t){const n="rtl"===t,a="y"===e,i=!a&&n?-1:1,r={scroll:a?"y":"x",cross:a?"x":"y",startEdge:a?"top":n?"right":"left",endEdge:a?"bottom":n?"left":"right",measureSize:function(e){const{height:t,width:n}=e;return a?t:n},direction:function(e){return e*i}};return r}(c,l),E=S.measureSize(M),$=function(e){const t={measure:function(t){return e*(t/100)}};return t}(E),A=function(e,t){const n={start:function(){return 0},center:function(e){return a(e)/2},end:a};function a(e){return t-e}const i={measure:function(a,i){return eS(e)?n[e](a):e(t,a,i)}};return i}(s,E),z=!u&&!!v,I=u||!!v,{slideSizes:T,slideSizesWithGaps:j,startGap:O,endGap:D}=function(e,t,n,a,i,r){const{measureSize:o,startEdge:s,endEdge:c}=e,l=n[0]&&i,d=function(){if(!l)return 0;const e=n[0];return aS(t[s]-e[s])}(),u=function(){if(!l)return 0;const e=r.getComputedStyle(sS(a));return parseFloat(e.getPropertyValue(`margin-${c}`))}(),h=n.map(o),p=n.map(((e,t,n)=>{const a=!t,i=lS(n,t);return a?h[t]+d:i?h[t]+u:n[t+1][s]-e[s]})).map(aS);return{slideSizes:h,slideSizesWithGaps:p,startGap:d,endGap:u}}(S,M,k,n,I,i),R=zS(S,E,f,u,M,k,O,D,2),{snaps:P,snapsAligned:L}=function(e,t,n,a,i){const{startEdge:r,endEdge:o}=e,{groupSlides:s}=i,c=s(a).map((e=>sS(e)[o]-e[0][r])).map(aS).map(t.measure),l=a.map((e=>n[r]-e[r])).map((e=>-aS(e))),d=s(l).map((e=>e[0])).map(((e,t)=>e+c[t]));return{snaps:l,snapsAligned:d}}(S,A,M,k,R),N=-sS(P)+sS(j),{snapsContained:F,scrollContainLimit:V}=function(e,t,n,a,i){const r=fS(-t+e,0),o=n.map(((e,t)=>{const{min:a,max:i}=r,o=r.constrain(e),s=!t,l=lS(n,t);return s?i:l||c(a,o)?a:c(i,o)?i:o})).map((e=>parseFloat(e.toFixed(3)))),s=function(){const e=o[0],t=sS(o);return fS(o.lastIndexOf(e),o.indexOf(t)+1)}();function c(e,t){return rS(e,t)<1}return{snapsContained:function(){if(t<=e+i)return[r.max];if("keepSnaps"===a)return o;const{min:n,max:c}=s;return o.slice(n,c)}(),scrollContainLimit:s}}(E,N,L,v,2),H=z?F:L,{limit:B}=function(e,t,n){const a=t[0];return{limit:fS(n?a-e:sS(t),a)}}(N,H,u),q=_S(cS(H),d,u),U=q.clone(),W=oS(n),Z=gS(a,i,(e=>(({dragHandler:e,scrollBody:t,scrollBounds:n,options:{loop:a}},i)=>{a||n.constrain(e.pointerDown()),t.seek(i)})(se,e)),(e=>(({scrollBody:e,translate:t,location:n,offsetLocation:a,scrollLooper:i,slideLooper:r,dragHandler:o,animation:s,eventHandler:c,scrollBounds:l,options:{loop:d}},u)=>{const h=e.settled(),p=!l.shouldConstrain(),m=d?h:h&&p;m&&!o.pointerDown()&&(s.stop(),c.emit("settle")),m||c.emit("scroll");const g=n.get()*u+Y.get()*(1-u);a.set(g),d&&(i.loop(e.direction()),r.loop()),t.to(a.get())})(se,e))),Q=H[q.get()],G=kS(Q),Y=kS(Q),K=kS(Q),X=kS(Q),J=function(e,t,n,a,i,r){let o=0,s=0,c=i,l=r,d=e.get(),u=0;function h(e){return c=e,m}function p(e){return l=e,m}const m={direction:function(){return s},duration:function(){return c},velocity:function(){return o},seek:function(t){const i=t/1e3,r=c*i,h=a.get()-e.get();let p=0;return c?(n.set(e),o+=h/r,o*=l,d+=o,e.add(o*i),p=d-u):(o=0,n.set(a),e.set(a),p=h),s=iS(p),u=d,m},settled:function(){return aS(a.get()-t.get())<.001},useBaseFriction:function(){return p(r)},useBaseDuration:function(){return h(i)},useFriction:p,useDuration:h};return m}(G,K,Y,X,h,.68),ee=CS(u,H,N,B,X),te=function(e,t,n,a,i,r,o){function s(i){const s=i.distance,c=i.index!==t.get();r.add(s),s&&(a.duration()?e.start():(e.update(),e.render(1),e.update())),c&&(n.set(t.get()),t.set(i.index),o.emit("select"))}const c={distance:function(e,t){s(i.byDistance(e,t))},index:function(e,n){const a=t.clone().set(e);s(i.byIndex(a.get(),n))}};return c}(Z,q,U,J,ee,X,o),ne=function(e){const{max:t,length:n}=e,a={get:function(e){return n?(e-t)/-n:0}};return a}(B),ae=mS(),ie=AS(t,n,o,g),{slideRegistry:re}=function(e,t,n,a,i,r){const{groupSlides:o}=i,{min:s,max:c}=a;return{slideRegistry:function(){const a=o(r),i=!e||"keepSnaps"===t;return 1===n.length?[r]:i?a:a.slice(s,c).map(((e,t,n)=>{const a=!t,i=lS(n,t);return a?dS(sS(n[0])+1):i?dS(cS(r)-sS(n)[0]+1,sS(n)[0]):e}))}()}}(z,v,H,V,R,W),oe=MS(e,n,re,te,J,ae,o,x),se={ownerDocument:a,ownerWindow:i,eventHandler:o,containerRect:M,slideRects:k,animation:Z,axis:S,dragHandler:vS(S,e,a,i,X,yS(S,i),G,Z,te,J,ee,q,o,$,p,m,_,.68,w),eventStore:ae,percentOfView:$,index:q,indexPrevious:U,limit:B,location:G,offsetLocation:K,previousLocation:Y,options:r,resizeHandler:bS(t,o,i,n,S,y,C),scrollBody:J,scrollBounds:wS(B,K,X,J,$),scrollLooper:xS(N,B,K,[G,K,Y,X]),scrollProgress:ne,scrollSnapList:H.map(ne.get),scrollSnaps:H,scrollTarget:ee,scrollTo:te,slideLooper:ES(S,E,N,T,j,P,H,K,n),slideFocus:oe,slidesHandler:$S(t,o,b),slidesInView:ie,slideIndexes:W,slideRegistry:re,slidesToScroll:R,target:X,translate:SS(S,t)};return se}const TS={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0,watchFocus:!0};function jS(e){function t(e,t){return hS(e,t||{})}const n={mergeOptions:t,optionsAtMedia:function(n){const a=n.breakpoints||{},i=uS(a).filter((t=>e.matchMedia(t).matches)).map((e=>a[e])).reduce(((e,n)=>t(e,n)),{});return t(n,i)},optionsMediaQueries:function(t){return t.map((e=>uS(e.breakpoints||{}))).reduce(((e,t)=>e.concat(t)),[]).map(e.matchMedia)}};return n}function OS(e,t,n){const a=e.ownerDocument,i=a.defaultView,r=jS(i),o=function(e){let t=[];const n={init:function(n,a){return t=a.filter((({options:t})=>!1!==e.optionsAtMedia(t).active)),t.forEach((t=>t.init(n,e))),a.reduce(((e,t)=>Object.assign(e,{[t.name]:t})),{})},destroy:function(){t=t.filter((e=>e.destroy()))}};return n}(r),s=mS(),c=function(){let e,t={};function n(e){return t[e]||[]}const a={init:function(t){e=t},emit:function(t){return n(t).forEach((n=>n(e,t))),a},off:function(e,i){return t[e]=n(e).filter((e=>e!==i)),a},on:function(e,i){return t[e]=n(e).concat([i]),a},clear:function(){t={}}};return a}(),{mergeOptions:l,optionsAtMedia:d,optionsMediaQueries:u}=r,{on:h,off:p,emit:m}=c,g=S;let f,_,v,y,b=!1,w=l(TS,OS.globalOptions),x=l(w),C=[];function M(t){const n=IS(e,v,y,a,i,t,c);if(t.loop&&!n.slideLooper.canLoop()){return M(Object.assign({},t,{loop:!1}))}return n}function k(t,n){b||(w=l(w,t),x=d(w),C=n||C,function(){const{container:t,slides:n}=x,a=eS(t)?e.querySelector(t):t;v=a||e.children[0];const i=eS(n)?v.querySelectorAll(n):n;y=[].slice.call(i||v.children)}(),f=M(x),u([w,...C.map((({options:e})=>e))]).forEach((e=>s.add(e,"change",S))),x.active&&(f.translate.to(f.location.get()),f.animation.init(),f.slidesInView.init(),f.slideFocus.init(z),f.eventHandler.init(z),f.resizeHandler.init(z),f.slidesHandler.init(z),f.options.loop&&f.slideLooper.loop(),v.offsetParent&&y.length&&f.dragHandler.init(z),_=o.init(z,C)))}function S(e,t){const n=A();E(),k(l({startIndex:n},e),t),c.emit("reInit")}function E(){f.dragHandler.destroy(),f.eventStore.clear(),f.translate.clear(),f.slideLooper.clear(),f.resizeHandler.destroy(),f.slidesHandler.destroy(),f.slidesInView.destroy(),f.animation.destroy(),o.destroy(),s.clear()}function $(e,t,n){x.active&&!b&&(f.scrollBody.useBaseFriction().useDuration(!0===t?0:x.duration),f.scrollTo.index(e,n||0))}function A(){return f.index.get()}const z={canScrollNext:function(){return f.index.add(1).get()!==A()},canScrollPrev:function(){return f.index.add(-1).get()!==A()},containerNode:function(){return v},internalEngine:function(){return f},destroy:function(){b||(b=!0,s.clear(),E(),c.emit("destroy"),c.clear())},off:p,on:h,emit:m,plugins:function(){return _},previousScrollSnap:function(){return f.indexPrevious.get()},reInit:g,rootNode:function(){return e},scrollNext:function(e){$(f.index.add(1).get(),e,-1)},scrollPrev:function(e){$(f.index.add(-1).get(),e,1)},scrollProgress:function(){return f.scrollProgress.get(f.location.get())},scrollSnapList:function(){return f.scrollSnapList},scrollTo:$,selectedScrollSnap:A,slideNodes:function(){return y},slidesInView:function(){return f.slidesInView.get()},slidesNotInView:function(){return f.slidesInView.get(!1)}};return k(t,n),setTimeout((()=>c.emit("init")),0),z}function DS(){return DS=Object.assign||function(e){for(var t=1;t=e;case"y":return Math.abs(i)>=e;case"z":return Math.abs(r)>=e;default:return!1}}(r,a)&&e.preventDefault(),l.isStarted?l.isMomentum&&r>Math.max(2,2*l.lastAbsDelta)&&(M(!0),x()):x(),0===r&&Object.is&&Object.is(e.deltaX,-0)?d=!0:(t=e,l.axisMovement=PS(l.axisMovement,a),l.lastAbsDelta=r,l.scrollPointsToMerge.push({axisDelta:a,timeStamp:i}),g(),p({axisDelta:a,isStart:!l.isStartPublished}),l.isStartPublished=!0,C())},g=function(){var e;l.scrollPointsToMerge.length===US?(l.scrollPoints.unshift({axisDeltaSum:l.scrollPointsToMerge.map((function(e){return e.axisDelta})).reduce(PS),timeStamp:(e=l.scrollPointsToMerge.map((function(e){return e.timeStamp})),e.reduce((function(e,t){return e+t}))/e.length)}),_(),l.scrollPointsToMerge.length=0,l.scrollPoints.length=1,l.isMomentum||b()):l.isStartPublished||f()},f=function(){var e;l.axisVelocity=(e=l.scrollPointsToMerge,e[e.length-1]).axisDelta.map((function(e){return e/l.willEndTimeout}))},_=function(){var e=l.scrollPoints,t=e[0],n=e[1];if(n&&t){var a=t.timeStamp-n.timeStamp;if(!(a<=0)){var i=t.axisDeltaSum.map((function(e){return e/a})),r=i.map((function(e,t){return e/(l.axisVelocity[t]||1)}));l.axisVelocity=i,l.accelerationFactors.push(r),v(a)}}},v=function(e){var t=10*Math.ceil(e/10)*1.2;l.isMomentum||(t=Math.max(100,2*t)),l.willEndTimeout=Math.min(1e3,Math.round(t))},y=function(e){return 0===e||e<=qS&&e>=BS},b=function(){if(l.accelerationFactors.length>=WS){if(d&&(d=!1,LS(l.axisVelocity)>=.2))return void w();var e=l.accelerationFactors.slice(-1*WS);e.every((function(e){var t=!!e.reduce((function(e,t){return e&&e<1&&e===t?1:0})),n=e.filter(y).length===e.length;return t||n}))&&w(),l.accelerationFactors=e}},w=function(){l.isMomentum=!0},x=function(){(l=GS()).isStarted=!0,l.startTime=Date.now(),n=void 0,d=!1},C=function(){clearTimeout(a),a=setTimeout(M,l.willEndTimeout)},M=function(e){void 0===e&&(e=!1),l.isStarted&&(l.isMomentum&&e?p({isEnding:!0,isMomentumCancel:!0}):p({isEnding:!0}),l.isMomentum=!1,l.isStarted=!1)},k=function(e){var t=[],n=function(n){n.removeEventListener("wheel",e),t=t.filter((function(e){return e!==n}))};return NS({observe:function(a){return a.addEventListener("wheel",e,{passive:!1}),t.push(a),function(){return n(a)}},unobserve:n,disconnect:function(){t.forEach(n)}})}(u),S=k.observe,E=k.unobserve,$=k.disconnect;return h(e),NS({on:r,off:o,observe:S,unobserve:E,disconnect:$,feedWheel:u,updateOptions:h})}var KS={active:!0,breakpoints:{},wheelDraggingClass:"is-wheel-dragging",forceWheelAxis:void 0,target:void 0};function XS(e){var t;void 0===e&&(e={});var n=function(){};var a={name:"wheelGestures",options:e,init:function(a,i){var r,o,s=i.mergeOptions,c=i.optionsAtMedia,l=s(KS,XS.globalOptions),d=s(l,e);t=c(d);var u,h=a.internalEngine(),p=null!=(r=t.target)?r:a.containerNode().parentNode,m=null!=(o=t.forceWheelAxis)?o:h.options.axis,g=YS({preventWheelAction:m,reverseSign:[!0,!0,!1]}),f=g.observe(p),_=g.on("wheel",(function(e){var a=e.axisDelta,i=a[0],r=a[1],o="x"===m?i:r,s="x"===m?r:i,c=e.isMomentum&&e.previous&&!e.previous.isMomentum,l=e.isEnding&&!e.isMomentum||c;Math.abs(o)>Math.abs(s)&&!v&&!e.isMomentum&&function(e){try{x(u=new MouseEvent("mousedown",e.event))}catch(e){return n()}v=!0,document.documentElement.addEventListener("mousemove",b,!0),document.documentElement.addEventListener("mouseup",b,!0),void document.documentElement.addEventListener("mousedown",b,!0),t.wheelDraggingClass&&p.classList.add(t.wheelDraggingClass)}(e);if(!v)return;l?function(e){v=!1,x(w("mouseup",e)),y(),t.wheelDraggingClass&&p.classList.remove(t.wheelDraggingClass)}(e):x(w("mousemove",e))})),v=!1;function y(){document.documentElement.removeEventListener("mousemove",b,!0),document.documentElement.removeEventListener("mouseup",b,!0),document.documentElement.removeEventListener("mousedown",b,!0)}function b(e){v&&e.isTrusted&&e.stopImmediatePropagation()}function w(e,t){var n,a;if(m===h.options.axis){var i=t.axisMovement;n=i[0],a=i[1]}else{var r=t.axisMovement;a=r[0],n=r[1]}if(!h.options.skipSnaps&&!h.options.dragFree){var o=h.containerRect.width,s=h.containerRect.height;n=n<0?Math.max(n,-o):Math.min(n,o),a=a<0?Math.max(a,-s):Math.min(a,s)}return new MouseEvent(e,{clientX:u.clientX+n,clientY:u.clientY+a,screenX:u.screenX+n,screenY:u.screenY+a,movementX:n,movementY:a,button:0,bubbles:!0,cancelable:!0,composed:!0})}function x(e){a.containerNode().dispatchEvent(e)}n=function(){f(),_(),y()}},destroy:function(){return n()}};return a}XS.globalOptions=void 0;class JS{constructor(e,t,n){this._mutationObserver=new MutationObserver(((e,t)=>this._refreshCarouselContents())),this._refreshCarouselContents=()=>{const e=lf(this._parent);!Dv(this._carousel.slideNodes(),e)&&(this._carousel.destroy(),this._carousel=this._createCarousel(e))},this._root=e,this._parent=t,this._direction=n?.direction??"horizontal",this._transitionEffect=n?.transitionEffect??"slide",this._startIndex=n?.startIndex??0,this._dragFree=n?.dragFree??!1,this._loop=n?.loop??!1,this._draggable=n?.dragEnabled??!0,this._plugins=n?.plugins??[],this._carousel=this._createCarousel(lf(this._parent)),t instanceof HTMLSlotElement&&t.addEventListener("slotchange",this._refreshCarouselContents),this._mutationObserver.observe(this._parent,{childList:!0})}destroy(){this._parent instanceof HTMLSlotElement&&this._parent.removeEventListener("slotchange",this._refreshCarouselContents),this._mutationObserver.disconnect(),this._carousel.destroy()}getSlide(e){return this._carousel.slideNodes()[e]??null}getSelectedSlide(){return this.getSlide(this.getSelectedIndex())}getSelectedIndex(){return this._carousel.selectedScrollSnap()}selectSlide(e){this._carousel.scrollTo(e,"none"===this._transitionEffect);const t=this.getSlide(e);t&&Bg(this._parent,"carousel:force-select",{index:e,element:t})}_createCarousel(e){const t=OS(this._root,{slides:e,axis:"horizontal"===this._direction?"x":"y",duration:20,startIndex:this._startIndex,dragFree:this._dragFree,loop:this._loop,containScroll:"trimSnaps",watchSlides:!1,watchResize:!0,watchDrag:this._draggable},[...this._plugins,...e.length>1?[XS({forceWheelAxis:"y"})]:[]]),n=()=>{const e=(()=>{const e=t.selectedScrollSnap(),n=t.slideNodes()[e]??null;return n?{index:e,element:n}:null})();e&&Bg(this._parent,"carousel:select",e)};return t.on("select",(()=>n())),t}}let eE=class extends se{constructor(){super(...arguments),this.direction="horizontal",this.dragEnabled=!0,this.selected=0,this._refParent=ze(),this._refRoot=ze(),this._carousel=null}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._carousel?.destroy(),this._carousel=null,super.disconnectedCallback()}willUpdate(e){e.has("direction")&&this.setAttribute("direction",this.direction);["direction","dragEnabled","dragFree","loop","plugins","transitionEffect"].some((t=>e.has(t)))&&(this._carousel?.destroy(),this._carousel=null)}render(){return q`
+ +
+
+ +
+
+ +
`}updated(e){!this._carousel&&this._refRoot.value&&this._refParent.value?this._carousel=new JS(this._refRoot.value,this._refParent.value,{direction:this.direction,dragEnabled:this.dragEnabled,dragFree:this.dragFree,startIndex:this.selected,transitionEffect:this.transitionEffect,loop:this.loop,plugins:this.plugins}):e.has("selected")&&this._carousel?.selectSlide(this.selected)}static get styles(){return o(":host {\n display: block;\n height: 100%;\n width: 100%;\n position: relative;\n}\n\n.embla {\n width: 100%;\n height: 100%;\n margin-left: auto;\n margin-right: auto;\n}\n\n.embla__container {\n display: flex;\n width: 100%;\n height: 100%;\n user-select: none;\n -webkit-touch-callout: none;\n -khtml-user-select: none;\n -webkit-tap-highlight-color: transparent;\n}\n\n:host([direction=vertical]) .embla__container {\n flex-direction: column;\n}\n\n:host([direction=horizontal]) .embla__container {\n flex-direction: row;\n}\n\n.embla__viewport {\n width: 100%;\n height: 100%;\n overflow: hidden;\n display: flex;\n flex-direction: column;\n justify-content: center;\n}\n\n.embla__viewport.is-draggable {\n cursor: move;\n cursor: grab;\n}\n\n.embla__viewport.is-dragging {\n cursor: grabbing;\n}\n\n:host([direction=vertical]) ::slotted(.embla__slide) {\n margin-bottom: 5px;\n}\n\n:host([direction=horizontal]) ::slotted(.embla__slide) {\n margin-right: 5px;\n}")}};e([he({attribute:!0,reflect:!0})],eE.prototype,"direction",void 0),e([he({attribute:!0})],eE.prototype,"transitionEffect",void 0),e([he({attribute:!1})],eE.prototype,"loop",void 0),e([he({attribute:!1})],eE.prototype,"dragFree",void 0),e([he({attribute:!1})],eE.prototype,"dragEnabled",void 0),e([he({attribute:!1})],eE.prototype,"plugins",void 0),e([he({attribute:!1})],eE.prototype,"selected",void 0),eE=e([le("frigate-card-carousel")],eE); +/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const tE=window,nE=tE.ShadowRoot&&(void 0===tE.ShadyCSS||tE.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,aE=Symbol(),iE=new WeakMap;let rE=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==aE)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(nE&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=iE.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&iE.set(t,e))}return e}toString(){return this.cssText}};const oE=(e,t)=>{nE?e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):t.forEach((t=>{const n=document.createElement("style"),a=tE.litNonce;void 0!==a&&n.setAttribute("nonce",a),n.textContent=t.cssText,e.appendChild(n)}))},sE=nE?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return(e=>new rE("string"==typeof e?e:e+"",void 0,aE))(t)})(e):e +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */;var cE;const lE=window,dE=lE.trustedTypes,uE=dE?dE.emptyScript:"",hE=lE.reactiveElementPolyfillSupport,pE={toAttribute(e,t){switch(t){case Boolean:e=e?uE:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},mE=(e,t)=>t!==e&&(t==t||e==e),gE={attribute:!0,type:String,converter:pE,reflect:!1,hasChanged:mE},fE="finalized";class _E extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var t;this.finalize(),(null!==(t=this.h)&&void 0!==t?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach(((t,n)=>{const a=this._$Ep(n,t);void 0!==a&&(this._$Ev.set(a,n),e.push(a))})),e}static createProperty(e,t=gE){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){const n="symbol"==typeof e?Symbol():"__"+e,a=this.getPropertyDescriptor(e,n,t);void 0!==a&&Object.defineProperty(this.prototype,e,a)}}static getPropertyDescriptor(e,t,n){return{get(){return this[t]},set(a){const i=this[e];this[t]=a,this.requestUpdate(e,i,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||gE}static finalize(){if(this.hasOwnProperty(fE))return!1;this[fE]=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),void 0!==e.h&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const e=this.properties,t=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const n of t)this.createProperty(n,e[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(sE(e))}else void 0!==e&&t.push(sE(e));return t}static _$Ep(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(e=this.constructor.h)||void 0===e||e.forEach((e=>e(this)))}addController(e){var t,n;(null!==(t=this._$ES)&&void 0!==t?t:this._$ES=[]).push(e),void 0!==this.renderRoot&&this.isConnected&&(null===(n=e.hostConnected)||void 0===n||n.call(e))}removeController(e){var t;null===(t=this._$ES)||void 0===t||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])}))}createRenderRoot(){var e;const t=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return oE(t,this.constructor.elementStyles),t}connectedCallback(){var e;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostConnected)||void 0===t?void 0:t.call(e)}))}enableUpdating(e){}disconnectedCallback(){var e;null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostDisconnected)||void 0===t?void 0:t.call(e)}))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EO(e,t,n=gE){var a;const i=this.constructor._$Ep(e,n);if(void 0!==i&&!0===n.reflect){const r=(void 0!==(null===(a=n.converter)||void 0===a?void 0:a.toAttribute)?n.converter:pE).toAttribute(t,n.type);this._$El=e,null==r?this.removeAttribute(i):this.setAttribute(i,r),this._$El=null}}_$AK(e,t){var n;const a=this.constructor,i=a._$Ev.get(e);if(void 0!==i&&this._$El!==i){const e=a.getPropertyOptions(i),r="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==(null===(n=e.converter)||void 0===n?void 0:n.fromAttribute)?e.converter:pE;this._$El=i,this[i]=r.fromAttribute(t,e.type),this._$El=null}}requestUpdate(e,t,n){let a=!0;void 0!==e&&(((n=n||this.constructor.getPropertyOptions(e)).hasChanged||mE)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),!0===n.reflect&&this._$El!==e&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(e,n))):a=!1),!this.isUpdatePending&&a&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((e,t)=>this[t]=e)),this._$Ei=void 0);let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostUpdate)||void 0===t?void 0:t.call(e)})),this.update(n)):this._$Ek()}catch(e){throw t=!1,this._$Ek(),e}t&&this._$AE(n)}willUpdate(e){}_$AE(e){var t;null===(t=this._$ES)||void 0===t||t.forEach((e=>{var t;return null===(t=e.hostUpdated)||void 0===t?void 0:t.call(e)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){void 0!==this._$EC&&(this._$EC.forEach(((e,t)=>this._$EO(t,this[t],e))),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}}_E[fE]=!0,_E.elementProperties=new Map,_E.elementStyles=[],_E.shadowRootOptions={mode:"open"},null==hE||hE({ReactiveElement:_E}),(null!==(cE=lE.reactiveElementVersions)&&void 0!==cE?cE:lE.reactiveElementVersions=[]).push("1.6.3"); +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const vE=0,yE=Symbol();class bE{constructor(e,t,n){this.o=0,this.status=0,this.autoRun=!0,this.i=e,this.i.addController(this);const a="object"==typeof t?t:{task:t,args:n};this.t=a.task,this.h=a.args,void 0!==a.autoRun&&(this.autoRun=a.autoRun),this.taskComplete=new Promise(((e,t)=>{this.l=e,this.u=t}))}hostUpdated(){this.performTask()}async performTask(){var e;const t=null===(e=this.h)||void 0===e?void 0:e.call(this);this.shouldRun(t)&&this.run(t)}shouldRun(e){return this.autoRun&&this.v(e)}async run(e){var t;let n,a;null!=e||(e=null===(t=this.h)||void 0===t?void 0:t.call(this)),2!==this.status&&3!==this.status||(this.taskComplete=new Promise(((e,t)=>{this.l=e,this.u=t}))),this.status=1,this._=void 0,this.m=void 0,this.i.requestUpdate();const i=++this.o;try{n=await this.t(e)}catch(e){a=e}this.o===i&&(n===yE?this.status=0:(void 0===a?(this.status=2,this.l(n)):(this.status=3,this.u(a)),this.m=n,this._=a),this.i.requestUpdate())}get value(){return this.m}get error(){return this._}render(e){var t,n,a,i;switch(this.status){case 0:return null===(t=e.initial)||void 0===t?void 0:t.call(e);case 1:return null===(n=e.pending)||void 0===n?void 0:n.call(e);case 2:return null===(a=e.complete)||void 0===a?void 0:a.call(e,this.value);case 3:return null===(i=e.error)||void 0===i?void 0:i.call(e,this.error);default:this.status}}v(e){const t=this.T;return this.T=e,Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.some(((e,n)=>mE(e,t[n]))):e!==t}}class wE{constructor(e){this._keys=e}modify(e){this._keys.forEach((t=>e.removeContext(t)))}}var xE=":host {\n display: flex;\n flex-direction: column;\n width: 100%;\n margin-left: 5px;\n padding: 5px;\n color: var(--primary-text-color);\n overflow: hidden;\n column-gap: 5%;\n}\n\ndiv.title {\n font-size: 1.2rem;\n font-weight: bold;\n}\n\ndiv.details {\n flex: 1;\n justify-content: center;\n display: flex;\n flex-direction: column;\n flex-wrap: wrap;\n --mdc-icon-size: 16px;\n min-height: 0px;\n}";const CE=(e,t,n,a)=>{const i={...a?.cardWideConfig&&{cardWideConfig:a.cardWideConfig}};return q` ${t.render({initial:()=>a?.inProgressFunc?.()??xk(i),pending:()=>a?.inProgressFunc?.()??xk(i),error:t=>{Gg(t),kk(e,t)},complete:n})}`},ME=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,kE=(e,t,n,a=!0)=>new bE(e,{args:()=>[!!t(),n()],task:async([e,n])=>{const a=t();return e&&a&&n?(async(e,t)=>e&&t?t.startsWith("data:")||t.match(ME)?t:new Promise(((n,a)=>{e?e.fetchWithAuth(t).then((e=>e.blob())).then((e=>{const t=new FileReader;t.onload=()=>{const e=t.result;n("string"==typeof e?e:null)},t.onerror=e=>a(e),t.readAsDataURL(e)})):a()})):null)(a,n):null},autoRun:a}),SE=300;let EE=class extends se{constructor(){super(),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}connectedCallback(){this._intersectionObserver.observe(this),super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._intersectionObserver.disconnect()}willUpdate(e){e.has("thumbnail")&&(this._embedThumbnailTask=kE(this,(()=>this.hass),(()=>this.thumbnail),!1),this._intersectionObserver.unobserve(this),this._intersectionObserver.observe(this))}_intersectionHandler(e){this._embedThumbnailTask?.status===vE&&e.some((e=>e.isIntersecting))&&this._embedThumbnailTask?.run()}render(){const e=q` `;return this._embedThumbnailTask?q`${this.thumbnail?CE(this,this._embedThumbnailTask,(e=>e?q``:q``),{inProgressFunc:()=>e}):e} `:e}static get styles(){return o(":host {\n display: block;\n overflow: hidden;\n aspect-ratio: 1/1;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\nimg {\n display: block;\n}\n\nimg,\nha-icon {\n display: inline-block;\n vertical-align: top;\n margin: 0;\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n width: var(--frigate-card-thumbnail-size);\n max-height: 100%;\n aspect-ratio: 1/1;\n object-fit: cover;\n}\n\nha-icon {\n --mdc-icon-size: 50%;\n color: var(--primary-text-color);\n display: flex;\n justify-content: center;\n align-items: center;\n border: 1px solid rgba(255, 255, 255, 0.3);\n box-sizing: border-box;\n opacity: 0.2;\n}")}};e([he({attribute:!1})],EE.prototype,"thumbnail",void 0),e([he({attribute:!1})],EE.prototype,"hass",void 0),EE=e([le("frigate-card-thumbnail-feature-thumbnail")],EE);let $E=class extends se{render(){if(this.date)return q` + ${this.cameraMetadata?.engineLogo?q``:""} +
+
${Wu(this.date,"HH:mm")}
+
${Wu(this.date,"MMM do")}
+ ${this.showCameraTitle&&this.cameraMetadata?.title?q`
${this.cameraMetadata.title}
`:q``} +
+ `}static get styles(){return o(":host {\n display: block;\n max-width: var(--frigate-card-thumbnail-size);\n max-height: var(--frigate-card-thumbnail-size);\n aspect-ratio: 1/1;\n border: 1px solid var(--secondary-color);\n background-color: var(--secondary-background-color);\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n overflow: hidden;\n padding: 10px;\n box-sizing: border-box;\n position: relative;\n}\n\nimg.background {\n display: block;\n width: 100%;\n height: 100%;\n position: absolute;\n inset: 0;\n padding: 10%;\n box-sizing: border-box;\n pointer-events: none;\n opacity: 0.1;\n}\n\ndiv.content {\n height: 100%;\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n color: var(--primary-text-color);\n}\n\ndiv {\n text-align: center;\n}\n\ndiv.title {\n font-size: 1.5rem;\n}\n\ndiv.camera {\n font-size: 0.7em;\n}")}};e([he({attribute:!1})],$E.prototype,"date",void 0),e([he({attribute:!1})],$E.prototype,"cameraMetadata",void 0),e([he({attribute:!1})],$E.prototype,"showCameraTitle",void 0),$E=e([le("frigate-card-thumbnail-feature-text")],$E);let AE=class extends se{render(){if(!this.media)return;const e=this.media.getScore(),t=e?(100*e).toFixed(2)+"%":null,n=this.media.getStartTime(),a=n?Kg(n):null,i=this.media.getEndTime(),r=n&&i?ef(n,i):null,o=this.media.inProgress()?V_("event.in_progress"):null,s=qg(this.media.getWhat()?.join(", "))??null,c=qg(this.media.getWhere()?.join(", "))??null,l=qg(this.media.getTags()?.join(", "))??null,d=s||l?(s??"")+(s&&l?": ":"")+(l??""):null,u=this.seek?Wu(this.seek,"HH:mm:ss"):null;return q` + ${d?q`
+ ${d} + ${t?q`${t}`:""} +
`:""} +
+ ${a?q`
+ + ${a} +
+ ${r||o?q`
+ + ${r?q`${r}`:""} + ${o?q`${o}`:""} +
`:""}`:""} + ${this.cameraTitle?q`
+ + ${this.cameraTitle} +
`:""} + ${c?q`
+ + ${c} +
`:q``} + ${l?q`
+ + ${l} +
`:q``} + ${u?q`
+ + ${u} +
`:q``} +
+ `}static get styles(){return o(xE)}};e([he({attribute:!1})],AE.prototype,"media",void 0),e([he({attribute:!1})],AE.prototype,"seek",void 0),e([he({attribute:!1})],AE.prototype,"cameraTitle",void 0),AE=e([le("frigate-card-thumbnail-details-event")],AE);let zE=class extends se{render(){if(!this.media)return;const e=this.media.getStartTime(),t=e?Kg(e):null,n=this.media.getEndTime(),a=e&&n?ef(e,n):null,i=this.media.inProgress()?V_("recording.in_progress"):null,r=this.seek?Wu(this.seek,"HH:mm:ss"):null,o=this.media.getEventCount();return q` + ${this.cameraTitle?q`
+ ${this.cameraTitle} +
`:""} +
+ ${t?q`
+ + ${t} +
+ ${a||i?q`
+ + ${a?q`${a}`:""} + ${i?q`${i}`:""} +
`:""}`:""} + ${r?q`
+ + ${r} +
`:q``} + ${null!==o?q`
+ + ${o} +
`:""} +
+ `}static get styles(){return o(xE)}};e([he({attribute:!1})],zE.prototype,"media",void 0),e([he({attribute:!1})],zE.prototype,"seek",void 0),e([he({attribute:!1})],zE.prototype,"cameraTitle",void 0),zE=e([le("frigate-card-thumbnail-details-recording")],zE);let IE=class extends se{constructor(){super(...arguments),this.details=!1,this.show_favorite_control=!1,this.show_timeline_control=!1,this.show_download_control=!1}render(){if(!this.media||!this.cameraManager||!this.hass)return;const e=this.media.getThumbnail(),t=this.media.getTitle()??"",n={star:!0,starred:!!this.media?.isFavorite()},a=this.show_timeline_control&&(!tx.isRecording(this.media)||this.media.getStartTime()&&this.media.getEndTime()),i=this.cameraManager?.getMediaCapabilities(this.media),r=this.show_favorite_control&&this.media&&this.hass&&i?.canFavorite,o=this.show_download_control&&this.hass&&this.media.getID()&&i?.canDownload,s=this.cameraManager.getCameraMetadata(this.media.getCameraID());return q` + ${tx.isEvent(this.media)&&e?q``:tx.isEvent(this.media)||tx.isRecording(this.media)?q``:q``} + ${r?q` {if(wf(e),this.hass&&this.media){try{await(this.cameraManager?.favoriteMedia(this.media,!this.media?.isFavorite()))}catch(e){return void Gg(e)}this.requestUpdate()}}} + />`:""} + ${this.details&&tx.isEvent(this.media)?q``:this.details&&tx.isRecording(this.media)?q``:q``} + ${a?q`{wf(e),this.viewManagerEpoch&&this.media&&this.viewManagerEpoch.manager.setViewByParameters({params:{view:"timeline",queryResults:this.viewManagerEpoch?.manager.getView()?.queryResults?.clone().selectResultIfFound((e=>e===this.media))},modifiers:[new wE(["timeline"])]})}} + >`:""} + ${o?q` {if(wf(e),this.hass&&this.cameraManager&&this.media)try{await Ew(this.hass,this.cameraManager,this.media)}catch(e){kk(this,e)}}} + >`:""} + `}static get styles(){return o(":host {\n display: flex;\n flex-direction: row;\n box-sizing: border-box;\n position: relative;\n overflow: hidden;\n transition: transform 0.2s linear;\n}\n\n:host(:not([details])) {\n aspect-ratio: 1/1;\n}\n\n:host([details]) {\n border: 1px solid var(--primary-color);\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n padding: 2px;\n background-color: var(--primary-background-color, black);\n}\n\n:host(:hover) {\n transform: scale(1.04);\n}\n\nha-icon {\n position: absolute;\n border-radius: 50%;\n opacity: 0.5;\n color: var(--primary-color);\n cursor: pointer;\n transition: opacity 0.2s ease-in-out, color 0.2s ease-in-out;\n}\n\nha-icon:hover {\n opacity: 1;\n}\n\nha-icon.star {\n top: 3px;\n left: 3px;\n}\n\nha-icon.star.starred {\n color: gold;\n}\n\nha-icon.timeline {\n top: 3px;\n right: 3px;\n}\n\nha-icon.download {\n right: 3px;\n bottom: 3px;\n}\n\nfrigate-card-thumbnail-details-event,\nfrigate-card-thumbnail-details-recording {\n flex: 1;\n}")}};e([he({attribute:!1})],IE.prototype,"cameraManager",void 0),e([he({attribute:!1})],IE.prototype,"media",void 0),e([he({attribute:!0,type:Boolean})],IE.prototype,"details",void 0),e([he({attribute:!0,type:Boolean})],IE.prototype,"show_favorite_control",void 0),e([he({attribute:!0,type:Boolean})],IE.prototype,"show_timeline_control",void 0),e([he({attribute:!0,type:Boolean})],IE.prototype,"show_download_control",void 0),e([he({attribute:!1})],IE.prototype,"seek",void 0),IE=e([le("frigate-card-thumbnail")],IE);let TE=class extends se{constructor(){super(...arguments),this.fadeThumbnails=!1,this._thumbnailSlides=[]}willUpdate(e){if(e.has("config")){this.config?.size&&this.style.setProperty("--frigate-card-thumbnail-size",`${this.config.size}px`);const e=this._getDirection();e?this.setAttribute("direction",e):this.removeAttribute("direction")}["cameraManager","config","transitionEffect","viewManagerEpoch"].some((t=>e.has(t)))&&(this._thumbnailSlides=this._renderSlides()),e.has("viewManagerEpoch")&&this.style.setProperty("--frigate-card-carousel-thumbnail-opacity",this.fadeThumbnails&&null!==this._getSelectedSlide()?"0.4":"1.0")}_getSelectedSlide(){return this.viewManagerEpoch?.manager.getView()?.queryResults?.getSelectedIndex()??null}_renderSlides(){const e=[],t=this.viewManagerEpoch?.manager.getView(),n=t?.context?.mediaViewer?.seek,a=this._getSelectedSlide();for(const i of t?.queryResults?.getResults()??[]){const t=e.length,r={embla__slide:!0,"slide-selected":a===t};e.push(q` {const n=this.viewManagerEpoch?.manager.getView();n&&n.queryResults&&Bg(this,"thumbnail-carousel:tap",{queryResults:n.queryResults.clone().selectIndex(t)}),wf(e)}} + > + `)}return e}_getDirection(){return"left"===this.config?.mode||"right"===this.config?.mode?"vertical":"above"===this.config?.mode||"below"===this.config?.mode?"horizontal":null}render(){const e=this._getDirection();if(this._thumbnailSlides.length&&this.config&&e)return q` + ${this._thumbnailSlides} + `}static get styles(){return o(":host {\n --frigate-card-thumbnail-size-max: 300px;\n --frigate-card-thumbnail-details-width: calc(\n var(--frigate-card-thumbnail-size) + 200px\n );\n}\n\n:host {\n display: block;\n width: 100%;\n height: 100%;\n --frigate-card-carousel-thumbnail-opacity: 1;\n}\n\n:host([direction=vertical]) {\n height: 100%;\n}\n\n:host([direction=horizontal]) {\n height: auto;\n}\n\n.embla__slide {\n flex: 0 0 auto;\n opacity: var(--frigate-card-carousel-thumbnail-opacity);\n}\n\n.embla__slide.slide-selected {\n opacity: 1;\n}\n\nfrigate-card-thumbnail {\n width: var(--frigate-card-thumbnail-size);\n height: var(--frigate-card-thumbnail-size);\n max-width: 100%;\n}\n\nfrigate-card-thumbnail[details] {\n width: var(--frigate-card-thumbnail-details-width);\n}")}};e([he({attribute:!1})],TE.prototype,"hass",void 0),e([he({attribute:!1})],TE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1})],TE.prototype,"cameraManager",void 0),e([he({attribute:!1})],TE.prototype,"config",void 0),e([he({attribute:!1})],TE.prototype,"fadeThumbnails",void 0),TE=e([le("frigate-card-thumbnail-carousel")],TE);var jE=":host {\n width: 100%;\n height: 100%;\n display: block;\n}";const OE=document.createElement("template");OE.innerHTML='\n
\n
\n';class DE extends HTMLElement{constructor(){super();const e=this.attachShadow({mode:"open"});e.appendChild(OE.content.cloneNode(!0)),this._freeSpaceDiv=e.getElementById("fs")}connectedCallback(){this._freeSpaceDiv&&this._freeSpaceDiv.addEventListener("click",this.handleFreeSpaceDivClick),this.upgradeProperty("open")}disconnectedCallback(){document.removeEventListener("keyup",this.handleKeyUp)}upgradeProperty(e){if(this.hasOwnProperty(e)){let t=this[e];delete this[e],this[e]=t}}handleKeyUp=e=>{if(!e.altKey&&"Escape"===e.key)e.preventDefault(),this.open=!1};get open(){return this.hasAttribute("open")}set open(e){e?this.hasAttribute("open")||this.setAttribute("open",""):this.hasAttribute("open")&&this.removeAttribute("open")}static get observedAttributes(){return["open"]}attributeChangedCallback(e,t,n){"open"===e&&(this.open?(this.setAttribute("tabindex","0"),this.setAttribute("aria-disabled","false"),this.focus({preventScroll:!0}),document.addEventListener("keyup",this.handleKeyUp),this.dispatchEvent(new CustomEvent("open",{bubbles:!0}))):(this.setAttribute("tabindex","-1"),this.setAttribute("aria-disabled","true"),document.removeEventListener("keyup",this.handleKeyUp),this.dispatchEvent(new CustomEvent("close",{bubbles:!0}))))}handleFreeSpaceDivClick=()=>{this.open=!1}}customElements.define("side-drawer",DE);let RE=class extends se{constructor(){super(...arguments),this.location="left",this.control=!0,this.open=!1,this.empty=!0,this._refDrawer=ze(),this._refSlot=ze(),this._resizeObserver=new ResizeObserver((()=>this._hideDrawerIfNecessary())),this._isHoverableDevice=Yg()}firstUpdated(e){super.firstUpdated(e);const t=document.createElement("style");t.innerHTML=":host {\n width: unset;\n}\n\n#fs {\n display: none;\n width: 100%;\n inset: 0;\n}\n\n#d,\n#fs {\n height: 100%;\n position: absolute;\n}\n\n#d {\n overflow: visible;\n max-width: 90%;\n z-index: 10;\n}\n\n:host([location=right]) #d {\n left: unset;\n right: 0;\n transform: translateX(100%);\n}\n\n:host([location=right][open]) #d {\n transform: none;\n box-shadow: var(--frigate-card-css-box-shadow, 0px 0px 25px 0px black);\n}\n\n#ifs {\n height: 100%;\n}",this._refDrawer.value?.shadowRoot?.appendChild(t)}_slotChanged(){const e=this._refSlot.value?lf(this._refSlot.value):[];this._resizeObserver.disconnect();for(const t of e)this._resizeObserver.observe(t);this._hideDrawerIfNecessary()}_hideDrawerIfNecessary(){if(!this._refDrawer.value)return;const e=this._refSlot.value?lf(this._refSlot.value):null;this.empty=!e||!e.length||e.every((e=>{const t=e.getBoundingClientRect();return!t.width||!t.height}))}render(){return q` + {this.open&&(this.open=!1)}} + > + ${this.control?q` +
{wf(e),this.open=!this.open}} + > + {this._isHoverableDevice&&!this.open&&(this.open=!0)}} + > + +
+ `:""} + this._slotChanged()}> +
+ `}static get styles(){return o("side-drawer {\n background-color: var(--card-background-color);\n}\n\ndiv.control-surround {\n position: absolute;\n bottom: 50%;\n transform: translateY(50%);\n z-index: 0;\n padding-top: 20px;\n padding-bottom: 20px;\n}\n\n:host([location=left]) div.control-surround {\n padding-right: 12px;\n left: 100%;\n}\n\n:host([location=right]) div.control-surround {\n padding-left: 12px;\n right: 100%;\n}\n\n:host([empty]),\n:host([empty]) > * {\n visibility: hidden;\n}\n\n:host(:not([empty])),\n:host(:not([empty])) > * {\n visibility: visible;\n}\n\nha-icon.control {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.7);\n opacity: 0.5;\n pointer-events: all;\n --mdc-icon-size: 20px;\n padding-top: 20px;\n padding-bottom: 20px;\n transition: opacity 0.5s ease;\n}\n\n:host([open]) ha-icon.control,\nha-icon.control:hover {\n opacity: 1;\n background-color: black;\n}\n\n:host([location=left]) ha-icon.control {\n border-top-right-radius: 20px;\n border-bottom-right-radius: 20px;\n}\n\n:host([location=right]) ha-icon.control {\n border-top-left-radius: 20px;\n border-bottom-left-radius: 20px;\n}")}};e([he({attribute:!0,reflect:!0})],RE.prototype,"location",void 0),e([he({attribute:!0,reflect:!0,type:Boolean})],RE.prototype,"control",void 0),e([he({type:Boolean,reflect:!0,attribute:!0})],RE.prototype,"open",void 0),e([he({attribute:!1})],RE.prototype,"icons",void 0),e([he({type:Boolean,reflect:!0,attribute:!0})],RE.prototype,"empty",void 0),RE=e([le("frigate-card-drawer")],RE);let PE=class extends se{constructor(){super(...arguments),this._refDrawerLeft=ze(),this._refDrawerRight=ze(),this._boundDrawerHandler=this._drawerHandler.bind(this)}connectedCallback(){super.connectedCallback(),this.addEventListener("frigate-card:drawer:open",this._boundDrawerHandler),this.addEventListener("frigate-card:drawer:close",this._boundDrawerHandler)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("frigate-card:drawer:open",this._boundDrawerHandler),this.removeEventListener("frigate-card:drawer:close",this._boundDrawerHandler)}_drawerHandler(e){const t=e.detail.drawer,n=e.type.endsWith(":open");"left"===t&&this._refDrawerLeft.value?this._refDrawerLeft.value.open=n:"right"===t&&this._refDrawerRight.value&&(this._refDrawerRight.value.open=n)}render(){return q` + + + + + + + + `}static get styles(){return o(":host {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n position: relative;\n overflow: hidden;\n}\n\n::slotted(:not([slot])) {\n flex: 1;\n min-height: 0px;\n}")}};e([he({attribute:!1})],PE.prototype,"drawerIcons",void 0),PE=e([le("frigate-card-surround-basic")],PE);let LE=class extends se{_hasDrawer(){return!!this.thumbnailConfig&&["left","right"].includes(this.thumbnailConfig.mode)}willUpdate(e){this.timelineConfig?.mode&&"none"!==this.timelineConfig.mode&&import("./timeline-core-99ac5d81.js");const t=this.viewManagerEpoch?.manager.getView();e.has("viewManagerEpoch")&&(this.viewManagerEpoch?.manager.hasMajorMediaChange(this.viewManagerEpoch?.oldView)||this.viewManagerEpoch?.oldView?.displayMode!==t?.displayMode)&&(this._cameraIDsForTimeline=this._getCameraIDsForTimeline()??void 0)}_getCameraIDsForTimeline(){const e=this.viewManagerEpoch?.manager.getView();if(!e||!this.cameraManager)return null;if(e.is("live")){const t={anyCapabilities:["clips","snapshots","recordings"]};return e.supportsMultipleDisplayModes()&&e.isGrid()?this.cameraManager.getStore().getCameraIDsWithCapability(t):this.cameraManager.getStore().getAllDependentCameras(e.camera,t)}return e.isViewerView()?e.query?.getQueryCameraIDs()??null:null}render(){const e=this.viewManagerEpoch?.manager.getView();if(!this.hass||!e)return;const t=(e,t)=>{this.thumbnailConfig&&this._hasDrawer()&&Bg(e.composedPath()[0],"drawer:"+t,{drawer:this.thumbnailConfig.mode})};return q` t(e,"open")} + @frigate-card:thumbnails:close=${e=>t(e,"close")} + > + ${this.thumbnailConfig&&"none"!==this.thumbnailConfig.mode?q` {const n=e.detail.queryResults.getSelectedResult();n&&(this.viewManagerEpoch?.manager.setViewByParameters({params:{view:"media",queryResults:e.detail.queryResults,...n.getCameraID()&&{camera:n.getCameraID()}},modifiers:[new wE(["timeline","mediaViewer"])]}),t(e,"close"))}} + > + `:""} + ${this.timelineConfig&&"none"!==this.timelineConfig.mode?q` + `:""} + + `}static get styles(){return o(jE)}};e([he({attribute:!1})],LE.prototype,"hass",void 0),e([he({attribute:!1})],LE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1,hasChanged:Qg})],LE.prototype,"thumbnailConfig",void 0),e([he({attribute:!1,hasChanged:Qg})],LE.prototype,"timelineConfig",void 0),e([he({attribute:!1})],LE.prototype,"cameraManager",void 0),e([he({attribute:!1})],LE.prototype,"cardWideConfig",void 0),LE=e([le("frigate-card-surround")],LE);var NE="6.0.0",FE="Mon, 09 Dec 2024 00:16:17 GMT",VE="4590558",HE="Sun, 8 Dec 2024 16:05:13 -0800";const BE=ba.object({domain:ba.string(),version:ba.string().optional()}).passthrough(),qE="hass_web_proxy",UE=(e,t)=>`/api/${qE}/v${t??0}/?url=${encodeURIComponent(e)}`,WE=(e,t,n="media")=>(e=>e.config.components.includes(qE))(e)&&!!t[n];async function ZE(e,t,n){await e.callService(qE,"create_proxied_url",{url_pattern:t,...n&&{url_id:n.urlID,ssl_verification:n.sslVerification,ssl_ciphers:n.sslCiphers,open_limit:n.openLimit,ttl:n.ttl,allow_unauthenticated:n.allowUnauthenticated}})}const QE=()=>NE,GE=async(e,t)=>{let n=null;if(t)try{n=await(async(e,t)=>await $v(e,BE,{type:"manifest/get",integration:t}))(t,e)}catch(e){}return{detected:!!n,...n?.version&&{version:n.version}}};let YE=class extends se{constructor(){super(...arguments),this._diagnostics=null}async _fetchDiagnostics(){this._diagnostics=await(async(e,t,n)=>{const a=e&&t?await t.getMatchingDevices(e,(e=>"Frigate"===e.manufacturer)):[],i=new Map;return a?.forEach((e=>{e.config_entries.forEach((t=>{e.model&&i.set(t,e.model)}))})),{card_version:QE(),browser:navigator.userAgent,date:new Date,lang:F_(),timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,git:{hash:VE,build_date:FE,commit_date:HE},...e&&{ha_version:e.config.version},integrations:{reolink:await GE("reolink",e),frigate:{...await GE("frigate",e),...i.size&&{devices:Object.fromEntries(i)}},hass_web_proxy:await GE(qE,e),motioneye:await GE("motioneye",e)},...n&&{config:n}}})(this.hass,this.deviceRegistryManager,this.rawConfig)}shouldUpdate(){return!!this._diagnostics||(this._fetchDiagnostics().then((()=>this.requestUpdate())),!1)}render(){return wk({message:V_("error.diagnostics"),type:"diagnostics",icon:"mdi:information",context:this._diagnostics})}static get styles(){return o(jE)}};e([he({attribute:!1})],YE.prototype,"hass",void 0),e([he({attribute:!1})],YE.prototype,"deviceRegistryManager",void 0),e([he({attribute:!1})],YE.prototype,"rawConfig",void 0),e([pe()],YE.prototype,"_diagnostics",void 0),YE=e([le("frigate-card-diagnostics")],YE);let KE=class extends se{willUpdate(e){if(e.has("viewManagerEpoch")||e.has("config")){const e=this.viewManagerEpoch?.manager.getView();(e?.is("live")||this._shouldLivePreload())&&import("./index-3c9b9749.js").then((function(e){return e.i})),e?.isGalleryView()?import("./gallery-149d4f41.js"):e?.isViewerView()?import("./index-961f10b9.js"):e?.is("image")?import("./image-5371a090.js"):e?.is("timeline")&&import("./timeline-dfcd5e4d.js")}e.has("hide")&&(this.hide?this.setAttribute("hidden",""):this.removeAttribute("hidden"))}shouldUpdate(e){return!0}_shouldLivePreload(){const e=this.viewManagerEpoch?.manager.getView();return!!this.overriddenConfig?.live.preload&&!e?.is("diagnostics")}render(){if(!(this.hass&&this.overriddenConfig&&this.nonOverriddenConfig&&this.cardWideConfig))return q``;const e=this.viewManagerEpoch?.manager.getView(),t={hidden:this._shouldLivePreload()&&!e?.is("live")},n={hidden:!!this.hide},a=e?.is("live")?this.overriddenConfig.live.controls.thumbnails:e?.isViewerView()?this.overriddenConfig.media_viewer.controls.thumbnails:e?.is("timeline")?this.overriddenConfig.timeline.controls.thumbnails:void 0,i=e?.is("live")?this.overriddenConfig.live.controls.timeline:e?.isViewerView()?this.overriddenConfig.media_viewer.controls.timeline:void 0,r=e?this.cameraManager?.getStore().getCameraConfig(e.camera)??null:null;return q` + ${!this.hide&&e?.is("image")&&r?q` + `:""} + ${!this.hide&&e?.isGalleryView()?q` + `:""} + ${!this.hide&&e?.isViewerView()?q` + + + `:""} + ${!this.hide&&e?.is("timeline")?q` + `:""} + ${!this.hide&&e?.is("diagnostics")?q` + `:""} + ${this._shouldLivePreload()||!this.hide&&e?.is("live")?q` + + + `:""} + `}static get styles(){return o(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\n:host([hidden]),\n.hidden {\n display: none;\n}")}};e([he({attribute:!1})],KE.prototype,"hass",void 0),e([he({attribute:!1})],KE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1})],KE.prototype,"cameraManager",void 0),e([he({attribute:!1})],KE.prototype,"nonOverriddenConfig",void 0),e([he({attribute:!1})],KE.prototype,"overriddenConfig",void 0),e([he({attribute:!1})],KE.prototype,"cardWideConfig",void 0),e([he({attribute:!1})],KE.prototype,"rawConfig",void 0),e([he({attribute:!1})],KE.prototype,"resolvedMediaCache",void 0),e([he({attribute:!1})],KE.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],KE.prototype,"hide",void 0),e([he({attribute:!1})],KE.prototype,"microphoneManager",void 0),e([he({attribute:!1})],KE.prototype,"triggeredCameraIDs",void 0),e([he({attribute:!1})],KE.prototype,"deviceRegistryManager",void 0),KE=e([le("frigate-card-views")],KE);console.info(`%c FRIGATE-HASS-CARD \n%c ${V_("common.version")} `+QE(),"color: pink; font-weight: bold; background: black","color: white; font-weight: bold; background: dimgray"),window.customCards=window.customCards||[],window.customCards.push({type:"frigate-card",name:V_("common.frigate_card"),description:V_("common.frigate_card_description"),preview:!0,documentationURL:wa});let XE=class extends se{constructor(){super(...arguments),this._controller=new Ax(this,(()=>this._refMain.value?.scroll({top:0})),(()=>this._refMenu.value?.toggleMenu()),this._requestUpdateForComponentsThatUseConditions.bind(this)),this._menuButtonController=new zx,this._refMenu=ze(),this._refOverlay=ze(),this._refMain=ze(),this._refElements=ze(),this._refViews=ze()}get _config(){return this._controller.getConfigManager().getConfig()}get _hass(){return this._controller.getHASSManager().getHASS()}set hass(e){this._controller.getHASSManager().setHASS(e),this._refMenu.value&&(this._refMenu.value.hass=e),this._refElements.value&&(this._refElements.value.hass=e),this._refViews.value&&(this._refViews.value.hass=e)}static async getConfigElement(){return await Ax.getConfigElement()}static getStubConfig(e,t){return Ax.getStubConfig(t)}_requestUpdateForComponentsThatUseConditions(){this._refViews.value&&(this._refViews.value.conditionsManagerEpoch=this._controller.getConditionsManager().getEpoch()??void 0),this._refElements.value&&(this._refElements.value.conditionsManagerEpoch=this._controller.getConditionsManager().getEpoch()??void 0)}setConfig(e){this._controller.getConfigManager().setConfig(e)}shouldUpdate(){return!!this.isConnected&&(this._controller.getMessageManager().hasMessage()||this._controller.getInitializationManager().isInitializedMandatory()||this._controller.getInitializationManager().initializeMandatory(),!0)}_renderMenuStatusContainer(e){if(!this._config)return;const t=this._config.menu.style,n=this._config.menu.position,a=this._config.status_bar.style,i=this._config.status_bar.position;if("none"===t&&"none"===a||"overlay"===e&&"outside"===t&&"outside"===a||"overlay"!==e&&("outside"!==t||n!==e)&&("outside"!==a||i!==e))return;const r=e=>{const r="none"!==t&&("outside"===t&&"outerlay"===e||"outside"!==t&&"overlay"===e),o="none"!==a&&("outside"===a&&"outerlay"===e||"outside"!==a&&"overlay"===e),s="left"===n||"right"===n||"bottom"===n&&"hidden"===t&&"popup"!==a||"top"===n&&("hidden"!==t||"popup"===a);return q` + ${r&&s?this._renderMenu(n):""} + ${o?this._renderStatusBar(i):""} + ${r&&!s?this._renderMenu(n):""} + `};return q` + ${"overlay"===e?q`${r("overlay")}`:q`
+ ${r("outerlay")} +
`} + `}_renderMenu(e){const t=this._controller.getViewManager().getView();if(this._hass&&this._config)return q` + + `}_renderStatusBar(e){if(this._config)return q` + + `}updated(){this._controller.getInitializationManager().isInitializedMandatory()&&this._controller.getQueryStringManager().executeIfNecessary()}_renderInDialogIfNecessary(e){return this._controller.getExpandManager().isExpanded()?q` {this._controller.getExpandManager().setExpanded(!1)}} + > + ${e} + `:e}render(){if(!this._hass)return;const e={main:!0,"curve-top":"outside"!==this._config?.menu.style||"top"!==this._config?.menu.position,"curve-bottom":"outside"!==this._config?.menu.style||"top"===this._config?.menu.position},t=this._controller.getActionsManager().getMergedActions(),n=this._controller.getCameraManager(),a=!1!==this._config?.performance?.features.animated_progress_indicator&&!this._controller.getInitializationManager().wasEverInitialized()&&!this._controller.getMessageManager().hasMessage();return this._renderInDialogIfNecessary(q` this._controller.getMessageManager().setMessageIfHigherPriority(e.detail)} + @frigate-card:media:loaded=${e=>this._controller.getMediaLoadedInfoManager().set(e.detail)} + @frigate-card:media:unloaded=${()=>this._controller.getMediaLoadedInfoManager().clear()} + @frigate-card:media:volumechange=${()=>this.requestUpdate()} + @frigate-card:media:play=${()=>this.requestUpdate()} + @frigate-card:media:pause=${()=>this.requestUpdate()} + @frigate-card:focus=${()=>this.focus()} + > + ${a?q``:""} + ${this._renderMenuStatusContainer("top")} + ${this._renderMenuStatusContainer("overlay")} +
+ + ${wk(this._controller.getMessageManager().getMessage())} +
+ ${this._renderMenuStatusContainer("bottom")} + ${this._config?.elements?q` {this._menuButtonController.addDynamicMenuButton(e.detail),this.requestUpdate()}} + @frigate-card:menu:remove=${e=>{this._menuButtonController.removeDynamicMenuButton(e.detail),this.requestUpdate()}} + @frigate-card:status-bar:add=${e=>{this._controller.getStatusBarItemManager().addDynamicStatusBarItem(e.detail)}} + @frigate-card:status-bar:remove=${e=>{this._controller.getStatusBarItemManager().removeDynamicStatusBarItem(e.detail)}} + @frigate-card:conditions:evaluate=${e=>{e.evaluation=this._controller.getConditionsManager()?.evaluateConditions(e.conditions)}} + > + `:""} +
`)}static get styles(){return o(':host {\n display: block;\n position: relative;\n background-color: var(--card-background-color);\n border-radius: var(--ha-card-border-radius, 4px);\n height: var(--frigate-card-height);\n min-height: 100px;\n pointer-events: all;\n --frigate-card-expand-max-height: calc((100vh - (2 * 56px)) * 0.85);\n --frigate-card-expand-max-width: 85vw;\n --frigate-card-expand-width: none;\n --frigate-card-expand-height: none;\n --frigate-card-expand-aspect-ratio: unset;\n --frigate-card-height: auto;\n}\n\nfrigate-card-loading {\n position: absolute;\n inset: 0;\n z-index: 1;\n}\n\n:host([dark]) {\n filter: brightness(75%);\n}\n\n:host([panel]) {\n height: 100%;\n}\n\ndiv.main {\n position: relative;\n overflow: auto;\n width: 100%;\n height: 100%;\n margin: auto;\n display: block;\n transform: translateZ(0);\n scrollbar-width: none;\n -ms-overflow-style: none;\n}\n\n/* Hide scrollbar for Chrome, Safari and Opera */\ndiv.main::-webkit-scrollbar {\n display: none;\n}\n\ndiv.main.curve-top {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\ndiv.main.curve-bottom {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}\n\nha-card {\n display: flex;\n flex-direction: column;\n margin: auto;\n border: 0px;\n overflow: visible;\n width: 100%;\n height: 100%;\n position: static;\n color: var(--secondary-text-color, white);\n}\n\n/************\n * Fullscreen\n *************/\n:host(:fullscreen) #ha-card {\n border-radius: 0px;\n box-shadow: none;\n margin: 0;\n}\n\n:host(:-webkit-full-screen) #ha-card {\n border-radius: 0px;\n box-shadow: none;\n margin: 0;\n}\n\n:host(:fullscreen) div.main,\n:host(:fullscreen) frigate-card-menu {\n border-radius: 0px;\n}\n\n:host(:-webkit-full-screen) div.main,\n:host(:-webkit-full-screen) frigate-card-menu {\n border-radius: 0px;\n}\n\n/***************\n * Expanded mode\n ***************/\nweb-dialog {\n --dialog-padding: 0px;\n --dialog-container-padding: 0px;\n --dialog-max-height: var(--frigate-card-expand-max-height);\n --dialog-max-width: var(--frigate-card-expand-max-width);\n --dialog-width: var(--frigate-card-expand-width);\n --dialog-height: var(--frigate-card-expand-height);\n --dialog-overflow-x: visible;\n --dialog-overflow-y: visible;\n max-height: 100vh;\n}\n\nweb-dialog::part(dialog) {\n aspect-ratio: var(--frigate-card-expand-aspect-ratio);\n border-radius: 0px;\n background: transparent;\n}\n\n/*************************************\n * "Outside" style for menu/status bar\n *************************************/\n.outerlay[data-position=top] > *:first-child {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n.outerlay[data-position=bottom] > *:last-child {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n/*******************\n * Menu hover styles\n *******************/\nfrigate-card-menu {\n z-index: 2;\n}\n\nfrigate-card-menu[data-style*=hover] {\n transition: opacity 0.5s ease;\n opacity: 0;\n}\n\nfrigate-card-menu[data-style*=hover]:hover,\n.main:hover > frigate-card-overlay > frigate-card-menu[data-style=hover-card] {\n opacity: 1;\n}\n\n/*************************\n * Status bar hover styles\n *************************/\nfrigate-card-status-bar {\n z-index: 1;\n}\n\nfrigate-card-status-bar[data-style*=hover] {\n transition: opacity 0.5s ease;\n opacity: 0;\n}\n\nfrigate-card-status-bar[data-style*=hover]:hover,\n.main:hover > frigate-card-overlay > frigate-card-status-bar[data-style=hover-card] {\n opacity: 1;\n}')}getCardSize(){return 6}};XE=e([le("frigate-card")],XE);export{Il as $,tr as A,nr as B,Zi as C,ar as D,ir as E,rr as F,Pi as G,Li as H,Ni as I,Fi as J,Vi as K,Hi as L,Bi as M,qi as N,Ui as O,gs as P,Ws as Q,ns as R,Us as S,qo as T,Fo as U,Vo as V,Ho as W,Bo as X,Bs as Y,zl as Z,e as _,se as a,dr as a$,H_ as a0,tw as a1,et as a2,nw as a3,$s as a4,Di as a5,ji as a6,Oi as a7,Ri as a8,Wi as a9,Yr as aA,oo as aB,so as aC,lo as aD,uo as aE,co as aF,ao as aG,io as aH,ro as aI,mo as aJ,_o as aK,vo as aL,ho as aM,po as aN,fo as aO,go as aP,eo as aQ,no as aR,to as aS,Xr as aT,Jr as aU,Kr as aV,Ao as aW,Io as aX,zo as aY,hr as aZ,cr as a_,es as aa,Jo as ab,Xo as ac,ts as ad,hs as ae,us as af,ms as ag,qs as ah,ps as ai,So as aj,Co as ak,To as al,Mo as am,ko as an,qr as ao,Ur as ap,Wr as aq,Zr as ar,Eo as as,$o as at,yo as au,xo as av,bo as aw,wo as ax,Qr as ay,Gr as az,pe as b,ja as b$,ur as b0,lr as b1,sr as b2,mr as b3,gr as b4,fr as b5,_r as b6,xr as b7,Hr as b8,Cr as b9,Po as bA,Wo as bB,Zo as bC,Go as bD,Yo as bE,Qo as bF,Uo as bG,vs as bH,_s as bI,ys as bJ,xs as bK,Cs as bL,As as bM,Ms as bN,Es as bO,Ss as bP,Jb as bQ,Kb as bR,Uk as bS,Ug as bT,Ma as bU,Ja as bV,Ya as bW,La as bX,Na as bY,ka as bZ,Oa as b_,kr as ba,Mr as bb,vr as bc,wr as bd,yr as be,br as bf,Sr as bg,Er as bh,$r as bi,Or as bj,zr as bk,Tr as bl,jr as bm,Ir as bn,Ar as bo,Pr as bp,Fr as bq,Vr as br,Dr as bs,Rr as bt,Nr as bu,Lr as bv,Ro as bw,Lo as bx,Oo as by,Do as bz,ew as c,wf as c$,Da as c0,Ta as c1,Ga as c2,Ua as c3,Wa as c4,Za as c5,Qa as c6,_i as c7,fi as c8,Ra as c9,ai as cA,ii as cB,Sa as cC,Ea as cD,pi as cE,hi as cF,gi as cG,mi as cH,Fd as cI,Ca as cJ,ks as cK,ge as cL,fe as cM,W as cN,xe as cO,Gw as cP,Mk as cQ,ze as cR,Yw as cS,df as cT,wk as cU,je as cV,Qg as cW,vw as cX,td as cY,kk as cZ,Ky as c_,Pa as ca,Ha as cb,qa as cc,Fa as cd,Va as ce,Ba as cf,Ka as cg,Xa as ch,ti as ci,ei as cj,yi as ck,vi as cl,bi as cm,wi as cn,$a as co,Aa as cp,za as cq,Ia as cr,ni as cs,ri as ct,oi as cu,si as cv,ci as cw,li as cx,di as cy,ui as cz,aw as d,ba as d$,My as d0,ve as d1,jE as d2,Vd as d3,nu as d4,c as d5,ux as d6,Qv as d7,hx as d8,lx as d9,wx as dA,Ck as dB,U as dC,xf as dD,Bw as dE,kE as dF,CE as dG,yf as dH,Fk as dI,vf as dJ,kf as dK,bf as dL,p_ as dM,h_ as dN,Pv as dO,Lv as dP,Ud as dQ,Vv as dR,Yg as dS,Kg as dT,Cx as dU,Gy as dV,gx as dW,su as dX,sf as dY,Fv as dZ,Hg as d_,px as da,Gg as db,Ev as dc,Wu as dd,Xg as de,Qu as df,Bg as dg,qw as dh,af as di,SE as dj,kx as dk,xk as dl,$w as dm,tx as dn,hy as dp,Bb as dq,qb as dr,WE as ds,ZE as dt,Ib as du,UE as dv,Qw as dw,Kw as dx,Xw as dy,Jw as dz,_e as e,nf as e0,$v as e1,zs as e2,Kv as e3,Wv as e4,Z_ as e5,Q_ as e6,Yv as e7,Jg as e8,tf as e9,Lu as eA,Vb as eB,Zv as eC,Nb as eD,lf as eE,qy as eF,Uy as eG,Wy as eH,pf as eI,Qy as eJ,Rg as eK,Zy as eL,s as eM,Ae as eN,ye as eO,bE as eP,me as eQ,be as eR,jb as eS,Zw as eT,Gv as ea,Hk as eb,Hv as ec,rf as ed,Tv as ee,Bk as ef,Iv as eg,zv as eh,jv as ei,qk as ej,Xd as ek,Hd as el,Gd as em,Qd as en,Yd as eo,vu as ep,Jd as eq,eu as er,yu as es,_u as et,Bd as eu,au as ev,gu as ew,Ou as ex,Nu as ey,Fu as ez,ww as f,Fb as g,Xb as h,Dv as i,Lb as j,qg as k,V_ as l,Ki as m,he as n,Gi as o,Ld as p,Qi as q,o as r,of as s,le as t,Yi as u,Hb as v,Xi as w,q as x,er as y,Ji as z}; diff --git a/config/www/community/frigate-hass-card/card-7cd05290.js.gz b/config/www/community/frigate-hass-card/card-7cd05290.js.gz new file mode 100644 index 00000000..9e6e3ec1 Binary files /dev/null and b/config/www/community/frigate-hass-card/card-7cd05290.js.gz differ diff --git a/config/www/community/frigate-hass-card/card-c642ee74.js b/config/www/community/frigate-hass-card/card-c642ee74.js new file mode 100644 index 00000000..a52d5fd4 --- /dev/null +++ b/config/www/community/frigate-hass-card/card-c642ee74.js @@ -0,0 +1,650 @@ +function e(e,t,n,a){var i,r=arguments.length,o=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,n):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,a);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(r<3?i(o):r>3?i(t,n,o):i(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o}"function"==typeof SuppressedError&&SuppressedError; +/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const t=globalThis,n=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,a=Symbol(),i=new WeakMap;let r=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==a)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(n&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=i.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&i.set(t,e))}return e}toString(){return this.cssText}};const o=e=>new r("string"==typeof e?e:e+"",void 0,a),s=(e,...t)=>{const n=1===e.length?e[0]:t.reduce(((t,n,a)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+e[a+1]),e[0]);return new r(n,e,a)},c=(e,a)=>{if(n)e.adoptedStyleSheets=a.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(const n of a){const a=document.createElement("style"),i=t.litNonce;void 0!==i&&a.setAttribute("nonce",i),a.textContent=n.cssText,e.appendChild(a)}},l=n?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return o(t)})(e):e +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,{is:d,defineProperty:u,getOwnPropertyDescriptor:h,getOwnPropertyNames:p,getOwnPropertySymbols:m,getPrototypeOf:g}=Object,f=globalThis,_=f.trustedTypes,v=_?_.emptyScript:"",y=f.reactiveElementPolyfillSupport,b=(e,t)=>e,w={toAttribute(e,t){switch(t){case Boolean:e=e?v:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},x=(e,t)=>!d(e,t),C={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:x};Symbol.metadata??=Symbol("metadata"),f.litPropertyMetadata??=new WeakMap;class M extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=C){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){const n=Symbol(),a=this.getPropertyDescriptor(e,n,t);void 0!==a&&u(this.prototype,e,a)}}static getPropertyDescriptor(e,t,n){const{get:a,set:i}=h(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get(){return a?.call(this)},set(t){const r=a?.call(this);i.call(this,t),this.requestUpdate(e,r,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??C}static _$Ei(){if(this.hasOwnProperty(b("elementProperties")))return;const e=g(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(b("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(b("properties"))){const e=this.properties,t=[...p(e),...m(e)];for(const n of t)this.createProperty(n,e[n])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const n=this._$Eu(e,t);void 0!==n&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(l(e))}else void 0!==e&&t.push(l(e));return t}static _$Eu(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((e=>e(this)))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return c(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((e=>e.hostConnected?.()))}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach((e=>e.hostDisconnected?.()))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EC(e,t){const n=this.constructor.elementProperties.get(e),a=this.constructor._$Eu(e,n);if(void 0!==a&&!0===n.reflect){const i=(void 0!==n.converter?.toAttribute?n.converter:w).toAttribute(t,n.type);this._$Em=e,null==i?this.removeAttribute(a):this.setAttribute(a,i),this._$Em=null}}_$AK(e,t){const n=this.constructor,a=n._$Eh.get(e);if(void 0!==a&&this._$Em!==a){const e=n.getPropertyOptions(a),i="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:w;this._$Em=a,this[a]=i.fromAttribute(t,e.type),this._$Em=null}}requestUpdate(e,t,n){if(void 0!==e){if(n??=this.constructor.getPropertyOptions(e),!(n.hasChanged??x)(this[e],t))return;this.P(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(e,t,n){this._$AL.has(e)||this._$AL.set(e,t),!0===n.reflect&&this._$Em!==e&&(this._$Ej??=new Set).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,n]of e)!0!==n.wrapped||this._$AL.has(t)||void 0===this[t]||this.P(t,this[t],n)}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach((e=>e.hostUpdate?.())),this.update(t)):this._$EU()}catch(t){throw e=!1,this._$EU(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&=this._$Ej.forEach((e=>this._$EC(e,this[e]))),this._$EU()}updated(e){}firstUpdated(e){}}M.elementStyles=[],M.shadowRootOptions={mode:"open"},M[b("elementProperties")]=new Map,M[b("finalized")]=new Map,y?.({ReactiveElement:M}),(f.reactiveElementVersions??=[]).push("2.0.4"); +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const k=globalThis,S=k.trustedTypes,E=S?S.createPolicy("lit-html",{createHTML:e=>e}):void 0,$="$lit$",A=`lit$${(Math.random()+"").slice(9)}$`,z="?"+A,I=`<${z}>`,T=document,j=()=>T.createComment(""),O=e=>null===e||"object"!=typeof e&&"function"!=typeof e,D=Array.isArray,R="[ \t\n\f\r]",P=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,L=/-->/g,N=/>/g,F=RegExp(`>|${R}(?:([^\\s"'>=/]+)(${R}*=${R}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),V=/'/g,H=/"/g,B=/^(?:script|style|textarea|title)$/i,q=(e=>(t,...n)=>({_$litType$:e,strings:t,values:n}))(1),U=Symbol.for("lit-noChange"),W=Symbol.for("lit-nothing"),Z=new WeakMap,Q=T.createTreeWalker(T,129);function G(e,t){if(!Array.isArray(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==E?E.createHTML(t):t}const Y=(e,t)=>{const n=e.length-1,a=[];let i,r=2===t?"":"",o=P;for(let t=0;t"===c[0]?(o=i??P,l=-1):void 0===c[1]?l=-2:(l=o.lastIndex-c[2].length,s=c[1],o=void 0===c[3]?F:'"'===c[3]?H:V):o===H||o===V?o=F:o===L||o===N?o=P:(o=F,i=void 0);const u=o===F&&e[t+1].startsWith("/>")?" ":"";r+=o===P?n+I:l>=0?(a.push(s),n.slice(0,l)+$+n.slice(l)+A+u):n+A+(-2===l?t:u)}return[G(e,r+(e[n]||"")+(2===t?"":"")),a]};class K{constructor({strings:e,_$litType$:t},n){let a;this.parts=[];let i=0,r=0;const o=e.length-1,s=this.parts,[c,l]=Y(e,t);if(this.el=K.createElement(c,n),Q.currentNode=this.el.content,2===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(a=Q.nextNode())&&s.length0){a.textContent=S?S.emptyScript:"";for(let n=0;nD(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}S(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.S(e))}_(e){this._$AH!==W&&O(this._$AH)?this._$AA.nextSibling.data=e:this.T(T.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:n}=e,a="number"==typeof n?this._$AC(e):(void 0===n.el&&(n.el=K.createElement(G(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===a)this._$AH.p(t);else{const e=new J(a,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=Z.get(e.strings);return void 0===t&&Z.set(e.strings,t=new K(e)),t}k(e){D(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,a=0;for(const i of e)a===t.length?t.push(n=new ee(this.S(j()),this.S(j()),this,this.options)):n=t[a],n._$AI(i),a++;a2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=W}_$AI(e,t=this,n,a){const i=this.strings;let r=!1;if(void 0===i)e=X(this,e,t,0),r=!O(e)||e!==this._$AH&&e!==U,r&&(this._$AH=e);else{const a=e;let o,s;for(e=i[0],o=0;o{const a=n?.renderBefore??t;let i=a._$litPart$;if(void 0===i){const e=n?.renderBefore??null;a._$litPart$=i=new ee(t.insertBefore(j(),e),e,void 0,n??{})}return i._$AI(e),i})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return U}};se._$litElement$=!0,se.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:se});const ce=globalThis.litElementPolyfillSupport;ce?.({LitElement:se}),(globalThis.litElementVersions??=[]).push("4.0.4"); +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const le=e=>(t,n)=>{void 0!==n?n.addInitializer((()=>{customElements.define(e,t)})):customElements.define(e,t)} +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,de={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:x},ue=(e=de,t,n)=>{const{kind:a,metadata:i}=n;let r=globalThis.litPropertyMetadata.get(i);if(void 0===r&&globalThis.litPropertyMetadata.set(i,r=new Map),r.set(n.name,e),"accessor"===a){const{name:a}=n;return{set(n){const i=t.get.call(this);t.set.call(this,n),this.requestUpdate(a,i,e)},init(t){return void 0!==t&&this.P(a,void 0,e),t}}}if("setter"===a){const{name:a}=n;return function(n){const i=this[a];t.call(this,n),this.requestUpdate(a,i,e)}}throw Error("Unsupported decorator location: "+a)};function he(e){return(t,n)=>"object"==typeof n?ue(e,t,n):((e,t,n)=>{const a=t.hasOwnProperty(n);return t.constructor.createProperty(n,a?{...e,wrapped:!0}:e),a?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n) +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */}function pe(e){return he({...e,state:!0,attribute:!1})} +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const me={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},ge=e=>(...t)=>({_$litDirective$:e,values:t});let fe=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}; +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const _e=ge(class extends fe{constructor(e){if(super(e),e.type!==me.ATTRIBUTE||"class"!==e.name||e.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter((t=>e[t])).join(" ")+" "}update(e,[t]){if(void 0===this.st){this.st=new Set,void 0!==e.strings&&(this.nt=new Set(e.strings.join(" ").split(/\s/).filter((e=>""!==e))));for(const e in t)t[e]&&!this.nt?.has(e)&&this.st.add(e);return this.render(t)}const n=e.element.classList;for(const e of this.st)e in t||(n.remove(e),this.st.delete(e));for(const e in t){const a=!!t[e];a===this.st.has(e)||this.nt?.has(e)||(a?(n.add(e),this.st.add(e)):(n.remove(e),this.st.delete(e)))}return U}}),ve=e=>e??W +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,ye=e=>null===e||"object"!=typeof e&&"function"!=typeof e,be=e=>void 0===e.strings,we={},xe=(e,t=we)=>e._$AH=t +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,Ce=(e,t)=>{const n=e._$AN;if(void 0===n)return!1;for(const e of n)e._$AO?.(t,!1),Ce(e,t);return!0},Me=e=>{let t,n;do{if(void 0===(t=e._$AM))break;n=t._$AN,n.delete(e),e=t}while(0===n?.size)},ke=e=>{for(let t;t=e._$AM;e=t){let n=t._$AN;if(void 0===n)t._$AN=n=new Set;else if(n.has(e))break;n.add(e),$e(t)}}; +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */function Se(e){void 0!==this._$AN?(Me(this),this._$AM=e,ke(this)):this._$AM=e}function Ee(e,t=!1,n=0){const a=this._$AH,i=this._$AN;if(void 0!==i&&0!==i.size)if(t)if(Array.isArray(a))for(let e=n;e{e.type==me.CHILD&&(e._$AP??=Ee,e._$AQ??=Se)};class Ae extends fe{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,n){super._$AT(e,t,n),ke(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(Ce(this,e),Me(this))}setValue(e){if(be(this._$Ct))this._$Ct._$AI(e,this);else{const t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}} +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const ze=()=>new Ie;let Ie=class{};const Te=new WeakMap,je=ge(class extends Ae{render(e){return W}update(e,[t]){const n=t!==this.Y;return n&&void 0!==this.Y&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.Y=t,this.ht=e.options?.host,this.rt(this.ct=e.element)),W}rt(e){if("function"==typeof this.Y){const t=this.ht??globalThis;let n=Te.get(t);void 0===n&&(n=new WeakMap,Te.set(t,n)),void 0!==n.get(this.Y)&&this.Y.call(this.ht,void 0),n.set(this.Y,e),void 0!==e&&this.Y.call(this.ht,e)}else this.Y.value=e}get lt(){return"function"==typeof this.Y?Te.get(this.ht??globalThis)?.get(this.Y):this.Y?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}}),Oe="important",De=" !"+Oe,Re=ge(class extends fe{constructor(e){if(super(e),e.type!==me.ATTRIBUTE||"style"!==e.name||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce(((t,n)=>{const a=e[n];return null==a?t:t+`${n=n.includes("-")?n:n.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${a};`}),"")}update(e,[t]){const{style:n}=e.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(t)),this.render(t);for(const e of this.ft)null==t[e]&&(this.ft.delete(e),e.includes("-")?n.removeProperty(e):n[e]=null);for(const e in t){const a=t[e];if(null!=a){this.ft.add(e);const t="string"==typeof a&&a.endsWith(De);e.includes("-")||t?n.setProperty(e,t?a.slice(0,-11):a,t?Oe:""):n[e]=a}}return U}}); +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */function Pe(e,t,n,a=20,i=0){let r=[];if(i>=a)return r;const o=e=>{const r=e.assignedNodes().filter((e=>1===e.nodeType));return r.length>0?Pe(r[0].parentElement,t,n,a,i+1):[]},s=Array.from(e.children||[]);for(const e of s)t(e)||(n(e)&&r.push(e),null!=e.shadowRoot?r.push(...Pe(e.shadowRoot,t,n,a,i+1)):"SLOT"===e.tagName?r.push(...o(e)):r.push(...Pe(e,t,n,a,i+1)));return r}function Le(e){return e.hasAttribute("hidden")||e.hasAttribute("aria-hidden")&&"false"!==e.getAttribute("aria-hidden")||"none"===e.style.display||"0"===e.style.opacity||"hidden"===e.style.visibility||"collapse"===e.style.visibility}function Ne(e){return"-1"!==e.getAttribute("tabindex")&&!Le(e)&&!function(e){return e.hasAttribute("disabled")||e.hasAttribute("aria-disabled")&&"false"!==e.getAttribute("aria-disabled")}(e)&&(e.hasAttribute("tabindex")||(e instanceof HTMLAnchorElement||e instanceof HTMLAreaElement)&&e.hasAttribute("href")||e instanceof HTMLButtonElement||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e instanceof HTMLIFrameElement)}const Fe=new Map;const Ve=document.createElement("template");Ve.innerHTML='\n\t
\n\t
\n\t\n\t
\n';class He extends HTMLElement{constructor(){super(),this.debounceId=Math.random().toString(),this._focused=!1;const e=this.attachShadow({mode:"open"});e.appendChild(Ve.content.cloneNode(!0)),this.$backup=e.querySelector("#backup"),this.$start=e.querySelector("#start"),this.$end=e.querySelector("#end"),this.focusLastElement=this.focusLastElement.bind(this),this.focusFirstElement=this.focusFirstElement.bind(this),this.onFocusIn=this.onFocusIn.bind(this),this.onFocusOut=this.onFocusOut.bind(this)}static get observedAttributes(){return["inactive"]}get inactive(){return this.hasAttribute("inactive")}set inactive(e){e?this.setAttribute("inactive",""):this.removeAttribute("inactive")}get focused(){return this._focused}connectedCallback(){this.$start.addEventListener("focus",this.focusLastElement),this.$end.addEventListener("focus",this.focusFirstElement),this.addEventListener("focusin",this.onFocusIn),this.addEventListener("focusout",this.onFocusOut),this.render()}disconnectedCallback(){this.$start.removeEventListener("focus",this.focusLastElement),this.$end.removeEventListener("focus",this.focusFirstElement),this.removeEventListener("focusin",this.onFocusIn),this.removeEventListener("focusout",this.onFocusOut)}attributeChangedCallback(){this.render()}focusFirstElement(){this.trapFocus()}focusLastElement(){this.trapFocus(!0)}getFocusableElements(){return Pe(this,Le,Ne)}trapFocus(e){if(this.inactive)return;let t=this.getFocusableElements();t.length>0?(e?t[t.length-1].focus():t[0].focus(),this.$backup.setAttribute("tabindex","-1")):(this.$backup.setAttribute("tabindex","0"),this.$backup.focus())}onFocusIn(){this.updateFocused(!0)}onFocusOut(){this.updateFocused(!1)}updateFocused(e){!function(e,t,n){const a=Fe.get(n);null!=a&&window.clearTimeout(a),Fe.set(n,window.setTimeout((()=>{e(),Fe.delete(n)}),t))}((()=>{this.focused!==e&&(this._focused=e,this.render())}),0,this.debounceId)}render(){this.$start.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.$end.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.focused?this.setAttribute("focused",""):this.removeAttribute("focused")}}function Be(e){return Number(e.getAttribute("data-dialog-count"))||0}function qe(e,t){e.setAttribute("data-dialog-count",t.toString())}function Ue(e=document.activeElement){return null!=e&&null!=e.shadowRoot&&null!=e.shadowRoot.activeElement?Ue(e.shadowRoot.activeElement):e}window.customElements.define("focus-trap",He);const We=document.createElement("template");We.innerHTML='\n \n
\n \n \n \n';class Ze extends HTMLElement{constructor(){super(),this.$scrollContainer=document.documentElement,this.$previousActiveElement=null;const e=this.attachShadow({mode:"open"});e.appendChild(We.content.cloneNode(!0)),this.$dialog=e.querySelector("#dialog"),this.$backdrop=e.querySelector("#backdrop"),this.onBackdropClick=this.onBackdropClick.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.setAttribute("aria-modal","true"),this.$dialog.setAttribute("role","alertdialog")}static get observedAttributes(){return["open","center"]}get open(){return this.hasAttribute("open")}set open(e){e?this.setAttribute("open",""):this.removeAttribute("open")}get center(){return this.hasAttribute("center")}set center(e){e?this.setAttribute("center",""):this.removeAttribute("center")}connectedCallback(){this.$backdrop.addEventListener("click",this.onBackdropClick)}disconnectedCallback(){this.$backdrop.removeEventListener("click",this.onBackdropClick),this.open&&this.didClose()}show(){this.open=!0}close(e){this.result=e,this.open=!1}onBackdropClick(){this.assertClosing()&&this.close()}onKeyDown(e){if("Escape"===e.code)this.assertClosing()&&(this.close(),e.stopImmediatePropagation())}assertClosing(){return this.dispatchEvent(new CustomEvent("closing",{cancelable:!0}))}didOpen(){this.$previousActiveElement=Ue(document.activeElement),requestAnimationFrame((()=>{this.$dialog.focusFirstElement()})),this.tabIndex=0,this.$scrollContainer.style.overflow="hidden",this.addEventListener("keydown",this.onKeyDown,{capture:!0,passive:!0}),qe(this.$scrollContainer,Be(this.$scrollContainer)+1),this.dispatchEvent(new CustomEvent("open"))}didClose(){this.removeEventListener("keydown",this.onKeyDown,{capture:!0}),qe(this.$scrollContainer,Math.max(0,Be(this.$scrollContainer)-1)),Be(this.$scrollContainer)<=0&&(this.$scrollContainer.style.overflow=""),this.tabIndex=-1,null!=this.$previousActiveElement&&(this.$previousActiveElement.focus(),this.$previousActiveElement=null),this.dispatchEvent(new CustomEvent("close",{detail:this.result}))}attributeChangedCallback(e,t,n){if("open"===e)this.open?this.didOpen():this.didClose()}}var Qe,Ge;function Ye(e){return e.substr(0,e.indexOf("."))}customElements.define("web-dialog",Ze),function(e){e.language="language",e.system="system",e.comma_decimal="comma_decimal",e.decimal_comma="decimal_comma",e.space_comma="space_comma",e.none="none"}(Qe||(Qe={})),function(e){e.language="language",e.system="system",e.am_pm="12",e.twenty_four="24"}(Ge||(Ge={}));var Ke,Xe,Je=["closed","locked","off"],et=function(e,t,n,a){a=a||{},n=null==n?{}:n;var i=new Event(t,{bubbles:void 0===a.bubbles||a.bubbles,cancelable:Boolean(a.cancelable),composed:void 0===a.composed||a.composed});return i.detail=n,e.dispatchEvent(i),i},tt=function(e){et(window,"haptic",e)},nt=function(e,t){return function(e,t,n){void 0===n&&(n=!0);var a,i=Ye(t),r="group"===i?"homeassistant":i;switch(i){case"lock":a=n?"unlock":"lock";break;case"cover":a=n?"open_cover":"close_cover";break;default:a=n?"turn_on":"turn_off"}return e.callService(r,a,{entity_id:t})}(e,t,Je.includes(e.states[t].state))},at=function(e,t,n,a){if(a||(a={action:"more-info"}),!a.confirmation||a.confirmation.exemptions&&a.confirmation.exemptions.some((function(e){return e.user===t.user.id}))||(tt("warning"),confirm(a.confirmation.text||"Are you sure you want to "+a.action+"?")))switch(a.action){case"more-info":(n.entity||n.camera_image)&&et(e,"hass-more-info",{entityId:n.entity?n.entity:n.camera_image});break;case"navigate":a.navigation_path&&function(e,t,n){void 0===n&&(n=!1),n?history.replaceState(null,"",t):history.pushState(null,"",t),et(window,"location-changed",{replace:n})}(0,a.navigation_path);break;case"url":a.url_path&&window.open(a.url_path);break;case"toggle":n.entity&&(nt(t,n.entity),tt("success"));break;case"perform-action":if(!a.perform_action)return void tt("failure");var i=a.perform_action.split(".",2);t.callService(i[0],i[1],a.data,a.target),tt("success");break;case"call-service":if(!a.service)return void tt("failure");var r=a.service.split(".",2);t.callService(r[0],r[1],a.data,a.target),tt("success");break;case"fire-dom-event":et(e,"ll-custom",a)}};!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},e.getValidEnumValues=t=>{const n=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),a={};for(const e of n)a[e]=t[e];return e.objectValues(a)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(const n of e)if(t(n))return n},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(Ke||(Ke={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(Xe||(Xe={}));const it=Ke.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),rt=e=>{switch(typeof e){case"undefined":return it.undefined;case"string":return it.string;case"number":return isNaN(e)?it.nan:it.number;case"boolean":return it.boolean;case"function":return it.function;case"bigint":return it.bigint;case"symbol":return it.symbol;case"object":return Array.isArray(e)?it.array:null===e?it.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?it.promise:"undefined"!=typeof Map&&e instanceof Map?it.map:"undefined"!=typeof Set&&e instanceof Set?it.set:"undefined"!=typeof Date&&e instanceof Date?it.date:it.object;default:return it.unknown}},ot=Ke.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class st extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},n={_errors:[]},a=e=>{for(const i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(a);else if("invalid_return_type"===i.code)a(i.returnTypeError);else if("invalid_arguments"===i.code)a(i.argumentsError);else if(0===i.path.length)n._errors.push(t(i));else{let e=n,a=0;for(;ae.message)){const t={},n=[];for(const a of this.issues)a.path.length>0?(t[a.path[0]]=t[a.path[0]]||[],t[a.path[0]].push(e(a))):n.push(e(a));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}st.create=e=>new st(e);const ct=(e,t)=>{let n;switch(e.code){case ot.invalid_type:n=e.received===it.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case ot.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Ke.jsonStringifyReplacer)}`;break;case ot.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ke.joinValues(e.keys,", ")}`;break;case ot.invalid_union:n="Invalid input";break;case ot.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ke.joinValues(e.options)}`;break;case ot.invalid_enum_value:n=`Invalid enum value. Expected ${Ke.joinValues(e.options)}, received '${e.received}'`;break;case ot.invalid_arguments:n="Invalid function arguments";break;case ot.invalid_return_type:n="Invalid function return type";break;case ot.invalid_date:n="Invalid date";break;case ot.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Ke.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case ot.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case ot.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case ot.custom:n="Invalid input";break;case ot.invalid_intersection_types:n="Intersection results could not be merged";break;case ot.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case ot.not_finite:n="Number must be finite";break;default:n=t.defaultError,Ke.assertNever(e)}return{message:n}};let lt=ct;function dt(){return lt}const ut=e=>{const{data:t,path:n,errorMaps:a,issueData:i}=e,r=[...n,...i.path||[]],o={...i,path:r};if(void 0!==i.message)return{...i,path:r,message:i.message};let s="";const c=a.filter((e=>!!e)).slice().reverse();for(const e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:r,message:s}};function ht(e,t){const n=dt(),a=ut({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===ct?void 0:ct].filter((e=>!!e))});e.common.issues.push(a)}class pt{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const a of t){if("aborted"===a.status)return mt;"dirty"===a.status&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const e of t){const t=await e.key,a=await e.value;n.push({key:t,value:a})}return pt.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const a of t){const{key:t,value:i}=a;if("aborted"===t.status)return mt;if("aborted"===i.status)return mt;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"===t.value||void 0===i.value&&!a.alwaysSet||(n[t.value]=i.value)}return{status:e.value,value:n}}}const mt=Object.freeze({status:"aborted"}),gt=e=>({status:"dirty",value:e}),ft=e=>({status:"valid",value:e}),_t=e=>"aborted"===e.status,vt=e=>"dirty"===e.status,yt=e=>"valid"===e.status,bt=e=>"undefined"!=typeof Promise&&e instanceof Promise;function wt(e,t,n,a){if("a"===n&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?a:"a"===n?a.call(e):a?a.value:t.get(e)}function xt(e,t,n,a,i){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?i.call(e,n):i?i.value=n:t.set(e,n),n}var Ct,Mt,kt;"function"==typeof SuppressedError&&SuppressedError,function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(Ct||(Ct={}));class St{constructor(e,t,n,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=a}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Et=(e,t)=>{if(yt(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new st(e.common.issues);return this._error=t,this._error}}};function $t(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:a,description:i}=e;if(t&&(n||a))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:i};return{errorMap:(t,i)=>{var r,o;const{message:s}=e;return"invalid_enum_value"===t.code?{message:null!=s?s:i.defaultError}:void 0===i.data?{message:null!==(r=null!=s?s:a)&&void 0!==r?r:i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:null!==(o=null!=s?s:n)&&void 0!==o?o:i.defaultError}},description:i}}class At{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return rt(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:rt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new pt,ctx:{common:e.parent.common,data:e.data,parsedType:rt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(bt(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const a={common:{issues:[],async:null!==(n=null==t?void 0:t.async)&&void 0!==n&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rt(e)},i=this._parseSync({data:e,path:a.path,parent:a});return Et(a,i)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rt(e)},a=this._parse({data:e,path:n.path,parent:n}),i=await(bt(a)?a:Promise.resolve(a));return Et(n,i)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,a)=>{const i=e(t),r=()=>a.addIssue({code:ot.custom,...n(t)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then((e=>!!e||(r(),!1))):!!i||(r(),!1)}))}refinement(e,t){return this._refinement(((n,a)=>!!e(n)||(a.addIssue("function"==typeof t?t(n,a):t),!1)))}_refinement(e){return new kn({schema:this,typeName:Pn.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Sn.create(this,this._def)}nullable(){return En.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return on.create(this,this._def)}promise(){return Mn.create(this,this._def)}or(e){return ln.create([this,e],this._def)}and(e){return pn.create(this,e,this._def)}transform(e){return new kn({...$t(this._def),schema:this,typeName:Pn.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new $n({...$t(this._def),innerType:this,defaultValue:t,typeName:Pn.ZodDefault})}brand(){return new Tn({typeName:Pn.ZodBranded,type:this,...$t(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new An({...$t(this._def),innerType:this,catchValue:t,typeName:Pn.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return jn.create(this,e)}readonly(){return On.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const zt=/^c[^\s-]{8,}$/i,It=/^[0-9a-z]+$/,Tt=/^[0-9A-HJKMNP-TV-Z]{26}$/,jt=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ot=/^[a-z0-9_-]{21}$/i,Dt=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Rt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let Pt;const Lt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Nt=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Ft=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Vt="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Ht=new RegExp(`^${Vt}$`);function Bt(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function qt(e){let t=`${Vt}T${Bt(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function Ut(e,t){return!("v4"!==t&&t||!Lt.test(e))||!("v6"!==t&&t||!Nt.test(e))}class Wt extends At{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==it.string){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.string,received:t.parsedType}),mt}const t=new pt;let n;for(const a of this._def.checks)if("min"===a.kind)e.data.lengtha.value&&(n=this._getOrReturnCtx(e,n),ht(n,{code:ot.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("length"===a.kind){const i=e.data.length>a.value,r=e.data.lengthe.test(t)),{validation:t,code:ot.invalid_string,...Ct.errToObj(n)})}_addCheck(e){return new Wt({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ct.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ct.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ct.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ct.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ct.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ct.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ct.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ct.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ct.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ct.errToObj(e)})}datetime(e){var t,n;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(n=null==e?void 0:e.local)&&void 0!==n&&n,...Ct.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...Ct.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Ct.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Ct.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...Ct.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Ct.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Ct.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Ct.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Ct.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Ct.errToObj(t)})}nonempty(e){return this.min(1,Ct.errToObj(e))}trim(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.valuea?n:a;return parseInt(e.toFixed(i).replace(".",""))%parseInt(t.toFixed(i).replace(".",""))/Math.pow(10,i)}Wt.create=e=>{var t;return new Wt({checks:[],typeName:Pn.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...$t(e)})};class Qt extends At{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==it.number){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.number,received:t.parsedType}),mt}let t;const n=new pt;for(const a of this._def.checks)if("int"===a.kind)Ke.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty());else if("min"===a.kind){(a.inclusive?e.dataa.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty())}else"multipleOf"===a.kind?0!==Zt(e.data,a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.not_finite,message:a.message}),n.dirty()):Ke.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ct.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ct.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ct.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ct.toString(t))}setLimit(e,t,n,a){return new Qt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Ct.toString(a)}]})}_addCheck(e){return new Qt({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ct.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ct.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ct.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ct.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ct.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ct.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Ct.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ct.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ct.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value"int"===e.kind||"multipleOf"===e.kind&&Ke.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.valuenew Qt({checks:[],typeName:Pn.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...$t(e)});class Gt extends At{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){this._def.coerce&&(e.data=BigInt(e.data));if(this._getType(e)!==it.bigint){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.bigint,received:t.parsedType}),mt}let t;const n=new pt;for(const a of this._def.checks)if("min"===a.kind){(a.inclusive?e.dataa.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty())}else"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):Ke.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ct.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ct.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ct.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ct.toString(t))}setLimit(e,t,n,a){return new Gt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Ct.toString(a)}]})}_addCheck(e){return new Gt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ct.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ct.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ct.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ct.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ct.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value{var t;return new Gt({checks:[],typeName:Pn.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...$t(e)})};class Yt extends At{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==it.boolean){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.boolean,received:t.parsedType}),mt}return ft(e.data)}}Yt.create=e=>new Yt({typeName:Pn.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...$t(e)});class Kt extends At{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==it.date){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.date,received:t.parsedType}),mt}if(isNaN(e.data.getTime())){return ht(this._getOrReturnCtx(e),{code:ot.invalid_date}),mt}const t=new pt;let n;for(const a of this._def.checks)"min"===a.kind?e.data.getTime()a.value&&(n=this._getOrReturnCtx(e,n),ht(n,{code:ot.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),t.dirty()):Ke.assertNever(a);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Kt({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Ct.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Ct.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.valuenew Kt({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Pn.ZodDate,...$t(e)});class Xt extends At{_parse(e){if(this._getType(e)!==it.symbol){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.symbol,received:t.parsedType}),mt}return ft(e.data)}}Xt.create=e=>new Xt({typeName:Pn.ZodSymbol,...$t(e)});class Jt extends At{_parse(e){if(this._getType(e)!==it.undefined){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.undefined,received:t.parsedType}),mt}return ft(e.data)}}Jt.create=e=>new Jt({typeName:Pn.ZodUndefined,...$t(e)});class en extends At{_parse(e){if(this._getType(e)!==it.null){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.null,received:t.parsedType}),mt}return ft(e.data)}}en.create=e=>new en({typeName:Pn.ZodNull,...$t(e)});class tn extends At{constructor(){super(...arguments),this._any=!0}_parse(e){return ft(e.data)}}tn.create=e=>new tn({typeName:Pn.ZodAny,...$t(e)});class nn extends At{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ft(e.data)}}nn.create=e=>new nn({typeName:Pn.ZodUnknown,...$t(e)});class an extends At{_parse(e){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.never,received:t.parsedType}),mt}}an.create=e=>new an({typeName:Pn.ZodNever,...$t(e)});class rn extends At{_parse(e){if(this._getType(e)!==it.undefined){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.void,received:t.parsedType}),mt}return ft(e.data)}}rn.create=e=>new rn({typeName:Pn.ZodVoid,...$t(e)});class on extends At{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),a=this._def;if(t.parsedType!==it.array)return ht(t,{code:ot.invalid_type,expected:it.array,received:t.parsedType}),mt;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,i=t.data.lengtha.maxLength.value&&(ht(t,{code:ot.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map(((e,n)=>a.type._parseAsync(new St(t,e,t.path,n))))).then((e=>pt.mergeArray(n,e)));const i=[...t.data].map(((e,n)=>a.type._parseSync(new St(t,e,t.path,n))));return pt.mergeArray(n,i)}get element(){return this._def.type}min(e,t){return new on({...this._def,minLength:{value:e,message:Ct.toString(t)}})}max(e,t){return new on({...this._def,maxLength:{value:e,message:Ct.toString(t)}})}length(e,t){return new on({...this._def,exactLength:{value:e,message:Ct.toString(t)}})}nonempty(e){return this.min(1,e)}}function sn(e){if(e instanceof cn){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=Sn.create(sn(a))}return new cn({...e._def,shape:()=>t})}return e instanceof on?new on({...e._def,type:sn(e.element)}):e instanceof Sn?Sn.create(sn(e.unwrap())):e instanceof En?En.create(sn(e.unwrap())):e instanceof mn?mn.create(e.items.map((e=>sn(e)))):e}on.create=(e,t)=>new on({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Pn.ZodArray,...$t(t)});class cn extends At{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=Ke.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==it.object){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.object,received:t.parsedType}),mt}const{status:t,ctx:n}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),r=[];if(!(this._def.catchall instanceof an&&"strip"===this._def.unknownKeys))for(const e in n.data)i.includes(e)||r.push(e);const o=[];for(const e of i){const t=a[e],i=n.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new St(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof an){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of r)o.push({key:{status:"valid",value:e},value:{status:"valid",value:n.data[e]}});else if("strict"===e)r.length>0&&(ht(n,{code:ot.unrecognized_keys,keys:r}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of r){const a=n.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new St(n,a,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of o){const n=await t.key,a=await t.value;e.push({key:n,value:a,alwaysSet:t.alwaysSet})}return e})).then((e=>pt.mergeObjectSync(t,e))):pt.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return Ct.errToObj,new cn({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var a,i,r,o;const s=null!==(r=null===(i=(a=this._def).errorMap)||void 0===i?void 0:i.call(a,t,n).message)&&void 0!==r?r:n.defaultError;return"unrecognized_keys"===t.code?{message:null!==(o=Ct.errToObj(e).message)&&void 0!==o?o:s}:{message:s}}}:{}})}strip(){return new cn({...this._def,unknownKeys:"strip"})}passthrough(){return new cn({...this._def,unknownKeys:"passthrough"})}extend(e){return new cn({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new cn({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Pn.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new cn({...this._def,catchall:e})}pick(e){const t={};return Ke.objectKeys(e).forEach((n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])})),new cn({...this._def,shape:()=>t})}omit(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{e[n]||(t[n]=this.shape[n])})),new cn({...this._def,shape:()=>t})}deepPartial(){return sn(this)}partial(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{const a=this.shape[n];e&&!e[n]?t[n]=a:t[n]=a.optional()})),new cn({...this._def,shape:()=>t})}required(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof Sn;)e=e._def.innerType;t[n]=e}})),new cn({...this._def,shape:()=>t})}keyof(){return wn(Ke.objectKeys(this.shape))}}cn.create=(e,t)=>new cn({shape:()=>e,unknownKeys:"strip",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)}),cn.strictCreate=(e,t)=>new cn({shape:()=>e,unknownKeys:"strict",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)}),cn.lazycreate=(e,t)=>new cn({shape:e,unknownKeys:"strip",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)});class ln extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map((async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;const n=e.map((e=>new st(e.ctx.common.issues)));return ht(t,{code:ot.invalid_union,unionErrors:n}),mt}));{let e;const a=[];for(const i of n){const n={...t,common:{...t.common,issues:[]},parent:null},r=i._parseSync({data:t.data,path:t.path,parent:n});if("valid"===r.status)return r;"dirty"!==r.status||e||(e={result:r,ctx:n}),n.common.issues.length&&a.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const i=a.map((e=>new st(e)));return ht(t,{code:ot.invalid_union,unionErrors:i}),mt}}get options(){return this._def.options}}ln.create=(e,t)=>new ln({options:e,typeName:Pn.ZodUnion,...$t(t)});const dn=e=>e instanceof yn?dn(e.schema):e instanceof kn?dn(e.innerType()):e instanceof bn?[e.value]:e instanceof xn?e.options:e instanceof Cn?Ke.objectValues(e.enum):e instanceof $n?dn(e._def.innerType):e instanceof Jt?[void 0]:e instanceof en?[null]:e instanceof Sn?[void 0,...dn(e.unwrap())]:e instanceof En?[null,...dn(e.unwrap())]:e instanceof Tn||e instanceof On?dn(e.unwrap()):e instanceof An?dn(e._def.innerType):[];class un extends At{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.object)return ht(t,{code:ot.invalid_type,expected:it.object,received:t.parsedType}),mt;const n=this.discriminator,a=t.data[n],i=this.optionsMap.get(a);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(ht(t,{code:ot.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),mt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const a=new Map;for(const n of t){const t=dn(n.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const i of t){if(a.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);a.set(i,n)}}return new un({typeName:Pn.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...$t(n)})}}function hn(e,t){const n=rt(e),a=rt(t);if(e===t)return{valid:!0,data:e};if(n===it.object&&a===it.object){const n=Ke.objectKeys(t),a=Ke.objectKeys(e).filter((e=>-1!==n.indexOf(e))),i={...e,...t};for(const n of a){const a=hn(e[n],t[n]);if(!a.valid)return{valid:!1};i[n]=a.data}return{valid:!0,data:i}}if(n===it.array&&a===it.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let a=0;a{if(_t(e)||_t(a))return mt;const i=hn(e.value,a.value);return i.valid?((vt(e)||vt(a))&&t.dirty(),{status:t.value,value:i.data}):(ht(n,{code:ot.invalid_intersection_types}),mt)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then((([e,t])=>a(e,t))):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}pn.create=(e,t,n)=>new pn({left:e,right:t,typeName:Pn.ZodIntersection,...$t(n)});class mn extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.array)return ht(n,{code:ot.invalid_type,expected:it.array,received:n.parsedType}),mt;if(n.data.lengththis._def.items.length&&(ht(n,{code:ot.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map(((e,t)=>{const a=this._def.items[t]||this._def.rest;return a?a._parse(new St(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(a).then((e=>pt.mergeArray(t,e))):pt.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new mn({...this._def,rest:e})}}mn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new mn({items:e,typeName:Pn.ZodTuple,rest:null,...$t(t)})};class gn extends At{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.object)return ht(n,{code:ot.invalid_type,expected:it.object,received:n.parsedType}),mt;const a=[],i=this._def.keyType,r=this._def.valueType;for(const e in n.data)a.push({key:i._parse(new St(n,e,n.path,e)),value:r._parse(new St(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?pt.mergeObjectAsync(t,a):pt.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,n){return new gn(t instanceof At?{keyType:e,valueType:t,typeName:Pn.ZodRecord,...$t(n)}:{keyType:Wt.create(),valueType:e,typeName:Pn.ZodRecord,...$t(t)})}}class fn extends At{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.map)return ht(n,{code:ot.invalid_type,expected:it.map,received:n.parsedType}),mt;const a=this._def.keyType,i=this._def.valueType,r=[...n.data.entries()].map((([e,t],r)=>({key:a._parse(new St(n,e,n.path,[r,"key"])),value:i._parse(new St(n,t,n.path,[r,"value"]))})));if(n.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const n of r){const a=await n.key,i=await n.value;if("aborted"===a.status||"aborted"===i.status)return mt;"dirty"!==a.status&&"dirty"!==i.status||t.dirty(),e.set(a.value,i.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const n of r){const a=n.key,i=n.value;if("aborted"===a.status||"aborted"===i.status)return mt;"dirty"!==a.status&&"dirty"!==i.status||t.dirty(),e.set(a.value,i.value)}return{status:t.value,value:e}}}}fn.create=(e,t,n)=>new fn({valueType:t,keyType:e,typeName:Pn.ZodMap,...$t(n)});class _n extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.set)return ht(n,{code:ot.invalid_type,expected:it.set,received:n.parsedType}),mt;const a=this._def;null!==a.minSize&&n.data.sizea.maxSize.value&&(ht(n,{code:ot.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const i=this._def.valueType;function r(e){const n=new Set;for(const a of e){if("aborted"===a.status)return mt;"dirty"===a.status&&t.dirty(),n.add(a.value)}return{status:t.value,value:n}}const o=[...n.data.values()].map(((e,t)=>i._parse(new St(n,e,n.path,t))));return n.common.async?Promise.all(o).then((e=>r(e))):r(o)}min(e,t){return new _n({...this._def,minSize:{value:e,message:Ct.toString(t)}})}max(e,t){return new _n({...this._def,maxSize:{value:e,message:Ct.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}_n.create=(e,t)=>new _n({valueType:e,minSize:null,maxSize:null,typeName:Pn.ZodSet,...$t(t)});class vn extends At{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.function)return ht(t,{code:ot.invalid_type,expected:it.function,received:t.parsedType}),mt;function n(e,n){return ut({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,dt(),ct].filter((e=>!!e)),issueData:{code:ot.invalid_arguments,argumentsError:n}})}function a(e,n){return ut({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,dt(),ct].filter((e=>!!e)),issueData:{code:ot.invalid_return_type,returnTypeError:n}})}const i={errorMap:t.common.contextualErrorMap},r=t.data;if(this._def.returns instanceof Mn){const e=this;return ft((async function(...t){const o=new st([]),s=await e._def.args.parseAsync(t,i).catch((e=>{throw o.addIssue(n(t,e)),o})),c=await Reflect.apply(r,this,s),l=await e._def.returns._def.type.parseAsync(c,i).catch((e=>{throw o.addIssue(a(c,e)),o}));return l}))}{const e=this;return ft((function(...t){const o=e._def.args.safeParse(t,i);if(!o.success)throw new st([n(t,o.error)]);const s=Reflect.apply(r,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new st([a(s,c.error)]);return c.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new vn({...this._def,args:mn.create(e).rest(nn.create())})}returns(e){return new vn({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new vn({args:e||mn.create([]).rest(nn.create()),returns:t||nn.create(),typeName:Pn.ZodFunction,...$t(n)})}}class yn extends At{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}yn.create=(e,t)=>new yn({getter:e,typeName:Pn.ZodLazy,...$t(t)});class bn extends At{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return ht(t,{received:t.data,code:ot.invalid_literal,expected:this._def.value}),mt}return{status:"valid",value:e.data}}get value(){return this._def.value}}function wn(e,t){return new xn({values:e,typeName:Pn.ZodEnum,...$t(t)})}bn.create=(e,t)=>new bn({value:e,typeName:Pn.ZodLiteral,...$t(t)});class xn extends At{constructor(){super(...arguments),Mt.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return ht(t,{expected:Ke.joinValues(n),received:t.parsedType,code:ot.invalid_type}),mt}if(wt(this,Mt,"f")||xt(this,Mt,new Set(this._def.values),"f"),!wt(this,Mt,"f").has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return ht(t,{received:t.data,code:ot.invalid_enum_value,options:n}),mt}return ft(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return xn.create(e,{...this._def,...t})}exclude(e,t=this._def){return xn.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}Mt=new WeakMap,xn.create=wn;class Cn extends At{constructor(){super(...arguments),kt.set(this,void 0)}_parse(e){const t=Ke.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==it.string&&n.parsedType!==it.number){const e=Ke.objectValues(t);return ht(n,{expected:Ke.joinValues(e),received:n.parsedType,code:ot.invalid_type}),mt}if(wt(this,kt,"f")||xt(this,kt,new Set(Ke.getValidEnumValues(this._def.values)),"f"),!wt(this,kt,"f").has(e.data)){const e=Ke.objectValues(t);return ht(n,{received:n.data,code:ot.invalid_enum_value,options:e}),mt}return ft(e.data)}get enum(){return this._def.values}}kt=new WeakMap,Cn.create=(e,t)=>new Cn({values:e,typeName:Pn.ZodNativeEnum,...$t(t)});class Mn extends At{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.promise&&!1===t.common.async)return ht(t,{code:ot.invalid_type,expected:it.promise,received:t.parsedType}),mt;const n=t.parsedType===it.promise?t.data:Promise.resolve(t.data);return ft(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}Mn.create=(e,t)=>new Mn({type:e,typeName:Pn.ZodPromise,...$t(t)});class kn extends At{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Pn.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),a=this._def.effect||null,i={addIssue:e=>{ht(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===a.type){const e=a.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return mt;const a=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===a.status?mt:"dirty"===a.status||"dirty"===t.value?gt(a.value):a}));{if("aborted"===t.value)return mt;const a=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===a.status?mt:"dirty"===a.status||"dirty"===t.value?gt(a.value):a}}if("refinement"===a.type){const e=e=>{const t=a.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===n.common.async){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===a.status?mt:("dirty"===a.status&&t.dirty(),e(a.value),{status:t.value,value:a.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((n=>"aborted"===n.status?mt:("dirty"===n.status&&t.dirty(),e(n.value).then((()=>({status:t.value,value:n.value}))))))}if("transform"===a.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!yt(e))return e;const r=a.transform(e.value,i);if(r instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:r}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((e=>yt(e)?Promise.resolve(a.transform(e.value,i)).then((e=>({status:t.value,value:e}))):e))}Ke.assertNever(a)}}kn.create=(e,t,n)=>new kn({schema:e,typeName:Pn.ZodEffects,effect:t,...$t(n)}),kn.createWithPreprocess=(e,t,n)=>new kn({schema:t,effect:{type:"preprocess",transform:e},typeName:Pn.ZodEffects,...$t(n)});class Sn extends At{_parse(e){return this._getType(e)===it.undefined?ft(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Sn.create=(e,t)=>new Sn({innerType:e,typeName:Pn.ZodOptional,...$t(t)});class En extends At{_parse(e){return this._getType(e)===it.null?ft(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}En.create=(e,t)=>new En({innerType:e,typeName:Pn.ZodNullable,...$t(t)});class $n extends At{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===it.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}$n.create=(e,t)=>new $n({innerType:e,typeName:Pn.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...$t(t)});class An extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return bt(a)?a.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new st(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new st(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}An.create=(e,t)=>new An({innerType:e,typeName:Pn.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...$t(t)});class zn extends At{_parse(e){if(this._getType(e)!==it.nan){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.nan,received:t.parsedType}),mt}return{status:"valid",value:e.data}}}zn.create=e=>new zn({typeName:Pn.ZodNaN,...$t(e)});const In=Symbol("zod_brand");class Tn extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class jn extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?mt:"dirty"===e.status?(t.dirty(),gt(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})()}{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?mt:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new jn({in:e,out:t,typeName:Pn.ZodPipeline})}}class On extends At{_parse(e){const t=this._def.innerType._parse(e),n=e=>(yt(e)&&(e.value=Object.freeze(e.value)),e);return bt(t)?t.then((e=>n(e))):n(t)}unwrap(){return this._def.innerType}}function Dn(e,t={},n){return e?tn.create().superRefine(((a,i)=>{var r,o;if(!e(a)){const e="function"==typeof t?t(a):"string"==typeof t?{message:t}:t,s=null===(o=null!==(r=e.fatal)&&void 0!==r?r:n)||void 0===o||o,c="string"==typeof e?{message:e}:e;i.addIssue({code:"custom",...c,fatal:s})}})):tn.create()}On.create=(e,t)=>new On({innerType:e,typeName:Pn.ZodReadonly,...$t(t)});const Rn={object:cn.lazycreate};var Pn;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(Pn||(Pn={}));const Ln=Wt.create,Nn=Qt.create,Fn=zn.create,Vn=Gt.create,Hn=Yt.create,Bn=Kt.create,qn=Xt.create,Un=Jt.create,Wn=en.create,Zn=tn.create,Qn=nn.create,Gn=an.create,Yn=rn.create,Kn=on.create,Xn=cn.create,Jn=cn.strictCreate,ea=ln.create,ta=un.create,na=pn.create,aa=mn.create,ia=gn.create,ra=fn.create,oa=_n.create,sa=vn.create,ca=yn.create,la=bn.create,da=xn.create,ua=Cn.create,ha=Mn.create,pa=kn.create,ma=Sn.create,ga=En.create,fa=kn.createWithPreprocess,_a=jn.create,va={string:e=>Wt.create({...e,coerce:!0}),number:e=>Qt.create({...e,coerce:!0}),boolean:e=>Yt.create({...e,coerce:!0}),bigint:e=>Gt.create({...e,coerce:!0}),date:e=>Kt.create({...e,coerce:!0})},ya=mt;var ba=Object.freeze({__proto__:null,defaultErrorMap:ct,setErrorMap:function(e){lt=e},getErrorMap:dt,makeIssue:ut,EMPTY_PATH:[],addIssueToContext:ht,ParseStatus:pt,INVALID:mt,DIRTY:gt,OK:ft,isAborted:_t,isDirty:vt,isValid:yt,isAsync:bt,get util(){return Ke},get objectUtil(){return Xe},ZodParsedType:it,getParsedType:rt,ZodType:At,datetimeRegex:qt,ZodString:Wt,ZodNumber:Qt,ZodBigInt:Gt,ZodBoolean:Yt,ZodDate:Kt,ZodSymbol:Xt,ZodUndefined:Jt,ZodNull:en,ZodAny:tn,ZodUnknown:nn,ZodNever:an,ZodVoid:rn,ZodArray:on,ZodObject:cn,ZodUnion:ln,ZodDiscriminatedUnion:un,ZodIntersection:pn,ZodTuple:mn,ZodRecord:gn,ZodMap:fn,ZodSet:_n,ZodFunction:vn,ZodLazy:yn,ZodLiteral:bn,ZodEnum:xn,ZodNativeEnum:Cn,ZodPromise:Mn,ZodEffects:kn,ZodTransformer:kn,ZodOptional:Sn,ZodNullable:En,ZodDefault:$n,ZodCatch:An,ZodNaN:zn,BRAND:In,ZodBranded:Tn,ZodPipeline:jn,ZodReadonly:On,custom:Dn,Schema:At,ZodSchema:At,late:Rn,get ZodFirstPartyTypeKind(){return Pn},coerce:va,any:Zn,array:Kn,bigint:Vn,boolean:Hn,date:Bn,discriminatedUnion:ta,effect:pa,enum:da,function:sa,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>Dn((t=>t instanceof e),t),intersection:na,lazy:ca,literal:la,map:ra,nan:Fn,nativeEnum:ua,never:Gn,null:Wn,nullable:ga,number:Nn,object:Xn,oboolean:()=>Hn().optional(),onumber:()=>Nn().optional(),optional:ma,ostring:()=>Ln().optional(),pipeline:_a,preprocess:fa,promise:ha,record:ia,set:oa,strictObject:Jn,string:Ln,symbol:qn,transformer:pa,tuple:aa,undefined:Un,union:ea,unknown:Qn,void:Yn,NEVER:ya,ZodIssueCode:ot,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:st});const wa="https://github.com/dermotduffy/frigate-hass-card",xa=`${wa}#troubleshooting`,Ca="cameras",Ma=`${Ca}.#.camera_entity`,ka=`${Ca}.#.frigate.camera_name`,Sa=`${Ca}.#.capabilities.disable`,Ea=`${Ca}.#.capabilities.disable_except`,$a=`${Ca}.#.cast.method`,Aa=`${Ca}.#.cast.dashboard.dashboard_path`,za=`${Ca}.#.cast.dashboard.view_path`,Ia=`${Ca}.#.dimensions.aspect_ratio`,Ta=`${Ca}.#.frigate.client_id`,ja=`${Ca}.#.frigate.labels`,Oa=`${Ca}.#.frigate.url`,Da=`${Ca}.#.frigate.zones`,Ra=`${Ca}.#.go2rtc.modes`,Pa=`${Ca}.#.go2rtc.stream`,La=`${Ca}.#.icon`,Na=`${Ca}.#.id`,Fa=`${Ca}.#.image.entity`,Va=`${Ca}.#.image.entity_parameters`,Ha=`${Ca}.#.image.mode`,Ba=`${Ca}.#.image.refresh_seconds`,qa=`${Ca}.#.image.url`,Ua=`${Ca}.#.motioneye.images.directory_pattern`,Wa=`${Ca}.#.motioneye.images.file_pattern`,Za=`${Ca}.#.motioneye.movies.directory_pattern`,Qa=`${Ca}.#.motioneye.movies.file_pattern`,Ga=`${Ca}.#.motioneye.url`,Ya=`${Ca}.#.title`,Ka=`${Ca}.#.webrtc_card.entity`,Xa=`${Ca}.#.webrtc_card.url`,Ja=`${Ca}.#.live_provider`,ei=`${Ca}.#.dependencies.cameras`,ti=`${Ca}.#.dependencies.all_cameras`,ni=`${Ca}.#.dimensions.layout.fit`,ai=`${Ca}.#.dimensions.layout.pan.x`,ii=`${Ca}.#.dimensions.layout.pan.y`,ri=`${Ca}.#.dimensions.layout.position.x`,oi=`${Ca}.#.dimensions.layout.position.y`,si=`${Ca}.#.dimensions.layout.view_box.top`,ci=`${Ca}.#.dimensions.layout.view_box.bottom`,li=`${Ca}.#.dimensions.layout.view_box.left`,di=`${Ca}.#.dimensions.layout.view_box.right`,ui=`${Ca}.#.dimensions.layout.zoom`,hi=`${Ca}.#.proxy.dynamic`,pi=`${Ca}.#.proxy.media`,mi=`${Ca}.#.proxy.ssl_ciphers`,gi=`${Ca}.#.proxy.ssl_verification`,fi=`${Ca}.#.reolink.media_resolution`,_i=`${Ca}.#.reolink.url`,vi=`${Ca}.#.triggers.motion`,yi=`${Ca}.#.triggers.occupancy`,bi=`${Ca}.#.triggers.entities`,wi=`${Ca}.#.triggers.events`,xi="cameras_global",Ci=`${xi}.image`,Mi=`${xi}.live_provider`,ki=`${xi}.jsmpeg`,Si=`${xi}.webrtc_card`,Ei=`${xi}.triggers.occupancy`,$i=`${xi}.image.refresh_seconds`,Ai=`${xi}.dimensions.layout`,zi=`${xi}.ptz`,Ii="elements",Ti="view",ji=`${Ti}.camera_select`,Oi=`${Ti}.dark_mode`,Di=`${Ti}.default`,Ri=`${Ti}.interaction_seconds`,Pi=`${Ti}.keyboard_shortcuts`,Li=`${Ti}.keyboard_shortcuts.enabled`,Ni=`${Pi}.ptz_left`,Fi=`${Pi}.ptz_right`,Vi=`${Pi}.ptz_up`,Hi=`${Pi}.ptz_down`,Bi=`${Pi}.ptz_zoom_in`,qi=`${Pi}.ptz_zoom_out`,Ui=`${Pi}.ptz_home`,Wi=`${Ti}.default_cycle_camera`,Zi=`${Ti}.default_reset`,Qi=`${Zi}.interaction_mode`,Gi=`${Zi}.every_seconds`,Yi=`${Zi}.entities`,Ki=`${Zi}.after_interaction`,Xi=`${Ti}.triggers`,Ji=`${Xi}.show_trigger_status`,er=`${Xi}.filter_selected_camera`,tr=`${Xi}.untrigger_seconds`,nr=`${Xi}.actions`,ar=`${nr}.trigger`,ir=`${nr}.untrigger`,rr=`${nr}.interaction_mode`,or="media_gallery",sr=`${or}.controls.filter.mode`,cr=`${or}.controls.thumbnails.show_details`,lr=`${or}.controls.thumbnails.show_download_control`,dr=`${or}.controls.thumbnails.show_favorite_control`,ur=`${or}.controls.thumbnails.show_timeline_control`,hr=`${or}.controls.thumbnails.size`,pr="media_viewer",mr=`${pr}.auto_play`,gr=`${pr}.auto_pause`,fr=`${pr}.auto_mute`,_r=`${pr}.auto_unmute`,vr=`${pr}.display.mode`,yr=`${pr}.display.grid_columns`,br=`${pr}.display.grid_max_columns`,wr=`${pr}.display.grid_selected_width_factor`,xr=`${pr}.draggable`,Cr=`${pr}.lazy_load`,Mr=`${pr}.snapshot_click_plays_clip`,kr=`${pr}.transition_effect`,Sr=`${pr}.controls.builtin`,Er=`${pr}.controls.next_previous.style`,$r=`${pr}.controls.next_previous.size`,Ar=`${pr}.controls.thumbnails.mode`,zr=`${pr}.controls.thumbnails.show_details`,Ir=`${pr}.controls.thumbnails.show_download_control`,Tr=`${pr}.controls.thumbnails.show_favorite_control`,jr=`${pr}.controls.thumbnails.show_timeline_control`,Or=`${pr}.controls.thumbnails.size`,Dr=`${pr}.controls.timeline.clustering_threshold`,Rr=`${pr}.controls.timeline.events_media_type`,Pr=`${pr}.controls.timeline.mode`,Lr=`${pr}.controls.timeline.pan_mode`,Nr=`${pr}.controls.timeline.show_recordings`,Fr=`${pr}.controls.timeline.style`,Vr=`${pr}.controls.timeline.window_seconds`,Hr=`${pr}.zoomable`,Br="live",qr=`${Br}.auto_play`,Ur=`${Br}.auto_pause`,Wr=`${Br}.auto_mute`,Zr=`${Br}.auto_unmute`,Qr=`${Br}.controls.builtin`,Gr=`${Br}.controls.next_previous.style`,Yr=`${Br}.controls.next_previous.size`,Kr=`${Br}.controls.ptz.hide_home`,Xr=`${Br}.controls.ptz.hide_pan_tilt`,Jr=`${Br}.controls.ptz.hide_zoom`,eo=`${Br}.controls.ptz.mode`,to=`${Br}.controls.ptz.orientation`,no=`${Br}.controls.ptz.position`,ao=`${Br}.controls.thumbnails.media_type`,io=`${Br}.controls.thumbnails.events_media_type`,ro=`${Br}.controls.thumbnails.mode`,oo=`${Br}.controls.thumbnails.size`,so=`${Br}.controls.thumbnails.show_details`,co=`${Br}.controls.thumbnails.show_download_control`,lo=`${Br}.controls.thumbnails.show_favorite_control`,uo=`${Br}.controls.thumbnails.show_timeline_control`,ho=`${Br}.controls.timeline.clustering_threshold`,po=`${Br}.controls.timeline.events_media_type`,mo=`${Br}.controls.timeline.mode`,go=`${Br}.controls.timeline.pan_mode`,fo=`${Br}.controls.timeline.show_recordings`,_o=`${Br}.controls.timeline.style`,vo=`${Br}.controls.timeline.window_seconds`,yo=`${Br}.display.mode`,bo=`${Br}.display.grid_columns`,wo=`${Br}.display.grid_max_columns`,xo=`${Br}.display.grid_selected_width_factor`,Co=`${Br}.draggable`,Mo=`${Br}.lazy_load`,ko=`${Br}.lazy_unload`,So=`${Br}.preload`,Eo=`${Br}.transition_effect`,$o=`${Br}.show_image_during_load`,Ao=`${Br}.microphone.disconnect_seconds`,zo=`${Br}.microphone.mute_after_microphone_mute_seconds`,Io=`${Br}.microphone.always_connected`,To=`${Br}.zoomable`,jo="image",Oo=`${jo}.entity`,Do=`${jo}.entity_parameters`,Ro=`${jo}.mode`,Po=`${jo}.refresh_seconds`,Lo=`${jo}.url`,No="timeline",Fo=`${No}.window_seconds`,Vo=`${No}.clustering_threshold`,Ho=`${No}.events_media_type`,Bo=`${No}.show_recordings`,qo=`${No}.style`,Uo=`${No}.controls.thumbnails.mode`,Wo=`${No}.controls.thumbnails.size`,Zo=`${No}.controls.thumbnails.show_details`,Qo=`${No}.controls.thumbnails.show_download_control`,Go=`${No}.controls.thumbnails.show_favorite_control`,Yo=`${No}.controls.thumbnails.show_timeline_control`,Ko="menu",Xo=`${Ko}.alignment`,Jo=`${Ko}.position`,es=`${Ko}.style`,ts=`${Ko}.button_size`,ns=`${Ko}.buttons`,as=`${ns}.frigate`,is=`${ns}.camera_ui`,rs=`${ns}.fullscreen`,os=`${ns}.play`,ss=`${ns}.mute`,cs=`${ns}.media_player`,ls=`${ns}.timeline`,ds="status_bar",us=`${ds}.position`,hs=`${ds}.style`,ps=`${ds}.popup_seconds`,ms=`${ds}.height`,gs=`${ds}.items`,fs="dimensions",_s=`${fs}.aspect_ratio`,vs=`${fs}.aspect_ratio_mode`,ys=`${fs}.height`,bs="overrides",ws="performance",xs=`${ws}.features.animated_progress_indicator`,Cs=`${ws}.features.media_chunk_size`,Ms=`${ws}.features.max_simultaneous_engine_requests`,ks=`${ws}.profile`,Ss=`${ws}.style.box_shadow`,Es=`${ws}.style.border_radius`,$s="profiles",As=1e3;class zs extends Error{constructor(e,t){super(e),this.context=t}}const Is={info:10,error:20,connection:30,diagnostics:40},Ts=["clips","favorite-events","favorite-recordings","live","menu","ptz","recordings","seek","snapshots","substream"],js=ba.object({url:ba.string(),mime_type:ba.string()}),Os=ba.object({path:ba.string()});function Ds(e){if(e instanceof ba.ZodDefault)return Ds(e.removeDefault());if(e instanceof ba.ZodObject){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=ba.ZodOptional.create(Ds(a))}return new ba.ZodObject({...e._def,shape:()=>t})}return e instanceof ba.ZodArray?ba.ZodArray.create(Ds(e.element)).min(e._def.minLength?.value,e._def.minLength?.message).max(e._def.maxLength?.value,e._def.maxLength?.message).length(e._def.exactLength?.value,e._def.exactLength?.message):e instanceof ba.ZodOptional?ba.ZodOptional.create(Ds(e.unwrap())):e instanceof ba.ZodNullable?ba.ZodNullable.create(Ds(e.unwrap())):e instanceof ba.ZodTuple?ba.ZodTuple.create(e.items.map((e=>Ds(e)))):e}function Rs(e){const t=e.format();return Object.keys(t).filter((e=>!e.startsWith("_")))}const Ps=e=>{const t=new Set;if(e.issues.length)for(const n of e.issues)if("invalid_union"===n.code){const e=n.unionErrors;for(const n of e)Ps(n).forEach(t.add,t)}else t.add(Ls(n.path));return t},Ls=e=>{let t="";for(let n=0;n"fire-dom-event")).or(ba.literal("fire-dom-event")),card_id:ba.string().regex(tc,"card_id parameter can only contain [a-z][A-Z][0-9_]-").optional()}),_c=fc.extend({frigate_card_action:ba.enum(Zs)}),vc=fc.extend({frigate_card_action:ba.enum(["camera_ui","default","download","expand","fullscreen","live_substream_off","live_substream_on","menu_toggle","microphone_connect","microphone_disconnect","microphone_mute","microphone_unmute","mute","pause","play","screenshot","unmute"])}),yc=fc.extend({frigate_card_action:ba.literal("camera_select"),camera:ba.string().optional(),triggered:ba.boolean().optional()}),bc=fc.extend({frigate_card_action:ba.literal("live_substream_select"),camera:ba.string()}),wc=fc.extend({frigate_card_action:ba.literal("media_player"),media_player:ba.string(),media_player_action:ba.enum(["play","stop"])}),xc=fc.extend({frigate_card_action:ba.literal("display_mode_select"),display_mode:ic}),Cc=fc.extend({frigate_card_action:ba.literal("ptz"),camera:ba.string().optional(),ptz_action:ba.enum(Hs).optional(),ptz_phase:ba.enum(Js).optional(),ptz_preset:ba.string().optional()}),Mc=fc.extend({frigate_card_action:ba.literal("ptz_digital"),target_id:ba.string().optional(),absolute:ba.object({zoom:ac.optional(),pan:nc.optional()}).optional(),ptz_action:ba.enum(Hs).optional(),ptz_phase:ba.enum(Js).optional()}),kc=fc.extend({frigate_card_action:ba.literal("ptz_multi"),target_id:ba.string().optional(),ptz_action:ba.enum(Hs).optional(),ptz_phase:ba.enum(Js).optional(),ptz_preset:ba.string().optional()}),Sc=fc.extend({frigate_card_action:ba.literal("ptz_controls"),enabled:ba.boolean()}),Ec=ba.object({ms:ba.number().optional(),s:ba.number().optional(),m:ba.number().optional(),h:ba.number().optional()}),$c=fc.extend({frigate_card_action:ba.literal("sleep"),duration:Ec.optional().default({s:1})}),Ac=fc.extend({frigate_card_action:ba.literal("status_bar"),status_bar_action:ba.enum(["add","remove","reset"]),items:ba.lazy((()=>ol)).array().optional()}),zc=fc.extend({frigate_card_action:ba.literal("log"),message:ba.string(),level:ba.enum(["debug","info","warn","error"]).default("info")}),Ic=ba.union([yc,vc,bc,zc,wc,Cc,Mc,kc,Sc,_c,xc,$c,Ac]),Tc=ba.union([sc,dc,lc,uc,hc,pc,gc,mc,Ic]),jc=ba.object({tap_action:Tc.or(Tc.array()).optional(),hold_action:Tc.or(Tc.array()).optional(),double_tap_action:Tc.or(Tc.array()).optional(),start_tap_action:Tc.or(Tc.array()).optional(),end_tap_action:Tc.or(Tc.array()).optional()}).passthrough(),Oc=ba.object({actions:jc.optional()}),Dc=jc.extend({style:ba.record(ba.string().nullable().or(ba.undefined()).or(ba.number())).optional(),title:ba.string().nullable().optional()}),Rc=Dc.extend({type:ba.literal("state-badge"),entity:ba.string()}),Pc=Dc.extend({type:ba.literal("state-icon"),entity:ba.string(),icon:ba.string().optional(),state_color:ba.boolean().default(!0)}),Lc=Dc.extend({type:ba.literal("state-label"),entity:ba.string(),attribute:ba.string().optional(),prefix:ba.string().optional(),suffix:ba.string().optional()}),Nc=Dc.extend({type:ba.literal("service-button"),title:ba.string(),service:ba.string(),service_data:ba.object({}).passthrough().optional()}),Fc=Dc.extend({type:ba.literal("icon"),icon:ba.string(),entity:ba.string().optional()}),Vc=Dc.extend({type:ba.literal("image"),entity:ba.string().optional(),image:ba.string().optional(),camera_image:ba.string().optional(),camera_view:ba.string().optional(),state_image:ba.object({}).passthrough().optional(),filter:ba.string().optional(),state_filter:ba.object({}).passthrough().optional(),aspect_ratio:ba.string().optional()}),Hc=ba.object({condition:ba.literal("state").optional(),entity:ba.string(),state:ba.string().or(ba.string().array()).optional(),state_not:ba.string().or(ba.string().array()).optional()}),Bc=ba.object({condition:ba.literal("numeric_state"),entity:ba.string(),above:ba.number().optional(),below:ba.number().optional()}),qc=ba.object({condition:ba.literal("screen"),media_query:ba.string()}),Uc=ba.object({condition:ba.literal("user"),users:ba.string().array().min(1)}),Wc=ba.discriminatedUnion("condition",[Hc,Bc,qc,Uc]),Zc=ba.object({type:ba.literal("conditional"),conditions:Wc.array(),elements:ba.lazy((()=>yl))}),Qc=ba.object({type:ba.string().superRefine(((e,t)=>{e.match(/^custom:(?!frigate-card).+/)||t.addIssue({code:ba.ZodIssueCode.custom,message:"Frigate-card custom elements must match specific schemas",fatal:!0})}))}).passthrough(),Gc=ba.object({enabled:ba.boolean().default(!0).optional(),priority:ba.number().min(0).max(Us).default(50).optional(),alignment:ba.enum(["matching","opposing"]).default("matching").optional(),icon:ba.string().optional(),permanent:ba.boolean().default(!1).optional()}),Yc=Gc.merge(Fc).extend({type:ba.literal("custom:frigate-card-menu-icon")}),Kc=Gc.merge(Pc).extend({type:ba.literal("custom:frigate-card-menu-state-icon")}).merge(Gc),Xc=Dc.extend({entity:ba.string().optional(),icon:ba.string().optional(),state_color:ba.boolean().default(!0),selected:ba.boolean().default(!1),subtitle:ba.string().optional(),enabled:ba.boolean().default(!0)}),Jc=Gc.merge(Fc).extend({type:ba.literal("custom:frigate-card-menu-submenu"),items:Xc.array()}),el=Gc.merge(Pc).extend({type:ba.literal("custom:frigate-card-menu-submenu-select"),options:ba.record(Xc.deepPartial()).optional()}),tl=ba.object({enabled:ba.boolean().default(!0).optional(),priority:ba.number().min(0).max(100).default(50).optional()}),nl=tl.extend({sufficient:ba.boolean().default(!1).optional(),exclusive:ba.boolean().default(!1).optional(),expand:ba.boolean().default(!1).optional(),actions:jc.optional()}),al=nl.extend({type:ba.literal("custom:frigate-card-status-bar-icon"),icon:ba.string()}),il=nl.extend({type:ba.literal("custom:frigate-card-status-bar-image"),image:ba.string()}),rl=nl.extend({type:ba.literal("custom:frigate-card-status-bar-string"),string:ba.string()}),ol=ba.union([al,il,rl]),sl=ba.object({condition:ba.literal("view"),views:ba.string().array()}),cl=ba.object({condition:ba.literal("fullscreen"),fullscreen:ba.boolean()}),ll=ba.object({condition:ba.literal("expand"),expand:ba.boolean()}),dl=ba.object({condition:ba.literal("camera"),cameras:ba.string().array()}),ul=ba.object({condition:ba.literal("media_loaded"),media_loaded:ba.boolean()}),hl=ba.object({condition:ba.literal("display_mode"),display_mode:ic}),pl=ba.object({condition:ba.literal("triggered"),triggered:ba.string().array()}),ml=ba.object({condition:ba.literal("interaction"),interaction:ba.boolean()}),gl=ba.object({condition:ba.literal("microphone"),connected:ba.boolean().optional(),muted:ba.boolean().optional()}),fl=ba.object({condition:ba.literal("key"),key:ba.string(),state:ba.enum(["down","up"]).optional(),ctrl:ba.boolean().optional(),shift:ba.boolean().optional(),alt:ba.boolean().optional(),meta:ba.boolean().optional()}),_l=ba.discriminatedUnion("condition",[Hc,Bc,qc,Uc,sl,cl,ll,dl,ul,hl,pl,ml,gl,fl]),vl=ba.object({type:ba.literal("custom:frigate-card-conditional"),conditions:_l.array(),elements:ba.lazy((()=>yl))}),yl=ba.union([Zc,Qc,vl,Fc,Vc,Yc,Kc,Jc,el,Nc,Rc,Pc,Lc,al,il,rl]).array().optional(),bl=ba.object({fit:ba.enum(["contain","cover","fill"]).optional(),position:ba.object({x:ba.number().min(0).max(100).optional(),y:ba.number().min(0).max(100).optional()}).optional(),view_box:ba.object({bottom:ba.number().min(0).max(100).optional().default(0),left:ba.number().min(0).max(100).optional().default(0),right:ba.number().min(0).max(100).optional().default(0),top:ba.number().min(0).max(100).optional().default(0)}).optional(),pan:nc.optional(),zoom:ac.optional()}),wl=ba.number().array().length(2).or(ba.string().regex(/^\s*\d+\.?\d*\s*[:/]\s*\d+\.?\d*\s*$/).transform((e=>e.split(/[:\/]/).map((e=>Number(e)))))),xl={r2c_delay_between_calls_seconds:.5,c2r_delay_between_calls_seconds:.2},Cl=function(e){return t=>{if(!t||"object"!=typeof t||!t.service)return t;const n={...t};return Object.keys(t).forEach((a=>{const i=a.match(/^data_(.+)$/),r=i?.[1];r&&!(`${e}${r}`in t)&&(n[`${e}${r}`]={action:"perform-action",perform_action:t.service,data:t[a]},delete n[a],delete n.service)})),n}},Ml=ba.preprocess(Cl("actions_"),ba.object({actions_left:lc.optional(),actions_left_start:lc.optional(),actions_left_stop:lc.optional(),actions_right:lc.optional(),actions_right_start:lc.optional(),actions_right_stop:lc.optional(),actions_up:lc.optional(),actions_up_start:lc.optional(),actions_up_stop:lc.optional(),actions_down:lc.optional(),actions_down_start:lc.optional(),actions_down_stop:lc.optional(),actions_zoom_in:lc.optional(),actions_zoom_in_start:lc.optional(),actions_zoom_in_stop:lc.optional(),actions_zoom_out:lc.optional(),actions_zoom_out_start:lc.optional(),actions_zoom_out_stop:lc.optional(),r2c_delay_between_calls_seconds:ba.number().default(xl.r2c_delay_between_calls_seconds),c2r_delay_between_calls_seconds:ba.number().default(xl.c2r_delay_between_calls_seconds),presets:ba.preprocess(Cl(""),ba.union([ba.record(lc),ba.object({service:ba.string().optional()})])).optional(),service:ba.string().optional()}).passthrough()),kl={orientation:"horizontal",mode:"auto",hide_pan_tilt:!1,hide_zoom:!1,hide_home:!1,position:"bottom-right"},Sl=ba.object({mode:ba.enum(["off","auto","on"]).default(kl.mode),position:ba.enum(["top-left","top-right","bottom-left","bottom-right"]).default(kl.position),orientation:ba.enum(["vertical","horizontal"]).default(kl.orientation),hide_pan_tilt:ba.boolean().default(kl.hide_pan_tilt),hide_zoom:ba.boolean().default(kl.hide_zoom),hide_home:ba.boolean().default(kl.hide_home),style:ba.object({}).passthrough().optional()}),El={mode:"auto",refresh_seconds:1},$l=ba.object({mode:ba.enum(["auto","camera","entity","screensaver","url"]).default(El.mode),refresh_seconds:ba.number().min(0).default(El.refresh_seconds),url:ba.string().optional(),entity:ba.string().optional(),entity_parameters:ba.string().optional()}),Al=$l.merge(Oc).default(El),zl=75,Il=300,Tl={size:100,show_details:!0,show_favorite_control:!0,show_timeline_control:!0,show_download_control:!0},jl=ba.object({size:ba.number().min(75).max(300).default(Tl.size),show_details:ba.boolean().default(Tl.show_details),show_favorite_control:ba.boolean().default(Tl.show_favorite_control),show_timeline_control:ba.boolean().default(Tl.show_timeline_control),show_download_control:ba.boolean().default(Tl.show_download_control)}),Ol={...Tl,mode:"right"},Dl=jl.extend({mode:ba.enum(["none","above","below","left","right"]).default(Ol.mode)}),Rl=ba.enum(["all","clips","snapshots"]),Pl={clustering_threshold:3,events_media_type:"all",window_seconds:3600,show_recordings:!0,style:"stack",pan_mode:"pan"},Ll=ba.enum(["pan","seek","seek-in-media","seek-in-camera"]),Nl=ba.object({clustering_threshold:ba.number().optional().default(Pl.clustering_threshold),events_media_type:Rl.optional().default(Pl.events_media_type),window_seconds:ba.number().min(60).max(86400).optional().default(Pl.window_seconds),show_recordings:ba.boolean().optional().default(Pl.show_recordings),style:ba.enum(["stack","ribbon"]).optional().default(Pl.style),pan_mode:Ll.optional().default(Pl.pan_mode)}),Fl={...Pl,mode:"none",style:"ribbon"},Vl=Nl.extend({mode:ba.enum(["none","above","below"]).default(Fl.mode),style:Nl.shape.style.default(Fl.style)}),Hl={...Pl,controls:{thumbnails:Ol}},Bl=Nl.extend({controls:ba.object({thumbnails:Dl.default(Hl.controls.thumbnails)}).default(Hl.controls)}).default(Hl),ql=ba.object({style:ba.enum(["none","chevrons","icons","thumbnails"]),size:ba.number().min(20)}),Ul=ba.enum(["none","slide"]),Wl={always_connected:!1,disconnect_seconds:90,mute_after_microphone_mute_seconds:60},Zl=ba.object({always_connected:ba.boolean().default(Wl.always_connected),disconnect_seconds:ba.number().min(0).default(Wl.disconnect_seconds),mute_after_microphone_mute_seconds:ba.number().min(0).default(Wl.mute_after_microphone_mute_seconds)}).default(Wl),Ql=ba.object({url:ba.string().transform((e=>e.replace(/\/+$/,""))).optional(),host:ba.string().optional(),modes:ba.enum(["webrtc","mse","mp4","mjpeg"]).array().optional(),stream:ba.string().optional()}),Gl=ba.object({entity:ba.string().optional(),url:ba.string().optional()}).passthrough(),Yl=ba.object({options:ba.object({audio:ba.boolean().optional(),video:ba.boolean().optional(),pauseWhenHidden:ba.boolean().optional(),disableGl:ba.boolean().optional(),disableWebAssembly:ba.boolean().optional(),preserveDrawingBuffer:ba.boolean().optional(),progressive:ba.boolean().optional(),throttled:ba.boolean().optional(),chunkSize:ba.number().optional(),maxAudioLag:ba.number().optional(),videoBufferSize:ba.number().optional(),audioBufferSize:ba.number().optional()}).optional()}),Kl={...Ol,media_type:"events",events_media_type:"all"},Xl={auto_play:[...Ys],auto_pause:[],auto_mute:[...Xs],auto_unmute:["microphone"],preload:!1,lazy_load:!0,lazy_unload:[],draggable:!0,zoomable:!0,transition_effect:"slide",show_image_during_load:!0,mode:"single",controls:{builtin:!0,next_previous:{size:48,style:"chevrons"},ptz:kl,thumbnails:Kl,timeline:Fl},microphone:{...Wl}},Jl=Dl.extend({media_type:ba.enum(["events","recordings"]).default(Xl.controls.thumbnails.media_type),events_media_type:Rl.default(Xl.controls.thumbnails.events_media_type)}),ed=ba.object({auto_pause:ba.enum(Gs).array().default(Xl.auto_pause),auto_play:ba.enum(Ys).array().default(Xl.auto_play),auto_mute:ba.enum(Xs).array().default(Xl.auto_mute),auto_unmute:ba.enum(Ks).array().default(Xl.auto_unmute),controls:ba.object({builtin:ba.boolean().default(Xl.controls.builtin),next_previous:ql.extend({style:ba.enum(["none","chevrons","icons"]).default(Xl.controls.next_previous.style),size:ql.shape.size.default(Xl.controls.next_previous.size)}).default(Xl.controls.next_previous),ptz:Sl.default(Xl.controls.ptz),thumbnails:Jl.default(Xl.controls.thumbnails),timeline:Vl.default(Xl.controls.timeline)}).default(Xl.controls),display:rc,draggable:ba.boolean().default(Xl.draggable),lazy_load:ba.boolean().default(Xl.lazy_load),lazy_unload:ba.enum(Gs).array().default(Xl.lazy_unload),microphone:Zl.default(Xl.microphone),preload:ba.boolean().default(Xl.preload),show_image_during_load:ba.boolean().default(Xl.show_image_during_load),transition_effect:Ul.default(Xl.transition_effect),zoomable:ba.boolean().default(Xl.zoomable)}).merge(Oc).default(Xl),td=ba.object({live:ed}),nd=ba.object({method:ba.enum(["standard","dashboard"]).default("standard").optional(),dashboard:ba.object({dashboard_path:ba.string().optional(),view_path:ba.string().optional()}).optional()}),ad={dependencies:{all_cameras:!1,cameras:[]},engine:"auto",frigate:{client_id:"frigate"},live_provider:"auto",motioneye:{images:{directory_pattern:"%Y-%m-%d",file_pattern:"%H-%M-%S"},movies:{directory_pattern:"%Y-%m-%d",file_pattern:"%H-%M-%S"}},reolink:{media_resolution:"low"},ptz:xl,triggers:{motion:!1,occupancy:!1,events:[...ec],entities:[]},proxy:{media:"auto",dynamic:!0,ssl_verification:"auto",ssl_ciphers:"auto"}},id=ba.object({media:ba.boolean().or(ba.literal("auto")).default(ad.proxy.media),dynamic:ba.boolean().default(ad.proxy.dynamic),ssl_verification:ba.boolean().or(ba.literal("auto")).default(ad.proxy.ssl_verification),ssl_ciphers:ba.enum(["default","insecure","intermediate","modern"]).or(ba.literal("auto")).default(ad.proxy.ssl_ciphers)}),rd=ba.object({camera_entity:ba.string().optional(),icon:ba.string().optional(),title:ba.string().optional(),capabilities:ba.object({disable:ba.enum(Ts).array().optional(),disable_except:ba.enum(Ts).array().optional()}).optional(),id:ba.string().optional(),dependencies:ba.object({all_cameras:ba.boolean().default(ad.dependencies.all_cameras),cameras:ba.string().array().default(ad.dependencies.cameras)}).default(ad.dependencies),triggers:ba.object({motion:ba.boolean().default(ad.triggers.motion),occupancy:ba.boolean().default(ad.triggers.occupancy),entities:ba.string().array().default(ad.triggers.entities),events:ba.enum(ec).array().default(ad.triggers.events)}).default(ad.triggers),engine:ba.enum(["auto","frigate","generic","motioneye","reolink"]).default("auto"),frigate:ba.object({url:ba.string().optional(),client_id:ba.string().default(ad.frigate.client_id),camera_name:ba.string().optional(),labels:ba.string().array().optional(),zones:ba.string().array().optional()}).default(ad.frigate),motioneye:ba.object({url:ba.string().optional(),images:ba.object({directory_pattern:ba.string().includes("%").default(ad.motioneye.images.directory_pattern),file_pattern:ba.string().includes("%").default(ad.motioneye.images.file_pattern)}).default(ad.motioneye.images),movies:ba.object({directory_pattern:ba.string().includes("%").default(ad.motioneye.movies.directory_pattern),file_pattern:ba.string().includes("%").default(ad.motioneye.movies.file_pattern)}).default(ad.motioneye.movies)}).default(ad.motioneye),reolink:ba.object({url:ba.string().optional(),media_resolution:ba.enum(["high","low"]).default(ad.reolink.media_resolution)}).default(ad.reolink),live_provider:ba.enum(["auto","image","ha","jsmpeg","go2rtc","webrtc-card"]).default(ad.live_provider),go2rtc:Ql.optional(),image:$l.optional().default(El),jsmpeg:Yl.optional(),webrtc_card:Gl.optional(),cast:nd.optional(),ptz:Ml.default(ad.ptz),dimensions:ba.object({aspect_ratio:wl.optional(),layout:bl.optional()}).optional(),proxy:id.default(ad.proxy)}).default(ad),od=rd.array().min(1),sd={default:Qs,camera_select:"current",interaction_seconds:300,default_reset:{every_seconds:0,after_interaction:!1,entities:[],interaction_mode:"inactive"},default_cycle_camera:!1,dark_mode:"off",triggers:{show_trigger_status:!1,filter_selected_camera:!0,actions:{trigger:"update",untrigger:"none"},untrigger_seconds:0},keyboard_shortcuts:Fs},cd=ba.enum(["all","inactive","active"]).default("inactive"),ld=ba.object({actions:ba.object({interaction_mode:cd,trigger:ba.enum(["default","live","media","none","update"]).default(sd.triggers.actions.trigger),untrigger:ba.enum(["default","none"]).default(sd.triggers.actions.untrigger)}).default(sd.triggers.actions),filter_selected_camera:ba.boolean().default(sd.triggers.filter_selected_camera),show_trigger_status:ba.boolean().default(sd.triggers.show_trigger_status),untrigger_seconds:ba.number().default(sd.triggers.untrigger_seconds)}),dd=ba.object({default:ba.enum(Zs).default(sd.default),camera_select:ba.enum([...Zs,"current"]).default(sd.camera_select),interaction_seconds:ba.number().default(sd.interaction_seconds),default_cycle_camera:ba.boolean().default(sd.default_cycle_camera),default_reset:ba.object({after_interaction:ba.boolean().default(sd.default_reset.after_interaction),every_seconds:ba.number().default(sd.default_reset.every_seconds),entities:ba.string().array().default(sd.default_reset.entities),interaction_mode:cd.default(sd.default_reset.interaction_mode)}).default(sd.default_reset),render_entities:ba.string().array().optional(),dark_mode:ba.enum(["on","off","auto"]).optional(),triggers:ld.default(sd.triggers),keyboard_shortcuts:Vs.default(sd.keyboard_shortcuts)}).merge(Oc).default(sd),ud=["left","right","top","bottom"],hd=ud,pd={priority:50,enabled:!0},md={priority:50,enabled:!1},gd={alignment:"left",button_size:40,buttons:{camera_ui:pd,cameras:pd,clips:pd,ptz_home:md,display_mode:pd,download:pd,expand:md,frigate:pd,fullscreen:pd,image:md,live:pd,media_player:pd,microphone:{...md,type:"momentary"},mute:md,play:md,ptz_controls:md,recordings:md,screenshot:md,snapshots:pd,substreams:pd,timeline:pd},position:"top",style:"hidden"},fd=Gc.extend({enabled:Gc.shape.enabled.default(pd.enabled),priority:Gc.shape.priority.default(pd.priority)}),_d=Gc.extend({enabled:Gc.shape.enabled.default(md.enabled),priority:Gc.shape.priority.default(md.priority)}),vd=ba.object({style:ba.enum(["none","hidden","overlay","hover","hover-card","outside"]).default(gd.style),position:ba.enum(ud).default(gd.position),alignment:ba.enum(hd).default(gd.alignment),buttons:ba.object({camera_ui:fd.default(gd.buttons.camera_ui),cameras:fd.default(gd.buttons.cameras),clips:fd.default(gd.buttons.clips),ptz_home:_d.default(gd.buttons.ptz_home),display_mode:fd.default(gd.buttons.display_mode),download:fd.default(gd.buttons.download),expand:_d.default(gd.buttons.expand),frigate:fd.default(gd.buttons.frigate),fullscreen:fd.default(gd.buttons.fullscreen),image:_d.default(gd.buttons.image),live:fd.default(gd.buttons.live),media_player:fd.default(gd.buttons.media_player),microphone:_d.extend({type:ba.enum(["momentary","toggle"]).default(gd.buttons.microphone.type)}).default(gd.buttons.microphone),mute:_d.default(gd.buttons.mute),play:_d.default(gd.buttons.play),ptz_controls:_d.default(gd.buttons.ptz_controls),recordings:_d.default(gd.buttons.recordings),screenshot:_d.default(gd.buttons.screenshot),snapshots:fd.default(gd.buttons.snapshots),substreams:fd.default(gd.buttons.substreams),timeline:fd.default(gd.buttons.timeline)}).default(gd.buttons),button_size:ba.number().min(20).default(gd.button_size)}).default(gd),yd={priority:50,enabled:!0},bd={height:46,items:{engine:yd,resolution:yd,technology:yd,title:yd},position:"bottom",style:"popup",popup_seconds:3},wd=ba.object({position:ba.enum(["top","bottom"]).default(bd.position),style:ba.enum(["none","overlay","hover","hover-card","outside","popup"]).default(bd.style),popup_seconds:ba.number().min(0).max(60).default(bd.popup_seconds),height:ba.number().min(20).default(bd.height),items:ba.object({engine:tl.default(bd.items.engine),technology:tl.default(bd.items.technology),resolution:tl.default(bd.items.resolution),title:tl.default(bd.items.title)}).default(bd.items)}).default(bd),xd={auto_play:[...Ys],auto_pause:[...Gs],auto_mute:[...Gs],auto_unmute:[],lazy_load:!0,draggable:!0,zoomable:!0,transition_effect:"slide",snapshot_click_plays_clip:!0,display_mode:"single",controls:{builtin:!0,next_previous:{size:48,style:"thumbnails"},thumbnails:Ol,timeline:Fl,ptz:{...kl,mode:"off"}}},Cd=ql.extend({style:ba.enum(["none","thumbnails","chevrons"]).default(xd.controls.next_previous.style),size:ql.shape.size.default(xd.controls.next_previous.size)}),Md=ba.object({auto_play:ba.enum(Ys).array().default(xd.auto_play),auto_pause:ba.enum(Gs).array().default(xd.auto_pause),auto_mute:ba.enum(Gs).array().default(xd.auto_mute),auto_unmute:ba.enum(Ys).array().default(xd.auto_unmute),lazy_load:ba.boolean().default(xd.lazy_load),draggable:ba.boolean().default(xd.draggable),zoomable:ba.boolean().default(xd.zoomable),transition_effect:Ul.default(xd.transition_effect),snapshot_click_plays_clip:ba.boolean().default(xd.snapshot_click_plays_clip),display:rc,controls:ba.object({builtin:ba.boolean().default(xd.controls.builtin),next_previous:Cd.default(xd.controls.next_previous),ptz:Sl.extend({mode:ba.enum(["off","on"]).default(xd.controls.ptz.mode)}).default(xd.controls.ptz),thumbnails:Dl.default(xd.controls.thumbnails),timeline:Vl.default(xd.controls.timeline)}).default(xd.controls)}).merge(Oc).default(xd),kd={...Ol,show_details:!1},Sd={controls:{thumbnails:kd,filter:{mode:"right"}}},Ed=Dl.extend({show_details:ba.boolean().default(kd.show_details)}),$d=ba.object({controls:ba.object({thumbnails:Ed.default(Sd.controls.thumbnails),filter:ba.object({mode:ba.enum(["none","left","right"]).default(Sd.controls.filter.mode)}).default(Sd.controls.filter)}).default(Sd.controls)}).merge(Oc).default(Sd),Ad={aspect_ratio_mode:"dynamic",aspect_ratio:[16,9],height:"auto"},zd=ba.object({aspect_ratio_mode:ba.enum(["dynamic","static","unconstrained"]).default(Ad.aspect_ratio_mode),aspect_ratio:wl.default(Ad.aspect_ratio),height:ba.string().default(Ad.height)}).default(Ad),Id=ba.object({conditions:_l.array(),merge:ba.object({}).passthrough().optional(),set:ba.object({}).passthrough().optional(),delete:ba.string().array().optional()}).array().optional(),Td=Tc.array(),jd=ba.object({conditions:_l.array(),actions:Td.optional(),actions_not:Td.optional()}).refine((e=>e.actions?.length||e.actions_not?.length),"Automations must include at least one action").array(),Od={features:{animated_progress_indicator:!0,media_chunk_size:50},style:{border_radius:!0,box_shadow:!0}},Dd=ba.object({features:ba.object({animated_progress_indicator:ba.boolean().default(Od.features.animated_progress_indicator),media_chunk_size:ba.number().min(0).max(1e3).default(Od.features.media_chunk_size),max_simultaneous_engine_requests:ba.number().min(1).optional()}).default(Od.features),style:ba.object({border_radius:ba.boolean().default(Od.style.border_radius),box_shadow:ba.boolean().default(Od.style.box_shadow)}).default(Od.style)}).default(Od),Rd={logging:!1},Pd=ba.object({logging:ba.boolean().default(Rd.logging)}).default(Rd),Ld=ba.enum(["casting","low-performance","scrubbing"]).array().optional(),Nd=ba.object({cameras:Ds(od),cameras_global:rd,view:dd,menu:vd,status_bar:wd,live:ed,media_gallery:$d,media_viewer:Md,image:Al,elements:yl,dimensions:zd,timeline:Bl,performance:Dd,debug:Pd,automations:jd.optional(),profiles:Ld,overrides:Id,card_mod:ba.unknown(),card_id:ba.string().regex(tc).optional(),type:ba.string()}),Fd={cameras:ad,view:sd,menu:gd,status_bar:bd,live:Xl,media_gallery:Sd,media_viewer:xd,image:El,timeline:Hl,performance:Od,debug:Rd};function Vd(e){const t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new e.constructor(+e):"number"==typeof e||"[object Number]"===t||"string"==typeof e||"[object String]"===t?new Date(e):new Date(NaN)}function Hd(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function Bd(e,t){const n=Vd(e);return isNaN(t)?Hd(e,NaN):t?(n.setDate(n.getDate()+t),n):n}function qd(e,t){const n=Vd(e);if(isNaN(t))return Hd(e,NaN);if(!t)return n;const a=n.getDate(),i=Hd(e,n.getTime());i.setMonth(n.getMonth()+t+1,0);return a>=i.getDate()?i:(n.setFullYear(i.getFullYear(),i.getMonth(),a),n)}function Ud(e,t){const{years:n=0,months:a=0,weeks:i=0,days:r=0,hours:o=0,minutes:s=0,seconds:c=0}=t,l=Vd(e),d=a||n?qd(l,a+12*n):l,u=1e3*(c+60*(s+60*o));return Hd(e,(r||i?Bd(d,r+7*i):d).getTime()+u)}const Wd=6048e5,Zd=864e5,Qd=6e4,Gd=36e5,Yd=1e3;let Kd={};function Xd(){return Kd}function Jd(e,t){const n=Xd(),a=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=Vd(e),r=i.getDay(),o=(r=i.getTime()?n+1:t.getTime()>=o.getTime()?n:n-1}function nu(e){const t=Vd(e);return t.setHours(0,0,0,0),t}function au(e){const t=Vd(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function iu(e){if(!(t=e,t instanceof Date||"object"==typeof t&&"[object Date]"===Object.prototype.toString.call(t)||"number"==typeof e))return!1;var t;const n=Vd(e);return!isNaN(Number(n))}function ru(e){return t=>{const n=(e?Math[e]:Math.trunc)(t);return 0===n?0:n}}function ou(e,t){return+Vd(e)-+Vd(t)}function su(e,t,n){const a=ou(e,t)/1e3;return ru(n?.roundingMethod)(a)}const cu={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function lu(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const du={date:lu({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:lu({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:lu({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},uu={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function hu(e){return(t,n)=>{let a;if("formatting"===(n?.context?String(n.context):"standalone")&&e.formattingValues){const t=e.defaultFormattingWidth||e.defaultWidth,i=n?.width?String(n.width):t;a=e.formattingValues[i]||e.formattingValues[t]}else{const t=e.defaultWidth,i=n?.width?String(n.width):e.defaultWidth;a=e.values[i]||e.values[t]}return a[e.argumentCallback?e.argumentCallback(t):t]}}function pu(e){return(t,n={})=>{const a=n.width,i=a&&e.matchPatterns[a]||e.matchPatterns[e.defaultMatchWidth],r=t.match(i);if(!r)return null;const o=r[0],s=a&&e.parsePatterns[a]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?function(e,t){for(let n=0;ne.test(o))):function(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n;return}(s,(e=>e.test(o)));let l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;return{value:l,rest:t.slice(o.length)}}}var mu;const gu={code:"en-US",formatDistance:(e,t,n)=>{let a;const i=cu[e];return a="string"==typeof i?i:1===t?i.one:i.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+a:a+" ago":a},formatLong:du,formatRelative:(e,t,n,a)=>uu[e],localize:{ordinalNumber:(e,t)=>{const n=Number(e),a=n%100;if(a>20||a<10)switch(a%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:hu({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:hu({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:hu({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:hu({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:hu({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(mu={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)},(e,t={})=>{const n=e.match(mu.matchPattern);if(!n)return null;const a=n[0],i=e.match(mu.parsePattern);if(!i)return null;let r=mu.valueCallback?mu.valueCallback(i[0]):i[0];return r=t.valueCallback?t.valueCallback(r):r,{value:r,rest:e.slice(a.length)}}),era:pu({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:pu({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:pu({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:pu({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:pu({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function fu(e){const t=Vd(e),n=function(e,t){const n=nu(e),a=nu(t),i=+n-au(n),r=+a-au(a);return Math.round((i-r)/Zd)}(t,function(e){const t=Vd(e),n=Hd(e,0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}(t));return n+1}function _u(e){const t=Vd(e),n=+eu(t)-+function(e){const t=tu(e),n=Hd(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),eu(n)}(t);return Math.round(n/Wd)+1}function vu(e,t){const n=Vd(e),a=n.getFullYear(),i=Xd(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=Hd(e,0);o.setFullYear(a+1,0,r),o.setHours(0,0,0,0);const s=Jd(o,t),c=Hd(e,0);c.setFullYear(a,0,r),c.setHours(0,0,0,0);const l=Jd(c,t);return n.getTime()>=s.getTime()?a+1:n.getTime()>=l.getTime()?a:a-1}function yu(e,t){const n=Vd(e),a=+Jd(n,t)-+function(e,t){const n=Xd(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=vu(e,t),r=Hd(e,0);return r.setFullYear(i,0,a),r.setHours(0,0,0,0),Jd(r,t)}(n,t);return Math.round(a/Wd)+1}function bu(e,t){return(e<0?"-":"")+Math.abs(e).toString().padStart(t,"0")}const wu={y(e,t){const n=e.getFullYear(),a=n>0?n:1-n;return bu("yy"===t?a%100:a,t.length)},M(e,t){const n=e.getMonth();return"M"===t?String(n+1):bu(n+1,2)},d:(e,t)=>bu(e.getDate(),t.length),a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return"am"===n?"a.m.":"p.m."}},h:(e,t)=>bu(e.getHours()%12||12,t.length),H:(e,t)=>bu(e.getHours(),t.length),m:(e,t)=>bu(e.getMinutes(),t.length),s:(e,t)=>bu(e.getSeconds(),t.length),S(e,t){const n=t.length,a=e.getMilliseconds();return bu(Math.trunc(a*Math.pow(10,n-3)),t.length)}},xu="midnight",Cu="noon",Mu="morning",ku="afternoon",Su="evening",Eu="night",$u={G:function(e,t,n){const a=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(a,{width:"abbreviated"});case"GGGGG":return n.era(a,{width:"narrow"});default:return n.era(a,{width:"wide"})}},y:function(e,t,n){if("yo"===t){const t=e.getFullYear(),a=t>0?t:1-t;return n.ordinalNumber(a,{unit:"year"})}return wu.y(e,t)},Y:function(e,t,n,a){const i=vu(e,a),r=i>0?i:1-i;if("YY"===t){return bu(r%100,2)}return"Yo"===t?n.ordinalNumber(r,{unit:"year"}):bu(r,t.length)},R:function(e,t){return bu(tu(e),t.length)},u:function(e,t){return bu(e.getFullYear(),t.length)},Q:function(e,t,n){const a=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(a);case"QQ":return bu(a,2);case"Qo":return n.ordinalNumber(a,{unit:"quarter"});case"QQQ":return n.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(a,{width:"narrow",context:"formatting"});default:return n.quarter(a,{width:"wide",context:"formatting"})}},q:function(e,t,n){const a=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(a);case"qq":return bu(a,2);case"qo":return n.ordinalNumber(a,{unit:"quarter"});case"qqq":return n.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(a,{width:"narrow",context:"standalone"});default:return n.quarter(a,{width:"wide",context:"standalone"})}},M:function(e,t,n){const a=e.getMonth();switch(t){case"M":case"MM":return wu.M(e,t);case"Mo":return n.ordinalNumber(a+1,{unit:"month"});case"MMM":return n.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(a,{width:"narrow",context:"formatting"});default:return n.month(a,{width:"wide",context:"formatting"})}},L:function(e,t,n){const a=e.getMonth();switch(t){case"L":return String(a+1);case"LL":return bu(a+1,2);case"Lo":return n.ordinalNumber(a+1,{unit:"month"});case"LLL":return n.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(a,{width:"narrow",context:"standalone"});default:return n.month(a,{width:"wide",context:"standalone"})}},w:function(e,t,n,a){const i=yu(e,a);return"wo"===t?n.ordinalNumber(i,{unit:"week"}):bu(i,t.length)},I:function(e,t,n){const a=_u(e);return"Io"===t?n.ordinalNumber(a,{unit:"week"}):bu(a,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getDate(),{unit:"date"}):wu.d(e,t)},D:function(e,t,n){const a=fu(e);return"Do"===t?n.ordinalNumber(a,{unit:"dayOfYear"}):bu(a,t.length)},E:function(e,t,n){const a=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(a,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(a,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},e:function(e,t,n,a){const i=e.getDay(),r=(i-a.weekStartsOn+8)%7||7;switch(t){case"e":return String(r);case"ee":return bu(r,2);case"eo":return n.ordinalNumber(r,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(e,t,n,a){const i=e.getDay(),r=(i-a.weekStartsOn+8)%7||7;switch(t){case"c":return String(r);case"cc":return bu(r,t.length);case"co":return n.ordinalNumber(r,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(e,t,n){const a=e.getDay(),i=0===a?7:a;switch(t){case"i":return String(i);case"ii":return bu(i,t.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},a:function(e,t,n){const a=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(e,t,n){const a=e.getHours();let i;switch(i=12===a?Cu:0===a?xu:a/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(e,t,n){const a=e.getHours();let i;switch(i=a>=17?Su:a>=12?ku:a>=4?Mu:Eu,t){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){let t=e.getHours()%12;return 0===t&&(t=12),n.ordinalNumber(t,{unit:"hour"})}return wu.h(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getHours(),{unit:"hour"}):wu.H(e,t)},K:function(e,t,n){const a=e.getHours()%12;return"Ko"===t?n.ordinalNumber(a,{unit:"hour"}):bu(a,t.length)},k:function(e,t,n){let a=e.getHours();return 0===a&&(a=24),"ko"===t?n.ordinalNumber(a,{unit:"hour"}):bu(a,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):wu.m(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getSeconds(),{unit:"second"}):wu.s(e,t)},S:function(e,t){return wu.S(e,t)},X:function(e,t,n){const a=e.getTimezoneOffset();if(0===a)return"Z";switch(t){case"X":return zu(a);case"XXXX":case"XX":return Iu(a);default:return Iu(a,":")}},x:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"x":return zu(a);case"xxxx":case"xx":return Iu(a);default:return Iu(a,":")}},O:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Au(a,":");default:return"GMT"+Iu(a,":")}},z:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Au(a,":");default:return"GMT"+Iu(a,":")}},t:function(e,t,n){return bu(Math.trunc(e.getTime()/1e3),t.length)},T:function(e,t,n){return bu(e.getTime(),t.length)}};function Au(e,t=""){const n=e>0?"-":"+",a=Math.abs(e),i=Math.trunc(a/60),r=a%60;return 0===r?n+String(i):n+String(i)+t+bu(r,2)}function zu(e,t){if(e%60==0){return(e>0?"-":"+")+bu(Math.abs(e)/60,2)}return Iu(e,t)}function Iu(e,t=""){const n=e>0?"-":"+",a=Math.abs(e);return n+bu(Math.trunc(a/60),2)+t+bu(a%60,2)}const Tu=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},ju=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},Ou={p:ju,P:(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],a=n[1],i=n[2];if(!i)return Tu(e,t);let r;switch(a){case"P":r=t.dateTime({width:"short"});break;case"PP":r=t.dateTime({width:"medium"});break;case"PPP":r=t.dateTime({width:"long"});break;default:r=t.dateTime({width:"full"})}return r.replace("{{date}}",Tu(a,t)).replace("{{time}}",ju(i,t))}},Du=/^D+$/,Ru=/^Y+$/,Pu=["D","DD","YY","YYYY"];function Lu(e){return Du.test(e)}function Nu(e){return Ru.test(e)}function Fu(e,t,n){const a=function(e,t,n){const a="Y"===e[0]?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${a} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}(e,t,n);if(console.warn(a),Pu.includes(e))throw new RangeError(a)}const Vu=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Hu=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Bu=/^'([^]*?)'?$/,qu=/''/g,Uu=/[a-zA-Z]/;function Wu(e,t,n){const a=Xd(),i=n?.locale??a.locale??gu,r=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??a.weekStartsOn??a.locale?.options?.weekStartsOn??0,s=Vd(e);if(!iu(s))throw new RangeError("Invalid time value");let c=t.match(Hu).map((e=>{const t=e[0];if("p"===t||"P"===t){return(0,Ou[t])(e,i.formatLong)}return e})).join("").match(Vu).map((e=>{if("''"===e)return{isToken:!1,value:"'"};const t=e[0];if("'"===t)return{isToken:!1,value:Zu(e)};if($u[t])return{isToken:!0,value:e};if(t.match(Uu))throw new RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}}));i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));const l={firstWeekContainsDate:r,weekStartsOn:o,locale:i};return c.map((a=>{if(!a.isToken)return a.value;const r=a.value;(!n?.useAdditionalWeekYearTokens&&Nu(r)||!n?.useAdditionalDayOfYearTokens&&Lu(r))&&Fu(r,t,String(e));return(0,$u[r[0]])(s,r,i.localize,l)})).join("")}function Zu(e){const t=e.match(Bu);return t?t[1].replace(qu,"'"):e}function Qu(e,t){const{years:n=0,months:a=0,weeks:i=0,days:r=0,hours:o=0,minutes:s=0,seconds:c=0}=t,l=function(e,t){return qd(e,-t)}(e,a+12*n),d=function(e,t){return Bd(e,-t)}(l,r+7*i),u=1e3*(c+60*(s+60*o));return Hd(e,d.getTime()-u)}function Gu(e,t){return e===t||e!=e&&t!=t}function Yu(e,t){for(var n=e.length;n--;)if(Gu(e[n][0],t))return n;return-1}var Ku=Array.prototype.splice;function Xu(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1},Xu.prototype.set=function(e,t){var n=this.__data__,a=Yu(n,e);return a<0?(++this.size,n.push([e,t])):n[a][1]=t,this};var Ju="object"==typeof global&&global&&global.Object===Object&&global,eh="object"==typeof self&&self&&self.Object===Object&&self,th=Ju||eh||Function("return this")(),nh=th.Symbol,ah=Object.prototype,ih=ah.hasOwnProperty,rh=ah.toString,oh=nh?nh.toStringTag:void 0;var sh=Object.prototype.toString;var ch="[object Null]",lh="[object Undefined]",dh=nh?nh.toStringTag:void 0;function uh(e){return null==e?void 0===e?lh:ch:dh&&dh in Object(e)?function(e){var t=ih.call(e,oh),n=e[oh];try{e[oh]=void 0;var a=!0}catch(e){}var i=rh.call(e);return a&&(t?e[oh]=n:delete e[oh]),i}(e):function(e){return sh.call(e)}(e)}function hh(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var ph="[object AsyncFunction]",mh="[object Function]",gh="[object GeneratorFunction]",fh="[object Proxy]";function _h(e){if(!hh(e))return!1;var t=uh(e);return t==mh||t==gh||t==ph||t==fh}var vh,yh=th["__core-js_shared__"],bh=(vh=/[^.]+$/.exec(yh&&yh.keys&&yh.keys.IE_PROTO||""))?"Symbol(src)_1."+vh:"";var wh=Function.prototype.toString;function xh(e){if(null!=e){try{return wh.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var Ch=/^\[object .+?Constructor\]$/,Mh=Function.prototype,kh=Object.prototype,Sh=Mh.toString,Eh=kh.hasOwnProperty,$h=RegExp("^"+Sh.call(Eh).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ah(e){return!(!hh(e)||(t=e,bh&&bh in t))&&(_h(e)?$h:Ch).test(xh(e));var t}function zh(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Ah(n)?n:void 0}var Ih=zh(th,"Map"),Th=zh(Object,"create");var jh=Object.prototype.hasOwnProperty;var Oh=Object.prototype.hasOwnProperty;function Dh(e){var t=-1,n=null==e?0:e.length;for(this.clear();++ts))return!1;var l=r.get(e),d=r.get(t);if(l&&d)return l==t&&d==e;var u=-1,h=!0,p=n&Bh?new Nh:void 0;for(r.set(e,t),r.set(t,e);++u-1&&e%1==0&&e-1&&e%1==0&&e<=Ap}var Ip={};function Tp(e){return function(t){return e(t)}}Ip["[object Float32Array]"]=Ip["[object Float64Array]"]=Ip["[object Int8Array]"]=Ip["[object Int16Array]"]=Ip["[object Int32Array]"]=Ip["[object Uint8Array]"]=Ip["[object Uint8ClampedArray]"]=Ip["[object Uint16Array]"]=Ip["[object Uint32Array]"]=!0,Ip["[object Arguments]"]=Ip["[object Array]"]=Ip["[object ArrayBuffer]"]=Ip["[object Boolean]"]=Ip["[object DataView]"]=Ip["[object Date]"]=Ip["[object Error]"]=Ip["[object Function]"]=Ip["[object Map]"]=Ip["[object Number]"]=Ip["[object Object]"]=Ip["[object RegExp]"]=Ip["[object Set]"]=Ip["[object String]"]=Ip["[object WeakMap]"]=!1;var jp="object"==typeof exports&&exports&&!exports.nodeType&&exports,Op=jp&&"object"==typeof module&&module&&!module.nodeType&&module,Dp=Op&&Op.exports===jp&&Ju.process,Rp=function(){try{var e=Op&&Op.require&&Op.require("util").types;return e||Dp&&Dp.binding&&Dp.binding("util")}catch(e){}}(),Pp=Rp,Lp=Pp&&Pp.isTypedArray,Np=Lp?Tp(Lp):function(e){return fp(e)&&zp(e.length)&&!!Ip[uh(e)]},Fp=Object.prototype.hasOwnProperty;function Vp(e,t){var n=dp(e),a=!n&&wp(e),i=!n&&!a&&kp(e),r=!n&&!a&&!i&&Np(e),o=n||a||i||r,s=o?function(e,t){for(var n=-1,a=Array(e);++n0){if(++og>=800)return arguments[0]}else og=0;return rg.apply(void 0,arguments)});function lg(e,t){return cg(function(e,t,n){return t=tg(void 0===t?e.length-1:t,0),function(){for(var a=arguments,i=-1,r=tg(a.length-t,0),o=Array(r);++i1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(r=e.length>3&&"function"==typeof r?(i--,r):void 0,o&&dg(n[0],n[1],o)&&(r=i<3?void 0:r,i=1),t=Object(t);++a-1}function Ng(e,t,n){for(var a=-1,i=null==e?0:e.length;++a=Vg){var l=t?null:Fg(e);if(l)return Zh(l);o=!1,i=Vh,c=new Nh}else c=t?[]:s;e:for(;++ae[0].toUpperCase()+e.substring(1))).join(" ")}function Ug(e,t,n){const a=e[t];return e.splice(t,1),e.splice(n,0,a),e}const Wg=e=>Array.isArray(e)?e:[e],Zg=e=>e instanceof Set?e:new Set(Wg(e));function Qg(e,t,n){return!function(e,t,n){var a=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===a?bm(e,t,void 0,n):!!a}(e,t,n)}function Gg(e,t=console.warn){e instanceof zs&&e.context?t(e,e.context):t("object"==typeof e&&"message"in e?e.message:e)}const Yg=()=>window.matchMedia("(hover: hover) and (pointer: fine)").matches,Kg=(e,t)=>Wu(e,"yyyy-MM-dd HH:mm"+(t?":ss":"")),Xg=e=>Wu(e,"yyyy-MM-dd"),Jg=(e,t)=>{window.requestIdleCallback?window.requestIdleCallback(e,{...t&&{timeout:t}}):e()};function ef(e,t){const n=function(e,t,n){const a=ou(e,t)/Gd;return ru(n?.roundingMethod)(a)}(t,e),a=function(e,t,n){const a=ou(e,t)/Qd;return ru(n?.roundingMethod)(a)}(t,e)-60*n;let i="";return n&&(i+=`${n}h `),a&&(i+=`${a}m `),i+=`${su(t,e)-60*n*60-60*a}s`,i}const tf=async(e,t)=>await Promise.all(Array.from(e).map((e=>t(e)))),nf=e=>new Date(`${e}T00:00:00`),af=async e=>{await new Promise((t=>setTimeout(t,1e3*e)))},rf=e=>!isNaN(e.getTime()),of=(e,t,n,a)=>{t?e.setAttribute(n,a??""):e.removeAttribute(n)},sf=e=>!!e,cf=e=>e instanceof HTMLElement,lf=e=>(e instanceof HTMLSlotElement?e.assignedElements({flatten:!0}):[...e.children]).filter(cf),df=e=>e?.ratio&&2===e.ratio.length?`${e.ratio[0]} / ${e.ratio[1]}`:e?.defaultStatic?"16 / 9":"auto",uf=e=>({"aspect-ratio":df(e)}),hf=e=>{if(Array.isArray(e))return e.filter((e=>void 0!==e)).map((e=>hf(e)));if("object"==typeof e&&null!==e){const t={};for(const n in e)t[n]=hf(e[n]);return t}return e},pf=(e,t,n)=>Rg(e,n)===Rg(t,n);function mf(e){if(!e)return null;const t=Ic.safeParse(e);return t.success?t.data:null}function gf(e,t){return{action:"fire-dom-event",frigate_card_action:e,...t?.cardID&&{card_id:t.cardID}}}function ff(e,t,n){return{action:"fire-dom-event",frigate_card_action:e,camera:t,...n?.cardID&&{card_id:n.cardID}}}function _f(e,t,n){return{action:"fire-dom-event",frigate_card_action:"media_player",media_player:e,media_player_action:t,...n?.cardID&&{card_id:n.cardID}}}function vf(e){return{action:"fire-dom-event",frigate_card_action:"ptz_multi",...e?.cardID&&{card_id:e.cardID},...e?.ptzAction&&{ptz_action:e.ptzAction},...e?.ptzPhase&&{ptz_phase:e.ptzPhase},...e?.ptzPreset&&{ptz_preset:e.ptzPreset},...e?.targetID&&{target_id:e.targetID}}}function yf(e,t){return e&&t?"tap"===e&&t.tap_action?t.tap_action:"hold"===e&&t.hold_action?t.hold_action:"double_tap"===e&&t.double_tap_action?t.double_tap_action:"end_tap"===e&&t.end_tap_action?t.end_tap_action:"start_tap"===e&&t.start_tap_action?t.start_tap_action:null:null}const bf=e=>Wg(e).some((e=>function(e){return void 0!==e&&"none"!==e.action}(e))),wf=e=>{e.stopPropagation()};class xf{constructor(){this._timer=null,this._repeated=!1}stop(){this._timer&&(this._repeated?window.clearInterval(this._timer):window.clearTimeout(this._timer),this._timer=null)}isRunning(){return null!==this._timer}start(e,t){this.stop(),this._timer=window.setTimeout((()=>{this._timer=null,t()}),1e3*e),this._repeated=!1}startRepeated(e,t){this.stop(),this._timer=window.setInterval((()=>{t()}),1e3*e),this._repeated=!0}}class Cf extends HTMLElement{constructor(){super(...arguments),this.holdTime=.4,this.holdTimer=new xf,this.doubleClickTimer=new xf,this.held=!1,this.started=!1}connectedCallback(){["touchcancel","mouseout","mouseup","touchmove","mousewheel","wheel","scroll"].forEach((e=>{document.addEventListener(e,(()=>{this.holdTimer.stop()}),{passive:!0})}))}bind(e,t){if(e.actionHandlerOptions)return void(e.actionHandlerOptions=t);e.actionHandlerOptions=t,e.addEventListener("contextmenu",(e=>{const t=e||window.event;return t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.cancelBubble=!0,t.returnValue=!1,!1}));const n=()=>{this.held=!1,this.holdTimer.start(this.holdTime,(()=>{this.held=!0})),this.started||(this.started=!0,et(e,"action",{action:"start_tap"}))},a=t=>{this.holdTimer.stop(),this.started&&(this.started=!1,et(e,"action",{action:"end_tap"}))},i=t=>{const n=e.actionHandlerOptions;n?.allowPropagation||wf(t),["touchend","touchcancel"].includes(t.type)&&!this.held||(a(),n?.hasHold&&this.held?et(e,"action",{action:"hold"}):n?.hasDoubleClick?"click"===t.type&&t.detail<2||!this.doubleClickTimer.isRunning()?this.doubleClickTimer.start(.25,(()=>et(e,"action",{action:"tap"}))):(this.doubleClickTimer.stop(),et(e,"action",{action:"double_tap"})):et(e,"action",{action:"tap"}))};e.addEventListener("touchstart",n,{passive:!0}),e.addEventListener("touchend",i),e.addEventListener("touchcancel",i),e.addEventListener("mousedown",n,{passive:!0}),e.addEventListener("click",i),e.addEventListener("keyup",(e=>{"Enter"===e.key&&i(e)})),e.addEventListener("mouseleave",a)}}customElements.define("action-handler-frigate-card",Cf);const Mf=(e,t)=>{const n=(()=>{const e=document.body;if(e.querySelector("action-handler-frigate-card"))return e.querySelector("action-handler-frigate-card");const t=document.createElement("action-handler-frigate-card");return e.appendChild(t),t})();n&&n.bind(e,t)},kf=ge(class extends fe{update(e,[t]){return Mf(e.element,t),U}render(e){}});var Sf=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)lp(t,gp(e)),e=Pm(e);return t}:hp;function Ef(e){return up(e,Km,Sf)}var $f=Object.prototype.hasOwnProperty;var Af=/\w*$/;var zf=nh?nh.prototype:void 0,If=zf?zf.valueOf:void 0;var Tf="[object Boolean]",jf="[object Date]",Of="[object Map]",Df="[object Number]",Rf="[object RegExp]",Pf="[object Set]",Lf="[object String]",Nf="[object Symbol]",Ff="[object ArrayBuffer]",Vf="[object DataView]",Hf="[object Float32Array]",Bf="[object Float64Array]",qf="[object Int8Array]",Uf="[object Int16Array]",Wf="[object Int32Array]",Zf="[object Uint8Array]",Qf="[object Uint8ClampedArray]",Gf="[object Uint16Array]",Yf="[object Uint32Array]";function Kf(e,t,n){var a,i,r,o=e.constructor;switch(t){case Ff:return Tm(e);case Tf:case jf:return new o(+e);case Vf:return function(e,t){var n=t?Tm(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case Hf:case Bf:case qf:case Uf:case Wf:case Zf:case Qf:case Gf:case Yf:return jm(e,n);case Of:return new o;case Df:case Lf:return new o(e);case Rf:return(r=new(i=e).constructor(i.source,Af.exec(i))).lastIndex=i.lastIndex,r;case Pf:return new o;case Nf:return a=e,If?Object(If.call(a)):{}}}var Xf=Pp&&Pp.isMap,Jf=Xf?Tp(Xf):function(e){return fp(e)&&"[object Map]"==pm(e)};var e_=Pp&&Pp.isSet,t_=e_?Tp(e_):function(e){return fp(e)&&"[object Set]"==pm(e)},n_=1,a_=2,i_=4,r_="[object Arguments]",o_="[object Function]",s_="[object GeneratorFunction]",c_="[object Object]",l_={};function d_(e,t,n,a,i,r){var o,s=t&n_,c=t&a_,l=t&i_;if(n&&(o=i?n(e,a,i,r):n(e)),void 0!==o)return o;if(!hh(e))return e;var d=dp(e);if(d){if(o=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&$f.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!s)return Om(e,o)}else{var u=pm(e),h=u==o_||u==s_;if(kp(e))return Im(e,s);if(u==c_||u==r_||h&&!i){if(o=c||h?{}:Lm(e),!s)return c?function(e,t){return Qm(e,Sf(e),t)}(e,function(e,t){return e&&Qm(t,Km(t),e)}(o,e)):function(e,t){return Qm(e,gp(e),t)}(e,function(e,t){return e&&Qm(t,Qp(t),e)}(o,e))}else{if(!l_[u])return i?e:{};o=Kf(e,u,s)}}r||(r=new Lh);var p=r.get(e);if(p)return p;r.set(e,o),t_(e)?e.forEach((function(a){o.add(d_(a,t,n,a,e,r))})):Jf(e)&&e.forEach((function(a,i){o.set(i,d_(a,t,n,i,e,r))}));var m=d?void 0:(l?c?Ef:Gp:c?Km:Qp)(e);return function(e,t){for(var n=-1,a=null==e?0:e.length;++nvoid 0===globalThis.DOMException?new __(e):new DOMException(e),y_=e=>{const t=void 0===e.reason?v_("This operation was aborted."):e.reason;return t instanceof Error?t:v_(t)};class b_{#e=[];enqueue(e,t){const n={priority:(t={priority:0,...t}).priority,run:e};if(this.size&&this.#e[this.size-1].priority>=t.priority)return void this.#e.push(n);const a=function(e,t,n){let a=0,i=e.length;for(;i>0;){const r=Math.trunc(i/2);let o=a+r;n(e[o],t)<=0?(a=++o,i-=r+1):i=r}return a}(this.#e,n,((e,t)=>t.priority-e.priority));this.#e.splice(a,0,n)}dequeue(){const e=this.#e.shift();return e?.run}filter(e){return this.#e.filter((t=>t.priority===e.priority)).map((e=>e.run))}get size(){return this.#e.length}}class w_ extends g_{#t;#n;#a=0;#i;#r;#o=0;#s;#c;#e;#l;#d=0;#u;#h;#p;timeout;constructor(e){if(super(),!("number"==typeof(e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:b_,...e}).intervalCap&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??""}\` (${typeof e.intervalCap})`);if(void 0===e.interval||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??""}\` (${typeof e.interval})`);this.#t=e.carryoverConcurrencyCount,this.#n=e.intervalCap===Number.POSITIVE_INFINITY||0===e.interval,this.#i=e.intervalCap,this.#r=e.interval,this.#e=new e.queueClass,this.#l=e.queueClass,this.concurrency=e.concurrency,this.timeout=e.timeout,this.#p=!0===e.throwOnTimeout,this.#h=!1===e.autoStart}get#m(){return this.#n||this.#a{this.#v()}),t)),!0;this.#a=this.#t?this.#d:0}return!1}#_(){if(0===this.#e.size)return this.#s&&clearInterval(this.#s),this.#s=void 0,this.emit("empty"),0===this.#d&&this.emit("idle"),!1;if(!this.#h){const e=!this.#w;if(this.#m&&this.#g){const t=this.#e.dequeue();return!!t&&(this.emit("active"),t(),e&&this.#b(),!0)}}return!1}#b(){this.#n||void 0!==this.#s||(this.#s=setInterval((()=>{this.#y()}),this.#r),this.#o=Date.now()+this.#r)}#y(){0===this.#a&&0===this.#d&&this.#s&&(clearInterval(this.#s),this.#s=void 0),this.#a=this.#t?this.#d:0,this.#x()}#x(){for(;this.#_(););}get concurrency(){return this.#u}set concurrency(e){if(!("number"==typeof e&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this.#u=e,this.#x()}async#C(e){return new Promise(((t,n)=>{e.addEventListener("abort",(()=>{n(e.reason)}),{once:!0})}))}async add(e,t={}){return t={timeout:this.timeout,throwOnTimeout:this.#p,...t},new Promise(((n,a)=>{this.#e.enqueue((async()=>{this.#d++,this.#a++;try{t.signal?.throwIfAborted();let a=e({signal:t.signal});t.timeout&&(a=function(e,t){const{milliseconds:n,fallback:a,message:i,customTimers:r={setTimeout:setTimeout,clearTimeout:clearTimeout}}=t;let o;const s=new Promise(((s,c)=>{if("number"!=typeof n||1!==Math.sign(n))throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${n}\``);if(t.signal){const{signal:e}=t;e.aborted&&c(y_(e)),e.addEventListener("abort",(()=>{c(y_(e))}))}if(n===Number.POSITIVE_INFINITY)return void e.then(s,c);const l=new f_;o=r.setTimeout.call(void 0,(()=>{if(a)try{s(a())}catch(e){c(e)}else"function"==typeof e.cancel&&e.cancel(),!1===i?s():i instanceof Error?c(i):(l.message=i??`Promise timed out after ${n} milliseconds`,c(l))}),n),(async()=>{try{s(await e)}catch(e){c(e)}})()})),c=s.finally((()=>{c.clear()}));return c.clear=()=>{r.clearTimeout.call(void 0,o),o=void 0},c}(Promise.resolve(a),{milliseconds:t.timeout})),t.signal&&(a=Promise.race([a,this.#C(t.signal)]));const i=await a;n(i),this.emit("completed",i)}catch(e){if(e instanceof f_&&!t.throwOnTimeout)return void n();a(e),this.emit("error",e)}finally{this.#f()}}),t),this.emit("add"),this.#_()}))}async addAll(e,t){return Promise.all(e.map((async e=>this.add(e,t))))}start(){return this.#h?(this.#h=!1,this.#x(),this):this}pause(){this.#h=!0}clear(){this.#e=new this.#l}async onEmpty(){0!==this.#e.size&&await this.#M("empty")}async onSizeLessThan(e){this.#e.sizethis.#e.size{const a=()=>{t&&!t()||(this.off(e,a),n())};this.on(e,a)}))}get size(){return this.#e.size}sizeBy(e){return this.#e.filter(e).length}get pending(){return this.#d}get isPaused(){return this.#h}}var x_={frigate_card:"Frigate card",frigate_card_description:"A Lovelace card for use with Frigate",live:"Live",no_media:"No media to display",recordings:"Recordings",version:"Version"},C_={cameras:{camera_entity:"Camera Entity",capabilities:{capabilities:{clips:"Clips","favorite-events":"Favorite Events","favorite-recordings":"Favorite Recordings",live:"Live",menu:"Menu",ptz:"PTZ",recordings:"Recordings",seek:"Seeking",snapshots:"Snapshots",substream:"Substream"},disable:"Disable",disable_except:"Disable except",editor_label:"Camera capabilities"},cast:{dashboard:{dashboard_path:"Dashboard path",view_path:"View path"},editor_label:"Cast options",method:"Cast method",methods:{dashboard:"Dashboard",standard:"Standard"}},dependencies:{all_cameras:"Show events for all cameras with this camera",cameras:"Show events for specific cameras with this camera",editor_label:"Dependency options"},dimensions:{aspect_ratio:"Static aspect ratio",editor_label:"Camera dimensions",layout:{editor_label:"Camera Layout",fit:"Layout fit",fits:{contain:"Media is contained/letterboxed",cover:"Media expands proportionally to cover the card",fill:"Media is stretched to fill the card"},pan:{x:"Pan horizontal percentage",y:"Pan vertical percentage"},position:{editor_label:"Layout Cover Position",x:"Horizontal placement percentage",y:"Vertical placement percentage"},view_box:{bottom:"Bottom inset percentage",editor_label:"Layout View Box",left:"Left inset percentage",right:"Right inset percentage",top:"Top inset percentage"},zoom:"Zoom factor"}},engines:{editor_label:"Camera engine options"},frigate:{camera_name:"Frigate camera name (Autodetected from entity)",client_id:"Frigate client id (For >1 Frigate server)",editor_label:"Frigate options",labels:"Frigate labels/object filters",url:"Frigate server URL",zones:"Frigate zones"},go2rtc:{editor_label:"go2rtc Options",modes:{editor_label:"go2rtc Modes",mjpeg:"Motion JPEG (MJPEG)",mp4:"MPEG-4 (MP4)",mse:"Media Source Extensions (MSE)",webrtc:"Web Real-Time Communication (WebRTC)"},stream:"go2rtc stream name"},icon:"Icon for this camera (Autodetected from entity)",id:"Unique id for this camera in this card",image:{editor_label:"Image Options",refresh_seconds:"Number of seconds after which to refresh live image (0=never)",url:"Image URL to use instead of camera entity snapshot"},live_provider:"Live view provider for this camera",live_provider_options:{editor_label:"Live provider options"},live_providers:{auto:"Automatic",go2rtc:"go2rtc",ha:"Home Assistant video stream (i.e. HLS, LL-HLS, WebRTC via HA)",image:"Home Assistant images",jsmpeg:"JSMpeg","webrtc-card":"WebRTC Card (i.e. AlexxIT's WebRTC Card)"},motioneye:{editor_label:"MotionEye options",images:{directory_pattern:"Images directory pattern",file_pattern:"Images file pattern"},movies:{directory_pattern:"Movies directory pattern",file_pattern:"Movies file pattern"},url:"MotionEye UI URL"},proxy:{dynamic:"Dynamic proxying",editor_label:"Camera proxying",media:{auto:"Media proxying automatically configured",editor_label:"Media proxying",false:"Media proxying disabled",true:"Media proxying enabled"},ssl_ciphers:{auto:"SSL ciphers automatically configured",default:"Default SSL ciphers",editor_label:"SSL ciphers",insecure:"Insecure SSL ciphers",intermediate:"Intermediate SSL ciphers",modern:"Modern SSL ciphers"},ssl_verification:{auto:"SSL verification automatically configured",editor_label:"SSL verification",false:"SSL verification disabled",true:"SSL verification enabled"}},reolink:{editor_label:"Reolink options",media_resolution:{editor_label:"Media Resolution",high:"High Resolution",low:"Low Resolution"},url:"Reolink UI URL"},title:"Title for this camera (Autodetected from entity)",triggers:{editor_label:"Trigger options",entities:"Trigger from other entities",events:{clips:"Events with new clips",editor_label:"Trigger Events",events:"All events",snapshots:"Events with new snapshots"},motion:"Trigger by auto-detecting the motion sensor",occupancy:"Trigger by auto-detecting the occupancy sensor"},webrtc_card:{editor_label:"WebRTC Card Options",entity:"WebRTC Card Camera Entity (Not a Frigate camera)",url:"WebRTC Card Camera URL"}},common:{controls:{builtin:"Built-in video controls",filter:{editor_label:"Media Filter",mode:"Filter mode",modes:{left:"Media filter in a drawer to the left",none:"No media filter",right:"Media filter in a drawer to the right"}},next_previous:{editor_label:"Next & Previous",size:"Next & previous control size in pixels",style:"Next & previous control style",styles:{chevrons:"Chevrons",icons:"Icons",none:"None",thumbnails:"Thumbnails"}},thumbnails:{editor_label:"Thumbnails",events_media_type:"Whether to show event thumbnails of clips or snapshots",events_media_types:{clips:"Clip thumbnails",snapshots:"Snapshot thumbnails"},media_type:"Whether to show thumnails of events or recordings",media_types:{events:"Events",recordings:"Recordings"},mode:"Thumbnails mode",modes:{above:"Thumbnails above",below:"Thumbnails below",left:"Thumbnails in a drawer to the left",none:"No thumbnails",right:"Thumbnails in a drawer to the right"},show_details:"Show details with thumbnails",show_download_control:"Show download control on thumbnails",show_favorite_control:"Show favorite control on thumbnails",show_timeline_control:"Show timeline control on thumbnails",size:"Thumbnails size in pixels"},timeline:{editor_label:"Mini Timeline",mode:"Mode",modes:{above:"Above",below:"Below",none:"None"},pan_mode:"Default pan mode",pan_modes:{pan:"Pan",seek:"Pan seeks across all media","seek-in-camera":"Pan seeks within selected camera only","seek-in-media":"Pan seeks within selected media item only"}}},display:{editor_label:"Display",grid_columns:"Exact number of grid columns",grid_max_columns:"Maximum number of grid columns",grid_selected_width_factor:"Increase selected media width by this factor",mode:"Mode"},image:{entity:"Entity for use with entity mode",entity_parameters:"Query parameters added to the entity-based picture URLs (e.g. width=1920&height=1080)",mode:"Image mode",modes:{camera:"Home Assistant camera snapshot of camera entity",entity:"Entity with entity_picture attribute",screensaver:"Embedded Frigate logo",url:"Arbitrary image specified by URL"},refresh_seconds:"Number of seconds after which to refresh (0=never)",url:"Static image URL"},media_action_conditions:{all:"All opportunities",hidden:"On browser/tab hiding",microphone_mute:"On microphone mute",microphone_unmute:"On microphone unmute",never:"Never",selected:"On selection",unselected:"On unselection",visible:"On browser/tab visibility"},timeline:{clustering_threshold:"The count of events at which they are clustered (0=no clustering)",events_media_type:"The events media the timeline displays",events_media_types:{all:"All event media types",clips:"Clips",snapshots:"Snapshots"},show_recordings:"Show recordings",style:"Timeline style",styles:{ribbon:"Events on a single ribbon",stack:"Stacked & clustered events"},window_seconds:"The default length of the timeline view in seconds"}},dimensions:{aspect_ratio:"Default aspect ratio (e.g. '16:9')",aspect_ratio_mode:"Aspect ratio mode",aspect_ratio_modes:{dynamic:"Aspect ratio adjusts to media",static:"Static aspect ratio",unconstrained:"Unconstrained aspect ratio"},height:"Card height in CSS units (e.g. '500px')"},live:{auto_mute:"Automatically mute live cameras",auto_pause:"Automatically pause live cameras",auto_play:"Automatically play live cameras",auto_unmute:"Automatically unmute live cameras",controls:{editor_label:"Live Controls",ptz:{editor_label:"PTZ",hide_home:"Hide home control",hide_pan_tilt:"Hide pan & tilt control",hide_zoom:"Hide zoom control",mode:"Mode",modes:{off:"Off",on:"On"},orientation:"Orientation",orientations:{horizontal:"Horizontal",vertical:"Vertical"},position:"Position",positions:{"bottom-left":"Bottom left","bottom-right":"Bottom right","top-left":"Top left","top-right":"Top right"}}},draggable:"Live cameras view can be dragged/swiped",lazy_load:"Live cameras are lazily loaded",lazy_unload:"Live cameras are lazily unloaded",microphone:{always_connected:"Always keep the microphone connected",disconnect_seconds:"Seconds after which to disconnect microphone (0=never)",editor_label:"Microphone",enabled:"Microphone enabled",mute_after_microphone_mute_seconds:"Seconds after microphone mute to mute inbound audio"},preload:"Preload live view in the background",show_image_during_load:"Show still image while the live stream is loading",transition_effect:"Live camera transition effect",zoomable:"Live cameras can be zoomed/panned"},media_viewer:{auto_mute:"Automatically mute media",auto_pause:"Automatically pause media",auto_play:"Automatically play media",auto_unmute:"Automatically unmute media",controls:{editor_label:"Media Viewer Controls"},draggable:"Media Viewer can be dragged/swiped",lazy_load:"Media Viewer media is lazily loaded in carousel",snapshot_click_plays_clip:"Clicking on a snapshot plays a related clip",transition_effect:"Media Viewer transition effect",transition_effects:{none:"No transition",slide:"Slide transition"},zoomable:"Media Viewer can be zoomed/panned"},menu:{alignment:"Menu alignment",alignments:{bottom:"Aligned to the bottom",left:"Aligned to the left",right:"Aligned to the right",top:"Aligned to the top"},button_size:"Menu button size in pixels",buttons:{alignment:"Button alignment",alignments:{matching:"Matching the menu alignment",opposing:"Opposing the menu alignment"},camera_ui:"Camera user interface",cameras:"Cameras",clips:"Clips",display_mode:"Display mode",download:"Download",enabled:"Button enabled",expand:"Expand",frigate:"Frigate menu / Default view",fullscreen:"Fullscreen",icon:"Icon",image:"Image",live:"Live",media_player:"Send to media player",microphone:"Microphone",mute:"Mute / Unmute",permanent:"Show when the menu is hidden",play:"Play / Pause",priority:"Priority",ptz_controls:"Show PTZ controls",ptz_home:"PTZ Home",recordings:"Recordings",screenshot:"Screenshot",snapshots:"Snapshots",substreams:"Substream(s)",timeline:"Timeline",type:"Button type",types:{momentary:"Momentary",toggle:"Toggle"}},position:"Menu position",positions:{bottom:"Positioned on the bottom",left:"Positioned on the left",right:"Positioned on the right",top:"Positioned on the top"},style:"Menu style",styles:{hidden:"Hidden menu",hover:"Hover menu","hover-card":"Hover menu (card-wide)",none:"No menu",outside:"Outside menu",overlay:"Overlay menu"}},overrides:{info:"This card configuration has manually specified overrides configured which may override values shown in the visual editor, please consult the code editor to view/modify these overrides"},performance:{features:{animated_progress_indicator:"Animated Progress Indicator",editor_label:"Feature Options",max_simultaneous_engine_requests:"Max simultaneous camera engine requests",media_chunk_size:"Media chunk size"},style:{border_radius:"Curves",box_shadow:"Shadows",editor_label:"Style Options"},warning:"This card is in low profile mode so defaults have changed to optimize performance"},profiles:{casting:"Casting",editor_label:"Configuration profiles","low-performance":"Low performance",scrubbing:"Video scrubbing"},status_bar:{height:"Status bar height in pixels",items:{enabled:"Item enabled",engine:"Camera engine",live_provider:"Live provider",priority:"Item priority",resolution:"Resolution",technology:"Technology",title:"Title"},popup_seconds:"Status bar popup seconds",position:"Status bar position",positions:{bottom:"Positioned on the bottom",top:"Positioned on the top"},style:"Status bar style",styles:{hover:"Hover status bar","hover-card":"Hover status bar (card-wide)",none:"No status bar",outside:"Outside status bar",overlay:"Overlay status bar",popup:"Popup status bar"}},view:{camera_select:"View for newly selected cameras",dark_mode:"Dark mode",dark_modes:{auto:"Auto",off:"Off",on:"On"},default:"Default view",default_cycle_camera:"Cycle through cameras when default view updates",default_reset:{after_interaction:"Reset to the default view after user interaction ends",editor_label:"Default view reset behavior",entities:"Reset to the default view on entity state change",every_seconds:"Reset to default view every X seconds (0=never)",interaction_mode:"How default reset behaves when the card has human interaction",interaction_modes:{active:"Only allow reset when card has active human interaction",all:"Reset regardless of human interaction",inactive:"Only reset when card has no human interaction"}},interaction_seconds:"Seconds after user action to remain interacted with (0=never)",keyboard_shortcuts:{editor_label:"Keyboard shortcuts",enabled:"Keyboard shortcuts enabled",ptz_down:"PTZ Down",ptz_home:"PTZ Home",ptz_left:"PTZ Left",ptz_right:"PTZ Right",ptz_up:"PTZ Up",ptz_zoom_in:"PTZ Zoom In",ptz_zoom_out:"PTZ Zoom Out"},triggers:{actions:{editor_label:"Trigger actions",interaction_mode:"How to handle actions when the card has human interaction",interaction_modes:{active:"Only trigger actions when card has human interaction",all:"Trigger actions regardless of human interaction",inactive:"Only trigger actions when card has no human interaction"},trigger:"Trigger action",triggers:{default:"Change to or update default view",live:"Change to or update live view",media:"Change to the relevant media view for new media",none:"No action"},untrigger:"Untrigger action",untriggers:{default:"Change to default view/camera",none:"No action"}},editor_label:"Trigger behavior",filter_selected_camera:"Only trigger on selected camera",show_trigger_status:"Show pulsing border when triggered",untrigger_seconds:"Seconds after inactive state change to untrigger"},views:{clip:"Most recent clip",clips:"Clips gallery",current:"Current view",image:"Static image",live:"Live view",recording:"Most recent recording",recordings:"Recordings gallery",snapshot:"Most recent snapshot",snapshots:"Snapshots gallery",timeline:"Timeline view"}}},M_={grid:"Show media viewer for each camera in a grid",single:"Show single media viewer"},k_={add_new_camera:"Add new camera",button:"Button",camera:"Camera",cameras:"Cameras",cameras_secondary:"What cameras to render on this card",delete:"Delete",dimensions:"Card dimensions",dimensions_secondary:"Card dimensions & shape options",image:"Image",image_secondary:"Static image view options",live:"Live",live_secondary:"Live camera view options",media_gallery:"Media gallery",media_gallery_secondary:"Media gallery options",media_viewer:"Media viewer",media_viewer_secondary:"Viewer for static media (clips, snapshots or recordings)",menu:"Menu",menu_secondary:"Menu look & feel options",move_down:"Move down",move_up:"Move up",overrides:"Overrides are active",overrides_secondary:"Dynamic configuration overrides detected",performance:"Performance",performance_secondary:"Card performance options",profiles:"Configuration profiles",profiles_secondary:"Choose pre-configured sets of defaults",status_bar:"Status bar",status_bar_secondary:"Status bar look & feel options",timeline:"Timeline",timeline_secondary:"Event timeline options",upgrade:"Upgrade",upgrade_available:"An automatic card configuration upgrade is available",view:"View",view_secondary:"What the card should show and how to show it"},S_={ptz:{down:"Down",home:"Home",left:"Left",right:"Right",up:"Up",zoom_in:"Zoom In",zoom_out:"Zoom Out"}},E_={awaiting_live:"Waiting for live stream to load ...",awaiting_media:"Waiting for media to load",camera_initialization:"Camera initialization failed",camera_initialization_reolink:"Could not initialize Reolink camera",could_not_render_elements:"Could not render picture elements",could_not_resolve:"Could not resolve media URL",diagnostics:"Card diagnostics. Please review for confidential information prior to sharing",download_no_media:"No media to download",download_sign_failed:"Could not sign media URL for download",duplicate_camera_id:"Duplicate Frigate camera id for the following camera, use the 'id' parameter to uniquely identify cameras",empty_response:"Received empty response from Home Assistant for request",failed_response:"Failed to receive response from Home Assistant for request",failed_retain:"Could not retain event",failed_sign:"Could not sign Home Assistant URL",image_load_error:"The image could not be loaded",invalid_configuration:"Invalid configuration",invalid_configuration_no_hint:"No location hint available (bad or missing type?)",invalid_configuration_override:"Invalid override configuration",invalid_elements_config:"Invalid picture elements configuration",invalid_response:"Received invalid response from Home Assistant for request",jsmpeg_no_player:"Could not start JSMPEG player",live_camera_no_endpoint:"Could not get camera endpoint for this live provider (incomplete configuration?)",live_camera_not_found:"The configured camera_entity was not found",live_camera_unavailable:"Camera unavailable",no_camera_engine:"Could not determine suitable engine for camera",no_camera_entity:"Could not find camera entity",no_camera_entity_for_triggers:"A camera entity is required in order to autodetect triggers",no_camera_id:"Could not determine camera id for the following camera, may need to set 'id' parameter manually",no_camera_name:"Could not determine a Frigate camera name for camera (or one of its dependents), please specify either 'camera_entity' or 'camera_name'",no_dashboard_or_view:"Both 'dashboard_path' and 'view_path' parameters are required for the 'dashboard' cast method",no_live_camera:"The camera_entity parameter must be set and valid for this live provider",no_supported_camera:"The selected camera does not support this view",no_supported_cameras:"No cameras support this view",reconnecting:"Reconnecting",too_many_automations:"Too many nested automation calls, please check your configuration for loops",troubleshooting:"Check troubleshooting",unknown:"Unknown error",upgrade_available:"An automated card configuration upgrade is available, please visit the visual card editor",webrtc_card_reported_error:"WebRTC Card reported an error",webrtc_card_waiting:"Waiting for WebRTC Card to load ..."},$_={camera:"Camera",duration:"Duration",in_progress:"In Progress",score:"Score",seek:"Seek",start:"Start",tag:"Tag",what:"What",where:"Where"},A_={assign:"Assign",assigning:"Assigning",modifiers:{alt:"Alt",ctrl:"Ctrl",meta:"Meta",shift:"Shift"},unassign:"Unassign"},z_={all:"All",camera:"Camera",favorite:"Favorite",media_type:"Media Type",media_types:{clips:"Clips",recordings:"Recordings",snapshots:"Snapshots"},not_favorite:"Not Favorite",select_camera:"Select camera...",select_favorite:"Select favorite...",select_media_type:"Select media type...",select_tag:"Select tag...",select_what:"Select what...",select_when:"Select when...",select_where:"Select where...",tag:"Tag",what:"What",when:"When",whens:{custom:"Custom",past_month:"Past Month",past_week:"Past Week",today:"Today",yesterday:"Yesterday"},where:"Where"},I_={unseekable:"Seek time not found in media"},T_={camera:"Camera",duration:"Duration",events:"Events",in_progress:"In Progress",seek:"Seek",start:"Start"},j_={download:"Download media",no_thumbnail:"No thumbnail available",retain_indefinitely:"Media will be indefinitely retained",timeline:"See media in timeline"},O_={select_date:"Choose date"},D_={common:x_,config:C_,display_modes:M_,editor:k_,elements:S_,error:E_,event:$_,key_assigner:A_,media_filter:z_,media_viewer:I_,recording:T_,thumbnail:j_,timeline:O_},R_=Object.freeze({__proto__:null,common:x_,config:C_,default:D_,display_modes:M_,editor:k_,elements:S_,error:E_,event:$_,key_assigner:A_,media_filter:z_,media_viewer:I_,recording:T_,thumbnail:j_,timeline:O_});const P_="en",L_={[P_]:R_};let N_;function F_(e){const t=e=>e.replace("-","_"),n=e?.language??e?.selectedLanguage;if(n)return t(n);const a=localStorage.getItem("selectedLanguage");if(a){const e=JSON.parse(a);if(e)return t(e)}for(const e of navigator.languages){const n=t(e);if(n&&n in L_)return n}return P_}function V_(e,t="",n=""){let a="";try{a=e.split(".").reduce(((e,t)=>e[t]),L_[N_??P_])}catch(e){}return a||(a=e.split(".").reduce(((e,t)=>e[t]),L_[P_])),""!==t&&""!==n&&(a=a.replace(t,n)),a}function H_(e){return"string"==typeof e?.id&&e.id||"string"==typeof e?.camera_entity&&e.camera_entity||"object"==typeof e?.webrtc_card&&e.webrtc_card&&("string"==typeof e.webrtc_card.entity&&e.webrtc_card.entity||"string"==typeof e.webrtc_card.url&&e.webrtc_card.url)||"object"==typeof e?.go2rtc&&e.go2rtc&&"string"==typeof e.go2rtc.url&&"string"==typeof e.go2rtc.stream&&`${e.go2rtc.url}#${e.go2rtc.stream}`||"object"==typeof e?.frigate&&e.frigate&&"string"==typeof e?.frigate.camera_name&&e.frigate.camera_name||""}const B_=(e,...t)=>{e?.debug?.logging&&console.debug(...t)},q_=(e,t,n)=>"preset"===t?(n?.preset?e.ptz.presets?.[n.preset]:null)??null:n?.phase?e.ptz[`actions_${t}_${n.phase}`]??null:e.ptz[`actions_${t}`]??null,U_=(e,t,n)=>!!q_(e,t,n),W_=(e,t)=>{const n=U_(e,t,{phase:"start"})&&U_(e,t,{phase:"stop"}),a=U_(e,t);return n||a?[...n?["continuous"]:[],...a?["relative"]:[]]:null},Z_=e=>{const t=W_(e,"left"),n=W_(e,"right"),a=W_(e,"up"),i=W_(e,"down"),r=W_(e,"zoom_in"),o=W_(e,"zoom_out"),s=e.ptz.presets?Object.keys(e.ptz.presets):void 0;return t?.length||n?.length||a?.length||i?.length||r?.length||o?.length||s?.length?{...t?{left:t}:{},...n?{right:n}:{},...a?{up:a}:{},...i?{down:i}:{},...r?{zoomIn:r}:{},...o?{zoomOut:o}:{},...s?{presets:s}:{}}:null};class Q_{constructor(e,t){this._capabilities=e;for(const e of t?.disable??[])this._disable(e);for(const e of Ts)t?.disableExcept?.length&&!t.disableExcept.includes(e)&&this._disable(e)}_disable(e){delete this._capabilities[e]}matches(e){let t=!0;return"string"==typeof e&&(t&&=this.has(e)),"object"==typeof e&&e.allCapabilities&&(t&&=e.allCapabilities.every((e=>this.has(e)))),"object"==typeof e&&e.anyCapabilities&&(t&&=e.anyCapabilities.some((e=>this.has(e)))),t}has(e){return!!this._capabilities[e]}getPTZCapabilities(){return this._capabilities.ptz??null}hasPTZCapability(){return!!(this._capabilities.ptz?.down?.length||this._capabilities.ptz?.up?.length||this._capabilities.ptz?.left?.length||this._capabilities.ptz?.right?.length||this._capabilities.ptz?.zoomIn?.length||this._capabilities.ptz?.zoomOut?.length||this._capabilities.ptz?.presets?.length)}getRawCapabilities(){return this._capabilities}}function G_(e,t,n){var a=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var r=Array(i);++at||r&&o&&c&&!s&&!l||a&&o&&c||!n&&c||!i)return 1;if(!a&&!r&&!l&&e=s?c:c*("desc"==n[a]?-1:1)}return e.index-t.index}(e,t,n)}))}function Ev(e,t,n,a){return null==e?[]:(dp(t)||(t=null==t?[]:[t]),dp(n=a?void 0:n)||(n=null==n?[]:[n]),Sv(e,t,n))}async function $v(e,t,n,a=!1){let i;try{i=await e.callWS(n)}catch(e){if(!(e instanceof Error))throw new zs(V_("error.failed_response"),{request:n,response:e});throw e}if(!i)throw new zs(V_("error.empty_response"),{request:n});const r=a?t.safeParse(JSON.parse(i)):t.safeParse(i);if(!r.success)throw new zs(V_("error.invalid_response"),{request:n,response:i,invalid_keys:Rs(r.error)});return r.data}const Av=ba.lazy((()=>ba.object({title:ba.string(),media_class:ba.string(),media_content_type:ba.string(),media_content_id:ba.string(),can_play:ba.boolean(),can_expand:ba.boolean(),children_media_class:ba.string().nullable().optional(),thumbnail:ba.string().nullable(),children:ba.array(Av).nullable().optional()}))),zv="video",Iv="image",Tv=60,jv=e=>Ev(e,(e=>e._metadata?.startDate),"desc");class Ov{async walkBrowseMedias(e,t,n){return t&&t.length?(await tf(t,(async t=>await this._walkBrowseMedia(e,t,n)))).flat():[]}async _walkBrowseMedia(e,t,n){let a=[];for(const i of function(e,t,n){t=(n?dg(e,t,n):void 0===t)?1:K_(Sg(t),0);var a=null==e?0:e.length;if(!a||t<1)return[];for(var i=0,r=0,o=Array(Y_(a/t));iawait this._browseMedia(e,a,{cache:n?.cache,matcher:t.matcher,metadataGenerator:t.metadataGenerator})));for(const e of r)for(const n of e.children??[])t.matcher(n)&&a.push(n);if(t.sorter&&(a=t.sorter(a)),t.earlyExit&&t.earlyExit(a))break}const i=t.advance?t.advance(a):null;return i?.length?await this.walkBrowseMedias(e,i,n):a}async _browseMedia(e,t,n){const a="object"==typeof t?t.media_content_id:t,i=n?.cache?n.cache.get(a):null;if(i)return i;const r={type:"media_source/browse_media",media_content_id:a},o=await $v(e,Av,r);if(n?.metadataGenerator)for(const e of o.children??[])e._metadata=n.metadataGenerator(e,"object"==typeof t?t:void 0)??void 0;return n?.cache&&n.cache.set(a,o,Ud(new Date,{seconds:60})),o}}function Dv(e,t){return bm(e,t)}function Rv(e,t){return e&&e.length?function(e,t){for(var n=-1,a=e.length,i=0,r=[];++nNv(t,e)))}add(e){this._ranges.push(e),this._ranges=Vv(this._ranges)}clear(){this._ranges=[]}}class Lv{constructor(e){this._ranges=e??[]}hasCoverage(e){const t=new Date;return this._ranges.some((n=>tet.start>=e.start&&t.end<=e.end,Fv=(e,t)=>e.start>=t.start&&e.start<=t.end||e.end>=t.start&&e.end<=t.end||e.start<=t.start&&e.end>=t.end,Vv=(e,t=0)=>{const n=[];e=Ev(e,(e=>e.start),"asc");let a=null;for(const i of e){const e=i.start instanceof Date?i.start.getTime():i.start;if(!a){a={...i};continue}(a.end instanceof Date?a.end.getTime():a.end)+1e3*t>=e?i.end>a.end&&(a.end=i.end):(n.push(a),a={...i})}return a&&n.push(a),n};class Hv{constructor(){this._data=[]}get(e){const t=new Date;for(const n of this._data)if((!n.expires||t<=n.expires)&&this._contains(e,n.request))return n.response;return null}clear(){this._data=[]}has(e){return!!this.get(e)}set(e,t,n){this._data.push({request:e,response:t,expires:n}),this._expireOldRequests()}_contains(e,t){return Dv(e,t)}_expireOldRequests(){const e=new Date;this._data=this._data.filter((t=>!t.expires||e=e.start.getTime()){if(a>e.end.getTime())break;t.push(n)}}return t}getSize(){return this._data.length}expireMatches(e){this._data=this._data.filter((t=>!e(t)))}}class Uv{constructor(){this._segments=new Map}add(e,t,n){let a=this._segments.get(e);a||(a=new qv((e=>1e3*e.start_time),(e=>e.id)),this._segments.set(e,a)),a.add(t,n)}clear(){this._segments.clear()}hasCoverage(e,t){return!!this._segments.get(e)?.hasCoverage(t)}get(e,t){return this._segments.get(e)?.get(t)??null}getSize(e){return this._segments.get(e)?.getSize()??null}getCameraIDs(){return[...this._segments.keys()]}expireMatches(e,t){this._segments.get(e)?.expireMatches(t)}}class Wv extends zs{}class Zv extends zs{}var Qv,Gv,Yv;!function(e){e.Event="event-query",e.Recording="recording-query",e.RecordingSegments="recording-segments-query",e.MediaMetadata="media-metadata"}(Qv||(Qv={})),function(e){e.Event="event-results",e.Recording="recording-results",e.RecordingSegments="recording-segments-results",e.MediaMetadata="media-metadata-results"}(Gv||(Gv={})),function(e){e.Frigate="frigate",e.Generic="generic",e.MotionEye="motioneye",e.Reolink="reolink"}(Yv||(Yv={}));const Kv=e=>e.camera_entity??e.webrtc_card?.entity??null;class Xv{constructor(e){this._entityRegistryManager=e}async createEngine(e,t){let n;switch(e){case Yv.Generic:const{GenericCameraManagerEngine:e}=await import("./engine-generic-bb62ddef.js").then((function(e){return e.e}));n=new e(t.stateWatcher,t.eventCallback);break;case Yv.Frigate:const{FrigateCameraManagerEngine:a}=await import("./engine-frigate-1cc4bb56.js");n=new a(this._entityRegistryManager,t.stateWatcher,new Uv,new Bv,t.eventCallback);break;case Yv.MotionEye:const{MotionEyeCameraManagerEngine:i}=await import("./engine-motioneye-381004ee.js");n=new i(this._entityRegistryManager,t.stateWatcher,new Ov,t.resolvedMediaCache,new Bv,t.eventCallback);break;case Yv.Reolink:const{ReolinkCameraManagerEngine:r}=await import("./engine-reolink-72a91bc6.js");n=new r(this._entityRegistryManager,t.stateWatcher,new Ov,t.resolvedMediaCache,new Bv,t.eventCallback)}return n}async getEngineForCamera(e,t){let n=null;if("frigate"===t.engine)n=Yv.Frigate;else if("motioneye"===t.engine)n=Yv.MotionEye;else if("generic"===t.engine)n=Yv.Generic;else if("reolink"===t.engine)n=Yv.Reolink;else{const a=Kv(t);if(a){const i=await this._entityRegistryManager.getEntity(e,a);if(!i){if(e.states[a])return Yv.Generic;throw new Wv(V_("error.no_camera_entity"),t)}switch(i?.platform){case"frigate":n=Yv.Frigate;break;case"motioneye":n=Yv.MotionEye;break;case"reolink":n=Yv.Reolink;break;default:n=Yv.Generic}}else t.frigate.camera_name?n=Yv.Frigate:(t.webrtc_card?.url||t.go2rtc?.url&&t.go2rtc?.stream)&&(n=Yv.Generic)}return n}}class Jv{constructor(){this._cameras=new Map,this._enginesByType=new Map}addCamera(e){this._cameras.set(e.getID(),e),this._enginesByType.set(e.getEngine().getEngineType(),e.getEngine())}async setCameras(e){for(const t of e){const e=this._cameras.get(t.getID());e!==t&&(this.addCamera(t),await(e?.destroy()))}for(const t of this._cameras.values())e.includes(t)||(await t.destroy(),this._cameras.delete(t.getID()))}async reset(){await tf(this._cameras.values(),(e=>e.destroy())),this._cameras.clear(),this._enginesByType.clear()}getCamera(e){return this._cameras.get(e)??null}getCameras(){return this._cameras}getCameraConfig(e){return this._cameras.get(e)?.getConfig()??null}hasCameraID(e){return this._cameras.has(e)}getCameraCount(){return this._cameras.size}getDefaultCameraID(){return this._cameras.keys().next().value??null}*getCameraConfigs(e){for(const[t,n]of this.getCameraConfigEntries(e))yield n}*getCameraConfigEntries(e){for(const t of e??this._cameras.keys()){const e=this.getCameraConfig(t);e&&(yield[t,e])}}getCameraIDs(){return new Set(this._cameras.keys())}getCameraIDsWithCapability(e){const t=new Set;for(const n of this._cameras.values())n.getCapabilities()?.matches(e)&&t.add(n.getID());return t}getCameraConfigForMedia(e){return this.getCameraConfig(e.getCameraID())}getEngineOfType(e){return this._enginesByType.get(e)??null}getEngineForCameraID(e){return this._cameras.get(e)?.getEngine()??null}getEnginesForCameraIDs(e){const t=new Map;for(const n of e){const e=this.getEngineForCameraID(n);e&&(t.has(e)||t.set(e,new Set),t.get(e)?.add(n))}return t.size?t:null}getEngineForMedia(e){return this.getEngineForCameraID(e.getCameraID())}getAllDependentCameras(e,t){const n=new Set,a=new Set,i=e=>{n.add(e);const r=this.getCamera(e),o=r?.getConfig();if(r&&o){t&&!r.getCapabilities()?.matches(t)||a.add(e);const s=new Set;o.dependencies.cameras.forEach((e=>s.add(e))),o.dependencies.all_cameras&&this.getCameraIDs().forEach((e=>s.add(e)));for(const e of s)n.has(e)||i(e)}};return i(e),a}}const ey=e=>{return Ev((n=e=>e.getID()??e,(t=e)&&t.length?Hg(t,xv(n)):[]),(e=>e.getStartTime()??e.getID()),"asc");var t,n};class ty{static isEventQuery(e){return e.type===Qv.Event}static isRecordingQuery(e){return e.type===Qv.Recording}static isRecordingSegmentsQuery(e){return e.type===Qv.RecordingSegments}static isMediaMetadataQuery(e){return e.type===Qv.MediaMetadata}}class ny{static isEventQueryResult(e){return e.type===Gv.Event}static isRecordingQueryResult(e){return e.type===Gv.Recording}static isRecordingSegmentsQueryResult(e){return e.type===Gv.RecordingSegments}static isMediaMetadataQueryResult(e){return e.type===Gv.MediaMetadata}}class ay{constructor(e,t){this._requestLimit=new w_,this._api=e,this._engineFactory=t?.factory??new Xv(this._api.getEntityRegistryManager()),this._store=t?.store??new Jv}async initializeCamerasFromConfig(){const e=this._api.getConfigManager().getConfig(),t=this._api.getHASSManager().getHASS();if(!e||!t)return!1;this._requestLimit.concurrency=e.performance.features.max_simultaneous_engine_requests??1/0;const n=e.cameras.map((t=>{return n={},a=u_(e?.cameras_global),hg(n,a,t,((e,t)=>Array.isArray(t)?t:void 0));var n,a}));try{await this._initializeCameras(n)}catch(e){return this._api.getMessageManager().setErrorIfHigherPriority(e,V_("error.camera_initialization")),!1}return!0}async reset(){await this._store.reset()}async _getEnginesForCameras(e){const t=new Map,n=new Map,a=this._api.getHASSManager().getHASS(); +/* istanbul ignore if: the if path cannot be reached -- @preserve */ +if(!a)return t;const i=await(async e=>await tf(e,(e=>this._engineFactory.getEngineForCamera(a,e))))(e);for(const[a,r]of e.entries()){const e=i[a],o=e?n.get(e)??await this._engineFactory.createEngine(e,{eventCallback:e=>this._api.getTriggersManager().handleCameraEvent(e),stateWatcher:this._api.getHASSManager().getStateWatcher(),resolvedMediaCache:this._api.getResolvedMediaCache()}):null;if(!o||!e)throw new Wv(V_("error.no_camera_engine"),u_(r));n.set(e,o),t.set(r,o)}return t}async _initializeCameras(e){const t=new Date,n=this._api.getHASSManager().getHASS(); +/* istanbul ignore if: the if path cannot be reached -- @preserve */ +if(!n)return;e.some((e=>(e=>e.triggers.motion||e.triggers.occupancy)(e)))&&await this._api.getEntityRegistryManager().fetchEntityList(n);const a=await this._getEnginesForCameras(e),i=await tf(a.entries(),(async([e,t])=>await t.createCamera(n,e))),r=async()=>{i.forEach((e=>e.destroy()))},o=new Set;for(const e of i){const t=H_(e.getConfig());if(!t)throw await r(),new Wv(V_("error.no_camera_id"),e.getConfig());if(o.has(t))throw await r(),new Wv(V_("error.duplicate_camera_id"),e.getConfig());e.setID(t),o.add(t)}await this._store.setCameras(i),B_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card CameraManager initialized (Cameras: ",this._store.getCameras(),`, Duration: ${((new Date).getTime()-t.getTime())/1e3}s,`,")")}isInitialized(){return this._store.getCameraCount()>0}getStore(){return this._store}generateDefaultEventQueries(e,t){return this._generateDefaultQueries(e,{type:Qv.Event,...t})}generateDefaultRecordingQueries(e,t){return this._generateDefaultQueries(e,{type:Qv.Recording,...t})}generateDefaultRecordingSegmentsQueries(e,t){return this._generateDefaultQueries(e,{type:Qv.RecordingSegments,...t})}_generateDefaultQueries(e,t){const n=[],a=Zg(e),i=this._store.getEnginesForCameraIDs(a);if(!i)return null;for(const[e,a]of i){let i=null; +/* istanbul ignore else: the else path cannot be reached -- @preserve */ty.isEventQuery(t)?i=e.generateDefaultEventQuery(this._store,a,t):ty.isRecordingQuery(t)?i=e.generateDefaultRecordingQuery(this._store,a,t):ty.isRecordingSegmentsQuery(t)&&(i=e.generateDefaultRecordingSegmentsQuery(this._store,a,t));for(const e of i??[])n.push(e)}return n.length?n:null}async getMediaMetadata(){const e=new Set,t=new Set,n=new Set,a=new Set,i={type:Qv.MediaMetadata,cameraIDs:this._store.getCameraIDs()},r=await this._handleQuery(i);for(const i of r.values())i.metadata.tags&&i.metadata.tags.forEach(e.add,e),i.metadata.what&&i.metadata.what.forEach(t.add,t),i.metadata.where&&i.metadata.where.forEach(n.add,n),i.metadata.days&&i.metadata.days.forEach(a.add,a);return t.size||n.size||a.size||e.size?{...e.size&&{tags:e},...t.size&&{what:t},...n.size&&{where:n},...a.size&&{days:a}}:null}async getEvents(e,t){return await this._handleQuery(e,t)}async getRecordings(e,t){return await this._handleQuery(e,t)}async getRecordingSegments(e,t){return await this._handleQuery(e,t)}async executeMediaQueries(e,t){return this._convertQueryResultsToMedia(await this._handleQuery(e,t))}async extendMediaQueries(e,t,n,a){if(!this._api.getHASSManager().getHASS())return null;const i=e=>{let n=null;for(const a of t){const t=a.getStartTime();t&&(!n||"earliest"===e&&tn)&&(n=t)}return n},r=this._api.getConfigManager().getCardWideConfig()?.performance?.features.media_chunk_size??50,o=[],s=[];for(const t of e){const e={...t}; +/* istanbul ignore else: the else path cannot be reached -- @preserve */if("later"===n){const t=i("latest");t&&(e.start=t,delete e.end)}else if("earlier"===n){const t=i("earliest");t&&(e.end=t,delete e.start)}e.limit=r,s.push({...t,limit:(t.limit??0)+r}),o.push(e)}const c=this._convertQueryResultsToMedia(await this._handleQuery(o,a));if(!c.length)return null;const l=ey(t.concat(c));return l.length===t.length?null:{queries:s,results:l}}async getMediaDownloadPath(e){const t=this._store.getCameraConfigForMedia(e),n=this._store.getEngineForMedia(e),a=this._api.getHASSManager().getHASS();return t&&n&&a?await n.getMediaDownloadPath(a,t,e):null}getMediaCapabilities(e){const t=this._store.getEngineForMedia(e);return t?t.getMediaCapabilities(e):null}async favoriteMedia(e,t){const n=this._store.getCameraConfigForMedia(e),a=this._store.getEngineForMedia(e),i=this._api.getHASSManager().getHASS();if(!n||!a||!i)return;const r=new Date;await this._requestLimit.add((()=>a.favoriteMedia(i,n,e,t))),B_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card CameraManager favorite request (",`Duration: ${((new Date).getTime()-r.getTime())/1e3}s,`,"Media:",e.getID(),", Favorite:",t,")")}areMediaQueriesResultsFresh(e,t){const n=new Date;for(const a of e){const e=this._store.getEnginesForCameraIDs(a.cameraIDs);for(const[i,r]of e??[]){const e=i.getQueryResultMaxAge({...a,cameraIDs:r});if(null!==e&&Ud(t,{seconds:e})a?null:await this._requestLimit.add((()=>i.getMediaSeekTime(r,this._store,e,t)))??null}async _handleQuery(e,t){const n=Wg(e),a=new Map,i=new Date,r=this._api.getHASSManager().getHASS();if(!r)return a;const o=async(e,n)=>{let i=null; +/* istanbul ignore else: the else path cannot be reached -- @preserve */ty.isEventQuery(n)?i=await e.getEvents(r,this._store,n,t):ty.isRecordingQuery(n)?i=await e.getRecordings(r,this._store,n,t):ty.isRecordingSegmentsQuery(n)?i=await e.getRecordingSegments(r,this._store,n,t):ty.isMediaMetadataQuery(n)&&(i=await e.getMediaMetadata(r,this._store,n,t)),i?.forEach(((e,t)=>a.set(t,e)))},s=async e=>{const t=this._store.getEnginesForCameraIDs(e.cameraIDs);t&&await Promise.all(Array.from(t.keys()).map((n=>this._requestLimit.add((()=>o(n,{...e,cameraIDs:t.get(n)}))))))};await Promise.all(n.map((e=>s(e))));const c=(l=Array.from(a.values()).map((e=>Number(e.cached??0))))&&l.length?function(e,t){for(var n,a=-1,i=e.length;++athis._store.getCamera(e))).filter(sf);return new Q_({live:t.some((e=>e.getCapabilities()?.has("live"))),clips:t.some((e=>e.getCapabilities()?.has("clips"))),recordings:t.some((e=>e.getCapabilities()?.has("recordings"))),snapshots:t.some((e=>e.getCapabilities()?.has("snapshots"))),"favorite-events":t.some((e=>e.getCapabilities()?.has("favorite-events"))),"favorite-recordings":t.some((e=>e.getCapabilities()?.has("favorite-recordings"))),seek:t.some((e=>e.getCapabilities()?.has("seek"))),menu:t.some((e=>e.getCapabilities()?.has("menu")))})}async executePTZAction(e,t,n){const a=this._store.getCameraConfig(e);if(!a)return;const i=q_(a,t,n);if(i)return await this._api.getActionsManager().executeActions(i);const r=this._api.getHASSManager().getHASS(),o=this._store.getEngineForCameraID(e);return o&&r?await this._requestLimit.add((()=>o.executePTZAction(r,a,t,n))):void 0}}class iy{constructor(e){this._cache=new Map,this._keyCallback=e}has(e){return this._cache.has(e)}getMatches(e){return[...this._cache.values()].filter(e)}get(e){return this._cache.get(e)??null}add(e){const t=e=>this._cache.set(this._keyCallback(e),e);Array.isArray(e)?e.forEach(t):t(e)}}const ry=ba.object({id:ba.string(),model:ba.string().nullable(),config_entries:ba.string().array(),manufacturer:ba.string().nullable()}).array();class oy{constructor(e){this._fetchedDeviceList=!1,this._cache=e}async getDevice(e,t){return this._cache.has(t)?this._cache.get(t):(await this._fetchDeviceList(e),this._cache.get(t)??null)}async getMatchingDevices(e,t){return await this._fetchDeviceList(e),this._cache.getMatches(t)}async _fetchDeviceList(e){if(this._fetchedDeviceList)return;let t=null;try{t=await $v(e,ry,{type:"config/device_registry/list"})}catch(e){return void Gg(e)}this._cache.add(t),this._fetchedDeviceList=!0}}const sy=ba.object({config_entry_id:ba.string().nullable(),device_id:ba.string().nullable(),disabled_by:ba.string().nullable(),entity_id:ba.string(),hidden_by:ba.string().nullable(),platform:ba.string(),translation_key:ba.string().nullable(),unique_id:ba.string().or(ba.number()).optional()}),cy=sy.array();class ly{constructor(e){this._fetchedEntityList=!1,this._cache=e}async getEntity(e,t){const n=this._cache.get(t);if(n)return n;let a=null;try{a=await $v(e,sy,{type:"config/entity_registry/get",entity_id:t})}catch(e){return Gg(e),null}return this._cache.add(a),a}async getMatchingEntities(e,t){return await this.fetchEntityList(e),this._cache.getMatches(t)}async getEntities(e,t){const n=new Map;return await Promise.all(t.map((async t=>{const a=await this.getEntity(e,t);a&&n.set(t,a)}))),n}async fetchEntityList(e){if(this._fetchedEntityList)return;let t=null;try{t=await $v(e,cy,{type:"config/entity_registry/list"})}catch(e){return void Gg(e)}this._cache.add(t),this._fetchedEntityList=!0}}class dy extends Map{constructor(e={}){if(super(),!(e.maxSize&&e.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");if("number"==typeof e.maxAge&&0===e.maxAge)throw new TypeError("`maxAge` must be a number greater than 0");this.maxSize=e.maxSize,this.maxAge=e.maxAge||Number.POSITIVE_INFINITY,this.onEviction=e.onEviction,this.cache=new Map,this.oldCache=new Map,this._size=0}_emitEvictions(e){if("function"==typeof this.onEviction)for(const[t,n]of e)this.onEviction(t,n.value)}_deleteIfExpired(e,t){return"number"==typeof t.expiry&&t.expiry<=Date.now()&&("function"==typeof this.onEviction&&this.onEviction(e,t.value),this.delete(e))}_getOrDeleteIfExpired(e,t){if(!1===this._deleteIfExpired(e,t))return t.value}_getItemValue(e,t){return t.expiry?this._getOrDeleteIfExpired(e,t):t.value}_peek(e,t){const n=t.get(e);return this._getItemValue(e,n)}_set(e,t){this.cache.set(e,t),this._size++,this._size>=this.maxSize&&(this._size=0,this._emitEvictions(this.oldCache),this.oldCache=this.cache,this.cache=new Map)}_moveToRecent(e,t){this.oldCache.delete(e),this._set(e,t)}*_entriesAscending(){for(const e of this.oldCache){const[t,n]=e;if(!this.cache.has(t)){!1===this._deleteIfExpired(t,n)&&(yield e)}}for(const e of this.cache){const[t,n]=e;!1===this._deleteIfExpired(t,n)&&(yield e)}}get(e){if(this.cache.has(e)){const t=this.cache.get(e);return this._getItemValue(e,t)}if(this.oldCache.has(e)){const t=this.oldCache.get(e);if(!1===this._deleteIfExpired(e,t))return this._moveToRecent(e,t),t.value}}set(e,t,{maxAge:n=this.maxAge}={}){const a="number"==typeof n&&n!==Number.POSITIVE_INFINITY?Date.now()+n:void 0;return this.cache.has(e)?this.cache.set(e,{value:t,expiry:a}):this._set(e,{value:t,expiry:a}),this}has(e){return this.cache.has(e)?!this._deleteIfExpired(e,this.cache.get(e)):!!this.oldCache.has(e)&&!this._deleteIfExpired(e,this.oldCache.get(e))}peek(e){return this.cache.has(e)?this._peek(e,this.cache):this.oldCache.has(e)?this._peek(e,this.oldCache):void 0}delete(e){const t=this.cache.delete(e);return t&&this._size--,this.oldCache.delete(e)||t}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}resize(e){if(!(e&&e>0))throw new TypeError("`maxSize` must be a number greater than 0");const t=[...this._entriesAscending()],n=t.length-e;n<0?(this.cache=new Map(t),this.oldCache=new Map,this._size=t.length):(n>0&&this._emitEvictions(t.slice(0,n)),this.oldCache=new Map(t.slice(n)),this.cache=new Map,this._size=0),this.maxSize=e}*keys(){for(const[e]of this)yield e}*values(){for(const[,e]of this)yield e}*[Symbol.iterator](){for(const e of this.cache){const[t,n]=e;!1===this._deleteIfExpired(t,n)&&(yield[t,n.value])}for(const e of this.oldCache){const[t,n]=e;if(!this.cache.has(t)){!1===this._deleteIfExpired(t,n)&&(yield[t,n.value])}}}*entriesDescending(){let e=[...this.cache];for(let t=e.length-1;t>=0;--t){const n=e[t],[a,i]=n;!1===this._deleteIfExpired(a,i)&&(yield[a,i.value])}e=[...this.oldCache];for(let t=e.length-1;t>=0;--t){const n=e[t],[a,i]=n;if(!this.cache.has(a)){!1===this._deleteIfExpired(a,i)&&(yield[a,i.value])}}}*entriesAscending(){for(const[e,t]of this._entriesAscending())yield[e,t.value]}get size(){if(!this._size)return this.oldCache.size;let e=0;for(const t of this.oldCache.keys())this.cache.has(t)||e++;return Math.min(this._size+e,this.maxSize)}entries(){return this.entriesAscending()}forEach(e,t=this){for(const[n,a]of this.entriesAscending())e.call(t,a,n,this)}get[Symbol.toStringTag](){return JSON.stringify([...this.entriesAscending()])}}class uy{constructor(){this._cache=new dy({maxSize:1e3})}has(e){return this._cache.has(e)}get(e){return this._cache.get(e)}set(e,t){this._cache.set(e,t)}}const hy=async(e,t,n)=>{const a=n?n.get(t):void 0;if(a)return a;const i={type:"media_source/resolve_media",media_content_id:t};let r=null;try{r=await $v(e,js,i)}catch(e){Gg(e)}return n&&r&&n.set(t,r),r};class py{constructor(e,t,n){this._context=e,this._action=t,this._config=n}async execute(e){}async stop(){}}class my extends py{}class gy extends my{async execute(e){const t=this._action.camera??(this._action.triggered?e.getTriggersManager().getMostRecentlyTriggeredCameraID():null),n=e.getViewManager().getView(),a=e.getConfigManager().getConfig();if(t&&n){const i=a?.view.camera_select??"current",r="current"===i?n.view:i;await e.getViewManager().setViewByParametersWithNewQuery({params:{view:r,camera:t},failSafe:!0})}}}class fy extends my{async execute(e){e.getCameraURLManager().openURL()}}class _y extends my{async execute(e){e.getViewManager().setViewDefault()}}class vy extends my{async execute(e){await e.getViewManager().setViewByParametersWithNewQuery({params:{displayMode:this._action.display_mode}})}}class yy extends my{async execute(e){await e.getDownloadManager().downloadViewerMedia()}}class by extends my{async execute(e){e.getExpandManager().toggleExpanded()}}class wy extends my{async execute(e){e.getFullscreenManager().toggleFullscreen()}}class xy extends py{async execute(e){const t=e.getHASSManager().getHASS();t&&at(e.getCardElementManager().getElement(),t,this._config??{},this._action)}}class Cy extends my{async execute(e){console[this._action.level](this._action.message)}}const My=(e,t)=>e.context?.live?.overrides?.get(t??e.camera)??t??e.camera,ky=e=>My(e)!==e.camera,Sy=(e,t)=>{const n=e.context?.live?.overrides??new Map;n.set(e.camera,t),e.mergeInContext({live:{overrides:n}})};class Ey extends my{async execute(e){const t=this._action.media_player,n=e.getMediaPlayerManager(),a=e.getViewManager().getView(),i=a?.queryResults?.getSelectedResult()??null;"stop"===this._action.media_player_action?await n.stop(t):a?.is("live")?await n.playLive(t,My(a)):a?.isViewerView()&&i&&await n.playMedia(t,i)}}class $y extends my{async execute(e){e.getCardElementManager().toggleMenu()}}class Ay extends my{async execute(e){await e.getMicrophoneManager().connect()}}class zy extends my{async execute(e){e.getMicrophoneManager().disconnect()}}class Iy extends my{async execute(e){e.getMicrophoneManager().mute()}}class Ty extends my{async execute(e){await e.getMicrophoneManager().unmute()}}class jy extends my{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.mute())}}class Oy extends my{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.pause())}}class Dy extends my{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.play())}}const Ry=(e,t)=>{if(e.isViewerView()){const n=e.queryResults?.getSelectedResult()?.getID()??null;return"ptz"!==t?.type&&n?{targetID:n,type:"digital"}:null}if(e.is("live")){const n=My(e);let a="digital";return"digital"!==t?.type&&t?.cameraManager&&(Py(t.cameraManager,n)&&(a="ptz"),"ptz"!==a&&"ptz"===t?.type)?null:{targetID:n,type:a}}return null},Py=(e,t)=>!!e.getStore().getCamera(t)?.getCapabilities()?.hasPTZCapability();var Ly=ug((function(e,t,n){Jm(e,t,n)}));const Ny=(e,t)=>{t?.[e]?.inProgressAction?.stop()},Fy=(e,t,n,a)=>{Ly(t,{[n]:{[e]:{inProgressAction:a}}})};class Vy extends my{constructor(){super(...arguments),this._timer=new xf}async stop(){this._timer.stop()}async execute(e){const t=e.getViewManager().getView();if(!t)return;const n=this._action.camera??Ry(t,{type:"ptz",cameraManager:e.getCameraManager()})?.targetID??null,a=n?e.getCameraManager().getCameraCapabilities(n)?.getPTZCapabilities():null,i=n?e.getCameraManager().getStore().getCameraConfig(n)?.ptz:null;if(!n||!a||!i)return;if(!this._action.ptz_action)return void(a.presets&&a.presets.length>=1&&await e.getCameraManager().executePTZAction(n,"preset",{phase:this._action.ptz_phase,preset:a.presets[0]}));const r=(e=>{switch(e){case"left":case"right":case"up":case"down":return e;case"zoom_in":return"zoomIn";case"zoom_out":return"zoomOut"}return null})(this._action.ptz_action);if(r&&a[r]?.includes(this._action.ptz_phase?"continuous":"relative")||"preset"===this._action.ptz_action)return await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{phase:this._action.ptz_phase,preset:this._action.ptz_preset});if("start"===this._action.ptz_phase){Ny(n,this._context.ptz),Fy(n,this._context,"ptz",this);const t=async()=>{this._action.ptz_action&&await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset}),this._timer.start(i.r2c_delay_between_calls_seconds,t)};await t()}else"stop"===this._action.ptz_phase?Ny(n,this._context.ptz):(await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset,phase:"start"}),this._timer.start(i.c2r_delay_between_calls_seconds,(async()=>{this._action.ptz_action&&await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset,phase:"stop"})})))}}class Hy extends my{async execute(e){e.getViewManager().setViewWithMergedContext({ptzControls:{enabled:this._action.enabled}})}}function By(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=Cg(n))==n?n:0),void 0!==t&&(t=(t=Cg(t))==t?t:0),function(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}(Cg(e),t,n)}const qy=50,Uy=50,Wy=1,Zy=4,Qy=e=>void 0===e?.pan?.x&&void 0===e?.pan?.y&&void 0===e?.zoom;class Gy{constructor(e){this._context=e}modify(e){e.mergeInContext(this._context)}}const Yy=(e,t)=>({zoom:{[e]:{observed:t?.observed??void 0,requested:t?.requested??null}}}),Ky=(e,t,n)=>{t&&n&&t.setViewByParameters({modifiers:[new Gy(Yy(n,{observed:e.detail}))]})};class Xy extends my{constructor(){super(...arguments),this._timer=new xf}async _stepChange(e,t){e.getViewManager().setViewWithMergedContext(Yy(t,{requested:this._convertActionToZoomSettings(e.getViewManager().getView()?.context?.zoom?.[t]?.observed)}))}async stop(){this._timer.stop()}async execute(e){const t=e.getViewManager().getView();if(!t)return;const n=this._action.target_id??Ry(t,{type:"digital",cameraManager:e.getCameraManager()})?.targetID;return n?this._action.absolute||!this._action.ptz_phase?await this._stepChange(e,n): +/* istanbul ignore else: the else path cannot be reached -- @preserve */ +void("start"===this._action.ptz_phase?(Ny(n,this._context.ptzDigital),Fy(n,this._context,"ptzDigital",this),await this._stepChange(e,n),this._timer.startRepeated(.1,(()=>this._stepChange(e,n)))):"stop"===this._action.ptz_phase&&(Ny(n,this._context.ptzDigital),delete this._context.ptzDigital?.[n])):void 0}_convertActionToZoomSettings(e){if(!this._action.absolute&&!this._action.ptz_action)return{};if(this._action.absolute)return this._action.absolute;const t=e?.zoom??1,n=e?.pan?.x??50,a=e?.pan?.y??50,i="zoom_in"===this._action.ptz_action?.1:"zoom_out"===this._action.ptz_action?-.1:0,r="left"===this._action.ptz_action?-5:"right"===this._action.ptz_action?5:0,o="up"===this._action.ptz_action?-5:"down"===this._action.ptz_action?5:0;return{zoom:By(t+i,1,10),pan:{x:By(n+r,0,100),y:By(a+o,0,100)}}}}class Jy extends my{async execute(e){const t=e.getViewManager().getView();let n=null,a=null;if(this._action.target_id)n=this._action.target_id,a=Py(e.getCameraManager(),n)?"ptz":"digital";else if(t){const i=Ry(t,{cameraManager:e.getCameraManager()});n=i?.targetID??null,a=i?.type??null}n&&null!==a&&("ptz"===a?this._toPTZAction(n):this._toPTZDigitalAction(n)).execute(e)}_toPTZAction(e){return new Vy(this._context,(t={cardID:this._action.card_id,cameraID:e,ptzAction:this._action.ptz_action,ptzPhase:this._action.ptz_phase,ptzPreset:this._action.ptz_preset},{action:"fire-dom-event",frigate_card_action:"ptz",...t?.cardID&&{card_id:t.cardID},...t?.ptzAction&&{ptz_action:t.ptzAction},...t?.ptzPhase&&{ptz_phase:t.ptzPhase},...t?.ptzPreset&&{ptz_preset:t.ptzPreset},...t?.cameraID&&{camera:t.cameraID}}),this._config);var t}_toPTZDigitalAction(e){return new Xy(this._context,(t={cardID:this._action.card_id,ptzPhase:this._action.ptz_phase,ptzAction:this._action.ptz_action,targetID:e},{action:"fire-dom-event",frigate_card_action:"ptz_digital",...t?.cardID&&{card_id:t.cardID},...t?.ptzAction&&{ptz_action:t.ptzAction},...t?.ptzPhase&&{ptz_phase:t.ptzPhase},...t?.absolute&&{absolute:t.absolute},...t?.targetID&&{target_id:t.targetID}}),this._config);var t}}class eb extends my{async execute(e){await e.getDownloadManager().downloadScreenshot()}}class tb extends my{async execute(e){var t;await af((t=this._action.duration,3600*(t.h??0)+60*(t.m??0)+(t.s??0)+(t.ms??0)/1e3))}}class nb extends my{async execute(e){switch(this._action.status_bar_action){case"reset":e.getStatusBarItemManager().removeAllDynamicStatusBarItems();break;case"add":this._action.items?.forEach((t=>e.getStatusBarItemManager().addDynamicStatusBarItem(t)));break;case"remove":this._action.items?.forEach((t=>e.getStatusBarItemManager().removeDynamicStatusBarItem(t)))}}}class ab{modify(e){(e=>{const t=e.context?.live?.overrides;t&&t.has(e.camera)&&e.context?.live?.overrides?.delete(e.camera)})(e)}}class ib extends my{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new ab]})}}class rb{constructor(e){this._api=e}modify(e){const t=[...this._api.getCameraManager().getStore().getAllDependentCameras(e.camera,"substream")];if(t.length<=1)return;const n=My(e),a=t.indexOf(n),i=a<0?0:(a+1)%t.length;Sy(e,t[i])}}class ob extends my{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new rb(e)]})}}class sb{constructor(e){this._substreamID=e}modify(e){Sy(e,this._substreamID)}}class cb extends my{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new sb(this._action.camera)]})}}class lb extends my{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.unmute())}}class db extends my{async execute(e){e.getViewManager().setViewByParametersWithNewQuery({params:{view:this._action.frigate_card_action}})}}class ub{createAction(e,t,n){const a=mf(t);if("fire-dom-event"!==t.action||!a)return new xy(e,t,n?.config);if(a.card_id&&a.card_id!==n?.cardID)return null;switch(a.frigate_card_action){case"default":return new _y(e,a,n?.config);case"clip":case"clips":case"image":case"live":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":case"diagnostics":return new db(e,a,n?.config);case"sleep":return new tb(e,a,n?.config);case"download":return new yy(e,a,n?.config);case"camera_ui":return new fy(e,a,n?.config);case"expand":return new by(e,a,n?.config);case"fullscreen":return new wy(e,a,n?.config);case"menu_toggle":return new $y(e,a,n?.config);case"camera_select":return new gy(e,a,n?.config);case"live_substream_select":return new cb(e,a,n?.config);case"live_substream_off":return new ib(e,a,n?.config);case"live_substream_on":return new ob(e,a,n?.config);case"media_player":return new Ey(e,a,n?.config);case"microphone_connect":return new Ay(e,a,n?.config);case"microphone_disconnect":return new zy(e,a,n?.config);case"microphone_mute":return new Iy(e,a,n?.config);case"microphone_unmute":return new Ty(e,a,n?.config);case"mute":return new jy(e,a,n?.config);case"unmute":return new lb(e,a,n?.config);case"play":return new Dy(e,a,n?.config);case"pause":return new Oy(e,a,n?.config);case"screenshot":return new eb(e,a,n?.config);case"display_mode_select":return new vy(e,a,n?.config);case"ptz":return new Vy(e,a,n?.config);case"ptz_digital":return new Xy(e,a,n?.config);case"ptz_multi":return new Jy(e,a,n?.config);case"ptz_controls":return new Hy(e,a,n?.config);case"log":return new Cy(e,a,n?.config);case"status_bar":return new nb(e,a,n?.config)} +/* istanbul ignore next: this path cannot be reached -- @preserve */ +/* istanbul ignore next: this path cannot be reached -- @preserve */ +return console.warn(`Frigate card received unknown card action: ${a.frigate_card_action}`),null}}class hb{constructor(e,t,n){this._actions=[],this._factory=new ub,this._stopped=!1,this._context=e;for(const a of Wg(t)){const t=this._factory.createAction(e,a,n);t&&this._actions.push(t)}}async execute(e){for(const t of this._actions){if(this._stopped)break;await t.execute(e)}}async stop(){this._stopped=!0}}const pb=ba.object({action:ba.enum(["tap","double_tap","hold","start_tap","end_tap"])}),mb=ba.object({detail:pb});class gb{constructor(e){this._actionsInFlight=[],this._actionContext={},this.handleInteractionEvent=e=>{const t=mb.safeParse(e);if(!t.success)return;const n=t.data.detail.action,a=this.getMergedActions(),i=yf(n,a);a&&n&&i&&this.executeActions(i,a)},this.handleCustomActionEvent=e=>{"detail"in e&&this.executeActions(e.detail)},this.handleActionExecutionRequestEvent=async e=>{await this.executeActions(e.detail.action,e.detail.config)},this._api=e}getMergedActions(){const e=this._api.getViewManager().getView();if(this._api.getMessageManager().hasMessage())return{};const t=this._api.getConfigManager().getConfig();let n;if(e?.is("live"))n=t?.live.actions;else if(e?.isGalleryView())n=t?.media_gallery?.actions;else if(e?.isViewerView())n=t?.media_viewer.actions;else{if(!e?.is("image"))return{};n=t?.image?.actions}return{...t?.view.actions,...n}}uninitialize(){this._actionsInFlight.forEach((e=>e.stop()))}async executeActions(e,t){const n=new hb(this._actionContext,e,{config:t,cardID:this._api.getConfigManager().getConfig()?.card_id});this._actionsInFlight.push(n),await n.execute(this._api),this._actionsInFlight=this._actionsInFlight.filter((e=>e!==n))}}class fb{constructor(e){this._automations=[],this._priorEvaluations=new Map,this._nestedAutomationExecutions=0,this._api=e}deleteAutomations(e){this._automations=this._automations.filter((t=>t.tag!==e))}addAutomations(e){this._automations.push(...e)}execute(){if(!this._api.getHASSManager().hasHASS()||!this._api.getInitializationManager().isInitializedMandatory()||this._api.getMessageManager().hasErrorMessage())return;const e=[];for(const t of this._automations){const n=this._api.getConditionsManager().evaluateConditions(t.conditions),a=n?t.actions:t.actions_not,i=this._priorEvaluations.get(t);this._priorEvaluations.set(t,n),n!==i&&a&&e.push(...a)}if(!e.length)return;(async e=>{++this._nestedAutomationExecutions,this._nestedAutomationExecutions>10?this._api.getMessageManager().setMessageIfHigherPriority({type:"error",message:V_("error.too_many_automations")}):(await this._api.getActionsManager().executeActions(e),--this._nestedAutomationExecutions)})(e)}}class _b{constructor(e){this._api=e}openURL(){const e=this.getCameraURL();e&&window.open(e)}hasCameraURL(){return!!this.getCameraURL()}getCameraURL(){const e=this._api.getViewManager().getView(),t=e?.queryResults?.getSelectedResult()??null,n=e?.camera?this._api.getCameraManager().getCameraEndpoints(e.camera,{view:e.view,...t&&{media:t}})??null:null;return n?.ui?.endpoint??null}}const vb=(e,t)=>!!((e.attributes.supported_features??0)&t),yb=e=>(e=>vb(e,4)&&"number"==typeof e.attributes.in_progress)(e)||!!e.attributes.in_progress,bb=e=>{switch(e){case"armed_away":return"mdi:shield-lock";case"armed_vacation":return"mdi:shield-airplane";case"armed_home":return"mdi:shield-home";case"armed_night":return"mdi:shield-moon";case"armed_custom_bypass":return"mdi:security";case"pending":case"arming":return"mdi:shield-sync";case"triggered":return"mdi:bell-ring";case"disarmed":return"mdi:shield-off";default:return"mdi:shield"}},wb=(e,t)=>{const n="off"===e;switch(t?.attributes.device_class){case"battery":return n?"mdi:battery":"mdi:battery-outline";case"battery_charging":return n?"mdi:battery":"mdi:battery-charging";case"cold":return n?"mdi:thermometer":"mdi:snowflake";case"connectivity":return n?"mdi:close-network-outline":"mdi:check-network-outline";case"door":return n?"mdi:door-closed":"mdi:door-open";case"garage_door":return n?"mdi:garage":"mdi:garage-open";case"power":case"plug":return n?"mdi:power-plug-off":"mdi:power-plug";case"gas":case"problem":case"safety":case"tamper":return n?"mdi:check-circle":"mdi:alert-circle";case"smoke":return n?"mdi:check-circle":"mdi:smoke";case"heat":return n?"mdi:thermometer":"mdi:fire";case"light":return n?"mdi:brightness5":"mdi:brightness-7";case"lock":return n?"mdi:lock":"mdi:lock-open";case"moisture":return n?"mdi:water-off":"mdi:water";case"motion":return n?"mdi:motion-sensor-off":"mdi:motion-sensor";case"occupancy":case"presence":return n?"mdi:home-outline":"mdi:home";case"opening":return n?"mdi:square":"mdi:square-outline";case"running":return n?"mdi:stop":"mdi:play";case"sound":return n?"mdi:music-note-off":"mdi:music-note";case"update":return n?"mdi:package":"mdi:package-up";case"vibration":return n?"mdi:crop-portrait":"mdi:vibrate";case"window":return n?"mdi:window-closed":"mdi:window-open";default:return n?"mdi:radiobox-blank":"mdi:checkbox-marked-circle"}},xb=(e,t)=>{const n="closed"!==e;switch(t?.attributes.device_class){case"garage":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:garage";default:return"mdi:garage-open"}case"gate":switch(e){case"opening":case"closing":return"mdi:gate-arrow-right";case"closed":return"mdi:gate";default:return"mdi:gate-open"}case"door":return n?"mdi:door-open":"mdi:door-closed";case"damper":return n?"md:circle":"mdi:circle-slice-8";case"shutter":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-shutter";default:return"mdi:window-shutter-open"}case"curtain":switch(e){case"opening":return"mdi:arrow-split-vertical";case"closing":return"mdi:arrow-collapse-horizontal";case"closed":return"mdi:curtains-closed";default:return"mdi:curtains"}case"blind":case"shade":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:blinds";default:return"mdi:blinds-open"}case"window":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-closed";default:return"mdi:window-open"}}switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-closed";default:return"mdi:window-open"}},Cb={apparent_power:"mdi:flash",aqi:"mdi:air-filter",carbon_dioxide:"mdi:molecule-co2",carbon_monoxide:"mdi:molecule-co",current:"mdi:current-ac",date:"mdi:calendar",energy:"mdi:lightning-bolt",frequency:"mdi:sine-wave",gas:"mdi:gas-cylinder",humidity:"mdi:water-percent",illuminance:"mdi:brightness-5",monetary:"mdi:cash",nitrogen_dioxide:"mdi:molecule",nitrogen_monoxide:"mdi:molecule",nitrous_oxide:"mdi:molecule",ozone:"mdi:molecule",pm1:"mdi:molecule",pm10:"mdi:molecule",pm25:"mdi:molecule",power:"mdi:flash",power_factor:"mdi:angle-acute",pressure:"mdi:gauge",reactive_power:"mdi:flash",signal_strength:"mdi:wifi",sulphur_dioxide:"mdi:molecule",temperature:"mdi:thermometer",timestamp:"mdi:clock",volatile_organic_compounds:"mdi:molecule",voltage:"mdi:sine-wave"},Mb={10:"mdi:battery-10",20:"mdi:battery-20",30:"mdi:battery-30",40:"mdi:battery-40",50:"mdi:battery-50",60:"mdi:battery-60",70:"mdi:battery-70",80:"mdi:battery-80",90:"mdi:battery-90",100:"mdi:battery"},kb={10:"mdi:battery-charging-10",20:"mdi:battery-charging-20",30:"mdi:battery-charging-30",40:"mdi:battery-charging-40",50:"mdi:battery-charging-50",60:"mdi:battery-charging-60",70:"mdi:battery-charging-70",80:"mdi:battery-charging-80",90:"mdi:battery-charging-90",100:"mdi:battery-charging"},Sb=(e,t)=>{const n=Number(e);if(isNaN(n))return"off"===e?"mdi:battery":"on"===e?"mdi:battery-alert":"mdi:battery-unknown";const a=10*Math.round(n/10);return t&&n>=10?kb[a]:t?"mdi:battery-charging-outline":n<=5?"mdi:battery-alert-variant-outline":Mb[a]},Eb=e=>{const t=e?.attributes.device_class;if(t&&t in Cb)return Cb[t];if("battery"===t)return e?((e,t)=>{const n=e.state;return Sb(n,"on"===t?.state)})(e):"mdi:battery";const n=e?.attributes.unit_of_measurement;return"°C"===n||"°F"===n?"mdi:thermometer":void 0},$b="mdi:bookmark",Ab={alert:"mdi:alert",air_quality:"mdi:air-filter",automation:"mdi:robot",calendar:"mdi:calendar",camera:"mdi:video",climate:"mdi:thermostat",configurator:"mdi:cog",conversation:"mdi:text-to-speech",counter:"mdi:counter",fan:"mdi:fan",google_assistant:"mdi:google-assistant",group:"mdi:google-circles-communities",homeassistant:"mdi:home-assistant",homekit:"mdi:home-automation",image_processing:"mdi:image-filter-frames",input_button:"mdi:gesture-tap-button",input_datetime:"mdi:calendar-clock",input_number:"mdi:ray-vertex",input_select:"mdi:format-list-bulleted",input_text:"mdi:form-textbox",light:"mdi:lightbulb",mailbox:"mdi:mailbox",notify:"mdi:comment-alert",number:"mdi:ray-vertex",persistent_notification:"mdi:bell",person:"mdi:account",plant:"mdi:flower",proximity:"mdi:apple-safari",remote:"mdi:remote",scene:"mdi:palette",script:"mdi:script-text",select:"mdi:format-list-bulleted",sensor:"mdi:eye",siren:"mdi:bullhorn",simple_alarm:"mdi:bell",sun:"mdi:white-balance-sunny",timer:"mdi:timer-outline",updater:"mdi:cloud-upload",vacuum:"mdi:robot-vacuum",water_heater:"mdi:thermometer",weather:"mdi:weather-cloudy",zone:"mdi:map-marker-radius"};function zb(e,t,n,a){switch(e){case"alarm_control_panel":return bb(n);case"binary_sensor":return wb(n,t);case"button":switch(t?.attributes.device_class){case"restart":return"mdi:restart";case"update":return"mdi:package-up";default:return"mdi:gesture-tap-button"}case"cover":return xb(n,t);case"device_tracker":return"router"===t?.attributes.source_type?"home"===n?"mdi:lan-connect":"mdi:lan-disconnect":["bluetooth","bluetooth_le"].includes(t?.attributes.source_type)?"home"===n?"mdi:bluetooth-connect":"mdi:bluetooth":"not_home"===n?"mdi:account-arrow-right":"mdi:account";case"humidifier":return n&&"off"===n?"mdi:air-humidifier-off":"mdi:air-humidifier";case"input_boolean":return"on"===n?"mdi:check-circle-outline":"mdi:close-circle-outline";case"lock":switch(n){case"unlocked":return"mdi:lock-open";case"jammed":return"mdi:lock-alert";case"locking":case"unlocking":return"mdi:lock-clock";default:return"mdi:lock"}case"media_player":switch(t?.attributes.device_class){case"speaker":switch(n){case"playing":return"mdi:speaker-play";case"paused":return"mdi:speaker-pause";case"off":return"mdi:speaker-off";default:return"mdi:speaker"}case"tv":switch(n){case"playing":return"mdi:television-play";case"paused":return"mdi:television-pause";case"off":return"mdi:television-off";default:return"mdi:television"}default:switch(n){case"playing":case"paused":return"mdi:cast-connected";case"off":return"mdi:cast-off";default:return"mdi:cast"}}case"switch":switch(t?.attributes.device_class){case"outlet":return"on"===n?"mdi:power-plug":"mdi:power-plug-off";case"switch":return"on"===n?"mdi:toggle-switch":"mdi:toggle-switch-off";default:return"mdi:flash"}case"zwave":switch(n){case"dead":return"mdi:emoticon-dead";case"sleeping":return"mdi:sleep";case"initializing":return"mdi:timer-sand";default:return"mdi:z-wave"}case"sensor":{const e=Eb(t);if(e)return e;break}case"input_datetime":if(!t?.attributes.has_date)return"mdi:clock";if(!t.attributes.has_time)return"mdi:calendar";break;case"sun":return"above_horizon"===t?.state?Ab[e]:"mdi:weather-night";case"update":return"on"===t?.state?yb(t)?"mdi:package-down":"mdi:package-up":"mdi:package"}return e in Ab?Ab[e]:a??$b}async function Ib(e,t,n){const a={type:"auth/sign_path",path:t,expires:n},i=await $v(e,Os,a);return i?e.hassUrl(i.path):null}function Tb(e,t,n,a){if(!e||!n||!n.length)return[];const i=[];for(const r of n){const n=t?.states[r],o=e.states[r];if((a?.stateOnly&&n?.state!==o?.state||!a?.stateOnly&&n!==o)&&(i.push({entityID:r,oldState:n,newState:o}),a?.firstOnly))break}return i}function jb(e,t,n,a){return!!Tb(e,t,n,{...a,firstOnly:!0}).length}function Ob(e){if("off"===e.state||!e.attributes.brightness)return"";return`brightness(${(e.attributes.brightness+245)/5}%)`}function Db(e){return"off"===e.state?"":e.attributes.rgb_color?`rgb(${e.attributes.rgb_color.join(",")})`:""}function Rb(e){return{color:Db(e),filter:Ob(e)}}function Pb(e,t){if(!t.entity)return t;const n=e.states[t.entity];n&&t.state_color&&(t.style={...Rb(n),...t.style}),t.title=t.title??(n?.attributes?.friendly_name||t.entity),t.icon=t.icon??Nb(e,t.entity);const a=n?function(e){return Ye(e.entity_id)}(n):void 0;return t.data_domain=t.state_color||"light"===a&&!1!==t.state_color?a:void 0,n&&(t.data_state=(e=>{const t=e.entity_id.split(".")[0];let n=e.state;return"climate"===t&&(n=e.attributes.hvac_action),n})(n)),t}function Lb(e,t){return t?e?.states[t]?.attributes?.friendly_name:void 0}function Nb(e,t,n){const a=e.states[t];return a&&a.attributes.icon?a.attributes.icon:zb(Ye(t),a,a?.state,n)}const Fb=async()=>{if(["ha-button-menu","ha-button","ha-camera-stream","ha-card","ha-circular-progress","ha-hls-player","ha-icon-button","ha-icon","ha-menu-button","ha-selector","ha-web-rtc-player"].every((e=>customElements.get(e))))return!0;const e=await window.loadCardHelpers();await e.createCardElement({type:"picture-glance",entities:[],camera_image:"dummy-to-load-editor-components"}),await customElements.whenDefined("hui-picture-glance-card");const t=customElements.get("hui-picture-glance-card");if(!t)return!1;const n=new t;return await n.constructor.getConfigElement(),!0},Vb=e=>!!e&&["on","open"].includes(e),Hb=(e,t)=>{if(!e)return[];const n=Object.keys(e.states).filter((e=>!t||e.substr(0,e.indexOf("."))===t));return n.sort(),n};function Bb(e){return!!e?.startsWith("/")}function qb(e,t){return Bb(t)?e.hassUrl(t):t??null}class Ub{constructor(){this._initialized=new Set}async initializeMultipleIfNecessary(e){return(await tf(Object.entries(e),(async([e,t])=>await this.initializeIfNecessary(e,t)))).every(Boolean)}async initializeIfNecessary(e,t){return!!this._initialized.has(e)||(t?!!await t()&&(this._initialized.add(e),!0):(this._initialized.add(e),!0))}uninitialize(e){this._initialized.delete(e)}isInitialized(e){return this._initialized.has(e)}isInitializedMultiple(e){return e.every((e=>this.isInitialized(e)))}}var Wb;!function(e){e.LANGUAGES="languages",e.SIDE_LOAD_ELEMENTS="side-load-elements",e.CAMERAS="cameras",e.MICROPHONE_CONNECT="microphone-connect",e.VIEW="view"}(Wb||(Wb={}));class Zb{constructor(e,t){this._initializationQueue=new w_({concurrency:1}),this._everInitialized=!1,this._api=e,this._initializer=t??new Ub}wasEverInitialized(){return this._everInitialized}isInitializedMandatory(){return!!this._api.getConfigManager().getConfig()&&this._initializer.isInitializedMultiple([Wb.LANGUAGES,Wb.SIDE_LOAD_ELEMENTS,Wb.CAMERAS,...this._api.getMicrophoneManager().shouldConnectOnInitialization()?[Wb.MICROPHONE_CONNECT]:[],Wb.VIEW])}async initializeMandatory(){await this._initializationQueue.add((()=>this._initializeMandatory()))}async _initializeMandatory(){const e=this._api.getHASSManager().getHASS();if(!e||this.isInitializedMandatory())return;if(!await this._initializer.initializeMultipleIfNecessary({[Wb.LANGUAGES]:async()=>await(async e=>{const t=F_(e);return"ca"===t?L_[t]=await import("./lang-ca-449daa4a.js"):"it"===t?L_[t]=await import("./lang-it-2a20a319.js"):"pt"===t?L_[t]=await import("./lang-pt-PT-c4863423.js"):"pt_BR"===t?L_[t]=await import("./lang-pt-BR-83a703b9.js"):"fr"===t&&(L_[t]=await import("./lang-fr-674e5de5.js")),t&&(N_=t),!0})(e),[Wb.SIDE_LOAD_ELEMENTS]:async()=>await Fb()}))return;this._api.getConfigManager().getConfig()&&await this._initializer.initializeMultipleIfNecessary({[Wb.CAMERAS]:async()=>await this._api.getCameraManager().initializeCamerasFromConfig(),...this._api.getMicrophoneManager().shouldConnectOnInitialization()&&{[Wb.MICROPHONE_CONNECT]:async()=>await this._api.getMicrophoneManager().connect()}})&&!this._api.getMessageManager().hasMessage()&&await this._initializer.initializeIfNecessary(Wb.VIEW,this._api.getViewManager().initialize)&&(this._everInitialized=!0,this._api.getCardElementManager().update())}uninitialize(e){this._initializer.uninitialize(e)}}class Qb{constructor(e,t,n,a){this.update=()=>{this._element.requestUpdate()},this._api=e,this._element=t,this._scrollCallback=n,this._menuToggleCallback=a}getElement(){return this._element}scrollReset(){this._scrollCallback()}toggleMenu(){this._menuToggleCallback()}hasUpdated(){return this._element.hasUpdated}elementConnected(){this._api.getInteractionManager().initialize(),this._api.getFullscreenManager().initialize(),this._api.getExpandManager().initialize(),this._api.getMediaLoadedInfoManager().initialize(),this._api.getMicrophoneManager().initialize(),this._api.getKeyboardStateManager().initialize(),this._api.getDefaultManager().initialize(),this._api.getMediaPlayerManager().initialize(),this._api.getHASSManager().getStateWatcher()?.subscribe(this.update,[...this._api.getConfigManager().getConfig()?.view.render_entities??[],...this._api.getMediaPlayerManager().getMediaPlayers()??[]]),of(this._element,(e=>{const t=e.getRootNode();return!!(t&&t instanceof ShadowRoot&&"HUI-PANEL-VIEW"===t.host.tagName)})(this._element),"panel"),of(this._element,!0,"tabindex","0"),this._api.getFullscreenManager().connect(),this._element.addEventListener("mousemove",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("wheel",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("ll-custom",this._api.getActionsManager().handleCustomActionEvent),this._element.addEventListener("action",this._api.getActionsManager().handleInteractionEvent),this._element.addEventListener("action",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("frigate-card:action:execution-request",this._api.getActionsManager().handleActionExecutionRequestEvent),window.addEventListener("location-changed",this._api.getQueryStringManager().requestExecution),window.addEventListener("popstate",this._api.getQueryStringManager().requestExecution),this._api.getQueryStringManager().requestExecution(),this._element.requestUpdate()}elementDisconnected(){of(this._element,!1,"panel"),of(this._element,!1,"tabindex"),this._api.getMediaLoadedInfoManager().clear(),this._api.getFullscreenManager().disconnect(),this._api.getKeyboardStateManager().uninitialize(),this._api.getActionsManager().uninitialize(),this._api.getDefaultManager().uninitialize(),this._api.getHASSManager().getStateWatcher()?.unsubscribe(this.update),this._api.getInitializationManager().uninitialize(Wb.CAMERAS),this._api.getCameraManager().reset(),this._element.removeEventListener("mousemove",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("wheel",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("ll-custom",this._api.getActionsManager().handleCustomActionEvent),this._element.removeEventListener("action",this._api.getActionsManager().handleInteractionEvent),this._element.removeEventListener("action",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("frigate-card:action:execution-request",this._api.getActionsManager().handleActionExecutionRequestEvent),window.removeEventListener("location-changed",this._api.getQueryStringManager().requestExecution),window.removeEventListener("popstate",this._api.getQueryStringManager().requestExecution)}}function Gb(e,t,n){return null==e?e:function(e,t,n,a){if(!hh(e))return e;for(var i=-1,r=(t=sv(t,e)).length,o=r-1,s=e;null!=s&&++i{Gb(e,t,n)},Xb=(e,t,n)=>fv(e,t,n),Jb=(e,t)=>{!function(e,t){null==e||Yb(e,t)}(e,t)},ew=e=>u_(e),tw=(e,t)=>e.replace("#",`[${t.toString()}]`),nw=function(e){let t=!1;for(let n=0;n{const i=Xb(e,t);if(void 0===i)return!1;const r=a?.transform?a.transform(i):i;return!(t===n&&Dv(i,r)||(null===r?a?.keepOriginal||(Jb(e,t),0):void 0===r||(a?.keepOriginal||Jb(e,t),Kb(e,n,r),0)))})(a,e,t,n)}},rw=function(e,t,n){return function(a){let i=iw(e,t,n)(a);return i=cw(bs,iw(e,t,n),(e=>e.overrides))(a)||i,i}},ow=function(e,t){return rw(e,e,{transform:t})},sw=function(e){return rw(e,e,{transform:e=>null})},cw=function(e,t,n){return function(a){let i=!1;const r=Xb(a,e);return Array.isArray(r)&&r.forEach((e=>{const a=n?n(e):e;a&&"object"==typeof a&&(i=t(a)||i)})),i}},lw=(e,t)=>{const n=a=>{let i=!1;if(a&&"object"==typeof a){const r=t?t(a):a;r&&(i=e(r)||i),Array.isArray(a)?a.forEach((e=>{i=n(e)||i})):Object.keys(a).forEach((e=>{i=n(a[e])||i}))}return i};return n},dw=e=>!("object"!=typeof e||!e||void 0===e.mediaLoaded)&&(e.media_loaded=e.mediaLoaded,delete e.mediaLoaded,!0),uw=e=>{if("object"!=typeof e||!e||"object"!=typeof e.conditions||!e.conditions)return!1;const t=e.conditions,n=[];if(void 0!==t.view&&n.push({condition:"view",views:t.view}),void 0!==t.fullscreen&&n.push({condition:"fullscreen",fullscreen:t.fullscreen}),void 0!==t.expand&&n.push({condition:"expand",expand:t.expand}),void 0!==t.camera&&n.push({condition:"camera",cameras:t.camera}),void 0!==t.media_loaded&&n.push({condition:"media_loaded",media_loaded:t.media_loaded}),void 0!==t.state&&Array.isArray(t.state))for(const e of t.state)"object"!=typeof e||!e||void 0===e.state&&void 0===e.state_not&&void 0===e.entity||n.push({condition:"state",...e.state&&{state:e.state},...e.state_not&&{state_not:e.state_not},...e.entity&&{entity:e.entity}});return void 0!==t.media_query&&n.push({condition:"screen",media_query:t.media_query}),!!n.length&&(e.conditions=n,!0)},hw=e=>!("object"!=typeof e||!e||"call-service"!==e.action||"string"!=typeof e.service)&&(e.action="perform-action",e.perform_action=e.service,delete e.service,!0),pw=e=>!("object"!=typeof e||!e||"call-service"!==e.action||void 0===e.service||void 0===e.service_data||void 0!==e.data)&&(e.data=e.service_data,delete e.service_data,!0),mw=e=>!("object"!=typeof e||!e||"custom:frigate-card-action"!==e.action||"frigate_ui"!==e.frigate_card_action)&&(e.frigate_card_action="camera_ui",!0),gw=[cw(bs,dw,(e=>e.conditions)),e=>lw(dw,(e=>e.conditions))("object"==typeof e&&e?e[Ii]:{}),rw("event_gallery",or),rw("menu.buttons.frigate_ui",is),e=>lw(mw)("object"==typeof e&&e?e:{}),cw(Ca,ow("live_provider",(e=>"frigate-jsmpeg"===e?"jsmpeg":e))),rw("live.jsmpeg",ki),rw("live.image",Ci),rw("live.webrtc_card",Si),cw(Ca,rw("frigate.zone","frigate.zones",{transform:e=>Wg(e)})),cw(Ca,rw("frigate.label","frigate.labels",{transform:e=>Wg(e)})),e=>lw(pw)("object"==typeof e&&e?e:{}),function(e){if("object"!=typeof e||!e||!(Ii in e)||!Array.isArray(e[Ii]))return!1;let t=!1;const n=n=>{if(!t){if(!fv(e,"live.controls.ptz")){const{type:t,...a}=n;Gb(e,"live.controls.ptz",a)}t=!0}},a=e=>{const t=[];for(const i of e)if("custom:frigate-card-ptz"===i.type)n(i);else if("conditional"!==i.type&&"custom:frigate-card-conditional"!==i.type||!Array.isArray(i.elements))t.push(i);else{const e=a(i.elements);e.length&&(i.elements=e,t.push(i))}return t},i=a(e[Ii]);return t&&(i.length?e[Ii]=i:delete e[Ii]),t},rw("view.timeout_seconds",Ri),ow("live.lazy_unload",(e=>"all"===e?["unselected","hidden"]:"never"===e?null:Wg(e))),ow("live.auto_play",(e=>"all"===e?null:"never"===e?[]:Wg(e))),ow("live.auto_pause",(e=>"all"===e?["unselected","hidden"]:"never"===e?null:Wg(e))),ow("live.auto_mute",(e=>"all"===e?null:"never"===e?[]:Wg(e))),ow("live.auto_unmute",(e=>"all"===e?["selected","visible","microphone"]:"never"===e?null:Wg(e))),ow("media_viewer.auto_play",(e=>"all"===e?null:"never"===e?[]:Wg(e))),ow("media_viewer.auto_pause",(e=>"all"===e?null:"never"===e?[]:Wg(e))),ow("media_viewer.auto_mute",(e=>"all"===e?null:"never"===e?[]:Wg(e))),ow("media_viewer.auto_unmute",(e=>"all"===e?["selected","visible"]:"never"===e?null:Wg(e))),rw("live.controls.thumbnails.media",io),rw("timeline.media",Ho),rw("live.controls.timeline.media",po),rw("media_viewer.controls.timeline.media",Rr),rw("view.scan",Xi),rw("view.triggers.enabled",ar,{transform:e=>!0===e?"live":null,keepOriginal:!0}),rw("view.triggers.enabled",er,{transform:e=>!0!==e&&null}),rw("view.triggers.untrigger_reset",ir,{transform:e=>e?"default":null}),rw("live.layout",Ai),sw("media_viewer.layout"),sw("image.layout"),cw(bs,uw),e=>lw(uw)("object"==typeof e&&e?e[Ii]:{}),e=>lw(uw)("object"==typeof e&&e?e.automations:{}),cw(Ca,rw("hide","capabilities",{transform:e=>!0===e?{disable_except:["substream"]}:null})),rw("performance.profile",$s,{transform:e=>"low"===e?["low-performance"]:null}),cw(bs,iw("overrides","merge")),rw("live.controls.ptz",zi,{transform:e=>{if("object"!=typeof e||!e)return;const t=["data_left","data_right","data_up","data_down","data_zoom_in","data_zoom_out","service"],n=["actions_left","actions_right","actions_up","actions_down","actions_zoom_in","actions_zoom_out"],a=[...t,...n,"data_home","actions_home"];if(!Object.keys(e).some((e=>a.includes(e))))return;const i={};t.filter((t=>t in e)).reduce(((t,n)=>(t[n]=e[n],t)),i),n.filter((t=>t in e)).reduce(((t,n)=>("object"==typeof e[n]&&"tap_action"in e[n]&&(t[n]=e[n].tap_action),t)),i);const r=()=>{i.presets="presets"in e&&"object"==typeof e.presets&&e.presets?e.presets:{}};return"actions_home"in e&&"object"==typeof e.actions_home&&e.actions_home&&"tap_action"in e.actions_home?(r(),i.presets.home=e.actions_home.tap_action):"data_home"in e&&"object"==typeof e.data_home&&e.data_home&&"string"==typeof e.service&&(r(),i.presets.service=e.service,i.presets.data_home=e.data_home),i},keepOriginal:!0}),ow("live.controls.ptz",(e=>{if("object"!=typeof e||!e)return e;const t=["mode","position","orientation","hide_pan_tilt","hide_zoom","hide_home","style"],n=Object.keys(e);return n.some((e=>!t.includes(e)))?n.filter((e=>t.includes(e))).reduce(((t,n)=>(t[n]=e[n],t)),{}):void 0})),rw("view.update_cycle_camera",Wi),rw("view.update_force",Qi,{transform:e=>!0===e?"all":null}),rw("view.update_seconds",Gi),rw("view.update_entities",Yi),iw("live.controls.title",ds,{transform:e=>"object"==typeof e&&e&&"string"==typeof e.mode?"none"===e.mode?{style:"none"}:e.mode.includes("bottom")?{position:"bottom"}:e.mode.includes("top")?{position:"top"}:null:null}),sw("live.controls.title"),sw("media_viewer.controls.title"),e=>lw(hw)("object"==typeof e&&e?e:{}),rw("dimensions.max_height",ys),sw("dimensions.min_height")];class fw extends zs{}class _w extends Event{constructor(e,t){super("frigate-card:conditions:evaluate",t),this.conditions=e}}function vw(e,t,n){let a=ew(t),i=!1;if(n?.configOverrides)for(const t of n.configOverrides)e.evaluateConditions(t.conditions,n?.stateOverrides)&&(t.delete?.forEach((e=>{Jb(a,e)})),Object.keys(t.set??{}).forEach((e=>{Kb(a,e,t.set?.[e])})),Object.keys(t.merge??{}).forEach((e=>{Kb(a,e,Ly({},Xb(a,e),t.merge?.[e]))})),i=!0);if(!i)return t;if(n?.configOverrides?.some((e=>e.delete?.length))&&(a=hf(a)),n?.schema){const e=n.schema.safeParse(a);if(!e.success)throw new fw(V_("error.invalid_configuration_override"),[e.error.errors,a]);return e.data}return a}class yw{constructor(e,t){this._state={},this._epoch=this._createEpoch(),this._hasHAStateConditions=!1,this._mediaQueries=[],this._mediaQueryTrigger=()=>this._triggerChange(),this._api=e,this._listeners=[()=>this._api.getConfigManager().computeOverrideConfig(),()=>this._api.getAutomationsManager().execute(),...t?[t]:[]]}removeConditions(){this._mediaQueries.forEach((e=>e.removeEventListener("change",this._mediaQueryTrigger))),this._mediaQueries=[]}setConditionsFromConfig(){this.removeConditions();const e=(()=>{const e=this._api.getConfigManager().getConfig(),t=[];e?.overrides?.forEach((e=>t.push(...e.conditions))),e?.automations?.forEach((e=>t.push(...e.conditions)));const n=e=>{const a=vl.safeParse(e);a.success?(t.push(...a.data.conditions),a.data.elements?.forEach(n)):e&&"object"==typeof e&&Object.keys(e).forEach((t=>n(e[t])))};return e?.elements?.forEach(n),t})();this._hasHAStateConditions=e.some((e=>!e.condition||["state","numeric_state","user"].includes(e.condition))),e.forEach((e=>{if("screen"===e.condition){const t=window.matchMedia(e.media_query);t.addEventListener("change",this._mediaQueryTrigger),this._mediaQueries.push(t)}}))}setState(e){Object.keys(e).every((t=>Dv(e[t],this._state[t])))||(this._state={...this._state,...e},this._triggerChange())}getState(){return this._state}hasHAStateConditions(){return this._hasHAStateConditions}getEpoch(){return this._epoch}evaluateConditions(e,t){return e.every((e=>this._evaluateCondition(e,t)))}_evaluateCondition(e,t){const n={...this._state,...t};switch(e.condition){case void 0:case"state":return!!n.state&&(!e.state&&!e.state_not||e.entity in n.state&&(!e.state||(Array.isArray(e.state)?e.state.includes(n.state[e.entity].state):e.state===n.state[e.entity].state))&&(!e.state_not||(Array.isArray(e.state_not)?!e.state_not.includes(n.state[e.entity].state):e.state_not!==n.state[e.entity].state)));case"view":return!!n?.view&&e.views.includes(n.view);case"fullscreen":return void 0!==n.fullscreen&&e.fullscreen===n.fullscreen;case"expand":return void 0!==n.expand&&e.expand===n.expand;case"camera":return!!n.camera&&e.cameras.includes(n.camera);case"numeric_state":return!!n.state&&e.entity in n.state&&void 0!==n.state[e.entity].state&&(void 0===e.above||Number(n.state[e.entity].state)>e.above)&&(void 0===e.below||Number(n.state[e.entity].state)n.triggered?.has(e)));case"interaction":return void 0!==n.interaction&&e.interaction===n.interaction;case"microphone":return!(void 0!==e.connected&&n.microphone?.connected!==e.connected||void 0!==e.muted&&n.microphone?.muted!==e.muted);case"key":return!(!n.keys||!(e.key in n.keys)||(e.state??"down")!==n.keys[e.key].state||void 0!==e.ctrl&&e.ctrl!==!!n.keys[e.key].ctrl||void 0!==e.alt&&e.alt!==!!n.keys[e.key].alt||void 0!==e.meta&&e.meta!==!!n.keys[e.key].meta||void 0!==e.shift&&e.shift!==!!n.keys[e.key].shift)}}_createEpoch(){return{manager:this}}_triggerChange(){this._epoch=this._createEpoch(),this._listeners.forEach((e=>e()))}}const bw={casting:{[Qr]:!1,[Sr]:!1,[es]:"none",[`${os}.enabled`]:!0,[`${ss}.enabled`]:!0,[`${rs}.enabled`]:!1,[`${cs}.enabled`]:!1,[Zr]:["selected","visible"],[vs]:"static",[_s]:"16:9",[$i]:1,[$o]:!0},"low-performance":{[ro]:"none",[Ar]:"none",[Uo]:"none",[fo]:!1,[Nr]:!1,[Bo]:!1,[Wr]:[],[mr]:[],[gr]:[],[fr]:[],[ko]:["unselected","hidden"],[Co]:!1,[xr]:!1,[Eo]:"none",[kr]:"none",[$o]:!1,[Er]:"chevrons",[hs]:"none",[es]:"outside",[`${as}.enabled`]:!1,[`${ls}.enabled`]:!1,[`${ls}.enabled`]:!1,[`${cs}.enabled`]:!1,[lr]:!1,[dr]:!1,[ur]:!1,[cr]:!1,[co]:!1,[lo]:!1,[uo]:!1,[so]:!1,[Ir]:!1,[Tr]:!1,[jr]:!1,[zr]:!1,[Qo]:!1,[Go]:!1,[Yo]:!1,[Zo]:!1,[xs]:!1,[Cs]:10,[Es]:!1,[Ss]:!1,[Mr]:!1,[Ei]:!1,[Mi]:"image",[$i]:10,[ar]:"none",[Ms]:1},scrubbing:{[mo]:"below",[_o]:"ribbon",[go]:"seek",[Pr]:"below",[Fr]:"ribbon",[Lr]:"seek"}},ww=(e,t,n)=>{const a=Ds(Nd).safeParse(e);if(!a.success)return t;const i=a.data;for(const e of n??[])e in bw&&Object.entries(bw[e]).forEach((([e,n])=>{return r=n,void(void 0===Xb(i,a=e)&&Kb(t,a,r));var a,r}));return t},xw=e=>{switch(e){case"ptz_left":return"left";case"ptz_right":return"right";case"ptz_up":return"up";case"ptz_down":return"down";case"ptz_zoom_in":return"zoom_in";case"ptz_zoom_out":return"zoom_out"} +/* istanbul ignore next: No (current) way to reach this code -- @preserve */return null},Cw=(e,t)=>{if(!t.enabled)return[];const n=[];for(const a of["ptz_down","ptz_left","ptz_right","ptz_up","ptz_zoom_in","ptz_zoom_out"]){const i=t[a],r=xw(a);i&&r&&(n.push({conditions:[{condition:"key",key:i.key,state:"down",shift:i.shift,ctrl:i.ctrl,alt:i.alt,meta:i.meta}],actions:[vf({ptzAction:r,ptzPhase:"start"})],tag:e}),n.push({conditions:[{condition:"key",key:i.key,state:"up"}],actions:[vf({ptzAction:r,ptzPhase:"stop"})],tag:e}))}const a=t.ptz_home;return a&&n.push({conditions:[{condition:"key",key:a.key,state:"down",shift:a.shift,ctrl:a.ctrl,alt:a.alt,meta:a.meta}],actions:[vf()],tag:e}),n};class Mw{constructor(e){this._config=null,this._overriddenConfig=null,this._rawConfig=null,this._cardWideConfig=null,this._api=e}hasConfig(){return!!this.getConfig()}getConfig(){return this._overriddenConfig??this._config}getCardWideConfig(){return this._cardWideConfig}getNonOverriddenConfig(){return this._config}getRawConfig(){return this._rawConfig}setConfig(e){if(!e)throw new Error(V_("error.invalid_configuration"));const t=Nd.safeParse(e);if(!t.success){const n=aw(e),a=Ps(t.error);let i="";throw n&&(i=`${V_("error.upgrade_available")}. `),new Error(i+`${V_("error.invalid_configuration")}: `+(a&&a.size?JSON.stringify([...a],null," "):V_("error.invalid_configuration_no_hint")))}const n=ww(e,t.data,t.data.profiles);var a;(this._rawConfig=e,Dv(this._config,n))||(this._config=n,this._cardWideConfig={performance:n.performance,debug:n.debug},this._api.getConditionsManager().setConditionsFromConfig(),this._api.getConditionsManager().setState({view:void 0,displayMode:void 0,camera:void 0}),this._api.getMediaLoadedInfoManager().clear(),this._api.getInitializationManager().uninitialize(Wb.VIEW),this._api.getViewManager().reset(),this._api.getMessageManager().reset(),this._api.getStyleManager().setPerformance(),this._api.getStatusBarItemManager().removeAllDynamicStatusBarItems(),((e,t)=>{e.getAutomationsManager().deleteAutomations(t);const n=e.getConfigManager().getConfig()?.view.keyboard_shortcuts;if(!n)return;const a=Cw(t,n);a.length&&e.getAutomationsManager().addAutomations(a)})(this._api,this),(a=this._api).getAutomationsManager().deleteAutomations(),a.getAutomationsManager().addAutomations(a.getConfigManager().getNonOverriddenConfig()?.automations??[]),this.computeOverrideConfig(),this._api.getCardElementManager().update())}computeOverrideConfig(){const e=this._api.getConditionsManager();if(!this._config)return;let t=null;try{t=vw(e,this._config,{configOverrides:this._config.overrides,schema:Nd})}catch(e){return void this._api.getMessageManager().setErrorIfHigherPriority(e)}if(Dv(t,this._overriddenConfig))return;const n=this._overriddenConfig;this._overriddenConfig=t,this._api.getStyleManager().setMinMaxHeight(),!n||Dv(n?.cameras,this._overriddenConfig?.cameras)&&Dv(n?.cameras_global,this._overriddenConfig?.cameras_global)||this._api.getInitializationManager().uninitialize(Wb.CAMERAS),n&&n?.live.microphone.always_connected!==this._overriddenConfig?.live.microphone.always_connected&&this._api.getInitializationManager().uninitialize(Wb.MICROPHONE_CONNECT),this._initializeBackground(n)}async _initializeBackground(e){await this._api.getDefaultManager().initializeIfNecessary(e),await this._api.getMediaPlayerManager().initializeIfNecessary(e),this._api.getCardElementManager().update()}}class kw{constructor(e){this._timer=new xf,this._stateChangeHandler=()=>{this._setToDefaultIfAllowed()},this._api=e}async initializeIfNecessary(e){Dv(e?.view.default_reset,this._api.getConfigManager().getConfig()?.view.default_reset)||await this.initialize()}async initialize(){this.uninitialize();const e=this._api.getConfigManager().getConfig()?.view.default_reset;e?.entities.length&&this._api.getHASSManager().getStateWatcher().subscribe(this._stateChangeHandler,e.entities);const t=this._api.getConfigManager().getConfig()?.view.default_reset.every_seconds;return t&&this._timer.startRepeated(t,(()=>this._setToDefaultIfAllowed())),this._api.getConfigManager().getConfig()?.view.default_reset.after_interaction&&this._api.getAutomationsManager().addAutomations([{actions:[gf("default")],conditions:[{condition:"interaction",interaction:!1}],tag:this}]),!0}uninitialize(){this._timer.stop(),this._api.getHASSManager().getStateWatcher().unsubscribe(this._stateChangeHandler),this._api.getAutomationsManager().deleteAutomations(this)}_setToDefaultIfAllowed(){this._isAutomatedUpdateAllowed()&&this._api.getViewManager().setViewDefault()}_isAutomatedUpdateAllowed(){const e=this._api.getConfigManager().getConfig()?.view.default_reset.interaction_mode;return!!e&&((e,t)=>{switch(e){case"all":return!0;case"active":return t;case"inactive":return!t}})(e,this._api.getInteractionManager().hasInteraction())}}const Sw=(e,t="download")=>{const n=new URL(e).origin===window.location.origin,a=e.startsWith("data:");if(navigator.userAgent.startsWith("Home Assistant/")||navigator.userAgent.startsWith("HomeAssistant/")||!n&&!a)window.open(e,"_blank");else{const n=document.createElement("a");n.setAttribute("download",t),n.href=e,n.click(),n.remove()}},Ew=async(e,t,n)=>{const a=await t.getMediaDownloadPath(n);if(!a)throw new zs(V_("error.download_no_media"));let i=a.endpoint;if(a.sign){let t;try{t=await Ib(e,a.endpoint)}catch(e){Gg(e)}if(!t)throw new zs(V_("error.download_sign_failed"));i=t}Sw(i)},$w=e=>{const t=document.createElement("canvas");t.width=e.videoWidth,t.height=e.videoHeight;const n=t.getContext("2d");return n?(n.drawImage(e,0,0,t.width,t.height),t.toDataURL("image/jpeg")):null};class Aw{constructor(e){this._api=e}async downloadViewerMedia(){const e=this._api.getViewManager().getView()?.queryResults?.getSelectedResult(),t=this._api.getHASSManager().getHASS();if(!e||!t)return!1;try{await Ew(t,this._api.getCameraManager(),e)}catch(e){return this._api.getMessageManager().setErrorIfHigherPriority(e),!1}return!0}async downloadScreenshot(){const e=await(this._api.getMediaLoadedInfoManager().get()?.player?.getScreenshotURL());e&&Sw(e,(e=>{if(e?.is("live")||e?.is("image"))return`${e.view}-${e.camera}-${Wu(new Date,"yyyy-MM-dd-HH-mm-ss")}.jpg`;if(e?.isViewerView()){const t=e.queryResults?.getSelectedResult(),n=t?.getID()??null;return`${e.view}-${e.camera}${n?`-${n}`:""}.jpg`}return"screenshot.jpg"})(this._api.getViewManager().getView()))}}class zw{constructor(e){this._expanded=!1,this._api=e}initialize(){this._setConditionState()}isExpanded(){return this._expanded}toggleExpanded(){this.setExpanded(!this._expanded)}setExpanded(e){e&&this._api.getFullscreenManager().isInFullscreen()&&this._api.getFullscreenManager().stopFullscreen(),this._expanded=e,this._setConditionState(),this._api.getCardElementManager().update()}_setConditionState(){this._api.getConditionsManager()?.setState({expand:this._expanded})}}const Iw=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],Tw=(()=>{if("undefined"==typeof document)return!1;const e=Iw[0],t={};for(const n of Iw){const a=n?.[1];if(a in document){for(const[a,i]of n.entries())t[e[a]]=i;return t}}return!1})(),jw={change:Tw.fullscreenchange,error:Tw.fullscreenerror};let Ow={request:(e=document.documentElement,t)=>new Promise(((n,a)=>{const i=()=>{Ow.off("change",i),n()};Ow.on("change",i);const r=e[Tw.requestFullscreen](t);r instanceof Promise&&r.then(i).catch(a)})),exit:()=>new Promise(((e,t)=>{if(!Ow.isFullscreen)return void e();const n=()=>{Ow.off("change",n),e()};Ow.on("change",n);const a=document[Tw.exitFullscreen]();a instanceof Promise&&a.then(n).catch(t)})),toggle:(e,t)=>Ow.isFullscreen?Ow.exit():Ow.request(e,t),onchange(e){Ow.on("change",e)},onerror(e){Ow.on("error",e)},on(e,t){const n=jw[e];n&&document.addEventListener(n,t,!1)},off(e,t){const n=jw[e];n&&document.removeEventListener(n,t,!1)},raw:Tw};Object.defineProperties(Ow,{isFullscreen:{get:()=>Boolean(document[Tw.fullscreenElement])},element:{enumerable:!0,get:()=>document[Tw.fullscreenElement]??void 0},isEnabled:{enumerable:!0,get:()=>Boolean(document[Tw.fullscreenEnabled])}}),Tw||(Ow={isEnabled:!1});var Dw=Ow;class Rw{constructor(e){this._fullscreenHandler=()=>{this._api.getExpandManager().setExpanded(!1),this._setConditionState(),this._api.getCardElementManager().update()},this._api=e}initialize(){this._setConditionState()}connect(){Dw.isEnabled&&Dw.on("change",this._fullscreenHandler)}disconnect(){Dw.isEnabled&&Dw.off("change",this._fullscreenHandler)}isInFullscreen(){return Dw.isEnabled&&Dw.isFullscreen}toggleFullscreen(){Dw.toggle(this._api.getCardElementManager().getElement())}stopFullscreen(){Dw.exit()}_setConditionState(){this._api.getConditionsManager()?.setState({fullscreen:this.isInFullscreen()})}}class Pw{constructor(){this._watcherCallbacks=new Map}setHASS(e,t){if(e)for(const[n,a]of this._watcherCallbacks.entries()){const i=Tb(t,e,a,{stateOnly:!0,firstOnly:!0});i.length&&n(i[0])}}subscribe(e,t){return!!t.length&&(this._watcherCallbacks.has(e)?this._watcherCallbacks.get(e)?.push(...t):this._watcherCallbacks.set(e,t),!0)}unsubscribe(e){this._watcherCallbacks.delete(e)}}class Lw{constructor(e){this._hass=null,this._stateWatcher=new Pw,this._api=e}getHASS(){return this._hass}hasHASS(){return!!this._hass}getStateWatcher(){return this._stateWatcher}setHASS(e){if(((e,t)=>e?.connected!==t?.connected)(this._hass,e)&&(e?.connected?this._api.getMessageManager().resetType("connection"):this._api.getMessageManager().setMessageIfHigherPriority({message:V_("error.reconnecting"),icon:"mdi:lan-disconnect",type:"connection",dotdotdot:!0})),!e)return;const t=this._hass;this._hass=e,this._api.getConditionsManager().hasHAStateConditions()&&this._api.getConditionsManager().setState({state:this._hass.states,user:this._hass.user}),this._api.getStyleManager().setLightOrDarkMode(),this._stateWatcher.setHASS(t,e)}}var Nw=function(){return th.Date.now()},Fw="Expected a function",Vw=Math.max,Hw=Math.min;function Bw(e,t,n){var a,i,r,o,s,c,l=0,d=!1,u=!1,h=!0;if("function"!=typeof e)throw new TypeError(Fw);function p(t){var n=a,r=i;return a=i=void 0,l=t,o=e.apply(r,n)}function m(e){var n=e-c;return void 0===c||n>=t||n<0||u&&e-l>=r}function g(){var e=Nw();if(m(e))return f(e);s=setTimeout(g,function(e){var n=t-(e-c);return u?Hw(n,r-(e-l)):n}(e))}function f(e){return s=void 0,h&&a?p(e):(a=i=void 0,o)}function _(){var e=Nw(),n=m(e);if(a=arguments,i=this,c=e,n){if(void 0===s)return function(e){return l=e,s=setTimeout(g,t),d?p(e):o}(c);if(u)return clearTimeout(s),s=setTimeout(g,t),p(c)}return void 0===s&&(s=setTimeout(g,t)),o}return t=Cg(t)||0,hh(n)&&(d=!!n.leading,r=(u="maxWait"in n)?Vw(Cg(n.maxWait)||0,t):r,h="trailing"in n?!!n.trailing:h),_.cancel=function(){void 0!==s&&clearTimeout(s),l=0,a=c=i=s=void 0},_.flush=function(){return void 0===s?o:f(Nw())},_}function qw(e,t,n){var a=!0,i=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return hh(n)&&(a="leading"in n?!!n.leading:a,i="trailing"in n?!!n.trailing:i),Bw(e,t,{leading:a,maxWait:t,trailing:i})}class Uw{constructor(e){this._timer=new xf,this.reportInteraction=qw((()=>{this._reportInteraction()}),1e3),this._api=e}initialize(){this._api.getConditionsManager().setState({interaction:!1})}hasInteraction(){return this._timer.isRunning()}_reportInteraction(){this._timer.stop();const e=this._api.getConfigManager().getConfig()?.view.interaction_seconds;e&&(this._api.getConditionsManager().setState({interaction:!0}),this._timer.start(e,(()=>{this._api.getConditionsManager().setState({interaction:!1}),this._api.getStyleManager().setLightOrDarkMode()})))}}class Ww{constructor(e){this._state={},this._handleKeydown=e=>{const t={state:"down",ctrl:e.ctrlKey,alt:e.altKey,meta:e.metaKey,shift:e.shiftKey};Dv(this._state[e.key],t)||(this._state[e.key]=t,this._processStateChange())},this._handleKeyup=e=>{e.key in this._state&&"down"===this._state[e.key].state&&(this._state[e.key].state="up",this._processStateChange())},this._handleBlur=()=>{Object.keys(this._state).length&&(this._state={},this._processStateChange())},this._api=e}initialize(){const e=this._api.getCardElementManager().getElement();e.addEventListener("keydown",this._handleKeydown),e.addEventListener("keyup",this._handleKeyup),e.addEventListener("blur",this._handleBlur)}uninitialize(){const e=this._api.getCardElementManager().getElement();e.removeEventListener("keydown",this._handleKeydown),e.removeEventListener("keyup",this._handleKeyup),e.removeEventListener("blur",this._handleBlur)}_processStateChange(){this._api.getConditionsManager().setState({keys:this._state})}}function Zw(e,t){let n;return n=e instanceof Event?e.composedPath()[0]:e,n instanceof HTMLImageElement?{width:n.naturalWidth,height:n.naturalHeight,...t}:n instanceof HTMLVideoElement?{width:n.videoWidth,height:n.videoHeight,...t}:n instanceof HTMLCanvasElement?{width:n.width,height:n.height,player:t?.player,...t}:null}function Qw(e,t,n){const a=Zw(t,n);a&&Gw(e,a)}function Gw(e,t){Bg(e,"media:loaded",t)}function Yw(e){Bg(e,"media:unloaded")}function Kw(e){Bg(e,"media:volumechange")}function Xw(e){Bg(e,"media:play")}function Jw(e){Bg(e,"media:pause")}class ex{constructor(e){this._current=null,this._lastKnown=null,this._api=e}initialize(){this.clear()}set(e){var t;(t=e).height>=50&&t.width>=50&&(B_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card media load: ",e),this._current=e,this._lastKnown=e,this._api.getConditionsManager().setState({media_loaded:!0}),this._api.getStyleManager().setExpandedMode(),this._api.getCardElementManager().update())}get(){return this._current}getLastKnown(){return this._lastKnown}clear(){this._current=null,this._api.getConditionsManager().setState({media_loaded:!1})}has(){return!!this._current}}class tx{static isEvent(e){return this.isClip(e)||this.isSnapshot(e)}static isRecording(e){return"recording"===e.getMediaType()}static isClip(e){return"clip"===e.getMediaType()}static isSnapshot(e){return"snapshot"===e.getMediaType()}static isVideo(e){return this.isClip(e)||this.isRecording(e)}}class nx{constructor(e){this._mediaPlayers=[],this._api=e}getMediaPlayers(){return this._mediaPlayers}hasMediaPlayers(){return this._mediaPlayers.length>0}async initializeIfNecessary(e){e?.menu.buttons.media_player.enabled!==this._api.getConfigManager().getConfig()?.menu.buttons.media_player.enabled&&await this.initialize()}async initialize(){const e=this._api.getHASSManager().getHASS();if(!e||!this._api.getConfigManager().getConfig()?.menu.buttons.media_player.enabled)return!1;const t=Object.keys(e.states).filter((t=>{if(t.startsWith("media_player.")){const n=e.states[t];if(n&&"unavailable"!==n.state&&vb(n,131072))return!0}return!1}));let n=null;try{n=await this._api.getEntityRegistryManager().getEntities(e,t)}catch(e){Gg(e)}return this._mediaPlayers=t.filter((e=>{const t=n?.get(e);return!t||!t.hidden_by})),!0}async stop(e){const t=this._api.getHASSManager().getHASS(),n=t?.states[e];if(!n)return;let a;if(vb(n,4096))a="media_stop";else{if(!vb(n,256))return;a="turn_off"}await t.callService("media_player",a,{entity_id:e})}async playLive(e,t){const n=this._api.getCameraManager().getStore().getCameraConfig(t);n&&("dashboard"===n.cast?.method?await this._playLiveDashboard(e,n):await this._playLiveStandard(e,t,n))}async _playLiveStandard(e,t,n){const a=this._api.getHASSManager().getHASS(),i=n?.camera_entity??null;if(!a||!i)return;const r=this._api.getCameraManager().getCameraMetadata(t)?.title??null,o=a.states[i]?.attributes?.entity_picture??null;await a.callService("media_player","play_media",{entity_id:e,media_content_id:`media-source://camera/${i}`,media_content_type:"application/vnd.apple.mpegurl",extra:{...r&&{title:r},...o&&{thumb:o}}})}async _playLiveDashboard(e,t){const n=this._api.getHASSManager().getHASS();if(!n)return;const a=t.cast?.dashboard;a?.dashboard_path&&a?.view_path?await n.callService("cast","show_lovelace_view",{entity_id:e,dashboard_path:a.dashboard_path,view_path:a.view_path}):this._api.getMessageManager().setMessageIfHigherPriority({type:"error",icon:"mdi:cast",message:V_("error.no_dashboard_or_view")})}async playMedia(e,t){const n=this._api.getHASSManager().getHASS();if(!n||!t)return;const a=t.getTitle(),i=t.getThumbnail();await n.callService("media_player","play_media",{entity_id:e,media_content_id:t.getContentID(),media_content_type:tx.isVideo(t)?"video":"image",extra:{...a&&{title:a},...i&&{thumb:i}}})}}class ax{constructor(e){this._message=null,this._api=e}getMessage(){return this._message}hasMessage(){return!!this._message}hasErrorMessage(){return"error"===this._message?.type}reset(){const e=this.hasMessage();this._message=null,e&&this._api.getCardElementManager().update()}resetType(e){this._message?.type===e&&this.reset()}setErrorIfHigherPriority(e,t){e&&"object"==typeof e&&"message"in e&&(Gg(e),this.setMessageIfHigherPriority({message:t?`${t}: ${e.message}`:e.message,type:"error",...e instanceof zs&&{context:e.context}}))}setMessageIfHigherPriority(e){const t=this._message?Is[this._message.type]:0,n=Is[e.type];return!(this._message&&ne.stop())),this._stream=void 0,this._setConditionState(),this._api.getCardElementManager().update()}getStream(){return this._stream??void 0}mute(){const e=this.isMuted();this._mute=!0,this._setMute(),this._setConditionState(),e||this._callListeners("muted")}async unmute(){if(!this.isSupported())return;const e=!this.isMuted(),t=()=>{this._mute=!1,this._setMute()};this.isConnected()||this.isForbidden()?this.isConnected()&&t():(t(),await this.connect()),this._setConditionState(),e||this._callListeners("unmuted")}isConnected(){return!!this._stream}isForbidden(){return null===this._stream}isMuted(){return!this._stream||this._stream.getTracks().every((e=>!e.enabled))}addListener(e){this._listeners.push(e)}removeListener(e){this._listeners=this._listeners.filter((t=>t!==e))}_callListeners(e){this._listeners.forEach((t=>t(e)))}_setMute(){this._stream?.getTracks().forEach((e=>{e.enabled=!this._mute})),this._startTimer(),this._api.getCardElementManager().update()}_startTimer(){const e=this._api.getConfigManager().getConfig()?.live.microphone;if(e?.always_connected)return;const t=e?.disconnect_seconds??0;t&&this._timer.start(t,(()=>{this.disconnect()}))}_setConditionState(){this._api.getConditionsManager().setState({microphone:{muted:this.isMuted(),connected:this.isConnected()}})}}class rx{constructor(e){this._shouldRun=!0,this.requestExecution=()=>{this._shouldRun=!0,this._api.getCardElementManager().update()},this.executeIfNecessary=async()=>{this._shouldRun&&(this._shouldRun=!1,await this._executeViewRelated(this._calculateIntent()),await this._executeNonViewRelated(this._calculateIntent()))},this._isViewAction=e=>{switch(e.frigate_card_action){case"clip":case"clips":case"diagnostics":case"image":case"live":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":return!0}return!1},this._api=e}hasViewRelatedActionsToRun(){return!!this._calculateIntent().view&&this._shouldRun}async _executeViewRelated(e){e.view&&(e.view.default?await this._api.getViewManager().setViewDefaultWithNewQuery({params:{camera:e.view.camera},...e.view.substream&&{modifiers:[new sb(e.view.substream)]}}):await this._api.getViewManager().setViewByParametersWithNewQuery({params:{...e.view.view&&{view:e.view.view},...e.view.camera&&{camera:e.view.camera}},...e.view.substream&&{modifiers:[new sb(e.view.substream)]}}))}async _executeNonViewRelated(e){e.other&&await this._api.getActionsManager().executeActions(e.other)}_calculateIntent(){const e={};for(const t of this._getActions())this._isViewAction(t)?((e.view??={}).view=t.frigate_card_action,(e.view??={}).default=void 0):"default"===t.frigate_card_action?((e.view??={}).default=!0,(e.view??={}).view=void 0):"camera_select"===t.frigate_card_action?(e.view??={}).camera=t.camera:"live_substream_select"===t.frigate_card_action?(e.view??={}).substream=t.camera:(e.other??=[]).push(t);return e}_getActions(){const e=new URLSearchParams(window.location.search),t=[],n=new RegExp(/^frigate-card-action([.:](?\w+))?[.:](?\w+)/);for(const[a,i]of e.entries()){const e=a.match(n);if(!e||!e.groups)continue;const r=e.groups.cardID,o=e.groups.action;let s=null;switch(o){case"camera_select":case"live_substream_select":i&&(s=ff(o,i,{cardID:r}));break;case"camera_ui":case"clip":case"clips":case"default":case"diagnostics":case"download":case"expand":case"image":case"live":case"menu_toggle":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":s=gf(o,{cardID:r});break;default:console.warn(`Frigate card received unknown card action in query string: ${o}`)}s&&t.push(s)}return t}}class ox{constructor(e){this._items=[],this._dynamicItems=[],this._api=e}addDynamicStatusBarItem(e){this._dynamicItems.includes(e)||this._dynamicItems.push(e),this._api.getCardElementManager().update()}removeDynamicStatusBarItem(e){this._dynamicItems=this._dynamicItems.filter((t=>!Dv(t,e))),this._api.getCardElementManager().update()}removeAllDynamicStatusBarItems(){this._dynamicItems=[],this._api.getCardElementManager().update()}calculateItems(e){const t=e?.view?e?.cameraManager?.getCameraMetadata(e?.view?.camera):null,n=t?.engineLogo??null,a=e?.view?.is("live")?t?.title??null:e?.view?.isViewerView()?e?.view.queryResults?.getSelectedResult()?.getTitle()??null:null,i=e?.mediaLoadedInfo?this._calculateResolution(e?.mediaLoadedInfo):null,r=e?.mediaLoadedInfo?.technology?.length?e?.mediaLoadedInfo.technology[0]:null;return[...a?[{type:"custom:frigate-card-status-bar-string",string:a,expand:!0,sufficient:!0,...e?.statusConfig?.items.title}]:[],...i?[{type:"custom:frigate-card-status-bar-string",string:i,...e?.statusConfig?.items.resolution}]:[],...r&&"webrtc"===r?[{type:"custom:frigate-card-status-bar-icon",icon:"mdi:webrtc",...e?.statusConfig?.items.technology}]:r?[{type:"custom:frigate-card-status-bar-string",string:r.toUpperCase(),...e?.statusConfig?.items.technology}]:[],...n?[{type:"custom:frigate-card-status-bar-image",image:n,...e?.statusConfig?.items.engine}]:[],...this._dynamicItems]}_matchesWidthHeight(e,t,n){const a=.99*t,i=1.01*t,r=.99*n,o=1.01*n,s=(e,t,n)=>e>=t&&e<=n;return!!e&&(s(e.width,a,i)&&s(e.height,r,o)||s(e.height,a,i)&&s(e.width,r,o))}_calculateResolution(e){return this._matchesWidthHeight(e,1920,1080)?"1080p":this._matchesWidthHeight(e,1280,720)?"720p":this._matchesWidthHeight(e,640,480)?"VGA":this._matchesWidthHeight(e,3840,2160)?"4K":this._matchesWidthHeight(e,720,480)?"480p":this._matchesWidthHeight(e,720,576)?"576p":this._matchesWidthHeight(e,7680,4320)?"8K":`${e.width}x${e.height}`}}class sx{constructor(e){this.setLightOrDarkMode=()=>{const e=this._api.getConfigManager().getConfig(),t="on"===e?.view.dark_mode||"auto"===e?.view.dark_mode&&(!this._api.getInteractionManager().hasInteraction()||!!this._api.getHASSManager().getHASS()?.themes.darkMode);of(this._api.getCardElementManager().getElement(),t,"dark")},this._api=e}setExpandedMode(){const e=this._api.getCardElementManager().getElement(),t=this._api.getViewManager().getView(),n=this._api.getMediaLoadedInfoManager().getLastKnown();e.style.setProperty("--frigate-card-expand-aspect-ratio",t?.isAnyMediaView()&&n?`${n.width} / ${n.height}`:"unset");const a=t?.isGrid();e.style.setProperty("--frigate-card-expand-width",!a&&t?.isAnyMediaView()?"none":"var(--frigate-card-expand-max-width)"),e.style.setProperty("--frigate-card-expand-height",!a&&t?.isAnyMediaView()?"none":"var(--frigate-card-expand-max-height)")}setMinMaxHeight(){const e=this._api.getConfigManager().getConfig();if(e){this._api.getCardElementManager().getElement().style.setProperty("--frigate-card-height",e.dimensions.height)}}setPerformance(){const e={box_shadow:"none",border_radius:"0px"},t=this._api.getCardElementManager().getElement(),n=this._api.getConfigManager().getCardWideConfig()?.performance,a=n?.style??{};for(const n of Object.keys(a)){const i=`--frigate-card-css-${n.replaceAll("_","-")}`;!1===a[n]?t.style.setProperty(i,e[n]):t.style.removeProperty(i)}}_isAspectRatioEnforced(e,t){const n=e.dimensions.aspect_ratio_mode;return!(this._api.getFullscreenManager().isInFullscreen()||this._api.getExpandManager().isExpanded()||"unconstrained"===n||"dynamic"===n&&(!t||t?.isAnyMediaView()||t?.is("timeline")||t?.is("diagnostics")))}getAspectRatioStyle(){const e=this._api.getConfigManager().getConfig(),t=this._api.getViewManager().getView();if(e){if(!this._isAspectRatioEnforced(e,t))return uf();const n=e.dimensions.aspect_ratio_mode,a=this._api.getMediaLoadedInfoManager().getLastKnown();return uf(a&&"dynamic"===n?{ratio:[a.width,a.height]}:{ratio:e.dimensions.aspect_ratio})}return uf({defaultStatic:!0})}}class cx{constructor(e){this._triggeredCameras=new Map,this._triggeredCameraTimers=new Map,this._throttledTriggerAction=qw(this._triggerAction.bind(this),1e3,{trailing:!0}),this._api=e}getTriggeredCameraIDs(){return new Set(this._triggeredCameras.keys())}isTriggered(){return!!this._triggeredCameras.size}getMostRecentlyTriggeredCameraID(){const e=Ev([...this._triggeredCameras.entries()],(e=>e[1].getTime()),"desc");return e.length?e[0][0]:null}async handleCameraEvent(e){const t=this._api.getConfigManager().getConfig()?.view.triggers,n=this._api.getViewManager().getView()?.camera;if(!t||!n)return;const a=this._api.getCameraManager().getStore().getAllDependentCameras(n);t.filter_selected_camera&&!a.has(e.cameraID)||("end"!==e.type?(this._triggeredCameras.set(e.cameraID,new Date),this._setConditionStateIfNecessary(),await this._throttledTriggerAction(e)):this._startUntriggerTimer(e.cameraID))}_hasAllowableInteractionStateForAction(){const e=this._api.getConfigManager().getConfig()?.view.triggers,t=this._api.getInteractionManager().hasInteraction();return!!e&&("all"===e.actions.interaction_mode||"active"===e.actions.interaction_mode&&t||"inactive"===e.actions.interaction_mode&&!t)}async _triggerAction(e){const t=this._api.getConfigManager().getConfig()?.view.triggers.actions.trigger,n=this._api.getConfigManager().getConfig()?.view.default;("high"!==e.fidelity||e.snapshot||e.clip||"live"===t||"default"===t&&"live"===n)&&(this._hasAllowableInteractionStateForAction()&&("update"===t?await this._api.getViewManager().setViewByParametersWithNewQuery({queryExecutorOptions:{useCache:!1}}):"live"===t?await this._api.getViewManager().setViewByParametersWithNewQuery({params:{view:"live",camera:e.cameraID}}):"default"===t?await this._api.getViewManager().setViewDefaultWithNewQuery({params:{camera:e.cameraID}}):"high"===e.fidelity&&"media"===t&&await this._api.getViewManager().setViewByParametersWithNewQuery({params:{view:e.clip?"clip":"snapshot",camera:e.cameraID}})),this._api.getCardElementManager().update())}_setConditionStateIfNecessary(){const e=new Set(this._triggeredCameras.keys()),t=e.size?e:void 0;Dv(t,this._api.getConditionsManager().getState().triggered)||this._api.getConditionsManager().setState({triggered:t})}async _untriggerAction(e){const t=this._api.getConfigManager().getConfig()?.view.triggers.actions.untrigger;"default"===t&&this._hasAllowableInteractionStateForAction()&&await this._api.getViewManager().setViewDefaultWithNewQuery(),this._triggeredCameras.delete(e),this._deleteTimer(e),this._setConditionStateIfNecessary(),this._api.getCardElementManager().update()}_startUntriggerTimer(e){this._deleteTimer(e);const t=new xf;this._triggeredCameraTimers.set(e,t),t.start( +/* istanbul ignore next: the case of config being null here cannot be + reached, as there's no way to have the untrigger call happen without + a config. -- @preserve */ +this._api.getConfigManager().getConfig()?.view.triggers.untrigger_seconds??0,(async()=>{await this._untriggerAction(e)}))}_deleteTimer(e){this._triggeredCameraTimers.get(e)?.stop(),this._triggeredCameraTimers.delete(e)}}function lx(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Hg(e,void 0,t):[]}class dx{constructor(e){this._queries=null,e&&(this._queries=e)}clone(){return u_(this)}getQueries(){return this._queries}setQueries(e){return this._queries=e,this}getQueryCameraIDs(){if(!this._queries)return null;const e=new Set;return this._queries.forEach((t=>[...t.cameraIDs].forEach((t=>e.add(t))))),e}setQueryCameraIDs(e){if(!this._queries)return this;const t=[];return this._queries.forEach((n=>t.push({...n,cameraIDs:Zg(e)}))),this._queries=lx(t,Dv),this}hasQueriesForCameraIDs(e){for(const t of e)if(!this._queries?.some((e=>e.cameraIDs.has(t))))return!1;return!0}}class ux extends dx{convertToClipsQueries(){for(const e of this._queries??[])delete e.hasSnapshot,e.hasClip=!0;return this}}class hx extends dx{}class px{static areEventQueries(e){return e instanceof ux}static areRecordingQueries(e){return e instanceof hx}static areClipsQueries(e){return this.areEventQueries(e)&&!!e?.getQueries()?.every((e=>e.hasClip))}static areSnapshotQueries(e){return this.areEventQueries(e)&&!!e?.getQueries()?.every((e=>e.hasSnapshot))}static getQueriesType(e){return this.areEventQueries(e)?"event":this.areRecordingQueries(e)?"recording":null}static getMediaType(e){return this.areClipsQueries(e)?"clips":this.areSnapshotQueries(e)?"snapshots":this.areRecordingQueries(e)?"recordings":null}}const mx=(e,t,n)=>{const a={anyCapabilities:["clips","snapshots","recordings"]};switch(t){case"image":case"diagnostics":return e.getStore().getCameraIDs();case"live":case"clip":case"clips":case"snapshot":case"snapshots":case"recording":case"recordings":const i="clip"===t?"clips":"snapshot"===t?"snapshots":"recording"===t?"recordings":t;return n?e.getStore().getAllDependentCameras(n,i):e.getStore().getCameraIDsWithCapability(i);case"timeline":return e.getStore().getCameraIDsWithCapability(a);case"media":return n?e.getStore().getAllDependentCameras(n,a):e.getStore().getCameraIDsWithCapability(a)}},gx=(e,t)=>Ly({},e,t);class fx{constructor(e){this.view=e.view,this.camera=e.camera,this.query=e.query??null,this.queryResults=e.queryResults??null,this.context=e.context??null,this.displayMode=e.displayMode??null}clone(){return new fx({view:this.view,camera:this.camera,query:this.query?.clone()??null,queryResults:this.queryResults?.clone()??null,context:this.context,displayMode:this.displayMode})}evolve(e){return new fx({view:void 0!==e.view?e.view:this.view,camera:void 0!==e.camera?e.camera:this.camera,query:void 0!==e.query?e.query:this.query?.clone()??null,queryResults:void 0!==e.queryResults?e.queryResults:this.queryResults?.clone()??null,context:void 0!==e.context?e.context:this.context,displayMode:void 0!==e.displayMode?e.displayMode:this.displayMode})}mergeInContext(e){return this.context=gx(this.context,e),this}removeContext(e){return this.context&&delete this.context[e],this}removeContextProperty(e,t){const n=this.context?.[e];return n&&delete n[t],this}is(e){return this.view==e}isGalleryView(){return["clips","snapshots","recordings"].includes(this.view)}isAnyMediaView(){return this.isViewerView()||this.is("live")||this.is("image")}isViewerView(){return["media","clip","snapshot","recording"].includes(this.view)}supportsMultipleDisplayModes(){return this.isViewerView()||this.is("live")}getDefaultMediaType(){return["clip","clips"].includes(this.view)?"clips":["snapshot","snapshots"].includes(this.view)?"snapshots":["recording","recordings"].includes(this.view)?"recordings":null}isGrid(){return"grid"===this.displayMode}}const _x=(e,t)=>{t?.forEach((t=>t.modify(e)))};class vx extends zs{}class yx extends zs{}class bx{constructor(e){this._api=e}getViewDefault(e){const t=this._api.getConfigManager().getConfig();if(!t)return null;let n=null;const a=e?.params?.view??t.view.default;if(e?.params?.camera)n=e.params.camera;else{const i=[...mx(this._api.getCameraManager(),a)];if(!i.length)return null;if(e?.baseView?.camera&&t.view.default_cycle_camera){const t=i.indexOf(e.baseView.camera);n=i[t+1>=i.length?0:t+1]}else n=i[0]}return this.getViewByParameters({params:{...e?.params,view:a,camera:n},baseView:e?.baseView})}getViewByParameters(e){const t=this._api.getConfigManager().getConfig();if(!t)return null;let n=e?.params?.camera??e?.baseView?.camera??null,a=e?.params?.view??e?.baseView?.view??t.view.default;const i=this._api.getCameraManager().getStore().getCameraIDs();if(!n||!i.has(n)){n=mx(this._api.getCameraManager(),a).keys().next().value??null}if(!n){const e=[...this._api.getCameraManager().getStore().getCameras()].reduce(((e,[t,n])=>{const a=n.getCapabilities()?.getRawCapabilities();return a&&(e[t]=a),e}),{});throw new vx(V_("error.no_supported_cameras"),{view:a,cameras_capabilities:e})}if(!this.isViewSupportedByCamera(n,a)){if(!e?.failSafe||!this.isViewSupportedByCamera(n,Qs)){const e=this._api.getCameraManager().getStore().getCamera(n)?.getCapabilities()?.getRawCapabilities();throw new yx(V_("error.no_supported_camera"),{view:a,camera:n,...e&&{camera_capabilities:e}})}a=Qs}const r=e?.params?.displayMode??e?.baseView?.displayMode??this._getDefaultDisplayModeForView(a,t),o={...e?.params,view:a,camera:n,displayMode:r},s=e?.baseView?e.baseView.evolve(o):new fx(o);return _x(s,e?.modifiers),s}isViewSupportedByCamera(e,t){return!!mx(this._api.getCameraManager(),t,e).size}_getDefaultDisplayModeForView(e,t){let n=null;switch(e){case"media":case"clip":case"recording":case"snapshot":n=t.media_viewer.display?.mode??null;break;case"live":n=t.live.display?.mode??null}return n??"single"}}class wx{constructor(e,t){this._key=e,this._property=t}modify(e){e.removeContextProperty(this._key,this._property)}}class xx{constructor(e){this._query=e?.query,this._queryResults=e?.queryResults}modify(e){void 0!==this._query&&(e.query=this._query),void 0!==this._queryResults&&(e.queryResults=this._queryResults)}}const Cx=(e,t,n)=>{let a;for(const[i,r]of e.entries()){const e=r.getStartTime(),o=r.getUsableEndTime();if(r.includesTime(t)&&e&&o){const t=o.getTime()-e.getTime();(!a||n&&a.cameraID!==n&&r.getCameraID()===n||t>a.duration&&(!n||a.cameraID!==n||r.getCameraID()===n))&&(a={index:i,duration:t,cameraID:r.getCameraID()})}}return a?a.index:null};class Mx{constructor(e){this._results=e?.results??[],this._selectedIndex=this._getInitialSelectedIndex(e)}_getInitialSelectedIndex(e){return null!=e?.selectedIndex?e.selectedIndex:e?.results&&e.results.length?e?.selectApproach&&"last"!==e?.selectApproach?0:e.results.length-1:null}clone(){return new Mx({results:this._results,selectedIndex:this._selectedIndex})}getResults(){return this._results}getSelectedIndex(){return this._selectedIndex}getResultsCount(){return this.getResults().length}hasResults(){return 0!==this.getResultsCount()}getResult(e){return void 0===e?null:this._results[e]}getSelectedResult(){const e=this.getSelectedIndex();return null!==e?this.getResult(e):null}hasSelectedResult(){return null!==this.getSelectedResult()}resetSelectedResult(){this._selectedIndex=null}selectIndex(e){(null===e||e>=0&&ee.getID()))),n=new Set(e._main.getResults()?.map((e=>e.getID())));return!(!t.size||!n.size||t.has(null)||n.has(null))&&((e,t)=>{for(const n of t)if(!e.has(n))return!1;return!0})(t,n)}getCameraIDs(){return new Set(this._cameras.keys())}getSlice(e){return e?this._cameras.get(e)??null:this._main}getResults(e){return this.getSlice(e)?.getResults()??null}getResultsCount(e){return this.getSlice(e)?.getResultsCount()??0}hasResults(e){return 0!==this.getSlice(e)?.getResultsCount()}getResult(e,t){return this.getSlice(t)?.getResult(e)??null}getSelectedIndex(e){return this.getSlice(e)?.getSelectedIndex()??null}getSelectedResult(e){return this.getSlice(e)?.getSelectedResult()??null}getMultipleSelectedResults(e){const t=[];if(!e||e.main){const e=this.getSelectedResult();e&&t.push(e)}const n=this._getCameraIDsFromCriteria(e);for(const e of n??[]){const n=this.getSelectedResult(e);n&&t.push(n)}return t}hasSelectedResult(e){return this.getSlice(e)?.hasSelectedResult()??!1}resetSelectedResult(e){return this.getSlice(e)?.resetSelectedResult(),this}getResultsTimestamp(){return this._resultsTimestamp}selectIndex(e,t){return this.getSlice(t)?.selectIndex(e),t||this.demoteMainSelectionToCameraSelection(),this}demoteMainSelectionToCameraSelection(){const e=this.getSelectedResult();if(e){const t=e.getCameraID();this.resetSelectedResult(t),this.selectResultIfFound((t=>t===e),{cameraID:t})}return this}promoteCameraSelectionToMainSelection(e){const t=this.getSelectedResult(e);return this.resetSelectedResult(),this.selectResultIfFound((e=>e===t)),this}_getCameraIDsFromCriteria(e){return e?.allCameras?this.getCameraIDs():e?.cameraID?new Set([e.cameraID]):null}selectResultIfFound(e,t){t&&!t?.main||(this._main.selectResultIfFound(e),this.demoteMainSelectionToCameraSelection());const n=this._getCameraIDsFromCriteria(t);for(const t of n??[])this.getSlice(t)?.selectResultIfFound(e);return this}selectBestResult(e,t){t&&!t.main||(this._main.selectBestResult(e),this.demoteMainSelectionToCameraSelection());const n=this._getCameraIDsFromCriteria(t);for(const t of n??[])this.getSlice(t)?.selectBestResult(e);return this}}class Sx{constructor(e){this._api=e}async executeDefaultEventQuery(e){const t=e?.eventsMediaType&&"all"!==e?.eventsMediaType?e.eventsMediaType:{anyCapabilities:["clips","snapshots"]},n=this._api.getCameraManager(),a=e?.cameraID?n.getStore().getAllDependentCameras(e.cameraID,t):n.getStore().getCameraIDsWithCapability(t);if(!a.size)return null;const i=n.generateDefaultEventQueries(a,{limit:this._getChunkLimit(),..."clips"===e?.eventsMediaType&&{hasClip:!0},..."snapshots"===e?.eventsMediaType&&{hasSnapshot:!0}});if(!i)return null;const r=new ux(i),o=await this.execute(r,e?.executorOptions);return o?{query:r,queryResults:o}:null}async executeDefaultRecordingQuery(e){const t=this._api.getCameraManager(),n=e?.cameraID?t.getStore().getAllDependentCameras(e.cameraID,"recordings"):t.getStore().getCameraIDsWithCapability("recordings");if(!n.size)return null;const a=t.generateDefaultRecordingQueries(n,{limit:this._getChunkLimit()});if(!a)return null;const i=new hx(a),r=await this.execute(i,e?.executorOptions);return r?{query:i,queryResults:r}:null}async execute(e,t){const n=e.getQueries();if(!n)return null;const a=await this._api.getCameraManager().executeMediaQueries(n,{useCache:t?.useCache});if(!a)return null;const i=new kx({results:a});return t?.rejectResults?.(i)?null:(t?.selectResult?.id?i.selectBestResult((e=>e.findIndex((e=>e.getID()===t.selectResult?.id)))):t?.selectResult?.func?i.selectResultIfFound(t.selectResult.func):t?.selectResult?.time&&i.selectBestResult((e=>Cx(e,t.selectResult?.time?.time,t.selectResult?.time?.favorCameraID))),i)}_getChunkLimit(){const e=this._api.getConfigManager().getCardWideConfig();return e?.performance?.features.media_chunk_size??50}}class Ex{constructor(e,t){this._api=e,this._executor=t??new Sx(e)}async getExistingQueryModifiers(e,t){return e.query?[new xx({queryResults:await this._executor.execute(e.query,t)})]:[]}async getNewQueryModifiers(e,t){return await this._executeNewQuery(e,{useCache:!1,...t})}async _executeNewQuery(e,t){const n=this._api.getConfigManager().getConfig();if(!n)return null;const a=e?.getDefaultMediaType(),i=[],r=async n=>{ +/* istanbul ignore if: this path cannot be reached -- @preserve */ +if(!n)return[];const a="recordings"===n?await this._executor.executeDefaultRecordingQuery({...!e.isGrid()&&{cameraID:e.camera},executorOptions:t}):"clips"===n||"snapshots"===n||"all"===n?await this._executor.executeDefaultEventQuery({...!e.isGrid()&&{cameraID:e.camera},eventsMediaType:n,executorOptions:t}):/* istanbul ignore next -- @preserve */ +null;return a?[new xx(a)]:[]};switch(e.view){case"live":"none"!==n.live.controls.thumbnails.mode&&i.push(...await r("recordings"===n.live.controls.thumbnails.media_type?"recordings":n.live.controls.thumbnails.events_media_type));break;case"media":i.push(...await r("clips"));break;case"clips":case"snapshots":case"recordings":i.push(...await r(a));break;case"clip":case"snapshot":case"recording":"none"!==n.media_viewer.controls.thumbnails.mode&&i.push(...await r(a))}return i.push(...this._getTimelineWindowViewModifier(e)),i.push(...this._getSeekTimeModifier(t?.selectResult?.time?.time)),i}_getTimelineWindowViewModifier(e){if(e.is("live")){const e=new Date,t=this._api.getConfigManager().getConfig()?.live; +/* istanbul ignore if: this if branch cannot be reached as if the config is + empty this function is never called -- @preserve */ +return t?[new Gy({timeline:{window:{start:Qu(e,{seconds:t.controls.timeline.window_seconds}),end:e}}})]:[]}return[new wx("timeline","window")]}_getSeekTimeModifier(e){return e?[new Gy({mediaViewer:{seek:e}})]:[new wx("mediaViewer","seek")]}}class $x{constructor(e,t){this._view=null,this._epoch=this._createEpoch(),this._loadingIndex=1,this.setViewDefault=e=>this._setViewGeneric(this._viewFactory.getViewDefault.bind(this._viewFactory),e),this.setViewByParameters=e=>this._setViewGeneric(this._viewFactory.getViewByParameters.bind(this._viewFactory),e),this.setViewDefaultWithNewQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewDefault.bind(this._viewFactory),this._viewQueryExecutor.getNewQueryModifiers.bind(this._viewQueryExecutor),e),this.setViewByParametersWithNewQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewByParameters.bind(this._viewFactory),this._viewQueryExecutor.getNewQueryModifiers.bind(this._viewQueryExecutor),e),this.setViewByParametersWithExistingQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewByParameters.bind(this._viewFactory),this._viewQueryExecutor.getExistingQueryModifiers.bind(this._viewQueryExecutor),e),this.initialize=async()=>(this._api.getQueryStringManager().hasViewRelatedActionsToRun()||this.setViewDefaultWithNewQuery({failSafe:!0}),!0),this._api=e,this._viewFactory=t?.viewFactory??new bx(e),this._viewQueryExecutor=t?.viewQueryExecutor??new Ex(e)}getEpoch(){return this._epoch}_createEpoch(e){return{manager:this,...e&&{oldView:e}}}getView(){return this._view}hasView(){return!!this.getView()}reset(){this._view&&this._setView(null)}_setViewGeneric(e,t){let n=null;try{n=e({baseView:this._view,...t})}catch(e){this._api.getMessageManager().setErrorIfHigherPriority(e)}n&&this._setView(n)}_markViewLoadingQuery(e,t){return e.mergeInContext({loading:{query:t}})}_markViewAsNotLoadingQuery(e){return e.removeContextProperty("loading","query")}async _setViewThenModifyAsync(e,t,n){let a=null;try{a=e({baseView:this._view,...n,params:{query:null,queryResults:null,...n?.params}})}catch(e){this._api.getMessageManager().setErrorIfHigherPriority(e)}if(!a)return;if(this._view&&this._shouldAdoptQueryAndResults(a))return a.query=this._view.query,a.queryResults=this._view.queryResults,this._markViewAsNotLoadingQuery(a),void this._setView(a);const i=this._loadingIndex++;this._markViewLoadingQuery(a,i),this._setView(a);let r=null,o=null;try{r=await t(a,n?.queryExecutorOptions)}catch(e){o=e}if(this._view&&this.hasMajorMediaChange(this._view,a))return void(this._view.context?.loading?.query===i&&this._setView(this._markViewAsNotLoadingQuery(this._view.clone())));if(o)return void this._api.getMessageManager().setErrorIfHigherPriority(o); +/* istanbul ignore if: the if path cannot be reached as the view is set + above -- @preserve */if(!this._view)return;const s=this._view.clone();this._view.context?.loading?.query===i&&this._markViewAsNotLoadingQuery(s),_x(s,r),this._setView(s)}_shouldAdoptQueryAndResults(e){const t=this._view?.isViewerView()&&e?.isGalleryView(),n=e?.getDefaultMediaType(),a=px.getMediaType(this._view?.query)===n;return!!t&&a}setViewWithMergedContext(e){if(this._view)return this._setView(this._view?.clone().mergeInContext(e))}isViewSupportedByCamera(e,t){return!!mx(this._api.getCameraManager(),t,e).size}hasMajorMediaChange(e,t){const n=t??this._view;return!!e!=!!n||e?.view!==n?.view||e?.camera!==n?.camera||"live"===n?.view&&e&&My(e)!==My(n)||"live"!==n?.view&&e?.queryResults!==n?.queryResults}_setView(e){const t=this._view;B_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card view change: ",e),this._view=e,this._epoch=this._createEpoch(t),this.hasMajorMediaChange(t)&&this._api.getMediaLoadedInfoManager().clear(),t?.view!==e?.view&&this._api.getCardElementManager().scrollReset(),this._api.getMessageManager().reset(),this._api.getStyleManager().setExpandedMode(),this._api.getConditionsManager()?.setState({view:e?.view,camera:e?.camera,displayMode:e?.displayMode??void 0}),this._api.getCardElementManager().update()}}class Ax{constructor(e,t,n,a){this._deviceRegistryManager=new oy(new iy((e=>e.id))),this._entityRegistryManager=new ly(new iy((e=>e.entity_id))),this._resolvedMediaCache=new uy,this._actionsManager=new gb(this),this._automationsManager=new fb(this),this._cameraManager=new ay(this),this._cameraURLManager=new _b(this),this._configManager=new Mw(this),this._defaultManager=new kw(this),this._downloadManager=new Aw(this),this._expandManager=new zw(this),this._fullscreenManager=new Rw(this),this._hassManager=new Lw(this),this._initializationManager=new Zb(this),this._interactionManager=new Uw(this),this._keyboardStateManager=new Ww(this),this._mediaLoadedInfoManager=new ex(this),this._mediaPlayerManager=new nx(this),this._messageManager=new ax(this),this._microphoneManager=new ix(this),this._queryStringManager=new rx(this),this._statusBarItemManager=new ox(this),this._styleManager=new sx(this),this._triggersManager=new cx(this),this._viewManager=new $x(this),e.addController(this),this._conditionsManager=new yw(this,a),this._cardElementManager=new Qb(this,e,t,n)}getActionsManager(){return this._actionsManager}getAutomationsManager(){return this._automationsManager}getCameraManager(){return this._cameraManager}getCameraURLManager(){return this._cameraURLManager}getCardElementManager(){return this._cardElementManager}getConditionsManager(){return this._conditionsManager}static async getConfigElement(){return await import("./editor-c3e576d8.js"),document.createElement("frigate-card-editor")}getConfigManager(){return this._configManager}getDefaultManager(){return this._defaultManager}getDeviceRegistryManager(){return this._deviceRegistryManager}getDownloadManager(){return this._downloadManager}getEntityRegistryManager(){return this._entityRegistryManager}getExpandManager(){return this._expandManager}getFullscreenManager(){return this._fullscreenManager}getHASSManager(){return this._hassManager}getInitializationManager(){return this._initializationManager}getInteractionManager(){return this._interactionManager}getKeyboardStateManager(){return this._keyboardStateManager}getMediaLoadedInfoManager(){return this._mediaLoadedInfoManager}getMediaPlayerManager(){return this._mediaPlayerManager}getMessageManager(){return this._messageManager}getMicrophoneManager(){return this._microphoneManager}getQueryStringManager(){return this._queryStringManager}getResolvedMediaCache(){return this._resolvedMediaCache}getStatusBarItemManager(){return this._statusBarItemManager}static getStubConfig(e){return{cameras:[{camera_entity:e.find((e=>e.startsWith("camera.")))??"camera.demo"}]}}getStyleManager(){return this._styleManager}getTriggersManager(){return this._triggersManager}getViewManager(){return this._viewManager}hostConnected(){this.getCardElementManager().elementConnected()}hostDisconnected(){this.getCardElementManager().elementDisconnected()}}class zx{constructor(){this._dynamicMenuButtons=[]}addDynamicMenuButton(e){this._dynamicMenuButtons.includes(e)||this._dynamicMenuButtons.push(e)}removeDynamicMenuButton(e){this._dynamicMenuButtons=this._dynamicMenuButtons.filter((t=>t!=e))}calculateButtons(e,t,n,a){return[this._getDefaultButton(t),this._getCamerasButton(t,n,a?.view),this._getSubstreamsButton(t,n,a?.view),this._getLiveButton(t,a?.view,a?.viewManager),this._getClipsButton(t,a?.view,a?.viewManager),this._getSnapshotsButton(t,a?.view,a?.viewManager),this._getRecordingsButton(t,a?.view,a?.viewManager),this._getImageButton(t,a?.view,a?.viewManager),this._getTimelineButton(t,a?.view,a?.viewManager),this._getDownloadButton(t,n,a?.view),this._getCameraUIButton(t,a?.showCameraUIButton),this._getMicrophoneButton(t,a?.microphoneManager,a?.currentMediaLoadedInfo),this._getExpandButton(t,a?.inExpandedMode),this._getFullscreenButton(t,a?.inFullscreenMode),this._getCastButton(e,t,n,a?.view,a?.mediaPlayerController),this._getPlayPauseButton(t,a?.currentMediaLoadedInfo),this._getMuteUnmuteButton(t,a?.currentMediaLoadedInfo),this._getScreenshotButton(t,a?.currentMediaLoadedInfo),this._getDisplayModeButton(t,n,a?.view),this._getPTZControlsButton(t,n,a?.view),this._getPTZHomeButton(t,n,a?.view),...this._dynamicMenuButtons.map((e=>({style:this._getStyleFromActions(t,e,a),...e})))].filter(sf)}_getDefaultButton(e){return{icon:"frigate",...e.menu.buttons.frigate,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.frigate"),permanent:!0,tap_action:"hidden"===e.menu?.style?gf("menu_toggle"):gf("default"),hold_action:gf("diagnostics")}}_getCamerasButton(e,t,n){const a=t.getStore().getCameraIDsWithCapability("menu");if(a.size>1){const i=Array.from(t.getStore().getCameraConfigEntries(a),(([e,a])=>{const i=ff("camera_select",e),r=t.getCameraMetadata(e);return{enabled:!0,icon:r?.icon,entity:a.camera_entity,state_color:!0,title:r?.title,selected:n?.camera===e,...i&&{tap_action:i}}}));return{icon:"mdi:video-switch",...e.menu.buttons.cameras,type:"custom:frigate-card-menu-submenu",title:V_("config.menu.buttons.cameras"),items:i}}return null}_getSubstreamsButton(e,t,n){if(!n)return null;const a=t.getStore().getAllDependentCameras(n.camera,"substream");if(a.size&&n.is("live")){const i=[...a].filter((e=>e!==n.camera)),r=[n.camera,...i],o=My(n);if(2===r.length)return{icon:"mdi:video-input-component",style:o!==n.camera?this._getEmphasizedStyle():{},title:V_("config.menu.buttons.substreams"),...e.menu.buttons.substreams,type:"custom:frigate-card-menu-icon",tap_action:gf(ky(n)?"live_substream_off":"live_substream_on")};if(r.length>2){const a=Array.from(r,(e=>{const n=ff("live_substream_select",e),a=t.getCameraMetadata(e)??void 0,i=t.getStore().getCameraConfig(e);return{enabled:!0,icon:a?.icon,entity:i?.camera_entity,state_color:!0,title:a?.title,selected:o===e,...n&&{tap_action:n}}}));return{icon:"mdi:video-input-component",title:V_("config.menu.buttons.substreams"),style:o!==n.camera?this._getEmphasizedStyle():{},...e.menu.buttons.substreams,type:"custom:frigate-card-menu-submenu",items:a}}}return null}_getLiveButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"live")?{icon:"mdi:cctv",...e.menu.buttons.live,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.live"),style:t.is("live")?this._getEmphasizedStyle():{},tap_action:gf("live")}:null}_getClipsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"clips")?{icon:"mdi:filmstrip",...e.menu.buttons.clips,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.clips"),style:t?.is("clips")?this._getEmphasizedStyle():{},tap_action:gf("clips"),hold_action:gf("clip")}:null}_getSnapshotsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"snapshots")?{icon:"mdi:camera",...e.menu.buttons.snapshots,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.snapshots"),style:t?.is("snapshots")?this._getEmphasizedStyle():{},tap_action:gf("snapshots"),hold_action:gf("snapshot")}:null}_getRecordingsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"recordings")?{icon:"mdi:album",...e.menu.buttons.recordings,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.recordings"),style:t.is("recordings")?this._getEmphasizedStyle():{},tap_action:gf("recordings"),hold_action:gf("recording")}:null}_getImageButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"image")?{icon:"mdi:image",...e.menu.buttons.image,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.image"),style:t?.is("image")?this._getEmphasizedStyle():{},tap_action:gf("image")}:null}_getTimelineButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"timeline")?{icon:"mdi:chart-gantt",...e.menu.buttons.timeline,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.timeline"),style:t.is("timeline")?this._getEmphasizedStyle():{},tap_action:gf("timeline")}:null}_getDownloadButton(e,t,n){const a=n?.queryResults?.getSelectedResult(),i=a?t?.getMediaCapabilities(a):null;return n?.isViewerView()&&i?.canDownload&&!this._isBeingCasted()?{icon:"mdi:download",...e.menu.buttons.download,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.download"),tap_action:gf("download")}:null}_getCameraUIButton(e,t){return t?{icon:"mdi:web",...e.menu.buttons.camera_ui,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.camera_ui"),tap_action:gf("camera_ui")}:null}_getMicrophoneButton(e,t,n){if(t&&n?.capabilities?.supports2WayAudio){const n=t.isForbidden()||!t.isSupported(),a=t.isMuted(),i=e.menu.buttons.microphone.type;return{icon:n?"mdi:microphone-message-off":a?"mdi:microphone-off":"mdi:microphone",...e.menu.buttons.microphone,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.microphone"),style:n||a?{}:this._getEmphasizedStyle(!0),...!n&&"momentary"===i&&{start_tap_action:gf("microphone_unmute"),end_tap_action:gf("microphone_mute")},...!n&&"toggle"===i&&{tap_action:gf(a?"microphone_unmute":"microphone_mute")}}}return null}_getExpandButton(e,t){return{icon:t?"mdi:arrow-collapse-all":"mdi:arrow-expand-all",...e.menu.buttons.expand,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.expand"),tap_action:gf("expand"),style:t?this._getEmphasizedStyle():{}}}_getFullscreenButton(e,t){return this._isBeingCasted()?null:{icon:t?"mdi:fullscreen-exit":"mdi:fullscreen",...e.menu.buttons.fullscreen,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.fullscreen"),tap_action:gf("fullscreen"),style:t?this._getEmphasizedStyle():{}}}_getCastButton(e,t,n,a,i){if(!a)return null;const r=n.getStore().getCameraConfig(a.camera);if(i?.hasMediaPlayers()&&(a.isViewerView()||a.is("live")&&r?.camera_entity)){const n=i.getMediaPlayers().map((t=>{const n=Lb(e,t)||t,a=e.states[t],i=_f(t,"play"),r=_f(t,"stop"),o=!a||"unavailable"===a.state;return{enabled:!0,selected:!1,icon:Nb(e,t),entity:t,state_color:!1,title:n,disabled:o,...!o&&i&&{tap_action:i},...!o&&r&&{hold_action:r}}}));return{icon:"mdi:cast",...t.menu.buttons.media_player,type:"custom:frigate-card-menu-submenu",title:V_("config.menu.buttons.media_player"),items:n}}return null}_getPlayPauseButton(e,t){if(t&&t.player&&t.capabilities?.supportsPause){const n=t.player.isPaused();return{icon:n?"mdi:play":"mdi:pause",...e.menu.buttons.play,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.play"),tap_action:gf(n?"play":"pause")}}return null}_getMuteUnmuteButton(e,t){if(t&&t.player&&t?.capabilities?.hasAudio){const n=t.player.isMuted();return{icon:n?"mdi:volume-off":"mdi:volume-high",...e.menu.buttons.mute,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.mute"),tap_action:gf(n?"unmute":"mute")}}return null}_getScreenshotButton(e,t){return t&&t.player?{icon:"mdi:monitor-screenshot",...e.menu.buttons.screenshot,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.screenshot"),tap_action:gf("screenshot")}:null}_getDisplayModeButton(e,t,n){const a=n?mx(t,n.view):null;if(n?.supportsMultipleDisplayModes()&&a&&a.size>1){const t=n.isGrid();return{icon:t?"mdi:grid-off":"mdi:grid",...e.menu.buttons.display_mode,style:t?this._getEmphasizedStyle():{},type:"custom:frigate-card-menu-icon",title:V_(t?"display_modes.single":"display_modes.grid"),tap_action:(i=t?"single":"grid",{action:"fire-dom-event",frigate_card_action:"display_mode_select",display_mode:i,...r?.cardID&&{card_id:r.cardID}})}}var i,r;return null}_getPTZControlsButton(e,t,n){const a=n?.is("live")?e.live.controls.ptz:n?.isViewerView()?e.media_viewer.controls.ptz:null;if(!n||!a||"off"===a.mode)return null;const i=Ry(n,{cameraManager:t,..."auto"===a.mode&&{type:"ptz"}});if(i){const t=!1!==n.context?.ptzControls?.enabled&&("on"===a.mode||"auto"===a.mode&&"ptz"===i.type);return{icon:"mdi:pan",...e.menu.buttons.ptz_controls,style:t?this._getEmphasizedStyle():{},type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.ptz_controls"),tap_action:(r=!t,{action:"fire-dom-event",frigate_card_action:"ptz_controls",enabled:r,...o?.cardID&&{card_id:o.cardID}})}}var r,o;return null}_getPTZHomeButton(e,t,n){const a=n?Ry(n,{cameraManager:t}):null;return!a||(("digital"===a.type&&n?.context?.zoom?.[a.targetID]?.observed?.isDefault)??1)?null:{icon:"mdi:home",...e.menu.buttons.ptz_home,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.ptz_home"),tap_action:vf({targetID:a.targetID})}}_getEmphasizedStyle(e){return e?{animation:"pulse 3s infinite",color:"var(--error-color, white)"}:{color:"var(--primary-color, white)"}}_getStyleFromActions(e,t,n){for(const a of[t.tap_action,t.double_tap_action,t.hold_action,t.start_tap_action,t.end_tap_action]){const t=Array.isArray(a)?a:[a];for(const a of t){if(!a||"fire-dom-event"!==a.action||!("frigate_card_action"in a))continue;const t=a;if(Zs.some((e=>e===t.frigate_card_action&&n?.view?.is(t.frigate_card_action)))||"default"===t.frigate_card_action&&n?.view?.is(e.view.default)||"fullscreen"===t.frigate_card_action&&n?.inFullscreenMode||"camera_select"===t.frigate_card_action&&n?.view?.camera===t.camera)return this._getEmphasizedStyle()}}return{}}_isBeingCasted(){return!!navigator.userAgent.match(/CrKey\//)}} +/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */ +function Ix(e){return null==e}var Tx=function(e,t){var n,a="";for(n=0;ns&&(t=a-s+(r=" ... ").length),n-a>s&&(n=a+s-(o=" ...").length),{str:r+e.slice(t,n).replace(/\t/g,"→")+o,pos:a-t+r.length}}function Lx(e,t){return jx.repeat(" ",t-e.length)+e}var Nx=function(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),"number"!=typeof t.indent&&(t.indent=1),"number"!=typeof t.linesBefore&&(t.linesBefore=3),"number"!=typeof t.linesAfter&&(t.linesAfter=2);for(var n,a=/\r?\n|\r|\0/g,i=[0],r=[],o=-1;n=a.exec(e.buffer);)r.push(n.index),i.push(n.index+n[0].length),e.position<=n.index&&o<0&&(o=i.length-2);o<0&&(o=i.length-1);var s,c,l="",d=Math.min(e.line+t.linesAfter,r.length).toString().length,u=t.maxLength-(t.indent+d+3);for(s=1;s<=t.linesBefore&&!(o-s<0);s++)c=Px(e.buffer,i[o-s],r[o-s],e.position-(i[o]-i[o-s]),u),l=jx.repeat(" ",t.indent)+Lx((e.line-s+1).toString(),d)+" | "+c.str+"\n"+l;for(c=Px(e.buffer,i[o],r[o],e.position,u),l+=jx.repeat(" ",t.indent)+Lx((e.line+1).toString(),d)+" | "+c.str+"\n",l+=jx.repeat("-",t.indent+d+3+c.pos)+"^\n",s=1;s<=t.linesAfter&&!(o+s>=r.length);s++)c=Px(e.buffer,i[o+s],r[o+s],e.position-(i[o]-i[o+s]),u),l+=jx.repeat(" ",t.indent)+Lx((e.line+s+1).toString(),d)+" | "+c.str+"\n";return l.replace(/\n$/,"")},Fx=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],Vx=["scalar","sequence","mapping"];var Hx=function(e,t){if(t=t||{},Object.keys(t).forEach((function(t){if(-1===Fx.indexOf(t))throw new Rx('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')})),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=function(e){var t={};return null!==e&&Object.keys(e).forEach((function(n){e[n].forEach((function(e){t[String(e)]=n}))})),t}(t.styleAliases||null),-1===Vx.indexOf(this.kind))throw new Rx('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')};function Bx(e,t){var n=[];return e[t].forEach((function(e){var t=n.length;n.forEach((function(n,a){n.tag===e.tag&&n.kind===e.kind&&n.multi===e.multi&&(t=a)})),n[t]=e})),n}function qx(e){return this.extend(e)}qx.prototype.extend=function(e){var t=[],n=[];if(e instanceof Hx)n.push(e);else if(Array.isArray(e))n=n.concat(e);else{if(!e||!Array.isArray(e.implicit)&&!Array.isArray(e.explicit))throw new Rx("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit))}t.forEach((function(e){if(!(e instanceof Hx))throw new Rx("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(e.loadKind&&"scalar"!==e.loadKind)throw new Rx("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(e.multi)throw new Rx("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")})),n.forEach((function(e){if(!(e instanceof Hx))throw new Rx("Specified list of YAML types (or a single Type object) contains a non-Type object.")}));var a=Object.create(qx.prototype);return a.implicit=(this.implicit||[]).concat(t),a.explicit=(this.explicit||[]).concat(n),a.compiledImplicit=Bx(a,"implicit"),a.compiledExplicit=Bx(a,"explicit"),a.compiledTypeMap=function(){var e,t,n={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function a(e){e.multi?(n.multi[e.kind].push(e),n.multi.fallback.push(e)):n[e.kind][e.tag]=n.fallback[e.tag]=e}for(e=0,t=arguments.length;e=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),nC=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var aC=/^[-+]?[0-9]+e/;var iC=new Hx("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!nC.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||jx.isNegativeZero(e))},represent:function(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(jx.isNegativeZero(e))return"-0.0";return n=e.toString(10),aC.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"}),rC=Gx.extend({implicit:[Yx,Kx,tC,iC]}),oC=rC,sC=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),cC=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");var lC=new Hx("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==sC.exec(e)||null!==cC.exec(e))},construct:function(e){var t,n,a,i,r,o,s,c,l=0,d=null;if(null===(t=sC.exec(e))&&(t=cC.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],a=+t[2]-1,i=+t[3],!t[4])return new Date(Date.UTC(n,a,i));if(r=+t[4],o=+t[5],s=+t[6],t[7]){for(l=t[7].slice(0,3);l.length<3;)l+="0";l=+l}return t[9]&&(d=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(d=-d)),c=new Date(Date.UTC(n,a,i,r,o,s,l)),d&&c.setTime(c.getTime()-d),c},instanceOf:Date,represent:function(e){return e.toISOString()}});var dC=new Hx("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}}),uC="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";var hC=new Hx("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,a=0,i=e.length,r=uC;for(n=0;n64)){if(t<0)return!1;a+=6}return a%8==0},construct:function(e){var t,n,a=e.replace(/[\r\n=]/g,""),i=a.length,r=uC,o=0,s=[];for(t=0;t>16&255),s.push(o>>8&255),s.push(255&o)),o=o<<6|r.indexOf(a.charAt(t));return 0===(n=i%4*6)?(s.push(o>>16&255),s.push(o>>8&255),s.push(255&o)):18===n?(s.push(o>>10&255),s.push(o>>2&255)):12===n&&s.push(o>>4&255),new Uint8Array(s)},predicate:function(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)},represent:function(e){var t,n,a="",i=0,r=e.length,o=uC;for(t=0;t>18&63],a+=o[i>>12&63],a+=o[i>>6&63],a+=o[63&i]),i=(i<<8)+e[t];return 0===(n=r%3)?(a+=o[i>>18&63],a+=o[i>>12&63],a+=o[i>>6&63],a+=o[63&i]):2===n?(a+=o[i>>10&63],a+=o[i>>4&63],a+=o[i<<2&63],a+=o[64]):1===n&&(a+=o[i>>2&63],a+=o[i<<4&63],a+=o[64],a+=o[64]),a}}),pC=Object.prototype.hasOwnProperty,mC=Object.prototype.toString;var gC=new Hx("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,a,i,r,o=[],s=e;for(t=0,n=s.length;t>10),56320+(e-65536&1023))}for(var qC=new Array(256),UC=new Array(256),WC=0;WC<256;WC++)qC[WC]=HC(WC)?1:0,UC[WC]=HC(WC);function ZC(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||bC,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function QC(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=Nx(n),new Rx(t,n)}function GC(e,t){throw QC(e,t)}function YC(e,t){e.onWarning&&e.onWarning.call(null,QC(e,t))}var KC={YAML:function(e,t,n){var a,i,r;null!==e.version&&GC(e,"duplication of %YAML directive"),1!==n.length&&GC(e,"YAML directive accepts exactly one argument"),null===(a=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&GC(e,"ill-formed argument of the YAML directive"),i=parseInt(a[1],10),r=parseInt(a[2],10),1!==i&&GC(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=r<2,1!==r&&2!==r&&YC(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var a,i;2!==n.length&&GC(e,"TAG directive accepts exactly two arguments"),a=n[0],i=n[1],TC.test(a)||GC(e,"ill-formed tag handle (first argument) of the TAG directive"),wC.call(e.tagMap,a)&&GC(e,'there is a previously declared suffix for "'+a+'" tag handle'),jC.test(i)||GC(e,"ill-formed tag prefix (second argument) of the TAG directive");try{i=decodeURIComponent(i)}catch(t){GC(e,"tag prefix is malformed: "+i)}e.tagMap[a]=i}};function XC(e,t,n,a){var i,r,o,s;if(t1&&(e.result+=jx.repeat("\n",t-1))}function rM(e,t){var n,a,i=e.tag,r=e.anchor,o=[],s=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=o),a=e.input.charCodeAt(e.position);0!==a&&(-1!==e.firstTabInLine&&(e.position=e.firstTabInLine,GC(e,"tab characters must not be used in indentation")),45===a)&&PC(e.input.charCodeAt(e.position+1));)if(s=!0,e.position++,nM(e,!0,-1)&&e.lineIndent<=t)o.push(null),a=e.input.charCodeAt(e.position);else if(n=e.line,cM(e,t,MC,!1,!0),o.push(e.result),nM(e,!0,-1),a=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==a)GC(e,"bad indentation of a sequence entry");else if(e.lineIndentt?m=1:e.lineIndent===t?m=0:e.lineIndentt?m=1:e.lineIndent===t?m=0:e.lineIndentt)&&(_&&(o=e.line,s=e.lineStart,c=e.position),cM(e,t,kC,!0,i)&&(_?g=e.result:f=e.result),_||(eM(e,h,p,m,g,f,o,s,c),m=g=f=null),nM(e,!0,-1),l=e.input.charCodeAt(e.position)),(e.line===r||e.lineIndent>t)&&0!==l)GC(e,"bad indentation of a mapping entry");else if(e.lineIndent=0))break;0===i?GC(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):c?GC(e,"repeat of an indentation width identifier"):(l=t+i-1,c=!0)}if(RC(r)){do{r=e.input.charCodeAt(++e.position)}while(RC(r));if(35===r)do{r=e.input.charCodeAt(++e.position)}while(!DC(r)&&0!==r)}for(;0!==r;){for(tM(e),e.lineIndent=0,r=e.input.charCodeAt(e.position);(!c||e.lineIndentl&&(l=e.lineIndent),DC(r))d++;else{if(e.lineIndent0){for(i=o,r=0;i>0;i--)(o=NC(s=e.input.charCodeAt(++e.position)))>=0?r=(r<<4)+o:GC(e,"expected hexadecimal character");e.result+=BC(r),e.position++}else GC(e,"unknown escape sequence");n=a=e.position}else DC(s)?(XC(e,n,a,!0),iM(e,nM(e,!1,t)),n=a=e.position):e.position===e.lineStart&&aM(e)?GC(e,"unexpected end of the document within a double quoted scalar"):(e.position++,a=e.position)}GC(e,"unexpected end of the stream within a double quoted scalar")}(e,h)?f=!0:!function(e){var t,n,a;if(42!==(a=e.input.charCodeAt(e.position)))return!1;for(a=e.input.charCodeAt(++e.position),t=e.position;0!==a&&!PC(a)&&!LC(a);)a=e.input.charCodeAt(++e.position);return e.position===t&&GC(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),wC.call(e.anchorMap,n)||GC(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],nM(e,!0,-1),!0}(e)?function(e,t,n){var a,i,r,o,s,c,l,d,u=e.kind,h=e.result;if(PC(d=e.input.charCodeAt(e.position))||LC(d)||35===d||38===d||42===d||33===d||124===d||62===d||39===d||34===d||37===d||64===d||96===d)return!1;if((63===d||45===d)&&(PC(a=e.input.charCodeAt(e.position+1))||n&&LC(a)))return!1;for(e.kind="scalar",e.result="",i=r=e.position,o=!1;0!==d;){if(58===d){if(PC(a=e.input.charCodeAt(e.position+1))||n&&LC(a))break}else if(35===d){if(PC(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&aM(e)||n&&LC(d))break;if(DC(d)){if(s=e.line,c=e.lineStart,l=e.lineIndent,nM(e,!1,-1),e.lineIndent>=t){o=!0,d=e.input.charCodeAt(e.position);continue}e.position=r,e.line=s,e.lineStart=c,e.lineIndent=l;break}}o&&(XC(e,i,r,!1),iM(e,e.line-s),i=r=e.position,o=!1),RC(d)||(r=e.position+1),d=e.input.charCodeAt(++e.position)}return XC(e,i,r,!1),!!e.result||(e.kind=u,e.result=h,!1)}(e,h,xC===n)&&(f=!0,null===e.tag&&(e.tag="?")):(f=!0,null===e.tag&&null===e.anchor||GC(e,"alias node should not have any properties")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===m&&(f=s&&rM(e,p))),null===e.tag)null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);else if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&GC(e,'unacceptable node kind for ! tag; it should be "scalar", not "'+e.kind+'"'),c=0,l=e.implicitTypes.length;c"),null!==e.result&&u.kind!==e.kind&&GC(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+u.kind+'", not "'+e.kind+'"'),u.resolve(e.result,e.tag)?(e.result=u.construct(e.result,e.tag),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):GC(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||f}function lM(e){var t,n,a,i,r=e.position,o=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);0!==(i=e.input.charCodeAt(e.position))&&(nM(e,!0,-1),i=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==i));){for(o=!0,i=e.input.charCodeAt(++e.position),t=e.position;0!==i&&!PC(i);)i=e.input.charCodeAt(++e.position);for(a=[],(n=e.input.slice(t,e.position)).length<1&&GC(e,"directive name must not be less than one character in length");0!==i;){for(;RC(i);)i=e.input.charCodeAt(++e.position);if(35===i){do{i=e.input.charCodeAt(++e.position)}while(0!==i&&!DC(i));break}if(DC(i))break;for(t=e.position;0!==i&&!PC(i);)i=e.input.charCodeAt(++e.position);a.push(e.input.slice(t,e.position))}0!==i&&tM(e),wC.call(KC,n)?KC[n](e,n,a):YC(e,'unknown document directive "'+n+'"')}nM(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,nM(e,!0,-1)):o&&GC(e,"directives end mark is expected"),cM(e,e.lineIndent-1,kC,!1,!0),nM(e,!0,-1),e.checkLineBreaks&&zC.test(e.input.slice(r,e.position))&&YC(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&aM(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,nM(e,!0,-1)):e.position=55296&&a<=56319&&t+1=56320&&n<=57343?1024*(a-55296)+n-56320+65536:a}function JM(e){return/^\n* /.test(e)}var ek=1,tk=2,nk=3,ak=4,ik=5;function rk(e,t,n,a,i,r,o,s){var c,l=0,d=null,u=!1,h=!1,p=-1!==a,m=-1,g=function(e){return GM(e)&&e!==mM&&!QM(e)&&e!==EM&&e!==IM&&e!==$M&&e!==SM&&e!==jM&&e!==OM&&e!==RM&&e!==LM&&e!==wM&&e!==CM&&e!==kM&&e!==yM&&e!==PM&&e!==AM&&e!==zM&&e!==MM&&e!==bM&&e!==xM&&e!==TM&&e!==DM}(XM(e,0))&&function(e){return!QM(e)&&e!==$M}(XM(e,e.length-1));if(t||o)for(c=0;c=65536?c+=2:c++){if(!GM(l=XM(e,c)))return ik;g=g&&KM(l,d,s),d=l}else{for(c=0;c=65536?c+=2:c++){if((l=XM(e,c))===fM)u=!0,p&&(h=h||c-m-1>a&&" "!==e[m+1],m=c);else if(!GM(l))return ik;g=g&&KM(l,d,s),d=l}h=h||p&&c-m-1>a&&" "!==e[m+1]}return u||h?n>9&&JM(e)?ik:o?r===qM?ik:tk:h?ak:nk:!g||o||i(e)?r===qM?ik:tk:ek}function ok(e,t,n,a,i){e.dump=function(){if(0===t.length)return e.quotingType===qM?'""':"''";if(!e.noCompatMode&&(-1!==FM.indexOf(t)||VM.test(t)))return e.quotingType===qM?'"'+t+'"':"'"+t+"'";var r=e.indent*Math.max(1,n),o=-1===e.lineWidth?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-r),s=a||e.flowLevel>-1&&n>=e.flowLevel;switch(rk(t,s,e.indent,o,(function(t){return function(e,t){var n,a;for(n=0,a=e.implicitTypes.length;n"+sk(t,e.indent)+ck(WM(function(e,t){var n,a,i=/(\n+)([^\n]*)/g,r=(s=e.indexOf("\n"),s=-1!==s?s:e.length,i.lastIndex=s,lk(e.slice(0,s),t)),o="\n"===e[0]||" "===e[0];var s;for(;a=i.exec(e);){var c=a[1],l=a[2];n=" "===l[0],r+=c+(o||n||""===l?"":"\n")+lk(l,t),o=n}return r}(t,o),r));case ik:return'"'+function(e){for(var t,n="",a=0,i=0;i=65536?i+=2:i++)a=XM(e,i),!(t=NM[a])&&GM(a)?(n+=e[i],a>=65536&&(n+=e[i+1])):n+=t||HM(a);return n}(t)+'"';default:throw new Rx("impossible error: invalid scalar style")}}()}function sk(e,t){var n=JM(e)?String(t):"",a="\n"===e[e.length-1];return n+(a&&("\n"===e[e.length-2]||"\n"===e)?"+":a?"":"-")+"\n"}function ck(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function lk(e,t){if(""===e||" "===e[0])return e;for(var n,a,i=/ [^ ]/g,r=0,o=0,s=0,c="";n=i.exec(e);)(s=n.index)-r>t&&(a=o>r?o:s,c+="\n"+e.slice(r,a),r=a+1),o=s;return c+="\n",e.length-r>t&&o>r?c+=e.slice(r,o)+"\n"+e.slice(o+1):c+=e.slice(r),c.slice(1)}function dk(e,t,n,a){var i,r,o,s="",c=e.tag;for(i=0,r=n.length;i tag resolver accepts not "'+c+'" style');a=s.represent[c](t,c)}e.dump=a}return!0}return!1}function hk(e,t,n,a,i,r,o){e.tag=null,e.dump=n,uk(e,n,!1)||uk(e,n,!0);var s,c=hM.call(e.dump),l=a;a&&(a=e.flowLevel<0||e.flowLevel>t);var d,u,h="[object Object]"===c||"[object Array]"===c;if(h&&(u=-1!==(d=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||u||2!==e.indent&&t>0)&&(i=!1),u&&e.usedDuplicates[d])e.dump="*ref_"+d;else{if(h&&u&&!e.usedDuplicates[d]&&(e.usedDuplicates[d]=!0),"[object Object]"===c)a&&0!==Object.keys(e.dump).length?(!function(e,t,n,a){var i,r,o,s,c,l,d="",u=e.tag,h=Object.keys(n);if(!0===e.sortKeys)h.sort();else if("function"==typeof e.sortKeys)h.sort(e.sortKeys);else if(e.sortKeys)throw new Rx("sortKeys must be a boolean or a function");for(i=0,r=h.length;i1024)&&(e.dump&&fM===e.dump.charCodeAt(0)?l+="?":l+="? "),l+=e.dump,c&&(l+=ZM(e,t)),hk(e,t+1,s,!0,c)&&(e.dump&&fM===e.dump.charCodeAt(0)?l+=":":l+=": ",d+=l+=e.dump));e.tag=u,e.dump=d||"{}"}(e,t,e.dump,i),u&&(e.dump="&ref_"+d+e.dump)):(!function(e,t,n){var a,i,r,o,s,c="",l=e.tag,d=Object.keys(n);for(a=0,i=d.length;a1024&&(s+="? "),s+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),hk(e,t,o,!1,!1)&&(c+=s+=e.dump));e.tag=l,e.dump="{"+c+"}"}(e,t,e.dump),u&&(e.dump="&ref_"+d+" "+e.dump));else if("[object Array]"===c)a&&0!==e.dump.length?(e.noArrayIndent&&!o&&t>0?dk(e,t-1,e.dump,i):dk(e,t,e.dump,i),u&&(e.dump="&ref_"+d+e.dump)):(!function(e,t,n){var a,i,r,o="",s=e.tag;for(a=0,i=n.length;a",e.dump=s+" "+e.dump)}return!0}function pk(e,t){var n,a,i=[],r=[];for(mk(e,i,r),n=0,a=r.length;nq`
${fk.dump(e)}
`;return q`
+
+
+ +
+
+ + ${this.message?q`${this.message}${this.context&&"string"==typeof this.context?": "+this.context:""}`:""} + + ${this.context&&Array.isArray(this.context)?this.context.map((e=>n(e))):"object"==typeof this.context?n(this.context):""} +
+
+
`}static get styles(){return o(_k)}};e([he({attribute:!1})],vk.prototype,"message",void 0),e([he({attribute:!1})],vk.prototype,"context",void 0),e([he({attribute:!1})],vk.prototype,"icon",void 0),e([he({attribute:!0,type:Boolean})],vk.prototype,"dotdotdot",void 0),vk=e([le("frigate-card-message")],vk);let yk=class extends se{render(){if(this.message)return q` ${V_("error.troubleshooting")}.`} + .icon=${this.message.icon??"mdi:alert-circle"} + .context=${this.message.context} + .dotdotdot=${this.message.dotdotdot} + > + `}static get styles(){return o(_k)}};e([he({attribute:!1})],yk.prototype,"message",void 0),yk=e([le("frigate-card-error-message")],yk);let bk=class extends se{constructor(){super(...arguments),this.message="",this.animated=!1,this.size="large"}render(){return q`
+ ${this.animated?q` + `:q``} + ${this.message?q`${this.message}`:q``} +
`}static get styles(){return o(_k)}};function wk(e){return"error"===e?.type?q` `:e?q` `:q``}function xk(e){return q` + + + `}function Ck(e,t,n,a){Bg(e,"message",{message:t,type:n,icon:a?.icon,context:a?.context})}function Mk(e,t,n){Ck(e,t,"error",{context:n?.context})}function kk(e,t){t instanceof Error&&Mk(e,t.message,{...t instanceof zs&&{context:t.context}})}e([he({attribute:!1})],bk.prototype,"message",void 0),e([he({attribute:!1})],bk.prototype,"animated",void 0),e([he({attribute:!1})],bk.prototype,"size",void 0),bk=e([le("frigate-card-progress-indicator")],bk);let Sk=class extends se{constructor(){super(...arguments),this._root=null}createRenderRoot(){return this}_createRoot(){const e=customElements.get("hui-conditional-element");if(!e||!this.hass)throw new Error(V_("error.could_not_render_elements"));const t=new e;t.hass=this.hass;const n={type:"conditional",conditions:[],elements:this.elements};try{t.setConfig(n)}catch(e){throw Gg(e,console.error),new zs(V_("error.invalid_elements_config"))}return t}willUpdate(e){try{!this.elements||this._root&&!e.has("elements")||(this._root=this._createRoot())}catch(e){return kk(this,e)}}render(){return q`${this._root||""}`}updated(){this.hass&&this._root&&(this._root.hass=this.hass)}};e([he({attribute:!1})],Sk.prototype,"elements",void 0),e([he({attribute:!1})],Sk.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],Sk.prototype,"hass",void 0),Sk=e([le("frigate-card-elements-core")],Sk);let Ek=class extends se{constructor(){super(...arguments),this._menuRemoveHandler=e=>{Bg(this,"menu:remove",e.detail)},this._statusBarRemoveHandler=e=>{Bg(this,"status-bar:remove",e.detail)},this._menuAddHandler=e=>{const t=e.composedPath();t.length&&this._addHandler(t[0],"frigate-card:menu:remove",this._menuRemoveHandler)},this._statusBarAddHandler=e=>{const t=e.composedPath();t.length&&this._addHandler(t[0],"frigate-card:status-bar:add",this._statusBarRemoveHandler)}}_addHandler(e,t,n){e.removeEventListener(t,n),e.addEventListener(t,n)}connectedCallback(){super.connectedCallback(),this.addEventListener("frigate-card:menu:add",this._menuAddHandler),this.addEventListener("frigate-card:status-bar:add",this._statusBarAddHandler)}disconnectedCallback(){this.removeEventListener("frigate-card:menu:add",this._menuAddHandler),this.addEventListener("frigate-card:status-bar:add",this._statusBarAddHandler),super.disconnectedCallback()}render(){return q` + `}static get styles(){return o(":host {\n position: absolute;\n inset: 0;\n overflow: hidden;\n pointer-events: none;\n}\n\n.element {\n position: absolute;\n transform: translate(-50%, -50%);\n pointer-events: auto;\n}\n\nhui-error-card.element {\n inset: 0px;\n transform: unset;\n}")}};e([he({attribute:!1})],Ek.prototype,"hass",void 0),e([he({attribute:!1})],Ek.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],Ek.prototype,"elements",void 0),Ek=e([le("frigate-card-elements")],Ek);let $k=class extends se{setConfig(e){this._config=e}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.className=""}render(){if(function(e,t){if(!t)return!0;const n=new _w(t,{bubbles:!0,composed:!0});return e.dispatchEvent(n),n.evaluation??!1}(this,this._config?.conditions))return q` + `}};e([he({attribute:!1,hasChanged:()=>!0})],$k.prototype,"hass",void 0),$k=e([le("frigate-card-conditional")],$k);class Ak extends se{constructor(e){super(),this._config=null,this._eventCategory=e}setConfig(e){this._config=e}connectedCallback(){super.connectedCallback(),this._config&&Bg(this,`${this._eventCategory}:add`,this._config)}disconnectedCallback(){this._config&&Bg(this,`${this._eventCategory}:remove`,this._config),super.disconnectedCallback()}}e([pe()],Ak.prototype,"_config",void 0);class zk extends Ak{constructor(){super("menu")}}let Ik=class extends zk{};Ik=e([le("frigate-card-menu-icon")],Ik);let Tk=class extends zk{};Tk=e([le("frigate-card-menu-state-icon")],Tk);let jk=class extends zk{};jk=e([le("frigate-card-menu-submenu")],jk);let Ok=class extends zk{};Ok=e([le("frigate-card-menu-submenu-select")],Ok);class Dk extends Ak{constructor(){super("status-bar")}}let Rk=class extends Dk{};Rk=e([le("frigate-card-status-bar-icon")],Rk);let Pk=class extends Dk{};Pk=e([le("frigate-card-status-bar-image")],Pk);let Lk=class extends Dk{};Lk=e([le("frigate-card-status-bar-string")],Lk);let Nk=class extends se{render(){return q` `}static get styles(){return o(":host {\n width: intrinsic;\n height: intrinsic;\n display: flex;\n justify-content: center;\n align-items: center;\n pointer-events: none;\n}\n\nimg {\n width: 10%;\n animation: rotate 8s linear infinite;\n}\n\n@keyframes rotate {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}")}};Nk=e([le("frigate-card-loading")],Nk);const Fk=(e,t)=>{Bg(e,"action:execution-request",t)};class Vk{constructor(e){this._config=null,this._buttons=[],this._expanded=!1,this._host=e}setMenuConfig(e){this._config=e,this._host.style.setProperty("--frigate-card-menu-button-size",`${e.button_size}px`),this._host.setAttribute("data-style",e.style),this._host.setAttribute("data-position",e.position),this._host.setAttribute("data-alignment",e.alignment),this._sortButtons(),this._host.requestUpdate()}getMenuConfig(){return this._config}isExpanded(){return this._expanded}setButtons(e){this._buttons=e,this._sortButtons(),this._host.requestUpdate()}getButtons(e){const t=e=>!this._isHidingMenu()||this._expanded||!!e.permanent;return this._buttons.filter((n=>(e=>!1!==e.enabled)(n)&&(t=>t.alignment===e||"matching"===e&&!t.alignment)(n)&&t(n)))}setExpanded(e){this._expanded=e,of(this._host,e,"expanded"),this._host.requestUpdate()}toggleExpanded(){this.setExpanded(!this._expanded)}actionHandler(e,t){if(e.stopPropagation(),e.detail.config&&(t=e.detail.config),!t)return;const n=e.detail.action,a=yf(n,t);if(!a)return;const i=Wg(a);let r=!1;const o=i.filter((e=>sf(e)&&!this._isUnknownActionMenuToggleAction(e)));if(o.length!=i.length&&(r=!0),o.length&&Fk(this._host,{action:i,config:t}),this._isHidingMenu())if(r)this.setExpanded(!this._expanded);else{const e=yf("hold",t),a=yf("double_tap",t),i=yf("tap",t),r=yf("end_tap",t);"end_tap"!==n&&("start_tap"!==n||e||a||i||r)&&("end_tap"===n||r)||this.setExpanded(!1)}}getFreshButtonState(e,t){const n={...t};return e&&"custom:frigate-card-menu-state-icon"===t.type?Pb(e,n):n}_sortButtons(){this._buttons=Ev(this._buttons,(e=>(e.priority??0)+(this._isHidingMenu()&&e.permanent?Us:0)),["desc"])}_isHidingMenu(){return"hidden"===this._config?.style}_isUnknownActionMenuToggleAction(e){const t=mf(e);return!!t&&"menu_toggle"==t.frigate_card_action}}var Hk="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' version='1.1' id='svg54' sodipodi:docname='frigate.svg' inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3e %3cdefs id='defs58' /%3e %3csodipodi:namedview id='namedview56' pagecolor='%23da4040' bordercolor='%23666666' borderopacity='1.0' inkscape:pageshadow='2' inkscape:pageopacity='0' inkscape:pagecheckerboard='0' showgrid='false' width='24px' inkscape:zoom='45.254834' inkscape:cx='-0.03314563' inkscape:cy='9.9768347' inkscape:window-width='3840' inkscape:window-height='1527' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='svg54' showguides='true' inkscape:showpageshadow='2' inkscape:deskcolor='%23d1d1d1' /%3e %3cpath d='m 4.8759466%2c22.743573 c 0.0866%2c0.69274 0.811811%2c1.16359 0.37885%2c1.27183 -0.43297%2c0.10824 -2.32718%2c-3.43665 -2.7601492%2c-4.95202 -0.4329602%2c-1.51538 -0.6764993%2c-3.22017 -0.5682593%2c-4.19434 0.1082301%2c-0.97417 5.7097085%2c-2.48955 5.7097085%2c-2.89545 0%2c-0.4059 -1.81304%2c-0.0271 -1.89422%2c-0.35178 -0.0812%2c-0.32472 1.36925%2c-0.12989 1.75892%2c-0.64945 0.60885%2c-0.81181 1.3800713%2c-0.6765 1.8671505%2c-1.1094696 0.4870902%2c-0.4329599 1.0824089%2c-2.0836399 1.1906589%2c-2.7871996 0.108241%2c-0.70357 -1.0824084%2c-1.51538 -1.4071389%2c-2.05658 -0.3247195%2c-0.54121 0.7035702%2c-0.92005 3.1931099%2c-1.94834 2.48954%2c-1.02829 10.39114%2c-3.30134994 10.49938%2c-3.03074994 0.10824%2c0.27061 -2.59779%2c1.40713994 -4.492%2c2.11069994 -1.89422%2c0.70357 -4.97909%2c2.05658 -4.97909%2c2.43542 0%2c0.37885 0.16236%2c0.67651 0.0541%2c1.54244 -0.10824%2c0.86593 -0.12123%2c1.2702597 -0.32472%2c1.8400997 -0.1353%2c0.37884 -0.2706%2c1.27183 0%2c2.0836295 0.21648%2c0.64945 0.92005%2c1.13653 1.24477%2c1.24478 0.2706%2c0.018 1.01746%2c0.0433 1.8401%2c0 1.02829%2c-0.0541 2.48954%2c0.0541 2.48954%2c0.32472 0%2c0.2706 -2.21894%2c0.10824 -2.21894%2c0.48708 0%2c0.37885 2.27306%2c-0.0541 2.21894%2c0.32473 -0.0541%2c0.37884 -1.89422%2c0.21648 -2.86839%2c0.21648 -0.77933%2c0 -1.93031%2c-0.0361 -2.43542%2c-0.21648 l -0.10824%2c0.37884 c -0.18038%2c0 -0.55744%2c0.10824 -0.94711%2c0.10824 -0.48708%2c0 -0.51414%2c0.16236 -1.40713%2c0.16236 -0.892989%2c0 -0.622391%2c-0.0541 -1.4341894%2c-0.10824 -0.81181%2c-0.0541 -3.842561%2c2.27306 -4.383761%2c3.03075 -0.54121%2c0.75768 -0.21649%2c2.59778 -0.21649%2c3.43665 0%2c0.75379 -0.10824%2c2.43542 0%2c3.30135 z' fill='black' id='path330' style='fill:white%3bfill-opacity:1%3bstroke:none%3bstroke-width:0.1%3bstroke-miterlimit:4%3bstroke-dasharray:none%3bstroke-opacity:1' sodipodi:nodetypes='csccscccccsscscccccsscsccssccscc' /%3e%3c/svg%3e",Bk="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3c!-- Created with Inkscape (http://www.inkscape.org/) --%3e%3csvg id='svg2' version='1.1' inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' width='24' height='24' xml:space='preserve' sodipodi:docname='motioneye.svg' inkscape:export-filename='/home/ccrisan/projects/motioneye/static/img/motioneye-logo.png' inkscape:export-xdpi='960' inkscape:export-ydpi='960' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23' xmlns:cc='http://creativecommons.org/ns%23' xmlns:dc='http://purl.org/dc/elements/1.1/'%3e%3cmetadata id='metadata8'%3e%3crdf:RDF%3e%3ccc:Work rdf:about=''%3e%3cdc:format%3eimage/svg%2bxml%3c/dc:format%3e%3cdc:type rdf:resource='http://purl.org/dc/dcmitype/StillImage' /%3e%3c/cc:Work%3e%3c/rdf:RDF%3e%3c/metadata%3e%3cdefs id='defs6'%3e%3clinearGradient inkscape:collect='always' id='linearGradient2058'%3e%3cstop style='stop-color:white%3bstop-opacity:1%3b' offset='0' id='stop2054' /%3e%3cstop style='stop-color:%23585858%3bstop-opacity:1' offset='1' id='stop2056' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' id='linearGradient2005'%3e%3cstop style='stop-color:white%3bstop-opacity:1%3b' offset='0' id='stop2001' /%3e%3cstop style='stop-color:grey%3bstop-opacity:1%3b' offset='1' id='stop2003' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' id='linearGradient4205'%3e%3cstop style='stop-color:%234aa3e0%3bstop-opacity:1' offset='0' id='stop4207' /%3e%3cstop style='stop-color:%233096db%3bstop-opacity:1' offset='1' id='stop4209' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' id='linearGradient4197'%3e%3cstop style='stop-color:white%3bstop-opacity:1%3b' offset='0' id='stop4199' /%3e%3cstop style='stop-color:%23585858%3bstop-opacity:1' offset='1' id='stop4201' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient4205' id='linearGradient4211' x1='26.602072' y1='43.034946' x2='26.602072' y2='29.466328' gradientUnits='userSpaceOnUse' gradientTransform='matrix(0.96428571%2c0%2c0%2c0.96428571%2c0.91428571%2c0.91428571)' /%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4285'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4287' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4289' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.6' result='blur' id='feGaussianBlur4291' /%3e%3cfeOffset dx='0' dy='-1' result='offset' id='feOffset4293' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4295' /%3e%3c/filter%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient2005' id='linearGradient4309' gradientUnits='userSpaceOnUse' x1='26.445793' y1='47.517574' x2='26.445793' y2='3.8183768' /%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient4197' id='linearGradient4311' gradientUnits='userSpaceOnUse' x1='26.445793' y1='47.517574' x2='26.445793' y2='3.8183768' /%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient2058' id='linearGradient4313' gradientUnits='userSpaceOnUse' x1='26.445793' y1='47.517574' x2='26.445793' y2='3.8183768' /%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4315' x='-0.03618178' y='-0.20783284' width='1.0723636' height='1.3304883'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4317' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4319' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.6' result='blur' id='feGaussianBlur4321' /%3e%3cfeOffset dx='0' dy='-1' result='offset' id='feOffset4323' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4325' /%3e%3c/filter%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4327' x='-0.27857143' y='-0.4720238' width='1.5571429' height='1.7505952'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4329' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4331' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.6' result='blur' id='feGaussianBlur4333' /%3e%3cfeOffset dx='0' dy='-1' result='offset' id='feOffset4335' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4337' /%3e%3c/filter%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4339' x='-0.0202507' y='-0.13980794' width='1.0405014' height='1.2082853'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4341' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4343' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.2' result='blur' id='feGaussianBlur4345' /%3e%3cfeOffset dx='0' dy='-0.5' result='offset' id='feOffset4347' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4349' /%3e%3c/filter%3e%3c/defs%3e%3csodipodi:namedview pagecolor='%23ff0d0d' bordercolor='%23666666' borderopacity='1' objecttolerance='10' gridtolerance='10' guidetolerance='10' inkscape:pageopacity='0' inkscape:pageshadow='2' inkscape:window-width='3840' inkscape:window-height='1527' id='namedview4' showgrid='false' inkscape:zoom='29.890116' inkscape:cx='19.973158' inkscape:cy='16.577386' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='g10' showguides='true' inkscape:guide-bbox='true' inkscape:showpageshadow='true' inkscape:pagecheckerboard='false' inkscape:deskcolor='%23d1d1d1' /%3e%3cg id='g10' inkscape:groupmode='layer' inkscape:label='ink_ext_XXXXXX' transform='matrix(1.25%2c0%2c0%2c-1.25%2c0%2c64)'%3e%3cg id='g4823' transform='matrix(1.0344694%2c0%2c0%2c1.0344694%2c-3.551886%2c-0.86695248)'%3e%3cpath id='path4244' d='M 8.9346154%2c40.515385 C 5.3647588%2c36.547307 3.2%2c31.357779 3.2%2c25.6 3.2%2c13.228821 13.228821%2c3.2 25.6%2c3.2 37.971179%2c3.2 48%2c13.228821 48%2c25.6 c 0%2c5.736682 -2.161128%2c10.952493 -5.707692%2c14.915385 -1.695935%2c-0.623286 -3.387833%2c-1.349065 -5.061539%2c-2.288462 3.2394%2c-0.937363 5.6%2c-3.937988 5.6%2c-7.457692 0%2c-4.260339 -3.469626%2c-7.753846 -7.753846%2c-7.753846 -3.633936%2c0 -6.690552%2c2.51055 -7.538461%2c5.869231 h -3.876924 c -0.840685%2c-3.360193 -3.903443%2c-5.869231 -7.538461%2c-5.869231 -4.284219%2c0 -7.7807693%2c3.493507 -7.7807693%2c7.753846 0%2c3.56112 2.4570323%2c6.5856 5.7615383%2c7.484616 -1.676267%2c0.912203 -3.404813%2c1.620556 -5.1692306%2c2.261538 z M 25.6%2c26.461538 c 0.532632%2c-1.981435 1.101793%2c-3.947553 3.446154%2c-5.16923 L 25.6%2c16.123077 22.153846%2c21.292308 c 2.053593%2c1.454966 3.000771%2c3.237758 3.446154%2c5.16923 z' style='fill:url(%23linearGradient4309)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4327)' inkscape:connector-curvature='0' transform='matrix(0.38078533%2c0%2c0%2c0.38078533%2c2.9655495%2c31.335499)' /%3e%3cpath id='path4242' d='m 16.123077%2c33.353847 c -1.427443%2c0 -2.584616%2c-1.157173 -2.584616%2c-2.584616 0%2c-1.427444 1.157173%2c-2.584615 2.584616%2c-2.584615 1.427444%2c0 2.584615%2c1.157171 2.584615%2c2.584615 0%2c1.427443 -1.157171%2c2.584616 -2.584615%2c2.584616 z' style='fill:url(%23linearGradient4311)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4327)' inkscape:connector-curvature='0' transform='matrix(0.38078533%2c0%2c0%2c0.38078533%2c2.9655495%2c31.335499)' /%3e%3cpath id='path4240' d='m 35.076923%2c33.353847 c -1.427443%2c0 -2.584615%2c-1.157173 -2.584615%2c-2.584616 0%2c-1.427444 1.157172%2c-2.584615 2.584615%2c-2.584615 1.427443%2c0 2.584616%2c1.157171 2.584616%2c2.584615 0%2c1.427443 -1.157173%2c2.584616 -2.584616%2c2.584616 z' style='fill:url(%23linearGradient4313)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4327)' inkscape:connector-curvature='0' transform='matrix(0.38078533%2c0%2c0%2c0.38078533%2c2.9655495%2c31.335499)' /%3e%3cpath inkscape:connector-curvature='0' style='fill:%23d9d9d9%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4339)' d='m 25.6%2c47.2 c -4.373944%2c0 -8.437159%2c-1.399808 -11.838461%2c-3.634616 3.677605%2c-0.394237 7.305921%2c-1.342945 11.423077%2c-3.375 4.166157%2c2.122533 8.434154%2c3.008875 12.279808%2c3.452886 C 34.057131%2c45.890032 29.986674%2c47.2 25.6%2c47.2 Z' id='path4248' transform='matrix(0.39488848%2c0%2c0%2c0.39488848%2c2.6045087%2c30.974457)' /%3e%3cpath inkscape:connector-curvature='0' style='fill:url(%23linearGradient4211)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4315)' d='M 39.723077%2c42.552884 C 35.394064%2c42.5242 29.479588%2c40.397223 25.184616%2c38.432418 20.668821%2c40.064102 16.035448%2c42.649343 10.801923%2c42.526924 10.453022%2c42.51873 10.118061%2c42.50105 9.7634616%2c42.475 L 5.6615384%2c42.1375 9.5557693%2c40.839424 c 5.3417977%2c-1.74056 10.0398397%2c-2.851302 14.1749997%2c-10.025963 0.959101%2c0 2.845924%2c-4.15e-4 3.738462%2c-4.15e-4 4.11884%2c7.134039 9.059296%2c8.324614 14.149039%2c10.026378 L 45.460577%2c42.085577 41.4625%2c42.475 c -0.544847%2c0.05181 -1.120992%2c0.08198 -1.739423%2c0.07788 z' id='path4246' sodipodi:nodetypes='cccccccccccc' transform='matrix(0.39488848%2c0%2c0%2c0.39488848%2c2.6045087%2c30.974457)' /%3e%3c/g%3e%3c/g%3e%3c/svg%3e",qk="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3c!-- Created with Inkscape (http://www.inkscape.org/) --%3e%3csvg version='1.1' id='svg62' width='24' height='24' viewBox='0 0 24 24' sodipodi:docname='reolink.svg' inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3e %3cdefs id='defs66' /%3e %3csodipodi:namedview id='namedview64' pagecolor='%23505050' bordercolor='%23eeeeee' borderopacity='1' inkscape:showpageshadow='0' inkscape:pageopacity='0' inkscape:pagecheckerboard='0' inkscape:deskcolor='%23505050' showgrid='true' inkscape:zoom='36.417984' inkscape:cx='18.191562' inkscape:cy='8.6633022' inkscape:window-width='3840' inkscape:window-height='1527' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='g68'%3e %3cinkscape:grid type='xygrid' id='grid1175' dotted='false' snapvisiblegridlinesonly='true' /%3e %3c/sodipodi:namedview%3e %3cg inkscape:groupmode='layer' inkscape:label='Reolink Logo' id='g68'%3e %3cpath style='fill:white%3bstroke-width:0.0393282%3bfill-opacity:1' d='M 17.037254%2c23.964909 C 16.764634%2c23.917573 16.561708%2c23.83617 16.325735%2c23.67954 16.196719%2c23.593913 14.543544%2c21.952905 12.217956%2c19.602014 10.077426%2c17.438191 8.2198993%2c15.582673 8.0901166%2c15.478642 7.6038998%2c15.088895 7.0877741%2c14.869424 6.4986827%2c14.801908 6.3140805%2c14.780765 5.079061%2c14.763305 3.7541964%2c14.763126 l -2.408845%2c-4.78e-4 0.00713%2c-7.3937713 v -7.3935985 l 6.2040046%2c3.536e-5 c 3.9799342%2c1.969e-5 6.3590882%2c0.01465833 6.6366112%2c0.0408227 2.331195%2c0.21982024 4.364771%2c1.49885914 5.578726%2c3.50085534 0.686043%2c1.1313823 1.020901%2c2.2783695 1.067186%2c3.6554196 0.06335%2c1.8844953 -0.57426%2c3.6597378 -1.831469%2c5.0992438 -0.756457%2c0.866146 -1.861127%2c1.62991 -2.928729%2c2.024919 l -0.319718%2c0.118287 -1.951287%2c-1.979284 -1.951286%2c-1.979278 1.046741%2c-0.02346 c 0.575706%2c-0.01291 1.099833%2c-0.03689 1.164724%2c-0.0533 0.596068%2c-0.150649 0.949703%2c-0.313968 1.322206%2c-0.6106282 0.643573%2c-0.5125401 1.046169%2c-1.2439257 1.137985%2c-2.0673522 0.167852%2c-1.505317 -0.771478%2c-2.8704888 -2.263547%2c-3.2897068 L 13.950001%2c4.3234481 9.7981831%2c4.3106846 5.6392389%2c4.29801 v 3.0692702 3.0692648 l 1.4185165%2c7.9e-4 c 1.6275801%2c8.87e-4 1.7789152%2c0.01912 2.3105245%2c0.27984 0.3095679%2c0.15183 0.389559%2c0.219499 1.0817441%2c0.915083 3.027399%2c3.042274 12.19404%2c12.30837 12.204589%2c12.337002 0.0161%2c0.04373 -5.364393%2c0.03953 -5.617359%2c-0.0045 z' id='path1173' inkscape:label='R' /%3e %3c/g%3e%3c/svg%3e";const Uk=e=>{switch(e){case"frigate":return Hk;case"motioneye":return Bk;case"reolink":return qk;default:return null}};const Wk=(e,t,n)=>{const a=e.states[t],i=n?.state?n.state:a?a.state:null;if(!i)return null;const r=Ye(t),o=a?a.attributes:null;return n?.entity?.translation_key&&e.localize(`component.${n.entity.platform}.entity.${r}.${n.entity.translation_key}.state.${i}`)||o?.device_class&&e.localize(`component.${r}.state.${o.device_class}.${i}`)||e.localize(`component.${r}.state._.${i}`)||i};let Zk=class extends se{_renderItem(e){if(!this.hass)return;const t=Pb(this.hass,{...e});return q` + {t.detail.config=e}} + .actionHandler=${kf({hasHold:bf(e.hold_action),hasDoubleClick:bf(e.double_tap_action)})} + > + ${t.title||""} + ${e.subtitle?q`${e.subtitle}`:""} + ${(e=>{if(e.icon){const t=Uk(e.icon);return t?q``:q` + `}return q``})(t)} + + `}render(){if(!this.submenu)return q``;const e=this.submenu.items;return q` + e.stopPropagation()} + @click=${e=>wf(e)} + > + + + + ${e.map(this._renderItem.bind(this))} + + `}static get styles(){return o("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n pointer-events: auto;\n}\n\nmwc-list-item {\n z-index: 20;\n}")}};e([he({attribute:!1})],Zk.prototype,"hass",void 0),e([he({attribute:!1})],Zk.prototype,"submenu",void 0),Zk=e([le("frigate-card-submenu")],Zk);let Qk=class extends se{shouldUpdate(e){const t=e.get("hass");return!e.has("hass")||!t||!this.submenuSelect||jb(this.hass,t,[this.submenuSelect.entity])}async _refreshOptionTitles(){if(!this.hass||!this.submenuSelect)return;const e=this.submenuSelect.entity,t=this.hass.states[e],n=t?.attributes?.options,a=await(this.entityRegistryManager?.getEntity(this.hass,e))??null,i={};for(const t of n){const n=Wk(this.hass,e,{...a&&{entity:a},state:t});n&&(i[t]=n)}this._optionTitles=i}willUpdate(){if(!this.submenuSelect||!this.hass)return;this._optionTitles||this._refreshOptionTitles();const e=this.submenuSelect.entity,t=this.hass.states[e],n=t?.attributes?.options;if(!t||!n)return;const a={icon:zb("select"),...Pb(this.hass,this.submenuSelect),...this.submenuSelect,type:"custom:frigate-card-menu-submenu",items:[]};delete a.options;const i=a.items;for(const a of n){const n=this._optionTitles?.[a]??a;i.push({state_color:!0,selected:t.state===a,enabled:!0,title:n||a,...(e.startsWith("select.")||e.startsWith("input_select."))&&{tap_action:{action:"perform-action",perform_action:e.startsWith("select.")?"select.select_option":"input_select.select_option",target:{entity_id:e},data:{option:a}}},...this.submenuSelect.options&&this.submenuSelect.options[a]})}this._generatedSubmenu=a}render(){return q` `}};e([he({attribute:!1})],Qk.prototype,"hass",void 0),e([he({attribute:!1})],Qk.prototype,"submenuSelect",void 0),e([he({attribute:!1})],Qk.prototype,"entityRegistryManager",void 0),e([pe()],Qk.prototype,"_optionTitles",void 0),Qk=e([le("frigate-card-submenu-select")],Qk);let Gk=class extends se{constructor(){super(...arguments),this._controller=new Vk(this)}set menuConfig(e){this._controller.setMenuConfig(e)}set buttons(e){this._controller.setButtons(e)}set expanded(e){this._controller.setExpanded(e)}toggleMenu(){this._controller.toggleExpanded()}_renderButton(e){if(!this.hass)return;if("custom:frigate-card-menu-submenu"===e.type)return q` this._controller.actionHandler(e)} + > + `;if("custom:frigate-card-menu-submenu-select"===e.type)return q` this._controller.actionHandler(e)} + > + `;const t=this._controller.getFreshButtonState(this.hass,e),n=Uk(t.icon);return q` this._controller.actionHandler(t,e)} + > + ${n?q``:q``} + `}render(){const e=this._controller.getMenuConfig(),t=e?.style;if(!e||"none"===t)return;const n=this._controller.getButtons("matching"),a=this._controller.getButtons("opposing");return q`
+ ${n.map((e=>this._renderButton(e)))} +
+
+ ${a.map((e=>this._renderButton(e)))} +
`}static get styles(){return o('ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n --frigate-card-menu-button-size: 40px;\n --mdc-icon-button-size: var(--frigate-card-menu-button-size);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n pointer-events: auto;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n}\n\n/*******************************************************\n * Non-hover styles should not interact with the pointer\n *******************************************************/\n:host(:not([data-style*=hover])) {\n pointer-events: none;\n}\n\n/***********************************\n * Aligned divs: matching & opposing\n ***********************************/\ndiv.matching,\ndiv.opposing {\n display: flex;\n flex-wrap: wrap;\n flex-direction: row;\n align-items: flex-start;\n min-width: 0px;\n min-height: 0px;\n}\n\ndiv.matching {\n justify-content: flex-start;\n}\n\ndiv.opposing {\n justify-content: flex-end;\n}\n\n/********************\n * Outside menu style\n ********************/\n:host([data-style=outside]) {\n width: 100%;\n background: var(--secondary-background-color);\n}\n\n/********************************************************\n * Hack: Ensure host & div expand for column flex layouts\n ********************************************************/\n:host(:not([data-style=outside])[data-position=left]) {\n writing-mode: vertical-lr;\n}\n\n:host(:not([data-style=outside])[data-position=right]) {\n writing-mode: vertical-rl;\n}\n\n:host(:not([data-style=outside])[data-style=overlay][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style=overlay][data-position=right]) div > *,\n:host(:not([data-style=outside])[data-style*=hover][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style*=hover][data-position=right]) div > *,\n:host(:not([data-style=outside])[data-style=hidden][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style=hidden][data-position=right]) div > * {\n writing-mode: horizontal-tb;\n}\n\n/**********************\n * "Reverse" alignments\n **********************/\n:host(:not([data-style=outside])[data-position=left][data-alignment=bottom]),\n:host(:not([data-style=outside])[data-position=right][data-alignment=bottom]),\n:host([data-position=top][data-alignment=right]),\n:host([data-position=bottom][data-alignment=right]),\n:host(:not([data-style=outside])[data-position=left][data-alignment=bottom]) div,\n:host(:not([data-style=outside])[data-position=right][data-alignment=bottom]) div,\n:host([data-position=top][data-alignment=right]) div,\n:host([data-position=bottom][data-alignment=right]) div {\n flex-direction: row-reverse;\n}\n\n/****************************\n * Wrap upwards on the bottom\n ****************************/\n:host(:not([data-style=outside])[data-position=bottom]) div {\n flex-wrap: wrap-reverse;\n}\n\n/********************************************\n * Positioning for absolute based menu styles\n ********************************************/\n:host([data-style=overlay]),\n:host([data-style*=hover]),\n:host([data-style=hidden]) {\n overflow: hidden;\n width: calc(var(--frigate-card-menu-button-size) + 6px);\n height: calc(var(--frigate-card-menu-button-size) + 6px);\n}\n\n:host([data-style=overlay]),\n:host([data-style*=hover]),\n:host([data-style=hidden][expanded]) {\n overflow: visible;\n}\n\n:host([data-style=overlay][data-position=top]),\n:host([data-style=overlay][data-position=bottom]),\n:host([data-style*=hover][data-position=top]),\n:host([data-style*=hover][data-position=bottom]),\n:host([data-style=hidden][data-position=top]),\n:host([data-style=hidden][data-position=bottom]) {\n width: 100%;\n height: auto;\n}\n\n:host([data-style=overlay][data-position=top][data-alignment=left]),\n:host([data-style=overlay][data-position=bottom][data-alignment=left]),\n:host([data-style*=hover][data-position=top][data-alignment=left]),\n:host([data-style*=hover][data-position=bottom][data-alignment=left]),\n:host([data-style=hidden][data-position=top][data-alignment=left][expanded]),\n:host([data-style=hidden][data-position=bottom][data-alignment=left][expanded]) {\n background: linear-gradient(90deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=top][data-alignment=right]),\n:host([data-style=overlay][data-position=bottom][data-alignment=right]),\n:host([data-style*=hover][data-position=top][data-alignment=right]),\n:host([data-style*=hover][data-position=bottom][data-alignment=right]),\n:host([data-style=hidden][data-position=top][data-alignment=right][expanded]),\n:host([data-style=hidden][data-position=bottom][data-alignment=right][expanded]) {\n background: linear-gradient(270deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=left]),\n:host([data-style=overlay][data-position=right]),\n:host([data-style*=hover][data-position=left]),\n:host([data-style*=hover][data-position=right]),\n:host([data-style=hidden][data-position=left]),\n:host([data-style=hidden][data-position=right]) {\n width: auto;\n height: 100%;\n}\n\n:host([data-style=overlay][data-position=left][data-alignment=top]),\n:host([data-style=overlay][data-position=right][data-alignment=top]),\n:host([data-style*=hover][data-position=left][data-alignment=top]),\n:host([data-style*=hover][data-position=right][data-alignment=top]),\n:host([data-style=hidden][data-position=left][data-alignment=top][expanded]),\n:host([data-style=hidden][data-position=right][data-alignment=top][expanded]) {\n background: linear-gradient(180deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=left][data-alignment=bottom]),\n:host([data-style=overlay][data-position=right][data-alignment=bottom]),\n:host([data-style*=hover][data-position=left][data-alignment=bottom]),\n:host([data-style*=hover][data-position=right][data-alignment=bottom]),\n:host([data-style=hidden][data-position=left][data-alignment=bottom][expanded]),\n:host([data-style=hidden][data-position=right][data-alignment=bottom][expanded]) {\n background: linear-gradient(0deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}')}};e([he({attribute:!1})],Gk.prototype,"entityRegistryManager",void 0),e([he({attribute:!1})],Gk.prototype,"hass",void 0),Gk=e([le("frigate-card-menu")],Gk);let Yk=class extends se{render(){return q` + + + + + `}static get styles(){return o("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n position: absolute;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n\nslot {\n position: absolute;\n display: flex;\n}\n\n/***************\n * Slot position\n ***************/\nslot[name=top] {\n top: 0px;\n}\n\nslot[name=bottom] {\n bottom: 0px;\n}\n\nslot[name=left] {\n left: 0px;\n}\n\nslot[name=right] {\n right: 0px;\n}\n\n/***********\n * Slot size\n ***********/\nslot[name=top],\nslot[name=bottom] {\n width: 100%;\n flex-direction: column;\n}\n\nslot[name=left],\nslot[name=right] {\n height: 100%;\n flex-direction: row;\n}\n\nslot[name=top],\nslot[name=left] {\n justify-content: flex-start;\n}\n\nslot[name=bottom],\nslot[name=right] {\n justify-content: flex-end;\n}\n\n/*******************************\n * Match rounded corners to card\n *******************************/\n::slotted([slot=top]:first-child),\n::slotted([slot=left]:first-child) {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=top]:first-child),\n::slotted([slot=right]:first-child) {\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=bottom]:last-child),\n::slotted([slot=left]:last-child) {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=bottom]:last-child),\n::slotted([slot=right]:last-child) {\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}")}};Yk=e([le("frigate-card-overlay")],Yk);class Kk{constructor(e){this._config=null,this._popupTimer=new xf,this._items=[],this._host=e}getRenderItems(){return this._items}setItems(e){const t=e.filter((e=>!!e.exclusive)),n=Ev(t.length?t:e,(e=>e.priority??50),"desc"),a=this._getSufficientValues(this._items),i=this._getSufficientValues(n);this._items=n,"popup"!==this._config?.style||Dv(a,i)||(this._show(),this._popupTimer.start(this._config.popup_seconds,(()=>this._hide()))),this._host.requestUpdate()}setConfig(e){this._config=e,this._host.style.setProperty("--frigate-card-status-bar-height",`${e.height}px`),this._host.setAttribute("data-style",e.style),this._host.setAttribute("data-position",e.position),"popup"!==this._config?.style&&this._show(),this._host.requestUpdate()}shouldRender(){return this._items.some((e=>!1!==e.enabled&&e.sufficient))}actionHandler(e,t){e.stopPropagation();const n=yf(e.detail.action,t);n&&Fk(this._host,{action:Wg(n),config:t})}_getSufficientValue(e){ +/* istanbul ignore else: cannot happen -- @preserve */ +return"custom:frigate-card-status-bar-icon"===e.type?e.icon:"custom:frigate-card-status-bar-string"===e.type?e.string:"custom:frigate-card-status-bar-image"===e.type?e.image:null}_getSufficientValues(e){return e.filter((e=>!1!==e.enabled&&e.sufficient)).map((e=>this._getSufficientValue(e)))}_show(){of(this._host,!1,"hide")}_hide(){of(this._host,!0,"hide")}}let Xk=class extends se{constructor(){super(...arguments),this._controller=new Kk(this)}willUpdate(e){e.has("config")&&this.config&&this._controller.setConfig(this.config),e.has("items")&&this._controller.setItems(this.items??[])}render(){if(this._controller.shouldRender())return q` +
+ ${this._controller.getRenderItems().map((e=>{if(!1===e.enabled)return;const t=_e({item:!0,expand:!!e.expand,action:!!Object.keys(e.actions??{}).length}),n=kf({hasHold:bf(e.actions?.hold_action),hasDoubleClick:bf(e.actions?.double_tap_action)});if("custom:frigate-card-status-bar-string"===e.type)return q`
this._controller.actionHandler(t,e.actions)} + > + ${e.string} +
`;if("custom:frigate-card-status-bar-icon"===e.type){const a=Uk(e.icon);return a?q`this._controller.actionHandler(t,e.actions)} + />`:q`this._controller.actionHandler(t,e.actions)} + >`}return"custom:frigate-card-status-bar-image"===e.type?q`this._controller.actionHandler(t,e.actions)} + />`:void 0}))} +
+ `}static get styles(){return o("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n --mdc-icon-button-size: calc(var(--frigate-card-status-bar-height) - 6px);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n display: block;\n width: 100%;\n pointer-events: auto;\n opacity: 1;\n transition: opacity 1s;\n}\n\n/*******************************************************\n * Non-hover styles should not interact with the pointer\n *******************************************************/\n:host(:not([data-style*=hover])) {\n pointer-events: none;\n}\n\n/***************\n * Outside style\n ***************/\n:host([data-style=outside]) {\n color: var(--primary-text-color);\n background: var(--secondary-background-color);\n}\n\n/*******************\n * Non-outside style\n *******************/\n:host(:not([data-style=outside])) {\n color: white;\n background: linear-gradient(90deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=popup][hide]) {\n opacity: 0;\n}\n\n/*********************\n * Status bar contents\n *********************/\n.status {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n overflow: hidden;\n width: 100%;\n height: var(--frigate-card-status-bar-height);\n}\n\n.item {\n display: inline-block;\n margin: 3px;\n padding: 3px;\n align-content: center;\n opacity: 0.7;\n}\n\n.item:first-child {\n margin-left: 10px;\n}\n\n.item:last-child {\n margin-right: 10px;\n}\n\n.item.expand {\n flex: 1;\n}\n\n.item.action {\n cursor: pointer;\n}\n\nimg.item {\n width: var(--mdc-icon-size, 24px);\n height: var(--mdc-icon-size, 24px);\n}")}};e([he({attribute:!1})],Xk.prototype,"items",void 0),e([he({attribute:!1})],Xk.prototype,"config",void 0),Xk=e([le("frigate-card-status-bar")],Xk);function Jk(e){return"number"==typeof e}function eS(e){return"string"==typeof e}function tS(e){return"boolean"==typeof e}function nS(e){return"[object Object]"===Object.prototype.toString.call(e)}function aS(e){return Math.abs(e)}function iS(e){return Math.sign(e)}function rS(e,t){return aS(e-t)}function oS(e){return uS(e).map(Number)}function sS(e){return e[cS(e)]}function cS(e){return Math.max(0,e.length-1)}function lS(e,t){return t===cS(e)}function dS(e,t=0){return Array.from(Array(e),((e,n)=>t+n))}function uS(e){return Object.keys(e)}function hS(e,t){return[e,t].reduce(((e,t)=>(uS(t).forEach((n=>{const a=e[n],i=t[n],r=nS(a)&&nS(i);e[n]=r?hS(a,i):i})),e)),{})}function pS(e,t){return void 0!==t.MouseEvent&&e instanceof t.MouseEvent}function mS(){let e=[];const t={add:function(n,a,i,r={passive:!0}){let o;if("addEventListener"in n)n.addEventListener(a,i,r),o=()=>n.removeEventListener(a,i,r);else{const e=n;e.addListener(i),o=()=>e.removeListener(i)}return e.push(o),t},clear:function(){e=e.filter((e=>e()))}};return t}function gS(e,t,n,a){const i=mS(),r=1e3/60;let o=null,s=0,c=0;function l(e){if(!c)return;o||(o=e);const i=e-o;for(o=e,s+=i;s>=r;)n(r),s-=r;a(s/r),c&&t.requestAnimationFrame(l)}function d(){t.cancelAnimationFrame(c),o=null,s=0,c=0}return{init:function(){i.add(e,"visibilitychange",(()=>{e.hidden&&(o=null,s=0)}))},destroy:function(){d(),i.clear()},start:function(){c||(c=t.requestAnimationFrame(l))},stop:d,update:()=>n(r),render:a}}function fS(e=0,t=0){const n=aS(e-t);function a(t){return tt}function r(e){return a(e)||i(e)}const o={length:n,max:t,min:e,constrain:function(n){return r(n)?a(n)?e:t:n},reachedAny:r,reachedMax:i,reachedMin:a,removeOffset:function(e){return n?e-n*Math.ceil((e-t)/n):e}};return o}function _S(e,t,n){const{constrain:a}=fS(0,e),i=e+1;let r=o(t);function o(e){return n?aS((i+e)%i):a(e)}function s(){return r}function c(){return _S(e,s(),n)}const l={get:s,set:function(e){return r=o(e),l},add:function(e){return c().set(s()+e)},clone:c};return l}function vS(e,t,n,a,i,r,o,s,c,l,d,u,h,p,m,g,f,_,v){const{cross:y,direction:b}=e,w=["INPUT","SELECT","TEXTAREA"],x={passive:!1},C=mS(),M=mS(),k=fS(50,225).constrain(p.measure(20)),S={mouse:300,touch:400},E={mouse:500,touch:600},$=m?43:25;let A=!1,z=0,I=0,T=!1,j=!1,O=!1,D=!1;function R(e){if(!pS(e,a)&&e.touches.length>=2)return P(e);const t=r.readPoint(e),n=r.readPoint(e,y),o=rS(t,z),c=rS(n,I);if(!j&&!D){if(!e.cancelable)return P(e);if(j=o>c,!j)return P(e)}const d=r.pointerMove(e);o>g&&(O=!0),l.useFriction(.3).useDuration(.75),s.start(),i.add(b(d)),e.preventDefault()}function P(e){const t=d.byDistance(0,!1).index!==u.get(),n=r.pointerUp(e)*(m?E:S)[D?"mouse":"touch"],a=function(e,t){const n=u.add(-1*iS(e)),a=d.byDistance(e,!m).distance;return m||aS(e)=2,s&&0!==e.button)return;if(function(e){const t=e.nodeName||"";return w.includes(t)}(e.target))return;T=!0,r.pointerDown(e),l.useFriction(0).useDuration(0),i.set(o),function(){const e=D?n:t;M.add(e,"touchmove",R,x).add(e,"touchend",P).add(e,"mousemove",R,x).add(e,"mouseup",P)}(),z=r.readPoint(e),I=r.readPoint(e,y),h.emit("pointerDown")}(s)}const c=t;C.add(c,"dragstart",(e=>e.preventDefault()),x).add(c,"touchmove",(()=>{}),x).add(c,"touchend",(()=>{})).add(c,"touchstart",s).add(c,"mousedown",s).add(c,"touchcancel",P).add(c,"contextmenu",P).add(c,"click",L,!0)},destroy:function(){C.clear(),M.clear()},pointerDown:function(){return T}}}function yS(e,t){let n,a;function i(e){return e.timeStamp}function r(n,a){const i="client"+("x"===(a||e.scroll)?"X":"Y");return(pS(n,t)?n:n.touches[0])[i]}return{pointerDown:function(e){return n=e,a=e,r(e)},pointerMove:function(e){const t=r(e)-r(a),o=i(e)-i(n)>170;return a=e,o&&(n=e),t},pointerUp:function(e){if(!n||!a)return 0;const t=r(a)-r(n),o=i(e)-i(n),s=i(e)-i(a)>170,c=t/o;return o&&!s&&aS(c)>.1?c:0},readPoint:r}}function bS(e,t,n,a,i,r,o){const s=[e].concat(a);let c,l,d=[],u=!1;function h(e){return i.measureSize(o.measure(e))}return{init:function(i){r&&(l=h(e),d=a.map(h),c=new ResizeObserver((n=>{(tS(r)||r(i,n))&&function(n){for(const r of n){if(u)return;const n=r.target===e,o=a.indexOf(r.target),s=n?l:d[o];if(aS(h(n?e:a[o])-s)>=.5){i.reInit(),t.emit("resize");break}}}(n)})),n.requestAnimationFrame((()=>{s.forEach((e=>c.observe(e)))})))},destroy:function(){u=!0,c&&c.disconnect()}}}function wS(e,t,n,a,i){const r=i.measure(10),o=i.measure(50),s=fS(.1,.99);let c=!1;function l(){return!c&&(!!e.reachedAny(n.get())&&!!e.reachedAny(t.get()))}return{shouldConstrain:l,constrain:function(i){if(!l())return;const c=e.reachedMin(t.get())?"min":"max",d=aS(e[c]-t.get()),u=n.get()-t.get(),h=s.constrain(d/o);n.subtract(u*h),!i&&aS(u)e.add(i)))}};return c}function CS(e,t,n,a,i){const{reachedAny:r,removeOffset:o,constrain:s}=a;function c(e){return e.concat().sort(((e,t)=>aS(e)-aS(t)))[0]}function l(t,a){const i=[t,t+n,t-n];if(!e)return t;if(!a)return c(i);const r=i.filter((e=>iS(e)===a));return r.length?c(r):sS(i)-n}return{byDistance:function(n,a){const c=i.get()+n,{index:d,distance:u}=function(n){const a=e?o(n):s(n),i=t.map(((e,t)=>({diff:l(e-a,0),index:t}))).sort(((e,t)=>aS(e.diff)-aS(t.diff))),{index:r}=i[0];return{index:r,distance:a}}(c),h=!e&&r(c);return!a||h?{index:d,distance:n}:{index:d,distance:n+l(t[d]-u,0)}},byIndex:function(e,n){return{index:e,distance:l(t[e]-i.get(),n)}},shortcut:l}}function MS(e,t,n,a,i,r,o,s){const c={passive:!0,capture:!0};let l=0;function d(e){"Tab"===e.code&&(l=(new Date).getTime())}return{init:function(u){s&&(r.add(document,"keydown",d,!1),t.forEach(((t,d)=>{r.add(t,"focus",(t=>{(tS(s)||s(u,t))&&function(t){if((new Date).getTime()-l>10)return;o.emit("slideFocusStart"),e.scrollLeft=0;const r=n.findIndex((e=>e.includes(t)));Jk(r)&&(i.useDuration(0),a.index(r,0),o.emit("slideFocus"))}(d)}),c)})))}}}function kS(e){let t=e;function n(e){return Jk(e)?e:e.get()}const a={get:function(){return t},set:function(e){t=n(e)},add:function(e){t+=n(e)},subtract:function(e){t-=n(e)}};return a}function SS(e,t){const n="x"===e.scroll?function(e){return`translate3d(${e}px,0px,0px)`}:function(e){return`translate3d(0px,${e}px,0px)`},a=t.style;let i=!1;return{clear:function(){i||(a.transform="",t.getAttribute("style")||t.removeAttribute("style"))},to:function(t){i||(a.transform=n(e.direction(t)))},toggleActive:function(e){i=!e}}}function ES(e,t,n,a,i,r,o,s,c){const l=.5,d=oS(i),u=oS(i).reverse(),h=function(){const e=o[0];return g(m(u,e),n,!1)}().concat(function(){const e=t-o[0]-1;return g(m(d,e),-n,!0)}());function p(e,t){return e.reduce(((e,t)=>e-i[t]),t)}function m(e,t){return e.reduce(((e,n)=>p(e,t)>0?e.concat([n]):e),[])}function g(i,o,d){const u=function(e){return r.map(((n,i)=>({start:n-a[i]+l+e,end:n+t-l+e})))}(o);return i.map((t=>{const a=d?0:-n,i=d?n:0,r=d?"end":"start",o=u[t][r];return{index:t,loopPoint:o,slideLocation:kS(-1),translate:SS(e,c[t]),target:()=>s.get()>o?a:i}}))}const f={canLoop:function(){return h.every((({index:e})=>{const n=d.filter((t=>t!==e));return p(n,t)<=.1}))},clear:function(){h.forEach((e=>e.translate.clear()))},loop:function(){h.forEach((e=>{const{target:t,translate:n,slideLocation:a}=e,i=t();i!==a.get()&&(n.to(i),a.set(i))}))},loopPoints:h};return f}function $S(e,t,n){let a,i=!1;return{init:function(r){n&&(a=new MutationObserver((e=>{i||(tS(n)||n(r,e))&&function(e){for(const n of e)if("childList"===n.type){r.reInit(),t.emit("slidesChanged");break}}(e)})),a.observe(e,{childList:!0}))},destroy:function(){a&&a.disconnect(),i=!0}}}function AS(e,t,n,a){const i={};let r,o=null,s=null,c=!1;return{init:function(){r=new IntersectionObserver((e=>{c||(e.forEach((e=>{const n=t.indexOf(e.target);i[n]=e})),o=null,s=null,n.emit("slidesInView"))}),{root:e.parentElement,threshold:a}),t.forEach((e=>r.observe(e)))},destroy:function(){r&&r.disconnect(),c=!0},get:function(e=!0){if(e&&o)return o;if(!e&&s)return s;const t=function(e){return uS(i).reduce(((t,n)=>{const a=parseInt(n),{isIntersecting:r}=i[a];return(e&&r||!e&&!r)&&t.push(a),t}),[])}(e);return e&&(o=t),e||(s=t),t}}}function zS(e,t,n,a,i,r,o,s,c){const{startEdge:l,endEdge:d,direction:u}=e,h=Jk(n);const p={groupSlides:function(e){return h?function(e,t){return oS(e).filter((e=>e%t==0)).map((n=>e.slice(n,n+t)))}(e,n):function(e){return e.length?oS(e).reduce(((n,h,p)=>{const m=sS(n)||0,g=0===m,f=h===cS(e),_=i[l]-r[m][l],v=i[l]-r[h][d],y=!a&&g?u(o):0,b=aS(v-(!a&&f?u(s):0)-(_+y));return p&&b>t+c&&n.push(h),f&&n.push(e.length),n}),[]).map(((t,n,a)=>{const i=Math.max(a[n-1]||0);return e.slice(i,t)})):[]}(e)}};return p}function IS(e,t,n,a,i,r,o){const{align:s,axis:c,direction:l,startIndex:d,loop:u,duration:h,dragFree:p,dragThreshold:m,inViewThreshold:g,slidesToScroll:f,skipSnaps:_,containScroll:v,watchResize:y,watchSlides:b,watchDrag:w,watchFocus:x}=r,C={measure:function(e){const{offsetTop:t,offsetLeft:n,offsetWidth:a,offsetHeight:i}=e;return{top:t,right:n+a,bottom:t+i,left:n,width:a,height:i}}},M=C.measure(t),k=n.map(C.measure),S=function(e,t){const n="rtl"===t,a="y"===e,i=!a&&n?-1:1,r={scroll:a?"y":"x",cross:a?"x":"y",startEdge:a?"top":n?"right":"left",endEdge:a?"bottom":n?"left":"right",measureSize:function(e){const{height:t,width:n}=e;return a?t:n},direction:function(e){return e*i}};return r}(c,l),E=S.measureSize(M),$=function(e){const t={measure:function(t){return e*(t/100)}};return t}(E),A=function(e,t){const n={start:function(){return 0},center:function(e){return a(e)/2},end:a};function a(e){return t-e}const i={measure:function(a,i){return eS(e)?n[e](a):e(t,a,i)}};return i}(s,E),z=!u&&!!v,I=u||!!v,{slideSizes:T,slideSizesWithGaps:j,startGap:O,endGap:D}=function(e,t,n,a,i,r){const{measureSize:o,startEdge:s,endEdge:c}=e,l=n[0]&&i,d=function(){if(!l)return 0;const e=n[0];return aS(t[s]-e[s])}(),u=function(){if(!l)return 0;const e=r.getComputedStyle(sS(a));return parseFloat(e.getPropertyValue(`margin-${c}`))}(),h=n.map(o),p=n.map(((e,t,n)=>{const a=!t,i=lS(n,t);return a?h[t]+d:i?h[t]+u:n[t+1][s]-e[s]})).map(aS);return{slideSizes:h,slideSizesWithGaps:p,startGap:d,endGap:u}}(S,M,k,n,I,i),R=zS(S,E,f,u,M,k,O,D,2),{snaps:P,snapsAligned:L}=function(e,t,n,a,i){const{startEdge:r,endEdge:o}=e,{groupSlides:s}=i,c=s(a).map((e=>sS(e)[o]-e[0][r])).map(aS).map(t.measure),l=a.map((e=>n[r]-e[r])).map((e=>-aS(e))),d=s(l).map((e=>e[0])).map(((e,t)=>e+c[t]));return{snaps:l,snapsAligned:d}}(S,A,M,k,R),N=-sS(P)+sS(j),{snapsContained:F,scrollContainLimit:V}=function(e,t,n,a,i){const r=fS(-t+e,0),o=n.map(((e,t)=>{const{min:a,max:i}=r,o=r.constrain(e),s=!t,l=lS(n,t);return s?i:l||c(a,o)?a:c(i,o)?i:o})).map((e=>parseFloat(e.toFixed(3)))),s=function(){const e=o[0],t=sS(o);return fS(o.lastIndexOf(e),o.indexOf(t)+1)}();function c(e,t){return rS(e,t)<1}return{snapsContained:function(){if(t<=e+i)return[r.max];if("keepSnaps"===a)return o;const{min:n,max:c}=s;return o.slice(n,c)}(),scrollContainLimit:s}}(E,N,L,v,2),H=z?F:L,{limit:B}=function(e,t,n){const a=t[0];return{limit:fS(n?a-e:sS(t),a)}}(N,H,u),q=_S(cS(H),d,u),U=q.clone(),W=oS(n),Z=gS(a,i,(e=>(({dragHandler:e,scrollBody:t,scrollBounds:n,options:{loop:a}},i)=>{a||n.constrain(e.pointerDown()),t.seek(i)})(se,e)),(e=>(({scrollBody:e,translate:t,location:n,offsetLocation:a,scrollLooper:i,slideLooper:r,dragHandler:o,animation:s,eventHandler:c,scrollBounds:l,options:{loop:d}},u)=>{const h=e.settled(),p=!l.shouldConstrain(),m=d?h:h&&p;m&&!o.pointerDown()&&(s.stop(),c.emit("settle")),m||c.emit("scroll");const g=n.get()*u+Y.get()*(1-u);a.set(g),d&&(i.loop(e.direction()),r.loop()),t.to(a.get())})(se,e))),Q=H[q.get()],G=kS(Q),Y=kS(Q),K=kS(Q),X=kS(Q),J=function(e,t,n,a,i,r){let o=0,s=0,c=i,l=r,d=e.get(),u=0;function h(e){return c=e,m}function p(e){return l=e,m}const m={direction:function(){return s},duration:function(){return c},velocity:function(){return o},seek:function(t){const i=t/1e3,r=c*i,h=a.get()-e.get();let p=0;return c?(n.set(e),o+=h/r,o*=l,d+=o,e.add(o*i),p=d-u):(o=0,n.set(a),e.set(a),p=h),s=iS(p),u=d,m},settled:function(){return aS(a.get()-t.get())<.001},useBaseFriction:function(){return p(r)},useBaseDuration:function(){return h(i)},useFriction:p,useDuration:h};return m}(G,K,Y,X,h,.68),ee=CS(u,H,N,B,X),te=function(e,t,n,a,i,r,o){function s(i){const s=i.distance,c=i.index!==t.get();r.add(s),s&&(a.duration()?e.start():(e.update(),e.render(1),e.update())),c&&(n.set(t.get()),t.set(i.index),o.emit("select"))}const c={distance:function(e,t){s(i.byDistance(e,t))},index:function(e,n){const a=t.clone().set(e);s(i.byIndex(a.get(),n))}};return c}(Z,q,U,J,ee,X,o),ne=function(e){const{max:t,length:n}=e,a={get:function(e){return n?(e-t)/-n:0}};return a}(B),ae=mS(),ie=AS(t,n,o,g),{slideRegistry:re}=function(e,t,n,a,i,r){const{groupSlides:o}=i,{min:s,max:c}=a;return{slideRegistry:function(){const a=o(r),i=!e||"keepSnaps"===t;return 1===n.length?[r]:i?a:a.slice(s,c).map(((e,t,n)=>{const a=!t,i=lS(n,t);return a?dS(sS(n[0])+1):i?dS(cS(r)-sS(n)[0]+1,sS(n)[0]):e}))}()}}(z,v,H,V,R,W),oe=MS(e,n,re,te,J,ae,o,x),se={ownerDocument:a,ownerWindow:i,eventHandler:o,containerRect:M,slideRects:k,animation:Z,axis:S,dragHandler:vS(S,e,a,i,X,yS(S,i),G,Z,te,J,ee,q,o,$,p,m,_,.68,w),eventStore:ae,percentOfView:$,index:q,indexPrevious:U,limit:B,location:G,offsetLocation:K,previousLocation:Y,options:r,resizeHandler:bS(t,o,i,n,S,y,C),scrollBody:J,scrollBounds:wS(B,K,X,J,$),scrollLooper:xS(N,B,K,[G,K,Y,X]),scrollProgress:ne,scrollSnapList:H.map(ne.get),scrollSnaps:H,scrollTarget:ee,scrollTo:te,slideLooper:ES(S,E,N,T,j,P,H,K,n),slideFocus:oe,slidesHandler:$S(t,o,b),slidesInView:ie,slideIndexes:W,slideRegistry:re,slidesToScroll:R,target:X,translate:SS(S,t)};return se}const TS={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0,watchFocus:!0};function jS(e){function t(e,t){return hS(e,t||{})}const n={mergeOptions:t,optionsAtMedia:function(n){const a=n.breakpoints||{},i=uS(a).filter((t=>e.matchMedia(t).matches)).map((e=>a[e])).reduce(((e,n)=>t(e,n)),{});return t(n,i)},optionsMediaQueries:function(t){return t.map((e=>uS(e.breakpoints||{}))).reduce(((e,t)=>e.concat(t)),[]).map(e.matchMedia)}};return n}function OS(e,t,n){const a=e.ownerDocument,i=a.defaultView,r=jS(i),o=function(e){let t=[];const n={init:function(n,a){return t=a.filter((({options:t})=>!1!==e.optionsAtMedia(t).active)),t.forEach((t=>t.init(n,e))),a.reduce(((e,t)=>Object.assign(e,{[t.name]:t})),{})},destroy:function(){t=t.filter((e=>e.destroy()))}};return n}(r),s=mS(),c=function(){let e,t={};function n(e){return t[e]||[]}const a={init:function(t){e=t},emit:function(t){return n(t).forEach((n=>n(e,t))),a},off:function(e,i){return t[e]=n(e).filter((e=>e!==i)),a},on:function(e,i){return t[e]=n(e).concat([i]),a},clear:function(){t={}}};return a}(),{mergeOptions:l,optionsAtMedia:d,optionsMediaQueries:u}=r,{on:h,off:p,emit:m}=c,g=S;let f,_,v,y,b=!1,w=l(TS,OS.globalOptions),x=l(w),C=[];function M(t){const n=IS(e,v,y,a,i,t,c);if(t.loop&&!n.slideLooper.canLoop()){return M(Object.assign({},t,{loop:!1}))}return n}function k(t,n){b||(w=l(w,t),x=d(w),C=n||C,function(){const{container:t,slides:n}=x,a=eS(t)?e.querySelector(t):t;v=a||e.children[0];const i=eS(n)?v.querySelectorAll(n):n;y=[].slice.call(i||v.children)}(),f=M(x),u([w,...C.map((({options:e})=>e))]).forEach((e=>s.add(e,"change",S))),x.active&&(f.translate.to(f.location.get()),f.animation.init(),f.slidesInView.init(),f.slideFocus.init(z),f.eventHandler.init(z),f.resizeHandler.init(z),f.slidesHandler.init(z),f.options.loop&&f.slideLooper.loop(),v.offsetParent&&y.length&&f.dragHandler.init(z),_=o.init(z,C)))}function S(e,t){const n=A();E(),k(l({startIndex:n},e),t),c.emit("reInit")}function E(){f.dragHandler.destroy(),f.eventStore.clear(),f.translate.clear(),f.slideLooper.clear(),f.resizeHandler.destroy(),f.slidesHandler.destroy(),f.slidesInView.destroy(),f.animation.destroy(),o.destroy(),s.clear()}function $(e,t,n){x.active&&!b&&(f.scrollBody.useBaseFriction().useDuration(!0===t?0:x.duration),f.scrollTo.index(e,n||0))}function A(){return f.index.get()}const z={canScrollNext:function(){return f.index.add(1).get()!==A()},canScrollPrev:function(){return f.index.add(-1).get()!==A()},containerNode:function(){return v},internalEngine:function(){return f},destroy:function(){b||(b=!0,s.clear(),E(),c.emit("destroy"),c.clear())},off:p,on:h,emit:m,plugins:function(){return _},previousScrollSnap:function(){return f.indexPrevious.get()},reInit:g,rootNode:function(){return e},scrollNext:function(e){$(f.index.add(1).get(),e,-1)},scrollPrev:function(e){$(f.index.add(-1).get(),e,1)},scrollProgress:function(){return f.scrollProgress.get(f.location.get())},scrollSnapList:function(){return f.scrollSnapList},scrollTo:$,selectedScrollSnap:A,slideNodes:function(){return y},slidesInView:function(){return f.slidesInView.get()},slidesNotInView:function(){return f.slidesInView.get(!1)}};return k(t,n),setTimeout((()=>c.emit("init")),0),z}function DS(){return DS=Object.assign||function(e){for(var t=1;t=e;case"y":return Math.abs(i)>=e;case"z":return Math.abs(r)>=e;default:return!1}}(r,a)&&e.preventDefault(),l.isStarted?l.isMomentum&&r>Math.max(2,2*l.lastAbsDelta)&&(M(!0),x()):x(),0===r&&Object.is&&Object.is(e.deltaX,-0)?d=!0:(t=e,l.axisMovement=PS(l.axisMovement,a),l.lastAbsDelta=r,l.scrollPointsToMerge.push({axisDelta:a,timeStamp:i}),g(),p({axisDelta:a,isStart:!l.isStartPublished}),l.isStartPublished=!0,C())},g=function(){var e;l.scrollPointsToMerge.length===US?(l.scrollPoints.unshift({axisDeltaSum:l.scrollPointsToMerge.map((function(e){return e.axisDelta})).reduce(PS),timeStamp:(e=l.scrollPointsToMerge.map((function(e){return e.timeStamp})),e.reduce((function(e,t){return e+t}))/e.length)}),_(),l.scrollPointsToMerge.length=0,l.scrollPoints.length=1,l.isMomentum||b()):l.isStartPublished||f()},f=function(){var e;l.axisVelocity=(e=l.scrollPointsToMerge,e[e.length-1]).axisDelta.map((function(e){return e/l.willEndTimeout}))},_=function(){var e=l.scrollPoints,t=e[0],n=e[1];if(n&&t){var a=t.timeStamp-n.timeStamp;if(!(a<=0)){var i=t.axisDeltaSum.map((function(e){return e/a})),r=i.map((function(e,t){return e/(l.axisVelocity[t]||1)}));l.axisVelocity=i,l.accelerationFactors.push(r),v(a)}}},v=function(e){var t=10*Math.ceil(e/10)*1.2;l.isMomentum||(t=Math.max(100,2*t)),l.willEndTimeout=Math.min(1e3,Math.round(t))},y=function(e){return 0===e||e<=qS&&e>=BS},b=function(){if(l.accelerationFactors.length>=WS){if(d&&(d=!1,LS(l.axisVelocity)>=.2))return void w();var e=l.accelerationFactors.slice(-1*WS);e.every((function(e){var t=!!e.reduce((function(e,t){return e&&e<1&&e===t?1:0})),n=e.filter(y).length===e.length;return t||n}))&&w(),l.accelerationFactors=e}},w=function(){l.isMomentum=!0},x=function(){(l=GS()).isStarted=!0,l.startTime=Date.now(),n=void 0,d=!1},C=function(){clearTimeout(a),a=setTimeout(M,l.willEndTimeout)},M=function(e){void 0===e&&(e=!1),l.isStarted&&(l.isMomentum&&e?p({isEnding:!0,isMomentumCancel:!0}):p({isEnding:!0}),l.isMomentum=!1,l.isStarted=!1)},k=function(e){var t=[],n=function(n){n.removeEventListener("wheel",e),t=t.filter((function(e){return e!==n}))};return NS({observe:function(a){return a.addEventListener("wheel",e,{passive:!1}),t.push(a),function(){return n(a)}},unobserve:n,disconnect:function(){t.forEach(n)}})}(u),S=k.observe,E=k.unobserve,$=k.disconnect;return h(e),NS({on:r,off:o,observe:S,unobserve:E,disconnect:$,feedWheel:u,updateOptions:h})}var KS={active:!0,breakpoints:{},wheelDraggingClass:"is-wheel-dragging",forceWheelAxis:void 0,target:void 0};function XS(e){var t;void 0===e&&(e={});var n=function(){};var a={name:"wheelGestures",options:e,init:function(a,i){var r,o,s=i.mergeOptions,c=i.optionsAtMedia,l=s(KS,XS.globalOptions),d=s(l,e);t=c(d);var u,h=a.internalEngine(),p=null!=(r=t.target)?r:a.containerNode().parentNode,m=null!=(o=t.forceWheelAxis)?o:h.options.axis,g=YS({preventWheelAction:m,reverseSign:[!0,!0,!1]}),f=g.observe(p),_=g.on("wheel",(function(e){var a=e.axisDelta,i=a[0],r=a[1],o="x"===m?i:r,s="x"===m?r:i,c=e.isMomentum&&e.previous&&!e.previous.isMomentum,l=e.isEnding&&!e.isMomentum||c;Math.abs(o)>Math.abs(s)&&!v&&!e.isMomentum&&function(e){try{x(u=new MouseEvent("mousedown",e.event))}catch(e){return n()}v=!0,document.documentElement.addEventListener("mousemove",b,!0),document.documentElement.addEventListener("mouseup",b,!0),void document.documentElement.addEventListener("mousedown",b,!0),t.wheelDraggingClass&&p.classList.add(t.wheelDraggingClass)}(e);if(!v)return;l?function(e){v=!1,x(w("mouseup",e)),y(),t.wheelDraggingClass&&p.classList.remove(t.wheelDraggingClass)}(e):x(w("mousemove",e))})),v=!1;function y(){document.documentElement.removeEventListener("mousemove",b,!0),document.documentElement.removeEventListener("mouseup",b,!0),document.documentElement.removeEventListener("mousedown",b,!0)}function b(e){v&&e.isTrusted&&e.stopImmediatePropagation()}function w(e,t){var n,a;if(m===h.options.axis){var i=t.axisMovement;n=i[0],a=i[1]}else{var r=t.axisMovement;a=r[0],n=r[1]}if(!h.options.skipSnaps&&!h.options.dragFree){var o=h.containerRect.width,s=h.containerRect.height;n=n<0?Math.max(n,-o):Math.min(n,o),a=a<0?Math.max(a,-s):Math.min(a,s)}return new MouseEvent(e,{clientX:u.clientX+n,clientY:u.clientY+a,screenX:u.screenX+n,screenY:u.screenY+a,movementX:n,movementY:a,button:0,bubbles:!0,cancelable:!0,composed:!0})}function x(e){a.containerNode().dispatchEvent(e)}n=function(){f(),_(),y()}},destroy:function(){return n()}};return a}XS.globalOptions=void 0;class JS{constructor(e,t,n){this._mutationObserver=new MutationObserver(((e,t)=>this._refreshCarouselContents())),this._refreshCarouselContents=()=>{const e=lf(this._parent);!Dv(this._carousel.slideNodes(),e)&&(this._carousel.destroy(),this._carousel=this._createCarousel(e))},this._root=e,this._parent=t,this._direction=n?.direction??"horizontal",this._transitionEffect=n?.transitionEffect??"slide",this._startIndex=n?.startIndex??0,this._dragFree=n?.dragFree??!1,this._loop=n?.loop??!1,this._draggable=n?.dragEnabled??!0,this._plugins=n?.plugins??[],this._carousel=this._createCarousel(lf(this._parent)),t instanceof HTMLSlotElement&&t.addEventListener("slotchange",this._refreshCarouselContents),this._mutationObserver.observe(this._parent,{childList:!0})}destroy(){this._parent instanceof HTMLSlotElement&&this._parent.removeEventListener("slotchange",this._refreshCarouselContents),this._mutationObserver.disconnect(),this._carousel.destroy()}getSlide(e){return this._carousel.slideNodes()[e]??null}getSelectedSlide(){return this.getSlide(this.getSelectedIndex())}getSelectedIndex(){return this._carousel.selectedScrollSnap()}selectSlide(e){this._carousel.scrollTo(e,"none"===this._transitionEffect);const t=this.getSlide(e);t&&Bg(this._parent,"carousel:force-select",{index:e,element:t})}_createCarousel(e){const t=OS(this._root,{slides:e,axis:"horizontal"===this._direction?"x":"y",duration:20,startIndex:this._startIndex,dragFree:this._dragFree,loop:this._loop,containScroll:"trimSnaps",watchSlides:!1,watchResize:!0,watchDrag:this._draggable},[...this._plugins,...e.length>1?[XS({forceWheelAxis:"y"})]:[]]),n=()=>{const e=(()=>{const e=t.selectedScrollSnap(),n=t.slideNodes()[e]??null;return n?{index:e,element:n}:null})();e&&Bg(this._parent,"carousel:select",e)};return t.on("select",(()=>n())),t}}let eE=class extends se{constructor(){super(...arguments),this.direction="horizontal",this.dragEnabled=!0,this.selected=0,this._refParent=ze(),this._refRoot=ze(),this._carousel=null}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._carousel?.destroy(),this._carousel=null,super.disconnectedCallback()}willUpdate(e){e.has("direction")&&this.setAttribute("direction",this.direction);["direction","dragEnabled","dragFree","loop","plugins","transitionEffect"].some((t=>e.has(t)))&&(this._carousel?.destroy(),this._carousel=null)}render(){return q`
+ +
+
+ +
+
+ +
`}updated(e){!this._carousel&&this._refRoot.value&&this._refParent.value?this._carousel=new JS(this._refRoot.value,this._refParent.value,{direction:this.direction,dragEnabled:this.dragEnabled,dragFree:this.dragFree,startIndex:this.selected,transitionEffect:this.transitionEffect,loop:this.loop,plugins:this.plugins}):e.has("selected")&&this._carousel?.selectSlide(this.selected)}static get styles(){return o(":host {\n display: block;\n height: 100%;\n width: 100%;\n position: relative;\n}\n\n.embla {\n width: 100%;\n height: 100%;\n margin-left: auto;\n margin-right: auto;\n}\n\n.embla__container {\n display: flex;\n width: 100%;\n height: 100%;\n user-select: none;\n -webkit-touch-callout: none;\n -khtml-user-select: none;\n -webkit-tap-highlight-color: transparent;\n}\n\n:host([direction=vertical]) .embla__container {\n flex-direction: column;\n}\n\n:host([direction=horizontal]) .embla__container {\n flex-direction: row;\n}\n\n.embla__viewport {\n width: 100%;\n height: 100%;\n overflow: hidden;\n display: flex;\n flex-direction: column;\n justify-content: center;\n}\n\n.embla__viewport.is-draggable {\n cursor: move;\n cursor: grab;\n}\n\n.embla__viewport.is-dragging {\n cursor: grabbing;\n}\n\n:host([direction=vertical]) ::slotted(.embla__slide) {\n margin-bottom: 5px;\n}\n\n:host([direction=horizontal]) ::slotted(.embla__slide) {\n margin-right: 5px;\n}")}};e([he({attribute:!0,reflect:!0})],eE.prototype,"direction",void 0),e([he({attribute:!0})],eE.prototype,"transitionEffect",void 0),e([he({attribute:!1})],eE.prototype,"loop",void 0),e([he({attribute:!1})],eE.prototype,"dragFree",void 0),e([he({attribute:!1})],eE.prototype,"dragEnabled",void 0),e([he({attribute:!1})],eE.prototype,"plugins",void 0),e([he({attribute:!1})],eE.prototype,"selected",void 0),eE=e([le("frigate-card-carousel")],eE); +/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const tE=window,nE=tE.ShadowRoot&&(void 0===tE.ShadyCSS||tE.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,aE=Symbol(),iE=new WeakMap;let rE=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==aE)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(nE&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=iE.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&iE.set(t,e))}return e}toString(){return this.cssText}};const oE=(e,t)=>{nE?e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):t.forEach((t=>{const n=document.createElement("style"),a=tE.litNonce;void 0!==a&&n.setAttribute("nonce",a),n.textContent=t.cssText,e.appendChild(n)}))},sE=nE?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return(e=>new rE("string"==typeof e?e:e+"",void 0,aE))(t)})(e):e +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */;var cE;const lE=window,dE=lE.trustedTypes,uE=dE?dE.emptyScript:"",hE=lE.reactiveElementPolyfillSupport,pE={toAttribute(e,t){switch(t){case Boolean:e=e?uE:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},mE=(e,t)=>t!==e&&(t==t||e==e),gE={attribute:!0,type:String,converter:pE,reflect:!1,hasChanged:mE},fE="finalized";class _E extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var t;this.finalize(),(null!==(t=this.h)&&void 0!==t?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach(((t,n)=>{const a=this._$Ep(n,t);void 0!==a&&(this._$Ev.set(a,n),e.push(a))})),e}static createProperty(e,t=gE){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){const n="symbol"==typeof e?Symbol():"__"+e,a=this.getPropertyDescriptor(e,n,t);void 0!==a&&Object.defineProperty(this.prototype,e,a)}}static getPropertyDescriptor(e,t,n){return{get(){return this[t]},set(a){const i=this[e];this[t]=a,this.requestUpdate(e,i,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||gE}static finalize(){if(this.hasOwnProperty(fE))return!1;this[fE]=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),void 0!==e.h&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const e=this.properties,t=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const n of t)this.createProperty(n,e[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(sE(e))}else void 0!==e&&t.push(sE(e));return t}static _$Ep(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(e=this.constructor.h)||void 0===e||e.forEach((e=>e(this)))}addController(e){var t,n;(null!==(t=this._$ES)&&void 0!==t?t:this._$ES=[]).push(e),void 0!==this.renderRoot&&this.isConnected&&(null===(n=e.hostConnected)||void 0===n||n.call(e))}removeController(e){var t;null===(t=this._$ES)||void 0===t||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])}))}createRenderRoot(){var e;const t=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return oE(t,this.constructor.elementStyles),t}connectedCallback(){var e;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostConnected)||void 0===t?void 0:t.call(e)}))}enableUpdating(e){}disconnectedCallback(){var e;null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostDisconnected)||void 0===t?void 0:t.call(e)}))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EO(e,t,n=gE){var a;const i=this.constructor._$Ep(e,n);if(void 0!==i&&!0===n.reflect){const r=(void 0!==(null===(a=n.converter)||void 0===a?void 0:a.toAttribute)?n.converter:pE).toAttribute(t,n.type);this._$El=e,null==r?this.removeAttribute(i):this.setAttribute(i,r),this._$El=null}}_$AK(e,t){var n;const a=this.constructor,i=a._$Ev.get(e);if(void 0!==i&&this._$El!==i){const e=a.getPropertyOptions(i),r="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==(null===(n=e.converter)||void 0===n?void 0:n.fromAttribute)?e.converter:pE;this._$El=i,this[i]=r.fromAttribute(t,e.type),this._$El=null}}requestUpdate(e,t,n){let a=!0;void 0!==e&&(((n=n||this.constructor.getPropertyOptions(e)).hasChanged||mE)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),!0===n.reflect&&this._$El!==e&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(e,n))):a=!1),!this.isUpdatePending&&a&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((e,t)=>this[t]=e)),this._$Ei=void 0);let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostUpdate)||void 0===t?void 0:t.call(e)})),this.update(n)):this._$Ek()}catch(e){throw t=!1,this._$Ek(),e}t&&this._$AE(n)}willUpdate(e){}_$AE(e){var t;null===(t=this._$ES)||void 0===t||t.forEach((e=>{var t;return null===(t=e.hostUpdated)||void 0===t?void 0:t.call(e)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){void 0!==this._$EC&&(this._$EC.forEach(((e,t)=>this._$EO(t,this[t],e))),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}}_E[fE]=!0,_E.elementProperties=new Map,_E.elementStyles=[],_E.shadowRootOptions={mode:"open"},null==hE||hE({ReactiveElement:_E}),(null!==(cE=lE.reactiveElementVersions)&&void 0!==cE?cE:lE.reactiveElementVersions=[]).push("1.6.3"); +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const vE=0,yE=Symbol();class bE{constructor(e,t,n){this.o=0,this.status=0,this.autoRun=!0,this.i=e,this.i.addController(this);const a="object"==typeof t?t:{task:t,args:n};this.t=a.task,this.h=a.args,void 0!==a.autoRun&&(this.autoRun=a.autoRun),this.taskComplete=new Promise(((e,t)=>{this.l=e,this.u=t}))}hostUpdated(){this.performTask()}async performTask(){var e;const t=null===(e=this.h)||void 0===e?void 0:e.call(this);this.shouldRun(t)&&this.run(t)}shouldRun(e){return this.autoRun&&this.v(e)}async run(e){var t;let n,a;null!=e||(e=null===(t=this.h)||void 0===t?void 0:t.call(this)),2!==this.status&&3!==this.status||(this.taskComplete=new Promise(((e,t)=>{this.l=e,this.u=t}))),this.status=1,this._=void 0,this.m=void 0,this.i.requestUpdate();const i=++this.o;try{n=await this.t(e)}catch(e){a=e}this.o===i&&(n===yE?this.status=0:(void 0===a?(this.status=2,this.l(n)):(this.status=3,this.u(a)),this.m=n,this._=a),this.i.requestUpdate())}get value(){return this.m}get error(){return this._}render(e){var t,n,a,i;switch(this.status){case 0:return null===(t=e.initial)||void 0===t?void 0:t.call(e);case 1:return null===(n=e.pending)||void 0===n?void 0:n.call(e);case 2:return null===(a=e.complete)||void 0===a?void 0:a.call(e,this.value);case 3:return null===(i=e.error)||void 0===i?void 0:i.call(e,this.error);default:this.status}}v(e){const t=this.T;return this.T=e,Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.some(((e,n)=>mE(e,t[n]))):e!==t}}class wE{constructor(e){this._keys=e}modify(e){this._keys.forEach((t=>e.removeContext(t)))}}var xE=":host {\n display: flex;\n flex-direction: column;\n width: 100%;\n margin-left: 5px;\n padding: 5px;\n color: var(--primary-text-color);\n overflow: hidden;\n column-gap: 5%;\n}\n\ndiv.title {\n font-size: 1.2rem;\n font-weight: bold;\n}\n\ndiv.details {\n flex: 1;\n justify-content: center;\n display: flex;\n flex-direction: column;\n flex-wrap: wrap;\n --mdc-icon-size: 16px;\n min-height: 0px;\n}";const CE=(e,t,n,a)=>{const i={...a?.cardWideConfig&&{cardWideConfig:a.cardWideConfig}};return q` ${t.render({initial:()=>a?.inProgressFunc?.()??xk(i),pending:()=>a?.inProgressFunc?.()??xk(i),error:t=>{Gg(t),kk(e,t)},complete:n})}`},ME=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,kE=(e,t,n,a=!0)=>new bE(e,{args:()=>[!!t(),n()],task:async([e,n])=>{const a=t();return e&&a&&n?(async(e,t)=>e&&t?t.startsWith("data:")||t.match(ME)?t:new Promise(((n,a)=>{e?e.fetchWithAuth(t).then((e=>e.blob())).then((e=>{const t=new FileReader;t.onload=()=>{const e=t.result;n("string"==typeof e?e:null)},t.onerror=e=>a(e),t.readAsDataURL(e)})):a()})):null)(a,n):null},autoRun:a}),SE=300;let EE=class extends se{constructor(){super(),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}connectedCallback(){this._intersectionObserver.observe(this),super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._intersectionObserver.disconnect()}willUpdate(e){e.has("thumbnail")&&(this._embedThumbnailTask=kE(this,(()=>this.hass),(()=>this.thumbnail),!1),this._intersectionObserver.unobserve(this),this._intersectionObserver.observe(this))}_intersectionHandler(e){this._embedThumbnailTask?.status===vE&&e.some((e=>e.isIntersecting))&&this._embedThumbnailTask?.run()}render(){const e=q` `;return this._embedThumbnailTask?q`${this.thumbnail?CE(this,this._embedThumbnailTask,(e=>e?q``:q``),{inProgressFunc:()=>e}):e} `:e}static get styles(){return o(":host {\n display: block;\n overflow: hidden;\n aspect-ratio: 1/1;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\nimg {\n display: block;\n}\n\nimg,\nha-icon {\n display: inline-block;\n vertical-align: top;\n margin: 0;\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n width: var(--frigate-card-thumbnail-size);\n max-height: 100%;\n aspect-ratio: 1/1;\n object-fit: cover;\n}\n\nha-icon {\n --mdc-icon-size: 50%;\n color: var(--primary-text-color);\n display: flex;\n justify-content: center;\n align-items: center;\n border: 1px solid rgba(255, 255, 255, 0.3);\n box-sizing: border-box;\n opacity: 0.2;\n}")}};e([he({attribute:!1})],EE.prototype,"thumbnail",void 0),e([he({attribute:!1})],EE.prototype,"hass",void 0),EE=e([le("frigate-card-thumbnail-feature-thumbnail")],EE);let $E=class extends se{render(){if(this.date)return q` + ${this.cameraMetadata?.engineLogo?q``:""} +
+
${Wu(this.date,"HH:mm")}
+
${Wu(this.date,"MMM do")}
+ ${this.showCameraTitle&&this.cameraMetadata?.title?q`
${this.cameraMetadata.title}
`:q``} +
+ `}static get styles(){return o(":host {\n display: block;\n max-width: var(--frigate-card-thumbnail-size);\n max-height: var(--frigate-card-thumbnail-size);\n aspect-ratio: 1/1;\n border: 1px solid var(--secondary-color);\n background-color: var(--secondary-background-color);\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n overflow: hidden;\n padding: 10px;\n box-sizing: border-box;\n position: relative;\n}\n\nimg.background {\n display: block;\n width: 100%;\n height: 100%;\n position: absolute;\n inset: 0;\n padding: 10%;\n box-sizing: border-box;\n pointer-events: none;\n opacity: 0.1;\n}\n\ndiv.content {\n height: 100%;\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n color: var(--primary-text-color);\n}\n\ndiv {\n text-align: center;\n}\n\ndiv.title {\n font-size: 1.5rem;\n}\n\ndiv.camera {\n font-size: 0.7em;\n}")}};e([he({attribute:!1})],$E.prototype,"date",void 0),e([he({attribute:!1})],$E.prototype,"cameraMetadata",void 0),e([he({attribute:!1})],$E.prototype,"showCameraTitle",void 0),$E=e([le("frigate-card-thumbnail-feature-text")],$E);let AE=class extends se{render(){if(!this.media)return;const e=this.media.getScore(),t=e?(100*e).toFixed(2)+"%":null,n=this.media.getStartTime(),a=n?Kg(n):null,i=this.media.getEndTime(),r=n&&i?ef(n,i):null,o=this.media.inProgress()?V_("event.in_progress"):null,s=qg(this.media.getWhat()?.join(", "))??null,c=qg(this.media.getWhere()?.join(", "))??null,l=qg(this.media.getTags()?.join(", "))??null,d=s||l?(s??"")+(s&&l?": ":"")+(l??""):null,u=this.seek?Wu(this.seek,"HH:mm:ss"):null;return q` + ${d?q`
+ ${d} + ${t?q`${t}`:""} +
`:""} +
+ ${a?q`
+ + ${a} +
+ ${r||o?q`
+ + ${r?q`${r}`:""} + ${o?q`${o}`:""} +
`:""}`:""} + ${this.cameraTitle?q`
+ + ${this.cameraTitle} +
`:""} + ${c?q`
+ + ${c} +
`:q``} + ${l?q`
+ + ${l} +
`:q``} + ${u?q`
+ + ${u} +
`:q``} +
+ `}static get styles(){return o(xE)}};e([he({attribute:!1})],AE.prototype,"media",void 0),e([he({attribute:!1})],AE.prototype,"seek",void 0),e([he({attribute:!1})],AE.prototype,"cameraTitle",void 0),AE=e([le("frigate-card-thumbnail-details-event")],AE);let zE=class extends se{render(){if(!this.media)return;const e=this.media.getStartTime(),t=e?Kg(e):null,n=this.media.getEndTime(),a=e&&n?ef(e,n):null,i=this.media.inProgress()?V_("recording.in_progress"):null,r=this.seek?Wu(this.seek,"HH:mm:ss"):null,o=this.media.getEventCount();return q` + ${this.cameraTitle?q`
+ ${this.cameraTitle} +
`:""} +
+ ${t?q`
+ + ${t} +
+ ${a||i?q`
+ + ${a?q`${a}`:""} + ${i?q`${i}`:""} +
`:""}`:""} + ${r?q`
+ + ${r} +
`:q``} + ${null!==o?q`
+ + ${o} +
`:""} +
+ `}static get styles(){return o(xE)}};e([he({attribute:!1})],zE.prototype,"media",void 0),e([he({attribute:!1})],zE.prototype,"seek",void 0),e([he({attribute:!1})],zE.prototype,"cameraTitle",void 0),zE=e([le("frigate-card-thumbnail-details-recording")],zE);let IE=class extends se{constructor(){super(...arguments),this.details=!1,this.show_favorite_control=!1,this.show_timeline_control=!1,this.show_download_control=!1}render(){if(!this.media||!this.cameraManager||!this.hass)return;const e=this.media.getThumbnail(),t=this.media.getTitle()??"",n={star:!0,starred:!!this.media?.isFavorite()},a=this.show_timeline_control&&(!tx.isRecording(this.media)||this.media.getStartTime()&&this.media.getEndTime()),i=this.cameraManager?.getMediaCapabilities(this.media),r=this.show_favorite_control&&this.media&&this.hass&&i?.canFavorite,o=this.show_download_control&&this.hass&&this.media.getID()&&i?.canDownload,s=this.cameraManager.getCameraMetadata(this.media.getCameraID());return q` + ${tx.isEvent(this.media)&&e?q``:tx.isEvent(this.media)||tx.isRecording(this.media)?q``:q``} + ${r?q` {if(wf(e),this.hass&&this.media){try{await(this.cameraManager?.favoriteMedia(this.media,!this.media?.isFavorite()))}catch(e){return void Gg(e)}this.requestUpdate()}}} + />`:""} + ${this.details&&tx.isEvent(this.media)?q``:this.details&&tx.isRecording(this.media)?q``:q``} + ${a?q`{wf(e),this.viewManagerEpoch&&this.media&&this.viewManagerEpoch.manager.setViewByParameters({params:{view:"timeline",queryResults:this.viewManagerEpoch?.manager.getView()?.queryResults?.clone().selectResultIfFound((e=>e===this.media))},modifiers:[new wE(["timeline"])]})}} + >`:""} + ${o?q` {if(wf(e),this.hass&&this.cameraManager&&this.media)try{await Ew(this.hass,this.cameraManager,this.media)}catch(e){kk(this,e)}}} + >`:""} + `}static get styles(){return o(":host {\n display: flex;\n flex-direction: row;\n box-sizing: border-box;\n position: relative;\n overflow: hidden;\n transition: transform 0.2s linear;\n}\n\n:host(:not([details])) {\n aspect-ratio: 1/1;\n}\n\n:host([details]) {\n border: 1px solid var(--primary-color);\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n padding: 2px;\n background-color: var(--primary-background-color, black);\n}\n\n:host(:hover) {\n transform: scale(1.04);\n}\n\nha-icon {\n position: absolute;\n border-radius: 50%;\n opacity: 0.5;\n color: var(--primary-color);\n cursor: pointer;\n transition: opacity 0.2s ease-in-out, color 0.2s ease-in-out;\n}\n\nha-icon:hover {\n opacity: 1;\n}\n\nha-icon.star {\n top: 3px;\n left: 3px;\n}\n\nha-icon.star.starred {\n color: gold;\n}\n\nha-icon.timeline {\n top: 3px;\n right: 3px;\n}\n\nha-icon.download {\n right: 3px;\n bottom: 3px;\n}\n\nfrigate-card-thumbnail-details-event,\nfrigate-card-thumbnail-details-recording {\n flex: 1;\n}")}};e([he({attribute:!1})],IE.prototype,"cameraManager",void 0),e([he({attribute:!1})],IE.prototype,"media",void 0),e([he({attribute:!0,type:Boolean})],IE.prototype,"details",void 0),e([he({attribute:!0,type:Boolean})],IE.prototype,"show_favorite_control",void 0),e([he({attribute:!0,type:Boolean})],IE.prototype,"show_timeline_control",void 0),e([he({attribute:!0,type:Boolean})],IE.prototype,"show_download_control",void 0),e([he({attribute:!1})],IE.prototype,"seek",void 0),IE=e([le("frigate-card-thumbnail")],IE);let TE=class extends se{constructor(){super(...arguments),this.fadeThumbnails=!1,this._thumbnailSlides=[]}willUpdate(e){if(e.has("config")){this.config?.size&&this.style.setProperty("--frigate-card-thumbnail-size",`${this.config.size}px`);const e=this._getDirection();e?this.setAttribute("direction",e):this.removeAttribute("direction")}["cameraManager","config","transitionEffect","viewManagerEpoch"].some((t=>e.has(t)))&&(this._thumbnailSlides=this._renderSlides()),e.has("viewManagerEpoch")&&this.style.setProperty("--frigate-card-carousel-thumbnail-opacity",this.fadeThumbnails&&null!==this._getSelectedSlide()?"0.4":"1.0")}_getSelectedSlide(){return this.viewManagerEpoch?.manager.getView()?.queryResults?.getSelectedIndex()??null}_renderSlides(){const e=[],t=this.viewManagerEpoch?.manager.getView(),n=t?.context?.mediaViewer?.seek,a=this._getSelectedSlide();for(const i of t?.queryResults?.getResults()??[]){const t=e.length,r={embla__slide:!0,"slide-selected":a===t};e.push(q` {const n=this.viewManagerEpoch?.manager.getView();n&&n.queryResults&&Bg(this,"thumbnail-carousel:tap",{queryResults:n.queryResults.clone().selectIndex(t)}),wf(e)}} + > + `)}return e}_getDirection(){return"left"===this.config?.mode||"right"===this.config?.mode?"vertical":"above"===this.config?.mode||"below"===this.config?.mode?"horizontal":null}render(){const e=this._getDirection();if(this._thumbnailSlides.length&&this.config&&e)return q` + ${this._thumbnailSlides} + `}static get styles(){return o(":host {\n --frigate-card-thumbnail-size-max: 300px;\n --frigate-card-thumbnail-details-width: calc(\n var(--frigate-card-thumbnail-size) + 200px\n );\n}\n\n:host {\n display: block;\n width: 100%;\n height: 100%;\n --frigate-card-carousel-thumbnail-opacity: 1;\n}\n\n:host([direction=vertical]) {\n height: 100%;\n}\n\n:host([direction=horizontal]) {\n height: auto;\n}\n\n.embla__slide {\n flex: 0 0 auto;\n opacity: var(--frigate-card-carousel-thumbnail-opacity);\n}\n\n.embla__slide.slide-selected {\n opacity: 1;\n}\n\nfrigate-card-thumbnail {\n width: var(--frigate-card-thumbnail-size);\n height: var(--frigate-card-thumbnail-size);\n max-width: 100%;\n}\n\nfrigate-card-thumbnail[details] {\n width: var(--frigate-card-thumbnail-details-width);\n}")}};e([he({attribute:!1})],TE.prototype,"hass",void 0),e([he({attribute:!1})],TE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1})],TE.prototype,"cameraManager",void 0),e([he({attribute:!1})],TE.prototype,"config",void 0),e([he({attribute:!1})],TE.prototype,"fadeThumbnails",void 0),TE=e([le("frigate-card-thumbnail-carousel")],TE);var jE=":host {\n width: 100%;\n height: 100%;\n display: block;\n}";const OE=document.createElement("template");OE.innerHTML='\n
\n
\n';class DE extends HTMLElement{constructor(){super();const e=this.attachShadow({mode:"open"});e.appendChild(OE.content.cloneNode(!0)),this._freeSpaceDiv=e.getElementById("fs")}connectedCallback(){this._freeSpaceDiv&&this._freeSpaceDiv.addEventListener("click",this.handleFreeSpaceDivClick),this.upgradeProperty("open")}disconnectedCallback(){document.removeEventListener("keyup",this.handleKeyUp)}upgradeProperty(e){if(this.hasOwnProperty(e)){let t=this[e];delete this[e],this[e]=t}}handleKeyUp=e=>{if(!e.altKey&&"Escape"===e.key)e.preventDefault(),this.open=!1};get open(){return this.hasAttribute("open")}set open(e){e?this.hasAttribute("open")||this.setAttribute("open",""):this.hasAttribute("open")&&this.removeAttribute("open")}static get observedAttributes(){return["open"]}attributeChangedCallback(e,t,n){"open"===e&&(this.open?(this.setAttribute("tabindex","0"),this.setAttribute("aria-disabled","false"),this.focus({preventScroll:!0}),document.addEventListener("keyup",this.handleKeyUp),this.dispatchEvent(new CustomEvent("open",{bubbles:!0}))):(this.setAttribute("tabindex","-1"),this.setAttribute("aria-disabled","true"),document.removeEventListener("keyup",this.handleKeyUp),this.dispatchEvent(new CustomEvent("close",{bubbles:!0}))))}handleFreeSpaceDivClick=()=>{this.open=!1}}customElements.define("side-drawer",DE);let RE=class extends se{constructor(){super(...arguments),this.location="left",this.control=!0,this.open=!1,this.empty=!0,this._refDrawer=ze(),this._refSlot=ze(),this._resizeObserver=new ResizeObserver((()=>this._hideDrawerIfNecessary())),this._isHoverableDevice=Yg()}firstUpdated(e){super.firstUpdated(e);const t=document.createElement("style");t.innerHTML=":host {\n width: unset;\n}\n\n#fs {\n display: none;\n width: 100%;\n inset: 0;\n}\n\n#d,\n#fs {\n height: 100%;\n position: absolute;\n}\n\n#d {\n overflow: visible;\n max-width: 90%;\n z-index: 10;\n}\n\n:host([location=right]) #d {\n left: unset;\n right: 0;\n transform: translateX(100%);\n}\n\n:host([location=right][open]) #d {\n transform: none;\n box-shadow: var(--frigate-card-css-box-shadow, 0px 0px 25px 0px black);\n}\n\n#ifs {\n height: 100%;\n}",this._refDrawer.value?.shadowRoot?.appendChild(t)}_slotChanged(){const e=this._refSlot.value?lf(this._refSlot.value):[];this._resizeObserver.disconnect();for(const t of e)this._resizeObserver.observe(t);this._hideDrawerIfNecessary()}_hideDrawerIfNecessary(){if(!this._refDrawer.value)return;const e=this._refSlot.value?lf(this._refSlot.value):null;this.empty=!e||!e.length||e.every((e=>{const t=e.getBoundingClientRect();return!t.width||!t.height}))}render(){return q` + {this.open&&(this.open=!1)}} + > + ${this.control?q` +
{wf(e),this.open=!this.open}} + > + {this._isHoverableDevice&&!this.open&&(this.open=!0)}} + > + +
+ `:""} + this._slotChanged()}> +
+ `}static get styles(){return o("side-drawer {\n background-color: var(--card-background-color);\n}\n\ndiv.control-surround {\n position: absolute;\n bottom: 50%;\n transform: translateY(50%);\n z-index: 0;\n padding-top: 20px;\n padding-bottom: 20px;\n}\n\n:host([location=left]) div.control-surround {\n padding-right: 12px;\n left: 100%;\n}\n\n:host([location=right]) div.control-surround {\n padding-left: 12px;\n right: 100%;\n}\n\n:host([empty]),\n:host([empty]) > * {\n visibility: hidden;\n}\n\n:host(:not([empty])),\n:host(:not([empty])) > * {\n visibility: visible;\n}\n\nha-icon.control {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.7);\n opacity: 0.5;\n pointer-events: all;\n --mdc-icon-size: 20px;\n padding-top: 20px;\n padding-bottom: 20px;\n transition: opacity 0.5s ease;\n}\n\n:host([open]) ha-icon.control,\nha-icon.control:hover {\n opacity: 1;\n background-color: black;\n}\n\n:host([location=left]) ha-icon.control {\n border-top-right-radius: 20px;\n border-bottom-right-radius: 20px;\n}\n\n:host([location=right]) ha-icon.control {\n border-top-left-radius: 20px;\n border-bottom-left-radius: 20px;\n}")}};e([he({attribute:!0,reflect:!0})],RE.prototype,"location",void 0),e([he({attribute:!0,reflect:!0,type:Boolean})],RE.prototype,"control",void 0),e([he({type:Boolean,reflect:!0,attribute:!0})],RE.prototype,"open",void 0),e([he({attribute:!1})],RE.prototype,"icons",void 0),e([he({type:Boolean,reflect:!0,attribute:!0})],RE.prototype,"empty",void 0),RE=e([le("frigate-card-drawer")],RE);let PE=class extends se{constructor(){super(...arguments),this._refDrawerLeft=ze(),this._refDrawerRight=ze(),this._boundDrawerHandler=this._drawerHandler.bind(this)}connectedCallback(){super.connectedCallback(),this.addEventListener("frigate-card:drawer:open",this._boundDrawerHandler),this.addEventListener("frigate-card:drawer:close",this._boundDrawerHandler)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("frigate-card:drawer:open",this._boundDrawerHandler),this.removeEventListener("frigate-card:drawer:close",this._boundDrawerHandler)}_drawerHandler(e){const t=e.detail.drawer,n=e.type.endsWith(":open");"left"===t&&this._refDrawerLeft.value?this._refDrawerLeft.value.open=n:"right"===t&&this._refDrawerRight.value&&(this._refDrawerRight.value.open=n)}render(){return q` + + + + + + + + `}static get styles(){return o(":host {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n position: relative;\n overflow: hidden;\n}\n\n::slotted(:not([slot])) {\n flex: 1;\n min-height: 0px;\n}")}};e([he({attribute:!1})],PE.prototype,"drawerIcons",void 0),PE=e([le("frigate-card-surround-basic")],PE);let LE=class extends se{_hasDrawer(){return!!this.thumbnailConfig&&["left","right"].includes(this.thumbnailConfig.mode)}willUpdate(e){this.timelineConfig?.mode&&"none"!==this.timelineConfig.mode&&import("./timeline-core-fabd0153.js");const t=this.viewManagerEpoch?.manager.getView();e.has("viewManagerEpoch")&&(this.viewManagerEpoch?.manager.hasMajorMediaChange(this.viewManagerEpoch?.oldView)||this.viewManagerEpoch?.oldView?.displayMode!==t?.displayMode)&&(this._cameraIDsForTimeline=this._getCameraIDsForTimeline()??void 0)}_getCameraIDsForTimeline(){const e=this.viewManagerEpoch?.manager.getView();if(!e||!this.cameraManager)return null;if(e.is("live")){const t={anyCapabilities:["clips","snapshots","recordings"]};return e.supportsMultipleDisplayModes()&&e.isGrid()?this.cameraManager.getStore().getCameraIDsWithCapability(t):this.cameraManager.getStore().getAllDependentCameras(e.camera,t)}return e.isViewerView()?e.query?.getQueryCameraIDs()??null:null}render(){const e=this.viewManagerEpoch?.manager.getView();if(!this.hass||!e)return;const t=(e,t)=>{this.thumbnailConfig&&this._hasDrawer()&&Bg(e.composedPath()[0],"drawer:"+t,{drawer:this.thumbnailConfig.mode})};return q` t(e,"open")} + @frigate-card:thumbnails:close=${e=>t(e,"close")} + > + ${this.thumbnailConfig&&"none"!==this.thumbnailConfig.mode?q` {const n=e.detail.queryResults.getSelectedResult();n&&(this.viewManagerEpoch?.manager.setViewByParameters({params:{view:"media",queryResults:e.detail.queryResults,...n.getCameraID()&&{camera:n.getCameraID()}},modifiers:[new wE(["timeline","mediaViewer"])]}),t(e,"close"))}} + > + `:""} + ${this.timelineConfig&&"none"!==this.timelineConfig.mode?q` + `:""} + + `}static get styles(){return o(jE)}};e([he({attribute:!1})],LE.prototype,"hass",void 0),e([he({attribute:!1})],LE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1,hasChanged:Qg})],LE.prototype,"thumbnailConfig",void 0),e([he({attribute:!1,hasChanged:Qg})],LE.prototype,"timelineConfig",void 0),e([he({attribute:!1})],LE.prototype,"cameraManager",void 0),e([he({attribute:!1})],LE.prototype,"cardWideConfig",void 0),LE=e([le("frigate-card-surround")],LE);var NE="Wed, 11 Dec 2024 03:36:17 GMT",FE="47fdfbc",VE="Tue, 10 Dec 2024 19:35:09 -0800";const HE=ba.object({domain:ba.string(),version:ba.string().optional()}).passthrough(),BE="hass_web_proxy",qE=(e,t)=>`/api/${BE}/v${t??0}/?url=${encodeURIComponent(e)}`,UE=(e,t,n="media")=>(e=>e.config.components.includes(BE))(e)&&!!t[n];async function WE(e,t,n){await e.callService(BE,"create_proxied_url",{url_pattern:t,...n&&{url_id:n.urlID,ssl_verification:n.sslVerification,ssl_ciphers:n.sslCiphers,open_limit:n.openLimit,ttl:n.ttl,allow_unauthenticated:n.allowUnauthenticated}})}const ZE=async(e,t)=>{let n=null;if(t)try{n=await(async(e,t)=>await $v(e,HE,{type:"manifest/get",integration:t}))(t,e)}catch(e){}return{detected:!!n,...n?.version&&{version:n.version}}};let QE=class extends se{constructor(){super(...arguments),this._diagnostics=null}async _fetchDiagnostics(){this._diagnostics=await(async(e,t,n)=>{const a=e&&t?await t.getMatchingDevices(e,(e=>"Frigate"===e.manufacturer)):[],i=new Map;return a?.forEach((e=>{e.config_entries.forEach((t=>{e.model&&i.set(t,e.model)}))})),{card_version:"6.0.3",browser:navigator.userAgent,date:new Date,lang:F_(),timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,git:{hash:FE,build_date:NE,commit_date:VE},...e&&{ha_version:e.config.version},integrations:{reolink:await ZE("reolink",e),frigate:{...await ZE("frigate",e),...i.size&&{devices:Object.fromEntries(i)}},hass_web_proxy:await ZE(BE,e),motioneye:await ZE("motioneye",e)},...n&&{config:n}}})(this.hass,this.deviceRegistryManager,this.rawConfig)}shouldUpdate(){return!!this._diagnostics||(this._fetchDiagnostics().then((()=>this.requestUpdate())),!1)}render(){return wk({message:V_("error.diagnostics"),type:"diagnostics",icon:"mdi:information",context:this._diagnostics})}static get styles(){return o(jE)}};e([he({attribute:!1})],QE.prototype,"hass",void 0),e([he({attribute:!1})],QE.prototype,"deviceRegistryManager",void 0),e([he({attribute:!1})],QE.prototype,"rawConfig",void 0),e([pe()],QE.prototype,"_diagnostics",void 0),QE=e([le("frigate-card-diagnostics")],QE);let GE=class extends se{willUpdate(e){if(e.has("viewManagerEpoch")||e.has("config")){const e=this.viewManagerEpoch?.manager.getView();(e?.is("live")||this._shouldLivePreload())&&import("./index-0a012f43.js").then((function(e){return e.i})),e?.isGalleryView()?import("./gallery-c718155d.js"):e?.isViewerView()?import("./index-0197eb89.js"):e?.is("image")?import("./image-cbfd7ccb.js"):e?.is("timeline")&&import("./timeline-62b72e11.js")}e.has("hide")&&(this.hide?this.setAttribute("hidden",""):this.removeAttribute("hidden"))}shouldUpdate(e){return!0}_shouldLivePreload(){const e=this.viewManagerEpoch?.manager.getView();return!!this.overriddenConfig?.live.preload&&!e?.is("diagnostics")}render(){if(!(this.hass&&this.overriddenConfig&&this.nonOverriddenConfig&&this.cardWideConfig))return q``;const e=this.viewManagerEpoch?.manager.getView(),t={hidden:this._shouldLivePreload()&&!e?.is("live")},n={hidden:!!this.hide},a=e?.is("live")?this.overriddenConfig.live.controls.thumbnails:e?.isViewerView()?this.overriddenConfig.media_viewer.controls.thumbnails:e?.is("timeline")?this.overriddenConfig.timeline.controls.thumbnails:void 0,i=e?.is("live")?this.overriddenConfig.live.controls.timeline:e?.isViewerView()?this.overriddenConfig.media_viewer.controls.timeline:void 0,r=e?this.cameraManager?.getStore().getCameraConfig(e.camera)??null:null;return q` + ${!this.hide&&e?.is("image")&&r?q` + `:""} + ${!this.hide&&e?.isGalleryView()?q` + `:""} + ${!this.hide&&e?.isViewerView()?q` + + + `:""} + ${!this.hide&&e?.is("timeline")?q` + `:""} + ${!this.hide&&e?.is("diagnostics")?q` + `:""} + ${this._shouldLivePreload()||!this.hide&&e?.is("live")?q` + + + `:""} + `}static get styles(){return o(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\n:host([hidden]),\n.hidden {\n display: none;\n}")}};e([he({attribute:!1})],GE.prototype,"hass",void 0),e([he({attribute:!1})],GE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1})],GE.prototype,"cameraManager",void 0),e([he({attribute:!1})],GE.prototype,"nonOverriddenConfig",void 0),e([he({attribute:!1})],GE.prototype,"overriddenConfig",void 0),e([he({attribute:!1})],GE.prototype,"cardWideConfig",void 0),e([he({attribute:!1})],GE.prototype,"rawConfig",void 0),e([he({attribute:!1})],GE.prototype,"resolvedMediaCache",void 0),e([he({attribute:!1})],GE.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],GE.prototype,"hide",void 0),e([he({attribute:!1})],GE.prototype,"microphoneManager",void 0),e([he({attribute:!1})],GE.prototype,"triggeredCameraIDs",void 0),e([he({attribute:!1})],GE.prototype,"deviceRegistryManager",void 0),GE=e([le("frigate-card-views")],GE);console.info(`%c FRIGATE-HASS-CARD \n%c ${V_("common.version")} 6.0.3`,"color: pink; font-weight: bold; background: black","color: white; font-weight: bold; background: dimgray"),window.customCards=window.customCards||[],window.customCards.push({type:"frigate-card",name:V_("common.frigate_card"),description:V_("common.frigate_card_description"),preview:!0,documentationURL:wa});let YE=class extends se{constructor(){super(...arguments),this._controller=new Ax(this,(()=>this._refMain.value?.scroll({top:0})),(()=>this._refMenu.value?.toggleMenu()),this._requestUpdateForComponentsThatUseConditions.bind(this)),this._menuButtonController=new zx,this._refMenu=ze(),this._refOverlay=ze(),this._refMain=ze(),this._refElements=ze(),this._refViews=ze()}get _config(){return this._controller.getConfigManager().getConfig()}get _hass(){return this._controller.getHASSManager().getHASS()}set hass(e){this._controller.getHASSManager().setHASS(e),this._refMenu.value&&(this._refMenu.value.hass=e),this._refElements.value&&(this._refElements.value.hass=e),this._refViews.value&&(this._refViews.value.hass=e)}static async getConfigElement(){return await Ax.getConfigElement()}static getStubConfig(e,t){return Ax.getStubConfig(t)}_requestUpdateForComponentsThatUseConditions(){this._refViews.value&&(this._refViews.value.conditionsManagerEpoch=this._controller.getConditionsManager().getEpoch()??void 0),this._refElements.value&&(this._refElements.value.conditionsManagerEpoch=this._controller.getConditionsManager().getEpoch()??void 0)}setConfig(e){this._controller.getConfigManager().setConfig(e)}shouldUpdate(){return!!this.isConnected&&(this._controller.getMessageManager().hasMessage()||this._controller.getInitializationManager().isInitializedMandatory()||this._controller.getInitializationManager().initializeMandatory(),!0)}_renderMenuStatusContainer(e){if(!this._config)return;const t=this._config.menu.style,n=this._config.menu.position,a=this._config.status_bar.style,i=this._config.status_bar.position;if("none"===t&&"none"===a||"overlay"===e&&"outside"===t&&"outside"===a||"overlay"!==e&&("outside"!==t||n!==e)&&("outside"!==a||i!==e))return;const r=e=>{const r="none"!==t&&("outside"===t&&"outerlay"===e||"outside"!==t&&"overlay"===e),o="none"!==a&&("outside"===a&&"outerlay"===e||"outside"!==a&&"overlay"===e),s="left"===n||"right"===n||"bottom"===n&&"hidden"===t&&"popup"!==a||"top"===n&&("hidden"!==t||"popup"===a);return q` + ${r&&s?this._renderMenu(n):""} + ${o?this._renderStatusBar(i):""} + ${r&&!s?this._renderMenu(n):""} + `};return q` + ${"overlay"===e?q`${r("overlay")}`:q`
+ ${r("outerlay")} +
`} + `}_renderMenu(e){const t=this._controller.getViewManager().getView();if(this._hass&&this._config)return q` + + `}_renderStatusBar(e){if(this._config)return q` + + `}updated(){this._controller.getInitializationManager().isInitializedMandatory()&&this._controller.getQueryStringManager().executeIfNecessary()}_renderInDialogIfNecessary(e){return this._controller.getExpandManager().isExpanded()?q` {this._controller.getExpandManager().setExpanded(!1)}} + > + ${e} + `:e}render(){if(!this._hass)return;const e={main:!0,"curve-top":"outside"!==this._config?.menu.style||"top"!==this._config?.menu.position,"curve-bottom":"outside"!==this._config?.menu.style||"top"===this._config?.menu.position},t=this._controller.getActionsManager().getMergedActions(),n=this._controller.getCameraManager(),a=!1!==this._config?.performance?.features.animated_progress_indicator&&!this._controller.getInitializationManager().wasEverInitialized()&&!this._controller.getMessageManager().hasMessage();return this._renderInDialogIfNecessary(q` this._controller.getMessageManager().setMessageIfHigherPriority(e.detail)} + @frigate-card:media:loaded=${e=>this._controller.getMediaLoadedInfoManager().set(e.detail)} + @frigate-card:media:unloaded=${()=>this._controller.getMediaLoadedInfoManager().clear()} + @frigate-card:media:volumechange=${()=>this.requestUpdate()} + @frigate-card:media:play=${()=>this.requestUpdate()} + @frigate-card:media:pause=${()=>this.requestUpdate()} + @frigate-card:focus=${()=>this.focus()} + > + ${a?q``:""} + ${this._renderMenuStatusContainer("top")} + ${this._renderMenuStatusContainer("overlay")} +
+ + ${wk(this._controller.getMessageManager().getMessage())} +
+ ${this._renderMenuStatusContainer("bottom")} + ${this._config?.elements?q` {this._menuButtonController.addDynamicMenuButton(e.detail),this.requestUpdate()}} + @frigate-card:menu:remove=${e=>{this._menuButtonController.removeDynamicMenuButton(e.detail),this.requestUpdate()}} + @frigate-card:status-bar:add=${e=>{this._controller.getStatusBarItemManager().addDynamicStatusBarItem(e.detail)}} + @frigate-card:status-bar:remove=${e=>{this._controller.getStatusBarItemManager().removeDynamicStatusBarItem(e.detail)}} + @frigate-card:conditions:evaluate=${e=>{e.evaluation=this._controller.getConditionsManager()?.evaluateConditions(e.conditions)}} + > + `:""} +
`)}static get styles(){return o(':host {\n display: block;\n position: relative;\n background-color: var(--card-background-color);\n border-radius: var(--ha-card-border-radius, 4px);\n height: var(--frigate-card-height);\n min-height: 100px;\n pointer-events: all;\n --frigate-card-expand-max-height: calc((100vh - (2 * 56px)) * 0.85);\n --frigate-card-expand-max-width: 85vw;\n --frigate-card-expand-width: none;\n --frigate-card-expand-height: none;\n --frigate-card-expand-aspect-ratio: unset;\n --frigate-card-height: auto;\n}\n\nfrigate-card-loading {\n position: absolute;\n inset: 0;\n z-index: 1;\n}\n\n:host([dark]) {\n filter: brightness(75%);\n}\n\n:host([panel]) {\n height: 100%;\n}\n\ndiv.main {\n position: relative;\n overflow: auto;\n width: 100%;\n height: 100%;\n margin: auto;\n display: block;\n transform: translateZ(0);\n scrollbar-width: none;\n -ms-overflow-style: none;\n}\n\n/* Hide scrollbar for Chrome, Safari and Opera */\ndiv.main::-webkit-scrollbar {\n display: none;\n}\n\ndiv.main.curve-top {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\ndiv.main.curve-bottom {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}\n\nha-card {\n display: flex;\n flex-direction: column;\n margin: auto;\n border: 0px;\n overflow: visible;\n width: 100%;\n height: 100%;\n position: static;\n color: var(--secondary-text-color, white);\n}\n\n/************\n * Fullscreen\n *************/\n:host(:fullscreen) #ha-card {\n border-radius: 0px;\n box-shadow: none;\n margin: 0;\n}\n\n:host(:-webkit-full-screen) #ha-card {\n border-radius: 0px;\n box-shadow: none;\n margin: 0;\n}\n\n:host(:fullscreen) div.main,\n:host(:fullscreen) frigate-card-menu {\n border-radius: 0px;\n}\n\n:host(:-webkit-full-screen) div.main,\n:host(:-webkit-full-screen) frigate-card-menu {\n border-radius: 0px;\n}\n\n/***************\n * Expanded mode\n ***************/\nweb-dialog {\n --dialog-padding: 0px;\n --dialog-container-padding: 0px;\n --dialog-max-height: var(--frigate-card-expand-max-height);\n --dialog-max-width: var(--frigate-card-expand-max-width);\n --dialog-width: var(--frigate-card-expand-width);\n --dialog-height: var(--frigate-card-expand-height);\n --dialog-overflow-x: visible;\n --dialog-overflow-y: visible;\n max-height: 100vh;\n}\n\nweb-dialog::part(dialog) {\n aspect-ratio: var(--frigate-card-expand-aspect-ratio);\n border-radius: 0px;\n background: transparent;\n}\n\n/*************************************\n * "Outside" style for menu/status bar\n *************************************/\n.outerlay[data-position=top] > *:first-child {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n.outerlay[data-position=bottom] > *:last-child {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n/*******************\n * Menu hover styles\n *******************/\nfrigate-card-menu {\n z-index: 2;\n}\n\nfrigate-card-menu[data-style*=hover] {\n transition: opacity 0.5s ease;\n opacity: 0;\n}\n\nfrigate-card-menu[data-style*=hover]:hover,\nha-card:hover > frigate-card-overlay > frigate-card-menu[data-style=hover-card] {\n opacity: 1;\n}\n\n/*************************\n * Status bar hover styles\n *************************/\nfrigate-card-status-bar {\n z-index: 1;\n}\n\nfrigate-card-status-bar[data-style*=hover] {\n transition: opacity 0.5s ease;\n opacity: 0;\n}\n\nfrigate-card-status-bar[data-style*=hover]:hover,\nha-card:hover > frigate-card-overlay > frigate-card-status-bar[data-style=hover-card] {\n opacity: 1;\n}')}getCardSize(){return 6}};YE=e([le("frigate-card")],YE);export{Il as $,tr as A,nr as B,Zi as C,ar as D,ir as E,rr as F,Pi as G,Li as H,Ni as I,Fi as J,Vi as K,Hi as L,Bi as M,qi as N,Ui as O,gs as P,Ws as Q,ns as R,Us as S,qo as T,Fo as U,Vo as V,Ho as W,Bo as X,Bs as Y,zl as Z,e as _,se as a,dr as a$,H_ as a0,tw as a1,et as a2,nw as a3,$s as a4,Di as a5,ji as a6,Oi as a7,Ri as a8,Wi as a9,Yr as aA,oo as aB,so as aC,lo as aD,uo as aE,co as aF,ao as aG,io as aH,ro as aI,mo as aJ,_o as aK,vo as aL,ho as aM,po as aN,fo as aO,go as aP,eo as aQ,no as aR,to as aS,Xr as aT,Jr as aU,Kr as aV,Ao as aW,Io as aX,zo as aY,hr as aZ,cr as a_,es as aa,Jo as ab,Xo as ac,ts as ad,hs as ae,us as af,ms as ag,qs as ah,ps as ai,So as aj,Co as ak,To as al,Mo as am,ko as an,qr as ao,Ur as ap,Wr as aq,Zr as ar,Eo as as,$o as at,yo as au,xo as av,bo as aw,wo as ax,Qr as ay,Gr as az,pe as b,ja as b$,ur as b0,lr as b1,sr as b2,mr as b3,gr as b4,fr as b5,_r as b6,xr as b7,Hr as b8,Cr as b9,Po as bA,Wo as bB,Zo as bC,Go as bD,Yo as bE,Qo as bF,Uo as bG,vs as bH,_s as bI,ys as bJ,xs as bK,Cs as bL,As as bM,Ms as bN,Es as bO,Ss as bP,Jb as bQ,Kb as bR,Uk as bS,Ug as bT,Ma as bU,Ja as bV,Ya as bW,La as bX,Na as bY,ka as bZ,Oa as b_,kr as ba,Mr as bb,vr as bc,wr as bd,yr as be,br as bf,Sr as bg,Er as bh,$r as bi,Or as bj,zr as bk,Tr as bl,jr as bm,Ir as bn,Ar as bo,Pr as bp,Fr as bq,Vr as br,Dr as bs,Rr as bt,Nr as bu,Lr as bv,Ro as bw,Lo as bx,Oo as by,Do as bz,ew as c,wf as c$,Da as c0,Ta as c1,Ga as c2,Ua as c3,Wa as c4,Za as c5,Qa as c6,_i as c7,fi as c8,Ra as c9,ai as cA,ii as cB,Sa as cC,Ea as cD,pi as cE,hi as cF,gi as cG,mi as cH,Fd as cI,Ca as cJ,ks as cK,ge as cL,fe as cM,W as cN,xe as cO,Gw as cP,Mk as cQ,ze as cR,Yw as cS,df as cT,wk as cU,je as cV,Qg as cW,vw as cX,td as cY,kk as cZ,Ky as c_,Pa as ca,Ha as cb,qa as cc,Fa as cd,Va as ce,Ba as cf,Ka as cg,Xa as ch,ti as ci,ei as cj,yi as ck,vi as cl,bi as cm,wi as cn,$a as co,Aa as cp,za as cq,Ia as cr,ni as cs,ri as ct,oi as cu,si as cv,ci as cw,li as cx,di as cy,ui as cz,aw as d,ba as d$,My as d0,ve as d1,jE as d2,Vd as d3,nu as d4,c as d5,ux as d6,Qv as d7,hx as d8,lx as d9,wx as dA,Ck as dB,U as dC,xf as dD,Bw as dE,kE as dF,CE as dG,yf as dH,Fk as dI,vf as dJ,kf as dK,bf as dL,p_ as dM,h_ as dN,Pv as dO,Lv as dP,Ud as dQ,Vv as dR,Yg as dS,Kg as dT,Cx as dU,Gy as dV,gx as dW,su as dX,sf as dY,Fv as dZ,Hg as d_,px as da,Gg as db,Ev as dc,Wu as dd,Xg as de,Qu as df,Bg as dg,qw as dh,af as di,SE as dj,kx as dk,xk as dl,$w as dm,tx as dn,hy as dp,Bb as dq,qb as dr,UE as ds,WE as dt,Ib as du,qE as dv,Qw as dw,Kw as dx,Xw as dy,Jw as dz,_e as e,nf as e0,$v as e1,zs as e2,Kv as e3,Wv as e4,Z_ as e5,Q_ as e6,Yv as e7,Jg as e8,tf as e9,Lu as eA,Vb as eB,Zv as eC,Nb as eD,lf as eE,qy as eF,Uy as eG,Wy as eH,pf as eI,Qy as eJ,Rg as eK,Zy as eL,s as eM,Ae as eN,ye as eO,Zw as eP,bE as eQ,me as eR,be as eS,jb as eT,Gv as ea,Hk as eb,Hv as ec,rf as ed,Tv as ee,Bk as ef,Iv as eg,zv as eh,jv as ei,qk as ej,Xd as ek,Hd as el,Gd as em,Qd as en,Yd as eo,vu as ep,Jd as eq,eu as er,yu as es,_u as et,Bd as eu,au as ev,gu as ew,Ou as ex,Nu as ey,Fu as ez,ww as f,Fb as g,Xb as h,Dv as i,Lb as j,qg as k,V_ as l,Ki as m,he as n,Gi as o,Ld as p,Qi as q,o as r,of as s,le as t,Yi as u,Hb as v,Xi as w,q as x,er as y,Ji as z}; diff --git a/config/www/community/frigate-hass-card/card-c642ee74.js.gz b/config/www/community/frigate-hass-card/card-c642ee74.js.gz new file mode 100644 index 00000000..050ed8d9 Binary files /dev/null and b/config/www/community/frigate-hass-card/card-c642ee74.js.gz differ diff --git a/config/www/community/frigate-hass-card/date-picker-3dacab82.js b/config/www/community/frigate-hass-card/date-picker-3dacab82.js new file mode 100644 index 00000000..e52587a0 --- /dev/null +++ b/config/www/community/frigate-hass-card/date-picker-3dacab82.js @@ -0,0 +1,15 @@ +import{_ as e,n as t,t as n,a as i,cR as a,x as l,l as s,cV as o,c$ as r,r as c,dg as h}from"./card-09c4bade.js";let p=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;h(this,"date-picker:change",{date:e?new Date(e):null})};return l`e()} + @change=${()=>e()} + /> + {r(e),this._refInput.value?.showPicker()}} + > + `}static get styles(){return c(":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}\nha-icon {\n display: block;\n height: 100%;\n width: 100%;\n position: absolute;\n}")}};e([t({attribute:!1})],p.prototype,"icon",void 0),p=e([n("frigate-card-date-picker")],p);export{p as F}; diff --git a/config/www/community/frigate-hass-card/date-picker-3dacab82.js.gz b/config/www/community/frigate-hass-card/date-picker-3dacab82.js.gz new file mode 100644 index 00000000..2e22753d Binary files /dev/null and b/config/www/community/frigate-hass-card/date-picker-3dacab82.js.gz differ diff --git a/config/www/community/frigate-hass-card/date-picker-40111fdc.js b/config/www/community/frigate-hass-card/date-picker-40111fdc.js new file mode 100644 index 00000000..304d5917 --- /dev/null +++ b/config/www/community/frigate-hass-card/date-picker-40111fdc.js @@ -0,0 +1,15 @@ +import{_ as e,n as t,t as n,a as i,cR as a,x as l,l as s,cV as o,c$ as r,r as c,dg as h}from"./card-45855f1f.js";let p=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;h(this,"date-picker:change",{date:e?new Date(e):null})};return l`e()} + @change=${()=>e()} + /> + {r(e),this._refInput.value?.showPicker()}} + > + `}static get styles(){return c(":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}\nha-icon {\n display: block;\n height: 100%;\n width: 100%;\n position: absolute;\n}")}};e([t({attribute:!1})],p.prototype,"icon",void 0),p=e([n("frigate-card-date-picker")],p);export{p as F}; diff --git a/config/www/community/frigate-hass-card/date-picker-40111fdc.js.gz b/config/www/community/frigate-hass-card/date-picker-40111fdc.js.gz new file mode 100644 index 00000000..009dbb19 Binary files /dev/null and b/config/www/community/frigate-hass-card/date-picker-40111fdc.js.gz differ diff --git a/config/www/community/frigate-hass-card/date-picker-576d50a8.js b/config/www/community/frigate-hass-card/date-picker-576d50a8.js new file mode 100644 index 00000000..b3acf888 --- /dev/null +++ b/config/www/community/frigate-hass-card/date-picker-576d50a8.js @@ -0,0 +1,15 @@ +import{_ as e,n as t,t as n,a as i,cM as a,x as l,l as s,cQ as c,cX as o,r,dc as h}from"./card-320adb66.js";let p=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;h(this,"date-picker:change",{date:e?new Date(e):null})};return l`e()} + @change=${()=>e()} + /> + {o(e),this._refInput.value?.showPicker()}} + > + `}static get styles(){return r(":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}\nha-icon {\n display: block;\n height: 100%;\n width: 100%;\n position: absolute;\n}")}};e([t({attribute:!1})],p.prototype,"icon",void 0),p=e([n("frigate-card-date-picker")],p);export{p as F}; diff --git a/config/www/community/frigate-hass-card/date-picker-576d50a8.js.gz b/config/www/community/frigate-hass-card/date-picker-576d50a8.js.gz new file mode 100644 index 00000000..0099ac91 Binary files /dev/null and b/config/www/community/frigate-hass-card/date-picker-576d50a8.js.gz differ diff --git a/config/www/community/frigate-hass-card/date-picker-8102261e.js b/config/www/community/frigate-hass-card/date-picker-8102261e.js new file mode 100644 index 00000000..3b55876f --- /dev/null +++ b/config/www/community/frigate-hass-card/date-picker-8102261e.js @@ -0,0 +1,15 @@ +import{_ as e,n as t,t as n,a as i,cR as a,x as l,l as s,cV as o,c$ as r,r as c,dg as h}from"./card-769e2b91.js";let p=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;h(this,"date-picker:change",{date:e?new Date(e):null})};return l`e()} + @change=${()=>e()} + /> + {r(e),this._refInput.value?.showPicker()}} + > + `}static get styles(){return c(":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}\nha-icon {\n display: block;\n height: 100%;\n width: 100%;\n position: absolute;\n}")}};e([t({attribute:!1})],p.prototype,"icon",void 0),p=e([n("frigate-card-date-picker")],p);export{p as F}; diff --git a/config/www/community/frigate-hass-card/date-picker-8102261e.js.gz b/config/www/community/frigate-hass-card/date-picker-8102261e.js.gz new file mode 100644 index 00000000..aa8f1891 Binary files /dev/null and b/config/www/community/frigate-hass-card/date-picker-8102261e.js.gz differ diff --git a/config/www/community/frigate-hass-card/date-picker-86e47001.js b/config/www/community/frigate-hass-card/date-picker-86e47001.js new file mode 100644 index 00000000..fdff505b --- /dev/null +++ b/config/www/community/frigate-hass-card/date-picker-86e47001.js @@ -0,0 +1,15 @@ +import{_ as e,n as t,t as n,a as i,cR as a,x as l,l as s,cV as o,c$ as r,r as c,dg as h}from"./card-7cd05290.js";let p=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;h(this,"date-picker:change",{date:e?new Date(e):null})};return l`e()} + @change=${()=>e()} + /> + {r(e),this._refInput.value?.showPicker()}} + > + `}static get styles(){return c(":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}\nha-icon {\n display: block;\n height: 100%;\n width: 100%;\n position: absolute;\n}")}};e([t({attribute:!1})],p.prototype,"icon",void 0),p=e([n("frigate-card-date-picker")],p);export{p as F}; diff --git a/config/www/community/frigate-hass-card/date-picker-86e47001.js.gz b/config/www/community/frigate-hass-card/date-picker-86e47001.js.gz new file mode 100644 index 00000000..0ee9cf2a Binary files /dev/null and b/config/www/community/frigate-hass-card/date-picker-86e47001.js.gz differ diff --git a/config/www/community/frigate-hass-card/date-picker-cfd85f75.js b/config/www/community/frigate-hass-card/date-picker-cfd85f75.js new file mode 100644 index 00000000..36375899 --- /dev/null +++ b/config/www/community/frigate-hass-card/date-picker-cfd85f75.js @@ -0,0 +1,15 @@ +import{_ as e,n as t,t as n,a as i,cR as a,x as l,l as s,cV as o,c$ as r,r as c,dg as h}from"./card-c642ee74.js";let p=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;h(this,"date-picker:change",{date:e?new Date(e):null})};return l`e()} + @change=${()=>e()} + /> + {r(e),this._refInput.value?.showPicker()}} + > + `}static get styles(){return c(":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}\nha-icon {\n display: block;\n height: 100%;\n width: 100%;\n position: absolute;\n}")}};e([t({attribute:!1})],p.prototype,"icon",void 0),p=e([n("frigate-card-date-picker")],p);export{p as F}; diff --git a/config/www/community/frigate-hass-card/date-picker-cfd85f75.js.gz b/config/www/community/frigate-hass-card/date-picker-cfd85f75.js.gz new file mode 100644 index 00000000..6a07b442 Binary files /dev/null and b/config/www/community/frigate-hass-card/date-picker-cfd85f75.js.gz differ diff --git a/config/www/community/frigate-hass-card/dispatch-live-error-c649b480.js b/config/www/community/frigate-hass-card/dispatch-live-error-c649b480.js new file mode 100644 index 00000000..027ea950 --- /dev/null +++ b/config/www/community/frigate-hass-card/dispatch-live-error-c649b480.js @@ -0,0 +1,33 @@ +import{dx as t,dy as a,dz as n,dA as i,cL as o,dB as e,_ as r,n as s,b as l,t as d,a as c,dC as h,x as m,e as u,dD as p,r as g,dE as _,dF as f,dG as v,dH as b,dI as y,l as z,dc as w}from"./card-320adb66.js"; +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const C={},x=t(class extends a{constructor(){super(...arguments),this.ot=C}render(t,a){return a()}update(t,[a,i]){if(Array.isArray(a)){if(Array.isArray(this.ot)&&this.ot.length===a.length&&a.every(((t,a)=>t===this.ot[a])))return n}else if(this.ot===a)return n;return this.ot=Array.isArray(a)?Array.from(a):a,this.render(a,i)}});class I{constructor(){this._options=null,this._viewportIntersecting=null,this._microphoneMuteTimer=new i,this._root=null,this._eventListeners=new Map,this._children=[],this._target=null,this._mutationObserver=new MutationObserver(this._mutationHandler.bind(this)),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this)),this._mediaLoadedHandler=async t=>{this._target?.index===t&&(await this._unmuteTargetIfConfigured(this._target.selected?"selected":"visible"),await this._playTargetIfConfigured(this._target.selected?"selected":"visible"))},this._visibilityHandler=async()=>{await this._changeVisibility("visible"===document.visibilityState)},this._changeVisibility=async t=>{t?(await this._unmuteTargetIfConfigured("visible"),await this._playTargetIfConfigured("visible")):(await this._pauseAllIfConfigured("hidden"),await this._muteAllIfConfigured("hidden"))},this._microphoneChangeHandler=async t=>{"unmuted"===t?await this._unmuteTargetIfConfigured("microphone"):"muted"===t&&this._options?.autoMuteConditions?.includes("microphone")&&this._microphoneMuteTimer.start(this._options.microphoneMuteSeconds??60,(async()=>{await this._muteTargetIfConfigured("microphone")}))}}setOptions(t){this._options=t,this._options?.microphoneManager&&(this._options.microphoneManager.removeListener(this._microphoneChangeHandler),this._options.microphoneManager.addListener(this._microphoneChangeHandler))}hasRoot(){return!!this._root}destroy(){this._viewportIntersecting=null,this._microphoneMuteTimer.stop(),this._root=null,this._removeChildHandlers(),this._children=[],this._target=null,this._mutationObserver.disconnect(),this._intersectionObserver.disconnect(),this._options?.microphoneManager?.removeListener(this._microphoneChangeHandler),document.removeEventListener("visibilitychange",this._visibilityHandler)}async setTarget(t,a){this._target?.index===t&&this._target?.selected===a||(this._target?.selected&&(await this._pauseTargetIfConfigured("unselected"),await this._muteTargetIfConfigured("unselected"),this._microphoneMuteTimer.stop()),this._target={selected:a,index:t},a?(await this._unmuteTargetIfConfigured("selected"),await this._playTargetIfConfigured("selected")):(await this._unmuteTargetIfConfigured("visible"),await this._playTargetIfConfigured("visible")))}unsetTarget(){this._target=null}async _playTargetIfConfigured(t){null!==this._target&&this._options?.autoPlayConditions?.includes(t)&&await this._play(this._target.index)}async _play(t){await(this._children[t]?.play())}async _unmuteTargetIfConfigured(t){null!==this._target&&this._options?.autoUnmuteConditions?.includes(t)&&await this._unmute(this._target.index)}async _unmute(t){await(this._children[t]?.unmute())}async _pauseAllIfConfigured(t){if(this._options?.autoPauseConditions?.includes(t))for(const t of this._children.keys())await this._pause(t)}async _pauseTargetIfConfigured(t){null!==this._target&&this._options?.autoPauseConditions?.includes(t)&&await this._pause(this._target.index)}async _pause(t){await(this._children[t]?.pause())}async _muteAllIfConfigured(t){if(this._options?.autoMuteConditions?.includes(t))for(const t of this._children.keys())await this._mute(t)}async _muteTargetIfConfigured(t){null!==this._target&&this._options?.autoMuteConditions?.includes(t)&&await this._mute(this._target.index)}async _mute(t){await(this._children[t]?.mute())}_mutationHandler(t,a){this._initializeRoot()}_removeChildHandlers(){for(const[t,a]of this._eventListeners.entries())t.removeEventListener("frigate-card:media:loaded",a);this._eventListeners.clear()}initialize(t){this._root=t,this._initializeRoot(),document.addEventListener("visibilitychange",this._visibilityHandler),this._intersectionObserver.disconnect(),this._intersectionObserver.observe(t),this._mutationObserver.disconnect(),this._mutationObserver.observe(this._root,{childList:!0,subtree:!0})}_initializeRoot(){if(this._options&&this._root){this._removeChildHandlers(),this._children=[...this._root.querySelectorAll(this._options.playerSelector)];for(const[t,a]of this._children.entries()){const n=()=>this._mediaLoadedHandler(t);this._eventListeners.set(a,n),a.addEventListener("frigate-card:media:loaded",n)}}}async _intersectionHandler(t){const a=this._viewportIntersecting;this._viewportIntersecting=t.some((t=>t.isIntersecting)),null!==a&&a!==this._viewportIntersecting&&await this._changeVisibility(this._viewportIntersecting)}}const A={active:!0,breakpoints:{},lazyLoadCount:0};function L(t={}){let a,n,i;const o=new Set,e=["init","select"],r=["select"];function s(){"hidden"===document.visibilityState&&a.lazyUnloadConditions?.includes("hidden")?o.forEach((t=>{a.lazyUnloadCallback&&(a.lazyUnloadCallback(t,i[t]),o.delete(t))})):"visible"===document.visibilityState&&a.lazyLoadCallback&&d()}function l(t){return o.has(t)}function d(){const t=a.lazyLoadCount,e=n.selectedScrollSnap(),r=new Set;for(let a=1;a<=t&&e-a>=0;a++)r.add(e-a);r.add(e);for(let a=1;a<=t&&e+a{!l(t)&&a.lazyLoadCallback&&(o.add(t),a.lazyLoadCallback(t,i[t]))}))}function c(){const t=n.previousScrollSnap();l(t)&&a.lazyUnloadCallback&&(a.lazyUnloadCallback(t,i[t]),o.delete(t))}return{name:"autoLazyLoad",options:t,init:function(o,l){const{mergeOptions:h,optionsAtMedia:m}=l,u=h(A,t);a=m(u),n=o,i=n.slideNodes(),a.lazyLoadCallback&&e.forEach((t=>n.on(t,d))),a.lazyUnloadCallback&&a.lazyUnloadConditions?.includes("unselected")&&r.forEach((t=>n.on(t,c))),document.addEventListener("visibilitychange",s)},destroy:function(){a.lazyLoadCallback&&e.forEach((t=>n.off(t,d))),a.lazyUnloadCallback&&r.forEach((t=>n.off(t,c))),document.removeEventListener("visibilitychange",s)}}}function S(){let t,a=[];const n=[];function i(i){const o=i.composedPath();for(const[e,r]of[...a.entries()].reverse())if(o.includes(r)){n[e]=i.detail,e!==t.selectedScrollSnap()&&i.stopPropagation();break}}function e(i){const o=i.composedPath();for(const[e,r]of a.entries())if(o.includes(r)){delete n[e],e!==t.selectedScrollSnap()&&i.stopPropagation();break}}function r(){const i=t.selectedScrollSnap(),e=n[i];e&&o(a[i],e)}return{name:"autoMediaLoadedInfo",options:{},init:function(n){t=n,a=t.slideNodes();for(const t of a)t.addEventListener("frigate-card:media:loaded",i),t.addEventListener("frigate-card:media:unloaded",e);t.on("init",r),t.containerNode().addEventListener("frigate-card:carousel:force-select",r)},destroy:function(){for(const t of a)t.removeEventListener("frigate-card:media:loaded",i),t.removeEventListener("frigate-card:media:unloaded",e);t.off("init",r),t.containerNode().removeEventListener("frigate-card:carousel:force-select",r)}}}class T{constructor(t){this._scrolling=!1,this._shouldReInitOnScrollStop=!1,this._scrollingStart=()=>{this._scrolling=!0},this._scrollingStop=()=>{this._scrolling=!1,this._shouldReInitOnScrollStop&&(this._shouldReInitOnScrollStop=!1,this._debouncedReInit())},this._debouncedReInit=e((()=>{this._scrolling=!1,this._shouldReInitOnScrollStop=!1,this._emblaApi?.reInit()}),500,{trailing:!0}),this._emblaApi=t,this._emblaApi.on("scroll",this._scrollingStart),this._emblaApi.on("settle",this._scrollingStop),this._emblaApi.on("destroy",this.destroy)}destroy(){this._emblaApi.off("scroll",this._scrollingStart),this._emblaApi.off("settle",this._scrollingStop),this._emblaApi.off("destroy",this.destroy)}reinit(){this._scrolling?this._shouldReInitOnScrollStop=!0:this._debouncedReInit()}}function $(){let t,a=null,n=null;const i=new Map,o=new ResizeObserver((function(t){let a=!1;for(const n of t){const t={height:n.contentRect.height,width:n.contentRect.width},o=i.get(n.target);t.width&&t.height&&(o?.height!==t.height||o?.width!==t.width)&&(i.set(n.target,t),a=!0)}a&&s()})),r=new IntersectionObserver((function(t){const i=t.some((t=>t.isIntersecting));if(i!==n){const t=i&&null!==n;n=i,t&&a?.reinit()}})),s=e((()=>function(){const{slideRegistry:n,options:{axis:i}}=t.internalEngine();if("y"===i)return;t.containerNode().style.removeProperty("max-height");const o=n[t.selectedScrollSnap()],e=t.slideNodes(),r=Math.max(...o.map((t=>e[t].getBoundingClientRect().height)));!isNaN(r)&&r>0&&(t.containerNode().style.maxHeight=`${r}px`);a?.reinit()}()),200,{trailing:!0});return{name:"autoSize",options:{},init:function(n){t=n,a=new T(t),r.observe(t.containerNode()),o.observe(t.containerNode());for(const a of t.slideNodes())o.observe(a);t.containerNode().addEventListener("frigate-card:media:loaded",s),t.on("settle",s)},destroy:function(){r.disconnect(),o.disconnect(),a?.destroy(),t.containerNode().removeEventListener("frigate-card:media:loaded",s),t.off("settle",s)}}}let P=class extends c{constructor(){super(...arguments),this.disabled=!1,this.label="",this._thumbnailError=!1,this._embedThumbnailTask=h(this,(()=>this.hass),(()=>this.thumbnail))}set controlConfig(t){t?.size&&this.style.setProperty("--frigate-card-next-prev-size",`${t.size}px`),this._controlConfig=t}render(){if(this.disabled||!this._controlConfig||"none"==this._controlConfig.style)return m``;const t=!this.thumbnail||["chevrons","icons"].includes(this._controlConfig.style)||this._thumbnailError,a={controls:!0,left:"left"===this.side,right:"right"===this.side,thumbnails:!t,icons:t,button:t};if(t){const t=this.thumbnail&&this.icon&&"chevrons"!==this._controlConfig.style&&!this._thumbnailError?this.icon:"left"===this.side?"mdi:chevron-left":"mdi:chevron-right";return m` + + `}return p(this._embedThumbnailTask,(t=>t?m``:m``),{inProgressFunc:()=>m`
`,errorFunc:t=>{this._thumbnailError=!0}})}static get styles(){return g("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n --frigate-card-next-prev-size: 48px;\n --frigate-card-next-prev-size-hover: calc(var(--frigate-card-next-prev-size) * 2);\n --frigate-card-left-position: 45px;\n --frigate-card-right-position: 45px;\n --mdc-icon-button-size: var(--frigate-card-next-prev-size);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n}\n\n.controls {\n position: absolute;\n z-index: 1;\n overflow: hidden;\n}\n\n.controls.left {\n left: var(--frigate-card-left-position);\n}\n\n.controls.right {\n right: var(--frigate-card-right-position);\n}\n\n.controls.icons {\n top: calc(50% - var(--frigate-card-next-prev-size) / 2);\n}\n\n.controls.thumbnails {\n border-radius: 50%;\n height: var(--frigate-card-next-prev-size);\n top: calc(50% - var(--frigate-card-next-prev-size) / 2);\n box-shadow: var(--frigate-card-css-box-shadow, 0px 0px 20px 5px black);\n transition: all 0.2s ease-out;\n opacity: 0.8;\n aspect-ratio: 1/1;\n}\n\n.controls.thumbnails:hover {\n opacity: 1 !important;\n height: var(--frigate-card-next-prev-size-hover);\n top: calc(50% - var(--frigate-card-next-prev-size-hover) / 2);\n}\n\n.controls.left.thumbnails:hover {\n left: calc(var(--frigate-card-left-position) - (var(--frigate-card-next-prev-size-hover) - var(--frigate-card-next-prev-size)) / 2);\n}\n\n.controls.right.thumbnails:hover {\n right: calc(var(--frigate-card-right-position) - (var(--frigate-card-next-prev-size-hover) - var(--frigate-card-next-prev-size)) / 2);\n}")}};r([s({attribute:!1})],P.prototype,"side",void 0),r([s({attribute:!1})],P.prototype,"hass",void 0),r([l()],P.prototype,"_controlConfig",void 0),r([s({attribute:!1})],P.prototype,"thumbnail",void 0),r([s({attribute:!1})],P.prototype,"icon",void 0),r([s({attribute:!0,type:Boolean})],P.prototype,"disabled",void 0),r([s()],P.prototype,"label",void 0),r([l()],P.prototype,"_thumbnailError",void 0),P=r([d("frigate-card-next-previous-control")],P);class k{constructor(t){this._config=null,this._hass=null,this._cameraManager=null,this._cameraID=null,this._host=t}setConfig(t){this._config=t??null,this._host.setAttribute("data-orientation",t?.orientation??"horizontal"),this._host.setAttribute("data-position",t?.position??"bottom-right"),this._host.setAttribute("style",Object.entries(t?.style??{}).map((([t,a])=>`${t}:${a}`)).join(";"))}getConfig(){return this._config}setCamera(t,a){this._cameraManager=t??null,this._cameraID=a??null}setForceVisibility(t){this._forceVisibility=t}handleAction(t,a){t.stopPropagation();const n=t.detail.action,i=_(n,a);i&&f(this._host,{action:i,...a&&{config:a}})}hasUsefulAction(){const t={pt:!0,z:!0,home:!0};if(!this._cameraID)return t;const a=this._cameraManager?.getCameraCapabilities(this._cameraID);if(!a||!a.hasPTZCapability())return t;const n=a.getPTZCapabilities();return{pt:!!(n?.up||n?.down||n?.left||n?.right),z:!!n?.zoomIn||!!n?.zoomOut,home:!!n?.presets?.length}}shouldDisplay(){return void 0!==this._forceVisibility?this._forceVisibility:"auto"===this._config?.mode?!!this._cameraID&&!!this._cameraManager?.getCameraCapabilities(this._cameraID)?.hasPTZCapability():"on"===this._config?.mode}getPTZActions(){const t=t=>({start_tap_action:v({ptzAction:t?.ptzAction,ptzPhase:"start",ptzPreset:t?.preset}),end_tap_action:v({ptzAction:t?.ptzAction,ptzPhase:"stop",ptzPreset:t?.preset})}),a={};return a.up=t({ptzAction:"up"}),a.down=t({ptzAction:"down"}),a.left=t({ptzAction:"left"}),a.right=t({ptzAction:"right"}),a.zoom_in=t({ptzAction:"zoom_in"}),a.zoom_out=t({ptzAction:"zoom_out"}),a.home={tap_action:v()},a}}let E=class extends c{constructor(){super(...arguments),this._controller=new k(this),this._actions=this._controller.getPTZActions(),this._actionPresence=null}willUpdate(t){t.has("config")&&this._controller.setConfig(this.config),(t.has("cameraManager")||t.has("cameraID"))&&this._controller.setCamera(this.cameraManager,this.cameraID),t.has("forceVisibility")&&this._controller.setForceVisibility(this.forceVisibility),(t.has("cameraID")||t.has("cameraManager"))&&(this._actionPresence=this._controller.hasUsefulAction())}render(){if(!this._controller.shouldDisplay())return;const t=(t,a,n)=>n?m`this._controller.handleAction(t,n)} + >`:m``,a=this._controller.getConfig();return m`
+ ${!a?.hide_pan_tilt&&this._actionPresence?.pt?m`
+ ${t("right","mdi:arrow-right",this._actions.right)} + ${t("left","mdi:arrow-left",this._actions.left)} + ${t("up","mdi:arrow-up",this._actions.up)} + ${t("down","mdi:arrow-down",this._actions.down)} +
`:""} + ${!a?.hide_zoom&&this._actionPresence?.z?m`
+ ${t("zoom_in","mdi:plus",this._actions.zoom_in)} + ${t("zoom_out","mdi:minus",this._actions.zoom_out)} +
`:m``} + ${!a?.hide_home&&this._actionPresence?.home?m`
+ ${t("home","mdi:home",this._actions.home)} +
`:m``} +
`}static get styles(){return g(":host {\n position: absolute;\n width: fit-content;\n height: fit-content;\n --frigate-card-ptz-icon-size: 24px;\n}\n\n:host([data-position$=-left]) {\n left: 5%;\n}\n\n:host([data-position$=-right]) {\n right: 5%;\n}\n\n:host([data-position^=top-]) {\n top: 5%;\n}\n\n:host([data-position^=bottom-]) {\n bottom: 5%;\n}\n\n/*****************\n * Main Containers\n *****************/\n.ptz {\n display: flex;\n gap: 10px;\n color: var(--light-primary-color);\n opacity: 0.4;\n transition: opacity 0.3s ease-in-out;\n}\n\n:host([data-orientation=vertical]) .ptz {\n flex-direction: column;\n}\n\n:host([data-orientation=horizontal]) .ptz {\n flex-direction: row;\n}\n\n.ptz:hover {\n opacity: 1;\n}\n\n:host([data-orientation=vertical]) .ptz div {\n width: calc(var(--frigate-card-ptz-icon-size) * 3);\n}\n\n:host([data-orientation=horizontal]) .ptz div {\n height: calc(var(--frigate-card-ptz-icon-size) * 3);\n}\n\n.ptz-move,\n.ptz-zoom,\n.ptz-home {\n position: relative;\n background-color: rgba(0, 0, 0, 0.3);\n}\n\n.ptz-move {\n height: calc(var(--frigate-card-ptz-icon-size) * 3);\n width: calc(var(--frigate-card-ptz-icon-size) * 3);\n border-radius: 50%;\n}\n\n:host([data-orientation=horizontal]) .ptz .ptz-zoom,\n:host([data-orientation=horizontal]) .ptz .ptz-home {\n width: calc(var(--frigate-card-ptz-icon-size) * 1.5);\n}\n\n:host([data-orientation=vertical]) .ptz .ptz-zoom,\n:host([data-orientation=vertical]) .ptz .ptz-home {\n height: calc(var(--frigate-card-ptz-icon-size) * 1.5);\n}\n\n.ptz-zoom,\n.ptz-home {\n border-radius: var(--ha-card-border-radius, 4px);\n}\n\n/***********\n * PTZ Icons\n ***********/\nha-icon {\n position: absolute;\n --mdc-icon-size: var(--frigate-card-ptz-icon-size);\n}\n\nha-icon:not(.disabled) {\n cursor: pointer;\n}\n\n.disabled {\n color: var(--disabled-text-color);\n}\n\n.up {\n top: 5px;\n left: 50%;\n transform: translateX(-50%);\n}\n\n.down {\n bottom: 5px;\n left: 50%;\n transform: translateX(-50%);\n}\n\n.left {\n left: 5px;\n top: 50%;\n transform: translateY(-50%);\n}\n\n.right {\n right: 5px;\n top: 50%;\n transform: translateY(-50%);\n}\n\n:host([data-orientation=vertical]) .zoom_in {\n right: 5px;\n top: 50%;\n}\n\n:host([data-orientation=vertical]) .zoom_out {\n left: 5px;\n top: 50%;\n}\n\n:host([data-orientation=horizontal]) .zoom_in {\n left: 50%;\n top: 5px;\n}\n\n:host([data-orientation=horizontal]) .zoom_out {\n left: 50%;\n bottom: 5px;\n}\n\n:host([data-orientation=vertical]) .zoom_in,\n:host([data-orientation=vertical]) .zoom_out {\n transform: translateY(-50%);\n}\n\n:host([data-orientation=horizontal]) .zoom_in,\n:host([data-orientation=horizontal]) .zoom_out {\n transform: translateX(-50%);\n}\n\n.home {\n top: 50%;\n left: 50%;\n transform: translateX(-50%) translateY(-50%);\n}")}};r([s({attribute:!1})],E.prototype,"config",void 0),r([s({attribute:!1})],E.prototype,"cameraManager",void 0),r([s({attribute:!1})],E.prototype,"cameraID",void 0),r([s({attribute:!1})],E.prototype,"forceVisibility",void 0),E=r([d("frigate-card-ptz")],E);const M=(t,a)=>{void 0!==a?.fit?t.style.setProperty("--frigate-card-media-layout-fit",a.fit):t.style.removeProperty("--frigate-card-media-layout-fit");for(const n of["x","y"])void 0!==a?.position?.[n]?t.style.setProperty(`--frigate-card-media-layout-position-${n}`,`${a.position[n]}%`):t.style.removeProperty(`--frigate-card-media-layout-position-${n}`);for(const n of["top","bottom","left","right"])void 0!==a?.view_box?.[n]?t.style.setProperty(`--frigate-card-media-layout-view-box-${n}`,`${a.view_box[n]}%`):t.style.removeProperty(`--frigate-card-media-layout-view-box-${n}`)},H=2,O=(t,a)=>{t._controlsHideTimer&&(t._controlsHideTimer.stop(),delete t._controlsHideTimer,delete t._controlsOriginalValue),t.controls=a},R=(t,a=1)=>{const n=t._controlsOriginalValue??t.controls;O(t,!1),t._controlsHideTimer??=new i,t._controlsOriginalValue=n;const o=()=>{O(t,n),t.removeEventListener("loadstart",o)};t.addEventListener("loadstart",o),t._controlsHideTimer.start(a,(()=>{O(t,n)}))},N=async(t,a)=>{if(a?.play)try{await a.play()}catch(n){if("NotAllowedError"===n.name&&!t.isMuted()){await t.mute();try{await a.play()}catch(t){}}}};function D(t){w(t,"live:error")}export{L as A,I as M,S as a,$ as b,H as c,D as d,R as h,x as i,N as p,O as s,M as u}; diff --git a/config/www/community/frigate-hass-card/dispatch-live-error-c649b480.js.gz b/config/www/community/frigate-hass-card/dispatch-live-error-c649b480.js.gz new file mode 100644 index 00000000..c2e598eb Binary files /dev/null and b/config/www/community/frigate-hass-card/dispatch-live-error-c649b480.js.gz differ diff --git a/config/www/community/frigate-hass-card/editor-0c0425c2.js b/config/www/community/frigate-hass-card/editor-0c0425c2.js new file mode 100644 index 00000000..2c7a83b1 --- /dev/null +++ b/config/www/community/frigate-hass-card/editor-0c0425c2.js @@ -0,0 +1,462 @@ +import{i as e,s as a,_ as t,n as i,t as n,a as s,x as o,e as r,l,r as c,b as d,c as m,d as u,p as h,f as _,g,h as b,j as p,k as v,C as f,m as $,o as y,q as w,u as S,v as x,w as M,y as I,z as k,A as O,B as C,D as z,E as A,F as N,G as T,H as B,I as E,J as P,K as H,L,M as V,N as K,O as U,P as j,Q as q,R,S as D,T as F,U as G,V as J,W as Q,X as W,Y as X,Z as Y,$ as Z,a0 as ee,a1 as ae,a2 as te,a3 as ie,a4 as ne,a5 as se,a6 as oe,a7 as re,a8 as le,a9 as ce,aa as de,ab as me,ac as ue,ad as he,ae as _e,af as ge,ag as be,ah as pe,ai as ve,aj as fe,ak as $e,al as ye,am as we,an as Se,ao as xe,ap as Me,aq as Ie,ar as ke,as as Oe,at as Ce,au as ze,av as Ae,aw as Ne,ax as Te,ay as Be,az as Ee,aA as Pe,aB as He,aC as Le,aD as Ve,aE as Ke,aF as Ue,aG as je,aH as qe,aI as Re,aJ as De,aK as Fe,aL as Ge,aM as Je,aN as Qe,aO as We,aP as Xe,aQ as Ye,aR as Ze,aS as ea,aT as aa,aU as ta,aV as ia,aW as na,aX as sa,aY as oa,aZ as ra,a_ as la,a$ as ca,b0 as da,b1 as ma,b2 as ua,b3 as ha,b4 as _a,b5 as ga,b6 as ba,b7 as pa,b8 as va,b9 as fa,ba as $a,bb as ya,bc as wa,bd as Sa,be as xa,bf as Ma,bg as Ia,bh as ka,bi as Oa,bj as Ca,bk as za,bl as Aa,bm as Na,bn as Ta,bo as Ba,bp as Ea,bq as Pa,br as Ha,bs as La,bt as Va,bu as Ka,bv as Ua,bw as ja,bx as qa,by as Ra,bz as Da,bA as Fa,bB as Ga,bC as Ja,bD as Qa,bE as Wa,bF as Xa,bG as Ya,bH as Za,bI as et,bJ as at,bK as tt,bL as it,bM as nt,bN as st,bO as ot,bP as rt,bQ as lt,bR as ct,bS as dt,bT as mt,bU as ut,bV as ht,bW as _t,bX as gt,bY as bt,bZ as pt,b_ as vt,b$ as ft,c0 as $t,c1 as yt,c2 as wt,c3 as St,c4 as xt,c5 as Mt,c6 as It,c7 as kt,c8 as Ot,c9 as Ct,ca as zt,cb as At,cc as Nt,cd as Tt,ce as Bt,cf as Et,cg as Pt,ch as Ht,ci as Lt,cj as Vt,ck as Kt,cl as Ut,cm as jt,cn as qt,co as Rt,cp as Dt,cq as Ft,cr as Gt,cs as Jt,ct as Qt,cu as Wt,cv as Xt,cw as Yt,cx as Zt,cy as ei,cz as ai,cA as ti,cB as ii,cC as ni,cD as si,cE as oi,cF as ri,cG as li,cH as ci,cI as di,cJ as mi,cK as ui}from"./card-320adb66.js";class hi{constructor(e){this._assigning=!1,this._value=null,this._blurEventHandler=()=>{this._setAssigning(!1)},this._keydownEventHandler=e=>{e.key&&!["Control","Alt","Shift","Meta"].includes(e.key)&&(this.setValue({key:e.key,ctrl:e.ctrlKey,alt:e.altKey,shift:e.shiftKey,meta:e.metaKey}),this._setAssigning(!1))},this._host=e,this._host.addController(this)}setValue(a){e(a,this._value)||(this._value=a,this._host.requestUpdate(),this._host.dispatchEvent(new CustomEvent("value-changed",{detail:{value:this._value}})))}getValue(){return this._value}hasValue(){return!!this._value}isAssigning(){return this._assigning}toggleAssigning(){this._setAssigning(!this._assigning)}_setAssigning(e){this._assigning=e,a(this._host,this._assigning,"assigning"),this._assigning?this._host.addEventListener("keydown",this._keydownEventHandler):this._host.removeEventListener("keydown",this._keydownEventHandler),this._host.requestUpdate()}hostConnected(){this._host.addEventListener("blur",this._blurEventHandler)}hostDisconnected(){this._host.removeEventListener("blur",this._blurEventHandler)}}let _i=class extends s{constructor(){super(...arguments),this._controller=new hi(this)}willUpdate(e){e.has("value")&&this._controller.setValue(this.value??null)}render(){if(!this.label)return;const e=e=>o`
+
${e}
+
`;return o` +
${this.label}
+ {this._controller.toggleAssigning()}} + > + + + ${this._controller.isAssigning()?l("key_assigner.assigning"):l("key_assigner.assign")} + + + ${this._controller.hasValue()?o`{this._controller.setValue(null)}} + > + + ${l("key_assigner.unassign")} + `:""} +
+ ${this.value?.ctrl?e(l("key_assigner.modifiers.ctrl")):""} + ${this.value?.shift?e(l("key_assigner.modifiers.shift")):""} + ${this.value?.meta?e(l("key_assigner.modifiers.meta")):""} + ${this.value?.alt?e(l("key_assigner.modifiers.alt")):""} + ${this.value?.key?e(this.value.key):""} +
+ `}static get styles(){return c('.dotdotdot:after {\n animation: dots 2s linear infinite;\n content: "";\n display: inline-block;\n width: 3em;\n}\n@keyframes dots {\n 0%, 20% {\n content: ".";\n }\n 40% {\n content: "..";\n }\n 60% {\n content: "...";\n }\n 90%, 100% {\n content: "";\n }\n}\n\n:host {\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 10px;\n height: 56px;\n border: 1px solid var(--divider-color);\n}\n\n:host([assigning]) ha-button.assign span,\n:host([assigning]) ha-button.assign ha-icon {\n color: var(--warning-color);\n}\n\nha-icon {\n padding: 10px;\n}\n\ndiv.label {\n width: 100px;\n margin-left: 4px;\n}\n\ndiv.key-row {\n flex: 1;\n display: flex;\n justify-content: center;\n align-items: center;\n padding-left: 10px;\n padding-right: 10px;\n}\n\ndiv.key {\n display: flex;\n align-items: center;\n height: 90%;\n width: min-content;\n margin-left: 5px;\n margin-right: 5px;\n}\n\ndiv.key-inner {\n height: 100%;\n width: 100%;\n padding-top: 2px;\n padding-bottom: 2px;\n padding-left: 4px;\n padding-right: 4px;\n border: 2px;\n border-radius: 4px;\n border-style: outset;\n border-color: var(--divider-color);\n font-family: monospace;\n text-transform: capitalize;\n}\n\ndiv.unassigned {\n font-style: italic;\n}\n\ndiv.key + div.key:before {\n display: flex;\n align-items: center;\n margin-right: 5px;\n content: " + ";\n}')}};t([i({attribute:!1})],_i.prototype,"label",void 0),t([i({attribute:!1})],_i.prototype,"value",void 0),_i=t([n("frigate-card-key-assigner")],_i);const gi="cameras",bi="options",pi={cameras:{icon:"video",name:l("editor.cameras"),secondary:l("editor.cameras_secondary")},view:{icon:"eye",name:l("editor.view"),secondary:l("editor.view_secondary")},menu:{icon:"menu",name:l("editor.menu"),secondary:l("editor.menu_secondary")},status_bar:{icon:"sign-text",name:l("editor.status_bar"),secondary:l("editor.status_bar_secondary")},live:{icon:"cctv",name:l("editor.live"),secondary:l("editor.live_secondary")},media_gallery:{icon:"grid",name:l("editor.media_gallery"),secondary:l("editor.media_gallery_secondary")},media_viewer:{icon:"filmstrip",name:l("editor.media_viewer"),secondary:l("editor.media_viewer_secondary")},image:{icon:"image",name:l("editor.image"),secondary:l("editor.image_secondary")},timeline:{icon:"chart-gantt",name:l("editor.timeline"),secondary:l("editor.timeline_secondary")},dimensions:{icon:"aspect-ratio",name:l("editor.dimensions"),secondary:l("editor.dimensions_secondary")},performance:{icon:"speedometer",name:l("editor.performance"),secondary:l("editor.performance_secondary")},profiles:{icon:"folder-wrench-outline",name:l("editor.profiles"),secondary:l("editor.profiles_secondary")},overrides:{icon:"file-replace",name:l("editor.overrides"),secondary:l("editor.overrides_secondary")}};let vi=class extends s{constructor(){super(...arguments),this._defaults=m(di),this._initialized=!1,this._configUpgradeable=!1,this._expandedMenus={},this._viewModes=[{value:"",label:""},{value:"live",label:l("config.view.views.live")},{value:"clips",label:l("config.view.views.clips")},{value:"snapshots",label:l("config.view.views.snapshots")},{value:"recordings",label:l("config.view.views.recordings")},{value:"clip",label:l("config.view.views.clip")},{value:"snapshot",label:l("config.view.views.snapshot")},{value:"recording",label:l("config.view.views.recording")},{value:"image",label:l("config.view.views.image")},{value:"timeline",label:l("config.view.views.timeline")}],this._cameraSelectViewModes=[...this._viewModes,{value:"current",label:l("config.view.views.current")}],this._filterModes=[{value:"",label:""},{value:"none",label:l("config.common.controls.filter.modes.none")},{value:"left",label:l("config.common.controls.filter.modes.left")},{value:"right",label:l("config.common.controls.filter.modes.right")}],this._menuStyles=[{value:"",label:""},{value:"none",label:l("config.menu.styles.none")},{value:"hidden",label:l("config.menu.styles.hidden")},{value:"overlay",label:l("config.menu.styles.overlay")},{value:"hover",label:l("config.menu.styles.hover")},{value:"hover-card",label:l("config.menu.styles.hover-card")},{value:"outside",label:l("config.menu.styles.outside")}],this._menuPositions=[{value:"",label:""},{value:"left",label:l("config.menu.positions.left")},{value:"right",label:l("config.menu.positions.right")},{value:"top",label:l("config.menu.positions.top")},{value:"bottom",label:l("config.menu.positions.bottom")}],this._menuAlignments=[{value:"",label:""},{value:"left",label:l("config.menu.alignments.left")},{value:"right",label:l("config.menu.alignments.right")},{value:"top",label:l("config.menu.alignments.top")},{value:"bottom",label:l("config.menu.alignments.bottom")}],this._nextPreviousControlStyles=[{value:"",label:""},{value:"chevrons",label:l("config.common.controls.next_previous.styles.chevrons")},{value:"icons",label:l("config.common.controls.next_previous.styles.icons")},{value:"none",label:l("config.common.controls.next_previous.styles.none")},{value:"thumbnails",label:l("config.common.controls.next_previous.styles.thumbnails")}],this._aspectRatioModes=[{value:"",label:""},{value:"dynamic",label:l("config.dimensions.aspect_ratio_modes.dynamic")},{value:"static",label:l("config.dimensions.aspect_ratio_modes.static")},{value:"unconstrained",label:l("config.dimensions.aspect_ratio_modes.unconstrained")}],this._thumbnailModes=[{value:"",label:""},{value:"none",label:l("config.common.controls.thumbnails.modes.none")},{value:"above",label:l("config.common.controls.thumbnails.modes.above")},{value:"below",label:l("config.common.controls.thumbnails.modes.below")},{value:"left",label:l("config.common.controls.thumbnails.modes.left")},{value:"right",label:l("config.common.controls.thumbnails.modes.right")}],this._thumbnailMediaTypes=[{value:"",label:""},{value:"events",label:l("config.common.controls.thumbnails.media_types.events")},{value:"recordings",label:l("config.common.controls.thumbnails.media_types.recordings")}],this._thumbnailEventsMediaTypes=[{value:"",label:""},{value:"clips",label:l("config.common.controls.thumbnails.events_media_types.clips")},{value:"snapshots",label:l("config.common.controls.thumbnails.events_media_types.snapshots")}],this._transitionEffects=[{value:"",label:""},{value:"none",label:l("config.media_viewer.transition_effects.none")},{value:"slide",label:l("config.media_viewer.transition_effects.slide")}],this._imageModes=[{value:"",label:""},{value:"camera",label:l("config.common.image.modes.camera")},{value:"entity",label:l("config.common.image.modes.entity")},{value:"screensaver",label:l("config.common.image.modes.screensaver")},{value:"url",label:l("config.common.image.modes.url")}],this._timelineEventsMediaTypes=[{value:"",label:""},{value:"all",label:l("config.common.timeline.events_media_types.all")},{value:"clips",label:l("config.common.timeline.events_media_types.clips")},{value:"snapshots",label:l("config.common.timeline.events_media_types.snapshots")}],this._timelineStyleTypes=[{value:"",label:""},{value:"ribbon",label:l("config.common.timeline.styles.ribbon")},{value:"stack",label:l("config.common.timeline.styles.stack")}],this._darkModes=[{value:"",label:""},{value:"on",label:l("config.view.dark_modes.on")},{value:"off",label:l("config.view.dark_modes.off")},{value:"auto",label:l("config.view.dark_modes.auto")}],this._mediaActionNegativeConditions=[{value:"",label:""},{value:"unselected",label:l("config.common.media_action_conditions.unselected")},{value:"hidden",label:l("config.common.media_action_conditions.hidden")}],this._mediaActionPositiveConditions=[{value:"",label:""},{value:"selected",label:l("config.common.media_action_conditions.selected")},{value:"visible",label:l("config.common.media_action_conditions.visible")}],this._mediaLiveUnmuteConditions=[...this._mediaActionPositiveConditions,{value:"microphone",label:l("config.common.media_action_conditions.microphone_unmute")}],this._mediaLiveMuteConditions=[...this._mediaActionNegativeConditions,{value:"microphone",label:l("config.common.media_action_conditions.microphone_mute")}],this._layoutFits=[{value:"",label:""},{value:"contain",label:l("config.cameras.dimensions.layout.fits.contain")},{value:"cover",label:l("config.cameras.dimensions.layout.fits.cover")},{value:"fill",label:l("config.cameras.dimensions.layout.fits.fill")}],this._miniTimelineModes=[{value:"",label:""},{value:"none",label:l("config.common.controls.timeline.modes.none")},{value:"above",label:l("config.common.controls.timeline.modes.above")},{value:"below",label:l("config.common.controls.timeline.modes.below")}],this._profiles=[{value:"",label:""},{value:"casting",label:l("config.profiles.casting")},{value:"low-performance",label:l("config.profiles.low-performance")},{value:"scrubbing",label:l("config.profiles.scrubbing")}],this._go2rtcModes=[{value:"",label:""},{value:"mse",label:l("config.cameras.go2rtc.modes.mse")},{value:"webrtc",label:l("config.cameras.go2rtc.modes.webrtc")},{value:"mp4",label:l("config.cameras.go2rtc.modes.mp4")},{value:"mjpeg",label:l("config.cameras.go2rtc.modes.mjpeg")}],this._microphoneButtonTypes=[{value:"",label:""},{value:"momentary",label:l("config.menu.buttons.types.momentary")},{value:"toggle",label:l("config.menu.buttons.types.toggle")}],this._displayModes=[{value:"",label:""},{value:"single",label:l("display_modes.single")},{value:"grid",label:l("display_modes.grid")}],this._castMethods=[{value:"",label:""},{value:"standard",label:l("config.cameras.cast.methods.standard")},{value:"dashboard",label:l("config.cameras.cast.methods.dashboard")}],this._ptzModes=[{value:"",label:""},{value:"on",label:l("config.live.controls.ptz.modes.on")},{value:"off",label:l("config.live.controls.ptz.modes.off")}],this._ptzOrientations=[{value:"",label:""},{value:"vertical",label:l("config.live.controls.ptz.orientations.vertical")},{value:"horizontal",label:l("config.live.controls.ptz.orientations.horizontal")}],this._ptzPositions=[{value:"",label:""},{value:"top-left",label:l("config.live.controls.ptz.positions.top-left")},{value:"top-right",label:l("config.live.controls.ptz.positions.top-right")},{value:"bottom-left",label:l("config.live.controls.ptz.positions.bottom-left")},{value:"bottom-right",label:l("config.live.controls.ptz.positions.bottom-right")}],this._triggersActionsInteractionModes=[{value:"",label:""},{value:"all",label:l("config.view.triggers.actions.interaction_modes.all")},{value:"inactive",label:l("config.view.triggers.actions.interaction_modes.inactive")},{value:"active",label:l("config.view.triggers.actions.interaction_modes.active")}],this._triggersActionsTrigger=[{value:"",label:""},{value:"default",label:l("config.view.triggers.actions.triggers.default")},{value:"live",label:l("config.view.triggers.actions.triggers.live")},{value:"media",label:l("config.view.triggers.actions.triggers.media")},{value:"none",label:l("config.view.triggers.actions.triggers.none")}],this._triggersActionsUntrigger=[{value:"",label:""},{value:"default",label:l("config.view.triggers.actions.untriggers.default")},{value:"none",label:l("config.view.triggers.actions.untriggers.none")}],this._triggersEvents=[{value:"",label:""},{value:"events",label:l("config.cameras.triggers.events.events")},{value:"clips",label:l("config.cameras.triggers.events.clips")},{value:"snapshots",label:l("config.cameras.triggers.events.snapshots")}],this._timelinePanModes=[{value:"",label:""},{value:"pan",label:l("config.common.controls.timeline.pan_modes.pan")},{value:"seek",label:l("config.common.controls.timeline.pan_modes.seek")},{value:"seek-in-media",label:l("config.common.controls.timeline.pan_modes.seek-in-media")},{value:"seek-in-camera",label:l("config.common.controls.timeline.pan_modes.seek-in-camera")}],this._capabilities=[{value:"",label:""},{value:"live",label:l("config.cameras.capabilities.capabilities.live")},{value:"substream",label:l("config.cameras.capabilities.capabilities.substream")},{value:"clips",label:l("config.cameras.capabilities.capabilities.clips")},{value:"recordings",label:l("config.cameras.capabilities.capabilities.recordings")},{value:"snapshots",label:l("config.cameras.capabilities.capabilities.snapshots")},{value:"favorite-events",label:l("config.cameras.capabilities.capabilities.favorite-events")},{value:"favorite-recordings",label:l("config.cameras.capabilities.capabilities.favorite-recordings")},{value:"seek",label:l("config.cameras.capabilities.capabilities.seek")},{value:"ptz",label:l("config.cameras.capabilities.capabilities.ptz")},{value:"menu",label:l("config.cameras.capabilities.capabilities.menu")}],this._defaultResetInteractionModes=[{value:"",label:""},{value:"all",label:l("config.view.default_reset.interaction_modes.all")},{value:"inactive",label:l("config.view.default_reset.interaction_modes.inactive")},{value:"active",label:l("config.view.default_reset.interaction_modes.active")}],this._proxyMedia=[{value:"",label:""},{value:"auto",label:l("config.cameras.proxy.media.auto")},{value:!0,label:l("config.cameras.proxy.media.true")},{value:!1,label:l("config.cameras.proxy.media.false")}],this._proxySSLCiphers=[{value:"",label:""},{value:"auto",label:l("config.cameras.proxy.ssl_ciphers.auto")},{value:"default",label:l("config.cameras.proxy.ssl_ciphers.default")},{value:"insecure",label:l("config.cameras.proxy.ssl_ciphers.insecure")},{value:"intermediate",label:l("config.cameras.proxy.ssl_ciphers.intermediate")},{value:"modern",label:l("config.cameras.proxy.ssl_ciphers.modern")}],this._proxySSLVerification=[{value:"",label:""},{value:"auto",label:l("config.cameras.proxy.ssl_verification.auto")},{value:!0,label:l("config.cameras.proxy.ssl_verification.true")},{value:!1,label:l("config.cameras.proxy.ssl_verification.false")}],this._reolinkMediaResolution=[{value:"",label:""},{value:"high",label:l("config.cameras.reolink.media_resolution.high")},{value:"low",label:l("config.cameras.reolink.media_resolution.low")}],this._statusBarStyles=[{value:"",label:""},{value:"hover",label:l("config.status_bar.styles.hover")},{value:"hover-card",label:l("config.status_bar.styles.hover-card")},{value:"none",label:l("config.status_bar.styles.none")},{value:"outside",label:l("config.status_bar.styles.outside")},{value:"overlay",label:l("config.status_bar.styles.overlay")},{value:"popup",label:l("config.status_bar.styles.popup")}],this._statusBarPositions=[{value:"",label:""},{value:"top",label:l("config.status_bar.positions.top")},{value:"bottom",label:l("config.status_bar.positions.bottom")}]}setConfig(e){this._config=e,this._configUpgradeable=u(e);const a=h.safeParse(this._config.profiles);if(a.success){const e=m(di);_(this._config,e,a.data),this._defaults=e}}willUpdate(){this._initialized||g().then((e=>{e&&(this._initialized=!0)}))}_renderOptionSetHeader(e,a){const t=pi[e];return o` +
+
+ +
${t.name}
+
+
${t.secondary}
+
+ `}_getLabel(e){const a=e.split(".").filter((e=>!e.match(/^\[[0-9]+\]$/))).join(".");return l(`config.${a}`)}_renderEntitySelector(e,a){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderOptionSelector(e,a=[],t){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderIconSelector(e,a){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderNumberInput(e,a){if(!this._config)return;const t=b(this._config,e),i=void 0===a?.max?"box":"slider";return o` + this._valueChangedHandler(e,a)} + > + + `}_renderInfo(e){return o` ${e}`}_getEditorCameraTitle(e,a){return"string"==typeof a?.title&&a.title||("string"==typeof a?.camera_entity?p(this.hass,a.camera_entity):"")||"object"==typeof a?.webrtc_card&&a.webrtc_card&&"string"==typeof a.webrtc_card.entity&&a.webrtc_card.entity||("object"==typeof a?.frigate&&a.frigate&&"string"==typeof a?.frigate.camera_name&&a.frigate.camera_name?v(a.frigate.camera_name):"")||"string"==typeof a?.id&&a.id||l("editor.camera")+" #"+e}_renderViewDefaultResetMenu(){return this._putInSubmenu("view.default_reset",!0,`config.${f}.editor_label`,"mdi:restart",o` + ${this._renderSwitch($,this._defaults.view.default_reset.after_interaction)} + ${this._renderNumberInput(y)} + ${this._renderOptionSelector(w,this._defaultResetInteractionModes,{label:l("config.view.default_reset.interaction_mode")})}, + ${this._renderOptionSelector(S,this.hass?x(this.hass):[],{multiple:!0})} + `)}_renderViewTriggersMenu(){return this._putInSubmenu("view.triggers",!0,`config.${M}.editor_label`,"mdi:target-account",o` + ${this._renderSwitch(I,this._defaults.view.triggers.filter_selected_camera,{label:l(`config.${I}`)})} + ${this._renderSwitch(k,this._defaults.view.triggers.show_trigger_status,{label:l(`config.${k}`)})} + ${this._renderNumberInput(O,{default:this._defaults.view.triggers.untrigger_seconds})} + ${this._putInSubmenu("view.triggers.actions",!0,`config.${C}.editor_label`,"mdi:cogs",o` ${this._renderOptionSelector(z,this._triggersActionsTrigger,{label:l("config.view.triggers.actions.trigger")})} + ${this._renderOptionSelector(A,this._triggersActionsUntrigger,{label:l("config.view.triggers.actions.untrigger")})} + ${this._renderOptionSelector(N,this._triggersActionsInteractionModes,{label:l("config.view.triggers.actions.interaction_mode")})}`)} + `)}_renderKeyAssigner(e,a){return o` this._valueChangedHandler(e,a)} + >`}_renderViewKeyboardShortcutMenu(){return this._putInSubmenu("view.keyboard_shortcuts",!0,`config.${T}.editor_label`,"mdi:keyboard",o` + ${this._renderSwitch(B,this._defaults.view.keyboard_shortcuts.enabled,{label:l(`config.${B}`)})} + ${this._renderKeyAssigner(E,this._defaults.view.keyboard_shortcuts.ptz_left)} + ${this._renderKeyAssigner(P,this._defaults.view.keyboard_shortcuts.ptz_right)} + ${this._renderKeyAssigner(H,this._defaults.view.keyboard_shortcuts.ptz_up)} + ${this._renderKeyAssigner(L,this._defaults.view.keyboard_shortcuts.ptz_down)} + ${this._renderKeyAssigner(V,this._defaults.view.keyboard_shortcuts.ptz_zoom_in)} + ${this._renderKeyAssigner(K,this._defaults.view.keyboard_shortcuts.ptz_zoom_out)} + ${this._renderKeyAssigner(U,this._defaults.view.keyboard_shortcuts.ptz_home)} + `)}_renderStatusBarItem(e){return o` ${this._putInSubmenu("status_bar.items",e,`config.status_bar.items.${e}`,"mdi:feature-search",o` + ${this._renderSwitch(`${j}.${e}.enabled`,this._defaults.status_bar.items[e]?.enabled??!0,{label:l("config.status_bar.items.enabled")})} + ${this._renderNumberInput(`${j}.${e}.priority`,{max:q,default:this._defaults.status_bar.items[e]?.priority,label:l("config.status_bar.items.priority")})} + `)}`}_renderMenuButton(e,a){const t=[{value:"",label:""},{value:"matching",label:l("config.menu.buttons.alignments.matching")},{value:"opposing",label:l("config.menu.buttons.alignments.opposing")}];return o` ${this._putInSubmenu("menu.buttons",e,`config.menu.buttons.${e}`,"mdi:gesture-tap-button",o` + ${this._renderSwitch(`${R}.${e}.enabled`,this._defaults.menu.buttons[e]?.enabled??!0,{label:l("config.menu.buttons.enabled")})} + ${this._renderOptionSelector(`${R}.${e}.alignment`,t,{label:l("config.menu.buttons.alignment")})} + ${this._renderSwitch(`${R}.${e}.permanent`,this._defaults.menu.buttons[e]?.permanent??!1,{label:l("config.menu.buttons.permanent")})} + ${this._renderNumberInput(`${R}.${e}.priority`,{max:D,default:this._defaults.menu.buttons[e]?.priority,label:l("config.menu.buttons.priority")})} + ${this._renderIconSelector(`${R}.${e}.icon`,{label:l("config.menu.buttons.icon")})} + ${a} + `)}`}_putInSubmenu(e,a,t,i,n){const s=this._expandedMenus[e]===a,c={submenu:!0,selected:s},d=dt(i);return o`
+ + ${s?o`
${n}
`:""} +
`}_renderMediaLayout(e,a,t,i,n,s,r,c,d,m,u,h){return this._putInSubmenu(e,!0,a,"mdi:page-layout-body",o` + ${this._renderNumberInput(m,{min:0,max:10,label:l("config.cameras.dimensions.layout.zoom"),step:.1})} + ${this._renderNumberInput(u,{min:0,max:100,label:l("config.cameras.dimensions.layout.pan.x")})} + ${this._renderNumberInput(h,{min:0,max:100,label:l("config.cameras.dimensions.layout.pan.y")})} + ${this._renderOptionSelector(t,this._layoutFits,{label:l("config.cameras.dimensions.layout.fit")})} + ${this._putInSubmenu(`${e}.position`,!0,"config.cameras.dimensions.layout.position.editor_label","mdi:aspect-ratio",o` ${this._renderNumberInput(i,{min:0,max:100,label:l("config.cameras.dimensions.layout.position.x")})} + ${this._renderNumberInput(n,{min:0,max:100,label:l("config.cameras.dimensions.layout.position.y")})}`)} + ${this._putInSubmenu(`${e}.view_box`,!0,"config.cameras.dimensions.layout.view_box.editor_label","mdi:crop",o` + ${this._renderNumberInput(s,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.top")})} + ${this._renderNumberInput(r,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.bottom")})} + ${this._renderNumberInput(c,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.left")})} + ${this._renderNumberInput(d,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.right")})} + `)} + `)}_renderTimelineCoreControls(e,a,t,i,n,s,r){return o` + ${this._renderOptionSelector(e,this._timelineStyleTypes,{label:l(`config.common.${F}`)})} + ${r?this._renderOptionSelector(r,this._timelinePanModes,{label:l("config.common.controls.timeline.pan_mode")}):""} + ${this._renderNumberInput(a,{label:l(`config.common.${G}`)})} + ${this._renderNumberInput(t,{label:l(`config.common.${J}`)})} + ${this._renderOptionSelector(i,this._timelineEventsMediaTypes,{label:l(`config.common.${Q}`)})} + ${this._renderSwitch(n,s,{label:l(`config.common.${W}`)})} + `}_renderMiniTimeline(e,a,t,i,n,s,r,c,d){return this._putInSubmenu(e,!0,"config.common.controls.timeline.editor_label","mdi:chart-gantt",o` ${this._renderOptionSelector(a,this._miniTimelineModes,{label:l("config.common.controls.timeline.mode")})} + ${this._renderTimelineCoreControls(t,i,n,s,r,c,d)}`)}_renderViewDisplay(e,a,t,i,n){return this._putInSubmenu(e,!0,"config.common.display.editor_label","mdi:palette-swatch",o` + ${this._renderOptionSelector(a,this._displayModes,{label:l("config.common.display.mode")})} + ${this._renderNumberInput(t,{min:0,label:l("config.common.display.grid_selected_width_factor")})} + ${this._renderNumberInput(i,{min:0,label:l("config.common.display.grid_columns")})} + ${this._renderNumberInput(n,{min:0,label:l("config.common.display.grid_max_columns")})} + `)}_renderNextPreviousControls(e,a,t,i){return this._putInSubmenu(e,!0,"config.common.controls.next_previous.editor_label","mdi:arrow-right-bold-circle",o` + ${this._renderOptionSelector(a,this._nextPreviousControlStyles.filter((e=>!(!i?.allowThumbnails&&"thumbnails"===e.value||!i?.allowIcons&&"icons"===e.value))),{label:l("config.common.controls.next_previous.style")})} + ${this._renderNumberInput(t,{min:X,label:l("config.common.controls.next_previous.size")})} + `)}_renderThumbnailsControls(e,a,t,i,n,s,r,c){return this._putInSubmenu(e,!0,"config.common.controls.thumbnails.editor_label","mdi:image-text",o` + ${c?.configPathMode?o`${this._renderOptionSelector(c.configPathMode,this._thumbnailModes,{label:l("config.common.controls.thumbnails.mode")})}`:o``} + ${c?.configPathMediaType?o`${this._renderOptionSelector(c.configPathMediaType,this._thumbnailMediaTypes,{label:l("config.common.controls.thumbnails.media_type")})}`:o``} + ${c?.configPathEventsMediaType?o`${this._renderOptionSelector(c.configPathEventsMediaType,this._thumbnailEventsMediaTypes,{label:l("config.common.controls.thumbnails.events_media_type")})}`:o``} + ${this._renderNumberInput(a,{min:Y,max:Z,label:l("config.common.controls.thumbnails.size")})} + ${this._renderSwitch(t,r.show_details,{label:l("config.common.controls.thumbnails.show_details")})} + ${this._renderSwitch(i,r.show_favorite_control,{label:l("config.common.controls.thumbnails.show_favorite_control")})} + ${this._renderSwitch(n,r.show_timeline_control,{label:l("config.common.controls.thumbnails.show_timeline_control")})} + ${this._renderSwitch(s,r.show_download_control,{label:l("config.common.controls.thumbnails.show_download_control")})} + `)}_renderFilterControls(e,a){return this._putInSubmenu(e,!0,"config.common.controls.filter.editor_label","mdi:filter-cog",o` + ${a?o`${this._renderOptionSelector(a,this._filterModes,{label:l("config.common.controls.filter.mode")})}`:o``} + `)}_renderImageOptions(e,a,t,i,n){return o` + ${this._renderOptionSelector(e,this._imageModes,{label:l("config.common.image.mode")})} + ${this._renderStringInput(a,{label:l("config.common.image.url")})} + ${this._renderOptionSelector(t,this.hass?x(this.hass):[],{label:l("config.common.image.entity")})} + ${this._renderStringInput(i,{label:l("config.common.image.entity_parameters")})} + ${this._renderNumberInput(n,{label:l("config.common.image.refresh_seconds")})} + `}_renderCamera(e,a,t,i){const n=[{value:"",label:""},{value:"auto",label:l("config.cameras.live_providers.auto")},{value:"ha",label:l("config.cameras.live_providers.ha")},{value:"image",label:l("config.cameras.live_providers.image")},{value:"jsmpeg",label:l("config.cameras.live_providers.jsmpeg")},{value:"go2rtc",label:l("config.cameras.live_providers.go2rtc")},{value:"webrtc-card",label:l("config.cameras.live_providers.webrtc-card")}],s=[];e.forEach(((e,t)=>{t!==a&&s.push({value:ee(e),label:this._getEditorCameraTitle(t,e)})}));const c=e=>{if(this._config){const a=m(this._config);e(a)&&this._updateConfig(a)}},d={submenu:!0,selected:this._expandedMenus[gi]===a};return o` +
+ + ${this._expandedMenus[gi]===a?o`
+
+ !i&&c((e=>!!(Array.isArray(e.cameras)&&a>0)&&(mt(e.cameras,a,a-1),this._openMenu(gi,a-1),!0)))} + > + + + =this._config.cameras.length-1} + @click=${()=>!i&&c((e=>!!(Array.isArray(e.cameras)&&a + + + {c((e=>!!Array.isArray(e.cameras)&&(e.cameras.splice(a,1),this._closeMenu(gi),!0)))}} + > + + +
+ ${this._renderEntitySelector(ae(ut,a),"camera")} + ${this._renderOptionSelector(ae(ht,a),n)} + ${this._renderStringInput(ae(_t,a))} + ${this._renderIconSelector(ae(gt,a),{label:l("config.cameras.icon")})} + ${this._renderStringInput(ae(bt,a))} + ${this._putInSubmenu("cameras.engine",!0,"config.cameras.engines.editor_label","mdi:engine",o`${this._putInSubmenu("cameras.frigate",a,"config.cameras.frigate.editor_label","frigate",o` + ${this._renderStringInput(ae(pt,a))} + ${this._renderStringInput(ae(vt,a))} + ${this._renderOptionSelector(ae(ft,a),[],{multiple:!0,label:l("config.cameras.frigate.labels")})} + ${this._renderOptionSelector(ae($t,a),[],{multiple:!0,label:l("config.cameras.frigate.zones")})} + ${this._renderStringInput(ae(yt,a))} + `)} + ${this._putInSubmenu("cameras.motioneye",a,"config.cameras.motioneye.editor_label","motioneye",o` ${this._renderStringInput(ae(wt,a))} + ${this._renderStringInput(ae(St,a))} + ${this._renderStringInput(ae(xt,a))} + ${this._renderStringInput(ae(Mt,a))} + ${this._renderStringInput(ae(It,a))}`)} + ${this._putInSubmenu("cameras.reolink",a,"config.cameras.reolink.editor_label","reolink",o` ${this._renderStringInput(ae(kt,a))} + ${this._renderOptionSelector(ae(Ot,a),this._reolinkMediaResolution,{label:l("config.cameras.reolink.media_resolution.editor_label")})}`)}`)} + ${this._putInSubmenu("cameras.live_provider",!0,"config.cameras.live_provider_options.editor_label","mdi:cctv",o` ${this._putInSubmenu("cameras.go2rtc",a,"config.cameras.go2rtc.editor_label","mdi:alpha-g-circle",o`${this._renderOptionSelector(ae(Ct,a),this._go2rtcModes,{multiple:!0,label:l("config.cameras.go2rtc.modes.editor_label")})} + ${this._renderStringInput(ae(zt,a))}`)} + ${this._putInSubmenu("cameras.image",!0,"config.cameras.image.editor_label","mdi:image",this._renderImageOptions(ae(At,a),ae(Nt,a),ae(Tt,a),ae(Bt,a),ae(Et,a)))} + ${this._putInSubmenu("cameras.webrtc_card",a,"config.cameras.webrtc_card.editor_label","mdi:webrtc",o`${this._renderEntitySelector(ae(Pt,a),"camera")} + ${this._renderStringInput(ae(Ht,a))}`)}`)} + ${this._putInSubmenu("cameras.dependencies",a,"config.cameras.dependencies.editor_label","mdi:graph",o` ${this._renderSwitch(ae(Lt,a),this._defaults.cameras.dependencies.all_cameras)} + ${this._renderOptionSelector(ae(Vt,a),s,{multiple:!0})}`)} + ${this._putInSubmenu("cameras.triggers",a,"config.cameras.triggers.editor_label","mdi:magnify-scan",o` + ${this._renderSwitch(ae(Kt,a),this._defaults.cameras.triggers.occupancy)} + ${this._renderSwitch(ae(Ut,a),this._defaults.cameras.triggers.motion)} + ${this._renderOptionSelector(ae(jt,a),t,{multiple:!0})} + ${this._renderOptionSelector(ae(qt,a),this._triggersEvents,{multiple:!0,label:l("config.cameras.triggers.events.editor_label")})} + `)} + ${this._putInSubmenu("cameras.cast",a,"config.cameras.cast.editor_label","mdi:cast",o` + ${this._renderOptionSelector(ae(Rt,a),this._castMethods)} + ${this._renderStringInput(ae(Dt,a))} + ${this._renderStringInput(ae(Ft,a))} + `)} + ${this._putInSubmenu("cameras.dimensions",a,"config.cameras.dimensions.editor_label","mdi:aspect-ratio",o` + ${this._renderStringInput(ae(Gt,a))} + ${this._renderMediaLayout("cameras.dimensions.layout","config.cameras.dimensions.layout.editor_label",ae(Jt,a),ae(Qt,a),ae(Wt,a),ae(Xt,a),ae(Yt,a),ae(Zt,a),ae(ei,a),ae(ai,a),ae(ti,a),ae(ii,a))} + `)} + ${this._putInSubmenu("cameras.capabilities",a,"config.cameras.capabilities.editor_label","mdi:cog-stop",o` + ${this._renderOptionSelector(ae(ni,a),this._capabilities,{multiple:!0})} + ${this._renderOptionSelector(ae(si,a),this._capabilities,{multiple:!0})} + `)} + ${this._putInSubmenu("cameras.proxy",a,"config.cameras.proxy.editor_label","mdi:arrow-decision",o` + ${this._renderOptionSelector(ae(oi,a),this._proxyMedia,{label:l("config.cameras.proxy.media.editor_label")})} + ${this._renderSwitch(ae(ri,a),this._defaults.cameras.proxy.dynamic)} + ${this._renderOptionSelector(ae(li,a),this._proxySSLVerification,{label:l("config.cameras.proxy.ssl_verification.editor_label")})} + ${this._renderOptionSelector(ae(ci,a),this._proxySSLCiphers,{label:l("config.cameras.proxy.ssl_ciphers.editor_label")})} + `)} +
`:""} +
+ `}_renderStringInput(e,a){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderSwitch(e,a,t){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_updateConfig(e){this._config=e,te(this,"config-changed",{config:this._config})}render(){if(!this.hass||!this._config)return o``;const e=x(this.hass),a=b(this._config,mi)||[];return o` + ${this._configUpgradeable?o`
+ ${l("editor.upgrade_available")} + + {if(this._config){const e=m(this._config);ie(e),this._updateConfig(e)}}} + > + + +
+
`:o``} +
+ ${this._renderOptionSetHeader("cameras")} + ${"cameras"===this._expandedMenus[bi]?o` +
+ ${a.map(((t,i)=>this._renderCamera(a,i,e)))} + ${this._renderCamera(a,a.length,e,!0)} +
+ `:""} + ${this._renderOptionSetHeader("profiles")} + ${"profiles"===this._expandedMenus[bi]?o`
+ ${this._renderOptionSelector(ne,this._profiles,{multiple:!0,label:l("config.profiles.editor_label")})} +
`:""} + ${this._renderOptionSetHeader("view")} + ${"view"===this._expandedMenus[bi]?o` +
+ ${this._renderOptionSelector(se,this._viewModes)} + ${this._renderOptionSelector(oe,this._cameraSelectViewModes)} + ${this._renderOptionSelector(re,this._darkModes)} + ${this._renderNumberInput(le)} + ${this._renderSwitch(ce,this._defaults.view.default_cycle_camera)} + ${this._renderViewDefaultResetMenu()} ${this._renderViewTriggersMenu()} + ${this._renderViewKeyboardShortcutMenu()} +
+ `:""} + ${this._renderOptionSetHeader("menu")} + ${"menu"===this._expandedMenus[bi]?o` +
+ ${this._renderOptionSelector(de,this._menuStyles)} + ${this._renderOptionSelector(me,this._menuPositions)} + ${this._renderOptionSelector(ue,this._menuAlignments)} + ${this._renderNumberInput(he,{min:X})} + ${this._renderMenuButton("frigate")} + ${this._renderMenuButton("cameras")} + ${this._renderMenuButton("substreams")} + ${this._renderMenuButton("live")} + ${this._renderMenuButton("clips")} + ${this._renderMenuButton("snapshots")} + ${this._renderMenuButton("recordings")} + ${this._renderMenuButton("image")} + ${this._renderMenuButton("download")} + ${this._renderMenuButton("camera_ui")} + ${this._renderMenuButton("fullscreen")} + ${this._renderMenuButton("expand")} + ${this._renderMenuButton("timeline")} + ${this._renderMenuButton("media_player")} + ${this._renderMenuButton("microphone",o`${this._renderOptionSelector(`${R}.microphone.type`,this._microphoneButtonTypes,{label:l("config.menu.buttons.type")})}`)} + ${this._renderMenuButton("play")} + ${this._renderMenuButton("mute")} + ${this._renderMenuButton("screenshot")} + ${this._renderMenuButton("display_mode")} + ${this._renderMenuButton("ptz_controls")} + ${this._renderMenuButton("ptz_home")} +
+ `:""} + ${this._renderOptionSetHeader("status_bar")} + ${"status_bar"===this._expandedMenus[bi]?o` +
+ ${this._renderOptionSelector(_e,this._statusBarStyles)} + ${this._renderOptionSelector(ge,this._statusBarPositions)} + ${this._renderNumberInput(be,{min:pe,label:l("config.status_bar.height")})} + ${this._renderNumberInput(ve,{min:0,max:60,default:this._defaults.status_bar.popup_seconds,label:l("config.status_bar.popup_seconds")})} + ${this._renderStatusBarItem("title")} + ${this._renderStatusBarItem("resolution")} + ${this._renderStatusBarItem("technology")} + ${this._renderStatusBarItem("engine")} +
+ `:""} + ${this._renderOptionSetHeader("live")} + ${"live"===this._expandedMenus[bi]?o` +
+ ${this._renderSwitch(fe,this._defaults.live.preload)} + ${this._renderSwitch($e,this._defaults.live.draggable)} + ${this._renderSwitch(ye,this._defaults.live.zoomable)} + ${this._renderSwitch(we,this._defaults.live.lazy_load)} + ${this._renderOptionSelector(Se,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(xe,this._mediaActionPositiveConditions,{multiple:!0})} + ${this._renderOptionSelector(Me,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(Ie,this._mediaLiveMuteConditions,{multiple:!0})} + ${this._renderOptionSelector(ke,this._mediaLiveUnmuteConditions,{multiple:!0})} + ${this._renderOptionSelector(Oe,this._transitionEffects)} + ${this._renderSwitch(Ce,this._defaults.live.show_image_during_load)} + ${this._renderViewDisplay("live.display",ze,Ae,Ne,Te)} + ${this._putInSubmenu("live.controls",!0,"config.live.controls.editor_label","mdi:gamepad",o` + ${this._renderSwitch(Be,this._defaults.live.controls.builtin,{label:l("config.common.controls.builtin")})} + ${this._renderNextPreviousControls("live.controls.next_previous",Ee,Pe,{allowIcons:!0})} + ${this._renderThumbnailsControls("live.controls.thumbnails",He,Le,Ve,Ke,Ue,this._defaults.live.controls.thumbnails,{configPathMediaType:je,configPathEventsMediaType:qe,configPathMode:Re})} + ${this._renderMiniTimeline("live.controls.timeline",De,Fe,Ge,Je,Qe,We,this._defaults.live.controls.timeline.show_recordings,Xe)} + ${this._putInSubmenu("live.controls.ptz",!0,"config.live.controls.ptz.editor_label","mdi:pan",o` + ${this._renderOptionSelector(Ye,this._ptzModes)} + ${this._renderOptionSelector(Ze,this._ptzPositions)} + ${this._renderOptionSelector(ea,this._ptzOrientations)} + ${this._renderSwitch(aa,this._defaults.live.controls.ptz.hide_pan_tilt,{label:l("config.live.controls.ptz.hide_pan_tilt")})} + ${this._renderSwitch(ta,this._defaults.live.controls.ptz.hide_pan_tilt,{label:l("config.live.controls.ptz.hide_zoom")})} + ${this._renderSwitch(ia,this._defaults.live.controls.ptz.hide_home,{label:l("config.live.controls.ptz.hide_home")})} + `)} + `)} + ${this._putInSubmenu("live.microphone",!0,"config.live.microphone.editor_label","mdi:microphone",o` + ${this._renderNumberInput(na)} + ${this._renderSwitch(sa,this._defaults.live.microphone.always_connected)} + ${this._renderNumberInput(oa)} + `)} +
+ `:""} + ${this._renderOptionSetHeader("media_gallery")} + ${"media_gallery"===this._expandedMenus[bi]?o`
+ ${this._renderThumbnailsControls("media_gallery.controls.thumbnails",ra,la,ca,da,ma,this._defaults.media_gallery.controls.thumbnails)} + ${this._renderFilterControls("media_gallery.controls.filter",ua)} +
`:""} + ${this._renderOptionSetHeader("media_viewer")} + ${"media_viewer"===this._expandedMenus[bi]?o`
+ ${this._renderOptionSelector(ha,this._mediaActionPositiveConditions,{multiple:!0})} + ${this._renderOptionSelector(_a,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(ga,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(ba,this._mediaActionPositiveConditions,{multiple:!0})} + ${this._renderSwitch(pa,this._defaults.media_viewer.draggable)} + ${this._renderSwitch(va,this._defaults.media_viewer.zoomable)} + ${this._renderSwitch(fa,this._defaults.media_viewer.lazy_load)} + ${this._renderOptionSelector($a,this._transitionEffects)} + ${this._renderSwitch(ya,this._defaults.media_viewer.snapshot_click_plays_clip)} + ${this._renderViewDisplay("media_viewer.display",wa,Sa,xa,Ma)} + ${this._putInSubmenu("media_viewer.controls",!0,"config.media_viewer.controls.editor_label","mdi:gamepad",o` + ${this._renderSwitch(Ia,this._defaults.media_viewer.controls.builtin,{label:l("config.common.controls.builtin")})} + ${this._renderNextPreviousControls("media_viewer.controls.next_previous",ka,Oa,{allowThumbnails:!0})} + ${this._renderThumbnailsControls("media_viewer.controls.thumbnails",Ca,za,Aa,Na,Ta,this._defaults.media_viewer.controls.thumbnails,{configPathMode:Ba})} + ${this._renderMiniTimeline("media_viewer.controls.timeline",Ea,Pa,Ha,La,Va,Ka,this._defaults.media_viewer.controls.timeline.show_recordings,Ua)} + `)} +
`:""} + ${this._renderOptionSetHeader("image")} + ${"image"===this._expandedMenus[bi]?o`
+ ${this._renderImageOptions(ja,qa,Ra,Da,Fa)} +
`:""} + ${this._renderOptionSetHeader("timeline")} + ${"timeline"===this._expandedMenus[bi]?o`
+ ${this._renderTimelineCoreControls(F,G,J,Q,W,this._defaults.timeline.show_recordings)} + ${this._renderThumbnailsControls("timeline.controls.thumbnails",Ga,Ja,Qa,Wa,Xa,this._defaults.timeline.controls.thumbnails,{configPathMode:Ya})} +
`:""} + ${this._renderOptionSetHeader("dimensions")} + ${"dimensions"===this._expandedMenus[bi]?o`
+ ${this._renderOptionSelector(Za,this._aspectRatioModes)} + ${this._renderStringInput(et)} + ${this._renderStringInput(at)} +
`:""} + ${this._renderOptionSetHeader("performance","low"===b(this._config,ui)?"warning":void 0)} + ${"performance"===this._expandedMenus[bi]?o`
+ ${"low"===b(this._config,ui)?this._renderInfo(l("config.performance.warning")):o``} + ${this._putInSubmenu("performance.features",!0,"config.performance.features.editor_label","mdi:feature-search",o` + ${this._renderSwitch(tt,this._defaults.performance.features.animated_progress_indicator)} + ${this._renderNumberInput(it,{max:nt})} + ${this._renderNumberInput(st,{min:1})} + `)} + ${this._putInSubmenu("performance.style",!0,"config.performance.style.editor_label","mdi:palette-swatch-variant",o` + ${this._renderSwitch(ot,this._defaults.performance.style.border_radius)} + ${this._renderSwitch(rt,this._defaults.performance.style.box_shadow)} + `)} +
`:""} + ${void 0!==this._config.overrides?o` ${this._renderOptionSetHeader("overrides")} + ${"overrides"===this._expandedMenus[bi]?o`
+ ${this._renderInfo(l("config.overrides.info"))} +
`:""}`:o``} +
+ `}_closeMenu(e){delete this._expandedMenus[e],this.requestUpdate()}_openMenu(e,a){this._expandedMenus[e]=a,this.requestUpdate()}_toggleMenu(e){if(e&&e.target){const a=e.target.domain,t=e.target.key;this._expandedMenus[a]===t?this._closeMenu(a):this._openMenu(a,t)}}_valueChangedHandler(e,a){if(!this._config||!this.hass)return;let t;if(a.detail&&void 0!==a.detail.value&&(t=a.detail.value,"string"==typeof t&&(t=t.trim())),b(this._config,e)===t)return;const i=m(this._config);""===t||void 0===t?lt(i,e):ct(i,e,t),this._updateConfig(i)}static get styles(){return c('ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n.option {\n padding: 4px 4px;\n cursor: pointer;\n}\n\n.option.option-overrides .title {\n color: var(--warning-color);\n}\n\n.row {\n display: flex;\n margin-bottom: -14px;\n pointer-events: none;\n}\n\n.title {\n padding-left: 16px;\n margin-top: -6px;\n pointer-events: none;\n}\n\n.title.warning {\n color: var(--warning-color);\n}\n\n.secondary {\n padding-left: 40px;\n color: var(--secondary-text-color);\n pointer-events: none;\n}\n\n.values {\n background: var(--secondary-background-color);\n display: grid;\n}\n\n.values + .option,\n.submenu + .option {\n margin-top: 10px;\n}\n\ndiv.upgrade {\n width: auto;\n border: 1px dotted var(--primary-color);\n margin: 10px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\ndiv.upgrade span {\n padding: 10px;\n}\n\n.submenu-header {\n display: flex;\n padding: 10px;\n cursor: pointer;\n}\n\n.submenu.selected > .submenu-header {\n background-color: var(--primary-color);\n color: var(--primary-text-color);\n}\n\n.submenu-header * {\n flex-basis: auto;\n pointer-events: none;\n}\n\n.submenu-header .new-camera {\n font-style: italic;\n}\n\n.submenu:not(.selected) > .submenu-header .new-camera {\n color: var(--secondary-text-color, "black");\n}\n\n.submenu-header ha-icon,\n.submenu-header img {\n padding-right: 15px;\n}\n\n.submenu.selected {\n border: 1px solid var(--primary-color);\n}\n\n.submenu {\n width: calc(100% - 20px);\n margin-left: auto;\n margin-right: auto;\n margin-bottom: 10px;\n}\n\n.submenu:first-child,\n:not(.submenu) + .submenu {\n margin-top: 10px;\n}\n\n.submenu .controls {\n display: inline-block;\n margin-left: auto;\n margin-right: 0px;\n margin-bottom: 5px;\n}\n\n.submenu .controls ha-icon-button.button {\n --mdc-icon-button-size: 32px;\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n}\n\nspan.info {\n padding: 10px;\n}\n\nha-selector {\n padding: 10px;\n border: 1px solid var(--divider-color);\n}')}};t([i({attribute:!1})],vi.prototype,"hass",void 0),t([d()],vi.prototype,"_config",void 0),t([d()],vi.prototype,"_defaults",void 0),t([d()],vi.prototype,"_expandedMenus",void 0),vi=t([n("frigate-card-editor")],vi);export{vi as FrigateCardEditor}; diff --git a/config/www/community/frigate-hass-card/editor-0c0425c2.js.gz b/config/www/community/frigate-hass-card/editor-0c0425c2.js.gz new file mode 100644 index 00000000..b2fc5064 Binary files /dev/null and b/config/www/community/frigate-hass-card/editor-0c0425c2.js.gz differ diff --git a/config/www/community/frigate-hass-card/editor-13524f00.js b/config/www/community/frigate-hass-card/editor-13524f00.js new file mode 100644 index 00000000..6e09e984 --- /dev/null +++ b/config/www/community/frigate-hass-card/editor-13524f00.js @@ -0,0 +1,462 @@ +import{i as e,s as a,_ as t,n as i,t as n,a as s,x as o,e as r,l,r as c,b as d,c as m,d as u,p as h,f as _,g,h as b,j as p,k as v,C as f,m as $,o as y,q as w,u as S,v as x,w as M,y as I,z as k,A as O,B as C,D as z,E as A,F as N,G as T,H as B,I as E,J as P,K as H,L,M as V,N as K,O as U,P as j,Q as q,R,S as D,T as F,U as G,V as J,W as Q,X as W,Y as X,Z as Y,$ as Z,a0 as ee,a1 as ae,a2 as te,a3 as ie,a4 as ne,a5 as se,a6 as oe,a7 as re,a8 as le,a9 as ce,aa as de,ab as me,ac as ue,ad as he,ae as _e,af as ge,ag as be,ah as pe,ai as ve,aj as fe,ak as $e,al as ye,am as we,an as Se,ao as xe,ap as Me,aq as Ie,ar as ke,as as Oe,at as Ce,au as ze,av as Ae,aw as Ne,ax as Te,ay as Be,az as Ee,aA as Pe,aB as He,aC as Le,aD as Ve,aE as Ke,aF as Ue,aG as je,aH as qe,aI as Re,aJ as De,aK as Fe,aL as Ge,aM as Je,aN as Qe,aO as We,aP as Xe,aQ as Ye,aR as Ze,aS as ea,aT as aa,aU as ta,aV as ia,aW as na,aX as sa,aY as oa,aZ as ra,a_ as la,a$ as ca,b0 as da,b1 as ma,b2 as ua,b3 as ha,b4 as _a,b5 as ga,b6 as ba,b7 as pa,b8 as va,b9 as fa,ba as $a,bb as ya,bc as wa,bd as Sa,be as xa,bf as Ma,bg as Ia,bh as ka,bi as Oa,bj as Ca,bk as za,bl as Aa,bm as Na,bn as Ta,bo as Ba,bp as Ea,bq as Pa,br as Ha,bs as La,bt as Va,bu as Ka,bv as Ua,bw as ja,bx as qa,by as Ra,bz as Da,bA as Fa,bB as Ga,bC as Ja,bD as Qa,bE as Wa,bF as Xa,bG as Ya,bH as Za,bI as et,bJ as at,bK as tt,bL as it,bM as nt,bN as st,bO as ot,bP as rt,bQ as lt,bR as ct,bS as dt,bT as mt,bU as ut,bV as ht,bW as _t,bX as gt,bY as bt,bZ as pt,b_ as vt,b$ as ft,c0 as $t,c1 as yt,c2 as wt,c3 as St,c4 as xt,c5 as Mt,c6 as It,c7 as kt,c8 as Ot,c9 as Ct,ca as zt,cb as At,cc as Nt,cd as Tt,ce as Bt,cf as Et,cg as Pt,ch as Ht,ci as Lt,cj as Vt,ck as Kt,cl as Ut,cm as jt,cn as qt,co as Rt,cp as Dt,cq as Ft,cr as Gt,cs as Jt,ct as Qt,cu as Wt,cv as Xt,cw as Yt,cx as Zt,cy as ei,cz as ai,cA as ti,cB as ii,cC as ni,cD as si,cE as oi,cF as ri,cG as li,cH as ci,cI as di,cJ as mi,cK as ui}from"./card-769e2b91.js";class hi{constructor(e){this._assigning=!1,this._value=null,this._blurEventHandler=()=>{this._setAssigning(!1)},this._keydownEventHandler=e=>{e.key&&!["Control","Alt","Shift","Meta"].includes(e.key)&&(this.setValue({key:e.key,ctrl:e.ctrlKey,alt:e.altKey,shift:e.shiftKey,meta:e.metaKey}),this._setAssigning(!1))},this._host=e,this._host.addController(this)}setValue(a){e(a,this._value)||(this._value=a,this._host.requestUpdate(),this._host.dispatchEvent(new CustomEvent("value-changed",{detail:{value:this._value}})))}getValue(){return this._value}hasValue(){return!!this._value}isAssigning(){return this._assigning}toggleAssigning(){this._setAssigning(!this._assigning)}_setAssigning(e){this._assigning=e,a(this._host,this._assigning,"assigning"),this._assigning?this._host.addEventListener("keydown",this._keydownEventHandler):this._host.removeEventListener("keydown",this._keydownEventHandler),this._host.requestUpdate()}hostConnected(){this._host.addEventListener("blur",this._blurEventHandler)}hostDisconnected(){this._host.removeEventListener("blur",this._blurEventHandler)}}let _i=class extends s{constructor(){super(...arguments),this._controller=new hi(this)}willUpdate(e){e.has("value")&&this._controller.setValue(this.value??null)}render(){if(!this.label)return;const e=e=>o`
+
${e}
+
`;return o` +
${this.label}
+ {this._controller.toggleAssigning()}} + > + + + ${this._controller.isAssigning()?l("key_assigner.assigning"):l("key_assigner.assign")} + + + ${this._controller.hasValue()?o`{this._controller.setValue(null)}} + > + + ${l("key_assigner.unassign")} + `:""} +
+ ${this.value?.ctrl?e(l("key_assigner.modifiers.ctrl")):""} + ${this.value?.shift?e(l("key_assigner.modifiers.shift")):""} + ${this.value?.meta?e(l("key_assigner.modifiers.meta")):""} + ${this.value?.alt?e(l("key_assigner.modifiers.alt")):""} + ${this.value?.key?e(this.value.key):""} +
+ `}static get styles(){return c('.dotdotdot:after {\n animation: dots 2s linear infinite;\n content: "";\n display: inline-block;\n width: 3em;\n}\n@keyframes dots {\n 0%, 20% {\n content: ".";\n }\n 40% {\n content: "..";\n }\n 60% {\n content: "...";\n }\n 90%, 100% {\n content: "";\n }\n}\n\n:host {\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 10px;\n height: 56px;\n border: 1px solid var(--divider-color);\n}\n\n:host([assigning]) ha-button.assign span,\n:host([assigning]) ha-button.assign ha-icon {\n color: var(--warning-color);\n}\n\nha-icon {\n padding: 10px;\n}\n\ndiv.label {\n width: 100px;\n margin-left: 4px;\n}\n\ndiv.key-row {\n flex: 1;\n display: flex;\n justify-content: center;\n align-items: center;\n padding-left: 10px;\n padding-right: 10px;\n}\n\ndiv.key {\n display: flex;\n align-items: center;\n height: 90%;\n width: min-content;\n margin-left: 5px;\n margin-right: 5px;\n}\n\ndiv.key-inner {\n height: 100%;\n width: 100%;\n padding-top: 2px;\n padding-bottom: 2px;\n padding-left: 4px;\n padding-right: 4px;\n border: 2px;\n border-radius: 4px;\n border-style: outset;\n border-color: var(--divider-color);\n font-family: monospace;\n text-transform: capitalize;\n}\n\ndiv.unassigned {\n font-style: italic;\n}\n\ndiv.key + div.key:before {\n display: flex;\n align-items: center;\n margin-right: 5px;\n content: " + ";\n}')}};t([i({attribute:!1})],_i.prototype,"label",void 0),t([i({attribute:!1})],_i.prototype,"value",void 0),_i=t([n("frigate-card-key-assigner")],_i);const gi="cameras",bi="options",pi={cameras:{icon:"video",name:l("editor.cameras"),secondary:l("editor.cameras_secondary")},view:{icon:"eye",name:l("editor.view"),secondary:l("editor.view_secondary")},menu:{icon:"menu",name:l("editor.menu"),secondary:l("editor.menu_secondary")},status_bar:{icon:"sign-text",name:l("editor.status_bar"),secondary:l("editor.status_bar_secondary")},live:{icon:"cctv",name:l("editor.live"),secondary:l("editor.live_secondary")},media_gallery:{icon:"grid",name:l("editor.media_gallery"),secondary:l("editor.media_gallery_secondary")},media_viewer:{icon:"filmstrip",name:l("editor.media_viewer"),secondary:l("editor.media_viewer_secondary")},image:{icon:"image",name:l("editor.image"),secondary:l("editor.image_secondary")},timeline:{icon:"chart-gantt",name:l("editor.timeline"),secondary:l("editor.timeline_secondary")},dimensions:{icon:"aspect-ratio",name:l("editor.dimensions"),secondary:l("editor.dimensions_secondary")},performance:{icon:"speedometer",name:l("editor.performance"),secondary:l("editor.performance_secondary")},profiles:{icon:"folder-wrench-outline",name:l("editor.profiles"),secondary:l("editor.profiles_secondary")},overrides:{icon:"file-replace",name:l("editor.overrides"),secondary:l("editor.overrides_secondary")}};let vi=class extends s{constructor(){super(...arguments),this._defaults=m(di),this._initialized=!1,this._configUpgradeable=!1,this._expandedMenus={},this._viewModes=[{value:"",label:""},{value:"live",label:l("config.view.views.live")},{value:"clips",label:l("config.view.views.clips")},{value:"snapshots",label:l("config.view.views.snapshots")},{value:"recordings",label:l("config.view.views.recordings")},{value:"clip",label:l("config.view.views.clip")},{value:"snapshot",label:l("config.view.views.snapshot")},{value:"recording",label:l("config.view.views.recording")},{value:"image",label:l("config.view.views.image")},{value:"timeline",label:l("config.view.views.timeline")}],this._cameraSelectViewModes=[...this._viewModes,{value:"current",label:l("config.view.views.current")}],this._filterModes=[{value:"",label:""},{value:"none",label:l("config.common.controls.filter.modes.none")},{value:"left",label:l("config.common.controls.filter.modes.left")},{value:"right",label:l("config.common.controls.filter.modes.right")}],this._menuStyles=[{value:"",label:""},{value:"none",label:l("config.menu.styles.none")},{value:"hidden",label:l("config.menu.styles.hidden")},{value:"overlay",label:l("config.menu.styles.overlay")},{value:"hover",label:l("config.menu.styles.hover")},{value:"hover-card",label:l("config.menu.styles.hover-card")},{value:"outside",label:l("config.menu.styles.outside")}],this._menuPositions=[{value:"",label:""},{value:"left",label:l("config.menu.positions.left")},{value:"right",label:l("config.menu.positions.right")},{value:"top",label:l("config.menu.positions.top")},{value:"bottom",label:l("config.menu.positions.bottom")}],this._menuAlignments=[{value:"",label:""},{value:"left",label:l("config.menu.alignments.left")},{value:"right",label:l("config.menu.alignments.right")},{value:"top",label:l("config.menu.alignments.top")},{value:"bottom",label:l("config.menu.alignments.bottom")}],this._nextPreviousControlStyles=[{value:"",label:""},{value:"chevrons",label:l("config.common.controls.next_previous.styles.chevrons")},{value:"icons",label:l("config.common.controls.next_previous.styles.icons")},{value:"none",label:l("config.common.controls.next_previous.styles.none")},{value:"thumbnails",label:l("config.common.controls.next_previous.styles.thumbnails")}],this._aspectRatioModes=[{value:"",label:""},{value:"dynamic",label:l("config.dimensions.aspect_ratio_modes.dynamic")},{value:"static",label:l("config.dimensions.aspect_ratio_modes.static")},{value:"unconstrained",label:l("config.dimensions.aspect_ratio_modes.unconstrained")}],this._thumbnailModes=[{value:"",label:""},{value:"none",label:l("config.common.controls.thumbnails.modes.none")},{value:"above",label:l("config.common.controls.thumbnails.modes.above")},{value:"below",label:l("config.common.controls.thumbnails.modes.below")},{value:"left",label:l("config.common.controls.thumbnails.modes.left")},{value:"right",label:l("config.common.controls.thumbnails.modes.right")}],this._thumbnailMediaTypes=[{value:"",label:""},{value:"events",label:l("config.common.controls.thumbnails.media_types.events")},{value:"recordings",label:l("config.common.controls.thumbnails.media_types.recordings")}],this._thumbnailEventsMediaTypes=[{value:"",label:""},{value:"clips",label:l("config.common.controls.thumbnails.events_media_types.clips")},{value:"snapshots",label:l("config.common.controls.thumbnails.events_media_types.snapshots")}],this._transitionEffects=[{value:"",label:""},{value:"none",label:l("config.media_viewer.transition_effects.none")},{value:"slide",label:l("config.media_viewer.transition_effects.slide")}],this._imageModes=[{value:"",label:""},{value:"camera",label:l("config.common.image.modes.camera")},{value:"entity",label:l("config.common.image.modes.entity")},{value:"screensaver",label:l("config.common.image.modes.screensaver")},{value:"url",label:l("config.common.image.modes.url")}],this._timelineEventsMediaTypes=[{value:"",label:""},{value:"all",label:l("config.common.timeline.events_media_types.all")},{value:"clips",label:l("config.common.timeline.events_media_types.clips")},{value:"snapshots",label:l("config.common.timeline.events_media_types.snapshots")}],this._timelineStyleTypes=[{value:"",label:""},{value:"ribbon",label:l("config.common.timeline.styles.ribbon")},{value:"stack",label:l("config.common.timeline.styles.stack")}],this._darkModes=[{value:"",label:""},{value:"on",label:l("config.view.dark_modes.on")},{value:"off",label:l("config.view.dark_modes.off")},{value:"auto",label:l("config.view.dark_modes.auto")}],this._mediaActionNegativeConditions=[{value:"",label:""},{value:"unselected",label:l("config.common.media_action_conditions.unselected")},{value:"hidden",label:l("config.common.media_action_conditions.hidden")}],this._mediaActionPositiveConditions=[{value:"",label:""},{value:"selected",label:l("config.common.media_action_conditions.selected")},{value:"visible",label:l("config.common.media_action_conditions.visible")}],this._mediaLiveUnmuteConditions=[...this._mediaActionPositiveConditions,{value:"microphone",label:l("config.common.media_action_conditions.microphone_unmute")}],this._mediaLiveMuteConditions=[...this._mediaActionNegativeConditions,{value:"microphone",label:l("config.common.media_action_conditions.microphone_mute")}],this._layoutFits=[{value:"",label:""},{value:"contain",label:l("config.cameras.dimensions.layout.fits.contain")},{value:"cover",label:l("config.cameras.dimensions.layout.fits.cover")},{value:"fill",label:l("config.cameras.dimensions.layout.fits.fill")}],this._miniTimelineModes=[{value:"",label:""},{value:"none",label:l("config.common.controls.timeline.modes.none")},{value:"above",label:l("config.common.controls.timeline.modes.above")},{value:"below",label:l("config.common.controls.timeline.modes.below")}],this._profiles=[{value:"",label:""},{value:"casting",label:l("config.profiles.casting")},{value:"low-performance",label:l("config.profiles.low-performance")},{value:"scrubbing",label:l("config.profiles.scrubbing")}],this._go2rtcModes=[{value:"",label:""},{value:"mse",label:l("config.cameras.go2rtc.modes.mse")},{value:"webrtc",label:l("config.cameras.go2rtc.modes.webrtc")},{value:"mp4",label:l("config.cameras.go2rtc.modes.mp4")},{value:"mjpeg",label:l("config.cameras.go2rtc.modes.mjpeg")}],this._microphoneButtonTypes=[{value:"",label:""},{value:"momentary",label:l("config.menu.buttons.types.momentary")},{value:"toggle",label:l("config.menu.buttons.types.toggle")}],this._displayModes=[{value:"",label:""},{value:"single",label:l("display_modes.single")},{value:"grid",label:l("display_modes.grid")}],this._castMethods=[{value:"",label:""},{value:"standard",label:l("config.cameras.cast.methods.standard")},{value:"dashboard",label:l("config.cameras.cast.methods.dashboard")}],this._ptzModes=[{value:"",label:""},{value:"on",label:l("config.live.controls.ptz.modes.on")},{value:"off",label:l("config.live.controls.ptz.modes.off")}],this._ptzOrientations=[{value:"",label:""},{value:"vertical",label:l("config.live.controls.ptz.orientations.vertical")},{value:"horizontal",label:l("config.live.controls.ptz.orientations.horizontal")}],this._ptzPositions=[{value:"",label:""},{value:"top-left",label:l("config.live.controls.ptz.positions.top-left")},{value:"top-right",label:l("config.live.controls.ptz.positions.top-right")},{value:"bottom-left",label:l("config.live.controls.ptz.positions.bottom-left")},{value:"bottom-right",label:l("config.live.controls.ptz.positions.bottom-right")}],this._triggersActionsInteractionModes=[{value:"",label:""},{value:"all",label:l("config.view.triggers.actions.interaction_modes.all")},{value:"inactive",label:l("config.view.triggers.actions.interaction_modes.inactive")},{value:"active",label:l("config.view.triggers.actions.interaction_modes.active")}],this._triggersActionsTrigger=[{value:"",label:""},{value:"default",label:l("config.view.triggers.actions.triggers.default")},{value:"live",label:l("config.view.triggers.actions.triggers.live")},{value:"media",label:l("config.view.triggers.actions.triggers.media")},{value:"none",label:l("config.view.triggers.actions.triggers.none")}],this._triggersActionsUntrigger=[{value:"",label:""},{value:"default",label:l("config.view.triggers.actions.untriggers.default")},{value:"none",label:l("config.view.triggers.actions.untriggers.none")}],this._triggersEvents=[{value:"",label:""},{value:"events",label:l("config.cameras.triggers.events.events")},{value:"clips",label:l("config.cameras.triggers.events.clips")},{value:"snapshots",label:l("config.cameras.triggers.events.snapshots")}],this._timelinePanModes=[{value:"",label:""},{value:"pan",label:l("config.common.controls.timeline.pan_modes.pan")},{value:"seek",label:l("config.common.controls.timeline.pan_modes.seek")},{value:"seek-in-media",label:l("config.common.controls.timeline.pan_modes.seek-in-media")},{value:"seek-in-camera",label:l("config.common.controls.timeline.pan_modes.seek-in-camera")}],this._capabilities=[{value:"",label:""},{value:"live",label:l("config.cameras.capabilities.capabilities.live")},{value:"substream",label:l("config.cameras.capabilities.capabilities.substream")},{value:"clips",label:l("config.cameras.capabilities.capabilities.clips")},{value:"recordings",label:l("config.cameras.capabilities.capabilities.recordings")},{value:"snapshots",label:l("config.cameras.capabilities.capabilities.snapshots")},{value:"favorite-events",label:l("config.cameras.capabilities.capabilities.favorite-events")},{value:"favorite-recordings",label:l("config.cameras.capabilities.capabilities.favorite-recordings")},{value:"seek",label:l("config.cameras.capabilities.capabilities.seek")},{value:"ptz",label:l("config.cameras.capabilities.capabilities.ptz")},{value:"menu",label:l("config.cameras.capabilities.capabilities.menu")}],this._defaultResetInteractionModes=[{value:"",label:""},{value:"all",label:l("config.view.default_reset.interaction_modes.all")},{value:"inactive",label:l("config.view.default_reset.interaction_modes.inactive")},{value:"active",label:l("config.view.default_reset.interaction_modes.active")}],this._proxyMedia=[{value:"",label:""},{value:"auto",label:l("config.cameras.proxy.media.auto")},{value:!0,label:l("config.cameras.proxy.media.true")},{value:!1,label:l("config.cameras.proxy.media.false")}],this._proxySSLCiphers=[{value:"",label:""},{value:"auto",label:l("config.cameras.proxy.ssl_ciphers.auto")},{value:"default",label:l("config.cameras.proxy.ssl_ciphers.default")},{value:"insecure",label:l("config.cameras.proxy.ssl_ciphers.insecure")},{value:"intermediate",label:l("config.cameras.proxy.ssl_ciphers.intermediate")},{value:"modern",label:l("config.cameras.proxy.ssl_ciphers.modern")}],this._proxySSLVerification=[{value:"",label:""},{value:"auto",label:l("config.cameras.proxy.ssl_verification.auto")},{value:!0,label:l("config.cameras.proxy.ssl_verification.true")},{value:!1,label:l("config.cameras.proxy.ssl_verification.false")}],this._reolinkMediaResolution=[{value:"",label:""},{value:"high",label:l("config.cameras.reolink.media_resolution.high")},{value:"low",label:l("config.cameras.reolink.media_resolution.low")}],this._statusBarStyles=[{value:"",label:""},{value:"hover",label:l("config.status_bar.styles.hover")},{value:"hover-card",label:l("config.status_bar.styles.hover-card")},{value:"none",label:l("config.status_bar.styles.none")},{value:"outside",label:l("config.status_bar.styles.outside")},{value:"overlay",label:l("config.status_bar.styles.overlay")},{value:"popup",label:l("config.status_bar.styles.popup")}],this._statusBarPositions=[{value:"",label:""},{value:"top",label:l("config.status_bar.positions.top")},{value:"bottom",label:l("config.status_bar.positions.bottom")}]}setConfig(e){this._config=e,this._configUpgradeable=u(e);const a=h.safeParse(this._config.profiles);if(a.success){const e=m(di);_(this._config,e,a.data),this._defaults=e}}willUpdate(){this._initialized||g().then((e=>{e&&(this._initialized=!0)}))}_renderOptionSetHeader(e,a){const t=pi[e];return o` +
+
+ +
${t.name}
+
+
${t.secondary}
+
+ `}_getLabel(e){const a=e.split(".").filter((e=>!e.match(/^\[[0-9]+\]$/))).join(".");return l(`config.${a}`)}_renderEntitySelector(e,a){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderOptionSelector(e,a=[],t){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderIconSelector(e,a){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderNumberInput(e,a){if(!this._config)return;const t=b(this._config,e),i=void 0===a?.max?"box":"slider";return o` + this._valueChangedHandler(e,a)} + > + + `}_renderInfo(e){return o` ${e}`}_getEditorCameraTitle(e,a){return"string"==typeof a?.title&&a.title||("string"==typeof a?.camera_entity?p(this.hass,a.camera_entity):"")||"object"==typeof a?.webrtc_card&&a.webrtc_card&&"string"==typeof a.webrtc_card.entity&&a.webrtc_card.entity||("object"==typeof a?.frigate&&a.frigate&&"string"==typeof a?.frigate.camera_name&&a.frigate.camera_name?v(a.frigate.camera_name):"")||"string"==typeof a?.id&&a.id||l("editor.camera")+" #"+e}_renderViewDefaultResetMenu(){return this._putInSubmenu("view.default_reset",!0,`config.${f}.editor_label`,"mdi:restart",o` + ${this._renderSwitch($,this._defaults.view.default_reset.after_interaction)} + ${this._renderNumberInput(y)} + ${this._renderOptionSelector(w,this._defaultResetInteractionModes,{label:l("config.view.default_reset.interaction_mode")})}, + ${this._renderOptionSelector(S,this.hass?x(this.hass):[],{multiple:!0})} + `)}_renderViewTriggersMenu(){return this._putInSubmenu("view.triggers",!0,`config.${M}.editor_label`,"mdi:target-account",o` + ${this._renderSwitch(I,this._defaults.view.triggers.filter_selected_camera,{label:l(`config.${I}`)})} + ${this._renderSwitch(k,this._defaults.view.triggers.show_trigger_status,{label:l(`config.${k}`)})} + ${this._renderNumberInput(O,{default:this._defaults.view.triggers.untrigger_seconds})} + ${this._putInSubmenu("view.triggers.actions",!0,`config.${C}.editor_label`,"mdi:cogs",o` ${this._renderOptionSelector(z,this._triggersActionsTrigger,{label:l("config.view.triggers.actions.trigger")})} + ${this._renderOptionSelector(A,this._triggersActionsUntrigger,{label:l("config.view.triggers.actions.untrigger")})} + ${this._renderOptionSelector(N,this._triggersActionsInteractionModes,{label:l("config.view.triggers.actions.interaction_mode")})}`)} + `)}_renderKeyAssigner(e,a){return o` this._valueChangedHandler(e,a)} + >`}_renderViewKeyboardShortcutMenu(){return this._putInSubmenu("view.keyboard_shortcuts",!0,`config.${T}.editor_label`,"mdi:keyboard",o` + ${this._renderSwitch(B,this._defaults.view.keyboard_shortcuts.enabled,{label:l(`config.${B}`)})} + ${this._renderKeyAssigner(E,this._defaults.view.keyboard_shortcuts.ptz_left)} + ${this._renderKeyAssigner(P,this._defaults.view.keyboard_shortcuts.ptz_right)} + ${this._renderKeyAssigner(H,this._defaults.view.keyboard_shortcuts.ptz_up)} + ${this._renderKeyAssigner(L,this._defaults.view.keyboard_shortcuts.ptz_down)} + ${this._renderKeyAssigner(V,this._defaults.view.keyboard_shortcuts.ptz_zoom_in)} + ${this._renderKeyAssigner(K,this._defaults.view.keyboard_shortcuts.ptz_zoom_out)} + ${this._renderKeyAssigner(U,this._defaults.view.keyboard_shortcuts.ptz_home)} + `)}_renderStatusBarItem(e){return o` ${this._putInSubmenu("status_bar.items",e,`config.status_bar.items.${e}`,"mdi:feature-search",o` + ${this._renderSwitch(`${j}.${e}.enabled`,this._defaults.status_bar.items[e]?.enabled??!0,{label:l("config.status_bar.items.enabled")})} + ${this._renderNumberInput(`${j}.${e}.priority`,{max:q,default:this._defaults.status_bar.items[e]?.priority,label:l("config.status_bar.items.priority")})} + `)}`}_renderMenuButton(e,a){const t=[{value:"",label:""},{value:"matching",label:l("config.menu.buttons.alignments.matching")},{value:"opposing",label:l("config.menu.buttons.alignments.opposing")}];return o` ${this._putInSubmenu("menu.buttons",e,`config.menu.buttons.${e}`,"mdi:gesture-tap-button",o` + ${this._renderSwitch(`${R}.${e}.enabled`,this._defaults.menu.buttons[e]?.enabled??!0,{label:l("config.menu.buttons.enabled")})} + ${this._renderOptionSelector(`${R}.${e}.alignment`,t,{label:l("config.menu.buttons.alignment")})} + ${this._renderSwitch(`${R}.${e}.permanent`,this._defaults.menu.buttons[e]?.permanent??!1,{label:l("config.menu.buttons.permanent")})} + ${this._renderNumberInput(`${R}.${e}.priority`,{max:D,default:this._defaults.menu.buttons[e]?.priority,label:l("config.menu.buttons.priority")})} + ${this._renderIconSelector(`${R}.${e}.icon`,{label:l("config.menu.buttons.icon")})} + ${a} + `)}`}_putInSubmenu(e,a,t,i,n){const s=this._expandedMenus[e]===a,c={submenu:!0,selected:s},d=dt(i);return o`
+ + ${s?o`
${n}
`:""} +
`}_renderMediaLayout(e,a,t,i,n,s,r,c,d,m,u,h){return this._putInSubmenu(e,!0,a,"mdi:page-layout-body",o` + ${this._renderNumberInput(m,{min:0,max:10,label:l("config.cameras.dimensions.layout.zoom"),step:.1})} + ${this._renderNumberInput(u,{min:0,max:100,label:l("config.cameras.dimensions.layout.pan.x")})} + ${this._renderNumberInput(h,{min:0,max:100,label:l("config.cameras.dimensions.layout.pan.y")})} + ${this._renderOptionSelector(t,this._layoutFits,{label:l("config.cameras.dimensions.layout.fit")})} + ${this._putInSubmenu(`${e}.position`,!0,"config.cameras.dimensions.layout.position.editor_label","mdi:aspect-ratio",o` ${this._renderNumberInput(i,{min:0,max:100,label:l("config.cameras.dimensions.layout.position.x")})} + ${this._renderNumberInput(n,{min:0,max:100,label:l("config.cameras.dimensions.layout.position.y")})}`)} + ${this._putInSubmenu(`${e}.view_box`,!0,"config.cameras.dimensions.layout.view_box.editor_label","mdi:crop",o` + ${this._renderNumberInput(s,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.top")})} + ${this._renderNumberInput(r,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.bottom")})} + ${this._renderNumberInput(c,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.left")})} + ${this._renderNumberInput(d,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.right")})} + `)} + `)}_renderTimelineCoreControls(e,a,t,i,n,s,r){return o` + ${this._renderOptionSelector(e,this._timelineStyleTypes,{label:l(`config.common.${F}`)})} + ${r?this._renderOptionSelector(r,this._timelinePanModes,{label:l("config.common.controls.timeline.pan_mode")}):""} + ${this._renderNumberInput(a,{label:l(`config.common.${G}`)})} + ${this._renderNumberInput(t,{label:l(`config.common.${J}`)})} + ${this._renderOptionSelector(i,this._timelineEventsMediaTypes,{label:l(`config.common.${Q}`)})} + ${this._renderSwitch(n,s,{label:l(`config.common.${W}`)})} + `}_renderMiniTimeline(e,a,t,i,n,s,r,c,d){return this._putInSubmenu(e,!0,"config.common.controls.timeline.editor_label","mdi:chart-gantt",o` ${this._renderOptionSelector(a,this._miniTimelineModes,{label:l("config.common.controls.timeline.mode")})} + ${this._renderTimelineCoreControls(t,i,n,s,r,c,d)}`)}_renderViewDisplay(e,a,t,i,n){return this._putInSubmenu(e,!0,"config.common.display.editor_label","mdi:palette-swatch",o` + ${this._renderOptionSelector(a,this._displayModes,{label:l("config.common.display.mode")})} + ${this._renderNumberInput(t,{min:0,label:l("config.common.display.grid_selected_width_factor")})} + ${this._renderNumberInput(i,{min:0,label:l("config.common.display.grid_columns")})} + ${this._renderNumberInput(n,{min:0,label:l("config.common.display.grid_max_columns")})} + `)}_renderNextPreviousControls(e,a,t,i){return this._putInSubmenu(e,!0,"config.common.controls.next_previous.editor_label","mdi:arrow-right-bold-circle",o` + ${this._renderOptionSelector(a,this._nextPreviousControlStyles.filter((e=>!(!i?.allowThumbnails&&"thumbnails"===e.value||!i?.allowIcons&&"icons"===e.value))),{label:l("config.common.controls.next_previous.style")})} + ${this._renderNumberInput(t,{min:X,label:l("config.common.controls.next_previous.size")})} + `)}_renderThumbnailsControls(e,a,t,i,n,s,r,c){return this._putInSubmenu(e,!0,"config.common.controls.thumbnails.editor_label","mdi:image-text",o` + ${c?.configPathMode?o`${this._renderOptionSelector(c.configPathMode,this._thumbnailModes,{label:l("config.common.controls.thumbnails.mode")})}`:o``} + ${c?.configPathMediaType?o`${this._renderOptionSelector(c.configPathMediaType,this._thumbnailMediaTypes,{label:l("config.common.controls.thumbnails.media_type")})}`:o``} + ${c?.configPathEventsMediaType?o`${this._renderOptionSelector(c.configPathEventsMediaType,this._thumbnailEventsMediaTypes,{label:l("config.common.controls.thumbnails.events_media_type")})}`:o``} + ${this._renderNumberInput(a,{min:Y,max:Z,label:l("config.common.controls.thumbnails.size")})} + ${this._renderSwitch(t,r.show_details,{label:l("config.common.controls.thumbnails.show_details")})} + ${this._renderSwitch(i,r.show_favorite_control,{label:l("config.common.controls.thumbnails.show_favorite_control")})} + ${this._renderSwitch(n,r.show_timeline_control,{label:l("config.common.controls.thumbnails.show_timeline_control")})} + ${this._renderSwitch(s,r.show_download_control,{label:l("config.common.controls.thumbnails.show_download_control")})} + `)}_renderFilterControls(e,a){return this._putInSubmenu(e,!0,"config.common.controls.filter.editor_label","mdi:filter-cog",o` + ${a?o`${this._renderOptionSelector(a,this._filterModes,{label:l("config.common.controls.filter.mode")})}`:o``} + `)}_renderImageOptions(e,a,t,i,n){return o` + ${this._renderOptionSelector(e,this._imageModes,{label:l("config.common.image.mode")})} + ${this._renderStringInput(a,{label:l("config.common.image.url")})} + ${this._renderOptionSelector(t,this.hass?x(this.hass):[],{label:l("config.common.image.entity")})} + ${this._renderStringInput(i,{label:l("config.common.image.entity_parameters")})} + ${this._renderNumberInput(n,{label:l("config.common.image.refresh_seconds")})} + `}_renderCamera(e,a,t,i){const n=[{value:"",label:""},{value:"auto",label:l("config.cameras.live_providers.auto")},{value:"ha",label:l("config.cameras.live_providers.ha")},{value:"image",label:l("config.cameras.live_providers.image")},{value:"jsmpeg",label:l("config.cameras.live_providers.jsmpeg")},{value:"go2rtc",label:l("config.cameras.live_providers.go2rtc")},{value:"webrtc-card",label:l("config.cameras.live_providers.webrtc-card")}],s=[];e.forEach(((e,t)=>{t!==a&&s.push({value:ee(e),label:this._getEditorCameraTitle(t,e)})}));const c=e=>{if(this._config){const a=m(this._config);e(a)&&this._updateConfig(a)}},d={submenu:!0,selected:this._expandedMenus[gi]===a};return o` +
+ + ${this._expandedMenus[gi]===a?o`
+
+ !i&&c((e=>!!(Array.isArray(e.cameras)&&a>0)&&(mt(e.cameras,a,a-1),this._openMenu(gi,a-1),!0)))} + > + + + =this._config.cameras.length-1} + @click=${()=>!i&&c((e=>!!(Array.isArray(e.cameras)&&a + + + {c((e=>!!Array.isArray(e.cameras)&&(e.cameras.splice(a,1),this._closeMenu(gi),!0)))}} + > + + +
+ ${this._renderEntitySelector(ae(ut,a),"camera")} + ${this._renderOptionSelector(ae(ht,a),n)} + ${this._renderStringInput(ae(_t,a))} + ${this._renderIconSelector(ae(gt,a),{label:l("config.cameras.icon")})} + ${this._renderStringInput(ae(bt,a))} + ${this._putInSubmenu("cameras.engine",!0,"config.cameras.engines.editor_label","mdi:engine",o`${this._putInSubmenu("cameras.frigate",a,"config.cameras.frigate.editor_label","frigate",o` + ${this._renderStringInput(ae(pt,a))} + ${this._renderStringInput(ae(vt,a))} + ${this._renderOptionSelector(ae(ft,a),[],{multiple:!0,label:l("config.cameras.frigate.labels")})} + ${this._renderOptionSelector(ae($t,a),[],{multiple:!0,label:l("config.cameras.frigate.zones")})} + ${this._renderStringInput(ae(yt,a))} + `)} + ${this._putInSubmenu("cameras.motioneye",a,"config.cameras.motioneye.editor_label","motioneye",o` ${this._renderStringInput(ae(wt,a))} + ${this._renderStringInput(ae(St,a))} + ${this._renderStringInput(ae(xt,a))} + ${this._renderStringInput(ae(Mt,a))} + ${this._renderStringInput(ae(It,a))}`)} + ${this._putInSubmenu("cameras.reolink",a,"config.cameras.reolink.editor_label","reolink",o` ${this._renderStringInput(ae(kt,a))} + ${this._renderOptionSelector(ae(Ot,a),this._reolinkMediaResolution,{label:l("config.cameras.reolink.media_resolution.editor_label")})}`)}`)} + ${this._putInSubmenu("cameras.live_provider",!0,"config.cameras.live_provider_options.editor_label","mdi:cctv",o` ${this._putInSubmenu("cameras.go2rtc",a,"config.cameras.go2rtc.editor_label","mdi:alpha-g-circle",o`${this._renderOptionSelector(ae(Ct,a),this._go2rtcModes,{multiple:!0,label:l("config.cameras.go2rtc.modes.editor_label")})} + ${this._renderStringInput(ae(zt,a))}`)} + ${this._putInSubmenu("cameras.image",!0,"config.cameras.image.editor_label","mdi:image",this._renderImageOptions(ae(At,a),ae(Nt,a),ae(Tt,a),ae(Bt,a),ae(Et,a)))} + ${this._putInSubmenu("cameras.webrtc_card",a,"config.cameras.webrtc_card.editor_label","mdi:webrtc",o`${this._renderEntitySelector(ae(Pt,a),"camera")} + ${this._renderStringInput(ae(Ht,a))}`)}`)} + ${this._putInSubmenu("cameras.dependencies",a,"config.cameras.dependencies.editor_label","mdi:graph",o` ${this._renderSwitch(ae(Lt,a),this._defaults.cameras.dependencies.all_cameras)} + ${this._renderOptionSelector(ae(Vt,a),s,{multiple:!0})}`)} + ${this._putInSubmenu("cameras.triggers",a,"config.cameras.triggers.editor_label","mdi:magnify-scan",o` + ${this._renderSwitch(ae(Kt,a),this._defaults.cameras.triggers.occupancy)} + ${this._renderSwitch(ae(Ut,a),this._defaults.cameras.triggers.motion)} + ${this._renderOptionSelector(ae(jt,a),t,{multiple:!0})} + ${this._renderOptionSelector(ae(qt,a),this._triggersEvents,{multiple:!0,label:l("config.cameras.triggers.events.editor_label")})} + `)} + ${this._putInSubmenu("cameras.cast",a,"config.cameras.cast.editor_label","mdi:cast",o` + ${this._renderOptionSelector(ae(Rt,a),this._castMethods)} + ${this._renderStringInput(ae(Dt,a))} + ${this._renderStringInput(ae(Ft,a))} + `)} + ${this._putInSubmenu("cameras.dimensions",a,"config.cameras.dimensions.editor_label","mdi:aspect-ratio",o` + ${this._renderStringInput(ae(Gt,a))} + ${this._renderMediaLayout("cameras.dimensions.layout","config.cameras.dimensions.layout.editor_label",ae(Jt,a),ae(Qt,a),ae(Wt,a),ae(Xt,a),ae(Yt,a),ae(Zt,a),ae(ei,a),ae(ai,a),ae(ti,a),ae(ii,a))} + `)} + ${this._putInSubmenu("cameras.capabilities",a,"config.cameras.capabilities.editor_label","mdi:cog-stop",o` + ${this._renderOptionSelector(ae(ni,a),this._capabilities,{multiple:!0})} + ${this._renderOptionSelector(ae(si,a),this._capabilities,{multiple:!0})} + `)} + ${this._putInSubmenu("cameras.proxy",a,"config.cameras.proxy.editor_label","mdi:arrow-decision",o` + ${this._renderOptionSelector(ae(oi,a),this._proxyMedia,{label:l("config.cameras.proxy.media.editor_label")})} + ${this._renderSwitch(ae(ri,a),this._defaults.cameras.proxy.dynamic)} + ${this._renderOptionSelector(ae(li,a),this._proxySSLVerification,{label:l("config.cameras.proxy.ssl_verification.editor_label")})} + ${this._renderOptionSelector(ae(ci,a),this._proxySSLCiphers,{label:l("config.cameras.proxy.ssl_ciphers.editor_label")})} + `)} +
`:""} +
+ `}_renderStringInput(e,a){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderSwitch(e,a,t){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_updateConfig(e){this._config=e,te(this,"config-changed",{config:this._config})}render(){if(!this.hass||!this._config)return o``;const e=x(this.hass),a=b(this._config,mi)||[];return o` + ${this._configUpgradeable?o`
+ ${l("editor.upgrade_available")} + + {if(this._config){const e=m(this._config);ie(e),this._updateConfig(e)}}} + > + + +
+
`:o``} +
+ ${this._renderOptionSetHeader("cameras")} + ${"cameras"===this._expandedMenus[bi]?o` +
+ ${a.map(((t,i)=>this._renderCamera(a,i,e)))} + ${this._renderCamera(a,a.length,e,!0)} +
+ `:""} + ${this._renderOptionSetHeader("profiles")} + ${"profiles"===this._expandedMenus[bi]?o`
+ ${this._renderOptionSelector(ne,this._profiles,{multiple:!0,label:l("config.profiles.editor_label")})} +
`:""} + ${this._renderOptionSetHeader("view")} + ${"view"===this._expandedMenus[bi]?o` +
+ ${this._renderOptionSelector(se,this._viewModes)} + ${this._renderOptionSelector(oe,this._cameraSelectViewModes)} + ${this._renderOptionSelector(re,this._darkModes)} + ${this._renderNumberInput(le)} + ${this._renderSwitch(ce,this._defaults.view.default_cycle_camera)} + ${this._renderViewDefaultResetMenu()} ${this._renderViewTriggersMenu()} + ${this._renderViewKeyboardShortcutMenu()} +
+ `:""} + ${this._renderOptionSetHeader("menu")} + ${"menu"===this._expandedMenus[bi]?o` +
+ ${this._renderOptionSelector(de,this._menuStyles)} + ${this._renderOptionSelector(me,this._menuPositions)} + ${this._renderOptionSelector(ue,this._menuAlignments)} + ${this._renderNumberInput(he,{min:X})} + ${this._renderMenuButton("frigate")} + ${this._renderMenuButton("cameras")} + ${this._renderMenuButton("substreams")} + ${this._renderMenuButton("live")} + ${this._renderMenuButton("clips")} + ${this._renderMenuButton("snapshots")} + ${this._renderMenuButton("recordings")} + ${this._renderMenuButton("image")} + ${this._renderMenuButton("download")} + ${this._renderMenuButton("camera_ui")} + ${this._renderMenuButton("fullscreen")} + ${this._renderMenuButton("expand")} + ${this._renderMenuButton("timeline")} + ${this._renderMenuButton("media_player")} + ${this._renderMenuButton("microphone",o`${this._renderOptionSelector(`${R}.microphone.type`,this._microphoneButtonTypes,{label:l("config.menu.buttons.type")})}`)} + ${this._renderMenuButton("play")} + ${this._renderMenuButton("mute")} + ${this._renderMenuButton("screenshot")} + ${this._renderMenuButton("display_mode")} + ${this._renderMenuButton("ptz_controls")} + ${this._renderMenuButton("ptz_home")} +
+ `:""} + ${this._renderOptionSetHeader("status_bar")} + ${"status_bar"===this._expandedMenus[bi]?o` +
+ ${this._renderOptionSelector(_e,this._statusBarStyles)} + ${this._renderOptionSelector(ge,this._statusBarPositions)} + ${this._renderNumberInput(be,{min:pe,label:l("config.status_bar.height")})} + ${this._renderNumberInput(ve,{min:0,max:60,default:this._defaults.status_bar.popup_seconds,label:l("config.status_bar.popup_seconds")})} + ${this._renderStatusBarItem("title")} + ${this._renderStatusBarItem("resolution")} + ${this._renderStatusBarItem("technology")} + ${this._renderStatusBarItem("engine")} +
+ `:""} + ${this._renderOptionSetHeader("live")} + ${"live"===this._expandedMenus[bi]?o` +
+ ${this._renderSwitch(fe,this._defaults.live.preload)} + ${this._renderSwitch($e,this._defaults.live.draggable)} + ${this._renderSwitch(ye,this._defaults.live.zoomable)} + ${this._renderSwitch(we,this._defaults.live.lazy_load)} + ${this._renderOptionSelector(Se,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(xe,this._mediaActionPositiveConditions,{multiple:!0})} + ${this._renderOptionSelector(Me,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(Ie,this._mediaLiveMuteConditions,{multiple:!0})} + ${this._renderOptionSelector(ke,this._mediaLiveUnmuteConditions,{multiple:!0})} + ${this._renderOptionSelector(Oe,this._transitionEffects)} + ${this._renderSwitch(Ce,this._defaults.live.show_image_during_load)} + ${this._renderViewDisplay("live.display",ze,Ae,Ne,Te)} + ${this._putInSubmenu("live.controls",!0,"config.live.controls.editor_label","mdi:gamepad",o` + ${this._renderSwitch(Be,this._defaults.live.controls.builtin,{label:l("config.common.controls.builtin")})} + ${this._renderNextPreviousControls("live.controls.next_previous",Ee,Pe,{allowIcons:!0})} + ${this._renderThumbnailsControls("live.controls.thumbnails",He,Le,Ve,Ke,Ue,this._defaults.live.controls.thumbnails,{configPathMediaType:je,configPathEventsMediaType:qe,configPathMode:Re})} + ${this._renderMiniTimeline("live.controls.timeline",De,Fe,Ge,Je,Qe,We,this._defaults.live.controls.timeline.show_recordings,Xe)} + ${this._putInSubmenu("live.controls.ptz",!0,"config.live.controls.ptz.editor_label","mdi:pan",o` + ${this._renderOptionSelector(Ye,this._ptzModes)} + ${this._renderOptionSelector(Ze,this._ptzPositions)} + ${this._renderOptionSelector(ea,this._ptzOrientations)} + ${this._renderSwitch(aa,this._defaults.live.controls.ptz.hide_pan_tilt,{label:l("config.live.controls.ptz.hide_pan_tilt")})} + ${this._renderSwitch(ta,this._defaults.live.controls.ptz.hide_pan_tilt,{label:l("config.live.controls.ptz.hide_zoom")})} + ${this._renderSwitch(ia,this._defaults.live.controls.ptz.hide_home,{label:l("config.live.controls.ptz.hide_home")})} + `)} + `)} + ${this._putInSubmenu("live.microphone",!0,"config.live.microphone.editor_label","mdi:microphone",o` + ${this._renderNumberInput(na)} + ${this._renderSwitch(sa,this._defaults.live.microphone.always_connected)} + ${this._renderNumberInput(oa)} + `)} +
+ `:""} + ${this._renderOptionSetHeader("media_gallery")} + ${"media_gallery"===this._expandedMenus[bi]?o`
+ ${this._renderThumbnailsControls("media_gallery.controls.thumbnails",ra,la,ca,da,ma,this._defaults.media_gallery.controls.thumbnails)} + ${this._renderFilterControls("media_gallery.controls.filter",ua)} +
`:""} + ${this._renderOptionSetHeader("media_viewer")} + ${"media_viewer"===this._expandedMenus[bi]?o`
+ ${this._renderOptionSelector(ha,this._mediaActionPositiveConditions,{multiple:!0})} + ${this._renderOptionSelector(_a,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(ga,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(ba,this._mediaActionPositiveConditions,{multiple:!0})} + ${this._renderSwitch(pa,this._defaults.media_viewer.draggable)} + ${this._renderSwitch(va,this._defaults.media_viewer.zoomable)} + ${this._renderSwitch(fa,this._defaults.media_viewer.lazy_load)} + ${this._renderOptionSelector($a,this._transitionEffects)} + ${this._renderSwitch(ya,this._defaults.media_viewer.snapshot_click_plays_clip)} + ${this._renderViewDisplay("media_viewer.display",wa,Sa,xa,Ma)} + ${this._putInSubmenu("media_viewer.controls",!0,"config.media_viewer.controls.editor_label","mdi:gamepad",o` + ${this._renderSwitch(Ia,this._defaults.media_viewer.controls.builtin,{label:l("config.common.controls.builtin")})} + ${this._renderNextPreviousControls("media_viewer.controls.next_previous",ka,Oa,{allowThumbnails:!0})} + ${this._renderThumbnailsControls("media_viewer.controls.thumbnails",Ca,za,Aa,Na,Ta,this._defaults.media_viewer.controls.thumbnails,{configPathMode:Ba})} + ${this._renderMiniTimeline("media_viewer.controls.timeline",Ea,Pa,Ha,La,Va,Ka,this._defaults.media_viewer.controls.timeline.show_recordings,Ua)} + `)} +
`:""} + ${this._renderOptionSetHeader("image")} + ${"image"===this._expandedMenus[bi]?o`
+ ${this._renderImageOptions(ja,qa,Ra,Da,Fa)} +
`:""} + ${this._renderOptionSetHeader("timeline")} + ${"timeline"===this._expandedMenus[bi]?o`
+ ${this._renderTimelineCoreControls(F,G,J,Q,W,this._defaults.timeline.show_recordings)} + ${this._renderThumbnailsControls("timeline.controls.thumbnails",Ga,Ja,Qa,Wa,Xa,this._defaults.timeline.controls.thumbnails,{configPathMode:Ya})} +
`:""} + ${this._renderOptionSetHeader("dimensions")} + ${"dimensions"===this._expandedMenus[bi]?o`
+ ${this._renderOptionSelector(Za,this._aspectRatioModes)} + ${this._renderStringInput(et)} + ${this._renderStringInput(at)} +
`:""} + ${this._renderOptionSetHeader("performance","low"===b(this._config,ui)?"warning":void 0)} + ${"performance"===this._expandedMenus[bi]?o`
+ ${"low"===b(this._config,ui)?this._renderInfo(l("config.performance.warning")):o``} + ${this._putInSubmenu("performance.features",!0,"config.performance.features.editor_label","mdi:feature-search",o` + ${this._renderSwitch(tt,this._defaults.performance.features.animated_progress_indicator)} + ${this._renderNumberInput(it,{max:nt})} + ${this._renderNumberInput(st,{min:1})} + `)} + ${this._putInSubmenu("performance.style",!0,"config.performance.style.editor_label","mdi:palette-swatch-variant",o` + ${this._renderSwitch(ot,this._defaults.performance.style.border_radius)} + ${this._renderSwitch(rt,this._defaults.performance.style.box_shadow)} + `)} +
`:""} + ${void 0!==this._config.overrides?o` ${this._renderOptionSetHeader("overrides")} + ${"overrides"===this._expandedMenus[bi]?o`
+ ${this._renderInfo(l("config.overrides.info"))} +
`:""}`:o``} +
+ `}_closeMenu(e){delete this._expandedMenus[e],this.requestUpdate()}_openMenu(e,a){this._expandedMenus[e]=a,this.requestUpdate()}_toggleMenu(e){if(e&&e.target){const a=e.target.domain,t=e.target.key;this._expandedMenus[a]===t?this._closeMenu(a):this._openMenu(a,t)}}_valueChangedHandler(e,a){if(!this._config||!this.hass)return;let t;if(a.detail&&void 0!==a.detail.value&&(t=a.detail.value,"string"==typeof t&&(t=t.trim())),b(this._config,e)===t)return;const i=m(this._config);""===t||void 0===t?lt(i,e):ct(i,e,t),this._updateConfig(i)}static get styles(){return c('ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n.option {\n padding: 4px 4px;\n cursor: pointer;\n}\n\n.option.option-overrides .title {\n color: var(--warning-color);\n}\n\n.row {\n display: flex;\n margin-bottom: -14px;\n pointer-events: none;\n}\n\n.title {\n padding-left: 16px;\n margin-top: -6px;\n pointer-events: none;\n}\n\n.title.warning {\n color: var(--warning-color);\n}\n\n.secondary {\n padding-left: 40px;\n color: var(--secondary-text-color);\n pointer-events: none;\n}\n\n.values {\n background: var(--secondary-background-color);\n display: grid;\n}\n\n.values + .option,\n.submenu + .option {\n margin-top: 10px;\n}\n\ndiv.upgrade {\n width: auto;\n border: 1px dotted var(--primary-color);\n margin: 10px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\ndiv.upgrade span {\n padding: 10px;\n}\n\n.submenu-header {\n display: flex;\n padding: 10px;\n cursor: pointer;\n}\n\n.submenu.selected > .submenu-header {\n background-color: var(--primary-color);\n color: var(--primary-text-color);\n}\n\n.submenu-header * {\n flex-basis: auto;\n pointer-events: none;\n}\n\n.submenu-header .new-camera {\n font-style: italic;\n}\n\n.submenu:not(.selected) > .submenu-header .new-camera {\n color: var(--secondary-text-color, "black");\n}\n\n.submenu-header ha-icon,\n.submenu-header img {\n padding-right: 15px;\n}\n\n.submenu.selected {\n border: 1px solid var(--primary-color);\n}\n\n.submenu {\n width: calc(100% - 20px);\n margin-left: auto;\n margin-right: auto;\n margin-bottom: 10px;\n}\n\n.submenu:first-child,\n:not(.submenu) + .submenu {\n margin-top: 10px;\n}\n\n.submenu .controls {\n display: inline-block;\n margin-left: auto;\n margin-right: 0px;\n margin-bottom: 5px;\n}\n\n.submenu .controls ha-icon-button.button {\n --mdc-icon-button-size: 32px;\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n}\n\nspan.info {\n padding: 10px;\n}\n\nha-selector {\n padding: 10px;\n border: 1px solid var(--divider-color);\n}')}};t([i({attribute:!1})],vi.prototype,"hass",void 0),t([d()],vi.prototype,"_config",void 0),t([d()],vi.prototype,"_defaults",void 0),t([d()],vi.prototype,"_expandedMenus",void 0),vi=t([n("frigate-card-editor")],vi);export{vi as FrigateCardEditor}; diff --git a/config/www/community/frigate-hass-card/editor-13524f00.js.gz b/config/www/community/frigate-hass-card/editor-13524f00.js.gz new file mode 100644 index 00000000..d819494d Binary files /dev/null and b/config/www/community/frigate-hass-card/editor-13524f00.js.gz differ diff --git a/config/www/community/frigate-hass-card/editor-5368ad86.js b/config/www/community/frigate-hass-card/editor-5368ad86.js new file mode 100644 index 00000000..4ff4cb47 --- /dev/null +++ b/config/www/community/frigate-hass-card/editor-5368ad86.js @@ -0,0 +1,462 @@ +import{i as e,s as a,_ as t,n as i,t as n,a as s,x as o,e as r,l,r as c,b as d,c as m,d as u,p as h,f as _,g,h as b,j as p,k as v,C as f,m as $,o as y,q as w,u as S,v as x,w as M,y as I,z as k,A as O,B as C,D as z,E as A,F as N,G as T,H as B,I as E,J as P,K as H,L,M as V,N as K,O as U,P as j,Q as q,R,S as D,T as F,U as G,V as J,W as Q,X as W,Y as X,Z as Y,$ as Z,a0 as ee,a1 as ae,a2 as te,a3 as ie,a4 as ne,a5 as se,a6 as oe,a7 as re,a8 as le,a9 as ce,aa as de,ab as me,ac as ue,ad as he,ae as _e,af as ge,ag as be,ah as pe,ai as ve,aj as fe,ak as $e,al as ye,am as we,an as Se,ao as xe,ap as Me,aq as Ie,ar as ke,as as Oe,at as Ce,au as ze,av as Ae,aw as Ne,ax as Te,ay as Be,az as Ee,aA as Pe,aB as He,aC as Le,aD as Ve,aE as Ke,aF as Ue,aG as je,aH as qe,aI as Re,aJ as De,aK as Fe,aL as Ge,aM as Je,aN as Qe,aO as We,aP as Xe,aQ as Ye,aR as Ze,aS as ea,aT as aa,aU as ta,aV as ia,aW as na,aX as sa,aY as oa,aZ as ra,a_ as la,a$ as ca,b0 as da,b1 as ma,b2 as ua,b3 as ha,b4 as _a,b5 as ga,b6 as ba,b7 as pa,b8 as va,b9 as fa,ba as $a,bb as ya,bc as wa,bd as Sa,be as xa,bf as Ma,bg as Ia,bh as ka,bi as Oa,bj as Ca,bk as za,bl as Aa,bm as Na,bn as Ta,bo as Ba,bp as Ea,bq as Pa,br as Ha,bs as La,bt as Va,bu as Ka,bv as Ua,bw as ja,bx as qa,by as Ra,bz as Da,bA as Fa,bB as Ga,bC as Ja,bD as Qa,bE as Wa,bF as Xa,bG as Ya,bH as Za,bI as et,bJ as at,bK as tt,bL as it,bM as nt,bN as st,bO as ot,bP as rt,bQ as lt,bR as ct,bS as dt,bT as mt,bU as ut,bV as ht,bW as _t,bX as gt,bY as bt,bZ as pt,b_ as vt,b$ as ft,c0 as $t,c1 as yt,c2 as wt,c3 as St,c4 as xt,c5 as Mt,c6 as It,c7 as kt,c8 as Ot,c9 as Ct,ca as zt,cb as At,cc as Nt,cd as Tt,ce as Bt,cf as Et,cg as Pt,ch as Ht,ci as Lt,cj as Vt,ck as Kt,cl as Ut,cm as jt,cn as qt,co as Rt,cp as Dt,cq as Ft,cr as Gt,cs as Jt,ct as Qt,cu as Wt,cv as Xt,cw as Yt,cx as Zt,cy as ei,cz as ai,cA as ti,cB as ii,cC as ni,cD as si,cE as oi,cF as ri,cG as li,cH as ci,cI as di,cJ as mi,cK as ui}from"./card-45855f1f.js";class hi{constructor(e){this._assigning=!1,this._value=null,this._blurEventHandler=()=>{this._setAssigning(!1)},this._keydownEventHandler=e=>{e.key&&!["Control","Alt","Shift","Meta"].includes(e.key)&&(this.setValue({key:e.key,ctrl:e.ctrlKey,alt:e.altKey,shift:e.shiftKey,meta:e.metaKey}),this._setAssigning(!1))},this._host=e,this._host.addController(this)}setValue(a){e(a,this._value)||(this._value=a,this._host.requestUpdate(),this._host.dispatchEvent(new CustomEvent("value-changed",{detail:{value:this._value}})))}getValue(){return this._value}hasValue(){return!!this._value}isAssigning(){return this._assigning}toggleAssigning(){this._setAssigning(!this._assigning)}_setAssigning(e){this._assigning=e,a(this._host,this._assigning,"assigning"),this._assigning?this._host.addEventListener("keydown",this._keydownEventHandler):this._host.removeEventListener("keydown",this._keydownEventHandler),this._host.requestUpdate()}hostConnected(){this._host.addEventListener("blur",this._blurEventHandler)}hostDisconnected(){this._host.removeEventListener("blur",this._blurEventHandler)}}let _i=class extends s{constructor(){super(...arguments),this._controller=new hi(this)}willUpdate(e){e.has("value")&&this._controller.setValue(this.value??null)}render(){if(!this.label)return;const e=e=>o`
+
${e}
+
`;return o` +
${this.label}
+ {this._controller.toggleAssigning()}} + > + + + ${this._controller.isAssigning()?l("key_assigner.assigning"):l("key_assigner.assign")} + + + ${this._controller.hasValue()?o`{this._controller.setValue(null)}} + > + + ${l("key_assigner.unassign")} + `:""} +
+ ${this.value?.ctrl?e(l("key_assigner.modifiers.ctrl")):""} + ${this.value?.shift?e(l("key_assigner.modifiers.shift")):""} + ${this.value?.meta?e(l("key_assigner.modifiers.meta")):""} + ${this.value?.alt?e(l("key_assigner.modifiers.alt")):""} + ${this.value?.key?e(this.value.key):""} +
+ `}static get styles(){return c('.dotdotdot:after {\n animation: dots 2s linear infinite;\n content: "";\n display: inline-block;\n width: 3em;\n}\n@keyframes dots {\n 0%, 20% {\n content: ".";\n }\n 40% {\n content: "..";\n }\n 60% {\n content: "...";\n }\n 90%, 100% {\n content: "";\n }\n}\n\n:host {\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 10px;\n height: 56px;\n border: 1px solid var(--divider-color);\n}\n\n:host([assigning]) ha-button.assign span,\n:host([assigning]) ha-button.assign ha-icon {\n color: var(--warning-color);\n}\n\nha-icon {\n padding: 10px;\n}\n\ndiv.label {\n width: 100px;\n margin-left: 4px;\n}\n\ndiv.key-row {\n flex: 1;\n display: flex;\n justify-content: center;\n align-items: center;\n padding-left: 10px;\n padding-right: 10px;\n}\n\ndiv.key {\n display: flex;\n align-items: center;\n height: 90%;\n width: min-content;\n margin-left: 5px;\n margin-right: 5px;\n}\n\ndiv.key-inner {\n height: 100%;\n width: 100%;\n padding-top: 2px;\n padding-bottom: 2px;\n padding-left: 4px;\n padding-right: 4px;\n border: 2px;\n border-radius: 4px;\n border-style: outset;\n border-color: var(--divider-color);\n font-family: monospace;\n text-transform: capitalize;\n}\n\ndiv.unassigned {\n font-style: italic;\n}\n\ndiv.key + div.key:before {\n display: flex;\n align-items: center;\n margin-right: 5px;\n content: " + ";\n}')}};t([i({attribute:!1})],_i.prototype,"label",void 0),t([i({attribute:!1})],_i.prototype,"value",void 0),_i=t([n("frigate-card-key-assigner")],_i);const gi="cameras",bi="options",pi={cameras:{icon:"video",name:l("editor.cameras"),secondary:l("editor.cameras_secondary")},view:{icon:"eye",name:l("editor.view"),secondary:l("editor.view_secondary")},menu:{icon:"menu",name:l("editor.menu"),secondary:l("editor.menu_secondary")},status_bar:{icon:"sign-text",name:l("editor.status_bar"),secondary:l("editor.status_bar_secondary")},live:{icon:"cctv",name:l("editor.live"),secondary:l("editor.live_secondary")},media_gallery:{icon:"grid",name:l("editor.media_gallery"),secondary:l("editor.media_gallery_secondary")},media_viewer:{icon:"filmstrip",name:l("editor.media_viewer"),secondary:l("editor.media_viewer_secondary")},image:{icon:"image",name:l("editor.image"),secondary:l("editor.image_secondary")},timeline:{icon:"chart-gantt",name:l("editor.timeline"),secondary:l("editor.timeline_secondary")},dimensions:{icon:"aspect-ratio",name:l("editor.dimensions"),secondary:l("editor.dimensions_secondary")},performance:{icon:"speedometer",name:l("editor.performance"),secondary:l("editor.performance_secondary")},profiles:{icon:"folder-wrench-outline",name:l("editor.profiles"),secondary:l("editor.profiles_secondary")},overrides:{icon:"file-replace",name:l("editor.overrides"),secondary:l("editor.overrides_secondary")}};let vi=class extends s{constructor(){super(...arguments),this._defaults=m(di),this._initialized=!1,this._configUpgradeable=!1,this._expandedMenus={},this._viewModes=[{value:"",label:""},{value:"live",label:l("config.view.views.live")},{value:"clips",label:l("config.view.views.clips")},{value:"snapshots",label:l("config.view.views.snapshots")},{value:"recordings",label:l("config.view.views.recordings")},{value:"clip",label:l("config.view.views.clip")},{value:"snapshot",label:l("config.view.views.snapshot")},{value:"recording",label:l("config.view.views.recording")},{value:"image",label:l("config.view.views.image")},{value:"timeline",label:l("config.view.views.timeline")}],this._cameraSelectViewModes=[...this._viewModes,{value:"current",label:l("config.view.views.current")}],this._filterModes=[{value:"",label:""},{value:"none",label:l("config.common.controls.filter.modes.none")},{value:"left",label:l("config.common.controls.filter.modes.left")},{value:"right",label:l("config.common.controls.filter.modes.right")}],this._menuStyles=[{value:"",label:""},{value:"none",label:l("config.menu.styles.none")},{value:"hidden",label:l("config.menu.styles.hidden")},{value:"overlay",label:l("config.menu.styles.overlay")},{value:"hover",label:l("config.menu.styles.hover")},{value:"hover-card",label:l("config.menu.styles.hover-card")},{value:"outside",label:l("config.menu.styles.outside")}],this._menuPositions=[{value:"",label:""},{value:"left",label:l("config.menu.positions.left")},{value:"right",label:l("config.menu.positions.right")},{value:"top",label:l("config.menu.positions.top")},{value:"bottom",label:l("config.menu.positions.bottom")}],this._menuAlignments=[{value:"",label:""},{value:"left",label:l("config.menu.alignments.left")},{value:"right",label:l("config.menu.alignments.right")},{value:"top",label:l("config.menu.alignments.top")},{value:"bottom",label:l("config.menu.alignments.bottom")}],this._nextPreviousControlStyles=[{value:"",label:""},{value:"chevrons",label:l("config.common.controls.next_previous.styles.chevrons")},{value:"icons",label:l("config.common.controls.next_previous.styles.icons")},{value:"none",label:l("config.common.controls.next_previous.styles.none")},{value:"thumbnails",label:l("config.common.controls.next_previous.styles.thumbnails")}],this._aspectRatioModes=[{value:"",label:""},{value:"dynamic",label:l("config.dimensions.aspect_ratio_modes.dynamic")},{value:"static",label:l("config.dimensions.aspect_ratio_modes.static")},{value:"unconstrained",label:l("config.dimensions.aspect_ratio_modes.unconstrained")}],this._thumbnailModes=[{value:"",label:""},{value:"none",label:l("config.common.controls.thumbnails.modes.none")},{value:"above",label:l("config.common.controls.thumbnails.modes.above")},{value:"below",label:l("config.common.controls.thumbnails.modes.below")},{value:"left",label:l("config.common.controls.thumbnails.modes.left")},{value:"right",label:l("config.common.controls.thumbnails.modes.right")}],this._thumbnailMediaTypes=[{value:"",label:""},{value:"events",label:l("config.common.controls.thumbnails.media_types.events")},{value:"recordings",label:l("config.common.controls.thumbnails.media_types.recordings")}],this._thumbnailEventsMediaTypes=[{value:"",label:""},{value:"clips",label:l("config.common.controls.thumbnails.events_media_types.clips")},{value:"snapshots",label:l("config.common.controls.thumbnails.events_media_types.snapshots")}],this._transitionEffects=[{value:"",label:""},{value:"none",label:l("config.media_viewer.transition_effects.none")},{value:"slide",label:l("config.media_viewer.transition_effects.slide")}],this._imageModes=[{value:"",label:""},{value:"camera",label:l("config.common.image.modes.camera")},{value:"entity",label:l("config.common.image.modes.entity")},{value:"screensaver",label:l("config.common.image.modes.screensaver")},{value:"url",label:l("config.common.image.modes.url")}],this._timelineEventsMediaTypes=[{value:"",label:""},{value:"all",label:l("config.common.timeline.events_media_types.all")},{value:"clips",label:l("config.common.timeline.events_media_types.clips")},{value:"snapshots",label:l("config.common.timeline.events_media_types.snapshots")}],this._timelineStyleTypes=[{value:"",label:""},{value:"ribbon",label:l("config.common.timeline.styles.ribbon")},{value:"stack",label:l("config.common.timeline.styles.stack")}],this._darkModes=[{value:"",label:""},{value:"on",label:l("config.view.dark_modes.on")},{value:"off",label:l("config.view.dark_modes.off")},{value:"auto",label:l("config.view.dark_modes.auto")}],this._mediaActionNegativeConditions=[{value:"",label:""},{value:"unselected",label:l("config.common.media_action_conditions.unselected")},{value:"hidden",label:l("config.common.media_action_conditions.hidden")}],this._mediaActionPositiveConditions=[{value:"",label:""},{value:"selected",label:l("config.common.media_action_conditions.selected")},{value:"visible",label:l("config.common.media_action_conditions.visible")}],this._mediaLiveUnmuteConditions=[...this._mediaActionPositiveConditions,{value:"microphone",label:l("config.common.media_action_conditions.microphone_unmute")}],this._mediaLiveMuteConditions=[...this._mediaActionNegativeConditions,{value:"microphone",label:l("config.common.media_action_conditions.microphone_mute")}],this._layoutFits=[{value:"",label:""},{value:"contain",label:l("config.cameras.dimensions.layout.fits.contain")},{value:"cover",label:l("config.cameras.dimensions.layout.fits.cover")},{value:"fill",label:l("config.cameras.dimensions.layout.fits.fill")}],this._miniTimelineModes=[{value:"",label:""},{value:"none",label:l("config.common.controls.timeline.modes.none")},{value:"above",label:l("config.common.controls.timeline.modes.above")},{value:"below",label:l("config.common.controls.timeline.modes.below")}],this._profiles=[{value:"",label:""},{value:"casting",label:l("config.profiles.casting")},{value:"low-performance",label:l("config.profiles.low-performance")},{value:"scrubbing",label:l("config.profiles.scrubbing")}],this._go2rtcModes=[{value:"",label:""},{value:"mse",label:l("config.cameras.go2rtc.modes.mse")},{value:"webrtc",label:l("config.cameras.go2rtc.modes.webrtc")},{value:"mp4",label:l("config.cameras.go2rtc.modes.mp4")},{value:"mjpeg",label:l("config.cameras.go2rtc.modes.mjpeg")}],this._microphoneButtonTypes=[{value:"",label:""},{value:"momentary",label:l("config.menu.buttons.types.momentary")},{value:"toggle",label:l("config.menu.buttons.types.toggle")}],this._displayModes=[{value:"",label:""},{value:"single",label:l("display_modes.single")},{value:"grid",label:l("display_modes.grid")}],this._castMethods=[{value:"",label:""},{value:"standard",label:l("config.cameras.cast.methods.standard")},{value:"dashboard",label:l("config.cameras.cast.methods.dashboard")}],this._ptzModes=[{value:"",label:""},{value:"on",label:l("config.live.controls.ptz.modes.on")},{value:"off",label:l("config.live.controls.ptz.modes.off")}],this._ptzOrientations=[{value:"",label:""},{value:"vertical",label:l("config.live.controls.ptz.orientations.vertical")},{value:"horizontal",label:l("config.live.controls.ptz.orientations.horizontal")}],this._ptzPositions=[{value:"",label:""},{value:"top-left",label:l("config.live.controls.ptz.positions.top-left")},{value:"top-right",label:l("config.live.controls.ptz.positions.top-right")},{value:"bottom-left",label:l("config.live.controls.ptz.positions.bottom-left")},{value:"bottom-right",label:l("config.live.controls.ptz.positions.bottom-right")}],this._triggersActionsInteractionModes=[{value:"",label:""},{value:"all",label:l("config.view.triggers.actions.interaction_modes.all")},{value:"inactive",label:l("config.view.triggers.actions.interaction_modes.inactive")},{value:"active",label:l("config.view.triggers.actions.interaction_modes.active")}],this._triggersActionsTrigger=[{value:"",label:""},{value:"default",label:l("config.view.triggers.actions.triggers.default")},{value:"live",label:l("config.view.triggers.actions.triggers.live")},{value:"media",label:l("config.view.triggers.actions.triggers.media")},{value:"none",label:l("config.view.triggers.actions.triggers.none")}],this._triggersActionsUntrigger=[{value:"",label:""},{value:"default",label:l("config.view.triggers.actions.untriggers.default")},{value:"none",label:l("config.view.triggers.actions.untriggers.none")}],this._triggersEvents=[{value:"",label:""},{value:"events",label:l("config.cameras.triggers.events.events")},{value:"clips",label:l("config.cameras.triggers.events.clips")},{value:"snapshots",label:l("config.cameras.triggers.events.snapshots")}],this._timelinePanModes=[{value:"",label:""},{value:"pan",label:l("config.common.controls.timeline.pan_modes.pan")},{value:"seek",label:l("config.common.controls.timeline.pan_modes.seek")},{value:"seek-in-media",label:l("config.common.controls.timeline.pan_modes.seek-in-media")},{value:"seek-in-camera",label:l("config.common.controls.timeline.pan_modes.seek-in-camera")}],this._capabilities=[{value:"",label:""},{value:"live",label:l("config.cameras.capabilities.capabilities.live")},{value:"substream",label:l("config.cameras.capabilities.capabilities.substream")},{value:"clips",label:l("config.cameras.capabilities.capabilities.clips")},{value:"recordings",label:l("config.cameras.capabilities.capabilities.recordings")},{value:"snapshots",label:l("config.cameras.capabilities.capabilities.snapshots")},{value:"favorite-events",label:l("config.cameras.capabilities.capabilities.favorite-events")},{value:"favorite-recordings",label:l("config.cameras.capabilities.capabilities.favorite-recordings")},{value:"seek",label:l("config.cameras.capabilities.capabilities.seek")},{value:"ptz",label:l("config.cameras.capabilities.capabilities.ptz")},{value:"menu",label:l("config.cameras.capabilities.capabilities.menu")}],this._defaultResetInteractionModes=[{value:"",label:""},{value:"all",label:l("config.view.default_reset.interaction_modes.all")},{value:"inactive",label:l("config.view.default_reset.interaction_modes.inactive")},{value:"active",label:l("config.view.default_reset.interaction_modes.active")}],this._proxyMedia=[{value:"",label:""},{value:"auto",label:l("config.cameras.proxy.media.auto")},{value:!0,label:l("config.cameras.proxy.media.true")},{value:!1,label:l("config.cameras.proxy.media.false")}],this._proxySSLCiphers=[{value:"",label:""},{value:"auto",label:l("config.cameras.proxy.ssl_ciphers.auto")},{value:"default",label:l("config.cameras.proxy.ssl_ciphers.default")},{value:"insecure",label:l("config.cameras.proxy.ssl_ciphers.insecure")},{value:"intermediate",label:l("config.cameras.proxy.ssl_ciphers.intermediate")},{value:"modern",label:l("config.cameras.proxy.ssl_ciphers.modern")}],this._proxySSLVerification=[{value:"",label:""},{value:"auto",label:l("config.cameras.proxy.ssl_verification.auto")},{value:!0,label:l("config.cameras.proxy.ssl_verification.true")},{value:!1,label:l("config.cameras.proxy.ssl_verification.false")}],this._reolinkMediaResolution=[{value:"",label:""},{value:"high",label:l("config.cameras.reolink.media_resolution.high")},{value:"low",label:l("config.cameras.reolink.media_resolution.low")}],this._statusBarStyles=[{value:"",label:""},{value:"hover",label:l("config.status_bar.styles.hover")},{value:"hover-card",label:l("config.status_bar.styles.hover-card")},{value:"none",label:l("config.status_bar.styles.none")},{value:"outside",label:l("config.status_bar.styles.outside")},{value:"overlay",label:l("config.status_bar.styles.overlay")},{value:"popup",label:l("config.status_bar.styles.popup")}],this._statusBarPositions=[{value:"",label:""},{value:"top",label:l("config.status_bar.positions.top")},{value:"bottom",label:l("config.status_bar.positions.bottom")}]}setConfig(e){this._config=e,this._configUpgradeable=u(e);const a=h.safeParse(this._config.profiles);if(a.success){const e=m(di);_(this._config,e,a.data),this._defaults=e}}willUpdate(){this._initialized||g().then((e=>{e&&(this._initialized=!0)}))}_renderOptionSetHeader(e,a){const t=pi[e];return o` +
+
+ +
${t.name}
+
+
${t.secondary}
+
+ `}_getLabel(e){const a=e.split(".").filter((e=>!e.match(/^\[[0-9]+\]$/))).join(".");return l(`config.${a}`)}_renderEntitySelector(e,a){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderOptionSelector(e,a=[],t){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderIconSelector(e,a){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderNumberInput(e,a){if(!this._config)return;const t=b(this._config,e),i=void 0===a?.max?"box":"slider";return o` + this._valueChangedHandler(e,a)} + > + + `}_renderInfo(e){return o` ${e}`}_getEditorCameraTitle(e,a){return"string"==typeof a?.title&&a.title||("string"==typeof a?.camera_entity?p(this.hass,a.camera_entity):"")||"object"==typeof a?.webrtc_card&&a.webrtc_card&&"string"==typeof a.webrtc_card.entity&&a.webrtc_card.entity||("object"==typeof a?.frigate&&a.frigate&&"string"==typeof a?.frigate.camera_name&&a.frigate.camera_name?v(a.frigate.camera_name):"")||"string"==typeof a?.id&&a.id||l("editor.camera")+" #"+e}_renderViewDefaultResetMenu(){return this._putInSubmenu("view.default_reset",!0,`config.${f}.editor_label`,"mdi:restart",o` + ${this._renderSwitch($,this._defaults.view.default_reset.after_interaction)} + ${this._renderNumberInput(y)} + ${this._renderOptionSelector(w,this._defaultResetInteractionModes,{label:l("config.view.default_reset.interaction_mode")})}, + ${this._renderOptionSelector(S,this.hass?x(this.hass):[],{multiple:!0})} + `)}_renderViewTriggersMenu(){return this._putInSubmenu("view.triggers",!0,`config.${M}.editor_label`,"mdi:target-account",o` + ${this._renderSwitch(I,this._defaults.view.triggers.filter_selected_camera,{label:l(`config.${I}`)})} + ${this._renderSwitch(k,this._defaults.view.triggers.show_trigger_status,{label:l(`config.${k}`)})} + ${this._renderNumberInput(O,{default:this._defaults.view.triggers.untrigger_seconds})} + ${this._putInSubmenu("view.triggers.actions",!0,`config.${C}.editor_label`,"mdi:cogs",o` ${this._renderOptionSelector(z,this._triggersActionsTrigger,{label:l("config.view.triggers.actions.trigger")})} + ${this._renderOptionSelector(A,this._triggersActionsUntrigger,{label:l("config.view.triggers.actions.untrigger")})} + ${this._renderOptionSelector(N,this._triggersActionsInteractionModes,{label:l("config.view.triggers.actions.interaction_mode")})}`)} + `)}_renderKeyAssigner(e,a){return o` this._valueChangedHandler(e,a)} + >`}_renderViewKeyboardShortcutMenu(){return this._putInSubmenu("view.keyboard_shortcuts",!0,`config.${T}.editor_label`,"mdi:keyboard",o` + ${this._renderSwitch(B,this._defaults.view.keyboard_shortcuts.enabled,{label:l(`config.${B}`)})} + ${this._renderKeyAssigner(E,this._defaults.view.keyboard_shortcuts.ptz_left)} + ${this._renderKeyAssigner(P,this._defaults.view.keyboard_shortcuts.ptz_right)} + ${this._renderKeyAssigner(H,this._defaults.view.keyboard_shortcuts.ptz_up)} + ${this._renderKeyAssigner(L,this._defaults.view.keyboard_shortcuts.ptz_down)} + ${this._renderKeyAssigner(V,this._defaults.view.keyboard_shortcuts.ptz_zoom_in)} + ${this._renderKeyAssigner(K,this._defaults.view.keyboard_shortcuts.ptz_zoom_out)} + ${this._renderKeyAssigner(U,this._defaults.view.keyboard_shortcuts.ptz_home)} + `)}_renderStatusBarItem(e){return o` ${this._putInSubmenu("status_bar.items",e,`config.status_bar.items.${e}`,"mdi:feature-search",o` + ${this._renderSwitch(`${j}.${e}.enabled`,this._defaults.status_bar.items[e]?.enabled??!0,{label:l("config.status_bar.items.enabled")})} + ${this._renderNumberInput(`${j}.${e}.priority`,{max:q,default:this._defaults.status_bar.items[e]?.priority,label:l("config.status_bar.items.priority")})} + `)}`}_renderMenuButton(e,a){const t=[{value:"",label:""},{value:"matching",label:l("config.menu.buttons.alignments.matching")},{value:"opposing",label:l("config.menu.buttons.alignments.opposing")}];return o` ${this._putInSubmenu("menu.buttons",e,`config.menu.buttons.${e}`,"mdi:gesture-tap-button",o` + ${this._renderSwitch(`${R}.${e}.enabled`,this._defaults.menu.buttons[e]?.enabled??!0,{label:l("config.menu.buttons.enabled")})} + ${this._renderOptionSelector(`${R}.${e}.alignment`,t,{label:l("config.menu.buttons.alignment")})} + ${this._renderSwitch(`${R}.${e}.permanent`,this._defaults.menu.buttons[e]?.permanent??!1,{label:l("config.menu.buttons.permanent")})} + ${this._renderNumberInput(`${R}.${e}.priority`,{max:D,default:this._defaults.menu.buttons[e]?.priority,label:l("config.menu.buttons.priority")})} + ${this._renderIconSelector(`${R}.${e}.icon`,{label:l("config.menu.buttons.icon")})} + ${a} + `)}`}_putInSubmenu(e,a,t,i,n){const s=this._expandedMenus[e]===a,c={submenu:!0,selected:s},d=dt(i);return o`
+ + ${s?o`
${n}
`:""} +
`}_renderMediaLayout(e,a,t,i,n,s,r,c,d,m,u,h){return this._putInSubmenu(e,!0,a,"mdi:page-layout-body",o` + ${this._renderNumberInput(m,{min:0,max:10,label:l("config.cameras.dimensions.layout.zoom"),step:.1})} + ${this._renderNumberInput(u,{min:0,max:100,label:l("config.cameras.dimensions.layout.pan.x")})} + ${this._renderNumberInput(h,{min:0,max:100,label:l("config.cameras.dimensions.layout.pan.y")})} + ${this._renderOptionSelector(t,this._layoutFits,{label:l("config.cameras.dimensions.layout.fit")})} + ${this._putInSubmenu(`${e}.position`,!0,"config.cameras.dimensions.layout.position.editor_label","mdi:aspect-ratio",o` ${this._renderNumberInput(i,{min:0,max:100,label:l("config.cameras.dimensions.layout.position.x")})} + ${this._renderNumberInput(n,{min:0,max:100,label:l("config.cameras.dimensions.layout.position.y")})}`)} + ${this._putInSubmenu(`${e}.view_box`,!0,"config.cameras.dimensions.layout.view_box.editor_label","mdi:crop",o` + ${this._renderNumberInput(s,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.top")})} + ${this._renderNumberInput(r,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.bottom")})} + ${this._renderNumberInput(c,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.left")})} + ${this._renderNumberInput(d,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.right")})} + `)} + `)}_renderTimelineCoreControls(e,a,t,i,n,s,r){return o` + ${this._renderOptionSelector(e,this._timelineStyleTypes,{label:l(`config.common.${F}`)})} + ${r?this._renderOptionSelector(r,this._timelinePanModes,{label:l("config.common.controls.timeline.pan_mode")}):""} + ${this._renderNumberInput(a,{label:l(`config.common.${G}`)})} + ${this._renderNumberInput(t,{label:l(`config.common.${J}`)})} + ${this._renderOptionSelector(i,this._timelineEventsMediaTypes,{label:l(`config.common.${Q}`)})} + ${this._renderSwitch(n,s,{label:l(`config.common.${W}`)})} + `}_renderMiniTimeline(e,a,t,i,n,s,r,c,d){return this._putInSubmenu(e,!0,"config.common.controls.timeline.editor_label","mdi:chart-gantt",o` ${this._renderOptionSelector(a,this._miniTimelineModes,{label:l("config.common.controls.timeline.mode")})} + ${this._renderTimelineCoreControls(t,i,n,s,r,c,d)}`)}_renderViewDisplay(e,a,t,i,n){return this._putInSubmenu(e,!0,"config.common.display.editor_label","mdi:palette-swatch",o` + ${this._renderOptionSelector(a,this._displayModes,{label:l("config.common.display.mode")})} + ${this._renderNumberInput(t,{min:0,label:l("config.common.display.grid_selected_width_factor")})} + ${this._renderNumberInput(i,{min:0,label:l("config.common.display.grid_columns")})} + ${this._renderNumberInput(n,{min:0,label:l("config.common.display.grid_max_columns")})} + `)}_renderNextPreviousControls(e,a,t,i){return this._putInSubmenu(e,!0,"config.common.controls.next_previous.editor_label","mdi:arrow-right-bold-circle",o` + ${this._renderOptionSelector(a,this._nextPreviousControlStyles.filter((e=>!(!i?.allowThumbnails&&"thumbnails"===e.value||!i?.allowIcons&&"icons"===e.value))),{label:l("config.common.controls.next_previous.style")})} + ${this._renderNumberInput(t,{min:X,label:l("config.common.controls.next_previous.size")})} + `)}_renderThumbnailsControls(e,a,t,i,n,s,r,c){return this._putInSubmenu(e,!0,"config.common.controls.thumbnails.editor_label","mdi:image-text",o` + ${c?.configPathMode?o`${this._renderOptionSelector(c.configPathMode,this._thumbnailModes,{label:l("config.common.controls.thumbnails.mode")})}`:o``} + ${c?.configPathMediaType?o`${this._renderOptionSelector(c.configPathMediaType,this._thumbnailMediaTypes,{label:l("config.common.controls.thumbnails.media_type")})}`:o``} + ${c?.configPathEventsMediaType?o`${this._renderOptionSelector(c.configPathEventsMediaType,this._thumbnailEventsMediaTypes,{label:l("config.common.controls.thumbnails.events_media_type")})}`:o``} + ${this._renderNumberInput(a,{min:Y,max:Z,label:l("config.common.controls.thumbnails.size")})} + ${this._renderSwitch(t,r.show_details,{label:l("config.common.controls.thumbnails.show_details")})} + ${this._renderSwitch(i,r.show_favorite_control,{label:l("config.common.controls.thumbnails.show_favorite_control")})} + ${this._renderSwitch(n,r.show_timeline_control,{label:l("config.common.controls.thumbnails.show_timeline_control")})} + ${this._renderSwitch(s,r.show_download_control,{label:l("config.common.controls.thumbnails.show_download_control")})} + `)}_renderFilterControls(e,a){return this._putInSubmenu(e,!0,"config.common.controls.filter.editor_label","mdi:filter-cog",o` + ${a?o`${this._renderOptionSelector(a,this._filterModes,{label:l("config.common.controls.filter.mode")})}`:o``} + `)}_renderImageOptions(e,a,t,i,n){return o` + ${this._renderOptionSelector(e,this._imageModes,{label:l("config.common.image.mode")})} + ${this._renderStringInput(a,{label:l("config.common.image.url")})} + ${this._renderOptionSelector(t,this.hass?x(this.hass):[],{label:l("config.common.image.entity")})} + ${this._renderStringInput(i,{label:l("config.common.image.entity_parameters")})} + ${this._renderNumberInput(n,{label:l("config.common.image.refresh_seconds")})} + `}_renderCamera(e,a,t,i){const n=[{value:"",label:""},{value:"auto",label:l("config.cameras.live_providers.auto")},{value:"ha",label:l("config.cameras.live_providers.ha")},{value:"image",label:l("config.cameras.live_providers.image")},{value:"jsmpeg",label:l("config.cameras.live_providers.jsmpeg")},{value:"go2rtc",label:l("config.cameras.live_providers.go2rtc")},{value:"webrtc-card",label:l("config.cameras.live_providers.webrtc-card")}],s=[];e.forEach(((e,t)=>{t!==a&&s.push({value:ee(e),label:this._getEditorCameraTitle(t,e)})}));const c=e=>{if(this._config){const a=m(this._config);e(a)&&this._updateConfig(a)}},d={submenu:!0,selected:this._expandedMenus[gi]===a};return o` +
+ + ${this._expandedMenus[gi]===a?o`
+
+ !i&&c((e=>!!(Array.isArray(e.cameras)&&a>0)&&(mt(e.cameras,a,a-1),this._openMenu(gi,a-1),!0)))} + > + + + =this._config.cameras.length-1} + @click=${()=>!i&&c((e=>!!(Array.isArray(e.cameras)&&a + + + {c((e=>!!Array.isArray(e.cameras)&&(e.cameras.splice(a,1),this._closeMenu(gi),!0)))}} + > + + +
+ ${this._renderEntitySelector(ae(ut,a),"camera")} + ${this._renderOptionSelector(ae(ht,a),n)} + ${this._renderStringInput(ae(_t,a))} + ${this._renderIconSelector(ae(gt,a),{label:l("config.cameras.icon")})} + ${this._renderStringInput(ae(bt,a))} + ${this._putInSubmenu("cameras.engine",!0,"config.cameras.engines.editor_label","mdi:engine",o`${this._putInSubmenu("cameras.frigate",a,"config.cameras.frigate.editor_label","frigate",o` + ${this._renderStringInput(ae(pt,a))} + ${this._renderStringInput(ae(vt,a))} + ${this._renderOptionSelector(ae(ft,a),[],{multiple:!0,label:l("config.cameras.frigate.labels")})} + ${this._renderOptionSelector(ae($t,a),[],{multiple:!0,label:l("config.cameras.frigate.zones")})} + ${this._renderStringInput(ae(yt,a))} + `)} + ${this._putInSubmenu("cameras.motioneye",a,"config.cameras.motioneye.editor_label","motioneye",o` ${this._renderStringInput(ae(wt,a))} + ${this._renderStringInput(ae(St,a))} + ${this._renderStringInput(ae(xt,a))} + ${this._renderStringInput(ae(Mt,a))} + ${this._renderStringInput(ae(It,a))}`)} + ${this._putInSubmenu("cameras.reolink",a,"config.cameras.reolink.editor_label","reolink",o` ${this._renderStringInput(ae(kt,a))} + ${this._renderOptionSelector(ae(Ot,a),this._reolinkMediaResolution,{label:l("config.cameras.reolink.media_resolution.editor_label")})}`)}`)} + ${this._putInSubmenu("cameras.live_provider",!0,"config.cameras.live_provider_options.editor_label","mdi:cctv",o` ${this._putInSubmenu("cameras.go2rtc",a,"config.cameras.go2rtc.editor_label","mdi:alpha-g-circle",o`${this._renderOptionSelector(ae(Ct,a),this._go2rtcModes,{multiple:!0,label:l("config.cameras.go2rtc.modes.editor_label")})} + ${this._renderStringInput(ae(zt,a))}`)} + ${this._putInSubmenu("cameras.image",!0,"config.cameras.image.editor_label","mdi:image",this._renderImageOptions(ae(At,a),ae(Nt,a),ae(Tt,a),ae(Bt,a),ae(Et,a)))} + ${this._putInSubmenu("cameras.webrtc_card",a,"config.cameras.webrtc_card.editor_label","mdi:webrtc",o`${this._renderEntitySelector(ae(Pt,a),"camera")} + ${this._renderStringInput(ae(Ht,a))}`)}`)} + ${this._putInSubmenu("cameras.dependencies",a,"config.cameras.dependencies.editor_label","mdi:graph",o` ${this._renderSwitch(ae(Lt,a),this._defaults.cameras.dependencies.all_cameras)} + ${this._renderOptionSelector(ae(Vt,a),s,{multiple:!0})}`)} + ${this._putInSubmenu("cameras.triggers",a,"config.cameras.triggers.editor_label","mdi:magnify-scan",o` + ${this._renderSwitch(ae(Kt,a),this._defaults.cameras.triggers.occupancy)} + ${this._renderSwitch(ae(Ut,a),this._defaults.cameras.triggers.motion)} + ${this._renderOptionSelector(ae(jt,a),t,{multiple:!0})} + ${this._renderOptionSelector(ae(qt,a),this._triggersEvents,{multiple:!0,label:l("config.cameras.triggers.events.editor_label")})} + `)} + ${this._putInSubmenu("cameras.cast",a,"config.cameras.cast.editor_label","mdi:cast",o` + ${this._renderOptionSelector(ae(Rt,a),this._castMethods)} + ${this._renderStringInput(ae(Dt,a))} + ${this._renderStringInput(ae(Ft,a))} + `)} + ${this._putInSubmenu("cameras.dimensions",a,"config.cameras.dimensions.editor_label","mdi:aspect-ratio",o` + ${this._renderStringInput(ae(Gt,a))} + ${this._renderMediaLayout("cameras.dimensions.layout","config.cameras.dimensions.layout.editor_label",ae(Jt,a),ae(Qt,a),ae(Wt,a),ae(Xt,a),ae(Yt,a),ae(Zt,a),ae(ei,a),ae(ai,a),ae(ti,a),ae(ii,a))} + `)} + ${this._putInSubmenu("cameras.capabilities",a,"config.cameras.capabilities.editor_label","mdi:cog-stop",o` + ${this._renderOptionSelector(ae(ni,a),this._capabilities,{multiple:!0})} + ${this._renderOptionSelector(ae(si,a),this._capabilities,{multiple:!0})} + `)} + ${this._putInSubmenu("cameras.proxy",a,"config.cameras.proxy.editor_label","mdi:arrow-decision",o` + ${this._renderOptionSelector(ae(oi,a),this._proxyMedia,{label:l("config.cameras.proxy.media.editor_label")})} + ${this._renderSwitch(ae(ri,a),this._defaults.cameras.proxy.dynamic)} + ${this._renderOptionSelector(ae(li,a),this._proxySSLVerification,{label:l("config.cameras.proxy.ssl_verification.editor_label")})} + ${this._renderOptionSelector(ae(ci,a),this._proxySSLCiphers,{label:l("config.cameras.proxy.ssl_ciphers.editor_label")})} + `)} +
`:""} +
+ `}_renderStringInput(e,a){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderSwitch(e,a,t){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_updateConfig(e){this._config=e,te(this,"config-changed",{config:this._config})}render(){if(!this.hass||!this._config)return o``;const e=x(this.hass),a=b(this._config,mi)||[];return o` + ${this._configUpgradeable?o`
+ ${l("editor.upgrade_available")} + + {if(this._config){const e=m(this._config);ie(e),this._updateConfig(e)}}} + > + + +
+
`:o``} +
+ ${this._renderOptionSetHeader("cameras")} + ${"cameras"===this._expandedMenus[bi]?o` +
+ ${a.map(((t,i)=>this._renderCamera(a,i,e)))} + ${this._renderCamera(a,a.length,e,!0)} +
+ `:""} + ${this._renderOptionSetHeader("profiles")} + ${"profiles"===this._expandedMenus[bi]?o`
+ ${this._renderOptionSelector(ne,this._profiles,{multiple:!0,label:l("config.profiles.editor_label")})} +
`:""} + ${this._renderOptionSetHeader("view")} + ${"view"===this._expandedMenus[bi]?o` +
+ ${this._renderOptionSelector(se,this._viewModes)} + ${this._renderOptionSelector(oe,this._cameraSelectViewModes)} + ${this._renderOptionSelector(re,this._darkModes)} + ${this._renderNumberInput(le)} + ${this._renderSwitch(ce,this._defaults.view.default_cycle_camera)} + ${this._renderViewDefaultResetMenu()} ${this._renderViewTriggersMenu()} + ${this._renderViewKeyboardShortcutMenu()} +
+ `:""} + ${this._renderOptionSetHeader("menu")} + ${"menu"===this._expandedMenus[bi]?o` +
+ ${this._renderOptionSelector(de,this._menuStyles)} + ${this._renderOptionSelector(me,this._menuPositions)} + ${this._renderOptionSelector(ue,this._menuAlignments)} + ${this._renderNumberInput(he,{min:X})} + ${this._renderMenuButton("frigate")} + ${this._renderMenuButton("cameras")} + ${this._renderMenuButton("substreams")} + ${this._renderMenuButton("live")} + ${this._renderMenuButton("clips")} + ${this._renderMenuButton("snapshots")} + ${this._renderMenuButton("recordings")} + ${this._renderMenuButton("image")} + ${this._renderMenuButton("download")} + ${this._renderMenuButton("camera_ui")} + ${this._renderMenuButton("fullscreen")} + ${this._renderMenuButton("expand")} + ${this._renderMenuButton("timeline")} + ${this._renderMenuButton("media_player")} + ${this._renderMenuButton("microphone",o`${this._renderOptionSelector(`${R}.microphone.type`,this._microphoneButtonTypes,{label:l("config.menu.buttons.type")})}`)} + ${this._renderMenuButton("play")} + ${this._renderMenuButton("mute")} + ${this._renderMenuButton("screenshot")} + ${this._renderMenuButton("display_mode")} + ${this._renderMenuButton("ptz_controls")} + ${this._renderMenuButton("ptz_home")} +
+ `:""} + ${this._renderOptionSetHeader("status_bar")} + ${"status_bar"===this._expandedMenus[bi]?o` +
+ ${this._renderOptionSelector(_e,this._statusBarStyles)} + ${this._renderOptionSelector(ge,this._statusBarPositions)} + ${this._renderNumberInput(be,{min:pe,label:l("config.status_bar.height")})} + ${this._renderNumberInput(ve,{min:0,max:60,default:this._defaults.status_bar.popup_seconds,label:l("config.status_bar.popup_seconds")})} + ${this._renderStatusBarItem("title")} + ${this._renderStatusBarItem("resolution")} + ${this._renderStatusBarItem("technology")} + ${this._renderStatusBarItem("engine")} +
+ `:""} + ${this._renderOptionSetHeader("live")} + ${"live"===this._expandedMenus[bi]?o` +
+ ${this._renderSwitch(fe,this._defaults.live.preload)} + ${this._renderSwitch($e,this._defaults.live.draggable)} + ${this._renderSwitch(ye,this._defaults.live.zoomable)} + ${this._renderSwitch(we,this._defaults.live.lazy_load)} + ${this._renderOptionSelector(Se,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(xe,this._mediaActionPositiveConditions,{multiple:!0})} + ${this._renderOptionSelector(Me,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(Ie,this._mediaLiveMuteConditions,{multiple:!0})} + ${this._renderOptionSelector(ke,this._mediaLiveUnmuteConditions,{multiple:!0})} + ${this._renderOptionSelector(Oe,this._transitionEffects)} + ${this._renderSwitch(Ce,this._defaults.live.show_image_during_load)} + ${this._renderViewDisplay("live.display",ze,Ae,Ne,Te)} + ${this._putInSubmenu("live.controls",!0,"config.live.controls.editor_label","mdi:gamepad",o` + ${this._renderSwitch(Be,this._defaults.live.controls.builtin,{label:l("config.common.controls.builtin")})} + ${this._renderNextPreviousControls("live.controls.next_previous",Ee,Pe,{allowIcons:!0})} + ${this._renderThumbnailsControls("live.controls.thumbnails",He,Le,Ve,Ke,Ue,this._defaults.live.controls.thumbnails,{configPathMediaType:je,configPathEventsMediaType:qe,configPathMode:Re})} + ${this._renderMiniTimeline("live.controls.timeline",De,Fe,Ge,Je,Qe,We,this._defaults.live.controls.timeline.show_recordings,Xe)} + ${this._putInSubmenu("live.controls.ptz",!0,"config.live.controls.ptz.editor_label","mdi:pan",o` + ${this._renderOptionSelector(Ye,this._ptzModes)} + ${this._renderOptionSelector(Ze,this._ptzPositions)} + ${this._renderOptionSelector(ea,this._ptzOrientations)} + ${this._renderSwitch(aa,this._defaults.live.controls.ptz.hide_pan_tilt,{label:l("config.live.controls.ptz.hide_pan_tilt")})} + ${this._renderSwitch(ta,this._defaults.live.controls.ptz.hide_pan_tilt,{label:l("config.live.controls.ptz.hide_zoom")})} + ${this._renderSwitch(ia,this._defaults.live.controls.ptz.hide_home,{label:l("config.live.controls.ptz.hide_home")})} + `)} + `)} + ${this._putInSubmenu("live.microphone",!0,"config.live.microphone.editor_label","mdi:microphone",o` + ${this._renderNumberInput(na)} + ${this._renderSwitch(sa,this._defaults.live.microphone.always_connected)} + ${this._renderNumberInput(oa)} + `)} +
+ `:""} + ${this._renderOptionSetHeader("media_gallery")} + ${"media_gallery"===this._expandedMenus[bi]?o`
+ ${this._renderThumbnailsControls("media_gallery.controls.thumbnails",ra,la,ca,da,ma,this._defaults.media_gallery.controls.thumbnails)} + ${this._renderFilterControls("media_gallery.controls.filter",ua)} +
`:""} + ${this._renderOptionSetHeader("media_viewer")} + ${"media_viewer"===this._expandedMenus[bi]?o`
+ ${this._renderOptionSelector(ha,this._mediaActionPositiveConditions,{multiple:!0})} + ${this._renderOptionSelector(_a,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(ga,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(ba,this._mediaActionPositiveConditions,{multiple:!0})} + ${this._renderSwitch(pa,this._defaults.media_viewer.draggable)} + ${this._renderSwitch(va,this._defaults.media_viewer.zoomable)} + ${this._renderSwitch(fa,this._defaults.media_viewer.lazy_load)} + ${this._renderOptionSelector($a,this._transitionEffects)} + ${this._renderSwitch(ya,this._defaults.media_viewer.snapshot_click_plays_clip)} + ${this._renderViewDisplay("media_viewer.display",wa,Sa,xa,Ma)} + ${this._putInSubmenu("media_viewer.controls",!0,"config.media_viewer.controls.editor_label","mdi:gamepad",o` + ${this._renderSwitch(Ia,this._defaults.media_viewer.controls.builtin,{label:l("config.common.controls.builtin")})} + ${this._renderNextPreviousControls("media_viewer.controls.next_previous",ka,Oa,{allowThumbnails:!0})} + ${this._renderThumbnailsControls("media_viewer.controls.thumbnails",Ca,za,Aa,Na,Ta,this._defaults.media_viewer.controls.thumbnails,{configPathMode:Ba})} + ${this._renderMiniTimeline("media_viewer.controls.timeline",Ea,Pa,Ha,La,Va,Ka,this._defaults.media_viewer.controls.timeline.show_recordings,Ua)} + `)} +
`:""} + ${this._renderOptionSetHeader("image")} + ${"image"===this._expandedMenus[bi]?o`
+ ${this._renderImageOptions(ja,qa,Ra,Da,Fa)} +
`:""} + ${this._renderOptionSetHeader("timeline")} + ${"timeline"===this._expandedMenus[bi]?o`
+ ${this._renderTimelineCoreControls(F,G,J,Q,W,this._defaults.timeline.show_recordings)} + ${this._renderThumbnailsControls("timeline.controls.thumbnails",Ga,Ja,Qa,Wa,Xa,this._defaults.timeline.controls.thumbnails,{configPathMode:Ya})} +
`:""} + ${this._renderOptionSetHeader("dimensions")} + ${"dimensions"===this._expandedMenus[bi]?o`
+ ${this._renderOptionSelector(Za,this._aspectRatioModes)} + ${this._renderStringInput(et)} + ${this._renderStringInput(at)} +
`:""} + ${this._renderOptionSetHeader("performance","low"===b(this._config,ui)?"warning":void 0)} + ${"performance"===this._expandedMenus[bi]?o`
+ ${"low"===b(this._config,ui)?this._renderInfo(l("config.performance.warning")):o``} + ${this._putInSubmenu("performance.features",!0,"config.performance.features.editor_label","mdi:feature-search",o` + ${this._renderSwitch(tt,this._defaults.performance.features.animated_progress_indicator)} + ${this._renderNumberInput(it,{max:nt})} + ${this._renderNumberInput(st,{min:1})} + `)} + ${this._putInSubmenu("performance.style",!0,"config.performance.style.editor_label","mdi:palette-swatch-variant",o` + ${this._renderSwitch(ot,this._defaults.performance.style.border_radius)} + ${this._renderSwitch(rt,this._defaults.performance.style.box_shadow)} + `)} +
`:""} + ${void 0!==this._config.overrides?o` ${this._renderOptionSetHeader("overrides")} + ${"overrides"===this._expandedMenus[bi]?o`
+ ${this._renderInfo(l("config.overrides.info"))} +
`:""}`:o``} +
+ `}_closeMenu(e){delete this._expandedMenus[e],this.requestUpdate()}_openMenu(e,a){this._expandedMenus[e]=a,this.requestUpdate()}_toggleMenu(e){if(e&&e.target){const a=e.target.domain,t=e.target.key;this._expandedMenus[a]===t?this._closeMenu(a):this._openMenu(a,t)}}_valueChangedHandler(e,a){if(!this._config||!this.hass)return;let t;if(a.detail&&void 0!==a.detail.value&&(t=a.detail.value,"string"==typeof t&&(t=t.trim())),b(this._config,e)===t)return;const i=m(this._config);""===t||void 0===t?lt(i,e):ct(i,e,t),this._updateConfig(i)}static get styles(){return c('ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n.option {\n padding: 4px 4px;\n cursor: pointer;\n}\n\n.option.option-overrides .title {\n color: var(--warning-color);\n}\n\n.row {\n display: flex;\n margin-bottom: -14px;\n pointer-events: none;\n}\n\n.title {\n padding-left: 16px;\n margin-top: -6px;\n pointer-events: none;\n}\n\n.title.warning {\n color: var(--warning-color);\n}\n\n.secondary {\n padding-left: 40px;\n color: var(--secondary-text-color);\n pointer-events: none;\n}\n\n.values {\n background: var(--secondary-background-color);\n display: grid;\n}\n\n.values + .option,\n.submenu + .option {\n margin-top: 10px;\n}\n\ndiv.upgrade {\n width: auto;\n border: 1px dotted var(--primary-color);\n margin: 10px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\ndiv.upgrade span {\n padding: 10px;\n}\n\n.submenu-header {\n display: flex;\n padding: 10px;\n cursor: pointer;\n}\n\n.submenu.selected > .submenu-header {\n background-color: var(--primary-color);\n color: var(--primary-text-color);\n}\n\n.submenu-header * {\n flex-basis: auto;\n pointer-events: none;\n}\n\n.submenu-header .new-camera {\n font-style: italic;\n}\n\n.submenu:not(.selected) > .submenu-header .new-camera {\n color: var(--secondary-text-color, "black");\n}\n\n.submenu-header ha-icon,\n.submenu-header img {\n padding-right: 15px;\n}\n\n.submenu.selected {\n border: 1px solid var(--primary-color);\n}\n\n.submenu {\n width: calc(100% - 20px);\n margin-left: auto;\n margin-right: auto;\n margin-bottom: 10px;\n}\n\n.submenu:first-child,\n:not(.submenu) + .submenu {\n margin-top: 10px;\n}\n\n.submenu .controls {\n display: inline-block;\n margin-left: auto;\n margin-right: 0px;\n margin-bottom: 5px;\n}\n\n.submenu .controls ha-icon-button.button {\n --mdc-icon-button-size: 32px;\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n}\n\nspan.info {\n padding: 10px;\n}\n\nha-selector {\n padding: 10px;\n border: 1px solid var(--divider-color);\n}')}};t([i({attribute:!1})],vi.prototype,"hass",void 0),t([d()],vi.prototype,"_config",void 0),t([d()],vi.prototype,"_defaults",void 0),t([d()],vi.prototype,"_expandedMenus",void 0),vi=t([n("frigate-card-editor")],vi);export{vi as FrigateCardEditor}; diff --git a/config/www/community/frigate-hass-card/editor-5368ad86.js.gz b/config/www/community/frigate-hass-card/editor-5368ad86.js.gz new file mode 100644 index 00000000..e693fb2b Binary files /dev/null and b/config/www/community/frigate-hass-card/editor-5368ad86.js.gz differ diff --git a/config/www/community/frigate-hass-card/editor-837da8b4.js b/config/www/community/frigate-hass-card/editor-837da8b4.js new file mode 100644 index 00000000..d6c85c42 --- /dev/null +++ b/config/www/community/frigate-hass-card/editor-837da8b4.js @@ -0,0 +1,462 @@ +import{i as e,s as a,_ as t,n as i,t as n,a as s,x as o,e as r,l,r as c,b as d,c as m,d as u,p as h,f as _,g,h as b,j as p,k as v,C as f,m as $,o as y,q as w,u as S,v as x,w as M,y as I,z as k,A as O,B as C,D as z,E as A,F as N,G as T,H as B,I as E,J as P,K as H,L,M as V,N as K,O as U,P as j,Q as q,R,S as D,T as F,U as G,V as J,W as Q,X as W,Y as X,Z as Y,$ as Z,a0 as ee,a1 as ae,a2 as te,a3 as ie,a4 as ne,a5 as se,a6 as oe,a7 as re,a8 as le,a9 as ce,aa as de,ab as me,ac as ue,ad as he,ae as _e,af as ge,ag as be,ah as pe,ai as ve,aj as fe,ak as $e,al as ye,am as we,an as Se,ao as xe,ap as Me,aq as Ie,ar as ke,as as Oe,at as Ce,au as ze,av as Ae,aw as Ne,ax as Te,ay as Be,az as Ee,aA as Pe,aB as He,aC as Le,aD as Ve,aE as Ke,aF as Ue,aG as je,aH as qe,aI as Re,aJ as De,aK as Fe,aL as Ge,aM as Je,aN as Qe,aO as We,aP as Xe,aQ as Ye,aR as Ze,aS as ea,aT as aa,aU as ta,aV as ia,aW as na,aX as sa,aY as oa,aZ as ra,a_ as la,a$ as ca,b0 as da,b1 as ma,b2 as ua,b3 as ha,b4 as _a,b5 as ga,b6 as ba,b7 as pa,b8 as va,b9 as fa,ba as $a,bb as ya,bc as wa,bd as Sa,be as xa,bf as Ma,bg as Ia,bh as ka,bi as Oa,bj as Ca,bk as za,bl as Aa,bm as Na,bn as Ta,bo as Ba,bp as Ea,bq as Pa,br as Ha,bs as La,bt as Va,bu as Ka,bv as Ua,bw as ja,bx as qa,by as Ra,bz as Da,bA as Fa,bB as Ga,bC as Ja,bD as Qa,bE as Wa,bF as Xa,bG as Ya,bH as Za,bI as et,bJ as at,bK as tt,bL as it,bM as nt,bN as st,bO as ot,bP as rt,bQ as lt,bR as ct,bS as dt,bT as mt,bU as ut,bV as ht,bW as _t,bX as gt,bY as bt,bZ as pt,b_ as vt,b$ as ft,c0 as $t,c1 as yt,c2 as wt,c3 as St,c4 as xt,c5 as Mt,c6 as It,c7 as kt,c8 as Ot,c9 as Ct,ca as zt,cb as At,cc as Nt,cd as Tt,ce as Bt,cf as Et,cg as Pt,ch as Ht,ci as Lt,cj as Vt,ck as Kt,cl as Ut,cm as jt,cn as qt,co as Rt,cp as Dt,cq as Ft,cr as Gt,cs as Jt,ct as Qt,cu as Wt,cv as Xt,cw as Yt,cx as Zt,cy as ei,cz as ai,cA as ti,cB as ii,cC as ni,cD as si,cE as oi,cF as ri,cG as li,cH as ci,cI as di,cJ as mi,cK as ui}from"./card-09c4bade.js";class hi{constructor(e){this._assigning=!1,this._value=null,this._blurEventHandler=()=>{this._setAssigning(!1)},this._keydownEventHandler=e=>{e.key&&!["Control","Alt","Shift","Meta"].includes(e.key)&&(this.setValue({key:e.key,ctrl:e.ctrlKey,alt:e.altKey,shift:e.shiftKey,meta:e.metaKey}),this._setAssigning(!1))},this._host=e,this._host.addController(this)}setValue(a){e(a,this._value)||(this._value=a,this._host.requestUpdate(),this._host.dispatchEvent(new CustomEvent("value-changed",{detail:{value:this._value}})))}getValue(){return this._value}hasValue(){return!!this._value}isAssigning(){return this._assigning}toggleAssigning(){this._setAssigning(!this._assigning)}_setAssigning(e){this._assigning=e,a(this._host,this._assigning,"assigning"),this._assigning?this._host.addEventListener("keydown",this._keydownEventHandler):this._host.removeEventListener("keydown",this._keydownEventHandler),this._host.requestUpdate()}hostConnected(){this._host.addEventListener("blur",this._blurEventHandler)}hostDisconnected(){this._host.removeEventListener("blur",this._blurEventHandler)}}let _i=class extends s{constructor(){super(...arguments),this._controller=new hi(this)}willUpdate(e){e.has("value")&&this._controller.setValue(this.value??null)}render(){if(!this.label)return;const e=e=>o`
+
${e}
+
`;return o` +
${this.label}
+ {this._controller.toggleAssigning()}} + > + + + ${this._controller.isAssigning()?l("key_assigner.assigning"):l("key_assigner.assign")} + + + ${this._controller.hasValue()?o`{this._controller.setValue(null)}} + > + + ${l("key_assigner.unassign")} + `:""} +
+ ${this.value?.ctrl?e(l("key_assigner.modifiers.ctrl")):""} + ${this.value?.shift?e(l("key_assigner.modifiers.shift")):""} + ${this.value?.meta?e(l("key_assigner.modifiers.meta")):""} + ${this.value?.alt?e(l("key_assigner.modifiers.alt")):""} + ${this.value?.key?e(this.value.key):""} +
+ `}static get styles(){return c('.dotdotdot:after {\n animation: dots 2s linear infinite;\n content: "";\n display: inline-block;\n width: 3em;\n}\n@keyframes dots {\n 0%, 20% {\n content: ".";\n }\n 40% {\n content: "..";\n }\n 60% {\n content: "...";\n }\n 90%, 100% {\n content: "";\n }\n}\n\n:host {\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 10px;\n height: 56px;\n border: 1px solid var(--divider-color);\n}\n\n:host([assigning]) ha-button.assign span,\n:host([assigning]) ha-button.assign ha-icon {\n color: var(--warning-color);\n}\n\nha-icon {\n padding: 10px;\n}\n\ndiv.label {\n width: 100px;\n margin-left: 4px;\n}\n\ndiv.key-row {\n flex: 1;\n display: flex;\n justify-content: center;\n align-items: center;\n padding-left: 10px;\n padding-right: 10px;\n}\n\ndiv.key {\n display: flex;\n align-items: center;\n height: 90%;\n width: min-content;\n margin-left: 5px;\n margin-right: 5px;\n}\n\ndiv.key-inner {\n height: 100%;\n width: 100%;\n padding-top: 2px;\n padding-bottom: 2px;\n padding-left: 4px;\n padding-right: 4px;\n border: 2px;\n border-radius: 4px;\n border-style: outset;\n border-color: var(--divider-color);\n font-family: monospace;\n text-transform: capitalize;\n}\n\ndiv.unassigned {\n font-style: italic;\n}\n\ndiv.key + div.key:before {\n display: flex;\n align-items: center;\n margin-right: 5px;\n content: " + ";\n}')}};t([i({attribute:!1})],_i.prototype,"label",void 0),t([i({attribute:!1})],_i.prototype,"value",void 0),_i=t([n("frigate-card-key-assigner")],_i);const gi="cameras",bi="options",pi={cameras:{icon:"video",name:l("editor.cameras"),secondary:l("editor.cameras_secondary")},view:{icon:"eye",name:l("editor.view"),secondary:l("editor.view_secondary")},menu:{icon:"menu",name:l("editor.menu"),secondary:l("editor.menu_secondary")},status_bar:{icon:"sign-text",name:l("editor.status_bar"),secondary:l("editor.status_bar_secondary")},live:{icon:"cctv",name:l("editor.live"),secondary:l("editor.live_secondary")},media_gallery:{icon:"grid",name:l("editor.media_gallery"),secondary:l("editor.media_gallery_secondary")},media_viewer:{icon:"filmstrip",name:l("editor.media_viewer"),secondary:l("editor.media_viewer_secondary")},image:{icon:"image",name:l("editor.image"),secondary:l("editor.image_secondary")},timeline:{icon:"chart-gantt",name:l("editor.timeline"),secondary:l("editor.timeline_secondary")},dimensions:{icon:"aspect-ratio",name:l("editor.dimensions"),secondary:l("editor.dimensions_secondary")},performance:{icon:"speedometer",name:l("editor.performance"),secondary:l("editor.performance_secondary")},profiles:{icon:"folder-wrench-outline",name:l("editor.profiles"),secondary:l("editor.profiles_secondary")},overrides:{icon:"file-replace",name:l("editor.overrides"),secondary:l("editor.overrides_secondary")}};let vi=class extends s{constructor(){super(...arguments),this._defaults=m(di),this._initialized=!1,this._configUpgradeable=!1,this._expandedMenus={},this._viewModes=[{value:"",label:""},{value:"live",label:l("config.view.views.live")},{value:"clips",label:l("config.view.views.clips")},{value:"snapshots",label:l("config.view.views.snapshots")},{value:"recordings",label:l("config.view.views.recordings")},{value:"clip",label:l("config.view.views.clip")},{value:"snapshot",label:l("config.view.views.snapshot")},{value:"recording",label:l("config.view.views.recording")},{value:"image",label:l("config.view.views.image")},{value:"timeline",label:l("config.view.views.timeline")}],this._cameraSelectViewModes=[...this._viewModes,{value:"current",label:l("config.view.views.current")}],this._filterModes=[{value:"",label:""},{value:"none",label:l("config.common.controls.filter.modes.none")},{value:"left",label:l("config.common.controls.filter.modes.left")},{value:"right",label:l("config.common.controls.filter.modes.right")}],this._menuStyles=[{value:"",label:""},{value:"none",label:l("config.menu.styles.none")},{value:"hidden",label:l("config.menu.styles.hidden")},{value:"overlay",label:l("config.menu.styles.overlay")},{value:"hover",label:l("config.menu.styles.hover")},{value:"hover-card",label:l("config.menu.styles.hover-card")},{value:"outside",label:l("config.menu.styles.outside")}],this._menuPositions=[{value:"",label:""},{value:"left",label:l("config.menu.positions.left")},{value:"right",label:l("config.menu.positions.right")},{value:"top",label:l("config.menu.positions.top")},{value:"bottom",label:l("config.menu.positions.bottom")}],this._menuAlignments=[{value:"",label:""},{value:"left",label:l("config.menu.alignments.left")},{value:"right",label:l("config.menu.alignments.right")},{value:"top",label:l("config.menu.alignments.top")},{value:"bottom",label:l("config.menu.alignments.bottom")}],this._nextPreviousControlStyles=[{value:"",label:""},{value:"chevrons",label:l("config.common.controls.next_previous.styles.chevrons")},{value:"icons",label:l("config.common.controls.next_previous.styles.icons")},{value:"none",label:l("config.common.controls.next_previous.styles.none")},{value:"thumbnails",label:l("config.common.controls.next_previous.styles.thumbnails")}],this._aspectRatioModes=[{value:"",label:""},{value:"dynamic",label:l("config.dimensions.aspect_ratio_modes.dynamic")},{value:"static",label:l("config.dimensions.aspect_ratio_modes.static")},{value:"unconstrained",label:l("config.dimensions.aspect_ratio_modes.unconstrained")}],this._thumbnailModes=[{value:"",label:""},{value:"none",label:l("config.common.controls.thumbnails.modes.none")},{value:"above",label:l("config.common.controls.thumbnails.modes.above")},{value:"below",label:l("config.common.controls.thumbnails.modes.below")},{value:"left",label:l("config.common.controls.thumbnails.modes.left")},{value:"right",label:l("config.common.controls.thumbnails.modes.right")}],this._thumbnailMediaTypes=[{value:"",label:""},{value:"events",label:l("config.common.controls.thumbnails.media_types.events")},{value:"recordings",label:l("config.common.controls.thumbnails.media_types.recordings")}],this._thumbnailEventsMediaTypes=[{value:"",label:""},{value:"clips",label:l("config.common.controls.thumbnails.events_media_types.clips")},{value:"snapshots",label:l("config.common.controls.thumbnails.events_media_types.snapshots")}],this._transitionEffects=[{value:"",label:""},{value:"none",label:l("config.media_viewer.transition_effects.none")},{value:"slide",label:l("config.media_viewer.transition_effects.slide")}],this._imageModes=[{value:"",label:""},{value:"camera",label:l("config.common.image.modes.camera")},{value:"entity",label:l("config.common.image.modes.entity")},{value:"screensaver",label:l("config.common.image.modes.screensaver")},{value:"url",label:l("config.common.image.modes.url")}],this._timelineEventsMediaTypes=[{value:"",label:""},{value:"all",label:l("config.common.timeline.events_media_types.all")},{value:"clips",label:l("config.common.timeline.events_media_types.clips")},{value:"snapshots",label:l("config.common.timeline.events_media_types.snapshots")}],this._timelineStyleTypes=[{value:"",label:""},{value:"ribbon",label:l("config.common.timeline.styles.ribbon")},{value:"stack",label:l("config.common.timeline.styles.stack")}],this._darkModes=[{value:"",label:""},{value:"on",label:l("config.view.dark_modes.on")},{value:"off",label:l("config.view.dark_modes.off")},{value:"auto",label:l("config.view.dark_modes.auto")}],this._mediaActionNegativeConditions=[{value:"",label:""},{value:"unselected",label:l("config.common.media_action_conditions.unselected")},{value:"hidden",label:l("config.common.media_action_conditions.hidden")}],this._mediaActionPositiveConditions=[{value:"",label:""},{value:"selected",label:l("config.common.media_action_conditions.selected")},{value:"visible",label:l("config.common.media_action_conditions.visible")}],this._mediaLiveUnmuteConditions=[...this._mediaActionPositiveConditions,{value:"microphone",label:l("config.common.media_action_conditions.microphone_unmute")}],this._mediaLiveMuteConditions=[...this._mediaActionNegativeConditions,{value:"microphone",label:l("config.common.media_action_conditions.microphone_mute")}],this._layoutFits=[{value:"",label:""},{value:"contain",label:l("config.cameras.dimensions.layout.fits.contain")},{value:"cover",label:l("config.cameras.dimensions.layout.fits.cover")},{value:"fill",label:l("config.cameras.dimensions.layout.fits.fill")}],this._miniTimelineModes=[{value:"",label:""},{value:"none",label:l("config.common.controls.timeline.modes.none")},{value:"above",label:l("config.common.controls.timeline.modes.above")},{value:"below",label:l("config.common.controls.timeline.modes.below")}],this._profiles=[{value:"",label:""},{value:"casting",label:l("config.profiles.casting")},{value:"low-performance",label:l("config.profiles.low-performance")},{value:"scrubbing",label:l("config.profiles.scrubbing")}],this._go2rtcModes=[{value:"",label:""},{value:"mse",label:l("config.cameras.go2rtc.modes.mse")},{value:"webrtc",label:l("config.cameras.go2rtc.modes.webrtc")},{value:"mp4",label:l("config.cameras.go2rtc.modes.mp4")},{value:"mjpeg",label:l("config.cameras.go2rtc.modes.mjpeg")}],this._microphoneButtonTypes=[{value:"",label:""},{value:"momentary",label:l("config.menu.buttons.types.momentary")},{value:"toggle",label:l("config.menu.buttons.types.toggle")}],this._displayModes=[{value:"",label:""},{value:"single",label:l("display_modes.single")},{value:"grid",label:l("display_modes.grid")}],this._castMethods=[{value:"",label:""},{value:"standard",label:l("config.cameras.cast.methods.standard")},{value:"dashboard",label:l("config.cameras.cast.methods.dashboard")}],this._ptzModes=[{value:"",label:""},{value:"on",label:l("config.live.controls.ptz.modes.on")},{value:"off",label:l("config.live.controls.ptz.modes.off")}],this._ptzOrientations=[{value:"",label:""},{value:"vertical",label:l("config.live.controls.ptz.orientations.vertical")},{value:"horizontal",label:l("config.live.controls.ptz.orientations.horizontal")}],this._ptzPositions=[{value:"",label:""},{value:"top-left",label:l("config.live.controls.ptz.positions.top-left")},{value:"top-right",label:l("config.live.controls.ptz.positions.top-right")},{value:"bottom-left",label:l("config.live.controls.ptz.positions.bottom-left")},{value:"bottom-right",label:l("config.live.controls.ptz.positions.bottom-right")}],this._triggersActionsInteractionModes=[{value:"",label:""},{value:"all",label:l("config.view.triggers.actions.interaction_modes.all")},{value:"inactive",label:l("config.view.triggers.actions.interaction_modes.inactive")},{value:"active",label:l("config.view.triggers.actions.interaction_modes.active")}],this._triggersActionsTrigger=[{value:"",label:""},{value:"default",label:l("config.view.triggers.actions.triggers.default")},{value:"live",label:l("config.view.triggers.actions.triggers.live")},{value:"media",label:l("config.view.triggers.actions.triggers.media")},{value:"none",label:l("config.view.triggers.actions.triggers.none")}],this._triggersActionsUntrigger=[{value:"",label:""},{value:"default",label:l("config.view.triggers.actions.untriggers.default")},{value:"none",label:l("config.view.triggers.actions.untriggers.none")}],this._triggersEvents=[{value:"",label:""},{value:"events",label:l("config.cameras.triggers.events.events")},{value:"clips",label:l("config.cameras.triggers.events.clips")},{value:"snapshots",label:l("config.cameras.triggers.events.snapshots")}],this._timelinePanModes=[{value:"",label:""},{value:"pan",label:l("config.common.controls.timeline.pan_modes.pan")},{value:"seek",label:l("config.common.controls.timeline.pan_modes.seek")},{value:"seek-in-media",label:l("config.common.controls.timeline.pan_modes.seek-in-media")},{value:"seek-in-camera",label:l("config.common.controls.timeline.pan_modes.seek-in-camera")}],this._capabilities=[{value:"",label:""},{value:"live",label:l("config.cameras.capabilities.capabilities.live")},{value:"substream",label:l("config.cameras.capabilities.capabilities.substream")},{value:"clips",label:l("config.cameras.capabilities.capabilities.clips")},{value:"recordings",label:l("config.cameras.capabilities.capabilities.recordings")},{value:"snapshots",label:l("config.cameras.capabilities.capabilities.snapshots")},{value:"favorite-events",label:l("config.cameras.capabilities.capabilities.favorite-events")},{value:"favorite-recordings",label:l("config.cameras.capabilities.capabilities.favorite-recordings")},{value:"seek",label:l("config.cameras.capabilities.capabilities.seek")},{value:"ptz",label:l("config.cameras.capabilities.capabilities.ptz")},{value:"menu",label:l("config.cameras.capabilities.capabilities.menu")}],this._defaultResetInteractionModes=[{value:"",label:""},{value:"all",label:l("config.view.default_reset.interaction_modes.all")},{value:"inactive",label:l("config.view.default_reset.interaction_modes.inactive")},{value:"active",label:l("config.view.default_reset.interaction_modes.active")}],this._proxyMedia=[{value:"",label:""},{value:"auto",label:l("config.cameras.proxy.media.auto")},{value:!0,label:l("config.cameras.proxy.media.true")},{value:!1,label:l("config.cameras.proxy.media.false")}],this._proxySSLCiphers=[{value:"",label:""},{value:"auto",label:l("config.cameras.proxy.ssl_ciphers.auto")},{value:"default",label:l("config.cameras.proxy.ssl_ciphers.default")},{value:"insecure",label:l("config.cameras.proxy.ssl_ciphers.insecure")},{value:"intermediate",label:l("config.cameras.proxy.ssl_ciphers.intermediate")},{value:"modern",label:l("config.cameras.proxy.ssl_ciphers.modern")}],this._proxySSLVerification=[{value:"",label:""},{value:"auto",label:l("config.cameras.proxy.ssl_verification.auto")},{value:!0,label:l("config.cameras.proxy.ssl_verification.true")},{value:!1,label:l("config.cameras.proxy.ssl_verification.false")}],this._reolinkMediaResolution=[{value:"",label:""},{value:"high",label:l("config.cameras.reolink.media_resolution.high")},{value:"low",label:l("config.cameras.reolink.media_resolution.low")}],this._statusBarStyles=[{value:"",label:""},{value:"hover",label:l("config.status_bar.styles.hover")},{value:"hover-card",label:l("config.status_bar.styles.hover-card")},{value:"none",label:l("config.status_bar.styles.none")},{value:"outside",label:l("config.status_bar.styles.outside")},{value:"overlay",label:l("config.status_bar.styles.overlay")},{value:"popup",label:l("config.status_bar.styles.popup")}],this._statusBarPositions=[{value:"",label:""},{value:"top",label:l("config.status_bar.positions.top")},{value:"bottom",label:l("config.status_bar.positions.bottom")}]}setConfig(e){this._config=e,this._configUpgradeable=u(e);const a=h.safeParse(this._config.profiles);if(a.success){const e=m(di);_(this._config,e,a.data),this._defaults=e}}willUpdate(){this._initialized||g().then((e=>{e&&(this._initialized=!0)}))}_renderOptionSetHeader(e,a){const t=pi[e];return o` +
+
+ +
${t.name}
+
+
${t.secondary}
+
+ `}_getLabel(e){const a=e.split(".").filter((e=>!e.match(/^\[[0-9]+\]$/))).join(".");return l(`config.${a}`)}_renderEntitySelector(e,a){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderOptionSelector(e,a=[],t){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderIconSelector(e,a){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderNumberInput(e,a){if(!this._config)return;const t=b(this._config,e),i=void 0===a?.max?"box":"slider";return o` + this._valueChangedHandler(e,a)} + > + + `}_renderInfo(e){return o` ${e}`}_getEditorCameraTitle(e,a){return"string"==typeof a?.title&&a.title||("string"==typeof a?.camera_entity?p(this.hass,a.camera_entity):"")||"object"==typeof a?.webrtc_card&&a.webrtc_card&&"string"==typeof a.webrtc_card.entity&&a.webrtc_card.entity||("object"==typeof a?.frigate&&a.frigate&&"string"==typeof a?.frigate.camera_name&&a.frigate.camera_name?v(a.frigate.camera_name):"")||"string"==typeof a?.id&&a.id||l("editor.camera")+" #"+e}_renderViewDefaultResetMenu(){return this._putInSubmenu("view.default_reset",!0,`config.${f}.editor_label`,"mdi:restart",o` + ${this._renderSwitch($,this._defaults.view.default_reset.after_interaction)} + ${this._renderNumberInput(y)} + ${this._renderOptionSelector(w,this._defaultResetInteractionModes,{label:l("config.view.default_reset.interaction_mode")})}, + ${this._renderOptionSelector(S,this.hass?x(this.hass):[],{multiple:!0})} + `)}_renderViewTriggersMenu(){return this._putInSubmenu("view.triggers",!0,`config.${M}.editor_label`,"mdi:target-account",o` + ${this._renderSwitch(I,this._defaults.view.triggers.filter_selected_camera,{label:l(`config.${I}`)})} + ${this._renderSwitch(k,this._defaults.view.triggers.show_trigger_status,{label:l(`config.${k}`)})} + ${this._renderNumberInput(O,{default:this._defaults.view.triggers.untrigger_seconds})} + ${this._putInSubmenu("view.triggers.actions",!0,`config.${C}.editor_label`,"mdi:cogs",o` ${this._renderOptionSelector(z,this._triggersActionsTrigger,{label:l("config.view.triggers.actions.trigger")})} + ${this._renderOptionSelector(A,this._triggersActionsUntrigger,{label:l("config.view.triggers.actions.untrigger")})} + ${this._renderOptionSelector(N,this._triggersActionsInteractionModes,{label:l("config.view.triggers.actions.interaction_mode")})}`)} + `)}_renderKeyAssigner(e,a){return o` this._valueChangedHandler(e,a)} + >`}_renderViewKeyboardShortcutMenu(){return this._putInSubmenu("view.keyboard_shortcuts",!0,`config.${T}.editor_label`,"mdi:keyboard",o` + ${this._renderSwitch(B,this._defaults.view.keyboard_shortcuts.enabled,{label:l(`config.${B}`)})} + ${this._renderKeyAssigner(E,this._defaults.view.keyboard_shortcuts.ptz_left)} + ${this._renderKeyAssigner(P,this._defaults.view.keyboard_shortcuts.ptz_right)} + ${this._renderKeyAssigner(H,this._defaults.view.keyboard_shortcuts.ptz_up)} + ${this._renderKeyAssigner(L,this._defaults.view.keyboard_shortcuts.ptz_down)} + ${this._renderKeyAssigner(V,this._defaults.view.keyboard_shortcuts.ptz_zoom_in)} + ${this._renderKeyAssigner(K,this._defaults.view.keyboard_shortcuts.ptz_zoom_out)} + ${this._renderKeyAssigner(U,this._defaults.view.keyboard_shortcuts.ptz_home)} + `)}_renderStatusBarItem(e){return o` ${this._putInSubmenu("status_bar.items",e,`config.status_bar.items.${e}`,"mdi:feature-search",o` + ${this._renderSwitch(`${j}.${e}.enabled`,this._defaults.status_bar.items[e]?.enabled??!0,{label:l("config.status_bar.items.enabled")})} + ${this._renderNumberInput(`${j}.${e}.priority`,{max:q,default:this._defaults.status_bar.items[e]?.priority,label:l("config.status_bar.items.priority")})} + `)}`}_renderMenuButton(e,a){const t=[{value:"",label:""},{value:"matching",label:l("config.menu.buttons.alignments.matching")},{value:"opposing",label:l("config.menu.buttons.alignments.opposing")}];return o` ${this._putInSubmenu("menu.buttons",e,`config.menu.buttons.${e}`,"mdi:gesture-tap-button",o` + ${this._renderSwitch(`${R}.${e}.enabled`,this._defaults.menu.buttons[e]?.enabled??!0,{label:l("config.menu.buttons.enabled")})} + ${this._renderOptionSelector(`${R}.${e}.alignment`,t,{label:l("config.menu.buttons.alignment")})} + ${this._renderSwitch(`${R}.${e}.permanent`,this._defaults.menu.buttons[e]?.permanent??!1,{label:l("config.menu.buttons.permanent")})} + ${this._renderNumberInput(`${R}.${e}.priority`,{max:D,default:this._defaults.menu.buttons[e]?.priority,label:l("config.menu.buttons.priority")})} + ${this._renderIconSelector(`${R}.${e}.icon`,{label:l("config.menu.buttons.icon")})} + ${a} + `)}`}_putInSubmenu(e,a,t,i,n){const s=this._expandedMenus[e]===a,c={submenu:!0,selected:s},d=dt(i);return o`
+ + ${s?o`
${n}
`:""} +
`}_renderMediaLayout(e,a,t,i,n,s,r,c,d,m,u,h){return this._putInSubmenu(e,!0,a,"mdi:page-layout-body",o` + ${this._renderNumberInput(m,{min:0,max:10,label:l("config.cameras.dimensions.layout.zoom"),step:.1})} + ${this._renderNumberInput(u,{min:0,max:100,label:l("config.cameras.dimensions.layout.pan.x")})} + ${this._renderNumberInput(h,{min:0,max:100,label:l("config.cameras.dimensions.layout.pan.y")})} + ${this._renderOptionSelector(t,this._layoutFits,{label:l("config.cameras.dimensions.layout.fit")})} + ${this._putInSubmenu(`${e}.position`,!0,"config.cameras.dimensions.layout.position.editor_label","mdi:aspect-ratio",o` ${this._renderNumberInput(i,{min:0,max:100,label:l("config.cameras.dimensions.layout.position.x")})} + ${this._renderNumberInput(n,{min:0,max:100,label:l("config.cameras.dimensions.layout.position.y")})}`)} + ${this._putInSubmenu(`${e}.view_box`,!0,"config.cameras.dimensions.layout.view_box.editor_label","mdi:crop",o` + ${this._renderNumberInput(s,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.top")})} + ${this._renderNumberInput(r,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.bottom")})} + ${this._renderNumberInput(c,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.left")})} + ${this._renderNumberInput(d,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.right")})} + `)} + `)}_renderTimelineCoreControls(e,a,t,i,n,s,r){return o` + ${this._renderOptionSelector(e,this._timelineStyleTypes,{label:l(`config.common.${F}`)})} + ${r?this._renderOptionSelector(r,this._timelinePanModes,{label:l("config.common.controls.timeline.pan_mode")}):""} + ${this._renderNumberInput(a,{label:l(`config.common.${G}`)})} + ${this._renderNumberInput(t,{label:l(`config.common.${J}`)})} + ${this._renderOptionSelector(i,this._timelineEventsMediaTypes,{label:l(`config.common.${Q}`)})} + ${this._renderSwitch(n,s,{label:l(`config.common.${W}`)})} + `}_renderMiniTimeline(e,a,t,i,n,s,r,c,d){return this._putInSubmenu(e,!0,"config.common.controls.timeline.editor_label","mdi:chart-gantt",o` ${this._renderOptionSelector(a,this._miniTimelineModes,{label:l("config.common.controls.timeline.mode")})} + ${this._renderTimelineCoreControls(t,i,n,s,r,c,d)}`)}_renderViewDisplay(e,a,t,i,n){return this._putInSubmenu(e,!0,"config.common.display.editor_label","mdi:palette-swatch",o` + ${this._renderOptionSelector(a,this._displayModes,{label:l("config.common.display.mode")})} + ${this._renderNumberInput(t,{min:0,label:l("config.common.display.grid_selected_width_factor")})} + ${this._renderNumberInput(i,{min:0,label:l("config.common.display.grid_columns")})} + ${this._renderNumberInput(n,{min:0,label:l("config.common.display.grid_max_columns")})} + `)}_renderNextPreviousControls(e,a,t,i){return this._putInSubmenu(e,!0,"config.common.controls.next_previous.editor_label","mdi:arrow-right-bold-circle",o` + ${this._renderOptionSelector(a,this._nextPreviousControlStyles.filter((e=>!(!i?.allowThumbnails&&"thumbnails"===e.value||!i?.allowIcons&&"icons"===e.value))),{label:l("config.common.controls.next_previous.style")})} + ${this._renderNumberInput(t,{min:X,label:l("config.common.controls.next_previous.size")})} + `)}_renderThumbnailsControls(e,a,t,i,n,s,r,c){return this._putInSubmenu(e,!0,"config.common.controls.thumbnails.editor_label","mdi:image-text",o` + ${c?.configPathMode?o`${this._renderOptionSelector(c.configPathMode,this._thumbnailModes,{label:l("config.common.controls.thumbnails.mode")})}`:o``} + ${c?.configPathMediaType?o`${this._renderOptionSelector(c.configPathMediaType,this._thumbnailMediaTypes,{label:l("config.common.controls.thumbnails.media_type")})}`:o``} + ${c?.configPathEventsMediaType?o`${this._renderOptionSelector(c.configPathEventsMediaType,this._thumbnailEventsMediaTypes,{label:l("config.common.controls.thumbnails.events_media_type")})}`:o``} + ${this._renderNumberInput(a,{min:Y,max:Z,label:l("config.common.controls.thumbnails.size")})} + ${this._renderSwitch(t,r.show_details,{label:l("config.common.controls.thumbnails.show_details")})} + ${this._renderSwitch(i,r.show_favorite_control,{label:l("config.common.controls.thumbnails.show_favorite_control")})} + ${this._renderSwitch(n,r.show_timeline_control,{label:l("config.common.controls.thumbnails.show_timeline_control")})} + ${this._renderSwitch(s,r.show_download_control,{label:l("config.common.controls.thumbnails.show_download_control")})} + `)}_renderFilterControls(e,a){return this._putInSubmenu(e,!0,"config.common.controls.filter.editor_label","mdi:filter-cog",o` + ${a?o`${this._renderOptionSelector(a,this._filterModes,{label:l("config.common.controls.filter.mode")})}`:o``} + `)}_renderImageOptions(e,a,t,i,n){return o` + ${this._renderOptionSelector(e,this._imageModes,{label:l("config.common.image.mode")})} + ${this._renderStringInput(a,{label:l("config.common.image.url")})} + ${this._renderOptionSelector(t,this.hass?x(this.hass):[],{label:l("config.common.image.entity")})} + ${this._renderStringInput(i,{label:l("config.common.image.entity_parameters")})} + ${this._renderNumberInput(n,{label:l("config.common.image.refresh_seconds")})} + `}_renderCamera(e,a,t,i){const n=[{value:"",label:""},{value:"auto",label:l("config.cameras.live_providers.auto")},{value:"ha",label:l("config.cameras.live_providers.ha")},{value:"image",label:l("config.cameras.live_providers.image")},{value:"jsmpeg",label:l("config.cameras.live_providers.jsmpeg")},{value:"go2rtc",label:l("config.cameras.live_providers.go2rtc")},{value:"webrtc-card",label:l("config.cameras.live_providers.webrtc-card")}],s=[];e.forEach(((e,t)=>{t!==a&&s.push({value:ee(e),label:this._getEditorCameraTitle(t,e)})}));const c=e=>{if(this._config){const a=m(this._config);e(a)&&this._updateConfig(a)}},d={submenu:!0,selected:this._expandedMenus[gi]===a};return o` +
+ + ${this._expandedMenus[gi]===a?o`
+
+ !i&&c((e=>!!(Array.isArray(e.cameras)&&a>0)&&(mt(e.cameras,a,a-1),this._openMenu(gi,a-1),!0)))} + > + + + =this._config.cameras.length-1} + @click=${()=>!i&&c((e=>!!(Array.isArray(e.cameras)&&a + + + {c((e=>!!Array.isArray(e.cameras)&&(e.cameras.splice(a,1),this._closeMenu(gi),!0)))}} + > + + +
+ ${this._renderEntitySelector(ae(ut,a),"camera")} + ${this._renderOptionSelector(ae(ht,a),n)} + ${this._renderStringInput(ae(_t,a))} + ${this._renderIconSelector(ae(gt,a),{label:l("config.cameras.icon")})} + ${this._renderStringInput(ae(bt,a))} + ${this._putInSubmenu("cameras.engine",!0,"config.cameras.engines.editor_label","mdi:engine",o`${this._putInSubmenu("cameras.frigate",a,"config.cameras.frigate.editor_label","frigate",o` + ${this._renderStringInput(ae(pt,a))} + ${this._renderStringInput(ae(vt,a))} + ${this._renderOptionSelector(ae(ft,a),[],{multiple:!0,label:l("config.cameras.frigate.labels")})} + ${this._renderOptionSelector(ae($t,a),[],{multiple:!0,label:l("config.cameras.frigate.zones")})} + ${this._renderStringInput(ae(yt,a))} + `)} + ${this._putInSubmenu("cameras.motioneye",a,"config.cameras.motioneye.editor_label","motioneye",o` ${this._renderStringInput(ae(wt,a))} + ${this._renderStringInput(ae(St,a))} + ${this._renderStringInput(ae(xt,a))} + ${this._renderStringInput(ae(Mt,a))} + ${this._renderStringInput(ae(It,a))}`)} + ${this._putInSubmenu("cameras.reolink",a,"config.cameras.reolink.editor_label","reolink",o` ${this._renderStringInput(ae(kt,a))} + ${this._renderOptionSelector(ae(Ot,a),this._reolinkMediaResolution,{label:l("config.cameras.reolink.media_resolution.editor_label")})}`)}`)} + ${this._putInSubmenu("cameras.live_provider",!0,"config.cameras.live_provider_options.editor_label","mdi:cctv",o` ${this._putInSubmenu("cameras.go2rtc",a,"config.cameras.go2rtc.editor_label","mdi:alpha-g-circle",o`${this._renderOptionSelector(ae(Ct,a),this._go2rtcModes,{multiple:!0,label:l("config.cameras.go2rtc.modes.editor_label")})} + ${this._renderStringInput(ae(zt,a))}`)} + ${this._putInSubmenu("cameras.image",!0,"config.cameras.image.editor_label","mdi:image",this._renderImageOptions(ae(At,a),ae(Nt,a),ae(Tt,a),ae(Bt,a),ae(Et,a)))} + ${this._putInSubmenu("cameras.webrtc_card",a,"config.cameras.webrtc_card.editor_label","mdi:webrtc",o`${this._renderEntitySelector(ae(Pt,a),"camera")} + ${this._renderStringInput(ae(Ht,a))}`)}`)} + ${this._putInSubmenu("cameras.dependencies",a,"config.cameras.dependencies.editor_label","mdi:graph",o` ${this._renderSwitch(ae(Lt,a),this._defaults.cameras.dependencies.all_cameras)} + ${this._renderOptionSelector(ae(Vt,a),s,{multiple:!0})}`)} + ${this._putInSubmenu("cameras.triggers",a,"config.cameras.triggers.editor_label","mdi:magnify-scan",o` + ${this._renderSwitch(ae(Kt,a),this._defaults.cameras.triggers.occupancy)} + ${this._renderSwitch(ae(Ut,a),this._defaults.cameras.triggers.motion)} + ${this._renderOptionSelector(ae(jt,a),t,{multiple:!0})} + ${this._renderOptionSelector(ae(qt,a),this._triggersEvents,{multiple:!0,label:l("config.cameras.triggers.events.editor_label")})} + `)} + ${this._putInSubmenu("cameras.cast",a,"config.cameras.cast.editor_label","mdi:cast",o` + ${this._renderOptionSelector(ae(Rt,a),this._castMethods)} + ${this._renderStringInput(ae(Dt,a))} + ${this._renderStringInput(ae(Ft,a))} + `)} + ${this._putInSubmenu("cameras.dimensions",a,"config.cameras.dimensions.editor_label","mdi:aspect-ratio",o` + ${this._renderStringInput(ae(Gt,a))} + ${this._renderMediaLayout("cameras.dimensions.layout","config.cameras.dimensions.layout.editor_label",ae(Jt,a),ae(Qt,a),ae(Wt,a),ae(Xt,a),ae(Yt,a),ae(Zt,a),ae(ei,a),ae(ai,a),ae(ti,a),ae(ii,a))} + `)} + ${this._putInSubmenu("cameras.capabilities",a,"config.cameras.capabilities.editor_label","mdi:cog-stop",o` + ${this._renderOptionSelector(ae(ni,a),this._capabilities,{multiple:!0})} + ${this._renderOptionSelector(ae(si,a),this._capabilities,{multiple:!0})} + `)} + ${this._putInSubmenu("cameras.proxy",a,"config.cameras.proxy.editor_label","mdi:arrow-decision",o` + ${this._renderOptionSelector(ae(oi,a),this._proxyMedia,{label:l("config.cameras.proxy.media.editor_label")})} + ${this._renderSwitch(ae(ri,a),this._defaults.cameras.proxy.dynamic)} + ${this._renderOptionSelector(ae(li,a),this._proxySSLVerification,{label:l("config.cameras.proxy.ssl_verification.editor_label")})} + ${this._renderOptionSelector(ae(ci,a),this._proxySSLCiphers,{label:l("config.cameras.proxy.ssl_ciphers.editor_label")})} + `)} +
`:""} +
+ `}_renderStringInput(e,a){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderSwitch(e,a,t){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_updateConfig(e){this._config=e,te(this,"config-changed",{config:this._config})}render(){if(!this.hass||!this._config)return o``;const e=x(this.hass),a=b(this._config,mi)||[];return o` + ${this._configUpgradeable?o`
+ ${l("editor.upgrade_available")} + + {if(this._config){const e=m(this._config);ie(e),this._updateConfig(e)}}} + > + + +
+
`:o``} +
+ ${this._renderOptionSetHeader("cameras")} + ${"cameras"===this._expandedMenus[bi]?o` +
+ ${a.map(((t,i)=>this._renderCamera(a,i,e)))} + ${this._renderCamera(a,a.length,e,!0)} +
+ `:""} + ${this._renderOptionSetHeader("profiles")} + ${"profiles"===this._expandedMenus[bi]?o`
+ ${this._renderOptionSelector(ne,this._profiles,{multiple:!0,label:l("config.profiles.editor_label")})} +
`:""} + ${this._renderOptionSetHeader("view")} + ${"view"===this._expandedMenus[bi]?o` +
+ ${this._renderOptionSelector(se,this._viewModes)} + ${this._renderOptionSelector(oe,this._cameraSelectViewModes)} + ${this._renderOptionSelector(re,this._darkModes)} + ${this._renderNumberInput(le)} + ${this._renderSwitch(ce,this._defaults.view.default_cycle_camera)} + ${this._renderViewDefaultResetMenu()} ${this._renderViewTriggersMenu()} + ${this._renderViewKeyboardShortcutMenu()} +
+ `:""} + ${this._renderOptionSetHeader("menu")} + ${"menu"===this._expandedMenus[bi]?o` +
+ ${this._renderOptionSelector(de,this._menuStyles)} + ${this._renderOptionSelector(me,this._menuPositions)} + ${this._renderOptionSelector(ue,this._menuAlignments)} + ${this._renderNumberInput(he,{min:X})} + ${this._renderMenuButton("frigate")} + ${this._renderMenuButton("cameras")} + ${this._renderMenuButton("substreams")} + ${this._renderMenuButton("live")} + ${this._renderMenuButton("clips")} + ${this._renderMenuButton("snapshots")} + ${this._renderMenuButton("recordings")} + ${this._renderMenuButton("image")} + ${this._renderMenuButton("download")} + ${this._renderMenuButton("camera_ui")} + ${this._renderMenuButton("fullscreen")} + ${this._renderMenuButton("expand")} + ${this._renderMenuButton("timeline")} + ${this._renderMenuButton("media_player")} + ${this._renderMenuButton("microphone",o`${this._renderOptionSelector(`${R}.microphone.type`,this._microphoneButtonTypes,{label:l("config.menu.buttons.type")})}`)} + ${this._renderMenuButton("play")} + ${this._renderMenuButton("mute")} + ${this._renderMenuButton("screenshot")} + ${this._renderMenuButton("display_mode")} + ${this._renderMenuButton("ptz_controls")} + ${this._renderMenuButton("ptz_home")} +
+ `:""} + ${this._renderOptionSetHeader("status_bar")} + ${"status_bar"===this._expandedMenus[bi]?o` +
+ ${this._renderOptionSelector(_e,this._statusBarStyles)} + ${this._renderOptionSelector(ge,this._statusBarPositions)} + ${this._renderNumberInput(be,{min:pe,label:l("config.status_bar.height")})} + ${this._renderNumberInput(ve,{min:0,max:60,default:this._defaults.status_bar.popup_seconds,label:l("config.status_bar.popup_seconds")})} + ${this._renderStatusBarItem("title")} + ${this._renderStatusBarItem("resolution")} + ${this._renderStatusBarItem("technology")} + ${this._renderStatusBarItem("engine")} +
+ `:""} + ${this._renderOptionSetHeader("live")} + ${"live"===this._expandedMenus[bi]?o` +
+ ${this._renderSwitch(fe,this._defaults.live.preload)} + ${this._renderSwitch($e,this._defaults.live.draggable)} + ${this._renderSwitch(ye,this._defaults.live.zoomable)} + ${this._renderSwitch(we,this._defaults.live.lazy_load)} + ${this._renderOptionSelector(Se,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(xe,this._mediaActionPositiveConditions,{multiple:!0})} + ${this._renderOptionSelector(Me,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(Ie,this._mediaLiveMuteConditions,{multiple:!0})} + ${this._renderOptionSelector(ke,this._mediaLiveUnmuteConditions,{multiple:!0})} + ${this._renderOptionSelector(Oe,this._transitionEffects)} + ${this._renderSwitch(Ce,this._defaults.live.show_image_during_load)} + ${this._renderViewDisplay("live.display",ze,Ae,Ne,Te)} + ${this._putInSubmenu("live.controls",!0,"config.live.controls.editor_label","mdi:gamepad",o` + ${this._renderSwitch(Be,this._defaults.live.controls.builtin,{label:l("config.common.controls.builtin")})} + ${this._renderNextPreviousControls("live.controls.next_previous",Ee,Pe,{allowIcons:!0})} + ${this._renderThumbnailsControls("live.controls.thumbnails",He,Le,Ve,Ke,Ue,this._defaults.live.controls.thumbnails,{configPathMediaType:je,configPathEventsMediaType:qe,configPathMode:Re})} + ${this._renderMiniTimeline("live.controls.timeline",De,Fe,Ge,Je,Qe,We,this._defaults.live.controls.timeline.show_recordings,Xe)} + ${this._putInSubmenu("live.controls.ptz",!0,"config.live.controls.ptz.editor_label","mdi:pan",o` + ${this._renderOptionSelector(Ye,this._ptzModes)} + ${this._renderOptionSelector(Ze,this._ptzPositions)} + ${this._renderOptionSelector(ea,this._ptzOrientations)} + ${this._renderSwitch(aa,this._defaults.live.controls.ptz.hide_pan_tilt,{label:l("config.live.controls.ptz.hide_pan_tilt")})} + ${this._renderSwitch(ta,this._defaults.live.controls.ptz.hide_pan_tilt,{label:l("config.live.controls.ptz.hide_zoom")})} + ${this._renderSwitch(ia,this._defaults.live.controls.ptz.hide_home,{label:l("config.live.controls.ptz.hide_home")})} + `)} + `)} + ${this._putInSubmenu("live.microphone",!0,"config.live.microphone.editor_label","mdi:microphone",o` + ${this._renderNumberInput(na)} + ${this._renderSwitch(sa,this._defaults.live.microphone.always_connected)} + ${this._renderNumberInput(oa)} + `)} +
+ `:""} + ${this._renderOptionSetHeader("media_gallery")} + ${"media_gallery"===this._expandedMenus[bi]?o`
+ ${this._renderThumbnailsControls("media_gallery.controls.thumbnails",ra,la,ca,da,ma,this._defaults.media_gallery.controls.thumbnails)} + ${this._renderFilterControls("media_gallery.controls.filter",ua)} +
`:""} + ${this._renderOptionSetHeader("media_viewer")} + ${"media_viewer"===this._expandedMenus[bi]?o`
+ ${this._renderOptionSelector(ha,this._mediaActionPositiveConditions,{multiple:!0})} + ${this._renderOptionSelector(_a,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(ga,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(ba,this._mediaActionPositiveConditions,{multiple:!0})} + ${this._renderSwitch(pa,this._defaults.media_viewer.draggable)} + ${this._renderSwitch(va,this._defaults.media_viewer.zoomable)} + ${this._renderSwitch(fa,this._defaults.media_viewer.lazy_load)} + ${this._renderOptionSelector($a,this._transitionEffects)} + ${this._renderSwitch(ya,this._defaults.media_viewer.snapshot_click_plays_clip)} + ${this._renderViewDisplay("media_viewer.display",wa,Sa,xa,Ma)} + ${this._putInSubmenu("media_viewer.controls",!0,"config.media_viewer.controls.editor_label","mdi:gamepad",o` + ${this._renderSwitch(Ia,this._defaults.media_viewer.controls.builtin,{label:l("config.common.controls.builtin")})} + ${this._renderNextPreviousControls("media_viewer.controls.next_previous",ka,Oa,{allowThumbnails:!0})} + ${this._renderThumbnailsControls("media_viewer.controls.thumbnails",Ca,za,Aa,Na,Ta,this._defaults.media_viewer.controls.thumbnails,{configPathMode:Ba})} + ${this._renderMiniTimeline("media_viewer.controls.timeline",Ea,Pa,Ha,La,Va,Ka,this._defaults.media_viewer.controls.timeline.show_recordings,Ua)} + `)} +
`:""} + ${this._renderOptionSetHeader("image")} + ${"image"===this._expandedMenus[bi]?o`
+ ${this._renderImageOptions(ja,qa,Ra,Da,Fa)} +
`:""} + ${this._renderOptionSetHeader("timeline")} + ${"timeline"===this._expandedMenus[bi]?o`
+ ${this._renderTimelineCoreControls(F,G,J,Q,W,this._defaults.timeline.show_recordings)} + ${this._renderThumbnailsControls("timeline.controls.thumbnails",Ga,Ja,Qa,Wa,Xa,this._defaults.timeline.controls.thumbnails,{configPathMode:Ya})} +
`:""} + ${this._renderOptionSetHeader("dimensions")} + ${"dimensions"===this._expandedMenus[bi]?o`
+ ${this._renderOptionSelector(Za,this._aspectRatioModes)} + ${this._renderStringInput(et)} + ${this._renderStringInput(at)} +
`:""} + ${this._renderOptionSetHeader("performance","low"===b(this._config,ui)?"warning":void 0)} + ${"performance"===this._expandedMenus[bi]?o`
+ ${"low"===b(this._config,ui)?this._renderInfo(l("config.performance.warning")):o``} + ${this._putInSubmenu("performance.features",!0,"config.performance.features.editor_label","mdi:feature-search",o` + ${this._renderSwitch(tt,this._defaults.performance.features.animated_progress_indicator)} + ${this._renderNumberInput(it,{max:nt})} + ${this._renderNumberInput(st,{min:1})} + `)} + ${this._putInSubmenu("performance.style",!0,"config.performance.style.editor_label","mdi:palette-swatch-variant",o` + ${this._renderSwitch(ot,this._defaults.performance.style.border_radius)} + ${this._renderSwitch(rt,this._defaults.performance.style.box_shadow)} + `)} +
`:""} + ${void 0!==this._config.overrides?o` ${this._renderOptionSetHeader("overrides")} + ${"overrides"===this._expandedMenus[bi]?o`
+ ${this._renderInfo(l("config.overrides.info"))} +
`:""}`:o``} +
+ `}_closeMenu(e){delete this._expandedMenus[e],this.requestUpdate()}_openMenu(e,a){this._expandedMenus[e]=a,this.requestUpdate()}_toggleMenu(e){if(e&&e.target){const a=e.target.domain,t=e.target.key;this._expandedMenus[a]===t?this._closeMenu(a):this._openMenu(a,t)}}_valueChangedHandler(e,a){if(!this._config||!this.hass)return;let t;if(a.detail&&void 0!==a.detail.value&&(t=a.detail.value,"string"==typeof t&&(t=t.trim())),b(this._config,e)===t)return;const i=m(this._config);""===t||void 0===t?lt(i,e):ct(i,e,t),this._updateConfig(i)}static get styles(){return c('ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n.option {\n padding: 4px 4px;\n cursor: pointer;\n}\n\n.option.option-overrides .title {\n color: var(--warning-color);\n}\n\n.row {\n display: flex;\n margin-bottom: -14px;\n pointer-events: none;\n}\n\n.title {\n padding-left: 16px;\n margin-top: -6px;\n pointer-events: none;\n}\n\n.title.warning {\n color: var(--warning-color);\n}\n\n.secondary {\n padding-left: 40px;\n color: var(--secondary-text-color);\n pointer-events: none;\n}\n\n.values {\n background: var(--secondary-background-color);\n display: grid;\n}\n\n.values + .option,\n.submenu + .option {\n margin-top: 10px;\n}\n\ndiv.upgrade {\n width: auto;\n border: 1px dotted var(--primary-color);\n margin: 10px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\ndiv.upgrade span {\n padding: 10px;\n}\n\n.submenu-header {\n display: flex;\n padding: 10px;\n cursor: pointer;\n}\n\n.submenu.selected > .submenu-header {\n background-color: var(--primary-color);\n color: var(--primary-text-color);\n}\n\n.submenu-header * {\n flex-basis: auto;\n pointer-events: none;\n}\n\n.submenu-header .new-camera {\n font-style: italic;\n}\n\n.submenu:not(.selected) > .submenu-header .new-camera {\n color: var(--secondary-text-color, "black");\n}\n\n.submenu-header ha-icon,\n.submenu-header img {\n padding-right: 15px;\n}\n\n.submenu.selected {\n border: 1px solid var(--primary-color);\n}\n\n.submenu {\n width: calc(100% - 20px);\n margin-left: auto;\n margin-right: auto;\n margin-bottom: 10px;\n}\n\n.submenu:first-child,\n:not(.submenu) + .submenu {\n margin-top: 10px;\n}\n\n.submenu .controls {\n display: inline-block;\n margin-left: auto;\n margin-right: 0px;\n margin-bottom: 5px;\n}\n\n.submenu .controls ha-icon-button.button {\n --mdc-icon-button-size: 32px;\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n}\n\nspan.info {\n padding: 10px;\n}\n\nha-selector {\n padding: 10px;\n border: 1px solid var(--divider-color);\n}')}};t([i({attribute:!1})],vi.prototype,"hass",void 0),t([d()],vi.prototype,"_config",void 0),t([d()],vi.prototype,"_defaults",void 0),t([d()],vi.prototype,"_expandedMenus",void 0),vi=t([n("frigate-card-editor")],vi);export{vi as FrigateCardEditor}; diff --git a/config/www/community/frigate-hass-card/editor-837da8b4.js.gz b/config/www/community/frigate-hass-card/editor-837da8b4.js.gz new file mode 100644 index 00000000..8564fb46 Binary files /dev/null and b/config/www/community/frigate-hass-card/editor-837da8b4.js.gz differ diff --git a/config/www/community/frigate-hass-card/editor-c3e576d8.js b/config/www/community/frigate-hass-card/editor-c3e576d8.js new file mode 100644 index 00000000..78ff1291 --- /dev/null +++ b/config/www/community/frigate-hass-card/editor-c3e576d8.js @@ -0,0 +1,462 @@ +import{i as e,s as a,_ as t,n as i,t as n,a as s,x as o,e as r,l,r as c,b as d,c as m,d as u,p as h,f as _,g,h as b,j as p,k as v,C as f,m as $,o as y,q as w,u as S,v as x,w as M,y as I,z as k,A as O,B as C,D as z,E as A,F as N,G as T,H as B,I as E,J as P,K as H,L,M as V,N as K,O as U,P as j,Q as q,R,S as D,T as F,U as G,V as J,W as Q,X as W,Y as X,Z as Y,$ as Z,a0 as ee,a1 as ae,a2 as te,a3 as ie,a4 as ne,a5 as se,a6 as oe,a7 as re,a8 as le,a9 as ce,aa as de,ab as me,ac as ue,ad as he,ae as _e,af as ge,ag as be,ah as pe,ai as ve,aj as fe,ak as $e,al as ye,am as we,an as Se,ao as xe,ap as Me,aq as Ie,ar as ke,as as Oe,at as Ce,au as ze,av as Ae,aw as Ne,ax as Te,ay as Be,az as Ee,aA as Pe,aB as He,aC as Le,aD as Ve,aE as Ke,aF as Ue,aG as je,aH as qe,aI as Re,aJ as De,aK as Fe,aL as Ge,aM as Je,aN as Qe,aO as We,aP as Xe,aQ as Ye,aR as Ze,aS as ea,aT as aa,aU as ta,aV as ia,aW as na,aX as sa,aY as oa,aZ as ra,a_ as la,a$ as ca,b0 as da,b1 as ma,b2 as ua,b3 as ha,b4 as _a,b5 as ga,b6 as ba,b7 as pa,b8 as va,b9 as fa,ba as $a,bb as ya,bc as wa,bd as Sa,be as xa,bf as Ma,bg as Ia,bh as ka,bi as Oa,bj as Ca,bk as za,bl as Aa,bm as Na,bn as Ta,bo as Ba,bp as Ea,bq as Pa,br as Ha,bs as La,bt as Va,bu as Ka,bv as Ua,bw as ja,bx as qa,by as Ra,bz as Da,bA as Fa,bB as Ga,bC as Ja,bD as Qa,bE as Wa,bF as Xa,bG as Ya,bH as Za,bI as et,bJ as at,bK as tt,bL as it,bM as nt,bN as st,bO as ot,bP as rt,bQ as lt,bR as ct,bS as dt,bT as mt,bU as ut,bV as ht,bW as _t,bX as gt,bY as bt,bZ as pt,b_ as vt,b$ as ft,c0 as $t,c1 as yt,c2 as wt,c3 as St,c4 as xt,c5 as Mt,c6 as It,c7 as kt,c8 as Ot,c9 as Ct,ca as zt,cb as At,cc as Nt,cd as Tt,ce as Bt,cf as Et,cg as Pt,ch as Ht,ci as Lt,cj as Vt,ck as Kt,cl as Ut,cm as jt,cn as qt,co as Rt,cp as Dt,cq as Ft,cr as Gt,cs as Jt,ct as Qt,cu as Wt,cv as Xt,cw as Yt,cx as Zt,cy as ei,cz as ai,cA as ti,cB as ii,cC as ni,cD as si,cE as oi,cF as ri,cG as li,cH as ci,cI as di,cJ as mi,cK as ui}from"./card-c642ee74.js";class hi{constructor(e){this._assigning=!1,this._value=null,this._blurEventHandler=()=>{this._setAssigning(!1)},this._keydownEventHandler=e=>{e.key&&!["Control","Alt","Shift","Meta"].includes(e.key)&&(this.setValue({key:e.key,ctrl:e.ctrlKey,alt:e.altKey,shift:e.shiftKey,meta:e.metaKey}),this._setAssigning(!1))},this._host=e,this._host.addController(this)}setValue(a){e(a,this._value)||(this._value=a,this._host.requestUpdate(),this._host.dispatchEvent(new CustomEvent("value-changed",{detail:{value:this._value}})))}getValue(){return this._value}hasValue(){return!!this._value}isAssigning(){return this._assigning}toggleAssigning(){this._setAssigning(!this._assigning)}_setAssigning(e){this._assigning=e,a(this._host,this._assigning,"assigning"),this._assigning?this._host.addEventListener("keydown",this._keydownEventHandler):this._host.removeEventListener("keydown",this._keydownEventHandler),this._host.requestUpdate()}hostConnected(){this._host.addEventListener("blur",this._blurEventHandler)}hostDisconnected(){this._host.removeEventListener("blur",this._blurEventHandler)}}let _i=class extends s{constructor(){super(...arguments),this._controller=new hi(this)}willUpdate(e){e.has("value")&&this._controller.setValue(this.value??null)}render(){if(!this.label)return;const e=e=>o`
+
${e}
+
`;return o` +
${this.label}
+ {this._controller.toggleAssigning()}} + > + + + ${this._controller.isAssigning()?l("key_assigner.assigning"):l("key_assigner.assign")} + + + ${this._controller.hasValue()?o`{this._controller.setValue(null)}} + > + + ${l("key_assigner.unassign")} + `:""} +
+ ${this.value?.ctrl?e(l("key_assigner.modifiers.ctrl")):""} + ${this.value?.shift?e(l("key_assigner.modifiers.shift")):""} + ${this.value?.meta?e(l("key_assigner.modifiers.meta")):""} + ${this.value?.alt?e(l("key_assigner.modifiers.alt")):""} + ${this.value?.key?e(this.value.key):""} +
+ `}static get styles(){return c('.dotdotdot:after {\n animation: dots 2s linear infinite;\n content: "";\n display: inline-block;\n width: 3em;\n}\n@keyframes dots {\n 0%, 20% {\n content: ".";\n }\n 40% {\n content: "..";\n }\n 60% {\n content: "...";\n }\n 90%, 100% {\n content: "";\n }\n}\n\n:host {\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 10px;\n height: 56px;\n border: 1px solid var(--divider-color);\n}\n\n:host([assigning]) ha-button.assign span,\n:host([assigning]) ha-button.assign ha-icon {\n color: var(--warning-color);\n}\n\nha-icon {\n padding: 10px;\n}\n\ndiv.label {\n width: 100px;\n margin-left: 4px;\n}\n\ndiv.key-row {\n flex: 1;\n display: flex;\n justify-content: center;\n align-items: center;\n padding-left: 10px;\n padding-right: 10px;\n}\n\ndiv.key {\n display: flex;\n align-items: center;\n height: 90%;\n width: min-content;\n margin-left: 5px;\n margin-right: 5px;\n}\n\ndiv.key-inner {\n height: 100%;\n width: 100%;\n padding-top: 2px;\n padding-bottom: 2px;\n padding-left: 4px;\n padding-right: 4px;\n border: 2px;\n border-radius: 4px;\n border-style: outset;\n border-color: var(--divider-color);\n font-family: monospace;\n text-transform: capitalize;\n}\n\ndiv.unassigned {\n font-style: italic;\n}\n\ndiv.key + div.key:before {\n display: flex;\n align-items: center;\n margin-right: 5px;\n content: " + ";\n}')}};t([i({attribute:!1})],_i.prototype,"label",void 0),t([i({attribute:!1})],_i.prototype,"value",void 0),_i=t([n("frigate-card-key-assigner")],_i);const gi="cameras",bi="options",pi={cameras:{icon:"video",name:l("editor.cameras"),secondary:l("editor.cameras_secondary")},view:{icon:"eye",name:l("editor.view"),secondary:l("editor.view_secondary")},menu:{icon:"menu",name:l("editor.menu"),secondary:l("editor.menu_secondary")},status_bar:{icon:"sign-text",name:l("editor.status_bar"),secondary:l("editor.status_bar_secondary")},live:{icon:"cctv",name:l("editor.live"),secondary:l("editor.live_secondary")},media_gallery:{icon:"grid",name:l("editor.media_gallery"),secondary:l("editor.media_gallery_secondary")},media_viewer:{icon:"filmstrip",name:l("editor.media_viewer"),secondary:l("editor.media_viewer_secondary")},image:{icon:"image",name:l("editor.image"),secondary:l("editor.image_secondary")},timeline:{icon:"chart-gantt",name:l("editor.timeline"),secondary:l("editor.timeline_secondary")},dimensions:{icon:"aspect-ratio",name:l("editor.dimensions"),secondary:l("editor.dimensions_secondary")},performance:{icon:"speedometer",name:l("editor.performance"),secondary:l("editor.performance_secondary")},profiles:{icon:"folder-wrench-outline",name:l("editor.profiles"),secondary:l("editor.profiles_secondary")},overrides:{icon:"file-replace",name:l("editor.overrides"),secondary:l("editor.overrides_secondary")}};let vi=class extends s{constructor(){super(...arguments),this._defaults=m(di),this._initialized=!1,this._configUpgradeable=!1,this._expandedMenus={},this._viewModes=[{value:"",label:""},{value:"live",label:l("config.view.views.live")},{value:"clips",label:l("config.view.views.clips")},{value:"snapshots",label:l("config.view.views.snapshots")},{value:"recordings",label:l("config.view.views.recordings")},{value:"clip",label:l("config.view.views.clip")},{value:"snapshot",label:l("config.view.views.snapshot")},{value:"recording",label:l("config.view.views.recording")},{value:"image",label:l("config.view.views.image")},{value:"timeline",label:l("config.view.views.timeline")}],this._cameraSelectViewModes=[...this._viewModes,{value:"current",label:l("config.view.views.current")}],this._filterModes=[{value:"",label:""},{value:"none",label:l("config.common.controls.filter.modes.none")},{value:"left",label:l("config.common.controls.filter.modes.left")},{value:"right",label:l("config.common.controls.filter.modes.right")}],this._menuStyles=[{value:"",label:""},{value:"none",label:l("config.menu.styles.none")},{value:"hidden",label:l("config.menu.styles.hidden")},{value:"overlay",label:l("config.menu.styles.overlay")},{value:"hover",label:l("config.menu.styles.hover")},{value:"hover-card",label:l("config.menu.styles.hover-card")},{value:"outside",label:l("config.menu.styles.outside")}],this._menuPositions=[{value:"",label:""},{value:"left",label:l("config.menu.positions.left")},{value:"right",label:l("config.menu.positions.right")},{value:"top",label:l("config.menu.positions.top")},{value:"bottom",label:l("config.menu.positions.bottom")}],this._menuAlignments=[{value:"",label:""},{value:"left",label:l("config.menu.alignments.left")},{value:"right",label:l("config.menu.alignments.right")},{value:"top",label:l("config.menu.alignments.top")},{value:"bottom",label:l("config.menu.alignments.bottom")}],this._nextPreviousControlStyles=[{value:"",label:""},{value:"chevrons",label:l("config.common.controls.next_previous.styles.chevrons")},{value:"icons",label:l("config.common.controls.next_previous.styles.icons")},{value:"none",label:l("config.common.controls.next_previous.styles.none")},{value:"thumbnails",label:l("config.common.controls.next_previous.styles.thumbnails")}],this._aspectRatioModes=[{value:"",label:""},{value:"dynamic",label:l("config.dimensions.aspect_ratio_modes.dynamic")},{value:"static",label:l("config.dimensions.aspect_ratio_modes.static")},{value:"unconstrained",label:l("config.dimensions.aspect_ratio_modes.unconstrained")}],this._thumbnailModes=[{value:"",label:""},{value:"none",label:l("config.common.controls.thumbnails.modes.none")},{value:"above",label:l("config.common.controls.thumbnails.modes.above")},{value:"below",label:l("config.common.controls.thumbnails.modes.below")},{value:"left",label:l("config.common.controls.thumbnails.modes.left")},{value:"right",label:l("config.common.controls.thumbnails.modes.right")}],this._thumbnailMediaTypes=[{value:"",label:""},{value:"events",label:l("config.common.controls.thumbnails.media_types.events")},{value:"recordings",label:l("config.common.controls.thumbnails.media_types.recordings")}],this._thumbnailEventsMediaTypes=[{value:"",label:""},{value:"clips",label:l("config.common.controls.thumbnails.events_media_types.clips")},{value:"snapshots",label:l("config.common.controls.thumbnails.events_media_types.snapshots")}],this._transitionEffects=[{value:"",label:""},{value:"none",label:l("config.media_viewer.transition_effects.none")},{value:"slide",label:l("config.media_viewer.transition_effects.slide")}],this._imageModes=[{value:"",label:""},{value:"camera",label:l("config.common.image.modes.camera")},{value:"entity",label:l("config.common.image.modes.entity")},{value:"screensaver",label:l("config.common.image.modes.screensaver")},{value:"url",label:l("config.common.image.modes.url")}],this._timelineEventsMediaTypes=[{value:"",label:""},{value:"all",label:l("config.common.timeline.events_media_types.all")},{value:"clips",label:l("config.common.timeline.events_media_types.clips")},{value:"snapshots",label:l("config.common.timeline.events_media_types.snapshots")}],this._timelineStyleTypes=[{value:"",label:""},{value:"ribbon",label:l("config.common.timeline.styles.ribbon")},{value:"stack",label:l("config.common.timeline.styles.stack")}],this._darkModes=[{value:"",label:""},{value:"on",label:l("config.view.dark_modes.on")},{value:"off",label:l("config.view.dark_modes.off")},{value:"auto",label:l("config.view.dark_modes.auto")}],this._mediaActionNegativeConditions=[{value:"",label:""},{value:"unselected",label:l("config.common.media_action_conditions.unselected")},{value:"hidden",label:l("config.common.media_action_conditions.hidden")}],this._mediaActionPositiveConditions=[{value:"",label:""},{value:"selected",label:l("config.common.media_action_conditions.selected")},{value:"visible",label:l("config.common.media_action_conditions.visible")}],this._mediaLiveUnmuteConditions=[...this._mediaActionPositiveConditions,{value:"microphone",label:l("config.common.media_action_conditions.microphone_unmute")}],this._mediaLiveMuteConditions=[...this._mediaActionNegativeConditions,{value:"microphone",label:l("config.common.media_action_conditions.microphone_mute")}],this._layoutFits=[{value:"",label:""},{value:"contain",label:l("config.cameras.dimensions.layout.fits.contain")},{value:"cover",label:l("config.cameras.dimensions.layout.fits.cover")},{value:"fill",label:l("config.cameras.dimensions.layout.fits.fill")}],this._miniTimelineModes=[{value:"",label:""},{value:"none",label:l("config.common.controls.timeline.modes.none")},{value:"above",label:l("config.common.controls.timeline.modes.above")},{value:"below",label:l("config.common.controls.timeline.modes.below")}],this._profiles=[{value:"",label:""},{value:"casting",label:l("config.profiles.casting")},{value:"low-performance",label:l("config.profiles.low-performance")},{value:"scrubbing",label:l("config.profiles.scrubbing")}],this._go2rtcModes=[{value:"",label:""},{value:"mse",label:l("config.cameras.go2rtc.modes.mse")},{value:"webrtc",label:l("config.cameras.go2rtc.modes.webrtc")},{value:"mp4",label:l("config.cameras.go2rtc.modes.mp4")},{value:"mjpeg",label:l("config.cameras.go2rtc.modes.mjpeg")}],this._microphoneButtonTypes=[{value:"",label:""},{value:"momentary",label:l("config.menu.buttons.types.momentary")},{value:"toggle",label:l("config.menu.buttons.types.toggle")}],this._displayModes=[{value:"",label:""},{value:"single",label:l("display_modes.single")},{value:"grid",label:l("display_modes.grid")}],this._castMethods=[{value:"",label:""},{value:"standard",label:l("config.cameras.cast.methods.standard")},{value:"dashboard",label:l("config.cameras.cast.methods.dashboard")}],this._ptzModes=[{value:"",label:""},{value:"on",label:l("config.live.controls.ptz.modes.on")},{value:"off",label:l("config.live.controls.ptz.modes.off")}],this._ptzOrientations=[{value:"",label:""},{value:"vertical",label:l("config.live.controls.ptz.orientations.vertical")},{value:"horizontal",label:l("config.live.controls.ptz.orientations.horizontal")}],this._ptzPositions=[{value:"",label:""},{value:"top-left",label:l("config.live.controls.ptz.positions.top-left")},{value:"top-right",label:l("config.live.controls.ptz.positions.top-right")},{value:"bottom-left",label:l("config.live.controls.ptz.positions.bottom-left")},{value:"bottom-right",label:l("config.live.controls.ptz.positions.bottom-right")}],this._triggersActionsInteractionModes=[{value:"",label:""},{value:"all",label:l("config.view.triggers.actions.interaction_modes.all")},{value:"inactive",label:l("config.view.triggers.actions.interaction_modes.inactive")},{value:"active",label:l("config.view.triggers.actions.interaction_modes.active")}],this._triggersActionsTrigger=[{value:"",label:""},{value:"default",label:l("config.view.triggers.actions.triggers.default")},{value:"live",label:l("config.view.triggers.actions.triggers.live")},{value:"media",label:l("config.view.triggers.actions.triggers.media")},{value:"none",label:l("config.view.triggers.actions.triggers.none")}],this._triggersActionsUntrigger=[{value:"",label:""},{value:"default",label:l("config.view.triggers.actions.untriggers.default")},{value:"none",label:l("config.view.triggers.actions.untriggers.none")}],this._triggersEvents=[{value:"",label:""},{value:"events",label:l("config.cameras.triggers.events.events")},{value:"clips",label:l("config.cameras.triggers.events.clips")},{value:"snapshots",label:l("config.cameras.triggers.events.snapshots")}],this._timelinePanModes=[{value:"",label:""},{value:"pan",label:l("config.common.controls.timeline.pan_modes.pan")},{value:"seek",label:l("config.common.controls.timeline.pan_modes.seek")},{value:"seek-in-media",label:l("config.common.controls.timeline.pan_modes.seek-in-media")},{value:"seek-in-camera",label:l("config.common.controls.timeline.pan_modes.seek-in-camera")}],this._capabilities=[{value:"",label:""},{value:"live",label:l("config.cameras.capabilities.capabilities.live")},{value:"substream",label:l("config.cameras.capabilities.capabilities.substream")},{value:"clips",label:l("config.cameras.capabilities.capabilities.clips")},{value:"recordings",label:l("config.cameras.capabilities.capabilities.recordings")},{value:"snapshots",label:l("config.cameras.capabilities.capabilities.snapshots")},{value:"favorite-events",label:l("config.cameras.capabilities.capabilities.favorite-events")},{value:"favorite-recordings",label:l("config.cameras.capabilities.capabilities.favorite-recordings")},{value:"seek",label:l("config.cameras.capabilities.capabilities.seek")},{value:"ptz",label:l("config.cameras.capabilities.capabilities.ptz")},{value:"menu",label:l("config.cameras.capabilities.capabilities.menu")}],this._defaultResetInteractionModes=[{value:"",label:""},{value:"all",label:l("config.view.default_reset.interaction_modes.all")},{value:"inactive",label:l("config.view.default_reset.interaction_modes.inactive")},{value:"active",label:l("config.view.default_reset.interaction_modes.active")}],this._proxyMedia=[{value:"",label:""},{value:"auto",label:l("config.cameras.proxy.media.auto")},{value:!0,label:l("config.cameras.proxy.media.true")},{value:!1,label:l("config.cameras.proxy.media.false")}],this._proxySSLCiphers=[{value:"",label:""},{value:"auto",label:l("config.cameras.proxy.ssl_ciphers.auto")},{value:"default",label:l("config.cameras.proxy.ssl_ciphers.default")},{value:"insecure",label:l("config.cameras.proxy.ssl_ciphers.insecure")},{value:"intermediate",label:l("config.cameras.proxy.ssl_ciphers.intermediate")},{value:"modern",label:l("config.cameras.proxy.ssl_ciphers.modern")}],this._proxySSLVerification=[{value:"",label:""},{value:"auto",label:l("config.cameras.proxy.ssl_verification.auto")},{value:!0,label:l("config.cameras.proxy.ssl_verification.true")},{value:!1,label:l("config.cameras.proxy.ssl_verification.false")}],this._reolinkMediaResolution=[{value:"",label:""},{value:"high",label:l("config.cameras.reolink.media_resolution.high")},{value:"low",label:l("config.cameras.reolink.media_resolution.low")}],this._statusBarStyles=[{value:"",label:""},{value:"hover",label:l("config.status_bar.styles.hover")},{value:"hover-card",label:l("config.status_bar.styles.hover-card")},{value:"none",label:l("config.status_bar.styles.none")},{value:"outside",label:l("config.status_bar.styles.outside")},{value:"overlay",label:l("config.status_bar.styles.overlay")},{value:"popup",label:l("config.status_bar.styles.popup")}],this._statusBarPositions=[{value:"",label:""},{value:"top",label:l("config.status_bar.positions.top")},{value:"bottom",label:l("config.status_bar.positions.bottom")}]}setConfig(e){this._config=e,this._configUpgradeable=u(e);const a=h.safeParse(this._config.profiles);if(a.success){const e=m(di);_(this._config,e,a.data),this._defaults=e}}willUpdate(){this._initialized||g().then((e=>{e&&(this._initialized=!0)}))}_renderOptionSetHeader(e,a){const t=pi[e];return o` +
+
+ +
${t.name}
+
+
${t.secondary}
+
+ `}_getLabel(e){const a=e.split(".").filter((e=>!e.match(/^\[[0-9]+\]$/))).join(".");return l(`config.${a}`)}_renderEntitySelector(e,a){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderOptionSelector(e,a=[],t){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderIconSelector(e,a){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderNumberInput(e,a){if(!this._config)return;const t=b(this._config,e),i=void 0===a?.max?"box":"slider";return o` + this._valueChangedHandler(e,a)} + > + + `}_renderInfo(e){return o` ${e}`}_getEditorCameraTitle(e,a){return"string"==typeof a?.title&&a.title||("string"==typeof a?.camera_entity?p(this.hass,a.camera_entity):"")||"object"==typeof a?.webrtc_card&&a.webrtc_card&&"string"==typeof a.webrtc_card.entity&&a.webrtc_card.entity||("object"==typeof a?.frigate&&a.frigate&&"string"==typeof a?.frigate.camera_name&&a.frigate.camera_name?v(a.frigate.camera_name):"")||"string"==typeof a?.id&&a.id||l("editor.camera")+" #"+e}_renderViewDefaultResetMenu(){return this._putInSubmenu("view.default_reset",!0,`config.${f}.editor_label`,"mdi:restart",o` + ${this._renderSwitch($,this._defaults.view.default_reset.after_interaction)} + ${this._renderNumberInput(y)} + ${this._renderOptionSelector(w,this._defaultResetInteractionModes,{label:l("config.view.default_reset.interaction_mode")})}, + ${this._renderOptionSelector(S,this.hass?x(this.hass):[],{multiple:!0})} + `)}_renderViewTriggersMenu(){return this._putInSubmenu("view.triggers",!0,`config.${M}.editor_label`,"mdi:target-account",o` + ${this._renderSwitch(I,this._defaults.view.triggers.filter_selected_camera,{label:l(`config.${I}`)})} + ${this._renderSwitch(k,this._defaults.view.triggers.show_trigger_status,{label:l(`config.${k}`)})} + ${this._renderNumberInput(O,{default:this._defaults.view.triggers.untrigger_seconds})} + ${this._putInSubmenu("view.triggers.actions",!0,`config.${C}.editor_label`,"mdi:cogs",o` ${this._renderOptionSelector(z,this._triggersActionsTrigger,{label:l("config.view.triggers.actions.trigger")})} + ${this._renderOptionSelector(A,this._triggersActionsUntrigger,{label:l("config.view.triggers.actions.untrigger")})} + ${this._renderOptionSelector(N,this._triggersActionsInteractionModes,{label:l("config.view.triggers.actions.interaction_mode")})}`)} + `)}_renderKeyAssigner(e,a){return o` this._valueChangedHandler(e,a)} + >`}_renderViewKeyboardShortcutMenu(){return this._putInSubmenu("view.keyboard_shortcuts",!0,`config.${T}.editor_label`,"mdi:keyboard",o` + ${this._renderSwitch(B,this._defaults.view.keyboard_shortcuts.enabled,{label:l(`config.${B}`)})} + ${this._renderKeyAssigner(E,this._defaults.view.keyboard_shortcuts.ptz_left)} + ${this._renderKeyAssigner(P,this._defaults.view.keyboard_shortcuts.ptz_right)} + ${this._renderKeyAssigner(H,this._defaults.view.keyboard_shortcuts.ptz_up)} + ${this._renderKeyAssigner(L,this._defaults.view.keyboard_shortcuts.ptz_down)} + ${this._renderKeyAssigner(V,this._defaults.view.keyboard_shortcuts.ptz_zoom_in)} + ${this._renderKeyAssigner(K,this._defaults.view.keyboard_shortcuts.ptz_zoom_out)} + ${this._renderKeyAssigner(U,this._defaults.view.keyboard_shortcuts.ptz_home)} + `)}_renderStatusBarItem(e){return o` ${this._putInSubmenu("status_bar.items",e,`config.status_bar.items.${e}`,"mdi:feature-search",o` + ${this._renderSwitch(`${j}.${e}.enabled`,this._defaults.status_bar.items[e]?.enabled??!0,{label:l("config.status_bar.items.enabled")})} + ${this._renderNumberInput(`${j}.${e}.priority`,{max:q,default:this._defaults.status_bar.items[e]?.priority,label:l("config.status_bar.items.priority")})} + `)}`}_renderMenuButton(e,a){const t=[{value:"",label:""},{value:"matching",label:l("config.menu.buttons.alignments.matching")},{value:"opposing",label:l("config.menu.buttons.alignments.opposing")}];return o` ${this._putInSubmenu("menu.buttons",e,`config.menu.buttons.${e}`,"mdi:gesture-tap-button",o` + ${this._renderSwitch(`${R}.${e}.enabled`,this._defaults.menu.buttons[e]?.enabled??!0,{label:l("config.menu.buttons.enabled")})} + ${this._renderOptionSelector(`${R}.${e}.alignment`,t,{label:l("config.menu.buttons.alignment")})} + ${this._renderSwitch(`${R}.${e}.permanent`,this._defaults.menu.buttons[e]?.permanent??!1,{label:l("config.menu.buttons.permanent")})} + ${this._renderNumberInput(`${R}.${e}.priority`,{max:D,default:this._defaults.menu.buttons[e]?.priority,label:l("config.menu.buttons.priority")})} + ${this._renderIconSelector(`${R}.${e}.icon`,{label:l("config.menu.buttons.icon")})} + ${a} + `)}`}_putInSubmenu(e,a,t,i,n){const s=this._expandedMenus[e]===a,c={submenu:!0,selected:s},d=dt(i);return o`
+ + ${s?o`
${n}
`:""} +
`}_renderMediaLayout(e,a,t,i,n,s,r,c,d,m,u,h){return this._putInSubmenu(e,!0,a,"mdi:page-layout-body",o` + ${this._renderNumberInput(m,{min:0,max:10,label:l("config.cameras.dimensions.layout.zoom"),step:.1})} + ${this._renderNumberInput(u,{min:0,max:100,label:l("config.cameras.dimensions.layout.pan.x")})} + ${this._renderNumberInput(h,{min:0,max:100,label:l("config.cameras.dimensions.layout.pan.y")})} + ${this._renderOptionSelector(t,this._layoutFits,{label:l("config.cameras.dimensions.layout.fit")})} + ${this._putInSubmenu(`${e}.position`,!0,"config.cameras.dimensions.layout.position.editor_label","mdi:aspect-ratio",o` ${this._renderNumberInput(i,{min:0,max:100,label:l("config.cameras.dimensions.layout.position.x")})} + ${this._renderNumberInput(n,{min:0,max:100,label:l("config.cameras.dimensions.layout.position.y")})}`)} + ${this._putInSubmenu(`${e}.view_box`,!0,"config.cameras.dimensions.layout.view_box.editor_label","mdi:crop",o` + ${this._renderNumberInput(s,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.top")})} + ${this._renderNumberInput(r,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.bottom")})} + ${this._renderNumberInput(c,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.left")})} + ${this._renderNumberInput(d,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.right")})} + `)} + `)}_renderTimelineCoreControls(e,a,t,i,n,s,r){return o` + ${this._renderOptionSelector(e,this._timelineStyleTypes,{label:l(`config.common.${F}`)})} + ${r?this._renderOptionSelector(r,this._timelinePanModes,{label:l("config.common.controls.timeline.pan_mode")}):""} + ${this._renderNumberInput(a,{label:l(`config.common.${G}`)})} + ${this._renderNumberInput(t,{label:l(`config.common.${J}`)})} + ${this._renderOptionSelector(i,this._timelineEventsMediaTypes,{label:l(`config.common.${Q}`)})} + ${this._renderSwitch(n,s,{label:l(`config.common.${W}`)})} + `}_renderMiniTimeline(e,a,t,i,n,s,r,c,d){return this._putInSubmenu(e,!0,"config.common.controls.timeline.editor_label","mdi:chart-gantt",o` ${this._renderOptionSelector(a,this._miniTimelineModes,{label:l("config.common.controls.timeline.mode")})} + ${this._renderTimelineCoreControls(t,i,n,s,r,c,d)}`)}_renderViewDisplay(e,a,t,i,n){return this._putInSubmenu(e,!0,"config.common.display.editor_label","mdi:palette-swatch",o` + ${this._renderOptionSelector(a,this._displayModes,{label:l("config.common.display.mode")})} + ${this._renderNumberInput(t,{min:0,label:l("config.common.display.grid_selected_width_factor")})} + ${this._renderNumberInput(i,{min:0,label:l("config.common.display.grid_columns")})} + ${this._renderNumberInput(n,{min:0,label:l("config.common.display.grid_max_columns")})} + `)}_renderNextPreviousControls(e,a,t,i){return this._putInSubmenu(e,!0,"config.common.controls.next_previous.editor_label","mdi:arrow-right-bold-circle",o` + ${this._renderOptionSelector(a,this._nextPreviousControlStyles.filter((e=>!(!i?.allowThumbnails&&"thumbnails"===e.value||!i?.allowIcons&&"icons"===e.value))),{label:l("config.common.controls.next_previous.style")})} + ${this._renderNumberInput(t,{min:X,label:l("config.common.controls.next_previous.size")})} + `)}_renderThumbnailsControls(e,a,t,i,n,s,r,c){return this._putInSubmenu(e,!0,"config.common.controls.thumbnails.editor_label","mdi:image-text",o` + ${c?.configPathMode?o`${this._renderOptionSelector(c.configPathMode,this._thumbnailModes,{label:l("config.common.controls.thumbnails.mode")})}`:o``} + ${c?.configPathMediaType?o`${this._renderOptionSelector(c.configPathMediaType,this._thumbnailMediaTypes,{label:l("config.common.controls.thumbnails.media_type")})}`:o``} + ${c?.configPathEventsMediaType?o`${this._renderOptionSelector(c.configPathEventsMediaType,this._thumbnailEventsMediaTypes,{label:l("config.common.controls.thumbnails.events_media_type")})}`:o``} + ${this._renderNumberInput(a,{min:Y,max:Z,label:l("config.common.controls.thumbnails.size")})} + ${this._renderSwitch(t,r.show_details,{label:l("config.common.controls.thumbnails.show_details")})} + ${this._renderSwitch(i,r.show_favorite_control,{label:l("config.common.controls.thumbnails.show_favorite_control")})} + ${this._renderSwitch(n,r.show_timeline_control,{label:l("config.common.controls.thumbnails.show_timeline_control")})} + ${this._renderSwitch(s,r.show_download_control,{label:l("config.common.controls.thumbnails.show_download_control")})} + `)}_renderFilterControls(e,a){return this._putInSubmenu(e,!0,"config.common.controls.filter.editor_label","mdi:filter-cog",o` + ${a?o`${this._renderOptionSelector(a,this._filterModes,{label:l("config.common.controls.filter.mode")})}`:o``} + `)}_renderImageOptions(e,a,t,i,n){return o` + ${this._renderOptionSelector(e,this._imageModes,{label:l("config.common.image.mode")})} + ${this._renderStringInput(a,{label:l("config.common.image.url")})} + ${this._renderOptionSelector(t,this.hass?x(this.hass):[],{label:l("config.common.image.entity")})} + ${this._renderStringInput(i,{label:l("config.common.image.entity_parameters")})} + ${this._renderNumberInput(n,{label:l("config.common.image.refresh_seconds")})} + `}_renderCamera(e,a,t,i){const n=[{value:"",label:""},{value:"auto",label:l("config.cameras.live_providers.auto")},{value:"ha",label:l("config.cameras.live_providers.ha")},{value:"image",label:l("config.cameras.live_providers.image")},{value:"jsmpeg",label:l("config.cameras.live_providers.jsmpeg")},{value:"go2rtc",label:l("config.cameras.live_providers.go2rtc")},{value:"webrtc-card",label:l("config.cameras.live_providers.webrtc-card")}],s=[];e.forEach(((e,t)=>{t!==a&&s.push({value:ee(e),label:this._getEditorCameraTitle(t,e)})}));const c=e=>{if(this._config){const a=m(this._config);e(a)&&this._updateConfig(a)}},d={submenu:!0,selected:this._expandedMenus[gi]===a};return o` +
+ + ${this._expandedMenus[gi]===a?o`
+
+ !i&&c((e=>!!(Array.isArray(e.cameras)&&a>0)&&(mt(e.cameras,a,a-1),this._openMenu(gi,a-1),!0)))} + > + + + =this._config.cameras.length-1} + @click=${()=>!i&&c((e=>!!(Array.isArray(e.cameras)&&a + + + {c((e=>!!Array.isArray(e.cameras)&&(e.cameras.splice(a,1),this._closeMenu(gi),!0)))}} + > + + +
+ ${this._renderEntitySelector(ae(ut,a),"camera")} + ${this._renderOptionSelector(ae(ht,a),n)} + ${this._renderStringInput(ae(_t,a))} + ${this._renderIconSelector(ae(gt,a),{label:l("config.cameras.icon")})} + ${this._renderStringInput(ae(bt,a))} + ${this._putInSubmenu("cameras.engine",!0,"config.cameras.engines.editor_label","mdi:engine",o`${this._putInSubmenu("cameras.frigate",a,"config.cameras.frigate.editor_label","frigate",o` + ${this._renderStringInput(ae(pt,a))} + ${this._renderStringInput(ae(vt,a))} + ${this._renderOptionSelector(ae(ft,a),[],{multiple:!0,label:l("config.cameras.frigate.labels")})} + ${this._renderOptionSelector(ae($t,a),[],{multiple:!0,label:l("config.cameras.frigate.zones")})} + ${this._renderStringInput(ae(yt,a))} + `)} + ${this._putInSubmenu("cameras.motioneye",a,"config.cameras.motioneye.editor_label","motioneye",o` ${this._renderStringInput(ae(wt,a))} + ${this._renderStringInput(ae(St,a))} + ${this._renderStringInput(ae(xt,a))} + ${this._renderStringInput(ae(Mt,a))} + ${this._renderStringInput(ae(It,a))}`)} + ${this._putInSubmenu("cameras.reolink",a,"config.cameras.reolink.editor_label","reolink",o` ${this._renderStringInput(ae(kt,a))} + ${this._renderOptionSelector(ae(Ot,a),this._reolinkMediaResolution,{label:l("config.cameras.reolink.media_resolution.editor_label")})}`)}`)} + ${this._putInSubmenu("cameras.live_provider",!0,"config.cameras.live_provider_options.editor_label","mdi:cctv",o` ${this._putInSubmenu("cameras.go2rtc",a,"config.cameras.go2rtc.editor_label","mdi:alpha-g-circle",o`${this._renderOptionSelector(ae(Ct,a),this._go2rtcModes,{multiple:!0,label:l("config.cameras.go2rtc.modes.editor_label")})} + ${this._renderStringInput(ae(zt,a))}`)} + ${this._putInSubmenu("cameras.image",!0,"config.cameras.image.editor_label","mdi:image",this._renderImageOptions(ae(At,a),ae(Nt,a),ae(Tt,a),ae(Bt,a),ae(Et,a)))} + ${this._putInSubmenu("cameras.webrtc_card",a,"config.cameras.webrtc_card.editor_label","mdi:webrtc",o`${this._renderEntitySelector(ae(Pt,a),"camera")} + ${this._renderStringInput(ae(Ht,a))}`)}`)} + ${this._putInSubmenu("cameras.dependencies",a,"config.cameras.dependencies.editor_label","mdi:graph",o` ${this._renderSwitch(ae(Lt,a),this._defaults.cameras.dependencies.all_cameras)} + ${this._renderOptionSelector(ae(Vt,a),s,{multiple:!0})}`)} + ${this._putInSubmenu("cameras.triggers",a,"config.cameras.triggers.editor_label","mdi:magnify-scan",o` + ${this._renderSwitch(ae(Kt,a),this._defaults.cameras.triggers.occupancy)} + ${this._renderSwitch(ae(Ut,a),this._defaults.cameras.triggers.motion)} + ${this._renderOptionSelector(ae(jt,a),t,{multiple:!0})} + ${this._renderOptionSelector(ae(qt,a),this._triggersEvents,{multiple:!0,label:l("config.cameras.triggers.events.editor_label")})} + `)} + ${this._putInSubmenu("cameras.cast",a,"config.cameras.cast.editor_label","mdi:cast",o` + ${this._renderOptionSelector(ae(Rt,a),this._castMethods)} + ${this._renderStringInput(ae(Dt,a))} + ${this._renderStringInput(ae(Ft,a))} + `)} + ${this._putInSubmenu("cameras.dimensions",a,"config.cameras.dimensions.editor_label","mdi:aspect-ratio",o` + ${this._renderStringInput(ae(Gt,a))} + ${this._renderMediaLayout("cameras.dimensions.layout","config.cameras.dimensions.layout.editor_label",ae(Jt,a),ae(Qt,a),ae(Wt,a),ae(Xt,a),ae(Yt,a),ae(Zt,a),ae(ei,a),ae(ai,a),ae(ti,a),ae(ii,a))} + `)} + ${this._putInSubmenu("cameras.capabilities",a,"config.cameras.capabilities.editor_label","mdi:cog-stop",o` + ${this._renderOptionSelector(ae(ni,a),this._capabilities,{multiple:!0})} + ${this._renderOptionSelector(ae(si,a),this._capabilities,{multiple:!0})} + `)} + ${this._putInSubmenu("cameras.proxy",a,"config.cameras.proxy.editor_label","mdi:arrow-decision",o` + ${this._renderOptionSelector(ae(oi,a),this._proxyMedia,{label:l("config.cameras.proxy.media.editor_label")})} + ${this._renderSwitch(ae(ri,a),this._defaults.cameras.proxy.dynamic)} + ${this._renderOptionSelector(ae(li,a),this._proxySSLVerification,{label:l("config.cameras.proxy.ssl_verification.editor_label")})} + ${this._renderOptionSelector(ae(ci,a),this._proxySSLCiphers,{label:l("config.cameras.proxy.ssl_ciphers.editor_label")})} + `)} +
`:""} +
+ `}_renderStringInput(e,a){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderSwitch(e,a,t){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_updateConfig(e){this._config=e,te(this,"config-changed",{config:this._config})}render(){if(!this.hass||!this._config)return o``;const e=x(this.hass),a=b(this._config,mi)||[];return o` + ${this._configUpgradeable?o`
+ ${l("editor.upgrade_available")} + + {if(this._config){const e=m(this._config);ie(e),this._updateConfig(e)}}} + > + + +
+
`:o``} +
+ ${this._renderOptionSetHeader("cameras")} + ${"cameras"===this._expandedMenus[bi]?o` +
+ ${a.map(((t,i)=>this._renderCamera(a,i,e)))} + ${this._renderCamera(a,a.length,e,!0)} +
+ `:""} + ${this._renderOptionSetHeader("profiles")} + ${"profiles"===this._expandedMenus[bi]?o`
+ ${this._renderOptionSelector(ne,this._profiles,{multiple:!0,label:l("config.profiles.editor_label")})} +
`:""} + ${this._renderOptionSetHeader("view")} + ${"view"===this._expandedMenus[bi]?o` +
+ ${this._renderOptionSelector(se,this._viewModes)} + ${this._renderOptionSelector(oe,this._cameraSelectViewModes)} + ${this._renderOptionSelector(re,this._darkModes)} + ${this._renderNumberInput(le)} + ${this._renderSwitch(ce,this._defaults.view.default_cycle_camera)} + ${this._renderViewDefaultResetMenu()} ${this._renderViewTriggersMenu()} + ${this._renderViewKeyboardShortcutMenu()} +
+ `:""} + ${this._renderOptionSetHeader("menu")} + ${"menu"===this._expandedMenus[bi]?o` +
+ ${this._renderOptionSelector(de,this._menuStyles)} + ${this._renderOptionSelector(me,this._menuPositions)} + ${this._renderOptionSelector(ue,this._menuAlignments)} + ${this._renderNumberInput(he,{min:X})} + ${this._renderMenuButton("frigate")} + ${this._renderMenuButton("cameras")} + ${this._renderMenuButton("substreams")} + ${this._renderMenuButton("live")} + ${this._renderMenuButton("clips")} + ${this._renderMenuButton("snapshots")} + ${this._renderMenuButton("recordings")} + ${this._renderMenuButton("image")} + ${this._renderMenuButton("download")} + ${this._renderMenuButton("camera_ui")} + ${this._renderMenuButton("fullscreen")} + ${this._renderMenuButton("expand")} + ${this._renderMenuButton("timeline")} + ${this._renderMenuButton("media_player")} + ${this._renderMenuButton("microphone",o`${this._renderOptionSelector(`${R}.microphone.type`,this._microphoneButtonTypes,{label:l("config.menu.buttons.type")})}`)} + ${this._renderMenuButton("play")} + ${this._renderMenuButton("mute")} + ${this._renderMenuButton("screenshot")} + ${this._renderMenuButton("display_mode")} + ${this._renderMenuButton("ptz_controls")} + ${this._renderMenuButton("ptz_home")} +
+ `:""} + ${this._renderOptionSetHeader("status_bar")} + ${"status_bar"===this._expandedMenus[bi]?o` +
+ ${this._renderOptionSelector(_e,this._statusBarStyles)} + ${this._renderOptionSelector(ge,this._statusBarPositions)} + ${this._renderNumberInput(be,{min:pe,label:l("config.status_bar.height")})} + ${this._renderNumberInput(ve,{min:0,max:60,default:this._defaults.status_bar.popup_seconds,label:l("config.status_bar.popup_seconds")})} + ${this._renderStatusBarItem("title")} + ${this._renderStatusBarItem("resolution")} + ${this._renderStatusBarItem("technology")} + ${this._renderStatusBarItem("engine")} +
+ `:""} + ${this._renderOptionSetHeader("live")} + ${"live"===this._expandedMenus[bi]?o` +
+ ${this._renderSwitch(fe,this._defaults.live.preload)} + ${this._renderSwitch($e,this._defaults.live.draggable)} + ${this._renderSwitch(ye,this._defaults.live.zoomable)} + ${this._renderSwitch(we,this._defaults.live.lazy_load)} + ${this._renderOptionSelector(Se,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(xe,this._mediaActionPositiveConditions,{multiple:!0})} + ${this._renderOptionSelector(Me,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(Ie,this._mediaLiveMuteConditions,{multiple:!0})} + ${this._renderOptionSelector(ke,this._mediaLiveUnmuteConditions,{multiple:!0})} + ${this._renderOptionSelector(Oe,this._transitionEffects)} + ${this._renderSwitch(Ce,this._defaults.live.show_image_during_load)} + ${this._renderViewDisplay("live.display",ze,Ae,Ne,Te)} + ${this._putInSubmenu("live.controls",!0,"config.live.controls.editor_label","mdi:gamepad",o` + ${this._renderSwitch(Be,this._defaults.live.controls.builtin,{label:l("config.common.controls.builtin")})} + ${this._renderNextPreviousControls("live.controls.next_previous",Ee,Pe,{allowIcons:!0})} + ${this._renderThumbnailsControls("live.controls.thumbnails",He,Le,Ve,Ke,Ue,this._defaults.live.controls.thumbnails,{configPathMediaType:je,configPathEventsMediaType:qe,configPathMode:Re})} + ${this._renderMiniTimeline("live.controls.timeline",De,Fe,Ge,Je,Qe,We,this._defaults.live.controls.timeline.show_recordings,Xe)} + ${this._putInSubmenu("live.controls.ptz",!0,"config.live.controls.ptz.editor_label","mdi:pan",o` + ${this._renderOptionSelector(Ye,this._ptzModes)} + ${this._renderOptionSelector(Ze,this._ptzPositions)} + ${this._renderOptionSelector(ea,this._ptzOrientations)} + ${this._renderSwitch(aa,this._defaults.live.controls.ptz.hide_pan_tilt,{label:l("config.live.controls.ptz.hide_pan_tilt")})} + ${this._renderSwitch(ta,this._defaults.live.controls.ptz.hide_pan_tilt,{label:l("config.live.controls.ptz.hide_zoom")})} + ${this._renderSwitch(ia,this._defaults.live.controls.ptz.hide_home,{label:l("config.live.controls.ptz.hide_home")})} + `)} + `)} + ${this._putInSubmenu("live.microphone",!0,"config.live.microphone.editor_label","mdi:microphone",o` + ${this._renderNumberInput(na)} + ${this._renderSwitch(sa,this._defaults.live.microphone.always_connected)} + ${this._renderNumberInput(oa)} + `)} +
+ `:""} + ${this._renderOptionSetHeader("media_gallery")} + ${"media_gallery"===this._expandedMenus[bi]?o`
+ ${this._renderThumbnailsControls("media_gallery.controls.thumbnails",ra,la,ca,da,ma,this._defaults.media_gallery.controls.thumbnails)} + ${this._renderFilterControls("media_gallery.controls.filter",ua)} +
`:""} + ${this._renderOptionSetHeader("media_viewer")} + ${"media_viewer"===this._expandedMenus[bi]?o`
+ ${this._renderOptionSelector(ha,this._mediaActionPositiveConditions,{multiple:!0})} + ${this._renderOptionSelector(_a,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(ga,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(ba,this._mediaActionPositiveConditions,{multiple:!0})} + ${this._renderSwitch(pa,this._defaults.media_viewer.draggable)} + ${this._renderSwitch(va,this._defaults.media_viewer.zoomable)} + ${this._renderSwitch(fa,this._defaults.media_viewer.lazy_load)} + ${this._renderOptionSelector($a,this._transitionEffects)} + ${this._renderSwitch(ya,this._defaults.media_viewer.snapshot_click_plays_clip)} + ${this._renderViewDisplay("media_viewer.display",wa,Sa,xa,Ma)} + ${this._putInSubmenu("media_viewer.controls",!0,"config.media_viewer.controls.editor_label","mdi:gamepad",o` + ${this._renderSwitch(Ia,this._defaults.media_viewer.controls.builtin,{label:l("config.common.controls.builtin")})} + ${this._renderNextPreviousControls("media_viewer.controls.next_previous",ka,Oa,{allowThumbnails:!0})} + ${this._renderThumbnailsControls("media_viewer.controls.thumbnails",Ca,za,Aa,Na,Ta,this._defaults.media_viewer.controls.thumbnails,{configPathMode:Ba})} + ${this._renderMiniTimeline("media_viewer.controls.timeline",Ea,Pa,Ha,La,Va,Ka,this._defaults.media_viewer.controls.timeline.show_recordings,Ua)} + `)} +
`:""} + ${this._renderOptionSetHeader("image")} + ${"image"===this._expandedMenus[bi]?o`
+ ${this._renderImageOptions(ja,qa,Ra,Da,Fa)} +
`:""} + ${this._renderOptionSetHeader("timeline")} + ${"timeline"===this._expandedMenus[bi]?o`
+ ${this._renderTimelineCoreControls(F,G,J,Q,W,this._defaults.timeline.show_recordings)} + ${this._renderThumbnailsControls("timeline.controls.thumbnails",Ga,Ja,Qa,Wa,Xa,this._defaults.timeline.controls.thumbnails,{configPathMode:Ya})} +
`:""} + ${this._renderOptionSetHeader("dimensions")} + ${"dimensions"===this._expandedMenus[bi]?o`
+ ${this._renderOptionSelector(Za,this._aspectRatioModes)} + ${this._renderStringInput(et)} + ${this._renderStringInput(at)} +
`:""} + ${this._renderOptionSetHeader("performance","low"===b(this._config,ui)?"warning":void 0)} + ${"performance"===this._expandedMenus[bi]?o`
+ ${"low"===b(this._config,ui)?this._renderInfo(l("config.performance.warning")):o``} + ${this._putInSubmenu("performance.features",!0,"config.performance.features.editor_label","mdi:feature-search",o` + ${this._renderSwitch(tt,this._defaults.performance.features.animated_progress_indicator)} + ${this._renderNumberInput(it,{max:nt})} + ${this._renderNumberInput(st,{min:1})} + `)} + ${this._putInSubmenu("performance.style",!0,"config.performance.style.editor_label","mdi:palette-swatch-variant",o` + ${this._renderSwitch(ot,this._defaults.performance.style.border_radius)} + ${this._renderSwitch(rt,this._defaults.performance.style.box_shadow)} + `)} +
`:""} + ${void 0!==this._config.overrides?o` ${this._renderOptionSetHeader("overrides")} + ${"overrides"===this._expandedMenus[bi]?o`
+ ${this._renderInfo(l("config.overrides.info"))} +
`:""}`:o``} +
+ `}_closeMenu(e){delete this._expandedMenus[e],this.requestUpdate()}_openMenu(e,a){this._expandedMenus[e]=a,this.requestUpdate()}_toggleMenu(e){if(e&&e.target){const a=e.target.domain,t=e.target.key;this._expandedMenus[a]===t?this._closeMenu(a):this._openMenu(a,t)}}_valueChangedHandler(e,a){if(!this._config||!this.hass)return;let t;if(a.detail&&void 0!==a.detail.value&&(t=a.detail.value,"string"==typeof t&&(t=t.trim())),b(this._config,e)===t)return;const i=m(this._config);""===t||void 0===t?lt(i,e):ct(i,e,t),this._updateConfig(i)}static get styles(){return c('ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n.option {\n padding: 4px 4px;\n cursor: pointer;\n}\n\n.option.option-overrides .title {\n color: var(--warning-color);\n}\n\n.row {\n display: flex;\n margin-bottom: -14px;\n pointer-events: none;\n}\n\n.title {\n padding-left: 16px;\n margin-top: -6px;\n pointer-events: none;\n}\n\n.title.warning {\n color: var(--warning-color);\n}\n\n.secondary {\n padding-left: 40px;\n color: var(--secondary-text-color);\n pointer-events: none;\n}\n\n.values {\n background: var(--secondary-background-color);\n display: grid;\n}\n\n.values + .option,\n.submenu + .option {\n margin-top: 10px;\n}\n\ndiv.upgrade {\n width: auto;\n border: 1px dotted var(--primary-color);\n margin: 10px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\ndiv.upgrade span {\n padding: 10px;\n}\n\n.submenu-header {\n display: flex;\n padding: 10px;\n cursor: pointer;\n}\n\n.submenu.selected > .submenu-header {\n background-color: var(--primary-color);\n color: var(--primary-text-color);\n}\n\n.submenu-header * {\n flex-basis: auto;\n pointer-events: none;\n}\n\n.submenu-header .new-camera {\n font-style: italic;\n}\n\n.submenu:not(.selected) > .submenu-header .new-camera {\n color: var(--secondary-text-color, "black");\n}\n\n.submenu-header ha-icon,\n.submenu-header img {\n padding-right: 15px;\n}\n\n.submenu.selected {\n border: 1px solid var(--primary-color);\n}\n\n.submenu {\n width: calc(100% - 20px);\n margin-left: auto;\n margin-right: auto;\n margin-bottom: 10px;\n}\n\n.submenu:first-child,\n:not(.submenu) + .submenu {\n margin-top: 10px;\n}\n\n.submenu .controls {\n display: inline-block;\n margin-left: auto;\n margin-right: 0px;\n margin-bottom: 5px;\n}\n\n.submenu .controls ha-icon-button.button {\n --mdc-icon-button-size: 32px;\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n}\n\nspan.info {\n padding: 10px;\n}\n\nha-selector {\n padding: 10px;\n border: 1px solid var(--divider-color);\n}')}};t([i({attribute:!1})],vi.prototype,"hass",void 0),t([d()],vi.prototype,"_config",void 0),t([d()],vi.prototype,"_defaults",void 0),t([d()],vi.prototype,"_expandedMenus",void 0),vi=t([n("frigate-card-editor")],vi);export{vi as FrigateCardEditor}; diff --git a/config/www/community/frigate-hass-card/editor-c3e576d8.js.gz b/config/www/community/frigate-hass-card/editor-c3e576d8.js.gz new file mode 100644 index 00000000..8dc7cbdf Binary files /dev/null and b/config/www/community/frigate-hass-card/editor-c3e576d8.js.gz differ diff --git a/config/www/community/frigate-hass-card/editor-ce460dd0.js b/config/www/community/frigate-hass-card/editor-ce460dd0.js new file mode 100644 index 00000000..74131d68 --- /dev/null +++ b/config/www/community/frigate-hass-card/editor-ce460dd0.js @@ -0,0 +1,462 @@ +import{i as e,s as a,_ as t,n as i,t as n,a as s,x as o,e as r,l,r as c,b as d,c as m,d as u,p as h,f as _,g,h as b,j as p,k as v,C as f,m as $,o as y,q as w,u as S,v as x,w as M,y as I,z as k,A as O,B as C,D as z,E as A,F as N,G as T,H as B,I as E,J as P,K as H,L,M as V,N as K,O as U,P as j,Q as q,R,S as D,T as F,U as G,V as J,W as Q,X as W,Y as X,Z as Y,$ as Z,a0 as ee,a1 as ae,a2 as te,a3 as ie,a4 as ne,a5 as se,a6 as oe,a7 as re,a8 as le,a9 as ce,aa as de,ab as me,ac as ue,ad as he,ae as _e,af as ge,ag as be,ah as pe,ai as ve,aj as fe,ak as $e,al as ye,am as we,an as Se,ao as xe,ap as Me,aq as Ie,ar as ke,as as Oe,at as Ce,au as ze,av as Ae,aw as Ne,ax as Te,ay as Be,az as Ee,aA as Pe,aB as He,aC as Le,aD as Ve,aE as Ke,aF as Ue,aG as je,aH as qe,aI as Re,aJ as De,aK as Fe,aL as Ge,aM as Je,aN as Qe,aO as We,aP as Xe,aQ as Ye,aR as Ze,aS as ea,aT as aa,aU as ta,aV as ia,aW as na,aX as sa,aY as oa,aZ as ra,a_ as la,a$ as ca,b0 as da,b1 as ma,b2 as ua,b3 as ha,b4 as _a,b5 as ga,b6 as ba,b7 as pa,b8 as va,b9 as fa,ba as $a,bb as ya,bc as wa,bd as Sa,be as xa,bf as Ma,bg as Ia,bh as ka,bi as Oa,bj as Ca,bk as za,bl as Aa,bm as Na,bn as Ta,bo as Ba,bp as Ea,bq as Pa,br as Ha,bs as La,bt as Va,bu as Ka,bv as Ua,bw as ja,bx as qa,by as Ra,bz as Da,bA as Fa,bB as Ga,bC as Ja,bD as Qa,bE as Wa,bF as Xa,bG as Ya,bH as Za,bI as et,bJ as at,bK as tt,bL as it,bM as nt,bN as st,bO as ot,bP as rt,bQ as lt,bR as ct,bS as dt,bT as mt,bU as ut,bV as ht,bW as _t,bX as gt,bY as bt,bZ as pt,b_ as vt,b$ as ft,c0 as $t,c1 as yt,c2 as wt,c3 as St,c4 as xt,c5 as Mt,c6 as It,c7 as kt,c8 as Ot,c9 as Ct,ca as zt,cb as At,cc as Nt,cd as Tt,ce as Bt,cf as Et,cg as Pt,ch as Ht,ci as Lt,cj as Vt,ck as Kt,cl as Ut,cm as jt,cn as qt,co as Rt,cp as Dt,cq as Ft,cr as Gt,cs as Jt,ct as Qt,cu as Wt,cv as Xt,cw as Yt,cx as Zt,cy as ei,cz as ai,cA as ti,cB as ii,cC as ni,cD as si,cE as oi,cF as ri,cG as li,cH as ci,cI as di,cJ as mi,cK as ui}from"./card-7cd05290.js";class hi{constructor(e){this._assigning=!1,this._value=null,this._blurEventHandler=()=>{this._setAssigning(!1)},this._keydownEventHandler=e=>{e.key&&!["Control","Alt","Shift","Meta"].includes(e.key)&&(this.setValue({key:e.key,ctrl:e.ctrlKey,alt:e.altKey,shift:e.shiftKey,meta:e.metaKey}),this._setAssigning(!1))},this._host=e,this._host.addController(this)}setValue(a){e(a,this._value)||(this._value=a,this._host.requestUpdate(),this._host.dispatchEvent(new CustomEvent("value-changed",{detail:{value:this._value}})))}getValue(){return this._value}hasValue(){return!!this._value}isAssigning(){return this._assigning}toggleAssigning(){this._setAssigning(!this._assigning)}_setAssigning(e){this._assigning=e,a(this._host,this._assigning,"assigning"),this._assigning?this._host.addEventListener("keydown",this._keydownEventHandler):this._host.removeEventListener("keydown",this._keydownEventHandler),this._host.requestUpdate()}hostConnected(){this._host.addEventListener("blur",this._blurEventHandler)}hostDisconnected(){this._host.removeEventListener("blur",this._blurEventHandler)}}let _i=class extends s{constructor(){super(...arguments),this._controller=new hi(this)}willUpdate(e){e.has("value")&&this._controller.setValue(this.value??null)}render(){if(!this.label)return;const e=e=>o`
+
${e}
+
`;return o` +
${this.label}
+ {this._controller.toggleAssigning()}} + > + + + ${this._controller.isAssigning()?l("key_assigner.assigning"):l("key_assigner.assign")} + + + ${this._controller.hasValue()?o`{this._controller.setValue(null)}} + > + + ${l("key_assigner.unassign")} + `:""} +
+ ${this.value?.ctrl?e(l("key_assigner.modifiers.ctrl")):""} + ${this.value?.shift?e(l("key_assigner.modifiers.shift")):""} + ${this.value?.meta?e(l("key_assigner.modifiers.meta")):""} + ${this.value?.alt?e(l("key_assigner.modifiers.alt")):""} + ${this.value?.key?e(this.value.key):""} +
+ `}static get styles(){return c('.dotdotdot:after {\n animation: dots 2s linear infinite;\n content: "";\n display: inline-block;\n width: 3em;\n}\n@keyframes dots {\n 0%, 20% {\n content: ".";\n }\n 40% {\n content: "..";\n }\n 60% {\n content: "...";\n }\n 90%, 100% {\n content: "";\n }\n}\n\n:host {\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 10px;\n height: 56px;\n border: 1px solid var(--divider-color);\n}\n\n:host([assigning]) ha-button.assign span,\n:host([assigning]) ha-button.assign ha-icon {\n color: var(--warning-color);\n}\n\nha-icon {\n padding: 10px;\n}\n\ndiv.label {\n width: 100px;\n margin-left: 4px;\n}\n\ndiv.key-row {\n flex: 1;\n display: flex;\n justify-content: center;\n align-items: center;\n padding-left: 10px;\n padding-right: 10px;\n}\n\ndiv.key {\n display: flex;\n align-items: center;\n height: 90%;\n width: min-content;\n margin-left: 5px;\n margin-right: 5px;\n}\n\ndiv.key-inner {\n height: 100%;\n width: 100%;\n padding-top: 2px;\n padding-bottom: 2px;\n padding-left: 4px;\n padding-right: 4px;\n border: 2px;\n border-radius: 4px;\n border-style: outset;\n border-color: var(--divider-color);\n font-family: monospace;\n text-transform: capitalize;\n}\n\ndiv.unassigned {\n font-style: italic;\n}\n\ndiv.key + div.key:before {\n display: flex;\n align-items: center;\n margin-right: 5px;\n content: " + ";\n}')}};t([i({attribute:!1})],_i.prototype,"label",void 0),t([i({attribute:!1})],_i.prototype,"value",void 0),_i=t([n("frigate-card-key-assigner")],_i);const gi="cameras",bi="options",pi={cameras:{icon:"video",name:l("editor.cameras"),secondary:l("editor.cameras_secondary")},view:{icon:"eye",name:l("editor.view"),secondary:l("editor.view_secondary")},menu:{icon:"menu",name:l("editor.menu"),secondary:l("editor.menu_secondary")},status_bar:{icon:"sign-text",name:l("editor.status_bar"),secondary:l("editor.status_bar_secondary")},live:{icon:"cctv",name:l("editor.live"),secondary:l("editor.live_secondary")},media_gallery:{icon:"grid",name:l("editor.media_gallery"),secondary:l("editor.media_gallery_secondary")},media_viewer:{icon:"filmstrip",name:l("editor.media_viewer"),secondary:l("editor.media_viewer_secondary")},image:{icon:"image",name:l("editor.image"),secondary:l("editor.image_secondary")},timeline:{icon:"chart-gantt",name:l("editor.timeline"),secondary:l("editor.timeline_secondary")},dimensions:{icon:"aspect-ratio",name:l("editor.dimensions"),secondary:l("editor.dimensions_secondary")},performance:{icon:"speedometer",name:l("editor.performance"),secondary:l("editor.performance_secondary")},profiles:{icon:"folder-wrench-outline",name:l("editor.profiles"),secondary:l("editor.profiles_secondary")},overrides:{icon:"file-replace",name:l("editor.overrides"),secondary:l("editor.overrides_secondary")}};let vi=class extends s{constructor(){super(...arguments),this._defaults=m(di),this._initialized=!1,this._configUpgradeable=!1,this._expandedMenus={},this._viewModes=[{value:"",label:""},{value:"live",label:l("config.view.views.live")},{value:"clips",label:l("config.view.views.clips")},{value:"snapshots",label:l("config.view.views.snapshots")},{value:"recordings",label:l("config.view.views.recordings")},{value:"clip",label:l("config.view.views.clip")},{value:"snapshot",label:l("config.view.views.snapshot")},{value:"recording",label:l("config.view.views.recording")},{value:"image",label:l("config.view.views.image")},{value:"timeline",label:l("config.view.views.timeline")}],this._cameraSelectViewModes=[...this._viewModes,{value:"current",label:l("config.view.views.current")}],this._filterModes=[{value:"",label:""},{value:"none",label:l("config.common.controls.filter.modes.none")},{value:"left",label:l("config.common.controls.filter.modes.left")},{value:"right",label:l("config.common.controls.filter.modes.right")}],this._menuStyles=[{value:"",label:""},{value:"none",label:l("config.menu.styles.none")},{value:"hidden",label:l("config.menu.styles.hidden")},{value:"overlay",label:l("config.menu.styles.overlay")},{value:"hover",label:l("config.menu.styles.hover")},{value:"hover-card",label:l("config.menu.styles.hover-card")},{value:"outside",label:l("config.menu.styles.outside")}],this._menuPositions=[{value:"",label:""},{value:"left",label:l("config.menu.positions.left")},{value:"right",label:l("config.menu.positions.right")},{value:"top",label:l("config.menu.positions.top")},{value:"bottom",label:l("config.menu.positions.bottom")}],this._menuAlignments=[{value:"",label:""},{value:"left",label:l("config.menu.alignments.left")},{value:"right",label:l("config.menu.alignments.right")},{value:"top",label:l("config.menu.alignments.top")},{value:"bottom",label:l("config.menu.alignments.bottom")}],this._nextPreviousControlStyles=[{value:"",label:""},{value:"chevrons",label:l("config.common.controls.next_previous.styles.chevrons")},{value:"icons",label:l("config.common.controls.next_previous.styles.icons")},{value:"none",label:l("config.common.controls.next_previous.styles.none")},{value:"thumbnails",label:l("config.common.controls.next_previous.styles.thumbnails")}],this._aspectRatioModes=[{value:"",label:""},{value:"dynamic",label:l("config.dimensions.aspect_ratio_modes.dynamic")},{value:"static",label:l("config.dimensions.aspect_ratio_modes.static")},{value:"unconstrained",label:l("config.dimensions.aspect_ratio_modes.unconstrained")}],this._thumbnailModes=[{value:"",label:""},{value:"none",label:l("config.common.controls.thumbnails.modes.none")},{value:"above",label:l("config.common.controls.thumbnails.modes.above")},{value:"below",label:l("config.common.controls.thumbnails.modes.below")},{value:"left",label:l("config.common.controls.thumbnails.modes.left")},{value:"right",label:l("config.common.controls.thumbnails.modes.right")}],this._thumbnailMediaTypes=[{value:"",label:""},{value:"events",label:l("config.common.controls.thumbnails.media_types.events")},{value:"recordings",label:l("config.common.controls.thumbnails.media_types.recordings")}],this._thumbnailEventsMediaTypes=[{value:"",label:""},{value:"clips",label:l("config.common.controls.thumbnails.events_media_types.clips")},{value:"snapshots",label:l("config.common.controls.thumbnails.events_media_types.snapshots")}],this._transitionEffects=[{value:"",label:""},{value:"none",label:l("config.media_viewer.transition_effects.none")},{value:"slide",label:l("config.media_viewer.transition_effects.slide")}],this._imageModes=[{value:"",label:""},{value:"camera",label:l("config.common.image.modes.camera")},{value:"entity",label:l("config.common.image.modes.entity")},{value:"screensaver",label:l("config.common.image.modes.screensaver")},{value:"url",label:l("config.common.image.modes.url")}],this._timelineEventsMediaTypes=[{value:"",label:""},{value:"all",label:l("config.common.timeline.events_media_types.all")},{value:"clips",label:l("config.common.timeline.events_media_types.clips")},{value:"snapshots",label:l("config.common.timeline.events_media_types.snapshots")}],this._timelineStyleTypes=[{value:"",label:""},{value:"ribbon",label:l("config.common.timeline.styles.ribbon")},{value:"stack",label:l("config.common.timeline.styles.stack")}],this._darkModes=[{value:"",label:""},{value:"on",label:l("config.view.dark_modes.on")},{value:"off",label:l("config.view.dark_modes.off")},{value:"auto",label:l("config.view.dark_modes.auto")}],this._mediaActionNegativeConditions=[{value:"",label:""},{value:"unselected",label:l("config.common.media_action_conditions.unselected")},{value:"hidden",label:l("config.common.media_action_conditions.hidden")}],this._mediaActionPositiveConditions=[{value:"",label:""},{value:"selected",label:l("config.common.media_action_conditions.selected")},{value:"visible",label:l("config.common.media_action_conditions.visible")}],this._mediaLiveUnmuteConditions=[...this._mediaActionPositiveConditions,{value:"microphone",label:l("config.common.media_action_conditions.microphone_unmute")}],this._mediaLiveMuteConditions=[...this._mediaActionNegativeConditions,{value:"microphone",label:l("config.common.media_action_conditions.microphone_mute")}],this._layoutFits=[{value:"",label:""},{value:"contain",label:l("config.cameras.dimensions.layout.fits.contain")},{value:"cover",label:l("config.cameras.dimensions.layout.fits.cover")},{value:"fill",label:l("config.cameras.dimensions.layout.fits.fill")}],this._miniTimelineModes=[{value:"",label:""},{value:"none",label:l("config.common.controls.timeline.modes.none")},{value:"above",label:l("config.common.controls.timeline.modes.above")},{value:"below",label:l("config.common.controls.timeline.modes.below")}],this._profiles=[{value:"",label:""},{value:"casting",label:l("config.profiles.casting")},{value:"low-performance",label:l("config.profiles.low-performance")},{value:"scrubbing",label:l("config.profiles.scrubbing")}],this._go2rtcModes=[{value:"",label:""},{value:"mse",label:l("config.cameras.go2rtc.modes.mse")},{value:"webrtc",label:l("config.cameras.go2rtc.modes.webrtc")},{value:"mp4",label:l("config.cameras.go2rtc.modes.mp4")},{value:"mjpeg",label:l("config.cameras.go2rtc.modes.mjpeg")}],this._microphoneButtonTypes=[{value:"",label:""},{value:"momentary",label:l("config.menu.buttons.types.momentary")},{value:"toggle",label:l("config.menu.buttons.types.toggle")}],this._displayModes=[{value:"",label:""},{value:"single",label:l("display_modes.single")},{value:"grid",label:l("display_modes.grid")}],this._castMethods=[{value:"",label:""},{value:"standard",label:l("config.cameras.cast.methods.standard")},{value:"dashboard",label:l("config.cameras.cast.methods.dashboard")}],this._ptzModes=[{value:"",label:""},{value:"on",label:l("config.live.controls.ptz.modes.on")},{value:"off",label:l("config.live.controls.ptz.modes.off")}],this._ptzOrientations=[{value:"",label:""},{value:"vertical",label:l("config.live.controls.ptz.orientations.vertical")},{value:"horizontal",label:l("config.live.controls.ptz.orientations.horizontal")}],this._ptzPositions=[{value:"",label:""},{value:"top-left",label:l("config.live.controls.ptz.positions.top-left")},{value:"top-right",label:l("config.live.controls.ptz.positions.top-right")},{value:"bottom-left",label:l("config.live.controls.ptz.positions.bottom-left")},{value:"bottom-right",label:l("config.live.controls.ptz.positions.bottom-right")}],this._triggersActionsInteractionModes=[{value:"",label:""},{value:"all",label:l("config.view.triggers.actions.interaction_modes.all")},{value:"inactive",label:l("config.view.triggers.actions.interaction_modes.inactive")},{value:"active",label:l("config.view.triggers.actions.interaction_modes.active")}],this._triggersActionsTrigger=[{value:"",label:""},{value:"default",label:l("config.view.triggers.actions.triggers.default")},{value:"live",label:l("config.view.triggers.actions.triggers.live")},{value:"media",label:l("config.view.triggers.actions.triggers.media")},{value:"none",label:l("config.view.triggers.actions.triggers.none")}],this._triggersActionsUntrigger=[{value:"",label:""},{value:"default",label:l("config.view.triggers.actions.untriggers.default")},{value:"none",label:l("config.view.triggers.actions.untriggers.none")}],this._triggersEvents=[{value:"",label:""},{value:"events",label:l("config.cameras.triggers.events.events")},{value:"clips",label:l("config.cameras.triggers.events.clips")},{value:"snapshots",label:l("config.cameras.triggers.events.snapshots")}],this._timelinePanModes=[{value:"",label:""},{value:"pan",label:l("config.common.controls.timeline.pan_modes.pan")},{value:"seek",label:l("config.common.controls.timeline.pan_modes.seek")},{value:"seek-in-media",label:l("config.common.controls.timeline.pan_modes.seek-in-media")},{value:"seek-in-camera",label:l("config.common.controls.timeline.pan_modes.seek-in-camera")}],this._capabilities=[{value:"",label:""},{value:"live",label:l("config.cameras.capabilities.capabilities.live")},{value:"substream",label:l("config.cameras.capabilities.capabilities.substream")},{value:"clips",label:l("config.cameras.capabilities.capabilities.clips")},{value:"recordings",label:l("config.cameras.capabilities.capabilities.recordings")},{value:"snapshots",label:l("config.cameras.capabilities.capabilities.snapshots")},{value:"favorite-events",label:l("config.cameras.capabilities.capabilities.favorite-events")},{value:"favorite-recordings",label:l("config.cameras.capabilities.capabilities.favorite-recordings")},{value:"seek",label:l("config.cameras.capabilities.capabilities.seek")},{value:"ptz",label:l("config.cameras.capabilities.capabilities.ptz")},{value:"menu",label:l("config.cameras.capabilities.capabilities.menu")}],this._defaultResetInteractionModes=[{value:"",label:""},{value:"all",label:l("config.view.default_reset.interaction_modes.all")},{value:"inactive",label:l("config.view.default_reset.interaction_modes.inactive")},{value:"active",label:l("config.view.default_reset.interaction_modes.active")}],this._proxyMedia=[{value:"",label:""},{value:"auto",label:l("config.cameras.proxy.media.auto")},{value:!0,label:l("config.cameras.proxy.media.true")},{value:!1,label:l("config.cameras.proxy.media.false")}],this._proxySSLCiphers=[{value:"",label:""},{value:"auto",label:l("config.cameras.proxy.ssl_ciphers.auto")},{value:"default",label:l("config.cameras.proxy.ssl_ciphers.default")},{value:"insecure",label:l("config.cameras.proxy.ssl_ciphers.insecure")},{value:"intermediate",label:l("config.cameras.proxy.ssl_ciphers.intermediate")},{value:"modern",label:l("config.cameras.proxy.ssl_ciphers.modern")}],this._proxySSLVerification=[{value:"",label:""},{value:"auto",label:l("config.cameras.proxy.ssl_verification.auto")},{value:!0,label:l("config.cameras.proxy.ssl_verification.true")},{value:!1,label:l("config.cameras.proxy.ssl_verification.false")}],this._reolinkMediaResolution=[{value:"",label:""},{value:"high",label:l("config.cameras.reolink.media_resolution.high")},{value:"low",label:l("config.cameras.reolink.media_resolution.low")}],this._statusBarStyles=[{value:"",label:""},{value:"hover",label:l("config.status_bar.styles.hover")},{value:"hover-card",label:l("config.status_bar.styles.hover-card")},{value:"none",label:l("config.status_bar.styles.none")},{value:"outside",label:l("config.status_bar.styles.outside")},{value:"overlay",label:l("config.status_bar.styles.overlay")},{value:"popup",label:l("config.status_bar.styles.popup")}],this._statusBarPositions=[{value:"",label:""},{value:"top",label:l("config.status_bar.positions.top")},{value:"bottom",label:l("config.status_bar.positions.bottom")}]}setConfig(e){this._config=e,this._configUpgradeable=u(e);const a=h.safeParse(this._config.profiles);if(a.success){const e=m(di);_(this._config,e,a.data),this._defaults=e}}willUpdate(){this._initialized||g().then((e=>{e&&(this._initialized=!0)}))}_renderOptionSetHeader(e,a){const t=pi[e];return o` +
+
+ +
${t.name}
+
+
${t.secondary}
+
+ `}_getLabel(e){const a=e.split(".").filter((e=>!e.match(/^\[[0-9]+\]$/))).join(".");return l(`config.${a}`)}_renderEntitySelector(e,a){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderOptionSelector(e,a=[],t){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderIconSelector(e,a){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderNumberInput(e,a){if(!this._config)return;const t=b(this._config,e),i=void 0===a?.max?"box":"slider";return o` + this._valueChangedHandler(e,a)} + > + + `}_renderInfo(e){return o` ${e}`}_getEditorCameraTitle(e,a){return"string"==typeof a?.title&&a.title||("string"==typeof a?.camera_entity?p(this.hass,a.camera_entity):"")||"object"==typeof a?.webrtc_card&&a.webrtc_card&&"string"==typeof a.webrtc_card.entity&&a.webrtc_card.entity||("object"==typeof a?.frigate&&a.frigate&&"string"==typeof a?.frigate.camera_name&&a.frigate.camera_name?v(a.frigate.camera_name):"")||"string"==typeof a?.id&&a.id||l("editor.camera")+" #"+e}_renderViewDefaultResetMenu(){return this._putInSubmenu("view.default_reset",!0,`config.${f}.editor_label`,"mdi:restart",o` + ${this._renderSwitch($,this._defaults.view.default_reset.after_interaction)} + ${this._renderNumberInput(y)} + ${this._renderOptionSelector(w,this._defaultResetInteractionModes,{label:l("config.view.default_reset.interaction_mode")})}, + ${this._renderOptionSelector(S,this.hass?x(this.hass):[],{multiple:!0})} + `)}_renderViewTriggersMenu(){return this._putInSubmenu("view.triggers",!0,`config.${M}.editor_label`,"mdi:target-account",o` + ${this._renderSwitch(I,this._defaults.view.triggers.filter_selected_camera,{label:l(`config.${I}`)})} + ${this._renderSwitch(k,this._defaults.view.triggers.show_trigger_status,{label:l(`config.${k}`)})} + ${this._renderNumberInput(O,{default:this._defaults.view.triggers.untrigger_seconds})} + ${this._putInSubmenu("view.triggers.actions",!0,`config.${C}.editor_label`,"mdi:cogs",o` ${this._renderOptionSelector(z,this._triggersActionsTrigger,{label:l("config.view.triggers.actions.trigger")})} + ${this._renderOptionSelector(A,this._triggersActionsUntrigger,{label:l("config.view.triggers.actions.untrigger")})} + ${this._renderOptionSelector(N,this._triggersActionsInteractionModes,{label:l("config.view.triggers.actions.interaction_mode")})}`)} + `)}_renderKeyAssigner(e,a){return o` this._valueChangedHandler(e,a)} + >`}_renderViewKeyboardShortcutMenu(){return this._putInSubmenu("view.keyboard_shortcuts",!0,`config.${T}.editor_label`,"mdi:keyboard",o` + ${this._renderSwitch(B,this._defaults.view.keyboard_shortcuts.enabled,{label:l(`config.${B}`)})} + ${this._renderKeyAssigner(E,this._defaults.view.keyboard_shortcuts.ptz_left)} + ${this._renderKeyAssigner(P,this._defaults.view.keyboard_shortcuts.ptz_right)} + ${this._renderKeyAssigner(H,this._defaults.view.keyboard_shortcuts.ptz_up)} + ${this._renderKeyAssigner(L,this._defaults.view.keyboard_shortcuts.ptz_down)} + ${this._renderKeyAssigner(V,this._defaults.view.keyboard_shortcuts.ptz_zoom_in)} + ${this._renderKeyAssigner(K,this._defaults.view.keyboard_shortcuts.ptz_zoom_out)} + ${this._renderKeyAssigner(U,this._defaults.view.keyboard_shortcuts.ptz_home)} + `)}_renderStatusBarItem(e){return o` ${this._putInSubmenu("status_bar.items",e,`config.status_bar.items.${e}`,"mdi:feature-search",o` + ${this._renderSwitch(`${j}.${e}.enabled`,this._defaults.status_bar.items[e]?.enabled??!0,{label:l("config.status_bar.items.enabled")})} + ${this._renderNumberInput(`${j}.${e}.priority`,{max:q,default:this._defaults.status_bar.items[e]?.priority,label:l("config.status_bar.items.priority")})} + `)}`}_renderMenuButton(e,a){const t=[{value:"",label:""},{value:"matching",label:l("config.menu.buttons.alignments.matching")},{value:"opposing",label:l("config.menu.buttons.alignments.opposing")}];return o` ${this._putInSubmenu("menu.buttons",e,`config.menu.buttons.${e}`,"mdi:gesture-tap-button",o` + ${this._renderSwitch(`${R}.${e}.enabled`,this._defaults.menu.buttons[e]?.enabled??!0,{label:l("config.menu.buttons.enabled")})} + ${this._renderOptionSelector(`${R}.${e}.alignment`,t,{label:l("config.menu.buttons.alignment")})} + ${this._renderSwitch(`${R}.${e}.permanent`,this._defaults.menu.buttons[e]?.permanent??!1,{label:l("config.menu.buttons.permanent")})} + ${this._renderNumberInput(`${R}.${e}.priority`,{max:D,default:this._defaults.menu.buttons[e]?.priority,label:l("config.menu.buttons.priority")})} + ${this._renderIconSelector(`${R}.${e}.icon`,{label:l("config.menu.buttons.icon")})} + ${a} + `)}`}_putInSubmenu(e,a,t,i,n){const s=this._expandedMenus[e]===a,c={submenu:!0,selected:s},d=dt(i);return o`
+ + ${s?o`
${n}
`:""} +
`}_renderMediaLayout(e,a,t,i,n,s,r,c,d,m,u,h){return this._putInSubmenu(e,!0,a,"mdi:page-layout-body",o` + ${this._renderNumberInput(m,{min:0,max:10,label:l("config.cameras.dimensions.layout.zoom"),step:.1})} + ${this._renderNumberInput(u,{min:0,max:100,label:l("config.cameras.dimensions.layout.pan.x")})} + ${this._renderNumberInput(h,{min:0,max:100,label:l("config.cameras.dimensions.layout.pan.y")})} + ${this._renderOptionSelector(t,this._layoutFits,{label:l("config.cameras.dimensions.layout.fit")})} + ${this._putInSubmenu(`${e}.position`,!0,"config.cameras.dimensions.layout.position.editor_label","mdi:aspect-ratio",o` ${this._renderNumberInput(i,{min:0,max:100,label:l("config.cameras.dimensions.layout.position.x")})} + ${this._renderNumberInput(n,{min:0,max:100,label:l("config.cameras.dimensions.layout.position.y")})}`)} + ${this._putInSubmenu(`${e}.view_box`,!0,"config.cameras.dimensions.layout.view_box.editor_label","mdi:crop",o` + ${this._renderNumberInput(s,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.top")})} + ${this._renderNumberInput(r,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.bottom")})} + ${this._renderNumberInput(c,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.left")})} + ${this._renderNumberInput(d,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.right")})} + `)} + `)}_renderTimelineCoreControls(e,a,t,i,n,s,r){return o` + ${this._renderOptionSelector(e,this._timelineStyleTypes,{label:l(`config.common.${F}`)})} + ${r?this._renderOptionSelector(r,this._timelinePanModes,{label:l("config.common.controls.timeline.pan_mode")}):""} + ${this._renderNumberInput(a,{label:l(`config.common.${G}`)})} + ${this._renderNumberInput(t,{label:l(`config.common.${J}`)})} + ${this._renderOptionSelector(i,this._timelineEventsMediaTypes,{label:l(`config.common.${Q}`)})} + ${this._renderSwitch(n,s,{label:l(`config.common.${W}`)})} + `}_renderMiniTimeline(e,a,t,i,n,s,r,c,d){return this._putInSubmenu(e,!0,"config.common.controls.timeline.editor_label","mdi:chart-gantt",o` ${this._renderOptionSelector(a,this._miniTimelineModes,{label:l("config.common.controls.timeline.mode")})} + ${this._renderTimelineCoreControls(t,i,n,s,r,c,d)}`)}_renderViewDisplay(e,a,t,i,n){return this._putInSubmenu(e,!0,"config.common.display.editor_label","mdi:palette-swatch",o` + ${this._renderOptionSelector(a,this._displayModes,{label:l("config.common.display.mode")})} + ${this._renderNumberInput(t,{min:0,label:l("config.common.display.grid_selected_width_factor")})} + ${this._renderNumberInput(i,{min:0,label:l("config.common.display.grid_columns")})} + ${this._renderNumberInput(n,{min:0,label:l("config.common.display.grid_max_columns")})} + `)}_renderNextPreviousControls(e,a,t,i){return this._putInSubmenu(e,!0,"config.common.controls.next_previous.editor_label","mdi:arrow-right-bold-circle",o` + ${this._renderOptionSelector(a,this._nextPreviousControlStyles.filter((e=>!(!i?.allowThumbnails&&"thumbnails"===e.value||!i?.allowIcons&&"icons"===e.value))),{label:l("config.common.controls.next_previous.style")})} + ${this._renderNumberInput(t,{min:X,label:l("config.common.controls.next_previous.size")})} + `)}_renderThumbnailsControls(e,a,t,i,n,s,r,c){return this._putInSubmenu(e,!0,"config.common.controls.thumbnails.editor_label","mdi:image-text",o` + ${c?.configPathMode?o`${this._renderOptionSelector(c.configPathMode,this._thumbnailModes,{label:l("config.common.controls.thumbnails.mode")})}`:o``} + ${c?.configPathMediaType?o`${this._renderOptionSelector(c.configPathMediaType,this._thumbnailMediaTypes,{label:l("config.common.controls.thumbnails.media_type")})}`:o``} + ${c?.configPathEventsMediaType?o`${this._renderOptionSelector(c.configPathEventsMediaType,this._thumbnailEventsMediaTypes,{label:l("config.common.controls.thumbnails.events_media_type")})}`:o``} + ${this._renderNumberInput(a,{min:Y,max:Z,label:l("config.common.controls.thumbnails.size")})} + ${this._renderSwitch(t,r.show_details,{label:l("config.common.controls.thumbnails.show_details")})} + ${this._renderSwitch(i,r.show_favorite_control,{label:l("config.common.controls.thumbnails.show_favorite_control")})} + ${this._renderSwitch(n,r.show_timeline_control,{label:l("config.common.controls.thumbnails.show_timeline_control")})} + ${this._renderSwitch(s,r.show_download_control,{label:l("config.common.controls.thumbnails.show_download_control")})} + `)}_renderFilterControls(e,a){return this._putInSubmenu(e,!0,"config.common.controls.filter.editor_label","mdi:filter-cog",o` + ${a?o`${this._renderOptionSelector(a,this._filterModes,{label:l("config.common.controls.filter.mode")})}`:o``} + `)}_renderImageOptions(e,a,t,i,n){return o` + ${this._renderOptionSelector(e,this._imageModes,{label:l("config.common.image.mode")})} + ${this._renderStringInput(a,{label:l("config.common.image.url")})} + ${this._renderOptionSelector(t,this.hass?x(this.hass):[],{label:l("config.common.image.entity")})} + ${this._renderStringInput(i,{label:l("config.common.image.entity_parameters")})} + ${this._renderNumberInput(n,{label:l("config.common.image.refresh_seconds")})} + `}_renderCamera(e,a,t,i){const n=[{value:"",label:""},{value:"auto",label:l("config.cameras.live_providers.auto")},{value:"ha",label:l("config.cameras.live_providers.ha")},{value:"image",label:l("config.cameras.live_providers.image")},{value:"jsmpeg",label:l("config.cameras.live_providers.jsmpeg")},{value:"go2rtc",label:l("config.cameras.live_providers.go2rtc")},{value:"webrtc-card",label:l("config.cameras.live_providers.webrtc-card")}],s=[];e.forEach(((e,t)=>{t!==a&&s.push({value:ee(e),label:this._getEditorCameraTitle(t,e)})}));const c=e=>{if(this._config){const a=m(this._config);e(a)&&this._updateConfig(a)}},d={submenu:!0,selected:this._expandedMenus[gi]===a};return o` +
+ + ${this._expandedMenus[gi]===a?o`
+
+ !i&&c((e=>!!(Array.isArray(e.cameras)&&a>0)&&(mt(e.cameras,a,a-1),this._openMenu(gi,a-1),!0)))} + > + + + =this._config.cameras.length-1} + @click=${()=>!i&&c((e=>!!(Array.isArray(e.cameras)&&a + + + {c((e=>!!Array.isArray(e.cameras)&&(e.cameras.splice(a,1),this._closeMenu(gi),!0)))}} + > + + +
+ ${this._renderEntitySelector(ae(ut,a),"camera")} + ${this._renderOptionSelector(ae(ht,a),n)} + ${this._renderStringInput(ae(_t,a))} + ${this._renderIconSelector(ae(gt,a),{label:l("config.cameras.icon")})} + ${this._renderStringInput(ae(bt,a))} + ${this._putInSubmenu("cameras.engine",!0,"config.cameras.engines.editor_label","mdi:engine",o`${this._putInSubmenu("cameras.frigate",a,"config.cameras.frigate.editor_label","frigate",o` + ${this._renderStringInput(ae(pt,a))} + ${this._renderStringInput(ae(vt,a))} + ${this._renderOptionSelector(ae(ft,a),[],{multiple:!0,label:l("config.cameras.frigate.labels")})} + ${this._renderOptionSelector(ae($t,a),[],{multiple:!0,label:l("config.cameras.frigate.zones")})} + ${this._renderStringInput(ae(yt,a))} + `)} + ${this._putInSubmenu("cameras.motioneye",a,"config.cameras.motioneye.editor_label","motioneye",o` ${this._renderStringInput(ae(wt,a))} + ${this._renderStringInput(ae(St,a))} + ${this._renderStringInput(ae(xt,a))} + ${this._renderStringInput(ae(Mt,a))} + ${this._renderStringInput(ae(It,a))}`)} + ${this._putInSubmenu("cameras.reolink",a,"config.cameras.reolink.editor_label","reolink",o` ${this._renderStringInput(ae(kt,a))} + ${this._renderOptionSelector(ae(Ot,a),this._reolinkMediaResolution,{label:l("config.cameras.reolink.media_resolution.editor_label")})}`)}`)} + ${this._putInSubmenu("cameras.live_provider",!0,"config.cameras.live_provider_options.editor_label","mdi:cctv",o` ${this._putInSubmenu("cameras.go2rtc",a,"config.cameras.go2rtc.editor_label","mdi:alpha-g-circle",o`${this._renderOptionSelector(ae(Ct,a),this._go2rtcModes,{multiple:!0,label:l("config.cameras.go2rtc.modes.editor_label")})} + ${this._renderStringInput(ae(zt,a))}`)} + ${this._putInSubmenu("cameras.image",!0,"config.cameras.image.editor_label","mdi:image",this._renderImageOptions(ae(At,a),ae(Nt,a),ae(Tt,a),ae(Bt,a),ae(Et,a)))} + ${this._putInSubmenu("cameras.webrtc_card",a,"config.cameras.webrtc_card.editor_label","mdi:webrtc",o`${this._renderEntitySelector(ae(Pt,a),"camera")} + ${this._renderStringInput(ae(Ht,a))}`)}`)} + ${this._putInSubmenu("cameras.dependencies",a,"config.cameras.dependencies.editor_label","mdi:graph",o` ${this._renderSwitch(ae(Lt,a),this._defaults.cameras.dependencies.all_cameras)} + ${this._renderOptionSelector(ae(Vt,a),s,{multiple:!0})}`)} + ${this._putInSubmenu("cameras.triggers",a,"config.cameras.triggers.editor_label","mdi:magnify-scan",o` + ${this._renderSwitch(ae(Kt,a),this._defaults.cameras.triggers.occupancy)} + ${this._renderSwitch(ae(Ut,a),this._defaults.cameras.triggers.motion)} + ${this._renderOptionSelector(ae(jt,a),t,{multiple:!0})} + ${this._renderOptionSelector(ae(qt,a),this._triggersEvents,{multiple:!0,label:l("config.cameras.triggers.events.editor_label")})} + `)} + ${this._putInSubmenu("cameras.cast",a,"config.cameras.cast.editor_label","mdi:cast",o` + ${this._renderOptionSelector(ae(Rt,a),this._castMethods)} + ${this._renderStringInput(ae(Dt,a))} + ${this._renderStringInput(ae(Ft,a))} + `)} + ${this._putInSubmenu("cameras.dimensions",a,"config.cameras.dimensions.editor_label","mdi:aspect-ratio",o` + ${this._renderStringInput(ae(Gt,a))} + ${this._renderMediaLayout("cameras.dimensions.layout","config.cameras.dimensions.layout.editor_label",ae(Jt,a),ae(Qt,a),ae(Wt,a),ae(Xt,a),ae(Yt,a),ae(Zt,a),ae(ei,a),ae(ai,a),ae(ti,a),ae(ii,a))} + `)} + ${this._putInSubmenu("cameras.capabilities",a,"config.cameras.capabilities.editor_label","mdi:cog-stop",o` + ${this._renderOptionSelector(ae(ni,a),this._capabilities,{multiple:!0})} + ${this._renderOptionSelector(ae(si,a),this._capabilities,{multiple:!0})} + `)} + ${this._putInSubmenu("cameras.proxy",a,"config.cameras.proxy.editor_label","mdi:arrow-decision",o` + ${this._renderOptionSelector(ae(oi,a),this._proxyMedia,{label:l("config.cameras.proxy.media.editor_label")})} + ${this._renderSwitch(ae(ri,a),this._defaults.cameras.proxy.dynamic)} + ${this._renderOptionSelector(ae(li,a),this._proxySSLVerification,{label:l("config.cameras.proxy.ssl_verification.editor_label")})} + ${this._renderOptionSelector(ae(ci,a),this._proxySSLCiphers,{label:l("config.cameras.proxy.ssl_ciphers.editor_label")})} + `)} +
`:""} +
+ `}_renderStringInput(e,a){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderSwitch(e,a,t){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_updateConfig(e){this._config=e,te(this,"config-changed",{config:this._config})}render(){if(!this.hass||!this._config)return o``;const e=x(this.hass),a=b(this._config,mi)||[];return o` + ${this._configUpgradeable?o`
+ ${l("editor.upgrade_available")} + + {if(this._config){const e=m(this._config);ie(e),this._updateConfig(e)}}} + > + + +
+
`:o``} +
+ ${this._renderOptionSetHeader("cameras")} + ${"cameras"===this._expandedMenus[bi]?o` +
+ ${a.map(((t,i)=>this._renderCamera(a,i,e)))} + ${this._renderCamera(a,a.length,e,!0)} +
+ `:""} + ${this._renderOptionSetHeader("profiles")} + ${"profiles"===this._expandedMenus[bi]?o`
+ ${this._renderOptionSelector(ne,this._profiles,{multiple:!0,label:l("config.profiles.editor_label")})} +
`:""} + ${this._renderOptionSetHeader("view")} + ${"view"===this._expandedMenus[bi]?o` +
+ ${this._renderOptionSelector(se,this._viewModes)} + ${this._renderOptionSelector(oe,this._cameraSelectViewModes)} + ${this._renderOptionSelector(re,this._darkModes)} + ${this._renderNumberInput(le)} + ${this._renderSwitch(ce,this._defaults.view.default_cycle_camera)} + ${this._renderViewDefaultResetMenu()} ${this._renderViewTriggersMenu()} + ${this._renderViewKeyboardShortcutMenu()} +
+ `:""} + ${this._renderOptionSetHeader("menu")} + ${"menu"===this._expandedMenus[bi]?o` +
+ ${this._renderOptionSelector(de,this._menuStyles)} + ${this._renderOptionSelector(me,this._menuPositions)} + ${this._renderOptionSelector(ue,this._menuAlignments)} + ${this._renderNumberInput(he,{min:X})} + ${this._renderMenuButton("frigate")} + ${this._renderMenuButton("cameras")} + ${this._renderMenuButton("substreams")} + ${this._renderMenuButton("live")} + ${this._renderMenuButton("clips")} + ${this._renderMenuButton("snapshots")} + ${this._renderMenuButton("recordings")} + ${this._renderMenuButton("image")} + ${this._renderMenuButton("download")} + ${this._renderMenuButton("camera_ui")} + ${this._renderMenuButton("fullscreen")} + ${this._renderMenuButton("expand")} + ${this._renderMenuButton("timeline")} + ${this._renderMenuButton("media_player")} + ${this._renderMenuButton("microphone",o`${this._renderOptionSelector(`${R}.microphone.type`,this._microphoneButtonTypes,{label:l("config.menu.buttons.type")})}`)} + ${this._renderMenuButton("play")} + ${this._renderMenuButton("mute")} + ${this._renderMenuButton("screenshot")} + ${this._renderMenuButton("display_mode")} + ${this._renderMenuButton("ptz_controls")} + ${this._renderMenuButton("ptz_home")} +
+ `:""} + ${this._renderOptionSetHeader("status_bar")} + ${"status_bar"===this._expandedMenus[bi]?o` +
+ ${this._renderOptionSelector(_e,this._statusBarStyles)} + ${this._renderOptionSelector(ge,this._statusBarPositions)} + ${this._renderNumberInput(be,{min:pe,label:l("config.status_bar.height")})} + ${this._renderNumberInput(ve,{min:0,max:60,default:this._defaults.status_bar.popup_seconds,label:l("config.status_bar.popup_seconds")})} + ${this._renderStatusBarItem("title")} + ${this._renderStatusBarItem("resolution")} + ${this._renderStatusBarItem("technology")} + ${this._renderStatusBarItem("engine")} +
+ `:""} + ${this._renderOptionSetHeader("live")} + ${"live"===this._expandedMenus[bi]?o` +
+ ${this._renderSwitch(fe,this._defaults.live.preload)} + ${this._renderSwitch($e,this._defaults.live.draggable)} + ${this._renderSwitch(ye,this._defaults.live.zoomable)} + ${this._renderSwitch(we,this._defaults.live.lazy_load)} + ${this._renderOptionSelector(Se,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(xe,this._mediaActionPositiveConditions,{multiple:!0})} + ${this._renderOptionSelector(Me,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(Ie,this._mediaLiveMuteConditions,{multiple:!0})} + ${this._renderOptionSelector(ke,this._mediaLiveUnmuteConditions,{multiple:!0})} + ${this._renderOptionSelector(Oe,this._transitionEffects)} + ${this._renderSwitch(Ce,this._defaults.live.show_image_during_load)} + ${this._renderViewDisplay("live.display",ze,Ae,Ne,Te)} + ${this._putInSubmenu("live.controls",!0,"config.live.controls.editor_label","mdi:gamepad",o` + ${this._renderSwitch(Be,this._defaults.live.controls.builtin,{label:l("config.common.controls.builtin")})} + ${this._renderNextPreviousControls("live.controls.next_previous",Ee,Pe,{allowIcons:!0})} + ${this._renderThumbnailsControls("live.controls.thumbnails",He,Le,Ve,Ke,Ue,this._defaults.live.controls.thumbnails,{configPathMediaType:je,configPathEventsMediaType:qe,configPathMode:Re})} + ${this._renderMiniTimeline("live.controls.timeline",De,Fe,Ge,Je,Qe,We,this._defaults.live.controls.timeline.show_recordings,Xe)} + ${this._putInSubmenu("live.controls.ptz",!0,"config.live.controls.ptz.editor_label","mdi:pan",o` + ${this._renderOptionSelector(Ye,this._ptzModes)} + ${this._renderOptionSelector(Ze,this._ptzPositions)} + ${this._renderOptionSelector(ea,this._ptzOrientations)} + ${this._renderSwitch(aa,this._defaults.live.controls.ptz.hide_pan_tilt,{label:l("config.live.controls.ptz.hide_pan_tilt")})} + ${this._renderSwitch(ta,this._defaults.live.controls.ptz.hide_pan_tilt,{label:l("config.live.controls.ptz.hide_zoom")})} + ${this._renderSwitch(ia,this._defaults.live.controls.ptz.hide_home,{label:l("config.live.controls.ptz.hide_home")})} + `)} + `)} + ${this._putInSubmenu("live.microphone",!0,"config.live.microphone.editor_label","mdi:microphone",o` + ${this._renderNumberInput(na)} + ${this._renderSwitch(sa,this._defaults.live.microphone.always_connected)} + ${this._renderNumberInput(oa)} + `)} +
+ `:""} + ${this._renderOptionSetHeader("media_gallery")} + ${"media_gallery"===this._expandedMenus[bi]?o`
+ ${this._renderThumbnailsControls("media_gallery.controls.thumbnails",ra,la,ca,da,ma,this._defaults.media_gallery.controls.thumbnails)} + ${this._renderFilterControls("media_gallery.controls.filter",ua)} +
`:""} + ${this._renderOptionSetHeader("media_viewer")} + ${"media_viewer"===this._expandedMenus[bi]?o`
+ ${this._renderOptionSelector(ha,this._mediaActionPositiveConditions,{multiple:!0})} + ${this._renderOptionSelector(_a,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(ga,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(ba,this._mediaActionPositiveConditions,{multiple:!0})} + ${this._renderSwitch(pa,this._defaults.media_viewer.draggable)} + ${this._renderSwitch(va,this._defaults.media_viewer.zoomable)} + ${this._renderSwitch(fa,this._defaults.media_viewer.lazy_load)} + ${this._renderOptionSelector($a,this._transitionEffects)} + ${this._renderSwitch(ya,this._defaults.media_viewer.snapshot_click_plays_clip)} + ${this._renderViewDisplay("media_viewer.display",wa,Sa,xa,Ma)} + ${this._putInSubmenu("media_viewer.controls",!0,"config.media_viewer.controls.editor_label","mdi:gamepad",o` + ${this._renderSwitch(Ia,this._defaults.media_viewer.controls.builtin,{label:l("config.common.controls.builtin")})} + ${this._renderNextPreviousControls("media_viewer.controls.next_previous",ka,Oa,{allowThumbnails:!0})} + ${this._renderThumbnailsControls("media_viewer.controls.thumbnails",Ca,za,Aa,Na,Ta,this._defaults.media_viewer.controls.thumbnails,{configPathMode:Ba})} + ${this._renderMiniTimeline("media_viewer.controls.timeline",Ea,Pa,Ha,La,Va,Ka,this._defaults.media_viewer.controls.timeline.show_recordings,Ua)} + `)} +
`:""} + ${this._renderOptionSetHeader("image")} + ${"image"===this._expandedMenus[bi]?o`
+ ${this._renderImageOptions(ja,qa,Ra,Da,Fa)} +
`:""} + ${this._renderOptionSetHeader("timeline")} + ${"timeline"===this._expandedMenus[bi]?o`
+ ${this._renderTimelineCoreControls(F,G,J,Q,W,this._defaults.timeline.show_recordings)} + ${this._renderThumbnailsControls("timeline.controls.thumbnails",Ga,Ja,Qa,Wa,Xa,this._defaults.timeline.controls.thumbnails,{configPathMode:Ya})} +
`:""} + ${this._renderOptionSetHeader("dimensions")} + ${"dimensions"===this._expandedMenus[bi]?o`
+ ${this._renderOptionSelector(Za,this._aspectRatioModes)} + ${this._renderStringInput(et)} + ${this._renderStringInput(at)} +
`:""} + ${this._renderOptionSetHeader("performance","low"===b(this._config,ui)?"warning":void 0)} + ${"performance"===this._expandedMenus[bi]?o`
+ ${"low"===b(this._config,ui)?this._renderInfo(l("config.performance.warning")):o``} + ${this._putInSubmenu("performance.features",!0,"config.performance.features.editor_label","mdi:feature-search",o` + ${this._renderSwitch(tt,this._defaults.performance.features.animated_progress_indicator)} + ${this._renderNumberInput(it,{max:nt})} + ${this._renderNumberInput(st,{min:1})} + `)} + ${this._putInSubmenu("performance.style",!0,"config.performance.style.editor_label","mdi:palette-swatch-variant",o` + ${this._renderSwitch(ot,this._defaults.performance.style.border_radius)} + ${this._renderSwitch(rt,this._defaults.performance.style.box_shadow)} + `)} +
`:""} + ${void 0!==this._config.overrides?o` ${this._renderOptionSetHeader("overrides")} + ${"overrides"===this._expandedMenus[bi]?o`
+ ${this._renderInfo(l("config.overrides.info"))} +
`:""}`:o``} +
+ `}_closeMenu(e){delete this._expandedMenus[e],this.requestUpdate()}_openMenu(e,a){this._expandedMenus[e]=a,this.requestUpdate()}_toggleMenu(e){if(e&&e.target){const a=e.target.domain,t=e.target.key;this._expandedMenus[a]===t?this._closeMenu(a):this._openMenu(a,t)}}_valueChangedHandler(e,a){if(!this._config||!this.hass)return;let t;if(a.detail&&void 0!==a.detail.value&&(t=a.detail.value,"string"==typeof t&&(t=t.trim())),b(this._config,e)===t)return;const i=m(this._config);""===t||void 0===t?lt(i,e):ct(i,e,t),this._updateConfig(i)}static get styles(){return c('ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n.option {\n padding: 4px 4px;\n cursor: pointer;\n}\n\n.option.option-overrides .title {\n color: var(--warning-color);\n}\n\n.row {\n display: flex;\n margin-bottom: -14px;\n pointer-events: none;\n}\n\n.title {\n padding-left: 16px;\n margin-top: -6px;\n pointer-events: none;\n}\n\n.title.warning {\n color: var(--warning-color);\n}\n\n.secondary {\n padding-left: 40px;\n color: var(--secondary-text-color);\n pointer-events: none;\n}\n\n.values {\n background: var(--secondary-background-color);\n display: grid;\n}\n\n.values + .option,\n.submenu + .option {\n margin-top: 10px;\n}\n\ndiv.upgrade {\n width: auto;\n border: 1px dotted var(--primary-color);\n margin: 10px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\ndiv.upgrade span {\n padding: 10px;\n}\n\n.submenu-header {\n display: flex;\n padding: 10px;\n cursor: pointer;\n}\n\n.submenu.selected > .submenu-header {\n background-color: var(--primary-color);\n color: var(--primary-text-color);\n}\n\n.submenu-header * {\n flex-basis: auto;\n pointer-events: none;\n}\n\n.submenu-header .new-camera {\n font-style: italic;\n}\n\n.submenu:not(.selected) > .submenu-header .new-camera {\n color: var(--secondary-text-color, "black");\n}\n\n.submenu-header ha-icon,\n.submenu-header img {\n padding-right: 15px;\n}\n\n.submenu.selected {\n border: 1px solid var(--primary-color);\n}\n\n.submenu {\n width: calc(100% - 20px);\n margin-left: auto;\n margin-right: auto;\n margin-bottom: 10px;\n}\n\n.submenu:first-child,\n:not(.submenu) + .submenu {\n margin-top: 10px;\n}\n\n.submenu .controls {\n display: inline-block;\n margin-left: auto;\n margin-right: 0px;\n margin-bottom: 5px;\n}\n\n.submenu .controls ha-icon-button.button {\n --mdc-icon-button-size: 32px;\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n}\n\nspan.info {\n padding: 10px;\n}\n\nha-selector {\n padding: 10px;\n border: 1px solid var(--divider-color);\n}')}};t([i({attribute:!1})],vi.prototype,"hass",void 0),t([d()],vi.prototype,"_config",void 0),t([d()],vi.prototype,"_defaults",void 0),t([d()],vi.prototype,"_expandedMenus",void 0),vi=t([n("frigate-card-editor")],vi);export{vi as FrigateCardEditor}; diff --git a/config/www/community/frigate-hass-card/editor-ce460dd0.js.gz b/config/www/community/frigate-hass-card/editor-ce460dd0.js.gz new file mode 100644 index 00000000..ea45d48e Binary files /dev/null and b/config/www/community/frigate-hass-card/editor-ce460dd0.js.gz differ diff --git a/config/www/community/frigate-hass-card/endOfDay-086a6977.js b/config/www/community/frigate-hass-card/endOfDay-086a6977.js new file mode 100644 index 00000000..21673a2a --- /dev/null +++ b/config/www/community/frigate-hass-card/endOfDay-086a6977.js @@ -0,0 +1 @@ +import{c$ as r}from"./card-320adb66.js";function o(o){const s=r(o);return s.setHours(23,59,59,999),s}export{o as e}; diff --git a/config/www/community/frigate-hass-card/endOfDay-086a6977.js.gz b/config/www/community/frigate-hass-card/endOfDay-086a6977.js.gz new file mode 100644 index 00000000..efe6a589 Binary files /dev/null and b/config/www/community/frigate-hass-card/endOfDay-086a6977.js.gz differ diff --git a/config/www/community/frigate-hass-card/endOfDay-0c5086cb.js b/config/www/community/frigate-hass-card/endOfDay-0c5086cb.js new file mode 100644 index 00000000..9f7c52e3 --- /dev/null +++ b/config/www/community/frigate-hass-card/endOfDay-0c5086cb.js @@ -0,0 +1 @@ +import{d3 as r}from"./card-7cd05290.js";function o(o){const s=r(o);return s.setHours(23,59,59,999),s}export{o as e}; diff --git a/config/www/community/frigate-hass-card/endOfDay-0c5086cb.js.gz b/config/www/community/frigate-hass-card/endOfDay-0c5086cb.js.gz new file mode 100644 index 00000000..2b01a43c Binary files /dev/null and b/config/www/community/frigate-hass-card/endOfDay-0c5086cb.js.gz differ diff --git a/config/www/community/frigate-hass-card/endOfDay-24d35e3f.js b/config/www/community/frigate-hass-card/endOfDay-24d35e3f.js new file mode 100644 index 00000000..94c721c6 --- /dev/null +++ b/config/www/community/frigate-hass-card/endOfDay-24d35e3f.js @@ -0,0 +1 @@ +import{d3 as r}from"./card-45855f1f.js";function o(o){const s=r(o);return s.setHours(23,59,59,999),s}export{o as e}; diff --git a/config/www/community/frigate-hass-card/endOfDay-24d35e3f.js.gz b/config/www/community/frigate-hass-card/endOfDay-24d35e3f.js.gz new file mode 100644 index 00000000..90d088de Binary files /dev/null and b/config/www/community/frigate-hass-card/endOfDay-24d35e3f.js.gz differ diff --git a/config/www/community/frigate-hass-card/endOfDay-696ac7f4.js b/config/www/community/frigate-hass-card/endOfDay-696ac7f4.js new file mode 100644 index 00000000..32f96c36 --- /dev/null +++ b/config/www/community/frigate-hass-card/endOfDay-696ac7f4.js @@ -0,0 +1 @@ +import{d3 as r}from"./card-769e2b91.js";function o(o){const s=r(o);return s.setHours(23,59,59,999),s}export{o as e}; diff --git a/config/www/community/frigate-hass-card/endOfDay-696ac7f4.js.gz b/config/www/community/frigate-hass-card/endOfDay-696ac7f4.js.gz new file mode 100644 index 00000000..a5c10156 Binary files /dev/null and b/config/www/community/frigate-hass-card/endOfDay-696ac7f4.js.gz differ diff --git a/config/www/community/frigate-hass-card/endOfDay-8be4da1b.js b/config/www/community/frigate-hass-card/endOfDay-8be4da1b.js new file mode 100644 index 00000000..2363a99e --- /dev/null +++ b/config/www/community/frigate-hass-card/endOfDay-8be4da1b.js @@ -0,0 +1 @@ +import{d3 as r}from"./card-09c4bade.js";function o(o){const s=r(o);return s.setHours(23,59,59,999),s}export{o as e}; diff --git a/config/www/community/frigate-hass-card/endOfDay-8be4da1b.js.gz b/config/www/community/frigate-hass-card/endOfDay-8be4da1b.js.gz new file mode 100644 index 00000000..c086b9f1 Binary files /dev/null and b/config/www/community/frigate-hass-card/endOfDay-8be4da1b.js.gz differ diff --git a/config/www/community/frigate-hass-card/endOfDay-97ae2cc7.js b/config/www/community/frigate-hass-card/endOfDay-97ae2cc7.js new file mode 100644 index 00000000..3e58ebe8 --- /dev/null +++ b/config/www/community/frigate-hass-card/endOfDay-97ae2cc7.js @@ -0,0 +1 @@ +import{d3 as r}from"./card-c642ee74.js";function o(o){const s=r(o);return s.setHours(23,59,59,999),s}export{o as e}; diff --git a/config/www/community/frigate-hass-card/endOfDay-97ae2cc7.js.gz b/config/www/community/frigate-hass-card/endOfDay-97ae2cc7.js.gz new file mode 100644 index 00000000..f3127ad8 Binary files /dev/null and b/config/www/community/frigate-hass-card/endOfDay-97ae2cc7.js.gz differ diff --git a/config/www/community/frigate-hass-card/endpoint-760ea36f.js b/config/www/community/frigate-hass-card/endpoint-760ea36f.js new file mode 100644 index 00000000..530d2b54 --- /dev/null +++ b/config/www/community/frigate-hass-card/endpoint-760ea36f.js @@ -0,0 +1 @@ +import{du as r,db as t,cQ as n,l as a}from"./card-7cd05290.js";const e=async(e,s,i,l)=>{if(!i.sign)return i.endpoint;let c;try{c=await r(s,i.endpoint,l)}catch(r){return t(r),null}return c?c.replace(/^http/i,"ws"):(n(e,a("error.failed_sign")),null)};export{e as g}; diff --git a/config/www/community/frigate-hass-card/endpoint-760ea36f.js.gz b/config/www/community/frigate-hass-card/endpoint-760ea36f.js.gz new file mode 100644 index 00000000..e8462676 Binary files /dev/null and b/config/www/community/frigate-hass-card/endpoint-760ea36f.js.gz differ diff --git a/config/www/community/frigate-hass-card/endpoint-9c79ab63.js b/config/www/community/frigate-hass-card/endpoint-9c79ab63.js new file mode 100644 index 00000000..f7672bea --- /dev/null +++ b/config/www/community/frigate-hass-card/endpoint-9c79ab63.js @@ -0,0 +1 @@ +import{du as r,db as t,cQ as n,l as a}from"./card-769e2b91.js";const e=async(e,s,i,l)=>{if(!i.sign)return i.endpoint;let c;try{c=await r(s,i.endpoint,l)}catch(r){return t(r),null}return c?c.replace(/^http/i,"ws"):(n(e,a("error.failed_sign")),null)};export{e as g}; diff --git a/config/www/community/frigate-hass-card/endpoint-9c79ab63.js.gz b/config/www/community/frigate-hass-card/endpoint-9c79ab63.js.gz new file mode 100644 index 00000000..6c01d22b Binary files /dev/null and b/config/www/community/frigate-hass-card/endpoint-9c79ab63.js.gz differ diff --git a/config/www/community/frigate-hass-card/endpoint-a6d38c7a.js b/config/www/community/frigate-hass-card/endpoint-a6d38c7a.js new file mode 100644 index 00000000..408311d9 --- /dev/null +++ b/config/www/community/frigate-hass-card/endpoint-a6d38c7a.js @@ -0,0 +1 @@ +import{dq as t,d7 as n}from"./card-320adb66.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}; diff --git a/config/www/community/frigate-hass-card/endpoint-a6d38c7a.js.gz b/config/www/community/frigate-hass-card/endpoint-a6d38c7a.js.gz new file mode 100644 index 00000000..71f4d1d4 Binary files /dev/null and b/config/www/community/frigate-hass-card/endpoint-a6d38c7a.js.gz differ diff --git a/config/www/community/frigate-hass-card/endpoint-cc3caf82.js b/config/www/community/frigate-hass-card/endpoint-cc3caf82.js new file mode 100644 index 00000000..187ccce3 --- /dev/null +++ b/config/www/community/frigate-hass-card/endpoint-cc3caf82.js @@ -0,0 +1 @@ +import{du as r,db as t,cQ as n,l as a}from"./card-c642ee74.js";const e=async(e,s,i,l)=>{if(!i.sign)return i.endpoint;let c;try{c=await r(s,i.endpoint,l)}catch(r){return t(r),null}return c?c.replace(/^http/i,"ws"):(n(e,a("error.failed_sign")),null)};export{e as g}; diff --git a/config/www/community/frigate-hass-card/endpoint-cc3caf82.js.gz b/config/www/community/frigate-hass-card/endpoint-cc3caf82.js.gz new file mode 100644 index 00000000..97b79225 Binary files /dev/null and b/config/www/community/frigate-hass-card/endpoint-cc3caf82.js.gz differ diff --git a/config/www/community/frigate-hass-card/endpoint-e9cb8034.js b/config/www/community/frigate-hass-card/endpoint-e9cb8034.js new file mode 100644 index 00000000..a15c8d0b --- /dev/null +++ b/config/www/community/frigate-hass-card/endpoint-e9cb8034.js @@ -0,0 +1 @@ +import{du as r,db as t,cQ as n,l as a}from"./card-09c4bade.js";const e=async(e,s,i,l)=>{if(!i.sign)return i.endpoint;let c;try{c=await r(s,i.endpoint,l)}catch(r){return t(r),null}return c?c.replace(/^http/i,"ws"):(n(e,a("error.failed_sign")),null)};export{e as g}; diff --git a/config/www/community/frigate-hass-card/endpoint-e9cb8034.js.gz b/config/www/community/frigate-hass-card/endpoint-e9cb8034.js.gz new file mode 100644 index 00000000..1b3903b9 Binary files /dev/null and b/config/www/community/frigate-hass-card/endpoint-e9cb8034.js.gz differ diff --git a/config/www/community/frigate-hass-card/endpoint-f74ef6db.js b/config/www/community/frigate-hass-card/endpoint-f74ef6db.js new file mode 100644 index 00000000..757d0868 --- /dev/null +++ b/config/www/community/frigate-hass-card/endpoint-f74ef6db.js @@ -0,0 +1 @@ +import{du as r,db as t,cQ as n,l as a}from"./card-45855f1f.js";const e=async(e,s,i,l)=>{if(!i.sign)return i.endpoint;let c;try{c=await r(s,i.endpoint,l)}catch(r){return t(r),null}return c?c.replace(/^http/i,"ws"):(n(e,a("error.failed_sign")),null)};export{e as g}; diff --git a/config/www/community/frigate-hass-card/endpoint-f74ef6db.js.gz b/config/www/community/frigate-hass-card/endpoint-f74ef6db.js.gz new file mode 100644 index 00000000..110d4957 Binary files /dev/null and b/config/www/community/frigate-hass-card/endpoint-f74ef6db.js.gz differ diff --git a/config/www/community/frigate-hass-card/engine-86b0096c.js b/config/www/community/frigate-hass-card/engine-86b0096c.js new file mode 100644 index 00000000..e0a518f7 --- /dev/null +++ b/config/www/community/frigate-hass-card/engine-86b0096c.js @@ -0,0 +1 @@ +const e=1e4;export{e as C}; diff --git a/config/www/community/frigate-hass-card/engine-86b0096c.js.gz b/config/www/community/frigate-hass-card/engine-86b0096c.js.gz new file mode 100644 index 00000000..0280383b Binary files /dev/null and b/config/www/community/frigate-hass-card/engine-86b0096c.js.gz differ diff --git a/config/www/community/frigate-hass-card/engine-frigate-1cc4bb56.js b/config/www/community/frigate-hass-card/engine-frigate-1cc4bb56.js new file mode 100644 index 00000000..2e8470b0 --- /dev/null +++ b/config/www/community/frigate-hass-card/engine-frigate-1cc4bb56.js @@ -0,0 +1,3 @@ +import{d3 as e,d_ as t,d$ as n,e0 as a,e1 as r,e2 as i,l as s,e3 as o,e4 as c,e5 as g,e6 as l,db as u,dT as m,k as d,i as f,dh as h,e7 as p,dn as _,d9 as y,d7 as b,e8 as w,e9 as D,ea as C,dQ as v,j as T,eb as I,dc as S,de as M,dd as F}from"./card-c642ee74.js";import{C as $}from"./engine-86b0096c.js";import{C as z,G as N,g as E}from"./engine-generic-bb62ddef.js";import{a as R,V as Y}from"./media-c9012082.js";import{s as x,e as H}from"./startOfHour-4de961cf.js";function j(t){return e(1e3*t)}const Z=n.object({camera:n.string(),end_time:n.number().nullable(),false_positive:n.boolean().nullable(),has_clip:n.boolean(),has_snapshot:n.boolean(),id:n.string(),label:n.string(),sub_label:n.string().nullable(),start_time:n.number(),top_score:n.number().nullable(),zones:n.string().array(),retain_indefinitely:n.boolean().optional()}).array(),q=n.object({hour:n.preprocess((e=>Number(e)),n.number().min(0).max(23)),duration:n.number().min(0),events:n.number().min(0)}),U=n.object({day:n.preprocess((e=>"string"==typeof e?a(e):e),n.date()),events:n.number(),hours:q.array()}).array(),W=n.object({start_time:n.number(),end_time:n.number(),id:n.string()}).array(),Q=n.object({success:n.boolean(),message:n.string()}),k=n.object({camera:n.string(),day:n.string(),label:n.string(),sub_label:n.string().nullable(),zones:n.string().array()}).array(),P=n.object({name:n.string().optional(),features:n.string().array().optional(),presets:n.string().array().optional()}),A=n.object({camera:n.string(),snapshot:n.object({frame_time:n.number()}).nullable(),has_clip:n.boolean(),has_snapshot:n.boolean(),label:n.string(),current_zones:n.string().array()}),O=n.object({before:A,after:A,type:n.enum(["new","update","end"])});const L=async(e,t)=>await r(e,Z,{type:"frigate/events/get",...t},!0),V=e=>"birdseye"===e.frigate.camera_name;class G extends z{constructor(e,t,n){super(e,t,n),this._frigateEventHandler=e=>{const t=!e.before.has_snapshot&&e.after.has_snapshot||e.before.snapshot?.frame_time!==e.after.snapshot?.frame_time,n=!e.before.has_clip&&e.after.has_clip,a=this.getConfig();if(a.frigate.zones?.length&&!a.frigate.zones.some((t=>e.after.current_zones.includes(t)))||a.frigate.labels?.length&&!a.frigate.labels.includes(e.after.label))return;const r=a.triggers.events;(r.includes("events")||r.includes("snapshots")&&t||r.includes("clips")&&n)&&this._eventCallback?.({fidelity:"high",cameraID:this.getID(),type:e.type,clip:n&&r.includes("clips"),snapshot:t&&r.includes("snapshots")})}}async initialize(e){return await this._initializeConfig(e.hass,e.entityRegistryManager),await this._initializeCapabilities(e.hass),await this._subscribeToEvents(e.hass,e.frigateEventWatcher),await super.initialize(e)}async _initializeConfig(e,n){const a=this.getConfig(),r=!!a.frigate?.camera_name,i=a.triggers.motion||a.triggers.occupancy;let g=null;const l=o(a);if(l&&(!r||i)&&(g=await n.getEntity(e,l),!g))throw new c(s("error.no_camera_entity"),a);if(g&&!r){const e=this._getFrigateCameraNameFromEntity(g);e&&(this._config.frigate.camera_name=e)}if(i){const r=await n.getMatchingEntities(e,(e=>e.config_entry_id===g?.config_entry_id&&!e.disabled_by&&e.entity_id.startsWith("binary_sensor.")));if(a.triggers.motion){const e=this._getMotionSensor(a,[...r.values()]);e&&a.triggers.entities.push(e)}if(a.triggers.occupancy){const e=this._getOccupancySensor(a,[...r.values()]);e&&a.triggers.entities.push(...e)}a.triggers.entities=(u=a.triggers.entities)&&u.length?t(u):[]}var u}async _initializeCapabilities(e){const t=this.getConfig(),n=g(this.getConfig()),a=await this._getPTZCapabilities(e,t),r=n||a?{...a,...n}:null,i=V(t);this._capabilities=new l({"favorite-events":!i,"favorite-recordings":!1,seek:!i,clips:!i,snapshots:!i,recordings:!i,live:!0,menu:!0,substream:!0,...r&&{ptz:r}},{disable:t.capabilities?.disable,disableExcept:t.capabilities?.disable_except})}_getFrigateCameraNameFromEntity(e){if("frigate"===e.platform&&e.unique_id&&"string"==typeof e.unique_id){const t=e.unique_id.match(/:camera:(?[^:]+)$/);if(t&&t.groups)return t.groups.camera}return null}async _getPTZCapabilities(e,t){if(!t.frigate.camera_name||V(t))return null;let n=null;try{n=await(async(e,t,n)=>await r(e,P,{type:"frigate/ptz/info",instance_id:t,camera:n},!0))(e,t.frigate.client_id,t.frigate.camera_name)}catch(e){return u(e),null}const a=[...n.features?.includes("pt")?["continuous"]:[]],i=[...n.features?.includes("zoom")?["continuous"]:[]],s=n.presets;return a.length||i.length||s?.length?{...a&&{left:a,right:a,up:a,down:a},...i&&{zoomIn:i,zoomOut:i},...s&&{presets:s}}:null}_getMotionSensor(e,t){return e.frigate.camera_name?t.find((t=>"string"==typeof t.unique_id&&!!t.unique_id?.match(new RegExp(`:motion_sensor:${e.frigate.camera_name}`))))?.entity_id??null:null}_getOccupancySensor(e,t){const n=[],a=(e,a)=>{const r=t.find((t=>"string"==typeof t.unique_id&&!!t.unique_id?.match(new RegExp(`:occupancy_sensor:${e}_${a}`))))?.entity_id??null;r&&n.push(r)};if(e.frigate.camera_name){const t=e.frigate.zones?.length?e.frigate.zones:[e.frigate.camera_name],r=e.frigate.labels?.length?e.frigate.labels:["all"];for(const e of t)for(const t of r)a(e,t);if(n.length)return n}return null}async _subscribeToEvents(e,t){const n=this.getConfig();if(!n.triggers.events.length||!n.frigate.camera_name)return; +/* istanbul ignore next -- exercising the matcher is not possible when the + test uses an event watcher -- @preserve */const a={instanceID:n.frigate.client_id,callback:e=>this._frigateEventHandler(e),matcher:e=>e.after.camera===n.frigate.camera_name};await t.subscribe(e,a),this._onDestroy((()=>t.unsubscribe(a)))}}class J{constructor(){this._requests=[],this._unsubscribeCallback={}}async subscribe(e,t){const n=!this._hasSubscribers(t.instanceID);this._requests.push(t),n&&(this._unsubscribeCallback[t.instanceID]=await e.connection.subscribeMessage((e=>this._receiveHandler(t.instanceID,e)),{type:"frigate/events/subscribe",instance_id:t.instanceID}))}async unsubscribe(e){this._requests=this._requests.filter((t=>t!==e)),this._hasSubscribers(e.instanceID)||(await this._unsubscribeCallback[e.instanceID](),delete this._unsubscribeCallback[e.instanceID])}_hasSubscribers(e){return!!this._requests.filter((t=>t.instanceID===e)).length}_receiveHandler(e,t){let n;try{n=JSON.parse(t)}catch(e){return void console.warn("Received non-JSON payload as Frigate event",t)}const a=O.safeParse(n);if(a.success)for(const t of this._requests)t.instanceID!==e||t.matcher&&!t.matcher(a.data)||t.callback(a.data);else console.warn("Received malformed Frigate event from Home Assistant",t)}}function B(e,t){const n=function(e){if(!X[e]){const t=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),n="06/25/2014, 00:00:00"===t||"‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00"===t;X[e]=n?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}return X[e]}(t);return"formatToParts"in n?function(e,t){try{const n=e.formatToParts(t),a=[];for(let e=0;e=0?i:1e3+i,a-r}function se(e,t){return-23<=e&&e<=23&&(null==t||0<=t&&t<=59)}const oe={};function ce(e){const t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+e-+t}const ge=36e5,le=6e4,ue=2,me={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,plainTime:/:/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/};function de(e,t={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(null===e)return new Date(NaN);const n=null==t.additionalDigits?ue:Number(t.additionalDigits);if(2!==n&&1!==n&&0!==n)throw new RangeError("additionalDigits must be 0, 1 or 2");if(e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e))return new Date(e.getTime());if("number"==typeof e||"[object Number]"===Object.prototype.toString.call(e))return new Date(e);if("[object String]"!==Object.prototype.toString.call(e))return new Date(NaN);const a=function(e){const t={};let n,a=me.dateTimePattern.exec(e);a?(t.date=a[1],n=a[3]):(a=me.datePattern.exec(e),a?(t.date=a[1],n=a[2]):(t.date=null,n=e));if(n){const e=me.timeZone.exec(n);e?(t.time=n.replace(e[1],""),t.timeZone=e[1].trim()):t.time=n}return t}(e),{year:r,restDateString:i}=function(e,t){if(e){const n=me.YYY[t],a=me.YYYYY[t];let r=me.YYYY.exec(e)||a.exec(e);if(r){const t=r[1];return{year:parseInt(t,10),restDateString:e.slice(t.length)}}if(r=me.YY.exec(e)||n.exec(e),r){const t=r[1];return{year:100*parseInt(t,10),restDateString:e.slice(t.length)}}}return{year:null}}(a.date,n),s=function(e,t){if(null===t)return null;let n,a,r;if(!e||!e.length)return n=new Date(0),n.setUTCFullYear(t),n;let i=me.MM.exec(e);if(i)return n=new Date(0),a=parseInt(i[1],10)-1,ye(t,a)?(n.setUTCFullYear(t,a),n):new Date(NaN);if(i=me.DDD.exec(e),i){n=new Date(0);const e=parseInt(i[1],10);return function(e,t){if(t<1)return!1;const n=_e(e);if(n&&t>366)return!1;if(!n&&t>365)return!1;return!0}(t,e)?(n.setUTCFullYear(t,0,e),n):new Date(NaN)}if(i=me.MMDD.exec(e),i){n=new Date(0),a=parseInt(i[1],10)-1;const e=parseInt(i[2],10);return ye(t,a,e)?(n.setUTCFullYear(t,a,e),n):new Date(NaN)}if(i=me.Www.exec(e),i)return r=parseInt(i[1],10)-1,be(r)?fe(t,r):new Date(NaN);if(i=me.WwwD.exec(e),i){r=parseInt(i[1],10)-1;const e=parseInt(i[2],10)-1;return be(r,e)?fe(t,r,e):new Date(NaN)}return null}(i,r);if(null===s||isNaN(s.getTime()))return new Date(NaN);if(s){const e=s.getTime();let n,r=0;if(a.time&&(r=function(e){let t,n,a=me.HH.exec(e);if(a)return t=parseFloat(a[1].replace(",",".")),we(t)?t%24*ge:NaN;if(a=me.HHMM.exec(e),a)return t=parseInt(a[1],10),n=parseFloat(a[2].replace(",",".")),we(t,n)?t%24*ge+n*le:NaN;if(a=me.HHMMSS.exec(e),a){t=parseInt(a[1],10),n=parseInt(a[2],10);const e=parseFloat(a[3].replace(",","."));return we(t,n,e)?t%24*ge+n*le+1e3*e:NaN}return null}(a.time),null===r||isNaN(r)))return new Date(NaN);if(a.timeZone||t.timeZone){if(n=re(a.timeZone||t.timeZone,new Date(e+r)),isNaN(n))return new Date(NaN)}else n=ce(new Date(e+r)),n=ce(new Date(e+r+n));return new Date(e+r+n)}return new Date(NaN)}function fe(e,t,n){t=t||0,n=n||0;const a=new Date(0);a.setUTCFullYear(e,0,4);const r=7*t+n+1-(a.getUTCDay()||7);return a.setUTCDate(a.getUTCDate()+r),a}const he=[31,28,31,30,31,30,31,31,30,31,30,31],pe=[31,29,31,30,31,30,31,31,30,31,30,31];function _e(e){return e%400==0||e%4==0&&e%100!=0}function ye(e,t,n){if(t<0||t>11)return!1;if(null!=n){if(n<1)return!1;const a=_e(e);if(a&&n>pe[t])return!1;if(!a&&n>he[t])return!1}return!0}function be(e,t){return!(e<0||e>52)&&(null==t||!(t<0||t>6))}function we(e,t,n){return!(e<0||e>=25)&&((null==t||!(t<0||t>=60))&&(null==n||!(n<0||n>=60)))}const De=e=>{const t=Intl.DateTimeFormat().resolvedOptions().timeZone,n=Math.round(e.end_time?e.end_time-e.start_time:Date.now()/1e3-e.start_time),a=null!==e.top_score?` ${Math.round(100*e.top_score)}%`:"";return`${m(function(e,t,n){const a=re(t,e=de(e,n),!0),r=new Date(e.getTime()-a),i=new Date(0);return i.setFullYear(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate()),i.setHours(r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),r.getUTCMilliseconds()),i}(1e3*e.start_time,t))} [${n}s, ${d(e.label)}${a}]`};class Ce extends R{constructor(e,t,n,a,r,i){super(e,t),this._event=n,this._contentID=a,this._thumbnail=r,this._subLabels=i??null}getStartTime(){return j(this._event.start_time)}getEndTime(){return this._event.end_time?j(this._event.end_time):null}inProgress(){return!this.getEndTime()}getVideoContentType(){return Y.HLS}getID(){return this._event.id}getContentID(){return this._contentID}getTitle(){return De(this._event)}getThumbnail(){return this._thumbnail}isFavorite(){return this._event.retain_indefinitely??null}setFavorite(e){this._event.retain_indefinitely=e}getWhat(){return[this._event.label]}getWhere(){const e=this._event.zones;return e.length?e:null}getScore(){return this._event.top_score}getTags(){return this._subLabels}isGroupableWith(e){return this.getMediaType()===e.getMediaType()&&f(this.getWhere(),e.getWhere())&&f(this.getWhat(),e.getWhat())}}class ve extends R{constructor(e,t,n,a,r,i){super(e,t),this._recording=n,this._id=a,this._contentID=r,this._title=i}getID(){return this._id}getStartTime(){return this._recording.startTime}getEndTime(){return this._recording.endTime}inProgress(){return!this.getEndTime()}getVideoContentType(){return Y.HLS}getContentID(){return this._contentID}getTitle(){return this._title}getEventCount(){return this._recording.events}}class Te{static createEventViewMedia(e,t,n,a,r){return"clip"===e&&!a.has_clip||"snapshot"===e&&!a.has_snapshot||!n.frigate.client_id||!n.frigate.camera_name?null:new Ce(e,t,a,((e,t,n,a)=>`media-source://frigate/${e}/event/${a}/${t}/${n.id}`)(n.frigate.client_id,n.frigate.camera_name,a,"clip"===e?"clips":"snapshots"),((e,t)=>`/api/frigate/${e}/thumbnail/${t.id}`)(n.frigate.client_id,a),r)}static createRecordingViewMedia(e,t,n,a){return n.frigate.client_id&&n.frigate.camera_name?new ve("recording",e,t,((e,t)=>`${e.frigate?.client_id??""}/${e.frigate.camera_name??""}/${t.startTime.getTime()}/${t.endTime.getTime()}`)(n,t),((e,t,n)=>["media-source://frigate",e,"recordings",t,`${n.startTime.getFullYear()}-${String(n.startTime.getMonth()+1).padStart(2,"0")}-${String(String(n.startTime.getDate()).padStart(2,"0"))}`,String(n.startTime.getHours()).padStart(2,"0")].join("/"))(n.frigate.client_id,n.frigate.camera_name,t),((e,t)=>`${e} ${m(t.startTime)}`)(a,t)):null}}class Ie{static isFrigateMedia(e){return this.isFrigateEvent(e)||this.isFrigateRecording(e)}static isFrigateEvent(e){return e instanceof Ce}static isFrigateRecording(e){return e instanceof ve}}class Se{static isFrigateEventQueryResults(e){return e.engine===p.Frigate&&e.type===C.Event}static isFrigateRecordingQueryResults(e){return e.engine===p.Frigate&&e.type===C.Recording}static isFrigateRecordingSegmentsResults(e){return e.engine===p.Frigate&&e.type===C.RecordingSegments}}class Me extends N{constructor(e,t,n,a,r){super(t,r),this._throttledSegmentGarbageCollector=h(this._garbageCollectSegments.bind(this),36e5,{leading:!1,trailing:!0}),this._entityRegistryManager=e,this._frigateEventWatcher=new J,this._recordingSegmentsCache=n,this._requestCache=a}getEngineType(){return p.Frigate}async createCamera(e,t){const n=new G(t,this,{eventCallback:this._eventCallback});return await n.initialize({hass:e,entityRegistryManager:this._entityRegistryManager,stateWatcher:this._stateWatcher,frigateEventWatcher:this._frigateEventWatcher})}async getMediaDownloadPath(e,t,n){return Ie.isFrigateEvent(n)?{endpoint:`/api/frigate/${t.frigate.client_id}/notifications/${n.getID()}/`+(_.isClip(n)?"clip.mp4":"snapshot.jpg")+"?download=true",sign:!0}:Ie.isFrigateRecording(n)?{endpoint:`/api/frigate/${t.frigate.client_id}/recording/${t.frigate.camera_name}/start/${Math.floor(n.getStartTime().getTime()/1e3)}/end/${Math.floor(n.getEndTime().getTime()/1e3)}?download=true`,sign:!0}:null}generateDefaultEventQuery(e,t,n){const a=[...e.getCameraConfigs(t)],r=y(a.map((e=>e?.frigate.zones)),f),i=y(a.map((e=>e?.frigate.labels)),f);if(1===r.length&&1===i.length)return[{type:b.Event,cameraIDs:t,...i[0]&&{what:new Set(i[0])},...r[0]&&{where:new Set(r[0])},...n}];const s=[];for(const a of t){const t=e.getCameraConfig(a);t&&s.push({type:b.Event,cameraIDs:new Set([a]),...t.frigate.labels&&{what:new Set(t.frigate.labels)},...t.frigate.zones&&{where:new Set(t.frigate.zones)},...n})}return s.length?s:null}generateDefaultRecordingQuery(e,t,n){return[{type:b.Recording,cameraIDs:t,...n}]}generateDefaultRecordingSegmentsQuery(e,t,n){return n.start&&n.end?[{type:b.RecordingSegments,cameraIDs:t,start:n.start,end:n.end,...n}]:null}async favoriteMedia(e,t,n,a){Ie.isFrigateEvent(n)&&(await async function(e,t,n,a){const o={type:"frigate/event/retain",instance_id:t,event_id:n,retain:a},c=await r(e,Q,o,!0);if(!c.success)throw new i(s("error.failed_retain"),{request:o,response:c})}(e,t.frigate.client_id,n.getID(),a),n.setFavorite(a))}_buildInstanceToCameraIDMapFromQuery(e,t){const n=new Map;for(const a of t){const t=this._getQueryableCameraConfig(e,a),r=t?.frigate.client_id;r&&(n.has(r)||n.set(r,new Set),n.get(r)?.add(a))}return n}_getFrigateCameraNamesForCameraIDs(e,t){const n=new Set;for(const a of t){const t=this._getQueryableCameraConfig(e,a);t?.frigate.camera_name&&n.add(t.frigate.camera_name)}return n}async getEvents(e,t,n,a){const r=new Map,i=async(i,s)=>{if(!s||!s.size)return;const o={...n,cameraIDs:s},c=a?.useCache??1?this._requestCache.get(o):null;if(c)return void r.set(n,c);const g={instance_id:i,cameras:Array.from(this._getFrigateCameraNamesForCameraIDs(t,s)),...n.what&&{labels:Array.from(n.what)},...n.where&&{zones:Array.from(n.where)},...n.tags&&{sub_labels:Array.from(n.tags)},...n.end&&{before:Math.floor(n.end.getTime()/1e3)},...n.start&&{after:Math.floor(n.start.getTime()/1e3)},...n.limit&&{limit:n.limit},...n.hasClip&&{has_clip:n.hasClip},...n.hasSnapshot&&{has_snapshot:n.hasSnapshot},...n.favorite&&{favorites:n.favorite},limit:n?.limit??$},l={type:C.Event,engine:p.Frigate,instanceID:i,events:await L(e,g),expiry:v(new Date,{seconds:60}),cached:!1};(a?.useCache??1)&&this._requestCache.set(n,{...l,cached:!0},l.expiry),r.set(o,l)},s=this._buildInstanceToCameraIDMapFromQuery(t,n.cameraIDs);return await Promise.all(Array.from(s.keys()).map((e=>i(e,s.get(e))))),r.size?r:null}async getRecordings(e,t,n,a){const i=new Map,s=async(n,s)=>{const o={...n,cameraIDs:new Set([s])},c=a?.useCache??1?this._requestCache.get(o):null;if(c)return void i.set(o,c);const g=this._getQueryableCameraConfig(t,s);if(!g||!g.frigate.camera_name)return;const l=await(async(e,t,n)=>await r(e,U,{type:"frigate/recordings/summary",instance_id:t,camera:n,timezone:e.config.time_zone},!0))(e,g.frigate.client_id,g.frigate.camera_name);let u=[];for(const e of l??[])for(const t of e.hours){const n=v(e.day,{hours:t.hour}),a=x(n),r=H(n);(!o.start||a>=o.start)&&(!o.end||r<=o.end)&&u.push({cameraID:s,startTime:a,endTime:r,events:t.events})}void 0!==o.limit&&(u=S(u,(e=>e.startTime),"desc").slice(0,o.limit));const m={type:C.Recording,engine:p.Frigate,instanceID:g.frigate.client_id,recordings:u,expiry:v(new Date,{seconds:60}),cached:!1};(a?.useCache??1)&&this._requestCache.set(o,{...m,cached:!0},m.expiry),i.set(o,m)};return await Promise.all(Array.from(n.cameraIDs).map((e=>s(n,e)))),i.size?i:null}async getRecordingSegments(e,t,n,a){const i=new Map,s=async(n,s)=>{const o={...n,cameraIDs:new Set([s])},c=this._getQueryableCameraConfig(t,s);if(!c||!c.frigate.camera_name)return;const g={start:o.start,end:o.end},l=a?.useCache??1?this._recordingSegmentsCache.get(s,g):null;if(l)return void i.set(o,{type:C.RecordingSegments,engine:p.Frigate,instanceID:c.frigate.client_id,segments:l,cached:!0});const u={instance_id:c.frigate.client_id,camera:c.frigate.camera_name,after:Math.floor(o.start.getTime()/1e3),before:Math.floor(o.end.getTime()/1e3)},m=await(async(e,t)=>await r(e,W,{type:"frigate/recordings/get",...t},!0))(e,u);(a?.useCache??1)&&this._recordingSegmentsCache.add(s,g,m),i.set(o,{type:C.RecordingSegments,engine:p.Frigate,instanceID:c.frigate.client_id,segments:m,cached:!1})};return await Promise.all(Array.from(n.cameraIDs).map((e=>s(n,e)))),w((()=>this._throttledSegmentGarbageCollector(e,t))),i.size?i:null}_getCameraIDMatch(e,t,n,a){if(1===t.cameraIDs.size)return[...t.cameraIDs][0];for(const[t,r]of e.getCameraConfigEntries())if(r.frigate.client_id===n&&r.frigate.camera_name===a)return t;return null}generateMediaFromEvents(e,t,n,a){if(!Se.isFrigateEventQueryResults(a))return null;const r=[];for(const e of a.events){const i=this._getCameraIDMatch(t,n,a.instanceID,e.camera);if(!i)continue;const s=this._getQueryableCameraConfig(t,i);if(!s)continue;let o=null;if(n.hasClip||n.hasSnapshot||!e.has_clip&&!e.has_snapshot?n.hasSnapshot&&e.has_snapshot?o="snapshot":n.hasClip&&e.has_clip&&(o="clip"):o=e.has_clip?"clip":"snapshot",!o)continue;const c=Te.createEventViewMedia(o,i,s,e,e.sub_label?this._splitSubLabels(e.sub_label):void 0);c&&r.push(c)}return r}generateMediaFromRecordings(e,t,n,a){if(!Se.isFrigateRecordingQueryResults(a))return null;const r=[];for(const n of a.recordings){const a=this._getQueryableCameraConfig(t,n.cameraID);if(!a)continue;const i=Te.createRecordingViewMedia(n.cameraID,n,a,this.getCameraMetadata(e,a).title);i&&r.push(i)}return r}getQueryResultMaxAge(e){return e.type===b.Event||e.type===b.Recording?60:null}async getMediaSeekTime(e,t,n,a,r){const i=n.getStartTime(),s=n.getEndTime();if(!i||!s||as)return null;const o=n.getCameraID(),c={cameraIDs:new Set([o]),start:i,end:s,type:b.RecordingSegments},g=await this.getRecordingSegments(e,t,c,r);return g?this._getSeekTimeInSegments(i,a,Array.from(g.values())[0].segments):null}_getQueryableCameraConfig(e,t){const n=e.getCameraConfig(t);return!n||V(n)?null:n}_splitSubLabels(e){return e.split(",").map((e=>e.trim()))}async getMediaMetadata(e,t,n,a){const i=new Map;if((a?.useCache??1)&&this._requestCache.has(n)){const e=this._requestCache.get(n);if(e)return i.set(n,e),i}const s=new Set,o=new Set,c=new Set,g=new Set,l=this._buildInstanceToCameraIDMapFromQuery(t,n.cameraIDs),u=async(n,a)=>{const i=this._getFrigateCameraNamesForCameraIDs(t,a);for(const t of await(async(e,t)=>await r(e,k,{type:"frigate/events/summary",instance_id:t,timezone:e.config.time_zone},!0))(e,n))i.has(t.camera)&&(t.label&&s.add(t.label),t.zones.length&&t.zones.forEach(o.add,o),t.day&&c.add(t.day),t.sub_label&&this._splitSubLabels(t.sub_label).forEach(g.add,g))},m=async n=>{const r=await this.getRecordings(e,t,{type:b.Recording,cameraIDs:n},a);if(r)for(const e of r.values())if(Se.isFrigateRecordingQueryResults(e))for(const t of e.recordings)c.add(M(t.startTime))};await D([...l.entries()],(([e,t])=>(async()=>{await Promise.all([u(e,t),m(t)])})()));const d={type:C.MediaMetadata,engine:p.Frigate,metadata:{...s.size&&{what:s},...o.size&&{where:o},...c.size&&{days:c},...g.size&&{tags:g}},expiry:v(new Date,{seconds:60}),cached:!1};return(a?.useCache??1)&&this._requestCache.set(n,{...d,cached:!0},d.expiry),i.set(n,d),i}async _garbageCollectSegments(e,t){const n=this._recordingSegmentsCache.getCameraIDs(),a={cameraIDs:new Set(n),type:b.Recording},r=(e,t)=>`${e}/${t.getDate()}/${t.getHours()}`,i=await this.getRecordings(e,t,a);if(i)for(const[e,t]of i){if(!Se.isFrigateRecordingQueryResults(t))continue;const n=new Set;for(const e of t.recordings)n.add(r(e.cameraID,e.startTime));const a=Array.from(e.cameraIDs)[0];this._recordingSegmentsCache.expireMatches(a,(e=>{const t=r(a,j(e.start_time));return!n.has(t)}))}}_getSeekTimeInSegments(e,t,n){if(!n.length)return null;let a=0;for(const r of n){const n=j(r.start_time);if(n>t)break;const i=j(r.end_time),s=nt?t:i).getTime()-s.getTime()}return a/1e3}getMediaCapabilities(e){return{canFavorite:_.isEvent(e),canDownload:!0}}getCameraMetadata(e,t){const n=super.getCameraMetadata(e,t);return{title:t.title??T(e,t.camera_entity)??T(e,t.webrtc_card?.entity)??d(t.frigate?.camera_name)??t.id??"",icon:n.icon,engineLogo:I}}getCameraEndpoints(e,t){const n=(()=>{if(!e.frigate.url)return null;if(!e.frigate.camera_name)return{endpoint:e.frigate.url};const n=`${e.frigate.url}/cameras/`+e.frigate.camera_name;if("live"===t?.view)return{endpoint:n};const a=`${e.frigate.url}/events?camera=`+e.frigate.camera_name,r=`${e.frigate.url}/recording/`+e.frigate.camera_name;switch(t?.media?.getMediaType()){case"clip":case"snapshot":return{endpoint:a};case"recording":const e=t.media.getStartTime();if(e)return{endpoint:r+F(e,"yyyy-MM-dd/HH")}}switch(t?.view){case"clip":case"clips":case"snapshots":case"snapshot":return{endpoint:a};case"recording":case"recordings":return{endpoint:r}}return{endpoint:n}})(),a=E(e,{url:e.go2rtc?.url??`/api/frigate/${e.frigate.client_id}/mse`,stream:e.go2rtc?.stream??e.frigate.camera_name}),r={endpoint:`/api/frigate/${e.frigate.client_id}/jsmpeg/${e.frigate.camera_name}`,sign:!0},i=(()=>{const t=e.frigate.camera_name?e.frigate.camera_name:null;return t?{endpoint:t}:null})();return{...super.getCameraEndpoints(e,t),...n&&{ui:n},...a&&{go2rtc:a},...r&&{jsmpeg:r},...i&&{webrtcCard:i}}}async executePTZAction(e,t,n,a){const r=t.camera_entity;("preset"!==n||a?.preset)&&await e.callService("frigate","ptz",{entity_id:r,action:"stop"===a?.phase?"stop":"zoom_in"===n||"zoom_out"===n?"zoom":"preset"===n?"preset":"move",..."stop"!==a?.phase&&{argument:"zoom_in"===n?"in":"zoom_out"===n?"out":"preset"===n?a?.preset:n}})}}export{Me as FrigateCameraManagerEngine}; diff --git a/config/www/community/frigate-hass-card/engine-frigate-1cc4bb56.js.gz b/config/www/community/frigate-hass-card/engine-frigate-1cc4bb56.js.gz new file mode 100644 index 00000000..d4334e4b Binary files /dev/null and b/config/www/community/frigate-hass-card/engine-frigate-1cc4bb56.js.gz differ diff --git a/config/www/community/frigate-hass-card/engine-frigate-3f150159.js b/config/www/community/frigate-hass-card/engine-frigate-3f150159.js new file mode 100644 index 00000000..24965393 --- /dev/null +++ b/config/www/community/frigate-hass-card/engine-frigate-3f150159.js @@ -0,0 +1,3 @@ +import{d3 as e,d_ as t,d$ as n,e0 as a,e1 as r,e2 as i,l as s,e3 as o,e4 as c,e5 as g,e6 as l,db as u,dT as m,k as d,i as f,dh as h,e7 as p,dn as _,d9 as y,d7 as b,e8 as w,e9 as D,ea as C,dQ as v,j as T,eb as I,dc as S,de as M,dd as F}from"./card-45855f1f.js";import{C as $}from"./engine-86b0096c.js";import{C as z,G as N,g as E}from"./engine-generic-31c14ad9.js";import{a as R,V as Y}from"./media-c9012082.js";import{s as x,e as H}from"./startOfHour-5e3c525d.js";function j(t){return e(1e3*t)}const Z=n.object({camera:n.string(),end_time:n.number().nullable(),false_positive:n.boolean().nullable(),has_clip:n.boolean(),has_snapshot:n.boolean(),id:n.string(),label:n.string(),sub_label:n.string().nullable(),start_time:n.number(),top_score:n.number().nullable(),zones:n.string().array(),retain_indefinitely:n.boolean().optional()}).array(),q=n.object({hour:n.preprocess((e=>Number(e)),n.number().min(0).max(23)),duration:n.number().min(0),events:n.number().min(0)}),U=n.object({day:n.preprocess((e=>"string"==typeof e?a(e):e),n.date()),events:n.number(),hours:q.array()}).array(),W=n.object({start_time:n.number(),end_time:n.number(),id:n.string()}).array(),Q=n.object({success:n.boolean(),message:n.string()}),k=n.object({camera:n.string(),day:n.string(),label:n.string(),sub_label:n.string().nullable(),zones:n.string().array()}).array(),P=n.object({name:n.string().optional(),features:n.string().array().optional(),presets:n.string().array().optional()}),A=n.object({camera:n.string(),snapshot:n.object({frame_time:n.number()}).nullable(),has_clip:n.boolean(),has_snapshot:n.boolean(),label:n.string(),current_zones:n.string().array()}),O=n.object({before:A,after:A,type:n.enum(["new","update","end"])});const L=async(e,t)=>await r(e,Z,{type:"frigate/events/get",...t},!0),V=e=>"birdseye"===e.frigate.camera_name;class G extends z{constructor(e,t,n){super(e,t,n),this._frigateEventHandler=e=>{const t=!e.before.has_snapshot&&e.after.has_snapshot||e.before.snapshot?.frame_time!==e.after.snapshot?.frame_time,n=!e.before.has_clip&&e.after.has_clip,a=this.getConfig();if(a.frigate.zones?.length&&!a.frigate.zones.some((t=>e.after.current_zones.includes(t)))||a.frigate.labels?.length&&!a.frigate.labels.includes(e.after.label))return;const r=a.triggers.events;(r.includes("events")||r.includes("snapshots")&&t||r.includes("clips")&&n)&&this._eventCallback?.({fidelity:"high",cameraID:this.getID(),type:e.type,clip:n&&r.includes("clips"),snapshot:t&&r.includes("snapshots")})}}async initialize(e){return await this._initializeConfig(e.hass,e.entityRegistryManager),await this._initializeCapabilities(e.hass),await this._subscribeToEvents(e.hass,e.frigateEventWatcher),await super.initialize(e)}async _initializeConfig(e,n){const a=this.getConfig(),r=!!a.frigate?.camera_name,i=a.triggers.motion||a.triggers.occupancy;let g=null;const l=o(a);if(l&&(!r||i)&&(g=await n.getEntity(e,l),!g))throw new c(s("error.no_camera_entity"),a);if(g&&!r){const e=this._getFrigateCameraNameFromEntity(g);e&&(this._config.frigate.camera_name=e)}if(i){const r=await n.getMatchingEntities(e,(e=>e.config_entry_id===g?.config_entry_id&&!e.disabled_by&&e.entity_id.startsWith("binary_sensor.")));if(a.triggers.motion){const e=this._getMotionSensor(a,[...r.values()]);e&&a.triggers.entities.push(e)}if(a.triggers.occupancy){const e=this._getOccupancySensor(a,[...r.values()]);e&&a.triggers.entities.push(...e)}a.triggers.entities=(u=a.triggers.entities)&&u.length?t(u):[]}var u}async _initializeCapabilities(e){const t=this.getConfig(),n=g(this.getConfig()),a=await this._getPTZCapabilities(e,t),r=n||a?{...a,...n}:null,i=V(t);this._capabilities=new l({"favorite-events":!i,"favorite-recordings":!1,seek:!i,clips:!i,snapshots:!i,recordings:!i,live:!0,menu:!0,substream:!0,...r&&{ptz:r}},{disable:t.capabilities?.disable,disableExcept:t.capabilities?.disable_except})}_getFrigateCameraNameFromEntity(e){if("frigate"===e.platform&&e.unique_id&&"string"==typeof e.unique_id){const t=e.unique_id.match(/:camera:(?[^:]+)$/);if(t&&t.groups)return t.groups.camera}return null}async _getPTZCapabilities(e,t){if(!t.frigate.camera_name||V(t))return null;let n=null;try{n=await(async(e,t,n)=>await r(e,P,{type:"frigate/ptz/info",instance_id:t,camera:n},!0))(e,t.frigate.client_id,t.frigate.camera_name)}catch(e){return u(e),null}const a=[...n.features?.includes("pt")?["continuous"]:[]],i=[...n.features?.includes("zoom")?["continuous"]:[]],s=n.presets;return a.length||i.length||s?.length?{...a&&{left:a,right:a,up:a,down:a},...i&&{zoomIn:i,zoomOut:i},...s&&{presets:s}}:null}_getMotionSensor(e,t){return e.frigate.camera_name?t.find((t=>"string"==typeof t.unique_id&&!!t.unique_id?.match(new RegExp(`:motion_sensor:${e.frigate.camera_name}`))))?.entity_id??null:null}_getOccupancySensor(e,t){const n=[],a=(e,a)=>{const r=t.find((t=>"string"==typeof t.unique_id&&!!t.unique_id?.match(new RegExp(`:occupancy_sensor:${e}_${a}`))))?.entity_id??null;r&&n.push(r)};if(e.frigate.camera_name){const t=e.frigate.zones?.length?e.frigate.zones:[e.frigate.camera_name],r=e.frigate.labels?.length?e.frigate.labels:["all"];for(const e of t)for(const t of r)a(e,t);if(n.length)return n}return null}async _subscribeToEvents(e,t){const n=this.getConfig();if(!n.triggers.events.length||!n.frigate.camera_name)return; +/* istanbul ignore next -- exercising the matcher is not possible when the + test uses an event watcher -- @preserve */const a={instanceID:n.frigate.client_id,callback:e=>this._frigateEventHandler(e),matcher:e=>e.after.camera===n.frigate.camera_name};await t.subscribe(e,a),this._onDestroy((()=>t.unsubscribe(a)))}}class J{constructor(){this._requests=[],this._unsubscribeCallback={}}async subscribe(e,t){const n=!this._hasSubscribers(t.instanceID);this._requests.push(t),n&&(this._unsubscribeCallback[t.instanceID]=await e.connection.subscribeMessage((e=>this._receiveHandler(t.instanceID,e)),{type:"frigate/events/subscribe",instance_id:t.instanceID}))}async unsubscribe(e){this._requests=this._requests.filter((t=>t!==e)),this._hasSubscribers(e.instanceID)||(await this._unsubscribeCallback[e.instanceID](),delete this._unsubscribeCallback[e.instanceID])}_hasSubscribers(e){return!!this._requests.filter((t=>t.instanceID===e)).length}_receiveHandler(e,t){let n;try{n=JSON.parse(t)}catch(e){return void console.warn("Received non-JSON payload as Frigate event",t)}const a=O.safeParse(n);if(a.success)for(const t of this._requests)t.instanceID!==e||t.matcher&&!t.matcher(a.data)||t.callback(a.data);else console.warn("Received malformed Frigate event from Home Assistant",t)}}function B(e,t){const n=function(e){if(!X[e]){const t=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),n="06/25/2014, 00:00:00"===t||"‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00"===t;X[e]=n?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}return X[e]}(t);return"formatToParts"in n?function(e,t){try{const n=e.formatToParts(t),a=[];for(let e=0;e=0?i:1e3+i,a-r}function se(e,t){return-23<=e&&e<=23&&(null==t||0<=t&&t<=59)}const oe={};function ce(e){const t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+e-+t}const ge=36e5,le=6e4,ue=2,me={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,plainTime:/:/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/};function de(e,t={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(null===e)return new Date(NaN);const n=null==t.additionalDigits?ue:Number(t.additionalDigits);if(2!==n&&1!==n&&0!==n)throw new RangeError("additionalDigits must be 0, 1 or 2");if(e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e))return new Date(e.getTime());if("number"==typeof e||"[object Number]"===Object.prototype.toString.call(e))return new Date(e);if("[object String]"!==Object.prototype.toString.call(e))return new Date(NaN);const a=function(e){const t={};let n,a=me.dateTimePattern.exec(e);a?(t.date=a[1],n=a[3]):(a=me.datePattern.exec(e),a?(t.date=a[1],n=a[2]):(t.date=null,n=e));if(n){const e=me.timeZone.exec(n);e?(t.time=n.replace(e[1],""),t.timeZone=e[1].trim()):t.time=n}return t}(e),{year:r,restDateString:i}=function(e,t){if(e){const n=me.YYY[t],a=me.YYYYY[t];let r=me.YYYY.exec(e)||a.exec(e);if(r){const t=r[1];return{year:parseInt(t,10),restDateString:e.slice(t.length)}}if(r=me.YY.exec(e)||n.exec(e),r){const t=r[1];return{year:100*parseInt(t,10),restDateString:e.slice(t.length)}}}return{year:null}}(a.date,n),s=function(e,t){if(null===t)return null;let n,a,r;if(!e||!e.length)return n=new Date(0),n.setUTCFullYear(t),n;let i=me.MM.exec(e);if(i)return n=new Date(0),a=parseInt(i[1],10)-1,ye(t,a)?(n.setUTCFullYear(t,a),n):new Date(NaN);if(i=me.DDD.exec(e),i){n=new Date(0);const e=parseInt(i[1],10);return function(e,t){if(t<1)return!1;const n=_e(e);if(n&&t>366)return!1;if(!n&&t>365)return!1;return!0}(t,e)?(n.setUTCFullYear(t,0,e),n):new Date(NaN)}if(i=me.MMDD.exec(e),i){n=new Date(0),a=parseInt(i[1],10)-1;const e=parseInt(i[2],10);return ye(t,a,e)?(n.setUTCFullYear(t,a,e),n):new Date(NaN)}if(i=me.Www.exec(e),i)return r=parseInt(i[1],10)-1,be(r)?fe(t,r):new Date(NaN);if(i=me.WwwD.exec(e),i){r=parseInt(i[1],10)-1;const e=parseInt(i[2],10)-1;return be(r,e)?fe(t,r,e):new Date(NaN)}return null}(i,r);if(null===s||isNaN(s.getTime()))return new Date(NaN);if(s){const e=s.getTime();let n,r=0;if(a.time&&(r=function(e){let t,n,a=me.HH.exec(e);if(a)return t=parseFloat(a[1].replace(",",".")),we(t)?t%24*ge:NaN;if(a=me.HHMM.exec(e),a)return t=parseInt(a[1],10),n=parseFloat(a[2].replace(",",".")),we(t,n)?t%24*ge+n*le:NaN;if(a=me.HHMMSS.exec(e),a){t=parseInt(a[1],10),n=parseInt(a[2],10);const e=parseFloat(a[3].replace(",","."));return we(t,n,e)?t%24*ge+n*le+1e3*e:NaN}return null}(a.time),null===r||isNaN(r)))return new Date(NaN);if(a.timeZone||t.timeZone){if(n=re(a.timeZone||t.timeZone,new Date(e+r)),isNaN(n))return new Date(NaN)}else n=ce(new Date(e+r)),n=ce(new Date(e+r+n));return new Date(e+r+n)}return new Date(NaN)}function fe(e,t,n){t=t||0,n=n||0;const a=new Date(0);a.setUTCFullYear(e,0,4);const r=7*t+n+1-(a.getUTCDay()||7);return a.setUTCDate(a.getUTCDate()+r),a}const he=[31,28,31,30,31,30,31,31,30,31,30,31],pe=[31,29,31,30,31,30,31,31,30,31,30,31];function _e(e){return e%400==0||e%4==0&&e%100!=0}function ye(e,t,n){if(t<0||t>11)return!1;if(null!=n){if(n<1)return!1;const a=_e(e);if(a&&n>pe[t])return!1;if(!a&&n>he[t])return!1}return!0}function be(e,t){return!(e<0||e>52)&&(null==t||!(t<0||t>6))}function we(e,t,n){return!(e<0||e>=25)&&((null==t||!(t<0||t>=60))&&(null==n||!(n<0||n>=60)))}const De=e=>{const t=Intl.DateTimeFormat().resolvedOptions().timeZone,n=Math.round(e.end_time?e.end_time-e.start_time:Date.now()/1e3-e.start_time),a=null!==e.top_score?` ${Math.round(100*e.top_score)}%`:"";return`${m(function(e,t,n){const a=re(t,e=de(e,n),!0),r=new Date(e.getTime()-a),i=new Date(0);return i.setFullYear(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate()),i.setHours(r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),r.getUTCMilliseconds()),i}(1e3*e.start_time,t))} [${n}s, ${d(e.label)}${a}]`};class Ce extends R{constructor(e,t,n,a,r,i){super(e,t),this._event=n,this._contentID=a,this._thumbnail=r,this._subLabels=i??null}getStartTime(){return j(this._event.start_time)}getEndTime(){return this._event.end_time?j(this._event.end_time):null}inProgress(){return!this.getEndTime()}getVideoContentType(){return Y.HLS}getID(){return this._event.id}getContentID(){return this._contentID}getTitle(){return De(this._event)}getThumbnail(){return this._thumbnail}isFavorite(){return this._event.retain_indefinitely??null}setFavorite(e){this._event.retain_indefinitely=e}getWhat(){return[this._event.label]}getWhere(){const e=this._event.zones;return e.length?e:null}getScore(){return this._event.top_score}getTags(){return this._subLabels}isGroupableWith(e){return this.getMediaType()===e.getMediaType()&&f(this.getWhere(),e.getWhere())&&f(this.getWhat(),e.getWhat())}}class ve extends R{constructor(e,t,n,a,r,i){super(e,t),this._recording=n,this._id=a,this._contentID=r,this._title=i}getID(){return this._id}getStartTime(){return this._recording.startTime}getEndTime(){return this._recording.endTime}inProgress(){return!this.getEndTime()}getVideoContentType(){return Y.HLS}getContentID(){return this._contentID}getTitle(){return this._title}getEventCount(){return this._recording.events}}class Te{static createEventViewMedia(e,t,n,a,r){return"clip"===e&&!a.has_clip||"snapshot"===e&&!a.has_snapshot||!n.frigate.client_id||!n.frigate.camera_name?null:new Ce(e,t,a,((e,t,n,a)=>`media-source://frigate/${e}/event/${a}/${t}/${n.id}`)(n.frigate.client_id,n.frigate.camera_name,a,"clip"===e?"clips":"snapshots"),((e,t)=>`/api/frigate/${e}/thumbnail/${t.id}`)(n.frigate.client_id,a),r)}static createRecordingViewMedia(e,t,n,a){return n.frigate.client_id&&n.frigate.camera_name?new ve("recording",e,t,((e,t)=>`${e.frigate?.client_id??""}/${e.frigate.camera_name??""}/${t.startTime.getTime()}/${t.endTime.getTime()}`)(n,t),((e,t,n)=>["media-source://frigate",e,"recordings",t,`${n.startTime.getFullYear()}-${String(n.startTime.getMonth()+1).padStart(2,"0")}-${String(String(n.startTime.getDate()).padStart(2,"0"))}`,String(n.startTime.getHours()).padStart(2,"0")].join("/"))(n.frigate.client_id,n.frigate.camera_name,t),((e,t)=>`${e} ${m(t.startTime)}`)(a,t)):null}}class Ie{static isFrigateMedia(e){return this.isFrigateEvent(e)||this.isFrigateRecording(e)}static isFrigateEvent(e){return e instanceof Ce}static isFrigateRecording(e){return e instanceof ve}}class Se{static isFrigateEventQueryResults(e){return e.engine===p.Frigate&&e.type===C.Event}static isFrigateRecordingQueryResults(e){return e.engine===p.Frigate&&e.type===C.Recording}static isFrigateRecordingSegmentsResults(e){return e.engine===p.Frigate&&e.type===C.RecordingSegments}}class Me extends N{constructor(e,t,n,a,r){super(t,r),this._throttledSegmentGarbageCollector=h(this._garbageCollectSegments.bind(this),36e5,{leading:!1,trailing:!0}),this._entityRegistryManager=e,this._frigateEventWatcher=new J,this._recordingSegmentsCache=n,this._requestCache=a}getEngineType(){return p.Frigate}async createCamera(e,t){const n=new G(t,this,{eventCallback:this._eventCallback});return await n.initialize({hass:e,entityRegistryManager:this._entityRegistryManager,stateWatcher:this._stateWatcher,frigateEventWatcher:this._frigateEventWatcher})}async getMediaDownloadPath(e,t,n){return Ie.isFrigateEvent(n)?{endpoint:`/api/frigate/${t.frigate.client_id}/notifications/${n.getID()}/`+(_.isClip(n)?"clip.mp4":"snapshot.jpg")+"?download=true",sign:!0}:Ie.isFrigateRecording(n)?{endpoint:`/api/frigate/${t.frigate.client_id}/recording/${t.frigate.camera_name}/start/${Math.floor(n.getStartTime().getTime()/1e3)}/end/${Math.floor(n.getEndTime().getTime()/1e3)}?download=true`,sign:!0}:null}generateDefaultEventQuery(e,t,n){const a=[...e.getCameraConfigs(t)],r=y(a.map((e=>e?.frigate.zones)),f),i=y(a.map((e=>e?.frigate.labels)),f);if(1===r.length&&1===i.length)return[{type:b.Event,cameraIDs:t,...i[0]&&{what:new Set(i[0])},...r[0]&&{where:new Set(r[0])},...n}];const s=[];for(const a of t){const t=e.getCameraConfig(a);t&&s.push({type:b.Event,cameraIDs:new Set([a]),...t.frigate.labels&&{what:new Set(t.frigate.labels)},...t.frigate.zones&&{where:new Set(t.frigate.zones)},...n})}return s.length?s:null}generateDefaultRecordingQuery(e,t,n){return[{type:b.Recording,cameraIDs:t,...n}]}generateDefaultRecordingSegmentsQuery(e,t,n){return n.start&&n.end?[{type:b.RecordingSegments,cameraIDs:t,start:n.start,end:n.end,...n}]:null}async favoriteMedia(e,t,n,a){Ie.isFrigateEvent(n)&&(await async function(e,t,n,a){const o={type:"frigate/event/retain",instance_id:t,event_id:n,retain:a},c=await r(e,Q,o,!0);if(!c.success)throw new i(s("error.failed_retain"),{request:o,response:c})}(e,t.frigate.client_id,n.getID(),a),n.setFavorite(a))}_buildInstanceToCameraIDMapFromQuery(e,t){const n=new Map;for(const a of t){const t=this._getQueryableCameraConfig(e,a),r=t?.frigate.client_id;r&&(n.has(r)||n.set(r,new Set),n.get(r)?.add(a))}return n}_getFrigateCameraNamesForCameraIDs(e,t){const n=new Set;for(const a of t){const t=this._getQueryableCameraConfig(e,a);t?.frigate.camera_name&&n.add(t.frigate.camera_name)}return n}async getEvents(e,t,n,a){const r=new Map,i=async(i,s)=>{if(!s||!s.size)return;const o={...n,cameraIDs:s},c=a?.useCache??1?this._requestCache.get(o):null;if(c)return void r.set(n,c);const g={instance_id:i,cameras:Array.from(this._getFrigateCameraNamesForCameraIDs(t,s)),...n.what&&{labels:Array.from(n.what)},...n.where&&{zones:Array.from(n.where)},...n.tags&&{sub_labels:Array.from(n.tags)},...n.end&&{before:Math.floor(n.end.getTime()/1e3)},...n.start&&{after:Math.floor(n.start.getTime()/1e3)},...n.limit&&{limit:n.limit},...n.hasClip&&{has_clip:n.hasClip},...n.hasSnapshot&&{has_snapshot:n.hasSnapshot},...n.favorite&&{favorites:n.favorite},limit:n?.limit??$},l={type:C.Event,engine:p.Frigate,instanceID:i,events:await L(e,g),expiry:v(new Date,{seconds:60}),cached:!1};(a?.useCache??1)&&this._requestCache.set(n,{...l,cached:!0},l.expiry),r.set(o,l)},s=this._buildInstanceToCameraIDMapFromQuery(t,n.cameraIDs);return await Promise.all(Array.from(s.keys()).map((e=>i(e,s.get(e))))),r.size?r:null}async getRecordings(e,t,n,a){const i=new Map,s=async(n,s)=>{const o={...n,cameraIDs:new Set([s])},c=a?.useCache??1?this._requestCache.get(o):null;if(c)return void i.set(o,c);const g=this._getQueryableCameraConfig(t,s);if(!g||!g.frigate.camera_name)return;const l=await(async(e,t,n)=>await r(e,U,{type:"frigate/recordings/summary",instance_id:t,camera:n,timezone:e.config.time_zone},!0))(e,g.frigate.client_id,g.frigate.camera_name);let u=[];for(const e of l??[])for(const t of e.hours){const n=v(e.day,{hours:t.hour}),a=x(n),r=H(n);(!o.start||a>=o.start)&&(!o.end||r<=o.end)&&u.push({cameraID:s,startTime:a,endTime:r,events:t.events})}void 0!==o.limit&&(u=S(u,(e=>e.startTime),"desc").slice(0,o.limit));const m={type:C.Recording,engine:p.Frigate,instanceID:g.frigate.client_id,recordings:u,expiry:v(new Date,{seconds:60}),cached:!1};(a?.useCache??1)&&this._requestCache.set(o,{...m,cached:!0},m.expiry),i.set(o,m)};return await Promise.all(Array.from(n.cameraIDs).map((e=>s(n,e)))),i.size?i:null}async getRecordingSegments(e,t,n,a){const i=new Map,s=async(n,s)=>{const o={...n,cameraIDs:new Set([s])},c=this._getQueryableCameraConfig(t,s);if(!c||!c.frigate.camera_name)return;const g={start:o.start,end:o.end},l=a?.useCache??1?this._recordingSegmentsCache.get(s,g):null;if(l)return void i.set(o,{type:C.RecordingSegments,engine:p.Frigate,instanceID:c.frigate.client_id,segments:l,cached:!0});const u={instance_id:c.frigate.client_id,camera:c.frigate.camera_name,after:Math.floor(o.start.getTime()/1e3),before:Math.floor(o.end.getTime()/1e3)},m=await(async(e,t)=>await r(e,W,{type:"frigate/recordings/get",...t},!0))(e,u);(a?.useCache??1)&&this._recordingSegmentsCache.add(s,g,m),i.set(o,{type:C.RecordingSegments,engine:p.Frigate,instanceID:c.frigate.client_id,segments:m,cached:!1})};return await Promise.all(Array.from(n.cameraIDs).map((e=>s(n,e)))),w((()=>this._throttledSegmentGarbageCollector(e,t))),i.size?i:null}_getCameraIDMatch(e,t,n,a){if(1===t.cameraIDs.size)return[...t.cameraIDs][0];for(const[t,r]of e.getCameraConfigEntries())if(r.frigate.client_id===n&&r.frigate.camera_name===a)return t;return null}generateMediaFromEvents(e,t,n,a){if(!Se.isFrigateEventQueryResults(a))return null;const r=[];for(const e of a.events){const i=this._getCameraIDMatch(t,n,a.instanceID,e.camera);if(!i)continue;const s=this._getQueryableCameraConfig(t,i);if(!s)continue;let o=null;if(n.hasClip||n.hasSnapshot||!e.has_clip&&!e.has_snapshot?n.hasSnapshot&&e.has_snapshot?o="snapshot":n.hasClip&&e.has_clip&&(o="clip"):o=e.has_clip?"clip":"snapshot",!o)continue;const c=Te.createEventViewMedia(o,i,s,e,e.sub_label?this._splitSubLabels(e.sub_label):void 0);c&&r.push(c)}return r}generateMediaFromRecordings(e,t,n,a){if(!Se.isFrigateRecordingQueryResults(a))return null;const r=[];for(const n of a.recordings){const a=this._getQueryableCameraConfig(t,n.cameraID);if(!a)continue;const i=Te.createRecordingViewMedia(n.cameraID,n,a,this.getCameraMetadata(e,a).title);i&&r.push(i)}return r}getQueryResultMaxAge(e){return e.type===b.Event||e.type===b.Recording?60:null}async getMediaSeekTime(e,t,n,a,r){const i=n.getStartTime(),s=n.getEndTime();if(!i||!s||as)return null;const o=n.getCameraID(),c={cameraIDs:new Set([o]),start:i,end:s,type:b.RecordingSegments},g=await this.getRecordingSegments(e,t,c,r);return g?this._getSeekTimeInSegments(i,a,Array.from(g.values())[0].segments):null}_getQueryableCameraConfig(e,t){const n=e.getCameraConfig(t);return!n||V(n)?null:n}_splitSubLabels(e){return e.split(",").map((e=>e.trim()))}async getMediaMetadata(e,t,n,a){const i=new Map;if((a?.useCache??1)&&this._requestCache.has(n)){const e=this._requestCache.get(n);if(e)return i.set(n,e),i}const s=new Set,o=new Set,c=new Set,g=new Set,l=this._buildInstanceToCameraIDMapFromQuery(t,n.cameraIDs),u=async(n,a)=>{const i=this._getFrigateCameraNamesForCameraIDs(t,a);for(const t of await(async(e,t)=>await r(e,k,{type:"frigate/events/summary",instance_id:t,timezone:e.config.time_zone},!0))(e,n))i.has(t.camera)&&(t.label&&s.add(t.label),t.zones.length&&t.zones.forEach(o.add,o),t.day&&c.add(t.day),t.sub_label&&this._splitSubLabels(t.sub_label).forEach(g.add,g))},m=async n=>{const r=await this.getRecordings(e,t,{type:b.Recording,cameraIDs:n},a);if(r)for(const e of r.values())if(Se.isFrigateRecordingQueryResults(e))for(const t of e.recordings)c.add(M(t.startTime))};await D([...l.entries()],(([e,t])=>(async()=>{await Promise.all([u(e,t),m(t)])})()));const d={type:C.MediaMetadata,engine:p.Frigate,metadata:{...s.size&&{what:s},...o.size&&{where:o},...c.size&&{days:c},...g.size&&{tags:g}},expiry:v(new Date,{seconds:60}),cached:!1};return(a?.useCache??1)&&this._requestCache.set(n,{...d,cached:!0},d.expiry),i.set(n,d),i}async _garbageCollectSegments(e,t){const n=this._recordingSegmentsCache.getCameraIDs(),a={cameraIDs:new Set(n),type:b.Recording},r=(e,t)=>`${e}/${t.getDate()}/${t.getHours()}`,i=await this.getRecordings(e,t,a);if(i)for(const[e,t]of i){if(!Se.isFrigateRecordingQueryResults(t))continue;const n=new Set;for(const e of t.recordings)n.add(r(e.cameraID,e.startTime));const a=Array.from(e.cameraIDs)[0];this._recordingSegmentsCache.expireMatches(a,(e=>{const t=r(a,j(e.start_time));return!n.has(t)}))}}_getSeekTimeInSegments(e,t,n){if(!n.length)return null;let a=0;for(const r of n){const n=j(r.start_time);if(n>t)break;const i=j(r.end_time),s=nt?t:i).getTime()-s.getTime()}return a/1e3}getMediaCapabilities(e){return{canFavorite:_.isEvent(e),canDownload:!0}}getCameraMetadata(e,t){const n=super.getCameraMetadata(e,t);return{title:t.title??T(e,t.camera_entity)??T(e,t.webrtc_card?.entity)??d(t.frigate?.camera_name)??t.id??"",icon:n.icon,engineLogo:I}}getCameraEndpoints(e,t){const n=(()=>{if(!e.frigate.url)return null;if(!e.frigate.camera_name)return{endpoint:e.frigate.url};const n=`${e.frigate.url}/cameras/`+e.frigate.camera_name;if("live"===t?.view)return{endpoint:n};const a=`${e.frigate.url}/events?camera=`+e.frigate.camera_name,r=`${e.frigate.url}/recording/`+e.frigate.camera_name;switch(t?.media?.getMediaType()){case"clip":case"snapshot":return{endpoint:a};case"recording":const e=t.media.getStartTime();if(e)return{endpoint:r+F(e,"yyyy-MM-dd/HH")}}switch(t?.view){case"clip":case"clips":case"snapshots":case"snapshot":return{endpoint:a};case"recording":case"recordings":return{endpoint:r}}return{endpoint:n}})(),a=E(e,{url:e.go2rtc?.url??`/api/frigate/${e.frigate.client_id}/mse`,stream:e.go2rtc?.stream??e.frigate.camera_name}),r={endpoint:`/api/frigate/${e.frigate.client_id}/jsmpeg/${e.frigate.camera_name}`,sign:!0},i=(()=>{const t=e.frigate.camera_name?e.frigate.camera_name:null;return t?{endpoint:t}:null})();return{...super.getCameraEndpoints(e,t),...n&&{ui:n},...a&&{go2rtc:a},...r&&{jsmpeg:r},...i&&{webrtcCard:i}}}async executePTZAction(e,t,n,a){const r=t.camera_entity;("preset"!==n||a?.preset)&&await e.callService("frigate","ptz",{entity_id:r,action:"stop"===a?.phase?"stop":"zoom_in"===n||"zoom_out"===n?"zoom":"preset"===n?"preset":"move",..."stop"!==a?.phase&&{argument:"zoom_in"===n?"in":"zoom_out"===n?"out":"preset"===n?a?.preset:n}})}}export{Me as FrigateCameraManagerEngine}; diff --git a/config/www/community/frigate-hass-card/engine-frigate-3f150159.js.gz b/config/www/community/frigate-hass-card/engine-frigate-3f150159.js.gz new file mode 100644 index 00000000..b91d8fc2 Binary files /dev/null and b/config/www/community/frigate-hass-card/engine-frigate-3f150159.js.gz differ diff --git a/config/www/community/frigate-hass-card/engine-frigate-69a32a9e.js b/config/www/community/frigate-hass-card/engine-frigate-69a32a9e.js new file mode 100644 index 00000000..57802294 --- /dev/null +++ b/config/www/community/frigate-hass-card/engine-frigate-69a32a9e.js @@ -0,0 +1,3 @@ +import{c$ as e,dX as t,dY as n,dZ as a,d_ as r,d$ as i,l as s,e0 as o,e1 as c,e2 as g,e3 as l,d7 as u,dQ as m,k as d,i as f,dd as h,e4 as p,dj as _,d5 as y,d3 as b,e5 as w,e6 as D,e7 as C,dN as v,j as T,e8 as I,d8 as S,da as M,d9 as F}from"./card-320adb66.js";import{C as $}from"./engine-86b0096c.js";import{C as z,G as N,g as E}from"./engine-generic-39deaa91.js";import{a as R,V as Y}from"./media-c9012082.js";import{s as x,e as H}from"./startOfHour-b41e160a.js";function j(t){return e(1e3*t)}const Z=n.object({camera:n.string(),end_time:n.number().nullable(),false_positive:n.boolean().nullable(),has_clip:n.boolean(),has_snapshot:n.boolean(),id:n.string(),label:n.string(),sub_label:n.string().nullable(),start_time:n.number(),top_score:n.number().nullable(),zones:n.string().array(),retain_indefinitely:n.boolean().optional()}).array(),q=n.object({hour:n.preprocess((e=>Number(e)),n.number().min(0).max(23)),duration:n.number().min(0),events:n.number().min(0)}),U=n.object({day:n.preprocess((e=>"string"==typeof e?a(e):e),n.date()),events:n.number(),hours:q.array()}).array(),W=n.object({start_time:n.number(),end_time:n.number(),id:n.string()}).array(),Q=n.object({success:n.boolean(),message:n.string()}),k=n.object({camera:n.string(),day:n.string(),label:n.string(),sub_label:n.string().nullable(),zones:n.string().array()}).array(),P=n.object({name:n.string().optional(),features:n.string().array().optional(),presets:n.string().array().optional()}),A=n.object({camera:n.string(),snapshot:n.object({frame_time:n.number()}).nullable(),has_clip:n.boolean(),has_snapshot:n.boolean(),label:n.string(),current_zones:n.string().array()}),O=n.object({before:A,after:A,type:n.enum(["new","update","end"])});const L=async(e,t)=>await r(e,Z,{type:"frigate/events/get",...t},!0),V=e=>"birdseye"===e.frigate.camera_name;class G extends z{constructor(e,t,n){super(e,t,n),this._frigateEventHandler=e=>{const t=!e.before.has_snapshot&&e.after.has_snapshot||e.before.snapshot?.frame_time!==e.after.snapshot?.frame_time,n=!e.before.has_clip&&e.after.has_clip,a=this.getConfig();if(a.frigate.zones?.length&&!a.frigate.zones.some((t=>e.after.current_zones.includes(t)))||a.frigate.labels?.length&&!a.frigate.labels.includes(e.after.label))return;const r=a.triggers.events;(r.includes("events")||r.includes("snapshots")&&t||r.includes("clips")&&n)&&this._eventCallback?.({fidelity:"high",cameraID:this.getID(),type:e.type,clip:n&&r.includes("clips"),snapshot:t&&r.includes("snapshots")})}}async initialize(e){return await this._initializeConfig(e.hass,e.entityRegistryManager),await this._initializeCapabilities(e.hass),await this._subscribeToEvents(e.hass,e.frigateEventWatcher),await super.initialize(e)}async _initializeConfig(e,n){const a=this.getConfig(),r=!!a.frigate?.camera_name,i=a.triggers.motion||a.triggers.occupancy;let g=null;const l=o(a);if(l&&(!r||i)&&(g=await n.getEntity(e,l),!g))throw new c(s("error.no_camera_entity"),a);if(g&&!r){const e=this._getFrigateCameraNameFromEntity(g);e&&(this._config.frigate.camera_name=e)}if(i){const r=await n.getMatchingEntities(e,(e=>e.config_entry_id===g?.config_entry_id&&!e.disabled_by&&e.entity_id.startsWith("binary_sensor.")));if(a.triggers.motion){const e=this._getMotionSensor(a,[...r.values()]);e&&a.triggers.entities.push(e)}if(a.triggers.occupancy){const e=this._getOccupancySensor(a,[...r.values()]);e&&a.triggers.entities.push(...e)}a.triggers.entities=(u=a.triggers.entities)&&u.length?t(u):[]}var u}async _initializeCapabilities(e){const t=this.getConfig(),n=g(this.getConfig()),a=await this._getPTZCapabilities(e,t),r=n||a?{...a,...n}:null,i=V(t);this._capabilities=new l({"favorite-events":!i,"favorite-recordings":!1,seek:!i,clips:!i,snapshots:!i,recordings:!i,live:!0,menu:!0,substream:!0,...r&&{ptz:r}},{disable:t.capabilities?.disable,disableExcept:t.capabilities?.disable_except})}_getFrigateCameraNameFromEntity(e){if("frigate"===e.platform&&e.unique_id&&"string"==typeof e.unique_id){const t=e.unique_id.match(/:camera:(?[^:]+)$/);if(t&&t.groups)return t.groups.camera}return null}async _getPTZCapabilities(e,t){if(!t.frigate.camera_name||V(t))return null;let n=null;try{n=await(async(e,t,n)=>await r(e,P,{type:"frigate/ptz/info",instance_id:t,camera:n},!0))(e,t.frigate.client_id,t.frigate.camera_name)}catch(e){return u(e),null}const a=[...n.features?.includes("pt")?["continuous"]:[]],i=[...n.features?.includes("zoom")?["continuous"]:[]],s=n.presets;return a.length||i.length||s?.length?{...a&&{left:a,right:a,up:a,down:a},...i&&{zoomIn:i,zoomOut:i},...s&&{presets:s}}:null}_getMotionSensor(e,t){return e.frigate.camera_name?t.find((t=>"string"==typeof t.unique_id&&!!t.unique_id?.match(new RegExp(`:motion_sensor:${e.frigate.camera_name}`))))?.entity_id??null:null}_getOccupancySensor(e,t){const n=[],a=(e,a)=>{const r=t.find((t=>"string"==typeof t.unique_id&&!!t.unique_id?.match(new RegExp(`:occupancy_sensor:${e}_${a}`))))?.entity_id??null;r&&n.push(r)};if(e.frigate.camera_name){const t=e.frigate.zones?.length?e.frigate.zones:[e.frigate.camera_name],r=e.frigate.labels?.length?e.frigate.labels:["all"];for(const e of t)for(const t of r)a(e,t);if(n.length)return n}return null}async _subscribeToEvents(e,t){const n=this.getConfig();if(!n.triggers.events.length||!n.frigate.camera_name)return; +/* istanbul ignore next -- exercising the matcher is not possible when the + test uses an event watcher -- @preserve */const a={instanceID:n.frigate.client_id,callback:e=>this._frigateEventHandler(e),matcher:e=>e.after.camera===n.frigate.camera_name};await t.subscribe(e,a),this._onDestroy((()=>t.unsubscribe(a)))}}class J{constructor(){this._requests=[],this._unsubscribeCallback={}}async subscribe(e,t){const n=!this._hasSubscribers(t.instanceID);this._requests.push(t),n&&(this._unsubscribeCallback[t.instanceID]=await e.connection.subscribeMessage((e=>this._receiveHandler(t.instanceID,e)),{type:"frigate/events/subscribe",instance_id:t.instanceID}))}async unsubscribe(e){this._requests=this._requests.filter((t=>t!==e)),this._hasSubscribers(e.instanceID)||(await this._unsubscribeCallback[e.instanceID](),delete this._unsubscribeCallback[e.instanceID])}_hasSubscribers(e){return!!this._requests.filter((t=>t.instanceID===e)).length}_receiveHandler(e,t){let n;try{n=JSON.parse(t)}catch(e){return void console.warn("Received non-JSON payload as Frigate event",t)}const a=O.safeParse(n);if(a.success)for(const t of this._requests)t.instanceID!==e||t.matcher&&!t.matcher(a.data)||t.callback(a.data);else console.warn("Received malformed Frigate event from Home Assistant",t)}}function X(e,t){const n=function(e){if(!K[e]){const t=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),n="06/25/2014, 00:00:00"===t||"‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00"===t;K[e]=n?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}return K[e]}(t);return"formatToParts"in n?function(e,t){try{const n=e.formatToParts(t),a=[];for(let e=0;e=0?i:1e3+i,a-r}function se(e,t){return-23<=e&&e<=23&&(null==t||0<=t&&t<=59)}const oe={};function ce(e){const t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+e-+t}const ge=36e5,le=6e4,ue=2,me={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,plainTime:/:/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/};function de(e,t={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(null===e)return new Date(NaN);const n=null==t.additionalDigits?ue:Number(t.additionalDigits);if(2!==n&&1!==n&&0!==n)throw new RangeError("additionalDigits must be 0, 1 or 2");if(e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e))return new Date(e.getTime());if("number"==typeof e||"[object Number]"===Object.prototype.toString.call(e))return new Date(e);if("[object String]"!==Object.prototype.toString.call(e))return new Date(NaN);const a=function(e){const t={};let n,a=me.dateTimePattern.exec(e);a?(t.date=a[1],n=a[3]):(a=me.datePattern.exec(e),a?(t.date=a[1],n=a[2]):(t.date=null,n=e));if(n){const e=me.timeZone.exec(n);e?(t.time=n.replace(e[1],""),t.timeZone=e[1].trim()):t.time=n}return t}(e),{year:r,restDateString:i}=function(e,t){if(e){const n=me.YYY[t],a=me.YYYYY[t];let r=me.YYYY.exec(e)||a.exec(e);if(r){const t=r[1];return{year:parseInt(t,10),restDateString:e.slice(t.length)}}if(r=me.YY.exec(e)||n.exec(e),r){const t=r[1];return{year:100*parseInt(t,10),restDateString:e.slice(t.length)}}}return{year:null}}(a.date,n),s=function(e,t){if(null===t)return null;let n,a,r;if(!e||!e.length)return n=new Date(0),n.setUTCFullYear(t),n;let i=me.MM.exec(e);if(i)return n=new Date(0),a=parseInt(i[1],10)-1,ye(t,a)?(n.setUTCFullYear(t,a),n):new Date(NaN);if(i=me.DDD.exec(e),i){n=new Date(0);const e=parseInt(i[1],10);return function(e,t){if(t<1)return!1;const n=_e(e);if(n&&t>366)return!1;if(!n&&t>365)return!1;return!0}(t,e)?(n.setUTCFullYear(t,0,e),n):new Date(NaN)}if(i=me.MMDD.exec(e),i){n=new Date(0),a=parseInt(i[1],10)-1;const e=parseInt(i[2],10);return ye(t,a,e)?(n.setUTCFullYear(t,a,e),n):new Date(NaN)}if(i=me.Www.exec(e),i)return r=parseInt(i[1],10)-1,be(r)?fe(t,r):new Date(NaN);if(i=me.WwwD.exec(e),i){r=parseInt(i[1],10)-1;const e=parseInt(i[2],10)-1;return be(r,e)?fe(t,r,e):new Date(NaN)}return null}(i,r);if(null===s||isNaN(s.getTime()))return new Date(NaN);if(s){const e=s.getTime();let n,r=0;if(a.time&&(r=function(e){let t,n,a=me.HH.exec(e);if(a)return t=parseFloat(a[1].replace(",",".")),we(t)?t%24*ge:NaN;if(a=me.HHMM.exec(e),a)return t=parseInt(a[1],10),n=parseFloat(a[2].replace(",",".")),we(t,n)?t%24*ge+n*le:NaN;if(a=me.HHMMSS.exec(e),a){t=parseInt(a[1],10),n=parseInt(a[2],10);const e=parseFloat(a[3].replace(",","."));return we(t,n,e)?t%24*ge+n*le+1e3*e:NaN}return null}(a.time),null===r||isNaN(r)))return new Date(NaN);if(a.timeZone||t.timeZone){if(n=re(a.timeZone||t.timeZone,new Date(e+r)),isNaN(n))return new Date(NaN)}else n=ce(new Date(e+r)),n=ce(new Date(e+r+n));return new Date(e+r+n)}return new Date(NaN)}function fe(e,t,n){t=t||0,n=n||0;const a=new Date(0);a.setUTCFullYear(e,0,4);const r=7*t+n+1-(a.getUTCDay()||7);return a.setUTCDate(a.getUTCDate()+r),a}const he=[31,28,31,30,31,30,31,31,30,31,30,31],pe=[31,29,31,30,31,30,31,31,30,31,30,31];function _e(e){return e%400==0||e%4==0&&e%100!=0}function ye(e,t,n){if(t<0||t>11)return!1;if(null!=n){if(n<1)return!1;const a=_e(e);if(a&&n>pe[t])return!1;if(!a&&n>he[t])return!1}return!0}function be(e,t){return!(e<0||e>52)&&(null==t||!(t<0||t>6))}function we(e,t,n){return!(e<0||e>=25)&&((null==t||!(t<0||t>=60))&&(null==n||!(n<0||n>=60)))}const De=e=>{const t=Intl.DateTimeFormat().resolvedOptions().timeZone,n=Math.round(e.end_time?e.end_time-e.start_time:Date.now()/1e3-e.start_time),a=null!==e.top_score?` ${Math.round(100*e.top_score)}%`:"";return`${m(function(e,t,n){const a=re(t,e=de(e,n),!0),r=new Date(e.getTime()-a),i=new Date(0);return i.setFullYear(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate()),i.setHours(r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),r.getUTCMilliseconds()),i}(1e3*e.start_time,t))} [${n}s, ${d(e.label)}${a}]`};class Ce extends R{constructor(e,t,n,a,r,i){super(e,t),this._event=n,this._contentID=a,this._thumbnail=r,this._subLabels=i??null}getStartTime(){return j(this._event.start_time)}getEndTime(){return this._event.end_time?j(this._event.end_time):null}inProgress(){return!this.getEndTime()}getVideoContentType(){return Y.HLS}getID(){return this._event.id}getContentID(){return this._contentID}getTitle(){return De(this._event)}getThumbnail(){return this._thumbnail}isFavorite(){return this._event.retain_indefinitely??null}setFavorite(e){this._event.retain_indefinitely=e}getWhat(){return[this._event.label]}getWhere(){const e=this._event.zones;return e.length?e:null}getScore(){return this._event.top_score}getTags(){return this._subLabels}isGroupableWith(e){return this.getMediaType()===e.getMediaType()&&f(this.getWhere(),e.getWhere())&&f(this.getWhat(),e.getWhat())}}class ve extends R{constructor(e,t,n,a,r,i){super(e,t),this._recording=n,this._id=a,this._contentID=r,this._title=i}getID(){return this._id}getStartTime(){return this._recording.startTime}getEndTime(){return this._recording.endTime}inProgress(){return!this.getEndTime()}getVideoContentType(){return Y.HLS}getContentID(){return this._contentID}getTitle(){return this._title}getEventCount(){return this._recording.events}}class Te{static createEventViewMedia(e,t,n,a,r){return"clip"===e&&!a.has_clip||"snapshot"===e&&!a.has_snapshot||!n.frigate.client_id||!n.frigate.camera_name?null:new Ce(e,t,a,((e,t,n,a)=>`media-source://frigate/${e}/event/${a}/${t}/${n.id}`)(n.frigate.client_id,n.frigate.camera_name,a,"clip"===e?"clips":"snapshots"),((e,t)=>`/api/frigate/${e}/thumbnail/${t.id}`)(n.frigate.client_id,a),r)}static createRecordingViewMedia(e,t,n,a){return n.frigate.client_id&&n.frigate.camera_name?new ve("recording",e,t,((e,t)=>`${e.frigate?.client_id??""}/${e.frigate.camera_name??""}/${t.startTime.getTime()}/${t.endTime.getTime()}`)(n,t),((e,t,n)=>["media-source://frigate",e,"recordings",t,`${n.startTime.getFullYear()}-${String(n.startTime.getMonth()+1).padStart(2,"0")}-${String(String(n.startTime.getDate()).padStart(2,"0"))}`,String(n.startTime.getHours()).padStart(2,"0")].join("/"))(n.frigate.client_id,n.frigate.camera_name,t),((e,t)=>`${e} ${m(t.startTime)}`)(a,t)):null}}class Ie{static isFrigateMedia(e){return this.isFrigateEvent(e)||this.isFrigateRecording(e)}static isFrigateEvent(e){return e instanceof Ce}static isFrigateRecording(e){return e instanceof ve}}class Se{static isFrigateEventQueryResults(e){return e.engine===p.Frigate&&e.type===C.Event}static isFrigateRecordingQueryResults(e){return e.engine===p.Frigate&&e.type===C.Recording}static isFrigateRecordingSegmentsResults(e){return e.engine===p.Frigate&&e.type===C.RecordingSegments}}class Me extends N{constructor(e,t,n,a,r){super(t,r),this._throttledSegmentGarbageCollector=h(this._garbageCollectSegments.bind(this),36e5,{leading:!1,trailing:!0}),this._entityRegistryManager=e,this._frigateEventWatcher=new J,this._recordingSegmentsCache=n,this._requestCache=a}getEngineType(){return p.Frigate}async createCamera(e,t){const n=new G(t,this,{eventCallback:this._eventCallback});return await n.initialize({hass:e,entityRegistryManager:this._entityRegistryManager,stateWatcher:this._stateWatcher,frigateEventWatcher:this._frigateEventWatcher})}async getMediaDownloadPath(e,t,n){return Ie.isFrigateEvent(n)?{endpoint:`/api/frigate/${t.frigate.client_id}/notifications/${n.getID()}/`+(_.isClip(n)?"clip.mp4":"snapshot.jpg")+"?download=true",sign:!0}:Ie.isFrigateRecording(n)?{endpoint:`/api/frigate/${t.frigate.client_id}/recording/${t.frigate.camera_name}/start/${Math.floor(n.getStartTime().getTime()/1e3)}/end/${Math.floor(n.getEndTime().getTime()/1e3)}?download=true`,sign:!0}:null}generateDefaultEventQuery(e,t,n){const a=[...e.getCameraConfigs(t)],r=y(a.map((e=>e?.frigate.zones)),f),i=y(a.map((e=>e?.frigate.labels)),f);if(1===r.length&&1===i.length)return[{type:b.Event,cameraIDs:t,...i[0]&&{what:new Set(i[0])},...r[0]&&{where:new Set(r[0])},...n}];const s=[];for(const a of t){const t=e.getCameraConfig(a);t&&s.push({type:b.Event,cameraIDs:new Set([a]),...t.frigate.labels&&{what:new Set(t.frigate.labels)},...t.frigate.zones&&{where:new Set(t.frigate.zones)},...n})}return s.length?s:null}generateDefaultRecordingQuery(e,t,n){return[{type:b.Recording,cameraIDs:t,...n}]}generateDefaultRecordingSegmentsQuery(e,t,n){return n.start&&n.end?[{type:b.RecordingSegments,cameraIDs:t,start:n.start,end:n.end,...n}]:null}async favoriteMedia(e,t,n,a){Ie.isFrigateEvent(n)&&(await async function(e,t,n,a){const o={type:"frigate/event/retain",instance_id:t,event_id:n,retain:a},c=await r(e,Q,o,!0);if(!c.success)throw new i(s("error.failed_retain"),{request:o,response:c})}(e,t.frigate.client_id,n.getID(),a),n.setFavorite(a))}_buildInstanceToCameraIDMapFromQuery(e,t){const n=new Map;for(const a of t){const t=this._getQueryableCameraConfig(e,a),r=t?.frigate.client_id;r&&(n.has(r)||n.set(r,new Set),n.get(r)?.add(a))}return n}_getFrigateCameraNamesForCameraIDs(e,t){const n=new Set;for(const a of t){const t=this._getQueryableCameraConfig(e,a);t?.frigate.camera_name&&n.add(t.frigate.camera_name)}return n}async getEvents(e,t,n,a){const r=new Map,i=async(i,s)=>{if(!s||!s.size)return;const o={...n,cameraIDs:s},c=a?.useCache??1?this._requestCache.get(o):null;if(c)return void r.set(n,c);const g={instance_id:i,cameras:Array.from(this._getFrigateCameraNamesForCameraIDs(t,s)),...n.what&&{labels:Array.from(n.what)},...n.where&&{zones:Array.from(n.where)},...n.tags&&{sub_labels:Array.from(n.tags)},...n.end&&{before:Math.floor(n.end.getTime()/1e3)},...n.start&&{after:Math.floor(n.start.getTime()/1e3)},...n.limit&&{limit:n.limit},...n.hasClip&&{has_clip:n.hasClip},...n.hasSnapshot&&{has_snapshot:n.hasSnapshot},...n.favorite&&{favorites:n.favorite},limit:n?.limit??$},l={type:C.Event,engine:p.Frigate,instanceID:i,events:await L(e,g),expiry:v(new Date,{seconds:60}),cached:!1};(a?.useCache??1)&&this._requestCache.set(n,{...l,cached:!0},l.expiry),r.set(o,l)},s=this._buildInstanceToCameraIDMapFromQuery(t,n.cameraIDs);return await Promise.all(Array.from(s.keys()).map((e=>i(e,s.get(e))))),r.size?r:null}async getRecordings(e,t,n,a){const i=new Map,s=async(n,s)=>{const o={...n,cameraIDs:new Set([s])},c=a?.useCache??1?this._requestCache.get(o):null;if(c)return void i.set(o,c);const g=this._getQueryableCameraConfig(t,s);if(!g||!g.frigate.camera_name)return;const l=await(async(e,t,n)=>await r(e,U,{type:"frigate/recordings/summary",instance_id:t,camera:n,timezone:e.config.time_zone},!0))(e,g.frigate.client_id,g.frigate.camera_name);let u=[];for(const e of l??[])for(const t of e.hours){const n=v(e.day,{hours:t.hour}),a=x(n),r=H(n);(!o.start||a>=o.start)&&(!o.end||r<=o.end)&&u.push({cameraID:s,startTime:a,endTime:r,events:t.events})}void 0!==o.limit&&(u=S(u,(e=>e.startTime),"desc").slice(0,o.limit));const m={type:C.Recording,engine:p.Frigate,instanceID:g.frigate.client_id,recordings:u,expiry:v(new Date,{seconds:60}),cached:!1};(a?.useCache??1)&&this._requestCache.set(o,{...m,cached:!0},m.expiry),i.set(o,m)};return await Promise.all(Array.from(n.cameraIDs).map((e=>s(n,e)))),i.size?i:null}async getRecordingSegments(e,t,n,a){const i=new Map,s=async(n,s)=>{const o={...n,cameraIDs:new Set([s])},c=this._getQueryableCameraConfig(t,s);if(!c||!c.frigate.camera_name)return;const g={start:o.start,end:o.end},l=a?.useCache??1?this._recordingSegmentsCache.get(s,g):null;if(l)return void i.set(o,{type:C.RecordingSegments,engine:p.Frigate,instanceID:c.frigate.client_id,segments:l,cached:!0});const u={instance_id:c.frigate.client_id,camera:c.frigate.camera_name,after:Math.floor(o.start.getTime()/1e3),before:Math.floor(o.end.getTime()/1e3)},m=await(async(e,t)=>await r(e,W,{type:"frigate/recordings/get",...t},!0))(e,u);(a?.useCache??1)&&this._recordingSegmentsCache.add(s,g,m),i.set(o,{type:C.RecordingSegments,engine:p.Frigate,instanceID:c.frigate.client_id,segments:m,cached:!1})};return await Promise.all(Array.from(n.cameraIDs).map((e=>s(n,e)))),w((()=>this._throttledSegmentGarbageCollector(e,t))),i.size?i:null}_getCameraIDMatch(e,t,n,a){if(1===t.cameraIDs.size)return[...t.cameraIDs][0];for(const[t,r]of e.getCameraConfigEntries())if(r.frigate.client_id===n&&r.frigate.camera_name===a)return t;return null}generateMediaFromEvents(e,t,n,a){if(!Se.isFrigateEventQueryResults(a))return null;const r=[];for(const e of a.events){const i=this._getCameraIDMatch(t,n,a.instanceID,e.camera);if(!i)continue;const s=this._getQueryableCameraConfig(t,i);if(!s)continue;let o=null;if(n.hasClip||n.hasSnapshot||!e.has_clip&&!e.has_snapshot?n.hasSnapshot&&e.has_snapshot?o="snapshot":n.hasClip&&e.has_clip&&(o="clip"):o=e.has_clip?"clip":"snapshot",!o)continue;const c=Te.createEventViewMedia(o,i,s,e,e.sub_label?this._splitSubLabels(e.sub_label):void 0);c&&r.push(c)}return r}generateMediaFromRecordings(e,t,n,a){if(!Se.isFrigateRecordingQueryResults(a))return null;const r=[];for(const n of a.recordings){const a=this._getQueryableCameraConfig(t,n.cameraID);if(!a)continue;const i=Te.createRecordingViewMedia(n.cameraID,n,a,this.getCameraMetadata(e,a).title);i&&r.push(i)}return r}getQueryResultMaxAge(e){return e.type===b.Event||e.type===b.Recording?60:null}async getMediaSeekTime(e,t,n,a,r){const i=n.getStartTime(),s=n.getEndTime();if(!i||!s||as)return null;const o=n.getCameraID(),c={cameraIDs:new Set([o]),start:i,end:s,type:b.RecordingSegments},g=await this.getRecordingSegments(e,t,c,r);return g?this._getSeekTimeInSegments(i,a,Array.from(g.values())[0].segments):null}_getQueryableCameraConfig(e,t){const n=e.getCameraConfig(t);return!n||V(n)?null:n}_splitSubLabels(e){return e.split(",").map((e=>e.trim()))}async getMediaMetadata(e,t,n,a){const i=new Map;if((a?.useCache??1)&&this._requestCache.has(n)){const e=this._requestCache.get(n);if(e)return i.set(n,e),i}const s=new Set,o=new Set,c=new Set,g=new Set,l=this._buildInstanceToCameraIDMapFromQuery(t,n.cameraIDs),u=async(n,a)=>{const i=this._getFrigateCameraNamesForCameraIDs(t,a);for(const t of await(async(e,t)=>await r(e,k,{type:"frigate/events/summary",instance_id:t,timezone:e.config.time_zone},!0))(e,n))i.has(t.camera)&&(t.label&&s.add(t.label),t.zones.length&&t.zones.forEach(o.add,o),t.day&&c.add(t.day),t.sub_label&&this._splitSubLabels(t.sub_label).forEach(g.add,g))},m=async n=>{const r=await this.getRecordings(e,t,{type:b.Recording,cameraIDs:n},a);if(r)for(const e of r.values())if(Se.isFrigateRecordingQueryResults(e))for(const t of e.recordings)c.add(M(t.startTime))};await D([...l.entries()],(([e,t])=>(async()=>{await Promise.all([u(e,t),m(t)])})()));const d={type:C.MediaMetadata,engine:p.Frigate,metadata:{...s.size&&{what:s},...o.size&&{where:o},...c.size&&{days:c},...g.size&&{tags:g}},expiry:v(new Date,{seconds:60}),cached:!1};return(a?.useCache??1)&&this._requestCache.set(n,{...d,cached:!0},d.expiry),i.set(n,d),i}async _garbageCollectSegments(e,t){const n=this._recordingSegmentsCache.getCameraIDs(),a={cameraIDs:new Set(n),type:b.Recording},r=(e,t)=>`${e}/${t.getDate()}/${t.getHours()}`,i=await this.getRecordings(e,t,a);if(i)for(const[e,t]of i){if(!Se.isFrigateRecordingQueryResults(t))continue;const n=new Set;for(const e of t.recordings)n.add(r(e.cameraID,e.startTime));const a=Array.from(e.cameraIDs)[0];this._recordingSegmentsCache.expireMatches(a,(e=>{const t=r(a,j(e.start_time));return!n.has(t)}))}}_getSeekTimeInSegments(e,t,n){if(!n.length)return null;let a=0;for(const r of n){const n=j(r.start_time);if(n>t)break;const i=j(r.end_time),s=nt?t:i).getTime()-s.getTime()}return a/1e3}getMediaCapabilities(e){return{canFavorite:_.isEvent(e),canDownload:!0}}getCameraMetadata(e,t){const n=super.getCameraMetadata(e,t);return{title:t.title??T(e,t.camera_entity)??T(e,t.webrtc_card?.entity)??d(t.frigate?.camera_name)??t.id??"",icon:n.icon,engineLogo:I}}getCameraEndpoints(e,t){const n=(()=>{if(!e.frigate.url)return null;if(!e.frigate.camera_name)return{endpoint:e.frigate.url};const n=`${e.frigate.url}/cameras/`+e.frigate.camera_name;if("live"===t?.view)return{endpoint:n};const a=`${e.frigate.url}/events?camera=`+e.frigate.camera_name,r=`${e.frigate.url}/recording/`+e.frigate.camera_name;switch(t?.media?.getMediaType()){case"clip":case"snapshot":return{endpoint:a};case"recording":const e=t.media.getStartTime();if(e)return{endpoint:r+F(e,"yyyy-MM-dd/HH")}}switch(t?.view){case"clip":case"clips":case"snapshots":case"snapshot":return{endpoint:a};case"recording":case"recordings":return{endpoint:r}}return{endpoint:n}})(),a=E(e,{url:e.go2rtc?.url??`/api/frigate/${e.frigate.client_id}/mse`,stream:e.go2rtc?.stream??e.frigate.camera_name}),r={endpoint:`/api/frigate/${e.frigate.client_id}/jsmpeg/${e.frigate.camera_name}`,sign:!0},i=(()=>{const t=e.frigate.camera_name?e.frigate.camera_name:null;return t?{endpoint:t}:null})();return{...super.getCameraEndpoints(e,t),...n&&{ui:n},...a&&{go2rtc:a},...r&&{jsmpeg:r},...i&&{webrtcCard:i}}}async executePTZAction(e,t,n,a){const r=t.camera_entity;("preset"!==n||a?.preset)&&await e.callService("frigate","ptz",{entity_id:r,action:"stop"===a?.phase?"stop":"zoom_in"===n||"zoom_out"===n?"zoom":"preset"===n?"preset":"move",..."stop"!==a?.phase&&{argument:"zoom_in"===n?"in":"zoom_out"===n?"out":"preset"===n?a?.preset:n}})}}export{Me as FrigateCameraManagerEngine}; diff --git a/config/www/community/frigate-hass-card/engine-frigate-69a32a9e.js.gz b/config/www/community/frigate-hass-card/engine-frigate-69a32a9e.js.gz new file mode 100644 index 00000000..30cd08cf Binary files /dev/null and b/config/www/community/frigate-hass-card/engine-frigate-69a32a9e.js.gz differ diff --git a/config/www/community/frigate-hass-card/engine-frigate-7cd5392b.js b/config/www/community/frigate-hass-card/engine-frigate-7cd5392b.js new file mode 100644 index 00000000..3c65f46b --- /dev/null +++ b/config/www/community/frigate-hass-card/engine-frigate-7cd5392b.js @@ -0,0 +1,3 @@ +import{d3 as e,d_ as t,d$ as n,e0 as a,e1 as r,e2 as i,l as s,e3 as o,e4 as c,e5 as g,e6 as l,db as u,dT as m,k as d,i as f,dh as h,e7 as p,dn as _,d9 as y,d7 as b,e8 as w,e9 as D,ea as C,dQ as v,j as T,eb as I,dc as S,de as M,dd as F}from"./card-09c4bade.js";import{C as $}from"./engine-86b0096c.js";import{C as z,G as N,g as E}from"./engine-generic-458c9005.js";import{a as R,V as Y}from"./media-c9012082.js";import{s as x,e as H}from"./startOfHour-7a3519fb.js";function j(t){return e(1e3*t)}const Z=n.object({camera:n.string(),end_time:n.number().nullable(),false_positive:n.boolean().nullable(),has_clip:n.boolean(),has_snapshot:n.boolean(),id:n.string(),label:n.string(),sub_label:n.string().nullable(),start_time:n.number(),top_score:n.number().nullable(),zones:n.string().array(),retain_indefinitely:n.boolean().optional()}).array(),q=n.object({hour:n.preprocess((e=>Number(e)),n.number().min(0).max(23)),duration:n.number().min(0),events:n.number().min(0)}),U=n.object({day:n.preprocess((e=>"string"==typeof e?a(e):e),n.date()),events:n.number(),hours:q.array()}).array(),W=n.object({start_time:n.number(),end_time:n.number(),id:n.string()}).array(),Q=n.object({success:n.boolean(),message:n.string()}),k=n.object({camera:n.string(),day:n.string(),label:n.string(),sub_label:n.string().nullable(),zones:n.string().array()}).array(),P=n.object({name:n.string().optional(),features:n.string().array().optional(),presets:n.string().array().optional()}),A=n.object({camera:n.string(),snapshot:n.object({frame_time:n.number()}).nullable(),has_clip:n.boolean(),has_snapshot:n.boolean(),label:n.string(),current_zones:n.string().array()}),O=n.object({before:A,after:A,type:n.enum(["new","update","end"])});const L=async(e,t)=>await r(e,Z,{type:"frigate/events/get",...t},!0),V=e=>"birdseye"===e.frigate.camera_name;class G extends z{constructor(e,t,n){super(e,t,n),this._frigateEventHandler=e=>{const t=!e.before.has_snapshot&&e.after.has_snapshot||e.before.snapshot?.frame_time!==e.after.snapshot?.frame_time,n=!e.before.has_clip&&e.after.has_clip,a=this.getConfig();if(a.frigate.zones?.length&&!a.frigate.zones.some((t=>e.after.current_zones.includes(t)))||a.frigate.labels?.length&&!a.frigate.labels.includes(e.after.label))return;const r=a.triggers.events;(r.includes("events")||r.includes("snapshots")&&t||r.includes("clips")&&n)&&this._eventCallback?.({fidelity:"high",cameraID:this.getID(),type:e.type,clip:n&&r.includes("clips"),snapshot:t&&r.includes("snapshots")})}}async initialize(e){return await this._initializeConfig(e.hass,e.entityRegistryManager),await this._initializeCapabilities(e.hass),await this._subscribeToEvents(e.hass,e.frigateEventWatcher),await super.initialize(e)}async _initializeConfig(e,n){const a=this.getConfig(),r=!!a.frigate?.camera_name,i=a.triggers.motion||a.triggers.occupancy;let g=null;const l=o(a);if(l&&(!r||i)&&(g=await n.getEntity(e,l),!g))throw new c(s("error.no_camera_entity"),a);if(g&&!r){const e=this._getFrigateCameraNameFromEntity(g);e&&(this._config.frigate.camera_name=e)}if(i){const r=await n.getMatchingEntities(e,(e=>e.config_entry_id===g?.config_entry_id&&!e.disabled_by&&e.entity_id.startsWith("binary_sensor.")));if(a.triggers.motion){const e=this._getMotionSensor(a,[...r.values()]);e&&a.triggers.entities.push(e)}if(a.triggers.occupancy){const e=this._getOccupancySensor(a,[...r.values()]);e&&a.triggers.entities.push(...e)}a.triggers.entities=(u=a.triggers.entities)&&u.length?t(u):[]}var u}async _initializeCapabilities(e){const t=this.getConfig(),n=g(this.getConfig()),a=await this._getPTZCapabilities(e,t),r=n||a?{...a,...n}:null,i=V(t);this._capabilities=new l({"favorite-events":!i,"favorite-recordings":!1,seek:!i,clips:!i,snapshots:!i,recordings:!i,live:!0,menu:!0,substream:!0,...r&&{ptz:r}},{disable:t.capabilities?.disable,disableExcept:t.capabilities?.disable_except})}_getFrigateCameraNameFromEntity(e){if("frigate"===e.platform&&e.unique_id&&"string"==typeof e.unique_id){const t=e.unique_id.match(/:camera:(?[^:]+)$/);if(t&&t.groups)return t.groups.camera}return null}async _getPTZCapabilities(e,t){if(!t.frigate.camera_name||V(t))return null;let n=null;try{n=await(async(e,t,n)=>await r(e,P,{type:"frigate/ptz/info",instance_id:t,camera:n},!0))(e,t.frigate.client_id,t.frigate.camera_name)}catch(e){return u(e),null}const a=[...n.features?.includes("pt")?["continuous"]:[]],i=[...n.features?.includes("zoom")?["continuous"]:[]],s=n.presets;return a.length||i.length||s?.length?{...a&&{left:a,right:a,up:a,down:a},...i&&{zoomIn:i,zoomOut:i},...s&&{presets:s}}:null}_getMotionSensor(e,t){return e.frigate.camera_name?t.find((t=>"string"==typeof t.unique_id&&!!t.unique_id?.match(new RegExp(`:motion_sensor:${e.frigate.camera_name}`))))?.entity_id??null:null}_getOccupancySensor(e,t){const n=[],a=(e,a)=>{const r=t.find((t=>"string"==typeof t.unique_id&&!!t.unique_id?.match(new RegExp(`:occupancy_sensor:${e}_${a}`))))?.entity_id??null;r&&n.push(r)};if(e.frigate.camera_name){const t=e.frigate.zones?.length?e.frigate.zones:[e.frigate.camera_name],r=e.frigate.labels?.length?e.frigate.labels:["all"];for(const e of t)for(const t of r)a(e,t);if(n.length)return n}return null}async _subscribeToEvents(e,t){const n=this.getConfig();if(!n.triggers.events.length||!n.frigate.camera_name)return; +/* istanbul ignore next -- exercising the matcher is not possible when the + test uses an event watcher -- @preserve */const a={instanceID:n.frigate.client_id,callback:e=>this._frigateEventHandler(e),matcher:e=>e.after.camera===n.frigate.camera_name};await t.subscribe(e,a),this._onDestroy((()=>t.unsubscribe(a)))}}class J{constructor(){this._requests=[],this._unsubscribeCallback={}}async subscribe(e,t){const n=!this._hasSubscribers(t.instanceID);this._requests.push(t),n&&(this._unsubscribeCallback[t.instanceID]=await e.connection.subscribeMessage((e=>this._receiveHandler(t.instanceID,e)),{type:"frigate/events/subscribe",instance_id:t.instanceID}))}async unsubscribe(e){this._requests=this._requests.filter((t=>t!==e)),this._hasSubscribers(e.instanceID)||(await this._unsubscribeCallback[e.instanceID](),delete this._unsubscribeCallback[e.instanceID])}_hasSubscribers(e){return!!this._requests.filter((t=>t.instanceID===e)).length}_receiveHandler(e,t){let n;try{n=JSON.parse(t)}catch(e){return void console.warn("Received non-JSON payload as Frigate event",t)}const a=O.safeParse(n);if(a.success)for(const t of this._requests)t.instanceID!==e||t.matcher&&!t.matcher(a.data)||t.callback(a.data);else console.warn("Received malformed Frigate event from Home Assistant",t)}}function B(e,t){const n=function(e){if(!X[e]){const t=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),n="06/25/2014, 00:00:00"===t||"‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00"===t;X[e]=n?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}return X[e]}(t);return"formatToParts"in n?function(e,t){try{const n=e.formatToParts(t),a=[];for(let e=0;e=0?i:1e3+i,a-r}function se(e,t){return-23<=e&&e<=23&&(null==t||0<=t&&t<=59)}const oe={};function ce(e){const t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+e-+t}const ge=36e5,le=6e4,ue=2,me={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,plainTime:/:/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/};function de(e,t={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(null===e)return new Date(NaN);const n=null==t.additionalDigits?ue:Number(t.additionalDigits);if(2!==n&&1!==n&&0!==n)throw new RangeError("additionalDigits must be 0, 1 or 2");if(e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e))return new Date(e.getTime());if("number"==typeof e||"[object Number]"===Object.prototype.toString.call(e))return new Date(e);if("[object String]"!==Object.prototype.toString.call(e))return new Date(NaN);const a=function(e){const t={};let n,a=me.dateTimePattern.exec(e);a?(t.date=a[1],n=a[3]):(a=me.datePattern.exec(e),a?(t.date=a[1],n=a[2]):(t.date=null,n=e));if(n){const e=me.timeZone.exec(n);e?(t.time=n.replace(e[1],""),t.timeZone=e[1].trim()):t.time=n}return t}(e),{year:r,restDateString:i}=function(e,t){if(e){const n=me.YYY[t],a=me.YYYYY[t];let r=me.YYYY.exec(e)||a.exec(e);if(r){const t=r[1];return{year:parseInt(t,10),restDateString:e.slice(t.length)}}if(r=me.YY.exec(e)||n.exec(e),r){const t=r[1];return{year:100*parseInt(t,10),restDateString:e.slice(t.length)}}}return{year:null}}(a.date,n),s=function(e,t){if(null===t)return null;let n,a,r;if(!e||!e.length)return n=new Date(0),n.setUTCFullYear(t),n;let i=me.MM.exec(e);if(i)return n=new Date(0),a=parseInt(i[1],10)-1,ye(t,a)?(n.setUTCFullYear(t,a),n):new Date(NaN);if(i=me.DDD.exec(e),i){n=new Date(0);const e=parseInt(i[1],10);return function(e,t){if(t<1)return!1;const n=_e(e);if(n&&t>366)return!1;if(!n&&t>365)return!1;return!0}(t,e)?(n.setUTCFullYear(t,0,e),n):new Date(NaN)}if(i=me.MMDD.exec(e),i){n=new Date(0),a=parseInt(i[1],10)-1;const e=parseInt(i[2],10);return ye(t,a,e)?(n.setUTCFullYear(t,a,e),n):new Date(NaN)}if(i=me.Www.exec(e),i)return r=parseInt(i[1],10)-1,be(r)?fe(t,r):new Date(NaN);if(i=me.WwwD.exec(e),i){r=parseInt(i[1],10)-1;const e=parseInt(i[2],10)-1;return be(r,e)?fe(t,r,e):new Date(NaN)}return null}(i,r);if(null===s||isNaN(s.getTime()))return new Date(NaN);if(s){const e=s.getTime();let n,r=0;if(a.time&&(r=function(e){let t,n,a=me.HH.exec(e);if(a)return t=parseFloat(a[1].replace(",",".")),we(t)?t%24*ge:NaN;if(a=me.HHMM.exec(e),a)return t=parseInt(a[1],10),n=parseFloat(a[2].replace(",",".")),we(t,n)?t%24*ge+n*le:NaN;if(a=me.HHMMSS.exec(e),a){t=parseInt(a[1],10),n=parseInt(a[2],10);const e=parseFloat(a[3].replace(",","."));return we(t,n,e)?t%24*ge+n*le+1e3*e:NaN}return null}(a.time),null===r||isNaN(r)))return new Date(NaN);if(a.timeZone||t.timeZone){if(n=re(a.timeZone||t.timeZone,new Date(e+r)),isNaN(n))return new Date(NaN)}else n=ce(new Date(e+r)),n=ce(new Date(e+r+n));return new Date(e+r+n)}return new Date(NaN)}function fe(e,t,n){t=t||0,n=n||0;const a=new Date(0);a.setUTCFullYear(e,0,4);const r=7*t+n+1-(a.getUTCDay()||7);return a.setUTCDate(a.getUTCDate()+r),a}const he=[31,28,31,30,31,30,31,31,30,31,30,31],pe=[31,29,31,30,31,30,31,31,30,31,30,31];function _e(e){return e%400==0||e%4==0&&e%100!=0}function ye(e,t,n){if(t<0||t>11)return!1;if(null!=n){if(n<1)return!1;const a=_e(e);if(a&&n>pe[t])return!1;if(!a&&n>he[t])return!1}return!0}function be(e,t){return!(e<0||e>52)&&(null==t||!(t<0||t>6))}function we(e,t,n){return!(e<0||e>=25)&&((null==t||!(t<0||t>=60))&&(null==n||!(n<0||n>=60)))}const De=e=>{const t=Intl.DateTimeFormat().resolvedOptions().timeZone,n=Math.round(e.end_time?e.end_time-e.start_time:Date.now()/1e3-e.start_time),a=null!==e.top_score?` ${Math.round(100*e.top_score)}%`:"";return`${m(function(e,t,n){const a=re(t,e=de(e,n),!0),r=new Date(e.getTime()-a),i=new Date(0);return i.setFullYear(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate()),i.setHours(r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),r.getUTCMilliseconds()),i}(1e3*e.start_time,t))} [${n}s, ${d(e.label)}${a}]`};class Ce extends R{constructor(e,t,n,a,r,i){super(e,t),this._event=n,this._contentID=a,this._thumbnail=r,this._subLabels=i??null}getStartTime(){return j(this._event.start_time)}getEndTime(){return this._event.end_time?j(this._event.end_time):null}inProgress(){return!this.getEndTime()}getVideoContentType(){return Y.HLS}getID(){return this._event.id}getContentID(){return this._contentID}getTitle(){return De(this._event)}getThumbnail(){return this._thumbnail}isFavorite(){return this._event.retain_indefinitely??null}setFavorite(e){this._event.retain_indefinitely=e}getWhat(){return[this._event.label]}getWhere(){const e=this._event.zones;return e.length?e:null}getScore(){return this._event.top_score}getTags(){return this._subLabels}isGroupableWith(e){return this.getMediaType()===e.getMediaType()&&f(this.getWhere(),e.getWhere())&&f(this.getWhat(),e.getWhat())}}class ve extends R{constructor(e,t,n,a,r,i){super(e,t),this._recording=n,this._id=a,this._contentID=r,this._title=i}getID(){return this._id}getStartTime(){return this._recording.startTime}getEndTime(){return this._recording.endTime}inProgress(){return!this.getEndTime()}getVideoContentType(){return Y.HLS}getContentID(){return this._contentID}getTitle(){return this._title}getEventCount(){return this._recording.events}}class Te{static createEventViewMedia(e,t,n,a,r){return"clip"===e&&!a.has_clip||"snapshot"===e&&!a.has_snapshot||!n.frigate.client_id||!n.frigate.camera_name?null:new Ce(e,t,a,((e,t,n,a)=>`media-source://frigate/${e}/event/${a}/${t}/${n.id}`)(n.frigate.client_id,n.frigate.camera_name,a,"clip"===e?"clips":"snapshots"),((e,t)=>`/api/frigate/${e}/thumbnail/${t.id}`)(n.frigate.client_id,a),r)}static createRecordingViewMedia(e,t,n,a){return n.frigate.client_id&&n.frigate.camera_name?new ve("recording",e,t,((e,t)=>`${e.frigate?.client_id??""}/${e.frigate.camera_name??""}/${t.startTime.getTime()}/${t.endTime.getTime()}`)(n,t),((e,t,n)=>["media-source://frigate",e,"recordings",t,`${n.startTime.getFullYear()}-${String(n.startTime.getMonth()+1).padStart(2,"0")}-${String(String(n.startTime.getDate()).padStart(2,"0"))}`,String(n.startTime.getHours()).padStart(2,"0")].join("/"))(n.frigate.client_id,n.frigate.camera_name,t),((e,t)=>`${e} ${m(t.startTime)}`)(a,t)):null}}class Ie{static isFrigateMedia(e){return this.isFrigateEvent(e)||this.isFrigateRecording(e)}static isFrigateEvent(e){return e instanceof Ce}static isFrigateRecording(e){return e instanceof ve}}class Se{static isFrigateEventQueryResults(e){return e.engine===p.Frigate&&e.type===C.Event}static isFrigateRecordingQueryResults(e){return e.engine===p.Frigate&&e.type===C.Recording}static isFrigateRecordingSegmentsResults(e){return e.engine===p.Frigate&&e.type===C.RecordingSegments}}class Me extends N{constructor(e,t,n,a,r){super(t,r),this._throttledSegmentGarbageCollector=h(this._garbageCollectSegments.bind(this),36e5,{leading:!1,trailing:!0}),this._entityRegistryManager=e,this._frigateEventWatcher=new J,this._recordingSegmentsCache=n,this._requestCache=a}getEngineType(){return p.Frigate}async createCamera(e,t){const n=new G(t,this,{eventCallback:this._eventCallback});return await n.initialize({hass:e,entityRegistryManager:this._entityRegistryManager,stateWatcher:this._stateWatcher,frigateEventWatcher:this._frigateEventWatcher})}async getMediaDownloadPath(e,t,n){return Ie.isFrigateEvent(n)?{endpoint:`/api/frigate/${t.frigate.client_id}/notifications/${n.getID()}/`+(_.isClip(n)?"clip.mp4":"snapshot.jpg")+"?download=true",sign:!0}:Ie.isFrigateRecording(n)?{endpoint:`/api/frigate/${t.frigate.client_id}/recording/${t.frigate.camera_name}/start/${Math.floor(n.getStartTime().getTime()/1e3)}/end/${Math.floor(n.getEndTime().getTime()/1e3)}?download=true`,sign:!0}:null}generateDefaultEventQuery(e,t,n){const a=[...e.getCameraConfigs(t)],r=y(a.map((e=>e?.frigate.zones)),f),i=y(a.map((e=>e?.frigate.labels)),f);if(1===r.length&&1===i.length)return[{type:b.Event,cameraIDs:t,...i[0]&&{what:new Set(i[0])},...r[0]&&{where:new Set(r[0])},...n}];const s=[];for(const a of t){const t=e.getCameraConfig(a);t&&s.push({type:b.Event,cameraIDs:new Set([a]),...t.frigate.labels&&{what:new Set(t.frigate.labels)},...t.frigate.zones&&{where:new Set(t.frigate.zones)},...n})}return s.length?s:null}generateDefaultRecordingQuery(e,t,n){return[{type:b.Recording,cameraIDs:t,...n}]}generateDefaultRecordingSegmentsQuery(e,t,n){return n.start&&n.end?[{type:b.RecordingSegments,cameraIDs:t,start:n.start,end:n.end,...n}]:null}async favoriteMedia(e,t,n,a){Ie.isFrigateEvent(n)&&(await async function(e,t,n,a){const o={type:"frigate/event/retain",instance_id:t,event_id:n,retain:a},c=await r(e,Q,o,!0);if(!c.success)throw new i(s("error.failed_retain"),{request:o,response:c})}(e,t.frigate.client_id,n.getID(),a),n.setFavorite(a))}_buildInstanceToCameraIDMapFromQuery(e,t){const n=new Map;for(const a of t){const t=this._getQueryableCameraConfig(e,a),r=t?.frigate.client_id;r&&(n.has(r)||n.set(r,new Set),n.get(r)?.add(a))}return n}_getFrigateCameraNamesForCameraIDs(e,t){const n=new Set;for(const a of t){const t=this._getQueryableCameraConfig(e,a);t?.frigate.camera_name&&n.add(t.frigate.camera_name)}return n}async getEvents(e,t,n,a){const r=new Map,i=async(i,s)=>{if(!s||!s.size)return;const o={...n,cameraIDs:s},c=a?.useCache??1?this._requestCache.get(o):null;if(c)return void r.set(n,c);const g={instance_id:i,cameras:Array.from(this._getFrigateCameraNamesForCameraIDs(t,s)),...n.what&&{labels:Array.from(n.what)},...n.where&&{zones:Array.from(n.where)},...n.tags&&{sub_labels:Array.from(n.tags)},...n.end&&{before:Math.floor(n.end.getTime()/1e3)},...n.start&&{after:Math.floor(n.start.getTime()/1e3)},...n.limit&&{limit:n.limit},...n.hasClip&&{has_clip:n.hasClip},...n.hasSnapshot&&{has_snapshot:n.hasSnapshot},...n.favorite&&{favorites:n.favorite},limit:n?.limit??$},l={type:C.Event,engine:p.Frigate,instanceID:i,events:await L(e,g),expiry:v(new Date,{seconds:60}),cached:!1};(a?.useCache??1)&&this._requestCache.set(n,{...l,cached:!0},l.expiry),r.set(o,l)},s=this._buildInstanceToCameraIDMapFromQuery(t,n.cameraIDs);return await Promise.all(Array.from(s.keys()).map((e=>i(e,s.get(e))))),r.size?r:null}async getRecordings(e,t,n,a){const i=new Map,s=async(n,s)=>{const o={...n,cameraIDs:new Set([s])},c=a?.useCache??1?this._requestCache.get(o):null;if(c)return void i.set(o,c);const g=this._getQueryableCameraConfig(t,s);if(!g||!g.frigate.camera_name)return;const l=await(async(e,t,n)=>await r(e,U,{type:"frigate/recordings/summary",instance_id:t,camera:n,timezone:e.config.time_zone},!0))(e,g.frigate.client_id,g.frigate.camera_name);let u=[];for(const e of l??[])for(const t of e.hours){const n=v(e.day,{hours:t.hour}),a=x(n),r=H(n);(!o.start||a>=o.start)&&(!o.end||r<=o.end)&&u.push({cameraID:s,startTime:a,endTime:r,events:t.events})}void 0!==o.limit&&(u=S(u,(e=>e.startTime),"desc").slice(0,o.limit));const m={type:C.Recording,engine:p.Frigate,instanceID:g.frigate.client_id,recordings:u,expiry:v(new Date,{seconds:60}),cached:!1};(a?.useCache??1)&&this._requestCache.set(o,{...m,cached:!0},m.expiry),i.set(o,m)};return await Promise.all(Array.from(n.cameraIDs).map((e=>s(n,e)))),i.size?i:null}async getRecordingSegments(e,t,n,a){const i=new Map,s=async(n,s)=>{const o={...n,cameraIDs:new Set([s])},c=this._getQueryableCameraConfig(t,s);if(!c||!c.frigate.camera_name)return;const g={start:o.start,end:o.end},l=a?.useCache??1?this._recordingSegmentsCache.get(s,g):null;if(l)return void i.set(o,{type:C.RecordingSegments,engine:p.Frigate,instanceID:c.frigate.client_id,segments:l,cached:!0});const u={instance_id:c.frigate.client_id,camera:c.frigate.camera_name,after:Math.floor(o.start.getTime()/1e3),before:Math.floor(o.end.getTime()/1e3)},m=await(async(e,t)=>await r(e,W,{type:"frigate/recordings/get",...t},!0))(e,u);(a?.useCache??1)&&this._recordingSegmentsCache.add(s,g,m),i.set(o,{type:C.RecordingSegments,engine:p.Frigate,instanceID:c.frigate.client_id,segments:m,cached:!1})};return await Promise.all(Array.from(n.cameraIDs).map((e=>s(n,e)))),w((()=>this._throttledSegmentGarbageCollector(e,t))),i.size?i:null}_getCameraIDMatch(e,t,n,a){if(1===t.cameraIDs.size)return[...t.cameraIDs][0];for(const[t,r]of e.getCameraConfigEntries())if(r.frigate.client_id===n&&r.frigate.camera_name===a)return t;return null}generateMediaFromEvents(e,t,n,a){if(!Se.isFrigateEventQueryResults(a))return null;const r=[];for(const e of a.events){const i=this._getCameraIDMatch(t,n,a.instanceID,e.camera);if(!i)continue;const s=this._getQueryableCameraConfig(t,i);if(!s)continue;let o=null;if(n.hasClip||n.hasSnapshot||!e.has_clip&&!e.has_snapshot?n.hasSnapshot&&e.has_snapshot?o="snapshot":n.hasClip&&e.has_clip&&(o="clip"):o=e.has_clip?"clip":"snapshot",!o)continue;const c=Te.createEventViewMedia(o,i,s,e,e.sub_label?this._splitSubLabels(e.sub_label):void 0);c&&r.push(c)}return r}generateMediaFromRecordings(e,t,n,a){if(!Se.isFrigateRecordingQueryResults(a))return null;const r=[];for(const n of a.recordings){const a=this._getQueryableCameraConfig(t,n.cameraID);if(!a)continue;const i=Te.createRecordingViewMedia(n.cameraID,n,a,this.getCameraMetadata(e,a).title);i&&r.push(i)}return r}getQueryResultMaxAge(e){return e.type===b.Event||e.type===b.Recording?60:null}async getMediaSeekTime(e,t,n,a,r){const i=n.getStartTime(),s=n.getEndTime();if(!i||!s||as)return null;const o=n.getCameraID(),c={cameraIDs:new Set([o]),start:i,end:s,type:b.RecordingSegments},g=await this.getRecordingSegments(e,t,c,r);return g?this._getSeekTimeInSegments(i,a,Array.from(g.values())[0].segments):null}_getQueryableCameraConfig(e,t){const n=e.getCameraConfig(t);return!n||V(n)?null:n}_splitSubLabels(e){return e.split(",").map((e=>e.trim()))}async getMediaMetadata(e,t,n,a){const i=new Map;if((a?.useCache??1)&&this._requestCache.has(n)){const e=this._requestCache.get(n);if(e)return i.set(n,e),i}const s=new Set,o=new Set,c=new Set,g=new Set,l=this._buildInstanceToCameraIDMapFromQuery(t,n.cameraIDs),u=async(n,a)=>{const i=this._getFrigateCameraNamesForCameraIDs(t,a);for(const t of await(async(e,t)=>await r(e,k,{type:"frigate/events/summary",instance_id:t,timezone:e.config.time_zone},!0))(e,n))i.has(t.camera)&&(t.label&&s.add(t.label),t.zones.length&&t.zones.forEach(o.add,o),t.day&&c.add(t.day),t.sub_label&&this._splitSubLabels(t.sub_label).forEach(g.add,g))},m=async n=>{const r=await this.getRecordings(e,t,{type:b.Recording,cameraIDs:n},a);if(r)for(const e of r.values())if(Se.isFrigateRecordingQueryResults(e))for(const t of e.recordings)c.add(M(t.startTime))};await D([...l.entries()],(([e,t])=>(async()=>{await Promise.all([u(e,t),m(t)])})()));const d={type:C.MediaMetadata,engine:p.Frigate,metadata:{...s.size&&{what:s},...o.size&&{where:o},...c.size&&{days:c},...g.size&&{tags:g}},expiry:v(new Date,{seconds:60}),cached:!1};return(a?.useCache??1)&&this._requestCache.set(n,{...d,cached:!0},d.expiry),i.set(n,d),i}async _garbageCollectSegments(e,t){const n=this._recordingSegmentsCache.getCameraIDs(),a={cameraIDs:new Set(n),type:b.Recording},r=(e,t)=>`${e}/${t.getDate()}/${t.getHours()}`,i=await this.getRecordings(e,t,a);if(i)for(const[e,t]of i){if(!Se.isFrigateRecordingQueryResults(t))continue;const n=new Set;for(const e of t.recordings)n.add(r(e.cameraID,e.startTime));const a=Array.from(e.cameraIDs)[0];this._recordingSegmentsCache.expireMatches(a,(e=>{const t=r(a,j(e.start_time));return!n.has(t)}))}}_getSeekTimeInSegments(e,t,n){if(!n.length)return null;let a=0;for(const r of n){const n=j(r.start_time);if(n>t)break;const i=j(r.end_time),s=nt?t:i).getTime()-s.getTime()}return a/1e3}getMediaCapabilities(e){return{canFavorite:_.isEvent(e),canDownload:!0}}getCameraMetadata(e,t){const n=super.getCameraMetadata(e,t);return{title:t.title??T(e,t.camera_entity)??T(e,t.webrtc_card?.entity)??d(t.frigate?.camera_name)??t.id??"",icon:n.icon,engineLogo:I}}getCameraEndpoints(e,t){const n=(()=>{if(!e.frigate.url)return null;if(!e.frigate.camera_name)return{endpoint:e.frigate.url};const n=`${e.frigate.url}/cameras/`+e.frigate.camera_name;if("live"===t?.view)return{endpoint:n};const a=`${e.frigate.url}/events?camera=`+e.frigate.camera_name,r=`${e.frigate.url}/recording/`+e.frigate.camera_name;switch(t?.media?.getMediaType()){case"clip":case"snapshot":return{endpoint:a};case"recording":const e=t.media.getStartTime();if(e)return{endpoint:r+F(e,"yyyy-MM-dd/HH")}}switch(t?.view){case"clip":case"clips":case"snapshots":case"snapshot":return{endpoint:a};case"recording":case"recordings":return{endpoint:r}}return{endpoint:n}})(),a=E(e,{url:e.go2rtc?.url??`/api/frigate/${e.frigate.client_id}/mse`,stream:e.go2rtc?.stream??e.frigate.camera_name}),r={endpoint:`/api/frigate/${e.frigate.client_id}/jsmpeg/${e.frigate.camera_name}`,sign:!0},i=(()=>{const t=e.frigate.camera_name?e.frigate.camera_name:null;return t?{endpoint:t}:null})();return{...super.getCameraEndpoints(e,t),...n&&{ui:n},...a&&{go2rtc:a},...r&&{jsmpeg:r},...i&&{webrtcCard:i}}}async executePTZAction(e,t,n,a){const r=t.camera_entity;("preset"!==n||a?.preset)&&await e.callService("frigate","ptz",{entity_id:r,action:"stop"===a?.phase?"stop":"zoom_in"===n||"zoom_out"===n?"zoom":"preset"===n?"preset":"move",..."stop"!==a?.phase&&{argument:"zoom_in"===n?"in":"zoom_out"===n?"out":"preset"===n?a?.preset:n}})}}export{Me as FrigateCameraManagerEngine}; diff --git a/config/www/community/frigate-hass-card/engine-frigate-7cd5392b.js.gz b/config/www/community/frigate-hass-card/engine-frigate-7cd5392b.js.gz new file mode 100644 index 00000000..fa36bfa2 Binary files /dev/null and b/config/www/community/frigate-hass-card/engine-frigate-7cd5392b.js.gz differ diff --git a/config/www/community/frigate-hass-card/engine-frigate-a6e3bd9e.js b/config/www/community/frigate-hass-card/engine-frigate-a6e3bd9e.js new file mode 100644 index 00000000..52621318 --- /dev/null +++ b/config/www/community/frigate-hass-card/engine-frigate-a6e3bd9e.js @@ -0,0 +1,3 @@ +import{d3 as e,d_ as t,d$ as n,e0 as a,e1 as r,e2 as i,l as s,e3 as o,e4 as c,e5 as g,e6 as l,db as u,dT as m,k as d,i as f,dh as h,e7 as p,dn as _,d9 as y,d7 as b,e8 as w,e9 as D,ea as C,dQ as v,j as T,eb as I,dc as S,de as M,dd as F}from"./card-7cd05290.js";import{C as $}from"./engine-86b0096c.js";import{C as z,G as N,g as E}from"./engine-generic-96b32038.js";import{a as R,V as Y}from"./media-c9012082.js";import{s as x,e as H}from"./startOfHour-f3ea02fd.js";function j(t){return e(1e3*t)}const Z=n.object({camera:n.string(),end_time:n.number().nullable(),false_positive:n.boolean().nullable(),has_clip:n.boolean(),has_snapshot:n.boolean(),id:n.string(),label:n.string(),sub_label:n.string().nullable(),start_time:n.number(),top_score:n.number().nullable(),zones:n.string().array(),retain_indefinitely:n.boolean().optional()}).array(),q=n.object({hour:n.preprocess((e=>Number(e)),n.number().min(0).max(23)),duration:n.number().min(0),events:n.number().min(0)}),U=n.object({day:n.preprocess((e=>"string"==typeof e?a(e):e),n.date()),events:n.number(),hours:q.array()}).array(),W=n.object({start_time:n.number(),end_time:n.number(),id:n.string()}).array(),Q=n.object({success:n.boolean(),message:n.string()}),k=n.object({camera:n.string(),day:n.string(),label:n.string(),sub_label:n.string().nullable(),zones:n.string().array()}).array(),P=n.object({name:n.string().optional(),features:n.string().array().optional(),presets:n.string().array().optional()}),A=n.object({camera:n.string(),snapshot:n.object({frame_time:n.number()}).nullable(),has_clip:n.boolean(),has_snapshot:n.boolean(),label:n.string(),current_zones:n.string().array()}),O=n.object({before:A,after:A,type:n.enum(["new","update","end"])});const L=async(e,t)=>await r(e,Z,{type:"frigate/events/get",...t},!0),V=e=>"birdseye"===e.frigate.camera_name;class G extends z{constructor(e,t,n){super(e,t,n),this._frigateEventHandler=e=>{const t=!e.before.has_snapshot&&e.after.has_snapshot||e.before.snapshot?.frame_time!==e.after.snapshot?.frame_time,n=!e.before.has_clip&&e.after.has_clip,a=this.getConfig();if(a.frigate.zones?.length&&!a.frigate.zones.some((t=>e.after.current_zones.includes(t)))||a.frigate.labels?.length&&!a.frigate.labels.includes(e.after.label))return;const r=a.triggers.events;(r.includes("events")||r.includes("snapshots")&&t||r.includes("clips")&&n)&&this._eventCallback?.({fidelity:"high",cameraID:this.getID(),type:e.type,clip:n&&r.includes("clips"),snapshot:t&&r.includes("snapshots")})}}async initialize(e){return await this._initializeConfig(e.hass,e.entityRegistryManager),await this._initializeCapabilities(e.hass),await this._subscribeToEvents(e.hass,e.frigateEventWatcher),await super.initialize(e)}async _initializeConfig(e,n){const a=this.getConfig(),r=!!a.frigate?.camera_name,i=a.triggers.motion||a.triggers.occupancy;let g=null;const l=o(a);if(l&&(!r||i)&&(g=await n.getEntity(e,l),!g))throw new c(s("error.no_camera_entity"),a);if(g&&!r){const e=this._getFrigateCameraNameFromEntity(g);e&&(this._config.frigate.camera_name=e)}if(i){const r=await n.getMatchingEntities(e,(e=>e.config_entry_id===g?.config_entry_id&&!e.disabled_by&&e.entity_id.startsWith("binary_sensor.")));if(a.triggers.motion){const e=this._getMotionSensor(a,[...r.values()]);e&&a.triggers.entities.push(e)}if(a.triggers.occupancy){const e=this._getOccupancySensor(a,[...r.values()]);e&&a.triggers.entities.push(...e)}a.triggers.entities=(u=a.triggers.entities)&&u.length?t(u):[]}var u}async _initializeCapabilities(e){const t=this.getConfig(),n=g(this.getConfig()),a=await this._getPTZCapabilities(e,t),r=n||a?{...a,...n}:null,i=V(t);this._capabilities=new l({"favorite-events":!i,"favorite-recordings":!1,seek:!i,clips:!i,snapshots:!i,recordings:!i,live:!0,menu:!0,substream:!0,...r&&{ptz:r}},{disable:t.capabilities?.disable,disableExcept:t.capabilities?.disable_except})}_getFrigateCameraNameFromEntity(e){if("frigate"===e.platform&&e.unique_id&&"string"==typeof e.unique_id){const t=e.unique_id.match(/:camera:(?[^:]+)$/);if(t&&t.groups)return t.groups.camera}return null}async _getPTZCapabilities(e,t){if(!t.frigate.camera_name||V(t))return null;let n=null;try{n=await(async(e,t,n)=>await r(e,P,{type:"frigate/ptz/info",instance_id:t,camera:n},!0))(e,t.frigate.client_id,t.frigate.camera_name)}catch(e){return u(e),null}const a=[...n.features?.includes("pt")?["continuous"]:[]],i=[...n.features?.includes("zoom")?["continuous"]:[]],s=n.presets;return a.length||i.length||s?.length?{...a&&{left:a,right:a,up:a,down:a},...i&&{zoomIn:i,zoomOut:i},...s&&{presets:s}}:null}_getMotionSensor(e,t){return e.frigate.camera_name?t.find((t=>"string"==typeof t.unique_id&&!!t.unique_id?.match(new RegExp(`:motion_sensor:${e.frigate.camera_name}`))))?.entity_id??null:null}_getOccupancySensor(e,t){const n=[],a=(e,a)=>{const r=t.find((t=>"string"==typeof t.unique_id&&!!t.unique_id?.match(new RegExp(`:occupancy_sensor:${e}_${a}`))))?.entity_id??null;r&&n.push(r)};if(e.frigate.camera_name){const t=e.frigate.zones?.length?e.frigate.zones:[e.frigate.camera_name],r=e.frigate.labels?.length?e.frigate.labels:["all"];for(const e of t)for(const t of r)a(e,t);if(n.length)return n}return null}async _subscribeToEvents(e,t){const n=this.getConfig();if(!n.triggers.events.length||!n.frigate.camera_name)return; +/* istanbul ignore next -- exercising the matcher is not possible when the + test uses an event watcher -- @preserve */const a={instanceID:n.frigate.client_id,callback:e=>this._frigateEventHandler(e),matcher:e=>e.after.camera===n.frigate.camera_name};await t.subscribe(e,a),this._onDestroy((()=>t.unsubscribe(a)))}}class J{constructor(){this._requests=[],this._unsubscribeCallback={}}async subscribe(e,t){const n=!this._hasSubscribers(t.instanceID);this._requests.push(t),n&&(this._unsubscribeCallback[t.instanceID]=await e.connection.subscribeMessage((e=>this._receiveHandler(t.instanceID,e)),{type:"frigate/events/subscribe",instance_id:t.instanceID}))}async unsubscribe(e){this._requests=this._requests.filter((t=>t!==e)),this._hasSubscribers(e.instanceID)||(await this._unsubscribeCallback[e.instanceID](),delete this._unsubscribeCallback[e.instanceID])}_hasSubscribers(e){return!!this._requests.filter((t=>t.instanceID===e)).length}_receiveHandler(e,t){let n;try{n=JSON.parse(t)}catch(e){return void console.warn("Received non-JSON payload as Frigate event",t)}const a=O.safeParse(n);if(a.success)for(const t of this._requests)t.instanceID!==e||t.matcher&&!t.matcher(a.data)||t.callback(a.data);else console.warn("Received malformed Frigate event from Home Assistant",t)}}function B(e,t){const n=function(e){if(!X[e]){const t=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),n="06/25/2014, 00:00:00"===t||"‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00"===t;X[e]=n?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}return X[e]}(t);return"formatToParts"in n?function(e,t){try{const n=e.formatToParts(t),a=[];for(let e=0;e=0?i:1e3+i,a-r}function se(e,t){return-23<=e&&e<=23&&(null==t||0<=t&&t<=59)}const oe={};function ce(e){const t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+e-+t}const ge=36e5,le=6e4,ue=2,me={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,plainTime:/:/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/};function de(e,t={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(null===e)return new Date(NaN);const n=null==t.additionalDigits?ue:Number(t.additionalDigits);if(2!==n&&1!==n&&0!==n)throw new RangeError("additionalDigits must be 0, 1 or 2");if(e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e))return new Date(e.getTime());if("number"==typeof e||"[object Number]"===Object.prototype.toString.call(e))return new Date(e);if("[object String]"!==Object.prototype.toString.call(e))return new Date(NaN);const a=function(e){const t={};let n,a=me.dateTimePattern.exec(e);a?(t.date=a[1],n=a[3]):(a=me.datePattern.exec(e),a?(t.date=a[1],n=a[2]):(t.date=null,n=e));if(n){const e=me.timeZone.exec(n);e?(t.time=n.replace(e[1],""),t.timeZone=e[1].trim()):t.time=n}return t}(e),{year:r,restDateString:i}=function(e,t){if(e){const n=me.YYY[t],a=me.YYYYY[t];let r=me.YYYY.exec(e)||a.exec(e);if(r){const t=r[1];return{year:parseInt(t,10),restDateString:e.slice(t.length)}}if(r=me.YY.exec(e)||n.exec(e),r){const t=r[1];return{year:100*parseInt(t,10),restDateString:e.slice(t.length)}}}return{year:null}}(a.date,n),s=function(e,t){if(null===t)return null;let n,a,r;if(!e||!e.length)return n=new Date(0),n.setUTCFullYear(t),n;let i=me.MM.exec(e);if(i)return n=new Date(0),a=parseInt(i[1],10)-1,ye(t,a)?(n.setUTCFullYear(t,a),n):new Date(NaN);if(i=me.DDD.exec(e),i){n=new Date(0);const e=parseInt(i[1],10);return function(e,t){if(t<1)return!1;const n=_e(e);if(n&&t>366)return!1;if(!n&&t>365)return!1;return!0}(t,e)?(n.setUTCFullYear(t,0,e),n):new Date(NaN)}if(i=me.MMDD.exec(e),i){n=new Date(0),a=parseInt(i[1],10)-1;const e=parseInt(i[2],10);return ye(t,a,e)?(n.setUTCFullYear(t,a,e),n):new Date(NaN)}if(i=me.Www.exec(e),i)return r=parseInt(i[1],10)-1,be(r)?fe(t,r):new Date(NaN);if(i=me.WwwD.exec(e),i){r=parseInt(i[1],10)-1;const e=parseInt(i[2],10)-1;return be(r,e)?fe(t,r,e):new Date(NaN)}return null}(i,r);if(null===s||isNaN(s.getTime()))return new Date(NaN);if(s){const e=s.getTime();let n,r=0;if(a.time&&(r=function(e){let t,n,a=me.HH.exec(e);if(a)return t=parseFloat(a[1].replace(",",".")),we(t)?t%24*ge:NaN;if(a=me.HHMM.exec(e),a)return t=parseInt(a[1],10),n=parseFloat(a[2].replace(",",".")),we(t,n)?t%24*ge+n*le:NaN;if(a=me.HHMMSS.exec(e),a){t=parseInt(a[1],10),n=parseInt(a[2],10);const e=parseFloat(a[3].replace(",","."));return we(t,n,e)?t%24*ge+n*le+1e3*e:NaN}return null}(a.time),null===r||isNaN(r)))return new Date(NaN);if(a.timeZone||t.timeZone){if(n=re(a.timeZone||t.timeZone,new Date(e+r)),isNaN(n))return new Date(NaN)}else n=ce(new Date(e+r)),n=ce(new Date(e+r+n));return new Date(e+r+n)}return new Date(NaN)}function fe(e,t,n){t=t||0,n=n||0;const a=new Date(0);a.setUTCFullYear(e,0,4);const r=7*t+n+1-(a.getUTCDay()||7);return a.setUTCDate(a.getUTCDate()+r),a}const he=[31,28,31,30,31,30,31,31,30,31,30,31],pe=[31,29,31,30,31,30,31,31,30,31,30,31];function _e(e){return e%400==0||e%4==0&&e%100!=0}function ye(e,t,n){if(t<0||t>11)return!1;if(null!=n){if(n<1)return!1;const a=_e(e);if(a&&n>pe[t])return!1;if(!a&&n>he[t])return!1}return!0}function be(e,t){return!(e<0||e>52)&&(null==t||!(t<0||t>6))}function we(e,t,n){return!(e<0||e>=25)&&((null==t||!(t<0||t>=60))&&(null==n||!(n<0||n>=60)))}const De=e=>{const t=Intl.DateTimeFormat().resolvedOptions().timeZone,n=Math.round(e.end_time?e.end_time-e.start_time:Date.now()/1e3-e.start_time),a=null!==e.top_score?` ${Math.round(100*e.top_score)}%`:"";return`${m(function(e,t,n){const a=re(t,e=de(e,n),!0),r=new Date(e.getTime()-a),i=new Date(0);return i.setFullYear(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate()),i.setHours(r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),r.getUTCMilliseconds()),i}(1e3*e.start_time,t))} [${n}s, ${d(e.label)}${a}]`};class Ce extends R{constructor(e,t,n,a,r,i){super(e,t),this._event=n,this._contentID=a,this._thumbnail=r,this._subLabels=i??null}getStartTime(){return j(this._event.start_time)}getEndTime(){return this._event.end_time?j(this._event.end_time):null}inProgress(){return!this.getEndTime()}getVideoContentType(){return Y.HLS}getID(){return this._event.id}getContentID(){return this._contentID}getTitle(){return De(this._event)}getThumbnail(){return this._thumbnail}isFavorite(){return this._event.retain_indefinitely??null}setFavorite(e){this._event.retain_indefinitely=e}getWhat(){return[this._event.label]}getWhere(){const e=this._event.zones;return e.length?e:null}getScore(){return this._event.top_score}getTags(){return this._subLabels}isGroupableWith(e){return this.getMediaType()===e.getMediaType()&&f(this.getWhere(),e.getWhere())&&f(this.getWhat(),e.getWhat())}}class ve extends R{constructor(e,t,n,a,r,i){super(e,t),this._recording=n,this._id=a,this._contentID=r,this._title=i}getID(){return this._id}getStartTime(){return this._recording.startTime}getEndTime(){return this._recording.endTime}inProgress(){return!this.getEndTime()}getVideoContentType(){return Y.HLS}getContentID(){return this._contentID}getTitle(){return this._title}getEventCount(){return this._recording.events}}class Te{static createEventViewMedia(e,t,n,a,r){return"clip"===e&&!a.has_clip||"snapshot"===e&&!a.has_snapshot||!n.frigate.client_id||!n.frigate.camera_name?null:new Ce(e,t,a,((e,t,n,a)=>`media-source://frigate/${e}/event/${a}/${t}/${n.id}`)(n.frigate.client_id,n.frigate.camera_name,a,"clip"===e?"clips":"snapshots"),((e,t)=>`/api/frigate/${e}/thumbnail/${t.id}`)(n.frigate.client_id,a),r)}static createRecordingViewMedia(e,t,n,a){return n.frigate.client_id&&n.frigate.camera_name?new ve("recording",e,t,((e,t)=>`${e.frigate?.client_id??""}/${e.frigate.camera_name??""}/${t.startTime.getTime()}/${t.endTime.getTime()}`)(n,t),((e,t,n)=>["media-source://frigate",e,"recordings",t,`${n.startTime.getFullYear()}-${String(n.startTime.getMonth()+1).padStart(2,"0")}-${String(String(n.startTime.getDate()).padStart(2,"0"))}`,String(n.startTime.getHours()).padStart(2,"0")].join("/"))(n.frigate.client_id,n.frigate.camera_name,t),((e,t)=>`${e} ${m(t.startTime)}`)(a,t)):null}}class Ie{static isFrigateMedia(e){return this.isFrigateEvent(e)||this.isFrigateRecording(e)}static isFrigateEvent(e){return e instanceof Ce}static isFrigateRecording(e){return e instanceof ve}}class Se{static isFrigateEventQueryResults(e){return e.engine===p.Frigate&&e.type===C.Event}static isFrigateRecordingQueryResults(e){return e.engine===p.Frigate&&e.type===C.Recording}static isFrigateRecordingSegmentsResults(e){return e.engine===p.Frigate&&e.type===C.RecordingSegments}}class Me extends N{constructor(e,t,n,a,r){super(t,r),this._throttledSegmentGarbageCollector=h(this._garbageCollectSegments.bind(this),36e5,{leading:!1,trailing:!0}),this._entityRegistryManager=e,this._frigateEventWatcher=new J,this._recordingSegmentsCache=n,this._requestCache=a}getEngineType(){return p.Frigate}async createCamera(e,t){const n=new G(t,this,{eventCallback:this._eventCallback});return await n.initialize({hass:e,entityRegistryManager:this._entityRegistryManager,stateWatcher:this._stateWatcher,frigateEventWatcher:this._frigateEventWatcher})}async getMediaDownloadPath(e,t,n){return Ie.isFrigateEvent(n)?{endpoint:`/api/frigate/${t.frigate.client_id}/notifications/${n.getID()}/`+(_.isClip(n)?"clip.mp4":"snapshot.jpg")+"?download=true",sign:!0}:Ie.isFrigateRecording(n)?{endpoint:`/api/frigate/${t.frigate.client_id}/recording/${t.frigate.camera_name}/start/${Math.floor(n.getStartTime().getTime()/1e3)}/end/${Math.floor(n.getEndTime().getTime()/1e3)}?download=true`,sign:!0}:null}generateDefaultEventQuery(e,t,n){const a=[...e.getCameraConfigs(t)],r=y(a.map((e=>e?.frigate.zones)),f),i=y(a.map((e=>e?.frigate.labels)),f);if(1===r.length&&1===i.length)return[{type:b.Event,cameraIDs:t,...i[0]&&{what:new Set(i[0])},...r[0]&&{where:new Set(r[0])},...n}];const s=[];for(const a of t){const t=e.getCameraConfig(a);t&&s.push({type:b.Event,cameraIDs:new Set([a]),...t.frigate.labels&&{what:new Set(t.frigate.labels)},...t.frigate.zones&&{where:new Set(t.frigate.zones)},...n})}return s.length?s:null}generateDefaultRecordingQuery(e,t,n){return[{type:b.Recording,cameraIDs:t,...n}]}generateDefaultRecordingSegmentsQuery(e,t,n){return n.start&&n.end?[{type:b.RecordingSegments,cameraIDs:t,start:n.start,end:n.end,...n}]:null}async favoriteMedia(e,t,n,a){Ie.isFrigateEvent(n)&&(await async function(e,t,n,a){const o={type:"frigate/event/retain",instance_id:t,event_id:n,retain:a},c=await r(e,Q,o,!0);if(!c.success)throw new i(s("error.failed_retain"),{request:o,response:c})}(e,t.frigate.client_id,n.getID(),a),n.setFavorite(a))}_buildInstanceToCameraIDMapFromQuery(e,t){const n=new Map;for(const a of t){const t=this._getQueryableCameraConfig(e,a),r=t?.frigate.client_id;r&&(n.has(r)||n.set(r,new Set),n.get(r)?.add(a))}return n}_getFrigateCameraNamesForCameraIDs(e,t){const n=new Set;for(const a of t){const t=this._getQueryableCameraConfig(e,a);t?.frigate.camera_name&&n.add(t.frigate.camera_name)}return n}async getEvents(e,t,n,a){const r=new Map,i=async(i,s)=>{if(!s||!s.size)return;const o={...n,cameraIDs:s},c=a?.useCache??1?this._requestCache.get(o):null;if(c)return void r.set(n,c);const g={instance_id:i,cameras:Array.from(this._getFrigateCameraNamesForCameraIDs(t,s)),...n.what&&{labels:Array.from(n.what)},...n.where&&{zones:Array.from(n.where)},...n.tags&&{sub_labels:Array.from(n.tags)},...n.end&&{before:Math.floor(n.end.getTime()/1e3)},...n.start&&{after:Math.floor(n.start.getTime()/1e3)},...n.limit&&{limit:n.limit},...n.hasClip&&{has_clip:n.hasClip},...n.hasSnapshot&&{has_snapshot:n.hasSnapshot},...n.favorite&&{favorites:n.favorite},limit:n?.limit??$},l={type:C.Event,engine:p.Frigate,instanceID:i,events:await L(e,g),expiry:v(new Date,{seconds:60}),cached:!1};(a?.useCache??1)&&this._requestCache.set(n,{...l,cached:!0},l.expiry),r.set(o,l)},s=this._buildInstanceToCameraIDMapFromQuery(t,n.cameraIDs);return await Promise.all(Array.from(s.keys()).map((e=>i(e,s.get(e))))),r.size?r:null}async getRecordings(e,t,n,a){const i=new Map,s=async(n,s)=>{const o={...n,cameraIDs:new Set([s])},c=a?.useCache??1?this._requestCache.get(o):null;if(c)return void i.set(o,c);const g=this._getQueryableCameraConfig(t,s);if(!g||!g.frigate.camera_name)return;const l=await(async(e,t,n)=>await r(e,U,{type:"frigate/recordings/summary",instance_id:t,camera:n,timezone:e.config.time_zone},!0))(e,g.frigate.client_id,g.frigate.camera_name);let u=[];for(const e of l??[])for(const t of e.hours){const n=v(e.day,{hours:t.hour}),a=x(n),r=H(n);(!o.start||a>=o.start)&&(!o.end||r<=o.end)&&u.push({cameraID:s,startTime:a,endTime:r,events:t.events})}void 0!==o.limit&&(u=S(u,(e=>e.startTime),"desc").slice(0,o.limit));const m={type:C.Recording,engine:p.Frigate,instanceID:g.frigate.client_id,recordings:u,expiry:v(new Date,{seconds:60}),cached:!1};(a?.useCache??1)&&this._requestCache.set(o,{...m,cached:!0},m.expiry),i.set(o,m)};return await Promise.all(Array.from(n.cameraIDs).map((e=>s(n,e)))),i.size?i:null}async getRecordingSegments(e,t,n,a){const i=new Map,s=async(n,s)=>{const o={...n,cameraIDs:new Set([s])},c=this._getQueryableCameraConfig(t,s);if(!c||!c.frigate.camera_name)return;const g={start:o.start,end:o.end},l=a?.useCache??1?this._recordingSegmentsCache.get(s,g):null;if(l)return void i.set(o,{type:C.RecordingSegments,engine:p.Frigate,instanceID:c.frigate.client_id,segments:l,cached:!0});const u={instance_id:c.frigate.client_id,camera:c.frigate.camera_name,after:Math.floor(o.start.getTime()/1e3),before:Math.floor(o.end.getTime()/1e3)},m=await(async(e,t)=>await r(e,W,{type:"frigate/recordings/get",...t},!0))(e,u);(a?.useCache??1)&&this._recordingSegmentsCache.add(s,g,m),i.set(o,{type:C.RecordingSegments,engine:p.Frigate,instanceID:c.frigate.client_id,segments:m,cached:!1})};return await Promise.all(Array.from(n.cameraIDs).map((e=>s(n,e)))),w((()=>this._throttledSegmentGarbageCollector(e,t))),i.size?i:null}_getCameraIDMatch(e,t,n,a){if(1===t.cameraIDs.size)return[...t.cameraIDs][0];for(const[t,r]of e.getCameraConfigEntries())if(r.frigate.client_id===n&&r.frigate.camera_name===a)return t;return null}generateMediaFromEvents(e,t,n,a){if(!Se.isFrigateEventQueryResults(a))return null;const r=[];for(const e of a.events){const i=this._getCameraIDMatch(t,n,a.instanceID,e.camera);if(!i)continue;const s=this._getQueryableCameraConfig(t,i);if(!s)continue;let o=null;if(n.hasClip||n.hasSnapshot||!e.has_clip&&!e.has_snapshot?n.hasSnapshot&&e.has_snapshot?o="snapshot":n.hasClip&&e.has_clip&&(o="clip"):o=e.has_clip?"clip":"snapshot",!o)continue;const c=Te.createEventViewMedia(o,i,s,e,e.sub_label?this._splitSubLabels(e.sub_label):void 0);c&&r.push(c)}return r}generateMediaFromRecordings(e,t,n,a){if(!Se.isFrigateRecordingQueryResults(a))return null;const r=[];for(const n of a.recordings){const a=this._getQueryableCameraConfig(t,n.cameraID);if(!a)continue;const i=Te.createRecordingViewMedia(n.cameraID,n,a,this.getCameraMetadata(e,a).title);i&&r.push(i)}return r}getQueryResultMaxAge(e){return e.type===b.Event||e.type===b.Recording?60:null}async getMediaSeekTime(e,t,n,a,r){const i=n.getStartTime(),s=n.getEndTime();if(!i||!s||as)return null;const o=n.getCameraID(),c={cameraIDs:new Set([o]),start:i,end:s,type:b.RecordingSegments},g=await this.getRecordingSegments(e,t,c,r);return g?this._getSeekTimeInSegments(i,a,Array.from(g.values())[0].segments):null}_getQueryableCameraConfig(e,t){const n=e.getCameraConfig(t);return!n||V(n)?null:n}_splitSubLabels(e){return e.split(",").map((e=>e.trim()))}async getMediaMetadata(e,t,n,a){const i=new Map;if((a?.useCache??1)&&this._requestCache.has(n)){const e=this._requestCache.get(n);if(e)return i.set(n,e),i}const s=new Set,o=new Set,c=new Set,g=new Set,l=this._buildInstanceToCameraIDMapFromQuery(t,n.cameraIDs),u=async(n,a)=>{const i=this._getFrigateCameraNamesForCameraIDs(t,a);for(const t of await(async(e,t)=>await r(e,k,{type:"frigate/events/summary",instance_id:t,timezone:e.config.time_zone},!0))(e,n))i.has(t.camera)&&(t.label&&s.add(t.label),t.zones.length&&t.zones.forEach(o.add,o),t.day&&c.add(t.day),t.sub_label&&this._splitSubLabels(t.sub_label).forEach(g.add,g))},m=async n=>{const r=await this.getRecordings(e,t,{type:b.Recording,cameraIDs:n},a);if(r)for(const e of r.values())if(Se.isFrigateRecordingQueryResults(e))for(const t of e.recordings)c.add(M(t.startTime))};await D([...l.entries()],(([e,t])=>(async()=>{await Promise.all([u(e,t),m(t)])})()));const d={type:C.MediaMetadata,engine:p.Frigate,metadata:{...s.size&&{what:s},...o.size&&{where:o},...c.size&&{days:c},...g.size&&{tags:g}},expiry:v(new Date,{seconds:60}),cached:!1};return(a?.useCache??1)&&this._requestCache.set(n,{...d,cached:!0},d.expiry),i.set(n,d),i}async _garbageCollectSegments(e,t){const n=this._recordingSegmentsCache.getCameraIDs(),a={cameraIDs:new Set(n),type:b.Recording},r=(e,t)=>`${e}/${t.getDate()}/${t.getHours()}`,i=await this.getRecordings(e,t,a);if(i)for(const[e,t]of i){if(!Se.isFrigateRecordingQueryResults(t))continue;const n=new Set;for(const e of t.recordings)n.add(r(e.cameraID,e.startTime));const a=Array.from(e.cameraIDs)[0];this._recordingSegmentsCache.expireMatches(a,(e=>{const t=r(a,j(e.start_time));return!n.has(t)}))}}_getSeekTimeInSegments(e,t,n){if(!n.length)return null;let a=0;for(const r of n){const n=j(r.start_time);if(n>t)break;const i=j(r.end_time),s=nt?t:i).getTime()-s.getTime()}return a/1e3}getMediaCapabilities(e){return{canFavorite:_.isEvent(e),canDownload:!0}}getCameraMetadata(e,t){const n=super.getCameraMetadata(e,t);return{title:t.title??T(e,t.camera_entity)??T(e,t.webrtc_card?.entity)??d(t.frigate?.camera_name)??t.id??"",icon:n.icon,engineLogo:I}}getCameraEndpoints(e,t){const n=(()=>{if(!e.frigate.url)return null;if(!e.frigate.camera_name)return{endpoint:e.frigate.url};const n=`${e.frigate.url}/cameras/`+e.frigate.camera_name;if("live"===t?.view)return{endpoint:n};const a=`${e.frigate.url}/events?camera=`+e.frigate.camera_name,r=`${e.frigate.url}/recording/`+e.frigate.camera_name;switch(t?.media?.getMediaType()){case"clip":case"snapshot":return{endpoint:a};case"recording":const e=t.media.getStartTime();if(e)return{endpoint:r+F(e,"yyyy-MM-dd/HH")}}switch(t?.view){case"clip":case"clips":case"snapshots":case"snapshot":return{endpoint:a};case"recording":case"recordings":return{endpoint:r}}return{endpoint:n}})(),a=E(e,{url:e.go2rtc?.url??`/api/frigate/${e.frigate.client_id}/mse`,stream:e.go2rtc?.stream??e.frigate.camera_name}),r={endpoint:`/api/frigate/${e.frigate.client_id}/jsmpeg/${e.frigate.camera_name}`,sign:!0},i=(()=>{const t=e.frigate.camera_name?e.frigate.camera_name:null;return t?{endpoint:t}:null})();return{...super.getCameraEndpoints(e,t),...n&&{ui:n},...a&&{go2rtc:a},...r&&{jsmpeg:r},...i&&{webrtcCard:i}}}async executePTZAction(e,t,n,a){const r=t.camera_entity;("preset"!==n||a?.preset)&&await e.callService("frigate","ptz",{entity_id:r,action:"stop"===a?.phase?"stop":"zoom_in"===n||"zoom_out"===n?"zoom":"preset"===n?"preset":"move",..."stop"!==a?.phase&&{argument:"zoom_in"===n?"in":"zoom_out"===n?"out":"preset"===n?a?.preset:n}})}}export{Me as FrigateCameraManagerEngine}; diff --git a/config/www/community/frigate-hass-card/engine-frigate-a6e3bd9e.js.gz b/config/www/community/frigate-hass-card/engine-frigate-a6e3bd9e.js.gz new file mode 100644 index 00000000..aef7b531 Binary files /dev/null and b/config/www/community/frigate-hass-card/engine-frigate-a6e3bd9e.js.gz differ diff --git a/config/www/community/frigate-hass-card/engine-frigate-f675aa79.js b/config/www/community/frigate-hass-card/engine-frigate-f675aa79.js new file mode 100644 index 00000000..574841cf --- /dev/null +++ b/config/www/community/frigate-hass-card/engine-frigate-f675aa79.js @@ -0,0 +1,3 @@ +import{d3 as e,d_ as t,d$ as n,e0 as a,e1 as r,e2 as i,l as s,e3 as o,e4 as c,e5 as g,e6 as l,db as u,dT as m,k as d,i as f,dh as h,e7 as p,dn as _,d9 as y,d7 as b,e8 as w,e9 as D,ea as C,dQ as v,j as T,eb as I,dc as S,de as M,dd as F}from"./card-769e2b91.js";import{C as $}from"./engine-86b0096c.js";import{C as z,G as N,g as E}from"./engine-generic-97fdd47e.js";import{a as R,V as Y}from"./media-c9012082.js";import{s as x,e as H}from"./startOfHour-1a5ce3ae.js";function j(t){return e(1e3*t)}const Z=n.object({camera:n.string(),end_time:n.number().nullable(),false_positive:n.boolean().nullable(),has_clip:n.boolean(),has_snapshot:n.boolean(),id:n.string(),label:n.string(),sub_label:n.string().nullable(),start_time:n.number(),top_score:n.number().nullable(),zones:n.string().array(),retain_indefinitely:n.boolean().optional()}).array(),q=n.object({hour:n.preprocess((e=>Number(e)),n.number().min(0).max(23)),duration:n.number().min(0),events:n.number().min(0)}),U=n.object({day:n.preprocess((e=>"string"==typeof e?a(e):e),n.date()),events:n.number(),hours:q.array()}).array(),W=n.object({start_time:n.number(),end_time:n.number(),id:n.string()}).array(),Q=n.object({success:n.boolean(),message:n.string()}),k=n.object({camera:n.string(),day:n.string(),label:n.string(),sub_label:n.string().nullable(),zones:n.string().array()}).array(),P=n.object({name:n.string().optional(),features:n.string().array().optional(),presets:n.string().array().optional()}),A=n.object({camera:n.string(),snapshot:n.object({frame_time:n.number()}).nullable(),has_clip:n.boolean(),has_snapshot:n.boolean(),label:n.string(),current_zones:n.string().array()}),O=n.object({before:A,after:A,type:n.enum(["new","update","end"])});const L=async(e,t)=>await r(e,Z,{type:"frigate/events/get",...t},!0),V=e=>"birdseye"===e.frigate.camera_name;class G extends z{constructor(e,t,n){super(e,t,n),this._frigateEventHandler=e=>{const t=!e.before.has_snapshot&&e.after.has_snapshot||e.before.snapshot?.frame_time!==e.after.snapshot?.frame_time,n=!e.before.has_clip&&e.after.has_clip,a=this.getConfig();if(a.frigate.zones?.length&&!a.frigate.zones.some((t=>e.after.current_zones.includes(t)))||a.frigate.labels?.length&&!a.frigate.labels.includes(e.after.label))return;const r=a.triggers.events;(r.includes("events")||r.includes("snapshots")&&t||r.includes("clips")&&n)&&this._eventCallback?.({fidelity:"high",cameraID:this.getID(),type:e.type,clip:n&&r.includes("clips"),snapshot:t&&r.includes("snapshots")})}}async initialize(e){return await this._initializeConfig(e.hass,e.entityRegistryManager),await this._initializeCapabilities(e.hass),await this._subscribeToEvents(e.hass,e.frigateEventWatcher),await super.initialize(e)}async _initializeConfig(e,n){const a=this.getConfig(),r=!!a.frigate?.camera_name,i=a.triggers.motion||a.triggers.occupancy;let g=null;const l=o(a);if(l&&(!r||i)&&(g=await n.getEntity(e,l),!g))throw new c(s("error.no_camera_entity"),a);if(g&&!r){const e=this._getFrigateCameraNameFromEntity(g);e&&(this._config.frigate.camera_name=e)}if(i){const r=await n.getMatchingEntities(e,(e=>e.config_entry_id===g?.config_entry_id&&!e.disabled_by&&e.entity_id.startsWith("binary_sensor.")));if(a.triggers.motion){const e=this._getMotionSensor(a,[...r.values()]);e&&a.triggers.entities.push(e)}if(a.triggers.occupancy){const e=this._getOccupancySensor(a,[...r.values()]);e&&a.triggers.entities.push(...e)}a.triggers.entities=(u=a.triggers.entities)&&u.length?t(u):[]}var u}async _initializeCapabilities(e){const t=this.getConfig(),n=g(this.getConfig()),a=await this._getPTZCapabilities(e,t),r=n||a?{...a,...n}:null,i=V(t);this._capabilities=new l({"favorite-events":!i,"favorite-recordings":!1,seek:!i,clips:!i,snapshots:!i,recordings:!i,live:!0,menu:!0,substream:!0,...r&&{ptz:r}},{disable:t.capabilities?.disable,disableExcept:t.capabilities?.disable_except})}_getFrigateCameraNameFromEntity(e){if("frigate"===e.platform&&e.unique_id&&"string"==typeof e.unique_id){const t=e.unique_id.match(/:camera:(?[^:]+)$/);if(t&&t.groups)return t.groups.camera}return null}async _getPTZCapabilities(e,t){if(!t.frigate.camera_name||V(t))return null;let n=null;try{n=await(async(e,t,n)=>await r(e,P,{type:"frigate/ptz/info",instance_id:t,camera:n},!0))(e,t.frigate.client_id,t.frigate.camera_name)}catch(e){return u(e),null}const a=[...n.features?.includes("pt")?["continuous"]:[]],i=[...n.features?.includes("zoom")?["continuous"]:[]],s=n.presets;return a.length||i.length||s?.length?{...a&&{left:a,right:a,up:a,down:a},...i&&{zoomIn:i,zoomOut:i},...s&&{presets:s}}:null}_getMotionSensor(e,t){return e.frigate.camera_name?t.find((t=>"string"==typeof t.unique_id&&!!t.unique_id?.match(new RegExp(`:motion_sensor:${e.frigate.camera_name}`))))?.entity_id??null:null}_getOccupancySensor(e,t){const n=[],a=(e,a)=>{const r=t.find((t=>"string"==typeof t.unique_id&&!!t.unique_id?.match(new RegExp(`:occupancy_sensor:${e}_${a}`))))?.entity_id??null;r&&n.push(r)};if(e.frigate.camera_name){const t=e.frigate.zones?.length?e.frigate.zones:[e.frigate.camera_name],r=e.frigate.labels?.length?e.frigate.labels:["all"];for(const e of t)for(const t of r)a(e,t);if(n.length)return n}return null}async _subscribeToEvents(e,t){const n=this.getConfig();if(!n.triggers.events.length||!n.frigate.camera_name)return; +/* istanbul ignore next -- exercising the matcher is not possible when the + test uses an event watcher -- @preserve */const a={instanceID:n.frigate.client_id,callback:e=>this._frigateEventHandler(e),matcher:e=>e.after.camera===n.frigate.camera_name};await t.subscribe(e,a),this._onDestroy((()=>t.unsubscribe(a)))}}class J{constructor(){this._requests=[],this._unsubscribeCallback={}}async subscribe(e,t){const n=!this._hasSubscribers(t.instanceID);this._requests.push(t),n&&(this._unsubscribeCallback[t.instanceID]=await e.connection.subscribeMessage((e=>this._receiveHandler(t.instanceID,e)),{type:"frigate/events/subscribe",instance_id:t.instanceID}))}async unsubscribe(e){this._requests=this._requests.filter((t=>t!==e)),this._hasSubscribers(e.instanceID)||(await this._unsubscribeCallback[e.instanceID](),delete this._unsubscribeCallback[e.instanceID])}_hasSubscribers(e){return!!this._requests.filter((t=>t.instanceID===e)).length}_receiveHandler(e,t){let n;try{n=JSON.parse(t)}catch(e){return void console.warn("Received non-JSON payload as Frigate event",t)}const a=O.safeParse(n);if(a.success)for(const t of this._requests)t.instanceID!==e||t.matcher&&!t.matcher(a.data)||t.callback(a.data);else console.warn("Received malformed Frigate event from Home Assistant",t)}}function B(e,t){const n=function(e){if(!X[e]){const t=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),n="06/25/2014, 00:00:00"===t||"‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00"===t;X[e]=n?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}return X[e]}(t);return"formatToParts"in n?function(e,t){try{const n=e.formatToParts(t),a=[];for(let e=0;e=0?i:1e3+i,a-r}function se(e,t){return-23<=e&&e<=23&&(null==t||0<=t&&t<=59)}const oe={};function ce(e){const t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+e-+t}const ge=36e5,le=6e4,ue=2,me={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,plainTime:/:/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/};function de(e,t={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(null===e)return new Date(NaN);const n=null==t.additionalDigits?ue:Number(t.additionalDigits);if(2!==n&&1!==n&&0!==n)throw new RangeError("additionalDigits must be 0, 1 or 2");if(e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e))return new Date(e.getTime());if("number"==typeof e||"[object Number]"===Object.prototype.toString.call(e))return new Date(e);if("[object String]"!==Object.prototype.toString.call(e))return new Date(NaN);const a=function(e){const t={};let n,a=me.dateTimePattern.exec(e);a?(t.date=a[1],n=a[3]):(a=me.datePattern.exec(e),a?(t.date=a[1],n=a[2]):(t.date=null,n=e));if(n){const e=me.timeZone.exec(n);e?(t.time=n.replace(e[1],""),t.timeZone=e[1].trim()):t.time=n}return t}(e),{year:r,restDateString:i}=function(e,t){if(e){const n=me.YYY[t],a=me.YYYYY[t];let r=me.YYYY.exec(e)||a.exec(e);if(r){const t=r[1];return{year:parseInt(t,10),restDateString:e.slice(t.length)}}if(r=me.YY.exec(e)||n.exec(e),r){const t=r[1];return{year:100*parseInt(t,10),restDateString:e.slice(t.length)}}}return{year:null}}(a.date,n),s=function(e,t){if(null===t)return null;let n,a,r;if(!e||!e.length)return n=new Date(0),n.setUTCFullYear(t),n;let i=me.MM.exec(e);if(i)return n=new Date(0),a=parseInt(i[1],10)-1,ye(t,a)?(n.setUTCFullYear(t,a),n):new Date(NaN);if(i=me.DDD.exec(e),i){n=new Date(0);const e=parseInt(i[1],10);return function(e,t){if(t<1)return!1;const n=_e(e);if(n&&t>366)return!1;if(!n&&t>365)return!1;return!0}(t,e)?(n.setUTCFullYear(t,0,e),n):new Date(NaN)}if(i=me.MMDD.exec(e),i){n=new Date(0),a=parseInt(i[1],10)-1;const e=parseInt(i[2],10);return ye(t,a,e)?(n.setUTCFullYear(t,a,e),n):new Date(NaN)}if(i=me.Www.exec(e),i)return r=parseInt(i[1],10)-1,be(r)?fe(t,r):new Date(NaN);if(i=me.WwwD.exec(e),i){r=parseInt(i[1],10)-1;const e=parseInt(i[2],10)-1;return be(r,e)?fe(t,r,e):new Date(NaN)}return null}(i,r);if(null===s||isNaN(s.getTime()))return new Date(NaN);if(s){const e=s.getTime();let n,r=0;if(a.time&&(r=function(e){let t,n,a=me.HH.exec(e);if(a)return t=parseFloat(a[1].replace(",",".")),we(t)?t%24*ge:NaN;if(a=me.HHMM.exec(e),a)return t=parseInt(a[1],10),n=parseFloat(a[2].replace(",",".")),we(t,n)?t%24*ge+n*le:NaN;if(a=me.HHMMSS.exec(e),a){t=parseInt(a[1],10),n=parseInt(a[2],10);const e=parseFloat(a[3].replace(",","."));return we(t,n,e)?t%24*ge+n*le+1e3*e:NaN}return null}(a.time),null===r||isNaN(r)))return new Date(NaN);if(a.timeZone||t.timeZone){if(n=re(a.timeZone||t.timeZone,new Date(e+r)),isNaN(n))return new Date(NaN)}else n=ce(new Date(e+r)),n=ce(new Date(e+r+n));return new Date(e+r+n)}return new Date(NaN)}function fe(e,t,n){t=t||0,n=n||0;const a=new Date(0);a.setUTCFullYear(e,0,4);const r=7*t+n+1-(a.getUTCDay()||7);return a.setUTCDate(a.getUTCDate()+r),a}const he=[31,28,31,30,31,30,31,31,30,31,30,31],pe=[31,29,31,30,31,30,31,31,30,31,30,31];function _e(e){return e%400==0||e%4==0&&e%100!=0}function ye(e,t,n){if(t<0||t>11)return!1;if(null!=n){if(n<1)return!1;const a=_e(e);if(a&&n>pe[t])return!1;if(!a&&n>he[t])return!1}return!0}function be(e,t){return!(e<0||e>52)&&(null==t||!(t<0||t>6))}function we(e,t,n){return!(e<0||e>=25)&&((null==t||!(t<0||t>=60))&&(null==n||!(n<0||n>=60)))}const De=e=>{const t=Intl.DateTimeFormat().resolvedOptions().timeZone,n=Math.round(e.end_time?e.end_time-e.start_time:Date.now()/1e3-e.start_time),a=null!==e.top_score?` ${Math.round(100*e.top_score)}%`:"";return`${m(function(e,t,n){const a=re(t,e=de(e,n),!0),r=new Date(e.getTime()-a),i=new Date(0);return i.setFullYear(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate()),i.setHours(r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),r.getUTCMilliseconds()),i}(1e3*e.start_time,t))} [${n}s, ${d(e.label)}${a}]`};class Ce extends R{constructor(e,t,n,a,r,i){super(e,t),this._event=n,this._contentID=a,this._thumbnail=r,this._subLabels=i??null}getStartTime(){return j(this._event.start_time)}getEndTime(){return this._event.end_time?j(this._event.end_time):null}inProgress(){return!this.getEndTime()}getVideoContentType(){return Y.HLS}getID(){return this._event.id}getContentID(){return this._contentID}getTitle(){return De(this._event)}getThumbnail(){return this._thumbnail}isFavorite(){return this._event.retain_indefinitely??null}setFavorite(e){this._event.retain_indefinitely=e}getWhat(){return[this._event.label]}getWhere(){const e=this._event.zones;return e.length?e:null}getScore(){return this._event.top_score}getTags(){return this._subLabels}isGroupableWith(e){return this.getMediaType()===e.getMediaType()&&f(this.getWhere(),e.getWhere())&&f(this.getWhat(),e.getWhat())}}class ve extends R{constructor(e,t,n,a,r,i){super(e,t),this._recording=n,this._id=a,this._contentID=r,this._title=i}getID(){return this._id}getStartTime(){return this._recording.startTime}getEndTime(){return this._recording.endTime}inProgress(){return!this.getEndTime()}getVideoContentType(){return Y.HLS}getContentID(){return this._contentID}getTitle(){return this._title}getEventCount(){return this._recording.events}}class Te{static createEventViewMedia(e,t,n,a,r){return"clip"===e&&!a.has_clip||"snapshot"===e&&!a.has_snapshot||!n.frigate.client_id||!n.frigate.camera_name?null:new Ce(e,t,a,((e,t,n,a)=>`media-source://frigate/${e}/event/${a}/${t}/${n.id}`)(n.frigate.client_id,n.frigate.camera_name,a,"clip"===e?"clips":"snapshots"),((e,t)=>`/api/frigate/${e}/thumbnail/${t.id}`)(n.frigate.client_id,a),r)}static createRecordingViewMedia(e,t,n,a){return n.frigate.client_id&&n.frigate.camera_name?new ve("recording",e,t,((e,t)=>`${e.frigate?.client_id??""}/${e.frigate.camera_name??""}/${t.startTime.getTime()}/${t.endTime.getTime()}`)(n,t),((e,t,n)=>["media-source://frigate",e,"recordings",t,`${n.startTime.getFullYear()}-${String(n.startTime.getMonth()+1).padStart(2,"0")}-${String(String(n.startTime.getDate()).padStart(2,"0"))}`,String(n.startTime.getHours()).padStart(2,"0")].join("/"))(n.frigate.client_id,n.frigate.camera_name,t),((e,t)=>`${e} ${m(t.startTime)}`)(a,t)):null}}class Ie{static isFrigateMedia(e){return this.isFrigateEvent(e)||this.isFrigateRecording(e)}static isFrigateEvent(e){return e instanceof Ce}static isFrigateRecording(e){return e instanceof ve}}class Se{static isFrigateEventQueryResults(e){return e.engine===p.Frigate&&e.type===C.Event}static isFrigateRecordingQueryResults(e){return e.engine===p.Frigate&&e.type===C.Recording}static isFrigateRecordingSegmentsResults(e){return e.engine===p.Frigate&&e.type===C.RecordingSegments}}class Me extends N{constructor(e,t,n,a,r){super(t,r),this._throttledSegmentGarbageCollector=h(this._garbageCollectSegments.bind(this),36e5,{leading:!1,trailing:!0}),this._entityRegistryManager=e,this._frigateEventWatcher=new J,this._recordingSegmentsCache=n,this._requestCache=a}getEngineType(){return p.Frigate}async createCamera(e,t){const n=new G(t,this,{eventCallback:this._eventCallback});return await n.initialize({hass:e,entityRegistryManager:this._entityRegistryManager,stateWatcher:this._stateWatcher,frigateEventWatcher:this._frigateEventWatcher})}async getMediaDownloadPath(e,t,n){return Ie.isFrigateEvent(n)?{endpoint:`/api/frigate/${t.frigate.client_id}/notifications/${n.getID()}/`+(_.isClip(n)?"clip.mp4":"snapshot.jpg")+"?download=true",sign:!0}:Ie.isFrigateRecording(n)?{endpoint:`/api/frigate/${t.frigate.client_id}/recording/${t.frigate.camera_name}/start/${Math.floor(n.getStartTime().getTime()/1e3)}/end/${Math.floor(n.getEndTime().getTime()/1e3)}?download=true`,sign:!0}:null}generateDefaultEventQuery(e,t,n){const a=[...e.getCameraConfigs(t)],r=y(a.map((e=>e?.frigate.zones)),f),i=y(a.map((e=>e?.frigate.labels)),f);if(1===r.length&&1===i.length)return[{type:b.Event,cameraIDs:t,...i[0]&&{what:new Set(i[0])},...r[0]&&{where:new Set(r[0])},...n}];const s=[];for(const a of t){const t=e.getCameraConfig(a);t&&s.push({type:b.Event,cameraIDs:new Set([a]),...t.frigate.labels&&{what:new Set(t.frigate.labels)},...t.frigate.zones&&{where:new Set(t.frigate.zones)},...n})}return s.length?s:null}generateDefaultRecordingQuery(e,t,n){return[{type:b.Recording,cameraIDs:t,...n}]}generateDefaultRecordingSegmentsQuery(e,t,n){return n.start&&n.end?[{type:b.RecordingSegments,cameraIDs:t,start:n.start,end:n.end,...n}]:null}async favoriteMedia(e,t,n,a){Ie.isFrigateEvent(n)&&(await async function(e,t,n,a){const o={type:"frigate/event/retain",instance_id:t,event_id:n,retain:a},c=await r(e,Q,o,!0);if(!c.success)throw new i(s("error.failed_retain"),{request:o,response:c})}(e,t.frigate.client_id,n.getID(),a),n.setFavorite(a))}_buildInstanceToCameraIDMapFromQuery(e,t){const n=new Map;for(const a of t){const t=this._getQueryableCameraConfig(e,a),r=t?.frigate.client_id;r&&(n.has(r)||n.set(r,new Set),n.get(r)?.add(a))}return n}_getFrigateCameraNamesForCameraIDs(e,t){const n=new Set;for(const a of t){const t=this._getQueryableCameraConfig(e,a);t?.frigate.camera_name&&n.add(t.frigate.camera_name)}return n}async getEvents(e,t,n,a){const r=new Map,i=async(i,s)=>{if(!s||!s.size)return;const o={...n,cameraIDs:s},c=a?.useCache??1?this._requestCache.get(o):null;if(c)return void r.set(n,c);const g={instance_id:i,cameras:Array.from(this._getFrigateCameraNamesForCameraIDs(t,s)),...n.what&&{labels:Array.from(n.what)},...n.where&&{zones:Array.from(n.where)},...n.tags&&{sub_labels:Array.from(n.tags)},...n.end&&{before:Math.floor(n.end.getTime()/1e3)},...n.start&&{after:Math.floor(n.start.getTime()/1e3)},...n.limit&&{limit:n.limit},...n.hasClip&&{has_clip:n.hasClip},...n.hasSnapshot&&{has_snapshot:n.hasSnapshot},...n.favorite&&{favorites:n.favorite},limit:n?.limit??$},l={type:C.Event,engine:p.Frigate,instanceID:i,events:await L(e,g),expiry:v(new Date,{seconds:60}),cached:!1};(a?.useCache??1)&&this._requestCache.set(n,{...l,cached:!0},l.expiry),r.set(o,l)},s=this._buildInstanceToCameraIDMapFromQuery(t,n.cameraIDs);return await Promise.all(Array.from(s.keys()).map((e=>i(e,s.get(e))))),r.size?r:null}async getRecordings(e,t,n,a){const i=new Map,s=async(n,s)=>{const o={...n,cameraIDs:new Set([s])},c=a?.useCache??1?this._requestCache.get(o):null;if(c)return void i.set(o,c);const g=this._getQueryableCameraConfig(t,s);if(!g||!g.frigate.camera_name)return;const l=await(async(e,t,n)=>await r(e,U,{type:"frigate/recordings/summary",instance_id:t,camera:n,timezone:e.config.time_zone},!0))(e,g.frigate.client_id,g.frigate.camera_name);let u=[];for(const e of l??[])for(const t of e.hours){const n=v(e.day,{hours:t.hour}),a=x(n),r=H(n);(!o.start||a>=o.start)&&(!o.end||r<=o.end)&&u.push({cameraID:s,startTime:a,endTime:r,events:t.events})}void 0!==o.limit&&(u=S(u,(e=>e.startTime),"desc").slice(0,o.limit));const m={type:C.Recording,engine:p.Frigate,instanceID:g.frigate.client_id,recordings:u,expiry:v(new Date,{seconds:60}),cached:!1};(a?.useCache??1)&&this._requestCache.set(o,{...m,cached:!0},m.expiry),i.set(o,m)};return await Promise.all(Array.from(n.cameraIDs).map((e=>s(n,e)))),i.size?i:null}async getRecordingSegments(e,t,n,a){const i=new Map,s=async(n,s)=>{const o={...n,cameraIDs:new Set([s])},c=this._getQueryableCameraConfig(t,s);if(!c||!c.frigate.camera_name)return;const g={start:o.start,end:o.end},l=a?.useCache??1?this._recordingSegmentsCache.get(s,g):null;if(l)return void i.set(o,{type:C.RecordingSegments,engine:p.Frigate,instanceID:c.frigate.client_id,segments:l,cached:!0});const u={instance_id:c.frigate.client_id,camera:c.frigate.camera_name,after:Math.floor(o.start.getTime()/1e3),before:Math.floor(o.end.getTime()/1e3)},m=await(async(e,t)=>await r(e,W,{type:"frigate/recordings/get",...t},!0))(e,u);(a?.useCache??1)&&this._recordingSegmentsCache.add(s,g,m),i.set(o,{type:C.RecordingSegments,engine:p.Frigate,instanceID:c.frigate.client_id,segments:m,cached:!1})};return await Promise.all(Array.from(n.cameraIDs).map((e=>s(n,e)))),w((()=>this._throttledSegmentGarbageCollector(e,t))),i.size?i:null}_getCameraIDMatch(e,t,n,a){if(1===t.cameraIDs.size)return[...t.cameraIDs][0];for(const[t,r]of e.getCameraConfigEntries())if(r.frigate.client_id===n&&r.frigate.camera_name===a)return t;return null}generateMediaFromEvents(e,t,n,a){if(!Se.isFrigateEventQueryResults(a))return null;const r=[];for(const e of a.events){const i=this._getCameraIDMatch(t,n,a.instanceID,e.camera);if(!i)continue;const s=this._getQueryableCameraConfig(t,i);if(!s)continue;let o=null;if(n.hasClip||n.hasSnapshot||!e.has_clip&&!e.has_snapshot?n.hasSnapshot&&e.has_snapshot?o="snapshot":n.hasClip&&e.has_clip&&(o="clip"):o=e.has_clip?"clip":"snapshot",!o)continue;const c=Te.createEventViewMedia(o,i,s,e,e.sub_label?this._splitSubLabels(e.sub_label):void 0);c&&r.push(c)}return r}generateMediaFromRecordings(e,t,n,a){if(!Se.isFrigateRecordingQueryResults(a))return null;const r=[];for(const n of a.recordings){const a=this._getQueryableCameraConfig(t,n.cameraID);if(!a)continue;const i=Te.createRecordingViewMedia(n.cameraID,n,a,this.getCameraMetadata(e,a).title);i&&r.push(i)}return r}getQueryResultMaxAge(e){return e.type===b.Event||e.type===b.Recording?60:null}async getMediaSeekTime(e,t,n,a,r){const i=n.getStartTime(),s=n.getEndTime();if(!i||!s||as)return null;const o=n.getCameraID(),c={cameraIDs:new Set([o]),start:i,end:s,type:b.RecordingSegments},g=await this.getRecordingSegments(e,t,c,r);return g?this._getSeekTimeInSegments(i,a,Array.from(g.values())[0].segments):null}_getQueryableCameraConfig(e,t){const n=e.getCameraConfig(t);return!n||V(n)?null:n}_splitSubLabels(e){return e.split(",").map((e=>e.trim()))}async getMediaMetadata(e,t,n,a){const i=new Map;if((a?.useCache??1)&&this._requestCache.has(n)){const e=this._requestCache.get(n);if(e)return i.set(n,e),i}const s=new Set,o=new Set,c=new Set,g=new Set,l=this._buildInstanceToCameraIDMapFromQuery(t,n.cameraIDs),u=async(n,a)=>{const i=this._getFrigateCameraNamesForCameraIDs(t,a);for(const t of await(async(e,t)=>await r(e,k,{type:"frigate/events/summary",instance_id:t,timezone:e.config.time_zone},!0))(e,n))i.has(t.camera)&&(t.label&&s.add(t.label),t.zones.length&&t.zones.forEach(o.add,o),t.day&&c.add(t.day),t.sub_label&&this._splitSubLabels(t.sub_label).forEach(g.add,g))},m=async n=>{const r=await this.getRecordings(e,t,{type:b.Recording,cameraIDs:n},a);if(r)for(const e of r.values())if(Se.isFrigateRecordingQueryResults(e))for(const t of e.recordings)c.add(M(t.startTime))};await D([...l.entries()],(([e,t])=>(async()=>{await Promise.all([u(e,t),m(t)])})()));const d={type:C.MediaMetadata,engine:p.Frigate,metadata:{...s.size&&{what:s},...o.size&&{where:o},...c.size&&{days:c},...g.size&&{tags:g}},expiry:v(new Date,{seconds:60}),cached:!1};return(a?.useCache??1)&&this._requestCache.set(n,{...d,cached:!0},d.expiry),i.set(n,d),i}async _garbageCollectSegments(e,t){const n=this._recordingSegmentsCache.getCameraIDs(),a={cameraIDs:new Set(n),type:b.Recording},r=(e,t)=>`${e}/${t.getDate()}/${t.getHours()}`,i=await this.getRecordings(e,t,a);if(i)for(const[e,t]of i){if(!Se.isFrigateRecordingQueryResults(t))continue;const n=new Set;for(const e of t.recordings)n.add(r(e.cameraID,e.startTime));const a=Array.from(e.cameraIDs)[0];this._recordingSegmentsCache.expireMatches(a,(e=>{const t=r(a,j(e.start_time));return!n.has(t)}))}}_getSeekTimeInSegments(e,t,n){if(!n.length)return null;let a=0;for(const r of n){const n=j(r.start_time);if(n>t)break;const i=j(r.end_time),s=nt?t:i).getTime()-s.getTime()}return a/1e3}getMediaCapabilities(e){return{canFavorite:_.isEvent(e),canDownload:!0}}getCameraMetadata(e,t){const n=super.getCameraMetadata(e,t);return{title:t.title??T(e,t.camera_entity)??T(e,t.webrtc_card?.entity)??d(t.frigate?.camera_name)??t.id??"",icon:n.icon,engineLogo:I}}getCameraEndpoints(e,t){const n=(()=>{if(!e.frigate.url)return null;if(!e.frigate.camera_name)return{endpoint:e.frigate.url};const n=`${e.frigate.url}/cameras/`+e.frigate.camera_name;if("live"===t?.view)return{endpoint:n};const a=`${e.frigate.url}/events?camera=`+e.frigate.camera_name,r=`${e.frigate.url}/recording/`+e.frigate.camera_name;switch(t?.media?.getMediaType()){case"clip":case"snapshot":return{endpoint:a};case"recording":const e=t.media.getStartTime();if(e)return{endpoint:r+F(e,"yyyy-MM-dd/HH")}}switch(t?.view){case"clip":case"clips":case"snapshots":case"snapshot":return{endpoint:a};case"recording":case"recordings":return{endpoint:r}}return{endpoint:n}})(),a=E(e,{url:e.go2rtc?.url??`/api/frigate/${e.frigate.client_id}/mse`,stream:e.go2rtc?.stream??e.frigate.camera_name}),r={endpoint:`/api/frigate/${e.frigate.client_id}/jsmpeg/${e.frigate.camera_name}`,sign:!0},i=(()=>{const t=e.frigate.camera_name?e.frigate.camera_name:null;return t?{endpoint:t}:null})();return{...super.getCameraEndpoints(e,t),...n&&{ui:n},...a&&{go2rtc:a},...r&&{jsmpeg:r},...i&&{webrtcCard:i}}}async executePTZAction(e,t,n,a){const r=t.camera_entity;("preset"!==n||a?.preset)&&await e.callService("frigate","ptz",{entity_id:r,action:"stop"===a?.phase?"stop":"zoom_in"===n||"zoom_out"===n?"zoom":"preset"===n?"preset":"move",..."stop"!==a?.phase&&{argument:"zoom_in"===n?"in":"zoom_out"===n?"out":"preset"===n?a?.preset:n}})}}export{Me as FrigateCameraManagerEngine}; diff --git a/config/www/community/frigate-hass-card/engine-frigate-f675aa79.js.gz b/config/www/community/frigate-hass-card/engine-frigate-f675aa79.js.gz new file mode 100644 index 00000000..eed530c5 Binary files /dev/null and b/config/www/community/frigate-hass-card/engine-frigate-f675aa79.js.gz differ diff --git a/config/www/community/frigate-hass-card/engine-generic-31c14ad9.js b/config/www/community/frigate-hass-card/engine-generic-31c14ad9.js new file mode 100644 index 00000000..6879389a --- /dev/null +++ b/config/www/community/frigate-hass-card/engine-generic-31c14ad9.js @@ -0,0 +1 @@ +import{eB as e,eC as t,l as i,e7 as a,e6 as n,e5 as s,e3 as r,j as c,eD as l}from"./card-45855f1f.js";class o{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 u=(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 g{constructor(e,t){this._stateWatcher=e,this._eventCallback=t}getEngineType(){return a.Generic}async createCamera(e,t){return await new o(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:t?.icon??(i?l(e,i,"mdi:video"):"mdi:video")}}getMediaCapabilities(e){return null}getCameraEndpoints(e,t){const i=u(e);return i?{go2rtc:i}:null}async executePTZAction(e,t,i,a){}}var d=Object.freeze({__proto__:null,GenericCameraManagerEngine:g});export{o as C,g as G,d as e,u as g}; diff --git a/config/www/community/frigate-hass-card/engine-generic-31c14ad9.js.gz b/config/www/community/frigate-hass-card/engine-generic-31c14ad9.js.gz new file mode 100644 index 00000000..d257e726 Binary files /dev/null and b/config/www/community/frigate-hass-card/engine-generic-31c14ad9.js.gz differ diff --git a/config/www/community/frigate-hass-card/engine-generic-39deaa91.js b/config/www/community/frigate-hass-card/engine-generic-39deaa91.js new file mode 100644 index 00000000..4c590468 --- /dev/null +++ b/config/www/community/frigate-hass-card/engine-generic-39deaa91.js @@ -0,0 +1 @@ +import{ey as e,ez as t,l as i,e4 as a,e3 as n,e2 as s,e0 as r,j as c,eA as l}from"./card-320adb66.js";class o{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 u=(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 g{constructor(e,t){this._stateWatcher=e,this._eventCallback=t}getEngineType(){return a.Generic}async createCamera(e,t){return await new o(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:t?.icon??(i?l(e,i,"mdi:video"):"mdi:video")}}getMediaCapabilities(e){return null}getCameraEndpoints(e,t){const i=u(e);return i?{go2rtc:i}:null}async executePTZAction(e,t,i,a){}}var d=Object.freeze({__proto__:null,GenericCameraManagerEngine:g});export{o as C,g as G,d as e,u as g}; diff --git a/config/www/community/frigate-hass-card/engine-generic-39deaa91.js.gz b/config/www/community/frigate-hass-card/engine-generic-39deaa91.js.gz new file mode 100644 index 00000000..81c1261b Binary files /dev/null and b/config/www/community/frigate-hass-card/engine-generic-39deaa91.js.gz differ diff --git a/config/www/community/frigate-hass-card/engine-generic-458c9005.js b/config/www/community/frigate-hass-card/engine-generic-458c9005.js new file mode 100644 index 00000000..1245afbb --- /dev/null +++ b/config/www/community/frigate-hass-card/engine-generic-458c9005.js @@ -0,0 +1 @@ +import{eB as e,eC as t,l as i,e7 as a,e6 as n,e5 as s,e3 as r,j as c,eD as l}from"./card-09c4bade.js";class o{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 u=(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 g{constructor(e,t){this._stateWatcher=e,this._eventCallback=t}getEngineType(){return a.Generic}async createCamera(e,t){return await new o(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:t?.icon??(i?l(e,i,"mdi:video"):"mdi:video")}}getMediaCapabilities(e){return null}getCameraEndpoints(e,t){const i=u(e);return i?{go2rtc:i}:null}async executePTZAction(e,t,i,a){}}var d=Object.freeze({__proto__:null,GenericCameraManagerEngine:g});export{o as C,g as G,d as e,u as g}; diff --git a/config/www/community/frigate-hass-card/engine-generic-458c9005.js.gz b/config/www/community/frigate-hass-card/engine-generic-458c9005.js.gz new file mode 100644 index 00000000..628c42fc Binary files /dev/null and b/config/www/community/frigate-hass-card/engine-generic-458c9005.js.gz differ diff --git a/config/www/community/frigate-hass-card/engine-generic-96b32038.js b/config/www/community/frigate-hass-card/engine-generic-96b32038.js new file mode 100644 index 00000000..3230f56d --- /dev/null +++ b/config/www/community/frigate-hass-card/engine-generic-96b32038.js @@ -0,0 +1 @@ +import{eB as e,eC as t,l as i,e7 as a,e6 as n,e5 as s,e3 as r,j as c,eD as l}from"./card-7cd05290.js";class o{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 u=(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 g{constructor(e,t){this._stateWatcher=e,this._eventCallback=t}getEngineType(){return a.Generic}async createCamera(e,t){return await new o(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:t?.icon??(i?l(e,i,"mdi:video"):"mdi:video")}}getMediaCapabilities(e){return null}getCameraEndpoints(e,t){const i=u(e);return i?{go2rtc:i}:null}async executePTZAction(e,t,i,a){}}var d=Object.freeze({__proto__:null,GenericCameraManagerEngine:g});export{o as C,g as G,d as e,u as g}; diff --git a/config/www/community/frigate-hass-card/engine-generic-96b32038.js.gz b/config/www/community/frigate-hass-card/engine-generic-96b32038.js.gz new file mode 100644 index 00000000..962b738d Binary files /dev/null and b/config/www/community/frigate-hass-card/engine-generic-96b32038.js.gz differ diff --git a/config/www/community/frigate-hass-card/engine-generic-97fdd47e.js b/config/www/community/frigate-hass-card/engine-generic-97fdd47e.js new file mode 100644 index 00000000..e27b1523 --- /dev/null +++ b/config/www/community/frigate-hass-card/engine-generic-97fdd47e.js @@ -0,0 +1 @@ +import{eB as e,eC as t,l as i,e7 as a,e6 as n,e5 as s,e3 as r,j as c,eD as l}from"./card-769e2b91.js";class o{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 u=(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 g{constructor(e,t){this._stateWatcher=e,this._eventCallback=t}getEngineType(){return a.Generic}async createCamera(e,t){return await new o(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:t?.icon??(i?l(e,i,"mdi:video"):"mdi:video")}}getMediaCapabilities(e){return null}getCameraEndpoints(e,t){const i=u(e);return i?{go2rtc:i}:null}async executePTZAction(e,t,i,a){}}var d=Object.freeze({__proto__:null,GenericCameraManagerEngine:g});export{o as C,g as G,d as e,u as g}; diff --git a/config/www/community/frigate-hass-card/engine-generic-97fdd47e.js.gz b/config/www/community/frigate-hass-card/engine-generic-97fdd47e.js.gz new file mode 100644 index 00000000..d2ef2f8f Binary files /dev/null and b/config/www/community/frigate-hass-card/engine-generic-97fdd47e.js.gz differ diff --git a/config/www/community/frigate-hass-card/engine-generic-bb62ddef.js b/config/www/community/frigate-hass-card/engine-generic-bb62ddef.js new file mode 100644 index 00000000..7efc0bbe --- /dev/null +++ b/config/www/community/frigate-hass-card/engine-generic-bb62ddef.js @@ -0,0 +1 @@ +import{eB as e,eC as t,l as i,e7 as a,e6 as n,e5 as s,e3 as r,j as c,eD as l}from"./card-c642ee74.js";class o{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 u=(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 g{constructor(e,t){this._stateWatcher=e,this._eventCallback=t}getEngineType(){return a.Generic}async createCamera(e,t){return await new o(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:t?.icon??(i?l(e,i,"mdi:video"):"mdi:video")}}getMediaCapabilities(e){return null}getCameraEndpoints(e,t){const i=u(e);return i?{go2rtc:i}:null}async executePTZAction(e,t,i,a){}}var d=Object.freeze({__proto__:null,GenericCameraManagerEngine:g});export{o as C,g as G,d as e,u as g}; diff --git a/config/www/community/frigate-hass-card/engine-generic-bb62ddef.js.gz b/config/www/community/frigate-hass-card/engine-generic-bb62ddef.js.gz new file mode 100644 index 00000000..8abd426f Binary files /dev/null and b/config/www/community/frigate-hass-card/engine-generic-bb62ddef.js.gz differ diff --git a/config/www/community/frigate-hass-card/engine-motioneye-205f9ce6.js b/config/www/community/frigate-hass-card/engine-motioneye-205f9ce6.js new file mode 100644 index 00000000..4fd404ee --- /dev/null +++ b/config/www/community/frigate-hass-card/engine-motioneye-205f9ce6.js @@ -0,0 +1 @@ +import{e9 as e,e4 as t,e3 as a,e2 as s,ea as i,d0 as n,e6 as r,e7 as o,dN as c,eb as d,ec as m,ed as l,ee as h,d8 as u,da as y}from"./card-320adb66.js";import{B as g,a as p,g as _,i as M}from"./within-dates-c613e3cb.js";import{C as f}from"./engine-86b0096c.js";import{p as C}from"./parse-7f4a6e12.js";import{e as w}from"./endOfDay-086a6977.js";import"./engine-generic-39deaa91.js";import"./media-c9012082.js";class D extends g{getProxyConfig(){return{...super.getProxyConfig(),media:"auto"===this._config.proxy.media||this._config.proxy.media}}}class E{static isMotionEyeEventQueryResults(e){return e.engine===t.MotionEye&&e.type===o.Event}}const v={"%Y":"yyyy","%m":"MM","%d":"dd","%H":"HH","%M":"mm","%S":"ss"},x=new RegExp(/(%Y|%m|%d|%H|%M|%S)/g);class b extends p{constructor(){super(...arguments),this._directoryCache=new e,this._fileCache=new e}getEngineType(){return t.MotionEye}async createCamera(e,t){const i=new D(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(x,((e,t)=>v[t]))}_motionEyeMetadataGeneratorFile(e,t,a,s){let n=s?._metadata?.startDate??new Date;if(t){const e=a.title.replace(/\.[^/.]+$/,"");if(n=C(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=C(a.title,t,r);if(!i(e))return null;r=n(e)}return{cameraID:e,startDate:r,endDate:s?._metadata?.endDate??w(r)}}async _getMatchingDirectories(e,t,a,s,i){const n=t.getCamera(a),r=n?.getConfig();if(!(n instanceof g&&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)&&M(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 m=a.getCameraConfig(r);if(!m)return;const y=await this._getMatchingDirectories(e,a,r,c,i);if(!y||!y.length)return;const g=this._convertMotionEyeTimeFormatToDateFNS(m.motioneye.movies.file_pattern),p=this._convertMotionEyeTimeFormatToDateFNS(m.motioneye.images.file_pattern),_=c.limit??f,C=await this._browseMediaManager.walkBrowseMedias(e,[{targets:y,metadataGenerator:(e,t)=>e.media_class===l||e.media_class===h?this._motionEyeMetadataGeneratorFile(r,e.media_class===l?p:g,e,t):null,earlyExit:e=>e.length>=_,matcher:e=>!e.can_expand&&M(e,c.start,c.end)}],{...!1!==i?.useCache&&{cache:this._fileCache}}),w=u(C,(e=>e._metadata?.startDate),"desc").slice(0,c.limit??f),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 E.isMotionEyeEventQueryResults(s)?_(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(y(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),engineLogo:m}}getCameraEndpoints(e,t){const a=e.motioneye?.url?{endpoint:e.motioneye.url}:null;return{...super.getCameraEndpoints(e,t),...a&&{ui:a}}}}export{b as MotionEyeCameraManagerEngine}; diff --git a/config/www/community/frigate-hass-card/engine-motioneye-205f9ce6.js.gz b/config/www/community/frigate-hass-card/engine-motioneye-205f9ce6.js.gz new file mode 100644 index 00000000..1e859642 Binary files /dev/null and b/config/www/community/frigate-hass-card/engine-motioneye-205f9ce6.js.gz differ diff --git a/config/www/community/frigate-hass-card/engine-motioneye-3521f17f.js b/config/www/community/frigate-hass-card/engine-motioneye-3521f17f.js new file mode 100644 index 00000000..a1310cd3 --- /dev/null +++ b/config/www/community/frigate-hass-card/engine-motioneye-3521f17f.js @@ -0,0 +1 @@ +import{ec as e,e7 as t,e6 as a,e5 as s,ed as i,d4 as n,e9 as r,ea as o,dQ as c,ee as d,ef as m,eg as l,eh as h,dc as u,de as y}from"./card-09c4bade.js";import{B as g,a as p,g as _,i as M}from"./within-dates-cc9f8404.js";import{C as f}from"./engine-86b0096c.js";import{p as C}from"./parse-645a86cb.js";import{e as w}from"./endOfDay-8be4da1b.js";import"./engine-generic-458c9005.js";import"./media-c9012082.js";class D extends g{getProxyConfig(){return{...super.getProxyConfig(),media:"auto"===this._config.proxy.media||this._config.proxy.media}}}class E{static isMotionEyeEventQueryResults(e){return e.engine===t.MotionEye&&e.type===o.Event}}const v={"%Y":"yyyy","%m":"MM","%d":"dd","%H":"HH","%M":"mm","%S":"ss"},x=new RegExp(/(%Y|%m|%d|%H|%M|%S)/g);class b extends p{constructor(){super(...arguments),this._directoryCache=new e,this._fileCache=new e}getEngineType(){return t.MotionEye}async createCamera(e,t){const i=new D(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(x,((e,t)=>v[t]))}_motionEyeMetadataGeneratorFile(e,t,a,s){let n=s?._metadata?.startDate??new Date;if(t){const e=a.title.replace(/\.[^/.]+$/,"");if(n=C(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=C(a.title,t,r);if(!i(e))return null;r=n(e)}return{cameraID:e,startDate:r,endDate:s?._metadata?.endDate??w(r)}}async _getMatchingDirectories(e,t,a,s,i){const n=t.getCamera(a),r=n?.getConfig();if(!(n instanceof g&&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)&&M(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 m=a.getCameraConfig(r);if(!m)return;const y=await this._getMatchingDirectories(e,a,r,c,i);if(!y||!y.length)return;const g=this._convertMotionEyeTimeFormatToDateFNS(m.motioneye.movies.file_pattern),p=this._convertMotionEyeTimeFormatToDateFNS(m.motioneye.images.file_pattern),_=c.limit??f,C=await this._browseMediaManager.walkBrowseMedias(e,[{targets:y,metadataGenerator:(e,t)=>e.media_class===l||e.media_class===h?this._motionEyeMetadataGeneratorFile(r,e.media_class===l?p:g,e,t):null,earlyExit:e=>e.length>=_,matcher:e=>!e.can_expand&&M(e,c.start,c.end)}],{...!1!==i?.useCache&&{cache:this._fileCache}}),w=u(C,(e=>e._metadata?.startDate),"desc").slice(0,c.limit??f),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 E.isMotionEyeEventQueryResults(s)?_(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(y(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),engineLogo:m}}getCameraEndpoints(e,t){const a=e.motioneye?.url?{endpoint:e.motioneye.url}:null;return{...super.getCameraEndpoints(e,t),...a&&{ui:a}}}}export{b as MotionEyeCameraManagerEngine}; diff --git a/config/www/community/frigate-hass-card/engine-motioneye-3521f17f.js.gz b/config/www/community/frigate-hass-card/engine-motioneye-3521f17f.js.gz new file mode 100644 index 00000000..376fce21 Binary files /dev/null and b/config/www/community/frigate-hass-card/engine-motioneye-3521f17f.js.gz differ diff --git a/config/www/community/frigate-hass-card/engine-motioneye-381004ee.js b/config/www/community/frigate-hass-card/engine-motioneye-381004ee.js new file mode 100644 index 00000000..bcb4f70c --- /dev/null +++ b/config/www/community/frigate-hass-card/engine-motioneye-381004ee.js @@ -0,0 +1 @@ +import{ec as e,e7 as t,e6 as a,e5 as s,ed as i,d4 as n,e9 as r,ea as o,dQ as c,ee as d,ef as m,eg as l,eh as h,dc as u,de as y}from"./card-c642ee74.js";import{B as g,a as p,g as _,i as M}from"./within-dates-cc65dfa5.js";import{C as f}from"./engine-86b0096c.js";import{p as C}from"./parse-a53fb39b.js";import{e as w}from"./endOfDay-97ae2cc7.js";import"./engine-generic-bb62ddef.js";import"./media-c9012082.js";class D extends g{getProxyConfig(){return{...super.getProxyConfig(),media:"auto"===this._config.proxy.media||this._config.proxy.media}}}class E{static isMotionEyeEventQueryResults(e){return e.engine===t.MotionEye&&e.type===o.Event}}const v={"%Y":"yyyy","%m":"MM","%d":"dd","%H":"HH","%M":"mm","%S":"ss"},x=new RegExp(/(%Y|%m|%d|%H|%M|%S)/g);class b extends p{constructor(){super(...arguments),this._directoryCache=new e,this._fileCache=new e}getEngineType(){return t.MotionEye}async createCamera(e,t){const i=new D(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(x,((e,t)=>v[t]))}_motionEyeMetadataGeneratorFile(e,t,a,s){let n=s?._metadata?.startDate??new Date;if(t){const e=a.title.replace(/\.[^/.]+$/,"");if(n=C(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=C(a.title,t,r);if(!i(e))return null;r=n(e)}return{cameraID:e,startDate:r,endDate:s?._metadata?.endDate??w(r)}}async _getMatchingDirectories(e,t,a,s,i){const n=t.getCamera(a),r=n?.getConfig();if(!(n instanceof g&&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)&&M(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 m=a.getCameraConfig(r);if(!m)return;const y=await this._getMatchingDirectories(e,a,r,c,i);if(!y||!y.length)return;const g=this._convertMotionEyeTimeFormatToDateFNS(m.motioneye.movies.file_pattern),p=this._convertMotionEyeTimeFormatToDateFNS(m.motioneye.images.file_pattern),_=c.limit??f,C=await this._browseMediaManager.walkBrowseMedias(e,[{targets:y,metadataGenerator:(e,t)=>e.media_class===l||e.media_class===h?this._motionEyeMetadataGeneratorFile(r,e.media_class===l?p:g,e,t):null,earlyExit:e=>e.length>=_,matcher:e=>!e.can_expand&&M(e,c.start,c.end)}],{...!1!==i?.useCache&&{cache:this._fileCache}}),w=u(C,(e=>e._metadata?.startDate),"desc").slice(0,c.limit??f),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 E.isMotionEyeEventQueryResults(s)?_(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(y(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),engineLogo:m}}getCameraEndpoints(e,t){const a=e.motioneye?.url?{endpoint:e.motioneye.url}:null;return{...super.getCameraEndpoints(e,t),...a&&{ui:a}}}}export{b as MotionEyeCameraManagerEngine}; diff --git a/config/www/community/frigate-hass-card/engine-motioneye-381004ee.js.gz b/config/www/community/frigate-hass-card/engine-motioneye-381004ee.js.gz new file mode 100644 index 00000000..b92af387 Binary files /dev/null and b/config/www/community/frigate-hass-card/engine-motioneye-381004ee.js.gz differ diff --git a/config/www/community/frigate-hass-card/engine-motioneye-7a5554b3.js b/config/www/community/frigate-hass-card/engine-motioneye-7a5554b3.js new file mode 100644 index 00000000..f5f4a1d7 --- /dev/null +++ b/config/www/community/frigate-hass-card/engine-motioneye-7a5554b3.js @@ -0,0 +1 @@ +import{ec as e,e7 as t,e6 as a,e5 as s,ed as i,d4 as n,e9 as r,ea as o,dQ as c,ee as d,ef as m,eg as l,eh as h,dc as u,de as y}from"./card-769e2b91.js";import{B as g,a as p,g as _,i as M}from"./within-dates-a146acf5.js";import{C as f}from"./engine-86b0096c.js";import{p as C}from"./parse-7dfc1897.js";import{e as w}from"./endOfDay-696ac7f4.js";import"./engine-generic-97fdd47e.js";import"./media-c9012082.js";class D extends g{getProxyConfig(){return{...super.getProxyConfig(),media:"auto"===this._config.proxy.media||this._config.proxy.media}}}class E{static isMotionEyeEventQueryResults(e){return e.engine===t.MotionEye&&e.type===o.Event}}const v={"%Y":"yyyy","%m":"MM","%d":"dd","%H":"HH","%M":"mm","%S":"ss"},x=new RegExp(/(%Y|%m|%d|%H|%M|%S)/g);class b extends p{constructor(){super(...arguments),this._directoryCache=new e,this._fileCache=new e}getEngineType(){return t.MotionEye}async createCamera(e,t){const i=new D(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(x,((e,t)=>v[t]))}_motionEyeMetadataGeneratorFile(e,t,a,s){let n=s?._metadata?.startDate??new Date;if(t){const e=a.title.replace(/\.[^/.]+$/,"");if(n=C(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=C(a.title,t,r);if(!i(e))return null;r=n(e)}return{cameraID:e,startDate:r,endDate:s?._metadata?.endDate??w(r)}}async _getMatchingDirectories(e,t,a,s,i){const n=t.getCamera(a),r=n?.getConfig();if(!(n instanceof g&&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)&&M(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 m=a.getCameraConfig(r);if(!m)return;const y=await this._getMatchingDirectories(e,a,r,c,i);if(!y||!y.length)return;const g=this._convertMotionEyeTimeFormatToDateFNS(m.motioneye.movies.file_pattern),p=this._convertMotionEyeTimeFormatToDateFNS(m.motioneye.images.file_pattern),_=c.limit??f,C=await this._browseMediaManager.walkBrowseMedias(e,[{targets:y,metadataGenerator:(e,t)=>e.media_class===l||e.media_class===h?this._motionEyeMetadataGeneratorFile(r,e.media_class===l?p:g,e,t):null,earlyExit:e=>e.length>=_,matcher:e=>!e.can_expand&&M(e,c.start,c.end)}],{...!1!==i?.useCache&&{cache:this._fileCache}}),w=u(C,(e=>e._metadata?.startDate),"desc").slice(0,c.limit??f),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 E.isMotionEyeEventQueryResults(s)?_(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(y(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),engineLogo:m}}getCameraEndpoints(e,t){const a=e.motioneye?.url?{endpoint:e.motioneye.url}:null;return{...super.getCameraEndpoints(e,t),...a&&{ui:a}}}}export{b as MotionEyeCameraManagerEngine}; diff --git a/config/www/community/frigate-hass-card/engine-motioneye-7a5554b3.js.gz b/config/www/community/frigate-hass-card/engine-motioneye-7a5554b3.js.gz new file mode 100644 index 00000000..36b579b9 Binary files /dev/null and b/config/www/community/frigate-hass-card/engine-motioneye-7a5554b3.js.gz differ diff --git a/config/www/community/frigate-hass-card/engine-motioneye-d04d1919.js b/config/www/community/frigate-hass-card/engine-motioneye-d04d1919.js new file mode 100644 index 00000000..fe2becc3 --- /dev/null +++ b/config/www/community/frigate-hass-card/engine-motioneye-d04d1919.js @@ -0,0 +1 @@ +import{ec as e,e7 as t,e6 as a,e5 as s,ed as i,d4 as n,e9 as r,ea as o,dQ as c,ee as d,ef as m,eg as l,eh as h,dc as u,de as y}from"./card-7cd05290.js";import{B as g,a as p,g as _,i as M}from"./within-dates-2bb98b10.js";import{C as f}from"./engine-86b0096c.js";import{p as C}from"./parse-feacefaa.js";import{e as w}from"./endOfDay-0c5086cb.js";import"./engine-generic-96b32038.js";import"./media-c9012082.js";class D extends g{getProxyConfig(){return{...super.getProxyConfig(),media:"auto"===this._config.proxy.media||this._config.proxy.media}}}class E{static isMotionEyeEventQueryResults(e){return e.engine===t.MotionEye&&e.type===o.Event}}const v={"%Y":"yyyy","%m":"MM","%d":"dd","%H":"HH","%M":"mm","%S":"ss"},x=new RegExp(/(%Y|%m|%d|%H|%M|%S)/g);class b extends p{constructor(){super(...arguments),this._directoryCache=new e,this._fileCache=new e}getEngineType(){return t.MotionEye}async createCamera(e,t){const i=new D(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(x,((e,t)=>v[t]))}_motionEyeMetadataGeneratorFile(e,t,a,s){let n=s?._metadata?.startDate??new Date;if(t){const e=a.title.replace(/\.[^/.]+$/,"");if(n=C(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=C(a.title,t,r);if(!i(e))return null;r=n(e)}return{cameraID:e,startDate:r,endDate:s?._metadata?.endDate??w(r)}}async _getMatchingDirectories(e,t,a,s,i){const n=t.getCamera(a),r=n?.getConfig();if(!(n instanceof g&&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)&&M(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 m=a.getCameraConfig(r);if(!m)return;const y=await this._getMatchingDirectories(e,a,r,c,i);if(!y||!y.length)return;const g=this._convertMotionEyeTimeFormatToDateFNS(m.motioneye.movies.file_pattern),p=this._convertMotionEyeTimeFormatToDateFNS(m.motioneye.images.file_pattern),_=c.limit??f,C=await this._browseMediaManager.walkBrowseMedias(e,[{targets:y,metadataGenerator:(e,t)=>e.media_class===l||e.media_class===h?this._motionEyeMetadataGeneratorFile(r,e.media_class===l?p:g,e,t):null,earlyExit:e=>e.length>=_,matcher:e=>!e.can_expand&&M(e,c.start,c.end)}],{...!1!==i?.useCache&&{cache:this._fileCache}}),w=u(C,(e=>e._metadata?.startDate),"desc").slice(0,c.limit??f),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 E.isMotionEyeEventQueryResults(s)?_(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(y(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),engineLogo:m}}getCameraEndpoints(e,t){const a=e.motioneye?.url?{endpoint:e.motioneye.url}:null;return{...super.getCameraEndpoints(e,t),...a&&{ui:a}}}}export{b as MotionEyeCameraManagerEngine}; diff --git a/config/www/community/frigate-hass-card/engine-motioneye-d04d1919.js.gz b/config/www/community/frigate-hass-card/engine-motioneye-d04d1919.js.gz new file mode 100644 index 00000000..de7f7d55 Binary files /dev/null and b/config/www/community/frigate-hass-card/engine-motioneye-d04d1919.js.gz differ diff --git a/config/www/community/frigate-hass-card/engine-motioneye-fa799851.js b/config/www/community/frigate-hass-card/engine-motioneye-fa799851.js new file mode 100644 index 00000000..06f83c89 --- /dev/null +++ b/config/www/community/frigate-hass-card/engine-motioneye-fa799851.js @@ -0,0 +1 @@ +import{ec as e,e7 as t,e6 as a,e5 as s,ed as i,d4 as n,e9 as r,ea as o,dQ as c,ee as d,ef as m,eg as l,eh as h,dc as u,de as y}from"./card-45855f1f.js";import{B as g,a as p,g as _,i as M}from"./within-dates-a663657f.js";import{C as f}from"./engine-86b0096c.js";import{p as C}from"./parse-114e8d53.js";import{e as w}from"./endOfDay-24d35e3f.js";import"./engine-generic-31c14ad9.js";import"./media-c9012082.js";class D extends g{getProxyConfig(){return{...super.getProxyConfig(),media:"auto"===this._config.proxy.media||this._config.proxy.media}}}class E{static isMotionEyeEventQueryResults(e){return e.engine===t.MotionEye&&e.type===o.Event}}const v={"%Y":"yyyy","%m":"MM","%d":"dd","%H":"HH","%M":"mm","%S":"ss"},x=new RegExp(/(%Y|%m|%d|%H|%M|%S)/g);class b extends p{constructor(){super(...arguments),this._directoryCache=new e,this._fileCache=new e}getEngineType(){return t.MotionEye}async createCamera(e,t){const i=new D(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(x,((e,t)=>v[t]))}_motionEyeMetadataGeneratorFile(e,t,a,s){let n=s?._metadata?.startDate??new Date;if(t){const e=a.title.replace(/\.[^/.]+$/,"");if(n=C(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=C(a.title,t,r);if(!i(e))return null;r=n(e)}return{cameraID:e,startDate:r,endDate:s?._metadata?.endDate??w(r)}}async _getMatchingDirectories(e,t,a,s,i){const n=t.getCamera(a),r=n?.getConfig();if(!(n instanceof g&&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)&&M(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 m=a.getCameraConfig(r);if(!m)return;const y=await this._getMatchingDirectories(e,a,r,c,i);if(!y||!y.length)return;const g=this._convertMotionEyeTimeFormatToDateFNS(m.motioneye.movies.file_pattern),p=this._convertMotionEyeTimeFormatToDateFNS(m.motioneye.images.file_pattern),_=c.limit??f,C=await this._browseMediaManager.walkBrowseMedias(e,[{targets:y,metadataGenerator:(e,t)=>e.media_class===l||e.media_class===h?this._motionEyeMetadataGeneratorFile(r,e.media_class===l?p:g,e,t):null,earlyExit:e=>e.length>=_,matcher:e=>!e.can_expand&&M(e,c.start,c.end)}],{...!1!==i?.useCache&&{cache:this._fileCache}}),w=u(C,(e=>e._metadata?.startDate),"desc").slice(0,c.limit??f),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 E.isMotionEyeEventQueryResults(s)?_(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(y(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),engineLogo:m}}getCameraEndpoints(e,t){const a=e.motioneye?.url?{endpoint:e.motioneye.url}:null;return{...super.getCameraEndpoints(e,t),...a&&{ui:a}}}}export{b as MotionEyeCameraManagerEngine}; diff --git a/config/www/community/frigate-hass-card/engine-motioneye-fa799851.js.gz b/config/www/community/frigate-hass-card/engine-motioneye-fa799851.js.gz new file mode 100644 index 00000000..86daea4e Binary files /dev/null and b/config/www/community/frigate-hass-card/engine-motioneye-fa799851.js.gz differ diff --git a/config/www/community/frigate-hass-card/engine-reolink-0f6e3569.js b/config/www/community/frigate-hass-card/engine-reolink-0f6e3569.js new file mode 100644 index 00000000..33d09684 --- /dev/null +++ b/config/www/community/frigate-hass-card/engine-reolink-0f6e3569.js @@ -0,0 +1,8 @@ +import{l as e,e1 as t,e9 as a,e4 as n,ee as s,ea as i,dN as r,d0 as o,e3 as c,e2 as l,ef as u,e6 as h,e7 as d,eb as g,eg as m,d8 as _,da as p}from"./card-320adb66.js";import{B as y,a as f,i as w,g as C}from"./within-dates-c613e3cb.js";import{C as M}from"./engine-86b0096c.js";import{p as D}from"./parse-7f4a6e12.js";import{e as k}from"./endOfDay-086a6977.js";import"./engine-generic-39deaa91.js";import"./media-c9012082.js";class b extends t{}class x extends y{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(/(.*)_(?\d+)/):null,n=a&&a.groups?.channel?Number(a.groups.channel):null;if(null===n)throw new b(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 v{static isReolinkEventQueryResults(e){return e.engine===n.Reolink&&e.type===d.Event}}class E extends f{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=D(n[0],"HH:mm:ss",a._metadata.startDate);if(!i(o))return null;const c=n[1].match(/(?\d+):(?\d+):(?\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=D(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\|(?.+)\|(?\d+)$/);return t?.groups?{configEntryID:t.groups.configEntryID,channel:Number(t.groups.channel)}:null}async createCamera(e,t){const a=new x(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&&w(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 x?await this._getMatchingDirectories(e,l,o,s):null,g=o.limit??M;let m=[];h?.length&&(m=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&&w(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 v.isReolinkEventQueryResults(n)?C(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 x))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(p(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),engineLogo:m}}getCameraEndpoints(e,t){const a=e.reolink?.url?{endpoint:e.reolink.url}:null;return{...super.getCameraEndpoints(e,t),...a&&{ui:a}}}}export{E as ReolinkCameraManagerEngine,v as ReolinkQueryResultsClassifier}; diff --git a/config/www/community/frigate-hass-card/engine-reolink-0f6e3569.js.gz b/config/www/community/frigate-hass-card/engine-reolink-0f6e3569.js.gz new file mode 100644 index 00000000..4da118d6 Binary files /dev/null and b/config/www/community/frigate-hass-card/engine-reolink-0f6e3569.js.gz differ diff --git a/config/www/community/frigate-hass-card/engine-reolink-13b9bf20.js b/config/www/community/frigate-hass-card/engine-reolink-13b9bf20.js new file mode 100644 index 00000000..0ad07d20 --- /dev/null +++ b/config/www/community/frigate-hass-card/engine-reolink-13b9bf20.js @@ -0,0 +1,8 @@ +import{l as e,e4 as t,ec as a,e7 as s,eh as n,ed as i,dQ as r,d4 as o,e6 as c,e5 as l,ei as u,e9 as h,ea as d,ee as g,ej as m,dc as p,de as _}from"./card-769e2b91.js";import{B as y,a as f,i as C,g as w}from"./within-dates-a146acf5.js";import{C as M}from"./engine-86b0096c.js";import{p as D}from"./parse-7dfc1897.js";import{e as x}from"./endOfDay-696ac7f4.js";import"./engine-generic-97fdd47e.js";import"./media-c9012082.js";class k extends t{}class b extends y{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(/(.*)_(?\d+)/):null,s=a&&a.groups?.channel?Number(a.groups.channel):null;if(null===s)throw new k(e("error.camera_initialization_reolink"),this.getConfig());this._channel=s}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 v{static isReolinkEventQueryResults(e){return e.engine===s.Reolink&&e.type===d.Event}}class E extends f{constructor(){super(...arguments),this._directoryCache=new a,this._fileCache=new a}getEngineType(){return s.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!==n)return null;const s=t.title.split(/ +/);if(2!==s.length)return null;const o=D(s[0],"HH:mm:ss",a._metadata.startDate);if(!i(o))return null;const c=s[1].match(/(?\d+):(?\d+):(?\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=D(t.title,"yyyy/M/d",new Date);return i(a)?{cameraID:e,startDate:o(a),endDate:x(a)}: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,s){const n=t.getConfig(),i=t.getEntity(),r=i?.config_entry_id;return null!==t.getChannel()&&r?await this._browseMediaManager.walkBrowseMedias(e,[{targets:[`media-source://reolink/RES|${r}|${t.getChannel()}|`+("low"===n.reolink?.media_resolution?"sub":"main")],concurrency:1/0,metadataGenerator:(e,a)=>this._reolinkDirectoryMetadataGenerator(t.getID(),e),matcher:e=>e.can_expand&&C(e,a?.start,a?.end),sorter:e=>u(e)}],{...!1!==s?.useCache&&{cache:this._directoryCache}}):null}async getEvents(e,t,a,n){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=n?.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,n):null,g=o.limit??M;let m=[];h?.length&&(m=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&&C(e,o.start,o.end),sorter:e=>u(e)}],{...!1!==n?.useCache&&{cache:this._fileCache}}));const _=p(m,(e=>e._metadata?.startDate),"desc").slice(0,g),y={type:d.Event,engine:s.Reolink,browseMedia:_};(n?.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,s){return v.isReolinkEventQueryResults(s)?w(s.browseMedia):null}async getMediaMetadata(e,t,a,n){const i=new Map,o=n?.useCache??1?this._requestCache.get(a):null;if(o)return i.set(a,o),i;const c=new Set,l=async a=>{const s=t.getCamera(a);if(!(s&&s instanceof b))return;const i=await this._getMatchingDirectories(e,s,null,n);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:s.Reolink,metadata:{...c.size&&{days:c}},expiry:r(new Date,{seconds:g}),cached:!1};return(n?.useCache??1)&&this._requestCache.set(a,{...u,cached:!0},u.expiry),i.set(a,u),i}getCameraMetadata(e,t){return{...super.getCameraMetadata(e,t),engineLogo:m}}getCameraEndpoints(e,t){const a=e.reolink?.url?{endpoint:e.reolink.url}:null;return{...super.getCameraEndpoints(e,t),...a&&{ui:a}}}}export{E as ReolinkCameraManagerEngine,v as ReolinkQueryResultsClassifier}; diff --git a/config/www/community/frigate-hass-card/engine-reolink-13b9bf20.js.gz b/config/www/community/frigate-hass-card/engine-reolink-13b9bf20.js.gz new file mode 100644 index 00000000..c128f644 Binary files /dev/null and b/config/www/community/frigate-hass-card/engine-reolink-13b9bf20.js.gz differ diff --git a/config/www/community/frigate-hass-card/engine-reolink-5d642010.js b/config/www/community/frigate-hass-card/engine-reolink-5d642010.js new file mode 100644 index 00000000..fffc8d96 --- /dev/null +++ b/config/www/community/frigate-hass-card/engine-reolink-5d642010.js @@ -0,0 +1,8 @@ +import{l as e,e4 as t,ec as a,e7 as s,eh as n,ed as i,dQ as r,d4 as o,e6 as c,e5 as l,ei as u,e9 as h,ea as d,ee as g,ej as m,dc as p,de as _}from"./card-45855f1f.js";import{B as y,a as f,i as C,g as w}from"./within-dates-a663657f.js";import{C as M}from"./engine-86b0096c.js";import{p as D}from"./parse-114e8d53.js";import{e as x}from"./endOfDay-24d35e3f.js";import"./engine-generic-31c14ad9.js";import"./media-c9012082.js";class k extends t{}class b extends y{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(/(.*)_(?\d+)/):null,s=a&&a.groups?.channel?Number(a.groups.channel):null;if(null===s)throw new k(e("error.camera_initialization_reolink"),this.getConfig());this._channel=s}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 v{static isReolinkEventQueryResults(e){return e.engine===s.Reolink&&e.type===d.Event}}class E extends f{constructor(){super(...arguments),this._directoryCache=new a,this._fileCache=new a}getEngineType(){return s.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!==n)return null;const s=t.title.split(/ +/);if(2!==s.length)return null;const o=D(s[0],"HH:mm:ss",a._metadata.startDate);if(!i(o))return null;const c=s[1].match(/(?\d+):(?\d+):(?\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=D(t.title,"yyyy/M/d",new Date);return i(a)?{cameraID:e,startDate:o(a),endDate:x(a)}: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,s){const n=t.getConfig(),i=t.getEntity(),r=i?.config_entry_id;return null!==t.getChannel()&&r?await this._browseMediaManager.walkBrowseMedias(e,[{targets:[`media-source://reolink/RES|${r}|${t.getChannel()}|`+("low"===n.reolink?.media_resolution?"sub":"main")],concurrency:1/0,metadataGenerator:(e,a)=>this._reolinkDirectoryMetadataGenerator(t.getID(),e),matcher:e=>e.can_expand&&C(e,a?.start,a?.end),sorter:e=>u(e)}],{...!1!==s?.useCache&&{cache:this._directoryCache}}):null}async getEvents(e,t,a,n){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=n?.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,n):null,g=o.limit??M;let m=[];h?.length&&(m=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&&C(e,o.start,o.end),sorter:e=>u(e)}],{...!1!==n?.useCache&&{cache:this._fileCache}}));const _=p(m,(e=>e._metadata?.startDate),"desc").slice(0,g),y={type:d.Event,engine:s.Reolink,browseMedia:_};(n?.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,s){return v.isReolinkEventQueryResults(s)?w(s.browseMedia):null}async getMediaMetadata(e,t,a,n){const i=new Map,o=n?.useCache??1?this._requestCache.get(a):null;if(o)return i.set(a,o),i;const c=new Set,l=async a=>{const s=t.getCamera(a);if(!(s&&s instanceof b))return;const i=await this._getMatchingDirectories(e,s,null,n);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:s.Reolink,metadata:{...c.size&&{days:c}},expiry:r(new Date,{seconds:g}),cached:!1};return(n?.useCache??1)&&this._requestCache.set(a,{...u,cached:!0},u.expiry),i.set(a,u),i}getCameraMetadata(e,t){return{...super.getCameraMetadata(e,t),engineLogo:m}}getCameraEndpoints(e,t){const a=e.reolink?.url?{endpoint:e.reolink.url}:null;return{...super.getCameraEndpoints(e,t),...a&&{ui:a}}}}export{E as ReolinkCameraManagerEngine,v as ReolinkQueryResultsClassifier}; diff --git a/config/www/community/frigate-hass-card/engine-reolink-5d642010.js.gz b/config/www/community/frigate-hass-card/engine-reolink-5d642010.js.gz new file mode 100644 index 00000000..513f1b5d Binary files /dev/null and b/config/www/community/frigate-hass-card/engine-reolink-5d642010.js.gz differ diff --git a/config/www/community/frigate-hass-card/engine-reolink-72a91bc6.js b/config/www/community/frigate-hass-card/engine-reolink-72a91bc6.js new file mode 100644 index 00000000..fcd97707 --- /dev/null +++ b/config/www/community/frigate-hass-card/engine-reolink-72a91bc6.js @@ -0,0 +1,8 @@ +import{l as e,e4 as t,ec as a,e7 as s,eh as n,ed as i,dQ as r,d4 as o,e6 as c,e5 as l,ei as u,e9 as h,ea as d,ee as g,ej as m,dc as p,de as _}from"./card-c642ee74.js";import{B as y,a as f,i as C,g as w}from"./within-dates-cc65dfa5.js";import{C as M}from"./engine-86b0096c.js";import{p as D}from"./parse-a53fb39b.js";import{e as x}from"./endOfDay-97ae2cc7.js";import"./engine-generic-bb62ddef.js";import"./media-c9012082.js";class k extends t{}class b extends y{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(/(.*)_(?\d+)/):null,s=a&&a.groups?.channel?Number(a.groups.channel):null;if(null===s)throw new k(e("error.camera_initialization_reolink"),this.getConfig());this._channel=s}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 v{static isReolinkEventQueryResults(e){return e.engine===s.Reolink&&e.type===d.Event}}class E extends f{constructor(){super(...arguments),this._directoryCache=new a,this._fileCache=new a}getEngineType(){return s.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!==n)return null;const s=t.title.split(/ +/);if(2!==s.length)return null;const o=D(s[0],"HH:mm:ss",a._metadata.startDate);if(!i(o))return null;const c=s[1].match(/(?\d+):(?\d+):(?\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=D(t.title,"yyyy/M/d",new Date);return i(a)?{cameraID:e,startDate:o(a),endDate:x(a)}: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,s){const n=t.getConfig(),i=t.getEntity(),r=i?.config_entry_id;return null!==t.getChannel()&&r?await this._browseMediaManager.walkBrowseMedias(e,[{targets:[`media-source://reolink/RES|${r}|${t.getChannel()}|`+("low"===n.reolink?.media_resolution?"sub":"main")],concurrency:1/0,metadataGenerator:(e,a)=>this._reolinkDirectoryMetadataGenerator(t.getID(),e),matcher:e=>e.can_expand&&C(e,a?.start,a?.end),sorter:e=>u(e)}],{...!1!==s?.useCache&&{cache:this._directoryCache}}):null}async getEvents(e,t,a,n){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=n?.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,n):null,g=o.limit??M;let m=[];h?.length&&(m=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&&C(e,o.start,o.end),sorter:e=>u(e)}],{...!1!==n?.useCache&&{cache:this._fileCache}}));const _=p(m,(e=>e._metadata?.startDate),"desc").slice(0,g),y={type:d.Event,engine:s.Reolink,browseMedia:_};(n?.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,s){return v.isReolinkEventQueryResults(s)?w(s.browseMedia):null}async getMediaMetadata(e,t,a,n){const i=new Map,o=n?.useCache??1?this._requestCache.get(a):null;if(o)return i.set(a,o),i;const c=new Set,l=async a=>{const s=t.getCamera(a);if(!(s&&s instanceof b))return;const i=await this._getMatchingDirectories(e,s,null,n);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:s.Reolink,metadata:{...c.size&&{days:c}},expiry:r(new Date,{seconds:g}),cached:!1};return(n?.useCache??1)&&this._requestCache.set(a,{...u,cached:!0},u.expiry),i.set(a,u),i}getCameraMetadata(e,t){return{...super.getCameraMetadata(e,t),engineLogo:m}}getCameraEndpoints(e,t){const a=e.reolink?.url?{endpoint:e.reolink.url}:null;return{...super.getCameraEndpoints(e,t),...a&&{ui:a}}}}export{E as ReolinkCameraManagerEngine,v as ReolinkQueryResultsClassifier}; diff --git a/config/www/community/frigate-hass-card/engine-reolink-72a91bc6.js.gz b/config/www/community/frigate-hass-card/engine-reolink-72a91bc6.js.gz new file mode 100644 index 00000000..d8c7ee4a Binary files /dev/null and b/config/www/community/frigate-hass-card/engine-reolink-72a91bc6.js.gz differ diff --git a/config/www/community/frigate-hass-card/engine-reolink-c0a1587c.js b/config/www/community/frigate-hass-card/engine-reolink-c0a1587c.js new file mode 100644 index 00000000..79333c81 --- /dev/null +++ b/config/www/community/frigate-hass-card/engine-reolink-c0a1587c.js @@ -0,0 +1,8 @@ +import{l as e,e4 as t,ec as a,e7 as n,eh as s,ed as i,dQ as r,d4 as o,e6 as c,e5 as l,ei as u,e9 as h,ea as d,ee as g,ej as m,dc as _,de as p}from"./card-09c4bade.js";import{B as y,a as f,i as w,g as C}from"./within-dates-cc9f8404.js";import{C as M}from"./engine-86b0096c.js";import{p as D}from"./parse-645a86cb.js";import{e as k}from"./endOfDay-8be4da1b.js";import"./engine-generic-458c9005.js";import"./media-c9012082.js";class b extends t{}class x extends y{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(/(.*)_(?\d+)/):null,n=a&&a.groups?.channel?Number(a.groups.channel):null;if(null===n)throw new b(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 v{static isReolinkEventQueryResults(e){return e.engine===n.Reolink&&e.type===d.Event}}class E extends f{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=D(n[0],"HH:mm:ss",a._metadata.startDate);if(!i(o))return null;const c=n[1].match(/(?\d+):(?\d+):(?\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=D(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\|(?.+)\|(?\d+)$/);return t?.groups?{configEntryID:t.groups.configEntryID,channel:Number(t.groups.channel)}:null}async createCamera(e,t){const a=new x(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&&w(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 x?await this._getMatchingDirectories(e,l,o,s):null,g=o.limit??M;let m=[];h?.length&&(m=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&&w(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 v.isReolinkEventQueryResults(n)?C(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 x))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(p(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),engineLogo:m}}getCameraEndpoints(e,t){const a=e.reolink?.url?{endpoint:e.reolink.url}:null;return{...super.getCameraEndpoints(e,t),...a&&{ui:a}}}}export{E as ReolinkCameraManagerEngine,v as ReolinkQueryResultsClassifier}; diff --git a/config/www/community/frigate-hass-card/engine-reolink-c0a1587c.js.gz b/config/www/community/frigate-hass-card/engine-reolink-c0a1587c.js.gz new file mode 100644 index 00000000..ac49fbe0 Binary files /dev/null and b/config/www/community/frigate-hass-card/engine-reolink-c0a1587c.js.gz differ diff --git a/config/www/community/frigate-hass-card/engine-reolink-ec1b4246.js b/config/www/community/frigate-hass-card/engine-reolink-ec1b4246.js new file mode 100644 index 00000000..b8f098fc --- /dev/null +++ b/config/www/community/frigate-hass-card/engine-reolink-ec1b4246.js @@ -0,0 +1,8 @@ +import{l as e,e4 as t,ec as a,e7 as s,eh as n,ed as i,dQ as r,d4 as o,e6 as c,e5 as l,ei as u,e9 as h,ea as d,ee as g,ej as m,dc as p,de as _}from"./card-7cd05290.js";import{B as y,a as f,i as C,g as w}from"./within-dates-2bb98b10.js";import{C as M}from"./engine-86b0096c.js";import{p as D}from"./parse-feacefaa.js";import{e as x}from"./endOfDay-0c5086cb.js";import"./engine-generic-96b32038.js";import"./media-c9012082.js";class k extends t{}class b extends y{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(/(.*)_(?\d+)/):null,s=a&&a.groups?.channel?Number(a.groups.channel):null;if(null===s)throw new k(e("error.camera_initialization_reolink"),this.getConfig());this._channel=s}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 v{static isReolinkEventQueryResults(e){return e.engine===s.Reolink&&e.type===d.Event}}class E extends f{constructor(){super(...arguments),this._directoryCache=new a,this._fileCache=new a}getEngineType(){return s.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!==n)return null;const s=t.title.split(/ +/);if(2!==s.length)return null;const o=D(s[0],"HH:mm:ss",a._metadata.startDate);if(!i(o))return null;const c=s[1].match(/(?\d+):(?\d+):(?\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=D(t.title,"yyyy/M/d",new Date);return i(a)?{cameraID:e,startDate:o(a),endDate:x(a)}: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,s){const n=t.getConfig(),i=t.getEntity(),r=i?.config_entry_id;return null!==t.getChannel()&&r?await this._browseMediaManager.walkBrowseMedias(e,[{targets:[`media-source://reolink/RES|${r}|${t.getChannel()}|`+("low"===n.reolink?.media_resolution?"sub":"main")],concurrency:1/0,metadataGenerator:(e,a)=>this._reolinkDirectoryMetadataGenerator(t.getID(),e),matcher:e=>e.can_expand&&C(e,a?.start,a?.end),sorter:e=>u(e)}],{...!1!==s?.useCache&&{cache:this._directoryCache}}):null}async getEvents(e,t,a,n){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=n?.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,n):null,g=o.limit??M;let m=[];h?.length&&(m=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&&C(e,o.start,o.end),sorter:e=>u(e)}],{...!1!==n?.useCache&&{cache:this._fileCache}}));const _=p(m,(e=>e._metadata?.startDate),"desc").slice(0,g),y={type:d.Event,engine:s.Reolink,browseMedia:_};(n?.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,s){return v.isReolinkEventQueryResults(s)?w(s.browseMedia):null}async getMediaMetadata(e,t,a,n){const i=new Map,o=n?.useCache??1?this._requestCache.get(a):null;if(o)return i.set(a,o),i;const c=new Set,l=async a=>{const s=t.getCamera(a);if(!(s&&s instanceof b))return;const i=await this._getMatchingDirectories(e,s,null,n);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:s.Reolink,metadata:{...c.size&&{days:c}},expiry:r(new Date,{seconds:g}),cached:!1};return(n?.useCache??1)&&this._requestCache.set(a,{...u,cached:!0},u.expiry),i.set(a,u),i}getCameraMetadata(e,t){return{...super.getCameraMetadata(e,t),engineLogo:m}}getCameraEndpoints(e,t){const a=e.reolink?.url?{endpoint:e.reolink.url}:null;return{...super.getCameraEndpoints(e,t),...a&&{ui:a}}}}export{E as ReolinkCameraManagerEngine,v as ReolinkQueryResultsClassifier}; diff --git a/config/www/community/frigate-hass-card/engine-reolink-ec1b4246.js.gz b/config/www/community/frigate-hass-card/engine-reolink-ec1b4246.js.gz new file mode 100644 index 00000000..7300b731 Binary files /dev/null and b/config/www/community/frigate-hass-card/engine-reolink-ec1b4246.js.gz differ diff --git a/config/www/community/frigate-hass-card/frigate-hass-card.js b/config/www/community/frigate-hass-card/frigate-hass-card.js index 764fd995..2de29fba 100644 --- a/config/www/community/frigate-hass-card/frigate-hass-card.js +++ b/config/www/community/frigate-hass-card/frigate-hass-card.js @@ -1 +1 @@ -import"./card-555679fd.js"; +import"./card-320adb66.js"; diff --git a/config/www/community/frigate-hass-card/frigate-hass-card.js.gz b/config/www/community/frigate-hass-card/frigate-hass-card.js.gz index c33a8011..ecbc7fea 100644 Binary files a/config/www/community/frigate-hass-card/frigate-hass-card.js.gz and b/config/www/community/frigate-hass-card/frigate-hass-card.js.gz differ diff --git a/config/www/community/frigate-hass-card/frigate-hass-card.zip b/config/www/community/frigate-hass-card/frigate-hass-card.zip index 0475a05a..f38ad2ef 100644 Binary files a/config/www/community/frigate-hass-card/frigate-hass-card.zip and b/config/www/community/frigate-hass-card/frigate-hass-card.zip differ diff --git a/config/www/community/frigate-hass-card/gallery-149d4f41.js b/config/www/community/frigate-hass-card/gallery-149d4f41.js new file mode 100644 index 00000000..30549d97 --- /dev/null +++ b/config/www/community/frigate-hass-card/gallery-149d4f41.js @@ -0,0 +1,184 @@ +import{d3 as e,d4 as t,d5 as r,l as i,d6 as o,d7 as n,d8 as a,d9 as s,i as l,da as c,db as d,k as h,dc as g,dd as u,de as m,df as p,_ as f,n as v,cW as b,cR as y,dg as w,x as $,cV as x,r as k,a as _,t as C,e as T,b as E,dh as O,di as S,cI as M,dj as z,dk as L,cU as D,dl as A,c$ as F}from"./card-7cd05290.js";import{e as I}from"./endOfDay-0c5086cb.js";import{p as W}from"./parse-feacefaa.js";import{F as R}from"./date-picker-86e47001.js";function N(t){const r=e(t),i=r.getMonth();return r.setFullYear(r.getFullYear(),i+1,0),r.setHours(23,59,59,999),r}function H(){const e=new Date,t=e.getFullYear(),r=e.getMonth(),i=e.getDate(),o=new Date(0);return o.setFullYear(t,r,i-1),o.setHours(23,59,59,999),o}function V(){const e=new Date,t=e.getFullYear(),r=e.getMonth(),i=e.getDate(),o=new Date(0);return o.setFullYear(t,r,i-1),o.setHours(0,0,0,0),o}var j,B,q; +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +function P(e){return class extends e{createRenderRoot(){const e=this.constructor,{registry:t,elementDefinitions:i,shadowRootOptions:o}=e;i&&!t&&(e.registry=new CustomElementRegistry,Object.entries(i).forEach((([t,r])=>e.registry.define(t,r))));const n=this.renderOptions.creationScope=this.attachShadow({...o,customElements:e.registry});return r(n,this.constructor.elementStyles),n}}}!function(e){e.Favorite="favorite",e.NotFavorite="not-favorite"}(j||(j={})),function(e){e.Today="today",e.Yesterday="yesterday",e.PastWeek="past-week",e.PastMonth="past-month",e.Custom="custom"}(B||(B={})),function(e){e.Clips="clips",e.Snapshots="snapshots",e.Recordings="recordings"}(q||(q={}));class U{constructor(e){this._cameraOptions=[],this._whenOptions=[],this._metaDataWhenOptions=[],this._whatOptions=[],this._whereOptions=[],this._tagsOptions=[],this._defaults=null,this._viewManager=null,this._host=e,this._favoriteOptions=[{value:j.Favorite,label:i("media_filter.favorite")},{value:j.NotFavorite,label:i("media_filter.not_favorite")}],this._mediaTypeOptions=[{value:q.Clips,label:i("media_filter.media_types.clips")},{value:q.Snapshots,label:i("media_filter.media_types.snapshots")},{value:q.Recordings,label:i("media_filter.media_types.recordings")}],this._staticWhenOptions=[{value:B.Today,label:i("media_filter.whens.today")},{value:B.Yesterday,label:i("media_filter.whens.yesterday")},{value:B.PastWeek,label:i("media_filter.whens.past_week")},{value:B.PastMonth,label:i("media_filter.whens.past_month")},{value:B.Custom,label:i("media_filter.whens.custom")}],this._computeWhenOptions()}getMediaTypeOptions(){return this._mediaTypeOptions}getCameraOptions(){return this._cameraOptions}getWhenOptions(){return this._whenOptions}getWhatOptions(){return this._whatOptions}getWhereOptions(){return this._whereOptions}getTagsOptions(){return this._tagsOptions}getFavoriteOptions(){return this._favoriteOptions}getDefaults(){return this._defaults}setViewManager(e){this._viewManager=e}async valueChangeHandler(e,t,r,i){const s=e=>e&&Array.isArray(e)&&e.length&&!e.includes("")?new Set([...e]):null,l=s(r.camera)??this._getAllCameraIDs(e);if(!l.size||!r.mediaType)return;const c=this._getWhen(r.when),d=r.favorite?r.favorite===j.Favorite:null,h=t.performance?.features.media_chunk_size;if(r.mediaType===q.Clips||r.mediaType===q.Snapshots){const e=s(r.where),t=s(r.what),i=s(r.tags),a=new o([{type:n.Event,cameraIDs:l,...i&&{tags:i},...t&&{what:t},...e&&{where:e},...null!==d&&{favorite:d},...c&&{...c.start&&{start:c.start},...c.end&&{end:c.end}},...h&&{limit:h},...r.mediaType===q.Clips&&{hasClip:!0},...r.mediaType===q.Snapshots&&{hasSnapshot:!0}}]);this._viewManager?.setViewByParametersWithExistingQuery({params:{query:a,...1===l.size&&{camera:[...l][0]},view:r.mediaType===q.Clips?"clips":"snapshots"}})}else{const e=new a([{type:n.Recording,cameraIDs:l,...h&&{limit:h},...c&&{...c.start&&{start:c.start},...c.end&&{end:c.end}},...null!==d&&{favorite:d}}]);this._viewManager?.setViewByParametersWithExistingQuery({params:{query:e,...1===l.size&&{camera:[...l][0]},view:"recordings"}})}this._host.requestUpdate()}_getAllCameraIDs(e){return e.getStore().getCameraIDsWithCapability({anyCapabilities:["clips","snapshots","recordings"]})}computeInitialDefaultsFromView(e){const t=this._viewManager?.getView(),r=t?.query?.getQueries(),i=this._getAllCameraIDs(e);if(!t||!r||!i.size)return;let o,n,a,d,h,g;1!==s(r.map((e=>e.cameraIDs)),l).length||l(r[0].cameraIDs,i)||(n=[...r[0].cameraIDs]); +/* istanbul ignore else: the else path cannot be reached -- @preserve */ +if(1===s(r.map((e=>e.favorite)),l).length&&void 0!==r[0].favorite&&(h=r[0].favorite?j.Favorite:j.NotFavorite),c.areEventQueries(t.query)){const e=t.query.getQueries(); +/* istanbul ignore if: the if path cannot be reached -- @preserve */if(!e)return;const r=s(e.map((e=>e.hasClip)),l),i=s(e.map((e=>e.hasSnapshot)),l);1===r.length&&1===i.length&&(o=r[0]?q.Clips:i[0]?q.Snapshots:void 0);1===s(e.map((e=>e.what)),l).length&&e[0].what?.size&&(a=[...e[0].what]);1===s(e.map((e=>e.where)),l).length&&e[0].where?.size&&(d=[...e[0].where]);1===s(e.map((e=>e.tags)),l).length&&e[0].tags?.size&&(g=[...e[0].tags])}else c.areRecordingQueries(t.query)&&(o=q.Recordings);this._defaults={...o&&{mediaType:o},...n&&{cameraIDs:n},...a&&{what:a},...d&&{where:d},...void 0!==h&&{favorite:h},...g&&{tags:g}}}computeCameraOptions(e){this._cameraOptions=[...this._getAllCameraIDs(e)].map((t=>({value:t,label:e.getCameraMetadata(t)?.title??t})))}async computeMetadataOptions(e){let t=null;try{t=await e.getMediaMetadata()}catch(e){d(e)}if(t){if(t.what&&(this._whatOptions=[...t.what].sort().map((e=>({value:e,label:h(e)})))),t.where&&(this._whereOptions=[...t.where].sort().map((e=>({value:e,label:h(e)})))),t.tags&&(this._tagsOptions=[...t.tags].sort().map((e=>({value:e,label:h(e)})))),t.days){const e=new Set;[...t.days].forEach((t=>{e.add(t.substring(0,7))}));const r=[];e.forEach((e=>{r.push(W(e,"yyyy-MM",new Date))})),this._metaDataWhenOptions=g(r,(e=>e.getTime()),"desc").map((e=>({label:u(e,"MMMM yyyy"),value:this._dateRangeToString({start:e,end:N(e)})}))),this._computeWhenOptions()}this._host.requestUpdate()}}getControlsToShow(e){const t=this._viewManager?.getView(),r=c.areEventQueries(t?.query),i=c.areRecordingQueries(t?.query),o=e.getAggregateCameraCapabilities();return{events:r,recordings:i,favorites:r?o?.has("favorite-events"):!!i&&o?.has("favorite-recordings")}}_computeWhenOptions(){this._whenOptions=[...this._staticWhenOptions,...this._metaDataWhenOptions]}_dateRangeToString(e){return`${m(e.start)},${m(e.end)}`}_stringToDateRange(e){const t=e.split(",");return{start:W(t[0],"yyyy-MM-dd",new Date),end:I(W(t[1],"yyyy-MM-dd",new Date))}}_getWhen(e){if(e.from||e.to)return{...e.from&&{start:e.from},...e.to&&{end:e.to}};if(!e.selected||Array.isArray(e.selected))return null;const r=new Date;switch(e.selected){case B.Custom:return null;case B.Today:return{start:t(Date.now()),end:I(Date.now())};case B.Yesterday:return{start:V(),end:H()};case B.PastWeek:return{start:t(p(r,{days:7})),end:I(r)};case B.PastMonth:return{start:t(p(r,{months:1})),end:I(r)};default:return this._stringToDateRange(e.selected)}}}const K=!0,Y=!0,Q=!0,G=!1,X=!1;let Z,J,ee,te=!1,re=!1,ie=!1,oe=!1,ne=null,ae=!1;const se="http://www.w3.org/1999/xlink",le={},ce=e=>"object"===(e=typeof e)||"function"===e;const de=(e,t,...r)=>{let i=null,o=null,n=null,a=!1,s=!1;const l=[],c=t=>{for(let r=0;re[t])).join(" "))}}if("function"==typeof e)return e(null===t?{}:t,l,ue);const d=he(e,null);return d.$attrs$=t,l.length>0&&(d.$children$=l),d.$key$=o,d.$name$=n,d},he=(e,t)=>{const r={$flags$:0,$tag$:e,$text$:t,$elm$:null,$children$:null,$attrs$:null,$key$:null,$name$:null};return r},ge={},ue={forEach:(e,t)=>e.map(me).forEach(t),map:(e,t)=>e.map(me).map(t).map(pe)},me=e=>({vattrs:e.$attrs$,vchildren:e.$children$,vkey:e.$key$,vname:e.$name$,vtag:e.$tag$,vtext:e.$text$}),pe=e=>{if("function"==typeof e.vtag){const t=Object.assign({},e.vattrs);return e.vkey&&(t.key=e.vkey),e.vname&&(t.name=e.vname),de(e.vtag,t,...e.vchildren||[])}const t=he(e.vtag,e.vtext);return t.$attrs$=e.vattrs,t.$children$=e.vchildren,t.$key$=e.vkey,t.$name$=e.vname,t},fe=(e,t,r)=>{const i=e;return{emit:e=>ve(i,t,{bubbles:!!(4&r),composed:!!(2&r),cancelable:!!(1&r),detail:e})}},ve=(e,t,r)=>{const i=ht.ce(t,r);return e.dispatchEvent(i),i},be=new WeakMap,ye=e=>{const t=e.$cmpMeta$,r=e.$hostElement$,i=t.$flags$,o=(t.$tagName$,()=>{}),n=((e,t,r,i)=>{var o;let n=we(t,r);const a=at.get(n);if(e=11===e.nodeType?e:ct,a)if("string"==typeof a){e=e.head||e;let t,r=be.get(e);if(r||be.set(e,r=new Set),!r.has(n)){{t=ct.createElement("style"),t.innerHTML=a;const r=null!==(o=ht.$nonce$)&&void 0!==o?o:function(e){var t,r,i;return null!==(i=null===(r=null===(t=e.head)||void 0===t?void 0:t.querySelector('meta[name="csp-nonce"]'))||void 0===r?void 0:r.getAttribute("content"))&&void 0!==i?i:void 0}(ct);null!=r&&t.setAttribute("nonce",r),e.insertBefore(t,e.querySelector("link"))}r&&r.add(n)}}else e.adoptedStyleSheets.includes(a)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,a]);return n})(r.shadowRoot?r.shadowRoot:r.getRootNode(),t,e.$modeName$);10&i&&(r["s-sc"]=n,r.classList.add(n+"-h"),2&i&&r.classList.add(n+"-s")),o()},we=(e,t)=>"sc-"+(t&&32&e.$flags$?e.$tagName$+"-"+t:e.$tagName$),$e=(e,t,r,i,o,n)=>{if(r!==i){let a=ot(e,t),s=t.toLowerCase();if("class"===t){const t=e.classList,o=ke(r),n=ke(i);t.remove(...o.filter((e=>e&&!n.includes(e)))),t.add(...n.filter((e=>e&&!o.includes(e))))}else if("style"===t){for(const t in r)i&&null!=i[t]||(t.includes("-")?e.style.removeProperty(t):e.style[t]="");for(const t in i)r&&i[t]===r[t]||(t.includes("-")?e.style.setProperty(t,i[t]):e.style[t]=i[t])}else if("key"===t);else if("ref"===t)i&&i(e);else if(e.__lookupSetter__(t)||"o"!==t[0]||"n"!==t[1]){const l=ce(i);if((a||l&&null!==i)&&!o)try{if(e.tagName.includes("-"))e[t]=i;else{const o=null==i?"":i;"list"===t?a=!1:null!=r&&e[t]==o||(e[t]=o)}}catch(e){}let c=!1;s!==(s=s.replace(/^xlink\:?/,""))&&(t=s,c=!0),null==i||!1===i?!1===i&&""!==e.getAttribute(t)||(c?e.removeAttributeNS(se,t):e.removeAttribute(t)):(!a||4&n||o)&&!l&&(i=!0===i?"":i,c?e.setAttributeNS(se,t,i):e.setAttribute(t,i))}else t="-"===t[2]?t.slice(3):ot(lt,s)?s.slice(2):s[2]+t.slice(3),r&&ht.rel(e,t,r,!1),i&&ht.ael(e,t,i,!1)}},xe=/\s/,ke=e=>e?e.split(xe):[],_e=(e,t,r,i)=>{const o=11===t.$elm$.nodeType&&t.$elm$.host?t.$elm$.host:t.$elm$,n=e&&e.$attrs$||le,a=t.$attrs$||le;for(i in n)i in a||$e(o,i,n[i],void 0,r,t.$flags$);for(i in a)$e(o,i,n[i],a[i],r,t.$flags$)},Ce=(e,t,r,i)=>{const o=t.$children$[r];let n,a,s,l=0;if(te||(ie=!0,"slot"===o.$tag$&&(Z&&i.classList.add(Z+"-s"),o.$flags$|=o.$children$?2:1)),null!==o.$text$)n=o.$elm$=ct.createTextNode(o.$text$);else if(1&o.$flags$)n=o.$elm$=ct.createTextNode("");else{if(oe||(oe="svg"===o.$tag$),n=o.$elm$=ct.createElementNS(oe?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",2&o.$flags$?"slot-fb":o.$tag$),oe&&"foreignObject"===o.$tag$&&(oe=!1),_e(null,o,oe),null!=Z&&n["s-si"]!==Z&&n.classList.add(n["s-si"]=Z),o.$children$)for(l=0;l{ht.$flags$|=1;const r=e.childNodes;for(let e=r.length-1;e>=0;e--){const i=r[e];i["s-hn"]!==ee&&i["s-ol"]&&(ze(i).insertBefore(i,Me(i)),i["s-ol"].remove(),i["s-ol"]=void 0,ie=!0),t&&Te(i,t)}ht.$flags$&=-2},Ee=(e,t,r,i,o,n)=>{let a,s=e["s-cr"]&&e["s-cr"].parentNode||e;for(s.shadowRoot&&s.tagName===ee&&(s=s.shadowRoot);o<=n;++o)i[o]&&(a=Ce(null,r,o,e),a&&(i[o].$elm$=a,s.insertBefore(a,Me(t))))},Oe=(e,t,r,i,o)=>{for(;t<=r;++t)(i=e[t])&&(o=i.$elm$,We(i),re=!0,o["s-ol"]?o["s-ol"].remove():Te(o,!0),o.remove())},Se=(e,t)=>e.$tag$===t.$tag$&&("slot"===e.$tag$?e.$name$===t.$name$:e.$key$===t.$key$),Me=e=>e&&e["s-ol"]||e,ze=e=>(e["s-ol"]?e["s-ol"]:e).parentNode,Le=(e,t)=>{const r=t.$elm$=e.$elm$,i=e.$children$,o=t.$children$,n=t.$tag$,a=t.$text$;let s;null===a?(oe="svg"===n||"foreignObject"!==n&&oe,"slot"===n||_e(e,t,oe),null!==i&&null!==o?((e,t,r,i)=>{let o,n,a=0,s=0,l=0,c=0,d=t.length-1,h=t[0],g=t[d],u=i.length-1,m=i[0],p=i[u];for(;a<=d&&s<=u;)if(null==h)h=t[++a];else if(null==g)g=t[--d];else if(null==m)m=i[++s];else if(null==p)p=i[--u];else if(Se(h,m))Le(h,m),h=t[++a],m=i[++s];else if(Se(g,p))Le(g,p),g=t[--d],p=i[--u];else if(Se(h,p))"slot"!==h.$tag$&&"slot"!==p.$tag$||Te(h.$elm$.parentNode,!1),Le(h,p),e.insertBefore(h.$elm$,g.$elm$.nextSibling),h=t[++a],p=i[--u];else if(Se(g,m))"slot"!==h.$tag$&&"slot"!==p.$tag$||Te(g.$elm$.parentNode,!1),Le(g,m),e.insertBefore(g.$elm$,h.$elm$),g=t[--d],m=i[++s];else{for(l=-1,c=a;c<=d;++c)if(t[c]&&null!==t[c].$key$&&t[c].$key$===m.$key$){l=c;break}l>=0?(n=t[l],n.$tag$!==m.$tag$?o=Ce(t&&t[s],r,l,e):(Le(n,m),t[l]=void 0,o=n.$elm$),m=i[++s]):(o=Ce(t&&t[s],r,s,e),m=i[++s]),o&&ze(h.$elm$).insertBefore(o,Me(h.$elm$))}a>d?Ee(e,null==i[u+1]?null:i[u+1].$elm$,r,i,s,u):s>u&&Oe(t,a,d)})(r,i,t,o):null!==o?(null!==e.$text$&&(r.textContent=""),Ee(r,null,t,o,0,o.length-1)):null!==i&&Oe(i,0,i.length-1),oe&&"svg"===n&&(oe=!1)):(s=r["s-cr"])?s.parentNode.textContent=a:e.$text$!==a&&(r.data=a)},De=e=>{const t=e.childNodes;let r,i,o,n,a,s;for(i=0,o=t.length;i{let t,r,i,o,n,a,s=0;const l=e.childNodes,c=l.length;for(;s=0;a--)r=i[a],r["s-cn"]||r["s-nr"]||r["s-hn"]===t["s-hn"]||(Ie(r,o)?(n=Ae.find((e=>e.$nodeToRelocate$===r)),re=!0,r["s-sn"]=r["s-sn"]||o,n?n.$slotRefNode$=t:Ae.push({$slotRefNode$:t,$nodeToRelocate$:r}),r["s-sr"]&&Ae.map((e=>{Ie(e.$nodeToRelocate$,r["s-sn"])&&(n=Ae.find((e=>e.$nodeToRelocate$===r)),n&&!e.$slotRefNode$&&(e.$slotRefNode$=n.$slotRefNode$))}))):Ae.some((e=>e.$nodeToRelocate$===r))||Ae.push({$nodeToRelocate$:r}));1===t.nodeType&&Fe(t)}},Ie=(e,t)=>1===e.nodeType?null===e.getAttribute("slot")&&""===t||e.getAttribute("slot")===t:e["s-sn"]===t||""===t,We=e=>{e.$attrs$&&e.$attrs$.ref&&e.$attrs$.ref(null),e.$children$&&e.$children$.map(We)},Re=(e,t)=>{const r=e.$hostElement$,i=e.$cmpMeta$,o=e.$vnode$||he(null,null),n=(a=t)&&a.$tag$===ge?t:de(null,null,t);var a;if(ee=r.tagName,i.$attrsToReflect$&&(n.$attrs$=n.$attrs$||{},i.$attrsToReflect$.map((([e,t])=>n.$attrs$[t]=r[e]))),n.$tag$=null,n.$flags$|=4,e.$vnode$=n,n.$elm$=o.$elm$=r.shadowRoot||r,Z=r["s-sc"],J=r["s-cr"],te=!!(1&i.$flags$),re=!1,Le(o,n),ht.$flags$|=1,ie){let e,t,r,i,o,a;Fe(n.$elm$);let s=0;for(;s{e.$flags$|=16,e.$ancestorComponent$;return $t((()=>He(e,t)))},He=(e,t)=>{const r=e.$hostElement$,i=(e.$cmpMeta$.$tagName$,()=>{}),o=r;let n;return n=qe(o,t?"componentWillLoad":"componentWillUpdate"),n=Pe(n,(()=>qe(o,"componentWillRender"))),i(),Pe(n,(()=>Ve(e,o,t)))},Ve=async(e,t,r)=>{const i=e.$hostElement$,o=(e.$cmpMeta$.$tagName$,()=>{});i["s-rc"],r&&ye(e);const n=(e.$cmpMeta$.$tagName$,()=>{});je(e,t,i),n(),o(),Be(e)},je=(e,t,r)=>{try{ne=t,t=t.render&&t.render(),e.$flags$&=-17,e.$flags$|=2,(K||Y)&&(Q||Y)&&(G||Re(e,t))}catch(t){nt(t,e.$hostElement$)}return ne=null,null},Be=e=>{e.$cmpMeta$.$tagName$;const t=()=>{},r=e.$hostElement$;e.$ancestorComponent$,qe(r,"componentDidRender"),64&e.$flags$?(qe(r,"componentDidUpdate"),t()):(e.$flags$|=64,qe(r,"componentDidLoad"),t())},qe=(e,t,r)=>{if(e&&e[t])try{return e[t](r)}catch(e){nt(e)}},Pe=(e,t)=>e&&e.then?e.then(t):t(),Ue=(e,t,r,i)=>{const o=rt(e),n=e,a=o.$instanceValues$.get(t),s=o.$flags$,l=n;var c,d;c=r,d=i.$members$[t][0],r=null==c||ce(c)?c:4&d?"false"!==c&&(""===c||!!c):2&d?parseFloat(c):1&d?String(c):c;const h=Number.isNaN(a)&&Number.isNaN(r);if(r!==a&&!h){if(o.$instanceValues$.set(t,r),i.$watchers$&&128&s){const e=i.$watchers$[t];e&&e.map((e=>{try{l[e](r,a,t)}catch(e){nt(e,n)}}))}if(2==(18&s)){if(l.componentShouldUpdate&&!1===l.componentShouldUpdate(r,a,t))return;Ne(o,!1)}}},Ke=(e,t,r)=>{if(t.$members$){e.watchers&&(t.$watchers$=e.watchers);const r=Object.entries(t.$members$),i=e.prototype;r.map((([e,[r]])=>{(31&r||32&r)&&Object.defineProperty(i,e,{get(){return t=e,rt(this).$instanceValues$.get(t);var t},set(r){Ue(this,e,r,t)},configurable:!0,enumerable:!0})}));{const o=new Map;i.attributeChangedCallback=function(e,t,r){ht.jmp((()=>{const t=o.get(e);if(this.hasOwnProperty(t))r=this[t],delete this[t];else if(i.hasOwnProperty(t)&&"number"==typeof this[t]&&this[t]==r)return;this[t]=(null!==r||"boolean"!=typeof this[t])&&r}))},e.observedAttributes=r.filter((([e,t])=>15&t[0])).map((([e,r])=>{const i=r[1]||e;return o.set(i,e),512&r[0]&&t.$attrsToReflect$.push([e,i]),i}))}}return e},Ye=async(e,t,r,i,o)=>{if(!(32&t.$flags$)&&(o=e.constructor,t.$flags$|=32,customElements.whenDefined(r.$tagName$).then((()=>t.$flags$|=128)),o.style)){let i=o.style;"string"!=typeof i&&(i=i[t.$modeName$=(e=>st.map((t=>t(e))).find((e=>!!e)))(e)]);const n=we(r,t.$modeName$);if(!at.has(n)){const e=(r.$tagName$,()=>{});((e,t,r)=>{let i=at.get(e);mt&&r?(i=i||new CSSStyleSheet,"string"==typeof i?i=t:i.replaceSync(t)):i=t,at.set(e,i)})(n,i,!!(1&r.$flags$)),e()}}t.$ancestorComponent$;Ne(t,!0)},Qe=e=>{const t=e["s-cr"]=ct.createComment("");t["s-cn"]=!0,e.insertBefore(t,e.firstChild)},Ge=(e,t)=>{const r={$flags$:t[0],$tagName$:t[1]};r.$members$=t[2],r.$listeners$=t[3],r.$watchers$=e.$watchers$,r.$attrsToReflect$=[],!gt&&1&r.$flags$&&(r.$flags$|=8);const i=e.prototype.connectedCallback,o=e.prototype.disconnectedCallback;return Object.assign(e.prototype,{__registerHost(){it(this,r)},connectedCallback(){(e=>{if(!(1&ht.$flags$)){const t=rt(e),r=t.$cmpMeta$,i=(r.$tagName$,()=>{});1&t.$flags$?(Xe(e,t,r.$listeners$),t.$lazyInstance$):(t.$flags$|=1,12&r.$flags$&&Qe(e),r.$members$&&Object.entries(r.$members$).map((([t,[r]])=>{if(31&r&&e.hasOwnProperty(t)){const r=e[t];delete e[t],e[t]=r}})),Ye(e,t,r)),i()}})(this),i&&i.call(this)},disconnectedCallback(){(e=>{if(!(1&ht.$flags$)){const t=rt(e);t.$rmListeners$&&(t.$rmListeners$.map((e=>e())),t.$rmListeners$=void 0)}})(this),o&&o.call(this)},__attachShadow(){gt?this.attachShadow({mode:"open",delegatesFocus:!!(16&r.$flags$)}):this.shadowRoot=this}}),e.is=r.$tagName$,Ke(e,r)},Xe=(e,t,r,i)=>{r&&r.map((([r,i,o])=>{const n=Je(e,r),a=Ze(t,o),s=et(r);ht.ael(n,i,a,s),(t.$rmListeners$=t.$rmListeners$||[]).push((()=>ht.rel(n,i,a,s)))}))},Ze=(e,t)=>r=>{try{X||e.$hostElement$[t](r)}catch(e){nt(e)}},Je=(e,t)=>4&t?ct:8&t?lt:16&t?ct.body:e,et=e=>ut?{passive:!!(1&e),capture:!!(2&e)}:!!(2&e),tt=new WeakMap,rt=e=>tt.get(e),it=(e,t)=>{const r={$flags$:0,$hostElement$:e,$cmpMeta$:t,$instanceValues$:new Map};return Xe(e,r,t.$listeners$),tt.set(e,r)},ot=(e,t)=>t in e,nt=(e,t)=>(0,console.error)(e,t),at=new Map,st=[],lt="undefined"!=typeof window?window:{},ct=lt.document||{head:{}},dt=lt.HTMLElement||class{},ht={$flags$:0,$resourcesUrl$:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,r,i)=>e.addEventListener(t,r,i),rel:(e,t,r,i)=>e.removeEventListener(t,r,i),ce:(e,t)=>new CustomEvent(e,t)},gt=!0,ut=(()=>{let e=!1;try{ct.addEventListener("e",null,Object.defineProperty({},"passive",{get(){e=!0}}))}catch(e){}return e})(),mt=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync}catch(e){}return!1})(),pt=[],ft=[],vt=(e,t)=>r=>{e.push(r),ae||(ae=!0,t&&4&ht.$flags$?wt(yt):ht.raf(yt))},bt=e=>{for(let t=0;t{bt(pt),bt(ft),(ae=pt.length>0)&&ht.raf(yt)},wt=e=>{return Promise.resolve(t).then(e);var t},$t=vt(ft,!0),xt=(e,t)=>{const r=!!e.label||e.hasLabelSlot,i=!!e.helpText||e.hasHelpTextSlot,o=!!e.invalidText||e.hasInvalidTextSlot,n=!e.invalid,a=!!e.invalid;return de("div",{class:{"form-control":!0,[`form-control-${e.size}`]:!0,"form-control-has-label":r,"form-control-has-help-text":i,"form-control-has-invalid-text":o}},de("label",{id:e.labelId,class:"form-control-label",htmlFor:e.inputId,"aria-hidden":r?"false":"true",onClick:e.onLabelClick},de("slot",{name:"label"},e.label),e.requiredIndicator&&de("div",{class:"asterisk"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 1200 1200"},de("path",{fill:"currentColor",d:"M489.838 29.354v443.603L68.032 335.894 0 545.285l421.829 137.086-260.743 358.876 178.219 129.398L600.048 811.84l260.673 358.806 178.146-129.398-260.766-358.783L1200 545.379l-68.032-209.403-421.899 137.07V29.443H489.84l-.002-.089z"})))),de("div",{class:"form-control-input"},t),n&&de("div",{id:e.helpTextId,class:"form-control-help-text","aria-hidden":i?"false":"true"},de("slot",{name:"help-text"},e.helpText)),a&&de("div",{id:e.invalidTextId,class:"form-control-invalid-text","aria-hidden":o?"false":"true"},de("div",{class:"icon"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Alert Circle"),de("path",{d:"M256,48C141.31,48,48,141.31,48,256s93.31,208,208,208,208-93.31,208-208S370.69,48,256,48Zm0,319.91a20,20,0,1,1,20-20A20,20,0,0,1,256,367.91Zm21.72-201.15-5.74,122a16,16,0,0,1-32,0l-5.74-121.94v-.05a21.74,21.74,0,1,1,43.44,0Z",fill:"currentColor"}))),de("div",{class:"text"},de("slot",{name:"invalid-text"},e.invalidText))))}; +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +function kt(e){const t=e?e.assignedNodes({flatten:!0}):[];let r="";return[...t].map((e=>{e.nodeType===Node.TEXT_NODE&&(r+=e.textContent)})),r}function _t(e,t){return t?null!==e.querySelector(`[slot="${t}"]`):[...e.childNodes].some((e=>{if(e.nodeType===e.TEXT_NODE&&""!==e.textContent.trim())return!0;if(e.nodeType===e.ELEMENT_NODE){if(!e.hasAttribute("slot"))return!0}return!1}))} +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */const Ct=(e,t=[])=>{const r={};return t.forEach((t=>{if(e.hasAttribute(t)){null!==e.getAttribute(t)&&(r[t]=e.getAttribute(t)),e.removeAttribute(t)}})),r},Tt=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow()}render(){return de("span",{class:"spinner","aria-busy":"true","aria-live":"polite"})}static get style(){return":host{--track-color:var(--gr-color-light-shade);--indicator-color:var(--gr-color-primary);--stroke-width:2px;display:inline-flex;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.spinner{display:inline-block;width:1em;height:1em;border-radius:50%;border:solid var(--stroke-width) var(--track-color);border-top-color:var(--indicator-color);border-right-color:var(--indicator-color);animation:1s linear infinite spin}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}"}},[1,"gr-spinner"]);function Et(){if("undefined"==typeof customElements)return;["gr-spinner"].forEach((e=>{if("gr-spinner"===e)customElements.get(e)||customElements.define(e,Tt)}))}Et(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const Ot=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grFocus=fe(this,"gr-focus",7),this.grBlur=fe(this,"gr-blur",7),this.inheritedAttributes={},this.handleClick=e=>{if("button"!==this.type){const t=this.el.closest("form");if(t){e.preventDefault();const r=document.createElement("button");r.type=this.type,r.style.display="none",t.appendChild(r),r.click(),r.remove()}}},this.onFocus=()=>{this.grFocus.emit()},this.onBlur=()=>{this.grBlur.emit()},this.variant="default",this.disabled=!1,this.loading=!1,this.size="medium",this.caret=!1,this.pill=!1,this.expand=void 0,this.circle=!1,this.href=void 0,this.target=void 0,this.rel=void 0,this.type="button"}componentWillLoad(){this.inheritedAttributes=Ct(this.el,["aria-label","tabindex","title"])}async setFocus(e){this.button.focus(e)}async removeFocus(){this.button.blur()}render(){const{rel:e,target:t,href:r,variant:i,size:o,expand:n,type:a,inheritedAttributes:s,disabled:l}=this,c=void 0===r?"button":"a",d="button"===c?{type:a}:{href:r,rel:e,target:t};return de(ge,{onClick:this.handleClick,"aria-disabled":l?"true":null,class:{[`button-${i}`]:!0,[`button-${o}`]:!0,[`button-${n}`]:void 0!==n,"button-caret":this.caret,"button-circle":this.circle,"button-pill":this.pill,"button-disabled":l,"button-loading":this.loading}},de(c,Object.assign({ref:e=>this.button=e},d,{class:"button-native",disabled:l,onFocus:this.onFocus,onBlur:this.onBlur},s),de("span",{class:"button-inner"},de("slot",{name:"icon-only"}),de("slot",{name:"start"}),de("slot",null),de("slot",{name:"end"}),this.caret&&de("span",{class:"caret"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Chevron Down"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"M112 184l144 144 144-144"})))),this.loading&&de("gr-spinner",null)))}get el(){return this}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{display:inline-block;width:auto;font-family:var(--gr-font-family);font-weight:var(--gr-font-weight-medium);font-size:var(--gr-form-element-font-size-medium);font-kerning:none;user-select:none;vertical-align:top;vertical-align:-webkit-baseline-middle;pointer-events:auto;--height:var(--gr-form-element-height-medium);--border-radius:var(--gr-form-element-border-radius-medium);--border-width:1px;--border-style:solid;--background:transparent;--background-hover:transparent;--background-focus:transparent;--color:var(--gr-color-dark-tint);--color-hover:var(--gr-color-dark-tint);--color-focus:var(--gr-color-dark-tint);--border-color:var(--gr-color-light-shade);--border-color-hover:var(--gr-color-medium);--border-color-focus:var(--gr-color-primary);--padding-top:0;--padding-start:var(--gr-spacing-medium);--padding-end:var(--gr-spacing-medium);--padding-bottom:0;--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33);--shadow:none;--transition:background-color 150ms linear, opacity 150ms linear, border 150ms linear, color 150ms linear}:host(.button-disabled){pointer-events:none;opacity:0.5}:host(.button-primary){--border-color:var(--gr-color-primary);--background:var(--gr-color-primary);--color:var(--gr-color-primary-contrast);--border-color-hover:var(--gr-color-primary-shade);--background-hover:var(--gr-color-primary-shade);--color-hover:var(--gr-color-primary-contrast);--border-color-focus:var(--gr-color-primary);--background-focus:var(--gr-color-primary-shade);--color-focus:var(--gr-color-primary-contrast);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33)}:host(.button-secondary){--border-color:var(--gr-color-light-shade);--background:transparent;--color:var(--gr-color-primary);--border-color-hover:var(--gr-color-primary);--background-hover:transparent;--color-hover:var(--gr-color-primary);--border-color-focus:var(--gr-color-primary);--background-focus:transparent;--color-focus:var(--gr-color-primary);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33)}:host(.button-danger){--border-color:var(--gr-color-danger);--background:transparent;--color:var(--gr-color-danger);--border-color-hover:var(--gr-color-danger);--background-hover:var(--gr-color-danger);--color-hover:var(--gr-color-danger-contrast);--border-color-focus:var(--gr-color-danger);--background-focus:var(--gr-color-danger);--color-focus:var(--gr-color-danger-contrast);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-danger-rgb), 0.33)}:host(.button-plain){--border-color:transparent;--background:transparent;--color:var(--gr-color-primary);--border-color-hover:transparent;--background-hover:transparent;--color-hover:var(--gr-color-primary-shade);--border-color-focus:transparent;--background-focus:transparent;--color-focus:var(--gr-color-primary-shade);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33)}:host(.button-small){--padding-start:var(--gr-spacing-small);--padding-end:var(--gr-spacing-small);--border-radius:var(--gr-form-element-border-radius-small);--height:var(--gr-form-element-height-small);font-size:var(--gr-form-element-font-size-small)}:host(.button-large){--padding-start:var(--gr-spacing-large);--padding-end:var(--gr-spacing-large);--border-radius:var(--gr-form-element-border-radius-large);--height:var(--gr-form-element-height-large);font-size:var(--gr-form-element-font-size-large)}:host(.button-block){display:block}:host(.button-block) .button-native{margin-left:0;margin-right:0;display:block;width:100%;clear:both;contain:content}:host(.button-block) .button-native::after{clear:both}:host(.button-full){display:block}:host(.button-full) .button-native{margin-left:0;margin-right:0;display:block;width:100%;contain:content;border-radius:0;border-right-width:0;border-left-width:0}.button-native{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:block;position:relative;padding-top:var(--padding-top);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-bottom:var(--padding-bottom);width:100%;height:var(--height);transition:var(--transition);border-radius:var(--border-radius);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);color:var(--color);box-shadow:var(--shadow);line-height:1;cursor:pointer;z-index:0;text-decoration:none;box-sizing:border-box}.button-native::-moz-focus-inner{border:0}.button-native:focus{outline:none;box-shadow:var(--focus-ring);border-color:var(--border-color-focus);background-color:var(--background-focus);color:var(--color-focus)}.button-native *,.button-native *:before,.button-native *:after{box-sizing:inherit}.button-inner{display:flex;position:relative;flex-flow:row nowrap;flex-shrink:0;align-items:center;justify-content:center;width:100%;height:100%;z-index:1}:host(.button-circle) .button-native{padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;border-radius:50%;width:var(--height)}@media (any-hover: hover){.button-native:hover{color:var(--color-hover);background:var(--background-hover);border-color:var(--border-color-hover)}}:host(.button-caret) .caret{display:flex;align-items:center;margin-left:0.3em}:host(.button-caret) .caret svg{width:1em;height:1em}:host(.button-pill) .button-native{border-radius:var(--height)}::slotted(*){pointer-events:none}::slotted([slot=start]){margin-top:0;margin-left:-0.3em;margin-right:0.3em;margin-bottom:0}::slotted([slot=end]){margin-top:0;margin-left:0.3em;margin-right:-0.2em;margin-bottom:0}::slotted([slot=icon-only]){font-size:1.4em;pointer-events:none}:host(.button-loading){position:relative;pointer-events:none}:host(.button-loading) .caret{visibility:hidden}:host(.button-loading) slot[name=start],:host(.button-loading) slot[name=end],:host(.button-loading) slot[name=icon-only],:host(.button-loading) slot:not([name]){visibility:hidden}:host(.button-loading) gr-spinner{--indicator-color:currentColor;position:absolute;height:1em;width:1em;top:calc(50% - 0.5em);left:calc(50% - 0.5em)}@media not all and (min-resolution: 0.001dpcm){@supports (-webkit-appearance: none) and (stroke-color: transparent){:host([type=button]),:host([type=reset]),:host([type=submit]){-webkit-appearance:none !important}}}"}},[1,"gr-button",{variant:[513],disabled:[516],loading:[516],size:[513],caret:[4],pill:[516],expand:[513],circle:[516],href:[1],target:[1],rel:[1],type:[1],setFocus:[64],removeFocus:[64]}]);function St(){if("undefined"==typeof customElements)return;["gr-button","gr-spinner"].forEach((e=>{switch(e){case"gr-button":customElements.get(e)||customElements.define(e,Ot);break;case"gr-spinner":customElements.get(e)||Et()}}))}function Mt(e,t,r="vertical",i="smooth"){const o= +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +function(e,t){return{top:Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top),left:Math.round(e.getBoundingClientRect().left-t.getBoundingClientRect().left)}}(e,t),n=o.top+t.scrollTop,a=o.left+t.scrollLeft,s=t.scrollLeft,l=t.scrollLeft+t.offsetWidth,c=t.scrollTop,d=t.scrollTop+t.offsetHeight;"horizontal"!==r&&"both"!==r||(al&&t.scrollTo({left:a-t.offsetWidth+e.clientWidth,behavior:i})),"vertical"!==r&&"both"!==r||(nd&&t.scrollTo({top:n-t.offsetHeight+e.clientHeight,behavior:i}))} +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */function zt(e){return e.tabIndex>-1}function Lt(e){if(zt(e))return e;if(e.shadowRoot){const t=[...e.shadowRoot.children].find(zt);if(t)return t}return e.children?[...e.children].map(Lt)[0]:null}St();var Dt="top",At="bottom",Ft="right",It="left",Wt="auto",Rt=[Dt,At,Ft,It],Nt="start",Ht="end",Vt="clippingParents",jt="viewport",Bt="popper",qt="reference",Pt=Rt.reduce((function(e,t){return e.concat([t+"-"+Nt,t+"-"+Ht])}),[]),Ut=[].concat(Rt,[Wt]).reduce((function(e,t){return e.concat([t,t+"-"+Nt,t+"-"+Ht])}),[]),Kt=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function Yt(e){return e?(e.nodeName||"").toLowerCase():null}function Qt(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Gt(e){return e instanceof Qt(e).Element||e instanceof Element}function Xt(e){return e instanceof Qt(e).HTMLElement||e instanceof HTMLElement}function Zt(e){return"undefined"!=typeof ShadowRoot&&(e instanceof Qt(e).ShadowRoot||e instanceof ShadowRoot)}const Jt={name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach((function(e){var r=t.styles[e]||{},i=t.attributes[e]||{},o=t.elements[e];Xt(o)&&Yt(o)&&(Object.assign(o.style,r),Object.keys(i).forEach((function(e){var t=i[e];!1===t?o.removeAttribute(e):o.setAttribute(e,!0===t?"":t)})))}))},effect:function(e){var t=e.state,r={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,r.popper),t.styles=r,t.elements.arrow&&Object.assign(t.elements.arrow.style,r.arrow),function(){Object.keys(t.elements).forEach((function(e){var i=t.elements[e],o=t.attributes[e]||{},n=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:r[e]).reduce((function(e,t){return e[t]="",e}),{});Xt(i)&&Yt(i)&&(Object.assign(i.style,n),Object.keys(o).forEach((function(e){i.removeAttribute(e)})))}))}},requires:["computeStyles"]};function er(e){return e.split("-")[0]}var tr=Math.max,rr=Math.min,ir=Math.round;function or(e,t){void 0===t&&(t=!1);var r=e.getBoundingClientRect(),i=1,o=1;if(Xt(e)&&t){var n=e.offsetHeight,a=e.offsetWidth;a>0&&(i=ir(r.width)/a||1),n>0&&(o=ir(r.height)/n||1)}return{width:r.width/i,height:r.height/o,top:r.top/o,right:r.right/i,bottom:r.bottom/o,left:r.left/i,x:r.left/i,y:r.top/o}}function nr(e){var t=or(e),r=e.offsetWidth,i=e.offsetHeight;return Math.abs(t.width-r)<=1&&(r=t.width),Math.abs(t.height-i)<=1&&(i=t.height),{x:e.offsetLeft,y:e.offsetTop,width:r,height:i}}function ar(e,t){var r=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(r&&Zt(r)){var i=t;do{if(i&&e.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function sr(e){return Qt(e).getComputedStyle(e)}function lr(e){return["table","td","th"].indexOf(Yt(e))>=0}function cr(e){return((Gt(e)?e.ownerDocument:e.document)||window.document).documentElement}function dr(e){return"html"===Yt(e)?e:e.assignedSlot||e.parentNode||(Zt(e)?e.host:null)||cr(e)}function hr(e){return Xt(e)&&"fixed"!==sr(e).position?e.offsetParent:null}function gr(e){for(var t=Qt(e),r=hr(e);r&&lr(r)&&"static"===sr(r).position;)r=hr(r);return r&&("html"===Yt(r)||"body"===Yt(r)&&"static"===sr(r).position)?t:r||function(e){var t=-1!==navigator.userAgent.toLowerCase().indexOf("firefox");if(-1!==navigator.userAgent.indexOf("Trident")&&Xt(e)&&"fixed"===sr(e).position)return null;var r=dr(e);for(Zt(r)&&(r=r.host);Xt(r)&&["html","body"].indexOf(Yt(r))<0;){var i=sr(r);if("none"!==i.transform||"none"!==i.perspective||"paint"===i.contain||-1!==["transform","perspective"].indexOf(i.willChange)||t&&"filter"===i.willChange||t&&i.filter&&"none"!==i.filter)return r;r=r.parentNode}return null}(e)||t}function ur(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function mr(e,t,r){return tr(e,rr(t,r))}function pr(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},e)}function fr(e,t){return t.reduce((function(t,r){return t[r]=e,t}),{})}const vr={name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,r=e.state,i=e.name,o=e.options,n=r.elements.arrow,a=r.modifiersData.popperOffsets,s=er(r.placement),l=ur(s),c=[It,Ft].indexOf(s)>=0?"height":"width";if(n&&a){var d=function(e,t){return pr("number"!=typeof(e="function"==typeof e?e(Object.assign({},t.rects,{placement:t.placement})):e)?e:fr(e,Rt))}(o.padding,r),h=nr(n),g="y"===l?Dt:It,u="y"===l?At:Ft,m=r.rects.reference[c]+r.rects.reference[l]-a[l]-r.rects.popper[c],p=a[l]-r.rects.reference[l],f=gr(n),v=f?"y"===l?f.clientHeight||0:f.clientWidth||0:0,b=m/2-p/2,y=d[g],w=v-h[c]-d[u],$=v/2-h[c]/2+b,x=mr(y,$,w),k=l;r.modifiersData[i]=((t={})[k]=x,t.centerOffset=x-$,t)}},effect:function(e){var t=e.state,r=e.options.element,i=void 0===r?"[data-popper-arrow]":r;null!=i&&("string"!=typeof i||(i=t.elements.popper.querySelector(i)))&&ar(t.elements.popper,i)&&(t.elements.arrow=i)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function br(e){return e.split("-")[1]}var yr={top:"auto",right:"auto",bottom:"auto",left:"auto"};function wr(e){var t,r=e.popper,i=e.popperRect,o=e.placement,n=e.variation,a=e.offsets,s=e.position,l=e.gpuAcceleration,c=e.adaptive,d=e.roundOffsets,h=e.isFixed,g=a.x,u=void 0===g?0:g,m=a.y,p=void 0===m?0:m,f="function"==typeof d?d({x:u,y:p}):{x:u,y:p};u=f.x,p=f.y;var v=a.hasOwnProperty("x"),b=a.hasOwnProperty("y"),y=It,w=Dt,$=window;if(c){var x=gr(r),k="clientHeight",_="clientWidth";if(x===Qt(r)&&"static"!==sr(x=cr(r)).position&&"absolute"===s&&(k="scrollHeight",_="scrollWidth"),o===Dt||(o===It||o===Ft)&&n===Ht)w=At,p-=(h&&x===$&&$.visualViewport?$.visualViewport.height:x[k])-i.height,p*=l?1:-1;if(o===It||(o===Dt||o===At)&&n===Ht)y=Ft,u-=(h&&x===$&&$.visualViewport?$.visualViewport.width:x[_])-i.width,u*=l?1:-1}var C,T=Object.assign({position:s},c&&yr),E=!0===d?function(e){var t=e.x,r=e.y,i=window.devicePixelRatio||1;return{x:ir(t*i)/i||0,y:ir(r*i)/i||0}}({x:u,y:p}):{x:u,y:p};return u=E.x,p=E.y,l?Object.assign({},T,((C={})[w]=b?"0":"",C[y]=v?"0":"",C.transform=($.devicePixelRatio||1)<=1?"translate("+u+"px, "+p+"px)":"translate3d("+u+"px, "+p+"px, 0)",C)):Object.assign({},T,((t={})[w]=b?p+"px":"",t[y]=v?u+"px":"",t.transform="",t))}var $r={passive:!0};var xr={left:"right",right:"left",bottom:"top",top:"bottom"};function kr(e){return e.replace(/left|right|bottom|top/g,(function(e){return xr[e]}))}var _r={start:"end",end:"start"};function Cr(e){return e.replace(/start|end/g,(function(e){return _r[e]}))}function Tr(e){var t=Qt(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function Er(e){return or(cr(e)).left+Tr(e).scrollLeft}function Or(e){var t=sr(e),r=t.overflow,i=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(r+o+i)}function Sr(e){return["html","body","#document"].indexOf(Yt(e))>=0?e.ownerDocument.body:Xt(e)&&Or(e)?e:Sr(dr(e))}function Mr(e,t){var r;void 0===t&&(t=[]);var i=Sr(e),o=i===(null==(r=e.ownerDocument)?void 0:r.body),n=Qt(i),a=o?[n].concat(n.visualViewport||[],Or(i)?i:[]):i,s=t.concat(a);return o?s:s.concat(Mr(dr(a)))}function zr(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function Lr(e,t){return t===jt?zr(function(e){var t=Qt(e),r=cr(e),i=t.visualViewport,o=r.clientWidth,n=r.clientHeight,a=0,s=0;return i&&(o=i.width,n=i.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(a=i.offsetLeft,s=i.offsetTop)),{width:o,height:n,x:a+Er(e),y:s}}(e)):Gt(t)?function(e){var t=or(e);return t.top=t.top+e.clientTop,t.left=t.left+e.clientLeft,t.bottom=t.top+e.clientHeight,t.right=t.left+e.clientWidth,t.width=e.clientWidth,t.height=e.clientHeight,t.x=t.left,t.y=t.top,t}(t):zr(function(e){var t,r=cr(e),i=Tr(e),o=null==(t=e.ownerDocument)?void 0:t.body,n=tr(r.scrollWidth,r.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=tr(r.scrollHeight,r.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),s=-i.scrollLeft+Er(e),l=-i.scrollTop;return"rtl"===sr(o||r).direction&&(s+=tr(r.clientWidth,o?o.clientWidth:0)-n),{width:n,height:a,x:s,y:l}}(cr(e)))}function Dr(e,t,r){var i="clippingParents"===t?function(e){var t=Mr(dr(e)),r=["absolute","fixed"].indexOf(sr(e).position)>=0&&Xt(e)?gr(e):e;return Gt(r)?t.filter((function(e){return Gt(e)&&ar(e,r)&&"body"!==Yt(e)})):[]}(e):[].concat(t),o=[].concat(i,[r]),n=o[0],a=o.reduce((function(t,r){var i=Lr(e,r);return t.top=tr(i.top,t.top),t.right=rr(i.right,t.right),t.bottom=rr(i.bottom,t.bottom),t.left=tr(i.left,t.left),t}),Lr(e,n));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function Ar(e){var t,r=e.reference,i=e.element,o=e.placement,n=o?er(o):null,a=o?br(o):null,s=r.x+r.width/2-i.width/2,l=r.y+r.height/2-i.height/2;switch(n){case Dt:t={x:s,y:r.y-i.height};break;case At:t={x:s,y:r.y+r.height};break;case Ft:t={x:r.x+r.width,y:l};break;case It:t={x:r.x-i.width,y:l};break;default:t={x:r.x,y:r.y}}var c=n?ur(n):null;if(null!=c){var d="y"===c?"height":"width";switch(a){case Nt:t[c]=t[c]-(r[d]/2-i[d]/2);break;case Ht:t[c]=t[c]+(r[d]/2-i[d]/2)}}return t}function Fr(e,t){void 0===t&&(t={});var r=t,i=r.placement,o=void 0===i?e.placement:i,n=r.boundary,a=void 0===n?Vt:n,s=r.rootBoundary,l=void 0===s?jt:s,c=r.elementContext,d=void 0===c?Bt:c,h=r.altBoundary,g=void 0!==h&&h,u=r.padding,m=void 0===u?0:u,p=pr("number"!=typeof m?m:fr(m,Rt)),f=d===Bt?qt:Bt,v=e.rects.popper,b=e.elements[g?f:d],y=Dr(Gt(b)?b:b.contextElement||cr(e.elements.popper),a,l),w=or(e.elements.reference),$=Ar({reference:w,element:v,strategy:"absolute",placement:o}),x=zr(Object.assign({},v,$)),k=d===Bt?x:w,_={top:y.top-k.top+p.top,bottom:k.bottom-y.bottom+p.bottom,left:y.left-k.left+p.left,right:k.right-y.right+p.right},C=e.modifiersData.offset;if(d===Bt&&C){var T=C[o];Object.keys(_).forEach((function(e){var t=[Ft,At].indexOf(e)>=0?1:-1,r=[Dt,At].indexOf(e)>=0?"y":"x";_[e]+=T[r]*t}))}return _}function Ir(e,t){void 0===t&&(t={});var r=t,i=r.placement,o=r.boundary,n=r.rootBoundary,a=r.padding,s=r.flipVariations,l=r.allowedAutoPlacements,c=void 0===l?Ut:l,d=br(i),h=d?s?Pt:Pt.filter((function(e){return br(e)===d})):Rt,g=h.filter((function(e){return c.indexOf(e)>=0}));0===g.length&&(g=h);var u=g.reduce((function(t,r){return t[r]=Fr(e,{placement:r,boundary:o,rootBoundary:n,padding:a})[er(r)],t}),{});return Object.keys(u).sort((function(e,t){return u[e]-u[t]}))}const Wr={name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,r=e.options,i=e.name;if(!t.modifiersData[i]._skip){for(var o=r.mainAxis,n=void 0===o||o,a=r.altAxis,s=void 0===a||a,l=r.fallbackPlacements,c=r.padding,d=r.boundary,h=r.rootBoundary,g=r.altBoundary,u=r.flipVariations,m=void 0===u||u,p=r.allowedAutoPlacements,f=t.options.placement,v=er(f),b=l||(v===f||!m?[kr(f)]:function(e){if(er(e)===Wt)return[];var t=kr(e);return[Cr(e),t,Cr(t)]}(f)),y=[f].concat(b).reduce((function(e,r){return e.concat(er(r)===Wt?Ir(t,{placement:r,boundary:d,rootBoundary:h,padding:c,flipVariations:m,allowedAutoPlacements:p}):r)}),[]),w=t.rects.reference,$=t.rects.popper,x=new Map,k=!0,_=y[0],C=0;C=0,M=S?"width":"height",z=Fr(t,{placement:T,boundary:d,rootBoundary:h,altBoundary:g,padding:c}),L=S?O?Ft:It:O?At:Dt;w[M]>$[M]&&(L=kr(L));var D=kr(L),A=[];if(n&&A.push(z[E]<=0),s&&A.push(z[L]<=0,z[D]<=0),A.every((function(e){return e}))){_=T,k=!1;break}x.set(T,A)}if(k)for(var F=function(e){var t=y.find((function(t){var r=x.get(t);if(r)return r.slice(0,e).every((function(e){return e}))}));if(t)return _=t,"break"},I=m?3:1;I>0;I--){if("break"===F(I))break}t.placement!==_&&(t.modifiersData[i]._skip=!0,t.placement=_,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function Rr(e,t,r){return void 0===r&&(r={x:0,y:0}),{top:e.top-t.height-r.y,right:e.right-t.width+r.x,bottom:e.bottom-t.height+r.y,left:e.left-t.width-r.x}}function Nr(e){return[Dt,Ft,At,It].some((function(t){return e[t]>=0}))}const Hr={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,r=e.options,i=e.name,o=r.offset,n=void 0===o?[0,0]:o,a=Ut.reduce((function(e,r){return e[r]=function(e,t,r){var i=er(e),o=[It,Dt].indexOf(i)>=0?-1:1,n="function"==typeof r?r(Object.assign({},t,{placement:e})):r,a=n[0],s=n[1];return a=a||0,s=(s||0)*o,[It,Ft].indexOf(i)>=0?{x:s,y:a}:{x:a,y:s}}(r,t.rects,n),e}),{}),s=a[t.placement],l=s.x,c=s.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=c),t.modifiersData[i]=a}};const Vr={name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,r=e.options,i=e.name,o=r.mainAxis,n=void 0===o||o,a=r.altAxis,s=void 0!==a&&a,l=r.boundary,c=r.rootBoundary,d=r.altBoundary,h=r.padding,g=r.tether,u=void 0===g||g,m=r.tetherOffset,p=void 0===m?0:m,f=Fr(t,{boundary:l,rootBoundary:c,padding:h,altBoundary:d}),v=er(t.placement),b=br(t.placement),y=!b,w=ur(v),$="x"===w?"y":"x",x=t.modifiersData.popperOffsets,k=t.rects.reference,_=t.rects.popper,C="function"==typeof p?p(Object.assign({},t.rects,{placement:t.placement})):p,T="number"==typeof C?{mainAxis:C,altAxis:C}:Object.assign({mainAxis:0,altAxis:0},C),E=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,O={x:0,y:0};if(x){if(n){var S,M="y"===w?Dt:It,z="y"===w?At:Ft,L="y"===w?"height":"width",D=x[w],A=D+f[M],F=D-f[z],I=u?-_[L]/2:0,W=b===Nt?k[L]:_[L],R=b===Nt?-_[L]:-k[L],N=t.elements.arrow,H=u&&N?nr(N):{width:0,height:0},V=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},j=V[M],B=V[z],q=mr(0,k[L],H[L]),P=y?k[L]/2-I-q-j-T.mainAxis:W-q-j-T.mainAxis,U=y?-k[L]/2+I+q+B+T.mainAxis:R+q+B+T.mainAxis,K=t.elements.arrow&&gr(t.elements.arrow),Y=K?"y"===w?K.clientTop||0:K.clientLeft||0:0,Q=null!=(S=null==E?void 0:E[w])?S:0,G=D+U-Q,X=mr(u?rr(A,D+P-Q-Y):A,D,u?tr(F,G):F);x[w]=X,O[w]=X-D}if(s){var Z,J="x"===w?Dt:It,ee="x"===w?At:Ft,te=x[$],re="y"===$?"height":"width",ie=te+f[J],oe=te-f[ee],ne=-1!==[Dt,It].indexOf(v),ae=null!=(Z=null==E?void 0:E[$])?Z:0,se=ne?ie:te-k[re]-_[re]-ae+T.altAxis,le=ne?te+k[re]+_[re]-ae-T.altAxis:oe,ce=u&&ne?function(e,t,r){var i=mr(e,t,r);return i>r?r:i}(se,te,le):mr(u?se:ie,te,u?le:oe);x[$]=ce,O[$]=ce-te}t.modifiersData[i]=O}},requiresIfExists:["offset"]};function jr(e,t,r){void 0===r&&(r=!1);var i,o,n=Xt(t),a=Xt(t)&&function(e){var t=e.getBoundingClientRect(),r=ir(t.width)/e.offsetWidth||1,i=ir(t.height)/e.offsetHeight||1;return 1!==r||1!==i}(t),s=cr(t),l=or(e,a),c={scrollLeft:0,scrollTop:0},d={x:0,y:0};return(n||!n&&!r)&&(("body"!==Yt(t)||Or(s))&&(c=(i=t)!==Qt(i)&&Xt(i)?{scrollLeft:(o=i).scrollLeft,scrollTop:o.scrollTop}:Tr(i)),Xt(t)?((d=or(t,!0)).x+=t.clientLeft,d.y+=t.clientTop):s&&(d.x=Er(s))),{x:l.left+c.scrollLeft-d.x,y:l.top+c.scrollTop-d.y,width:l.width,height:l.height}}function Br(e){var t=new Map,r=new Set,i=[];function o(e){r.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach((function(e){if(!r.has(e)){var i=t.get(e);i&&o(i)}})),i.push(e)}return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){r.has(e.name)||o(e)})),i}var qr={placement:"bottom",modifiers:[],strategy:"absolute"};function Pr(){for(var e=arguments.length,t=new Array(e),r=0;r{},onAfterHide:()=>{},onTransitionEnd:()=>{}},r),this.isVisible=!1,this.popover.hidden=!0,this.popover.classList.remove(this.options.visibleClass),this.popover.addEventListener("transitionend",this.handleTransitionEnd)}handleTransitionEnd(e){e.target===this.options.transitionElement&&(this.options.onTransitionEnd.call(this,e),this.isVisible||this.popover.hidden||(this.popover.hidden=!0,this.popover.classList.remove(this.options.visibleClass),this.options.onAfterHide.call(this)))}destroy(){this.popover.removeEventListener("transitionend",this.handleTransitionEnd),this.popper&&(this.popper.destroy(),this.popper=null)}show(){this.isVisible=!0,this.popover.hidden=!1,requestAnimationFrame((()=>this.popover.classList.add(this.options.visibleClass))),this.popper&&this.popper.destroy(),this.popper=Kr(this.anchor,this.popover,{placement:this.options.placement,strategy:this.options.strategy,modifiers:[{name:"flip",options:{boundary:"viewport"}},{name:"offset",options:{offset:[this.options.skidding,this.options.distance]}}]}),this.popover.addEventListener("transitionend",(()=>this.options.onAfterShow.call(this)),{once:!0}),requestAnimationFrame((()=>this.popper.update()))}hide(){this.isVisible=!1,this.popover.classList.remove(this.options.visibleClass)}setOptions(e){this.options=Object.assign(this.options,e),this.isVisible?this.popover.classList.add(this.options.visibleClass):this.popover.classList.remove(this.options.visibleClass),this.popper&&(this.popper.setOptions({placement:this.options.placement,strategy:this.options.strategy}),requestAnimationFrame((()=>this.popper.update())))}}let Qr=0;const Gr=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grShow=fe(this,"gr-show",7),this.grAfterShow=fe(this,"gr-after-show",7),this.grHide=fe(this,"gr-hide",7),this.grAfterHide=fe(this,"gr-after-hide",7),this.componentId="dropdown-"+ ++Qr,this.isVisible=!1,this.open=!1,this.placement="bottom-start",this.closeOnSelect=!0,this.containingElement=void 0,this.distance=2,this.skidding=0,this.hoist=!1}handleOpenChange(){this.open?this.show():this.hide(),this.updateAccessibleTrigger()}handlePopoverOptionsChange(){this.popoverElement.setOptions({strategy:this.hoist?"fixed":"absolute",placement:this.placement,distance:this.distance,skidding:this.skidding})}connectedCallback(){this.containingElement||(this.containingElement=this.el),this.handleDocumentKeyDown=this.handleDocumentKeyDown.bind(this),this.handleDocumentMouseDown=this.handleDocumentMouseDown.bind(this),this.handleMenuItemActivate=this.handleMenuItemActivate.bind(this),this.handlePanelSelect=this.handlePanelSelect.bind(this),this.handleTriggerClick=this.handleTriggerClick.bind(this),this.handleTriggerKeyDown=this.handleTriggerKeyDown.bind(this),this.handleTriggerKeyUp=this.handleTriggerKeyUp.bind(this),this.handleTriggerSlotChange=this.handleTriggerSlotChange.bind(this)}componentDidLoad(){this.popoverElement=new Yr(this.trigger,this.positioner,{strategy:this.hoist?"fixed":"absolute",placement:this.placement,distance:this.distance,skidding:this.skidding,transitionElement:this.panel,onAfterHide:()=>this.grAfterHide.emit(),onAfterShow:()=>this.grAfterShow.emit(),onTransitionEnd:()=>{this.open||(this.panel.scrollTop=0)}}),this.open&&this.show()}disconnectedCallback(){this.hide(),this.popoverElement.destroy()}async show(){if(this.isVisible)return;this.grShow.emit().defaultPrevented?this.open=!1:(this.panel.addEventListener("gr-activate",this.handleMenuItemActivate),this.panel.addEventListener("gr-select",this.handlePanelSelect),document.addEventListener("keydown",this.handleDocumentKeyDown),document.addEventListener("mousedown",this.handleDocumentMouseDown),this.isVisible=!0,this.open=!0,this.popoverElement.show())}async hide(){if(!this.isVisible)return;this.grHide.emit().defaultPrevented?this.open=!0:(this.panel.removeEventListener("gr-activate",this.handleMenuItemActivate),this.panel.removeEventListener("gr-select",this.handlePanelSelect),document.addEventListener("keydown",this.handleDocumentKeyDown),document.removeEventListener("mousedown",this.handleDocumentMouseDown),this.isVisible=!1,this.open=!1,this.popoverElement.hide())}async focusOnTrigger(){const e=this.trigger.querySelector("slot").assignedElements({flatten:!0})[0];e&&("function"==typeof e.setFocus?e.setFocus():"function"==typeof e.focus&&e.focus())}getMenu(){return this.panel.querySelector("slot").assignedElements({flatten:!0}).filter((e=>"gr-menu"===e.tagName.toLowerCase()))[0]}handleDocumentKeyDown(e){var t;if("Escape"===e.key)return this.hide(),void this.focusOnTrigger();if("Tab"===e.key){if(this.open&&"gr-menu-item"===(null===(t=document.activeElement)||void 0===t?void 0:t.tagName.toLowerCase()))return e.preventDefault(),this.hide(),void this.focusOnTrigger();setTimeout((()=>{var e;const t=this.containingElement.getRootNode()instanceof ShadowRoot?null===(e=document.activeElement.shadowRoot)||void 0===e?void 0:e.activeElement:document.activeElement;(null==t?void 0:t.closest(this.containingElement.tagName.toLowerCase()))===this.containingElement||this.hide()}))}}handleDocumentMouseDown(e){e.composedPath().includes(this.containingElement)||this.hide()}handleMenuItemActivate(e){Mt(e.target,this.panel)}handlePanelSelect(e){const t=e.target;this.closeOnSelect&&"gr-menu"===t.tagName.toLowerCase()&&(this.hide(),this.focusOnTrigger())}handleTriggerClick(){this.open?this.hide():this.show()}handleTriggerKeyDown(e){const t=this.getMenu(),r=t?[...t.querySelectorAll("gr-menu-item")]:null,i=r[0],o=r[r.length-1];if("Escape"===e.key)return this.focusOnTrigger(),void this.hide();if([" ","Enter"].includes(e.key))return e.preventDefault(),void(this.open?this.hide():this.show());if(["ArrowDown","ArrowUp"].includes(e.key)){if(e.preventDefault(),this.open||this.show(),"ArrowDown"===e.key&&i)return void i.setFocus();if("ArrowUp"===e.key&&o)return void o.setFocus()}this.open&&t&&!["Tab","Shift","Meta","Ctrl","Alt"].includes(e.key)&&t.typeToSelect(e.key)}handleTriggerKeyUp(e){" "===e.key&&e.preventDefault()}handleTriggerSlotChange(){this.updateAccessibleTrigger()}updateAccessibleTrigger(){const e=this.trigger.querySelector("slot").assignedElements({flatten:!0}).map(Lt)[0];e&&(e.setAttribute("aria-haspopup","true"),e.setAttribute("aria-expanded",this.open?"true":"false"))}render(){return de(ge,{id:this.componentId,class:{"dropdown-open":this.open}},de("span",{class:"dropdown-trigger",ref:e=>this.trigger=e,onClick:this.handleTriggerClick,onKeyDown:this.handleTriggerKeyDown,onKeyUp:this.handleTriggerKeyUp},de("slot",{name:"trigger",onSlotchange:this.handleTriggerSlotChange})),de("div",{ref:e=>this.positioner=e,class:"dropdown-positioner"},de("div",{ref:e=>this.panel=e,class:"dropdown-panel",role:"menu","aria-hidden":this.open?"false":"true","aria-labelledby":this.componentId},de("slot",null))))}get el(){return this}static get watchers(){return{open:["handleOpenChange"],distance:["handlePopoverOptionsChange"],hoist:["handlePopoverOptionsChange"],placement:["handlePopoverOptionsChange"],skidding:["handlePopoverOptionsChange"]}}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{--panel-background-color:var(--gr-color-white);--panel-border-radius:var(--gr-border-radius-medium);--panel-border-color:var(--gr-panel-border-color);--panel-box-shadow:var(--gr-shadow-large);--transition:150ms opacity, 150ms transform;display:inline-block;position:relative;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.dropdown-trigger{display:block}.dropdown-positioner{position:absolute;z-index:var(--gr-z-index-dropdown)}.dropdown-panel{max-height:50vh;font-family:var(--gr-font-family);font-size:var(--gr-font-size-medium);font-weight:var(--gr-font-weight-normal);background-color:var(--panel-background-color);border:solid 1px var(--panel-border-color);border-radius:var(--panel-border-radius);box-shadow:var(--panel-box-shadow);opacity:0;overflow:auto;overscroll-behavior:none;pointer-events:none;transform:scale(0.9);transition:var(--transition)}.dropdown-positioner[data-popper-placement^=top] .dropdown-panel{transform-origin:bottom}.dropdown-positioner[data-popper-placement^=bottom] .dropdown-panel{transform-origin:top}.dropdown-positioner[data-popper-placement^=left] .dropdown-panel{transform-origin:right}.dropdown-positioner[data-popper-placement^=right] .dropdown-panel{transform-origin:left}.dropdown-positioner.popover-visible .dropdown-panel{opacity:1;transform:none;pointer-events:all}"}},[1,"gr-dropdown",{open:[1540],placement:[1],closeOnSelect:[4,"close-on-select"],containingElement:[1040],distance:[2],skidding:[2],hoist:[4],show:[64],hide:[64],focusOnTrigger:[64]}]);function Xr(){if("undefined"==typeof customElements)return;["gr-dropdown"].forEach((e=>{if("gr-dropdown"===e)customElements.get(e)||customElements.define(e,Gr)}))}Xr(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const Zr=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grSelect=fe(this,"gr-select",7),this.typeToSelectString=""}connectedCallback(){this.handleClick=this.handleClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}async typeToSelect(e){clearTimeout(this.typeToSelectTimeout),this.typeToSelectTimeout=setTimeout((()=>this.typeToSelectString=""),750),this.typeToSelectString+=e.toLowerCase();const t=this.getItems();for(const e of t){if(kt(e.shadowRoot.querySelector("slot:not([name])")).toLowerCase().trim().substring(0,this.typeToSelectString.length)===this.typeToSelectString){e.setFocus();break}}}getItems(){return[...this.menu.querySelector("slot").assignedElements({flatten:!0})].filter((e=>"gr-menu-item"===e.tagName.toLowerCase()&&!e.disabled))}getActiveItem(){return this.getItems().find((e=>e===document.activeElement))}setActiveItem(e){e.setFocus()}handleClick(e){const t=e.target.closest("gr-menu-item");t&&!t.disabled&&this.grSelect.emit({item:t})}handleKeyDown(e){if("Enter"===e.key){const t=this.getActiveItem();e.preventDefault(),t&&this.grSelect.emit({item:t})}if(" "===e.key&&e.preventDefault(),["ArrowDown","ArrowUp","Home","End"].includes(e.key)){const t=this.getItems(),r=this.getActiveItem();let i=t.indexOf(r);if(t.length)return e.preventDefault(),"ArrowDown"===e.key?i++:"ArrowUp"===e.key?i--:"Home"===e.key?i=0:"End"===e.key&&(i=t.length-1),i<0&&(i=0),i>t.length-1&&(i=t.length-1),void this.setActiveItem(t[i])}this.typeToSelect(e.key)}render(){return de("div",{ref:e=>this.menu=e,class:"menu",role:"menu",onClick:this.handleClick,onKeyDown:this.handleKeyDown},de("slot",null))}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{--padding-top:var(--gr-spacing-x-small);--padding-bottom:var(--gr-spacing-x-small);display:block;padding-top:var(--padding-top);padding-left:0;padding-right:0;padding-bottom:var(--padding-bottom);box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host:focus{outline:none}"}},[1,"gr-menu",{typeToSelect:[64]}]);function Jr(){if("undefined"==typeof customElements)return;["gr-menu"].forEach((e=>{if("gr-menu"===e)customElements.get(e)||customElements.define(e,Zr)}))}Jr(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const ei=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grClear=fe(this,"gr-clear",7),this.type="primary",this.size="medium",this.pill=!1,this.clearable=!1,this.truncate=!1,this.title=""}connectedCallback(){this.handleClearClick=this.handleClearClick.bind(this)}handleClearClick(){this.grClear.emit()}render(){return de(ge,{class:{[`tag-${this.type}`]:!0,[`tag-${this.size}`]:!0,"tag-pill":this.pill,"tag-clearable":this.clearable}},de("span",{class:"tag"},de("span",{class:{"tag-truncate":this.truncate},title:this.title},de("slot",null)),this.clearable&&de("gr-button",{variant:"plain",size:this.size,class:"tag-clear","aria-label":"clear",onClick:this.handleClearClick},de("svg",{slot:"icon-only",role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Close"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 368L144 144M368 144L144 368"})))))}static get style(){return":host{--height:calc(var(--gr-form-element-height-medium) * 0.8);--line-height:calc(var(--gr-form-element-height-medium) - 1px * 2);--border-radius:var(--gr-form-element-border-radius-medium);--border-width:1px;--border-style:solid;--padding-top:0;--padding-start:var(--gr-spacing-small);--padding-end:var(--gr-spacing-small);--padding-bottom:0;--font-size:var(--gr-form-element-font-size-medium);--background-color:rgba(var(--gr-color-primary-rgb), 0.05);--border-color:rgba(var(--gr-color-primary-rgb), 0.2);--color:var(--gr-color-primary-shade);--clear-color:var(--gr-color-primary);--clear-color-hover:var(--gr-color-primary-shade);--clear-margin-left:var(--gr-spacing-xx-small);--clear-margin-right:calc(-1 * var(--gr-spacing-xxx-small));display:inline-block;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host(.tag-success){--background-color:rgba(var(--gr-color-success-rgb), 0.05);--border-color:rgba(var(--gr-color-success-rgb), 0.2);--color:var(--gr-color-success-shade);--clear-color:var(--gr-color-success);--clear-color-hover:var(--gr-color-success-shade)}:host(.tag-info){--background-color:rgba(var(--gr-color-medium-rgb), 0.05);--border-color:rgba(var(--gr-color-medium-rgb), 0.2);--color:var(--gr-color-medium-shade);--clear-color:var(--gr-color-medium);--clear-color-hover:var(--gr-color-medium-shade)}:host(.tag-warning){--background-color:rgba(var(--gr-color-warning-rgb), 0.05);--border-color:rgba(var(--gr-color-warning-rgb), 0.2);--color:var(--gr-color-warning-shade);--clear-color:var(--gr-color-warning);--clear-color-hover:var(--gr-color-warning-shade)}:host(.tag-danger){--background-color:rgba(var(--gr-color-danger-rgb), 0.05);--border-color:rgba(var(--gr-color-danger-rgb), 0.2);--color:var(--gr-color-danger-shade);--clear-color:var(--gr-color-danger);--clear-color-hover:var(--gr-color-danger-shade)}:host(.tag-small){--font-size:var(--gr-form-element-font-size-small);--height:calc(var(--gr-form-element-height-small) * 0.8);--line-height:calc(var(--gr-form-element-height-small) - 1px * 2);--border-radius:var(--gr-form-element-border-radius-small);--padding-start:var(--gr-spacing-x-small);--padding-end:var(--gr-spacing-x-small);--clear-margin-left:var(--gr-spacing-xx-small);--clear-margin-right:calc(-1 * var(--gr-spacing-xxx-small))}:host(.tag-large){--font-size:var(--gr-form-element-font-size-large);--height:calc(var(--gr-form-element-height-large) * 0.8);--line-height:calc(var(--gr-form-element-height-large) - 1px * 2);--border-radius:var(--gr-form-element-border-radius-large);--padding:0 var(--gr-spacing-medium);--clear-margin-left:var(--gr-spacing-xx-small);--clear-margin-right:calc(-1 * var(--gr-spacing-x-small))}.tag{display:flex;align-items:center;border-style:var(--border-style);border-width:var(--border-width);border-radius:var(--border-radius);white-space:nowrap;user-select:none;cursor:default;font-family:var(--gr-font-family);font-size:var(--font-size);font-weight:var(--gr-font-weight-normal);height:var(--height);line-height:var(--line-height);padding-top:var(--padding-top);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-bottom:var(--padding-bottom);background-color:var(--background-color);border-color:var(--border-color);color:var(--color)}.tag-clear{--color:var(--clear-color);--color-hover:var(--clear-color-hover);--padding-start:0;--padding-end:0;margin-left:var(--clear-margin-left);margin-right:var(--clear-margin-right);--height:1em}.tag-clear svg{font-size:0.7em}.tag-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tag-clear svg{width:1.1em;height:1.1em}:host(.tag-pill) .tag{border-radius:var(--height)}"}},[1,"gr-tag",{type:[513],size:[513],pill:[516],clearable:[516],truncate:[516],title:[513]}]);function ti(){if("undefined"==typeof customElements)return;["gr-tag","gr-button","gr-spinner"].forEach((e=>{switch(e){case"gr-tag":customElements.get(e)||customElements.define(e,ei);break;case"gr-button":customElements.get(e)||St();break;case"gr-spinner":customElements.get(e)||Et()}}))}ti(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const ri="undefined"!=typeof HTMLElement?HTMLElement:class{};let ii=0;const oi=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grChange=fe(this,"gr-change",7),this.grFocus=fe(this,"gr-focus",7),this.grBlur=fe(this,"gr-blur",7),this.inputId="select-"+ ++ii,this.labelId=`select-label-${ii}`,this.helpTextId=`select-help-text-${ii}`,this.invalidTextId=`select-invalid-text-${ii}`,this.inheritedAttributes={},this.handleBlur=()=>{this.isOpen||(this.hasFocus=!1,this.grBlur.emit())},this.handleFocus=()=>{this.hasFocus||(this.hasFocus=!0,this.grFocus.emit())},this.hasFocus=!1,this.hasHelpTextSlot=!1,this.hasInvalidTextSlot=!1,this.hasLabelSlot=!1,this.isOpen=!1,this.items=[],this.displayLabel="",this.displayTags=[],this.multiple=!1,this.maxTagsVisible=3,this.disabled=!1,this.name="",this.placeholder="",this.size="medium",this.hoist=!1,this.value="",this.pill=!1,this.label="",this.requiredIndicator=!1,this.helpText="",this.invalidText="",this.invalid=!1,this.clearable=!1}handleDisabledChange(){this.disabled&&this.isOpen&&this.dropdown.hide()}handleLabelChange(){this.handleSlotChange()}handleMultipleChange(){const e=this.getValueAsArray();this.value=this.multiple?e:e[0]||"",this.syncItemsFromValue()}handleValueChange(){this.syncItemsFromValue(),this.grChange.emit()}connectedCallback(){this.handleClearClick=this.handleClearClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleLabelClick=this.handleLabelClick.bind(this),this.handleMenuHide=this.handleMenuHide.bind(this),this.handleMenuShow=this.handleMenuShow.bind(this),this.handleMenuSelect=this.handleMenuSelect.bind(this),this.handleSlotChange=this.handleSlotChange.bind(this),this.handleTagInteraction=this.handleTagInteraction.bind(this),this.el.shadowRoot.addEventListener("slotchange",this.handleSlotChange)}componentWillLoad(){this.handleSlotChange(),this.inheritedAttributes=Ct(this.el,["aria-label"])}componentDidLoad(){this.resizeObserver=new ResizeObserver((()=>this.resizeMenu())),this.reportDuplicateItemValues(),requestAnimationFrame((()=>this.syncItemsFromValue()))}disconnectedCallback(){this.el.shadowRoot.removeEventListener("slotchange",this.handleSlotChange)}async setFocus(){this.hasFocus=!0,this.grFocus.emit(),this.dropdown.focusOnTrigger()}getItemLabel(e){return kt(e.shadowRoot.querySelector("slot:not([name])"))}getItems(){return[...this.el.querySelectorAll("gr-menu-item")]}getValueAsArray(){return Array.isArray(this.value)?this.value:[this.value]}handleClearClick(e){e.stopPropagation(),this.value=this.multiple?[]:"",this.syncItemsFromValue()}handleKeyDown(e){const t=e.target,r=this.getItems(),i=r[0],o=r[r.length-1];if("gr-tag"!==t.tagName.toLowerCase())if("Tab"!==e.key){if(["ArrowDown","ArrowUp"].includes(e.key)){if(e.preventDefault(),this.isOpen||this.dropdown.show(),"ArrowDown"===e.key&&i)return void i.setFocus();if("ArrowUp"===e.key&&o)return void o.setFocus()}this.isOpen||1!==e.key.length||(e.stopPropagation(),e.preventDefault(),this.dropdown.show(),this.menu.typeToSelect(e.key))}else this.isOpen&&this.dropdown.hide()}handleLabelClick(){this.box.focus()}handleMenuSelect(e){const t=e.detail.item;this.multiple?this.value=this.value.includes(t.value)?this.value.filter((e=>e!==t.value)):[...this.value,t.value]:this.value=t.value,this.syncItemsFromValue()}handleMenuShow(e){this.disabled?e.preventDefault():(this.resizeMenu(),this.resizeObserver.observe(this.el),this.isOpen=!0)}handleMenuHide(){this.resizeObserver.unobserve(this.el),this.isOpen=!1,this.box.focus()}handleSlotChange(){this.hasHelpTextSlot=_t(this.el,"help-text"),this.hasInvalidTextSlot=_t(this.el,"invalid-text"),this.hasLabelSlot=_t(this.el,"label"),this.syncItemsFromValue(),this.reportDuplicateItemValues()}handleTagInteraction(e){e.composedPath().find((e=>{if(e instanceof ri)return e.classList.contains("tag-clear")}))&&e.stopPropagation()}reportDuplicateItemValues(){const e=this.getItems().map((e=>e.value)).filter(((e,t,r)=>r.indexOf(e)!==t));if(e.length)throw new Error('Duplicate value found on in : "'+e.join('", "')+'"')}resizeMenu(){this.menu.style.width=`${this.box.clientWidth}px`}syncItemsFromValue(){const e=this.getItems(),t=this.getValueAsArray();if(e.map((e=>e.checked=t.includes(e.value))),this.multiple){const r=[];if(t.map((t=>e.map((e=>e.value===t?r.push(e):null)))),this.displayTags=r.map((e=>de("gr-tag",{type:"info",size:this.size,pill:this.pill,clearable:!0,onClick:this.handleTagInteraction,onKeyDown:this.handleTagInteraction,"onGr-clear":t=>{t.stopPropagation(),this.disabled||(e.checked=!1,this.syncValueFromItems())}},this.getItemLabel(e)))),this.maxTagsVisible>0&&this.displayTags.length>this.maxTagsVisible){const e=this.displayTags.length;this.displayLabel="",this.displayTags=this.displayTags.slice(0,this.maxTagsVisible),this.displayTags.push(de("gr-tag",{type:"info",size:this.size,pill:this.pill},"+",e-this.maxTagsVisible))}}else{const r=e.filter((e=>e.value===t[0]))[0];this.displayLabel=r?this.getItemLabel(r):"",this.displayTags=[]}}syncValueFromItems(){const e=this.getItems().filter((e=>e.checked)).map((e=>e.value));this.multiple?this.value=this.value.filter((t=>e.includes(t))):this.value=e.length>0?e[0]:""}render(){var e;const t=this.multiple?this.value.length>0:""!==this.value,r=this.inheritedAttributes["aria-label"]?{"aria-label":this.inheritedAttributes["aria-label"]}:{"aria-labelledby":this.labelId};return((e,t,r,i)=>{let o=e.querySelector("input.aux-input");o||(o=e.ownerDocument.createElement("input"),o.type="hidden",o.classList.add("aux-input"),e.appendChild(o)),o.disabled=i,o.name=t,o.value=r||""})(this.el,this.name,ni(this.value),this.disabled),de(xt,{inputId:this.inputId,label:this.label,labelId:this.labelId,hasLabelSlot:this.hasLabelSlot,helpTextId:this.helpTextId,helpText:this.helpText,hasHelpTextSlot:this.hasHelpTextSlot,invalidTextId:this.invalidTextId,invalidText:this.invalidText,invalid:this.invalid,hasInvalidTextSlot:this.hasInvalidTextSlot,size:this.size,onLabelClick:this.handleLabelClick,requiredIndicator:this.requiredIndicator},de("gr-dropdown",{ref:e=>this.dropdown=e,hoist:this.hoist,closeOnSelect:!this.multiple,containingElement:this.el,class:{select:!0,"select-open":this.isOpen,"select-empty":0===(null===(e=this.value)||void 0===e?void 0:e.length),"select-focused":this.hasFocus,"select-clearable":this.clearable,"select-disabled":this.disabled,"select-multiple":this.multiple,"select-has-tags":this.multiple&&t,"select-placeholder-visible":""===this.displayLabel,[`select-${this.size}`]:!0,"select-pill":this.pill,"select-invalid":this.invalid},"onGr-show":this.handleMenuShow,"onGr-hide":this.handleMenuHide},de("div",Object.assign({slot:"trigger",ref:e=>this.box=e,id:this.inputId,class:"select-box",role:"combobox"},r,{"aria-describedby":this.invalid?this.invalidTextId:this.helpTextId,"aria-haspopup":"true","aria-expanded":this.isOpen?"true":"false","aria-invalid":this.invalid?"true":"false","aria-required":this.requiredIndicator?"true":"false",tabIndex:this.disabled?-1:0,onBlur:this.handleBlur,onFocus:this.handleFocus,onKeyDown:this.handleKeyDown}),de("div",{class:"select-label"},this.displayTags.length?de("span",{class:"select-tags"},this.displayTags):this.displayLabel||this.placeholder),this.clearable&&t&&de("button",{class:"select-clear",type:"button",onClick:this.handleClearClick,"aria-label":"clear",tabindex:"-1"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Close Circle"),de("path",{d:"M448 256c0-106-86-192-192-192S64 150 64 256s86 192 192 192 192-86 192-192z",fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32"}),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M320 320L192 192M192 320l128-128"}))),de("span",{class:"caret"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Chevron Down"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"M112 184l144 144 144-144"}))),de("input",{class:"select-hidden-select","aria-hidden":"true",value:t?"1":"",tabIndex:-1})),de("gr-menu",{ref:e=>this.menu=e,class:"select-menu","onGr-select":this.handleMenuSelect},de("slot",{onSlotchange:this.handleSlotChange}))))}get el(){return this}static get watchers(){return{disabled:["handleDisabledChange"],helpText:["handleLabelChange"],invalidText:["handleLabelChange"],label:["handleLabelChange"],multiple:["handleMultipleChange"],value:["handleValueChange"]}}static get style(){return".form-control .form-control-label{display:none}.form-control .form-control-help-text{display:none}.form-control .form-control-invalid-text{display:none}.form-control-has-label .form-control-label{display:flex;line-height:var(--gr-line-height-normal);color:var(--gr-form-element-label-color);margin-bottom:var(--gr-spacing-xxx-small)}.form-control-has-label.form-control-small .form-control-label{font-size:var(--gr-form-element-label-font-size-small)}.form-control-has-label.form-control-medium .form-control-label{font-size:var(--gr-form-element-label-font-size-medium)}.form-control-has-label.form-control-large .form-control-label{font-size:var(--gr-form-element-label-font-size-large)}.form-control-has-label .form-control-label .asterisk{margin-left:var(--gr-spacing-x-small);color:var(--gr-color-medium)}.form-control-has-label .form-control-label .asterisk svg{width:0.6em;height:0.6em;margin-bottom:var(--gr-spacing-xxx-small)}.form-control-has-help-text .form-control-help-text{display:block;line-height:var(--gr-line-height-normal);color:var(--gr-form-element-help-text-color);margin-top:var(--gr-spacing-xxx-small)}.form-control-has-help-text.form-control-small .form-control-help-text{font-size:var(--gr-form-element-help-text-font-size-small);min-height:1.625rem}.form-control-has-help-text.form-control-medium .form-control-help-text{font-size:var(--gr-form-element-help-text-font-size-medium);min-height:1.875rem}.form-control-has-help-text.form-control-large .form-control-help-text{font-size:var(--gr-form-element-help-text-font-size-large);min-height:2.125rem}.form-control-has-invalid-text .form-control-invalid-text{display:flex;margin-left:-2px;line-height:var(--gr-line-height-normal);color:var(--gr-form-element-invalid-text-color);margin-top:var(--gr-spacing-xxx-small)}.form-control-has-invalid-text .form-control-invalid-text .icon{margin-top:var(--gr-spacing-xxx-small);margin-right:var(--gr-spacing-xx-small)}.form-control-has-invalid-text .form-control-invalid-text .icon svg{width:1.4em;height:1.4em}.form-control-has-invalid-text.form-control-small .form-control-invalid-text{font-size:var(--gr-form-element-invalid-text-font-size-small);min-height:1.625rem}.form-control-has-invalid-text.form-control-medium .form-control-invalid-text{font-size:var(--gr-form-element-invalid-text-font-size-medium);min-height:1.875rem}.form-control-has-invalid-text.form-control-large .form-control-invalid-text{font-size:var(--gr-form-element-invalid-text-font-size-large);min-height:2.125rem}.gr-scroll-lock{overflow:hidden !important}:host{--font-size:var(--gr-form-element-font-size-medium);--font-weight:var(--gr-font-weight-normal);--background-color:var(--gr-color-white);--background-color-hover:var(--gr-color-white);--background-color-focus:var(--gr-color-white);--background-color-invalid:var(--gr-color-white);--background-color-invalid-hover:var(--gr-color-white);--border-radius:var(--gr-form-element-border-radius-small);--border-color:var(--gr-color-light-shade);--border-color-hover:var(--gr-color-medium);--border-color-focus:var(--gr-color-primary);--border-color-invalid:var(--gr-color-danger);--border-color-invalid-hover:var(--gr-color-danger-shade);--color:var(--gr-color-dark-tint);--placeholder-color:var(--gr-color-medium-tint);--min-height:var(--gr-form-element-height-medium);--label-margin-start:var(--gr-spacing-medium);--label-margin-end:var(--gr-spacing-medium);--clear-icon-margin-end:var(--gr-spacing-medium);--caret-margin-end:var(--gr-spacing-medium);--tags-padding-top:3px;--tags-padding-bottom:3px;--tags-margin-end:var(--gr-spacing-xx-small);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33);display:block;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.select-small{--font-size:var(--gr-form-element-font-size-small);--min-height:var(--gr-form-element-height-small);--label-margin-start:var(--gr-spacing-small);--label-margin-end:var(--gr-spacing-small);--clear-icon-margin-end:var(--gr-spacing-small);--caret-margin-end:var(--gr-spacing-small);--tags-padding-top:2px;--tags-padding-bottom:2px}.select-large{--font-size:var(--gr-form-element-font-size-large);--min-height:var(--gr-form-element-height-large);--label-margin-start:var(--gr-spacing-large);--label-margin-end:var(--gr-spacing-large);--clear-icon-margin-end:var(--gr-spacing-large);--caret-margin-end:var(--gr-spacing-large);--tags-padding-top:4px;--tags-padding-bottom:4px}.select{display:block}.select-box{display:inline-flex;align-items:center;justify-content:start;position:relative;width:100%;font-family:var(--gr-font-family);font-size:var(--font-size);font-weight:var(--font-weight);letter-spacing:normal;background-color:var(--background-color);border:solid 1px var(--border-color);border-radius:var(--border-radius);min-height:var(--min-height);color:var(--color);vertical-align:middle;overflow:hidden;transition:150ms color, 150ms border, 150ms box-shadow;cursor:pointer}.select.select-invalid:not(.select-disabled) .select-box{background-color:var(--background-color-invalid);border-color:var(--border-color-invalid)}.select.select-invalid:not(.select-disabled):not(.select-focused) .select-box:hover{background-color:var(--background-color-invalid-hover);border-color:var(--border-color-invalid-hover)}.select.select-invalid:not(.select-disabled) .select-box{background-color:var(--background-color-invalid);border-color:var(--border-color-invalid)}.select:not(.select-disabled) .select-box:hover{background-color:var(--background-color-hover);border-color:var(--border-color-hover)}.select.select-focused:not(.select-disabled) .select-box{outline:none;box-shadow:var(--focus-ring);border-color:var(--border-color-focus);background-color:var(--background-color-focus)}.select-disabled .select-box{opacity:0.5;cursor:not-allowed;outline:none}.select-disabled .select-tags,.select-disabled .select-clear{pointer-events:none}.select-label{flex:1 1 auto;display:flex;align-items:center;user-select:none;margin-top:0;margin-left:var(--label-margin-start);margin-right:var(--label-margin-end);margin-bottom:0;scrollbar-width:none;-ms-overflow-style:none;overflow-x:auto;overflow-y:hidden;white-space:nowrap}.select-label::-webkit-scrollbar{width:0;height:0}.select-has-tags .select-label{margin-left:0}.select-clear{display:inline-flex;align-items:center;font-size:inherit;color:var(--gr-color-medium);border:none;background:none;padding:0;transition:150ms color;cursor:pointer;margin-right:var(--clear-icon-margin-end)}.select-clear:hover{color:var(--gr-color-dark)}.select-clear:focus{outline:none}.select-clear svg{width:1.2em;height:1.2em;font-size:var(--font-size)}.caret{flex:0 0 auto;display:inline-flex;transition:250ms transform ease;margin-right:var(--caret-margin-end)}.caret svg{width:1em;height:1em;font-size:var(--font-size)}.select-open .caret{transform:rotate(-180deg)}.select-placeholder-visible .select-label{color:var(--placeholder-color)}.select-tags{display:inline-flex;align-items:center;flex-wrap:wrap;justify-content:left;margin-left:var(--gr-spacing-xx-small);padding-bottom:var(--tags-padding-bottom)}.select-tags gr-tag{padding-top:var(--tags-padding-top)}.select-tags gr-tag:not(:last-of-type){margin-right:var(--tags-margin-end)}.select-hidden-select{clip:rect(0 0 0 0);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px;position:absolute;top:0;left:0;width:100%;height:100%}.select-pill .select-box{border-radius:var(--min-height)}"}},[1,"gr-select",{multiple:[4],maxTagsVisible:[2,"max-tags-visible"],disabled:[4],name:[1],placeholder:[1],size:[1],hoist:[4],value:[1025],pill:[4],label:[1],requiredIndicator:[4,"required-indicator"],helpText:[1,"help-text"],invalidText:[1,"invalid-text"],invalid:[516],clearable:[4],hasFocus:[32],hasHelpTextSlot:[32],hasInvalidTextSlot:[32],hasLabelSlot:[32],isOpen:[32],items:[32],displayLabel:[32],displayTags:[32],setFocus:[64]}]),ni=e=>{if(null!=e)return Array.isArray(e)?e.join(","):e.toString()};!function(){if("undefined"==typeof customElements)return;["gr-select","gr-button","gr-dropdown","gr-menu","gr-spinner","gr-tag"].forEach((e=>{switch(e){case"gr-select":customElements.get(e)||customElements.define(e,oi);break;case"gr-button":customElements.get(e)||St();break;case"gr-dropdown":customElements.get(e)||Xr();break;case"gr-menu":customElements.get(e)||Jr();break;case"gr-spinner":customElements.get(e)||Et();break;case"gr-tag":customElements.get(e)||ti()}}))}();const ai=oi,si=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.hasFocus=!1,this.checked=!1,this.value="",this.disabled=!1}connectedCallback(){this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleMouseEnter=this.handleMouseEnter.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this)}async setFocus(e){this.el.focus(e)}async removeFocus(){this.el.blur()}handleBlur(){this.hasFocus=!1}handleFocus(){this.hasFocus=!0}handleMouseEnter(){this.setFocus()}handleMouseLeave(){this.removeFocus()}render(){return de(ge,{class:{"menu-item-checked":this.checked,"menu-item-disabled":this.disabled,"menu-item-focused":this.hasFocus},role:"menuitem","aria-disabled":this.disabled?"true":"false","aria-checked":this.checked?"true":"false",tabIndex:this.disabled?null:0,onFocus:this.handleFocus,onBlur:this.handleBlur,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave},de("span",{class:"checkmark"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Checkmark"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M416 128L192 384l-96-96"}))),de("span",{class:"start"},de("slot",{name:"start"})),de("span",{class:"label"},de("slot",null)),de("span",{class:"end"},de("slot",{name:"end"})))}get el(){return this}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{--line-height:var(--gr-line-height-normal);--background-color:transparent;--background-color-focused:var(--gr-color-primary);--color:var(--gr-color-dark);--color-focused:var(--gr-color-primary-contrast);--color-disabled:var(--gr-color-medium);--padding-top:var(--gr-spacing-xx-small);--padding-start:var(--gr-spacing-x-large);--padding-end:var(--gr-spacing-x-large);--padding-bottom:var(--gr-spacing-xx-small);--transition:background-color 150ms linear, color 150ms linear;position:relative;display:flex;align-items:stretch;font-family:var(--gr-font-family);font-size:var(--gr-font-size-medium);font-weight:var(--gr-font-weight-normal);line-height:var(--line-height);letter-spacing:var(--gr-letter-spacing-normal);text-align:left;background-color:var(--background-color);color:var(--color);padding-top:var(--padding-top);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-bottom:var(--padding-bottom);transition:var(--transition);user-select:none;white-space:nowrap;cursor:pointer;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host(.menu-item-focused:not(.menu-item-disabled)){outline:none;background-color:var(--background-color-focused);color:var(--color-focused)}:host(.menu-item-disabled){outline:none;color:var(--color-disabled);cursor:not-allowed}.checkmark{display:flex;position:absolute;left:0.5em;top:calc(50% - 0.5em);visibility:hidden;align-items:center;font-size:inherit}.checkmark svg{display:inline-block;width:1.1em;height:1.1em;contain:strict;fill:currentcolor;box-sizing:content-box !important}:host(.menu-item-checked) .checkmark{visibility:visible}.label{flex:1 1 auto}.start{flex:0 0 auto;display:flex;align-items:center}.start ::slotted(:last-child){margin-right:0.5em}.end{flex:0 0 auto;display:flex;align-items:center}.end ::slotted(:first-child){margin-left:0.5em}"}},[1,"gr-menu-item",{checked:[516],value:[513],disabled:[516],hasFocus:[32],setFocus:[64],removeFocus:[64]}]); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */!function(){if("undefined"==typeof customElements)return;["gr-menu-item"].forEach((e=>{if("gr-menu-item"===e)customElements.get(e)||customElements.define(e,si)}))}();const li={"gr-select":ai,"gr-menu-item":si};class ci extends(P(_)){constructor(){super(...arguments),this.value=null,this.multiple=!1,this.clearable=!1,this._refSelect=y()}reset(){this.value=null}_valueChangedHandler(e){const t=this._refSelect.value?.value;if(void 0!==t&&!l(this.value,t)){const e=null===this.value;this.value=t,e||w(this,"select:change",t)}}willUpdate(e){e.has("initialValue")&&this.initialValue&&!this.value&&(this.value=this.initialValue)}render(){return $` + ${this.options?.map((e=>$`${e.label}`))} + `}static get styles(){return k(':root, :host {\n --gr-color-primary: #1079b2;\n --gr-color-primary-rgb: 16, 121, 178;\n --gr-color-primary-contrast: #ffffff;\n --gr-color-primary-contrast-rgb: 255, 255, 255;\n --gr-color-primary-shade: #0d6696;\n --gr-color-primary-tint: #1499e1;\n --gr-color-secondary: #051f2c;\n --gr-color-secondary-rgb: 5, 31, 44;\n --gr-color-secondary-contrast: #ffffff;\n --gr-color-secondary-contrast-rgb: 255, 255, 255;\n --gr-color-secondary-shade: #000000;\n --gr-color-secondary-tint: #0a415c;\n --gr-color-tertiary: #0c4a6e;\n --gr-color-tertiary-rgb: 12, 74, 110;\n --gr-color-tertiary-contrast: #ffffff;\n --gr-color-tertiary-contrast-rgb: 255, 255, 255;\n --gr-color-tertiary-shade: #083249;\n --gr-color-tertiary-tint: #106393;\n --gr-color-success: #0fbe78;\n --gr-color-success-rgb: 15, 190, 120;\n --gr-color-success-contrast: #000000;\n --gr-color-success-contrast-rgb: 0, 0, 0;\n --gr-color-success-shade: #057f4e;\n --gr-color-success-tint: #12e28f;\n --gr-color-warning: #fbbc4e;\n --gr-color-warning-rgb: 251, 188, 78;\n --gr-color-warning-contrast: #051f2c;\n --gr-color-warning-contrast-rgb: 5, 31, 44;\n --gr-color-warning-shade: #9e6400;\n --gr-color-warning-tint: #fdd187;\n --gr-color-danger: #e60017;\n --gr-color-danger-rgb: 230, 0, 23;\n --gr-color-danger-contrast: #ffffff;\n --gr-color-danger-contrast-rgb: 255, 255, 255;\n --gr-color-danger-shade: #cc0014;\n --gr-color-danger-tint: #ff1f35;\n --gr-color-light: #f4f5f8;\n --gr-color-light-rgb: 244, 245, 248;\n --gr-color-light-contrast: #051f2c;\n --gr-color-light-contrast-rgb: 5, 31, 44;\n --gr-color-light-shade: #d7d8da;\n --gr-color-light-tint: #f9fafb;\n --gr-color-medium: #5e6c78;\n --gr-color-medium-rgb: 94, 108, 120;\n --gr-color-medium-contrast: #ffffff;\n --gr-color-medium-contrast-rgb: 255, 255, 255;\n --gr-color-medium-shade: #48535b;\n --gr-color-medium-tint: #81909c;\n --gr-color-dark: #02131b;\n --gr-color-dark-rgb: 2, 19, 27;\n --gr-color-dark-contrast: #ffffff;\n --gr-color-dark-contrast-rgb: 255, 255, 255;\n --gr-color-dark-shade: #000000;\n --gr-color-dark-tint: #222428;\n --gr-color-white: #ffffff;\n --gr-color-black: #000000;\n --gr-border-radius-small: 0.125rem;\n --gr-border-radius-medium: 0.25rem;\n --gr-border-radius-large: 0.5rem;\n --gr-border-radius-x-large: 1rem;\n --gr-border-width-small: 0.063rem;\n --gr-border-width-medium: 0.125rem;\n --gr-border-width-large: 0.188rem;\n --gr-shadow-x-small: 0 1px 0 #0d131e0d;\n --gr-shadow-small: 0 1px 2px #0d131e1a;\n --gr-shadow-medium: 0 2px 4px #0d131e1a;\n --gr-shadow-large: 0 2px 8px #0d131e1a;\n --gr-shadow-x-large: 0 4px 16px #0d131e1a;\n --gr-spacing-xxx-small: 0.125rem;\n --gr-spacing-xx-small: 0.25rem;\n --gr-spacing-x-small: 0.5rem;\n --gr-spacing-small: 0.75rem;\n --gr-spacing-medium: 1rem;\n --gr-spacing-large: 1.25rem;\n --gr-spacing-x-large: 1.75rem;\n --gr-spacing-xx-large: 2.25rem;\n --gr-spacing-xxx-large: 3rem;\n --gr-spacing-xxxx-large: 4.5rem;\n --gr-font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,\n sans-serif;\n --gr-letter-spacing-dense: -0.015em;\n --gr-letter-spacing-normal: normal;\n --gr-letter-spacing-loose: 0.075em;\n --gr-line-height-dense: 1.4;\n --gr-line-height-normal: 1.8;\n --gr-line-height-loose: 2.2;\n --gr-font-size-xx-small: 0.625rem;\n --gr-font-size-x-small: 0.75rem;\n --gr-font-size-small: 0.875rem;\n --gr-font-size-medium: 1rem;\n --gr-font-size-large: 1.25rem;\n --gr-font-size-x-large: 1.5rem;\n --gr-font-size-xx-large: 2.25rem;\n --gr-font-size-xxx-large: 3rem;\n --gr-font-size-xxxx-large: 4.5rem;\n --gr-font-weight-thin: 100;\n --gr-font-weight-extra-light: 200;\n --gr-font-weight-light: 300;\n --gr-font-weight-normal: 400;\n --gr-font-weight-medium: 500;\n --gr-font-weight-semi-bold: 600;\n --gr-font-weight-bold: 700;\n --gr-font-weight-extra-bold: 800;\n --gr-font-weight-black: 900;\n --gr-form-element-font-size-x-small: var(--gr-font-size-x-small);\n --gr-form-element-font-size-small: var(--gr-font-size-small);\n --gr-form-element-font-size-medium: var(--gr-font-size-medium);\n --gr-form-element-font-size-large: var(--gr-font-size-large);\n --gr-form-element-height-small: 2.188rem;\n --gr-form-element-height-medium: 3.125rem;\n --gr-form-element-height-large: 4.063rem;\n --gr-form-element-border-radius-small: var(--gr-border-radius-medium);\n --gr-form-element-border-radius-medium: var(--gr-border-radius-medium);\n --gr-form-element-border-radius-large: var(--gr-border-radius-medium);\n --gr-focus-ring-width: 2px;\n --gr-form-element-label-font-size-small: var(--gr-font-size-small);\n --gr-form-element-label-font-size-medium: var(--gr-font-size-medium);\n --gr-form-element-label-font-size-large: var(--gr-font-size-large);\n --gr-form-element-label-color: inherit;\n --gr-form-element-help-text-font-size-small: var(--gr-font-size-x-small);\n --gr-form-element-help-text-font-size-medium: var(--gr-font-size-small);\n --gr-form-element-help-text-font-size-large: var(--gr-font-size-medium);\n --gr-form-element-help-text-color: var(--gr-color-medium);\n --gr-form-element-invalid-text-font-size-small: var(--gr-font-size-x-small);\n --gr-form-element-invalid-text-font-size-medium: var(--gr-font-size-small);\n --gr-form-element-invalid-text-font-size-large: var(--gr-font-size-medium);\n --gr-form-element-invalid-text-color: var(--gr-color-danger);\n --gr-toggle-size: 1rem;\n --gr-panel-border-color: var(--gr-color-light-shade);\n --gr-z-index-dropdown: 900;\n}\n\n')}}ci.elementDefinitions={...li},f([v({attribute:!1,hasChanged:b})],ci.prototype,"options",void 0),f([v({attribute:!1,hasChanged:b})],ci.prototype,"value",void 0),f([v({attribute:!1,hasChanged:b})],ci.prototype,"initialValue",void 0),f([v({attribute:!0})],ci.prototype,"label",void 0),f([v({attribute:!0})],ci.prototype,"placeholder",void 0),f([v({attribute:!0,type:Boolean})],ci.prototype,"multiple",void 0),f([v({attribute:!0,type:Boolean})],ci.prototype,"clearable",void 0);let di=class extends(P(_)){constructor(){super(...arguments),this._mediaFilterController=new U(this),this._refMediaType=y(),this._refCamera=y(),this._refWhen=y(),this._refWhenFrom=y(),this._refWhenTo=y(),this._refWhat=y(),this._refWhere=y(),this._refFavorite=y(),this._refTags=y()}willUpdate(e){e.has("viewManagerEpoch")&&this._mediaFilterController.setViewManager(this.viewManagerEpoch?.manager??null),e.has("cameraManager")&&this.cameraManager&&(this._mediaFilterController.computeCameraOptions(this.cameraManager),this._mediaFilterController.computeMetadataOptions(this.cameraManager)),!e.get("viewManager")&&this.viewManagerEpoch&&this.cameraManager&&this._mediaFilterController.computeInitialDefaultsFromView(this.cameraManager)}render(){const e=async()=>{this.cameraManager&&this.viewManagerEpoch&&this.cardWideConfig&&await this._mediaFilterController.valueChangeHandler(this.cameraManager,this.cardWideConfig,{camera:this._refCamera.value?.value??void 0,mediaType:this._refMediaType.value?.value??void 0,when:{selected:this._refWhen.value?.value??void 0,from:this._refWhenFrom.value?.value,to:this._refWhenTo.value?.value},favorite:this._refFavorite.value?.value??void 0,where:this._refWhere.value?.value??void 0,what:this._refWhat.value?.value??void 0,tags:this._refTags.value?.value??void 0})},t=async t=>{"custom"===t&&this._refWhen.value?this._refWhenFrom.value?.value||this._refWhenTo.value?.value?this._refWhen.value.value=B.Custom:this._refWhen.value.reset():this._refWhen.value?.value!==B.Custom&&(this._refWhenFrom.value?.reset(),this._refWhenTo.value?.reset()),await e()};if(!this.cameraManager||!this.viewManagerEpoch)return;const r=this._mediaFilterController.getControlsToShow(this.cameraManager),o=this._mediaFilterController.getDefaults(),n=this._mediaFilterController.getWhatOptions(),a=this._mediaFilterController.getTagsOptions(),s=this._mediaFilterController.getWhereOptions();return $` e()} + > + +
+ t("selected")} + > + + t("custom")} + > + + t("custom")} + > + +
+ e()} + > + + ${r.events&&n.length?$` e()} + > + `:""} + ${r.events&&a.length?$` e()} + > + `:""} + ${r.events&&s.length?$` e()} + > + `:""} + ${r.favorites?$` + e()} + > + + `:""}`}static get styles(){return k(":host {\n display: flex;\n flex-direction: column;\n overflow: auto;\n scrollbar-width: none;\n -ms-overflow-style: none;\n height: 100%;\n width: 300px;\n margin: 5px;\n}\n\n/* Hide scrollbar for Chrome, Safari and Opera */\n:host::-webkit-scrollbar {\n display: none;\n}\n\nfrigate-card-select {\n padding: 5px;\n}\n\ndiv.when {\n display: inline-flex;\n align-items: flex-end;\n}\n\ndiv.when frigate-card-select {\n flex: 1;\n}\n\ndiv.when frigate-card-date-picker {\n padding-bottom: 5px;\n transition: width 0.5s ease-in-out;\n}\n\ndiv.when frigate-card-date-picker {\n color: var(--secondary-color);\n}\n\ndiv.when frigate-card-date-picker.selected {\n color: var(--primary-color);\n}\n\ndiv.when frigate-card-date-picker.hidden {\n width: 0px;\n}")}};di.elementDefinitions={"frigate-card-select":ci,"frigate-card-date-picker":R},f([v({attribute:!1})],di.prototype,"hass",void 0),f([v({attribute:!1})],di.prototype,"cameraManager",void 0),f([v({attribute:!1})],di.prototype,"viewManagerEpoch",void 0),f([v({attribute:!1})],di.prototype,"cardWideConfig",void 0),di=f([C("frigate-card-media-filter")],di);const hi={closed:"mdi:filter-cog-outline",open:"mdi:filter-cog"};let gi=class extends _{render(){const e=this.viewManagerEpoch?.manager.getView();if(this.hass&&e?.isGalleryView()&&this.cameraManager&&this.cardWideConfig)return $` + + ${this.galleryConfig&&"none"!==this.galleryConfig.controls.filter.mode?$` + `:""} + + + + `}static get styles(){return k(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\nfrigate-card-surround-basic {\n max-height: 110dvh;\n}")}};f([v({attribute:!1})],gi.prototype,"hass",void 0),f([v({attribute:!1})],gi.prototype,"viewManagerEpoch",void 0),f([v({attribute:!1})],gi.prototype,"galleryConfig",void 0),f([v({attribute:!1})],gi.prototype,"cameraManager",void 0),f([v({attribute:!1})],gi.prototype,"cardWideConfig",void 0),gi=f([C("frigate-card-gallery")],gi);let ui=class extends _{constructor(){super(),this._refLoaderBottom=y(),this._refSelected=y(),this._showLoaderBottom=!0,this._showLoaderTop=!1,this._boundWheelHandler=this._wheelHandler.bind(this),this._boundTouchStartHandler=this._touchStartHandler.bind(this),this._boundTouchEndHandler=this._touchEndHandler.bind(this),this._throttleExtendGalleryLater=O(this._extendGallery.bind(this),500,{leading:!0,trailing:!1}),this._touchScrollYPosition=null,this._resizeObserver=new ResizeObserver(this._resizeHandler.bind(this)),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}_touchStartHandler(e){1===e.touches.length?this._touchScrollYPosition=e.touches[0].screenY:this._touchScrollYPosition=null}async _touchEndHandler(e){!this.scrollTop&&1===e.changedTouches.length&&this._touchScrollYPosition&&e.changedTouches[0].screenY>this._touchScrollYPosition&&await this._extendLater(),this._touchScrollYPosition=null}async _wheelHandler(e){!this.scrollTop&&e.deltaY<0&&await this._extendLater()}async _extendLater(){const e=new Date;this._showLoaderTop=!0,await this._throttleExtendGalleryLater("later",!1);const t=(new Date).getTime()-e.getTime();t<500&&await S(.5-t/1e3),this._showLoaderTop=!1}connectedCallback(){super.connectedCallback(),this._resizeObserver.observe(this),this.addEventListener("wheel",this._boundWheelHandler,{passive:!0}),this.addEventListener("touchstart",this._boundTouchStartHandler,{passive:!0}),this.addEventListener("touchend",this._boundTouchEndHandler),this.requestUpdate()}disconnectedCallback(){this.removeEventListener("wheel",this._boundWheelHandler),this.removeEventListener("touchstart",this._boundTouchStartHandler),this.removeEventListener("touchend",this._boundTouchEndHandler),this._resizeObserver.disconnect(),this._intersectionObserver.disconnect(),super.disconnectedCallback()}_setColumnCount(){const e=this.galleryConfig?.controls.thumbnails.size??M.media_gallery.controls.thumbnails.size,t=this.galleryConfig?.controls.thumbnails.show_details?Math.max(1,Math.floor(this.clientWidth/z)):Math.max(1,Math.ceil(this.clientWidth/e));this.style.setProperty("--frigate-card-gallery-columns",String(t))}_resizeHandler(){this._setColumnCount()}async _intersectionHandler(e){e.every((e=>!e.isIntersecting))||(this._showLoaderBottom=!1,await this._extendGallery("earlier"))}async _extendGallery(e,t=!0){const r=this.viewManagerEpoch?.manager.getView();if(!this.cameraManager||!this.hass||!r)return;const i=r.query,n=i?.getQueries()??null,s=r.queryResults?.getResults();if(!i||!n||!s)return;let l;try{l=await this.cameraManager.extendMediaQueries(n,s,e,{useCache:t})}catch(e){return void d(e)}if(l){const e=c.areEventQueries(i)?new o(l.queries):c.areRecordingQueries(i)?new a(l.queries):null;e&&this.viewManagerEpoch?.manager.setViewByParameters({baseView:r,params:{query:e,queryResults:new L({results:l.results}).selectResultIfFound((e=>e===r.queryResults?.getSelectedResult()))}})}}willUpdate(e){if(e.has("galleryConfig")&&(this.galleryConfig?.controls.thumbnails.show_details?this.setAttribute("details",""):this.removeAttribute("details"),this._setColumnCount(),this.galleryConfig?.controls.thumbnails.size&&this.style.setProperty("--frigate-card-thumbnail-size",`${this.galleryConfig.controls.thumbnails.size}px`)),e.has("viewManagerEpoch")){this._showLoaderBottom=!0;const e=this.viewManagerEpoch?.manager.getView(),t=this.viewManagerEpoch?.oldView;this._media&&t?.queryResults?.getResults()===e?.queryResults?.getResults()||(this._media=[...e?.queryResults?.getResults()??[]].reverse())}}render(){if(!this._media||!this.hass)return $``;const e=this.viewManagerEpoch?.manager.getView();if(!e?.queryResults||0===e.queryResults.getResultsCount()){const t=!!e?.context?.loading?.query;return D({type:"info",message:i(t?"error.awaiting_media":"common.no_media"),icon:"mdi:multimedia",dotdotdot:t})}const t=e.queryResults.getSelectedResult();return $`
+ ${this._showLoaderTop?$`${A({cardWideConfig:this.cardWideConfig,classes:{top:!0},size:"small"})}`:""} + ${this._media.map(((r,i)=>$`{this._media&&this.viewManagerEpoch?.manager.setViewByParameters({params:{view:"media",queryResults:e.queryResults?.clone().selectIndex(this._media.length-i-1)}}),F(t)}} + > + `))} + ${this._showLoaderBottom?$`${A({cardWideConfig:this.cardWideConfig,componentRef:this._refLoaderBottom})}`:""} +
`}updated(e){this._refLoaderBottom.value&&(this._intersectionObserver.disconnect(),this._intersectionObserver.observe(this._refLoaderBottom.value)),this.updateComplete.then((()=>{e.has("viewManagerEpoch")&&!e.get("viewManagerEpoch")&&this._refSelected.value&&this._refSelected.value.scrollIntoView({block:"center"})}))}static get styles(){return k(":host {\n width: 100%;\n height: 100%;\n display: block;\n overflow: auto;\n -ms-overflow-style: none;\n scrollbar-width: none;\n --frigate-card-gallery-gap: 3px;\n --frigate-card-gallery-columns: 4;\n}\n\n.grid {\n display: grid;\n grid-template-columns: repeat(var(--frigate-card-gallery-columns), minmax(0, 1fr));\n grid-auto-rows: min-content;\n gap: var(--frigate-card-gallery-gap);\n}\n\n:host::-webkit-scrollbar {\n display: none;\n}\n\nfrigate-card-thumbnail {\n height: 100%;\n max-height: var(--frigate-card-thumbnail-size);\n}\n\nfrigate-card-thumbnail:not([details]) {\n width: 100%;\n}\n\nfrigate-card-thumbnail.selected {\n border: 4px solid var(--accent-color);\n border-radius: calc(var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px)) + 4px);\n}\n\nfrigate-card-progress-indicator.top {\n grid-column: 1/-1;\n}")}};f([v({attribute:!1})],ui.prototype,"hass",void 0),f([v({attribute:!1})],ui.prototype,"viewManagerEpoch",void 0),f([v({attribute:!1})],ui.prototype,"galleryConfig",void 0),f([v({attribute:!1})],ui.prototype,"cameraManager",void 0),f([v({attribute:!1})],ui.prototype,"cardWideConfig",void 0),f([E()],ui.prototype,"_showLoaderBottom",void 0),f([E()],ui.prototype,"_showLoaderTop",void 0),ui=f([C("frigate-card-gallery-core")],ui);export{gi as FrigateCardGallery,ui as FrigateCardGalleryCore}; diff --git a/config/www/community/frigate-hass-card/gallery-149d4f41.js.gz b/config/www/community/frigate-hass-card/gallery-149d4f41.js.gz new file mode 100644 index 00000000..1a315d42 Binary files /dev/null and b/config/www/community/frigate-hass-card/gallery-149d4f41.js.gz differ diff --git a/config/www/community/frigate-hass-card/gallery-15a600d2.js b/config/www/community/frigate-hass-card/gallery-15a600d2.js new file mode 100644 index 00000000..0d0aa6f6 --- /dev/null +++ b/config/www/community/frigate-hass-card/gallery-15a600d2.js @@ -0,0 +1,184 @@ +import{d3 as e,d4 as t,d5 as r,l as i,d6 as o,d7 as n,d8 as a,d9 as s,i as l,da as c,db as d,k as h,dc as g,dd as u,de as m,df as p,_ as f,n as v,cW as b,cR as y,dg as w,x as $,cV as x,r as k,a as _,t as C,e as T,b as E,dh as O,di as S,cI as M,dj as z,dk as L,cU as D,dl as A,c$ as F}from"./card-769e2b91.js";import{e as I}from"./endOfDay-696ac7f4.js";import{p as W}from"./parse-7dfc1897.js";import{F as R}from"./date-picker-8102261e.js";function N(t){const r=e(t),i=r.getMonth();return r.setFullYear(r.getFullYear(),i+1,0),r.setHours(23,59,59,999),r}function H(){const e=new Date,t=e.getFullYear(),r=e.getMonth(),i=e.getDate(),o=new Date(0);return o.setFullYear(t,r,i-1),o.setHours(23,59,59,999),o}function V(){const e=new Date,t=e.getFullYear(),r=e.getMonth(),i=e.getDate(),o=new Date(0);return o.setFullYear(t,r,i-1),o.setHours(0,0,0,0),o}var j,B,q; +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +function P(e){return class extends e{createRenderRoot(){const e=this.constructor,{registry:t,elementDefinitions:i,shadowRootOptions:o}=e;i&&!t&&(e.registry=new CustomElementRegistry,Object.entries(i).forEach((([t,r])=>e.registry.define(t,r))));const n=this.renderOptions.creationScope=this.attachShadow({...o,customElements:e.registry});return r(n,this.constructor.elementStyles),n}}}!function(e){e.Favorite="favorite",e.NotFavorite="not-favorite"}(j||(j={})),function(e){e.Today="today",e.Yesterday="yesterday",e.PastWeek="past-week",e.PastMonth="past-month",e.Custom="custom"}(B||(B={})),function(e){e.Clips="clips",e.Snapshots="snapshots",e.Recordings="recordings"}(q||(q={}));class U{constructor(e){this._cameraOptions=[],this._whenOptions=[],this._metaDataWhenOptions=[],this._whatOptions=[],this._whereOptions=[],this._tagsOptions=[],this._defaults=null,this._viewManager=null,this._host=e,this._favoriteOptions=[{value:j.Favorite,label:i("media_filter.favorite")},{value:j.NotFavorite,label:i("media_filter.not_favorite")}],this._mediaTypeOptions=[{value:q.Clips,label:i("media_filter.media_types.clips")},{value:q.Snapshots,label:i("media_filter.media_types.snapshots")},{value:q.Recordings,label:i("media_filter.media_types.recordings")}],this._staticWhenOptions=[{value:B.Today,label:i("media_filter.whens.today")},{value:B.Yesterday,label:i("media_filter.whens.yesterday")},{value:B.PastWeek,label:i("media_filter.whens.past_week")},{value:B.PastMonth,label:i("media_filter.whens.past_month")},{value:B.Custom,label:i("media_filter.whens.custom")}],this._computeWhenOptions()}getMediaTypeOptions(){return this._mediaTypeOptions}getCameraOptions(){return this._cameraOptions}getWhenOptions(){return this._whenOptions}getWhatOptions(){return this._whatOptions}getWhereOptions(){return this._whereOptions}getTagsOptions(){return this._tagsOptions}getFavoriteOptions(){return this._favoriteOptions}getDefaults(){return this._defaults}setViewManager(e){this._viewManager=e}async valueChangeHandler(e,t,r,i){const s=e=>e&&Array.isArray(e)&&e.length&&!e.includes("")?new Set([...e]):null,l=s(r.camera)??this._getAllCameraIDs(e);if(!l.size||!r.mediaType)return;const c=this._getWhen(r.when),d=r.favorite?r.favorite===j.Favorite:null,h=t.performance?.features.media_chunk_size;if(r.mediaType===q.Clips||r.mediaType===q.Snapshots){const e=s(r.where),t=s(r.what),i=s(r.tags),a=new o([{type:n.Event,cameraIDs:l,...i&&{tags:i},...t&&{what:t},...e&&{where:e},...null!==d&&{favorite:d},...c&&{...c.start&&{start:c.start},...c.end&&{end:c.end}},...h&&{limit:h},...r.mediaType===q.Clips&&{hasClip:!0},...r.mediaType===q.Snapshots&&{hasSnapshot:!0}}]);this._viewManager?.setViewByParametersWithExistingQuery({params:{query:a,...1===l.size&&{camera:[...l][0]},view:r.mediaType===q.Clips?"clips":"snapshots"}})}else{const e=new a([{type:n.Recording,cameraIDs:l,...h&&{limit:h},...c&&{...c.start&&{start:c.start},...c.end&&{end:c.end}},...null!==d&&{favorite:d}}]);this._viewManager?.setViewByParametersWithExistingQuery({params:{query:e,...1===l.size&&{camera:[...l][0]},view:"recordings"}})}this._host.requestUpdate()}_getAllCameraIDs(e){return e.getStore().getCameraIDsWithCapability({anyCapabilities:["clips","snapshots","recordings"]})}computeInitialDefaultsFromView(e){const t=this._viewManager?.getView(),r=t?.query?.getQueries(),i=this._getAllCameraIDs(e);if(!t||!r||!i.size)return;let o,n,a,d,h,g;1!==s(r.map((e=>e.cameraIDs)),l).length||l(r[0].cameraIDs,i)||(n=[...r[0].cameraIDs]); +/* istanbul ignore else: the else path cannot be reached -- @preserve */ +if(1===s(r.map((e=>e.favorite)),l).length&&void 0!==r[0].favorite&&(h=r[0].favorite?j.Favorite:j.NotFavorite),c.areEventQueries(t.query)){const e=t.query.getQueries(); +/* istanbul ignore if: the if path cannot be reached -- @preserve */if(!e)return;const r=s(e.map((e=>e.hasClip)),l),i=s(e.map((e=>e.hasSnapshot)),l);1===r.length&&1===i.length&&(o=r[0]?q.Clips:i[0]?q.Snapshots:void 0);1===s(e.map((e=>e.what)),l).length&&e[0].what?.size&&(a=[...e[0].what]);1===s(e.map((e=>e.where)),l).length&&e[0].where?.size&&(d=[...e[0].where]);1===s(e.map((e=>e.tags)),l).length&&e[0].tags?.size&&(g=[...e[0].tags])}else c.areRecordingQueries(t.query)&&(o=q.Recordings);this._defaults={...o&&{mediaType:o},...n&&{cameraIDs:n},...a&&{what:a},...d&&{where:d},...void 0!==h&&{favorite:h},...g&&{tags:g}}}computeCameraOptions(e){this._cameraOptions=[...this._getAllCameraIDs(e)].map((t=>({value:t,label:e.getCameraMetadata(t)?.title??t})))}async computeMetadataOptions(e){let t=null;try{t=await e.getMediaMetadata()}catch(e){d(e)}if(t){if(t.what&&(this._whatOptions=[...t.what].sort().map((e=>({value:e,label:h(e)})))),t.where&&(this._whereOptions=[...t.where].sort().map((e=>({value:e,label:h(e)})))),t.tags&&(this._tagsOptions=[...t.tags].sort().map((e=>({value:e,label:h(e)})))),t.days){const e=new Set;[...t.days].forEach((t=>{e.add(t.substring(0,7))}));const r=[];e.forEach((e=>{r.push(W(e,"yyyy-MM",new Date))})),this._metaDataWhenOptions=g(r,(e=>e.getTime()),"desc").map((e=>({label:u(e,"MMMM yyyy"),value:this._dateRangeToString({start:e,end:N(e)})}))),this._computeWhenOptions()}this._host.requestUpdate()}}getControlsToShow(e){const t=this._viewManager?.getView(),r=c.areEventQueries(t?.query),i=c.areRecordingQueries(t?.query),o=e.getAggregateCameraCapabilities();return{events:r,recordings:i,favorites:r?o?.has("favorite-events"):!!i&&o?.has("favorite-recordings")}}_computeWhenOptions(){this._whenOptions=[...this._staticWhenOptions,...this._metaDataWhenOptions]}_dateRangeToString(e){return`${m(e.start)},${m(e.end)}`}_stringToDateRange(e){const t=e.split(",");return{start:W(t[0],"yyyy-MM-dd",new Date),end:I(W(t[1],"yyyy-MM-dd",new Date))}}_getWhen(e){if(e.from||e.to)return{...e.from&&{start:e.from},...e.to&&{end:e.to}};if(!e.selected||Array.isArray(e.selected))return null;const r=new Date;switch(e.selected){case B.Custom:return null;case B.Today:return{start:t(Date.now()),end:I(Date.now())};case B.Yesterday:return{start:V(),end:H()};case B.PastWeek:return{start:t(p(r,{days:7})),end:I(r)};case B.PastMonth:return{start:t(p(r,{months:1})),end:I(r)};default:return this._stringToDateRange(e.selected)}}}const K=!0,Y=!0,Q=!0,G=!1,X=!1;let Z,J,ee,te=!1,re=!1,ie=!1,oe=!1,ne=null,ae=!1;const se="http://www.w3.org/1999/xlink",le={},ce=e=>"object"===(e=typeof e)||"function"===e;const de=(e,t,...r)=>{let i=null,o=null,n=null,a=!1,s=!1;const l=[],c=t=>{for(let r=0;re[t])).join(" "))}}if("function"==typeof e)return e(null===t?{}:t,l,ue);const d=he(e,null);return d.$attrs$=t,l.length>0&&(d.$children$=l),d.$key$=o,d.$name$=n,d},he=(e,t)=>{const r={$flags$:0,$tag$:e,$text$:t,$elm$:null,$children$:null,$attrs$:null,$key$:null,$name$:null};return r},ge={},ue={forEach:(e,t)=>e.map(me).forEach(t),map:(e,t)=>e.map(me).map(t).map(pe)},me=e=>({vattrs:e.$attrs$,vchildren:e.$children$,vkey:e.$key$,vname:e.$name$,vtag:e.$tag$,vtext:e.$text$}),pe=e=>{if("function"==typeof e.vtag){const t=Object.assign({},e.vattrs);return e.vkey&&(t.key=e.vkey),e.vname&&(t.name=e.vname),de(e.vtag,t,...e.vchildren||[])}const t=he(e.vtag,e.vtext);return t.$attrs$=e.vattrs,t.$children$=e.vchildren,t.$key$=e.vkey,t.$name$=e.vname,t},fe=(e,t,r)=>{const i=e;return{emit:e=>ve(i,t,{bubbles:!!(4&r),composed:!!(2&r),cancelable:!!(1&r),detail:e})}},ve=(e,t,r)=>{const i=ht.ce(t,r);return e.dispatchEvent(i),i},be=new WeakMap,ye=e=>{const t=e.$cmpMeta$,r=e.$hostElement$,i=t.$flags$,o=(t.$tagName$,()=>{}),n=((e,t,r,i)=>{var o;let n=we(t,r);const a=at.get(n);if(e=11===e.nodeType?e:ct,a)if("string"==typeof a){e=e.head||e;let t,r=be.get(e);if(r||be.set(e,r=new Set),!r.has(n)){{t=ct.createElement("style"),t.innerHTML=a;const r=null!==(o=ht.$nonce$)&&void 0!==o?o:function(e){var t,r,i;return null!==(i=null===(r=null===(t=e.head)||void 0===t?void 0:t.querySelector('meta[name="csp-nonce"]'))||void 0===r?void 0:r.getAttribute("content"))&&void 0!==i?i:void 0}(ct);null!=r&&t.setAttribute("nonce",r),e.insertBefore(t,e.querySelector("link"))}r&&r.add(n)}}else e.adoptedStyleSheets.includes(a)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,a]);return n})(r.shadowRoot?r.shadowRoot:r.getRootNode(),t,e.$modeName$);10&i&&(r["s-sc"]=n,r.classList.add(n+"-h"),2&i&&r.classList.add(n+"-s")),o()},we=(e,t)=>"sc-"+(t&&32&e.$flags$?e.$tagName$+"-"+t:e.$tagName$),$e=(e,t,r,i,o,n)=>{if(r!==i){let a=ot(e,t),s=t.toLowerCase();if("class"===t){const t=e.classList,o=ke(r),n=ke(i);t.remove(...o.filter((e=>e&&!n.includes(e)))),t.add(...n.filter((e=>e&&!o.includes(e))))}else if("style"===t){for(const t in r)i&&null!=i[t]||(t.includes("-")?e.style.removeProperty(t):e.style[t]="");for(const t in i)r&&i[t]===r[t]||(t.includes("-")?e.style.setProperty(t,i[t]):e.style[t]=i[t])}else if("key"===t);else if("ref"===t)i&&i(e);else if(e.__lookupSetter__(t)||"o"!==t[0]||"n"!==t[1]){const l=ce(i);if((a||l&&null!==i)&&!o)try{if(e.tagName.includes("-"))e[t]=i;else{const o=null==i?"":i;"list"===t?a=!1:null!=r&&e[t]==o||(e[t]=o)}}catch(e){}let c=!1;s!==(s=s.replace(/^xlink\:?/,""))&&(t=s,c=!0),null==i||!1===i?!1===i&&""!==e.getAttribute(t)||(c?e.removeAttributeNS(se,t):e.removeAttribute(t)):(!a||4&n||o)&&!l&&(i=!0===i?"":i,c?e.setAttributeNS(se,t,i):e.setAttribute(t,i))}else t="-"===t[2]?t.slice(3):ot(lt,s)?s.slice(2):s[2]+t.slice(3),r&&ht.rel(e,t,r,!1),i&&ht.ael(e,t,i,!1)}},xe=/\s/,ke=e=>e?e.split(xe):[],_e=(e,t,r,i)=>{const o=11===t.$elm$.nodeType&&t.$elm$.host?t.$elm$.host:t.$elm$,n=e&&e.$attrs$||le,a=t.$attrs$||le;for(i in n)i in a||$e(o,i,n[i],void 0,r,t.$flags$);for(i in a)$e(o,i,n[i],a[i],r,t.$flags$)},Ce=(e,t,r,i)=>{const o=t.$children$[r];let n,a,s,l=0;if(te||(ie=!0,"slot"===o.$tag$&&(Z&&i.classList.add(Z+"-s"),o.$flags$|=o.$children$?2:1)),null!==o.$text$)n=o.$elm$=ct.createTextNode(o.$text$);else if(1&o.$flags$)n=o.$elm$=ct.createTextNode("");else{if(oe||(oe="svg"===o.$tag$),n=o.$elm$=ct.createElementNS(oe?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",2&o.$flags$?"slot-fb":o.$tag$),oe&&"foreignObject"===o.$tag$&&(oe=!1),_e(null,o,oe),null!=Z&&n["s-si"]!==Z&&n.classList.add(n["s-si"]=Z),o.$children$)for(l=0;l{ht.$flags$|=1;const r=e.childNodes;for(let e=r.length-1;e>=0;e--){const i=r[e];i["s-hn"]!==ee&&i["s-ol"]&&(ze(i).insertBefore(i,Me(i)),i["s-ol"].remove(),i["s-ol"]=void 0,ie=!0),t&&Te(i,t)}ht.$flags$&=-2},Ee=(e,t,r,i,o,n)=>{let a,s=e["s-cr"]&&e["s-cr"].parentNode||e;for(s.shadowRoot&&s.tagName===ee&&(s=s.shadowRoot);o<=n;++o)i[o]&&(a=Ce(null,r,o,e),a&&(i[o].$elm$=a,s.insertBefore(a,Me(t))))},Oe=(e,t,r,i,o)=>{for(;t<=r;++t)(i=e[t])&&(o=i.$elm$,We(i),re=!0,o["s-ol"]?o["s-ol"].remove():Te(o,!0),o.remove())},Se=(e,t)=>e.$tag$===t.$tag$&&("slot"===e.$tag$?e.$name$===t.$name$:e.$key$===t.$key$),Me=e=>e&&e["s-ol"]||e,ze=e=>(e["s-ol"]?e["s-ol"]:e).parentNode,Le=(e,t)=>{const r=t.$elm$=e.$elm$,i=e.$children$,o=t.$children$,n=t.$tag$,a=t.$text$;let s;null===a?(oe="svg"===n||"foreignObject"!==n&&oe,"slot"===n||_e(e,t,oe),null!==i&&null!==o?((e,t,r,i)=>{let o,n,a=0,s=0,l=0,c=0,d=t.length-1,h=t[0],g=t[d],u=i.length-1,m=i[0],p=i[u];for(;a<=d&&s<=u;)if(null==h)h=t[++a];else if(null==g)g=t[--d];else if(null==m)m=i[++s];else if(null==p)p=i[--u];else if(Se(h,m))Le(h,m),h=t[++a],m=i[++s];else if(Se(g,p))Le(g,p),g=t[--d],p=i[--u];else if(Se(h,p))"slot"!==h.$tag$&&"slot"!==p.$tag$||Te(h.$elm$.parentNode,!1),Le(h,p),e.insertBefore(h.$elm$,g.$elm$.nextSibling),h=t[++a],p=i[--u];else if(Se(g,m))"slot"!==h.$tag$&&"slot"!==p.$tag$||Te(g.$elm$.parentNode,!1),Le(g,m),e.insertBefore(g.$elm$,h.$elm$),g=t[--d],m=i[++s];else{for(l=-1,c=a;c<=d;++c)if(t[c]&&null!==t[c].$key$&&t[c].$key$===m.$key$){l=c;break}l>=0?(n=t[l],n.$tag$!==m.$tag$?o=Ce(t&&t[s],r,l,e):(Le(n,m),t[l]=void 0,o=n.$elm$),m=i[++s]):(o=Ce(t&&t[s],r,s,e),m=i[++s]),o&&ze(h.$elm$).insertBefore(o,Me(h.$elm$))}a>d?Ee(e,null==i[u+1]?null:i[u+1].$elm$,r,i,s,u):s>u&&Oe(t,a,d)})(r,i,t,o):null!==o?(null!==e.$text$&&(r.textContent=""),Ee(r,null,t,o,0,o.length-1)):null!==i&&Oe(i,0,i.length-1),oe&&"svg"===n&&(oe=!1)):(s=r["s-cr"])?s.parentNode.textContent=a:e.$text$!==a&&(r.data=a)},De=e=>{const t=e.childNodes;let r,i,o,n,a,s;for(i=0,o=t.length;i{let t,r,i,o,n,a,s=0;const l=e.childNodes,c=l.length;for(;s=0;a--)r=i[a],r["s-cn"]||r["s-nr"]||r["s-hn"]===t["s-hn"]||(Ie(r,o)?(n=Ae.find((e=>e.$nodeToRelocate$===r)),re=!0,r["s-sn"]=r["s-sn"]||o,n?n.$slotRefNode$=t:Ae.push({$slotRefNode$:t,$nodeToRelocate$:r}),r["s-sr"]&&Ae.map((e=>{Ie(e.$nodeToRelocate$,r["s-sn"])&&(n=Ae.find((e=>e.$nodeToRelocate$===r)),n&&!e.$slotRefNode$&&(e.$slotRefNode$=n.$slotRefNode$))}))):Ae.some((e=>e.$nodeToRelocate$===r))||Ae.push({$nodeToRelocate$:r}));1===t.nodeType&&Fe(t)}},Ie=(e,t)=>1===e.nodeType?null===e.getAttribute("slot")&&""===t||e.getAttribute("slot")===t:e["s-sn"]===t||""===t,We=e=>{e.$attrs$&&e.$attrs$.ref&&e.$attrs$.ref(null),e.$children$&&e.$children$.map(We)},Re=(e,t)=>{const r=e.$hostElement$,i=e.$cmpMeta$,o=e.$vnode$||he(null,null),n=(a=t)&&a.$tag$===ge?t:de(null,null,t);var a;if(ee=r.tagName,i.$attrsToReflect$&&(n.$attrs$=n.$attrs$||{},i.$attrsToReflect$.map((([e,t])=>n.$attrs$[t]=r[e]))),n.$tag$=null,n.$flags$|=4,e.$vnode$=n,n.$elm$=o.$elm$=r.shadowRoot||r,Z=r["s-sc"],J=r["s-cr"],te=!!(1&i.$flags$),re=!1,Le(o,n),ht.$flags$|=1,ie){let e,t,r,i,o,a;Fe(n.$elm$);let s=0;for(;s{e.$flags$|=16,e.$ancestorComponent$;return $t((()=>He(e,t)))},He=(e,t)=>{const r=e.$hostElement$,i=(e.$cmpMeta$.$tagName$,()=>{}),o=r;let n;return n=qe(o,t?"componentWillLoad":"componentWillUpdate"),n=Pe(n,(()=>qe(o,"componentWillRender"))),i(),Pe(n,(()=>Ve(e,o,t)))},Ve=async(e,t,r)=>{const i=e.$hostElement$,o=(e.$cmpMeta$.$tagName$,()=>{});i["s-rc"],r&&ye(e);const n=(e.$cmpMeta$.$tagName$,()=>{});je(e,t,i),n(),o(),Be(e)},je=(e,t,r)=>{try{ne=t,t=t.render&&t.render(),e.$flags$&=-17,e.$flags$|=2,(K||Y)&&(Q||Y)&&(G||Re(e,t))}catch(t){nt(t,e.$hostElement$)}return ne=null,null},Be=e=>{e.$cmpMeta$.$tagName$;const t=()=>{},r=e.$hostElement$;e.$ancestorComponent$,qe(r,"componentDidRender"),64&e.$flags$?(qe(r,"componentDidUpdate"),t()):(e.$flags$|=64,qe(r,"componentDidLoad"),t())},qe=(e,t,r)=>{if(e&&e[t])try{return e[t](r)}catch(e){nt(e)}},Pe=(e,t)=>e&&e.then?e.then(t):t(),Ue=(e,t,r,i)=>{const o=rt(e),n=e,a=o.$instanceValues$.get(t),s=o.$flags$,l=n;var c,d;c=r,d=i.$members$[t][0],r=null==c||ce(c)?c:4&d?"false"!==c&&(""===c||!!c):2&d?parseFloat(c):1&d?String(c):c;const h=Number.isNaN(a)&&Number.isNaN(r);if(r!==a&&!h){if(o.$instanceValues$.set(t,r),i.$watchers$&&128&s){const e=i.$watchers$[t];e&&e.map((e=>{try{l[e](r,a,t)}catch(e){nt(e,n)}}))}if(2==(18&s)){if(l.componentShouldUpdate&&!1===l.componentShouldUpdate(r,a,t))return;Ne(o,!1)}}},Ke=(e,t,r)=>{if(t.$members$){e.watchers&&(t.$watchers$=e.watchers);const r=Object.entries(t.$members$),i=e.prototype;r.map((([e,[r]])=>{(31&r||32&r)&&Object.defineProperty(i,e,{get(){return t=e,rt(this).$instanceValues$.get(t);var t},set(r){Ue(this,e,r,t)},configurable:!0,enumerable:!0})}));{const o=new Map;i.attributeChangedCallback=function(e,t,r){ht.jmp((()=>{const t=o.get(e);if(this.hasOwnProperty(t))r=this[t],delete this[t];else if(i.hasOwnProperty(t)&&"number"==typeof this[t]&&this[t]==r)return;this[t]=(null!==r||"boolean"!=typeof this[t])&&r}))},e.observedAttributes=r.filter((([e,t])=>15&t[0])).map((([e,r])=>{const i=r[1]||e;return o.set(i,e),512&r[0]&&t.$attrsToReflect$.push([e,i]),i}))}}return e},Ye=async(e,t,r,i,o)=>{if(!(32&t.$flags$)&&(o=e.constructor,t.$flags$|=32,customElements.whenDefined(r.$tagName$).then((()=>t.$flags$|=128)),o.style)){let i=o.style;"string"!=typeof i&&(i=i[t.$modeName$=(e=>st.map((t=>t(e))).find((e=>!!e)))(e)]);const n=we(r,t.$modeName$);if(!at.has(n)){const e=(r.$tagName$,()=>{});((e,t,r)=>{let i=at.get(e);mt&&r?(i=i||new CSSStyleSheet,"string"==typeof i?i=t:i.replaceSync(t)):i=t,at.set(e,i)})(n,i,!!(1&r.$flags$)),e()}}t.$ancestorComponent$;Ne(t,!0)},Qe=e=>{const t=e["s-cr"]=ct.createComment("");t["s-cn"]=!0,e.insertBefore(t,e.firstChild)},Ge=(e,t)=>{const r={$flags$:t[0],$tagName$:t[1]};r.$members$=t[2],r.$listeners$=t[3],r.$watchers$=e.$watchers$,r.$attrsToReflect$=[],!gt&&1&r.$flags$&&(r.$flags$|=8);const i=e.prototype.connectedCallback,o=e.prototype.disconnectedCallback;return Object.assign(e.prototype,{__registerHost(){it(this,r)},connectedCallback(){(e=>{if(!(1&ht.$flags$)){const t=rt(e),r=t.$cmpMeta$,i=(r.$tagName$,()=>{});1&t.$flags$?(Xe(e,t,r.$listeners$),t.$lazyInstance$):(t.$flags$|=1,12&r.$flags$&&Qe(e),r.$members$&&Object.entries(r.$members$).map((([t,[r]])=>{if(31&r&&e.hasOwnProperty(t)){const r=e[t];delete e[t],e[t]=r}})),Ye(e,t,r)),i()}})(this),i&&i.call(this)},disconnectedCallback(){(e=>{if(!(1&ht.$flags$)){const t=rt(e);t.$rmListeners$&&(t.$rmListeners$.map((e=>e())),t.$rmListeners$=void 0)}})(this),o&&o.call(this)},__attachShadow(){gt?this.attachShadow({mode:"open",delegatesFocus:!!(16&r.$flags$)}):this.shadowRoot=this}}),e.is=r.$tagName$,Ke(e,r)},Xe=(e,t,r,i)=>{r&&r.map((([r,i,o])=>{const n=Je(e,r),a=Ze(t,o),s=et(r);ht.ael(n,i,a,s),(t.$rmListeners$=t.$rmListeners$||[]).push((()=>ht.rel(n,i,a,s)))}))},Ze=(e,t)=>r=>{try{X||e.$hostElement$[t](r)}catch(e){nt(e)}},Je=(e,t)=>4&t?ct:8&t?lt:16&t?ct.body:e,et=e=>ut?{passive:!!(1&e),capture:!!(2&e)}:!!(2&e),tt=new WeakMap,rt=e=>tt.get(e),it=(e,t)=>{const r={$flags$:0,$hostElement$:e,$cmpMeta$:t,$instanceValues$:new Map};return Xe(e,r,t.$listeners$),tt.set(e,r)},ot=(e,t)=>t in e,nt=(e,t)=>(0,console.error)(e,t),at=new Map,st=[],lt="undefined"!=typeof window?window:{},ct=lt.document||{head:{}},dt=lt.HTMLElement||class{},ht={$flags$:0,$resourcesUrl$:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,r,i)=>e.addEventListener(t,r,i),rel:(e,t,r,i)=>e.removeEventListener(t,r,i),ce:(e,t)=>new CustomEvent(e,t)},gt=!0,ut=(()=>{let e=!1;try{ct.addEventListener("e",null,Object.defineProperty({},"passive",{get(){e=!0}}))}catch(e){}return e})(),mt=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync}catch(e){}return!1})(),pt=[],ft=[],vt=(e,t)=>r=>{e.push(r),ae||(ae=!0,t&&4&ht.$flags$?wt(yt):ht.raf(yt))},bt=e=>{for(let t=0;t{bt(pt),bt(ft),(ae=pt.length>0)&&ht.raf(yt)},wt=e=>{return Promise.resolve(t).then(e);var t},$t=vt(ft,!0),xt=(e,t)=>{const r=!!e.label||e.hasLabelSlot,i=!!e.helpText||e.hasHelpTextSlot,o=!!e.invalidText||e.hasInvalidTextSlot,n=!e.invalid,a=!!e.invalid;return de("div",{class:{"form-control":!0,[`form-control-${e.size}`]:!0,"form-control-has-label":r,"form-control-has-help-text":i,"form-control-has-invalid-text":o}},de("label",{id:e.labelId,class:"form-control-label",htmlFor:e.inputId,"aria-hidden":r?"false":"true",onClick:e.onLabelClick},de("slot",{name:"label"},e.label),e.requiredIndicator&&de("div",{class:"asterisk"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 1200 1200"},de("path",{fill:"currentColor",d:"M489.838 29.354v443.603L68.032 335.894 0 545.285l421.829 137.086-260.743 358.876 178.219 129.398L600.048 811.84l260.673 358.806 178.146-129.398-260.766-358.783L1200 545.379l-68.032-209.403-421.899 137.07V29.443H489.84l-.002-.089z"})))),de("div",{class:"form-control-input"},t),n&&de("div",{id:e.helpTextId,class:"form-control-help-text","aria-hidden":i?"false":"true"},de("slot",{name:"help-text"},e.helpText)),a&&de("div",{id:e.invalidTextId,class:"form-control-invalid-text","aria-hidden":o?"false":"true"},de("div",{class:"icon"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Alert Circle"),de("path",{d:"M256,48C141.31,48,48,141.31,48,256s93.31,208,208,208,208-93.31,208-208S370.69,48,256,48Zm0,319.91a20,20,0,1,1,20-20A20,20,0,0,1,256,367.91Zm21.72-201.15-5.74,122a16,16,0,0,1-32,0l-5.74-121.94v-.05a21.74,21.74,0,1,1,43.44,0Z",fill:"currentColor"}))),de("div",{class:"text"},de("slot",{name:"invalid-text"},e.invalidText))))}; +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +function kt(e){const t=e?e.assignedNodes({flatten:!0}):[];let r="";return[...t].map((e=>{e.nodeType===Node.TEXT_NODE&&(r+=e.textContent)})),r}function _t(e,t){return t?null!==e.querySelector(`[slot="${t}"]`):[...e.childNodes].some((e=>{if(e.nodeType===e.TEXT_NODE&&""!==e.textContent.trim())return!0;if(e.nodeType===e.ELEMENT_NODE){if(!e.hasAttribute("slot"))return!0}return!1}))} +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */const Ct=(e,t=[])=>{const r={};return t.forEach((t=>{if(e.hasAttribute(t)){null!==e.getAttribute(t)&&(r[t]=e.getAttribute(t)),e.removeAttribute(t)}})),r},Tt=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow()}render(){return de("span",{class:"spinner","aria-busy":"true","aria-live":"polite"})}static get style(){return":host{--track-color:var(--gr-color-light-shade);--indicator-color:var(--gr-color-primary);--stroke-width:2px;display:inline-flex;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.spinner{display:inline-block;width:1em;height:1em;border-radius:50%;border:solid var(--stroke-width) var(--track-color);border-top-color:var(--indicator-color);border-right-color:var(--indicator-color);animation:1s linear infinite spin}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}"}},[1,"gr-spinner"]);function Et(){if("undefined"==typeof customElements)return;["gr-spinner"].forEach((e=>{if("gr-spinner"===e)customElements.get(e)||customElements.define(e,Tt)}))}Et(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const Ot=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grFocus=fe(this,"gr-focus",7),this.grBlur=fe(this,"gr-blur",7),this.inheritedAttributes={},this.handleClick=e=>{if("button"!==this.type){const t=this.el.closest("form");if(t){e.preventDefault();const r=document.createElement("button");r.type=this.type,r.style.display="none",t.appendChild(r),r.click(),r.remove()}}},this.onFocus=()=>{this.grFocus.emit()},this.onBlur=()=>{this.grBlur.emit()},this.variant="default",this.disabled=!1,this.loading=!1,this.size="medium",this.caret=!1,this.pill=!1,this.expand=void 0,this.circle=!1,this.href=void 0,this.target=void 0,this.rel=void 0,this.type="button"}componentWillLoad(){this.inheritedAttributes=Ct(this.el,["aria-label","tabindex","title"])}async setFocus(e){this.button.focus(e)}async removeFocus(){this.button.blur()}render(){const{rel:e,target:t,href:r,variant:i,size:o,expand:n,type:a,inheritedAttributes:s,disabled:l}=this,c=void 0===r?"button":"a",d="button"===c?{type:a}:{href:r,rel:e,target:t};return de(ge,{onClick:this.handleClick,"aria-disabled":l?"true":null,class:{[`button-${i}`]:!0,[`button-${o}`]:!0,[`button-${n}`]:void 0!==n,"button-caret":this.caret,"button-circle":this.circle,"button-pill":this.pill,"button-disabled":l,"button-loading":this.loading}},de(c,Object.assign({ref:e=>this.button=e},d,{class:"button-native",disabled:l,onFocus:this.onFocus,onBlur:this.onBlur},s),de("span",{class:"button-inner"},de("slot",{name:"icon-only"}),de("slot",{name:"start"}),de("slot",null),de("slot",{name:"end"}),this.caret&&de("span",{class:"caret"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Chevron Down"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"M112 184l144 144 144-144"})))),this.loading&&de("gr-spinner",null)))}get el(){return this}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{display:inline-block;width:auto;font-family:var(--gr-font-family);font-weight:var(--gr-font-weight-medium);font-size:var(--gr-form-element-font-size-medium);font-kerning:none;user-select:none;vertical-align:top;vertical-align:-webkit-baseline-middle;pointer-events:auto;--height:var(--gr-form-element-height-medium);--border-radius:var(--gr-form-element-border-radius-medium);--border-width:1px;--border-style:solid;--background:transparent;--background-hover:transparent;--background-focus:transparent;--color:var(--gr-color-dark-tint);--color-hover:var(--gr-color-dark-tint);--color-focus:var(--gr-color-dark-tint);--border-color:var(--gr-color-light-shade);--border-color-hover:var(--gr-color-medium);--border-color-focus:var(--gr-color-primary);--padding-top:0;--padding-start:var(--gr-spacing-medium);--padding-end:var(--gr-spacing-medium);--padding-bottom:0;--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33);--shadow:none;--transition:background-color 150ms linear, opacity 150ms linear, border 150ms linear, color 150ms linear}:host(.button-disabled){pointer-events:none;opacity:0.5}:host(.button-primary){--border-color:var(--gr-color-primary);--background:var(--gr-color-primary);--color:var(--gr-color-primary-contrast);--border-color-hover:var(--gr-color-primary-shade);--background-hover:var(--gr-color-primary-shade);--color-hover:var(--gr-color-primary-contrast);--border-color-focus:var(--gr-color-primary);--background-focus:var(--gr-color-primary-shade);--color-focus:var(--gr-color-primary-contrast);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33)}:host(.button-secondary){--border-color:var(--gr-color-light-shade);--background:transparent;--color:var(--gr-color-primary);--border-color-hover:var(--gr-color-primary);--background-hover:transparent;--color-hover:var(--gr-color-primary);--border-color-focus:var(--gr-color-primary);--background-focus:transparent;--color-focus:var(--gr-color-primary);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33)}:host(.button-danger){--border-color:var(--gr-color-danger);--background:transparent;--color:var(--gr-color-danger);--border-color-hover:var(--gr-color-danger);--background-hover:var(--gr-color-danger);--color-hover:var(--gr-color-danger-contrast);--border-color-focus:var(--gr-color-danger);--background-focus:var(--gr-color-danger);--color-focus:var(--gr-color-danger-contrast);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-danger-rgb), 0.33)}:host(.button-plain){--border-color:transparent;--background:transparent;--color:var(--gr-color-primary);--border-color-hover:transparent;--background-hover:transparent;--color-hover:var(--gr-color-primary-shade);--border-color-focus:transparent;--background-focus:transparent;--color-focus:var(--gr-color-primary-shade);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33)}:host(.button-small){--padding-start:var(--gr-spacing-small);--padding-end:var(--gr-spacing-small);--border-radius:var(--gr-form-element-border-radius-small);--height:var(--gr-form-element-height-small);font-size:var(--gr-form-element-font-size-small)}:host(.button-large){--padding-start:var(--gr-spacing-large);--padding-end:var(--gr-spacing-large);--border-radius:var(--gr-form-element-border-radius-large);--height:var(--gr-form-element-height-large);font-size:var(--gr-form-element-font-size-large)}:host(.button-block){display:block}:host(.button-block) .button-native{margin-left:0;margin-right:0;display:block;width:100%;clear:both;contain:content}:host(.button-block) .button-native::after{clear:both}:host(.button-full){display:block}:host(.button-full) .button-native{margin-left:0;margin-right:0;display:block;width:100%;contain:content;border-radius:0;border-right-width:0;border-left-width:0}.button-native{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:block;position:relative;padding-top:var(--padding-top);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-bottom:var(--padding-bottom);width:100%;height:var(--height);transition:var(--transition);border-radius:var(--border-radius);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);color:var(--color);box-shadow:var(--shadow);line-height:1;cursor:pointer;z-index:0;text-decoration:none;box-sizing:border-box}.button-native::-moz-focus-inner{border:0}.button-native:focus{outline:none;box-shadow:var(--focus-ring);border-color:var(--border-color-focus);background-color:var(--background-focus);color:var(--color-focus)}.button-native *,.button-native *:before,.button-native *:after{box-sizing:inherit}.button-inner{display:flex;position:relative;flex-flow:row nowrap;flex-shrink:0;align-items:center;justify-content:center;width:100%;height:100%;z-index:1}:host(.button-circle) .button-native{padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;border-radius:50%;width:var(--height)}@media (any-hover: hover){.button-native:hover{color:var(--color-hover);background:var(--background-hover);border-color:var(--border-color-hover)}}:host(.button-caret) .caret{display:flex;align-items:center;margin-left:0.3em}:host(.button-caret) .caret svg{width:1em;height:1em}:host(.button-pill) .button-native{border-radius:var(--height)}::slotted(*){pointer-events:none}::slotted([slot=start]){margin-top:0;margin-left:-0.3em;margin-right:0.3em;margin-bottom:0}::slotted([slot=end]){margin-top:0;margin-left:0.3em;margin-right:-0.2em;margin-bottom:0}::slotted([slot=icon-only]){font-size:1.4em;pointer-events:none}:host(.button-loading){position:relative;pointer-events:none}:host(.button-loading) .caret{visibility:hidden}:host(.button-loading) slot[name=start],:host(.button-loading) slot[name=end],:host(.button-loading) slot[name=icon-only],:host(.button-loading) slot:not([name]){visibility:hidden}:host(.button-loading) gr-spinner{--indicator-color:currentColor;position:absolute;height:1em;width:1em;top:calc(50% - 0.5em);left:calc(50% - 0.5em)}@media not all and (min-resolution: 0.001dpcm){@supports (-webkit-appearance: none) and (stroke-color: transparent){:host([type=button]),:host([type=reset]),:host([type=submit]){-webkit-appearance:none !important}}}"}},[1,"gr-button",{variant:[513],disabled:[516],loading:[516],size:[513],caret:[4],pill:[516],expand:[513],circle:[516],href:[1],target:[1],rel:[1],type:[1],setFocus:[64],removeFocus:[64]}]);function St(){if("undefined"==typeof customElements)return;["gr-button","gr-spinner"].forEach((e=>{switch(e){case"gr-button":customElements.get(e)||customElements.define(e,Ot);break;case"gr-spinner":customElements.get(e)||Et()}}))}function Mt(e,t,r="vertical",i="smooth"){const o= +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +function(e,t){return{top:Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top),left:Math.round(e.getBoundingClientRect().left-t.getBoundingClientRect().left)}}(e,t),n=o.top+t.scrollTop,a=o.left+t.scrollLeft,s=t.scrollLeft,l=t.scrollLeft+t.offsetWidth,c=t.scrollTop,d=t.scrollTop+t.offsetHeight;"horizontal"!==r&&"both"!==r||(al&&t.scrollTo({left:a-t.offsetWidth+e.clientWidth,behavior:i})),"vertical"!==r&&"both"!==r||(nd&&t.scrollTo({top:n-t.offsetHeight+e.clientHeight,behavior:i}))} +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */function zt(e){return e.tabIndex>-1}function Lt(e){if(zt(e))return e;if(e.shadowRoot){const t=[...e.shadowRoot.children].find(zt);if(t)return t}return e.children?[...e.children].map(Lt)[0]:null}St();var Dt="top",At="bottom",Ft="right",It="left",Wt="auto",Rt=[Dt,At,Ft,It],Nt="start",Ht="end",Vt="clippingParents",jt="viewport",Bt="popper",qt="reference",Pt=Rt.reduce((function(e,t){return e.concat([t+"-"+Nt,t+"-"+Ht])}),[]),Ut=[].concat(Rt,[Wt]).reduce((function(e,t){return e.concat([t,t+"-"+Nt,t+"-"+Ht])}),[]),Kt=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function Yt(e){return e?(e.nodeName||"").toLowerCase():null}function Qt(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Gt(e){return e instanceof Qt(e).Element||e instanceof Element}function Xt(e){return e instanceof Qt(e).HTMLElement||e instanceof HTMLElement}function Zt(e){return"undefined"!=typeof ShadowRoot&&(e instanceof Qt(e).ShadowRoot||e instanceof ShadowRoot)}const Jt={name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach((function(e){var r=t.styles[e]||{},i=t.attributes[e]||{},o=t.elements[e];Xt(o)&&Yt(o)&&(Object.assign(o.style,r),Object.keys(i).forEach((function(e){var t=i[e];!1===t?o.removeAttribute(e):o.setAttribute(e,!0===t?"":t)})))}))},effect:function(e){var t=e.state,r={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,r.popper),t.styles=r,t.elements.arrow&&Object.assign(t.elements.arrow.style,r.arrow),function(){Object.keys(t.elements).forEach((function(e){var i=t.elements[e],o=t.attributes[e]||{},n=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:r[e]).reduce((function(e,t){return e[t]="",e}),{});Xt(i)&&Yt(i)&&(Object.assign(i.style,n),Object.keys(o).forEach((function(e){i.removeAttribute(e)})))}))}},requires:["computeStyles"]};function er(e){return e.split("-")[0]}var tr=Math.max,rr=Math.min,ir=Math.round;function or(e,t){void 0===t&&(t=!1);var r=e.getBoundingClientRect(),i=1,o=1;if(Xt(e)&&t){var n=e.offsetHeight,a=e.offsetWidth;a>0&&(i=ir(r.width)/a||1),n>0&&(o=ir(r.height)/n||1)}return{width:r.width/i,height:r.height/o,top:r.top/o,right:r.right/i,bottom:r.bottom/o,left:r.left/i,x:r.left/i,y:r.top/o}}function nr(e){var t=or(e),r=e.offsetWidth,i=e.offsetHeight;return Math.abs(t.width-r)<=1&&(r=t.width),Math.abs(t.height-i)<=1&&(i=t.height),{x:e.offsetLeft,y:e.offsetTop,width:r,height:i}}function ar(e,t){var r=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(r&&Zt(r)){var i=t;do{if(i&&e.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function sr(e){return Qt(e).getComputedStyle(e)}function lr(e){return["table","td","th"].indexOf(Yt(e))>=0}function cr(e){return((Gt(e)?e.ownerDocument:e.document)||window.document).documentElement}function dr(e){return"html"===Yt(e)?e:e.assignedSlot||e.parentNode||(Zt(e)?e.host:null)||cr(e)}function hr(e){return Xt(e)&&"fixed"!==sr(e).position?e.offsetParent:null}function gr(e){for(var t=Qt(e),r=hr(e);r&&lr(r)&&"static"===sr(r).position;)r=hr(r);return r&&("html"===Yt(r)||"body"===Yt(r)&&"static"===sr(r).position)?t:r||function(e){var t=-1!==navigator.userAgent.toLowerCase().indexOf("firefox");if(-1!==navigator.userAgent.indexOf("Trident")&&Xt(e)&&"fixed"===sr(e).position)return null;var r=dr(e);for(Zt(r)&&(r=r.host);Xt(r)&&["html","body"].indexOf(Yt(r))<0;){var i=sr(r);if("none"!==i.transform||"none"!==i.perspective||"paint"===i.contain||-1!==["transform","perspective"].indexOf(i.willChange)||t&&"filter"===i.willChange||t&&i.filter&&"none"!==i.filter)return r;r=r.parentNode}return null}(e)||t}function ur(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function mr(e,t,r){return tr(e,rr(t,r))}function pr(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},e)}function fr(e,t){return t.reduce((function(t,r){return t[r]=e,t}),{})}const vr={name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,r=e.state,i=e.name,o=e.options,n=r.elements.arrow,a=r.modifiersData.popperOffsets,s=er(r.placement),l=ur(s),c=[It,Ft].indexOf(s)>=0?"height":"width";if(n&&a){var d=function(e,t){return pr("number"!=typeof(e="function"==typeof e?e(Object.assign({},t.rects,{placement:t.placement})):e)?e:fr(e,Rt))}(o.padding,r),h=nr(n),g="y"===l?Dt:It,u="y"===l?At:Ft,m=r.rects.reference[c]+r.rects.reference[l]-a[l]-r.rects.popper[c],p=a[l]-r.rects.reference[l],f=gr(n),v=f?"y"===l?f.clientHeight||0:f.clientWidth||0:0,b=m/2-p/2,y=d[g],w=v-h[c]-d[u],$=v/2-h[c]/2+b,x=mr(y,$,w),k=l;r.modifiersData[i]=((t={})[k]=x,t.centerOffset=x-$,t)}},effect:function(e){var t=e.state,r=e.options.element,i=void 0===r?"[data-popper-arrow]":r;null!=i&&("string"!=typeof i||(i=t.elements.popper.querySelector(i)))&&ar(t.elements.popper,i)&&(t.elements.arrow=i)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function br(e){return e.split("-")[1]}var yr={top:"auto",right:"auto",bottom:"auto",left:"auto"};function wr(e){var t,r=e.popper,i=e.popperRect,o=e.placement,n=e.variation,a=e.offsets,s=e.position,l=e.gpuAcceleration,c=e.adaptive,d=e.roundOffsets,h=e.isFixed,g=a.x,u=void 0===g?0:g,m=a.y,p=void 0===m?0:m,f="function"==typeof d?d({x:u,y:p}):{x:u,y:p};u=f.x,p=f.y;var v=a.hasOwnProperty("x"),b=a.hasOwnProperty("y"),y=It,w=Dt,$=window;if(c){var x=gr(r),k="clientHeight",_="clientWidth";if(x===Qt(r)&&"static"!==sr(x=cr(r)).position&&"absolute"===s&&(k="scrollHeight",_="scrollWidth"),o===Dt||(o===It||o===Ft)&&n===Ht)w=At,p-=(h&&x===$&&$.visualViewport?$.visualViewport.height:x[k])-i.height,p*=l?1:-1;if(o===It||(o===Dt||o===At)&&n===Ht)y=Ft,u-=(h&&x===$&&$.visualViewport?$.visualViewport.width:x[_])-i.width,u*=l?1:-1}var C,T=Object.assign({position:s},c&&yr),E=!0===d?function(e){var t=e.x,r=e.y,i=window.devicePixelRatio||1;return{x:ir(t*i)/i||0,y:ir(r*i)/i||0}}({x:u,y:p}):{x:u,y:p};return u=E.x,p=E.y,l?Object.assign({},T,((C={})[w]=b?"0":"",C[y]=v?"0":"",C.transform=($.devicePixelRatio||1)<=1?"translate("+u+"px, "+p+"px)":"translate3d("+u+"px, "+p+"px, 0)",C)):Object.assign({},T,((t={})[w]=b?p+"px":"",t[y]=v?u+"px":"",t.transform="",t))}var $r={passive:!0};var xr={left:"right",right:"left",bottom:"top",top:"bottom"};function kr(e){return e.replace(/left|right|bottom|top/g,(function(e){return xr[e]}))}var _r={start:"end",end:"start"};function Cr(e){return e.replace(/start|end/g,(function(e){return _r[e]}))}function Tr(e){var t=Qt(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function Er(e){return or(cr(e)).left+Tr(e).scrollLeft}function Or(e){var t=sr(e),r=t.overflow,i=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(r+o+i)}function Sr(e){return["html","body","#document"].indexOf(Yt(e))>=0?e.ownerDocument.body:Xt(e)&&Or(e)?e:Sr(dr(e))}function Mr(e,t){var r;void 0===t&&(t=[]);var i=Sr(e),o=i===(null==(r=e.ownerDocument)?void 0:r.body),n=Qt(i),a=o?[n].concat(n.visualViewport||[],Or(i)?i:[]):i,s=t.concat(a);return o?s:s.concat(Mr(dr(a)))}function zr(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function Lr(e,t){return t===jt?zr(function(e){var t=Qt(e),r=cr(e),i=t.visualViewport,o=r.clientWidth,n=r.clientHeight,a=0,s=0;return i&&(o=i.width,n=i.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(a=i.offsetLeft,s=i.offsetTop)),{width:o,height:n,x:a+Er(e),y:s}}(e)):Gt(t)?function(e){var t=or(e);return t.top=t.top+e.clientTop,t.left=t.left+e.clientLeft,t.bottom=t.top+e.clientHeight,t.right=t.left+e.clientWidth,t.width=e.clientWidth,t.height=e.clientHeight,t.x=t.left,t.y=t.top,t}(t):zr(function(e){var t,r=cr(e),i=Tr(e),o=null==(t=e.ownerDocument)?void 0:t.body,n=tr(r.scrollWidth,r.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=tr(r.scrollHeight,r.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),s=-i.scrollLeft+Er(e),l=-i.scrollTop;return"rtl"===sr(o||r).direction&&(s+=tr(r.clientWidth,o?o.clientWidth:0)-n),{width:n,height:a,x:s,y:l}}(cr(e)))}function Dr(e,t,r){var i="clippingParents"===t?function(e){var t=Mr(dr(e)),r=["absolute","fixed"].indexOf(sr(e).position)>=0&&Xt(e)?gr(e):e;return Gt(r)?t.filter((function(e){return Gt(e)&&ar(e,r)&&"body"!==Yt(e)})):[]}(e):[].concat(t),o=[].concat(i,[r]),n=o[0],a=o.reduce((function(t,r){var i=Lr(e,r);return t.top=tr(i.top,t.top),t.right=rr(i.right,t.right),t.bottom=rr(i.bottom,t.bottom),t.left=tr(i.left,t.left),t}),Lr(e,n));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function Ar(e){var t,r=e.reference,i=e.element,o=e.placement,n=o?er(o):null,a=o?br(o):null,s=r.x+r.width/2-i.width/2,l=r.y+r.height/2-i.height/2;switch(n){case Dt:t={x:s,y:r.y-i.height};break;case At:t={x:s,y:r.y+r.height};break;case Ft:t={x:r.x+r.width,y:l};break;case It:t={x:r.x-i.width,y:l};break;default:t={x:r.x,y:r.y}}var c=n?ur(n):null;if(null!=c){var d="y"===c?"height":"width";switch(a){case Nt:t[c]=t[c]-(r[d]/2-i[d]/2);break;case Ht:t[c]=t[c]+(r[d]/2-i[d]/2)}}return t}function Fr(e,t){void 0===t&&(t={});var r=t,i=r.placement,o=void 0===i?e.placement:i,n=r.boundary,a=void 0===n?Vt:n,s=r.rootBoundary,l=void 0===s?jt:s,c=r.elementContext,d=void 0===c?Bt:c,h=r.altBoundary,g=void 0!==h&&h,u=r.padding,m=void 0===u?0:u,p=pr("number"!=typeof m?m:fr(m,Rt)),f=d===Bt?qt:Bt,v=e.rects.popper,b=e.elements[g?f:d],y=Dr(Gt(b)?b:b.contextElement||cr(e.elements.popper),a,l),w=or(e.elements.reference),$=Ar({reference:w,element:v,strategy:"absolute",placement:o}),x=zr(Object.assign({},v,$)),k=d===Bt?x:w,_={top:y.top-k.top+p.top,bottom:k.bottom-y.bottom+p.bottom,left:y.left-k.left+p.left,right:k.right-y.right+p.right},C=e.modifiersData.offset;if(d===Bt&&C){var T=C[o];Object.keys(_).forEach((function(e){var t=[Ft,At].indexOf(e)>=0?1:-1,r=[Dt,At].indexOf(e)>=0?"y":"x";_[e]+=T[r]*t}))}return _}function Ir(e,t){void 0===t&&(t={});var r=t,i=r.placement,o=r.boundary,n=r.rootBoundary,a=r.padding,s=r.flipVariations,l=r.allowedAutoPlacements,c=void 0===l?Ut:l,d=br(i),h=d?s?Pt:Pt.filter((function(e){return br(e)===d})):Rt,g=h.filter((function(e){return c.indexOf(e)>=0}));0===g.length&&(g=h);var u=g.reduce((function(t,r){return t[r]=Fr(e,{placement:r,boundary:o,rootBoundary:n,padding:a})[er(r)],t}),{});return Object.keys(u).sort((function(e,t){return u[e]-u[t]}))}const Wr={name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,r=e.options,i=e.name;if(!t.modifiersData[i]._skip){for(var o=r.mainAxis,n=void 0===o||o,a=r.altAxis,s=void 0===a||a,l=r.fallbackPlacements,c=r.padding,d=r.boundary,h=r.rootBoundary,g=r.altBoundary,u=r.flipVariations,m=void 0===u||u,p=r.allowedAutoPlacements,f=t.options.placement,v=er(f),b=l||(v===f||!m?[kr(f)]:function(e){if(er(e)===Wt)return[];var t=kr(e);return[Cr(e),t,Cr(t)]}(f)),y=[f].concat(b).reduce((function(e,r){return e.concat(er(r)===Wt?Ir(t,{placement:r,boundary:d,rootBoundary:h,padding:c,flipVariations:m,allowedAutoPlacements:p}):r)}),[]),w=t.rects.reference,$=t.rects.popper,x=new Map,k=!0,_=y[0],C=0;C=0,M=S?"width":"height",z=Fr(t,{placement:T,boundary:d,rootBoundary:h,altBoundary:g,padding:c}),L=S?O?Ft:It:O?At:Dt;w[M]>$[M]&&(L=kr(L));var D=kr(L),A=[];if(n&&A.push(z[E]<=0),s&&A.push(z[L]<=0,z[D]<=0),A.every((function(e){return e}))){_=T,k=!1;break}x.set(T,A)}if(k)for(var F=function(e){var t=y.find((function(t){var r=x.get(t);if(r)return r.slice(0,e).every((function(e){return e}))}));if(t)return _=t,"break"},I=m?3:1;I>0;I--){if("break"===F(I))break}t.placement!==_&&(t.modifiersData[i]._skip=!0,t.placement=_,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function Rr(e,t,r){return void 0===r&&(r={x:0,y:0}),{top:e.top-t.height-r.y,right:e.right-t.width+r.x,bottom:e.bottom-t.height+r.y,left:e.left-t.width-r.x}}function Nr(e){return[Dt,Ft,At,It].some((function(t){return e[t]>=0}))}const Hr={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,r=e.options,i=e.name,o=r.offset,n=void 0===o?[0,0]:o,a=Ut.reduce((function(e,r){return e[r]=function(e,t,r){var i=er(e),o=[It,Dt].indexOf(i)>=0?-1:1,n="function"==typeof r?r(Object.assign({},t,{placement:e})):r,a=n[0],s=n[1];return a=a||0,s=(s||0)*o,[It,Ft].indexOf(i)>=0?{x:s,y:a}:{x:a,y:s}}(r,t.rects,n),e}),{}),s=a[t.placement],l=s.x,c=s.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=c),t.modifiersData[i]=a}};const Vr={name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,r=e.options,i=e.name,o=r.mainAxis,n=void 0===o||o,a=r.altAxis,s=void 0!==a&&a,l=r.boundary,c=r.rootBoundary,d=r.altBoundary,h=r.padding,g=r.tether,u=void 0===g||g,m=r.tetherOffset,p=void 0===m?0:m,f=Fr(t,{boundary:l,rootBoundary:c,padding:h,altBoundary:d}),v=er(t.placement),b=br(t.placement),y=!b,w=ur(v),$="x"===w?"y":"x",x=t.modifiersData.popperOffsets,k=t.rects.reference,_=t.rects.popper,C="function"==typeof p?p(Object.assign({},t.rects,{placement:t.placement})):p,T="number"==typeof C?{mainAxis:C,altAxis:C}:Object.assign({mainAxis:0,altAxis:0},C),E=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,O={x:0,y:0};if(x){if(n){var S,M="y"===w?Dt:It,z="y"===w?At:Ft,L="y"===w?"height":"width",D=x[w],A=D+f[M],F=D-f[z],I=u?-_[L]/2:0,W=b===Nt?k[L]:_[L],R=b===Nt?-_[L]:-k[L],N=t.elements.arrow,H=u&&N?nr(N):{width:0,height:0},V=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},j=V[M],B=V[z],q=mr(0,k[L],H[L]),P=y?k[L]/2-I-q-j-T.mainAxis:W-q-j-T.mainAxis,U=y?-k[L]/2+I+q+B+T.mainAxis:R+q+B+T.mainAxis,K=t.elements.arrow&&gr(t.elements.arrow),Y=K?"y"===w?K.clientTop||0:K.clientLeft||0:0,Q=null!=(S=null==E?void 0:E[w])?S:0,G=D+U-Q,X=mr(u?rr(A,D+P-Q-Y):A,D,u?tr(F,G):F);x[w]=X,O[w]=X-D}if(s){var Z,J="x"===w?Dt:It,ee="x"===w?At:Ft,te=x[$],re="y"===$?"height":"width",ie=te+f[J],oe=te-f[ee],ne=-1!==[Dt,It].indexOf(v),ae=null!=(Z=null==E?void 0:E[$])?Z:0,se=ne?ie:te-k[re]-_[re]-ae+T.altAxis,le=ne?te+k[re]+_[re]-ae-T.altAxis:oe,ce=u&&ne?function(e,t,r){var i=mr(e,t,r);return i>r?r:i}(se,te,le):mr(u?se:ie,te,u?le:oe);x[$]=ce,O[$]=ce-te}t.modifiersData[i]=O}},requiresIfExists:["offset"]};function jr(e,t,r){void 0===r&&(r=!1);var i,o,n=Xt(t),a=Xt(t)&&function(e){var t=e.getBoundingClientRect(),r=ir(t.width)/e.offsetWidth||1,i=ir(t.height)/e.offsetHeight||1;return 1!==r||1!==i}(t),s=cr(t),l=or(e,a),c={scrollLeft:0,scrollTop:0},d={x:0,y:0};return(n||!n&&!r)&&(("body"!==Yt(t)||Or(s))&&(c=(i=t)!==Qt(i)&&Xt(i)?{scrollLeft:(o=i).scrollLeft,scrollTop:o.scrollTop}:Tr(i)),Xt(t)?((d=or(t,!0)).x+=t.clientLeft,d.y+=t.clientTop):s&&(d.x=Er(s))),{x:l.left+c.scrollLeft-d.x,y:l.top+c.scrollTop-d.y,width:l.width,height:l.height}}function Br(e){var t=new Map,r=new Set,i=[];function o(e){r.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach((function(e){if(!r.has(e)){var i=t.get(e);i&&o(i)}})),i.push(e)}return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){r.has(e.name)||o(e)})),i}var qr={placement:"bottom",modifiers:[],strategy:"absolute"};function Pr(){for(var e=arguments.length,t=new Array(e),r=0;r{},onAfterHide:()=>{},onTransitionEnd:()=>{}},r),this.isVisible=!1,this.popover.hidden=!0,this.popover.classList.remove(this.options.visibleClass),this.popover.addEventListener("transitionend",this.handleTransitionEnd)}handleTransitionEnd(e){e.target===this.options.transitionElement&&(this.options.onTransitionEnd.call(this,e),this.isVisible||this.popover.hidden||(this.popover.hidden=!0,this.popover.classList.remove(this.options.visibleClass),this.options.onAfterHide.call(this)))}destroy(){this.popover.removeEventListener("transitionend",this.handleTransitionEnd),this.popper&&(this.popper.destroy(),this.popper=null)}show(){this.isVisible=!0,this.popover.hidden=!1,requestAnimationFrame((()=>this.popover.classList.add(this.options.visibleClass))),this.popper&&this.popper.destroy(),this.popper=Kr(this.anchor,this.popover,{placement:this.options.placement,strategy:this.options.strategy,modifiers:[{name:"flip",options:{boundary:"viewport"}},{name:"offset",options:{offset:[this.options.skidding,this.options.distance]}}]}),this.popover.addEventListener("transitionend",(()=>this.options.onAfterShow.call(this)),{once:!0}),requestAnimationFrame((()=>this.popper.update()))}hide(){this.isVisible=!1,this.popover.classList.remove(this.options.visibleClass)}setOptions(e){this.options=Object.assign(this.options,e),this.isVisible?this.popover.classList.add(this.options.visibleClass):this.popover.classList.remove(this.options.visibleClass),this.popper&&(this.popper.setOptions({placement:this.options.placement,strategy:this.options.strategy}),requestAnimationFrame((()=>this.popper.update())))}}let Qr=0;const Gr=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grShow=fe(this,"gr-show",7),this.grAfterShow=fe(this,"gr-after-show",7),this.grHide=fe(this,"gr-hide",7),this.grAfterHide=fe(this,"gr-after-hide",7),this.componentId="dropdown-"+ ++Qr,this.isVisible=!1,this.open=!1,this.placement="bottom-start",this.closeOnSelect=!0,this.containingElement=void 0,this.distance=2,this.skidding=0,this.hoist=!1}handleOpenChange(){this.open?this.show():this.hide(),this.updateAccessibleTrigger()}handlePopoverOptionsChange(){this.popoverElement.setOptions({strategy:this.hoist?"fixed":"absolute",placement:this.placement,distance:this.distance,skidding:this.skidding})}connectedCallback(){this.containingElement||(this.containingElement=this.el),this.handleDocumentKeyDown=this.handleDocumentKeyDown.bind(this),this.handleDocumentMouseDown=this.handleDocumentMouseDown.bind(this),this.handleMenuItemActivate=this.handleMenuItemActivate.bind(this),this.handlePanelSelect=this.handlePanelSelect.bind(this),this.handleTriggerClick=this.handleTriggerClick.bind(this),this.handleTriggerKeyDown=this.handleTriggerKeyDown.bind(this),this.handleTriggerKeyUp=this.handleTriggerKeyUp.bind(this),this.handleTriggerSlotChange=this.handleTriggerSlotChange.bind(this)}componentDidLoad(){this.popoverElement=new Yr(this.trigger,this.positioner,{strategy:this.hoist?"fixed":"absolute",placement:this.placement,distance:this.distance,skidding:this.skidding,transitionElement:this.panel,onAfterHide:()=>this.grAfterHide.emit(),onAfterShow:()=>this.grAfterShow.emit(),onTransitionEnd:()=>{this.open||(this.panel.scrollTop=0)}}),this.open&&this.show()}disconnectedCallback(){this.hide(),this.popoverElement.destroy()}async show(){if(this.isVisible)return;this.grShow.emit().defaultPrevented?this.open=!1:(this.panel.addEventListener("gr-activate",this.handleMenuItemActivate),this.panel.addEventListener("gr-select",this.handlePanelSelect),document.addEventListener("keydown",this.handleDocumentKeyDown),document.addEventListener("mousedown",this.handleDocumentMouseDown),this.isVisible=!0,this.open=!0,this.popoverElement.show())}async hide(){if(!this.isVisible)return;this.grHide.emit().defaultPrevented?this.open=!0:(this.panel.removeEventListener("gr-activate",this.handleMenuItemActivate),this.panel.removeEventListener("gr-select",this.handlePanelSelect),document.addEventListener("keydown",this.handleDocumentKeyDown),document.removeEventListener("mousedown",this.handleDocumentMouseDown),this.isVisible=!1,this.open=!1,this.popoverElement.hide())}async focusOnTrigger(){const e=this.trigger.querySelector("slot").assignedElements({flatten:!0})[0];e&&("function"==typeof e.setFocus?e.setFocus():"function"==typeof e.focus&&e.focus())}getMenu(){return this.panel.querySelector("slot").assignedElements({flatten:!0}).filter((e=>"gr-menu"===e.tagName.toLowerCase()))[0]}handleDocumentKeyDown(e){var t;if("Escape"===e.key)return this.hide(),void this.focusOnTrigger();if("Tab"===e.key){if(this.open&&"gr-menu-item"===(null===(t=document.activeElement)||void 0===t?void 0:t.tagName.toLowerCase()))return e.preventDefault(),this.hide(),void this.focusOnTrigger();setTimeout((()=>{var e;const t=this.containingElement.getRootNode()instanceof ShadowRoot?null===(e=document.activeElement.shadowRoot)||void 0===e?void 0:e.activeElement:document.activeElement;(null==t?void 0:t.closest(this.containingElement.tagName.toLowerCase()))===this.containingElement||this.hide()}))}}handleDocumentMouseDown(e){e.composedPath().includes(this.containingElement)||this.hide()}handleMenuItemActivate(e){Mt(e.target,this.panel)}handlePanelSelect(e){const t=e.target;this.closeOnSelect&&"gr-menu"===t.tagName.toLowerCase()&&(this.hide(),this.focusOnTrigger())}handleTriggerClick(){this.open?this.hide():this.show()}handleTriggerKeyDown(e){const t=this.getMenu(),r=t?[...t.querySelectorAll("gr-menu-item")]:null,i=r[0],o=r[r.length-1];if("Escape"===e.key)return this.focusOnTrigger(),void this.hide();if([" ","Enter"].includes(e.key))return e.preventDefault(),void(this.open?this.hide():this.show());if(["ArrowDown","ArrowUp"].includes(e.key)){if(e.preventDefault(),this.open||this.show(),"ArrowDown"===e.key&&i)return void i.setFocus();if("ArrowUp"===e.key&&o)return void o.setFocus()}this.open&&t&&!["Tab","Shift","Meta","Ctrl","Alt"].includes(e.key)&&t.typeToSelect(e.key)}handleTriggerKeyUp(e){" "===e.key&&e.preventDefault()}handleTriggerSlotChange(){this.updateAccessibleTrigger()}updateAccessibleTrigger(){const e=this.trigger.querySelector("slot").assignedElements({flatten:!0}).map(Lt)[0];e&&(e.setAttribute("aria-haspopup","true"),e.setAttribute("aria-expanded",this.open?"true":"false"))}render(){return de(ge,{id:this.componentId,class:{"dropdown-open":this.open}},de("span",{class:"dropdown-trigger",ref:e=>this.trigger=e,onClick:this.handleTriggerClick,onKeyDown:this.handleTriggerKeyDown,onKeyUp:this.handleTriggerKeyUp},de("slot",{name:"trigger",onSlotchange:this.handleTriggerSlotChange})),de("div",{ref:e=>this.positioner=e,class:"dropdown-positioner"},de("div",{ref:e=>this.panel=e,class:"dropdown-panel",role:"menu","aria-hidden":this.open?"false":"true","aria-labelledby":this.componentId},de("slot",null))))}get el(){return this}static get watchers(){return{open:["handleOpenChange"],distance:["handlePopoverOptionsChange"],hoist:["handlePopoverOptionsChange"],placement:["handlePopoverOptionsChange"],skidding:["handlePopoverOptionsChange"]}}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{--panel-background-color:var(--gr-color-white);--panel-border-radius:var(--gr-border-radius-medium);--panel-border-color:var(--gr-panel-border-color);--panel-box-shadow:var(--gr-shadow-large);--transition:150ms opacity, 150ms transform;display:inline-block;position:relative;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.dropdown-trigger{display:block}.dropdown-positioner{position:absolute;z-index:var(--gr-z-index-dropdown)}.dropdown-panel{max-height:50vh;font-family:var(--gr-font-family);font-size:var(--gr-font-size-medium);font-weight:var(--gr-font-weight-normal);background-color:var(--panel-background-color);border:solid 1px var(--panel-border-color);border-radius:var(--panel-border-radius);box-shadow:var(--panel-box-shadow);opacity:0;overflow:auto;overscroll-behavior:none;pointer-events:none;transform:scale(0.9);transition:var(--transition)}.dropdown-positioner[data-popper-placement^=top] .dropdown-panel{transform-origin:bottom}.dropdown-positioner[data-popper-placement^=bottom] .dropdown-panel{transform-origin:top}.dropdown-positioner[data-popper-placement^=left] .dropdown-panel{transform-origin:right}.dropdown-positioner[data-popper-placement^=right] .dropdown-panel{transform-origin:left}.dropdown-positioner.popover-visible .dropdown-panel{opacity:1;transform:none;pointer-events:all}"}},[1,"gr-dropdown",{open:[1540],placement:[1],closeOnSelect:[4,"close-on-select"],containingElement:[1040],distance:[2],skidding:[2],hoist:[4],show:[64],hide:[64],focusOnTrigger:[64]}]);function Xr(){if("undefined"==typeof customElements)return;["gr-dropdown"].forEach((e=>{if("gr-dropdown"===e)customElements.get(e)||customElements.define(e,Gr)}))}Xr(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const Zr=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grSelect=fe(this,"gr-select",7),this.typeToSelectString=""}connectedCallback(){this.handleClick=this.handleClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}async typeToSelect(e){clearTimeout(this.typeToSelectTimeout),this.typeToSelectTimeout=setTimeout((()=>this.typeToSelectString=""),750),this.typeToSelectString+=e.toLowerCase();const t=this.getItems();for(const e of t){if(kt(e.shadowRoot.querySelector("slot:not([name])")).toLowerCase().trim().substring(0,this.typeToSelectString.length)===this.typeToSelectString){e.setFocus();break}}}getItems(){return[...this.menu.querySelector("slot").assignedElements({flatten:!0})].filter((e=>"gr-menu-item"===e.tagName.toLowerCase()&&!e.disabled))}getActiveItem(){return this.getItems().find((e=>e===document.activeElement))}setActiveItem(e){e.setFocus()}handleClick(e){const t=e.target.closest("gr-menu-item");t&&!t.disabled&&this.grSelect.emit({item:t})}handleKeyDown(e){if("Enter"===e.key){const t=this.getActiveItem();e.preventDefault(),t&&this.grSelect.emit({item:t})}if(" "===e.key&&e.preventDefault(),["ArrowDown","ArrowUp","Home","End"].includes(e.key)){const t=this.getItems(),r=this.getActiveItem();let i=t.indexOf(r);if(t.length)return e.preventDefault(),"ArrowDown"===e.key?i++:"ArrowUp"===e.key?i--:"Home"===e.key?i=0:"End"===e.key&&(i=t.length-1),i<0&&(i=0),i>t.length-1&&(i=t.length-1),void this.setActiveItem(t[i])}this.typeToSelect(e.key)}render(){return de("div",{ref:e=>this.menu=e,class:"menu",role:"menu",onClick:this.handleClick,onKeyDown:this.handleKeyDown},de("slot",null))}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{--padding-top:var(--gr-spacing-x-small);--padding-bottom:var(--gr-spacing-x-small);display:block;padding-top:var(--padding-top);padding-left:0;padding-right:0;padding-bottom:var(--padding-bottom);box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host:focus{outline:none}"}},[1,"gr-menu",{typeToSelect:[64]}]);function Jr(){if("undefined"==typeof customElements)return;["gr-menu"].forEach((e=>{if("gr-menu"===e)customElements.get(e)||customElements.define(e,Zr)}))}Jr(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const ei=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grClear=fe(this,"gr-clear",7),this.type="primary",this.size="medium",this.pill=!1,this.clearable=!1,this.truncate=!1,this.title=""}connectedCallback(){this.handleClearClick=this.handleClearClick.bind(this)}handleClearClick(){this.grClear.emit()}render(){return de(ge,{class:{[`tag-${this.type}`]:!0,[`tag-${this.size}`]:!0,"tag-pill":this.pill,"tag-clearable":this.clearable}},de("span",{class:"tag"},de("span",{class:{"tag-truncate":this.truncate},title:this.title},de("slot",null)),this.clearable&&de("gr-button",{variant:"plain",size:this.size,class:"tag-clear","aria-label":"clear",onClick:this.handleClearClick},de("svg",{slot:"icon-only",role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Close"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 368L144 144M368 144L144 368"})))))}static get style(){return":host{--height:calc(var(--gr-form-element-height-medium) * 0.8);--line-height:calc(var(--gr-form-element-height-medium) - 1px * 2);--border-radius:var(--gr-form-element-border-radius-medium);--border-width:1px;--border-style:solid;--padding-top:0;--padding-start:var(--gr-spacing-small);--padding-end:var(--gr-spacing-small);--padding-bottom:0;--font-size:var(--gr-form-element-font-size-medium);--background-color:rgba(var(--gr-color-primary-rgb), 0.05);--border-color:rgba(var(--gr-color-primary-rgb), 0.2);--color:var(--gr-color-primary-shade);--clear-color:var(--gr-color-primary);--clear-color-hover:var(--gr-color-primary-shade);--clear-margin-left:var(--gr-spacing-xx-small);--clear-margin-right:calc(-1 * var(--gr-spacing-xxx-small));display:inline-block;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host(.tag-success){--background-color:rgba(var(--gr-color-success-rgb), 0.05);--border-color:rgba(var(--gr-color-success-rgb), 0.2);--color:var(--gr-color-success-shade);--clear-color:var(--gr-color-success);--clear-color-hover:var(--gr-color-success-shade)}:host(.tag-info){--background-color:rgba(var(--gr-color-medium-rgb), 0.05);--border-color:rgba(var(--gr-color-medium-rgb), 0.2);--color:var(--gr-color-medium-shade);--clear-color:var(--gr-color-medium);--clear-color-hover:var(--gr-color-medium-shade)}:host(.tag-warning){--background-color:rgba(var(--gr-color-warning-rgb), 0.05);--border-color:rgba(var(--gr-color-warning-rgb), 0.2);--color:var(--gr-color-warning-shade);--clear-color:var(--gr-color-warning);--clear-color-hover:var(--gr-color-warning-shade)}:host(.tag-danger){--background-color:rgba(var(--gr-color-danger-rgb), 0.05);--border-color:rgba(var(--gr-color-danger-rgb), 0.2);--color:var(--gr-color-danger-shade);--clear-color:var(--gr-color-danger);--clear-color-hover:var(--gr-color-danger-shade)}:host(.tag-small){--font-size:var(--gr-form-element-font-size-small);--height:calc(var(--gr-form-element-height-small) * 0.8);--line-height:calc(var(--gr-form-element-height-small) - 1px * 2);--border-radius:var(--gr-form-element-border-radius-small);--padding-start:var(--gr-spacing-x-small);--padding-end:var(--gr-spacing-x-small);--clear-margin-left:var(--gr-spacing-xx-small);--clear-margin-right:calc(-1 * var(--gr-spacing-xxx-small))}:host(.tag-large){--font-size:var(--gr-form-element-font-size-large);--height:calc(var(--gr-form-element-height-large) * 0.8);--line-height:calc(var(--gr-form-element-height-large) - 1px * 2);--border-radius:var(--gr-form-element-border-radius-large);--padding:0 var(--gr-spacing-medium);--clear-margin-left:var(--gr-spacing-xx-small);--clear-margin-right:calc(-1 * var(--gr-spacing-x-small))}.tag{display:flex;align-items:center;border-style:var(--border-style);border-width:var(--border-width);border-radius:var(--border-radius);white-space:nowrap;user-select:none;cursor:default;font-family:var(--gr-font-family);font-size:var(--font-size);font-weight:var(--gr-font-weight-normal);height:var(--height);line-height:var(--line-height);padding-top:var(--padding-top);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-bottom:var(--padding-bottom);background-color:var(--background-color);border-color:var(--border-color);color:var(--color)}.tag-clear{--color:var(--clear-color);--color-hover:var(--clear-color-hover);--padding-start:0;--padding-end:0;margin-left:var(--clear-margin-left);margin-right:var(--clear-margin-right);--height:1em}.tag-clear svg{font-size:0.7em}.tag-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tag-clear svg{width:1.1em;height:1.1em}:host(.tag-pill) .tag{border-radius:var(--height)}"}},[1,"gr-tag",{type:[513],size:[513],pill:[516],clearable:[516],truncate:[516],title:[513]}]);function ti(){if("undefined"==typeof customElements)return;["gr-tag","gr-button","gr-spinner"].forEach((e=>{switch(e){case"gr-tag":customElements.get(e)||customElements.define(e,ei);break;case"gr-button":customElements.get(e)||St();break;case"gr-spinner":customElements.get(e)||Et()}}))}ti(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const ri="undefined"!=typeof HTMLElement?HTMLElement:class{};let ii=0;const oi=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grChange=fe(this,"gr-change",7),this.grFocus=fe(this,"gr-focus",7),this.grBlur=fe(this,"gr-blur",7),this.inputId="select-"+ ++ii,this.labelId=`select-label-${ii}`,this.helpTextId=`select-help-text-${ii}`,this.invalidTextId=`select-invalid-text-${ii}`,this.inheritedAttributes={},this.handleBlur=()=>{this.isOpen||(this.hasFocus=!1,this.grBlur.emit())},this.handleFocus=()=>{this.hasFocus||(this.hasFocus=!0,this.grFocus.emit())},this.hasFocus=!1,this.hasHelpTextSlot=!1,this.hasInvalidTextSlot=!1,this.hasLabelSlot=!1,this.isOpen=!1,this.items=[],this.displayLabel="",this.displayTags=[],this.multiple=!1,this.maxTagsVisible=3,this.disabled=!1,this.name="",this.placeholder="",this.size="medium",this.hoist=!1,this.value="",this.pill=!1,this.label="",this.requiredIndicator=!1,this.helpText="",this.invalidText="",this.invalid=!1,this.clearable=!1}handleDisabledChange(){this.disabled&&this.isOpen&&this.dropdown.hide()}handleLabelChange(){this.handleSlotChange()}handleMultipleChange(){const e=this.getValueAsArray();this.value=this.multiple?e:e[0]||"",this.syncItemsFromValue()}handleValueChange(){this.syncItemsFromValue(),this.grChange.emit()}connectedCallback(){this.handleClearClick=this.handleClearClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleLabelClick=this.handleLabelClick.bind(this),this.handleMenuHide=this.handleMenuHide.bind(this),this.handleMenuShow=this.handleMenuShow.bind(this),this.handleMenuSelect=this.handleMenuSelect.bind(this),this.handleSlotChange=this.handleSlotChange.bind(this),this.handleTagInteraction=this.handleTagInteraction.bind(this),this.el.shadowRoot.addEventListener("slotchange",this.handleSlotChange)}componentWillLoad(){this.handleSlotChange(),this.inheritedAttributes=Ct(this.el,["aria-label"])}componentDidLoad(){this.resizeObserver=new ResizeObserver((()=>this.resizeMenu())),this.reportDuplicateItemValues(),requestAnimationFrame((()=>this.syncItemsFromValue()))}disconnectedCallback(){this.el.shadowRoot.removeEventListener("slotchange",this.handleSlotChange)}async setFocus(){this.hasFocus=!0,this.grFocus.emit(),this.dropdown.focusOnTrigger()}getItemLabel(e){return kt(e.shadowRoot.querySelector("slot:not([name])"))}getItems(){return[...this.el.querySelectorAll("gr-menu-item")]}getValueAsArray(){return Array.isArray(this.value)?this.value:[this.value]}handleClearClick(e){e.stopPropagation(),this.value=this.multiple?[]:"",this.syncItemsFromValue()}handleKeyDown(e){const t=e.target,r=this.getItems(),i=r[0],o=r[r.length-1];if("gr-tag"!==t.tagName.toLowerCase())if("Tab"!==e.key){if(["ArrowDown","ArrowUp"].includes(e.key)){if(e.preventDefault(),this.isOpen||this.dropdown.show(),"ArrowDown"===e.key&&i)return void i.setFocus();if("ArrowUp"===e.key&&o)return void o.setFocus()}this.isOpen||1!==e.key.length||(e.stopPropagation(),e.preventDefault(),this.dropdown.show(),this.menu.typeToSelect(e.key))}else this.isOpen&&this.dropdown.hide()}handleLabelClick(){this.box.focus()}handleMenuSelect(e){const t=e.detail.item;this.multiple?this.value=this.value.includes(t.value)?this.value.filter((e=>e!==t.value)):[...this.value,t.value]:this.value=t.value,this.syncItemsFromValue()}handleMenuShow(e){this.disabled?e.preventDefault():(this.resizeMenu(),this.resizeObserver.observe(this.el),this.isOpen=!0)}handleMenuHide(){this.resizeObserver.unobserve(this.el),this.isOpen=!1,this.box.focus()}handleSlotChange(){this.hasHelpTextSlot=_t(this.el,"help-text"),this.hasInvalidTextSlot=_t(this.el,"invalid-text"),this.hasLabelSlot=_t(this.el,"label"),this.syncItemsFromValue(),this.reportDuplicateItemValues()}handleTagInteraction(e){e.composedPath().find((e=>{if(e instanceof ri)return e.classList.contains("tag-clear")}))&&e.stopPropagation()}reportDuplicateItemValues(){const e=this.getItems().map((e=>e.value)).filter(((e,t,r)=>r.indexOf(e)!==t));if(e.length)throw new Error('Duplicate value found on in : "'+e.join('", "')+'"')}resizeMenu(){this.menu.style.width=`${this.box.clientWidth}px`}syncItemsFromValue(){const e=this.getItems(),t=this.getValueAsArray();if(e.map((e=>e.checked=t.includes(e.value))),this.multiple){const r=[];if(t.map((t=>e.map((e=>e.value===t?r.push(e):null)))),this.displayTags=r.map((e=>de("gr-tag",{type:"info",size:this.size,pill:this.pill,clearable:!0,onClick:this.handleTagInteraction,onKeyDown:this.handleTagInteraction,"onGr-clear":t=>{t.stopPropagation(),this.disabled||(e.checked=!1,this.syncValueFromItems())}},this.getItemLabel(e)))),this.maxTagsVisible>0&&this.displayTags.length>this.maxTagsVisible){const e=this.displayTags.length;this.displayLabel="",this.displayTags=this.displayTags.slice(0,this.maxTagsVisible),this.displayTags.push(de("gr-tag",{type:"info",size:this.size,pill:this.pill},"+",e-this.maxTagsVisible))}}else{const r=e.filter((e=>e.value===t[0]))[0];this.displayLabel=r?this.getItemLabel(r):"",this.displayTags=[]}}syncValueFromItems(){const e=this.getItems().filter((e=>e.checked)).map((e=>e.value));this.multiple?this.value=this.value.filter((t=>e.includes(t))):this.value=e.length>0?e[0]:""}render(){var e;const t=this.multiple?this.value.length>0:""!==this.value,r=this.inheritedAttributes["aria-label"]?{"aria-label":this.inheritedAttributes["aria-label"]}:{"aria-labelledby":this.labelId};return((e,t,r,i)=>{let o=e.querySelector("input.aux-input");o||(o=e.ownerDocument.createElement("input"),o.type="hidden",o.classList.add("aux-input"),e.appendChild(o)),o.disabled=i,o.name=t,o.value=r||""})(this.el,this.name,ni(this.value),this.disabled),de(xt,{inputId:this.inputId,label:this.label,labelId:this.labelId,hasLabelSlot:this.hasLabelSlot,helpTextId:this.helpTextId,helpText:this.helpText,hasHelpTextSlot:this.hasHelpTextSlot,invalidTextId:this.invalidTextId,invalidText:this.invalidText,invalid:this.invalid,hasInvalidTextSlot:this.hasInvalidTextSlot,size:this.size,onLabelClick:this.handleLabelClick,requiredIndicator:this.requiredIndicator},de("gr-dropdown",{ref:e=>this.dropdown=e,hoist:this.hoist,closeOnSelect:!this.multiple,containingElement:this.el,class:{select:!0,"select-open":this.isOpen,"select-empty":0===(null===(e=this.value)||void 0===e?void 0:e.length),"select-focused":this.hasFocus,"select-clearable":this.clearable,"select-disabled":this.disabled,"select-multiple":this.multiple,"select-has-tags":this.multiple&&t,"select-placeholder-visible":""===this.displayLabel,[`select-${this.size}`]:!0,"select-pill":this.pill,"select-invalid":this.invalid},"onGr-show":this.handleMenuShow,"onGr-hide":this.handleMenuHide},de("div",Object.assign({slot:"trigger",ref:e=>this.box=e,id:this.inputId,class:"select-box",role:"combobox"},r,{"aria-describedby":this.invalid?this.invalidTextId:this.helpTextId,"aria-haspopup":"true","aria-expanded":this.isOpen?"true":"false","aria-invalid":this.invalid?"true":"false","aria-required":this.requiredIndicator?"true":"false",tabIndex:this.disabled?-1:0,onBlur:this.handleBlur,onFocus:this.handleFocus,onKeyDown:this.handleKeyDown}),de("div",{class:"select-label"},this.displayTags.length?de("span",{class:"select-tags"},this.displayTags):this.displayLabel||this.placeholder),this.clearable&&t&&de("button",{class:"select-clear",type:"button",onClick:this.handleClearClick,"aria-label":"clear",tabindex:"-1"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Close Circle"),de("path",{d:"M448 256c0-106-86-192-192-192S64 150 64 256s86 192 192 192 192-86 192-192z",fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32"}),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M320 320L192 192M192 320l128-128"}))),de("span",{class:"caret"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Chevron Down"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"M112 184l144 144 144-144"}))),de("input",{class:"select-hidden-select","aria-hidden":"true",value:t?"1":"",tabIndex:-1})),de("gr-menu",{ref:e=>this.menu=e,class:"select-menu","onGr-select":this.handleMenuSelect},de("slot",{onSlotchange:this.handleSlotChange}))))}get el(){return this}static get watchers(){return{disabled:["handleDisabledChange"],helpText:["handleLabelChange"],invalidText:["handleLabelChange"],label:["handleLabelChange"],multiple:["handleMultipleChange"],value:["handleValueChange"]}}static get style(){return".form-control .form-control-label{display:none}.form-control .form-control-help-text{display:none}.form-control .form-control-invalid-text{display:none}.form-control-has-label .form-control-label{display:flex;line-height:var(--gr-line-height-normal);color:var(--gr-form-element-label-color);margin-bottom:var(--gr-spacing-xxx-small)}.form-control-has-label.form-control-small .form-control-label{font-size:var(--gr-form-element-label-font-size-small)}.form-control-has-label.form-control-medium .form-control-label{font-size:var(--gr-form-element-label-font-size-medium)}.form-control-has-label.form-control-large .form-control-label{font-size:var(--gr-form-element-label-font-size-large)}.form-control-has-label .form-control-label .asterisk{margin-left:var(--gr-spacing-x-small);color:var(--gr-color-medium)}.form-control-has-label .form-control-label .asterisk svg{width:0.6em;height:0.6em;margin-bottom:var(--gr-spacing-xxx-small)}.form-control-has-help-text .form-control-help-text{display:block;line-height:var(--gr-line-height-normal);color:var(--gr-form-element-help-text-color);margin-top:var(--gr-spacing-xxx-small)}.form-control-has-help-text.form-control-small .form-control-help-text{font-size:var(--gr-form-element-help-text-font-size-small);min-height:1.625rem}.form-control-has-help-text.form-control-medium .form-control-help-text{font-size:var(--gr-form-element-help-text-font-size-medium);min-height:1.875rem}.form-control-has-help-text.form-control-large .form-control-help-text{font-size:var(--gr-form-element-help-text-font-size-large);min-height:2.125rem}.form-control-has-invalid-text .form-control-invalid-text{display:flex;margin-left:-2px;line-height:var(--gr-line-height-normal);color:var(--gr-form-element-invalid-text-color);margin-top:var(--gr-spacing-xxx-small)}.form-control-has-invalid-text .form-control-invalid-text .icon{margin-top:var(--gr-spacing-xxx-small);margin-right:var(--gr-spacing-xx-small)}.form-control-has-invalid-text .form-control-invalid-text .icon svg{width:1.4em;height:1.4em}.form-control-has-invalid-text.form-control-small .form-control-invalid-text{font-size:var(--gr-form-element-invalid-text-font-size-small);min-height:1.625rem}.form-control-has-invalid-text.form-control-medium .form-control-invalid-text{font-size:var(--gr-form-element-invalid-text-font-size-medium);min-height:1.875rem}.form-control-has-invalid-text.form-control-large .form-control-invalid-text{font-size:var(--gr-form-element-invalid-text-font-size-large);min-height:2.125rem}.gr-scroll-lock{overflow:hidden !important}:host{--font-size:var(--gr-form-element-font-size-medium);--font-weight:var(--gr-font-weight-normal);--background-color:var(--gr-color-white);--background-color-hover:var(--gr-color-white);--background-color-focus:var(--gr-color-white);--background-color-invalid:var(--gr-color-white);--background-color-invalid-hover:var(--gr-color-white);--border-radius:var(--gr-form-element-border-radius-small);--border-color:var(--gr-color-light-shade);--border-color-hover:var(--gr-color-medium);--border-color-focus:var(--gr-color-primary);--border-color-invalid:var(--gr-color-danger);--border-color-invalid-hover:var(--gr-color-danger-shade);--color:var(--gr-color-dark-tint);--placeholder-color:var(--gr-color-medium-tint);--min-height:var(--gr-form-element-height-medium);--label-margin-start:var(--gr-spacing-medium);--label-margin-end:var(--gr-spacing-medium);--clear-icon-margin-end:var(--gr-spacing-medium);--caret-margin-end:var(--gr-spacing-medium);--tags-padding-top:3px;--tags-padding-bottom:3px;--tags-margin-end:var(--gr-spacing-xx-small);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33);display:block;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.select-small{--font-size:var(--gr-form-element-font-size-small);--min-height:var(--gr-form-element-height-small);--label-margin-start:var(--gr-spacing-small);--label-margin-end:var(--gr-spacing-small);--clear-icon-margin-end:var(--gr-spacing-small);--caret-margin-end:var(--gr-spacing-small);--tags-padding-top:2px;--tags-padding-bottom:2px}.select-large{--font-size:var(--gr-form-element-font-size-large);--min-height:var(--gr-form-element-height-large);--label-margin-start:var(--gr-spacing-large);--label-margin-end:var(--gr-spacing-large);--clear-icon-margin-end:var(--gr-spacing-large);--caret-margin-end:var(--gr-spacing-large);--tags-padding-top:4px;--tags-padding-bottom:4px}.select{display:block}.select-box{display:inline-flex;align-items:center;justify-content:start;position:relative;width:100%;font-family:var(--gr-font-family);font-size:var(--font-size);font-weight:var(--font-weight);letter-spacing:normal;background-color:var(--background-color);border:solid 1px var(--border-color);border-radius:var(--border-radius);min-height:var(--min-height);color:var(--color);vertical-align:middle;overflow:hidden;transition:150ms color, 150ms border, 150ms box-shadow;cursor:pointer}.select.select-invalid:not(.select-disabled) .select-box{background-color:var(--background-color-invalid);border-color:var(--border-color-invalid)}.select.select-invalid:not(.select-disabled):not(.select-focused) .select-box:hover{background-color:var(--background-color-invalid-hover);border-color:var(--border-color-invalid-hover)}.select.select-invalid:not(.select-disabled) .select-box{background-color:var(--background-color-invalid);border-color:var(--border-color-invalid)}.select:not(.select-disabled) .select-box:hover{background-color:var(--background-color-hover);border-color:var(--border-color-hover)}.select.select-focused:not(.select-disabled) .select-box{outline:none;box-shadow:var(--focus-ring);border-color:var(--border-color-focus);background-color:var(--background-color-focus)}.select-disabled .select-box{opacity:0.5;cursor:not-allowed;outline:none}.select-disabled .select-tags,.select-disabled .select-clear{pointer-events:none}.select-label{flex:1 1 auto;display:flex;align-items:center;user-select:none;margin-top:0;margin-left:var(--label-margin-start);margin-right:var(--label-margin-end);margin-bottom:0;scrollbar-width:none;-ms-overflow-style:none;overflow-x:auto;overflow-y:hidden;white-space:nowrap}.select-label::-webkit-scrollbar{width:0;height:0}.select-has-tags .select-label{margin-left:0}.select-clear{display:inline-flex;align-items:center;font-size:inherit;color:var(--gr-color-medium);border:none;background:none;padding:0;transition:150ms color;cursor:pointer;margin-right:var(--clear-icon-margin-end)}.select-clear:hover{color:var(--gr-color-dark)}.select-clear:focus{outline:none}.select-clear svg{width:1.2em;height:1.2em;font-size:var(--font-size)}.caret{flex:0 0 auto;display:inline-flex;transition:250ms transform ease;margin-right:var(--caret-margin-end)}.caret svg{width:1em;height:1em;font-size:var(--font-size)}.select-open .caret{transform:rotate(-180deg)}.select-placeholder-visible .select-label{color:var(--placeholder-color)}.select-tags{display:inline-flex;align-items:center;flex-wrap:wrap;justify-content:left;margin-left:var(--gr-spacing-xx-small);padding-bottom:var(--tags-padding-bottom)}.select-tags gr-tag{padding-top:var(--tags-padding-top)}.select-tags gr-tag:not(:last-of-type){margin-right:var(--tags-margin-end)}.select-hidden-select{clip:rect(0 0 0 0);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px;position:absolute;top:0;left:0;width:100%;height:100%}.select-pill .select-box{border-radius:var(--min-height)}"}},[1,"gr-select",{multiple:[4],maxTagsVisible:[2,"max-tags-visible"],disabled:[4],name:[1],placeholder:[1],size:[1],hoist:[4],value:[1025],pill:[4],label:[1],requiredIndicator:[4,"required-indicator"],helpText:[1,"help-text"],invalidText:[1,"invalid-text"],invalid:[516],clearable:[4],hasFocus:[32],hasHelpTextSlot:[32],hasInvalidTextSlot:[32],hasLabelSlot:[32],isOpen:[32],items:[32],displayLabel:[32],displayTags:[32],setFocus:[64]}]),ni=e=>{if(null!=e)return Array.isArray(e)?e.join(","):e.toString()};!function(){if("undefined"==typeof customElements)return;["gr-select","gr-button","gr-dropdown","gr-menu","gr-spinner","gr-tag"].forEach((e=>{switch(e){case"gr-select":customElements.get(e)||customElements.define(e,oi);break;case"gr-button":customElements.get(e)||St();break;case"gr-dropdown":customElements.get(e)||Xr();break;case"gr-menu":customElements.get(e)||Jr();break;case"gr-spinner":customElements.get(e)||Et();break;case"gr-tag":customElements.get(e)||ti()}}))}();const ai=oi,si=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.hasFocus=!1,this.checked=!1,this.value="",this.disabled=!1}connectedCallback(){this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleMouseEnter=this.handleMouseEnter.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this)}async setFocus(e){this.el.focus(e)}async removeFocus(){this.el.blur()}handleBlur(){this.hasFocus=!1}handleFocus(){this.hasFocus=!0}handleMouseEnter(){this.setFocus()}handleMouseLeave(){this.removeFocus()}render(){return de(ge,{class:{"menu-item-checked":this.checked,"menu-item-disabled":this.disabled,"menu-item-focused":this.hasFocus},role:"menuitem","aria-disabled":this.disabled?"true":"false","aria-checked":this.checked?"true":"false",tabIndex:this.disabled?null:0,onFocus:this.handleFocus,onBlur:this.handleBlur,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave},de("span",{class:"checkmark"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Checkmark"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M416 128L192 384l-96-96"}))),de("span",{class:"start"},de("slot",{name:"start"})),de("span",{class:"label"},de("slot",null)),de("span",{class:"end"},de("slot",{name:"end"})))}get el(){return this}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{--line-height:var(--gr-line-height-normal);--background-color:transparent;--background-color-focused:var(--gr-color-primary);--color:var(--gr-color-dark);--color-focused:var(--gr-color-primary-contrast);--color-disabled:var(--gr-color-medium);--padding-top:var(--gr-spacing-xx-small);--padding-start:var(--gr-spacing-x-large);--padding-end:var(--gr-spacing-x-large);--padding-bottom:var(--gr-spacing-xx-small);--transition:background-color 150ms linear, color 150ms linear;position:relative;display:flex;align-items:stretch;font-family:var(--gr-font-family);font-size:var(--gr-font-size-medium);font-weight:var(--gr-font-weight-normal);line-height:var(--line-height);letter-spacing:var(--gr-letter-spacing-normal);text-align:left;background-color:var(--background-color);color:var(--color);padding-top:var(--padding-top);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-bottom:var(--padding-bottom);transition:var(--transition);user-select:none;white-space:nowrap;cursor:pointer;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host(.menu-item-focused:not(.menu-item-disabled)){outline:none;background-color:var(--background-color-focused);color:var(--color-focused)}:host(.menu-item-disabled){outline:none;color:var(--color-disabled);cursor:not-allowed}.checkmark{display:flex;position:absolute;left:0.5em;top:calc(50% - 0.5em);visibility:hidden;align-items:center;font-size:inherit}.checkmark svg{display:inline-block;width:1.1em;height:1.1em;contain:strict;fill:currentcolor;box-sizing:content-box !important}:host(.menu-item-checked) .checkmark{visibility:visible}.label{flex:1 1 auto}.start{flex:0 0 auto;display:flex;align-items:center}.start ::slotted(:last-child){margin-right:0.5em}.end{flex:0 0 auto;display:flex;align-items:center}.end ::slotted(:first-child){margin-left:0.5em}"}},[1,"gr-menu-item",{checked:[516],value:[513],disabled:[516],hasFocus:[32],setFocus:[64],removeFocus:[64]}]); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */!function(){if("undefined"==typeof customElements)return;["gr-menu-item"].forEach((e=>{if("gr-menu-item"===e)customElements.get(e)||customElements.define(e,si)}))}();const li={"gr-select":ai,"gr-menu-item":si};class ci extends(P(_)){constructor(){super(...arguments),this.value=null,this.multiple=!1,this.clearable=!1,this._refSelect=y()}reset(){this.value=null}_valueChangedHandler(e){const t=this._refSelect.value?.value;if(void 0!==t&&!l(this.value,t)){const e=null===this.value;this.value=t,e||w(this,"select:change",t)}}willUpdate(e){e.has("initialValue")&&this.initialValue&&!this.value&&(this.value=this.initialValue)}render(){return $` + ${this.options?.map((e=>$`${e.label}`))} + `}static get styles(){return k(':root, :host {\n --gr-color-primary: #1079b2;\n --gr-color-primary-rgb: 16, 121, 178;\n --gr-color-primary-contrast: #ffffff;\n --gr-color-primary-contrast-rgb: 255, 255, 255;\n --gr-color-primary-shade: #0d6696;\n --gr-color-primary-tint: #1499e1;\n --gr-color-secondary: #051f2c;\n --gr-color-secondary-rgb: 5, 31, 44;\n --gr-color-secondary-contrast: #ffffff;\n --gr-color-secondary-contrast-rgb: 255, 255, 255;\n --gr-color-secondary-shade: #000000;\n --gr-color-secondary-tint: #0a415c;\n --gr-color-tertiary: #0c4a6e;\n --gr-color-tertiary-rgb: 12, 74, 110;\n --gr-color-tertiary-contrast: #ffffff;\n --gr-color-tertiary-contrast-rgb: 255, 255, 255;\n --gr-color-tertiary-shade: #083249;\n --gr-color-tertiary-tint: #106393;\n --gr-color-success: #0fbe78;\n --gr-color-success-rgb: 15, 190, 120;\n --gr-color-success-contrast: #000000;\n --gr-color-success-contrast-rgb: 0, 0, 0;\n --gr-color-success-shade: #057f4e;\n --gr-color-success-tint: #12e28f;\n --gr-color-warning: #fbbc4e;\n --gr-color-warning-rgb: 251, 188, 78;\n --gr-color-warning-contrast: #051f2c;\n --gr-color-warning-contrast-rgb: 5, 31, 44;\n --gr-color-warning-shade: #9e6400;\n --gr-color-warning-tint: #fdd187;\n --gr-color-danger: #e60017;\n --gr-color-danger-rgb: 230, 0, 23;\n --gr-color-danger-contrast: #ffffff;\n --gr-color-danger-contrast-rgb: 255, 255, 255;\n --gr-color-danger-shade: #cc0014;\n --gr-color-danger-tint: #ff1f35;\n --gr-color-light: #f4f5f8;\n --gr-color-light-rgb: 244, 245, 248;\n --gr-color-light-contrast: #051f2c;\n --gr-color-light-contrast-rgb: 5, 31, 44;\n --gr-color-light-shade: #d7d8da;\n --gr-color-light-tint: #f9fafb;\n --gr-color-medium: #5e6c78;\n --gr-color-medium-rgb: 94, 108, 120;\n --gr-color-medium-contrast: #ffffff;\n --gr-color-medium-contrast-rgb: 255, 255, 255;\n --gr-color-medium-shade: #48535b;\n --gr-color-medium-tint: #81909c;\n --gr-color-dark: #02131b;\n --gr-color-dark-rgb: 2, 19, 27;\n --gr-color-dark-contrast: #ffffff;\n --gr-color-dark-contrast-rgb: 255, 255, 255;\n --gr-color-dark-shade: #000000;\n --gr-color-dark-tint: #222428;\n --gr-color-white: #ffffff;\n --gr-color-black: #000000;\n --gr-border-radius-small: 0.125rem;\n --gr-border-radius-medium: 0.25rem;\n --gr-border-radius-large: 0.5rem;\n --gr-border-radius-x-large: 1rem;\n --gr-border-width-small: 0.063rem;\n --gr-border-width-medium: 0.125rem;\n --gr-border-width-large: 0.188rem;\n --gr-shadow-x-small: 0 1px 0 #0d131e0d;\n --gr-shadow-small: 0 1px 2px #0d131e1a;\n --gr-shadow-medium: 0 2px 4px #0d131e1a;\n --gr-shadow-large: 0 2px 8px #0d131e1a;\n --gr-shadow-x-large: 0 4px 16px #0d131e1a;\n --gr-spacing-xxx-small: 0.125rem;\n --gr-spacing-xx-small: 0.25rem;\n --gr-spacing-x-small: 0.5rem;\n --gr-spacing-small: 0.75rem;\n --gr-spacing-medium: 1rem;\n --gr-spacing-large: 1.25rem;\n --gr-spacing-x-large: 1.75rem;\n --gr-spacing-xx-large: 2.25rem;\n --gr-spacing-xxx-large: 3rem;\n --gr-spacing-xxxx-large: 4.5rem;\n --gr-font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,\n sans-serif;\n --gr-letter-spacing-dense: -0.015em;\n --gr-letter-spacing-normal: normal;\n --gr-letter-spacing-loose: 0.075em;\n --gr-line-height-dense: 1.4;\n --gr-line-height-normal: 1.8;\n --gr-line-height-loose: 2.2;\n --gr-font-size-xx-small: 0.625rem;\n --gr-font-size-x-small: 0.75rem;\n --gr-font-size-small: 0.875rem;\n --gr-font-size-medium: 1rem;\n --gr-font-size-large: 1.25rem;\n --gr-font-size-x-large: 1.5rem;\n --gr-font-size-xx-large: 2.25rem;\n --gr-font-size-xxx-large: 3rem;\n --gr-font-size-xxxx-large: 4.5rem;\n --gr-font-weight-thin: 100;\n --gr-font-weight-extra-light: 200;\n --gr-font-weight-light: 300;\n --gr-font-weight-normal: 400;\n --gr-font-weight-medium: 500;\n --gr-font-weight-semi-bold: 600;\n --gr-font-weight-bold: 700;\n --gr-font-weight-extra-bold: 800;\n --gr-font-weight-black: 900;\n --gr-form-element-font-size-x-small: var(--gr-font-size-x-small);\n --gr-form-element-font-size-small: var(--gr-font-size-small);\n --gr-form-element-font-size-medium: var(--gr-font-size-medium);\n --gr-form-element-font-size-large: var(--gr-font-size-large);\n --gr-form-element-height-small: 2.188rem;\n --gr-form-element-height-medium: 3.125rem;\n --gr-form-element-height-large: 4.063rem;\n --gr-form-element-border-radius-small: var(--gr-border-radius-medium);\n --gr-form-element-border-radius-medium: var(--gr-border-radius-medium);\n --gr-form-element-border-radius-large: var(--gr-border-radius-medium);\n --gr-focus-ring-width: 2px;\n --gr-form-element-label-font-size-small: var(--gr-font-size-small);\n --gr-form-element-label-font-size-medium: var(--gr-font-size-medium);\n --gr-form-element-label-font-size-large: var(--gr-font-size-large);\n --gr-form-element-label-color: inherit;\n --gr-form-element-help-text-font-size-small: var(--gr-font-size-x-small);\n --gr-form-element-help-text-font-size-medium: var(--gr-font-size-small);\n --gr-form-element-help-text-font-size-large: var(--gr-font-size-medium);\n --gr-form-element-help-text-color: var(--gr-color-medium);\n --gr-form-element-invalid-text-font-size-small: var(--gr-font-size-x-small);\n --gr-form-element-invalid-text-font-size-medium: var(--gr-font-size-small);\n --gr-form-element-invalid-text-font-size-large: var(--gr-font-size-medium);\n --gr-form-element-invalid-text-color: var(--gr-color-danger);\n --gr-toggle-size: 1rem;\n --gr-panel-border-color: var(--gr-color-light-shade);\n --gr-z-index-dropdown: 900;\n}\n\n')}}ci.elementDefinitions={...li},f([v({attribute:!1,hasChanged:b})],ci.prototype,"options",void 0),f([v({attribute:!1,hasChanged:b})],ci.prototype,"value",void 0),f([v({attribute:!1,hasChanged:b})],ci.prototype,"initialValue",void 0),f([v({attribute:!0})],ci.prototype,"label",void 0),f([v({attribute:!0})],ci.prototype,"placeholder",void 0),f([v({attribute:!0,type:Boolean})],ci.prototype,"multiple",void 0),f([v({attribute:!0,type:Boolean})],ci.prototype,"clearable",void 0);let di=class extends(P(_)){constructor(){super(...arguments),this._mediaFilterController=new U(this),this._refMediaType=y(),this._refCamera=y(),this._refWhen=y(),this._refWhenFrom=y(),this._refWhenTo=y(),this._refWhat=y(),this._refWhere=y(),this._refFavorite=y(),this._refTags=y()}willUpdate(e){e.has("viewManagerEpoch")&&this._mediaFilterController.setViewManager(this.viewManagerEpoch?.manager??null),e.has("cameraManager")&&this.cameraManager&&(this._mediaFilterController.computeCameraOptions(this.cameraManager),this._mediaFilterController.computeMetadataOptions(this.cameraManager)),!e.get("viewManager")&&this.viewManagerEpoch&&this.cameraManager&&this._mediaFilterController.computeInitialDefaultsFromView(this.cameraManager)}render(){const e=async()=>{this.cameraManager&&this.viewManagerEpoch&&this.cardWideConfig&&await this._mediaFilterController.valueChangeHandler(this.cameraManager,this.cardWideConfig,{camera:this._refCamera.value?.value??void 0,mediaType:this._refMediaType.value?.value??void 0,when:{selected:this._refWhen.value?.value??void 0,from:this._refWhenFrom.value?.value,to:this._refWhenTo.value?.value},favorite:this._refFavorite.value?.value??void 0,where:this._refWhere.value?.value??void 0,what:this._refWhat.value?.value??void 0,tags:this._refTags.value?.value??void 0})},t=async t=>{"custom"===t&&this._refWhen.value?this._refWhenFrom.value?.value||this._refWhenTo.value?.value?this._refWhen.value.value=B.Custom:this._refWhen.value.reset():this._refWhen.value?.value!==B.Custom&&(this._refWhenFrom.value?.reset(),this._refWhenTo.value?.reset()),await e()};if(!this.cameraManager||!this.viewManagerEpoch)return;const r=this._mediaFilterController.getControlsToShow(this.cameraManager),o=this._mediaFilterController.getDefaults(),n=this._mediaFilterController.getWhatOptions(),a=this._mediaFilterController.getTagsOptions(),s=this._mediaFilterController.getWhereOptions();return $` e()} + > + +
+ t("selected")} + > + + t("custom")} + > + + t("custom")} + > + +
+ e()} + > + + ${r.events&&n.length?$` e()} + > + `:""} + ${r.events&&a.length?$` e()} + > + `:""} + ${r.events&&s.length?$` e()} + > + `:""} + ${r.favorites?$` + e()} + > + + `:""}`}static get styles(){return k(":host {\n display: flex;\n flex-direction: column;\n overflow: auto;\n scrollbar-width: none;\n -ms-overflow-style: none;\n height: 100%;\n width: 300px;\n margin: 5px;\n}\n\n/* Hide scrollbar for Chrome, Safari and Opera */\n:host::-webkit-scrollbar {\n display: none;\n}\n\nfrigate-card-select {\n padding: 5px;\n}\n\ndiv.when {\n display: inline-flex;\n align-items: flex-end;\n}\n\ndiv.when frigate-card-select {\n flex: 1;\n}\n\ndiv.when frigate-card-date-picker {\n padding-bottom: 5px;\n transition: width 0.5s ease-in-out;\n}\n\ndiv.when frigate-card-date-picker {\n color: var(--secondary-color);\n}\n\ndiv.when frigate-card-date-picker.selected {\n color: var(--primary-color);\n}\n\ndiv.when frigate-card-date-picker.hidden {\n width: 0px;\n}")}};di.elementDefinitions={"frigate-card-select":ci,"frigate-card-date-picker":R},f([v({attribute:!1})],di.prototype,"hass",void 0),f([v({attribute:!1})],di.prototype,"cameraManager",void 0),f([v({attribute:!1})],di.prototype,"viewManagerEpoch",void 0),f([v({attribute:!1})],di.prototype,"cardWideConfig",void 0),di=f([C("frigate-card-media-filter")],di);const hi={closed:"mdi:filter-cog-outline",open:"mdi:filter-cog"};let gi=class extends _{render(){const e=this.viewManagerEpoch?.manager.getView();if(this.hass&&e?.isGalleryView()&&this.cameraManager&&this.cardWideConfig)return $` + + ${this.galleryConfig&&"none"!==this.galleryConfig.controls.filter.mode?$` + `:""} + + + + `}static get styles(){return k(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\nfrigate-card-surround-basic {\n max-height: 110dvh;\n}")}};f([v({attribute:!1})],gi.prototype,"hass",void 0),f([v({attribute:!1})],gi.prototype,"viewManagerEpoch",void 0),f([v({attribute:!1})],gi.prototype,"galleryConfig",void 0),f([v({attribute:!1})],gi.prototype,"cameraManager",void 0),f([v({attribute:!1})],gi.prototype,"cardWideConfig",void 0),gi=f([C("frigate-card-gallery")],gi);let ui=class extends _{constructor(){super(),this._refLoaderBottom=y(),this._refSelected=y(),this._showLoaderBottom=!0,this._showLoaderTop=!1,this._boundWheelHandler=this._wheelHandler.bind(this),this._boundTouchStartHandler=this._touchStartHandler.bind(this),this._boundTouchEndHandler=this._touchEndHandler.bind(this),this._throttleExtendGalleryLater=O(this._extendGallery.bind(this),500,{leading:!0,trailing:!1}),this._touchScrollYPosition=null,this._resizeObserver=new ResizeObserver(this._resizeHandler.bind(this)),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}_touchStartHandler(e){1===e.touches.length?this._touchScrollYPosition=e.touches[0].screenY:this._touchScrollYPosition=null}async _touchEndHandler(e){!this.scrollTop&&1===e.changedTouches.length&&this._touchScrollYPosition&&e.changedTouches[0].screenY>this._touchScrollYPosition&&await this._extendLater(),this._touchScrollYPosition=null}async _wheelHandler(e){!this.scrollTop&&e.deltaY<0&&await this._extendLater()}async _extendLater(){const e=new Date;this._showLoaderTop=!0,await this._throttleExtendGalleryLater("later",!1);const t=(new Date).getTime()-e.getTime();t<500&&await S(.5-t/1e3),this._showLoaderTop=!1}connectedCallback(){super.connectedCallback(),this._resizeObserver.observe(this),this.addEventListener("wheel",this._boundWheelHandler,{passive:!0}),this.addEventListener("touchstart",this._boundTouchStartHandler,{passive:!0}),this.addEventListener("touchend",this._boundTouchEndHandler),this.requestUpdate()}disconnectedCallback(){this.removeEventListener("wheel",this._boundWheelHandler),this.removeEventListener("touchstart",this._boundTouchStartHandler),this.removeEventListener("touchend",this._boundTouchEndHandler),this._resizeObserver.disconnect(),this._intersectionObserver.disconnect(),super.disconnectedCallback()}_setColumnCount(){const e=this.galleryConfig?.controls.thumbnails.size??M.media_gallery.controls.thumbnails.size,t=this.galleryConfig?.controls.thumbnails.show_details?Math.max(1,Math.floor(this.clientWidth/z)):Math.max(1,Math.ceil(this.clientWidth/e));this.style.setProperty("--frigate-card-gallery-columns",String(t))}_resizeHandler(){this._setColumnCount()}async _intersectionHandler(e){e.every((e=>!e.isIntersecting))||(this._showLoaderBottom=!1,await this._extendGallery("earlier"))}async _extendGallery(e,t=!0){const r=this.viewManagerEpoch?.manager.getView();if(!this.cameraManager||!this.hass||!r)return;const i=r.query,n=i?.getQueries()??null,s=r.queryResults?.getResults();if(!i||!n||!s)return;let l;try{l=await this.cameraManager.extendMediaQueries(n,s,e,{useCache:t})}catch(e){return void d(e)}if(l){const e=c.areEventQueries(i)?new o(l.queries):c.areRecordingQueries(i)?new a(l.queries):null;e&&this.viewManagerEpoch?.manager.setViewByParameters({baseView:r,params:{query:e,queryResults:new L({results:l.results}).selectResultIfFound((e=>e===r.queryResults?.getSelectedResult()))}})}}willUpdate(e){if(e.has("galleryConfig")&&(this.galleryConfig?.controls.thumbnails.show_details?this.setAttribute("details",""):this.removeAttribute("details"),this._setColumnCount(),this.galleryConfig?.controls.thumbnails.size&&this.style.setProperty("--frigate-card-thumbnail-size",`${this.galleryConfig.controls.thumbnails.size}px`)),e.has("viewManagerEpoch")){this._showLoaderBottom=!0;const e=this.viewManagerEpoch?.manager.getView(),t=this.viewManagerEpoch?.oldView;this._media&&t?.queryResults?.getResults()===e?.queryResults?.getResults()||(this._media=[...e?.queryResults?.getResults()??[]].reverse())}}render(){if(!this._media||!this.hass)return $``;const e=this.viewManagerEpoch?.manager.getView();if(!e?.queryResults||0===e.queryResults.getResultsCount()){const t=!!e?.context?.loading?.query;return D({type:"info",message:i(t?"error.awaiting_media":"common.no_media"),icon:"mdi:multimedia",dotdotdot:t})}const t=e.queryResults.getSelectedResult();return $`
+ ${this._showLoaderTop?$`${A({cardWideConfig:this.cardWideConfig,classes:{top:!0},size:"small"})}`:""} + ${this._media.map(((r,i)=>$`{this._media&&this.viewManagerEpoch?.manager.setViewByParameters({params:{view:"media",queryResults:e.queryResults?.clone().selectIndex(this._media.length-i-1)}}),F(t)}} + > + `))} + ${this._showLoaderBottom?$`${A({cardWideConfig:this.cardWideConfig,componentRef:this._refLoaderBottom})}`:""} +
`}updated(e){this._refLoaderBottom.value&&(this._intersectionObserver.disconnect(),this._intersectionObserver.observe(this._refLoaderBottom.value)),this.updateComplete.then((()=>{e.has("viewManagerEpoch")&&!e.get("viewManagerEpoch")&&this._refSelected.value&&this._refSelected.value.scrollIntoView({block:"center"})}))}static get styles(){return k(":host {\n width: 100%;\n height: 100%;\n display: block;\n overflow: auto;\n -ms-overflow-style: none;\n scrollbar-width: none;\n --frigate-card-gallery-gap: 3px;\n --frigate-card-gallery-columns: 4;\n}\n\n.grid {\n display: grid;\n grid-template-columns: repeat(var(--frigate-card-gallery-columns), minmax(0, 1fr));\n grid-auto-rows: min-content;\n gap: var(--frigate-card-gallery-gap);\n}\n\n:host::-webkit-scrollbar {\n display: none;\n}\n\nfrigate-card-thumbnail {\n height: 100%;\n max-height: var(--frigate-card-thumbnail-size);\n}\n\nfrigate-card-thumbnail:not([details]) {\n width: 100%;\n}\n\nfrigate-card-thumbnail.selected {\n border: 4px solid var(--accent-color);\n border-radius: calc(var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px)) + 4px);\n}\n\nfrigate-card-progress-indicator.top {\n grid-column: 1/-1;\n}")}};f([v({attribute:!1})],ui.prototype,"hass",void 0),f([v({attribute:!1})],ui.prototype,"viewManagerEpoch",void 0),f([v({attribute:!1})],ui.prototype,"galleryConfig",void 0),f([v({attribute:!1})],ui.prototype,"cameraManager",void 0),f([v({attribute:!1})],ui.prototype,"cardWideConfig",void 0),f([E()],ui.prototype,"_showLoaderBottom",void 0),f([E()],ui.prototype,"_showLoaderTop",void 0),ui=f([C("frigate-card-gallery-core")],ui);export{gi as FrigateCardGallery,ui as FrigateCardGalleryCore}; diff --git a/config/www/community/frigate-hass-card/gallery-15a600d2.js.gz b/config/www/community/frigate-hass-card/gallery-15a600d2.js.gz new file mode 100644 index 00000000..0bb5129b Binary files /dev/null and b/config/www/community/frigate-hass-card/gallery-15a600d2.js.gz differ diff --git a/config/www/community/frigate-hass-card/gallery-1de615c4.js b/config/www/community/frigate-hass-card/gallery-1de615c4.js new file mode 100644 index 00000000..6d2b4b61 --- /dev/null +++ b/config/www/community/frigate-hass-card/gallery-1de615c4.js @@ -0,0 +1,184 @@ +import{d3 as e,d4 as t,d5 as r,l as i,d6 as o,d7 as n,d8 as a,d9 as s,i as l,da as c,db as d,k as h,dc as g,dd as u,de as m,df as p,_ as f,n as v,cW as b,cR as y,dg as w,x as $,cV as x,r as k,a as _,t as C,e as T,b as E,dh as O,di as S,cI as M,dj as z,dk as L,cU as D,dl as A,c$ as F}from"./card-45855f1f.js";import{e as I}from"./endOfDay-24d35e3f.js";import{p as W}from"./parse-114e8d53.js";import{F as R}from"./date-picker-40111fdc.js";function N(t){const r=e(t),i=r.getMonth();return r.setFullYear(r.getFullYear(),i+1,0),r.setHours(23,59,59,999),r}function H(){const e=new Date,t=e.getFullYear(),r=e.getMonth(),i=e.getDate(),o=new Date(0);return o.setFullYear(t,r,i-1),o.setHours(23,59,59,999),o}function V(){const e=new Date,t=e.getFullYear(),r=e.getMonth(),i=e.getDate(),o=new Date(0);return o.setFullYear(t,r,i-1),o.setHours(0,0,0,0),o}var j,B,q; +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +function P(e){return class extends e{createRenderRoot(){const e=this.constructor,{registry:t,elementDefinitions:i,shadowRootOptions:o}=e;i&&!t&&(e.registry=new CustomElementRegistry,Object.entries(i).forEach((([t,r])=>e.registry.define(t,r))));const n=this.renderOptions.creationScope=this.attachShadow({...o,customElements:e.registry});return r(n,this.constructor.elementStyles),n}}}!function(e){e.Favorite="favorite",e.NotFavorite="not-favorite"}(j||(j={})),function(e){e.Today="today",e.Yesterday="yesterday",e.PastWeek="past-week",e.PastMonth="past-month",e.Custom="custom"}(B||(B={})),function(e){e.Clips="clips",e.Snapshots="snapshots",e.Recordings="recordings"}(q||(q={}));class U{constructor(e){this._cameraOptions=[],this._whenOptions=[],this._metaDataWhenOptions=[],this._whatOptions=[],this._whereOptions=[],this._tagsOptions=[],this._defaults=null,this._viewManager=null,this._host=e,this._favoriteOptions=[{value:j.Favorite,label:i("media_filter.favorite")},{value:j.NotFavorite,label:i("media_filter.not_favorite")}],this._mediaTypeOptions=[{value:q.Clips,label:i("media_filter.media_types.clips")},{value:q.Snapshots,label:i("media_filter.media_types.snapshots")},{value:q.Recordings,label:i("media_filter.media_types.recordings")}],this._staticWhenOptions=[{value:B.Today,label:i("media_filter.whens.today")},{value:B.Yesterday,label:i("media_filter.whens.yesterday")},{value:B.PastWeek,label:i("media_filter.whens.past_week")},{value:B.PastMonth,label:i("media_filter.whens.past_month")},{value:B.Custom,label:i("media_filter.whens.custom")}],this._computeWhenOptions()}getMediaTypeOptions(){return this._mediaTypeOptions}getCameraOptions(){return this._cameraOptions}getWhenOptions(){return this._whenOptions}getWhatOptions(){return this._whatOptions}getWhereOptions(){return this._whereOptions}getTagsOptions(){return this._tagsOptions}getFavoriteOptions(){return this._favoriteOptions}getDefaults(){return this._defaults}setViewManager(e){this._viewManager=e}async valueChangeHandler(e,t,r,i){const s=e=>e&&Array.isArray(e)&&e.length&&!e.includes("")?new Set([...e]):null,l=s(r.camera)??this._getAllCameraIDs(e);if(!l.size||!r.mediaType)return;const c=this._getWhen(r.when),d=r.favorite?r.favorite===j.Favorite:null,h=t.performance?.features.media_chunk_size;if(r.mediaType===q.Clips||r.mediaType===q.Snapshots){const e=s(r.where),t=s(r.what),i=s(r.tags),a=new o([{type:n.Event,cameraIDs:l,...i&&{tags:i},...t&&{what:t},...e&&{where:e},...null!==d&&{favorite:d},...c&&{...c.start&&{start:c.start},...c.end&&{end:c.end}},...h&&{limit:h},...r.mediaType===q.Clips&&{hasClip:!0},...r.mediaType===q.Snapshots&&{hasSnapshot:!0}}]);this._viewManager?.setViewByParametersWithExistingQuery({params:{query:a,...1===l.size&&{camera:[...l][0]},view:r.mediaType===q.Clips?"clips":"snapshots"}})}else{const e=new a([{type:n.Recording,cameraIDs:l,...h&&{limit:h},...c&&{...c.start&&{start:c.start},...c.end&&{end:c.end}},...null!==d&&{favorite:d}}]);this._viewManager?.setViewByParametersWithExistingQuery({params:{query:e,...1===l.size&&{camera:[...l][0]},view:"recordings"}})}this._host.requestUpdate()}_getAllCameraIDs(e){return e.getStore().getCameraIDsWithCapability({anyCapabilities:["clips","snapshots","recordings"]})}computeInitialDefaultsFromView(e){const t=this._viewManager?.getView(),r=t?.query?.getQueries(),i=this._getAllCameraIDs(e);if(!t||!r||!i.size)return;let o,n,a,d,h,g;1!==s(r.map((e=>e.cameraIDs)),l).length||l(r[0].cameraIDs,i)||(n=[...r[0].cameraIDs]); +/* istanbul ignore else: the else path cannot be reached -- @preserve */ +if(1===s(r.map((e=>e.favorite)),l).length&&void 0!==r[0].favorite&&(h=r[0].favorite?j.Favorite:j.NotFavorite),c.areEventQueries(t.query)){const e=t.query.getQueries(); +/* istanbul ignore if: the if path cannot be reached -- @preserve */if(!e)return;const r=s(e.map((e=>e.hasClip)),l),i=s(e.map((e=>e.hasSnapshot)),l);1===r.length&&1===i.length&&(o=r[0]?q.Clips:i[0]?q.Snapshots:void 0);1===s(e.map((e=>e.what)),l).length&&e[0].what?.size&&(a=[...e[0].what]);1===s(e.map((e=>e.where)),l).length&&e[0].where?.size&&(d=[...e[0].where]);1===s(e.map((e=>e.tags)),l).length&&e[0].tags?.size&&(g=[...e[0].tags])}else c.areRecordingQueries(t.query)&&(o=q.Recordings);this._defaults={...o&&{mediaType:o},...n&&{cameraIDs:n},...a&&{what:a},...d&&{where:d},...void 0!==h&&{favorite:h},...g&&{tags:g}}}computeCameraOptions(e){this._cameraOptions=[...this._getAllCameraIDs(e)].map((t=>({value:t,label:e.getCameraMetadata(t)?.title??t})))}async computeMetadataOptions(e){let t=null;try{t=await e.getMediaMetadata()}catch(e){d(e)}if(t){if(t.what&&(this._whatOptions=[...t.what].sort().map((e=>({value:e,label:h(e)})))),t.where&&(this._whereOptions=[...t.where].sort().map((e=>({value:e,label:h(e)})))),t.tags&&(this._tagsOptions=[...t.tags].sort().map((e=>({value:e,label:h(e)})))),t.days){const e=new Set;[...t.days].forEach((t=>{e.add(t.substring(0,7))}));const r=[];e.forEach((e=>{r.push(W(e,"yyyy-MM",new Date))})),this._metaDataWhenOptions=g(r,(e=>e.getTime()),"desc").map((e=>({label:u(e,"MMMM yyyy"),value:this._dateRangeToString({start:e,end:N(e)})}))),this._computeWhenOptions()}this._host.requestUpdate()}}getControlsToShow(e){const t=this._viewManager?.getView(),r=c.areEventQueries(t?.query),i=c.areRecordingQueries(t?.query),o=e.getAggregateCameraCapabilities();return{events:r,recordings:i,favorites:r?o?.has("favorite-events"):!!i&&o?.has("favorite-recordings")}}_computeWhenOptions(){this._whenOptions=[...this._staticWhenOptions,...this._metaDataWhenOptions]}_dateRangeToString(e){return`${m(e.start)},${m(e.end)}`}_stringToDateRange(e){const t=e.split(",");return{start:W(t[0],"yyyy-MM-dd",new Date),end:I(W(t[1],"yyyy-MM-dd",new Date))}}_getWhen(e){if(e.from||e.to)return{...e.from&&{start:e.from},...e.to&&{end:e.to}};if(!e.selected||Array.isArray(e.selected))return null;const r=new Date;switch(e.selected){case B.Custom:return null;case B.Today:return{start:t(Date.now()),end:I(Date.now())};case B.Yesterday:return{start:V(),end:H()};case B.PastWeek:return{start:t(p(r,{days:7})),end:I(r)};case B.PastMonth:return{start:t(p(r,{months:1})),end:I(r)};default:return this._stringToDateRange(e.selected)}}}const K=!0,Y=!0,Q=!0,G=!1,X=!1;let Z,J,ee,te=!1,re=!1,ie=!1,oe=!1,ne=null,ae=!1;const se="http://www.w3.org/1999/xlink",le={},ce=e=>"object"===(e=typeof e)||"function"===e;const de=(e,t,...r)=>{let i=null,o=null,n=null,a=!1,s=!1;const l=[],c=t=>{for(let r=0;re[t])).join(" "))}}if("function"==typeof e)return e(null===t?{}:t,l,ue);const d=he(e,null);return d.$attrs$=t,l.length>0&&(d.$children$=l),d.$key$=o,d.$name$=n,d},he=(e,t)=>{const r={$flags$:0,$tag$:e,$text$:t,$elm$:null,$children$:null,$attrs$:null,$key$:null,$name$:null};return r},ge={},ue={forEach:(e,t)=>e.map(me).forEach(t),map:(e,t)=>e.map(me).map(t).map(pe)},me=e=>({vattrs:e.$attrs$,vchildren:e.$children$,vkey:e.$key$,vname:e.$name$,vtag:e.$tag$,vtext:e.$text$}),pe=e=>{if("function"==typeof e.vtag){const t=Object.assign({},e.vattrs);return e.vkey&&(t.key=e.vkey),e.vname&&(t.name=e.vname),de(e.vtag,t,...e.vchildren||[])}const t=he(e.vtag,e.vtext);return t.$attrs$=e.vattrs,t.$children$=e.vchildren,t.$key$=e.vkey,t.$name$=e.vname,t},fe=(e,t,r)=>{const i=e;return{emit:e=>ve(i,t,{bubbles:!!(4&r),composed:!!(2&r),cancelable:!!(1&r),detail:e})}},ve=(e,t,r)=>{const i=ht.ce(t,r);return e.dispatchEvent(i),i},be=new WeakMap,ye=e=>{const t=e.$cmpMeta$,r=e.$hostElement$,i=t.$flags$,o=(t.$tagName$,()=>{}),n=((e,t,r,i)=>{var o;let n=we(t,r);const a=at.get(n);if(e=11===e.nodeType?e:ct,a)if("string"==typeof a){e=e.head||e;let t,r=be.get(e);if(r||be.set(e,r=new Set),!r.has(n)){{t=ct.createElement("style"),t.innerHTML=a;const r=null!==(o=ht.$nonce$)&&void 0!==o?o:function(e){var t,r,i;return null!==(i=null===(r=null===(t=e.head)||void 0===t?void 0:t.querySelector('meta[name="csp-nonce"]'))||void 0===r?void 0:r.getAttribute("content"))&&void 0!==i?i:void 0}(ct);null!=r&&t.setAttribute("nonce",r),e.insertBefore(t,e.querySelector("link"))}r&&r.add(n)}}else e.adoptedStyleSheets.includes(a)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,a]);return n})(r.shadowRoot?r.shadowRoot:r.getRootNode(),t,e.$modeName$);10&i&&(r["s-sc"]=n,r.classList.add(n+"-h"),2&i&&r.classList.add(n+"-s")),o()},we=(e,t)=>"sc-"+(t&&32&e.$flags$?e.$tagName$+"-"+t:e.$tagName$),$e=(e,t,r,i,o,n)=>{if(r!==i){let a=ot(e,t),s=t.toLowerCase();if("class"===t){const t=e.classList,o=ke(r),n=ke(i);t.remove(...o.filter((e=>e&&!n.includes(e)))),t.add(...n.filter((e=>e&&!o.includes(e))))}else if("style"===t){for(const t in r)i&&null!=i[t]||(t.includes("-")?e.style.removeProperty(t):e.style[t]="");for(const t in i)r&&i[t]===r[t]||(t.includes("-")?e.style.setProperty(t,i[t]):e.style[t]=i[t])}else if("key"===t);else if("ref"===t)i&&i(e);else if(e.__lookupSetter__(t)||"o"!==t[0]||"n"!==t[1]){const l=ce(i);if((a||l&&null!==i)&&!o)try{if(e.tagName.includes("-"))e[t]=i;else{const o=null==i?"":i;"list"===t?a=!1:null!=r&&e[t]==o||(e[t]=o)}}catch(e){}let c=!1;s!==(s=s.replace(/^xlink\:?/,""))&&(t=s,c=!0),null==i||!1===i?!1===i&&""!==e.getAttribute(t)||(c?e.removeAttributeNS(se,t):e.removeAttribute(t)):(!a||4&n||o)&&!l&&(i=!0===i?"":i,c?e.setAttributeNS(se,t,i):e.setAttribute(t,i))}else t="-"===t[2]?t.slice(3):ot(lt,s)?s.slice(2):s[2]+t.slice(3),r&&ht.rel(e,t,r,!1),i&&ht.ael(e,t,i,!1)}},xe=/\s/,ke=e=>e?e.split(xe):[],_e=(e,t,r,i)=>{const o=11===t.$elm$.nodeType&&t.$elm$.host?t.$elm$.host:t.$elm$,n=e&&e.$attrs$||le,a=t.$attrs$||le;for(i in n)i in a||$e(o,i,n[i],void 0,r,t.$flags$);for(i in a)$e(o,i,n[i],a[i],r,t.$flags$)},Ce=(e,t,r,i)=>{const o=t.$children$[r];let n,a,s,l=0;if(te||(ie=!0,"slot"===o.$tag$&&(Z&&i.classList.add(Z+"-s"),o.$flags$|=o.$children$?2:1)),null!==o.$text$)n=o.$elm$=ct.createTextNode(o.$text$);else if(1&o.$flags$)n=o.$elm$=ct.createTextNode("");else{if(oe||(oe="svg"===o.$tag$),n=o.$elm$=ct.createElementNS(oe?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",2&o.$flags$?"slot-fb":o.$tag$),oe&&"foreignObject"===o.$tag$&&(oe=!1),_e(null,o,oe),null!=Z&&n["s-si"]!==Z&&n.classList.add(n["s-si"]=Z),o.$children$)for(l=0;l{ht.$flags$|=1;const r=e.childNodes;for(let e=r.length-1;e>=0;e--){const i=r[e];i["s-hn"]!==ee&&i["s-ol"]&&(ze(i).insertBefore(i,Me(i)),i["s-ol"].remove(),i["s-ol"]=void 0,ie=!0),t&&Te(i,t)}ht.$flags$&=-2},Ee=(e,t,r,i,o,n)=>{let a,s=e["s-cr"]&&e["s-cr"].parentNode||e;for(s.shadowRoot&&s.tagName===ee&&(s=s.shadowRoot);o<=n;++o)i[o]&&(a=Ce(null,r,o,e),a&&(i[o].$elm$=a,s.insertBefore(a,Me(t))))},Oe=(e,t,r,i,o)=>{for(;t<=r;++t)(i=e[t])&&(o=i.$elm$,We(i),re=!0,o["s-ol"]?o["s-ol"].remove():Te(o,!0),o.remove())},Se=(e,t)=>e.$tag$===t.$tag$&&("slot"===e.$tag$?e.$name$===t.$name$:e.$key$===t.$key$),Me=e=>e&&e["s-ol"]||e,ze=e=>(e["s-ol"]?e["s-ol"]:e).parentNode,Le=(e,t)=>{const r=t.$elm$=e.$elm$,i=e.$children$,o=t.$children$,n=t.$tag$,a=t.$text$;let s;null===a?(oe="svg"===n||"foreignObject"!==n&&oe,"slot"===n||_e(e,t,oe),null!==i&&null!==o?((e,t,r,i)=>{let o,n,a=0,s=0,l=0,c=0,d=t.length-1,h=t[0],g=t[d],u=i.length-1,m=i[0],p=i[u];for(;a<=d&&s<=u;)if(null==h)h=t[++a];else if(null==g)g=t[--d];else if(null==m)m=i[++s];else if(null==p)p=i[--u];else if(Se(h,m))Le(h,m),h=t[++a],m=i[++s];else if(Se(g,p))Le(g,p),g=t[--d],p=i[--u];else if(Se(h,p))"slot"!==h.$tag$&&"slot"!==p.$tag$||Te(h.$elm$.parentNode,!1),Le(h,p),e.insertBefore(h.$elm$,g.$elm$.nextSibling),h=t[++a],p=i[--u];else if(Se(g,m))"slot"!==h.$tag$&&"slot"!==p.$tag$||Te(g.$elm$.parentNode,!1),Le(g,m),e.insertBefore(g.$elm$,h.$elm$),g=t[--d],m=i[++s];else{for(l=-1,c=a;c<=d;++c)if(t[c]&&null!==t[c].$key$&&t[c].$key$===m.$key$){l=c;break}l>=0?(n=t[l],n.$tag$!==m.$tag$?o=Ce(t&&t[s],r,l,e):(Le(n,m),t[l]=void 0,o=n.$elm$),m=i[++s]):(o=Ce(t&&t[s],r,s,e),m=i[++s]),o&&ze(h.$elm$).insertBefore(o,Me(h.$elm$))}a>d?Ee(e,null==i[u+1]?null:i[u+1].$elm$,r,i,s,u):s>u&&Oe(t,a,d)})(r,i,t,o):null!==o?(null!==e.$text$&&(r.textContent=""),Ee(r,null,t,o,0,o.length-1)):null!==i&&Oe(i,0,i.length-1),oe&&"svg"===n&&(oe=!1)):(s=r["s-cr"])?s.parentNode.textContent=a:e.$text$!==a&&(r.data=a)},De=e=>{const t=e.childNodes;let r,i,o,n,a,s;for(i=0,o=t.length;i{let t,r,i,o,n,a,s=0;const l=e.childNodes,c=l.length;for(;s=0;a--)r=i[a],r["s-cn"]||r["s-nr"]||r["s-hn"]===t["s-hn"]||(Ie(r,o)?(n=Ae.find((e=>e.$nodeToRelocate$===r)),re=!0,r["s-sn"]=r["s-sn"]||o,n?n.$slotRefNode$=t:Ae.push({$slotRefNode$:t,$nodeToRelocate$:r}),r["s-sr"]&&Ae.map((e=>{Ie(e.$nodeToRelocate$,r["s-sn"])&&(n=Ae.find((e=>e.$nodeToRelocate$===r)),n&&!e.$slotRefNode$&&(e.$slotRefNode$=n.$slotRefNode$))}))):Ae.some((e=>e.$nodeToRelocate$===r))||Ae.push({$nodeToRelocate$:r}));1===t.nodeType&&Fe(t)}},Ie=(e,t)=>1===e.nodeType?null===e.getAttribute("slot")&&""===t||e.getAttribute("slot")===t:e["s-sn"]===t||""===t,We=e=>{e.$attrs$&&e.$attrs$.ref&&e.$attrs$.ref(null),e.$children$&&e.$children$.map(We)},Re=(e,t)=>{const r=e.$hostElement$,i=e.$cmpMeta$,o=e.$vnode$||he(null,null),n=(a=t)&&a.$tag$===ge?t:de(null,null,t);var a;if(ee=r.tagName,i.$attrsToReflect$&&(n.$attrs$=n.$attrs$||{},i.$attrsToReflect$.map((([e,t])=>n.$attrs$[t]=r[e]))),n.$tag$=null,n.$flags$|=4,e.$vnode$=n,n.$elm$=o.$elm$=r.shadowRoot||r,Z=r["s-sc"],J=r["s-cr"],te=!!(1&i.$flags$),re=!1,Le(o,n),ht.$flags$|=1,ie){let e,t,r,i,o,a;Fe(n.$elm$);let s=0;for(;s{e.$flags$|=16,e.$ancestorComponent$;return $t((()=>He(e,t)))},He=(e,t)=>{const r=e.$hostElement$,i=(e.$cmpMeta$.$tagName$,()=>{}),o=r;let n;return n=qe(o,t?"componentWillLoad":"componentWillUpdate"),n=Pe(n,(()=>qe(o,"componentWillRender"))),i(),Pe(n,(()=>Ve(e,o,t)))},Ve=async(e,t,r)=>{const i=e.$hostElement$,o=(e.$cmpMeta$.$tagName$,()=>{});i["s-rc"],r&&ye(e);const n=(e.$cmpMeta$.$tagName$,()=>{});je(e,t,i),n(),o(),Be(e)},je=(e,t,r)=>{try{ne=t,t=t.render&&t.render(),e.$flags$&=-17,e.$flags$|=2,(K||Y)&&(Q||Y)&&(G||Re(e,t))}catch(t){nt(t,e.$hostElement$)}return ne=null,null},Be=e=>{e.$cmpMeta$.$tagName$;const t=()=>{},r=e.$hostElement$;e.$ancestorComponent$,qe(r,"componentDidRender"),64&e.$flags$?(qe(r,"componentDidUpdate"),t()):(e.$flags$|=64,qe(r,"componentDidLoad"),t())},qe=(e,t,r)=>{if(e&&e[t])try{return e[t](r)}catch(e){nt(e)}},Pe=(e,t)=>e&&e.then?e.then(t):t(),Ue=(e,t,r,i)=>{const o=rt(e),n=e,a=o.$instanceValues$.get(t),s=o.$flags$,l=n;var c,d;c=r,d=i.$members$[t][0],r=null==c||ce(c)?c:4&d?"false"!==c&&(""===c||!!c):2&d?parseFloat(c):1&d?String(c):c;const h=Number.isNaN(a)&&Number.isNaN(r);if(r!==a&&!h){if(o.$instanceValues$.set(t,r),i.$watchers$&&128&s){const e=i.$watchers$[t];e&&e.map((e=>{try{l[e](r,a,t)}catch(e){nt(e,n)}}))}if(2==(18&s)){if(l.componentShouldUpdate&&!1===l.componentShouldUpdate(r,a,t))return;Ne(o,!1)}}},Ke=(e,t,r)=>{if(t.$members$){e.watchers&&(t.$watchers$=e.watchers);const r=Object.entries(t.$members$),i=e.prototype;r.map((([e,[r]])=>{(31&r||32&r)&&Object.defineProperty(i,e,{get(){return t=e,rt(this).$instanceValues$.get(t);var t},set(r){Ue(this,e,r,t)},configurable:!0,enumerable:!0})}));{const o=new Map;i.attributeChangedCallback=function(e,t,r){ht.jmp((()=>{const t=o.get(e);if(this.hasOwnProperty(t))r=this[t],delete this[t];else if(i.hasOwnProperty(t)&&"number"==typeof this[t]&&this[t]==r)return;this[t]=(null!==r||"boolean"!=typeof this[t])&&r}))},e.observedAttributes=r.filter((([e,t])=>15&t[0])).map((([e,r])=>{const i=r[1]||e;return o.set(i,e),512&r[0]&&t.$attrsToReflect$.push([e,i]),i}))}}return e},Ye=async(e,t,r,i,o)=>{if(!(32&t.$flags$)&&(o=e.constructor,t.$flags$|=32,customElements.whenDefined(r.$tagName$).then((()=>t.$flags$|=128)),o.style)){let i=o.style;"string"!=typeof i&&(i=i[t.$modeName$=(e=>st.map((t=>t(e))).find((e=>!!e)))(e)]);const n=we(r,t.$modeName$);if(!at.has(n)){const e=(r.$tagName$,()=>{});((e,t,r)=>{let i=at.get(e);mt&&r?(i=i||new CSSStyleSheet,"string"==typeof i?i=t:i.replaceSync(t)):i=t,at.set(e,i)})(n,i,!!(1&r.$flags$)),e()}}t.$ancestorComponent$;Ne(t,!0)},Qe=e=>{const t=e["s-cr"]=ct.createComment("");t["s-cn"]=!0,e.insertBefore(t,e.firstChild)},Ge=(e,t)=>{const r={$flags$:t[0],$tagName$:t[1]};r.$members$=t[2],r.$listeners$=t[3],r.$watchers$=e.$watchers$,r.$attrsToReflect$=[],!gt&&1&r.$flags$&&(r.$flags$|=8);const i=e.prototype.connectedCallback,o=e.prototype.disconnectedCallback;return Object.assign(e.prototype,{__registerHost(){it(this,r)},connectedCallback(){(e=>{if(!(1&ht.$flags$)){const t=rt(e),r=t.$cmpMeta$,i=(r.$tagName$,()=>{});1&t.$flags$?(Xe(e,t,r.$listeners$),t.$lazyInstance$):(t.$flags$|=1,12&r.$flags$&&Qe(e),r.$members$&&Object.entries(r.$members$).map((([t,[r]])=>{if(31&r&&e.hasOwnProperty(t)){const r=e[t];delete e[t],e[t]=r}})),Ye(e,t,r)),i()}})(this),i&&i.call(this)},disconnectedCallback(){(e=>{if(!(1&ht.$flags$)){const t=rt(e);t.$rmListeners$&&(t.$rmListeners$.map((e=>e())),t.$rmListeners$=void 0)}})(this),o&&o.call(this)},__attachShadow(){gt?this.attachShadow({mode:"open",delegatesFocus:!!(16&r.$flags$)}):this.shadowRoot=this}}),e.is=r.$tagName$,Ke(e,r)},Xe=(e,t,r,i)=>{r&&r.map((([r,i,o])=>{const n=Je(e,r),a=Ze(t,o),s=et(r);ht.ael(n,i,a,s),(t.$rmListeners$=t.$rmListeners$||[]).push((()=>ht.rel(n,i,a,s)))}))},Ze=(e,t)=>r=>{try{X||e.$hostElement$[t](r)}catch(e){nt(e)}},Je=(e,t)=>4&t?ct:8&t?lt:16&t?ct.body:e,et=e=>ut?{passive:!!(1&e),capture:!!(2&e)}:!!(2&e),tt=new WeakMap,rt=e=>tt.get(e),it=(e,t)=>{const r={$flags$:0,$hostElement$:e,$cmpMeta$:t,$instanceValues$:new Map};return Xe(e,r,t.$listeners$),tt.set(e,r)},ot=(e,t)=>t in e,nt=(e,t)=>(0,console.error)(e,t),at=new Map,st=[],lt="undefined"!=typeof window?window:{},ct=lt.document||{head:{}},dt=lt.HTMLElement||class{},ht={$flags$:0,$resourcesUrl$:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,r,i)=>e.addEventListener(t,r,i),rel:(e,t,r,i)=>e.removeEventListener(t,r,i),ce:(e,t)=>new CustomEvent(e,t)},gt=!0,ut=(()=>{let e=!1;try{ct.addEventListener("e",null,Object.defineProperty({},"passive",{get(){e=!0}}))}catch(e){}return e})(),mt=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync}catch(e){}return!1})(),pt=[],ft=[],vt=(e,t)=>r=>{e.push(r),ae||(ae=!0,t&&4&ht.$flags$?wt(yt):ht.raf(yt))},bt=e=>{for(let t=0;t{bt(pt),bt(ft),(ae=pt.length>0)&&ht.raf(yt)},wt=e=>{return Promise.resolve(t).then(e);var t},$t=vt(ft,!0),xt=(e,t)=>{const r=!!e.label||e.hasLabelSlot,i=!!e.helpText||e.hasHelpTextSlot,o=!!e.invalidText||e.hasInvalidTextSlot,n=!e.invalid,a=!!e.invalid;return de("div",{class:{"form-control":!0,[`form-control-${e.size}`]:!0,"form-control-has-label":r,"form-control-has-help-text":i,"form-control-has-invalid-text":o}},de("label",{id:e.labelId,class:"form-control-label",htmlFor:e.inputId,"aria-hidden":r?"false":"true",onClick:e.onLabelClick},de("slot",{name:"label"},e.label),e.requiredIndicator&&de("div",{class:"asterisk"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 1200 1200"},de("path",{fill:"currentColor",d:"M489.838 29.354v443.603L68.032 335.894 0 545.285l421.829 137.086-260.743 358.876 178.219 129.398L600.048 811.84l260.673 358.806 178.146-129.398-260.766-358.783L1200 545.379l-68.032-209.403-421.899 137.07V29.443H489.84l-.002-.089z"})))),de("div",{class:"form-control-input"},t),n&&de("div",{id:e.helpTextId,class:"form-control-help-text","aria-hidden":i?"false":"true"},de("slot",{name:"help-text"},e.helpText)),a&&de("div",{id:e.invalidTextId,class:"form-control-invalid-text","aria-hidden":o?"false":"true"},de("div",{class:"icon"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Alert Circle"),de("path",{d:"M256,48C141.31,48,48,141.31,48,256s93.31,208,208,208,208-93.31,208-208S370.69,48,256,48Zm0,319.91a20,20,0,1,1,20-20A20,20,0,0,1,256,367.91Zm21.72-201.15-5.74,122a16,16,0,0,1-32,0l-5.74-121.94v-.05a21.74,21.74,0,1,1,43.44,0Z",fill:"currentColor"}))),de("div",{class:"text"},de("slot",{name:"invalid-text"},e.invalidText))))}; +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +function kt(e){const t=e?e.assignedNodes({flatten:!0}):[];let r="";return[...t].map((e=>{e.nodeType===Node.TEXT_NODE&&(r+=e.textContent)})),r}function _t(e,t){return t?null!==e.querySelector(`[slot="${t}"]`):[...e.childNodes].some((e=>{if(e.nodeType===e.TEXT_NODE&&""!==e.textContent.trim())return!0;if(e.nodeType===e.ELEMENT_NODE){if(!e.hasAttribute("slot"))return!0}return!1}))} +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */const Ct=(e,t=[])=>{const r={};return t.forEach((t=>{if(e.hasAttribute(t)){null!==e.getAttribute(t)&&(r[t]=e.getAttribute(t)),e.removeAttribute(t)}})),r},Tt=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow()}render(){return de("span",{class:"spinner","aria-busy":"true","aria-live":"polite"})}static get style(){return":host{--track-color:var(--gr-color-light-shade);--indicator-color:var(--gr-color-primary);--stroke-width:2px;display:inline-flex;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.spinner{display:inline-block;width:1em;height:1em;border-radius:50%;border:solid var(--stroke-width) var(--track-color);border-top-color:var(--indicator-color);border-right-color:var(--indicator-color);animation:1s linear infinite spin}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}"}},[1,"gr-spinner"]);function Et(){if("undefined"==typeof customElements)return;["gr-spinner"].forEach((e=>{if("gr-spinner"===e)customElements.get(e)||customElements.define(e,Tt)}))}Et(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const Ot=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grFocus=fe(this,"gr-focus",7),this.grBlur=fe(this,"gr-blur",7),this.inheritedAttributes={},this.handleClick=e=>{if("button"!==this.type){const t=this.el.closest("form");if(t){e.preventDefault();const r=document.createElement("button");r.type=this.type,r.style.display="none",t.appendChild(r),r.click(),r.remove()}}},this.onFocus=()=>{this.grFocus.emit()},this.onBlur=()=>{this.grBlur.emit()},this.variant="default",this.disabled=!1,this.loading=!1,this.size="medium",this.caret=!1,this.pill=!1,this.expand=void 0,this.circle=!1,this.href=void 0,this.target=void 0,this.rel=void 0,this.type="button"}componentWillLoad(){this.inheritedAttributes=Ct(this.el,["aria-label","tabindex","title"])}async setFocus(e){this.button.focus(e)}async removeFocus(){this.button.blur()}render(){const{rel:e,target:t,href:r,variant:i,size:o,expand:n,type:a,inheritedAttributes:s,disabled:l}=this,c=void 0===r?"button":"a",d="button"===c?{type:a}:{href:r,rel:e,target:t};return de(ge,{onClick:this.handleClick,"aria-disabled":l?"true":null,class:{[`button-${i}`]:!0,[`button-${o}`]:!0,[`button-${n}`]:void 0!==n,"button-caret":this.caret,"button-circle":this.circle,"button-pill":this.pill,"button-disabled":l,"button-loading":this.loading}},de(c,Object.assign({ref:e=>this.button=e},d,{class:"button-native",disabled:l,onFocus:this.onFocus,onBlur:this.onBlur},s),de("span",{class:"button-inner"},de("slot",{name:"icon-only"}),de("slot",{name:"start"}),de("slot",null),de("slot",{name:"end"}),this.caret&&de("span",{class:"caret"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Chevron Down"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"M112 184l144 144 144-144"})))),this.loading&&de("gr-spinner",null)))}get el(){return this}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{display:inline-block;width:auto;font-family:var(--gr-font-family);font-weight:var(--gr-font-weight-medium);font-size:var(--gr-form-element-font-size-medium);font-kerning:none;user-select:none;vertical-align:top;vertical-align:-webkit-baseline-middle;pointer-events:auto;--height:var(--gr-form-element-height-medium);--border-radius:var(--gr-form-element-border-radius-medium);--border-width:1px;--border-style:solid;--background:transparent;--background-hover:transparent;--background-focus:transparent;--color:var(--gr-color-dark-tint);--color-hover:var(--gr-color-dark-tint);--color-focus:var(--gr-color-dark-tint);--border-color:var(--gr-color-light-shade);--border-color-hover:var(--gr-color-medium);--border-color-focus:var(--gr-color-primary);--padding-top:0;--padding-start:var(--gr-spacing-medium);--padding-end:var(--gr-spacing-medium);--padding-bottom:0;--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33);--shadow:none;--transition:background-color 150ms linear, opacity 150ms linear, border 150ms linear, color 150ms linear}:host(.button-disabled){pointer-events:none;opacity:0.5}:host(.button-primary){--border-color:var(--gr-color-primary);--background:var(--gr-color-primary);--color:var(--gr-color-primary-contrast);--border-color-hover:var(--gr-color-primary-shade);--background-hover:var(--gr-color-primary-shade);--color-hover:var(--gr-color-primary-contrast);--border-color-focus:var(--gr-color-primary);--background-focus:var(--gr-color-primary-shade);--color-focus:var(--gr-color-primary-contrast);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33)}:host(.button-secondary){--border-color:var(--gr-color-light-shade);--background:transparent;--color:var(--gr-color-primary);--border-color-hover:var(--gr-color-primary);--background-hover:transparent;--color-hover:var(--gr-color-primary);--border-color-focus:var(--gr-color-primary);--background-focus:transparent;--color-focus:var(--gr-color-primary);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33)}:host(.button-danger){--border-color:var(--gr-color-danger);--background:transparent;--color:var(--gr-color-danger);--border-color-hover:var(--gr-color-danger);--background-hover:var(--gr-color-danger);--color-hover:var(--gr-color-danger-contrast);--border-color-focus:var(--gr-color-danger);--background-focus:var(--gr-color-danger);--color-focus:var(--gr-color-danger-contrast);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-danger-rgb), 0.33)}:host(.button-plain){--border-color:transparent;--background:transparent;--color:var(--gr-color-primary);--border-color-hover:transparent;--background-hover:transparent;--color-hover:var(--gr-color-primary-shade);--border-color-focus:transparent;--background-focus:transparent;--color-focus:var(--gr-color-primary-shade);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33)}:host(.button-small){--padding-start:var(--gr-spacing-small);--padding-end:var(--gr-spacing-small);--border-radius:var(--gr-form-element-border-radius-small);--height:var(--gr-form-element-height-small);font-size:var(--gr-form-element-font-size-small)}:host(.button-large){--padding-start:var(--gr-spacing-large);--padding-end:var(--gr-spacing-large);--border-radius:var(--gr-form-element-border-radius-large);--height:var(--gr-form-element-height-large);font-size:var(--gr-form-element-font-size-large)}:host(.button-block){display:block}:host(.button-block) .button-native{margin-left:0;margin-right:0;display:block;width:100%;clear:both;contain:content}:host(.button-block) .button-native::after{clear:both}:host(.button-full){display:block}:host(.button-full) .button-native{margin-left:0;margin-right:0;display:block;width:100%;contain:content;border-radius:0;border-right-width:0;border-left-width:0}.button-native{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:block;position:relative;padding-top:var(--padding-top);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-bottom:var(--padding-bottom);width:100%;height:var(--height);transition:var(--transition);border-radius:var(--border-radius);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);color:var(--color);box-shadow:var(--shadow);line-height:1;cursor:pointer;z-index:0;text-decoration:none;box-sizing:border-box}.button-native::-moz-focus-inner{border:0}.button-native:focus{outline:none;box-shadow:var(--focus-ring);border-color:var(--border-color-focus);background-color:var(--background-focus);color:var(--color-focus)}.button-native *,.button-native *:before,.button-native *:after{box-sizing:inherit}.button-inner{display:flex;position:relative;flex-flow:row nowrap;flex-shrink:0;align-items:center;justify-content:center;width:100%;height:100%;z-index:1}:host(.button-circle) .button-native{padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;border-radius:50%;width:var(--height)}@media (any-hover: hover){.button-native:hover{color:var(--color-hover);background:var(--background-hover);border-color:var(--border-color-hover)}}:host(.button-caret) .caret{display:flex;align-items:center;margin-left:0.3em}:host(.button-caret) .caret svg{width:1em;height:1em}:host(.button-pill) .button-native{border-radius:var(--height)}::slotted(*){pointer-events:none}::slotted([slot=start]){margin-top:0;margin-left:-0.3em;margin-right:0.3em;margin-bottom:0}::slotted([slot=end]){margin-top:0;margin-left:0.3em;margin-right:-0.2em;margin-bottom:0}::slotted([slot=icon-only]){font-size:1.4em;pointer-events:none}:host(.button-loading){position:relative;pointer-events:none}:host(.button-loading) .caret{visibility:hidden}:host(.button-loading) slot[name=start],:host(.button-loading) slot[name=end],:host(.button-loading) slot[name=icon-only],:host(.button-loading) slot:not([name]){visibility:hidden}:host(.button-loading) gr-spinner{--indicator-color:currentColor;position:absolute;height:1em;width:1em;top:calc(50% - 0.5em);left:calc(50% - 0.5em)}@media not all and (min-resolution: 0.001dpcm){@supports (-webkit-appearance: none) and (stroke-color: transparent){:host([type=button]),:host([type=reset]),:host([type=submit]){-webkit-appearance:none !important}}}"}},[1,"gr-button",{variant:[513],disabled:[516],loading:[516],size:[513],caret:[4],pill:[516],expand:[513],circle:[516],href:[1],target:[1],rel:[1],type:[1],setFocus:[64],removeFocus:[64]}]);function St(){if("undefined"==typeof customElements)return;["gr-button","gr-spinner"].forEach((e=>{switch(e){case"gr-button":customElements.get(e)||customElements.define(e,Ot);break;case"gr-spinner":customElements.get(e)||Et()}}))}function Mt(e,t,r="vertical",i="smooth"){const o= +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +function(e,t){return{top:Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top),left:Math.round(e.getBoundingClientRect().left-t.getBoundingClientRect().left)}}(e,t),n=o.top+t.scrollTop,a=o.left+t.scrollLeft,s=t.scrollLeft,l=t.scrollLeft+t.offsetWidth,c=t.scrollTop,d=t.scrollTop+t.offsetHeight;"horizontal"!==r&&"both"!==r||(al&&t.scrollTo({left:a-t.offsetWidth+e.clientWidth,behavior:i})),"vertical"!==r&&"both"!==r||(nd&&t.scrollTo({top:n-t.offsetHeight+e.clientHeight,behavior:i}))} +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */function zt(e){return e.tabIndex>-1}function Lt(e){if(zt(e))return e;if(e.shadowRoot){const t=[...e.shadowRoot.children].find(zt);if(t)return t}return e.children?[...e.children].map(Lt)[0]:null}St();var Dt="top",At="bottom",Ft="right",It="left",Wt="auto",Rt=[Dt,At,Ft,It],Nt="start",Ht="end",Vt="clippingParents",jt="viewport",Bt="popper",qt="reference",Pt=Rt.reduce((function(e,t){return e.concat([t+"-"+Nt,t+"-"+Ht])}),[]),Ut=[].concat(Rt,[Wt]).reduce((function(e,t){return e.concat([t,t+"-"+Nt,t+"-"+Ht])}),[]),Kt=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function Yt(e){return e?(e.nodeName||"").toLowerCase():null}function Qt(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Gt(e){return e instanceof Qt(e).Element||e instanceof Element}function Xt(e){return e instanceof Qt(e).HTMLElement||e instanceof HTMLElement}function Zt(e){return"undefined"!=typeof ShadowRoot&&(e instanceof Qt(e).ShadowRoot||e instanceof ShadowRoot)}const Jt={name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach((function(e){var r=t.styles[e]||{},i=t.attributes[e]||{},o=t.elements[e];Xt(o)&&Yt(o)&&(Object.assign(o.style,r),Object.keys(i).forEach((function(e){var t=i[e];!1===t?o.removeAttribute(e):o.setAttribute(e,!0===t?"":t)})))}))},effect:function(e){var t=e.state,r={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,r.popper),t.styles=r,t.elements.arrow&&Object.assign(t.elements.arrow.style,r.arrow),function(){Object.keys(t.elements).forEach((function(e){var i=t.elements[e],o=t.attributes[e]||{},n=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:r[e]).reduce((function(e,t){return e[t]="",e}),{});Xt(i)&&Yt(i)&&(Object.assign(i.style,n),Object.keys(o).forEach((function(e){i.removeAttribute(e)})))}))}},requires:["computeStyles"]};function er(e){return e.split("-")[0]}var tr=Math.max,rr=Math.min,ir=Math.round;function or(e,t){void 0===t&&(t=!1);var r=e.getBoundingClientRect(),i=1,o=1;if(Xt(e)&&t){var n=e.offsetHeight,a=e.offsetWidth;a>0&&(i=ir(r.width)/a||1),n>0&&(o=ir(r.height)/n||1)}return{width:r.width/i,height:r.height/o,top:r.top/o,right:r.right/i,bottom:r.bottom/o,left:r.left/i,x:r.left/i,y:r.top/o}}function nr(e){var t=or(e),r=e.offsetWidth,i=e.offsetHeight;return Math.abs(t.width-r)<=1&&(r=t.width),Math.abs(t.height-i)<=1&&(i=t.height),{x:e.offsetLeft,y:e.offsetTop,width:r,height:i}}function ar(e,t){var r=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(r&&Zt(r)){var i=t;do{if(i&&e.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function sr(e){return Qt(e).getComputedStyle(e)}function lr(e){return["table","td","th"].indexOf(Yt(e))>=0}function cr(e){return((Gt(e)?e.ownerDocument:e.document)||window.document).documentElement}function dr(e){return"html"===Yt(e)?e:e.assignedSlot||e.parentNode||(Zt(e)?e.host:null)||cr(e)}function hr(e){return Xt(e)&&"fixed"!==sr(e).position?e.offsetParent:null}function gr(e){for(var t=Qt(e),r=hr(e);r&&lr(r)&&"static"===sr(r).position;)r=hr(r);return r&&("html"===Yt(r)||"body"===Yt(r)&&"static"===sr(r).position)?t:r||function(e){var t=-1!==navigator.userAgent.toLowerCase().indexOf("firefox");if(-1!==navigator.userAgent.indexOf("Trident")&&Xt(e)&&"fixed"===sr(e).position)return null;var r=dr(e);for(Zt(r)&&(r=r.host);Xt(r)&&["html","body"].indexOf(Yt(r))<0;){var i=sr(r);if("none"!==i.transform||"none"!==i.perspective||"paint"===i.contain||-1!==["transform","perspective"].indexOf(i.willChange)||t&&"filter"===i.willChange||t&&i.filter&&"none"!==i.filter)return r;r=r.parentNode}return null}(e)||t}function ur(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function mr(e,t,r){return tr(e,rr(t,r))}function pr(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},e)}function fr(e,t){return t.reduce((function(t,r){return t[r]=e,t}),{})}const vr={name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,r=e.state,i=e.name,o=e.options,n=r.elements.arrow,a=r.modifiersData.popperOffsets,s=er(r.placement),l=ur(s),c=[It,Ft].indexOf(s)>=0?"height":"width";if(n&&a){var d=function(e,t){return pr("number"!=typeof(e="function"==typeof e?e(Object.assign({},t.rects,{placement:t.placement})):e)?e:fr(e,Rt))}(o.padding,r),h=nr(n),g="y"===l?Dt:It,u="y"===l?At:Ft,m=r.rects.reference[c]+r.rects.reference[l]-a[l]-r.rects.popper[c],p=a[l]-r.rects.reference[l],f=gr(n),v=f?"y"===l?f.clientHeight||0:f.clientWidth||0:0,b=m/2-p/2,y=d[g],w=v-h[c]-d[u],$=v/2-h[c]/2+b,x=mr(y,$,w),k=l;r.modifiersData[i]=((t={})[k]=x,t.centerOffset=x-$,t)}},effect:function(e){var t=e.state,r=e.options.element,i=void 0===r?"[data-popper-arrow]":r;null!=i&&("string"!=typeof i||(i=t.elements.popper.querySelector(i)))&&ar(t.elements.popper,i)&&(t.elements.arrow=i)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function br(e){return e.split("-")[1]}var yr={top:"auto",right:"auto",bottom:"auto",left:"auto"};function wr(e){var t,r=e.popper,i=e.popperRect,o=e.placement,n=e.variation,a=e.offsets,s=e.position,l=e.gpuAcceleration,c=e.adaptive,d=e.roundOffsets,h=e.isFixed,g=a.x,u=void 0===g?0:g,m=a.y,p=void 0===m?0:m,f="function"==typeof d?d({x:u,y:p}):{x:u,y:p};u=f.x,p=f.y;var v=a.hasOwnProperty("x"),b=a.hasOwnProperty("y"),y=It,w=Dt,$=window;if(c){var x=gr(r),k="clientHeight",_="clientWidth";if(x===Qt(r)&&"static"!==sr(x=cr(r)).position&&"absolute"===s&&(k="scrollHeight",_="scrollWidth"),o===Dt||(o===It||o===Ft)&&n===Ht)w=At,p-=(h&&x===$&&$.visualViewport?$.visualViewport.height:x[k])-i.height,p*=l?1:-1;if(o===It||(o===Dt||o===At)&&n===Ht)y=Ft,u-=(h&&x===$&&$.visualViewport?$.visualViewport.width:x[_])-i.width,u*=l?1:-1}var C,T=Object.assign({position:s},c&&yr),E=!0===d?function(e){var t=e.x,r=e.y,i=window.devicePixelRatio||1;return{x:ir(t*i)/i||0,y:ir(r*i)/i||0}}({x:u,y:p}):{x:u,y:p};return u=E.x,p=E.y,l?Object.assign({},T,((C={})[w]=b?"0":"",C[y]=v?"0":"",C.transform=($.devicePixelRatio||1)<=1?"translate("+u+"px, "+p+"px)":"translate3d("+u+"px, "+p+"px, 0)",C)):Object.assign({},T,((t={})[w]=b?p+"px":"",t[y]=v?u+"px":"",t.transform="",t))}var $r={passive:!0};var xr={left:"right",right:"left",bottom:"top",top:"bottom"};function kr(e){return e.replace(/left|right|bottom|top/g,(function(e){return xr[e]}))}var _r={start:"end",end:"start"};function Cr(e){return e.replace(/start|end/g,(function(e){return _r[e]}))}function Tr(e){var t=Qt(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function Er(e){return or(cr(e)).left+Tr(e).scrollLeft}function Or(e){var t=sr(e),r=t.overflow,i=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(r+o+i)}function Sr(e){return["html","body","#document"].indexOf(Yt(e))>=0?e.ownerDocument.body:Xt(e)&&Or(e)?e:Sr(dr(e))}function Mr(e,t){var r;void 0===t&&(t=[]);var i=Sr(e),o=i===(null==(r=e.ownerDocument)?void 0:r.body),n=Qt(i),a=o?[n].concat(n.visualViewport||[],Or(i)?i:[]):i,s=t.concat(a);return o?s:s.concat(Mr(dr(a)))}function zr(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function Lr(e,t){return t===jt?zr(function(e){var t=Qt(e),r=cr(e),i=t.visualViewport,o=r.clientWidth,n=r.clientHeight,a=0,s=0;return i&&(o=i.width,n=i.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(a=i.offsetLeft,s=i.offsetTop)),{width:o,height:n,x:a+Er(e),y:s}}(e)):Gt(t)?function(e){var t=or(e);return t.top=t.top+e.clientTop,t.left=t.left+e.clientLeft,t.bottom=t.top+e.clientHeight,t.right=t.left+e.clientWidth,t.width=e.clientWidth,t.height=e.clientHeight,t.x=t.left,t.y=t.top,t}(t):zr(function(e){var t,r=cr(e),i=Tr(e),o=null==(t=e.ownerDocument)?void 0:t.body,n=tr(r.scrollWidth,r.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=tr(r.scrollHeight,r.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),s=-i.scrollLeft+Er(e),l=-i.scrollTop;return"rtl"===sr(o||r).direction&&(s+=tr(r.clientWidth,o?o.clientWidth:0)-n),{width:n,height:a,x:s,y:l}}(cr(e)))}function Dr(e,t,r){var i="clippingParents"===t?function(e){var t=Mr(dr(e)),r=["absolute","fixed"].indexOf(sr(e).position)>=0&&Xt(e)?gr(e):e;return Gt(r)?t.filter((function(e){return Gt(e)&&ar(e,r)&&"body"!==Yt(e)})):[]}(e):[].concat(t),o=[].concat(i,[r]),n=o[0],a=o.reduce((function(t,r){var i=Lr(e,r);return t.top=tr(i.top,t.top),t.right=rr(i.right,t.right),t.bottom=rr(i.bottom,t.bottom),t.left=tr(i.left,t.left),t}),Lr(e,n));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function Ar(e){var t,r=e.reference,i=e.element,o=e.placement,n=o?er(o):null,a=o?br(o):null,s=r.x+r.width/2-i.width/2,l=r.y+r.height/2-i.height/2;switch(n){case Dt:t={x:s,y:r.y-i.height};break;case At:t={x:s,y:r.y+r.height};break;case Ft:t={x:r.x+r.width,y:l};break;case It:t={x:r.x-i.width,y:l};break;default:t={x:r.x,y:r.y}}var c=n?ur(n):null;if(null!=c){var d="y"===c?"height":"width";switch(a){case Nt:t[c]=t[c]-(r[d]/2-i[d]/2);break;case Ht:t[c]=t[c]+(r[d]/2-i[d]/2)}}return t}function Fr(e,t){void 0===t&&(t={});var r=t,i=r.placement,o=void 0===i?e.placement:i,n=r.boundary,a=void 0===n?Vt:n,s=r.rootBoundary,l=void 0===s?jt:s,c=r.elementContext,d=void 0===c?Bt:c,h=r.altBoundary,g=void 0!==h&&h,u=r.padding,m=void 0===u?0:u,p=pr("number"!=typeof m?m:fr(m,Rt)),f=d===Bt?qt:Bt,v=e.rects.popper,b=e.elements[g?f:d],y=Dr(Gt(b)?b:b.contextElement||cr(e.elements.popper),a,l),w=or(e.elements.reference),$=Ar({reference:w,element:v,strategy:"absolute",placement:o}),x=zr(Object.assign({},v,$)),k=d===Bt?x:w,_={top:y.top-k.top+p.top,bottom:k.bottom-y.bottom+p.bottom,left:y.left-k.left+p.left,right:k.right-y.right+p.right},C=e.modifiersData.offset;if(d===Bt&&C){var T=C[o];Object.keys(_).forEach((function(e){var t=[Ft,At].indexOf(e)>=0?1:-1,r=[Dt,At].indexOf(e)>=0?"y":"x";_[e]+=T[r]*t}))}return _}function Ir(e,t){void 0===t&&(t={});var r=t,i=r.placement,o=r.boundary,n=r.rootBoundary,a=r.padding,s=r.flipVariations,l=r.allowedAutoPlacements,c=void 0===l?Ut:l,d=br(i),h=d?s?Pt:Pt.filter((function(e){return br(e)===d})):Rt,g=h.filter((function(e){return c.indexOf(e)>=0}));0===g.length&&(g=h);var u=g.reduce((function(t,r){return t[r]=Fr(e,{placement:r,boundary:o,rootBoundary:n,padding:a})[er(r)],t}),{});return Object.keys(u).sort((function(e,t){return u[e]-u[t]}))}const Wr={name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,r=e.options,i=e.name;if(!t.modifiersData[i]._skip){for(var o=r.mainAxis,n=void 0===o||o,a=r.altAxis,s=void 0===a||a,l=r.fallbackPlacements,c=r.padding,d=r.boundary,h=r.rootBoundary,g=r.altBoundary,u=r.flipVariations,m=void 0===u||u,p=r.allowedAutoPlacements,f=t.options.placement,v=er(f),b=l||(v===f||!m?[kr(f)]:function(e){if(er(e)===Wt)return[];var t=kr(e);return[Cr(e),t,Cr(t)]}(f)),y=[f].concat(b).reduce((function(e,r){return e.concat(er(r)===Wt?Ir(t,{placement:r,boundary:d,rootBoundary:h,padding:c,flipVariations:m,allowedAutoPlacements:p}):r)}),[]),w=t.rects.reference,$=t.rects.popper,x=new Map,k=!0,_=y[0],C=0;C=0,M=S?"width":"height",z=Fr(t,{placement:T,boundary:d,rootBoundary:h,altBoundary:g,padding:c}),L=S?O?Ft:It:O?At:Dt;w[M]>$[M]&&(L=kr(L));var D=kr(L),A=[];if(n&&A.push(z[E]<=0),s&&A.push(z[L]<=0,z[D]<=0),A.every((function(e){return e}))){_=T,k=!1;break}x.set(T,A)}if(k)for(var F=function(e){var t=y.find((function(t){var r=x.get(t);if(r)return r.slice(0,e).every((function(e){return e}))}));if(t)return _=t,"break"},I=m?3:1;I>0;I--){if("break"===F(I))break}t.placement!==_&&(t.modifiersData[i]._skip=!0,t.placement=_,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function Rr(e,t,r){return void 0===r&&(r={x:0,y:0}),{top:e.top-t.height-r.y,right:e.right-t.width+r.x,bottom:e.bottom-t.height+r.y,left:e.left-t.width-r.x}}function Nr(e){return[Dt,Ft,At,It].some((function(t){return e[t]>=0}))}const Hr={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,r=e.options,i=e.name,o=r.offset,n=void 0===o?[0,0]:o,a=Ut.reduce((function(e,r){return e[r]=function(e,t,r){var i=er(e),o=[It,Dt].indexOf(i)>=0?-1:1,n="function"==typeof r?r(Object.assign({},t,{placement:e})):r,a=n[0],s=n[1];return a=a||0,s=(s||0)*o,[It,Ft].indexOf(i)>=0?{x:s,y:a}:{x:a,y:s}}(r,t.rects,n),e}),{}),s=a[t.placement],l=s.x,c=s.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=c),t.modifiersData[i]=a}};const Vr={name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,r=e.options,i=e.name,o=r.mainAxis,n=void 0===o||o,a=r.altAxis,s=void 0!==a&&a,l=r.boundary,c=r.rootBoundary,d=r.altBoundary,h=r.padding,g=r.tether,u=void 0===g||g,m=r.tetherOffset,p=void 0===m?0:m,f=Fr(t,{boundary:l,rootBoundary:c,padding:h,altBoundary:d}),v=er(t.placement),b=br(t.placement),y=!b,w=ur(v),$="x"===w?"y":"x",x=t.modifiersData.popperOffsets,k=t.rects.reference,_=t.rects.popper,C="function"==typeof p?p(Object.assign({},t.rects,{placement:t.placement})):p,T="number"==typeof C?{mainAxis:C,altAxis:C}:Object.assign({mainAxis:0,altAxis:0},C),E=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,O={x:0,y:0};if(x){if(n){var S,M="y"===w?Dt:It,z="y"===w?At:Ft,L="y"===w?"height":"width",D=x[w],A=D+f[M],F=D-f[z],I=u?-_[L]/2:0,W=b===Nt?k[L]:_[L],R=b===Nt?-_[L]:-k[L],N=t.elements.arrow,H=u&&N?nr(N):{width:0,height:0},V=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},j=V[M],B=V[z],q=mr(0,k[L],H[L]),P=y?k[L]/2-I-q-j-T.mainAxis:W-q-j-T.mainAxis,U=y?-k[L]/2+I+q+B+T.mainAxis:R+q+B+T.mainAxis,K=t.elements.arrow&&gr(t.elements.arrow),Y=K?"y"===w?K.clientTop||0:K.clientLeft||0:0,Q=null!=(S=null==E?void 0:E[w])?S:0,G=D+U-Q,X=mr(u?rr(A,D+P-Q-Y):A,D,u?tr(F,G):F);x[w]=X,O[w]=X-D}if(s){var Z,J="x"===w?Dt:It,ee="x"===w?At:Ft,te=x[$],re="y"===$?"height":"width",ie=te+f[J],oe=te-f[ee],ne=-1!==[Dt,It].indexOf(v),ae=null!=(Z=null==E?void 0:E[$])?Z:0,se=ne?ie:te-k[re]-_[re]-ae+T.altAxis,le=ne?te+k[re]+_[re]-ae-T.altAxis:oe,ce=u&&ne?function(e,t,r){var i=mr(e,t,r);return i>r?r:i}(se,te,le):mr(u?se:ie,te,u?le:oe);x[$]=ce,O[$]=ce-te}t.modifiersData[i]=O}},requiresIfExists:["offset"]};function jr(e,t,r){void 0===r&&(r=!1);var i,o,n=Xt(t),a=Xt(t)&&function(e){var t=e.getBoundingClientRect(),r=ir(t.width)/e.offsetWidth||1,i=ir(t.height)/e.offsetHeight||1;return 1!==r||1!==i}(t),s=cr(t),l=or(e,a),c={scrollLeft:0,scrollTop:0},d={x:0,y:0};return(n||!n&&!r)&&(("body"!==Yt(t)||Or(s))&&(c=(i=t)!==Qt(i)&&Xt(i)?{scrollLeft:(o=i).scrollLeft,scrollTop:o.scrollTop}:Tr(i)),Xt(t)?((d=or(t,!0)).x+=t.clientLeft,d.y+=t.clientTop):s&&(d.x=Er(s))),{x:l.left+c.scrollLeft-d.x,y:l.top+c.scrollTop-d.y,width:l.width,height:l.height}}function Br(e){var t=new Map,r=new Set,i=[];function o(e){r.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach((function(e){if(!r.has(e)){var i=t.get(e);i&&o(i)}})),i.push(e)}return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){r.has(e.name)||o(e)})),i}var qr={placement:"bottom",modifiers:[],strategy:"absolute"};function Pr(){for(var e=arguments.length,t=new Array(e),r=0;r{},onAfterHide:()=>{},onTransitionEnd:()=>{}},r),this.isVisible=!1,this.popover.hidden=!0,this.popover.classList.remove(this.options.visibleClass),this.popover.addEventListener("transitionend",this.handleTransitionEnd)}handleTransitionEnd(e){e.target===this.options.transitionElement&&(this.options.onTransitionEnd.call(this,e),this.isVisible||this.popover.hidden||(this.popover.hidden=!0,this.popover.classList.remove(this.options.visibleClass),this.options.onAfterHide.call(this)))}destroy(){this.popover.removeEventListener("transitionend",this.handleTransitionEnd),this.popper&&(this.popper.destroy(),this.popper=null)}show(){this.isVisible=!0,this.popover.hidden=!1,requestAnimationFrame((()=>this.popover.classList.add(this.options.visibleClass))),this.popper&&this.popper.destroy(),this.popper=Kr(this.anchor,this.popover,{placement:this.options.placement,strategy:this.options.strategy,modifiers:[{name:"flip",options:{boundary:"viewport"}},{name:"offset",options:{offset:[this.options.skidding,this.options.distance]}}]}),this.popover.addEventListener("transitionend",(()=>this.options.onAfterShow.call(this)),{once:!0}),requestAnimationFrame((()=>this.popper.update()))}hide(){this.isVisible=!1,this.popover.classList.remove(this.options.visibleClass)}setOptions(e){this.options=Object.assign(this.options,e),this.isVisible?this.popover.classList.add(this.options.visibleClass):this.popover.classList.remove(this.options.visibleClass),this.popper&&(this.popper.setOptions({placement:this.options.placement,strategy:this.options.strategy}),requestAnimationFrame((()=>this.popper.update())))}}let Qr=0;const Gr=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grShow=fe(this,"gr-show",7),this.grAfterShow=fe(this,"gr-after-show",7),this.grHide=fe(this,"gr-hide",7),this.grAfterHide=fe(this,"gr-after-hide",7),this.componentId="dropdown-"+ ++Qr,this.isVisible=!1,this.open=!1,this.placement="bottom-start",this.closeOnSelect=!0,this.containingElement=void 0,this.distance=2,this.skidding=0,this.hoist=!1}handleOpenChange(){this.open?this.show():this.hide(),this.updateAccessibleTrigger()}handlePopoverOptionsChange(){this.popoverElement.setOptions({strategy:this.hoist?"fixed":"absolute",placement:this.placement,distance:this.distance,skidding:this.skidding})}connectedCallback(){this.containingElement||(this.containingElement=this.el),this.handleDocumentKeyDown=this.handleDocumentKeyDown.bind(this),this.handleDocumentMouseDown=this.handleDocumentMouseDown.bind(this),this.handleMenuItemActivate=this.handleMenuItemActivate.bind(this),this.handlePanelSelect=this.handlePanelSelect.bind(this),this.handleTriggerClick=this.handleTriggerClick.bind(this),this.handleTriggerKeyDown=this.handleTriggerKeyDown.bind(this),this.handleTriggerKeyUp=this.handleTriggerKeyUp.bind(this),this.handleTriggerSlotChange=this.handleTriggerSlotChange.bind(this)}componentDidLoad(){this.popoverElement=new Yr(this.trigger,this.positioner,{strategy:this.hoist?"fixed":"absolute",placement:this.placement,distance:this.distance,skidding:this.skidding,transitionElement:this.panel,onAfterHide:()=>this.grAfterHide.emit(),onAfterShow:()=>this.grAfterShow.emit(),onTransitionEnd:()=>{this.open||(this.panel.scrollTop=0)}}),this.open&&this.show()}disconnectedCallback(){this.hide(),this.popoverElement.destroy()}async show(){if(this.isVisible)return;this.grShow.emit().defaultPrevented?this.open=!1:(this.panel.addEventListener("gr-activate",this.handleMenuItemActivate),this.panel.addEventListener("gr-select",this.handlePanelSelect),document.addEventListener("keydown",this.handleDocumentKeyDown),document.addEventListener("mousedown",this.handleDocumentMouseDown),this.isVisible=!0,this.open=!0,this.popoverElement.show())}async hide(){if(!this.isVisible)return;this.grHide.emit().defaultPrevented?this.open=!0:(this.panel.removeEventListener("gr-activate",this.handleMenuItemActivate),this.panel.removeEventListener("gr-select",this.handlePanelSelect),document.addEventListener("keydown",this.handleDocumentKeyDown),document.removeEventListener("mousedown",this.handleDocumentMouseDown),this.isVisible=!1,this.open=!1,this.popoverElement.hide())}async focusOnTrigger(){const e=this.trigger.querySelector("slot").assignedElements({flatten:!0})[0];e&&("function"==typeof e.setFocus?e.setFocus():"function"==typeof e.focus&&e.focus())}getMenu(){return this.panel.querySelector("slot").assignedElements({flatten:!0}).filter((e=>"gr-menu"===e.tagName.toLowerCase()))[0]}handleDocumentKeyDown(e){var t;if("Escape"===e.key)return this.hide(),void this.focusOnTrigger();if("Tab"===e.key){if(this.open&&"gr-menu-item"===(null===(t=document.activeElement)||void 0===t?void 0:t.tagName.toLowerCase()))return e.preventDefault(),this.hide(),void this.focusOnTrigger();setTimeout((()=>{var e;const t=this.containingElement.getRootNode()instanceof ShadowRoot?null===(e=document.activeElement.shadowRoot)||void 0===e?void 0:e.activeElement:document.activeElement;(null==t?void 0:t.closest(this.containingElement.tagName.toLowerCase()))===this.containingElement||this.hide()}))}}handleDocumentMouseDown(e){e.composedPath().includes(this.containingElement)||this.hide()}handleMenuItemActivate(e){Mt(e.target,this.panel)}handlePanelSelect(e){const t=e.target;this.closeOnSelect&&"gr-menu"===t.tagName.toLowerCase()&&(this.hide(),this.focusOnTrigger())}handleTriggerClick(){this.open?this.hide():this.show()}handleTriggerKeyDown(e){const t=this.getMenu(),r=t?[...t.querySelectorAll("gr-menu-item")]:null,i=r[0],o=r[r.length-1];if("Escape"===e.key)return this.focusOnTrigger(),void this.hide();if([" ","Enter"].includes(e.key))return e.preventDefault(),void(this.open?this.hide():this.show());if(["ArrowDown","ArrowUp"].includes(e.key)){if(e.preventDefault(),this.open||this.show(),"ArrowDown"===e.key&&i)return void i.setFocus();if("ArrowUp"===e.key&&o)return void o.setFocus()}this.open&&t&&!["Tab","Shift","Meta","Ctrl","Alt"].includes(e.key)&&t.typeToSelect(e.key)}handleTriggerKeyUp(e){" "===e.key&&e.preventDefault()}handleTriggerSlotChange(){this.updateAccessibleTrigger()}updateAccessibleTrigger(){const e=this.trigger.querySelector("slot").assignedElements({flatten:!0}).map(Lt)[0];e&&(e.setAttribute("aria-haspopup","true"),e.setAttribute("aria-expanded",this.open?"true":"false"))}render(){return de(ge,{id:this.componentId,class:{"dropdown-open":this.open}},de("span",{class:"dropdown-trigger",ref:e=>this.trigger=e,onClick:this.handleTriggerClick,onKeyDown:this.handleTriggerKeyDown,onKeyUp:this.handleTriggerKeyUp},de("slot",{name:"trigger",onSlotchange:this.handleTriggerSlotChange})),de("div",{ref:e=>this.positioner=e,class:"dropdown-positioner"},de("div",{ref:e=>this.panel=e,class:"dropdown-panel",role:"menu","aria-hidden":this.open?"false":"true","aria-labelledby":this.componentId},de("slot",null))))}get el(){return this}static get watchers(){return{open:["handleOpenChange"],distance:["handlePopoverOptionsChange"],hoist:["handlePopoverOptionsChange"],placement:["handlePopoverOptionsChange"],skidding:["handlePopoverOptionsChange"]}}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{--panel-background-color:var(--gr-color-white);--panel-border-radius:var(--gr-border-radius-medium);--panel-border-color:var(--gr-panel-border-color);--panel-box-shadow:var(--gr-shadow-large);--transition:150ms opacity, 150ms transform;display:inline-block;position:relative;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.dropdown-trigger{display:block}.dropdown-positioner{position:absolute;z-index:var(--gr-z-index-dropdown)}.dropdown-panel{max-height:50vh;font-family:var(--gr-font-family);font-size:var(--gr-font-size-medium);font-weight:var(--gr-font-weight-normal);background-color:var(--panel-background-color);border:solid 1px var(--panel-border-color);border-radius:var(--panel-border-radius);box-shadow:var(--panel-box-shadow);opacity:0;overflow:auto;overscroll-behavior:none;pointer-events:none;transform:scale(0.9);transition:var(--transition)}.dropdown-positioner[data-popper-placement^=top] .dropdown-panel{transform-origin:bottom}.dropdown-positioner[data-popper-placement^=bottom] .dropdown-panel{transform-origin:top}.dropdown-positioner[data-popper-placement^=left] .dropdown-panel{transform-origin:right}.dropdown-positioner[data-popper-placement^=right] .dropdown-panel{transform-origin:left}.dropdown-positioner.popover-visible .dropdown-panel{opacity:1;transform:none;pointer-events:all}"}},[1,"gr-dropdown",{open:[1540],placement:[1],closeOnSelect:[4,"close-on-select"],containingElement:[1040],distance:[2],skidding:[2],hoist:[4],show:[64],hide:[64],focusOnTrigger:[64]}]);function Xr(){if("undefined"==typeof customElements)return;["gr-dropdown"].forEach((e=>{if("gr-dropdown"===e)customElements.get(e)||customElements.define(e,Gr)}))}Xr(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const Zr=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grSelect=fe(this,"gr-select",7),this.typeToSelectString=""}connectedCallback(){this.handleClick=this.handleClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}async typeToSelect(e){clearTimeout(this.typeToSelectTimeout),this.typeToSelectTimeout=setTimeout((()=>this.typeToSelectString=""),750),this.typeToSelectString+=e.toLowerCase();const t=this.getItems();for(const e of t){if(kt(e.shadowRoot.querySelector("slot:not([name])")).toLowerCase().trim().substring(0,this.typeToSelectString.length)===this.typeToSelectString){e.setFocus();break}}}getItems(){return[...this.menu.querySelector("slot").assignedElements({flatten:!0})].filter((e=>"gr-menu-item"===e.tagName.toLowerCase()&&!e.disabled))}getActiveItem(){return this.getItems().find((e=>e===document.activeElement))}setActiveItem(e){e.setFocus()}handleClick(e){const t=e.target.closest("gr-menu-item");t&&!t.disabled&&this.grSelect.emit({item:t})}handleKeyDown(e){if("Enter"===e.key){const t=this.getActiveItem();e.preventDefault(),t&&this.grSelect.emit({item:t})}if(" "===e.key&&e.preventDefault(),["ArrowDown","ArrowUp","Home","End"].includes(e.key)){const t=this.getItems(),r=this.getActiveItem();let i=t.indexOf(r);if(t.length)return e.preventDefault(),"ArrowDown"===e.key?i++:"ArrowUp"===e.key?i--:"Home"===e.key?i=0:"End"===e.key&&(i=t.length-1),i<0&&(i=0),i>t.length-1&&(i=t.length-1),void this.setActiveItem(t[i])}this.typeToSelect(e.key)}render(){return de("div",{ref:e=>this.menu=e,class:"menu",role:"menu",onClick:this.handleClick,onKeyDown:this.handleKeyDown},de("slot",null))}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{--padding-top:var(--gr-spacing-x-small);--padding-bottom:var(--gr-spacing-x-small);display:block;padding-top:var(--padding-top);padding-left:0;padding-right:0;padding-bottom:var(--padding-bottom);box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host:focus{outline:none}"}},[1,"gr-menu",{typeToSelect:[64]}]);function Jr(){if("undefined"==typeof customElements)return;["gr-menu"].forEach((e=>{if("gr-menu"===e)customElements.get(e)||customElements.define(e,Zr)}))}Jr(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const ei=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grClear=fe(this,"gr-clear",7),this.type="primary",this.size="medium",this.pill=!1,this.clearable=!1,this.truncate=!1,this.title=""}connectedCallback(){this.handleClearClick=this.handleClearClick.bind(this)}handleClearClick(){this.grClear.emit()}render(){return de(ge,{class:{[`tag-${this.type}`]:!0,[`tag-${this.size}`]:!0,"tag-pill":this.pill,"tag-clearable":this.clearable}},de("span",{class:"tag"},de("span",{class:{"tag-truncate":this.truncate},title:this.title},de("slot",null)),this.clearable&&de("gr-button",{variant:"plain",size:this.size,class:"tag-clear","aria-label":"clear",onClick:this.handleClearClick},de("svg",{slot:"icon-only",role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Close"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 368L144 144M368 144L144 368"})))))}static get style(){return":host{--height:calc(var(--gr-form-element-height-medium) * 0.8);--line-height:calc(var(--gr-form-element-height-medium) - 1px * 2);--border-radius:var(--gr-form-element-border-radius-medium);--border-width:1px;--border-style:solid;--padding-top:0;--padding-start:var(--gr-spacing-small);--padding-end:var(--gr-spacing-small);--padding-bottom:0;--font-size:var(--gr-form-element-font-size-medium);--background-color:rgba(var(--gr-color-primary-rgb), 0.05);--border-color:rgba(var(--gr-color-primary-rgb), 0.2);--color:var(--gr-color-primary-shade);--clear-color:var(--gr-color-primary);--clear-color-hover:var(--gr-color-primary-shade);--clear-margin-left:var(--gr-spacing-xx-small);--clear-margin-right:calc(-1 * var(--gr-spacing-xxx-small));display:inline-block;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host(.tag-success){--background-color:rgba(var(--gr-color-success-rgb), 0.05);--border-color:rgba(var(--gr-color-success-rgb), 0.2);--color:var(--gr-color-success-shade);--clear-color:var(--gr-color-success);--clear-color-hover:var(--gr-color-success-shade)}:host(.tag-info){--background-color:rgba(var(--gr-color-medium-rgb), 0.05);--border-color:rgba(var(--gr-color-medium-rgb), 0.2);--color:var(--gr-color-medium-shade);--clear-color:var(--gr-color-medium);--clear-color-hover:var(--gr-color-medium-shade)}:host(.tag-warning){--background-color:rgba(var(--gr-color-warning-rgb), 0.05);--border-color:rgba(var(--gr-color-warning-rgb), 0.2);--color:var(--gr-color-warning-shade);--clear-color:var(--gr-color-warning);--clear-color-hover:var(--gr-color-warning-shade)}:host(.tag-danger){--background-color:rgba(var(--gr-color-danger-rgb), 0.05);--border-color:rgba(var(--gr-color-danger-rgb), 0.2);--color:var(--gr-color-danger-shade);--clear-color:var(--gr-color-danger);--clear-color-hover:var(--gr-color-danger-shade)}:host(.tag-small){--font-size:var(--gr-form-element-font-size-small);--height:calc(var(--gr-form-element-height-small) * 0.8);--line-height:calc(var(--gr-form-element-height-small) - 1px * 2);--border-radius:var(--gr-form-element-border-radius-small);--padding-start:var(--gr-spacing-x-small);--padding-end:var(--gr-spacing-x-small);--clear-margin-left:var(--gr-spacing-xx-small);--clear-margin-right:calc(-1 * var(--gr-spacing-xxx-small))}:host(.tag-large){--font-size:var(--gr-form-element-font-size-large);--height:calc(var(--gr-form-element-height-large) * 0.8);--line-height:calc(var(--gr-form-element-height-large) - 1px * 2);--border-radius:var(--gr-form-element-border-radius-large);--padding:0 var(--gr-spacing-medium);--clear-margin-left:var(--gr-spacing-xx-small);--clear-margin-right:calc(-1 * var(--gr-spacing-x-small))}.tag{display:flex;align-items:center;border-style:var(--border-style);border-width:var(--border-width);border-radius:var(--border-radius);white-space:nowrap;user-select:none;cursor:default;font-family:var(--gr-font-family);font-size:var(--font-size);font-weight:var(--gr-font-weight-normal);height:var(--height);line-height:var(--line-height);padding-top:var(--padding-top);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-bottom:var(--padding-bottom);background-color:var(--background-color);border-color:var(--border-color);color:var(--color)}.tag-clear{--color:var(--clear-color);--color-hover:var(--clear-color-hover);--padding-start:0;--padding-end:0;margin-left:var(--clear-margin-left);margin-right:var(--clear-margin-right);--height:1em}.tag-clear svg{font-size:0.7em}.tag-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tag-clear svg{width:1.1em;height:1.1em}:host(.tag-pill) .tag{border-radius:var(--height)}"}},[1,"gr-tag",{type:[513],size:[513],pill:[516],clearable:[516],truncate:[516],title:[513]}]);function ti(){if("undefined"==typeof customElements)return;["gr-tag","gr-button","gr-spinner"].forEach((e=>{switch(e){case"gr-tag":customElements.get(e)||customElements.define(e,ei);break;case"gr-button":customElements.get(e)||St();break;case"gr-spinner":customElements.get(e)||Et()}}))}ti(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const ri="undefined"!=typeof HTMLElement?HTMLElement:class{};let ii=0;const oi=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grChange=fe(this,"gr-change",7),this.grFocus=fe(this,"gr-focus",7),this.grBlur=fe(this,"gr-blur",7),this.inputId="select-"+ ++ii,this.labelId=`select-label-${ii}`,this.helpTextId=`select-help-text-${ii}`,this.invalidTextId=`select-invalid-text-${ii}`,this.inheritedAttributes={},this.handleBlur=()=>{this.isOpen||(this.hasFocus=!1,this.grBlur.emit())},this.handleFocus=()=>{this.hasFocus||(this.hasFocus=!0,this.grFocus.emit())},this.hasFocus=!1,this.hasHelpTextSlot=!1,this.hasInvalidTextSlot=!1,this.hasLabelSlot=!1,this.isOpen=!1,this.items=[],this.displayLabel="",this.displayTags=[],this.multiple=!1,this.maxTagsVisible=3,this.disabled=!1,this.name="",this.placeholder="",this.size="medium",this.hoist=!1,this.value="",this.pill=!1,this.label="",this.requiredIndicator=!1,this.helpText="",this.invalidText="",this.invalid=!1,this.clearable=!1}handleDisabledChange(){this.disabled&&this.isOpen&&this.dropdown.hide()}handleLabelChange(){this.handleSlotChange()}handleMultipleChange(){const e=this.getValueAsArray();this.value=this.multiple?e:e[0]||"",this.syncItemsFromValue()}handleValueChange(){this.syncItemsFromValue(),this.grChange.emit()}connectedCallback(){this.handleClearClick=this.handleClearClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleLabelClick=this.handleLabelClick.bind(this),this.handleMenuHide=this.handleMenuHide.bind(this),this.handleMenuShow=this.handleMenuShow.bind(this),this.handleMenuSelect=this.handleMenuSelect.bind(this),this.handleSlotChange=this.handleSlotChange.bind(this),this.handleTagInteraction=this.handleTagInteraction.bind(this),this.el.shadowRoot.addEventListener("slotchange",this.handleSlotChange)}componentWillLoad(){this.handleSlotChange(),this.inheritedAttributes=Ct(this.el,["aria-label"])}componentDidLoad(){this.resizeObserver=new ResizeObserver((()=>this.resizeMenu())),this.reportDuplicateItemValues(),requestAnimationFrame((()=>this.syncItemsFromValue()))}disconnectedCallback(){this.el.shadowRoot.removeEventListener("slotchange",this.handleSlotChange)}async setFocus(){this.hasFocus=!0,this.grFocus.emit(),this.dropdown.focusOnTrigger()}getItemLabel(e){return kt(e.shadowRoot.querySelector("slot:not([name])"))}getItems(){return[...this.el.querySelectorAll("gr-menu-item")]}getValueAsArray(){return Array.isArray(this.value)?this.value:[this.value]}handleClearClick(e){e.stopPropagation(),this.value=this.multiple?[]:"",this.syncItemsFromValue()}handleKeyDown(e){const t=e.target,r=this.getItems(),i=r[0],o=r[r.length-1];if("gr-tag"!==t.tagName.toLowerCase())if("Tab"!==e.key){if(["ArrowDown","ArrowUp"].includes(e.key)){if(e.preventDefault(),this.isOpen||this.dropdown.show(),"ArrowDown"===e.key&&i)return void i.setFocus();if("ArrowUp"===e.key&&o)return void o.setFocus()}this.isOpen||1!==e.key.length||(e.stopPropagation(),e.preventDefault(),this.dropdown.show(),this.menu.typeToSelect(e.key))}else this.isOpen&&this.dropdown.hide()}handleLabelClick(){this.box.focus()}handleMenuSelect(e){const t=e.detail.item;this.multiple?this.value=this.value.includes(t.value)?this.value.filter((e=>e!==t.value)):[...this.value,t.value]:this.value=t.value,this.syncItemsFromValue()}handleMenuShow(e){this.disabled?e.preventDefault():(this.resizeMenu(),this.resizeObserver.observe(this.el),this.isOpen=!0)}handleMenuHide(){this.resizeObserver.unobserve(this.el),this.isOpen=!1,this.box.focus()}handleSlotChange(){this.hasHelpTextSlot=_t(this.el,"help-text"),this.hasInvalidTextSlot=_t(this.el,"invalid-text"),this.hasLabelSlot=_t(this.el,"label"),this.syncItemsFromValue(),this.reportDuplicateItemValues()}handleTagInteraction(e){e.composedPath().find((e=>{if(e instanceof ri)return e.classList.contains("tag-clear")}))&&e.stopPropagation()}reportDuplicateItemValues(){const e=this.getItems().map((e=>e.value)).filter(((e,t,r)=>r.indexOf(e)!==t));if(e.length)throw new Error('Duplicate value found on in : "'+e.join('", "')+'"')}resizeMenu(){this.menu.style.width=`${this.box.clientWidth}px`}syncItemsFromValue(){const e=this.getItems(),t=this.getValueAsArray();if(e.map((e=>e.checked=t.includes(e.value))),this.multiple){const r=[];if(t.map((t=>e.map((e=>e.value===t?r.push(e):null)))),this.displayTags=r.map((e=>de("gr-tag",{type:"info",size:this.size,pill:this.pill,clearable:!0,onClick:this.handleTagInteraction,onKeyDown:this.handleTagInteraction,"onGr-clear":t=>{t.stopPropagation(),this.disabled||(e.checked=!1,this.syncValueFromItems())}},this.getItemLabel(e)))),this.maxTagsVisible>0&&this.displayTags.length>this.maxTagsVisible){const e=this.displayTags.length;this.displayLabel="",this.displayTags=this.displayTags.slice(0,this.maxTagsVisible),this.displayTags.push(de("gr-tag",{type:"info",size:this.size,pill:this.pill},"+",e-this.maxTagsVisible))}}else{const r=e.filter((e=>e.value===t[0]))[0];this.displayLabel=r?this.getItemLabel(r):"",this.displayTags=[]}}syncValueFromItems(){const e=this.getItems().filter((e=>e.checked)).map((e=>e.value));this.multiple?this.value=this.value.filter((t=>e.includes(t))):this.value=e.length>0?e[0]:""}render(){var e;const t=this.multiple?this.value.length>0:""!==this.value,r=this.inheritedAttributes["aria-label"]?{"aria-label":this.inheritedAttributes["aria-label"]}:{"aria-labelledby":this.labelId};return((e,t,r,i)=>{let o=e.querySelector("input.aux-input");o||(o=e.ownerDocument.createElement("input"),o.type="hidden",o.classList.add("aux-input"),e.appendChild(o)),o.disabled=i,o.name=t,o.value=r||""})(this.el,this.name,ni(this.value),this.disabled),de(xt,{inputId:this.inputId,label:this.label,labelId:this.labelId,hasLabelSlot:this.hasLabelSlot,helpTextId:this.helpTextId,helpText:this.helpText,hasHelpTextSlot:this.hasHelpTextSlot,invalidTextId:this.invalidTextId,invalidText:this.invalidText,invalid:this.invalid,hasInvalidTextSlot:this.hasInvalidTextSlot,size:this.size,onLabelClick:this.handleLabelClick,requiredIndicator:this.requiredIndicator},de("gr-dropdown",{ref:e=>this.dropdown=e,hoist:this.hoist,closeOnSelect:!this.multiple,containingElement:this.el,class:{select:!0,"select-open":this.isOpen,"select-empty":0===(null===(e=this.value)||void 0===e?void 0:e.length),"select-focused":this.hasFocus,"select-clearable":this.clearable,"select-disabled":this.disabled,"select-multiple":this.multiple,"select-has-tags":this.multiple&&t,"select-placeholder-visible":""===this.displayLabel,[`select-${this.size}`]:!0,"select-pill":this.pill,"select-invalid":this.invalid},"onGr-show":this.handleMenuShow,"onGr-hide":this.handleMenuHide},de("div",Object.assign({slot:"trigger",ref:e=>this.box=e,id:this.inputId,class:"select-box",role:"combobox"},r,{"aria-describedby":this.invalid?this.invalidTextId:this.helpTextId,"aria-haspopup":"true","aria-expanded":this.isOpen?"true":"false","aria-invalid":this.invalid?"true":"false","aria-required":this.requiredIndicator?"true":"false",tabIndex:this.disabled?-1:0,onBlur:this.handleBlur,onFocus:this.handleFocus,onKeyDown:this.handleKeyDown}),de("div",{class:"select-label"},this.displayTags.length?de("span",{class:"select-tags"},this.displayTags):this.displayLabel||this.placeholder),this.clearable&&t&&de("button",{class:"select-clear",type:"button",onClick:this.handleClearClick,"aria-label":"clear",tabindex:"-1"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Close Circle"),de("path",{d:"M448 256c0-106-86-192-192-192S64 150 64 256s86 192 192 192 192-86 192-192z",fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32"}),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M320 320L192 192M192 320l128-128"}))),de("span",{class:"caret"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Chevron Down"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"M112 184l144 144 144-144"}))),de("input",{class:"select-hidden-select","aria-hidden":"true",value:t?"1":"",tabIndex:-1})),de("gr-menu",{ref:e=>this.menu=e,class:"select-menu","onGr-select":this.handleMenuSelect},de("slot",{onSlotchange:this.handleSlotChange}))))}get el(){return this}static get watchers(){return{disabled:["handleDisabledChange"],helpText:["handleLabelChange"],invalidText:["handleLabelChange"],label:["handleLabelChange"],multiple:["handleMultipleChange"],value:["handleValueChange"]}}static get style(){return".form-control .form-control-label{display:none}.form-control .form-control-help-text{display:none}.form-control .form-control-invalid-text{display:none}.form-control-has-label .form-control-label{display:flex;line-height:var(--gr-line-height-normal);color:var(--gr-form-element-label-color);margin-bottom:var(--gr-spacing-xxx-small)}.form-control-has-label.form-control-small .form-control-label{font-size:var(--gr-form-element-label-font-size-small)}.form-control-has-label.form-control-medium .form-control-label{font-size:var(--gr-form-element-label-font-size-medium)}.form-control-has-label.form-control-large .form-control-label{font-size:var(--gr-form-element-label-font-size-large)}.form-control-has-label .form-control-label .asterisk{margin-left:var(--gr-spacing-x-small);color:var(--gr-color-medium)}.form-control-has-label .form-control-label .asterisk svg{width:0.6em;height:0.6em;margin-bottom:var(--gr-spacing-xxx-small)}.form-control-has-help-text .form-control-help-text{display:block;line-height:var(--gr-line-height-normal);color:var(--gr-form-element-help-text-color);margin-top:var(--gr-spacing-xxx-small)}.form-control-has-help-text.form-control-small .form-control-help-text{font-size:var(--gr-form-element-help-text-font-size-small);min-height:1.625rem}.form-control-has-help-text.form-control-medium .form-control-help-text{font-size:var(--gr-form-element-help-text-font-size-medium);min-height:1.875rem}.form-control-has-help-text.form-control-large .form-control-help-text{font-size:var(--gr-form-element-help-text-font-size-large);min-height:2.125rem}.form-control-has-invalid-text .form-control-invalid-text{display:flex;margin-left:-2px;line-height:var(--gr-line-height-normal);color:var(--gr-form-element-invalid-text-color);margin-top:var(--gr-spacing-xxx-small)}.form-control-has-invalid-text .form-control-invalid-text .icon{margin-top:var(--gr-spacing-xxx-small);margin-right:var(--gr-spacing-xx-small)}.form-control-has-invalid-text .form-control-invalid-text .icon svg{width:1.4em;height:1.4em}.form-control-has-invalid-text.form-control-small .form-control-invalid-text{font-size:var(--gr-form-element-invalid-text-font-size-small);min-height:1.625rem}.form-control-has-invalid-text.form-control-medium .form-control-invalid-text{font-size:var(--gr-form-element-invalid-text-font-size-medium);min-height:1.875rem}.form-control-has-invalid-text.form-control-large .form-control-invalid-text{font-size:var(--gr-form-element-invalid-text-font-size-large);min-height:2.125rem}.gr-scroll-lock{overflow:hidden !important}:host{--font-size:var(--gr-form-element-font-size-medium);--font-weight:var(--gr-font-weight-normal);--background-color:var(--gr-color-white);--background-color-hover:var(--gr-color-white);--background-color-focus:var(--gr-color-white);--background-color-invalid:var(--gr-color-white);--background-color-invalid-hover:var(--gr-color-white);--border-radius:var(--gr-form-element-border-radius-small);--border-color:var(--gr-color-light-shade);--border-color-hover:var(--gr-color-medium);--border-color-focus:var(--gr-color-primary);--border-color-invalid:var(--gr-color-danger);--border-color-invalid-hover:var(--gr-color-danger-shade);--color:var(--gr-color-dark-tint);--placeholder-color:var(--gr-color-medium-tint);--min-height:var(--gr-form-element-height-medium);--label-margin-start:var(--gr-spacing-medium);--label-margin-end:var(--gr-spacing-medium);--clear-icon-margin-end:var(--gr-spacing-medium);--caret-margin-end:var(--gr-spacing-medium);--tags-padding-top:3px;--tags-padding-bottom:3px;--tags-margin-end:var(--gr-spacing-xx-small);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33);display:block;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.select-small{--font-size:var(--gr-form-element-font-size-small);--min-height:var(--gr-form-element-height-small);--label-margin-start:var(--gr-spacing-small);--label-margin-end:var(--gr-spacing-small);--clear-icon-margin-end:var(--gr-spacing-small);--caret-margin-end:var(--gr-spacing-small);--tags-padding-top:2px;--tags-padding-bottom:2px}.select-large{--font-size:var(--gr-form-element-font-size-large);--min-height:var(--gr-form-element-height-large);--label-margin-start:var(--gr-spacing-large);--label-margin-end:var(--gr-spacing-large);--clear-icon-margin-end:var(--gr-spacing-large);--caret-margin-end:var(--gr-spacing-large);--tags-padding-top:4px;--tags-padding-bottom:4px}.select{display:block}.select-box{display:inline-flex;align-items:center;justify-content:start;position:relative;width:100%;font-family:var(--gr-font-family);font-size:var(--font-size);font-weight:var(--font-weight);letter-spacing:normal;background-color:var(--background-color);border:solid 1px var(--border-color);border-radius:var(--border-radius);min-height:var(--min-height);color:var(--color);vertical-align:middle;overflow:hidden;transition:150ms color, 150ms border, 150ms box-shadow;cursor:pointer}.select.select-invalid:not(.select-disabled) .select-box{background-color:var(--background-color-invalid);border-color:var(--border-color-invalid)}.select.select-invalid:not(.select-disabled):not(.select-focused) .select-box:hover{background-color:var(--background-color-invalid-hover);border-color:var(--border-color-invalid-hover)}.select.select-invalid:not(.select-disabled) .select-box{background-color:var(--background-color-invalid);border-color:var(--border-color-invalid)}.select:not(.select-disabled) .select-box:hover{background-color:var(--background-color-hover);border-color:var(--border-color-hover)}.select.select-focused:not(.select-disabled) .select-box{outline:none;box-shadow:var(--focus-ring);border-color:var(--border-color-focus);background-color:var(--background-color-focus)}.select-disabled .select-box{opacity:0.5;cursor:not-allowed;outline:none}.select-disabled .select-tags,.select-disabled .select-clear{pointer-events:none}.select-label{flex:1 1 auto;display:flex;align-items:center;user-select:none;margin-top:0;margin-left:var(--label-margin-start);margin-right:var(--label-margin-end);margin-bottom:0;scrollbar-width:none;-ms-overflow-style:none;overflow-x:auto;overflow-y:hidden;white-space:nowrap}.select-label::-webkit-scrollbar{width:0;height:0}.select-has-tags .select-label{margin-left:0}.select-clear{display:inline-flex;align-items:center;font-size:inherit;color:var(--gr-color-medium);border:none;background:none;padding:0;transition:150ms color;cursor:pointer;margin-right:var(--clear-icon-margin-end)}.select-clear:hover{color:var(--gr-color-dark)}.select-clear:focus{outline:none}.select-clear svg{width:1.2em;height:1.2em;font-size:var(--font-size)}.caret{flex:0 0 auto;display:inline-flex;transition:250ms transform ease;margin-right:var(--caret-margin-end)}.caret svg{width:1em;height:1em;font-size:var(--font-size)}.select-open .caret{transform:rotate(-180deg)}.select-placeholder-visible .select-label{color:var(--placeholder-color)}.select-tags{display:inline-flex;align-items:center;flex-wrap:wrap;justify-content:left;margin-left:var(--gr-spacing-xx-small);padding-bottom:var(--tags-padding-bottom)}.select-tags gr-tag{padding-top:var(--tags-padding-top)}.select-tags gr-tag:not(:last-of-type){margin-right:var(--tags-margin-end)}.select-hidden-select{clip:rect(0 0 0 0);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px;position:absolute;top:0;left:0;width:100%;height:100%}.select-pill .select-box{border-radius:var(--min-height)}"}},[1,"gr-select",{multiple:[4],maxTagsVisible:[2,"max-tags-visible"],disabled:[4],name:[1],placeholder:[1],size:[1],hoist:[4],value:[1025],pill:[4],label:[1],requiredIndicator:[4,"required-indicator"],helpText:[1,"help-text"],invalidText:[1,"invalid-text"],invalid:[516],clearable:[4],hasFocus:[32],hasHelpTextSlot:[32],hasInvalidTextSlot:[32],hasLabelSlot:[32],isOpen:[32],items:[32],displayLabel:[32],displayTags:[32],setFocus:[64]}]),ni=e=>{if(null!=e)return Array.isArray(e)?e.join(","):e.toString()};!function(){if("undefined"==typeof customElements)return;["gr-select","gr-button","gr-dropdown","gr-menu","gr-spinner","gr-tag"].forEach((e=>{switch(e){case"gr-select":customElements.get(e)||customElements.define(e,oi);break;case"gr-button":customElements.get(e)||St();break;case"gr-dropdown":customElements.get(e)||Xr();break;case"gr-menu":customElements.get(e)||Jr();break;case"gr-spinner":customElements.get(e)||Et();break;case"gr-tag":customElements.get(e)||ti()}}))}();const ai=oi,si=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.hasFocus=!1,this.checked=!1,this.value="",this.disabled=!1}connectedCallback(){this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleMouseEnter=this.handleMouseEnter.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this)}async setFocus(e){this.el.focus(e)}async removeFocus(){this.el.blur()}handleBlur(){this.hasFocus=!1}handleFocus(){this.hasFocus=!0}handleMouseEnter(){this.setFocus()}handleMouseLeave(){this.removeFocus()}render(){return de(ge,{class:{"menu-item-checked":this.checked,"menu-item-disabled":this.disabled,"menu-item-focused":this.hasFocus},role:"menuitem","aria-disabled":this.disabled?"true":"false","aria-checked":this.checked?"true":"false",tabIndex:this.disabled?null:0,onFocus:this.handleFocus,onBlur:this.handleBlur,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave},de("span",{class:"checkmark"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Checkmark"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M416 128L192 384l-96-96"}))),de("span",{class:"start"},de("slot",{name:"start"})),de("span",{class:"label"},de("slot",null)),de("span",{class:"end"},de("slot",{name:"end"})))}get el(){return this}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{--line-height:var(--gr-line-height-normal);--background-color:transparent;--background-color-focused:var(--gr-color-primary);--color:var(--gr-color-dark);--color-focused:var(--gr-color-primary-contrast);--color-disabled:var(--gr-color-medium);--padding-top:var(--gr-spacing-xx-small);--padding-start:var(--gr-spacing-x-large);--padding-end:var(--gr-spacing-x-large);--padding-bottom:var(--gr-spacing-xx-small);--transition:background-color 150ms linear, color 150ms linear;position:relative;display:flex;align-items:stretch;font-family:var(--gr-font-family);font-size:var(--gr-font-size-medium);font-weight:var(--gr-font-weight-normal);line-height:var(--line-height);letter-spacing:var(--gr-letter-spacing-normal);text-align:left;background-color:var(--background-color);color:var(--color);padding-top:var(--padding-top);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-bottom:var(--padding-bottom);transition:var(--transition);user-select:none;white-space:nowrap;cursor:pointer;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host(.menu-item-focused:not(.menu-item-disabled)){outline:none;background-color:var(--background-color-focused);color:var(--color-focused)}:host(.menu-item-disabled){outline:none;color:var(--color-disabled);cursor:not-allowed}.checkmark{display:flex;position:absolute;left:0.5em;top:calc(50% - 0.5em);visibility:hidden;align-items:center;font-size:inherit}.checkmark svg{display:inline-block;width:1.1em;height:1.1em;contain:strict;fill:currentcolor;box-sizing:content-box !important}:host(.menu-item-checked) .checkmark{visibility:visible}.label{flex:1 1 auto}.start{flex:0 0 auto;display:flex;align-items:center}.start ::slotted(:last-child){margin-right:0.5em}.end{flex:0 0 auto;display:flex;align-items:center}.end ::slotted(:first-child){margin-left:0.5em}"}},[1,"gr-menu-item",{checked:[516],value:[513],disabled:[516],hasFocus:[32],setFocus:[64],removeFocus:[64]}]); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */!function(){if("undefined"==typeof customElements)return;["gr-menu-item"].forEach((e=>{if("gr-menu-item"===e)customElements.get(e)||customElements.define(e,si)}))}();const li={"gr-select":ai,"gr-menu-item":si};class ci extends(P(_)){constructor(){super(...arguments),this.value=null,this.multiple=!1,this.clearable=!1,this._refSelect=y()}reset(){this.value=null}_valueChangedHandler(e){const t=this._refSelect.value?.value;if(void 0!==t&&!l(this.value,t)){const e=null===this.value;this.value=t,e||w(this,"select:change",t)}}willUpdate(e){e.has("initialValue")&&this.initialValue&&!this.value&&(this.value=this.initialValue)}render(){return $` + ${this.options?.map((e=>$`${e.label}`))} + `}static get styles(){return k(':root, :host {\n --gr-color-primary: #1079b2;\n --gr-color-primary-rgb: 16, 121, 178;\n --gr-color-primary-contrast: #ffffff;\n --gr-color-primary-contrast-rgb: 255, 255, 255;\n --gr-color-primary-shade: #0d6696;\n --gr-color-primary-tint: #1499e1;\n --gr-color-secondary: #051f2c;\n --gr-color-secondary-rgb: 5, 31, 44;\n --gr-color-secondary-contrast: #ffffff;\n --gr-color-secondary-contrast-rgb: 255, 255, 255;\n --gr-color-secondary-shade: #000000;\n --gr-color-secondary-tint: #0a415c;\n --gr-color-tertiary: #0c4a6e;\n --gr-color-tertiary-rgb: 12, 74, 110;\n --gr-color-tertiary-contrast: #ffffff;\n --gr-color-tertiary-contrast-rgb: 255, 255, 255;\n --gr-color-tertiary-shade: #083249;\n --gr-color-tertiary-tint: #106393;\n --gr-color-success: #0fbe78;\n --gr-color-success-rgb: 15, 190, 120;\n --gr-color-success-contrast: #000000;\n --gr-color-success-contrast-rgb: 0, 0, 0;\n --gr-color-success-shade: #057f4e;\n --gr-color-success-tint: #12e28f;\n --gr-color-warning: #fbbc4e;\n --gr-color-warning-rgb: 251, 188, 78;\n --gr-color-warning-contrast: #051f2c;\n --gr-color-warning-contrast-rgb: 5, 31, 44;\n --gr-color-warning-shade: #9e6400;\n --gr-color-warning-tint: #fdd187;\n --gr-color-danger: #e60017;\n --gr-color-danger-rgb: 230, 0, 23;\n --gr-color-danger-contrast: #ffffff;\n --gr-color-danger-contrast-rgb: 255, 255, 255;\n --gr-color-danger-shade: #cc0014;\n --gr-color-danger-tint: #ff1f35;\n --gr-color-light: #f4f5f8;\n --gr-color-light-rgb: 244, 245, 248;\n --gr-color-light-contrast: #051f2c;\n --gr-color-light-contrast-rgb: 5, 31, 44;\n --gr-color-light-shade: #d7d8da;\n --gr-color-light-tint: #f9fafb;\n --gr-color-medium: #5e6c78;\n --gr-color-medium-rgb: 94, 108, 120;\n --gr-color-medium-contrast: #ffffff;\n --gr-color-medium-contrast-rgb: 255, 255, 255;\n --gr-color-medium-shade: #48535b;\n --gr-color-medium-tint: #81909c;\n --gr-color-dark: #02131b;\n --gr-color-dark-rgb: 2, 19, 27;\n --gr-color-dark-contrast: #ffffff;\n --gr-color-dark-contrast-rgb: 255, 255, 255;\n --gr-color-dark-shade: #000000;\n --gr-color-dark-tint: #222428;\n --gr-color-white: #ffffff;\n --gr-color-black: #000000;\n --gr-border-radius-small: 0.125rem;\n --gr-border-radius-medium: 0.25rem;\n --gr-border-radius-large: 0.5rem;\n --gr-border-radius-x-large: 1rem;\n --gr-border-width-small: 0.063rem;\n --gr-border-width-medium: 0.125rem;\n --gr-border-width-large: 0.188rem;\n --gr-shadow-x-small: 0 1px 0 #0d131e0d;\n --gr-shadow-small: 0 1px 2px #0d131e1a;\n --gr-shadow-medium: 0 2px 4px #0d131e1a;\n --gr-shadow-large: 0 2px 8px #0d131e1a;\n --gr-shadow-x-large: 0 4px 16px #0d131e1a;\n --gr-spacing-xxx-small: 0.125rem;\n --gr-spacing-xx-small: 0.25rem;\n --gr-spacing-x-small: 0.5rem;\n --gr-spacing-small: 0.75rem;\n --gr-spacing-medium: 1rem;\n --gr-spacing-large: 1.25rem;\n --gr-spacing-x-large: 1.75rem;\n --gr-spacing-xx-large: 2.25rem;\n --gr-spacing-xxx-large: 3rem;\n --gr-spacing-xxxx-large: 4.5rem;\n --gr-font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,\n sans-serif;\n --gr-letter-spacing-dense: -0.015em;\n --gr-letter-spacing-normal: normal;\n --gr-letter-spacing-loose: 0.075em;\n --gr-line-height-dense: 1.4;\n --gr-line-height-normal: 1.8;\n --gr-line-height-loose: 2.2;\n --gr-font-size-xx-small: 0.625rem;\n --gr-font-size-x-small: 0.75rem;\n --gr-font-size-small: 0.875rem;\n --gr-font-size-medium: 1rem;\n --gr-font-size-large: 1.25rem;\n --gr-font-size-x-large: 1.5rem;\n --gr-font-size-xx-large: 2.25rem;\n --gr-font-size-xxx-large: 3rem;\n --gr-font-size-xxxx-large: 4.5rem;\n --gr-font-weight-thin: 100;\n --gr-font-weight-extra-light: 200;\n --gr-font-weight-light: 300;\n --gr-font-weight-normal: 400;\n --gr-font-weight-medium: 500;\n --gr-font-weight-semi-bold: 600;\n --gr-font-weight-bold: 700;\n --gr-font-weight-extra-bold: 800;\n --gr-font-weight-black: 900;\n --gr-form-element-font-size-x-small: var(--gr-font-size-x-small);\n --gr-form-element-font-size-small: var(--gr-font-size-small);\n --gr-form-element-font-size-medium: var(--gr-font-size-medium);\n --gr-form-element-font-size-large: var(--gr-font-size-large);\n --gr-form-element-height-small: 2.188rem;\n --gr-form-element-height-medium: 3.125rem;\n --gr-form-element-height-large: 4.063rem;\n --gr-form-element-border-radius-small: var(--gr-border-radius-medium);\n --gr-form-element-border-radius-medium: var(--gr-border-radius-medium);\n --gr-form-element-border-radius-large: var(--gr-border-radius-medium);\n --gr-focus-ring-width: 2px;\n --gr-form-element-label-font-size-small: var(--gr-font-size-small);\n --gr-form-element-label-font-size-medium: var(--gr-font-size-medium);\n --gr-form-element-label-font-size-large: var(--gr-font-size-large);\n --gr-form-element-label-color: inherit;\n --gr-form-element-help-text-font-size-small: var(--gr-font-size-x-small);\n --gr-form-element-help-text-font-size-medium: var(--gr-font-size-small);\n --gr-form-element-help-text-font-size-large: var(--gr-font-size-medium);\n --gr-form-element-help-text-color: var(--gr-color-medium);\n --gr-form-element-invalid-text-font-size-small: var(--gr-font-size-x-small);\n --gr-form-element-invalid-text-font-size-medium: var(--gr-font-size-small);\n --gr-form-element-invalid-text-font-size-large: var(--gr-font-size-medium);\n --gr-form-element-invalid-text-color: var(--gr-color-danger);\n --gr-toggle-size: 1rem;\n --gr-panel-border-color: var(--gr-color-light-shade);\n --gr-z-index-dropdown: 900;\n}\n\n')}}ci.elementDefinitions={...li},f([v({attribute:!1,hasChanged:b})],ci.prototype,"options",void 0),f([v({attribute:!1,hasChanged:b})],ci.prototype,"value",void 0),f([v({attribute:!1,hasChanged:b})],ci.prototype,"initialValue",void 0),f([v({attribute:!0})],ci.prototype,"label",void 0),f([v({attribute:!0})],ci.prototype,"placeholder",void 0),f([v({attribute:!0,type:Boolean})],ci.prototype,"multiple",void 0),f([v({attribute:!0,type:Boolean})],ci.prototype,"clearable",void 0);let di=class extends(P(_)){constructor(){super(...arguments),this._mediaFilterController=new U(this),this._refMediaType=y(),this._refCamera=y(),this._refWhen=y(),this._refWhenFrom=y(),this._refWhenTo=y(),this._refWhat=y(),this._refWhere=y(),this._refFavorite=y(),this._refTags=y()}willUpdate(e){e.has("viewManagerEpoch")&&this._mediaFilterController.setViewManager(this.viewManagerEpoch?.manager??null),e.has("cameraManager")&&this.cameraManager&&(this._mediaFilterController.computeCameraOptions(this.cameraManager),this._mediaFilterController.computeMetadataOptions(this.cameraManager)),!e.get("viewManager")&&this.viewManagerEpoch&&this.cameraManager&&this._mediaFilterController.computeInitialDefaultsFromView(this.cameraManager)}render(){const e=async()=>{this.cameraManager&&this.viewManagerEpoch&&this.cardWideConfig&&await this._mediaFilterController.valueChangeHandler(this.cameraManager,this.cardWideConfig,{camera:this._refCamera.value?.value??void 0,mediaType:this._refMediaType.value?.value??void 0,when:{selected:this._refWhen.value?.value??void 0,from:this._refWhenFrom.value?.value,to:this._refWhenTo.value?.value},favorite:this._refFavorite.value?.value??void 0,where:this._refWhere.value?.value??void 0,what:this._refWhat.value?.value??void 0,tags:this._refTags.value?.value??void 0})},t=async t=>{"custom"===t&&this._refWhen.value?this._refWhenFrom.value?.value||this._refWhenTo.value?.value?this._refWhen.value.value=B.Custom:this._refWhen.value.reset():this._refWhen.value?.value!==B.Custom&&(this._refWhenFrom.value?.reset(),this._refWhenTo.value?.reset()),await e()};if(!this.cameraManager||!this.viewManagerEpoch)return;const r=this._mediaFilterController.getControlsToShow(this.cameraManager),o=this._mediaFilterController.getDefaults(),n=this._mediaFilterController.getWhatOptions(),a=this._mediaFilterController.getTagsOptions(),s=this._mediaFilterController.getWhereOptions();return $` e()} + > + +
+ t("selected")} + > + + t("custom")} + > + + t("custom")} + > + +
+ e()} + > + + ${r.events&&n.length?$` e()} + > + `:""} + ${r.events&&a.length?$` e()} + > + `:""} + ${r.events&&s.length?$` e()} + > + `:""} + ${r.favorites?$` + e()} + > + + `:""}`}static get styles(){return k(":host {\n display: flex;\n flex-direction: column;\n overflow: auto;\n scrollbar-width: none;\n -ms-overflow-style: none;\n height: 100%;\n width: 300px;\n margin: 5px;\n}\n\n/* Hide scrollbar for Chrome, Safari and Opera */\n:host::-webkit-scrollbar {\n display: none;\n}\n\nfrigate-card-select {\n padding: 5px;\n}\n\ndiv.when {\n display: inline-flex;\n align-items: flex-end;\n}\n\ndiv.when frigate-card-select {\n flex: 1;\n}\n\ndiv.when frigate-card-date-picker {\n padding-bottom: 5px;\n transition: width 0.5s ease-in-out;\n}\n\ndiv.when frigate-card-date-picker {\n color: var(--secondary-color);\n}\n\ndiv.when frigate-card-date-picker.selected {\n color: var(--primary-color);\n}\n\ndiv.when frigate-card-date-picker.hidden {\n width: 0px;\n}")}};di.elementDefinitions={"frigate-card-select":ci,"frigate-card-date-picker":R},f([v({attribute:!1})],di.prototype,"hass",void 0),f([v({attribute:!1})],di.prototype,"cameraManager",void 0),f([v({attribute:!1})],di.prototype,"viewManagerEpoch",void 0),f([v({attribute:!1})],di.prototype,"cardWideConfig",void 0),di=f([C("frigate-card-media-filter")],di);const hi={closed:"mdi:filter-cog-outline",open:"mdi:filter-cog"};let gi=class extends _{render(){const e=this.viewManagerEpoch?.manager.getView();if(this.hass&&e?.isGalleryView()&&this.cameraManager&&this.cardWideConfig)return $` + + ${this.galleryConfig&&"none"!==this.galleryConfig.controls.filter.mode?$` + `:""} + + + + `}static get styles(){return k(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\nfrigate-card-surround-basic {\n max-height: 110dvh;\n}")}};f([v({attribute:!1})],gi.prototype,"hass",void 0),f([v({attribute:!1})],gi.prototype,"viewManagerEpoch",void 0),f([v({attribute:!1})],gi.prototype,"galleryConfig",void 0),f([v({attribute:!1})],gi.prototype,"cameraManager",void 0),f([v({attribute:!1})],gi.prototype,"cardWideConfig",void 0),gi=f([C("frigate-card-gallery")],gi);let ui=class extends _{constructor(){super(),this._refLoaderBottom=y(),this._refSelected=y(),this._showLoaderBottom=!0,this._showLoaderTop=!1,this._boundWheelHandler=this._wheelHandler.bind(this),this._boundTouchStartHandler=this._touchStartHandler.bind(this),this._boundTouchEndHandler=this._touchEndHandler.bind(this),this._throttleExtendGalleryLater=O(this._extendGallery.bind(this),500,{leading:!0,trailing:!1}),this._touchScrollYPosition=null,this._resizeObserver=new ResizeObserver(this._resizeHandler.bind(this)),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}_touchStartHandler(e){1===e.touches.length?this._touchScrollYPosition=e.touches[0].screenY:this._touchScrollYPosition=null}async _touchEndHandler(e){!this.scrollTop&&1===e.changedTouches.length&&this._touchScrollYPosition&&e.changedTouches[0].screenY>this._touchScrollYPosition&&await this._extendLater(),this._touchScrollYPosition=null}async _wheelHandler(e){!this.scrollTop&&e.deltaY<0&&await this._extendLater()}async _extendLater(){const e=new Date;this._showLoaderTop=!0,await this._throttleExtendGalleryLater("later",!1);const t=(new Date).getTime()-e.getTime();t<500&&await S(.5-t/1e3),this._showLoaderTop=!1}connectedCallback(){super.connectedCallback(),this._resizeObserver.observe(this),this.addEventListener("wheel",this._boundWheelHandler,{passive:!0}),this.addEventListener("touchstart",this._boundTouchStartHandler,{passive:!0}),this.addEventListener("touchend",this._boundTouchEndHandler),this.requestUpdate()}disconnectedCallback(){this.removeEventListener("wheel",this._boundWheelHandler),this.removeEventListener("touchstart",this._boundTouchStartHandler),this.removeEventListener("touchend",this._boundTouchEndHandler),this._resizeObserver.disconnect(),this._intersectionObserver.disconnect(),super.disconnectedCallback()}_setColumnCount(){const e=this.galleryConfig?.controls.thumbnails.size??M.media_gallery.controls.thumbnails.size,t=this.galleryConfig?.controls.thumbnails.show_details?Math.max(1,Math.floor(this.clientWidth/z)):Math.max(1,Math.ceil(this.clientWidth/e));this.style.setProperty("--frigate-card-gallery-columns",String(t))}_resizeHandler(){this._setColumnCount()}async _intersectionHandler(e){e.every((e=>!e.isIntersecting))||(this._showLoaderBottom=!1,await this._extendGallery("earlier"))}async _extendGallery(e,t=!0){const r=this.viewManagerEpoch?.manager.getView();if(!this.cameraManager||!this.hass||!r)return;const i=r.query,n=i?.getQueries()??null,s=r.queryResults?.getResults();if(!i||!n||!s)return;let l;try{l=await this.cameraManager.extendMediaQueries(n,s,e,{useCache:t})}catch(e){return void d(e)}if(l){const e=c.areEventQueries(i)?new o(l.queries):c.areRecordingQueries(i)?new a(l.queries):null;e&&this.viewManagerEpoch?.manager.setViewByParameters({baseView:r,params:{query:e,queryResults:new L({results:l.results}).selectResultIfFound((e=>e===r.queryResults?.getSelectedResult()))}})}}willUpdate(e){if(e.has("galleryConfig")&&(this.galleryConfig?.controls.thumbnails.show_details?this.setAttribute("details",""):this.removeAttribute("details"),this._setColumnCount(),this.galleryConfig?.controls.thumbnails.size&&this.style.setProperty("--frigate-card-thumbnail-size",`${this.galleryConfig.controls.thumbnails.size}px`)),e.has("viewManagerEpoch")){this._showLoaderBottom=!0;const e=this.viewManagerEpoch?.manager.getView(),t=this.viewManagerEpoch?.oldView;this._media&&t?.queryResults?.getResults()===e?.queryResults?.getResults()||(this._media=[...e?.queryResults?.getResults()??[]].reverse())}}render(){if(!this._media||!this.hass)return $``;const e=this.viewManagerEpoch?.manager.getView();if(!e?.queryResults||0===e.queryResults.getResultsCount()){const t=!!e?.context?.loading?.query;return D({type:"info",message:i(t?"error.awaiting_media":"common.no_media"),icon:"mdi:multimedia",dotdotdot:t})}const t=e.queryResults.getSelectedResult();return $`
+ ${this._showLoaderTop?$`${A({cardWideConfig:this.cardWideConfig,classes:{top:!0},size:"small"})}`:""} + ${this._media.map(((r,i)=>$`{this._media&&this.viewManagerEpoch?.manager.setViewByParameters({params:{view:"media",queryResults:e.queryResults?.clone().selectIndex(this._media.length-i-1)}}),F(t)}} + > + `))} + ${this._showLoaderBottom?$`${A({cardWideConfig:this.cardWideConfig,componentRef:this._refLoaderBottom})}`:""} +
`}updated(e){this._refLoaderBottom.value&&(this._intersectionObserver.disconnect(),this._intersectionObserver.observe(this._refLoaderBottom.value)),this.updateComplete.then((()=>{e.has("viewManagerEpoch")&&!e.get("viewManagerEpoch")&&this._refSelected.value&&this._refSelected.value.scrollIntoView({block:"center"})}))}static get styles(){return k(":host {\n width: 100%;\n height: 100%;\n display: block;\n overflow: auto;\n -ms-overflow-style: none;\n scrollbar-width: none;\n --frigate-card-gallery-gap: 3px;\n --frigate-card-gallery-columns: 4;\n}\n\n.grid {\n display: grid;\n grid-template-columns: repeat(var(--frigate-card-gallery-columns), minmax(0, 1fr));\n grid-auto-rows: min-content;\n gap: var(--frigate-card-gallery-gap);\n}\n\n:host::-webkit-scrollbar {\n display: none;\n}\n\nfrigate-card-thumbnail {\n height: 100%;\n max-height: var(--frigate-card-thumbnail-size);\n}\n\nfrigate-card-thumbnail:not([details]) {\n width: 100%;\n}\n\nfrigate-card-thumbnail.selected {\n border: 4px solid var(--accent-color);\n border-radius: calc(var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px)) + 4px);\n}\n\nfrigate-card-progress-indicator.top {\n grid-column: 1/-1;\n}")}};f([v({attribute:!1})],ui.prototype,"hass",void 0),f([v({attribute:!1})],ui.prototype,"viewManagerEpoch",void 0),f([v({attribute:!1})],ui.prototype,"galleryConfig",void 0),f([v({attribute:!1})],ui.prototype,"cameraManager",void 0),f([v({attribute:!1})],ui.prototype,"cardWideConfig",void 0),f([E()],ui.prototype,"_showLoaderBottom",void 0),f([E()],ui.prototype,"_showLoaderTop",void 0),ui=f([C("frigate-card-gallery-core")],ui);export{gi as FrigateCardGallery,ui as FrigateCardGalleryCore}; diff --git a/config/www/community/frigate-hass-card/gallery-1de615c4.js.gz b/config/www/community/frigate-hass-card/gallery-1de615c4.js.gz new file mode 100644 index 00000000..599edb92 Binary files /dev/null and b/config/www/community/frigate-hass-card/gallery-1de615c4.js.gz differ diff --git a/config/www/community/frigate-hass-card/gallery-9024cb87.js b/config/www/community/frigate-hass-card/gallery-9024cb87.js new file mode 100644 index 00000000..dfcd0754 --- /dev/null +++ b/config/www/community/frigate-hass-card/gallery-9024cb87.js @@ -0,0 +1,184 @@ +import{d3 as e,d4 as t,d5 as r,l as i,d6 as o,d7 as n,d8 as a,d9 as s,i as l,da as c,db as d,k as h,dc as g,dd as u,de as m,df as p,_ as f,n as v,cW as b,cR as y,dg as w,x as $,cV as x,r as k,a as _,t as C,e as T,b as E,dh as O,di as S,cI as M,dj as z,dk as L,cU as D,dl as A,c$ as F}from"./card-09c4bade.js";import{e as I}from"./endOfDay-8be4da1b.js";import{p as W}from"./parse-645a86cb.js";import{F as R}from"./date-picker-3dacab82.js";function N(t){const r=e(t),i=r.getMonth();return r.setFullYear(r.getFullYear(),i+1,0),r.setHours(23,59,59,999),r}function H(){const e=new Date,t=e.getFullYear(),r=e.getMonth(),i=e.getDate(),o=new Date(0);return o.setFullYear(t,r,i-1),o.setHours(23,59,59,999),o}function V(){const e=new Date,t=e.getFullYear(),r=e.getMonth(),i=e.getDate(),o=new Date(0);return o.setFullYear(t,r,i-1),o.setHours(0,0,0,0),o}var j,B,q; +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +function P(e){return class extends e{createRenderRoot(){const e=this.constructor,{registry:t,elementDefinitions:i,shadowRootOptions:o}=e;i&&!t&&(e.registry=new CustomElementRegistry,Object.entries(i).forEach((([t,r])=>e.registry.define(t,r))));const n=this.renderOptions.creationScope=this.attachShadow({...o,customElements:e.registry});return r(n,this.constructor.elementStyles),n}}}!function(e){e.Favorite="favorite",e.NotFavorite="not-favorite"}(j||(j={})),function(e){e.Today="today",e.Yesterday="yesterday",e.PastWeek="past-week",e.PastMonth="past-month",e.Custom="custom"}(B||(B={})),function(e){e.Clips="clips",e.Snapshots="snapshots",e.Recordings="recordings"}(q||(q={}));class U{constructor(e){this._cameraOptions=[],this._whenOptions=[],this._metaDataWhenOptions=[],this._whatOptions=[],this._whereOptions=[],this._tagsOptions=[],this._defaults=null,this._viewManager=null,this._host=e,this._favoriteOptions=[{value:j.Favorite,label:i("media_filter.favorite")},{value:j.NotFavorite,label:i("media_filter.not_favorite")}],this._mediaTypeOptions=[{value:q.Clips,label:i("media_filter.media_types.clips")},{value:q.Snapshots,label:i("media_filter.media_types.snapshots")},{value:q.Recordings,label:i("media_filter.media_types.recordings")}],this._staticWhenOptions=[{value:B.Today,label:i("media_filter.whens.today")},{value:B.Yesterday,label:i("media_filter.whens.yesterday")},{value:B.PastWeek,label:i("media_filter.whens.past_week")},{value:B.PastMonth,label:i("media_filter.whens.past_month")},{value:B.Custom,label:i("media_filter.whens.custom")}],this._computeWhenOptions()}getMediaTypeOptions(){return this._mediaTypeOptions}getCameraOptions(){return this._cameraOptions}getWhenOptions(){return this._whenOptions}getWhatOptions(){return this._whatOptions}getWhereOptions(){return this._whereOptions}getTagsOptions(){return this._tagsOptions}getFavoriteOptions(){return this._favoriteOptions}getDefaults(){return this._defaults}setViewManager(e){this._viewManager=e}async valueChangeHandler(e,t,r,i){const s=e=>e&&Array.isArray(e)&&e.length&&!e.includes("")?new Set([...e]):null,l=s(r.camera)??this._getAllCameraIDs(e);if(!l.size||!r.mediaType)return;const c=this._getWhen(r.when),d=r.favorite?r.favorite===j.Favorite:null,h=t.performance?.features.media_chunk_size;if(r.mediaType===q.Clips||r.mediaType===q.Snapshots){const e=s(r.where),t=s(r.what),i=s(r.tags),a=new o([{type:n.Event,cameraIDs:l,...i&&{tags:i},...t&&{what:t},...e&&{where:e},...null!==d&&{favorite:d},...c&&{...c.start&&{start:c.start},...c.end&&{end:c.end}},...h&&{limit:h},...r.mediaType===q.Clips&&{hasClip:!0},...r.mediaType===q.Snapshots&&{hasSnapshot:!0}}]);this._viewManager?.setViewByParametersWithExistingQuery({params:{query:a,...1===l.size&&{camera:[...l][0]},view:r.mediaType===q.Clips?"clips":"snapshots"}})}else{const e=new a([{type:n.Recording,cameraIDs:l,...h&&{limit:h},...c&&{...c.start&&{start:c.start},...c.end&&{end:c.end}},...null!==d&&{favorite:d}}]);this._viewManager?.setViewByParametersWithExistingQuery({params:{query:e,...1===l.size&&{camera:[...l][0]},view:"recordings"}})}this._host.requestUpdate()}_getAllCameraIDs(e){return e.getStore().getCameraIDsWithCapability({anyCapabilities:["clips","snapshots","recordings"]})}computeInitialDefaultsFromView(e){const t=this._viewManager?.getView(),r=t?.query?.getQueries(),i=this._getAllCameraIDs(e);if(!t||!r||!i.size)return;let o,n,a,d,h,g;1!==s(r.map((e=>e.cameraIDs)),l).length||l(r[0].cameraIDs,i)||(n=[...r[0].cameraIDs]); +/* istanbul ignore else: the else path cannot be reached -- @preserve */ +if(1===s(r.map((e=>e.favorite)),l).length&&void 0!==r[0].favorite&&(h=r[0].favorite?j.Favorite:j.NotFavorite),c.areEventQueries(t.query)){const e=t.query.getQueries(); +/* istanbul ignore if: the if path cannot be reached -- @preserve */if(!e)return;const r=s(e.map((e=>e.hasClip)),l),i=s(e.map((e=>e.hasSnapshot)),l);1===r.length&&1===i.length&&(o=r[0]?q.Clips:i[0]?q.Snapshots:void 0);1===s(e.map((e=>e.what)),l).length&&e[0].what?.size&&(a=[...e[0].what]);1===s(e.map((e=>e.where)),l).length&&e[0].where?.size&&(d=[...e[0].where]);1===s(e.map((e=>e.tags)),l).length&&e[0].tags?.size&&(g=[...e[0].tags])}else c.areRecordingQueries(t.query)&&(o=q.Recordings);this._defaults={...o&&{mediaType:o},...n&&{cameraIDs:n},...a&&{what:a},...d&&{where:d},...void 0!==h&&{favorite:h},...g&&{tags:g}}}computeCameraOptions(e){this._cameraOptions=[...this._getAllCameraIDs(e)].map((t=>({value:t,label:e.getCameraMetadata(t)?.title??t})))}async computeMetadataOptions(e){let t=null;try{t=await e.getMediaMetadata()}catch(e){d(e)}if(t){if(t.what&&(this._whatOptions=[...t.what].sort().map((e=>({value:e,label:h(e)})))),t.where&&(this._whereOptions=[...t.where].sort().map((e=>({value:e,label:h(e)})))),t.tags&&(this._tagsOptions=[...t.tags].sort().map((e=>({value:e,label:h(e)})))),t.days){const e=new Set;[...t.days].forEach((t=>{e.add(t.substring(0,7))}));const r=[];e.forEach((e=>{r.push(W(e,"yyyy-MM",new Date))})),this._metaDataWhenOptions=g(r,(e=>e.getTime()),"desc").map((e=>({label:u(e,"MMMM yyyy"),value:this._dateRangeToString({start:e,end:N(e)})}))),this._computeWhenOptions()}this._host.requestUpdate()}}getControlsToShow(e){const t=this._viewManager?.getView(),r=c.areEventQueries(t?.query),i=c.areRecordingQueries(t?.query),o=e.getAggregateCameraCapabilities();return{events:r,recordings:i,favorites:r?o?.has("favorite-events"):!!i&&o?.has("favorite-recordings")}}_computeWhenOptions(){this._whenOptions=[...this._staticWhenOptions,...this._metaDataWhenOptions]}_dateRangeToString(e){return`${m(e.start)},${m(e.end)}`}_stringToDateRange(e){const t=e.split(",");return{start:W(t[0],"yyyy-MM-dd",new Date),end:I(W(t[1],"yyyy-MM-dd",new Date))}}_getWhen(e){if(e.from||e.to)return{...e.from&&{start:e.from},...e.to&&{end:e.to}};if(!e.selected||Array.isArray(e.selected))return null;const r=new Date;switch(e.selected){case B.Custom:return null;case B.Today:return{start:t(Date.now()),end:I(Date.now())};case B.Yesterday:return{start:V(),end:H()};case B.PastWeek:return{start:t(p(r,{days:7})),end:I(r)};case B.PastMonth:return{start:t(p(r,{months:1})),end:I(r)};default:return this._stringToDateRange(e.selected)}}}const K=!0,Y=!0,Q=!0,G=!1,X=!1;let Z,J,ee,te=!1,re=!1,ie=!1,oe=!1,ne=null,ae=!1;const se="http://www.w3.org/1999/xlink",le={},ce=e=>"object"===(e=typeof e)||"function"===e;const de=(e,t,...r)=>{let i=null,o=null,n=null,a=!1,s=!1;const l=[],c=t=>{for(let r=0;re[t])).join(" "))}}if("function"==typeof e)return e(null===t?{}:t,l,ue);const d=he(e,null);return d.$attrs$=t,l.length>0&&(d.$children$=l),d.$key$=o,d.$name$=n,d},he=(e,t)=>{const r={$flags$:0,$tag$:e,$text$:t,$elm$:null,$children$:null,$attrs$:null,$key$:null,$name$:null};return r},ge={},ue={forEach:(e,t)=>e.map(me).forEach(t),map:(e,t)=>e.map(me).map(t).map(pe)},me=e=>({vattrs:e.$attrs$,vchildren:e.$children$,vkey:e.$key$,vname:e.$name$,vtag:e.$tag$,vtext:e.$text$}),pe=e=>{if("function"==typeof e.vtag){const t=Object.assign({},e.vattrs);return e.vkey&&(t.key=e.vkey),e.vname&&(t.name=e.vname),de(e.vtag,t,...e.vchildren||[])}const t=he(e.vtag,e.vtext);return t.$attrs$=e.vattrs,t.$children$=e.vchildren,t.$key$=e.vkey,t.$name$=e.vname,t},fe=(e,t,r)=>{const i=e;return{emit:e=>ve(i,t,{bubbles:!!(4&r),composed:!!(2&r),cancelable:!!(1&r),detail:e})}},ve=(e,t,r)=>{const i=ht.ce(t,r);return e.dispatchEvent(i),i},be=new WeakMap,ye=e=>{const t=e.$cmpMeta$,r=e.$hostElement$,i=t.$flags$,o=(t.$tagName$,()=>{}),n=((e,t,r,i)=>{var o;let n=we(t,r);const a=at.get(n);if(e=11===e.nodeType?e:ct,a)if("string"==typeof a){e=e.head||e;let t,r=be.get(e);if(r||be.set(e,r=new Set),!r.has(n)){{t=ct.createElement("style"),t.innerHTML=a;const r=null!==(o=ht.$nonce$)&&void 0!==o?o:function(e){var t,r,i;return null!==(i=null===(r=null===(t=e.head)||void 0===t?void 0:t.querySelector('meta[name="csp-nonce"]'))||void 0===r?void 0:r.getAttribute("content"))&&void 0!==i?i:void 0}(ct);null!=r&&t.setAttribute("nonce",r),e.insertBefore(t,e.querySelector("link"))}r&&r.add(n)}}else e.adoptedStyleSheets.includes(a)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,a]);return n})(r.shadowRoot?r.shadowRoot:r.getRootNode(),t,e.$modeName$);10&i&&(r["s-sc"]=n,r.classList.add(n+"-h"),2&i&&r.classList.add(n+"-s")),o()},we=(e,t)=>"sc-"+(t&&32&e.$flags$?e.$tagName$+"-"+t:e.$tagName$),$e=(e,t,r,i,o,n)=>{if(r!==i){let a=ot(e,t),s=t.toLowerCase();if("class"===t){const t=e.classList,o=ke(r),n=ke(i);t.remove(...o.filter((e=>e&&!n.includes(e)))),t.add(...n.filter((e=>e&&!o.includes(e))))}else if("style"===t){for(const t in r)i&&null!=i[t]||(t.includes("-")?e.style.removeProperty(t):e.style[t]="");for(const t in i)r&&i[t]===r[t]||(t.includes("-")?e.style.setProperty(t,i[t]):e.style[t]=i[t])}else if("key"===t);else if("ref"===t)i&&i(e);else if(e.__lookupSetter__(t)||"o"!==t[0]||"n"!==t[1]){const l=ce(i);if((a||l&&null!==i)&&!o)try{if(e.tagName.includes("-"))e[t]=i;else{const o=null==i?"":i;"list"===t?a=!1:null!=r&&e[t]==o||(e[t]=o)}}catch(e){}let c=!1;s!==(s=s.replace(/^xlink\:?/,""))&&(t=s,c=!0),null==i||!1===i?!1===i&&""!==e.getAttribute(t)||(c?e.removeAttributeNS(se,t):e.removeAttribute(t)):(!a||4&n||o)&&!l&&(i=!0===i?"":i,c?e.setAttributeNS(se,t,i):e.setAttribute(t,i))}else t="-"===t[2]?t.slice(3):ot(lt,s)?s.slice(2):s[2]+t.slice(3),r&&ht.rel(e,t,r,!1),i&&ht.ael(e,t,i,!1)}},xe=/\s/,ke=e=>e?e.split(xe):[],_e=(e,t,r,i)=>{const o=11===t.$elm$.nodeType&&t.$elm$.host?t.$elm$.host:t.$elm$,n=e&&e.$attrs$||le,a=t.$attrs$||le;for(i in n)i in a||$e(o,i,n[i],void 0,r,t.$flags$);for(i in a)$e(o,i,n[i],a[i],r,t.$flags$)},Ce=(e,t,r,i)=>{const o=t.$children$[r];let n,a,s,l=0;if(te||(ie=!0,"slot"===o.$tag$&&(Z&&i.classList.add(Z+"-s"),o.$flags$|=o.$children$?2:1)),null!==o.$text$)n=o.$elm$=ct.createTextNode(o.$text$);else if(1&o.$flags$)n=o.$elm$=ct.createTextNode("");else{if(oe||(oe="svg"===o.$tag$),n=o.$elm$=ct.createElementNS(oe?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",2&o.$flags$?"slot-fb":o.$tag$),oe&&"foreignObject"===o.$tag$&&(oe=!1),_e(null,o,oe),null!=Z&&n["s-si"]!==Z&&n.classList.add(n["s-si"]=Z),o.$children$)for(l=0;l{ht.$flags$|=1;const r=e.childNodes;for(let e=r.length-1;e>=0;e--){const i=r[e];i["s-hn"]!==ee&&i["s-ol"]&&(ze(i).insertBefore(i,Me(i)),i["s-ol"].remove(),i["s-ol"]=void 0,ie=!0),t&&Te(i,t)}ht.$flags$&=-2},Ee=(e,t,r,i,o,n)=>{let a,s=e["s-cr"]&&e["s-cr"].parentNode||e;for(s.shadowRoot&&s.tagName===ee&&(s=s.shadowRoot);o<=n;++o)i[o]&&(a=Ce(null,r,o,e),a&&(i[o].$elm$=a,s.insertBefore(a,Me(t))))},Oe=(e,t,r,i,o)=>{for(;t<=r;++t)(i=e[t])&&(o=i.$elm$,We(i),re=!0,o["s-ol"]?o["s-ol"].remove():Te(o,!0),o.remove())},Se=(e,t)=>e.$tag$===t.$tag$&&("slot"===e.$tag$?e.$name$===t.$name$:e.$key$===t.$key$),Me=e=>e&&e["s-ol"]||e,ze=e=>(e["s-ol"]?e["s-ol"]:e).parentNode,Le=(e,t)=>{const r=t.$elm$=e.$elm$,i=e.$children$,o=t.$children$,n=t.$tag$,a=t.$text$;let s;null===a?(oe="svg"===n||"foreignObject"!==n&&oe,"slot"===n||_e(e,t,oe),null!==i&&null!==o?((e,t,r,i)=>{let o,n,a=0,s=0,l=0,c=0,d=t.length-1,h=t[0],g=t[d],u=i.length-1,m=i[0],p=i[u];for(;a<=d&&s<=u;)if(null==h)h=t[++a];else if(null==g)g=t[--d];else if(null==m)m=i[++s];else if(null==p)p=i[--u];else if(Se(h,m))Le(h,m),h=t[++a],m=i[++s];else if(Se(g,p))Le(g,p),g=t[--d],p=i[--u];else if(Se(h,p))"slot"!==h.$tag$&&"slot"!==p.$tag$||Te(h.$elm$.parentNode,!1),Le(h,p),e.insertBefore(h.$elm$,g.$elm$.nextSibling),h=t[++a],p=i[--u];else if(Se(g,m))"slot"!==h.$tag$&&"slot"!==p.$tag$||Te(g.$elm$.parentNode,!1),Le(g,m),e.insertBefore(g.$elm$,h.$elm$),g=t[--d],m=i[++s];else{for(l=-1,c=a;c<=d;++c)if(t[c]&&null!==t[c].$key$&&t[c].$key$===m.$key$){l=c;break}l>=0?(n=t[l],n.$tag$!==m.$tag$?o=Ce(t&&t[s],r,l,e):(Le(n,m),t[l]=void 0,o=n.$elm$),m=i[++s]):(o=Ce(t&&t[s],r,s,e),m=i[++s]),o&&ze(h.$elm$).insertBefore(o,Me(h.$elm$))}a>d?Ee(e,null==i[u+1]?null:i[u+1].$elm$,r,i,s,u):s>u&&Oe(t,a,d)})(r,i,t,o):null!==o?(null!==e.$text$&&(r.textContent=""),Ee(r,null,t,o,0,o.length-1)):null!==i&&Oe(i,0,i.length-1),oe&&"svg"===n&&(oe=!1)):(s=r["s-cr"])?s.parentNode.textContent=a:e.$text$!==a&&(r.data=a)},De=e=>{const t=e.childNodes;let r,i,o,n,a,s;for(i=0,o=t.length;i{let t,r,i,o,n,a,s=0;const l=e.childNodes,c=l.length;for(;s=0;a--)r=i[a],r["s-cn"]||r["s-nr"]||r["s-hn"]===t["s-hn"]||(Ie(r,o)?(n=Ae.find((e=>e.$nodeToRelocate$===r)),re=!0,r["s-sn"]=r["s-sn"]||o,n?n.$slotRefNode$=t:Ae.push({$slotRefNode$:t,$nodeToRelocate$:r}),r["s-sr"]&&Ae.map((e=>{Ie(e.$nodeToRelocate$,r["s-sn"])&&(n=Ae.find((e=>e.$nodeToRelocate$===r)),n&&!e.$slotRefNode$&&(e.$slotRefNode$=n.$slotRefNode$))}))):Ae.some((e=>e.$nodeToRelocate$===r))||Ae.push({$nodeToRelocate$:r}));1===t.nodeType&&Fe(t)}},Ie=(e,t)=>1===e.nodeType?null===e.getAttribute("slot")&&""===t||e.getAttribute("slot")===t:e["s-sn"]===t||""===t,We=e=>{e.$attrs$&&e.$attrs$.ref&&e.$attrs$.ref(null),e.$children$&&e.$children$.map(We)},Re=(e,t)=>{const r=e.$hostElement$,i=e.$cmpMeta$,o=e.$vnode$||he(null,null),n=(a=t)&&a.$tag$===ge?t:de(null,null,t);var a;if(ee=r.tagName,i.$attrsToReflect$&&(n.$attrs$=n.$attrs$||{},i.$attrsToReflect$.map((([e,t])=>n.$attrs$[t]=r[e]))),n.$tag$=null,n.$flags$|=4,e.$vnode$=n,n.$elm$=o.$elm$=r.shadowRoot||r,Z=r["s-sc"],J=r["s-cr"],te=!!(1&i.$flags$),re=!1,Le(o,n),ht.$flags$|=1,ie){let e,t,r,i,o,a;Fe(n.$elm$);let s=0;for(;s{e.$flags$|=16,e.$ancestorComponent$;return $t((()=>He(e,t)))},He=(e,t)=>{const r=e.$hostElement$,i=(e.$cmpMeta$.$tagName$,()=>{}),o=r;let n;return n=qe(o,t?"componentWillLoad":"componentWillUpdate"),n=Pe(n,(()=>qe(o,"componentWillRender"))),i(),Pe(n,(()=>Ve(e,o,t)))},Ve=async(e,t,r)=>{const i=e.$hostElement$,o=(e.$cmpMeta$.$tagName$,()=>{});i["s-rc"],r&&ye(e);const n=(e.$cmpMeta$.$tagName$,()=>{});je(e,t,i),n(),o(),Be(e)},je=(e,t,r)=>{try{ne=t,t=t.render&&t.render(),e.$flags$&=-17,e.$flags$|=2,(K||Y)&&(Q||Y)&&(G||Re(e,t))}catch(t){nt(t,e.$hostElement$)}return ne=null,null},Be=e=>{e.$cmpMeta$.$tagName$;const t=()=>{},r=e.$hostElement$;e.$ancestorComponent$,qe(r,"componentDidRender"),64&e.$flags$?(qe(r,"componentDidUpdate"),t()):(e.$flags$|=64,qe(r,"componentDidLoad"),t())},qe=(e,t,r)=>{if(e&&e[t])try{return e[t](r)}catch(e){nt(e)}},Pe=(e,t)=>e&&e.then?e.then(t):t(),Ue=(e,t,r,i)=>{const o=rt(e),n=e,a=o.$instanceValues$.get(t),s=o.$flags$,l=n;var c,d;c=r,d=i.$members$[t][0],r=null==c||ce(c)?c:4&d?"false"!==c&&(""===c||!!c):2&d?parseFloat(c):1&d?String(c):c;const h=Number.isNaN(a)&&Number.isNaN(r);if(r!==a&&!h){if(o.$instanceValues$.set(t,r),i.$watchers$&&128&s){const e=i.$watchers$[t];e&&e.map((e=>{try{l[e](r,a,t)}catch(e){nt(e,n)}}))}if(2==(18&s)){if(l.componentShouldUpdate&&!1===l.componentShouldUpdate(r,a,t))return;Ne(o,!1)}}},Ke=(e,t,r)=>{if(t.$members$){e.watchers&&(t.$watchers$=e.watchers);const r=Object.entries(t.$members$),i=e.prototype;r.map((([e,[r]])=>{(31&r||32&r)&&Object.defineProperty(i,e,{get(){return t=e,rt(this).$instanceValues$.get(t);var t},set(r){Ue(this,e,r,t)},configurable:!0,enumerable:!0})}));{const o=new Map;i.attributeChangedCallback=function(e,t,r){ht.jmp((()=>{const t=o.get(e);if(this.hasOwnProperty(t))r=this[t],delete this[t];else if(i.hasOwnProperty(t)&&"number"==typeof this[t]&&this[t]==r)return;this[t]=(null!==r||"boolean"!=typeof this[t])&&r}))},e.observedAttributes=r.filter((([e,t])=>15&t[0])).map((([e,r])=>{const i=r[1]||e;return o.set(i,e),512&r[0]&&t.$attrsToReflect$.push([e,i]),i}))}}return e},Ye=async(e,t,r,i,o)=>{if(!(32&t.$flags$)&&(o=e.constructor,t.$flags$|=32,customElements.whenDefined(r.$tagName$).then((()=>t.$flags$|=128)),o.style)){let i=o.style;"string"!=typeof i&&(i=i[t.$modeName$=(e=>st.map((t=>t(e))).find((e=>!!e)))(e)]);const n=we(r,t.$modeName$);if(!at.has(n)){const e=(r.$tagName$,()=>{});((e,t,r)=>{let i=at.get(e);mt&&r?(i=i||new CSSStyleSheet,"string"==typeof i?i=t:i.replaceSync(t)):i=t,at.set(e,i)})(n,i,!!(1&r.$flags$)),e()}}t.$ancestorComponent$;Ne(t,!0)},Qe=e=>{const t=e["s-cr"]=ct.createComment("");t["s-cn"]=!0,e.insertBefore(t,e.firstChild)},Ge=(e,t)=>{const r={$flags$:t[0],$tagName$:t[1]};r.$members$=t[2],r.$listeners$=t[3],r.$watchers$=e.$watchers$,r.$attrsToReflect$=[],!gt&&1&r.$flags$&&(r.$flags$|=8);const i=e.prototype.connectedCallback,o=e.prototype.disconnectedCallback;return Object.assign(e.prototype,{__registerHost(){it(this,r)},connectedCallback(){(e=>{if(!(1&ht.$flags$)){const t=rt(e),r=t.$cmpMeta$,i=(r.$tagName$,()=>{});1&t.$flags$?(Xe(e,t,r.$listeners$),t.$lazyInstance$):(t.$flags$|=1,12&r.$flags$&&Qe(e),r.$members$&&Object.entries(r.$members$).map((([t,[r]])=>{if(31&r&&e.hasOwnProperty(t)){const r=e[t];delete e[t],e[t]=r}})),Ye(e,t,r)),i()}})(this),i&&i.call(this)},disconnectedCallback(){(e=>{if(!(1&ht.$flags$)){const t=rt(e);t.$rmListeners$&&(t.$rmListeners$.map((e=>e())),t.$rmListeners$=void 0)}})(this),o&&o.call(this)},__attachShadow(){gt?this.attachShadow({mode:"open",delegatesFocus:!!(16&r.$flags$)}):this.shadowRoot=this}}),e.is=r.$tagName$,Ke(e,r)},Xe=(e,t,r,i)=>{r&&r.map((([r,i,o])=>{const n=Je(e,r),a=Ze(t,o),s=et(r);ht.ael(n,i,a,s),(t.$rmListeners$=t.$rmListeners$||[]).push((()=>ht.rel(n,i,a,s)))}))},Ze=(e,t)=>r=>{try{X||e.$hostElement$[t](r)}catch(e){nt(e)}},Je=(e,t)=>4&t?ct:8&t?lt:16&t?ct.body:e,et=e=>ut?{passive:!!(1&e),capture:!!(2&e)}:!!(2&e),tt=new WeakMap,rt=e=>tt.get(e),it=(e,t)=>{const r={$flags$:0,$hostElement$:e,$cmpMeta$:t,$instanceValues$:new Map};return Xe(e,r,t.$listeners$),tt.set(e,r)},ot=(e,t)=>t in e,nt=(e,t)=>(0,console.error)(e,t),at=new Map,st=[],lt="undefined"!=typeof window?window:{},ct=lt.document||{head:{}},dt=lt.HTMLElement||class{},ht={$flags$:0,$resourcesUrl$:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,r,i)=>e.addEventListener(t,r,i),rel:(e,t,r,i)=>e.removeEventListener(t,r,i),ce:(e,t)=>new CustomEvent(e,t)},gt=!0,ut=(()=>{let e=!1;try{ct.addEventListener("e",null,Object.defineProperty({},"passive",{get(){e=!0}}))}catch(e){}return e})(),mt=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync}catch(e){}return!1})(),pt=[],ft=[],vt=(e,t)=>r=>{e.push(r),ae||(ae=!0,t&&4&ht.$flags$?wt(yt):ht.raf(yt))},bt=e=>{for(let t=0;t{bt(pt),bt(ft),(ae=pt.length>0)&&ht.raf(yt)},wt=e=>{return Promise.resolve(t).then(e);var t},$t=vt(ft,!0),xt=(e,t)=>{const r=!!e.label||e.hasLabelSlot,i=!!e.helpText||e.hasHelpTextSlot,o=!!e.invalidText||e.hasInvalidTextSlot,n=!e.invalid,a=!!e.invalid;return de("div",{class:{"form-control":!0,[`form-control-${e.size}`]:!0,"form-control-has-label":r,"form-control-has-help-text":i,"form-control-has-invalid-text":o}},de("label",{id:e.labelId,class:"form-control-label",htmlFor:e.inputId,"aria-hidden":r?"false":"true",onClick:e.onLabelClick},de("slot",{name:"label"},e.label),e.requiredIndicator&&de("div",{class:"asterisk"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 1200 1200"},de("path",{fill:"currentColor",d:"M489.838 29.354v443.603L68.032 335.894 0 545.285l421.829 137.086-260.743 358.876 178.219 129.398L600.048 811.84l260.673 358.806 178.146-129.398-260.766-358.783L1200 545.379l-68.032-209.403-421.899 137.07V29.443H489.84l-.002-.089z"})))),de("div",{class:"form-control-input"},t),n&&de("div",{id:e.helpTextId,class:"form-control-help-text","aria-hidden":i?"false":"true"},de("slot",{name:"help-text"},e.helpText)),a&&de("div",{id:e.invalidTextId,class:"form-control-invalid-text","aria-hidden":o?"false":"true"},de("div",{class:"icon"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Alert Circle"),de("path",{d:"M256,48C141.31,48,48,141.31,48,256s93.31,208,208,208,208-93.31,208-208S370.69,48,256,48Zm0,319.91a20,20,0,1,1,20-20A20,20,0,0,1,256,367.91Zm21.72-201.15-5.74,122a16,16,0,0,1-32,0l-5.74-121.94v-.05a21.74,21.74,0,1,1,43.44,0Z",fill:"currentColor"}))),de("div",{class:"text"},de("slot",{name:"invalid-text"},e.invalidText))))}; +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +function kt(e){const t=e?e.assignedNodes({flatten:!0}):[];let r="";return[...t].map((e=>{e.nodeType===Node.TEXT_NODE&&(r+=e.textContent)})),r}function _t(e,t){return t?null!==e.querySelector(`[slot="${t}"]`):[...e.childNodes].some((e=>{if(e.nodeType===e.TEXT_NODE&&""!==e.textContent.trim())return!0;if(e.nodeType===e.ELEMENT_NODE){if(!e.hasAttribute("slot"))return!0}return!1}))} +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */const Ct=(e,t=[])=>{const r={};return t.forEach((t=>{if(e.hasAttribute(t)){null!==e.getAttribute(t)&&(r[t]=e.getAttribute(t)),e.removeAttribute(t)}})),r},Tt=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow()}render(){return de("span",{class:"spinner","aria-busy":"true","aria-live":"polite"})}static get style(){return":host{--track-color:var(--gr-color-light-shade);--indicator-color:var(--gr-color-primary);--stroke-width:2px;display:inline-flex;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.spinner{display:inline-block;width:1em;height:1em;border-radius:50%;border:solid var(--stroke-width) var(--track-color);border-top-color:var(--indicator-color);border-right-color:var(--indicator-color);animation:1s linear infinite spin}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}"}},[1,"gr-spinner"]);function Et(){if("undefined"==typeof customElements)return;["gr-spinner"].forEach((e=>{if("gr-spinner"===e)customElements.get(e)||customElements.define(e,Tt)}))}Et(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const Ot=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grFocus=fe(this,"gr-focus",7),this.grBlur=fe(this,"gr-blur",7),this.inheritedAttributes={},this.handleClick=e=>{if("button"!==this.type){const t=this.el.closest("form");if(t){e.preventDefault();const r=document.createElement("button");r.type=this.type,r.style.display="none",t.appendChild(r),r.click(),r.remove()}}},this.onFocus=()=>{this.grFocus.emit()},this.onBlur=()=>{this.grBlur.emit()},this.variant="default",this.disabled=!1,this.loading=!1,this.size="medium",this.caret=!1,this.pill=!1,this.expand=void 0,this.circle=!1,this.href=void 0,this.target=void 0,this.rel=void 0,this.type="button"}componentWillLoad(){this.inheritedAttributes=Ct(this.el,["aria-label","tabindex","title"])}async setFocus(e){this.button.focus(e)}async removeFocus(){this.button.blur()}render(){const{rel:e,target:t,href:r,variant:i,size:o,expand:n,type:a,inheritedAttributes:s,disabled:l}=this,c=void 0===r?"button":"a",d="button"===c?{type:a}:{href:r,rel:e,target:t};return de(ge,{onClick:this.handleClick,"aria-disabled":l?"true":null,class:{[`button-${i}`]:!0,[`button-${o}`]:!0,[`button-${n}`]:void 0!==n,"button-caret":this.caret,"button-circle":this.circle,"button-pill":this.pill,"button-disabled":l,"button-loading":this.loading}},de(c,Object.assign({ref:e=>this.button=e},d,{class:"button-native",disabled:l,onFocus:this.onFocus,onBlur:this.onBlur},s),de("span",{class:"button-inner"},de("slot",{name:"icon-only"}),de("slot",{name:"start"}),de("slot",null),de("slot",{name:"end"}),this.caret&&de("span",{class:"caret"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Chevron Down"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"M112 184l144 144 144-144"})))),this.loading&&de("gr-spinner",null)))}get el(){return this}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{display:inline-block;width:auto;font-family:var(--gr-font-family);font-weight:var(--gr-font-weight-medium);font-size:var(--gr-form-element-font-size-medium);font-kerning:none;user-select:none;vertical-align:top;vertical-align:-webkit-baseline-middle;pointer-events:auto;--height:var(--gr-form-element-height-medium);--border-radius:var(--gr-form-element-border-radius-medium);--border-width:1px;--border-style:solid;--background:transparent;--background-hover:transparent;--background-focus:transparent;--color:var(--gr-color-dark-tint);--color-hover:var(--gr-color-dark-tint);--color-focus:var(--gr-color-dark-tint);--border-color:var(--gr-color-light-shade);--border-color-hover:var(--gr-color-medium);--border-color-focus:var(--gr-color-primary);--padding-top:0;--padding-start:var(--gr-spacing-medium);--padding-end:var(--gr-spacing-medium);--padding-bottom:0;--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33);--shadow:none;--transition:background-color 150ms linear, opacity 150ms linear, border 150ms linear, color 150ms linear}:host(.button-disabled){pointer-events:none;opacity:0.5}:host(.button-primary){--border-color:var(--gr-color-primary);--background:var(--gr-color-primary);--color:var(--gr-color-primary-contrast);--border-color-hover:var(--gr-color-primary-shade);--background-hover:var(--gr-color-primary-shade);--color-hover:var(--gr-color-primary-contrast);--border-color-focus:var(--gr-color-primary);--background-focus:var(--gr-color-primary-shade);--color-focus:var(--gr-color-primary-contrast);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33)}:host(.button-secondary){--border-color:var(--gr-color-light-shade);--background:transparent;--color:var(--gr-color-primary);--border-color-hover:var(--gr-color-primary);--background-hover:transparent;--color-hover:var(--gr-color-primary);--border-color-focus:var(--gr-color-primary);--background-focus:transparent;--color-focus:var(--gr-color-primary);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33)}:host(.button-danger){--border-color:var(--gr-color-danger);--background:transparent;--color:var(--gr-color-danger);--border-color-hover:var(--gr-color-danger);--background-hover:var(--gr-color-danger);--color-hover:var(--gr-color-danger-contrast);--border-color-focus:var(--gr-color-danger);--background-focus:var(--gr-color-danger);--color-focus:var(--gr-color-danger-contrast);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-danger-rgb), 0.33)}:host(.button-plain){--border-color:transparent;--background:transparent;--color:var(--gr-color-primary);--border-color-hover:transparent;--background-hover:transparent;--color-hover:var(--gr-color-primary-shade);--border-color-focus:transparent;--background-focus:transparent;--color-focus:var(--gr-color-primary-shade);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33)}:host(.button-small){--padding-start:var(--gr-spacing-small);--padding-end:var(--gr-spacing-small);--border-radius:var(--gr-form-element-border-radius-small);--height:var(--gr-form-element-height-small);font-size:var(--gr-form-element-font-size-small)}:host(.button-large){--padding-start:var(--gr-spacing-large);--padding-end:var(--gr-spacing-large);--border-radius:var(--gr-form-element-border-radius-large);--height:var(--gr-form-element-height-large);font-size:var(--gr-form-element-font-size-large)}:host(.button-block){display:block}:host(.button-block) .button-native{margin-left:0;margin-right:0;display:block;width:100%;clear:both;contain:content}:host(.button-block) .button-native::after{clear:both}:host(.button-full){display:block}:host(.button-full) .button-native{margin-left:0;margin-right:0;display:block;width:100%;contain:content;border-radius:0;border-right-width:0;border-left-width:0}.button-native{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:block;position:relative;padding-top:var(--padding-top);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-bottom:var(--padding-bottom);width:100%;height:var(--height);transition:var(--transition);border-radius:var(--border-radius);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);color:var(--color);box-shadow:var(--shadow);line-height:1;cursor:pointer;z-index:0;text-decoration:none;box-sizing:border-box}.button-native::-moz-focus-inner{border:0}.button-native:focus{outline:none;box-shadow:var(--focus-ring);border-color:var(--border-color-focus);background-color:var(--background-focus);color:var(--color-focus)}.button-native *,.button-native *:before,.button-native *:after{box-sizing:inherit}.button-inner{display:flex;position:relative;flex-flow:row nowrap;flex-shrink:0;align-items:center;justify-content:center;width:100%;height:100%;z-index:1}:host(.button-circle) .button-native{padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;border-radius:50%;width:var(--height)}@media (any-hover: hover){.button-native:hover{color:var(--color-hover);background:var(--background-hover);border-color:var(--border-color-hover)}}:host(.button-caret) .caret{display:flex;align-items:center;margin-left:0.3em}:host(.button-caret) .caret svg{width:1em;height:1em}:host(.button-pill) .button-native{border-radius:var(--height)}::slotted(*){pointer-events:none}::slotted([slot=start]){margin-top:0;margin-left:-0.3em;margin-right:0.3em;margin-bottom:0}::slotted([slot=end]){margin-top:0;margin-left:0.3em;margin-right:-0.2em;margin-bottom:0}::slotted([slot=icon-only]){font-size:1.4em;pointer-events:none}:host(.button-loading){position:relative;pointer-events:none}:host(.button-loading) .caret{visibility:hidden}:host(.button-loading) slot[name=start],:host(.button-loading) slot[name=end],:host(.button-loading) slot[name=icon-only],:host(.button-loading) slot:not([name]){visibility:hidden}:host(.button-loading) gr-spinner{--indicator-color:currentColor;position:absolute;height:1em;width:1em;top:calc(50% - 0.5em);left:calc(50% - 0.5em)}@media not all and (min-resolution: 0.001dpcm){@supports (-webkit-appearance: none) and (stroke-color: transparent){:host([type=button]),:host([type=reset]),:host([type=submit]){-webkit-appearance:none !important}}}"}},[1,"gr-button",{variant:[513],disabled:[516],loading:[516],size:[513],caret:[4],pill:[516],expand:[513],circle:[516],href:[1],target:[1],rel:[1],type:[1],setFocus:[64],removeFocus:[64]}]);function St(){if("undefined"==typeof customElements)return;["gr-button","gr-spinner"].forEach((e=>{switch(e){case"gr-button":customElements.get(e)||customElements.define(e,Ot);break;case"gr-spinner":customElements.get(e)||Et()}}))}function Mt(e,t,r="vertical",i="smooth"){const o= +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +function(e,t){return{top:Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top),left:Math.round(e.getBoundingClientRect().left-t.getBoundingClientRect().left)}}(e,t),n=o.top+t.scrollTop,a=o.left+t.scrollLeft,s=t.scrollLeft,l=t.scrollLeft+t.offsetWidth,c=t.scrollTop,d=t.scrollTop+t.offsetHeight;"horizontal"!==r&&"both"!==r||(al&&t.scrollTo({left:a-t.offsetWidth+e.clientWidth,behavior:i})),"vertical"!==r&&"both"!==r||(nd&&t.scrollTo({top:n-t.offsetHeight+e.clientHeight,behavior:i}))} +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */function zt(e){return e.tabIndex>-1}function Lt(e){if(zt(e))return e;if(e.shadowRoot){const t=[...e.shadowRoot.children].find(zt);if(t)return t}return e.children?[...e.children].map(Lt)[0]:null}St();var Dt="top",At="bottom",Ft="right",It="left",Wt="auto",Rt=[Dt,At,Ft,It],Nt="start",Ht="end",Vt="clippingParents",jt="viewport",Bt="popper",qt="reference",Pt=Rt.reduce((function(e,t){return e.concat([t+"-"+Nt,t+"-"+Ht])}),[]),Ut=[].concat(Rt,[Wt]).reduce((function(e,t){return e.concat([t,t+"-"+Nt,t+"-"+Ht])}),[]),Kt=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function Yt(e){return e?(e.nodeName||"").toLowerCase():null}function Qt(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Gt(e){return e instanceof Qt(e).Element||e instanceof Element}function Xt(e){return e instanceof Qt(e).HTMLElement||e instanceof HTMLElement}function Zt(e){return"undefined"!=typeof ShadowRoot&&(e instanceof Qt(e).ShadowRoot||e instanceof ShadowRoot)}const Jt={name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach((function(e){var r=t.styles[e]||{},i=t.attributes[e]||{},o=t.elements[e];Xt(o)&&Yt(o)&&(Object.assign(o.style,r),Object.keys(i).forEach((function(e){var t=i[e];!1===t?o.removeAttribute(e):o.setAttribute(e,!0===t?"":t)})))}))},effect:function(e){var t=e.state,r={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,r.popper),t.styles=r,t.elements.arrow&&Object.assign(t.elements.arrow.style,r.arrow),function(){Object.keys(t.elements).forEach((function(e){var i=t.elements[e],o=t.attributes[e]||{},n=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:r[e]).reduce((function(e,t){return e[t]="",e}),{});Xt(i)&&Yt(i)&&(Object.assign(i.style,n),Object.keys(o).forEach((function(e){i.removeAttribute(e)})))}))}},requires:["computeStyles"]};function er(e){return e.split("-")[0]}var tr=Math.max,rr=Math.min,ir=Math.round;function or(e,t){void 0===t&&(t=!1);var r=e.getBoundingClientRect(),i=1,o=1;if(Xt(e)&&t){var n=e.offsetHeight,a=e.offsetWidth;a>0&&(i=ir(r.width)/a||1),n>0&&(o=ir(r.height)/n||1)}return{width:r.width/i,height:r.height/o,top:r.top/o,right:r.right/i,bottom:r.bottom/o,left:r.left/i,x:r.left/i,y:r.top/o}}function nr(e){var t=or(e),r=e.offsetWidth,i=e.offsetHeight;return Math.abs(t.width-r)<=1&&(r=t.width),Math.abs(t.height-i)<=1&&(i=t.height),{x:e.offsetLeft,y:e.offsetTop,width:r,height:i}}function ar(e,t){var r=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(r&&Zt(r)){var i=t;do{if(i&&e.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function sr(e){return Qt(e).getComputedStyle(e)}function lr(e){return["table","td","th"].indexOf(Yt(e))>=0}function cr(e){return((Gt(e)?e.ownerDocument:e.document)||window.document).documentElement}function dr(e){return"html"===Yt(e)?e:e.assignedSlot||e.parentNode||(Zt(e)?e.host:null)||cr(e)}function hr(e){return Xt(e)&&"fixed"!==sr(e).position?e.offsetParent:null}function gr(e){for(var t=Qt(e),r=hr(e);r&&lr(r)&&"static"===sr(r).position;)r=hr(r);return r&&("html"===Yt(r)||"body"===Yt(r)&&"static"===sr(r).position)?t:r||function(e){var t=-1!==navigator.userAgent.toLowerCase().indexOf("firefox");if(-1!==navigator.userAgent.indexOf("Trident")&&Xt(e)&&"fixed"===sr(e).position)return null;var r=dr(e);for(Zt(r)&&(r=r.host);Xt(r)&&["html","body"].indexOf(Yt(r))<0;){var i=sr(r);if("none"!==i.transform||"none"!==i.perspective||"paint"===i.contain||-1!==["transform","perspective"].indexOf(i.willChange)||t&&"filter"===i.willChange||t&&i.filter&&"none"!==i.filter)return r;r=r.parentNode}return null}(e)||t}function ur(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function mr(e,t,r){return tr(e,rr(t,r))}function pr(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},e)}function fr(e,t){return t.reduce((function(t,r){return t[r]=e,t}),{})}const vr={name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,r=e.state,i=e.name,o=e.options,n=r.elements.arrow,a=r.modifiersData.popperOffsets,s=er(r.placement),l=ur(s),c=[It,Ft].indexOf(s)>=0?"height":"width";if(n&&a){var d=function(e,t){return pr("number"!=typeof(e="function"==typeof e?e(Object.assign({},t.rects,{placement:t.placement})):e)?e:fr(e,Rt))}(o.padding,r),h=nr(n),g="y"===l?Dt:It,u="y"===l?At:Ft,m=r.rects.reference[c]+r.rects.reference[l]-a[l]-r.rects.popper[c],p=a[l]-r.rects.reference[l],f=gr(n),v=f?"y"===l?f.clientHeight||0:f.clientWidth||0:0,b=m/2-p/2,y=d[g],w=v-h[c]-d[u],$=v/2-h[c]/2+b,x=mr(y,$,w),k=l;r.modifiersData[i]=((t={})[k]=x,t.centerOffset=x-$,t)}},effect:function(e){var t=e.state,r=e.options.element,i=void 0===r?"[data-popper-arrow]":r;null!=i&&("string"!=typeof i||(i=t.elements.popper.querySelector(i)))&&ar(t.elements.popper,i)&&(t.elements.arrow=i)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function br(e){return e.split("-")[1]}var yr={top:"auto",right:"auto",bottom:"auto",left:"auto"};function wr(e){var t,r=e.popper,i=e.popperRect,o=e.placement,n=e.variation,a=e.offsets,s=e.position,l=e.gpuAcceleration,c=e.adaptive,d=e.roundOffsets,h=e.isFixed,g=a.x,u=void 0===g?0:g,m=a.y,p=void 0===m?0:m,f="function"==typeof d?d({x:u,y:p}):{x:u,y:p};u=f.x,p=f.y;var v=a.hasOwnProperty("x"),b=a.hasOwnProperty("y"),y=It,w=Dt,$=window;if(c){var x=gr(r),k="clientHeight",_="clientWidth";if(x===Qt(r)&&"static"!==sr(x=cr(r)).position&&"absolute"===s&&(k="scrollHeight",_="scrollWidth"),o===Dt||(o===It||o===Ft)&&n===Ht)w=At,p-=(h&&x===$&&$.visualViewport?$.visualViewport.height:x[k])-i.height,p*=l?1:-1;if(o===It||(o===Dt||o===At)&&n===Ht)y=Ft,u-=(h&&x===$&&$.visualViewport?$.visualViewport.width:x[_])-i.width,u*=l?1:-1}var C,T=Object.assign({position:s},c&&yr),E=!0===d?function(e){var t=e.x,r=e.y,i=window.devicePixelRatio||1;return{x:ir(t*i)/i||0,y:ir(r*i)/i||0}}({x:u,y:p}):{x:u,y:p};return u=E.x,p=E.y,l?Object.assign({},T,((C={})[w]=b?"0":"",C[y]=v?"0":"",C.transform=($.devicePixelRatio||1)<=1?"translate("+u+"px, "+p+"px)":"translate3d("+u+"px, "+p+"px, 0)",C)):Object.assign({},T,((t={})[w]=b?p+"px":"",t[y]=v?u+"px":"",t.transform="",t))}var $r={passive:!0};var xr={left:"right",right:"left",bottom:"top",top:"bottom"};function kr(e){return e.replace(/left|right|bottom|top/g,(function(e){return xr[e]}))}var _r={start:"end",end:"start"};function Cr(e){return e.replace(/start|end/g,(function(e){return _r[e]}))}function Tr(e){var t=Qt(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function Er(e){return or(cr(e)).left+Tr(e).scrollLeft}function Or(e){var t=sr(e),r=t.overflow,i=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(r+o+i)}function Sr(e){return["html","body","#document"].indexOf(Yt(e))>=0?e.ownerDocument.body:Xt(e)&&Or(e)?e:Sr(dr(e))}function Mr(e,t){var r;void 0===t&&(t=[]);var i=Sr(e),o=i===(null==(r=e.ownerDocument)?void 0:r.body),n=Qt(i),a=o?[n].concat(n.visualViewport||[],Or(i)?i:[]):i,s=t.concat(a);return o?s:s.concat(Mr(dr(a)))}function zr(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function Lr(e,t){return t===jt?zr(function(e){var t=Qt(e),r=cr(e),i=t.visualViewport,o=r.clientWidth,n=r.clientHeight,a=0,s=0;return i&&(o=i.width,n=i.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(a=i.offsetLeft,s=i.offsetTop)),{width:o,height:n,x:a+Er(e),y:s}}(e)):Gt(t)?function(e){var t=or(e);return t.top=t.top+e.clientTop,t.left=t.left+e.clientLeft,t.bottom=t.top+e.clientHeight,t.right=t.left+e.clientWidth,t.width=e.clientWidth,t.height=e.clientHeight,t.x=t.left,t.y=t.top,t}(t):zr(function(e){var t,r=cr(e),i=Tr(e),o=null==(t=e.ownerDocument)?void 0:t.body,n=tr(r.scrollWidth,r.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=tr(r.scrollHeight,r.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),s=-i.scrollLeft+Er(e),l=-i.scrollTop;return"rtl"===sr(o||r).direction&&(s+=tr(r.clientWidth,o?o.clientWidth:0)-n),{width:n,height:a,x:s,y:l}}(cr(e)))}function Dr(e,t,r){var i="clippingParents"===t?function(e){var t=Mr(dr(e)),r=["absolute","fixed"].indexOf(sr(e).position)>=0&&Xt(e)?gr(e):e;return Gt(r)?t.filter((function(e){return Gt(e)&&ar(e,r)&&"body"!==Yt(e)})):[]}(e):[].concat(t),o=[].concat(i,[r]),n=o[0],a=o.reduce((function(t,r){var i=Lr(e,r);return t.top=tr(i.top,t.top),t.right=rr(i.right,t.right),t.bottom=rr(i.bottom,t.bottom),t.left=tr(i.left,t.left),t}),Lr(e,n));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function Ar(e){var t,r=e.reference,i=e.element,o=e.placement,n=o?er(o):null,a=o?br(o):null,s=r.x+r.width/2-i.width/2,l=r.y+r.height/2-i.height/2;switch(n){case Dt:t={x:s,y:r.y-i.height};break;case At:t={x:s,y:r.y+r.height};break;case Ft:t={x:r.x+r.width,y:l};break;case It:t={x:r.x-i.width,y:l};break;default:t={x:r.x,y:r.y}}var c=n?ur(n):null;if(null!=c){var d="y"===c?"height":"width";switch(a){case Nt:t[c]=t[c]-(r[d]/2-i[d]/2);break;case Ht:t[c]=t[c]+(r[d]/2-i[d]/2)}}return t}function Fr(e,t){void 0===t&&(t={});var r=t,i=r.placement,o=void 0===i?e.placement:i,n=r.boundary,a=void 0===n?Vt:n,s=r.rootBoundary,l=void 0===s?jt:s,c=r.elementContext,d=void 0===c?Bt:c,h=r.altBoundary,g=void 0!==h&&h,u=r.padding,m=void 0===u?0:u,p=pr("number"!=typeof m?m:fr(m,Rt)),f=d===Bt?qt:Bt,v=e.rects.popper,b=e.elements[g?f:d],y=Dr(Gt(b)?b:b.contextElement||cr(e.elements.popper),a,l),w=or(e.elements.reference),$=Ar({reference:w,element:v,strategy:"absolute",placement:o}),x=zr(Object.assign({},v,$)),k=d===Bt?x:w,_={top:y.top-k.top+p.top,bottom:k.bottom-y.bottom+p.bottom,left:y.left-k.left+p.left,right:k.right-y.right+p.right},C=e.modifiersData.offset;if(d===Bt&&C){var T=C[o];Object.keys(_).forEach((function(e){var t=[Ft,At].indexOf(e)>=0?1:-1,r=[Dt,At].indexOf(e)>=0?"y":"x";_[e]+=T[r]*t}))}return _}function Ir(e,t){void 0===t&&(t={});var r=t,i=r.placement,o=r.boundary,n=r.rootBoundary,a=r.padding,s=r.flipVariations,l=r.allowedAutoPlacements,c=void 0===l?Ut:l,d=br(i),h=d?s?Pt:Pt.filter((function(e){return br(e)===d})):Rt,g=h.filter((function(e){return c.indexOf(e)>=0}));0===g.length&&(g=h);var u=g.reduce((function(t,r){return t[r]=Fr(e,{placement:r,boundary:o,rootBoundary:n,padding:a})[er(r)],t}),{});return Object.keys(u).sort((function(e,t){return u[e]-u[t]}))}const Wr={name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,r=e.options,i=e.name;if(!t.modifiersData[i]._skip){for(var o=r.mainAxis,n=void 0===o||o,a=r.altAxis,s=void 0===a||a,l=r.fallbackPlacements,c=r.padding,d=r.boundary,h=r.rootBoundary,g=r.altBoundary,u=r.flipVariations,m=void 0===u||u,p=r.allowedAutoPlacements,f=t.options.placement,v=er(f),b=l||(v===f||!m?[kr(f)]:function(e){if(er(e)===Wt)return[];var t=kr(e);return[Cr(e),t,Cr(t)]}(f)),y=[f].concat(b).reduce((function(e,r){return e.concat(er(r)===Wt?Ir(t,{placement:r,boundary:d,rootBoundary:h,padding:c,flipVariations:m,allowedAutoPlacements:p}):r)}),[]),w=t.rects.reference,$=t.rects.popper,x=new Map,k=!0,_=y[0],C=0;C=0,M=S?"width":"height",z=Fr(t,{placement:T,boundary:d,rootBoundary:h,altBoundary:g,padding:c}),L=S?O?Ft:It:O?At:Dt;w[M]>$[M]&&(L=kr(L));var D=kr(L),A=[];if(n&&A.push(z[E]<=0),s&&A.push(z[L]<=0,z[D]<=0),A.every((function(e){return e}))){_=T,k=!1;break}x.set(T,A)}if(k)for(var F=function(e){var t=y.find((function(t){var r=x.get(t);if(r)return r.slice(0,e).every((function(e){return e}))}));if(t)return _=t,"break"},I=m?3:1;I>0;I--){if("break"===F(I))break}t.placement!==_&&(t.modifiersData[i]._skip=!0,t.placement=_,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function Rr(e,t,r){return void 0===r&&(r={x:0,y:0}),{top:e.top-t.height-r.y,right:e.right-t.width+r.x,bottom:e.bottom-t.height+r.y,left:e.left-t.width-r.x}}function Nr(e){return[Dt,Ft,At,It].some((function(t){return e[t]>=0}))}const Hr={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,r=e.options,i=e.name,o=r.offset,n=void 0===o?[0,0]:o,a=Ut.reduce((function(e,r){return e[r]=function(e,t,r){var i=er(e),o=[It,Dt].indexOf(i)>=0?-1:1,n="function"==typeof r?r(Object.assign({},t,{placement:e})):r,a=n[0],s=n[1];return a=a||0,s=(s||0)*o,[It,Ft].indexOf(i)>=0?{x:s,y:a}:{x:a,y:s}}(r,t.rects,n),e}),{}),s=a[t.placement],l=s.x,c=s.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=c),t.modifiersData[i]=a}};const Vr={name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,r=e.options,i=e.name,o=r.mainAxis,n=void 0===o||o,a=r.altAxis,s=void 0!==a&&a,l=r.boundary,c=r.rootBoundary,d=r.altBoundary,h=r.padding,g=r.tether,u=void 0===g||g,m=r.tetherOffset,p=void 0===m?0:m,f=Fr(t,{boundary:l,rootBoundary:c,padding:h,altBoundary:d}),v=er(t.placement),b=br(t.placement),y=!b,w=ur(v),$="x"===w?"y":"x",x=t.modifiersData.popperOffsets,k=t.rects.reference,_=t.rects.popper,C="function"==typeof p?p(Object.assign({},t.rects,{placement:t.placement})):p,T="number"==typeof C?{mainAxis:C,altAxis:C}:Object.assign({mainAxis:0,altAxis:0},C),E=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,O={x:0,y:0};if(x){if(n){var S,M="y"===w?Dt:It,z="y"===w?At:Ft,L="y"===w?"height":"width",D=x[w],A=D+f[M],F=D-f[z],I=u?-_[L]/2:0,W=b===Nt?k[L]:_[L],R=b===Nt?-_[L]:-k[L],N=t.elements.arrow,H=u&&N?nr(N):{width:0,height:0},V=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},j=V[M],B=V[z],q=mr(0,k[L],H[L]),P=y?k[L]/2-I-q-j-T.mainAxis:W-q-j-T.mainAxis,U=y?-k[L]/2+I+q+B+T.mainAxis:R+q+B+T.mainAxis,K=t.elements.arrow&&gr(t.elements.arrow),Y=K?"y"===w?K.clientTop||0:K.clientLeft||0:0,Q=null!=(S=null==E?void 0:E[w])?S:0,G=D+U-Q,X=mr(u?rr(A,D+P-Q-Y):A,D,u?tr(F,G):F);x[w]=X,O[w]=X-D}if(s){var Z,J="x"===w?Dt:It,ee="x"===w?At:Ft,te=x[$],re="y"===$?"height":"width",ie=te+f[J],oe=te-f[ee],ne=-1!==[Dt,It].indexOf(v),ae=null!=(Z=null==E?void 0:E[$])?Z:0,se=ne?ie:te-k[re]-_[re]-ae+T.altAxis,le=ne?te+k[re]+_[re]-ae-T.altAxis:oe,ce=u&&ne?function(e,t,r){var i=mr(e,t,r);return i>r?r:i}(se,te,le):mr(u?se:ie,te,u?le:oe);x[$]=ce,O[$]=ce-te}t.modifiersData[i]=O}},requiresIfExists:["offset"]};function jr(e,t,r){void 0===r&&(r=!1);var i,o,n=Xt(t),a=Xt(t)&&function(e){var t=e.getBoundingClientRect(),r=ir(t.width)/e.offsetWidth||1,i=ir(t.height)/e.offsetHeight||1;return 1!==r||1!==i}(t),s=cr(t),l=or(e,a),c={scrollLeft:0,scrollTop:0},d={x:0,y:0};return(n||!n&&!r)&&(("body"!==Yt(t)||Or(s))&&(c=(i=t)!==Qt(i)&&Xt(i)?{scrollLeft:(o=i).scrollLeft,scrollTop:o.scrollTop}:Tr(i)),Xt(t)?((d=or(t,!0)).x+=t.clientLeft,d.y+=t.clientTop):s&&(d.x=Er(s))),{x:l.left+c.scrollLeft-d.x,y:l.top+c.scrollTop-d.y,width:l.width,height:l.height}}function Br(e){var t=new Map,r=new Set,i=[];function o(e){r.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach((function(e){if(!r.has(e)){var i=t.get(e);i&&o(i)}})),i.push(e)}return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){r.has(e.name)||o(e)})),i}var qr={placement:"bottom",modifiers:[],strategy:"absolute"};function Pr(){for(var e=arguments.length,t=new Array(e),r=0;r{},onAfterHide:()=>{},onTransitionEnd:()=>{}},r),this.isVisible=!1,this.popover.hidden=!0,this.popover.classList.remove(this.options.visibleClass),this.popover.addEventListener("transitionend",this.handleTransitionEnd)}handleTransitionEnd(e){e.target===this.options.transitionElement&&(this.options.onTransitionEnd.call(this,e),this.isVisible||this.popover.hidden||(this.popover.hidden=!0,this.popover.classList.remove(this.options.visibleClass),this.options.onAfterHide.call(this)))}destroy(){this.popover.removeEventListener("transitionend",this.handleTransitionEnd),this.popper&&(this.popper.destroy(),this.popper=null)}show(){this.isVisible=!0,this.popover.hidden=!1,requestAnimationFrame((()=>this.popover.classList.add(this.options.visibleClass))),this.popper&&this.popper.destroy(),this.popper=Kr(this.anchor,this.popover,{placement:this.options.placement,strategy:this.options.strategy,modifiers:[{name:"flip",options:{boundary:"viewport"}},{name:"offset",options:{offset:[this.options.skidding,this.options.distance]}}]}),this.popover.addEventListener("transitionend",(()=>this.options.onAfterShow.call(this)),{once:!0}),requestAnimationFrame((()=>this.popper.update()))}hide(){this.isVisible=!1,this.popover.classList.remove(this.options.visibleClass)}setOptions(e){this.options=Object.assign(this.options,e),this.isVisible?this.popover.classList.add(this.options.visibleClass):this.popover.classList.remove(this.options.visibleClass),this.popper&&(this.popper.setOptions({placement:this.options.placement,strategy:this.options.strategy}),requestAnimationFrame((()=>this.popper.update())))}}let Qr=0;const Gr=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grShow=fe(this,"gr-show",7),this.grAfterShow=fe(this,"gr-after-show",7),this.grHide=fe(this,"gr-hide",7),this.grAfterHide=fe(this,"gr-after-hide",7),this.componentId="dropdown-"+ ++Qr,this.isVisible=!1,this.open=!1,this.placement="bottom-start",this.closeOnSelect=!0,this.containingElement=void 0,this.distance=2,this.skidding=0,this.hoist=!1}handleOpenChange(){this.open?this.show():this.hide(),this.updateAccessibleTrigger()}handlePopoverOptionsChange(){this.popoverElement.setOptions({strategy:this.hoist?"fixed":"absolute",placement:this.placement,distance:this.distance,skidding:this.skidding})}connectedCallback(){this.containingElement||(this.containingElement=this.el),this.handleDocumentKeyDown=this.handleDocumentKeyDown.bind(this),this.handleDocumentMouseDown=this.handleDocumentMouseDown.bind(this),this.handleMenuItemActivate=this.handleMenuItemActivate.bind(this),this.handlePanelSelect=this.handlePanelSelect.bind(this),this.handleTriggerClick=this.handleTriggerClick.bind(this),this.handleTriggerKeyDown=this.handleTriggerKeyDown.bind(this),this.handleTriggerKeyUp=this.handleTriggerKeyUp.bind(this),this.handleTriggerSlotChange=this.handleTriggerSlotChange.bind(this)}componentDidLoad(){this.popoverElement=new Yr(this.trigger,this.positioner,{strategy:this.hoist?"fixed":"absolute",placement:this.placement,distance:this.distance,skidding:this.skidding,transitionElement:this.panel,onAfterHide:()=>this.grAfterHide.emit(),onAfterShow:()=>this.grAfterShow.emit(),onTransitionEnd:()=>{this.open||(this.panel.scrollTop=0)}}),this.open&&this.show()}disconnectedCallback(){this.hide(),this.popoverElement.destroy()}async show(){if(this.isVisible)return;this.grShow.emit().defaultPrevented?this.open=!1:(this.panel.addEventListener("gr-activate",this.handleMenuItemActivate),this.panel.addEventListener("gr-select",this.handlePanelSelect),document.addEventListener("keydown",this.handleDocumentKeyDown),document.addEventListener("mousedown",this.handleDocumentMouseDown),this.isVisible=!0,this.open=!0,this.popoverElement.show())}async hide(){if(!this.isVisible)return;this.grHide.emit().defaultPrevented?this.open=!0:(this.panel.removeEventListener("gr-activate",this.handleMenuItemActivate),this.panel.removeEventListener("gr-select",this.handlePanelSelect),document.addEventListener("keydown",this.handleDocumentKeyDown),document.removeEventListener("mousedown",this.handleDocumentMouseDown),this.isVisible=!1,this.open=!1,this.popoverElement.hide())}async focusOnTrigger(){const e=this.trigger.querySelector("slot").assignedElements({flatten:!0})[0];e&&("function"==typeof e.setFocus?e.setFocus():"function"==typeof e.focus&&e.focus())}getMenu(){return this.panel.querySelector("slot").assignedElements({flatten:!0}).filter((e=>"gr-menu"===e.tagName.toLowerCase()))[0]}handleDocumentKeyDown(e){var t;if("Escape"===e.key)return this.hide(),void this.focusOnTrigger();if("Tab"===e.key){if(this.open&&"gr-menu-item"===(null===(t=document.activeElement)||void 0===t?void 0:t.tagName.toLowerCase()))return e.preventDefault(),this.hide(),void this.focusOnTrigger();setTimeout((()=>{var e;const t=this.containingElement.getRootNode()instanceof ShadowRoot?null===(e=document.activeElement.shadowRoot)||void 0===e?void 0:e.activeElement:document.activeElement;(null==t?void 0:t.closest(this.containingElement.tagName.toLowerCase()))===this.containingElement||this.hide()}))}}handleDocumentMouseDown(e){e.composedPath().includes(this.containingElement)||this.hide()}handleMenuItemActivate(e){Mt(e.target,this.panel)}handlePanelSelect(e){const t=e.target;this.closeOnSelect&&"gr-menu"===t.tagName.toLowerCase()&&(this.hide(),this.focusOnTrigger())}handleTriggerClick(){this.open?this.hide():this.show()}handleTriggerKeyDown(e){const t=this.getMenu(),r=t?[...t.querySelectorAll("gr-menu-item")]:null,i=r[0],o=r[r.length-1];if("Escape"===e.key)return this.focusOnTrigger(),void this.hide();if([" ","Enter"].includes(e.key))return e.preventDefault(),void(this.open?this.hide():this.show());if(["ArrowDown","ArrowUp"].includes(e.key)){if(e.preventDefault(),this.open||this.show(),"ArrowDown"===e.key&&i)return void i.setFocus();if("ArrowUp"===e.key&&o)return void o.setFocus()}this.open&&t&&!["Tab","Shift","Meta","Ctrl","Alt"].includes(e.key)&&t.typeToSelect(e.key)}handleTriggerKeyUp(e){" "===e.key&&e.preventDefault()}handleTriggerSlotChange(){this.updateAccessibleTrigger()}updateAccessibleTrigger(){const e=this.trigger.querySelector("slot").assignedElements({flatten:!0}).map(Lt)[0];e&&(e.setAttribute("aria-haspopup","true"),e.setAttribute("aria-expanded",this.open?"true":"false"))}render(){return de(ge,{id:this.componentId,class:{"dropdown-open":this.open}},de("span",{class:"dropdown-trigger",ref:e=>this.trigger=e,onClick:this.handleTriggerClick,onKeyDown:this.handleTriggerKeyDown,onKeyUp:this.handleTriggerKeyUp},de("slot",{name:"trigger",onSlotchange:this.handleTriggerSlotChange})),de("div",{ref:e=>this.positioner=e,class:"dropdown-positioner"},de("div",{ref:e=>this.panel=e,class:"dropdown-panel",role:"menu","aria-hidden":this.open?"false":"true","aria-labelledby":this.componentId},de("slot",null))))}get el(){return this}static get watchers(){return{open:["handleOpenChange"],distance:["handlePopoverOptionsChange"],hoist:["handlePopoverOptionsChange"],placement:["handlePopoverOptionsChange"],skidding:["handlePopoverOptionsChange"]}}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{--panel-background-color:var(--gr-color-white);--panel-border-radius:var(--gr-border-radius-medium);--panel-border-color:var(--gr-panel-border-color);--panel-box-shadow:var(--gr-shadow-large);--transition:150ms opacity, 150ms transform;display:inline-block;position:relative;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.dropdown-trigger{display:block}.dropdown-positioner{position:absolute;z-index:var(--gr-z-index-dropdown)}.dropdown-panel{max-height:50vh;font-family:var(--gr-font-family);font-size:var(--gr-font-size-medium);font-weight:var(--gr-font-weight-normal);background-color:var(--panel-background-color);border:solid 1px var(--panel-border-color);border-radius:var(--panel-border-radius);box-shadow:var(--panel-box-shadow);opacity:0;overflow:auto;overscroll-behavior:none;pointer-events:none;transform:scale(0.9);transition:var(--transition)}.dropdown-positioner[data-popper-placement^=top] .dropdown-panel{transform-origin:bottom}.dropdown-positioner[data-popper-placement^=bottom] .dropdown-panel{transform-origin:top}.dropdown-positioner[data-popper-placement^=left] .dropdown-panel{transform-origin:right}.dropdown-positioner[data-popper-placement^=right] .dropdown-panel{transform-origin:left}.dropdown-positioner.popover-visible .dropdown-panel{opacity:1;transform:none;pointer-events:all}"}},[1,"gr-dropdown",{open:[1540],placement:[1],closeOnSelect:[4,"close-on-select"],containingElement:[1040],distance:[2],skidding:[2],hoist:[4],show:[64],hide:[64],focusOnTrigger:[64]}]);function Xr(){if("undefined"==typeof customElements)return;["gr-dropdown"].forEach((e=>{if("gr-dropdown"===e)customElements.get(e)||customElements.define(e,Gr)}))}Xr(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const Zr=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grSelect=fe(this,"gr-select",7),this.typeToSelectString=""}connectedCallback(){this.handleClick=this.handleClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}async typeToSelect(e){clearTimeout(this.typeToSelectTimeout),this.typeToSelectTimeout=setTimeout((()=>this.typeToSelectString=""),750),this.typeToSelectString+=e.toLowerCase();const t=this.getItems();for(const e of t){if(kt(e.shadowRoot.querySelector("slot:not([name])")).toLowerCase().trim().substring(0,this.typeToSelectString.length)===this.typeToSelectString){e.setFocus();break}}}getItems(){return[...this.menu.querySelector("slot").assignedElements({flatten:!0})].filter((e=>"gr-menu-item"===e.tagName.toLowerCase()&&!e.disabled))}getActiveItem(){return this.getItems().find((e=>e===document.activeElement))}setActiveItem(e){e.setFocus()}handleClick(e){const t=e.target.closest("gr-menu-item");t&&!t.disabled&&this.grSelect.emit({item:t})}handleKeyDown(e){if("Enter"===e.key){const t=this.getActiveItem();e.preventDefault(),t&&this.grSelect.emit({item:t})}if(" "===e.key&&e.preventDefault(),["ArrowDown","ArrowUp","Home","End"].includes(e.key)){const t=this.getItems(),r=this.getActiveItem();let i=t.indexOf(r);if(t.length)return e.preventDefault(),"ArrowDown"===e.key?i++:"ArrowUp"===e.key?i--:"Home"===e.key?i=0:"End"===e.key&&(i=t.length-1),i<0&&(i=0),i>t.length-1&&(i=t.length-1),void this.setActiveItem(t[i])}this.typeToSelect(e.key)}render(){return de("div",{ref:e=>this.menu=e,class:"menu",role:"menu",onClick:this.handleClick,onKeyDown:this.handleKeyDown},de("slot",null))}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{--padding-top:var(--gr-spacing-x-small);--padding-bottom:var(--gr-spacing-x-small);display:block;padding-top:var(--padding-top);padding-left:0;padding-right:0;padding-bottom:var(--padding-bottom);box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host:focus{outline:none}"}},[1,"gr-menu",{typeToSelect:[64]}]);function Jr(){if("undefined"==typeof customElements)return;["gr-menu"].forEach((e=>{if("gr-menu"===e)customElements.get(e)||customElements.define(e,Zr)}))}Jr(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const ei=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grClear=fe(this,"gr-clear",7),this.type="primary",this.size="medium",this.pill=!1,this.clearable=!1,this.truncate=!1,this.title=""}connectedCallback(){this.handleClearClick=this.handleClearClick.bind(this)}handleClearClick(){this.grClear.emit()}render(){return de(ge,{class:{[`tag-${this.type}`]:!0,[`tag-${this.size}`]:!0,"tag-pill":this.pill,"tag-clearable":this.clearable}},de("span",{class:"tag"},de("span",{class:{"tag-truncate":this.truncate},title:this.title},de("slot",null)),this.clearable&&de("gr-button",{variant:"plain",size:this.size,class:"tag-clear","aria-label":"clear",onClick:this.handleClearClick},de("svg",{slot:"icon-only",role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Close"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 368L144 144M368 144L144 368"})))))}static get style(){return":host{--height:calc(var(--gr-form-element-height-medium) * 0.8);--line-height:calc(var(--gr-form-element-height-medium) - 1px * 2);--border-radius:var(--gr-form-element-border-radius-medium);--border-width:1px;--border-style:solid;--padding-top:0;--padding-start:var(--gr-spacing-small);--padding-end:var(--gr-spacing-small);--padding-bottom:0;--font-size:var(--gr-form-element-font-size-medium);--background-color:rgba(var(--gr-color-primary-rgb), 0.05);--border-color:rgba(var(--gr-color-primary-rgb), 0.2);--color:var(--gr-color-primary-shade);--clear-color:var(--gr-color-primary);--clear-color-hover:var(--gr-color-primary-shade);--clear-margin-left:var(--gr-spacing-xx-small);--clear-margin-right:calc(-1 * var(--gr-spacing-xxx-small));display:inline-block;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host(.tag-success){--background-color:rgba(var(--gr-color-success-rgb), 0.05);--border-color:rgba(var(--gr-color-success-rgb), 0.2);--color:var(--gr-color-success-shade);--clear-color:var(--gr-color-success);--clear-color-hover:var(--gr-color-success-shade)}:host(.tag-info){--background-color:rgba(var(--gr-color-medium-rgb), 0.05);--border-color:rgba(var(--gr-color-medium-rgb), 0.2);--color:var(--gr-color-medium-shade);--clear-color:var(--gr-color-medium);--clear-color-hover:var(--gr-color-medium-shade)}:host(.tag-warning){--background-color:rgba(var(--gr-color-warning-rgb), 0.05);--border-color:rgba(var(--gr-color-warning-rgb), 0.2);--color:var(--gr-color-warning-shade);--clear-color:var(--gr-color-warning);--clear-color-hover:var(--gr-color-warning-shade)}:host(.tag-danger){--background-color:rgba(var(--gr-color-danger-rgb), 0.05);--border-color:rgba(var(--gr-color-danger-rgb), 0.2);--color:var(--gr-color-danger-shade);--clear-color:var(--gr-color-danger);--clear-color-hover:var(--gr-color-danger-shade)}:host(.tag-small){--font-size:var(--gr-form-element-font-size-small);--height:calc(var(--gr-form-element-height-small) * 0.8);--line-height:calc(var(--gr-form-element-height-small) - 1px * 2);--border-radius:var(--gr-form-element-border-radius-small);--padding-start:var(--gr-spacing-x-small);--padding-end:var(--gr-spacing-x-small);--clear-margin-left:var(--gr-spacing-xx-small);--clear-margin-right:calc(-1 * var(--gr-spacing-xxx-small))}:host(.tag-large){--font-size:var(--gr-form-element-font-size-large);--height:calc(var(--gr-form-element-height-large) * 0.8);--line-height:calc(var(--gr-form-element-height-large) - 1px * 2);--border-radius:var(--gr-form-element-border-radius-large);--padding:0 var(--gr-spacing-medium);--clear-margin-left:var(--gr-spacing-xx-small);--clear-margin-right:calc(-1 * var(--gr-spacing-x-small))}.tag{display:flex;align-items:center;border-style:var(--border-style);border-width:var(--border-width);border-radius:var(--border-radius);white-space:nowrap;user-select:none;cursor:default;font-family:var(--gr-font-family);font-size:var(--font-size);font-weight:var(--gr-font-weight-normal);height:var(--height);line-height:var(--line-height);padding-top:var(--padding-top);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-bottom:var(--padding-bottom);background-color:var(--background-color);border-color:var(--border-color);color:var(--color)}.tag-clear{--color:var(--clear-color);--color-hover:var(--clear-color-hover);--padding-start:0;--padding-end:0;margin-left:var(--clear-margin-left);margin-right:var(--clear-margin-right);--height:1em}.tag-clear svg{font-size:0.7em}.tag-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tag-clear svg{width:1.1em;height:1.1em}:host(.tag-pill) .tag{border-radius:var(--height)}"}},[1,"gr-tag",{type:[513],size:[513],pill:[516],clearable:[516],truncate:[516],title:[513]}]);function ti(){if("undefined"==typeof customElements)return;["gr-tag","gr-button","gr-spinner"].forEach((e=>{switch(e){case"gr-tag":customElements.get(e)||customElements.define(e,ei);break;case"gr-button":customElements.get(e)||St();break;case"gr-spinner":customElements.get(e)||Et()}}))}ti(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const ri="undefined"!=typeof HTMLElement?HTMLElement:class{};let ii=0;const oi=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grChange=fe(this,"gr-change",7),this.grFocus=fe(this,"gr-focus",7),this.grBlur=fe(this,"gr-blur",7),this.inputId="select-"+ ++ii,this.labelId=`select-label-${ii}`,this.helpTextId=`select-help-text-${ii}`,this.invalidTextId=`select-invalid-text-${ii}`,this.inheritedAttributes={},this.handleBlur=()=>{this.isOpen||(this.hasFocus=!1,this.grBlur.emit())},this.handleFocus=()=>{this.hasFocus||(this.hasFocus=!0,this.grFocus.emit())},this.hasFocus=!1,this.hasHelpTextSlot=!1,this.hasInvalidTextSlot=!1,this.hasLabelSlot=!1,this.isOpen=!1,this.items=[],this.displayLabel="",this.displayTags=[],this.multiple=!1,this.maxTagsVisible=3,this.disabled=!1,this.name="",this.placeholder="",this.size="medium",this.hoist=!1,this.value="",this.pill=!1,this.label="",this.requiredIndicator=!1,this.helpText="",this.invalidText="",this.invalid=!1,this.clearable=!1}handleDisabledChange(){this.disabled&&this.isOpen&&this.dropdown.hide()}handleLabelChange(){this.handleSlotChange()}handleMultipleChange(){const e=this.getValueAsArray();this.value=this.multiple?e:e[0]||"",this.syncItemsFromValue()}handleValueChange(){this.syncItemsFromValue(),this.grChange.emit()}connectedCallback(){this.handleClearClick=this.handleClearClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleLabelClick=this.handleLabelClick.bind(this),this.handleMenuHide=this.handleMenuHide.bind(this),this.handleMenuShow=this.handleMenuShow.bind(this),this.handleMenuSelect=this.handleMenuSelect.bind(this),this.handleSlotChange=this.handleSlotChange.bind(this),this.handleTagInteraction=this.handleTagInteraction.bind(this),this.el.shadowRoot.addEventListener("slotchange",this.handleSlotChange)}componentWillLoad(){this.handleSlotChange(),this.inheritedAttributes=Ct(this.el,["aria-label"])}componentDidLoad(){this.resizeObserver=new ResizeObserver((()=>this.resizeMenu())),this.reportDuplicateItemValues(),requestAnimationFrame((()=>this.syncItemsFromValue()))}disconnectedCallback(){this.el.shadowRoot.removeEventListener("slotchange",this.handleSlotChange)}async setFocus(){this.hasFocus=!0,this.grFocus.emit(),this.dropdown.focusOnTrigger()}getItemLabel(e){return kt(e.shadowRoot.querySelector("slot:not([name])"))}getItems(){return[...this.el.querySelectorAll("gr-menu-item")]}getValueAsArray(){return Array.isArray(this.value)?this.value:[this.value]}handleClearClick(e){e.stopPropagation(),this.value=this.multiple?[]:"",this.syncItemsFromValue()}handleKeyDown(e){const t=e.target,r=this.getItems(),i=r[0],o=r[r.length-1];if("gr-tag"!==t.tagName.toLowerCase())if("Tab"!==e.key){if(["ArrowDown","ArrowUp"].includes(e.key)){if(e.preventDefault(),this.isOpen||this.dropdown.show(),"ArrowDown"===e.key&&i)return void i.setFocus();if("ArrowUp"===e.key&&o)return void o.setFocus()}this.isOpen||1!==e.key.length||(e.stopPropagation(),e.preventDefault(),this.dropdown.show(),this.menu.typeToSelect(e.key))}else this.isOpen&&this.dropdown.hide()}handleLabelClick(){this.box.focus()}handleMenuSelect(e){const t=e.detail.item;this.multiple?this.value=this.value.includes(t.value)?this.value.filter((e=>e!==t.value)):[...this.value,t.value]:this.value=t.value,this.syncItemsFromValue()}handleMenuShow(e){this.disabled?e.preventDefault():(this.resizeMenu(),this.resizeObserver.observe(this.el),this.isOpen=!0)}handleMenuHide(){this.resizeObserver.unobserve(this.el),this.isOpen=!1,this.box.focus()}handleSlotChange(){this.hasHelpTextSlot=_t(this.el,"help-text"),this.hasInvalidTextSlot=_t(this.el,"invalid-text"),this.hasLabelSlot=_t(this.el,"label"),this.syncItemsFromValue(),this.reportDuplicateItemValues()}handleTagInteraction(e){e.composedPath().find((e=>{if(e instanceof ri)return e.classList.contains("tag-clear")}))&&e.stopPropagation()}reportDuplicateItemValues(){const e=this.getItems().map((e=>e.value)).filter(((e,t,r)=>r.indexOf(e)!==t));if(e.length)throw new Error('Duplicate value found on in : "'+e.join('", "')+'"')}resizeMenu(){this.menu.style.width=`${this.box.clientWidth}px`}syncItemsFromValue(){const e=this.getItems(),t=this.getValueAsArray();if(e.map((e=>e.checked=t.includes(e.value))),this.multiple){const r=[];if(t.map((t=>e.map((e=>e.value===t?r.push(e):null)))),this.displayTags=r.map((e=>de("gr-tag",{type:"info",size:this.size,pill:this.pill,clearable:!0,onClick:this.handleTagInteraction,onKeyDown:this.handleTagInteraction,"onGr-clear":t=>{t.stopPropagation(),this.disabled||(e.checked=!1,this.syncValueFromItems())}},this.getItemLabel(e)))),this.maxTagsVisible>0&&this.displayTags.length>this.maxTagsVisible){const e=this.displayTags.length;this.displayLabel="",this.displayTags=this.displayTags.slice(0,this.maxTagsVisible),this.displayTags.push(de("gr-tag",{type:"info",size:this.size,pill:this.pill},"+",e-this.maxTagsVisible))}}else{const r=e.filter((e=>e.value===t[0]))[0];this.displayLabel=r?this.getItemLabel(r):"",this.displayTags=[]}}syncValueFromItems(){const e=this.getItems().filter((e=>e.checked)).map((e=>e.value));this.multiple?this.value=this.value.filter((t=>e.includes(t))):this.value=e.length>0?e[0]:""}render(){var e;const t=this.multiple?this.value.length>0:""!==this.value,r=this.inheritedAttributes["aria-label"]?{"aria-label":this.inheritedAttributes["aria-label"]}:{"aria-labelledby":this.labelId};return((e,t,r,i)=>{let o=e.querySelector("input.aux-input");o||(o=e.ownerDocument.createElement("input"),o.type="hidden",o.classList.add("aux-input"),e.appendChild(o)),o.disabled=i,o.name=t,o.value=r||""})(this.el,this.name,ni(this.value),this.disabled),de(xt,{inputId:this.inputId,label:this.label,labelId:this.labelId,hasLabelSlot:this.hasLabelSlot,helpTextId:this.helpTextId,helpText:this.helpText,hasHelpTextSlot:this.hasHelpTextSlot,invalidTextId:this.invalidTextId,invalidText:this.invalidText,invalid:this.invalid,hasInvalidTextSlot:this.hasInvalidTextSlot,size:this.size,onLabelClick:this.handleLabelClick,requiredIndicator:this.requiredIndicator},de("gr-dropdown",{ref:e=>this.dropdown=e,hoist:this.hoist,closeOnSelect:!this.multiple,containingElement:this.el,class:{select:!0,"select-open":this.isOpen,"select-empty":0===(null===(e=this.value)||void 0===e?void 0:e.length),"select-focused":this.hasFocus,"select-clearable":this.clearable,"select-disabled":this.disabled,"select-multiple":this.multiple,"select-has-tags":this.multiple&&t,"select-placeholder-visible":""===this.displayLabel,[`select-${this.size}`]:!0,"select-pill":this.pill,"select-invalid":this.invalid},"onGr-show":this.handleMenuShow,"onGr-hide":this.handleMenuHide},de("div",Object.assign({slot:"trigger",ref:e=>this.box=e,id:this.inputId,class:"select-box",role:"combobox"},r,{"aria-describedby":this.invalid?this.invalidTextId:this.helpTextId,"aria-haspopup":"true","aria-expanded":this.isOpen?"true":"false","aria-invalid":this.invalid?"true":"false","aria-required":this.requiredIndicator?"true":"false",tabIndex:this.disabled?-1:0,onBlur:this.handleBlur,onFocus:this.handleFocus,onKeyDown:this.handleKeyDown}),de("div",{class:"select-label"},this.displayTags.length?de("span",{class:"select-tags"},this.displayTags):this.displayLabel||this.placeholder),this.clearable&&t&&de("button",{class:"select-clear",type:"button",onClick:this.handleClearClick,"aria-label":"clear",tabindex:"-1"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Close Circle"),de("path",{d:"M448 256c0-106-86-192-192-192S64 150 64 256s86 192 192 192 192-86 192-192z",fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32"}),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M320 320L192 192M192 320l128-128"}))),de("span",{class:"caret"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Chevron Down"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"M112 184l144 144 144-144"}))),de("input",{class:"select-hidden-select","aria-hidden":"true",value:t?"1":"",tabIndex:-1})),de("gr-menu",{ref:e=>this.menu=e,class:"select-menu","onGr-select":this.handleMenuSelect},de("slot",{onSlotchange:this.handleSlotChange}))))}get el(){return this}static get watchers(){return{disabled:["handleDisabledChange"],helpText:["handleLabelChange"],invalidText:["handleLabelChange"],label:["handleLabelChange"],multiple:["handleMultipleChange"],value:["handleValueChange"]}}static get style(){return".form-control .form-control-label{display:none}.form-control .form-control-help-text{display:none}.form-control .form-control-invalid-text{display:none}.form-control-has-label .form-control-label{display:flex;line-height:var(--gr-line-height-normal);color:var(--gr-form-element-label-color);margin-bottom:var(--gr-spacing-xxx-small)}.form-control-has-label.form-control-small .form-control-label{font-size:var(--gr-form-element-label-font-size-small)}.form-control-has-label.form-control-medium .form-control-label{font-size:var(--gr-form-element-label-font-size-medium)}.form-control-has-label.form-control-large .form-control-label{font-size:var(--gr-form-element-label-font-size-large)}.form-control-has-label .form-control-label .asterisk{margin-left:var(--gr-spacing-x-small);color:var(--gr-color-medium)}.form-control-has-label .form-control-label .asterisk svg{width:0.6em;height:0.6em;margin-bottom:var(--gr-spacing-xxx-small)}.form-control-has-help-text .form-control-help-text{display:block;line-height:var(--gr-line-height-normal);color:var(--gr-form-element-help-text-color);margin-top:var(--gr-spacing-xxx-small)}.form-control-has-help-text.form-control-small .form-control-help-text{font-size:var(--gr-form-element-help-text-font-size-small);min-height:1.625rem}.form-control-has-help-text.form-control-medium .form-control-help-text{font-size:var(--gr-form-element-help-text-font-size-medium);min-height:1.875rem}.form-control-has-help-text.form-control-large .form-control-help-text{font-size:var(--gr-form-element-help-text-font-size-large);min-height:2.125rem}.form-control-has-invalid-text .form-control-invalid-text{display:flex;margin-left:-2px;line-height:var(--gr-line-height-normal);color:var(--gr-form-element-invalid-text-color);margin-top:var(--gr-spacing-xxx-small)}.form-control-has-invalid-text .form-control-invalid-text .icon{margin-top:var(--gr-spacing-xxx-small);margin-right:var(--gr-spacing-xx-small)}.form-control-has-invalid-text .form-control-invalid-text .icon svg{width:1.4em;height:1.4em}.form-control-has-invalid-text.form-control-small .form-control-invalid-text{font-size:var(--gr-form-element-invalid-text-font-size-small);min-height:1.625rem}.form-control-has-invalid-text.form-control-medium .form-control-invalid-text{font-size:var(--gr-form-element-invalid-text-font-size-medium);min-height:1.875rem}.form-control-has-invalid-text.form-control-large .form-control-invalid-text{font-size:var(--gr-form-element-invalid-text-font-size-large);min-height:2.125rem}.gr-scroll-lock{overflow:hidden !important}:host{--font-size:var(--gr-form-element-font-size-medium);--font-weight:var(--gr-font-weight-normal);--background-color:var(--gr-color-white);--background-color-hover:var(--gr-color-white);--background-color-focus:var(--gr-color-white);--background-color-invalid:var(--gr-color-white);--background-color-invalid-hover:var(--gr-color-white);--border-radius:var(--gr-form-element-border-radius-small);--border-color:var(--gr-color-light-shade);--border-color-hover:var(--gr-color-medium);--border-color-focus:var(--gr-color-primary);--border-color-invalid:var(--gr-color-danger);--border-color-invalid-hover:var(--gr-color-danger-shade);--color:var(--gr-color-dark-tint);--placeholder-color:var(--gr-color-medium-tint);--min-height:var(--gr-form-element-height-medium);--label-margin-start:var(--gr-spacing-medium);--label-margin-end:var(--gr-spacing-medium);--clear-icon-margin-end:var(--gr-spacing-medium);--caret-margin-end:var(--gr-spacing-medium);--tags-padding-top:3px;--tags-padding-bottom:3px;--tags-margin-end:var(--gr-spacing-xx-small);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33);display:block;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.select-small{--font-size:var(--gr-form-element-font-size-small);--min-height:var(--gr-form-element-height-small);--label-margin-start:var(--gr-spacing-small);--label-margin-end:var(--gr-spacing-small);--clear-icon-margin-end:var(--gr-spacing-small);--caret-margin-end:var(--gr-spacing-small);--tags-padding-top:2px;--tags-padding-bottom:2px}.select-large{--font-size:var(--gr-form-element-font-size-large);--min-height:var(--gr-form-element-height-large);--label-margin-start:var(--gr-spacing-large);--label-margin-end:var(--gr-spacing-large);--clear-icon-margin-end:var(--gr-spacing-large);--caret-margin-end:var(--gr-spacing-large);--tags-padding-top:4px;--tags-padding-bottom:4px}.select{display:block}.select-box{display:inline-flex;align-items:center;justify-content:start;position:relative;width:100%;font-family:var(--gr-font-family);font-size:var(--font-size);font-weight:var(--font-weight);letter-spacing:normal;background-color:var(--background-color);border:solid 1px var(--border-color);border-radius:var(--border-radius);min-height:var(--min-height);color:var(--color);vertical-align:middle;overflow:hidden;transition:150ms color, 150ms border, 150ms box-shadow;cursor:pointer}.select.select-invalid:not(.select-disabled) .select-box{background-color:var(--background-color-invalid);border-color:var(--border-color-invalid)}.select.select-invalid:not(.select-disabled):not(.select-focused) .select-box:hover{background-color:var(--background-color-invalid-hover);border-color:var(--border-color-invalid-hover)}.select.select-invalid:not(.select-disabled) .select-box{background-color:var(--background-color-invalid);border-color:var(--border-color-invalid)}.select:not(.select-disabled) .select-box:hover{background-color:var(--background-color-hover);border-color:var(--border-color-hover)}.select.select-focused:not(.select-disabled) .select-box{outline:none;box-shadow:var(--focus-ring);border-color:var(--border-color-focus);background-color:var(--background-color-focus)}.select-disabled .select-box{opacity:0.5;cursor:not-allowed;outline:none}.select-disabled .select-tags,.select-disabled .select-clear{pointer-events:none}.select-label{flex:1 1 auto;display:flex;align-items:center;user-select:none;margin-top:0;margin-left:var(--label-margin-start);margin-right:var(--label-margin-end);margin-bottom:0;scrollbar-width:none;-ms-overflow-style:none;overflow-x:auto;overflow-y:hidden;white-space:nowrap}.select-label::-webkit-scrollbar{width:0;height:0}.select-has-tags .select-label{margin-left:0}.select-clear{display:inline-flex;align-items:center;font-size:inherit;color:var(--gr-color-medium);border:none;background:none;padding:0;transition:150ms color;cursor:pointer;margin-right:var(--clear-icon-margin-end)}.select-clear:hover{color:var(--gr-color-dark)}.select-clear:focus{outline:none}.select-clear svg{width:1.2em;height:1.2em;font-size:var(--font-size)}.caret{flex:0 0 auto;display:inline-flex;transition:250ms transform ease;margin-right:var(--caret-margin-end)}.caret svg{width:1em;height:1em;font-size:var(--font-size)}.select-open .caret{transform:rotate(-180deg)}.select-placeholder-visible .select-label{color:var(--placeholder-color)}.select-tags{display:inline-flex;align-items:center;flex-wrap:wrap;justify-content:left;margin-left:var(--gr-spacing-xx-small);padding-bottom:var(--tags-padding-bottom)}.select-tags gr-tag{padding-top:var(--tags-padding-top)}.select-tags gr-tag:not(:last-of-type){margin-right:var(--tags-margin-end)}.select-hidden-select{clip:rect(0 0 0 0);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px;position:absolute;top:0;left:0;width:100%;height:100%}.select-pill .select-box{border-radius:var(--min-height)}"}},[1,"gr-select",{multiple:[4],maxTagsVisible:[2,"max-tags-visible"],disabled:[4],name:[1],placeholder:[1],size:[1],hoist:[4],value:[1025],pill:[4],label:[1],requiredIndicator:[4,"required-indicator"],helpText:[1,"help-text"],invalidText:[1,"invalid-text"],invalid:[516],clearable:[4],hasFocus:[32],hasHelpTextSlot:[32],hasInvalidTextSlot:[32],hasLabelSlot:[32],isOpen:[32],items:[32],displayLabel:[32],displayTags:[32],setFocus:[64]}]),ni=e=>{if(null!=e)return Array.isArray(e)?e.join(","):e.toString()};!function(){if("undefined"==typeof customElements)return;["gr-select","gr-button","gr-dropdown","gr-menu","gr-spinner","gr-tag"].forEach((e=>{switch(e){case"gr-select":customElements.get(e)||customElements.define(e,oi);break;case"gr-button":customElements.get(e)||St();break;case"gr-dropdown":customElements.get(e)||Xr();break;case"gr-menu":customElements.get(e)||Jr();break;case"gr-spinner":customElements.get(e)||Et();break;case"gr-tag":customElements.get(e)||ti()}}))}();const ai=oi,si=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.hasFocus=!1,this.checked=!1,this.value="",this.disabled=!1}connectedCallback(){this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleMouseEnter=this.handleMouseEnter.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this)}async setFocus(e){this.el.focus(e)}async removeFocus(){this.el.blur()}handleBlur(){this.hasFocus=!1}handleFocus(){this.hasFocus=!0}handleMouseEnter(){this.setFocus()}handleMouseLeave(){this.removeFocus()}render(){return de(ge,{class:{"menu-item-checked":this.checked,"menu-item-disabled":this.disabled,"menu-item-focused":this.hasFocus},role:"menuitem","aria-disabled":this.disabled?"true":"false","aria-checked":this.checked?"true":"false",tabIndex:this.disabled?null:0,onFocus:this.handleFocus,onBlur:this.handleBlur,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave},de("span",{class:"checkmark"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Checkmark"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M416 128L192 384l-96-96"}))),de("span",{class:"start"},de("slot",{name:"start"})),de("span",{class:"label"},de("slot",null)),de("span",{class:"end"},de("slot",{name:"end"})))}get el(){return this}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{--line-height:var(--gr-line-height-normal);--background-color:transparent;--background-color-focused:var(--gr-color-primary);--color:var(--gr-color-dark);--color-focused:var(--gr-color-primary-contrast);--color-disabled:var(--gr-color-medium);--padding-top:var(--gr-spacing-xx-small);--padding-start:var(--gr-spacing-x-large);--padding-end:var(--gr-spacing-x-large);--padding-bottom:var(--gr-spacing-xx-small);--transition:background-color 150ms linear, color 150ms linear;position:relative;display:flex;align-items:stretch;font-family:var(--gr-font-family);font-size:var(--gr-font-size-medium);font-weight:var(--gr-font-weight-normal);line-height:var(--line-height);letter-spacing:var(--gr-letter-spacing-normal);text-align:left;background-color:var(--background-color);color:var(--color);padding-top:var(--padding-top);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-bottom:var(--padding-bottom);transition:var(--transition);user-select:none;white-space:nowrap;cursor:pointer;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host(.menu-item-focused:not(.menu-item-disabled)){outline:none;background-color:var(--background-color-focused);color:var(--color-focused)}:host(.menu-item-disabled){outline:none;color:var(--color-disabled);cursor:not-allowed}.checkmark{display:flex;position:absolute;left:0.5em;top:calc(50% - 0.5em);visibility:hidden;align-items:center;font-size:inherit}.checkmark svg{display:inline-block;width:1.1em;height:1.1em;contain:strict;fill:currentcolor;box-sizing:content-box !important}:host(.menu-item-checked) .checkmark{visibility:visible}.label{flex:1 1 auto}.start{flex:0 0 auto;display:flex;align-items:center}.start ::slotted(:last-child){margin-right:0.5em}.end{flex:0 0 auto;display:flex;align-items:center}.end ::slotted(:first-child){margin-left:0.5em}"}},[1,"gr-menu-item",{checked:[516],value:[513],disabled:[516],hasFocus:[32],setFocus:[64],removeFocus:[64]}]); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */!function(){if("undefined"==typeof customElements)return;["gr-menu-item"].forEach((e=>{if("gr-menu-item"===e)customElements.get(e)||customElements.define(e,si)}))}();const li={"gr-select":ai,"gr-menu-item":si};class ci extends(P(_)){constructor(){super(...arguments),this.value=null,this.multiple=!1,this.clearable=!1,this._refSelect=y()}reset(){this.value=null}_valueChangedHandler(e){const t=this._refSelect.value?.value;if(void 0!==t&&!l(this.value,t)){const e=null===this.value;this.value=t,e||w(this,"select:change",t)}}willUpdate(e){e.has("initialValue")&&this.initialValue&&!this.value&&(this.value=this.initialValue)}render(){return $` + ${this.options?.map((e=>$`${e.label}`))} + `}static get styles(){return k(':root, :host {\n --gr-color-primary: #1079b2;\n --gr-color-primary-rgb: 16, 121, 178;\n --gr-color-primary-contrast: #ffffff;\n --gr-color-primary-contrast-rgb: 255, 255, 255;\n --gr-color-primary-shade: #0d6696;\n --gr-color-primary-tint: #1499e1;\n --gr-color-secondary: #051f2c;\n --gr-color-secondary-rgb: 5, 31, 44;\n --gr-color-secondary-contrast: #ffffff;\n --gr-color-secondary-contrast-rgb: 255, 255, 255;\n --gr-color-secondary-shade: #000000;\n --gr-color-secondary-tint: #0a415c;\n --gr-color-tertiary: #0c4a6e;\n --gr-color-tertiary-rgb: 12, 74, 110;\n --gr-color-tertiary-contrast: #ffffff;\n --gr-color-tertiary-contrast-rgb: 255, 255, 255;\n --gr-color-tertiary-shade: #083249;\n --gr-color-tertiary-tint: #106393;\n --gr-color-success: #0fbe78;\n --gr-color-success-rgb: 15, 190, 120;\n --gr-color-success-contrast: #000000;\n --gr-color-success-contrast-rgb: 0, 0, 0;\n --gr-color-success-shade: #057f4e;\n --gr-color-success-tint: #12e28f;\n --gr-color-warning: #fbbc4e;\n --gr-color-warning-rgb: 251, 188, 78;\n --gr-color-warning-contrast: #051f2c;\n --gr-color-warning-contrast-rgb: 5, 31, 44;\n --gr-color-warning-shade: #9e6400;\n --gr-color-warning-tint: #fdd187;\n --gr-color-danger: #e60017;\n --gr-color-danger-rgb: 230, 0, 23;\n --gr-color-danger-contrast: #ffffff;\n --gr-color-danger-contrast-rgb: 255, 255, 255;\n --gr-color-danger-shade: #cc0014;\n --gr-color-danger-tint: #ff1f35;\n --gr-color-light: #f4f5f8;\n --gr-color-light-rgb: 244, 245, 248;\n --gr-color-light-contrast: #051f2c;\n --gr-color-light-contrast-rgb: 5, 31, 44;\n --gr-color-light-shade: #d7d8da;\n --gr-color-light-tint: #f9fafb;\n --gr-color-medium: #5e6c78;\n --gr-color-medium-rgb: 94, 108, 120;\n --gr-color-medium-contrast: #ffffff;\n --gr-color-medium-contrast-rgb: 255, 255, 255;\n --gr-color-medium-shade: #48535b;\n --gr-color-medium-tint: #81909c;\n --gr-color-dark: #02131b;\n --gr-color-dark-rgb: 2, 19, 27;\n --gr-color-dark-contrast: #ffffff;\n --gr-color-dark-contrast-rgb: 255, 255, 255;\n --gr-color-dark-shade: #000000;\n --gr-color-dark-tint: #222428;\n --gr-color-white: #ffffff;\n --gr-color-black: #000000;\n --gr-border-radius-small: 0.125rem;\n --gr-border-radius-medium: 0.25rem;\n --gr-border-radius-large: 0.5rem;\n --gr-border-radius-x-large: 1rem;\n --gr-border-width-small: 0.063rem;\n --gr-border-width-medium: 0.125rem;\n --gr-border-width-large: 0.188rem;\n --gr-shadow-x-small: 0 1px 0 #0d131e0d;\n --gr-shadow-small: 0 1px 2px #0d131e1a;\n --gr-shadow-medium: 0 2px 4px #0d131e1a;\n --gr-shadow-large: 0 2px 8px #0d131e1a;\n --gr-shadow-x-large: 0 4px 16px #0d131e1a;\n --gr-spacing-xxx-small: 0.125rem;\n --gr-spacing-xx-small: 0.25rem;\n --gr-spacing-x-small: 0.5rem;\n --gr-spacing-small: 0.75rem;\n --gr-spacing-medium: 1rem;\n --gr-spacing-large: 1.25rem;\n --gr-spacing-x-large: 1.75rem;\n --gr-spacing-xx-large: 2.25rem;\n --gr-spacing-xxx-large: 3rem;\n --gr-spacing-xxxx-large: 4.5rem;\n --gr-font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,\n sans-serif;\n --gr-letter-spacing-dense: -0.015em;\n --gr-letter-spacing-normal: normal;\n --gr-letter-spacing-loose: 0.075em;\n --gr-line-height-dense: 1.4;\n --gr-line-height-normal: 1.8;\n --gr-line-height-loose: 2.2;\n --gr-font-size-xx-small: 0.625rem;\n --gr-font-size-x-small: 0.75rem;\n --gr-font-size-small: 0.875rem;\n --gr-font-size-medium: 1rem;\n --gr-font-size-large: 1.25rem;\n --gr-font-size-x-large: 1.5rem;\n --gr-font-size-xx-large: 2.25rem;\n --gr-font-size-xxx-large: 3rem;\n --gr-font-size-xxxx-large: 4.5rem;\n --gr-font-weight-thin: 100;\n --gr-font-weight-extra-light: 200;\n --gr-font-weight-light: 300;\n --gr-font-weight-normal: 400;\n --gr-font-weight-medium: 500;\n --gr-font-weight-semi-bold: 600;\n --gr-font-weight-bold: 700;\n --gr-font-weight-extra-bold: 800;\n --gr-font-weight-black: 900;\n --gr-form-element-font-size-x-small: var(--gr-font-size-x-small);\n --gr-form-element-font-size-small: var(--gr-font-size-small);\n --gr-form-element-font-size-medium: var(--gr-font-size-medium);\n --gr-form-element-font-size-large: var(--gr-font-size-large);\n --gr-form-element-height-small: 2.188rem;\n --gr-form-element-height-medium: 3.125rem;\n --gr-form-element-height-large: 4.063rem;\n --gr-form-element-border-radius-small: var(--gr-border-radius-medium);\n --gr-form-element-border-radius-medium: var(--gr-border-radius-medium);\n --gr-form-element-border-radius-large: var(--gr-border-radius-medium);\n --gr-focus-ring-width: 2px;\n --gr-form-element-label-font-size-small: var(--gr-font-size-small);\n --gr-form-element-label-font-size-medium: var(--gr-font-size-medium);\n --gr-form-element-label-font-size-large: var(--gr-font-size-large);\n --gr-form-element-label-color: inherit;\n --gr-form-element-help-text-font-size-small: var(--gr-font-size-x-small);\n --gr-form-element-help-text-font-size-medium: var(--gr-font-size-small);\n --gr-form-element-help-text-font-size-large: var(--gr-font-size-medium);\n --gr-form-element-help-text-color: var(--gr-color-medium);\n --gr-form-element-invalid-text-font-size-small: var(--gr-font-size-x-small);\n --gr-form-element-invalid-text-font-size-medium: var(--gr-font-size-small);\n --gr-form-element-invalid-text-font-size-large: var(--gr-font-size-medium);\n --gr-form-element-invalid-text-color: var(--gr-color-danger);\n --gr-toggle-size: 1rem;\n --gr-panel-border-color: var(--gr-color-light-shade);\n --gr-z-index-dropdown: 900;\n}\n\n')}}ci.elementDefinitions={...li},f([v({attribute:!1,hasChanged:b})],ci.prototype,"options",void 0),f([v({attribute:!1,hasChanged:b})],ci.prototype,"value",void 0),f([v({attribute:!1,hasChanged:b})],ci.prototype,"initialValue",void 0),f([v({attribute:!0})],ci.prototype,"label",void 0),f([v({attribute:!0})],ci.prototype,"placeholder",void 0),f([v({attribute:!0,type:Boolean})],ci.prototype,"multiple",void 0),f([v({attribute:!0,type:Boolean})],ci.prototype,"clearable",void 0);let di=class extends(P(_)){constructor(){super(...arguments),this._mediaFilterController=new U(this),this._refMediaType=y(),this._refCamera=y(),this._refWhen=y(),this._refWhenFrom=y(),this._refWhenTo=y(),this._refWhat=y(),this._refWhere=y(),this._refFavorite=y(),this._refTags=y()}willUpdate(e){e.has("viewManagerEpoch")&&this._mediaFilterController.setViewManager(this.viewManagerEpoch?.manager??null),e.has("cameraManager")&&this.cameraManager&&(this._mediaFilterController.computeCameraOptions(this.cameraManager),this._mediaFilterController.computeMetadataOptions(this.cameraManager)),!e.get("viewManager")&&this.viewManagerEpoch&&this.cameraManager&&this._mediaFilterController.computeInitialDefaultsFromView(this.cameraManager)}render(){const e=async()=>{this.cameraManager&&this.viewManagerEpoch&&this.cardWideConfig&&await this._mediaFilterController.valueChangeHandler(this.cameraManager,this.cardWideConfig,{camera:this._refCamera.value?.value??void 0,mediaType:this._refMediaType.value?.value??void 0,when:{selected:this._refWhen.value?.value??void 0,from:this._refWhenFrom.value?.value,to:this._refWhenTo.value?.value},favorite:this._refFavorite.value?.value??void 0,where:this._refWhere.value?.value??void 0,what:this._refWhat.value?.value??void 0,tags:this._refTags.value?.value??void 0})},t=async t=>{"custom"===t&&this._refWhen.value?this._refWhenFrom.value?.value||this._refWhenTo.value?.value?this._refWhen.value.value=B.Custom:this._refWhen.value.reset():this._refWhen.value?.value!==B.Custom&&(this._refWhenFrom.value?.reset(),this._refWhenTo.value?.reset()),await e()};if(!this.cameraManager||!this.viewManagerEpoch)return;const r=this._mediaFilterController.getControlsToShow(this.cameraManager),o=this._mediaFilterController.getDefaults(),n=this._mediaFilterController.getWhatOptions(),a=this._mediaFilterController.getTagsOptions(),s=this._mediaFilterController.getWhereOptions();return $` e()} + > + +
+ t("selected")} + > + + t("custom")} + > + + t("custom")} + > + +
+ e()} + > + + ${r.events&&n.length?$` e()} + > + `:""} + ${r.events&&a.length?$` e()} + > + `:""} + ${r.events&&s.length?$` e()} + > + `:""} + ${r.favorites?$` + e()} + > + + `:""}`}static get styles(){return k(":host {\n display: flex;\n flex-direction: column;\n overflow: auto;\n scrollbar-width: none;\n -ms-overflow-style: none;\n height: 100%;\n width: 300px;\n margin: 5px;\n}\n\n/* Hide scrollbar for Chrome, Safari and Opera */\n:host::-webkit-scrollbar {\n display: none;\n}\n\nfrigate-card-select {\n padding: 5px;\n}\n\ndiv.when {\n display: inline-flex;\n align-items: flex-end;\n}\n\ndiv.when frigate-card-select {\n flex: 1;\n}\n\ndiv.when frigate-card-date-picker {\n padding-bottom: 5px;\n transition: width 0.5s ease-in-out;\n}\n\ndiv.when frigate-card-date-picker {\n color: var(--secondary-color);\n}\n\ndiv.when frigate-card-date-picker.selected {\n color: var(--primary-color);\n}\n\ndiv.when frigate-card-date-picker.hidden {\n width: 0px;\n}")}};di.elementDefinitions={"frigate-card-select":ci,"frigate-card-date-picker":R},f([v({attribute:!1})],di.prototype,"hass",void 0),f([v({attribute:!1})],di.prototype,"cameraManager",void 0),f([v({attribute:!1})],di.prototype,"viewManagerEpoch",void 0),f([v({attribute:!1})],di.prototype,"cardWideConfig",void 0),di=f([C("frigate-card-media-filter")],di);const hi={closed:"mdi:filter-cog-outline",open:"mdi:filter-cog"};let gi=class extends _{render(){const e=this.viewManagerEpoch?.manager.getView();if(this.hass&&e?.isGalleryView()&&this.cameraManager&&this.cardWideConfig)return $` + + ${this.galleryConfig&&"none"!==this.galleryConfig.controls.filter.mode?$` + `:""} + + + + `}static get styles(){return k(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\nfrigate-card-surround-basic {\n max-height: 110dvh;\n}")}};f([v({attribute:!1})],gi.prototype,"hass",void 0),f([v({attribute:!1})],gi.prototype,"viewManagerEpoch",void 0),f([v({attribute:!1})],gi.prototype,"galleryConfig",void 0),f([v({attribute:!1})],gi.prototype,"cameraManager",void 0),f([v({attribute:!1})],gi.prototype,"cardWideConfig",void 0),gi=f([C("frigate-card-gallery")],gi);let ui=class extends _{constructor(){super(),this._refLoaderBottom=y(),this._refSelected=y(),this._showLoaderBottom=!0,this._showLoaderTop=!1,this._boundWheelHandler=this._wheelHandler.bind(this),this._boundTouchStartHandler=this._touchStartHandler.bind(this),this._boundTouchEndHandler=this._touchEndHandler.bind(this),this._throttleExtendGalleryLater=O(this._extendGallery.bind(this),500,{leading:!0,trailing:!1}),this._touchScrollYPosition=null,this._resizeObserver=new ResizeObserver(this._resizeHandler.bind(this)),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}_touchStartHandler(e){1===e.touches.length?this._touchScrollYPosition=e.touches[0].screenY:this._touchScrollYPosition=null}async _touchEndHandler(e){!this.scrollTop&&1===e.changedTouches.length&&this._touchScrollYPosition&&e.changedTouches[0].screenY>this._touchScrollYPosition&&await this._extendLater(),this._touchScrollYPosition=null}async _wheelHandler(e){!this.scrollTop&&e.deltaY<0&&await this._extendLater()}async _extendLater(){const e=new Date;this._showLoaderTop=!0,await this._throttleExtendGalleryLater("later",!1);const t=(new Date).getTime()-e.getTime();t<500&&await S(.5-t/1e3),this._showLoaderTop=!1}connectedCallback(){super.connectedCallback(),this._resizeObserver.observe(this),this.addEventListener("wheel",this._boundWheelHandler,{passive:!0}),this.addEventListener("touchstart",this._boundTouchStartHandler,{passive:!0}),this.addEventListener("touchend",this._boundTouchEndHandler),this.requestUpdate()}disconnectedCallback(){this.removeEventListener("wheel",this._boundWheelHandler),this.removeEventListener("touchstart",this._boundTouchStartHandler),this.removeEventListener("touchend",this._boundTouchEndHandler),this._resizeObserver.disconnect(),this._intersectionObserver.disconnect(),super.disconnectedCallback()}_setColumnCount(){const e=this.galleryConfig?.controls.thumbnails.size??M.media_gallery.controls.thumbnails.size,t=this.galleryConfig?.controls.thumbnails.show_details?Math.max(1,Math.floor(this.clientWidth/z)):Math.max(1,Math.ceil(this.clientWidth/e));this.style.setProperty("--frigate-card-gallery-columns",String(t))}_resizeHandler(){this._setColumnCount()}async _intersectionHandler(e){e.every((e=>!e.isIntersecting))||(this._showLoaderBottom=!1,await this._extendGallery("earlier"))}async _extendGallery(e,t=!0){const r=this.viewManagerEpoch?.manager.getView();if(!this.cameraManager||!this.hass||!r)return;const i=r.query,n=i?.getQueries()??null,s=r.queryResults?.getResults();if(!i||!n||!s)return;let l;try{l=await this.cameraManager.extendMediaQueries(n,s,e,{useCache:t})}catch(e){return void d(e)}if(l){const e=c.areEventQueries(i)?new o(l.queries):c.areRecordingQueries(i)?new a(l.queries):null;e&&this.viewManagerEpoch?.manager.setViewByParameters({baseView:r,params:{query:e,queryResults:new L({results:l.results}).selectResultIfFound((e=>e===r.queryResults?.getSelectedResult()))}})}}willUpdate(e){if(e.has("galleryConfig")&&(this.galleryConfig?.controls.thumbnails.show_details?this.setAttribute("details",""):this.removeAttribute("details"),this._setColumnCount(),this.galleryConfig?.controls.thumbnails.size&&this.style.setProperty("--frigate-card-thumbnail-size",`${this.galleryConfig.controls.thumbnails.size}px`)),e.has("viewManagerEpoch")){this._showLoaderBottom=!0;const e=this.viewManagerEpoch?.manager.getView(),t=this.viewManagerEpoch?.oldView;this._media&&t?.queryResults?.getResults()===e?.queryResults?.getResults()||(this._media=[...e?.queryResults?.getResults()??[]].reverse())}}render(){if(!this._media||!this.hass)return $``;const e=this.viewManagerEpoch?.manager.getView();if(!e?.queryResults||0===e.queryResults.getResultsCount()){const t=!!e?.context?.loading?.query;return D({type:"info",message:i(t?"error.awaiting_media":"common.no_media"),icon:"mdi:multimedia",dotdotdot:t})}const t=e.queryResults.getSelectedResult();return $`
+ ${this._showLoaderTop?$`${A({cardWideConfig:this.cardWideConfig,classes:{top:!0},size:"small"})}`:""} + ${this._media.map(((r,i)=>$`{this._media&&this.viewManagerEpoch?.manager.setViewByParameters({params:{view:"media",queryResults:e.queryResults?.clone().selectIndex(this._media.length-i-1)}}),F(t)}} + > + `))} + ${this._showLoaderBottom?$`${A({cardWideConfig:this.cardWideConfig,componentRef:this._refLoaderBottom})}`:""} +
`}updated(e){this._refLoaderBottom.value&&(this._intersectionObserver.disconnect(),this._intersectionObserver.observe(this._refLoaderBottom.value)),this.updateComplete.then((()=>{e.has("viewManagerEpoch")&&!e.get("viewManagerEpoch")&&this._refSelected.value&&this._refSelected.value.scrollIntoView({block:"center"})}))}static get styles(){return k(":host {\n width: 100%;\n height: 100%;\n display: block;\n overflow: auto;\n -ms-overflow-style: none;\n scrollbar-width: none;\n --frigate-card-gallery-gap: 3px;\n --frigate-card-gallery-columns: 4;\n}\n\n.grid {\n display: grid;\n grid-template-columns: repeat(var(--frigate-card-gallery-columns), minmax(0, 1fr));\n grid-auto-rows: min-content;\n gap: var(--frigate-card-gallery-gap);\n}\n\n:host::-webkit-scrollbar {\n display: none;\n}\n\nfrigate-card-thumbnail {\n height: 100%;\n max-height: var(--frigate-card-thumbnail-size);\n}\n\nfrigate-card-thumbnail:not([details]) {\n width: 100%;\n}\n\nfrigate-card-thumbnail.selected {\n border: 4px solid var(--accent-color);\n border-radius: calc(var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px)) + 4px);\n}\n\nfrigate-card-progress-indicator.top {\n grid-column: 1/-1;\n}")}};f([v({attribute:!1})],ui.prototype,"hass",void 0),f([v({attribute:!1})],ui.prototype,"viewManagerEpoch",void 0),f([v({attribute:!1})],ui.prototype,"galleryConfig",void 0),f([v({attribute:!1})],ui.prototype,"cameraManager",void 0),f([v({attribute:!1})],ui.prototype,"cardWideConfig",void 0),f([E()],ui.prototype,"_showLoaderBottom",void 0),f([E()],ui.prototype,"_showLoaderTop",void 0),ui=f([C("frigate-card-gallery-core")],ui);export{gi as FrigateCardGallery,ui as FrigateCardGalleryCore}; diff --git a/config/www/community/frigate-hass-card/gallery-9024cb87.js.gz b/config/www/community/frigate-hass-card/gallery-9024cb87.js.gz new file mode 100644 index 00000000..f3f5ea84 Binary files /dev/null and b/config/www/community/frigate-hass-card/gallery-9024cb87.js.gz differ diff --git a/config/www/community/frigate-hass-card/gallery-bf3892f1.js b/config/www/community/frigate-hass-card/gallery-bf3892f1.js new file mode 100644 index 00000000..88ab9687 --- /dev/null +++ b/config/www/community/frigate-hass-card/gallery-bf3892f1.js @@ -0,0 +1,184 @@ +import{c$ as e,d0 as t,d1 as r,l as i,d2 as o,d3 as n,d4 as a,d5 as s,i as l,d6 as c,d7 as d,k as h,d8 as g,d9 as u,da as m,db as p,_ as f,n as v,cR as b,cM as y,dc as w,x as $,cQ as x,r as k,a as _,t as C,e as T,b as E,dd as O,de as S,cI as M,df as z,dg as L,cP as D,dh as A,cX as F}from"./card-320adb66.js";import{e as I}from"./endOfDay-086a6977.js";import{p as W}from"./parse-7f4a6e12.js";import{F as R}from"./date-picker-576d50a8.js";function N(t){const r=e(t),i=r.getMonth();return r.setFullYear(r.getFullYear(),i+1,0),r.setHours(23,59,59,999),r}function H(){const e=new Date,t=e.getFullYear(),r=e.getMonth(),i=e.getDate(),o=new Date(0);return o.setFullYear(t,r,i-1),o.setHours(23,59,59,999),o}function V(){const e=new Date,t=e.getFullYear(),r=e.getMonth(),i=e.getDate(),o=new Date(0);return o.setFullYear(t,r,i-1),o.setHours(0,0,0,0),o}var j,B,P; +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +function q(e){return class extends e{createRenderRoot(){const e=this.constructor,{registry:t,elementDefinitions:i,shadowRootOptions:o}=e;i&&!t&&(e.registry=new CustomElementRegistry,Object.entries(i).forEach((([t,r])=>e.registry.define(t,r))));const n=this.renderOptions.creationScope=this.attachShadow({...o,customElements:e.registry});return r(n,this.constructor.elementStyles),n}}}!function(e){e.Favorite="favorite",e.NotFavorite="not-favorite"}(j||(j={})),function(e){e.Today="today",e.Yesterday="yesterday",e.PastWeek="past-week",e.PastMonth="past-month",e.Custom="custom"}(B||(B={})),function(e){e.Clips="clips",e.Snapshots="snapshots",e.Recordings="recordings"}(P||(P={}));class U{constructor(e){this._cameraOptions=[],this._whenOptions=[],this._metaDataWhenOptions=[],this._whatOptions=[],this._whereOptions=[],this._tagsOptions=[],this._defaults=null,this._viewManager=null,this._host=e,this._favoriteOptions=[{value:j.Favorite,label:i("media_filter.favorite")},{value:j.NotFavorite,label:i("media_filter.not_favorite")}],this._mediaTypeOptions=[{value:P.Clips,label:i("media_filter.media_types.clips")},{value:P.Snapshots,label:i("media_filter.media_types.snapshots")},{value:P.Recordings,label:i("media_filter.media_types.recordings")}],this._staticWhenOptions=[{value:B.Today,label:i("media_filter.whens.today")},{value:B.Yesterday,label:i("media_filter.whens.yesterday")},{value:B.PastWeek,label:i("media_filter.whens.past_week")},{value:B.PastMonth,label:i("media_filter.whens.past_month")},{value:B.Custom,label:i("media_filter.whens.custom")}],this._computeWhenOptions()}getMediaTypeOptions(){return this._mediaTypeOptions}getCameraOptions(){return this._cameraOptions}getWhenOptions(){return this._whenOptions}getWhatOptions(){return this._whatOptions}getWhereOptions(){return this._whereOptions}getTagsOptions(){return this._tagsOptions}getFavoriteOptions(){return this._favoriteOptions}getDefaults(){return this._defaults}setViewManager(e){this._viewManager=e}async valueChangeHandler(e,t,r,i){const s=e=>e&&Array.isArray(e)&&e.length&&!e.includes("")?new Set([...e]):null,l=s(r.camera)??this._getAllCameraIDs(e);if(!l.size||!r.mediaType)return;const c=this._getWhen(r.when),d=r.favorite?r.favorite===j.Favorite:null,h=t.performance?.features.media_chunk_size;if(r.mediaType===P.Clips||r.mediaType===P.Snapshots){const e=s(r.where),t=s(r.what),i=s(r.tags),a=new o([{type:n.Event,cameraIDs:l,...i&&{tags:i},...t&&{what:t},...e&&{where:e},...null!==d&&{favorite:d},...c&&{...c.start&&{start:c.start},...c.end&&{end:c.end}},...h&&{limit:h},...r.mediaType===P.Clips&&{hasClip:!0},...r.mediaType===P.Snapshots&&{hasSnapshot:!0}}]);this._viewManager?.setViewByParametersWithExistingQuery({params:{query:a,...1===l.size&&{camera:[...l][0]},view:r.mediaType===P.Clips?"clips":"snapshots"}})}else{const e=new a([{type:n.Recording,cameraIDs:l,...h&&{limit:h},...c&&{...c.start&&{start:c.start},...c.end&&{end:c.end}},...null!==d&&{favorite:d}}]);this._viewManager?.setViewByParametersWithExistingQuery({params:{query:e,...1===l.size&&{camera:[...l][0]},view:"recordings"}})}this._host.requestUpdate()}_getAllCameraIDs(e){return e.getStore().getCameraIDsWithCapability({anyCapabilities:["clips","snapshots","recordings"]})}computeInitialDefaultsFromView(e){const t=this._viewManager?.getView(),r=t?.query?.getQueries(),i=this._getAllCameraIDs(e);if(!t||!r||!i.size)return;let o,n,a,d,h,g;1!==s(r.map((e=>e.cameraIDs)),l).length||l(r[0].cameraIDs,i)||(n=[...r[0].cameraIDs]); +/* istanbul ignore else: the else path cannot be reached -- @preserve */ +if(1===s(r.map((e=>e.favorite)),l).length&&void 0!==r[0].favorite&&(h=r[0].favorite?j.Favorite:j.NotFavorite),c.areEventQueries(t.query)){const e=t.query.getQueries(); +/* istanbul ignore if: the if path cannot be reached -- @preserve */if(!e)return;const r=s(e.map((e=>e.hasClip)),l),i=s(e.map((e=>e.hasSnapshot)),l);1===r.length&&1===i.length&&(o=r[0]?P.Clips:i[0]?P.Snapshots:void 0);1===s(e.map((e=>e.what)),l).length&&e[0].what?.size&&(a=[...e[0].what]);1===s(e.map((e=>e.where)),l).length&&e[0].where?.size&&(d=[...e[0].where]);1===s(e.map((e=>e.tags)),l).length&&e[0].tags?.size&&(g=[...e[0].tags])}else c.areRecordingQueries(t.query)&&(o=P.Recordings);this._defaults={...o&&{mediaType:o},...n&&{cameraIDs:n},...a&&{what:a},...d&&{where:d},...void 0!==h&&{favorite:h},...g&&{tags:g}}}computeCameraOptions(e){this._cameraOptions=[...this._getAllCameraIDs(e)].map((t=>({value:t,label:e.getCameraMetadata(t)?.title??t})))}async computeMetadataOptions(e){let t=null;try{t=await e.getMediaMetadata()}catch(e){d(e)}if(t){if(t.what&&(this._whatOptions=[...t.what].sort().map((e=>({value:e,label:h(e)})))),t.where&&(this._whereOptions=[...t.where].sort().map((e=>({value:e,label:h(e)})))),t.tags&&(this._tagsOptions=[...t.tags].sort().map((e=>({value:e,label:h(e)})))),t.days){const e=new Set;[...t.days].forEach((t=>{e.add(t.substring(0,7))}));const r=[];e.forEach((e=>{r.push(W(e,"yyyy-MM",new Date))})),this._metaDataWhenOptions=g(r,(e=>e.getTime()),"desc").map((e=>({label:u(e,"MMMM yyyy"),value:this._dateRangeToString({start:e,end:N(e)})}))),this._computeWhenOptions()}this._host.requestUpdate()}}getControlsToShow(e){const t=this._viewManager?.getView(),r=c.areEventQueries(t?.query),i=c.areRecordingQueries(t?.query),o=e.getAggregateCameraCapabilities();return{events:r,recordings:i,favorites:r?o?.has("favorite-events"):!!i&&o?.has("favorite-recordings")}}_computeWhenOptions(){this._whenOptions=[...this._staticWhenOptions,...this._metaDataWhenOptions]}_dateRangeToString(e){return`${m(e.start)},${m(e.end)}`}_stringToDateRange(e){const t=e.split(",");return{start:W(t[0],"yyyy-MM-dd",new Date),end:I(W(t[1],"yyyy-MM-dd",new Date))}}_getWhen(e){if(e.from||e.to)return{...e.from&&{start:e.from},...e.to&&{end:e.to}};if(!e.selected||Array.isArray(e.selected))return null;const r=new Date;switch(e.selected){case B.Custom:return null;case B.Today:return{start:t(Date.now()),end:I(Date.now())};case B.Yesterday:return{start:V(),end:H()};case B.PastWeek:return{start:t(p(r,{days:7})),end:I(r)};case B.PastMonth:return{start:t(p(r,{months:1})),end:I(r)};default:return this._stringToDateRange(e.selected)}}}const K=!0,Y=!0,Q=!0,G=!1,X=!1;let Z,J,ee,te=!1,re=!1,ie=!1,oe=!1,ne=null,ae=!1;const se="http://www.w3.org/1999/xlink",le={},ce=e=>"object"===(e=typeof e)||"function"===e;const de=(e,t,...r)=>{let i=null,o=null,n=null,a=!1,s=!1;const l=[],c=t=>{for(let r=0;re[t])).join(" "))}}if("function"==typeof e)return e(null===t?{}:t,l,ue);const d=he(e,null);return d.$attrs$=t,l.length>0&&(d.$children$=l),d.$key$=o,d.$name$=n,d},he=(e,t)=>{const r={$flags$:0,$tag$:e,$text$:t,$elm$:null,$children$:null,$attrs$:null,$key$:null,$name$:null};return r},ge={},ue={forEach:(e,t)=>e.map(me).forEach(t),map:(e,t)=>e.map(me).map(t).map(pe)},me=e=>({vattrs:e.$attrs$,vchildren:e.$children$,vkey:e.$key$,vname:e.$name$,vtag:e.$tag$,vtext:e.$text$}),pe=e=>{if("function"==typeof e.vtag){const t=Object.assign({},e.vattrs);return e.vkey&&(t.key=e.vkey),e.vname&&(t.name=e.vname),de(e.vtag,t,...e.vchildren||[])}const t=he(e.vtag,e.vtext);return t.$attrs$=e.vattrs,t.$children$=e.vchildren,t.$key$=e.vkey,t.$name$=e.vname,t},fe=(e,t,r)=>{const i=e;return{emit:e=>ve(i,t,{bubbles:!!(4&r),composed:!!(2&r),cancelable:!!(1&r),detail:e})}},ve=(e,t,r)=>{const i=ht.ce(t,r);return e.dispatchEvent(i),i},be=new WeakMap,ye=e=>{const t=e.$cmpMeta$,r=e.$hostElement$,i=t.$flags$,o=(t.$tagName$,()=>{}),n=((e,t,r,i)=>{var o;let n=we(t,r);const a=at.get(n);if(e=11===e.nodeType?e:ct,a)if("string"==typeof a){e=e.head||e;let t,r=be.get(e);if(r||be.set(e,r=new Set),!r.has(n)){{t=ct.createElement("style"),t.innerHTML=a;const r=null!==(o=ht.$nonce$)&&void 0!==o?o:function(e){var t,r,i;return null!==(i=null===(r=null===(t=e.head)||void 0===t?void 0:t.querySelector('meta[name="csp-nonce"]'))||void 0===r?void 0:r.getAttribute("content"))&&void 0!==i?i:void 0}(ct);null!=r&&t.setAttribute("nonce",r),e.insertBefore(t,e.querySelector("link"))}r&&r.add(n)}}else e.adoptedStyleSheets.includes(a)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,a]);return n})(r.shadowRoot?r.shadowRoot:r.getRootNode(),t,e.$modeName$);10&i&&(r["s-sc"]=n,r.classList.add(n+"-h"),2&i&&r.classList.add(n+"-s")),o()},we=(e,t)=>"sc-"+(t&&32&e.$flags$?e.$tagName$+"-"+t:e.$tagName$),$e=(e,t,r,i,o,n)=>{if(r!==i){let a=ot(e,t),s=t.toLowerCase();if("class"===t){const t=e.classList,o=ke(r),n=ke(i);t.remove(...o.filter((e=>e&&!n.includes(e)))),t.add(...n.filter((e=>e&&!o.includes(e))))}else if("style"===t){for(const t in r)i&&null!=i[t]||(t.includes("-")?e.style.removeProperty(t):e.style[t]="");for(const t in i)r&&i[t]===r[t]||(t.includes("-")?e.style.setProperty(t,i[t]):e.style[t]=i[t])}else if("key"===t);else if("ref"===t)i&&i(e);else if(e.__lookupSetter__(t)||"o"!==t[0]||"n"!==t[1]){const l=ce(i);if((a||l&&null!==i)&&!o)try{if(e.tagName.includes("-"))e[t]=i;else{const o=null==i?"":i;"list"===t?a=!1:null!=r&&e[t]==o||(e[t]=o)}}catch(e){}let c=!1;s!==(s=s.replace(/^xlink\:?/,""))&&(t=s,c=!0),null==i||!1===i?!1===i&&""!==e.getAttribute(t)||(c?e.removeAttributeNS(se,t):e.removeAttribute(t)):(!a||4&n||o)&&!l&&(i=!0===i?"":i,c?e.setAttributeNS(se,t,i):e.setAttribute(t,i))}else t="-"===t[2]?t.slice(3):ot(lt,s)?s.slice(2):s[2]+t.slice(3),r&&ht.rel(e,t,r,!1),i&&ht.ael(e,t,i,!1)}},xe=/\s/,ke=e=>e?e.split(xe):[],_e=(e,t,r,i)=>{const o=11===t.$elm$.nodeType&&t.$elm$.host?t.$elm$.host:t.$elm$,n=e&&e.$attrs$||le,a=t.$attrs$||le;for(i in n)i in a||$e(o,i,n[i],void 0,r,t.$flags$);for(i in a)$e(o,i,n[i],a[i],r,t.$flags$)},Ce=(e,t,r,i)=>{const o=t.$children$[r];let n,a,s,l=0;if(te||(ie=!0,"slot"===o.$tag$&&(Z&&i.classList.add(Z+"-s"),o.$flags$|=o.$children$?2:1)),null!==o.$text$)n=o.$elm$=ct.createTextNode(o.$text$);else if(1&o.$flags$)n=o.$elm$=ct.createTextNode("");else{if(oe||(oe="svg"===o.$tag$),n=o.$elm$=ct.createElementNS(oe?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",2&o.$flags$?"slot-fb":o.$tag$),oe&&"foreignObject"===o.$tag$&&(oe=!1),_e(null,o,oe),null!=Z&&n["s-si"]!==Z&&n.classList.add(n["s-si"]=Z),o.$children$)for(l=0;l{ht.$flags$|=1;const r=e.childNodes;for(let e=r.length-1;e>=0;e--){const i=r[e];i["s-hn"]!==ee&&i["s-ol"]&&(ze(i).insertBefore(i,Me(i)),i["s-ol"].remove(),i["s-ol"]=void 0,ie=!0),t&&Te(i,t)}ht.$flags$&=-2},Ee=(e,t,r,i,o,n)=>{let a,s=e["s-cr"]&&e["s-cr"].parentNode||e;for(s.shadowRoot&&s.tagName===ee&&(s=s.shadowRoot);o<=n;++o)i[o]&&(a=Ce(null,r,o,e),a&&(i[o].$elm$=a,s.insertBefore(a,Me(t))))},Oe=(e,t,r,i,o)=>{for(;t<=r;++t)(i=e[t])&&(o=i.$elm$,We(i),re=!0,o["s-ol"]?o["s-ol"].remove():Te(o,!0),o.remove())},Se=(e,t)=>e.$tag$===t.$tag$&&("slot"===e.$tag$?e.$name$===t.$name$:e.$key$===t.$key$),Me=e=>e&&e["s-ol"]||e,ze=e=>(e["s-ol"]?e["s-ol"]:e).parentNode,Le=(e,t)=>{const r=t.$elm$=e.$elm$,i=e.$children$,o=t.$children$,n=t.$tag$,a=t.$text$;let s;null===a?(oe="svg"===n||"foreignObject"!==n&&oe,"slot"===n||_e(e,t,oe),null!==i&&null!==o?((e,t,r,i)=>{let o,n,a=0,s=0,l=0,c=0,d=t.length-1,h=t[0],g=t[d],u=i.length-1,m=i[0],p=i[u];for(;a<=d&&s<=u;)if(null==h)h=t[++a];else if(null==g)g=t[--d];else if(null==m)m=i[++s];else if(null==p)p=i[--u];else if(Se(h,m))Le(h,m),h=t[++a],m=i[++s];else if(Se(g,p))Le(g,p),g=t[--d],p=i[--u];else if(Se(h,p))"slot"!==h.$tag$&&"slot"!==p.$tag$||Te(h.$elm$.parentNode,!1),Le(h,p),e.insertBefore(h.$elm$,g.$elm$.nextSibling),h=t[++a],p=i[--u];else if(Se(g,m))"slot"!==h.$tag$&&"slot"!==p.$tag$||Te(g.$elm$.parentNode,!1),Le(g,m),e.insertBefore(g.$elm$,h.$elm$),g=t[--d],m=i[++s];else{for(l=-1,c=a;c<=d;++c)if(t[c]&&null!==t[c].$key$&&t[c].$key$===m.$key$){l=c;break}l>=0?(n=t[l],n.$tag$!==m.$tag$?o=Ce(t&&t[s],r,l,e):(Le(n,m),t[l]=void 0,o=n.$elm$),m=i[++s]):(o=Ce(t&&t[s],r,s,e),m=i[++s]),o&&ze(h.$elm$).insertBefore(o,Me(h.$elm$))}a>d?Ee(e,null==i[u+1]?null:i[u+1].$elm$,r,i,s,u):s>u&&Oe(t,a,d)})(r,i,t,o):null!==o?(null!==e.$text$&&(r.textContent=""),Ee(r,null,t,o,0,o.length-1)):null!==i&&Oe(i,0,i.length-1),oe&&"svg"===n&&(oe=!1)):(s=r["s-cr"])?s.parentNode.textContent=a:e.$text$!==a&&(r.data=a)},De=e=>{const t=e.childNodes;let r,i,o,n,a,s;for(i=0,o=t.length;i{let t,r,i,o,n,a,s=0;const l=e.childNodes,c=l.length;for(;s=0;a--)r=i[a],r["s-cn"]||r["s-nr"]||r["s-hn"]===t["s-hn"]||(Ie(r,o)?(n=Ae.find((e=>e.$nodeToRelocate$===r)),re=!0,r["s-sn"]=r["s-sn"]||o,n?n.$slotRefNode$=t:Ae.push({$slotRefNode$:t,$nodeToRelocate$:r}),r["s-sr"]&&Ae.map((e=>{Ie(e.$nodeToRelocate$,r["s-sn"])&&(n=Ae.find((e=>e.$nodeToRelocate$===r)),n&&!e.$slotRefNode$&&(e.$slotRefNode$=n.$slotRefNode$))}))):Ae.some((e=>e.$nodeToRelocate$===r))||Ae.push({$nodeToRelocate$:r}));1===t.nodeType&&Fe(t)}},Ie=(e,t)=>1===e.nodeType?null===e.getAttribute("slot")&&""===t||e.getAttribute("slot")===t:e["s-sn"]===t||""===t,We=e=>{e.$attrs$&&e.$attrs$.ref&&e.$attrs$.ref(null),e.$children$&&e.$children$.map(We)},Re=(e,t)=>{const r=e.$hostElement$,i=e.$cmpMeta$,o=e.$vnode$||he(null,null),n=(a=t)&&a.$tag$===ge?t:de(null,null,t);var a;if(ee=r.tagName,i.$attrsToReflect$&&(n.$attrs$=n.$attrs$||{},i.$attrsToReflect$.map((([e,t])=>n.$attrs$[t]=r[e]))),n.$tag$=null,n.$flags$|=4,e.$vnode$=n,n.$elm$=o.$elm$=r.shadowRoot||r,Z=r["s-sc"],J=r["s-cr"],te=!!(1&i.$flags$),re=!1,Le(o,n),ht.$flags$|=1,ie){let e,t,r,i,o,a;Fe(n.$elm$);let s=0;for(;s{e.$flags$|=16,e.$ancestorComponent$;return $t((()=>He(e,t)))},He=(e,t)=>{const r=e.$hostElement$,i=(e.$cmpMeta$.$tagName$,()=>{}),o=r;let n;return n=Pe(o,t?"componentWillLoad":"componentWillUpdate"),n=qe(n,(()=>Pe(o,"componentWillRender"))),i(),qe(n,(()=>Ve(e,o,t)))},Ve=async(e,t,r)=>{const i=e.$hostElement$,o=(e.$cmpMeta$.$tagName$,()=>{});i["s-rc"],r&&ye(e);const n=(e.$cmpMeta$.$tagName$,()=>{});je(e,t,i),n(),o(),Be(e)},je=(e,t,r)=>{try{ne=t,t=t.render&&t.render(),e.$flags$&=-17,e.$flags$|=2,(K||Y)&&(Q||Y)&&(G||Re(e,t))}catch(t){nt(t,e.$hostElement$)}return ne=null,null},Be=e=>{e.$cmpMeta$.$tagName$;const t=()=>{},r=e.$hostElement$;e.$ancestorComponent$,Pe(r,"componentDidRender"),64&e.$flags$?(Pe(r,"componentDidUpdate"),t()):(e.$flags$|=64,Pe(r,"componentDidLoad"),t())},Pe=(e,t,r)=>{if(e&&e[t])try{return e[t](r)}catch(e){nt(e)}},qe=(e,t)=>e&&e.then?e.then(t):t(),Ue=(e,t,r,i)=>{const o=rt(e),n=e,a=o.$instanceValues$.get(t),s=o.$flags$,l=n;var c,d;c=r,d=i.$members$[t][0],r=null==c||ce(c)?c:4&d?"false"!==c&&(""===c||!!c):2&d?parseFloat(c):1&d?String(c):c;const h=Number.isNaN(a)&&Number.isNaN(r);if(r!==a&&!h){if(o.$instanceValues$.set(t,r),i.$watchers$&&128&s){const e=i.$watchers$[t];e&&e.map((e=>{try{l[e](r,a,t)}catch(e){nt(e,n)}}))}if(2==(18&s)){if(l.componentShouldUpdate&&!1===l.componentShouldUpdate(r,a,t))return;Ne(o,!1)}}},Ke=(e,t,r)=>{if(t.$members$){e.watchers&&(t.$watchers$=e.watchers);const r=Object.entries(t.$members$),i=e.prototype;r.map((([e,[r]])=>{(31&r||32&r)&&Object.defineProperty(i,e,{get(){return t=e,rt(this).$instanceValues$.get(t);var t},set(r){Ue(this,e,r,t)},configurable:!0,enumerable:!0})}));{const o=new Map;i.attributeChangedCallback=function(e,t,r){ht.jmp((()=>{const t=o.get(e);if(this.hasOwnProperty(t))r=this[t],delete this[t];else if(i.hasOwnProperty(t)&&"number"==typeof this[t]&&this[t]==r)return;this[t]=(null!==r||"boolean"!=typeof this[t])&&r}))},e.observedAttributes=r.filter((([e,t])=>15&t[0])).map((([e,r])=>{const i=r[1]||e;return o.set(i,e),512&r[0]&&t.$attrsToReflect$.push([e,i]),i}))}}return e},Ye=async(e,t,r,i,o)=>{if(!(32&t.$flags$)&&(o=e.constructor,t.$flags$|=32,customElements.whenDefined(r.$tagName$).then((()=>t.$flags$|=128)),o.style)){let i=o.style;"string"!=typeof i&&(i=i[t.$modeName$=(e=>st.map((t=>t(e))).find((e=>!!e)))(e)]);const n=we(r,t.$modeName$);if(!at.has(n)){const e=(r.$tagName$,()=>{});((e,t,r)=>{let i=at.get(e);mt&&r?(i=i||new CSSStyleSheet,"string"==typeof i?i=t:i.replaceSync(t)):i=t,at.set(e,i)})(n,i,!!(1&r.$flags$)),e()}}t.$ancestorComponent$;Ne(t,!0)},Qe=e=>{const t=e["s-cr"]=ct.createComment("");t["s-cn"]=!0,e.insertBefore(t,e.firstChild)},Ge=(e,t)=>{const r={$flags$:t[0],$tagName$:t[1]};r.$members$=t[2],r.$listeners$=t[3],r.$watchers$=e.$watchers$,r.$attrsToReflect$=[],!gt&&1&r.$flags$&&(r.$flags$|=8);const i=e.prototype.connectedCallback,o=e.prototype.disconnectedCallback;return Object.assign(e.prototype,{__registerHost(){it(this,r)},connectedCallback(){(e=>{if(!(1&ht.$flags$)){const t=rt(e),r=t.$cmpMeta$,i=(r.$tagName$,()=>{});1&t.$flags$?(Xe(e,t,r.$listeners$),t.$lazyInstance$):(t.$flags$|=1,12&r.$flags$&&Qe(e),r.$members$&&Object.entries(r.$members$).map((([t,[r]])=>{if(31&r&&e.hasOwnProperty(t)){const r=e[t];delete e[t],e[t]=r}})),Ye(e,t,r)),i()}})(this),i&&i.call(this)},disconnectedCallback(){(e=>{if(!(1&ht.$flags$)){const t=rt(e);t.$rmListeners$&&(t.$rmListeners$.map((e=>e())),t.$rmListeners$=void 0)}})(this),o&&o.call(this)},__attachShadow(){gt?this.attachShadow({mode:"open",delegatesFocus:!!(16&r.$flags$)}):this.shadowRoot=this}}),e.is=r.$tagName$,Ke(e,r)},Xe=(e,t,r,i)=>{r&&r.map((([r,i,o])=>{const n=Je(e,r),a=Ze(t,o),s=et(r);ht.ael(n,i,a,s),(t.$rmListeners$=t.$rmListeners$||[]).push((()=>ht.rel(n,i,a,s)))}))},Ze=(e,t)=>r=>{try{X||e.$hostElement$[t](r)}catch(e){nt(e)}},Je=(e,t)=>4&t?ct:8&t?lt:16&t?ct.body:e,et=e=>ut?{passive:!!(1&e),capture:!!(2&e)}:!!(2&e),tt=new WeakMap,rt=e=>tt.get(e),it=(e,t)=>{const r={$flags$:0,$hostElement$:e,$cmpMeta$:t,$instanceValues$:new Map};return Xe(e,r,t.$listeners$),tt.set(e,r)},ot=(e,t)=>t in e,nt=(e,t)=>(0,console.error)(e,t),at=new Map,st=[],lt="undefined"!=typeof window?window:{},ct=lt.document||{head:{}},dt=lt.HTMLElement||class{},ht={$flags$:0,$resourcesUrl$:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,r,i)=>e.addEventListener(t,r,i),rel:(e,t,r,i)=>e.removeEventListener(t,r,i),ce:(e,t)=>new CustomEvent(e,t)},gt=!0,ut=(()=>{let e=!1;try{ct.addEventListener("e",null,Object.defineProperty({},"passive",{get(){e=!0}}))}catch(e){}return e})(),mt=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync}catch(e){}return!1})(),pt=[],ft=[],vt=(e,t)=>r=>{e.push(r),ae||(ae=!0,t&&4&ht.$flags$?wt(yt):ht.raf(yt))},bt=e=>{for(let t=0;t{bt(pt),bt(ft),(ae=pt.length>0)&&ht.raf(yt)},wt=e=>{return Promise.resolve(t).then(e);var t},$t=vt(ft,!0),xt=(e,t)=>{const r=!!e.label||e.hasLabelSlot,i=!!e.helpText||e.hasHelpTextSlot,o=!!e.invalidText||e.hasInvalidTextSlot,n=!e.invalid,a=!!e.invalid;return de("div",{class:{"form-control":!0,[`form-control-${e.size}`]:!0,"form-control-has-label":r,"form-control-has-help-text":i,"form-control-has-invalid-text":o}},de("label",{id:e.labelId,class:"form-control-label",htmlFor:e.inputId,"aria-hidden":r?"false":"true",onClick:e.onLabelClick},de("slot",{name:"label"},e.label),e.requiredIndicator&&de("div",{class:"asterisk"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 1200 1200"},de("path",{fill:"currentColor",d:"M489.838 29.354v443.603L68.032 335.894 0 545.285l421.829 137.086-260.743 358.876 178.219 129.398L600.048 811.84l260.673 358.806 178.146-129.398-260.766-358.783L1200 545.379l-68.032-209.403-421.899 137.07V29.443H489.84l-.002-.089z"})))),de("div",{class:"form-control-input"},t),n&&de("div",{id:e.helpTextId,class:"form-control-help-text","aria-hidden":i?"false":"true"},de("slot",{name:"help-text"},e.helpText)),a&&de("div",{id:e.invalidTextId,class:"form-control-invalid-text","aria-hidden":o?"false":"true"},de("div",{class:"icon"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Alert Circle"),de("path",{d:"M256,48C141.31,48,48,141.31,48,256s93.31,208,208,208,208-93.31,208-208S370.69,48,256,48Zm0,319.91a20,20,0,1,1,20-20A20,20,0,0,1,256,367.91Zm21.72-201.15-5.74,122a16,16,0,0,1-32,0l-5.74-121.94v-.05a21.74,21.74,0,1,1,43.44,0Z",fill:"currentColor"}))),de("div",{class:"text"},de("slot",{name:"invalid-text"},e.invalidText))))}; +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +function kt(e){const t=e?e.assignedNodes({flatten:!0}):[];let r="";return[...t].map((e=>{e.nodeType===Node.TEXT_NODE&&(r+=e.textContent)})),r}function _t(e,t){return t?null!==e.querySelector(`[slot="${t}"]`):[...e.childNodes].some((e=>{if(e.nodeType===e.TEXT_NODE&&""!==e.textContent.trim())return!0;if(e.nodeType===e.ELEMENT_NODE){if(!e.hasAttribute("slot"))return!0}return!1}))} +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */const Ct=(e,t=[])=>{const r={};return t.forEach((t=>{if(e.hasAttribute(t)){null!==e.getAttribute(t)&&(r[t]=e.getAttribute(t)),e.removeAttribute(t)}})),r},Tt=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow()}render(){return de("span",{class:"spinner","aria-busy":"true","aria-live":"polite"})}static get style(){return":host{--track-color:var(--gr-color-light-shade);--indicator-color:var(--gr-color-primary);--stroke-width:2px;display:inline-flex;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.spinner{display:inline-block;width:1em;height:1em;border-radius:50%;border:solid var(--stroke-width) var(--track-color);border-top-color:var(--indicator-color);border-right-color:var(--indicator-color);animation:1s linear infinite spin}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}"}},[1,"gr-spinner"]);function Et(){if("undefined"==typeof customElements)return;["gr-spinner"].forEach((e=>{if("gr-spinner"===e)customElements.get(e)||customElements.define(e,Tt)}))}Et(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const Ot=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grFocus=fe(this,"gr-focus",7),this.grBlur=fe(this,"gr-blur",7),this.inheritedAttributes={},this.handleClick=e=>{if("button"!==this.type){const t=this.el.closest("form");if(t){e.preventDefault();const r=document.createElement("button");r.type=this.type,r.style.display="none",t.appendChild(r),r.click(),r.remove()}}},this.onFocus=()=>{this.grFocus.emit()},this.onBlur=()=>{this.grBlur.emit()},this.variant="default",this.disabled=!1,this.loading=!1,this.size="medium",this.caret=!1,this.pill=!1,this.expand=void 0,this.circle=!1,this.href=void 0,this.target=void 0,this.rel=void 0,this.type="button"}componentWillLoad(){this.inheritedAttributes=Ct(this.el,["aria-label","tabindex","title"])}async setFocus(e){this.button.focus(e)}async removeFocus(){this.button.blur()}render(){const{rel:e,target:t,href:r,variant:i,size:o,expand:n,type:a,inheritedAttributes:s,disabled:l}=this,c=void 0===r?"button":"a",d="button"===c?{type:a}:{href:r,rel:e,target:t};return de(ge,{onClick:this.handleClick,"aria-disabled":l?"true":null,class:{[`button-${i}`]:!0,[`button-${o}`]:!0,[`button-${n}`]:void 0!==n,"button-caret":this.caret,"button-circle":this.circle,"button-pill":this.pill,"button-disabled":l,"button-loading":this.loading}},de(c,Object.assign({ref:e=>this.button=e},d,{class:"button-native",disabled:l,onFocus:this.onFocus,onBlur:this.onBlur},s),de("span",{class:"button-inner"},de("slot",{name:"icon-only"}),de("slot",{name:"start"}),de("slot",null),de("slot",{name:"end"}),this.caret&&de("span",{class:"caret"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Chevron Down"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"M112 184l144 144 144-144"})))),this.loading&&de("gr-spinner",null)))}get el(){return this}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{display:inline-block;width:auto;font-family:var(--gr-font-family);font-weight:var(--gr-font-weight-medium);font-size:var(--gr-form-element-font-size-medium);font-kerning:none;user-select:none;vertical-align:top;vertical-align:-webkit-baseline-middle;pointer-events:auto;--height:var(--gr-form-element-height-medium);--border-radius:var(--gr-form-element-border-radius-medium);--border-width:1px;--border-style:solid;--background:transparent;--background-hover:transparent;--background-focus:transparent;--color:var(--gr-color-dark-tint);--color-hover:var(--gr-color-dark-tint);--color-focus:var(--gr-color-dark-tint);--border-color:var(--gr-color-light-shade);--border-color-hover:var(--gr-color-medium);--border-color-focus:var(--gr-color-primary);--padding-top:0;--padding-start:var(--gr-spacing-medium);--padding-end:var(--gr-spacing-medium);--padding-bottom:0;--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33);--shadow:none;--transition:background-color 150ms linear, opacity 150ms linear, border 150ms linear, color 150ms linear}:host(.button-disabled){pointer-events:none;opacity:0.5}:host(.button-primary){--border-color:var(--gr-color-primary);--background:var(--gr-color-primary);--color:var(--gr-color-primary-contrast);--border-color-hover:var(--gr-color-primary-shade);--background-hover:var(--gr-color-primary-shade);--color-hover:var(--gr-color-primary-contrast);--border-color-focus:var(--gr-color-primary);--background-focus:var(--gr-color-primary-shade);--color-focus:var(--gr-color-primary-contrast);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33)}:host(.button-secondary){--border-color:var(--gr-color-light-shade);--background:transparent;--color:var(--gr-color-primary);--border-color-hover:var(--gr-color-primary);--background-hover:transparent;--color-hover:var(--gr-color-primary);--border-color-focus:var(--gr-color-primary);--background-focus:transparent;--color-focus:var(--gr-color-primary);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33)}:host(.button-danger){--border-color:var(--gr-color-danger);--background:transparent;--color:var(--gr-color-danger);--border-color-hover:var(--gr-color-danger);--background-hover:var(--gr-color-danger);--color-hover:var(--gr-color-danger-contrast);--border-color-focus:var(--gr-color-danger);--background-focus:var(--gr-color-danger);--color-focus:var(--gr-color-danger-contrast);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-danger-rgb), 0.33)}:host(.button-plain){--border-color:transparent;--background:transparent;--color:var(--gr-color-primary);--border-color-hover:transparent;--background-hover:transparent;--color-hover:var(--gr-color-primary-shade);--border-color-focus:transparent;--background-focus:transparent;--color-focus:var(--gr-color-primary-shade);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33)}:host(.button-small){--padding-start:var(--gr-spacing-small);--padding-end:var(--gr-spacing-small);--border-radius:var(--gr-form-element-border-radius-small);--height:var(--gr-form-element-height-small);font-size:var(--gr-form-element-font-size-small)}:host(.button-large){--padding-start:var(--gr-spacing-large);--padding-end:var(--gr-spacing-large);--border-radius:var(--gr-form-element-border-radius-large);--height:var(--gr-form-element-height-large);font-size:var(--gr-form-element-font-size-large)}:host(.button-block){display:block}:host(.button-block) .button-native{margin-left:0;margin-right:0;display:block;width:100%;clear:both;contain:content}:host(.button-block) .button-native::after{clear:both}:host(.button-full){display:block}:host(.button-full) .button-native{margin-left:0;margin-right:0;display:block;width:100%;contain:content;border-radius:0;border-right-width:0;border-left-width:0}.button-native{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:block;position:relative;padding-top:var(--padding-top);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-bottom:var(--padding-bottom);width:100%;height:var(--height);transition:var(--transition);border-radius:var(--border-radius);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);color:var(--color);box-shadow:var(--shadow);line-height:1;cursor:pointer;z-index:0;text-decoration:none;box-sizing:border-box}.button-native::-moz-focus-inner{border:0}.button-native:focus{outline:none;box-shadow:var(--focus-ring);border-color:var(--border-color-focus);background-color:var(--background-focus);color:var(--color-focus)}.button-native *,.button-native *:before,.button-native *:after{box-sizing:inherit}.button-inner{display:flex;position:relative;flex-flow:row nowrap;flex-shrink:0;align-items:center;justify-content:center;width:100%;height:100%;z-index:1}:host(.button-circle) .button-native{padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;border-radius:50%;width:var(--height)}@media (any-hover: hover){.button-native:hover{color:var(--color-hover);background:var(--background-hover);border-color:var(--border-color-hover)}}:host(.button-caret) .caret{display:flex;align-items:center;margin-left:0.3em}:host(.button-caret) .caret svg{width:1em;height:1em}:host(.button-pill) .button-native{border-radius:var(--height)}::slotted(*){pointer-events:none}::slotted([slot=start]){margin-top:0;margin-left:-0.3em;margin-right:0.3em;margin-bottom:0}::slotted([slot=end]){margin-top:0;margin-left:0.3em;margin-right:-0.2em;margin-bottom:0}::slotted([slot=icon-only]){font-size:1.4em;pointer-events:none}:host(.button-loading){position:relative;pointer-events:none}:host(.button-loading) .caret{visibility:hidden}:host(.button-loading) slot[name=start],:host(.button-loading) slot[name=end],:host(.button-loading) slot[name=icon-only],:host(.button-loading) slot:not([name]){visibility:hidden}:host(.button-loading) gr-spinner{--indicator-color:currentColor;position:absolute;height:1em;width:1em;top:calc(50% - 0.5em);left:calc(50% - 0.5em)}@media not all and (min-resolution: 0.001dpcm){@supports (-webkit-appearance: none) and (stroke-color: transparent){:host([type=button]),:host([type=reset]),:host([type=submit]){-webkit-appearance:none !important}}}"}},[1,"gr-button",{variant:[513],disabled:[516],loading:[516],size:[513],caret:[4],pill:[516],expand:[513],circle:[516],href:[1],target:[1],rel:[1],type:[1],setFocus:[64],removeFocus:[64]}]);function St(){if("undefined"==typeof customElements)return;["gr-button","gr-spinner"].forEach((e=>{switch(e){case"gr-button":customElements.get(e)||customElements.define(e,Ot);break;case"gr-spinner":customElements.get(e)||Et()}}))}function Mt(e,t,r="vertical",i="smooth"){const o= +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +function(e,t){return{top:Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top),left:Math.round(e.getBoundingClientRect().left-t.getBoundingClientRect().left)}}(e,t),n=o.top+t.scrollTop,a=o.left+t.scrollLeft,s=t.scrollLeft,l=t.scrollLeft+t.offsetWidth,c=t.scrollTop,d=t.scrollTop+t.offsetHeight;"horizontal"!==r&&"both"!==r||(al&&t.scrollTo({left:a-t.offsetWidth+e.clientWidth,behavior:i})),"vertical"!==r&&"both"!==r||(nd&&t.scrollTo({top:n-t.offsetHeight+e.clientHeight,behavior:i}))} +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */function zt(e){return e.tabIndex>-1}function Lt(e){if(zt(e))return e;if(e.shadowRoot){const t=[...e.shadowRoot.children].find(zt);if(t)return t}return e.children?[...e.children].map(Lt)[0]:null}St();var Dt="top",At="bottom",Ft="right",It="left",Wt="auto",Rt=[Dt,At,Ft,It],Nt="start",Ht="end",Vt="clippingParents",jt="viewport",Bt="popper",Pt="reference",qt=Rt.reduce((function(e,t){return e.concat([t+"-"+Nt,t+"-"+Ht])}),[]),Ut=[].concat(Rt,[Wt]).reduce((function(e,t){return e.concat([t,t+"-"+Nt,t+"-"+Ht])}),[]),Kt=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function Yt(e){return e?(e.nodeName||"").toLowerCase():null}function Qt(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Gt(e){return e instanceof Qt(e).Element||e instanceof Element}function Xt(e){return e instanceof Qt(e).HTMLElement||e instanceof HTMLElement}function Zt(e){return"undefined"!=typeof ShadowRoot&&(e instanceof Qt(e).ShadowRoot||e instanceof ShadowRoot)}const Jt={name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach((function(e){var r=t.styles[e]||{},i=t.attributes[e]||{},o=t.elements[e];Xt(o)&&Yt(o)&&(Object.assign(o.style,r),Object.keys(i).forEach((function(e){var t=i[e];!1===t?o.removeAttribute(e):o.setAttribute(e,!0===t?"":t)})))}))},effect:function(e){var t=e.state,r={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,r.popper),t.styles=r,t.elements.arrow&&Object.assign(t.elements.arrow.style,r.arrow),function(){Object.keys(t.elements).forEach((function(e){var i=t.elements[e],o=t.attributes[e]||{},n=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:r[e]).reduce((function(e,t){return e[t]="",e}),{});Xt(i)&&Yt(i)&&(Object.assign(i.style,n),Object.keys(o).forEach((function(e){i.removeAttribute(e)})))}))}},requires:["computeStyles"]};function er(e){return e.split("-")[0]}var tr=Math.max,rr=Math.min,ir=Math.round;function or(e,t){void 0===t&&(t=!1);var r=e.getBoundingClientRect(),i=1,o=1;if(Xt(e)&&t){var n=e.offsetHeight,a=e.offsetWidth;a>0&&(i=ir(r.width)/a||1),n>0&&(o=ir(r.height)/n||1)}return{width:r.width/i,height:r.height/o,top:r.top/o,right:r.right/i,bottom:r.bottom/o,left:r.left/i,x:r.left/i,y:r.top/o}}function nr(e){var t=or(e),r=e.offsetWidth,i=e.offsetHeight;return Math.abs(t.width-r)<=1&&(r=t.width),Math.abs(t.height-i)<=1&&(i=t.height),{x:e.offsetLeft,y:e.offsetTop,width:r,height:i}}function ar(e,t){var r=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(r&&Zt(r)){var i=t;do{if(i&&e.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function sr(e){return Qt(e).getComputedStyle(e)}function lr(e){return["table","td","th"].indexOf(Yt(e))>=0}function cr(e){return((Gt(e)?e.ownerDocument:e.document)||window.document).documentElement}function dr(e){return"html"===Yt(e)?e:e.assignedSlot||e.parentNode||(Zt(e)?e.host:null)||cr(e)}function hr(e){return Xt(e)&&"fixed"!==sr(e).position?e.offsetParent:null}function gr(e){for(var t=Qt(e),r=hr(e);r&&lr(r)&&"static"===sr(r).position;)r=hr(r);return r&&("html"===Yt(r)||"body"===Yt(r)&&"static"===sr(r).position)?t:r||function(e){var t=-1!==navigator.userAgent.toLowerCase().indexOf("firefox");if(-1!==navigator.userAgent.indexOf("Trident")&&Xt(e)&&"fixed"===sr(e).position)return null;var r=dr(e);for(Zt(r)&&(r=r.host);Xt(r)&&["html","body"].indexOf(Yt(r))<0;){var i=sr(r);if("none"!==i.transform||"none"!==i.perspective||"paint"===i.contain||-1!==["transform","perspective"].indexOf(i.willChange)||t&&"filter"===i.willChange||t&&i.filter&&"none"!==i.filter)return r;r=r.parentNode}return null}(e)||t}function ur(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function mr(e,t,r){return tr(e,rr(t,r))}function pr(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},e)}function fr(e,t){return t.reduce((function(t,r){return t[r]=e,t}),{})}const vr={name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,r=e.state,i=e.name,o=e.options,n=r.elements.arrow,a=r.modifiersData.popperOffsets,s=er(r.placement),l=ur(s),c=[It,Ft].indexOf(s)>=0?"height":"width";if(n&&a){var d=function(e,t){return pr("number"!=typeof(e="function"==typeof e?e(Object.assign({},t.rects,{placement:t.placement})):e)?e:fr(e,Rt))}(o.padding,r),h=nr(n),g="y"===l?Dt:It,u="y"===l?At:Ft,m=r.rects.reference[c]+r.rects.reference[l]-a[l]-r.rects.popper[c],p=a[l]-r.rects.reference[l],f=gr(n),v=f?"y"===l?f.clientHeight||0:f.clientWidth||0:0,b=m/2-p/2,y=d[g],w=v-h[c]-d[u],$=v/2-h[c]/2+b,x=mr(y,$,w),k=l;r.modifiersData[i]=((t={})[k]=x,t.centerOffset=x-$,t)}},effect:function(e){var t=e.state,r=e.options.element,i=void 0===r?"[data-popper-arrow]":r;null!=i&&("string"!=typeof i||(i=t.elements.popper.querySelector(i)))&&ar(t.elements.popper,i)&&(t.elements.arrow=i)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function br(e){return e.split("-")[1]}var yr={top:"auto",right:"auto",bottom:"auto",left:"auto"};function wr(e){var t,r=e.popper,i=e.popperRect,o=e.placement,n=e.variation,a=e.offsets,s=e.position,l=e.gpuAcceleration,c=e.adaptive,d=e.roundOffsets,h=e.isFixed,g=a.x,u=void 0===g?0:g,m=a.y,p=void 0===m?0:m,f="function"==typeof d?d({x:u,y:p}):{x:u,y:p};u=f.x,p=f.y;var v=a.hasOwnProperty("x"),b=a.hasOwnProperty("y"),y=It,w=Dt,$=window;if(c){var x=gr(r),k="clientHeight",_="clientWidth";if(x===Qt(r)&&"static"!==sr(x=cr(r)).position&&"absolute"===s&&(k="scrollHeight",_="scrollWidth"),o===Dt||(o===It||o===Ft)&&n===Ht)w=At,p-=(h&&x===$&&$.visualViewport?$.visualViewport.height:x[k])-i.height,p*=l?1:-1;if(o===It||(o===Dt||o===At)&&n===Ht)y=Ft,u-=(h&&x===$&&$.visualViewport?$.visualViewport.width:x[_])-i.width,u*=l?1:-1}var C,T=Object.assign({position:s},c&&yr),E=!0===d?function(e){var t=e.x,r=e.y,i=window.devicePixelRatio||1;return{x:ir(t*i)/i||0,y:ir(r*i)/i||0}}({x:u,y:p}):{x:u,y:p};return u=E.x,p=E.y,l?Object.assign({},T,((C={})[w]=b?"0":"",C[y]=v?"0":"",C.transform=($.devicePixelRatio||1)<=1?"translate("+u+"px, "+p+"px)":"translate3d("+u+"px, "+p+"px, 0)",C)):Object.assign({},T,((t={})[w]=b?p+"px":"",t[y]=v?u+"px":"",t.transform="",t))}var $r={passive:!0};var xr={left:"right",right:"left",bottom:"top",top:"bottom"};function kr(e){return e.replace(/left|right|bottom|top/g,(function(e){return xr[e]}))}var _r={start:"end",end:"start"};function Cr(e){return e.replace(/start|end/g,(function(e){return _r[e]}))}function Tr(e){var t=Qt(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function Er(e){return or(cr(e)).left+Tr(e).scrollLeft}function Or(e){var t=sr(e),r=t.overflow,i=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(r+o+i)}function Sr(e){return["html","body","#document"].indexOf(Yt(e))>=0?e.ownerDocument.body:Xt(e)&&Or(e)?e:Sr(dr(e))}function Mr(e,t){var r;void 0===t&&(t=[]);var i=Sr(e),o=i===(null==(r=e.ownerDocument)?void 0:r.body),n=Qt(i),a=o?[n].concat(n.visualViewport||[],Or(i)?i:[]):i,s=t.concat(a);return o?s:s.concat(Mr(dr(a)))}function zr(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function Lr(e,t){return t===jt?zr(function(e){var t=Qt(e),r=cr(e),i=t.visualViewport,o=r.clientWidth,n=r.clientHeight,a=0,s=0;return i&&(o=i.width,n=i.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(a=i.offsetLeft,s=i.offsetTop)),{width:o,height:n,x:a+Er(e),y:s}}(e)):Gt(t)?function(e){var t=or(e);return t.top=t.top+e.clientTop,t.left=t.left+e.clientLeft,t.bottom=t.top+e.clientHeight,t.right=t.left+e.clientWidth,t.width=e.clientWidth,t.height=e.clientHeight,t.x=t.left,t.y=t.top,t}(t):zr(function(e){var t,r=cr(e),i=Tr(e),o=null==(t=e.ownerDocument)?void 0:t.body,n=tr(r.scrollWidth,r.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=tr(r.scrollHeight,r.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),s=-i.scrollLeft+Er(e),l=-i.scrollTop;return"rtl"===sr(o||r).direction&&(s+=tr(r.clientWidth,o?o.clientWidth:0)-n),{width:n,height:a,x:s,y:l}}(cr(e)))}function Dr(e,t,r){var i="clippingParents"===t?function(e){var t=Mr(dr(e)),r=["absolute","fixed"].indexOf(sr(e).position)>=0&&Xt(e)?gr(e):e;return Gt(r)?t.filter((function(e){return Gt(e)&&ar(e,r)&&"body"!==Yt(e)})):[]}(e):[].concat(t),o=[].concat(i,[r]),n=o[0],a=o.reduce((function(t,r){var i=Lr(e,r);return t.top=tr(i.top,t.top),t.right=rr(i.right,t.right),t.bottom=rr(i.bottom,t.bottom),t.left=tr(i.left,t.left),t}),Lr(e,n));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function Ar(e){var t,r=e.reference,i=e.element,o=e.placement,n=o?er(o):null,a=o?br(o):null,s=r.x+r.width/2-i.width/2,l=r.y+r.height/2-i.height/2;switch(n){case Dt:t={x:s,y:r.y-i.height};break;case At:t={x:s,y:r.y+r.height};break;case Ft:t={x:r.x+r.width,y:l};break;case It:t={x:r.x-i.width,y:l};break;default:t={x:r.x,y:r.y}}var c=n?ur(n):null;if(null!=c){var d="y"===c?"height":"width";switch(a){case Nt:t[c]=t[c]-(r[d]/2-i[d]/2);break;case Ht:t[c]=t[c]+(r[d]/2-i[d]/2)}}return t}function Fr(e,t){void 0===t&&(t={});var r=t,i=r.placement,o=void 0===i?e.placement:i,n=r.boundary,a=void 0===n?Vt:n,s=r.rootBoundary,l=void 0===s?jt:s,c=r.elementContext,d=void 0===c?Bt:c,h=r.altBoundary,g=void 0!==h&&h,u=r.padding,m=void 0===u?0:u,p=pr("number"!=typeof m?m:fr(m,Rt)),f=d===Bt?Pt:Bt,v=e.rects.popper,b=e.elements[g?f:d],y=Dr(Gt(b)?b:b.contextElement||cr(e.elements.popper),a,l),w=or(e.elements.reference),$=Ar({reference:w,element:v,strategy:"absolute",placement:o}),x=zr(Object.assign({},v,$)),k=d===Bt?x:w,_={top:y.top-k.top+p.top,bottom:k.bottom-y.bottom+p.bottom,left:y.left-k.left+p.left,right:k.right-y.right+p.right},C=e.modifiersData.offset;if(d===Bt&&C){var T=C[o];Object.keys(_).forEach((function(e){var t=[Ft,At].indexOf(e)>=0?1:-1,r=[Dt,At].indexOf(e)>=0?"y":"x";_[e]+=T[r]*t}))}return _}function Ir(e,t){void 0===t&&(t={});var r=t,i=r.placement,o=r.boundary,n=r.rootBoundary,a=r.padding,s=r.flipVariations,l=r.allowedAutoPlacements,c=void 0===l?Ut:l,d=br(i),h=d?s?qt:qt.filter((function(e){return br(e)===d})):Rt,g=h.filter((function(e){return c.indexOf(e)>=0}));0===g.length&&(g=h);var u=g.reduce((function(t,r){return t[r]=Fr(e,{placement:r,boundary:o,rootBoundary:n,padding:a})[er(r)],t}),{});return Object.keys(u).sort((function(e,t){return u[e]-u[t]}))}const Wr={name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,r=e.options,i=e.name;if(!t.modifiersData[i]._skip){for(var o=r.mainAxis,n=void 0===o||o,a=r.altAxis,s=void 0===a||a,l=r.fallbackPlacements,c=r.padding,d=r.boundary,h=r.rootBoundary,g=r.altBoundary,u=r.flipVariations,m=void 0===u||u,p=r.allowedAutoPlacements,f=t.options.placement,v=er(f),b=l||(v===f||!m?[kr(f)]:function(e){if(er(e)===Wt)return[];var t=kr(e);return[Cr(e),t,Cr(t)]}(f)),y=[f].concat(b).reduce((function(e,r){return e.concat(er(r)===Wt?Ir(t,{placement:r,boundary:d,rootBoundary:h,padding:c,flipVariations:m,allowedAutoPlacements:p}):r)}),[]),w=t.rects.reference,$=t.rects.popper,x=new Map,k=!0,_=y[0],C=0;C=0,M=S?"width":"height",z=Fr(t,{placement:T,boundary:d,rootBoundary:h,altBoundary:g,padding:c}),L=S?O?Ft:It:O?At:Dt;w[M]>$[M]&&(L=kr(L));var D=kr(L),A=[];if(n&&A.push(z[E]<=0),s&&A.push(z[L]<=0,z[D]<=0),A.every((function(e){return e}))){_=T,k=!1;break}x.set(T,A)}if(k)for(var F=function(e){var t=y.find((function(t){var r=x.get(t);if(r)return r.slice(0,e).every((function(e){return e}))}));if(t)return _=t,"break"},I=m?3:1;I>0;I--){if("break"===F(I))break}t.placement!==_&&(t.modifiersData[i]._skip=!0,t.placement=_,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function Rr(e,t,r){return void 0===r&&(r={x:0,y:0}),{top:e.top-t.height-r.y,right:e.right-t.width+r.x,bottom:e.bottom-t.height+r.y,left:e.left-t.width-r.x}}function Nr(e){return[Dt,Ft,At,It].some((function(t){return e[t]>=0}))}const Hr={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,r=e.options,i=e.name,o=r.offset,n=void 0===o?[0,0]:o,a=Ut.reduce((function(e,r){return e[r]=function(e,t,r){var i=er(e),o=[It,Dt].indexOf(i)>=0?-1:1,n="function"==typeof r?r(Object.assign({},t,{placement:e})):r,a=n[0],s=n[1];return a=a||0,s=(s||0)*o,[It,Ft].indexOf(i)>=0?{x:s,y:a}:{x:a,y:s}}(r,t.rects,n),e}),{}),s=a[t.placement],l=s.x,c=s.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=c),t.modifiersData[i]=a}};const Vr={name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,r=e.options,i=e.name,o=r.mainAxis,n=void 0===o||o,a=r.altAxis,s=void 0!==a&&a,l=r.boundary,c=r.rootBoundary,d=r.altBoundary,h=r.padding,g=r.tether,u=void 0===g||g,m=r.tetherOffset,p=void 0===m?0:m,f=Fr(t,{boundary:l,rootBoundary:c,padding:h,altBoundary:d}),v=er(t.placement),b=br(t.placement),y=!b,w=ur(v),$="x"===w?"y":"x",x=t.modifiersData.popperOffsets,k=t.rects.reference,_=t.rects.popper,C="function"==typeof p?p(Object.assign({},t.rects,{placement:t.placement})):p,T="number"==typeof C?{mainAxis:C,altAxis:C}:Object.assign({mainAxis:0,altAxis:0},C),E=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,O={x:0,y:0};if(x){if(n){var S,M="y"===w?Dt:It,z="y"===w?At:Ft,L="y"===w?"height":"width",D=x[w],A=D+f[M],F=D-f[z],I=u?-_[L]/2:0,W=b===Nt?k[L]:_[L],R=b===Nt?-_[L]:-k[L],N=t.elements.arrow,H=u&&N?nr(N):{width:0,height:0},V=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},j=V[M],B=V[z],P=mr(0,k[L],H[L]),q=y?k[L]/2-I-P-j-T.mainAxis:W-P-j-T.mainAxis,U=y?-k[L]/2+I+P+B+T.mainAxis:R+P+B+T.mainAxis,K=t.elements.arrow&&gr(t.elements.arrow),Y=K?"y"===w?K.clientTop||0:K.clientLeft||0:0,Q=null!=(S=null==E?void 0:E[w])?S:0,G=D+U-Q,X=mr(u?rr(A,D+q-Q-Y):A,D,u?tr(F,G):F);x[w]=X,O[w]=X-D}if(s){var Z,J="x"===w?Dt:It,ee="x"===w?At:Ft,te=x[$],re="y"===$?"height":"width",ie=te+f[J],oe=te-f[ee],ne=-1!==[Dt,It].indexOf(v),ae=null!=(Z=null==E?void 0:E[$])?Z:0,se=ne?ie:te-k[re]-_[re]-ae+T.altAxis,le=ne?te+k[re]+_[re]-ae-T.altAxis:oe,ce=u&&ne?function(e,t,r){var i=mr(e,t,r);return i>r?r:i}(se,te,le):mr(u?se:ie,te,u?le:oe);x[$]=ce,O[$]=ce-te}t.modifiersData[i]=O}},requiresIfExists:["offset"]};function jr(e,t,r){void 0===r&&(r=!1);var i,o,n=Xt(t),a=Xt(t)&&function(e){var t=e.getBoundingClientRect(),r=ir(t.width)/e.offsetWidth||1,i=ir(t.height)/e.offsetHeight||1;return 1!==r||1!==i}(t),s=cr(t),l=or(e,a),c={scrollLeft:0,scrollTop:0},d={x:0,y:0};return(n||!n&&!r)&&(("body"!==Yt(t)||Or(s))&&(c=(i=t)!==Qt(i)&&Xt(i)?{scrollLeft:(o=i).scrollLeft,scrollTop:o.scrollTop}:Tr(i)),Xt(t)?((d=or(t,!0)).x+=t.clientLeft,d.y+=t.clientTop):s&&(d.x=Er(s))),{x:l.left+c.scrollLeft-d.x,y:l.top+c.scrollTop-d.y,width:l.width,height:l.height}}function Br(e){var t=new Map,r=new Set,i=[];function o(e){r.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach((function(e){if(!r.has(e)){var i=t.get(e);i&&o(i)}})),i.push(e)}return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){r.has(e.name)||o(e)})),i}var Pr={placement:"bottom",modifiers:[],strategy:"absolute"};function qr(){for(var e=arguments.length,t=new Array(e),r=0;r{},onAfterHide:()=>{},onTransitionEnd:()=>{}},r),this.isVisible=!1,this.popover.hidden=!0,this.popover.classList.remove(this.options.visibleClass),this.popover.addEventListener("transitionend",this.handleTransitionEnd)}handleTransitionEnd(e){e.target===this.options.transitionElement&&(this.options.onTransitionEnd.call(this,e),this.isVisible||this.popover.hidden||(this.popover.hidden=!0,this.popover.classList.remove(this.options.visibleClass),this.options.onAfterHide.call(this)))}destroy(){this.popover.removeEventListener("transitionend",this.handleTransitionEnd),this.popper&&(this.popper.destroy(),this.popper=null)}show(){this.isVisible=!0,this.popover.hidden=!1,requestAnimationFrame((()=>this.popover.classList.add(this.options.visibleClass))),this.popper&&this.popper.destroy(),this.popper=Kr(this.anchor,this.popover,{placement:this.options.placement,strategy:this.options.strategy,modifiers:[{name:"flip",options:{boundary:"viewport"}},{name:"offset",options:{offset:[this.options.skidding,this.options.distance]}}]}),this.popover.addEventListener("transitionend",(()=>this.options.onAfterShow.call(this)),{once:!0}),requestAnimationFrame((()=>this.popper.update()))}hide(){this.isVisible=!1,this.popover.classList.remove(this.options.visibleClass)}setOptions(e){this.options=Object.assign(this.options,e),this.isVisible?this.popover.classList.add(this.options.visibleClass):this.popover.classList.remove(this.options.visibleClass),this.popper&&(this.popper.setOptions({placement:this.options.placement,strategy:this.options.strategy}),requestAnimationFrame((()=>this.popper.update())))}}let Qr=0;const Gr=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grShow=fe(this,"gr-show",7),this.grAfterShow=fe(this,"gr-after-show",7),this.grHide=fe(this,"gr-hide",7),this.grAfterHide=fe(this,"gr-after-hide",7),this.componentId="dropdown-"+ ++Qr,this.isVisible=!1,this.open=!1,this.placement="bottom-start",this.closeOnSelect=!0,this.containingElement=void 0,this.distance=2,this.skidding=0,this.hoist=!1}handleOpenChange(){this.open?this.show():this.hide(),this.updateAccessibleTrigger()}handlePopoverOptionsChange(){this.popoverElement.setOptions({strategy:this.hoist?"fixed":"absolute",placement:this.placement,distance:this.distance,skidding:this.skidding})}connectedCallback(){this.containingElement||(this.containingElement=this.el),this.handleDocumentKeyDown=this.handleDocumentKeyDown.bind(this),this.handleDocumentMouseDown=this.handleDocumentMouseDown.bind(this),this.handleMenuItemActivate=this.handleMenuItemActivate.bind(this),this.handlePanelSelect=this.handlePanelSelect.bind(this),this.handleTriggerClick=this.handleTriggerClick.bind(this),this.handleTriggerKeyDown=this.handleTriggerKeyDown.bind(this),this.handleTriggerKeyUp=this.handleTriggerKeyUp.bind(this),this.handleTriggerSlotChange=this.handleTriggerSlotChange.bind(this)}componentDidLoad(){this.popoverElement=new Yr(this.trigger,this.positioner,{strategy:this.hoist?"fixed":"absolute",placement:this.placement,distance:this.distance,skidding:this.skidding,transitionElement:this.panel,onAfterHide:()=>this.grAfterHide.emit(),onAfterShow:()=>this.grAfterShow.emit(),onTransitionEnd:()=>{this.open||(this.panel.scrollTop=0)}}),this.open&&this.show()}disconnectedCallback(){this.hide(),this.popoverElement.destroy()}async show(){if(this.isVisible)return;this.grShow.emit().defaultPrevented?this.open=!1:(this.panel.addEventListener("gr-activate",this.handleMenuItemActivate),this.panel.addEventListener("gr-select",this.handlePanelSelect),document.addEventListener("keydown",this.handleDocumentKeyDown),document.addEventListener("mousedown",this.handleDocumentMouseDown),this.isVisible=!0,this.open=!0,this.popoverElement.show())}async hide(){if(!this.isVisible)return;this.grHide.emit().defaultPrevented?this.open=!0:(this.panel.removeEventListener("gr-activate",this.handleMenuItemActivate),this.panel.removeEventListener("gr-select",this.handlePanelSelect),document.addEventListener("keydown",this.handleDocumentKeyDown),document.removeEventListener("mousedown",this.handleDocumentMouseDown),this.isVisible=!1,this.open=!1,this.popoverElement.hide())}async focusOnTrigger(){const e=this.trigger.querySelector("slot").assignedElements({flatten:!0})[0];e&&("function"==typeof e.setFocus?e.setFocus():"function"==typeof e.focus&&e.focus())}getMenu(){return this.panel.querySelector("slot").assignedElements({flatten:!0}).filter((e=>"gr-menu"===e.tagName.toLowerCase()))[0]}handleDocumentKeyDown(e){var t;if("Escape"===e.key)return this.hide(),void this.focusOnTrigger();if("Tab"===e.key){if(this.open&&"gr-menu-item"===(null===(t=document.activeElement)||void 0===t?void 0:t.tagName.toLowerCase()))return e.preventDefault(),this.hide(),void this.focusOnTrigger();setTimeout((()=>{var e;const t=this.containingElement.getRootNode()instanceof ShadowRoot?null===(e=document.activeElement.shadowRoot)||void 0===e?void 0:e.activeElement:document.activeElement;(null==t?void 0:t.closest(this.containingElement.tagName.toLowerCase()))===this.containingElement||this.hide()}))}}handleDocumentMouseDown(e){e.composedPath().includes(this.containingElement)||this.hide()}handleMenuItemActivate(e){Mt(e.target,this.panel)}handlePanelSelect(e){const t=e.target;this.closeOnSelect&&"gr-menu"===t.tagName.toLowerCase()&&(this.hide(),this.focusOnTrigger())}handleTriggerClick(){this.open?this.hide():this.show()}handleTriggerKeyDown(e){const t=this.getMenu(),r=t?[...t.querySelectorAll("gr-menu-item")]:null,i=r[0],o=r[r.length-1];if("Escape"===e.key)return this.focusOnTrigger(),void this.hide();if([" ","Enter"].includes(e.key))return e.preventDefault(),void(this.open?this.hide():this.show());if(["ArrowDown","ArrowUp"].includes(e.key)){if(e.preventDefault(),this.open||this.show(),"ArrowDown"===e.key&&i)return void i.setFocus();if("ArrowUp"===e.key&&o)return void o.setFocus()}this.open&&t&&!["Tab","Shift","Meta","Ctrl","Alt"].includes(e.key)&&t.typeToSelect(e.key)}handleTriggerKeyUp(e){" "===e.key&&e.preventDefault()}handleTriggerSlotChange(){this.updateAccessibleTrigger()}updateAccessibleTrigger(){const e=this.trigger.querySelector("slot").assignedElements({flatten:!0}).map(Lt)[0];e&&(e.setAttribute("aria-haspopup","true"),e.setAttribute("aria-expanded",this.open?"true":"false"))}render(){return de(ge,{id:this.componentId,class:{"dropdown-open":this.open}},de("span",{class:"dropdown-trigger",ref:e=>this.trigger=e,onClick:this.handleTriggerClick,onKeyDown:this.handleTriggerKeyDown,onKeyUp:this.handleTriggerKeyUp},de("slot",{name:"trigger",onSlotchange:this.handleTriggerSlotChange})),de("div",{ref:e=>this.positioner=e,class:"dropdown-positioner"},de("div",{ref:e=>this.panel=e,class:"dropdown-panel",role:"menu","aria-hidden":this.open?"false":"true","aria-labelledby":this.componentId},de("slot",null))))}get el(){return this}static get watchers(){return{open:["handleOpenChange"],distance:["handlePopoverOptionsChange"],hoist:["handlePopoverOptionsChange"],placement:["handlePopoverOptionsChange"],skidding:["handlePopoverOptionsChange"]}}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{--panel-background-color:var(--gr-color-white);--panel-border-radius:var(--gr-border-radius-medium);--panel-border-color:var(--gr-panel-border-color);--panel-box-shadow:var(--gr-shadow-large);--transition:150ms opacity, 150ms transform;display:inline-block;position:relative;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.dropdown-trigger{display:block}.dropdown-positioner{position:absolute;z-index:var(--gr-z-index-dropdown)}.dropdown-panel{max-height:50vh;font-family:var(--gr-font-family);font-size:var(--gr-font-size-medium);font-weight:var(--gr-font-weight-normal);background-color:var(--panel-background-color);border:solid 1px var(--panel-border-color);border-radius:var(--panel-border-radius);box-shadow:var(--panel-box-shadow);opacity:0;overflow:auto;overscroll-behavior:none;pointer-events:none;transform:scale(0.9);transition:var(--transition)}.dropdown-positioner[data-popper-placement^=top] .dropdown-panel{transform-origin:bottom}.dropdown-positioner[data-popper-placement^=bottom] .dropdown-panel{transform-origin:top}.dropdown-positioner[data-popper-placement^=left] .dropdown-panel{transform-origin:right}.dropdown-positioner[data-popper-placement^=right] .dropdown-panel{transform-origin:left}.dropdown-positioner.popover-visible .dropdown-panel{opacity:1;transform:none;pointer-events:all}"}},[1,"gr-dropdown",{open:[1540],placement:[1],closeOnSelect:[4,"close-on-select"],containingElement:[1040],distance:[2],skidding:[2],hoist:[4],show:[64],hide:[64],focusOnTrigger:[64]}]);function Xr(){if("undefined"==typeof customElements)return;["gr-dropdown"].forEach((e=>{if("gr-dropdown"===e)customElements.get(e)||customElements.define(e,Gr)}))}Xr(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const Zr=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grSelect=fe(this,"gr-select",7),this.typeToSelectString=""}connectedCallback(){this.handleClick=this.handleClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}async typeToSelect(e){clearTimeout(this.typeToSelectTimeout),this.typeToSelectTimeout=setTimeout((()=>this.typeToSelectString=""),750),this.typeToSelectString+=e.toLowerCase();const t=this.getItems();for(const e of t){if(kt(e.shadowRoot.querySelector("slot:not([name])")).toLowerCase().trim().substring(0,this.typeToSelectString.length)===this.typeToSelectString){e.setFocus();break}}}getItems(){return[...this.menu.querySelector("slot").assignedElements({flatten:!0})].filter((e=>"gr-menu-item"===e.tagName.toLowerCase()&&!e.disabled))}getActiveItem(){return this.getItems().find((e=>e===document.activeElement))}setActiveItem(e){e.setFocus()}handleClick(e){const t=e.target.closest("gr-menu-item");t&&!t.disabled&&this.grSelect.emit({item:t})}handleKeyDown(e){if("Enter"===e.key){const t=this.getActiveItem();e.preventDefault(),t&&this.grSelect.emit({item:t})}if(" "===e.key&&e.preventDefault(),["ArrowDown","ArrowUp","Home","End"].includes(e.key)){const t=this.getItems(),r=this.getActiveItem();let i=t.indexOf(r);if(t.length)return e.preventDefault(),"ArrowDown"===e.key?i++:"ArrowUp"===e.key?i--:"Home"===e.key?i=0:"End"===e.key&&(i=t.length-1),i<0&&(i=0),i>t.length-1&&(i=t.length-1),void this.setActiveItem(t[i])}this.typeToSelect(e.key)}render(){return de("div",{ref:e=>this.menu=e,class:"menu",role:"menu",onClick:this.handleClick,onKeyDown:this.handleKeyDown},de("slot",null))}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{--padding-top:var(--gr-spacing-x-small);--padding-bottom:var(--gr-spacing-x-small);display:block;padding-top:var(--padding-top);padding-left:0;padding-right:0;padding-bottom:var(--padding-bottom);box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host:focus{outline:none}"}},[1,"gr-menu",{typeToSelect:[64]}]);function Jr(){if("undefined"==typeof customElements)return;["gr-menu"].forEach((e=>{if("gr-menu"===e)customElements.get(e)||customElements.define(e,Zr)}))}Jr(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const ei=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grClear=fe(this,"gr-clear",7),this.type="primary",this.size="medium",this.pill=!1,this.clearable=!1,this.truncate=!1,this.title=""}connectedCallback(){this.handleClearClick=this.handleClearClick.bind(this)}handleClearClick(){this.grClear.emit()}render(){return de(ge,{class:{[`tag-${this.type}`]:!0,[`tag-${this.size}`]:!0,"tag-pill":this.pill,"tag-clearable":this.clearable}},de("span",{class:"tag"},de("span",{class:{"tag-truncate":this.truncate},title:this.title},de("slot",null)),this.clearable&&de("gr-button",{variant:"plain",size:this.size,class:"tag-clear","aria-label":"clear",onClick:this.handleClearClick},de("svg",{slot:"icon-only",role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Close"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 368L144 144M368 144L144 368"})))))}static get style(){return":host{--height:calc(var(--gr-form-element-height-medium) * 0.8);--line-height:calc(var(--gr-form-element-height-medium) - 1px * 2);--border-radius:var(--gr-form-element-border-radius-medium);--border-width:1px;--border-style:solid;--padding-top:0;--padding-start:var(--gr-spacing-small);--padding-end:var(--gr-spacing-small);--padding-bottom:0;--font-size:var(--gr-form-element-font-size-medium);--background-color:rgba(var(--gr-color-primary-rgb), 0.05);--border-color:rgba(var(--gr-color-primary-rgb), 0.2);--color:var(--gr-color-primary-shade);--clear-color:var(--gr-color-primary);--clear-color-hover:var(--gr-color-primary-shade);--clear-margin-left:var(--gr-spacing-xx-small);--clear-margin-right:calc(-1 * var(--gr-spacing-xxx-small));display:inline-block;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host(.tag-success){--background-color:rgba(var(--gr-color-success-rgb), 0.05);--border-color:rgba(var(--gr-color-success-rgb), 0.2);--color:var(--gr-color-success-shade);--clear-color:var(--gr-color-success);--clear-color-hover:var(--gr-color-success-shade)}:host(.tag-info){--background-color:rgba(var(--gr-color-medium-rgb), 0.05);--border-color:rgba(var(--gr-color-medium-rgb), 0.2);--color:var(--gr-color-medium-shade);--clear-color:var(--gr-color-medium);--clear-color-hover:var(--gr-color-medium-shade)}:host(.tag-warning){--background-color:rgba(var(--gr-color-warning-rgb), 0.05);--border-color:rgba(var(--gr-color-warning-rgb), 0.2);--color:var(--gr-color-warning-shade);--clear-color:var(--gr-color-warning);--clear-color-hover:var(--gr-color-warning-shade)}:host(.tag-danger){--background-color:rgba(var(--gr-color-danger-rgb), 0.05);--border-color:rgba(var(--gr-color-danger-rgb), 0.2);--color:var(--gr-color-danger-shade);--clear-color:var(--gr-color-danger);--clear-color-hover:var(--gr-color-danger-shade)}:host(.tag-small){--font-size:var(--gr-form-element-font-size-small);--height:calc(var(--gr-form-element-height-small) * 0.8);--line-height:calc(var(--gr-form-element-height-small) - 1px * 2);--border-radius:var(--gr-form-element-border-radius-small);--padding-start:var(--gr-spacing-x-small);--padding-end:var(--gr-spacing-x-small);--clear-margin-left:var(--gr-spacing-xx-small);--clear-margin-right:calc(-1 * var(--gr-spacing-xxx-small))}:host(.tag-large){--font-size:var(--gr-form-element-font-size-large);--height:calc(var(--gr-form-element-height-large) * 0.8);--line-height:calc(var(--gr-form-element-height-large) - 1px * 2);--border-radius:var(--gr-form-element-border-radius-large);--padding:0 var(--gr-spacing-medium);--clear-margin-left:var(--gr-spacing-xx-small);--clear-margin-right:calc(-1 * var(--gr-spacing-x-small))}.tag{display:flex;align-items:center;border-style:var(--border-style);border-width:var(--border-width);border-radius:var(--border-radius);white-space:nowrap;user-select:none;cursor:default;font-family:var(--gr-font-family);font-size:var(--font-size);font-weight:var(--gr-font-weight-normal);height:var(--height);line-height:var(--line-height);padding-top:var(--padding-top);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-bottom:var(--padding-bottom);background-color:var(--background-color);border-color:var(--border-color);color:var(--color)}.tag-clear{--color:var(--clear-color);--color-hover:var(--clear-color-hover);--padding-start:0;--padding-end:0;margin-left:var(--clear-margin-left);margin-right:var(--clear-margin-right);--height:1em}.tag-clear svg{font-size:0.7em}.tag-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tag-clear svg{width:1.1em;height:1.1em}:host(.tag-pill) .tag{border-radius:var(--height)}"}},[1,"gr-tag",{type:[513],size:[513],pill:[516],clearable:[516],truncate:[516],title:[513]}]);function ti(){if("undefined"==typeof customElements)return;["gr-tag","gr-button","gr-spinner"].forEach((e=>{switch(e){case"gr-tag":customElements.get(e)||customElements.define(e,ei);break;case"gr-button":customElements.get(e)||St();break;case"gr-spinner":customElements.get(e)||Et()}}))}ti(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const ri="undefined"!=typeof HTMLElement?HTMLElement:class{};let ii=0;const oi=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grChange=fe(this,"gr-change",7),this.grFocus=fe(this,"gr-focus",7),this.grBlur=fe(this,"gr-blur",7),this.inputId="select-"+ ++ii,this.labelId=`select-label-${ii}`,this.helpTextId=`select-help-text-${ii}`,this.invalidTextId=`select-invalid-text-${ii}`,this.inheritedAttributes={},this.handleBlur=()=>{this.isOpen||(this.hasFocus=!1,this.grBlur.emit())},this.handleFocus=()=>{this.hasFocus||(this.hasFocus=!0,this.grFocus.emit())},this.hasFocus=!1,this.hasHelpTextSlot=!1,this.hasInvalidTextSlot=!1,this.hasLabelSlot=!1,this.isOpen=!1,this.items=[],this.displayLabel="",this.displayTags=[],this.multiple=!1,this.maxTagsVisible=3,this.disabled=!1,this.name="",this.placeholder="",this.size="medium",this.hoist=!1,this.value="",this.pill=!1,this.label="",this.requiredIndicator=!1,this.helpText="",this.invalidText="",this.invalid=!1,this.clearable=!1}handleDisabledChange(){this.disabled&&this.isOpen&&this.dropdown.hide()}handleLabelChange(){this.handleSlotChange()}handleMultipleChange(){const e=this.getValueAsArray();this.value=this.multiple?e:e[0]||"",this.syncItemsFromValue()}handleValueChange(){this.syncItemsFromValue(),this.grChange.emit()}connectedCallback(){this.handleClearClick=this.handleClearClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleLabelClick=this.handleLabelClick.bind(this),this.handleMenuHide=this.handleMenuHide.bind(this),this.handleMenuShow=this.handleMenuShow.bind(this),this.handleMenuSelect=this.handleMenuSelect.bind(this),this.handleSlotChange=this.handleSlotChange.bind(this),this.handleTagInteraction=this.handleTagInteraction.bind(this),this.el.shadowRoot.addEventListener("slotchange",this.handleSlotChange)}componentWillLoad(){this.handleSlotChange(),this.inheritedAttributes=Ct(this.el,["aria-label"])}componentDidLoad(){this.resizeObserver=new ResizeObserver((()=>this.resizeMenu())),this.reportDuplicateItemValues(),requestAnimationFrame((()=>this.syncItemsFromValue()))}disconnectedCallback(){this.el.shadowRoot.removeEventListener("slotchange",this.handleSlotChange)}async setFocus(){this.hasFocus=!0,this.grFocus.emit(),this.dropdown.focusOnTrigger()}getItemLabel(e){return kt(e.shadowRoot.querySelector("slot:not([name])"))}getItems(){return[...this.el.querySelectorAll("gr-menu-item")]}getValueAsArray(){return Array.isArray(this.value)?this.value:[this.value]}handleClearClick(e){e.stopPropagation(),this.value=this.multiple?[]:"",this.syncItemsFromValue()}handleKeyDown(e){const t=e.target,r=this.getItems(),i=r[0],o=r[r.length-1];if("gr-tag"!==t.tagName.toLowerCase())if("Tab"!==e.key){if(["ArrowDown","ArrowUp"].includes(e.key)){if(e.preventDefault(),this.isOpen||this.dropdown.show(),"ArrowDown"===e.key&&i)return void i.setFocus();if("ArrowUp"===e.key&&o)return void o.setFocus()}this.isOpen||1!==e.key.length||(e.stopPropagation(),e.preventDefault(),this.dropdown.show(),this.menu.typeToSelect(e.key))}else this.isOpen&&this.dropdown.hide()}handleLabelClick(){this.box.focus()}handleMenuSelect(e){const t=e.detail.item;this.multiple?this.value=this.value.includes(t.value)?this.value.filter((e=>e!==t.value)):[...this.value,t.value]:this.value=t.value,this.syncItemsFromValue()}handleMenuShow(e){this.disabled?e.preventDefault():(this.resizeMenu(),this.resizeObserver.observe(this.el),this.isOpen=!0)}handleMenuHide(){this.resizeObserver.unobserve(this.el),this.isOpen=!1,this.box.focus()}handleSlotChange(){this.hasHelpTextSlot=_t(this.el,"help-text"),this.hasInvalidTextSlot=_t(this.el,"invalid-text"),this.hasLabelSlot=_t(this.el,"label"),this.syncItemsFromValue(),this.reportDuplicateItemValues()}handleTagInteraction(e){e.composedPath().find((e=>{if(e instanceof ri)return e.classList.contains("tag-clear")}))&&e.stopPropagation()}reportDuplicateItemValues(){const e=this.getItems().map((e=>e.value)).filter(((e,t,r)=>r.indexOf(e)!==t));if(e.length)throw new Error('Duplicate value found on in : "'+e.join('", "')+'"')}resizeMenu(){this.menu.style.width=`${this.box.clientWidth}px`}syncItemsFromValue(){const e=this.getItems(),t=this.getValueAsArray();if(e.map((e=>e.checked=t.includes(e.value))),this.multiple){const r=[];if(t.map((t=>e.map((e=>e.value===t?r.push(e):null)))),this.displayTags=r.map((e=>de("gr-tag",{type:"info",size:this.size,pill:this.pill,clearable:!0,onClick:this.handleTagInteraction,onKeyDown:this.handleTagInteraction,"onGr-clear":t=>{t.stopPropagation(),this.disabled||(e.checked=!1,this.syncValueFromItems())}},this.getItemLabel(e)))),this.maxTagsVisible>0&&this.displayTags.length>this.maxTagsVisible){const e=this.displayTags.length;this.displayLabel="",this.displayTags=this.displayTags.slice(0,this.maxTagsVisible),this.displayTags.push(de("gr-tag",{type:"info",size:this.size,pill:this.pill},"+",e-this.maxTagsVisible))}}else{const r=e.filter((e=>e.value===t[0]))[0];this.displayLabel=r?this.getItemLabel(r):"",this.displayTags=[]}}syncValueFromItems(){const e=this.getItems().filter((e=>e.checked)).map((e=>e.value));this.multiple?this.value=this.value.filter((t=>e.includes(t))):this.value=e.length>0?e[0]:""}render(){var e;const t=this.multiple?this.value.length>0:""!==this.value,r=this.inheritedAttributes["aria-label"]?{"aria-label":this.inheritedAttributes["aria-label"]}:{"aria-labelledby":this.labelId};return((e,t,r,i)=>{let o=e.querySelector("input.aux-input");o||(o=e.ownerDocument.createElement("input"),o.type="hidden",o.classList.add("aux-input"),e.appendChild(o)),o.disabled=i,o.name=t,o.value=r||""})(this.el,this.name,ni(this.value),this.disabled),de(xt,{inputId:this.inputId,label:this.label,labelId:this.labelId,hasLabelSlot:this.hasLabelSlot,helpTextId:this.helpTextId,helpText:this.helpText,hasHelpTextSlot:this.hasHelpTextSlot,invalidTextId:this.invalidTextId,invalidText:this.invalidText,invalid:this.invalid,hasInvalidTextSlot:this.hasInvalidTextSlot,size:this.size,onLabelClick:this.handleLabelClick,requiredIndicator:this.requiredIndicator},de("gr-dropdown",{ref:e=>this.dropdown=e,hoist:this.hoist,closeOnSelect:!this.multiple,containingElement:this.el,class:{select:!0,"select-open":this.isOpen,"select-empty":0===(null===(e=this.value)||void 0===e?void 0:e.length),"select-focused":this.hasFocus,"select-clearable":this.clearable,"select-disabled":this.disabled,"select-multiple":this.multiple,"select-has-tags":this.multiple&&t,"select-placeholder-visible":""===this.displayLabel,[`select-${this.size}`]:!0,"select-pill":this.pill,"select-invalid":this.invalid},"onGr-show":this.handleMenuShow,"onGr-hide":this.handleMenuHide},de("div",Object.assign({slot:"trigger",ref:e=>this.box=e,id:this.inputId,class:"select-box",role:"combobox"},r,{"aria-describedby":this.invalid?this.invalidTextId:this.helpTextId,"aria-haspopup":"true","aria-expanded":this.isOpen?"true":"false","aria-invalid":this.invalid?"true":"false","aria-required":this.requiredIndicator?"true":"false",tabIndex:this.disabled?-1:0,onBlur:this.handleBlur,onFocus:this.handleFocus,onKeyDown:this.handleKeyDown}),de("div",{class:"select-label"},this.displayTags.length?de("span",{class:"select-tags"},this.displayTags):this.displayLabel||this.placeholder),this.clearable&&t&&de("button",{class:"select-clear",type:"button",onClick:this.handleClearClick,"aria-label":"clear",tabindex:"-1"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Close Circle"),de("path",{d:"M448 256c0-106-86-192-192-192S64 150 64 256s86 192 192 192 192-86 192-192z",fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32"}),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M320 320L192 192M192 320l128-128"}))),de("span",{class:"caret"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Chevron Down"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"M112 184l144 144 144-144"}))),de("input",{class:"select-hidden-select","aria-hidden":"true",value:t?"1":"",tabIndex:-1})),de("gr-menu",{ref:e=>this.menu=e,class:"select-menu","onGr-select":this.handleMenuSelect},de("slot",{onSlotchange:this.handleSlotChange}))))}get el(){return this}static get watchers(){return{disabled:["handleDisabledChange"],helpText:["handleLabelChange"],invalidText:["handleLabelChange"],label:["handleLabelChange"],multiple:["handleMultipleChange"],value:["handleValueChange"]}}static get style(){return".form-control .form-control-label{display:none}.form-control .form-control-help-text{display:none}.form-control .form-control-invalid-text{display:none}.form-control-has-label .form-control-label{display:flex;line-height:var(--gr-line-height-normal);color:var(--gr-form-element-label-color);margin-bottom:var(--gr-spacing-xxx-small)}.form-control-has-label.form-control-small .form-control-label{font-size:var(--gr-form-element-label-font-size-small)}.form-control-has-label.form-control-medium .form-control-label{font-size:var(--gr-form-element-label-font-size-medium)}.form-control-has-label.form-control-large .form-control-label{font-size:var(--gr-form-element-label-font-size-large)}.form-control-has-label .form-control-label .asterisk{margin-left:var(--gr-spacing-x-small);color:var(--gr-color-medium)}.form-control-has-label .form-control-label .asterisk svg{width:0.6em;height:0.6em;margin-bottom:var(--gr-spacing-xxx-small)}.form-control-has-help-text .form-control-help-text{display:block;line-height:var(--gr-line-height-normal);color:var(--gr-form-element-help-text-color);margin-top:var(--gr-spacing-xxx-small)}.form-control-has-help-text.form-control-small .form-control-help-text{font-size:var(--gr-form-element-help-text-font-size-small);min-height:1.625rem}.form-control-has-help-text.form-control-medium .form-control-help-text{font-size:var(--gr-form-element-help-text-font-size-medium);min-height:1.875rem}.form-control-has-help-text.form-control-large .form-control-help-text{font-size:var(--gr-form-element-help-text-font-size-large);min-height:2.125rem}.form-control-has-invalid-text .form-control-invalid-text{display:flex;margin-left:-2px;line-height:var(--gr-line-height-normal);color:var(--gr-form-element-invalid-text-color);margin-top:var(--gr-spacing-xxx-small)}.form-control-has-invalid-text .form-control-invalid-text .icon{margin-top:var(--gr-spacing-xxx-small);margin-right:var(--gr-spacing-xx-small)}.form-control-has-invalid-text .form-control-invalid-text .icon svg{width:1.4em;height:1.4em}.form-control-has-invalid-text.form-control-small .form-control-invalid-text{font-size:var(--gr-form-element-invalid-text-font-size-small);min-height:1.625rem}.form-control-has-invalid-text.form-control-medium .form-control-invalid-text{font-size:var(--gr-form-element-invalid-text-font-size-medium);min-height:1.875rem}.form-control-has-invalid-text.form-control-large .form-control-invalid-text{font-size:var(--gr-form-element-invalid-text-font-size-large);min-height:2.125rem}.gr-scroll-lock{overflow:hidden !important}:host{--font-size:var(--gr-form-element-font-size-medium);--font-weight:var(--gr-font-weight-normal);--background-color:var(--gr-color-white);--background-color-hover:var(--gr-color-white);--background-color-focus:var(--gr-color-white);--background-color-invalid:var(--gr-color-white);--background-color-invalid-hover:var(--gr-color-white);--border-radius:var(--gr-form-element-border-radius-small);--border-color:var(--gr-color-light-shade);--border-color-hover:var(--gr-color-medium);--border-color-focus:var(--gr-color-primary);--border-color-invalid:var(--gr-color-danger);--border-color-invalid-hover:var(--gr-color-danger-shade);--color:var(--gr-color-dark-tint);--placeholder-color:var(--gr-color-medium-tint);--min-height:var(--gr-form-element-height-medium);--label-margin-start:var(--gr-spacing-medium);--label-margin-end:var(--gr-spacing-medium);--clear-icon-margin-end:var(--gr-spacing-medium);--caret-margin-end:var(--gr-spacing-medium);--tags-padding-top:3px;--tags-padding-bottom:3px;--tags-margin-end:var(--gr-spacing-xx-small);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33);display:block;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.select-small{--font-size:var(--gr-form-element-font-size-small);--min-height:var(--gr-form-element-height-small);--label-margin-start:var(--gr-spacing-small);--label-margin-end:var(--gr-spacing-small);--clear-icon-margin-end:var(--gr-spacing-small);--caret-margin-end:var(--gr-spacing-small);--tags-padding-top:2px;--tags-padding-bottom:2px}.select-large{--font-size:var(--gr-form-element-font-size-large);--min-height:var(--gr-form-element-height-large);--label-margin-start:var(--gr-spacing-large);--label-margin-end:var(--gr-spacing-large);--clear-icon-margin-end:var(--gr-spacing-large);--caret-margin-end:var(--gr-spacing-large);--tags-padding-top:4px;--tags-padding-bottom:4px}.select{display:block}.select-box{display:inline-flex;align-items:center;justify-content:start;position:relative;width:100%;font-family:var(--gr-font-family);font-size:var(--font-size);font-weight:var(--font-weight);letter-spacing:normal;background-color:var(--background-color);border:solid 1px var(--border-color);border-radius:var(--border-radius);min-height:var(--min-height);color:var(--color);vertical-align:middle;overflow:hidden;transition:150ms color, 150ms border, 150ms box-shadow;cursor:pointer}.select.select-invalid:not(.select-disabled) .select-box{background-color:var(--background-color-invalid);border-color:var(--border-color-invalid)}.select.select-invalid:not(.select-disabled):not(.select-focused) .select-box:hover{background-color:var(--background-color-invalid-hover);border-color:var(--border-color-invalid-hover)}.select.select-invalid:not(.select-disabled) .select-box{background-color:var(--background-color-invalid);border-color:var(--border-color-invalid)}.select:not(.select-disabled) .select-box:hover{background-color:var(--background-color-hover);border-color:var(--border-color-hover)}.select.select-focused:not(.select-disabled) .select-box{outline:none;box-shadow:var(--focus-ring);border-color:var(--border-color-focus);background-color:var(--background-color-focus)}.select-disabled .select-box{opacity:0.5;cursor:not-allowed;outline:none}.select-disabled .select-tags,.select-disabled .select-clear{pointer-events:none}.select-label{flex:1 1 auto;display:flex;align-items:center;user-select:none;margin-top:0;margin-left:var(--label-margin-start);margin-right:var(--label-margin-end);margin-bottom:0;scrollbar-width:none;-ms-overflow-style:none;overflow-x:auto;overflow-y:hidden;white-space:nowrap}.select-label::-webkit-scrollbar{width:0;height:0}.select-has-tags .select-label{margin-left:0}.select-clear{display:inline-flex;align-items:center;font-size:inherit;color:var(--gr-color-medium);border:none;background:none;padding:0;transition:150ms color;cursor:pointer;margin-right:var(--clear-icon-margin-end)}.select-clear:hover{color:var(--gr-color-dark)}.select-clear:focus{outline:none}.select-clear svg{width:1.2em;height:1.2em;font-size:var(--font-size)}.caret{flex:0 0 auto;display:inline-flex;transition:250ms transform ease;margin-right:var(--caret-margin-end)}.caret svg{width:1em;height:1em;font-size:var(--font-size)}.select-open .caret{transform:rotate(-180deg)}.select-placeholder-visible .select-label{color:var(--placeholder-color)}.select-tags{display:inline-flex;align-items:center;flex-wrap:wrap;justify-content:left;margin-left:var(--gr-spacing-xx-small);padding-bottom:var(--tags-padding-bottom)}.select-tags gr-tag{padding-top:var(--tags-padding-top)}.select-tags gr-tag:not(:last-of-type){margin-right:var(--tags-margin-end)}.select-hidden-select{clip:rect(0 0 0 0);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px;position:absolute;top:0;left:0;width:100%;height:100%}.select-pill .select-box{border-radius:var(--min-height)}"}},[1,"gr-select",{multiple:[4],maxTagsVisible:[2,"max-tags-visible"],disabled:[4],name:[1],placeholder:[1],size:[1],hoist:[4],value:[1025],pill:[4],label:[1],requiredIndicator:[4,"required-indicator"],helpText:[1,"help-text"],invalidText:[1,"invalid-text"],invalid:[516],clearable:[4],hasFocus:[32],hasHelpTextSlot:[32],hasInvalidTextSlot:[32],hasLabelSlot:[32],isOpen:[32],items:[32],displayLabel:[32],displayTags:[32],setFocus:[64]}]),ni=e=>{if(null!=e)return Array.isArray(e)?e.join(","):e.toString()};!function(){if("undefined"==typeof customElements)return;["gr-select","gr-button","gr-dropdown","gr-menu","gr-spinner","gr-tag"].forEach((e=>{switch(e){case"gr-select":customElements.get(e)||customElements.define(e,oi);break;case"gr-button":customElements.get(e)||St();break;case"gr-dropdown":customElements.get(e)||Xr();break;case"gr-menu":customElements.get(e)||Jr();break;case"gr-spinner":customElements.get(e)||Et();break;case"gr-tag":customElements.get(e)||ti()}}))}();const ai=oi,si=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.hasFocus=!1,this.checked=!1,this.value="",this.disabled=!1}connectedCallback(){this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleMouseEnter=this.handleMouseEnter.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this)}async setFocus(e){this.el.focus(e)}async removeFocus(){this.el.blur()}handleBlur(){this.hasFocus=!1}handleFocus(){this.hasFocus=!0}handleMouseEnter(){this.setFocus()}handleMouseLeave(){this.removeFocus()}render(){return de(ge,{class:{"menu-item-checked":this.checked,"menu-item-disabled":this.disabled,"menu-item-focused":this.hasFocus},role:"menuitem","aria-disabled":this.disabled?"true":"false","aria-checked":this.checked?"true":"false",tabIndex:this.disabled?null:0,onFocus:this.handleFocus,onBlur:this.handleBlur,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave},de("span",{class:"checkmark"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Checkmark"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M416 128L192 384l-96-96"}))),de("span",{class:"start"},de("slot",{name:"start"})),de("span",{class:"label"},de("slot",null)),de("span",{class:"end"},de("slot",{name:"end"})))}get el(){return this}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{--line-height:var(--gr-line-height-normal);--background-color:transparent;--background-color-focused:var(--gr-color-primary);--color:var(--gr-color-dark);--color-focused:var(--gr-color-primary-contrast);--color-disabled:var(--gr-color-medium);--padding-top:var(--gr-spacing-xx-small);--padding-start:var(--gr-spacing-x-large);--padding-end:var(--gr-spacing-x-large);--padding-bottom:var(--gr-spacing-xx-small);--transition:background-color 150ms linear, color 150ms linear;position:relative;display:flex;align-items:stretch;font-family:var(--gr-font-family);font-size:var(--gr-font-size-medium);font-weight:var(--gr-font-weight-normal);line-height:var(--line-height);letter-spacing:var(--gr-letter-spacing-normal);text-align:left;background-color:var(--background-color);color:var(--color);padding-top:var(--padding-top);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-bottom:var(--padding-bottom);transition:var(--transition);user-select:none;white-space:nowrap;cursor:pointer;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host(.menu-item-focused:not(.menu-item-disabled)){outline:none;background-color:var(--background-color-focused);color:var(--color-focused)}:host(.menu-item-disabled){outline:none;color:var(--color-disabled);cursor:not-allowed}.checkmark{display:flex;position:absolute;left:0.5em;top:calc(50% - 0.5em);visibility:hidden;align-items:center;font-size:inherit}.checkmark svg{display:inline-block;width:1.1em;height:1.1em;contain:strict;fill:currentcolor;box-sizing:content-box !important}:host(.menu-item-checked) .checkmark{visibility:visible}.label{flex:1 1 auto}.start{flex:0 0 auto;display:flex;align-items:center}.start ::slotted(:last-child){margin-right:0.5em}.end{flex:0 0 auto;display:flex;align-items:center}.end ::slotted(:first-child){margin-left:0.5em}"}},[1,"gr-menu-item",{checked:[516],value:[513],disabled:[516],hasFocus:[32],setFocus:[64],removeFocus:[64]}]); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */!function(){if("undefined"==typeof customElements)return;["gr-menu-item"].forEach((e=>{if("gr-menu-item"===e)customElements.get(e)||customElements.define(e,si)}))}();const li={"gr-select":ai,"gr-menu-item":si};class ci extends(q(_)){constructor(){super(...arguments),this.value=null,this.multiple=!1,this.clearable=!1,this._refSelect=y()}reset(){this.value=null}_valueChangedHandler(e){const t=this._refSelect.value?.value;if(void 0!==t&&!l(this.value,t)){const e=null===this.value;this.value=t,e||w(this,"select:change",t)}}willUpdate(e){e.has("initialValue")&&this.initialValue&&!this.value&&(this.value=this.initialValue)}render(){return $` + ${this.options?.map((e=>$`${e.label}`))} + `}static get styles(){return k(':root, :host {\n --gr-color-primary: #1079b2;\n --gr-color-primary-rgb: 16, 121, 178;\n --gr-color-primary-contrast: #ffffff;\n --gr-color-primary-contrast-rgb: 255, 255, 255;\n --gr-color-primary-shade: #0d6696;\n --gr-color-primary-tint: #1499e1;\n --gr-color-secondary: #051f2c;\n --gr-color-secondary-rgb: 5, 31, 44;\n --gr-color-secondary-contrast: #ffffff;\n --gr-color-secondary-contrast-rgb: 255, 255, 255;\n --gr-color-secondary-shade: #000000;\n --gr-color-secondary-tint: #0a415c;\n --gr-color-tertiary: #0c4a6e;\n --gr-color-tertiary-rgb: 12, 74, 110;\n --gr-color-tertiary-contrast: #ffffff;\n --gr-color-tertiary-contrast-rgb: 255, 255, 255;\n --gr-color-tertiary-shade: #083249;\n --gr-color-tertiary-tint: #106393;\n --gr-color-success: #0fbe78;\n --gr-color-success-rgb: 15, 190, 120;\n --gr-color-success-contrast: #000000;\n --gr-color-success-contrast-rgb: 0, 0, 0;\n --gr-color-success-shade: #057f4e;\n --gr-color-success-tint: #12e28f;\n --gr-color-warning: #fbbc4e;\n --gr-color-warning-rgb: 251, 188, 78;\n --gr-color-warning-contrast: #051f2c;\n --gr-color-warning-contrast-rgb: 5, 31, 44;\n --gr-color-warning-shade: #9e6400;\n --gr-color-warning-tint: #fdd187;\n --gr-color-danger: #e60017;\n --gr-color-danger-rgb: 230, 0, 23;\n --gr-color-danger-contrast: #ffffff;\n --gr-color-danger-contrast-rgb: 255, 255, 255;\n --gr-color-danger-shade: #cc0014;\n --gr-color-danger-tint: #ff1f35;\n --gr-color-light: #f4f5f8;\n --gr-color-light-rgb: 244, 245, 248;\n --gr-color-light-contrast: #051f2c;\n --gr-color-light-contrast-rgb: 5, 31, 44;\n --gr-color-light-shade: #d7d8da;\n --gr-color-light-tint: #f9fafb;\n --gr-color-medium: #5e6c78;\n --gr-color-medium-rgb: 94, 108, 120;\n --gr-color-medium-contrast: #ffffff;\n --gr-color-medium-contrast-rgb: 255, 255, 255;\n --gr-color-medium-shade: #48535b;\n --gr-color-medium-tint: #81909c;\n --gr-color-dark: #02131b;\n --gr-color-dark-rgb: 2, 19, 27;\n --gr-color-dark-contrast: #ffffff;\n --gr-color-dark-contrast-rgb: 255, 255, 255;\n --gr-color-dark-shade: #000000;\n --gr-color-dark-tint: #222428;\n --gr-color-white: #ffffff;\n --gr-color-black: #000000;\n --gr-border-radius-small: 0.125rem;\n --gr-border-radius-medium: 0.25rem;\n --gr-border-radius-large: 0.5rem;\n --gr-border-radius-x-large: 1rem;\n --gr-border-width-small: 0.063rem;\n --gr-border-width-medium: 0.125rem;\n --gr-border-width-large: 0.188rem;\n --gr-shadow-x-small: 0 1px 0 #0d131e0d;\n --gr-shadow-small: 0 1px 2px #0d131e1a;\n --gr-shadow-medium: 0 2px 4px #0d131e1a;\n --gr-shadow-large: 0 2px 8px #0d131e1a;\n --gr-shadow-x-large: 0 4px 16px #0d131e1a;\n --gr-spacing-xxx-small: 0.125rem;\n --gr-spacing-xx-small: 0.25rem;\n --gr-spacing-x-small: 0.5rem;\n --gr-spacing-small: 0.75rem;\n --gr-spacing-medium: 1rem;\n --gr-spacing-large: 1.25rem;\n --gr-spacing-x-large: 1.75rem;\n --gr-spacing-xx-large: 2.25rem;\n --gr-spacing-xxx-large: 3rem;\n --gr-spacing-xxxx-large: 4.5rem;\n --gr-font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,\n sans-serif;\n --gr-letter-spacing-dense: -0.015em;\n --gr-letter-spacing-normal: normal;\n --gr-letter-spacing-loose: 0.075em;\n --gr-line-height-dense: 1.4;\n --gr-line-height-normal: 1.8;\n --gr-line-height-loose: 2.2;\n --gr-font-size-xx-small: 0.625rem;\n --gr-font-size-x-small: 0.75rem;\n --gr-font-size-small: 0.875rem;\n --gr-font-size-medium: 1rem;\n --gr-font-size-large: 1.25rem;\n --gr-font-size-x-large: 1.5rem;\n --gr-font-size-xx-large: 2.25rem;\n --gr-font-size-xxx-large: 3rem;\n --gr-font-size-xxxx-large: 4.5rem;\n --gr-font-weight-thin: 100;\n --gr-font-weight-extra-light: 200;\n --gr-font-weight-light: 300;\n --gr-font-weight-normal: 400;\n --gr-font-weight-medium: 500;\n --gr-font-weight-semi-bold: 600;\n --gr-font-weight-bold: 700;\n --gr-font-weight-extra-bold: 800;\n --gr-font-weight-black: 900;\n --gr-form-element-font-size-x-small: var(--gr-font-size-x-small);\n --gr-form-element-font-size-small: var(--gr-font-size-small);\n --gr-form-element-font-size-medium: var(--gr-font-size-medium);\n --gr-form-element-font-size-large: var(--gr-font-size-large);\n --gr-form-element-height-small: 2.188rem;\n --gr-form-element-height-medium: 3.125rem;\n --gr-form-element-height-large: 4.063rem;\n --gr-form-element-border-radius-small: var(--gr-border-radius-medium);\n --gr-form-element-border-radius-medium: var(--gr-border-radius-medium);\n --gr-form-element-border-radius-large: var(--gr-border-radius-medium);\n --gr-focus-ring-width: 2px;\n --gr-form-element-label-font-size-small: var(--gr-font-size-small);\n --gr-form-element-label-font-size-medium: var(--gr-font-size-medium);\n --gr-form-element-label-font-size-large: var(--gr-font-size-large);\n --gr-form-element-label-color: inherit;\n --gr-form-element-help-text-font-size-small: var(--gr-font-size-x-small);\n --gr-form-element-help-text-font-size-medium: var(--gr-font-size-small);\n --gr-form-element-help-text-font-size-large: var(--gr-font-size-medium);\n --gr-form-element-help-text-color: var(--gr-color-medium);\n --gr-form-element-invalid-text-font-size-small: var(--gr-font-size-x-small);\n --gr-form-element-invalid-text-font-size-medium: var(--gr-font-size-small);\n --gr-form-element-invalid-text-font-size-large: var(--gr-font-size-medium);\n --gr-form-element-invalid-text-color: var(--gr-color-danger);\n --gr-toggle-size: 1rem;\n --gr-panel-border-color: var(--gr-color-light-shade);\n --gr-z-index-dropdown: 900;\n}\n\n')}}ci.elementDefinitions={...li},f([v({attribute:!1,hasChanged:b})],ci.prototype,"options",void 0),f([v({attribute:!1,hasChanged:b})],ci.prototype,"value",void 0),f([v({attribute:!1,hasChanged:b})],ci.prototype,"initialValue",void 0),f([v({attribute:!0})],ci.prototype,"label",void 0),f([v({attribute:!0})],ci.prototype,"placeholder",void 0),f([v({attribute:!0,type:Boolean})],ci.prototype,"multiple",void 0),f([v({attribute:!0,type:Boolean})],ci.prototype,"clearable",void 0);let di=class extends(q(_)){constructor(){super(...arguments),this._mediaFilterController=new U(this),this._refMediaType=y(),this._refCamera=y(),this._refWhen=y(),this._refWhenFrom=y(),this._refWhenTo=y(),this._refWhat=y(),this._refWhere=y(),this._refFavorite=y(),this._refTags=y()}willUpdate(e){e.has("viewManagerEpoch")&&this._mediaFilterController.setViewManager(this.viewManagerEpoch?.manager??null),e.has("cameraManager")&&this.cameraManager&&(this._mediaFilterController.computeCameraOptions(this.cameraManager),this._mediaFilterController.computeMetadataOptions(this.cameraManager)),!e.get("viewManager")&&this.viewManagerEpoch&&this.cameraManager&&this._mediaFilterController.computeInitialDefaultsFromView(this.cameraManager)}render(){const e=async()=>{this.cameraManager&&this.viewManagerEpoch&&this.cardWideConfig&&await this._mediaFilterController.valueChangeHandler(this.cameraManager,this.cardWideConfig,{camera:this._refCamera.value?.value??void 0,mediaType:this._refMediaType.value?.value??void 0,when:{selected:this._refWhen.value?.value??void 0,from:this._refWhenFrom.value?.value,to:this._refWhenTo.value?.value},favorite:this._refFavorite.value?.value??void 0,where:this._refWhere.value?.value??void 0,what:this._refWhat.value?.value??void 0,tags:this._refTags.value?.value??void 0})},t=async t=>{"custom"===t&&this._refWhen.value?this._refWhenFrom.value?.value||this._refWhenTo.value?.value?this._refWhen.value.value=B.Custom:this._refWhen.value.reset():this._refWhen.value?.value!==B.Custom&&(this._refWhenFrom.value?.reset(),this._refWhenTo.value?.reset()),await e()};if(!this.cameraManager||!this.viewManagerEpoch)return;const r=this._mediaFilterController.getControlsToShow(this.cameraManager),o=this._mediaFilterController.getDefaults(),n=this._mediaFilterController.getWhatOptions(),a=this._mediaFilterController.getTagsOptions(),s=this._mediaFilterController.getWhereOptions();return $` e()} + > + +
+ t("selected")} + > + + t("custom")} + > + + t("custom")} + > + +
+ e()} + > + + ${r.events&&n.length?$` e()} + > + `:""} + ${r.events&&a.length?$` e()} + > + `:""} + ${r.events&&s.length?$` e()} + > + `:""} + ${r.favorites?$` + e()} + > + + `:""}`}static get styles(){return k(":host {\n display: flex;\n flex-direction: column;\n overflow: auto;\n scrollbar-width: none;\n -ms-overflow-style: none;\n height: 100%;\n width: 300px;\n margin: 5px;\n}\n\n/* Hide scrollbar for Chrome, Safari and Opera */\n:host::-webkit-scrollbar {\n display: none;\n}\n\nfrigate-card-select {\n padding: 5px;\n}\n\ndiv.when {\n display: inline-flex;\n align-items: flex-end;\n}\n\ndiv.when frigate-card-select {\n flex: 1;\n}\n\ndiv.when frigate-card-date-picker {\n padding-bottom: 5px;\n transition: width 0.5s ease-in-out;\n}\n\ndiv.when frigate-card-date-picker {\n color: var(--secondary-color);\n}\n\ndiv.when frigate-card-date-picker.selected {\n color: var(--primary-color);\n}\n\ndiv.when frigate-card-date-picker.hidden {\n width: 0px;\n}")}};di.elementDefinitions={"frigate-card-select":ci,"frigate-card-date-picker":R},f([v({attribute:!1})],di.prototype,"hass",void 0),f([v({attribute:!1})],di.prototype,"cameraManager",void 0),f([v({attribute:!1})],di.prototype,"viewManagerEpoch",void 0),f([v({attribute:!1})],di.prototype,"cardWideConfig",void 0),di=f([C("frigate-card-media-filter")],di);const hi={closed:"mdi:filter-cog-outline",open:"mdi:filter-cog"};let gi=class extends _{render(){const e=this.viewManagerEpoch?.manager.getView();if(this.hass&&e?.isGalleryView()&&this.cameraManager&&this.cardWideConfig)return $` + + ${this.galleryConfig&&"none"!==this.galleryConfig.controls.filter.mode?$` + `:""} + + + + `}static get styles(){return k(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\nfrigate-card-surround-basic {\n max-height: 110dvh;\n}")}};f([v({attribute:!1})],gi.prototype,"hass",void 0),f([v({attribute:!1})],gi.prototype,"viewManagerEpoch",void 0),f([v({attribute:!1})],gi.prototype,"galleryConfig",void 0),f([v({attribute:!1})],gi.prototype,"cameraManager",void 0),f([v({attribute:!1})],gi.prototype,"cardWideConfig",void 0),gi=f([C("frigate-card-gallery")],gi);let ui=class extends _{constructor(){super(),this._refLoaderBottom=y(),this._refSelected=y(),this._showLoaderBottom=!0,this._showLoaderTop=!1,this._boundWheelHandler=this._wheelHandler.bind(this),this._boundTouchStartHandler=this._touchStartHandler.bind(this),this._boundTouchEndHandler=this._touchEndHandler.bind(this),this._throttleExtendGalleryLater=O(this._extendGallery.bind(this),500,{leading:!0,trailing:!1}),this._touchScrollYPosition=null,this._resizeObserver=new ResizeObserver(this._resizeHandler.bind(this)),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}_touchStartHandler(e){1===e.touches.length?this._touchScrollYPosition=e.touches[0].screenY:this._touchScrollYPosition=null}async _touchEndHandler(e){!this.scrollTop&&1===e.changedTouches.length&&this._touchScrollYPosition&&e.changedTouches[0].screenY>this._touchScrollYPosition&&await this._extendLater(),this._touchScrollYPosition=null}async _wheelHandler(e){!this.scrollTop&&e.deltaY<0&&await this._extendLater()}async _extendLater(){const e=new Date;this._showLoaderTop=!0,await this._throttleExtendGalleryLater("later",!1);const t=(new Date).getTime()-e.getTime();t<500&&await S(.5-t/1e3),this._showLoaderTop=!1}connectedCallback(){super.connectedCallback(),this._resizeObserver.observe(this),this.addEventListener("wheel",this._boundWheelHandler,{passive:!0}),this.addEventListener("touchstart",this._boundTouchStartHandler,{passive:!0}),this.addEventListener("touchend",this._boundTouchEndHandler),this.requestUpdate()}disconnectedCallback(){this.removeEventListener("wheel",this._boundWheelHandler),this.removeEventListener("touchstart",this._boundTouchStartHandler),this.removeEventListener("touchend",this._boundTouchEndHandler),this._resizeObserver.disconnect(),this._intersectionObserver.disconnect(),super.disconnectedCallback()}_setColumnCount(){const e=this.galleryConfig?.controls.thumbnails.size??M.media_gallery.controls.thumbnails.size,t=this.galleryConfig?.controls.thumbnails.show_details?Math.max(1,Math.floor(this.clientWidth/z)):Math.max(1,Math.ceil(this.clientWidth/e));this.style.setProperty("--frigate-card-gallery-columns",String(t))}_resizeHandler(){this._setColumnCount()}async _intersectionHandler(e){e.every((e=>!e.isIntersecting))||(this._showLoaderBottom=!1,await this._extendGallery("earlier"))}async _extendGallery(e,t=!0){const r=this.viewManagerEpoch?.manager.getView();if(!this.cameraManager||!this.hass||!r)return;const i=r.query,n=i?.getQueries()??null,s=r.queryResults?.getResults();if(!i||!n||!s)return;let l;try{l=await this.cameraManager.extendMediaQueries(n,s,e,{useCache:t})}catch(e){return void d(e)}if(l){const e=c.areEventQueries(i)?new o(l.queries):c.areRecordingQueries(i)?new a(l.queries):null;e&&this.viewManagerEpoch?.manager.setViewByParameters({baseView:r,params:{query:e,queryResults:new L({results:l.results}).selectResultIfFound((e=>e===r.queryResults?.getSelectedResult()))}})}}willUpdate(e){if(e.has("galleryConfig")&&(this.galleryConfig?.controls.thumbnails.show_details?this.setAttribute("details",""):this.removeAttribute("details"),this._setColumnCount(),this.galleryConfig?.controls.thumbnails.size&&this.style.setProperty("--frigate-card-thumbnail-size",`${this.galleryConfig.controls.thumbnails.size}px`)),e.has("viewManagerEpoch")){this._showLoaderBottom=!0;const e=this.viewManagerEpoch?.manager.getView(),t=this.viewManagerEpoch?.oldView;this._media&&t?.queryResults?.getResults()===e?.queryResults?.getResults()||(this._media=[...e?.queryResults?.getResults()??[]].reverse())}}render(){if(!this._media||!this.hass)return $``;const e=this.viewManagerEpoch?.manager.getView();if(!e?.queryResults||0===e.queryResults.getResultsCount()){const t=!!e?.context?.loading?.query;return D({type:"info",message:i(t?"error.awaiting_media":"common.no_media"),icon:"mdi:multimedia",dotdotdot:t})}const t=e.queryResults.getSelectedResult();return $`
+ ${this._showLoaderTop?$`${A({cardWideConfig:this.cardWideConfig,classes:{top:!0},size:"small"})}`:""} + ${this._media.map(((r,i)=>$`{this._media&&this.viewManagerEpoch?.manager.setViewByParameters({params:{view:"media",queryResults:e.queryResults?.clone().selectIndex(this._media.length-i-1)}}),F(t)}} + > + `))} + ${this._showLoaderBottom?$`${A({cardWideConfig:this.cardWideConfig,componentRef:this._refLoaderBottom})}`:""} +
`}updated(e){this._refLoaderBottom.value&&(this._intersectionObserver.disconnect(),this._intersectionObserver.observe(this._refLoaderBottom.value)),this.updateComplete.then((()=>{e.has("viewManagerEpoch")&&!e.get("viewManagerEpoch")&&this._refSelected.value&&this._refSelected.value.scrollIntoView({block:"center"})}))}static get styles(){return k(":host {\n width: 100%;\n height: 100%;\n display: block;\n overflow: auto;\n -ms-overflow-style: none;\n scrollbar-width: none;\n --frigate-card-gallery-gap: 3px;\n --frigate-card-gallery-columns: 4;\n}\n\n.grid {\n display: grid;\n grid-template-columns: repeat(var(--frigate-card-gallery-columns), minmax(0, 1fr));\n grid-auto-rows: min-content;\n gap: var(--frigate-card-gallery-gap);\n}\n\n:host::-webkit-scrollbar {\n display: none;\n}\n\nfrigate-card-thumbnail {\n height: 100%;\n max-height: var(--frigate-card-thumbnail-size);\n}\n\nfrigate-card-thumbnail:not([details]) {\n width: 100%;\n}\n\nfrigate-card-thumbnail.selected {\n border: 4px solid var(--accent-color);\n border-radius: calc(var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px)) + 4px);\n}\n\nfrigate-card-progress-indicator.top {\n grid-column: 1/-1;\n}")}};f([v({attribute:!1})],ui.prototype,"hass",void 0),f([v({attribute:!1})],ui.prototype,"viewManagerEpoch",void 0),f([v({attribute:!1})],ui.prototype,"galleryConfig",void 0),f([v({attribute:!1})],ui.prototype,"cameraManager",void 0),f([v({attribute:!1})],ui.prototype,"cardWideConfig",void 0),f([E()],ui.prototype,"_showLoaderBottom",void 0),f([E()],ui.prototype,"_showLoaderTop",void 0),ui=f([C("frigate-card-gallery-core")],ui);export{gi as FrigateCardGallery,ui as FrigateCardGalleryCore}; diff --git a/config/www/community/frigate-hass-card/gallery-bf3892f1.js.gz b/config/www/community/frigate-hass-card/gallery-bf3892f1.js.gz new file mode 100644 index 00000000..3f00b875 Binary files /dev/null and b/config/www/community/frigate-hass-card/gallery-bf3892f1.js.gz differ diff --git a/config/www/community/frigate-hass-card/gallery-c718155d.js b/config/www/community/frigate-hass-card/gallery-c718155d.js new file mode 100644 index 00000000..2cebd1d1 --- /dev/null +++ b/config/www/community/frigate-hass-card/gallery-c718155d.js @@ -0,0 +1,184 @@ +import{d3 as e,d4 as t,d5 as r,l as i,d6 as o,d7 as n,d8 as a,d9 as s,i as l,da as c,db as d,k as h,dc as g,dd as u,de as m,df as p,_ as f,n as v,cW as b,cR as y,dg as w,x as $,cV as x,r as k,a as _,t as C,e as T,b as E,dh as O,di as S,cI as M,dj as z,dk as L,cU as D,dl as A,c$ as F}from"./card-c642ee74.js";import{e as I}from"./endOfDay-97ae2cc7.js";import{p as W}from"./parse-a53fb39b.js";import{F as R}from"./date-picker-cfd85f75.js";function N(t){const r=e(t),i=r.getMonth();return r.setFullYear(r.getFullYear(),i+1,0),r.setHours(23,59,59,999),r}function H(){const e=new Date,t=e.getFullYear(),r=e.getMonth(),i=e.getDate(),o=new Date(0);return o.setFullYear(t,r,i-1),o.setHours(23,59,59,999),o}function V(){const e=new Date,t=e.getFullYear(),r=e.getMonth(),i=e.getDate(),o=new Date(0);return o.setFullYear(t,r,i-1),o.setHours(0,0,0,0),o}var j,B,q; +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +function P(e){return class extends e{createRenderRoot(){const e=this.constructor,{registry:t,elementDefinitions:i,shadowRootOptions:o}=e;i&&!t&&(e.registry=new CustomElementRegistry,Object.entries(i).forEach((([t,r])=>e.registry.define(t,r))));const n=this.renderOptions.creationScope=this.attachShadow({...o,customElements:e.registry});return r(n,this.constructor.elementStyles),n}}}!function(e){e.Favorite="favorite",e.NotFavorite="not-favorite"}(j||(j={})),function(e){e.Today="today",e.Yesterday="yesterday",e.PastWeek="past-week",e.PastMonth="past-month",e.Custom="custom"}(B||(B={})),function(e){e.Clips="clips",e.Snapshots="snapshots",e.Recordings="recordings"}(q||(q={}));class U{constructor(e){this._cameraOptions=[],this._whenOptions=[],this._metaDataWhenOptions=[],this._whatOptions=[],this._whereOptions=[],this._tagsOptions=[],this._defaults=null,this._viewManager=null,this._host=e,this._favoriteOptions=[{value:j.Favorite,label:i("media_filter.favorite")},{value:j.NotFavorite,label:i("media_filter.not_favorite")}],this._mediaTypeOptions=[{value:q.Clips,label:i("media_filter.media_types.clips")},{value:q.Snapshots,label:i("media_filter.media_types.snapshots")},{value:q.Recordings,label:i("media_filter.media_types.recordings")}],this._staticWhenOptions=[{value:B.Today,label:i("media_filter.whens.today")},{value:B.Yesterday,label:i("media_filter.whens.yesterday")},{value:B.PastWeek,label:i("media_filter.whens.past_week")},{value:B.PastMonth,label:i("media_filter.whens.past_month")},{value:B.Custom,label:i("media_filter.whens.custom")}],this._computeWhenOptions()}getMediaTypeOptions(){return this._mediaTypeOptions}getCameraOptions(){return this._cameraOptions}getWhenOptions(){return this._whenOptions}getWhatOptions(){return this._whatOptions}getWhereOptions(){return this._whereOptions}getTagsOptions(){return this._tagsOptions}getFavoriteOptions(){return this._favoriteOptions}getDefaults(){return this._defaults}setViewManager(e){this._viewManager=e}async valueChangeHandler(e,t,r,i){const s=e=>e&&Array.isArray(e)&&e.length&&!e.includes("")?new Set([...e]):null,l=s(r.camera)??this._getAllCameraIDs(e);if(!l.size||!r.mediaType)return;const c=this._getWhen(r.when),d=r.favorite?r.favorite===j.Favorite:null,h=t.performance?.features.media_chunk_size;if(r.mediaType===q.Clips||r.mediaType===q.Snapshots){const e=s(r.where),t=s(r.what),i=s(r.tags),a=new o([{type:n.Event,cameraIDs:l,...i&&{tags:i},...t&&{what:t},...e&&{where:e},...null!==d&&{favorite:d},...c&&{...c.start&&{start:c.start},...c.end&&{end:c.end}},...h&&{limit:h},...r.mediaType===q.Clips&&{hasClip:!0},...r.mediaType===q.Snapshots&&{hasSnapshot:!0}}]);this._viewManager?.setViewByParametersWithExistingQuery({params:{query:a,...1===l.size&&{camera:[...l][0]},view:r.mediaType===q.Clips?"clips":"snapshots"}})}else{const e=new a([{type:n.Recording,cameraIDs:l,...h&&{limit:h},...c&&{...c.start&&{start:c.start},...c.end&&{end:c.end}},...null!==d&&{favorite:d}}]);this._viewManager?.setViewByParametersWithExistingQuery({params:{query:e,...1===l.size&&{camera:[...l][0]},view:"recordings"}})}this._host.requestUpdate()}_getAllCameraIDs(e){return e.getStore().getCameraIDsWithCapability({anyCapabilities:["clips","snapshots","recordings"]})}computeInitialDefaultsFromView(e){const t=this._viewManager?.getView(),r=t?.query?.getQueries(),i=this._getAllCameraIDs(e);if(!t||!r||!i.size)return;let o,n,a,d,h,g;1!==s(r.map((e=>e.cameraIDs)),l).length||l(r[0].cameraIDs,i)||(n=[...r[0].cameraIDs]); +/* istanbul ignore else: the else path cannot be reached -- @preserve */ +if(1===s(r.map((e=>e.favorite)),l).length&&void 0!==r[0].favorite&&(h=r[0].favorite?j.Favorite:j.NotFavorite),c.areEventQueries(t.query)){const e=t.query.getQueries(); +/* istanbul ignore if: the if path cannot be reached -- @preserve */if(!e)return;const r=s(e.map((e=>e.hasClip)),l),i=s(e.map((e=>e.hasSnapshot)),l);1===r.length&&1===i.length&&(o=r[0]?q.Clips:i[0]?q.Snapshots:void 0);1===s(e.map((e=>e.what)),l).length&&e[0].what?.size&&(a=[...e[0].what]);1===s(e.map((e=>e.where)),l).length&&e[0].where?.size&&(d=[...e[0].where]);1===s(e.map((e=>e.tags)),l).length&&e[0].tags?.size&&(g=[...e[0].tags])}else c.areRecordingQueries(t.query)&&(o=q.Recordings);this._defaults={...o&&{mediaType:o},...n&&{cameraIDs:n},...a&&{what:a},...d&&{where:d},...void 0!==h&&{favorite:h},...g&&{tags:g}}}computeCameraOptions(e){this._cameraOptions=[...this._getAllCameraIDs(e)].map((t=>({value:t,label:e.getCameraMetadata(t)?.title??t})))}async computeMetadataOptions(e){let t=null;try{t=await e.getMediaMetadata()}catch(e){d(e)}if(t){if(t.what&&(this._whatOptions=[...t.what].sort().map((e=>({value:e,label:h(e)})))),t.where&&(this._whereOptions=[...t.where].sort().map((e=>({value:e,label:h(e)})))),t.tags&&(this._tagsOptions=[...t.tags].sort().map((e=>({value:e,label:h(e)})))),t.days){const e=new Set;[...t.days].forEach((t=>{e.add(t.substring(0,7))}));const r=[];e.forEach((e=>{r.push(W(e,"yyyy-MM",new Date))})),this._metaDataWhenOptions=g(r,(e=>e.getTime()),"desc").map((e=>({label:u(e,"MMMM yyyy"),value:this._dateRangeToString({start:e,end:N(e)})}))),this._computeWhenOptions()}this._host.requestUpdate()}}getControlsToShow(e){const t=this._viewManager?.getView(),r=c.areEventQueries(t?.query),i=c.areRecordingQueries(t?.query),o=e.getAggregateCameraCapabilities();return{events:r,recordings:i,favorites:r?o?.has("favorite-events"):!!i&&o?.has("favorite-recordings")}}_computeWhenOptions(){this._whenOptions=[...this._staticWhenOptions,...this._metaDataWhenOptions]}_dateRangeToString(e){return`${m(e.start)},${m(e.end)}`}_stringToDateRange(e){const t=e.split(",");return{start:W(t[0],"yyyy-MM-dd",new Date),end:I(W(t[1],"yyyy-MM-dd",new Date))}}_getWhen(e){if(e.from||e.to)return{...e.from&&{start:e.from},...e.to&&{end:e.to}};if(!e.selected||Array.isArray(e.selected))return null;const r=new Date;switch(e.selected){case B.Custom:return null;case B.Today:return{start:t(Date.now()),end:I(Date.now())};case B.Yesterday:return{start:V(),end:H()};case B.PastWeek:return{start:t(p(r,{days:7})),end:I(r)};case B.PastMonth:return{start:t(p(r,{months:1})),end:I(r)};default:return this._stringToDateRange(e.selected)}}}const K=!0,Y=!0,Q=!0,G=!1,X=!1;let Z,J,ee,te=!1,re=!1,ie=!1,oe=!1,ne=null,ae=!1;const se="http://www.w3.org/1999/xlink",le={},ce=e=>"object"===(e=typeof e)||"function"===e;const de=(e,t,...r)=>{let i=null,o=null,n=null,a=!1,s=!1;const l=[],c=t=>{for(let r=0;re[t])).join(" "))}}if("function"==typeof e)return e(null===t?{}:t,l,ue);const d=he(e,null);return d.$attrs$=t,l.length>0&&(d.$children$=l),d.$key$=o,d.$name$=n,d},he=(e,t)=>{const r={$flags$:0,$tag$:e,$text$:t,$elm$:null,$children$:null,$attrs$:null,$key$:null,$name$:null};return r},ge={},ue={forEach:(e,t)=>e.map(me).forEach(t),map:(e,t)=>e.map(me).map(t).map(pe)},me=e=>({vattrs:e.$attrs$,vchildren:e.$children$,vkey:e.$key$,vname:e.$name$,vtag:e.$tag$,vtext:e.$text$}),pe=e=>{if("function"==typeof e.vtag){const t=Object.assign({},e.vattrs);return e.vkey&&(t.key=e.vkey),e.vname&&(t.name=e.vname),de(e.vtag,t,...e.vchildren||[])}const t=he(e.vtag,e.vtext);return t.$attrs$=e.vattrs,t.$children$=e.vchildren,t.$key$=e.vkey,t.$name$=e.vname,t},fe=(e,t,r)=>{const i=e;return{emit:e=>ve(i,t,{bubbles:!!(4&r),composed:!!(2&r),cancelable:!!(1&r),detail:e})}},ve=(e,t,r)=>{const i=ht.ce(t,r);return e.dispatchEvent(i),i},be=new WeakMap,ye=e=>{const t=e.$cmpMeta$,r=e.$hostElement$,i=t.$flags$,o=(t.$tagName$,()=>{}),n=((e,t,r,i)=>{var o;let n=we(t,r);const a=at.get(n);if(e=11===e.nodeType?e:ct,a)if("string"==typeof a){e=e.head||e;let t,r=be.get(e);if(r||be.set(e,r=new Set),!r.has(n)){{t=ct.createElement("style"),t.innerHTML=a;const r=null!==(o=ht.$nonce$)&&void 0!==o?o:function(e){var t,r,i;return null!==(i=null===(r=null===(t=e.head)||void 0===t?void 0:t.querySelector('meta[name="csp-nonce"]'))||void 0===r?void 0:r.getAttribute("content"))&&void 0!==i?i:void 0}(ct);null!=r&&t.setAttribute("nonce",r),e.insertBefore(t,e.querySelector("link"))}r&&r.add(n)}}else e.adoptedStyleSheets.includes(a)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,a]);return n})(r.shadowRoot?r.shadowRoot:r.getRootNode(),t,e.$modeName$);10&i&&(r["s-sc"]=n,r.classList.add(n+"-h"),2&i&&r.classList.add(n+"-s")),o()},we=(e,t)=>"sc-"+(t&&32&e.$flags$?e.$tagName$+"-"+t:e.$tagName$),$e=(e,t,r,i,o,n)=>{if(r!==i){let a=ot(e,t),s=t.toLowerCase();if("class"===t){const t=e.classList,o=ke(r),n=ke(i);t.remove(...o.filter((e=>e&&!n.includes(e)))),t.add(...n.filter((e=>e&&!o.includes(e))))}else if("style"===t){for(const t in r)i&&null!=i[t]||(t.includes("-")?e.style.removeProperty(t):e.style[t]="");for(const t in i)r&&i[t]===r[t]||(t.includes("-")?e.style.setProperty(t,i[t]):e.style[t]=i[t])}else if("key"===t);else if("ref"===t)i&&i(e);else if(e.__lookupSetter__(t)||"o"!==t[0]||"n"!==t[1]){const l=ce(i);if((a||l&&null!==i)&&!o)try{if(e.tagName.includes("-"))e[t]=i;else{const o=null==i?"":i;"list"===t?a=!1:null!=r&&e[t]==o||(e[t]=o)}}catch(e){}let c=!1;s!==(s=s.replace(/^xlink\:?/,""))&&(t=s,c=!0),null==i||!1===i?!1===i&&""!==e.getAttribute(t)||(c?e.removeAttributeNS(se,t):e.removeAttribute(t)):(!a||4&n||o)&&!l&&(i=!0===i?"":i,c?e.setAttributeNS(se,t,i):e.setAttribute(t,i))}else t="-"===t[2]?t.slice(3):ot(lt,s)?s.slice(2):s[2]+t.slice(3),r&&ht.rel(e,t,r,!1),i&&ht.ael(e,t,i,!1)}},xe=/\s/,ke=e=>e?e.split(xe):[],_e=(e,t,r,i)=>{const o=11===t.$elm$.nodeType&&t.$elm$.host?t.$elm$.host:t.$elm$,n=e&&e.$attrs$||le,a=t.$attrs$||le;for(i in n)i in a||$e(o,i,n[i],void 0,r,t.$flags$);for(i in a)$e(o,i,n[i],a[i],r,t.$flags$)},Ce=(e,t,r,i)=>{const o=t.$children$[r];let n,a,s,l=0;if(te||(ie=!0,"slot"===o.$tag$&&(Z&&i.classList.add(Z+"-s"),o.$flags$|=o.$children$?2:1)),null!==o.$text$)n=o.$elm$=ct.createTextNode(o.$text$);else if(1&o.$flags$)n=o.$elm$=ct.createTextNode("");else{if(oe||(oe="svg"===o.$tag$),n=o.$elm$=ct.createElementNS(oe?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",2&o.$flags$?"slot-fb":o.$tag$),oe&&"foreignObject"===o.$tag$&&(oe=!1),_e(null,o,oe),null!=Z&&n["s-si"]!==Z&&n.classList.add(n["s-si"]=Z),o.$children$)for(l=0;l{ht.$flags$|=1;const r=e.childNodes;for(let e=r.length-1;e>=0;e--){const i=r[e];i["s-hn"]!==ee&&i["s-ol"]&&(ze(i).insertBefore(i,Me(i)),i["s-ol"].remove(),i["s-ol"]=void 0,ie=!0),t&&Te(i,t)}ht.$flags$&=-2},Ee=(e,t,r,i,o,n)=>{let a,s=e["s-cr"]&&e["s-cr"].parentNode||e;for(s.shadowRoot&&s.tagName===ee&&(s=s.shadowRoot);o<=n;++o)i[o]&&(a=Ce(null,r,o,e),a&&(i[o].$elm$=a,s.insertBefore(a,Me(t))))},Oe=(e,t,r,i,o)=>{for(;t<=r;++t)(i=e[t])&&(o=i.$elm$,We(i),re=!0,o["s-ol"]?o["s-ol"].remove():Te(o,!0),o.remove())},Se=(e,t)=>e.$tag$===t.$tag$&&("slot"===e.$tag$?e.$name$===t.$name$:e.$key$===t.$key$),Me=e=>e&&e["s-ol"]||e,ze=e=>(e["s-ol"]?e["s-ol"]:e).parentNode,Le=(e,t)=>{const r=t.$elm$=e.$elm$,i=e.$children$,o=t.$children$,n=t.$tag$,a=t.$text$;let s;null===a?(oe="svg"===n||"foreignObject"!==n&&oe,"slot"===n||_e(e,t,oe),null!==i&&null!==o?((e,t,r,i)=>{let o,n,a=0,s=0,l=0,c=0,d=t.length-1,h=t[0],g=t[d],u=i.length-1,m=i[0],p=i[u];for(;a<=d&&s<=u;)if(null==h)h=t[++a];else if(null==g)g=t[--d];else if(null==m)m=i[++s];else if(null==p)p=i[--u];else if(Se(h,m))Le(h,m),h=t[++a],m=i[++s];else if(Se(g,p))Le(g,p),g=t[--d],p=i[--u];else if(Se(h,p))"slot"!==h.$tag$&&"slot"!==p.$tag$||Te(h.$elm$.parentNode,!1),Le(h,p),e.insertBefore(h.$elm$,g.$elm$.nextSibling),h=t[++a],p=i[--u];else if(Se(g,m))"slot"!==h.$tag$&&"slot"!==p.$tag$||Te(g.$elm$.parentNode,!1),Le(g,m),e.insertBefore(g.$elm$,h.$elm$),g=t[--d],m=i[++s];else{for(l=-1,c=a;c<=d;++c)if(t[c]&&null!==t[c].$key$&&t[c].$key$===m.$key$){l=c;break}l>=0?(n=t[l],n.$tag$!==m.$tag$?o=Ce(t&&t[s],r,l,e):(Le(n,m),t[l]=void 0,o=n.$elm$),m=i[++s]):(o=Ce(t&&t[s],r,s,e),m=i[++s]),o&&ze(h.$elm$).insertBefore(o,Me(h.$elm$))}a>d?Ee(e,null==i[u+1]?null:i[u+1].$elm$,r,i,s,u):s>u&&Oe(t,a,d)})(r,i,t,o):null!==o?(null!==e.$text$&&(r.textContent=""),Ee(r,null,t,o,0,o.length-1)):null!==i&&Oe(i,0,i.length-1),oe&&"svg"===n&&(oe=!1)):(s=r["s-cr"])?s.parentNode.textContent=a:e.$text$!==a&&(r.data=a)},De=e=>{const t=e.childNodes;let r,i,o,n,a,s;for(i=0,o=t.length;i{let t,r,i,o,n,a,s=0;const l=e.childNodes,c=l.length;for(;s=0;a--)r=i[a],r["s-cn"]||r["s-nr"]||r["s-hn"]===t["s-hn"]||(Ie(r,o)?(n=Ae.find((e=>e.$nodeToRelocate$===r)),re=!0,r["s-sn"]=r["s-sn"]||o,n?n.$slotRefNode$=t:Ae.push({$slotRefNode$:t,$nodeToRelocate$:r}),r["s-sr"]&&Ae.map((e=>{Ie(e.$nodeToRelocate$,r["s-sn"])&&(n=Ae.find((e=>e.$nodeToRelocate$===r)),n&&!e.$slotRefNode$&&(e.$slotRefNode$=n.$slotRefNode$))}))):Ae.some((e=>e.$nodeToRelocate$===r))||Ae.push({$nodeToRelocate$:r}));1===t.nodeType&&Fe(t)}},Ie=(e,t)=>1===e.nodeType?null===e.getAttribute("slot")&&""===t||e.getAttribute("slot")===t:e["s-sn"]===t||""===t,We=e=>{e.$attrs$&&e.$attrs$.ref&&e.$attrs$.ref(null),e.$children$&&e.$children$.map(We)},Re=(e,t)=>{const r=e.$hostElement$,i=e.$cmpMeta$,o=e.$vnode$||he(null,null),n=(a=t)&&a.$tag$===ge?t:de(null,null,t);var a;if(ee=r.tagName,i.$attrsToReflect$&&(n.$attrs$=n.$attrs$||{},i.$attrsToReflect$.map((([e,t])=>n.$attrs$[t]=r[e]))),n.$tag$=null,n.$flags$|=4,e.$vnode$=n,n.$elm$=o.$elm$=r.shadowRoot||r,Z=r["s-sc"],J=r["s-cr"],te=!!(1&i.$flags$),re=!1,Le(o,n),ht.$flags$|=1,ie){let e,t,r,i,o,a;Fe(n.$elm$);let s=0;for(;s{e.$flags$|=16,e.$ancestorComponent$;return $t((()=>He(e,t)))},He=(e,t)=>{const r=e.$hostElement$,i=(e.$cmpMeta$.$tagName$,()=>{}),o=r;let n;return n=qe(o,t?"componentWillLoad":"componentWillUpdate"),n=Pe(n,(()=>qe(o,"componentWillRender"))),i(),Pe(n,(()=>Ve(e,o,t)))},Ve=async(e,t,r)=>{const i=e.$hostElement$,o=(e.$cmpMeta$.$tagName$,()=>{});i["s-rc"],r&&ye(e);const n=(e.$cmpMeta$.$tagName$,()=>{});je(e,t,i),n(),o(),Be(e)},je=(e,t,r)=>{try{ne=t,t=t.render&&t.render(),e.$flags$&=-17,e.$flags$|=2,(K||Y)&&(Q||Y)&&(G||Re(e,t))}catch(t){nt(t,e.$hostElement$)}return ne=null,null},Be=e=>{e.$cmpMeta$.$tagName$;const t=()=>{},r=e.$hostElement$;e.$ancestorComponent$,qe(r,"componentDidRender"),64&e.$flags$?(qe(r,"componentDidUpdate"),t()):(e.$flags$|=64,qe(r,"componentDidLoad"),t())},qe=(e,t,r)=>{if(e&&e[t])try{return e[t](r)}catch(e){nt(e)}},Pe=(e,t)=>e&&e.then?e.then(t):t(),Ue=(e,t,r,i)=>{const o=rt(e),n=e,a=o.$instanceValues$.get(t),s=o.$flags$,l=n;var c,d;c=r,d=i.$members$[t][0],r=null==c||ce(c)?c:4&d?"false"!==c&&(""===c||!!c):2&d?parseFloat(c):1&d?String(c):c;const h=Number.isNaN(a)&&Number.isNaN(r);if(r!==a&&!h){if(o.$instanceValues$.set(t,r),i.$watchers$&&128&s){const e=i.$watchers$[t];e&&e.map((e=>{try{l[e](r,a,t)}catch(e){nt(e,n)}}))}if(2==(18&s)){if(l.componentShouldUpdate&&!1===l.componentShouldUpdate(r,a,t))return;Ne(o,!1)}}},Ke=(e,t,r)=>{if(t.$members$){e.watchers&&(t.$watchers$=e.watchers);const r=Object.entries(t.$members$),i=e.prototype;r.map((([e,[r]])=>{(31&r||32&r)&&Object.defineProperty(i,e,{get(){return t=e,rt(this).$instanceValues$.get(t);var t},set(r){Ue(this,e,r,t)},configurable:!0,enumerable:!0})}));{const o=new Map;i.attributeChangedCallback=function(e,t,r){ht.jmp((()=>{const t=o.get(e);if(this.hasOwnProperty(t))r=this[t],delete this[t];else if(i.hasOwnProperty(t)&&"number"==typeof this[t]&&this[t]==r)return;this[t]=(null!==r||"boolean"!=typeof this[t])&&r}))},e.observedAttributes=r.filter((([e,t])=>15&t[0])).map((([e,r])=>{const i=r[1]||e;return o.set(i,e),512&r[0]&&t.$attrsToReflect$.push([e,i]),i}))}}return e},Ye=async(e,t,r,i,o)=>{if(!(32&t.$flags$)&&(o=e.constructor,t.$flags$|=32,customElements.whenDefined(r.$tagName$).then((()=>t.$flags$|=128)),o.style)){let i=o.style;"string"!=typeof i&&(i=i[t.$modeName$=(e=>st.map((t=>t(e))).find((e=>!!e)))(e)]);const n=we(r,t.$modeName$);if(!at.has(n)){const e=(r.$tagName$,()=>{});((e,t,r)=>{let i=at.get(e);mt&&r?(i=i||new CSSStyleSheet,"string"==typeof i?i=t:i.replaceSync(t)):i=t,at.set(e,i)})(n,i,!!(1&r.$flags$)),e()}}t.$ancestorComponent$;Ne(t,!0)},Qe=e=>{const t=e["s-cr"]=ct.createComment("");t["s-cn"]=!0,e.insertBefore(t,e.firstChild)},Ge=(e,t)=>{const r={$flags$:t[0],$tagName$:t[1]};r.$members$=t[2],r.$listeners$=t[3],r.$watchers$=e.$watchers$,r.$attrsToReflect$=[],!gt&&1&r.$flags$&&(r.$flags$|=8);const i=e.prototype.connectedCallback,o=e.prototype.disconnectedCallback;return Object.assign(e.prototype,{__registerHost(){it(this,r)},connectedCallback(){(e=>{if(!(1&ht.$flags$)){const t=rt(e),r=t.$cmpMeta$,i=(r.$tagName$,()=>{});1&t.$flags$?(Xe(e,t,r.$listeners$),t.$lazyInstance$):(t.$flags$|=1,12&r.$flags$&&Qe(e),r.$members$&&Object.entries(r.$members$).map((([t,[r]])=>{if(31&r&&e.hasOwnProperty(t)){const r=e[t];delete e[t],e[t]=r}})),Ye(e,t,r)),i()}})(this),i&&i.call(this)},disconnectedCallback(){(e=>{if(!(1&ht.$flags$)){const t=rt(e);t.$rmListeners$&&(t.$rmListeners$.map((e=>e())),t.$rmListeners$=void 0)}})(this),o&&o.call(this)},__attachShadow(){gt?this.attachShadow({mode:"open",delegatesFocus:!!(16&r.$flags$)}):this.shadowRoot=this}}),e.is=r.$tagName$,Ke(e,r)},Xe=(e,t,r,i)=>{r&&r.map((([r,i,o])=>{const n=Je(e,r),a=Ze(t,o),s=et(r);ht.ael(n,i,a,s),(t.$rmListeners$=t.$rmListeners$||[]).push((()=>ht.rel(n,i,a,s)))}))},Ze=(e,t)=>r=>{try{X||e.$hostElement$[t](r)}catch(e){nt(e)}},Je=(e,t)=>4&t?ct:8&t?lt:16&t?ct.body:e,et=e=>ut?{passive:!!(1&e),capture:!!(2&e)}:!!(2&e),tt=new WeakMap,rt=e=>tt.get(e),it=(e,t)=>{const r={$flags$:0,$hostElement$:e,$cmpMeta$:t,$instanceValues$:new Map};return Xe(e,r,t.$listeners$),tt.set(e,r)},ot=(e,t)=>t in e,nt=(e,t)=>(0,console.error)(e,t),at=new Map,st=[],lt="undefined"!=typeof window?window:{},ct=lt.document||{head:{}},dt=lt.HTMLElement||class{},ht={$flags$:0,$resourcesUrl$:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,r,i)=>e.addEventListener(t,r,i),rel:(e,t,r,i)=>e.removeEventListener(t,r,i),ce:(e,t)=>new CustomEvent(e,t)},gt=!0,ut=(()=>{let e=!1;try{ct.addEventListener("e",null,Object.defineProperty({},"passive",{get(){e=!0}}))}catch(e){}return e})(),mt=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync}catch(e){}return!1})(),pt=[],ft=[],vt=(e,t)=>r=>{e.push(r),ae||(ae=!0,t&&4&ht.$flags$?wt(yt):ht.raf(yt))},bt=e=>{for(let t=0;t{bt(pt),bt(ft),(ae=pt.length>0)&&ht.raf(yt)},wt=e=>{return Promise.resolve(t).then(e);var t},$t=vt(ft,!0),xt=(e,t)=>{const r=!!e.label||e.hasLabelSlot,i=!!e.helpText||e.hasHelpTextSlot,o=!!e.invalidText||e.hasInvalidTextSlot,n=!e.invalid,a=!!e.invalid;return de("div",{class:{"form-control":!0,[`form-control-${e.size}`]:!0,"form-control-has-label":r,"form-control-has-help-text":i,"form-control-has-invalid-text":o}},de("label",{id:e.labelId,class:"form-control-label",htmlFor:e.inputId,"aria-hidden":r?"false":"true",onClick:e.onLabelClick},de("slot",{name:"label"},e.label),e.requiredIndicator&&de("div",{class:"asterisk"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 1200 1200"},de("path",{fill:"currentColor",d:"M489.838 29.354v443.603L68.032 335.894 0 545.285l421.829 137.086-260.743 358.876 178.219 129.398L600.048 811.84l260.673 358.806 178.146-129.398-260.766-358.783L1200 545.379l-68.032-209.403-421.899 137.07V29.443H489.84l-.002-.089z"})))),de("div",{class:"form-control-input"},t),n&&de("div",{id:e.helpTextId,class:"form-control-help-text","aria-hidden":i?"false":"true"},de("slot",{name:"help-text"},e.helpText)),a&&de("div",{id:e.invalidTextId,class:"form-control-invalid-text","aria-hidden":o?"false":"true"},de("div",{class:"icon"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Alert Circle"),de("path",{d:"M256,48C141.31,48,48,141.31,48,256s93.31,208,208,208,208-93.31,208-208S370.69,48,256,48Zm0,319.91a20,20,0,1,1,20-20A20,20,0,0,1,256,367.91Zm21.72-201.15-5.74,122a16,16,0,0,1-32,0l-5.74-121.94v-.05a21.74,21.74,0,1,1,43.44,0Z",fill:"currentColor"}))),de("div",{class:"text"},de("slot",{name:"invalid-text"},e.invalidText))))}; +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +function kt(e){const t=e?e.assignedNodes({flatten:!0}):[];let r="";return[...t].map((e=>{e.nodeType===Node.TEXT_NODE&&(r+=e.textContent)})),r}function _t(e,t){return t?null!==e.querySelector(`[slot="${t}"]`):[...e.childNodes].some((e=>{if(e.nodeType===e.TEXT_NODE&&""!==e.textContent.trim())return!0;if(e.nodeType===e.ELEMENT_NODE){if(!e.hasAttribute("slot"))return!0}return!1}))} +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */const Ct=(e,t=[])=>{const r={};return t.forEach((t=>{if(e.hasAttribute(t)){null!==e.getAttribute(t)&&(r[t]=e.getAttribute(t)),e.removeAttribute(t)}})),r},Tt=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow()}render(){return de("span",{class:"spinner","aria-busy":"true","aria-live":"polite"})}static get style(){return":host{--track-color:var(--gr-color-light-shade);--indicator-color:var(--gr-color-primary);--stroke-width:2px;display:inline-flex;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.spinner{display:inline-block;width:1em;height:1em;border-radius:50%;border:solid var(--stroke-width) var(--track-color);border-top-color:var(--indicator-color);border-right-color:var(--indicator-color);animation:1s linear infinite spin}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}"}},[1,"gr-spinner"]);function Et(){if("undefined"==typeof customElements)return;["gr-spinner"].forEach((e=>{if("gr-spinner"===e)customElements.get(e)||customElements.define(e,Tt)}))}Et(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const Ot=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grFocus=fe(this,"gr-focus",7),this.grBlur=fe(this,"gr-blur",7),this.inheritedAttributes={},this.handleClick=e=>{if("button"!==this.type){const t=this.el.closest("form");if(t){e.preventDefault();const r=document.createElement("button");r.type=this.type,r.style.display="none",t.appendChild(r),r.click(),r.remove()}}},this.onFocus=()=>{this.grFocus.emit()},this.onBlur=()=>{this.grBlur.emit()},this.variant="default",this.disabled=!1,this.loading=!1,this.size="medium",this.caret=!1,this.pill=!1,this.expand=void 0,this.circle=!1,this.href=void 0,this.target=void 0,this.rel=void 0,this.type="button"}componentWillLoad(){this.inheritedAttributes=Ct(this.el,["aria-label","tabindex","title"])}async setFocus(e){this.button.focus(e)}async removeFocus(){this.button.blur()}render(){const{rel:e,target:t,href:r,variant:i,size:o,expand:n,type:a,inheritedAttributes:s,disabled:l}=this,c=void 0===r?"button":"a",d="button"===c?{type:a}:{href:r,rel:e,target:t};return de(ge,{onClick:this.handleClick,"aria-disabled":l?"true":null,class:{[`button-${i}`]:!0,[`button-${o}`]:!0,[`button-${n}`]:void 0!==n,"button-caret":this.caret,"button-circle":this.circle,"button-pill":this.pill,"button-disabled":l,"button-loading":this.loading}},de(c,Object.assign({ref:e=>this.button=e},d,{class:"button-native",disabled:l,onFocus:this.onFocus,onBlur:this.onBlur},s),de("span",{class:"button-inner"},de("slot",{name:"icon-only"}),de("slot",{name:"start"}),de("slot",null),de("slot",{name:"end"}),this.caret&&de("span",{class:"caret"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Chevron Down"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"M112 184l144 144 144-144"})))),this.loading&&de("gr-spinner",null)))}get el(){return this}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{display:inline-block;width:auto;font-family:var(--gr-font-family);font-weight:var(--gr-font-weight-medium);font-size:var(--gr-form-element-font-size-medium);font-kerning:none;user-select:none;vertical-align:top;vertical-align:-webkit-baseline-middle;pointer-events:auto;--height:var(--gr-form-element-height-medium);--border-radius:var(--gr-form-element-border-radius-medium);--border-width:1px;--border-style:solid;--background:transparent;--background-hover:transparent;--background-focus:transparent;--color:var(--gr-color-dark-tint);--color-hover:var(--gr-color-dark-tint);--color-focus:var(--gr-color-dark-tint);--border-color:var(--gr-color-light-shade);--border-color-hover:var(--gr-color-medium);--border-color-focus:var(--gr-color-primary);--padding-top:0;--padding-start:var(--gr-spacing-medium);--padding-end:var(--gr-spacing-medium);--padding-bottom:0;--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33);--shadow:none;--transition:background-color 150ms linear, opacity 150ms linear, border 150ms linear, color 150ms linear}:host(.button-disabled){pointer-events:none;opacity:0.5}:host(.button-primary){--border-color:var(--gr-color-primary);--background:var(--gr-color-primary);--color:var(--gr-color-primary-contrast);--border-color-hover:var(--gr-color-primary-shade);--background-hover:var(--gr-color-primary-shade);--color-hover:var(--gr-color-primary-contrast);--border-color-focus:var(--gr-color-primary);--background-focus:var(--gr-color-primary-shade);--color-focus:var(--gr-color-primary-contrast);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33)}:host(.button-secondary){--border-color:var(--gr-color-light-shade);--background:transparent;--color:var(--gr-color-primary);--border-color-hover:var(--gr-color-primary);--background-hover:transparent;--color-hover:var(--gr-color-primary);--border-color-focus:var(--gr-color-primary);--background-focus:transparent;--color-focus:var(--gr-color-primary);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33)}:host(.button-danger){--border-color:var(--gr-color-danger);--background:transparent;--color:var(--gr-color-danger);--border-color-hover:var(--gr-color-danger);--background-hover:var(--gr-color-danger);--color-hover:var(--gr-color-danger-contrast);--border-color-focus:var(--gr-color-danger);--background-focus:var(--gr-color-danger);--color-focus:var(--gr-color-danger-contrast);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-danger-rgb), 0.33)}:host(.button-plain){--border-color:transparent;--background:transparent;--color:var(--gr-color-primary);--border-color-hover:transparent;--background-hover:transparent;--color-hover:var(--gr-color-primary-shade);--border-color-focus:transparent;--background-focus:transparent;--color-focus:var(--gr-color-primary-shade);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33)}:host(.button-small){--padding-start:var(--gr-spacing-small);--padding-end:var(--gr-spacing-small);--border-radius:var(--gr-form-element-border-radius-small);--height:var(--gr-form-element-height-small);font-size:var(--gr-form-element-font-size-small)}:host(.button-large){--padding-start:var(--gr-spacing-large);--padding-end:var(--gr-spacing-large);--border-radius:var(--gr-form-element-border-radius-large);--height:var(--gr-form-element-height-large);font-size:var(--gr-form-element-font-size-large)}:host(.button-block){display:block}:host(.button-block) .button-native{margin-left:0;margin-right:0;display:block;width:100%;clear:both;contain:content}:host(.button-block) .button-native::after{clear:both}:host(.button-full){display:block}:host(.button-full) .button-native{margin-left:0;margin-right:0;display:block;width:100%;contain:content;border-radius:0;border-right-width:0;border-left-width:0}.button-native{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:block;position:relative;padding-top:var(--padding-top);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-bottom:var(--padding-bottom);width:100%;height:var(--height);transition:var(--transition);border-radius:var(--border-radius);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);color:var(--color);box-shadow:var(--shadow);line-height:1;cursor:pointer;z-index:0;text-decoration:none;box-sizing:border-box}.button-native::-moz-focus-inner{border:0}.button-native:focus{outline:none;box-shadow:var(--focus-ring);border-color:var(--border-color-focus);background-color:var(--background-focus);color:var(--color-focus)}.button-native *,.button-native *:before,.button-native *:after{box-sizing:inherit}.button-inner{display:flex;position:relative;flex-flow:row nowrap;flex-shrink:0;align-items:center;justify-content:center;width:100%;height:100%;z-index:1}:host(.button-circle) .button-native{padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;border-radius:50%;width:var(--height)}@media (any-hover: hover){.button-native:hover{color:var(--color-hover);background:var(--background-hover);border-color:var(--border-color-hover)}}:host(.button-caret) .caret{display:flex;align-items:center;margin-left:0.3em}:host(.button-caret) .caret svg{width:1em;height:1em}:host(.button-pill) .button-native{border-radius:var(--height)}::slotted(*){pointer-events:none}::slotted([slot=start]){margin-top:0;margin-left:-0.3em;margin-right:0.3em;margin-bottom:0}::slotted([slot=end]){margin-top:0;margin-left:0.3em;margin-right:-0.2em;margin-bottom:0}::slotted([slot=icon-only]){font-size:1.4em;pointer-events:none}:host(.button-loading){position:relative;pointer-events:none}:host(.button-loading) .caret{visibility:hidden}:host(.button-loading) slot[name=start],:host(.button-loading) slot[name=end],:host(.button-loading) slot[name=icon-only],:host(.button-loading) slot:not([name]){visibility:hidden}:host(.button-loading) gr-spinner{--indicator-color:currentColor;position:absolute;height:1em;width:1em;top:calc(50% - 0.5em);left:calc(50% - 0.5em)}@media not all and (min-resolution: 0.001dpcm){@supports (-webkit-appearance: none) and (stroke-color: transparent){:host([type=button]),:host([type=reset]),:host([type=submit]){-webkit-appearance:none !important}}}"}},[1,"gr-button",{variant:[513],disabled:[516],loading:[516],size:[513],caret:[4],pill:[516],expand:[513],circle:[516],href:[1],target:[1],rel:[1],type:[1],setFocus:[64],removeFocus:[64]}]);function St(){if("undefined"==typeof customElements)return;["gr-button","gr-spinner"].forEach((e=>{switch(e){case"gr-button":customElements.get(e)||customElements.define(e,Ot);break;case"gr-spinner":customElements.get(e)||Et()}}))}function Mt(e,t,r="vertical",i="smooth"){const o= +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +function(e,t){return{top:Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top),left:Math.round(e.getBoundingClientRect().left-t.getBoundingClientRect().left)}}(e,t),n=o.top+t.scrollTop,a=o.left+t.scrollLeft,s=t.scrollLeft,l=t.scrollLeft+t.offsetWidth,c=t.scrollTop,d=t.scrollTop+t.offsetHeight;"horizontal"!==r&&"both"!==r||(al&&t.scrollTo({left:a-t.offsetWidth+e.clientWidth,behavior:i})),"vertical"!==r&&"both"!==r||(nd&&t.scrollTo({top:n-t.offsetHeight+e.clientHeight,behavior:i}))} +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */function zt(e){return e.tabIndex>-1}function Lt(e){if(zt(e))return e;if(e.shadowRoot){const t=[...e.shadowRoot.children].find(zt);if(t)return t}return e.children?[...e.children].map(Lt)[0]:null}St();var Dt="top",At="bottom",Ft="right",It="left",Wt="auto",Rt=[Dt,At,Ft,It],Nt="start",Ht="end",Vt="clippingParents",jt="viewport",Bt="popper",qt="reference",Pt=Rt.reduce((function(e,t){return e.concat([t+"-"+Nt,t+"-"+Ht])}),[]),Ut=[].concat(Rt,[Wt]).reduce((function(e,t){return e.concat([t,t+"-"+Nt,t+"-"+Ht])}),[]),Kt=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function Yt(e){return e?(e.nodeName||"").toLowerCase():null}function Qt(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Gt(e){return e instanceof Qt(e).Element||e instanceof Element}function Xt(e){return e instanceof Qt(e).HTMLElement||e instanceof HTMLElement}function Zt(e){return"undefined"!=typeof ShadowRoot&&(e instanceof Qt(e).ShadowRoot||e instanceof ShadowRoot)}const Jt={name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach((function(e){var r=t.styles[e]||{},i=t.attributes[e]||{},o=t.elements[e];Xt(o)&&Yt(o)&&(Object.assign(o.style,r),Object.keys(i).forEach((function(e){var t=i[e];!1===t?o.removeAttribute(e):o.setAttribute(e,!0===t?"":t)})))}))},effect:function(e){var t=e.state,r={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,r.popper),t.styles=r,t.elements.arrow&&Object.assign(t.elements.arrow.style,r.arrow),function(){Object.keys(t.elements).forEach((function(e){var i=t.elements[e],o=t.attributes[e]||{},n=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:r[e]).reduce((function(e,t){return e[t]="",e}),{});Xt(i)&&Yt(i)&&(Object.assign(i.style,n),Object.keys(o).forEach((function(e){i.removeAttribute(e)})))}))}},requires:["computeStyles"]};function er(e){return e.split("-")[0]}var tr=Math.max,rr=Math.min,ir=Math.round;function or(e,t){void 0===t&&(t=!1);var r=e.getBoundingClientRect(),i=1,o=1;if(Xt(e)&&t){var n=e.offsetHeight,a=e.offsetWidth;a>0&&(i=ir(r.width)/a||1),n>0&&(o=ir(r.height)/n||1)}return{width:r.width/i,height:r.height/o,top:r.top/o,right:r.right/i,bottom:r.bottom/o,left:r.left/i,x:r.left/i,y:r.top/o}}function nr(e){var t=or(e),r=e.offsetWidth,i=e.offsetHeight;return Math.abs(t.width-r)<=1&&(r=t.width),Math.abs(t.height-i)<=1&&(i=t.height),{x:e.offsetLeft,y:e.offsetTop,width:r,height:i}}function ar(e,t){var r=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(r&&Zt(r)){var i=t;do{if(i&&e.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function sr(e){return Qt(e).getComputedStyle(e)}function lr(e){return["table","td","th"].indexOf(Yt(e))>=0}function cr(e){return((Gt(e)?e.ownerDocument:e.document)||window.document).documentElement}function dr(e){return"html"===Yt(e)?e:e.assignedSlot||e.parentNode||(Zt(e)?e.host:null)||cr(e)}function hr(e){return Xt(e)&&"fixed"!==sr(e).position?e.offsetParent:null}function gr(e){for(var t=Qt(e),r=hr(e);r&&lr(r)&&"static"===sr(r).position;)r=hr(r);return r&&("html"===Yt(r)||"body"===Yt(r)&&"static"===sr(r).position)?t:r||function(e){var t=-1!==navigator.userAgent.toLowerCase().indexOf("firefox");if(-1!==navigator.userAgent.indexOf("Trident")&&Xt(e)&&"fixed"===sr(e).position)return null;var r=dr(e);for(Zt(r)&&(r=r.host);Xt(r)&&["html","body"].indexOf(Yt(r))<0;){var i=sr(r);if("none"!==i.transform||"none"!==i.perspective||"paint"===i.contain||-1!==["transform","perspective"].indexOf(i.willChange)||t&&"filter"===i.willChange||t&&i.filter&&"none"!==i.filter)return r;r=r.parentNode}return null}(e)||t}function ur(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function mr(e,t,r){return tr(e,rr(t,r))}function pr(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},e)}function fr(e,t){return t.reduce((function(t,r){return t[r]=e,t}),{})}const vr={name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,r=e.state,i=e.name,o=e.options,n=r.elements.arrow,a=r.modifiersData.popperOffsets,s=er(r.placement),l=ur(s),c=[It,Ft].indexOf(s)>=0?"height":"width";if(n&&a){var d=function(e,t){return pr("number"!=typeof(e="function"==typeof e?e(Object.assign({},t.rects,{placement:t.placement})):e)?e:fr(e,Rt))}(o.padding,r),h=nr(n),g="y"===l?Dt:It,u="y"===l?At:Ft,m=r.rects.reference[c]+r.rects.reference[l]-a[l]-r.rects.popper[c],p=a[l]-r.rects.reference[l],f=gr(n),v=f?"y"===l?f.clientHeight||0:f.clientWidth||0:0,b=m/2-p/2,y=d[g],w=v-h[c]-d[u],$=v/2-h[c]/2+b,x=mr(y,$,w),k=l;r.modifiersData[i]=((t={})[k]=x,t.centerOffset=x-$,t)}},effect:function(e){var t=e.state,r=e.options.element,i=void 0===r?"[data-popper-arrow]":r;null!=i&&("string"!=typeof i||(i=t.elements.popper.querySelector(i)))&&ar(t.elements.popper,i)&&(t.elements.arrow=i)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function br(e){return e.split("-")[1]}var yr={top:"auto",right:"auto",bottom:"auto",left:"auto"};function wr(e){var t,r=e.popper,i=e.popperRect,o=e.placement,n=e.variation,a=e.offsets,s=e.position,l=e.gpuAcceleration,c=e.adaptive,d=e.roundOffsets,h=e.isFixed,g=a.x,u=void 0===g?0:g,m=a.y,p=void 0===m?0:m,f="function"==typeof d?d({x:u,y:p}):{x:u,y:p};u=f.x,p=f.y;var v=a.hasOwnProperty("x"),b=a.hasOwnProperty("y"),y=It,w=Dt,$=window;if(c){var x=gr(r),k="clientHeight",_="clientWidth";if(x===Qt(r)&&"static"!==sr(x=cr(r)).position&&"absolute"===s&&(k="scrollHeight",_="scrollWidth"),o===Dt||(o===It||o===Ft)&&n===Ht)w=At,p-=(h&&x===$&&$.visualViewport?$.visualViewport.height:x[k])-i.height,p*=l?1:-1;if(o===It||(o===Dt||o===At)&&n===Ht)y=Ft,u-=(h&&x===$&&$.visualViewport?$.visualViewport.width:x[_])-i.width,u*=l?1:-1}var C,T=Object.assign({position:s},c&&yr),E=!0===d?function(e){var t=e.x,r=e.y,i=window.devicePixelRatio||1;return{x:ir(t*i)/i||0,y:ir(r*i)/i||0}}({x:u,y:p}):{x:u,y:p};return u=E.x,p=E.y,l?Object.assign({},T,((C={})[w]=b?"0":"",C[y]=v?"0":"",C.transform=($.devicePixelRatio||1)<=1?"translate("+u+"px, "+p+"px)":"translate3d("+u+"px, "+p+"px, 0)",C)):Object.assign({},T,((t={})[w]=b?p+"px":"",t[y]=v?u+"px":"",t.transform="",t))}var $r={passive:!0};var xr={left:"right",right:"left",bottom:"top",top:"bottom"};function kr(e){return e.replace(/left|right|bottom|top/g,(function(e){return xr[e]}))}var _r={start:"end",end:"start"};function Cr(e){return e.replace(/start|end/g,(function(e){return _r[e]}))}function Tr(e){var t=Qt(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function Er(e){return or(cr(e)).left+Tr(e).scrollLeft}function Or(e){var t=sr(e),r=t.overflow,i=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(r+o+i)}function Sr(e){return["html","body","#document"].indexOf(Yt(e))>=0?e.ownerDocument.body:Xt(e)&&Or(e)?e:Sr(dr(e))}function Mr(e,t){var r;void 0===t&&(t=[]);var i=Sr(e),o=i===(null==(r=e.ownerDocument)?void 0:r.body),n=Qt(i),a=o?[n].concat(n.visualViewport||[],Or(i)?i:[]):i,s=t.concat(a);return o?s:s.concat(Mr(dr(a)))}function zr(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function Lr(e,t){return t===jt?zr(function(e){var t=Qt(e),r=cr(e),i=t.visualViewport,o=r.clientWidth,n=r.clientHeight,a=0,s=0;return i&&(o=i.width,n=i.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(a=i.offsetLeft,s=i.offsetTop)),{width:o,height:n,x:a+Er(e),y:s}}(e)):Gt(t)?function(e){var t=or(e);return t.top=t.top+e.clientTop,t.left=t.left+e.clientLeft,t.bottom=t.top+e.clientHeight,t.right=t.left+e.clientWidth,t.width=e.clientWidth,t.height=e.clientHeight,t.x=t.left,t.y=t.top,t}(t):zr(function(e){var t,r=cr(e),i=Tr(e),o=null==(t=e.ownerDocument)?void 0:t.body,n=tr(r.scrollWidth,r.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=tr(r.scrollHeight,r.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),s=-i.scrollLeft+Er(e),l=-i.scrollTop;return"rtl"===sr(o||r).direction&&(s+=tr(r.clientWidth,o?o.clientWidth:0)-n),{width:n,height:a,x:s,y:l}}(cr(e)))}function Dr(e,t,r){var i="clippingParents"===t?function(e){var t=Mr(dr(e)),r=["absolute","fixed"].indexOf(sr(e).position)>=0&&Xt(e)?gr(e):e;return Gt(r)?t.filter((function(e){return Gt(e)&&ar(e,r)&&"body"!==Yt(e)})):[]}(e):[].concat(t),o=[].concat(i,[r]),n=o[0],a=o.reduce((function(t,r){var i=Lr(e,r);return t.top=tr(i.top,t.top),t.right=rr(i.right,t.right),t.bottom=rr(i.bottom,t.bottom),t.left=tr(i.left,t.left),t}),Lr(e,n));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function Ar(e){var t,r=e.reference,i=e.element,o=e.placement,n=o?er(o):null,a=o?br(o):null,s=r.x+r.width/2-i.width/2,l=r.y+r.height/2-i.height/2;switch(n){case Dt:t={x:s,y:r.y-i.height};break;case At:t={x:s,y:r.y+r.height};break;case Ft:t={x:r.x+r.width,y:l};break;case It:t={x:r.x-i.width,y:l};break;default:t={x:r.x,y:r.y}}var c=n?ur(n):null;if(null!=c){var d="y"===c?"height":"width";switch(a){case Nt:t[c]=t[c]-(r[d]/2-i[d]/2);break;case Ht:t[c]=t[c]+(r[d]/2-i[d]/2)}}return t}function Fr(e,t){void 0===t&&(t={});var r=t,i=r.placement,o=void 0===i?e.placement:i,n=r.boundary,a=void 0===n?Vt:n,s=r.rootBoundary,l=void 0===s?jt:s,c=r.elementContext,d=void 0===c?Bt:c,h=r.altBoundary,g=void 0!==h&&h,u=r.padding,m=void 0===u?0:u,p=pr("number"!=typeof m?m:fr(m,Rt)),f=d===Bt?qt:Bt,v=e.rects.popper,b=e.elements[g?f:d],y=Dr(Gt(b)?b:b.contextElement||cr(e.elements.popper),a,l),w=or(e.elements.reference),$=Ar({reference:w,element:v,strategy:"absolute",placement:o}),x=zr(Object.assign({},v,$)),k=d===Bt?x:w,_={top:y.top-k.top+p.top,bottom:k.bottom-y.bottom+p.bottom,left:y.left-k.left+p.left,right:k.right-y.right+p.right},C=e.modifiersData.offset;if(d===Bt&&C){var T=C[o];Object.keys(_).forEach((function(e){var t=[Ft,At].indexOf(e)>=0?1:-1,r=[Dt,At].indexOf(e)>=0?"y":"x";_[e]+=T[r]*t}))}return _}function Ir(e,t){void 0===t&&(t={});var r=t,i=r.placement,o=r.boundary,n=r.rootBoundary,a=r.padding,s=r.flipVariations,l=r.allowedAutoPlacements,c=void 0===l?Ut:l,d=br(i),h=d?s?Pt:Pt.filter((function(e){return br(e)===d})):Rt,g=h.filter((function(e){return c.indexOf(e)>=0}));0===g.length&&(g=h);var u=g.reduce((function(t,r){return t[r]=Fr(e,{placement:r,boundary:o,rootBoundary:n,padding:a})[er(r)],t}),{});return Object.keys(u).sort((function(e,t){return u[e]-u[t]}))}const Wr={name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,r=e.options,i=e.name;if(!t.modifiersData[i]._skip){for(var o=r.mainAxis,n=void 0===o||o,a=r.altAxis,s=void 0===a||a,l=r.fallbackPlacements,c=r.padding,d=r.boundary,h=r.rootBoundary,g=r.altBoundary,u=r.flipVariations,m=void 0===u||u,p=r.allowedAutoPlacements,f=t.options.placement,v=er(f),b=l||(v===f||!m?[kr(f)]:function(e){if(er(e)===Wt)return[];var t=kr(e);return[Cr(e),t,Cr(t)]}(f)),y=[f].concat(b).reduce((function(e,r){return e.concat(er(r)===Wt?Ir(t,{placement:r,boundary:d,rootBoundary:h,padding:c,flipVariations:m,allowedAutoPlacements:p}):r)}),[]),w=t.rects.reference,$=t.rects.popper,x=new Map,k=!0,_=y[0],C=0;C=0,M=S?"width":"height",z=Fr(t,{placement:T,boundary:d,rootBoundary:h,altBoundary:g,padding:c}),L=S?O?Ft:It:O?At:Dt;w[M]>$[M]&&(L=kr(L));var D=kr(L),A=[];if(n&&A.push(z[E]<=0),s&&A.push(z[L]<=0,z[D]<=0),A.every((function(e){return e}))){_=T,k=!1;break}x.set(T,A)}if(k)for(var F=function(e){var t=y.find((function(t){var r=x.get(t);if(r)return r.slice(0,e).every((function(e){return e}))}));if(t)return _=t,"break"},I=m?3:1;I>0;I--){if("break"===F(I))break}t.placement!==_&&(t.modifiersData[i]._skip=!0,t.placement=_,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function Rr(e,t,r){return void 0===r&&(r={x:0,y:0}),{top:e.top-t.height-r.y,right:e.right-t.width+r.x,bottom:e.bottom-t.height+r.y,left:e.left-t.width-r.x}}function Nr(e){return[Dt,Ft,At,It].some((function(t){return e[t]>=0}))}const Hr={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,r=e.options,i=e.name,o=r.offset,n=void 0===o?[0,0]:o,a=Ut.reduce((function(e,r){return e[r]=function(e,t,r){var i=er(e),o=[It,Dt].indexOf(i)>=0?-1:1,n="function"==typeof r?r(Object.assign({},t,{placement:e})):r,a=n[0],s=n[1];return a=a||0,s=(s||0)*o,[It,Ft].indexOf(i)>=0?{x:s,y:a}:{x:a,y:s}}(r,t.rects,n),e}),{}),s=a[t.placement],l=s.x,c=s.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=c),t.modifiersData[i]=a}};const Vr={name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,r=e.options,i=e.name,o=r.mainAxis,n=void 0===o||o,a=r.altAxis,s=void 0!==a&&a,l=r.boundary,c=r.rootBoundary,d=r.altBoundary,h=r.padding,g=r.tether,u=void 0===g||g,m=r.tetherOffset,p=void 0===m?0:m,f=Fr(t,{boundary:l,rootBoundary:c,padding:h,altBoundary:d}),v=er(t.placement),b=br(t.placement),y=!b,w=ur(v),$="x"===w?"y":"x",x=t.modifiersData.popperOffsets,k=t.rects.reference,_=t.rects.popper,C="function"==typeof p?p(Object.assign({},t.rects,{placement:t.placement})):p,T="number"==typeof C?{mainAxis:C,altAxis:C}:Object.assign({mainAxis:0,altAxis:0},C),E=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,O={x:0,y:0};if(x){if(n){var S,M="y"===w?Dt:It,z="y"===w?At:Ft,L="y"===w?"height":"width",D=x[w],A=D+f[M],F=D-f[z],I=u?-_[L]/2:0,W=b===Nt?k[L]:_[L],R=b===Nt?-_[L]:-k[L],N=t.elements.arrow,H=u&&N?nr(N):{width:0,height:0},V=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},j=V[M],B=V[z],q=mr(0,k[L],H[L]),P=y?k[L]/2-I-q-j-T.mainAxis:W-q-j-T.mainAxis,U=y?-k[L]/2+I+q+B+T.mainAxis:R+q+B+T.mainAxis,K=t.elements.arrow&&gr(t.elements.arrow),Y=K?"y"===w?K.clientTop||0:K.clientLeft||0:0,Q=null!=(S=null==E?void 0:E[w])?S:0,G=D+U-Q,X=mr(u?rr(A,D+P-Q-Y):A,D,u?tr(F,G):F);x[w]=X,O[w]=X-D}if(s){var Z,J="x"===w?Dt:It,ee="x"===w?At:Ft,te=x[$],re="y"===$?"height":"width",ie=te+f[J],oe=te-f[ee],ne=-1!==[Dt,It].indexOf(v),ae=null!=(Z=null==E?void 0:E[$])?Z:0,se=ne?ie:te-k[re]-_[re]-ae+T.altAxis,le=ne?te+k[re]+_[re]-ae-T.altAxis:oe,ce=u&&ne?function(e,t,r){var i=mr(e,t,r);return i>r?r:i}(se,te,le):mr(u?se:ie,te,u?le:oe);x[$]=ce,O[$]=ce-te}t.modifiersData[i]=O}},requiresIfExists:["offset"]};function jr(e,t,r){void 0===r&&(r=!1);var i,o,n=Xt(t),a=Xt(t)&&function(e){var t=e.getBoundingClientRect(),r=ir(t.width)/e.offsetWidth||1,i=ir(t.height)/e.offsetHeight||1;return 1!==r||1!==i}(t),s=cr(t),l=or(e,a),c={scrollLeft:0,scrollTop:0},d={x:0,y:0};return(n||!n&&!r)&&(("body"!==Yt(t)||Or(s))&&(c=(i=t)!==Qt(i)&&Xt(i)?{scrollLeft:(o=i).scrollLeft,scrollTop:o.scrollTop}:Tr(i)),Xt(t)?((d=or(t,!0)).x+=t.clientLeft,d.y+=t.clientTop):s&&(d.x=Er(s))),{x:l.left+c.scrollLeft-d.x,y:l.top+c.scrollTop-d.y,width:l.width,height:l.height}}function Br(e){var t=new Map,r=new Set,i=[];function o(e){r.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach((function(e){if(!r.has(e)){var i=t.get(e);i&&o(i)}})),i.push(e)}return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){r.has(e.name)||o(e)})),i}var qr={placement:"bottom",modifiers:[],strategy:"absolute"};function Pr(){for(var e=arguments.length,t=new Array(e),r=0;r{},onAfterHide:()=>{},onTransitionEnd:()=>{}},r),this.isVisible=!1,this.popover.hidden=!0,this.popover.classList.remove(this.options.visibleClass),this.popover.addEventListener("transitionend",this.handleTransitionEnd)}handleTransitionEnd(e){e.target===this.options.transitionElement&&(this.options.onTransitionEnd.call(this,e),this.isVisible||this.popover.hidden||(this.popover.hidden=!0,this.popover.classList.remove(this.options.visibleClass),this.options.onAfterHide.call(this)))}destroy(){this.popover.removeEventListener("transitionend",this.handleTransitionEnd),this.popper&&(this.popper.destroy(),this.popper=null)}show(){this.isVisible=!0,this.popover.hidden=!1,requestAnimationFrame((()=>this.popover.classList.add(this.options.visibleClass))),this.popper&&this.popper.destroy(),this.popper=Kr(this.anchor,this.popover,{placement:this.options.placement,strategy:this.options.strategy,modifiers:[{name:"flip",options:{boundary:"viewport"}},{name:"offset",options:{offset:[this.options.skidding,this.options.distance]}}]}),this.popover.addEventListener("transitionend",(()=>this.options.onAfterShow.call(this)),{once:!0}),requestAnimationFrame((()=>this.popper.update()))}hide(){this.isVisible=!1,this.popover.classList.remove(this.options.visibleClass)}setOptions(e){this.options=Object.assign(this.options,e),this.isVisible?this.popover.classList.add(this.options.visibleClass):this.popover.classList.remove(this.options.visibleClass),this.popper&&(this.popper.setOptions({placement:this.options.placement,strategy:this.options.strategy}),requestAnimationFrame((()=>this.popper.update())))}}let Qr=0;const Gr=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grShow=fe(this,"gr-show",7),this.grAfterShow=fe(this,"gr-after-show",7),this.grHide=fe(this,"gr-hide",7),this.grAfterHide=fe(this,"gr-after-hide",7),this.componentId="dropdown-"+ ++Qr,this.isVisible=!1,this.open=!1,this.placement="bottom-start",this.closeOnSelect=!0,this.containingElement=void 0,this.distance=2,this.skidding=0,this.hoist=!1}handleOpenChange(){this.open?this.show():this.hide(),this.updateAccessibleTrigger()}handlePopoverOptionsChange(){this.popoverElement.setOptions({strategy:this.hoist?"fixed":"absolute",placement:this.placement,distance:this.distance,skidding:this.skidding})}connectedCallback(){this.containingElement||(this.containingElement=this.el),this.handleDocumentKeyDown=this.handleDocumentKeyDown.bind(this),this.handleDocumentMouseDown=this.handleDocumentMouseDown.bind(this),this.handleMenuItemActivate=this.handleMenuItemActivate.bind(this),this.handlePanelSelect=this.handlePanelSelect.bind(this),this.handleTriggerClick=this.handleTriggerClick.bind(this),this.handleTriggerKeyDown=this.handleTriggerKeyDown.bind(this),this.handleTriggerKeyUp=this.handleTriggerKeyUp.bind(this),this.handleTriggerSlotChange=this.handleTriggerSlotChange.bind(this)}componentDidLoad(){this.popoverElement=new Yr(this.trigger,this.positioner,{strategy:this.hoist?"fixed":"absolute",placement:this.placement,distance:this.distance,skidding:this.skidding,transitionElement:this.panel,onAfterHide:()=>this.grAfterHide.emit(),onAfterShow:()=>this.grAfterShow.emit(),onTransitionEnd:()=>{this.open||(this.panel.scrollTop=0)}}),this.open&&this.show()}disconnectedCallback(){this.hide(),this.popoverElement.destroy()}async show(){if(this.isVisible)return;this.grShow.emit().defaultPrevented?this.open=!1:(this.panel.addEventListener("gr-activate",this.handleMenuItemActivate),this.panel.addEventListener("gr-select",this.handlePanelSelect),document.addEventListener("keydown",this.handleDocumentKeyDown),document.addEventListener("mousedown",this.handleDocumentMouseDown),this.isVisible=!0,this.open=!0,this.popoverElement.show())}async hide(){if(!this.isVisible)return;this.grHide.emit().defaultPrevented?this.open=!0:(this.panel.removeEventListener("gr-activate",this.handleMenuItemActivate),this.panel.removeEventListener("gr-select",this.handlePanelSelect),document.addEventListener("keydown",this.handleDocumentKeyDown),document.removeEventListener("mousedown",this.handleDocumentMouseDown),this.isVisible=!1,this.open=!1,this.popoverElement.hide())}async focusOnTrigger(){const e=this.trigger.querySelector("slot").assignedElements({flatten:!0})[0];e&&("function"==typeof e.setFocus?e.setFocus():"function"==typeof e.focus&&e.focus())}getMenu(){return this.panel.querySelector("slot").assignedElements({flatten:!0}).filter((e=>"gr-menu"===e.tagName.toLowerCase()))[0]}handleDocumentKeyDown(e){var t;if("Escape"===e.key)return this.hide(),void this.focusOnTrigger();if("Tab"===e.key){if(this.open&&"gr-menu-item"===(null===(t=document.activeElement)||void 0===t?void 0:t.tagName.toLowerCase()))return e.preventDefault(),this.hide(),void this.focusOnTrigger();setTimeout((()=>{var e;const t=this.containingElement.getRootNode()instanceof ShadowRoot?null===(e=document.activeElement.shadowRoot)||void 0===e?void 0:e.activeElement:document.activeElement;(null==t?void 0:t.closest(this.containingElement.tagName.toLowerCase()))===this.containingElement||this.hide()}))}}handleDocumentMouseDown(e){e.composedPath().includes(this.containingElement)||this.hide()}handleMenuItemActivate(e){Mt(e.target,this.panel)}handlePanelSelect(e){const t=e.target;this.closeOnSelect&&"gr-menu"===t.tagName.toLowerCase()&&(this.hide(),this.focusOnTrigger())}handleTriggerClick(){this.open?this.hide():this.show()}handleTriggerKeyDown(e){const t=this.getMenu(),r=t?[...t.querySelectorAll("gr-menu-item")]:null,i=r[0],o=r[r.length-1];if("Escape"===e.key)return this.focusOnTrigger(),void this.hide();if([" ","Enter"].includes(e.key))return e.preventDefault(),void(this.open?this.hide():this.show());if(["ArrowDown","ArrowUp"].includes(e.key)){if(e.preventDefault(),this.open||this.show(),"ArrowDown"===e.key&&i)return void i.setFocus();if("ArrowUp"===e.key&&o)return void o.setFocus()}this.open&&t&&!["Tab","Shift","Meta","Ctrl","Alt"].includes(e.key)&&t.typeToSelect(e.key)}handleTriggerKeyUp(e){" "===e.key&&e.preventDefault()}handleTriggerSlotChange(){this.updateAccessibleTrigger()}updateAccessibleTrigger(){const e=this.trigger.querySelector("slot").assignedElements({flatten:!0}).map(Lt)[0];e&&(e.setAttribute("aria-haspopup","true"),e.setAttribute("aria-expanded",this.open?"true":"false"))}render(){return de(ge,{id:this.componentId,class:{"dropdown-open":this.open}},de("span",{class:"dropdown-trigger",ref:e=>this.trigger=e,onClick:this.handleTriggerClick,onKeyDown:this.handleTriggerKeyDown,onKeyUp:this.handleTriggerKeyUp},de("slot",{name:"trigger",onSlotchange:this.handleTriggerSlotChange})),de("div",{ref:e=>this.positioner=e,class:"dropdown-positioner"},de("div",{ref:e=>this.panel=e,class:"dropdown-panel",role:"menu","aria-hidden":this.open?"false":"true","aria-labelledby":this.componentId},de("slot",null))))}get el(){return this}static get watchers(){return{open:["handleOpenChange"],distance:["handlePopoverOptionsChange"],hoist:["handlePopoverOptionsChange"],placement:["handlePopoverOptionsChange"],skidding:["handlePopoverOptionsChange"]}}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{--panel-background-color:var(--gr-color-white);--panel-border-radius:var(--gr-border-radius-medium);--panel-border-color:var(--gr-panel-border-color);--panel-box-shadow:var(--gr-shadow-large);--transition:150ms opacity, 150ms transform;display:inline-block;position:relative;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.dropdown-trigger{display:block}.dropdown-positioner{position:absolute;z-index:var(--gr-z-index-dropdown)}.dropdown-panel{max-height:50vh;font-family:var(--gr-font-family);font-size:var(--gr-font-size-medium);font-weight:var(--gr-font-weight-normal);background-color:var(--panel-background-color);border:solid 1px var(--panel-border-color);border-radius:var(--panel-border-radius);box-shadow:var(--panel-box-shadow);opacity:0;overflow:auto;overscroll-behavior:none;pointer-events:none;transform:scale(0.9);transition:var(--transition)}.dropdown-positioner[data-popper-placement^=top] .dropdown-panel{transform-origin:bottom}.dropdown-positioner[data-popper-placement^=bottom] .dropdown-panel{transform-origin:top}.dropdown-positioner[data-popper-placement^=left] .dropdown-panel{transform-origin:right}.dropdown-positioner[data-popper-placement^=right] .dropdown-panel{transform-origin:left}.dropdown-positioner.popover-visible .dropdown-panel{opacity:1;transform:none;pointer-events:all}"}},[1,"gr-dropdown",{open:[1540],placement:[1],closeOnSelect:[4,"close-on-select"],containingElement:[1040],distance:[2],skidding:[2],hoist:[4],show:[64],hide:[64],focusOnTrigger:[64]}]);function Xr(){if("undefined"==typeof customElements)return;["gr-dropdown"].forEach((e=>{if("gr-dropdown"===e)customElements.get(e)||customElements.define(e,Gr)}))}Xr(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const Zr=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grSelect=fe(this,"gr-select",7),this.typeToSelectString=""}connectedCallback(){this.handleClick=this.handleClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}async typeToSelect(e){clearTimeout(this.typeToSelectTimeout),this.typeToSelectTimeout=setTimeout((()=>this.typeToSelectString=""),750),this.typeToSelectString+=e.toLowerCase();const t=this.getItems();for(const e of t){if(kt(e.shadowRoot.querySelector("slot:not([name])")).toLowerCase().trim().substring(0,this.typeToSelectString.length)===this.typeToSelectString){e.setFocus();break}}}getItems(){return[...this.menu.querySelector("slot").assignedElements({flatten:!0})].filter((e=>"gr-menu-item"===e.tagName.toLowerCase()&&!e.disabled))}getActiveItem(){return this.getItems().find((e=>e===document.activeElement))}setActiveItem(e){e.setFocus()}handleClick(e){const t=e.target.closest("gr-menu-item");t&&!t.disabled&&this.grSelect.emit({item:t})}handleKeyDown(e){if("Enter"===e.key){const t=this.getActiveItem();e.preventDefault(),t&&this.grSelect.emit({item:t})}if(" "===e.key&&e.preventDefault(),["ArrowDown","ArrowUp","Home","End"].includes(e.key)){const t=this.getItems(),r=this.getActiveItem();let i=t.indexOf(r);if(t.length)return e.preventDefault(),"ArrowDown"===e.key?i++:"ArrowUp"===e.key?i--:"Home"===e.key?i=0:"End"===e.key&&(i=t.length-1),i<0&&(i=0),i>t.length-1&&(i=t.length-1),void this.setActiveItem(t[i])}this.typeToSelect(e.key)}render(){return de("div",{ref:e=>this.menu=e,class:"menu",role:"menu",onClick:this.handleClick,onKeyDown:this.handleKeyDown},de("slot",null))}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{--padding-top:var(--gr-spacing-x-small);--padding-bottom:var(--gr-spacing-x-small);display:block;padding-top:var(--padding-top);padding-left:0;padding-right:0;padding-bottom:var(--padding-bottom);box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host:focus{outline:none}"}},[1,"gr-menu",{typeToSelect:[64]}]);function Jr(){if("undefined"==typeof customElements)return;["gr-menu"].forEach((e=>{if("gr-menu"===e)customElements.get(e)||customElements.define(e,Zr)}))}Jr(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const ei=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grClear=fe(this,"gr-clear",7),this.type="primary",this.size="medium",this.pill=!1,this.clearable=!1,this.truncate=!1,this.title=""}connectedCallback(){this.handleClearClick=this.handleClearClick.bind(this)}handleClearClick(){this.grClear.emit()}render(){return de(ge,{class:{[`tag-${this.type}`]:!0,[`tag-${this.size}`]:!0,"tag-pill":this.pill,"tag-clearable":this.clearable}},de("span",{class:"tag"},de("span",{class:{"tag-truncate":this.truncate},title:this.title},de("slot",null)),this.clearable&&de("gr-button",{variant:"plain",size:this.size,class:"tag-clear","aria-label":"clear",onClick:this.handleClearClick},de("svg",{slot:"icon-only",role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Close"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 368L144 144M368 144L144 368"})))))}static get style(){return":host{--height:calc(var(--gr-form-element-height-medium) * 0.8);--line-height:calc(var(--gr-form-element-height-medium) - 1px * 2);--border-radius:var(--gr-form-element-border-radius-medium);--border-width:1px;--border-style:solid;--padding-top:0;--padding-start:var(--gr-spacing-small);--padding-end:var(--gr-spacing-small);--padding-bottom:0;--font-size:var(--gr-form-element-font-size-medium);--background-color:rgba(var(--gr-color-primary-rgb), 0.05);--border-color:rgba(var(--gr-color-primary-rgb), 0.2);--color:var(--gr-color-primary-shade);--clear-color:var(--gr-color-primary);--clear-color-hover:var(--gr-color-primary-shade);--clear-margin-left:var(--gr-spacing-xx-small);--clear-margin-right:calc(-1 * var(--gr-spacing-xxx-small));display:inline-block;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host(.tag-success){--background-color:rgba(var(--gr-color-success-rgb), 0.05);--border-color:rgba(var(--gr-color-success-rgb), 0.2);--color:var(--gr-color-success-shade);--clear-color:var(--gr-color-success);--clear-color-hover:var(--gr-color-success-shade)}:host(.tag-info){--background-color:rgba(var(--gr-color-medium-rgb), 0.05);--border-color:rgba(var(--gr-color-medium-rgb), 0.2);--color:var(--gr-color-medium-shade);--clear-color:var(--gr-color-medium);--clear-color-hover:var(--gr-color-medium-shade)}:host(.tag-warning){--background-color:rgba(var(--gr-color-warning-rgb), 0.05);--border-color:rgba(var(--gr-color-warning-rgb), 0.2);--color:var(--gr-color-warning-shade);--clear-color:var(--gr-color-warning);--clear-color-hover:var(--gr-color-warning-shade)}:host(.tag-danger){--background-color:rgba(var(--gr-color-danger-rgb), 0.05);--border-color:rgba(var(--gr-color-danger-rgb), 0.2);--color:var(--gr-color-danger-shade);--clear-color:var(--gr-color-danger);--clear-color-hover:var(--gr-color-danger-shade)}:host(.tag-small){--font-size:var(--gr-form-element-font-size-small);--height:calc(var(--gr-form-element-height-small) * 0.8);--line-height:calc(var(--gr-form-element-height-small) - 1px * 2);--border-radius:var(--gr-form-element-border-radius-small);--padding-start:var(--gr-spacing-x-small);--padding-end:var(--gr-spacing-x-small);--clear-margin-left:var(--gr-spacing-xx-small);--clear-margin-right:calc(-1 * var(--gr-spacing-xxx-small))}:host(.tag-large){--font-size:var(--gr-form-element-font-size-large);--height:calc(var(--gr-form-element-height-large) * 0.8);--line-height:calc(var(--gr-form-element-height-large) - 1px * 2);--border-radius:var(--gr-form-element-border-radius-large);--padding:0 var(--gr-spacing-medium);--clear-margin-left:var(--gr-spacing-xx-small);--clear-margin-right:calc(-1 * var(--gr-spacing-x-small))}.tag{display:flex;align-items:center;border-style:var(--border-style);border-width:var(--border-width);border-radius:var(--border-radius);white-space:nowrap;user-select:none;cursor:default;font-family:var(--gr-font-family);font-size:var(--font-size);font-weight:var(--gr-font-weight-normal);height:var(--height);line-height:var(--line-height);padding-top:var(--padding-top);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-bottom:var(--padding-bottom);background-color:var(--background-color);border-color:var(--border-color);color:var(--color)}.tag-clear{--color:var(--clear-color);--color-hover:var(--clear-color-hover);--padding-start:0;--padding-end:0;margin-left:var(--clear-margin-left);margin-right:var(--clear-margin-right);--height:1em}.tag-clear svg{font-size:0.7em}.tag-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tag-clear svg{width:1.1em;height:1.1em}:host(.tag-pill) .tag{border-radius:var(--height)}"}},[1,"gr-tag",{type:[513],size:[513],pill:[516],clearable:[516],truncate:[516],title:[513]}]);function ti(){if("undefined"==typeof customElements)return;["gr-tag","gr-button","gr-spinner"].forEach((e=>{switch(e){case"gr-tag":customElements.get(e)||customElements.define(e,ei);break;case"gr-button":customElements.get(e)||St();break;case"gr-spinner":customElements.get(e)||Et()}}))}ti(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const ri="undefined"!=typeof HTMLElement?HTMLElement:class{};let ii=0;const oi=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grChange=fe(this,"gr-change",7),this.grFocus=fe(this,"gr-focus",7),this.grBlur=fe(this,"gr-blur",7),this.inputId="select-"+ ++ii,this.labelId=`select-label-${ii}`,this.helpTextId=`select-help-text-${ii}`,this.invalidTextId=`select-invalid-text-${ii}`,this.inheritedAttributes={},this.handleBlur=()=>{this.isOpen||(this.hasFocus=!1,this.grBlur.emit())},this.handleFocus=()=>{this.hasFocus||(this.hasFocus=!0,this.grFocus.emit())},this.hasFocus=!1,this.hasHelpTextSlot=!1,this.hasInvalidTextSlot=!1,this.hasLabelSlot=!1,this.isOpen=!1,this.items=[],this.displayLabel="",this.displayTags=[],this.multiple=!1,this.maxTagsVisible=3,this.disabled=!1,this.name="",this.placeholder="",this.size="medium",this.hoist=!1,this.value="",this.pill=!1,this.label="",this.requiredIndicator=!1,this.helpText="",this.invalidText="",this.invalid=!1,this.clearable=!1}handleDisabledChange(){this.disabled&&this.isOpen&&this.dropdown.hide()}handleLabelChange(){this.handleSlotChange()}handleMultipleChange(){const e=this.getValueAsArray();this.value=this.multiple?e:e[0]||"",this.syncItemsFromValue()}handleValueChange(){this.syncItemsFromValue(),this.grChange.emit()}connectedCallback(){this.handleClearClick=this.handleClearClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleLabelClick=this.handleLabelClick.bind(this),this.handleMenuHide=this.handleMenuHide.bind(this),this.handleMenuShow=this.handleMenuShow.bind(this),this.handleMenuSelect=this.handleMenuSelect.bind(this),this.handleSlotChange=this.handleSlotChange.bind(this),this.handleTagInteraction=this.handleTagInteraction.bind(this),this.el.shadowRoot.addEventListener("slotchange",this.handleSlotChange)}componentWillLoad(){this.handleSlotChange(),this.inheritedAttributes=Ct(this.el,["aria-label"])}componentDidLoad(){this.resizeObserver=new ResizeObserver((()=>this.resizeMenu())),this.reportDuplicateItemValues(),requestAnimationFrame((()=>this.syncItemsFromValue()))}disconnectedCallback(){this.el.shadowRoot.removeEventListener("slotchange",this.handleSlotChange)}async setFocus(){this.hasFocus=!0,this.grFocus.emit(),this.dropdown.focusOnTrigger()}getItemLabel(e){return kt(e.shadowRoot.querySelector("slot:not([name])"))}getItems(){return[...this.el.querySelectorAll("gr-menu-item")]}getValueAsArray(){return Array.isArray(this.value)?this.value:[this.value]}handleClearClick(e){e.stopPropagation(),this.value=this.multiple?[]:"",this.syncItemsFromValue()}handleKeyDown(e){const t=e.target,r=this.getItems(),i=r[0],o=r[r.length-1];if("gr-tag"!==t.tagName.toLowerCase())if("Tab"!==e.key){if(["ArrowDown","ArrowUp"].includes(e.key)){if(e.preventDefault(),this.isOpen||this.dropdown.show(),"ArrowDown"===e.key&&i)return void i.setFocus();if("ArrowUp"===e.key&&o)return void o.setFocus()}this.isOpen||1!==e.key.length||(e.stopPropagation(),e.preventDefault(),this.dropdown.show(),this.menu.typeToSelect(e.key))}else this.isOpen&&this.dropdown.hide()}handleLabelClick(){this.box.focus()}handleMenuSelect(e){const t=e.detail.item;this.multiple?this.value=this.value.includes(t.value)?this.value.filter((e=>e!==t.value)):[...this.value,t.value]:this.value=t.value,this.syncItemsFromValue()}handleMenuShow(e){this.disabled?e.preventDefault():(this.resizeMenu(),this.resizeObserver.observe(this.el),this.isOpen=!0)}handleMenuHide(){this.resizeObserver.unobserve(this.el),this.isOpen=!1,this.box.focus()}handleSlotChange(){this.hasHelpTextSlot=_t(this.el,"help-text"),this.hasInvalidTextSlot=_t(this.el,"invalid-text"),this.hasLabelSlot=_t(this.el,"label"),this.syncItemsFromValue(),this.reportDuplicateItemValues()}handleTagInteraction(e){e.composedPath().find((e=>{if(e instanceof ri)return e.classList.contains("tag-clear")}))&&e.stopPropagation()}reportDuplicateItemValues(){const e=this.getItems().map((e=>e.value)).filter(((e,t,r)=>r.indexOf(e)!==t));if(e.length)throw new Error('Duplicate value found on in : "'+e.join('", "')+'"')}resizeMenu(){this.menu.style.width=`${this.box.clientWidth}px`}syncItemsFromValue(){const e=this.getItems(),t=this.getValueAsArray();if(e.map((e=>e.checked=t.includes(e.value))),this.multiple){const r=[];if(t.map((t=>e.map((e=>e.value===t?r.push(e):null)))),this.displayTags=r.map((e=>de("gr-tag",{type:"info",size:this.size,pill:this.pill,clearable:!0,onClick:this.handleTagInteraction,onKeyDown:this.handleTagInteraction,"onGr-clear":t=>{t.stopPropagation(),this.disabled||(e.checked=!1,this.syncValueFromItems())}},this.getItemLabel(e)))),this.maxTagsVisible>0&&this.displayTags.length>this.maxTagsVisible){const e=this.displayTags.length;this.displayLabel="",this.displayTags=this.displayTags.slice(0,this.maxTagsVisible),this.displayTags.push(de("gr-tag",{type:"info",size:this.size,pill:this.pill},"+",e-this.maxTagsVisible))}}else{const r=e.filter((e=>e.value===t[0]))[0];this.displayLabel=r?this.getItemLabel(r):"",this.displayTags=[]}}syncValueFromItems(){const e=this.getItems().filter((e=>e.checked)).map((e=>e.value));this.multiple?this.value=this.value.filter((t=>e.includes(t))):this.value=e.length>0?e[0]:""}render(){var e;const t=this.multiple?this.value.length>0:""!==this.value,r=this.inheritedAttributes["aria-label"]?{"aria-label":this.inheritedAttributes["aria-label"]}:{"aria-labelledby":this.labelId};return((e,t,r,i)=>{let o=e.querySelector("input.aux-input");o||(o=e.ownerDocument.createElement("input"),o.type="hidden",o.classList.add("aux-input"),e.appendChild(o)),o.disabled=i,o.name=t,o.value=r||""})(this.el,this.name,ni(this.value),this.disabled),de(xt,{inputId:this.inputId,label:this.label,labelId:this.labelId,hasLabelSlot:this.hasLabelSlot,helpTextId:this.helpTextId,helpText:this.helpText,hasHelpTextSlot:this.hasHelpTextSlot,invalidTextId:this.invalidTextId,invalidText:this.invalidText,invalid:this.invalid,hasInvalidTextSlot:this.hasInvalidTextSlot,size:this.size,onLabelClick:this.handleLabelClick,requiredIndicator:this.requiredIndicator},de("gr-dropdown",{ref:e=>this.dropdown=e,hoist:this.hoist,closeOnSelect:!this.multiple,containingElement:this.el,class:{select:!0,"select-open":this.isOpen,"select-empty":0===(null===(e=this.value)||void 0===e?void 0:e.length),"select-focused":this.hasFocus,"select-clearable":this.clearable,"select-disabled":this.disabled,"select-multiple":this.multiple,"select-has-tags":this.multiple&&t,"select-placeholder-visible":""===this.displayLabel,[`select-${this.size}`]:!0,"select-pill":this.pill,"select-invalid":this.invalid},"onGr-show":this.handleMenuShow,"onGr-hide":this.handleMenuHide},de("div",Object.assign({slot:"trigger",ref:e=>this.box=e,id:this.inputId,class:"select-box",role:"combobox"},r,{"aria-describedby":this.invalid?this.invalidTextId:this.helpTextId,"aria-haspopup":"true","aria-expanded":this.isOpen?"true":"false","aria-invalid":this.invalid?"true":"false","aria-required":this.requiredIndicator?"true":"false",tabIndex:this.disabled?-1:0,onBlur:this.handleBlur,onFocus:this.handleFocus,onKeyDown:this.handleKeyDown}),de("div",{class:"select-label"},this.displayTags.length?de("span",{class:"select-tags"},this.displayTags):this.displayLabel||this.placeholder),this.clearable&&t&&de("button",{class:"select-clear",type:"button",onClick:this.handleClearClick,"aria-label":"clear",tabindex:"-1"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Close Circle"),de("path",{d:"M448 256c0-106-86-192-192-192S64 150 64 256s86 192 192 192 192-86 192-192z",fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32"}),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M320 320L192 192M192 320l128-128"}))),de("span",{class:"caret"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Chevron Down"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"M112 184l144 144 144-144"}))),de("input",{class:"select-hidden-select","aria-hidden":"true",value:t?"1":"",tabIndex:-1})),de("gr-menu",{ref:e=>this.menu=e,class:"select-menu","onGr-select":this.handleMenuSelect},de("slot",{onSlotchange:this.handleSlotChange}))))}get el(){return this}static get watchers(){return{disabled:["handleDisabledChange"],helpText:["handleLabelChange"],invalidText:["handleLabelChange"],label:["handleLabelChange"],multiple:["handleMultipleChange"],value:["handleValueChange"]}}static get style(){return".form-control .form-control-label{display:none}.form-control .form-control-help-text{display:none}.form-control .form-control-invalid-text{display:none}.form-control-has-label .form-control-label{display:flex;line-height:var(--gr-line-height-normal);color:var(--gr-form-element-label-color);margin-bottom:var(--gr-spacing-xxx-small)}.form-control-has-label.form-control-small .form-control-label{font-size:var(--gr-form-element-label-font-size-small)}.form-control-has-label.form-control-medium .form-control-label{font-size:var(--gr-form-element-label-font-size-medium)}.form-control-has-label.form-control-large .form-control-label{font-size:var(--gr-form-element-label-font-size-large)}.form-control-has-label .form-control-label .asterisk{margin-left:var(--gr-spacing-x-small);color:var(--gr-color-medium)}.form-control-has-label .form-control-label .asterisk svg{width:0.6em;height:0.6em;margin-bottom:var(--gr-spacing-xxx-small)}.form-control-has-help-text .form-control-help-text{display:block;line-height:var(--gr-line-height-normal);color:var(--gr-form-element-help-text-color);margin-top:var(--gr-spacing-xxx-small)}.form-control-has-help-text.form-control-small .form-control-help-text{font-size:var(--gr-form-element-help-text-font-size-small);min-height:1.625rem}.form-control-has-help-text.form-control-medium .form-control-help-text{font-size:var(--gr-form-element-help-text-font-size-medium);min-height:1.875rem}.form-control-has-help-text.form-control-large .form-control-help-text{font-size:var(--gr-form-element-help-text-font-size-large);min-height:2.125rem}.form-control-has-invalid-text .form-control-invalid-text{display:flex;margin-left:-2px;line-height:var(--gr-line-height-normal);color:var(--gr-form-element-invalid-text-color);margin-top:var(--gr-spacing-xxx-small)}.form-control-has-invalid-text .form-control-invalid-text .icon{margin-top:var(--gr-spacing-xxx-small);margin-right:var(--gr-spacing-xx-small)}.form-control-has-invalid-text .form-control-invalid-text .icon svg{width:1.4em;height:1.4em}.form-control-has-invalid-text.form-control-small .form-control-invalid-text{font-size:var(--gr-form-element-invalid-text-font-size-small);min-height:1.625rem}.form-control-has-invalid-text.form-control-medium .form-control-invalid-text{font-size:var(--gr-form-element-invalid-text-font-size-medium);min-height:1.875rem}.form-control-has-invalid-text.form-control-large .form-control-invalid-text{font-size:var(--gr-form-element-invalid-text-font-size-large);min-height:2.125rem}.gr-scroll-lock{overflow:hidden !important}:host{--font-size:var(--gr-form-element-font-size-medium);--font-weight:var(--gr-font-weight-normal);--background-color:var(--gr-color-white);--background-color-hover:var(--gr-color-white);--background-color-focus:var(--gr-color-white);--background-color-invalid:var(--gr-color-white);--background-color-invalid-hover:var(--gr-color-white);--border-radius:var(--gr-form-element-border-radius-small);--border-color:var(--gr-color-light-shade);--border-color-hover:var(--gr-color-medium);--border-color-focus:var(--gr-color-primary);--border-color-invalid:var(--gr-color-danger);--border-color-invalid-hover:var(--gr-color-danger-shade);--color:var(--gr-color-dark-tint);--placeholder-color:var(--gr-color-medium-tint);--min-height:var(--gr-form-element-height-medium);--label-margin-start:var(--gr-spacing-medium);--label-margin-end:var(--gr-spacing-medium);--clear-icon-margin-end:var(--gr-spacing-medium);--caret-margin-end:var(--gr-spacing-medium);--tags-padding-top:3px;--tags-padding-bottom:3px;--tags-margin-end:var(--gr-spacing-xx-small);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33);display:block;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.select-small{--font-size:var(--gr-form-element-font-size-small);--min-height:var(--gr-form-element-height-small);--label-margin-start:var(--gr-spacing-small);--label-margin-end:var(--gr-spacing-small);--clear-icon-margin-end:var(--gr-spacing-small);--caret-margin-end:var(--gr-spacing-small);--tags-padding-top:2px;--tags-padding-bottom:2px}.select-large{--font-size:var(--gr-form-element-font-size-large);--min-height:var(--gr-form-element-height-large);--label-margin-start:var(--gr-spacing-large);--label-margin-end:var(--gr-spacing-large);--clear-icon-margin-end:var(--gr-spacing-large);--caret-margin-end:var(--gr-spacing-large);--tags-padding-top:4px;--tags-padding-bottom:4px}.select{display:block}.select-box{display:inline-flex;align-items:center;justify-content:start;position:relative;width:100%;font-family:var(--gr-font-family);font-size:var(--font-size);font-weight:var(--font-weight);letter-spacing:normal;background-color:var(--background-color);border:solid 1px var(--border-color);border-radius:var(--border-radius);min-height:var(--min-height);color:var(--color);vertical-align:middle;overflow:hidden;transition:150ms color, 150ms border, 150ms box-shadow;cursor:pointer}.select.select-invalid:not(.select-disabled) .select-box{background-color:var(--background-color-invalid);border-color:var(--border-color-invalid)}.select.select-invalid:not(.select-disabled):not(.select-focused) .select-box:hover{background-color:var(--background-color-invalid-hover);border-color:var(--border-color-invalid-hover)}.select.select-invalid:not(.select-disabled) .select-box{background-color:var(--background-color-invalid);border-color:var(--border-color-invalid)}.select:not(.select-disabled) .select-box:hover{background-color:var(--background-color-hover);border-color:var(--border-color-hover)}.select.select-focused:not(.select-disabled) .select-box{outline:none;box-shadow:var(--focus-ring);border-color:var(--border-color-focus);background-color:var(--background-color-focus)}.select-disabled .select-box{opacity:0.5;cursor:not-allowed;outline:none}.select-disabled .select-tags,.select-disabled .select-clear{pointer-events:none}.select-label{flex:1 1 auto;display:flex;align-items:center;user-select:none;margin-top:0;margin-left:var(--label-margin-start);margin-right:var(--label-margin-end);margin-bottom:0;scrollbar-width:none;-ms-overflow-style:none;overflow-x:auto;overflow-y:hidden;white-space:nowrap}.select-label::-webkit-scrollbar{width:0;height:0}.select-has-tags .select-label{margin-left:0}.select-clear{display:inline-flex;align-items:center;font-size:inherit;color:var(--gr-color-medium);border:none;background:none;padding:0;transition:150ms color;cursor:pointer;margin-right:var(--clear-icon-margin-end)}.select-clear:hover{color:var(--gr-color-dark)}.select-clear:focus{outline:none}.select-clear svg{width:1.2em;height:1.2em;font-size:var(--font-size)}.caret{flex:0 0 auto;display:inline-flex;transition:250ms transform ease;margin-right:var(--caret-margin-end)}.caret svg{width:1em;height:1em;font-size:var(--font-size)}.select-open .caret{transform:rotate(-180deg)}.select-placeholder-visible .select-label{color:var(--placeholder-color)}.select-tags{display:inline-flex;align-items:center;flex-wrap:wrap;justify-content:left;margin-left:var(--gr-spacing-xx-small);padding-bottom:var(--tags-padding-bottom)}.select-tags gr-tag{padding-top:var(--tags-padding-top)}.select-tags gr-tag:not(:last-of-type){margin-right:var(--tags-margin-end)}.select-hidden-select{clip:rect(0 0 0 0);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px;position:absolute;top:0;left:0;width:100%;height:100%}.select-pill .select-box{border-radius:var(--min-height)}"}},[1,"gr-select",{multiple:[4],maxTagsVisible:[2,"max-tags-visible"],disabled:[4],name:[1],placeholder:[1],size:[1],hoist:[4],value:[1025],pill:[4],label:[1],requiredIndicator:[4,"required-indicator"],helpText:[1,"help-text"],invalidText:[1,"invalid-text"],invalid:[516],clearable:[4],hasFocus:[32],hasHelpTextSlot:[32],hasInvalidTextSlot:[32],hasLabelSlot:[32],isOpen:[32],items:[32],displayLabel:[32],displayTags:[32],setFocus:[64]}]),ni=e=>{if(null!=e)return Array.isArray(e)?e.join(","):e.toString()};!function(){if("undefined"==typeof customElements)return;["gr-select","gr-button","gr-dropdown","gr-menu","gr-spinner","gr-tag"].forEach((e=>{switch(e){case"gr-select":customElements.get(e)||customElements.define(e,oi);break;case"gr-button":customElements.get(e)||St();break;case"gr-dropdown":customElements.get(e)||Xr();break;case"gr-menu":customElements.get(e)||Jr();break;case"gr-spinner":customElements.get(e)||Et();break;case"gr-tag":customElements.get(e)||ti()}}))}();const ai=oi,si=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.hasFocus=!1,this.checked=!1,this.value="",this.disabled=!1}connectedCallback(){this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleMouseEnter=this.handleMouseEnter.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this)}async setFocus(e){this.el.focus(e)}async removeFocus(){this.el.blur()}handleBlur(){this.hasFocus=!1}handleFocus(){this.hasFocus=!0}handleMouseEnter(){this.setFocus()}handleMouseLeave(){this.removeFocus()}render(){return de(ge,{class:{"menu-item-checked":this.checked,"menu-item-disabled":this.disabled,"menu-item-focused":this.hasFocus},role:"menuitem","aria-disabled":this.disabled?"true":"false","aria-checked":this.checked?"true":"false",tabIndex:this.disabled?null:0,onFocus:this.handleFocus,onBlur:this.handleBlur,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave},de("span",{class:"checkmark"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Checkmark"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M416 128L192 384l-96-96"}))),de("span",{class:"start"},de("slot",{name:"start"})),de("span",{class:"label"},de("slot",null)),de("span",{class:"end"},de("slot",{name:"end"})))}get el(){return this}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{--line-height:var(--gr-line-height-normal);--background-color:transparent;--background-color-focused:var(--gr-color-primary);--color:var(--gr-color-dark);--color-focused:var(--gr-color-primary-contrast);--color-disabled:var(--gr-color-medium);--padding-top:var(--gr-spacing-xx-small);--padding-start:var(--gr-spacing-x-large);--padding-end:var(--gr-spacing-x-large);--padding-bottom:var(--gr-spacing-xx-small);--transition:background-color 150ms linear, color 150ms linear;position:relative;display:flex;align-items:stretch;font-family:var(--gr-font-family);font-size:var(--gr-font-size-medium);font-weight:var(--gr-font-weight-normal);line-height:var(--line-height);letter-spacing:var(--gr-letter-spacing-normal);text-align:left;background-color:var(--background-color);color:var(--color);padding-top:var(--padding-top);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-bottom:var(--padding-bottom);transition:var(--transition);user-select:none;white-space:nowrap;cursor:pointer;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host(.menu-item-focused:not(.menu-item-disabled)){outline:none;background-color:var(--background-color-focused);color:var(--color-focused)}:host(.menu-item-disabled){outline:none;color:var(--color-disabled);cursor:not-allowed}.checkmark{display:flex;position:absolute;left:0.5em;top:calc(50% - 0.5em);visibility:hidden;align-items:center;font-size:inherit}.checkmark svg{display:inline-block;width:1.1em;height:1.1em;contain:strict;fill:currentcolor;box-sizing:content-box !important}:host(.menu-item-checked) .checkmark{visibility:visible}.label{flex:1 1 auto}.start{flex:0 0 auto;display:flex;align-items:center}.start ::slotted(:last-child){margin-right:0.5em}.end{flex:0 0 auto;display:flex;align-items:center}.end ::slotted(:first-child){margin-left:0.5em}"}},[1,"gr-menu-item",{checked:[516],value:[513],disabled:[516],hasFocus:[32],setFocus:[64],removeFocus:[64]}]); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */!function(){if("undefined"==typeof customElements)return;["gr-menu-item"].forEach((e=>{if("gr-menu-item"===e)customElements.get(e)||customElements.define(e,si)}))}();const li={"gr-select":ai,"gr-menu-item":si};class ci extends(P(_)){constructor(){super(...arguments),this.value=null,this.multiple=!1,this.clearable=!1,this._refSelect=y()}reset(){this.value=null}_valueChangedHandler(e){const t=this._refSelect.value?.value;if(void 0!==t&&!l(this.value,t)){const e=null===this.value;this.value=t,e||w(this,"select:change",t)}}willUpdate(e){e.has("initialValue")&&this.initialValue&&!this.value&&(this.value=this.initialValue)}render(){return $` + ${this.options?.map((e=>$`${e.label}`))} + `}static get styles(){return k(':root, :host {\n --gr-color-primary: #1079b2;\n --gr-color-primary-rgb: 16, 121, 178;\n --gr-color-primary-contrast: #ffffff;\n --gr-color-primary-contrast-rgb: 255, 255, 255;\n --gr-color-primary-shade: #0d6696;\n --gr-color-primary-tint: #1499e1;\n --gr-color-secondary: #051f2c;\n --gr-color-secondary-rgb: 5, 31, 44;\n --gr-color-secondary-contrast: #ffffff;\n --gr-color-secondary-contrast-rgb: 255, 255, 255;\n --gr-color-secondary-shade: #000000;\n --gr-color-secondary-tint: #0a415c;\n --gr-color-tertiary: #0c4a6e;\n --gr-color-tertiary-rgb: 12, 74, 110;\n --gr-color-tertiary-contrast: #ffffff;\n --gr-color-tertiary-contrast-rgb: 255, 255, 255;\n --gr-color-tertiary-shade: #083249;\n --gr-color-tertiary-tint: #106393;\n --gr-color-success: #0fbe78;\n --gr-color-success-rgb: 15, 190, 120;\n --gr-color-success-contrast: #000000;\n --gr-color-success-contrast-rgb: 0, 0, 0;\n --gr-color-success-shade: #057f4e;\n --gr-color-success-tint: #12e28f;\n --gr-color-warning: #fbbc4e;\n --gr-color-warning-rgb: 251, 188, 78;\n --gr-color-warning-contrast: #051f2c;\n --gr-color-warning-contrast-rgb: 5, 31, 44;\n --gr-color-warning-shade: #9e6400;\n --gr-color-warning-tint: #fdd187;\n --gr-color-danger: #e60017;\n --gr-color-danger-rgb: 230, 0, 23;\n --gr-color-danger-contrast: #ffffff;\n --gr-color-danger-contrast-rgb: 255, 255, 255;\n --gr-color-danger-shade: #cc0014;\n --gr-color-danger-tint: #ff1f35;\n --gr-color-light: #f4f5f8;\n --gr-color-light-rgb: 244, 245, 248;\n --gr-color-light-contrast: #051f2c;\n --gr-color-light-contrast-rgb: 5, 31, 44;\n --gr-color-light-shade: #d7d8da;\n --gr-color-light-tint: #f9fafb;\n --gr-color-medium: #5e6c78;\n --gr-color-medium-rgb: 94, 108, 120;\n --gr-color-medium-contrast: #ffffff;\n --gr-color-medium-contrast-rgb: 255, 255, 255;\n --gr-color-medium-shade: #48535b;\n --gr-color-medium-tint: #81909c;\n --gr-color-dark: #02131b;\n --gr-color-dark-rgb: 2, 19, 27;\n --gr-color-dark-contrast: #ffffff;\n --gr-color-dark-contrast-rgb: 255, 255, 255;\n --gr-color-dark-shade: #000000;\n --gr-color-dark-tint: #222428;\n --gr-color-white: #ffffff;\n --gr-color-black: #000000;\n --gr-border-radius-small: 0.125rem;\n --gr-border-radius-medium: 0.25rem;\n --gr-border-radius-large: 0.5rem;\n --gr-border-radius-x-large: 1rem;\n --gr-border-width-small: 0.063rem;\n --gr-border-width-medium: 0.125rem;\n --gr-border-width-large: 0.188rem;\n --gr-shadow-x-small: 0 1px 0 #0d131e0d;\n --gr-shadow-small: 0 1px 2px #0d131e1a;\n --gr-shadow-medium: 0 2px 4px #0d131e1a;\n --gr-shadow-large: 0 2px 8px #0d131e1a;\n --gr-shadow-x-large: 0 4px 16px #0d131e1a;\n --gr-spacing-xxx-small: 0.125rem;\n --gr-spacing-xx-small: 0.25rem;\n --gr-spacing-x-small: 0.5rem;\n --gr-spacing-small: 0.75rem;\n --gr-spacing-medium: 1rem;\n --gr-spacing-large: 1.25rem;\n --gr-spacing-x-large: 1.75rem;\n --gr-spacing-xx-large: 2.25rem;\n --gr-spacing-xxx-large: 3rem;\n --gr-spacing-xxxx-large: 4.5rem;\n --gr-font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,\n sans-serif;\n --gr-letter-spacing-dense: -0.015em;\n --gr-letter-spacing-normal: normal;\n --gr-letter-spacing-loose: 0.075em;\n --gr-line-height-dense: 1.4;\n --gr-line-height-normal: 1.8;\n --gr-line-height-loose: 2.2;\n --gr-font-size-xx-small: 0.625rem;\n --gr-font-size-x-small: 0.75rem;\n --gr-font-size-small: 0.875rem;\n --gr-font-size-medium: 1rem;\n --gr-font-size-large: 1.25rem;\n --gr-font-size-x-large: 1.5rem;\n --gr-font-size-xx-large: 2.25rem;\n --gr-font-size-xxx-large: 3rem;\n --gr-font-size-xxxx-large: 4.5rem;\n --gr-font-weight-thin: 100;\n --gr-font-weight-extra-light: 200;\n --gr-font-weight-light: 300;\n --gr-font-weight-normal: 400;\n --gr-font-weight-medium: 500;\n --gr-font-weight-semi-bold: 600;\n --gr-font-weight-bold: 700;\n --gr-font-weight-extra-bold: 800;\n --gr-font-weight-black: 900;\n --gr-form-element-font-size-x-small: var(--gr-font-size-x-small);\n --gr-form-element-font-size-small: var(--gr-font-size-small);\n --gr-form-element-font-size-medium: var(--gr-font-size-medium);\n --gr-form-element-font-size-large: var(--gr-font-size-large);\n --gr-form-element-height-small: 2.188rem;\n --gr-form-element-height-medium: 3.125rem;\n --gr-form-element-height-large: 4.063rem;\n --gr-form-element-border-radius-small: var(--gr-border-radius-medium);\n --gr-form-element-border-radius-medium: var(--gr-border-radius-medium);\n --gr-form-element-border-radius-large: var(--gr-border-radius-medium);\n --gr-focus-ring-width: 2px;\n --gr-form-element-label-font-size-small: var(--gr-font-size-small);\n --gr-form-element-label-font-size-medium: var(--gr-font-size-medium);\n --gr-form-element-label-font-size-large: var(--gr-font-size-large);\n --gr-form-element-label-color: inherit;\n --gr-form-element-help-text-font-size-small: var(--gr-font-size-x-small);\n --gr-form-element-help-text-font-size-medium: var(--gr-font-size-small);\n --gr-form-element-help-text-font-size-large: var(--gr-font-size-medium);\n --gr-form-element-help-text-color: var(--gr-color-medium);\n --gr-form-element-invalid-text-font-size-small: var(--gr-font-size-x-small);\n --gr-form-element-invalid-text-font-size-medium: var(--gr-font-size-small);\n --gr-form-element-invalid-text-font-size-large: var(--gr-font-size-medium);\n --gr-form-element-invalid-text-color: var(--gr-color-danger);\n --gr-toggle-size: 1rem;\n --gr-panel-border-color: var(--gr-color-light-shade);\n --gr-z-index-dropdown: 900;\n}\n\n')}}ci.elementDefinitions={...li},f([v({attribute:!1,hasChanged:b})],ci.prototype,"options",void 0),f([v({attribute:!1,hasChanged:b})],ci.prototype,"value",void 0),f([v({attribute:!1,hasChanged:b})],ci.prototype,"initialValue",void 0),f([v({attribute:!0})],ci.prototype,"label",void 0),f([v({attribute:!0})],ci.prototype,"placeholder",void 0),f([v({attribute:!0,type:Boolean})],ci.prototype,"multiple",void 0),f([v({attribute:!0,type:Boolean})],ci.prototype,"clearable",void 0);let di=class extends(P(_)){constructor(){super(...arguments),this._mediaFilterController=new U(this),this._refMediaType=y(),this._refCamera=y(),this._refWhen=y(),this._refWhenFrom=y(),this._refWhenTo=y(),this._refWhat=y(),this._refWhere=y(),this._refFavorite=y(),this._refTags=y()}willUpdate(e){e.has("viewManagerEpoch")&&this._mediaFilterController.setViewManager(this.viewManagerEpoch?.manager??null),e.has("cameraManager")&&this.cameraManager&&(this._mediaFilterController.computeCameraOptions(this.cameraManager),this._mediaFilterController.computeMetadataOptions(this.cameraManager)),!e.get("viewManager")&&this.viewManagerEpoch&&this.cameraManager&&this._mediaFilterController.computeInitialDefaultsFromView(this.cameraManager)}render(){const e=async()=>{this.cameraManager&&this.viewManagerEpoch&&this.cardWideConfig&&await this._mediaFilterController.valueChangeHandler(this.cameraManager,this.cardWideConfig,{camera:this._refCamera.value?.value??void 0,mediaType:this._refMediaType.value?.value??void 0,when:{selected:this._refWhen.value?.value??void 0,from:this._refWhenFrom.value?.value,to:this._refWhenTo.value?.value},favorite:this._refFavorite.value?.value??void 0,where:this._refWhere.value?.value??void 0,what:this._refWhat.value?.value??void 0,tags:this._refTags.value?.value??void 0})},t=async t=>{"custom"===t&&this._refWhen.value?this._refWhenFrom.value?.value||this._refWhenTo.value?.value?this._refWhen.value.value=B.Custom:this._refWhen.value.reset():this._refWhen.value?.value!==B.Custom&&(this._refWhenFrom.value?.reset(),this._refWhenTo.value?.reset()),await e()};if(!this.cameraManager||!this.viewManagerEpoch)return;const r=this._mediaFilterController.getControlsToShow(this.cameraManager),o=this._mediaFilterController.getDefaults(),n=this._mediaFilterController.getWhatOptions(),a=this._mediaFilterController.getTagsOptions(),s=this._mediaFilterController.getWhereOptions();return $` e()} + > + +
+ t("selected")} + > + + t("custom")} + > + + t("custom")} + > + +
+ e()} + > + + ${r.events&&n.length?$` e()} + > + `:""} + ${r.events&&a.length?$` e()} + > + `:""} + ${r.events&&s.length?$` e()} + > + `:""} + ${r.favorites?$` + e()} + > + + `:""}`}static get styles(){return k(":host {\n display: flex;\n flex-direction: column;\n overflow: auto;\n scrollbar-width: none;\n -ms-overflow-style: none;\n height: 100%;\n width: 300px;\n margin: 5px;\n}\n\n/* Hide scrollbar for Chrome, Safari and Opera */\n:host::-webkit-scrollbar {\n display: none;\n}\n\nfrigate-card-select {\n padding: 5px;\n}\n\ndiv.when {\n display: inline-flex;\n align-items: flex-end;\n}\n\ndiv.when frigate-card-select {\n flex: 1;\n}\n\ndiv.when frigate-card-date-picker {\n padding-bottom: 5px;\n transition: width 0.5s ease-in-out;\n}\n\ndiv.when frigate-card-date-picker {\n color: var(--secondary-color);\n}\n\ndiv.when frigate-card-date-picker.selected {\n color: var(--primary-color);\n}\n\ndiv.when frigate-card-date-picker.hidden {\n width: 0px;\n}")}};di.elementDefinitions={"frigate-card-select":ci,"frigate-card-date-picker":R},f([v({attribute:!1})],di.prototype,"hass",void 0),f([v({attribute:!1})],di.prototype,"cameraManager",void 0),f([v({attribute:!1})],di.prototype,"viewManagerEpoch",void 0),f([v({attribute:!1})],di.prototype,"cardWideConfig",void 0),di=f([C("frigate-card-media-filter")],di);const hi={closed:"mdi:filter-cog-outline",open:"mdi:filter-cog"};let gi=class extends _{render(){const e=this.viewManagerEpoch?.manager.getView();if(this.hass&&e?.isGalleryView()&&this.cameraManager&&this.cardWideConfig)return $` + + ${this.galleryConfig&&"none"!==this.galleryConfig.controls.filter.mode?$` + `:""} + + + + `}static get styles(){return k(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\nfrigate-card-surround-basic {\n max-height: 110dvh;\n}")}};f([v({attribute:!1})],gi.prototype,"hass",void 0),f([v({attribute:!1})],gi.prototype,"viewManagerEpoch",void 0),f([v({attribute:!1})],gi.prototype,"galleryConfig",void 0),f([v({attribute:!1})],gi.prototype,"cameraManager",void 0),f([v({attribute:!1})],gi.prototype,"cardWideConfig",void 0),gi=f([C("frigate-card-gallery")],gi);let ui=class extends _{constructor(){super(),this._refLoaderBottom=y(),this._refSelected=y(),this._showLoaderBottom=!0,this._showLoaderTop=!1,this._boundWheelHandler=this._wheelHandler.bind(this),this._boundTouchStartHandler=this._touchStartHandler.bind(this),this._boundTouchEndHandler=this._touchEndHandler.bind(this),this._throttleExtendGalleryLater=O(this._extendGallery.bind(this),500,{leading:!0,trailing:!1}),this._touchScrollYPosition=null,this._resizeObserver=new ResizeObserver(this._resizeHandler.bind(this)),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}_touchStartHandler(e){1===e.touches.length?this._touchScrollYPosition=e.touches[0].screenY:this._touchScrollYPosition=null}async _touchEndHandler(e){!this.scrollTop&&1===e.changedTouches.length&&this._touchScrollYPosition&&e.changedTouches[0].screenY>this._touchScrollYPosition&&await this._extendLater(),this._touchScrollYPosition=null}async _wheelHandler(e){!this.scrollTop&&e.deltaY<0&&await this._extendLater()}async _extendLater(){const e=new Date;this._showLoaderTop=!0,await this._throttleExtendGalleryLater("later",!1);const t=(new Date).getTime()-e.getTime();t<500&&await S(.5-t/1e3),this._showLoaderTop=!1}connectedCallback(){super.connectedCallback(),this._resizeObserver.observe(this),this.addEventListener("wheel",this._boundWheelHandler,{passive:!0}),this.addEventListener("touchstart",this._boundTouchStartHandler,{passive:!0}),this.addEventListener("touchend",this._boundTouchEndHandler),this.requestUpdate()}disconnectedCallback(){this.removeEventListener("wheel",this._boundWheelHandler),this.removeEventListener("touchstart",this._boundTouchStartHandler),this.removeEventListener("touchend",this._boundTouchEndHandler),this._resizeObserver.disconnect(),this._intersectionObserver.disconnect(),super.disconnectedCallback()}_setColumnCount(){const e=this.galleryConfig?.controls.thumbnails.size??M.media_gallery.controls.thumbnails.size,t=this.galleryConfig?.controls.thumbnails.show_details?Math.max(1,Math.floor(this.clientWidth/z)):Math.max(1,Math.ceil(this.clientWidth/e));this.style.setProperty("--frigate-card-gallery-columns",String(t))}_resizeHandler(){this._setColumnCount()}async _intersectionHandler(e){e.every((e=>!e.isIntersecting))||(this._showLoaderBottom=!1,await this._extendGallery("earlier"))}async _extendGallery(e,t=!0){const r=this.viewManagerEpoch?.manager.getView();if(!this.cameraManager||!this.hass||!r)return;const i=r.query,n=i?.getQueries()??null,s=r.queryResults?.getResults();if(!i||!n||!s)return;let l;try{l=await this.cameraManager.extendMediaQueries(n,s,e,{useCache:t})}catch(e){return void d(e)}if(l){const e=c.areEventQueries(i)?new o(l.queries):c.areRecordingQueries(i)?new a(l.queries):null;e&&this.viewManagerEpoch?.manager.setViewByParameters({baseView:r,params:{query:e,queryResults:new L({results:l.results}).selectResultIfFound((e=>e===r.queryResults?.getSelectedResult()))}})}}willUpdate(e){if(e.has("galleryConfig")&&(this.galleryConfig?.controls.thumbnails.show_details?this.setAttribute("details",""):this.removeAttribute("details"),this._setColumnCount(),this.galleryConfig?.controls.thumbnails.size&&this.style.setProperty("--frigate-card-thumbnail-size",`${this.galleryConfig.controls.thumbnails.size}px`)),e.has("viewManagerEpoch")){this._showLoaderBottom=!0;const e=this.viewManagerEpoch?.manager.getView(),t=this.viewManagerEpoch?.oldView;this._media&&t?.queryResults?.getResults()===e?.queryResults?.getResults()||(this._media=[...e?.queryResults?.getResults()??[]].reverse())}}render(){if(!this._media||!this.hass)return $``;const e=this.viewManagerEpoch?.manager.getView();if(!e?.queryResults||0===e.queryResults.getResultsCount()){const t=!!e?.context?.loading?.query;return D({type:"info",message:i(t?"error.awaiting_media":"common.no_media"),icon:"mdi:multimedia",dotdotdot:t})}const t=e.queryResults.getSelectedResult();return $`
+ ${this._showLoaderTop?$`${A({cardWideConfig:this.cardWideConfig,classes:{top:!0},size:"small"})}`:""} + ${this._media.map(((r,i)=>$`{this._media&&this.viewManagerEpoch?.manager.setViewByParameters({params:{view:"media",queryResults:e.queryResults?.clone().selectIndex(this._media.length-i-1)}}),F(t)}} + > + `))} + ${this._showLoaderBottom?$`${A({cardWideConfig:this.cardWideConfig,componentRef:this._refLoaderBottom})}`:""} +
`}updated(e){this._refLoaderBottom.value&&(this._intersectionObserver.disconnect(),this._intersectionObserver.observe(this._refLoaderBottom.value)),this.updateComplete.then((()=>{e.has("viewManagerEpoch")&&!e.get("viewManagerEpoch")&&this._refSelected.value&&this._refSelected.value.scrollIntoView({block:"center"})}))}static get styles(){return k(":host {\n width: 100%;\n height: 100%;\n display: block;\n overflow: auto;\n -ms-overflow-style: none;\n scrollbar-width: none;\n --frigate-card-gallery-gap: 3px;\n --frigate-card-gallery-columns: 4;\n}\n\n.grid {\n display: grid;\n grid-template-columns: repeat(var(--frigate-card-gallery-columns), minmax(0, 1fr));\n grid-auto-rows: min-content;\n gap: var(--frigate-card-gallery-gap);\n}\n\n:host::-webkit-scrollbar {\n display: none;\n}\n\nfrigate-card-thumbnail {\n height: 100%;\n max-height: var(--frigate-card-thumbnail-size);\n}\n\nfrigate-card-thumbnail:not([details]) {\n width: 100%;\n}\n\nfrigate-card-thumbnail.selected {\n border: 4px solid var(--accent-color);\n border-radius: calc(var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px)) + 4px);\n}\n\nfrigate-card-progress-indicator.top {\n grid-column: 1/-1;\n}")}};f([v({attribute:!1})],ui.prototype,"hass",void 0),f([v({attribute:!1})],ui.prototype,"viewManagerEpoch",void 0),f([v({attribute:!1})],ui.prototype,"galleryConfig",void 0),f([v({attribute:!1})],ui.prototype,"cameraManager",void 0),f([v({attribute:!1})],ui.prototype,"cardWideConfig",void 0),f([E()],ui.prototype,"_showLoaderBottom",void 0),f([E()],ui.prototype,"_showLoaderTop",void 0),ui=f([C("frigate-card-gallery-core")],ui);export{gi as FrigateCardGallery,ui as FrigateCardGalleryCore}; diff --git a/config/www/community/frigate-hass-card/gallery-c718155d.js.gz b/config/www/community/frigate-hass-card/gallery-c718155d.js.gz new file mode 100644 index 00000000..d5eda4d8 Binary files /dev/null and b/config/www/community/frigate-hass-card/gallery-c718155d.js.gz differ diff --git a/config/www/community/frigate-hass-card/get-technology-for-video-rtc-778a0c05.js b/config/www/community/frigate-hass-card/get-technology-for-video-rtc-778a0c05.js new file mode 100644 index 00000000..8bcd1216 --- /dev/null +++ b/config/www/community/frigate-hass-card/get-technology-for-video-rtc-778a0c05.js @@ -0,0 +1 @@ +const e=e=>{const s=[...e.pc?["webrtc"]:[],...!e.pc&&e.mseCodecs?["mse","hls"]:[]];return s.length?s:void 0};export{e as g}; diff --git a/config/www/community/frigate-hass-card/get-technology-for-video-rtc-778a0c05.js.gz b/config/www/community/frigate-hass-card/get-technology-for-video-rtc-778a0c05.js.gz new file mode 100644 index 00000000..172bdaaa Binary files /dev/null and b/config/www/community/frigate-hass-card/get-technology-for-video-rtc-778a0c05.js.gz differ diff --git a/config/www/community/frigate-hass-card/ha-1d1cb9a1.js b/config/www/community/frigate-hass-card/ha-1d1cb9a1.js new file mode 100644 index 00000000..4d9b2217 --- /dev/null +++ b/config/www/community/frigate-hass-card/ha-1d1cb9a1.js @@ -0,0 +1,61 @@ +import{dm as e,cQ as t,x as s,dw as a,dx as r,dy as i,dz as o,r as h,eM as l,_ as n,t as u,a as d,cR as c,cU as y,l as p,cV as m,n as _}from"./card-45855f1f.js";import{c as v,e as g}from"./ha-hls-player-ad38a2a0.js";import{m as f}from"./audio-cf3a75aa.js";import{s as $,h as b,c as w}from"./media-1a34ac2c.js";import{g as R}from"./index-9bf80040.js";customElements.whenDefined("ha-web-rtc-player").then((()=>{let d=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&&$(this._video,e??this.controls)}isPaused(){return this._video?.paused??!0}async getScreenshotURL(){return this._video?e(this._video):null}render(){return this._error?t(this,`${this._error} (${this.entityid})`):s` + + `}static get styles(){return[super.styles,h(v),l` + :host { + width: 100%; + height: 100%; + } + video { + width: 100%; + height: 100%; + } + `]}};n([g("#remote-stream")],d.prototype,"_video",void 0),d=n([u("frigate-card-ha-web-rtc-player")],d)})),customElements.whenDefined("ha-camera-stream").then((()=>{let e=class extends(customElements.get("ha-camera-stream")){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}render(){return this.stateObj?this._shouldRenderMJPEG?s` + {a(this,e,{player:this,technology:["mjpeg"]})}} + .src=${void 0===this._connected||this._connected?(e=this.stateObj,`/api/camera_proxy_stream/${e.entity_id}?token=${e.attributes.access_token}`):""} + /> + `:"hls"===this.stateObj.attributes.frontend_stream_type?this._url?s` `:s``:"web_rtc"===this.stateObj.attributes.frontend_stream_type?s``:void 0:s``;var e}static get styles(){return[super.styles,h(v),l` + :host { + width: 100%; + height: 100%; + } + img { + width: 100%; + height: 100%; + } + `]}};n([g("#player")],e.prototype,"_player",void 0),e=n([u("frigate-card-ha-camera-stream")],e)}));let j=class extends d{constructor(){super(...arguments),this.controls=!0,this._playerRef=c()}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;const e=R(this,this.hass,this.cameraConfig);return e?"unavailable"===e.state?y({message:p("error.live_camera_unavailable"),type:"error",icon:"mdi:connection",context:this.cameraConfig}):s` + `:void 0}static get styles(){return h(":host {\n width: 100%;\n height: 100%;\n display: block;\n}")}};n([_({attribute:!1})],j.prototype,"hass",void 0),n([_({attribute:!1})],j.prototype,"cameraConfig",void 0),n([_({attribute:!0,type:Boolean})],j.prototype,"controls",void 0),j=n([u("frigate-card-live-ha")],j);export{j as FrigateCardLiveHA}; diff --git a/config/www/community/frigate-hass-card/ha-1d1cb9a1.js.gz b/config/www/community/frigate-hass-card/ha-1d1cb9a1.js.gz new file mode 100644 index 00000000..064197b4 Binary files /dev/null and b/config/www/community/frigate-hass-card/ha-1d1cb9a1.js.gz differ diff --git a/config/www/community/frigate-hass-card/ha-31684cf1.js b/config/www/community/frigate-hass-card/ha-31684cf1.js new file mode 100644 index 00000000..2c56374b --- /dev/null +++ b/config/www/community/frigate-hass-card/ha-31684cf1.js @@ -0,0 +1,69 @@ +import{dm as e,cQ as t,x as s,dw as a,dx as i,dy as r,dz as o,r as h,eM as d,_ as n,t as l,cN as c,eP as p,cP as u,a as y,cR as m,cU as _,l as f,cV as v,n as g}from"./card-c642ee74.js";import{c as $,e as b}from"./ha-hls-player-abb86874.js";import{m as w}from"./audio-cf3a75aa.js";import{s as R,h as L,c as P}from"./media-6eadcd60.js";import{g as I}from"./index-0a012f43.js";customElements.whenDefined("ha-web-rtc-player").then((()=>{let c=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&&R(this._video,e??this.controls)}isPaused(){return this._video?.paused??!0}async getScreenshotURL(){return this._video?e(this._video):null}render(){return this._error?t(this,`${this._error} (${this.entityid})`):s` + + `}static get styles(){return[super.styles,h($),d` + :host { + width: 100%; + height: 100%; + } + video { + width: 100%; + height: 100%; + } + `]}};n([b("#remote-stream")],c.prototype,"_video",void 0),c=n([l("frigate-card-ha-web-rtc-player")],c)})),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` + this._storeMediaLoadedInfo(t,p(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` this._storeMediaLoadedInfoHandler("hls",e)} + @streams=${this._handleHlsStreams} + class=${a.visible?"":"hidden"} + >`:a.type===e?s`this._storeMediaLoadedInfoHandler(e,t)} + @streams=${this._handleWebRtcStreams} + class=${a.visible?"":"hidden"} + >`:c:c;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,u(this,e))}}static get styles(){return[super.styles,h($),d` + :host { + width: 100%; + height: 100%; + } + img { + width: 100%; + height: 100%; + } + `]}};n([b("#player")],a.prototype,"_player",void 0),a=n([l("frigate-card-ha-camera-stream")],a)}));let S=class extends y{constructor(){super(...arguments),this.controls=!0,this._playerRef=m()}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;const e=I(this,this.hass,this.cameraConfig);return e?"unavailable"===e.state?_({message:f("error.live_camera_unavailable"),type:"error",icon:"mdi:connection",context:this.cameraConfig}):s` + `:void 0}static get styles(){return h(":host {\n width: 100%;\n height: 100%;\n display: block;\n}")}};n([g({attribute:!1})],S.prototype,"hass",void 0),n([g({attribute:!1})],S.prototype,"cameraConfig",void 0),n([g({attribute:!0,type:Boolean})],S.prototype,"controls",void 0),S=n([l("frigate-card-live-ha")],S);export{S as FrigateCardLiveHA}; diff --git a/config/www/community/frigate-hass-card/ha-31684cf1.js.gz b/config/www/community/frigate-hass-card/ha-31684cf1.js.gz new file mode 100644 index 00000000..e4217976 Binary files /dev/null and b/config/www/community/frigate-hass-card/ha-31684cf1.js.gz differ diff --git a/config/www/community/frigate-hass-card/ha-378b7a69.js b/config/www/community/frigate-hass-card/ha-378b7a69.js new file mode 100644 index 00000000..d5f93879 --- /dev/null +++ b/config/www/community/frigate-hass-card/ha-378b7a69.js @@ -0,0 +1,69 @@ +import{dm as e,cQ as t,x as s,dw as a,dx as i,dy as r,dz as o,r as h,eM as d,_ as n,t as l,cN as c,eP as p,cP as u,a as y,cR as m,cU as _,l as f,cV as v,n as g}from"./card-769e2b91.js";import{c as $,e as b}from"./ha-hls-player-2c0fea5b.js";import{m as w}from"./audio-cf3a75aa.js";import{s as R,h as L,c as P}from"./media-d4c0d154.js";import{g as I}from"./index-9b434861.js";customElements.whenDefined("ha-web-rtc-player").then((()=>{let c=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&&R(this._video,e??this.controls)}isPaused(){return this._video?.paused??!0}async getScreenshotURL(){return this._video?e(this._video):null}render(){return this._error?t(this,`${this._error} (${this.entityid})`):s` + + `}static get styles(){return[super.styles,h($),d` + :host { + width: 100%; + height: 100%; + } + video { + width: 100%; + height: 100%; + } + `]}};n([b("#remote-stream")],c.prototype,"_video",void 0),c=n([l("frigate-card-ha-web-rtc-player")],c)})),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` + this._storeMediaLoadedInfo(t,p(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` this._storeMediaLoadedInfoHandler("hls",e)} + @streams=${this._handleHlsStreams} + class=${a.visible?"":"hidden"} + >`:a.type===e?s`this._storeMediaLoadedInfoHandler(e,t)} + @streams=${this._handleWebRtcStreams} + class=${a.visible?"":"hidden"} + >`:c:c;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,u(this,e))}}static get styles(){return[super.styles,h($),d` + :host { + width: 100%; + height: 100%; + } + img { + width: 100%; + height: 100%; + } + `]}};n([b("#player")],a.prototype,"_player",void 0),a=n([l("frigate-card-ha-camera-stream")],a)}));let S=class extends y{constructor(){super(...arguments),this.controls=!0,this._playerRef=m()}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;const e=I(this,this.hass,this.cameraConfig);return e?"unavailable"===e.state?_({message:f("error.live_camera_unavailable"),type:"error",icon:"mdi:connection",context:this.cameraConfig}):s` + `:void 0}static get styles(){return h(":host {\n width: 100%;\n height: 100%;\n display: block;\n}")}};n([g({attribute:!1})],S.prototype,"hass",void 0),n([g({attribute:!1})],S.prototype,"cameraConfig",void 0),n([g({attribute:!0,type:Boolean})],S.prototype,"controls",void 0),S=n([l("frigate-card-live-ha")],S);export{S as FrigateCardLiveHA}; diff --git a/config/www/community/frigate-hass-card/ha-378b7a69.js.gz b/config/www/community/frigate-hass-card/ha-378b7a69.js.gz new file mode 100644 index 00000000..c9402eb7 Binary files /dev/null and b/config/www/community/frigate-hass-card/ha-378b7a69.js.gz differ diff --git a/config/www/community/frigate-hass-card/ha-4f7cd760.js b/config/www/community/frigate-hass-card/ha-4f7cd760.js new file mode 100644 index 00000000..45029929 --- /dev/null +++ b/config/www/community/frigate-hass-card/ha-4f7cd760.js @@ -0,0 +1,68 @@ +import{di as e,cP as t,x as s,cZ as a,dt as i,du as r,dv as o,ds as d,r as h,eJ as l,_ as n,t as c,eM as p,eN as u,cL as y,a as m,cM as _,cQ as f,n as v}from"./card-320adb66.js";import{c as g,e as $}from"./ha-hls-player-b195eaa1.js";import{s as b,d as w,h as L,c as R}from"./dispatch-live-error-c649b480.js";import{m as P}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` + + `}_loadedDataHandler(e){super._loadedData(),d(this,e,{player:this,capabilities:{supportsPause:!0,hasAudio:P(this._video)},technology:["webrtc"]})}static get styles(){return[super.styles,h(g),l` + :host { + width: 100%; + height: 100%; + } + video { + width: 100%; + height: 100%; + } + `]}};n([$("#remote-stream")],p.prototype,"_video",void 0),p=n([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` + 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` this._storeMediaLoadedInfoHandler("hls",e)} + @streams=${this._handleHlsStreams} + class="player ${a.visible?"":"hidden"}" + >`:a.type===e?s`this._storeMediaLoadedInfoHandler(e,t)} + @streams=${this._handleWebRtcStreams} + class="player ${a.visible?"":"hidden"}" + >`: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),l` + :host { + width: 100%; + height: 100%; + } + img { + width: 100%; + height: 100%; + } + `]}};n([$(".player:not(.hidden)")],a.prototype,"_player",void 0),a=n([c("frigate-card-ha-camera-stream")],a)}));let I=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` + `}static get styles(){return h(":host {\n width: 100%;\n height: 100%;\n display: block;\n}")}};n([v({attribute:!1})],I.prototype,"hass",void 0),n([v({attribute:!1})],I.prototype,"cameraConfig",void 0),n([v({attribute:!0,type:Boolean})],I.prototype,"controls",void 0),I=n([c("frigate-card-live-ha")],I);export{I as FrigateCardLiveHA}; diff --git a/config/www/community/frigate-hass-card/ha-4f7cd760.js.gz b/config/www/community/frigate-hass-card/ha-4f7cd760.js.gz new file mode 100644 index 00000000..394a8081 Binary files /dev/null and b/config/www/community/frigate-hass-card/ha-4f7cd760.js.gz differ diff --git a/config/www/community/frigate-hass-card/ha-9af0bc47.js b/config/www/community/frigate-hass-card/ha-9af0bc47.js new file mode 100644 index 00000000..8e58f6c7 --- /dev/null +++ b/config/www/community/frigate-hass-card/ha-9af0bc47.js @@ -0,0 +1,61 @@ +import{dm as e,cQ as t,x as s,dw as a,dx as r,dy as i,dz as o,r as h,eM as l,_ as n,t as u,a as d,cR as c,cU as y,l as p,cV as m,n as _}from"./card-7cd05290.js";import{c as v,e as g}from"./ha-hls-player-717bfdfd.js";import{m as f}from"./audio-cf3a75aa.js";import{s as $,h as b,c as w}from"./media-67c578aa.js";import{g as R}from"./index-3c9b9749.js";customElements.whenDefined("ha-web-rtc-player").then((()=>{let d=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&&$(this._video,e??this.controls)}isPaused(){return this._video?.paused??!0}async getScreenshotURL(){return this._video?e(this._video):null}render(){return this._error?t(this,`${this._error} (${this.entityid})`):s` + + `}static get styles(){return[super.styles,h(v),l` + :host { + width: 100%; + height: 100%; + } + video { + width: 100%; + height: 100%; + } + `]}};n([g("#remote-stream")],d.prototype,"_video",void 0),d=n([u("frigate-card-ha-web-rtc-player")],d)})),customElements.whenDefined("ha-camera-stream").then((()=>{let e=class extends(customElements.get("ha-camera-stream")){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}render(){return this.stateObj?this._shouldRenderMJPEG?s` + {a(this,e,{player:this,technology:["mjpeg"]})}} + .src=${void 0===this._connected||this._connected?(e=this.stateObj,`/api/camera_proxy_stream/${e.entity_id}?token=${e.attributes.access_token}`):""} + /> + `:"hls"===this.stateObj.attributes.frontend_stream_type?this._url?s` `:s``:"web_rtc"===this.stateObj.attributes.frontend_stream_type?s``:void 0:s``;var e}static get styles(){return[super.styles,h(v),l` + :host { + width: 100%; + height: 100%; + } + img { + width: 100%; + height: 100%; + } + `]}};n([g("#player")],e.prototype,"_player",void 0),e=n([u("frigate-card-ha-camera-stream")],e)}));let j=class extends d{constructor(){super(...arguments),this.controls=!0,this._playerRef=c()}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;const e=R(this,this.hass,this.cameraConfig);return e?"unavailable"===e.state?y({message:p("error.live_camera_unavailable"),type:"error",icon:"mdi:connection",context:this.cameraConfig}):s` + `:void 0}static get styles(){return h(":host {\n width: 100%;\n height: 100%;\n display: block;\n}")}};n([_({attribute:!1})],j.prototype,"hass",void 0),n([_({attribute:!1})],j.prototype,"cameraConfig",void 0),n([_({attribute:!0,type:Boolean})],j.prototype,"controls",void 0),j=n([u("frigate-card-live-ha")],j);export{j as FrigateCardLiveHA}; diff --git a/config/www/community/frigate-hass-card/ha-9af0bc47.js.gz b/config/www/community/frigate-hass-card/ha-9af0bc47.js.gz new file mode 100644 index 00000000..79e9d4a7 Binary files /dev/null and b/config/www/community/frigate-hass-card/ha-9af0bc47.js.gz differ diff --git a/config/www/community/frigate-hass-card/ha-a4f2c69e.js b/config/www/community/frigate-hass-card/ha-a4f2c69e.js new file mode 100644 index 00000000..42f8ec35 --- /dev/null +++ b/config/www/community/frigate-hass-card/ha-a4f2c69e.js @@ -0,0 +1,69 @@ +import{dm as e,cQ as t,x as s,dw as a,dx as i,dy as r,dz as o,r as h,eM as d,_ as n,t as l,cN as c,eP as p,cP as u,a as y,cR as m,cU as _,l as f,cV as v,n as g}from"./card-09c4bade.js";import{c as $,e as b}from"./ha-hls-player-ba5834a9.js";import{m as w}from"./audio-cf3a75aa.js";import{s as R,h as L,c as P}from"./media-aef44451.js";import{g as I}from"./index-e610f971.js";customElements.whenDefined("ha-web-rtc-player").then((()=>{let c=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&&R(this._video,e??this.controls)}isPaused(){return this._video?.paused??!0}async getScreenshotURL(){return this._video?e(this._video):null}render(){return this._error?t(this,`${this._error} (${this.entityid})`):s` + + `}static get styles(){return[super.styles,h($),d` + :host { + width: 100%; + height: 100%; + } + video { + width: 100%; + height: 100%; + } + `]}};n([b("#remote-stream")],c.prototype,"_video",void 0),c=n([l("frigate-card-ha-web-rtc-player")],c)})),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` + this._storeMediaLoadedInfo(t,p(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` this._storeMediaLoadedInfoHandler("hls",e)} + @streams=${this._handleHlsStreams} + class=${a.visible?"":"hidden"} + >`:a.type===e?s`this._storeMediaLoadedInfoHandler(e,t)} + @streams=${this._handleWebRtcStreams} + class=${a.visible?"":"hidden"} + >`:c:c;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,u(this,e))}}static get styles(){return[super.styles,h($),d` + :host { + width: 100%; + height: 100%; + } + img { + width: 100%; + height: 100%; + } + `]}};n([b("#player")],a.prototype,"_player",void 0),a=n([l("frigate-card-ha-camera-stream")],a)}));let S=class extends y{constructor(){super(...arguments),this.controls=!0,this._playerRef=m()}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;const e=I(this,this.hass,this.cameraConfig);return e?"unavailable"===e.state?_({message:f("error.live_camera_unavailable"),type:"error",icon:"mdi:connection",context:this.cameraConfig}):s` + `:void 0}static get styles(){return h(":host {\n width: 100%;\n height: 100%;\n display: block;\n}")}};n([g({attribute:!1})],S.prototype,"hass",void 0),n([g({attribute:!1})],S.prototype,"cameraConfig",void 0),n([g({attribute:!0,type:Boolean})],S.prototype,"controls",void 0),S=n([l("frigate-card-live-ha")],S);export{S as FrigateCardLiveHA}; diff --git a/config/www/community/frigate-hass-card/ha-a4f2c69e.js.gz b/config/www/community/frigate-hass-card/ha-a4f2c69e.js.gz new file mode 100644 index 00000000..c6f78956 Binary files /dev/null and b/config/www/community/frigate-hass-card/ha-a4f2c69e.js.gz differ diff --git a/config/www/community/frigate-hass-card/ha-hls-player-2c0fea5b.js b/config/www/community/frigate-hass-card/ha-hls-player-2c0fea5b.js new file mode 100644 index 00000000..504f7779 --- /dev/null +++ b/config/www/community/frigate-hass-card/ha-hls-player-2c0fea5b.js @@ -0,0 +1,34 @@ +import{dm as e,cQ as t,db as i,x as s,dx as a,dy as o,dz as r,dw as d,r as n,eM as h,_ as l,t as u}from"./card-769e2b91.js";import{m as c}from"./audio-cf3a75aa.js";import{h as v,s as p,c as y}from"./media-d4c0d154.js"; +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const m=(e,t,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,i),i) +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */;function _(e,t){return(i,s,a)=>{const o=t=>t.renderRoot?.querySelector(e)??null;if(t){const{get:e,set:t}="object"==typeof s?i:a??(()=>{const e=Symbol();return{get(){return this[e]},set(t){this[e]=t}}})();return m(i,s,{get(){let i=e.call(this);return void 0===i&&(i=o(this),(null!==i||this.hasUpdated)&&t.call(this,i)),i}})}return m(i,s,{get(){return o(this)}})}}var f="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 m=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(e){this._video&&(v(this._video),this._video.currentTime=e)}async setControls(e){this._video&&p(this._video,e??this.controls)}isPaused(){return this._video?.paused??!0}async getScreenshotURL(){return this._video?e(this._video):null}render(){if(this._error){if(this._errorIsFatal)return t(this,this._error);i(this._error,console.error)}return s` + + `}_loadedDataHandler(e){super._loadedData(),d(this,e,{player:this,capabilities:{supportsPause:!0,hasAudio:c(this._video)},technology:["hls"]})}static get styles(){return[super.styles,n(f),h` + :host { + width: 100%; + height: 100%; + } + video { + width: 100%; + height: 100%; + } + `]}};l([_("#video")],m.prototype,"_video",void 0),m=l([u("frigate-card-ha-hls-player")],m)}));export{f as c,_ as e}; diff --git a/config/www/community/frigate-hass-card/ha-hls-player-2c0fea5b.js.gz b/config/www/community/frigate-hass-card/ha-hls-player-2c0fea5b.js.gz new file mode 100644 index 00000000..506e461b Binary files /dev/null and b/config/www/community/frigate-hass-card/ha-hls-player-2c0fea5b.js.gz differ diff --git a/config/www/community/frigate-hass-card/ha-hls-player-717bfdfd.js b/config/www/community/frigate-hass-card/ha-hls-player-717bfdfd.js new file mode 100644 index 00000000..67838cba --- /dev/null +++ b/config/www/community/frigate-hass-card/ha-hls-player-717bfdfd.js @@ -0,0 +1,34 @@ +import{dm as e,cQ as t,db as i,x as s,dx as a,dy as o,dz as r,dw as d,r as n,eM as h,_ as l,t as u}from"./card-7cd05290.js";import{m as c}from"./audio-cf3a75aa.js";import{h as v,s as p,c as y}from"./media-67c578aa.js"; +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const m=(e,t,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,i),i) +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */;function _(e,t){return(i,s,a)=>{const o=t=>t.renderRoot?.querySelector(e)??null;if(t){const{get:e,set:t}="object"==typeof s?i:a??(()=>{const e=Symbol();return{get(){return this[e]},set(t){this[e]=t}}})();return m(i,s,{get(){let i=e.call(this);return void 0===i&&(i=o(this),(null!==i||this.hasUpdated)&&t.call(this,i)),i}})}return m(i,s,{get(){return o(this)}})}}var f="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 m=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(e){this._video&&(v(this._video),this._video.currentTime=e)}async setControls(e){this._video&&p(this._video,e??this.controls)}isPaused(){return this._video?.paused??!0}async getScreenshotURL(){return this._video?e(this._video):null}render(){if(this._error){if(this._errorIsFatal)return t(this,this._error);i(this._error,console.error)}return s` + + `}_loadedDataHandler(e){super._loadedData(),d(this,e,{player:this,capabilities:{supportsPause:!0,hasAudio:c(this._video)},technology:["hls"]})}static get styles(){return[super.styles,n(f),h` + :host { + width: 100%; + height: 100%; + } + video { + width: 100%; + height: 100%; + } + `]}};l([_("#video")],m.prototype,"_video",void 0),m=l([u("frigate-card-ha-hls-player")],m)}));export{f as c,_ as e}; diff --git a/config/www/community/frigate-hass-card/ha-hls-player-717bfdfd.js.gz b/config/www/community/frigate-hass-card/ha-hls-player-717bfdfd.js.gz new file mode 100644 index 00000000..255a9969 Binary files /dev/null and b/config/www/community/frigate-hass-card/ha-hls-player-717bfdfd.js.gz differ diff --git a/config/www/community/frigate-hass-card/ha-hls-player-abb86874.js b/config/www/community/frigate-hass-card/ha-hls-player-abb86874.js new file mode 100644 index 00000000..e6a90422 --- /dev/null +++ b/config/www/community/frigate-hass-card/ha-hls-player-abb86874.js @@ -0,0 +1,34 @@ +import{dm as e,cQ as t,db as i,x as s,dx as a,dy as o,dz as r,dw as d,r as n,eM as h,_ as l,t as u}from"./card-c642ee74.js";import{m as c}from"./audio-cf3a75aa.js";import{h as v,s as p,c as y}from"./media-6eadcd60.js"; +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const m=(e,t,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,i),i) +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */;function _(e,t){return(i,s,a)=>{const o=t=>t.renderRoot?.querySelector(e)??null;if(t){const{get:e,set:t}="object"==typeof s?i:a??(()=>{const e=Symbol();return{get(){return this[e]},set(t){this[e]=t}}})();return m(i,s,{get(){let i=e.call(this);return void 0===i&&(i=o(this),(null!==i||this.hasUpdated)&&t.call(this,i)),i}})}return m(i,s,{get(){return o(this)}})}}var f="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 m=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(e){this._video&&(v(this._video),this._video.currentTime=e)}async setControls(e){this._video&&p(this._video,e??this.controls)}isPaused(){return this._video?.paused??!0}async getScreenshotURL(){return this._video?e(this._video):null}render(){if(this._error){if(this._errorIsFatal)return t(this,this._error);i(this._error,console.error)}return s` + + `}_loadedDataHandler(e){super._loadedData(),d(this,e,{player:this,capabilities:{supportsPause:!0,hasAudio:c(this._video)},technology:["hls"]})}static get styles(){return[super.styles,n(f),h` + :host { + width: 100%; + height: 100%; + } + video { + width: 100%; + height: 100%; + } + `]}};l([_("#video")],m.prototype,"_video",void 0),m=l([u("frigate-card-ha-hls-player")],m)}));export{f as c,_ as e}; diff --git a/config/www/community/frigate-hass-card/ha-hls-player-abb86874.js.gz b/config/www/community/frigate-hass-card/ha-hls-player-abb86874.js.gz new file mode 100644 index 00000000..edf7b48c Binary files /dev/null and b/config/www/community/frigate-hass-card/ha-hls-player-abb86874.js.gz differ diff --git a/config/www/community/frigate-hass-card/ha-hls-player-ad38a2a0.js b/config/www/community/frigate-hass-card/ha-hls-player-ad38a2a0.js new file mode 100644 index 00000000..00ea2c6b --- /dev/null +++ b/config/www/community/frigate-hass-card/ha-hls-player-ad38a2a0.js @@ -0,0 +1,34 @@ +import{dm as e,cQ as t,db as i,x as s,dx as a,dy as o,dz as r,dw as d,r as n,eM as h,_ as l,t as u}from"./card-45855f1f.js";import{m as c}from"./audio-cf3a75aa.js";import{h as v,s as p,c as y}from"./media-1a34ac2c.js"; +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const m=(e,t,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,i),i) +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */;function _(e,t){return(i,s,a)=>{const o=t=>t.renderRoot?.querySelector(e)??null;if(t){const{get:e,set:t}="object"==typeof s?i:a??(()=>{const e=Symbol();return{get(){return this[e]},set(t){this[e]=t}}})();return m(i,s,{get(){let i=e.call(this);return void 0===i&&(i=o(this),(null!==i||this.hasUpdated)&&t.call(this,i)),i}})}return m(i,s,{get(){return o(this)}})}}var f="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 m=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(e){this._video&&(v(this._video),this._video.currentTime=e)}async setControls(e){this._video&&p(this._video,e??this.controls)}isPaused(){return this._video?.paused??!0}async getScreenshotURL(){return this._video?e(this._video):null}render(){if(this._error){if(this._errorIsFatal)return t(this,this._error);i(this._error,console.error)}return s` + + `}_loadedDataHandler(e){super._loadedData(),d(this,e,{player:this,capabilities:{supportsPause:!0,hasAudio:c(this._video)},technology:["hls"]})}static get styles(){return[super.styles,n(f),h` + :host { + width: 100%; + height: 100%; + } + video { + width: 100%; + height: 100%; + } + `]}};l([_("#video")],m.prototype,"_video",void 0),m=l([u("frigate-card-ha-hls-player")],m)}));export{f as c,_ as e}; diff --git a/config/www/community/frigate-hass-card/ha-hls-player-ad38a2a0.js.gz b/config/www/community/frigate-hass-card/ha-hls-player-ad38a2a0.js.gz new file mode 100644 index 00000000..82362e37 Binary files /dev/null and b/config/www/community/frigate-hass-card/ha-hls-player-ad38a2a0.js.gz differ diff --git a/config/www/community/frigate-hass-card/ha-hls-player-b195eaa1.js b/config/www/community/frigate-hass-card/ha-hls-player-b195eaa1.js new file mode 100644 index 00000000..9cc99dbd --- /dev/null +++ b/config/www/community/frigate-hass-card/ha-hls-player-b195eaa1.js @@ -0,0 +1,34 @@ +import{di as t,cP as e,d7 as i,x as s,dt as a,du as o,dv as r,ds as d,r as n,eJ as h,_ as l,t as u}from"./card-320adb66.js";import{h as c,s as v,d as p,c as y}from"./dispatch-live-error-c649b480.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 p(this),e({type:"error",message:this._error,context:{entity_id:this.entityid}});i(this._error,console.error)}return s` + + `}_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}; diff --git a/config/www/community/frigate-hass-card/ha-hls-player-b195eaa1.js.gz b/config/www/community/frigate-hass-card/ha-hls-player-b195eaa1.js.gz new file mode 100644 index 00000000..3eba34aa Binary files /dev/null and b/config/www/community/frigate-hass-card/ha-hls-player-b195eaa1.js.gz differ diff --git a/config/www/community/frigate-hass-card/ha-hls-player-ba5834a9.js b/config/www/community/frigate-hass-card/ha-hls-player-ba5834a9.js new file mode 100644 index 00000000..e82b5e7f --- /dev/null +++ b/config/www/community/frigate-hass-card/ha-hls-player-ba5834a9.js @@ -0,0 +1,34 @@ +import{dm as e,cQ as t,db as i,x as s,dx as a,dy as o,dz as r,dw as d,r as n,eM as h,_ as l,t as u}from"./card-09c4bade.js";import{m as c}from"./audio-cf3a75aa.js";import{h as v,s as p,c as y}from"./media-aef44451.js"; +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const m=(e,t,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,i),i) +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */;function _(e,t){return(i,s,a)=>{const o=t=>t.renderRoot?.querySelector(e)??null;if(t){const{get:e,set:t}="object"==typeof s?i:a??(()=>{const e=Symbol();return{get(){return this[e]},set(t){this[e]=t}}})();return m(i,s,{get(){let i=e.call(this);return void 0===i&&(i=o(this),(null!==i||this.hasUpdated)&&t.call(this,i)),i}})}return m(i,s,{get(){return o(this)}})}}var f="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 m=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(e){this._video&&(v(this._video),this._video.currentTime=e)}async setControls(e){this._video&&p(this._video,e??this.controls)}isPaused(){return this._video?.paused??!0}async getScreenshotURL(){return this._video?e(this._video):null}render(){if(this._error){if(this._errorIsFatal)return t(this,this._error);i(this._error,console.error)}return s` + + `}_loadedDataHandler(e){super._loadedData(),d(this,e,{player:this,capabilities:{supportsPause:!0,hasAudio:c(this._video)},technology:["hls"]})}static get styles(){return[super.styles,n(f),h` + :host { + width: 100%; + height: 100%; + } + video { + width: 100%; + height: 100%; + } + `]}};l([_("#video")],m.prototype,"_video",void 0),m=l([u("frigate-card-ha-hls-player")],m)}));export{f as c,_ as e}; diff --git a/config/www/community/frigate-hass-card/ha-hls-player-ba5834a9.js.gz b/config/www/community/frigate-hass-card/ha-hls-player-ba5834a9.js.gz new file mode 100644 index 00000000..735e1c35 Binary files /dev/null and b/config/www/community/frigate-hass-card/ha-hls-player-ba5834a9.js.gz differ diff --git a/config/www/community/frigate-hass-card/image-1c1ebdfa.js b/config/www/community/frigate-hass-card/image-1c1ebdfa.js new file mode 100644 index 00000000..a9d7d40c --- /dev/null +++ b/config/www/community/frigate-hass-card/image-1c1ebdfa.js @@ -0,0 +1,13 @@ +import{cL as A,cM as e,eR as t,eS as i,dC as a,cN as r,cO as g,dD as o,_ as c,n as s,cW as h,t as C,a as l,cR as I,eT as n,dy as E,dz as u,x as m,cV as w,eP as Q,i as M,cP as B,cQ as d,l as b,r as L}from"./card-09c4bade.js"; +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const D=A(class extends e{constructor(A){if(super(A),A.type!==t.PROPERTY&&A.type!==t.ATTRIBUTE&&A.type!==t.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!i(A))throw Error("`live` bindings can only contain a single expression")}render(A){return A}update(A,[e]){if(e===a||e===r)return e;const i=A.element,o=A.name;if(A.type===t.PROPERTY){if(e===i[o])return a}else if(A.type===t.BOOLEAN_ATTRIBUTE){if(!!e===i.hasAttribute(o))return a}else if(A.type===t.ATTRIBUTE&&i.getAttribute(o)===e+"")return a;return g(A),e}});class p{constructor(A,e,t,i,a){this._timer=new o,this._timerSeconds=e,this._callback=t,this._timerStartCallback=i,this._timerStopCallback=a,(this._host=A).addController(this)}removeController(){this.stopTimer(),this._host.removeController(this)}get value(){return this._value}updateValue(){this._value=this._callback()}clearValue(){this._value=void 0}stopTimer(){this._timer.isRunning()&&(this._timer.stop(),this._timerStopCallback?.())}startTimer(){this.stopTimer(),this._timerStartCallback?.(),this._timer.startRepeated(this._timerSeconds,(()=>{this.updateValue(),this._host.requestUpdate()}))}hasTimer(){return this._timer.isRunning()}hostConnected(){this.updateValue(),this.startTimer(),this._host.requestUpdate()}hostDisconnected(){this.clearValue(),this.stopTimer()}}var k="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAUDBAQEAwUEBAQFBQUGBwwIBwcHBw8LCwkMEQ8SEhEPERETFhwXExQaFRERGCEYGh0dHx8fExciJCIeJBweHx7/2wBDAQUFBQcGBw4ICA4eFBEUHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh7/wgARCAEVAewDAREAAhEBAxEB/8QAGwAAAwEAAwEAAAAAAAAAAAAAAAECAwQFBgf/xAAaAQEBAQEBAQEAAAAAAAAAAAAAAQIDBAUG/9oADAMBAAIQAxAAAAHu/wBF+fKuKWoua2zblcOpTDeJqLJsVgAACCiNQEKJRCmEoMAhy1FzThq4VrCHDWbHCoilBWQKqzaa2xeTz3Uumd+Z+h4Sxy0VGmdbzV5AybMdZjUz1kEFA4AAEAAdEFAAEVKBDVxc1UtSgiaY1cSI4nPfl/N6eZrHp/Rw11mLJq83XO9c2ovO+Ry6ea+j4FY1uKl1zrSAAIucd5mlYUoBggA1ACiRiVgiCiW81w6JQqWpazQVTQCo6fz9vH+L2ec83o937PJ7P6HgsBAaZ1vjemdJNcb5HLr536PgACrioqFU2RZFkWLcAgAAokdoEhRKwgoHCCgrKpWrlQ1ctQpVU0jovN38P4fZ1HDta+y9HD3f1Pm2jEBrm78+muNXNVnW2N6Z15z6fz7zWSlDEkVnrMWKyaVgOCkA6AkBipwKBDhgIa1AC3KoaiuJtmPP+b0eM8Ps6Pl01lprsenL6V9T5vadMUJEa41y+XXXGqmrzrTOrzamvNfU+brnThgRrOdk2Z6yqSKxBTAQAgojBBRQAHDhhDViRLc1cpKhV5rzd/nnz/dw+PbkIqheXrH036nz+578LipVY42xvl8u14uk1pjeuNXNB5f6vzNc6uERc56znokjUEBBYAFACGAIAAAAKDyoqaEJRWVNOOn5dfnXz/b5rz9he1zutRGtfSvo/O731+aoYwjTOuRz6b893nW2N6Z3ebpnTXyf1/laZ0xM5azGpFioQAVgCiAAKmgAAoCAhgpDHLctZoNUvh/H6vnfzvfjHJl56taNNT6L9L5voPT59s1UAVLti8nl2rN1zrbn00zq860zoPJ/Y+SDM7nPUmxWIBiQoAKABAAAAAFEQ1BIBFTV5uktTXnOXX4/8n6euNbnYzWVjXkdMfR/qfL7X0cNM63xqpagKl5PLrrjdy643rjeuN641cpL4n73xUFmdzNCAACFAAFAAgAAogACCiQCiUlqWoqa0zfkXzvo+Z8fq7XnvmVx9Zmu27cvon1Pmcrvwcu+N6S689a51pnWmdb8+m/PppjeuNbZ3ea5QZ4H9D8JWISKhAKIApgAAgAK0SCiiACCwCEooOWocvTcuvx74v1+RjfZmk1jrPp/Z4/cfU+a9QHHIxupeRz3tjXJ5dXLvz6crl11570zqpXRDVnz39F8BwqlDUSCgwABgMIVORqkLEoAAJAFQAqsakOX5T8j6nQ+P19xNTc8nHXk9uP1L7fxI3hUK5d8a2xrk8+muNcnj25HPptjfI59NM6AHDVqHz79D+fCbFokAoHAAwAcEFEMWghKgALEgoAhaCiPLznm9Py3431+djXay8TU7vty919L5/YejzTYhDl3xrl8+nJ5dd+XTkc+nJ5ddcavOnKqCotoA+efovz9RGorEFMIYQUDQlYBAAtQAIKIVgoqRiqbAcuWNfH/AIv2ev4du3zrSqj6R9L5/fezxRYqRUC65vL5dOTx7crl15PLrtjd5tTRBTilagHzr9H+eZNgAwpwAADgGAQUAKwUQAQArjLG+s83p7P3+BhnXy/5H1vN+T1b5vPa1s9r34+++h87PWc9RwE2TV5cjn05vDvz/P6N+e9MbuWlBqAAQHzn9N+ecKwgGFjlBhBRDAIACkMSClEi0UOXTNpfN+L3ec+D+k7z6Xx+r8/o8FvlWddkbHP6Y+vfT+VyZqUmzTOtcbZnrNTXK49eVy67c9643rnVNAAAAAR84/TfnmgADgGADgAKcFEIBolKAEiRWhWbyMbivi3wf0EcuvKmuH38mWNdrbon036fy+768dsbcumd6Y1rjfL5dalBy0ry1zvXG6UAAAAA+cfpPzrAdAAMIcEFAACFoAISlCJSxQrUjl1zry3l9Pyz5P1MY1O72wxruK9F6vL7j6PzNc6359N8dORy6a43rje+NuAnRDjTGts7uaAAAAAPnH6T886IaFAQwGOEAAFAgAAAAAQ5Vm+D8Pt8J873xLKJeyrntdpL9I+n8vse/m1zvTOtM65vn9G/PpvjdQE1lrKRrUuuNbY3pNgAAAB85/S/niAdhBRDGAQUIKIgBSkEACpwEYvmPH7fCeH2dVx2mmVLFNnvLruq+o/R+ZyOvCprTO2c3z+jmce2uNMipsz1nPeHNa41rne3PWudtQAAAPnH6T86DAB0Q6IcFFJCBSwhKCBBQ43PfQ+fv5zyerzfl9XGzYRy6LCCiKucdxqfZPs/Fcu+OnJ5dUmmd87z+jkc9hOk2QznuXm6Z1pnWuN6501AEJGofOf0v51wAADGAQWCiClAgEEB13Lr82+T9TpOHaEUOXlzVmlaDlzlmzg3N12J9p+x8blaztjfJ5dtcbqORz68nl1cKgmxI2rmqy1xrSbYEiZais+c/pfzzQgAdOAAAAAKQQgpRwuXX5N8X6/X8+hHLObNaLnZRUFVL3HLp6P0eXzPSddJ0fPp9G4693+g+Lvm8nl15fHtU1rjV5rWpqoBDVxebpndytUJEjVqz5x+k/PMEFKcjAIKEFAAQhBWeNfJ/ifY6Xh25kvPWrMiluXVexzPQ/Q8HoPf4OT24llZvH8vp+X/ABPt9fqfSvT5fX/R8PL49eXx7OUVoS1LUuudENai860ztqwAEFAPnf6P88QtFRIU4YQUAOFaCRUiZfmHxvreb8vp5Evay1YWcatJe+9Pn9f7/ndp6fPGiSpRKl359PM/N9/kvN6uQfSvX5O81ORy63mxqTrNZ1rnTl0zqoqW86qaqVq4KAAAPnX6P8+IrFTHKIwhUwHCpWkIVnhPmfQ8N876HNl3rQYrnkdM/QfpfM7f1+VWCkXLedXCNcbvN+a/K+p6j0+fpPL6vqnq82+NXnUazNjNcbvOrlcC1LedXm0rUCAAoPm/6X88SA6ZWaBQhDBUipFZpb53y+r538f6txnWpVmusfTfqfL7D0cTWVQhDmtZrTN0zrTLfn00zrjY38u8fs+gduPF59PadMXmgE2VLctTSRq5by1zu86pQMgKAPm36b86wh2seQjUokqUEToi83qePb5b8b6153QrGdv25fRvq/K5PTDSLA0zqpXDW5dcXk8+nI5ddM6cvTZ347n07BPb9McrNqVjlcquW05QqXXFvOtJpqBAEAHzf9P+dACCql0zXEWMagkjSs3jc+nyf4/1sOfTSWyLO87+f6N9X5fJ1EBNjipdJalqWjbnvlce2/PprndZoeXzvgmlnsrnTN0zsVWRc3NXmuXTOtM6pQAAAAI+bfpfzgNUMoZWarCWgWbIoxr5b8f6/V8O2hcvYaz636Hz/Sezyck0zpWJLlZFgJbl0zeTy6czj25HLrU040zpnQY6d9rFDilCUVaY1rnVzTUAAAAAAPmv6T86wBGrCiAocriNJTwHyfq+U8Xr2NK9j6fN7j6Pz63ijk8+jgBBdsaqWUw6Yqa2xrXG+Xx7b8+ly1nVy6Z1WaCqNZVjzWVLpndKAAAAAAAB81/SfnC1hIDtBhDHKQjy/k9fgPk/V7beO69HD1Hp8/e+jz6ZrSbNM60zdM6i5z3nbn05fHtpnXH6c1W2N6Y1tjemdXnWmbedaZ2xIiNZjWQrOtc6poAAAAAAAAPmf6X845XRIwV2uAqLzoTi8uvnvH7O16c+768uRrNDluHGeo0vOtsbjWYueRz68nl10zus1rebct51UrlqNM7uVqIEmW+cay5rTGrmqUAAAAAAAD5l+l/OMYQwKtcripdc6uJ8nr7a5DXG9M6x3zy3loLFyJlvJLUa53yeXXbHTfnu86ZedVm6TQCOW5qpWoAJnc5ayy5qs22gAAAAAAAPmX6b825QcOiKtakmmdVLpm9t5PTyOfSprfnu86z1ni9uMazGs5bzFzjvIuubyuPXkcuu+OmmNXLeNbY1U01STqVLebTQAAJJQGtAoEFAAAAAAf/EACkQAAEEAgIBBAIDAQEBAAAAAAEAAgMEBREQIBITIUBQFCIGMDFBFSP/2gAIAQEAAQUC6hDofrwE1D+gIdDwfpNqxZggbNnAXQQ5Kwom+DOQgEBwEFrjXGkOpKJ+kuZKrWVvMWJUXeTsDVsMQ6gIDjSa1ALS8VpaWlrqfo7uUrVlcytqwhG8rwaFim0GzjqAgFpaQCA50tLS19Pcy9SBXMpYsrW0PZHax1J1ySjViqxjo0JoQHAC0tcBD6MdcjloKqu5GzaMMZI1pa4q1ZrMmMpMpxBDoxDkIchDk/R38hXptv5izYTimAl2zx4uKirSyyYim6pBpa6BNHAQCCHIQ5P0GuM1mPTT3lxUUJcgGtQCLXKNs7zhq81eu3s0IcBDgdifov5Db/GpOO1FE6VRQ/s4+y0CoK80rsZXdWqhBDjS0g1NatIBBqAQCAWlrja388chfyC3+TeVD/5Sy68/bijSltGnB+NXQQ4bwAgE0IBBqAQC19PtZu3+LRJ2q0fm4f7M0sQCxWMc6VrWsbwE3hqCAWkwIBAIfVZy3+TbYNuDWta9VnhyoVX2LX/OjUE1BNQag1AfV565+PVcdqkP3sBoR9xg6vqZCrTirSdAmhAJoTQmhBD6ueVkMN+y6zZHuWjxa8pgWDpehWIWuNLS0moJqaEAh119FJ5+Fa4JJOJHMijy+RdbkKrj9h/p91hcc90WkQtLS8V48NCaFGE0ID6cLSzNYPhNyz6dHMQyr+T+qXJo2QxrQG6VCo+1aiaGMCKAQCDV6a9JNjTWINQQ+nBQKc0OEkz6tya5t8V10jJmaMTSSxvtolYmr+LWCHDWrxTAgF4rxWuQh9O1ZvKNga874YdKPUsNc6k0Y34Wn52EE1BNCAQCHYIfTPLWMymb2nHyK1xVk0+WLb2bLMZCIqAagEE1NTUOu1tAoFD6OSRkTbmcgjV29YtO6FN9jE/yZjx52arDFXQWk1MTUOh5CCCHz5bEESsZupGrGctPUs75XE8BBjii0hNBJWlDoNx0xFkoIJqITE0odCtIBBBBD5t+3FUiu5OxYJcSt8AEoV3kCshGGoex9t+jomPyJBaWHRpvNexDI2aJqCaeAE1DrrkIfNu2Y6sF61Jan4ZXcQxjGD9db415BjduLC12Mr2JF/48L68uJsvnyGKsVZfJYa/tjSgmhNHA433CHzJZGRR5O263YUcBeoowxErSA9gAS6N8clenudmHb6sUEER2toFWofWiyNdvlVc6E4e2HhqYh12h1HzCQ1uYyBtSbUTNljkTobBBPu1U8XPMq9CrAieoQWaq+TcYIzas1pcbYxdgWa7Qh0HA/v38L+Q3/f3Ka1qPuWeyemD9Y60srocZTiPTSAXivFNavFZqia0uMljymOpSSYvJNIIHQcDqPl5e+K0etqb3LRzHDPIG1YparWhjOw4DUGoNVqsyxAPWxOTuwR36n8es7a3+sIIfIyVxlOB73zSjpjqL7hqwsrwddLS0gEAmBAIBaWVoMu18FZfTtZmF9O1XlbNDzrkchDgf3BHuFbnjrQXLEluf/gQTP2diKTprUUbI2865HRqaEBzpZrGC2zFWhbhwfq1rKCA6BaWkAtfB33c5rGZW665OOB/lWnNPHg6H47WMa0NatLS0vFeK1yEE1NQ5AWlexcdicMG9LXTSAWlr5Wcv+q5vuf8AuiXQYSQsjYGN0mhALS0tcNC8EYkWJrUGprUwIcaQWlpa7AIfLzdwwsmjeySWg+vRw2JLlSxsFZ4WlrgIcHhiHDmoNQagEAgEOB1PIQ+XcmbWrYyjM5UMXHA51dj3+C8V4rXGuBweGBDjS8UAtIDkIdSjyEPjjhn+zUhYm9NeCaxemnM77W0AmoIdNf1noPjjiP8A2M+yCHDgiODw7lqagghwAgOw+R//xAAsEQABBAEEAQQCAQQDAAAAAAABAAIDERAEEiAhMRMwQFAiQQUUQlFhIzIz/9oACAEDAQE/AfaPwB7Y+KPZHC0flj3GsLvCbpT/AHFF8bP+oRO43yGBms19WyB7kzSsHlCgtTM0jbypDLQgMUq+rZp3O89JkLWeFRVKXdR7rkEFSpUgM19VHpnO89JkLWeM0VI8Mbaklc/zxAQCrACr3L+gjgc/tRxtZ4QGaT3BnZU05k6/XIIZCH0tYGWROf4UcLWYGaTjtFlaicSdDm0YCpDA+mrEEO7s5rAVFF+3yVqJmyHpDgMAIYCGAPqImb3VgC0ETik+RrPJWolEh6QwOACa1UgEAgEAqVKs39EFpWU2/wDOGdFHMkzY/Kmm9U3zAQCAVIBAKlXC/pImb3bUEO1aIpV/lTztaKae0ST55BAIBUmhAIBV9VpY9rbP7yVGQfxKmf6Te047jfMBAJqpBqA+r00W92Go4lJjbam1DpBR5BAIBAIBDA+qaCTQUUQjbWbVLUybvx5hBNTQgPqGP2m1JpdzfUi7GAgLWn0+zs+cDMuo2t2DzwpUqxSATQgEFX09L+P1f9PJ+XgrV6COvUYEP42GZ/4Gv9KT+Pbpm7m8XvDBaJs2UEcAINXpr00I01iDcD6cZ0WtliYKUkrd++Ppf1Bcwschwnl3u4Bq2poQC2raqyEPpwoIPU7Pji3Gpk2NrAQQQCAQHMIfTBqi0v7egONILU9yFUqQQQQ52rVoH6NoLugo9I7+5MibH45hF+3tTyB77GaQTUPaH0DY3u8BN0bz56TNHGPPaaA3ocKVcSL6wEEFSaU08qwMD50URkNBRQNj8cdq2qs0qzSlidG6iggmnACbxpVwHzYozIaCYwMFDO3F8aUUrIzUnhanWxRvqMWjqYnC7UUgkvb+sSxCdlftVRo4AQCpDF+wPmMaXGgoYhGKxWL4EV5RLWi7Tte2ugn6iR/kqycBQSmJ+4I04bgmmlrIb/5AgE1DN5HEfMAtaeD0x/vgeEuqYwf5T9XI798KVYC0k1fgVKCOx5UMweFLF6bqQCHAfR6WGvyPEoJzwAn6p540qVKkAgoJN4o+VKwxutq/9WIIYpUhgcLQPy9LBvNnwq4lwCM7g40UST2eIQzSDVtTbabCNSNUTzE5TMo7ghwrA4hBD5EMRkKaABQ4yTNj8qSQvNn2qTRgBUmHaVIyxuCjdY2leOFKsDgAq+OExheaCYwMFDjPN6YTnuebPCuYQQGaTHbU9ldhOF94CrgMUgFXwb5tF9BQxemOBeB0VqZ+6aiS42UAqzSrgFSamhAZAVJppUq5AKlXytLBtG48HaloBTnF3lUqzWQFsXpotQC2oNQGKzSpVypAfL0sO47iimyBxoKXUbemqXUl/XIYOGoYIQag1AKlWQhwrgPlxx7zSfIB+A8KScu6b4Qc4CgqVKlXAK8tCGKVKlSriOJ+WMBR/iOltW1Bi2Itr2QE3AwM17RVKvkjDUzAQwQqwcHg1BDgAq9yvg//xAAsEQABBAEDBAICAgEFAAAAAAABAAIDERAEEiATITFQMEAiQTJhIxQVM0JR/9oACAECAQE/Afmr1h9q6RrPKdq/00JrJH/yKa0NFDiVeDwv4q9G/UMYn6qR3hdytLp3A7ieRKOS5Xi1fq5NSxvhSTverxCRY7WeRKJV4tHjfEZH3z2Umqa3wpJ3yec2omdR21RxNjHbiSiVeCVav1cuoaxSTOf5V8GMc801QacR9/3yKPrpJms8qTUOfxtNaXGgtNp+l+R88iUTgq/hHotRPt/EInjaazd4C00Do7JR5HJRzav00r9jC5WiawMWmRuf4WnhMY78bVolFytErcrVq1avNeiK1Ulu2/8AmHiwhmKB0nhQQiIVxOLVolWiVav4qVfelk6bd2CqQN40+nc424dkAB45FFEq04olWr9Vq5N7qH6yE8V+QUTOqaCY3aK5FFEpy3IuRPq9TL02/wB4Kbf7xC0SOpRQNjNjkUSiUSiUfkHoHODRZU0vUdeAqxpo9o3IHkUU5Eon46+5akZvb2UWrp3Tl7HJdS1M/U7Dxxi0+5284BVq1avBKJTiiUT6i1rtJ12WPIUGrk/gSv8AcJYmfl3TNc7UdjxYwyGggK7YCtWi5b11EZEXon1NZ1WnYZCms/Ha/uhEA4EJ2AqUMWxvAuVpxVrcr4H1BU8/T8eUTwKC08e43koolEon1xKm1f6Yib4DOmoMV5KKPCsUqVIhH6dfQc4N8qTWNH8VJM5/lXzDd3ZQsLGUVWSnchwKPoHSsb5KdrWDwn6158IuLvPxAoDBRQKciOVq8n70szYhZUuofJxtXmlavIKhlbK2wjgjFoo+mlkEbbKkkMhs5vFcbUkTpB+HlaXSyyMuTsv9PI00pWdKt37xDIdLLf8A1KsEWMOKJ+M/dc4NFlTSmR14vkDY7IbnnaGlN0Dv2UzTMZ4C2qlS1MDZmFpTCR+LvITm7gtDMW/4nIpyOaxXoiaWon6h/rgAqzFpXv8A6TNJG39IDhaONZp7/wAjfIUTgVNCWd1DN1GIlHgVfotZPf4DiMNYXJmkYONq1atEolTRdN1jwo3CRu0r/hfg4CtHnX2gtVqNg2jzya0lDTtLRaDQOwzfA4tbluTqcKKFxuUrBKxQusbSj6WaURNRcXGzxiidL4UcYY2hzvJKcVatWnjcFG7aaKe2nbgvPC/QPeGCypJDI6zx08XUd3TWBgocL5lEonNp4tMffYpprt8Fq1f0aVc3Gu5U8vUPANJFhaaDtbk1oaKCvF4tblfAopyvNq0RatWrzatEq/sjGr1G47RwZpX2E1oaKCtE4tWrwSt6EiDkXLci5OObVq1avA4X9zVT7BtHnDoy0WVDpy/u5Q6YR9z3Ob4jDkcAouRcrV/CD9+SQMbaZETbz5UUAb3d3KLWk2VuW5WrxfAYccWrW5WrV/EPulSfke63rei9b0Hc6wSjg5tX8YVq/tuT8FHDSgcDAyUUUckq8j7f/8QANxAAAQMBBQYEAwcFAQAAAAAAAQACAxEQEiExUQQTIjJBUCAjUmFxgaEwM0JikcHRBRRAYOFy/9oACAEBAAY/Av8Ab6zSNZ8Vc2SF0rtSr207RuG+iPNBoJNNTXvNHPvO9LVSOkDfqqm9I7Ulb2QNjachdxPeaV3j9Gq7euM0asli5MZGH7RL6rtGt7xRrt6/Rqu1uM0bZgsUQ0igzJVyMfE692LG+bJoMgvMfw+kZIuPguxtJVBi88x7rxuq/wBAzRAO7Z6W2YW4BXGNLj7Ihxq52Y07qdn2V3F+J6JJqbKnAKjRZkrsd4nQIia7U9Kd1ow0fJgLKMxOiN/CnS3NUiaXfBXH3b1endnXTwM4W2NkcMETbWMcIzJQiDr3dnUPG/BtlTkLcRgVvNoj8rQ9VdY0NGg7uSORuDVRUbYYZOU5exW4HKMSfZU7vum/eSfQWXim3MqY2M3gq0NvJ7468Xd3SyHhanSu62AIJt4G6TRCVxq+Rv6DuZ3brruhojBKN3M3NuvwtL5DdaOqutwiGQsrpbG+cNMRN673UzjB8Yr8kDxPLciM/wDqEZY/eIUfWMdLAFQWCMYDq5NY3JooO60OSk3D+AONEJIQY304qap7ZiX3lhlZihQVOSunmdi7ux2eE1lOZ9Pgu9eixWozRnrwRnD37qXvcGtHUoxbJgPWqnw32mlV+ZqiAFCRePc70j2tHuUWwN3h16KsrzTTp4/ZMiOF40qmRuIJaKdw8yVjfiV5YdIf0C8u7GPbNVke5x9zbgsrKWkE5j9FE8dHdvvyHHo3Vc11vpCxNuS6LFypZQ5K+OVUVFUYJklA6hyTZG5Htpkk+Q1Rlk+Q0swVTgsqqlLKqqp1V0ggoncl8XVB7b8cujslcMVPforoG8bdvVFjb3wcqjLtZkeaNCLzyjlFlcgsvn4ANVdkBb8QmhkjHh2gKBkc271DaqscQHgoOcYtRNKFVxwOaEROB5f47UXE0AV1hpE3L3sqVSytnWhR3g3TNXDFNoy84dXfYGdo/wDf8p2ybR93Nh8D0KDXGrDyuCvfjGDu0/2kRwHOf2sGGPgocNE3ynmvUBAhhcR6j9neZyHlP7Iwz4vbg7+VupuXI+7dVUZdn3bD5rvosVgKKtt9kbnNrSoChZtELS5jQgxoo0ZD7R0UgwP0V4jLP8wTZYqF1KsP7J2yP5o+WunZrxxeeUIySGpPhdQ3WjqUImZD6/b3cpBylHYNoq1pOFfwlM/qMHq4wmysPC4VHZDLIcB9UZH/ACGngwQMjDuhmrkbQ1un+DvI8J25fmT9g2webSmPX/qm/p0lSG8Ubuxl7jRozKwwjHKPBI9jcGDFGaVvG7IHorrGho0H+GzaGvMUrfxAKtMexnZ4j5beY6myiutFSozI+7XnGio0U6943EX3r/oFuSDeGaEsho954WdaaoTbU3h6N1V8cT9T07y6Z3T6p+3TU378Yw7ot7J5sxxLig9zAXNy73GZMY2Y3dT/ALh//8QAKhABAAICAQMCBgIDAQAAAAAAAQARECExQVFhIHEwQFCBkbGh8MHR4fH/2gAIAQEAAT8hhBgwyGCcYxl/LkIes9JlIkPQFrBxgwQxGLl4PywlSoQhCVhyPoUqnlt+0v1GjQfjlle9ehX5dIJpdTp+7hlQemI1GKhAQgQl4vIX8oQxUrJlzcuW1H8jLNvB3+cLdDmLsspP5nYYmQzVTli0emiCKwxYvliEPSYvCy4YnzLj3Zci14vyzd2PLHizFp5391bggZM2QZMEIZBFYWOH0vx6lQMkMVlZdCug5Yg/iR+Zd7bxfmdyOtVv23L+b92CH7ekPacvTz85HF8HBWIgipywqVGLFjFl/JmD1glRxxxep+RjO06NYmhA4mrRGK7XLzzq9D3ilv7Ug9AMOMIYCVK9BcUWLF+XIZqVCDh545f5dps1+pz7vWKtwkWgCbX3lzrCBlXpFociHEEkVWAhxkOAYBKgyWKLH5kYMMVhUuahoOng/wBxKycq8xblDb305gmhLtavywUCbl3GJvbsAs93rhWSBiGoZwggSsDLwLF+cIMGER7quOh1f73jKNIHkbYPUnuBQBQaAn2nSG+zLDLw1CW5s048X1yqBfw+vKmBci/QBhRLP+4zrHvVuzxEhg28957Iu+bIuCJ2ZCRKK3VZHUMCWyj1DKRWbjh+eJcIsFX/AGmMoHlCfhigapLHvHEdXqF1gLNN4XIeAojlwhDDNU5eggegJX0WwN/f/Mr+FzoN5i0NQ/b2vrK6B1dx4SqFlorcckUMGoYfQUGLwel+OfJEy6a/YzrJXS0R1arR2ZfbApLjOicfublHf0O2KlSvWoUwQl5IZJcX58lCAL9/ETXlo7HaDggkcnMVeype8hTNUSdPNWRUMGmLm+aECBKlQgPQfOVAg03UH3IFnSs15RzAYI0Nqm07fe8su7snLsKSaFXFSEKduqIaayC+LCYGiZgIECVK+gk2jPXsh3EDxj2Svnp+3mcaZ1KP4mySeLxZ/wCxIbjVtXHSXfLLVvEurDdGgg8UT2CcIZZKZdg+EXGRBiQPoxcRAAopGGmpi7KuEvrwnwja4FK9bgXcmyaiS8vVAJazQ6wj2dK48fbBSr9ABqUlIQQ+lU7YKP8ArcuXi9LHo7jg2uEnA9APiE7Ude7n+IOQzRlx6CEUUH6HUCcuIEoJWv8AA9b7doqIq4YNMo91A5OXUp0Sv8kEoH5VyGkW5xgghGLF9ITh9AvCTuHVL0u/1FqLoOh9pd4Emq1BHCoF7L7Mu5YfvTd2AOJeHCaMeRixwuEH0Jfid2whPBoWIPuv5Med4LpbLvmWWoMW+odaaeJWERumKnfRHXRLmFLhi3iYLJTFTmMfSA9avB8vtcXFyo3t9PSR60fvG2NaJl9/aM6ofaeYd5fR/wCwLDtwr2dF1C6a+GXF0i+wIGqIvf4l4dN08nhwWILwGo9RcVKwCGQ+Meo+AuXjqLtEo/QO0Xe5VtRx49nmDqs6qS7SR50QcbdOScPz1lBVVoo5Y4G++o5dpq8L48w6rWdZf5luthrrUXzFztAXT2igO5N6LQB3Dr7n6hIIKLE6zfFolYjgMH0GQ9R8qAstqy/A1dsjuDbaNMf700o3EUzls9sjcrV13drzHdAB0/d0QCeHuH5iRGlXy/zChRqXiRr0Nq9+z4eIu7Zfceo+YNNCD9cZvX/I+8ME4xIS4ODhgIEEPTXoD0nxTBCtXpGLOF/ZluI/AhCbbq9R93R1KAHMp8pd6cLRe5UHDf6Ihibra9+3ESLjmVFHqDpr+H96f+QQa3XqfB+vuxau/pf+JDSThTv39n0FzCCECEIYPgEXLyYPh2rsy6sJup3BnMOY2A5TYl1y3MVeJ8nZNiFLs/jiLeSHopolURBHSMO2cna/4/XtNW+8ngxKDTacdp7c/mEEFFidc0iYjlcGDFCHxCHpPSRnFwarp7yjAX1mogDsRDC9QT1NAXApUa0j9oUIlB0zUqEMSWTXh7UQeq6JOjBanC9T+6Yo4fLjyveK7T3zx+0WCJKhCXgyXx1ZIZYQ4jirQ77/AKjqX2rOcdk8S91KJOlNX2hv9x7u8rDCBDCesQFwq2f8b4mu0H8b7MA/R9x/pl0oUCEqEV6QggQfFMRkxccKBnEd3aKfz7A7QKpB0nPfBAqFXxFTNna+IDCuBAjKjAQwIQgyQSsKxhNuzsx0wG+Kf9JRFvQ0nb+b/MCDBWTgYpFfGJeRDDgRZbTpN6K6/wA8Nbh3hvQtdE5LA058HmKLU0Lg95UwehRgIYIMLXF4DE3BAgZKskHqq4uAVVilrEySGEQfIj0DLlxxzaur+1Y93RKJCdoDnk6o6feU7hbeV5Y4uj0Mlk3wKehCiCBCBCDEkYYrAPkzJgxUvPp3UnQTa9bmld1fuLt0iqBzXT7+xEhPS/ShhDpA3kDXojqJqWeoMBAggZqCMPkgyekgSp0veju6Ep0ieAfRYoWx5DxAlIjTi+YPEghNTlAY4JWFYDKuE0wmBUrIYqVBkRRfKHohqC4Xc0/7/t/mACqhiOkolSokqMXcJLYjgcECEBKwQh6RKgSsD5AyYMV9BBDKhQbiTjCKpeBDrEYGIJWHB6ySpUCV8b//2gAMAwEAAgADAAAAEH2HUWVRt01vusrnCqQdyy4N9XeYWWL2cdbhqRx0hGkn/wAs0nkte+AQgaKPE2wWfkGt2j1Y/JJpId4PnLAe3/kikDJPKyX9pQNglIi9KcD3LyLIV2KB7QVOhQZHc7sQaly8r7/4D4Qydu2J49xjIXy8xb5zVpyBHOglgjzzstSQq/p8m8/zqMBYezDcRwhuKVZtACMCW0WTFLAy1sZGYTVrfsdgKP3Q3F7rKImyM8xCB83o55LZ6wGYu5RdeI7Lp6AMoRWg4CLzuePJ7M55rLG3M4oebZO68kG2S/DT0p3Th/cUmwbUm7g/skONjaEm2qCyavWvb6KYFW2AmKms78tEtYtZbdAacIzaL9b6iRIf5emPy+0ABiRvgoxTAR8dgDbD5plFyEogUtcBEv8Am8krr0HX0PRe1t89izE+0Gjz8jUaolnmsk5yyiks1bZKkkNqS2w52KAqkjWVytEkmiuysoYxLaGX0Y/4aHqrhKS5MZ6YkkkmhsqzkkkQOp9gfQRBkAFYPmxJR4kkkkkb4Epj1ujAAUPLDQOrC6wQNRtM+AkkkkQzNwgHiYE28zo6YUo8csVUJJ3iREkkkCxdyIQYPqE2UUYrF8dAbxwpfhiBMkkk3+ww3QnxeW+y7PLTznY8DudN8XMMgHkrSWzu++IgiYVZqRZkUV/WYn7Xgnkk6khawJJQuMXP3iflDG6A+EBhYBPQQMn6A26DRwYBa/r+b/imdAcuoISNcLhqkgMkLg10wsUTJlq2+UaWXKVLueOM9rmmkkkncCt+MbCVspCfTY5xK9Il1hvLkmskmkHxIQqM7/EQmpcQNRUuLuw2WZXkoEm00oQG6Df4BzRLB39WcnufoYWtzmwfMmm2AKgGyksQOV3Rqr9fM2DZszWWBkgkkkkXW3qeeGsg2eGFYhkGJlRzvk65Ekkkkky+Ti1yD25a5AtyDMXfugXkmYkkkkkkkcL9pZf+MoG7i7OqkFJtorQTzkkkkkkkmCfngR+ZIUUu06s8RU1hhMJikkkkkkktGftSppknhiZ/VhReALFkhOoQkkkkkkInvAZg3jSpMLQ+AHeigckkv8Mmkkkkk//EACkRAAMAAgIBAwQBBQEAAAAAAAABERAhIDFBMFFhgaGx0XFAkeHw8cH/2gAIAQMBAT8QzRCdQmJkEkQsUuLxmLCjE5lBeiWKL0UTEwjQsExOi6GUXXF0XgPKxvitnR2LYmdjYniwTJiZIaEuE4I160SVh/H7NRZ+7H0ZQkJa4KGsEtEEFmjGxsvClKUTwhiJBZWh0QnlEEsJiylw2Mi+Tc7v/fBHEiAKv8ft8UhBCQlw6BojCQWIQbKP0IQgtkOxcJwQhEFhdCQuO+0fP6OiV+7E4hdiO6EX3/6TigooFQsZLCDRCEy+SylntYpRP0Esp4lEsLC24j2I+/8AY6tv3feE/Yttll2Nb09hMeFgWJUTJSIIXBvDLg2UfJCOspHWEXKEI7wkISFlZWkJNf2aLiUXtE1YaBrBD6wlj0ExLBBLCFijeG9FxOE4pZuKMWi0vG4Qg2EbxNe5tJX7sh2GNCd+BFGIkL0vPkhDoSEqJYEhBBBCEELDZRso+FFzomJEEPQxEEoXFELMCR8L/Ikkdis0uhLinsEKC8fIw0LQ0I8WEiFggihJmlGylLi5XGlEd8FjvhcIQtCYhEl+u3/H+X9qQb1E98kPpiGyF1rJ9xhDYhGNfEK3AmFkuDZdYReK4dYSFiUhcI6LwTwsLDae/wAPH7+olBtzJtNDYnv9g7SmEJCELDDEs1QXCsnil9FsuEMTEUhBaLcrZBawnjwRvDz/AB/nr6iC9mLYugo+A4ANa2UI7EKGjhCgo4JEy8P04QSIPsRJwb4rEZsTw3z34eBI0tLBT4/Hwyg9h7G7ZRYQhI0DBBGWCcEuLw2T0FyeE8JCWUjo7E0XFx2fS2//ABEp22Ik9D6Hle/Aj+D7kIQRBeBchYhZUQuNG/QWJvmsIuhDwsdkGsdiYldjFBfr8sSJMFsm+hzT0hqMgkQhMGEuSSEhYgkJcExvC9KE49Y6WFopKJQhDdlV5XwN7F8eUN4OZJKtil8j7EZ2LhbvIO9saJw0EHMcsSCCRCei+Gxems74rCwkpK5Jr2ur+xZlWn2ot/v8lYz+C/2d19RIRbpt9/7rwQREkJUug13YyRYJUiUGLHiFgWsEhejcLM9FcfOUxDwh6YwnUSjvappVPaHoLfa8X4+DvRev74oZdHR9LoT2JkpI2wVIIFAvWF6lwli4uVrPkQ1mxv8Aq+P4939P4SSKWD2MO00ntlpWKGjIrXBYYb0pl8exC5z0khjcP0n7/QhaRDY0JoVbQlZaD8CgQ0HrOovDobomUIr1BeKzRCxSiKJ4oncvDSFY1t4vv+jru/fyQQmIaF2N4IHHQ3rif6KI6GrHO/B9D1hCVFgvQby+D40sxOMxZ2drv6Hiv3fj9nlf+vgTRi+BvCFQ2EniC0hCNhuPIuhyyD5DwSEEsF1xvrJCR3yQkeHnlibSv3ZTR2JUTQQ0FoXyXL4ErcI04zsfhRjXg0wJXCkF1mDwpTCwXFcHyWeuKz1l4v4oIJJESCeLRKjZONFeJN4b+4p6jzap+z7KvP8Ab9D1P+HhlPb70/8AwbORtC40JzBNcFobEdBdZeEuEF6DFyRRA7GQL6kNxKD2yknoa80HZ10vktdv8iiPaH2HhmKH1PleRluhl4ifq84J4bMokIJcZwhMUvFcZwY0XYir7CEhPwNBMpdbIpbf75La0XwbPBMEEsL/AAvr4f8AkWPoDMn9UXU68YlINzKCQsJCWE56NGy5hMpTKFwR+Ji6Eh0SwhLYzNtaL6Ti+C0kEIQWBYqQdc0+6/wdBkzWrtCeMIMMaF4KLIXoLhOEwkQgsJEPZt9xItIYmM6O9Y/tTbHr7HiEEhBBCjFWBFkNDRTf+plS/qK8CzqUWSGKUTyYb0kpwj4IRMJYm/C7EpGkJ3FGyT7xjKEwiCQlhLJSyG2E4m6NoxbFhNwIJCwIJeiniiEIayhlySQUSQkIbRsU9lj1iWJrBLCKJiYtFwJJCSwfo+inxkKUSEokXBCCwUJ6SxM0QohcHv5BMfL7xTwPV2MrV1+R8ZWNEIJCvGCwlFgpghD3MYWntCQkSgkTCQwRSL1ITC5LNEe4f4I28NJC4W39mMq1GEEosoUsOhhiLiwpCEEkhIWU1BieIIQ9ZMvBbysJEIe3K/JCUWxl2zyK8x/gRwohIhEJbySEzQmi5DBEQQSgkIJwYagmL+gMWijwniYQkQetRmup3PwIuoObtMrBChoSNjCSD2JYkEqIyIIpEJMghZQg0JhMTE/6ClxRFwgtISsZt835xXDckQaPI+sJluNIJCaOsIJCEwlhLhBMEEhevcIRBZQp2G0XBSCmNUxo0FvCiEdMUEhbEpgSEg1hIXKDQgkJT1v/xAApEQEBAQACAgECBQUBAQAAAAABABEQISAxQTBRQGGhsdFxgZHB8OHx/9oACAECAQE/EA2zjLJJvXJEEEQ4PwJL5LznPx4MMMM8PBLOpj1y8M8ZZBBBHr8Gy2274NtsPkl7jkC9qG3I+xwgI42Uzp4L3Dbw2WZsssggiH198H1P0Q8es3X8rrOp/wB8yNq22gfv/B47wK23OJm8CbbbwPARHO/SbPDYbZeV43l4756Xs/8AfN7Fw+xYtfiOQ/2Pz+fXGx4gxZq52HhvIQ4OByeO22cPhvO28ZzvKWSBq3T9n9LoF19iLD5g/EmJz5/tZj2+88HGUspteBjNmbctjuIIizgYbedjgeM5PBs43y22DjpDtke09s5XLNG3Yu18/wAS+X2nqWWW22Z4DYIIIPE8S2J8N465ySeV5TgXt3dDuFswZFiwTrKlexn5W287ySymLPK8ZBCCPELJjrgPLOAs5ecsnjbbbt+39rR142D7y5AlebNsn38fbgPA2yzl2ertKWWeTLIIIPE8sstvjk52zjPFsmbOPfo/q/wfrl2g9p9dQi19pnDs/Hu/pJPqSXPMasa1rwBZwCzwzgILNg5Hfr5w+Dqnr93z/H9pbSD3euWMEnnQ+8pDu8MzCWczwnitbq+GQWcByZwcZZ4B4FsH00sstH5fH9f/AD3LL7XpENl+0AgNwZZwzw5eIBrrw3neCI8Mg43keFtjnbfpZZZD8N+75lg33CZf5fzJz6IAHxHLMpXRKfAB9Asg+k8D4t8cbb5By3pfbo/mW7GE0MIj8fmffL+kW22yy8SNSzwE+WQ8ngs4XLbPPOM4PANjrhmCdEiv18S8Cb7D3Fs9vANtttvEXTmFl5HJfFgQcnG8nVtt7jqY65HfMt4Mgsfhv8knw8bkQVepV8D9Zs2DL1MHoy9ch4yjwBFzGy+bbweWeSTzl1weAcsxA3c7h/1MRJnrt/4lzJ+bc/yRvpfeHr/v62zBzgEg9T7lOJuEUMHGrLs/S7+mtscZxmwSTHl8WTE7hyL8+fZ7mfgPT+X53R3kMZhw937ZJLc8CLtW7Xh/CngbL1wO85ZHAWckvAhOf+H5v+v+1F14L2Qul+QyyeC4MbWXgjhJJPwG2+BYyWZHBDxlnIxbbYmtjv8Ak/iRKvfgupugsFPmaskeuKl4IgcjxB+APBmWcZZBZ9DIbVkJnZvd+vtw9+A5Hd/dI4+pEbbuQmfcQRwyTJfwhn1vSherrF50nte287ls8k46fF0dz1wXfANLKYjg4Me5fJln0dtt4PpbfMX4JDtw+1t8cbY4HcmzMevm6Gx2cYWh/wD7weLcmvYdwXqG222WZ8D6nxznJ5rqc+G7bVhx6ZetsJpaQqPk/acN2+Mx9+/6XqP8WDTP9vtxlnt7/J/7+P6BXoZ65DdmyySyGGXkvgcbzvmcHPUPk6bolS9fHDi9wcfM6dwbdpk9haT0/wBO5rT2AdBZkX9pt+z8P9raLOhP9n5PsjUfUjp/R/7/AL/MpShk4JwSTjbSWfo7bHlkE8lngAV9T5np6/m22S04ZZKa9LuezAQcbw7TMg/uH3P5PZ/iZB9M0D2emHb5PfII7g5Fm2ec+jkHhsc7zkdcbbx+6f4ngMJ5OADZamv5wYQcLMYc7oY2l7H6P/v73zlLH8lns3ko4MmSySyfFtsfQe48Nth5WV9yX6Tq6wQRBKdEcHsicOoh4bbbwZzMYEeiGO6xP8iQjgt6tmyySySSfEbfobwS8jDPGo+X0TD2MxZHVqfbBvCZZeCy8gx4Ryl4Lj02zjeGwc9Syy+GWWfQZh8CIJZbaTmfcXTDr5ig4Sw2xF4eWfMLbGITvzYPntCpZZYYhl4Nbv0Ms8s5Ak5JgL6Jen0euPd84ToOizZ+/j8rDOEzYm8hu0smXFTNtmF2ae+d5EeQ38Klk8H1dh9H6w2R9pTLh+pZ5wjgL3w6xwwjHBrwPA0ltmMeDUMuFtn8GPFbeNvvq/Sx9sA6dhPQXZELaxN6mbZQ9cFFnyDWLLLLyXrgHZNmfw28NssqfxB9t+h/eX2/Yi5dljg8Q8NJkfALdJup4mbLPkT4SSz62eBznDwsLo/A+Pzu/ILvbbDwOwTMzgcyt4YzeXzURm2/WPotl6Q7jguEJYeDGCzwSl5FW8Lhnz22H6//xAAnEAEAAgICAgICAwADAQAAAAABABEhMRBBUWFxgSCRMKGxwdHw4f/aAAgBAQABPxC2JlBL4sxx8ApgIMpux1ERdxmuAzCVKmp1OuAlSoSqhCEqBBDmGJAxCahgl3waqdzqYlPqCRLJbKpvKuETFhQNuIYSptCFloXiMHAh4uMuLh56hycHAQiSvwIOBwWu5rBcBUqoMMtl4nsixcTCMaMsP0gy/RLS4pVHqh/wQHKKHM8Ob+ywZuV84lFY9w3eIZcOGUwsxLrFZTOOLcfmlU0xPCWR95iZYtRgeKgQhwEDkgQ7lQJUeWriBcIFAqGo4OJcRH5g3GkOsNMxsd3hdH236l5cx3z/AB9VGgo2kq/+9yhHi0mSiye1QlwFQY4q2ZYz1x6yzCXqUaRswFamJCvHRChEjruPURjweJWIk7hKlcdQODg5CVK3ByBKxKzOptBxGLnghtAknigi/QfVsY1dvbHjY/5GcQ5cMoh6802EsaKwCbA7a8p8Fy1gk1FmTHS6nqlRqXdT0ygg1BcsI4VN9So4LUKOPBlQh74BKzKgSoFcEJiHAQJpPhwkuKLFSoQFEvHElWCtGgJXuMW4vvX9XGgYqWQ/LbFJcld7hkA8soL2LxuINdBbc9bP/rqANGp5/b48EMKrgFy5mCNQRwSs7YMqhNYpUyhlqUOYeJuhDElQhMSuCVwQIHcz+HhB6ivECEYjDcylkKRYmYskuDnn+no+6mUB5H6V5+W2D22AO4YP2RC8/Us6/IhMqTrHyuiAnqtNDWh6P7/yg4dSs8ARJeMmGGYYYwPuPMRUEjG3ncOIqw5CE+uO+DXBDcPyJcWYoa4OB8V2blW1dkK8ej2/QxNHGFFP2f49RFZb9wqcEyGvcpTDpe0bXeGIMs81GGBqX9+Ja9BF1GvbnLMVyiFkqyMvDVmGiWvJimYoDxKMzAi1Em3PCrjqVUKj8zuEIy/xNfgsuHBOocHljIUwtDaXzKExlzbv2+f08xU8rYKe2LsrALILP6DzPlaYy/cQqfFSf7MoEE2McB+i0folIE6k83WX0wrVY3KrmUqETuDPEiyqM2CmCYuFa1LzBB1K02zbw2Tc6gwYzqH4Gp98kJ3+XXNwvzGyrcKptF6LKU9d9UQpVV7h9AgKlni4Qg0CGbOmDI8MA9RQbUwPZO2BgZuaRKfLoPmWQ1OYhqlS6UtvmjERUWZcVBWJpwRZV1LViKxPEc6jPUp3MMp4j+ZhHGo9suXcGXu51Dg4OCViGeA4PcxO/wAji4blIT5x+544Aaaf7H+qlh53L36hOvI99kuRUo/tFYmFuyUAkOBodTf648QGs6wLasDox/vG8sh1FcN9SpCi7qCmoB1PXBhnUpKJRCUstluLl2S4TPFwccnITrgPxXhhOp3Bjgw4AESubJZ/Qf2kYZsu4j829vRKlEG1IxCCADQ8j4iP3IH+kU5OwfRixrvxiawfkH0RWcbRQLZhl7TKo8RFOpeanrgkKr8AENcP4HAcXwQgSpUCVx55J3LnXJ+AwbllWoAWr1HrlUdAc/Zz8VAYQK18HcwrezzFqAUq/MtmE+C9npqk+PEbWLYrQgvkt6mHAMKtaKzwrHBzOipe8JRjpTLuoR1CIASw4DBArgQKlYmNwUiwlcHHmEN8HO0eTmuOo8GYstnrgmQPTTTp+zR9+ItxONeoGVYz2wKkm3OVuvSV/cxC9jGVJNmkgfsEtkOCValaY9/0RyR4FXqBtlzNfED1Kpj1KJiY/AeoMco7lAl0XghC4EODUCEMXL/O8Q5udQhEjB4AMuXldD2sarSF2OsegiV5K1U0Hlq9xeXo3AdgAnxYPkGKiIQaWtPstv1KVi+ouoi3XAEMEh1CRi1xUHFg4WiSj8FFZb+BAhDk1x1Dg4qp5/JlLLBBgWrBd4TZ/fhGOCax9kdiZg9I6XhaLQf/AH1Gi7Mb/wC3+fuFnsdsvfQvzL6L8ZnmcxEC/AWtYeG731ACAAKAMEvtqbS1LBqIbIt6iRTBVhmHMqJXxYJSU/IZ1yQhCEN8EITz+JyS4pxcUrgwUxKMV0d5iX5Nn/2EVBtV3yIsOsmHpLgK2JE85Y+iJwKjgsEaA9LbemtRC8Sh/BUuvcastj1K3Oi8dRwbK5RCl/OvuUFAHgKP8huKtE8SGskAajYcR1xAnUM2f1CMEI4GyUfwjDjEqUwhCVCHPTBK4vgjOp1xqXczBplDAgw9QGEdjFnKSNB0njRkmzq6q5umh3Lo7DKAtt+rmNKdvqW5sMy4sI+kjtFgrbYKimYaNFIV/d/cWZilzKM1MtRRpjtJj1AOoB1BRHmbR/xEMwhOuCEITrj75oPwvi/wYyrYDE6juwu2Bwg/+nzFdNr3K3OzgRJTY+Tr7gmWfdHZCr2ljflBPIqbtEF9ZDEVl1hvcCAxcSl1KSARCopUUWYfmD5ln8NQ5OA4Ic4qD+Oody8QZcshEmXCe/rKB8stY8tFfF6e3PxEqBartiK1EhbIeqLmGDZRjV9t/r9xWaGg1XklIMxbp3b9UfUqc6hB1FF8Uw4LIKiqYJXDgW9xZbFZ/CQg8EOCMvg3zcZfFwZcWDDtBuFXXUD8XuHhEotN+Nv9SuNNq+iMfcUnbLRzL2Yq4BRbdwMlkXpf80fqJp3FYCoa73Mt1xWgtBYOCj6iWO5bTg3VBMCKiZIuNhjWd0NcV/BmEPXA9cGp1Djrj44HHFy5cvMGXCGKtWhb63BSMxT+xz/U8Q3pg/8AGqj1G2sf9ytgIJWoa1awdKboah5ZkXmNhtq6gqFMBkJmAEpTbIX1fjplxA90Jkyez2J5EsiiL0xLviGmWLI4CwUmRcGIODhmTwUQQQcrUYtmnBxc7lwzCVidcY4Nfwo6DRn/AMx5YH2jMoPfa+2KlfawyqVnSxm0eAgoJsunKXwukLXH6A/vYLF701oRzHqvT5I+fS2YLWr+5nIZfBdYjcUVVJHbqRwyUiJnrMMtqmQ3t8+SUAD0afaHScKmYpRtgjZG5I3NYycEdQcXw6iy4Zg1DUNfgQ4V+OUYfhcJoX4b6Y/76jyctBo6B4lnivYQw5eiWxu1Zb6hQLFXWfhgdyyGiaq5NSptTPzEgl/0MS17TYo6muWAbHpGANMCADTfCL0eYudFQshFJkCVnq9MFoU2FyUDgUMDWaMSgnmVN6TLYtIXs8ywVEx6nUvTuhVe6M43YwgwealrA6R8RRq4BSaSmFoBAYhAhDBBU7w1GVKgQYzAxuBidSuCEJWJX4E6nmLF4ueJ+5j/AJfUfiys4/73axqy7hlWNC7RyV+4IKtslu6s/uXVGTIxu3Tuo1Ors7IHaFUUBfWXBDRmiEj0q0+CJhi1gWqFgPNw3n3SfFqyZAVG6vFpamiQaAoIeRlzcVKd0WCPqLXzfUBd3BKCoDwRH96RhpkMDAmd+e4egRX1nfhc/QzRwUbh4DqY98dqixY4wckeoHRCVKhFEo4wSo1FhMIQZ5mIQ7hNcMeGhIeoBtY/CU031/1HR9xbTMqcu7NsJpFZeGCSjc5auIwY/pjPXyHuIhvSmceEZwpGjfFg/vEKCpS/mNH0RRV4iLuC3ARLEQeNk4AoGxg/SqOqaYWVQI0s3OkV8Kks88zanD7VNX9oyx5TUYWH0ZPs6lEFES5hFZmy0lE1rgMrzX8HRERi4QTuaRYQhi5eIvFRICtEOwWzcdFvB37x1Ea5tFEGl5SXb8Re6vEOlM7nV1UVijkWr9RJHgUxNKNVjOYuLgPsnaK/pEytgwgvXJNjUMtRNCJblQWI7EggZ/hTK3z0vcKQhne/c8+XyN4c6dHBstgd/wDRh+1IWB0j4gxKxLJtmDMXAaJXhpgsVk0/gGXiHHtMItwnXAxAxGOoMNkIDURAa9mU7e/H78ShO1pS1VyxAlFBUFAf8TMPiHaBAlrwRH0rTotY7yfuKaaooDJdLzv3bKgehoHqJEg258YczXgRIU0aQPETAnY6O10j/wCphElp4z36H+inUaJ/HxPgGiOk9MvnWnBXq99vHwniBUsqoBIE2xCxwXmW3HuCxvA/4SEGDBgmUnHtw+omL4hmEMcCpfsfT/5LulM7i2OpS1LepeQZgT4I8FJblW0rurfr3K1R6aU2vbARwRZhthQ3qHjHlHBT1MHAwYBqs0u/Y78YZbKUdva/s1dJtjjQAWBWFa6bH3nbL7mruk0+zT7iuGFp6JUJqK5UBiLylH8BUOLhxp3AckSBBGOEVsAsrFHZnoHtjpcq+oiGQMsUKZXcJewgwdeHAv2xEprNlOrna1rNRrw4NHy+X3MdwQSRN1KYcwFRZqU6mbiXsxcBkBWo2NR34wwDXu8P040YVwFGV38nnF7GB+vSxNLbWQU6YeI8DSMTPCRd1PXBIAP4RhDWZ3CfOYQuVF3FiKdRS8xmU2KAbY0UMjs8/bDFquOsrjIooA7jfHPFauqgzs/AwpRt07VHtMV4vzCbIsGH0RdxQqZJ6ZcaiqsIi1ESCJdjXxrSk4V4G3UPndE3VoYtK3eoVDIHJC6L8Fv7ZXxAGBUQrXCqz1z1wCAH8h4hCHBYLBmCEaRy8zvwyMB17D+36jdWP8J6TLjoABaszbLUdZB5Wb8e4scGky608qxHqUOSF04F4gNSp1ANVEPBGSwjNJLiUxL1KXBaTZjhu4KkGoOAXC/CZ1/MMHi4TSEqCAyxG44Q21oLdMX8uiEGcKIGaTySpP57oF+AMK3nqYALQfoM/wBjG7ZxjD0NPvfxCdwXMHKpRGsNwyBUrPEoC2JZupX1L+pT1OqohOiYuM6lYjuNphgqKoiVhr+YZSDGKDCViE3lpBrUISz264D5YKF1GYNausUdEv6MPYNtQ9325+Jc5wNXCnzCbJpqOMQJbpL2gCAOYzaVYXXjoISNwkPFAOoPiV9QMPCCaTSdSkpMEOXh5iBX84MGDdwfMIOY5cILlEDQy4hKCxcD6C6O30zTlAPEC8EHxAdIl2ph1CRqUtIQGVYRzFyxLiVkFsKsyg43zPMcR3ACHMMOPwSypjY5szwoQZmn8twgwXDc7/AwiVE0iM3ZCvUGrgIjCQcCMwUyVjhqKWDLmFBhVBUF1AZQgSBiDHBghr8QSJgCBUAfzf/Z";let U=class extends l{constructor(){super(...arguments),this._refImage=I(),this._boundVisibilityHandler=this._visibilityHandler.bind(this),this._mediaLoadedInfo=null}async play(){this._cachedValueController?.startTimer()}async pause(){this._cachedValueController?.stopTimer()}async mute(){}async unmute(){}isMuted(){return!0}async seek(A){}async setControls(A){}isPaused(){return!this._cachedValueController?.hasTimer()}async getScreenshotURL(){return this._cachedValueController?.value??null}_getCameraEntity(){return(this.cameraConfig?.camera_entity||this.cameraConfig?.webrtc_card?.entity)??null}shouldUpdate(A){if(!this.hass||"visible"!==document.visibilityState)return!1;const e=this._getRelevantEntityForMode(this._resolveMode(this.imageConfig?.mode));return!A.has("hass")||1!=A.size||!e||(n(this.hass,A.get("hass"),[e])?(this._cachedValueController?.clearValue(),!0):!this.hasUpdated)}willUpdate(A){A.has("imageConfig")&&(this._cachedValueController&&this._cachedValueController.removeController(),this.imageConfig&&(this._cachedValueController=new p(this,this.imageConfig.refresh_seconds,this._getImageSource.bind(this),(()=>E(this)),(()=>u(this)))));const e=this._getRelevantEntityForMode(this._resolveMode(this.imageConfig?.mode));(A.has("cameraConfig")||A.has("view")||e&&!this._getAcceptableState(e))&&this._cachedValueController?.clearValue(),this._cachedValueController?.value||this._cachedValueController?.updateValue()}_getAcceptableState(A){const e=(A?this.hass?.states[A]:null)??null;return this.hass&&this.hass.connected&&e&&Date.now()-Date.parse(e.last_updated)<3e5?e:null}connectedCallback(){super.connectedCallback(),document.addEventListener("visibilitychange",this._boundVisibilityHandler),this._cachedValueController?.startTimer()}disconnectedCallback(){this._cachedValueController?.stopTimer(),document.removeEventListener("visibilitychange",this._boundVisibilityHandler),super.disconnectedCallback()}_visibilityHandler(){this._refImage.value&&("hidden"===document.visibilityState?(this._cachedValueController?.stopTimer(),this._cachedValueController?.clearValue(),this._forceSafeImage()):(this._cachedValueController?.startTimer(),this.requestUpdate()))}_buildImageURL(A){return A.searchParams.append("_t",String(Date.now())),A.toString()}_addQueryParametersToURL(A,e){if(e){const t=new URLSearchParams(e);for(const[e,i]of t.entries())A.searchParams.append(e,i)}return A}_getRelevantEntityForMode(A){return"camera"===A?this._getCameraEntity():"entity"===A?this.imageConfig?.entity??null:null}_resolveMode(A){if(!A)return"screensaver";if("auto"!==A)return A;const e=this._getCameraEntity();return this.imageConfig?.entity?"entity":this.imageConfig?.url?"url":e?"camera":"screensaver"}_getImageSource(){const A=this._resolveMode(this.imageConfig?.mode);if(this.hass&&"camera"===A){const A=this._getAcceptableState(this._getCameraEntity());if(A?.attributes.entity_picture){const e=new URL(A.attributes.entity_picture,document.baseURI);return this._addQueryParametersToURL(e,this.imageConfig?.entity_parameters),this._buildImageURL(e)}}if(this.hass&&"entity"===A&&this.imageConfig?.entity){const A=this._getAcceptableState(this.imageConfig?.entity);if(A?.attributes.entity_picture){const e=new URL(A.attributes.entity_picture,document.baseURI);return this._addQueryParametersToURL(e,this.imageConfig?.entity_parameters),this._buildImageURL(e)}}return"url"===A&&this.imageConfig?.url?this._buildImageURL(new URL(this.imageConfig.url,document.baseURI)):k}_forceSafeImage(A){this._refImage.value&&(this._refImage.value.src=!A&&this.imageConfig?.url?this.imageConfig.url:k)}render(){const A=this._cachedValueController?.value;return A?m` + {const e=Q(A,{player:this,capabilities:{supportsPause:!!this.imageConfig?.refresh_seconds}});e&&!M(this._mediaLoadedInfo,e)&&(this._mediaLoadedInfo=e,B(this,e))}} + @error=${()=>{const A=this._resolveMode(this.imageConfig?.mode);"camera"===A||"entity"===A?this._forceSafeImage(!0):"url"===A&&d(this,b("error.image_load_error"),{context:this.imageConfig})}} + /> + `:m``}static get styles(){return L(':host {\n background-color: var(--primary-background-color);\n background-position: center;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJjYW1lcmEtaXJpcy5zdmciCiAgIGlkPSJzdmc0IgogICB2ZXJzaW9uPSIxLjEiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjYjkzZTNlIgogICAgIGJvcmRlcmNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcm9wYWNpdHk9IjAuMjUiCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuNjA3ODQzMTQiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyNi42MjUwNiIKICAgICBpbmtzY2FwZTpjeD0iLTEuOTM0MjY4IgogICAgIGlua3NjYXBlOmN5PSIxNS42ODA3MTYiCiAgICAgaW5rc2NhcGU6d2luZG93LXdpZHRoPSIzODQwIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjE1MjciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEwODAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjIyNyIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiIC8+CiAgPGcKICAgICBpZD0iZzExMTkiCiAgICAgc3R5bGU9ImZpbGwtb3BhY2l0eTowLjA1O2ZpbGw6I2ZmZmZmZiI+CiAgICA8Y2lyY2xlCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eTowLjA1O3N0cm9rZS13aWR0aDoxLjM5NzI5IgogICAgICAgaWQ9InBhdGgxNzAiCiAgICAgICBjeD0iMTIiCiAgICAgICBjeT0iMTIiCiAgICAgICBpbmtzY2FwZTpsYWJlbD0iV2hpdGUgQmFja2dyb3VuZCIKICAgICAgIHI9IjExLjI1IiAvPgogICAgPHBhdGgKICAgICAgIGQ9Ik0gMTMuNzMwMDAxLDE1IDkuODMwMDAwMywyMS43NiBDIDEwLjUzLDIxLjkxIDExLjI1LDIyIDEyLDIyIGMgMi40MDAwMDEsMCA0LjYsLTAuODUgNi4zMiwtMi4yNSBMIDE0LjY2MDAwMSwxMy40IE0gMi40NjAwMDAzLDE1IGMgMC45MiwyLjkyIDMuMTUsNS4yNiA1Ljk5LDYuMzQgTCAxMi4xMiwxNSBtIC0zLjU3OTk5OTcsLTMgLTMuOSwtNi43NDk5OTk2IGMgLTEuNjQsMS43NDk5OTkgLTIuNjQsNC4xMzk5OTkzIC0yLjY0LDYuNzQ5OTk5NiAwLDAuNjggMC4wNywxLjM1IDAuMiwyIGggNy40OSBNIDIxLjgsOS45OTk5OTk3IEggMTQuMzEwMDAxIEwgMTQuNjAwMDAxLDEwLjUgMTkuMzYsMTguNzUgQyAyMSwxNi45NyAyMiwxNC42IDIyLDEyIDIyLDExLjMxIDIxLjkzLDEwLjY0IDIxLjgsOS45OTk5OTk3IG0gLTAuMjYsLTEgQyAyMC42Miw2LjA3MDAwMDUgMTguMzksMy43NDAwMDAyIDE1LjU1MDAwMSwyLjY2MDAwMDIgTCAxMS44OCw4Ljk5OTk5OTcgTSA5LjQwMDAwMDMsMTAuNSAxNC4xNzAwMDEsMi4yNDAwMDAyIGMgLTAuNywtMC4xNSAtMS40MjAwMDEsLTAuMjQgLTIuMTcwMDAxLC0wLjI0IC0yLjM5OTk5OTcsMCAtNC41OTk5OTk3LDAuODQgLTYuMzE5OTk5NywyLjI1MDAwMDMgbCAzLjY2LDYuMzQ5OTk5NSB6IgogICAgICAgaWQ9InBhdGgyIgogICAgICAgaW5rc2NhcGU6bGFiZWw9IklyaXMiCiAgICAgICBzdHlsZT0iZmlsbC1vcGFjaXR5OjAuMDU7ZmlsbDojZmZmZmZmIiAvPgogIDwvZz4KPC9zdmc+Cg==");\n background-size: 10%;\n background-position: center;\n}\n\nimg {\n width: 100%;\n height: 100%;\n display: block;\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}')}};c([s({attribute:!1})],U.prototype,"hass",void 0),c([s({attribute:!1})],U.prototype,"view",void 0),c([s({attribute:!1})],U.prototype,"cameraConfig",void 0),c([s({attribute:!1})],U.prototype,"cameraManager",void 0),c([s({attribute:!1,hasChanged:h})],U.prototype,"imageConfig",void 0),U=c([C("frigate-card-image")],U);export{U as FrigateCardImage}; diff --git a/config/www/community/frigate-hass-card/image-1c1ebdfa.js.gz b/config/www/community/frigate-hass-card/image-1c1ebdfa.js.gz new file mode 100644 index 00000000..43d47303 Binary files /dev/null and b/config/www/community/frigate-hass-card/image-1c1ebdfa.js.gz differ diff --git a/config/www/community/frigate-hass-card/image-1e2a0a79.js b/config/www/community/frigate-hass-card/image-1e2a0a79.js new file mode 100644 index 00000000..4923fbd0 --- /dev/null +++ b/config/www/community/frigate-hass-card/image-1e2a0a79.js @@ -0,0 +1,13 @@ +import{cL as A,cM as e,eQ as t,eR as i,dC as a,cN as r,cO as g,dD as o,_ as c,n as s,cW as h,t as C,a as l,cR as I,eS as n,dy as E,dz as u,x as m,cV as w,eT as Q,i as M,cP as B,cQ as d,l as b,r as L}from"./card-45855f1f.js"; +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const D=A(class extends e{constructor(A){if(super(A),A.type!==t.PROPERTY&&A.type!==t.ATTRIBUTE&&A.type!==t.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!i(A))throw Error("`live` bindings can only contain a single expression")}render(A){return A}update(A,[e]){if(e===a||e===r)return e;const i=A.element,o=A.name;if(A.type===t.PROPERTY){if(e===i[o])return a}else if(A.type===t.BOOLEAN_ATTRIBUTE){if(!!e===i.hasAttribute(o))return a}else if(A.type===t.ATTRIBUTE&&i.getAttribute(o)===e+"")return a;return g(A),e}});class p{constructor(A,e,t,i,a){this._timer=new o,this._timerSeconds=e,this._callback=t,this._timerStartCallback=i,this._timerStopCallback=a,(this._host=A).addController(this)}removeController(){this.stopTimer(),this._host.removeController(this)}get value(){return this._value}updateValue(){this._value=this._callback()}clearValue(){this._value=void 0}stopTimer(){this._timer.isRunning()&&(this._timer.stop(),this._timerStopCallback?.())}startTimer(){this.stopTimer(),this._timerStartCallback?.(),this._timer.startRepeated(this._timerSeconds,(()=>{this.updateValue(),this._host.requestUpdate()}))}hasTimer(){return this._timer.isRunning()}hostConnected(){this.updateValue(),this.startTimer(),this._host.requestUpdate()}hostDisconnected(){this.clearValue(),this.stopTimer()}}var k="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAUDBAQEAwUEBAQFBQUGBwwIBwcHBw8LCwkMEQ8SEhEPERETFhwXExQaFRERGCEYGh0dHx8fExciJCIeJBweHx7/2wBDAQUFBQcGBw4ICA4eFBEUHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh7/wgARCAEVAewDAREAAhEBAxEB/8QAGwAAAwEAAwEAAAAAAAAAAAAAAAECAwQFBgf/xAAaAQEBAQEBAQEAAAAAAAAAAAAAAQIDBAUG/9oADAMBAAIQAxAAAAHu/wBF+fKuKWoua2zblcOpTDeJqLJsVgAACCiNQEKJRCmEoMAhy1FzThq4VrCHDWbHCoilBWQKqzaa2xeTz3Uumd+Z+h4Sxy0VGmdbzV5AybMdZjUz1kEFA4AAEAAdEFAAEVKBDVxc1UtSgiaY1cSI4nPfl/N6eZrHp/Rw11mLJq83XO9c2ovO+Ry6ea+j4FY1uKl1zrSAAIucd5mlYUoBggA1ACiRiVgiCiW81w6JQqWpazQVTQCo6fz9vH+L2ec83o937PJ7P6HgsBAaZ1vjemdJNcb5HLr536PgACrioqFU2RZFkWLcAgAAokdoEhRKwgoHCCgrKpWrlQ1ctQpVU0jovN38P4fZ1HDta+y9HD3f1Pm2jEBrm78+muNXNVnW2N6Z15z6fz7zWSlDEkVnrMWKyaVgOCkA6AkBipwKBDhgIa1AC3KoaiuJtmPP+b0eM8Ps6Pl01lprsenL6V9T5vadMUJEa41y+XXXGqmrzrTOrzamvNfU+brnThgRrOdk2Z6yqSKxBTAQAgojBBRQAHDhhDViRLc1cpKhV5rzd/nnz/dw+PbkIqheXrH036nz+578LipVY42xvl8u14uk1pjeuNXNB5f6vzNc6uERc56znokjUEBBYAFACGAIAAAAKDyoqaEJRWVNOOn5dfnXz/b5rz9he1zutRGtfSvo/O731+aoYwjTOuRz6b893nW2N6Z3ebpnTXyf1/laZ0xM5azGpFioQAVgCiAAKmgAAoCAhgpDHLctZoNUvh/H6vnfzvfjHJl56taNNT6L9L5voPT59s1UAVLti8nl2rN1zrbn00zq860zoPJ/Y+SDM7nPUmxWIBiQoAKABAAAAAFEQ1BIBFTV5uktTXnOXX4/8n6euNbnYzWVjXkdMfR/qfL7X0cNM63xqpagKl5PLrrjdy643rjeuN641cpL4n73xUFmdzNCAACFAAFAAgAAogACCiQCiUlqWoqa0zfkXzvo+Z8fq7XnvmVx9Zmu27cvon1Pmcrvwcu+N6S689a51pnWmdb8+m/PppjeuNbZ3ea5QZ4H9D8JWISKhAKIApgAAgAK0SCiiACCwCEooOWocvTcuvx74v1+RjfZmk1jrPp/Z4/cfU+a9QHHIxupeRz3tjXJ5dXLvz6crl11570zqpXRDVnz39F8BwqlDUSCgwABgMIVORqkLEoAAJAFQAqsakOX5T8j6nQ+P19xNTc8nHXk9uP1L7fxI3hUK5d8a2xrk8+muNcnj25HPptjfI59NM6AHDVqHz79D+fCbFokAoHAAwAcEFEMWghKgALEgoAhaCiPLznm9Py3431+djXay8TU7vty919L5/YejzTYhDl3xrl8+nJ5dd+XTkc+nJ5ddcavOnKqCotoA+efovz9RGorEFMIYQUDQlYBAAtQAIKIVgoqRiqbAcuWNfH/AIv2ev4du3zrSqj6R9L5/fezxRYqRUC65vL5dOTx7crl15PLrtjd5tTRBTilagHzr9H+eZNgAwpwAADgGAQUAKwUQAQArjLG+s83p7P3+BhnXy/5H1vN+T1b5vPa1s9r34+++h87PWc9RwE2TV5cjn05vDvz/P6N+e9MbuWlBqAAQHzn9N+ecKwgGFjlBhBRDAIACkMSClEi0UOXTNpfN+L3ec+D+k7z6Xx+r8/o8FvlWddkbHP6Y+vfT+VyZqUmzTOtcbZnrNTXK49eVy67c9643rnVNAAAAAR84/TfnmgADgGADgAKcFEIBolKAEiRWhWbyMbivi3wf0EcuvKmuH38mWNdrbon036fy+768dsbcumd6Y1rjfL5dalBy0ry1zvXG6UAAAAA+cfpPzrAdAAMIcEFAACFoAISlCJSxQrUjl1zry3l9Pyz5P1MY1O72wxruK9F6vL7j6PzNc6359N8dORy6a43rje+NuAnRDjTGts7uaAAAAAPnH6T886IaFAQwGOEAAFAgAAAAAQ5Vm+D8Pt8J873xLKJeyrntdpL9I+n8vse/m1zvTOtM65vn9G/PpvjdQE1lrKRrUuuNbY3pNgAAAB85/S/niAdhBRDGAQUIKIgBSkEACpwEYvmPH7fCeH2dVx2mmVLFNnvLruq+o/R+ZyOvCprTO2c3z+jmce2uNMipsz1nPeHNa41rne3PWudtQAAAPnH6T86DAB0Q6IcFFJCBSwhKCBBQ43PfQ+fv5zyerzfl9XGzYRy6LCCiKucdxqfZPs/Fcu+OnJ5dUmmd87z+jkc9hOk2QznuXm6Z1pnWuN6501AEJGofOf0v51wAADGAQWCiClAgEEB13Lr82+T9TpOHaEUOXlzVmlaDlzlmzg3N12J9p+x8blaztjfJ5dtcbqORz68nl1cKgmxI2rmqy1xrSbYEiZais+c/pfzzQgAdOAAAAAKQQgpRwuXX5N8X6/X8+hHLObNaLnZRUFVL3HLp6P0eXzPSddJ0fPp9G4693+g+Lvm8nl15fHtU1rjV5rWpqoBDVxebpndytUJEjVqz5x+k/PMEFKcjAIKEFAAQhBWeNfJ/ifY6Xh25kvPWrMiluXVexzPQ/Q8HoPf4OT24llZvH8vp+X/ABPt9fqfSvT5fX/R8PL49eXx7OUVoS1LUuudENai860ztqwAEFAPnf6P88QtFRIU4YQUAOFaCRUiZfmHxvreb8vp5Evay1YWcatJe+9Pn9f7/ndp6fPGiSpRKl359PM/N9/kvN6uQfSvX5O81ORy63mxqTrNZ1rnTl0zqoqW86qaqVq4KAAAPnX6P8+IrFTHKIwhUwHCpWkIVnhPmfQ8N876HNl3rQYrnkdM/QfpfM7f1+VWCkXLedXCNcbvN+a/K+p6j0+fpPL6vqnq82+NXnUazNjNcbvOrlcC1LedXm0rUCAAoPm/6X88SA6ZWaBQhDBUipFZpb53y+r538f6txnWpVmusfTfqfL7D0cTWVQhDmtZrTN0zrTLfn00zrjY38u8fs+gduPF59PadMXmgE2VLctTSRq5by1zu86pQMgKAPm36b86wh2seQjUokqUEToi83qePb5b8b6153QrGdv25fRvq/K5PTDSLA0zqpXDW5dcXk8+nI5ddM6cvTZ347n07BPb9McrNqVjlcquW05QqXXFvOtJpqBAEAHzf9P+dACCql0zXEWMagkjSs3jc+nyf4/1sOfTSWyLO87+f6N9X5fJ1EBNjipdJalqWjbnvlce2/PprndZoeXzvgmlnsrnTN0zsVWRc3NXmuXTOtM6pQAAAAI+bfpfzgNUMoZWarCWgWbIoxr5b8f6/V8O2hcvYaz636Hz/Sezyck0zpWJLlZFgJbl0zeTy6czj25HLrU040zpnQY6d9rFDilCUVaY1rnVzTUAAAAAAPmv6T86wBGrCiAocriNJTwHyfq+U8Xr2NK9j6fN7j6Pz63ijk8+jgBBdsaqWUw6Yqa2xrXG+Xx7b8+ly1nVy6Z1WaCqNZVjzWVLpndKAAAAAAAB81/SfnC1hIDtBhDHKQjy/k9fgPk/V7beO69HD1Hp8/e+jz6ZrSbNM60zdM6i5z3nbn05fHtpnXH6c1W2N6Y1tjemdXnWmbedaZ2xIiNZjWQrOtc6poAAAAAAAAPmf6X845XRIwV2uAqLzoTi8uvnvH7O16c+768uRrNDluHGeo0vOtsbjWYueRz68nl10zus1rebct51UrlqNM7uVqIEmW+cay5rTGrmqUAAAAAAAD5l+l/OMYQwKtcripdc6uJ8nr7a5DXG9M6x3zy3loLFyJlvJLUa53yeXXbHTfnu86ZedVm6TQCOW5qpWoAJnc5ayy5qs22gAAAAAAAPmX6b825QcOiKtakmmdVLpm9t5PTyOfSprfnu86z1ni9uMazGs5bzFzjvIuubyuPXkcuu+OmmNXLeNbY1U01STqVLebTQAAJJQGtAoEFAAAAAAf/EACkQAAEEAgIBBAIDAQEBAAAAAAEAAgMEBREQIBITIUBQFCIGMDFBFSP/2gAIAQEAAQUC6hDofrwE1D+gIdDwfpNqxZggbNnAXQQ5Kwom+DOQgEBwEFrjXGkOpKJ+kuZKrWVvMWJUXeTsDVsMQ6gIDjSa1ALS8VpaWlrqfo7uUrVlcytqwhG8rwaFim0GzjqAgFpaQCA50tLS19Pcy9SBXMpYsrW0PZHax1J1ySjViqxjo0JoQHAC0tcBD6MdcjloKqu5GzaMMZI1pa4q1ZrMmMpMpxBDoxDkIchDk/R38hXptv5izYTimAl2zx4uKirSyyYim6pBpa6BNHAQCCHIQ5P0GuM1mPTT3lxUUJcgGtQCLXKNs7zhq81eu3s0IcBDgdifov5Db/GpOO1FE6VRQ/s4+y0CoK80rsZXdWqhBDjS0g1NatIBBqAQCAWlrja388chfyC3+TeVD/5Sy68/bijSltGnB+NXQQ4bwAgE0IBBqAQC19PtZu3+LRJ2q0fm4f7M0sQCxWMc6VrWsbwE3hqCAWkwIBAIfVZy3+TbYNuDWta9VnhyoVX2LX/OjUE1BNQag1AfV565+PVcdqkP3sBoR9xg6vqZCrTirSdAmhAJoTQmhBD6ueVkMN+y6zZHuWjxa8pgWDpehWIWuNLS0moJqaEAh119FJ5+Fa4JJOJHMijy+RdbkKrj9h/p91hcc90WkQtLS8V48NCaFGE0ID6cLSzNYPhNyz6dHMQyr+T+qXJo2QxrQG6VCo+1aiaGMCKAQCDV6a9JNjTWINQQ+nBQKc0OEkz6tya5t8V10jJmaMTSSxvtolYmr+LWCHDWrxTAgF4rxWuQh9O1ZvKNga874YdKPUsNc6k0Y34Wn52EE1BNCAQCHYIfTPLWMymb2nHyK1xVk0+WLb2bLMZCIqAagEE1NTUOu1tAoFD6OSRkTbmcgjV29YtO6FN9jE/yZjx52arDFXQWk1MTUOh5CCCHz5bEESsZupGrGctPUs75XE8BBjii0hNBJWlDoNx0xFkoIJqITE0odCtIBBBBD5t+3FUiu5OxYJcSt8AEoV3kCshGGoex9t+jomPyJBaWHRpvNexDI2aJqCaeAE1DrrkIfNu2Y6sF61Jan4ZXcQxjGD9db415BjduLC12Mr2JF/48L68uJsvnyGKsVZfJYa/tjSgmhNHA433CHzJZGRR5O263YUcBeoowxErSA9gAS6N8clenudmHb6sUEER2toFWofWiyNdvlVc6E4e2HhqYh12h1HzCQ1uYyBtSbUTNljkTobBBPu1U8XPMq9CrAieoQWaq+TcYIzas1pcbYxdgWa7Qh0HA/v38L+Q3/f3Ka1qPuWeyemD9Y60srocZTiPTSAXivFNavFZqia0uMljymOpSSYvJNIIHQcDqPl5e+K0etqb3LRzHDPIG1YparWhjOw4DUGoNVqsyxAPWxOTuwR36n8es7a3+sIIfIyVxlOB73zSjpjqL7hqwsrwddLS0gEAmBAIBaWVoMu18FZfTtZmF9O1XlbNDzrkchDgf3BHuFbnjrQXLEluf/gQTP2diKTprUUbI2865HRqaEBzpZrGC2zFWhbhwfq1rKCA6BaWkAtfB33c5rGZW665OOB/lWnNPHg6H47WMa0NatLS0vFeK1yEE1NQ5AWlexcdicMG9LXTSAWlr5Wcv+q5vuf8AuiXQYSQsjYGN0mhALS0tcNC8EYkWJrUGprUwIcaQWlpa7AIfLzdwwsmjeySWg+vRw2JLlSxsFZ4WlrgIcHhiHDmoNQagEAgEOB1PIQ+XcmbWrYyjM5UMXHA51dj3+C8V4rXGuBweGBDjS8UAtIDkIdSjyEPjjhn+zUhYm9NeCaxemnM77W0AmoIdNf1noPjjiP8A2M+yCHDgiODw7lqagghwAgOw+R//xAAsEQABBAEEAQQCAQQDAAAAAAABAAIDERAEEiAhMRMwQFAiQQUUQlFhIzIz/9oACAEDAQE/AfaPwB7Y+KPZHC0flj3GsLvCbpT/AHFF8bP+oRO43yGBms19WyB7kzSsHlCgtTM0jbypDLQgMUq+rZp3O89JkLWeFRVKXdR7rkEFSpUgM19VHpnO89JkLWeM0VI8Mbaklc/zxAQCrACr3L+gjgc/tRxtZ4QGaT3BnZU05k6/XIIZCH0tYGWROf4UcLWYGaTjtFlaicSdDm0YCpDA+mrEEO7s5rAVFF+3yVqJmyHpDgMAIYCGAPqImb3VgC0ETik+RrPJWolEh6QwOACa1UgEAgEAqVKs39EFpWU2/wDOGdFHMkzY/Kmm9U3zAQCAVIBAKlXC/pImb3bUEO1aIpV/lTztaKae0ST55BAIBUmhAIBV9VpY9rbP7yVGQfxKmf6Te047jfMBAJqpBqA+r00W92Go4lJjbam1DpBR5BAIBAIBDA+qaCTQUUQjbWbVLUybvx5hBNTQgPqGP2m1JpdzfUi7GAgLWn0+zs+cDMuo2t2DzwpUqxSATQgEFX09L+P1f9PJ+XgrV6COvUYEP42GZ/4Gv9KT+Pbpm7m8XvDBaJs2UEcAINXpr00I01iDcD6cZ0WtliYKUkrd++Ppf1Bcwschwnl3u4Bq2poQC2raqyEPpwoIPU7Pji3Gpk2NrAQQQCAQHMIfTBqi0v7egONILU9yFUqQQQQ52rVoH6NoLugo9I7+5MibH45hF+3tTyB77GaQTUPaH0DY3u8BN0bz56TNHGPPaaA3ocKVcSL6wEEFSaU08qwMD50URkNBRQNj8cdq2qs0qzSlidG6iggmnACbxpVwHzYozIaCYwMFDO3F8aUUrIzUnhanWxRvqMWjqYnC7UUgkvb+sSxCdlftVRo4AQCpDF+wPmMaXGgoYhGKxWL4EV5RLWi7Tte2ugn6iR/kqycBQSmJ+4I04bgmmlrIb/5AgE1DN5HEfMAtaeD0x/vgeEuqYwf5T9XI798KVYC0k1fgVKCOx5UMweFLF6bqQCHAfR6WGvyPEoJzwAn6p540qVKkAgoJN4o+VKwxutq/9WIIYpUhgcLQPy9LBvNnwq4lwCM7g40UST2eIQzSDVtTbabCNSNUTzE5TMo7ghwrA4hBD5EMRkKaABQ4yTNj8qSQvNn2qTRgBUmHaVIyxuCjdY2leOFKsDgAq+OExheaCYwMFDjPN6YTnuebPCuYQQGaTHbU9ldhOF94CrgMUgFXwb5tF9BQxemOBeB0VqZ+6aiS42UAqzSrgFSamhAZAVJppUq5AKlXytLBtG48HaloBTnF3lUqzWQFsXpotQC2oNQGKzSpVypAfL0sO47iimyBxoKXUbemqXUl/XIYOGoYIQag1AKlWQhwrgPlxx7zSfIB+A8KScu6b4Qc4CgqVKlXAK8tCGKVKlSriOJ+WMBR/iOltW1Bi2Itr2QE3AwM17RVKvkjDUzAQwQqwcHg1BDgAq9yvg//xAAsEQABBAEDBAICAgEFAAAAAAABAAIDERAEEiATITFQMEAiQTJhIxQVM0JR/9oACAECAQE/Afmr1h9q6RrPKdq/00JrJH/yKa0NFDiVeDwv4q9G/UMYn6qR3hdytLp3A7ieRKOS5Xi1fq5NSxvhSTverxCRY7WeRKJV4tHjfEZH3z2Umqa3wpJ3yec2omdR21RxNjHbiSiVeCVav1cuoaxSTOf5V8GMc801QacR9/3yKPrpJms8qTUOfxtNaXGgtNp+l+R88iUTgq/hHotRPt/EInjaazd4C00Do7JR5HJRzav00r9jC5WiawMWmRuf4WnhMY78bVolFytErcrVq1avNeiK1Ulu2/8AmHiwhmKB0nhQQiIVxOLVolWiVav4qVfelk6bd2CqQN40+nc424dkAB45FFEq04olWr9Vq5N7qH6yE8V+QUTOqaCY3aK5FFEpy3IuRPq9TL02/wB4Kbf7xC0SOpRQNjNjkUSiUSiUfkHoHODRZU0vUdeAqxpo9o3IHkUU5Eon46+5akZvb2UWrp3Tl7HJdS1M/U7Dxxi0+5284BVq1avBKJTiiUT6i1rtJ12WPIUGrk/gSv8AcJYmfl3TNc7UdjxYwyGggK7YCtWi5b11EZEXon1NZ1WnYZCms/Ha/uhEA4EJ2AqUMWxvAuVpxVrcr4H1BU8/T8eUTwKC08e43koolEon1xKm1f6Yib4DOmoMV5KKPCsUqVIhH6dfQc4N8qTWNH8VJM5/lXzDd3ZQsLGUVWSnchwKPoHSsb5KdrWDwn6158IuLvPxAoDBRQKciOVq8n70szYhZUuofJxtXmlavIKhlbK2wjgjFoo+mlkEbbKkkMhs5vFcbUkTpB+HlaXSyyMuTsv9PI00pWdKt37xDIdLLf8A1KsEWMOKJ+M/dc4NFlTSmR14vkDY7IbnnaGlN0Dv2UzTMZ4C2qlS1MDZmFpTCR+LvITm7gtDMW/4nIpyOaxXoiaWon6h/rgAqzFpXv8A6TNJG39IDhaONZp7/wAjfIUTgVNCWd1DN1GIlHgVfotZPf4DiMNYXJmkYONq1atEolTRdN1jwo3CRu0r/hfg4CtHnX2gtVqNg2jzya0lDTtLRaDQOwzfA4tbluTqcKKFxuUrBKxQusbSj6WaURNRcXGzxiidL4UcYY2hzvJKcVatWnjcFG7aaKe2nbgvPC/QPeGCypJDI6zx08XUd3TWBgocL5lEonNp4tMffYpprt8Fq1f0aVc3Gu5U8vUPANJFhaaDtbk1oaKCvF4tblfAopyvNq0RatWrzatEq/sjGr1G47RwZpX2E1oaKCtE4tWrwSt6EiDkXLci5OObVq1avA4X9zVT7BtHnDoy0WVDpy/u5Q6YR9z3Ob4jDkcAouRcrV/CD9+SQMbaZETbz5UUAb3d3KLWk2VuW5WrxfAYccWrW5WrV/EPulSfke63rei9b0Hc6wSjg5tX8YVq/tuT8FHDSgcDAyUUUckq8j7f/8QANxAAAQMBBQYEAwcFAQAAAAAAAQACAxEQEiExUQQTIjJBUCAjUmFxgaEwM0JikcHRBRRAYOFy/9oACAEBAAY/Av8Ab6zSNZ8Vc2SF0rtSr207RuG+iPNBoJNNTXvNHPvO9LVSOkDfqqm9I7Ulb2QNjachdxPeaV3j9Gq7euM0asli5MZGH7RL6rtGt7xRrt6/Rqu1uM0bZgsUQ0igzJVyMfE692LG+bJoMgvMfw+kZIuPguxtJVBi88x7rxuq/wBAzRAO7Z6W2YW4BXGNLj7Ihxq52Y07qdn2V3F+J6JJqbKnAKjRZkrsd4nQIia7U9Kd1ow0fJgLKMxOiN/CnS3NUiaXfBXH3b1endnXTwM4W2NkcMETbWMcIzJQiDr3dnUPG/BtlTkLcRgVvNoj8rQ9VdY0NGg7uSORuDVRUbYYZOU5exW4HKMSfZU7vum/eSfQWXim3MqY2M3gq0NvJ7468Xd3SyHhanSu62AIJt4G6TRCVxq+Rv6DuZ3brruhojBKN3M3NuvwtL5DdaOqutwiGQsrpbG+cNMRN673UzjB8Yr8kDxPLciM/wDqEZY/eIUfWMdLAFQWCMYDq5NY3JooO60OSk3D+AONEJIQY304qap7ZiX3lhlZihQVOSunmdi7ux2eE1lOZ9Pgu9eixWozRnrwRnD37qXvcGtHUoxbJgPWqnw32mlV+ZqiAFCRePc70j2tHuUWwN3h16KsrzTTp4/ZMiOF40qmRuIJaKdw8yVjfiV5YdIf0C8u7GPbNVke5x9zbgsrKWkE5j9FE8dHdvvyHHo3Vc11vpCxNuS6LFypZQ5K+OVUVFUYJklA6hyTZG5Htpkk+Q1Rlk+Q0swVTgsqqlLKqqp1V0ggoncl8XVB7b8cujslcMVPforoG8bdvVFjb3wcqjLtZkeaNCLzyjlFlcgsvn4ANVdkBb8QmhkjHh2gKBkc271DaqscQHgoOcYtRNKFVxwOaEROB5f47UXE0AV1hpE3L3sqVSytnWhR3g3TNXDFNoy84dXfYGdo/wDf8p2ybR93Nh8D0KDXGrDyuCvfjGDu0/2kRwHOf2sGGPgocNE3ynmvUBAhhcR6j9neZyHlP7Iwz4vbg7+VupuXI+7dVUZdn3bD5rvosVgKKtt9kbnNrSoChZtELS5jQgxoo0ZD7R0UgwP0V4jLP8wTZYqF1KsP7J2yP5o+WunZrxxeeUIySGpPhdQ3WjqUImZD6/b3cpBylHYNoq1pOFfwlM/qMHq4wmysPC4VHZDLIcB9UZH/ACGngwQMjDuhmrkbQ1un+DvI8J25fmT9g2webSmPX/qm/p0lSG8Ubuxl7jRozKwwjHKPBI9jcGDFGaVvG7IHorrGho0H+GzaGvMUrfxAKtMexnZ4j5beY6myiutFSozI+7XnGio0U6943EX3r/oFuSDeGaEsho954WdaaoTbU3h6N1V8cT9T07y6Z3T6p+3TU378Yw7ot7J5sxxLig9zAXNy73GZMY2Y3dT/ALh//8QAKhABAAICAQMCBgIDAQAAAAAAAQARECExQVFhIHEwQFCBkbGh8MHR4fH/2gAIAQEAAT8hhBgwyGCcYxl/LkIes9JlIkPQFrBxgwQxGLl4PywlSoQhCVhyPoUqnlt+0v1GjQfjlle9ehX5dIJpdTp+7hlQemI1GKhAQgQl4vIX8oQxUrJlzcuW1H8jLNvB3+cLdDmLsspP5nYYmQzVTli0emiCKwxYvliEPSYvCy4YnzLj3Zci14vyzd2PLHizFp5391bggZM2QZMEIZBFYWOH0vx6lQMkMVlZdCug5Yg/iR+Zd7bxfmdyOtVv23L+b92CH7ekPacvTz85HF8HBWIgipywqVGLFjFl/JmD1glRxxxep+RjO06NYmhA4mrRGK7XLzzq9D3ilv7Ug9AMOMIYCVK9BcUWLF+XIZqVCDh545f5dps1+pz7vWKtwkWgCbX3lzrCBlXpFociHEEkVWAhxkOAYBKgyWKLH5kYMMVhUuahoOng/wBxKycq8xblDb305gmhLtavywUCbl3GJvbsAs93rhWSBiGoZwggSsDLwLF+cIMGER7quOh1f73jKNIHkbYPUnuBQBQaAn2nSG+zLDLw1CW5s048X1yqBfw+vKmBci/QBhRLP+4zrHvVuzxEhg28957Iu+bIuCJ2ZCRKK3VZHUMCWyj1DKRWbjh+eJcIsFX/AGmMoHlCfhigapLHvHEdXqF1gLNN4XIeAojlwhDDNU5eggegJX0WwN/f/Mr+FzoN5i0NQ/b2vrK6B1dx4SqFlorcckUMGoYfQUGLwel+OfJEy6a/YzrJXS0R1arR2ZfbApLjOicfublHf0O2KlSvWoUwQl5IZJcX58lCAL9/ETXlo7HaDggkcnMVeype8hTNUSdPNWRUMGmLm+aECBKlQgPQfOVAg03UH3IFnSs15RzAYI0Nqm07fe8su7snLsKSaFXFSEKduqIaayC+LCYGiZgIECVK+gk2jPXsh3EDxj2Svnp+3mcaZ1KP4mySeLxZ/wCxIbjVtXHSXfLLVvEurDdGgg8UT2CcIZZKZdg+EXGRBiQPoxcRAAopGGmpi7KuEvrwnwja4FK9bgXcmyaiS8vVAJazQ6wj2dK48fbBSr9ABqUlIQQ+lU7YKP8ArcuXi9LHo7jg2uEnA9APiE7Ude7n+IOQzRlx6CEUUH6HUCcuIEoJWv8AA9b7doqIq4YNMo91A5OXUp0Sv8kEoH5VyGkW5xgghGLF9ITh9AvCTuHVL0u/1FqLoOh9pd4Emq1BHCoF7L7Mu5YfvTd2AOJeHCaMeRixwuEH0Jfid2whPBoWIPuv5Med4LpbLvmWWoMW+odaaeJWERumKnfRHXRLmFLhi3iYLJTFTmMfSA9avB8vtcXFyo3t9PSR60fvG2NaJl9/aM6ofaeYd5fR/wCwLDtwr2dF1C6a+GXF0i+wIGqIvf4l4dN08nhwWILwGo9RcVKwCGQ+Meo+AuXjqLtEo/QO0Xe5VtRx49nmDqs6qS7SR50QcbdOScPz1lBVVoo5Y4G++o5dpq8L48w6rWdZf5luthrrUXzFztAXT2igO5N6LQB3Dr7n6hIIKLE6zfFolYjgMH0GQ9R8qAstqy/A1dsjuDbaNMf700o3EUzls9sjcrV13drzHdAB0/d0QCeHuH5iRGlXy/zChRqXiRr0Nq9+z4eIu7Zfceo+YNNCD9cZvX/I+8ME4xIS4ODhgIEEPTXoD0nxTBCtXpGLOF/ZluI/AhCbbq9R93R1KAHMp8pd6cLRe5UHDf6Ihibra9+3ESLjmVFHqDpr+H96f+QQa3XqfB+vuxau/pf+JDSThTv39n0FzCCECEIYPgEXLyYPh2rsy6sJup3BnMOY2A5TYl1y3MVeJ8nZNiFLs/jiLeSHopolURBHSMO2cna/4/XtNW+8ngxKDTacdp7c/mEEFFidc0iYjlcGDFCHxCHpPSRnFwarp7yjAX1mogDsRDC9QT1NAXApUa0j9oUIlB0zUqEMSWTXh7UQeq6JOjBanC9T+6Yo4fLjyveK7T3zx+0WCJKhCXgyXx1ZIZYQ4jirQ77/AKjqX2rOcdk8S91KJOlNX2hv9x7u8rDCBDCesQFwq2f8b4mu0H8b7MA/R9x/pl0oUCEqEV6QggQfFMRkxccKBnEd3aKfz7A7QKpB0nPfBAqFXxFTNna+IDCuBAjKjAQwIQgyQSsKxhNuzsx0wG+Kf9JRFvQ0nb+b/MCDBWTgYpFfGJeRDDgRZbTpN6K6/wA8Nbh3hvQtdE5LA058HmKLU0Lg95UwehRgIYIMLXF4DE3BAgZKskHqq4uAVVilrEySGEQfIj0DLlxxzaur+1Y93RKJCdoDnk6o6feU7hbeV5Y4uj0Mlk3wKehCiCBCBCDEkYYrAPkzJgxUvPp3UnQTa9bmld1fuLt0iqBzXT7+xEhPS/ShhDpA3kDXojqJqWeoMBAggZqCMPkgyekgSp0veju6Ep0ieAfRYoWx5DxAlIjTi+YPEghNTlAY4JWFYDKuE0wmBUrIYqVBkRRfKHohqC4Xc0/7/t/mACqhiOkolSokqMXcJLYjgcECEBKwQh6RKgSsD5AyYMV9BBDKhQbiTjCKpeBDrEYGIJWHB6ySpUCV8b//2gAMAwEAAgADAAAAEH2HUWVRt01vusrnCqQdyy4N9XeYWWL2cdbhqRx0hGkn/wAs0nkte+AQgaKPE2wWfkGt2j1Y/JJpId4PnLAe3/kikDJPKyX9pQNglIi9KcD3LyLIV2KB7QVOhQZHc7sQaly8r7/4D4Qydu2J49xjIXy8xb5zVpyBHOglgjzzstSQq/p8m8/zqMBYezDcRwhuKVZtACMCW0WTFLAy1sZGYTVrfsdgKP3Q3F7rKImyM8xCB83o55LZ6wGYu5RdeI7Lp6AMoRWg4CLzuePJ7M55rLG3M4oebZO68kG2S/DT0p3Th/cUmwbUm7g/skONjaEm2qCyavWvb6KYFW2AmKms78tEtYtZbdAacIzaL9b6iRIf5emPy+0ABiRvgoxTAR8dgDbD5plFyEogUtcBEv8Am8krr0HX0PRe1t89izE+0Gjz8jUaolnmsk5yyiks1bZKkkNqS2w52KAqkjWVytEkmiuysoYxLaGX0Y/4aHqrhKS5MZ6YkkkmhsqzkkkQOp9gfQRBkAFYPmxJR4kkkkkb4Epj1ujAAUPLDQOrC6wQNRtM+AkkkkQzNwgHiYE28zo6YUo8csVUJJ3iREkkkCxdyIQYPqE2UUYrF8dAbxwpfhiBMkkk3+ww3QnxeW+y7PLTznY8DudN8XMMgHkrSWzu++IgiYVZqRZkUV/WYn7Xgnkk6khawJJQuMXP3iflDG6A+EBhYBPQQMn6A26DRwYBa/r+b/imdAcuoISNcLhqkgMkLg10wsUTJlq2+UaWXKVLueOM9rmmkkkncCt+MbCVspCfTY5xK9Il1hvLkmskmkHxIQqM7/EQmpcQNRUuLuw2WZXkoEm00oQG6Df4BzRLB39WcnufoYWtzmwfMmm2AKgGyksQOV3Rqr9fM2DZszWWBkgkkkkXW3qeeGsg2eGFYhkGJlRzvk65Ekkkkky+Ti1yD25a5AtyDMXfugXkmYkkkkkkkcL9pZf+MoG7i7OqkFJtorQTzkkkkkkkmCfngR+ZIUUu06s8RU1hhMJikkkkkkktGftSppknhiZ/VhReALFkhOoQkkkkkkInvAZg3jSpMLQ+AHeigckkv8Mmkkkkk//EACkRAAMAAgIBAwQBBQEAAAAAAAABERAhIDFBMFFhgaGx0XFAkeHw8cH/2gAIAQMBAT8QzRCdQmJkEkQsUuLxmLCjE5lBeiWKL0UTEwjQsExOi6GUXXF0XgPKxvitnR2LYmdjYniwTJiZIaEuE4I160SVh/H7NRZ+7H0ZQkJa4KGsEtEEFmjGxsvClKUTwhiJBZWh0QnlEEsJiylw2Mi+Tc7v/fBHEiAKv8ft8UhBCQlw6BojCQWIQbKP0IQgtkOxcJwQhEFhdCQuO+0fP6OiV+7E4hdiO6EX3/6TigooFQsZLCDRCEy+SylntYpRP0Esp4lEsLC24j2I+/8AY6tv3feE/Yttll2Nb09hMeFgWJUTJSIIXBvDLg2UfJCOspHWEXKEI7wkISFlZWkJNf2aLiUXtE1YaBrBD6wlj0ExLBBLCFijeG9FxOE4pZuKMWi0vG4Qg2EbxNe5tJX7sh2GNCd+BFGIkL0vPkhDoSEqJYEhBBBCEELDZRso+FFzomJEEPQxEEoXFELMCR8L/Ikkdis0uhLinsEKC8fIw0LQ0I8WEiFggihJmlGylLi5XGlEd8FjvhcIQtCYhEl+u3/H+X9qQb1E98kPpiGyF1rJ9xhDYhGNfEK3AmFkuDZdYReK4dYSFiUhcI6LwTwsLDae/wAPH7+olBtzJtNDYnv9g7SmEJCELDDEs1QXCsnil9FsuEMTEUhBaLcrZBawnjwRvDz/AB/nr6iC9mLYugo+A4ANa2UI7EKGjhCgo4JEy8P04QSIPsRJwb4rEZsTw3z34eBI0tLBT4/Hwyg9h7G7ZRYQhI0DBBGWCcEuLw2T0FyeE8JCWUjo7E0XFx2fS2//ABEp22Ik9D6Hle/Aj+D7kIQRBeBchYhZUQuNG/QWJvmsIuhDwsdkGsdiYldjFBfr8sSJMFsm+hzT0hqMgkQhMGEuSSEhYgkJcExvC9KE49Y6WFopKJQhDdlV5XwN7F8eUN4OZJKtil8j7EZ2LhbvIO9saJw0EHMcsSCCRCei+Gxems74rCwkpK5Jr2ur+xZlWn2ot/v8lYz+C/2d19RIRbpt9/7rwQREkJUug13YyRYJUiUGLHiFgWsEhejcLM9FcfOUxDwh6YwnUSjvappVPaHoLfa8X4+DvRev74oZdHR9LoT2JkpI2wVIIFAvWF6lwli4uVrPkQ1mxv8Aq+P4939P4SSKWD2MO00ntlpWKGjIrXBYYb0pl8exC5z0khjcP0n7/QhaRDY0JoVbQlZaD8CgQ0HrOovDobomUIr1BeKzRCxSiKJ4oncvDSFY1t4vv+jru/fyQQmIaF2N4IHHQ3rif6KI6GrHO/B9D1hCVFgvQby+D40sxOMxZ2drv6Hiv3fj9nlf+vgTRi+BvCFQ2EniC0hCNhuPIuhyyD5DwSEEsF1xvrJCR3yQkeHnlibSv3ZTR2JUTQQ0FoXyXL4ErcI04zsfhRjXg0wJXCkF1mDwpTCwXFcHyWeuKz1l4v4oIJJESCeLRKjZONFeJN4b+4p6jzap+z7KvP8Ab9D1P+HhlPb70/8AwbORtC40JzBNcFobEdBdZeEuEF6DFyRRA7GQL6kNxKD2yknoa80HZ10vktdv8iiPaH2HhmKH1PleRluhl4ifq84J4bMokIJcZwhMUvFcZwY0XYir7CEhPwNBMpdbIpbf75La0XwbPBMEEsL/AAvr4f8AkWPoDMn9UXU68YlINzKCQsJCWE56NGy5hMpTKFwR+Ji6Eh0SwhLYzNtaL6Ti+C0kEIQWBYqQdc0+6/wdBkzWrtCeMIMMaF4KLIXoLhOEwkQgsJEPZt9xItIYmM6O9Y/tTbHr7HiEEhBBCjFWBFkNDRTf+plS/qK8CzqUWSGKUTyYb0kpwj4IRMJYm/C7EpGkJ3FGyT7xjKEwiCQlhLJSyG2E4m6NoxbFhNwIJCwIJeiniiEIayhlySQUSQkIbRsU9lj1iWJrBLCKJiYtFwJJCSwfo+inxkKUSEokXBCCwUJ6SxM0QohcHv5BMfL7xTwPV2MrV1+R8ZWNEIJCvGCwlFgpghD3MYWntCQkSgkTCQwRSL1ITC5LNEe4f4I28NJC4W39mMq1GEEosoUsOhhiLiwpCEEkhIWU1BieIIQ9ZMvBbysJEIe3K/JCUWxl2zyK8x/gRwohIhEJbySEzQmi5DBEQQSgkIJwYagmL+gMWijwniYQkQetRmup3PwIuoObtMrBChoSNjCSD2JYkEqIyIIpEJMghZQg0JhMTE/6ClxRFwgtISsZt835xXDckQaPI+sJluNIJCaOsIJCEwlhLhBMEEhevcIRBZQp2G0XBSCmNUxo0FvCiEdMUEhbEpgSEg1hIXKDQgkJT1v/xAApEQEBAQACAgECBQUBAQAAAAABABEQISAxQTBRQGGhsdFxgZHB8OHx/9oACAECAQE/EA2zjLJJvXJEEEQ4PwJL5LznPx4MMMM8PBLOpj1y8M8ZZBBBHr8Gy2274NtsPkl7jkC9qG3I+xwgI42Uzp4L3Dbw2WZsssggiH198H1P0Q8es3X8rrOp/wB8yNq22gfv/B47wK23OJm8CbbbwPARHO/SbPDYbZeV43l4756Xs/8AfN7Fw+xYtfiOQ/2Pz+fXGx4gxZq52HhvIQ4OByeO22cPhvO28ZzvKWSBq3T9n9LoF19iLD5g/EmJz5/tZj2+88HGUspteBjNmbctjuIIizgYbedjgeM5PBs43y22DjpDtke09s5XLNG3Yu18/wAS+X2nqWWW22Z4DYIIIPE8S2J8N465ySeV5TgXt3dDuFswZFiwTrKlexn5W287ySymLPK8ZBCCPELJjrgPLOAs5ecsnjbbbt+39rR142D7y5AlebNsn38fbgPA2yzl2ertKWWeTLIIIPE8sstvjk52zjPFsmbOPfo/q/wfrl2g9p9dQi19pnDs/Hu/pJPqSXPMasa1rwBZwCzwzgILNg5Hfr5w+Dqnr93z/H9pbSD3euWMEnnQ+8pDu8MzCWczwnitbq+GQWcByZwcZZ4B4FsH00sstH5fH9f/AD3LL7XpENl+0AgNwZZwzw5eIBrrw3neCI8Mg43keFtjnbfpZZZD8N+75lg33CZf5fzJz6IAHxHLMpXRKfAB9Asg+k8D4t8cbb5By3pfbo/mW7GE0MIj8fmffL+kW22yy8SNSzwE+WQ8ngs4XLbPPOM4PANjrhmCdEiv18S8Cb7D3Fs9vANtttvEXTmFl5HJfFgQcnG8nVtt7jqY65HfMt4Mgsfhv8knw8bkQVepV8D9Zs2DL1MHoy9ch4yjwBFzGy+bbweWeSTzl1weAcsxA3c7h/1MRJnrt/4lzJ+bc/yRvpfeHr/v62zBzgEg9T7lOJuEUMHGrLs/S7+mtscZxmwSTHl8WTE7hyL8+fZ7mfgPT+X53R3kMZhw937ZJLc8CLtW7Xh/CngbL1wO85ZHAWckvAhOf+H5v+v+1F14L2Qul+QyyeC4MbWXgjhJJPwG2+BYyWZHBDxlnIxbbYmtjv8Ak/iRKvfgupugsFPmaskeuKl4IgcjxB+APBmWcZZBZ9DIbVkJnZvd+vtw9+A5Hd/dI4+pEbbuQmfcQRwyTJfwhn1vSherrF50nte287ls8k46fF0dz1wXfANLKYjg4Me5fJln0dtt4PpbfMX4JDtw+1t8cbY4HcmzMevm6Gx2cYWh/wD7weLcmvYdwXqG222WZ8D6nxznJ5rqc+G7bVhx6ZetsJpaQqPk/acN2+Mx9+/6XqP8WDTP9vtxlnt7/J/7+P6BXoZ65DdmyySyGGXkvgcbzvmcHPUPk6bolS9fHDi9wcfM6dwbdpk9haT0/wBO5rT2AdBZkX9pt+z8P9raLOhP9n5PsjUfUjp/R/7/AL/MpShk4JwSTjbSWfo7bHlkE8lngAV9T5np6/m22S04ZZKa9LuezAQcbw7TMg/uH3P5PZ/iZB9M0D2emHb5PfII7g5Fm2ec+jkHhsc7zkdcbbx+6f4ngMJ5OADZamv5wYQcLMYc7oY2l7H6P/v73zlLH8lns3ko4MmSySyfFtsfQe48Nth5WV9yX6Tq6wQRBKdEcHsicOoh4bbbwZzMYEeiGO6xP8iQjgt6tmyySySSfEbfobwS8jDPGo+X0TD2MxZHVqfbBvCZZeCy8gx4Ryl4Lj02zjeGwc9Syy+GWWfQZh8CIJZbaTmfcXTDr5ig4Sw2xF4eWfMLbGITvzYPntCpZZYYhl4Nbv0Ms8s5Ak5JgL6Jen0euPd84ToOizZ+/j8rDOEzYm8hu0smXFTNtmF2ae+d5EeQ38Klk8H1dh9H6w2R9pTLh+pZ5wjgL3w6xwwjHBrwPA0ltmMeDUMuFtn8GPFbeNvvq/Sx9sA6dhPQXZELaxN6mbZQ9cFFnyDWLLLLyXrgHZNmfw28NssqfxB9t+h/eX2/Yi5dljg8Q8NJkfALdJup4mbLPkT4SSz62eBznDwsLo/A+Pzu/ILvbbDwOwTMzgcyt4YzeXzURm2/WPotl6Q7jguEJYeDGCzwSl5FW8Lhnz22H6//xAAnEAEAAgICAgICAwADAQAAAAABABEhMRBBUWFxgSCRMKGxwdHw4f/aAAgBAQABPxC2JlBL4sxx8ApgIMpux1ERdxmuAzCVKmp1OuAlSoSqhCEqBBDmGJAxCahgl3waqdzqYlPqCRLJbKpvKuETFhQNuIYSptCFloXiMHAh4uMuLh56hycHAQiSvwIOBwWu5rBcBUqoMMtl4nsixcTCMaMsP0gy/RLS4pVHqh/wQHKKHM8Ob+ywZuV84lFY9w3eIZcOGUwsxLrFZTOOLcfmlU0xPCWR95iZYtRgeKgQhwEDkgQ7lQJUeWriBcIFAqGo4OJcRH5g3GkOsNMxsd3hdH236l5cx3z/AB9VGgo2kq/+9yhHi0mSiye1QlwFQY4q2ZYz1x6yzCXqUaRswFamJCvHRChEjruPURjweJWIk7hKlcdQODg5CVK3ByBKxKzOptBxGLnghtAknigi/QfVsY1dvbHjY/5GcQ5cMoh6802EsaKwCbA7a8p8Fy1gk1FmTHS6nqlRqXdT0ygg1BcsI4VN9So4LUKOPBlQh74BKzKgSoFcEJiHAQJpPhwkuKLFSoQFEvHElWCtGgJXuMW4vvX9XGgYqWQ/LbFJcld7hkA8soL2LxuINdBbc9bP/rqANGp5/b48EMKrgFy5mCNQRwSs7YMqhNYpUyhlqUOYeJuhDElQhMSuCVwQIHcz+HhB6ivECEYjDcylkKRYmYskuDnn+no+6mUB5H6V5+W2D22AO4YP2RC8/Us6/IhMqTrHyuiAnqtNDWh6P7/yg4dSs8ARJeMmGGYYYwPuPMRUEjG3ncOIqw5CE+uO+DXBDcPyJcWYoa4OB8V2blW1dkK8ej2/QxNHGFFP2f49RFZb9wqcEyGvcpTDpe0bXeGIMs81GGBqX9+Ja9BF1GvbnLMVyiFkqyMvDVmGiWvJimYoDxKMzAi1Em3PCrjqVUKj8zuEIy/xNfgsuHBOocHljIUwtDaXzKExlzbv2+f08xU8rYKe2LsrALILP6DzPlaYy/cQqfFSf7MoEE2McB+i0folIE6k83WX0wrVY3KrmUqETuDPEiyqM2CmCYuFa1LzBB1K02zbw2Tc6gwYzqH4Gp98kJ3+XXNwvzGyrcKptF6LKU9d9UQpVV7h9AgKlni4Qg0CGbOmDI8MA9RQbUwPZO2BgZuaRKfLoPmWQ1OYhqlS6UtvmjERUWZcVBWJpwRZV1LViKxPEc6jPUp3MMp4j+ZhHGo9suXcGXu51Dg4OCViGeA4PcxO/wAji4blIT5x+544Aaaf7H+qlh53L36hOvI99kuRUo/tFYmFuyUAkOBodTf648QGs6wLasDox/vG8sh1FcN9SpCi7qCmoB1PXBhnUpKJRCUstluLl2S4TPFwccnITrgPxXhhOp3Bjgw4AESubJZ/Qf2kYZsu4j829vRKlEG1IxCCADQ8j4iP3IH+kU5OwfRixrvxiawfkH0RWcbRQLZhl7TKo8RFOpeanrgkKr8AENcP4HAcXwQgSpUCVx55J3LnXJ+AwbllWoAWr1HrlUdAc/Zz8VAYQK18HcwrezzFqAUq/MtmE+C9npqk+PEbWLYrQgvkt6mHAMKtaKzwrHBzOipe8JRjpTLuoR1CIASw4DBArgQKlYmNwUiwlcHHmEN8HO0eTmuOo8GYstnrgmQPTTTp+zR9+ItxONeoGVYz2wKkm3OVuvSV/cxC9jGVJNmkgfsEtkOCValaY9/0RyR4FXqBtlzNfED1Kpj1KJiY/AeoMco7lAl0XghC4EODUCEMXL/O8Q5udQhEjB4AMuXldD2sarSF2OsegiV5K1U0Hlq9xeXo3AdgAnxYPkGKiIQaWtPstv1KVi+ouoi3XAEMEh1CRi1xUHFg4WiSj8FFZb+BAhDk1x1Dg4qp5/JlLLBBgWrBd4TZ/fhGOCax9kdiZg9I6XhaLQf/AH1Gi7Mb/wC3+fuFnsdsvfQvzL6L8ZnmcxEC/AWtYeG731ACAAKAMEvtqbS1LBqIbIt6iRTBVhmHMqJXxYJSU/IZ1yQhCEN8EITz+JyS4pxcUrgwUxKMV0d5iX5Nn/2EVBtV3yIsOsmHpLgK2JE85Y+iJwKjgsEaA9LbemtRC8Sh/BUuvcastj1K3Oi8dRwbK5RCl/OvuUFAHgKP8huKtE8SGskAajYcR1xAnUM2f1CMEI4GyUfwjDjEqUwhCVCHPTBK4vgjOp1xqXczBplDAgw9QGEdjFnKSNB0njRkmzq6q5umh3Lo7DKAtt+rmNKdvqW5sMy4sI+kjtFgrbYKimYaNFIV/d/cWZilzKM1MtRRpjtJj1AOoB1BRHmbR/xEMwhOuCEITrj75oPwvi/wYyrYDE6juwu2Bwg/+nzFdNr3K3OzgRJTY+Tr7gmWfdHZCr2ljflBPIqbtEF9ZDEVl1hvcCAxcSl1KSARCopUUWYfmD5ln8NQ5OA4Ic4qD+Oody8QZcshEmXCe/rKB8stY8tFfF6e3PxEqBartiK1EhbIeqLmGDZRjV9t/r9xWaGg1XklIMxbp3b9UfUqc6hB1FF8Uw4LIKiqYJXDgW9xZbFZ/CQg8EOCMvg3zcZfFwZcWDDtBuFXXUD8XuHhEotN+Nv9SuNNq+iMfcUnbLRzL2Yq4BRbdwMlkXpf80fqJp3FYCoa73Mt1xWgtBYOCj6iWO5bTg3VBMCKiZIuNhjWd0NcV/BmEPXA9cGp1Djrj44HHFy5cvMGXCGKtWhb63BSMxT+xz/U8Q3pg/8AGqj1G2sf9ytgIJWoa1awdKboah5ZkXmNhtq6gqFMBkJmAEpTbIX1fjplxA90Jkyez2J5EsiiL0xLviGmWLI4CwUmRcGIODhmTwUQQQcrUYtmnBxc7lwzCVidcY4Nfwo6DRn/AMx5YH2jMoPfa+2KlfawyqVnSxm0eAgoJsunKXwukLXH6A/vYLF701oRzHqvT5I+fS2YLWr+5nIZfBdYjcUVVJHbqRwyUiJnrMMtqmQ3t8+SUAD0afaHScKmYpRtgjZG5I3NYycEdQcXw6iy4Zg1DUNfgQ4V+OUYfhcJoX4b6Y/76jyctBo6B4lnivYQw5eiWxu1Zb6hQLFXWfhgdyyGiaq5NSptTPzEgl/0MS17TYo6muWAbHpGANMCADTfCL0eYudFQshFJkCVnq9MFoU2FyUDgUMDWaMSgnmVN6TLYtIXs8ywVEx6nUvTuhVe6M43YwgwealrA6R8RRq4BSaSmFoBAYhAhDBBU7w1GVKgQYzAxuBidSuCEJWJX4E6nmLF4ueJ+5j/AJfUfiys4/73axqy7hlWNC7RyV+4IKtslu6s/uXVGTIxu3Tuo1Ors7IHaFUUBfWXBDRmiEj0q0+CJhi1gWqFgPNw3n3SfFqyZAVG6vFpamiQaAoIeRlzcVKd0WCPqLXzfUBd3BKCoDwRH96RhpkMDAmd+e4egRX1nfhc/QzRwUbh4DqY98dqixY4wckeoHRCVKhFEo4wSo1FhMIQZ5mIQ7hNcMeGhIeoBtY/CU031/1HR9xbTMqcu7NsJpFZeGCSjc5auIwY/pjPXyHuIhvSmceEZwpGjfFg/vEKCpS/mNH0RRV4iLuC3ARLEQeNk4AoGxg/SqOqaYWVQI0s3OkV8Kks88zanD7VNX9oyx5TUYWH0ZPs6lEFES5hFZmy0lE1rgMrzX8HRERi4QTuaRYQhi5eIvFRICtEOwWzcdFvB37x1Ea5tFEGl5SXb8Re6vEOlM7nV1UVijkWr9RJHgUxNKNVjOYuLgPsnaK/pEytgwgvXJNjUMtRNCJblQWI7EggZ/hTK3z0vcKQhne/c8+XyN4c6dHBstgd/wDRh+1IWB0j4gxKxLJtmDMXAaJXhpgsVk0/gGXiHHtMItwnXAxAxGOoMNkIDURAa9mU7e/H78ShO1pS1VyxAlFBUFAf8TMPiHaBAlrwRH0rTotY7yfuKaaooDJdLzv3bKgehoHqJEg258YczXgRIU0aQPETAnY6O10j/wCphElp4z36H+inUaJ/HxPgGiOk9MvnWnBXq99vHwniBUsqoBIE2xCxwXmW3HuCxvA/4SEGDBgmUnHtw+omL4hmEMcCpfsfT/5LulM7i2OpS1LepeQZgT4I8FJblW0rurfr3K1R6aU2vbARwRZhthQ3qHjHlHBT1MHAwYBqs0u/Y78YZbKUdva/s1dJtjjQAWBWFa6bH3nbL7mruk0+zT7iuGFp6JUJqK5UBiLylH8BUOLhxp3AckSBBGOEVsAsrFHZnoHtjpcq+oiGQMsUKZXcJewgwdeHAv2xEprNlOrna1rNRrw4NHy+X3MdwQSRN1KYcwFRZqU6mbiXsxcBkBWo2NR34wwDXu8P040YVwFGV38nnF7GB+vSxNLbWQU6YeI8DSMTPCRd1PXBIAP4RhDWZ3CfOYQuVF3FiKdRS8xmU2KAbY0UMjs8/bDFquOsrjIooA7jfHPFauqgzs/AwpRt07VHtMV4vzCbIsGH0RdxQqZJ6ZcaiqsIi1ESCJdjXxrSk4V4G3UPndE3VoYtK3eoVDIHJC6L8Fv7ZXxAGBUQrXCqz1z1wCAH8h4hCHBYLBmCEaRy8zvwyMB17D+36jdWP8J6TLjoABaszbLUdZB5Wb8e4scGky608qxHqUOSF04F4gNSp1ANVEPBGSwjNJLiUxL1KXBaTZjhu4KkGoOAXC/CZ1/MMHi4TSEqCAyxG44Q21oLdMX8uiEGcKIGaTySpP57oF+AMK3nqYALQfoM/wBjG7ZxjD0NPvfxCdwXMHKpRGsNwyBUrPEoC2JZupX1L+pT1OqohOiYuM6lYjuNphgqKoiVhr+YZSDGKDCViE3lpBrUISz264D5YKF1GYNausUdEv6MPYNtQ9325+Jc5wNXCnzCbJpqOMQJbpL2gCAOYzaVYXXjoISNwkPFAOoPiV9QMPCCaTSdSkpMEOXh5iBX84MGDdwfMIOY5cILlEDQy4hKCxcD6C6O30zTlAPEC8EHxAdIl2ph1CRqUtIQGVYRzFyxLiVkFsKsyg43zPMcR3ACHMMOPwSypjY5szwoQZmn8twgwXDc7/AwiVE0iM3ZCvUGrgIjCQcCMwUyVjhqKWDLmFBhVBUF1AZQgSBiDHBghr8QSJgCBUAfzf/Z";let U=class extends l{constructor(){super(...arguments),this._refImage=I(),this._boundVisibilityHandler=this._visibilityHandler.bind(this),this._mediaLoadedInfo=null}async play(){this._cachedValueController?.startTimer()}async pause(){this._cachedValueController?.stopTimer()}async mute(){}async unmute(){}isMuted(){return!0}async seek(A){}async setControls(A){}isPaused(){return!this._cachedValueController?.hasTimer()}async getScreenshotURL(){return this._cachedValueController?.value??null}_getCameraEntity(){return(this.cameraConfig?.camera_entity||this.cameraConfig?.webrtc_card?.entity)??null}shouldUpdate(A){if(!this.hass||"visible"!==document.visibilityState)return!1;const e=this._getRelevantEntityForMode(this._resolveMode(this.imageConfig?.mode));return!A.has("hass")||1!=A.size||!e||(n(this.hass,A.get("hass"),[e])?(this._cachedValueController?.clearValue(),!0):!this.hasUpdated)}willUpdate(A){A.has("imageConfig")&&(this._cachedValueController&&this._cachedValueController.removeController(),this.imageConfig&&(this._cachedValueController=new p(this,this.imageConfig.refresh_seconds,this._getImageSource.bind(this),(()=>E(this)),(()=>u(this)))));const e=this._getRelevantEntityForMode(this._resolveMode(this.imageConfig?.mode));(A.has("cameraConfig")||A.has("view")||e&&!this._getAcceptableState(e))&&this._cachedValueController?.clearValue(),this._cachedValueController?.value||this._cachedValueController?.updateValue()}_getAcceptableState(A){const e=(A?this.hass?.states[A]:null)??null;return this.hass&&this.hass.connected&&e&&Date.now()-Date.parse(e.last_updated)<3e5?e:null}connectedCallback(){super.connectedCallback(),document.addEventListener("visibilitychange",this._boundVisibilityHandler),this._cachedValueController?.startTimer()}disconnectedCallback(){this._cachedValueController?.stopTimer(),document.removeEventListener("visibilitychange",this._boundVisibilityHandler),super.disconnectedCallback()}_visibilityHandler(){this._refImage.value&&("hidden"===document.visibilityState?(this._cachedValueController?.stopTimer(),this._cachedValueController?.clearValue(),this._forceSafeImage()):(this._cachedValueController?.startTimer(),this.requestUpdate()))}_buildImageURL(A){return A.searchParams.append("_t",String(Date.now())),A.toString()}_addQueryParametersToURL(A,e){if(e){const t=new URLSearchParams(e);for(const[e,i]of t.entries())A.searchParams.append(e,i)}return A}_getRelevantEntityForMode(A){return"camera"===A?this._getCameraEntity():"entity"===A?this.imageConfig?.entity??null:null}_resolveMode(A){if(!A)return"screensaver";if("auto"!==A)return A;const e=this._getCameraEntity();return this.imageConfig?.entity?"entity":this.imageConfig?.url?"url":e?"camera":"screensaver"}_getImageSource(){const A=this._resolveMode(this.imageConfig?.mode);if(this.hass&&"camera"===A){const A=this._getAcceptableState(this._getCameraEntity());if(A?.attributes.entity_picture){const e=new URL(A.attributes.entity_picture,document.baseURI);return this._addQueryParametersToURL(e,this.imageConfig?.entity_parameters),this._buildImageURL(e)}}if(this.hass&&"entity"===A&&this.imageConfig?.entity){const A=this._getAcceptableState(this.imageConfig?.entity);if(A?.attributes.entity_picture){const e=new URL(A.attributes.entity_picture,document.baseURI);return this._addQueryParametersToURL(e,this.imageConfig?.entity_parameters),this._buildImageURL(e)}}return"url"===A&&this.imageConfig?.url?this._buildImageURL(new URL(this.imageConfig.url,document.baseURI)):k}_forceSafeImage(A){this._refImage.value&&(this._refImage.value.src=!A&&this.imageConfig?.url?this.imageConfig.url:k)}render(){const A=this._cachedValueController?.value;return A?m` + {const e=Q(A,{player:this,capabilities:{supportsPause:!!this.imageConfig?.refresh_seconds}});e&&!M(this._mediaLoadedInfo,e)&&(this._mediaLoadedInfo=e,B(this,e))}} + @error=${()=>{const A=this._resolveMode(this.imageConfig?.mode);"camera"===A||"entity"===A?this._forceSafeImage(!0):"url"===A&&d(this,b("error.image_load_error"),{context:this.imageConfig})}} + /> + `:m``}static get styles(){return L(':host {\n background-color: var(--primary-background-color);\n background-position: center;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJjYW1lcmEtaXJpcy5zdmciCiAgIGlkPSJzdmc0IgogICB2ZXJzaW9uPSIxLjEiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjYjkzZTNlIgogICAgIGJvcmRlcmNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcm9wYWNpdHk9IjAuMjUiCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuNjA3ODQzMTQiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyNi42MjUwNiIKICAgICBpbmtzY2FwZTpjeD0iLTEuOTM0MjY4IgogICAgIGlua3NjYXBlOmN5PSIxNS42ODA3MTYiCiAgICAgaW5rc2NhcGU6d2luZG93LXdpZHRoPSIzODQwIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjE1MjciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEwODAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjIyNyIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiIC8+CiAgPGcKICAgICBpZD0iZzExMTkiCiAgICAgc3R5bGU9ImZpbGwtb3BhY2l0eTowLjA1O2ZpbGw6I2ZmZmZmZiI+CiAgICA8Y2lyY2xlCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eTowLjA1O3N0cm9rZS13aWR0aDoxLjM5NzI5IgogICAgICAgaWQ9InBhdGgxNzAiCiAgICAgICBjeD0iMTIiCiAgICAgICBjeT0iMTIiCiAgICAgICBpbmtzY2FwZTpsYWJlbD0iV2hpdGUgQmFja2dyb3VuZCIKICAgICAgIHI9IjExLjI1IiAvPgogICAgPHBhdGgKICAgICAgIGQ9Ik0gMTMuNzMwMDAxLDE1IDkuODMwMDAwMywyMS43NiBDIDEwLjUzLDIxLjkxIDExLjI1LDIyIDEyLDIyIGMgMi40MDAwMDEsMCA0LjYsLTAuODUgNi4zMiwtMi4yNSBMIDE0LjY2MDAwMSwxMy40IE0gMi40NjAwMDAzLDE1IGMgMC45MiwyLjkyIDMuMTUsNS4yNiA1Ljk5LDYuMzQgTCAxMi4xMiwxNSBtIC0zLjU3OTk5OTcsLTMgLTMuOSwtNi43NDk5OTk2IGMgLTEuNjQsMS43NDk5OTkgLTIuNjQsNC4xMzk5OTkzIC0yLjY0LDYuNzQ5OTk5NiAwLDAuNjggMC4wNywxLjM1IDAuMiwyIGggNy40OSBNIDIxLjgsOS45OTk5OTk3IEggMTQuMzEwMDAxIEwgMTQuNjAwMDAxLDEwLjUgMTkuMzYsMTguNzUgQyAyMSwxNi45NyAyMiwxNC42IDIyLDEyIDIyLDExLjMxIDIxLjkzLDEwLjY0IDIxLjgsOS45OTk5OTk3IG0gLTAuMjYsLTEgQyAyMC42Miw2LjA3MDAwMDUgMTguMzksMy43NDAwMDAyIDE1LjU1MDAwMSwyLjY2MDAwMDIgTCAxMS44OCw4Ljk5OTk5OTcgTSA5LjQwMDAwMDMsMTAuNSAxNC4xNzAwMDEsMi4yNDAwMDAyIGMgLTAuNywtMC4xNSAtMS40MjAwMDEsLTAuMjQgLTIuMTcwMDAxLC0wLjI0IC0yLjM5OTk5OTcsMCAtNC41OTk5OTk3LDAuODQgLTYuMzE5OTk5NywyLjI1MDAwMDMgbCAzLjY2LDYuMzQ5OTk5NSB6IgogICAgICAgaWQ9InBhdGgyIgogICAgICAgaW5rc2NhcGU6bGFiZWw9IklyaXMiCiAgICAgICBzdHlsZT0iZmlsbC1vcGFjaXR5OjAuMDU7ZmlsbDojZmZmZmZmIiAvPgogIDwvZz4KPC9zdmc+Cg==");\n background-size: 10%;\n background-position: center;\n}\n\nimg {\n width: 100%;\n height: 100%;\n display: block;\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}')}};c([s({attribute:!1})],U.prototype,"hass",void 0),c([s({attribute:!1})],U.prototype,"view",void 0),c([s({attribute:!1})],U.prototype,"cameraConfig",void 0),c([s({attribute:!1})],U.prototype,"cameraManager",void 0),c([s({attribute:!1,hasChanged:h})],U.prototype,"imageConfig",void 0),U=c([C("frigate-card-image")],U);export{U as FrigateCardImage}; diff --git a/config/www/community/frigate-hass-card/image-1e2a0a79.js.gz b/config/www/community/frigate-hass-card/image-1e2a0a79.js.gz new file mode 100644 index 00000000..36073fa2 Binary files /dev/null and b/config/www/community/frigate-hass-card/image-1e2a0a79.js.gz differ diff --git a/config/www/community/frigate-hass-card/image-5371a090.js b/config/www/community/frigate-hass-card/image-5371a090.js new file mode 100644 index 00000000..42ad70b0 --- /dev/null +++ b/config/www/community/frigate-hass-card/image-5371a090.js @@ -0,0 +1,13 @@ +import{cL as A,cM as e,eQ as t,eR as i,dC as a,cN as r,cO as g,dD as o,_ as c,n as s,cW as h,t as C,a as l,cR as I,eS as n,dy as E,dz as u,x as m,cV as w,eT as Q,i as M,cP as B,cQ as d,l as b,r as L}from"./card-7cd05290.js"; +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const D=A(class extends e{constructor(A){if(super(A),A.type!==t.PROPERTY&&A.type!==t.ATTRIBUTE&&A.type!==t.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!i(A))throw Error("`live` bindings can only contain a single expression")}render(A){return A}update(A,[e]){if(e===a||e===r)return e;const i=A.element,o=A.name;if(A.type===t.PROPERTY){if(e===i[o])return a}else if(A.type===t.BOOLEAN_ATTRIBUTE){if(!!e===i.hasAttribute(o))return a}else if(A.type===t.ATTRIBUTE&&i.getAttribute(o)===e+"")return a;return g(A),e}});class p{constructor(A,e,t,i,a){this._timer=new o,this._timerSeconds=e,this._callback=t,this._timerStartCallback=i,this._timerStopCallback=a,(this._host=A).addController(this)}removeController(){this.stopTimer(),this._host.removeController(this)}get value(){return this._value}updateValue(){this._value=this._callback()}clearValue(){this._value=void 0}stopTimer(){this._timer.isRunning()&&(this._timer.stop(),this._timerStopCallback?.())}startTimer(){this.stopTimer(),this._timerStartCallback?.(),this._timer.startRepeated(this._timerSeconds,(()=>{this.updateValue(),this._host.requestUpdate()}))}hasTimer(){return this._timer.isRunning()}hostConnected(){this.updateValue(),this.startTimer(),this._host.requestUpdate()}hostDisconnected(){this.clearValue(),this.stopTimer()}}var k="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAUDBAQEAwUEBAQFBQUGBwwIBwcHBw8LCwkMEQ8SEhEPERETFhwXExQaFRERGCEYGh0dHx8fExciJCIeJBweHx7/2wBDAQUFBQcGBw4ICA4eFBEUHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh7/wgARCAEVAewDAREAAhEBAxEB/8QAGwAAAwEAAwEAAAAAAAAAAAAAAAECAwQFBgf/xAAaAQEBAQEBAQEAAAAAAAAAAAAAAQIDBAUG/9oADAMBAAIQAxAAAAHu/wBF+fKuKWoua2zblcOpTDeJqLJsVgAACCiNQEKJRCmEoMAhy1FzThq4VrCHDWbHCoilBWQKqzaa2xeTz3Uumd+Z+h4Sxy0VGmdbzV5AybMdZjUz1kEFA4AAEAAdEFAAEVKBDVxc1UtSgiaY1cSI4nPfl/N6eZrHp/Rw11mLJq83XO9c2ovO+Ry6ea+j4FY1uKl1zrSAAIucd5mlYUoBggA1ACiRiVgiCiW81w6JQqWpazQVTQCo6fz9vH+L2ec83o937PJ7P6HgsBAaZ1vjemdJNcb5HLr536PgACrioqFU2RZFkWLcAgAAokdoEhRKwgoHCCgrKpWrlQ1ctQpVU0jovN38P4fZ1HDta+y9HD3f1Pm2jEBrm78+muNXNVnW2N6Z15z6fz7zWSlDEkVnrMWKyaVgOCkA6AkBipwKBDhgIa1AC3KoaiuJtmPP+b0eM8Ps6Pl01lprsenL6V9T5vadMUJEa41y+XXXGqmrzrTOrzamvNfU+brnThgRrOdk2Z6yqSKxBTAQAgojBBRQAHDhhDViRLc1cpKhV5rzd/nnz/dw+PbkIqheXrH036nz+578LipVY42xvl8u14uk1pjeuNXNB5f6vzNc6uERc56znokjUEBBYAFACGAIAAAAKDyoqaEJRWVNOOn5dfnXz/b5rz9he1zutRGtfSvo/O731+aoYwjTOuRz6b893nW2N6Z3ebpnTXyf1/laZ0xM5azGpFioQAVgCiAAKmgAAoCAhgpDHLctZoNUvh/H6vnfzvfjHJl56taNNT6L9L5voPT59s1UAVLti8nl2rN1zrbn00zq860zoPJ/Y+SDM7nPUmxWIBiQoAKABAAAAAFEQ1BIBFTV5uktTXnOXX4/8n6euNbnYzWVjXkdMfR/qfL7X0cNM63xqpagKl5PLrrjdy643rjeuN641cpL4n73xUFmdzNCAACFAAFAAgAAogACCiQCiUlqWoqa0zfkXzvo+Z8fq7XnvmVx9Zmu27cvon1Pmcrvwcu+N6S689a51pnWmdb8+m/PppjeuNbZ3ea5QZ4H9D8JWISKhAKIApgAAgAK0SCiiACCwCEooOWocvTcuvx74v1+RjfZmk1jrPp/Z4/cfU+a9QHHIxupeRz3tjXJ5dXLvz6crl11570zqpXRDVnz39F8BwqlDUSCgwABgMIVORqkLEoAAJAFQAqsakOX5T8j6nQ+P19xNTc8nHXk9uP1L7fxI3hUK5d8a2xrk8+muNcnj25HPptjfI59NM6AHDVqHz79D+fCbFokAoHAAwAcEFEMWghKgALEgoAhaCiPLznm9Py3431+djXay8TU7vty919L5/YejzTYhDl3xrl8+nJ5dd+XTkc+nJ5ddcavOnKqCotoA+efovz9RGorEFMIYQUDQlYBAAtQAIKIVgoqRiqbAcuWNfH/AIv2ev4du3zrSqj6R9L5/fezxRYqRUC65vL5dOTx7crl15PLrtjd5tTRBTilagHzr9H+eZNgAwpwAADgGAQUAKwUQAQArjLG+s83p7P3+BhnXy/5H1vN+T1b5vPa1s9r34+++h87PWc9RwE2TV5cjn05vDvz/P6N+e9MbuWlBqAAQHzn9N+ecKwgGFjlBhBRDAIACkMSClEi0UOXTNpfN+L3ec+D+k7z6Xx+r8/o8FvlWddkbHP6Y+vfT+VyZqUmzTOtcbZnrNTXK49eVy67c9643rnVNAAAAAR84/TfnmgADgGADgAKcFEIBolKAEiRWhWbyMbivi3wf0EcuvKmuH38mWNdrbon036fy+768dsbcumd6Y1rjfL5dalBy0ry1zvXG6UAAAAA+cfpPzrAdAAMIcEFAACFoAISlCJSxQrUjl1zry3l9Pyz5P1MY1O72wxruK9F6vL7j6PzNc6359N8dORy6a43rje+NuAnRDjTGts7uaAAAAAPnH6T886IaFAQwGOEAAFAgAAAAAQ5Vm+D8Pt8J873xLKJeyrntdpL9I+n8vse/m1zvTOtM65vn9G/PpvjdQE1lrKRrUuuNbY3pNgAAAB85/S/niAdhBRDGAQUIKIgBSkEACpwEYvmPH7fCeH2dVx2mmVLFNnvLruq+o/R+ZyOvCprTO2c3z+jmce2uNMipsz1nPeHNa41rne3PWudtQAAAPnH6T86DAB0Q6IcFFJCBSwhKCBBQ43PfQ+fv5zyerzfl9XGzYRy6LCCiKucdxqfZPs/Fcu+OnJ5dUmmd87z+jkc9hOk2QznuXm6Z1pnWuN6501AEJGofOf0v51wAADGAQWCiClAgEEB13Lr82+T9TpOHaEUOXlzVmlaDlzlmzg3N12J9p+x8blaztjfJ5dtcbqORz68nl1cKgmxI2rmqy1xrSbYEiZais+c/pfzzQgAdOAAAAAKQQgpRwuXX5N8X6/X8+hHLObNaLnZRUFVL3HLp6P0eXzPSddJ0fPp9G4693+g+Lvm8nl15fHtU1rjV5rWpqoBDVxebpndytUJEjVqz5x+k/PMEFKcjAIKEFAAQhBWeNfJ/ifY6Xh25kvPWrMiluXVexzPQ/Q8HoPf4OT24llZvH8vp+X/ABPt9fqfSvT5fX/R8PL49eXx7OUVoS1LUuudENai860ztqwAEFAPnf6P88QtFRIU4YQUAOFaCRUiZfmHxvreb8vp5Evay1YWcatJe+9Pn9f7/ndp6fPGiSpRKl359PM/N9/kvN6uQfSvX5O81ORy63mxqTrNZ1rnTl0zqoqW86qaqVq4KAAAPnX6P8+IrFTHKIwhUwHCpWkIVnhPmfQ8N876HNl3rQYrnkdM/QfpfM7f1+VWCkXLedXCNcbvN+a/K+p6j0+fpPL6vqnq82+NXnUazNjNcbvOrlcC1LedXm0rUCAAoPm/6X88SA6ZWaBQhDBUipFZpb53y+r538f6txnWpVmusfTfqfL7D0cTWVQhDmtZrTN0zrTLfn00zrjY38u8fs+gduPF59PadMXmgE2VLctTSRq5by1zu86pQMgKAPm36b86wh2seQjUokqUEToi83qePb5b8b6153QrGdv25fRvq/K5PTDSLA0zqpXDW5dcXk8+nI5ddM6cvTZ347n07BPb9McrNqVjlcquW05QqXXFvOtJpqBAEAHzf9P+dACCql0zXEWMagkjSs3jc+nyf4/1sOfTSWyLO87+f6N9X5fJ1EBNjipdJalqWjbnvlce2/PprndZoeXzvgmlnsrnTN0zsVWRc3NXmuXTOtM6pQAAAAI+bfpfzgNUMoZWarCWgWbIoxr5b8f6/V8O2hcvYaz636Hz/Sezyck0zpWJLlZFgJbl0zeTy6czj25HLrU040zpnQY6d9rFDilCUVaY1rnVzTUAAAAAAPmv6T86wBGrCiAocriNJTwHyfq+U8Xr2NK9j6fN7j6Pz63ijk8+jgBBdsaqWUw6Yqa2xrXG+Xx7b8+ly1nVy6Z1WaCqNZVjzWVLpndKAAAAAAAB81/SfnC1hIDtBhDHKQjy/k9fgPk/V7beO69HD1Hp8/e+jz6ZrSbNM60zdM6i5z3nbn05fHtpnXH6c1W2N6Y1tjemdXnWmbedaZ2xIiNZjWQrOtc6poAAAAAAAAPmf6X845XRIwV2uAqLzoTi8uvnvH7O16c+768uRrNDluHGeo0vOtsbjWYueRz68nl10zus1rebct51UrlqNM7uVqIEmW+cay5rTGrmqUAAAAAAAD5l+l/OMYQwKtcripdc6uJ8nr7a5DXG9M6x3zy3loLFyJlvJLUa53yeXXbHTfnu86ZedVm6TQCOW5qpWoAJnc5ayy5qs22gAAAAAAAPmX6b825QcOiKtakmmdVLpm9t5PTyOfSprfnu86z1ni9uMazGs5bzFzjvIuubyuPXkcuu+OmmNXLeNbY1U01STqVLebTQAAJJQGtAoEFAAAAAAf/EACkQAAEEAgIBBAIDAQEBAAAAAAEAAgMEBREQIBITIUBQFCIGMDFBFSP/2gAIAQEAAQUC6hDofrwE1D+gIdDwfpNqxZggbNnAXQQ5Kwom+DOQgEBwEFrjXGkOpKJ+kuZKrWVvMWJUXeTsDVsMQ6gIDjSa1ALS8VpaWlrqfo7uUrVlcytqwhG8rwaFim0GzjqAgFpaQCA50tLS19Pcy9SBXMpYsrW0PZHax1J1ySjViqxjo0JoQHAC0tcBD6MdcjloKqu5GzaMMZI1pa4q1ZrMmMpMpxBDoxDkIchDk/R38hXptv5izYTimAl2zx4uKirSyyYim6pBpa6BNHAQCCHIQ5P0GuM1mPTT3lxUUJcgGtQCLXKNs7zhq81eu3s0IcBDgdifov5Db/GpOO1FE6VRQ/s4+y0CoK80rsZXdWqhBDjS0g1NatIBBqAQCAWlrja388chfyC3+TeVD/5Sy68/bijSltGnB+NXQQ4bwAgE0IBBqAQC19PtZu3+LRJ2q0fm4f7M0sQCxWMc6VrWsbwE3hqCAWkwIBAIfVZy3+TbYNuDWta9VnhyoVX2LX/OjUE1BNQag1AfV565+PVcdqkP3sBoR9xg6vqZCrTirSdAmhAJoTQmhBD6ueVkMN+y6zZHuWjxa8pgWDpehWIWuNLS0moJqaEAh119FJ5+Fa4JJOJHMijy+RdbkKrj9h/p91hcc90WkQtLS8V48NCaFGE0ID6cLSzNYPhNyz6dHMQyr+T+qXJo2QxrQG6VCo+1aiaGMCKAQCDV6a9JNjTWINQQ+nBQKc0OEkz6tya5t8V10jJmaMTSSxvtolYmr+LWCHDWrxTAgF4rxWuQh9O1ZvKNga874YdKPUsNc6k0Y34Wn52EE1BNCAQCHYIfTPLWMymb2nHyK1xVk0+WLb2bLMZCIqAagEE1NTUOu1tAoFD6OSRkTbmcgjV29YtO6FN9jE/yZjx52arDFXQWk1MTUOh5CCCHz5bEESsZupGrGctPUs75XE8BBjii0hNBJWlDoNx0xFkoIJqITE0odCtIBBBBD5t+3FUiu5OxYJcSt8AEoV3kCshGGoex9t+jomPyJBaWHRpvNexDI2aJqCaeAE1DrrkIfNu2Y6sF61Jan4ZXcQxjGD9db415BjduLC12Mr2JF/48L68uJsvnyGKsVZfJYa/tjSgmhNHA433CHzJZGRR5O263YUcBeoowxErSA9gAS6N8clenudmHb6sUEER2toFWofWiyNdvlVc6E4e2HhqYh12h1HzCQ1uYyBtSbUTNljkTobBBPu1U8XPMq9CrAieoQWaq+TcYIzas1pcbYxdgWa7Qh0HA/v38L+Q3/f3Ka1qPuWeyemD9Y60srocZTiPTSAXivFNavFZqia0uMljymOpSSYvJNIIHQcDqPl5e+K0etqb3LRzHDPIG1YparWhjOw4DUGoNVqsyxAPWxOTuwR36n8es7a3+sIIfIyVxlOB73zSjpjqL7hqwsrwddLS0gEAmBAIBaWVoMu18FZfTtZmF9O1XlbNDzrkchDgf3BHuFbnjrQXLEluf/gQTP2diKTprUUbI2865HRqaEBzpZrGC2zFWhbhwfq1rKCA6BaWkAtfB33c5rGZW665OOB/lWnNPHg6H47WMa0NatLS0vFeK1yEE1NQ5AWlexcdicMG9LXTSAWlr5Wcv+q5vuf8AuiXQYSQsjYGN0mhALS0tcNC8EYkWJrUGprUwIcaQWlpa7AIfLzdwwsmjeySWg+vRw2JLlSxsFZ4WlrgIcHhiHDmoNQagEAgEOB1PIQ+XcmbWrYyjM5UMXHA51dj3+C8V4rXGuBweGBDjS8UAtIDkIdSjyEPjjhn+zUhYm9NeCaxemnM77W0AmoIdNf1noPjjiP8A2M+yCHDgiODw7lqagghwAgOw+R//xAAsEQABBAEEAQQCAQQDAAAAAAABAAIDERAEEiAhMRMwQFAiQQUUQlFhIzIz/9oACAEDAQE/AfaPwB7Y+KPZHC0flj3GsLvCbpT/AHFF8bP+oRO43yGBms19WyB7kzSsHlCgtTM0jbypDLQgMUq+rZp3O89JkLWeFRVKXdR7rkEFSpUgM19VHpnO89JkLWeM0VI8Mbaklc/zxAQCrACr3L+gjgc/tRxtZ4QGaT3BnZU05k6/XIIZCH0tYGWROf4UcLWYGaTjtFlaicSdDm0YCpDA+mrEEO7s5rAVFF+3yVqJmyHpDgMAIYCGAPqImb3VgC0ETik+RrPJWolEh6QwOACa1UgEAgEAqVKs39EFpWU2/wDOGdFHMkzY/Kmm9U3zAQCAVIBAKlXC/pImb3bUEO1aIpV/lTztaKae0ST55BAIBUmhAIBV9VpY9rbP7yVGQfxKmf6Te047jfMBAJqpBqA+r00W92Go4lJjbam1DpBR5BAIBAIBDA+qaCTQUUQjbWbVLUybvx5hBNTQgPqGP2m1JpdzfUi7GAgLWn0+zs+cDMuo2t2DzwpUqxSATQgEFX09L+P1f9PJ+XgrV6COvUYEP42GZ/4Gv9KT+Pbpm7m8XvDBaJs2UEcAINXpr00I01iDcD6cZ0WtliYKUkrd++Ppf1Bcwschwnl3u4Bq2poQC2raqyEPpwoIPU7Pji3Gpk2NrAQQQCAQHMIfTBqi0v7egONILU9yFUqQQQQ52rVoH6NoLugo9I7+5MibH45hF+3tTyB77GaQTUPaH0DY3u8BN0bz56TNHGPPaaA3ocKVcSL6wEEFSaU08qwMD50URkNBRQNj8cdq2qs0qzSlidG6iggmnACbxpVwHzYozIaCYwMFDO3F8aUUrIzUnhanWxRvqMWjqYnC7UUgkvb+sSxCdlftVRo4AQCpDF+wPmMaXGgoYhGKxWL4EV5RLWi7Tte2ugn6iR/kqycBQSmJ+4I04bgmmlrIb/5AgE1DN5HEfMAtaeD0x/vgeEuqYwf5T9XI798KVYC0k1fgVKCOx5UMweFLF6bqQCHAfR6WGvyPEoJzwAn6p540qVKkAgoJN4o+VKwxutq/9WIIYpUhgcLQPy9LBvNnwq4lwCM7g40UST2eIQzSDVtTbabCNSNUTzE5TMo7ghwrA4hBD5EMRkKaABQ4yTNj8qSQvNn2qTRgBUmHaVIyxuCjdY2leOFKsDgAq+OExheaCYwMFDjPN6YTnuebPCuYQQGaTHbU9ldhOF94CrgMUgFXwb5tF9BQxemOBeB0VqZ+6aiS42UAqzSrgFSamhAZAVJppUq5AKlXytLBtG48HaloBTnF3lUqzWQFsXpotQC2oNQGKzSpVypAfL0sO47iimyBxoKXUbemqXUl/XIYOGoYIQag1AKlWQhwrgPlxx7zSfIB+A8KScu6b4Qc4CgqVKlXAK8tCGKVKlSriOJ+WMBR/iOltW1Bi2Itr2QE3AwM17RVKvkjDUzAQwQqwcHg1BDgAq9yvg//xAAsEQABBAEDBAICAgEFAAAAAAABAAIDERAEEiATITFQMEAiQTJhIxQVM0JR/9oACAECAQE/Afmr1h9q6RrPKdq/00JrJH/yKa0NFDiVeDwv4q9G/UMYn6qR3hdytLp3A7ieRKOS5Xi1fq5NSxvhSTverxCRY7WeRKJV4tHjfEZH3z2Umqa3wpJ3yec2omdR21RxNjHbiSiVeCVav1cuoaxSTOf5V8GMc801QacR9/3yKPrpJms8qTUOfxtNaXGgtNp+l+R88iUTgq/hHotRPt/EInjaazd4C00Do7JR5HJRzav00r9jC5WiawMWmRuf4WnhMY78bVolFytErcrVq1avNeiK1Ulu2/8AmHiwhmKB0nhQQiIVxOLVolWiVav4qVfelk6bd2CqQN40+nc424dkAB45FFEq04olWr9Vq5N7qH6yE8V+QUTOqaCY3aK5FFEpy3IuRPq9TL02/wB4Kbf7xC0SOpRQNjNjkUSiUSiUfkHoHODRZU0vUdeAqxpo9o3IHkUU5Eon46+5akZvb2UWrp3Tl7HJdS1M/U7Dxxi0+5284BVq1avBKJTiiUT6i1rtJ12WPIUGrk/gSv8AcJYmfl3TNc7UdjxYwyGggK7YCtWi5b11EZEXon1NZ1WnYZCms/Ha/uhEA4EJ2AqUMWxvAuVpxVrcr4H1BU8/T8eUTwKC08e43koolEon1xKm1f6Yib4DOmoMV5KKPCsUqVIhH6dfQc4N8qTWNH8VJM5/lXzDd3ZQsLGUVWSnchwKPoHSsb5KdrWDwn6158IuLvPxAoDBRQKciOVq8n70szYhZUuofJxtXmlavIKhlbK2wjgjFoo+mlkEbbKkkMhs5vFcbUkTpB+HlaXSyyMuTsv9PI00pWdKt37xDIdLLf8A1KsEWMOKJ+M/dc4NFlTSmR14vkDY7IbnnaGlN0Dv2UzTMZ4C2qlS1MDZmFpTCR+LvITm7gtDMW/4nIpyOaxXoiaWon6h/rgAqzFpXv8A6TNJG39IDhaONZp7/wAjfIUTgVNCWd1DN1GIlHgVfotZPf4DiMNYXJmkYONq1atEolTRdN1jwo3CRu0r/hfg4CtHnX2gtVqNg2jzya0lDTtLRaDQOwzfA4tbluTqcKKFxuUrBKxQusbSj6WaURNRcXGzxiidL4UcYY2hzvJKcVatWnjcFG7aaKe2nbgvPC/QPeGCypJDI6zx08XUd3TWBgocL5lEonNp4tMffYpprt8Fq1f0aVc3Gu5U8vUPANJFhaaDtbk1oaKCvF4tblfAopyvNq0RatWrzatEq/sjGr1G47RwZpX2E1oaKCtE4tWrwSt6EiDkXLci5OObVq1avA4X9zVT7BtHnDoy0WVDpy/u5Q6YR9z3Ob4jDkcAouRcrV/CD9+SQMbaZETbz5UUAb3d3KLWk2VuW5WrxfAYccWrW5WrV/EPulSfke63rei9b0Hc6wSjg5tX8YVq/tuT8FHDSgcDAyUUUckq8j7f/8QANxAAAQMBBQYEAwcFAQAAAAAAAQACAxEQEiExUQQTIjJBUCAjUmFxgaEwM0JikcHRBRRAYOFy/9oACAEBAAY/Av8Ab6zSNZ8Vc2SF0rtSr207RuG+iPNBoJNNTXvNHPvO9LVSOkDfqqm9I7Ulb2QNjachdxPeaV3j9Gq7euM0asli5MZGH7RL6rtGt7xRrt6/Rqu1uM0bZgsUQ0igzJVyMfE692LG+bJoMgvMfw+kZIuPguxtJVBi88x7rxuq/wBAzRAO7Z6W2YW4BXGNLj7Ihxq52Y07qdn2V3F+J6JJqbKnAKjRZkrsd4nQIia7U9Kd1ow0fJgLKMxOiN/CnS3NUiaXfBXH3b1endnXTwM4W2NkcMETbWMcIzJQiDr3dnUPG/BtlTkLcRgVvNoj8rQ9VdY0NGg7uSORuDVRUbYYZOU5exW4HKMSfZU7vum/eSfQWXim3MqY2M3gq0NvJ7468Xd3SyHhanSu62AIJt4G6TRCVxq+Rv6DuZ3brruhojBKN3M3NuvwtL5DdaOqutwiGQsrpbG+cNMRN673UzjB8Yr8kDxPLciM/wDqEZY/eIUfWMdLAFQWCMYDq5NY3JooO60OSk3D+AONEJIQY304qap7ZiX3lhlZihQVOSunmdi7ux2eE1lOZ9Pgu9eixWozRnrwRnD37qXvcGtHUoxbJgPWqnw32mlV+ZqiAFCRePc70j2tHuUWwN3h16KsrzTTp4/ZMiOF40qmRuIJaKdw8yVjfiV5YdIf0C8u7GPbNVke5x9zbgsrKWkE5j9FE8dHdvvyHHo3Vc11vpCxNuS6LFypZQ5K+OVUVFUYJklA6hyTZG5Htpkk+Q1Rlk+Q0swVTgsqqlLKqqp1V0ggoncl8XVB7b8cujslcMVPforoG8bdvVFjb3wcqjLtZkeaNCLzyjlFlcgsvn4ANVdkBb8QmhkjHh2gKBkc271DaqscQHgoOcYtRNKFVxwOaEROB5f47UXE0AV1hpE3L3sqVSytnWhR3g3TNXDFNoy84dXfYGdo/wDf8p2ybR93Nh8D0KDXGrDyuCvfjGDu0/2kRwHOf2sGGPgocNE3ynmvUBAhhcR6j9neZyHlP7Iwz4vbg7+VupuXI+7dVUZdn3bD5rvosVgKKtt9kbnNrSoChZtELS5jQgxoo0ZD7R0UgwP0V4jLP8wTZYqF1KsP7J2yP5o+WunZrxxeeUIySGpPhdQ3WjqUImZD6/b3cpBylHYNoq1pOFfwlM/qMHq4wmysPC4VHZDLIcB9UZH/ACGngwQMjDuhmrkbQ1un+DvI8J25fmT9g2webSmPX/qm/p0lSG8Ubuxl7jRozKwwjHKPBI9jcGDFGaVvG7IHorrGho0H+GzaGvMUrfxAKtMexnZ4j5beY6myiutFSozI+7XnGio0U6943EX3r/oFuSDeGaEsho954WdaaoTbU3h6N1V8cT9T07y6Z3T6p+3TU378Yw7ot7J5sxxLig9zAXNy73GZMY2Y3dT/ALh//8QAKhABAAICAQMCBgIDAQAAAAAAAQARECExQVFhIHEwQFCBkbGh8MHR4fH/2gAIAQEAAT8hhBgwyGCcYxl/LkIes9JlIkPQFrBxgwQxGLl4PywlSoQhCVhyPoUqnlt+0v1GjQfjlle9ehX5dIJpdTp+7hlQemI1GKhAQgQl4vIX8oQxUrJlzcuW1H8jLNvB3+cLdDmLsspP5nYYmQzVTli0emiCKwxYvliEPSYvCy4YnzLj3Zci14vyzd2PLHizFp5391bggZM2QZMEIZBFYWOH0vx6lQMkMVlZdCug5Yg/iR+Zd7bxfmdyOtVv23L+b92CH7ekPacvTz85HF8HBWIgipywqVGLFjFl/JmD1glRxxxep+RjO06NYmhA4mrRGK7XLzzq9D3ilv7Ug9AMOMIYCVK9BcUWLF+XIZqVCDh545f5dps1+pz7vWKtwkWgCbX3lzrCBlXpFociHEEkVWAhxkOAYBKgyWKLH5kYMMVhUuahoOng/wBxKycq8xblDb305gmhLtavywUCbl3GJvbsAs93rhWSBiGoZwggSsDLwLF+cIMGER7quOh1f73jKNIHkbYPUnuBQBQaAn2nSG+zLDLw1CW5s048X1yqBfw+vKmBci/QBhRLP+4zrHvVuzxEhg28957Iu+bIuCJ2ZCRKK3VZHUMCWyj1DKRWbjh+eJcIsFX/AGmMoHlCfhigapLHvHEdXqF1gLNN4XIeAojlwhDDNU5eggegJX0WwN/f/Mr+FzoN5i0NQ/b2vrK6B1dx4SqFlorcckUMGoYfQUGLwel+OfJEy6a/YzrJXS0R1arR2ZfbApLjOicfublHf0O2KlSvWoUwQl5IZJcX58lCAL9/ETXlo7HaDggkcnMVeype8hTNUSdPNWRUMGmLm+aECBKlQgPQfOVAg03UH3IFnSs15RzAYI0Nqm07fe8su7snLsKSaFXFSEKduqIaayC+LCYGiZgIECVK+gk2jPXsh3EDxj2Svnp+3mcaZ1KP4mySeLxZ/wCxIbjVtXHSXfLLVvEurDdGgg8UT2CcIZZKZdg+EXGRBiQPoxcRAAopGGmpi7KuEvrwnwja4FK9bgXcmyaiS8vVAJazQ6wj2dK48fbBSr9ABqUlIQQ+lU7YKP8ArcuXi9LHo7jg2uEnA9APiE7Ude7n+IOQzRlx6CEUUH6HUCcuIEoJWv8AA9b7doqIq4YNMo91A5OXUp0Sv8kEoH5VyGkW5xgghGLF9ITh9AvCTuHVL0u/1FqLoOh9pd4Emq1BHCoF7L7Mu5YfvTd2AOJeHCaMeRixwuEH0Jfid2whPBoWIPuv5Med4LpbLvmWWoMW+odaaeJWERumKnfRHXRLmFLhi3iYLJTFTmMfSA9avB8vtcXFyo3t9PSR60fvG2NaJl9/aM6ofaeYd5fR/wCwLDtwr2dF1C6a+GXF0i+wIGqIvf4l4dN08nhwWILwGo9RcVKwCGQ+Meo+AuXjqLtEo/QO0Xe5VtRx49nmDqs6qS7SR50QcbdOScPz1lBVVoo5Y4G++o5dpq8L48w6rWdZf5luthrrUXzFztAXT2igO5N6LQB3Dr7n6hIIKLE6zfFolYjgMH0GQ9R8qAstqy/A1dsjuDbaNMf700o3EUzls9sjcrV13drzHdAB0/d0QCeHuH5iRGlXy/zChRqXiRr0Nq9+z4eIu7Zfceo+YNNCD9cZvX/I+8ME4xIS4ODhgIEEPTXoD0nxTBCtXpGLOF/ZluI/AhCbbq9R93R1KAHMp8pd6cLRe5UHDf6Ihibra9+3ESLjmVFHqDpr+H96f+QQa3XqfB+vuxau/pf+JDSThTv39n0FzCCECEIYPgEXLyYPh2rsy6sJup3BnMOY2A5TYl1y3MVeJ8nZNiFLs/jiLeSHopolURBHSMO2cna/4/XtNW+8ngxKDTacdp7c/mEEFFidc0iYjlcGDFCHxCHpPSRnFwarp7yjAX1mogDsRDC9QT1NAXApUa0j9oUIlB0zUqEMSWTXh7UQeq6JOjBanC9T+6Yo4fLjyveK7T3zx+0WCJKhCXgyXx1ZIZYQ4jirQ77/AKjqX2rOcdk8S91KJOlNX2hv9x7u8rDCBDCesQFwq2f8b4mu0H8b7MA/R9x/pl0oUCEqEV6QggQfFMRkxccKBnEd3aKfz7A7QKpB0nPfBAqFXxFTNna+IDCuBAjKjAQwIQgyQSsKxhNuzsx0wG+Kf9JRFvQ0nb+b/MCDBWTgYpFfGJeRDDgRZbTpN6K6/wA8Nbh3hvQtdE5LA058HmKLU0Lg95UwehRgIYIMLXF4DE3BAgZKskHqq4uAVVilrEySGEQfIj0DLlxxzaur+1Y93RKJCdoDnk6o6feU7hbeV5Y4uj0Mlk3wKehCiCBCBCDEkYYrAPkzJgxUvPp3UnQTa9bmld1fuLt0iqBzXT7+xEhPS/ShhDpA3kDXojqJqWeoMBAggZqCMPkgyekgSp0veju6Ep0ieAfRYoWx5DxAlIjTi+YPEghNTlAY4JWFYDKuE0wmBUrIYqVBkRRfKHohqC4Xc0/7/t/mACqhiOkolSokqMXcJLYjgcECEBKwQh6RKgSsD5AyYMV9BBDKhQbiTjCKpeBDrEYGIJWHB6ySpUCV8b//2gAMAwEAAgADAAAAEH2HUWVRt01vusrnCqQdyy4N9XeYWWL2cdbhqRx0hGkn/wAs0nkte+AQgaKPE2wWfkGt2j1Y/JJpId4PnLAe3/kikDJPKyX9pQNglIi9KcD3LyLIV2KB7QVOhQZHc7sQaly8r7/4D4Qydu2J49xjIXy8xb5zVpyBHOglgjzzstSQq/p8m8/zqMBYezDcRwhuKVZtACMCW0WTFLAy1sZGYTVrfsdgKP3Q3F7rKImyM8xCB83o55LZ6wGYu5RdeI7Lp6AMoRWg4CLzuePJ7M55rLG3M4oebZO68kG2S/DT0p3Th/cUmwbUm7g/skONjaEm2qCyavWvb6KYFW2AmKms78tEtYtZbdAacIzaL9b6iRIf5emPy+0ABiRvgoxTAR8dgDbD5plFyEogUtcBEv8Am8krr0HX0PRe1t89izE+0Gjz8jUaolnmsk5yyiks1bZKkkNqS2w52KAqkjWVytEkmiuysoYxLaGX0Y/4aHqrhKS5MZ6YkkkmhsqzkkkQOp9gfQRBkAFYPmxJR4kkkkkb4Epj1ujAAUPLDQOrC6wQNRtM+AkkkkQzNwgHiYE28zo6YUo8csVUJJ3iREkkkCxdyIQYPqE2UUYrF8dAbxwpfhiBMkkk3+ww3QnxeW+y7PLTznY8DudN8XMMgHkrSWzu++IgiYVZqRZkUV/WYn7Xgnkk6khawJJQuMXP3iflDG6A+EBhYBPQQMn6A26DRwYBa/r+b/imdAcuoISNcLhqkgMkLg10wsUTJlq2+UaWXKVLueOM9rmmkkkncCt+MbCVspCfTY5xK9Il1hvLkmskmkHxIQqM7/EQmpcQNRUuLuw2WZXkoEm00oQG6Df4BzRLB39WcnufoYWtzmwfMmm2AKgGyksQOV3Rqr9fM2DZszWWBkgkkkkXW3qeeGsg2eGFYhkGJlRzvk65Ekkkkky+Ti1yD25a5AtyDMXfugXkmYkkkkkkkcL9pZf+MoG7i7OqkFJtorQTzkkkkkkkmCfngR+ZIUUu06s8RU1hhMJikkkkkkktGftSppknhiZ/VhReALFkhOoQkkkkkkInvAZg3jSpMLQ+AHeigckkv8Mmkkkkk//EACkRAAMAAgIBAwQBBQEAAAAAAAABERAhIDFBMFFhgaGx0XFAkeHw8cH/2gAIAQMBAT8QzRCdQmJkEkQsUuLxmLCjE5lBeiWKL0UTEwjQsExOi6GUXXF0XgPKxvitnR2LYmdjYniwTJiZIaEuE4I160SVh/H7NRZ+7H0ZQkJa4KGsEtEEFmjGxsvClKUTwhiJBZWh0QnlEEsJiylw2Mi+Tc7v/fBHEiAKv8ft8UhBCQlw6BojCQWIQbKP0IQgtkOxcJwQhEFhdCQuO+0fP6OiV+7E4hdiO6EX3/6TigooFQsZLCDRCEy+SylntYpRP0Esp4lEsLC24j2I+/8AY6tv3feE/Yttll2Nb09hMeFgWJUTJSIIXBvDLg2UfJCOspHWEXKEI7wkISFlZWkJNf2aLiUXtE1YaBrBD6wlj0ExLBBLCFijeG9FxOE4pZuKMWi0vG4Qg2EbxNe5tJX7sh2GNCd+BFGIkL0vPkhDoSEqJYEhBBBCEELDZRso+FFzomJEEPQxEEoXFELMCR8L/Ikkdis0uhLinsEKC8fIw0LQ0I8WEiFggihJmlGylLi5XGlEd8FjvhcIQtCYhEl+u3/H+X9qQb1E98kPpiGyF1rJ9xhDYhGNfEK3AmFkuDZdYReK4dYSFiUhcI6LwTwsLDae/wAPH7+olBtzJtNDYnv9g7SmEJCELDDEs1QXCsnil9FsuEMTEUhBaLcrZBawnjwRvDz/AB/nr6iC9mLYugo+A4ANa2UI7EKGjhCgo4JEy8P04QSIPsRJwb4rEZsTw3z34eBI0tLBT4/Hwyg9h7G7ZRYQhI0DBBGWCcEuLw2T0FyeE8JCWUjo7E0XFx2fS2//ABEp22Ik9D6Hle/Aj+D7kIQRBeBchYhZUQuNG/QWJvmsIuhDwsdkGsdiYldjFBfr8sSJMFsm+hzT0hqMgkQhMGEuSSEhYgkJcExvC9KE49Y6WFopKJQhDdlV5XwN7F8eUN4OZJKtil8j7EZ2LhbvIO9saJw0EHMcsSCCRCei+Gxems74rCwkpK5Jr2ur+xZlWn2ot/v8lYz+C/2d19RIRbpt9/7rwQREkJUug13YyRYJUiUGLHiFgWsEhejcLM9FcfOUxDwh6YwnUSjvappVPaHoLfa8X4+DvRev74oZdHR9LoT2JkpI2wVIIFAvWF6lwli4uVrPkQ1mxv8Aq+P4939P4SSKWD2MO00ntlpWKGjIrXBYYb0pl8exC5z0khjcP0n7/QhaRDY0JoVbQlZaD8CgQ0HrOovDobomUIr1BeKzRCxSiKJ4oncvDSFY1t4vv+jru/fyQQmIaF2N4IHHQ3rif6KI6GrHO/B9D1hCVFgvQby+D40sxOMxZ2drv6Hiv3fj9nlf+vgTRi+BvCFQ2EniC0hCNhuPIuhyyD5DwSEEsF1xvrJCR3yQkeHnlibSv3ZTR2JUTQQ0FoXyXL4ErcI04zsfhRjXg0wJXCkF1mDwpTCwXFcHyWeuKz1l4v4oIJJESCeLRKjZONFeJN4b+4p6jzap+z7KvP8Ab9D1P+HhlPb70/8AwbORtC40JzBNcFobEdBdZeEuEF6DFyRRA7GQL6kNxKD2yknoa80HZ10vktdv8iiPaH2HhmKH1PleRluhl4ifq84J4bMokIJcZwhMUvFcZwY0XYir7CEhPwNBMpdbIpbf75La0XwbPBMEEsL/AAvr4f8AkWPoDMn9UXU68YlINzKCQsJCWE56NGy5hMpTKFwR+Ji6Eh0SwhLYzNtaL6Ti+C0kEIQWBYqQdc0+6/wdBkzWrtCeMIMMaF4KLIXoLhOEwkQgsJEPZt9xItIYmM6O9Y/tTbHr7HiEEhBBCjFWBFkNDRTf+plS/qK8CzqUWSGKUTyYb0kpwj4IRMJYm/C7EpGkJ3FGyT7xjKEwiCQlhLJSyG2E4m6NoxbFhNwIJCwIJeiniiEIayhlySQUSQkIbRsU9lj1iWJrBLCKJiYtFwJJCSwfo+inxkKUSEokXBCCwUJ6SxM0QohcHv5BMfL7xTwPV2MrV1+R8ZWNEIJCvGCwlFgpghD3MYWntCQkSgkTCQwRSL1ITC5LNEe4f4I28NJC4W39mMq1GEEosoUsOhhiLiwpCEEkhIWU1BieIIQ9ZMvBbysJEIe3K/JCUWxl2zyK8x/gRwohIhEJbySEzQmi5DBEQQSgkIJwYagmL+gMWijwniYQkQetRmup3PwIuoObtMrBChoSNjCSD2JYkEqIyIIpEJMghZQg0JhMTE/6ClxRFwgtISsZt835xXDckQaPI+sJluNIJCaOsIJCEwlhLhBMEEhevcIRBZQp2G0XBSCmNUxo0FvCiEdMUEhbEpgSEg1hIXKDQgkJT1v/xAApEQEBAQACAgECBQUBAQAAAAABABEQISAxQTBRQGGhsdFxgZHB8OHx/9oACAECAQE/EA2zjLJJvXJEEEQ4PwJL5LznPx4MMMM8PBLOpj1y8M8ZZBBBHr8Gy2274NtsPkl7jkC9qG3I+xwgI42Uzp4L3Dbw2WZsssggiH198H1P0Q8es3X8rrOp/wB8yNq22gfv/B47wK23OJm8CbbbwPARHO/SbPDYbZeV43l4756Xs/8AfN7Fw+xYtfiOQ/2Pz+fXGx4gxZq52HhvIQ4OByeO22cPhvO28ZzvKWSBq3T9n9LoF19iLD5g/EmJz5/tZj2+88HGUspteBjNmbctjuIIizgYbedjgeM5PBs43y22DjpDtke09s5XLNG3Yu18/wAS+X2nqWWW22Z4DYIIIPE8S2J8N465ySeV5TgXt3dDuFswZFiwTrKlexn5W287ySymLPK8ZBCCPELJjrgPLOAs5ecsnjbbbt+39rR142D7y5AlebNsn38fbgPA2yzl2ertKWWeTLIIIPE8sstvjk52zjPFsmbOPfo/q/wfrl2g9p9dQi19pnDs/Hu/pJPqSXPMasa1rwBZwCzwzgILNg5Hfr5w+Dqnr93z/H9pbSD3euWMEnnQ+8pDu8MzCWczwnitbq+GQWcByZwcZZ4B4FsH00sstH5fH9f/AD3LL7XpENl+0AgNwZZwzw5eIBrrw3neCI8Mg43keFtjnbfpZZZD8N+75lg33CZf5fzJz6IAHxHLMpXRKfAB9Asg+k8D4t8cbb5By3pfbo/mW7GE0MIj8fmffL+kW22yy8SNSzwE+WQ8ngs4XLbPPOM4PANjrhmCdEiv18S8Cb7D3Fs9vANtttvEXTmFl5HJfFgQcnG8nVtt7jqY65HfMt4Mgsfhv8knw8bkQVepV8D9Zs2DL1MHoy9ch4yjwBFzGy+bbweWeSTzl1weAcsxA3c7h/1MRJnrt/4lzJ+bc/yRvpfeHr/v62zBzgEg9T7lOJuEUMHGrLs/S7+mtscZxmwSTHl8WTE7hyL8+fZ7mfgPT+X53R3kMZhw937ZJLc8CLtW7Xh/CngbL1wO85ZHAWckvAhOf+H5v+v+1F14L2Qul+QyyeC4MbWXgjhJJPwG2+BYyWZHBDxlnIxbbYmtjv8Ak/iRKvfgupugsFPmaskeuKl4IgcjxB+APBmWcZZBZ9DIbVkJnZvd+vtw9+A5Hd/dI4+pEbbuQmfcQRwyTJfwhn1vSherrF50nte287ls8k46fF0dz1wXfANLKYjg4Me5fJln0dtt4PpbfMX4JDtw+1t8cbY4HcmzMevm6Gx2cYWh/wD7weLcmvYdwXqG222WZ8D6nxznJ5rqc+G7bVhx6ZetsJpaQqPk/acN2+Mx9+/6XqP8WDTP9vtxlnt7/J/7+P6BXoZ65DdmyySyGGXkvgcbzvmcHPUPk6bolS9fHDi9wcfM6dwbdpk9haT0/wBO5rT2AdBZkX9pt+z8P9raLOhP9n5PsjUfUjp/R/7/AL/MpShk4JwSTjbSWfo7bHlkE8lngAV9T5np6/m22S04ZZKa9LuezAQcbw7TMg/uH3P5PZ/iZB9M0D2emHb5PfII7g5Fm2ec+jkHhsc7zkdcbbx+6f4ngMJ5OADZamv5wYQcLMYc7oY2l7H6P/v73zlLH8lns3ko4MmSySyfFtsfQe48Nth5WV9yX6Tq6wQRBKdEcHsicOoh4bbbwZzMYEeiGO6xP8iQjgt6tmyySySSfEbfobwS8jDPGo+X0TD2MxZHVqfbBvCZZeCy8gx4Ryl4Lj02zjeGwc9Syy+GWWfQZh8CIJZbaTmfcXTDr5ig4Sw2xF4eWfMLbGITvzYPntCpZZYYhl4Nbv0Ms8s5Ak5JgL6Jen0euPd84ToOizZ+/j8rDOEzYm8hu0smXFTNtmF2ae+d5EeQ38Klk8H1dh9H6w2R9pTLh+pZ5wjgL3w6xwwjHBrwPA0ltmMeDUMuFtn8GPFbeNvvq/Sx9sA6dhPQXZELaxN6mbZQ9cFFnyDWLLLLyXrgHZNmfw28NssqfxB9t+h/eX2/Yi5dljg8Q8NJkfALdJup4mbLPkT4SSz62eBznDwsLo/A+Pzu/ILvbbDwOwTMzgcyt4YzeXzURm2/WPotl6Q7jguEJYeDGCzwSl5FW8Lhnz22H6//xAAnEAEAAgICAgICAwADAQAAAAABABEhMRBBUWFxgSCRMKGxwdHw4f/aAAgBAQABPxC2JlBL4sxx8ApgIMpux1ERdxmuAzCVKmp1OuAlSoSqhCEqBBDmGJAxCahgl3waqdzqYlPqCRLJbKpvKuETFhQNuIYSptCFloXiMHAh4uMuLh56hycHAQiSvwIOBwWu5rBcBUqoMMtl4nsixcTCMaMsP0gy/RLS4pVHqh/wQHKKHM8Ob+ywZuV84lFY9w3eIZcOGUwsxLrFZTOOLcfmlU0xPCWR95iZYtRgeKgQhwEDkgQ7lQJUeWriBcIFAqGo4OJcRH5g3GkOsNMxsd3hdH236l5cx3z/AB9VGgo2kq/+9yhHi0mSiye1QlwFQY4q2ZYz1x6yzCXqUaRswFamJCvHRChEjruPURjweJWIk7hKlcdQODg5CVK3ByBKxKzOptBxGLnghtAknigi/QfVsY1dvbHjY/5GcQ5cMoh6802EsaKwCbA7a8p8Fy1gk1FmTHS6nqlRqXdT0ygg1BcsI4VN9So4LUKOPBlQh74BKzKgSoFcEJiHAQJpPhwkuKLFSoQFEvHElWCtGgJXuMW4vvX9XGgYqWQ/LbFJcld7hkA8soL2LxuINdBbc9bP/rqANGp5/b48EMKrgFy5mCNQRwSs7YMqhNYpUyhlqUOYeJuhDElQhMSuCVwQIHcz+HhB6ivECEYjDcylkKRYmYskuDnn+no+6mUB5H6V5+W2D22AO4YP2RC8/Us6/IhMqTrHyuiAnqtNDWh6P7/yg4dSs8ARJeMmGGYYYwPuPMRUEjG3ncOIqw5CE+uO+DXBDcPyJcWYoa4OB8V2blW1dkK8ej2/QxNHGFFP2f49RFZb9wqcEyGvcpTDpe0bXeGIMs81GGBqX9+Ja9BF1GvbnLMVyiFkqyMvDVmGiWvJimYoDxKMzAi1Em3PCrjqVUKj8zuEIy/xNfgsuHBOocHljIUwtDaXzKExlzbv2+f08xU8rYKe2LsrALILP6DzPlaYy/cQqfFSf7MoEE2McB+i0folIE6k83WX0wrVY3KrmUqETuDPEiyqM2CmCYuFa1LzBB1K02zbw2Tc6gwYzqH4Gp98kJ3+XXNwvzGyrcKptF6LKU9d9UQpVV7h9AgKlni4Qg0CGbOmDI8MA9RQbUwPZO2BgZuaRKfLoPmWQ1OYhqlS6UtvmjERUWZcVBWJpwRZV1LViKxPEc6jPUp3MMp4j+ZhHGo9suXcGXu51Dg4OCViGeA4PcxO/wAji4blIT5x+544Aaaf7H+qlh53L36hOvI99kuRUo/tFYmFuyUAkOBodTf648QGs6wLasDox/vG8sh1FcN9SpCi7qCmoB1PXBhnUpKJRCUstluLl2S4TPFwccnITrgPxXhhOp3Bjgw4AESubJZ/Qf2kYZsu4j829vRKlEG1IxCCADQ8j4iP3IH+kU5OwfRixrvxiawfkH0RWcbRQLZhl7TKo8RFOpeanrgkKr8AENcP4HAcXwQgSpUCVx55J3LnXJ+AwbllWoAWr1HrlUdAc/Zz8VAYQK18HcwrezzFqAUq/MtmE+C9npqk+PEbWLYrQgvkt6mHAMKtaKzwrHBzOipe8JRjpTLuoR1CIASw4DBArgQKlYmNwUiwlcHHmEN8HO0eTmuOo8GYstnrgmQPTTTp+zR9+ItxONeoGVYz2wKkm3OVuvSV/cxC9jGVJNmkgfsEtkOCValaY9/0RyR4FXqBtlzNfED1Kpj1KJiY/AeoMco7lAl0XghC4EODUCEMXL/O8Q5udQhEjB4AMuXldD2sarSF2OsegiV5K1U0Hlq9xeXo3AdgAnxYPkGKiIQaWtPstv1KVi+ouoi3XAEMEh1CRi1xUHFg4WiSj8FFZb+BAhDk1x1Dg4qp5/JlLLBBgWrBd4TZ/fhGOCax9kdiZg9I6XhaLQf/AH1Gi7Mb/wC3+fuFnsdsvfQvzL6L8ZnmcxEC/AWtYeG731ACAAKAMEvtqbS1LBqIbIt6iRTBVhmHMqJXxYJSU/IZ1yQhCEN8EITz+JyS4pxcUrgwUxKMV0d5iX5Nn/2EVBtV3yIsOsmHpLgK2JE85Y+iJwKjgsEaA9LbemtRC8Sh/BUuvcastj1K3Oi8dRwbK5RCl/OvuUFAHgKP8huKtE8SGskAajYcR1xAnUM2f1CMEI4GyUfwjDjEqUwhCVCHPTBK4vgjOp1xqXczBplDAgw9QGEdjFnKSNB0njRkmzq6q5umh3Lo7DKAtt+rmNKdvqW5sMy4sI+kjtFgrbYKimYaNFIV/d/cWZilzKM1MtRRpjtJj1AOoB1BRHmbR/xEMwhOuCEITrj75oPwvi/wYyrYDE6juwu2Bwg/+nzFdNr3K3OzgRJTY+Tr7gmWfdHZCr2ljflBPIqbtEF9ZDEVl1hvcCAxcSl1KSARCopUUWYfmD5ln8NQ5OA4Ic4qD+Oody8QZcshEmXCe/rKB8stY8tFfF6e3PxEqBartiK1EhbIeqLmGDZRjV9t/r9xWaGg1XklIMxbp3b9UfUqc6hB1FF8Uw4LIKiqYJXDgW9xZbFZ/CQg8EOCMvg3zcZfFwZcWDDtBuFXXUD8XuHhEotN+Nv9SuNNq+iMfcUnbLRzL2Yq4BRbdwMlkXpf80fqJp3FYCoa73Mt1xWgtBYOCj6iWO5bTg3VBMCKiZIuNhjWd0NcV/BmEPXA9cGp1Djrj44HHFy5cvMGXCGKtWhb63BSMxT+xz/U8Q3pg/8AGqj1G2sf9ytgIJWoa1awdKboah5ZkXmNhtq6gqFMBkJmAEpTbIX1fjplxA90Jkyez2J5EsiiL0xLviGmWLI4CwUmRcGIODhmTwUQQQcrUYtmnBxc7lwzCVidcY4Nfwo6DRn/AMx5YH2jMoPfa+2KlfawyqVnSxm0eAgoJsunKXwukLXH6A/vYLF701oRzHqvT5I+fS2YLWr+5nIZfBdYjcUVVJHbqRwyUiJnrMMtqmQ3t8+SUAD0afaHScKmYpRtgjZG5I3NYycEdQcXw6iy4Zg1DUNfgQ4V+OUYfhcJoX4b6Y/76jyctBo6B4lnivYQw5eiWxu1Zb6hQLFXWfhgdyyGiaq5NSptTPzEgl/0MS17TYo6muWAbHpGANMCADTfCL0eYudFQshFJkCVnq9MFoU2FyUDgUMDWaMSgnmVN6TLYtIXs8ywVEx6nUvTuhVe6M43YwgwealrA6R8RRq4BSaSmFoBAYhAhDBBU7w1GVKgQYzAxuBidSuCEJWJX4E6nmLF4ueJ+5j/AJfUfiys4/73axqy7hlWNC7RyV+4IKtslu6s/uXVGTIxu3Tuo1Ors7IHaFUUBfWXBDRmiEj0q0+CJhi1gWqFgPNw3n3SfFqyZAVG6vFpamiQaAoIeRlzcVKd0WCPqLXzfUBd3BKCoDwRH96RhpkMDAmd+e4egRX1nfhc/QzRwUbh4DqY98dqixY4wckeoHRCVKhFEo4wSo1FhMIQZ5mIQ7hNcMeGhIeoBtY/CU031/1HR9xbTMqcu7NsJpFZeGCSjc5auIwY/pjPXyHuIhvSmceEZwpGjfFg/vEKCpS/mNH0RRV4iLuC3ARLEQeNk4AoGxg/SqOqaYWVQI0s3OkV8Kks88zanD7VNX9oyx5TUYWH0ZPs6lEFES5hFZmy0lE1rgMrzX8HRERi4QTuaRYQhi5eIvFRICtEOwWzcdFvB37x1Ea5tFEGl5SXb8Re6vEOlM7nV1UVijkWr9RJHgUxNKNVjOYuLgPsnaK/pEytgwgvXJNjUMtRNCJblQWI7EggZ/hTK3z0vcKQhne/c8+XyN4c6dHBstgd/wDRh+1IWB0j4gxKxLJtmDMXAaJXhpgsVk0/gGXiHHtMItwnXAxAxGOoMNkIDURAa9mU7e/H78ShO1pS1VyxAlFBUFAf8TMPiHaBAlrwRH0rTotY7yfuKaaooDJdLzv3bKgehoHqJEg258YczXgRIU0aQPETAnY6O10j/wCphElp4z36H+inUaJ/HxPgGiOk9MvnWnBXq99vHwniBUsqoBIE2xCxwXmW3HuCxvA/4SEGDBgmUnHtw+omL4hmEMcCpfsfT/5LulM7i2OpS1LepeQZgT4I8FJblW0rurfr3K1R6aU2vbARwRZhthQ3qHjHlHBT1MHAwYBqs0u/Y78YZbKUdva/s1dJtjjQAWBWFa6bH3nbL7mruk0+zT7iuGFp6JUJqK5UBiLylH8BUOLhxp3AckSBBGOEVsAsrFHZnoHtjpcq+oiGQMsUKZXcJewgwdeHAv2xEprNlOrna1rNRrw4NHy+X3MdwQSRN1KYcwFRZqU6mbiXsxcBkBWo2NR34wwDXu8P040YVwFGV38nnF7GB+vSxNLbWQU6YeI8DSMTPCRd1PXBIAP4RhDWZ3CfOYQuVF3FiKdRS8xmU2KAbY0UMjs8/bDFquOsrjIooA7jfHPFauqgzs/AwpRt07VHtMV4vzCbIsGH0RdxQqZJ6ZcaiqsIi1ESCJdjXxrSk4V4G3UPndE3VoYtK3eoVDIHJC6L8Fv7ZXxAGBUQrXCqz1z1wCAH8h4hCHBYLBmCEaRy8zvwyMB17D+36jdWP8J6TLjoABaszbLUdZB5Wb8e4scGky608qxHqUOSF04F4gNSp1ANVEPBGSwjNJLiUxL1KXBaTZjhu4KkGoOAXC/CZ1/MMHi4TSEqCAyxG44Q21oLdMX8uiEGcKIGaTySpP57oF+AMK3nqYALQfoM/wBjG7ZxjD0NPvfxCdwXMHKpRGsNwyBUrPEoC2JZupX1L+pT1OqohOiYuM6lYjuNphgqKoiVhr+YZSDGKDCViE3lpBrUISz264D5YKF1GYNausUdEv6MPYNtQ9325+Jc5wNXCnzCbJpqOMQJbpL2gCAOYzaVYXXjoISNwkPFAOoPiV9QMPCCaTSdSkpMEOXh5iBX84MGDdwfMIOY5cILlEDQy4hKCxcD6C6O30zTlAPEC8EHxAdIl2ph1CRqUtIQGVYRzFyxLiVkFsKsyg43zPMcR3ACHMMOPwSypjY5szwoQZmn8twgwXDc7/AwiVE0iM3ZCvUGrgIjCQcCMwUyVjhqKWDLmFBhVBUF1AZQgSBiDHBghr8QSJgCBUAfzf/Z";let U=class extends l{constructor(){super(...arguments),this._refImage=I(),this._boundVisibilityHandler=this._visibilityHandler.bind(this),this._mediaLoadedInfo=null}async play(){this._cachedValueController?.startTimer()}async pause(){this._cachedValueController?.stopTimer()}async mute(){}async unmute(){}isMuted(){return!0}async seek(A){}async setControls(A){}isPaused(){return!this._cachedValueController?.hasTimer()}async getScreenshotURL(){return this._cachedValueController?.value??null}_getCameraEntity(){return(this.cameraConfig?.camera_entity||this.cameraConfig?.webrtc_card?.entity)??null}shouldUpdate(A){if(!this.hass||"visible"!==document.visibilityState)return!1;const e=this._getRelevantEntityForMode(this._resolveMode(this.imageConfig?.mode));return!A.has("hass")||1!=A.size||!e||(n(this.hass,A.get("hass"),[e])?(this._cachedValueController?.clearValue(),!0):!this.hasUpdated)}willUpdate(A){A.has("imageConfig")&&(this._cachedValueController&&this._cachedValueController.removeController(),this.imageConfig&&(this._cachedValueController=new p(this,this.imageConfig.refresh_seconds,this._getImageSource.bind(this),(()=>E(this)),(()=>u(this)))));const e=this._getRelevantEntityForMode(this._resolveMode(this.imageConfig?.mode));(A.has("cameraConfig")||A.has("view")||e&&!this._getAcceptableState(e))&&this._cachedValueController?.clearValue(),this._cachedValueController?.value||this._cachedValueController?.updateValue()}_getAcceptableState(A){const e=(A?this.hass?.states[A]:null)??null;return this.hass&&this.hass.connected&&e&&Date.now()-Date.parse(e.last_updated)<3e5?e:null}connectedCallback(){super.connectedCallback(),document.addEventListener("visibilitychange",this._boundVisibilityHandler),this._cachedValueController?.startTimer()}disconnectedCallback(){this._cachedValueController?.stopTimer(),document.removeEventListener("visibilitychange",this._boundVisibilityHandler),super.disconnectedCallback()}_visibilityHandler(){this._refImage.value&&("hidden"===document.visibilityState?(this._cachedValueController?.stopTimer(),this._cachedValueController?.clearValue(),this._forceSafeImage()):(this._cachedValueController?.startTimer(),this.requestUpdate()))}_buildImageURL(A){return A.searchParams.append("_t",String(Date.now())),A.toString()}_addQueryParametersToURL(A,e){if(e){const t=new URLSearchParams(e);for(const[e,i]of t.entries())A.searchParams.append(e,i)}return A}_getRelevantEntityForMode(A){return"camera"===A?this._getCameraEntity():"entity"===A?this.imageConfig?.entity??null:null}_resolveMode(A){if(!A)return"screensaver";if("auto"!==A)return A;const e=this._getCameraEntity();return this.imageConfig?.entity?"entity":this.imageConfig?.url?"url":e?"camera":"screensaver"}_getImageSource(){const A=this._resolveMode(this.imageConfig?.mode);if(this.hass&&"camera"===A){const A=this._getAcceptableState(this._getCameraEntity());if(A?.attributes.entity_picture){const e=new URL(A.attributes.entity_picture,document.baseURI);return this._addQueryParametersToURL(e,this.imageConfig?.entity_parameters),this._buildImageURL(e)}}if(this.hass&&"entity"===A&&this.imageConfig?.entity){const A=this._getAcceptableState(this.imageConfig?.entity);if(A?.attributes.entity_picture){const e=new URL(A.attributes.entity_picture,document.baseURI);return this._addQueryParametersToURL(e,this.imageConfig?.entity_parameters),this._buildImageURL(e)}}return"url"===A&&this.imageConfig?.url?this._buildImageURL(new URL(this.imageConfig.url,document.baseURI)):k}_forceSafeImage(A){this._refImage.value&&(this._refImage.value.src=!A&&this.imageConfig?.url?this.imageConfig.url:k)}render(){const A=this._cachedValueController?.value;return A?m` + {const e=Q(A,{player:this,capabilities:{supportsPause:!!this.imageConfig?.refresh_seconds}});e&&!M(this._mediaLoadedInfo,e)&&(this._mediaLoadedInfo=e,B(this,e))}} + @error=${()=>{const A=this._resolveMode(this.imageConfig?.mode);"camera"===A||"entity"===A?this._forceSafeImage(!0):"url"===A&&d(this,b("error.image_load_error"),{context:this.imageConfig})}} + /> + `:m``}static get styles(){return L(':host {\n background-color: var(--primary-background-color);\n background-position: center;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJjYW1lcmEtaXJpcy5zdmciCiAgIGlkPSJzdmc0IgogICB2ZXJzaW9uPSIxLjEiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjYjkzZTNlIgogICAgIGJvcmRlcmNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcm9wYWNpdHk9IjAuMjUiCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuNjA3ODQzMTQiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyNi42MjUwNiIKICAgICBpbmtzY2FwZTpjeD0iLTEuOTM0MjY4IgogICAgIGlua3NjYXBlOmN5PSIxNS42ODA3MTYiCiAgICAgaW5rc2NhcGU6d2luZG93LXdpZHRoPSIzODQwIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjE1MjciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEwODAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjIyNyIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiIC8+CiAgPGcKICAgICBpZD0iZzExMTkiCiAgICAgc3R5bGU9ImZpbGwtb3BhY2l0eTowLjA1O2ZpbGw6I2ZmZmZmZiI+CiAgICA8Y2lyY2xlCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eTowLjA1O3N0cm9rZS13aWR0aDoxLjM5NzI5IgogICAgICAgaWQ9InBhdGgxNzAiCiAgICAgICBjeD0iMTIiCiAgICAgICBjeT0iMTIiCiAgICAgICBpbmtzY2FwZTpsYWJlbD0iV2hpdGUgQmFja2dyb3VuZCIKICAgICAgIHI9IjExLjI1IiAvPgogICAgPHBhdGgKICAgICAgIGQ9Ik0gMTMuNzMwMDAxLDE1IDkuODMwMDAwMywyMS43NiBDIDEwLjUzLDIxLjkxIDExLjI1LDIyIDEyLDIyIGMgMi40MDAwMDEsMCA0LjYsLTAuODUgNi4zMiwtMi4yNSBMIDE0LjY2MDAwMSwxMy40IE0gMi40NjAwMDAzLDE1IGMgMC45MiwyLjkyIDMuMTUsNS4yNiA1Ljk5LDYuMzQgTCAxMi4xMiwxNSBtIC0zLjU3OTk5OTcsLTMgLTMuOSwtNi43NDk5OTk2IGMgLTEuNjQsMS43NDk5OTkgLTIuNjQsNC4xMzk5OTkzIC0yLjY0LDYuNzQ5OTk5NiAwLDAuNjggMC4wNywxLjM1IDAuMiwyIGggNy40OSBNIDIxLjgsOS45OTk5OTk3IEggMTQuMzEwMDAxIEwgMTQuNjAwMDAxLDEwLjUgMTkuMzYsMTguNzUgQyAyMSwxNi45NyAyMiwxNC42IDIyLDEyIDIyLDExLjMxIDIxLjkzLDEwLjY0IDIxLjgsOS45OTk5OTk3IG0gLTAuMjYsLTEgQyAyMC42Miw2LjA3MDAwMDUgMTguMzksMy43NDAwMDAyIDE1LjU1MDAwMSwyLjY2MDAwMDIgTCAxMS44OCw4Ljk5OTk5OTcgTSA5LjQwMDAwMDMsMTAuNSAxNC4xNzAwMDEsMi4yNDAwMDAyIGMgLTAuNywtMC4xNSAtMS40MjAwMDEsLTAuMjQgLTIuMTcwMDAxLC0wLjI0IC0yLjM5OTk5OTcsMCAtNC41OTk5OTk3LDAuODQgLTYuMzE5OTk5NywyLjI1MDAwMDMgbCAzLjY2LDYuMzQ5OTk5NSB6IgogICAgICAgaWQ9InBhdGgyIgogICAgICAgaW5rc2NhcGU6bGFiZWw9IklyaXMiCiAgICAgICBzdHlsZT0iZmlsbC1vcGFjaXR5OjAuMDU7ZmlsbDojZmZmZmZmIiAvPgogIDwvZz4KPC9zdmc+Cg==");\n background-size: 10%;\n background-position: center;\n}\n\nimg {\n width: 100%;\n height: 100%;\n display: block;\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}')}};c([s({attribute:!1})],U.prototype,"hass",void 0),c([s({attribute:!1})],U.prototype,"view",void 0),c([s({attribute:!1})],U.prototype,"cameraConfig",void 0),c([s({attribute:!1})],U.prototype,"cameraManager",void 0),c([s({attribute:!1,hasChanged:h})],U.prototype,"imageConfig",void 0),U=c([C("frigate-card-image")],U);export{U as FrigateCardImage}; diff --git a/config/www/community/frigate-hass-card/image-5371a090.js.gz b/config/www/community/frigate-hass-card/image-5371a090.js.gz new file mode 100644 index 00000000..149539da Binary files /dev/null and b/config/www/community/frigate-hass-card/image-5371a090.js.gz differ diff --git a/config/www/community/frigate-hass-card/image-632882b9.js b/config/www/community/frigate-hass-card/image-632882b9.js new file mode 100644 index 00000000..035c619e --- /dev/null +++ b/config/www/community/frigate-hass-card/image-632882b9.js @@ -0,0 +1,13 @@ +import{cL as A,cM as e,eR as t,eS as i,dC as a,cN as r,cO as g,dD as o,_ as c,n as s,cW as h,t as C,a as l,cR as I,eT as n,dy as E,dz as u,x as m,cV as w,eP as Q,i as M,cP as B,cQ as d,l as b,r as L}from"./card-769e2b91.js"; +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const D=A(class extends e{constructor(A){if(super(A),A.type!==t.PROPERTY&&A.type!==t.ATTRIBUTE&&A.type!==t.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!i(A))throw Error("`live` bindings can only contain a single expression")}render(A){return A}update(A,[e]){if(e===a||e===r)return e;const i=A.element,o=A.name;if(A.type===t.PROPERTY){if(e===i[o])return a}else if(A.type===t.BOOLEAN_ATTRIBUTE){if(!!e===i.hasAttribute(o))return a}else if(A.type===t.ATTRIBUTE&&i.getAttribute(o)===e+"")return a;return g(A),e}});class p{constructor(A,e,t,i,a){this._timer=new o,this._timerSeconds=e,this._callback=t,this._timerStartCallback=i,this._timerStopCallback=a,(this._host=A).addController(this)}removeController(){this.stopTimer(),this._host.removeController(this)}get value(){return this._value}updateValue(){this._value=this._callback()}clearValue(){this._value=void 0}stopTimer(){this._timer.isRunning()&&(this._timer.stop(),this._timerStopCallback?.())}startTimer(){this.stopTimer(),this._timerStartCallback?.(),this._timer.startRepeated(this._timerSeconds,(()=>{this.updateValue(),this._host.requestUpdate()}))}hasTimer(){return this._timer.isRunning()}hostConnected(){this.updateValue(),this.startTimer(),this._host.requestUpdate()}hostDisconnected(){this.clearValue(),this.stopTimer()}}var k="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAUDBAQEAwUEBAQFBQUGBwwIBwcHBw8LCwkMEQ8SEhEPERETFhwXExQaFRERGCEYGh0dHx8fExciJCIeJBweHx7/2wBDAQUFBQcGBw4ICA4eFBEUHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh7/wgARCAEVAewDAREAAhEBAxEB/8QAGwAAAwEAAwEAAAAAAAAAAAAAAAECAwQFBgf/xAAaAQEBAQEBAQEAAAAAAAAAAAAAAQIDBAUG/9oADAMBAAIQAxAAAAHu/wBF+fKuKWoua2zblcOpTDeJqLJsVgAACCiNQEKJRCmEoMAhy1FzThq4VrCHDWbHCoilBWQKqzaa2xeTz3Uumd+Z+h4Sxy0VGmdbzV5AybMdZjUz1kEFA4AAEAAdEFAAEVKBDVxc1UtSgiaY1cSI4nPfl/N6eZrHp/Rw11mLJq83XO9c2ovO+Ry6ea+j4FY1uKl1zrSAAIucd5mlYUoBggA1ACiRiVgiCiW81w6JQqWpazQVTQCo6fz9vH+L2ec83o937PJ7P6HgsBAaZ1vjemdJNcb5HLr536PgACrioqFU2RZFkWLcAgAAokdoEhRKwgoHCCgrKpWrlQ1ctQpVU0jovN38P4fZ1HDta+y9HD3f1Pm2jEBrm78+muNXNVnW2N6Z15z6fz7zWSlDEkVnrMWKyaVgOCkA6AkBipwKBDhgIa1AC3KoaiuJtmPP+b0eM8Ps6Pl01lprsenL6V9T5vadMUJEa41y+XXXGqmrzrTOrzamvNfU+brnThgRrOdk2Z6yqSKxBTAQAgojBBRQAHDhhDViRLc1cpKhV5rzd/nnz/dw+PbkIqheXrH036nz+578LipVY42xvl8u14uk1pjeuNXNB5f6vzNc6uERc56znokjUEBBYAFACGAIAAAAKDyoqaEJRWVNOOn5dfnXz/b5rz9he1zutRGtfSvo/O731+aoYwjTOuRz6b893nW2N6Z3ebpnTXyf1/laZ0xM5azGpFioQAVgCiAAKmgAAoCAhgpDHLctZoNUvh/H6vnfzvfjHJl56taNNT6L9L5voPT59s1UAVLti8nl2rN1zrbn00zq860zoPJ/Y+SDM7nPUmxWIBiQoAKABAAAAAFEQ1BIBFTV5uktTXnOXX4/8n6euNbnYzWVjXkdMfR/qfL7X0cNM63xqpagKl5PLrrjdy643rjeuN641cpL4n73xUFmdzNCAACFAAFAAgAAogACCiQCiUlqWoqa0zfkXzvo+Z8fq7XnvmVx9Zmu27cvon1Pmcrvwcu+N6S689a51pnWmdb8+m/PppjeuNbZ3ea5QZ4H9D8JWISKhAKIApgAAgAK0SCiiACCwCEooOWocvTcuvx74v1+RjfZmk1jrPp/Z4/cfU+a9QHHIxupeRz3tjXJ5dXLvz6crl11570zqpXRDVnz39F8BwqlDUSCgwABgMIVORqkLEoAAJAFQAqsakOX5T8j6nQ+P19xNTc8nHXk9uP1L7fxI3hUK5d8a2xrk8+muNcnj25HPptjfI59NM6AHDVqHz79D+fCbFokAoHAAwAcEFEMWghKgALEgoAhaCiPLznm9Py3431+djXay8TU7vty919L5/YejzTYhDl3xrl8+nJ5dd+XTkc+nJ5ddcavOnKqCotoA+efovz9RGorEFMIYQUDQlYBAAtQAIKIVgoqRiqbAcuWNfH/AIv2ev4du3zrSqj6R9L5/fezxRYqRUC65vL5dOTx7crl15PLrtjd5tTRBTilagHzr9H+eZNgAwpwAADgGAQUAKwUQAQArjLG+s83p7P3+BhnXy/5H1vN+T1b5vPa1s9r34+++h87PWc9RwE2TV5cjn05vDvz/P6N+e9MbuWlBqAAQHzn9N+ecKwgGFjlBhBRDAIACkMSClEi0UOXTNpfN+L3ec+D+k7z6Xx+r8/o8FvlWddkbHP6Y+vfT+VyZqUmzTOtcbZnrNTXK49eVy67c9643rnVNAAAAAR84/TfnmgADgGADgAKcFEIBolKAEiRWhWbyMbivi3wf0EcuvKmuH38mWNdrbon036fy+768dsbcumd6Y1rjfL5dalBy0ry1zvXG6UAAAAA+cfpPzrAdAAMIcEFAACFoAISlCJSxQrUjl1zry3l9Pyz5P1MY1O72wxruK9F6vL7j6PzNc6359N8dORy6a43rje+NuAnRDjTGts7uaAAAAAPnH6T886IaFAQwGOEAAFAgAAAAAQ5Vm+D8Pt8J873xLKJeyrntdpL9I+n8vse/m1zvTOtM65vn9G/PpvjdQE1lrKRrUuuNbY3pNgAAAB85/S/niAdhBRDGAQUIKIgBSkEACpwEYvmPH7fCeH2dVx2mmVLFNnvLruq+o/R+ZyOvCprTO2c3z+jmce2uNMipsz1nPeHNa41rne3PWudtQAAAPnH6T86DAB0Q6IcFFJCBSwhKCBBQ43PfQ+fv5zyerzfl9XGzYRy6LCCiKucdxqfZPs/Fcu+OnJ5dUmmd87z+jkc9hOk2QznuXm6Z1pnWuN6501AEJGofOf0v51wAADGAQWCiClAgEEB13Lr82+T9TpOHaEUOXlzVmlaDlzlmzg3N12J9p+x8blaztjfJ5dtcbqORz68nl1cKgmxI2rmqy1xrSbYEiZais+c/pfzzQgAdOAAAAAKQQgpRwuXX5N8X6/X8+hHLObNaLnZRUFVL3HLp6P0eXzPSddJ0fPp9G4693+g+Lvm8nl15fHtU1rjV5rWpqoBDVxebpndytUJEjVqz5x+k/PMEFKcjAIKEFAAQhBWeNfJ/ifY6Xh25kvPWrMiluXVexzPQ/Q8HoPf4OT24llZvH8vp+X/ABPt9fqfSvT5fX/R8PL49eXx7OUVoS1LUuudENai860ztqwAEFAPnf6P88QtFRIU4YQUAOFaCRUiZfmHxvreb8vp5Evay1YWcatJe+9Pn9f7/ndp6fPGiSpRKl359PM/N9/kvN6uQfSvX5O81ORy63mxqTrNZ1rnTl0zqoqW86qaqVq4KAAAPnX6P8+IrFTHKIwhUwHCpWkIVnhPmfQ8N876HNl3rQYrnkdM/QfpfM7f1+VWCkXLedXCNcbvN+a/K+p6j0+fpPL6vqnq82+NXnUazNjNcbvOrlcC1LedXm0rUCAAoPm/6X88SA6ZWaBQhDBUipFZpb53y+r538f6txnWpVmusfTfqfL7D0cTWVQhDmtZrTN0zrTLfn00zrjY38u8fs+gduPF59PadMXmgE2VLctTSRq5by1zu86pQMgKAPm36b86wh2seQjUokqUEToi83qePb5b8b6153QrGdv25fRvq/K5PTDSLA0zqpXDW5dcXk8+nI5ddM6cvTZ347n07BPb9McrNqVjlcquW05QqXXFvOtJpqBAEAHzf9P+dACCql0zXEWMagkjSs3jc+nyf4/1sOfTSWyLO87+f6N9X5fJ1EBNjipdJalqWjbnvlce2/PprndZoeXzvgmlnsrnTN0zsVWRc3NXmuXTOtM6pQAAAAI+bfpfzgNUMoZWarCWgWbIoxr5b8f6/V8O2hcvYaz636Hz/Sezyck0zpWJLlZFgJbl0zeTy6czj25HLrU040zpnQY6d9rFDilCUVaY1rnVzTUAAAAAAPmv6T86wBGrCiAocriNJTwHyfq+U8Xr2NK9j6fN7j6Pz63ijk8+jgBBdsaqWUw6Yqa2xrXG+Xx7b8+ly1nVy6Z1WaCqNZVjzWVLpndKAAAAAAAB81/SfnC1hIDtBhDHKQjy/k9fgPk/V7beO69HD1Hp8/e+jz6ZrSbNM60zdM6i5z3nbn05fHtpnXH6c1W2N6Y1tjemdXnWmbedaZ2xIiNZjWQrOtc6poAAAAAAAAPmf6X845XRIwV2uAqLzoTi8uvnvH7O16c+768uRrNDluHGeo0vOtsbjWYueRz68nl10zus1rebct51UrlqNM7uVqIEmW+cay5rTGrmqUAAAAAAAD5l+l/OMYQwKtcripdc6uJ8nr7a5DXG9M6x3zy3loLFyJlvJLUa53yeXXbHTfnu86ZedVm6TQCOW5qpWoAJnc5ayy5qs22gAAAAAAAPmX6b825QcOiKtakmmdVLpm9t5PTyOfSprfnu86z1ni9uMazGs5bzFzjvIuubyuPXkcuu+OmmNXLeNbY1U01STqVLebTQAAJJQGtAoEFAAAAAAf/EACkQAAEEAgIBBAIDAQEBAAAAAAEAAgMEBREQIBITIUBQFCIGMDFBFSP/2gAIAQEAAQUC6hDofrwE1D+gIdDwfpNqxZggbNnAXQQ5Kwom+DOQgEBwEFrjXGkOpKJ+kuZKrWVvMWJUXeTsDVsMQ6gIDjSa1ALS8VpaWlrqfo7uUrVlcytqwhG8rwaFim0GzjqAgFpaQCA50tLS19Pcy9SBXMpYsrW0PZHax1J1ySjViqxjo0JoQHAC0tcBD6MdcjloKqu5GzaMMZI1pa4q1ZrMmMpMpxBDoxDkIchDk/R38hXptv5izYTimAl2zx4uKirSyyYim6pBpa6BNHAQCCHIQ5P0GuM1mPTT3lxUUJcgGtQCLXKNs7zhq81eu3s0IcBDgdifov5Db/GpOO1FE6VRQ/s4+y0CoK80rsZXdWqhBDjS0g1NatIBBqAQCAWlrja388chfyC3+TeVD/5Sy68/bijSltGnB+NXQQ4bwAgE0IBBqAQC19PtZu3+LRJ2q0fm4f7M0sQCxWMc6VrWsbwE3hqCAWkwIBAIfVZy3+TbYNuDWta9VnhyoVX2LX/OjUE1BNQag1AfV565+PVcdqkP3sBoR9xg6vqZCrTirSdAmhAJoTQmhBD6ueVkMN+y6zZHuWjxa8pgWDpehWIWuNLS0moJqaEAh119FJ5+Fa4JJOJHMijy+RdbkKrj9h/p91hcc90WkQtLS8V48NCaFGE0ID6cLSzNYPhNyz6dHMQyr+T+qXJo2QxrQG6VCo+1aiaGMCKAQCDV6a9JNjTWINQQ+nBQKc0OEkz6tya5t8V10jJmaMTSSxvtolYmr+LWCHDWrxTAgF4rxWuQh9O1ZvKNga874YdKPUsNc6k0Y34Wn52EE1BNCAQCHYIfTPLWMymb2nHyK1xVk0+WLb2bLMZCIqAagEE1NTUOu1tAoFD6OSRkTbmcgjV29YtO6FN9jE/yZjx52arDFXQWk1MTUOh5CCCHz5bEESsZupGrGctPUs75XE8BBjii0hNBJWlDoNx0xFkoIJqITE0odCtIBBBBD5t+3FUiu5OxYJcSt8AEoV3kCshGGoex9t+jomPyJBaWHRpvNexDI2aJqCaeAE1DrrkIfNu2Y6sF61Jan4ZXcQxjGD9db415BjduLC12Mr2JF/48L68uJsvnyGKsVZfJYa/tjSgmhNHA433CHzJZGRR5O263YUcBeoowxErSA9gAS6N8clenudmHb6sUEER2toFWofWiyNdvlVc6E4e2HhqYh12h1HzCQ1uYyBtSbUTNljkTobBBPu1U8XPMq9CrAieoQWaq+TcYIzas1pcbYxdgWa7Qh0HA/v38L+Q3/f3Ka1qPuWeyemD9Y60srocZTiPTSAXivFNavFZqia0uMljymOpSSYvJNIIHQcDqPl5e+K0etqb3LRzHDPIG1YparWhjOw4DUGoNVqsyxAPWxOTuwR36n8es7a3+sIIfIyVxlOB73zSjpjqL7hqwsrwddLS0gEAmBAIBaWVoMu18FZfTtZmF9O1XlbNDzrkchDgf3BHuFbnjrQXLEluf/gQTP2diKTprUUbI2865HRqaEBzpZrGC2zFWhbhwfq1rKCA6BaWkAtfB33c5rGZW665OOB/lWnNPHg6H47WMa0NatLS0vFeK1yEE1NQ5AWlexcdicMG9LXTSAWlr5Wcv+q5vuf8AuiXQYSQsjYGN0mhALS0tcNC8EYkWJrUGprUwIcaQWlpa7AIfLzdwwsmjeySWg+vRw2JLlSxsFZ4WlrgIcHhiHDmoNQagEAgEOB1PIQ+XcmbWrYyjM5UMXHA51dj3+C8V4rXGuBweGBDjS8UAtIDkIdSjyEPjjhn+zUhYm9NeCaxemnM77W0AmoIdNf1noPjjiP8A2M+yCHDgiODw7lqagghwAgOw+R//xAAsEQABBAEEAQQCAQQDAAAAAAABAAIDERAEEiAhMRMwQFAiQQUUQlFhIzIz/9oACAEDAQE/AfaPwB7Y+KPZHC0flj3GsLvCbpT/AHFF8bP+oRO43yGBms19WyB7kzSsHlCgtTM0jbypDLQgMUq+rZp3O89JkLWeFRVKXdR7rkEFSpUgM19VHpnO89JkLWeM0VI8Mbaklc/zxAQCrACr3L+gjgc/tRxtZ4QGaT3BnZU05k6/XIIZCH0tYGWROf4UcLWYGaTjtFlaicSdDm0YCpDA+mrEEO7s5rAVFF+3yVqJmyHpDgMAIYCGAPqImb3VgC0ETik+RrPJWolEh6QwOACa1UgEAgEAqVKs39EFpWU2/wDOGdFHMkzY/Kmm9U3zAQCAVIBAKlXC/pImb3bUEO1aIpV/lTztaKae0ST55BAIBUmhAIBV9VpY9rbP7yVGQfxKmf6Te047jfMBAJqpBqA+r00W92Go4lJjbam1DpBR5BAIBAIBDA+qaCTQUUQjbWbVLUybvx5hBNTQgPqGP2m1JpdzfUi7GAgLWn0+zs+cDMuo2t2DzwpUqxSATQgEFX09L+P1f9PJ+XgrV6COvUYEP42GZ/4Gv9KT+Pbpm7m8XvDBaJs2UEcAINXpr00I01iDcD6cZ0WtliYKUkrd++Ppf1Bcwschwnl3u4Bq2poQC2raqyEPpwoIPU7Pji3Gpk2NrAQQQCAQHMIfTBqi0v7egONILU9yFUqQQQQ52rVoH6NoLugo9I7+5MibH45hF+3tTyB77GaQTUPaH0DY3u8BN0bz56TNHGPPaaA3ocKVcSL6wEEFSaU08qwMD50URkNBRQNj8cdq2qs0qzSlidG6iggmnACbxpVwHzYozIaCYwMFDO3F8aUUrIzUnhanWxRvqMWjqYnC7UUgkvb+sSxCdlftVRo4AQCpDF+wPmMaXGgoYhGKxWL4EV5RLWi7Tte2ugn6iR/kqycBQSmJ+4I04bgmmlrIb/5AgE1DN5HEfMAtaeD0x/vgeEuqYwf5T9XI798KVYC0k1fgVKCOx5UMweFLF6bqQCHAfR6WGvyPEoJzwAn6p540qVKkAgoJN4o+VKwxutq/9WIIYpUhgcLQPy9LBvNnwq4lwCM7g40UST2eIQzSDVtTbabCNSNUTzE5TMo7ghwrA4hBD5EMRkKaABQ4yTNj8qSQvNn2qTRgBUmHaVIyxuCjdY2leOFKsDgAq+OExheaCYwMFDjPN6YTnuebPCuYQQGaTHbU9ldhOF94CrgMUgFXwb5tF9BQxemOBeB0VqZ+6aiS42UAqzSrgFSamhAZAVJppUq5AKlXytLBtG48HaloBTnF3lUqzWQFsXpotQC2oNQGKzSpVypAfL0sO47iimyBxoKXUbemqXUl/XIYOGoYIQag1AKlWQhwrgPlxx7zSfIB+A8KScu6b4Qc4CgqVKlXAK8tCGKVKlSriOJ+WMBR/iOltW1Bi2Itr2QE3AwM17RVKvkjDUzAQwQqwcHg1BDgAq9yvg//xAAsEQABBAEDBAICAgEFAAAAAAABAAIDERAEEiATITFQMEAiQTJhIxQVM0JR/9oACAECAQE/Afmr1h9q6RrPKdq/00JrJH/yKa0NFDiVeDwv4q9G/UMYn6qR3hdytLp3A7ieRKOS5Xi1fq5NSxvhSTverxCRY7WeRKJV4tHjfEZH3z2Umqa3wpJ3yec2omdR21RxNjHbiSiVeCVav1cuoaxSTOf5V8GMc801QacR9/3yKPrpJms8qTUOfxtNaXGgtNp+l+R88iUTgq/hHotRPt/EInjaazd4C00Do7JR5HJRzav00r9jC5WiawMWmRuf4WnhMY78bVolFytErcrVq1avNeiK1Ulu2/8AmHiwhmKB0nhQQiIVxOLVolWiVav4qVfelk6bd2CqQN40+nc424dkAB45FFEq04olWr9Vq5N7qH6yE8V+QUTOqaCY3aK5FFEpy3IuRPq9TL02/wB4Kbf7xC0SOpRQNjNjkUSiUSiUfkHoHODRZU0vUdeAqxpo9o3IHkUU5Eon46+5akZvb2UWrp3Tl7HJdS1M/U7Dxxi0+5284BVq1avBKJTiiUT6i1rtJ12WPIUGrk/gSv8AcJYmfl3TNc7UdjxYwyGggK7YCtWi5b11EZEXon1NZ1WnYZCms/Ha/uhEA4EJ2AqUMWxvAuVpxVrcr4H1BU8/T8eUTwKC08e43koolEon1xKm1f6Yib4DOmoMV5KKPCsUqVIhH6dfQc4N8qTWNH8VJM5/lXzDd3ZQsLGUVWSnchwKPoHSsb5KdrWDwn6158IuLvPxAoDBRQKciOVq8n70szYhZUuofJxtXmlavIKhlbK2wjgjFoo+mlkEbbKkkMhs5vFcbUkTpB+HlaXSyyMuTsv9PI00pWdKt37xDIdLLf8A1KsEWMOKJ+M/dc4NFlTSmR14vkDY7IbnnaGlN0Dv2UzTMZ4C2qlS1MDZmFpTCR+LvITm7gtDMW/4nIpyOaxXoiaWon6h/rgAqzFpXv8A6TNJG39IDhaONZp7/wAjfIUTgVNCWd1DN1GIlHgVfotZPf4DiMNYXJmkYONq1atEolTRdN1jwo3CRu0r/hfg4CtHnX2gtVqNg2jzya0lDTtLRaDQOwzfA4tbluTqcKKFxuUrBKxQusbSj6WaURNRcXGzxiidL4UcYY2hzvJKcVatWnjcFG7aaKe2nbgvPC/QPeGCypJDI6zx08XUd3TWBgocL5lEonNp4tMffYpprt8Fq1f0aVc3Gu5U8vUPANJFhaaDtbk1oaKCvF4tblfAopyvNq0RatWrzatEq/sjGr1G47RwZpX2E1oaKCtE4tWrwSt6EiDkXLci5OObVq1avA4X9zVT7BtHnDoy0WVDpy/u5Q6YR9z3Ob4jDkcAouRcrV/CD9+SQMbaZETbz5UUAb3d3KLWk2VuW5WrxfAYccWrW5WrV/EPulSfke63rei9b0Hc6wSjg5tX8YVq/tuT8FHDSgcDAyUUUckq8j7f/8QANxAAAQMBBQYEAwcFAQAAAAAAAQACAxEQEiExUQQTIjJBUCAjUmFxgaEwM0JikcHRBRRAYOFy/9oACAEBAAY/Av8Ab6zSNZ8Vc2SF0rtSr207RuG+iPNBoJNNTXvNHPvO9LVSOkDfqqm9I7Ulb2QNjachdxPeaV3j9Gq7euM0asli5MZGH7RL6rtGt7xRrt6/Rqu1uM0bZgsUQ0igzJVyMfE692LG+bJoMgvMfw+kZIuPguxtJVBi88x7rxuq/wBAzRAO7Z6W2YW4BXGNLj7Ihxq52Y07qdn2V3F+J6JJqbKnAKjRZkrsd4nQIia7U9Kd1ow0fJgLKMxOiN/CnS3NUiaXfBXH3b1endnXTwM4W2NkcMETbWMcIzJQiDr3dnUPG/BtlTkLcRgVvNoj8rQ9VdY0NGg7uSORuDVRUbYYZOU5exW4HKMSfZU7vum/eSfQWXim3MqY2M3gq0NvJ7468Xd3SyHhanSu62AIJt4G6TRCVxq+Rv6DuZ3brruhojBKN3M3NuvwtL5DdaOqutwiGQsrpbG+cNMRN673UzjB8Yr8kDxPLciM/wDqEZY/eIUfWMdLAFQWCMYDq5NY3JooO60OSk3D+AONEJIQY304qap7ZiX3lhlZihQVOSunmdi7ux2eE1lOZ9Pgu9eixWozRnrwRnD37qXvcGtHUoxbJgPWqnw32mlV+ZqiAFCRePc70j2tHuUWwN3h16KsrzTTp4/ZMiOF40qmRuIJaKdw8yVjfiV5YdIf0C8u7GPbNVke5x9zbgsrKWkE5j9FE8dHdvvyHHo3Vc11vpCxNuS6LFypZQ5K+OVUVFUYJklA6hyTZG5Htpkk+Q1Rlk+Q0swVTgsqqlLKqqp1V0ggoncl8XVB7b8cujslcMVPforoG8bdvVFjb3wcqjLtZkeaNCLzyjlFlcgsvn4ANVdkBb8QmhkjHh2gKBkc271DaqscQHgoOcYtRNKFVxwOaEROB5f47UXE0AV1hpE3L3sqVSytnWhR3g3TNXDFNoy84dXfYGdo/wDf8p2ybR93Nh8D0KDXGrDyuCvfjGDu0/2kRwHOf2sGGPgocNE3ynmvUBAhhcR6j9neZyHlP7Iwz4vbg7+VupuXI+7dVUZdn3bD5rvosVgKKtt9kbnNrSoChZtELS5jQgxoo0ZD7R0UgwP0V4jLP8wTZYqF1KsP7J2yP5o+WunZrxxeeUIySGpPhdQ3WjqUImZD6/b3cpBylHYNoq1pOFfwlM/qMHq4wmysPC4VHZDLIcB9UZH/ACGngwQMjDuhmrkbQ1un+DvI8J25fmT9g2webSmPX/qm/p0lSG8Ubuxl7jRozKwwjHKPBI9jcGDFGaVvG7IHorrGho0H+GzaGvMUrfxAKtMexnZ4j5beY6myiutFSozI+7XnGio0U6943EX3r/oFuSDeGaEsho954WdaaoTbU3h6N1V8cT9T07y6Z3T6p+3TU378Yw7ot7J5sxxLig9zAXNy73GZMY2Y3dT/ALh//8QAKhABAAICAQMCBgIDAQAAAAAAAQARECExQVFhIHEwQFCBkbGh8MHR4fH/2gAIAQEAAT8hhBgwyGCcYxl/LkIes9JlIkPQFrBxgwQxGLl4PywlSoQhCVhyPoUqnlt+0v1GjQfjlle9ehX5dIJpdTp+7hlQemI1GKhAQgQl4vIX8oQxUrJlzcuW1H8jLNvB3+cLdDmLsspP5nYYmQzVTli0emiCKwxYvliEPSYvCy4YnzLj3Zci14vyzd2PLHizFp5391bggZM2QZMEIZBFYWOH0vx6lQMkMVlZdCug5Yg/iR+Zd7bxfmdyOtVv23L+b92CH7ekPacvTz85HF8HBWIgipywqVGLFjFl/JmD1glRxxxep+RjO06NYmhA4mrRGK7XLzzq9D3ilv7Ug9AMOMIYCVK9BcUWLF+XIZqVCDh545f5dps1+pz7vWKtwkWgCbX3lzrCBlXpFociHEEkVWAhxkOAYBKgyWKLH5kYMMVhUuahoOng/wBxKycq8xblDb305gmhLtavywUCbl3GJvbsAs93rhWSBiGoZwggSsDLwLF+cIMGER7quOh1f73jKNIHkbYPUnuBQBQaAn2nSG+zLDLw1CW5s048X1yqBfw+vKmBci/QBhRLP+4zrHvVuzxEhg28957Iu+bIuCJ2ZCRKK3VZHUMCWyj1DKRWbjh+eJcIsFX/AGmMoHlCfhigapLHvHEdXqF1gLNN4XIeAojlwhDDNU5eggegJX0WwN/f/Mr+FzoN5i0NQ/b2vrK6B1dx4SqFlorcckUMGoYfQUGLwel+OfJEy6a/YzrJXS0R1arR2ZfbApLjOicfublHf0O2KlSvWoUwQl5IZJcX58lCAL9/ETXlo7HaDggkcnMVeype8hTNUSdPNWRUMGmLm+aECBKlQgPQfOVAg03UH3IFnSs15RzAYI0Nqm07fe8su7snLsKSaFXFSEKduqIaayC+LCYGiZgIECVK+gk2jPXsh3EDxj2Svnp+3mcaZ1KP4mySeLxZ/wCxIbjVtXHSXfLLVvEurDdGgg8UT2CcIZZKZdg+EXGRBiQPoxcRAAopGGmpi7KuEvrwnwja4FK9bgXcmyaiS8vVAJazQ6wj2dK48fbBSr9ABqUlIQQ+lU7YKP8ArcuXi9LHo7jg2uEnA9APiE7Ude7n+IOQzRlx6CEUUH6HUCcuIEoJWv8AA9b7doqIq4YNMo91A5OXUp0Sv8kEoH5VyGkW5xgghGLF9ITh9AvCTuHVL0u/1FqLoOh9pd4Emq1BHCoF7L7Mu5YfvTd2AOJeHCaMeRixwuEH0Jfid2whPBoWIPuv5Med4LpbLvmWWoMW+odaaeJWERumKnfRHXRLmFLhi3iYLJTFTmMfSA9avB8vtcXFyo3t9PSR60fvG2NaJl9/aM6ofaeYd5fR/wCwLDtwr2dF1C6a+GXF0i+wIGqIvf4l4dN08nhwWILwGo9RcVKwCGQ+Meo+AuXjqLtEo/QO0Xe5VtRx49nmDqs6qS7SR50QcbdOScPz1lBVVoo5Y4G++o5dpq8L48w6rWdZf5luthrrUXzFztAXT2igO5N6LQB3Dr7n6hIIKLE6zfFolYjgMH0GQ9R8qAstqy/A1dsjuDbaNMf700o3EUzls9sjcrV13drzHdAB0/d0QCeHuH5iRGlXy/zChRqXiRr0Nq9+z4eIu7Zfceo+YNNCD9cZvX/I+8ME4xIS4ODhgIEEPTXoD0nxTBCtXpGLOF/ZluI/AhCbbq9R93R1KAHMp8pd6cLRe5UHDf6Ihibra9+3ESLjmVFHqDpr+H96f+QQa3XqfB+vuxau/pf+JDSThTv39n0FzCCECEIYPgEXLyYPh2rsy6sJup3BnMOY2A5TYl1y3MVeJ8nZNiFLs/jiLeSHopolURBHSMO2cna/4/XtNW+8ngxKDTacdp7c/mEEFFidc0iYjlcGDFCHxCHpPSRnFwarp7yjAX1mogDsRDC9QT1NAXApUa0j9oUIlB0zUqEMSWTXh7UQeq6JOjBanC9T+6Yo4fLjyveK7T3zx+0WCJKhCXgyXx1ZIZYQ4jirQ77/AKjqX2rOcdk8S91KJOlNX2hv9x7u8rDCBDCesQFwq2f8b4mu0H8b7MA/R9x/pl0oUCEqEV6QggQfFMRkxccKBnEd3aKfz7A7QKpB0nPfBAqFXxFTNna+IDCuBAjKjAQwIQgyQSsKxhNuzsx0wG+Kf9JRFvQ0nb+b/MCDBWTgYpFfGJeRDDgRZbTpN6K6/wA8Nbh3hvQtdE5LA058HmKLU0Lg95UwehRgIYIMLXF4DE3BAgZKskHqq4uAVVilrEySGEQfIj0DLlxxzaur+1Y93RKJCdoDnk6o6feU7hbeV5Y4uj0Mlk3wKehCiCBCBCDEkYYrAPkzJgxUvPp3UnQTa9bmld1fuLt0iqBzXT7+xEhPS/ShhDpA3kDXojqJqWeoMBAggZqCMPkgyekgSp0veju6Ep0ieAfRYoWx5DxAlIjTi+YPEghNTlAY4JWFYDKuE0wmBUrIYqVBkRRfKHohqC4Xc0/7/t/mACqhiOkolSokqMXcJLYjgcECEBKwQh6RKgSsD5AyYMV9BBDKhQbiTjCKpeBDrEYGIJWHB6ySpUCV8b//2gAMAwEAAgADAAAAEH2HUWVRt01vusrnCqQdyy4N9XeYWWL2cdbhqRx0hGkn/wAs0nkte+AQgaKPE2wWfkGt2j1Y/JJpId4PnLAe3/kikDJPKyX9pQNglIi9KcD3LyLIV2KB7QVOhQZHc7sQaly8r7/4D4Qydu2J49xjIXy8xb5zVpyBHOglgjzzstSQq/p8m8/zqMBYezDcRwhuKVZtACMCW0WTFLAy1sZGYTVrfsdgKP3Q3F7rKImyM8xCB83o55LZ6wGYu5RdeI7Lp6AMoRWg4CLzuePJ7M55rLG3M4oebZO68kG2S/DT0p3Th/cUmwbUm7g/skONjaEm2qCyavWvb6KYFW2AmKms78tEtYtZbdAacIzaL9b6iRIf5emPy+0ABiRvgoxTAR8dgDbD5plFyEogUtcBEv8Am8krr0HX0PRe1t89izE+0Gjz8jUaolnmsk5yyiks1bZKkkNqS2w52KAqkjWVytEkmiuysoYxLaGX0Y/4aHqrhKS5MZ6YkkkmhsqzkkkQOp9gfQRBkAFYPmxJR4kkkkkb4Epj1ujAAUPLDQOrC6wQNRtM+AkkkkQzNwgHiYE28zo6YUo8csVUJJ3iREkkkCxdyIQYPqE2UUYrF8dAbxwpfhiBMkkk3+ww3QnxeW+y7PLTznY8DudN8XMMgHkrSWzu++IgiYVZqRZkUV/WYn7Xgnkk6khawJJQuMXP3iflDG6A+EBhYBPQQMn6A26DRwYBa/r+b/imdAcuoISNcLhqkgMkLg10wsUTJlq2+UaWXKVLueOM9rmmkkkncCt+MbCVspCfTY5xK9Il1hvLkmskmkHxIQqM7/EQmpcQNRUuLuw2WZXkoEm00oQG6Df4BzRLB39WcnufoYWtzmwfMmm2AKgGyksQOV3Rqr9fM2DZszWWBkgkkkkXW3qeeGsg2eGFYhkGJlRzvk65Ekkkkky+Ti1yD25a5AtyDMXfugXkmYkkkkkkkcL9pZf+MoG7i7OqkFJtorQTzkkkkkkkmCfngR+ZIUUu06s8RU1hhMJikkkkkkktGftSppknhiZ/VhReALFkhOoQkkkkkkInvAZg3jSpMLQ+AHeigckkv8Mmkkkkk//EACkRAAMAAgIBAwQBBQEAAAAAAAABERAhIDFBMFFhgaGx0XFAkeHw8cH/2gAIAQMBAT8QzRCdQmJkEkQsUuLxmLCjE5lBeiWKL0UTEwjQsExOi6GUXXF0XgPKxvitnR2LYmdjYniwTJiZIaEuE4I160SVh/H7NRZ+7H0ZQkJa4KGsEtEEFmjGxsvClKUTwhiJBZWh0QnlEEsJiylw2Mi+Tc7v/fBHEiAKv8ft8UhBCQlw6BojCQWIQbKP0IQgtkOxcJwQhEFhdCQuO+0fP6OiV+7E4hdiO6EX3/6TigooFQsZLCDRCEy+SylntYpRP0Esp4lEsLC24j2I+/8AY6tv3feE/Yttll2Nb09hMeFgWJUTJSIIXBvDLg2UfJCOspHWEXKEI7wkISFlZWkJNf2aLiUXtE1YaBrBD6wlj0ExLBBLCFijeG9FxOE4pZuKMWi0vG4Qg2EbxNe5tJX7sh2GNCd+BFGIkL0vPkhDoSEqJYEhBBBCEELDZRso+FFzomJEEPQxEEoXFELMCR8L/Ikkdis0uhLinsEKC8fIw0LQ0I8WEiFggihJmlGylLi5XGlEd8FjvhcIQtCYhEl+u3/H+X9qQb1E98kPpiGyF1rJ9xhDYhGNfEK3AmFkuDZdYReK4dYSFiUhcI6LwTwsLDae/wAPH7+olBtzJtNDYnv9g7SmEJCELDDEs1QXCsnil9FsuEMTEUhBaLcrZBawnjwRvDz/AB/nr6iC9mLYugo+A4ANa2UI7EKGjhCgo4JEy8P04QSIPsRJwb4rEZsTw3z34eBI0tLBT4/Hwyg9h7G7ZRYQhI0DBBGWCcEuLw2T0FyeE8JCWUjo7E0XFx2fS2//ABEp22Ik9D6Hle/Aj+D7kIQRBeBchYhZUQuNG/QWJvmsIuhDwsdkGsdiYldjFBfr8sSJMFsm+hzT0hqMgkQhMGEuSSEhYgkJcExvC9KE49Y6WFopKJQhDdlV5XwN7F8eUN4OZJKtil8j7EZ2LhbvIO9saJw0EHMcsSCCRCei+Gxems74rCwkpK5Jr2ur+xZlWn2ot/v8lYz+C/2d19RIRbpt9/7rwQREkJUug13YyRYJUiUGLHiFgWsEhejcLM9FcfOUxDwh6YwnUSjvappVPaHoLfa8X4+DvRev74oZdHR9LoT2JkpI2wVIIFAvWF6lwli4uVrPkQ1mxv8Aq+P4939P4SSKWD2MO00ntlpWKGjIrXBYYb0pl8exC5z0khjcP0n7/QhaRDY0JoVbQlZaD8CgQ0HrOovDobomUIr1BeKzRCxSiKJ4oncvDSFY1t4vv+jru/fyQQmIaF2N4IHHQ3rif6KI6GrHO/B9D1hCVFgvQby+D40sxOMxZ2drv6Hiv3fj9nlf+vgTRi+BvCFQ2EniC0hCNhuPIuhyyD5DwSEEsF1xvrJCR3yQkeHnlibSv3ZTR2JUTQQ0FoXyXL4ErcI04zsfhRjXg0wJXCkF1mDwpTCwXFcHyWeuKz1l4v4oIJJESCeLRKjZONFeJN4b+4p6jzap+z7KvP8Ab9D1P+HhlPb70/8AwbORtC40JzBNcFobEdBdZeEuEF6DFyRRA7GQL6kNxKD2yknoa80HZ10vktdv8iiPaH2HhmKH1PleRluhl4ifq84J4bMokIJcZwhMUvFcZwY0XYir7CEhPwNBMpdbIpbf75La0XwbPBMEEsL/AAvr4f8AkWPoDMn9UXU68YlINzKCQsJCWE56NGy5hMpTKFwR+Ji6Eh0SwhLYzNtaL6Ti+C0kEIQWBYqQdc0+6/wdBkzWrtCeMIMMaF4KLIXoLhOEwkQgsJEPZt9xItIYmM6O9Y/tTbHr7HiEEhBBCjFWBFkNDRTf+plS/qK8CzqUWSGKUTyYb0kpwj4IRMJYm/C7EpGkJ3FGyT7xjKEwiCQlhLJSyG2E4m6NoxbFhNwIJCwIJeiniiEIayhlySQUSQkIbRsU9lj1iWJrBLCKJiYtFwJJCSwfo+inxkKUSEokXBCCwUJ6SxM0QohcHv5BMfL7xTwPV2MrV1+R8ZWNEIJCvGCwlFgpghD3MYWntCQkSgkTCQwRSL1ITC5LNEe4f4I28NJC4W39mMq1GEEosoUsOhhiLiwpCEEkhIWU1BieIIQ9ZMvBbysJEIe3K/JCUWxl2zyK8x/gRwohIhEJbySEzQmi5DBEQQSgkIJwYagmL+gMWijwniYQkQetRmup3PwIuoObtMrBChoSNjCSD2JYkEqIyIIpEJMghZQg0JhMTE/6ClxRFwgtISsZt835xXDckQaPI+sJluNIJCaOsIJCEwlhLhBMEEhevcIRBZQp2G0XBSCmNUxo0FvCiEdMUEhbEpgSEg1hIXKDQgkJT1v/xAApEQEBAQACAgECBQUBAQAAAAABABEQISAxQTBRQGGhsdFxgZHB8OHx/9oACAECAQE/EA2zjLJJvXJEEEQ4PwJL5LznPx4MMMM8PBLOpj1y8M8ZZBBBHr8Gy2274NtsPkl7jkC9qG3I+xwgI42Uzp4L3Dbw2WZsssggiH198H1P0Q8es3X8rrOp/wB8yNq22gfv/B47wK23OJm8CbbbwPARHO/SbPDYbZeV43l4756Xs/8AfN7Fw+xYtfiOQ/2Pz+fXGx4gxZq52HhvIQ4OByeO22cPhvO28ZzvKWSBq3T9n9LoF19iLD5g/EmJz5/tZj2+88HGUspteBjNmbctjuIIizgYbedjgeM5PBs43y22DjpDtke09s5XLNG3Yu18/wAS+X2nqWWW22Z4DYIIIPE8S2J8N465ySeV5TgXt3dDuFswZFiwTrKlexn5W287ySymLPK8ZBCCPELJjrgPLOAs5ecsnjbbbt+39rR142D7y5AlebNsn38fbgPA2yzl2ertKWWeTLIIIPE8sstvjk52zjPFsmbOPfo/q/wfrl2g9p9dQi19pnDs/Hu/pJPqSXPMasa1rwBZwCzwzgILNg5Hfr5w+Dqnr93z/H9pbSD3euWMEnnQ+8pDu8MzCWczwnitbq+GQWcByZwcZZ4B4FsH00sstH5fH9f/AD3LL7XpENl+0AgNwZZwzw5eIBrrw3neCI8Mg43keFtjnbfpZZZD8N+75lg33CZf5fzJz6IAHxHLMpXRKfAB9Asg+k8D4t8cbb5By3pfbo/mW7GE0MIj8fmffL+kW22yy8SNSzwE+WQ8ngs4XLbPPOM4PANjrhmCdEiv18S8Cb7D3Fs9vANtttvEXTmFl5HJfFgQcnG8nVtt7jqY65HfMt4Mgsfhv8knw8bkQVepV8D9Zs2DL1MHoy9ch4yjwBFzGy+bbweWeSTzl1weAcsxA3c7h/1MRJnrt/4lzJ+bc/yRvpfeHr/v62zBzgEg9T7lOJuEUMHGrLs/S7+mtscZxmwSTHl8WTE7hyL8+fZ7mfgPT+X53R3kMZhw937ZJLc8CLtW7Xh/CngbL1wO85ZHAWckvAhOf+H5v+v+1F14L2Qul+QyyeC4MbWXgjhJJPwG2+BYyWZHBDxlnIxbbYmtjv8Ak/iRKvfgupugsFPmaskeuKl4IgcjxB+APBmWcZZBZ9DIbVkJnZvd+vtw9+A5Hd/dI4+pEbbuQmfcQRwyTJfwhn1vSherrF50nte287ls8k46fF0dz1wXfANLKYjg4Me5fJln0dtt4PpbfMX4JDtw+1t8cbY4HcmzMevm6Gx2cYWh/wD7weLcmvYdwXqG222WZ8D6nxznJ5rqc+G7bVhx6ZetsJpaQqPk/acN2+Mx9+/6XqP8WDTP9vtxlnt7/J/7+P6BXoZ65DdmyySyGGXkvgcbzvmcHPUPk6bolS9fHDi9wcfM6dwbdpk9haT0/wBO5rT2AdBZkX9pt+z8P9raLOhP9n5PsjUfUjp/R/7/AL/MpShk4JwSTjbSWfo7bHlkE8lngAV9T5np6/m22S04ZZKa9LuezAQcbw7TMg/uH3P5PZ/iZB9M0D2emHb5PfII7g5Fm2ec+jkHhsc7zkdcbbx+6f4ngMJ5OADZamv5wYQcLMYc7oY2l7H6P/v73zlLH8lns3ko4MmSySyfFtsfQe48Nth5WV9yX6Tq6wQRBKdEcHsicOoh4bbbwZzMYEeiGO6xP8iQjgt6tmyySySSfEbfobwS8jDPGo+X0TD2MxZHVqfbBvCZZeCy8gx4Ryl4Lj02zjeGwc9Syy+GWWfQZh8CIJZbaTmfcXTDr5ig4Sw2xF4eWfMLbGITvzYPntCpZZYYhl4Nbv0Ms8s5Ak5JgL6Jen0euPd84ToOizZ+/j8rDOEzYm8hu0smXFTNtmF2ae+d5EeQ38Klk8H1dh9H6w2R9pTLh+pZ5wjgL3w6xwwjHBrwPA0ltmMeDUMuFtn8GPFbeNvvq/Sx9sA6dhPQXZELaxN6mbZQ9cFFnyDWLLLLyXrgHZNmfw28NssqfxB9t+h/eX2/Yi5dljg8Q8NJkfALdJup4mbLPkT4SSz62eBznDwsLo/A+Pzu/ILvbbDwOwTMzgcyt4YzeXzURm2/WPotl6Q7jguEJYeDGCzwSl5FW8Lhnz22H6//xAAnEAEAAgICAgICAwADAQAAAAABABEhMRBBUWFxgSCRMKGxwdHw4f/aAAgBAQABPxC2JlBL4sxx8ApgIMpux1ERdxmuAzCVKmp1OuAlSoSqhCEqBBDmGJAxCahgl3waqdzqYlPqCRLJbKpvKuETFhQNuIYSptCFloXiMHAh4uMuLh56hycHAQiSvwIOBwWu5rBcBUqoMMtl4nsixcTCMaMsP0gy/RLS4pVHqh/wQHKKHM8Ob+ywZuV84lFY9w3eIZcOGUwsxLrFZTOOLcfmlU0xPCWR95iZYtRgeKgQhwEDkgQ7lQJUeWriBcIFAqGo4OJcRH5g3GkOsNMxsd3hdH236l5cx3z/AB9VGgo2kq/+9yhHi0mSiye1QlwFQY4q2ZYz1x6yzCXqUaRswFamJCvHRChEjruPURjweJWIk7hKlcdQODg5CVK3ByBKxKzOptBxGLnghtAknigi/QfVsY1dvbHjY/5GcQ5cMoh6802EsaKwCbA7a8p8Fy1gk1FmTHS6nqlRqXdT0ygg1BcsI4VN9So4LUKOPBlQh74BKzKgSoFcEJiHAQJpPhwkuKLFSoQFEvHElWCtGgJXuMW4vvX9XGgYqWQ/LbFJcld7hkA8soL2LxuINdBbc9bP/rqANGp5/b48EMKrgFy5mCNQRwSs7YMqhNYpUyhlqUOYeJuhDElQhMSuCVwQIHcz+HhB6ivECEYjDcylkKRYmYskuDnn+no+6mUB5H6V5+W2D22AO4YP2RC8/Us6/IhMqTrHyuiAnqtNDWh6P7/yg4dSs8ARJeMmGGYYYwPuPMRUEjG3ncOIqw5CE+uO+DXBDcPyJcWYoa4OB8V2blW1dkK8ej2/QxNHGFFP2f49RFZb9wqcEyGvcpTDpe0bXeGIMs81GGBqX9+Ja9BF1GvbnLMVyiFkqyMvDVmGiWvJimYoDxKMzAi1Em3PCrjqVUKj8zuEIy/xNfgsuHBOocHljIUwtDaXzKExlzbv2+f08xU8rYKe2LsrALILP6DzPlaYy/cQqfFSf7MoEE2McB+i0folIE6k83WX0wrVY3KrmUqETuDPEiyqM2CmCYuFa1LzBB1K02zbw2Tc6gwYzqH4Gp98kJ3+XXNwvzGyrcKptF6LKU9d9UQpVV7h9AgKlni4Qg0CGbOmDI8MA9RQbUwPZO2BgZuaRKfLoPmWQ1OYhqlS6UtvmjERUWZcVBWJpwRZV1LViKxPEc6jPUp3MMp4j+ZhHGo9suXcGXu51Dg4OCViGeA4PcxO/wAji4blIT5x+544Aaaf7H+qlh53L36hOvI99kuRUo/tFYmFuyUAkOBodTf648QGs6wLasDox/vG8sh1FcN9SpCi7qCmoB1PXBhnUpKJRCUstluLl2S4TPFwccnITrgPxXhhOp3Bjgw4AESubJZ/Qf2kYZsu4j829vRKlEG1IxCCADQ8j4iP3IH+kU5OwfRixrvxiawfkH0RWcbRQLZhl7TKo8RFOpeanrgkKr8AENcP4HAcXwQgSpUCVx55J3LnXJ+AwbllWoAWr1HrlUdAc/Zz8VAYQK18HcwrezzFqAUq/MtmE+C9npqk+PEbWLYrQgvkt6mHAMKtaKzwrHBzOipe8JRjpTLuoR1CIASw4DBArgQKlYmNwUiwlcHHmEN8HO0eTmuOo8GYstnrgmQPTTTp+zR9+ItxONeoGVYz2wKkm3OVuvSV/cxC9jGVJNmkgfsEtkOCValaY9/0RyR4FXqBtlzNfED1Kpj1KJiY/AeoMco7lAl0XghC4EODUCEMXL/O8Q5udQhEjB4AMuXldD2sarSF2OsegiV5K1U0Hlq9xeXo3AdgAnxYPkGKiIQaWtPstv1KVi+ouoi3XAEMEh1CRi1xUHFg4WiSj8FFZb+BAhDk1x1Dg4qp5/JlLLBBgWrBd4TZ/fhGOCax9kdiZg9I6XhaLQf/AH1Gi7Mb/wC3+fuFnsdsvfQvzL6L8ZnmcxEC/AWtYeG731ACAAKAMEvtqbS1LBqIbIt6iRTBVhmHMqJXxYJSU/IZ1yQhCEN8EITz+JyS4pxcUrgwUxKMV0d5iX5Nn/2EVBtV3yIsOsmHpLgK2JE85Y+iJwKjgsEaA9LbemtRC8Sh/BUuvcastj1K3Oi8dRwbK5RCl/OvuUFAHgKP8huKtE8SGskAajYcR1xAnUM2f1CMEI4GyUfwjDjEqUwhCVCHPTBK4vgjOp1xqXczBplDAgw9QGEdjFnKSNB0njRkmzq6q5umh3Lo7DKAtt+rmNKdvqW5sMy4sI+kjtFgrbYKimYaNFIV/d/cWZilzKM1MtRRpjtJj1AOoB1BRHmbR/xEMwhOuCEITrj75oPwvi/wYyrYDE6juwu2Bwg/+nzFdNr3K3OzgRJTY+Tr7gmWfdHZCr2ljflBPIqbtEF9ZDEVl1hvcCAxcSl1KSARCopUUWYfmD5ln8NQ5OA4Ic4qD+Oody8QZcshEmXCe/rKB8stY8tFfF6e3PxEqBartiK1EhbIeqLmGDZRjV9t/r9xWaGg1XklIMxbp3b9UfUqc6hB1FF8Uw4LIKiqYJXDgW9xZbFZ/CQg8EOCMvg3zcZfFwZcWDDtBuFXXUD8XuHhEotN+Nv9SuNNq+iMfcUnbLRzL2Yq4BRbdwMlkXpf80fqJp3FYCoa73Mt1xWgtBYOCj6iWO5bTg3VBMCKiZIuNhjWd0NcV/BmEPXA9cGp1Djrj44HHFy5cvMGXCGKtWhb63BSMxT+xz/U8Q3pg/8AGqj1G2sf9ytgIJWoa1awdKboah5ZkXmNhtq6gqFMBkJmAEpTbIX1fjplxA90Jkyez2J5EsiiL0xLviGmWLI4CwUmRcGIODhmTwUQQQcrUYtmnBxc7lwzCVidcY4Nfwo6DRn/AMx5YH2jMoPfa+2KlfawyqVnSxm0eAgoJsunKXwukLXH6A/vYLF701oRzHqvT5I+fS2YLWr+5nIZfBdYjcUVVJHbqRwyUiJnrMMtqmQ3t8+SUAD0afaHScKmYpRtgjZG5I3NYycEdQcXw6iy4Zg1DUNfgQ4V+OUYfhcJoX4b6Y/76jyctBo6B4lnivYQw5eiWxu1Zb6hQLFXWfhgdyyGiaq5NSptTPzEgl/0MS17TYo6muWAbHpGANMCADTfCL0eYudFQshFJkCVnq9MFoU2FyUDgUMDWaMSgnmVN6TLYtIXs8ywVEx6nUvTuhVe6M43YwgwealrA6R8RRq4BSaSmFoBAYhAhDBBU7w1GVKgQYzAxuBidSuCEJWJX4E6nmLF4ueJ+5j/AJfUfiys4/73axqy7hlWNC7RyV+4IKtslu6s/uXVGTIxu3Tuo1Ors7IHaFUUBfWXBDRmiEj0q0+CJhi1gWqFgPNw3n3SfFqyZAVG6vFpamiQaAoIeRlzcVKd0WCPqLXzfUBd3BKCoDwRH96RhpkMDAmd+e4egRX1nfhc/QzRwUbh4DqY98dqixY4wckeoHRCVKhFEo4wSo1FhMIQZ5mIQ7hNcMeGhIeoBtY/CU031/1HR9xbTMqcu7NsJpFZeGCSjc5auIwY/pjPXyHuIhvSmceEZwpGjfFg/vEKCpS/mNH0RRV4iLuC3ARLEQeNk4AoGxg/SqOqaYWVQI0s3OkV8Kks88zanD7VNX9oyx5TUYWH0ZPs6lEFES5hFZmy0lE1rgMrzX8HRERi4QTuaRYQhi5eIvFRICtEOwWzcdFvB37x1Ea5tFEGl5SXb8Re6vEOlM7nV1UVijkWr9RJHgUxNKNVjOYuLgPsnaK/pEytgwgvXJNjUMtRNCJblQWI7EggZ/hTK3z0vcKQhne/c8+XyN4c6dHBstgd/wDRh+1IWB0j4gxKxLJtmDMXAaJXhpgsVk0/gGXiHHtMItwnXAxAxGOoMNkIDURAa9mU7e/H78ShO1pS1VyxAlFBUFAf8TMPiHaBAlrwRH0rTotY7yfuKaaooDJdLzv3bKgehoHqJEg258YczXgRIU0aQPETAnY6O10j/wCphElp4z36H+inUaJ/HxPgGiOk9MvnWnBXq99vHwniBUsqoBIE2xCxwXmW3HuCxvA/4SEGDBgmUnHtw+omL4hmEMcCpfsfT/5LulM7i2OpS1LepeQZgT4I8FJblW0rurfr3K1R6aU2vbARwRZhthQ3qHjHlHBT1MHAwYBqs0u/Y78YZbKUdva/s1dJtjjQAWBWFa6bH3nbL7mruk0+zT7iuGFp6JUJqK5UBiLylH8BUOLhxp3AckSBBGOEVsAsrFHZnoHtjpcq+oiGQMsUKZXcJewgwdeHAv2xEprNlOrna1rNRrw4NHy+X3MdwQSRN1KYcwFRZqU6mbiXsxcBkBWo2NR34wwDXu8P040YVwFGV38nnF7GB+vSxNLbWQU6YeI8DSMTPCRd1PXBIAP4RhDWZ3CfOYQuVF3FiKdRS8xmU2KAbY0UMjs8/bDFquOsrjIooA7jfHPFauqgzs/AwpRt07VHtMV4vzCbIsGH0RdxQqZJ6ZcaiqsIi1ESCJdjXxrSk4V4G3UPndE3VoYtK3eoVDIHJC6L8Fv7ZXxAGBUQrXCqz1z1wCAH8h4hCHBYLBmCEaRy8zvwyMB17D+36jdWP8J6TLjoABaszbLUdZB5Wb8e4scGky608qxHqUOSF04F4gNSp1ANVEPBGSwjNJLiUxL1KXBaTZjhu4KkGoOAXC/CZ1/MMHi4TSEqCAyxG44Q21oLdMX8uiEGcKIGaTySpP57oF+AMK3nqYALQfoM/wBjG7ZxjD0NPvfxCdwXMHKpRGsNwyBUrPEoC2JZupX1L+pT1OqohOiYuM6lYjuNphgqKoiVhr+YZSDGKDCViE3lpBrUISz264D5YKF1GYNausUdEv6MPYNtQ9325+Jc5wNXCnzCbJpqOMQJbpL2gCAOYzaVYXXjoISNwkPFAOoPiV9QMPCCaTSdSkpMEOXh5iBX84MGDdwfMIOY5cILlEDQy4hKCxcD6C6O30zTlAPEC8EHxAdIl2ph1CRqUtIQGVYRzFyxLiVkFsKsyg43zPMcR3ACHMMOPwSypjY5szwoQZmn8twgwXDc7/AwiVE0iM3ZCvUGrgIjCQcCMwUyVjhqKWDLmFBhVBUF1AZQgSBiDHBghr8QSJgCBUAfzf/Z";let U=class extends l{constructor(){super(...arguments),this._refImage=I(),this._boundVisibilityHandler=this._visibilityHandler.bind(this),this._mediaLoadedInfo=null}async play(){this._cachedValueController?.startTimer()}async pause(){this._cachedValueController?.stopTimer()}async mute(){}async unmute(){}isMuted(){return!0}async seek(A){}async setControls(A){}isPaused(){return!this._cachedValueController?.hasTimer()}async getScreenshotURL(){return this._cachedValueController?.value??null}_getCameraEntity(){return(this.cameraConfig?.camera_entity||this.cameraConfig?.webrtc_card?.entity)??null}shouldUpdate(A){if(!this.hass||"visible"!==document.visibilityState)return!1;const e=this._getRelevantEntityForMode(this._resolveMode(this.imageConfig?.mode));return!A.has("hass")||1!=A.size||!e||(n(this.hass,A.get("hass"),[e])?(this._cachedValueController?.clearValue(),!0):!this.hasUpdated)}willUpdate(A){A.has("imageConfig")&&(this._cachedValueController&&this._cachedValueController.removeController(),this.imageConfig&&(this._cachedValueController=new p(this,this.imageConfig.refresh_seconds,this._getImageSource.bind(this),(()=>E(this)),(()=>u(this)))));const e=this._getRelevantEntityForMode(this._resolveMode(this.imageConfig?.mode));(A.has("cameraConfig")||A.has("view")||e&&!this._getAcceptableState(e))&&this._cachedValueController?.clearValue(),this._cachedValueController?.value||this._cachedValueController?.updateValue()}_getAcceptableState(A){const e=(A?this.hass?.states[A]:null)??null;return this.hass&&this.hass.connected&&e&&Date.now()-Date.parse(e.last_updated)<3e5?e:null}connectedCallback(){super.connectedCallback(),document.addEventListener("visibilitychange",this._boundVisibilityHandler),this._cachedValueController?.startTimer()}disconnectedCallback(){this._cachedValueController?.stopTimer(),document.removeEventListener("visibilitychange",this._boundVisibilityHandler),super.disconnectedCallback()}_visibilityHandler(){this._refImage.value&&("hidden"===document.visibilityState?(this._cachedValueController?.stopTimer(),this._cachedValueController?.clearValue(),this._forceSafeImage()):(this._cachedValueController?.startTimer(),this.requestUpdate()))}_buildImageURL(A){return A.searchParams.append("_t",String(Date.now())),A.toString()}_addQueryParametersToURL(A,e){if(e){const t=new URLSearchParams(e);for(const[e,i]of t.entries())A.searchParams.append(e,i)}return A}_getRelevantEntityForMode(A){return"camera"===A?this._getCameraEntity():"entity"===A?this.imageConfig?.entity??null:null}_resolveMode(A){if(!A)return"screensaver";if("auto"!==A)return A;const e=this._getCameraEntity();return this.imageConfig?.entity?"entity":this.imageConfig?.url?"url":e?"camera":"screensaver"}_getImageSource(){const A=this._resolveMode(this.imageConfig?.mode);if(this.hass&&"camera"===A){const A=this._getAcceptableState(this._getCameraEntity());if(A?.attributes.entity_picture){const e=new URL(A.attributes.entity_picture,document.baseURI);return this._addQueryParametersToURL(e,this.imageConfig?.entity_parameters),this._buildImageURL(e)}}if(this.hass&&"entity"===A&&this.imageConfig?.entity){const A=this._getAcceptableState(this.imageConfig?.entity);if(A?.attributes.entity_picture){const e=new URL(A.attributes.entity_picture,document.baseURI);return this._addQueryParametersToURL(e,this.imageConfig?.entity_parameters),this._buildImageURL(e)}}return"url"===A&&this.imageConfig?.url?this._buildImageURL(new URL(this.imageConfig.url,document.baseURI)):k}_forceSafeImage(A){this._refImage.value&&(this._refImage.value.src=!A&&this.imageConfig?.url?this.imageConfig.url:k)}render(){const A=this._cachedValueController?.value;return A?m` + {const e=Q(A,{player:this,capabilities:{supportsPause:!!this.imageConfig?.refresh_seconds}});e&&!M(this._mediaLoadedInfo,e)&&(this._mediaLoadedInfo=e,B(this,e))}} + @error=${()=>{const A=this._resolveMode(this.imageConfig?.mode);"camera"===A||"entity"===A?this._forceSafeImage(!0):"url"===A&&d(this,b("error.image_load_error"),{context:this.imageConfig})}} + /> + `:m``}static get styles(){return L(':host {\n background-color: var(--primary-background-color);\n background-position: center;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJjYW1lcmEtaXJpcy5zdmciCiAgIGlkPSJzdmc0IgogICB2ZXJzaW9uPSIxLjEiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjYjkzZTNlIgogICAgIGJvcmRlcmNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcm9wYWNpdHk9IjAuMjUiCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuNjA3ODQzMTQiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyNi42MjUwNiIKICAgICBpbmtzY2FwZTpjeD0iLTEuOTM0MjY4IgogICAgIGlua3NjYXBlOmN5PSIxNS42ODA3MTYiCiAgICAgaW5rc2NhcGU6d2luZG93LXdpZHRoPSIzODQwIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjE1MjciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEwODAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjIyNyIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiIC8+CiAgPGcKICAgICBpZD0iZzExMTkiCiAgICAgc3R5bGU9ImZpbGwtb3BhY2l0eTowLjA1O2ZpbGw6I2ZmZmZmZiI+CiAgICA8Y2lyY2xlCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eTowLjA1O3N0cm9rZS13aWR0aDoxLjM5NzI5IgogICAgICAgaWQ9InBhdGgxNzAiCiAgICAgICBjeD0iMTIiCiAgICAgICBjeT0iMTIiCiAgICAgICBpbmtzY2FwZTpsYWJlbD0iV2hpdGUgQmFja2dyb3VuZCIKICAgICAgIHI9IjExLjI1IiAvPgogICAgPHBhdGgKICAgICAgIGQ9Ik0gMTMuNzMwMDAxLDE1IDkuODMwMDAwMywyMS43NiBDIDEwLjUzLDIxLjkxIDExLjI1LDIyIDEyLDIyIGMgMi40MDAwMDEsMCA0LjYsLTAuODUgNi4zMiwtMi4yNSBMIDE0LjY2MDAwMSwxMy40IE0gMi40NjAwMDAzLDE1IGMgMC45MiwyLjkyIDMuMTUsNS4yNiA1Ljk5LDYuMzQgTCAxMi4xMiwxNSBtIC0zLjU3OTk5OTcsLTMgLTMuOSwtNi43NDk5OTk2IGMgLTEuNjQsMS43NDk5OTkgLTIuNjQsNC4xMzk5OTkzIC0yLjY0LDYuNzQ5OTk5NiAwLDAuNjggMC4wNywxLjM1IDAuMiwyIGggNy40OSBNIDIxLjgsOS45OTk5OTk3IEggMTQuMzEwMDAxIEwgMTQuNjAwMDAxLDEwLjUgMTkuMzYsMTguNzUgQyAyMSwxNi45NyAyMiwxNC42IDIyLDEyIDIyLDExLjMxIDIxLjkzLDEwLjY0IDIxLjgsOS45OTk5OTk3IG0gLTAuMjYsLTEgQyAyMC42Miw2LjA3MDAwMDUgMTguMzksMy43NDAwMDAyIDE1LjU1MDAwMSwyLjY2MDAwMDIgTCAxMS44OCw4Ljk5OTk5OTcgTSA5LjQwMDAwMDMsMTAuNSAxNC4xNzAwMDEsMi4yNDAwMDAyIGMgLTAuNywtMC4xNSAtMS40MjAwMDEsLTAuMjQgLTIuMTcwMDAxLC0wLjI0IC0yLjM5OTk5OTcsMCAtNC41OTk5OTk3LDAuODQgLTYuMzE5OTk5NywyLjI1MDAwMDMgbCAzLjY2LDYuMzQ5OTk5NSB6IgogICAgICAgaWQ9InBhdGgyIgogICAgICAgaW5rc2NhcGU6bGFiZWw9IklyaXMiCiAgICAgICBzdHlsZT0iZmlsbC1vcGFjaXR5OjAuMDU7ZmlsbDojZmZmZmZmIiAvPgogIDwvZz4KPC9zdmc+Cg==");\n background-size: 10%;\n background-position: center;\n}\n\nimg {\n width: 100%;\n height: 100%;\n display: block;\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}')}};c([s({attribute:!1})],U.prototype,"hass",void 0),c([s({attribute:!1})],U.prototype,"view",void 0),c([s({attribute:!1})],U.prototype,"cameraConfig",void 0),c([s({attribute:!1})],U.prototype,"cameraManager",void 0),c([s({attribute:!1,hasChanged:h})],U.prototype,"imageConfig",void 0),U=c([C("frigate-card-image")],U);export{U as FrigateCardImage}; diff --git a/config/www/community/frigate-hass-card/image-632882b9.js.gz b/config/www/community/frigate-hass-card/image-632882b9.js.gz new file mode 100644 index 00000000..54da439c Binary files /dev/null and b/config/www/community/frigate-hass-card/image-632882b9.js.gz differ diff --git a/config/www/community/frigate-hass-card/image-669f8abb.js b/config/www/community/frigate-hass-card/image-669f8abb.js new file mode 100644 index 00000000..ba3616de --- /dev/null +++ b/config/www/community/frigate-hass-card/image-669f8abb.js @@ -0,0 +1,9 @@ +import{a,cR as e,x as s,cV as t,r as i,d2 as r,_ as m,n as g,t as n}from"./card-769e2b91.js";import{g as u}from"./index-9b434861.js";import"./image-632882b9.js";import"./media-d4c0d154.js";let o=class extends a{constructor(){super(...arguments),this._refImage=e()}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(a){await(this._refImage.value?.seek(a))}async setControls(a){await(this._refImage.value?.setControls(a))}isPaused(){return this._refImage.value?.isPaused()??!0}async getScreenshotURL(){return await(this._refImage.value?.getScreenshotURL())??null}render(){if(this.hass&&this.cameraConfig)return u(this,this.hass,this.cameraConfig),s` + + + `}static get styles(){return i(r)}};m([g({attribute:!1})],o.prototype,"hass",void 0),m([g({attribute:!1})],o.prototype,"cameraConfig",void 0),o=m([n("frigate-card-live-image")],o);export{o as FrigateCardLiveImage}; diff --git a/config/www/community/frigate-hass-card/image-669f8abb.js.gz b/config/www/community/frigate-hass-card/image-669f8abb.js.gz new file mode 100644 index 00000000..68305dca Binary files /dev/null and b/config/www/community/frigate-hass-card/image-669f8abb.js.gz differ diff --git a/config/www/community/frigate-hass-card/image-678a8283.js b/config/www/community/frigate-hass-card/image-678a8283.js new file mode 100644 index 00000000..41bb54a7 --- /dev/null +++ b/config/www/community/frigate-hass-card/image-678a8283.js @@ -0,0 +1,9 @@ +import{a as e,cM as a,x as t,cQ as s,r as i,c_ as r,_ as u,n as g,t as m}from"./card-320adb66.js";import"./image-88fcb8ac.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` + + + `}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}; diff --git a/config/www/community/frigate-hass-card/image-678a8283.js.gz b/config/www/community/frigate-hass-card/image-678a8283.js.gz new file mode 100644 index 00000000..f4e82f80 Binary files /dev/null and b/config/www/community/frigate-hass-card/image-678a8283.js.gz differ diff --git a/config/www/community/frigate-hass-card/image-88fcb8ac.js b/config/www/community/frigate-hass-card/image-88fcb8ac.js new file mode 100644 index 00000000..c334a730 --- /dev/null +++ b/config/www/community/frigate-hass-card/image-88fcb8ac.js @@ -0,0 +1,13 @@ +import{dx as A,dy as e,eP as t,eQ as i,dz as a,eM as r,eR as g,dA as s,_ as o,n as c,cR as h,b as C,t as l,a as n,cM as I,eS as E,du as u,dv as m,cP as w,x as Q,cQ as M,eN as B,i as d,cL as b,l as L,r as D}from"./card-320adb66.js"; +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const p=A(class extends e{constructor(A){if(super(A),A.type!==t.PROPERTY&&A.type!==t.ATTRIBUTE&&A.type!==t.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!i(A))throw Error("`live` bindings can only contain a single expression")}render(A){return A}update(A,[e]){if(e===a||e===r)return e;const i=A.element,s=A.name;if(A.type===t.PROPERTY){if(e===i[s])return a}else if(A.type===t.BOOLEAN_ATTRIBUTE){if(!!e===i.hasAttribute(s))return a}else if(A.type===t.ATTRIBUTE&&i.getAttribute(s)===e+"")return a;return g(A),e}});class k{constructor(A,e,t,i,a){this._timer=new s,this._timerSeconds=e,this._callback=t,this._timerStartCallback=i,this._timerStopCallback=a,(this._host=A).addController(this)}removeController(){this.stopTimer(),this._host.removeController(this)}get value(){return this._value}updateValue(){this._value=this._callback()}clearValue(){this._value=void 0}stopTimer(){this._timer.isRunning()&&(this._timer.stop(),this._timerStopCallback?.())}startTimer(){this.stopTimer(),this._timerStartCallback?.(),this._timer.startRepeated(this._timerSeconds,(()=>{this.updateValue(),this._host.requestUpdate()}))}hasTimer(){return this._timer.isRunning()}hostConnected(){this.updateValue(),this.startTimer(),this._host.requestUpdate()}hostDisconnected(){this.clearValue(),this.stopTimer()}}var U="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAUDBAQEAwUEBAQFBQUGBwwIBwcHBw8LCwkMEQ8SEhEPERETFhwXExQaFRERGCEYGh0dHx8fExciJCIeJBweHx7/2wBDAQUFBQcGBw4ICA4eFBEUHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh7/wgARCAEVAewDAREAAhEBAxEB/8QAGwAAAwEAAwEAAAAAAAAAAAAAAAECAwQFBgf/xAAaAQEBAQEBAQEAAAAAAAAAAAAAAQIDBAUG/9oADAMBAAIQAxAAAAHu/wBF+fKuKWoua2zblcOpTDeJqLJsVgAACCiNQEKJRCmEoMAhy1FzThq4VrCHDWbHCoilBWQKqzaa2xeTz3Uumd+Z+h4Sxy0VGmdbzV5AybMdZjUz1kEFA4AAEAAdEFAAEVKBDVxc1UtSgiaY1cSI4nPfl/N6eZrHp/Rw11mLJq83XO9c2ovO+Ry6ea+j4FY1uKl1zrSAAIucd5mlYUoBggA1ACiRiVgiCiW81w6JQqWpazQVTQCo6fz9vH+L2ec83o937PJ7P6HgsBAaZ1vjemdJNcb5HLr536PgACrioqFU2RZFkWLcAgAAokdoEhRKwgoHCCgrKpWrlQ1ctQpVU0jovN38P4fZ1HDta+y9HD3f1Pm2jEBrm78+muNXNVnW2N6Z15z6fz7zWSlDEkVnrMWKyaVgOCkA6AkBipwKBDhgIa1AC3KoaiuJtmPP+b0eM8Ps6Pl01lprsenL6V9T5vadMUJEa41y+XXXGqmrzrTOrzamvNfU+brnThgRrOdk2Z6yqSKxBTAQAgojBBRQAHDhhDViRLc1cpKhV5rzd/nnz/dw+PbkIqheXrH036nz+578LipVY42xvl8u14uk1pjeuNXNB5f6vzNc6uERc56znokjUEBBYAFACGAIAAAAKDyoqaEJRWVNOOn5dfnXz/b5rz9he1zutRGtfSvo/O731+aoYwjTOuRz6b893nW2N6Z3ebpnTXyf1/laZ0xM5azGpFioQAVgCiAAKmgAAoCAhgpDHLctZoNUvh/H6vnfzvfjHJl56taNNT6L9L5voPT59s1UAVLti8nl2rN1zrbn00zq860zoPJ/Y+SDM7nPUmxWIBiQoAKABAAAAAFEQ1BIBFTV5uktTXnOXX4/8n6euNbnYzWVjXkdMfR/qfL7X0cNM63xqpagKl5PLrrjdy643rjeuN641cpL4n73xUFmdzNCAACFAAFAAgAAogACCiQCiUlqWoqa0zfkXzvo+Z8fq7XnvmVx9Zmu27cvon1Pmcrvwcu+N6S689a51pnWmdb8+m/PppjeuNbZ3ea5QZ4H9D8JWISKhAKIApgAAgAK0SCiiACCwCEooOWocvTcuvx74v1+RjfZmk1jrPp/Z4/cfU+a9QHHIxupeRz3tjXJ5dXLvz6crl11570zqpXRDVnz39F8BwqlDUSCgwABgMIVORqkLEoAAJAFQAqsakOX5T8j6nQ+P19xNTc8nHXk9uP1L7fxI3hUK5d8a2xrk8+muNcnj25HPptjfI59NM6AHDVqHz79D+fCbFokAoHAAwAcEFEMWghKgALEgoAhaCiPLznm9Py3431+djXay8TU7vty919L5/YejzTYhDl3xrl8+nJ5dd+XTkc+nJ5ddcavOnKqCotoA+efovz9RGorEFMIYQUDQlYBAAtQAIKIVgoqRiqbAcuWNfH/AIv2ev4du3zrSqj6R9L5/fezxRYqRUC65vL5dOTx7crl15PLrtjd5tTRBTilagHzr9H+eZNgAwpwAADgGAQUAKwUQAQArjLG+s83p7P3+BhnXy/5H1vN+T1b5vPa1s9r34+++h87PWc9RwE2TV5cjn05vDvz/P6N+e9MbuWlBqAAQHzn9N+ecKwgGFjlBhBRDAIACkMSClEi0UOXTNpfN+L3ec+D+k7z6Xx+r8/o8FvlWddkbHP6Y+vfT+VyZqUmzTOtcbZnrNTXK49eVy67c9643rnVNAAAAAR84/TfnmgADgGADgAKcFEIBolKAEiRWhWbyMbivi3wf0EcuvKmuH38mWNdrbon036fy+768dsbcumd6Y1rjfL5dalBy0ry1zvXG6UAAAAA+cfpPzrAdAAMIcEFAACFoAISlCJSxQrUjl1zry3l9Pyz5P1MY1O72wxruK9F6vL7j6PzNc6359N8dORy6a43rje+NuAnRDjTGts7uaAAAAAPnH6T886IaFAQwGOEAAFAgAAAAAQ5Vm+D8Pt8J873xLKJeyrntdpL9I+n8vse/m1zvTOtM65vn9G/PpvjdQE1lrKRrUuuNbY3pNgAAAB85/S/niAdhBRDGAQUIKIgBSkEACpwEYvmPH7fCeH2dVx2mmVLFNnvLruq+o/R+ZyOvCprTO2c3z+jmce2uNMipsz1nPeHNa41rne3PWudtQAAAPnH6T86DAB0Q6IcFFJCBSwhKCBBQ43PfQ+fv5zyerzfl9XGzYRy6LCCiKucdxqfZPs/Fcu+OnJ5dUmmd87z+jkc9hOk2QznuXm6Z1pnWuN6501AEJGofOf0v51wAADGAQWCiClAgEEB13Lr82+T9TpOHaEUOXlzVmlaDlzlmzg3N12J9p+x8blaztjfJ5dtcbqORz68nl1cKgmxI2rmqy1xrSbYEiZais+c/pfzzQgAdOAAAAAKQQgpRwuXX5N8X6/X8+hHLObNaLnZRUFVL3HLp6P0eXzPSddJ0fPp9G4693+g+Lvm8nl15fHtU1rjV5rWpqoBDVxebpndytUJEjVqz5x+k/PMEFKcjAIKEFAAQhBWeNfJ/ifY6Xh25kvPWrMiluXVexzPQ/Q8HoPf4OT24llZvH8vp+X/ABPt9fqfSvT5fX/R8PL49eXx7OUVoS1LUuudENai860ztqwAEFAPnf6P88QtFRIU4YQUAOFaCRUiZfmHxvreb8vp5Evay1YWcatJe+9Pn9f7/ndp6fPGiSpRKl359PM/N9/kvN6uQfSvX5O81ORy63mxqTrNZ1rnTl0zqoqW86qaqVq4KAAAPnX6P8+IrFTHKIwhUwHCpWkIVnhPmfQ8N876HNl3rQYrnkdM/QfpfM7f1+VWCkXLedXCNcbvN+a/K+p6j0+fpPL6vqnq82+NXnUazNjNcbvOrlcC1LedXm0rUCAAoPm/6X88SA6ZWaBQhDBUipFZpb53y+r538f6txnWpVmusfTfqfL7D0cTWVQhDmtZrTN0zrTLfn00zrjY38u8fs+gduPF59PadMXmgE2VLctTSRq5by1zu86pQMgKAPm36b86wh2seQjUokqUEToi83qePb5b8b6153QrGdv25fRvq/K5PTDSLA0zqpXDW5dcXk8+nI5ddM6cvTZ347n07BPb9McrNqVjlcquW05QqXXFvOtJpqBAEAHzf9P+dACCql0zXEWMagkjSs3jc+nyf4/1sOfTSWyLO87+f6N9X5fJ1EBNjipdJalqWjbnvlce2/PprndZoeXzvgmlnsrnTN0zsVWRc3NXmuXTOtM6pQAAAAI+bfpfzgNUMoZWarCWgWbIoxr5b8f6/V8O2hcvYaz636Hz/Sezyck0zpWJLlZFgJbl0zeTy6czj25HLrU040zpnQY6d9rFDilCUVaY1rnVzTUAAAAAAPmv6T86wBGrCiAocriNJTwHyfq+U8Xr2NK9j6fN7j6Pz63ijk8+jgBBdsaqWUw6Yqa2xrXG+Xx7b8+ly1nVy6Z1WaCqNZVjzWVLpndKAAAAAAAB81/SfnC1hIDtBhDHKQjy/k9fgPk/V7beO69HD1Hp8/e+jz6ZrSbNM60zdM6i5z3nbn05fHtpnXH6c1W2N6Y1tjemdXnWmbedaZ2xIiNZjWQrOtc6poAAAAAAAAPmf6X845XRIwV2uAqLzoTi8uvnvH7O16c+768uRrNDluHGeo0vOtsbjWYueRz68nl10zus1rebct51UrlqNM7uVqIEmW+cay5rTGrmqUAAAAAAAD5l+l/OMYQwKtcripdc6uJ8nr7a5DXG9M6x3zy3loLFyJlvJLUa53yeXXbHTfnu86ZedVm6TQCOW5qpWoAJnc5ayy5qs22gAAAAAAAPmX6b825QcOiKtakmmdVLpm9t5PTyOfSprfnu86z1ni9uMazGs5bzFzjvIuubyuPXkcuu+OmmNXLeNbY1U01STqVLebTQAAJJQGtAoEFAAAAAAf/EACkQAAEEAgIBBAIDAQEBAAAAAAEAAgMEBREQIBITIUBQFCIGMDFBFSP/2gAIAQEAAQUC6hDofrwE1D+gIdDwfpNqxZggbNnAXQQ5Kwom+DOQgEBwEFrjXGkOpKJ+kuZKrWVvMWJUXeTsDVsMQ6gIDjSa1ALS8VpaWlrqfo7uUrVlcytqwhG8rwaFim0GzjqAgFpaQCA50tLS19Pcy9SBXMpYsrW0PZHax1J1ySjViqxjo0JoQHAC0tcBD6MdcjloKqu5GzaMMZI1pa4q1ZrMmMpMpxBDoxDkIchDk/R38hXptv5izYTimAl2zx4uKirSyyYim6pBpa6BNHAQCCHIQ5P0GuM1mPTT3lxUUJcgGtQCLXKNs7zhq81eu3s0IcBDgdifov5Db/GpOO1FE6VRQ/s4+y0CoK80rsZXdWqhBDjS0g1NatIBBqAQCAWlrja388chfyC3+TeVD/5Sy68/bijSltGnB+NXQQ4bwAgE0IBBqAQC19PtZu3+LRJ2q0fm4f7M0sQCxWMc6VrWsbwE3hqCAWkwIBAIfVZy3+TbYNuDWta9VnhyoVX2LX/OjUE1BNQag1AfV565+PVcdqkP3sBoR9xg6vqZCrTirSdAmhAJoTQmhBD6ueVkMN+y6zZHuWjxa8pgWDpehWIWuNLS0moJqaEAh119FJ5+Fa4JJOJHMijy+RdbkKrj9h/p91hcc90WkQtLS8V48NCaFGE0ID6cLSzNYPhNyz6dHMQyr+T+qXJo2QxrQG6VCo+1aiaGMCKAQCDV6a9JNjTWINQQ+nBQKc0OEkz6tya5t8V10jJmaMTSSxvtolYmr+LWCHDWrxTAgF4rxWuQh9O1ZvKNga874YdKPUsNc6k0Y34Wn52EE1BNCAQCHYIfTPLWMymb2nHyK1xVk0+WLb2bLMZCIqAagEE1NTUOu1tAoFD6OSRkTbmcgjV29YtO6FN9jE/yZjx52arDFXQWk1MTUOh5CCCHz5bEESsZupGrGctPUs75XE8BBjii0hNBJWlDoNx0xFkoIJqITE0odCtIBBBBD5t+3FUiu5OxYJcSt8AEoV3kCshGGoex9t+jomPyJBaWHRpvNexDI2aJqCaeAE1DrrkIfNu2Y6sF61Jan4ZXcQxjGD9db415BjduLC12Mr2JF/48L68uJsvnyGKsVZfJYa/tjSgmhNHA433CHzJZGRR5O263YUcBeoowxErSA9gAS6N8clenudmHb6sUEER2toFWofWiyNdvlVc6E4e2HhqYh12h1HzCQ1uYyBtSbUTNljkTobBBPu1U8XPMq9CrAieoQWaq+TcYIzas1pcbYxdgWa7Qh0HA/v38L+Q3/f3Ka1qPuWeyemD9Y60srocZTiPTSAXivFNavFZqia0uMljymOpSSYvJNIIHQcDqPl5e+K0etqb3LRzHDPIG1YparWhjOw4DUGoNVqsyxAPWxOTuwR36n8es7a3+sIIfIyVxlOB73zSjpjqL7hqwsrwddLS0gEAmBAIBaWVoMu18FZfTtZmF9O1XlbNDzrkchDgf3BHuFbnjrQXLEluf/gQTP2diKTprUUbI2865HRqaEBzpZrGC2zFWhbhwfq1rKCA6BaWkAtfB33c5rGZW665OOB/lWnNPHg6H47WMa0NatLS0vFeK1yEE1NQ5AWlexcdicMG9LXTSAWlr5Wcv+q5vuf8AuiXQYSQsjYGN0mhALS0tcNC8EYkWJrUGprUwIcaQWlpa7AIfLzdwwsmjeySWg+vRw2JLlSxsFZ4WlrgIcHhiHDmoNQagEAgEOB1PIQ+XcmbWrYyjM5UMXHA51dj3+C8V4rXGuBweGBDjS8UAtIDkIdSjyEPjjhn+zUhYm9NeCaxemnM77W0AmoIdNf1noPjjiP8A2M+yCHDgiODw7lqagghwAgOw+R//xAAsEQABBAEEAQQCAQQDAAAAAAABAAIDERAEEiAhMRMwQFAiQQUUQlFhIzIz/9oACAEDAQE/AfaPwB7Y+KPZHC0flj3GsLvCbpT/AHFF8bP+oRO43yGBms19WyB7kzSsHlCgtTM0jbypDLQgMUq+rZp3O89JkLWeFRVKXdR7rkEFSpUgM19VHpnO89JkLWeM0VI8Mbaklc/zxAQCrACr3L+gjgc/tRxtZ4QGaT3BnZU05k6/XIIZCH0tYGWROf4UcLWYGaTjtFlaicSdDm0YCpDA+mrEEO7s5rAVFF+3yVqJmyHpDgMAIYCGAPqImb3VgC0ETik+RrPJWolEh6QwOACa1UgEAgEAqVKs39EFpWU2/wDOGdFHMkzY/Kmm9U3zAQCAVIBAKlXC/pImb3bUEO1aIpV/lTztaKae0ST55BAIBUmhAIBV9VpY9rbP7yVGQfxKmf6Te047jfMBAJqpBqA+r00W92Go4lJjbam1DpBR5BAIBAIBDA+qaCTQUUQjbWbVLUybvx5hBNTQgPqGP2m1JpdzfUi7GAgLWn0+zs+cDMuo2t2DzwpUqxSATQgEFX09L+P1f9PJ+XgrV6COvUYEP42GZ/4Gv9KT+Pbpm7m8XvDBaJs2UEcAINXpr00I01iDcD6cZ0WtliYKUkrd++Ppf1Bcwschwnl3u4Bq2poQC2raqyEPpwoIPU7Pji3Gpk2NrAQQQCAQHMIfTBqi0v7egONILU9yFUqQQQQ52rVoH6NoLugo9I7+5MibH45hF+3tTyB77GaQTUPaH0DY3u8BN0bz56TNHGPPaaA3ocKVcSL6wEEFSaU08qwMD50URkNBRQNj8cdq2qs0qzSlidG6iggmnACbxpVwHzYozIaCYwMFDO3F8aUUrIzUnhanWxRvqMWjqYnC7UUgkvb+sSxCdlftVRo4AQCpDF+wPmMaXGgoYhGKxWL4EV5RLWi7Tte2ugn6iR/kqycBQSmJ+4I04bgmmlrIb/5AgE1DN5HEfMAtaeD0x/vgeEuqYwf5T9XI798KVYC0k1fgVKCOx5UMweFLF6bqQCHAfR6WGvyPEoJzwAn6p540qVKkAgoJN4o+VKwxutq/9WIIYpUhgcLQPy9LBvNnwq4lwCM7g40UST2eIQzSDVtTbabCNSNUTzE5TMo7ghwrA4hBD5EMRkKaABQ4yTNj8qSQvNn2qTRgBUmHaVIyxuCjdY2leOFKsDgAq+OExheaCYwMFDjPN6YTnuebPCuYQQGaTHbU9ldhOF94CrgMUgFXwb5tF9BQxemOBeB0VqZ+6aiS42UAqzSrgFSamhAZAVJppUq5AKlXytLBtG48HaloBTnF3lUqzWQFsXpotQC2oNQGKzSpVypAfL0sO47iimyBxoKXUbemqXUl/XIYOGoYIQag1AKlWQhwrgPlxx7zSfIB+A8KScu6b4Qc4CgqVKlXAK8tCGKVKlSriOJ+WMBR/iOltW1Bi2Itr2QE3AwM17RVKvkjDUzAQwQqwcHg1BDgAq9yvg//xAAsEQABBAEDBAICAgEFAAAAAAABAAIDERAEEiATITFQMEAiQTJhIxQVM0JR/9oACAECAQE/Afmr1h9q6RrPKdq/00JrJH/yKa0NFDiVeDwv4q9G/UMYn6qR3hdytLp3A7ieRKOS5Xi1fq5NSxvhSTverxCRY7WeRKJV4tHjfEZH3z2Umqa3wpJ3yec2omdR21RxNjHbiSiVeCVav1cuoaxSTOf5V8GMc801QacR9/3yKPrpJms8qTUOfxtNaXGgtNp+l+R88iUTgq/hHotRPt/EInjaazd4C00Do7JR5HJRzav00r9jC5WiawMWmRuf4WnhMY78bVolFytErcrVq1avNeiK1Ulu2/8AmHiwhmKB0nhQQiIVxOLVolWiVav4qVfelk6bd2CqQN40+nc424dkAB45FFEq04olWr9Vq5N7qH6yE8V+QUTOqaCY3aK5FFEpy3IuRPq9TL02/wB4Kbf7xC0SOpRQNjNjkUSiUSiUfkHoHODRZU0vUdeAqxpo9o3IHkUU5Eon46+5akZvb2UWrp3Tl7HJdS1M/U7Dxxi0+5284BVq1avBKJTiiUT6i1rtJ12WPIUGrk/gSv8AcJYmfl3TNc7UdjxYwyGggK7YCtWi5b11EZEXon1NZ1WnYZCms/Ha/uhEA4EJ2AqUMWxvAuVpxVrcr4H1BU8/T8eUTwKC08e43koolEon1xKm1f6Yib4DOmoMV5KKPCsUqVIhH6dfQc4N8qTWNH8VJM5/lXzDd3ZQsLGUVWSnchwKPoHSsb5KdrWDwn6158IuLvPxAoDBRQKciOVq8n70szYhZUuofJxtXmlavIKhlbK2wjgjFoo+mlkEbbKkkMhs5vFcbUkTpB+HlaXSyyMuTsv9PI00pWdKt37xDIdLLf8A1KsEWMOKJ+M/dc4NFlTSmR14vkDY7IbnnaGlN0Dv2UzTMZ4C2qlS1MDZmFpTCR+LvITm7gtDMW/4nIpyOaxXoiaWon6h/rgAqzFpXv8A6TNJG39IDhaONZp7/wAjfIUTgVNCWd1DN1GIlHgVfotZPf4DiMNYXJmkYONq1atEolTRdN1jwo3CRu0r/hfg4CtHnX2gtVqNg2jzya0lDTtLRaDQOwzfA4tbluTqcKKFxuUrBKxQusbSj6WaURNRcXGzxiidL4UcYY2hzvJKcVatWnjcFG7aaKe2nbgvPC/QPeGCypJDI6zx08XUd3TWBgocL5lEonNp4tMffYpprt8Fq1f0aVc3Gu5U8vUPANJFhaaDtbk1oaKCvF4tblfAopyvNq0RatWrzatEq/sjGr1G47RwZpX2E1oaKCtE4tWrwSt6EiDkXLci5OObVq1avA4X9zVT7BtHnDoy0WVDpy/u5Q6YR9z3Ob4jDkcAouRcrV/CD9+SQMbaZETbz5UUAb3d3KLWk2VuW5WrxfAYccWrW5WrV/EPulSfke63rei9b0Hc6wSjg5tX8YVq/tuT8FHDSgcDAyUUUckq8j7f/8QANxAAAQMBBQYEAwcFAQAAAAAAAQACAxEQEiExUQQTIjJBUCAjUmFxgaEwM0JikcHRBRRAYOFy/9oACAEBAAY/Av8Ab6zSNZ8Vc2SF0rtSr207RuG+iPNBoJNNTXvNHPvO9LVSOkDfqqm9I7Ulb2QNjachdxPeaV3j9Gq7euM0asli5MZGH7RL6rtGt7xRrt6/Rqu1uM0bZgsUQ0igzJVyMfE692LG+bJoMgvMfw+kZIuPguxtJVBi88x7rxuq/wBAzRAO7Z6W2YW4BXGNLj7Ihxq52Y07qdn2V3F+J6JJqbKnAKjRZkrsd4nQIia7U9Kd1ow0fJgLKMxOiN/CnS3NUiaXfBXH3b1endnXTwM4W2NkcMETbWMcIzJQiDr3dnUPG/BtlTkLcRgVvNoj8rQ9VdY0NGg7uSORuDVRUbYYZOU5exW4HKMSfZU7vum/eSfQWXim3MqY2M3gq0NvJ7468Xd3SyHhanSu62AIJt4G6TRCVxq+Rv6DuZ3brruhojBKN3M3NuvwtL5DdaOqutwiGQsrpbG+cNMRN673UzjB8Yr8kDxPLciM/wDqEZY/eIUfWMdLAFQWCMYDq5NY3JooO60OSk3D+AONEJIQY304qap7ZiX3lhlZihQVOSunmdi7ux2eE1lOZ9Pgu9eixWozRnrwRnD37qXvcGtHUoxbJgPWqnw32mlV+ZqiAFCRePc70j2tHuUWwN3h16KsrzTTp4/ZMiOF40qmRuIJaKdw8yVjfiV5YdIf0C8u7GPbNVke5x9zbgsrKWkE5j9FE8dHdvvyHHo3Vc11vpCxNuS6LFypZQ5K+OVUVFUYJklA6hyTZG5Htpkk+Q1Rlk+Q0swVTgsqqlLKqqp1V0ggoncl8XVB7b8cujslcMVPforoG8bdvVFjb3wcqjLtZkeaNCLzyjlFlcgsvn4ANVdkBb8QmhkjHh2gKBkc271DaqscQHgoOcYtRNKFVxwOaEROB5f47UXE0AV1hpE3L3sqVSytnWhR3g3TNXDFNoy84dXfYGdo/wDf8p2ybR93Nh8D0KDXGrDyuCvfjGDu0/2kRwHOf2sGGPgocNE3ynmvUBAhhcR6j9neZyHlP7Iwz4vbg7+VupuXI+7dVUZdn3bD5rvosVgKKtt9kbnNrSoChZtELS5jQgxoo0ZD7R0UgwP0V4jLP8wTZYqF1KsP7J2yP5o+WunZrxxeeUIySGpPhdQ3WjqUImZD6/b3cpBylHYNoq1pOFfwlM/qMHq4wmysPC4VHZDLIcB9UZH/ACGngwQMjDuhmrkbQ1un+DvI8J25fmT9g2webSmPX/qm/p0lSG8Ubuxl7jRozKwwjHKPBI9jcGDFGaVvG7IHorrGho0H+GzaGvMUrfxAKtMexnZ4j5beY6myiutFSozI+7XnGio0U6943EX3r/oFuSDeGaEsho954WdaaoTbU3h6N1V8cT9T07y6Z3T6p+3TU378Yw7ot7J5sxxLig9zAXNy73GZMY2Y3dT/ALh//8QAKhABAAICAQMCBgIDAQAAAAAAAQARECExQVFhIHEwQFCBkbGh8MHR4fH/2gAIAQEAAT8hhBgwyGCcYxl/LkIes9JlIkPQFrBxgwQxGLl4PywlSoQhCVhyPoUqnlt+0v1GjQfjlle9ehX5dIJpdTp+7hlQemI1GKhAQgQl4vIX8oQxUrJlzcuW1H8jLNvB3+cLdDmLsspP5nYYmQzVTli0emiCKwxYvliEPSYvCy4YnzLj3Zci14vyzd2PLHizFp5391bggZM2QZMEIZBFYWOH0vx6lQMkMVlZdCug5Yg/iR+Zd7bxfmdyOtVv23L+b92CH7ekPacvTz85HF8HBWIgipywqVGLFjFl/JmD1glRxxxep+RjO06NYmhA4mrRGK7XLzzq9D3ilv7Ug9AMOMIYCVK9BcUWLF+XIZqVCDh545f5dps1+pz7vWKtwkWgCbX3lzrCBlXpFociHEEkVWAhxkOAYBKgyWKLH5kYMMVhUuahoOng/wBxKycq8xblDb305gmhLtavywUCbl3GJvbsAs93rhWSBiGoZwggSsDLwLF+cIMGER7quOh1f73jKNIHkbYPUnuBQBQaAn2nSG+zLDLw1CW5s048X1yqBfw+vKmBci/QBhRLP+4zrHvVuzxEhg28957Iu+bIuCJ2ZCRKK3VZHUMCWyj1DKRWbjh+eJcIsFX/AGmMoHlCfhigapLHvHEdXqF1gLNN4XIeAojlwhDDNU5eggegJX0WwN/f/Mr+FzoN5i0NQ/b2vrK6B1dx4SqFlorcckUMGoYfQUGLwel+OfJEy6a/YzrJXS0R1arR2ZfbApLjOicfublHf0O2KlSvWoUwQl5IZJcX58lCAL9/ETXlo7HaDggkcnMVeype8hTNUSdPNWRUMGmLm+aECBKlQgPQfOVAg03UH3IFnSs15RzAYI0Nqm07fe8su7snLsKSaFXFSEKduqIaayC+LCYGiZgIECVK+gk2jPXsh3EDxj2Svnp+3mcaZ1KP4mySeLxZ/wCxIbjVtXHSXfLLVvEurDdGgg8UT2CcIZZKZdg+EXGRBiQPoxcRAAopGGmpi7KuEvrwnwja4FK9bgXcmyaiS8vVAJazQ6wj2dK48fbBSr9ABqUlIQQ+lU7YKP8ArcuXi9LHo7jg2uEnA9APiE7Ude7n+IOQzRlx6CEUUH6HUCcuIEoJWv8AA9b7doqIq4YNMo91A5OXUp0Sv8kEoH5VyGkW5xgghGLF9ITh9AvCTuHVL0u/1FqLoOh9pd4Emq1BHCoF7L7Mu5YfvTd2AOJeHCaMeRixwuEH0Jfid2whPBoWIPuv5Med4LpbLvmWWoMW+odaaeJWERumKnfRHXRLmFLhi3iYLJTFTmMfSA9avB8vtcXFyo3t9PSR60fvG2NaJl9/aM6ofaeYd5fR/wCwLDtwr2dF1C6a+GXF0i+wIGqIvf4l4dN08nhwWILwGo9RcVKwCGQ+Meo+AuXjqLtEo/QO0Xe5VtRx49nmDqs6qS7SR50QcbdOScPz1lBVVoo5Y4G++o5dpq8L48w6rWdZf5luthrrUXzFztAXT2igO5N6LQB3Dr7n6hIIKLE6zfFolYjgMH0GQ9R8qAstqy/A1dsjuDbaNMf700o3EUzls9sjcrV13drzHdAB0/d0QCeHuH5iRGlXy/zChRqXiRr0Nq9+z4eIu7Zfceo+YNNCD9cZvX/I+8ME4xIS4ODhgIEEPTXoD0nxTBCtXpGLOF/ZluI/AhCbbq9R93R1KAHMp8pd6cLRe5UHDf6Ihibra9+3ESLjmVFHqDpr+H96f+QQa3XqfB+vuxau/pf+JDSThTv39n0FzCCECEIYPgEXLyYPh2rsy6sJup3BnMOY2A5TYl1y3MVeJ8nZNiFLs/jiLeSHopolURBHSMO2cna/4/XtNW+8ngxKDTacdp7c/mEEFFidc0iYjlcGDFCHxCHpPSRnFwarp7yjAX1mogDsRDC9QT1NAXApUa0j9oUIlB0zUqEMSWTXh7UQeq6JOjBanC9T+6Yo4fLjyveK7T3zx+0WCJKhCXgyXx1ZIZYQ4jirQ77/AKjqX2rOcdk8S91KJOlNX2hv9x7u8rDCBDCesQFwq2f8b4mu0H8b7MA/R9x/pl0oUCEqEV6QggQfFMRkxccKBnEd3aKfz7A7QKpB0nPfBAqFXxFTNna+IDCuBAjKjAQwIQgyQSsKxhNuzsx0wG+Kf9JRFvQ0nb+b/MCDBWTgYpFfGJeRDDgRZbTpN6K6/wA8Nbh3hvQtdE5LA058HmKLU0Lg95UwehRgIYIMLXF4DE3BAgZKskHqq4uAVVilrEySGEQfIj0DLlxxzaur+1Y93RKJCdoDnk6o6feU7hbeV5Y4uj0Mlk3wKehCiCBCBCDEkYYrAPkzJgxUvPp3UnQTa9bmld1fuLt0iqBzXT7+xEhPS/ShhDpA3kDXojqJqWeoMBAggZqCMPkgyekgSp0veju6Ep0ieAfRYoWx5DxAlIjTi+YPEghNTlAY4JWFYDKuE0wmBUrIYqVBkRRfKHohqC4Xc0/7/t/mACqhiOkolSokqMXcJLYjgcECEBKwQh6RKgSsD5AyYMV9BBDKhQbiTjCKpeBDrEYGIJWHB6ySpUCV8b//2gAMAwEAAgADAAAAEH2HUWVRt01vusrnCqQdyy4N9XeYWWL2cdbhqRx0hGkn/wAs0nkte+AQgaKPE2wWfkGt2j1Y/JJpId4PnLAe3/kikDJPKyX9pQNglIi9KcD3LyLIV2KB7QVOhQZHc7sQaly8r7/4D4Qydu2J49xjIXy8xb5zVpyBHOglgjzzstSQq/p8m8/zqMBYezDcRwhuKVZtACMCW0WTFLAy1sZGYTVrfsdgKP3Q3F7rKImyM8xCB83o55LZ6wGYu5RdeI7Lp6AMoRWg4CLzuePJ7M55rLG3M4oebZO68kG2S/DT0p3Th/cUmwbUm7g/skONjaEm2qCyavWvb6KYFW2AmKms78tEtYtZbdAacIzaL9b6iRIf5emPy+0ABiRvgoxTAR8dgDbD5plFyEogUtcBEv8Am8krr0HX0PRe1t89izE+0Gjz8jUaolnmsk5yyiks1bZKkkNqS2w52KAqkjWVytEkmiuysoYxLaGX0Y/4aHqrhKS5MZ6YkkkmhsqzkkkQOp9gfQRBkAFYPmxJR4kkkkkb4Epj1ujAAUPLDQOrC6wQNRtM+AkkkkQzNwgHiYE28zo6YUo8csVUJJ3iREkkkCxdyIQYPqE2UUYrF8dAbxwpfhiBMkkk3+ww3QnxeW+y7PLTznY8DudN8XMMgHkrSWzu++IgiYVZqRZkUV/WYn7Xgnkk6khawJJQuMXP3iflDG6A+EBhYBPQQMn6A26DRwYBa/r+b/imdAcuoISNcLhqkgMkLg10wsUTJlq2+UaWXKVLueOM9rmmkkkncCt+MbCVspCfTY5xK9Il1hvLkmskmkHxIQqM7/EQmpcQNRUuLuw2WZXkoEm00oQG6Df4BzRLB39WcnufoYWtzmwfMmm2AKgGyksQOV3Rqr9fM2DZszWWBkgkkkkXW3qeeGsg2eGFYhkGJlRzvk65Ekkkkky+Ti1yD25a5AtyDMXfugXkmYkkkkkkkcL9pZf+MoG7i7OqkFJtorQTzkkkkkkkmCfngR+ZIUUu06s8RU1hhMJikkkkkkktGftSppknhiZ/VhReALFkhOoQkkkkkkInvAZg3jSpMLQ+AHeigckkv8Mmkkkkk//EACkRAAMAAgIBAwQBBQEAAAAAAAABERAhIDFBMFFhgaGx0XFAkeHw8cH/2gAIAQMBAT8QzRCdQmJkEkQsUuLxmLCjE5lBeiWKL0UTEwjQsExOi6GUXXF0XgPKxvitnR2LYmdjYniwTJiZIaEuE4I160SVh/H7NRZ+7H0ZQkJa4KGsEtEEFmjGxsvClKUTwhiJBZWh0QnlEEsJiylw2Mi+Tc7v/fBHEiAKv8ft8UhBCQlw6BojCQWIQbKP0IQgtkOxcJwQhEFhdCQuO+0fP6OiV+7E4hdiO6EX3/6TigooFQsZLCDRCEy+SylntYpRP0Esp4lEsLC24j2I+/8AY6tv3feE/Yttll2Nb09hMeFgWJUTJSIIXBvDLg2UfJCOspHWEXKEI7wkISFlZWkJNf2aLiUXtE1YaBrBD6wlj0ExLBBLCFijeG9FxOE4pZuKMWi0vG4Qg2EbxNe5tJX7sh2GNCd+BFGIkL0vPkhDoSEqJYEhBBBCEELDZRso+FFzomJEEPQxEEoXFELMCR8L/Ikkdis0uhLinsEKC8fIw0LQ0I8WEiFggihJmlGylLi5XGlEd8FjvhcIQtCYhEl+u3/H+X9qQb1E98kPpiGyF1rJ9xhDYhGNfEK3AmFkuDZdYReK4dYSFiUhcI6LwTwsLDae/wAPH7+olBtzJtNDYnv9g7SmEJCELDDEs1QXCsnil9FsuEMTEUhBaLcrZBawnjwRvDz/AB/nr6iC9mLYugo+A4ANa2UI7EKGjhCgo4JEy8P04QSIPsRJwb4rEZsTw3z34eBI0tLBT4/Hwyg9h7G7ZRYQhI0DBBGWCcEuLw2T0FyeE8JCWUjo7E0XFx2fS2//ABEp22Ik9D6Hle/Aj+D7kIQRBeBchYhZUQuNG/QWJvmsIuhDwsdkGsdiYldjFBfr8sSJMFsm+hzT0hqMgkQhMGEuSSEhYgkJcExvC9KE49Y6WFopKJQhDdlV5XwN7F8eUN4OZJKtil8j7EZ2LhbvIO9saJw0EHMcsSCCRCei+Gxems74rCwkpK5Jr2ur+xZlWn2ot/v8lYz+C/2d19RIRbpt9/7rwQREkJUug13YyRYJUiUGLHiFgWsEhejcLM9FcfOUxDwh6YwnUSjvappVPaHoLfa8X4+DvRev74oZdHR9LoT2JkpI2wVIIFAvWF6lwli4uVrPkQ1mxv8Aq+P4939P4SSKWD2MO00ntlpWKGjIrXBYYb0pl8exC5z0khjcP0n7/QhaRDY0JoVbQlZaD8CgQ0HrOovDobomUIr1BeKzRCxSiKJ4oncvDSFY1t4vv+jru/fyQQmIaF2N4IHHQ3rif6KI6GrHO/B9D1hCVFgvQby+D40sxOMxZ2drv6Hiv3fj9nlf+vgTRi+BvCFQ2EniC0hCNhuPIuhyyD5DwSEEsF1xvrJCR3yQkeHnlibSv3ZTR2JUTQQ0FoXyXL4ErcI04zsfhRjXg0wJXCkF1mDwpTCwXFcHyWeuKz1l4v4oIJJESCeLRKjZONFeJN4b+4p6jzap+z7KvP8Ab9D1P+HhlPb70/8AwbORtC40JzBNcFobEdBdZeEuEF6DFyRRA7GQL6kNxKD2yknoa80HZ10vktdv8iiPaH2HhmKH1PleRluhl4ifq84J4bMokIJcZwhMUvFcZwY0XYir7CEhPwNBMpdbIpbf75La0XwbPBMEEsL/AAvr4f8AkWPoDMn9UXU68YlINzKCQsJCWE56NGy5hMpTKFwR+Ji6Eh0SwhLYzNtaL6Ti+C0kEIQWBYqQdc0+6/wdBkzWrtCeMIMMaF4KLIXoLhOEwkQgsJEPZt9xItIYmM6O9Y/tTbHr7HiEEhBBCjFWBFkNDRTf+plS/qK8CzqUWSGKUTyYb0kpwj4IRMJYm/C7EpGkJ3FGyT7xjKEwiCQlhLJSyG2E4m6NoxbFhNwIJCwIJeiniiEIayhlySQUSQkIbRsU9lj1iWJrBLCKJiYtFwJJCSwfo+inxkKUSEokXBCCwUJ6SxM0QohcHv5BMfL7xTwPV2MrV1+R8ZWNEIJCvGCwlFgpghD3MYWntCQkSgkTCQwRSL1ITC5LNEe4f4I28NJC4W39mMq1GEEosoUsOhhiLiwpCEEkhIWU1BieIIQ9ZMvBbysJEIe3K/JCUWxl2zyK8x/gRwohIhEJbySEzQmi5DBEQQSgkIJwYagmL+gMWijwniYQkQetRmup3PwIuoObtMrBChoSNjCSD2JYkEqIyIIpEJMghZQg0JhMTE/6ClxRFwgtISsZt835xXDckQaPI+sJluNIJCaOsIJCEwlhLhBMEEhevcIRBZQp2G0XBSCmNUxo0FvCiEdMUEhbEpgSEg1hIXKDQgkJT1v/xAApEQEBAQACAgECBQUBAQAAAAABABEQISAxQTBRQGGhsdFxgZHB8OHx/9oACAECAQE/EA2zjLJJvXJEEEQ4PwJL5LznPx4MMMM8PBLOpj1y8M8ZZBBBHr8Gy2274NtsPkl7jkC9qG3I+xwgI42Uzp4L3Dbw2WZsssggiH198H1P0Q8es3X8rrOp/wB8yNq22gfv/B47wK23OJm8CbbbwPARHO/SbPDYbZeV43l4756Xs/8AfN7Fw+xYtfiOQ/2Pz+fXGx4gxZq52HhvIQ4OByeO22cPhvO28ZzvKWSBq3T9n9LoF19iLD5g/EmJz5/tZj2+88HGUspteBjNmbctjuIIizgYbedjgeM5PBs43y22DjpDtke09s5XLNG3Yu18/wAS+X2nqWWW22Z4DYIIIPE8S2J8N465ySeV5TgXt3dDuFswZFiwTrKlexn5W287ySymLPK8ZBCCPELJjrgPLOAs5ecsnjbbbt+39rR142D7y5AlebNsn38fbgPA2yzl2ertKWWeTLIIIPE8sstvjk52zjPFsmbOPfo/q/wfrl2g9p9dQi19pnDs/Hu/pJPqSXPMasa1rwBZwCzwzgILNg5Hfr5w+Dqnr93z/H9pbSD3euWMEnnQ+8pDu8MzCWczwnitbq+GQWcByZwcZZ4B4FsH00sstH5fH9f/AD3LL7XpENl+0AgNwZZwzw5eIBrrw3neCI8Mg43keFtjnbfpZZZD8N+75lg33CZf5fzJz6IAHxHLMpXRKfAB9Asg+k8D4t8cbb5By3pfbo/mW7GE0MIj8fmffL+kW22yy8SNSzwE+WQ8ngs4XLbPPOM4PANjrhmCdEiv18S8Cb7D3Fs9vANtttvEXTmFl5HJfFgQcnG8nVtt7jqY65HfMt4Mgsfhv8knw8bkQVepV8D9Zs2DL1MHoy9ch4yjwBFzGy+bbweWeSTzl1weAcsxA3c7h/1MRJnrt/4lzJ+bc/yRvpfeHr/v62zBzgEg9T7lOJuEUMHGrLs/S7+mtscZxmwSTHl8WTE7hyL8+fZ7mfgPT+X53R3kMZhw937ZJLc8CLtW7Xh/CngbL1wO85ZHAWckvAhOf+H5v+v+1F14L2Qul+QyyeC4MbWXgjhJJPwG2+BYyWZHBDxlnIxbbYmtjv8Ak/iRKvfgupugsFPmaskeuKl4IgcjxB+APBmWcZZBZ9DIbVkJnZvd+vtw9+A5Hd/dI4+pEbbuQmfcQRwyTJfwhn1vSherrF50nte287ls8k46fF0dz1wXfANLKYjg4Me5fJln0dtt4PpbfMX4JDtw+1t8cbY4HcmzMevm6Gx2cYWh/wD7weLcmvYdwXqG222WZ8D6nxznJ5rqc+G7bVhx6ZetsJpaQqPk/acN2+Mx9+/6XqP8WDTP9vtxlnt7/J/7+P6BXoZ65DdmyySyGGXkvgcbzvmcHPUPk6bolS9fHDi9wcfM6dwbdpk9haT0/wBO5rT2AdBZkX9pt+z8P9raLOhP9n5PsjUfUjp/R/7/AL/MpShk4JwSTjbSWfo7bHlkE8lngAV9T5np6/m22S04ZZKa9LuezAQcbw7TMg/uH3P5PZ/iZB9M0D2emHb5PfII7g5Fm2ec+jkHhsc7zkdcbbx+6f4ngMJ5OADZamv5wYQcLMYc7oY2l7H6P/v73zlLH8lns3ko4MmSySyfFtsfQe48Nth5WV9yX6Tq6wQRBKdEcHsicOoh4bbbwZzMYEeiGO6xP8iQjgt6tmyySySSfEbfobwS8jDPGo+X0TD2MxZHVqfbBvCZZeCy8gx4Ryl4Lj02zjeGwc9Syy+GWWfQZh8CIJZbaTmfcXTDr5ig4Sw2xF4eWfMLbGITvzYPntCpZZYYhl4Nbv0Ms8s5Ak5JgL6Jen0euPd84ToOizZ+/j8rDOEzYm8hu0smXFTNtmF2ae+d5EeQ38Klk8H1dh9H6w2R9pTLh+pZ5wjgL3w6xwwjHBrwPA0ltmMeDUMuFtn8GPFbeNvvq/Sx9sA6dhPQXZELaxN6mbZQ9cFFnyDWLLLLyXrgHZNmfw28NssqfxB9t+h/eX2/Yi5dljg8Q8NJkfALdJup4mbLPkT4SSz62eBznDwsLo/A+Pzu/ILvbbDwOwTMzgcyt4YzeXzURm2/WPotl6Q7jguEJYeDGCzwSl5FW8Lhnz22H6//xAAnEAEAAgICAgICAwADAQAAAAABABEhMRBBUWFxgSCRMKGxwdHw4f/aAAgBAQABPxC2JlBL4sxx8ApgIMpux1ERdxmuAzCVKmp1OuAlSoSqhCEqBBDmGJAxCahgl3waqdzqYlPqCRLJbKpvKuETFhQNuIYSptCFloXiMHAh4uMuLh56hycHAQiSvwIOBwWu5rBcBUqoMMtl4nsixcTCMaMsP0gy/RLS4pVHqh/wQHKKHM8Ob+ywZuV84lFY9w3eIZcOGUwsxLrFZTOOLcfmlU0xPCWR95iZYtRgeKgQhwEDkgQ7lQJUeWriBcIFAqGo4OJcRH5g3GkOsNMxsd3hdH236l5cx3z/AB9VGgo2kq/+9yhHi0mSiye1QlwFQY4q2ZYz1x6yzCXqUaRswFamJCvHRChEjruPURjweJWIk7hKlcdQODg5CVK3ByBKxKzOptBxGLnghtAknigi/QfVsY1dvbHjY/5GcQ5cMoh6802EsaKwCbA7a8p8Fy1gk1FmTHS6nqlRqXdT0ygg1BcsI4VN9So4LUKOPBlQh74BKzKgSoFcEJiHAQJpPhwkuKLFSoQFEvHElWCtGgJXuMW4vvX9XGgYqWQ/LbFJcld7hkA8soL2LxuINdBbc9bP/rqANGp5/b48EMKrgFy5mCNQRwSs7YMqhNYpUyhlqUOYeJuhDElQhMSuCVwQIHcz+HhB6ivECEYjDcylkKRYmYskuDnn+no+6mUB5H6V5+W2D22AO4YP2RC8/Us6/IhMqTrHyuiAnqtNDWh6P7/yg4dSs8ARJeMmGGYYYwPuPMRUEjG3ncOIqw5CE+uO+DXBDcPyJcWYoa4OB8V2blW1dkK8ej2/QxNHGFFP2f49RFZb9wqcEyGvcpTDpe0bXeGIMs81GGBqX9+Ja9BF1GvbnLMVyiFkqyMvDVmGiWvJimYoDxKMzAi1Em3PCrjqVUKj8zuEIy/xNfgsuHBOocHljIUwtDaXzKExlzbv2+f08xU8rYKe2LsrALILP6DzPlaYy/cQqfFSf7MoEE2McB+i0folIE6k83WX0wrVY3KrmUqETuDPEiyqM2CmCYuFa1LzBB1K02zbw2Tc6gwYzqH4Gp98kJ3+XXNwvzGyrcKptF6LKU9d9UQpVV7h9AgKlni4Qg0CGbOmDI8MA9RQbUwPZO2BgZuaRKfLoPmWQ1OYhqlS6UtvmjERUWZcVBWJpwRZV1LViKxPEc6jPUp3MMp4j+ZhHGo9suXcGXu51Dg4OCViGeA4PcxO/wAji4blIT5x+544Aaaf7H+qlh53L36hOvI99kuRUo/tFYmFuyUAkOBodTf648QGs6wLasDox/vG8sh1FcN9SpCi7qCmoB1PXBhnUpKJRCUstluLl2S4TPFwccnITrgPxXhhOp3Bjgw4AESubJZ/Qf2kYZsu4j829vRKlEG1IxCCADQ8j4iP3IH+kU5OwfRixrvxiawfkH0RWcbRQLZhl7TKo8RFOpeanrgkKr8AENcP4HAcXwQgSpUCVx55J3LnXJ+AwbllWoAWr1HrlUdAc/Zz8VAYQK18HcwrezzFqAUq/MtmE+C9npqk+PEbWLYrQgvkt6mHAMKtaKzwrHBzOipe8JRjpTLuoR1CIASw4DBArgQKlYmNwUiwlcHHmEN8HO0eTmuOo8GYstnrgmQPTTTp+zR9+ItxONeoGVYz2wKkm3OVuvSV/cxC9jGVJNmkgfsEtkOCValaY9/0RyR4FXqBtlzNfED1Kpj1KJiY/AeoMco7lAl0XghC4EODUCEMXL/O8Q5udQhEjB4AMuXldD2sarSF2OsegiV5K1U0Hlq9xeXo3AdgAnxYPkGKiIQaWtPstv1KVi+ouoi3XAEMEh1CRi1xUHFg4WiSj8FFZb+BAhDk1x1Dg4qp5/JlLLBBgWrBd4TZ/fhGOCax9kdiZg9I6XhaLQf/AH1Gi7Mb/wC3+fuFnsdsvfQvzL6L8ZnmcxEC/AWtYeG731ACAAKAMEvtqbS1LBqIbIt6iRTBVhmHMqJXxYJSU/IZ1yQhCEN8EITz+JyS4pxcUrgwUxKMV0d5iX5Nn/2EVBtV3yIsOsmHpLgK2JE85Y+iJwKjgsEaA9LbemtRC8Sh/BUuvcastj1K3Oi8dRwbK5RCl/OvuUFAHgKP8huKtE8SGskAajYcR1xAnUM2f1CMEI4GyUfwjDjEqUwhCVCHPTBK4vgjOp1xqXczBplDAgw9QGEdjFnKSNB0njRkmzq6q5umh3Lo7DKAtt+rmNKdvqW5sMy4sI+kjtFgrbYKimYaNFIV/d/cWZilzKM1MtRRpjtJj1AOoB1BRHmbR/xEMwhOuCEITrj75oPwvi/wYyrYDE6juwu2Bwg/+nzFdNr3K3OzgRJTY+Tr7gmWfdHZCr2ljflBPIqbtEF9ZDEVl1hvcCAxcSl1KSARCopUUWYfmD5ln8NQ5OA4Ic4qD+Oody8QZcshEmXCe/rKB8stY8tFfF6e3PxEqBartiK1EhbIeqLmGDZRjV9t/r9xWaGg1XklIMxbp3b9UfUqc6hB1FF8Uw4LIKiqYJXDgW9xZbFZ/CQg8EOCMvg3zcZfFwZcWDDtBuFXXUD8XuHhEotN+Nv9SuNNq+iMfcUnbLRzL2Yq4BRbdwMlkXpf80fqJp3FYCoa73Mt1xWgtBYOCj6iWO5bTg3VBMCKiZIuNhjWd0NcV/BmEPXA9cGp1Djrj44HHFy5cvMGXCGKtWhb63BSMxT+xz/U8Q3pg/8AGqj1G2sf9ytgIJWoa1awdKboah5ZkXmNhtq6gqFMBkJmAEpTbIX1fjplxA90Jkyez2J5EsiiL0xLviGmWLI4CwUmRcGIODhmTwUQQQcrUYtmnBxc7lwzCVidcY4Nfwo6DRn/AMx5YH2jMoPfa+2KlfawyqVnSxm0eAgoJsunKXwukLXH6A/vYLF701oRzHqvT5I+fS2YLWr+5nIZfBdYjcUVVJHbqRwyUiJnrMMtqmQ3t8+SUAD0afaHScKmYpRtgjZG5I3NYycEdQcXw6iy4Zg1DUNfgQ4V+OUYfhcJoX4b6Y/76jyctBo6B4lnivYQw5eiWxu1Zb6hQLFXWfhgdyyGiaq5NSptTPzEgl/0MS17TYo6muWAbHpGANMCADTfCL0eYudFQshFJkCVnq9MFoU2FyUDgUMDWaMSgnmVN6TLYtIXs8ywVEx6nUvTuhVe6M43YwgwealrA6R8RRq4BSaSmFoBAYhAhDBBU7w1GVKgQYzAxuBidSuCEJWJX4E6nmLF4ueJ+5j/AJfUfiys4/73axqy7hlWNC7RyV+4IKtslu6s/uXVGTIxu3Tuo1Ors7IHaFUUBfWXBDRmiEj0q0+CJhi1gWqFgPNw3n3SfFqyZAVG6vFpamiQaAoIeRlzcVKd0WCPqLXzfUBd3BKCoDwRH96RhpkMDAmd+e4egRX1nfhc/QzRwUbh4DqY98dqixY4wckeoHRCVKhFEo4wSo1FhMIQZ5mIQ7hNcMeGhIeoBtY/CU031/1HR9xbTMqcu7NsJpFZeGCSjc5auIwY/pjPXyHuIhvSmceEZwpGjfFg/vEKCpS/mNH0RRV4iLuC3ARLEQeNk4AoGxg/SqOqaYWVQI0s3OkV8Kks88zanD7VNX9oyx5TUYWH0ZPs6lEFES5hFZmy0lE1rgMrzX8HRERi4QTuaRYQhi5eIvFRICtEOwWzcdFvB37x1Ea5tFEGl5SXb8Re6vEOlM7nV1UVijkWr9RJHgUxNKNVjOYuLgPsnaK/pEytgwgvXJNjUMtRNCJblQWI7EggZ/hTK3z0vcKQhne/c8+XyN4c6dHBstgd/wDRh+1IWB0j4gxKxLJtmDMXAaJXhpgsVk0/gGXiHHtMItwnXAxAxGOoMNkIDURAa9mU7e/H78ShO1pS1VyxAlFBUFAf8TMPiHaBAlrwRH0rTotY7yfuKaaooDJdLzv3bKgehoHqJEg258YczXgRIU0aQPETAnY6O10j/wCphElp4z36H+inUaJ/HxPgGiOk9MvnWnBXq99vHwniBUsqoBIE2xCxwXmW3HuCxvA/4SEGDBgmUnHtw+omL4hmEMcCpfsfT/5LulM7i2OpS1LepeQZgT4I8FJblW0rurfr3K1R6aU2vbARwRZhthQ3qHjHlHBT1MHAwYBqs0u/Y78YZbKUdva/s1dJtjjQAWBWFa6bH3nbL7mruk0+zT7iuGFp6JUJqK5UBiLylH8BUOLhxp3AckSBBGOEVsAsrFHZnoHtjpcq+oiGQMsUKZXcJewgwdeHAv2xEprNlOrna1rNRrw4NHy+X3MdwQSRN1KYcwFRZqU6mbiXsxcBkBWo2NR34wwDXu8P040YVwFGV38nnF7GB+vSxNLbWQU6YeI8DSMTPCRd1PXBIAP4RhDWZ3CfOYQuVF3FiKdRS8xmU2KAbY0UMjs8/bDFquOsrjIooA7jfHPFauqgzs/AwpRt07VHtMV4vzCbIsGH0RdxQqZJ6ZcaiqsIi1ESCJdjXxrSk4V4G3UPndE3VoYtK3eoVDIHJC6L8Fv7ZXxAGBUQrXCqz1z1wCAH8h4hCHBYLBmCEaRy8zvwyMB17D+36jdWP8J6TLjoABaszbLUdZB5Wb8e4scGky608qxHqUOSF04F4gNSp1ANVEPBGSwjNJLiUxL1KXBaTZjhu4KkGoOAXC/CZ1/MMHi4TSEqCAyxG44Q21oLdMX8uiEGcKIGaTySpP57oF+AMK3nqYALQfoM/wBjG7ZxjD0NPvfxCdwXMHKpRGsNwyBUrPEoC2JZupX1L+pT1OqohOiYuM6lYjuNphgqKoiVhr+YZSDGKDCViE3lpBrUISz264D5YKF1GYNausUdEv6MPYNtQ9325+Jc5wNXCnzCbJpqOMQJbpL2gCAOYzaVYXXjoISNwkPFAOoPiV9QMPCCaTSdSkpMEOXh5iBX84MGDdwfMIOY5cILlEDQy4hKCxcD6C6O30zTlAPEC8EHxAdIl2ph1CRqUtIQGVYRzFyxLiVkFsKsyg43zPMcR3ACHMMOPwSypjY5szwoQZmn8twgwXDc7/AwiVE0iM3ZCvUGrgIjCQcCMwUyVjhqKWDLmFBhVBUF1AZQgSBiDHBghr8QSJgCBUAfzf/Z";let y=class extends n{constructor(){super(...arguments),this._message=null,this._refImage=I(),this._boundVisibilityHandler=this._visibilityHandler.bind(this),this._mediaLoadedInfo=null}async play(){this._cachedValueController?.startTimer()}async pause(){this._cachedValueController?.stopTimer()}async mute(){}async unmute(){}isMuted(){return!0}async seek(A){}async setControls(A){}isPaused(){return!this._cachedValueController?.hasTimer()}async getScreenshotURL(){return this._cachedValueController?.value??null}_getCameraEntity(){return(this.cameraConfig?.camera_entity||this.cameraConfig?.webrtc_card?.entity)??null}shouldUpdate(A){if(!this.hass||"visible"!==document.visibilityState)return!1;const e=this._getRelevantEntityForMode(this._resolveMode(this.imageConfig?.mode));return!A.has("hass")||1!=A.size||!e||(E(this.hass,A.get("hass"),[e])?(this._cachedValueController?.clearValue(),!0):!this.hasUpdated)}willUpdate(A){A.has("imageConfig")&&(this._cachedValueController&&this._cachedValueController.removeController(),this.imageConfig&&(this._cachedValueController=new k(this,this.imageConfig.refresh_seconds,this._getImageSource.bind(this),(()=>u(this)),(()=>m(this)))));const e=this._getRelevantEntityForMode(this._resolveMode(this.imageConfig?.mode));(A.has("cameraConfig")||A.has("view")||e&&!this._getAcceptableState(e))&&this._cachedValueController?.clearValue(),this._cachedValueController?.value||this._cachedValueController?.updateValue(),["imageConfig","view"].some((e=>A.has(e)))&&(this._message=null)}_getAcceptableState(A){const e=(A?this.hass?.states[A]:null)??null;return this.hass&&this.hass.connected&&e&&Date.now()-Date.parse(e.last_updated)<3e5?e:null}connectedCallback(){super.connectedCallback(),document.addEventListener("visibilitychange",this._boundVisibilityHandler),this._cachedValueController?.startTimer()}disconnectedCallback(){this._cachedValueController?.stopTimer(),this._message=null,document.removeEventListener("visibilitychange",this._boundVisibilityHandler),super.disconnectedCallback()}_visibilityHandler(){this._refImage.value&&("hidden"===document.visibilityState?(this._cachedValueController?.stopTimer(),this._cachedValueController?.clearValue(),this._forceSafeImage()):(this._cachedValueController?.startTimer(),this.requestUpdate()))}_buildImageURL(A){return A.searchParams.append("_t",String(Date.now())),A.toString()}_addQueryParametersToURL(A,e){if(e){const t=new URLSearchParams(e);for(const[e,i]of t.entries())A.searchParams.append(e,i)}return A}_getRelevantEntityForMode(A){return"camera"===A?this._getCameraEntity():"entity"===A?this.imageConfig?.entity??null:null}_resolveMode(A){if(!A)return"screensaver";if("auto"!==A)return A;const e=this._getCameraEntity();return this.imageConfig?.entity?"entity":this.imageConfig?.url?"url":e?"camera":"screensaver"}_getImageSource(){const A=this._resolveMode(this.imageConfig?.mode);if(this.hass&&"camera"===A){const A=this._getAcceptableState(this._getCameraEntity());if(A?.attributes.entity_picture){const e=new URL(A.attributes.entity_picture,document.baseURI);return this._addQueryParametersToURL(e,this.imageConfig?.entity_parameters),this._buildImageURL(e)}}if(this.hass&&"entity"===A&&this.imageConfig?.entity){const A=this._getAcceptableState(this.imageConfig?.entity);if(A?.attributes.entity_picture){const e=new URL(A.attributes.entity_picture,document.baseURI);return this._addQueryParametersToURL(e,this.imageConfig?.entity_parameters),this._buildImageURL(e)}}return"url"===A&&this.imageConfig?.url?this._buildImageURL(new URL(this.imageConfig.url,document.baseURI)):U}_forceSafeImage(A){this._refImage.value&&(this._refImage.value.src=!A&&this.imageConfig?.url?this.imageConfig.url:U)}render(){if(this._message)return w(this._message);const A=this._cachedValueController?.value;return A?Q` + {const e=B(A,{player:this,capabilities:{supportsPause:!!this.imageConfig?.refresh_seconds}});e&&!d(this._mediaLoadedInfo,e)&&(this._mediaLoadedInfo=e,b(this,e))}} + @error=${()=>{const A=this._resolveMode(this.imageConfig?.mode);"camera"===A||"entity"===A?this._forceSafeImage(!0):"url"===A&&(this._message={type:"error",message:L("error.image_load_error"),context:this.imageConfig})}} + /> + `:Q``}static get styles(){return D(':host {\n background-color: var(--primary-background-color);\n background-position: center;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJjYW1lcmEtaXJpcy5zdmciCiAgIGlkPSJzdmc0IgogICB2ZXJzaW9uPSIxLjEiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjYjkzZTNlIgogICAgIGJvcmRlcmNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcm9wYWNpdHk9IjAuMjUiCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuNjA3ODQzMTQiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyNi42MjUwNiIKICAgICBpbmtzY2FwZTpjeD0iLTEuOTM0MjY4IgogICAgIGlua3NjYXBlOmN5PSIxNS42ODA3MTYiCiAgICAgaW5rc2NhcGU6d2luZG93LXdpZHRoPSIzODQwIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjE1MjciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEwODAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjIyNyIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiIC8+CiAgPGcKICAgICBpZD0iZzExMTkiCiAgICAgc3R5bGU9ImZpbGwtb3BhY2l0eTowLjA1O2ZpbGw6I2ZmZmZmZiI+CiAgICA8Y2lyY2xlCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eTowLjA1O3N0cm9rZS13aWR0aDoxLjM5NzI5IgogICAgICAgaWQ9InBhdGgxNzAiCiAgICAgICBjeD0iMTIiCiAgICAgICBjeT0iMTIiCiAgICAgICBpbmtzY2FwZTpsYWJlbD0iV2hpdGUgQmFja2dyb3VuZCIKICAgICAgIHI9IjExLjI1IiAvPgogICAgPHBhdGgKICAgICAgIGQ9Ik0gMTMuNzMwMDAxLDE1IDkuODMwMDAwMywyMS43NiBDIDEwLjUzLDIxLjkxIDExLjI1LDIyIDEyLDIyIGMgMi40MDAwMDEsMCA0LjYsLTAuODUgNi4zMiwtMi4yNSBMIDE0LjY2MDAwMSwxMy40IE0gMi40NjAwMDAzLDE1IGMgMC45MiwyLjkyIDMuMTUsNS4yNiA1Ljk5LDYuMzQgTCAxMi4xMiwxNSBtIC0zLjU3OTk5OTcsLTMgLTMuOSwtNi43NDk5OTk2IGMgLTEuNjQsMS43NDk5OTkgLTIuNjQsNC4xMzk5OTkzIC0yLjY0LDYuNzQ5OTk5NiAwLDAuNjggMC4wNywxLjM1IDAuMiwyIGggNy40OSBNIDIxLjgsOS45OTk5OTk3IEggMTQuMzEwMDAxIEwgMTQuNjAwMDAxLDEwLjUgMTkuMzYsMTguNzUgQyAyMSwxNi45NyAyMiwxNC42IDIyLDEyIDIyLDExLjMxIDIxLjkzLDEwLjY0IDIxLjgsOS45OTk5OTk3IG0gLTAuMjYsLTEgQyAyMC42Miw2LjA3MDAwMDUgMTguMzksMy43NDAwMDAyIDE1LjU1MDAwMSwyLjY2MDAwMDIgTCAxMS44OCw4Ljk5OTk5OTcgTSA5LjQwMDAwMDMsMTAuNSAxNC4xNzAwMDEsMi4yNDAwMDAyIGMgLTAuNywtMC4xNSAtMS40MjAwMDEsLTAuMjQgLTIuMTcwMDAxLC0wLjI0IC0yLjM5OTk5OTcsMCAtNC41OTk5OTk3LDAuODQgLTYuMzE5OTk5NywyLjI1MDAwMDMgbCAzLjY2LDYuMzQ5OTk5NSB6IgogICAgICAgaWQ9InBhdGgyIgogICAgICAgaW5rc2NhcGU6bGFiZWw9IklyaXMiCiAgICAgICBzdHlsZT0iZmlsbC1vcGFjaXR5OjAuMDU7ZmlsbDojZmZmZmZmIiAvPgogIDwvZz4KPC9zdmc+Cg==");\n background-size: 10%;\n background-position: center;\n}\n\nimg {\n width: 100%;\n height: 100%;\n display: block;\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}')}};o([c({attribute:!1})],y.prototype,"hass",void 0),o([c({attribute:!1})],y.prototype,"view",void 0),o([c({attribute:!1})],y.prototype,"cameraConfig",void 0),o([c({attribute:!1})],y.prototype,"cameraManager",void 0),o([c({attribute:!1,hasChanged:h})],y.prototype,"imageConfig",void 0),o([C()],y.prototype,"_message",void 0),y=o([l("frigate-card-image")],y);export{y as FrigateCardImage}; diff --git a/config/www/community/frigate-hass-card/image-88fcb8ac.js.gz b/config/www/community/frigate-hass-card/image-88fcb8ac.js.gz new file mode 100644 index 00000000..f7cf1675 Binary files /dev/null and b/config/www/community/frigate-hass-card/image-88fcb8ac.js.gz differ diff --git a/config/www/community/frigate-hass-card/image-b5d57727.js b/config/www/community/frigate-hass-card/image-b5d57727.js new file mode 100644 index 00000000..97c60e50 --- /dev/null +++ b/config/www/community/frigate-hass-card/image-b5d57727.js @@ -0,0 +1,9 @@ +import{a,cR as e,x as s,cV as t,r as i,d2 as r,_ as m,n as g,t as n}from"./card-7cd05290.js";import{g as u}from"./index-3c9b9749.js";import"./image-5371a090.js";import"./media-67c578aa.js";let o=class extends a{constructor(){super(...arguments),this._refImage=e()}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(a){await(this._refImage.value?.seek(a))}async setControls(a){await(this._refImage.value?.setControls(a))}isPaused(){return this._refImage.value?.isPaused()??!0}async getScreenshotURL(){return await(this._refImage.value?.getScreenshotURL())??null}render(){if(this.hass&&this.cameraConfig)return u(this,this.hass,this.cameraConfig),s` + + + `}static get styles(){return i(r)}};m([g({attribute:!1})],o.prototype,"hass",void 0),m([g({attribute:!1})],o.prototype,"cameraConfig",void 0),o=m([n("frigate-card-live-image")],o);export{o as FrigateCardLiveImage}; diff --git a/config/www/community/frigate-hass-card/image-b5d57727.js.gz b/config/www/community/frigate-hass-card/image-b5d57727.js.gz new file mode 100644 index 00000000..a6ef6a44 Binary files /dev/null and b/config/www/community/frigate-hass-card/image-b5d57727.js.gz differ diff --git a/config/www/community/frigate-hass-card/image-c0a8dc12.js b/config/www/community/frigate-hass-card/image-c0a8dc12.js new file mode 100644 index 00000000..ba4755f7 --- /dev/null +++ b/config/www/community/frigate-hass-card/image-c0a8dc12.js @@ -0,0 +1,9 @@ +import{a,cR as e,x as s,cV as t,r as i,d2 as r,_ as m,n as g,t as n}from"./card-45855f1f.js";import{g as u}from"./index-9bf80040.js";import"./image-1e2a0a79.js";import"./media-1a34ac2c.js";let o=class extends a{constructor(){super(...arguments),this._refImage=e()}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(a){await(this._refImage.value?.seek(a))}async setControls(a){await(this._refImage.value?.setControls(a))}isPaused(){return this._refImage.value?.isPaused()??!0}async getScreenshotURL(){return await(this._refImage.value?.getScreenshotURL())??null}render(){if(this.hass&&this.cameraConfig)return u(this,this.hass,this.cameraConfig),s` + + + `}static get styles(){return i(r)}};m([g({attribute:!1})],o.prototype,"hass",void 0),m([g({attribute:!1})],o.prototype,"cameraConfig",void 0),o=m([n("frigate-card-live-image")],o);export{o as FrigateCardLiveImage}; diff --git a/config/www/community/frigate-hass-card/image-c0a8dc12.js.gz b/config/www/community/frigate-hass-card/image-c0a8dc12.js.gz new file mode 100644 index 00000000..a0cc541d Binary files /dev/null and b/config/www/community/frigate-hass-card/image-c0a8dc12.js.gz differ diff --git a/config/www/community/frigate-hass-card/image-c6a10ba0.js b/config/www/community/frigate-hass-card/image-c6a10ba0.js new file mode 100644 index 00000000..88e6ca9e --- /dev/null +++ b/config/www/community/frigate-hass-card/image-c6a10ba0.js @@ -0,0 +1,9 @@ +import{a,cR as e,x as s,cV as t,r as i,d2 as r,_ as m,n as g,t as n}from"./card-c642ee74.js";import{g as u}from"./index-0a012f43.js";import"./image-cbfd7ccb.js";import"./media-6eadcd60.js";let o=class extends a{constructor(){super(...arguments),this._refImage=e()}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(a){await(this._refImage.value?.seek(a))}async setControls(a){await(this._refImage.value?.setControls(a))}isPaused(){return this._refImage.value?.isPaused()??!0}async getScreenshotURL(){return await(this._refImage.value?.getScreenshotURL())??null}render(){if(this.hass&&this.cameraConfig)return u(this,this.hass,this.cameraConfig),s` + + + `}static get styles(){return i(r)}};m([g({attribute:!1})],o.prototype,"hass",void 0),m([g({attribute:!1})],o.prototype,"cameraConfig",void 0),o=m([n("frigate-card-live-image")],o);export{o as FrigateCardLiveImage}; diff --git a/config/www/community/frigate-hass-card/image-c6a10ba0.js.gz b/config/www/community/frigate-hass-card/image-c6a10ba0.js.gz new file mode 100644 index 00000000..33d8936a Binary files /dev/null and b/config/www/community/frigate-hass-card/image-c6a10ba0.js.gz differ diff --git a/config/www/community/frigate-hass-card/image-cbfd7ccb.js b/config/www/community/frigate-hass-card/image-cbfd7ccb.js new file mode 100644 index 00000000..e0833450 --- /dev/null +++ b/config/www/community/frigate-hass-card/image-cbfd7ccb.js @@ -0,0 +1,13 @@ +import{cL as A,cM as e,eR as t,eS as i,dC as a,cN as r,cO as g,dD as o,_ as c,n as s,cW as h,t as C,a as l,cR as I,eT as n,dy as E,dz as u,x as m,cV as w,eP as Q,i as M,cP as B,cQ as d,l as b,r as L}from"./card-c642ee74.js"; +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const D=A(class extends e{constructor(A){if(super(A),A.type!==t.PROPERTY&&A.type!==t.ATTRIBUTE&&A.type!==t.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!i(A))throw Error("`live` bindings can only contain a single expression")}render(A){return A}update(A,[e]){if(e===a||e===r)return e;const i=A.element,o=A.name;if(A.type===t.PROPERTY){if(e===i[o])return a}else if(A.type===t.BOOLEAN_ATTRIBUTE){if(!!e===i.hasAttribute(o))return a}else if(A.type===t.ATTRIBUTE&&i.getAttribute(o)===e+"")return a;return g(A),e}});class p{constructor(A,e,t,i,a){this._timer=new o,this._timerSeconds=e,this._callback=t,this._timerStartCallback=i,this._timerStopCallback=a,(this._host=A).addController(this)}removeController(){this.stopTimer(),this._host.removeController(this)}get value(){return this._value}updateValue(){this._value=this._callback()}clearValue(){this._value=void 0}stopTimer(){this._timer.isRunning()&&(this._timer.stop(),this._timerStopCallback?.())}startTimer(){this.stopTimer(),this._timerStartCallback?.(),this._timer.startRepeated(this._timerSeconds,(()=>{this.updateValue(),this._host.requestUpdate()}))}hasTimer(){return this._timer.isRunning()}hostConnected(){this.updateValue(),this.startTimer(),this._host.requestUpdate()}hostDisconnected(){this.clearValue(),this.stopTimer()}}var k="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAUDBAQEAwUEBAQFBQUGBwwIBwcHBw8LCwkMEQ8SEhEPERETFhwXExQaFRERGCEYGh0dHx8fExciJCIeJBweHx7/2wBDAQUFBQcGBw4ICA4eFBEUHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh7/wgARCAEVAewDAREAAhEBAxEB/8QAGwAAAwEAAwEAAAAAAAAAAAAAAAECAwQFBgf/xAAaAQEBAQEBAQEAAAAAAAAAAAAAAQIDBAUG/9oADAMBAAIQAxAAAAHu/wBF+fKuKWoua2zblcOpTDeJqLJsVgAACCiNQEKJRCmEoMAhy1FzThq4VrCHDWbHCoilBWQKqzaa2xeTz3Uumd+Z+h4Sxy0VGmdbzV5AybMdZjUz1kEFA4AAEAAdEFAAEVKBDVxc1UtSgiaY1cSI4nPfl/N6eZrHp/Rw11mLJq83XO9c2ovO+Ry6ea+j4FY1uKl1zrSAAIucd5mlYUoBggA1ACiRiVgiCiW81w6JQqWpazQVTQCo6fz9vH+L2ec83o937PJ7P6HgsBAaZ1vjemdJNcb5HLr536PgACrioqFU2RZFkWLcAgAAokdoEhRKwgoHCCgrKpWrlQ1ctQpVU0jovN38P4fZ1HDta+y9HD3f1Pm2jEBrm78+muNXNVnW2N6Z15z6fz7zWSlDEkVnrMWKyaVgOCkA6AkBipwKBDhgIa1AC3KoaiuJtmPP+b0eM8Ps6Pl01lprsenL6V9T5vadMUJEa41y+XXXGqmrzrTOrzamvNfU+brnThgRrOdk2Z6yqSKxBTAQAgojBBRQAHDhhDViRLc1cpKhV5rzd/nnz/dw+PbkIqheXrH036nz+578LipVY42xvl8u14uk1pjeuNXNB5f6vzNc6uERc56znokjUEBBYAFACGAIAAAAKDyoqaEJRWVNOOn5dfnXz/b5rz9he1zutRGtfSvo/O731+aoYwjTOuRz6b893nW2N6Z3ebpnTXyf1/laZ0xM5azGpFioQAVgCiAAKmgAAoCAhgpDHLctZoNUvh/H6vnfzvfjHJl56taNNT6L9L5voPT59s1UAVLti8nl2rN1zrbn00zq860zoPJ/Y+SDM7nPUmxWIBiQoAKABAAAAAFEQ1BIBFTV5uktTXnOXX4/8n6euNbnYzWVjXkdMfR/qfL7X0cNM63xqpagKl5PLrrjdy643rjeuN641cpL4n73xUFmdzNCAACFAAFAAgAAogACCiQCiUlqWoqa0zfkXzvo+Z8fq7XnvmVx9Zmu27cvon1Pmcrvwcu+N6S689a51pnWmdb8+m/PppjeuNbZ3ea5QZ4H9D8JWISKhAKIApgAAgAK0SCiiACCwCEooOWocvTcuvx74v1+RjfZmk1jrPp/Z4/cfU+a9QHHIxupeRz3tjXJ5dXLvz6crl11570zqpXRDVnz39F8BwqlDUSCgwABgMIVORqkLEoAAJAFQAqsakOX5T8j6nQ+P19xNTc8nHXk9uP1L7fxI3hUK5d8a2xrk8+muNcnj25HPptjfI59NM6AHDVqHz79D+fCbFokAoHAAwAcEFEMWghKgALEgoAhaCiPLznm9Py3431+djXay8TU7vty919L5/YejzTYhDl3xrl8+nJ5dd+XTkc+nJ5ddcavOnKqCotoA+efovz9RGorEFMIYQUDQlYBAAtQAIKIVgoqRiqbAcuWNfH/AIv2ev4du3zrSqj6R9L5/fezxRYqRUC65vL5dOTx7crl15PLrtjd5tTRBTilagHzr9H+eZNgAwpwAADgGAQUAKwUQAQArjLG+s83p7P3+BhnXy/5H1vN+T1b5vPa1s9r34+++h87PWc9RwE2TV5cjn05vDvz/P6N+e9MbuWlBqAAQHzn9N+ecKwgGFjlBhBRDAIACkMSClEi0UOXTNpfN+L3ec+D+k7z6Xx+r8/o8FvlWddkbHP6Y+vfT+VyZqUmzTOtcbZnrNTXK49eVy67c9643rnVNAAAAAR84/TfnmgADgGADgAKcFEIBolKAEiRWhWbyMbivi3wf0EcuvKmuH38mWNdrbon036fy+768dsbcumd6Y1rjfL5dalBy0ry1zvXG6UAAAAA+cfpPzrAdAAMIcEFAACFoAISlCJSxQrUjl1zry3l9Pyz5P1MY1O72wxruK9F6vL7j6PzNc6359N8dORy6a43rje+NuAnRDjTGts7uaAAAAAPnH6T886IaFAQwGOEAAFAgAAAAAQ5Vm+D8Pt8J873xLKJeyrntdpL9I+n8vse/m1zvTOtM65vn9G/PpvjdQE1lrKRrUuuNbY3pNgAAAB85/S/niAdhBRDGAQUIKIgBSkEACpwEYvmPH7fCeH2dVx2mmVLFNnvLruq+o/R+ZyOvCprTO2c3z+jmce2uNMipsz1nPeHNa41rne3PWudtQAAAPnH6T86DAB0Q6IcFFJCBSwhKCBBQ43PfQ+fv5zyerzfl9XGzYRy6LCCiKucdxqfZPs/Fcu+OnJ5dUmmd87z+jkc9hOk2QznuXm6Z1pnWuN6501AEJGofOf0v51wAADGAQWCiClAgEEB13Lr82+T9TpOHaEUOXlzVmlaDlzlmzg3N12J9p+x8blaztjfJ5dtcbqORz68nl1cKgmxI2rmqy1xrSbYEiZais+c/pfzzQgAdOAAAAAKQQgpRwuXX5N8X6/X8+hHLObNaLnZRUFVL3HLp6P0eXzPSddJ0fPp9G4693+g+Lvm8nl15fHtU1rjV5rWpqoBDVxebpndytUJEjVqz5x+k/PMEFKcjAIKEFAAQhBWeNfJ/ifY6Xh25kvPWrMiluXVexzPQ/Q8HoPf4OT24llZvH8vp+X/ABPt9fqfSvT5fX/R8PL49eXx7OUVoS1LUuudENai860ztqwAEFAPnf6P88QtFRIU4YQUAOFaCRUiZfmHxvreb8vp5Evay1YWcatJe+9Pn9f7/ndp6fPGiSpRKl359PM/N9/kvN6uQfSvX5O81ORy63mxqTrNZ1rnTl0zqoqW86qaqVq4KAAAPnX6P8+IrFTHKIwhUwHCpWkIVnhPmfQ8N876HNl3rQYrnkdM/QfpfM7f1+VWCkXLedXCNcbvN+a/K+p6j0+fpPL6vqnq82+NXnUazNjNcbvOrlcC1LedXm0rUCAAoPm/6X88SA6ZWaBQhDBUipFZpb53y+r538f6txnWpVmusfTfqfL7D0cTWVQhDmtZrTN0zrTLfn00zrjY38u8fs+gduPF59PadMXmgE2VLctTSRq5by1zu86pQMgKAPm36b86wh2seQjUokqUEToi83qePb5b8b6153QrGdv25fRvq/K5PTDSLA0zqpXDW5dcXk8+nI5ddM6cvTZ347n07BPb9McrNqVjlcquW05QqXXFvOtJpqBAEAHzf9P+dACCql0zXEWMagkjSs3jc+nyf4/1sOfTSWyLO87+f6N9X5fJ1EBNjipdJalqWjbnvlce2/PprndZoeXzvgmlnsrnTN0zsVWRc3NXmuXTOtM6pQAAAAI+bfpfzgNUMoZWarCWgWbIoxr5b8f6/V8O2hcvYaz636Hz/Sezyck0zpWJLlZFgJbl0zeTy6czj25HLrU040zpnQY6d9rFDilCUVaY1rnVzTUAAAAAAPmv6T86wBGrCiAocriNJTwHyfq+U8Xr2NK9j6fN7j6Pz63ijk8+jgBBdsaqWUw6Yqa2xrXG+Xx7b8+ly1nVy6Z1WaCqNZVjzWVLpndKAAAAAAAB81/SfnC1hIDtBhDHKQjy/k9fgPk/V7beO69HD1Hp8/e+jz6ZrSbNM60zdM6i5z3nbn05fHtpnXH6c1W2N6Y1tjemdXnWmbedaZ2xIiNZjWQrOtc6poAAAAAAAAPmf6X845XRIwV2uAqLzoTi8uvnvH7O16c+768uRrNDluHGeo0vOtsbjWYueRz68nl10zus1rebct51UrlqNM7uVqIEmW+cay5rTGrmqUAAAAAAAD5l+l/OMYQwKtcripdc6uJ8nr7a5DXG9M6x3zy3loLFyJlvJLUa53yeXXbHTfnu86ZedVm6TQCOW5qpWoAJnc5ayy5qs22gAAAAAAAPmX6b825QcOiKtakmmdVLpm9t5PTyOfSprfnu86z1ni9uMazGs5bzFzjvIuubyuPXkcuu+OmmNXLeNbY1U01STqVLebTQAAJJQGtAoEFAAAAAAf/EACkQAAEEAgIBBAIDAQEBAAAAAAEAAgMEBREQIBITIUBQFCIGMDFBFSP/2gAIAQEAAQUC6hDofrwE1D+gIdDwfpNqxZggbNnAXQQ5Kwom+DOQgEBwEFrjXGkOpKJ+kuZKrWVvMWJUXeTsDVsMQ6gIDjSa1ALS8VpaWlrqfo7uUrVlcytqwhG8rwaFim0GzjqAgFpaQCA50tLS19Pcy9SBXMpYsrW0PZHax1J1ySjViqxjo0JoQHAC0tcBD6MdcjloKqu5GzaMMZI1pa4q1ZrMmMpMpxBDoxDkIchDk/R38hXptv5izYTimAl2zx4uKirSyyYim6pBpa6BNHAQCCHIQ5P0GuM1mPTT3lxUUJcgGtQCLXKNs7zhq81eu3s0IcBDgdifov5Db/GpOO1FE6VRQ/s4+y0CoK80rsZXdWqhBDjS0g1NatIBBqAQCAWlrja388chfyC3+TeVD/5Sy68/bijSltGnB+NXQQ4bwAgE0IBBqAQC19PtZu3+LRJ2q0fm4f7M0sQCxWMc6VrWsbwE3hqCAWkwIBAIfVZy3+TbYNuDWta9VnhyoVX2LX/OjUE1BNQag1AfV565+PVcdqkP3sBoR9xg6vqZCrTirSdAmhAJoTQmhBD6ueVkMN+y6zZHuWjxa8pgWDpehWIWuNLS0moJqaEAh119FJ5+Fa4JJOJHMijy+RdbkKrj9h/p91hcc90WkQtLS8V48NCaFGE0ID6cLSzNYPhNyz6dHMQyr+T+qXJo2QxrQG6VCo+1aiaGMCKAQCDV6a9JNjTWINQQ+nBQKc0OEkz6tya5t8V10jJmaMTSSxvtolYmr+LWCHDWrxTAgF4rxWuQh9O1ZvKNga874YdKPUsNc6k0Y34Wn52EE1BNCAQCHYIfTPLWMymb2nHyK1xVk0+WLb2bLMZCIqAagEE1NTUOu1tAoFD6OSRkTbmcgjV29YtO6FN9jE/yZjx52arDFXQWk1MTUOh5CCCHz5bEESsZupGrGctPUs75XE8BBjii0hNBJWlDoNx0xFkoIJqITE0odCtIBBBBD5t+3FUiu5OxYJcSt8AEoV3kCshGGoex9t+jomPyJBaWHRpvNexDI2aJqCaeAE1DrrkIfNu2Y6sF61Jan4ZXcQxjGD9db415BjduLC12Mr2JF/48L68uJsvnyGKsVZfJYa/tjSgmhNHA433CHzJZGRR5O263YUcBeoowxErSA9gAS6N8clenudmHb6sUEER2toFWofWiyNdvlVc6E4e2HhqYh12h1HzCQ1uYyBtSbUTNljkTobBBPu1U8XPMq9CrAieoQWaq+TcYIzas1pcbYxdgWa7Qh0HA/v38L+Q3/f3Ka1qPuWeyemD9Y60srocZTiPTSAXivFNavFZqia0uMljymOpSSYvJNIIHQcDqPl5e+K0etqb3LRzHDPIG1YparWhjOw4DUGoNVqsyxAPWxOTuwR36n8es7a3+sIIfIyVxlOB73zSjpjqL7hqwsrwddLS0gEAmBAIBaWVoMu18FZfTtZmF9O1XlbNDzrkchDgf3BHuFbnjrQXLEluf/gQTP2diKTprUUbI2865HRqaEBzpZrGC2zFWhbhwfq1rKCA6BaWkAtfB33c5rGZW665OOB/lWnNPHg6H47WMa0NatLS0vFeK1yEE1NQ5AWlexcdicMG9LXTSAWlr5Wcv+q5vuf8AuiXQYSQsjYGN0mhALS0tcNC8EYkWJrUGprUwIcaQWlpa7AIfLzdwwsmjeySWg+vRw2JLlSxsFZ4WlrgIcHhiHDmoNQagEAgEOB1PIQ+XcmbWrYyjM5UMXHA51dj3+C8V4rXGuBweGBDjS8UAtIDkIdSjyEPjjhn+zUhYm9NeCaxemnM77W0AmoIdNf1noPjjiP8A2M+yCHDgiODw7lqagghwAgOw+R//xAAsEQABBAEEAQQCAQQDAAAAAAABAAIDERAEEiAhMRMwQFAiQQUUQlFhIzIz/9oACAEDAQE/AfaPwB7Y+KPZHC0flj3GsLvCbpT/AHFF8bP+oRO43yGBms19WyB7kzSsHlCgtTM0jbypDLQgMUq+rZp3O89JkLWeFRVKXdR7rkEFSpUgM19VHpnO89JkLWeM0VI8Mbaklc/zxAQCrACr3L+gjgc/tRxtZ4QGaT3BnZU05k6/XIIZCH0tYGWROf4UcLWYGaTjtFlaicSdDm0YCpDA+mrEEO7s5rAVFF+3yVqJmyHpDgMAIYCGAPqImb3VgC0ETik+RrPJWolEh6QwOACa1UgEAgEAqVKs39EFpWU2/wDOGdFHMkzY/Kmm9U3zAQCAVIBAKlXC/pImb3bUEO1aIpV/lTztaKae0ST55BAIBUmhAIBV9VpY9rbP7yVGQfxKmf6Te047jfMBAJqpBqA+r00W92Go4lJjbam1DpBR5BAIBAIBDA+qaCTQUUQjbWbVLUybvx5hBNTQgPqGP2m1JpdzfUi7GAgLWn0+zs+cDMuo2t2DzwpUqxSATQgEFX09L+P1f9PJ+XgrV6COvUYEP42GZ/4Gv9KT+Pbpm7m8XvDBaJs2UEcAINXpr00I01iDcD6cZ0WtliYKUkrd++Ppf1Bcwschwnl3u4Bq2poQC2raqyEPpwoIPU7Pji3Gpk2NrAQQQCAQHMIfTBqi0v7egONILU9yFUqQQQQ52rVoH6NoLugo9I7+5MibH45hF+3tTyB77GaQTUPaH0DY3u8BN0bz56TNHGPPaaA3ocKVcSL6wEEFSaU08qwMD50URkNBRQNj8cdq2qs0qzSlidG6iggmnACbxpVwHzYozIaCYwMFDO3F8aUUrIzUnhanWxRvqMWjqYnC7UUgkvb+sSxCdlftVRo4AQCpDF+wPmMaXGgoYhGKxWL4EV5RLWi7Tte2ugn6iR/kqycBQSmJ+4I04bgmmlrIb/5AgE1DN5HEfMAtaeD0x/vgeEuqYwf5T9XI798KVYC0k1fgVKCOx5UMweFLF6bqQCHAfR6WGvyPEoJzwAn6p540qVKkAgoJN4o+VKwxutq/9WIIYpUhgcLQPy9LBvNnwq4lwCM7g40UST2eIQzSDVtTbabCNSNUTzE5TMo7ghwrA4hBD5EMRkKaABQ4yTNj8qSQvNn2qTRgBUmHaVIyxuCjdY2leOFKsDgAq+OExheaCYwMFDjPN6YTnuebPCuYQQGaTHbU9ldhOF94CrgMUgFXwb5tF9BQxemOBeB0VqZ+6aiS42UAqzSrgFSamhAZAVJppUq5AKlXytLBtG48HaloBTnF3lUqzWQFsXpotQC2oNQGKzSpVypAfL0sO47iimyBxoKXUbemqXUl/XIYOGoYIQag1AKlWQhwrgPlxx7zSfIB+A8KScu6b4Qc4CgqVKlXAK8tCGKVKlSriOJ+WMBR/iOltW1Bi2Itr2QE3AwM17RVKvkjDUzAQwQqwcHg1BDgAq9yvg//xAAsEQABBAEDBAICAgEFAAAAAAABAAIDERAEEiATITFQMEAiQTJhIxQVM0JR/9oACAECAQE/Afmr1h9q6RrPKdq/00JrJH/yKa0NFDiVeDwv4q9G/UMYn6qR3hdytLp3A7ieRKOS5Xi1fq5NSxvhSTverxCRY7WeRKJV4tHjfEZH3z2Umqa3wpJ3yec2omdR21RxNjHbiSiVeCVav1cuoaxSTOf5V8GMc801QacR9/3yKPrpJms8qTUOfxtNaXGgtNp+l+R88iUTgq/hHotRPt/EInjaazd4C00Do7JR5HJRzav00r9jC5WiawMWmRuf4WnhMY78bVolFytErcrVq1avNeiK1Ulu2/8AmHiwhmKB0nhQQiIVxOLVolWiVav4qVfelk6bd2CqQN40+nc424dkAB45FFEq04olWr9Vq5N7qH6yE8V+QUTOqaCY3aK5FFEpy3IuRPq9TL02/wB4Kbf7xC0SOpRQNjNjkUSiUSiUfkHoHODRZU0vUdeAqxpo9o3IHkUU5Eon46+5akZvb2UWrp3Tl7HJdS1M/U7Dxxi0+5284BVq1avBKJTiiUT6i1rtJ12WPIUGrk/gSv8AcJYmfl3TNc7UdjxYwyGggK7YCtWi5b11EZEXon1NZ1WnYZCms/Ha/uhEA4EJ2AqUMWxvAuVpxVrcr4H1BU8/T8eUTwKC08e43koolEon1xKm1f6Yib4DOmoMV5KKPCsUqVIhH6dfQc4N8qTWNH8VJM5/lXzDd3ZQsLGUVWSnchwKPoHSsb5KdrWDwn6158IuLvPxAoDBRQKciOVq8n70szYhZUuofJxtXmlavIKhlbK2wjgjFoo+mlkEbbKkkMhs5vFcbUkTpB+HlaXSyyMuTsv9PI00pWdKt37xDIdLLf8A1KsEWMOKJ+M/dc4NFlTSmR14vkDY7IbnnaGlN0Dv2UzTMZ4C2qlS1MDZmFpTCR+LvITm7gtDMW/4nIpyOaxXoiaWon6h/rgAqzFpXv8A6TNJG39IDhaONZp7/wAjfIUTgVNCWd1DN1GIlHgVfotZPf4DiMNYXJmkYONq1atEolTRdN1jwo3CRu0r/hfg4CtHnX2gtVqNg2jzya0lDTtLRaDQOwzfA4tbluTqcKKFxuUrBKxQusbSj6WaURNRcXGzxiidL4UcYY2hzvJKcVatWnjcFG7aaKe2nbgvPC/QPeGCypJDI6zx08XUd3TWBgocL5lEonNp4tMffYpprt8Fq1f0aVc3Gu5U8vUPANJFhaaDtbk1oaKCvF4tblfAopyvNq0RatWrzatEq/sjGr1G47RwZpX2E1oaKCtE4tWrwSt6EiDkXLci5OObVq1avA4X9zVT7BtHnDoy0WVDpy/u5Q6YR9z3Ob4jDkcAouRcrV/CD9+SQMbaZETbz5UUAb3d3KLWk2VuW5WrxfAYccWrW5WrV/EPulSfke63rei9b0Hc6wSjg5tX8YVq/tuT8FHDSgcDAyUUUckq8j7f/8QANxAAAQMBBQYEAwcFAQAAAAAAAQACAxEQEiExUQQTIjJBUCAjUmFxgaEwM0JikcHRBRRAYOFy/9oACAEBAAY/Av8Ab6zSNZ8Vc2SF0rtSr207RuG+iPNBoJNNTXvNHPvO9LVSOkDfqqm9I7Ulb2QNjachdxPeaV3j9Gq7euM0asli5MZGH7RL6rtGt7xRrt6/Rqu1uM0bZgsUQ0igzJVyMfE692LG+bJoMgvMfw+kZIuPguxtJVBi88x7rxuq/wBAzRAO7Z6W2YW4BXGNLj7Ihxq52Y07qdn2V3F+J6JJqbKnAKjRZkrsd4nQIia7U9Kd1ow0fJgLKMxOiN/CnS3NUiaXfBXH3b1endnXTwM4W2NkcMETbWMcIzJQiDr3dnUPG/BtlTkLcRgVvNoj8rQ9VdY0NGg7uSORuDVRUbYYZOU5exW4HKMSfZU7vum/eSfQWXim3MqY2M3gq0NvJ7468Xd3SyHhanSu62AIJt4G6TRCVxq+Rv6DuZ3brruhojBKN3M3NuvwtL5DdaOqutwiGQsrpbG+cNMRN673UzjB8Yr8kDxPLciM/wDqEZY/eIUfWMdLAFQWCMYDq5NY3JooO60OSk3D+AONEJIQY304qap7ZiX3lhlZihQVOSunmdi7ux2eE1lOZ9Pgu9eixWozRnrwRnD37qXvcGtHUoxbJgPWqnw32mlV+ZqiAFCRePc70j2tHuUWwN3h16KsrzTTp4/ZMiOF40qmRuIJaKdw8yVjfiV5YdIf0C8u7GPbNVke5x9zbgsrKWkE5j9FE8dHdvvyHHo3Vc11vpCxNuS6LFypZQ5K+OVUVFUYJklA6hyTZG5Htpkk+Q1Rlk+Q0swVTgsqqlLKqqp1V0ggoncl8XVB7b8cujslcMVPforoG8bdvVFjb3wcqjLtZkeaNCLzyjlFlcgsvn4ANVdkBb8QmhkjHh2gKBkc271DaqscQHgoOcYtRNKFVxwOaEROB5f47UXE0AV1hpE3L3sqVSytnWhR3g3TNXDFNoy84dXfYGdo/wDf8p2ybR93Nh8D0KDXGrDyuCvfjGDu0/2kRwHOf2sGGPgocNE3ynmvUBAhhcR6j9neZyHlP7Iwz4vbg7+VupuXI+7dVUZdn3bD5rvosVgKKtt9kbnNrSoChZtELS5jQgxoo0ZD7R0UgwP0V4jLP8wTZYqF1KsP7J2yP5o+WunZrxxeeUIySGpPhdQ3WjqUImZD6/b3cpBylHYNoq1pOFfwlM/qMHq4wmysPC4VHZDLIcB9UZH/ACGngwQMjDuhmrkbQ1un+DvI8J25fmT9g2webSmPX/qm/p0lSG8Ubuxl7jRozKwwjHKPBI9jcGDFGaVvG7IHorrGho0H+GzaGvMUrfxAKtMexnZ4j5beY6myiutFSozI+7XnGio0U6943EX3r/oFuSDeGaEsho954WdaaoTbU3h6N1V8cT9T07y6Z3T6p+3TU378Yw7ot7J5sxxLig9zAXNy73GZMY2Y3dT/ALh//8QAKhABAAICAQMCBgIDAQAAAAAAAQARECExQVFhIHEwQFCBkbGh8MHR4fH/2gAIAQEAAT8hhBgwyGCcYxl/LkIes9JlIkPQFrBxgwQxGLl4PywlSoQhCVhyPoUqnlt+0v1GjQfjlle9ehX5dIJpdTp+7hlQemI1GKhAQgQl4vIX8oQxUrJlzcuW1H8jLNvB3+cLdDmLsspP5nYYmQzVTli0emiCKwxYvliEPSYvCy4YnzLj3Zci14vyzd2PLHizFp5391bggZM2QZMEIZBFYWOH0vx6lQMkMVlZdCug5Yg/iR+Zd7bxfmdyOtVv23L+b92CH7ekPacvTz85HF8HBWIgipywqVGLFjFl/JmD1glRxxxep+RjO06NYmhA4mrRGK7XLzzq9D3ilv7Ug9AMOMIYCVK9BcUWLF+XIZqVCDh545f5dps1+pz7vWKtwkWgCbX3lzrCBlXpFociHEEkVWAhxkOAYBKgyWKLH5kYMMVhUuahoOng/wBxKycq8xblDb305gmhLtavywUCbl3GJvbsAs93rhWSBiGoZwggSsDLwLF+cIMGER7quOh1f73jKNIHkbYPUnuBQBQaAn2nSG+zLDLw1CW5s048X1yqBfw+vKmBci/QBhRLP+4zrHvVuzxEhg28957Iu+bIuCJ2ZCRKK3VZHUMCWyj1DKRWbjh+eJcIsFX/AGmMoHlCfhigapLHvHEdXqF1gLNN4XIeAojlwhDDNU5eggegJX0WwN/f/Mr+FzoN5i0NQ/b2vrK6B1dx4SqFlorcckUMGoYfQUGLwel+OfJEy6a/YzrJXS0R1arR2ZfbApLjOicfublHf0O2KlSvWoUwQl5IZJcX58lCAL9/ETXlo7HaDggkcnMVeype8hTNUSdPNWRUMGmLm+aECBKlQgPQfOVAg03UH3IFnSs15RzAYI0Nqm07fe8su7snLsKSaFXFSEKduqIaayC+LCYGiZgIECVK+gk2jPXsh3EDxj2Svnp+3mcaZ1KP4mySeLxZ/wCxIbjVtXHSXfLLVvEurDdGgg8UT2CcIZZKZdg+EXGRBiQPoxcRAAopGGmpi7KuEvrwnwja4FK9bgXcmyaiS8vVAJazQ6wj2dK48fbBSr9ABqUlIQQ+lU7YKP8ArcuXi9LHo7jg2uEnA9APiE7Ude7n+IOQzRlx6CEUUH6HUCcuIEoJWv8AA9b7doqIq4YNMo91A5OXUp0Sv8kEoH5VyGkW5xgghGLF9ITh9AvCTuHVL0u/1FqLoOh9pd4Emq1BHCoF7L7Mu5YfvTd2AOJeHCaMeRixwuEH0Jfid2whPBoWIPuv5Med4LpbLvmWWoMW+odaaeJWERumKnfRHXRLmFLhi3iYLJTFTmMfSA9avB8vtcXFyo3t9PSR60fvG2NaJl9/aM6ofaeYd5fR/wCwLDtwr2dF1C6a+GXF0i+wIGqIvf4l4dN08nhwWILwGo9RcVKwCGQ+Meo+AuXjqLtEo/QO0Xe5VtRx49nmDqs6qS7SR50QcbdOScPz1lBVVoo5Y4G++o5dpq8L48w6rWdZf5luthrrUXzFztAXT2igO5N6LQB3Dr7n6hIIKLE6zfFolYjgMH0GQ9R8qAstqy/A1dsjuDbaNMf700o3EUzls9sjcrV13drzHdAB0/d0QCeHuH5iRGlXy/zChRqXiRr0Nq9+z4eIu7Zfceo+YNNCD9cZvX/I+8ME4xIS4ODhgIEEPTXoD0nxTBCtXpGLOF/ZluI/AhCbbq9R93R1KAHMp8pd6cLRe5UHDf6Ihibra9+3ESLjmVFHqDpr+H96f+QQa3XqfB+vuxau/pf+JDSThTv39n0FzCCECEIYPgEXLyYPh2rsy6sJup3BnMOY2A5TYl1y3MVeJ8nZNiFLs/jiLeSHopolURBHSMO2cna/4/XtNW+8ngxKDTacdp7c/mEEFFidc0iYjlcGDFCHxCHpPSRnFwarp7yjAX1mogDsRDC9QT1NAXApUa0j9oUIlB0zUqEMSWTXh7UQeq6JOjBanC9T+6Yo4fLjyveK7T3zx+0WCJKhCXgyXx1ZIZYQ4jirQ77/AKjqX2rOcdk8S91KJOlNX2hv9x7u8rDCBDCesQFwq2f8b4mu0H8b7MA/R9x/pl0oUCEqEV6QggQfFMRkxccKBnEd3aKfz7A7QKpB0nPfBAqFXxFTNna+IDCuBAjKjAQwIQgyQSsKxhNuzsx0wG+Kf9JRFvQ0nb+b/MCDBWTgYpFfGJeRDDgRZbTpN6K6/wA8Nbh3hvQtdE5LA058HmKLU0Lg95UwehRgIYIMLXF4DE3BAgZKskHqq4uAVVilrEySGEQfIj0DLlxxzaur+1Y93RKJCdoDnk6o6feU7hbeV5Y4uj0Mlk3wKehCiCBCBCDEkYYrAPkzJgxUvPp3UnQTa9bmld1fuLt0iqBzXT7+xEhPS/ShhDpA3kDXojqJqWeoMBAggZqCMPkgyekgSp0veju6Ep0ieAfRYoWx5DxAlIjTi+YPEghNTlAY4JWFYDKuE0wmBUrIYqVBkRRfKHohqC4Xc0/7/t/mACqhiOkolSokqMXcJLYjgcECEBKwQh6RKgSsD5AyYMV9BBDKhQbiTjCKpeBDrEYGIJWHB6ySpUCV8b//2gAMAwEAAgADAAAAEH2HUWVRt01vusrnCqQdyy4N9XeYWWL2cdbhqRx0hGkn/wAs0nkte+AQgaKPE2wWfkGt2j1Y/JJpId4PnLAe3/kikDJPKyX9pQNglIi9KcD3LyLIV2KB7QVOhQZHc7sQaly8r7/4D4Qydu2J49xjIXy8xb5zVpyBHOglgjzzstSQq/p8m8/zqMBYezDcRwhuKVZtACMCW0WTFLAy1sZGYTVrfsdgKP3Q3F7rKImyM8xCB83o55LZ6wGYu5RdeI7Lp6AMoRWg4CLzuePJ7M55rLG3M4oebZO68kG2S/DT0p3Th/cUmwbUm7g/skONjaEm2qCyavWvb6KYFW2AmKms78tEtYtZbdAacIzaL9b6iRIf5emPy+0ABiRvgoxTAR8dgDbD5plFyEogUtcBEv8Am8krr0HX0PRe1t89izE+0Gjz8jUaolnmsk5yyiks1bZKkkNqS2w52KAqkjWVytEkmiuysoYxLaGX0Y/4aHqrhKS5MZ6YkkkmhsqzkkkQOp9gfQRBkAFYPmxJR4kkkkkb4Epj1ujAAUPLDQOrC6wQNRtM+AkkkkQzNwgHiYE28zo6YUo8csVUJJ3iREkkkCxdyIQYPqE2UUYrF8dAbxwpfhiBMkkk3+ww3QnxeW+y7PLTznY8DudN8XMMgHkrSWzu++IgiYVZqRZkUV/WYn7Xgnkk6khawJJQuMXP3iflDG6A+EBhYBPQQMn6A26DRwYBa/r+b/imdAcuoISNcLhqkgMkLg10wsUTJlq2+UaWXKVLueOM9rmmkkkncCt+MbCVspCfTY5xK9Il1hvLkmskmkHxIQqM7/EQmpcQNRUuLuw2WZXkoEm00oQG6Df4BzRLB39WcnufoYWtzmwfMmm2AKgGyksQOV3Rqr9fM2DZszWWBkgkkkkXW3qeeGsg2eGFYhkGJlRzvk65Ekkkkky+Ti1yD25a5AtyDMXfugXkmYkkkkkkkcL9pZf+MoG7i7OqkFJtorQTzkkkkkkkmCfngR+ZIUUu06s8RU1hhMJikkkkkkktGftSppknhiZ/VhReALFkhOoQkkkkkkInvAZg3jSpMLQ+AHeigckkv8Mmkkkkk//EACkRAAMAAgIBAwQBBQEAAAAAAAABERAhIDFBMFFhgaGx0XFAkeHw8cH/2gAIAQMBAT8QzRCdQmJkEkQsUuLxmLCjE5lBeiWKL0UTEwjQsExOi6GUXXF0XgPKxvitnR2LYmdjYniwTJiZIaEuE4I160SVh/H7NRZ+7H0ZQkJa4KGsEtEEFmjGxsvClKUTwhiJBZWh0QnlEEsJiylw2Mi+Tc7v/fBHEiAKv8ft8UhBCQlw6BojCQWIQbKP0IQgtkOxcJwQhEFhdCQuO+0fP6OiV+7E4hdiO6EX3/6TigooFQsZLCDRCEy+SylntYpRP0Esp4lEsLC24j2I+/8AY6tv3feE/Yttll2Nb09hMeFgWJUTJSIIXBvDLg2UfJCOspHWEXKEI7wkISFlZWkJNf2aLiUXtE1YaBrBD6wlj0ExLBBLCFijeG9FxOE4pZuKMWi0vG4Qg2EbxNe5tJX7sh2GNCd+BFGIkL0vPkhDoSEqJYEhBBBCEELDZRso+FFzomJEEPQxEEoXFELMCR8L/Ikkdis0uhLinsEKC8fIw0LQ0I8WEiFggihJmlGylLi5XGlEd8FjvhcIQtCYhEl+u3/H+X9qQb1E98kPpiGyF1rJ9xhDYhGNfEK3AmFkuDZdYReK4dYSFiUhcI6LwTwsLDae/wAPH7+olBtzJtNDYnv9g7SmEJCELDDEs1QXCsnil9FsuEMTEUhBaLcrZBawnjwRvDz/AB/nr6iC9mLYugo+A4ANa2UI7EKGjhCgo4JEy8P04QSIPsRJwb4rEZsTw3z34eBI0tLBT4/Hwyg9h7G7ZRYQhI0DBBGWCcEuLw2T0FyeE8JCWUjo7E0XFx2fS2//ABEp22Ik9D6Hle/Aj+D7kIQRBeBchYhZUQuNG/QWJvmsIuhDwsdkGsdiYldjFBfr8sSJMFsm+hzT0hqMgkQhMGEuSSEhYgkJcExvC9KE49Y6WFopKJQhDdlV5XwN7F8eUN4OZJKtil8j7EZ2LhbvIO9saJw0EHMcsSCCRCei+Gxems74rCwkpK5Jr2ur+xZlWn2ot/v8lYz+C/2d19RIRbpt9/7rwQREkJUug13YyRYJUiUGLHiFgWsEhejcLM9FcfOUxDwh6YwnUSjvappVPaHoLfa8X4+DvRev74oZdHR9LoT2JkpI2wVIIFAvWF6lwli4uVrPkQ1mxv8Aq+P4939P4SSKWD2MO00ntlpWKGjIrXBYYb0pl8exC5z0khjcP0n7/QhaRDY0JoVbQlZaD8CgQ0HrOovDobomUIr1BeKzRCxSiKJ4oncvDSFY1t4vv+jru/fyQQmIaF2N4IHHQ3rif6KI6GrHO/B9D1hCVFgvQby+D40sxOMxZ2drv6Hiv3fj9nlf+vgTRi+BvCFQ2EniC0hCNhuPIuhyyD5DwSEEsF1xvrJCR3yQkeHnlibSv3ZTR2JUTQQ0FoXyXL4ErcI04zsfhRjXg0wJXCkF1mDwpTCwXFcHyWeuKz1l4v4oIJJESCeLRKjZONFeJN4b+4p6jzap+z7KvP8Ab9D1P+HhlPb70/8AwbORtC40JzBNcFobEdBdZeEuEF6DFyRRA7GQL6kNxKD2yknoa80HZ10vktdv8iiPaH2HhmKH1PleRluhl4ifq84J4bMokIJcZwhMUvFcZwY0XYir7CEhPwNBMpdbIpbf75La0XwbPBMEEsL/AAvr4f8AkWPoDMn9UXU68YlINzKCQsJCWE56NGy5hMpTKFwR+Ji6Eh0SwhLYzNtaL6Ti+C0kEIQWBYqQdc0+6/wdBkzWrtCeMIMMaF4KLIXoLhOEwkQgsJEPZt9xItIYmM6O9Y/tTbHr7HiEEhBBCjFWBFkNDRTf+plS/qK8CzqUWSGKUTyYb0kpwj4IRMJYm/C7EpGkJ3FGyT7xjKEwiCQlhLJSyG2E4m6NoxbFhNwIJCwIJeiniiEIayhlySQUSQkIbRsU9lj1iWJrBLCKJiYtFwJJCSwfo+inxkKUSEokXBCCwUJ6SxM0QohcHv5BMfL7xTwPV2MrV1+R8ZWNEIJCvGCwlFgpghD3MYWntCQkSgkTCQwRSL1ITC5LNEe4f4I28NJC4W39mMq1GEEosoUsOhhiLiwpCEEkhIWU1BieIIQ9ZMvBbysJEIe3K/JCUWxl2zyK8x/gRwohIhEJbySEzQmi5DBEQQSgkIJwYagmL+gMWijwniYQkQetRmup3PwIuoObtMrBChoSNjCSD2JYkEqIyIIpEJMghZQg0JhMTE/6ClxRFwgtISsZt835xXDckQaPI+sJluNIJCaOsIJCEwlhLhBMEEhevcIRBZQp2G0XBSCmNUxo0FvCiEdMUEhbEpgSEg1hIXKDQgkJT1v/xAApEQEBAQACAgECBQUBAQAAAAABABEQISAxQTBRQGGhsdFxgZHB8OHx/9oACAECAQE/EA2zjLJJvXJEEEQ4PwJL5LznPx4MMMM8PBLOpj1y8M8ZZBBBHr8Gy2274NtsPkl7jkC9qG3I+xwgI42Uzp4L3Dbw2WZsssggiH198H1P0Q8es3X8rrOp/wB8yNq22gfv/B47wK23OJm8CbbbwPARHO/SbPDYbZeV43l4756Xs/8AfN7Fw+xYtfiOQ/2Pz+fXGx4gxZq52HhvIQ4OByeO22cPhvO28ZzvKWSBq3T9n9LoF19iLD5g/EmJz5/tZj2+88HGUspteBjNmbctjuIIizgYbedjgeM5PBs43y22DjpDtke09s5XLNG3Yu18/wAS+X2nqWWW22Z4DYIIIPE8S2J8N465ySeV5TgXt3dDuFswZFiwTrKlexn5W287ySymLPK8ZBCCPELJjrgPLOAs5ecsnjbbbt+39rR142D7y5AlebNsn38fbgPA2yzl2ertKWWeTLIIIPE8sstvjk52zjPFsmbOPfo/q/wfrl2g9p9dQi19pnDs/Hu/pJPqSXPMasa1rwBZwCzwzgILNg5Hfr5w+Dqnr93z/H9pbSD3euWMEnnQ+8pDu8MzCWczwnitbq+GQWcByZwcZZ4B4FsH00sstH5fH9f/AD3LL7XpENl+0AgNwZZwzw5eIBrrw3neCI8Mg43keFtjnbfpZZZD8N+75lg33CZf5fzJz6IAHxHLMpXRKfAB9Asg+k8D4t8cbb5By3pfbo/mW7GE0MIj8fmffL+kW22yy8SNSzwE+WQ8ngs4XLbPPOM4PANjrhmCdEiv18S8Cb7D3Fs9vANtttvEXTmFl5HJfFgQcnG8nVtt7jqY65HfMt4Mgsfhv8knw8bkQVepV8D9Zs2DL1MHoy9ch4yjwBFzGy+bbweWeSTzl1weAcsxA3c7h/1MRJnrt/4lzJ+bc/yRvpfeHr/v62zBzgEg9T7lOJuEUMHGrLs/S7+mtscZxmwSTHl8WTE7hyL8+fZ7mfgPT+X53R3kMZhw937ZJLc8CLtW7Xh/CngbL1wO85ZHAWckvAhOf+H5v+v+1F14L2Qul+QyyeC4MbWXgjhJJPwG2+BYyWZHBDxlnIxbbYmtjv8Ak/iRKvfgupugsFPmaskeuKl4IgcjxB+APBmWcZZBZ9DIbVkJnZvd+vtw9+A5Hd/dI4+pEbbuQmfcQRwyTJfwhn1vSherrF50nte287ls8k46fF0dz1wXfANLKYjg4Me5fJln0dtt4PpbfMX4JDtw+1t8cbY4HcmzMevm6Gx2cYWh/wD7weLcmvYdwXqG222WZ8D6nxznJ5rqc+G7bVhx6ZetsJpaQqPk/acN2+Mx9+/6XqP8WDTP9vtxlnt7/J/7+P6BXoZ65DdmyySyGGXkvgcbzvmcHPUPk6bolS9fHDi9wcfM6dwbdpk9haT0/wBO5rT2AdBZkX9pt+z8P9raLOhP9n5PsjUfUjp/R/7/AL/MpShk4JwSTjbSWfo7bHlkE8lngAV9T5np6/m22S04ZZKa9LuezAQcbw7TMg/uH3P5PZ/iZB9M0D2emHb5PfII7g5Fm2ec+jkHhsc7zkdcbbx+6f4ngMJ5OADZamv5wYQcLMYc7oY2l7H6P/v73zlLH8lns3ko4MmSySyfFtsfQe48Nth5WV9yX6Tq6wQRBKdEcHsicOoh4bbbwZzMYEeiGO6xP8iQjgt6tmyySySSfEbfobwS8jDPGo+X0TD2MxZHVqfbBvCZZeCy8gx4Ryl4Lj02zjeGwc9Syy+GWWfQZh8CIJZbaTmfcXTDr5ig4Sw2xF4eWfMLbGITvzYPntCpZZYYhl4Nbv0Ms8s5Ak5JgL6Jen0euPd84ToOizZ+/j8rDOEzYm8hu0smXFTNtmF2ae+d5EeQ38Klk8H1dh9H6w2R9pTLh+pZ5wjgL3w6xwwjHBrwPA0ltmMeDUMuFtn8GPFbeNvvq/Sx9sA6dhPQXZELaxN6mbZQ9cFFnyDWLLLLyXrgHZNmfw28NssqfxB9t+h/eX2/Yi5dljg8Q8NJkfALdJup4mbLPkT4SSz62eBznDwsLo/A+Pzu/ILvbbDwOwTMzgcyt4YzeXzURm2/WPotl6Q7jguEJYeDGCzwSl5FW8Lhnz22H6//xAAnEAEAAgICAgICAwADAQAAAAABABEhMRBBUWFxgSCRMKGxwdHw4f/aAAgBAQABPxC2JlBL4sxx8ApgIMpux1ERdxmuAzCVKmp1OuAlSoSqhCEqBBDmGJAxCahgl3waqdzqYlPqCRLJbKpvKuETFhQNuIYSptCFloXiMHAh4uMuLh56hycHAQiSvwIOBwWu5rBcBUqoMMtl4nsixcTCMaMsP0gy/RLS4pVHqh/wQHKKHM8Ob+ywZuV84lFY9w3eIZcOGUwsxLrFZTOOLcfmlU0xPCWR95iZYtRgeKgQhwEDkgQ7lQJUeWriBcIFAqGo4OJcRH5g3GkOsNMxsd3hdH236l5cx3z/AB9VGgo2kq/+9yhHi0mSiye1QlwFQY4q2ZYz1x6yzCXqUaRswFamJCvHRChEjruPURjweJWIk7hKlcdQODg5CVK3ByBKxKzOptBxGLnghtAknigi/QfVsY1dvbHjY/5GcQ5cMoh6802EsaKwCbA7a8p8Fy1gk1FmTHS6nqlRqXdT0ygg1BcsI4VN9So4LUKOPBlQh74BKzKgSoFcEJiHAQJpPhwkuKLFSoQFEvHElWCtGgJXuMW4vvX9XGgYqWQ/LbFJcld7hkA8soL2LxuINdBbc9bP/rqANGp5/b48EMKrgFy5mCNQRwSs7YMqhNYpUyhlqUOYeJuhDElQhMSuCVwQIHcz+HhB6ivECEYjDcylkKRYmYskuDnn+no+6mUB5H6V5+W2D22AO4YP2RC8/Us6/IhMqTrHyuiAnqtNDWh6P7/yg4dSs8ARJeMmGGYYYwPuPMRUEjG3ncOIqw5CE+uO+DXBDcPyJcWYoa4OB8V2blW1dkK8ej2/QxNHGFFP2f49RFZb9wqcEyGvcpTDpe0bXeGIMs81GGBqX9+Ja9BF1GvbnLMVyiFkqyMvDVmGiWvJimYoDxKMzAi1Em3PCrjqVUKj8zuEIy/xNfgsuHBOocHljIUwtDaXzKExlzbv2+f08xU8rYKe2LsrALILP6DzPlaYy/cQqfFSf7MoEE2McB+i0folIE6k83WX0wrVY3KrmUqETuDPEiyqM2CmCYuFa1LzBB1K02zbw2Tc6gwYzqH4Gp98kJ3+XXNwvzGyrcKptF6LKU9d9UQpVV7h9AgKlni4Qg0CGbOmDI8MA9RQbUwPZO2BgZuaRKfLoPmWQ1OYhqlS6UtvmjERUWZcVBWJpwRZV1LViKxPEc6jPUp3MMp4j+ZhHGo9suXcGXu51Dg4OCViGeA4PcxO/wAji4blIT5x+544Aaaf7H+qlh53L36hOvI99kuRUo/tFYmFuyUAkOBodTf648QGs6wLasDox/vG8sh1FcN9SpCi7qCmoB1PXBhnUpKJRCUstluLl2S4TPFwccnITrgPxXhhOp3Bjgw4AESubJZ/Qf2kYZsu4j829vRKlEG1IxCCADQ8j4iP3IH+kU5OwfRixrvxiawfkH0RWcbRQLZhl7TKo8RFOpeanrgkKr8AENcP4HAcXwQgSpUCVx55J3LnXJ+AwbllWoAWr1HrlUdAc/Zz8VAYQK18HcwrezzFqAUq/MtmE+C9npqk+PEbWLYrQgvkt6mHAMKtaKzwrHBzOipe8JRjpTLuoR1CIASw4DBArgQKlYmNwUiwlcHHmEN8HO0eTmuOo8GYstnrgmQPTTTp+zR9+ItxONeoGVYz2wKkm3OVuvSV/cxC9jGVJNmkgfsEtkOCValaY9/0RyR4FXqBtlzNfED1Kpj1KJiY/AeoMco7lAl0XghC4EODUCEMXL/O8Q5udQhEjB4AMuXldD2sarSF2OsegiV5K1U0Hlq9xeXo3AdgAnxYPkGKiIQaWtPstv1KVi+ouoi3XAEMEh1CRi1xUHFg4WiSj8FFZb+BAhDk1x1Dg4qp5/JlLLBBgWrBd4TZ/fhGOCax9kdiZg9I6XhaLQf/AH1Gi7Mb/wC3+fuFnsdsvfQvzL6L8ZnmcxEC/AWtYeG731ACAAKAMEvtqbS1LBqIbIt6iRTBVhmHMqJXxYJSU/IZ1yQhCEN8EITz+JyS4pxcUrgwUxKMV0d5iX5Nn/2EVBtV3yIsOsmHpLgK2JE85Y+iJwKjgsEaA9LbemtRC8Sh/BUuvcastj1K3Oi8dRwbK5RCl/OvuUFAHgKP8huKtE8SGskAajYcR1xAnUM2f1CMEI4GyUfwjDjEqUwhCVCHPTBK4vgjOp1xqXczBplDAgw9QGEdjFnKSNB0njRkmzq6q5umh3Lo7DKAtt+rmNKdvqW5sMy4sI+kjtFgrbYKimYaNFIV/d/cWZilzKM1MtRRpjtJj1AOoB1BRHmbR/xEMwhOuCEITrj75oPwvi/wYyrYDE6juwu2Bwg/+nzFdNr3K3OzgRJTY+Tr7gmWfdHZCr2ljflBPIqbtEF9ZDEVl1hvcCAxcSl1KSARCopUUWYfmD5ln8NQ5OA4Ic4qD+Oody8QZcshEmXCe/rKB8stY8tFfF6e3PxEqBartiK1EhbIeqLmGDZRjV9t/r9xWaGg1XklIMxbp3b9UfUqc6hB1FF8Uw4LIKiqYJXDgW9xZbFZ/CQg8EOCMvg3zcZfFwZcWDDtBuFXXUD8XuHhEotN+Nv9SuNNq+iMfcUnbLRzL2Yq4BRbdwMlkXpf80fqJp3FYCoa73Mt1xWgtBYOCj6iWO5bTg3VBMCKiZIuNhjWd0NcV/BmEPXA9cGp1Djrj44HHFy5cvMGXCGKtWhb63BSMxT+xz/U8Q3pg/8AGqj1G2sf9ytgIJWoa1awdKboah5ZkXmNhtq6gqFMBkJmAEpTbIX1fjplxA90Jkyez2J5EsiiL0xLviGmWLI4CwUmRcGIODhmTwUQQQcrUYtmnBxc7lwzCVidcY4Nfwo6DRn/AMx5YH2jMoPfa+2KlfawyqVnSxm0eAgoJsunKXwukLXH6A/vYLF701oRzHqvT5I+fS2YLWr+5nIZfBdYjcUVVJHbqRwyUiJnrMMtqmQ3t8+SUAD0afaHScKmYpRtgjZG5I3NYycEdQcXw6iy4Zg1DUNfgQ4V+OUYfhcJoX4b6Y/76jyctBo6B4lnivYQw5eiWxu1Zb6hQLFXWfhgdyyGiaq5NSptTPzEgl/0MS17TYo6muWAbHpGANMCADTfCL0eYudFQshFJkCVnq9MFoU2FyUDgUMDWaMSgnmVN6TLYtIXs8ywVEx6nUvTuhVe6M43YwgwealrA6R8RRq4BSaSmFoBAYhAhDBBU7w1GVKgQYzAxuBidSuCEJWJX4E6nmLF4ueJ+5j/AJfUfiys4/73axqy7hlWNC7RyV+4IKtslu6s/uXVGTIxu3Tuo1Ors7IHaFUUBfWXBDRmiEj0q0+CJhi1gWqFgPNw3n3SfFqyZAVG6vFpamiQaAoIeRlzcVKd0WCPqLXzfUBd3BKCoDwRH96RhpkMDAmd+e4egRX1nfhc/QzRwUbh4DqY98dqixY4wckeoHRCVKhFEo4wSo1FhMIQZ5mIQ7hNcMeGhIeoBtY/CU031/1HR9xbTMqcu7NsJpFZeGCSjc5auIwY/pjPXyHuIhvSmceEZwpGjfFg/vEKCpS/mNH0RRV4iLuC3ARLEQeNk4AoGxg/SqOqaYWVQI0s3OkV8Kks88zanD7VNX9oyx5TUYWH0ZPs6lEFES5hFZmy0lE1rgMrzX8HRERi4QTuaRYQhi5eIvFRICtEOwWzcdFvB37x1Ea5tFEGl5SXb8Re6vEOlM7nV1UVijkWr9RJHgUxNKNVjOYuLgPsnaK/pEytgwgvXJNjUMtRNCJblQWI7EggZ/hTK3z0vcKQhne/c8+XyN4c6dHBstgd/wDRh+1IWB0j4gxKxLJtmDMXAaJXhpgsVk0/gGXiHHtMItwnXAxAxGOoMNkIDURAa9mU7e/H78ShO1pS1VyxAlFBUFAf8TMPiHaBAlrwRH0rTotY7yfuKaaooDJdLzv3bKgehoHqJEg258YczXgRIU0aQPETAnY6O10j/wCphElp4z36H+inUaJ/HxPgGiOk9MvnWnBXq99vHwniBUsqoBIE2xCxwXmW3HuCxvA/4SEGDBgmUnHtw+omL4hmEMcCpfsfT/5LulM7i2OpS1LepeQZgT4I8FJblW0rurfr3K1R6aU2vbARwRZhthQ3qHjHlHBT1MHAwYBqs0u/Y78YZbKUdva/s1dJtjjQAWBWFa6bH3nbL7mruk0+zT7iuGFp6JUJqK5UBiLylH8BUOLhxp3AckSBBGOEVsAsrFHZnoHtjpcq+oiGQMsUKZXcJewgwdeHAv2xEprNlOrna1rNRrw4NHy+X3MdwQSRN1KYcwFRZqU6mbiXsxcBkBWo2NR34wwDXu8P040YVwFGV38nnF7GB+vSxNLbWQU6YeI8DSMTPCRd1PXBIAP4RhDWZ3CfOYQuVF3FiKdRS8xmU2KAbY0UMjs8/bDFquOsrjIooA7jfHPFauqgzs/AwpRt07VHtMV4vzCbIsGH0RdxQqZJ6ZcaiqsIi1ESCJdjXxrSk4V4G3UPndE3VoYtK3eoVDIHJC6L8Fv7ZXxAGBUQrXCqz1z1wCAH8h4hCHBYLBmCEaRy8zvwyMB17D+36jdWP8J6TLjoABaszbLUdZB5Wb8e4scGky608qxHqUOSF04F4gNSp1ANVEPBGSwjNJLiUxL1KXBaTZjhu4KkGoOAXC/CZ1/MMHi4TSEqCAyxG44Q21oLdMX8uiEGcKIGaTySpP57oF+AMK3nqYALQfoM/wBjG7ZxjD0NPvfxCdwXMHKpRGsNwyBUrPEoC2JZupX1L+pT1OqohOiYuM6lYjuNphgqKoiVhr+YZSDGKDCViE3lpBrUISz264D5YKF1GYNausUdEv6MPYNtQ9325+Jc5wNXCnzCbJpqOMQJbpL2gCAOYzaVYXXjoISNwkPFAOoPiV9QMPCCaTSdSkpMEOXh5iBX84MGDdwfMIOY5cILlEDQy4hKCxcD6C6O30zTlAPEC8EHxAdIl2ph1CRqUtIQGVYRzFyxLiVkFsKsyg43zPMcR3ACHMMOPwSypjY5szwoQZmn8twgwXDc7/AwiVE0iM3ZCvUGrgIjCQcCMwUyVjhqKWDLmFBhVBUF1AZQgSBiDHBghr8QSJgCBUAfzf/Z";let U=class extends l{constructor(){super(...arguments),this._refImage=I(),this._boundVisibilityHandler=this._visibilityHandler.bind(this),this._mediaLoadedInfo=null}async play(){this._cachedValueController?.startTimer()}async pause(){this._cachedValueController?.stopTimer()}async mute(){}async unmute(){}isMuted(){return!0}async seek(A){}async setControls(A){}isPaused(){return!this._cachedValueController?.hasTimer()}async getScreenshotURL(){return this._cachedValueController?.value??null}_getCameraEntity(){return(this.cameraConfig?.camera_entity||this.cameraConfig?.webrtc_card?.entity)??null}shouldUpdate(A){if(!this.hass||"visible"!==document.visibilityState)return!1;const e=this._getRelevantEntityForMode(this._resolveMode(this.imageConfig?.mode));return!A.has("hass")||1!=A.size||!e||(n(this.hass,A.get("hass"),[e])?(this._cachedValueController?.clearValue(),!0):!this.hasUpdated)}willUpdate(A){A.has("imageConfig")&&(this._cachedValueController&&this._cachedValueController.removeController(),this.imageConfig&&(this._cachedValueController=new p(this,this.imageConfig.refresh_seconds,this._getImageSource.bind(this),(()=>E(this)),(()=>u(this)))));const e=this._getRelevantEntityForMode(this._resolveMode(this.imageConfig?.mode));(A.has("cameraConfig")||A.has("view")||e&&!this._getAcceptableState(e))&&this._cachedValueController?.clearValue(),this._cachedValueController?.value||this._cachedValueController?.updateValue()}_getAcceptableState(A){const e=(A?this.hass?.states[A]:null)??null;return this.hass&&this.hass.connected&&e&&Date.now()-Date.parse(e.last_updated)<3e5?e:null}connectedCallback(){super.connectedCallback(),document.addEventListener("visibilitychange",this._boundVisibilityHandler),this._cachedValueController?.startTimer()}disconnectedCallback(){this._cachedValueController?.stopTimer(),document.removeEventListener("visibilitychange",this._boundVisibilityHandler),super.disconnectedCallback()}_visibilityHandler(){this._refImage.value&&("hidden"===document.visibilityState?(this._cachedValueController?.stopTimer(),this._cachedValueController?.clearValue(),this._forceSafeImage()):(this._cachedValueController?.startTimer(),this.requestUpdate()))}_buildImageURL(A){return A.searchParams.append("_t",String(Date.now())),A.toString()}_addQueryParametersToURL(A,e){if(e){const t=new URLSearchParams(e);for(const[e,i]of t.entries())A.searchParams.append(e,i)}return A}_getRelevantEntityForMode(A){return"camera"===A?this._getCameraEntity():"entity"===A?this.imageConfig?.entity??null:null}_resolveMode(A){if(!A)return"screensaver";if("auto"!==A)return A;const e=this._getCameraEntity();return this.imageConfig?.entity?"entity":this.imageConfig?.url?"url":e?"camera":"screensaver"}_getImageSource(){const A=this._resolveMode(this.imageConfig?.mode);if(this.hass&&"camera"===A){const A=this._getAcceptableState(this._getCameraEntity());if(A?.attributes.entity_picture){const e=new URL(A.attributes.entity_picture,document.baseURI);return this._addQueryParametersToURL(e,this.imageConfig?.entity_parameters),this._buildImageURL(e)}}if(this.hass&&"entity"===A&&this.imageConfig?.entity){const A=this._getAcceptableState(this.imageConfig?.entity);if(A?.attributes.entity_picture){const e=new URL(A.attributes.entity_picture,document.baseURI);return this._addQueryParametersToURL(e,this.imageConfig?.entity_parameters),this._buildImageURL(e)}}return"url"===A&&this.imageConfig?.url?this._buildImageURL(new URL(this.imageConfig.url,document.baseURI)):k}_forceSafeImage(A){this._refImage.value&&(this._refImage.value.src=!A&&this.imageConfig?.url?this.imageConfig.url:k)}render(){const A=this._cachedValueController?.value;return A?m` + {const e=Q(A,{player:this,capabilities:{supportsPause:!!this.imageConfig?.refresh_seconds}});e&&!M(this._mediaLoadedInfo,e)&&(this._mediaLoadedInfo=e,B(this,e))}} + @error=${()=>{const A=this._resolveMode(this.imageConfig?.mode);"camera"===A||"entity"===A?this._forceSafeImage(!0):"url"===A&&d(this,b("error.image_load_error"),{context:this.imageConfig})}} + /> + `:m``}static get styles(){return L(':host {\n background-color: var(--primary-background-color);\n background-position: center;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJjYW1lcmEtaXJpcy5zdmciCiAgIGlkPSJzdmc0IgogICB2ZXJzaW9uPSIxLjEiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjYjkzZTNlIgogICAgIGJvcmRlcmNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcm9wYWNpdHk9IjAuMjUiCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuNjA3ODQzMTQiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyNi42MjUwNiIKICAgICBpbmtzY2FwZTpjeD0iLTEuOTM0MjY4IgogICAgIGlua3NjYXBlOmN5PSIxNS42ODA3MTYiCiAgICAgaW5rc2NhcGU6d2luZG93LXdpZHRoPSIzODQwIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjE1MjciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEwODAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjIyNyIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiIC8+CiAgPGcKICAgICBpZD0iZzExMTkiCiAgICAgc3R5bGU9ImZpbGwtb3BhY2l0eTowLjA1O2ZpbGw6I2ZmZmZmZiI+CiAgICA8Y2lyY2xlCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eTowLjA1O3N0cm9rZS13aWR0aDoxLjM5NzI5IgogICAgICAgaWQ9InBhdGgxNzAiCiAgICAgICBjeD0iMTIiCiAgICAgICBjeT0iMTIiCiAgICAgICBpbmtzY2FwZTpsYWJlbD0iV2hpdGUgQmFja2dyb3VuZCIKICAgICAgIHI9IjExLjI1IiAvPgogICAgPHBhdGgKICAgICAgIGQ9Ik0gMTMuNzMwMDAxLDE1IDkuODMwMDAwMywyMS43NiBDIDEwLjUzLDIxLjkxIDExLjI1LDIyIDEyLDIyIGMgMi40MDAwMDEsMCA0LjYsLTAuODUgNi4zMiwtMi4yNSBMIDE0LjY2MDAwMSwxMy40IE0gMi40NjAwMDAzLDE1IGMgMC45MiwyLjkyIDMuMTUsNS4yNiA1Ljk5LDYuMzQgTCAxMi4xMiwxNSBtIC0zLjU3OTk5OTcsLTMgLTMuOSwtNi43NDk5OTk2IGMgLTEuNjQsMS43NDk5OTkgLTIuNjQsNC4xMzk5OTkzIC0yLjY0LDYuNzQ5OTk5NiAwLDAuNjggMC4wNywxLjM1IDAuMiwyIGggNy40OSBNIDIxLjgsOS45OTk5OTk3IEggMTQuMzEwMDAxIEwgMTQuNjAwMDAxLDEwLjUgMTkuMzYsMTguNzUgQyAyMSwxNi45NyAyMiwxNC42IDIyLDEyIDIyLDExLjMxIDIxLjkzLDEwLjY0IDIxLjgsOS45OTk5OTk3IG0gLTAuMjYsLTEgQyAyMC42Miw2LjA3MDAwMDUgMTguMzksMy43NDAwMDAyIDE1LjU1MDAwMSwyLjY2MDAwMDIgTCAxMS44OCw4Ljk5OTk5OTcgTSA5LjQwMDAwMDMsMTAuNSAxNC4xNzAwMDEsMi4yNDAwMDAyIGMgLTAuNywtMC4xNSAtMS40MjAwMDEsLTAuMjQgLTIuMTcwMDAxLC0wLjI0IC0yLjM5OTk5OTcsMCAtNC41OTk5OTk3LDAuODQgLTYuMzE5OTk5NywyLjI1MDAwMDMgbCAzLjY2LDYuMzQ5OTk5NSB6IgogICAgICAgaWQ9InBhdGgyIgogICAgICAgaW5rc2NhcGU6bGFiZWw9IklyaXMiCiAgICAgICBzdHlsZT0iZmlsbC1vcGFjaXR5OjAuMDU7ZmlsbDojZmZmZmZmIiAvPgogIDwvZz4KPC9zdmc+Cg==");\n background-size: 10%;\n background-position: center;\n}\n\nimg {\n width: 100%;\n height: 100%;\n display: block;\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}')}};c([s({attribute:!1})],U.prototype,"hass",void 0),c([s({attribute:!1})],U.prototype,"view",void 0),c([s({attribute:!1})],U.prototype,"cameraConfig",void 0),c([s({attribute:!1})],U.prototype,"cameraManager",void 0),c([s({attribute:!1,hasChanged:h})],U.prototype,"imageConfig",void 0),U=c([C("frigate-card-image")],U);export{U as FrigateCardImage}; diff --git a/config/www/community/frigate-hass-card/image-cbfd7ccb.js.gz b/config/www/community/frigate-hass-card/image-cbfd7ccb.js.gz new file mode 100644 index 00000000..fd6d123b Binary files /dev/null and b/config/www/community/frigate-hass-card/image-cbfd7ccb.js.gz differ diff --git a/config/www/community/frigate-hass-card/image-cdeb2c7e.js b/config/www/community/frigate-hass-card/image-cdeb2c7e.js new file mode 100644 index 00000000..4e4b6599 --- /dev/null +++ b/config/www/community/frigate-hass-card/image-cdeb2c7e.js @@ -0,0 +1,9 @@ +import{a,cR as e,x as s,cV as t,r as i,d2 as r,_ as m,n as g,t as n}from"./card-09c4bade.js";import{g as u}from"./index-e610f971.js";import"./image-1c1ebdfa.js";import"./media-aef44451.js";let o=class extends a{constructor(){super(...arguments),this._refImage=e()}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(a){await(this._refImage.value?.seek(a))}async setControls(a){await(this._refImage.value?.setControls(a))}isPaused(){return this._refImage.value?.isPaused()??!0}async getScreenshotURL(){return await(this._refImage.value?.getScreenshotURL())??null}render(){if(this.hass&&this.cameraConfig)return u(this,this.hass,this.cameraConfig),s` + + + `}static get styles(){return i(r)}};m([g({attribute:!1})],o.prototype,"hass",void 0),m([g({attribute:!1})],o.prototype,"cameraConfig",void 0),o=m([n("frigate-card-live-image")],o);export{o as FrigateCardLiveImage}; diff --git a/config/www/community/frigate-hass-card/image-cdeb2c7e.js.gz b/config/www/community/frigate-hass-card/image-cdeb2c7e.js.gz new file mode 100644 index 00000000..cd71058b Binary files /dev/null and b/config/www/community/frigate-hass-card/image-cdeb2c7e.js.gz differ diff --git a/config/www/community/frigate-hass-card/index-0197eb89.js b/config/www/community/frigate-hass-card/index-0197eb89.js new file mode 100644 index 00000000..f867e25d --- /dev/null +++ b/config/www/community/frigate-hass-card/index-0197eb89.js @@ -0,0 +1,131 @@ +import{_ as e,n as i,b as t,t as a,a as r,cR as s,dm as o,dn as n,da as d,dp as l,dq as g,dr as h,ds as c,dt as u,du as m,dv as v,db as p,cT as C,x as w,c_ as f,dl as I,cV as M,dw as y,dx as _,dy as b,dz as A,r as D,cW as x,cI as k,dA as j,s as $,dB as T,l as z,c$ as N,d1 as L,d2 as E,cU as P}from"./card-c642ee74.js";import"./ha-hls-player-abb86874.js";import{p as Z,h as V,s as G,u as S,i as W,c as F,M as O,A as R,a as U,b as Y}from"./media-6eadcd60.js";import{m as B}from"./audio-cf3a75aa.js";import{V as Q}from"./media-c9012082.js";let q=class extends r{constructor(){super(...arguments),this.load=!1,this._refFrigateCardMediaPlayer=s(),this._refVideoProvider=s(),this._refImageProvider=s(),this._url=null}async play(){await Z(this,this._refFrigateCardMediaPlayer.value??this._refVideoProvider.value)}async pause(){(this._refFrigateCardMediaPlayer.value||this._refVideoProvider.value)?.pause()}async mute(){this._refFrigateCardMediaPlayer.value?this._refFrigateCardMediaPlayer.value?.mute():this._refVideoProvider.value&&(this._refVideoProvider.value.muted=!0)}async unmute(){this._refFrigateCardMediaPlayer.value?this._refFrigateCardMediaPlayer.value?.mute():this._refVideoProvider.value&&(this._refVideoProvider.value.muted=!1)}isMuted(){return this._refFrigateCardMediaPlayer.value?this._refFrigateCardMediaPlayer.value?.isMuted()??!0:!this._refVideoProvider.value||this._refVideoProvider.value.muted}async seek(e){if(this._refFrigateCardMediaPlayer.value)return this._refFrigateCardMediaPlayer.value.seek(e);this._refVideoProvider.value&&(V(this._refVideoProvider.value),this._refVideoProvider.value.currentTime=e)}async setControls(e){if(this._refFrigateCardMediaPlayer.value)return this._refFrigateCardMediaPlayer.value.setControls(e);this._refVideoProvider.value&&G(this._refVideoProvider.value,e??this.viewerConfig?.controls.builtin??!0)}isPaused(){return this._refFrigateCardMediaPlayer.value?this._refFrigateCardMediaPlayer.value.isPaused():!this._refVideoProvider.value||this._refVideoProvider.value.paused}async getScreenshotURL(){return this._refFrigateCardMediaPlayer.value?await this._refFrigateCardMediaPlayer.value.getScreenshotURL():this._refVideoProvider.value?o(this._refVideoProvider.value):this._refImageProvider.value?this._refImageProvider.value.src:null}async _switchToRelatedClipView(){const e=this.viewManagerEpoch?.manager.getView();if(!(this.hass&&e&&this.cameraManager&&this.media&&n.isEvent(this.media)&&d.areEventQueries(e.query)))return;const i=e.query.clone();i.convertToClipsQueries();i.getQueries()&&await(this.viewManagerEpoch?.manager.setViewByParametersWithExistingQuery({params:{view:"media",query:i},queryExecutorOptions:{selectResult:{id:this.media.getID()??void 0},rejectResults:e=>!e.hasSelectedResult()}}))}async _setURL(){const e=this.media?.getContentID();if(!this.media||!e||!this.hass||this.viewerConfig?.lazy_load&&!this.load)return;let i=this.resolvedMediaCache?.get(e)??null;if(i||(i=await l(this.hass,e,this.resolvedMediaCache)),!i)return;const t=i.url;if(g(t))return void(this._url=h(this.hass,t));const a=this.cameraManager?.getStore().getCamera(this.media.getCameraID()),r=a?.getProxyConfig();if(r&&c(this.hass,r,"media")){if(r.dynamic){const e=t.split(/#/)[0];await u(this.hass,e,{sslVerification:r.ssl_verification,sslCiphers:r.ssl_ciphers,openLimit:0})}try{this._url=await m(this.hass,v(t))}catch(e){p(e)}}else this._url=t}willUpdate(e){if((e.has("load")||e.has("media")||e.has("viewerConfig")||e.has("resolvedMediaCache")||e.has("hass"))&&this._setURL().then((()=>{this.requestUpdate()})),e.has("viewerConfig")&&this.viewerConfig?.zoomable&&import("./zoomer-725f087c.js"),e.has("media")||e.has("cameraManager")){const e=this.media?.getCameraID(),i=e?this.cameraManager?.getStore().getCameraConfig(e):null;S(this,i?.dimensions?.layout),this.style.aspectRatio=C({ratio:i?.dimensions?.aspect_ratio})}}_useZoomIfRequired(e){if(!this.media)return e;const i=this.media.getCameraID(),t=this.media.getID()??void 0,a=this.cameraManager?.getStore().getCameraConfig(i),r=this.viewManagerEpoch?.manager.getView();return this.viewerConfig?.zoomable?w` a?.dimensions?.layout?{pan:a.dimensions.layout.pan,zoom:a.dimensions.layout.zoom}:void 0))} + .settings=${t?r?.context?.zoom?.[t]?.requested:void 0} + @frigate-card:zoom:zoomed=${()=>this.setControls(!1)} + @frigate-card:zoom:unzoomed=${()=>this.setControls()} + @frigate-card:zoom:change=${e=>f(e,this.viewManagerEpoch?.manager,t)} + > + ${e} + `:e}render(){if(this.load&&this.media&&this.hass&&this.viewerConfig)return this._url?this._useZoomIfRequired(w` + ${n.isVideo(this.media)?this.media.getVideoContentType()===Q.HLS?w` + `:w` + + `:w`{this.viewerConfig?.snapshot_click_plays_clip&&this._switchToRelatedClipView()}} + @load=${e=>{y(this,e,{player:this,technology:["jpg"]})}} + />`} + `):I({cardWideConfig:this.cardWideConfig})}static get styles(){return D(':host {\n background-color: var(--primary-background-color);\n background-position: center;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJjYW1lcmEtaXJpcy5zdmciCiAgIGlkPSJzdmc0IgogICB2ZXJzaW9uPSIxLjEiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjYjkzZTNlIgogICAgIGJvcmRlcmNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcm9wYWNpdHk9IjAuMjUiCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuNjA3ODQzMTQiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyNi42MjUwNiIKICAgICBpbmtzY2FwZTpjeD0iLTEuOTM0MjY4IgogICAgIGlua3NjYXBlOmN5PSIxNS42ODA3MTYiCiAgICAgaW5rc2NhcGU6d2luZG93LXdpZHRoPSIzODQwIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjE1MjciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEwODAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjIyNyIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiIC8+CiAgPGcKICAgICBpZD0iZzExMTkiCiAgICAgc3R5bGU9ImZpbGwtb3BhY2l0eTowLjA1O2ZpbGw6I2ZmZmZmZiI+CiAgICA8Y2lyY2xlCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eTowLjA1O3N0cm9rZS13aWR0aDoxLjM5NzI5IgogICAgICAgaWQ9InBhdGgxNzAiCiAgICAgICBjeD0iMTIiCiAgICAgICBjeT0iMTIiCiAgICAgICBpbmtzY2FwZTpsYWJlbD0iV2hpdGUgQmFja2dyb3VuZCIKICAgICAgIHI9IjExLjI1IiAvPgogICAgPHBhdGgKICAgICAgIGQ9Ik0gMTMuNzMwMDAxLDE1IDkuODMwMDAwMywyMS43NiBDIDEwLjUzLDIxLjkxIDExLjI1LDIyIDEyLDIyIGMgMi40MDAwMDEsMCA0LjYsLTAuODUgNi4zMiwtMi4yNSBMIDE0LjY2MDAwMSwxMy40IE0gMi40NjAwMDAzLDE1IGMgMC45MiwyLjkyIDMuMTUsNS4yNiA1Ljk5LDYuMzQgTCAxMi4xMiwxNSBtIC0zLjU3OTk5OTcsLTMgLTMuOSwtNi43NDk5OTk2IGMgLTEuNjQsMS43NDk5OTkgLTIuNjQsNC4xMzk5OTkzIC0yLjY0LDYuNzQ5OTk5NiAwLDAuNjggMC4wNywxLjM1IDAuMiwyIGggNy40OSBNIDIxLjgsOS45OTk5OTk3IEggMTQuMzEwMDAxIEwgMTQuNjAwMDAxLDEwLjUgMTkuMzYsMTguNzUgQyAyMSwxNi45NyAyMiwxNC42IDIyLDEyIDIyLDExLjMxIDIxLjkzLDEwLjY0IDIxLjgsOS45OTk5OTk3IG0gLTAuMjYsLTEgQyAyMC42Miw2LjA3MDAwMDUgMTguMzksMy43NDAwMDAyIDE1LjU1MDAwMSwyLjY2MDAwMDIgTCAxMS44OCw4Ljk5OTk5OTcgTSA5LjQwMDAwMDMsMTAuNSAxNC4xNzAwMDEsMi4yNDAwMDAyIGMgLTAuNywtMC4xNSAtMS40MjAwMDEsLTAuMjQgLTIuMTcwMDAxLC0wLjI0IC0yLjM5OTk5OTcsMCAtNC41OTk5OTk3LDAuODQgLTYuMzE5OTk5NywyLjI1MDAwMDMgbCAzLjY2LDYuMzQ5OTk5NSB6IgogICAgICAgaWQ9InBhdGgyIgogICAgICAgaW5rc2NhcGU6bGFiZWw9IklyaXMiCiAgICAgICBzdHlsZT0iZmlsbC1vcGFjaXR5OjAuMDU7ZmlsbDojZmZmZmZmIiAvPgogIDwvZz4KPC9zdmc+Cg==");\n background-size: 10%;\n background-position: center;\n}\n\n:host {\n display: block;\n width: 100%;\n height: 100%;\n}\n\nimg,\nvideo,\nfrigate-card-ha-hls-player {\n display: block;\n width: 100%;\n height: 100%;\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}\n\nfrigate-card-progress-indicator {\n padding: 30px;\n box-sizing: border-box;\n}')}};e([i({attribute:!1})],q.prototype,"hass",void 0),e([i({attribute:!1})],q.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],q.prototype,"media",void 0),e([i({attribute:!1})],q.prototype,"viewerConfig",void 0),e([i({attribute:!1})],q.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],q.prototype,"load",void 0),e([i({attribute:!1})],q.prototype,"cameraManager",void 0),e([i({attribute:!1})],q.prototype,"cardWideConfig",void 0),e([t()],q.prototype,"_url",void 0),q=e([a("frigate-card-viewer-provider")],q);let H=class extends r{constructor(){super(...arguments),this.showControls=!0,this._selected=0,this._media=null,this._mediaActionsController=new O,this._player=null,this._refCarousel=s()}updated(e){super.updated(e),e.has("viewManagerEpoch")&&this.viewManagerEpoch?.manager.getView()?.context?.mediaViewer!==this.viewManagerEpoch?.oldView?.context?.mediaViewer&&this._seekHandler(),!this._mediaActionsController.hasRoot()&&this._refCarousel.value&&this._mediaActionsController.initialize(this._refCarousel.value)}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._mediaActionsController.destroy(),super.disconnectedCallback()}_getTransitionEffect(){return this.viewerConfig?.transition_effect??k.media_viewer.transition_effect}_getPlugins(){return[R({...this.viewerConfig?.lazy_load&&{lazyLoadCallback:(e,i)=>this._lazyloadSlide(i)}}),U(),Y()]}_getMediaNeighbors(){const e=this._media?.length??0;if(!this._media)return null;const i=this._selected>0?this._selected-1:null,t=this._selected+1{if(!t||!this._media)return;const i=("previous"===e?t.previous?.index:t.next?.index)??null;null!==i&&this._setViewSelectedIndex(i)},r=this.viewManagerEpoch?.manager.getView();return w` + {this._setViewSelectedIndex(e.detail.index)}} + @frigate-card:media:loaded=${e=>{this._player=e.detail.player??null,this._seekHandler()}} + @frigate-card:media:unloaded=${()=>{this._player=null}} + > + ${this.showControls?w` {a("previous"),N(e)}} + >`:""} + ${W([this._media,r],(()=>this._getSlides()))} + ${this.showControls?w` {a("next"),N(e)}} + >`:""} + + ${r?w` + `:""} +
+ + +
+ `}async _seekHandler(){const e=this.viewManagerEpoch?.manager.getView(),i=e?.context?.mediaViewer?.seek;if(!(this.hass&&i&&this._media&&this._player))return;const t=this._media[this._selected];if(!t)return;const a=t.includesTime(i);$(this,!a,"unseekable"),a||this._player.isPaused()?a&&this._player.isPaused()&&this._player.play():this._player.pause();const r=await(this.cameraManager?.getMediaSeekTime(t,i))??null;null!==r&&this._player.seek(r)}_renderMediaItem(e){const i=this.viewManagerEpoch?.manager.getView();return this.hass&&i&&this.viewerConfig?w`
+ +
`:null}static get styles(){return D(":host {\n position: relative;\n --video-max-height: none;\n}\n\n:host([unselected]) frigate-card-carousel,\n:host([unselected]) .seek-warning {\n pointer-events: none;\n}\n\n:host([unseekable]) frigate-card-carousel {\n filter: brightness(50%);\n}\n\n:host([unseekable]) .seek-warning {\n display: block;\n}\n\n.seek-warning {\n display: none;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translateX(-50%) translateY(-50%);\n color: white;\n}\n\n.embla__slide {\n height: 100%;\n flex: 0 0 100%;\n}")}};e([i({attribute:!1})],H.prototype,"hass",void 0),e([i({attribute:!1})],H.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],H.prototype,"viewFilterCameraID",void 0),e([i({attribute:!1,hasChanged:x})],H.prototype,"viewerConfig",void 0),e([i({attribute:!1})],H.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],H.prototype,"cardWideConfig",void 0),e([i({attribute:!1})],H.prototype,"cameraManager",void 0),e([i({attribute:!1})],H.prototype,"showControls",void 0),e([t()],H.prototype,"_selected",void 0),H=e([a("frigate-card-viewer-carousel")],H);let X=class extends r{_renderCarousel(e){const i=this.viewManagerEpoch?.manager.getView()?.camera;return w` + + + `}willUpdate(e){e.has("viewManagerEpoch")&&this._needsGrid()&&import("./media-grid-3082f0ad.js")}_needsGrid(){const e=this.viewManagerEpoch?.manager.getView(),i=e?.queryResults?.getCameraIDs();return!!e?.isGrid()&&!!e?.supportsMultipleDisplayModes()&&(i?.size??0)>1}_gridSelectCamera(e){const i=this.viewManagerEpoch?.manager.getView();this.viewManagerEpoch?.manager.setViewByParameters({params:{camera:e,queryResults:i?.queryResults?.clone().promoteCameraSelectionToMainSelection(e)}})}render(){const e=this.viewManagerEpoch?.manager.getView(),i=e?.queryResults?.getCameraIDs();return i&&this._needsGrid()?w` + this._gridSelectCamera(e.detail.selected)} + > + ${[...i].map((e=>this._renderCarousel(e)))} + + `:this._renderCarousel()}static get styles(){return D(E)}};e([i({attribute:!1})],X.prototype,"hass",void 0),e([i({attribute:!1})],X.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],X.prototype,"viewerConfig",void 0),e([i({attribute:!1})],X.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],X.prototype,"cardWideConfig",void 0),e([i({attribute:!1})],X.prototype,"cameraManager",void 0),X=e([a("frigate-card-viewer-grid")],X);let J=class extends r{render(){if(this.hass&&this.viewManagerEpoch&&this.viewerConfig&&this.cameraManager&&this.cardWideConfig){if(!this.viewManagerEpoch.manager.getView()?.queryResults?.hasResults()){const e=!!this.viewManagerEpoch.manager.getView()?.context?.loading?.query;return P({type:"info",message:z(e?"error.awaiting_media":"common.no_media"),icon:"mdi:multimedia",dotdotdot:e})}return w` + `}}static get styles(){return D(":host {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n gap: 5px;\n}\n\nfrigate-card-viewer-carousel {\n flex: 1;\n min-height: 0;\n}")}};e([i({attribute:!1})],J.prototype,"hass",void 0),e([i({attribute:!1})],J.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],J.prototype,"viewerConfig",void 0),e([i({attribute:!1})],J.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],J.prototype,"cameraManager",void 0),e([i({attribute:!1})],J.prototype,"cardWideConfig",void 0),J=e([a("frigate-card-viewer")],J);export{J as FrigateCardViewer}; diff --git a/config/www/community/frigate-hass-card/index-0197eb89.js.gz b/config/www/community/frigate-hass-card/index-0197eb89.js.gz new file mode 100644 index 00000000..85b7ec08 Binary files /dev/null and b/config/www/community/frigate-hass-card/index-0197eb89.js.gz differ diff --git a/config/www/community/frigate-hass-card/index-0a012f43.js b/config/www/community/frigate-hass-card/index-0a012f43.js new file mode 100644 index 00000000..fc574140 --- /dev/null +++ b/config/www/community/frigate-hass-card/index-0a012f43.js @@ -0,0 +1,162 @@ +import{cL as e,cM as i,cN as t,cO as a,cP as r,cQ as o,l as s,_ as n,n as d,b as g,t as c,a as h,cR as l,cI as m,cS as v,cT as p,x as u,cU as C,cV as f,e as I,r as M,cW as _,cX as w,cY as b,cZ as y,c_ as L,c$ as A,d0 as D,d1 as $,d2 as j}from"./card-c642ee74.js";import{p as z,u as k,i as S,M as E,A as N,a as x,b as T}from"./media-6eadcd60.js"; +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const Z=e(class extends i{constructor(){super(...arguments),this.key=t}render(e,i){return this.key=e,i}update(e,[i,t]){return i!==this.key&&(a(e),this.key=i),t}});class O{constructor(e){this._inBackground=!1,this._messageReceived=!1,this._lastMediaLoadedInfo=null,this._renderEpoch=0,this._handleMessage=e=>{this._messageReceived=!0,this._inBackground&&(e.stopPropagation(),this._renderEpoch++)},this._handleMediaLoaded=e=>{this._lastMediaLoadedInfo={source:e.composedPath()[0],mediaLoadedInfo:e.detail},this._inBackground&&e.stopPropagation()},this._host=e,e.addController(this),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}shouldUpdate(){return!(this._inBackground&&this._messageReceived)}hostConnected(){this._intersectionObserver.observe(this._host),this._host.addEventListener("frigate-card:media:loaded",this._handleMediaLoaded),this._host.addEventListener("frigate-card:message",this._handleMessage)}hostDisconnected(){this._intersectionObserver.disconnect(),this._host.removeEventListener("frigate-card:media:loaded",this._handleMediaLoaded),this._host.removeEventListener("frigate-card:message",this._handleMessage)}clearMessageReceived(){this._messageReceived=!1}isInBackground(){return this._inBackground}getRenderEpoch(){return this._renderEpoch}_intersectionHandler(e){const i=this._inBackground;this._inBackground=!e.some((e=>e.isIntersecting)),this._inBackground||this._messageReceived||!this._lastMediaLoadedInfo||r(this._lastMediaLoadedInfo.source,this._lastMediaLoadedInfo.mediaLoadedInfo),i!==this._inBackground&&this._host.requestUpdate()}}const P=(e,i,t)=>{if(!t?.camera_entity)return o(e,s("error.no_live_camera"),{context:t}),null;const a=i.states[t.camera_entity];return a||(o(e,s("error.live_camera_not_found"),{context:t}),null)};let G=class extends h{constructor(){super(...arguments),this.load=!1,this.label="",this._isVideoMediaLoaded=!1,this._refProvider=l(),this._importPromises=[]}async play(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await z(this,this._refProvider.value)}async pause(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.pause())}async mute(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.mute())}async unmute(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.unmute())}isMuted(){return this._refProvider.value?.isMuted()??!0}async seek(e){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.seek(e))}async setControls(e){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.setControls(e))}isPaused(){return this._refProvider.value?.isPaused()??!0}async getScreenshotURL(){return await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.getScreenshotURL())??null}_getResolvedProvider(){return"auto"===this.cameraConfig?.live_provider?this.cameraConfig?.webrtc_card?.entity||this.cameraConfig?.webrtc_card?.url?"webrtc-card":this.cameraConfig?.camera_entity?"ha":this.cameraConfig?.frigate.camera_name?"jsmpeg":m.cameras.live_provider:this.cameraConfig?.live_provider||"image"}_shouldShowImageDuringLoading(){return!!this.cameraConfig?.camera_entity&&!!this.hass&&!!this.liveConfig?.show_image_during_load}disconnectedCallback(){this._isVideoMediaLoaded=!1}_videoMediaShowHandler(){this._isVideoMediaLoaded=!0}willUpdate(e){if(e.has("load")&&(this.load||(this._isVideoMediaLoaded=!1,v(this))),e.has("liveConfig")&&(this.liveConfig?.show_image_during_load&&this._importPromises.push(import("./image-c6a10ba0.js")),this.liveConfig?.zoomable&&this._importPromises.push(import("./zoomer-725f087c.js"))),e.has("cameraConfig")){const e=this._getResolvedProvider();"jsmpeg"===e?this._importPromises.push(import("./jsmpeg-66c8006d.js")):"ha"===e?this._importPromises.push(import("./ha-31684cf1.js")):"webrtc-card"===e?this._importPromises.push(import("./webrtc-card-74652e9d.js")):"image"===e?this._importPromises.push(import("./image-c6a10ba0.js")):"go2rtc"===e&&this._importPromises.push(import("./index-17f8eed5.js")),k(this,this.cameraConfig?.dimensions?.layout),this.style.aspectRatio=p({ratio:this.cameraConfig?.dimensions?.aspect_ratio})}}async getUpdateComplete(){const e=await super.getUpdateComplete();return await Promise.all(this._importPromises),this._importPromises=[],e}_useZoomIfRequired(e){return this.liveConfig?.zoomable?u` this.cameraConfig?.dimensions?.layout?{pan:this.cameraConfig.dimensions.layout.pan,zoom:this.cameraConfig.dimensions.layout.zoom}:void 0))} + .settings=${this.zoomSettings} + @frigate-card:zoom:zoomed=${()=>this.setControls(!1)} + @frigate-card:zoom:unzoomed=${()=>this.setControls()} + > + ${e} + `:e}render(){if(!(this.load&&this.hass&&this.liveConfig&&this.cameraConfig))return;this.title=this.label,this.ariaLabel=this.label;const e=this._getResolvedProvider(),i=!this._isVideoMediaLoaded&&this._shouldShowImageDuringLoading(),t={hidden:i};if("ha"===e||"image"===e){const e=P(this,this.hass,this.cameraConfig);if(!e)return;if("unavailable"===e.state)return v(this),C({message:`${s("error.live_camera_unavailable")}${this.label?`: ${this.label}`:""}`,type:"info",icon:"mdi:cctv-off",dotdotdot:!0})}return u`${this._useZoomIfRequired(u` + ${i||"image"===e?u` {"image"===e?this._videoMediaShowHandler():i.stopPropagation()}} + > + `:u``} + ${"ha"===e?u` + `:"go2rtc"===e?u` + `:"webrtc-card"===e?u` + `:"jsmpeg"===e?u` + `:u``} + `)} + ${i&&!this._isVideoMediaLoaded?u``:""} `}static get styles(){return M(':host {\n background-color: var(--primary-background-color);\n background-position: center;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJjYW1lcmEtaXJpcy5zdmciCiAgIGlkPSJzdmc0IgogICB2ZXJzaW9uPSIxLjEiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjYjkzZTNlIgogICAgIGJvcmRlcmNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcm9wYWNpdHk9IjAuMjUiCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuNjA3ODQzMTQiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyNi42MjUwNiIKICAgICBpbmtzY2FwZTpjeD0iLTEuOTM0MjY4IgogICAgIGlua3NjYXBlOmN5PSIxNS42ODA3MTYiCiAgICAgaW5rc2NhcGU6d2luZG93LXdpZHRoPSIzODQwIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjE1MjciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEwODAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjIyNyIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiIC8+CiAgPGcKICAgICBpZD0iZzExMTkiCiAgICAgc3R5bGU9ImZpbGwtb3BhY2l0eTowLjA1O2ZpbGw6I2ZmZmZmZiI+CiAgICA8Y2lyY2xlCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eTowLjA1O3N0cm9rZS13aWR0aDoxLjM5NzI5IgogICAgICAgaWQ9InBhdGgxNzAiCiAgICAgICBjeD0iMTIiCiAgICAgICBjeT0iMTIiCiAgICAgICBpbmtzY2FwZTpsYWJlbD0iV2hpdGUgQmFja2dyb3VuZCIKICAgICAgIHI9IjExLjI1IiAvPgogICAgPHBhdGgKICAgICAgIGQ9Ik0gMTMuNzMwMDAxLDE1IDkuODMwMDAwMywyMS43NiBDIDEwLjUzLDIxLjkxIDExLjI1LDIyIDEyLDIyIGMgMi40MDAwMDEsMCA0LjYsLTAuODUgNi4zMiwtMi4yNSBMIDE0LjY2MDAwMSwxMy40IE0gMi40NjAwMDAzLDE1IGMgMC45MiwyLjkyIDMuMTUsNS4yNiA1Ljk5LDYuMzQgTCAxMi4xMiwxNSBtIC0zLjU3OTk5OTcsLTMgLTMuOSwtNi43NDk5OTk2IGMgLTEuNjQsMS43NDk5OTkgLTIuNjQsNC4xMzk5OTkzIC0yLjY0LDYuNzQ5OTk5NiAwLDAuNjggMC4wNywxLjM1IDAuMiwyIGggNy40OSBNIDIxLjgsOS45OTk5OTk3IEggMTQuMzEwMDAxIEwgMTQuNjAwMDAxLDEwLjUgMTkuMzYsMTguNzUgQyAyMSwxNi45NyAyMiwxNC42IDIyLDEyIDIyLDExLjMxIDIxLjkzLDEwLjY0IDIxLjgsOS45OTk5OTk3IG0gLTAuMjYsLTEgQyAyMC42Miw2LjA3MDAwMDUgMTguMzksMy43NDAwMDAyIDE1LjU1MDAwMSwyLjY2MDAwMDIgTCAxMS44OCw4Ljk5OTk5OTcgTSA5LjQwMDAwMDMsMTAuNSAxNC4xNzAwMDEsMi4yNDAwMDAyIGMgLTAuNywtMC4xNSAtMS40MjAwMDEsLTAuMjQgLTIuMTcwMDAxLC0wLjI0IC0yLjM5OTk5OTcsMCAtNC41OTk5OTk3LDAuODQgLTYuMzE5OTk5NywyLjI1MDAwMDMgbCAzLjY2LDYuMzQ5OTk5NSB6IgogICAgICAgaWQ9InBhdGgyIgogICAgICAgaW5rc2NhcGU6bGFiZWw9IklyaXMiCiAgICAgICBzdHlsZT0iZmlsbC1vcGFjaXR5OjAuMDU7ZmlsbDojZmZmZmZmIiAvPgogIDwvZz4KPC9zdmc+Cg==");\n background-size: 10%;\n background-position: center;\n}\n\n:host {\n display: block;\n height: 100%;\n width: 100%;\n position: relative;\n}\n\n.hidden {\n display: none;\n}\n\nha-icon {\n position: absolute;\n top: 10px;\n right: 10px;\n color: var(--primary-color);\n}')}};n([d({attribute:!1})],G.prototype,"hass",void 0),n([d({attribute:!1})],G.prototype,"cameraConfig",void 0),n([d({attribute:!1})],G.prototype,"cameraEndpoints",void 0),n([d({attribute:!1})],G.prototype,"liveConfig",void 0),n([d({attribute:!0,type:Boolean})],G.prototype,"load",void 0),n([d({attribute:!1})],G.prototype,"label",void 0),n([d({attribute:!1})],G.prototype,"cardWideConfig",void 0),n([d({attribute:!1})],G.prototype,"microphoneStream",void 0),n([d({attribute:!1})],G.prototype,"zoomSettings",void 0),n([g()],G.prototype,"_isVideoMediaLoaded",void 0),G=n([c("frigate-card-live-provider")],G);const W="frigate-card-live-provider";let U=class extends h{constructor(){super(...arguments),this._cameraToSlide={},this._refPTZControl=l(),this._refCarousel=l(),this._mediaActionsController=new E,this._mediaHasLoaded=!1}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._mediaActionsController.destroy(),super.disconnectedCallback()}_getTransitionEffect(){return this.overriddenLiveConfig?.transition_effect??m.live.transition_effect}_getSelectedCameraIndex(){if(this.viewFilterCameraID)return 0;const e=this.cameraManager?.getStore().getCameraIDsWithCapability("live"),i=this.viewManagerEpoch?.manager.getView();return e?.size&&i?Math.max(0,Array.from(e).indexOf(i.camera)):0}willUpdate(e){(e.has("microphoneManager")||e.has("overriddenLiveConfig"))&&this._mediaActionsController.setOptions({playerSelector:W,...this.overriddenLiveConfig?.auto_play&&{autoPlayConditions:this.overriddenLiveConfig.auto_play},...this.overriddenLiveConfig?.auto_pause&&{autoPauseConditions:this.overriddenLiveConfig.auto_pause},...this.overriddenLiveConfig?.auto_mute&&{autoMuteConditions:this.overriddenLiveConfig.auto_mute},...this.overriddenLiveConfig?.auto_unmute&&{autoUnmuteConditions:this.overriddenLiveConfig.auto_unmute},...(this.overriddenLiveConfig?.auto_unmute||this.overriddenLiveConfig?.auto_mute)&&{microphoneManager:this.microphoneManager,microphoneMuteSeconds:this.overriddenLiveConfig.microphone.mute_after_microphone_mute_seconds}})}_getPlugins(){return[N({...this.overriddenLiveConfig?.lazy_load&&{lazyLoadCallback:(e,i)=>this._lazyloadOrUnloadSlide("load",e,i)},lazyUnloadConditions:this.overriddenLiveConfig?.lazy_unload,lazyUnloadCallback:(e,i)=>this._lazyloadOrUnloadSlide("unload",e,i)}),x(),T()]}_getLazyLoadCount(){return!1===this.overriddenLiveConfig?.lazy_load?null:0}_getSlides(){if(!this.cameraManager)return[[],{}];const e=this.viewManagerEpoch?.manager.getView(),i=this.viewFilterCameraID?new Set([this.viewFilterCameraID]):this.cameraManager?.getStore().getCameraIDsWithCapability("live"),t=[],a={};for(const[r,o]of this.cameraManager.getStore().getCameraConfigEntries(i)){const i=this._getSubstreamCameraID(r,e),s=r===i?o:this.cameraManager?.getStore().getCameraConfig(i),n=s?this._renderLive(i,s):null;n&&(a[r]=t.length,t.push(n))}return[t,a]}_setViewHandler(e){const i=this.cameraManager?.getStore().getCameraIDsWithCapability("live");i?.size&&e.detail.index!==this._getSelectedCameraIndex()&&this._setViewCameraID([...i][e.detail.index])}_setViewCameraID(e){e&&this.viewManagerEpoch?.manager.setViewByParametersWithNewQuery({params:{camera:e}})}_lazyloadOrUnloadSlide(e,i,t){t instanceof HTMLSlotElement&&(t=t.assignedElements({flatten:!0})[0]);const a=t?.querySelector(W);a&&(a.load="load"===e)}_renderLive(e,i){if(!(this.overriddenLiveConfig&&this.nonOverriddenLiveConfig&&this.hass&&this.cameraManager&&this.conditionsManagerEpoch))return;let t=null;try{t=w(this.conditionsManagerEpoch.manager,{live:this.nonOverriddenLiveConfig},{configOverrides:this.overrides,stateOverrides:{camera:e},schema:b}).live}catch(e){return y(this,e)}const a=this.cameraManager.getCameraMetadata(e),r=this.viewManagerEpoch?.manager.getView();return u` +
+ this.cameraManager?.getCameraEndpoints(e)??void 0))} + .label=${a?.title??""} + .liveConfig=${t} + .hass=${this.hass} + .cardWideConfig=${this.cardWideConfig} + .zoomSettings=${r?.context?.zoom?.[e]?.requested} + @frigate-card:zoom:change=${i=>L(i,this.viewManagerEpoch?.manager,e)} + > + +
+ `}_getCameraIDsOfNeighbors(){const e=this.cameraManager?[...this.cameraManager?.getStore().getCameraIDsWithCapability("live")]:[],i=this.viewManagerEpoch?.manager.getView();if(this.viewFilterCameraID||e.length<=1||!i||!this.hass)return[null,null];const t=this.viewFilterCameraID??i.camera,a=e.indexOf(t);return a<0?[null,null]:[e[a>0?a-1:e.length-1],e[a+11,[r,o]=this._getCameraIDsOfNeighbors(),s=r?this.cameraManager.getCameraMetadata(this._getSubstreamCameraID(r,e)):null,n=o?this.cameraManager.getCameraMetadata(this._getSubstreamCameraID(o,e)):null,d=!(!this._mediaHasLoaded||this.viewFilterCameraID&&this.viewFilterCameraID!==e.camera||!1===e.context?.ptzControls?.enabled)&&e.context?.ptzControls?.enabled;return u` + {this._mediaHasLoaded=!0}} + @frigate-card:media:unloaded=${()=>{this._mediaHasLoaded=!1}} + > + {this._setViewCameraID(r),A(e)}} + > + + ${i} + {this._setViewCameraID(o),A(e)}} + > + + + + + `}_setMediaTarget(){const e=this.viewManagerEpoch?.manager.getView(),i=this._getSelectedCameraIndex();this.viewFilterCameraID?this._mediaActionsController.setTarget(i,e?.camera===this.viewFilterCameraID):this._mediaActionsController.setTarget(i,!0)}updated(e){super.updated(e);let i=!1;!this._mediaActionsController.hasRoot()&&this._refCarousel.value&&(this._mediaActionsController.initialize(this._refCarousel.value),i=!0),(i||e.has("viewManagerEpoch"))&&this._setMediaTarget()}static get styles(){return M(":host {\n display: block;\n --video-max-height: none;\n}\n\n:host(:not([grid-id])) {\n height: 100%;\n}\n\n:host([unselected]) frigate-card-carousel {\n pointer-events: none;\n}\n\n.embla__slide {\n display: flex;\n justify-content: center;\n height: 100%;\n flex: 0 0 100%;\n}")}};n([d({attribute:!1})],U.prototype,"hass",void 0),n([d({attribute:!1})],U.prototype,"viewManagerEpoch",void 0),n([d({attribute:!1})],U.prototype,"nonOverriddenLiveConfig",void 0),n([d({attribute:!1})],U.prototype,"overriddenLiveConfig",void 0),n([d({attribute:!1,hasChanged:_})],U.prototype,"overrides",void 0),n([d({attribute:!1})],U.prototype,"conditionsManagerEpoch",void 0),n([d({attribute:!1})],U.prototype,"cardWideConfig",void 0),n([d({attribute:!1})],U.prototype,"cameraManager",void 0),n([d({attribute:!1})],U.prototype,"microphoneManager",void 0),n([d({attribute:!1})],U.prototype,"viewFilterCameraID",void 0),n([g()],U.prototype,"_mediaHasLoaded",void 0),U=n([c("frigate-card-live-carousel")],U);let B=class extends h{_renderCarousel(e){const i=this.viewManagerEpoch?.manager.getView(),t=e??i?.camera;return u` + + + `}_gridSelectCamera(e){this.viewManagerEpoch?.manager.setViewByParameters({params:{camera:e}})}_needsGrid(){const e=this.cameraManager?.getStore().getCameraIDsWithCapability("live"),i=this.viewManagerEpoch?.manager.getView();return!!i?.isGrid()&&!!i?.supportsMultipleDisplayModes()&&!!e&&e.size>1}willUpdate(e){e.has("viewManagerEpoch")&&this._needsGrid()&&import("./media-grid-3082f0ad.js")}render(){if(!this.conditionsManagerEpoch||!this.nonOverriddenLiveConfig)return;const e=this.cameraManager?.getStore().getCameraIDsWithCapability("live");return e?.size&&this._needsGrid()?u` + this._gridSelectCamera(e.detail.selected)} + > + ${[...e].map((e=>this._renderCarousel(e)))} + + `:this._renderCarousel()}static get styles(){return M(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\n@keyframes warning-pulse {\n 0% {\n border: solid 2px var(--frigate-card-triggered-color-1, rgba(0, 0, 0, 0));\n }\n 50% {\n border: solid 2px var(--frigate-card-triggered-color-2, var(--warning-color));\n }\n 100% {\n border: solid 2px var(--frigate-card-triggered-color-1, rgba(0, 0, 0, 0));\n }\n}\nfrigate-card-live-carousel[triggered] {\n animation: warning-pulse 5s infinite;\n}\n\nfrigate-card-live-carousel[selected] {\n --frigate-card-triggered-color-1: var(--primary-color);\n}")}};n([d({attribute:!1})],B.prototype,"hass",void 0),n([d({attribute:!1})],B.prototype,"viewManagerEpoch",void 0),n([d({attribute:!1})],B.prototype,"nonOverriddenLiveConfig",void 0),n([d({attribute:!1})],B.prototype,"overriddenLiveConfig",void 0),n([d({attribute:!1,hasChanged:_})],B.prototype,"overrides",void 0),n([d({attribute:!1})],B.prototype,"conditionsManagerEpoch",void 0),n([d({attribute:!1})],B.prototype,"cardWideConfig",void 0),n([d({attribute:!1})],B.prototype,"cameraManager",void 0),n([d({attribute:!1})],B.prototype,"microphoneManager",void 0),n([d({attribute:!1})],B.prototype,"triggeredCameraIDs",void 0),B=n([c("frigate-card-live-grid")],B);let V=class extends h{constructor(){super(...arguments),this._controller=new O(this)}shouldUpdate(e){return this._controller.shouldUpdate()}willUpdate(){this._controller.clearMessageReceived()}render(){if(this.hass&&this.nonOverriddenLiveConfig&&this.cameraManager)return u`${Z(this._controller.getRenderEpoch(),u` + + + `)}`}static get styles(){return M(j)}};n([d({attribute:!1})],V.prototype,"conditionsManagerEpoch",void 0),n([d({attribute:!1})],V.prototype,"hass",void 0),n([d({attribute:!1})],V.prototype,"viewManagerEpoch",void 0),n([d({attribute:!1})],V.prototype,"nonOverriddenLiveConfig",void 0),n([d({attribute:!1})],V.prototype,"overriddenLiveConfig",void 0),n([d({attribute:!1,hasChanged:_})],V.prototype,"overrides",void 0),n([d({attribute:!1})],V.prototype,"cameraManager",void 0),n([d({attribute:!1})],V.prototype,"cardWideConfig",void 0),n([d({attribute:!1})],V.prototype,"microphoneManager",void 0),n([d({attribute:!1})],V.prototype,"triggeredCameraIDs",void 0),V=n([c("frigate-card-live")],V);var Y=Object.freeze({__proto__:null,get FrigateCardLive(){return V}});export{P as g,Y as i}; diff --git a/config/www/community/frigate-hass-card/index-0a012f43.js.gz b/config/www/community/frigate-hass-card/index-0a012f43.js.gz new file mode 100644 index 00000000..242ea06c Binary files /dev/null and b/config/www/community/frigate-hass-card/index-0a012f43.js.gz differ diff --git a/config/www/community/frigate-hass-card/index-17f8eed5.js b/config/www/community/frigate-hass-card/index-17f8eed5.js new file mode 100644 index 00000000..2e71cf49 --- /dev/null +++ b/config/www/community/frigate-hass-card/index-17f8eed5.js @@ -0,0 +1 @@ +import{dw as e,dx as t,dy as i,dz as s,a as n,dm as o,cQ as a,l as c,x as r,r as d,_ as h,n as l,t as p}from"./card-c642ee74.js";import{g as u}from"./endpoint-cc3caf82.js";import{s as m,h as v,c as y}from"./media-6eadcd60.js";import"./image-cbfd7ccb.js";import{m as g}from"./audio-cf3a75aa.js";import{g as f}from"./get-technology-for-video-rtc-778a0c05.js";class b extends HTMLElement{constructor(){super(),this.DISCONNECT_TIMEOUT=5e3,this.RECONNECT_TIMEOUT=15e3,this.CODECS=["avc1.640029","avc1.64002A","avc1.640033","hvc1.1.6.L153.B0","mp4a.40.2","mp4a.40.5","flac","opus"],this.mode="webrtc,mse,hls,mjpeg",this.media="video,audio",this.background=!1,this.visibilityThreshold=0,this.visibilityCheck=!0,this.pcConfig={bundlePolicy:"max-bundle",iceServers:[{urls:"stun:stun.l.google.com:19302"}],sdpSemantics:"unified-plan"},this.wsState=WebSocket.CLOSED,this.pcState=WebSocket.CLOSED,this.video=null,this.ws=null,this.wsURL="",this.pc=null,this.connectTS=0,this.mseCodecs="",this.disconnectTID=0,this.reconnectTID=0,this.ondata=null,this.onmessage=null,this.microphoneStream=null,this.containingPlayer=null,this.controls=!0}reconnect(){this.wsState!==WebSocket.CLOSED?(this.ws?.addEventListener("close",(()=>this.onconnect())),this.ondisconnect()):(this.ondisconnect(),this.onconnect())}set src(e){"string"!=typeof e&&(e=e.toString()),e.startsWith("http")?e="ws"+e.substring(4):e.startsWith("/")&&(e="ws"+location.origin.substring(4)+e),this.wsURL=e,this.onconnect()}play(){}send(e){this.ws&&this.ws.send(JSON.stringify(e))}codecs(e){return this.CODECS.filter((e=>this.media.indexOf(e.indexOf("vc1")>0?"video":"audio")>=0)).filter((t=>e(`video/mp4; codecs="${t}"`))).join()}connectedCallback(){if(this.disconnectTID&&(clearTimeout(this.disconnectTID),this.disconnectTID=0),this.video){const e=this.video.seekable;e.length>0&&(this.video.currentTime=e.end(e.length-1)),this.play()}else this.oninit();this.onconnect()}disconnectedCallback(){this.background||this.disconnectTID||this.wsState===WebSocket.CLOSED&&this.pcState===WebSocket.CLOSED||(this.disconnectTID=setTimeout((()=>{this.reconnectTID&&(clearTimeout(this.reconnectTID),this.reconnectTID=0),this.disconnectTID=0,this.ondisconnect()}),this.DISCONNECT_TIMEOUT))}oninit(){this.video=document.createElement("video"),m(this.video,this.controls),this.video.playsInline=!0,this.video.preload="auto",this.video.style.display="block",this.video.style.width="100%",this.video.style.height="100%",this.appendChild(this.video),this.video.addEventListener("error",(e=>{this.ws&&this.wsState===WebSocket.OPEN&&this.ws.close()}));const n=window.navigator.userAgent.match(/Version\/(\d+).+Safari/);if(n){const e=n[1]<"13"?"mp4a.40.2":n[1]<"14"?"flac":"opus";this.CODECS.splice(this.CODECS.indexOf(e))}if(!this.background){if("hidden"in document&&this.visibilityCheck&&document.addEventListener("visibilitychange",(()=>{document.hidden?this.disconnectedCallback():this.isConnected&&this.connectedCallback()})),"IntersectionObserver"in window&&this.visibilityThreshold){new IntersectionObserver((e=>{e.forEach((e=>{e.isIntersecting?this.isConnected&&this.connectedCallback():this.disconnectedCallback()}))}),{threshold:this.visibilityThreshold}).observe(this)}this.video.onloadeddata=()=>{this.controls&&v(this.video,y),e(this,this.video,{player:this.containingPlayer,capabilities:{supports2WayAudio:!!this.pc,supportsPause:!0,hasAudio:g(this.video)},technology:f(this)})},this.video.onvolumechange=()=>t(this),this.video.onplay=()=>i(this),this.video.onpause=()=>s(this),this.video.muted=!0}}onconnect(){return!(!this.isConnected||!this.wsURL||this.ws||this.pc)&&(this.wsState=WebSocket.CONNECTING,this.connectTS=Date.now(),this.ws=new WebSocket(this.wsURL),this.ws.binaryType="arraybuffer",this.ws.addEventListener("open",(e=>this.onopen(e))),this.ws.addEventListener("close",(e=>this.onclose(e))),!0)}ondisconnect(){this.wsState=WebSocket.CLOSED,this.ws&&(this.ws.close(),this.ws=null),this.pcState=WebSocket.CLOSED,this.pc&&(this.pc.getSenders().forEach((e=>{e.track&&e.track.stop()})),this.pc.close(),this.pc=null),this.video.src="",this.video.srcObject=null}onopen(){this.wsState=WebSocket.OPEN,this.ws.addEventListener("message",(e=>{if("string"==typeof e.data){const t=JSON.parse(e.data);for(const e in this.onmessage)this.onmessage[e](t)}else this.ondata(e.data)})),this.ondata=null,this.onmessage={};const e=[];return this.mode.indexOf("mse")>=0&&("MediaSource"in window||"ManagedMediaSource"in window)?(e.push("mse"),this.onmse()):this.mode.indexOf("hls")>=0&&this.video.canPlayType("application/vnd.apple.mpegurl")?(e.push("hls"),this.onhls()):this.mode.indexOf("mp4")>=0&&(e.push("mp4"),this.onmp4()),this.mode.indexOf("webrtc")>=0&&"RTCPeerConnection"in window&&(e.push("webrtc"),this.onwebrtc()),this.mode.indexOf("mjpeg")>=0&&(e.length?this.onmessage.mjpeg=t=>{"error"===t.type&&0===t.value.indexOf(e[0])&&this.onmjpeg()}:(e.push("mjpeg"),this.onmjpeg())),e}onclose(){if(this.wsState===WebSocket.CLOSED)return!1;this.wsState=WebSocket.CONNECTING,this.ws=null;const e=Math.max(this.RECONNECT_TIMEOUT-(Date.now()-this.connectTS),0);return this.reconnectTID=setTimeout((()=>{this.reconnectTID=0,this.onconnect()}),e),!0}onmse(){let e;if("ManagedMediaSource"in window){const t=window.ManagedMediaSource;e=new t,e.addEventListener("sourceopen",(()=>{this.send({type:"mse",value:this.codecs(t.isTypeSupported)})}),{once:!0}),this.video.disableRemotePlayback=!0,this.video.srcObject=e}else e=new MediaSource,e.addEventListener("sourceopen",(()=>{URL.revokeObjectURL(this.video.src),this.send({type:"mse",value:this.codecs(MediaSource.isTypeSupported)})}),{once:!0}),this.video.src=URL.createObjectURL(e),this.video.srcObject=null;this.play(),this.mseCodecs="",this.onmessage.mse=t=>{if("mse"!==t.type)return;this.mseCodecs=t.value;const i=e.addSourceBuffer(t.value);i.mode="segments",i.addEventListener("updateend",(()=>{if(!i.updating)try{if(n>0){const e=s.slice(0,n);n=0,i.appendBuffer(e)}else if(i.buffered&&i.buffered.length){const t=i.buffered.end(i.buffered.length-1)-15,s=i.buffered.start(0);t>s&&(i.remove(s,t),e.setLiveSeekableRange(t,t+15))}}catch(e){}}));const s=new Uint8Array(2097152);let n=0;this.ondata=e=>{if(i.updating||n>0){const t=new Uint8Array(e);s.set(t,n),n+=t.byteLength}else try{i.appendBuffer(e)}catch(e){}}}}onwebrtc(){const e=new RTCPeerConnection(this.pcConfig);e.addEventListener("icecandidate",(e=>{if(e.candidate&&this.mode.indexOf("webrtc/tcp")>=0&&"udp"===e.candidate.protocol)return;const t=e.candidate?e.candidate.toJSON().candidate:"";this.send({type:"webrtc/candidate",value:t})})),e.addEventListener("connectionstatechange",(()=>{if("connected"===e.connectionState){const t=e.getTransceivers().filter((e=>"recvonly"===e.currentDirection)).map((e=>e.receiver.track)),i=document.createElement("video");i.addEventListener("loadeddata",(()=>this.onpcvideo(i)),{once:!0}),i.srcObject=new MediaStream(t)}else"failed"!==e.connectionState&&"disconnected"!==e.connectionState||(e.close(),this.pcState=WebSocket.CLOSED,this.pc=null,this.onconnect())})),this.onmessage.webrtc=t=>{switch(t.type){case"webrtc/candidate":if(this.mode.indexOf("webrtc/tcp")>=0&&t.value.indexOf(" udp ")>0)return;e.addIceCandidate({candidate:t.value,sdpMid:"0"}).catch((e=>{console.warn(e)}));break;case"webrtc/answer":e.setRemoteDescription({type:"answer",sdp:t.value}).catch((e=>{console.warn(e)}));break;case"error":if(t.value.indexOf("webrtc/offer")<0)return;e.close()}},this.createOffer(e).then((e=>{this.send({type:"webrtc/offer",value:e.sdp})})),this.pcState=WebSocket.CONNECTING,this.pc=e}async createOffer(e){this.microphoneStream?.getTracks().forEach((t=>{e.addTransceiver(t,{direction:"sendonly"})}));try{if(this.media.indexOf("microphone")>=0){(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach((t=>{e.addTransceiver(t,{direction:"sendonly"})}))}}catch(e){console.warn(e)}for(const t of["video","audio"])this.media.indexOf(t)>=0&&e.addTransceiver(t,{direction:"recvonly"});const t=await e.createOffer();return await e.setLocalDescription(t),t}onpcvideo(e){if(this.pc){let t=0,i=0;const s=e.srcObject;s.getVideoTracks().length>0&&(t+=544),s.getAudioTracks().length>0&&(t+=258),this.mseCodecs.indexOf("hvc1.")>=0&&(i+=560),this.mseCodecs.indexOf("avc1.")>=0&&(i+=528),this.mseCodecs.indexOf("mp4a.")>=0&&(i+=257),t>=i?(this.video.srcObject=s,this.play(),this.pcState=WebSocket.OPEN,this.wsState=WebSocket.CLOSED,this.ws&&(this.ws.close(),this.ws=null)):(this.pcState=WebSocket.CLOSED,this.pc&&(this.pc.close(),this.pc=null))}e.srcObject=null}onmjpeg(){let t=!1;this.ondata=i=>{m(this.video,!1),this.video.poster="data:image/jpeg;base64,"+b.btoa(i),t||(t=!0,e(this,this.video,{player:this.containingPlayer,technology:["mjpeg"]}))},this.send({type:"mjpeg"})}onhls(){this.onmessage.hls=e=>{if("hls"!==e.type)return;const t="http"+this.wsURL.substring(2,this.wsURL.indexOf("/ws"))+"/hls/",i=e.value.replace("hls/",t);this.video.src="data:application/vnd.apple.mpegurl;base64,"+btoa(i),this.play()},this.send({type:"hls",value:this.codecs((e=>this.video.canPlayType(e)))})}onmp4(){const t=document.createElement("canvas");let i;const s=document.createElement("video");s.autoplay=!0,s.playsInline=!0,s.muted=!0,s.addEventListener("loadeddata",(n=>{i||(t.width=s.videoWidth,t.height=s.videoHeight,i=t.getContext("2d"),e(this,s,{player:this.containingPlayer,technology:["mp4"]})),i.drawImage(s,0,0,t.width,t.height),m(this.video,!1),this.video.poster=t.toDataURL("image/jpeg")})),this.ondata=e=>{s.src="data:video/mp4;base64,"+b.btoa(e)},this.send({type:"mp4",value:this.codecs(this.video.canPlayType)})}static btoa(e){const t=new Uint8Array(e),i=t.byteLength;let s="";for(let e=0;e!e.hasSelectedResult()}}))}async _setURL(){const e=this.media?.getContentID();if(!this.media||!e||!this.hass||this.viewerConfig?.lazy_load&&!this.load)return;let i=this.resolvedMediaCache?.get(e)??null;if(i||(i=await l(this.hass,e,this.resolvedMediaCache)),!i)return;const t=i.url;if(g(t))return void(this._url=h(this.hass,t));const a=this.cameraManager?.getStore().getCamera(this.media.getCameraID()),r=a?.getProxyConfig();if(r&&c(this.hass,r,"media")){if(r.dynamic){const e=t.split(/#/)[0];await u(this.hass,e,{sslVerification:r.ssl_verification,sslCiphers:r.ssl_ciphers,openLimit:0})}try{this._url=await m(this.hass,v(t))}catch(e){p(e)}}else this._url=t}willUpdate(e){if((e.has("load")||e.has("media")||e.has("viewerConfig")||e.has("resolvedMediaCache")||e.has("hass"))&&this._setURL().then((()=>{this.requestUpdate()})),e.has("viewerConfig")&&this.viewerConfig?.zoomable&&import("./zoomer-28db7d93.js"),e.has("media")||e.has("cameraManager")){const e=this.media?.getCameraID(),i=e?this.cameraManager?.getStore().getCameraConfig(e):null;S(this,i?.dimensions?.layout),this.style.aspectRatio=C({ratio:i?.dimensions?.aspect_ratio})}}_useZoomIfRequired(e){if(!this.media)return e;const i=this.media.getCameraID(),t=this.media.getID()??void 0,a=this.cameraManager?.getStore().getCameraConfig(i),r=this.viewManagerEpoch?.manager.getView();return this.viewerConfig?.zoomable?w` a?.dimensions?.layout?{pan:a.dimensions.layout.pan,zoom:a.dimensions.layout.zoom}:void 0))} + .settings=${t?r?.context?.zoom?.[t]?.requested:void 0} + @frigate-card:zoom:zoomed=${()=>this.setControls(!1)} + @frigate-card:zoom:unzoomed=${()=>this.setControls()} + @frigate-card:zoom:change=${e=>f(e,this.viewManagerEpoch?.manager,t)} + > + ${e} + `:e}render(){if(this.load&&this.media&&this.hass&&this.viewerConfig)return this._url?this._useZoomIfRequired(w` + ${n.isVideo(this.media)?this.media.getVideoContentType()===Q.HLS?w` + `:w` + + `:w`{this.viewerConfig?.snapshot_click_plays_clip&&this._switchToRelatedClipView()}} + @load=${e=>{y(this,e,{player:this,technology:["jpg"]})}} + />`} + `):I({cardWideConfig:this.cardWideConfig})}static get styles(){return D(':host {\n background-color: var(--primary-background-color);\n background-position: center;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJjYW1lcmEtaXJpcy5zdmciCiAgIGlkPSJzdmc0IgogICB2ZXJzaW9uPSIxLjEiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjYjkzZTNlIgogICAgIGJvcmRlcmNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcm9wYWNpdHk9IjAuMjUiCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuNjA3ODQzMTQiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyNi42MjUwNiIKICAgICBpbmtzY2FwZTpjeD0iLTEuOTM0MjY4IgogICAgIGlua3NjYXBlOmN5PSIxNS42ODA3MTYiCiAgICAgaW5rc2NhcGU6d2luZG93LXdpZHRoPSIzODQwIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjE1MjciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEwODAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjIyNyIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiIC8+CiAgPGcKICAgICBpZD0iZzExMTkiCiAgICAgc3R5bGU9ImZpbGwtb3BhY2l0eTowLjA1O2ZpbGw6I2ZmZmZmZiI+CiAgICA8Y2lyY2xlCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eTowLjA1O3N0cm9rZS13aWR0aDoxLjM5NzI5IgogICAgICAgaWQ9InBhdGgxNzAiCiAgICAgICBjeD0iMTIiCiAgICAgICBjeT0iMTIiCiAgICAgICBpbmtzY2FwZTpsYWJlbD0iV2hpdGUgQmFja2dyb3VuZCIKICAgICAgIHI9IjExLjI1IiAvPgogICAgPHBhdGgKICAgICAgIGQ9Ik0gMTMuNzMwMDAxLDE1IDkuODMwMDAwMywyMS43NiBDIDEwLjUzLDIxLjkxIDExLjI1LDIyIDEyLDIyIGMgMi40MDAwMDEsMCA0LjYsLTAuODUgNi4zMiwtMi4yNSBMIDE0LjY2MDAwMSwxMy40IE0gMi40NjAwMDAzLDE1IGMgMC45MiwyLjkyIDMuMTUsNS4yNiA1Ljk5LDYuMzQgTCAxMi4xMiwxNSBtIC0zLjU3OTk5OTcsLTMgLTMuOSwtNi43NDk5OTk2IGMgLTEuNjQsMS43NDk5OTkgLTIuNjQsNC4xMzk5OTkzIC0yLjY0LDYuNzQ5OTk5NiAwLDAuNjggMC4wNywxLjM1IDAuMiwyIGggNy40OSBNIDIxLjgsOS45OTk5OTk3IEggMTQuMzEwMDAxIEwgMTQuNjAwMDAxLDEwLjUgMTkuMzYsMTguNzUgQyAyMSwxNi45NyAyMiwxNC42IDIyLDEyIDIyLDExLjMxIDIxLjkzLDEwLjY0IDIxLjgsOS45OTk5OTk3IG0gLTAuMjYsLTEgQyAyMC42Miw2LjA3MDAwMDUgMTguMzksMy43NDAwMDAyIDE1LjU1MDAwMSwyLjY2MDAwMDIgTCAxMS44OCw4Ljk5OTk5OTcgTSA5LjQwMDAwMDMsMTAuNSAxNC4xNzAwMDEsMi4yNDAwMDAyIGMgLTAuNywtMC4xNSAtMS40MjAwMDEsLTAuMjQgLTIuMTcwMDAxLC0wLjI0IC0yLjM5OTk5OTcsMCAtNC41OTk5OTk3LDAuODQgLTYuMzE5OTk5NywyLjI1MDAwMDMgbCAzLjY2LDYuMzQ5OTk5NSB6IgogICAgICAgaWQ9InBhdGgyIgogICAgICAgaW5rc2NhcGU6bGFiZWw9IklyaXMiCiAgICAgICBzdHlsZT0iZmlsbC1vcGFjaXR5OjAuMDU7ZmlsbDojZmZmZmZmIiAvPgogIDwvZz4KPC9zdmc+Cg==");\n background-size: 10%;\n background-position: center;\n}\n\n:host {\n display: block;\n width: 100%;\n height: 100%;\n}\n\nimg,\nvideo,\nfrigate-card-ha-hls-player {\n display: block;\n width: 100%;\n height: 100%;\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}\n\nfrigate-card-progress-indicator {\n padding: 30px;\n box-sizing: border-box;\n}')}};e([i({attribute:!1})],q.prototype,"hass",void 0),e([i({attribute:!1})],q.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],q.prototype,"media",void 0),e([i({attribute:!1})],q.prototype,"viewerConfig",void 0),e([i({attribute:!1})],q.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],q.prototype,"load",void 0),e([i({attribute:!1})],q.prototype,"cameraManager",void 0),e([i({attribute:!1})],q.prototype,"cardWideConfig",void 0),e([t()],q.prototype,"_url",void 0),q=e([a("frigate-card-viewer-provider")],q);let H=class extends r{constructor(){super(...arguments),this.showControls=!0,this._selected=0,this._media=null,this._mediaActionsController=new O,this._player=null,this._refCarousel=s()}updated(e){super.updated(e),e.has("viewManagerEpoch")&&this.viewManagerEpoch?.manager.getView()?.context?.mediaViewer!==this.viewManagerEpoch?.oldView?.context?.mediaViewer&&this._seekHandler(),!this._mediaActionsController.hasRoot()&&this._refCarousel.value&&this._mediaActionsController.initialize(this._refCarousel.value)}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._mediaActionsController.destroy(),super.disconnectedCallback()}_getTransitionEffect(){return this.viewerConfig?.transition_effect??k.media_viewer.transition_effect}_getPlugins(){return[R({...this.viewerConfig?.lazy_load&&{lazyLoadCallback:(e,i)=>this._lazyloadSlide(i)}}),U(),Y()]}_getMediaNeighbors(){const e=this._media?.length??0;if(!this._media)return null;const i=this._selected>0?this._selected-1:null,t=this._selected+1{if(!t||!this._media)return;const i=("previous"===e?t.previous?.index:t.next?.index)??null;null!==i&&this._setViewSelectedIndex(i)},r=this.viewManagerEpoch?.manager.getView();return w` + {this._setViewSelectedIndex(e.detail.index)}} + @frigate-card:media:loaded=${e=>{this._player=e.detail.player??null,this._seekHandler()}} + @frigate-card:media:unloaded=${()=>{this._player=null}} + > + ${this.showControls?w` {a("previous"),N(e)}} + >`:""} + ${W([this._media,r],(()=>this._getSlides()))} + ${this.showControls?w` {a("next"),N(e)}} + >`:""} + + ${r?w` + `:""} +
+ + +
+ `}async _seekHandler(){const e=this.viewManagerEpoch?.manager.getView(),i=e?.context?.mediaViewer?.seek;if(!(this.hass&&i&&this._media&&this._player))return;const t=this._media[this._selected];if(!t)return;const a=t.includesTime(i);$(this,!a,"unseekable"),a||this._player.isPaused()?a&&this._player.isPaused()&&this._player.play():this._player.pause();const r=await(this.cameraManager?.getMediaSeekTime(t,i))??null;null!==r&&this._player.seek(r)}_renderMediaItem(e){const i=this.viewManagerEpoch?.manager.getView();return this.hass&&i&&this.viewerConfig?w`
+ +
`:null}static get styles(){return D(":host {\n position: relative;\n --video-max-height: none;\n}\n\n:host([unselected]) frigate-card-carousel,\n:host([unselected]) .seek-warning {\n pointer-events: none;\n}\n\n:host([unseekable]) frigate-card-carousel {\n filter: brightness(50%);\n}\n\n:host([unseekable]) .seek-warning {\n display: block;\n}\n\n.seek-warning {\n display: none;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translateX(-50%) translateY(-50%);\n color: white;\n}\n\n.embla__slide {\n height: 100%;\n flex: 0 0 100%;\n}")}};e([i({attribute:!1})],H.prototype,"hass",void 0),e([i({attribute:!1})],H.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],H.prototype,"viewFilterCameraID",void 0),e([i({attribute:!1,hasChanged:x})],H.prototype,"viewerConfig",void 0),e([i({attribute:!1})],H.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],H.prototype,"cardWideConfig",void 0),e([i({attribute:!1})],H.prototype,"cameraManager",void 0),e([i({attribute:!1})],H.prototype,"showControls",void 0),e([t()],H.prototype,"_selected",void 0),H=e([a("frigate-card-viewer-carousel")],H);let X=class extends r{_renderCarousel(e){const i=this.viewManagerEpoch?.manager.getView()?.camera;return w` + + + `}willUpdate(e){e.has("viewManagerEpoch")&&this._needsGrid()&&import("./media-grid-0f7352bc.js")}_needsGrid(){const e=this.viewManagerEpoch?.manager.getView(),i=e?.queryResults?.getCameraIDs();return!!e?.isGrid()&&!!e?.supportsMultipleDisplayModes()&&(i?.size??0)>1}_gridSelectCamera(e){const i=this.viewManagerEpoch?.manager.getView();this.viewManagerEpoch?.manager.setViewByParameters({params:{camera:e,queryResults:i?.queryResults?.clone().promoteCameraSelectionToMainSelection(e)}})}render(){const e=this.viewManagerEpoch?.manager.getView(),i=e?.queryResults?.getCameraIDs();return i&&this._needsGrid()?w` + this._gridSelectCamera(e.detail.selected)} + > + ${[...i].map((e=>this._renderCarousel(e)))} + + `:this._renderCarousel()}static get styles(){return D(E)}};e([i({attribute:!1})],X.prototype,"hass",void 0),e([i({attribute:!1})],X.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],X.prototype,"viewerConfig",void 0),e([i({attribute:!1})],X.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],X.prototype,"cardWideConfig",void 0),e([i({attribute:!1})],X.prototype,"cameraManager",void 0),X=e([a("frigate-card-viewer-grid")],X);let J=class extends r{render(){if(this.hass&&this.viewManagerEpoch&&this.viewerConfig&&this.cameraManager&&this.cardWideConfig){if(!this.viewManagerEpoch.manager.getView()?.queryResults?.hasResults()){const e=!!this.viewManagerEpoch.manager.getView()?.context?.loading?.query;return P({type:"info",message:z(e?"error.awaiting_media":"common.no_media"),icon:"mdi:multimedia",dotdotdot:e})}return w` + `}}static get styles(){return D(":host {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n gap: 5px;\n}\n\nfrigate-card-viewer-carousel {\n flex: 1;\n min-height: 0;\n}")}};e([i({attribute:!1})],J.prototype,"hass",void 0),e([i({attribute:!1})],J.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],J.prototype,"viewerConfig",void 0),e([i({attribute:!1})],J.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],J.prototype,"cameraManager",void 0),e([i({attribute:!1})],J.prototype,"cardWideConfig",void 0),J=e([a("frigate-card-viewer")],J);export{J as FrigateCardViewer}; diff --git a/config/www/community/frigate-hass-card/index-25c40d01.js.gz b/config/www/community/frigate-hass-card/index-25c40d01.js.gz new file mode 100644 index 00000000..76c70773 Binary files /dev/null and b/config/www/community/frigate-hass-card/index-25c40d01.js.gz differ diff --git a/config/www/community/frigate-hass-card/index-33db4eee.js b/config/www/community/frigate-hass-card/index-33db4eee.js new file mode 100644 index 00000000..bb79fff7 --- /dev/null +++ b/config/www/community/frigate-hass-card/index-33db4eee.js @@ -0,0 +1,154 @@ +import{cL as e,_ as i,n as a,b as t,t as r,a as o,cM as s,cI as n,cN as d,cO as g,x as c,cP as h,l,cQ as m,e as v,r as p,cR as u,cS as C,cT as f,cU as I,cV as M,cW as _,cX as w,cY as b,cZ as y,c_ as L}from"./card-320adb66.js";import{p as A,u as D,i as $,d as j,M as z,A as E,a as S,b as N}from"./dispatch-live-error-c649b480.js";class k{constructor(e){this._inBackground=!1,this._lastMediaLoadedInfo=null,this._handleMediaLoaded=e=>{this._lastMediaLoadedInfo={source:e.composedPath()[0],mediaLoadedInfo:e.detail},this._inBackground&&e.stopPropagation()},this._host=e,e.addController(this),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}hostConnected(){this._intersectionObserver.observe(this._host),this._host.addEventListener("frigate-card:media:loaded",this._handleMediaLoaded)}hostDisconnected(){this._intersectionObserver.disconnect(),this._host.removeEventListener("frigate-card:media:loaded",this._handleMediaLoaded)}isInBackground(){return this._inBackground}_intersectionHandler(i){const a=this._inBackground;this._inBackground=!i.some((e=>e.isIntersecting)),!this._inBackground&&this._lastMediaLoadedInfo&&e(this._lastMediaLoadedInfo.source,this._lastMediaLoadedInfo.mediaLoadedInfo),a!==this._inBackground&&this._host.requestUpdate()}}let x=class extends o{constructor(){super(...arguments),this.load=!1,this.label="",this._isVideoMediaLoaded=!1,this._hasProviderError=!1,this._refProvider=s(),this._importPromises=[]}async play(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await A(this,this._refProvider.value)}async pause(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.pause())}async mute(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.mute())}async unmute(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.unmute())}isMuted(){return this._refProvider.value?.isMuted()??!0}async seek(e){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.seek(e))}async setControls(e){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.setControls(e))}isPaused(){return this._refProvider.value?.isPaused()??!0}async getScreenshotURL(){return await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.getScreenshotURL())??null}_getResolvedProvider(){return"auto"===this.cameraConfig?.live_provider?this.cameraConfig?.webrtc_card?.entity||this.cameraConfig?.webrtc_card?.url?"webrtc-card":this.cameraConfig?.camera_entity?"ha":this.cameraConfig?.frigate.camera_name?"jsmpeg":n.cameras.live_provider:this.cameraConfig?.live_provider||"image"}_shouldShowImageDuringLoading(){return!(!this.cameraConfig?.camera_entity||!this.hass||!this.liveConfig?.show_image_during_load||this._hasProviderError)}disconnectedCallback(){this._isVideoMediaLoaded=!1}_videoMediaShowHandler(){this._isVideoMediaLoaded=!0}_providerErrorHandler(){this._hasProviderError=!0}willUpdate(e){if(e.has("load")&&(this.load||(this._isVideoMediaLoaded=!1,d(this))),e.has("liveConfig")&&(this.liveConfig?.show_image_during_load&&this._importPromises.push(import("./image-678a8283.js")),this.liveConfig?.zoomable&&this._importPromises.push(import("./zoomer-85596cd4.js"))),e.has("cameraConfig")){const e=this._getResolvedProvider();"jsmpeg"===e?this._importPromises.push(import("./jsmpeg-50dde246.js")):"ha"===e?this._importPromises.push(import("./ha-4f7cd760.js")):"webrtc-card"===e?this._importPromises.push(import("./webrtc-card-a69dcd1f.js")):"image"===e?this._importPromises.push(import("./image-678a8283.js")):"go2rtc"===e&&this._importPromises.push(import("./index-a3bb8676.js")),D(this,this.cameraConfig?.dimensions?.layout),this.style.aspectRatio=g({ratio:this.cameraConfig?.dimensions?.aspect_ratio})}}async getUpdateComplete(){const e=await super.getUpdateComplete();return await Promise.all(this._importPromises),this._importPromises=[],e}_useZoomIfRequired(e){return this.liveConfig?.zoomable?c` this.cameraConfig?.dimensions?.layout?{pan:this.cameraConfig.dimensions.layout.pan,zoom:this.cameraConfig.dimensions.layout.zoom}:void 0))} + .settings=${this.zoomSettings} + @frigate-card:zoom:zoomed=${()=>this.setControls(!1)} + @frigate-card:zoom:unzoomed=${()=>this.setControls()} + > + ${e} + `:e}render(){if(!(this.load&&this.hass&&this.liveConfig&&this.cameraConfig))return;this.title=this.label,this.ariaLabel=this.label;const e=this._getResolvedProvider(),i=!this._isVideoMediaLoaded&&this._shouldShowImageDuringLoading(),a={hidden:i};if("ha"===e||"image"===e||this.cameraConfig?.camera_entity&&this.cameraConfig.always_error_if_entity_unavailable){if(!this.cameraConfig?.camera_entity)return j(this),h({message:l("error.no_live_camera"),type:"error",icon:"mdi:camera",context:this.cameraConfig});const e=this.hass.states[this.cameraConfig.camera_entity];if(!e)return j(this),h({message:l("error.live_camera_not_found"),type:"error",icon:"mdi:camera",context:this.cameraConfig});if("unavailable"===e.state)return j(this),d(this),h({message:`${l("error.live_camera_unavailable")}${this.label?`: ${this.label}`:""}`,type:"info",icon:"mdi:cctv-off",dotdotdot:!0})}return c`${this._useZoomIfRequired(c` + ${i||"image"===e?c` this._providerErrorHandler()} + @frigate-card:media:loaded=${i=>{"image"===e?this._videoMediaShowHandler():i.stopPropagation()}} + > + `:c``} + ${"ha"===e?c` this._providerErrorHandler()} + @frigate-card:media:loaded=${this._videoMediaShowHandler.bind(this)} + > + `:"go2rtc"===e?c`this._providerErrorHandler()} + @frigate-card:media:loaded=${this._videoMediaShowHandler.bind(this)} + > + `:"webrtc-card"===e?c`this._providerErrorHandler()} + @frigate-card:media:loaded=${this._videoMediaShowHandler.bind(this)} + > + `:"jsmpeg"===e?c` this._providerErrorHandler()} + @frigate-card:media:loaded=${this._videoMediaShowHandler.bind(this)} + > + `:c``} + `)} + ${i&&!this._isVideoMediaLoaded?c``:""} `}static get styles(){return p(':host {\n background-color: var(--primary-background-color);\n background-position: center;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJjYW1lcmEtaXJpcy5zdmciCiAgIGlkPSJzdmc0IgogICB2ZXJzaW9uPSIxLjEiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjYjkzZTNlIgogICAgIGJvcmRlcmNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcm9wYWNpdHk9IjAuMjUiCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuNjA3ODQzMTQiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyNi42MjUwNiIKICAgICBpbmtzY2FwZTpjeD0iLTEuOTM0MjY4IgogICAgIGlua3NjYXBlOmN5PSIxNS42ODA3MTYiCiAgICAgaW5rc2NhcGU6d2luZG93LXdpZHRoPSIzODQwIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjE1MjciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEwODAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjIyNyIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiIC8+CiAgPGcKICAgICBpZD0iZzExMTkiCiAgICAgc3R5bGU9ImZpbGwtb3BhY2l0eTowLjA1O2ZpbGw6I2ZmZmZmZiI+CiAgICA8Y2lyY2xlCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eTowLjA1O3N0cm9rZS13aWR0aDoxLjM5NzI5IgogICAgICAgaWQ9InBhdGgxNzAiCiAgICAgICBjeD0iMTIiCiAgICAgICBjeT0iMTIiCiAgICAgICBpbmtzY2FwZTpsYWJlbD0iV2hpdGUgQmFja2dyb3VuZCIKICAgICAgIHI9IjExLjI1IiAvPgogICAgPHBhdGgKICAgICAgIGQ9Ik0gMTMuNzMwMDAxLDE1IDkuODMwMDAwMywyMS43NiBDIDEwLjUzLDIxLjkxIDExLjI1LDIyIDEyLDIyIGMgMi40MDAwMDEsMCA0LjYsLTAuODUgNi4zMiwtMi4yNSBMIDE0LjY2MDAwMSwxMy40IE0gMi40NjAwMDAzLDE1IGMgMC45MiwyLjkyIDMuMTUsNS4yNiA1Ljk5LDYuMzQgTCAxMi4xMiwxNSBtIC0zLjU3OTk5OTcsLTMgLTMuOSwtNi43NDk5OTk2IGMgLTEuNjQsMS43NDk5OTkgLTIuNjQsNC4xMzk5OTkzIC0yLjY0LDYuNzQ5OTk5NiAwLDAuNjggMC4wNywxLjM1IDAuMiwyIGggNy40OSBNIDIxLjgsOS45OTk5OTk3IEggMTQuMzEwMDAxIEwgMTQuNjAwMDAxLDEwLjUgMTkuMzYsMTguNzUgQyAyMSwxNi45NyAyMiwxNC42IDIyLDEyIDIyLDExLjMxIDIxLjkzLDEwLjY0IDIxLjgsOS45OTk5OTk3IG0gLTAuMjYsLTEgQyAyMC42Miw2LjA3MDAwMDUgMTguMzksMy43NDAwMDAyIDE1LjU1MDAwMSwyLjY2MDAwMDIgTCAxMS44OCw4Ljk5OTk5OTcgTSA5LjQwMDAwMDMsMTAuNSAxNC4xNzAwMDEsMi4yNDAwMDAyIGMgLTAuNywtMC4xNSAtMS40MjAwMDEsLTAuMjQgLTIuMTcwMDAxLC0wLjI0IC0yLjM5OTk5OTcsMCAtNC41OTk5OTk3LDAuODQgLTYuMzE5OTk5NywyLjI1MDAwMDMgbCAzLjY2LDYuMzQ5OTk5NSB6IgogICAgICAgaWQ9InBhdGgyIgogICAgICAgaW5rc2NhcGU6bGFiZWw9IklyaXMiCiAgICAgICBzdHlsZT0iZmlsbC1vcGFjaXR5OjAuMDU7ZmlsbDojZmZmZmZmIiAvPgogIDwvZz4KPC9zdmc+Cg==");\n background-size: 10%;\n background-position: center;\n}\n\n:host {\n display: block;\n height: 100%;\n width: 100%;\n position: relative;\n}\n\n.hidden {\n display: none;\n}\n\nha-icon {\n position: absolute;\n top: 10px;\n right: 10px;\n color: var(--primary-color);\n}')}};i([a({attribute:!1})],x.prototype,"hass",void 0),i([a({attribute:!1})],x.prototype,"cameraConfig",void 0),i([a({attribute:!1})],x.prototype,"cameraEndpoints",void 0),i([a({attribute:!1})],x.prototype,"liveConfig",void 0),i([a({attribute:!0,type:Boolean})],x.prototype,"load",void 0),i([a({attribute:!1})],x.prototype,"label",void 0),i([a({attribute:!1})],x.prototype,"cardWideConfig",void 0),i([a({attribute:!1})],x.prototype,"microphoneStream",void 0),i([a({attribute:!1})],x.prototype,"zoomSettings",void 0),i([t()],x.prototype,"_isVideoMediaLoaded",void 0),i([t()],x.prototype,"_hasProviderError",void 0),x=i([r("frigate-card-live-provider")],x);const P="frigate-card-live-provider";let T=class extends o{constructor(){super(...arguments),this._cameraToSlide={},this._refPTZControl=s(),this._refCarousel=s(),this._mediaActionsController=new z,this._mediaHasLoaded=!1}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._mediaActionsController.destroy(),super.disconnectedCallback()}_getTransitionEffect(){return this.overriddenLiveConfig?.transition_effect??n.live.transition_effect}_getSelectedCameraIndex(){if(this.viewFilterCameraID)return 0;const e=this.cameraManager?.getStore().getCameraIDsWithCapability("live"),i=this.viewManagerEpoch?.manager.getView();return e?.size&&i?Math.max(0,Array.from(e).indexOf(i.camera)):0}willUpdate(e){(e.has("microphoneManager")||e.has("overriddenLiveConfig"))&&this._mediaActionsController.setOptions({playerSelector:P,...this.overriddenLiveConfig?.auto_play&&{autoPlayConditions:this.overriddenLiveConfig.auto_play},...this.overriddenLiveConfig?.auto_pause&&{autoPauseConditions:this.overriddenLiveConfig.auto_pause},...this.overriddenLiveConfig?.auto_mute&&{autoMuteConditions:this.overriddenLiveConfig.auto_mute},...this.overriddenLiveConfig?.auto_unmute&&{autoUnmuteConditions:this.overriddenLiveConfig.auto_unmute},...(this.overriddenLiveConfig?.auto_unmute||this.overriddenLiveConfig?.auto_mute)&&{microphoneManager:this.microphoneManager,microphoneMuteSeconds:this.overriddenLiveConfig.microphone.mute_after_microphone_mute_seconds}})}_getPlugins(){return[E({...this.overriddenLiveConfig?.lazy_load&&{lazyLoadCallback:(e,i)=>this._lazyloadOrUnloadSlide("load",e,i)},lazyUnloadConditions:this.overriddenLiveConfig?.lazy_unload,lazyUnloadCallback:(e,i)=>this._lazyloadOrUnloadSlide("unload",e,i)}),S(),N()]}_getLazyLoadCount(){return!1===this.overriddenLiveConfig?.lazy_load?null:0}_getSlides(){if(!this.cameraManager)return[[],{}];const e=this.viewManagerEpoch?.manager.getView(),i=this.viewFilterCameraID?new Set([this.viewFilterCameraID]):this.cameraManager?.getStore().getCameraIDsWithCapability("live"),a=[],t={};for(const[r,o]of this.cameraManager.getStore().getCameraConfigEntries(i)){const i=this._getSubstreamCameraID(r,e),s=r===i?o:this.cameraManager?.getStore().getCameraConfig(i),n=s?this._renderLive(i,s):null;n&&(t[r]=a.length,a.push(n))}return[a,t]}_setViewHandler(e){const i=this.cameraManager?.getStore().getCameraIDsWithCapability("live");i?.size&&e.detail.index!==this._getSelectedCameraIndex()&&this._setViewCameraID([...i][e.detail.index])}_setViewCameraID(e){e&&this.viewManagerEpoch?.manager.setViewByParametersWithNewQuery({params:{camera:e}})}_lazyloadOrUnloadSlide(e,i,a){a instanceof HTMLSlotElement&&(a=a.assignedElements({flatten:!0})[0]);const t=a?.querySelector(P);t&&(t.load="load"===e)}_renderLive(e,i){if(!(this.overriddenLiveConfig&&this.nonOverriddenLiveConfig&&this.hass&&this.cameraManager&&this.conditionsManagerEpoch))return;let a=null;try{a=C(this.conditionsManagerEpoch.manager,{live:this.nonOverriddenLiveConfig},{configOverrides:this.overrides,stateOverrides:{camera:e},schema:f}).live}catch(e){return I(this,e)}const t=this.cameraManager.getCameraMetadata(e),r=this.viewManagerEpoch?.manager.getView();return c` +
+ this.cameraManager?.getCameraEndpoints(e)??void 0))} + .label=${t?.title??""} + .liveConfig=${a} + .hass=${this.hass} + .cardWideConfig=${this.cardWideConfig} + .zoomSettings=${r?.context?.zoom?.[e]?.requested} + @frigate-card:zoom:change=${i=>M(i,this.viewManagerEpoch?.manager,e)} + > + +
+ `}_getSubstreamCameraID(e,i){return i?.context?.live?.overrides?.get(e)??e}_getCameraNeighbors(){const e=this.cameraManager?[...this.cameraManager?.getStore().getCameraIDsWithCapability("live")]:[],i=this.viewManagerEpoch?.manager.getView();if(this.viewFilterCameraID||e.length<=1||!i||!this.hass)return{};const a=this.viewFilterCameraID??i.camera,t=e.indexOf(a);if(t<0)return{};const r=e[t>0?t-1:e.length-1],o=e[t+1{this._setViewCameraID(t?.id),w(e)}} + > + `}render(){const e=this.viewManagerEpoch?.manager.getView();if(!(this.overriddenLiveConfig&&this.hass&&e&&this.cameraManager))return;const[i,a]=this._getSlides();if(this._cameraToSlide=a,!i.length)return;const t=i.length>1,r=this._getCameraNeighbors(),o=!(!this._mediaHasLoaded||this.viewFilterCameraID&&this.viewFilterCameraID!==e.camera||!1===e.context?.ptzControls?.enabled)&&e.context?.ptzControls?.enabled;return c` + {this._mediaHasLoaded=!0}} + @frigate-card:media:unloaded=${()=>{this._mediaHasLoaded=!1}} + > + ${this._renderNextPrevious("left",r)} + + ${i} + + ${this._renderNextPrevious("right",r)} + + + + `}_setMediaTarget(){const e=this.viewManagerEpoch?.manager.getView(),i=this._getSelectedCameraIndex();this.viewFilterCameraID?this._mediaActionsController.setTarget(i,e?.camera===this.viewFilterCameraID):this._mediaActionsController.setTarget(i,!0)}updated(e){super.updated(e);let i=!1;!this._mediaActionsController.hasRoot()&&this._refCarousel.value&&(this._mediaActionsController.initialize(this._refCarousel.value),i=!0),(i||e.has("viewManagerEpoch"))&&this._setMediaTarget()}static get styles(){return p(":host {\n display: block;\n --video-max-height: none;\n}\n\n:host(:not([grid-id])) {\n height: 100%;\n}\n\n:host([unselected]) frigate-card-carousel {\n pointer-events: none;\n}\n\n.embla__slide {\n display: flex;\n justify-content: center;\n height: 100%;\n flex: 0 0 100%;\n}")}};i([a({attribute:!1})],T.prototype,"hass",void 0),i([a({attribute:!1})],T.prototype,"viewManagerEpoch",void 0),i([a({attribute:!1})],T.prototype,"nonOverriddenLiveConfig",void 0),i([a({attribute:!1})],T.prototype,"overriddenLiveConfig",void 0),i([a({attribute:!1,hasChanged:u})],T.prototype,"overrides",void 0),i([a({attribute:!1})],T.prototype,"conditionsManagerEpoch",void 0),i([a({attribute:!1})],T.prototype,"cardWideConfig",void 0),i([a({attribute:!1})],T.prototype,"cameraManager",void 0),i([a({attribute:!1})],T.prototype,"microphoneManager",void 0),i([a({attribute:!1})],T.prototype,"viewFilterCameraID",void 0),i([t()],T.prototype,"_mediaHasLoaded",void 0),T=i([r("frigate-card-live-carousel")],T);let Z=class extends o{_renderCarousel(e){const i=this.viewManagerEpoch?.manager.getView(),a=e??i?.camera;return c` + + + `}_gridSelectCamera(e){this.viewManagerEpoch?.manager.setViewByParameters({params:{camera:e}})}_needsGrid(){const e=this.cameraManager?.getStore().getCameraIDsWithCapability("live"),i=this.viewManagerEpoch?.manager.getView();return!!i?.isGrid()&&!!i?.supportsMultipleDisplayModes()&&!!e&&e.size>1}willUpdate(e){e.has("viewManagerEpoch")&&this._needsGrid()&&import("./media-grid-adc03f7c.js")}render(){if(!this.conditionsManagerEpoch||!this.nonOverriddenLiveConfig)return;const e=this.cameraManager?.getStore().getCameraIDsWithCapability("live");return e?.size&&this._needsGrid()?c` + this._gridSelectCamera(e.detail.selected)} + > + ${[...e].map((e=>this._renderCarousel(e)))} + + `:this._renderCarousel()}static get styles(){return p(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\n@keyframes warning-pulse {\n 0% {\n border: solid 2px var(--frigate-card-triggered-color-1, rgba(0, 0, 0, 0));\n }\n 50% {\n border: solid 2px var(--frigate-card-triggered-color-2, var(--warning-color));\n }\n 100% {\n border: solid 2px var(--frigate-card-triggered-color-1, rgba(0, 0, 0, 0));\n }\n}\nfrigate-card-live-carousel[triggered] {\n animation: warning-pulse 5s infinite;\n}\n\nfrigate-card-live-carousel[selected] {\n --frigate-card-triggered-color-1: var(--primary-color);\n}")}};i([a({attribute:!1})],Z.prototype,"hass",void 0),i([a({attribute:!1})],Z.prototype,"viewManagerEpoch",void 0),i([a({attribute:!1})],Z.prototype,"nonOverriddenLiveConfig",void 0),i([a({attribute:!1})],Z.prototype,"overriddenLiveConfig",void 0),i([a({attribute:!1,hasChanged:u})],Z.prototype,"overrides",void 0),i([a({attribute:!1})],Z.prototype,"conditionsManagerEpoch",void 0),i([a({attribute:!1})],Z.prototype,"cardWideConfig",void 0),i([a({attribute:!1})],Z.prototype,"cameraManager",void 0),i([a({attribute:!1})],Z.prototype,"microphoneManager",void 0),i([a({attribute:!1})],Z.prototype,"triggeredCameraIDs",void 0),Z=i([r("frigate-card-live-grid")],Z);let G=class extends o{constructor(){super(...arguments),this._controller=new k(this)}render(){if(this.hass&&this.nonOverriddenLiveConfig&&this.cameraManager)return c` + + + `}static get styles(){return p(L)}};i([a({attribute:!1})],G.prototype,"conditionsManagerEpoch",void 0),i([a({attribute:!1})],G.prototype,"hass",void 0),i([a({attribute:!1})],G.prototype,"viewManagerEpoch",void 0),i([a({attribute:!1})],G.prototype,"nonOverriddenLiveConfig",void 0),i([a({attribute:!1})],G.prototype,"overriddenLiveConfig",void 0),i([a({attribute:!1,hasChanged:u})],G.prototype,"overrides",void 0),i([a({attribute:!1})],G.prototype,"cameraManager",void 0),i([a({attribute:!1})],G.prototype,"cardWideConfig",void 0),i([a({attribute:!1})],G.prototype,"microphoneManager",void 0),i([a({attribute:!1})],G.prototype,"triggeredCameraIDs",void 0),G=i([r("frigate-card-live")],G);export{G as FrigateCardLive}; diff --git a/config/www/community/frigate-hass-card/index-33db4eee.js.gz b/config/www/community/frigate-hass-card/index-33db4eee.js.gz new file mode 100644 index 00000000..5174b75e Binary files /dev/null and b/config/www/community/frigate-hass-card/index-33db4eee.js.gz differ diff --git a/config/www/community/frigate-hass-card/index-37750213.js b/config/www/community/frigate-hass-card/index-37750213.js new file mode 100644 index 00000000..9b6c9aba --- /dev/null +++ b/config/www/community/frigate-hass-card/index-37750213.js @@ -0,0 +1,131 @@ +import{_ as e,n as i,b as t,t as a,a as r,cR as s,dm as o,dn as n,da as d,dp as l,dq as g,dr as h,ds as c,dt as u,du as m,dv as v,db as p,cT as C,x as w,c_ as f,dl as I,cV as M,dw as y,dx as _,dy as b,dz as A,r as D,cW as x,cI as k,dA as j,s as $,dB as T,l as z,c$ as N,d1 as L,d2 as E,cU as P}from"./card-769e2b91.js";import"./ha-hls-player-2c0fea5b.js";import{p as Z,h as V,s as G,u as S,i as W,c as F,M as O,A as R,a as U,b as Y}from"./media-d4c0d154.js";import{m as B}from"./audio-cf3a75aa.js";import{V as Q}from"./media-c9012082.js";let q=class extends r{constructor(){super(...arguments),this.load=!1,this._refFrigateCardMediaPlayer=s(),this._refVideoProvider=s(),this._refImageProvider=s(),this._url=null}async play(){await Z(this,this._refFrigateCardMediaPlayer.value??this._refVideoProvider.value)}async pause(){(this._refFrigateCardMediaPlayer.value||this._refVideoProvider.value)?.pause()}async mute(){this._refFrigateCardMediaPlayer.value?this._refFrigateCardMediaPlayer.value?.mute():this._refVideoProvider.value&&(this._refVideoProvider.value.muted=!0)}async unmute(){this._refFrigateCardMediaPlayer.value?this._refFrigateCardMediaPlayer.value?.mute():this._refVideoProvider.value&&(this._refVideoProvider.value.muted=!1)}isMuted(){return this._refFrigateCardMediaPlayer.value?this._refFrigateCardMediaPlayer.value?.isMuted()??!0:!this._refVideoProvider.value||this._refVideoProvider.value.muted}async seek(e){if(this._refFrigateCardMediaPlayer.value)return this._refFrigateCardMediaPlayer.value.seek(e);this._refVideoProvider.value&&(V(this._refVideoProvider.value),this._refVideoProvider.value.currentTime=e)}async setControls(e){if(this._refFrigateCardMediaPlayer.value)return this._refFrigateCardMediaPlayer.value.setControls(e);this._refVideoProvider.value&&G(this._refVideoProvider.value,e??this.viewerConfig?.controls.builtin??!0)}isPaused(){return this._refFrigateCardMediaPlayer.value?this._refFrigateCardMediaPlayer.value.isPaused():!this._refVideoProvider.value||this._refVideoProvider.value.paused}async getScreenshotURL(){return this._refFrigateCardMediaPlayer.value?await this._refFrigateCardMediaPlayer.value.getScreenshotURL():this._refVideoProvider.value?o(this._refVideoProvider.value):this._refImageProvider.value?this._refImageProvider.value.src:null}async _switchToRelatedClipView(){const e=this.viewManagerEpoch?.manager.getView();if(!(this.hass&&e&&this.cameraManager&&this.media&&n.isEvent(this.media)&&d.areEventQueries(e.query)))return;const i=e.query.clone();i.convertToClipsQueries();i.getQueries()&&await(this.viewManagerEpoch?.manager.setViewByParametersWithExistingQuery({params:{view:"media",query:i},queryExecutorOptions:{selectResult:{id:this.media.getID()??void 0},rejectResults:e=>!e.hasSelectedResult()}}))}async _setURL(){const e=this.media?.getContentID();if(!this.media||!e||!this.hass||this.viewerConfig?.lazy_load&&!this.load)return;let i=this.resolvedMediaCache?.get(e)??null;if(i||(i=await l(this.hass,e,this.resolvedMediaCache)),!i)return;const t=i.url;if(g(t))return void(this._url=h(this.hass,t));const a=this.cameraManager?.getStore().getCamera(this.media.getCameraID()),r=a?.getProxyConfig();if(r&&c(this.hass,r,"media")){if(r.dynamic){const e=t.split(/#/)[0];await u(this.hass,e,{sslVerification:r.ssl_verification,sslCiphers:r.ssl_ciphers,openLimit:0})}try{this._url=await m(this.hass,v(t))}catch(e){p(e)}}else this._url=t}willUpdate(e){if((e.has("load")||e.has("media")||e.has("viewerConfig")||e.has("resolvedMediaCache")||e.has("hass"))&&this._setURL().then((()=>{this.requestUpdate()})),e.has("viewerConfig")&&this.viewerConfig?.zoomable&&import("./zoomer-ddec5522.js"),e.has("media")||e.has("cameraManager")){const e=this.media?.getCameraID(),i=e?this.cameraManager?.getStore().getCameraConfig(e):null;S(this,i?.dimensions?.layout),this.style.aspectRatio=C({ratio:i?.dimensions?.aspect_ratio})}}_useZoomIfRequired(e){if(!this.media)return e;const i=this.media.getCameraID(),t=this.media.getID()??void 0,a=this.cameraManager?.getStore().getCameraConfig(i),r=this.viewManagerEpoch?.manager.getView();return this.viewerConfig?.zoomable?w` a?.dimensions?.layout?{pan:a.dimensions.layout.pan,zoom:a.dimensions.layout.zoom}:void 0))} + .settings=${t?r?.context?.zoom?.[t]?.requested:void 0} + @frigate-card:zoom:zoomed=${()=>this.setControls(!1)} + @frigate-card:zoom:unzoomed=${()=>this.setControls()} + @frigate-card:zoom:change=${e=>f(e,this.viewManagerEpoch?.manager,t)} + > + ${e} + `:e}render(){if(this.load&&this.media&&this.hass&&this.viewerConfig)return this._url?this._useZoomIfRequired(w` + ${n.isVideo(this.media)?this.media.getVideoContentType()===Q.HLS?w` + `:w` + + `:w`{this.viewerConfig?.snapshot_click_plays_clip&&this._switchToRelatedClipView()}} + @load=${e=>{y(this,e,{player:this,technology:["jpg"]})}} + />`} + `):I({cardWideConfig:this.cardWideConfig})}static get styles(){return D(':host {\n background-color: var(--primary-background-color);\n background-position: center;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJjYW1lcmEtaXJpcy5zdmciCiAgIGlkPSJzdmc0IgogICB2ZXJzaW9uPSIxLjEiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjYjkzZTNlIgogICAgIGJvcmRlcmNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcm9wYWNpdHk9IjAuMjUiCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuNjA3ODQzMTQiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyNi42MjUwNiIKICAgICBpbmtzY2FwZTpjeD0iLTEuOTM0MjY4IgogICAgIGlua3NjYXBlOmN5PSIxNS42ODA3MTYiCiAgICAgaW5rc2NhcGU6d2luZG93LXdpZHRoPSIzODQwIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjE1MjciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEwODAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjIyNyIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiIC8+CiAgPGcKICAgICBpZD0iZzExMTkiCiAgICAgc3R5bGU9ImZpbGwtb3BhY2l0eTowLjA1O2ZpbGw6I2ZmZmZmZiI+CiAgICA8Y2lyY2xlCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eTowLjA1O3N0cm9rZS13aWR0aDoxLjM5NzI5IgogICAgICAgaWQ9InBhdGgxNzAiCiAgICAgICBjeD0iMTIiCiAgICAgICBjeT0iMTIiCiAgICAgICBpbmtzY2FwZTpsYWJlbD0iV2hpdGUgQmFja2dyb3VuZCIKICAgICAgIHI9IjExLjI1IiAvPgogICAgPHBhdGgKICAgICAgIGQ9Ik0gMTMuNzMwMDAxLDE1IDkuODMwMDAwMywyMS43NiBDIDEwLjUzLDIxLjkxIDExLjI1LDIyIDEyLDIyIGMgMi40MDAwMDEsMCA0LjYsLTAuODUgNi4zMiwtMi4yNSBMIDE0LjY2MDAwMSwxMy40IE0gMi40NjAwMDAzLDE1IGMgMC45MiwyLjkyIDMuMTUsNS4yNiA1Ljk5LDYuMzQgTCAxMi4xMiwxNSBtIC0zLjU3OTk5OTcsLTMgLTMuOSwtNi43NDk5OTk2IGMgLTEuNjQsMS43NDk5OTkgLTIuNjQsNC4xMzk5OTkzIC0yLjY0LDYuNzQ5OTk5NiAwLDAuNjggMC4wNywxLjM1IDAuMiwyIGggNy40OSBNIDIxLjgsOS45OTk5OTk3IEggMTQuMzEwMDAxIEwgMTQuNjAwMDAxLDEwLjUgMTkuMzYsMTguNzUgQyAyMSwxNi45NyAyMiwxNC42IDIyLDEyIDIyLDExLjMxIDIxLjkzLDEwLjY0IDIxLjgsOS45OTk5OTk3IG0gLTAuMjYsLTEgQyAyMC42Miw2LjA3MDAwMDUgMTguMzksMy43NDAwMDAyIDE1LjU1MDAwMSwyLjY2MDAwMDIgTCAxMS44OCw4Ljk5OTk5OTcgTSA5LjQwMDAwMDMsMTAuNSAxNC4xNzAwMDEsMi4yNDAwMDAyIGMgLTAuNywtMC4xNSAtMS40MjAwMDEsLTAuMjQgLTIuMTcwMDAxLC0wLjI0IC0yLjM5OTk5OTcsMCAtNC41OTk5OTk3LDAuODQgLTYuMzE5OTk5NywyLjI1MDAwMDMgbCAzLjY2LDYuMzQ5OTk5NSB6IgogICAgICAgaWQ9InBhdGgyIgogICAgICAgaW5rc2NhcGU6bGFiZWw9IklyaXMiCiAgICAgICBzdHlsZT0iZmlsbC1vcGFjaXR5OjAuMDU7ZmlsbDojZmZmZmZmIiAvPgogIDwvZz4KPC9zdmc+Cg==");\n background-size: 10%;\n background-position: center;\n}\n\n:host {\n display: block;\n width: 100%;\n height: 100%;\n}\n\nimg,\nvideo,\nfrigate-card-ha-hls-player {\n display: block;\n width: 100%;\n height: 100%;\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}\n\nfrigate-card-progress-indicator {\n padding: 30px;\n box-sizing: border-box;\n}')}};e([i({attribute:!1})],q.prototype,"hass",void 0),e([i({attribute:!1})],q.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],q.prototype,"media",void 0),e([i({attribute:!1})],q.prototype,"viewerConfig",void 0),e([i({attribute:!1})],q.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],q.prototype,"load",void 0),e([i({attribute:!1})],q.prototype,"cameraManager",void 0),e([i({attribute:!1})],q.prototype,"cardWideConfig",void 0),e([t()],q.prototype,"_url",void 0),q=e([a("frigate-card-viewer-provider")],q);let H=class extends r{constructor(){super(...arguments),this.showControls=!0,this._selected=0,this._media=null,this._mediaActionsController=new O,this._player=null,this._refCarousel=s()}updated(e){super.updated(e),e.has("viewManagerEpoch")&&this.viewManagerEpoch?.manager.getView()?.context?.mediaViewer!==this.viewManagerEpoch?.oldView?.context?.mediaViewer&&this._seekHandler(),!this._mediaActionsController.hasRoot()&&this._refCarousel.value&&this._mediaActionsController.initialize(this._refCarousel.value)}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._mediaActionsController.destroy(),super.disconnectedCallback()}_getTransitionEffect(){return this.viewerConfig?.transition_effect??k.media_viewer.transition_effect}_getPlugins(){return[R({...this.viewerConfig?.lazy_load&&{lazyLoadCallback:(e,i)=>this._lazyloadSlide(i)}}),U(),Y()]}_getMediaNeighbors(){const e=this._media?.length??0;if(!this._media)return null;const i=this._selected>0?this._selected-1:null,t=this._selected+1{if(!t||!this._media)return;const i=("previous"===e?t.previous?.index:t.next?.index)??null;null!==i&&this._setViewSelectedIndex(i)},r=this.viewManagerEpoch?.manager.getView();return w` + {this._setViewSelectedIndex(e.detail.index)}} + @frigate-card:media:loaded=${e=>{this._player=e.detail.player??null,this._seekHandler()}} + @frigate-card:media:unloaded=${()=>{this._player=null}} + > + ${this.showControls?w` {a("previous"),N(e)}} + >`:""} + ${W([this._media,r],(()=>this._getSlides()))} + ${this.showControls?w` {a("next"),N(e)}} + >`:""} + + ${r?w` + `:""} +
+ + +
+ `}async _seekHandler(){const e=this.viewManagerEpoch?.manager.getView(),i=e?.context?.mediaViewer?.seek;if(!(this.hass&&i&&this._media&&this._player))return;const t=this._media[this._selected];if(!t)return;const a=t.includesTime(i);$(this,!a,"unseekable"),a||this._player.isPaused()?a&&this._player.isPaused()&&this._player.play():this._player.pause();const r=await(this.cameraManager?.getMediaSeekTime(t,i))??null;null!==r&&this._player.seek(r)}_renderMediaItem(e){const i=this.viewManagerEpoch?.manager.getView();return this.hass&&i&&this.viewerConfig?w`
+ +
`:null}static get styles(){return D(":host {\n position: relative;\n --video-max-height: none;\n}\n\n:host([unselected]) frigate-card-carousel,\n:host([unselected]) .seek-warning {\n pointer-events: none;\n}\n\n:host([unseekable]) frigate-card-carousel {\n filter: brightness(50%);\n}\n\n:host([unseekable]) .seek-warning {\n display: block;\n}\n\n.seek-warning {\n display: none;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translateX(-50%) translateY(-50%);\n color: white;\n}\n\n.embla__slide {\n height: 100%;\n flex: 0 0 100%;\n}")}};e([i({attribute:!1})],H.prototype,"hass",void 0),e([i({attribute:!1})],H.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],H.prototype,"viewFilterCameraID",void 0),e([i({attribute:!1,hasChanged:x})],H.prototype,"viewerConfig",void 0),e([i({attribute:!1})],H.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],H.prototype,"cardWideConfig",void 0),e([i({attribute:!1})],H.prototype,"cameraManager",void 0),e([i({attribute:!1})],H.prototype,"showControls",void 0),e([t()],H.prototype,"_selected",void 0),H=e([a("frigate-card-viewer-carousel")],H);let X=class extends r{_renderCarousel(e){const i=this.viewManagerEpoch?.manager.getView()?.camera;return w` + + + `}willUpdate(e){e.has("viewManagerEpoch")&&this._needsGrid()&&import("./media-grid-110faed3.js")}_needsGrid(){const e=this.viewManagerEpoch?.manager.getView(),i=e?.queryResults?.getCameraIDs();return!!e?.isGrid()&&!!e?.supportsMultipleDisplayModes()&&(i?.size??0)>1}_gridSelectCamera(e){const i=this.viewManagerEpoch?.manager.getView();this.viewManagerEpoch?.manager.setViewByParameters({params:{camera:e,queryResults:i?.queryResults?.clone().promoteCameraSelectionToMainSelection(e)}})}render(){const e=this.viewManagerEpoch?.manager.getView(),i=e?.queryResults?.getCameraIDs();return i&&this._needsGrid()?w` + this._gridSelectCamera(e.detail.selected)} + > + ${[...i].map((e=>this._renderCarousel(e)))} + + `:this._renderCarousel()}static get styles(){return D(E)}};e([i({attribute:!1})],X.prototype,"hass",void 0),e([i({attribute:!1})],X.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],X.prototype,"viewerConfig",void 0),e([i({attribute:!1})],X.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],X.prototype,"cardWideConfig",void 0),e([i({attribute:!1})],X.prototype,"cameraManager",void 0),X=e([a("frigate-card-viewer-grid")],X);let J=class extends r{render(){if(this.hass&&this.viewManagerEpoch&&this.viewerConfig&&this.cameraManager&&this.cardWideConfig){if(!this.viewManagerEpoch.manager.getView()?.queryResults?.hasResults()){const e=!!this.viewManagerEpoch.manager.getView()?.context?.loading?.query;return P({type:"info",message:z(e?"error.awaiting_media":"common.no_media"),icon:"mdi:multimedia",dotdotdot:e})}return w` + `}}static get styles(){return D(":host {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n gap: 5px;\n}\n\nfrigate-card-viewer-carousel {\n flex: 1;\n min-height: 0;\n}")}};e([i({attribute:!1})],J.prototype,"hass",void 0),e([i({attribute:!1})],J.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],J.prototype,"viewerConfig",void 0),e([i({attribute:!1})],J.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],J.prototype,"cameraManager",void 0),e([i({attribute:!1})],J.prototype,"cardWideConfig",void 0),J=e([a("frigate-card-viewer")],J);export{J as FrigateCardViewer}; diff --git a/config/www/community/frigate-hass-card/index-37750213.js.gz b/config/www/community/frigate-hass-card/index-37750213.js.gz new file mode 100644 index 00000000..be6634a2 Binary files /dev/null and b/config/www/community/frigate-hass-card/index-37750213.js.gz differ diff --git a/config/www/community/frigate-hass-card/index-3c9b9749.js b/config/www/community/frigate-hass-card/index-3c9b9749.js new file mode 100644 index 00000000..9e8e16ba --- /dev/null +++ b/config/www/community/frigate-hass-card/index-3c9b9749.js @@ -0,0 +1,162 @@ +import{cL as e,cM as i,cN as t,cO as a,cP as r,cQ as o,l as s,_ as n,n as d,b as g,t as c,a as h,cR as l,cI as m,cS as v,cT as p,x as u,cU as C,cV as f,e as I,r as M,cW as _,cX as w,cY as b,cZ as y,c_ as L,c$ as A,d0 as D,d1 as $,d2 as j}from"./card-7cd05290.js";import{p as z,u as k,i as S,M as E,A as N,a as x,b as T}from"./media-67c578aa.js"; +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const Z=e(class extends i{constructor(){super(...arguments),this.key=t}render(e,i){return this.key=e,i}update(e,[i,t]){return i!==this.key&&(a(e),this.key=i),t}});class O{constructor(e){this._inBackground=!1,this._messageReceived=!1,this._lastMediaLoadedInfo=null,this._renderEpoch=0,this._handleMessage=e=>{this._messageReceived=!0,this._inBackground&&(e.stopPropagation(),this._renderEpoch++)},this._handleMediaLoaded=e=>{this._lastMediaLoadedInfo={source:e.composedPath()[0],mediaLoadedInfo:e.detail},this._inBackground&&e.stopPropagation()},this._host=e,e.addController(this),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}shouldUpdate(){return!(this._inBackground&&this._messageReceived)}hostConnected(){this._intersectionObserver.observe(this._host),this._host.addEventListener("frigate-card:media:loaded",this._handleMediaLoaded),this._host.addEventListener("frigate-card:message",this._handleMessage)}hostDisconnected(){this._intersectionObserver.disconnect(),this._host.removeEventListener("frigate-card:media:loaded",this._handleMediaLoaded),this._host.removeEventListener("frigate-card:message",this._handleMessage)}clearMessageReceived(){this._messageReceived=!1}isInBackground(){return this._inBackground}getRenderEpoch(){return this._renderEpoch}_intersectionHandler(e){const i=this._inBackground;this._inBackground=!e.some((e=>e.isIntersecting)),this._inBackground||this._messageReceived||!this._lastMediaLoadedInfo||r(this._lastMediaLoadedInfo.source,this._lastMediaLoadedInfo.mediaLoadedInfo),i!==this._inBackground&&this._host.requestUpdate()}}const P=(e,i,t)=>{if(!t?.camera_entity)return o(e,s("error.no_live_camera"),{context:t}),null;const a=i.states[t.camera_entity];return a||(o(e,s("error.live_camera_not_found"),{context:t}),null)};let G=class extends h{constructor(){super(...arguments),this.load=!1,this.label="",this._isVideoMediaLoaded=!1,this._refProvider=l(),this._importPromises=[]}async play(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await z(this,this._refProvider.value)}async pause(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.pause())}async mute(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.mute())}async unmute(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.unmute())}isMuted(){return this._refProvider.value?.isMuted()??!0}async seek(e){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.seek(e))}async setControls(e){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.setControls(e))}isPaused(){return this._refProvider.value?.isPaused()??!0}async getScreenshotURL(){return await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.getScreenshotURL())??null}_getResolvedProvider(){return"auto"===this.cameraConfig?.live_provider?this.cameraConfig?.webrtc_card?.entity||this.cameraConfig?.webrtc_card?.url?"webrtc-card":this.cameraConfig?.camera_entity?"ha":this.cameraConfig?.frigate.camera_name?"jsmpeg":m.cameras.live_provider:this.cameraConfig?.live_provider||"image"}_shouldShowImageDuringLoading(){return!!this.cameraConfig?.camera_entity&&!!this.hass&&!!this.liveConfig?.show_image_during_load}disconnectedCallback(){this._isVideoMediaLoaded=!1}_videoMediaShowHandler(){this._isVideoMediaLoaded=!0}willUpdate(e){if(e.has("load")&&(this.load||(this._isVideoMediaLoaded=!1,v(this))),e.has("liveConfig")&&(this.liveConfig?.show_image_during_load&&this._importPromises.push(import("./image-b5d57727.js")),this.liveConfig?.zoomable&&this._importPromises.push(import("./zoomer-672d26af.js"))),e.has("cameraConfig")){const e=this._getResolvedProvider();"jsmpeg"===e?this._importPromises.push(import("./jsmpeg-45778f1d.js")):"ha"===e?this._importPromises.push(import("./ha-9af0bc47.js")):"webrtc-card"===e?this._importPromises.push(import("./webrtc-card-b8854548.js")):"image"===e?this._importPromises.push(import("./image-b5d57727.js")):"go2rtc"===e&&this._importPromises.push(import("./index-78f3984a.js")),k(this,this.cameraConfig?.dimensions?.layout),this.style.aspectRatio=p({ratio:this.cameraConfig?.dimensions?.aspect_ratio})}}async getUpdateComplete(){const e=await super.getUpdateComplete();return await Promise.all(this._importPromises),this._importPromises=[],e}_useZoomIfRequired(e){return this.liveConfig?.zoomable?u` this.cameraConfig?.dimensions?.layout?{pan:this.cameraConfig.dimensions.layout.pan,zoom:this.cameraConfig.dimensions.layout.zoom}:void 0))} + .settings=${this.zoomSettings} + @frigate-card:zoom:zoomed=${()=>this.setControls(!1)} + @frigate-card:zoom:unzoomed=${()=>this.setControls()} + > + ${e} + `:e}render(){if(!(this.load&&this.hass&&this.liveConfig&&this.cameraConfig))return;this.title=this.label,this.ariaLabel=this.label;const e=this._getResolvedProvider(),i=!this._isVideoMediaLoaded&&this._shouldShowImageDuringLoading(),t={hidden:i};if("ha"===e||"image"===e){const e=P(this,this.hass,this.cameraConfig);if(!e)return;if("unavailable"===e.state)return v(this),C({message:`${s("error.live_camera_unavailable")}${this.label?`: ${this.label}`:""}`,type:"info",icon:"mdi:cctv-off",dotdotdot:!0})}return u`${this._useZoomIfRequired(u` + ${i||"image"===e?u` {"image"===e?this._videoMediaShowHandler():i.stopPropagation()}} + > + `:u``} + ${"ha"===e?u` + `:"go2rtc"===e?u` + `:"webrtc-card"===e?u` + `:"jsmpeg"===e?u` + `:u``} + `)} + ${i&&!this._isVideoMediaLoaded?u``:""} `}static get styles(){return M(':host {\n background-color: var(--primary-background-color);\n background-position: center;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJjYW1lcmEtaXJpcy5zdmciCiAgIGlkPSJzdmc0IgogICB2ZXJzaW9uPSIxLjEiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjYjkzZTNlIgogICAgIGJvcmRlcmNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcm9wYWNpdHk9IjAuMjUiCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuNjA3ODQzMTQiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyNi42MjUwNiIKICAgICBpbmtzY2FwZTpjeD0iLTEuOTM0MjY4IgogICAgIGlua3NjYXBlOmN5PSIxNS42ODA3MTYiCiAgICAgaW5rc2NhcGU6d2luZG93LXdpZHRoPSIzODQwIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjE1MjciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEwODAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjIyNyIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiIC8+CiAgPGcKICAgICBpZD0iZzExMTkiCiAgICAgc3R5bGU9ImZpbGwtb3BhY2l0eTowLjA1O2ZpbGw6I2ZmZmZmZiI+CiAgICA8Y2lyY2xlCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eTowLjA1O3N0cm9rZS13aWR0aDoxLjM5NzI5IgogICAgICAgaWQ9InBhdGgxNzAiCiAgICAgICBjeD0iMTIiCiAgICAgICBjeT0iMTIiCiAgICAgICBpbmtzY2FwZTpsYWJlbD0iV2hpdGUgQmFja2dyb3VuZCIKICAgICAgIHI9IjExLjI1IiAvPgogICAgPHBhdGgKICAgICAgIGQ9Ik0gMTMuNzMwMDAxLDE1IDkuODMwMDAwMywyMS43NiBDIDEwLjUzLDIxLjkxIDExLjI1LDIyIDEyLDIyIGMgMi40MDAwMDEsMCA0LjYsLTAuODUgNi4zMiwtMi4yNSBMIDE0LjY2MDAwMSwxMy40IE0gMi40NjAwMDAzLDE1IGMgMC45MiwyLjkyIDMuMTUsNS4yNiA1Ljk5LDYuMzQgTCAxMi4xMiwxNSBtIC0zLjU3OTk5OTcsLTMgLTMuOSwtNi43NDk5OTk2IGMgLTEuNjQsMS43NDk5OTkgLTIuNjQsNC4xMzk5OTkzIC0yLjY0LDYuNzQ5OTk5NiAwLDAuNjggMC4wNywxLjM1IDAuMiwyIGggNy40OSBNIDIxLjgsOS45OTk5OTk3IEggMTQuMzEwMDAxIEwgMTQuNjAwMDAxLDEwLjUgMTkuMzYsMTguNzUgQyAyMSwxNi45NyAyMiwxNC42IDIyLDEyIDIyLDExLjMxIDIxLjkzLDEwLjY0IDIxLjgsOS45OTk5OTk3IG0gLTAuMjYsLTEgQyAyMC42Miw2LjA3MDAwMDUgMTguMzksMy43NDAwMDAyIDE1LjU1MDAwMSwyLjY2MDAwMDIgTCAxMS44OCw4Ljk5OTk5OTcgTSA5LjQwMDAwMDMsMTAuNSAxNC4xNzAwMDEsMi4yNDAwMDAyIGMgLTAuNywtMC4xNSAtMS40MjAwMDEsLTAuMjQgLTIuMTcwMDAxLC0wLjI0IC0yLjM5OTk5OTcsMCAtNC41OTk5OTk3LDAuODQgLTYuMzE5OTk5NywyLjI1MDAwMDMgbCAzLjY2LDYuMzQ5OTk5NSB6IgogICAgICAgaWQ9InBhdGgyIgogICAgICAgaW5rc2NhcGU6bGFiZWw9IklyaXMiCiAgICAgICBzdHlsZT0iZmlsbC1vcGFjaXR5OjAuMDU7ZmlsbDojZmZmZmZmIiAvPgogIDwvZz4KPC9zdmc+Cg==");\n background-size: 10%;\n background-position: center;\n}\n\n:host {\n display: block;\n height: 100%;\n width: 100%;\n position: relative;\n}\n\n.hidden {\n display: none;\n}\n\nha-icon {\n position: absolute;\n top: 10px;\n right: 10px;\n color: var(--primary-color);\n}')}};n([d({attribute:!1})],G.prototype,"hass",void 0),n([d({attribute:!1})],G.prototype,"cameraConfig",void 0),n([d({attribute:!1})],G.prototype,"cameraEndpoints",void 0),n([d({attribute:!1})],G.prototype,"liveConfig",void 0),n([d({attribute:!0,type:Boolean})],G.prototype,"load",void 0),n([d({attribute:!1})],G.prototype,"label",void 0),n([d({attribute:!1})],G.prototype,"cardWideConfig",void 0),n([d({attribute:!1})],G.prototype,"microphoneStream",void 0),n([d({attribute:!1})],G.prototype,"zoomSettings",void 0),n([g()],G.prototype,"_isVideoMediaLoaded",void 0),G=n([c("frigate-card-live-provider")],G);const W="frigate-card-live-provider";let U=class extends h{constructor(){super(...arguments),this._cameraToSlide={},this._refPTZControl=l(),this._refCarousel=l(),this._mediaActionsController=new E,this._mediaHasLoaded=!1}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._mediaActionsController.destroy(),super.disconnectedCallback()}_getTransitionEffect(){return this.overriddenLiveConfig?.transition_effect??m.live.transition_effect}_getSelectedCameraIndex(){if(this.viewFilterCameraID)return 0;const e=this.cameraManager?.getStore().getCameraIDsWithCapability("live"),i=this.viewManagerEpoch?.manager.getView();return e?.size&&i?Math.max(0,Array.from(e).indexOf(i.camera)):0}willUpdate(e){(e.has("microphoneManager")||e.has("overriddenLiveConfig"))&&this._mediaActionsController.setOptions({playerSelector:W,...this.overriddenLiveConfig?.auto_play&&{autoPlayConditions:this.overriddenLiveConfig.auto_play},...this.overriddenLiveConfig?.auto_pause&&{autoPauseConditions:this.overriddenLiveConfig.auto_pause},...this.overriddenLiveConfig?.auto_mute&&{autoMuteConditions:this.overriddenLiveConfig.auto_mute},...this.overriddenLiveConfig?.auto_unmute&&{autoUnmuteConditions:this.overriddenLiveConfig.auto_unmute},...(this.overriddenLiveConfig?.auto_unmute||this.overriddenLiveConfig?.auto_mute)&&{microphoneManager:this.microphoneManager,microphoneMuteSeconds:this.overriddenLiveConfig.microphone.mute_after_microphone_mute_seconds}})}_getPlugins(){return[N({...this.overriddenLiveConfig?.lazy_load&&{lazyLoadCallback:(e,i)=>this._lazyloadOrUnloadSlide("load",e,i)},lazyUnloadConditions:this.overriddenLiveConfig?.lazy_unload,lazyUnloadCallback:(e,i)=>this._lazyloadOrUnloadSlide("unload",e,i)}),x(),T()]}_getLazyLoadCount(){return!1===this.overriddenLiveConfig?.lazy_load?null:0}_getSlides(){if(!this.cameraManager)return[[],{}];const e=this.viewManagerEpoch?.manager.getView(),i=this.viewFilterCameraID?new Set([this.viewFilterCameraID]):this.cameraManager?.getStore().getCameraIDsWithCapability("live"),t=[],a={};for(const[r,o]of this.cameraManager.getStore().getCameraConfigEntries(i)){const i=this._getSubstreamCameraID(r,e),s=r===i?o:this.cameraManager?.getStore().getCameraConfig(i),n=s?this._renderLive(i,s):null;n&&(a[r]=t.length,t.push(n))}return[t,a]}_setViewHandler(e){const i=this.cameraManager?.getStore().getCameraIDsWithCapability("live");i?.size&&e.detail.index!==this._getSelectedCameraIndex()&&this._setViewCameraID([...i][e.detail.index])}_setViewCameraID(e){e&&this.viewManagerEpoch?.manager.setViewByParametersWithNewQuery({params:{camera:e}})}_lazyloadOrUnloadSlide(e,i,t){t instanceof HTMLSlotElement&&(t=t.assignedElements({flatten:!0})[0]);const a=t?.querySelector(W);a&&(a.load="load"===e)}_renderLive(e,i){if(!(this.overriddenLiveConfig&&this.nonOverriddenLiveConfig&&this.hass&&this.cameraManager&&this.conditionsManagerEpoch))return;let t=null;try{t=w(this.conditionsManagerEpoch.manager,{live:this.nonOverriddenLiveConfig},{configOverrides:this.overrides,stateOverrides:{camera:e},schema:b}).live}catch(e){return y(this,e)}const a=this.cameraManager.getCameraMetadata(e),r=this.viewManagerEpoch?.manager.getView();return u` +
+ this.cameraManager?.getCameraEndpoints(e)??void 0))} + .label=${a?.title??""} + .liveConfig=${t} + .hass=${this.hass} + .cardWideConfig=${this.cardWideConfig} + .zoomSettings=${r?.context?.zoom?.[e]?.requested} + @frigate-card:zoom:change=${i=>L(i,this.viewManagerEpoch?.manager,e)} + > + +
+ `}_getCameraIDsOfNeighbors(){const e=this.cameraManager?[...this.cameraManager?.getStore().getCameraIDsWithCapability("live")]:[],i=this.viewManagerEpoch?.manager.getView();if(this.viewFilterCameraID||e.length<=1||!i||!this.hass)return[null,null];const t=this.viewFilterCameraID??i.camera,a=e.indexOf(t);return a<0?[null,null]:[e[a>0?a-1:e.length-1],e[a+11,[r,o]=this._getCameraIDsOfNeighbors(),s=r?this.cameraManager.getCameraMetadata(this._getSubstreamCameraID(r,e)):null,n=o?this.cameraManager.getCameraMetadata(this._getSubstreamCameraID(o,e)):null,d=!(!this._mediaHasLoaded||this.viewFilterCameraID&&this.viewFilterCameraID!==e.camera||!1===e.context?.ptzControls?.enabled)&&e.context?.ptzControls?.enabled;return u` + {this._mediaHasLoaded=!0}} + @frigate-card:media:unloaded=${()=>{this._mediaHasLoaded=!1}} + > + {this._setViewCameraID(r),A(e)}} + > + + ${i} + {this._setViewCameraID(o),A(e)}} + > + + + + + `}_setMediaTarget(){const e=this.viewManagerEpoch?.manager.getView(),i=this._getSelectedCameraIndex();this.viewFilterCameraID?this._mediaActionsController.setTarget(i,e?.camera===this.viewFilterCameraID):this._mediaActionsController.setTarget(i,!0)}updated(e){super.updated(e);let i=!1;!this._mediaActionsController.hasRoot()&&this._refCarousel.value&&(this._mediaActionsController.initialize(this._refCarousel.value),i=!0),(i||e.has("viewManagerEpoch"))&&this._setMediaTarget()}static get styles(){return M(":host {\n display: block;\n --video-max-height: none;\n}\n\n:host(:not([grid-id])) {\n height: 100%;\n}\n\n:host([unselected]) frigate-card-carousel {\n pointer-events: none;\n}\n\n.embla__slide {\n display: flex;\n justify-content: center;\n height: 100%;\n flex: 0 0 100%;\n}")}};n([d({attribute:!1})],U.prototype,"hass",void 0),n([d({attribute:!1})],U.prototype,"viewManagerEpoch",void 0),n([d({attribute:!1})],U.prototype,"nonOverriddenLiveConfig",void 0),n([d({attribute:!1})],U.prototype,"overriddenLiveConfig",void 0),n([d({attribute:!1,hasChanged:_})],U.prototype,"overrides",void 0),n([d({attribute:!1})],U.prototype,"conditionsManagerEpoch",void 0),n([d({attribute:!1})],U.prototype,"cardWideConfig",void 0),n([d({attribute:!1})],U.prototype,"cameraManager",void 0),n([d({attribute:!1})],U.prototype,"microphoneManager",void 0),n([d({attribute:!1})],U.prototype,"viewFilterCameraID",void 0),n([g()],U.prototype,"_mediaHasLoaded",void 0),U=n([c("frigate-card-live-carousel")],U);let B=class extends h{_renderCarousel(e){const i=this.viewManagerEpoch?.manager.getView(),t=e??i?.camera;return u` + + + `}_gridSelectCamera(e){this.viewManagerEpoch?.manager.setViewByParameters({params:{camera:e}})}_needsGrid(){const e=this.cameraManager?.getStore().getCameraIDsWithCapability("live"),i=this.viewManagerEpoch?.manager.getView();return!!i?.isGrid()&&!!i?.supportsMultipleDisplayModes()&&!!e&&e.size>1}willUpdate(e){e.has("viewManagerEpoch")&&this._needsGrid()&&import("./media-grid-cff66b0b.js")}render(){if(!this.conditionsManagerEpoch||!this.nonOverriddenLiveConfig)return;const e=this.cameraManager?.getStore().getCameraIDsWithCapability("live");return e?.size&&this._needsGrid()?u` + this._gridSelectCamera(e.detail.selected)} + > + ${[...e].map((e=>this._renderCarousel(e)))} + + `:this._renderCarousel()}static get styles(){return M(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\n@keyframes warning-pulse {\n 0% {\n border: solid 2px var(--frigate-card-triggered-color-1, rgba(0, 0, 0, 0));\n }\n 50% {\n border: solid 2px var(--frigate-card-triggered-color-2, var(--warning-color));\n }\n 100% {\n border: solid 2px var(--frigate-card-triggered-color-1, rgba(0, 0, 0, 0));\n }\n}\nfrigate-card-live-carousel[triggered] {\n animation: warning-pulse 5s infinite;\n}\n\nfrigate-card-live-carousel[selected] {\n --frigate-card-triggered-color-1: var(--primary-color);\n}")}};n([d({attribute:!1})],B.prototype,"hass",void 0),n([d({attribute:!1})],B.prototype,"viewManagerEpoch",void 0),n([d({attribute:!1})],B.prototype,"nonOverriddenLiveConfig",void 0),n([d({attribute:!1})],B.prototype,"overriddenLiveConfig",void 0),n([d({attribute:!1,hasChanged:_})],B.prototype,"overrides",void 0),n([d({attribute:!1})],B.prototype,"conditionsManagerEpoch",void 0),n([d({attribute:!1})],B.prototype,"cardWideConfig",void 0),n([d({attribute:!1})],B.prototype,"cameraManager",void 0),n([d({attribute:!1})],B.prototype,"microphoneManager",void 0),n([d({attribute:!1})],B.prototype,"triggeredCameraIDs",void 0),B=n([c("frigate-card-live-grid")],B);let V=class extends h{constructor(){super(...arguments),this._controller=new O(this)}shouldUpdate(e){return this._controller.shouldUpdate()}willUpdate(){this._controller.clearMessageReceived()}render(){if(this.hass&&this.nonOverriddenLiveConfig&&this.cameraManager)return u`${Z(this._controller.getRenderEpoch(),u` + + + `)}`}static get styles(){return M(j)}};n([d({attribute:!1})],V.prototype,"conditionsManagerEpoch",void 0),n([d({attribute:!1})],V.prototype,"hass",void 0),n([d({attribute:!1})],V.prototype,"viewManagerEpoch",void 0),n([d({attribute:!1})],V.prototype,"nonOverriddenLiveConfig",void 0),n([d({attribute:!1})],V.prototype,"overriddenLiveConfig",void 0),n([d({attribute:!1,hasChanged:_})],V.prototype,"overrides",void 0),n([d({attribute:!1})],V.prototype,"cameraManager",void 0),n([d({attribute:!1})],V.prototype,"cardWideConfig",void 0),n([d({attribute:!1})],V.prototype,"microphoneManager",void 0),n([d({attribute:!1})],V.prototype,"triggeredCameraIDs",void 0),V=n([c("frigate-card-live")],V);var Y=Object.freeze({__proto__:null,get FrigateCardLive(){return V}});export{P as g,Y as i}; diff --git a/config/www/community/frigate-hass-card/index-3c9b9749.js.gz b/config/www/community/frigate-hass-card/index-3c9b9749.js.gz new file mode 100644 index 00000000..0a5cf640 Binary files /dev/null and b/config/www/community/frigate-hass-card/index-3c9b9749.js.gz differ diff --git a/config/www/community/frigate-hass-card/index-5de5f421.js b/config/www/community/frigate-hass-card/index-5de5f421.js new file mode 100644 index 00000000..be2da7a6 --- /dev/null +++ b/config/www/community/frigate-hass-card/index-5de5f421.js @@ -0,0 +1,122 @@ +import{_ as e,n as i,b as t,t as a,a as r,cM as s,di as o,dj as n,d6 as d,dk as l,dl as g,dm as h,dn as c,dp as u,dq as m,dr as v,d7 as C,cO as p,x as w,cV as I,dh as f,cQ as M,ds as y,dt as _,du as b,dv as A,r as D,cR as j,cI as k,dw as x,s as T,cW as N,cX as z,cP as $,l as L,cZ as P,c_ as E}from"./card-320adb66.js";import"./ha-hls-player-b195eaa1.js";import{p as Z,h as V,s as G,u as S,i as W,c as F,M as O,A as R,a as U,b as Y}from"./dispatch-live-error-c649b480.js";import{m as B}from"./audio-cf3a75aa.js";import{V as Q}from"./media-c9012082.js";let q=class extends r{constructor(){super(...arguments),this.load=!1,this._refFrigateCardMediaPlayer=s(),this._refVideoProvider=s(),this._refImageProvider=s(),this._url=null}async play(){await Z(this,this._refFrigateCardMediaPlayer.value??this._refVideoProvider.value)}async pause(){(this._refFrigateCardMediaPlayer.value||this._refVideoProvider.value)?.pause()}async mute(){this._refFrigateCardMediaPlayer.value?this._refFrigateCardMediaPlayer.value?.mute():this._refVideoProvider.value&&(this._refVideoProvider.value.muted=!0)}async unmute(){this._refFrigateCardMediaPlayer.value?this._refFrigateCardMediaPlayer.value?.mute():this._refVideoProvider.value&&(this._refVideoProvider.value.muted=!1)}isMuted(){return this._refFrigateCardMediaPlayer.value?this._refFrigateCardMediaPlayer.value?.isMuted()??!0:!this._refVideoProvider.value||this._refVideoProvider.value.muted}async seek(e){if(this._refFrigateCardMediaPlayer.value)return this._refFrigateCardMediaPlayer.value.seek(e);this._refVideoProvider.value&&(V(this._refVideoProvider.value),this._refVideoProvider.value.currentTime=e)}async setControls(e){if(this._refFrigateCardMediaPlayer.value)return this._refFrigateCardMediaPlayer.value.setControls(e);this._refVideoProvider.value&&G(this._refVideoProvider.value,e??this.viewerConfig?.controls.builtin??!0)}isPaused(){return this._refFrigateCardMediaPlayer.value?this._refFrigateCardMediaPlayer.value.isPaused():!this._refVideoProvider.value||this._refVideoProvider.value.paused}async getScreenshotURL(){return this._refFrigateCardMediaPlayer.value?await this._refFrigateCardMediaPlayer.value.getScreenshotURL():this._refVideoProvider.value?o(this._refVideoProvider.value):this._refImageProvider.value?this._refImageProvider.value.src:null}async _switchToRelatedClipView(){const e=this.viewManagerEpoch?.manager.getView();if(!(this.hass&&e&&this.cameraManager&&this.media&&n.isEvent(this.media)&&d.areEventQueries(e.query)))return;const i=e.query.clone();i.convertToClipsQueries();i.getQueries()&&await(this.viewManagerEpoch?.manager.setViewByParametersWithExistingQuery({params:{view:"media",query:i},queryExecutorOptions:{selectResult:{id:this.media.getID()??void 0},rejectResults:e=>!e.hasSelectedResult()}}))}async _setURL(){const e=this.media?.getContentID();if(!this.media||!e||!this.hass||this.viewerConfig?.lazy_load&&!this.load)return;let i=this.resolvedMediaCache?.get(e)??null;if(i||(i=await l(this.hass,e,this.resolvedMediaCache)),!i)return;const t=i.url;if(g(t))return void(this._url=h(this.hass,t));const a=this.cameraManager?.getStore().getCamera(this.media.getCameraID()),r=a?.getProxyConfig();if(r&&c(this.hass,r,"media")){if(r.dynamic){const e=t.split(/#/)[0];await u(this.hass,e,{sslVerification:r.ssl_verification,sslCiphers:r.ssl_ciphers,openLimit:0})}try{this._url=await m(this.hass,v(t))}catch(e){C(e)}}else this._url=t}willUpdate(e){if((e.has("load")||e.has("media")||e.has("viewerConfig")||e.has("resolvedMediaCache")||e.has("hass"))&&this._setURL().then((()=>{this.requestUpdate()})),e.has("viewerConfig")&&this.viewerConfig?.zoomable&&import("./zoomer-85596cd4.js"),e.has("media")||e.has("cameraManager")){const e=this.media?.getCameraID(),i=e?this.cameraManager?.getStore().getCameraConfig(e):null;S(this,i?.dimensions?.layout),this.style.aspectRatio=p({ratio:i?.dimensions?.aspect_ratio})}}_useZoomIfRequired(e){if(!this.media)return e;const i=this.media.getCameraID(),t=this.media.getID()??void 0,a=this.cameraManager?.getStore().getCameraConfig(i),r=this.viewManagerEpoch?.manager.getView();return this.viewerConfig?.zoomable?w` a?.dimensions?.layout?{pan:a.dimensions.layout.pan,zoom:a.dimensions.layout.zoom}:void 0))} + .settings=${t?r?.context?.zoom?.[t]?.requested:void 0} + @frigate-card:zoom:zoomed=${()=>this.setControls(!1)} + @frigate-card:zoom:unzoomed=${()=>this.setControls()} + @frigate-card:zoom:change=${e=>I(e,this.viewManagerEpoch?.manager,t)} + > + ${e} + `:e}render(){if(this.load&&this.media&&this.hass&&this.viewerConfig)return this._url?this._useZoomIfRequired(w` + ${n.isVideo(this.media)?this.media.getVideoContentType()===Q.HLS?w` + `:w` + + `:w`{this.viewerConfig?.snapshot_click_plays_clip&&this._switchToRelatedClipView()}} + @load=${e=>{y(this,e,{player:this,technology:["jpg"]})}} + />`} + `):f({cardWideConfig:this.cardWideConfig})}static get styles(){return D(':host {\n background-color: var(--primary-background-color);\n background-position: center;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJjYW1lcmEtaXJpcy5zdmciCiAgIGlkPSJzdmc0IgogICB2ZXJzaW9uPSIxLjEiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjYjkzZTNlIgogICAgIGJvcmRlcmNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcm9wYWNpdHk9IjAuMjUiCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuNjA3ODQzMTQiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyNi42MjUwNiIKICAgICBpbmtzY2FwZTpjeD0iLTEuOTM0MjY4IgogICAgIGlua3NjYXBlOmN5PSIxNS42ODA3MTYiCiAgICAgaW5rc2NhcGU6d2luZG93LXdpZHRoPSIzODQwIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjE1MjciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEwODAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjIyNyIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiIC8+CiAgPGcKICAgICBpZD0iZzExMTkiCiAgICAgc3R5bGU9ImZpbGwtb3BhY2l0eTowLjA1O2ZpbGw6I2ZmZmZmZiI+CiAgICA8Y2lyY2xlCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eTowLjA1O3N0cm9rZS13aWR0aDoxLjM5NzI5IgogICAgICAgaWQ9InBhdGgxNzAiCiAgICAgICBjeD0iMTIiCiAgICAgICBjeT0iMTIiCiAgICAgICBpbmtzY2FwZTpsYWJlbD0iV2hpdGUgQmFja2dyb3VuZCIKICAgICAgIHI9IjExLjI1IiAvPgogICAgPHBhdGgKICAgICAgIGQ9Ik0gMTMuNzMwMDAxLDE1IDkuODMwMDAwMywyMS43NiBDIDEwLjUzLDIxLjkxIDExLjI1LDIyIDEyLDIyIGMgMi40MDAwMDEsMCA0LjYsLTAuODUgNi4zMiwtMi4yNSBMIDE0LjY2MDAwMSwxMy40IE0gMi40NjAwMDAzLDE1IGMgMC45MiwyLjkyIDMuMTUsNS4yNiA1Ljk5LDYuMzQgTCAxMi4xMiwxNSBtIC0zLjU3OTk5OTcsLTMgLTMuOSwtNi43NDk5OTk2IGMgLTEuNjQsMS43NDk5OTkgLTIuNjQsNC4xMzk5OTkzIC0yLjY0LDYuNzQ5OTk5NiAwLDAuNjggMC4wNywxLjM1IDAuMiwyIGggNy40OSBNIDIxLjgsOS45OTk5OTk3IEggMTQuMzEwMDAxIEwgMTQuNjAwMDAxLDEwLjUgMTkuMzYsMTguNzUgQyAyMSwxNi45NyAyMiwxNC42IDIyLDEyIDIyLDExLjMxIDIxLjkzLDEwLjY0IDIxLjgsOS45OTk5OTk3IG0gLTAuMjYsLTEgQyAyMC42Miw2LjA3MDAwMDUgMTguMzksMy43NDAwMDAyIDE1LjU1MDAwMSwyLjY2MDAwMDIgTCAxMS44OCw4Ljk5OTk5OTcgTSA5LjQwMDAwMDMsMTAuNSAxNC4xNzAwMDEsMi4yNDAwMDAyIGMgLTAuNywtMC4xNSAtMS40MjAwMDEsLTAuMjQgLTIuMTcwMDAxLC0wLjI0IC0yLjM5OTk5OTcsMCAtNC41OTk5OTk3LDAuODQgLTYuMzE5OTk5NywyLjI1MDAwMDMgbCAzLjY2LDYuMzQ5OTk5NSB6IgogICAgICAgaWQ9InBhdGgyIgogICAgICAgaW5rc2NhcGU6bGFiZWw9IklyaXMiCiAgICAgICBzdHlsZT0iZmlsbC1vcGFjaXR5OjAuMDU7ZmlsbDojZmZmZmZmIiAvPgogIDwvZz4KPC9zdmc+Cg==");\n background-size: 10%;\n background-position: center;\n}\n\n:host {\n display: block;\n width: 100%;\n height: 100%;\n}\n\nimg,\nvideo,\nfrigate-card-ha-hls-player {\n display: block;\n width: 100%;\n height: 100%;\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}\n\nfrigate-card-progress-indicator {\n padding: 30px;\n box-sizing: border-box;\n}')}};e([i({attribute:!1})],q.prototype,"hass",void 0),e([i({attribute:!1})],q.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],q.prototype,"media",void 0),e([i({attribute:!1})],q.prototype,"viewerConfig",void 0),e([i({attribute:!1})],q.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],q.prototype,"load",void 0),e([i({attribute:!1})],q.prototype,"cameraManager",void 0),e([i({attribute:!1})],q.prototype,"cardWideConfig",void 0),e([t()],q.prototype,"_url",void 0),q=e([a("frigate-card-viewer-provider")],q);let H=class extends r{constructor(){super(...arguments),this.showControls=!0,this._selected=0,this._media=null,this._mediaActionsController=new O,this._player=null,this._refCarousel=s()}updated(e){super.updated(e),e.has("viewManagerEpoch")&&this.viewManagerEpoch?.manager.getView()?.context?.mediaViewer!==this.viewManagerEpoch?.oldView?.context?.mediaViewer&&this._seekHandler(),!this._mediaActionsController.hasRoot()&&this._refCarousel.value&&this._mediaActionsController.initialize(this._refCarousel.value)}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._mediaActionsController.destroy(),super.disconnectedCallback()}_getTransitionEffect(){return this.viewerConfig?.transition_effect??k.media_viewer.transition_effect}_getPlugins(){return[R({...this.viewerConfig?.lazy_load&&{lazyLoadCallback:(e,i)=>this._lazyloadSlide(i)}}),U(),Y()]}_getMediaNeighbors(){const e=this._media?.length??0;if(!this._media)return null;const i=this._selected>0?this._selected-1:null,t=this._selected+1{if(!i||!this._media)return;const t=("previous"===e?i.previous?.index:i.next?.index)??null;null!==t&&this._setViewSelectedIndex(t)},a=N(this),r="ltr"===a&&"left"===e||"rtl"===a&&"right"===e?"previous":"next";return w` {t(r),z(e)}} + >`}render(){const e=this._media?.length??0;if(!this._media||!e)return $({message:L("common.no_media"),type:"info",icon:"mdi:multimedia",...this.viewFilterCameraID&&{context:{camera_id:this.viewFilterCameraID}}});const i=this._media[this._selected]??this._media[e-1];if(!this.hass||!this.cameraManager||!i)return;const t=this._getMediaNeighbors(),a=this.viewManagerEpoch?.manager.getView();return w` + {this._setViewSelectedIndex(e.detail.index)}} + @frigate-card:media:loaded=${e=>{this._player=e.detail.player??null,this._seekHandler()}} + @frigate-card:media:unloaded=${()=>{this._player=null}} + > + ${this.showControls?this._renderNextPrevious("left",t):""} + ${W([this._media,a],(()=>this._getSlides()))} + ${this.showControls?this._renderNextPrevious("right",t):""} + + ${a?w` + `:""} +
+ + +
+ `}async _seekHandler(){const e=this.viewManagerEpoch?.manager.getView(),i=e?.context?.mediaViewer?.seek;if(!(this.hass&&i&&this._media&&this._player))return;const t=this._media[this._selected];if(!t)return;const a=t.includesTime(i);T(this,!a,"unseekable"),a||this._player.isPaused()?a&&this._player.isPaused()&&this._player.play():this._player.pause();const r=await(this.cameraManager?.getMediaSeekTime(t,i))??null;null!==r&&this._player.seek(r)}_renderMediaItem(e){const i=this.viewManagerEpoch?.manager.getView();return this.hass&&i&&this.viewerConfig?w`
+ +
`:null}static get styles(){return D(":host {\n position: relative;\n --video-max-height: none;\n}\n\n:host([unselected]) frigate-card-carousel,\n:host([unselected]) .seek-warning {\n pointer-events: none;\n}\n\n:host([unseekable]) frigate-card-carousel {\n filter: brightness(50%);\n}\n\n:host([unseekable]) .seek-warning {\n display: block;\n}\n\n.seek-warning {\n display: none;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translateX(-50%) translateY(-50%);\n color: white;\n}\n\n.embla__slide {\n height: 100%;\n flex: 0 0 100%;\n}")}};e([i({attribute:!1})],H.prototype,"hass",void 0),e([i({attribute:!1})],H.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],H.prototype,"viewFilterCameraID",void 0),e([i({attribute:!1,hasChanged:j})],H.prototype,"viewerConfig",void 0),e([i({attribute:!1})],H.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],H.prototype,"cardWideConfig",void 0),e([i({attribute:!1})],H.prototype,"cameraManager",void 0),e([i({attribute:!1})],H.prototype,"showControls",void 0),e([t()],H.prototype,"_selected",void 0),H=e([a("frigate-card-viewer-carousel")],H);let X=class extends r{_renderCarousel(e){const i=this.viewManagerEpoch?.manager.getView()?.camera;return w` + + + `}willUpdate(e){e.has("viewManagerEpoch")&&this._needsGrid()&&import("./media-grid-adc03f7c.js")}_needsGrid(){const e=this.viewManagerEpoch?.manager.getView(),i=e?.queryResults?.getCameraIDs();return!!e?.isGrid()&&!!e?.supportsMultipleDisplayModes()&&(i?.size??0)>1}_gridSelectCamera(e){const i=this.viewManagerEpoch?.manager.getView();this.viewManagerEpoch?.manager.setViewByParameters({params:{camera:e,queryResults:i?.queryResults?.clone().promoteCameraSelectionToMainSelection(e)}})}render(){const e=this.viewManagerEpoch?.manager.getView(),i=e?.queryResults?.getCameraIDs();return i&&this._needsGrid()?w` + this._gridSelectCamera(e.detail.selected)} + > + ${[...i].map((e=>this._renderCarousel(e)))} + + `:this._renderCarousel()}static get styles(){return D(E)}};e([i({attribute:!1})],X.prototype,"hass",void 0),e([i({attribute:!1})],X.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],X.prototype,"viewerConfig",void 0),e([i({attribute:!1})],X.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],X.prototype,"cardWideConfig",void 0),e([i({attribute:!1})],X.prototype,"cameraManager",void 0),X=e([a("frigate-card-viewer-grid")],X);let J=class extends r{render(){if(this.hass&&this.viewManagerEpoch&&this.viewerConfig&&this.cameraManager&&this.cardWideConfig){if(!this.viewManagerEpoch.manager.getView()?.queryResults?.hasResults()){const e=!!this.viewManagerEpoch.manager.getView()?.context?.loading?.query;return $({type:"info",message:L(e?"error.awaiting_media":"common.no_media"),icon:"mdi:multimedia",dotdotdot:e})}return w` + `}}static get styles(){return D(":host {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n gap: 5px;\n}\n\nfrigate-card-viewer-carousel {\n flex: 1;\n min-height: 0;\n}")}};e([i({attribute:!1})],J.prototype,"hass",void 0),e([i({attribute:!1})],J.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],J.prototype,"viewerConfig",void 0),e([i({attribute:!1})],J.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],J.prototype,"cameraManager",void 0),e([i({attribute:!1})],J.prototype,"cardWideConfig",void 0),J=e([a("frigate-card-viewer")],J);export{J as FrigateCardViewer}; diff --git a/config/www/community/frigate-hass-card/index-5de5f421.js.gz b/config/www/community/frigate-hass-card/index-5de5f421.js.gz new file mode 100644 index 00000000..db72ad0b Binary files /dev/null and b/config/www/community/frigate-hass-card/index-5de5f421.js.gz differ diff --git a/config/www/community/frigate-hass-card/index-76cab2a3.js b/config/www/community/frigate-hass-card/index-76cab2a3.js new file mode 100644 index 00000000..3b9fe425 --- /dev/null +++ b/config/www/community/frigate-hass-card/index-76cab2a3.js @@ -0,0 +1,131 @@ +import{_ as e,n as i,b as t,t as a,a as r,cR as s,dm as o,dn as n,da as d,dp as l,dq as g,dr as h,ds as c,dt as u,du as m,dv as v,db as p,cT as C,x as w,c_ as f,dl as I,cV as M,dw as y,dx as _,dy as b,dz as A,r as D,cW as x,cI as k,dA as j,s as $,dB as T,l as z,c$ as N,d1 as L,d2 as E,cU as P}from"./card-09c4bade.js";import"./ha-hls-player-ba5834a9.js";import{p as Z,h as V,s as G,u as S,i as W,c as F,M as O,A as R,a as U,b as Y}from"./media-aef44451.js";import{m as B}from"./audio-cf3a75aa.js";import{V as Q}from"./media-c9012082.js";let q=class extends r{constructor(){super(...arguments),this.load=!1,this._refFrigateCardMediaPlayer=s(),this._refVideoProvider=s(),this._refImageProvider=s(),this._url=null}async play(){await Z(this,this._refFrigateCardMediaPlayer.value??this._refVideoProvider.value)}async pause(){(this._refFrigateCardMediaPlayer.value||this._refVideoProvider.value)?.pause()}async mute(){this._refFrigateCardMediaPlayer.value?this._refFrigateCardMediaPlayer.value?.mute():this._refVideoProvider.value&&(this._refVideoProvider.value.muted=!0)}async unmute(){this._refFrigateCardMediaPlayer.value?this._refFrigateCardMediaPlayer.value?.mute():this._refVideoProvider.value&&(this._refVideoProvider.value.muted=!1)}isMuted(){return this._refFrigateCardMediaPlayer.value?this._refFrigateCardMediaPlayer.value?.isMuted()??!0:!this._refVideoProvider.value||this._refVideoProvider.value.muted}async seek(e){if(this._refFrigateCardMediaPlayer.value)return this._refFrigateCardMediaPlayer.value.seek(e);this._refVideoProvider.value&&(V(this._refVideoProvider.value),this._refVideoProvider.value.currentTime=e)}async setControls(e){if(this._refFrigateCardMediaPlayer.value)return this._refFrigateCardMediaPlayer.value.setControls(e);this._refVideoProvider.value&&G(this._refVideoProvider.value,e??this.viewerConfig?.controls.builtin??!0)}isPaused(){return this._refFrigateCardMediaPlayer.value?this._refFrigateCardMediaPlayer.value.isPaused():!this._refVideoProvider.value||this._refVideoProvider.value.paused}async getScreenshotURL(){return this._refFrigateCardMediaPlayer.value?await this._refFrigateCardMediaPlayer.value.getScreenshotURL():this._refVideoProvider.value?o(this._refVideoProvider.value):this._refImageProvider.value?this._refImageProvider.value.src:null}async _switchToRelatedClipView(){const e=this.viewManagerEpoch?.manager.getView();if(!(this.hass&&e&&this.cameraManager&&this.media&&n.isEvent(this.media)&&d.areEventQueries(e.query)))return;const i=e.query.clone();i.convertToClipsQueries();i.getQueries()&&await(this.viewManagerEpoch?.manager.setViewByParametersWithExistingQuery({params:{view:"media",query:i},queryExecutorOptions:{selectResult:{id:this.media.getID()??void 0},rejectResults:e=>!e.hasSelectedResult()}}))}async _setURL(){const e=this.media?.getContentID();if(!this.media||!e||!this.hass||this.viewerConfig?.lazy_load&&!this.load)return;let i=this.resolvedMediaCache?.get(e)??null;if(i||(i=await l(this.hass,e,this.resolvedMediaCache)),!i)return;const t=i.url;if(g(t))return void(this._url=h(this.hass,t));const a=this.cameraManager?.getStore().getCamera(this.media.getCameraID()),r=a?.getProxyConfig();if(r&&c(this.hass,r,"media")){if(r.dynamic){const e=t.split(/#/)[0];await u(this.hass,e,{sslVerification:r.ssl_verification,sslCiphers:r.ssl_ciphers,openLimit:0})}try{this._url=await m(this.hass,v(t))}catch(e){p(e)}}else this._url=t}willUpdate(e){if((e.has("load")||e.has("media")||e.has("viewerConfig")||e.has("resolvedMediaCache")||e.has("hass"))&&this._setURL().then((()=>{this.requestUpdate()})),e.has("viewerConfig")&&this.viewerConfig?.zoomable&&import("./zoomer-37e20bdd.js"),e.has("media")||e.has("cameraManager")){const e=this.media?.getCameraID(),i=e?this.cameraManager?.getStore().getCameraConfig(e):null;S(this,i?.dimensions?.layout),this.style.aspectRatio=C({ratio:i?.dimensions?.aspect_ratio})}}_useZoomIfRequired(e){if(!this.media)return e;const i=this.media.getCameraID(),t=this.media.getID()??void 0,a=this.cameraManager?.getStore().getCameraConfig(i),r=this.viewManagerEpoch?.manager.getView();return this.viewerConfig?.zoomable?w` a?.dimensions?.layout?{pan:a.dimensions.layout.pan,zoom:a.dimensions.layout.zoom}:void 0))} + .settings=${t?r?.context?.zoom?.[t]?.requested:void 0} + @frigate-card:zoom:zoomed=${()=>this.setControls(!1)} + @frigate-card:zoom:unzoomed=${()=>this.setControls()} + @frigate-card:zoom:change=${e=>f(e,this.viewManagerEpoch?.manager,t)} + > + ${e} + `:e}render(){if(this.load&&this.media&&this.hass&&this.viewerConfig)return this._url?this._useZoomIfRequired(w` + ${n.isVideo(this.media)?this.media.getVideoContentType()===Q.HLS?w` + `:w` + + `:w`{this.viewerConfig?.snapshot_click_plays_clip&&this._switchToRelatedClipView()}} + @load=${e=>{y(this,e,{player:this,technology:["jpg"]})}} + />`} + `):I({cardWideConfig:this.cardWideConfig})}static get styles(){return D(':host {\n background-color: var(--primary-background-color);\n background-position: center;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJjYW1lcmEtaXJpcy5zdmciCiAgIGlkPSJzdmc0IgogICB2ZXJzaW9uPSIxLjEiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjYjkzZTNlIgogICAgIGJvcmRlcmNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcm9wYWNpdHk9IjAuMjUiCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuNjA3ODQzMTQiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyNi42MjUwNiIKICAgICBpbmtzY2FwZTpjeD0iLTEuOTM0MjY4IgogICAgIGlua3NjYXBlOmN5PSIxNS42ODA3MTYiCiAgICAgaW5rc2NhcGU6d2luZG93LXdpZHRoPSIzODQwIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjE1MjciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEwODAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjIyNyIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiIC8+CiAgPGcKICAgICBpZD0iZzExMTkiCiAgICAgc3R5bGU9ImZpbGwtb3BhY2l0eTowLjA1O2ZpbGw6I2ZmZmZmZiI+CiAgICA8Y2lyY2xlCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eTowLjA1O3N0cm9rZS13aWR0aDoxLjM5NzI5IgogICAgICAgaWQ9InBhdGgxNzAiCiAgICAgICBjeD0iMTIiCiAgICAgICBjeT0iMTIiCiAgICAgICBpbmtzY2FwZTpsYWJlbD0iV2hpdGUgQmFja2dyb3VuZCIKICAgICAgIHI9IjExLjI1IiAvPgogICAgPHBhdGgKICAgICAgIGQ9Ik0gMTMuNzMwMDAxLDE1IDkuODMwMDAwMywyMS43NiBDIDEwLjUzLDIxLjkxIDExLjI1LDIyIDEyLDIyIGMgMi40MDAwMDEsMCA0LjYsLTAuODUgNi4zMiwtMi4yNSBMIDE0LjY2MDAwMSwxMy40IE0gMi40NjAwMDAzLDE1IGMgMC45MiwyLjkyIDMuMTUsNS4yNiA1Ljk5LDYuMzQgTCAxMi4xMiwxNSBtIC0zLjU3OTk5OTcsLTMgLTMuOSwtNi43NDk5OTk2IGMgLTEuNjQsMS43NDk5OTkgLTIuNjQsNC4xMzk5OTkzIC0yLjY0LDYuNzQ5OTk5NiAwLDAuNjggMC4wNywxLjM1IDAuMiwyIGggNy40OSBNIDIxLjgsOS45OTk5OTk3IEggMTQuMzEwMDAxIEwgMTQuNjAwMDAxLDEwLjUgMTkuMzYsMTguNzUgQyAyMSwxNi45NyAyMiwxNC42IDIyLDEyIDIyLDExLjMxIDIxLjkzLDEwLjY0IDIxLjgsOS45OTk5OTk3IG0gLTAuMjYsLTEgQyAyMC42Miw2LjA3MDAwMDUgMTguMzksMy43NDAwMDAyIDE1LjU1MDAwMSwyLjY2MDAwMDIgTCAxMS44OCw4Ljk5OTk5OTcgTSA5LjQwMDAwMDMsMTAuNSAxNC4xNzAwMDEsMi4yNDAwMDAyIGMgLTAuNywtMC4xNSAtMS40MjAwMDEsLTAuMjQgLTIuMTcwMDAxLC0wLjI0IC0yLjM5OTk5OTcsMCAtNC41OTk5OTk3LDAuODQgLTYuMzE5OTk5NywyLjI1MDAwMDMgbCAzLjY2LDYuMzQ5OTk5NSB6IgogICAgICAgaWQ9InBhdGgyIgogICAgICAgaW5rc2NhcGU6bGFiZWw9IklyaXMiCiAgICAgICBzdHlsZT0iZmlsbC1vcGFjaXR5OjAuMDU7ZmlsbDojZmZmZmZmIiAvPgogIDwvZz4KPC9zdmc+Cg==");\n background-size: 10%;\n background-position: center;\n}\n\n:host {\n display: block;\n width: 100%;\n height: 100%;\n}\n\nimg,\nvideo,\nfrigate-card-ha-hls-player {\n display: block;\n width: 100%;\n height: 100%;\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}\n\nfrigate-card-progress-indicator {\n padding: 30px;\n box-sizing: border-box;\n}')}};e([i({attribute:!1})],q.prototype,"hass",void 0),e([i({attribute:!1})],q.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],q.prototype,"media",void 0),e([i({attribute:!1})],q.prototype,"viewerConfig",void 0),e([i({attribute:!1})],q.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],q.prototype,"load",void 0),e([i({attribute:!1})],q.prototype,"cameraManager",void 0),e([i({attribute:!1})],q.prototype,"cardWideConfig",void 0),e([t()],q.prototype,"_url",void 0),q=e([a("frigate-card-viewer-provider")],q);let H=class extends r{constructor(){super(...arguments),this.showControls=!0,this._selected=0,this._media=null,this._mediaActionsController=new O,this._player=null,this._refCarousel=s()}updated(e){super.updated(e),e.has("viewManagerEpoch")&&this.viewManagerEpoch?.manager.getView()?.context?.mediaViewer!==this.viewManagerEpoch?.oldView?.context?.mediaViewer&&this._seekHandler(),!this._mediaActionsController.hasRoot()&&this._refCarousel.value&&this._mediaActionsController.initialize(this._refCarousel.value)}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._mediaActionsController.destroy(),super.disconnectedCallback()}_getTransitionEffect(){return this.viewerConfig?.transition_effect??k.media_viewer.transition_effect}_getPlugins(){return[R({...this.viewerConfig?.lazy_load&&{lazyLoadCallback:(e,i)=>this._lazyloadSlide(i)}}),U(),Y()]}_getMediaNeighbors(){const e=this._media?.length??0;if(!this._media)return null;const i=this._selected>0?this._selected-1:null,t=this._selected+1{if(!t||!this._media)return;const i=("previous"===e?t.previous?.index:t.next?.index)??null;null!==i&&this._setViewSelectedIndex(i)},r=this.viewManagerEpoch?.manager.getView();return w` + {this._setViewSelectedIndex(e.detail.index)}} + @frigate-card:media:loaded=${e=>{this._player=e.detail.player??null,this._seekHandler()}} + @frigate-card:media:unloaded=${()=>{this._player=null}} + > + ${this.showControls?w` {a("previous"),N(e)}} + >`:""} + ${W([this._media,r],(()=>this._getSlides()))} + ${this.showControls?w` {a("next"),N(e)}} + >`:""} + + ${r?w` + `:""} +
+ + +
+ `}async _seekHandler(){const e=this.viewManagerEpoch?.manager.getView(),i=e?.context?.mediaViewer?.seek;if(!(this.hass&&i&&this._media&&this._player))return;const t=this._media[this._selected];if(!t)return;const a=t.includesTime(i);$(this,!a,"unseekable"),a||this._player.isPaused()?a&&this._player.isPaused()&&this._player.play():this._player.pause();const r=await(this.cameraManager?.getMediaSeekTime(t,i))??null;null!==r&&this._player.seek(r)}_renderMediaItem(e){const i=this.viewManagerEpoch?.manager.getView();return this.hass&&i&&this.viewerConfig?w`
+ +
`:null}static get styles(){return D(":host {\n position: relative;\n --video-max-height: none;\n}\n\n:host([unselected]) frigate-card-carousel,\n:host([unselected]) .seek-warning {\n pointer-events: none;\n}\n\n:host([unseekable]) frigate-card-carousel {\n filter: brightness(50%);\n}\n\n:host([unseekable]) .seek-warning {\n display: block;\n}\n\n.seek-warning {\n display: none;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translateX(-50%) translateY(-50%);\n color: white;\n}\n\n.embla__slide {\n height: 100%;\n flex: 0 0 100%;\n}")}};e([i({attribute:!1})],H.prototype,"hass",void 0),e([i({attribute:!1})],H.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],H.prototype,"viewFilterCameraID",void 0),e([i({attribute:!1,hasChanged:x})],H.prototype,"viewerConfig",void 0),e([i({attribute:!1})],H.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],H.prototype,"cardWideConfig",void 0),e([i({attribute:!1})],H.prototype,"cameraManager",void 0),e([i({attribute:!1})],H.prototype,"showControls",void 0),e([t()],H.prototype,"_selected",void 0),H=e([a("frigate-card-viewer-carousel")],H);let X=class extends r{_renderCarousel(e){const i=this.viewManagerEpoch?.manager.getView()?.camera;return w` + + + `}willUpdate(e){e.has("viewManagerEpoch")&&this._needsGrid()&&import("./media-grid-ef47501a.js")}_needsGrid(){const e=this.viewManagerEpoch?.manager.getView(),i=e?.queryResults?.getCameraIDs();return!!e?.isGrid()&&!!e?.supportsMultipleDisplayModes()&&(i?.size??0)>1}_gridSelectCamera(e){const i=this.viewManagerEpoch?.manager.getView();this.viewManagerEpoch?.manager.setViewByParameters({params:{camera:e,queryResults:i?.queryResults?.clone().promoteCameraSelectionToMainSelection(e)}})}render(){const e=this.viewManagerEpoch?.manager.getView(),i=e?.queryResults?.getCameraIDs();return i&&this._needsGrid()?w` + this._gridSelectCamera(e.detail.selected)} + > + ${[...i].map((e=>this._renderCarousel(e)))} + + `:this._renderCarousel()}static get styles(){return D(E)}};e([i({attribute:!1})],X.prototype,"hass",void 0),e([i({attribute:!1})],X.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],X.prototype,"viewerConfig",void 0),e([i({attribute:!1})],X.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],X.prototype,"cardWideConfig",void 0),e([i({attribute:!1})],X.prototype,"cameraManager",void 0),X=e([a("frigate-card-viewer-grid")],X);let J=class extends r{render(){if(this.hass&&this.viewManagerEpoch&&this.viewerConfig&&this.cameraManager&&this.cardWideConfig){if(!this.viewManagerEpoch.manager.getView()?.queryResults?.hasResults()){const e=!!this.viewManagerEpoch.manager.getView()?.context?.loading?.query;return P({type:"info",message:z(e?"error.awaiting_media":"common.no_media"),icon:"mdi:multimedia",dotdotdot:e})}return w` + `}}static get styles(){return D(":host {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n gap: 5px;\n}\n\nfrigate-card-viewer-carousel {\n flex: 1;\n min-height: 0;\n}")}};e([i({attribute:!1})],J.prototype,"hass",void 0),e([i({attribute:!1})],J.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],J.prototype,"viewerConfig",void 0),e([i({attribute:!1})],J.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],J.prototype,"cameraManager",void 0),e([i({attribute:!1})],J.prototype,"cardWideConfig",void 0),J=e([a("frigate-card-viewer")],J);export{J as FrigateCardViewer}; diff --git a/config/www/community/frigate-hass-card/index-76cab2a3.js.gz b/config/www/community/frigate-hass-card/index-76cab2a3.js.gz new file mode 100644 index 00000000..3c653503 Binary files /dev/null and b/config/www/community/frigate-hass-card/index-76cab2a3.js.gz differ diff --git a/config/www/community/frigate-hass-card/index-78f3984a.js b/config/www/community/frigate-hass-card/index-78f3984a.js new file mode 100644 index 00000000..f10f6e67 --- /dev/null +++ b/config/www/community/frigate-hass-card/index-78f3984a.js @@ -0,0 +1 @@ +import{dw as e,dx as t,dy as i,dz as s,a as n,dm as o,cQ as a,l as c,x as r,r as d,_ as h,n as l,t as p}from"./card-7cd05290.js";import{g as u}from"./endpoint-760ea36f.js";import{s as m,h as v,c as y}from"./media-67c578aa.js";import"./image-5371a090.js";import{m as g}from"./audio-cf3a75aa.js";import{g as f}from"./get-technology-for-video-rtc-778a0c05.js";class b extends HTMLElement{constructor(){super(),this.DISCONNECT_TIMEOUT=5e3,this.RECONNECT_TIMEOUT=15e3,this.CODECS=["avc1.640029","avc1.64002A","avc1.640033","hvc1.1.6.L153.B0","mp4a.40.2","mp4a.40.5","flac","opus"],this.mode="webrtc,mse,hls,mjpeg",this.media="video,audio",this.background=!1,this.visibilityThreshold=0,this.visibilityCheck=!0,this.pcConfig={bundlePolicy:"max-bundle",iceServers:[{urls:"stun:stun.l.google.com:19302"}],sdpSemantics:"unified-plan"},this.wsState=WebSocket.CLOSED,this.pcState=WebSocket.CLOSED,this.video=null,this.ws=null,this.wsURL="",this.pc=null,this.connectTS=0,this.mseCodecs="",this.disconnectTID=0,this.reconnectTID=0,this.ondata=null,this.onmessage=null,this.microphoneStream=null,this.containingPlayer=null,this.controls=!0}reconnect(){this.wsState!==WebSocket.CLOSED?(this.ws?.addEventListener("close",(()=>this.onconnect())),this.ondisconnect()):(this.ondisconnect(),this.onconnect())}set src(e){"string"!=typeof e&&(e=e.toString()),e.startsWith("http")?e="ws"+e.substring(4):e.startsWith("/")&&(e="ws"+location.origin.substring(4)+e),this.wsURL=e,this.onconnect()}play(){}send(e){this.ws&&this.ws.send(JSON.stringify(e))}codecs(e){return this.CODECS.filter((e=>this.media.indexOf(e.indexOf("vc1")>0?"video":"audio")>=0)).filter((t=>e(`video/mp4; codecs="${t}"`))).join()}connectedCallback(){if(this.disconnectTID&&(clearTimeout(this.disconnectTID),this.disconnectTID=0),this.video){const e=this.video.seekable;e.length>0&&(this.video.currentTime=e.end(e.length-1)),this.play()}else this.oninit();this.onconnect()}disconnectedCallback(){this.background||this.disconnectTID||this.wsState===WebSocket.CLOSED&&this.pcState===WebSocket.CLOSED||(this.disconnectTID=setTimeout((()=>{this.reconnectTID&&(clearTimeout(this.reconnectTID),this.reconnectTID=0),this.disconnectTID=0,this.ondisconnect()}),this.DISCONNECT_TIMEOUT))}oninit(){this.video=document.createElement("video"),m(this.video,this.controls),this.video.playsInline=!0,this.video.preload="auto",this.video.style.display="block",this.video.style.width="100%",this.video.style.height="100%",this.appendChild(this.video),this.video.addEventListener("error",(e=>{this.ws&&this.wsState===WebSocket.OPEN&&this.ws.close()}));const n=window.navigator.userAgent.match(/Version\/(\d+).+Safari/);if(n){const e=n[1]<"13"?"mp4a.40.2":n[1]<"14"?"flac":"opus";this.CODECS.splice(this.CODECS.indexOf(e))}if(!this.background){if("hidden"in document&&this.visibilityCheck&&document.addEventListener("visibilitychange",(()=>{document.hidden?this.disconnectedCallback():this.isConnected&&this.connectedCallback()})),"IntersectionObserver"in window&&this.visibilityThreshold){new IntersectionObserver((e=>{e.forEach((e=>{e.isIntersecting?this.isConnected&&this.connectedCallback():this.disconnectedCallback()}))}),{threshold:this.visibilityThreshold}).observe(this)}this.video.onloadeddata=()=>{this.controls&&v(this.video,y),e(this,this.video,{player:this.containingPlayer,capabilities:{supports2WayAudio:!!this.pc,supportsPause:!0,hasAudio:g(this.video)},technology:f(this)})},this.video.onvolumechange=()=>t(this),this.video.onplay=()=>i(this),this.video.onpause=()=>s(this),this.video.muted=!0}}onconnect(){return!(!this.isConnected||!this.wsURL||this.ws||this.pc)&&(this.wsState=WebSocket.CONNECTING,this.connectTS=Date.now(),this.ws=new WebSocket(this.wsURL),this.ws.binaryType="arraybuffer",this.ws.addEventListener("open",(e=>this.onopen(e))),this.ws.addEventListener("close",(e=>this.onclose(e))),!0)}ondisconnect(){this.wsState=WebSocket.CLOSED,this.ws&&(this.ws.close(),this.ws=null),this.pcState=WebSocket.CLOSED,this.pc&&(this.pc.getSenders().forEach((e=>{e.track&&e.track.stop()})),this.pc.close(),this.pc=null),this.video.src="",this.video.srcObject=null}onopen(){this.wsState=WebSocket.OPEN,this.ws.addEventListener("message",(e=>{if("string"==typeof e.data){const t=JSON.parse(e.data);for(const e in this.onmessage)this.onmessage[e](t)}else this.ondata(e.data)})),this.ondata=null,this.onmessage={};const e=[];return this.mode.indexOf("mse")>=0&&("MediaSource"in window||"ManagedMediaSource"in window)?(e.push("mse"),this.onmse()):this.mode.indexOf("hls")>=0&&this.video.canPlayType("application/vnd.apple.mpegurl")?(e.push("hls"),this.onhls()):this.mode.indexOf("mp4")>=0&&(e.push("mp4"),this.onmp4()),this.mode.indexOf("webrtc")>=0&&"RTCPeerConnection"in window&&(e.push("webrtc"),this.onwebrtc()),this.mode.indexOf("mjpeg")>=0&&(e.length?this.onmessage.mjpeg=t=>{"error"===t.type&&0===t.value.indexOf(e[0])&&this.onmjpeg()}:(e.push("mjpeg"),this.onmjpeg())),e}onclose(){if(this.wsState===WebSocket.CLOSED)return!1;this.wsState=WebSocket.CONNECTING,this.ws=null;const e=Math.max(this.RECONNECT_TIMEOUT-(Date.now()-this.connectTS),0);return this.reconnectTID=setTimeout((()=>{this.reconnectTID=0,this.onconnect()}),e),!0}onmse(){let e;if("ManagedMediaSource"in window){const t=window.ManagedMediaSource;e=new t,e.addEventListener("sourceopen",(()=>{this.send({type:"mse",value:this.codecs(t.isTypeSupported)})}),{once:!0}),this.video.disableRemotePlayback=!0,this.video.srcObject=e}else e=new MediaSource,e.addEventListener("sourceopen",(()=>{URL.revokeObjectURL(this.video.src),this.send({type:"mse",value:this.codecs(MediaSource.isTypeSupported)})}),{once:!0}),this.video.src=URL.createObjectURL(e),this.video.srcObject=null;this.play(),this.mseCodecs="",this.onmessage.mse=t=>{if("mse"!==t.type)return;this.mseCodecs=t.value;const i=e.addSourceBuffer(t.value);i.mode="segments",i.addEventListener("updateend",(()=>{if(!i.updating)try{if(n>0){const e=s.slice(0,n);n=0,i.appendBuffer(e)}else if(i.buffered&&i.buffered.length){const t=i.buffered.end(i.buffered.length-1)-15,s=i.buffered.start(0);t>s&&(i.remove(s,t),e.setLiveSeekableRange(t,t+15))}}catch(e){}}));const s=new Uint8Array(2097152);let n=0;this.ondata=e=>{if(i.updating||n>0){const t=new Uint8Array(e);s.set(t,n),n+=t.byteLength}else try{i.appendBuffer(e)}catch(e){}}}}onwebrtc(){const e=new RTCPeerConnection(this.pcConfig);e.addEventListener("icecandidate",(e=>{if(e.candidate&&this.mode.indexOf("webrtc/tcp")>=0&&"udp"===e.candidate.protocol)return;const t=e.candidate?e.candidate.toJSON().candidate:"";this.send({type:"webrtc/candidate",value:t})})),e.addEventListener("connectionstatechange",(()=>{if("connected"===e.connectionState){const t=e.getTransceivers().filter((e=>"recvonly"===e.currentDirection)).map((e=>e.receiver.track)),i=document.createElement("video");i.addEventListener("loadeddata",(()=>this.onpcvideo(i)),{once:!0}),i.srcObject=new MediaStream(t)}else"failed"!==e.connectionState&&"disconnected"!==e.connectionState||(e.close(),this.pcState=WebSocket.CLOSED,this.pc=null,this.onconnect())})),this.onmessage.webrtc=t=>{switch(t.type){case"webrtc/candidate":if(this.mode.indexOf("webrtc/tcp")>=0&&t.value.indexOf(" udp ")>0)return;e.addIceCandidate({candidate:t.value,sdpMid:"0"}).catch((e=>{console.warn(e)}));break;case"webrtc/answer":e.setRemoteDescription({type:"answer",sdp:t.value}).catch((e=>{console.warn(e)}));break;case"error":if(t.value.indexOf("webrtc/offer")<0)return;e.close()}},this.createOffer(e).then((e=>{this.send({type:"webrtc/offer",value:e.sdp})})),this.pcState=WebSocket.CONNECTING,this.pc=e}async createOffer(e){this.microphoneStream?.getTracks().forEach((t=>{e.addTransceiver(t,{direction:"sendonly"})}));try{if(this.media.indexOf("microphone")>=0){(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach((t=>{e.addTransceiver(t,{direction:"sendonly"})}))}}catch(e){console.warn(e)}for(const t of["video","audio"])this.media.indexOf(t)>=0&&e.addTransceiver(t,{direction:"recvonly"});const t=await e.createOffer();return await e.setLocalDescription(t),t}onpcvideo(e){if(this.pc){let t=0,i=0;const s=e.srcObject;s.getVideoTracks().length>0&&(t+=544),s.getAudioTracks().length>0&&(t+=258),this.mseCodecs.indexOf("hvc1.")>=0&&(i+=560),this.mseCodecs.indexOf("avc1.")>=0&&(i+=528),this.mseCodecs.indexOf("mp4a.")>=0&&(i+=257),t>=i?(this.video.srcObject=s,this.play(),this.pcState=WebSocket.OPEN,this.wsState=WebSocket.CLOSED,this.ws&&(this.ws.close(),this.ws=null)):(this.pcState=WebSocket.CLOSED,this.pc&&(this.pc.close(),this.pc=null))}e.srcObject=null}onmjpeg(){let t=!1;this.ondata=i=>{m(this.video,!1),this.video.poster="data:image/jpeg;base64,"+b.btoa(i),t||(t=!0,e(this,this.video,{player:this.containingPlayer,technology:["mjpeg"]}))},this.send({type:"mjpeg"})}onhls(){this.onmessage.hls=e=>{if("hls"!==e.type)return;const t="http"+this.wsURL.substring(2,this.wsURL.indexOf("/ws"))+"/hls/",i=e.value.replace("hls/",t);this.video.src="data:application/vnd.apple.mpegurl;base64,"+btoa(i),this.play()},this.send({type:"hls",value:this.codecs((e=>this.video.canPlayType(e)))})}onmp4(){const t=document.createElement("canvas");let i;const s=document.createElement("video");s.autoplay=!0,s.playsInline=!0,s.muted=!0,s.addEventListener("loadeddata",(n=>{i||(t.width=s.videoWidth,t.height=s.videoHeight,i=t.getContext("2d"),e(this,s,{player:this.containingPlayer,technology:["mp4"]})),i.drawImage(s,0,0,t.width,t.height),m(this.video,!1),this.video.poster=t.toDataURL("image/jpeg")})),this.ondata=e=>{s.src="data:video/mp4;base64,"+b.btoa(e)},this.send({type:"mp4",value:this.codecs(this.video.canPlayType)})}static btoa(e){const t=new Uint8Array(e),i=t.byteLength;let s="";for(let e=0;ethis.onconnect())),this.ondisconnect()):(this.ondisconnect(),this.onconnect())}set src(e){"string"!=typeof e&&(e=e.toString()),e.startsWith("http")?e="ws"+e.substring(4):e.startsWith("/")&&(e="ws"+location.origin.substring(4)+e),this.wsURL=e,this.onconnect()}play(){}send(e){this.ws&&this.ws.send(JSON.stringify(e))}codecs(e){return this.CODECS.filter((e=>this.media.indexOf(e.indexOf("vc1")>0?"video":"audio")>=0)).filter((t=>e(`video/mp4; codecs="${t}"`))).join()}connectedCallback(){if(this.disconnectTID&&(clearTimeout(this.disconnectTID),this.disconnectTID=0),this.video){const e=this.video.seekable;e.length>0&&(this.video.currentTime=e.end(e.length-1)),this.play()}else this.oninit();this.onconnect()}disconnectedCallback(){this.background||this.disconnectTID||this.wsState===WebSocket.CLOSED&&this.pcState===WebSocket.CLOSED||(this.disconnectTID=setTimeout((()=>{this.reconnectTID&&(clearTimeout(this.reconnectTID),this.reconnectTID=0),this.disconnectTID=0,this.ondisconnect()}),this.DISCONNECT_TIMEOUT))}oninit(){this.video=document.createElement("video"),m(this.video,this.controls),this.video.playsInline=!0,this.video.preload="auto",this.video.style.display="block",this.video.style.width="100%",this.video.style.height="100%",this.appendChild(this.video),this.video.addEventListener("error",(e=>{this.ws&&this.wsState===WebSocket.OPEN&&this.ws.close()}));const n=window.navigator.userAgent.match(/Version\/(\d+).+Safari/);if(n){const e=n[1]<"13"?"mp4a.40.2":n[1]<"14"?"flac":"opus";this.CODECS.splice(this.CODECS.indexOf(e))}if(!this.background){if("hidden"in document&&this.visibilityCheck&&document.addEventListener("visibilitychange",(()=>{document.hidden?this.disconnectedCallback():this.isConnected&&this.connectedCallback()})),"IntersectionObserver"in window&&this.visibilityThreshold){new IntersectionObserver((e=>{e.forEach((e=>{e.isIntersecting?this.isConnected&&this.connectedCallback():this.disconnectedCallback()}))}),{threshold:this.visibilityThreshold}).observe(this)}this.video.onloadeddata=()=>{this.controls&&v(this.video,y),e(this,this.video,{player:this.containingPlayer,capabilities:{supports2WayAudio:!!this.pc,supportsPause:!0,hasAudio:g(this.video)},technology:f(this)})},this.video.onvolumechange=()=>t(this),this.video.onplay=()=>i(this),this.video.onpause=()=>s(this),this.video.muted=!0}}onconnect(){return!(!this.isConnected||!this.wsURL||this.ws||this.pc)&&(this.wsState=WebSocket.CONNECTING,this.connectTS=Date.now(),this.ws=new WebSocket(this.wsURL),this.ws.binaryType="arraybuffer",this.ws.addEventListener("open",(e=>this.onopen(e))),this.ws.addEventListener("close",(e=>this.onclose(e))),!0)}ondisconnect(){this.wsState=WebSocket.CLOSED,this.ws&&(this.ws.close(),this.ws=null),this.pcState=WebSocket.CLOSED,this.pc&&(this.pc.getSenders().forEach((e=>{e.track&&e.track.stop()})),this.pc.close(),this.pc=null),this.video.src="",this.video.srcObject=null}onopen(){this.wsState=WebSocket.OPEN,this.ws.addEventListener("message",(e=>{if("string"==typeof e.data){const t=JSON.parse(e.data);for(const e in this.onmessage)this.onmessage[e](t)}else this.ondata(e.data)})),this.ondata=null,this.onmessage={};const e=[];return this.mode.indexOf("mse")>=0&&("MediaSource"in window||"ManagedMediaSource"in window)?(e.push("mse"),this.onmse()):this.mode.indexOf("hls")>=0&&this.video.canPlayType("application/vnd.apple.mpegurl")?(e.push("hls"),this.onhls()):this.mode.indexOf("mp4")>=0&&(e.push("mp4"),this.onmp4()),this.mode.indexOf("webrtc")>=0&&"RTCPeerConnection"in window&&(e.push("webrtc"),this.onwebrtc()),this.mode.indexOf("mjpeg")>=0&&(e.length?this.onmessage.mjpeg=t=>{"error"===t.type&&0===t.value.indexOf(e[0])&&this.onmjpeg()}:(e.push("mjpeg"),this.onmjpeg())),e}onclose(){if(this.wsState===WebSocket.CLOSED)return!1;this.wsState=WebSocket.CONNECTING,this.ws=null;const e=Math.max(this.RECONNECT_TIMEOUT-(Date.now()-this.connectTS),0);return this.reconnectTID=setTimeout((()=>{this.reconnectTID=0,this.onconnect()}),e),!0}onmse(){let e;if("ManagedMediaSource"in window){const t=window.ManagedMediaSource;e=new t,e.addEventListener("sourceopen",(()=>{this.send({type:"mse",value:this.codecs(t.isTypeSupported)})}),{once:!0}),this.video.disableRemotePlayback=!0,this.video.srcObject=e}else e=new MediaSource,e.addEventListener("sourceopen",(()=>{URL.revokeObjectURL(this.video.src),this.send({type:"mse",value:this.codecs(MediaSource.isTypeSupported)})}),{once:!0}),this.video.src=URL.createObjectURL(e),this.video.srcObject=null;this.play(),this.mseCodecs="",this.onmessage.mse=t=>{if("mse"!==t.type)return;this.mseCodecs=t.value;const i=e.addSourceBuffer(t.value);i.mode="segments",i.addEventListener("updateend",(()=>{if(!i.updating)try{if(n>0){const e=s.slice(0,n);n=0,i.appendBuffer(e)}else if(i.buffered&&i.buffered.length){const t=i.buffered.end(i.buffered.length-1)-15,s=i.buffered.start(0);t>s&&(i.remove(s,t),e.setLiveSeekableRange(t,t+15))}}catch(e){}}));const s=new Uint8Array(2097152);let n=0;this.ondata=e=>{if(i.updating||n>0){const t=new Uint8Array(e);s.set(t,n),n+=t.byteLength}else try{i.appendBuffer(e)}catch(e){}}}}onwebrtc(){const e=new RTCPeerConnection(this.pcConfig);e.addEventListener("icecandidate",(e=>{if(e.candidate&&this.mode.indexOf("webrtc/tcp")>=0&&"udp"===e.candidate.protocol)return;const t=e.candidate?e.candidate.toJSON().candidate:"";this.send({type:"webrtc/candidate",value:t})})),e.addEventListener("connectionstatechange",(()=>{if("connected"===e.connectionState){const t=e.getTransceivers().filter((e=>"recvonly"===e.currentDirection)).map((e=>e.receiver.track)),i=document.createElement("video");i.addEventListener("loadeddata",(()=>this.onpcvideo(i)),{once:!0}),i.srcObject=new MediaStream(t)}else"failed"!==e.connectionState&&"disconnected"!==e.connectionState||(e.close(),this.pcState=WebSocket.CLOSED,this.pc=null,this.onconnect())})),this.onmessage.webrtc=t=>{switch(t.type){case"webrtc/candidate":if(this.mode.indexOf("webrtc/tcp")>=0&&t.value.indexOf(" udp ")>0)return;e.addIceCandidate({candidate:t.value,sdpMid:"0"}).catch((e=>{console.warn(e)}));break;case"webrtc/answer":e.setRemoteDescription({type:"answer",sdp:t.value}).catch((e=>{console.warn(e)}));break;case"error":if(t.value.indexOf("webrtc/offer")<0)return;e.close()}},this.createOffer(e).then((e=>{this.send({type:"webrtc/offer",value:e.sdp})})),this.pcState=WebSocket.CONNECTING,this.pc=e}async createOffer(e){this.microphoneStream?.getTracks().forEach((t=>{e.addTransceiver(t,{direction:"sendonly"})}));try{if(this.media.indexOf("microphone")>=0){(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach((t=>{e.addTransceiver(t,{direction:"sendonly"})}))}}catch(e){console.warn(e)}for(const t of["video","audio"])this.media.indexOf(t)>=0&&e.addTransceiver(t,{direction:"recvonly"});const t=await e.createOffer();return await e.setLocalDescription(t),t}onpcvideo(e){if(this.pc){let t=0,i=0;const s=e.srcObject;s.getVideoTracks().length>0&&(t+=544),s.getAudioTracks().length>0&&(t+=258),this.mseCodecs.indexOf("hvc1.")>=0&&(i+=560),this.mseCodecs.indexOf("avc1.")>=0&&(i+=528),this.mseCodecs.indexOf("mp4a.")>=0&&(i+=257),t>=i?(this.video.srcObject=s,this.play(),this.pcState=WebSocket.OPEN,this.wsState=WebSocket.CLOSED,this.ws&&(this.ws.close(),this.ws=null)):(this.pcState=WebSocket.CLOSED,this.pc&&(this.pc.close(),this.pc=null))}e.srcObject=null}onmjpeg(){let t=!1;this.ondata=i=>{m(this.video,!1),this.video.poster="data:image/jpeg;base64,"+b.btoa(i),t||(t=!0,e(this,this.video,{player:this.containingPlayer,technology:["mjpeg"]}))},this.send({type:"mjpeg"})}onhls(){this.onmessage.hls=e=>{if("hls"!==e.type)return;const t="http"+this.wsURL.substring(2,this.wsURL.indexOf("/ws"))+"/hls/",i=e.value.replace("hls/",t);this.video.src="data:application/vnd.apple.mpegurl;base64,"+btoa(i),this.play()},this.send({type:"hls",value:this.codecs((e=>this.video.canPlayType(e)))})}onmp4(){const t=document.createElement("canvas");let i;const s=document.createElement("video");s.autoplay=!0,s.playsInline=!0,s.muted=!0,s.addEventListener("loadeddata",(n=>{i||(t.width=s.videoWidth,t.height=s.videoHeight,i=t.getContext("2d"),e(this,s,{player:this.containingPlayer,technology:["mp4"]})),i.drawImage(s,0,0,t.width,t.height),m(this.video,!1),this.video.poster=t.toDataURL("image/jpeg")})),this.ondata=e=>{s.src="data:video/mp4;base64,"+b.btoa(e)},this.send({type:"mp4",value:this.codecs(this.video.canPlayType)})}static btoa(e){const t=new Uint8Array(e),i=t.byteLength;let s="";for(let e=0;e!e.hasSelectedResult()}}))}async _setURL(){const e=this.media?.getContentID();if(!this.media||!e||!this.hass||this.viewerConfig?.lazy_load&&!this.load)return;let i=this.resolvedMediaCache?.get(e)??null;if(i||(i=await l(this.hass,e,this.resolvedMediaCache)),!i)return;const t=i.url;if(g(t))return void(this._url=h(this.hass,t));const a=this.cameraManager?.getStore().getCamera(this.media.getCameraID()),r=a?.getProxyConfig();if(r&&c(this.hass,r,"media")){if(r.dynamic){const e=t.split(/#/)[0];await u(this.hass,e,{sslVerification:r.ssl_verification,sslCiphers:r.ssl_ciphers,openLimit:0})}try{this._url=await m(this.hass,v(t))}catch(e){p(e)}}else this._url=t}willUpdate(e){if((e.has("load")||e.has("media")||e.has("viewerConfig")||e.has("resolvedMediaCache")||e.has("hass"))&&this._setURL().then((()=>{this.requestUpdate()})),e.has("viewerConfig")&&this.viewerConfig?.zoomable&&import("./zoomer-672d26af.js"),e.has("media")||e.has("cameraManager")){const e=this.media?.getCameraID(),i=e?this.cameraManager?.getStore().getCameraConfig(e):null;S(this,i?.dimensions?.layout),this.style.aspectRatio=C({ratio:i?.dimensions?.aspect_ratio})}}_useZoomIfRequired(e){if(!this.media)return e;const i=this.media.getCameraID(),t=this.media.getID()??void 0,a=this.cameraManager?.getStore().getCameraConfig(i),r=this.viewManagerEpoch?.manager.getView();return this.viewerConfig?.zoomable?w` a?.dimensions?.layout?{pan:a.dimensions.layout.pan,zoom:a.dimensions.layout.zoom}:void 0))} + .settings=${t?r?.context?.zoom?.[t]?.requested:void 0} + @frigate-card:zoom:zoomed=${()=>this.setControls(!1)} + @frigate-card:zoom:unzoomed=${()=>this.setControls()} + @frigate-card:zoom:change=${e=>f(e,this.viewManagerEpoch?.manager,t)} + > + ${e} + `:e}render(){if(this.load&&this.media&&this.hass&&this.viewerConfig)return this._url?this._useZoomIfRequired(w` + ${n.isVideo(this.media)?this.media.getVideoContentType()===Q.HLS?w` + `:w` + + `:w`{this.viewerConfig?.snapshot_click_plays_clip&&this._switchToRelatedClipView()}} + @load=${e=>{y(this,e,{player:this,technology:["jpg"]})}} + />`} + `):I({cardWideConfig:this.cardWideConfig})}static get styles(){return D(':host {\n background-color: var(--primary-background-color);\n background-position: center;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJjYW1lcmEtaXJpcy5zdmciCiAgIGlkPSJzdmc0IgogICB2ZXJzaW9uPSIxLjEiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjYjkzZTNlIgogICAgIGJvcmRlcmNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcm9wYWNpdHk9IjAuMjUiCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuNjA3ODQzMTQiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyNi42MjUwNiIKICAgICBpbmtzY2FwZTpjeD0iLTEuOTM0MjY4IgogICAgIGlua3NjYXBlOmN5PSIxNS42ODA3MTYiCiAgICAgaW5rc2NhcGU6d2luZG93LXdpZHRoPSIzODQwIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjE1MjciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEwODAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjIyNyIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiIC8+CiAgPGcKICAgICBpZD0iZzExMTkiCiAgICAgc3R5bGU9ImZpbGwtb3BhY2l0eTowLjA1O2ZpbGw6I2ZmZmZmZiI+CiAgICA8Y2lyY2xlCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eTowLjA1O3N0cm9rZS13aWR0aDoxLjM5NzI5IgogICAgICAgaWQ9InBhdGgxNzAiCiAgICAgICBjeD0iMTIiCiAgICAgICBjeT0iMTIiCiAgICAgICBpbmtzY2FwZTpsYWJlbD0iV2hpdGUgQmFja2dyb3VuZCIKICAgICAgIHI9IjExLjI1IiAvPgogICAgPHBhdGgKICAgICAgIGQ9Ik0gMTMuNzMwMDAxLDE1IDkuODMwMDAwMywyMS43NiBDIDEwLjUzLDIxLjkxIDExLjI1LDIyIDEyLDIyIGMgMi40MDAwMDEsMCA0LjYsLTAuODUgNi4zMiwtMi4yNSBMIDE0LjY2MDAwMSwxMy40IE0gMi40NjAwMDAzLDE1IGMgMC45MiwyLjkyIDMuMTUsNS4yNiA1Ljk5LDYuMzQgTCAxMi4xMiwxNSBtIC0zLjU3OTk5OTcsLTMgLTMuOSwtNi43NDk5OTk2IGMgLTEuNjQsMS43NDk5OTkgLTIuNjQsNC4xMzk5OTkzIC0yLjY0LDYuNzQ5OTk5NiAwLDAuNjggMC4wNywxLjM1IDAuMiwyIGggNy40OSBNIDIxLjgsOS45OTk5OTk3IEggMTQuMzEwMDAxIEwgMTQuNjAwMDAxLDEwLjUgMTkuMzYsMTguNzUgQyAyMSwxNi45NyAyMiwxNC42IDIyLDEyIDIyLDExLjMxIDIxLjkzLDEwLjY0IDIxLjgsOS45OTk5OTk3IG0gLTAuMjYsLTEgQyAyMC42Miw2LjA3MDAwMDUgMTguMzksMy43NDAwMDAyIDE1LjU1MDAwMSwyLjY2MDAwMDIgTCAxMS44OCw4Ljk5OTk5OTcgTSA5LjQwMDAwMDMsMTAuNSAxNC4xNzAwMDEsMi4yNDAwMDAyIGMgLTAuNywtMC4xNSAtMS40MjAwMDEsLTAuMjQgLTIuMTcwMDAxLC0wLjI0IC0yLjM5OTk5OTcsMCAtNC41OTk5OTk3LDAuODQgLTYuMzE5OTk5NywyLjI1MDAwMDMgbCAzLjY2LDYuMzQ5OTk5NSB6IgogICAgICAgaWQ9InBhdGgyIgogICAgICAgaW5rc2NhcGU6bGFiZWw9IklyaXMiCiAgICAgICBzdHlsZT0iZmlsbC1vcGFjaXR5OjAuMDU7ZmlsbDojZmZmZmZmIiAvPgogIDwvZz4KPC9zdmc+Cg==");\n background-size: 10%;\n background-position: center;\n}\n\n:host {\n display: block;\n width: 100%;\n height: 100%;\n}\n\nimg,\nvideo,\nfrigate-card-ha-hls-player {\n display: block;\n width: 100%;\n height: 100%;\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}\n\nfrigate-card-progress-indicator {\n padding: 30px;\n box-sizing: border-box;\n}')}};e([i({attribute:!1})],q.prototype,"hass",void 0),e([i({attribute:!1})],q.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],q.prototype,"media",void 0),e([i({attribute:!1})],q.prototype,"viewerConfig",void 0),e([i({attribute:!1})],q.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],q.prototype,"load",void 0),e([i({attribute:!1})],q.prototype,"cameraManager",void 0),e([i({attribute:!1})],q.prototype,"cardWideConfig",void 0),e([t()],q.prototype,"_url",void 0),q=e([a("frigate-card-viewer-provider")],q);let H=class extends r{constructor(){super(...arguments),this.showControls=!0,this._selected=0,this._media=null,this._mediaActionsController=new O,this._player=null,this._refCarousel=s()}updated(e){super.updated(e),e.has("viewManagerEpoch")&&this.viewManagerEpoch?.manager.getView()?.context?.mediaViewer!==this.viewManagerEpoch?.oldView?.context?.mediaViewer&&this._seekHandler(),!this._mediaActionsController.hasRoot()&&this._refCarousel.value&&this._mediaActionsController.initialize(this._refCarousel.value)}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._mediaActionsController.destroy(),super.disconnectedCallback()}_getTransitionEffect(){return this.viewerConfig?.transition_effect??k.media_viewer.transition_effect}_getPlugins(){return[R({...this.viewerConfig?.lazy_load&&{lazyLoadCallback:(e,i)=>this._lazyloadSlide(i)}}),U(),Y()]}_getMediaNeighbors(){const e=this._media?.length??0;if(!this._media)return null;const i=this._selected>0?this._selected-1:null,t=this._selected+1{if(!t||!this._media)return;const i=("previous"===e?t.previous?.index:t.next?.index)??null;null!==i&&this._setViewSelectedIndex(i)},r=this.viewManagerEpoch?.manager.getView();return w` + {this._setViewSelectedIndex(e.detail.index)}} + @frigate-card:media:loaded=${e=>{this._player=e.detail.player??null,this._seekHandler()}} + @frigate-card:media:unloaded=${()=>{this._player=null}} + > + ${this.showControls?w` {a("previous"),N(e)}} + >`:""} + ${W([this._media,r],(()=>this._getSlides()))} + ${this.showControls?w` {a("next"),N(e)}} + >`:""} + + ${r?w` + `:""} +
+ + +
+ `}async _seekHandler(){const e=this.viewManagerEpoch?.manager.getView(),i=e?.context?.mediaViewer?.seek;if(!(this.hass&&i&&this._media&&this._player))return;const t=this._media[this._selected];if(!t)return;const a=t.includesTime(i);$(this,!a,"unseekable"),a||this._player.isPaused()?a&&this._player.isPaused()&&this._player.play():this._player.pause();const r=await(this.cameraManager?.getMediaSeekTime(t,i))??null;null!==r&&this._player.seek(r)}_renderMediaItem(e){const i=this.viewManagerEpoch?.manager.getView();return this.hass&&i&&this.viewerConfig?w`
+ +
`:null}static get styles(){return D(":host {\n position: relative;\n --video-max-height: none;\n}\n\n:host([unselected]) frigate-card-carousel,\n:host([unselected]) .seek-warning {\n pointer-events: none;\n}\n\n:host([unseekable]) frigate-card-carousel {\n filter: brightness(50%);\n}\n\n:host([unseekable]) .seek-warning {\n display: block;\n}\n\n.seek-warning {\n display: none;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translateX(-50%) translateY(-50%);\n color: white;\n}\n\n.embla__slide {\n height: 100%;\n flex: 0 0 100%;\n}")}};e([i({attribute:!1})],H.prototype,"hass",void 0),e([i({attribute:!1})],H.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],H.prototype,"viewFilterCameraID",void 0),e([i({attribute:!1,hasChanged:x})],H.prototype,"viewerConfig",void 0),e([i({attribute:!1})],H.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],H.prototype,"cardWideConfig",void 0),e([i({attribute:!1})],H.prototype,"cameraManager",void 0),e([i({attribute:!1})],H.prototype,"showControls",void 0),e([t()],H.prototype,"_selected",void 0),H=e([a("frigate-card-viewer-carousel")],H);let X=class extends r{_renderCarousel(e){const i=this.viewManagerEpoch?.manager.getView()?.camera;return w` + + + `}willUpdate(e){e.has("viewManagerEpoch")&&this._needsGrid()&&import("./media-grid-cff66b0b.js")}_needsGrid(){const e=this.viewManagerEpoch?.manager.getView(),i=e?.queryResults?.getCameraIDs();return!!e?.isGrid()&&!!e?.supportsMultipleDisplayModes()&&(i?.size??0)>1}_gridSelectCamera(e){const i=this.viewManagerEpoch?.manager.getView();this.viewManagerEpoch?.manager.setViewByParameters({params:{camera:e,queryResults:i?.queryResults?.clone().promoteCameraSelectionToMainSelection(e)}})}render(){const e=this.viewManagerEpoch?.manager.getView(),i=e?.queryResults?.getCameraIDs();return i&&this._needsGrid()?w` + this._gridSelectCamera(e.detail.selected)} + > + ${[...i].map((e=>this._renderCarousel(e)))} + + `:this._renderCarousel()}static get styles(){return D(E)}};e([i({attribute:!1})],X.prototype,"hass",void 0),e([i({attribute:!1})],X.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],X.prototype,"viewerConfig",void 0),e([i({attribute:!1})],X.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],X.prototype,"cardWideConfig",void 0),e([i({attribute:!1})],X.prototype,"cameraManager",void 0),X=e([a("frigate-card-viewer-grid")],X);let J=class extends r{render(){if(this.hass&&this.viewManagerEpoch&&this.viewerConfig&&this.cameraManager&&this.cardWideConfig){if(!this.viewManagerEpoch.manager.getView()?.queryResults?.hasResults()){const e=!!this.viewManagerEpoch.manager.getView()?.context?.loading?.query;return P({type:"info",message:z(e?"error.awaiting_media":"common.no_media"),icon:"mdi:multimedia",dotdotdot:e})}return w` + `}}static get styles(){return D(":host {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n gap: 5px;\n}\n\nfrigate-card-viewer-carousel {\n flex: 1;\n min-height: 0;\n}")}};e([i({attribute:!1})],J.prototype,"hass",void 0),e([i({attribute:!1})],J.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],J.prototype,"viewerConfig",void 0),e([i({attribute:!1})],J.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],J.prototype,"cameraManager",void 0),e([i({attribute:!1})],J.prototype,"cardWideConfig",void 0),J=e([a("frigate-card-viewer")],J);export{J as FrigateCardViewer}; diff --git a/config/www/community/frigate-hass-card/index-961f10b9.js.gz b/config/www/community/frigate-hass-card/index-961f10b9.js.gz new file mode 100644 index 00000000..71e0b9a9 Binary files /dev/null and b/config/www/community/frigate-hass-card/index-961f10b9.js.gz differ diff --git a/config/www/community/frigate-hass-card/index-9b434861.js b/config/www/community/frigate-hass-card/index-9b434861.js new file mode 100644 index 00000000..2581f2a8 --- /dev/null +++ b/config/www/community/frigate-hass-card/index-9b434861.js @@ -0,0 +1,162 @@ +import{cL as e,cM as i,cN as t,cO as a,cP as r,cQ as o,l as s,_ as n,n as d,b as g,t as c,a as h,cR as l,cI as m,cS as v,cT as p,x as u,cU as C,cV as f,e as I,r as M,cW as _,cX as w,cY as b,cZ as y,c_ as L,c$ as A,d0 as D,d1 as $,d2 as j}from"./card-769e2b91.js";import{p as z,u as k,i as S,M as E,A as N,a as x,b as T}from"./media-d4c0d154.js"; +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const Z=e(class extends i{constructor(){super(...arguments),this.key=t}render(e,i){return this.key=e,i}update(e,[i,t]){return i!==this.key&&(a(e),this.key=i),t}});class O{constructor(e){this._inBackground=!1,this._messageReceived=!1,this._lastMediaLoadedInfo=null,this._renderEpoch=0,this._handleMessage=e=>{this._messageReceived=!0,this._inBackground&&(e.stopPropagation(),this._renderEpoch++)},this._handleMediaLoaded=e=>{this._lastMediaLoadedInfo={source:e.composedPath()[0],mediaLoadedInfo:e.detail},this._inBackground&&e.stopPropagation()},this._host=e,e.addController(this),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}shouldUpdate(){return!(this._inBackground&&this._messageReceived)}hostConnected(){this._intersectionObserver.observe(this._host),this._host.addEventListener("frigate-card:media:loaded",this._handleMediaLoaded),this._host.addEventListener("frigate-card:message",this._handleMessage)}hostDisconnected(){this._intersectionObserver.disconnect(),this._host.removeEventListener("frigate-card:media:loaded",this._handleMediaLoaded),this._host.removeEventListener("frigate-card:message",this._handleMessage)}clearMessageReceived(){this._messageReceived=!1}isInBackground(){return this._inBackground}getRenderEpoch(){return this._renderEpoch}_intersectionHandler(e){const i=this._inBackground;this._inBackground=!e.some((e=>e.isIntersecting)),this._inBackground||this._messageReceived||!this._lastMediaLoadedInfo||r(this._lastMediaLoadedInfo.source,this._lastMediaLoadedInfo.mediaLoadedInfo),i!==this._inBackground&&this._host.requestUpdate()}}const P=(e,i,t)=>{if(!t?.camera_entity)return o(e,s("error.no_live_camera"),{context:t}),null;const a=i.states[t.camera_entity];return a||(o(e,s("error.live_camera_not_found"),{context:t}),null)};let G=class extends h{constructor(){super(...arguments),this.load=!1,this.label="",this._isVideoMediaLoaded=!1,this._refProvider=l(),this._importPromises=[]}async play(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await z(this,this._refProvider.value)}async pause(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.pause())}async mute(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.mute())}async unmute(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.unmute())}isMuted(){return this._refProvider.value?.isMuted()??!0}async seek(e){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.seek(e))}async setControls(e){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.setControls(e))}isPaused(){return this._refProvider.value?.isPaused()??!0}async getScreenshotURL(){return await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.getScreenshotURL())??null}_getResolvedProvider(){return"auto"===this.cameraConfig?.live_provider?this.cameraConfig?.webrtc_card?.entity||this.cameraConfig?.webrtc_card?.url?"webrtc-card":this.cameraConfig?.camera_entity?"ha":this.cameraConfig?.frigate.camera_name?"jsmpeg":m.cameras.live_provider:this.cameraConfig?.live_provider||"image"}_shouldShowImageDuringLoading(){return!!this.cameraConfig?.camera_entity&&!!this.hass&&!!this.liveConfig?.show_image_during_load}disconnectedCallback(){this._isVideoMediaLoaded=!1}_videoMediaShowHandler(){this._isVideoMediaLoaded=!0}willUpdate(e){if(e.has("load")&&(this.load||(this._isVideoMediaLoaded=!1,v(this))),e.has("liveConfig")&&(this.liveConfig?.show_image_during_load&&this._importPromises.push(import("./image-669f8abb.js")),this.liveConfig?.zoomable&&this._importPromises.push(import("./zoomer-ddec5522.js"))),e.has("cameraConfig")){const e=this._getResolvedProvider();"jsmpeg"===e?this._importPromises.push(import("./jsmpeg-ef28408a.js")):"ha"===e?this._importPromises.push(import("./ha-378b7a69.js")):"webrtc-card"===e?this._importPromises.push(import("./webrtc-card-ee41138a.js")):"image"===e?this._importPromises.push(import("./image-669f8abb.js")):"go2rtc"===e&&this._importPromises.push(import("./index-8355422b.js")),k(this,this.cameraConfig?.dimensions?.layout),this.style.aspectRatio=p({ratio:this.cameraConfig?.dimensions?.aspect_ratio})}}async getUpdateComplete(){const e=await super.getUpdateComplete();return await Promise.all(this._importPromises),this._importPromises=[],e}_useZoomIfRequired(e){return this.liveConfig?.zoomable?u` this.cameraConfig?.dimensions?.layout?{pan:this.cameraConfig.dimensions.layout.pan,zoom:this.cameraConfig.dimensions.layout.zoom}:void 0))} + .settings=${this.zoomSettings} + @frigate-card:zoom:zoomed=${()=>this.setControls(!1)} + @frigate-card:zoom:unzoomed=${()=>this.setControls()} + > + ${e} + `:e}render(){if(!(this.load&&this.hass&&this.liveConfig&&this.cameraConfig))return;this.title=this.label,this.ariaLabel=this.label;const e=this._getResolvedProvider(),i=!this._isVideoMediaLoaded&&this._shouldShowImageDuringLoading(),t={hidden:i};if("ha"===e||"image"===e){const e=P(this,this.hass,this.cameraConfig);if(!e)return;if("unavailable"===e.state)return v(this),C({message:`${s("error.live_camera_unavailable")}${this.label?`: ${this.label}`:""}`,type:"info",icon:"mdi:cctv-off",dotdotdot:!0})}return u`${this._useZoomIfRequired(u` + ${i||"image"===e?u` {"image"===e?this._videoMediaShowHandler():i.stopPropagation()}} + > + `:u``} + ${"ha"===e?u` + `:"go2rtc"===e?u` + `:"webrtc-card"===e?u` + `:"jsmpeg"===e?u` + `:u``} + `)} + ${i&&!this._isVideoMediaLoaded?u``:""} `}static get styles(){return M(':host {\n background-color: var(--primary-background-color);\n background-position: center;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJjYW1lcmEtaXJpcy5zdmciCiAgIGlkPSJzdmc0IgogICB2ZXJzaW9uPSIxLjEiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjYjkzZTNlIgogICAgIGJvcmRlcmNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcm9wYWNpdHk9IjAuMjUiCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuNjA3ODQzMTQiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyNi42MjUwNiIKICAgICBpbmtzY2FwZTpjeD0iLTEuOTM0MjY4IgogICAgIGlua3NjYXBlOmN5PSIxNS42ODA3MTYiCiAgICAgaW5rc2NhcGU6d2luZG93LXdpZHRoPSIzODQwIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjE1MjciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEwODAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjIyNyIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiIC8+CiAgPGcKICAgICBpZD0iZzExMTkiCiAgICAgc3R5bGU9ImZpbGwtb3BhY2l0eTowLjA1O2ZpbGw6I2ZmZmZmZiI+CiAgICA8Y2lyY2xlCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eTowLjA1O3N0cm9rZS13aWR0aDoxLjM5NzI5IgogICAgICAgaWQ9InBhdGgxNzAiCiAgICAgICBjeD0iMTIiCiAgICAgICBjeT0iMTIiCiAgICAgICBpbmtzY2FwZTpsYWJlbD0iV2hpdGUgQmFja2dyb3VuZCIKICAgICAgIHI9IjExLjI1IiAvPgogICAgPHBhdGgKICAgICAgIGQ9Ik0gMTMuNzMwMDAxLDE1IDkuODMwMDAwMywyMS43NiBDIDEwLjUzLDIxLjkxIDExLjI1LDIyIDEyLDIyIGMgMi40MDAwMDEsMCA0LjYsLTAuODUgNi4zMiwtMi4yNSBMIDE0LjY2MDAwMSwxMy40IE0gMi40NjAwMDAzLDE1IGMgMC45MiwyLjkyIDMuMTUsNS4yNiA1Ljk5LDYuMzQgTCAxMi4xMiwxNSBtIC0zLjU3OTk5OTcsLTMgLTMuOSwtNi43NDk5OTk2IGMgLTEuNjQsMS43NDk5OTkgLTIuNjQsNC4xMzk5OTkzIC0yLjY0LDYuNzQ5OTk5NiAwLDAuNjggMC4wNywxLjM1IDAuMiwyIGggNy40OSBNIDIxLjgsOS45OTk5OTk3IEggMTQuMzEwMDAxIEwgMTQuNjAwMDAxLDEwLjUgMTkuMzYsMTguNzUgQyAyMSwxNi45NyAyMiwxNC42IDIyLDEyIDIyLDExLjMxIDIxLjkzLDEwLjY0IDIxLjgsOS45OTk5OTk3IG0gLTAuMjYsLTEgQyAyMC42Miw2LjA3MDAwMDUgMTguMzksMy43NDAwMDAyIDE1LjU1MDAwMSwyLjY2MDAwMDIgTCAxMS44OCw4Ljk5OTk5OTcgTSA5LjQwMDAwMDMsMTAuNSAxNC4xNzAwMDEsMi4yNDAwMDAyIGMgLTAuNywtMC4xNSAtMS40MjAwMDEsLTAuMjQgLTIuMTcwMDAxLC0wLjI0IC0yLjM5OTk5OTcsMCAtNC41OTk5OTk3LDAuODQgLTYuMzE5OTk5NywyLjI1MDAwMDMgbCAzLjY2LDYuMzQ5OTk5NSB6IgogICAgICAgaWQ9InBhdGgyIgogICAgICAgaW5rc2NhcGU6bGFiZWw9IklyaXMiCiAgICAgICBzdHlsZT0iZmlsbC1vcGFjaXR5OjAuMDU7ZmlsbDojZmZmZmZmIiAvPgogIDwvZz4KPC9zdmc+Cg==");\n background-size: 10%;\n background-position: center;\n}\n\n:host {\n display: block;\n height: 100%;\n width: 100%;\n position: relative;\n}\n\n.hidden {\n display: none;\n}\n\nha-icon {\n position: absolute;\n top: 10px;\n right: 10px;\n color: var(--primary-color);\n}')}};n([d({attribute:!1})],G.prototype,"hass",void 0),n([d({attribute:!1})],G.prototype,"cameraConfig",void 0),n([d({attribute:!1})],G.prototype,"cameraEndpoints",void 0),n([d({attribute:!1})],G.prototype,"liveConfig",void 0),n([d({attribute:!0,type:Boolean})],G.prototype,"load",void 0),n([d({attribute:!1})],G.prototype,"label",void 0),n([d({attribute:!1})],G.prototype,"cardWideConfig",void 0),n([d({attribute:!1})],G.prototype,"microphoneStream",void 0),n([d({attribute:!1})],G.prototype,"zoomSettings",void 0),n([g()],G.prototype,"_isVideoMediaLoaded",void 0),G=n([c("frigate-card-live-provider")],G);const W="frigate-card-live-provider";let U=class extends h{constructor(){super(...arguments),this._cameraToSlide={},this._refPTZControl=l(),this._refCarousel=l(),this._mediaActionsController=new E,this._mediaHasLoaded=!1}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._mediaActionsController.destroy(),super.disconnectedCallback()}_getTransitionEffect(){return this.overriddenLiveConfig?.transition_effect??m.live.transition_effect}_getSelectedCameraIndex(){if(this.viewFilterCameraID)return 0;const e=this.cameraManager?.getStore().getCameraIDsWithCapability("live"),i=this.viewManagerEpoch?.manager.getView();return e?.size&&i?Math.max(0,Array.from(e).indexOf(i.camera)):0}willUpdate(e){(e.has("microphoneManager")||e.has("overriddenLiveConfig"))&&this._mediaActionsController.setOptions({playerSelector:W,...this.overriddenLiveConfig?.auto_play&&{autoPlayConditions:this.overriddenLiveConfig.auto_play},...this.overriddenLiveConfig?.auto_pause&&{autoPauseConditions:this.overriddenLiveConfig.auto_pause},...this.overriddenLiveConfig?.auto_mute&&{autoMuteConditions:this.overriddenLiveConfig.auto_mute},...this.overriddenLiveConfig?.auto_unmute&&{autoUnmuteConditions:this.overriddenLiveConfig.auto_unmute},...(this.overriddenLiveConfig?.auto_unmute||this.overriddenLiveConfig?.auto_mute)&&{microphoneManager:this.microphoneManager,microphoneMuteSeconds:this.overriddenLiveConfig.microphone.mute_after_microphone_mute_seconds}})}_getPlugins(){return[N({...this.overriddenLiveConfig?.lazy_load&&{lazyLoadCallback:(e,i)=>this._lazyloadOrUnloadSlide("load",e,i)},lazyUnloadConditions:this.overriddenLiveConfig?.lazy_unload,lazyUnloadCallback:(e,i)=>this._lazyloadOrUnloadSlide("unload",e,i)}),x(),T()]}_getLazyLoadCount(){return!1===this.overriddenLiveConfig?.lazy_load?null:0}_getSlides(){if(!this.cameraManager)return[[],{}];const e=this.viewManagerEpoch?.manager.getView(),i=this.viewFilterCameraID?new Set([this.viewFilterCameraID]):this.cameraManager?.getStore().getCameraIDsWithCapability("live"),t=[],a={};for(const[r,o]of this.cameraManager.getStore().getCameraConfigEntries(i)){const i=this._getSubstreamCameraID(r,e),s=r===i?o:this.cameraManager?.getStore().getCameraConfig(i),n=s?this._renderLive(i,s):null;n&&(a[r]=t.length,t.push(n))}return[t,a]}_setViewHandler(e){const i=this.cameraManager?.getStore().getCameraIDsWithCapability("live");i?.size&&e.detail.index!==this._getSelectedCameraIndex()&&this._setViewCameraID([...i][e.detail.index])}_setViewCameraID(e){e&&this.viewManagerEpoch?.manager.setViewByParametersWithNewQuery({params:{camera:e}})}_lazyloadOrUnloadSlide(e,i,t){t instanceof HTMLSlotElement&&(t=t.assignedElements({flatten:!0})[0]);const a=t?.querySelector(W);a&&(a.load="load"===e)}_renderLive(e,i){if(!(this.overriddenLiveConfig&&this.nonOverriddenLiveConfig&&this.hass&&this.cameraManager&&this.conditionsManagerEpoch))return;let t=null;try{t=w(this.conditionsManagerEpoch.manager,{live:this.nonOverriddenLiveConfig},{configOverrides:this.overrides,stateOverrides:{camera:e},schema:b}).live}catch(e){return y(this,e)}const a=this.cameraManager.getCameraMetadata(e),r=this.viewManagerEpoch?.manager.getView();return u` +
+ this.cameraManager?.getCameraEndpoints(e)??void 0))} + .label=${a?.title??""} + .liveConfig=${t} + .hass=${this.hass} + .cardWideConfig=${this.cardWideConfig} + .zoomSettings=${r?.context?.zoom?.[e]?.requested} + @frigate-card:zoom:change=${i=>L(i,this.viewManagerEpoch?.manager,e)} + > + +
+ `}_getCameraIDsOfNeighbors(){const e=this.cameraManager?[...this.cameraManager?.getStore().getCameraIDsWithCapability("live")]:[],i=this.viewManagerEpoch?.manager.getView();if(this.viewFilterCameraID||e.length<=1||!i||!this.hass)return[null,null];const t=this.viewFilterCameraID??i.camera,a=e.indexOf(t);return a<0?[null,null]:[e[a>0?a-1:e.length-1],e[a+11,[r,o]=this._getCameraIDsOfNeighbors(),s=r?this.cameraManager.getCameraMetadata(this._getSubstreamCameraID(r,e)):null,n=o?this.cameraManager.getCameraMetadata(this._getSubstreamCameraID(o,e)):null,d=!(!this._mediaHasLoaded||this.viewFilterCameraID&&this.viewFilterCameraID!==e.camera||!1===e.context?.ptzControls?.enabled)&&e.context?.ptzControls?.enabled;return u` + {this._mediaHasLoaded=!0}} + @frigate-card:media:unloaded=${()=>{this._mediaHasLoaded=!1}} + > + {this._setViewCameraID(r),A(e)}} + > + + ${i} + {this._setViewCameraID(o),A(e)}} + > + + + + + `}_setMediaTarget(){const e=this.viewManagerEpoch?.manager.getView(),i=this._getSelectedCameraIndex();this.viewFilterCameraID?this._mediaActionsController.setTarget(i,e?.camera===this.viewFilterCameraID):this._mediaActionsController.setTarget(i,!0)}updated(e){super.updated(e);let i=!1;!this._mediaActionsController.hasRoot()&&this._refCarousel.value&&(this._mediaActionsController.initialize(this._refCarousel.value),i=!0),(i||e.has("viewManagerEpoch"))&&this._setMediaTarget()}static get styles(){return M(":host {\n display: block;\n --video-max-height: none;\n}\n\n:host(:not([grid-id])) {\n height: 100%;\n}\n\n:host([unselected]) frigate-card-carousel {\n pointer-events: none;\n}\n\n.embla__slide {\n display: flex;\n justify-content: center;\n height: 100%;\n flex: 0 0 100%;\n}")}};n([d({attribute:!1})],U.prototype,"hass",void 0),n([d({attribute:!1})],U.prototype,"viewManagerEpoch",void 0),n([d({attribute:!1})],U.prototype,"nonOverriddenLiveConfig",void 0),n([d({attribute:!1})],U.prototype,"overriddenLiveConfig",void 0),n([d({attribute:!1,hasChanged:_})],U.prototype,"overrides",void 0),n([d({attribute:!1})],U.prototype,"conditionsManagerEpoch",void 0),n([d({attribute:!1})],U.prototype,"cardWideConfig",void 0),n([d({attribute:!1})],U.prototype,"cameraManager",void 0),n([d({attribute:!1})],U.prototype,"microphoneManager",void 0),n([d({attribute:!1})],U.prototype,"viewFilterCameraID",void 0),n([g()],U.prototype,"_mediaHasLoaded",void 0),U=n([c("frigate-card-live-carousel")],U);let B=class extends h{_renderCarousel(e){const i=this.viewManagerEpoch?.manager.getView(),t=e??i?.camera;return u` + + + `}_gridSelectCamera(e){this.viewManagerEpoch?.manager.setViewByParameters({params:{camera:e}})}_needsGrid(){const e=this.cameraManager?.getStore().getCameraIDsWithCapability("live"),i=this.viewManagerEpoch?.manager.getView();return!!i?.isGrid()&&!!i?.supportsMultipleDisplayModes()&&!!e&&e.size>1}willUpdate(e){e.has("viewManagerEpoch")&&this._needsGrid()&&import("./media-grid-110faed3.js")}render(){if(!this.conditionsManagerEpoch||!this.nonOverriddenLiveConfig)return;const e=this.cameraManager?.getStore().getCameraIDsWithCapability("live");return e?.size&&this._needsGrid()?u` + this._gridSelectCamera(e.detail.selected)} + > + ${[...e].map((e=>this._renderCarousel(e)))} + + `:this._renderCarousel()}static get styles(){return M(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\n@keyframes warning-pulse {\n 0% {\n border: solid 2px var(--frigate-card-triggered-color-1, rgba(0, 0, 0, 0));\n }\n 50% {\n border: solid 2px var(--frigate-card-triggered-color-2, var(--warning-color));\n }\n 100% {\n border: solid 2px var(--frigate-card-triggered-color-1, rgba(0, 0, 0, 0));\n }\n}\nfrigate-card-live-carousel[triggered] {\n animation: warning-pulse 5s infinite;\n}\n\nfrigate-card-live-carousel[selected] {\n --frigate-card-triggered-color-1: var(--primary-color);\n}")}};n([d({attribute:!1})],B.prototype,"hass",void 0),n([d({attribute:!1})],B.prototype,"viewManagerEpoch",void 0),n([d({attribute:!1})],B.prototype,"nonOverriddenLiveConfig",void 0),n([d({attribute:!1})],B.prototype,"overriddenLiveConfig",void 0),n([d({attribute:!1,hasChanged:_})],B.prototype,"overrides",void 0),n([d({attribute:!1})],B.prototype,"conditionsManagerEpoch",void 0),n([d({attribute:!1})],B.prototype,"cardWideConfig",void 0),n([d({attribute:!1})],B.prototype,"cameraManager",void 0),n([d({attribute:!1})],B.prototype,"microphoneManager",void 0),n([d({attribute:!1})],B.prototype,"triggeredCameraIDs",void 0),B=n([c("frigate-card-live-grid")],B);let V=class extends h{constructor(){super(...arguments),this._controller=new O(this)}shouldUpdate(e){return this._controller.shouldUpdate()}willUpdate(){this._controller.clearMessageReceived()}render(){if(this.hass&&this.nonOverriddenLiveConfig&&this.cameraManager)return u`${Z(this._controller.getRenderEpoch(),u` + + + `)}`}static get styles(){return M(j)}};n([d({attribute:!1})],V.prototype,"conditionsManagerEpoch",void 0),n([d({attribute:!1})],V.prototype,"hass",void 0),n([d({attribute:!1})],V.prototype,"viewManagerEpoch",void 0),n([d({attribute:!1})],V.prototype,"nonOverriddenLiveConfig",void 0),n([d({attribute:!1})],V.prototype,"overriddenLiveConfig",void 0),n([d({attribute:!1,hasChanged:_})],V.prototype,"overrides",void 0),n([d({attribute:!1})],V.prototype,"cameraManager",void 0),n([d({attribute:!1})],V.prototype,"cardWideConfig",void 0),n([d({attribute:!1})],V.prototype,"microphoneManager",void 0),n([d({attribute:!1})],V.prototype,"triggeredCameraIDs",void 0),V=n([c("frigate-card-live")],V);var Y=Object.freeze({__proto__:null,get FrigateCardLive(){return V}});export{P as g,Y as i}; diff --git a/config/www/community/frigate-hass-card/index-9b434861.js.gz b/config/www/community/frigate-hass-card/index-9b434861.js.gz new file mode 100644 index 00000000..593a09a5 Binary files /dev/null and b/config/www/community/frigate-hass-card/index-9b434861.js.gz differ diff --git a/config/www/community/frigate-hass-card/index-9bf80040.js b/config/www/community/frigate-hass-card/index-9bf80040.js new file mode 100644 index 00000000..cb15a605 --- /dev/null +++ b/config/www/community/frigate-hass-card/index-9bf80040.js @@ -0,0 +1,162 @@ +import{cL as e,cM as i,cN as t,cO as a,cP as r,cQ as o,l as s,_ as n,n as d,b as g,t as c,a as h,cR as l,cI as m,cS as v,cT as p,x as u,cU as C,cV as f,e as I,r as M,cW as _,cX as w,cY as b,cZ as y,c_ as L,c$ as A,d0 as D,d1 as $,d2 as j}from"./card-45855f1f.js";import{p as z,u as k,i as S,M as E,A as N,a as x,b as T}from"./media-1a34ac2c.js"; +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const Z=e(class extends i{constructor(){super(...arguments),this.key=t}render(e,i){return this.key=e,i}update(e,[i,t]){return i!==this.key&&(a(e),this.key=i),t}});class O{constructor(e){this._inBackground=!1,this._messageReceived=!1,this._lastMediaLoadedInfo=null,this._renderEpoch=0,this._handleMessage=e=>{this._messageReceived=!0,this._inBackground&&(e.stopPropagation(),this._renderEpoch++)},this._handleMediaLoaded=e=>{this._lastMediaLoadedInfo={source:e.composedPath()[0],mediaLoadedInfo:e.detail},this._inBackground&&e.stopPropagation()},this._host=e,e.addController(this),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}shouldUpdate(){return!(this._inBackground&&this._messageReceived)}hostConnected(){this._intersectionObserver.observe(this._host),this._host.addEventListener("frigate-card:media:loaded",this._handleMediaLoaded),this._host.addEventListener("frigate-card:message",this._handleMessage)}hostDisconnected(){this._intersectionObserver.disconnect(),this._host.removeEventListener("frigate-card:media:loaded",this._handleMediaLoaded),this._host.removeEventListener("frigate-card:message",this._handleMessage)}clearMessageReceived(){this._messageReceived=!1}isInBackground(){return this._inBackground}getRenderEpoch(){return this._renderEpoch}_intersectionHandler(e){const i=this._inBackground;this._inBackground=!e.some((e=>e.isIntersecting)),this._inBackground||this._messageReceived||!this._lastMediaLoadedInfo||r(this._lastMediaLoadedInfo.source,this._lastMediaLoadedInfo.mediaLoadedInfo),i!==this._inBackground&&this._host.requestUpdate()}}const P=(e,i,t)=>{if(!t?.camera_entity)return o(e,s("error.no_live_camera"),{context:t}),null;const a=i.states[t.camera_entity];return a||(o(e,s("error.live_camera_not_found"),{context:t}),null)};let G=class extends h{constructor(){super(...arguments),this.load=!1,this.label="",this._isVideoMediaLoaded=!1,this._refProvider=l(),this._importPromises=[]}async play(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await z(this,this._refProvider.value)}async pause(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.pause())}async mute(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.mute())}async unmute(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.unmute())}isMuted(){return this._refProvider.value?.isMuted()??!0}async seek(e){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.seek(e))}async setControls(e){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.setControls(e))}isPaused(){return this._refProvider.value?.isPaused()??!0}async getScreenshotURL(){return await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.getScreenshotURL())??null}_getResolvedProvider(){return"auto"===this.cameraConfig?.live_provider?this.cameraConfig?.webrtc_card?.entity||this.cameraConfig?.webrtc_card?.url?"webrtc-card":this.cameraConfig?.camera_entity?"ha":this.cameraConfig?.frigate.camera_name?"jsmpeg":m.cameras.live_provider:this.cameraConfig?.live_provider||"image"}_shouldShowImageDuringLoading(){return!!this.cameraConfig?.camera_entity&&!!this.hass&&!!this.liveConfig?.show_image_during_load}disconnectedCallback(){this._isVideoMediaLoaded=!1}_videoMediaShowHandler(){this._isVideoMediaLoaded=!0}willUpdate(e){if(e.has("load")&&(this.load||(this._isVideoMediaLoaded=!1,v(this))),e.has("liveConfig")&&(this.liveConfig?.show_image_during_load&&this._importPromises.push(import("./image-c0a8dc12.js")),this.liveConfig?.zoomable&&this._importPromises.push(import("./zoomer-28db7d93.js"))),e.has("cameraConfig")){const e=this._getResolvedProvider();"jsmpeg"===e?this._importPromises.push(import("./jsmpeg-05cdf58e.js")):"ha"===e?this._importPromises.push(import("./ha-1d1cb9a1.js")):"webrtc-card"===e?this._importPromises.push(import("./webrtc-card-171319e4.js")):"image"===e?this._importPromises.push(import("./image-c0a8dc12.js")):"go2rtc"===e&&this._importPromises.push(import("./index-d3be62c7.js")),k(this,this.cameraConfig?.dimensions?.layout),this.style.aspectRatio=p({ratio:this.cameraConfig?.dimensions?.aspect_ratio})}}async getUpdateComplete(){const e=await super.getUpdateComplete();return await Promise.all(this._importPromises),this._importPromises=[],e}_useZoomIfRequired(e){return this.liveConfig?.zoomable?u` this.cameraConfig?.dimensions?.layout?{pan:this.cameraConfig.dimensions.layout.pan,zoom:this.cameraConfig.dimensions.layout.zoom}:void 0))} + .settings=${this.zoomSettings} + @frigate-card:zoom:zoomed=${()=>this.setControls(!1)} + @frigate-card:zoom:unzoomed=${()=>this.setControls()} + > + ${e} + `:e}render(){if(!(this.load&&this.hass&&this.liveConfig&&this.cameraConfig))return;this.title=this.label,this.ariaLabel=this.label;const e=this._getResolvedProvider(),i=!this._isVideoMediaLoaded&&this._shouldShowImageDuringLoading(),t={hidden:i};if("ha"===e||"image"===e){const e=P(this,this.hass,this.cameraConfig);if(!e)return;if("unavailable"===e.state)return v(this),C({message:`${s("error.live_camera_unavailable")}${this.label?`: ${this.label}`:""}`,type:"info",icon:"mdi:cctv-off",dotdotdot:!0})}return u`${this._useZoomIfRequired(u` + ${i||"image"===e?u` {"image"===e?this._videoMediaShowHandler():i.stopPropagation()}} + > + `:u``} + ${"ha"===e?u` + `:"go2rtc"===e?u` + `:"webrtc-card"===e?u` + `:"jsmpeg"===e?u` + `:u``} + `)} + ${i&&!this._isVideoMediaLoaded?u``:""} `}static get styles(){return M(':host {\n background-color: var(--primary-background-color);\n background-position: center;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJjYW1lcmEtaXJpcy5zdmciCiAgIGlkPSJzdmc0IgogICB2ZXJzaW9uPSIxLjEiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjYjkzZTNlIgogICAgIGJvcmRlcmNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcm9wYWNpdHk9IjAuMjUiCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuNjA3ODQzMTQiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyNi42MjUwNiIKICAgICBpbmtzY2FwZTpjeD0iLTEuOTM0MjY4IgogICAgIGlua3NjYXBlOmN5PSIxNS42ODA3MTYiCiAgICAgaW5rc2NhcGU6d2luZG93LXdpZHRoPSIzODQwIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjE1MjciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEwODAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjIyNyIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiIC8+CiAgPGcKICAgICBpZD0iZzExMTkiCiAgICAgc3R5bGU9ImZpbGwtb3BhY2l0eTowLjA1O2ZpbGw6I2ZmZmZmZiI+CiAgICA8Y2lyY2xlCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eTowLjA1O3N0cm9rZS13aWR0aDoxLjM5NzI5IgogICAgICAgaWQ9InBhdGgxNzAiCiAgICAgICBjeD0iMTIiCiAgICAgICBjeT0iMTIiCiAgICAgICBpbmtzY2FwZTpsYWJlbD0iV2hpdGUgQmFja2dyb3VuZCIKICAgICAgIHI9IjExLjI1IiAvPgogICAgPHBhdGgKICAgICAgIGQ9Ik0gMTMuNzMwMDAxLDE1IDkuODMwMDAwMywyMS43NiBDIDEwLjUzLDIxLjkxIDExLjI1LDIyIDEyLDIyIGMgMi40MDAwMDEsMCA0LjYsLTAuODUgNi4zMiwtMi4yNSBMIDE0LjY2MDAwMSwxMy40IE0gMi40NjAwMDAzLDE1IGMgMC45MiwyLjkyIDMuMTUsNS4yNiA1Ljk5LDYuMzQgTCAxMi4xMiwxNSBtIC0zLjU3OTk5OTcsLTMgLTMuOSwtNi43NDk5OTk2IGMgLTEuNjQsMS43NDk5OTkgLTIuNjQsNC4xMzk5OTkzIC0yLjY0LDYuNzQ5OTk5NiAwLDAuNjggMC4wNywxLjM1IDAuMiwyIGggNy40OSBNIDIxLjgsOS45OTk5OTk3IEggMTQuMzEwMDAxIEwgMTQuNjAwMDAxLDEwLjUgMTkuMzYsMTguNzUgQyAyMSwxNi45NyAyMiwxNC42IDIyLDEyIDIyLDExLjMxIDIxLjkzLDEwLjY0IDIxLjgsOS45OTk5OTk3IG0gLTAuMjYsLTEgQyAyMC42Miw2LjA3MDAwMDUgMTguMzksMy43NDAwMDAyIDE1LjU1MDAwMSwyLjY2MDAwMDIgTCAxMS44OCw4Ljk5OTk5OTcgTSA5LjQwMDAwMDMsMTAuNSAxNC4xNzAwMDEsMi4yNDAwMDAyIGMgLTAuNywtMC4xNSAtMS40MjAwMDEsLTAuMjQgLTIuMTcwMDAxLC0wLjI0IC0yLjM5OTk5OTcsMCAtNC41OTk5OTk3LDAuODQgLTYuMzE5OTk5NywyLjI1MDAwMDMgbCAzLjY2LDYuMzQ5OTk5NSB6IgogICAgICAgaWQ9InBhdGgyIgogICAgICAgaW5rc2NhcGU6bGFiZWw9IklyaXMiCiAgICAgICBzdHlsZT0iZmlsbC1vcGFjaXR5OjAuMDU7ZmlsbDojZmZmZmZmIiAvPgogIDwvZz4KPC9zdmc+Cg==");\n background-size: 10%;\n background-position: center;\n}\n\n:host {\n display: block;\n height: 100%;\n width: 100%;\n position: relative;\n}\n\n.hidden {\n display: none;\n}\n\nha-icon {\n position: absolute;\n top: 10px;\n right: 10px;\n color: var(--primary-color);\n}')}};n([d({attribute:!1})],G.prototype,"hass",void 0),n([d({attribute:!1})],G.prototype,"cameraConfig",void 0),n([d({attribute:!1})],G.prototype,"cameraEndpoints",void 0),n([d({attribute:!1})],G.prototype,"liveConfig",void 0),n([d({attribute:!0,type:Boolean})],G.prototype,"load",void 0),n([d({attribute:!1})],G.prototype,"label",void 0),n([d({attribute:!1})],G.prototype,"cardWideConfig",void 0),n([d({attribute:!1})],G.prototype,"microphoneStream",void 0),n([d({attribute:!1})],G.prototype,"zoomSettings",void 0),n([g()],G.prototype,"_isVideoMediaLoaded",void 0),G=n([c("frigate-card-live-provider")],G);const W="frigate-card-live-provider";let U=class extends h{constructor(){super(...arguments),this._cameraToSlide={},this._refPTZControl=l(),this._refCarousel=l(),this._mediaActionsController=new E,this._mediaHasLoaded=!1}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._mediaActionsController.destroy(),super.disconnectedCallback()}_getTransitionEffect(){return this.overriddenLiveConfig?.transition_effect??m.live.transition_effect}_getSelectedCameraIndex(){if(this.viewFilterCameraID)return 0;const e=this.cameraManager?.getStore().getCameraIDsWithCapability("live"),i=this.viewManagerEpoch?.manager.getView();return e?.size&&i?Math.max(0,Array.from(e).indexOf(i.camera)):0}willUpdate(e){(e.has("microphoneManager")||e.has("overriddenLiveConfig"))&&this._mediaActionsController.setOptions({playerSelector:W,...this.overriddenLiveConfig?.auto_play&&{autoPlayConditions:this.overriddenLiveConfig.auto_play},...this.overriddenLiveConfig?.auto_pause&&{autoPauseConditions:this.overriddenLiveConfig.auto_pause},...this.overriddenLiveConfig?.auto_mute&&{autoMuteConditions:this.overriddenLiveConfig.auto_mute},...this.overriddenLiveConfig?.auto_unmute&&{autoUnmuteConditions:this.overriddenLiveConfig.auto_unmute},...(this.overriddenLiveConfig?.auto_unmute||this.overriddenLiveConfig?.auto_mute)&&{microphoneManager:this.microphoneManager,microphoneMuteSeconds:this.overriddenLiveConfig.microphone.mute_after_microphone_mute_seconds}})}_getPlugins(){return[N({...this.overriddenLiveConfig?.lazy_load&&{lazyLoadCallback:(e,i)=>this._lazyloadOrUnloadSlide("load",e,i)},lazyUnloadConditions:this.overriddenLiveConfig?.lazy_unload,lazyUnloadCallback:(e,i)=>this._lazyloadOrUnloadSlide("unload",e,i)}),x(),T()]}_getLazyLoadCount(){return!1===this.overriddenLiveConfig?.lazy_load?null:0}_getSlides(){if(!this.cameraManager)return[[],{}];const e=this.viewManagerEpoch?.manager.getView(),i=this.viewFilterCameraID?new Set([this.viewFilterCameraID]):this.cameraManager?.getStore().getCameraIDsWithCapability("live"),t=[],a={};for(const[r,o]of this.cameraManager.getStore().getCameraConfigEntries(i)){const i=this._getSubstreamCameraID(r,e),s=r===i?o:this.cameraManager?.getStore().getCameraConfig(i),n=s?this._renderLive(i,s):null;n&&(a[r]=t.length,t.push(n))}return[t,a]}_setViewHandler(e){const i=this.cameraManager?.getStore().getCameraIDsWithCapability("live");i?.size&&e.detail.index!==this._getSelectedCameraIndex()&&this._setViewCameraID([...i][e.detail.index])}_setViewCameraID(e){e&&this.viewManagerEpoch?.manager.setViewByParametersWithNewQuery({params:{camera:e}})}_lazyloadOrUnloadSlide(e,i,t){t instanceof HTMLSlotElement&&(t=t.assignedElements({flatten:!0})[0]);const a=t?.querySelector(W);a&&(a.load="load"===e)}_renderLive(e,i){if(!(this.overriddenLiveConfig&&this.nonOverriddenLiveConfig&&this.hass&&this.cameraManager&&this.conditionsManagerEpoch))return;let t=null;try{t=w(this.conditionsManagerEpoch.manager,{live:this.nonOverriddenLiveConfig},{configOverrides:this.overrides,stateOverrides:{camera:e},schema:b}).live}catch(e){return y(this,e)}const a=this.cameraManager.getCameraMetadata(e),r=this.viewManagerEpoch?.manager.getView();return u` +
+ this.cameraManager?.getCameraEndpoints(e)??void 0))} + .label=${a?.title??""} + .liveConfig=${t} + .hass=${this.hass} + .cardWideConfig=${this.cardWideConfig} + .zoomSettings=${r?.context?.zoom?.[e]?.requested} + @frigate-card:zoom:change=${i=>L(i,this.viewManagerEpoch?.manager,e)} + > + +
+ `}_getCameraIDsOfNeighbors(){const e=this.cameraManager?[...this.cameraManager?.getStore().getCameraIDsWithCapability("live")]:[],i=this.viewManagerEpoch?.manager.getView();if(this.viewFilterCameraID||e.length<=1||!i||!this.hass)return[null,null];const t=this.viewFilterCameraID??i.camera,a=e.indexOf(t);return a<0?[null,null]:[e[a>0?a-1:e.length-1],e[a+11,[r,o]=this._getCameraIDsOfNeighbors(),s=r?this.cameraManager.getCameraMetadata(this._getSubstreamCameraID(r,e)):null,n=o?this.cameraManager.getCameraMetadata(this._getSubstreamCameraID(o,e)):null,d=!(!this._mediaHasLoaded||this.viewFilterCameraID&&this.viewFilterCameraID!==e.camera||!1===e.context?.ptzControls?.enabled)&&e.context?.ptzControls?.enabled;return u` + {this._mediaHasLoaded=!0}} + @frigate-card:media:unloaded=${()=>{this._mediaHasLoaded=!1}} + > + {this._setViewCameraID(r),A(e)}} + > + + ${i} + {this._setViewCameraID(o),A(e)}} + > + + + + + `}_setMediaTarget(){const e=this.viewManagerEpoch?.manager.getView(),i=this._getSelectedCameraIndex();this.viewFilterCameraID?this._mediaActionsController.setTarget(i,e?.camera===this.viewFilterCameraID):this._mediaActionsController.setTarget(i,!0)}updated(e){super.updated(e);let i=!1;!this._mediaActionsController.hasRoot()&&this._refCarousel.value&&(this._mediaActionsController.initialize(this._refCarousel.value),i=!0),(i||e.has("viewManagerEpoch"))&&this._setMediaTarget()}static get styles(){return M(":host {\n display: block;\n --video-max-height: none;\n}\n\n:host(:not([grid-id])) {\n height: 100%;\n}\n\n:host([unselected]) frigate-card-carousel {\n pointer-events: none;\n}\n\n.embla__slide {\n display: flex;\n justify-content: center;\n height: 100%;\n flex: 0 0 100%;\n}")}};n([d({attribute:!1})],U.prototype,"hass",void 0),n([d({attribute:!1})],U.prototype,"viewManagerEpoch",void 0),n([d({attribute:!1})],U.prototype,"nonOverriddenLiveConfig",void 0),n([d({attribute:!1})],U.prototype,"overriddenLiveConfig",void 0),n([d({attribute:!1,hasChanged:_})],U.prototype,"overrides",void 0),n([d({attribute:!1})],U.prototype,"conditionsManagerEpoch",void 0),n([d({attribute:!1})],U.prototype,"cardWideConfig",void 0),n([d({attribute:!1})],U.prototype,"cameraManager",void 0),n([d({attribute:!1})],U.prototype,"microphoneManager",void 0),n([d({attribute:!1})],U.prototype,"viewFilterCameraID",void 0),n([g()],U.prototype,"_mediaHasLoaded",void 0),U=n([c("frigate-card-live-carousel")],U);let B=class extends h{_renderCarousel(e){const i=this.viewManagerEpoch?.manager.getView(),t=e??i?.camera;return u` + + + `}_gridSelectCamera(e){this.viewManagerEpoch?.manager.setViewByParameters({params:{camera:e}})}_needsGrid(){const e=this.cameraManager?.getStore().getCameraIDsWithCapability("live"),i=this.viewManagerEpoch?.manager.getView();return!!i?.isGrid()&&!!i?.supportsMultipleDisplayModes()&&!!e&&e.size>1}willUpdate(e){e.has("viewManagerEpoch")&&this._needsGrid()&&import("./media-grid-0f7352bc.js")}render(){if(!this.conditionsManagerEpoch||!this.nonOverriddenLiveConfig)return;const e=this.cameraManager?.getStore().getCameraIDsWithCapability("live");return e?.size&&this._needsGrid()?u` + this._gridSelectCamera(e.detail.selected)} + > + ${[...e].map((e=>this._renderCarousel(e)))} + + `:this._renderCarousel()}static get styles(){return M(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\n@keyframes warning-pulse {\n 0% {\n border: solid 2px var(--frigate-card-triggered-color-1, rgba(0, 0, 0, 0));\n }\n 50% {\n border: solid 2px var(--frigate-card-triggered-color-2, var(--warning-color));\n }\n 100% {\n border: solid 2px var(--frigate-card-triggered-color-1, rgba(0, 0, 0, 0));\n }\n}\nfrigate-card-live-carousel[triggered] {\n animation: warning-pulse 5s infinite;\n}\n\nfrigate-card-live-carousel[selected] {\n --frigate-card-triggered-color-1: var(--primary-color);\n}")}};n([d({attribute:!1})],B.prototype,"hass",void 0),n([d({attribute:!1})],B.prototype,"viewManagerEpoch",void 0),n([d({attribute:!1})],B.prototype,"nonOverriddenLiveConfig",void 0),n([d({attribute:!1})],B.prototype,"overriddenLiveConfig",void 0),n([d({attribute:!1,hasChanged:_})],B.prototype,"overrides",void 0),n([d({attribute:!1})],B.prototype,"conditionsManagerEpoch",void 0),n([d({attribute:!1})],B.prototype,"cardWideConfig",void 0),n([d({attribute:!1})],B.prototype,"cameraManager",void 0),n([d({attribute:!1})],B.prototype,"microphoneManager",void 0),n([d({attribute:!1})],B.prototype,"triggeredCameraIDs",void 0),B=n([c("frigate-card-live-grid")],B);let V=class extends h{constructor(){super(...arguments),this._controller=new O(this)}shouldUpdate(e){return this._controller.shouldUpdate()}willUpdate(){this._controller.clearMessageReceived()}render(){if(this.hass&&this.nonOverriddenLiveConfig&&this.cameraManager)return u`${Z(this._controller.getRenderEpoch(),u` + + + `)}`}static get styles(){return M(j)}};n([d({attribute:!1})],V.prototype,"conditionsManagerEpoch",void 0),n([d({attribute:!1})],V.prototype,"hass",void 0),n([d({attribute:!1})],V.prototype,"viewManagerEpoch",void 0),n([d({attribute:!1})],V.prototype,"nonOverriddenLiveConfig",void 0),n([d({attribute:!1})],V.prototype,"overriddenLiveConfig",void 0),n([d({attribute:!1,hasChanged:_})],V.prototype,"overrides",void 0),n([d({attribute:!1})],V.prototype,"cameraManager",void 0),n([d({attribute:!1})],V.prototype,"cardWideConfig",void 0),n([d({attribute:!1})],V.prototype,"microphoneManager",void 0),n([d({attribute:!1})],V.prototype,"triggeredCameraIDs",void 0),V=n([c("frigate-card-live")],V);var Y=Object.freeze({__proto__:null,get FrigateCardLive(){return V}});export{P as g,Y as i}; diff --git a/config/www/community/frigate-hass-card/index-9bf80040.js.gz b/config/www/community/frigate-hass-card/index-9bf80040.js.gz new file mode 100644 index 00000000..3e1f9c5d Binary files /dev/null and b/config/www/community/frigate-hass-card/index-9bf80040.js.gz differ diff --git a/config/www/community/frigate-hass-card/index-a3bb8676.js b/config/www/community/frigate-hass-card/index-a3bb8676.js new file mode 100644 index 00000000..4f95ecba --- /dev/null +++ b/config/www/community/frigate-hass-card/index-a3bb8676.js @@ -0,0 +1 @@ +import{ds as e,dt as t,du as i,dv as s,a as n,di as o,l as a,cP as c,x as r,r as h,_ as d,n as l,b as p,t as m}from"./card-320adb66.js";import{s as u,h as v,c as y,d as g}from"./dispatch-live-error-c649b480.js";import{c as f}from"./endpoint-a6d38c7a.js";import"./image-88fcb8ac.js";import{m as b}from"./audio-cf3a75aa.js";import{g as w}from"./get-technology-for-video-rtc-778a0c05.js";class S extends HTMLElement{constructor(){super(),this.DISCONNECT_TIMEOUT=5e3,this.RECONNECT_TIMEOUT=15e3,this.CODECS=["avc1.640029","avc1.64002A","avc1.640033","hvc1.1.6.L153.B0","mp4a.40.2","mp4a.40.5","flac","opus"],this.mode="webrtc,mse,hls,mjpeg",this.media="video,audio",this.background=!1,this.visibilityThreshold=0,this.visibilityCheck=!0,this.pcConfig={bundlePolicy:"max-bundle",iceServers:[{urls:"stun:stun.l.google.com:19302"}],sdpSemantics:"unified-plan"},this.wsState=WebSocket.CLOSED,this.pcState=WebSocket.CLOSED,this.video=null,this.ws=null,this.wsURL="",this.pc=null,this.connectTS=0,this.mseCodecs="",this.disconnectTID=0,this.reconnectTID=0,this.ondata=null,this.onmessage=null,this.microphoneStream=null,this.containingPlayer=null,this.controls=!0}reconnect(){this.wsState!==WebSocket.CLOSED?(this.ws?.addEventListener("close",(()=>this.onconnect())),this.ondisconnect()):(this.ondisconnect(),this.onconnect())}set src(e){"string"!=typeof e&&(e=e.toString()),e.startsWith("http")?e="ws"+e.substring(4):e.startsWith("/")&&(e="ws"+location.origin.substring(4)+e),this.wsURL=e,this.onconnect()}play(){}send(e){this.ws&&this.ws.send(JSON.stringify(e))}codecs(e){return this.CODECS.filter((e=>this.media.indexOf(e.indexOf("vc1")>0?"video":"audio")>=0)).filter((t=>e(`video/mp4; codecs="${t}"`))).join()}connectedCallback(){if(this.disconnectTID&&(clearTimeout(this.disconnectTID),this.disconnectTID=0),this.video){const e=this.video.seekable;e.length>0&&(this.video.currentTime=e.end(e.length-1)),this.play()}else this.oninit();this.onconnect()}disconnectedCallback(){this.background||this.disconnectTID||this.wsState===WebSocket.CLOSED&&this.pcState===WebSocket.CLOSED||(this.disconnectTID=setTimeout((()=>{this.reconnectTID&&(clearTimeout(this.reconnectTID),this.reconnectTID=0),this.disconnectTID=0,this.ondisconnect()}),this.DISCONNECT_TIMEOUT))}oninit(){this.video=document.createElement("video"),u(this.video,this.controls),this.video.playsInline=!0,this.video.preload="auto",this.video.style.display="block",this.video.style.width="100%",this.video.style.height="100%",this.appendChild(this.video),this.video.addEventListener("error",(e=>{this.ws&&this.wsState===WebSocket.OPEN&&this.ws.close()}));const n=window.navigator.userAgent.match(/Version\/(\d+).+Safari/);if(n){const e=n[1]<"13"?"mp4a.40.2":n[1]<"14"?"flac":"opus";this.CODECS.splice(this.CODECS.indexOf(e))}if(!this.background){if("hidden"in document&&this.visibilityCheck&&document.addEventListener("visibilitychange",(()=>{document.hidden?this.disconnectedCallback():this.isConnected&&this.connectedCallback()})),"IntersectionObserver"in window&&this.visibilityThreshold){new IntersectionObserver((e=>{e.forEach((e=>{e.isIntersecting?this.isConnected&&this.connectedCallback():this.disconnectedCallback()}))}),{threshold:this.visibilityThreshold}).observe(this)}this.video.onloadeddata=()=>{this.controls&&v(this.video,y),e(this,this.video,{player:this.containingPlayer,capabilities:{supports2WayAudio:!!this.pc,supportsPause:!0,hasAudio:b(this.video)},technology:w(this)})},this.video.onvolumechange=()=>t(this),this.video.onplay=()=>i(this),this.video.onpause=()=>s(this),this.video.muted=!0}}onconnect(){return!(!this.isConnected||!this.wsURL||this.ws||this.pc)&&(this.wsState=WebSocket.CONNECTING,this.connectTS=Date.now(),this.ws=new WebSocket(this.wsURL),this.ws.binaryType="arraybuffer",this.ws.addEventListener("open",(e=>this.onopen(e))),this.ws.addEventListener("close",(e=>this.onclose(e))),!0)}ondisconnect(){this.wsState=WebSocket.CLOSED,this.ws&&(this.ws.close(),this.ws=null),this.pcState=WebSocket.CLOSED,this.pc&&(this.pc.getSenders().forEach((e=>{e.track&&e.track.stop()})),this.pc.close(),this.pc=null),this.video.src="",this.video.srcObject=null}onopen(){this.wsState=WebSocket.OPEN,this.ws.addEventListener("message",(e=>{if("string"==typeof e.data){const t=JSON.parse(e.data);for(const e in this.onmessage)this.onmessage[e](t)}else this.ondata(e.data)})),this.ondata=null,this.onmessage={};const e=[];return this.mode.indexOf("mse")>=0&&("MediaSource"in window||"ManagedMediaSource"in window)?(e.push("mse"),this.onmse()):this.mode.indexOf("hls")>=0&&this.video.canPlayType("application/vnd.apple.mpegurl")?(e.push("hls"),this.onhls()):this.mode.indexOf("mp4")>=0&&(e.push("mp4"),this.onmp4()),this.mode.indexOf("webrtc")>=0&&"RTCPeerConnection"in window&&(e.push("webrtc"),this.onwebrtc()),this.mode.indexOf("mjpeg")>=0&&(e.length?this.onmessage.mjpeg=t=>{"error"===t.type&&0===t.value.indexOf(e[0])&&this.onmjpeg()}:(e.push("mjpeg"),this.onmjpeg())),e}onclose(){if(this.wsState===WebSocket.CLOSED)return!1;this.wsState=WebSocket.CONNECTING,this.ws=null;const e=Math.max(this.RECONNECT_TIMEOUT-(Date.now()-this.connectTS),0);return this.reconnectTID=setTimeout((()=>{this.reconnectTID=0,this.onconnect()}),e),!0}onmse(){let e;if("ManagedMediaSource"in window){const t=window.ManagedMediaSource;e=new t,e.addEventListener("sourceopen",(()=>{this.send({type:"mse",value:this.codecs(t.isTypeSupported)})}),{once:!0}),this.video.disableRemotePlayback=!0,this.video.srcObject=e}else e=new MediaSource,e.addEventListener("sourceopen",(()=>{URL.revokeObjectURL(this.video.src),this.send({type:"mse",value:this.codecs(MediaSource.isTypeSupported)})}),{once:!0}),this.video.src=URL.createObjectURL(e),this.video.srcObject=null;this.play(),this.mseCodecs="",this.onmessage.mse=t=>{if("mse"!==t.type)return;this.mseCodecs=t.value;const i=e.addSourceBuffer(t.value);i.mode="segments",i.addEventListener("updateend",(()=>{if(!i.updating)try{if(n>0){const e=s.slice(0,n);n=0,i.appendBuffer(e)}else if(i.buffered&&i.buffered.length){const t=i.buffered.end(i.buffered.length-1)-15,s=i.buffered.start(0);t>s&&(i.remove(s,t),e.setLiveSeekableRange(t,t+15))}}catch(e){}}));const s=new Uint8Array(2097152);let n=0;this.ondata=e=>{if(i.updating||n>0){const t=new Uint8Array(e);s.set(t,n),n+=t.byteLength}else try{i.appendBuffer(e)}catch(e){}}}}onwebrtc(){const e=new RTCPeerConnection(this.pcConfig);e.addEventListener("icecandidate",(e=>{if(e.candidate&&this.mode.indexOf("webrtc/tcp")>=0&&"udp"===e.candidate.protocol)return;const t=e.candidate?e.candidate.toJSON().candidate:"";this.send({type:"webrtc/candidate",value:t})})),e.addEventListener("connectionstatechange",(()=>{if("connected"===e.connectionState){const t=e.getTransceivers().filter((e=>"recvonly"===e.currentDirection)).map((e=>e.receiver.track)),i=document.createElement("video");i.addEventListener("loadeddata",(()=>this.onpcvideo(i)),{once:!0}),i.srcObject=new MediaStream(t)}else"failed"!==e.connectionState&&"disconnected"!==e.connectionState||(e.close(),this.pcState=WebSocket.CLOSED,this.pc=null,this.onconnect())})),this.onmessage.webrtc=t=>{switch(t.type){case"webrtc/candidate":if(this.mode.indexOf("webrtc/tcp")>=0&&t.value.indexOf(" udp ")>0)return;e.addIceCandidate({candidate:t.value,sdpMid:"0"}).catch((e=>{console.warn(e)}));break;case"webrtc/answer":e.setRemoteDescription({type:"answer",sdp:t.value}).catch((e=>{console.warn(e)}));break;case"error":if(t.value.indexOf("webrtc/offer")<0)return;e.close()}},this.createOffer(e).then((e=>{this.send({type:"webrtc/offer",value:e.sdp})})),this.pcState=WebSocket.CONNECTING,this.pc=e}async createOffer(e){this.microphoneStream?.getTracks().forEach((t=>{e.addTransceiver(t,{direction:"sendonly"})}));try{if(this.media.indexOf("microphone")>=0){(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach((t=>{e.addTransceiver(t,{direction:"sendonly"})}))}}catch(e){console.warn(e)}for(const t of["video","audio"])this.media.indexOf(t)>=0&&e.addTransceiver(t,{direction:"recvonly"});const t=await e.createOffer();return await e.setLocalDescription(t),t}onpcvideo(e){if(this.pc){let t=0,i=0;const s=e.srcObject;s.getVideoTracks().length>0&&(t+=544),s.getAudioTracks().length>0&&(t+=258),this.mseCodecs.indexOf("hvc1.")>=0&&(i+=560),this.mseCodecs.indexOf("avc1.")>=0&&(i+=528),this.mseCodecs.indexOf("mp4a.")>=0&&(i+=257),t>=i?(this.video.srcObject=s,this.play(),this.pcState=WebSocket.OPEN,this.wsState=WebSocket.CLOSED,this.ws&&(this.ws.close(),this.ws=null)):(this.pcState=WebSocket.CLOSED,this.pc&&(this.pc.close(),this.pc=null))}e.srcObject=null}onmjpeg(){let t=!1;this.ondata=i=>{u(this.video,!1),this.video.poster="data:image/jpeg;base64,"+S.btoa(i),t||(t=!0,e(this,this.video,{player:this.containingPlayer,technology:["mjpeg"]}))},this.send({type:"mjpeg"})}onhls(){this.onmessage.hls=e=>{if("hls"!==e.type)return;const t="http"+this.wsURL.substring(2,this.wsURL.indexOf("/ws"))+"/hls/",i=e.value.replace("hls/",t);this.video.src="data:application/vnd.apple.mpegurl;base64,"+btoa(i),this.play()},this.send({type:"hls",value:this.codecs((e=>this.video.canPlayType(e)))})}onmp4(){const t=document.createElement("canvas");let i;const s=document.createElement("video");s.autoplay=!0,s.playsInline=!0,s.muted=!0,s.addEventListener("loadeddata",(n=>{i||(t.width=s.videoWidth,t.height=s.videoHeight,i=t.getContext("2d"),e(this,s,{player:this.containingPlayer,technology:["mp4"]})),i.drawImage(s,0,0,t.width,t.height),u(this.video,!1),this.video.poster=t.toDataURL("image/jpeg")})),this.ondata=e=>{s.src="data:video/mp4;base64,"+S.btoa(e)},this.send({type:"mp4",value:this.codecs(this.video.canPlayType)})}static btoa(e){const t=new Uint8Array(e),i=t.byteLength;let s="";for(let e=0;ethis.onconnect())),this.ondisconnect()):(this.ondisconnect(),this.onconnect())}set src(e){"string"!=typeof e&&(e=e.toString()),e.startsWith("http")?e="ws"+e.substring(4):e.startsWith("/")&&(e="ws"+location.origin.substring(4)+e),this.wsURL=e,this.onconnect()}play(){}send(e){this.ws&&this.ws.send(JSON.stringify(e))}codecs(e){return this.CODECS.filter((e=>this.media.indexOf(e.indexOf("vc1")>0?"video":"audio")>=0)).filter((t=>e(`video/mp4; codecs="${t}"`))).join()}connectedCallback(){if(this.disconnectTID&&(clearTimeout(this.disconnectTID),this.disconnectTID=0),this.video){const e=this.video.seekable;e.length>0&&(this.video.currentTime=e.end(e.length-1)),this.play()}else this.oninit();this.onconnect()}disconnectedCallback(){this.background||this.disconnectTID||this.wsState===WebSocket.CLOSED&&this.pcState===WebSocket.CLOSED||(this.disconnectTID=setTimeout((()=>{this.reconnectTID&&(clearTimeout(this.reconnectTID),this.reconnectTID=0),this.disconnectTID=0,this.ondisconnect()}),this.DISCONNECT_TIMEOUT))}oninit(){this.video=document.createElement("video"),m(this.video,this.controls),this.video.playsInline=!0,this.video.preload="auto",this.video.style.display="block",this.video.style.width="100%",this.video.style.height="100%",this.appendChild(this.video),this.video.addEventListener("error",(e=>{this.ws&&this.wsState===WebSocket.OPEN&&this.ws.close()}));const n=window.navigator.userAgent.match(/Version\/(\d+).+Safari/);if(n){const e=n[1]<"13"?"mp4a.40.2":n[1]<"14"?"flac":"opus";this.CODECS.splice(this.CODECS.indexOf(e))}if(!this.background){if("hidden"in document&&this.visibilityCheck&&document.addEventListener("visibilitychange",(()=>{document.hidden?this.disconnectedCallback():this.isConnected&&this.connectedCallback()})),"IntersectionObserver"in window&&this.visibilityThreshold){new IntersectionObserver((e=>{e.forEach((e=>{e.isIntersecting?this.isConnected&&this.connectedCallback():this.disconnectedCallback()}))}),{threshold:this.visibilityThreshold}).observe(this)}this.video.onloadeddata=()=>{this.controls&&v(this.video,y),e(this,this.video,{player:this.containingPlayer,capabilities:{supports2WayAudio:!!this.pc,supportsPause:!0,hasAudio:g(this.video)},technology:f(this)})},this.video.onvolumechange=()=>t(this),this.video.onplay=()=>i(this),this.video.onpause=()=>s(this),this.video.muted=!0}}onconnect(){return!(!this.isConnected||!this.wsURL||this.ws||this.pc)&&(this.wsState=WebSocket.CONNECTING,this.connectTS=Date.now(),this.ws=new WebSocket(this.wsURL),this.ws.binaryType="arraybuffer",this.ws.addEventListener("open",(e=>this.onopen(e))),this.ws.addEventListener("close",(e=>this.onclose(e))),!0)}ondisconnect(){this.wsState=WebSocket.CLOSED,this.ws&&(this.ws.close(),this.ws=null),this.pcState=WebSocket.CLOSED,this.pc&&(this.pc.getSenders().forEach((e=>{e.track&&e.track.stop()})),this.pc.close(),this.pc=null),this.video.src="",this.video.srcObject=null}onopen(){this.wsState=WebSocket.OPEN,this.ws.addEventListener("message",(e=>{if("string"==typeof e.data){const t=JSON.parse(e.data);for(const e in this.onmessage)this.onmessage[e](t)}else this.ondata(e.data)})),this.ondata=null,this.onmessage={};const e=[];return this.mode.indexOf("mse")>=0&&("MediaSource"in window||"ManagedMediaSource"in window)?(e.push("mse"),this.onmse()):this.mode.indexOf("hls")>=0&&this.video.canPlayType("application/vnd.apple.mpegurl")?(e.push("hls"),this.onhls()):this.mode.indexOf("mp4")>=0&&(e.push("mp4"),this.onmp4()),this.mode.indexOf("webrtc")>=0&&"RTCPeerConnection"in window&&(e.push("webrtc"),this.onwebrtc()),this.mode.indexOf("mjpeg")>=0&&(e.length?this.onmessage.mjpeg=t=>{"error"===t.type&&0===t.value.indexOf(e[0])&&this.onmjpeg()}:(e.push("mjpeg"),this.onmjpeg())),e}onclose(){if(this.wsState===WebSocket.CLOSED)return!1;this.wsState=WebSocket.CONNECTING,this.ws=null;const e=Math.max(this.RECONNECT_TIMEOUT-(Date.now()-this.connectTS),0);return this.reconnectTID=setTimeout((()=>{this.reconnectTID=0,this.onconnect()}),e),!0}onmse(){let e;if("ManagedMediaSource"in window){const t=window.ManagedMediaSource;e=new t,e.addEventListener("sourceopen",(()=>{this.send({type:"mse",value:this.codecs(t.isTypeSupported)})}),{once:!0}),this.video.disableRemotePlayback=!0,this.video.srcObject=e}else e=new MediaSource,e.addEventListener("sourceopen",(()=>{URL.revokeObjectURL(this.video.src),this.send({type:"mse",value:this.codecs(MediaSource.isTypeSupported)})}),{once:!0}),this.video.src=URL.createObjectURL(e),this.video.srcObject=null;this.play(),this.mseCodecs="",this.onmessage.mse=t=>{if("mse"!==t.type)return;this.mseCodecs=t.value;const i=e.addSourceBuffer(t.value);i.mode="segments",i.addEventListener("updateend",(()=>{if(!i.updating)try{if(n>0){const e=s.slice(0,n);n=0,i.appendBuffer(e)}else if(i.buffered&&i.buffered.length){const t=i.buffered.end(i.buffered.length-1)-15,s=i.buffered.start(0);t>s&&(i.remove(s,t),e.setLiveSeekableRange(t,t+15))}}catch(e){}}));const s=new Uint8Array(2097152);let n=0;this.ondata=e=>{if(i.updating||n>0){const t=new Uint8Array(e);s.set(t,n),n+=t.byteLength}else try{i.appendBuffer(e)}catch(e){}}}}onwebrtc(){const e=new RTCPeerConnection(this.pcConfig);e.addEventListener("icecandidate",(e=>{if(e.candidate&&this.mode.indexOf("webrtc/tcp")>=0&&"udp"===e.candidate.protocol)return;const t=e.candidate?e.candidate.toJSON().candidate:"";this.send({type:"webrtc/candidate",value:t})})),e.addEventListener("connectionstatechange",(()=>{if("connected"===e.connectionState){const t=e.getTransceivers().filter((e=>"recvonly"===e.currentDirection)).map((e=>e.receiver.track)),i=document.createElement("video");i.addEventListener("loadeddata",(()=>this.onpcvideo(i)),{once:!0}),i.srcObject=new MediaStream(t)}else"failed"!==e.connectionState&&"disconnected"!==e.connectionState||(e.close(),this.pcState=WebSocket.CLOSED,this.pc=null,this.onconnect())})),this.onmessage.webrtc=t=>{switch(t.type){case"webrtc/candidate":if(this.mode.indexOf("webrtc/tcp")>=0&&t.value.indexOf(" udp ")>0)return;e.addIceCandidate({candidate:t.value,sdpMid:"0"}).catch((e=>{console.warn(e)}));break;case"webrtc/answer":e.setRemoteDescription({type:"answer",sdp:t.value}).catch((e=>{console.warn(e)}));break;case"error":if(t.value.indexOf("webrtc/offer")<0)return;e.close()}},this.createOffer(e).then((e=>{this.send({type:"webrtc/offer",value:e.sdp})})),this.pcState=WebSocket.CONNECTING,this.pc=e}async createOffer(e){this.microphoneStream?.getTracks().forEach((t=>{e.addTransceiver(t,{direction:"sendonly"})}));try{if(this.media.indexOf("microphone")>=0){(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach((t=>{e.addTransceiver(t,{direction:"sendonly"})}))}}catch(e){console.warn(e)}for(const t of["video","audio"])this.media.indexOf(t)>=0&&e.addTransceiver(t,{direction:"recvonly"});const t=await e.createOffer();return await e.setLocalDescription(t),t}onpcvideo(e){if(this.pc){let t=0,i=0;const s=e.srcObject;s.getVideoTracks().length>0&&(t+=544),s.getAudioTracks().length>0&&(t+=258),this.mseCodecs.indexOf("hvc1.")>=0&&(i+=560),this.mseCodecs.indexOf("avc1.")>=0&&(i+=528),this.mseCodecs.indexOf("mp4a.")>=0&&(i+=257),t>=i?(this.video.srcObject=s,this.play(),this.pcState=WebSocket.OPEN,this.wsState=WebSocket.CLOSED,this.ws&&(this.ws.close(),this.ws=null)):(this.pcState=WebSocket.CLOSED,this.pc&&(this.pc.close(),this.pc=null))}e.srcObject=null}onmjpeg(){let t=!1;this.ondata=i=>{m(this.video,!1),this.video.poster="data:image/jpeg;base64,"+b.btoa(i),t||(t=!0,e(this,this.video,{player:this.containingPlayer,technology:["mjpeg"]}))},this.send({type:"mjpeg"})}onhls(){this.onmessage.hls=e=>{if("hls"!==e.type)return;const t="http"+this.wsURL.substring(2,this.wsURL.indexOf("/ws"))+"/hls/",i=e.value.replace("hls/",t);this.video.src="data:application/vnd.apple.mpegurl;base64,"+btoa(i),this.play()},this.send({type:"hls",value:this.codecs((e=>this.video.canPlayType(e)))})}onmp4(){const t=document.createElement("canvas");let i;const s=document.createElement("video");s.autoplay=!0,s.playsInline=!0,s.muted=!0,s.addEventListener("loadeddata",(n=>{i||(t.width=s.videoWidth,t.height=s.videoHeight,i=t.getContext("2d"),e(this,s,{player:this.containingPlayer,technology:["mp4"]})),i.drawImage(s,0,0,t.width,t.height),m(this.video,!1),this.video.poster=t.toDataURL("image/jpeg")})),this.ondata=e=>{s.src="data:video/mp4;base64,"+b.btoa(e)},this.send({type:"mp4",value:this.codecs(this.video.canPlayType)})}static btoa(e){const t=new Uint8Array(e),i=t.byteLength;let s="";for(let e=0;ethis.onconnect())),this.ondisconnect()):(this.ondisconnect(),this.onconnect())}set src(e){"string"!=typeof e&&(e=e.toString()),e.startsWith("http")?e="ws"+e.substring(4):e.startsWith("/")&&(e="ws"+location.origin.substring(4)+e),this.wsURL=e,this.onconnect()}play(){}send(e){this.ws&&this.ws.send(JSON.stringify(e))}codecs(e){return this.CODECS.filter((e=>this.media.indexOf(e.indexOf("vc1")>0?"video":"audio")>=0)).filter((t=>e(`video/mp4; codecs="${t}"`))).join()}connectedCallback(){if(this.disconnectTID&&(clearTimeout(this.disconnectTID),this.disconnectTID=0),this.video){const e=this.video.seekable;e.length>0&&(this.video.currentTime=e.end(e.length-1)),this.play()}else this.oninit();this.onconnect()}disconnectedCallback(){this.background||this.disconnectTID||this.wsState===WebSocket.CLOSED&&this.pcState===WebSocket.CLOSED||(this.disconnectTID=setTimeout((()=>{this.reconnectTID&&(clearTimeout(this.reconnectTID),this.reconnectTID=0),this.disconnectTID=0,this.ondisconnect()}),this.DISCONNECT_TIMEOUT))}oninit(){this.video=document.createElement("video"),m(this.video,this.controls),this.video.playsInline=!0,this.video.preload="auto",this.video.style.display="block",this.video.style.width="100%",this.video.style.height="100%",this.appendChild(this.video),this.video.addEventListener("error",(e=>{this.ws&&this.wsState===WebSocket.OPEN&&this.ws.close()}));const n=window.navigator.userAgent.match(/Version\/(\d+).+Safari/);if(n){const e=n[1]<"13"?"mp4a.40.2":n[1]<"14"?"flac":"opus";this.CODECS.splice(this.CODECS.indexOf(e))}if(!this.background){if("hidden"in document&&this.visibilityCheck&&document.addEventListener("visibilitychange",(()=>{document.hidden?this.disconnectedCallback():this.isConnected&&this.connectedCallback()})),"IntersectionObserver"in window&&this.visibilityThreshold){new IntersectionObserver((e=>{e.forEach((e=>{e.isIntersecting?this.isConnected&&this.connectedCallback():this.disconnectedCallback()}))}),{threshold:this.visibilityThreshold}).observe(this)}this.video.onloadeddata=()=>{this.controls&&v(this.video,y),e(this,this.video,{player:this.containingPlayer,capabilities:{supports2WayAudio:!!this.pc,supportsPause:!0,hasAudio:g(this.video)},technology:f(this)})},this.video.onvolumechange=()=>t(this),this.video.onplay=()=>i(this),this.video.onpause=()=>s(this),this.video.muted=!0}}onconnect(){return!(!this.isConnected||!this.wsURL||this.ws||this.pc)&&(this.wsState=WebSocket.CONNECTING,this.connectTS=Date.now(),this.ws=new WebSocket(this.wsURL),this.ws.binaryType="arraybuffer",this.ws.addEventListener("open",(e=>this.onopen(e))),this.ws.addEventListener("close",(e=>this.onclose(e))),!0)}ondisconnect(){this.wsState=WebSocket.CLOSED,this.ws&&(this.ws.close(),this.ws=null),this.pcState=WebSocket.CLOSED,this.pc&&(this.pc.getSenders().forEach((e=>{e.track&&e.track.stop()})),this.pc.close(),this.pc=null),this.video.src="",this.video.srcObject=null}onopen(){this.wsState=WebSocket.OPEN,this.ws.addEventListener("message",(e=>{if("string"==typeof e.data){const t=JSON.parse(e.data);for(const e in this.onmessage)this.onmessage[e](t)}else this.ondata(e.data)})),this.ondata=null,this.onmessage={};const e=[];return this.mode.indexOf("mse")>=0&&("MediaSource"in window||"ManagedMediaSource"in window)?(e.push("mse"),this.onmse()):this.mode.indexOf("hls")>=0&&this.video.canPlayType("application/vnd.apple.mpegurl")?(e.push("hls"),this.onhls()):this.mode.indexOf("mp4")>=0&&(e.push("mp4"),this.onmp4()),this.mode.indexOf("webrtc")>=0&&"RTCPeerConnection"in window&&(e.push("webrtc"),this.onwebrtc()),this.mode.indexOf("mjpeg")>=0&&(e.length?this.onmessage.mjpeg=t=>{"error"===t.type&&0===t.value.indexOf(e[0])&&this.onmjpeg()}:(e.push("mjpeg"),this.onmjpeg())),e}onclose(){if(this.wsState===WebSocket.CLOSED)return!1;this.wsState=WebSocket.CONNECTING,this.ws=null;const e=Math.max(this.RECONNECT_TIMEOUT-(Date.now()-this.connectTS),0);return this.reconnectTID=setTimeout((()=>{this.reconnectTID=0,this.onconnect()}),e),!0}onmse(){let e;if("ManagedMediaSource"in window){const t=window.ManagedMediaSource;e=new t,e.addEventListener("sourceopen",(()=>{this.send({type:"mse",value:this.codecs(t.isTypeSupported)})}),{once:!0}),this.video.disableRemotePlayback=!0,this.video.srcObject=e}else e=new MediaSource,e.addEventListener("sourceopen",(()=>{URL.revokeObjectURL(this.video.src),this.send({type:"mse",value:this.codecs(MediaSource.isTypeSupported)})}),{once:!0}),this.video.src=URL.createObjectURL(e),this.video.srcObject=null;this.play(),this.mseCodecs="",this.onmessage.mse=t=>{if("mse"!==t.type)return;this.mseCodecs=t.value;const i=e.addSourceBuffer(t.value);i.mode="segments",i.addEventListener("updateend",(()=>{if(!i.updating)try{if(n>0){const e=s.slice(0,n);n=0,i.appendBuffer(e)}else if(i.buffered&&i.buffered.length){const t=i.buffered.end(i.buffered.length-1)-15,s=i.buffered.start(0);t>s&&(i.remove(s,t),e.setLiveSeekableRange(t,t+15))}}catch(e){}}));const s=new Uint8Array(2097152);let n=0;this.ondata=e=>{if(i.updating||n>0){const t=new Uint8Array(e);s.set(t,n),n+=t.byteLength}else try{i.appendBuffer(e)}catch(e){}}}}onwebrtc(){const e=new RTCPeerConnection(this.pcConfig);e.addEventListener("icecandidate",(e=>{if(e.candidate&&this.mode.indexOf("webrtc/tcp")>=0&&"udp"===e.candidate.protocol)return;const t=e.candidate?e.candidate.toJSON().candidate:"";this.send({type:"webrtc/candidate",value:t})})),e.addEventListener("connectionstatechange",(()=>{if("connected"===e.connectionState){const t=e.getTransceivers().filter((e=>"recvonly"===e.currentDirection)).map((e=>e.receiver.track)),i=document.createElement("video");i.addEventListener("loadeddata",(()=>this.onpcvideo(i)),{once:!0}),i.srcObject=new MediaStream(t)}else"failed"!==e.connectionState&&"disconnected"!==e.connectionState||(e.close(),this.pcState=WebSocket.CLOSED,this.pc=null,this.onconnect())})),this.onmessage.webrtc=t=>{switch(t.type){case"webrtc/candidate":if(this.mode.indexOf("webrtc/tcp")>=0&&t.value.indexOf(" udp ")>0)return;e.addIceCandidate({candidate:t.value,sdpMid:"0"}).catch((e=>{console.warn(e)}));break;case"webrtc/answer":e.setRemoteDescription({type:"answer",sdp:t.value}).catch((e=>{console.warn(e)}));break;case"error":if(t.value.indexOf("webrtc/offer")<0)return;e.close()}},this.createOffer(e).then((e=>{this.send({type:"webrtc/offer",value:e.sdp})})),this.pcState=WebSocket.CONNECTING,this.pc=e}async createOffer(e){this.microphoneStream?.getTracks().forEach((t=>{e.addTransceiver(t,{direction:"sendonly"})}));try{if(this.media.indexOf("microphone")>=0){(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach((t=>{e.addTransceiver(t,{direction:"sendonly"})}))}}catch(e){console.warn(e)}for(const t of["video","audio"])this.media.indexOf(t)>=0&&e.addTransceiver(t,{direction:"recvonly"});const t=await e.createOffer();return await e.setLocalDescription(t),t}onpcvideo(e){if(this.pc){let t=0,i=0;const s=e.srcObject;s.getVideoTracks().length>0&&(t+=544),s.getAudioTracks().length>0&&(t+=258),this.mseCodecs.indexOf("hvc1.")>=0&&(i+=560),this.mseCodecs.indexOf("avc1.")>=0&&(i+=528),this.mseCodecs.indexOf("mp4a.")>=0&&(i+=257),t>=i?(this.video.srcObject=s,this.play(),this.pcState=WebSocket.OPEN,this.wsState=WebSocket.CLOSED,this.ws&&(this.ws.close(),this.ws=null)):(this.pcState=WebSocket.CLOSED,this.pc&&(this.pc.close(),this.pc=null))}e.srcObject=null}onmjpeg(){let t=!1;this.ondata=i=>{m(this.video,!1),this.video.poster="data:image/jpeg;base64,"+b.btoa(i),t||(t=!0,e(this,this.video,{player:this.containingPlayer,technology:["mjpeg"]}))},this.send({type:"mjpeg"})}onhls(){this.onmessage.hls=e=>{if("hls"!==e.type)return;const t="http"+this.wsURL.substring(2,this.wsURL.indexOf("/ws"))+"/hls/",i=e.value.replace("hls/",t);this.video.src="data:application/vnd.apple.mpegurl;base64,"+btoa(i),this.play()},this.send({type:"hls",value:this.codecs((e=>this.video.canPlayType(e)))})}onmp4(){const t=document.createElement("canvas");let i;const s=document.createElement("video");s.autoplay=!0,s.playsInline=!0,s.muted=!0,s.addEventListener("loadeddata",(n=>{i||(t.width=s.videoWidth,t.height=s.videoHeight,i=t.getContext("2d"),e(this,s,{player:this.containingPlayer,technology:["mp4"]})),i.drawImage(s,0,0,t.width,t.height),m(this.video,!1),this.video.poster=t.toDataURL("image/jpeg")})),this.ondata=e=>{s.src="data:video/mp4;base64,"+b.btoa(e)},this.send({type:"mp4",value:this.codecs(this.video.canPlayType)})}static btoa(e){const t=new Uint8Array(e),i=t.byteLength;let s="";for(let e=0;e{this._messageReceived=!0,this._inBackground&&(e.stopPropagation(),this._renderEpoch++)},this._handleMediaLoaded=e=>{this._lastMediaLoadedInfo={source:e.composedPath()[0],mediaLoadedInfo:e.detail},this._inBackground&&e.stopPropagation()},this._host=e,e.addController(this),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}shouldUpdate(){return!(this._inBackground&&this._messageReceived)}hostConnected(){this._intersectionObserver.observe(this._host),this._host.addEventListener("frigate-card:media:loaded",this._handleMediaLoaded),this._host.addEventListener("frigate-card:message",this._handleMessage)}hostDisconnected(){this._intersectionObserver.disconnect(),this._host.removeEventListener("frigate-card:media:loaded",this._handleMediaLoaded),this._host.removeEventListener("frigate-card:message",this._handleMessage)}clearMessageReceived(){this._messageReceived=!1}isInBackground(){return this._inBackground}getRenderEpoch(){return this._renderEpoch}_intersectionHandler(e){const i=this._inBackground;this._inBackground=!e.some((e=>e.isIntersecting)),this._inBackground||this._messageReceived||!this._lastMediaLoadedInfo||r(this._lastMediaLoadedInfo.source,this._lastMediaLoadedInfo.mediaLoadedInfo),i!==this._inBackground&&this._host.requestUpdate()}}const P=(e,i,t)=>{if(!t?.camera_entity)return o(e,s("error.no_live_camera"),{context:t}),null;const a=i.states[t.camera_entity];return a||(o(e,s("error.live_camera_not_found"),{context:t}),null)};let G=class extends h{constructor(){super(...arguments),this.load=!1,this.label="",this._isVideoMediaLoaded=!1,this._refProvider=l(),this._importPromises=[]}async play(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await z(this,this._refProvider.value)}async pause(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.pause())}async mute(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.mute())}async unmute(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.unmute())}isMuted(){return this._refProvider.value?.isMuted()??!0}async seek(e){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.seek(e))}async setControls(e){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.setControls(e))}isPaused(){return this._refProvider.value?.isPaused()??!0}async getScreenshotURL(){return await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.getScreenshotURL())??null}_getResolvedProvider(){return"auto"===this.cameraConfig?.live_provider?this.cameraConfig?.webrtc_card?.entity||this.cameraConfig?.webrtc_card?.url?"webrtc-card":this.cameraConfig?.camera_entity?"ha":this.cameraConfig?.frigate.camera_name?"jsmpeg":m.cameras.live_provider:this.cameraConfig?.live_provider||"image"}_shouldShowImageDuringLoading(){return!!this.cameraConfig?.camera_entity&&!!this.hass&&!!this.liveConfig?.show_image_during_load}disconnectedCallback(){this._isVideoMediaLoaded=!1}_videoMediaShowHandler(){this._isVideoMediaLoaded=!0}willUpdate(e){if(e.has("load")&&(this.load||(this._isVideoMediaLoaded=!1,v(this))),e.has("liveConfig")&&(this.liveConfig?.show_image_during_load&&this._importPromises.push(import("./image-cdeb2c7e.js")),this.liveConfig?.zoomable&&this._importPromises.push(import("./zoomer-37e20bdd.js"))),e.has("cameraConfig")){const e=this._getResolvedProvider();"jsmpeg"===e?this._importPromises.push(import("./jsmpeg-fd152ef0.js")):"ha"===e?this._importPromises.push(import("./ha-a4f2c69e.js")):"webrtc-card"===e?this._importPromises.push(import("./webrtc-card-a9018c5e.js")):"image"===e?this._importPromises.push(import("./image-cdeb2c7e.js")):"go2rtc"===e&&this._importPromises.push(import("./index-e0b66e9f.js")),k(this,this.cameraConfig?.dimensions?.layout),this.style.aspectRatio=p({ratio:this.cameraConfig?.dimensions?.aspect_ratio})}}async getUpdateComplete(){const e=await super.getUpdateComplete();return await Promise.all(this._importPromises),this._importPromises=[],e}_useZoomIfRequired(e){return this.liveConfig?.zoomable?u` this.cameraConfig?.dimensions?.layout?{pan:this.cameraConfig.dimensions.layout.pan,zoom:this.cameraConfig.dimensions.layout.zoom}:void 0))} + .settings=${this.zoomSettings} + @frigate-card:zoom:zoomed=${()=>this.setControls(!1)} + @frigate-card:zoom:unzoomed=${()=>this.setControls()} + > + ${e} + `:e}render(){if(!(this.load&&this.hass&&this.liveConfig&&this.cameraConfig))return;this.title=this.label,this.ariaLabel=this.label;const e=this._getResolvedProvider(),i=!this._isVideoMediaLoaded&&this._shouldShowImageDuringLoading(),t={hidden:i};if("ha"===e||"image"===e){const e=P(this,this.hass,this.cameraConfig);if(!e)return;if("unavailable"===e.state)return v(this),C({message:`${s("error.live_camera_unavailable")}${this.label?`: ${this.label}`:""}`,type:"info",icon:"mdi:cctv-off",dotdotdot:!0})}return u`${this._useZoomIfRequired(u` + ${i||"image"===e?u` {"image"===e?this._videoMediaShowHandler():i.stopPropagation()}} + > + `:u``} + ${"ha"===e?u` + `:"go2rtc"===e?u` + `:"webrtc-card"===e?u` + `:"jsmpeg"===e?u` + `:u``} + `)} + ${i&&!this._isVideoMediaLoaded?u``:""} `}static get styles(){return M(':host {\n background-color: var(--primary-background-color);\n background-position: center;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJjYW1lcmEtaXJpcy5zdmciCiAgIGlkPSJzdmc0IgogICB2ZXJzaW9uPSIxLjEiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjYjkzZTNlIgogICAgIGJvcmRlcmNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcm9wYWNpdHk9IjAuMjUiCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuNjA3ODQzMTQiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyNi42MjUwNiIKICAgICBpbmtzY2FwZTpjeD0iLTEuOTM0MjY4IgogICAgIGlua3NjYXBlOmN5PSIxNS42ODA3MTYiCiAgICAgaW5rc2NhcGU6d2luZG93LXdpZHRoPSIzODQwIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjE1MjciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEwODAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjIyNyIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiIC8+CiAgPGcKICAgICBpZD0iZzExMTkiCiAgICAgc3R5bGU9ImZpbGwtb3BhY2l0eTowLjA1O2ZpbGw6I2ZmZmZmZiI+CiAgICA8Y2lyY2xlCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eTowLjA1O3N0cm9rZS13aWR0aDoxLjM5NzI5IgogICAgICAgaWQ9InBhdGgxNzAiCiAgICAgICBjeD0iMTIiCiAgICAgICBjeT0iMTIiCiAgICAgICBpbmtzY2FwZTpsYWJlbD0iV2hpdGUgQmFja2dyb3VuZCIKICAgICAgIHI9IjExLjI1IiAvPgogICAgPHBhdGgKICAgICAgIGQ9Ik0gMTMuNzMwMDAxLDE1IDkuODMwMDAwMywyMS43NiBDIDEwLjUzLDIxLjkxIDExLjI1LDIyIDEyLDIyIGMgMi40MDAwMDEsMCA0LjYsLTAuODUgNi4zMiwtMi4yNSBMIDE0LjY2MDAwMSwxMy40IE0gMi40NjAwMDAzLDE1IGMgMC45MiwyLjkyIDMuMTUsNS4yNiA1Ljk5LDYuMzQgTCAxMi4xMiwxNSBtIC0zLjU3OTk5OTcsLTMgLTMuOSwtNi43NDk5OTk2IGMgLTEuNjQsMS43NDk5OTkgLTIuNjQsNC4xMzk5OTkzIC0yLjY0LDYuNzQ5OTk5NiAwLDAuNjggMC4wNywxLjM1IDAuMiwyIGggNy40OSBNIDIxLjgsOS45OTk5OTk3IEggMTQuMzEwMDAxIEwgMTQuNjAwMDAxLDEwLjUgMTkuMzYsMTguNzUgQyAyMSwxNi45NyAyMiwxNC42IDIyLDEyIDIyLDExLjMxIDIxLjkzLDEwLjY0IDIxLjgsOS45OTk5OTk3IG0gLTAuMjYsLTEgQyAyMC42Miw2LjA3MDAwMDUgMTguMzksMy43NDAwMDAyIDE1LjU1MDAwMSwyLjY2MDAwMDIgTCAxMS44OCw4Ljk5OTk5OTcgTSA5LjQwMDAwMDMsMTAuNSAxNC4xNzAwMDEsMi4yNDAwMDAyIGMgLTAuNywtMC4xNSAtMS40MjAwMDEsLTAuMjQgLTIuMTcwMDAxLC0wLjI0IC0yLjM5OTk5OTcsMCAtNC41OTk5OTk3LDAuODQgLTYuMzE5OTk5NywyLjI1MDAwMDMgbCAzLjY2LDYuMzQ5OTk5NSB6IgogICAgICAgaWQ9InBhdGgyIgogICAgICAgaW5rc2NhcGU6bGFiZWw9IklyaXMiCiAgICAgICBzdHlsZT0iZmlsbC1vcGFjaXR5OjAuMDU7ZmlsbDojZmZmZmZmIiAvPgogIDwvZz4KPC9zdmc+Cg==");\n background-size: 10%;\n background-position: center;\n}\n\n:host {\n display: block;\n height: 100%;\n width: 100%;\n position: relative;\n}\n\n.hidden {\n display: none;\n}\n\nha-icon {\n position: absolute;\n top: 10px;\n right: 10px;\n color: var(--primary-color);\n}')}};n([d({attribute:!1})],G.prototype,"hass",void 0),n([d({attribute:!1})],G.prototype,"cameraConfig",void 0),n([d({attribute:!1})],G.prototype,"cameraEndpoints",void 0),n([d({attribute:!1})],G.prototype,"liveConfig",void 0),n([d({attribute:!0,type:Boolean})],G.prototype,"load",void 0),n([d({attribute:!1})],G.prototype,"label",void 0),n([d({attribute:!1})],G.prototype,"cardWideConfig",void 0),n([d({attribute:!1})],G.prototype,"microphoneStream",void 0),n([d({attribute:!1})],G.prototype,"zoomSettings",void 0),n([g()],G.prototype,"_isVideoMediaLoaded",void 0),G=n([c("frigate-card-live-provider")],G);const W="frigate-card-live-provider";let U=class extends h{constructor(){super(...arguments),this._cameraToSlide={},this._refPTZControl=l(),this._refCarousel=l(),this._mediaActionsController=new E,this._mediaHasLoaded=!1}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._mediaActionsController.destroy(),super.disconnectedCallback()}_getTransitionEffect(){return this.overriddenLiveConfig?.transition_effect??m.live.transition_effect}_getSelectedCameraIndex(){if(this.viewFilterCameraID)return 0;const e=this.cameraManager?.getStore().getCameraIDsWithCapability("live"),i=this.viewManagerEpoch?.manager.getView();return e?.size&&i?Math.max(0,Array.from(e).indexOf(i.camera)):0}willUpdate(e){(e.has("microphoneManager")||e.has("overriddenLiveConfig"))&&this._mediaActionsController.setOptions({playerSelector:W,...this.overriddenLiveConfig?.auto_play&&{autoPlayConditions:this.overriddenLiveConfig.auto_play},...this.overriddenLiveConfig?.auto_pause&&{autoPauseConditions:this.overriddenLiveConfig.auto_pause},...this.overriddenLiveConfig?.auto_mute&&{autoMuteConditions:this.overriddenLiveConfig.auto_mute},...this.overriddenLiveConfig?.auto_unmute&&{autoUnmuteConditions:this.overriddenLiveConfig.auto_unmute},...(this.overriddenLiveConfig?.auto_unmute||this.overriddenLiveConfig?.auto_mute)&&{microphoneManager:this.microphoneManager,microphoneMuteSeconds:this.overriddenLiveConfig.microphone.mute_after_microphone_mute_seconds}})}_getPlugins(){return[N({...this.overriddenLiveConfig?.lazy_load&&{lazyLoadCallback:(e,i)=>this._lazyloadOrUnloadSlide("load",e,i)},lazyUnloadConditions:this.overriddenLiveConfig?.lazy_unload,lazyUnloadCallback:(e,i)=>this._lazyloadOrUnloadSlide("unload",e,i)}),x(),T()]}_getLazyLoadCount(){return!1===this.overriddenLiveConfig?.lazy_load?null:0}_getSlides(){if(!this.cameraManager)return[[],{}];const e=this.viewManagerEpoch?.manager.getView(),i=this.viewFilterCameraID?new Set([this.viewFilterCameraID]):this.cameraManager?.getStore().getCameraIDsWithCapability("live"),t=[],a={};for(const[r,o]of this.cameraManager.getStore().getCameraConfigEntries(i)){const i=this._getSubstreamCameraID(r,e),s=r===i?o:this.cameraManager?.getStore().getCameraConfig(i),n=s?this._renderLive(i,s):null;n&&(a[r]=t.length,t.push(n))}return[t,a]}_setViewHandler(e){const i=this.cameraManager?.getStore().getCameraIDsWithCapability("live");i?.size&&e.detail.index!==this._getSelectedCameraIndex()&&this._setViewCameraID([...i][e.detail.index])}_setViewCameraID(e){e&&this.viewManagerEpoch?.manager.setViewByParametersWithNewQuery({params:{camera:e}})}_lazyloadOrUnloadSlide(e,i,t){t instanceof HTMLSlotElement&&(t=t.assignedElements({flatten:!0})[0]);const a=t?.querySelector(W);a&&(a.load="load"===e)}_renderLive(e,i){if(!(this.overriddenLiveConfig&&this.nonOverriddenLiveConfig&&this.hass&&this.cameraManager&&this.conditionsManagerEpoch))return;let t=null;try{t=w(this.conditionsManagerEpoch.manager,{live:this.nonOverriddenLiveConfig},{configOverrides:this.overrides,stateOverrides:{camera:e},schema:b}).live}catch(e){return y(this,e)}const a=this.cameraManager.getCameraMetadata(e),r=this.viewManagerEpoch?.manager.getView();return u` +
+ this.cameraManager?.getCameraEndpoints(e)??void 0))} + .label=${a?.title??""} + .liveConfig=${t} + .hass=${this.hass} + .cardWideConfig=${this.cardWideConfig} + .zoomSettings=${r?.context?.zoom?.[e]?.requested} + @frigate-card:zoom:change=${i=>L(i,this.viewManagerEpoch?.manager,e)} + > + +
+ `}_getCameraIDsOfNeighbors(){const e=this.cameraManager?[...this.cameraManager?.getStore().getCameraIDsWithCapability("live")]:[],i=this.viewManagerEpoch?.manager.getView();if(this.viewFilterCameraID||e.length<=1||!i||!this.hass)return[null,null];const t=this.viewFilterCameraID??i.camera,a=e.indexOf(t);return a<0?[null,null]:[e[a>0?a-1:e.length-1],e[a+11,[r,o]=this._getCameraIDsOfNeighbors(),s=r?this.cameraManager.getCameraMetadata(this._getSubstreamCameraID(r,e)):null,n=o?this.cameraManager.getCameraMetadata(this._getSubstreamCameraID(o,e)):null,d=!(!this._mediaHasLoaded||this.viewFilterCameraID&&this.viewFilterCameraID!==e.camera||!1===e.context?.ptzControls?.enabled)&&e.context?.ptzControls?.enabled;return u` + {this._mediaHasLoaded=!0}} + @frigate-card:media:unloaded=${()=>{this._mediaHasLoaded=!1}} + > + {this._setViewCameraID(r),A(e)}} + > + + ${i} + {this._setViewCameraID(o),A(e)}} + > + + + + + `}_setMediaTarget(){const e=this.viewManagerEpoch?.manager.getView(),i=this._getSelectedCameraIndex();this.viewFilterCameraID?this._mediaActionsController.setTarget(i,e?.camera===this.viewFilterCameraID):this._mediaActionsController.setTarget(i,!0)}updated(e){super.updated(e);let i=!1;!this._mediaActionsController.hasRoot()&&this._refCarousel.value&&(this._mediaActionsController.initialize(this._refCarousel.value),i=!0),(i||e.has("viewManagerEpoch"))&&this._setMediaTarget()}static get styles(){return M(":host {\n display: block;\n --video-max-height: none;\n}\n\n:host(:not([grid-id])) {\n height: 100%;\n}\n\n:host([unselected]) frigate-card-carousel {\n pointer-events: none;\n}\n\n.embla__slide {\n display: flex;\n justify-content: center;\n height: 100%;\n flex: 0 0 100%;\n}")}};n([d({attribute:!1})],U.prototype,"hass",void 0),n([d({attribute:!1})],U.prototype,"viewManagerEpoch",void 0),n([d({attribute:!1})],U.prototype,"nonOverriddenLiveConfig",void 0),n([d({attribute:!1})],U.prototype,"overriddenLiveConfig",void 0),n([d({attribute:!1,hasChanged:_})],U.prototype,"overrides",void 0),n([d({attribute:!1})],U.prototype,"conditionsManagerEpoch",void 0),n([d({attribute:!1})],U.prototype,"cardWideConfig",void 0),n([d({attribute:!1})],U.prototype,"cameraManager",void 0),n([d({attribute:!1})],U.prototype,"microphoneManager",void 0),n([d({attribute:!1})],U.prototype,"viewFilterCameraID",void 0),n([g()],U.prototype,"_mediaHasLoaded",void 0),U=n([c("frigate-card-live-carousel")],U);let B=class extends h{_renderCarousel(e){const i=this.viewManagerEpoch?.manager.getView(),t=e??i?.camera;return u` + + + `}_gridSelectCamera(e){this.viewManagerEpoch?.manager.setViewByParameters({params:{camera:e}})}_needsGrid(){const e=this.cameraManager?.getStore().getCameraIDsWithCapability("live"),i=this.viewManagerEpoch?.manager.getView();return!!i?.isGrid()&&!!i?.supportsMultipleDisplayModes()&&!!e&&e.size>1}willUpdate(e){e.has("viewManagerEpoch")&&this._needsGrid()&&import("./media-grid-ef47501a.js")}render(){if(!this.conditionsManagerEpoch||!this.nonOverriddenLiveConfig)return;const e=this.cameraManager?.getStore().getCameraIDsWithCapability("live");return e?.size&&this._needsGrid()?u` + this._gridSelectCamera(e.detail.selected)} + > + ${[...e].map((e=>this._renderCarousel(e)))} + + `:this._renderCarousel()}static get styles(){return M(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\n@keyframes warning-pulse {\n 0% {\n border: solid 2px var(--frigate-card-triggered-color-1, rgba(0, 0, 0, 0));\n }\n 50% {\n border: solid 2px var(--frigate-card-triggered-color-2, var(--warning-color));\n }\n 100% {\n border: solid 2px var(--frigate-card-triggered-color-1, rgba(0, 0, 0, 0));\n }\n}\nfrigate-card-live-carousel[triggered] {\n animation: warning-pulse 5s infinite;\n}\n\nfrigate-card-live-carousel[selected] {\n --frigate-card-triggered-color-1: var(--primary-color);\n}")}};n([d({attribute:!1})],B.prototype,"hass",void 0),n([d({attribute:!1})],B.prototype,"viewManagerEpoch",void 0),n([d({attribute:!1})],B.prototype,"nonOverriddenLiveConfig",void 0),n([d({attribute:!1})],B.prototype,"overriddenLiveConfig",void 0),n([d({attribute:!1,hasChanged:_})],B.prototype,"overrides",void 0),n([d({attribute:!1})],B.prototype,"conditionsManagerEpoch",void 0),n([d({attribute:!1})],B.prototype,"cardWideConfig",void 0),n([d({attribute:!1})],B.prototype,"cameraManager",void 0),n([d({attribute:!1})],B.prototype,"microphoneManager",void 0),n([d({attribute:!1})],B.prototype,"triggeredCameraIDs",void 0),B=n([c("frigate-card-live-grid")],B);let V=class extends h{constructor(){super(...arguments),this._controller=new O(this)}shouldUpdate(e){return this._controller.shouldUpdate()}willUpdate(){this._controller.clearMessageReceived()}render(){if(this.hass&&this.nonOverriddenLiveConfig&&this.cameraManager)return u`${Z(this._controller.getRenderEpoch(),u` + + + `)}`}static get styles(){return M(j)}};n([d({attribute:!1})],V.prototype,"conditionsManagerEpoch",void 0),n([d({attribute:!1})],V.prototype,"hass",void 0),n([d({attribute:!1})],V.prototype,"viewManagerEpoch",void 0),n([d({attribute:!1})],V.prototype,"nonOverriddenLiveConfig",void 0),n([d({attribute:!1})],V.prototype,"overriddenLiveConfig",void 0),n([d({attribute:!1,hasChanged:_})],V.prototype,"overrides",void 0),n([d({attribute:!1})],V.prototype,"cameraManager",void 0),n([d({attribute:!1})],V.prototype,"cardWideConfig",void 0),n([d({attribute:!1})],V.prototype,"microphoneManager",void 0),n([d({attribute:!1})],V.prototype,"triggeredCameraIDs",void 0),V=n([c("frigate-card-live")],V);var Y=Object.freeze({__proto__:null,get FrigateCardLive(){return V}});export{P as g,Y as i}; diff --git a/config/www/community/frigate-hass-card/index-e610f971.js.gz b/config/www/community/frigate-hass-card/index-e610f971.js.gz new file mode 100644 index 00000000..3f4b28c3 Binary files /dev/null and b/config/www/community/frigate-hass-card/index-e610f971.js.gz differ diff --git a/config/www/community/frigate-hass-card/jsmpeg-05cdf58e.js b/config/www/community/frigate-hass-card/jsmpeg-05cdf58e.js new file mode 100644 index 00000000..ae20ce44 --- /dev/null +++ b/config/www/community/frigate-hass-card/jsmpeg-05cdf58e.js @@ -0,0 +1,12 @@ +import{cL as A,eN as t,dC as i,eO as e,a as s,dD as o,dy as g,dz as I,dw as a,cQ as B,l as r,x as C,dl as n,r as E,_ as Q,n as h,t as d}from"./card-45855f1f.js";import{g as c}from"./endpoint-f74ef6db.js";function l(){return l=Object.assign?Object.assign.bind():function(A){for(var t=1;t"string"==typeof A&&A.constructor===String,D=function(A){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t=A,"Promise"===Object.prototype.toString.call(t).slice(8,-1)?A:new Promise((t=>{A(),setTimeout(t,i)}))};var m="WJ3NAvwFY9",f="tR2-0dd-e1",y="ZgIIHVSSYI",R="kAA8SjbHe2",k="OueN4AU4CJ";!function(A,t){void 0===t&&(t={});var i=t.insertAt;if(A&&"undefined"!=typeof document){var e=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css","top"===i&&e.firstChild?e.insertBefore(s,e.firstChild):e.appendChild(s),s.styleSheet?s.styleSheet.cssText=A:s.appendChild(document.createTextNode(A))}}(".WJ3NAvwFY9,.ZgIIHVSSYI,.kAA8SjbHe2,.tR2-0dd-e1{height:100%;left:0;position:absolute;top:0;width:100%;z-index:1}.ZgIIHVSSYI{-ms-flex-pack:center;-ms-flex-align:center;-webkit-align-items:center;align-items:center;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-justify-content:center;justify-content:center}.WJ3NAvwFY9,.tR2-0dd-e1{display:block}.tR2-0dd-e1.OueN4AU4CJ{display:none}.ZgIIHVSSYI,.kAA8SjbHe2{-webkit-tap-highlight-color:rgba(255,0,0,0);cursor:pointer;opacity:.7}.OueN4AU4CJ.ZgIIHVSSYI,.OueN4AU4CJ.kAA8SjbHe2{display:none}.ZgIIHVSSYI{z-index:10}.ZgIIHVSSYI>svg{fill:#fff;height:12vw;max-height:60px;max-width:60px;width:12vw}.kAA8SjbHe2{-ms-flex-pack:end;-ms-flex-align:end;-webkit-align-items:flex-end;align-items:flex-end;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-justify-content:flex-end;justify-content:flex-end;z-index:10}.kAA8SjbHe2>svg{fill:#fff;height:9vw;margin:0 15px 15px 0;max-height:40px;max-width:40px;width:9vw}");var b=function(){function A(A,t,i,e){var s=void 0===i?{}:i,o=s.canvas,g=void 0===o?"":o,I=s.poster,a=void 0===I?"":I,B=s.autoplay,r=void 0!==B&&B,C=s.autoSetWrapperSize,n=void 0!==C&&C,E=s.loop,Q=void 0!==E&&E,h=s.control,d=void 0===h||h,c=s.decodeFirstFrame,u=void 0===c||c,w=s.picMode,D=void 0!==w&&w,m=s.progressive,f=void 0===m||m,y=s.chunkSize,R=void 0===y?1048576:y,k=s.hooks,b=void 0===k?{}:k;void 0===e&&(e={}),this.options=l({videoUrl:t,canvas:g,poster:a,picMode:D,autoplay:r,autoSetWrapperSize:n,loop:Q,control:d,decodeFirstFrame:u,progressive:f,chunkSize:R,hooks:l({play:function(){},pause:function(){},stop:function(){},load:function(){}},b)},e),this.options.needPlayButton=this.options.control&&!this.options.picMode,this.player=null,this.els={wrapper:p(A)?document.querySelector(A):A,canvas:null,playButton:document.createElement("div"),unmuteButton:null,poster:null},"static"===window.getComputedStyle(this.els.wrapper).getPropertyValue("position")&&(this.els.wrapper.style.position="relative"),this.els.wrapper.clientRect=this.els.wrapper.getBoundingClientRect(),this.initCanvas(),this.initPlayButton(),this.initPlayer()}var t=A.prototype;return t.initCanvas=function(){this.options.canvas?this.els.canvas=p(this.options.canvas)?document.querySelector(this.options.canvas):this.options.canvas:(this.els.canvas=document.createElement("canvas"),this.els.canvas.classList.add(m),this.els.wrapper.appendChild(this.els.canvas))},t.initPlayer=function(){var A=this;this.options=l(this.options,{canvas:this.els.canvas});var t=l({},this.options,{autoplay:!1});if(this.player=new X(this.options.videoUrl,t,{play:function(){A.options.needPlayButton&&A.els.playButton.classList.add(k),A.els.poster&&A.els.poster.classList.add(k),A.options.hooks.play()},pause:function(){A.options.needPlayButton&&A.els.playButton.classList.remove(k),A.options.hooks.pause()},stop:function(){A.els.poster&&A.els.poster.classList.remove(k),A.options.hooks.stop()},load:function(){A.options.autoplay&&A.play(),A._autoSetWrapperSize(),A.options.hooks.load()}}),this._copyPlayerFuncs(),this.els.wrapper.playerInstance=this.player,!this.options.poster||this.options.autoplay||this.player.options.streaming||(this.options.decodeFirstFrame=!1,this.els.poster=new Image,this.els.poster.src=this.options.poster,this.els.poster.classList.add(f),this.els.wrapper.appendChild(this.els.poster)),this.player.options.streaming||this.els.wrapper.addEventListener("click",this.onClick.bind(this)),(this.options.autoplay||this.player.options.streaming)&&this.els.playButton.classList.add(k),this.player.audioOut&&!this.player.audioOut.unlocked){var i=this.els.wrapper;(this.options.autoplay||this.player.options.streaming)&&(this.els.unmuteButton=document.createElement("div"),this.els.unmuteButton.innerHTML='\n\n \n\n',this.els.unmuteButton.classList.add(R),this.els.wrapper.appendChild(this.els.unmuteButton),i=this.els.unmuteButton),this.unlockAudioBound=this.onUnlockAudio.bind(this,i),i.addEventListener("touchstart",this.unlockAudioBound,!1),i.addEventListener("click",this.unlockAudioBound,!0)}},t.initPlayButton=function(){this.options.needPlayButton&&(this.els.playButton.classList.add(y),this.els.playButton.innerHTML='\n\n \n\n',this.els.wrapper.appendChild(this.els.playButton))},t._autoSetWrapperSize=function(){var A=this;if(!this.options.autoSetWrapperSize)return Promise.resolve();var t=this.player.video.destination;return t?Promise.resolve().then((function(){return D((function(){A.els.wrapper.style.width=t.width+"px",A.els.wrapper.style.height=t.height+"px"}))})):Promise.resolve()},t.onUnlockAudio=function(A,t){var i=this;this.els.unmuteButton&&(t.preventDefault(),t.stopPropagation()),this.player.audioOut.unlock((function(){i.els.unmuteButton&&i.els.unmuteButton.classList.add(k),A.removeEventListener("touchstart",i.unlockAudioBound),A.removeEventListener("click",i.unlockAudioBound)}))},t.onClick=function(){this.options.control&&(this.player.isPlaying?this.pause():this.play())},t._copyPlayerFuncs=function(){var A=this;this.play=function(){return A.player.play()},this.pause=function(){return A.player.pause()},this.stop=function(){return A.player.stop()},this.destroy=function(){A.player.destroy(),A.els.wrapper.innerHTML="",A.els.wrapper.playerInstance=null}},A}(),S=function(){return window.performance?window.performance.now()/1e3:Date.now()/1e3},G=function(A,t){if(A.fill)A.fill(t);else for(var i=0;iA&&this.loadNextChunk())},t.destroy=function(){this.request.abort(),this.aborted=!0},t.loadNextChunk=function(){var A=this,t=this.loadedSize,i=Math.min(this.loadedSize+this.chunkSize-1,this.fileSize-1);if(t>=this.fileSize||this.aborted)return this.completed=!0,void(this.onCompletedCallback&&this.onCompletedCallback(this));this.isLoading=!0,this.loadStartTime=S(),this.request=new XMLHttpRequest,this.request.onreadystatechange=function(){A.request.readyState===A.request.DONE&&A.request.status>=200&&A.request.status<300?A.onChunkLoad(A.request.response):A.request.readyState===A.request.DONE&&A.loadFails++<3&&A.loadNextChunk()},0===t&&(this.request.onprogress=this.onProgress.bind(this)),this.request.open("GET",this.url+"?"+t+"-"+i),this.request.setRequestHeader("Range","bytes="+t+"-"+i),this.request.responseType="arraybuffer",this.request.send()},t.onProgress=function(A){this.progress=A.loaded/A.total},t.onChunkLoad=function(A){var t=!this.established;this.established=!0,this.progress=1,this.loadedSize+=A.byteLength,this.loadFails=0,this.isLoading=!1,t&&this.hookOnEstablished&&this.hookOnEstablished(),t&&this.onEstablishedCallback&&this.onEstablishedCallback(this),this.destination&&this.destination.write(A),this.loadTime=S()-this.loadStartTime,this.throttled||this.loadNextChunk()},A}(),N=function(){function A(A,t){this.url=A,this.options=t,this.socket=null,this.streaming=!0,this.callbacks={connect:[],data:[]},this.destination=null,this.reconnectInterval=void 0!==t.reconnectInterval?t.reconnectInterval:5,this.shouldAttemptReconnect=!!this.reconnectInterval,this.completed=!1,this.established=!1,this.progress=0,this.reconnectTimeoutId=0,this.onEstablishedCallback=t.onSourceEstablished,this.onCompletedCallback=t.onSourceCompleted,t.hookOnEstablished&&(this.hookOnEstablished=t.hookOnEstablished)}var t=A.prototype;return t.connect=function(A){this.destination=A},t.destroy=function(){clearTimeout(this.reconnectTimeoutId),this.shouldAttemptReconnect=!1,this.socket.close()},t.start=function(){this.shouldAttemptReconnect=!!this.reconnectInterval,this.progress=0,this.established=!1,this.options.protocols?this.socket=new WebSocket(this.url,this.options.protocols):this.socket=new WebSocket(this.url),this.socket.binaryType="arraybuffer",this.socket.onmessage=this.onMessage.bind(this),this.socket.onopen=this.onOpen.bind(this),this.socket.onerror=this.onClose.bind(this),this.socket.onclose=this.onClose.bind(this)},t.resume=function(){},t.onOpen=function(){this.progress=1},t.onClose=function(){var A=this;this.shouldAttemptReconnect&&(clearTimeout(this.reconnectTimeoutId),this.reconnectTimeoutId=setTimeout((function(){A.start()}),1e3*this.reconnectInterval))},t.onMessage=function(A){var t=!this.established;this.established=!0,t&&this.hookOnEstablished&&this.hookOnEstablished(),t&&this.onEstablishedCallback&&this.onEstablishedCallback(this),this.destination&&this.destination.write(A.data)},A}(),L=function(){function A(t,i){"object"==typeof t?(this.bytes=t instanceof Uint8Array?t:new Uint8Array(t),this.byteLength=this.bytes.length):(this.bytes=new Uint8Array(t||1048576),this.byteLength=0),this.mode=i||A.MODE.EXPAND,this.index=0}var t=A.prototype;return t.resize=function(A){var t=new Uint8Array(A);0!==this.byteLength&&(this.byteLength=Math.min(this.byteLength,A),t.set(this.bytes,0,this.byteLength)),this.bytes=t,this.index=Math.min(this.index,this.byteLength<<3)},t.evict=function(A){var t=this.index>>3,i=this.bytes.length-this.byteLength;if(this.index===this.byteLength<<3||A>i+t)return this.byteLength=0,void(this.index=0);0!==t&&(this.bytes.copyWithin?this.bytes.copyWithin(0,t,this.byteLength):this.bytes.set(this.bytes.subarray(t,this.byteLength)),this.byteLength-=t,this.index-=t<<3)},t.write=function(t){var i="object"==typeof t[0],e=0,s=this.bytes.length-this.byteLength;if(i){e=0;for(var o=0;os)if(this.mode===A.MODE.EXPAND){var g=Math.max(2*this.bytes.length,e-s);this.resize(g)}else this.evict(e);if(i)for(var I=0;I>3;A>3;return A>=this.byteLength||0===this.bytes[A]&&0===this.bytes[A+1]&&1===this.bytes[A+2]},t.peek=function(A){for(var t=this.index,i=0;A;){var e=8-(7&t),s=e>3]&255>>8-s<>o,t+=s,A-=s}return i},t.read=function(A){var t=this.peek(A);return this.index+=A,t},t.skip=function(A){return this.index+=A},t.rewind=function(A){this.index=Math.max(this.index-A,0)},t.has=function(A){return(this.byteLength<<3)-this.index>=A},A}();L.MODE={EVICT:1,EXPAND:2};var U=function(){function A(){this.bits=null,this.leftoverBytes=null,this.guessVideoFrameEnd=!0,this.pidsToStreamIds={},this.pesPacketInfo={},this.startTime=0,this.currentTime=0}var t=A.prototype;return t.connect=function(A,t){this.pesPacketInfo[A]={destination:t,currentLength:0,totalLength:0,pts:0,buffers:[]}},t.write=function(A){if(this.leftoverBytes){var t=A.byteLength+this.leftoverBytes.byteLength;this.bits=new L(t),this.bits.write([this.leftoverBytes,A])}else this.bits=new L(A);for(;this.bits.has(1504)&&this.parsePacket(););var i=this.bits.byteLength-(this.bits.index>>3);this.leftoverBytes=i>0?this.bits.bytes.subarray(this.bits.index>>3):null},t.parsePacket=function(){if(71!==this.bits.read(8)&&!this.resync())return!1;var A=187+(this.bits.index>>3);this.bits.read(1);var t=this.bits.read(1);this.bits.read(1);var i=this.bits.read(13);this.bits.read(2);var e=this.bits.read(2);this.bits.read(4);var s=this.pidsToStreamIds[i];if(t&&s){var o=this.pesPacketInfo[s];o&&o.currentLength&&this.packetComplete(o)}if(1&e){if(2&e){var g=this.bits.read(8);this.bits.skip(g<<3)}if(t&&this.bits.nextBytesAreStartCode()){this.bits.skip(24),s=this.bits.read(8),this.pidsToStreamIds[i]=s;var I=this.bits.read(16);this.bits.skip(8);var a=this.bits.read(2);this.bits.skip(6);var B=this.bits.read(8),r=this.bits.index+(B<<3),C=this.pesPacketInfo[s];if(C){var n=0;if(2&a){this.bits.skip(4);var E=this.bits.read(3);this.bits.skip(1);var Q=this.bits.read(15);this.bits.skip(1);var h=this.bits.read(15);this.bits.skip(1),n=(1073741824*E+32768*Q+h)/9e4,this.currentTime=n,-1===this.startTime&&(this.startTime=n)}var d=I?I-B-3:0;this.packetStart(C,n,d)}this.bits.index=r}if(s){var c=this.pesPacketInfo[s];if(c){var l=this.bits.index>>3,u=!t&&2&e;(this.packetAddData(c,l,A)||this.guessVideoFrameEnd&&u)&&this.packetComplete(c)}}}return this.bits.index=A<<3,!0},t.resync=function(){if(!this.bits.has(9024))return!1;for(var A=this.bits.index>>3,t=0;t<187;t++)if(71===this.bits.bytes[A+t]){for(var i=!0,e=1;e<5;e++)if(71!==this.bits.bytes[A+t+188*e]){i=!1;break}if(i)return this.bits.index=A+t+1<<3,!0}return console.warn("JSMpeg: Possible garbage data. Skipping."),this.bits.skip(1496),!1},t.packetStart=function(A,t,i){A.totalLength=i,A.currentLength=0,A.pts=t},t.packetAddData=function(A,t,i){return A.buffers.push(this.bits.bytes.subarray(t,i)),A.currentLength+=i-t,0!==A.totalLength&&A.currentLength>=A.totalLength},t.packetComplete=function(A){A.destination.write(A.pts,A.buffers),A.totalLength=0,A.currentLength=0,A.buffers=[]},A}();U.STREAM={PACK_HEADER:186,SYSTEM_HEADER:187,PROGRAM_MAP:188,PRIVATE_1:189,PADDING:190,PRIVATE_2:191,AUDIO_1:192,VIDEO_1:224,DIRECTORY:255};var J=function(){function A(A){this.destination=null,this.canPlay=!1,this.collectTimestamps=!A.streaming,this.bytesWritten=0,this.timestamps=[],this.timestampIndex=0,this.startTime=0,this.decodedTime=0,Object.defineProperty(this,"currentTime",{get:this.getCurrentTime})}var t=A.prototype;return t.destroy=function(){},t.connect=function(A){this.destination=A},t.bufferGetIndex=function(){return this.bits.index},t.bufferSetIndex=function(A){this.bits.index=A},t.bufferWrite=function(A){return this.bits.write(A)},t.write=function(A,t){this.collectTimestamps&&(0===this.timestamps.length&&(this.startTime=A,this.decodedTime=A),this.timestamps.push({index:this.bytesWritten<<3,time:A})),this.bytesWritten+=this.bufferWrite(t),this.canPlay=!0},t.seek=function(A){if(this.collectTimestamps){this.timestampIndex=0;for(var t=0;tA);t++)this.timestampIndex=t;var i=this.timestamps[this.timestampIndex];i?(this.bufferSetIndex(i.index),this.decodedTime=i.time):(this.bits.index=0,this.decodedTime=this.startTime)}},t.decode=function(){this.advanceDecodedTime(0)},t.advanceDecodedTime=function(A){if(this.collectTimestamps){for(var t=-1,i=this.bufferGetIndex(),e=this.timestampIndex;ei);e++)t=e;if(-1!==t&&t!==this.timestampIndex)return this.timestampIndex=t,void(this.decodedTime=this.timestamps[this.timestampIndex].time)}this.decodedTime+=A},t.getCurrentTime=function(){return this.decodedTime},A}(),T=function(A){function t(t){var i;(i=A.call(this,t)||this).onDecodeCallback=t.onVideoDecode;var e=t.videoBufferSize||524288,s=t.streaming?L.MODE.EVICT:L.MODE.EXPAND;return i.bits=new L(e,s),i.customIntraQuantMatrix=new Uint8Array(64),i.customNonIntraQuantMatrix=new Uint8Array(64),i.blockData=new Int32Array(64),i.currentFrame=0,i.decodeFirstFrame=!1!==t.decodeFirstFrame,i}u(t,A);var i=t.prototype;return i.write=function(A,i){if(J.prototype.write.call(this,A,i),!this.hasSequenceHeader){if(-1===this.bits.findStartCode(t.START.SEQUENCE))return!1;this.decodeSequenceHeader(),this.decodeFirstFrame&&this.decode()}},i.decode=function(){var A=S();if(!this.hasSequenceHeader)return!1;if(-1===this.bits.findStartCode(t.START.PICTURE))return!1;this.decodePicture(),this.advanceDecodedTime(1/this.frameRate);var i=S()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,i),!0},i.readHuffman=function(A){var t=0;do{t=A[t+this.bits.read(1)]}while(t>=0&&0!==A[t]);return A[t+2]},i.decodeSequenceHeader=function(){var A=this.bits.read(12),i=this.bits.read(12);if(this.bits.skip(4),this.frameRate=t.PICTURE_RATE[this.bits.read(4)],this.bits.skip(30),A===this.width&&i===this.height||(this.width=A,this.height=i,this.initBuffers(),this.destination&&this.destination.resize(A,i)),this.bits.read(1)){for(var e=0;e<64;e++)this.customIntraQuantMatrix[t.ZIG_ZAG[e]]=this.bits.read(8);this.intraQuantMatrix=this.customIntraQuantMatrix}if(this.bits.read(1)){for(var s=0;s<64;s++){var o=t.ZIG_ZAG[s];this.customNonIntraQuantMatrix[o]=this.bits.read(8)}this.nonIntraQuantMatrix=this.customNonIntraQuantMatrix}this.hasSequenceHeader=!0},i.initBuffers=function(){this.intraQuantMatrix=t.DEFAULT_INTRA_QUANT_MATRIX,this.nonIntraQuantMatrix=t.DEFAULT_NON_INTRA_QUANT_MATRIX,this.mbWidth=this.width+15>>4,this.mbHeight=this.height+15>>4,this.mbSize=this.mbWidth*this.mbHeight,this.codedWidth=this.mbWidth<<4,this.codedHeight=this.mbHeight<<4,this.codedSize=this.codedWidth*this.codedHeight,this.halfWidth=this.mbWidth<<3,this.halfHeight=this.mbHeight<<3,this.currentY=new Uint8ClampedArray(this.codedSize),this.currentY32=new Uint32Array(this.currentY.buffer),this.currentCr=new Uint8ClampedArray(this.codedSize>>2),this.currentCr32=new Uint32Array(this.currentCr.buffer),this.currentCb=new Uint8ClampedArray(this.codedSize>>2),this.currentCb32=new Uint32Array(this.currentCb.buffer),this.forwardY=new Uint8ClampedArray(this.codedSize),this.forwardY32=new Uint32Array(this.forwardY.buffer),this.forwardCr=new Uint8ClampedArray(this.codedSize>>2),this.forwardCr32=new Uint32Array(this.forwardCr.buffer),this.forwardCb=new Uint8ClampedArray(this.codedSize>>2),this.forwardCb32=new Uint32Array(this.forwardCb.buffer)},i.decodePicture=function(){if(this.currentFrame++,this.bits.skip(10),this.pictureType=this.bits.read(3),this.bits.skip(16),!(this.pictureType<=0||this.pictureType>=t.PICTURE_TYPE.B)){if(this.pictureType===t.PICTURE_TYPE.PREDICTIVE){if(this.fullPelForward=this.bits.read(1),this.forwardFCode=this.bits.read(3),0===this.forwardFCode)return;this.forwardRSize=this.forwardFCode-1,this.forwardF=1<=t.START.SLICE_FIRST&&A<=t.START.SLICE_LAST;)this.decodeSlice(255&A),A=this.bits.findNextStartCode();if(-1!==A&&this.bits.rewind(32),this.destination&&this.destination.render(this.currentY,this.currentCr,this.currentCb,!0),this.pictureType===t.PICTURE_TYPE.INTRA||this.pictureType===t.PICTURE_TYPE.PREDICTIVE){var i=this.forwardY,e=this.forwardY32,s=this.forwardCr,o=this.forwardCr32,g=this.forwardCb,I=this.forwardCb32;this.forwardY=this.currentY,this.forwardY32=this.currentY32,this.forwardCr=this.currentCr,this.forwardCr32=this.currentCr32,this.forwardCb=this.currentCb,this.forwardCb32=this.currentCb32,this.currentY=i,this.currentY32=e,this.currentCr=s,this.currentCr32=o,this.currentCb=g,this.currentCb32=I}}},i.decodeSlice=function(A){for(this.sliceBegin=!0,this.macroblockAddress=(A-1)*this.mbWidth-1,this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0,this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.quantizerScale=this.bits.read(5);this.bits.read(1);)this.bits.skip(8);do{this.decodeMacroblock()}while(!this.bits.nextBytesAreStartCode())},i.decodeMacroblock=function(){for(var A=0,i=this.readHuffman(t.MACROBLOCK_ADDRESS_INCREMENT);34===i;)i=this.readHuffman(t.MACROBLOCK_ADDRESS_INCREMENT);for(;35===i;)A+=33,i=this.readHuffman(t.MACROBLOCK_ADDRESS_INCREMENT);if(A+=i,this.sliceBegin)this.sliceBegin=!1,this.macroblockAddress+=A;else{if(this.macroblockAddress+A>=this.mbSize)return;for(A>1&&(this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.pictureType===t.PICTURE_TYPE.PREDICTIVE&&(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0));A>1;)this.macroblockAddress++,this.mbRow=this.macroblockAddress/this.mbWidth|0,this.mbCol=this.macroblockAddress%this.mbWidth,this.copyMacroblock(this.motionFwH,this.motionFwV,this.forwardY,this.forwardCr,this.forwardCb),A--;this.macroblockAddress++}this.mbRow=this.macroblockAddress/this.mbWidth|0,this.mbCol=this.macroblockAddress%this.mbWidth;var e=t.MACROBLOCK_TYPE[this.pictureType];this.macroblockType=this.readHuffman(e),this.macroblockIntra=1&this.macroblockType,this.macroblockMotFw=8&this.macroblockType,16&this.macroblockType&&(this.quantizerScale=this.bits.read(5)),this.macroblockIntra?(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0):(this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.decodeMotionVectors(),this.copyMacroblock(this.motionFwH,this.motionFwV,this.forwardY,this.forwardCr,this.forwardCb));for(var s=2&this.macroblockType?this.readHuffman(t.CODE_BLOCK_PATTERN):this.macroblockIntra?63:0,o=0,g=32;o<6;o++)s&g&&this.decodeBlock(o),g>>=1},i.decodeMotionVectors=function(){var A,i,e=0;this.macroblockMotFw?(0!==(A=this.readHuffman(t.MOTION))&&1!==this.forwardF?(e=this.bits.read(this.forwardRSize),i=(Math.abs(A)-1<(this.forwardF<<4)-1?this.motionFwHPrev-=this.forwardF<<5:this.motionFwHPrev<-this.forwardF<<4&&(this.motionFwHPrev+=this.forwardF<<5),this.motionFwH=this.motionFwHPrev,this.fullPelForward&&(this.motionFwH<<=1),0!==(A=this.readHuffman(t.MOTION))&&1!==this.forwardF?(e=this.bits.read(this.forwardRSize),i=(Math.abs(A)-1<(this.forwardF<<4)-1?this.motionFwVPrev-=this.forwardF<<5:this.motionFwVPrev<-this.forwardF<<4&&(this.motionFwVPrev+=this.forwardF<<5),this.motionFwV=this.motionFwVPrev,this.fullPelForward&&(this.motionFwV<<=1)):this.pictureType===t.PICTURE_TYPE.PREDICTIVE&&(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0)},i.copyMacroblock=function(A,t,i,e,s){var o,g,I,a,B,r,C,n,E,Q,h,d,c,l,u,w,p,D,m,f=this.currentY32,y=this.currentCb32,R=this.currentCr32;if(g=(o=this.codedWidth)-16,I=A>>1,a=t>>1,B=!(1&~A),r=!(1&~t),C=((this.mbRow<<4)+a)*o+(this.mbCol<<4)+I,E=(n=this.mbRow*o+this.mbCol<<2)+(o<<2),B)if(r)for(;n>2&255,c|=(h=i[++C]+i[C+o])+d+2<<6&65280,c|=h+(d=i[++C]+i[C+o])+2<<14&16711680,h=i[++C]+i[C+o],C++,c|=h+d+2<<22&4278190080,f[n++]=c;n+=g>>2,C+=g-1}else for(;n>1&255,c|=(h=i[C++])+d+1<<7&65280,c|=h+(d=i[C++])+1<<15&16711680,c|=(h=i[C++])+d+1<<23&4278190080,f[n++]=c;n+=g>>2,C+=g-1}else if(r)for(;n>1&255,c|=i[++C]+i[C+o]+1<<7&65280,c|=i[++C]+i[C+o]+1<<15&16711680,c|=i[++C]+i[C+o]+1<<23&4278190080,C++,f[n++]=c;n+=g>>2,C+=g}else for(;n>2,C+=g}if(g=(o=this.halfWidth)-8,I=A/2>>1,a=t/2>>1,B=1==(A/2&1),r=1==(t/2&1),C=((this.mbRow<<3)+a)*o+(this.mbCol<<3)+I,E=(n=this.mbRow*o+this.mbCol<<1)+(o<<1),B)if(r)for(;n>2&255,m=p+(D=s[C]+s[C+o])+2>>2&255,w|=(l=e[++C]+e[C+o])+u+2<<6&65280,m|=(p=s[C]+s[C+o])+D+2<<6&65280,w|=l+(u=e[++C]+e[C+o])+2<<14&16711680,m|=p+(D=s[C]+s[C+o])+2<<14&16711680,l=e[++C]+e[C+o],p=s[C]+s[C+o],C++,w|=l+u+2<<22&4278190080,m|=p+D+2<<22&4278190080,R[n]=w,y[n]=m,n++;n+=g>>2,C+=g-1}else for(;n>1&255,m=p+(D=s[C++])+1>>1&255,w|=(l=e[C])+u+1<<7&65280,m|=(p=s[C++])+D+1<<7&65280,w|=l+(u=e[C])+1<<15&16711680,m|=p+(D=s[C++])+1<<15&16711680,w|=(l=e[C])+u+1<<23&4278190080,m|=(p=s[C++])+D+1<<23&4278190080,R[n]=w,y[n]=m,n++;n+=g>>2,C+=g-1}else if(r)for(;n>1&255,m=s[C]+s[C+o]+1>>1&255,w|=e[++C]+e[C+o]+1<<7&65280,m|=s[C]+s[C+o]+1<<7&65280,w|=e[++C]+e[C+o]+1<<15&16711680,m|=s[C]+s[C+o]+1<<15&16711680,w|=e[++C]+e[C+o]+1<<23&4278190080,m|=s[C]+s[C+o]+1<<23&4278190080,C++,R[n]=w,y[n]=m,n++;n+=g>>2,C+=g}else for(;n>2,C+=g}},i.decodeBlock=function(A){var i,e=0;if(this.macroblockIntra){var s,o;if(A<4?(s=this.dcPredictorY,o=this.readHuffman(t.DCT_DC_SIZE_LUMINANCE)):(s=4===A?this.dcPredictorCr:this.dcPredictorCb,o=this.readHuffman(t.DCT_DC_SIZE_CHROMINANCE)),o>0){var g=this.bits.read(o);this.blockData[0]=g&1<0&&0===this.bits.read(1))break;65535===n?(C=this.bits.read(6),0===(r=this.bits.read(8))?r=this.bits.read(8):128===r?r=this.bits.read(8)-256:r>128&&(r-=256)):(C=n>>8,r=255&n,this.bits.read(1)&&(r=-r)),e+=C;var E=t.ZIG_ZAG[e];e++,r<<=1,this.macroblockIntra||(r+=r<0?-1:1),1&(r=r*this.quantizerScale*i[E]>>4)||(r-=r>0?1:-1),r>2047?r=2047:r<-2048&&(r=-2048),this.blockData[E]=r*t.PREMULTIPLIER_MATRIX[E]}A<4?(I=this.currentY,B=this.codedWidth-8,a=this.mbRow*this.codedWidth+this.mbCol<<4,1&A&&(a+=8),2&A&&(a+=this.codedWidth<<3)):(I=4===A?this.currentCb:this.currentCr,B=(this.codedWidth>>1)-8,a=(this.mbRow*this.codedWidth<<2)+(this.mbCol<<3)),this.macroblockIntra?1===e?(t.CopyValueToDestination(this.blockData[0]+128>>8,I,a,B),this.blockData[0]=0):(t.IDCT(this.blockData),t.CopyBlockToDestination(this.blockData,I,a,B),G(this.blockData,0)):1===e?(t.AddValueToDestination(this.blockData[0]+128>>8,I,a,B),this.blockData[0]=0):(t.IDCT(this.blockData),t.AddBlockToDestination(this.blockData,I,a,B),G(this.blockData,0)),e=0},t.CopyBlockToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]=A[s+0],t[i+1]=A[s+1],t[i+2]=A[s+2],t[i+3]=A[s+3],t[i+4]=A[s+4],t[i+5]=A[s+5],t[i+6]=A[s+6],t[i+7]=A[s+7]},t.AddBlockToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]+=A[s+0],t[i+1]+=A[s+1],t[i+2]+=A[s+2],t[i+3]+=A[s+3],t[i+4]+=A[s+4],t[i+5]+=A[s+5],t[i+6]+=A[s+6],t[i+7]+=A[s+7]},t.CopyValueToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]=A,t[i+1]=A,t[i+2]=A,t[i+3]=A,t[i+4]=A,t[i+5]=A,t[i+6]=A,t[i+7]=A},t.AddValueToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]+=A,t[i+1]+=A,t[i+2]+=A,t[i+3]+=A,t[i+4]+=A,t[i+5]+=A,t[i+6]+=A,t[i+7]+=A},t.IDCT=function(A){for(var t,i,e,s,o,g,I,a,B,r,C,n,E,Q,h,d,c,l,u=0;u<8;++u)t=A[32+u],i=A[16+u]+A[48+u],e=A[40+u]-A[24+u],g=A[8+u]+A[56+u],I=A[24+u]+A[40+u],B=(E=(473*(s=A[8+u]-A[56+u])-196*e+128>>8)-(o=g+I))-(362*(g-I)+128>>8),Q=(r=(a=A[0+u])-t)+(C=(362*(A[16+u]-A[48+u])+128>>8)-i),h=(n=a+t)+i,d=r-C,c=n-i,l=-B-(473*e+196*s+128>>8),A[0+u]=o+h,A[8+u]=E+Q,A[16+u]=d-B,A[24+u]=c-l,A[32+u]=c+l,A[40+u]=B+d,A[48+u]=Q-E,A[56+u]=h-o;for(var w=0;w<64;w+=8)t=A[4+w],i=A[2+w]+A[6+w],e=A[5+w]-A[3+w],g=A[1+w]+A[7+w],I=A[3+w]+A[5+w],B=(E=(473*(s=A[1+w]-A[7+w])-196*e+128>>8)-(o=g+I))-(362*(g-I)+128>>8),Q=(r=(a=A[0+w])-t)+(C=(362*(A[2+w]-A[6+w])+128>>8)-i),h=(n=a+t)+i,d=r-C,c=n-i,l=-B-(473*e+196*s+128>>8),A[0+w]=o+h+128>>8,A[1+w]=E+Q+128>>8,A[2+w]=d-B+128>>8,A[3+w]=c-l+128>>8,A[4+w]=c+l+128>>8,A[5+w]=B+d+128>>8,A[6+w]=Q-E+128>>8,A[7+w]=h-o+128>>8},t}(J);T.prototype.frameRate=30,T.prototype.currentY=null,T.prototype.currentCr=null,T.prototype.currentCb=null,T.prototype.pictureType=0,T.prototype.forwardY=null,T.prototype.forwardCr=null,T.prototype.forwardCb=null,T.prototype.fullPelForward=!1,T.prototype.forwardFCode=0,T.prototype.forwardRSize=0,T.prototype.forwardF=0,T.prototype.quantizerScale=0,T.prototype.sliceBegin=!1,T.prototype.macroblockAddress=0,T.prototype.mbRow=0,T.prototype.mbCol=0,T.prototype.macroblockType=0,T.prototype.macroblockIntra=!1,T.prototype.macroblockMotFw=!1,T.prototype.motionFwH=0,T.prototype.motionFwV=0,T.prototype.motionFwHPrev=0,T.prototype.motionFwVPrev=0,T.prototype.dcPredictorY=0,T.prototype.dcPredictorCr=0,T.prototype.dcPredictorCb=0,T.prototype.blockData=null,T.PICTURE_RATE=[0,23.976,24,25,29.97,30,50,59.94,60,0,0,0,0,0,0,0],T.ZIG_ZAG=new Uint8Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),T.DEFAULT_INTRA_QUANT_MATRIX=new Uint8Array([8,16,19,22,26,27,29,34,16,16,22,24,27,29,34,37,19,22,26,27,29,34,34,38,22,22,26,27,29,34,37,40,22,26,27,29,32,35,40,48,26,27,29,32,35,40,48,58,26,27,29,34,38,46,56,69,27,29,35,38,46,56,69,83]),T.DEFAULT_NON_INTRA_QUANT_MATRIX=new Uint8Array([16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16]),T.PREMULTIPLIER_MATRIX=new Uint8Array([32,44,42,38,32,25,17,9,44,62,58,52,44,35,24,12,42,58,55,49,42,33,23,12,38,52,49,44,38,30,20,10,32,44,42,38,32,25,17,9,25,35,33,30,25,20,14,7,17,24,23,20,17,14,9,5,9,12,12,10,9,7,5,2]),T.MACROBLOCK_ADDRESS_INCREMENT=new Int16Array([3,6,0,9,12,0,0,0,1,15,18,0,21,24,0,27,30,0,33,36,0,0,0,3,0,0,2,39,42,0,45,48,0,0,0,5,0,0,4,51,54,0,57,60,0,0,0,7,0,0,6,63,66,0,69,72,0,75,78,0,81,84,0,-1,87,0,-1,90,0,93,96,0,99,102,0,105,108,0,111,114,0,0,0,9,0,0,8,117,120,0,123,126,0,129,132,0,135,138,0,0,0,15,0,0,14,0,0,13,0,0,12,0,0,11,0,0,10,141,-1,0,-1,144,0,147,150,0,153,156,0,159,162,0,165,168,0,171,174,0,177,180,0,183,-1,0,-1,186,0,189,192,0,195,198,0,201,204,0,207,210,0,213,216,0,219,222,0,0,0,21,0,0,20,0,0,19,0,0,18,0,0,17,0,0,16,0,0,35,0,0,34,0,0,33,0,0,32,0,0,31,0,0,30,0,0,29,0,0,28,0,0,27,0,0,26,0,0,25,0,0,24,0,0,23,0,0,22]),T.MACROBLOCK_TYPE_INTRA=new Int8Array([3,6,0,-1,9,0,0,0,1,0,0,17]),T.MACROBLOCK_TYPE_PREDICTIVE=new Int8Array([3,6,0,9,12,0,0,0,10,15,18,0,0,0,2,21,24,0,0,0,8,27,30,0,33,36,0,-1,39,0,0,0,18,0,0,26,0,0,1,0,0,17]),T.MACROBLOCK_TYPE_B=new Int8Array([3,6,0,9,15,0,12,18,0,24,21,0,0,0,12,27,30,0,0,0,14,39,42,0,36,33,0,0,0,4,0,0,6,54,48,0,45,51,0,0,0,8,0,0,10,-1,57,0,0,0,1,60,63,0,0,0,30,0,0,17,0,0,22,0,0,26]),T.MACROBLOCK_TYPE=[null,T.MACROBLOCK_TYPE_INTRA,T.MACROBLOCK_TYPE_PREDICTIVE,T.MACROBLOCK_TYPE_B],T.CODE_BLOCK_PATTERN=new Int16Array([6,3,0,9,18,0,12,15,0,24,33,0,36,39,0,27,21,0,30,42,0,60,57,0,54,48,0,69,51,0,81,75,0,63,84,0,45,66,0,72,78,0,0,0,60,105,120,0,132,144,0,114,108,0,126,141,0,87,93,0,117,96,0,0,0,32,135,138,0,99,123,0,129,102,0,0,0,4,90,111,0,0,0,8,0,0,16,0,0,44,150,168,0,0,0,28,0,0,52,0,0,62,183,177,0,156,180,0,0,0,1,165,162,0,0,0,61,0,0,56,171,174,0,0,0,2,0,0,40,153,186,0,0,0,48,192,189,0,147,159,0,0,0,20,0,0,12,240,249,0,0,0,63,231,225,0,195,219,0,252,198,0,0,0,24,0,0,36,0,0,3,207,261,0,243,237,0,204,213,0,210,234,0,201,228,0,216,222,0,258,255,0,264,246,0,-1,282,0,285,291,0,0,0,33,0,0,9,318,330,0,306,348,0,0,0,5,0,0,10,279,267,0,0,0,6,0,0,18,0,0,17,0,0,34,339,357,0,309,312,0,270,276,0,327,321,0,351,354,0,303,297,0,294,288,0,300,273,0,342,345,0,315,324,0,336,333,0,363,375,0,0,0,41,0,0,14,0,0,21,372,366,0,360,369,0,0,0,11,0,0,19,0,0,7,0,0,35,0,0,13,0,0,50,0,0,49,0,0,58,0,0,37,0,0,25,0,0,45,0,0,57,0,0,26,0,0,29,0,0,38,0,0,53,0,0,23,0,0,43,0,0,46,0,0,42,0,0,22,0,0,54,0,0,51,0,0,15,0,0,30,0,0,39,0,0,47,0,0,55,0,0,27,0,0,59,0,0,31]),T.MOTION=new Int16Array([3,6,0,12,9,0,0,0,0,18,15,0,24,21,0,0,0,-1,0,0,1,27,30,0,36,33,0,0,0,2,0,0,-2,42,45,0,48,39,0,60,54,0,0,0,3,0,0,-3,51,57,0,-1,69,0,81,75,0,78,63,0,72,66,0,96,84,0,87,93,0,-1,99,0,108,105,0,0,0,-4,90,102,0,0,0,4,0,0,-7,0,0,5,111,123,0,0,0,-5,0,0,7,114,120,0,126,117,0,0,0,-6,0,0,6,153,162,0,150,147,0,135,138,0,156,141,0,129,159,0,132,144,0,0,0,10,0,0,9,0,0,8,0,0,-8,171,198,0,0,0,-9,180,192,0,168,183,0,165,186,0,174,189,0,0,0,-10,177,195,0,0,0,12,0,0,16,0,0,13,0,0,14,0,0,11,0,0,15,0,0,-16,0,0,-12,0,0,-14,0,0,-15,0,0,-11,0,0,-13]),T.DCT_DC_SIZE_LUMINANCE=new Int8Array([6,3,0,18,15,0,9,12,0,0,0,1,0,0,2,27,24,0,21,30,0,0,0,0,36,33,0,0,0,4,0,0,3,39,42,0,0,0,5,0,0,6,48,45,0,51,-1,0,0,0,7,0,0,8]),T.DCT_DC_SIZE_CHROMINANCE=new Int8Array([6,3,0,12,9,0,18,15,0,24,21,0,0,0,2,0,0,1,0,0,0,30,27,0,0,0,3,36,33,0,0,0,4,42,39,0,0,0,5,48,45,0,0,0,6,51,-1,0,0,0,7,0,0,8]),T.DCT_COEFF=new Int32Array([3,6,0,12,9,0,0,0,1,21,24,0,18,15,0,39,27,0,33,30,0,42,36,0,0,0,257,60,66,0,54,63,0,48,57,0,0,0,513,51,45,0,0,0,2,0,0,3,81,75,0,87,93,0,72,78,0,96,90,0,0,0,1025,69,84,0,0,0,769,0,0,258,0,0,1793,0,0,65535,0,0,1537,111,108,0,0,0,1281,105,102,0,117,114,0,99,126,0,120,123,0,156,150,0,162,159,0,144,147,0,129,135,0,138,132,0,0,0,2049,0,0,4,0,0,514,0,0,2305,153,141,0,165,171,0,180,168,0,177,174,0,183,186,0,0,0,2561,0,0,3329,0,0,6,0,0,259,0,0,5,0,0,770,0,0,2817,0,0,3073,228,225,0,201,210,0,219,213,0,234,222,0,216,231,0,207,192,0,204,189,0,198,195,0,243,261,0,273,240,0,246,237,0,249,258,0,279,276,0,252,255,0,270,282,0,264,267,0,0,0,515,0,0,260,0,0,7,0,0,1026,0,0,1282,0,0,4097,0,0,3841,0,0,3585,315,321,0,333,342,0,312,291,0,375,357,0,288,294,0,-1,369,0,285,303,0,318,363,0,297,306,0,339,309,0,336,348,0,330,300,0,372,345,0,351,366,0,327,354,0,360,324,0,381,408,0,417,420,0,390,378,0,435,438,0,384,387,0,0,0,2050,396,402,0,465,462,0,0,0,8,411,399,0,429,432,0,453,414,0,426,423,0,0,0,10,0,0,9,0,0,11,0,0,5377,0,0,1538,0,0,771,0,0,5121,0,0,1794,0,0,4353,0,0,4609,0,0,4865,444,456,0,0,0,1027,459,450,0,0,0,261,393,405,0,0,0,516,447,441,0,516,519,0,486,474,0,510,483,0,504,498,0,471,537,0,507,501,0,522,513,0,534,531,0,468,477,0,492,495,0,549,546,0,525,528,0,0,0,263,0,0,2562,0,0,2306,0,0,5633,0,0,5889,0,0,6401,0,0,6145,0,0,1283,0,0,772,0,0,13,0,0,12,0,0,14,0,0,15,0,0,517,0,0,6657,0,0,262,540,543,0,480,489,0,588,597,0,0,0,27,609,555,0,606,603,0,0,0,19,0,0,22,591,621,0,0,0,18,573,576,0,564,570,0,0,0,20,552,582,0,0,0,21,558,579,0,0,0,23,612,594,0,0,0,25,0,0,24,600,615,0,0,0,31,0,0,30,0,0,28,0,0,29,0,0,26,0,0,17,0,0,16,567,618,0,561,585,0,654,633,0,0,0,37,645,648,0,0,0,36,630,636,0,0,0,34,639,627,0,663,666,0,657,624,0,651,642,0,669,660,0,0,0,35,0,0,267,0,0,40,0,0,268,0,0,266,0,0,32,0,0,264,0,0,265,0,0,38,0,0,269,0,0,270,0,0,33,0,0,39,0,0,7937,0,0,6913,0,0,7681,0,0,4098,0,0,7425,0,0,7169,0,0,271,0,0,274,0,0,273,0,0,272,0,0,1539,0,0,2818,0,0,3586,0,0,3330,0,0,3074,0,0,3842]),T.PICTURE_TYPE={INTRA:1,PREDICTIVE:2,B:3},T.START={SEQUENCE:179,SLICE_FIRST:1,SLICE_LAST:175,PICTURE:0,EXTENSION:181,USER_DATA:178};var v=function(A){function t(t){var i;return(i=A.call(this,t)||this).onDecodeCallback=t.onVideoDecode,i.module=t.wasmModule,i.bufferSize=t.videoBufferSize||524288,i.bufferMode=t.streaming?L.MODE.EVICT:L.MODE.EXPAND,i.decodeFirstFrame=!1!==t.decodeFirstFrame,i.hasSequenceHeader=!1,i}u(t,A);var i=t.prototype;return i.initializeWasmDecoder=function(){this.module.instance?(this.instance=this.module.instance,this.functions=this.module.instance.exports,this.decoder=this.functions._mpeg1_decoder_create(this.bufferSize,this.bufferMode)):console.warn("JSMpeg: WASM module not compiled yet")},i.destroy=function(){this.decoder&&this.functions._mpeg1_decoder_destroy(this.decoder)},i.bufferGetIndex=function(){if(this.decoder)return this.functions._mpeg1_decoder_get_index(this.decoder)},i.bufferSetIndex=function(A){this.decoder&&this.functions._mpeg1_decoder_set_index(this.decoder,A)},i.bufferWrite=function(A){this.decoder||this.initializeWasmDecoder();for(var t=0,i=0;i>2)),g=this.instance.heapU8.subarray(e,e+(this.codedSize>>2));this.destination.render(s,o,g,!1)}this.advanceDecodedTime(1/this.frameRate);var I=S()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,I),!0},t}(J),x=function(A){function t(i){var e;(e=A.call(this,i)||this).onDecodeCallback=i.onAudioDecode;var s=i.audioBufferSize||131072,o=i.streaming?L.MODE.EVICT:L.MODE.EXPAND;e.bits=new L(s,o),e.left=new Float32Array(1152),e.right=new Float32Array(1152),e.sampleRate=44100,e.D=new Float32Array(1024),e.D.set(t.SYNTHESIS_WINDOW,0),e.D.set(t.SYNTHESIS_WINDOW,512),e.V=[new Float32Array(1024),new Float32Array(1024)],e.U=new Int32Array(32),e.VPos=0,e.allocation=[new Array(32),new Array(32)],e.scaleFactorInfo=[new Uint8Array(32),new Uint8Array(32)],e.scaleFactor=[new Array(32),new Array(32)],e.sample=[new Array(32),new Array(32)];for(var g=0;g<2;g++)for(var I=0;I<32;I++)e.scaleFactor[g][I]=[0,0,0],e.sample[g][I]=[0,0,0];return e}u(t,A);var i=t.prototype;return i.decode=function(){var A=S(),t=this.bits.index>>3;if(t>=this.bits.byteLength)return!1;var i=this.decodeFrame(this.left,this.right);if(this.bits.index=t+i<<3,!i)return!1;this.destination&&this.destination.play(this.sampleRate,this.left,this.right),this.advanceDecodedTime(this.left.length/this.sampleRate);var e=S()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,e),!0},i.getCurrentTime=function(){var A=this.destination?this.destination.enqueuedTime:0;return this.decodedTime-A},i.decodeFrame=function(A,i){var e=this.bits.read(11),s=this.bits.read(2),o=this.bits.read(2),g=!this.bits.read(1);if(e!==t.FRAME_SYNC||s!==t.VERSION.MPEG_1||o!==t.LAYER.II)return 0;var I=this.bits.read(4)-1;if(I>13)return 0;var a=this.bits.read(2),B=t.SAMPLE_RATE[a];if(3===a)return 0;s===t.VERSION.MPEG_2&&(a+=4,I+=14);var r=this.bits.read(1);this.bits.read(1);var C=this.bits.read(2),n=0;C===t.MODE.JOINT_STEREO?n=this.bits.read(2)+1<<2:(this.bits.skip(2),n=C===t.MODE.MONO?0:32),this.bits.skip(4),g&&this.bits.skip(16);var E=144e3*t.BIT_RATE[I]/(B=t.SAMPLE_RATE[a])+r|0,Q=0,h=0;if(s===t.VERSION.MPEG_2)Q=2,h=30;else{var d=C===t.MODE.MONO?0:1,c=t.QUANT_LUT_STEP_1[d][I];h=63&(Q=t.QUANT_LUT_STEP_2[c][a]),Q>>=6}n>h&&(n=h);for(var l=0;l>1),U=this.VPos%128>>1;U<1024;){for(var J=0;J<32;++J)this.U[J]+=this.D[L++]*this.V[N][U++];U+=96,L+=32}for(U=1120-U,L-=480;U<1024;){for(var T=0;T<32;++T)this.U[T]+=this.D[L++]*this.V[N][U++];U+=96,L+=32}for(var v=0===N?A:i,x=0;x<32;x++)v[R+x]=this.U[x]/2147418112}R+=32}}return this.sampleRate=B,E},i.readAllocation=function(A,i){var e=t.QUANT_LUT_STEP_3[i][A],s=t.QUANT_LUT_STEP4[15&e][this.bits.read(e>>4)];return s?t.QUANT_TAB[s-1]:0},i.readSamples=function(A,i,e){var s=this.allocation[A][i],o=this.scaleFactor[A][i][e],g=this.sample[A][i],I=0;if(s){if(63===o)o=0;else{var a=o/3|0;o=t.SCALEFACTOR_BASE[o%3]+(1<>1)>>a}var B=s.levels;s.group?(I=this.bits.read(s.bits),g[0]=I%B,I=I/B|0,g[1]=I%B,g[2]=I/B|0):(g[0]=this.bits.read(s.bits),g[1]=this.bits.read(s.bits),g[2]=this.bits.read(s.bits));var r=65536/(B+1)|0;I=((B=(B+1>>1)-1)-g[0])*r,g[0]=I*(o>>12)+(I*(4095&o)+2048>>12)>>12,I=(B-g[1])*r,g[1]=I*(o>>12)+(I*(4095&o)+2048>>12)>>12,I=(B-g[2])*r,g[2]=I*(o>>12)+(I*(4095&o)+2048>>12)>>12}else g[0]=g[1]=g[2]=0},t.MatrixTransform=function(A,t,i,e){var s,o,g,I,a,B,r,C,n,E,Q,h,d,c,l,u,w,p,D,m,f,y,R,k,b,S,G,F,M,q,N,L,U;s=A[0][t]+A[31][t],o=.500602998235*(A[0][t]-A[31][t]),g=A[1][t]+A[30][t],I=.505470959898*(A[1][t]-A[30][t]),a=A[2][t]+A[29][t],B=.515447309923*(A[2][t]-A[29][t]),r=A[3][t]+A[28][t],C=.53104259109*(A[3][t]-A[28][t]),n=A[4][t]+A[27][t],E=.553103896034*(A[4][t]-A[27][t]),Q=A[5][t]+A[26][t],h=.582934968206*(A[5][t]-A[26][t]),d=A[6][t]+A[25][t],c=.622504123036*(A[6][t]-A[25][t]),l=A[7][t]+A[24][t],u=.674808341455*(A[7][t]-A[24][t]),w=A[8][t]+A[23][t],p=.744536271002*(A[8][t]-A[23][t]),D=A[9][t]+A[22][t],m=.839349645416*(A[9][t]-A[22][t]),f=A[10][t]+A[21][t],y=.972568237862*(A[10][t]-A[21][t]),R=A[11][t]+A[20][t],k=1.16943993343*(A[11][t]-A[20][t]),b=A[12][t]+A[19][t],S=1.48416461631*(A[12][t]-A[19][t]),G=A[13][t]+A[18][t],F=2.05778100995*(A[13][t]-A[18][t]),M=A[14][t]+A[17][t],q=3.40760841847*(A[14][t]-A[17][t]),U=s+(N=A[15][t]+A[16][t]),N=.502419286188*(s-N),s=g+M,M=.52249861494*(g-M),g=a+G,G=.566944034816*(a-G),a=r+b,b=.64682178336*(r-b),r=n+R,R=.788154623451*(n-R),n=Q+f,f=1.06067768599*(Q-f),Q=d+D,D=1.72244709824*(d-D),d=l+w,w=5.10114861869*(l-w),l=U+d,d=.509795579104*(U-d),U=s+Q,s=.601344886935*(s-Q),Q=g+n,n=.899976223136*(g-n),g=a+r,r=2.56291544774*(a-r),a=l+g,l=.541196100146*(l-g),g=U+Q,Q=1.30656296488*(U-Q),U=a+g,a=.707106781187*(a-g),g=l+Q,g+=l=.707106781187*(l-Q),Q=d+r,d=.541196100146*(d-r),r=s+n,n=1.30656296488*(s-n),s=Q+r,r=.707106781187*(Q-r),Q=d+n,s+=Q+=d=.707106781187*(d-n),Q+=r,r+=d,n=N+w,N=.509795579104*(N-w),w=M+D,M=.601344886935*(M-D),D=G+f,f=.899976223136*(G-f),G=b+R,R=2.56291544774*(b-R),b=n+G,n=.541196100146*(n-G),G=w+D,D=1.30656296488*(w-D),w=b+G,G=.707106781187*(b-G),b=n+D,D=.707106781187*(n-D),n=N+R,N=.541196100146*(N-R),R=M+f,f=1.30656296488*(M-f),M=n+R,R=.707106781187*(n-R),n=N+f,w+=M+=n+=N=.707106781187*(N-f),M+=b+=D,b+=n+=R,n+=G,G+=R+=N,R+=D,D+=N,f=o+(L=10.1900081235*(A[15][t]-A[16][t])),o=.502419286188*(o-L),L=I+q,I=.52249861494*(I-q),q=B+F,F=.566944034816*(B-F),B=C+S,C=.64682178336*(C-S),S=E+k,E=.788154623451*(E-k),k=h+y,y=1.06067768599*(h-y),h=c+m,m=1.72244709824*(c-m),c=u+p,u=5.10114861869*(u-p),p=f+c,c=.509795579104*(f-c),f=L+h,L=.601344886935*(L-h),h=q+k,k=.899976223136*(q-k),q=B+S,S=2.56291544774*(B-S),B=p+q,p=.541196100146*(p-q),q=f+h,h=1.30656296488*(f-h),f=B+q,q=.707106781187*(B-q),B=p+h,h=.707106781187*(p-h),p=c+S,S=.541196100146*(c-S),c=L+k,k=1.30656296488*(L-k),L=p+c,c=.707106781187*(p-c),p=S+k,L+=p+=k=.707106781187*(S-k),p+=c,S=c+k,c=o+u,o=.509795579104*(o-u),u=I+m,I=.601344886935*(I-m),m=F+y,y=.899976223136*(F-y),F=C+E,E=2.56291544774*(C-E),C=c+F,c=.541196100146*(c-F),F=u+m,m=1.30656296488*(u-m),u=C+F,F=.707106781187*(C-F),C=c+m,m=.707106781187*(c-m),c=o+E,o=.541196100146*(o-E),E=I+y,y=1.30656296488*(I-y),I=c+E,E=.707106781187*(c-E),c=o+y,f+=u+=I+=c+=o=.707106781187*(o-y),u+=L,L+=I+=C+=m,I+=B+=h,B+=C+=c+=E,C+=p,p+=c+=F,c+=q,q+=F+=E+=o,F+=S,S+=E+=m,E+=h,h+=m+=o,m+=k,k+=o,i[e+48]=-U,i[e+49]=i[e+47]=-f,i[e+50]=i[e+46]=-w,i[e+51]=i[e+45]=-u,i[e+52]=i[e+44]=-s,i[e+53]=i[e+43]=-L,i[e+54]=i[e+42]=-M,i[e+55]=i[e+41]=-I,i[e+56]=i[e+40]=-g,i[e+57]=i[e+39]=-B,i[e+58]=i[e+38]=-b,i[e+59]=i[e+37]=-C,i[e+60]=i[e+36]=-Q,i[e+61]=i[e+35]=-p,i[e+62]=i[e+34]=-n,i[e+63]=i[e+33]=-c,i[e+32]=-a,i[e+0]=a,i[e+31]=-q,i[e+1]=q,i[e+30]=-G,i[e+2]=G,i[e+29]=-F,i[e+3]=F,i[e+28]=-r,i[e+4]=r,i[e+27]=-S,i[e+5]=S,i[e+26]=-R,i[e+6]=R,i[e+25]=-E,i[e+7]=E,i[e+24]=-l,i[e+8]=l,i[e+23]=-h,i[e+9]=h,i[e+22]=-D,i[e+10]=D,i[e+21]=-m,i[e+11]=m,i[e+20]=-d,i[e+12]=d,i[e+19]=-k,i[e+13]=k,i[e+18]=-N,i[e+14]=N,i[e+17]=-o,i[e+15]=o,i[e+16]=0},t}(J);x.FRAME_SYNC=2047,x.VERSION={MPEG_2_5:0,MPEG_2:2,MPEG_1:3},x.LAYER={III:1,II:2,I:3},x.MODE={STEREO:0,JOINT_STEREO:1,DUAL_CHANNEL:2,MONO:3},x.SAMPLE_RATE=new Uint16Array([44100,48e3,32e3,0,22050,24e3,16e3,0]),x.BIT_RATE=new Uint16Array([32,48,56,64,80,96,112,128,160,192,224,256,320,384,8,16,24,32,40,48,56,64,80,96,112,128,144,160]),x.SCALEFACTOR_BASE=new Uint32Array([33554432,26632170,21137968]),x.SYNTHESIS_WINDOW=new Float32Array([0,-.5,-.5,-.5,-.5,-.5,-.5,-1,-1,-1,-1,-1.5,-1.5,-2,-2,-2.5,-2.5,-3,-3.5,-3.5,-4,-4.5,-5,-5.5,-6.5,-7,-8,-8.5,-9.5,-10.5,-12,-13,-14.5,-15.5,-17.5,-19,-20.5,-22.5,-24.5,-26.5,-29,-31.5,-34,-36.5,-39.5,-42.5,-45.5,-48.5,-52,-55.5,-58.5,-62.5,-66,-69.5,-73.5,-77,-80.5,-84.5,-88,-91.5,-95,-98,-101,-104,106.5,109,111,112.5,113.5,114,114,113.5,112,110.5,107.5,104,100,94.5,88.5,81.5,73,63.5,53,41.5,28.5,14.5,-1,-18,-36,-55.5,-76.5,-98.5,-122,-147,-173.5,-200.5,-229.5,-259.5,-290.5,-322.5,-355.5,-389.5,-424,-459.5,-495.5,-532,-568.5,-605,-641.5,-678,-714,-749,-783.5,-817,-849,-879.5,-908.5,-935,-959.5,-981,-1000.5,-1016,-1028.5,-1037.5,-1042.5,-1043.5,-1040,-1031.5,1018.5,1e3,976,946.5,911,869.5,822,767.5,707,640,565.5,485,397,302.5,201,92.5,-22.5,-144,-272.5,-407,-547.5,-694,-846,-1003,-1165,-1331.5,-1502,-1675.5,-1852.5,-2031.5,-2212.5,-2394,-2576.5,-2758.5,-2939.5,-3118.5,-3294.5,-3467.5,-3635.5,-3798.5,-3955,-4104.5,-4245.5,-4377.5,-4499,-4609.5,-4708,-4792.5,-4863.5,-4919,-4958,-4979.5,-4983,-4967.5,-4931.5,-4875,-4796,-4694.5,-4569.5,-4420,-4246,-4046,-3820,-3567,3287,2979.5,2644,2280.5,1888,1467.5,1018.5,541,35,-499,-1061,-1650,-2266.5,-2909,-3577,-4270,-4987.5,-5727.5,-6490,-7274,-8077.5,-8899.5,-9739,-10594.5,-11464.5,-12347,-13241,-14144.5,-15056,-15973.5,-16895.5,-17820,-18744.5,-19668,-20588,-21503,-22410.5,-23308.5,-24195,-25068.5,-25926.5,-26767,-27589,-28389,-29166.5,-29919,-30644.5,-31342,-32009.5,-32645,-33247,-33814.5,-34346,-34839.5,-35295,-35710,-36084.5,-36417.5,-36707.5,-36954,-37156.5,-37315,-37428,-37496,37519,37496,37428,37315,37156.5,36954,36707.5,36417.5,36084.5,35710,35295,34839.5,34346,33814.5,33247,32645,32009.5,31342,30644.5,29919,29166.5,28389,27589,26767,25926.5,25068.5,24195,23308.5,22410.5,21503,20588,19668,18744.5,17820,16895.5,15973.5,15056,14144.5,13241,12347,11464.5,10594.5,9739,8899.5,8077.5,7274,6490,5727.5,4987.5,4270,3577,2909,2266.5,1650,1061,499,-35,-541,-1018.5,-1467.5,-1888,-2280.5,-2644,-2979.5,3287,3567,3820,4046,4246,4420,4569.5,4694.5,4796,4875,4931.5,4967.5,4983,4979.5,4958,4919,4863.5,4792.5,4708,4609.5,4499,4377.5,4245.5,4104.5,3955,3798.5,3635.5,3467.5,3294.5,3118.5,2939.5,2758.5,2576.5,2394,2212.5,2031.5,1852.5,1675.5,1502,1331.5,1165,1003,846,694,547.5,407,272.5,144,22.5,-92.5,-201,-302.5,-397,-485,-565.5,-640,-707,-767.5,-822,-869.5,-911,-946.5,-976,-1e3,1018.5,1031.5,1040,1043.5,1042.5,1037.5,1028.5,1016,1000.5,981,959.5,935,908.5,879.5,849,817,783.5,749,714,678,641.5,605,568.5,532,495.5,459.5,424,389.5,355.5,322.5,290.5,259.5,229.5,200.5,173.5,147,122,98.5,76.5,55.5,36,18,1,-14.5,-28.5,-41.5,-53,-63.5,-73,-81.5,-88.5,-94.5,-100,-104,-107.5,-110.5,-112,-113.5,-114,-114,-113.5,-112.5,-111,-109,106.5,104,101,98,95,91.5,88,84.5,80.5,77,73.5,69.5,66,62.5,58.5,55.5,52,48.5,45.5,42.5,39.5,36.5,34,31.5,29,26.5,24.5,22.5,20.5,19,17.5,15.5,14.5,13,12,10.5,9.5,8.5,8,7,6.5,5.5,5,4.5,4,3.5,3.5,3,2.5,2.5,2,2,1.5,1.5,1,1,1,1,.5,.5,.5,.5,.5,.5]),x.QUANT_LUT_STEP_1=[[0,0,1,1,1,2,2,2,2,2,2,2,2,2],[0,0,0,0,0,0,1,1,1,2,2,2,2,2]],x.QUANT_TAB={A:91,B:94,C:8,D:12},x.QUANT_LUT_STEP_2=[[x.QUANT_TAB.C,x.QUANT_TAB.C,x.QUANT_TAB.D],[x.QUANT_TAB.A,x.QUANT_TAB.A,x.QUANT_TAB.A],[x.QUANT_TAB.B,x.QUANT_TAB.A,x.QUANT_TAB.B]],x.QUANT_LUT_STEP_3=[[68,68,52,52,52,52,52,52,52,52,52,52],[67,67,67,66,66,66,66,66,66,66,66,49,49,49,49,49,49,49,49,49,49,49,49,32,32,32,32,32,32,32],[69,69,69,69,52,52,52,52,52,52,52,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36]],x.QUANT_LUT_STEP4=[[0,1,2,17],[0,1,2,3,4,5,6,17],[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17],[0,1,3,5,6,7,8,9,10,11,12,13,14,15,16,17],[0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,17],[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]],x.QUANT_TAB=[{levels:3,group:1,bits:5},{levels:5,group:1,bits:7},{levels:7,group:0,bits:3},{levels:9,group:1,bits:10},{levels:15,group:0,bits:4},{levels:31,group:0,bits:5},{levels:63,group:0,bits:6},{levels:127,group:0,bits:7},{levels:255,group:0,bits:8},{levels:511,group:0,bits:9},{levels:1023,group:0,bits:10},{levels:2047,group:0,bits:11},{levels:4095,group:0,bits:12},{levels:8191,group:0,bits:13},{levels:16383,group:0,bits:14},{levels:32767,group:0,bits:15},{levels:65535,group:0,bits:16}];var Y=function(A){function t(t){var i;return(i=A.call(this,t)||this).onDecodeCallback=t.onAudioDecode,i.module=t.wasmModule,i.bufferSize=t.audioBufferSize||131072,i.bufferMode=t.streaming?L.MODE.EVICT:L.MODE.EXPAND,i.sampleRate=0,i}u(t,A);var i=t.prototype;return i.initializeWasmDecoder=function(){this.module.instance?(this.instance=this.module.instance,this.functions=this.module.instance.exports,this.decoder=this.functions._mp2_decoder_create(this.bufferSize,this.bufferMode)):console.warn("JSMpeg: WASM module not compiled yet")},i.destroy=function(){this.decoder&&this.functions._mp2_decoder_destroy(this.decoder)},i.bufferGetIndex=function(){if(this.decoder)return this.functions._mp2_decoder_get_index(this.decoder)},i.bufferSetIndex=function(A){this.decoder&&this.functions._mp2_decoder_set_index(this.decoder,A)},i.bufferWrite=function(A){this.decoder||this.initializeWasmDecoder();for(var t=0,i=0;i>4<<4;this.gl.viewport(0,0,i,this.height)},t.createTexture=function(A,t){var i=this.gl,e=i.createTexture();return i.bindTexture(i.TEXTURE_2D,e),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.uniform1i(i.getUniformLocation(this.program,t),A),e},t.createProgram=function(A,t){var i=this.gl,e=i.createProgram();return i.attachShader(e,this.compileShader(i.VERTEX_SHADER,A)),i.attachShader(e,this.compileShader(i.FRAGMENT_SHADER,t)),i.linkProgram(e),i.useProgram(e),e},t.compileShader=function(A,t){var i=this.gl,e=i.createShader(A);if(i.shaderSource(e,t),i.compileShader(e),!i.getShaderParameter(e,i.COMPILE_STATUS))throw new Error(i.getShaderInfoLog(e));return e},t.allowsClampedTextureData=function(){var A=this.gl,t=A.createTexture();return A.bindTexture(A.TEXTURE_2D,t),A.texImage2D(A.TEXTURE_2D,0,A.LUMINANCE,1,1,0,A.LUMINANCE,A.UNSIGNED_BYTE,new Uint8ClampedArray([0])),0===A.getError()},t.renderProgress=function(A){var t=this.gl;t.useProgram(this.loadingProgram);var i=t.getUniformLocation(this.loadingProgram,"progress");t.uniform1f(i,A),t.drawArrays(t.TRIANGLE_STRIP,0,4)},t.render=function(A,t,i,e){if(this.enabled){var s=this.gl,o=this.width+15>>4<<4,g=this.height,I=o>>1,a=g>>1;e&&this.shouldCreateUnclampedViews&&(A=new Uint8Array(A.buffer),t=new Uint8Array(t.buffer),i=new Uint8Array(i.buffer)),s.useProgram(this.program),this.updateTexture(s.TEXTURE0,this.textureY,o,g,A),this.updateTexture(s.TEXTURE1,this.textureCb,I,a,t),this.updateTexture(s.TEXTURE2,this.textureCr,I,a,i),s.drawArrays(s.TRIANGLE_STRIP,0,4)}},t.updateTexture=function(A,t,i,e,s){var o=this.gl;o.activeTexture(A),o.bindTexture(o.TEXTURE_2D,t),this.hasTextureData[A]?o.texSubImage2D(o.TEXTURE_2D,0,0,0,i,e,o.LUMINANCE,o.UNSIGNED_BYTE,s):(this.hasTextureData[A]=!0,o.texImage2D(o.TEXTURE_2D,0,o.LUMINANCE,i,e,0,o.LUMINANCE,o.UNSIGNED_BYTE,s))},t.deleteTexture=function(A,t){var i=this.gl;i.activeTexture(A),i.bindTexture(i.TEXTURE_2D,null),i.deleteTexture(t)},A.IsSupported=function(){try{if(!window.WebGLRenderingContext)return!1;var A=document.createElement("canvas");return!(!A.getContext("webgl")&&!A.getContext("experimental-webgl"))}catch(A){return!1}},A}();H.SHADER={FRAGMENT_YCRCB_TO_RGBA:["precision mediump float;","uniform sampler2D textureY;","uniform sampler2D textureCb;","uniform sampler2D textureCr;","varying vec2 texCoord;","mat4 rec601 = mat4(","1.16438, 0.00000, 1.59603, -0.87079,","1.16438, -0.39176, -0.81297, 0.52959,","1.16438, 2.01723, 0.00000, -1.08139,","0, 0, 0, 1",");","void main() {","float y = texture2D(textureY, texCoord).r;","float cb = texture2D(textureCb, texCoord).r;","float cr = texture2D(textureCr, texCoord).r;","gl_FragColor = vec4(y, cr, cb, 1.0) * rec601;","}"].join("\n"),FRAGMENT_LOADING:["precision mediump float;","uniform float progress;","varying vec2 texCoord;","void main() {","float c = ceil(progress-(1.0-texCoord.y));","gl_FragColor = vec4(c,c,c,1);","}"].join("\n"),VERTEX_IDENTITY:["attribute vec2 vertex;","varying vec2 texCoord;","void main() {","texCoord = vertex;","gl_Position = vec4((vertex * 2.0 - 1.0) * vec2(1, -1), 0.0, 1.0);","}"].join("\n")};var P=function(){function A(A){A.canvas?(this.canvas=A.canvas,this.ownsCanvasElement=!1):(this.canvas=document.createElement("canvas"),this.ownsCanvasElement=!0),this.width=this.canvas.width,this.height=this.canvas.height,this.enabled=!0,this.context=this.canvas.getContext("2d")}var t=A.prototype;return t.destroy=function(){this.ownsCanvasElement&&this.canvas.remove()},t.resize=function(A,t){this.width=0|A,this.height=0|t,this.canvas.width=this.width,this.canvas.height=this.height,this.imageData=this.context.getImageData(0,0,this.width,this.height),G(this.imageData.data,255)},t.renderProgress=function(A){var t=this.canvas.width,i=this.canvas.height,e=this.context;e.fillStyle="#222",e.fillRect(0,0,t,i),e.fillStyle="#fff",e.fillRect(0,i-i*A,t,i*A)},t.render=function(A,t,i){this.YCbCrToRGBA(A,t,i,this.imageData.data),this.context.putImageData(this.imageData,0,0)},t.YCbCrToRGBA=function(A,t,i,e){if(this.enabled)for(var s,o,g,I,a,B=this.width+15>>4<<4,r=B>>1,C=0,n=B,E=B+(B-this.width),Q=0,h=r-(this.width>>1),d=0,c=4*this.width,l=4*this.width,u=this.width>>1,w=this.height>>1,p=0;p>8)-179,I=(88*o>>8)-44+(183*s>>8)-91,a=o+(198*o>>8)-227;var m=A[C++],f=A[C++];e[d]=m+g,e[d+1]=m-I,e[d+2]=m+a,e[d+4]=f+g,e[d+5]=f-I,e[d+6]=f+a,d+=8;var y=A[n++],R=A[n++];e[c]=y+g,e[c+1]=y-I,e[c+2]=y+a,e[c+4]=R+g,e[c+5]=R-I,e[c+6]=R+a,c+=8}C+=E,n+=E,d+=l,c+=l,Q+=h}},A}(),O=function(){function A(){this.context=A.CachedContext=A.CachedContext||new(window.AudioContext||window.webkitAudioContext),this.gain=this.context.createGain(),this.destination=this.gain,this.gain.connect(this.context.destination),this.context._connections=(this.context._connections||0)+1,this.startTime=0,this.buffer=null,this.wallclockStartTime=0,this.volume=1,this.enabled=!0,this.unlocked=!A.NeedsUnlocking(),Object.defineProperty(this,"enqueuedTime",{get:this.getEnqueuedTime})}var t=A.prototype;return t.destroy=function(){this.gain.disconnect(),this.context._connections--,0===this.context._connections&&(this.context.close(),A.CachedContext=null)},t.play=function(A,t,i){if(this.enabled){if(!this.unlocked){var e=S();return this.wallclockStartTimethis.memory.buffer.byteLength){var i=this.brk-this.memory.buffer.byteLength,e=Math.ceil(i/this.pageSize);this.memory.grow(e),this.createHeapViews()}return t},t.c_abort=function(A){console.warn("JSMPeg: WASM abort",arguments)},t.c_assertFail=function(A){console.warn("JSMPeg: WASM ___assert_fail",arguments)},t.readDylinkSection=function(A){var t=new Uint8Array(A),i=0,e=function(){for(var A=0,e=1;;){var s=t[i++];if(A+=(127&s)*e,e*=128,!(128&s))return A}},s=function(A){for(var e=0;ethis.maxAudioLag&&(this.audioOut.resetEnqueuedTime(),this.audioOut.enabled=!1),A=this.audio.decode()}while(A);this.audioOut.enabled=!0}},t.updateForStaticFile=function(){var A=!1,t=0;if(this.audio&&this.audio.canPlay){for(;!A&&this.audio.decodedTime-this.audio.currentTime<.25;)A=!this.audio.decode();this.video&&this.video.currentTime0&&(e>2*s&&(this.startTime+=e),A=!this.video.decode()),t=this.demuxer.currentTime-i}this.source.resume(t),A&&this.source.completed?this.loop?this.seek(0):(this.stop(),this.options.onEnded&&this.options.onEnded(this)):A&&this.options.onStalled&&this.options.onStalled(this)},A}(),W={Player:X,VideoElement:b,BitBuffer:L,Source:{Ajax:M,AjaxProgressive:q,WebSocket:N,Fetch:function(){function A(A,t){this.url=A,this.destination=null,this.request=null,this.streaming=!0,this.completed=!1,this.established=!1,this.progress=0,this.aborted=!1,this.onEstablishedCallback=t.onSourceEstablished,this.onCompletedCallback=t.onSourceCompleted,t.hookOnEstablished&&(this.hookOnEstablished=t.hookOnEstablished)}var t=A.prototype;return t.connect=function(A){this.destination=A},t.start=function(){var A=this,t={method:"GET",headers:new Headers,cache:"default"};self.fetch(this.url,t).then((function(t){if(t.ok&&t.status>=200&&t.status<=299)return A.progress=1,A.established=!0,A.pump(t.body.getReader())})).catch((function(A){throw A}))},t.pump=function(A){var t=this;return A.read().then((function(i){if(!i.done)return t.aborted?A.cancel():(t.destination&&t.destination.write(i.value.buffer),t.pump(A));t.completed=!0})).catch((function(A){throw A}))},t.resume=function(){},t.abort=function(){this.aborted=!0},A}()},Demuxer:{TS:U},Decoder:{Base:J,MPEG1Video:T,MPEG1VideoWASM:v,MP2Audio:x,MP2AudioWASM:Y},Renderer:{WebGL:H,Canvas2D:P},AudioOutput:{WebAudio:O},WASMModule:K,Now:S,CreateVideoElements:function(){for(var A=document.querySelectorAll(".jsmpeg"),t=0;tthis.q=A))}resume(){this.q?.(),this.Z=this.q=void 0}} +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const V=A=>!e(A)&&"function"==typeof A.then,z=1073741823;const $=A(class extends t{constructor(){super(...arguments),this._$Cwt=z,this._$Cbt=[],this._$CK=new Z(this),this._$CX=new j}render(...A){return A.find((A=>!V(A)))??i}update(A,t){const e=this._$Cbt;let s=e.length;this._$Cbt=t;const o=this._$CK,g=this._$CX;this.isConnected||this.disconnected();for(let A=0;Athis._$Cwt);A++){const i=t[A];if(!V(i))return this._$Cwt=A,i;A{for(;g.get();)await g.get();const t=o.deref();if(void 0!==t){const e=t._$Cbt.indexOf(i);e>-1&&e{let i=!1;const e=new W.VideoElement(this,A,{canvas:this._jsmpegCanvasElement},{pauseWhenHidden:!1,autoplay:!1,protocols:[],audio:!1,videoBufferSize:4194304,preserveDrawingBuffer:!0,...this.cameraConfig?.jsmpeg?.options,reconnectInterval:0,onVideoDecode:()=>{!i&&this._jsmpegCanvasElement&&(i=!0,t(e))},onPlay:()=>g(this),onPause:()=>I(this)})})),this._jsmpegCanvasElement&&a(this,this._jsmpegCanvasElement,{player:this,capabilities:{supportsPause:!0},technology:["jsmpeg"]})}_resetPlayer(){if(this._refreshPlayerTimer.stop(),this._jsmpegVideoPlayer){try{this._jsmpegVideoPlayer.destroy()}catch(A){}this._jsmpegVideoPlayer=void 0}this._jsmpegCanvasElement&&(this._jsmpegCanvasElement.remove(),this._jsmpegCanvasElement=void 0)}connectedCallback(){super.connectedCallback(),this.isConnected&&this.requestUpdate()}disconnectedCallback(){this.isConnected||this._resetPlayer(),super.disconnectedCallback()}async _refreshPlayer(){if(!this.hass)return;this._resetPlayer(),this._jsmpegCanvasElement=document.createElement("canvas"),this._jsmpegCanvasElement.className="media";const A=this.cameraEndpoints?.jsmpeg;if(!A)return B(this,r("error.live_camera_no_endpoint"),{context:this.cameraConfig});const t=await c(this,this.hass,A,86400);t&&(await this._createJSMPEGPlayer(t),this._refreshPlayerTimer.start(82800,(()=>this.requestUpdate())))}render(){return C`${$((async()=>(await this._refreshPlayer(),this._jsmpegVideoPlayer&&this._jsmpegCanvasElement?C`${this._jsmpegCanvasElement}`:B(this,r("error.jsmpeg_no_player"))))(),n({cardWideConfig:this.cardWideConfig}))}`}static get styles(){return E(":host {\n width: 100%;\n height: 100%;\n display: flex;\n}\n\ncanvas {\n display: block;\n width: 100%;\n height: 100%;\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}")}};Q([h({attribute:!1})],AA.prototype,"cameraConfig",void 0),Q([h({attribute:!1})],AA.prototype,"cameraEndpoints",void 0),Q([h({attribute:!1})],AA.prototype,"cardWideConfig",void 0),AA=Q([d("frigate-card-live-jsmpeg")],AA);export{AA as FrigateCardLiveJSMPEG}; diff --git a/config/www/community/frigate-hass-card/jsmpeg-05cdf58e.js.gz b/config/www/community/frigate-hass-card/jsmpeg-05cdf58e.js.gz new file mode 100644 index 00000000..e582a0e2 Binary files /dev/null and b/config/www/community/frigate-hass-card/jsmpeg-05cdf58e.js.gz differ diff --git a/config/www/community/frigate-hass-card/jsmpeg-45778f1d.js b/config/www/community/frigate-hass-card/jsmpeg-45778f1d.js new file mode 100644 index 00000000..fa1a1a43 --- /dev/null +++ b/config/www/community/frigate-hass-card/jsmpeg-45778f1d.js @@ -0,0 +1,12 @@ +import{cL as A,eN as t,dC as i,eO as e,a as s,dD as o,dy as g,dz as I,dw as a,cQ as B,l as r,x as C,dl as n,r as E,_ as Q,n as h,t as d}from"./card-7cd05290.js";import{g as c}from"./endpoint-760ea36f.js";function l(){return l=Object.assign?Object.assign.bind():function(A){for(var t=1;t"string"==typeof A&&A.constructor===String,D=function(A){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t=A,"Promise"===Object.prototype.toString.call(t).slice(8,-1)?A:new Promise((t=>{A(),setTimeout(t,i)}))};var m="WJ3NAvwFY9",f="tR2-0dd-e1",y="ZgIIHVSSYI",R="kAA8SjbHe2",k="OueN4AU4CJ";!function(A,t){void 0===t&&(t={});var i=t.insertAt;if(A&&"undefined"!=typeof document){var e=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css","top"===i&&e.firstChild?e.insertBefore(s,e.firstChild):e.appendChild(s),s.styleSheet?s.styleSheet.cssText=A:s.appendChild(document.createTextNode(A))}}(".WJ3NAvwFY9,.ZgIIHVSSYI,.kAA8SjbHe2,.tR2-0dd-e1{height:100%;left:0;position:absolute;top:0;width:100%;z-index:1}.ZgIIHVSSYI{-ms-flex-pack:center;-ms-flex-align:center;-webkit-align-items:center;align-items:center;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-justify-content:center;justify-content:center}.WJ3NAvwFY9,.tR2-0dd-e1{display:block}.tR2-0dd-e1.OueN4AU4CJ{display:none}.ZgIIHVSSYI,.kAA8SjbHe2{-webkit-tap-highlight-color:rgba(255,0,0,0);cursor:pointer;opacity:.7}.OueN4AU4CJ.ZgIIHVSSYI,.OueN4AU4CJ.kAA8SjbHe2{display:none}.ZgIIHVSSYI{z-index:10}.ZgIIHVSSYI>svg{fill:#fff;height:12vw;max-height:60px;max-width:60px;width:12vw}.kAA8SjbHe2{-ms-flex-pack:end;-ms-flex-align:end;-webkit-align-items:flex-end;align-items:flex-end;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-justify-content:flex-end;justify-content:flex-end;z-index:10}.kAA8SjbHe2>svg{fill:#fff;height:9vw;margin:0 15px 15px 0;max-height:40px;max-width:40px;width:9vw}");var b=function(){function A(A,t,i,e){var s=void 0===i?{}:i,o=s.canvas,g=void 0===o?"":o,I=s.poster,a=void 0===I?"":I,B=s.autoplay,r=void 0!==B&&B,C=s.autoSetWrapperSize,n=void 0!==C&&C,E=s.loop,Q=void 0!==E&&E,h=s.control,d=void 0===h||h,c=s.decodeFirstFrame,u=void 0===c||c,w=s.picMode,D=void 0!==w&&w,m=s.progressive,f=void 0===m||m,y=s.chunkSize,R=void 0===y?1048576:y,k=s.hooks,b=void 0===k?{}:k;void 0===e&&(e={}),this.options=l({videoUrl:t,canvas:g,poster:a,picMode:D,autoplay:r,autoSetWrapperSize:n,loop:Q,control:d,decodeFirstFrame:u,progressive:f,chunkSize:R,hooks:l({play:function(){},pause:function(){},stop:function(){},load:function(){}},b)},e),this.options.needPlayButton=this.options.control&&!this.options.picMode,this.player=null,this.els={wrapper:p(A)?document.querySelector(A):A,canvas:null,playButton:document.createElement("div"),unmuteButton:null,poster:null},"static"===window.getComputedStyle(this.els.wrapper).getPropertyValue("position")&&(this.els.wrapper.style.position="relative"),this.els.wrapper.clientRect=this.els.wrapper.getBoundingClientRect(),this.initCanvas(),this.initPlayButton(),this.initPlayer()}var t=A.prototype;return t.initCanvas=function(){this.options.canvas?this.els.canvas=p(this.options.canvas)?document.querySelector(this.options.canvas):this.options.canvas:(this.els.canvas=document.createElement("canvas"),this.els.canvas.classList.add(m),this.els.wrapper.appendChild(this.els.canvas))},t.initPlayer=function(){var A=this;this.options=l(this.options,{canvas:this.els.canvas});var t=l({},this.options,{autoplay:!1});if(this.player=new X(this.options.videoUrl,t,{play:function(){A.options.needPlayButton&&A.els.playButton.classList.add(k),A.els.poster&&A.els.poster.classList.add(k),A.options.hooks.play()},pause:function(){A.options.needPlayButton&&A.els.playButton.classList.remove(k),A.options.hooks.pause()},stop:function(){A.els.poster&&A.els.poster.classList.remove(k),A.options.hooks.stop()},load:function(){A.options.autoplay&&A.play(),A._autoSetWrapperSize(),A.options.hooks.load()}}),this._copyPlayerFuncs(),this.els.wrapper.playerInstance=this.player,!this.options.poster||this.options.autoplay||this.player.options.streaming||(this.options.decodeFirstFrame=!1,this.els.poster=new Image,this.els.poster.src=this.options.poster,this.els.poster.classList.add(f),this.els.wrapper.appendChild(this.els.poster)),this.player.options.streaming||this.els.wrapper.addEventListener("click",this.onClick.bind(this)),(this.options.autoplay||this.player.options.streaming)&&this.els.playButton.classList.add(k),this.player.audioOut&&!this.player.audioOut.unlocked){var i=this.els.wrapper;(this.options.autoplay||this.player.options.streaming)&&(this.els.unmuteButton=document.createElement("div"),this.els.unmuteButton.innerHTML='\n\n \n\n',this.els.unmuteButton.classList.add(R),this.els.wrapper.appendChild(this.els.unmuteButton),i=this.els.unmuteButton),this.unlockAudioBound=this.onUnlockAudio.bind(this,i),i.addEventListener("touchstart",this.unlockAudioBound,!1),i.addEventListener("click",this.unlockAudioBound,!0)}},t.initPlayButton=function(){this.options.needPlayButton&&(this.els.playButton.classList.add(y),this.els.playButton.innerHTML='\n\n \n\n',this.els.wrapper.appendChild(this.els.playButton))},t._autoSetWrapperSize=function(){var A=this;if(!this.options.autoSetWrapperSize)return Promise.resolve();var t=this.player.video.destination;return t?Promise.resolve().then((function(){return D((function(){A.els.wrapper.style.width=t.width+"px",A.els.wrapper.style.height=t.height+"px"}))})):Promise.resolve()},t.onUnlockAudio=function(A,t){var i=this;this.els.unmuteButton&&(t.preventDefault(),t.stopPropagation()),this.player.audioOut.unlock((function(){i.els.unmuteButton&&i.els.unmuteButton.classList.add(k),A.removeEventListener("touchstart",i.unlockAudioBound),A.removeEventListener("click",i.unlockAudioBound)}))},t.onClick=function(){this.options.control&&(this.player.isPlaying?this.pause():this.play())},t._copyPlayerFuncs=function(){var A=this;this.play=function(){return A.player.play()},this.pause=function(){return A.player.pause()},this.stop=function(){return A.player.stop()},this.destroy=function(){A.player.destroy(),A.els.wrapper.innerHTML="",A.els.wrapper.playerInstance=null}},A}(),S=function(){return window.performance?window.performance.now()/1e3:Date.now()/1e3},G=function(A,t){if(A.fill)A.fill(t);else for(var i=0;iA&&this.loadNextChunk())},t.destroy=function(){this.request.abort(),this.aborted=!0},t.loadNextChunk=function(){var A=this,t=this.loadedSize,i=Math.min(this.loadedSize+this.chunkSize-1,this.fileSize-1);if(t>=this.fileSize||this.aborted)return this.completed=!0,void(this.onCompletedCallback&&this.onCompletedCallback(this));this.isLoading=!0,this.loadStartTime=S(),this.request=new XMLHttpRequest,this.request.onreadystatechange=function(){A.request.readyState===A.request.DONE&&A.request.status>=200&&A.request.status<300?A.onChunkLoad(A.request.response):A.request.readyState===A.request.DONE&&A.loadFails++<3&&A.loadNextChunk()},0===t&&(this.request.onprogress=this.onProgress.bind(this)),this.request.open("GET",this.url+"?"+t+"-"+i),this.request.setRequestHeader("Range","bytes="+t+"-"+i),this.request.responseType="arraybuffer",this.request.send()},t.onProgress=function(A){this.progress=A.loaded/A.total},t.onChunkLoad=function(A){var t=!this.established;this.established=!0,this.progress=1,this.loadedSize+=A.byteLength,this.loadFails=0,this.isLoading=!1,t&&this.hookOnEstablished&&this.hookOnEstablished(),t&&this.onEstablishedCallback&&this.onEstablishedCallback(this),this.destination&&this.destination.write(A),this.loadTime=S()-this.loadStartTime,this.throttled||this.loadNextChunk()},A}(),N=function(){function A(A,t){this.url=A,this.options=t,this.socket=null,this.streaming=!0,this.callbacks={connect:[],data:[]},this.destination=null,this.reconnectInterval=void 0!==t.reconnectInterval?t.reconnectInterval:5,this.shouldAttemptReconnect=!!this.reconnectInterval,this.completed=!1,this.established=!1,this.progress=0,this.reconnectTimeoutId=0,this.onEstablishedCallback=t.onSourceEstablished,this.onCompletedCallback=t.onSourceCompleted,t.hookOnEstablished&&(this.hookOnEstablished=t.hookOnEstablished)}var t=A.prototype;return t.connect=function(A){this.destination=A},t.destroy=function(){clearTimeout(this.reconnectTimeoutId),this.shouldAttemptReconnect=!1,this.socket.close()},t.start=function(){this.shouldAttemptReconnect=!!this.reconnectInterval,this.progress=0,this.established=!1,this.options.protocols?this.socket=new WebSocket(this.url,this.options.protocols):this.socket=new WebSocket(this.url),this.socket.binaryType="arraybuffer",this.socket.onmessage=this.onMessage.bind(this),this.socket.onopen=this.onOpen.bind(this),this.socket.onerror=this.onClose.bind(this),this.socket.onclose=this.onClose.bind(this)},t.resume=function(){},t.onOpen=function(){this.progress=1},t.onClose=function(){var A=this;this.shouldAttemptReconnect&&(clearTimeout(this.reconnectTimeoutId),this.reconnectTimeoutId=setTimeout((function(){A.start()}),1e3*this.reconnectInterval))},t.onMessage=function(A){var t=!this.established;this.established=!0,t&&this.hookOnEstablished&&this.hookOnEstablished(),t&&this.onEstablishedCallback&&this.onEstablishedCallback(this),this.destination&&this.destination.write(A.data)},A}(),L=function(){function A(t,i){"object"==typeof t?(this.bytes=t instanceof Uint8Array?t:new Uint8Array(t),this.byteLength=this.bytes.length):(this.bytes=new Uint8Array(t||1048576),this.byteLength=0),this.mode=i||A.MODE.EXPAND,this.index=0}var t=A.prototype;return t.resize=function(A){var t=new Uint8Array(A);0!==this.byteLength&&(this.byteLength=Math.min(this.byteLength,A),t.set(this.bytes,0,this.byteLength)),this.bytes=t,this.index=Math.min(this.index,this.byteLength<<3)},t.evict=function(A){var t=this.index>>3,i=this.bytes.length-this.byteLength;if(this.index===this.byteLength<<3||A>i+t)return this.byteLength=0,void(this.index=0);0!==t&&(this.bytes.copyWithin?this.bytes.copyWithin(0,t,this.byteLength):this.bytes.set(this.bytes.subarray(t,this.byteLength)),this.byteLength-=t,this.index-=t<<3)},t.write=function(t){var i="object"==typeof t[0],e=0,s=this.bytes.length-this.byteLength;if(i){e=0;for(var o=0;os)if(this.mode===A.MODE.EXPAND){var g=Math.max(2*this.bytes.length,e-s);this.resize(g)}else this.evict(e);if(i)for(var I=0;I>3;A>3;return A>=this.byteLength||0===this.bytes[A]&&0===this.bytes[A+1]&&1===this.bytes[A+2]},t.peek=function(A){for(var t=this.index,i=0;A;){var e=8-(7&t),s=e>3]&255>>8-s<>o,t+=s,A-=s}return i},t.read=function(A){var t=this.peek(A);return this.index+=A,t},t.skip=function(A){return this.index+=A},t.rewind=function(A){this.index=Math.max(this.index-A,0)},t.has=function(A){return(this.byteLength<<3)-this.index>=A},A}();L.MODE={EVICT:1,EXPAND:2};var U=function(){function A(){this.bits=null,this.leftoverBytes=null,this.guessVideoFrameEnd=!0,this.pidsToStreamIds={},this.pesPacketInfo={},this.startTime=0,this.currentTime=0}var t=A.prototype;return t.connect=function(A,t){this.pesPacketInfo[A]={destination:t,currentLength:0,totalLength:0,pts:0,buffers:[]}},t.write=function(A){if(this.leftoverBytes){var t=A.byteLength+this.leftoverBytes.byteLength;this.bits=new L(t),this.bits.write([this.leftoverBytes,A])}else this.bits=new L(A);for(;this.bits.has(1504)&&this.parsePacket(););var i=this.bits.byteLength-(this.bits.index>>3);this.leftoverBytes=i>0?this.bits.bytes.subarray(this.bits.index>>3):null},t.parsePacket=function(){if(71!==this.bits.read(8)&&!this.resync())return!1;var A=187+(this.bits.index>>3);this.bits.read(1);var t=this.bits.read(1);this.bits.read(1);var i=this.bits.read(13);this.bits.read(2);var e=this.bits.read(2);this.bits.read(4);var s=this.pidsToStreamIds[i];if(t&&s){var o=this.pesPacketInfo[s];o&&o.currentLength&&this.packetComplete(o)}if(1&e){if(2&e){var g=this.bits.read(8);this.bits.skip(g<<3)}if(t&&this.bits.nextBytesAreStartCode()){this.bits.skip(24),s=this.bits.read(8),this.pidsToStreamIds[i]=s;var I=this.bits.read(16);this.bits.skip(8);var a=this.bits.read(2);this.bits.skip(6);var B=this.bits.read(8),r=this.bits.index+(B<<3),C=this.pesPacketInfo[s];if(C){var n=0;if(2&a){this.bits.skip(4);var E=this.bits.read(3);this.bits.skip(1);var Q=this.bits.read(15);this.bits.skip(1);var h=this.bits.read(15);this.bits.skip(1),n=(1073741824*E+32768*Q+h)/9e4,this.currentTime=n,-1===this.startTime&&(this.startTime=n)}var d=I?I-B-3:0;this.packetStart(C,n,d)}this.bits.index=r}if(s){var c=this.pesPacketInfo[s];if(c){var l=this.bits.index>>3,u=!t&&2&e;(this.packetAddData(c,l,A)||this.guessVideoFrameEnd&&u)&&this.packetComplete(c)}}}return this.bits.index=A<<3,!0},t.resync=function(){if(!this.bits.has(9024))return!1;for(var A=this.bits.index>>3,t=0;t<187;t++)if(71===this.bits.bytes[A+t]){for(var i=!0,e=1;e<5;e++)if(71!==this.bits.bytes[A+t+188*e]){i=!1;break}if(i)return this.bits.index=A+t+1<<3,!0}return console.warn("JSMpeg: Possible garbage data. Skipping."),this.bits.skip(1496),!1},t.packetStart=function(A,t,i){A.totalLength=i,A.currentLength=0,A.pts=t},t.packetAddData=function(A,t,i){return A.buffers.push(this.bits.bytes.subarray(t,i)),A.currentLength+=i-t,0!==A.totalLength&&A.currentLength>=A.totalLength},t.packetComplete=function(A){A.destination.write(A.pts,A.buffers),A.totalLength=0,A.currentLength=0,A.buffers=[]},A}();U.STREAM={PACK_HEADER:186,SYSTEM_HEADER:187,PROGRAM_MAP:188,PRIVATE_1:189,PADDING:190,PRIVATE_2:191,AUDIO_1:192,VIDEO_1:224,DIRECTORY:255};var J=function(){function A(A){this.destination=null,this.canPlay=!1,this.collectTimestamps=!A.streaming,this.bytesWritten=0,this.timestamps=[],this.timestampIndex=0,this.startTime=0,this.decodedTime=0,Object.defineProperty(this,"currentTime",{get:this.getCurrentTime})}var t=A.prototype;return t.destroy=function(){},t.connect=function(A){this.destination=A},t.bufferGetIndex=function(){return this.bits.index},t.bufferSetIndex=function(A){this.bits.index=A},t.bufferWrite=function(A){return this.bits.write(A)},t.write=function(A,t){this.collectTimestamps&&(0===this.timestamps.length&&(this.startTime=A,this.decodedTime=A),this.timestamps.push({index:this.bytesWritten<<3,time:A})),this.bytesWritten+=this.bufferWrite(t),this.canPlay=!0},t.seek=function(A){if(this.collectTimestamps){this.timestampIndex=0;for(var t=0;tA);t++)this.timestampIndex=t;var i=this.timestamps[this.timestampIndex];i?(this.bufferSetIndex(i.index),this.decodedTime=i.time):(this.bits.index=0,this.decodedTime=this.startTime)}},t.decode=function(){this.advanceDecodedTime(0)},t.advanceDecodedTime=function(A){if(this.collectTimestamps){for(var t=-1,i=this.bufferGetIndex(),e=this.timestampIndex;ei);e++)t=e;if(-1!==t&&t!==this.timestampIndex)return this.timestampIndex=t,void(this.decodedTime=this.timestamps[this.timestampIndex].time)}this.decodedTime+=A},t.getCurrentTime=function(){return this.decodedTime},A}(),T=function(A){function t(t){var i;(i=A.call(this,t)||this).onDecodeCallback=t.onVideoDecode;var e=t.videoBufferSize||524288,s=t.streaming?L.MODE.EVICT:L.MODE.EXPAND;return i.bits=new L(e,s),i.customIntraQuantMatrix=new Uint8Array(64),i.customNonIntraQuantMatrix=new Uint8Array(64),i.blockData=new Int32Array(64),i.currentFrame=0,i.decodeFirstFrame=!1!==t.decodeFirstFrame,i}u(t,A);var i=t.prototype;return i.write=function(A,i){if(J.prototype.write.call(this,A,i),!this.hasSequenceHeader){if(-1===this.bits.findStartCode(t.START.SEQUENCE))return!1;this.decodeSequenceHeader(),this.decodeFirstFrame&&this.decode()}},i.decode=function(){var A=S();if(!this.hasSequenceHeader)return!1;if(-1===this.bits.findStartCode(t.START.PICTURE))return!1;this.decodePicture(),this.advanceDecodedTime(1/this.frameRate);var i=S()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,i),!0},i.readHuffman=function(A){var t=0;do{t=A[t+this.bits.read(1)]}while(t>=0&&0!==A[t]);return A[t+2]},i.decodeSequenceHeader=function(){var A=this.bits.read(12),i=this.bits.read(12);if(this.bits.skip(4),this.frameRate=t.PICTURE_RATE[this.bits.read(4)],this.bits.skip(30),A===this.width&&i===this.height||(this.width=A,this.height=i,this.initBuffers(),this.destination&&this.destination.resize(A,i)),this.bits.read(1)){for(var e=0;e<64;e++)this.customIntraQuantMatrix[t.ZIG_ZAG[e]]=this.bits.read(8);this.intraQuantMatrix=this.customIntraQuantMatrix}if(this.bits.read(1)){for(var s=0;s<64;s++){var o=t.ZIG_ZAG[s];this.customNonIntraQuantMatrix[o]=this.bits.read(8)}this.nonIntraQuantMatrix=this.customNonIntraQuantMatrix}this.hasSequenceHeader=!0},i.initBuffers=function(){this.intraQuantMatrix=t.DEFAULT_INTRA_QUANT_MATRIX,this.nonIntraQuantMatrix=t.DEFAULT_NON_INTRA_QUANT_MATRIX,this.mbWidth=this.width+15>>4,this.mbHeight=this.height+15>>4,this.mbSize=this.mbWidth*this.mbHeight,this.codedWidth=this.mbWidth<<4,this.codedHeight=this.mbHeight<<4,this.codedSize=this.codedWidth*this.codedHeight,this.halfWidth=this.mbWidth<<3,this.halfHeight=this.mbHeight<<3,this.currentY=new Uint8ClampedArray(this.codedSize),this.currentY32=new Uint32Array(this.currentY.buffer),this.currentCr=new Uint8ClampedArray(this.codedSize>>2),this.currentCr32=new Uint32Array(this.currentCr.buffer),this.currentCb=new Uint8ClampedArray(this.codedSize>>2),this.currentCb32=new Uint32Array(this.currentCb.buffer),this.forwardY=new Uint8ClampedArray(this.codedSize),this.forwardY32=new Uint32Array(this.forwardY.buffer),this.forwardCr=new Uint8ClampedArray(this.codedSize>>2),this.forwardCr32=new Uint32Array(this.forwardCr.buffer),this.forwardCb=new Uint8ClampedArray(this.codedSize>>2),this.forwardCb32=new Uint32Array(this.forwardCb.buffer)},i.decodePicture=function(){if(this.currentFrame++,this.bits.skip(10),this.pictureType=this.bits.read(3),this.bits.skip(16),!(this.pictureType<=0||this.pictureType>=t.PICTURE_TYPE.B)){if(this.pictureType===t.PICTURE_TYPE.PREDICTIVE){if(this.fullPelForward=this.bits.read(1),this.forwardFCode=this.bits.read(3),0===this.forwardFCode)return;this.forwardRSize=this.forwardFCode-1,this.forwardF=1<=t.START.SLICE_FIRST&&A<=t.START.SLICE_LAST;)this.decodeSlice(255&A),A=this.bits.findNextStartCode();if(-1!==A&&this.bits.rewind(32),this.destination&&this.destination.render(this.currentY,this.currentCr,this.currentCb,!0),this.pictureType===t.PICTURE_TYPE.INTRA||this.pictureType===t.PICTURE_TYPE.PREDICTIVE){var i=this.forwardY,e=this.forwardY32,s=this.forwardCr,o=this.forwardCr32,g=this.forwardCb,I=this.forwardCb32;this.forwardY=this.currentY,this.forwardY32=this.currentY32,this.forwardCr=this.currentCr,this.forwardCr32=this.currentCr32,this.forwardCb=this.currentCb,this.forwardCb32=this.currentCb32,this.currentY=i,this.currentY32=e,this.currentCr=s,this.currentCr32=o,this.currentCb=g,this.currentCb32=I}}},i.decodeSlice=function(A){for(this.sliceBegin=!0,this.macroblockAddress=(A-1)*this.mbWidth-1,this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0,this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.quantizerScale=this.bits.read(5);this.bits.read(1);)this.bits.skip(8);do{this.decodeMacroblock()}while(!this.bits.nextBytesAreStartCode())},i.decodeMacroblock=function(){for(var A=0,i=this.readHuffman(t.MACROBLOCK_ADDRESS_INCREMENT);34===i;)i=this.readHuffman(t.MACROBLOCK_ADDRESS_INCREMENT);for(;35===i;)A+=33,i=this.readHuffman(t.MACROBLOCK_ADDRESS_INCREMENT);if(A+=i,this.sliceBegin)this.sliceBegin=!1,this.macroblockAddress+=A;else{if(this.macroblockAddress+A>=this.mbSize)return;for(A>1&&(this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.pictureType===t.PICTURE_TYPE.PREDICTIVE&&(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0));A>1;)this.macroblockAddress++,this.mbRow=this.macroblockAddress/this.mbWidth|0,this.mbCol=this.macroblockAddress%this.mbWidth,this.copyMacroblock(this.motionFwH,this.motionFwV,this.forwardY,this.forwardCr,this.forwardCb),A--;this.macroblockAddress++}this.mbRow=this.macroblockAddress/this.mbWidth|0,this.mbCol=this.macroblockAddress%this.mbWidth;var e=t.MACROBLOCK_TYPE[this.pictureType];this.macroblockType=this.readHuffman(e),this.macroblockIntra=1&this.macroblockType,this.macroblockMotFw=8&this.macroblockType,16&this.macroblockType&&(this.quantizerScale=this.bits.read(5)),this.macroblockIntra?(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0):(this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.decodeMotionVectors(),this.copyMacroblock(this.motionFwH,this.motionFwV,this.forwardY,this.forwardCr,this.forwardCb));for(var s=2&this.macroblockType?this.readHuffman(t.CODE_BLOCK_PATTERN):this.macroblockIntra?63:0,o=0,g=32;o<6;o++)s&g&&this.decodeBlock(o),g>>=1},i.decodeMotionVectors=function(){var A,i,e=0;this.macroblockMotFw?(0!==(A=this.readHuffman(t.MOTION))&&1!==this.forwardF?(e=this.bits.read(this.forwardRSize),i=(Math.abs(A)-1<(this.forwardF<<4)-1?this.motionFwHPrev-=this.forwardF<<5:this.motionFwHPrev<-this.forwardF<<4&&(this.motionFwHPrev+=this.forwardF<<5),this.motionFwH=this.motionFwHPrev,this.fullPelForward&&(this.motionFwH<<=1),0!==(A=this.readHuffman(t.MOTION))&&1!==this.forwardF?(e=this.bits.read(this.forwardRSize),i=(Math.abs(A)-1<(this.forwardF<<4)-1?this.motionFwVPrev-=this.forwardF<<5:this.motionFwVPrev<-this.forwardF<<4&&(this.motionFwVPrev+=this.forwardF<<5),this.motionFwV=this.motionFwVPrev,this.fullPelForward&&(this.motionFwV<<=1)):this.pictureType===t.PICTURE_TYPE.PREDICTIVE&&(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0)},i.copyMacroblock=function(A,t,i,e,s){var o,g,I,a,B,r,C,n,E,Q,h,d,c,l,u,w,p,D,m,f=this.currentY32,y=this.currentCb32,R=this.currentCr32;if(g=(o=this.codedWidth)-16,I=A>>1,a=t>>1,B=!(1&~A),r=!(1&~t),C=((this.mbRow<<4)+a)*o+(this.mbCol<<4)+I,E=(n=this.mbRow*o+this.mbCol<<2)+(o<<2),B)if(r)for(;n>2&255,c|=(h=i[++C]+i[C+o])+d+2<<6&65280,c|=h+(d=i[++C]+i[C+o])+2<<14&16711680,h=i[++C]+i[C+o],C++,c|=h+d+2<<22&4278190080,f[n++]=c;n+=g>>2,C+=g-1}else for(;n>1&255,c|=(h=i[C++])+d+1<<7&65280,c|=h+(d=i[C++])+1<<15&16711680,c|=(h=i[C++])+d+1<<23&4278190080,f[n++]=c;n+=g>>2,C+=g-1}else if(r)for(;n>1&255,c|=i[++C]+i[C+o]+1<<7&65280,c|=i[++C]+i[C+o]+1<<15&16711680,c|=i[++C]+i[C+o]+1<<23&4278190080,C++,f[n++]=c;n+=g>>2,C+=g}else for(;n>2,C+=g}if(g=(o=this.halfWidth)-8,I=A/2>>1,a=t/2>>1,B=1==(A/2&1),r=1==(t/2&1),C=((this.mbRow<<3)+a)*o+(this.mbCol<<3)+I,E=(n=this.mbRow*o+this.mbCol<<1)+(o<<1),B)if(r)for(;n>2&255,m=p+(D=s[C]+s[C+o])+2>>2&255,w|=(l=e[++C]+e[C+o])+u+2<<6&65280,m|=(p=s[C]+s[C+o])+D+2<<6&65280,w|=l+(u=e[++C]+e[C+o])+2<<14&16711680,m|=p+(D=s[C]+s[C+o])+2<<14&16711680,l=e[++C]+e[C+o],p=s[C]+s[C+o],C++,w|=l+u+2<<22&4278190080,m|=p+D+2<<22&4278190080,R[n]=w,y[n]=m,n++;n+=g>>2,C+=g-1}else for(;n>1&255,m=p+(D=s[C++])+1>>1&255,w|=(l=e[C])+u+1<<7&65280,m|=(p=s[C++])+D+1<<7&65280,w|=l+(u=e[C])+1<<15&16711680,m|=p+(D=s[C++])+1<<15&16711680,w|=(l=e[C])+u+1<<23&4278190080,m|=(p=s[C++])+D+1<<23&4278190080,R[n]=w,y[n]=m,n++;n+=g>>2,C+=g-1}else if(r)for(;n>1&255,m=s[C]+s[C+o]+1>>1&255,w|=e[++C]+e[C+o]+1<<7&65280,m|=s[C]+s[C+o]+1<<7&65280,w|=e[++C]+e[C+o]+1<<15&16711680,m|=s[C]+s[C+o]+1<<15&16711680,w|=e[++C]+e[C+o]+1<<23&4278190080,m|=s[C]+s[C+o]+1<<23&4278190080,C++,R[n]=w,y[n]=m,n++;n+=g>>2,C+=g}else for(;n>2,C+=g}},i.decodeBlock=function(A){var i,e=0;if(this.macroblockIntra){var s,o;if(A<4?(s=this.dcPredictorY,o=this.readHuffman(t.DCT_DC_SIZE_LUMINANCE)):(s=4===A?this.dcPredictorCr:this.dcPredictorCb,o=this.readHuffman(t.DCT_DC_SIZE_CHROMINANCE)),o>0){var g=this.bits.read(o);this.blockData[0]=g&1<0&&0===this.bits.read(1))break;65535===n?(C=this.bits.read(6),0===(r=this.bits.read(8))?r=this.bits.read(8):128===r?r=this.bits.read(8)-256:r>128&&(r-=256)):(C=n>>8,r=255&n,this.bits.read(1)&&(r=-r)),e+=C;var E=t.ZIG_ZAG[e];e++,r<<=1,this.macroblockIntra||(r+=r<0?-1:1),1&(r=r*this.quantizerScale*i[E]>>4)||(r-=r>0?1:-1),r>2047?r=2047:r<-2048&&(r=-2048),this.blockData[E]=r*t.PREMULTIPLIER_MATRIX[E]}A<4?(I=this.currentY,B=this.codedWidth-8,a=this.mbRow*this.codedWidth+this.mbCol<<4,1&A&&(a+=8),2&A&&(a+=this.codedWidth<<3)):(I=4===A?this.currentCb:this.currentCr,B=(this.codedWidth>>1)-8,a=(this.mbRow*this.codedWidth<<2)+(this.mbCol<<3)),this.macroblockIntra?1===e?(t.CopyValueToDestination(this.blockData[0]+128>>8,I,a,B),this.blockData[0]=0):(t.IDCT(this.blockData),t.CopyBlockToDestination(this.blockData,I,a,B),G(this.blockData,0)):1===e?(t.AddValueToDestination(this.blockData[0]+128>>8,I,a,B),this.blockData[0]=0):(t.IDCT(this.blockData),t.AddBlockToDestination(this.blockData,I,a,B),G(this.blockData,0)),e=0},t.CopyBlockToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]=A[s+0],t[i+1]=A[s+1],t[i+2]=A[s+2],t[i+3]=A[s+3],t[i+4]=A[s+4],t[i+5]=A[s+5],t[i+6]=A[s+6],t[i+7]=A[s+7]},t.AddBlockToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]+=A[s+0],t[i+1]+=A[s+1],t[i+2]+=A[s+2],t[i+3]+=A[s+3],t[i+4]+=A[s+4],t[i+5]+=A[s+5],t[i+6]+=A[s+6],t[i+7]+=A[s+7]},t.CopyValueToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]=A,t[i+1]=A,t[i+2]=A,t[i+3]=A,t[i+4]=A,t[i+5]=A,t[i+6]=A,t[i+7]=A},t.AddValueToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]+=A,t[i+1]+=A,t[i+2]+=A,t[i+3]+=A,t[i+4]+=A,t[i+5]+=A,t[i+6]+=A,t[i+7]+=A},t.IDCT=function(A){for(var t,i,e,s,o,g,I,a,B,r,C,n,E,Q,h,d,c,l,u=0;u<8;++u)t=A[32+u],i=A[16+u]+A[48+u],e=A[40+u]-A[24+u],g=A[8+u]+A[56+u],I=A[24+u]+A[40+u],B=(E=(473*(s=A[8+u]-A[56+u])-196*e+128>>8)-(o=g+I))-(362*(g-I)+128>>8),Q=(r=(a=A[0+u])-t)+(C=(362*(A[16+u]-A[48+u])+128>>8)-i),h=(n=a+t)+i,d=r-C,c=n-i,l=-B-(473*e+196*s+128>>8),A[0+u]=o+h,A[8+u]=E+Q,A[16+u]=d-B,A[24+u]=c-l,A[32+u]=c+l,A[40+u]=B+d,A[48+u]=Q-E,A[56+u]=h-o;for(var w=0;w<64;w+=8)t=A[4+w],i=A[2+w]+A[6+w],e=A[5+w]-A[3+w],g=A[1+w]+A[7+w],I=A[3+w]+A[5+w],B=(E=(473*(s=A[1+w]-A[7+w])-196*e+128>>8)-(o=g+I))-(362*(g-I)+128>>8),Q=(r=(a=A[0+w])-t)+(C=(362*(A[2+w]-A[6+w])+128>>8)-i),h=(n=a+t)+i,d=r-C,c=n-i,l=-B-(473*e+196*s+128>>8),A[0+w]=o+h+128>>8,A[1+w]=E+Q+128>>8,A[2+w]=d-B+128>>8,A[3+w]=c-l+128>>8,A[4+w]=c+l+128>>8,A[5+w]=B+d+128>>8,A[6+w]=Q-E+128>>8,A[7+w]=h-o+128>>8},t}(J);T.prototype.frameRate=30,T.prototype.currentY=null,T.prototype.currentCr=null,T.prototype.currentCb=null,T.prototype.pictureType=0,T.prototype.forwardY=null,T.prototype.forwardCr=null,T.prototype.forwardCb=null,T.prototype.fullPelForward=!1,T.prototype.forwardFCode=0,T.prototype.forwardRSize=0,T.prototype.forwardF=0,T.prototype.quantizerScale=0,T.prototype.sliceBegin=!1,T.prototype.macroblockAddress=0,T.prototype.mbRow=0,T.prototype.mbCol=0,T.prototype.macroblockType=0,T.prototype.macroblockIntra=!1,T.prototype.macroblockMotFw=!1,T.prototype.motionFwH=0,T.prototype.motionFwV=0,T.prototype.motionFwHPrev=0,T.prototype.motionFwVPrev=0,T.prototype.dcPredictorY=0,T.prototype.dcPredictorCr=0,T.prototype.dcPredictorCb=0,T.prototype.blockData=null,T.PICTURE_RATE=[0,23.976,24,25,29.97,30,50,59.94,60,0,0,0,0,0,0,0],T.ZIG_ZAG=new Uint8Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),T.DEFAULT_INTRA_QUANT_MATRIX=new Uint8Array([8,16,19,22,26,27,29,34,16,16,22,24,27,29,34,37,19,22,26,27,29,34,34,38,22,22,26,27,29,34,37,40,22,26,27,29,32,35,40,48,26,27,29,32,35,40,48,58,26,27,29,34,38,46,56,69,27,29,35,38,46,56,69,83]),T.DEFAULT_NON_INTRA_QUANT_MATRIX=new Uint8Array([16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16]),T.PREMULTIPLIER_MATRIX=new Uint8Array([32,44,42,38,32,25,17,9,44,62,58,52,44,35,24,12,42,58,55,49,42,33,23,12,38,52,49,44,38,30,20,10,32,44,42,38,32,25,17,9,25,35,33,30,25,20,14,7,17,24,23,20,17,14,9,5,9,12,12,10,9,7,5,2]),T.MACROBLOCK_ADDRESS_INCREMENT=new Int16Array([3,6,0,9,12,0,0,0,1,15,18,0,21,24,0,27,30,0,33,36,0,0,0,3,0,0,2,39,42,0,45,48,0,0,0,5,0,0,4,51,54,0,57,60,0,0,0,7,0,0,6,63,66,0,69,72,0,75,78,0,81,84,0,-1,87,0,-1,90,0,93,96,0,99,102,0,105,108,0,111,114,0,0,0,9,0,0,8,117,120,0,123,126,0,129,132,0,135,138,0,0,0,15,0,0,14,0,0,13,0,0,12,0,0,11,0,0,10,141,-1,0,-1,144,0,147,150,0,153,156,0,159,162,0,165,168,0,171,174,0,177,180,0,183,-1,0,-1,186,0,189,192,0,195,198,0,201,204,0,207,210,0,213,216,0,219,222,0,0,0,21,0,0,20,0,0,19,0,0,18,0,0,17,0,0,16,0,0,35,0,0,34,0,0,33,0,0,32,0,0,31,0,0,30,0,0,29,0,0,28,0,0,27,0,0,26,0,0,25,0,0,24,0,0,23,0,0,22]),T.MACROBLOCK_TYPE_INTRA=new Int8Array([3,6,0,-1,9,0,0,0,1,0,0,17]),T.MACROBLOCK_TYPE_PREDICTIVE=new Int8Array([3,6,0,9,12,0,0,0,10,15,18,0,0,0,2,21,24,0,0,0,8,27,30,0,33,36,0,-1,39,0,0,0,18,0,0,26,0,0,1,0,0,17]),T.MACROBLOCK_TYPE_B=new Int8Array([3,6,0,9,15,0,12,18,0,24,21,0,0,0,12,27,30,0,0,0,14,39,42,0,36,33,0,0,0,4,0,0,6,54,48,0,45,51,0,0,0,8,0,0,10,-1,57,0,0,0,1,60,63,0,0,0,30,0,0,17,0,0,22,0,0,26]),T.MACROBLOCK_TYPE=[null,T.MACROBLOCK_TYPE_INTRA,T.MACROBLOCK_TYPE_PREDICTIVE,T.MACROBLOCK_TYPE_B],T.CODE_BLOCK_PATTERN=new Int16Array([6,3,0,9,18,0,12,15,0,24,33,0,36,39,0,27,21,0,30,42,0,60,57,0,54,48,0,69,51,0,81,75,0,63,84,0,45,66,0,72,78,0,0,0,60,105,120,0,132,144,0,114,108,0,126,141,0,87,93,0,117,96,0,0,0,32,135,138,0,99,123,0,129,102,0,0,0,4,90,111,0,0,0,8,0,0,16,0,0,44,150,168,0,0,0,28,0,0,52,0,0,62,183,177,0,156,180,0,0,0,1,165,162,0,0,0,61,0,0,56,171,174,0,0,0,2,0,0,40,153,186,0,0,0,48,192,189,0,147,159,0,0,0,20,0,0,12,240,249,0,0,0,63,231,225,0,195,219,0,252,198,0,0,0,24,0,0,36,0,0,3,207,261,0,243,237,0,204,213,0,210,234,0,201,228,0,216,222,0,258,255,0,264,246,0,-1,282,0,285,291,0,0,0,33,0,0,9,318,330,0,306,348,0,0,0,5,0,0,10,279,267,0,0,0,6,0,0,18,0,0,17,0,0,34,339,357,0,309,312,0,270,276,0,327,321,0,351,354,0,303,297,0,294,288,0,300,273,0,342,345,0,315,324,0,336,333,0,363,375,0,0,0,41,0,0,14,0,0,21,372,366,0,360,369,0,0,0,11,0,0,19,0,0,7,0,0,35,0,0,13,0,0,50,0,0,49,0,0,58,0,0,37,0,0,25,0,0,45,0,0,57,0,0,26,0,0,29,0,0,38,0,0,53,0,0,23,0,0,43,0,0,46,0,0,42,0,0,22,0,0,54,0,0,51,0,0,15,0,0,30,0,0,39,0,0,47,0,0,55,0,0,27,0,0,59,0,0,31]),T.MOTION=new Int16Array([3,6,0,12,9,0,0,0,0,18,15,0,24,21,0,0,0,-1,0,0,1,27,30,0,36,33,0,0,0,2,0,0,-2,42,45,0,48,39,0,60,54,0,0,0,3,0,0,-3,51,57,0,-1,69,0,81,75,0,78,63,0,72,66,0,96,84,0,87,93,0,-1,99,0,108,105,0,0,0,-4,90,102,0,0,0,4,0,0,-7,0,0,5,111,123,0,0,0,-5,0,0,7,114,120,0,126,117,0,0,0,-6,0,0,6,153,162,0,150,147,0,135,138,0,156,141,0,129,159,0,132,144,0,0,0,10,0,0,9,0,0,8,0,0,-8,171,198,0,0,0,-9,180,192,0,168,183,0,165,186,0,174,189,0,0,0,-10,177,195,0,0,0,12,0,0,16,0,0,13,0,0,14,0,0,11,0,0,15,0,0,-16,0,0,-12,0,0,-14,0,0,-15,0,0,-11,0,0,-13]),T.DCT_DC_SIZE_LUMINANCE=new Int8Array([6,3,0,18,15,0,9,12,0,0,0,1,0,0,2,27,24,0,21,30,0,0,0,0,36,33,0,0,0,4,0,0,3,39,42,0,0,0,5,0,0,6,48,45,0,51,-1,0,0,0,7,0,0,8]),T.DCT_DC_SIZE_CHROMINANCE=new Int8Array([6,3,0,12,9,0,18,15,0,24,21,0,0,0,2,0,0,1,0,0,0,30,27,0,0,0,3,36,33,0,0,0,4,42,39,0,0,0,5,48,45,0,0,0,6,51,-1,0,0,0,7,0,0,8]),T.DCT_COEFF=new Int32Array([3,6,0,12,9,0,0,0,1,21,24,0,18,15,0,39,27,0,33,30,0,42,36,0,0,0,257,60,66,0,54,63,0,48,57,0,0,0,513,51,45,0,0,0,2,0,0,3,81,75,0,87,93,0,72,78,0,96,90,0,0,0,1025,69,84,0,0,0,769,0,0,258,0,0,1793,0,0,65535,0,0,1537,111,108,0,0,0,1281,105,102,0,117,114,0,99,126,0,120,123,0,156,150,0,162,159,0,144,147,0,129,135,0,138,132,0,0,0,2049,0,0,4,0,0,514,0,0,2305,153,141,0,165,171,0,180,168,0,177,174,0,183,186,0,0,0,2561,0,0,3329,0,0,6,0,0,259,0,0,5,0,0,770,0,0,2817,0,0,3073,228,225,0,201,210,0,219,213,0,234,222,0,216,231,0,207,192,0,204,189,0,198,195,0,243,261,0,273,240,0,246,237,0,249,258,0,279,276,0,252,255,0,270,282,0,264,267,0,0,0,515,0,0,260,0,0,7,0,0,1026,0,0,1282,0,0,4097,0,0,3841,0,0,3585,315,321,0,333,342,0,312,291,0,375,357,0,288,294,0,-1,369,0,285,303,0,318,363,0,297,306,0,339,309,0,336,348,0,330,300,0,372,345,0,351,366,0,327,354,0,360,324,0,381,408,0,417,420,0,390,378,0,435,438,0,384,387,0,0,0,2050,396,402,0,465,462,0,0,0,8,411,399,0,429,432,0,453,414,0,426,423,0,0,0,10,0,0,9,0,0,11,0,0,5377,0,0,1538,0,0,771,0,0,5121,0,0,1794,0,0,4353,0,0,4609,0,0,4865,444,456,0,0,0,1027,459,450,0,0,0,261,393,405,0,0,0,516,447,441,0,516,519,0,486,474,0,510,483,0,504,498,0,471,537,0,507,501,0,522,513,0,534,531,0,468,477,0,492,495,0,549,546,0,525,528,0,0,0,263,0,0,2562,0,0,2306,0,0,5633,0,0,5889,0,0,6401,0,0,6145,0,0,1283,0,0,772,0,0,13,0,0,12,0,0,14,0,0,15,0,0,517,0,0,6657,0,0,262,540,543,0,480,489,0,588,597,0,0,0,27,609,555,0,606,603,0,0,0,19,0,0,22,591,621,0,0,0,18,573,576,0,564,570,0,0,0,20,552,582,0,0,0,21,558,579,0,0,0,23,612,594,0,0,0,25,0,0,24,600,615,0,0,0,31,0,0,30,0,0,28,0,0,29,0,0,26,0,0,17,0,0,16,567,618,0,561,585,0,654,633,0,0,0,37,645,648,0,0,0,36,630,636,0,0,0,34,639,627,0,663,666,0,657,624,0,651,642,0,669,660,0,0,0,35,0,0,267,0,0,40,0,0,268,0,0,266,0,0,32,0,0,264,0,0,265,0,0,38,0,0,269,0,0,270,0,0,33,0,0,39,0,0,7937,0,0,6913,0,0,7681,0,0,4098,0,0,7425,0,0,7169,0,0,271,0,0,274,0,0,273,0,0,272,0,0,1539,0,0,2818,0,0,3586,0,0,3330,0,0,3074,0,0,3842]),T.PICTURE_TYPE={INTRA:1,PREDICTIVE:2,B:3},T.START={SEQUENCE:179,SLICE_FIRST:1,SLICE_LAST:175,PICTURE:0,EXTENSION:181,USER_DATA:178};var v=function(A){function t(t){var i;return(i=A.call(this,t)||this).onDecodeCallback=t.onVideoDecode,i.module=t.wasmModule,i.bufferSize=t.videoBufferSize||524288,i.bufferMode=t.streaming?L.MODE.EVICT:L.MODE.EXPAND,i.decodeFirstFrame=!1!==t.decodeFirstFrame,i.hasSequenceHeader=!1,i}u(t,A);var i=t.prototype;return i.initializeWasmDecoder=function(){this.module.instance?(this.instance=this.module.instance,this.functions=this.module.instance.exports,this.decoder=this.functions._mpeg1_decoder_create(this.bufferSize,this.bufferMode)):console.warn("JSMpeg: WASM module not compiled yet")},i.destroy=function(){this.decoder&&this.functions._mpeg1_decoder_destroy(this.decoder)},i.bufferGetIndex=function(){if(this.decoder)return this.functions._mpeg1_decoder_get_index(this.decoder)},i.bufferSetIndex=function(A){this.decoder&&this.functions._mpeg1_decoder_set_index(this.decoder,A)},i.bufferWrite=function(A){this.decoder||this.initializeWasmDecoder();for(var t=0,i=0;i>2)),g=this.instance.heapU8.subarray(e,e+(this.codedSize>>2));this.destination.render(s,o,g,!1)}this.advanceDecodedTime(1/this.frameRate);var I=S()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,I),!0},t}(J),x=function(A){function t(i){var e;(e=A.call(this,i)||this).onDecodeCallback=i.onAudioDecode;var s=i.audioBufferSize||131072,o=i.streaming?L.MODE.EVICT:L.MODE.EXPAND;e.bits=new L(s,o),e.left=new Float32Array(1152),e.right=new Float32Array(1152),e.sampleRate=44100,e.D=new Float32Array(1024),e.D.set(t.SYNTHESIS_WINDOW,0),e.D.set(t.SYNTHESIS_WINDOW,512),e.V=[new Float32Array(1024),new Float32Array(1024)],e.U=new Int32Array(32),e.VPos=0,e.allocation=[new Array(32),new Array(32)],e.scaleFactorInfo=[new Uint8Array(32),new Uint8Array(32)],e.scaleFactor=[new Array(32),new Array(32)],e.sample=[new Array(32),new Array(32)];for(var g=0;g<2;g++)for(var I=0;I<32;I++)e.scaleFactor[g][I]=[0,0,0],e.sample[g][I]=[0,0,0];return e}u(t,A);var i=t.prototype;return i.decode=function(){var A=S(),t=this.bits.index>>3;if(t>=this.bits.byteLength)return!1;var i=this.decodeFrame(this.left,this.right);if(this.bits.index=t+i<<3,!i)return!1;this.destination&&this.destination.play(this.sampleRate,this.left,this.right),this.advanceDecodedTime(this.left.length/this.sampleRate);var e=S()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,e),!0},i.getCurrentTime=function(){var A=this.destination?this.destination.enqueuedTime:0;return this.decodedTime-A},i.decodeFrame=function(A,i){var e=this.bits.read(11),s=this.bits.read(2),o=this.bits.read(2),g=!this.bits.read(1);if(e!==t.FRAME_SYNC||s!==t.VERSION.MPEG_1||o!==t.LAYER.II)return 0;var I=this.bits.read(4)-1;if(I>13)return 0;var a=this.bits.read(2),B=t.SAMPLE_RATE[a];if(3===a)return 0;s===t.VERSION.MPEG_2&&(a+=4,I+=14);var r=this.bits.read(1);this.bits.read(1);var C=this.bits.read(2),n=0;C===t.MODE.JOINT_STEREO?n=this.bits.read(2)+1<<2:(this.bits.skip(2),n=C===t.MODE.MONO?0:32),this.bits.skip(4),g&&this.bits.skip(16);var E=144e3*t.BIT_RATE[I]/(B=t.SAMPLE_RATE[a])+r|0,Q=0,h=0;if(s===t.VERSION.MPEG_2)Q=2,h=30;else{var d=C===t.MODE.MONO?0:1,c=t.QUANT_LUT_STEP_1[d][I];h=63&(Q=t.QUANT_LUT_STEP_2[c][a]),Q>>=6}n>h&&(n=h);for(var l=0;l>1),U=this.VPos%128>>1;U<1024;){for(var J=0;J<32;++J)this.U[J]+=this.D[L++]*this.V[N][U++];U+=96,L+=32}for(U=1120-U,L-=480;U<1024;){for(var T=0;T<32;++T)this.U[T]+=this.D[L++]*this.V[N][U++];U+=96,L+=32}for(var v=0===N?A:i,x=0;x<32;x++)v[R+x]=this.U[x]/2147418112}R+=32}}return this.sampleRate=B,E},i.readAllocation=function(A,i){var e=t.QUANT_LUT_STEP_3[i][A],s=t.QUANT_LUT_STEP4[15&e][this.bits.read(e>>4)];return s?t.QUANT_TAB[s-1]:0},i.readSamples=function(A,i,e){var s=this.allocation[A][i],o=this.scaleFactor[A][i][e],g=this.sample[A][i],I=0;if(s){if(63===o)o=0;else{var a=o/3|0;o=t.SCALEFACTOR_BASE[o%3]+(1<>1)>>a}var B=s.levels;s.group?(I=this.bits.read(s.bits),g[0]=I%B,I=I/B|0,g[1]=I%B,g[2]=I/B|0):(g[0]=this.bits.read(s.bits),g[1]=this.bits.read(s.bits),g[2]=this.bits.read(s.bits));var r=65536/(B+1)|0;I=((B=(B+1>>1)-1)-g[0])*r,g[0]=I*(o>>12)+(I*(4095&o)+2048>>12)>>12,I=(B-g[1])*r,g[1]=I*(o>>12)+(I*(4095&o)+2048>>12)>>12,I=(B-g[2])*r,g[2]=I*(o>>12)+(I*(4095&o)+2048>>12)>>12}else g[0]=g[1]=g[2]=0},t.MatrixTransform=function(A,t,i,e){var s,o,g,I,a,B,r,C,n,E,Q,h,d,c,l,u,w,p,D,m,f,y,R,k,b,S,G,F,M,q,N,L,U;s=A[0][t]+A[31][t],o=.500602998235*(A[0][t]-A[31][t]),g=A[1][t]+A[30][t],I=.505470959898*(A[1][t]-A[30][t]),a=A[2][t]+A[29][t],B=.515447309923*(A[2][t]-A[29][t]),r=A[3][t]+A[28][t],C=.53104259109*(A[3][t]-A[28][t]),n=A[4][t]+A[27][t],E=.553103896034*(A[4][t]-A[27][t]),Q=A[5][t]+A[26][t],h=.582934968206*(A[5][t]-A[26][t]),d=A[6][t]+A[25][t],c=.622504123036*(A[6][t]-A[25][t]),l=A[7][t]+A[24][t],u=.674808341455*(A[7][t]-A[24][t]),w=A[8][t]+A[23][t],p=.744536271002*(A[8][t]-A[23][t]),D=A[9][t]+A[22][t],m=.839349645416*(A[9][t]-A[22][t]),f=A[10][t]+A[21][t],y=.972568237862*(A[10][t]-A[21][t]),R=A[11][t]+A[20][t],k=1.16943993343*(A[11][t]-A[20][t]),b=A[12][t]+A[19][t],S=1.48416461631*(A[12][t]-A[19][t]),G=A[13][t]+A[18][t],F=2.05778100995*(A[13][t]-A[18][t]),M=A[14][t]+A[17][t],q=3.40760841847*(A[14][t]-A[17][t]),U=s+(N=A[15][t]+A[16][t]),N=.502419286188*(s-N),s=g+M,M=.52249861494*(g-M),g=a+G,G=.566944034816*(a-G),a=r+b,b=.64682178336*(r-b),r=n+R,R=.788154623451*(n-R),n=Q+f,f=1.06067768599*(Q-f),Q=d+D,D=1.72244709824*(d-D),d=l+w,w=5.10114861869*(l-w),l=U+d,d=.509795579104*(U-d),U=s+Q,s=.601344886935*(s-Q),Q=g+n,n=.899976223136*(g-n),g=a+r,r=2.56291544774*(a-r),a=l+g,l=.541196100146*(l-g),g=U+Q,Q=1.30656296488*(U-Q),U=a+g,a=.707106781187*(a-g),g=l+Q,g+=l=.707106781187*(l-Q),Q=d+r,d=.541196100146*(d-r),r=s+n,n=1.30656296488*(s-n),s=Q+r,r=.707106781187*(Q-r),Q=d+n,s+=Q+=d=.707106781187*(d-n),Q+=r,r+=d,n=N+w,N=.509795579104*(N-w),w=M+D,M=.601344886935*(M-D),D=G+f,f=.899976223136*(G-f),G=b+R,R=2.56291544774*(b-R),b=n+G,n=.541196100146*(n-G),G=w+D,D=1.30656296488*(w-D),w=b+G,G=.707106781187*(b-G),b=n+D,D=.707106781187*(n-D),n=N+R,N=.541196100146*(N-R),R=M+f,f=1.30656296488*(M-f),M=n+R,R=.707106781187*(n-R),n=N+f,w+=M+=n+=N=.707106781187*(N-f),M+=b+=D,b+=n+=R,n+=G,G+=R+=N,R+=D,D+=N,f=o+(L=10.1900081235*(A[15][t]-A[16][t])),o=.502419286188*(o-L),L=I+q,I=.52249861494*(I-q),q=B+F,F=.566944034816*(B-F),B=C+S,C=.64682178336*(C-S),S=E+k,E=.788154623451*(E-k),k=h+y,y=1.06067768599*(h-y),h=c+m,m=1.72244709824*(c-m),c=u+p,u=5.10114861869*(u-p),p=f+c,c=.509795579104*(f-c),f=L+h,L=.601344886935*(L-h),h=q+k,k=.899976223136*(q-k),q=B+S,S=2.56291544774*(B-S),B=p+q,p=.541196100146*(p-q),q=f+h,h=1.30656296488*(f-h),f=B+q,q=.707106781187*(B-q),B=p+h,h=.707106781187*(p-h),p=c+S,S=.541196100146*(c-S),c=L+k,k=1.30656296488*(L-k),L=p+c,c=.707106781187*(p-c),p=S+k,L+=p+=k=.707106781187*(S-k),p+=c,S=c+k,c=o+u,o=.509795579104*(o-u),u=I+m,I=.601344886935*(I-m),m=F+y,y=.899976223136*(F-y),F=C+E,E=2.56291544774*(C-E),C=c+F,c=.541196100146*(c-F),F=u+m,m=1.30656296488*(u-m),u=C+F,F=.707106781187*(C-F),C=c+m,m=.707106781187*(c-m),c=o+E,o=.541196100146*(o-E),E=I+y,y=1.30656296488*(I-y),I=c+E,E=.707106781187*(c-E),c=o+y,f+=u+=I+=c+=o=.707106781187*(o-y),u+=L,L+=I+=C+=m,I+=B+=h,B+=C+=c+=E,C+=p,p+=c+=F,c+=q,q+=F+=E+=o,F+=S,S+=E+=m,E+=h,h+=m+=o,m+=k,k+=o,i[e+48]=-U,i[e+49]=i[e+47]=-f,i[e+50]=i[e+46]=-w,i[e+51]=i[e+45]=-u,i[e+52]=i[e+44]=-s,i[e+53]=i[e+43]=-L,i[e+54]=i[e+42]=-M,i[e+55]=i[e+41]=-I,i[e+56]=i[e+40]=-g,i[e+57]=i[e+39]=-B,i[e+58]=i[e+38]=-b,i[e+59]=i[e+37]=-C,i[e+60]=i[e+36]=-Q,i[e+61]=i[e+35]=-p,i[e+62]=i[e+34]=-n,i[e+63]=i[e+33]=-c,i[e+32]=-a,i[e+0]=a,i[e+31]=-q,i[e+1]=q,i[e+30]=-G,i[e+2]=G,i[e+29]=-F,i[e+3]=F,i[e+28]=-r,i[e+4]=r,i[e+27]=-S,i[e+5]=S,i[e+26]=-R,i[e+6]=R,i[e+25]=-E,i[e+7]=E,i[e+24]=-l,i[e+8]=l,i[e+23]=-h,i[e+9]=h,i[e+22]=-D,i[e+10]=D,i[e+21]=-m,i[e+11]=m,i[e+20]=-d,i[e+12]=d,i[e+19]=-k,i[e+13]=k,i[e+18]=-N,i[e+14]=N,i[e+17]=-o,i[e+15]=o,i[e+16]=0},t}(J);x.FRAME_SYNC=2047,x.VERSION={MPEG_2_5:0,MPEG_2:2,MPEG_1:3},x.LAYER={III:1,II:2,I:3},x.MODE={STEREO:0,JOINT_STEREO:1,DUAL_CHANNEL:2,MONO:3},x.SAMPLE_RATE=new Uint16Array([44100,48e3,32e3,0,22050,24e3,16e3,0]),x.BIT_RATE=new Uint16Array([32,48,56,64,80,96,112,128,160,192,224,256,320,384,8,16,24,32,40,48,56,64,80,96,112,128,144,160]),x.SCALEFACTOR_BASE=new Uint32Array([33554432,26632170,21137968]),x.SYNTHESIS_WINDOW=new Float32Array([0,-.5,-.5,-.5,-.5,-.5,-.5,-1,-1,-1,-1,-1.5,-1.5,-2,-2,-2.5,-2.5,-3,-3.5,-3.5,-4,-4.5,-5,-5.5,-6.5,-7,-8,-8.5,-9.5,-10.5,-12,-13,-14.5,-15.5,-17.5,-19,-20.5,-22.5,-24.5,-26.5,-29,-31.5,-34,-36.5,-39.5,-42.5,-45.5,-48.5,-52,-55.5,-58.5,-62.5,-66,-69.5,-73.5,-77,-80.5,-84.5,-88,-91.5,-95,-98,-101,-104,106.5,109,111,112.5,113.5,114,114,113.5,112,110.5,107.5,104,100,94.5,88.5,81.5,73,63.5,53,41.5,28.5,14.5,-1,-18,-36,-55.5,-76.5,-98.5,-122,-147,-173.5,-200.5,-229.5,-259.5,-290.5,-322.5,-355.5,-389.5,-424,-459.5,-495.5,-532,-568.5,-605,-641.5,-678,-714,-749,-783.5,-817,-849,-879.5,-908.5,-935,-959.5,-981,-1000.5,-1016,-1028.5,-1037.5,-1042.5,-1043.5,-1040,-1031.5,1018.5,1e3,976,946.5,911,869.5,822,767.5,707,640,565.5,485,397,302.5,201,92.5,-22.5,-144,-272.5,-407,-547.5,-694,-846,-1003,-1165,-1331.5,-1502,-1675.5,-1852.5,-2031.5,-2212.5,-2394,-2576.5,-2758.5,-2939.5,-3118.5,-3294.5,-3467.5,-3635.5,-3798.5,-3955,-4104.5,-4245.5,-4377.5,-4499,-4609.5,-4708,-4792.5,-4863.5,-4919,-4958,-4979.5,-4983,-4967.5,-4931.5,-4875,-4796,-4694.5,-4569.5,-4420,-4246,-4046,-3820,-3567,3287,2979.5,2644,2280.5,1888,1467.5,1018.5,541,35,-499,-1061,-1650,-2266.5,-2909,-3577,-4270,-4987.5,-5727.5,-6490,-7274,-8077.5,-8899.5,-9739,-10594.5,-11464.5,-12347,-13241,-14144.5,-15056,-15973.5,-16895.5,-17820,-18744.5,-19668,-20588,-21503,-22410.5,-23308.5,-24195,-25068.5,-25926.5,-26767,-27589,-28389,-29166.5,-29919,-30644.5,-31342,-32009.5,-32645,-33247,-33814.5,-34346,-34839.5,-35295,-35710,-36084.5,-36417.5,-36707.5,-36954,-37156.5,-37315,-37428,-37496,37519,37496,37428,37315,37156.5,36954,36707.5,36417.5,36084.5,35710,35295,34839.5,34346,33814.5,33247,32645,32009.5,31342,30644.5,29919,29166.5,28389,27589,26767,25926.5,25068.5,24195,23308.5,22410.5,21503,20588,19668,18744.5,17820,16895.5,15973.5,15056,14144.5,13241,12347,11464.5,10594.5,9739,8899.5,8077.5,7274,6490,5727.5,4987.5,4270,3577,2909,2266.5,1650,1061,499,-35,-541,-1018.5,-1467.5,-1888,-2280.5,-2644,-2979.5,3287,3567,3820,4046,4246,4420,4569.5,4694.5,4796,4875,4931.5,4967.5,4983,4979.5,4958,4919,4863.5,4792.5,4708,4609.5,4499,4377.5,4245.5,4104.5,3955,3798.5,3635.5,3467.5,3294.5,3118.5,2939.5,2758.5,2576.5,2394,2212.5,2031.5,1852.5,1675.5,1502,1331.5,1165,1003,846,694,547.5,407,272.5,144,22.5,-92.5,-201,-302.5,-397,-485,-565.5,-640,-707,-767.5,-822,-869.5,-911,-946.5,-976,-1e3,1018.5,1031.5,1040,1043.5,1042.5,1037.5,1028.5,1016,1000.5,981,959.5,935,908.5,879.5,849,817,783.5,749,714,678,641.5,605,568.5,532,495.5,459.5,424,389.5,355.5,322.5,290.5,259.5,229.5,200.5,173.5,147,122,98.5,76.5,55.5,36,18,1,-14.5,-28.5,-41.5,-53,-63.5,-73,-81.5,-88.5,-94.5,-100,-104,-107.5,-110.5,-112,-113.5,-114,-114,-113.5,-112.5,-111,-109,106.5,104,101,98,95,91.5,88,84.5,80.5,77,73.5,69.5,66,62.5,58.5,55.5,52,48.5,45.5,42.5,39.5,36.5,34,31.5,29,26.5,24.5,22.5,20.5,19,17.5,15.5,14.5,13,12,10.5,9.5,8.5,8,7,6.5,5.5,5,4.5,4,3.5,3.5,3,2.5,2.5,2,2,1.5,1.5,1,1,1,1,.5,.5,.5,.5,.5,.5]),x.QUANT_LUT_STEP_1=[[0,0,1,1,1,2,2,2,2,2,2,2,2,2],[0,0,0,0,0,0,1,1,1,2,2,2,2,2]],x.QUANT_TAB={A:91,B:94,C:8,D:12},x.QUANT_LUT_STEP_2=[[x.QUANT_TAB.C,x.QUANT_TAB.C,x.QUANT_TAB.D],[x.QUANT_TAB.A,x.QUANT_TAB.A,x.QUANT_TAB.A],[x.QUANT_TAB.B,x.QUANT_TAB.A,x.QUANT_TAB.B]],x.QUANT_LUT_STEP_3=[[68,68,52,52,52,52,52,52,52,52,52,52],[67,67,67,66,66,66,66,66,66,66,66,49,49,49,49,49,49,49,49,49,49,49,49,32,32,32,32,32,32,32],[69,69,69,69,52,52,52,52,52,52,52,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36]],x.QUANT_LUT_STEP4=[[0,1,2,17],[0,1,2,3,4,5,6,17],[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17],[0,1,3,5,6,7,8,9,10,11,12,13,14,15,16,17],[0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,17],[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]],x.QUANT_TAB=[{levels:3,group:1,bits:5},{levels:5,group:1,bits:7},{levels:7,group:0,bits:3},{levels:9,group:1,bits:10},{levels:15,group:0,bits:4},{levels:31,group:0,bits:5},{levels:63,group:0,bits:6},{levels:127,group:0,bits:7},{levels:255,group:0,bits:8},{levels:511,group:0,bits:9},{levels:1023,group:0,bits:10},{levels:2047,group:0,bits:11},{levels:4095,group:0,bits:12},{levels:8191,group:0,bits:13},{levels:16383,group:0,bits:14},{levels:32767,group:0,bits:15},{levels:65535,group:0,bits:16}];var Y=function(A){function t(t){var i;return(i=A.call(this,t)||this).onDecodeCallback=t.onAudioDecode,i.module=t.wasmModule,i.bufferSize=t.audioBufferSize||131072,i.bufferMode=t.streaming?L.MODE.EVICT:L.MODE.EXPAND,i.sampleRate=0,i}u(t,A);var i=t.prototype;return i.initializeWasmDecoder=function(){this.module.instance?(this.instance=this.module.instance,this.functions=this.module.instance.exports,this.decoder=this.functions._mp2_decoder_create(this.bufferSize,this.bufferMode)):console.warn("JSMpeg: WASM module not compiled yet")},i.destroy=function(){this.decoder&&this.functions._mp2_decoder_destroy(this.decoder)},i.bufferGetIndex=function(){if(this.decoder)return this.functions._mp2_decoder_get_index(this.decoder)},i.bufferSetIndex=function(A){this.decoder&&this.functions._mp2_decoder_set_index(this.decoder,A)},i.bufferWrite=function(A){this.decoder||this.initializeWasmDecoder();for(var t=0,i=0;i>4<<4;this.gl.viewport(0,0,i,this.height)},t.createTexture=function(A,t){var i=this.gl,e=i.createTexture();return i.bindTexture(i.TEXTURE_2D,e),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.uniform1i(i.getUniformLocation(this.program,t),A),e},t.createProgram=function(A,t){var i=this.gl,e=i.createProgram();return i.attachShader(e,this.compileShader(i.VERTEX_SHADER,A)),i.attachShader(e,this.compileShader(i.FRAGMENT_SHADER,t)),i.linkProgram(e),i.useProgram(e),e},t.compileShader=function(A,t){var i=this.gl,e=i.createShader(A);if(i.shaderSource(e,t),i.compileShader(e),!i.getShaderParameter(e,i.COMPILE_STATUS))throw new Error(i.getShaderInfoLog(e));return e},t.allowsClampedTextureData=function(){var A=this.gl,t=A.createTexture();return A.bindTexture(A.TEXTURE_2D,t),A.texImage2D(A.TEXTURE_2D,0,A.LUMINANCE,1,1,0,A.LUMINANCE,A.UNSIGNED_BYTE,new Uint8ClampedArray([0])),0===A.getError()},t.renderProgress=function(A){var t=this.gl;t.useProgram(this.loadingProgram);var i=t.getUniformLocation(this.loadingProgram,"progress");t.uniform1f(i,A),t.drawArrays(t.TRIANGLE_STRIP,0,4)},t.render=function(A,t,i,e){if(this.enabled){var s=this.gl,o=this.width+15>>4<<4,g=this.height,I=o>>1,a=g>>1;e&&this.shouldCreateUnclampedViews&&(A=new Uint8Array(A.buffer),t=new Uint8Array(t.buffer),i=new Uint8Array(i.buffer)),s.useProgram(this.program),this.updateTexture(s.TEXTURE0,this.textureY,o,g,A),this.updateTexture(s.TEXTURE1,this.textureCb,I,a,t),this.updateTexture(s.TEXTURE2,this.textureCr,I,a,i),s.drawArrays(s.TRIANGLE_STRIP,0,4)}},t.updateTexture=function(A,t,i,e,s){var o=this.gl;o.activeTexture(A),o.bindTexture(o.TEXTURE_2D,t),this.hasTextureData[A]?o.texSubImage2D(o.TEXTURE_2D,0,0,0,i,e,o.LUMINANCE,o.UNSIGNED_BYTE,s):(this.hasTextureData[A]=!0,o.texImage2D(o.TEXTURE_2D,0,o.LUMINANCE,i,e,0,o.LUMINANCE,o.UNSIGNED_BYTE,s))},t.deleteTexture=function(A,t){var i=this.gl;i.activeTexture(A),i.bindTexture(i.TEXTURE_2D,null),i.deleteTexture(t)},A.IsSupported=function(){try{if(!window.WebGLRenderingContext)return!1;var A=document.createElement("canvas");return!(!A.getContext("webgl")&&!A.getContext("experimental-webgl"))}catch(A){return!1}},A}();H.SHADER={FRAGMENT_YCRCB_TO_RGBA:["precision mediump float;","uniform sampler2D textureY;","uniform sampler2D textureCb;","uniform sampler2D textureCr;","varying vec2 texCoord;","mat4 rec601 = mat4(","1.16438, 0.00000, 1.59603, -0.87079,","1.16438, -0.39176, -0.81297, 0.52959,","1.16438, 2.01723, 0.00000, -1.08139,","0, 0, 0, 1",");","void main() {","float y = texture2D(textureY, texCoord).r;","float cb = texture2D(textureCb, texCoord).r;","float cr = texture2D(textureCr, texCoord).r;","gl_FragColor = vec4(y, cr, cb, 1.0) * rec601;","}"].join("\n"),FRAGMENT_LOADING:["precision mediump float;","uniform float progress;","varying vec2 texCoord;","void main() {","float c = ceil(progress-(1.0-texCoord.y));","gl_FragColor = vec4(c,c,c,1);","}"].join("\n"),VERTEX_IDENTITY:["attribute vec2 vertex;","varying vec2 texCoord;","void main() {","texCoord = vertex;","gl_Position = vec4((vertex * 2.0 - 1.0) * vec2(1, -1), 0.0, 1.0);","}"].join("\n")};var P=function(){function A(A){A.canvas?(this.canvas=A.canvas,this.ownsCanvasElement=!1):(this.canvas=document.createElement("canvas"),this.ownsCanvasElement=!0),this.width=this.canvas.width,this.height=this.canvas.height,this.enabled=!0,this.context=this.canvas.getContext("2d")}var t=A.prototype;return t.destroy=function(){this.ownsCanvasElement&&this.canvas.remove()},t.resize=function(A,t){this.width=0|A,this.height=0|t,this.canvas.width=this.width,this.canvas.height=this.height,this.imageData=this.context.getImageData(0,0,this.width,this.height),G(this.imageData.data,255)},t.renderProgress=function(A){var t=this.canvas.width,i=this.canvas.height,e=this.context;e.fillStyle="#222",e.fillRect(0,0,t,i),e.fillStyle="#fff",e.fillRect(0,i-i*A,t,i*A)},t.render=function(A,t,i){this.YCbCrToRGBA(A,t,i,this.imageData.data),this.context.putImageData(this.imageData,0,0)},t.YCbCrToRGBA=function(A,t,i,e){if(this.enabled)for(var s,o,g,I,a,B=this.width+15>>4<<4,r=B>>1,C=0,n=B,E=B+(B-this.width),Q=0,h=r-(this.width>>1),d=0,c=4*this.width,l=4*this.width,u=this.width>>1,w=this.height>>1,p=0;p>8)-179,I=(88*o>>8)-44+(183*s>>8)-91,a=o+(198*o>>8)-227;var m=A[C++],f=A[C++];e[d]=m+g,e[d+1]=m-I,e[d+2]=m+a,e[d+4]=f+g,e[d+5]=f-I,e[d+6]=f+a,d+=8;var y=A[n++],R=A[n++];e[c]=y+g,e[c+1]=y-I,e[c+2]=y+a,e[c+4]=R+g,e[c+5]=R-I,e[c+6]=R+a,c+=8}C+=E,n+=E,d+=l,c+=l,Q+=h}},A}(),O=function(){function A(){this.context=A.CachedContext=A.CachedContext||new(window.AudioContext||window.webkitAudioContext),this.gain=this.context.createGain(),this.destination=this.gain,this.gain.connect(this.context.destination),this.context._connections=(this.context._connections||0)+1,this.startTime=0,this.buffer=null,this.wallclockStartTime=0,this.volume=1,this.enabled=!0,this.unlocked=!A.NeedsUnlocking(),Object.defineProperty(this,"enqueuedTime",{get:this.getEnqueuedTime})}var t=A.prototype;return t.destroy=function(){this.gain.disconnect(),this.context._connections--,0===this.context._connections&&(this.context.close(),A.CachedContext=null)},t.play=function(A,t,i){if(this.enabled){if(!this.unlocked){var e=S();return this.wallclockStartTimethis.memory.buffer.byteLength){var i=this.brk-this.memory.buffer.byteLength,e=Math.ceil(i/this.pageSize);this.memory.grow(e),this.createHeapViews()}return t},t.c_abort=function(A){console.warn("JSMPeg: WASM abort",arguments)},t.c_assertFail=function(A){console.warn("JSMPeg: WASM ___assert_fail",arguments)},t.readDylinkSection=function(A){var t=new Uint8Array(A),i=0,e=function(){for(var A=0,e=1;;){var s=t[i++];if(A+=(127&s)*e,e*=128,!(128&s))return A}},s=function(A){for(var e=0;ethis.maxAudioLag&&(this.audioOut.resetEnqueuedTime(),this.audioOut.enabled=!1),A=this.audio.decode()}while(A);this.audioOut.enabled=!0}},t.updateForStaticFile=function(){var A=!1,t=0;if(this.audio&&this.audio.canPlay){for(;!A&&this.audio.decodedTime-this.audio.currentTime<.25;)A=!this.audio.decode();this.video&&this.video.currentTime0&&(e>2*s&&(this.startTime+=e),A=!this.video.decode()),t=this.demuxer.currentTime-i}this.source.resume(t),A&&this.source.completed?this.loop?this.seek(0):(this.stop(),this.options.onEnded&&this.options.onEnded(this)):A&&this.options.onStalled&&this.options.onStalled(this)},A}(),W={Player:X,VideoElement:b,BitBuffer:L,Source:{Ajax:M,AjaxProgressive:q,WebSocket:N,Fetch:function(){function A(A,t){this.url=A,this.destination=null,this.request=null,this.streaming=!0,this.completed=!1,this.established=!1,this.progress=0,this.aborted=!1,this.onEstablishedCallback=t.onSourceEstablished,this.onCompletedCallback=t.onSourceCompleted,t.hookOnEstablished&&(this.hookOnEstablished=t.hookOnEstablished)}var t=A.prototype;return t.connect=function(A){this.destination=A},t.start=function(){var A=this,t={method:"GET",headers:new Headers,cache:"default"};self.fetch(this.url,t).then((function(t){if(t.ok&&t.status>=200&&t.status<=299)return A.progress=1,A.established=!0,A.pump(t.body.getReader())})).catch((function(A){throw A}))},t.pump=function(A){var t=this;return A.read().then((function(i){if(!i.done)return t.aborted?A.cancel():(t.destination&&t.destination.write(i.value.buffer),t.pump(A));t.completed=!0})).catch((function(A){throw A}))},t.resume=function(){},t.abort=function(){this.aborted=!0},A}()},Demuxer:{TS:U},Decoder:{Base:J,MPEG1Video:T,MPEG1VideoWASM:v,MP2Audio:x,MP2AudioWASM:Y},Renderer:{WebGL:H,Canvas2D:P},AudioOutput:{WebAudio:O},WASMModule:K,Now:S,CreateVideoElements:function(){for(var A=document.querySelectorAll(".jsmpeg"),t=0;tthis.q=A))}resume(){this.q?.(),this.Z=this.q=void 0}} +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const V=A=>!e(A)&&"function"==typeof A.then,z=1073741823;const $=A(class extends t{constructor(){super(...arguments),this._$Cwt=z,this._$Cbt=[],this._$CK=new Z(this),this._$CX=new j}render(...A){return A.find((A=>!V(A)))??i}update(A,t){const e=this._$Cbt;let s=e.length;this._$Cbt=t;const o=this._$CK,g=this._$CX;this.isConnected||this.disconnected();for(let A=0;Athis._$Cwt);A++){const i=t[A];if(!V(i))return this._$Cwt=A,i;A{for(;g.get();)await g.get();const t=o.deref();if(void 0!==t){const e=t._$Cbt.indexOf(i);e>-1&&e{let i=!1;const e=new W.VideoElement(this,A,{canvas:this._jsmpegCanvasElement},{pauseWhenHidden:!1,autoplay:!1,protocols:[],audio:!1,videoBufferSize:4194304,preserveDrawingBuffer:!0,...this.cameraConfig?.jsmpeg?.options,reconnectInterval:0,onVideoDecode:()=>{!i&&this._jsmpegCanvasElement&&(i=!0,t(e))},onPlay:()=>g(this),onPause:()=>I(this)})})),this._jsmpegCanvasElement&&a(this,this._jsmpegCanvasElement,{player:this,capabilities:{supportsPause:!0},technology:["jsmpeg"]})}_resetPlayer(){if(this._refreshPlayerTimer.stop(),this._jsmpegVideoPlayer){try{this._jsmpegVideoPlayer.destroy()}catch(A){}this._jsmpegVideoPlayer=void 0}this._jsmpegCanvasElement&&(this._jsmpegCanvasElement.remove(),this._jsmpegCanvasElement=void 0)}connectedCallback(){super.connectedCallback(),this.isConnected&&this.requestUpdate()}disconnectedCallback(){this.isConnected||this._resetPlayer(),super.disconnectedCallback()}async _refreshPlayer(){if(!this.hass)return;this._resetPlayer(),this._jsmpegCanvasElement=document.createElement("canvas"),this._jsmpegCanvasElement.className="media";const A=this.cameraEndpoints?.jsmpeg;if(!A)return B(this,r("error.live_camera_no_endpoint"),{context:this.cameraConfig});const t=await c(this,this.hass,A,86400);t&&(await this._createJSMPEGPlayer(t),this._refreshPlayerTimer.start(82800,(()=>this.requestUpdate())))}render(){return C`${$((async()=>(await this._refreshPlayer(),this._jsmpegVideoPlayer&&this._jsmpegCanvasElement?C`${this._jsmpegCanvasElement}`:B(this,r("error.jsmpeg_no_player"))))(),n({cardWideConfig:this.cardWideConfig}))}`}static get styles(){return E(":host {\n width: 100%;\n height: 100%;\n display: flex;\n}\n\ncanvas {\n display: block;\n width: 100%;\n height: 100%;\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}")}};Q([h({attribute:!1})],AA.prototype,"cameraConfig",void 0),Q([h({attribute:!1})],AA.prototype,"cameraEndpoints",void 0),Q([h({attribute:!1})],AA.prototype,"cardWideConfig",void 0),AA=Q([d("frigate-card-live-jsmpeg")],AA);export{AA as FrigateCardLiveJSMPEG}; diff --git a/config/www/community/frigate-hass-card/jsmpeg-45778f1d.js.gz b/config/www/community/frigate-hass-card/jsmpeg-45778f1d.js.gz new file mode 100644 index 00000000..185d8fa3 Binary files /dev/null and b/config/www/community/frigate-hass-card/jsmpeg-45778f1d.js.gz differ diff --git a/config/www/community/frigate-hass-card/jsmpeg-50dde246.js b/config/www/community/frigate-hass-card/jsmpeg-50dde246.js new file mode 100644 index 00000000..4e26ebf4 --- /dev/null +++ b/config/www/community/frigate-hass-card/jsmpeg-50dde246.js @@ -0,0 +1,12 @@ +import{dx as A,eK as t,dz as i,eL as e,a as s,dA as o,du as g,dv as I,ds as a,l as B,cP as r,x as C,dh as n,r as E,_ as Q,n as h,b as d,t as c}from"./card-320adb66.js";import{d as l}from"./dispatch-live-error-c649b480.js";import{c as u}from"./endpoint-a6d38c7a.js";function w(){return w=Object.assign?Object.assign.bind():function(A){for(var t=1;t"string"==typeof A&&A.constructor===String,f=function(A){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t=A,"Promise"===Object.prototype.toString.call(t).slice(8,-1)?A:new Promise((t=>{A(),setTimeout(t,i)}))};var y="WJ3NAvwFY9",R="tR2-0dd-e1",k="ZgIIHVSSYI",b="kAA8SjbHe2",S="OueN4AU4CJ";!function(A,t){void 0===t&&(t={});var i=t.insertAt;if(A&&"undefined"!=typeof document){var e=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css","top"===i&&e.firstChild?e.insertBefore(s,e.firstChild):e.appendChild(s),s.styleSheet?s.styleSheet.cssText=A:s.appendChild(document.createTextNode(A))}}(".WJ3NAvwFY9,.ZgIIHVSSYI,.kAA8SjbHe2,.tR2-0dd-e1{height:100%;left:0;position:absolute;top:0;width:100%;z-index:1}.ZgIIHVSSYI{-ms-flex-pack:center;-ms-flex-align:center;-webkit-align-items:center;align-items:center;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-justify-content:center;justify-content:center}.WJ3NAvwFY9,.tR2-0dd-e1{display:block}.tR2-0dd-e1.OueN4AU4CJ{display:none}.ZgIIHVSSYI,.kAA8SjbHe2{-webkit-tap-highlight-color:rgba(255,0,0,0);cursor:pointer;opacity:.7}.OueN4AU4CJ.ZgIIHVSSYI,.OueN4AU4CJ.kAA8SjbHe2{display:none}.ZgIIHVSSYI{z-index:10}.ZgIIHVSSYI>svg{fill:#fff;height:12vw;max-height:60px;max-width:60px;width:12vw}.kAA8SjbHe2{-ms-flex-pack:end;-ms-flex-align:end;-webkit-align-items:flex-end;align-items:flex-end;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-justify-content:flex-end;justify-content:flex-end;z-index:10}.kAA8SjbHe2>svg{fill:#fff;height:9vw;margin:0 15px 15px 0;max-height:40px;max-width:40px;width:9vw}");var G=function(){function A(A,t,i,e){var s=void 0===i?{}:i,o=s.canvas,g=void 0===o?"":o,I=s.poster,a=void 0===I?"":I,B=s.autoplay,r=void 0!==B&&B,C=s.autoSetWrapperSize,n=void 0!==C&&C,E=s.loop,Q=void 0!==E&&E,h=s.control,d=void 0===h||h,c=s.decodeFirstFrame,l=void 0===c||c,u=s.picMode,p=void 0!==u&&u,m=s.progressive,f=void 0===m||m,y=s.chunkSize,R=void 0===y?1048576:y,k=s.hooks,b=void 0===k?{}:k;void 0===e&&(e={}),this.options=w({videoUrl:t,canvas:g,poster:a,picMode:p,autoplay:r,autoSetWrapperSize:n,loop:Q,control:d,decodeFirstFrame:l,progressive:f,chunkSize:R,hooks:w({play:function(){},pause:function(){},stop:function(){},load:function(){}},b)},e),this.options.needPlayButton=this.options.control&&!this.options.picMode,this.player=null,this.els={wrapper:D(A)?document.querySelector(A):A,canvas:null,playButton:document.createElement("div"),unmuteButton:null,poster:null},"static"===window.getComputedStyle(this.els.wrapper).getPropertyValue("position")&&(this.els.wrapper.style.position="relative"),this.els.wrapper.clientRect=this.els.wrapper.getBoundingClientRect(),this.initCanvas(),this.initPlayButton(),this.initPlayer()}var t=A.prototype;return t.initCanvas=function(){this.options.canvas?this.els.canvas=D(this.options.canvas)?document.querySelector(this.options.canvas):this.options.canvas:(this.els.canvas=document.createElement("canvas"),this.els.canvas.classList.add(y),this.els.wrapper.appendChild(this.els.canvas))},t.initPlayer=function(){var A=this;this.options=w(this.options,{canvas:this.els.canvas});var t=w({},this.options,{autoplay:!1});if(this.player=new Z(this.options.videoUrl,t,{play:function(){A.options.needPlayButton&&A.els.playButton.classList.add(S),A.els.poster&&A.els.poster.classList.add(S),A.options.hooks.play()},pause:function(){A.options.needPlayButton&&A.els.playButton.classList.remove(S),A.options.hooks.pause()},stop:function(){A.els.poster&&A.els.poster.classList.remove(S),A.options.hooks.stop()},load:function(){A.options.autoplay&&A.play(),A._autoSetWrapperSize(),A.options.hooks.load()}}),this._copyPlayerFuncs(),this.els.wrapper.playerInstance=this.player,!this.options.poster||this.options.autoplay||this.player.options.streaming||(this.options.decodeFirstFrame=!1,this.els.poster=new Image,this.els.poster.src=this.options.poster,this.els.poster.classList.add(R),this.els.wrapper.appendChild(this.els.poster)),this.player.options.streaming||this.els.wrapper.addEventListener("click",this.onClick.bind(this)),(this.options.autoplay||this.player.options.streaming)&&this.els.playButton.classList.add(S),this.player.audioOut&&!this.player.audioOut.unlocked){var i=this.els.wrapper;(this.options.autoplay||this.player.options.streaming)&&(this.els.unmuteButton=document.createElement("div"),this.els.unmuteButton.innerHTML='\n\n \n\n',this.els.unmuteButton.classList.add(b),this.els.wrapper.appendChild(this.els.unmuteButton),i=this.els.unmuteButton),this.unlockAudioBound=this.onUnlockAudio.bind(this,i),i.addEventListener("touchstart",this.unlockAudioBound,!1),i.addEventListener("click",this.unlockAudioBound,!0)}},t.initPlayButton=function(){this.options.needPlayButton&&(this.els.playButton.classList.add(k),this.els.playButton.innerHTML='\n\n \n\n',this.els.wrapper.appendChild(this.els.playButton))},t._autoSetWrapperSize=function(){var A=this;if(!this.options.autoSetWrapperSize)return Promise.resolve();var t=this.player.video.destination;return t?Promise.resolve().then((function(){return f((function(){A.els.wrapper.style.width=t.width+"px",A.els.wrapper.style.height=t.height+"px"}))})):Promise.resolve()},t.onUnlockAudio=function(A,t){var i=this;this.els.unmuteButton&&(t.preventDefault(),t.stopPropagation()),this.player.audioOut.unlock((function(){i.els.unmuteButton&&i.els.unmuteButton.classList.add(S),A.removeEventListener("touchstart",i.unlockAudioBound),A.removeEventListener("click",i.unlockAudioBound)}))},t.onClick=function(){this.options.control&&(this.player.isPlaying?this.pause():this.play())},t._copyPlayerFuncs=function(){var A=this;this.play=function(){return A.player.play()},this.pause=function(){return A.player.pause()},this.stop=function(){return A.player.stop()},this.destroy=function(){A.player.destroy(),A.els.wrapper.innerHTML="",A.els.wrapper.playerInstance=null}},A}(),F=function(){return window.performance?window.performance.now()/1e3:Date.now()/1e3},M=function(A,t){if(A.fill)A.fill(t);else for(var i=0;iA&&this.loadNextChunk())},t.destroy=function(){this.request.abort(),this.aborted=!0},t.loadNextChunk=function(){var A=this,t=this.loadedSize,i=Math.min(this.loadedSize+this.chunkSize-1,this.fileSize-1);if(t>=this.fileSize||this.aborted)return this.completed=!0,void(this.onCompletedCallback&&this.onCompletedCallback(this));this.isLoading=!0,this.loadStartTime=F(),this.request=new XMLHttpRequest,this.request.onreadystatechange=function(){A.request.readyState===A.request.DONE&&A.request.status>=200&&A.request.status<300?A.onChunkLoad(A.request.response):A.request.readyState===A.request.DONE&&A.loadFails++<3&&A.loadNextChunk()},0===t&&(this.request.onprogress=this.onProgress.bind(this)),this.request.open("GET",this.url+"?"+t+"-"+i),this.request.setRequestHeader("Range","bytes="+t+"-"+i),this.request.responseType="arraybuffer",this.request.send()},t.onProgress=function(A){this.progress=A.loaded/A.total},t.onChunkLoad=function(A){var t=!this.established;this.established=!0,this.progress=1,this.loadedSize+=A.byteLength,this.loadFails=0,this.isLoading=!1,t&&this.hookOnEstablished&&this.hookOnEstablished(),t&&this.onEstablishedCallback&&this.onEstablishedCallback(this),this.destination&&this.destination.write(A),this.loadTime=F()-this.loadStartTime,this.throttled||this.loadNextChunk()},A}(),U=function(){function A(A,t){this.url=A,this.options=t,this.socket=null,this.streaming=!0,this.callbacks={connect:[],data:[]},this.destination=null,this.reconnectInterval=void 0!==t.reconnectInterval?t.reconnectInterval:5,this.shouldAttemptReconnect=!!this.reconnectInterval,this.completed=!1,this.established=!1,this.progress=0,this.reconnectTimeoutId=0,this.onEstablishedCallback=t.onSourceEstablished,this.onCompletedCallback=t.onSourceCompleted,t.hookOnEstablished&&(this.hookOnEstablished=t.hookOnEstablished)}var t=A.prototype;return t.connect=function(A){this.destination=A},t.destroy=function(){clearTimeout(this.reconnectTimeoutId),this.shouldAttemptReconnect=!1,this.socket.close()},t.start=function(){this.shouldAttemptReconnect=!!this.reconnectInterval,this.progress=0,this.established=!1,this.options.protocols?this.socket=new WebSocket(this.url,this.options.protocols):this.socket=new WebSocket(this.url),this.socket.binaryType="arraybuffer",this.socket.onmessage=this.onMessage.bind(this),this.socket.onopen=this.onOpen.bind(this),this.socket.onerror=this.onClose.bind(this),this.socket.onclose=this.onClose.bind(this)},t.resume=function(){},t.onOpen=function(){this.progress=1},t.onClose=function(){var A=this;this.shouldAttemptReconnect&&(clearTimeout(this.reconnectTimeoutId),this.reconnectTimeoutId=setTimeout((function(){A.start()}),1e3*this.reconnectInterval))},t.onMessage=function(A){var t=!this.established;this.established=!0,t&&this.hookOnEstablished&&this.hookOnEstablished(),t&&this.onEstablishedCallback&&this.onEstablishedCallback(this),this.destination&&this.destination.write(A.data)},A}(),J=function(){function A(t,i){"object"==typeof t?(this.bytes=t instanceof Uint8Array?t:new Uint8Array(t),this.byteLength=this.bytes.length):(this.bytes=new Uint8Array(t||1048576),this.byteLength=0),this.mode=i||A.MODE.EXPAND,this.index=0}var t=A.prototype;return t.resize=function(A){var t=new Uint8Array(A);0!==this.byteLength&&(this.byteLength=Math.min(this.byteLength,A),t.set(this.bytes,0,this.byteLength)),this.bytes=t,this.index=Math.min(this.index,this.byteLength<<3)},t.evict=function(A){var t=this.index>>3,i=this.bytes.length-this.byteLength;if(this.index===this.byteLength<<3||A>i+t)return this.byteLength=0,void(this.index=0);0!==t&&(this.bytes.copyWithin?this.bytes.copyWithin(0,t,this.byteLength):this.bytes.set(this.bytes.subarray(t,this.byteLength)),this.byteLength-=t,this.index-=t<<3)},t.write=function(t){var i="object"==typeof t[0],e=0,s=this.bytes.length-this.byteLength;if(i){e=0;for(var o=0;os)if(this.mode===A.MODE.EXPAND){var g=Math.max(2*this.bytes.length,e-s);this.resize(g)}else this.evict(e);if(i)for(var I=0;I>3;A>3;return A>=this.byteLength||0===this.bytes[A]&&0===this.bytes[A+1]&&1===this.bytes[A+2]},t.peek=function(A){for(var t=this.index,i=0;A;){var e=8-(7&t),s=e>3]&255>>8-s<>o,t+=s,A-=s}return i},t.read=function(A){var t=this.peek(A);return this.index+=A,t},t.skip=function(A){return this.index+=A},t.rewind=function(A){this.index=Math.max(this.index-A,0)},t.has=function(A){return(this.byteLength<<3)-this.index>=A},A}();J.MODE={EVICT:1,EXPAND:2};var T=function(){function A(){this.bits=null,this.leftoverBytes=null,this.guessVideoFrameEnd=!0,this.pidsToStreamIds={},this.pesPacketInfo={},this.startTime=0,this.currentTime=0}var t=A.prototype;return t.connect=function(A,t){this.pesPacketInfo[A]={destination:t,currentLength:0,totalLength:0,pts:0,buffers:[]}},t.write=function(A){if(this.leftoverBytes){var t=A.byteLength+this.leftoverBytes.byteLength;this.bits=new J(t),this.bits.write([this.leftoverBytes,A])}else this.bits=new J(A);for(;this.bits.has(1504)&&this.parsePacket(););var i=this.bits.byteLength-(this.bits.index>>3);this.leftoverBytes=i>0?this.bits.bytes.subarray(this.bits.index>>3):null},t.parsePacket=function(){if(71!==this.bits.read(8)&&!this.resync())return!1;var A=187+(this.bits.index>>3);this.bits.read(1);var t=this.bits.read(1);this.bits.read(1);var i=this.bits.read(13);this.bits.read(2);var e=this.bits.read(2);this.bits.read(4);var s=this.pidsToStreamIds[i];if(t&&s){var o=this.pesPacketInfo[s];o&&o.currentLength&&this.packetComplete(o)}if(1&e){if(2&e){var g=this.bits.read(8);this.bits.skip(g<<3)}if(t&&this.bits.nextBytesAreStartCode()){this.bits.skip(24),s=this.bits.read(8),this.pidsToStreamIds[i]=s;var I=this.bits.read(16);this.bits.skip(8);var a=this.bits.read(2);this.bits.skip(6);var B=this.bits.read(8),r=this.bits.index+(B<<3),C=this.pesPacketInfo[s];if(C){var n=0;if(2&a){this.bits.skip(4);var E=this.bits.read(3);this.bits.skip(1);var Q=this.bits.read(15);this.bits.skip(1);var h=this.bits.read(15);this.bits.skip(1),n=(1073741824*E+32768*Q+h)/9e4,this.currentTime=n,-1===this.startTime&&(this.startTime=n)}var d=I?I-B-3:0;this.packetStart(C,n,d)}this.bits.index=r}if(s){var c=this.pesPacketInfo[s];if(c){var l=this.bits.index>>3,u=!t&&2&e;(this.packetAddData(c,l,A)||this.guessVideoFrameEnd&&u)&&this.packetComplete(c)}}}return this.bits.index=A<<3,!0},t.resync=function(){if(!this.bits.has(9024))return!1;for(var A=this.bits.index>>3,t=0;t<187;t++)if(71===this.bits.bytes[A+t]){for(var i=!0,e=1;e<5;e++)if(71!==this.bits.bytes[A+t+188*e]){i=!1;break}if(i)return this.bits.index=A+t+1<<3,!0}return console.warn("JSMpeg: Possible garbage data. Skipping."),this.bits.skip(1496),!1},t.packetStart=function(A,t,i){A.totalLength=i,A.currentLength=0,A.pts=t},t.packetAddData=function(A,t,i){return A.buffers.push(this.bits.bytes.subarray(t,i)),A.currentLength+=i-t,0!==A.totalLength&&A.currentLength>=A.totalLength},t.packetComplete=function(A){A.destination.write(A.pts,A.buffers),A.totalLength=0,A.currentLength=0,A.buffers=[]},A}();T.STREAM={PACK_HEADER:186,SYSTEM_HEADER:187,PROGRAM_MAP:188,PRIVATE_1:189,PADDING:190,PRIVATE_2:191,AUDIO_1:192,VIDEO_1:224,DIRECTORY:255};var v=function(){function A(A){this.destination=null,this.canPlay=!1,this.collectTimestamps=!A.streaming,this.bytesWritten=0,this.timestamps=[],this.timestampIndex=0,this.startTime=0,this.decodedTime=0,Object.defineProperty(this,"currentTime",{get:this.getCurrentTime})}var t=A.prototype;return t.destroy=function(){},t.connect=function(A){this.destination=A},t.bufferGetIndex=function(){return this.bits.index},t.bufferSetIndex=function(A){this.bits.index=A},t.bufferWrite=function(A){return this.bits.write(A)},t.write=function(A,t){this.collectTimestamps&&(0===this.timestamps.length&&(this.startTime=A,this.decodedTime=A),this.timestamps.push({index:this.bytesWritten<<3,time:A})),this.bytesWritten+=this.bufferWrite(t),this.canPlay=!0},t.seek=function(A){if(this.collectTimestamps){this.timestampIndex=0;for(var t=0;tA);t++)this.timestampIndex=t;var i=this.timestamps[this.timestampIndex];i?(this.bufferSetIndex(i.index),this.decodedTime=i.time):(this.bits.index=0,this.decodedTime=this.startTime)}},t.decode=function(){this.advanceDecodedTime(0)},t.advanceDecodedTime=function(A){if(this.collectTimestamps){for(var t=-1,i=this.bufferGetIndex(),e=this.timestampIndex;ei);e++)t=e;if(-1!==t&&t!==this.timestampIndex)return this.timestampIndex=t,void(this.decodedTime=this.timestamps[this.timestampIndex].time)}this.decodedTime+=A},t.getCurrentTime=function(){return this.decodedTime},A}(),x=function(A){function t(t){var i;(i=A.call(this,t)||this).onDecodeCallback=t.onVideoDecode;var e=t.videoBufferSize||524288,s=t.streaming?J.MODE.EVICT:J.MODE.EXPAND;return i.bits=new J(e,s),i.customIntraQuantMatrix=new Uint8Array(64),i.customNonIntraQuantMatrix=new Uint8Array(64),i.blockData=new Int32Array(64),i.currentFrame=0,i.decodeFirstFrame=!1!==t.decodeFirstFrame,i}p(t,A);var i=t.prototype;return i.write=function(A,i){if(v.prototype.write.call(this,A,i),!this.hasSequenceHeader){if(-1===this.bits.findStartCode(t.START.SEQUENCE))return!1;this.decodeSequenceHeader(),this.decodeFirstFrame&&this.decode()}},i.decode=function(){var A=F();if(!this.hasSequenceHeader)return!1;if(-1===this.bits.findStartCode(t.START.PICTURE))return!1;this.decodePicture(),this.advanceDecodedTime(1/this.frameRate);var i=F()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,i),!0},i.readHuffman=function(A){var t=0;do{t=A[t+this.bits.read(1)]}while(t>=0&&0!==A[t]);return A[t+2]},i.decodeSequenceHeader=function(){var A=this.bits.read(12),i=this.bits.read(12);if(this.bits.skip(4),this.frameRate=t.PICTURE_RATE[this.bits.read(4)],this.bits.skip(30),A===this.width&&i===this.height||(this.width=A,this.height=i,this.initBuffers(),this.destination&&this.destination.resize(A,i)),this.bits.read(1)){for(var e=0;e<64;e++)this.customIntraQuantMatrix[t.ZIG_ZAG[e]]=this.bits.read(8);this.intraQuantMatrix=this.customIntraQuantMatrix}if(this.bits.read(1)){for(var s=0;s<64;s++){var o=t.ZIG_ZAG[s];this.customNonIntraQuantMatrix[o]=this.bits.read(8)}this.nonIntraQuantMatrix=this.customNonIntraQuantMatrix}this.hasSequenceHeader=!0},i.initBuffers=function(){this.intraQuantMatrix=t.DEFAULT_INTRA_QUANT_MATRIX,this.nonIntraQuantMatrix=t.DEFAULT_NON_INTRA_QUANT_MATRIX,this.mbWidth=this.width+15>>4,this.mbHeight=this.height+15>>4,this.mbSize=this.mbWidth*this.mbHeight,this.codedWidth=this.mbWidth<<4,this.codedHeight=this.mbHeight<<4,this.codedSize=this.codedWidth*this.codedHeight,this.halfWidth=this.mbWidth<<3,this.halfHeight=this.mbHeight<<3,this.currentY=new Uint8ClampedArray(this.codedSize),this.currentY32=new Uint32Array(this.currentY.buffer),this.currentCr=new Uint8ClampedArray(this.codedSize>>2),this.currentCr32=new Uint32Array(this.currentCr.buffer),this.currentCb=new Uint8ClampedArray(this.codedSize>>2),this.currentCb32=new Uint32Array(this.currentCb.buffer),this.forwardY=new Uint8ClampedArray(this.codedSize),this.forwardY32=new Uint32Array(this.forwardY.buffer),this.forwardCr=new Uint8ClampedArray(this.codedSize>>2),this.forwardCr32=new Uint32Array(this.forwardCr.buffer),this.forwardCb=new Uint8ClampedArray(this.codedSize>>2),this.forwardCb32=new Uint32Array(this.forwardCb.buffer)},i.decodePicture=function(){if(this.currentFrame++,this.bits.skip(10),this.pictureType=this.bits.read(3),this.bits.skip(16),!(this.pictureType<=0||this.pictureType>=t.PICTURE_TYPE.B)){if(this.pictureType===t.PICTURE_TYPE.PREDICTIVE){if(this.fullPelForward=this.bits.read(1),this.forwardFCode=this.bits.read(3),0===this.forwardFCode)return;this.forwardRSize=this.forwardFCode-1,this.forwardF=1<=t.START.SLICE_FIRST&&A<=t.START.SLICE_LAST;)this.decodeSlice(255&A),A=this.bits.findNextStartCode();if(-1!==A&&this.bits.rewind(32),this.destination&&this.destination.render(this.currentY,this.currentCr,this.currentCb,!0),this.pictureType===t.PICTURE_TYPE.INTRA||this.pictureType===t.PICTURE_TYPE.PREDICTIVE){var i=this.forwardY,e=this.forwardY32,s=this.forwardCr,o=this.forwardCr32,g=this.forwardCb,I=this.forwardCb32;this.forwardY=this.currentY,this.forwardY32=this.currentY32,this.forwardCr=this.currentCr,this.forwardCr32=this.currentCr32,this.forwardCb=this.currentCb,this.forwardCb32=this.currentCb32,this.currentY=i,this.currentY32=e,this.currentCr=s,this.currentCr32=o,this.currentCb=g,this.currentCb32=I}}},i.decodeSlice=function(A){for(this.sliceBegin=!0,this.macroblockAddress=(A-1)*this.mbWidth-1,this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0,this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.quantizerScale=this.bits.read(5);this.bits.read(1);)this.bits.skip(8);do{this.decodeMacroblock()}while(!this.bits.nextBytesAreStartCode())},i.decodeMacroblock=function(){for(var A=0,i=this.readHuffman(t.MACROBLOCK_ADDRESS_INCREMENT);34===i;)i=this.readHuffman(t.MACROBLOCK_ADDRESS_INCREMENT);for(;35===i;)A+=33,i=this.readHuffman(t.MACROBLOCK_ADDRESS_INCREMENT);if(A+=i,this.sliceBegin)this.sliceBegin=!1,this.macroblockAddress+=A;else{if(this.macroblockAddress+A>=this.mbSize)return;for(A>1&&(this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.pictureType===t.PICTURE_TYPE.PREDICTIVE&&(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0));A>1;)this.macroblockAddress++,this.mbRow=this.macroblockAddress/this.mbWidth|0,this.mbCol=this.macroblockAddress%this.mbWidth,this.copyMacroblock(this.motionFwH,this.motionFwV,this.forwardY,this.forwardCr,this.forwardCb),A--;this.macroblockAddress++}this.mbRow=this.macroblockAddress/this.mbWidth|0,this.mbCol=this.macroblockAddress%this.mbWidth;var e=t.MACROBLOCK_TYPE[this.pictureType];this.macroblockType=this.readHuffman(e),this.macroblockIntra=1&this.macroblockType,this.macroblockMotFw=8&this.macroblockType,16&this.macroblockType&&(this.quantizerScale=this.bits.read(5)),this.macroblockIntra?(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0):(this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.decodeMotionVectors(),this.copyMacroblock(this.motionFwH,this.motionFwV,this.forwardY,this.forwardCr,this.forwardCb));for(var s=2&this.macroblockType?this.readHuffman(t.CODE_BLOCK_PATTERN):this.macroblockIntra?63:0,o=0,g=32;o<6;o++)s&g&&this.decodeBlock(o),g>>=1},i.decodeMotionVectors=function(){var A,i,e=0;this.macroblockMotFw?(0!==(A=this.readHuffman(t.MOTION))&&1!==this.forwardF?(e=this.bits.read(this.forwardRSize),i=(Math.abs(A)-1<(this.forwardF<<4)-1?this.motionFwHPrev-=this.forwardF<<5:this.motionFwHPrev<-this.forwardF<<4&&(this.motionFwHPrev+=this.forwardF<<5),this.motionFwH=this.motionFwHPrev,this.fullPelForward&&(this.motionFwH<<=1),0!==(A=this.readHuffman(t.MOTION))&&1!==this.forwardF?(e=this.bits.read(this.forwardRSize),i=(Math.abs(A)-1<(this.forwardF<<4)-1?this.motionFwVPrev-=this.forwardF<<5:this.motionFwVPrev<-this.forwardF<<4&&(this.motionFwVPrev+=this.forwardF<<5),this.motionFwV=this.motionFwVPrev,this.fullPelForward&&(this.motionFwV<<=1)):this.pictureType===t.PICTURE_TYPE.PREDICTIVE&&(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0)},i.copyMacroblock=function(A,t,i,e,s){var o,g,I,a,B,r,C,n,E,Q,h,d,c,l,u,w,p,m,D,f=this.currentY32,y=this.currentCb32,R=this.currentCr32;if(g=(o=this.codedWidth)-16,I=A>>1,a=t>>1,B=!(1&~A),r=!(1&~t),C=((this.mbRow<<4)+a)*o+(this.mbCol<<4)+I,E=(n=this.mbRow*o+this.mbCol<<2)+(o<<2),B)if(r)for(;n>2&255,c|=(h=i[++C]+i[C+o])+d+2<<6&65280,c|=h+(d=i[++C]+i[C+o])+2<<14&16711680,h=i[++C]+i[C+o],C++,c|=h+d+2<<22&4278190080,f[n++]=c;n+=g>>2,C+=g-1}else for(;n>1&255,c|=(h=i[C++])+d+1<<7&65280,c|=h+(d=i[C++])+1<<15&16711680,c|=(h=i[C++])+d+1<<23&4278190080,f[n++]=c;n+=g>>2,C+=g-1}else if(r)for(;n>1&255,c|=i[++C]+i[C+o]+1<<7&65280,c|=i[++C]+i[C+o]+1<<15&16711680,c|=i[++C]+i[C+o]+1<<23&4278190080,C++,f[n++]=c;n+=g>>2,C+=g}else for(;n>2,C+=g}if(g=(o=this.halfWidth)-8,I=A/2>>1,a=t/2>>1,B=1==(A/2&1),r=1==(t/2&1),C=((this.mbRow<<3)+a)*o+(this.mbCol<<3)+I,E=(n=this.mbRow*o+this.mbCol<<1)+(o<<1),B)if(r)for(;n>2&255,D=p+(m=s[C]+s[C+o])+2>>2&255,w|=(l=e[++C]+e[C+o])+u+2<<6&65280,D|=(p=s[C]+s[C+o])+m+2<<6&65280,w|=l+(u=e[++C]+e[C+o])+2<<14&16711680,D|=p+(m=s[C]+s[C+o])+2<<14&16711680,l=e[++C]+e[C+o],p=s[C]+s[C+o],C++,w|=l+u+2<<22&4278190080,D|=p+m+2<<22&4278190080,R[n]=w,y[n]=D,n++;n+=g>>2,C+=g-1}else for(;n>1&255,D=p+(m=s[C++])+1>>1&255,w|=(l=e[C])+u+1<<7&65280,D|=(p=s[C++])+m+1<<7&65280,w|=l+(u=e[C])+1<<15&16711680,D|=p+(m=s[C++])+1<<15&16711680,w|=(l=e[C])+u+1<<23&4278190080,D|=(p=s[C++])+m+1<<23&4278190080,R[n]=w,y[n]=D,n++;n+=g>>2,C+=g-1}else if(r)for(;n>1&255,D=s[C]+s[C+o]+1>>1&255,w|=e[++C]+e[C+o]+1<<7&65280,D|=s[C]+s[C+o]+1<<7&65280,w|=e[++C]+e[C+o]+1<<15&16711680,D|=s[C]+s[C+o]+1<<15&16711680,w|=e[++C]+e[C+o]+1<<23&4278190080,D|=s[C]+s[C+o]+1<<23&4278190080,C++,R[n]=w,y[n]=D,n++;n+=g>>2,C+=g}else for(;n>2,C+=g}},i.decodeBlock=function(A){var i,e=0;if(this.macroblockIntra){var s,o;if(A<4?(s=this.dcPredictorY,o=this.readHuffman(t.DCT_DC_SIZE_LUMINANCE)):(s=4===A?this.dcPredictorCr:this.dcPredictorCb,o=this.readHuffman(t.DCT_DC_SIZE_CHROMINANCE)),o>0){var g=this.bits.read(o);this.blockData[0]=g&1<0&&0===this.bits.read(1))break;65535===n?(C=this.bits.read(6),0===(r=this.bits.read(8))?r=this.bits.read(8):128===r?r=this.bits.read(8)-256:r>128&&(r-=256)):(C=n>>8,r=255&n,this.bits.read(1)&&(r=-r)),e+=C;var E=t.ZIG_ZAG[e];e++,r<<=1,this.macroblockIntra||(r+=r<0?-1:1),1&(r=r*this.quantizerScale*i[E]>>4)||(r-=r>0?1:-1),r>2047?r=2047:r<-2048&&(r=-2048),this.blockData[E]=r*t.PREMULTIPLIER_MATRIX[E]}A<4?(I=this.currentY,B=this.codedWidth-8,a=this.mbRow*this.codedWidth+this.mbCol<<4,1&A&&(a+=8),2&A&&(a+=this.codedWidth<<3)):(I=4===A?this.currentCb:this.currentCr,B=(this.codedWidth>>1)-8,a=(this.mbRow*this.codedWidth<<2)+(this.mbCol<<3)),this.macroblockIntra?1===e?(t.CopyValueToDestination(this.blockData[0]+128>>8,I,a,B),this.blockData[0]=0):(t.IDCT(this.blockData),t.CopyBlockToDestination(this.blockData,I,a,B),M(this.blockData,0)):1===e?(t.AddValueToDestination(this.blockData[0]+128>>8,I,a,B),this.blockData[0]=0):(t.IDCT(this.blockData),t.AddBlockToDestination(this.blockData,I,a,B),M(this.blockData,0)),e=0},t.CopyBlockToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]=A[s+0],t[i+1]=A[s+1],t[i+2]=A[s+2],t[i+3]=A[s+3],t[i+4]=A[s+4],t[i+5]=A[s+5],t[i+6]=A[s+6],t[i+7]=A[s+7]},t.AddBlockToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]+=A[s+0],t[i+1]+=A[s+1],t[i+2]+=A[s+2],t[i+3]+=A[s+3],t[i+4]+=A[s+4],t[i+5]+=A[s+5],t[i+6]+=A[s+6],t[i+7]+=A[s+7]},t.CopyValueToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]=A,t[i+1]=A,t[i+2]=A,t[i+3]=A,t[i+4]=A,t[i+5]=A,t[i+6]=A,t[i+7]=A},t.AddValueToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]+=A,t[i+1]+=A,t[i+2]+=A,t[i+3]+=A,t[i+4]+=A,t[i+5]+=A,t[i+6]+=A,t[i+7]+=A},t.IDCT=function(A){for(var t,i,e,s,o,g,I,a,B,r,C,n,E,Q,h,d,c,l,u=0;u<8;++u)t=A[32+u],i=A[16+u]+A[48+u],e=A[40+u]-A[24+u],g=A[8+u]+A[56+u],I=A[24+u]+A[40+u],B=(E=(473*(s=A[8+u]-A[56+u])-196*e+128>>8)-(o=g+I))-(362*(g-I)+128>>8),Q=(r=(a=A[0+u])-t)+(C=(362*(A[16+u]-A[48+u])+128>>8)-i),h=(n=a+t)+i,d=r-C,c=n-i,l=-B-(473*e+196*s+128>>8),A[0+u]=o+h,A[8+u]=E+Q,A[16+u]=d-B,A[24+u]=c-l,A[32+u]=c+l,A[40+u]=B+d,A[48+u]=Q-E,A[56+u]=h-o;for(var w=0;w<64;w+=8)t=A[4+w],i=A[2+w]+A[6+w],e=A[5+w]-A[3+w],g=A[1+w]+A[7+w],I=A[3+w]+A[5+w],B=(E=(473*(s=A[1+w]-A[7+w])-196*e+128>>8)-(o=g+I))-(362*(g-I)+128>>8),Q=(r=(a=A[0+w])-t)+(C=(362*(A[2+w]-A[6+w])+128>>8)-i),h=(n=a+t)+i,d=r-C,c=n-i,l=-B-(473*e+196*s+128>>8),A[0+w]=o+h+128>>8,A[1+w]=E+Q+128>>8,A[2+w]=d-B+128>>8,A[3+w]=c-l+128>>8,A[4+w]=c+l+128>>8,A[5+w]=B+d+128>>8,A[6+w]=Q-E+128>>8,A[7+w]=h-o+128>>8},t}(v);x.prototype.frameRate=30,x.prototype.currentY=null,x.prototype.currentCr=null,x.prototype.currentCb=null,x.prototype.pictureType=0,x.prototype.forwardY=null,x.prototype.forwardCr=null,x.prototype.forwardCb=null,x.prototype.fullPelForward=!1,x.prototype.forwardFCode=0,x.prototype.forwardRSize=0,x.prototype.forwardF=0,x.prototype.quantizerScale=0,x.prototype.sliceBegin=!1,x.prototype.macroblockAddress=0,x.prototype.mbRow=0,x.prototype.mbCol=0,x.prototype.macroblockType=0,x.prototype.macroblockIntra=!1,x.prototype.macroblockMotFw=!1,x.prototype.motionFwH=0,x.prototype.motionFwV=0,x.prototype.motionFwHPrev=0,x.prototype.motionFwVPrev=0,x.prototype.dcPredictorY=0,x.prototype.dcPredictorCr=0,x.prototype.dcPredictorCb=0,x.prototype.blockData=null,x.PICTURE_RATE=[0,23.976,24,25,29.97,30,50,59.94,60,0,0,0,0,0,0,0],x.ZIG_ZAG=new Uint8Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),x.DEFAULT_INTRA_QUANT_MATRIX=new Uint8Array([8,16,19,22,26,27,29,34,16,16,22,24,27,29,34,37,19,22,26,27,29,34,34,38,22,22,26,27,29,34,37,40,22,26,27,29,32,35,40,48,26,27,29,32,35,40,48,58,26,27,29,34,38,46,56,69,27,29,35,38,46,56,69,83]),x.DEFAULT_NON_INTRA_QUANT_MATRIX=new Uint8Array([16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16]),x.PREMULTIPLIER_MATRIX=new Uint8Array([32,44,42,38,32,25,17,9,44,62,58,52,44,35,24,12,42,58,55,49,42,33,23,12,38,52,49,44,38,30,20,10,32,44,42,38,32,25,17,9,25,35,33,30,25,20,14,7,17,24,23,20,17,14,9,5,9,12,12,10,9,7,5,2]),x.MACROBLOCK_ADDRESS_INCREMENT=new Int16Array([3,6,0,9,12,0,0,0,1,15,18,0,21,24,0,27,30,0,33,36,0,0,0,3,0,0,2,39,42,0,45,48,0,0,0,5,0,0,4,51,54,0,57,60,0,0,0,7,0,0,6,63,66,0,69,72,0,75,78,0,81,84,0,-1,87,0,-1,90,0,93,96,0,99,102,0,105,108,0,111,114,0,0,0,9,0,0,8,117,120,0,123,126,0,129,132,0,135,138,0,0,0,15,0,0,14,0,0,13,0,0,12,0,0,11,0,0,10,141,-1,0,-1,144,0,147,150,0,153,156,0,159,162,0,165,168,0,171,174,0,177,180,0,183,-1,0,-1,186,0,189,192,0,195,198,0,201,204,0,207,210,0,213,216,0,219,222,0,0,0,21,0,0,20,0,0,19,0,0,18,0,0,17,0,0,16,0,0,35,0,0,34,0,0,33,0,0,32,0,0,31,0,0,30,0,0,29,0,0,28,0,0,27,0,0,26,0,0,25,0,0,24,0,0,23,0,0,22]),x.MACROBLOCK_TYPE_INTRA=new Int8Array([3,6,0,-1,9,0,0,0,1,0,0,17]),x.MACROBLOCK_TYPE_PREDICTIVE=new Int8Array([3,6,0,9,12,0,0,0,10,15,18,0,0,0,2,21,24,0,0,0,8,27,30,0,33,36,0,-1,39,0,0,0,18,0,0,26,0,0,1,0,0,17]),x.MACROBLOCK_TYPE_B=new Int8Array([3,6,0,9,15,0,12,18,0,24,21,0,0,0,12,27,30,0,0,0,14,39,42,0,36,33,0,0,0,4,0,0,6,54,48,0,45,51,0,0,0,8,0,0,10,-1,57,0,0,0,1,60,63,0,0,0,30,0,0,17,0,0,22,0,0,26]),x.MACROBLOCK_TYPE=[null,x.MACROBLOCK_TYPE_INTRA,x.MACROBLOCK_TYPE_PREDICTIVE,x.MACROBLOCK_TYPE_B],x.CODE_BLOCK_PATTERN=new Int16Array([6,3,0,9,18,0,12,15,0,24,33,0,36,39,0,27,21,0,30,42,0,60,57,0,54,48,0,69,51,0,81,75,0,63,84,0,45,66,0,72,78,0,0,0,60,105,120,0,132,144,0,114,108,0,126,141,0,87,93,0,117,96,0,0,0,32,135,138,0,99,123,0,129,102,0,0,0,4,90,111,0,0,0,8,0,0,16,0,0,44,150,168,0,0,0,28,0,0,52,0,0,62,183,177,0,156,180,0,0,0,1,165,162,0,0,0,61,0,0,56,171,174,0,0,0,2,0,0,40,153,186,0,0,0,48,192,189,0,147,159,0,0,0,20,0,0,12,240,249,0,0,0,63,231,225,0,195,219,0,252,198,0,0,0,24,0,0,36,0,0,3,207,261,0,243,237,0,204,213,0,210,234,0,201,228,0,216,222,0,258,255,0,264,246,0,-1,282,0,285,291,0,0,0,33,0,0,9,318,330,0,306,348,0,0,0,5,0,0,10,279,267,0,0,0,6,0,0,18,0,0,17,0,0,34,339,357,0,309,312,0,270,276,0,327,321,0,351,354,0,303,297,0,294,288,0,300,273,0,342,345,0,315,324,0,336,333,0,363,375,0,0,0,41,0,0,14,0,0,21,372,366,0,360,369,0,0,0,11,0,0,19,0,0,7,0,0,35,0,0,13,0,0,50,0,0,49,0,0,58,0,0,37,0,0,25,0,0,45,0,0,57,0,0,26,0,0,29,0,0,38,0,0,53,0,0,23,0,0,43,0,0,46,0,0,42,0,0,22,0,0,54,0,0,51,0,0,15,0,0,30,0,0,39,0,0,47,0,0,55,0,0,27,0,0,59,0,0,31]),x.MOTION=new Int16Array([3,6,0,12,9,0,0,0,0,18,15,0,24,21,0,0,0,-1,0,0,1,27,30,0,36,33,0,0,0,2,0,0,-2,42,45,0,48,39,0,60,54,0,0,0,3,0,0,-3,51,57,0,-1,69,0,81,75,0,78,63,0,72,66,0,96,84,0,87,93,0,-1,99,0,108,105,0,0,0,-4,90,102,0,0,0,4,0,0,-7,0,0,5,111,123,0,0,0,-5,0,0,7,114,120,0,126,117,0,0,0,-6,0,0,6,153,162,0,150,147,0,135,138,0,156,141,0,129,159,0,132,144,0,0,0,10,0,0,9,0,0,8,0,0,-8,171,198,0,0,0,-9,180,192,0,168,183,0,165,186,0,174,189,0,0,0,-10,177,195,0,0,0,12,0,0,16,0,0,13,0,0,14,0,0,11,0,0,15,0,0,-16,0,0,-12,0,0,-14,0,0,-15,0,0,-11,0,0,-13]),x.DCT_DC_SIZE_LUMINANCE=new Int8Array([6,3,0,18,15,0,9,12,0,0,0,1,0,0,2,27,24,0,21,30,0,0,0,0,36,33,0,0,0,4,0,0,3,39,42,0,0,0,5,0,0,6,48,45,0,51,-1,0,0,0,7,0,0,8]),x.DCT_DC_SIZE_CHROMINANCE=new Int8Array([6,3,0,12,9,0,18,15,0,24,21,0,0,0,2,0,0,1,0,0,0,30,27,0,0,0,3,36,33,0,0,0,4,42,39,0,0,0,5,48,45,0,0,0,6,51,-1,0,0,0,7,0,0,8]),x.DCT_COEFF=new Int32Array([3,6,0,12,9,0,0,0,1,21,24,0,18,15,0,39,27,0,33,30,0,42,36,0,0,0,257,60,66,0,54,63,0,48,57,0,0,0,513,51,45,0,0,0,2,0,0,3,81,75,0,87,93,0,72,78,0,96,90,0,0,0,1025,69,84,0,0,0,769,0,0,258,0,0,1793,0,0,65535,0,0,1537,111,108,0,0,0,1281,105,102,0,117,114,0,99,126,0,120,123,0,156,150,0,162,159,0,144,147,0,129,135,0,138,132,0,0,0,2049,0,0,4,0,0,514,0,0,2305,153,141,0,165,171,0,180,168,0,177,174,0,183,186,0,0,0,2561,0,0,3329,0,0,6,0,0,259,0,0,5,0,0,770,0,0,2817,0,0,3073,228,225,0,201,210,0,219,213,0,234,222,0,216,231,0,207,192,0,204,189,0,198,195,0,243,261,0,273,240,0,246,237,0,249,258,0,279,276,0,252,255,0,270,282,0,264,267,0,0,0,515,0,0,260,0,0,7,0,0,1026,0,0,1282,0,0,4097,0,0,3841,0,0,3585,315,321,0,333,342,0,312,291,0,375,357,0,288,294,0,-1,369,0,285,303,0,318,363,0,297,306,0,339,309,0,336,348,0,330,300,0,372,345,0,351,366,0,327,354,0,360,324,0,381,408,0,417,420,0,390,378,0,435,438,0,384,387,0,0,0,2050,396,402,0,465,462,0,0,0,8,411,399,0,429,432,0,453,414,0,426,423,0,0,0,10,0,0,9,0,0,11,0,0,5377,0,0,1538,0,0,771,0,0,5121,0,0,1794,0,0,4353,0,0,4609,0,0,4865,444,456,0,0,0,1027,459,450,0,0,0,261,393,405,0,0,0,516,447,441,0,516,519,0,486,474,0,510,483,0,504,498,0,471,537,0,507,501,0,522,513,0,534,531,0,468,477,0,492,495,0,549,546,0,525,528,0,0,0,263,0,0,2562,0,0,2306,0,0,5633,0,0,5889,0,0,6401,0,0,6145,0,0,1283,0,0,772,0,0,13,0,0,12,0,0,14,0,0,15,0,0,517,0,0,6657,0,0,262,540,543,0,480,489,0,588,597,0,0,0,27,609,555,0,606,603,0,0,0,19,0,0,22,591,621,0,0,0,18,573,576,0,564,570,0,0,0,20,552,582,0,0,0,21,558,579,0,0,0,23,612,594,0,0,0,25,0,0,24,600,615,0,0,0,31,0,0,30,0,0,28,0,0,29,0,0,26,0,0,17,0,0,16,567,618,0,561,585,0,654,633,0,0,0,37,645,648,0,0,0,36,630,636,0,0,0,34,639,627,0,663,666,0,657,624,0,651,642,0,669,660,0,0,0,35,0,0,267,0,0,40,0,0,268,0,0,266,0,0,32,0,0,264,0,0,265,0,0,38,0,0,269,0,0,270,0,0,33,0,0,39,0,0,7937,0,0,6913,0,0,7681,0,0,4098,0,0,7425,0,0,7169,0,0,271,0,0,274,0,0,273,0,0,272,0,0,1539,0,0,2818,0,0,3586,0,0,3330,0,0,3074,0,0,3842]),x.PICTURE_TYPE={INTRA:1,PREDICTIVE:2,B:3},x.START={SEQUENCE:179,SLICE_FIRST:1,SLICE_LAST:175,PICTURE:0,EXTENSION:181,USER_DATA:178};var Y=function(A){function t(t){var i;return(i=A.call(this,t)||this).onDecodeCallback=t.onVideoDecode,i.module=t.wasmModule,i.bufferSize=t.videoBufferSize||524288,i.bufferMode=t.streaming?J.MODE.EVICT:J.MODE.EXPAND,i.decodeFirstFrame=!1!==t.decodeFirstFrame,i.hasSequenceHeader=!1,i}p(t,A);var i=t.prototype;return i.initializeWasmDecoder=function(){this.module.instance?(this.instance=this.module.instance,this.functions=this.module.instance.exports,this.decoder=this.functions._mpeg1_decoder_create(this.bufferSize,this.bufferMode)):console.warn("JSMpeg: WASM module not compiled yet")},i.destroy=function(){this.decoder&&this.functions._mpeg1_decoder_destroy(this.decoder)},i.bufferGetIndex=function(){if(this.decoder)return this.functions._mpeg1_decoder_get_index(this.decoder)},i.bufferSetIndex=function(A){this.decoder&&this.functions._mpeg1_decoder_set_index(this.decoder,A)},i.bufferWrite=function(A){this.decoder||this.initializeWasmDecoder();for(var t=0,i=0;i>2)),g=this.instance.heapU8.subarray(e,e+(this.codedSize>>2));this.destination.render(s,o,g,!1)}this.advanceDecodedTime(1/this.frameRate);var I=F()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,I),!0},t}(v),H=function(A){function t(i){var e;(e=A.call(this,i)||this).onDecodeCallback=i.onAudioDecode;var s=i.audioBufferSize||131072,o=i.streaming?J.MODE.EVICT:J.MODE.EXPAND;e.bits=new J(s,o),e.left=new Float32Array(1152),e.right=new Float32Array(1152),e.sampleRate=44100,e.D=new Float32Array(1024),e.D.set(t.SYNTHESIS_WINDOW,0),e.D.set(t.SYNTHESIS_WINDOW,512),e.V=[new Float32Array(1024),new Float32Array(1024)],e.U=new Int32Array(32),e.VPos=0,e.allocation=[new Array(32),new Array(32)],e.scaleFactorInfo=[new Uint8Array(32),new Uint8Array(32)],e.scaleFactor=[new Array(32),new Array(32)],e.sample=[new Array(32),new Array(32)];for(var g=0;g<2;g++)for(var I=0;I<32;I++)e.scaleFactor[g][I]=[0,0,0],e.sample[g][I]=[0,0,0];return e}p(t,A);var i=t.prototype;return i.decode=function(){var A=F(),t=this.bits.index>>3;if(t>=this.bits.byteLength)return!1;var i=this.decodeFrame(this.left,this.right);if(this.bits.index=t+i<<3,!i)return!1;this.destination&&this.destination.play(this.sampleRate,this.left,this.right),this.advanceDecodedTime(this.left.length/this.sampleRate);var e=F()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,e),!0},i.getCurrentTime=function(){var A=this.destination?this.destination.enqueuedTime:0;return this.decodedTime-A},i.decodeFrame=function(A,i){var e=this.bits.read(11),s=this.bits.read(2),o=this.bits.read(2),g=!this.bits.read(1);if(e!==t.FRAME_SYNC||s!==t.VERSION.MPEG_1||o!==t.LAYER.II)return 0;var I=this.bits.read(4)-1;if(I>13)return 0;var a=this.bits.read(2),B=t.SAMPLE_RATE[a];if(3===a)return 0;s===t.VERSION.MPEG_2&&(a+=4,I+=14);var r=this.bits.read(1);this.bits.read(1);var C=this.bits.read(2),n=0;C===t.MODE.JOINT_STEREO?n=this.bits.read(2)+1<<2:(this.bits.skip(2),n=C===t.MODE.MONO?0:32),this.bits.skip(4),g&&this.bits.skip(16);var E=144e3*t.BIT_RATE[I]/(B=t.SAMPLE_RATE[a])+r|0,Q=0,h=0;if(s===t.VERSION.MPEG_2)Q=2,h=30;else{var d=C===t.MODE.MONO?0:1,c=t.QUANT_LUT_STEP_1[d][I];h=63&(Q=t.QUANT_LUT_STEP_2[c][a]),Q>>=6}n>h&&(n=h);for(var l=0;l>1),U=this.VPos%128>>1;U<1024;){for(var J=0;J<32;++J)this.U[J]+=this.D[L++]*this.V[N][U++];U+=96,L+=32}for(U=1120-U,L-=480;U<1024;){for(var T=0;T<32;++T)this.U[T]+=this.D[L++]*this.V[N][U++];U+=96,L+=32}for(var v=0===N?A:i,x=0;x<32;x++)v[R+x]=this.U[x]/2147418112}R+=32}}return this.sampleRate=B,E},i.readAllocation=function(A,i){var e=t.QUANT_LUT_STEP_3[i][A],s=t.QUANT_LUT_STEP4[15&e][this.bits.read(e>>4)];return s?t.QUANT_TAB[s-1]:0},i.readSamples=function(A,i,e){var s=this.allocation[A][i],o=this.scaleFactor[A][i][e],g=this.sample[A][i],I=0;if(s){if(63===o)o=0;else{var a=o/3|0;o=t.SCALEFACTOR_BASE[o%3]+(1<>1)>>a}var B=s.levels;s.group?(I=this.bits.read(s.bits),g[0]=I%B,I=I/B|0,g[1]=I%B,g[2]=I/B|0):(g[0]=this.bits.read(s.bits),g[1]=this.bits.read(s.bits),g[2]=this.bits.read(s.bits));var r=65536/(B+1)|0;I=((B=(B+1>>1)-1)-g[0])*r,g[0]=I*(o>>12)+(I*(4095&o)+2048>>12)>>12,I=(B-g[1])*r,g[1]=I*(o>>12)+(I*(4095&o)+2048>>12)>>12,I=(B-g[2])*r,g[2]=I*(o>>12)+(I*(4095&o)+2048>>12)>>12}else g[0]=g[1]=g[2]=0},t.MatrixTransform=function(A,t,i,e){var s,o,g,I,a,B,r,C,n,E,Q,h,d,c,l,u,w,p,m,D,f,y,R,k,b,S,G,F,M,q,N,L,U;s=A[0][t]+A[31][t],o=.500602998235*(A[0][t]-A[31][t]),g=A[1][t]+A[30][t],I=.505470959898*(A[1][t]-A[30][t]),a=A[2][t]+A[29][t],B=.515447309923*(A[2][t]-A[29][t]),r=A[3][t]+A[28][t],C=.53104259109*(A[3][t]-A[28][t]),n=A[4][t]+A[27][t],E=.553103896034*(A[4][t]-A[27][t]),Q=A[5][t]+A[26][t],h=.582934968206*(A[5][t]-A[26][t]),d=A[6][t]+A[25][t],c=.622504123036*(A[6][t]-A[25][t]),l=A[7][t]+A[24][t],u=.674808341455*(A[7][t]-A[24][t]),w=A[8][t]+A[23][t],p=.744536271002*(A[8][t]-A[23][t]),m=A[9][t]+A[22][t],D=.839349645416*(A[9][t]-A[22][t]),f=A[10][t]+A[21][t],y=.972568237862*(A[10][t]-A[21][t]),R=A[11][t]+A[20][t],k=1.16943993343*(A[11][t]-A[20][t]),b=A[12][t]+A[19][t],S=1.48416461631*(A[12][t]-A[19][t]),G=A[13][t]+A[18][t],F=2.05778100995*(A[13][t]-A[18][t]),M=A[14][t]+A[17][t],q=3.40760841847*(A[14][t]-A[17][t]),U=s+(N=A[15][t]+A[16][t]),N=.502419286188*(s-N),s=g+M,M=.52249861494*(g-M),g=a+G,G=.566944034816*(a-G),a=r+b,b=.64682178336*(r-b),r=n+R,R=.788154623451*(n-R),n=Q+f,f=1.06067768599*(Q-f),Q=d+m,m=1.72244709824*(d-m),d=l+w,w=5.10114861869*(l-w),l=U+d,d=.509795579104*(U-d),U=s+Q,s=.601344886935*(s-Q),Q=g+n,n=.899976223136*(g-n),g=a+r,r=2.56291544774*(a-r),a=l+g,l=.541196100146*(l-g),g=U+Q,Q=1.30656296488*(U-Q),U=a+g,a=.707106781187*(a-g),g=l+Q,g+=l=.707106781187*(l-Q),Q=d+r,d=.541196100146*(d-r),r=s+n,n=1.30656296488*(s-n),s=Q+r,r=.707106781187*(Q-r),Q=d+n,s+=Q+=d=.707106781187*(d-n),Q+=r,r+=d,n=N+w,N=.509795579104*(N-w),w=M+m,M=.601344886935*(M-m),m=G+f,f=.899976223136*(G-f),G=b+R,R=2.56291544774*(b-R),b=n+G,n=.541196100146*(n-G),G=w+m,m=1.30656296488*(w-m),w=b+G,G=.707106781187*(b-G),b=n+m,m=.707106781187*(n-m),n=N+R,N=.541196100146*(N-R),R=M+f,f=1.30656296488*(M-f),M=n+R,R=.707106781187*(n-R),n=N+f,w+=M+=n+=N=.707106781187*(N-f),M+=b+=m,b+=n+=R,n+=G,G+=R+=N,R+=m,m+=N,f=o+(L=10.1900081235*(A[15][t]-A[16][t])),o=.502419286188*(o-L),L=I+q,I=.52249861494*(I-q),q=B+F,F=.566944034816*(B-F),B=C+S,C=.64682178336*(C-S),S=E+k,E=.788154623451*(E-k),k=h+y,y=1.06067768599*(h-y),h=c+D,D=1.72244709824*(c-D),c=u+p,u=5.10114861869*(u-p),p=f+c,c=.509795579104*(f-c),f=L+h,L=.601344886935*(L-h),h=q+k,k=.899976223136*(q-k),q=B+S,S=2.56291544774*(B-S),B=p+q,p=.541196100146*(p-q),q=f+h,h=1.30656296488*(f-h),f=B+q,q=.707106781187*(B-q),B=p+h,h=.707106781187*(p-h),p=c+S,S=.541196100146*(c-S),c=L+k,k=1.30656296488*(L-k),L=p+c,c=.707106781187*(p-c),p=S+k,L+=p+=k=.707106781187*(S-k),p+=c,S=c+k,c=o+u,o=.509795579104*(o-u),u=I+D,I=.601344886935*(I-D),D=F+y,y=.899976223136*(F-y),F=C+E,E=2.56291544774*(C-E),C=c+F,c=.541196100146*(c-F),F=u+D,D=1.30656296488*(u-D),u=C+F,F=.707106781187*(C-F),C=c+D,D=.707106781187*(c-D),c=o+E,o=.541196100146*(o-E),E=I+y,y=1.30656296488*(I-y),I=c+E,E=.707106781187*(c-E),c=o+y,f+=u+=I+=c+=o=.707106781187*(o-y),u+=L,L+=I+=C+=D,I+=B+=h,B+=C+=c+=E,C+=p,p+=c+=F,c+=q,q+=F+=E+=o,F+=S,S+=E+=D,E+=h,h+=D+=o,D+=k,k+=o,i[e+48]=-U,i[e+49]=i[e+47]=-f,i[e+50]=i[e+46]=-w,i[e+51]=i[e+45]=-u,i[e+52]=i[e+44]=-s,i[e+53]=i[e+43]=-L,i[e+54]=i[e+42]=-M,i[e+55]=i[e+41]=-I,i[e+56]=i[e+40]=-g,i[e+57]=i[e+39]=-B,i[e+58]=i[e+38]=-b,i[e+59]=i[e+37]=-C,i[e+60]=i[e+36]=-Q,i[e+61]=i[e+35]=-p,i[e+62]=i[e+34]=-n,i[e+63]=i[e+33]=-c,i[e+32]=-a,i[e+0]=a,i[e+31]=-q,i[e+1]=q,i[e+30]=-G,i[e+2]=G,i[e+29]=-F,i[e+3]=F,i[e+28]=-r,i[e+4]=r,i[e+27]=-S,i[e+5]=S,i[e+26]=-R,i[e+6]=R,i[e+25]=-E,i[e+7]=E,i[e+24]=-l,i[e+8]=l,i[e+23]=-h,i[e+9]=h,i[e+22]=-m,i[e+10]=m,i[e+21]=-D,i[e+11]=D,i[e+20]=-d,i[e+12]=d,i[e+19]=-k,i[e+13]=k,i[e+18]=-N,i[e+14]=N,i[e+17]=-o,i[e+15]=o,i[e+16]=0},t}(v);H.FRAME_SYNC=2047,H.VERSION={MPEG_2_5:0,MPEG_2:2,MPEG_1:3},H.LAYER={III:1,II:2,I:3},H.MODE={STEREO:0,JOINT_STEREO:1,DUAL_CHANNEL:2,MONO:3},H.SAMPLE_RATE=new Uint16Array([44100,48e3,32e3,0,22050,24e3,16e3,0]),H.BIT_RATE=new Uint16Array([32,48,56,64,80,96,112,128,160,192,224,256,320,384,8,16,24,32,40,48,56,64,80,96,112,128,144,160]),H.SCALEFACTOR_BASE=new Uint32Array([33554432,26632170,21137968]),H.SYNTHESIS_WINDOW=new Float32Array([0,-.5,-.5,-.5,-.5,-.5,-.5,-1,-1,-1,-1,-1.5,-1.5,-2,-2,-2.5,-2.5,-3,-3.5,-3.5,-4,-4.5,-5,-5.5,-6.5,-7,-8,-8.5,-9.5,-10.5,-12,-13,-14.5,-15.5,-17.5,-19,-20.5,-22.5,-24.5,-26.5,-29,-31.5,-34,-36.5,-39.5,-42.5,-45.5,-48.5,-52,-55.5,-58.5,-62.5,-66,-69.5,-73.5,-77,-80.5,-84.5,-88,-91.5,-95,-98,-101,-104,106.5,109,111,112.5,113.5,114,114,113.5,112,110.5,107.5,104,100,94.5,88.5,81.5,73,63.5,53,41.5,28.5,14.5,-1,-18,-36,-55.5,-76.5,-98.5,-122,-147,-173.5,-200.5,-229.5,-259.5,-290.5,-322.5,-355.5,-389.5,-424,-459.5,-495.5,-532,-568.5,-605,-641.5,-678,-714,-749,-783.5,-817,-849,-879.5,-908.5,-935,-959.5,-981,-1000.5,-1016,-1028.5,-1037.5,-1042.5,-1043.5,-1040,-1031.5,1018.5,1e3,976,946.5,911,869.5,822,767.5,707,640,565.5,485,397,302.5,201,92.5,-22.5,-144,-272.5,-407,-547.5,-694,-846,-1003,-1165,-1331.5,-1502,-1675.5,-1852.5,-2031.5,-2212.5,-2394,-2576.5,-2758.5,-2939.5,-3118.5,-3294.5,-3467.5,-3635.5,-3798.5,-3955,-4104.5,-4245.5,-4377.5,-4499,-4609.5,-4708,-4792.5,-4863.5,-4919,-4958,-4979.5,-4983,-4967.5,-4931.5,-4875,-4796,-4694.5,-4569.5,-4420,-4246,-4046,-3820,-3567,3287,2979.5,2644,2280.5,1888,1467.5,1018.5,541,35,-499,-1061,-1650,-2266.5,-2909,-3577,-4270,-4987.5,-5727.5,-6490,-7274,-8077.5,-8899.5,-9739,-10594.5,-11464.5,-12347,-13241,-14144.5,-15056,-15973.5,-16895.5,-17820,-18744.5,-19668,-20588,-21503,-22410.5,-23308.5,-24195,-25068.5,-25926.5,-26767,-27589,-28389,-29166.5,-29919,-30644.5,-31342,-32009.5,-32645,-33247,-33814.5,-34346,-34839.5,-35295,-35710,-36084.5,-36417.5,-36707.5,-36954,-37156.5,-37315,-37428,-37496,37519,37496,37428,37315,37156.5,36954,36707.5,36417.5,36084.5,35710,35295,34839.5,34346,33814.5,33247,32645,32009.5,31342,30644.5,29919,29166.5,28389,27589,26767,25926.5,25068.5,24195,23308.5,22410.5,21503,20588,19668,18744.5,17820,16895.5,15973.5,15056,14144.5,13241,12347,11464.5,10594.5,9739,8899.5,8077.5,7274,6490,5727.5,4987.5,4270,3577,2909,2266.5,1650,1061,499,-35,-541,-1018.5,-1467.5,-1888,-2280.5,-2644,-2979.5,3287,3567,3820,4046,4246,4420,4569.5,4694.5,4796,4875,4931.5,4967.5,4983,4979.5,4958,4919,4863.5,4792.5,4708,4609.5,4499,4377.5,4245.5,4104.5,3955,3798.5,3635.5,3467.5,3294.5,3118.5,2939.5,2758.5,2576.5,2394,2212.5,2031.5,1852.5,1675.5,1502,1331.5,1165,1003,846,694,547.5,407,272.5,144,22.5,-92.5,-201,-302.5,-397,-485,-565.5,-640,-707,-767.5,-822,-869.5,-911,-946.5,-976,-1e3,1018.5,1031.5,1040,1043.5,1042.5,1037.5,1028.5,1016,1000.5,981,959.5,935,908.5,879.5,849,817,783.5,749,714,678,641.5,605,568.5,532,495.5,459.5,424,389.5,355.5,322.5,290.5,259.5,229.5,200.5,173.5,147,122,98.5,76.5,55.5,36,18,1,-14.5,-28.5,-41.5,-53,-63.5,-73,-81.5,-88.5,-94.5,-100,-104,-107.5,-110.5,-112,-113.5,-114,-114,-113.5,-112.5,-111,-109,106.5,104,101,98,95,91.5,88,84.5,80.5,77,73.5,69.5,66,62.5,58.5,55.5,52,48.5,45.5,42.5,39.5,36.5,34,31.5,29,26.5,24.5,22.5,20.5,19,17.5,15.5,14.5,13,12,10.5,9.5,8.5,8,7,6.5,5.5,5,4.5,4,3.5,3.5,3,2.5,2.5,2,2,1.5,1.5,1,1,1,1,.5,.5,.5,.5,.5,.5]),H.QUANT_LUT_STEP_1=[[0,0,1,1,1,2,2,2,2,2,2,2,2,2],[0,0,0,0,0,0,1,1,1,2,2,2,2,2]],H.QUANT_TAB={A:91,B:94,C:8,D:12},H.QUANT_LUT_STEP_2=[[H.QUANT_TAB.C,H.QUANT_TAB.C,H.QUANT_TAB.D],[H.QUANT_TAB.A,H.QUANT_TAB.A,H.QUANT_TAB.A],[H.QUANT_TAB.B,H.QUANT_TAB.A,H.QUANT_TAB.B]],H.QUANT_LUT_STEP_3=[[68,68,52,52,52,52,52,52,52,52,52,52],[67,67,67,66,66,66,66,66,66,66,66,49,49,49,49,49,49,49,49,49,49,49,49,32,32,32,32,32,32,32],[69,69,69,69,52,52,52,52,52,52,52,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36]],H.QUANT_LUT_STEP4=[[0,1,2,17],[0,1,2,3,4,5,6,17],[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17],[0,1,3,5,6,7,8,9,10,11,12,13,14,15,16,17],[0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,17],[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]],H.QUANT_TAB=[{levels:3,group:1,bits:5},{levels:5,group:1,bits:7},{levels:7,group:0,bits:3},{levels:9,group:1,bits:10},{levels:15,group:0,bits:4},{levels:31,group:0,bits:5},{levels:63,group:0,bits:6},{levels:127,group:0,bits:7},{levels:255,group:0,bits:8},{levels:511,group:0,bits:9},{levels:1023,group:0,bits:10},{levels:2047,group:0,bits:11},{levels:4095,group:0,bits:12},{levels:8191,group:0,bits:13},{levels:16383,group:0,bits:14},{levels:32767,group:0,bits:15},{levels:65535,group:0,bits:16}];var P=function(A){function t(t){var i;return(i=A.call(this,t)||this).onDecodeCallback=t.onAudioDecode,i.module=t.wasmModule,i.bufferSize=t.audioBufferSize||131072,i.bufferMode=t.streaming?J.MODE.EVICT:J.MODE.EXPAND,i.sampleRate=0,i}p(t,A);var i=t.prototype;return i.initializeWasmDecoder=function(){this.module.instance?(this.instance=this.module.instance,this.functions=this.module.instance.exports,this.decoder=this.functions._mp2_decoder_create(this.bufferSize,this.bufferMode)):console.warn("JSMpeg: WASM module not compiled yet")},i.destroy=function(){this.decoder&&this.functions._mp2_decoder_destroy(this.decoder)},i.bufferGetIndex=function(){if(this.decoder)return this.functions._mp2_decoder_get_index(this.decoder)},i.bufferSetIndex=function(A){this.decoder&&this.functions._mp2_decoder_set_index(this.decoder,A)},i.bufferWrite=function(A){this.decoder||this.initializeWasmDecoder();for(var t=0,i=0;i>4<<4;this.gl.viewport(0,0,i,this.height)},t.createTexture=function(A,t){var i=this.gl,e=i.createTexture();return i.bindTexture(i.TEXTURE_2D,e),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.uniform1i(i.getUniformLocation(this.program,t),A),e},t.createProgram=function(A,t){var i=this.gl,e=i.createProgram();return i.attachShader(e,this.compileShader(i.VERTEX_SHADER,A)),i.attachShader(e,this.compileShader(i.FRAGMENT_SHADER,t)),i.linkProgram(e),i.useProgram(e),e},t.compileShader=function(A,t){var i=this.gl,e=i.createShader(A);if(i.shaderSource(e,t),i.compileShader(e),!i.getShaderParameter(e,i.COMPILE_STATUS))throw new Error(i.getShaderInfoLog(e));return e},t.allowsClampedTextureData=function(){var A=this.gl,t=A.createTexture();return A.bindTexture(A.TEXTURE_2D,t),A.texImage2D(A.TEXTURE_2D,0,A.LUMINANCE,1,1,0,A.LUMINANCE,A.UNSIGNED_BYTE,new Uint8ClampedArray([0])),0===A.getError()},t.renderProgress=function(A){var t=this.gl;t.useProgram(this.loadingProgram);var i=t.getUniformLocation(this.loadingProgram,"progress");t.uniform1f(i,A),t.drawArrays(t.TRIANGLE_STRIP,0,4)},t.render=function(A,t,i,e){if(this.enabled){var s=this.gl,o=this.width+15>>4<<4,g=this.height,I=o>>1,a=g>>1;e&&this.shouldCreateUnclampedViews&&(A=new Uint8Array(A.buffer),t=new Uint8Array(t.buffer),i=new Uint8Array(i.buffer)),s.useProgram(this.program),this.updateTexture(s.TEXTURE0,this.textureY,o,g,A),this.updateTexture(s.TEXTURE1,this.textureCb,I,a,t),this.updateTexture(s.TEXTURE2,this.textureCr,I,a,i),s.drawArrays(s.TRIANGLE_STRIP,0,4)}},t.updateTexture=function(A,t,i,e,s){var o=this.gl;o.activeTexture(A),o.bindTexture(o.TEXTURE_2D,t),this.hasTextureData[A]?o.texSubImage2D(o.TEXTURE_2D,0,0,0,i,e,o.LUMINANCE,o.UNSIGNED_BYTE,s):(this.hasTextureData[A]=!0,o.texImage2D(o.TEXTURE_2D,0,o.LUMINANCE,i,e,0,o.LUMINANCE,o.UNSIGNED_BYTE,s))},t.deleteTexture=function(A,t){var i=this.gl;i.activeTexture(A),i.bindTexture(i.TEXTURE_2D,null),i.deleteTexture(t)},A.IsSupported=function(){try{if(!window.WebGLRenderingContext)return!1;var A=document.createElement("canvas");return!(!A.getContext("webgl")&&!A.getContext("experimental-webgl"))}catch(A){return!1}},A}();_.SHADER={FRAGMENT_YCRCB_TO_RGBA:["precision mediump float;","uniform sampler2D textureY;","uniform sampler2D textureCb;","uniform sampler2D textureCr;","varying vec2 texCoord;","mat4 rec601 = mat4(","1.16438, 0.00000, 1.59603, -0.87079,","1.16438, -0.39176, -0.81297, 0.52959,","1.16438, 2.01723, 0.00000, -1.08139,","0, 0, 0, 1",");","void main() {","float y = texture2D(textureY, texCoord).r;","float cb = texture2D(textureCb, texCoord).r;","float cr = texture2D(textureCr, texCoord).r;","gl_FragColor = vec4(y, cr, cb, 1.0) * rec601;","}"].join("\n"),FRAGMENT_LOADING:["precision mediump float;","uniform float progress;","varying vec2 texCoord;","void main() {","float c = ceil(progress-(1.0-texCoord.y));","gl_FragColor = vec4(c,c,c,1);","}"].join("\n"),VERTEX_IDENTITY:["attribute vec2 vertex;","varying vec2 texCoord;","void main() {","texCoord = vertex;","gl_Position = vec4((vertex * 2.0 - 1.0) * vec2(1, -1), 0.0, 1.0);","}"].join("\n")};var O=function(){function A(A){A.canvas?(this.canvas=A.canvas,this.ownsCanvasElement=!1):(this.canvas=document.createElement("canvas"),this.ownsCanvasElement=!0),this.width=this.canvas.width,this.height=this.canvas.height,this.enabled=!0,this.context=this.canvas.getContext("2d")}var t=A.prototype;return t.destroy=function(){this.ownsCanvasElement&&this.canvas.remove()},t.resize=function(A,t){this.width=0|A,this.height=0|t,this.canvas.width=this.width,this.canvas.height=this.height,this.imageData=this.context.getImageData(0,0,this.width,this.height),M(this.imageData.data,255)},t.renderProgress=function(A){var t=this.canvas.width,i=this.canvas.height,e=this.context;e.fillStyle="#222",e.fillRect(0,0,t,i),e.fillStyle="#fff",e.fillRect(0,i-i*A,t,i*A)},t.render=function(A,t,i){this.YCbCrToRGBA(A,t,i,this.imageData.data),this.context.putImageData(this.imageData,0,0)},t.YCbCrToRGBA=function(A,t,i,e){if(this.enabled)for(var s,o,g,I,a,B=this.width+15>>4<<4,r=B>>1,C=0,n=B,E=B+(B-this.width),Q=0,h=r-(this.width>>1),d=0,c=4*this.width,l=4*this.width,u=this.width>>1,w=this.height>>1,p=0;p>8)-179,I=(88*o>>8)-44+(183*s>>8)-91,a=o+(198*o>>8)-227;var D=A[C++],f=A[C++];e[d]=D+g,e[d+1]=D-I,e[d+2]=D+a,e[d+4]=f+g,e[d+5]=f-I,e[d+6]=f+a,d+=8;var y=A[n++],R=A[n++];e[c]=y+g,e[c+1]=y-I,e[c+2]=y+a,e[c+4]=R+g,e[c+5]=R-I,e[c+6]=R+a,c+=8}C+=E,n+=E,d+=l,c+=l,Q+=h}},A}(),K=function(){function A(){this.context=A.CachedContext=A.CachedContext||new(window.AudioContext||window.webkitAudioContext),this.gain=this.context.createGain(),this.destination=this.gain,this.gain.connect(this.context.destination),this.context._connections=(this.context._connections||0)+1,this.startTime=0,this.buffer=null,this.wallclockStartTime=0,this.volume=1,this.enabled=!0,this.unlocked=!A.NeedsUnlocking(),Object.defineProperty(this,"enqueuedTime",{get:this.getEnqueuedTime})}var t=A.prototype;return t.destroy=function(){this.gain.disconnect(),this.context._connections--,0===this.context._connections&&(this.context.close(),A.CachedContext=null)},t.play=function(A,t,i){if(this.enabled){if(!this.unlocked){var e=F();return this.wallclockStartTimethis.memory.buffer.byteLength){var i=this.brk-this.memory.buffer.byteLength,e=Math.ceil(i/this.pageSize);this.memory.grow(e),this.createHeapViews()}return t},t.c_abort=function(A){console.warn("JSMPeg: WASM abort",arguments)},t.c_assertFail=function(A){console.warn("JSMPeg: WASM ___assert_fail",arguments)},t.readDylinkSection=function(A){var t=new Uint8Array(A),i=0,e=function(){for(var A=0,e=1;;){var s=t[i++];if(A+=(127&s)*e,e*=128,!(128&s))return A}},s=function(A){for(var e=0;ethis.maxAudioLag&&(this.audioOut.resetEnqueuedTime(),this.audioOut.enabled=!1),A=this.audio.decode()}while(A);this.audioOut.enabled=!0}},t.updateForStaticFile=function(){var A=!1,t=0;if(this.audio&&this.audio.canPlay){for(;!A&&this.audio.decodedTime-this.audio.currentTime<.25;)A=!this.audio.decode();this.video&&this.video.currentTime0&&(e>2*s&&(this.startTime+=e),A=!this.video.decode()),t=this.demuxer.currentTime-i}this.source.resume(t),A&&this.source.completed?this.loop?this.seek(0):(this.stop(),this.options.onEnded&&this.options.onEnded(this)):A&&this.options.onStalled&&this.options.onStalled(this)},A}(),j={Player:Z,VideoElement:G,BitBuffer:J,Source:{Ajax:N,AjaxProgressive:L,WebSocket:U,Fetch:function(){function A(A,t){this.url=A,this.destination=null,this.request=null,this.streaming=!0,this.completed=!1,this.established=!1,this.progress=0,this.aborted=!1,this.onEstablishedCallback=t.onSourceEstablished,this.onCompletedCallback=t.onSourceCompleted,t.hookOnEstablished&&(this.hookOnEstablished=t.hookOnEstablished)}var t=A.prototype;return t.connect=function(A){this.destination=A},t.start=function(){var A=this,t={method:"GET",headers:new Headers,cache:"default"};self.fetch(this.url,t).then((function(t){if(t.ok&&t.status>=200&&t.status<=299)return A.progress=1,A.established=!0,A.pump(t.body.getReader())})).catch((function(A){throw A}))},t.pump=function(A){var t=this;return A.read().then((function(i){if(!i.done)return t.aborted?A.cancel():(t.destination&&t.destination.write(i.value.buffer),t.pump(A));t.completed=!0})).catch((function(A){throw A}))},t.resume=function(){},t.abort=function(){this.aborted=!0},A}()},Demuxer:{TS:T},Decoder:{Base:v,MPEG1Video:x,MPEG1VideoWASM:Y,MP2Audio:H,MP2AudioWASM:P},Renderer:{WebGL:_,Canvas2D:O},AudioOutput:{WebAudio:K},WASMModule:X,Now:F,CreateVideoElements:function(){for(var A=document.querySelectorAll(".jsmpeg"),t=0;tthis.q=A))}resume(){this.q?.(),this.Z=this.q=void 0}} +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const $=A=>!e(A)&&"function"==typeof A.then,AA=1073741823;const tA=A(class extends t{constructor(){super(...arguments),this._$Cwt=AA,this._$Cbt=[],this._$CK=new V(this),this._$CX=new z}render(...A){return A.find((A=>!$(A)))??i}update(A,t){const e=this._$Cbt;let s=e.length;this._$Cbt=t;const o=this._$CK,g=this._$CX;this.isConnected||this.disconnected();for(let A=0;Athis._$Cwt);A++){const i=t[A];if(!$(i))return this._$Cwt=A,i;A{for(;g.get();)await g.get();const t=o.deref();if(void 0!==t){const e=t._$Cbt.indexOf(i);e>-1&&eA.has(t)))&&(this._message=null)}async _createJSMPEGPlayer(A){this._jsmpegVideoPlayer=await new Promise((t=>{let i=!1;const e=new j.VideoElement(this,A,{canvas:this._jsmpegCanvasElement},{pauseWhenHidden:!1,autoplay:!1,protocols:[],audio:!1,videoBufferSize:4194304,preserveDrawingBuffer:!0,...this.cameraConfig?.jsmpeg?.options,reconnectInterval:0,onVideoDecode:()=>{!i&&this._jsmpegCanvasElement&&(i=!0,t(e))},onPlay:()=>g(this),onPause:()=>I(this)})})),this._jsmpegCanvasElement&&a(this,this._jsmpegCanvasElement,{player:this,capabilities:{supportsPause:!0},technology:["jsmpeg"]})}_resetPlayer(){if(this._message=null,this._refreshPlayerTimer.stop(),this._jsmpegVideoPlayer){try{this._jsmpegVideoPlayer.destroy()}catch(A){}this._jsmpegVideoPlayer=void 0}this._jsmpegCanvasElement&&(this._jsmpegCanvasElement.remove(),this._jsmpegCanvasElement=void 0)}connectedCallback(){super.connectedCallback(),this.isConnected&&this.requestUpdate()}disconnectedCallback(){this.isConnected||this._resetPlayer(),super.disconnectedCallback()}async _refreshPlayer(){if(!this.hass)return;this._resetPlayer(),this._jsmpegCanvasElement=document.createElement("canvas"),this._jsmpegCanvasElement.className="media";const A=this.cameraEndpoints?.jsmpeg;if(!A)return this._message={message:B("error.live_camera_no_endpoint"),type:"error",context:this.cameraConfig},void l(this);const t=await u(this.hass,A,86400);if(!t)return this._message={type:"error",message:B("error.failed_sign"),context:this.cameraConfig},void l(this);await this._createJSMPEGPlayer(t),this._refreshPlayerTimer.start(82800,(()=>this.requestUpdate()))}render(){if(this._message)return r(this._message);return C`${tA((async()=>{if(await this._refreshPlayer(),this._jsmpegVideoPlayer&&this._jsmpegCanvasElement)return C`${this._jsmpegCanvasElement}`;this._message||(this._message={message:B("error.jsmpeg_no_player"),type:"error",context:this.cameraConfig},l(this))})(),n({cardWideConfig:this.cardWideConfig}))}`}static get styles(){return E(":host {\n width: 100%;\n height: 100%;\n display: flex;\n}\n\ncanvas {\n display: block;\n width: 100%;\n height: 100%;\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}")}};Q([h({attribute:!1})],iA.prototype,"cameraConfig",void 0),Q([h({attribute:!1})],iA.prototype,"cameraEndpoints",void 0),Q([h({attribute:!1})],iA.prototype,"cardWideConfig",void 0),Q([d()],iA.prototype,"_message",void 0),iA=Q([c("frigate-card-live-jsmpeg")],iA);export{iA as FrigateCardLiveJSMPEG}; diff --git a/config/www/community/frigate-hass-card/jsmpeg-50dde246.js.gz b/config/www/community/frigate-hass-card/jsmpeg-50dde246.js.gz new file mode 100644 index 00000000..bc918b7d Binary files /dev/null and b/config/www/community/frigate-hass-card/jsmpeg-50dde246.js.gz differ diff --git a/config/www/community/frigate-hass-card/jsmpeg-66c8006d.js b/config/www/community/frigate-hass-card/jsmpeg-66c8006d.js new file mode 100644 index 00000000..b076d34f --- /dev/null +++ b/config/www/community/frigate-hass-card/jsmpeg-66c8006d.js @@ -0,0 +1,12 @@ +import{cL as A,eN as t,dC as i,eO as e,a as s,dD as o,dy as g,dz as I,dw as a,cQ as B,l as r,x as C,dl as n,r as E,_ as Q,n as h,t as d}from"./card-c642ee74.js";import{g as c}from"./endpoint-cc3caf82.js";function l(){return l=Object.assign?Object.assign.bind():function(A){for(var t=1;t"string"==typeof A&&A.constructor===String,D=function(A){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t=A,"Promise"===Object.prototype.toString.call(t).slice(8,-1)?A:new Promise((t=>{A(),setTimeout(t,i)}))};var m="WJ3NAvwFY9",f="tR2-0dd-e1",y="ZgIIHVSSYI",R="kAA8SjbHe2",k="OueN4AU4CJ";!function(A,t){void 0===t&&(t={});var i=t.insertAt;if(A&&"undefined"!=typeof document){var e=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css","top"===i&&e.firstChild?e.insertBefore(s,e.firstChild):e.appendChild(s),s.styleSheet?s.styleSheet.cssText=A:s.appendChild(document.createTextNode(A))}}(".WJ3NAvwFY9,.ZgIIHVSSYI,.kAA8SjbHe2,.tR2-0dd-e1{height:100%;left:0;position:absolute;top:0;width:100%;z-index:1}.ZgIIHVSSYI{-ms-flex-pack:center;-ms-flex-align:center;-webkit-align-items:center;align-items:center;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-justify-content:center;justify-content:center}.WJ3NAvwFY9,.tR2-0dd-e1{display:block}.tR2-0dd-e1.OueN4AU4CJ{display:none}.ZgIIHVSSYI,.kAA8SjbHe2{-webkit-tap-highlight-color:rgba(255,0,0,0);cursor:pointer;opacity:.7}.OueN4AU4CJ.ZgIIHVSSYI,.OueN4AU4CJ.kAA8SjbHe2{display:none}.ZgIIHVSSYI{z-index:10}.ZgIIHVSSYI>svg{fill:#fff;height:12vw;max-height:60px;max-width:60px;width:12vw}.kAA8SjbHe2{-ms-flex-pack:end;-ms-flex-align:end;-webkit-align-items:flex-end;align-items:flex-end;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-justify-content:flex-end;justify-content:flex-end;z-index:10}.kAA8SjbHe2>svg{fill:#fff;height:9vw;margin:0 15px 15px 0;max-height:40px;max-width:40px;width:9vw}");var b=function(){function A(A,t,i,e){var s=void 0===i?{}:i,o=s.canvas,g=void 0===o?"":o,I=s.poster,a=void 0===I?"":I,B=s.autoplay,r=void 0!==B&&B,C=s.autoSetWrapperSize,n=void 0!==C&&C,E=s.loop,Q=void 0!==E&&E,h=s.control,d=void 0===h||h,c=s.decodeFirstFrame,u=void 0===c||c,w=s.picMode,D=void 0!==w&&w,m=s.progressive,f=void 0===m||m,y=s.chunkSize,R=void 0===y?1048576:y,k=s.hooks,b=void 0===k?{}:k;void 0===e&&(e={}),this.options=l({videoUrl:t,canvas:g,poster:a,picMode:D,autoplay:r,autoSetWrapperSize:n,loop:Q,control:d,decodeFirstFrame:u,progressive:f,chunkSize:R,hooks:l({play:function(){},pause:function(){},stop:function(){},load:function(){}},b)},e),this.options.needPlayButton=this.options.control&&!this.options.picMode,this.player=null,this.els={wrapper:p(A)?document.querySelector(A):A,canvas:null,playButton:document.createElement("div"),unmuteButton:null,poster:null},"static"===window.getComputedStyle(this.els.wrapper).getPropertyValue("position")&&(this.els.wrapper.style.position="relative"),this.els.wrapper.clientRect=this.els.wrapper.getBoundingClientRect(),this.initCanvas(),this.initPlayButton(),this.initPlayer()}var t=A.prototype;return t.initCanvas=function(){this.options.canvas?this.els.canvas=p(this.options.canvas)?document.querySelector(this.options.canvas):this.options.canvas:(this.els.canvas=document.createElement("canvas"),this.els.canvas.classList.add(m),this.els.wrapper.appendChild(this.els.canvas))},t.initPlayer=function(){var A=this;this.options=l(this.options,{canvas:this.els.canvas});var t=l({},this.options,{autoplay:!1});if(this.player=new X(this.options.videoUrl,t,{play:function(){A.options.needPlayButton&&A.els.playButton.classList.add(k),A.els.poster&&A.els.poster.classList.add(k),A.options.hooks.play()},pause:function(){A.options.needPlayButton&&A.els.playButton.classList.remove(k),A.options.hooks.pause()},stop:function(){A.els.poster&&A.els.poster.classList.remove(k),A.options.hooks.stop()},load:function(){A.options.autoplay&&A.play(),A._autoSetWrapperSize(),A.options.hooks.load()}}),this._copyPlayerFuncs(),this.els.wrapper.playerInstance=this.player,!this.options.poster||this.options.autoplay||this.player.options.streaming||(this.options.decodeFirstFrame=!1,this.els.poster=new Image,this.els.poster.src=this.options.poster,this.els.poster.classList.add(f),this.els.wrapper.appendChild(this.els.poster)),this.player.options.streaming||this.els.wrapper.addEventListener("click",this.onClick.bind(this)),(this.options.autoplay||this.player.options.streaming)&&this.els.playButton.classList.add(k),this.player.audioOut&&!this.player.audioOut.unlocked){var i=this.els.wrapper;(this.options.autoplay||this.player.options.streaming)&&(this.els.unmuteButton=document.createElement("div"),this.els.unmuteButton.innerHTML='\n\n \n\n',this.els.unmuteButton.classList.add(R),this.els.wrapper.appendChild(this.els.unmuteButton),i=this.els.unmuteButton),this.unlockAudioBound=this.onUnlockAudio.bind(this,i),i.addEventListener("touchstart",this.unlockAudioBound,!1),i.addEventListener("click",this.unlockAudioBound,!0)}},t.initPlayButton=function(){this.options.needPlayButton&&(this.els.playButton.classList.add(y),this.els.playButton.innerHTML='\n\n \n\n',this.els.wrapper.appendChild(this.els.playButton))},t._autoSetWrapperSize=function(){var A=this;if(!this.options.autoSetWrapperSize)return Promise.resolve();var t=this.player.video.destination;return t?Promise.resolve().then((function(){return D((function(){A.els.wrapper.style.width=t.width+"px",A.els.wrapper.style.height=t.height+"px"}))})):Promise.resolve()},t.onUnlockAudio=function(A,t){var i=this;this.els.unmuteButton&&(t.preventDefault(),t.stopPropagation()),this.player.audioOut.unlock((function(){i.els.unmuteButton&&i.els.unmuteButton.classList.add(k),A.removeEventListener("touchstart",i.unlockAudioBound),A.removeEventListener("click",i.unlockAudioBound)}))},t.onClick=function(){this.options.control&&(this.player.isPlaying?this.pause():this.play())},t._copyPlayerFuncs=function(){var A=this;this.play=function(){return A.player.play()},this.pause=function(){return A.player.pause()},this.stop=function(){return A.player.stop()},this.destroy=function(){A.player.destroy(),A.els.wrapper.innerHTML="",A.els.wrapper.playerInstance=null}},A}(),S=function(){return window.performance?window.performance.now()/1e3:Date.now()/1e3},G=function(A,t){if(A.fill)A.fill(t);else for(var i=0;iA&&this.loadNextChunk())},t.destroy=function(){this.request.abort(),this.aborted=!0},t.loadNextChunk=function(){var A=this,t=this.loadedSize,i=Math.min(this.loadedSize+this.chunkSize-1,this.fileSize-1);if(t>=this.fileSize||this.aborted)return this.completed=!0,void(this.onCompletedCallback&&this.onCompletedCallback(this));this.isLoading=!0,this.loadStartTime=S(),this.request=new XMLHttpRequest,this.request.onreadystatechange=function(){A.request.readyState===A.request.DONE&&A.request.status>=200&&A.request.status<300?A.onChunkLoad(A.request.response):A.request.readyState===A.request.DONE&&A.loadFails++<3&&A.loadNextChunk()},0===t&&(this.request.onprogress=this.onProgress.bind(this)),this.request.open("GET",this.url+"?"+t+"-"+i),this.request.setRequestHeader("Range","bytes="+t+"-"+i),this.request.responseType="arraybuffer",this.request.send()},t.onProgress=function(A){this.progress=A.loaded/A.total},t.onChunkLoad=function(A){var t=!this.established;this.established=!0,this.progress=1,this.loadedSize+=A.byteLength,this.loadFails=0,this.isLoading=!1,t&&this.hookOnEstablished&&this.hookOnEstablished(),t&&this.onEstablishedCallback&&this.onEstablishedCallback(this),this.destination&&this.destination.write(A),this.loadTime=S()-this.loadStartTime,this.throttled||this.loadNextChunk()},A}(),N=function(){function A(A,t){this.url=A,this.options=t,this.socket=null,this.streaming=!0,this.callbacks={connect:[],data:[]},this.destination=null,this.reconnectInterval=void 0!==t.reconnectInterval?t.reconnectInterval:5,this.shouldAttemptReconnect=!!this.reconnectInterval,this.completed=!1,this.established=!1,this.progress=0,this.reconnectTimeoutId=0,this.onEstablishedCallback=t.onSourceEstablished,this.onCompletedCallback=t.onSourceCompleted,t.hookOnEstablished&&(this.hookOnEstablished=t.hookOnEstablished)}var t=A.prototype;return t.connect=function(A){this.destination=A},t.destroy=function(){clearTimeout(this.reconnectTimeoutId),this.shouldAttemptReconnect=!1,this.socket.close()},t.start=function(){this.shouldAttemptReconnect=!!this.reconnectInterval,this.progress=0,this.established=!1,this.options.protocols?this.socket=new WebSocket(this.url,this.options.protocols):this.socket=new WebSocket(this.url),this.socket.binaryType="arraybuffer",this.socket.onmessage=this.onMessage.bind(this),this.socket.onopen=this.onOpen.bind(this),this.socket.onerror=this.onClose.bind(this),this.socket.onclose=this.onClose.bind(this)},t.resume=function(){},t.onOpen=function(){this.progress=1},t.onClose=function(){var A=this;this.shouldAttemptReconnect&&(clearTimeout(this.reconnectTimeoutId),this.reconnectTimeoutId=setTimeout((function(){A.start()}),1e3*this.reconnectInterval))},t.onMessage=function(A){var t=!this.established;this.established=!0,t&&this.hookOnEstablished&&this.hookOnEstablished(),t&&this.onEstablishedCallback&&this.onEstablishedCallback(this),this.destination&&this.destination.write(A.data)},A}(),L=function(){function A(t,i){"object"==typeof t?(this.bytes=t instanceof Uint8Array?t:new Uint8Array(t),this.byteLength=this.bytes.length):(this.bytes=new Uint8Array(t||1048576),this.byteLength=0),this.mode=i||A.MODE.EXPAND,this.index=0}var t=A.prototype;return t.resize=function(A){var t=new Uint8Array(A);0!==this.byteLength&&(this.byteLength=Math.min(this.byteLength,A),t.set(this.bytes,0,this.byteLength)),this.bytes=t,this.index=Math.min(this.index,this.byteLength<<3)},t.evict=function(A){var t=this.index>>3,i=this.bytes.length-this.byteLength;if(this.index===this.byteLength<<3||A>i+t)return this.byteLength=0,void(this.index=0);0!==t&&(this.bytes.copyWithin?this.bytes.copyWithin(0,t,this.byteLength):this.bytes.set(this.bytes.subarray(t,this.byteLength)),this.byteLength-=t,this.index-=t<<3)},t.write=function(t){var i="object"==typeof t[0],e=0,s=this.bytes.length-this.byteLength;if(i){e=0;for(var o=0;os)if(this.mode===A.MODE.EXPAND){var g=Math.max(2*this.bytes.length,e-s);this.resize(g)}else this.evict(e);if(i)for(var I=0;I>3;A>3;return A>=this.byteLength||0===this.bytes[A]&&0===this.bytes[A+1]&&1===this.bytes[A+2]},t.peek=function(A){for(var t=this.index,i=0;A;){var e=8-(7&t),s=e>3]&255>>8-s<>o,t+=s,A-=s}return i},t.read=function(A){var t=this.peek(A);return this.index+=A,t},t.skip=function(A){return this.index+=A},t.rewind=function(A){this.index=Math.max(this.index-A,0)},t.has=function(A){return(this.byteLength<<3)-this.index>=A},A}();L.MODE={EVICT:1,EXPAND:2};var U=function(){function A(){this.bits=null,this.leftoverBytes=null,this.guessVideoFrameEnd=!0,this.pidsToStreamIds={},this.pesPacketInfo={},this.startTime=0,this.currentTime=0}var t=A.prototype;return t.connect=function(A,t){this.pesPacketInfo[A]={destination:t,currentLength:0,totalLength:0,pts:0,buffers:[]}},t.write=function(A){if(this.leftoverBytes){var t=A.byteLength+this.leftoverBytes.byteLength;this.bits=new L(t),this.bits.write([this.leftoverBytes,A])}else this.bits=new L(A);for(;this.bits.has(1504)&&this.parsePacket(););var i=this.bits.byteLength-(this.bits.index>>3);this.leftoverBytes=i>0?this.bits.bytes.subarray(this.bits.index>>3):null},t.parsePacket=function(){if(71!==this.bits.read(8)&&!this.resync())return!1;var A=187+(this.bits.index>>3);this.bits.read(1);var t=this.bits.read(1);this.bits.read(1);var i=this.bits.read(13);this.bits.read(2);var e=this.bits.read(2);this.bits.read(4);var s=this.pidsToStreamIds[i];if(t&&s){var o=this.pesPacketInfo[s];o&&o.currentLength&&this.packetComplete(o)}if(1&e){if(2&e){var g=this.bits.read(8);this.bits.skip(g<<3)}if(t&&this.bits.nextBytesAreStartCode()){this.bits.skip(24),s=this.bits.read(8),this.pidsToStreamIds[i]=s;var I=this.bits.read(16);this.bits.skip(8);var a=this.bits.read(2);this.bits.skip(6);var B=this.bits.read(8),r=this.bits.index+(B<<3),C=this.pesPacketInfo[s];if(C){var n=0;if(2&a){this.bits.skip(4);var E=this.bits.read(3);this.bits.skip(1);var Q=this.bits.read(15);this.bits.skip(1);var h=this.bits.read(15);this.bits.skip(1),n=(1073741824*E+32768*Q+h)/9e4,this.currentTime=n,-1===this.startTime&&(this.startTime=n)}var d=I?I-B-3:0;this.packetStart(C,n,d)}this.bits.index=r}if(s){var c=this.pesPacketInfo[s];if(c){var l=this.bits.index>>3,u=!t&&2&e;(this.packetAddData(c,l,A)||this.guessVideoFrameEnd&&u)&&this.packetComplete(c)}}}return this.bits.index=A<<3,!0},t.resync=function(){if(!this.bits.has(9024))return!1;for(var A=this.bits.index>>3,t=0;t<187;t++)if(71===this.bits.bytes[A+t]){for(var i=!0,e=1;e<5;e++)if(71!==this.bits.bytes[A+t+188*e]){i=!1;break}if(i)return this.bits.index=A+t+1<<3,!0}return console.warn("JSMpeg: Possible garbage data. Skipping."),this.bits.skip(1496),!1},t.packetStart=function(A,t,i){A.totalLength=i,A.currentLength=0,A.pts=t},t.packetAddData=function(A,t,i){return A.buffers.push(this.bits.bytes.subarray(t,i)),A.currentLength+=i-t,0!==A.totalLength&&A.currentLength>=A.totalLength},t.packetComplete=function(A){A.destination.write(A.pts,A.buffers),A.totalLength=0,A.currentLength=0,A.buffers=[]},A}();U.STREAM={PACK_HEADER:186,SYSTEM_HEADER:187,PROGRAM_MAP:188,PRIVATE_1:189,PADDING:190,PRIVATE_2:191,AUDIO_1:192,VIDEO_1:224,DIRECTORY:255};var J=function(){function A(A){this.destination=null,this.canPlay=!1,this.collectTimestamps=!A.streaming,this.bytesWritten=0,this.timestamps=[],this.timestampIndex=0,this.startTime=0,this.decodedTime=0,Object.defineProperty(this,"currentTime",{get:this.getCurrentTime})}var t=A.prototype;return t.destroy=function(){},t.connect=function(A){this.destination=A},t.bufferGetIndex=function(){return this.bits.index},t.bufferSetIndex=function(A){this.bits.index=A},t.bufferWrite=function(A){return this.bits.write(A)},t.write=function(A,t){this.collectTimestamps&&(0===this.timestamps.length&&(this.startTime=A,this.decodedTime=A),this.timestamps.push({index:this.bytesWritten<<3,time:A})),this.bytesWritten+=this.bufferWrite(t),this.canPlay=!0},t.seek=function(A){if(this.collectTimestamps){this.timestampIndex=0;for(var t=0;tA);t++)this.timestampIndex=t;var i=this.timestamps[this.timestampIndex];i?(this.bufferSetIndex(i.index),this.decodedTime=i.time):(this.bits.index=0,this.decodedTime=this.startTime)}},t.decode=function(){this.advanceDecodedTime(0)},t.advanceDecodedTime=function(A){if(this.collectTimestamps){for(var t=-1,i=this.bufferGetIndex(),e=this.timestampIndex;ei);e++)t=e;if(-1!==t&&t!==this.timestampIndex)return this.timestampIndex=t,void(this.decodedTime=this.timestamps[this.timestampIndex].time)}this.decodedTime+=A},t.getCurrentTime=function(){return this.decodedTime},A}(),T=function(A){function t(t){var i;(i=A.call(this,t)||this).onDecodeCallback=t.onVideoDecode;var e=t.videoBufferSize||524288,s=t.streaming?L.MODE.EVICT:L.MODE.EXPAND;return i.bits=new L(e,s),i.customIntraQuantMatrix=new Uint8Array(64),i.customNonIntraQuantMatrix=new Uint8Array(64),i.blockData=new Int32Array(64),i.currentFrame=0,i.decodeFirstFrame=!1!==t.decodeFirstFrame,i}u(t,A);var i=t.prototype;return i.write=function(A,i){if(J.prototype.write.call(this,A,i),!this.hasSequenceHeader){if(-1===this.bits.findStartCode(t.START.SEQUENCE))return!1;this.decodeSequenceHeader(),this.decodeFirstFrame&&this.decode()}},i.decode=function(){var A=S();if(!this.hasSequenceHeader)return!1;if(-1===this.bits.findStartCode(t.START.PICTURE))return!1;this.decodePicture(),this.advanceDecodedTime(1/this.frameRate);var i=S()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,i),!0},i.readHuffman=function(A){var t=0;do{t=A[t+this.bits.read(1)]}while(t>=0&&0!==A[t]);return A[t+2]},i.decodeSequenceHeader=function(){var A=this.bits.read(12),i=this.bits.read(12);if(this.bits.skip(4),this.frameRate=t.PICTURE_RATE[this.bits.read(4)],this.bits.skip(30),A===this.width&&i===this.height||(this.width=A,this.height=i,this.initBuffers(),this.destination&&this.destination.resize(A,i)),this.bits.read(1)){for(var e=0;e<64;e++)this.customIntraQuantMatrix[t.ZIG_ZAG[e]]=this.bits.read(8);this.intraQuantMatrix=this.customIntraQuantMatrix}if(this.bits.read(1)){for(var s=0;s<64;s++){var o=t.ZIG_ZAG[s];this.customNonIntraQuantMatrix[o]=this.bits.read(8)}this.nonIntraQuantMatrix=this.customNonIntraQuantMatrix}this.hasSequenceHeader=!0},i.initBuffers=function(){this.intraQuantMatrix=t.DEFAULT_INTRA_QUANT_MATRIX,this.nonIntraQuantMatrix=t.DEFAULT_NON_INTRA_QUANT_MATRIX,this.mbWidth=this.width+15>>4,this.mbHeight=this.height+15>>4,this.mbSize=this.mbWidth*this.mbHeight,this.codedWidth=this.mbWidth<<4,this.codedHeight=this.mbHeight<<4,this.codedSize=this.codedWidth*this.codedHeight,this.halfWidth=this.mbWidth<<3,this.halfHeight=this.mbHeight<<3,this.currentY=new Uint8ClampedArray(this.codedSize),this.currentY32=new Uint32Array(this.currentY.buffer),this.currentCr=new Uint8ClampedArray(this.codedSize>>2),this.currentCr32=new Uint32Array(this.currentCr.buffer),this.currentCb=new Uint8ClampedArray(this.codedSize>>2),this.currentCb32=new Uint32Array(this.currentCb.buffer),this.forwardY=new Uint8ClampedArray(this.codedSize),this.forwardY32=new Uint32Array(this.forwardY.buffer),this.forwardCr=new Uint8ClampedArray(this.codedSize>>2),this.forwardCr32=new Uint32Array(this.forwardCr.buffer),this.forwardCb=new Uint8ClampedArray(this.codedSize>>2),this.forwardCb32=new Uint32Array(this.forwardCb.buffer)},i.decodePicture=function(){if(this.currentFrame++,this.bits.skip(10),this.pictureType=this.bits.read(3),this.bits.skip(16),!(this.pictureType<=0||this.pictureType>=t.PICTURE_TYPE.B)){if(this.pictureType===t.PICTURE_TYPE.PREDICTIVE){if(this.fullPelForward=this.bits.read(1),this.forwardFCode=this.bits.read(3),0===this.forwardFCode)return;this.forwardRSize=this.forwardFCode-1,this.forwardF=1<=t.START.SLICE_FIRST&&A<=t.START.SLICE_LAST;)this.decodeSlice(255&A),A=this.bits.findNextStartCode();if(-1!==A&&this.bits.rewind(32),this.destination&&this.destination.render(this.currentY,this.currentCr,this.currentCb,!0),this.pictureType===t.PICTURE_TYPE.INTRA||this.pictureType===t.PICTURE_TYPE.PREDICTIVE){var i=this.forwardY,e=this.forwardY32,s=this.forwardCr,o=this.forwardCr32,g=this.forwardCb,I=this.forwardCb32;this.forwardY=this.currentY,this.forwardY32=this.currentY32,this.forwardCr=this.currentCr,this.forwardCr32=this.currentCr32,this.forwardCb=this.currentCb,this.forwardCb32=this.currentCb32,this.currentY=i,this.currentY32=e,this.currentCr=s,this.currentCr32=o,this.currentCb=g,this.currentCb32=I}}},i.decodeSlice=function(A){for(this.sliceBegin=!0,this.macroblockAddress=(A-1)*this.mbWidth-1,this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0,this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.quantizerScale=this.bits.read(5);this.bits.read(1);)this.bits.skip(8);do{this.decodeMacroblock()}while(!this.bits.nextBytesAreStartCode())},i.decodeMacroblock=function(){for(var A=0,i=this.readHuffman(t.MACROBLOCK_ADDRESS_INCREMENT);34===i;)i=this.readHuffman(t.MACROBLOCK_ADDRESS_INCREMENT);for(;35===i;)A+=33,i=this.readHuffman(t.MACROBLOCK_ADDRESS_INCREMENT);if(A+=i,this.sliceBegin)this.sliceBegin=!1,this.macroblockAddress+=A;else{if(this.macroblockAddress+A>=this.mbSize)return;for(A>1&&(this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.pictureType===t.PICTURE_TYPE.PREDICTIVE&&(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0));A>1;)this.macroblockAddress++,this.mbRow=this.macroblockAddress/this.mbWidth|0,this.mbCol=this.macroblockAddress%this.mbWidth,this.copyMacroblock(this.motionFwH,this.motionFwV,this.forwardY,this.forwardCr,this.forwardCb),A--;this.macroblockAddress++}this.mbRow=this.macroblockAddress/this.mbWidth|0,this.mbCol=this.macroblockAddress%this.mbWidth;var e=t.MACROBLOCK_TYPE[this.pictureType];this.macroblockType=this.readHuffman(e),this.macroblockIntra=1&this.macroblockType,this.macroblockMotFw=8&this.macroblockType,16&this.macroblockType&&(this.quantizerScale=this.bits.read(5)),this.macroblockIntra?(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0):(this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.decodeMotionVectors(),this.copyMacroblock(this.motionFwH,this.motionFwV,this.forwardY,this.forwardCr,this.forwardCb));for(var s=2&this.macroblockType?this.readHuffman(t.CODE_BLOCK_PATTERN):this.macroblockIntra?63:0,o=0,g=32;o<6;o++)s&g&&this.decodeBlock(o),g>>=1},i.decodeMotionVectors=function(){var A,i,e=0;this.macroblockMotFw?(0!==(A=this.readHuffman(t.MOTION))&&1!==this.forwardF?(e=this.bits.read(this.forwardRSize),i=(Math.abs(A)-1<(this.forwardF<<4)-1?this.motionFwHPrev-=this.forwardF<<5:this.motionFwHPrev<-this.forwardF<<4&&(this.motionFwHPrev+=this.forwardF<<5),this.motionFwH=this.motionFwHPrev,this.fullPelForward&&(this.motionFwH<<=1),0!==(A=this.readHuffman(t.MOTION))&&1!==this.forwardF?(e=this.bits.read(this.forwardRSize),i=(Math.abs(A)-1<(this.forwardF<<4)-1?this.motionFwVPrev-=this.forwardF<<5:this.motionFwVPrev<-this.forwardF<<4&&(this.motionFwVPrev+=this.forwardF<<5),this.motionFwV=this.motionFwVPrev,this.fullPelForward&&(this.motionFwV<<=1)):this.pictureType===t.PICTURE_TYPE.PREDICTIVE&&(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0)},i.copyMacroblock=function(A,t,i,e,s){var o,g,I,a,B,r,C,n,E,Q,h,d,c,l,u,w,p,D,m,f=this.currentY32,y=this.currentCb32,R=this.currentCr32;if(g=(o=this.codedWidth)-16,I=A>>1,a=t>>1,B=!(1&~A),r=!(1&~t),C=((this.mbRow<<4)+a)*o+(this.mbCol<<4)+I,E=(n=this.mbRow*o+this.mbCol<<2)+(o<<2),B)if(r)for(;n>2&255,c|=(h=i[++C]+i[C+o])+d+2<<6&65280,c|=h+(d=i[++C]+i[C+o])+2<<14&16711680,h=i[++C]+i[C+o],C++,c|=h+d+2<<22&4278190080,f[n++]=c;n+=g>>2,C+=g-1}else for(;n>1&255,c|=(h=i[C++])+d+1<<7&65280,c|=h+(d=i[C++])+1<<15&16711680,c|=(h=i[C++])+d+1<<23&4278190080,f[n++]=c;n+=g>>2,C+=g-1}else if(r)for(;n>1&255,c|=i[++C]+i[C+o]+1<<7&65280,c|=i[++C]+i[C+o]+1<<15&16711680,c|=i[++C]+i[C+o]+1<<23&4278190080,C++,f[n++]=c;n+=g>>2,C+=g}else for(;n>2,C+=g}if(g=(o=this.halfWidth)-8,I=A/2>>1,a=t/2>>1,B=1==(A/2&1),r=1==(t/2&1),C=((this.mbRow<<3)+a)*o+(this.mbCol<<3)+I,E=(n=this.mbRow*o+this.mbCol<<1)+(o<<1),B)if(r)for(;n>2&255,m=p+(D=s[C]+s[C+o])+2>>2&255,w|=(l=e[++C]+e[C+o])+u+2<<6&65280,m|=(p=s[C]+s[C+o])+D+2<<6&65280,w|=l+(u=e[++C]+e[C+o])+2<<14&16711680,m|=p+(D=s[C]+s[C+o])+2<<14&16711680,l=e[++C]+e[C+o],p=s[C]+s[C+o],C++,w|=l+u+2<<22&4278190080,m|=p+D+2<<22&4278190080,R[n]=w,y[n]=m,n++;n+=g>>2,C+=g-1}else for(;n>1&255,m=p+(D=s[C++])+1>>1&255,w|=(l=e[C])+u+1<<7&65280,m|=(p=s[C++])+D+1<<7&65280,w|=l+(u=e[C])+1<<15&16711680,m|=p+(D=s[C++])+1<<15&16711680,w|=(l=e[C])+u+1<<23&4278190080,m|=(p=s[C++])+D+1<<23&4278190080,R[n]=w,y[n]=m,n++;n+=g>>2,C+=g-1}else if(r)for(;n>1&255,m=s[C]+s[C+o]+1>>1&255,w|=e[++C]+e[C+o]+1<<7&65280,m|=s[C]+s[C+o]+1<<7&65280,w|=e[++C]+e[C+o]+1<<15&16711680,m|=s[C]+s[C+o]+1<<15&16711680,w|=e[++C]+e[C+o]+1<<23&4278190080,m|=s[C]+s[C+o]+1<<23&4278190080,C++,R[n]=w,y[n]=m,n++;n+=g>>2,C+=g}else for(;n>2,C+=g}},i.decodeBlock=function(A){var i,e=0;if(this.macroblockIntra){var s,o;if(A<4?(s=this.dcPredictorY,o=this.readHuffman(t.DCT_DC_SIZE_LUMINANCE)):(s=4===A?this.dcPredictorCr:this.dcPredictorCb,o=this.readHuffman(t.DCT_DC_SIZE_CHROMINANCE)),o>0){var g=this.bits.read(o);this.blockData[0]=g&1<0&&0===this.bits.read(1))break;65535===n?(C=this.bits.read(6),0===(r=this.bits.read(8))?r=this.bits.read(8):128===r?r=this.bits.read(8)-256:r>128&&(r-=256)):(C=n>>8,r=255&n,this.bits.read(1)&&(r=-r)),e+=C;var E=t.ZIG_ZAG[e];e++,r<<=1,this.macroblockIntra||(r+=r<0?-1:1),1&(r=r*this.quantizerScale*i[E]>>4)||(r-=r>0?1:-1),r>2047?r=2047:r<-2048&&(r=-2048),this.blockData[E]=r*t.PREMULTIPLIER_MATRIX[E]}A<4?(I=this.currentY,B=this.codedWidth-8,a=this.mbRow*this.codedWidth+this.mbCol<<4,1&A&&(a+=8),2&A&&(a+=this.codedWidth<<3)):(I=4===A?this.currentCb:this.currentCr,B=(this.codedWidth>>1)-8,a=(this.mbRow*this.codedWidth<<2)+(this.mbCol<<3)),this.macroblockIntra?1===e?(t.CopyValueToDestination(this.blockData[0]+128>>8,I,a,B),this.blockData[0]=0):(t.IDCT(this.blockData),t.CopyBlockToDestination(this.blockData,I,a,B),G(this.blockData,0)):1===e?(t.AddValueToDestination(this.blockData[0]+128>>8,I,a,B),this.blockData[0]=0):(t.IDCT(this.blockData),t.AddBlockToDestination(this.blockData,I,a,B),G(this.blockData,0)),e=0},t.CopyBlockToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]=A[s+0],t[i+1]=A[s+1],t[i+2]=A[s+2],t[i+3]=A[s+3],t[i+4]=A[s+4],t[i+5]=A[s+5],t[i+6]=A[s+6],t[i+7]=A[s+7]},t.AddBlockToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]+=A[s+0],t[i+1]+=A[s+1],t[i+2]+=A[s+2],t[i+3]+=A[s+3],t[i+4]+=A[s+4],t[i+5]+=A[s+5],t[i+6]+=A[s+6],t[i+7]+=A[s+7]},t.CopyValueToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]=A,t[i+1]=A,t[i+2]=A,t[i+3]=A,t[i+4]=A,t[i+5]=A,t[i+6]=A,t[i+7]=A},t.AddValueToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]+=A,t[i+1]+=A,t[i+2]+=A,t[i+3]+=A,t[i+4]+=A,t[i+5]+=A,t[i+6]+=A,t[i+7]+=A},t.IDCT=function(A){for(var t,i,e,s,o,g,I,a,B,r,C,n,E,Q,h,d,c,l,u=0;u<8;++u)t=A[32+u],i=A[16+u]+A[48+u],e=A[40+u]-A[24+u],g=A[8+u]+A[56+u],I=A[24+u]+A[40+u],B=(E=(473*(s=A[8+u]-A[56+u])-196*e+128>>8)-(o=g+I))-(362*(g-I)+128>>8),Q=(r=(a=A[0+u])-t)+(C=(362*(A[16+u]-A[48+u])+128>>8)-i),h=(n=a+t)+i,d=r-C,c=n-i,l=-B-(473*e+196*s+128>>8),A[0+u]=o+h,A[8+u]=E+Q,A[16+u]=d-B,A[24+u]=c-l,A[32+u]=c+l,A[40+u]=B+d,A[48+u]=Q-E,A[56+u]=h-o;for(var w=0;w<64;w+=8)t=A[4+w],i=A[2+w]+A[6+w],e=A[5+w]-A[3+w],g=A[1+w]+A[7+w],I=A[3+w]+A[5+w],B=(E=(473*(s=A[1+w]-A[7+w])-196*e+128>>8)-(o=g+I))-(362*(g-I)+128>>8),Q=(r=(a=A[0+w])-t)+(C=(362*(A[2+w]-A[6+w])+128>>8)-i),h=(n=a+t)+i,d=r-C,c=n-i,l=-B-(473*e+196*s+128>>8),A[0+w]=o+h+128>>8,A[1+w]=E+Q+128>>8,A[2+w]=d-B+128>>8,A[3+w]=c-l+128>>8,A[4+w]=c+l+128>>8,A[5+w]=B+d+128>>8,A[6+w]=Q-E+128>>8,A[7+w]=h-o+128>>8},t}(J);T.prototype.frameRate=30,T.prototype.currentY=null,T.prototype.currentCr=null,T.prototype.currentCb=null,T.prototype.pictureType=0,T.prototype.forwardY=null,T.prototype.forwardCr=null,T.prototype.forwardCb=null,T.prototype.fullPelForward=!1,T.prototype.forwardFCode=0,T.prototype.forwardRSize=0,T.prototype.forwardF=0,T.prototype.quantizerScale=0,T.prototype.sliceBegin=!1,T.prototype.macroblockAddress=0,T.prototype.mbRow=0,T.prototype.mbCol=0,T.prototype.macroblockType=0,T.prototype.macroblockIntra=!1,T.prototype.macroblockMotFw=!1,T.prototype.motionFwH=0,T.prototype.motionFwV=0,T.prototype.motionFwHPrev=0,T.prototype.motionFwVPrev=0,T.prototype.dcPredictorY=0,T.prototype.dcPredictorCr=0,T.prototype.dcPredictorCb=0,T.prototype.blockData=null,T.PICTURE_RATE=[0,23.976,24,25,29.97,30,50,59.94,60,0,0,0,0,0,0,0],T.ZIG_ZAG=new Uint8Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),T.DEFAULT_INTRA_QUANT_MATRIX=new Uint8Array([8,16,19,22,26,27,29,34,16,16,22,24,27,29,34,37,19,22,26,27,29,34,34,38,22,22,26,27,29,34,37,40,22,26,27,29,32,35,40,48,26,27,29,32,35,40,48,58,26,27,29,34,38,46,56,69,27,29,35,38,46,56,69,83]),T.DEFAULT_NON_INTRA_QUANT_MATRIX=new Uint8Array([16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16]),T.PREMULTIPLIER_MATRIX=new Uint8Array([32,44,42,38,32,25,17,9,44,62,58,52,44,35,24,12,42,58,55,49,42,33,23,12,38,52,49,44,38,30,20,10,32,44,42,38,32,25,17,9,25,35,33,30,25,20,14,7,17,24,23,20,17,14,9,5,9,12,12,10,9,7,5,2]),T.MACROBLOCK_ADDRESS_INCREMENT=new Int16Array([3,6,0,9,12,0,0,0,1,15,18,0,21,24,0,27,30,0,33,36,0,0,0,3,0,0,2,39,42,0,45,48,0,0,0,5,0,0,4,51,54,0,57,60,0,0,0,7,0,0,6,63,66,0,69,72,0,75,78,0,81,84,0,-1,87,0,-1,90,0,93,96,0,99,102,0,105,108,0,111,114,0,0,0,9,0,0,8,117,120,0,123,126,0,129,132,0,135,138,0,0,0,15,0,0,14,0,0,13,0,0,12,0,0,11,0,0,10,141,-1,0,-1,144,0,147,150,0,153,156,0,159,162,0,165,168,0,171,174,0,177,180,0,183,-1,0,-1,186,0,189,192,0,195,198,0,201,204,0,207,210,0,213,216,0,219,222,0,0,0,21,0,0,20,0,0,19,0,0,18,0,0,17,0,0,16,0,0,35,0,0,34,0,0,33,0,0,32,0,0,31,0,0,30,0,0,29,0,0,28,0,0,27,0,0,26,0,0,25,0,0,24,0,0,23,0,0,22]),T.MACROBLOCK_TYPE_INTRA=new Int8Array([3,6,0,-1,9,0,0,0,1,0,0,17]),T.MACROBLOCK_TYPE_PREDICTIVE=new Int8Array([3,6,0,9,12,0,0,0,10,15,18,0,0,0,2,21,24,0,0,0,8,27,30,0,33,36,0,-1,39,0,0,0,18,0,0,26,0,0,1,0,0,17]),T.MACROBLOCK_TYPE_B=new Int8Array([3,6,0,9,15,0,12,18,0,24,21,0,0,0,12,27,30,0,0,0,14,39,42,0,36,33,0,0,0,4,0,0,6,54,48,0,45,51,0,0,0,8,0,0,10,-1,57,0,0,0,1,60,63,0,0,0,30,0,0,17,0,0,22,0,0,26]),T.MACROBLOCK_TYPE=[null,T.MACROBLOCK_TYPE_INTRA,T.MACROBLOCK_TYPE_PREDICTIVE,T.MACROBLOCK_TYPE_B],T.CODE_BLOCK_PATTERN=new Int16Array([6,3,0,9,18,0,12,15,0,24,33,0,36,39,0,27,21,0,30,42,0,60,57,0,54,48,0,69,51,0,81,75,0,63,84,0,45,66,0,72,78,0,0,0,60,105,120,0,132,144,0,114,108,0,126,141,0,87,93,0,117,96,0,0,0,32,135,138,0,99,123,0,129,102,0,0,0,4,90,111,0,0,0,8,0,0,16,0,0,44,150,168,0,0,0,28,0,0,52,0,0,62,183,177,0,156,180,0,0,0,1,165,162,0,0,0,61,0,0,56,171,174,0,0,0,2,0,0,40,153,186,0,0,0,48,192,189,0,147,159,0,0,0,20,0,0,12,240,249,0,0,0,63,231,225,0,195,219,0,252,198,0,0,0,24,0,0,36,0,0,3,207,261,0,243,237,0,204,213,0,210,234,0,201,228,0,216,222,0,258,255,0,264,246,0,-1,282,0,285,291,0,0,0,33,0,0,9,318,330,0,306,348,0,0,0,5,0,0,10,279,267,0,0,0,6,0,0,18,0,0,17,0,0,34,339,357,0,309,312,0,270,276,0,327,321,0,351,354,0,303,297,0,294,288,0,300,273,0,342,345,0,315,324,0,336,333,0,363,375,0,0,0,41,0,0,14,0,0,21,372,366,0,360,369,0,0,0,11,0,0,19,0,0,7,0,0,35,0,0,13,0,0,50,0,0,49,0,0,58,0,0,37,0,0,25,0,0,45,0,0,57,0,0,26,0,0,29,0,0,38,0,0,53,0,0,23,0,0,43,0,0,46,0,0,42,0,0,22,0,0,54,0,0,51,0,0,15,0,0,30,0,0,39,0,0,47,0,0,55,0,0,27,0,0,59,0,0,31]),T.MOTION=new Int16Array([3,6,0,12,9,0,0,0,0,18,15,0,24,21,0,0,0,-1,0,0,1,27,30,0,36,33,0,0,0,2,0,0,-2,42,45,0,48,39,0,60,54,0,0,0,3,0,0,-3,51,57,0,-1,69,0,81,75,0,78,63,0,72,66,0,96,84,0,87,93,0,-1,99,0,108,105,0,0,0,-4,90,102,0,0,0,4,0,0,-7,0,0,5,111,123,0,0,0,-5,0,0,7,114,120,0,126,117,0,0,0,-6,0,0,6,153,162,0,150,147,0,135,138,0,156,141,0,129,159,0,132,144,0,0,0,10,0,0,9,0,0,8,0,0,-8,171,198,0,0,0,-9,180,192,0,168,183,0,165,186,0,174,189,0,0,0,-10,177,195,0,0,0,12,0,0,16,0,0,13,0,0,14,0,0,11,0,0,15,0,0,-16,0,0,-12,0,0,-14,0,0,-15,0,0,-11,0,0,-13]),T.DCT_DC_SIZE_LUMINANCE=new Int8Array([6,3,0,18,15,0,9,12,0,0,0,1,0,0,2,27,24,0,21,30,0,0,0,0,36,33,0,0,0,4,0,0,3,39,42,0,0,0,5,0,0,6,48,45,0,51,-1,0,0,0,7,0,0,8]),T.DCT_DC_SIZE_CHROMINANCE=new Int8Array([6,3,0,12,9,0,18,15,0,24,21,0,0,0,2,0,0,1,0,0,0,30,27,0,0,0,3,36,33,0,0,0,4,42,39,0,0,0,5,48,45,0,0,0,6,51,-1,0,0,0,7,0,0,8]),T.DCT_COEFF=new Int32Array([3,6,0,12,9,0,0,0,1,21,24,0,18,15,0,39,27,0,33,30,0,42,36,0,0,0,257,60,66,0,54,63,0,48,57,0,0,0,513,51,45,0,0,0,2,0,0,3,81,75,0,87,93,0,72,78,0,96,90,0,0,0,1025,69,84,0,0,0,769,0,0,258,0,0,1793,0,0,65535,0,0,1537,111,108,0,0,0,1281,105,102,0,117,114,0,99,126,0,120,123,0,156,150,0,162,159,0,144,147,0,129,135,0,138,132,0,0,0,2049,0,0,4,0,0,514,0,0,2305,153,141,0,165,171,0,180,168,0,177,174,0,183,186,0,0,0,2561,0,0,3329,0,0,6,0,0,259,0,0,5,0,0,770,0,0,2817,0,0,3073,228,225,0,201,210,0,219,213,0,234,222,0,216,231,0,207,192,0,204,189,0,198,195,0,243,261,0,273,240,0,246,237,0,249,258,0,279,276,0,252,255,0,270,282,0,264,267,0,0,0,515,0,0,260,0,0,7,0,0,1026,0,0,1282,0,0,4097,0,0,3841,0,0,3585,315,321,0,333,342,0,312,291,0,375,357,0,288,294,0,-1,369,0,285,303,0,318,363,0,297,306,0,339,309,0,336,348,0,330,300,0,372,345,0,351,366,0,327,354,0,360,324,0,381,408,0,417,420,0,390,378,0,435,438,0,384,387,0,0,0,2050,396,402,0,465,462,0,0,0,8,411,399,0,429,432,0,453,414,0,426,423,0,0,0,10,0,0,9,0,0,11,0,0,5377,0,0,1538,0,0,771,0,0,5121,0,0,1794,0,0,4353,0,0,4609,0,0,4865,444,456,0,0,0,1027,459,450,0,0,0,261,393,405,0,0,0,516,447,441,0,516,519,0,486,474,0,510,483,0,504,498,0,471,537,0,507,501,0,522,513,0,534,531,0,468,477,0,492,495,0,549,546,0,525,528,0,0,0,263,0,0,2562,0,0,2306,0,0,5633,0,0,5889,0,0,6401,0,0,6145,0,0,1283,0,0,772,0,0,13,0,0,12,0,0,14,0,0,15,0,0,517,0,0,6657,0,0,262,540,543,0,480,489,0,588,597,0,0,0,27,609,555,0,606,603,0,0,0,19,0,0,22,591,621,0,0,0,18,573,576,0,564,570,0,0,0,20,552,582,0,0,0,21,558,579,0,0,0,23,612,594,0,0,0,25,0,0,24,600,615,0,0,0,31,0,0,30,0,0,28,0,0,29,0,0,26,0,0,17,0,0,16,567,618,0,561,585,0,654,633,0,0,0,37,645,648,0,0,0,36,630,636,0,0,0,34,639,627,0,663,666,0,657,624,0,651,642,0,669,660,0,0,0,35,0,0,267,0,0,40,0,0,268,0,0,266,0,0,32,0,0,264,0,0,265,0,0,38,0,0,269,0,0,270,0,0,33,0,0,39,0,0,7937,0,0,6913,0,0,7681,0,0,4098,0,0,7425,0,0,7169,0,0,271,0,0,274,0,0,273,0,0,272,0,0,1539,0,0,2818,0,0,3586,0,0,3330,0,0,3074,0,0,3842]),T.PICTURE_TYPE={INTRA:1,PREDICTIVE:2,B:3},T.START={SEQUENCE:179,SLICE_FIRST:1,SLICE_LAST:175,PICTURE:0,EXTENSION:181,USER_DATA:178};var v=function(A){function t(t){var i;return(i=A.call(this,t)||this).onDecodeCallback=t.onVideoDecode,i.module=t.wasmModule,i.bufferSize=t.videoBufferSize||524288,i.bufferMode=t.streaming?L.MODE.EVICT:L.MODE.EXPAND,i.decodeFirstFrame=!1!==t.decodeFirstFrame,i.hasSequenceHeader=!1,i}u(t,A);var i=t.prototype;return i.initializeWasmDecoder=function(){this.module.instance?(this.instance=this.module.instance,this.functions=this.module.instance.exports,this.decoder=this.functions._mpeg1_decoder_create(this.bufferSize,this.bufferMode)):console.warn("JSMpeg: WASM module not compiled yet")},i.destroy=function(){this.decoder&&this.functions._mpeg1_decoder_destroy(this.decoder)},i.bufferGetIndex=function(){if(this.decoder)return this.functions._mpeg1_decoder_get_index(this.decoder)},i.bufferSetIndex=function(A){this.decoder&&this.functions._mpeg1_decoder_set_index(this.decoder,A)},i.bufferWrite=function(A){this.decoder||this.initializeWasmDecoder();for(var t=0,i=0;i>2)),g=this.instance.heapU8.subarray(e,e+(this.codedSize>>2));this.destination.render(s,o,g,!1)}this.advanceDecodedTime(1/this.frameRate);var I=S()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,I),!0},t}(J),x=function(A){function t(i){var e;(e=A.call(this,i)||this).onDecodeCallback=i.onAudioDecode;var s=i.audioBufferSize||131072,o=i.streaming?L.MODE.EVICT:L.MODE.EXPAND;e.bits=new L(s,o),e.left=new Float32Array(1152),e.right=new Float32Array(1152),e.sampleRate=44100,e.D=new Float32Array(1024),e.D.set(t.SYNTHESIS_WINDOW,0),e.D.set(t.SYNTHESIS_WINDOW,512),e.V=[new Float32Array(1024),new Float32Array(1024)],e.U=new Int32Array(32),e.VPos=0,e.allocation=[new Array(32),new Array(32)],e.scaleFactorInfo=[new Uint8Array(32),new Uint8Array(32)],e.scaleFactor=[new Array(32),new Array(32)],e.sample=[new Array(32),new Array(32)];for(var g=0;g<2;g++)for(var I=0;I<32;I++)e.scaleFactor[g][I]=[0,0,0],e.sample[g][I]=[0,0,0];return e}u(t,A);var i=t.prototype;return i.decode=function(){var A=S(),t=this.bits.index>>3;if(t>=this.bits.byteLength)return!1;var i=this.decodeFrame(this.left,this.right);if(this.bits.index=t+i<<3,!i)return!1;this.destination&&this.destination.play(this.sampleRate,this.left,this.right),this.advanceDecodedTime(this.left.length/this.sampleRate);var e=S()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,e),!0},i.getCurrentTime=function(){var A=this.destination?this.destination.enqueuedTime:0;return this.decodedTime-A},i.decodeFrame=function(A,i){var e=this.bits.read(11),s=this.bits.read(2),o=this.bits.read(2),g=!this.bits.read(1);if(e!==t.FRAME_SYNC||s!==t.VERSION.MPEG_1||o!==t.LAYER.II)return 0;var I=this.bits.read(4)-1;if(I>13)return 0;var a=this.bits.read(2),B=t.SAMPLE_RATE[a];if(3===a)return 0;s===t.VERSION.MPEG_2&&(a+=4,I+=14);var r=this.bits.read(1);this.bits.read(1);var C=this.bits.read(2),n=0;C===t.MODE.JOINT_STEREO?n=this.bits.read(2)+1<<2:(this.bits.skip(2),n=C===t.MODE.MONO?0:32),this.bits.skip(4),g&&this.bits.skip(16);var E=144e3*t.BIT_RATE[I]/(B=t.SAMPLE_RATE[a])+r|0,Q=0,h=0;if(s===t.VERSION.MPEG_2)Q=2,h=30;else{var d=C===t.MODE.MONO?0:1,c=t.QUANT_LUT_STEP_1[d][I];h=63&(Q=t.QUANT_LUT_STEP_2[c][a]),Q>>=6}n>h&&(n=h);for(var l=0;l>1),U=this.VPos%128>>1;U<1024;){for(var J=0;J<32;++J)this.U[J]+=this.D[L++]*this.V[N][U++];U+=96,L+=32}for(U=1120-U,L-=480;U<1024;){for(var T=0;T<32;++T)this.U[T]+=this.D[L++]*this.V[N][U++];U+=96,L+=32}for(var v=0===N?A:i,x=0;x<32;x++)v[R+x]=this.U[x]/2147418112}R+=32}}return this.sampleRate=B,E},i.readAllocation=function(A,i){var e=t.QUANT_LUT_STEP_3[i][A],s=t.QUANT_LUT_STEP4[15&e][this.bits.read(e>>4)];return s?t.QUANT_TAB[s-1]:0},i.readSamples=function(A,i,e){var s=this.allocation[A][i],o=this.scaleFactor[A][i][e],g=this.sample[A][i],I=0;if(s){if(63===o)o=0;else{var a=o/3|0;o=t.SCALEFACTOR_BASE[o%3]+(1<>1)>>a}var B=s.levels;s.group?(I=this.bits.read(s.bits),g[0]=I%B,I=I/B|0,g[1]=I%B,g[2]=I/B|0):(g[0]=this.bits.read(s.bits),g[1]=this.bits.read(s.bits),g[2]=this.bits.read(s.bits));var r=65536/(B+1)|0;I=((B=(B+1>>1)-1)-g[0])*r,g[0]=I*(o>>12)+(I*(4095&o)+2048>>12)>>12,I=(B-g[1])*r,g[1]=I*(o>>12)+(I*(4095&o)+2048>>12)>>12,I=(B-g[2])*r,g[2]=I*(o>>12)+(I*(4095&o)+2048>>12)>>12}else g[0]=g[1]=g[2]=0},t.MatrixTransform=function(A,t,i,e){var s,o,g,I,a,B,r,C,n,E,Q,h,d,c,l,u,w,p,D,m,f,y,R,k,b,S,G,F,M,q,N,L,U;s=A[0][t]+A[31][t],o=.500602998235*(A[0][t]-A[31][t]),g=A[1][t]+A[30][t],I=.505470959898*(A[1][t]-A[30][t]),a=A[2][t]+A[29][t],B=.515447309923*(A[2][t]-A[29][t]),r=A[3][t]+A[28][t],C=.53104259109*(A[3][t]-A[28][t]),n=A[4][t]+A[27][t],E=.553103896034*(A[4][t]-A[27][t]),Q=A[5][t]+A[26][t],h=.582934968206*(A[5][t]-A[26][t]),d=A[6][t]+A[25][t],c=.622504123036*(A[6][t]-A[25][t]),l=A[7][t]+A[24][t],u=.674808341455*(A[7][t]-A[24][t]),w=A[8][t]+A[23][t],p=.744536271002*(A[8][t]-A[23][t]),D=A[9][t]+A[22][t],m=.839349645416*(A[9][t]-A[22][t]),f=A[10][t]+A[21][t],y=.972568237862*(A[10][t]-A[21][t]),R=A[11][t]+A[20][t],k=1.16943993343*(A[11][t]-A[20][t]),b=A[12][t]+A[19][t],S=1.48416461631*(A[12][t]-A[19][t]),G=A[13][t]+A[18][t],F=2.05778100995*(A[13][t]-A[18][t]),M=A[14][t]+A[17][t],q=3.40760841847*(A[14][t]-A[17][t]),U=s+(N=A[15][t]+A[16][t]),N=.502419286188*(s-N),s=g+M,M=.52249861494*(g-M),g=a+G,G=.566944034816*(a-G),a=r+b,b=.64682178336*(r-b),r=n+R,R=.788154623451*(n-R),n=Q+f,f=1.06067768599*(Q-f),Q=d+D,D=1.72244709824*(d-D),d=l+w,w=5.10114861869*(l-w),l=U+d,d=.509795579104*(U-d),U=s+Q,s=.601344886935*(s-Q),Q=g+n,n=.899976223136*(g-n),g=a+r,r=2.56291544774*(a-r),a=l+g,l=.541196100146*(l-g),g=U+Q,Q=1.30656296488*(U-Q),U=a+g,a=.707106781187*(a-g),g=l+Q,g+=l=.707106781187*(l-Q),Q=d+r,d=.541196100146*(d-r),r=s+n,n=1.30656296488*(s-n),s=Q+r,r=.707106781187*(Q-r),Q=d+n,s+=Q+=d=.707106781187*(d-n),Q+=r,r+=d,n=N+w,N=.509795579104*(N-w),w=M+D,M=.601344886935*(M-D),D=G+f,f=.899976223136*(G-f),G=b+R,R=2.56291544774*(b-R),b=n+G,n=.541196100146*(n-G),G=w+D,D=1.30656296488*(w-D),w=b+G,G=.707106781187*(b-G),b=n+D,D=.707106781187*(n-D),n=N+R,N=.541196100146*(N-R),R=M+f,f=1.30656296488*(M-f),M=n+R,R=.707106781187*(n-R),n=N+f,w+=M+=n+=N=.707106781187*(N-f),M+=b+=D,b+=n+=R,n+=G,G+=R+=N,R+=D,D+=N,f=o+(L=10.1900081235*(A[15][t]-A[16][t])),o=.502419286188*(o-L),L=I+q,I=.52249861494*(I-q),q=B+F,F=.566944034816*(B-F),B=C+S,C=.64682178336*(C-S),S=E+k,E=.788154623451*(E-k),k=h+y,y=1.06067768599*(h-y),h=c+m,m=1.72244709824*(c-m),c=u+p,u=5.10114861869*(u-p),p=f+c,c=.509795579104*(f-c),f=L+h,L=.601344886935*(L-h),h=q+k,k=.899976223136*(q-k),q=B+S,S=2.56291544774*(B-S),B=p+q,p=.541196100146*(p-q),q=f+h,h=1.30656296488*(f-h),f=B+q,q=.707106781187*(B-q),B=p+h,h=.707106781187*(p-h),p=c+S,S=.541196100146*(c-S),c=L+k,k=1.30656296488*(L-k),L=p+c,c=.707106781187*(p-c),p=S+k,L+=p+=k=.707106781187*(S-k),p+=c,S=c+k,c=o+u,o=.509795579104*(o-u),u=I+m,I=.601344886935*(I-m),m=F+y,y=.899976223136*(F-y),F=C+E,E=2.56291544774*(C-E),C=c+F,c=.541196100146*(c-F),F=u+m,m=1.30656296488*(u-m),u=C+F,F=.707106781187*(C-F),C=c+m,m=.707106781187*(c-m),c=o+E,o=.541196100146*(o-E),E=I+y,y=1.30656296488*(I-y),I=c+E,E=.707106781187*(c-E),c=o+y,f+=u+=I+=c+=o=.707106781187*(o-y),u+=L,L+=I+=C+=m,I+=B+=h,B+=C+=c+=E,C+=p,p+=c+=F,c+=q,q+=F+=E+=o,F+=S,S+=E+=m,E+=h,h+=m+=o,m+=k,k+=o,i[e+48]=-U,i[e+49]=i[e+47]=-f,i[e+50]=i[e+46]=-w,i[e+51]=i[e+45]=-u,i[e+52]=i[e+44]=-s,i[e+53]=i[e+43]=-L,i[e+54]=i[e+42]=-M,i[e+55]=i[e+41]=-I,i[e+56]=i[e+40]=-g,i[e+57]=i[e+39]=-B,i[e+58]=i[e+38]=-b,i[e+59]=i[e+37]=-C,i[e+60]=i[e+36]=-Q,i[e+61]=i[e+35]=-p,i[e+62]=i[e+34]=-n,i[e+63]=i[e+33]=-c,i[e+32]=-a,i[e+0]=a,i[e+31]=-q,i[e+1]=q,i[e+30]=-G,i[e+2]=G,i[e+29]=-F,i[e+3]=F,i[e+28]=-r,i[e+4]=r,i[e+27]=-S,i[e+5]=S,i[e+26]=-R,i[e+6]=R,i[e+25]=-E,i[e+7]=E,i[e+24]=-l,i[e+8]=l,i[e+23]=-h,i[e+9]=h,i[e+22]=-D,i[e+10]=D,i[e+21]=-m,i[e+11]=m,i[e+20]=-d,i[e+12]=d,i[e+19]=-k,i[e+13]=k,i[e+18]=-N,i[e+14]=N,i[e+17]=-o,i[e+15]=o,i[e+16]=0},t}(J);x.FRAME_SYNC=2047,x.VERSION={MPEG_2_5:0,MPEG_2:2,MPEG_1:3},x.LAYER={III:1,II:2,I:3},x.MODE={STEREO:0,JOINT_STEREO:1,DUAL_CHANNEL:2,MONO:3},x.SAMPLE_RATE=new Uint16Array([44100,48e3,32e3,0,22050,24e3,16e3,0]),x.BIT_RATE=new Uint16Array([32,48,56,64,80,96,112,128,160,192,224,256,320,384,8,16,24,32,40,48,56,64,80,96,112,128,144,160]),x.SCALEFACTOR_BASE=new Uint32Array([33554432,26632170,21137968]),x.SYNTHESIS_WINDOW=new Float32Array([0,-.5,-.5,-.5,-.5,-.5,-.5,-1,-1,-1,-1,-1.5,-1.5,-2,-2,-2.5,-2.5,-3,-3.5,-3.5,-4,-4.5,-5,-5.5,-6.5,-7,-8,-8.5,-9.5,-10.5,-12,-13,-14.5,-15.5,-17.5,-19,-20.5,-22.5,-24.5,-26.5,-29,-31.5,-34,-36.5,-39.5,-42.5,-45.5,-48.5,-52,-55.5,-58.5,-62.5,-66,-69.5,-73.5,-77,-80.5,-84.5,-88,-91.5,-95,-98,-101,-104,106.5,109,111,112.5,113.5,114,114,113.5,112,110.5,107.5,104,100,94.5,88.5,81.5,73,63.5,53,41.5,28.5,14.5,-1,-18,-36,-55.5,-76.5,-98.5,-122,-147,-173.5,-200.5,-229.5,-259.5,-290.5,-322.5,-355.5,-389.5,-424,-459.5,-495.5,-532,-568.5,-605,-641.5,-678,-714,-749,-783.5,-817,-849,-879.5,-908.5,-935,-959.5,-981,-1000.5,-1016,-1028.5,-1037.5,-1042.5,-1043.5,-1040,-1031.5,1018.5,1e3,976,946.5,911,869.5,822,767.5,707,640,565.5,485,397,302.5,201,92.5,-22.5,-144,-272.5,-407,-547.5,-694,-846,-1003,-1165,-1331.5,-1502,-1675.5,-1852.5,-2031.5,-2212.5,-2394,-2576.5,-2758.5,-2939.5,-3118.5,-3294.5,-3467.5,-3635.5,-3798.5,-3955,-4104.5,-4245.5,-4377.5,-4499,-4609.5,-4708,-4792.5,-4863.5,-4919,-4958,-4979.5,-4983,-4967.5,-4931.5,-4875,-4796,-4694.5,-4569.5,-4420,-4246,-4046,-3820,-3567,3287,2979.5,2644,2280.5,1888,1467.5,1018.5,541,35,-499,-1061,-1650,-2266.5,-2909,-3577,-4270,-4987.5,-5727.5,-6490,-7274,-8077.5,-8899.5,-9739,-10594.5,-11464.5,-12347,-13241,-14144.5,-15056,-15973.5,-16895.5,-17820,-18744.5,-19668,-20588,-21503,-22410.5,-23308.5,-24195,-25068.5,-25926.5,-26767,-27589,-28389,-29166.5,-29919,-30644.5,-31342,-32009.5,-32645,-33247,-33814.5,-34346,-34839.5,-35295,-35710,-36084.5,-36417.5,-36707.5,-36954,-37156.5,-37315,-37428,-37496,37519,37496,37428,37315,37156.5,36954,36707.5,36417.5,36084.5,35710,35295,34839.5,34346,33814.5,33247,32645,32009.5,31342,30644.5,29919,29166.5,28389,27589,26767,25926.5,25068.5,24195,23308.5,22410.5,21503,20588,19668,18744.5,17820,16895.5,15973.5,15056,14144.5,13241,12347,11464.5,10594.5,9739,8899.5,8077.5,7274,6490,5727.5,4987.5,4270,3577,2909,2266.5,1650,1061,499,-35,-541,-1018.5,-1467.5,-1888,-2280.5,-2644,-2979.5,3287,3567,3820,4046,4246,4420,4569.5,4694.5,4796,4875,4931.5,4967.5,4983,4979.5,4958,4919,4863.5,4792.5,4708,4609.5,4499,4377.5,4245.5,4104.5,3955,3798.5,3635.5,3467.5,3294.5,3118.5,2939.5,2758.5,2576.5,2394,2212.5,2031.5,1852.5,1675.5,1502,1331.5,1165,1003,846,694,547.5,407,272.5,144,22.5,-92.5,-201,-302.5,-397,-485,-565.5,-640,-707,-767.5,-822,-869.5,-911,-946.5,-976,-1e3,1018.5,1031.5,1040,1043.5,1042.5,1037.5,1028.5,1016,1000.5,981,959.5,935,908.5,879.5,849,817,783.5,749,714,678,641.5,605,568.5,532,495.5,459.5,424,389.5,355.5,322.5,290.5,259.5,229.5,200.5,173.5,147,122,98.5,76.5,55.5,36,18,1,-14.5,-28.5,-41.5,-53,-63.5,-73,-81.5,-88.5,-94.5,-100,-104,-107.5,-110.5,-112,-113.5,-114,-114,-113.5,-112.5,-111,-109,106.5,104,101,98,95,91.5,88,84.5,80.5,77,73.5,69.5,66,62.5,58.5,55.5,52,48.5,45.5,42.5,39.5,36.5,34,31.5,29,26.5,24.5,22.5,20.5,19,17.5,15.5,14.5,13,12,10.5,9.5,8.5,8,7,6.5,5.5,5,4.5,4,3.5,3.5,3,2.5,2.5,2,2,1.5,1.5,1,1,1,1,.5,.5,.5,.5,.5,.5]),x.QUANT_LUT_STEP_1=[[0,0,1,1,1,2,2,2,2,2,2,2,2,2],[0,0,0,0,0,0,1,1,1,2,2,2,2,2]],x.QUANT_TAB={A:91,B:94,C:8,D:12},x.QUANT_LUT_STEP_2=[[x.QUANT_TAB.C,x.QUANT_TAB.C,x.QUANT_TAB.D],[x.QUANT_TAB.A,x.QUANT_TAB.A,x.QUANT_TAB.A],[x.QUANT_TAB.B,x.QUANT_TAB.A,x.QUANT_TAB.B]],x.QUANT_LUT_STEP_3=[[68,68,52,52,52,52,52,52,52,52,52,52],[67,67,67,66,66,66,66,66,66,66,66,49,49,49,49,49,49,49,49,49,49,49,49,32,32,32,32,32,32,32],[69,69,69,69,52,52,52,52,52,52,52,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36]],x.QUANT_LUT_STEP4=[[0,1,2,17],[0,1,2,3,4,5,6,17],[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17],[0,1,3,5,6,7,8,9,10,11,12,13,14,15,16,17],[0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,17],[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]],x.QUANT_TAB=[{levels:3,group:1,bits:5},{levels:5,group:1,bits:7},{levels:7,group:0,bits:3},{levels:9,group:1,bits:10},{levels:15,group:0,bits:4},{levels:31,group:0,bits:5},{levels:63,group:0,bits:6},{levels:127,group:0,bits:7},{levels:255,group:0,bits:8},{levels:511,group:0,bits:9},{levels:1023,group:0,bits:10},{levels:2047,group:0,bits:11},{levels:4095,group:0,bits:12},{levels:8191,group:0,bits:13},{levels:16383,group:0,bits:14},{levels:32767,group:0,bits:15},{levels:65535,group:0,bits:16}];var Y=function(A){function t(t){var i;return(i=A.call(this,t)||this).onDecodeCallback=t.onAudioDecode,i.module=t.wasmModule,i.bufferSize=t.audioBufferSize||131072,i.bufferMode=t.streaming?L.MODE.EVICT:L.MODE.EXPAND,i.sampleRate=0,i}u(t,A);var i=t.prototype;return i.initializeWasmDecoder=function(){this.module.instance?(this.instance=this.module.instance,this.functions=this.module.instance.exports,this.decoder=this.functions._mp2_decoder_create(this.bufferSize,this.bufferMode)):console.warn("JSMpeg: WASM module not compiled yet")},i.destroy=function(){this.decoder&&this.functions._mp2_decoder_destroy(this.decoder)},i.bufferGetIndex=function(){if(this.decoder)return this.functions._mp2_decoder_get_index(this.decoder)},i.bufferSetIndex=function(A){this.decoder&&this.functions._mp2_decoder_set_index(this.decoder,A)},i.bufferWrite=function(A){this.decoder||this.initializeWasmDecoder();for(var t=0,i=0;i>4<<4;this.gl.viewport(0,0,i,this.height)},t.createTexture=function(A,t){var i=this.gl,e=i.createTexture();return i.bindTexture(i.TEXTURE_2D,e),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.uniform1i(i.getUniformLocation(this.program,t),A),e},t.createProgram=function(A,t){var i=this.gl,e=i.createProgram();return i.attachShader(e,this.compileShader(i.VERTEX_SHADER,A)),i.attachShader(e,this.compileShader(i.FRAGMENT_SHADER,t)),i.linkProgram(e),i.useProgram(e),e},t.compileShader=function(A,t){var i=this.gl,e=i.createShader(A);if(i.shaderSource(e,t),i.compileShader(e),!i.getShaderParameter(e,i.COMPILE_STATUS))throw new Error(i.getShaderInfoLog(e));return e},t.allowsClampedTextureData=function(){var A=this.gl,t=A.createTexture();return A.bindTexture(A.TEXTURE_2D,t),A.texImage2D(A.TEXTURE_2D,0,A.LUMINANCE,1,1,0,A.LUMINANCE,A.UNSIGNED_BYTE,new Uint8ClampedArray([0])),0===A.getError()},t.renderProgress=function(A){var t=this.gl;t.useProgram(this.loadingProgram);var i=t.getUniformLocation(this.loadingProgram,"progress");t.uniform1f(i,A),t.drawArrays(t.TRIANGLE_STRIP,0,4)},t.render=function(A,t,i,e){if(this.enabled){var s=this.gl,o=this.width+15>>4<<4,g=this.height,I=o>>1,a=g>>1;e&&this.shouldCreateUnclampedViews&&(A=new Uint8Array(A.buffer),t=new Uint8Array(t.buffer),i=new Uint8Array(i.buffer)),s.useProgram(this.program),this.updateTexture(s.TEXTURE0,this.textureY,o,g,A),this.updateTexture(s.TEXTURE1,this.textureCb,I,a,t),this.updateTexture(s.TEXTURE2,this.textureCr,I,a,i),s.drawArrays(s.TRIANGLE_STRIP,0,4)}},t.updateTexture=function(A,t,i,e,s){var o=this.gl;o.activeTexture(A),o.bindTexture(o.TEXTURE_2D,t),this.hasTextureData[A]?o.texSubImage2D(o.TEXTURE_2D,0,0,0,i,e,o.LUMINANCE,o.UNSIGNED_BYTE,s):(this.hasTextureData[A]=!0,o.texImage2D(o.TEXTURE_2D,0,o.LUMINANCE,i,e,0,o.LUMINANCE,o.UNSIGNED_BYTE,s))},t.deleteTexture=function(A,t){var i=this.gl;i.activeTexture(A),i.bindTexture(i.TEXTURE_2D,null),i.deleteTexture(t)},A.IsSupported=function(){try{if(!window.WebGLRenderingContext)return!1;var A=document.createElement("canvas");return!(!A.getContext("webgl")&&!A.getContext("experimental-webgl"))}catch(A){return!1}},A}();H.SHADER={FRAGMENT_YCRCB_TO_RGBA:["precision mediump float;","uniform sampler2D textureY;","uniform sampler2D textureCb;","uniform sampler2D textureCr;","varying vec2 texCoord;","mat4 rec601 = mat4(","1.16438, 0.00000, 1.59603, -0.87079,","1.16438, -0.39176, -0.81297, 0.52959,","1.16438, 2.01723, 0.00000, -1.08139,","0, 0, 0, 1",");","void main() {","float y = texture2D(textureY, texCoord).r;","float cb = texture2D(textureCb, texCoord).r;","float cr = texture2D(textureCr, texCoord).r;","gl_FragColor = vec4(y, cr, cb, 1.0) * rec601;","}"].join("\n"),FRAGMENT_LOADING:["precision mediump float;","uniform float progress;","varying vec2 texCoord;","void main() {","float c = ceil(progress-(1.0-texCoord.y));","gl_FragColor = vec4(c,c,c,1);","}"].join("\n"),VERTEX_IDENTITY:["attribute vec2 vertex;","varying vec2 texCoord;","void main() {","texCoord = vertex;","gl_Position = vec4((vertex * 2.0 - 1.0) * vec2(1, -1), 0.0, 1.0);","}"].join("\n")};var P=function(){function A(A){A.canvas?(this.canvas=A.canvas,this.ownsCanvasElement=!1):(this.canvas=document.createElement("canvas"),this.ownsCanvasElement=!0),this.width=this.canvas.width,this.height=this.canvas.height,this.enabled=!0,this.context=this.canvas.getContext("2d")}var t=A.prototype;return t.destroy=function(){this.ownsCanvasElement&&this.canvas.remove()},t.resize=function(A,t){this.width=0|A,this.height=0|t,this.canvas.width=this.width,this.canvas.height=this.height,this.imageData=this.context.getImageData(0,0,this.width,this.height),G(this.imageData.data,255)},t.renderProgress=function(A){var t=this.canvas.width,i=this.canvas.height,e=this.context;e.fillStyle="#222",e.fillRect(0,0,t,i),e.fillStyle="#fff",e.fillRect(0,i-i*A,t,i*A)},t.render=function(A,t,i){this.YCbCrToRGBA(A,t,i,this.imageData.data),this.context.putImageData(this.imageData,0,0)},t.YCbCrToRGBA=function(A,t,i,e){if(this.enabled)for(var s,o,g,I,a,B=this.width+15>>4<<4,r=B>>1,C=0,n=B,E=B+(B-this.width),Q=0,h=r-(this.width>>1),d=0,c=4*this.width,l=4*this.width,u=this.width>>1,w=this.height>>1,p=0;p>8)-179,I=(88*o>>8)-44+(183*s>>8)-91,a=o+(198*o>>8)-227;var m=A[C++],f=A[C++];e[d]=m+g,e[d+1]=m-I,e[d+2]=m+a,e[d+4]=f+g,e[d+5]=f-I,e[d+6]=f+a,d+=8;var y=A[n++],R=A[n++];e[c]=y+g,e[c+1]=y-I,e[c+2]=y+a,e[c+4]=R+g,e[c+5]=R-I,e[c+6]=R+a,c+=8}C+=E,n+=E,d+=l,c+=l,Q+=h}},A}(),O=function(){function A(){this.context=A.CachedContext=A.CachedContext||new(window.AudioContext||window.webkitAudioContext),this.gain=this.context.createGain(),this.destination=this.gain,this.gain.connect(this.context.destination),this.context._connections=(this.context._connections||0)+1,this.startTime=0,this.buffer=null,this.wallclockStartTime=0,this.volume=1,this.enabled=!0,this.unlocked=!A.NeedsUnlocking(),Object.defineProperty(this,"enqueuedTime",{get:this.getEnqueuedTime})}var t=A.prototype;return t.destroy=function(){this.gain.disconnect(),this.context._connections--,0===this.context._connections&&(this.context.close(),A.CachedContext=null)},t.play=function(A,t,i){if(this.enabled){if(!this.unlocked){var e=S();return this.wallclockStartTimethis.memory.buffer.byteLength){var i=this.brk-this.memory.buffer.byteLength,e=Math.ceil(i/this.pageSize);this.memory.grow(e),this.createHeapViews()}return t},t.c_abort=function(A){console.warn("JSMPeg: WASM abort",arguments)},t.c_assertFail=function(A){console.warn("JSMPeg: WASM ___assert_fail",arguments)},t.readDylinkSection=function(A){var t=new Uint8Array(A),i=0,e=function(){for(var A=0,e=1;;){var s=t[i++];if(A+=(127&s)*e,e*=128,!(128&s))return A}},s=function(A){for(var e=0;ethis.maxAudioLag&&(this.audioOut.resetEnqueuedTime(),this.audioOut.enabled=!1),A=this.audio.decode()}while(A);this.audioOut.enabled=!0}},t.updateForStaticFile=function(){var A=!1,t=0;if(this.audio&&this.audio.canPlay){for(;!A&&this.audio.decodedTime-this.audio.currentTime<.25;)A=!this.audio.decode();this.video&&this.video.currentTime0&&(e>2*s&&(this.startTime+=e),A=!this.video.decode()),t=this.demuxer.currentTime-i}this.source.resume(t),A&&this.source.completed?this.loop?this.seek(0):(this.stop(),this.options.onEnded&&this.options.onEnded(this)):A&&this.options.onStalled&&this.options.onStalled(this)},A}(),W={Player:X,VideoElement:b,BitBuffer:L,Source:{Ajax:M,AjaxProgressive:q,WebSocket:N,Fetch:function(){function A(A,t){this.url=A,this.destination=null,this.request=null,this.streaming=!0,this.completed=!1,this.established=!1,this.progress=0,this.aborted=!1,this.onEstablishedCallback=t.onSourceEstablished,this.onCompletedCallback=t.onSourceCompleted,t.hookOnEstablished&&(this.hookOnEstablished=t.hookOnEstablished)}var t=A.prototype;return t.connect=function(A){this.destination=A},t.start=function(){var A=this,t={method:"GET",headers:new Headers,cache:"default"};self.fetch(this.url,t).then((function(t){if(t.ok&&t.status>=200&&t.status<=299)return A.progress=1,A.established=!0,A.pump(t.body.getReader())})).catch((function(A){throw A}))},t.pump=function(A){var t=this;return A.read().then((function(i){if(!i.done)return t.aborted?A.cancel():(t.destination&&t.destination.write(i.value.buffer),t.pump(A));t.completed=!0})).catch((function(A){throw A}))},t.resume=function(){},t.abort=function(){this.aborted=!0},A}()},Demuxer:{TS:U},Decoder:{Base:J,MPEG1Video:T,MPEG1VideoWASM:v,MP2Audio:x,MP2AudioWASM:Y},Renderer:{WebGL:H,Canvas2D:P},AudioOutput:{WebAudio:O},WASMModule:K,Now:S,CreateVideoElements:function(){for(var A=document.querySelectorAll(".jsmpeg"),t=0;tthis.q=A))}resume(){this.q?.(),this.Z=this.q=void 0}} +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const V=A=>!e(A)&&"function"==typeof A.then,z=1073741823;const $=A(class extends t{constructor(){super(...arguments),this._$Cwt=z,this._$Cbt=[],this._$CK=new Z(this),this._$CX=new j}render(...A){return A.find((A=>!V(A)))??i}update(A,t){const e=this._$Cbt;let s=e.length;this._$Cbt=t;const o=this._$CK,g=this._$CX;this.isConnected||this.disconnected();for(let A=0;Athis._$Cwt);A++){const i=t[A];if(!V(i))return this._$Cwt=A,i;A{for(;g.get();)await g.get();const t=o.deref();if(void 0!==t){const e=t._$Cbt.indexOf(i);e>-1&&e{let i=!1;const e=new W.VideoElement(this,A,{canvas:this._jsmpegCanvasElement},{pauseWhenHidden:!1,autoplay:!1,protocols:[],audio:!1,videoBufferSize:4194304,preserveDrawingBuffer:!0,...this.cameraConfig?.jsmpeg?.options,reconnectInterval:0,onVideoDecode:()=>{!i&&this._jsmpegCanvasElement&&(i=!0,t(e))},onPlay:()=>g(this),onPause:()=>I(this)})})),this._jsmpegCanvasElement&&a(this,this._jsmpegCanvasElement,{player:this,capabilities:{supportsPause:!0},technology:["jsmpeg"]})}_resetPlayer(){if(this._refreshPlayerTimer.stop(),this._jsmpegVideoPlayer){try{this._jsmpegVideoPlayer.destroy()}catch(A){}this._jsmpegVideoPlayer=void 0}this._jsmpegCanvasElement&&(this._jsmpegCanvasElement.remove(),this._jsmpegCanvasElement=void 0)}connectedCallback(){super.connectedCallback(),this.isConnected&&this.requestUpdate()}disconnectedCallback(){this.isConnected||this._resetPlayer(),super.disconnectedCallback()}async _refreshPlayer(){if(!this.hass)return;this._resetPlayer(),this._jsmpegCanvasElement=document.createElement("canvas"),this._jsmpegCanvasElement.className="media";const A=this.cameraEndpoints?.jsmpeg;if(!A)return B(this,r("error.live_camera_no_endpoint"),{context:this.cameraConfig});const t=await c(this,this.hass,A,86400);t&&(await this._createJSMPEGPlayer(t),this._refreshPlayerTimer.start(82800,(()=>this.requestUpdate())))}render(){return C`${$((async()=>(await this._refreshPlayer(),this._jsmpegVideoPlayer&&this._jsmpegCanvasElement?C`${this._jsmpegCanvasElement}`:B(this,r("error.jsmpeg_no_player"))))(),n({cardWideConfig:this.cardWideConfig}))}`}static get styles(){return E(":host {\n width: 100%;\n height: 100%;\n display: flex;\n}\n\ncanvas {\n display: block;\n width: 100%;\n height: 100%;\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}")}};Q([h({attribute:!1})],AA.prototype,"cameraConfig",void 0),Q([h({attribute:!1})],AA.prototype,"cameraEndpoints",void 0),Q([h({attribute:!1})],AA.prototype,"cardWideConfig",void 0),AA=Q([d("frigate-card-live-jsmpeg")],AA);export{AA as FrigateCardLiveJSMPEG}; diff --git a/config/www/community/frigate-hass-card/jsmpeg-66c8006d.js.gz b/config/www/community/frigate-hass-card/jsmpeg-66c8006d.js.gz new file mode 100644 index 00000000..e3701dcb Binary files /dev/null and b/config/www/community/frigate-hass-card/jsmpeg-66c8006d.js.gz differ diff --git a/config/www/community/frigate-hass-card/jsmpeg-ef28408a.js b/config/www/community/frigate-hass-card/jsmpeg-ef28408a.js new file mode 100644 index 00000000..da0f3038 --- /dev/null +++ b/config/www/community/frigate-hass-card/jsmpeg-ef28408a.js @@ -0,0 +1,12 @@ +import{cL as A,eN as t,dC as i,eO as e,a as s,dD as o,dy as g,dz as I,dw as a,cQ as B,l as r,x as C,dl as n,r as E,_ as Q,n as h,t as d}from"./card-769e2b91.js";import{g as c}from"./endpoint-9c79ab63.js";function l(){return l=Object.assign?Object.assign.bind():function(A){for(var t=1;t"string"==typeof A&&A.constructor===String,D=function(A){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t=A,"Promise"===Object.prototype.toString.call(t).slice(8,-1)?A:new Promise((t=>{A(),setTimeout(t,i)}))};var m="WJ3NAvwFY9",f="tR2-0dd-e1",y="ZgIIHVSSYI",R="kAA8SjbHe2",k="OueN4AU4CJ";!function(A,t){void 0===t&&(t={});var i=t.insertAt;if(A&&"undefined"!=typeof document){var e=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css","top"===i&&e.firstChild?e.insertBefore(s,e.firstChild):e.appendChild(s),s.styleSheet?s.styleSheet.cssText=A:s.appendChild(document.createTextNode(A))}}(".WJ3NAvwFY9,.ZgIIHVSSYI,.kAA8SjbHe2,.tR2-0dd-e1{height:100%;left:0;position:absolute;top:0;width:100%;z-index:1}.ZgIIHVSSYI{-ms-flex-pack:center;-ms-flex-align:center;-webkit-align-items:center;align-items:center;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-justify-content:center;justify-content:center}.WJ3NAvwFY9,.tR2-0dd-e1{display:block}.tR2-0dd-e1.OueN4AU4CJ{display:none}.ZgIIHVSSYI,.kAA8SjbHe2{-webkit-tap-highlight-color:rgba(255,0,0,0);cursor:pointer;opacity:.7}.OueN4AU4CJ.ZgIIHVSSYI,.OueN4AU4CJ.kAA8SjbHe2{display:none}.ZgIIHVSSYI{z-index:10}.ZgIIHVSSYI>svg{fill:#fff;height:12vw;max-height:60px;max-width:60px;width:12vw}.kAA8SjbHe2{-ms-flex-pack:end;-ms-flex-align:end;-webkit-align-items:flex-end;align-items:flex-end;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-justify-content:flex-end;justify-content:flex-end;z-index:10}.kAA8SjbHe2>svg{fill:#fff;height:9vw;margin:0 15px 15px 0;max-height:40px;max-width:40px;width:9vw}");var b=function(){function A(A,t,i,e){var s=void 0===i?{}:i,o=s.canvas,g=void 0===o?"":o,I=s.poster,a=void 0===I?"":I,B=s.autoplay,r=void 0!==B&&B,C=s.autoSetWrapperSize,n=void 0!==C&&C,E=s.loop,Q=void 0!==E&&E,h=s.control,d=void 0===h||h,c=s.decodeFirstFrame,u=void 0===c||c,w=s.picMode,D=void 0!==w&&w,m=s.progressive,f=void 0===m||m,y=s.chunkSize,R=void 0===y?1048576:y,k=s.hooks,b=void 0===k?{}:k;void 0===e&&(e={}),this.options=l({videoUrl:t,canvas:g,poster:a,picMode:D,autoplay:r,autoSetWrapperSize:n,loop:Q,control:d,decodeFirstFrame:u,progressive:f,chunkSize:R,hooks:l({play:function(){},pause:function(){},stop:function(){},load:function(){}},b)},e),this.options.needPlayButton=this.options.control&&!this.options.picMode,this.player=null,this.els={wrapper:p(A)?document.querySelector(A):A,canvas:null,playButton:document.createElement("div"),unmuteButton:null,poster:null},"static"===window.getComputedStyle(this.els.wrapper).getPropertyValue("position")&&(this.els.wrapper.style.position="relative"),this.els.wrapper.clientRect=this.els.wrapper.getBoundingClientRect(),this.initCanvas(),this.initPlayButton(),this.initPlayer()}var t=A.prototype;return t.initCanvas=function(){this.options.canvas?this.els.canvas=p(this.options.canvas)?document.querySelector(this.options.canvas):this.options.canvas:(this.els.canvas=document.createElement("canvas"),this.els.canvas.classList.add(m),this.els.wrapper.appendChild(this.els.canvas))},t.initPlayer=function(){var A=this;this.options=l(this.options,{canvas:this.els.canvas});var t=l({},this.options,{autoplay:!1});if(this.player=new X(this.options.videoUrl,t,{play:function(){A.options.needPlayButton&&A.els.playButton.classList.add(k),A.els.poster&&A.els.poster.classList.add(k),A.options.hooks.play()},pause:function(){A.options.needPlayButton&&A.els.playButton.classList.remove(k),A.options.hooks.pause()},stop:function(){A.els.poster&&A.els.poster.classList.remove(k),A.options.hooks.stop()},load:function(){A.options.autoplay&&A.play(),A._autoSetWrapperSize(),A.options.hooks.load()}}),this._copyPlayerFuncs(),this.els.wrapper.playerInstance=this.player,!this.options.poster||this.options.autoplay||this.player.options.streaming||(this.options.decodeFirstFrame=!1,this.els.poster=new Image,this.els.poster.src=this.options.poster,this.els.poster.classList.add(f),this.els.wrapper.appendChild(this.els.poster)),this.player.options.streaming||this.els.wrapper.addEventListener("click",this.onClick.bind(this)),(this.options.autoplay||this.player.options.streaming)&&this.els.playButton.classList.add(k),this.player.audioOut&&!this.player.audioOut.unlocked){var i=this.els.wrapper;(this.options.autoplay||this.player.options.streaming)&&(this.els.unmuteButton=document.createElement("div"),this.els.unmuteButton.innerHTML='\n\n \n\n',this.els.unmuteButton.classList.add(R),this.els.wrapper.appendChild(this.els.unmuteButton),i=this.els.unmuteButton),this.unlockAudioBound=this.onUnlockAudio.bind(this,i),i.addEventListener("touchstart",this.unlockAudioBound,!1),i.addEventListener("click",this.unlockAudioBound,!0)}},t.initPlayButton=function(){this.options.needPlayButton&&(this.els.playButton.classList.add(y),this.els.playButton.innerHTML='\n\n \n\n',this.els.wrapper.appendChild(this.els.playButton))},t._autoSetWrapperSize=function(){var A=this;if(!this.options.autoSetWrapperSize)return Promise.resolve();var t=this.player.video.destination;return t?Promise.resolve().then((function(){return D((function(){A.els.wrapper.style.width=t.width+"px",A.els.wrapper.style.height=t.height+"px"}))})):Promise.resolve()},t.onUnlockAudio=function(A,t){var i=this;this.els.unmuteButton&&(t.preventDefault(),t.stopPropagation()),this.player.audioOut.unlock((function(){i.els.unmuteButton&&i.els.unmuteButton.classList.add(k),A.removeEventListener("touchstart",i.unlockAudioBound),A.removeEventListener("click",i.unlockAudioBound)}))},t.onClick=function(){this.options.control&&(this.player.isPlaying?this.pause():this.play())},t._copyPlayerFuncs=function(){var A=this;this.play=function(){return A.player.play()},this.pause=function(){return A.player.pause()},this.stop=function(){return A.player.stop()},this.destroy=function(){A.player.destroy(),A.els.wrapper.innerHTML="",A.els.wrapper.playerInstance=null}},A}(),S=function(){return window.performance?window.performance.now()/1e3:Date.now()/1e3},G=function(A,t){if(A.fill)A.fill(t);else for(var i=0;iA&&this.loadNextChunk())},t.destroy=function(){this.request.abort(),this.aborted=!0},t.loadNextChunk=function(){var A=this,t=this.loadedSize,i=Math.min(this.loadedSize+this.chunkSize-1,this.fileSize-1);if(t>=this.fileSize||this.aborted)return this.completed=!0,void(this.onCompletedCallback&&this.onCompletedCallback(this));this.isLoading=!0,this.loadStartTime=S(),this.request=new XMLHttpRequest,this.request.onreadystatechange=function(){A.request.readyState===A.request.DONE&&A.request.status>=200&&A.request.status<300?A.onChunkLoad(A.request.response):A.request.readyState===A.request.DONE&&A.loadFails++<3&&A.loadNextChunk()},0===t&&(this.request.onprogress=this.onProgress.bind(this)),this.request.open("GET",this.url+"?"+t+"-"+i),this.request.setRequestHeader("Range","bytes="+t+"-"+i),this.request.responseType="arraybuffer",this.request.send()},t.onProgress=function(A){this.progress=A.loaded/A.total},t.onChunkLoad=function(A){var t=!this.established;this.established=!0,this.progress=1,this.loadedSize+=A.byteLength,this.loadFails=0,this.isLoading=!1,t&&this.hookOnEstablished&&this.hookOnEstablished(),t&&this.onEstablishedCallback&&this.onEstablishedCallback(this),this.destination&&this.destination.write(A),this.loadTime=S()-this.loadStartTime,this.throttled||this.loadNextChunk()},A}(),N=function(){function A(A,t){this.url=A,this.options=t,this.socket=null,this.streaming=!0,this.callbacks={connect:[],data:[]},this.destination=null,this.reconnectInterval=void 0!==t.reconnectInterval?t.reconnectInterval:5,this.shouldAttemptReconnect=!!this.reconnectInterval,this.completed=!1,this.established=!1,this.progress=0,this.reconnectTimeoutId=0,this.onEstablishedCallback=t.onSourceEstablished,this.onCompletedCallback=t.onSourceCompleted,t.hookOnEstablished&&(this.hookOnEstablished=t.hookOnEstablished)}var t=A.prototype;return t.connect=function(A){this.destination=A},t.destroy=function(){clearTimeout(this.reconnectTimeoutId),this.shouldAttemptReconnect=!1,this.socket.close()},t.start=function(){this.shouldAttemptReconnect=!!this.reconnectInterval,this.progress=0,this.established=!1,this.options.protocols?this.socket=new WebSocket(this.url,this.options.protocols):this.socket=new WebSocket(this.url),this.socket.binaryType="arraybuffer",this.socket.onmessage=this.onMessage.bind(this),this.socket.onopen=this.onOpen.bind(this),this.socket.onerror=this.onClose.bind(this),this.socket.onclose=this.onClose.bind(this)},t.resume=function(){},t.onOpen=function(){this.progress=1},t.onClose=function(){var A=this;this.shouldAttemptReconnect&&(clearTimeout(this.reconnectTimeoutId),this.reconnectTimeoutId=setTimeout((function(){A.start()}),1e3*this.reconnectInterval))},t.onMessage=function(A){var t=!this.established;this.established=!0,t&&this.hookOnEstablished&&this.hookOnEstablished(),t&&this.onEstablishedCallback&&this.onEstablishedCallback(this),this.destination&&this.destination.write(A.data)},A}(),L=function(){function A(t,i){"object"==typeof t?(this.bytes=t instanceof Uint8Array?t:new Uint8Array(t),this.byteLength=this.bytes.length):(this.bytes=new Uint8Array(t||1048576),this.byteLength=0),this.mode=i||A.MODE.EXPAND,this.index=0}var t=A.prototype;return t.resize=function(A){var t=new Uint8Array(A);0!==this.byteLength&&(this.byteLength=Math.min(this.byteLength,A),t.set(this.bytes,0,this.byteLength)),this.bytes=t,this.index=Math.min(this.index,this.byteLength<<3)},t.evict=function(A){var t=this.index>>3,i=this.bytes.length-this.byteLength;if(this.index===this.byteLength<<3||A>i+t)return this.byteLength=0,void(this.index=0);0!==t&&(this.bytes.copyWithin?this.bytes.copyWithin(0,t,this.byteLength):this.bytes.set(this.bytes.subarray(t,this.byteLength)),this.byteLength-=t,this.index-=t<<3)},t.write=function(t){var i="object"==typeof t[0],e=0,s=this.bytes.length-this.byteLength;if(i){e=0;for(var o=0;os)if(this.mode===A.MODE.EXPAND){var g=Math.max(2*this.bytes.length,e-s);this.resize(g)}else this.evict(e);if(i)for(var I=0;I>3;A>3;return A>=this.byteLength||0===this.bytes[A]&&0===this.bytes[A+1]&&1===this.bytes[A+2]},t.peek=function(A){for(var t=this.index,i=0;A;){var e=8-(7&t),s=e>3]&255>>8-s<>o,t+=s,A-=s}return i},t.read=function(A){var t=this.peek(A);return this.index+=A,t},t.skip=function(A){return this.index+=A},t.rewind=function(A){this.index=Math.max(this.index-A,0)},t.has=function(A){return(this.byteLength<<3)-this.index>=A},A}();L.MODE={EVICT:1,EXPAND:2};var U=function(){function A(){this.bits=null,this.leftoverBytes=null,this.guessVideoFrameEnd=!0,this.pidsToStreamIds={},this.pesPacketInfo={},this.startTime=0,this.currentTime=0}var t=A.prototype;return t.connect=function(A,t){this.pesPacketInfo[A]={destination:t,currentLength:0,totalLength:0,pts:0,buffers:[]}},t.write=function(A){if(this.leftoverBytes){var t=A.byteLength+this.leftoverBytes.byteLength;this.bits=new L(t),this.bits.write([this.leftoverBytes,A])}else this.bits=new L(A);for(;this.bits.has(1504)&&this.parsePacket(););var i=this.bits.byteLength-(this.bits.index>>3);this.leftoverBytes=i>0?this.bits.bytes.subarray(this.bits.index>>3):null},t.parsePacket=function(){if(71!==this.bits.read(8)&&!this.resync())return!1;var A=187+(this.bits.index>>3);this.bits.read(1);var t=this.bits.read(1);this.bits.read(1);var i=this.bits.read(13);this.bits.read(2);var e=this.bits.read(2);this.bits.read(4);var s=this.pidsToStreamIds[i];if(t&&s){var o=this.pesPacketInfo[s];o&&o.currentLength&&this.packetComplete(o)}if(1&e){if(2&e){var g=this.bits.read(8);this.bits.skip(g<<3)}if(t&&this.bits.nextBytesAreStartCode()){this.bits.skip(24),s=this.bits.read(8),this.pidsToStreamIds[i]=s;var I=this.bits.read(16);this.bits.skip(8);var a=this.bits.read(2);this.bits.skip(6);var B=this.bits.read(8),r=this.bits.index+(B<<3),C=this.pesPacketInfo[s];if(C){var n=0;if(2&a){this.bits.skip(4);var E=this.bits.read(3);this.bits.skip(1);var Q=this.bits.read(15);this.bits.skip(1);var h=this.bits.read(15);this.bits.skip(1),n=(1073741824*E+32768*Q+h)/9e4,this.currentTime=n,-1===this.startTime&&(this.startTime=n)}var d=I?I-B-3:0;this.packetStart(C,n,d)}this.bits.index=r}if(s){var c=this.pesPacketInfo[s];if(c){var l=this.bits.index>>3,u=!t&&2&e;(this.packetAddData(c,l,A)||this.guessVideoFrameEnd&&u)&&this.packetComplete(c)}}}return this.bits.index=A<<3,!0},t.resync=function(){if(!this.bits.has(9024))return!1;for(var A=this.bits.index>>3,t=0;t<187;t++)if(71===this.bits.bytes[A+t]){for(var i=!0,e=1;e<5;e++)if(71!==this.bits.bytes[A+t+188*e]){i=!1;break}if(i)return this.bits.index=A+t+1<<3,!0}return console.warn("JSMpeg: Possible garbage data. Skipping."),this.bits.skip(1496),!1},t.packetStart=function(A,t,i){A.totalLength=i,A.currentLength=0,A.pts=t},t.packetAddData=function(A,t,i){return A.buffers.push(this.bits.bytes.subarray(t,i)),A.currentLength+=i-t,0!==A.totalLength&&A.currentLength>=A.totalLength},t.packetComplete=function(A){A.destination.write(A.pts,A.buffers),A.totalLength=0,A.currentLength=0,A.buffers=[]},A}();U.STREAM={PACK_HEADER:186,SYSTEM_HEADER:187,PROGRAM_MAP:188,PRIVATE_1:189,PADDING:190,PRIVATE_2:191,AUDIO_1:192,VIDEO_1:224,DIRECTORY:255};var J=function(){function A(A){this.destination=null,this.canPlay=!1,this.collectTimestamps=!A.streaming,this.bytesWritten=0,this.timestamps=[],this.timestampIndex=0,this.startTime=0,this.decodedTime=0,Object.defineProperty(this,"currentTime",{get:this.getCurrentTime})}var t=A.prototype;return t.destroy=function(){},t.connect=function(A){this.destination=A},t.bufferGetIndex=function(){return this.bits.index},t.bufferSetIndex=function(A){this.bits.index=A},t.bufferWrite=function(A){return this.bits.write(A)},t.write=function(A,t){this.collectTimestamps&&(0===this.timestamps.length&&(this.startTime=A,this.decodedTime=A),this.timestamps.push({index:this.bytesWritten<<3,time:A})),this.bytesWritten+=this.bufferWrite(t),this.canPlay=!0},t.seek=function(A){if(this.collectTimestamps){this.timestampIndex=0;for(var t=0;tA);t++)this.timestampIndex=t;var i=this.timestamps[this.timestampIndex];i?(this.bufferSetIndex(i.index),this.decodedTime=i.time):(this.bits.index=0,this.decodedTime=this.startTime)}},t.decode=function(){this.advanceDecodedTime(0)},t.advanceDecodedTime=function(A){if(this.collectTimestamps){for(var t=-1,i=this.bufferGetIndex(),e=this.timestampIndex;ei);e++)t=e;if(-1!==t&&t!==this.timestampIndex)return this.timestampIndex=t,void(this.decodedTime=this.timestamps[this.timestampIndex].time)}this.decodedTime+=A},t.getCurrentTime=function(){return this.decodedTime},A}(),T=function(A){function t(t){var i;(i=A.call(this,t)||this).onDecodeCallback=t.onVideoDecode;var e=t.videoBufferSize||524288,s=t.streaming?L.MODE.EVICT:L.MODE.EXPAND;return i.bits=new L(e,s),i.customIntraQuantMatrix=new Uint8Array(64),i.customNonIntraQuantMatrix=new Uint8Array(64),i.blockData=new Int32Array(64),i.currentFrame=0,i.decodeFirstFrame=!1!==t.decodeFirstFrame,i}u(t,A);var i=t.prototype;return i.write=function(A,i){if(J.prototype.write.call(this,A,i),!this.hasSequenceHeader){if(-1===this.bits.findStartCode(t.START.SEQUENCE))return!1;this.decodeSequenceHeader(),this.decodeFirstFrame&&this.decode()}},i.decode=function(){var A=S();if(!this.hasSequenceHeader)return!1;if(-1===this.bits.findStartCode(t.START.PICTURE))return!1;this.decodePicture(),this.advanceDecodedTime(1/this.frameRate);var i=S()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,i),!0},i.readHuffman=function(A){var t=0;do{t=A[t+this.bits.read(1)]}while(t>=0&&0!==A[t]);return A[t+2]},i.decodeSequenceHeader=function(){var A=this.bits.read(12),i=this.bits.read(12);if(this.bits.skip(4),this.frameRate=t.PICTURE_RATE[this.bits.read(4)],this.bits.skip(30),A===this.width&&i===this.height||(this.width=A,this.height=i,this.initBuffers(),this.destination&&this.destination.resize(A,i)),this.bits.read(1)){for(var e=0;e<64;e++)this.customIntraQuantMatrix[t.ZIG_ZAG[e]]=this.bits.read(8);this.intraQuantMatrix=this.customIntraQuantMatrix}if(this.bits.read(1)){for(var s=0;s<64;s++){var o=t.ZIG_ZAG[s];this.customNonIntraQuantMatrix[o]=this.bits.read(8)}this.nonIntraQuantMatrix=this.customNonIntraQuantMatrix}this.hasSequenceHeader=!0},i.initBuffers=function(){this.intraQuantMatrix=t.DEFAULT_INTRA_QUANT_MATRIX,this.nonIntraQuantMatrix=t.DEFAULT_NON_INTRA_QUANT_MATRIX,this.mbWidth=this.width+15>>4,this.mbHeight=this.height+15>>4,this.mbSize=this.mbWidth*this.mbHeight,this.codedWidth=this.mbWidth<<4,this.codedHeight=this.mbHeight<<4,this.codedSize=this.codedWidth*this.codedHeight,this.halfWidth=this.mbWidth<<3,this.halfHeight=this.mbHeight<<3,this.currentY=new Uint8ClampedArray(this.codedSize),this.currentY32=new Uint32Array(this.currentY.buffer),this.currentCr=new Uint8ClampedArray(this.codedSize>>2),this.currentCr32=new Uint32Array(this.currentCr.buffer),this.currentCb=new Uint8ClampedArray(this.codedSize>>2),this.currentCb32=new Uint32Array(this.currentCb.buffer),this.forwardY=new Uint8ClampedArray(this.codedSize),this.forwardY32=new Uint32Array(this.forwardY.buffer),this.forwardCr=new Uint8ClampedArray(this.codedSize>>2),this.forwardCr32=new Uint32Array(this.forwardCr.buffer),this.forwardCb=new Uint8ClampedArray(this.codedSize>>2),this.forwardCb32=new Uint32Array(this.forwardCb.buffer)},i.decodePicture=function(){if(this.currentFrame++,this.bits.skip(10),this.pictureType=this.bits.read(3),this.bits.skip(16),!(this.pictureType<=0||this.pictureType>=t.PICTURE_TYPE.B)){if(this.pictureType===t.PICTURE_TYPE.PREDICTIVE){if(this.fullPelForward=this.bits.read(1),this.forwardFCode=this.bits.read(3),0===this.forwardFCode)return;this.forwardRSize=this.forwardFCode-1,this.forwardF=1<=t.START.SLICE_FIRST&&A<=t.START.SLICE_LAST;)this.decodeSlice(255&A),A=this.bits.findNextStartCode();if(-1!==A&&this.bits.rewind(32),this.destination&&this.destination.render(this.currentY,this.currentCr,this.currentCb,!0),this.pictureType===t.PICTURE_TYPE.INTRA||this.pictureType===t.PICTURE_TYPE.PREDICTIVE){var i=this.forwardY,e=this.forwardY32,s=this.forwardCr,o=this.forwardCr32,g=this.forwardCb,I=this.forwardCb32;this.forwardY=this.currentY,this.forwardY32=this.currentY32,this.forwardCr=this.currentCr,this.forwardCr32=this.currentCr32,this.forwardCb=this.currentCb,this.forwardCb32=this.currentCb32,this.currentY=i,this.currentY32=e,this.currentCr=s,this.currentCr32=o,this.currentCb=g,this.currentCb32=I}}},i.decodeSlice=function(A){for(this.sliceBegin=!0,this.macroblockAddress=(A-1)*this.mbWidth-1,this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0,this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.quantizerScale=this.bits.read(5);this.bits.read(1);)this.bits.skip(8);do{this.decodeMacroblock()}while(!this.bits.nextBytesAreStartCode())},i.decodeMacroblock=function(){for(var A=0,i=this.readHuffman(t.MACROBLOCK_ADDRESS_INCREMENT);34===i;)i=this.readHuffman(t.MACROBLOCK_ADDRESS_INCREMENT);for(;35===i;)A+=33,i=this.readHuffman(t.MACROBLOCK_ADDRESS_INCREMENT);if(A+=i,this.sliceBegin)this.sliceBegin=!1,this.macroblockAddress+=A;else{if(this.macroblockAddress+A>=this.mbSize)return;for(A>1&&(this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.pictureType===t.PICTURE_TYPE.PREDICTIVE&&(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0));A>1;)this.macroblockAddress++,this.mbRow=this.macroblockAddress/this.mbWidth|0,this.mbCol=this.macroblockAddress%this.mbWidth,this.copyMacroblock(this.motionFwH,this.motionFwV,this.forwardY,this.forwardCr,this.forwardCb),A--;this.macroblockAddress++}this.mbRow=this.macroblockAddress/this.mbWidth|0,this.mbCol=this.macroblockAddress%this.mbWidth;var e=t.MACROBLOCK_TYPE[this.pictureType];this.macroblockType=this.readHuffman(e),this.macroblockIntra=1&this.macroblockType,this.macroblockMotFw=8&this.macroblockType,16&this.macroblockType&&(this.quantizerScale=this.bits.read(5)),this.macroblockIntra?(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0):(this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.decodeMotionVectors(),this.copyMacroblock(this.motionFwH,this.motionFwV,this.forwardY,this.forwardCr,this.forwardCb));for(var s=2&this.macroblockType?this.readHuffman(t.CODE_BLOCK_PATTERN):this.macroblockIntra?63:0,o=0,g=32;o<6;o++)s&g&&this.decodeBlock(o),g>>=1},i.decodeMotionVectors=function(){var A,i,e=0;this.macroblockMotFw?(0!==(A=this.readHuffman(t.MOTION))&&1!==this.forwardF?(e=this.bits.read(this.forwardRSize),i=(Math.abs(A)-1<(this.forwardF<<4)-1?this.motionFwHPrev-=this.forwardF<<5:this.motionFwHPrev<-this.forwardF<<4&&(this.motionFwHPrev+=this.forwardF<<5),this.motionFwH=this.motionFwHPrev,this.fullPelForward&&(this.motionFwH<<=1),0!==(A=this.readHuffman(t.MOTION))&&1!==this.forwardF?(e=this.bits.read(this.forwardRSize),i=(Math.abs(A)-1<(this.forwardF<<4)-1?this.motionFwVPrev-=this.forwardF<<5:this.motionFwVPrev<-this.forwardF<<4&&(this.motionFwVPrev+=this.forwardF<<5),this.motionFwV=this.motionFwVPrev,this.fullPelForward&&(this.motionFwV<<=1)):this.pictureType===t.PICTURE_TYPE.PREDICTIVE&&(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0)},i.copyMacroblock=function(A,t,i,e,s){var o,g,I,a,B,r,C,n,E,Q,h,d,c,l,u,w,p,D,m,f=this.currentY32,y=this.currentCb32,R=this.currentCr32;if(g=(o=this.codedWidth)-16,I=A>>1,a=t>>1,B=!(1&~A),r=!(1&~t),C=((this.mbRow<<4)+a)*o+(this.mbCol<<4)+I,E=(n=this.mbRow*o+this.mbCol<<2)+(o<<2),B)if(r)for(;n>2&255,c|=(h=i[++C]+i[C+o])+d+2<<6&65280,c|=h+(d=i[++C]+i[C+o])+2<<14&16711680,h=i[++C]+i[C+o],C++,c|=h+d+2<<22&4278190080,f[n++]=c;n+=g>>2,C+=g-1}else for(;n>1&255,c|=(h=i[C++])+d+1<<7&65280,c|=h+(d=i[C++])+1<<15&16711680,c|=(h=i[C++])+d+1<<23&4278190080,f[n++]=c;n+=g>>2,C+=g-1}else if(r)for(;n>1&255,c|=i[++C]+i[C+o]+1<<7&65280,c|=i[++C]+i[C+o]+1<<15&16711680,c|=i[++C]+i[C+o]+1<<23&4278190080,C++,f[n++]=c;n+=g>>2,C+=g}else for(;n>2,C+=g}if(g=(o=this.halfWidth)-8,I=A/2>>1,a=t/2>>1,B=1==(A/2&1),r=1==(t/2&1),C=((this.mbRow<<3)+a)*o+(this.mbCol<<3)+I,E=(n=this.mbRow*o+this.mbCol<<1)+(o<<1),B)if(r)for(;n>2&255,m=p+(D=s[C]+s[C+o])+2>>2&255,w|=(l=e[++C]+e[C+o])+u+2<<6&65280,m|=(p=s[C]+s[C+o])+D+2<<6&65280,w|=l+(u=e[++C]+e[C+o])+2<<14&16711680,m|=p+(D=s[C]+s[C+o])+2<<14&16711680,l=e[++C]+e[C+o],p=s[C]+s[C+o],C++,w|=l+u+2<<22&4278190080,m|=p+D+2<<22&4278190080,R[n]=w,y[n]=m,n++;n+=g>>2,C+=g-1}else for(;n>1&255,m=p+(D=s[C++])+1>>1&255,w|=(l=e[C])+u+1<<7&65280,m|=(p=s[C++])+D+1<<7&65280,w|=l+(u=e[C])+1<<15&16711680,m|=p+(D=s[C++])+1<<15&16711680,w|=(l=e[C])+u+1<<23&4278190080,m|=(p=s[C++])+D+1<<23&4278190080,R[n]=w,y[n]=m,n++;n+=g>>2,C+=g-1}else if(r)for(;n>1&255,m=s[C]+s[C+o]+1>>1&255,w|=e[++C]+e[C+o]+1<<7&65280,m|=s[C]+s[C+o]+1<<7&65280,w|=e[++C]+e[C+o]+1<<15&16711680,m|=s[C]+s[C+o]+1<<15&16711680,w|=e[++C]+e[C+o]+1<<23&4278190080,m|=s[C]+s[C+o]+1<<23&4278190080,C++,R[n]=w,y[n]=m,n++;n+=g>>2,C+=g}else for(;n>2,C+=g}},i.decodeBlock=function(A){var i,e=0;if(this.macroblockIntra){var s,o;if(A<4?(s=this.dcPredictorY,o=this.readHuffman(t.DCT_DC_SIZE_LUMINANCE)):(s=4===A?this.dcPredictorCr:this.dcPredictorCb,o=this.readHuffman(t.DCT_DC_SIZE_CHROMINANCE)),o>0){var g=this.bits.read(o);this.blockData[0]=g&1<0&&0===this.bits.read(1))break;65535===n?(C=this.bits.read(6),0===(r=this.bits.read(8))?r=this.bits.read(8):128===r?r=this.bits.read(8)-256:r>128&&(r-=256)):(C=n>>8,r=255&n,this.bits.read(1)&&(r=-r)),e+=C;var E=t.ZIG_ZAG[e];e++,r<<=1,this.macroblockIntra||(r+=r<0?-1:1),1&(r=r*this.quantizerScale*i[E]>>4)||(r-=r>0?1:-1),r>2047?r=2047:r<-2048&&(r=-2048),this.blockData[E]=r*t.PREMULTIPLIER_MATRIX[E]}A<4?(I=this.currentY,B=this.codedWidth-8,a=this.mbRow*this.codedWidth+this.mbCol<<4,1&A&&(a+=8),2&A&&(a+=this.codedWidth<<3)):(I=4===A?this.currentCb:this.currentCr,B=(this.codedWidth>>1)-8,a=(this.mbRow*this.codedWidth<<2)+(this.mbCol<<3)),this.macroblockIntra?1===e?(t.CopyValueToDestination(this.blockData[0]+128>>8,I,a,B),this.blockData[0]=0):(t.IDCT(this.blockData),t.CopyBlockToDestination(this.blockData,I,a,B),G(this.blockData,0)):1===e?(t.AddValueToDestination(this.blockData[0]+128>>8,I,a,B),this.blockData[0]=0):(t.IDCT(this.blockData),t.AddBlockToDestination(this.blockData,I,a,B),G(this.blockData,0)),e=0},t.CopyBlockToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]=A[s+0],t[i+1]=A[s+1],t[i+2]=A[s+2],t[i+3]=A[s+3],t[i+4]=A[s+4],t[i+5]=A[s+5],t[i+6]=A[s+6],t[i+7]=A[s+7]},t.AddBlockToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]+=A[s+0],t[i+1]+=A[s+1],t[i+2]+=A[s+2],t[i+3]+=A[s+3],t[i+4]+=A[s+4],t[i+5]+=A[s+5],t[i+6]+=A[s+6],t[i+7]+=A[s+7]},t.CopyValueToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]=A,t[i+1]=A,t[i+2]=A,t[i+3]=A,t[i+4]=A,t[i+5]=A,t[i+6]=A,t[i+7]=A},t.AddValueToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]+=A,t[i+1]+=A,t[i+2]+=A,t[i+3]+=A,t[i+4]+=A,t[i+5]+=A,t[i+6]+=A,t[i+7]+=A},t.IDCT=function(A){for(var t,i,e,s,o,g,I,a,B,r,C,n,E,Q,h,d,c,l,u=0;u<8;++u)t=A[32+u],i=A[16+u]+A[48+u],e=A[40+u]-A[24+u],g=A[8+u]+A[56+u],I=A[24+u]+A[40+u],B=(E=(473*(s=A[8+u]-A[56+u])-196*e+128>>8)-(o=g+I))-(362*(g-I)+128>>8),Q=(r=(a=A[0+u])-t)+(C=(362*(A[16+u]-A[48+u])+128>>8)-i),h=(n=a+t)+i,d=r-C,c=n-i,l=-B-(473*e+196*s+128>>8),A[0+u]=o+h,A[8+u]=E+Q,A[16+u]=d-B,A[24+u]=c-l,A[32+u]=c+l,A[40+u]=B+d,A[48+u]=Q-E,A[56+u]=h-o;for(var w=0;w<64;w+=8)t=A[4+w],i=A[2+w]+A[6+w],e=A[5+w]-A[3+w],g=A[1+w]+A[7+w],I=A[3+w]+A[5+w],B=(E=(473*(s=A[1+w]-A[7+w])-196*e+128>>8)-(o=g+I))-(362*(g-I)+128>>8),Q=(r=(a=A[0+w])-t)+(C=(362*(A[2+w]-A[6+w])+128>>8)-i),h=(n=a+t)+i,d=r-C,c=n-i,l=-B-(473*e+196*s+128>>8),A[0+w]=o+h+128>>8,A[1+w]=E+Q+128>>8,A[2+w]=d-B+128>>8,A[3+w]=c-l+128>>8,A[4+w]=c+l+128>>8,A[5+w]=B+d+128>>8,A[6+w]=Q-E+128>>8,A[7+w]=h-o+128>>8},t}(J);T.prototype.frameRate=30,T.prototype.currentY=null,T.prototype.currentCr=null,T.prototype.currentCb=null,T.prototype.pictureType=0,T.prototype.forwardY=null,T.prototype.forwardCr=null,T.prototype.forwardCb=null,T.prototype.fullPelForward=!1,T.prototype.forwardFCode=0,T.prototype.forwardRSize=0,T.prototype.forwardF=0,T.prototype.quantizerScale=0,T.prototype.sliceBegin=!1,T.prototype.macroblockAddress=0,T.prototype.mbRow=0,T.prototype.mbCol=0,T.prototype.macroblockType=0,T.prototype.macroblockIntra=!1,T.prototype.macroblockMotFw=!1,T.prototype.motionFwH=0,T.prototype.motionFwV=0,T.prototype.motionFwHPrev=0,T.prototype.motionFwVPrev=0,T.prototype.dcPredictorY=0,T.prototype.dcPredictorCr=0,T.prototype.dcPredictorCb=0,T.prototype.blockData=null,T.PICTURE_RATE=[0,23.976,24,25,29.97,30,50,59.94,60,0,0,0,0,0,0,0],T.ZIG_ZAG=new Uint8Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),T.DEFAULT_INTRA_QUANT_MATRIX=new Uint8Array([8,16,19,22,26,27,29,34,16,16,22,24,27,29,34,37,19,22,26,27,29,34,34,38,22,22,26,27,29,34,37,40,22,26,27,29,32,35,40,48,26,27,29,32,35,40,48,58,26,27,29,34,38,46,56,69,27,29,35,38,46,56,69,83]),T.DEFAULT_NON_INTRA_QUANT_MATRIX=new Uint8Array([16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16]),T.PREMULTIPLIER_MATRIX=new Uint8Array([32,44,42,38,32,25,17,9,44,62,58,52,44,35,24,12,42,58,55,49,42,33,23,12,38,52,49,44,38,30,20,10,32,44,42,38,32,25,17,9,25,35,33,30,25,20,14,7,17,24,23,20,17,14,9,5,9,12,12,10,9,7,5,2]),T.MACROBLOCK_ADDRESS_INCREMENT=new Int16Array([3,6,0,9,12,0,0,0,1,15,18,0,21,24,0,27,30,0,33,36,0,0,0,3,0,0,2,39,42,0,45,48,0,0,0,5,0,0,4,51,54,0,57,60,0,0,0,7,0,0,6,63,66,0,69,72,0,75,78,0,81,84,0,-1,87,0,-1,90,0,93,96,0,99,102,0,105,108,0,111,114,0,0,0,9,0,0,8,117,120,0,123,126,0,129,132,0,135,138,0,0,0,15,0,0,14,0,0,13,0,0,12,0,0,11,0,0,10,141,-1,0,-1,144,0,147,150,0,153,156,0,159,162,0,165,168,0,171,174,0,177,180,0,183,-1,0,-1,186,0,189,192,0,195,198,0,201,204,0,207,210,0,213,216,0,219,222,0,0,0,21,0,0,20,0,0,19,0,0,18,0,0,17,0,0,16,0,0,35,0,0,34,0,0,33,0,0,32,0,0,31,0,0,30,0,0,29,0,0,28,0,0,27,0,0,26,0,0,25,0,0,24,0,0,23,0,0,22]),T.MACROBLOCK_TYPE_INTRA=new Int8Array([3,6,0,-1,9,0,0,0,1,0,0,17]),T.MACROBLOCK_TYPE_PREDICTIVE=new Int8Array([3,6,0,9,12,0,0,0,10,15,18,0,0,0,2,21,24,0,0,0,8,27,30,0,33,36,0,-1,39,0,0,0,18,0,0,26,0,0,1,0,0,17]),T.MACROBLOCK_TYPE_B=new Int8Array([3,6,0,9,15,0,12,18,0,24,21,0,0,0,12,27,30,0,0,0,14,39,42,0,36,33,0,0,0,4,0,0,6,54,48,0,45,51,0,0,0,8,0,0,10,-1,57,0,0,0,1,60,63,0,0,0,30,0,0,17,0,0,22,0,0,26]),T.MACROBLOCK_TYPE=[null,T.MACROBLOCK_TYPE_INTRA,T.MACROBLOCK_TYPE_PREDICTIVE,T.MACROBLOCK_TYPE_B],T.CODE_BLOCK_PATTERN=new Int16Array([6,3,0,9,18,0,12,15,0,24,33,0,36,39,0,27,21,0,30,42,0,60,57,0,54,48,0,69,51,0,81,75,0,63,84,0,45,66,0,72,78,0,0,0,60,105,120,0,132,144,0,114,108,0,126,141,0,87,93,0,117,96,0,0,0,32,135,138,0,99,123,0,129,102,0,0,0,4,90,111,0,0,0,8,0,0,16,0,0,44,150,168,0,0,0,28,0,0,52,0,0,62,183,177,0,156,180,0,0,0,1,165,162,0,0,0,61,0,0,56,171,174,0,0,0,2,0,0,40,153,186,0,0,0,48,192,189,0,147,159,0,0,0,20,0,0,12,240,249,0,0,0,63,231,225,0,195,219,0,252,198,0,0,0,24,0,0,36,0,0,3,207,261,0,243,237,0,204,213,0,210,234,0,201,228,0,216,222,0,258,255,0,264,246,0,-1,282,0,285,291,0,0,0,33,0,0,9,318,330,0,306,348,0,0,0,5,0,0,10,279,267,0,0,0,6,0,0,18,0,0,17,0,0,34,339,357,0,309,312,0,270,276,0,327,321,0,351,354,0,303,297,0,294,288,0,300,273,0,342,345,0,315,324,0,336,333,0,363,375,0,0,0,41,0,0,14,0,0,21,372,366,0,360,369,0,0,0,11,0,0,19,0,0,7,0,0,35,0,0,13,0,0,50,0,0,49,0,0,58,0,0,37,0,0,25,0,0,45,0,0,57,0,0,26,0,0,29,0,0,38,0,0,53,0,0,23,0,0,43,0,0,46,0,0,42,0,0,22,0,0,54,0,0,51,0,0,15,0,0,30,0,0,39,0,0,47,0,0,55,0,0,27,0,0,59,0,0,31]),T.MOTION=new Int16Array([3,6,0,12,9,0,0,0,0,18,15,0,24,21,0,0,0,-1,0,0,1,27,30,0,36,33,0,0,0,2,0,0,-2,42,45,0,48,39,0,60,54,0,0,0,3,0,0,-3,51,57,0,-1,69,0,81,75,0,78,63,0,72,66,0,96,84,0,87,93,0,-1,99,0,108,105,0,0,0,-4,90,102,0,0,0,4,0,0,-7,0,0,5,111,123,0,0,0,-5,0,0,7,114,120,0,126,117,0,0,0,-6,0,0,6,153,162,0,150,147,0,135,138,0,156,141,0,129,159,0,132,144,0,0,0,10,0,0,9,0,0,8,0,0,-8,171,198,0,0,0,-9,180,192,0,168,183,0,165,186,0,174,189,0,0,0,-10,177,195,0,0,0,12,0,0,16,0,0,13,0,0,14,0,0,11,0,0,15,0,0,-16,0,0,-12,0,0,-14,0,0,-15,0,0,-11,0,0,-13]),T.DCT_DC_SIZE_LUMINANCE=new Int8Array([6,3,0,18,15,0,9,12,0,0,0,1,0,0,2,27,24,0,21,30,0,0,0,0,36,33,0,0,0,4,0,0,3,39,42,0,0,0,5,0,0,6,48,45,0,51,-1,0,0,0,7,0,0,8]),T.DCT_DC_SIZE_CHROMINANCE=new Int8Array([6,3,0,12,9,0,18,15,0,24,21,0,0,0,2,0,0,1,0,0,0,30,27,0,0,0,3,36,33,0,0,0,4,42,39,0,0,0,5,48,45,0,0,0,6,51,-1,0,0,0,7,0,0,8]),T.DCT_COEFF=new Int32Array([3,6,0,12,9,0,0,0,1,21,24,0,18,15,0,39,27,0,33,30,0,42,36,0,0,0,257,60,66,0,54,63,0,48,57,0,0,0,513,51,45,0,0,0,2,0,0,3,81,75,0,87,93,0,72,78,0,96,90,0,0,0,1025,69,84,0,0,0,769,0,0,258,0,0,1793,0,0,65535,0,0,1537,111,108,0,0,0,1281,105,102,0,117,114,0,99,126,0,120,123,0,156,150,0,162,159,0,144,147,0,129,135,0,138,132,0,0,0,2049,0,0,4,0,0,514,0,0,2305,153,141,0,165,171,0,180,168,0,177,174,0,183,186,0,0,0,2561,0,0,3329,0,0,6,0,0,259,0,0,5,0,0,770,0,0,2817,0,0,3073,228,225,0,201,210,0,219,213,0,234,222,0,216,231,0,207,192,0,204,189,0,198,195,0,243,261,0,273,240,0,246,237,0,249,258,0,279,276,0,252,255,0,270,282,0,264,267,0,0,0,515,0,0,260,0,0,7,0,0,1026,0,0,1282,0,0,4097,0,0,3841,0,0,3585,315,321,0,333,342,0,312,291,0,375,357,0,288,294,0,-1,369,0,285,303,0,318,363,0,297,306,0,339,309,0,336,348,0,330,300,0,372,345,0,351,366,0,327,354,0,360,324,0,381,408,0,417,420,0,390,378,0,435,438,0,384,387,0,0,0,2050,396,402,0,465,462,0,0,0,8,411,399,0,429,432,0,453,414,0,426,423,0,0,0,10,0,0,9,0,0,11,0,0,5377,0,0,1538,0,0,771,0,0,5121,0,0,1794,0,0,4353,0,0,4609,0,0,4865,444,456,0,0,0,1027,459,450,0,0,0,261,393,405,0,0,0,516,447,441,0,516,519,0,486,474,0,510,483,0,504,498,0,471,537,0,507,501,0,522,513,0,534,531,0,468,477,0,492,495,0,549,546,0,525,528,0,0,0,263,0,0,2562,0,0,2306,0,0,5633,0,0,5889,0,0,6401,0,0,6145,0,0,1283,0,0,772,0,0,13,0,0,12,0,0,14,0,0,15,0,0,517,0,0,6657,0,0,262,540,543,0,480,489,0,588,597,0,0,0,27,609,555,0,606,603,0,0,0,19,0,0,22,591,621,0,0,0,18,573,576,0,564,570,0,0,0,20,552,582,0,0,0,21,558,579,0,0,0,23,612,594,0,0,0,25,0,0,24,600,615,0,0,0,31,0,0,30,0,0,28,0,0,29,0,0,26,0,0,17,0,0,16,567,618,0,561,585,0,654,633,0,0,0,37,645,648,0,0,0,36,630,636,0,0,0,34,639,627,0,663,666,0,657,624,0,651,642,0,669,660,0,0,0,35,0,0,267,0,0,40,0,0,268,0,0,266,0,0,32,0,0,264,0,0,265,0,0,38,0,0,269,0,0,270,0,0,33,0,0,39,0,0,7937,0,0,6913,0,0,7681,0,0,4098,0,0,7425,0,0,7169,0,0,271,0,0,274,0,0,273,0,0,272,0,0,1539,0,0,2818,0,0,3586,0,0,3330,0,0,3074,0,0,3842]),T.PICTURE_TYPE={INTRA:1,PREDICTIVE:2,B:3},T.START={SEQUENCE:179,SLICE_FIRST:1,SLICE_LAST:175,PICTURE:0,EXTENSION:181,USER_DATA:178};var v=function(A){function t(t){var i;return(i=A.call(this,t)||this).onDecodeCallback=t.onVideoDecode,i.module=t.wasmModule,i.bufferSize=t.videoBufferSize||524288,i.bufferMode=t.streaming?L.MODE.EVICT:L.MODE.EXPAND,i.decodeFirstFrame=!1!==t.decodeFirstFrame,i.hasSequenceHeader=!1,i}u(t,A);var i=t.prototype;return i.initializeWasmDecoder=function(){this.module.instance?(this.instance=this.module.instance,this.functions=this.module.instance.exports,this.decoder=this.functions._mpeg1_decoder_create(this.bufferSize,this.bufferMode)):console.warn("JSMpeg: WASM module not compiled yet")},i.destroy=function(){this.decoder&&this.functions._mpeg1_decoder_destroy(this.decoder)},i.bufferGetIndex=function(){if(this.decoder)return this.functions._mpeg1_decoder_get_index(this.decoder)},i.bufferSetIndex=function(A){this.decoder&&this.functions._mpeg1_decoder_set_index(this.decoder,A)},i.bufferWrite=function(A){this.decoder||this.initializeWasmDecoder();for(var t=0,i=0;i>2)),g=this.instance.heapU8.subarray(e,e+(this.codedSize>>2));this.destination.render(s,o,g,!1)}this.advanceDecodedTime(1/this.frameRate);var I=S()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,I),!0},t}(J),x=function(A){function t(i){var e;(e=A.call(this,i)||this).onDecodeCallback=i.onAudioDecode;var s=i.audioBufferSize||131072,o=i.streaming?L.MODE.EVICT:L.MODE.EXPAND;e.bits=new L(s,o),e.left=new Float32Array(1152),e.right=new Float32Array(1152),e.sampleRate=44100,e.D=new Float32Array(1024),e.D.set(t.SYNTHESIS_WINDOW,0),e.D.set(t.SYNTHESIS_WINDOW,512),e.V=[new Float32Array(1024),new Float32Array(1024)],e.U=new Int32Array(32),e.VPos=0,e.allocation=[new Array(32),new Array(32)],e.scaleFactorInfo=[new Uint8Array(32),new Uint8Array(32)],e.scaleFactor=[new Array(32),new Array(32)],e.sample=[new Array(32),new Array(32)];for(var g=0;g<2;g++)for(var I=0;I<32;I++)e.scaleFactor[g][I]=[0,0,0],e.sample[g][I]=[0,0,0];return e}u(t,A);var i=t.prototype;return i.decode=function(){var A=S(),t=this.bits.index>>3;if(t>=this.bits.byteLength)return!1;var i=this.decodeFrame(this.left,this.right);if(this.bits.index=t+i<<3,!i)return!1;this.destination&&this.destination.play(this.sampleRate,this.left,this.right),this.advanceDecodedTime(this.left.length/this.sampleRate);var e=S()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,e),!0},i.getCurrentTime=function(){var A=this.destination?this.destination.enqueuedTime:0;return this.decodedTime-A},i.decodeFrame=function(A,i){var e=this.bits.read(11),s=this.bits.read(2),o=this.bits.read(2),g=!this.bits.read(1);if(e!==t.FRAME_SYNC||s!==t.VERSION.MPEG_1||o!==t.LAYER.II)return 0;var I=this.bits.read(4)-1;if(I>13)return 0;var a=this.bits.read(2),B=t.SAMPLE_RATE[a];if(3===a)return 0;s===t.VERSION.MPEG_2&&(a+=4,I+=14);var r=this.bits.read(1);this.bits.read(1);var C=this.bits.read(2),n=0;C===t.MODE.JOINT_STEREO?n=this.bits.read(2)+1<<2:(this.bits.skip(2),n=C===t.MODE.MONO?0:32),this.bits.skip(4),g&&this.bits.skip(16);var E=144e3*t.BIT_RATE[I]/(B=t.SAMPLE_RATE[a])+r|0,Q=0,h=0;if(s===t.VERSION.MPEG_2)Q=2,h=30;else{var d=C===t.MODE.MONO?0:1,c=t.QUANT_LUT_STEP_1[d][I];h=63&(Q=t.QUANT_LUT_STEP_2[c][a]),Q>>=6}n>h&&(n=h);for(var l=0;l>1),U=this.VPos%128>>1;U<1024;){for(var J=0;J<32;++J)this.U[J]+=this.D[L++]*this.V[N][U++];U+=96,L+=32}for(U=1120-U,L-=480;U<1024;){for(var T=0;T<32;++T)this.U[T]+=this.D[L++]*this.V[N][U++];U+=96,L+=32}for(var v=0===N?A:i,x=0;x<32;x++)v[R+x]=this.U[x]/2147418112}R+=32}}return this.sampleRate=B,E},i.readAllocation=function(A,i){var e=t.QUANT_LUT_STEP_3[i][A],s=t.QUANT_LUT_STEP4[15&e][this.bits.read(e>>4)];return s?t.QUANT_TAB[s-1]:0},i.readSamples=function(A,i,e){var s=this.allocation[A][i],o=this.scaleFactor[A][i][e],g=this.sample[A][i],I=0;if(s){if(63===o)o=0;else{var a=o/3|0;o=t.SCALEFACTOR_BASE[o%3]+(1<>1)>>a}var B=s.levels;s.group?(I=this.bits.read(s.bits),g[0]=I%B,I=I/B|0,g[1]=I%B,g[2]=I/B|0):(g[0]=this.bits.read(s.bits),g[1]=this.bits.read(s.bits),g[2]=this.bits.read(s.bits));var r=65536/(B+1)|0;I=((B=(B+1>>1)-1)-g[0])*r,g[0]=I*(o>>12)+(I*(4095&o)+2048>>12)>>12,I=(B-g[1])*r,g[1]=I*(o>>12)+(I*(4095&o)+2048>>12)>>12,I=(B-g[2])*r,g[2]=I*(o>>12)+(I*(4095&o)+2048>>12)>>12}else g[0]=g[1]=g[2]=0},t.MatrixTransform=function(A,t,i,e){var s,o,g,I,a,B,r,C,n,E,Q,h,d,c,l,u,w,p,D,m,f,y,R,k,b,S,G,F,M,q,N,L,U;s=A[0][t]+A[31][t],o=.500602998235*(A[0][t]-A[31][t]),g=A[1][t]+A[30][t],I=.505470959898*(A[1][t]-A[30][t]),a=A[2][t]+A[29][t],B=.515447309923*(A[2][t]-A[29][t]),r=A[3][t]+A[28][t],C=.53104259109*(A[3][t]-A[28][t]),n=A[4][t]+A[27][t],E=.553103896034*(A[4][t]-A[27][t]),Q=A[5][t]+A[26][t],h=.582934968206*(A[5][t]-A[26][t]),d=A[6][t]+A[25][t],c=.622504123036*(A[6][t]-A[25][t]),l=A[7][t]+A[24][t],u=.674808341455*(A[7][t]-A[24][t]),w=A[8][t]+A[23][t],p=.744536271002*(A[8][t]-A[23][t]),D=A[9][t]+A[22][t],m=.839349645416*(A[9][t]-A[22][t]),f=A[10][t]+A[21][t],y=.972568237862*(A[10][t]-A[21][t]),R=A[11][t]+A[20][t],k=1.16943993343*(A[11][t]-A[20][t]),b=A[12][t]+A[19][t],S=1.48416461631*(A[12][t]-A[19][t]),G=A[13][t]+A[18][t],F=2.05778100995*(A[13][t]-A[18][t]),M=A[14][t]+A[17][t],q=3.40760841847*(A[14][t]-A[17][t]),U=s+(N=A[15][t]+A[16][t]),N=.502419286188*(s-N),s=g+M,M=.52249861494*(g-M),g=a+G,G=.566944034816*(a-G),a=r+b,b=.64682178336*(r-b),r=n+R,R=.788154623451*(n-R),n=Q+f,f=1.06067768599*(Q-f),Q=d+D,D=1.72244709824*(d-D),d=l+w,w=5.10114861869*(l-w),l=U+d,d=.509795579104*(U-d),U=s+Q,s=.601344886935*(s-Q),Q=g+n,n=.899976223136*(g-n),g=a+r,r=2.56291544774*(a-r),a=l+g,l=.541196100146*(l-g),g=U+Q,Q=1.30656296488*(U-Q),U=a+g,a=.707106781187*(a-g),g=l+Q,g+=l=.707106781187*(l-Q),Q=d+r,d=.541196100146*(d-r),r=s+n,n=1.30656296488*(s-n),s=Q+r,r=.707106781187*(Q-r),Q=d+n,s+=Q+=d=.707106781187*(d-n),Q+=r,r+=d,n=N+w,N=.509795579104*(N-w),w=M+D,M=.601344886935*(M-D),D=G+f,f=.899976223136*(G-f),G=b+R,R=2.56291544774*(b-R),b=n+G,n=.541196100146*(n-G),G=w+D,D=1.30656296488*(w-D),w=b+G,G=.707106781187*(b-G),b=n+D,D=.707106781187*(n-D),n=N+R,N=.541196100146*(N-R),R=M+f,f=1.30656296488*(M-f),M=n+R,R=.707106781187*(n-R),n=N+f,w+=M+=n+=N=.707106781187*(N-f),M+=b+=D,b+=n+=R,n+=G,G+=R+=N,R+=D,D+=N,f=o+(L=10.1900081235*(A[15][t]-A[16][t])),o=.502419286188*(o-L),L=I+q,I=.52249861494*(I-q),q=B+F,F=.566944034816*(B-F),B=C+S,C=.64682178336*(C-S),S=E+k,E=.788154623451*(E-k),k=h+y,y=1.06067768599*(h-y),h=c+m,m=1.72244709824*(c-m),c=u+p,u=5.10114861869*(u-p),p=f+c,c=.509795579104*(f-c),f=L+h,L=.601344886935*(L-h),h=q+k,k=.899976223136*(q-k),q=B+S,S=2.56291544774*(B-S),B=p+q,p=.541196100146*(p-q),q=f+h,h=1.30656296488*(f-h),f=B+q,q=.707106781187*(B-q),B=p+h,h=.707106781187*(p-h),p=c+S,S=.541196100146*(c-S),c=L+k,k=1.30656296488*(L-k),L=p+c,c=.707106781187*(p-c),p=S+k,L+=p+=k=.707106781187*(S-k),p+=c,S=c+k,c=o+u,o=.509795579104*(o-u),u=I+m,I=.601344886935*(I-m),m=F+y,y=.899976223136*(F-y),F=C+E,E=2.56291544774*(C-E),C=c+F,c=.541196100146*(c-F),F=u+m,m=1.30656296488*(u-m),u=C+F,F=.707106781187*(C-F),C=c+m,m=.707106781187*(c-m),c=o+E,o=.541196100146*(o-E),E=I+y,y=1.30656296488*(I-y),I=c+E,E=.707106781187*(c-E),c=o+y,f+=u+=I+=c+=o=.707106781187*(o-y),u+=L,L+=I+=C+=m,I+=B+=h,B+=C+=c+=E,C+=p,p+=c+=F,c+=q,q+=F+=E+=o,F+=S,S+=E+=m,E+=h,h+=m+=o,m+=k,k+=o,i[e+48]=-U,i[e+49]=i[e+47]=-f,i[e+50]=i[e+46]=-w,i[e+51]=i[e+45]=-u,i[e+52]=i[e+44]=-s,i[e+53]=i[e+43]=-L,i[e+54]=i[e+42]=-M,i[e+55]=i[e+41]=-I,i[e+56]=i[e+40]=-g,i[e+57]=i[e+39]=-B,i[e+58]=i[e+38]=-b,i[e+59]=i[e+37]=-C,i[e+60]=i[e+36]=-Q,i[e+61]=i[e+35]=-p,i[e+62]=i[e+34]=-n,i[e+63]=i[e+33]=-c,i[e+32]=-a,i[e+0]=a,i[e+31]=-q,i[e+1]=q,i[e+30]=-G,i[e+2]=G,i[e+29]=-F,i[e+3]=F,i[e+28]=-r,i[e+4]=r,i[e+27]=-S,i[e+5]=S,i[e+26]=-R,i[e+6]=R,i[e+25]=-E,i[e+7]=E,i[e+24]=-l,i[e+8]=l,i[e+23]=-h,i[e+9]=h,i[e+22]=-D,i[e+10]=D,i[e+21]=-m,i[e+11]=m,i[e+20]=-d,i[e+12]=d,i[e+19]=-k,i[e+13]=k,i[e+18]=-N,i[e+14]=N,i[e+17]=-o,i[e+15]=o,i[e+16]=0},t}(J);x.FRAME_SYNC=2047,x.VERSION={MPEG_2_5:0,MPEG_2:2,MPEG_1:3},x.LAYER={III:1,II:2,I:3},x.MODE={STEREO:0,JOINT_STEREO:1,DUAL_CHANNEL:2,MONO:3},x.SAMPLE_RATE=new Uint16Array([44100,48e3,32e3,0,22050,24e3,16e3,0]),x.BIT_RATE=new Uint16Array([32,48,56,64,80,96,112,128,160,192,224,256,320,384,8,16,24,32,40,48,56,64,80,96,112,128,144,160]),x.SCALEFACTOR_BASE=new Uint32Array([33554432,26632170,21137968]),x.SYNTHESIS_WINDOW=new Float32Array([0,-.5,-.5,-.5,-.5,-.5,-.5,-1,-1,-1,-1,-1.5,-1.5,-2,-2,-2.5,-2.5,-3,-3.5,-3.5,-4,-4.5,-5,-5.5,-6.5,-7,-8,-8.5,-9.5,-10.5,-12,-13,-14.5,-15.5,-17.5,-19,-20.5,-22.5,-24.5,-26.5,-29,-31.5,-34,-36.5,-39.5,-42.5,-45.5,-48.5,-52,-55.5,-58.5,-62.5,-66,-69.5,-73.5,-77,-80.5,-84.5,-88,-91.5,-95,-98,-101,-104,106.5,109,111,112.5,113.5,114,114,113.5,112,110.5,107.5,104,100,94.5,88.5,81.5,73,63.5,53,41.5,28.5,14.5,-1,-18,-36,-55.5,-76.5,-98.5,-122,-147,-173.5,-200.5,-229.5,-259.5,-290.5,-322.5,-355.5,-389.5,-424,-459.5,-495.5,-532,-568.5,-605,-641.5,-678,-714,-749,-783.5,-817,-849,-879.5,-908.5,-935,-959.5,-981,-1000.5,-1016,-1028.5,-1037.5,-1042.5,-1043.5,-1040,-1031.5,1018.5,1e3,976,946.5,911,869.5,822,767.5,707,640,565.5,485,397,302.5,201,92.5,-22.5,-144,-272.5,-407,-547.5,-694,-846,-1003,-1165,-1331.5,-1502,-1675.5,-1852.5,-2031.5,-2212.5,-2394,-2576.5,-2758.5,-2939.5,-3118.5,-3294.5,-3467.5,-3635.5,-3798.5,-3955,-4104.5,-4245.5,-4377.5,-4499,-4609.5,-4708,-4792.5,-4863.5,-4919,-4958,-4979.5,-4983,-4967.5,-4931.5,-4875,-4796,-4694.5,-4569.5,-4420,-4246,-4046,-3820,-3567,3287,2979.5,2644,2280.5,1888,1467.5,1018.5,541,35,-499,-1061,-1650,-2266.5,-2909,-3577,-4270,-4987.5,-5727.5,-6490,-7274,-8077.5,-8899.5,-9739,-10594.5,-11464.5,-12347,-13241,-14144.5,-15056,-15973.5,-16895.5,-17820,-18744.5,-19668,-20588,-21503,-22410.5,-23308.5,-24195,-25068.5,-25926.5,-26767,-27589,-28389,-29166.5,-29919,-30644.5,-31342,-32009.5,-32645,-33247,-33814.5,-34346,-34839.5,-35295,-35710,-36084.5,-36417.5,-36707.5,-36954,-37156.5,-37315,-37428,-37496,37519,37496,37428,37315,37156.5,36954,36707.5,36417.5,36084.5,35710,35295,34839.5,34346,33814.5,33247,32645,32009.5,31342,30644.5,29919,29166.5,28389,27589,26767,25926.5,25068.5,24195,23308.5,22410.5,21503,20588,19668,18744.5,17820,16895.5,15973.5,15056,14144.5,13241,12347,11464.5,10594.5,9739,8899.5,8077.5,7274,6490,5727.5,4987.5,4270,3577,2909,2266.5,1650,1061,499,-35,-541,-1018.5,-1467.5,-1888,-2280.5,-2644,-2979.5,3287,3567,3820,4046,4246,4420,4569.5,4694.5,4796,4875,4931.5,4967.5,4983,4979.5,4958,4919,4863.5,4792.5,4708,4609.5,4499,4377.5,4245.5,4104.5,3955,3798.5,3635.5,3467.5,3294.5,3118.5,2939.5,2758.5,2576.5,2394,2212.5,2031.5,1852.5,1675.5,1502,1331.5,1165,1003,846,694,547.5,407,272.5,144,22.5,-92.5,-201,-302.5,-397,-485,-565.5,-640,-707,-767.5,-822,-869.5,-911,-946.5,-976,-1e3,1018.5,1031.5,1040,1043.5,1042.5,1037.5,1028.5,1016,1000.5,981,959.5,935,908.5,879.5,849,817,783.5,749,714,678,641.5,605,568.5,532,495.5,459.5,424,389.5,355.5,322.5,290.5,259.5,229.5,200.5,173.5,147,122,98.5,76.5,55.5,36,18,1,-14.5,-28.5,-41.5,-53,-63.5,-73,-81.5,-88.5,-94.5,-100,-104,-107.5,-110.5,-112,-113.5,-114,-114,-113.5,-112.5,-111,-109,106.5,104,101,98,95,91.5,88,84.5,80.5,77,73.5,69.5,66,62.5,58.5,55.5,52,48.5,45.5,42.5,39.5,36.5,34,31.5,29,26.5,24.5,22.5,20.5,19,17.5,15.5,14.5,13,12,10.5,9.5,8.5,8,7,6.5,5.5,5,4.5,4,3.5,3.5,3,2.5,2.5,2,2,1.5,1.5,1,1,1,1,.5,.5,.5,.5,.5,.5]),x.QUANT_LUT_STEP_1=[[0,0,1,1,1,2,2,2,2,2,2,2,2,2],[0,0,0,0,0,0,1,1,1,2,2,2,2,2]],x.QUANT_TAB={A:91,B:94,C:8,D:12},x.QUANT_LUT_STEP_2=[[x.QUANT_TAB.C,x.QUANT_TAB.C,x.QUANT_TAB.D],[x.QUANT_TAB.A,x.QUANT_TAB.A,x.QUANT_TAB.A],[x.QUANT_TAB.B,x.QUANT_TAB.A,x.QUANT_TAB.B]],x.QUANT_LUT_STEP_3=[[68,68,52,52,52,52,52,52,52,52,52,52],[67,67,67,66,66,66,66,66,66,66,66,49,49,49,49,49,49,49,49,49,49,49,49,32,32,32,32,32,32,32],[69,69,69,69,52,52,52,52,52,52,52,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36]],x.QUANT_LUT_STEP4=[[0,1,2,17],[0,1,2,3,4,5,6,17],[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17],[0,1,3,5,6,7,8,9,10,11,12,13,14,15,16,17],[0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,17],[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]],x.QUANT_TAB=[{levels:3,group:1,bits:5},{levels:5,group:1,bits:7},{levels:7,group:0,bits:3},{levels:9,group:1,bits:10},{levels:15,group:0,bits:4},{levels:31,group:0,bits:5},{levels:63,group:0,bits:6},{levels:127,group:0,bits:7},{levels:255,group:0,bits:8},{levels:511,group:0,bits:9},{levels:1023,group:0,bits:10},{levels:2047,group:0,bits:11},{levels:4095,group:0,bits:12},{levels:8191,group:0,bits:13},{levels:16383,group:0,bits:14},{levels:32767,group:0,bits:15},{levels:65535,group:0,bits:16}];var Y=function(A){function t(t){var i;return(i=A.call(this,t)||this).onDecodeCallback=t.onAudioDecode,i.module=t.wasmModule,i.bufferSize=t.audioBufferSize||131072,i.bufferMode=t.streaming?L.MODE.EVICT:L.MODE.EXPAND,i.sampleRate=0,i}u(t,A);var i=t.prototype;return i.initializeWasmDecoder=function(){this.module.instance?(this.instance=this.module.instance,this.functions=this.module.instance.exports,this.decoder=this.functions._mp2_decoder_create(this.bufferSize,this.bufferMode)):console.warn("JSMpeg: WASM module not compiled yet")},i.destroy=function(){this.decoder&&this.functions._mp2_decoder_destroy(this.decoder)},i.bufferGetIndex=function(){if(this.decoder)return this.functions._mp2_decoder_get_index(this.decoder)},i.bufferSetIndex=function(A){this.decoder&&this.functions._mp2_decoder_set_index(this.decoder,A)},i.bufferWrite=function(A){this.decoder||this.initializeWasmDecoder();for(var t=0,i=0;i>4<<4;this.gl.viewport(0,0,i,this.height)},t.createTexture=function(A,t){var i=this.gl,e=i.createTexture();return i.bindTexture(i.TEXTURE_2D,e),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.uniform1i(i.getUniformLocation(this.program,t),A),e},t.createProgram=function(A,t){var i=this.gl,e=i.createProgram();return i.attachShader(e,this.compileShader(i.VERTEX_SHADER,A)),i.attachShader(e,this.compileShader(i.FRAGMENT_SHADER,t)),i.linkProgram(e),i.useProgram(e),e},t.compileShader=function(A,t){var i=this.gl,e=i.createShader(A);if(i.shaderSource(e,t),i.compileShader(e),!i.getShaderParameter(e,i.COMPILE_STATUS))throw new Error(i.getShaderInfoLog(e));return e},t.allowsClampedTextureData=function(){var A=this.gl,t=A.createTexture();return A.bindTexture(A.TEXTURE_2D,t),A.texImage2D(A.TEXTURE_2D,0,A.LUMINANCE,1,1,0,A.LUMINANCE,A.UNSIGNED_BYTE,new Uint8ClampedArray([0])),0===A.getError()},t.renderProgress=function(A){var t=this.gl;t.useProgram(this.loadingProgram);var i=t.getUniformLocation(this.loadingProgram,"progress");t.uniform1f(i,A),t.drawArrays(t.TRIANGLE_STRIP,0,4)},t.render=function(A,t,i,e){if(this.enabled){var s=this.gl,o=this.width+15>>4<<4,g=this.height,I=o>>1,a=g>>1;e&&this.shouldCreateUnclampedViews&&(A=new Uint8Array(A.buffer),t=new Uint8Array(t.buffer),i=new Uint8Array(i.buffer)),s.useProgram(this.program),this.updateTexture(s.TEXTURE0,this.textureY,o,g,A),this.updateTexture(s.TEXTURE1,this.textureCb,I,a,t),this.updateTexture(s.TEXTURE2,this.textureCr,I,a,i),s.drawArrays(s.TRIANGLE_STRIP,0,4)}},t.updateTexture=function(A,t,i,e,s){var o=this.gl;o.activeTexture(A),o.bindTexture(o.TEXTURE_2D,t),this.hasTextureData[A]?o.texSubImage2D(o.TEXTURE_2D,0,0,0,i,e,o.LUMINANCE,o.UNSIGNED_BYTE,s):(this.hasTextureData[A]=!0,o.texImage2D(o.TEXTURE_2D,0,o.LUMINANCE,i,e,0,o.LUMINANCE,o.UNSIGNED_BYTE,s))},t.deleteTexture=function(A,t){var i=this.gl;i.activeTexture(A),i.bindTexture(i.TEXTURE_2D,null),i.deleteTexture(t)},A.IsSupported=function(){try{if(!window.WebGLRenderingContext)return!1;var A=document.createElement("canvas");return!(!A.getContext("webgl")&&!A.getContext("experimental-webgl"))}catch(A){return!1}},A}();H.SHADER={FRAGMENT_YCRCB_TO_RGBA:["precision mediump float;","uniform sampler2D textureY;","uniform sampler2D textureCb;","uniform sampler2D textureCr;","varying vec2 texCoord;","mat4 rec601 = mat4(","1.16438, 0.00000, 1.59603, -0.87079,","1.16438, -0.39176, -0.81297, 0.52959,","1.16438, 2.01723, 0.00000, -1.08139,","0, 0, 0, 1",");","void main() {","float y = texture2D(textureY, texCoord).r;","float cb = texture2D(textureCb, texCoord).r;","float cr = texture2D(textureCr, texCoord).r;","gl_FragColor = vec4(y, cr, cb, 1.0) * rec601;","}"].join("\n"),FRAGMENT_LOADING:["precision mediump float;","uniform float progress;","varying vec2 texCoord;","void main() {","float c = ceil(progress-(1.0-texCoord.y));","gl_FragColor = vec4(c,c,c,1);","}"].join("\n"),VERTEX_IDENTITY:["attribute vec2 vertex;","varying vec2 texCoord;","void main() {","texCoord = vertex;","gl_Position = vec4((vertex * 2.0 - 1.0) * vec2(1, -1), 0.0, 1.0);","}"].join("\n")};var P=function(){function A(A){A.canvas?(this.canvas=A.canvas,this.ownsCanvasElement=!1):(this.canvas=document.createElement("canvas"),this.ownsCanvasElement=!0),this.width=this.canvas.width,this.height=this.canvas.height,this.enabled=!0,this.context=this.canvas.getContext("2d")}var t=A.prototype;return t.destroy=function(){this.ownsCanvasElement&&this.canvas.remove()},t.resize=function(A,t){this.width=0|A,this.height=0|t,this.canvas.width=this.width,this.canvas.height=this.height,this.imageData=this.context.getImageData(0,0,this.width,this.height),G(this.imageData.data,255)},t.renderProgress=function(A){var t=this.canvas.width,i=this.canvas.height,e=this.context;e.fillStyle="#222",e.fillRect(0,0,t,i),e.fillStyle="#fff",e.fillRect(0,i-i*A,t,i*A)},t.render=function(A,t,i){this.YCbCrToRGBA(A,t,i,this.imageData.data),this.context.putImageData(this.imageData,0,0)},t.YCbCrToRGBA=function(A,t,i,e){if(this.enabled)for(var s,o,g,I,a,B=this.width+15>>4<<4,r=B>>1,C=0,n=B,E=B+(B-this.width),Q=0,h=r-(this.width>>1),d=0,c=4*this.width,l=4*this.width,u=this.width>>1,w=this.height>>1,p=0;p>8)-179,I=(88*o>>8)-44+(183*s>>8)-91,a=o+(198*o>>8)-227;var m=A[C++],f=A[C++];e[d]=m+g,e[d+1]=m-I,e[d+2]=m+a,e[d+4]=f+g,e[d+5]=f-I,e[d+6]=f+a,d+=8;var y=A[n++],R=A[n++];e[c]=y+g,e[c+1]=y-I,e[c+2]=y+a,e[c+4]=R+g,e[c+5]=R-I,e[c+6]=R+a,c+=8}C+=E,n+=E,d+=l,c+=l,Q+=h}},A}(),O=function(){function A(){this.context=A.CachedContext=A.CachedContext||new(window.AudioContext||window.webkitAudioContext),this.gain=this.context.createGain(),this.destination=this.gain,this.gain.connect(this.context.destination),this.context._connections=(this.context._connections||0)+1,this.startTime=0,this.buffer=null,this.wallclockStartTime=0,this.volume=1,this.enabled=!0,this.unlocked=!A.NeedsUnlocking(),Object.defineProperty(this,"enqueuedTime",{get:this.getEnqueuedTime})}var t=A.prototype;return t.destroy=function(){this.gain.disconnect(),this.context._connections--,0===this.context._connections&&(this.context.close(),A.CachedContext=null)},t.play=function(A,t,i){if(this.enabled){if(!this.unlocked){var e=S();return this.wallclockStartTimethis.memory.buffer.byteLength){var i=this.brk-this.memory.buffer.byteLength,e=Math.ceil(i/this.pageSize);this.memory.grow(e),this.createHeapViews()}return t},t.c_abort=function(A){console.warn("JSMPeg: WASM abort",arguments)},t.c_assertFail=function(A){console.warn("JSMPeg: WASM ___assert_fail",arguments)},t.readDylinkSection=function(A){var t=new Uint8Array(A),i=0,e=function(){for(var A=0,e=1;;){var s=t[i++];if(A+=(127&s)*e,e*=128,!(128&s))return A}},s=function(A){for(var e=0;ethis.maxAudioLag&&(this.audioOut.resetEnqueuedTime(),this.audioOut.enabled=!1),A=this.audio.decode()}while(A);this.audioOut.enabled=!0}},t.updateForStaticFile=function(){var A=!1,t=0;if(this.audio&&this.audio.canPlay){for(;!A&&this.audio.decodedTime-this.audio.currentTime<.25;)A=!this.audio.decode();this.video&&this.video.currentTime0&&(e>2*s&&(this.startTime+=e),A=!this.video.decode()),t=this.demuxer.currentTime-i}this.source.resume(t),A&&this.source.completed?this.loop?this.seek(0):(this.stop(),this.options.onEnded&&this.options.onEnded(this)):A&&this.options.onStalled&&this.options.onStalled(this)},A}(),W={Player:X,VideoElement:b,BitBuffer:L,Source:{Ajax:M,AjaxProgressive:q,WebSocket:N,Fetch:function(){function A(A,t){this.url=A,this.destination=null,this.request=null,this.streaming=!0,this.completed=!1,this.established=!1,this.progress=0,this.aborted=!1,this.onEstablishedCallback=t.onSourceEstablished,this.onCompletedCallback=t.onSourceCompleted,t.hookOnEstablished&&(this.hookOnEstablished=t.hookOnEstablished)}var t=A.prototype;return t.connect=function(A){this.destination=A},t.start=function(){var A=this,t={method:"GET",headers:new Headers,cache:"default"};self.fetch(this.url,t).then((function(t){if(t.ok&&t.status>=200&&t.status<=299)return A.progress=1,A.established=!0,A.pump(t.body.getReader())})).catch((function(A){throw A}))},t.pump=function(A){var t=this;return A.read().then((function(i){if(!i.done)return t.aborted?A.cancel():(t.destination&&t.destination.write(i.value.buffer),t.pump(A));t.completed=!0})).catch((function(A){throw A}))},t.resume=function(){},t.abort=function(){this.aborted=!0},A}()},Demuxer:{TS:U},Decoder:{Base:J,MPEG1Video:T,MPEG1VideoWASM:v,MP2Audio:x,MP2AudioWASM:Y},Renderer:{WebGL:H,Canvas2D:P},AudioOutput:{WebAudio:O},WASMModule:K,Now:S,CreateVideoElements:function(){for(var A=document.querySelectorAll(".jsmpeg"),t=0;tthis.q=A))}resume(){this.q?.(),this.Z=this.q=void 0}} +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const V=A=>!e(A)&&"function"==typeof A.then,z=1073741823;const $=A(class extends t{constructor(){super(...arguments),this._$Cwt=z,this._$Cbt=[],this._$CK=new Z(this),this._$CX=new j}render(...A){return A.find((A=>!V(A)))??i}update(A,t){const e=this._$Cbt;let s=e.length;this._$Cbt=t;const o=this._$CK,g=this._$CX;this.isConnected||this.disconnected();for(let A=0;Athis._$Cwt);A++){const i=t[A];if(!V(i))return this._$Cwt=A,i;A{for(;g.get();)await g.get();const t=o.deref();if(void 0!==t){const e=t._$Cbt.indexOf(i);e>-1&&e{let i=!1;const e=new W.VideoElement(this,A,{canvas:this._jsmpegCanvasElement},{pauseWhenHidden:!1,autoplay:!1,protocols:[],audio:!1,videoBufferSize:4194304,preserveDrawingBuffer:!0,...this.cameraConfig?.jsmpeg?.options,reconnectInterval:0,onVideoDecode:()=>{!i&&this._jsmpegCanvasElement&&(i=!0,t(e))},onPlay:()=>g(this),onPause:()=>I(this)})})),this._jsmpegCanvasElement&&a(this,this._jsmpegCanvasElement,{player:this,capabilities:{supportsPause:!0},technology:["jsmpeg"]})}_resetPlayer(){if(this._refreshPlayerTimer.stop(),this._jsmpegVideoPlayer){try{this._jsmpegVideoPlayer.destroy()}catch(A){}this._jsmpegVideoPlayer=void 0}this._jsmpegCanvasElement&&(this._jsmpegCanvasElement.remove(),this._jsmpegCanvasElement=void 0)}connectedCallback(){super.connectedCallback(),this.isConnected&&this.requestUpdate()}disconnectedCallback(){this.isConnected||this._resetPlayer(),super.disconnectedCallback()}async _refreshPlayer(){if(!this.hass)return;this._resetPlayer(),this._jsmpegCanvasElement=document.createElement("canvas"),this._jsmpegCanvasElement.className="media";const A=this.cameraEndpoints?.jsmpeg;if(!A)return B(this,r("error.live_camera_no_endpoint"),{context:this.cameraConfig});const t=await c(this,this.hass,A,86400);t&&(await this._createJSMPEGPlayer(t),this._refreshPlayerTimer.start(82800,(()=>this.requestUpdate())))}render(){return C`${$((async()=>(await this._refreshPlayer(),this._jsmpegVideoPlayer&&this._jsmpegCanvasElement?C`${this._jsmpegCanvasElement}`:B(this,r("error.jsmpeg_no_player"))))(),n({cardWideConfig:this.cardWideConfig}))}`}static get styles(){return E(":host {\n width: 100%;\n height: 100%;\n display: flex;\n}\n\ncanvas {\n display: block;\n width: 100%;\n height: 100%;\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}")}};Q([h({attribute:!1})],AA.prototype,"cameraConfig",void 0),Q([h({attribute:!1})],AA.prototype,"cameraEndpoints",void 0),Q([h({attribute:!1})],AA.prototype,"cardWideConfig",void 0),AA=Q([d("frigate-card-live-jsmpeg")],AA);export{AA as FrigateCardLiveJSMPEG}; diff --git a/config/www/community/frigate-hass-card/jsmpeg-ef28408a.js.gz b/config/www/community/frigate-hass-card/jsmpeg-ef28408a.js.gz new file mode 100644 index 00000000..cceea55c Binary files /dev/null and b/config/www/community/frigate-hass-card/jsmpeg-ef28408a.js.gz differ diff --git a/config/www/community/frigate-hass-card/jsmpeg-fd152ef0.js b/config/www/community/frigate-hass-card/jsmpeg-fd152ef0.js new file mode 100644 index 00000000..1e8683cc --- /dev/null +++ b/config/www/community/frigate-hass-card/jsmpeg-fd152ef0.js @@ -0,0 +1,12 @@ +import{cL as A,eN as t,dC as i,eO as e,a as s,dD as o,dy as g,dz as I,dw as a,cQ as B,l as r,x as C,dl as n,r as E,_ as Q,n as h,t as d}from"./card-09c4bade.js";import{g as c}from"./endpoint-e9cb8034.js";function l(){return l=Object.assign?Object.assign.bind():function(A){for(var t=1;t"string"==typeof A&&A.constructor===String,D=function(A){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t=A,"Promise"===Object.prototype.toString.call(t).slice(8,-1)?A:new Promise((t=>{A(),setTimeout(t,i)}))};var m="WJ3NAvwFY9",f="tR2-0dd-e1",y="ZgIIHVSSYI",R="kAA8SjbHe2",k="OueN4AU4CJ";!function(A,t){void 0===t&&(t={});var i=t.insertAt;if(A&&"undefined"!=typeof document){var e=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css","top"===i&&e.firstChild?e.insertBefore(s,e.firstChild):e.appendChild(s),s.styleSheet?s.styleSheet.cssText=A:s.appendChild(document.createTextNode(A))}}(".WJ3NAvwFY9,.ZgIIHVSSYI,.kAA8SjbHe2,.tR2-0dd-e1{height:100%;left:0;position:absolute;top:0;width:100%;z-index:1}.ZgIIHVSSYI{-ms-flex-pack:center;-ms-flex-align:center;-webkit-align-items:center;align-items:center;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-justify-content:center;justify-content:center}.WJ3NAvwFY9,.tR2-0dd-e1{display:block}.tR2-0dd-e1.OueN4AU4CJ{display:none}.ZgIIHVSSYI,.kAA8SjbHe2{-webkit-tap-highlight-color:rgba(255,0,0,0);cursor:pointer;opacity:.7}.OueN4AU4CJ.ZgIIHVSSYI,.OueN4AU4CJ.kAA8SjbHe2{display:none}.ZgIIHVSSYI{z-index:10}.ZgIIHVSSYI>svg{fill:#fff;height:12vw;max-height:60px;max-width:60px;width:12vw}.kAA8SjbHe2{-ms-flex-pack:end;-ms-flex-align:end;-webkit-align-items:flex-end;align-items:flex-end;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-justify-content:flex-end;justify-content:flex-end;z-index:10}.kAA8SjbHe2>svg{fill:#fff;height:9vw;margin:0 15px 15px 0;max-height:40px;max-width:40px;width:9vw}");var b=function(){function A(A,t,i,e){var s=void 0===i?{}:i,o=s.canvas,g=void 0===o?"":o,I=s.poster,a=void 0===I?"":I,B=s.autoplay,r=void 0!==B&&B,C=s.autoSetWrapperSize,n=void 0!==C&&C,E=s.loop,Q=void 0!==E&&E,h=s.control,d=void 0===h||h,c=s.decodeFirstFrame,u=void 0===c||c,w=s.picMode,D=void 0!==w&&w,m=s.progressive,f=void 0===m||m,y=s.chunkSize,R=void 0===y?1048576:y,k=s.hooks,b=void 0===k?{}:k;void 0===e&&(e={}),this.options=l({videoUrl:t,canvas:g,poster:a,picMode:D,autoplay:r,autoSetWrapperSize:n,loop:Q,control:d,decodeFirstFrame:u,progressive:f,chunkSize:R,hooks:l({play:function(){},pause:function(){},stop:function(){},load:function(){}},b)},e),this.options.needPlayButton=this.options.control&&!this.options.picMode,this.player=null,this.els={wrapper:p(A)?document.querySelector(A):A,canvas:null,playButton:document.createElement("div"),unmuteButton:null,poster:null},"static"===window.getComputedStyle(this.els.wrapper).getPropertyValue("position")&&(this.els.wrapper.style.position="relative"),this.els.wrapper.clientRect=this.els.wrapper.getBoundingClientRect(),this.initCanvas(),this.initPlayButton(),this.initPlayer()}var t=A.prototype;return t.initCanvas=function(){this.options.canvas?this.els.canvas=p(this.options.canvas)?document.querySelector(this.options.canvas):this.options.canvas:(this.els.canvas=document.createElement("canvas"),this.els.canvas.classList.add(m),this.els.wrapper.appendChild(this.els.canvas))},t.initPlayer=function(){var A=this;this.options=l(this.options,{canvas:this.els.canvas});var t=l({},this.options,{autoplay:!1});if(this.player=new X(this.options.videoUrl,t,{play:function(){A.options.needPlayButton&&A.els.playButton.classList.add(k),A.els.poster&&A.els.poster.classList.add(k),A.options.hooks.play()},pause:function(){A.options.needPlayButton&&A.els.playButton.classList.remove(k),A.options.hooks.pause()},stop:function(){A.els.poster&&A.els.poster.classList.remove(k),A.options.hooks.stop()},load:function(){A.options.autoplay&&A.play(),A._autoSetWrapperSize(),A.options.hooks.load()}}),this._copyPlayerFuncs(),this.els.wrapper.playerInstance=this.player,!this.options.poster||this.options.autoplay||this.player.options.streaming||(this.options.decodeFirstFrame=!1,this.els.poster=new Image,this.els.poster.src=this.options.poster,this.els.poster.classList.add(f),this.els.wrapper.appendChild(this.els.poster)),this.player.options.streaming||this.els.wrapper.addEventListener("click",this.onClick.bind(this)),(this.options.autoplay||this.player.options.streaming)&&this.els.playButton.classList.add(k),this.player.audioOut&&!this.player.audioOut.unlocked){var i=this.els.wrapper;(this.options.autoplay||this.player.options.streaming)&&(this.els.unmuteButton=document.createElement("div"),this.els.unmuteButton.innerHTML='\n\n \n\n',this.els.unmuteButton.classList.add(R),this.els.wrapper.appendChild(this.els.unmuteButton),i=this.els.unmuteButton),this.unlockAudioBound=this.onUnlockAudio.bind(this,i),i.addEventListener("touchstart",this.unlockAudioBound,!1),i.addEventListener("click",this.unlockAudioBound,!0)}},t.initPlayButton=function(){this.options.needPlayButton&&(this.els.playButton.classList.add(y),this.els.playButton.innerHTML='\n\n \n\n',this.els.wrapper.appendChild(this.els.playButton))},t._autoSetWrapperSize=function(){var A=this;if(!this.options.autoSetWrapperSize)return Promise.resolve();var t=this.player.video.destination;return t?Promise.resolve().then((function(){return D((function(){A.els.wrapper.style.width=t.width+"px",A.els.wrapper.style.height=t.height+"px"}))})):Promise.resolve()},t.onUnlockAudio=function(A,t){var i=this;this.els.unmuteButton&&(t.preventDefault(),t.stopPropagation()),this.player.audioOut.unlock((function(){i.els.unmuteButton&&i.els.unmuteButton.classList.add(k),A.removeEventListener("touchstart",i.unlockAudioBound),A.removeEventListener("click",i.unlockAudioBound)}))},t.onClick=function(){this.options.control&&(this.player.isPlaying?this.pause():this.play())},t._copyPlayerFuncs=function(){var A=this;this.play=function(){return A.player.play()},this.pause=function(){return A.player.pause()},this.stop=function(){return A.player.stop()},this.destroy=function(){A.player.destroy(),A.els.wrapper.innerHTML="",A.els.wrapper.playerInstance=null}},A}(),S=function(){return window.performance?window.performance.now()/1e3:Date.now()/1e3},G=function(A,t){if(A.fill)A.fill(t);else for(var i=0;iA&&this.loadNextChunk())},t.destroy=function(){this.request.abort(),this.aborted=!0},t.loadNextChunk=function(){var A=this,t=this.loadedSize,i=Math.min(this.loadedSize+this.chunkSize-1,this.fileSize-1);if(t>=this.fileSize||this.aborted)return this.completed=!0,void(this.onCompletedCallback&&this.onCompletedCallback(this));this.isLoading=!0,this.loadStartTime=S(),this.request=new XMLHttpRequest,this.request.onreadystatechange=function(){A.request.readyState===A.request.DONE&&A.request.status>=200&&A.request.status<300?A.onChunkLoad(A.request.response):A.request.readyState===A.request.DONE&&A.loadFails++<3&&A.loadNextChunk()},0===t&&(this.request.onprogress=this.onProgress.bind(this)),this.request.open("GET",this.url+"?"+t+"-"+i),this.request.setRequestHeader("Range","bytes="+t+"-"+i),this.request.responseType="arraybuffer",this.request.send()},t.onProgress=function(A){this.progress=A.loaded/A.total},t.onChunkLoad=function(A){var t=!this.established;this.established=!0,this.progress=1,this.loadedSize+=A.byteLength,this.loadFails=0,this.isLoading=!1,t&&this.hookOnEstablished&&this.hookOnEstablished(),t&&this.onEstablishedCallback&&this.onEstablishedCallback(this),this.destination&&this.destination.write(A),this.loadTime=S()-this.loadStartTime,this.throttled||this.loadNextChunk()},A}(),N=function(){function A(A,t){this.url=A,this.options=t,this.socket=null,this.streaming=!0,this.callbacks={connect:[],data:[]},this.destination=null,this.reconnectInterval=void 0!==t.reconnectInterval?t.reconnectInterval:5,this.shouldAttemptReconnect=!!this.reconnectInterval,this.completed=!1,this.established=!1,this.progress=0,this.reconnectTimeoutId=0,this.onEstablishedCallback=t.onSourceEstablished,this.onCompletedCallback=t.onSourceCompleted,t.hookOnEstablished&&(this.hookOnEstablished=t.hookOnEstablished)}var t=A.prototype;return t.connect=function(A){this.destination=A},t.destroy=function(){clearTimeout(this.reconnectTimeoutId),this.shouldAttemptReconnect=!1,this.socket.close()},t.start=function(){this.shouldAttemptReconnect=!!this.reconnectInterval,this.progress=0,this.established=!1,this.options.protocols?this.socket=new WebSocket(this.url,this.options.protocols):this.socket=new WebSocket(this.url),this.socket.binaryType="arraybuffer",this.socket.onmessage=this.onMessage.bind(this),this.socket.onopen=this.onOpen.bind(this),this.socket.onerror=this.onClose.bind(this),this.socket.onclose=this.onClose.bind(this)},t.resume=function(){},t.onOpen=function(){this.progress=1},t.onClose=function(){var A=this;this.shouldAttemptReconnect&&(clearTimeout(this.reconnectTimeoutId),this.reconnectTimeoutId=setTimeout((function(){A.start()}),1e3*this.reconnectInterval))},t.onMessage=function(A){var t=!this.established;this.established=!0,t&&this.hookOnEstablished&&this.hookOnEstablished(),t&&this.onEstablishedCallback&&this.onEstablishedCallback(this),this.destination&&this.destination.write(A.data)},A}(),L=function(){function A(t,i){"object"==typeof t?(this.bytes=t instanceof Uint8Array?t:new Uint8Array(t),this.byteLength=this.bytes.length):(this.bytes=new Uint8Array(t||1048576),this.byteLength=0),this.mode=i||A.MODE.EXPAND,this.index=0}var t=A.prototype;return t.resize=function(A){var t=new Uint8Array(A);0!==this.byteLength&&(this.byteLength=Math.min(this.byteLength,A),t.set(this.bytes,0,this.byteLength)),this.bytes=t,this.index=Math.min(this.index,this.byteLength<<3)},t.evict=function(A){var t=this.index>>3,i=this.bytes.length-this.byteLength;if(this.index===this.byteLength<<3||A>i+t)return this.byteLength=0,void(this.index=0);0!==t&&(this.bytes.copyWithin?this.bytes.copyWithin(0,t,this.byteLength):this.bytes.set(this.bytes.subarray(t,this.byteLength)),this.byteLength-=t,this.index-=t<<3)},t.write=function(t){var i="object"==typeof t[0],e=0,s=this.bytes.length-this.byteLength;if(i){e=0;for(var o=0;os)if(this.mode===A.MODE.EXPAND){var g=Math.max(2*this.bytes.length,e-s);this.resize(g)}else this.evict(e);if(i)for(var I=0;I>3;A>3;return A>=this.byteLength||0===this.bytes[A]&&0===this.bytes[A+1]&&1===this.bytes[A+2]},t.peek=function(A){for(var t=this.index,i=0;A;){var e=8-(7&t),s=e>3]&255>>8-s<>o,t+=s,A-=s}return i},t.read=function(A){var t=this.peek(A);return this.index+=A,t},t.skip=function(A){return this.index+=A},t.rewind=function(A){this.index=Math.max(this.index-A,0)},t.has=function(A){return(this.byteLength<<3)-this.index>=A},A}();L.MODE={EVICT:1,EXPAND:2};var U=function(){function A(){this.bits=null,this.leftoverBytes=null,this.guessVideoFrameEnd=!0,this.pidsToStreamIds={},this.pesPacketInfo={},this.startTime=0,this.currentTime=0}var t=A.prototype;return t.connect=function(A,t){this.pesPacketInfo[A]={destination:t,currentLength:0,totalLength:0,pts:0,buffers:[]}},t.write=function(A){if(this.leftoverBytes){var t=A.byteLength+this.leftoverBytes.byteLength;this.bits=new L(t),this.bits.write([this.leftoverBytes,A])}else this.bits=new L(A);for(;this.bits.has(1504)&&this.parsePacket(););var i=this.bits.byteLength-(this.bits.index>>3);this.leftoverBytes=i>0?this.bits.bytes.subarray(this.bits.index>>3):null},t.parsePacket=function(){if(71!==this.bits.read(8)&&!this.resync())return!1;var A=187+(this.bits.index>>3);this.bits.read(1);var t=this.bits.read(1);this.bits.read(1);var i=this.bits.read(13);this.bits.read(2);var e=this.bits.read(2);this.bits.read(4);var s=this.pidsToStreamIds[i];if(t&&s){var o=this.pesPacketInfo[s];o&&o.currentLength&&this.packetComplete(o)}if(1&e){if(2&e){var g=this.bits.read(8);this.bits.skip(g<<3)}if(t&&this.bits.nextBytesAreStartCode()){this.bits.skip(24),s=this.bits.read(8),this.pidsToStreamIds[i]=s;var I=this.bits.read(16);this.bits.skip(8);var a=this.bits.read(2);this.bits.skip(6);var B=this.bits.read(8),r=this.bits.index+(B<<3),C=this.pesPacketInfo[s];if(C){var n=0;if(2&a){this.bits.skip(4);var E=this.bits.read(3);this.bits.skip(1);var Q=this.bits.read(15);this.bits.skip(1);var h=this.bits.read(15);this.bits.skip(1),n=(1073741824*E+32768*Q+h)/9e4,this.currentTime=n,-1===this.startTime&&(this.startTime=n)}var d=I?I-B-3:0;this.packetStart(C,n,d)}this.bits.index=r}if(s){var c=this.pesPacketInfo[s];if(c){var l=this.bits.index>>3,u=!t&&2&e;(this.packetAddData(c,l,A)||this.guessVideoFrameEnd&&u)&&this.packetComplete(c)}}}return this.bits.index=A<<3,!0},t.resync=function(){if(!this.bits.has(9024))return!1;for(var A=this.bits.index>>3,t=0;t<187;t++)if(71===this.bits.bytes[A+t]){for(var i=!0,e=1;e<5;e++)if(71!==this.bits.bytes[A+t+188*e]){i=!1;break}if(i)return this.bits.index=A+t+1<<3,!0}return console.warn("JSMpeg: Possible garbage data. Skipping."),this.bits.skip(1496),!1},t.packetStart=function(A,t,i){A.totalLength=i,A.currentLength=0,A.pts=t},t.packetAddData=function(A,t,i){return A.buffers.push(this.bits.bytes.subarray(t,i)),A.currentLength+=i-t,0!==A.totalLength&&A.currentLength>=A.totalLength},t.packetComplete=function(A){A.destination.write(A.pts,A.buffers),A.totalLength=0,A.currentLength=0,A.buffers=[]},A}();U.STREAM={PACK_HEADER:186,SYSTEM_HEADER:187,PROGRAM_MAP:188,PRIVATE_1:189,PADDING:190,PRIVATE_2:191,AUDIO_1:192,VIDEO_1:224,DIRECTORY:255};var J=function(){function A(A){this.destination=null,this.canPlay=!1,this.collectTimestamps=!A.streaming,this.bytesWritten=0,this.timestamps=[],this.timestampIndex=0,this.startTime=0,this.decodedTime=0,Object.defineProperty(this,"currentTime",{get:this.getCurrentTime})}var t=A.prototype;return t.destroy=function(){},t.connect=function(A){this.destination=A},t.bufferGetIndex=function(){return this.bits.index},t.bufferSetIndex=function(A){this.bits.index=A},t.bufferWrite=function(A){return this.bits.write(A)},t.write=function(A,t){this.collectTimestamps&&(0===this.timestamps.length&&(this.startTime=A,this.decodedTime=A),this.timestamps.push({index:this.bytesWritten<<3,time:A})),this.bytesWritten+=this.bufferWrite(t),this.canPlay=!0},t.seek=function(A){if(this.collectTimestamps){this.timestampIndex=0;for(var t=0;tA);t++)this.timestampIndex=t;var i=this.timestamps[this.timestampIndex];i?(this.bufferSetIndex(i.index),this.decodedTime=i.time):(this.bits.index=0,this.decodedTime=this.startTime)}},t.decode=function(){this.advanceDecodedTime(0)},t.advanceDecodedTime=function(A){if(this.collectTimestamps){for(var t=-1,i=this.bufferGetIndex(),e=this.timestampIndex;ei);e++)t=e;if(-1!==t&&t!==this.timestampIndex)return this.timestampIndex=t,void(this.decodedTime=this.timestamps[this.timestampIndex].time)}this.decodedTime+=A},t.getCurrentTime=function(){return this.decodedTime},A}(),T=function(A){function t(t){var i;(i=A.call(this,t)||this).onDecodeCallback=t.onVideoDecode;var e=t.videoBufferSize||524288,s=t.streaming?L.MODE.EVICT:L.MODE.EXPAND;return i.bits=new L(e,s),i.customIntraQuantMatrix=new Uint8Array(64),i.customNonIntraQuantMatrix=new Uint8Array(64),i.blockData=new Int32Array(64),i.currentFrame=0,i.decodeFirstFrame=!1!==t.decodeFirstFrame,i}u(t,A);var i=t.prototype;return i.write=function(A,i){if(J.prototype.write.call(this,A,i),!this.hasSequenceHeader){if(-1===this.bits.findStartCode(t.START.SEQUENCE))return!1;this.decodeSequenceHeader(),this.decodeFirstFrame&&this.decode()}},i.decode=function(){var A=S();if(!this.hasSequenceHeader)return!1;if(-1===this.bits.findStartCode(t.START.PICTURE))return!1;this.decodePicture(),this.advanceDecodedTime(1/this.frameRate);var i=S()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,i),!0},i.readHuffman=function(A){var t=0;do{t=A[t+this.bits.read(1)]}while(t>=0&&0!==A[t]);return A[t+2]},i.decodeSequenceHeader=function(){var A=this.bits.read(12),i=this.bits.read(12);if(this.bits.skip(4),this.frameRate=t.PICTURE_RATE[this.bits.read(4)],this.bits.skip(30),A===this.width&&i===this.height||(this.width=A,this.height=i,this.initBuffers(),this.destination&&this.destination.resize(A,i)),this.bits.read(1)){for(var e=0;e<64;e++)this.customIntraQuantMatrix[t.ZIG_ZAG[e]]=this.bits.read(8);this.intraQuantMatrix=this.customIntraQuantMatrix}if(this.bits.read(1)){for(var s=0;s<64;s++){var o=t.ZIG_ZAG[s];this.customNonIntraQuantMatrix[o]=this.bits.read(8)}this.nonIntraQuantMatrix=this.customNonIntraQuantMatrix}this.hasSequenceHeader=!0},i.initBuffers=function(){this.intraQuantMatrix=t.DEFAULT_INTRA_QUANT_MATRIX,this.nonIntraQuantMatrix=t.DEFAULT_NON_INTRA_QUANT_MATRIX,this.mbWidth=this.width+15>>4,this.mbHeight=this.height+15>>4,this.mbSize=this.mbWidth*this.mbHeight,this.codedWidth=this.mbWidth<<4,this.codedHeight=this.mbHeight<<4,this.codedSize=this.codedWidth*this.codedHeight,this.halfWidth=this.mbWidth<<3,this.halfHeight=this.mbHeight<<3,this.currentY=new Uint8ClampedArray(this.codedSize),this.currentY32=new Uint32Array(this.currentY.buffer),this.currentCr=new Uint8ClampedArray(this.codedSize>>2),this.currentCr32=new Uint32Array(this.currentCr.buffer),this.currentCb=new Uint8ClampedArray(this.codedSize>>2),this.currentCb32=new Uint32Array(this.currentCb.buffer),this.forwardY=new Uint8ClampedArray(this.codedSize),this.forwardY32=new Uint32Array(this.forwardY.buffer),this.forwardCr=new Uint8ClampedArray(this.codedSize>>2),this.forwardCr32=new Uint32Array(this.forwardCr.buffer),this.forwardCb=new Uint8ClampedArray(this.codedSize>>2),this.forwardCb32=new Uint32Array(this.forwardCb.buffer)},i.decodePicture=function(){if(this.currentFrame++,this.bits.skip(10),this.pictureType=this.bits.read(3),this.bits.skip(16),!(this.pictureType<=0||this.pictureType>=t.PICTURE_TYPE.B)){if(this.pictureType===t.PICTURE_TYPE.PREDICTIVE){if(this.fullPelForward=this.bits.read(1),this.forwardFCode=this.bits.read(3),0===this.forwardFCode)return;this.forwardRSize=this.forwardFCode-1,this.forwardF=1<=t.START.SLICE_FIRST&&A<=t.START.SLICE_LAST;)this.decodeSlice(255&A),A=this.bits.findNextStartCode();if(-1!==A&&this.bits.rewind(32),this.destination&&this.destination.render(this.currentY,this.currentCr,this.currentCb,!0),this.pictureType===t.PICTURE_TYPE.INTRA||this.pictureType===t.PICTURE_TYPE.PREDICTIVE){var i=this.forwardY,e=this.forwardY32,s=this.forwardCr,o=this.forwardCr32,g=this.forwardCb,I=this.forwardCb32;this.forwardY=this.currentY,this.forwardY32=this.currentY32,this.forwardCr=this.currentCr,this.forwardCr32=this.currentCr32,this.forwardCb=this.currentCb,this.forwardCb32=this.currentCb32,this.currentY=i,this.currentY32=e,this.currentCr=s,this.currentCr32=o,this.currentCb=g,this.currentCb32=I}}},i.decodeSlice=function(A){for(this.sliceBegin=!0,this.macroblockAddress=(A-1)*this.mbWidth-1,this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0,this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.quantizerScale=this.bits.read(5);this.bits.read(1);)this.bits.skip(8);do{this.decodeMacroblock()}while(!this.bits.nextBytesAreStartCode())},i.decodeMacroblock=function(){for(var A=0,i=this.readHuffman(t.MACROBLOCK_ADDRESS_INCREMENT);34===i;)i=this.readHuffman(t.MACROBLOCK_ADDRESS_INCREMENT);for(;35===i;)A+=33,i=this.readHuffman(t.MACROBLOCK_ADDRESS_INCREMENT);if(A+=i,this.sliceBegin)this.sliceBegin=!1,this.macroblockAddress+=A;else{if(this.macroblockAddress+A>=this.mbSize)return;for(A>1&&(this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.pictureType===t.PICTURE_TYPE.PREDICTIVE&&(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0));A>1;)this.macroblockAddress++,this.mbRow=this.macroblockAddress/this.mbWidth|0,this.mbCol=this.macroblockAddress%this.mbWidth,this.copyMacroblock(this.motionFwH,this.motionFwV,this.forwardY,this.forwardCr,this.forwardCb),A--;this.macroblockAddress++}this.mbRow=this.macroblockAddress/this.mbWidth|0,this.mbCol=this.macroblockAddress%this.mbWidth;var e=t.MACROBLOCK_TYPE[this.pictureType];this.macroblockType=this.readHuffman(e),this.macroblockIntra=1&this.macroblockType,this.macroblockMotFw=8&this.macroblockType,16&this.macroblockType&&(this.quantizerScale=this.bits.read(5)),this.macroblockIntra?(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0):(this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.decodeMotionVectors(),this.copyMacroblock(this.motionFwH,this.motionFwV,this.forwardY,this.forwardCr,this.forwardCb));for(var s=2&this.macroblockType?this.readHuffman(t.CODE_BLOCK_PATTERN):this.macroblockIntra?63:0,o=0,g=32;o<6;o++)s&g&&this.decodeBlock(o),g>>=1},i.decodeMotionVectors=function(){var A,i,e=0;this.macroblockMotFw?(0!==(A=this.readHuffman(t.MOTION))&&1!==this.forwardF?(e=this.bits.read(this.forwardRSize),i=(Math.abs(A)-1<(this.forwardF<<4)-1?this.motionFwHPrev-=this.forwardF<<5:this.motionFwHPrev<-this.forwardF<<4&&(this.motionFwHPrev+=this.forwardF<<5),this.motionFwH=this.motionFwHPrev,this.fullPelForward&&(this.motionFwH<<=1),0!==(A=this.readHuffman(t.MOTION))&&1!==this.forwardF?(e=this.bits.read(this.forwardRSize),i=(Math.abs(A)-1<(this.forwardF<<4)-1?this.motionFwVPrev-=this.forwardF<<5:this.motionFwVPrev<-this.forwardF<<4&&(this.motionFwVPrev+=this.forwardF<<5),this.motionFwV=this.motionFwVPrev,this.fullPelForward&&(this.motionFwV<<=1)):this.pictureType===t.PICTURE_TYPE.PREDICTIVE&&(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0)},i.copyMacroblock=function(A,t,i,e,s){var o,g,I,a,B,r,C,n,E,Q,h,d,c,l,u,w,p,D,m,f=this.currentY32,y=this.currentCb32,R=this.currentCr32;if(g=(o=this.codedWidth)-16,I=A>>1,a=t>>1,B=!(1&~A),r=!(1&~t),C=((this.mbRow<<4)+a)*o+(this.mbCol<<4)+I,E=(n=this.mbRow*o+this.mbCol<<2)+(o<<2),B)if(r)for(;n>2&255,c|=(h=i[++C]+i[C+o])+d+2<<6&65280,c|=h+(d=i[++C]+i[C+o])+2<<14&16711680,h=i[++C]+i[C+o],C++,c|=h+d+2<<22&4278190080,f[n++]=c;n+=g>>2,C+=g-1}else for(;n>1&255,c|=(h=i[C++])+d+1<<7&65280,c|=h+(d=i[C++])+1<<15&16711680,c|=(h=i[C++])+d+1<<23&4278190080,f[n++]=c;n+=g>>2,C+=g-1}else if(r)for(;n>1&255,c|=i[++C]+i[C+o]+1<<7&65280,c|=i[++C]+i[C+o]+1<<15&16711680,c|=i[++C]+i[C+o]+1<<23&4278190080,C++,f[n++]=c;n+=g>>2,C+=g}else for(;n>2,C+=g}if(g=(o=this.halfWidth)-8,I=A/2>>1,a=t/2>>1,B=1==(A/2&1),r=1==(t/2&1),C=((this.mbRow<<3)+a)*o+(this.mbCol<<3)+I,E=(n=this.mbRow*o+this.mbCol<<1)+(o<<1),B)if(r)for(;n>2&255,m=p+(D=s[C]+s[C+o])+2>>2&255,w|=(l=e[++C]+e[C+o])+u+2<<6&65280,m|=(p=s[C]+s[C+o])+D+2<<6&65280,w|=l+(u=e[++C]+e[C+o])+2<<14&16711680,m|=p+(D=s[C]+s[C+o])+2<<14&16711680,l=e[++C]+e[C+o],p=s[C]+s[C+o],C++,w|=l+u+2<<22&4278190080,m|=p+D+2<<22&4278190080,R[n]=w,y[n]=m,n++;n+=g>>2,C+=g-1}else for(;n>1&255,m=p+(D=s[C++])+1>>1&255,w|=(l=e[C])+u+1<<7&65280,m|=(p=s[C++])+D+1<<7&65280,w|=l+(u=e[C])+1<<15&16711680,m|=p+(D=s[C++])+1<<15&16711680,w|=(l=e[C])+u+1<<23&4278190080,m|=(p=s[C++])+D+1<<23&4278190080,R[n]=w,y[n]=m,n++;n+=g>>2,C+=g-1}else if(r)for(;n>1&255,m=s[C]+s[C+o]+1>>1&255,w|=e[++C]+e[C+o]+1<<7&65280,m|=s[C]+s[C+o]+1<<7&65280,w|=e[++C]+e[C+o]+1<<15&16711680,m|=s[C]+s[C+o]+1<<15&16711680,w|=e[++C]+e[C+o]+1<<23&4278190080,m|=s[C]+s[C+o]+1<<23&4278190080,C++,R[n]=w,y[n]=m,n++;n+=g>>2,C+=g}else for(;n>2,C+=g}},i.decodeBlock=function(A){var i,e=0;if(this.macroblockIntra){var s,o;if(A<4?(s=this.dcPredictorY,o=this.readHuffman(t.DCT_DC_SIZE_LUMINANCE)):(s=4===A?this.dcPredictorCr:this.dcPredictorCb,o=this.readHuffman(t.DCT_DC_SIZE_CHROMINANCE)),o>0){var g=this.bits.read(o);this.blockData[0]=g&1<0&&0===this.bits.read(1))break;65535===n?(C=this.bits.read(6),0===(r=this.bits.read(8))?r=this.bits.read(8):128===r?r=this.bits.read(8)-256:r>128&&(r-=256)):(C=n>>8,r=255&n,this.bits.read(1)&&(r=-r)),e+=C;var E=t.ZIG_ZAG[e];e++,r<<=1,this.macroblockIntra||(r+=r<0?-1:1),1&(r=r*this.quantizerScale*i[E]>>4)||(r-=r>0?1:-1),r>2047?r=2047:r<-2048&&(r=-2048),this.blockData[E]=r*t.PREMULTIPLIER_MATRIX[E]}A<4?(I=this.currentY,B=this.codedWidth-8,a=this.mbRow*this.codedWidth+this.mbCol<<4,1&A&&(a+=8),2&A&&(a+=this.codedWidth<<3)):(I=4===A?this.currentCb:this.currentCr,B=(this.codedWidth>>1)-8,a=(this.mbRow*this.codedWidth<<2)+(this.mbCol<<3)),this.macroblockIntra?1===e?(t.CopyValueToDestination(this.blockData[0]+128>>8,I,a,B),this.blockData[0]=0):(t.IDCT(this.blockData),t.CopyBlockToDestination(this.blockData,I,a,B),G(this.blockData,0)):1===e?(t.AddValueToDestination(this.blockData[0]+128>>8,I,a,B),this.blockData[0]=0):(t.IDCT(this.blockData),t.AddBlockToDestination(this.blockData,I,a,B),G(this.blockData,0)),e=0},t.CopyBlockToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]=A[s+0],t[i+1]=A[s+1],t[i+2]=A[s+2],t[i+3]=A[s+3],t[i+4]=A[s+4],t[i+5]=A[s+5],t[i+6]=A[s+6],t[i+7]=A[s+7]},t.AddBlockToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]+=A[s+0],t[i+1]+=A[s+1],t[i+2]+=A[s+2],t[i+3]+=A[s+3],t[i+4]+=A[s+4],t[i+5]+=A[s+5],t[i+6]+=A[s+6],t[i+7]+=A[s+7]},t.CopyValueToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]=A,t[i+1]=A,t[i+2]=A,t[i+3]=A,t[i+4]=A,t[i+5]=A,t[i+6]=A,t[i+7]=A},t.AddValueToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]+=A,t[i+1]+=A,t[i+2]+=A,t[i+3]+=A,t[i+4]+=A,t[i+5]+=A,t[i+6]+=A,t[i+7]+=A},t.IDCT=function(A){for(var t,i,e,s,o,g,I,a,B,r,C,n,E,Q,h,d,c,l,u=0;u<8;++u)t=A[32+u],i=A[16+u]+A[48+u],e=A[40+u]-A[24+u],g=A[8+u]+A[56+u],I=A[24+u]+A[40+u],B=(E=(473*(s=A[8+u]-A[56+u])-196*e+128>>8)-(o=g+I))-(362*(g-I)+128>>8),Q=(r=(a=A[0+u])-t)+(C=(362*(A[16+u]-A[48+u])+128>>8)-i),h=(n=a+t)+i,d=r-C,c=n-i,l=-B-(473*e+196*s+128>>8),A[0+u]=o+h,A[8+u]=E+Q,A[16+u]=d-B,A[24+u]=c-l,A[32+u]=c+l,A[40+u]=B+d,A[48+u]=Q-E,A[56+u]=h-o;for(var w=0;w<64;w+=8)t=A[4+w],i=A[2+w]+A[6+w],e=A[5+w]-A[3+w],g=A[1+w]+A[7+w],I=A[3+w]+A[5+w],B=(E=(473*(s=A[1+w]-A[7+w])-196*e+128>>8)-(o=g+I))-(362*(g-I)+128>>8),Q=(r=(a=A[0+w])-t)+(C=(362*(A[2+w]-A[6+w])+128>>8)-i),h=(n=a+t)+i,d=r-C,c=n-i,l=-B-(473*e+196*s+128>>8),A[0+w]=o+h+128>>8,A[1+w]=E+Q+128>>8,A[2+w]=d-B+128>>8,A[3+w]=c-l+128>>8,A[4+w]=c+l+128>>8,A[5+w]=B+d+128>>8,A[6+w]=Q-E+128>>8,A[7+w]=h-o+128>>8},t}(J);T.prototype.frameRate=30,T.prototype.currentY=null,T.prototype.currentCr=null,T.prototype.currentCb=null,T.prototype.pictureType=0,T.prototype.forwardY=null,T.prototype.forwardCr=null,T.prototype.forwardCb=null,T.prototype.fullPelForward=!1,T.prototype.forwardFCode=0,T.prototype.forwardRSize=0,T.prototype.forwardF=0,T.prototype.quantizerScale=0,T.prototype.sliceBegin=!1,T.prototype.macroblockAddress=0,T.prototype.mbRow=0,T.prototype.mbCol=0,T.prototype.macroblockType=0,T.prototype.macroblockIntra=!1,T.prototype.macroblockMotFw=!1,T.prototype.motionFwH=0,T.prototype.motionFwV=0,T.prototype.motionFwHPrev=0,T.prototype.motionFwVPrev=0,T.prototype.dcPredictorY=0,T.prototype.dcPredictorCr=0,T.prototype.dcPredictorCb=0,T.prototype.blockData=null,T.PICTURE_RATE=[0,23.976,24,25,29.97,30,50,59.94,60,0,0,0,0,0,0,0],T.ZIG_ZAG=new Uint8Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),T.DEFAULT_INTRA_QUANT_MATRIX=new Uint8Array([8,16,19,22,26,27,29,34,16,16,22,24,27,29,34,37,19,22,26,27,29,34,34,38,22,22,26,27,29,34,37,40,22,26,27,29,32,35,40,48,26,27,29,32,35,40,48,58,26,27,29,34,38,46,56,69,27,29,35,38,46,56,69,83]),T.DEFAULT_NON_INTRA_QUANT_MATRIX=new Uint8Array([16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16]),T.PREMULTIPLIER_MATRIX=new Uint8Array([32,44,42,38,32,25,17,9,44,62,58,52,44,35,24,12,42,58,55,49,42,33,23,12,38,52,49,44,38,30,20,10,32,44,42,38,32,25,17,9,25,35,33,30,25,20,14,7,17,24,23,20,17,14,9,5,9,12,12,10,9,7,5,2]),T.MACROBLOCK_ADDRESS_INCREMENT=new Int16Array([3,6,0,9,12,0,0,0,1,15,18,0,21,24,0,27,30,0,33,36,0,0,0,3,0,0,2,39,42,0,45,48,0,0,0,5,0,0,4,51,54,0,57,60,0,0,0,7,0,0,6,63,66,0,69,72,0,75,78,0,81,84,0,-1,87,0,-1,90,0,93,96,0,99,102,0,105,108,0,111,114,0,0,0,9,0,0,8,117,120,0,123,126,0,129,132,0,135,138,0,0,0,15,0,0,14,0,0,13,0,0,12,0,0,11,0,0,10,141,-1,0,-1,144,0,147,150,0,153,156,0,159,162,0,165,168,0,171,174,0,177,180,0,183,-1,0,-1,186,0,189,192,0,195,198,0,201,204,0,207,210,0,213,216,0,219,222,0,0,0,21,0,0,20,0,0,19,0,0,18,0,0,17,0,0,16,0,0,35,0,0,34,0,0,33,0,0,32,0,0,31,0,0,30,0,0,29,0,0,28,0,0,27,0,0,26,0,0,25,0,0,24,0,0,23,0,0,22]),T.MACROBLOCK_TYPE_INTRA=new Int8Array([3,6,0,-1,9,0,0,0,1,0,0,17]),T.MACROBLOCK_TYPE_PREDICTIVE=new Int8Array([3,6,0,9,12,0,0,0,10,15,18,0,0,0,2,21,24,0,0,0,8,27,30,0,33,36,0,-1,39,0,0,0,18,0,0,26,0,0,1,0,0,17]),T.MACROBLOCK_TYPE_B=new Int8Array([3,6,0,9,15,0,12,18,0,24,21,0,0,0,12,27,30,0,0,0,14,39,42,0,36,33,0,0,0,4,0,0,6,54,48,0,45,51,0,0,0,8,0,0,10,-1,57,0,0,0,1,60,63,0,0,0,30,0,0,17,0,0,22,0,0,26]),T.MACROBLOCK_TYPE=[null,T.MACROBLOCK_TYPE_INTRA,T.MACROBLOCK_TYPE_PREDICTIVE,T.MACROBLOCK_TYPE_B],T.CODE_BLOCK_PATTERN=new Int16Array([6,3,0,9,18,0,12,15,0,24,33,0,36,39,0,27,21,0,30,42,0,60,57,0,54,48,0,69,51,0,81,75,0,63,84,0,45,66,0,72,78,0,0,0,60,105,120,0,132,144,0,114,108,0,126,141,0,87,93,0,117,96,0,0,0,32,135,138,0,99,123,0,129,102,0,0,0,4,90,111,0,0,0,8,0,0,16,0,0,44,150,168,0,0,0,28,0,0,52,0,0,62,183,177,0,156,180,0,0,0,1,165,162,0,0,0,61,0,0,56,171,174,0,0,0,2,0,0,40,153,186,0,0,0,48,192,189,0,147,159,0,0,0,20,0,0,12,240,249,0,0,0,63,231,225,0,195,219,0,252,198,0,0,0,24,0,0,36,0,0,3,207,261,0,243,237,0,204,213,0,210,234,0,201,228,0,216,222,0,258,255,0,264,246,0,-1,282,0,285,291,0,0,0,33,0,0,9,318,330,0,306,348,0,0,0,5,0,0,10,279,267,0,0,0,6,0,0,18,0,0,17,0,0,34,339,357,0,309,312,0,270,276,0,327,321,0,351,354,0,303,297,0,294,288,0,300,273,0,342,345,0,315,324,0,336,333,0,363,375,0,0,0,41,0,0,14,0,0,21,372,366,0,360,369,0,0,0,11,0,0,19,0,0,7,0,0,35,0,0,13,0,0,50,0,0,49,0,0,58,0,0,37,0,0,25,0,0,45,0,0,57,0,0,26,0,0,29,0,0,38,0,0,53,0,0,23,0,0,43,0,0,46,0,0,42,0,0,22,0,0,54,0,0,51,0,0,15,0,0,30,0,0,39,0,0,47,0,0,55,0,0,27,0,0,59,0,0,31]),T.MOTION=new Int16Array([3,6,0,12,9,0,0,0,0,18,15,0,24,21,0,0,0,-1,0,0,1,27,30,0,36,33,0,0,0,2,0,0,-2,42,45,0,48,39,0,60,54,0,0,0,3,0,0,-3,51,57,0,-1,69,0,81,75,0,78,63,0,72,66,0,96,84,0,87,93,0,-1,99,0,108,105,0,0,0,-4,90,102,0,0,0,4,0,0,-7,0,0,5,111,123,0,0,0,-5,0,0,7,114,120,0,126,117,0,0,0,-6,0,0,6,153,162,0,150,147,0,135,138,0,156,141,0,129,159,0,132,144,0,0,0,10,0,0,9,0,0,8,0,0,-8,171,198,0,0,0,-9,180,192,0,168,183,0,165,186,0,174,189,0,0,0,-10,177,195,0,0,0,12,0,0,16,0,0,13,0,0,14,0,0,11,0,0,15,0,0,-16,0,0,-12,0,0,-14,0,0,-15,0,0,-11,0,0,-13]),T.DCT_DC_SIZE_LUMINANCE=new Int8Array([6,3,0,18,15,0,9,12,0,0,0,1,0,0,2,27,24,0,21,30,0,0,0,0,36,33,0,0,0,4,0,0,3,39,42,0,0,0,5,0,0,6,48,45,0,51,-1,0,0,0,7,0,0,8]),T.DCT_DC_SIZE_CHROMINANCE=new Int8Array([6,3,0,12,9,0,18,15,0,24,21,0,0,0,2,0,0,1,0,0,0,30,27,0,0,0,3,36,33,0,0,0,4,42,39,0,0,0,5,48,45,0,0,0,6,51,-1,0,0,0,7,0,0,8]),T.DCT_COEFF=new Int32Array([3,6,0,12,9,0,0,0,1,21,24,0,18,15,0,39,27,0,33,30,0,42,36,0,0,0,257,60,66,0,54,63,0,48,57,0,0,0,513,51,45,0,0,0,2,0,0,3,81,75,0,87,93,0,72,78,0,96,90,0,0,0,1025,69,84,0,0,0,769,0,0,258,0,0,1793,0,0,65535,0,0,1537,111,108,0,0,0,1281,105,102,0,117,114,0,99,126,0,120,123,0,156,150,0,162,159,0,144,147,0,129,135,0,138,132,0,0,0,2049,0,0,4,0,0,514,0,0,2305,153,141,0,165,171,0,180,168,0,177,174,0,183,186,0,0,0,2561,0,0,3329,0,0,6,0,0,259,0,0,5,0,0,770,0,0,2817,0,0,3073,228,225,0,201,210,0,219,213,0,234,222,0,216,231,0,207,192,0,204,189,0,198,195,0,243,261,0,273,240,0,246,237,0,249,258,0,279,276,0,252,255,0,270,282,0,264,267,0,0,0,515,0,0,260,0,0,7,0,0,1026,0,0,1282,0,0,4097,0,0,3841,0,0,3585,315,321,0,333,342,0,312,291,0,375,357,0,288,294,0,-1,369,0,285,303,0,318,363,0,297,306,0,339,309,0,336,348,0,330,300,0,372,345,0,351,366,0,327,354,0,360,324,0,381,408,0,417,420,0,390,378,0,435,438,0,384,387,0,0,0,2050,396,402,0,465,462,0,0,0,8,411,399,0,429,432,0,453,414,0,426,423,0,0,0,10,0,0,9,0,0,11,0,0,5377,0,0,1538,0,0,771,0,0,5121,0,0,1794,0,0,4353,0,0,4609,0,0,4865,444,456,0,0,0,1027,459,450,0,0,0,261,393,405,0,0,0,516,447,441,0,516,519,0,486,474,0,510,483,0,504,498,0,471,537,0,507,501,0,522,513,0,534,531,0,468,477,0,492,495,0,549,546,0,525,528,0,0,0,263,0,0,2562,0,0,2306,0,0,5633,0,0,5889,0,0,6401,0,0,6145,0,0,1283,0,0,772,0,0,13,0,0,12,0,0,14,0,0,15,0,0,517,0,0,6657,0,0,262,540,543,0,480,489,0,588,597,0,0,0,27,609,555,0,606,603,0,0,0,19,0,0,22,591,621,0,0,0,18,573,576,0,564,570,0,0,0,20,552,582,0,0,0,21,558,579,0,0,0,23,612,594,0,0,0,25,0,0,24,600,615,0,0,0,31,0,0,30,0,0,28,0,0,29,0,0,26,0,0,17,0,0,16,567,618,0,561,585,0,654,633,0,0,0,37,645,648,0,0,0,36,630,636,0,0,0,34,639,627,0,663,666,0,657,624,0,651,642,0,669,660,0,0,0,35,0,0,267,0,0,40,0,0,268,0,0,266,0,0,32,0,0,264,0,0,265,0,0,38,0,0,269,0,0,270,0,0,33,0,0,39,0,0,7937,0,0,6913,0,0,7681,0,0,4098,0,0,7425,0,0,7169,0,0,271,0,0,274,0,0,273,0,0,272,0,0,1539,0,0,2818,0,0,3586,0,0,3330,0,0,3074,0,0,3842]),T.PICTURE_TYPE={INTRA:1,PREDICTIVE:2,B:3},T.START={SEQUENCE:179,SLICE_FIRST:1,SLICE_LAST:175,PICTURE:0,EXTENSION:181,USER_DATA:178};var v=function(A){function t(t){var i;return(i=A.call(this,t)||this).onDecodeCallback=t.onVideoDecode,i.module=t.wasmModule,i.bufferSize=t.videoBufferSize||524288,i.bufferMode=t.streaming?L.MODE.EVICT:L.MODE.EXPAND,i.decodeFirstFrame=!1!==t.decodeFirstFrame,i.hasSequenceHeader=!1,i}u(t,A);var i=t.prototype;return i.initializeWasmDecoder=function(){this.module.instance?(this.instance=this.module.instance,this.functions=this.module.instance.exports,this.decoder=this.functions._mpeg1_decoder_create(this.bufferSize,this.bufferMode)):console.warn("JSMpeg: WASM module not compiled yet")},i.destroy=function(){this.decoder&&this.functions._mpeg1_decoder_destroy(this.decoder)},i.bufferGetIndex=function(){if(this.decoder)return this.functions._mpeg1_decoder_get_index(this.decoder)},i.bufferSetIndex=function(A){this.decoder&&this.functions._mpeg1_decoder_set_index(this.decoder,A)},i.bufferWrite=function(A){this.decoder||this.initializeWasmDecoder();for(var t=0,i=0;i>2)),g=this.instance.heapU8.subarray(e,e+(this.codedSize>>2));this.destination.render(s,o,g,!1)}this.advanceDecodedTime(1/this.frameRate);var I=S()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,I),!0},t}(J),x=function(A){function t(i){var e;(e=A.call(this,i)||this).onDecodeCallback=i.onAudioDecode;var s=i.audioBufferSize||131072,o=i.streaming?L.MODE.EVICT:L.MODE.EXPAND;e.bits=new L(s,o),e.left=new Float32Array(1152),e.right=new Float32Array(1152),e.sampleRate=44100,e.D=new Float32Array(1024),e.D.set(t.SYNTHESIS_WINDOW,0),e.D.set(t.SYNTHESIS_WINDOW,512),e.V=[new Float32Array(1024),new Float32Array(1024)],e.U=new Int32Array(32),e.VPos=0,e.allocation=[new Array(32),new Array(32)],e.scaleFactorInfo=[new Uint8Array(32),new Uint8Array(32)],e.scaleFactor=[new Array(32),new Array(32)],e.sample=[new Array(32),new Array(32)];for(var g=0;g<2;g++)for(var I=0;I<32;I++)e.scaleFactor[g][I]=[0,0,0],e.sample[g][I]=[0,0,0];return e}u(t,A);var i=t.prototype;return i.decode=function(){var A=S(),t=this.bits.index>>3;if(t>=this.bits.byteLength)return!1;var i=this.decodeFrame(this.left,this.right);if(this.bits.index=t+i<<3,!i)return!1;this.destination&&this.destination.play(this.sampleRate,this.left,this.right),this.advanceDecodedTime(this.left.length/this.sampleRate);var e=S()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,e),!0},i.getCurrentTime=function(){var A=this.destination?this.destination.enqueuedTime:0;return this.decodedTime-A},i.decodeFrame=function(A,i){var e=this.bits.read(11),s=this.bits.read(2),o=this.bits.read(2),g=!this.bits.read(1);if(e!==t.FRAME_SYNC||s!==t.VERSION.MPEG_1||o!==t.LAYER.II)return 0;var I=this.bits.read(4)-1;if(I>13)return 0;var a=this.bits.read(2),B=t.SAMPLE_RATE[a];if(3===a)return 0;s===t.VERSION.MPEG_2&&(a+=4,I+=14);var r=this.bits.read(1);this.bits.read(1);var C=this.bits.read(2),n=0;C===t.MODE.JOINT_STEREO?n=this.bits.read(2)+1<<2:(this.bits.skip(2),n=C===t.MODE.MONO?0:32),this.bits.skip(4),g&&this.bits.skip(16);var E=144e3*t.BIT_RATE[I]/(B=t.SAMPLE_RATE[a])+r|0,Q=0,h=0;if(s===t.VERSION.MPEG_2)Q=2,h=30;else{var d=C===t.MODE.MONO?0:1,c=t.QUANT_LUT_STEP_1[d][I];h=63&(Q=t.QUANT_LUT_STEP_2[c][a]),Q>>=6}n>h&&(n=h);for(var l=0;l>1),U=this.VPos%128>>1;U<1024;){for(var J=0;J<32;++J)this.U[J]+=this.D[L++]*this.V[N][U++];U+=96,L+=32}for(U=1120-U,L-=480;U<1024;){for(var T=0;T<32;++T)this.U[T]+=this.D[L++]*this.V[N][U++];U+=96,L+=32}for(var v=0===N?A:i,x=0;x<32;x++)v[R+x]=this.U[x]/2147418112}R+=32}}return this.sampleRate=B,E},i.readAllocation=function(A,i){var e=t.QUANT_LUT_STEP_3[i][A],s=t.QUANT_LUT_STEP4[15&e][this.bits.read(e>>4)];return s?t.QUANT_TAB[s-1]:0},i.readSamples=function(A,i,e){var s=this.allocation[A][i],o=this.scaleFactor[A][i][e],g=this.sample[A][i],I=0;if(s){if(63===o)o=0;else{var a=o/3|0;o=t.SCALEFACTOR_BASE[o%3]+(1<>1)>>a}var B=s.levels;s.group?(I=this.bits.read(s.bits),g[0]=I%B,I=I/B|0,g[1]=I%B,g[2]=I/B|0):(g[0]=this.bits.read(s.bits),g[1]=this.bits.read(s.bits),g[2]=this.bits.read(s.bits));var r=65536/(B+1)|0;I=((B=(B+1>>1)-1)-g[0])*r,g[0]=I*(o>>12)+(I*(4095&o)+2048>>12)>>12,I=(B-g[1])*r,g[1]=I*(o>>12)+(I*(4095&o)+2048>>12)>>12,I=(B-g[2])*r,g[2]=I*(o>>12)+(I*(4095&o)+2048>>12)>>12}else g[0]=g[1]=g[2]=0},t.MatrixTransform=function(A,t,i,e){var s,o,g,I,a,B,r,C,n,E,Q,h,d,c,l,u,w,p,D,m,f,y,R,k,b,S,G,F,M,q,N,L,U;s=A[0][t]+A[31][t],o=.500602998235*(A[0][t]-A[31][t]),g=A[1][t]+A[30][t],I=.505470959898*(A[1][t]-A[30][t]),a=A[2][t]+A[29][t],B=.515447309923*(A[2][t]-A[29][t]),r=A[3][t]+A[28][t],C=.53104259109*(A[3][t]-A[28][t]),n=A[4][t]+A[27][t],E=.553103896034*(A[4][t]-A[27][t]),Q=A[5][t]+A[26][t],h=.582934968206*(A[5][t]-A[26][t]),d=A[6][t]+A[25][t],c=.622504123036*(A[6][t]-A[25][t]),l=A[7][t]+A[24][t],u=.674808341455*(A[7][t]-A[24][t]),w=A[8][t]+A[23][t],p=.744536271002*(A[8][t]-A[23][t]),D=A[9][t]+A[22][t],m=.839349645416*(A[9][t]-A[22][t]),f=A[10][t]+A[21][t],y=.972568237862*(A[10][t]-A[21][t]),R=A[11][t]+A[20][t],k=1.16943993343*(A[11][t]-A[20][t]),b=A[12][t]+A[19][t],S=1.48416461631*(A[12][t]-A[19][t]),G=A[13][t]+A[18][t],F=2.05778100995*(A[13][t]-A[18][t]),M=A[14][t]+A[17][t],q=3.40760841847*(A[14][t]-A[17][t]),U=s+(N=A[15][t]+A[16][t]),N=.502419286188*(s-N),s=g+M,M=.52249861494*(g-M),g=a+G,G=.566944034816*(a-G),a=r+b,b=.64682178336*(r-b),r=n+R,R=.788154623451*(n-R),n=Q+f,f=1.06067768599*(Q-f),Q=d+D,D=1.72244709824*(d-D),d=l+w,w=5.10114861869*(l-w),l=U+d,d=.509795579104*(U-d),U=s+Q,s=.601344886935*(s-Q),Q=g+n,n=.899976223136*(g-n),g=a+r,r=2.56291544774*(a-r),a=l+g,l=.541196100146*(l-g),g=U+Q,Q=1.30656296488*(U-Q),U=a+g,a=.707106781187*(a-g),g=l+Q,g+=l=.707106781187*(l-Q),Q=d+r,d=.541196100146*(d-r),r=s+n,n=1.30656296488*(s-n),s=Q+r,r=.707106781187*(Q-r),Q=d+n,s+=Q+=d=.707106781187*(d-n),Q+=r,r+=d,n=N+w,N=.509795579104*(N-w),w=M+D,M=.601344886935*(M-D),D=G+f,f=.899976223136*(G-f),G=b+R,R=2.56291544774*(b-R),b=n+G,n=.541196100146*(n-G),G=w+D,D=1.30656296488*(w-D),w=b+G,G=.707106781187*(b-G),b=n+D,D=.707106781187*(n-D),n=N+R,N=.541196100146*(N-R),R=M+f,f=1.30656296488*(M-f),M=n+R,R=.707106781187*(n-R),n=N+f,w+=M+=n+=N=.707106781187*(N-f),M+=b+=D,b+=n+=R,n+=G,G+=R+=N,R+=D,D+=N,f=o+(L=10.1900081235*(A[15][t]-A[16][t])),o=.502419286188*(o-L),L=I+q,I=.52249861494*(I-q),q=B+F,F=.566944034816*(B-F),B=C+S,C=.64682178336*(C-S),S=E+k,E=.788154623451*(E-k),k=h+y,y=1.06067768599*(h-y),h=c+m,m=1.72244709824*(c-m),c=u+p,u=5.10114861869*(u-p),p=f+c,c=.509795579104*(f-c),f=L+h,L=.601344886935*(L-h),h=q+k,k=.899976223136*(q-k),q=B+S,S=2.56291544774*(B-S),B=p+q,p=.541196100146*(p-q),q=f+h,h=1.30656296488*(f-h),f=B+q,q=.707106781187*(B-q),B=p+h,h=.707106781187*(p-h),p=c+S,S=.541196100146*(c-S),c=L+k,k=1.30656296488*(L-k),L=p+c,c=.707106781187*(p-c),p=S+k,L+=p+=k=.707106781187*(S-k),p+=c,S=c+k,c=o+u,o=.509795579104*(o-u),u=I+m,I=.601344886935*(I-m),m=F+y,y=.899976223136*(F-y),F=C+E,E=2.56291544774*(C-E),C=c+F,c=.541196100146*(c-F),F=u+m,m=1.30656296488*(u-m),u=C+F,F=.707106781187*(C-F),C=c+m,m=.707106781187*(c-m),c=o+E,o=.541196100146*(o-E),E=I+y,y=1.30656296488*(I-y),I=c+E,E=.707106781187*(c-E),c=o+y,f+=u+=I+=c+=o=.707106781187*(o-y),u+=L,L+=I+=C+=m,I+=B+=h,B+=C+=c+=E,C+=p,p+=c+=F,c+=q,q+=F+=E+=o,F+=S,S+=E+=m,E+=h,h+=m+=o,m+=k,k+=o,i[e+48]=-U,i[e+49]=i[e+47]=-f,i[e+50]=i[e+46]=-w,i[e+51]=i[e+45]=-u,i[e+52]=i[e+44]=-s,i[e+53]=i[e+43]=-L,i[e+54]=i[e+42]=-M,i[e+55]=i[e+41]=-I,i[e+56]=i[e+40]=-g,i[e+57]=i[e+39]=-B,i[e+58]=i[e+38]=-b,i[e+59]=i[e+37]=-C,i[e+60]=i[e+36]=-Q,i[e+61]=i[e+35]=-p,i[e+62]=i[e+34]=-n,i[e+63]=i[e+33]=-c,i[e+32]=-a,i[e+0]=a,i[e+31]=-q,i[e+1]=q,i[e+30]=-G,i[e+2]=G,i[e+29]=-F,i[e+3]=F,i[e+28]=-r,i[e+4]=r,i[e+27]=-S,i[e+5]=S,i[e+26]=-R,i[e+6]=R,i[e+25]=-E,i[e+7]=E,i[e+24]=-l,i[e+8]=l,i[e+23]=-h,i[e+9]=h,i[e+22]=-D,i[e+10]=D,i[e+21]=-m,i[e+11]=m,i[e+20]=-d,i[e+12]=d,i[e+19]=-k,i[e+13]=k,i[e+18]=-N,i[e+14]=N,i[e+17]=-o,i[e+15]=o,i[e+16]=0},t}(J);x.FRAME_SYNC=2047,x.VERSION={MPEG_2_5:0,MPEG_2:2,MPEG_1:3},x.LAYER={III:1,II:2,I:3},x.MODE={STEREO:0,JOINT_STEREO:1,DUAL_CHANNEL:2,MONO:3},x.SAMPLE_RATE=new Uint16Array([44100,48e3,32e3,0,22050,24e3,16e3,0]),x.BIT_RATE=new Uint16Array([32,48,56,64,80,96,112,128,160,192,224,256,320,384,8,16,24,32,40,48,56,64,80,96,112,128,144,160]),x.SCALEFACTOR_BASE=new Uint32Array([33554432,26632170,21137968]),x.SYNTHESIS_WINDOW=new Float32Array([0,-.5,-.5,-.5,-.5,-.5,-.5,-1,-1,-1,-1,-1.5,-1.5,-2,-2,-2.5,-2.5,-3,-3.5,-3.5,-4,-4.5,-5,-5.5,-6.5,-7,-8,-8.5,-9.5,-10.5,-12,-13,-14.5,-15.5,-17.5,-19,-20.5,-22.5,-24.5,-26.5,-29,-31.5,-34,-36.5,-39.5,-42.5,-45.5,-48.5,-52,-55.5,-58.5,-62.5,-66,-69.5,-73.5,-77,-80.5,-84.5,-88,-91.5,-95,-98,-101,-104,106.5,109,111,112.5,113.5,114,114,113.5,112,110.5,107.5,104,100,94.5,88.5,81.5,73,63.5,53,41.5,28.5,14.5,-1,-18,-36,-55.5,-76.5,-98.5,-122,-147,-173.5,-200.5,-229.5,-259.5,-290.5,-322.5,-355.5,-389.5,-424,-459.5,-495.5,-532,-568.5,-605,-641.5,-678,-714,-749,-783.5,-817,-849,-879.5,-908.5,-935,-959.5,-981,-1000.5,-1016,-1028.5,-1037.5,-1042.5,-1043.5,-1040,-1031.5,1018.5,1e3,976,946.5,911,869.5,822,767.5,707,640,565.5,485,397,302.5,201,92.5,-22.5,-144,-272.5,-407,-547.5,-694,-846,-1003,-1165,-1331.5,-1502,-1675.5,-1852.5,-2031.5,-2212.5,-2394,-2576.5,-2758.5,-2939.5,-3118.5,-3294.5,-3467.5,-3635.5,-3798.5,-3955,-4104.5,-4245.5,-4377.5,-4499,-4609.5,-4708,-4792.5,-4863.5,-4919,-4958,-4979.5,-4983,-4967.5,-4931.5,-4875,-4796,-4694.5,-4569.5,-4420,-4246,-4046,-3820,-3567,3287,2979.5,2644,2280.5,1888,1467.5,1018.5,541,35,-499,-1061,-1650,-2266.5,-2909,-3577,-4270,-4987.5,-5727.5,-6490,-7274,-8077.5,-8899.5,-9739,-10594.5,-11464.5,-12347,-13241,-14144.5,-15056,-15973.5,-16895.5,-17820,-18744.5,-19668,-20588,-21503,-22410.5,-23308.5,-24195,-25068.5,-25926.5,-26767,-27589,-28389,-29166.5,-29919,-30644.5,-31342,-32009.5,-32645,-33247,-33814.5,-34346,-34839.5,-35295,-35710,-36084.5,-36417.5,-36707.5,-36954,-37156.5,-37315,-37428,-37496,37519,37496,37428,37315,37156.5,36954,36707.5,36417.5,36084.5,35710,35295,34839.5,34346,33814.5,33247,32645,32009.5,31342,30644.5,29919,29166.5,28389,27589,26767,25926.5,25068.5,24195,23308.5,22410.5,21503,20588,19668,18744.5,17820,16895.5,15973.5,15056,14144.5,13241,12347,11464.5,10594.5,9739,8899.5,8077.5,7274,6490,5727.5,4987.5,4270,3577,2909,2266.5,1650,1061,499,-35,-541,-1018.5,-1467.5,-1888,-2280.5,-2644,-2979.5,3287,3567,3820,4046,4246,4420,4569.5,4694.5,4796,4875,4931.5,4967.5,4983,4979.5,4958,4919,4863.5,4792.5,4708,4609.5,4499,4377.5,4245.5,4104.5,3955,3798.5,3635.5,3467.5,3294.5,3118.5,2939.5,2758.5,2576.5,2394,2212.5,2031.5,1852.5,1675.5,1502,1331.5,1165,1003,846,694,547.5,407,272.5,144,22.5,-92.5,-201,-302.5,-397,-485,-565.5,-640,-707,-767.5,-822,-869.5,-911,-946.5,-976,-1e3,1018.5,1031.5,1040,1043.5,1042.5,1037.5,1028.5,1016,1000.5,981,959.5,935,908.5,879.5,849,817,783.5,749,714,678,641.5,605,568.5,532,495.5,459.5,424,389.5,355.5,322.5,290.5,259.5,229.5,200.5,173.5,147,122,98.5,76.5,55.5,36,18,1,-14.5,-28.5,-41.5,-53,-63.5,-73,-81.5,-88.5,-94.5,-100,-104,-107.5,-110.5,-112,-113.5,-114,-114,-113.5,-112.5,-111,-109,106.5,104,101,98,95,91.5,88,84.5,80.5,77,73.5,69.5,66,62.5,58.5,55.5,52,48.5,45.5,42.5,39.5,36.5,34,31.5,29,26.5,24.5,22.5,20.5,19,17.5,15.5,14.5,13,12,10.5,9.5,8.5,8,7,6.5,5.5,5,4.5,4,3.5,3.5,3,2.5,2.5,2,2,1.5,1.5,1,1,1,1,.5,.5,.5,.5,.5,.5]),x.QUANT_LUT_STEP_1=[[0,0,1,1,1,2,2,2,2,2,2,2,2,2],[0,0,0,0,0,0,1,1,1,2,2,2,2,2]],x.QUANT_TAB={A:91,B:94,C:8,D:12},x.QUANT_LUT_STEP_2=[[x.QUANT_TAB.C,x.QUANT_TAB.C,x.QUANT_TAB.D],[x.QUANT_TAB.A,x.QUANT_TAB.A,x.QUANT_TAB.A],[x.QUANT_TAB.B,x.QUANT_TAB.A,x.QUANT_TAB.B]],x.QUANT_LUT_STEP_3=[[68,68,52,52,52,52,52,52,52,52,52,52],[67,67,67,66,66,66,66,66,66,66,66,49,49,49,49,49,49,49,49,49,49,49,49,32,32,32,32,32,32,32],[69,69,69,69,52,52,52,52,52,52,52,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36]],x.QUANT_LUT_STEP4=[[0,1,2,17],[0,1,2,3,4,5,6,17],[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17],[0,1,3,5,6,7,8,9,10,11,12,13,14,15,16,17],[0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,17],[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]],x.QUANT_TAB=[{levels:3,group:1,bits:5},{levels:5,group:1,bits:7},{levels:7,group:0,bits:3},{levels:9,group:1,bits:10},{levels:15,group:0,bits:4},{levels:31,group:0,bits:5},{levels:63,group:0,bits:6},{levels:127,group:0,bits:7},{levels:255,group:0,bits:8},{levels:511,group:0,bits:9},{levels:1023,group:0,bits:10},{levels:2047,group:0,bits:11},{levels:4095,group:0,bits:12},{levels:8191,group:0,bits:13},{levels:16383,group:0,bits:14},{levels:32767,group:0,bits:15},{levels:65535,group:0,bits:16}];var Y=function(A){function t(t){var i;return(i=A.call(this,t)||this).onDecodeCallback=t.onAudioDecode,i.module=t.wasmModule,i.bufferSize=t.audioBufferSize||131072,i.bufferMode=t.streaming?L.MODE.EVICT:L.MODE.EXPAND,i.sampleRate=0,i}u(t,A);var i=t.prototype;return i.initializeWasmDecoder=function(){this.module.instance?(this.instance=this.module.instance,this.functions=this.module.instance.exports,this.decoder=this.functions._mp2_decoder_create(this.bufferSize,this.bufferMode)):console.warn("JSMpeg: WASM module not compiled yet")},i.destroy=function(){this.decoder&&this.functions._mp2_decoder_destroy(this.decoder)},i.bufferGetIndex=function(){if(this.decoder)return this.functions._mp2_decoder_get_index(this.decoder)},i.bufferSetIndex=function(A){this.decoder&&this.functions._mp2_decoder_set_index(this.decoder,A)},i.bufferWrite=function(A){this.decoder||this.initializeWasmDecoder();for(var t=0,i=0;i>4<<4;this.gl.viewport(0,0,i,this.height)},t.createTexture=function(A,t){var i=this.gl,e=i.createTexture();return i.bindTexture(i.TEXTURE_2D,e),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.uniform1i(i.getUniformLocation(this.program,t),A),e},t.createProgram=function(A,t){var i=this.gl,e=i.createProgram();return i.attachShader(e,this.compileShader(i.VERTEX_SHADER,A)),i.attachShader(e,this.compileShader(i.FRAGMENT_SHADER,t)),i.linkProgram(e),i.useProgram(e),e},t.compileShader=function(A,t){var i=this.gl,e=i.createShader(A);if(i.shaderSource(e,t),i.compileShader(e),!i.getShaderParameter(e,i.COMPILE_STATUS))throw new Error(i.getShaderInfoLog(e));return e},t.allowsClampedTextureData=function(){var A=this.gl,t=A.createTexture();return A.bindTexture(A.TEXTURE_2D,t),A.texImage2D(A.TEXTURE_2D,0,A.LUMINANCE,1,1,0,A.LUMINANCE,A.UNSIGNED_BYTE,new Uint8ClampedArray([0])),0===A.getError()},t.renderProgress=function(A){var t=this.gl;t.useProgram(this.loadingProgram);var i=t.getUniformLocation(this.loadingProgram,"progress");t.uniform1f(i,A),t.drawArrays(t.TRIANGLE_STRIP,0,4)},t.render=function(A,t,i,e){if(this.enabled){var s=this.gl,o=this.width+15>>4<<4,g=this.height,I=o>>1,a=g>>1;e&&this.shouldCreateUnclampedViews&&(A=new Uint8Array(A.buffer),t=new Uint8Array(t.buffer),i=new Uint8Array(i.buffer)),s.useProgram(this.program),this.updateTexture(s.TEXTURE0,this.textureY,o,g,A),this.updateTexture(s.TEXTURE1,this.textureCb,I,a,t),this.updateTexture(s.TEXTURE2,this.textureCr,I,a,i),s.drawArrays(s.TRIANGLE_STRIP,0,4)}},t.updateTexture=function(A,t,i,e,s){var o=this.gl;o.activeTexture(A),o.bindTexture(o.TEXTURE_2D,t),this.hasTextureData[A]?o.texSubImage2D(o.TEXTURE_2D,0,0,0,i,e,o.LUMINANCE,o.UNSIGNED_BYTE,s):(this.hasTextureData[A]=!0,o.texImage2D(o.TEXTURE_2D,0,o.LUMINANCE,i,e,0,o.LUMINANCE,o.UNSIGNED_BYTE,s))},t.deleteTexture=function(A,t){var i=this.gl;i.activeTexture(A),i.bindTexture(i.TEXTURE_2D,null),i.deleteTexture(t)},A.IsSupported=function(){try{if(!window.WebGLRenderingContext)return!1;var A=document.createElement("canvas");return!(!A.getContext("webgl")&&!A.getContext("experimental-webgl"))}catch(A){return!1}},A}();H.SHADER={FRAGMENT_YCRCB_TO_RGBA:["precision mediump float;","uniform sampler2D textureY;","uniform sampler2D textureCb;","uniform sampler2D textureCr;","varying vec2 texCoord;","mat4 rec601 = mat4(","1.16438, 0.00000, 1.59603, -0.87079,","1.16438, -0.39176, -0.81297, 0.52959,","1.16438, 2.01723, 0.00000, -1.08139,","0, 0, 0, 1",");","void main() {","float y = texture2D(textureY, texCoord).r;","float cb = texture2D(textureCb, texCoord).r;","float cr = texture2D(textureCr, texCoord).r;","gl_FragColor = vec4(y, cr, cb, 1.0) * rec601;","}"].join("\n"),FRAGMENT_LOADING:["precision mediump float;","uniform float progress;","varying vec2 texCoord;","void main() {","float c = ceil(progress-(1.0-texCoord.y));","gl_FragColor = vec4(c,c,c,1);","}"].join("\n"),VERTEX_IDENTITY:["attribute vec2 vertex;","varying vec2 texCoord;","void main() {","texCoord = vertex;","gl_Position = vec4((vertex * 2.0 - 1.0) * vec2(1, -1), 0.0, 1.0);","}"].join("\n")};var P=function(){function A(A){A.canvas?(this.canvas=A.canvas,this.ownsCanvasElement=!1):(this.canvas=document.createElement("canvas"),this.ownsCanvasElement=!0),this.width=this.canvas.width,this.height=this.canvas.height,this.enabled=!0,this.context=this.canvas.getContext("2d")}var t=A.prototype;return t.destroy=function(){this.ownsCanvasElement&&this.canvas.remove()},t.resize=function(A,t){this.width=0|A,this.height=0|t,this.canvas.width=this.width,this.canvas.height=this.height,this.imageData=this.context.getImageData(0,0,this.width,this.height),G(this.imageData.data,255)},t.renderProgress=function(A){var t=this.canvas.width,i=this.canvas.height,e=this.context;e.fillStyle="#222",e.fillRect(0,0,t,i),e.fillStyle="#fff",e.fillRect(0,i-i*A,t,i*A)},t.render=function(A,t,i){this.YCbCrToRGBA(A,t,i,this.imageData.data),this.context.putImageData(this.imageData,0,0)},t.YCbCrToRGBA=function(A,t,i,e){if(this.enabled)for(var s,o,g,I,a,B=this.width+15>>4<<4,r=B>>1,C=0,n=B,E=B+(B-this.width),Q=0,h=r-(this.width>>1),d=0,c=4*this.width,l=4*this.width,u=this.width>>1,w=this.height>>1,p=0;p>8)-179,I=(88*o>>8)-44+(183*s>>8)-91,a=o+(198*o>>8)-227;var m=A[C++],f=A[C++];e[d]=m+g,e[d+1]=m-I,e[d+2]=m+a,e[d+4]=f+g,e[d+5]=f-I,e[d+6]=f+a,d+=8;var y=A[n++],R=A[n++];e[c]=y+g,e[c+1]=y-I,e[c+2]=y+a,e[c+4]=R+g,e[c+5]=R-I,e[c+6]=R+a,c+=8}C+=E,n+=E,d+=l,c+=l,Q+=h}},A}(),O=function(){function A(){this.context=A.CachedContext=A.CachedContext||new(window.AudioContext||window.webkitAudioContext),this.gain=this.context.createGain(),this.destination=this.gain,this.gain.connect(this.context.destination),this.context._connections=(this.context._connections||0)+1,this.startTime=0,this.buffer=null,this.wallclockStartTime=0,this.volume=1,this.enabled=!0,this.unlocked=!A.NeedsUnlocking(),Object.defineProperty(this,"enqueuedTime",{get:this.getEnqueuedTime})}var t=A.prototype;return t.destroy=function(){this.gain.disconnect(),this.context._connections--,0===this.context._connections&&(this.context.close(),A.CachedContext=null)},t.play=function(A,t,i){if(this.enabled){if(!this.unlocked){var e=S();return this.wallclockStartTimethis.memory.buffer.byteLength){var i=this.brk-this.memory.buffer.byteLength,e=Math.ceil(i/this.pageSize);this.memory.grow(e),this.createHeapViews()}return t},t.c_abort=function(A){console.warn("JSMPeg: WASM abort",arguments)},t.c_assertFail=function(A){console.warn("JSMPeg: WASM ___assert_fail",arguments)},t.readDylinkSection=function(A){var t=new Uint8Array(A),i=0,e=function(){for(var A=0,e=1;;){var s=t[i++];if(A+=(127&s)*e,e*=128,!(128&s))return A}},s=function(A){for(var e=0;ethis.maxAudioLag&&(this.audioOut.resetEnqueuedTime(),this.audioOut.enabled=!1),A=this.audio.decode()}while(A);this.audioOut.enabled=!0}},t.updateForStaticFile=function(){var A=!1,t=0;if(this.audio&&this.audio.canPlay){for(;!A&&this.audio.decodedTime-this.audio.currentTime<.25;)A=!this.audio.decode();this.video&&this.video.currentTime0&&(e>2*s&&(this.startTime+=e),A=!this.video.decode()),t=this.demuxer.currentTime-i}this.source.resume(t),A&&this.source.completed?this.loop?this.seek(0):(this.stop(),this.options.onEnded&&this.options.onEnded(this)):A&&this.options.onStalled&&this.options.onStalled(this)},A}(),W={Player:X,VideoElement:b,BitBuffer:L,Source:{Ajax:M,AjaxProgressive:q,WebSocket:N,Fetch:function(){function A(A,t){this.url=A,this.destination=null,this.request=null,this.streaming=!0,this.completed=!1,this.established=!1,this.progress=0,this.aborted=!1,this.onEstablishedCallback=t.onSourceEstablished,this.onCompletedCallback=t.onSourceCompleted,t.hookOnEstablished&&(this.hookOnEstablished=t.hookOnEstablished)}var t=A.prototype;return t.connect=function(A){this.destination=A},t.start=function(){var A=this,t={method:"GET",headers:new Headers,cache:"default"};self.fetch(this.url,t).then((function(t){if(t.ok&&t.status>=200&&t.status<=299)return A.progress=1,A.established=!0,A.pump(t.body.getReader())})).catch((function(A){throw A}))},t.pump=function(A){var t=this;return A.read().then((function(i){if(!i.done)return t.aborted?A.cancel():(t.destination&&t.destination.write(i.value.buffer),t.pump(A));t.completed=!0})).catch((function(A){throw A}))},t.resume=function(){},t.abort=function(){this.aborted=!0},A}()},Demuxer:{TS:U},Decoder:{Base:J,MPEG1Video:T,MPEG1VideoWASM:v,MP2Audio:x,MP2AudioWASM:Y},Renderer:{WebGL:H,Canvas2D:P},AudioOutput:{WebAudio:O},WASMModule:K,Now:S,CreateVideoElements:function(){for(var A=document.querySelectorAll(".jsmpeg"),t=0;tthis.q=A))}resume(){this.q?.(),this.Z=this.q=void 0}} +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const V=A=>!e(A)&&"function"==typeof A.then,z=1073741823;const $=A(class extends t{constructor(){super(...arguments),this._$Cwt=z,this._$Cbt=[],this._$CK=new Z(this),this._$CX=new j}render(...A){return A.find((A=>!V(A)))??i}update(A,t){const e=this._$Cbt;let s=e.length;this._$Cbt=t;const o=this._$CK,g=this._$CX;this.isConnected||this.disconnected();for(let A=0;Athis._$Cwt);A++){const i=t[A];if(!V(i))return this._$Cwt=A,i;A{for(;g.get();)await g.get();const t=o.deref();if(void 0!==t){const e=t._$Cbt.indexOf(i);e>-1&&e{let i=!1;const e=new W.VideoElement(this,A,{canvas:this._jsmpegCanvasElement},{pauseWhenHidden:!1,autoplay:!1,protocols:[],audio:!1,videoBufferSize:4194304,preserveDrawingBuffer:!0,...this.cameraConfig?.jsmpeg?.options,reconnectInterval:0,onVideoDecode:()=>{!i&&this._jsmpegCanvasElement&&(i=!0,t(e))},onPlay:()=>g(this),onPause:()=>I(this)})})),this._jsmpegCanvasElement&&a(this,this._jsmpegCanvasElement,{player:this,capabilities:{supportsPause:!0},technology:["jsmpeg"]})}_resetPlayer(){if(this._refreshPlayerTimer.stop(),this._jsmpegVideoPlayer){try{this._jsmpegVideoPlayer.destroy()}catch(A){}this._jsmpegVideoPlayer=void 0}this._jsmpegCanvasElement&&(this._jsmpegCanvasElement.remove(),this._jsmpegCanvasElement=void 0)}connectedCallback(){super.connectedCallback(),this.isConnected&&this.requestUpdate()}disconnectedCallback(){this.isConnected||this._resetPlayer(),super.disconnectedCallback()}async _refreshPlayer(){if(!this.hass)return;this._resetPlayer(),this._jsmpegCanvasElement=document.createElement("canvas"),this._jsmpegCanvasElement.className="media";const A=this.cameraEndpoints?.jsmpeg;if(!A)return B(this,r("error.live_camera_no_endpoint"),{context:this.cameraConfig});const t=await c(this,this.hass,A,86400);t&&(await this._createJSMPEGPlayer(t),this._refreshPlayerTimer.start(82800,(()=>this.requestUpdate())))}render(){return C`${$((async()=>(await this._refreshPlayer(),this._jsmpegVideoPlayer&&this._jsmpegCanvasElement?C`${this._jsmpegCanvasElement}`:B(this,r("error.jsmpeg_no_player"))))(),n({cardWideConfig:this.cardWideConfig}))}`}static get styles(){return E(":host {\n width: 100%;\n height: 100%;\n display: flex;\n}\n\ncanvas {\n display: block;\n width: 100%;\n height: 100%;\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}")}};Q([h({attribute:!1})],AA.prototype,"cameraConfig",void 0),Q([h({attribute:!1})],AA.prototype,"cameraEndpoints",void 0),Q([h({attribute:!1})],AA.prototype,"cardWideConfig",void 0),AA=Q([d("frigate-card-live-jsmpeg")],AA);export{AA as FrigateCardLiveJSMPEG}; diff --git a/config/www/community/frigate-hass-card/jsmpeg-fd152ef0.js.gz b/config/www/community/frigate-hass-card/jsmpeg-fd152ef0.js.gz new file mode 100644 index 00000000..04e53e2f Binary files /dev/null and b/config/www/community/frigate-hass-card/jsmpeg-fd152ef0.js.gz differ diff --git a/config/www/community/frigate-hass-card/lang-ca-449daa4a.js b/config/www/community/frigate-hass-card/lang-ca-449daa4a.js new file mode 100644 index 00000000..f31ba121 --- /dev/null +++ b/config/www/community/frigate-hass-card/lang-ca-449daa4a.js @@ -0,0 +1 @@ +var e={frigate_card:"Tarjeta Frigate",frigate_card_description:"Una targeta Lovelace per a utilitzar amb Frigate",live:"En directe",no_media:"No hi ha suport per mostrar",recordings:"Enregistraments",version:"Versió"},a={cameras:{camera_entity:"Entitat de càmera",capabilities:{capabilities:{clips:"","favorite-events":"","favorite-recordings":"",live:"",menu:"",ptz:"",recordings:"",seek:"",snapshots:"",substream:""},disable:"",disable_except:"",editor_label:""},cast:{dashboard:{dashboard_path:"Ruta del tauler de control",view_path:"Ruta de la visualització"},editor_label:"Opcions d'emissió",method:"Mètode d'emissió",methods:{dashboard:"Tauler de control",standard:"Estàndard"}},dependencies:{all_cameras:"Mostra els esdeveniments de totes les càmeres amb aquesta càmera",cameras:"Mostra esdeveniments per a càmeres específiques amb aquesta càmera",editor_label:"Opcions de dependències"},dimensions:{aspect_ratio:"Relació d'aspecte estàtica",editor_label:"Dimensions de la càmera",layout:{editor_label:"Maquetació de la càmera",fit:"Ajust de la maquetació",fits:{contain:"Els mitjans multimèdia estan continguts/en bústia",cover:"El suport s'expandeix proporcionalment per cobrir la targeta",fill:"El suport s'estira per omplir la targeta"},pan:{x:"",y:""},position:{editor_label:"",x:"Percentatge d'emplaçament horitzontal",y:"Percentatge d'emplaçament vertical"},view_box:{bottom:"",editor_label:"",left:"",right:"",top:""},zoom:""}},engines:{editor_label:"Opcions del motor de càmera"},frigate:{camera_name:"Nom de la càmera de Frigate (detecció automàtica de l'entitat)",client_id:"Identificador de client de Frigate (per a > 1 servidor de Frigate)",editor_label:"Opcions de Frigate",labels:"Etiquetes de Frigate/filtres d'objectes",url:"URL del servidor de Frigate",zones:"Zones de Frigate"},go2rtc:{editor_label:"Opcions de go2rtc",modes:{editor_label:"Modes de go2rtc",mjpeg:"",mp4:"",mse:"",webrtc:""},stream:"nom del flux de go2rtc"},icon:"Icona d'aquesta càmera (detecció automàtica des de l'entitat)",id:"Identificador únic per a aquesta càmera en aquesta targeta",image:{editor_label:"Opcions d'imatge",refresh_seconds:"Nombre de segons després dels quals actualitzar la imatge en directe (0=mai)",url:"URL de la imatge que cal utilitzar en lloc de la instantània de l'entitat de la càmera"},live_provider:"Proveïdor de visualització en directe per a aquesta càmera",live_provider_options:{editor_label:"Opcions de proveïdor en directe"},live_providers:{auto:"Automàtic",go2rtc:"",ha:"Transmissió de vídeo de Home Assistant (és a dir, HLS, LL-HLS, WebRTC mitjançant HA)",image:"Imatges de Home Assistant",jsmpeg:"","webrtc-card":"Targeta WebRTC (és a dir, la targeta WebRTC d'AlexxIT)"},motioneye:{editor_label:"Opcions de MotionEye",images:{directory_pattern:"Patró del directori d'imatges",file_pattern:"Patró de fitxer d'imatges"},movies:{directory_pattern:"Patró del directori de pel·lícules",file_pattern:"Patró de fitxer de pel·lícules"},url:"URL de la interfície d'usuari de MotionEye"},proxy:{dynamic:"",editor_label:"",media:{auto:"",editor_label:"",false:"",true:""},ssl_ciphers:{auto:"",default:"",editor_label:"",insecure:"",intermediate:"",modern:""},ssl_verification:{auto:"",editor_label:"",false:"",true:""}},reolink:{editor_label:"",media_resolution:{editor_label:"",high:"",low:""},url:""},title:"Títol d'aquesta càmera (detecció automàtica de l'entitat)",triggers:{editor_label:"Opcions d'activació",entities:"Activador d'altres entitats",events:{clips:"Esdeveniments amb nous clips",editor_label:"Activar esdeveniments",events:"Tots els esdeveniments",snapshots:"Esdeveniments amb noves instantànies"},motion:"Activa la detecció automàtica del sensor de moviment",occupancy:"Activa la detecció automàtica del sensor d'ocupació"},webrtc_card:{editor_label:"Opcions de la targeta WebRTC",entity:"Entitat de càmera de targeta WebRTC (no una càmera de Frigate)",url:"URL de la càmera de la targeta WebRTC"}},common:{controls:{builtin:"Controls de vídeo integrats",filter:{editor_label:"Filtre multimèdia",mode:"Mode de filtre",modes:{left:"Filtre multimèdia en un calaix a l'esquerra",none:"Sense filtre multimèdia",right:"Filtre multimèdia en un calaix a la dreta"}},next_previous:{editor_label:"Següent i anterior",size:"Mida del control següent i anterior en píxels",style:"Estil de control següent i anterior",styles:{chevrons:"Xebrons",icons:"Icones",none:"Cap",thumbnails:"Miniatures"}},thumbnails:{editor_label:"Miniatures",events_media_type:"Si voleu mostrar miniatures d'esdeveniments de clips o instantànies",events_media_types:{clips:"Miniatures de clips",snapshots:"Miniatures d'instantànies"},media_type:"Si voleu mostrar miniatures d'esdeveniments o enregistraments",media_types:{events:"Esdeveniments",recordings:"Enregistraments"},mode:"Mode de miniatures",modes:{above:"Miniatures a dalt",below:"Miniatures a baix",left:"Miniatures en un calaix a l'esquerra",none:"Sense miniatures",right:"Miniatures en un calaix a la dreta"},show_details:"Mostra els detalls amb miniatures",show_download_control:"Mostra el control de descàrrega a les miniatures",show_favorite_control:"Mostra el control preferit a les miniatures",show_timeline_control:"Mostra el control de la línia de temps a les miniatures",size:"Mida de les miniatures en píxels"},timeline:{editor_label:"Mini cronologia",mode:"Mode",modes:{above:"A dalt",below:"Baix",none:"Cap"},pan_mode:"Mode d'escombratge predeterminat",pan_modes:{pan:"Escombratge",seek:"Cerca d'escombratge en tots els mitjans","seek-in-camera":"Cerca d'escombratge només a la càmera seleccionada","seek-in-media":"Cerca d'escombratge només dins de l'element multimèdia seleccionat"}}},display:{editor_label:"Visualització",grid_columns:"Nombre exacte de columnes de la graella",grid_max_columns:"Nombre màxim de columnes de la graella",grid_selected_width_factor:"Augmenta l'amplada del suport multimèdia seleccionat en aquest factor",mode:"Mode"},image:{entity:"",entity_parameters:"",mode:"Mode de visualització d'imatges",modes:{camera:"Instantània de l'entitat de la càmera de Home Assistant",entity:"",screensaver:"Logotip de Frigate incrustat",url:"Imatge arbitrària especificada per URL"},refresh_seconds:"Nombre de segons després dels quals cal actualitzar (0=mai)",url:"URL d'imatge estàtica per a la visualització d'imatges"},media_action_conditions:{all:"Totes les oportunitats",hidden:"A l'amagat del navegador/pestanya",microphone_mute:"Si el micròfon està en silenci",microphone_unmute:"Si el micròfon no està en silenci",never:"Mai",selected:"A la selecció",unselected:"En desselecció",visible:"En la visualització del navegador/pestanya"},timeline:{clustering_threshold:"El recompte d'esdeveniments en què s'agrupen (0=sense agrupació)",events_media_type:"Els esdeveniments multimèdia que mostra la línia de temps",events_media_types:{all:"Tots els tipus de mitjans",clips:"Clips",snapshots:"Imatges instantànies"},show_recordings:"Mostra les gravacions",style:"Estil de cronologia",styles:{ribbon:"Esdeveniments en una sola cinta",stack:"Esdeveniments apilats i agrupats"},window_seconds:"La durada predeterminada de la visualització de la línia de temps en segons"}},dimensions:{aspect_ratio:"Relació d'aspecte predeterminada (p. ex., '16:9')",aspect_ratio_mode:"Mode de relació d'aspecte",aspect_ratio_modes:{dynamic:"La relació d'aspecte s'ajusta al suport multimèdia",static:"Relació d'aspecte estàtica",unconstrained:"Relació d'aspecte sense restriccions"},height:""},live:{auto_mute:"Silencia automàticament les càmeres en directe",auto_pause:"Posa en pausa automàticament les càmeres en directe",auto_play:"Reprodueix automàticament les càmeres en directe",auto_unmute:"Activa automàticament el so de les càmeres en directe",controls:{editor_label:"Controls del directe",ptz:{editor_label:"PTZ",hide_home:"Amaga el control de casa",hide_pan_tilt:"Amaga el control d'escombratge i inclinació",hide_zoom:"Amaga el control de zoom",mode:"Mode",modes:{off:"Desactivat",on:"Activat"},orientation:"Orientació",orientations:{horizontal:"Horitzontal",vertical:"Vertical"},position:"Posició",positions:{"bottom-left":"Inferior esquerra","bottom-right":"Inferior dreta","top-left":"Superior left","top-right":"Superior dreta"}}},draggable:"La vista de càmeres en directe es pot arrossegar/lliscar",lazy_load:"Les càmeres en directe es carreguen amb mandra",lazy_unload:"Les càmeres en directe es descarreguen amb mandra",microphone:{always_connected:"Mantingueu sempre el micròfon connectat",disconnect_seconds:"Segons després dels quals desconnectar el micròfon (0=mai)",editor_label:"Micròfon",enabled:"El micròfon està activat",mute_after_microphone_mute_seconds:"Segons després de silenciar el micròfon per silenciar l'àudio entrant"},preload:"Carregueu prèviament la visualització en directe en segon pla",show_image_during_load:"Mostra la imatge fixa mentre es carrega la reproducció en directe",transition_effect:"Efecte de transició de càmera en directe",zoomable:"Les càmeres en directe es poden ampliar/escombrar"},media_viewer:{auto_mute:"Silencia automàticament els continguts multimèdia",auto_pause:"Atura automàticament el contingut multimèdia",auto_play:"Reprodueix automàticament els continguts multimèdia",auto_unmute:"Activa automàticament el so del contingut multimèdia",controls:{editor_label:"Controls del visualitzador de contingut multimèdia"},draggable:"El visualitzador de mitjans es pot arrossegar/lliscar",lazy_load:"El contingut multimèdia del visualitzador multimèdia es carreguen amb mandra al carrusel",snapshot_click_plays_clip:"Si feu clic a una instantània, es reprodueix un clip relacionat",transition_effect:"Efecte de transició del visualitzador multimèdia",transition_effects:{none:"Sense transició",slide:"Transició de diapositives"},zoomable:"El visualitzador de mitjans es pot ampliar/escombrar"},menu:{alignment:"Alineació del menú",alignments:{bottom:"Alineat a la part inferior",left:"Alineat a l'esquerra",right:"Alineat a la dreta",top:"Alineat a la part superior"},button_size:"Mida del botó del menú en píxels",buttons:{alignment:"Alineació de botons",alignments:{matching:"Coincideix amb l'alineació del menú",opposing:"Oposat a l'alineació del menú"},camera_ui:"Interfície d'usuari de la càmera",cameras:"Càmeres",clips:"Clips",display_mode:"Mode de visualització",download:"Descarregar",enabled:"Botó habilitat",expand:"Expandir",frigate:"Menú de Frigate / Vista per defecte",fullscreen:"Pantalla completa",icon:"Icona",image:"Imatge",live:"En directe",media_player:"Envia al reproductor multimèdia",microphone:"Micròfon",mute:"Silenciar / Activar el so",permanent:"",play:"Reproduir / Pausa",priority:"Prioritat",ptz_controls:"",ptz_home:"",recordings:"Enregistraments",screenshot:"Captura de pantalla",snapshots:"Imatges instantànies",substreams:"Subfluxos",timeline:"Cronologia",type:"Tipus de botó",types:{momentary:"Momentani",toggle:"Commuta"}},position:"Posició del menú",positions:{bottom:"Situat a la part inferior",left:"Situat a l'esquerra",right:"Situat a la dreta",top:"Situat a la part superior"},style:"Estil de menú",styles:{hidden:"Menú ocult",hover:"Menú passant el cursor","hover-card":"Menú passant el cursor (a tota la targeta)",none:"Sense menú",outside:"Menú exterior",overlay:"Menú superposat"}},overrides:{info:"Aquesta configuració de targeta ha especificat manualment substitucions configurades que poden anul·lar els valors que es mostren a l'editor visual; consulteu l'editor de codi per veure/modificar aquestes substitucions."},performance:{features:{animated_progress_indicator:"Indicador animat del progrés",editor_label:"Opcions de característiques",max_simultaneous_engine_requests:"",media_chunk_size:"Mida del fragment multimèdia"},style:{border_radius:"Corbes",box_shadow:"Ombres",editor_label:"Opcions d'estil"},warning:"Aquesta targeta està en mode de perfil baix, de manera que els valors predeterminats han canviat per optimitzar el rendiment"},profiles:{casting:"",editor_label:"","low-performance":"",scrubbing:""},status_bar:{height:"",items:{enabled:"",engine:"",live_provider:"",priority:"",resolution:"",technology:"",title:""},popup_seconds:"",position:"",positions:{bottom:"",top:""},style:"",styles:{hover:"","hover-card":"",none:"",outside:"",overlay:"",popup:""}},view:{camera_select:"Visualitza les càmeres seleccionades recentment",dark_mode:"Mode fosc",dark_modes:{auto:"Automàtic",off:"Desactivat",on:"Activat"},default:"Vista per defecte",default_cycle_camera:"Passeu per les càmeres quan s'actualitzi la vista predeterminada",default_reset:{after_interaction:"Restableix la vista predeterminada després de la interacció de l'usuari",editor_label:"",entities:"",every_seconds:"Actualitza la vista predeterminada cada X segons (0=mai)",interaction_mode:"",interaction_modes:{active:"",all:"",inactive:""}},interaction_seconds:"Segons després de l'acció de l'usuari per continuar interactuant (0=mai)",keyboard_shortcuts:{editor_label:"",enabled:"",ptz_down:"",ptz_home:"",ptz_left:"",ptz_right:"",ptz_up:"",ptz_zoom_in:"",ptz_zoom_out:""},triggers:{actions:{editor_label:"Activar accions",interaction_mode:"Com gestionar les accions quan la targeta té interacció humana",interaction_modes:{active:"Activa només accions quan la targeta té interacció humana",all:"Activa accions independentment de la interacció humana",inactive:"Només activa accions quan la targeta no té interacció humana"},trigger:"Activar l'acció",triggers:{default:"Canvia o actualitza la vista predeterminada",live:"Canvia o actualitza la visualització en directe",media:"Canvieu a la visualització de mitjans rellevants per als nous mitjans",none:"Sense acció"},untrigger:"Desactiva l'acció",untriggers:{default:"Canvia a la vista/càmera predeterminada",none:"Sense acció"}},editor_label:"Comportament quan s'activa una càmera",filter_selected_camera:"Activa només a la càmera seleccionada",show_trigger_status:"Mostra la vora intermitent quan s'activa",untrigger_seconds:"Segons després del canvi d'estat inactiu a desactivat"},views:{clip:"Clip més recent",clips:"Galeria de clips",current:"Vista actual",image:"Imatge estàtica",live:"Visualització en directe",recording:"Enregistrament més recent",recordings:"Galeria d'enregistraments",snapshot:"Instantània més recent",snapshots:"Galeria d'instantànies",timeline:"Vista cronològica"}}},i={grid:"Mostra el visualitzador multimèdia per a cada càmera d'una quadrícula",single:"Mostra un visualitzador multimèdia únic"},t={add_new_camera:"Afegeix una càmera nova",button:"Botó",camera:"Càmera",cameras:"Càmeres",cameras_secondary:"Quines càmeres renderitzar en aquesta targeta",delete:"Suprimeix",dimensions:"Dimensions",dimensions_secondary:"Opcions de dimensions i forma",image:"Imatge",image_secondary:"Opcions de visualització d'imatges estàtiques",live:"En directe",live_secondary:"Opcions de visualització de la càmera en directe",media_gallery:"Galeria multimèdia",media_gallery_secondary:"Opcions de la galeria multimèdia",media_viewer:"Visor multimèdia",media_viewer_secondary:"Visor de suports estàtics (clips, instantànies o enregistraments)",menu:"Menú",menu_secondary:"Opcions d'aspecte del menú",move_down:"Moure cap avall",move_up:"Moure cap amunt",overrides:"Les substitucions estan actives",overrides_secondary:"S'han detectat substitucions de configuració dinàmica",performance:"Rendiment",performance_secondary:"Opcions de rendiment de la targeta",profiles:"",profiles_secondary:"",status_bar:"",status_bar_secondary:"",timeline:"Cronologia",timeline_secondary:"Opcions de la cronologia d'esdeveniments",upgrade:"Upgrade",upgrade_available:"Hi ha disponible una actualització automàtica de la configuració de la targeta",view:"Vista",view_secondary:"Què ha de mostrar la targeta i com mostrar-la"},r={ptz:{down:"Avall",home:"Casa",left:"Esquerra",right:"Dreta",up:"Amunt",zoom_in:"Ampliar",zoom_out:"Reduir"}},s={awaiting_live:"S'està esperant que es carregui la transmissió en directe ...",awaiting_media:"",camera_initialization:"",camera_initialization_reolink:"",could_not_render_elements:"No s'han pogut representar els elements de la imatge",could_not_resolve:"No s'ha pogut resoldre l'URL multimèdia",diagnostics:"Diagnòstic de targetes. Reviseu la informació confidencial abans de compartir-la",download_no_media:"No hi ha contingut multimèdia per descarregar",download_sign_failed:"No s'ha pogut signar l'URL multimèdia per baixar-la",duplicate_camera_id:"Duplica l'identificador de la càmera Frigate per a la següent càmera, utilitza el paràmetre 'id' per identificar les càmeres de manera única",empty_response:"S'ha rebut una resposta buida de Home Assistant per a la sol·licitud",failed_response:"No s'ha pogut rebre la resposta de Home Assistant per a la sol·licitud",failed_retain:"No s'ha pogut retenir l'esdeveniment",failed_sign:"No s'ha pogut signar l'URL de Home Assistant",image_load_error:"No s'ha pogut carregar la imatge",invalid_configuration:"Configuració no vàlida",invalid_configuration_no_hint:"No hi ha cap indicació d'ubicació disponible (tipus dolent o faltant?)",invalid_configuration_override:"",invalid_elements_config:"La configuració dels elements de la imatge no és vàlida",invalid_response:"S'ha rebut una resposta no vàlida de Home Assistant per a la sol·licitud",jsmpeg_no_player:"No s'ha pogut iniciar el reproductor JSMPEG",live_camera_no_endpoint:"No s'ha pogut obtenir el punt final de la càmera per a aquest proveïdor en directe (configuració incompleta?)",live_camera_not_found:"No s'ha trobat la 'camera_entity' (entitat de la càmera) configurada",live_camera_unavailable:"Càmera no disponible",no_camera_engine:"No s'ha pogut determinar el motor adequat per a la càmera",no_camera_entity:"No s'ha pogut trobar l'entitat de la càmera",no_camera_entity_for_triggers:"Es requereix una entitat de càmera per detectar automàticament els activadors",no_camera_id:"No s'ha pogut determinar l'identificador de la càmera per a la següent càmera, és possible que hagis d'establir el paràmetre 'id' manualment",no_camera_name:"No s'ha pogut determinar el nom de la càmera Frigate per a la càmera (o una de les seves dependències), especifiqueu 'camera_entity' o 'camera_name'",no_dashboard_or_view:"Tant els paràmetres 'dashboard_path' com 'view_path' són necessaris per al mètode d'emissió 'dashboard'",no_live_camera:"El paràmetre 'camera_entity' s'ha de configurar i validar per a aquest proveïdor en directe",no_supported_camera:"",no_supported_cameras:"",reconnecting:"Reconnectant",too_many_automations:"Hi ha massa trucades d'automatització imbricades, comproveu la vostra configuració per veure si hi ha bucles",troubleshooting:"Comproveu la resolució de problemes",unknown:"Error desconegut",upgrade_available:"Hi ha disponible una actualització automàtica de la configuració de la targeta; visiteu l'editor de targetes visuals",webrtc_card_reported_error:"La targeta WebRTC ha informat d'un error",webrtc_card_waiting:"S'està esperant que es carregui la targeta WebRTC ..."},n={camera:"Càmera",duration:"Durada",in_progress:"En procés",score:"Puntuació",seek:"Buscar",start:"Començar",tag:"Etiqueta",what:"Què",where:"On"},o={assign:"",assigning:"",modifiers:{alt:"",ctrl:"",meta:"",shift:""},unassign:""},l={all:"Tots",camera:"Càmera",favorite:"Preferit",media_type:"Tipus de suport multimèdia",media_types:{clips:"Clips",recordings:"Enregistraments",snapshots:"Imatges instantànies"},not_favorite:"No preferit",select_camera:"Selecciona la càmera...",select_favorite:"Selecciona el preferit...",select_media_type:"Selecciona el tipus de suport multimèdia...",select_tag:"Selecciona l'etiqueta...",select_what:"Selecciona el què...",select_when:"Selecciona quan...",select_where:"Selecciona on...",tag:"Etiqueta",what:"Què",when:"Quan",whens:{custom:"Personalitzat",past_month:"El mes passat",past_week:"La setmana passada",today:"Avui",yesterday:"Ahir"},where:"On"},d={unseekable:"Busqueu temps no trobat als mitjans multimèdia"},c={camera:"Càmera",duration:"Durada",events:"Esdeveniments",in_progress:"En procés",seek:"Buscar",start:"Començar"},m={download:"Descarregar mitjans multimèdia",no_thumbnail:"No hi ha cap miniatura disponible",retain_indefinitely:"Els mitjans multimèdia es conservaran indefinidament",timeline:"Veure els mitjans multimèdia a la línia de temps"},u={select_date:"Escolliu la data"},p={common:e,config:a,display_modes:i,editor:t,elements:r,error:s,event:n,key_assigner:o,media_filter:l,media_viewer:d,recording:c,thumbnail:m,timeline:u};export{e as common,a as config,p as default,i as display_modes,t as editor,r as elements,s as error,n as event,o as key_assigner,l as media_filter,d as media_viewer,c as recording,m as thumbnail,u as timeline}; diff --git a/config/www/community/frigate-hass-card/lang-ca-449daa4a.js.gz b/config/www/community/frigate-hass-card/lang-ca-449daa4a.js.gz new file mode 100644 index 00000000..2ed7928c Binary files /dev/null and b/config/www/community/frigate-hass-card/lang-ca-449daa4a.js.gz differ diff --git a/config/www/community/frigate-hass-card/lang-fr-674e5de5.js b/config/www/community/frigate-hass-card/lang-fr-674e5de5.js new file mode 100644 index 00000000..b8f2fa9e --- /dev/null +++ b/config/www/community/frigate-hass-card/lang-fr-674e5de5.js @@ -0,0 +1 @@ +var e={frigate_card:"Carte Frigate",frigate_card_description:"Une carte Lovelace à utiliser avec Frigate",live:"En direct",no_media:"Aucun média à afficher",recordings:"Enregistrements",version:"Version"},a={cameras:{camera_entity:"Entité caméra",capabilities:{capabilities:{clips:"Clips","favorite-events":"Événements favoris","favorite-recordings":"Enregistrements favoris",live:"Vue en direct",menu:"Menu",ptz:"PTZ",recordings:"Enregistrements",seek:"Chercher",snapshots:"Snapshots",substream:"flux secondaire"},disable:"Désactiver",disable_except:"Désactive sauf",editor_label:"Capacités de la caméra"},cast:{dashboard:{dashboard_path:"Chemin du tableau de bord",view_path:"Voir le chemin"},editor_label:"Cast les options",method:"Cast les méthodes",methods:{dashboard:"Dashboard",standard:"Standard"}},dependencies:{all_cameras:"Afficher les événements pour toutes les caméras avec cette caméra",cameras:"Afficher les événements pour des caméras spécifiques avec cette caméra",editor_label:"Options de dépendance"},dimensions:{aspect_ratio:"ratio d'aspect",editor_label:"Dimensions de la caméra",layout:{editor_label:"Disposition de la caméra",fit:"Ajustement de la disposition",fits:{contain:"Le média est contenu",cover:"Le média s'étend proportionnellement pour couvrir la carte",fill:"Le média est étiré pour remplir la carte"},pan:{x:"",y:""},position:{editor_label:"",x:"Pourcentage de positionnement horizontal",y:"Pourcentage de positionnement vertical"},view_box:{bottom:"",editor_label:"",left:"",right:"",top:""},zoom:""}},engines:{editor_label:"Options du moteur de caméra"},frigate:{camera_name:"Nom de la caméra de la frégate (détecté automatiquement par l'entité)",client_id:"ID client Frigate (pour plus 1 d'un serveur Frigate)",editor_label:"Options de Frigate",labels:"Étiquettes de Frigate/filtres d'objets",url:"URL du serveur Frigate",zones:"Zones Frigate"},go2rtc:{editor_label:"Options go2rtc",modes:{editor_label:"Modes go2rtc",mjpeg:"Motion JPEG (MJPEG)",mp4:"MPEG-4 (MP4)",mse:"Extensions de sources multimédias (MSE)",webrtc:"Web Real-Time Communication (WebRTC)"},stream:"nom du flux go2rtc"},icon:"Icône pour cette caméra (auto-détectée par l'entité)",id:"ID unique pour cette caméra dans cette carte",image:{editor_label:"Options d'images",refresh_seconds:"Nombre de secondes après lesquelles actualiser l'image en direct (0=jamais)",url:"URL de l'image à utiliser à la place de l'instantané de l'entité de la caméra"},live_provider:"Fournisseur de visualisation en direct pour cette caméra",live_provider_options:{editor_label:"Options du fournisseur en direct"},live_providers:{auto:"Automatique",go2rtc:"go2rtc",ha:"Flux vidéo Home Assistant (c'est-à-dire HLS, LL-HLS, WebRTC via HA)",image:"Images d'Home Assistant",jsmpeg:"JSMpeg","webrtc-card":"Carte WebRTC (c.-⁠à-⁠d. La cartte WebRTC d'AlexxIT)"},motioneye:{editor_label:"Options de MotionEye",images:{directory_pattern:"Modèle de répertoire d'images",file_pattern:"Modèle de fichier images"},movies:{directory_pattern:"Modèle de répertoire de films",file_pattern:"Modèle de fichier de films"},url:"URL de l’interface MotionEye"},proxy:{dynamic:"",editor_label:"",media:{auto:"",editor_label:"",false:"",true:""},ssl_ciphers:{auto:"",default:"",editor_label:"",insecure:"",intermediate:"",modern:""},ssl_verification:{auto:"",editor_label:"",false:"",true:""}},reolink:{editor_label:"",media_resolution:{editor_label:"",high:"",low:""},url:""},title:"Titre de cette caméra (détection automatique à partir de l'entité)",triggers:{editor_label:"Modèle de répertoire des films",entities:"Déclencheur à partir d'autres entités",events:{clips:"Événements avec de nouveaux clips",editor_label:"Événements déclencheurs",events:"Tous les événements",snapshots:"Événements avec de nouveaux instantanés"},motion:"Déclenchement par détection automatique du capteur de mouvement",occupancy:"Déclenchement par détection automatique du capteur de présence"},webrtc_card:{editor_label:"Options de la carte WebRTC",entity:"Entité de caméra de carte WebRTC (pas une caméra de Frigate)",url:"URL de la caméra de la carte WebRTC"}},common:{controls:{builtin:"Commandes vidéo intégrées",filter:{editor_label:"Filtre multimédia",mode:"Mode de filtre",modes:{left:"Filtre média dans un menu à gauche",none:"Pas de filtre média",right:"Filtre média dans un menu à droite"}},next_previous:{editor_label:"Suivant et précédent",size:"Taille des contrôles suivant et précédent en pixels",style:"Style de contrôle suivant et précédent",styles:{chevrons:"Chevrons",icons:"Icônes",none:"Aucun",thumbnails:"Miniatures"}},thumbnails:{editor_label:"Miniatures",events_media_type:"S'il faut afficher des vignettes de clips ou des instantanés",events_media_types:{clips:"Miniatures de clips",snapshots:"Miniatures d'instantanés"},media_type:"Afficher ou non les vignettes des événements ou des enregistrements",media_types:{events:"Événements",recordings:"Enregistrements"},mode:"Mode vignettes",modes:{above:"Miniatures ci-dessus",below:"Miniatures ci-dessous",left:"Miniatures dans un menu à gauche",none:"Aucune vignette",right:"Miniatures dans un menu à droite"},show_details:"Afficher les détails avec des vignettes",show_download_control:"Afficher le contrôle de téléchargement sur les vignettes",show_favorite_control:"Afficher le contrôle favori sur les vignettes",show_timeline_control:"Afficher le contrôle de la chronologie sur les vignettes",size:"Taille des vignettes en pixels"},timeline:{editor_label:"Mini-chronologie",mode:"Mode",modes:{above:"Au-dessus",below:"En dessous",none:"Aucun"},pan_mode:"Mode panoramique par défaut",pan_modes:{pan:"Pan",seek:"Pan cherche parmi toutes les caméras","seek-in-camera":"Pan ne cherche que parmi la caméra sélectionnée","seek-in-media":"Pan ne cherche que parmi les médias sélectionnés"}}},display:{editor_label:"Affichage",grid_columns:"Nombre de colonnes de la grille",grid_max_columns:"Nombre maximum de colonnes de la grille",grid_selected_width_factor:"Augmenter la largeur du média sélectionnée par ce facteur",mode:"Mode"},image:{entity:"",entity_parameters:"",mode:"Mode d'affichage des images",modes:{camera:"Instantané de la caméra Home Assistant de l'entité caméra",entity:"",screensaver:"Logo Frigate intégré",url:"Image arbitraire spécifiée par URL"},refresh_seconds:"Nombre de secondes après lesquelles actualiser (0=jamais)",url:"URL d'image statique pour l'affichage de l'image"},media_action_conditions:{all:"Toutes les opportunités",hidden:"Sur le navigateur/onglet masqué",microphone_mute:"",microphone_unmute:"",never:"Jamais",selected:"Sur sélection",unselected:"Lors de la désélection",visible:"Sur la visibilité du navigateur/onglet"},timeline:{clustering_threshold:"Le nombre d'événements pour lesquels ils sont regroupés (0 = pas de clustering)",events_media_type:"Les médias affichés par la chronologie",events_media_types:{all:"Tous types de médias",clips:"Extraits",snapshots:"Instantanés"},show_recordings:"Afficher les enregistrements",style:"Style de chronologie",styles:{ribbon:"Événements sur un seul ruban",stack:"Événements empilés et groupés"},window_seconds:"La durée par défaut de la vue chronologique en secondes"}},dimensions:{aspect_ratio:"Format d'image par défaut (par exemple '16:9')",aspect_ratio_mode:"Mode rapport hauteur/largeur",aspect_ratio_modes:{dynamic:"Le rapport hauteur/largeur s'adapte au média",static:"Rapport hauteur/largeur statique",unconstrained:"Rapport hauteur/largeur sans contrainte"},height:""},live:{auto_mute:"Couper automatiquement le son des caméras en direct",auto_pause:"Mettre automatiquement en pause les caméras en direct",auto_play:"Lire automatiquement les caméras en direct",auto_unmute:"Activer automatiquement le son des caméras en direct",controls:{editor_label:"Contrôles en direct",ptz:{editor_label:"PTZ",hide_home:"Cacher le bouton d'origine",hide_pan_tilt:"Caher les boutons panoramiques/inclinaison",hide_zoom:"Cahger le bouton de zoom",mode:"Mode",modes:{off:"Eteint",on:"Allumé"},orientation:"",orientations:{horizontal:"",vertical:""},position:"",positions:{"bottom-left":"Bas à gauche","bottom-right":"Bas à droite","top-left":"Haut à gauche","top-right":"haut à droite"}}},draggable:"La vue des caméras en direct peut être glissée/glissée",lazy_load:"Les caméras en direct sont chargeés en différé",lazy_unload:"Les caméras en direct sont déchargés en différé",microphone:{always_connected:"Gardez toujours le microphone connecté",disconnect_seconds:"Secondes après quoi déconnecter le microphone (0=jamais)",editor_label:"Microphone",enabled:"Microphone activé",mute_after_microphone_mute_seconds:""},preload:"Précharger la vue en direct en arrière-plan",show_image_during_load:"Afficher une image fixe pendant le chargement du flux en direct",transition_effect:"Effet de transition de caméra en direct",zoomable:"Les caméras en direct peuvent être zoomées/panoramiques"},media_viewer:{auto_mute:"Couper automatiquement le son des médias",auto_pause:"Mettre automatiquement en pause les médias",auto_play:"Lire automatiquement les médias",auto_unmute:"Activer automatiquement le son des médias",controls:{editor_label:"Commandes de la visionneuse multimédia"},draggable:"La visionneuse multimédia peut être glissée/glissée",lazy_load:"Les médias Media Viewer sont chargés paresseusement dans le carrousel",snapshot_click_plays_clip:"Cliquer sur un instantané lit un clip associé",transition_effect:"Effet de transition de la visionneuse multimédia",transition_effects:{none:"Pas de transition",slide:"Transition de diapositive"},zoomable:"La visionneuse multimédia peut être zoomée/panoramique"},menu:{alignment:"Alignement des menus",alignments:{bottom:"Aligné vers le bas",left:"Aligné à gauche",right:"Aligné à droite",top:"Aligné vers le haut"},button_size:"Taille du bouton de menu en pixels",buttons:{alignment:"Alignement des boutons",alignments:{matching:"Faire correspondre l'alignement du menu",opposing:"S'opposer à l'alignement des menus"},camera_ui:"Interface utilisateur de la caméra",cameras:"Appareils photo",clips:"Extraits",display_mode:"",download:"Télécharger",enabled:"Bouton activé",expand:"Développer",frigate:"Menu Frégate / Vue par défaut",fullscreen:"Plein écran",icon:"Icône",image:"Image",live:"En direct",media_player:"Envoyer au lecteur multimédia",microphone:"Microphone",mute:"Désactiver/Réactiver le son",permanent:"",play:"Jouer / Pause",priority:"Priorité",ptz_controls:"",ptz_home:"",recordings:"Enregistrements",screenshot:"Capture d'écran",snapshots:"Instantanés",substreams:"Sous-flux",timeline:"Chronologie",type:"Type de bouton",types:{momentary:"Momentané",toggle:"Basculer"}},position:"Emplacement des menus",positions:{bottom:"Positionné en bas",left:"Positionné à gauche",right:"Positionné à droite",top:"Positionné en haut"},style:"Style de menu",styles:{hidden:"Menu caché",hover:"Menu survolé","hover-card":"Menu survolé (à l'échelle de la carte)",none:"Pas de menu",outside:"Menu extérieur",overlay:"Menu superposé"}},overrides:{info:"Cette configuration de carte comporte des remplacements spécifiés manuellement et configurés qui peuvent remplacer les valeurs affichées dans l'éditeur visuel. Veuillez consulter l'éditeur de code pour afficher/modifier ces remplacements."},performance:{features:{animated_progress_indicator:"Indicateur de progression animé",editor_label:"Options de fonctionnalités",max_simultaneous_engine_requests:"",media_chunk_size:"Taille du morceau de média"},style:{border_radius:"Courbes",box_shadow:"Ombres",editor_label:"Options de style"},warning:"Cette carte est en mode profil bas, les paramètres par défaut ont donc été modifiés pour optimiser les performances."},profiles:{casting:"",editor_label:"Configuration des profils","low-performance":"Basse performance",scrubbing:"Balayage vidéo"},status_bar:{height:"",items:{enabled:"",engine:"",live_provider:"",priority:"",resolution:"",technology:"",title:""},popup_seconds:"",position:"",positions:{bottom:"",top:""},style:"",styles:{hover:"","hover-card":"",none:"",outside:"",overlay:"",popup:""}},view:{camera_select:"Afficher les caméras nouvellement sélectionnées",dark_mode:"Mode sombre",dark_modes:{auto:"Automatique",off:"Désactivé",on:"Activé"},default:"Vue par défaut",default_cycle_camera:"Parcourez les caméras lorsque la vue par défaut est mise à jour",default_reset:{after_interaction:"",editor_label:"",entities:"",every_seconds:"Actualiser la vue par défaut toutes les X secondes (0=jamais)",interaction_mode:"",interaction_modes:{active:"",all:"",inactive:""}},interaction_seconds:"Secondes après l'action de l'utilisateur pour maintenir l'interaction (0=jamais)",keyboard_shortcuts:{editor_label:"",enabled:"",ptz_down:"",ptz_home:"",ptz_left:"",ptz_right:"",ptz_up:"",ptz_zoom_in:"",ptz_zoom_out:""},triggers:{actions:{editor_label:"Actions de déclenchement",interaction_mode:"Comment gérer les actions lorsque la carte comporte une interaction humaine ?",interaction_modes:{active:"Ne déclencher des actions que lorsque la carte a une interaction humaine",all:"Déclencher des actions sans interaction humaine",inactive:"Ne déclencher des actions que lorsque la carte n'a pas d'interaction humaine"},trigger:"Actions de déclenchement",triggers:{default:"Changement ou mise à jour de la vue par défaut",live:"Change ou met a jour la vue en direct",media:"Changement d'affichage pour les nouveaux médias",none:"Pas d'acction"},untrigger:"Action de désactivation",untriggers:{default:"Passage à la vue/caméra par défaut",none:"Pas d'action"}},editor_label:"Comportement en cas de déclenchement d'une caméra",filter_selected_camera:"Déclenchement uniquement sur la caméra sélectionnée",show_trigger_status:"Afficher la bordure clignotante lors du déclenchement",untrigger_seconds:"Quelques secondes après le changement d'état inactif pour débloquer"},views:{clip:"Clip le plus récent",clips:"Galerie de clips",current:"Vue actuelle",image:"Image statique",live:"Vue en direct",recording:"Enregistrement le plus récent",recordings:"Galerie d'enregistrements",snapshot:"Instantané le plus récent",snapshots:"Galerie d'instantanés",timeline:"Vue chronologique"}}},t={grid:"Afficher la visionneuse de médias pour chaque caméra d'une grille",single:"Affi une seule visionneuse"},i={add_new_camera:"Ajouter une nouvelle caméra",button:"Bouton",camera:"Caméra",cameras:"Caméras",cameras_secondary:"Quelles caméras afficher sur cette carte",delete:"Supprimer",dimensions:"Dimensions",dimensions_secondary:"Options de dimensions et de forme",image:"Image",image_secondary:"Options d'affichage d'image statique",live:"En direct",live_secondary:"Options d'affichage de la caméra en direct",media_gallery:"Galerie des médias",media_gallery_secondary:"Options de la galerie multimédia",media_viewer:"Visionneuse de médias",media_viewer_secondary:"Visionneuse de médias statiques (clips, instantanés ou enregistrements)",menu:"Menu",menu_secondary:"Options d'apparence et de convivialité du menu",move_down:"Descendre",move_up:"Déplacer vers le haut",overrides:"Les remplacements sont actifs",overrides_secondary:"Remplacements de configuration dynamique détectés",performance:"Performance",performance_secondary:"Options de performances de la carte",profiles:"Profils de confi",profiles_secondary:"",status_bar:"",status_bar_secondary:"",timeline:"Chronologie",timeline_secondary:"Options de chronologie des événements",upgrade:"Mise à niveau",upgrade_available:"Une mise à niveau automatique de la configuration de la carte est disponible",view:"Voir",view_secondary:"Ce que la carte doit montrer et comment la montrer"},n={ptz:{down:"Bas",home:"Origine",left:"Gauche",right:"Droite",up:"Haut",zoom_in:"Zoomer",zoom_out:"Dézoomer"}},r={awaiting_live:"En attente du flux en direct...",awaiting_media:"",camera_initialization:"",camera_initialization_reolink:"",could_not_render_elements:"Impossible de restituer les éléments de l'image",could_not_resolve:"Impossible de résoudre l'URL du média",diagnostics:"Diagnostic de la carte. Veuillez enlever les informations confidentielles avant de les partager",download_no_media:"Aucun média à télécharger",download_sign_failed:"Impossible de signer l'URL du média à télécharger",duplicate_camera_id:"ID de caméra Frigate en double pour la caméra suivante, utilisez le paramètre « ID » pour identifier de manière unique les caméras",empty_response:"Réponse vide reçue de Home Assistant pour la demande",failed_response:"Échec de la réponse de Home Assistant à la demande",failed_retain:"Impossible de conserver l'événement",failed_sign:"Impossible de signer l'URL de Home Assistant",image_load_error:"L'image n'a pas pu être chargée",invalid_configuration:"Configuration invalide",invalid_configuration_no_hint:"Aucune indication de localisation disponible (type incorrect ou manquant ?)",invalid_configuration_override:"",invalid_elements_config:"Configuration des éléments d'image invalide",invalid_response:"Réponse non valide reçue de Home Assistant pour la demande",jsmpeg_no_player:"Impossible de démarrer le lecteur JSMPEG",live_camera_no_endpoint:"Impossible d'obtenir le point de terminaison de la caméra pour ce fournisseur en direct (configuration incomplète ?)",live_camera_not_found:"L'entité caméra configurée n'a pas été trouvée",live_camera_unavailable:"Caméra indisponible",no_camera_engine:"Impossible de déterminer le moteur approprié pour la caméra",no_camera_entity:"Impossible de trouver l'entité de caméra",no_camera_entity_for_triggers:"Une entité caméra est requise pour détecter automatiquement les déclencheurs",no_camera_id:"Impossible de déterminer l'identifiant de la caméra suivante. Il faudra peut-être définir le paramètre « ID » manuellement",no_camera_name:"Impossible de déterminer le nom de la caméra Frigate pour la caméra (ou l'une de ses dépendances). Veuillez spécifier soit « camera_entity » soit « camera_name ».",no_dashboard_or_view:"",no_live_camera:"Le paramètre camera_entity doit être défini et valide pour ce fournisseur en direct",no_supported_camera:"",no_supported_cameras:"",reconnecting:"Reconnexion",too_many_automations:"Trop d'appels d'automatisation imbriqués, veuillez vérifier votre configuration pour les boucles",troubleshooting:"Vérifier le dépannage",unknown:"Erreur inconnue",upgrade_available:"Une mise à niveau automatisée de la configuration de la carte est disponible, veuillez visiter l'éditeur visuel de la carte",webrtc_card_reported_error:"La carte WebRTC a signalé une erreur",webrtc_card_waiting:"En attente du chargement de la carte WebRTC..."},s={camera:"Caméra",duration:"Durée",in_progress:"En cours",score:"Score",seek:"Chercher",start:"Commencer",tag:"Étiqueter",what:"Quoi",where:"Où"},o={assign:"",assigning:"",modifiers:{alt:"",ctrl:"",meta:"",shift:""},unassign:""},l={all:"Tous",camera:"Caméra",favorite:"Préféré",media_type:"Type de support",media_types:{clips:"Extraits",recordings:"Enregistrements",snapshots:"Instantanés"},not_favorite:"Pas favori",select_camera:"Sélectionnez une caméra...",select_favorite:"Sélectionnez un favori...",select_media_type:"Sélectionnez le type de média...",select_tag:"Sélectionnez la balise...",select_what:"Sélectionnez quoi...",select_when:"Sélectionnez quand...",select_where:"Sélectionnez où...",tag:"Étiqueter",what:"Quoi",when:"Quand",whens:{custom:"",past_month:"Mois passé",past_week:"La semaine dernière",today:"Aujourd'hui",yesterday:"Hier"},where:"Où"},d={unseekable:"Temps non trouvé dans les médias"},c={camera:"Caméra",duration:"Durée",events:"Événements",in_progress:"En cours",seek:"Chercher",start:"Commencer"},u={download:"Télécharger des médias",no_thumbnail:"Aucune vignette disponible",retain_indefinitely:"Les médias seront conservés indéfiniment",timeline:"Voir les médias dans la chronologie"},m={select_date:"Choisir une date"},p={common:e,config:a,display_modes:t,editor:i,elements:n,error:r,event:s,key_assigner:o,media_filter:l,media_viewer:d,recording:c,thumbnail:u,timeline:m};export{e as common,a as config,p as default,t as display_modes,i as editor,n as elements,r as error,s as event,o as key_assigner,l as media_filter,d as media_viewer,c as recording,u as thumbnail,m as timeline}; diff --git a/config/www/community/frigate-hass-card/lang-fr-674e5de5.js.gz b/config/www/community/frigate-hass-card/lang-fr-674e5de5.js.gz new file mode 100644 index 00000000..eedf1d89 Binary files /dev/null and b/config/www/community/frigate-hass-card/lang-fr-674e5de5.js.gz differ diff --git a/config/www/community/frigate-hass-card/lang-fr-ea16daba.js b/config/www/community/frigate-hass-card/lang-fr-ea16daba.js new file mode 100644 index 00000000..9fa4983c --- /dev/null +++ b/config/www/community/frigate-hass-card/lang-fr-ea16daba.js @@ -0,0 +1 @@ +var e={frigate_card:"Carte Frigate",frigate_card_description:"Une carte Lovelace à utiliser avec Frigate",live:"En direct",no_media:"Aucun média à afficher",recordings:"Enregistrements",version:"Version"},a={cameras:{camera_entity:"Entité caméra",capabilities:{capabilities:{clips:"Clips","favorite-events":"Événements favoris","favorite-recordings":"Enregistrements favoris",live:"Vue en direct",menu:"Menu",ptz:"PTZ",recordings:"Enregistrements",seek:"Recherche",snapshots:"Snapshots",substream:"flux secondaire"},disable:"Désactiver",disable_except:"Désactive sauf",editor_label:"Capacités de la caméra"},cast:{dashboard:{dashboard_path:"Chemin du tableau de bord",view_path:"Voir le chemin"},editor_label:"Options de diffusion",method:"Méthodes de diffusion",methods:{dashboard:"Dashboard",standard:"Standard"}},dependencies:{all_cameras:"Afficher les événements pour toutes les caméras avec cette caméra",cameras:"Afficher les événements pour des caméras spécifiques avec cette caméra",editor_label:"Options de dépendance"},dimensions:{aspect_ratio:"Rapport d'aspect d'image",editor_label:"Dimensions de la caméra",layout:{editor_label:"Disposition de la caméra",fit:"Ajustement de la disposition",fits:{contain:"Le média est contenu",cover:"Le média s'étend proportionnellement pour couvrir la carte",fill:"Le média est étiré pour remplir la carte"},pan:{x:"Pourcentage de panoramique horizontal",y:"Pourcentage de panoramique vertical"},position:{editor_label:"Position de la couverture",x:"Pourcentage de positionnement horizontal",y:"Pourcentage de positionnement vertical"},view_box:{bottom:"",editor_label:"",left:"",right:"",top:""},zoom:"Facteur de zoom"}},engines:{editor_label:"Options du moteur de caméra"},frigate:{camera_name:"Nom de la caméra Frigate (détecté automatiquement par l'entité)",client_id:"ID client Frigate (Si plus d'un serveur Frigate)",editor_label:"Options de Frigate",labels:"Étiquettes de Frigate/filtres d'objets",url:"URL du serveur Frigate",zones:"Zones Frigate"},go2rtc:{editor_label:"Options go2rtc",modes:{editor_label:"Modes go2rtc",mjpeg:"Motion JPEG (MJPEG)",mp4:"MPEG-4 (MP4)",mse:"Extensions de sources multimédias (MSE)",webrtc:"Web Real-Time Communication (WebRTC)"},stream:"nom du flux go2rtc"},icon:"Icône pour cette caméra (auto-détectée par l'entité)",id:"ID unique pour cette caméra dans cette carte",image:{editor_label:"Options d'images",refresh_seconds:"Nombre de secondes après lesquelles actualiser l'image en direct (0=jamais)",url:"URL de l'image à utiliser à la place de l'instantané de l'entité de la caméra"},live_provider:"Fournisseur de visualisation en direct pour cette caméra",live_provider_options:{editor_label:"Options du fournisseur en direct"},live_providers:{auto:"Automatique",go2rtc:"go2rtc",ha:"Flux vidéo Home Assistant (c'est-à-dire HLS, LL-HLS, WebRTC via HA)",image:"Images d'Home Assistant",jsmpeg:"JSMpeg","webrtc-card":"Carte WebRTC (c.-⁠à-⁠d. La carte WebRTC d'AlexxIT)"},motioneye:{editor_label:"Options de MotionEye",images:{directory_pattern:"Modèle de répertoire d'images",file_pattern:"Modèle de fichier images"},movies:{directory_pattern:"Modèle de répertoire de films",file_pattern:"Modèle de fichier de films"},url:"URL de l’interface MotionEye"},proxy:{dynamic:"",editor_label:"",media:{auto:"",editor_label:"",false:"",true:""},ssl_ciphers:{auto:"",default:"",editor_label:"",insecure:"",intermediate:"",modern:""},ssl_verification:{auto:"",editor_label:"",false:"",true:""}},reolink:{editor_label:"Option Reolink",media_resolution:{editor_label:"Désolution du média",high:"Haute résolution",low:"Basse résolution"},url:"URL de l'interface utilisateur Reolink"},title:"Titre de cette caméra (détection automatique à partir de l'entité)",triggers:{editor_label:"Modèle de répertoire des films",entities:"Déclencheur à partir d'autres entités",events:{clips:"Événements avec de nouveaux clips",editor_label:"Événements déclencheurs",events:"Tous les événements",snapshots:"Événements avec de nouveaux instantanés"},motion:"Déclenchement par détection automatique du capteur de mouvement",occupancy:"Déclenchement par détection automatique du capteur de présence"},webrtc_card:{editor_label:"Options de la carte WebRTC",entity:"Entité de caméra de carte WebRTC (pas une caméra de Frigate)",url:"URL de la caméra de la carte WebRTC"}},common:{controls:{builtin:"Commandes vidéo intégrées",filter:{editor_label:"Filtre multimédia",mode:"Mode de filtre",modes:{left:"Filtre média dans un menu à gauche",none:"Pas de filtre média",right:"Filtre média dans un menu à droite"}},next_previous:{editor_label:"Suivant et précédent",size:"Taille des contrôles suivant et précédent en pixels",style:"Style de contrôle suivant et précédent",styles:{chevrons:"Chevrons",icons:"Icônes",none:"Aucun",thumbnails:"Vignettes"}},thumbnails:{editor_label:"Vignettes",events_media_type:"S'il faut afficher des vignettes de clips ou des instantanés",events_media_types:{clips:"Vignettes de clips",snapshots:"Vignettes d'instantanés"},media_type:"Afficher ou non les vignettes des événements ou des enregistrements",media_types:{events:"Événements",recordings:"Enregistrements"},mode:"Mode vignettes",modes:{above:"Vignettes en haut",below:"Vignettes en bas",left:"Vignettes dans un menu à gauche",none:"Aucune vignette",right:"Vignettes dans un menu à droite"},show_details:"Afficher les détails avec des vignettes",show_download_control:"Afficher le contrôle de téléchargement sur les vignettes",show_favorite_control:"Afficher le contrôle favori sur les vignettes",show_timeline_control:"Afficher le contrôle de la chronologie sur les vignettes",size:"Taille des vignettes en pixels"},timeline:{editor_label:"Mini-chronologie",mode:"Mode",modes:{above:"Au-dessus",below:"En dessous",none:"Aucun"},pan_mode:"Mode panoramique par défaut",pan_modes:{pan:"Pan",seek:"Pan cherche parmi toutes les caméras","seek-in-camera":"Pan ne cherche que parmi la caméra sélectionnée","seek-in-media":"Pan ne cherche que parmi les médias sélectionnés"}}},display:{editor_label:"Affichage",grid_columns:"Nombre de colonnes de la grille",grid_max_columns:"Nombre maximum de colonnes de la grille",grid_selected_width_factor:"Augmenter la largeur du média sélectionnée par ce facteur",mode:"Mode"},image:{entity:"Entité à utiliser avec le mode entité",entity_parameters:"Paramètres de requête ajoutés aux URL des images basées sur l'entité (par exemple, width=1920&height=1080)",mode:"Mode d'affichage des images",modes:{camera:"Instantané de la caméra Home Assistant de l'entité caméra",entity:"Entité avec l'attribut entity_picture",screensaver:"Logo Frigate intégré",url:"Image arbitraire spécifiée par URL"},refresh_seconds:"Nombre de secondes après lesquelles actualiser (0=jamais)",url:"URL d'image statique pour l'affichage de l'image"},media_action_conditions:{all:"Toutes les opportunités",hidden:"Sur le navigateur/onglet masqué",microphone_mute:"Sourdine du microphone activée",microphone_unmute:"Sourdine du microphone désactivée",never:"Jamais",selected:"Sur sélection",unselected:"Lors de la désélection",visible:"Sur la visibilité du navigateur/onglet"},timeline:{clustering_threshold:"Le nombre d'événements pour lesquels ils sont regroupés (0 = pas de clustering)",events_media_type:"Les médias affichés par la chronologie",events_media_types:{all:"Tous types de médias",clips:"Extraits",snapshots:"Instantanés"},show_recordings:"Afficher les enregistrements",style:"Style de chronologie",styles:{ribbon:"Événements sur un seul ruban",stack:"Événements empilés et groupés"},window_seconds:"La durée par défaut de la vue chronologique en secondes"}},dimensions:{aspect_ratio:"Format d'image par défaut (par exemple '16:9')",aspect_ratio_mode:"Mode rapport hauteur/largeur",aspect_ratio_modes:{dynamic:"Le rapport hauteur/largeur s'adapte au média",static:"Rapport hauteur/largeur statique",unconstrained:"Rapport hauteur/largeur sans contrainte"},height:"Hauteur de la carte en unités CSS (par exemple, '500px')"},live:{auto_mute:"Couper automatiquement le son des caméras en direct",auto_pause:"Mettre automatiquement en pause les caméras en direct",auto_play:"Lire automatiquement les caméras en direct",auto_unmute:"Activer automatiquement le son des caméras en direct",controls:{editor_label:"Contrôles en direct",ptz:{editor_label:"PTZ",hide_home:"Cacher le bouton position d'origine",hide_pan_tilt:"Cacher les boutons panoramiques/inclinaison",hide_zoom:"Cacher le bouton de zoom",mode:"Mode",modes:{off:"Eteint",on:"Allumé"},orientation:"",orientations:{horizontal:"Horizontale",vertical:"Verticale"},position:"",positions:{"bottom-left":"En bas à gauche","bottom-right":"En bas à droite","top-left":"En haut à gauche","top-right":"En haut à droite"}}},draggable:"La vue des caméras en direct peut être déplacée/glissée",lazy_load:"Les caméras en direct sont chargeés en différé",lazy_unload:"Les caméras en direct sont déchargés en différé",microphone:{always_connected:"Toujours garder le microphone connecté",disconnect_seconds:"Secondes après quoi déconnecter le microphone (0=jamais)",editor_label:"Microphone",enabled:"Microphone activé",mute_after_microphone_mute_seconds:"Secondes après la mise en sourdine du microphone pour couper l'audio entrant"},preload:"Précharger la vue en direct en arrière-plan",show_image_during_load:"Afficher une image fixe pendant le chargement du flux en direct",transition_effect:"Effet de transition de caméra en direct",zoomable:"Les caméras en direct peuvent être zoomées/panoramiques"},media_viewer:{auto_mute:"Couper automatiquement le son des médias",auto_pause:"Mettre automatiquement en pause les médias",auto_play:"Lire automatiquement les médias",auto_unmute:"Activer automatiquement le son des médias",controls:{editor_label:"Commandes de la visionneuse multimédia"},draggable:"La visionneuse multimédia peut être déplacée/glissée",lazy_load:"Les médias Media Viewer sont chargés en différé dans le carrousel",snapshot_click_plays_clip:"Cliquer sur un instantané lit l'extrait associé",transition_effect:"Effet de transition de la visionneuse multimédia",transition_effects:{none:"Pas de transition",slide:"Transition de diapositive"},zoomable:"La visionneuse multimédia peut être zoomée/panoramique"},menu:{alignment:"Alignement des menus",alignments:{bottom:"Aligné vers le bas",left:"Aligné à gauche",right:"Aligné à droite",top:"Aligné vers le haut"},button_size:"Taille du bouton de menu en pixels",buttons:{alignment:"Alignement des boutons",alignments:{matching:"Faire correspondre l'alignement du menu",opposing:"S'opposer à l'alignement des menus"},camera_ui:"Interface utilisateur de la caméra",cameras:"Cameras",clips:"Extraits",display_mode:"Mode d'afficahge",download:"Télécharger",enabled:"Bouton activé",expand:"Développer",frigate:"Menu Frigate / Vue par défaut",fullscreen:"Plein écran",icon:"Icône",image:"Image",live:"En direct",media_player:"Envoyer au lecteur multimédia",microphone:"Microphone",mute:"Désactiver/Réactiver le son",permanent:"Afficher lorsque le menu est caché",play:"Jouer / Pause",priority:"Priorité",ptz_controls:"Afficher les controles PTZ",ptz_home:"Position d'origine PTZ",recordings:"Enregistrements",screenshot:"Capture d'écran",snapshots:"Instantanés",substreams:"flux secondaires",timeline:"Chronologie",type:"Type de bouton",types:{momentary:"Momentané",toggle:"Basculer"}},position:"Emplacement des menus",positions:{bottom:"Positionné en bas",left:"Positionné à gauche",right:"Positionné à droite",top:"Positionné en haut"},style:"Style de menu",styles:{hidden:"Menu caché",hover:"Menu survolé","hover-card":"Menu survolé (à l'échelle de la carte)",none:"Pas de menu",outside:"Menu extérieur",overlay:"Menu superposé"}},overrides:{info:"Cette configuration de carte comporte des remplacements spécifiés manuellement et configurés qui peuvent remplacer les valeurs affichées dans l'éditeur visuel. Veuillez consulter l'éditeur de code pour afficher/modifier ces remplacements."},performance:{features:{animated_progress_indicator:"Indicateur de progression animé",editor_label:"Options de fonctionnalités",max_simultaneous_engine_requests:"Nombre maximal de requêtes simultanées au moteur de caméra",media_chunk_size:"Taille du morceau de média"},style:{border_radius:"Courbes",box_shadow:"Ombres",editor_label:"Options de style"},warning:"Cette carte est en mode profil bas, les paramètres par défaut ont donc été modifiés pour optimiser les performances."},profiles:{casting:"Diffusion",editor_label:"Configuration des profils","low-performance":"Basse performance",scrubbing:"Balayage vidéo"},status_bar:{height:"Hauteur de la barre d'état en pixels",items:{enabled:"Item activé",engine:"Moteur de camera",live_provider:"fournisseur de flux en direc",priority:"Priorité de l'item",resolution:"Résolution",technology:"Technologie",title:"Titre"},popup_seconds:"Secondes de popup de la barre d'état",position:"Position de la barre d'état",positions:{bottom:"Postionné en bas",top:"Postionné en haut"},style:"Style de la barre d'état",styles:{hover:"Barre d'état au survol","hover-card":"Barre d'état au survol (sur toute la carte)",none:"Pas de barre d'état",outside:"Barre d'état extérieure",overlay:"Barre d'état superposée",popup:"Barre d'état contextuelle"}},view:{camera_select:"Afficher les caméras nouvellement sélectionnées",dark_mode:"Mode sombre",dark_modes:{auto:"Automatique",off:"Désactivé",on:"Activé"},default:"Vue par défaut",default_cycle_camera:"Parcourez les caméras lorsque la vue par défaut est mise à jour",default_reset:{after_interaction:"Réinitialiser à la vue par défaut après la fin de l'interaction de l'utilisateur",editor_label:"Comportement de réinitialisation de la vue par défaut",entities:"Réinitialiser à la vue par défaut lors du changement d'état de l'entité",every_seconds:"Actualiser la vue par défaut toutes les X secondes (0=jamais)",interaction_mode:"Comment la réinitialisation par défaut se comporte lorsque la carte a une interaction humaine",interaction_modes:{active:"Autoriser la réinitialisation uniquement lorsque la carte a une interaction humaine active",all:"Réinitialiser indépendamment de l'interaction humaine",inactive:"Réinitialiser uniquement lorsque la carte n'a pas d'interaction humaine"}},interaction_seconds:"Secondes après l'action de l'utilisateur pour maintenir l'interaction (0=jamais)",keyboard_shortcuts:{editor_label:"Raccourcis clavier",enabled:"Raccourcis clavier activés",ptz_down:"PTZ bas",ptz_home:"PTZ position d'origine",ptz_left:"PTZ gauche",ptz_right:"PTZ droite",ptz_up:"PTZ haut",ptz_zoom_in:"PTZ zoomer",ptz_zoom_out:"PTZ dézoomer"},triggers:{actions:{editor_label:"Actions de déclenchement",interaction_mode:"Comment gérer les actions lorsque la carte comporte une interaction humaine ?",interaction_modes:{active:"Ne déclencher des actions que lorsque la carte a une interaction humaine",all:"Déclencher des actions sans interaction humaine",inactive:"Ne déclencher des actions que lorsque la carte n'a pas d'interaction humaine"},trigger:"Actions de déclenchement",triggers:{default:"Changement ou mise à jour de la vue par défaut",live:"Change ou met a jour la vue en direct",media:"Changement d'affichage pour les nouveaux médias",none:"Pas d'acction"},untrigger:"Action de désactivation",untriggers:{default:"Passage à la vue/caméra par défaut",none:"Pas d'action"}},editor_label:"Comportement en cas de déclenchement d'une caméra",filter_selected_camera:"Déclenchement uniquement sur la caméra sélectionnée",show_trigger_status:"Afficher la bordure clignotante lors du déclenchement",untrigger_seconds:"Quelques secondes après le changement d'état inactif pour débloquer"},views:{clip:"Clip le plus récent",clips:"Galerie de clips",current:"Vue actuelle",image:"Image statique",live:"Vue en direct",recording:"Enregistrement le plus récent",recordings:"Galerie d'enregistrements",snapshot:"Instantané le plus récent",snapshots:"Galerie d'instantanés",timeline:"Vue chronologique"}}},t={grid:"Afficher la visionneuse de médias pour chaque caméra d'une grille",single:"Afficher une seule visionneuse"},i={add_new_camera:"Ajouter une nouvelle caméra",button:"Bouton",camera:"Caméra",cameras:"Caméras",cameras_secondary:"Quelles caméras afficher sur cette carte",delete:"Supprimer",dimensions:"Dimensions",dimensions_secondary:"Options de dimensions et de forme",image:"Image",image_secondary:"Options d'affichage d'image statique",live:"En direct",live_secondary:"Options d'affichage de la caméra en direct",media_gallery:"Galerie des médias",media_gallery_secondary:"Options de la galerie multimédia",media_viewer:"Visionneuse de médias",media_viewer_secondary:"Visionneuse de médias statiques (clips, instantanés ou enregistrements)",menu:"Menu",menu_secondary:"Options d'apparence et de convivialité du menu",move_down:"Descendre",move_up:"Déplacer vers le haut",overrides:"Les remplacements sont actifs",overrides_secondary:"Remplacements de configuration dynamique détectés",performance:"Performance",performance_secondary:"Options de performances de la carte",profiles:"Profils de confi",profiles_secondary:"Choisir des ensembles de paramètres par défaut pré-configurés",status_bar:"Barre d'état",status_bar_secondary:"Options d'apparence et de comportement de la barre d'état",timeline:"Chronologie",timeline_secondary:"Options de chronologie des événements",upgrade:"Mise à niveau",upgrade_available:"Une mise à niveau automatique de la configuration de la carte est disponible",view:"Voir",view_secondary:"Ce que la carte doit montrer et comment la montrer"},n={ptz:{down:"Bas",home:"Origine",left:"Gauche",right:"Droite",up:"Haut",zoom_in:"Zoomer",zoom_out:"Dézoomer"}},r={awaiting_live:"En attente du flux en direct...",awaiting_media:"En attente du chargement des médias",camera_initialization:"Échec de l'initialisation de la caméra",camera_initialization_reolink:"Impossible d'initialiser la caméra Reolink",could_not_render_elements:"Impossible de restituer les éléments de l'image",could_not_resolve:"Impossible de résoudre l'URL du média",diagnostics:"Diagnostic de la carte. Veuillez enlever les informations confidentielles avant de les partager",download_no_media:"Aucun média à télécharger",download_sign_failed:"Impossible de signer l'URL du média à télécharger",duplicate_camera_id:"ID de caméra Frigate en double pour la caméra suivante, utilisez le paramètre « ID » pour identifier de manière unique les caméras",empty_response:"Réponse vide reçue de Home Assistant pour la demande",failed_response:"Échec de la réponse de Home Assistant à la demande",failed_retain:"Impossible de conserver l'événement",failed_sign:"Impossible de signer l'URL de Home Assistant",image_load_error:"L'image n'a pas pu être chargée",invalid_configuration:"Configuration invalide",invalid_configuration_no_hint:"Aucune indication de localisation disponible (type incorrect ou manquant ?)",invalid_configuration_override:"Configuration de remplacement invalide",invalid_elements_config:"Configuration des éléments d'image invalide",invalid_response:"Réponse non valide reçue de Home Assistant pour la demande",jsmpeg_no_player:"Impossible de démarrer le lecteur JSMPEG",live_camera_no_endpoint:"Impossible d'obtenir le point de terminaison de la caméra pour ce fournisseur en direct (configuration incomplète ?)",live_camera_not_found:"L'entité caméra configurée n'a pas été trouvée",live_camera_unavailable:"Caméra indisponible",no_camera_engine:"Impossible de déterminer le moteur approprié pour la caméra",no_camera_entity:"Impossible de trouver l'entité de caméra",no_camera_entity_for_triggers:"Une entité caméra est requise pour détecter automatiquement les déclencheurs",no_camera_id:"Impossible de déterminer l'identifiant de la caméra suivante. Il faudra peut-être définir le paramètre « ID » manuellement",no_camera_name:"Impossible de déterminer le nom de la caméra Frigate pour la caméra (ou l'une de ses dépendances). Veuillez spécifier soit « camera_entity » soit « camera_name ».",no_dashboard_or_view:"Les paramètres 'dashboard_path' et 'view_path' sont requis pour la méthode de conversion 'dashboard'",no_live_camera:"Le paramètre camera_entity doit être défini et valide pour ce fournisseur en direct",no_supported_camera:"La caméra sélectionnée ne prend pas en charge cette vue",no_supported_cameras:"Aucune caméra ne prend en charge cette vue",reconnecting:"Reconnexion",too_many_automations:"Trop d'appels d'automatisation imbriqués, veuillez vérifier votre configuration pour les boucles",troubleshooting:"Vérifier le dépannage",unknown:"Erreur inconnue",upgrade_available:"Une mise à niveau automatisée de la configuration de la carte est disponible, veuillez visiter l'éditeur visuel de la carte",webrtc_card_reported_error:"La carte WebRTC a signalé une erreur",webrtc_card_waiting:"En attente du chargement de la carte WebRTC..."},o={camera:"Caméra",duration:"Durée",in_progress:"En cours",score:"Score",seek:"Chercher",start:"Commencer",tag:"Étiqueter",what:"Quoi",where:"Où"},s={assign:"Assigner",assigning:"Assignation",modifiers:{alt:"",ctrl:"",meta:"",shift:""},unassign:"Désassigner"},l={all:"Tous",camera:"Caméra",favorite:"Préféré",media_type:"Type de support",media_types:{clips:"Extraits",recordings:"Enregistrements",snapshots:"Instantanés"},not_favorite:"Pas favori",select_camera:"Sélectionnez une caméra...",select_favorite:"Sélectionnez un favori...",select_media_type:"Sélectionnez le type de média...",select_tag:"Sélectionnez la balise...",select_what:"Sélectionnez quoi...",select_when:"Sélectionnez quand...",select_where:"Sélectionnez où...",tag:"Étiqueter",what:"Quoi",when:"Quand",whens:{custom:"",past_month:"Mois passé",past_week:"La semaine dernière",today:"Aujourd'hui",yesterday:"Hier"},where:"Où"},d={unseekable:"Temps non trouvé dans les médias"},c={camera:"Caméra",duration:"Durée",events:"Événements",in_progress:"En cours",seek:"Chercher",start:"Commencer"},u={download:"Télécharger des médias",no_thumbnail:"Aucune vignette disponible",retain_indefinitely:"Les médias seront conservés indéfiniment",timeline:"Voir les médias dans la chronologie"},m={select_date:"Choisir une date"},p={common:e,config:a,display_modes:t,editor:i,elements:n,error:r,event:o,key_assigner:s,media_filter:l,media_viewer:d,recording:c,thumbnail:u,timeline:m};export{e as common,a as config,p as default,t as display_modes,i as editor,n as elements,r as error,o as event,s as key_assigner,l as media_filter,d as media_viewer,c as recording,u as thumbnail,m as timeline}; diff --git a/config/www/community/frigate-hass-card/lang-fr-ea16daba.js.gz b/config/www/community/frigate-hass-card/lang-fr-ea16daba.js.gz new file mode 100644 index 00000000..48574634 Binary files /dev/null and b/config/www/community/frigate-hass-card/lang-fr-ea16daba.js.gz differ diff --git a/config/www/community/frigate-hass-card/lang-it-2a20a319.js b/config/www/community/frigate-hass-card/lang-it-2a20a319.js new file mode 100644 index 00000000..dc9958a6 --- /dev/null +++ b/config/www/community/frigate-hass-card/lang-it-2a20a319.js @@ -0,0 +1 @@ +var e={frigate_card:"Frigate card",frigate_card_description:"Una scheda Lovelace per l'uso con Frigate",live:"Live",no_media:"Nessun contenuto multimediale da visualizzare",recordings:"Registrazioni",version:"Versione"},i={cameras:{camera_entity:"Entità della telecamera",capabilities:{capabilities:{clips:"","favorite-events":"","favorite-recordings":"",live:"",menu:"",ptz:"",recordings:"",seek:"",snapshots:"",substream:""},disable:"",disable_except:"",editor_label:""},cast:{dashboard:{dashboard_path:"",view_path:""},editor_label:"",method:"",methods:{dashboard:"",standard:""}},dependencies:{all_cameras:"Mostra eventi per tutte le telecamere con questa telecamera",cameras:"Mostra eventi per telecamere specifiche con questa telecamera",editor_label:"Opzioni di dipendenza"},dimensions:{aspect_ratio:"",editor_label:"",layout:{editor_label:"",fit:"Adatta al layout",fits:{contain:"Il supporto è contenuto/in cassetta delle lettere",cover:"Il supporto si espande proporzionalmente per coprire la scheda",fill:"Il supporto viene allungato per riempire la scheda"},pan:{x:"",y:""},position:{editor_label:"",x:"Percentuale di posizionamento orizzontale",y:"Percentuale di posizionamento verticale"},view_box:{bottom:"",editor_label:"",left:"",right:"",top:""},zoom:""}},engines:{editor_label:"Opzioni del motore della fotocamera"},frigate:{camera_name:"Nome della telecamera frigate (autodificato dall'entità)",client_id:"ID client Frigate (per > 1 Frigate server)",editor_label:"Frigate Opzione",labels:"Etichette per fregate/filtri per oggetti",url:"Frigate URL del server",zones:"Frigate Zone"},go2rtc:{editor_label:"Opzioni go2rtc",modes:{editor_label:"Modalità go2rtc",mjpeg:"JPEG animato (MJPEG)",mp4:"MPEG-4 (MP4)",mse:"Estensioni sorgente multimediale (MSE)",webrtc:"Comunicazione Web in tempo reale (WebRTC)"},stream:"nome del flusso go2rtc"},icon:"Icona per questa telecamera (Autoidentificato dall'entità)",id:"ID univoco per questa telecamera in questa carta",image:{editor_label:"Opzioni immagine",refresh_seconds:"Numero di secondi dopo i quali aggiornare l'immagine live (0=mai)",url:"URL dell'immagine da utilizzare al posto dell'istantanea dell'entità fotocamera"},live_provider:"Provider di visualizzazione dal vivo per questa telecamera",live_provider_options:{editor_label:"Opzioni del fornitore in tempo reale"},live_providers:{auto:"Automatica",go2rtc:"go2rtc",ha:"Streaming video di Home Assistant (ovvero HLS, LL-HLS, WebRTC tramite HA)",image:"Immagini Home Assistant",jsmpeg:"JSMpeg","webrtc-card":"Scheda WebRTC (ovvero la scheda WebRTC di Alexxit)"},motioneye:{editor_label:"Opzioni di MotionEye",images:{directory_pattern:"Modello di directory delle immagini",file_pattern:"Modello di file di immagini"},movies:{directory_pattern:"Modello di directory dei film",file_pattern:"Modello di file di film"},url:"URL dell'interfaccia utente di MotionEye"},proxy:{dynamic:"",editor_label:"",media:{auto:"",editor_label:"",false:"",true:""},ssl_ciphers:{auto:"",default:"",editor_label:"",insecure:"",intermediate:"",modern:""},ssl_verification:{auto:"",editor_label:"",false:"",true:""}},reolink:{editor_label:"",media_resolution:{editor_label:"",high:"",low:""},url:""},title:"Titolo per questa telecamera (Autoidentificato dall'entità)",triggers:{editor_label:"Trigger Opzioni",entities:"Trigger da altre entità",events:{clips:"",editor_label:"",events:"",snapshots:""},motion:"Trigger rilevando automaticamente dal sensore di movimento",occupancy:"Attivare rilevando automatico tramite il sensore di presenza"},webrtc_card:{editor_label:"Opzioni della scheda WebRTC",entity:"Entità della telecamera della scheda WebRTC (non una telecamera Frigate)",url:"URL della telecamera della scheda WebRTC"}},common:{controls:{builtin:"",filter:{editor_label:"Filtro multimediale",mode:"Modalità filtro",modes:{left:"Filtro multimediale in un cassetto a sinistra",none:"Nessun filtro multimediale",right:"Filtro multimediale in un cassetto a destra"}},next_previous:{editor_label:"Successivo e precedente",size:"Successiva e Precedenti dimensioni di controllo nei pixel",style:"Stile di controllo successivo e precedente",styles:{chevrons:"Chevrons",icons:"Icone",none:"Nessuno",thumbnails:"Miniature"}},thumbnails:{editor_label:"Miniature",events_media_type:"Se mostrare miniature di clip o istantanee",events_media_types:{clips:"Miniature di clip",snapshots:"Miniature istantanee"},media_type:"",media_types:{events:"",recordings:""},mode:"Modalità miniatura",modes:{above:"Miniature sopra",below:"Miniature sotto",left:"Miniature in un cassetto a sinistra",none:"Nessuna miniatura",right:"Miniature in un cassetto a destra"},show_details:"Mostra i dettagli con le miniature",show_download_control:"Mostra il controllo del download sulle miniature",show_favorite_control:"Mostra il controllo preferito sulle miniature",show_timeline_control:"Mostra il controllo della sequenza temporale sulle miniature",size:"Dimensione delle miniature in pixel"},timeline:{editor_label:"Mini Cronologia",mode:"Modalità",modes:{above:"sopra",below:"sotto",none:"sessuna"},pan_mode:"",pan_modes:{pan:"",seek:"","seek-in-camera":"","seek-in-media":""}}},display:{editor_label:"",grid_columns:"",grid_max_columns:"",grid_selected_width_factor:"",mode:""},image:{entity:"",entity_parameters:"",mode:"Modalità Visualizza immagine",modes:{camera:"Istantanea della telecamera di Home Assistant dell'entità telecamera",entity:"",screensaver:"Logo Frigate incorporato",url:"Immagine arbitraria specificata dall'URL"},refresh_seconds:"Numero di secondi dopo i quali aggiornare (0 = mai)",url:"URL di immagine statica per la vista dell'immagine"},media_action_conditions:{all:"Tutte le opportunità",hidden:"Sul browser/nascondere le schede",microphone_mute:"",microphone_unmute:"",never:"Mai",selected:"Sulla selezione",unselected:"Sulla non selezione",visible:"Sul browser/visibilità della scheda"},timeline:{clustering_threshold:"Il conteggio degli eventi in cui sono raggruppati (0 = nessun clustering)",events_media_type:"I media vengono visualizzati la sequenza temporale",events_media_types:{all:"Tutti i tipi di media",clips:"Clip",snapshots:"Istantanee"},show_recordings:"Mostra registrazioni",style:"",styles:{ribbon:"",stack:""},window_seconds:"La lunghezza predefinita della vista della sequenza temporale in secondi"}},dimensions:{aspect_ratio:"Proporzioni predefinite (ad es. '16:9')",aspect_ratio_mode:"Modalità proporzioni",aspect_ratio_modes:{dynamic:"Le proporzioni si adattano ai media",static:"Proporzioni statiche",unconstrained:"Proporzioni non vincolate"},height:""},live:{auto_mute:"Muta automaticamente le telecamere in diretta",auto_pause:"Metti in pausa automaticamente le telecamere in diretta",auto_play:"Gioca automaticamente le telecamere dal vivo",auto_unmute:"Riattiva automaticamente l'audio delle telecamere live",controls:{editor_label:"Controlli dal vivo",ptz:{editor_label:"",hide_home:"",hide_pan_tilt:"",hide_zoom:"",mode:"",modes:{off:"",on:""},orientation:"",orientations:{horizontal:"",vertical:""},position:"",positions:{"bottom-left":"","bottom-right":"","top-left":"","top-right":""}}},draggable:"Il Visualizzatore eventi può essere trascinato oppure puoi scorrere",lazy_load:"Le telecamere dal vivo sono pigramente cariche",lazy_unload:"Le telecamere dal vivo sono pigramente non caricate",microphone:{always_connected:"",disconnect_seconds:"",editor_label:"",enabled:"",mute_after_microphone_mute_seconds:""},preload:"Precarica Live View in background",show_image_during_load:"Mostra un'immagine fissa durante il caricamento del live streaming",transition_effect:"Effetto di transizione della telecamera dal vivo",zoomable:""},media_viewer:{auto_mute:"Muta automaticamente i media",auto_pause:"Metti in Pausa automaticamente i media",auto_play:"Riproduci automaticamente i contenuti multimediali",auto_unmute:"Riattiva automaticamente i contenuti multimediali",controls:{editor_label:"Controlli di visualizzatore multimediale"},draggable:"Il visualizzatore multimediale può essere trascinato oppure può scorrere",lazy_load:"Il media Viewer viene caricato pigramente nel carosello",snapshot_click_plays_clip:"",transition_effect:"Effetto di transizione del visualizzatore multimediale",transition_effects:{none:"Nessuna transizione",slide:"Transizione diapositiva"},zoomable:""},menu:{alignment:"Allineamento dei menu",alignments:{bottom:"Allineato al fondo",left:"Allineato a sinistra",right:"Allineato a destra",top:"Allineato in cima"},button_size:"Dimensione del pulsante menu in pixel",buttons:{alignment:"Allineamento dei pulsanti",alignments:{matching:"Corrispondenza con l'allineamento del menu",opposing:"Contrastare l'allineamento del menu"},camera_ui:"Interfaccia utente della fotocamera",cameras:"Telecamere",clips:"Clip",display_mode:"",download:"Download",enabled:"Pulsante abilitato",expand:"Espandere",frigate:"Frigate menu / Visualizzazione predefinita",fullscreen:"A schermo intero",icon:"Icona",image:"Immagine",live:"Abitare",media_player:"Invia a Media Player",microphone:"",mute:"",permanent:"",play:"",priority:"Priorità",ptz_controls:"",ptz_home:"",recordings:"",screenshot:"",snapshots:"Istantanee",substreams:"Flusso/i secondario/i",timeline:"Timeline",type:"",types:{momentary:"",toggle:""}},position:"Posizione del menu",positions:{bottom:"Posizionato sul fondo",left:"Posizionato a sinistra",right:"Posizionato a destra",top:"Posizionato in alto"},style:"Stile menu",styles:{hidden:"Menu nascosto",hover:"Menu al passaggio del mouse","hover-card":"",none:"Nessun menu",outside:"Menu esterno",overlay:"Menu di overlay"}},overrides:{info:"Questa configurazione della scheda ha specificato manualmente le sostituzioni configurate che possono sostituire i valori mostrati nell'editor visivo, consultare l'editor di codice per visualizzare/modificare queste sostituzioni"},performance:{features:{animated_progress_indicator:"Indicatore di avanzamento animato",editor_label:"Opzioni funzionalità",max_simultaneous_engine_requests:"",media_chunk_size:"Dimensione del blocco multimediale"},style:{border_radius:"Curve",box_shadow:"Ombre",editor_label:"Opzione di stile"},warning:"Questa scheda è in modalità basso profilo, quindi le impostazioni predefinite sono state modificate per ottimizzare le prestazioni"},profiles:{casting:"",editor_label:"","low-performance":"",scrubbing:""},status_bar:{height:"",items:{enabled:"",engine:"",live_provider:"",priority:"",resolution:"",technology:"",title:""},popup_seconds:"",position:"",positions:{bottom:"",top:""},style:"",styles:{hover:"","hover-card":"",none:"",outside:"",overlay:"",popup:""}},view:{camera_select:"Visualizza per le telecamere appena selezionate",dark_mode:"Tema scuro",dark_modes:{auto:"auto",off:"Off",on:"On"},default:"Visualizzazione predefinita",default_cycle_camera:"Scorri le telecamere quando si aggiorna la visualizzazione predefinita",default_reset:{after_interaction:"",editor_label:"",entities:"",every_seconds:"Aggiorna la visualizzazione predefinita ogni x secondi (0 = mai)",interaction_mode:"",interaction_modes:{active:"",all:"",inactive:""}},interaction_seconds:"",keyboard_shortcuts:{editor_label:"",enabled:"",ptz_down:"",ptz_home:"",ptz_left:"",ptz_right:"",ptz_up:"",ptz_zoom_in:"",ptz_zoom_out:""},triggers:{actions:{editor_label:"",interaction_mode:"",interaction_modes:{active:"",all:"",inactive:""},trigger:"",triggers:{default:"",live:"",media:"",none:""},untrigger:"",untriggers:{default:"",none:""}},editor_label:"",filter_selected_camera:"",show_trigger_status:"Mostra bordo pulsante quando attivato",untrigger_seconds:"Reimposta la vista ai valori predefiniti dopo aver annullato l'attivazione"},views:{clip:"Clip più recente",clips:"Galleria delle clip",current:"Vista corrente",image:"Immagine statica",live:"Dal vivo",recording:"",recordings:"",snapshot:"Snapshot più recente",snapshots:"Galleria delle istantanee",timeline:"Vista della timeline"}}},a={grid:"",single:""},t={add_new_camera:"Aggiungi nuova telecamera",button:"Pulsante",camera:"Telecamera",cameras:"Telecamere",cameras_secondary:"Quali telecamere visualizzare su questa card",delete:"Elimina",dimensions:"",dimensions_secondary:"",image:"Immagine",image_secondary:"Opzioni di visualizzazione dell'immagine statica",live:"Live",live_secondary:"Opzioni di visualizzazione della telecamera live",media_gallery:"Galleria multimediale",media_gallery_secondary:"Opzioni della galleria multimediale",media_viewer:"Visualizzatore dei media",media_viewer_secondary:"Visualizzatore per supporti statici (clip, istantanee o registrazioni)",menu:"Menu",menu_secondary:"Opzioni di aspetto e funzionalità del menu",move_down:"Sposta verso il basso",move_up:"Sposta verso l'alto",overrides:"La sovrascrittura è attiva",overrides_secondary:"Rilevate sovrascritture della configurazione dinamica",performance:"",performance_secondary:"",profiles:"",profiles_secondary:"",status_bar:"",status_bar_secondary:"",timeline:"Timeline",timeline_secondary:"Opzioni della timeline degli eventi",upgrade:"Aggiornamento",upgrade_available:"È disponibile un aggiornamento della configurazione della scheda automatica",view:"Visualizzazione",view_secondary:"Cosa dovrebbe mostrare la carta e come mostrarla"},o={ptz:{down:"Giù",home:"Home",left:"Sinistra",right:"Destra",up:"Su",zoom_in:"Ingrandire",zoom_out:"Zoom indietro"}},n={awaiting_live:"",awaiting_media:"",camera_initialization:"",camera_initialization_reolink:"",could_not_render_elements:"Impossibile renderizzare gli elementi dell'immagine",could_not_resolve:"Impossibile risolvere l'URL dei media",diagnostics:"Diagnostica delle carte.Si prega di rivedere per informazioni riservate prima di condividere",download_no_media:"Nessun media da scaricare",download_sign_failed:"Impossibile firmare URL multimediale per il download",duplicate_camera_id:"Duplicato ID dellla telecamera Frigate, utilizzare il parametro 'ID' per identificare in modo univoco le telecamere",empty_response:"Ricevuto risposta vuota da Home Assistant per la richiesta",failed_response:"Impossibile ricevere risposta da Home Assistant per la richiesta",failed_retain:"Impossibile conservare l'evento",failed_sign:"Impossibile firmare l'URL ad Home Assistant",image_load_error:"L'immagine non può essere caricata",invalid_configuration:"Configurazione non valida",invalid_configuration_no_hint:"Nessun suggerimento di posizione disponibile (tipo difettoso o mancante?)",invalid_configuration_override:"",invalid_elements_config:"Configurazione degli elementi di immagine non valida",invalid_response:"Ricevuta una risposta non valida da Home Assistant per la richiesta",jsmpeg_no_player:"Impossibile avviare JSMPEG Player",live_camera_no_endpoint:"Impossibile ottenere l'endpoint della videocamera per questo provider live (configurazione incompleta?)",live_camera_not_found:"La telecamera configurata non è stata trovata",live_camera_unavailable:"Telecamera non disponibile",no_camera_engine:"Impossibile determinare il motore adatto per la fotocamera",no_camera_entity:"Impossibile trovare l'entità fotocamera",no_camera_entity_for_triggers:"È necessaria un'entità telecamera per rilevare automaticamente i trigger",no_camera_id:"Impossibile determinare l'ID della telecamera , potrebbe essere necessario impostare manualmente il parametro 'ID'",no_camera_name:"Impossibile determinare un nome della telecamera in Frigate, si prega di specificare 'camera_enty' o 'camera_name'",no_dashboard_or_view:"",no_live_camera:"Il parametro fotocamera_enty deve essere impostato e valido per questo provider live",no_supported_camera:"",no_supported_cameras:"",reconnecting:"Riconnessione",too_many_automations:"",troubleshooting:"Controllare la risoluzione dei problemi",unknown:"Errore sconosciuto",upgrade_available:"È disponibile un aggiornamento di configurazione della scheda automatizzato, visitare l'editor di schede visive",webrtc_card_reported_error:"La scheda WebRTC ha riportato un errore",webrtc_card_waiting:"Aspettando che la scheda WebRTC si carichi ..."},r={camera:"Camera",duration:"Durata",in_progress:"In corso",score:"Punteggio",seek:"Cercare",start:"Avvia",tag:"",what:"Che cosa",where:"Dove"},l={assign:"",assigning:"",modifiers:{alt:"",ctrl:"",meta:"",shift:""},unassign:""},s={all:"Tutto",camera:"Telecamera",favorite:"Preferito",media_type:"Tipo di supporto",media_types:{clips:"Clip",recordings:"Registrazioni",snapshots:"Istantanee"},not_favorite:"Non preferito",select_camera:"Seleziona fotocamera...",select_favorite:"Seleziona preferito...",select_media_type:"Seleziona il tipo di supporto...",select_tag:"",select_what:"Seleziona cosa...",select_when:"Seleziona quando...",select_where:"Seleziona dove...",tag:"Tag",what:"Che cosa",when:"Quando",whens:{custom:"",past_month:"Mese scorso",past_week:"Settimana scorso",today:"Oggi",yesterday:"Ieri"},where:"Dove"},d={unseekable:""},m={camera:"Camera",duration:"Durata",events:"Eventi",in_progress:"In corso",seek:"Cercare",start:"Inizio"},c={download:"",no_thumbnail:"Nessuna miniatura disponibile",retain_indefinitely:"L'evento sarà mantenuto indefinitamente",timeline:"Vedi evento nella timeline"},u={select_date:"Scegli la data"},p={common:e,config:i,display_modes:a,editor:t,elements:o,error:n,event:r,key_assigner:l,media_filter:s,media_viewer:d,recording:m,thumbnail:c,timeline:u};export{e as common,i as config,p as default,a as display_modes,t as editor,o as elements,n as error,r as event,l as key_assigner,s as media_filter,d as media_viewer,m as recording,c as thumbnail,u as timeline}; diff --git a/config/www/community/frigate-hass-card/lang-it-2a20a319.js.gz b/config/www/community/frigate-hass-card/lang-it-2a20a319.js.gz new file mode 100644 index 00000000..64af2c94 Binary files /dev/null and b/config/www/community/frigate-hass-card/lang-it-2a20a319.js.gz differ diff --git a/config/www/community/frigate-hass-card/lang-pt-BR-83a703b9.js b/config/www/community/frigate-hass-card/lang-pt-BR-83a703b9.js new file mode 100644 index 00000000..b8033988 --- /dev/null +++ b/config/www/community/frigate-hass-card/lang-pt-BR-83a703b9.js @@ -0,0 +1 @@ +var e={frigate_card:"Cartão Frigate",frigate_card_description:"Um cartão da Lovelace para usar com Frigate",live:"Ao Vivo",no_media:"Nenhuma mídia para exibir",recordings:"Gravações",version:"Versão"},a={cameras:{camera_entity:"Entidade da Câmera",capabilities:{capabilities:{clips:"","favorite-events":"","favorite-recordings":"",live:"",menu:"",ptz:"",recordings:"",seek:"",snapshots:"",substream:""},disable:"",disable_except:"",editor_label:""},cast:{dashboard:{dashboard_path:"",view_path:""},editor_label:"",method:"",methods:{dashboard:"",standard:""}},dependencies:{all_cameras:"Mostrar eventos para todas as câmeras nesta câmera",cameras:"Mostrar eventos para câmeras específicas nesta câmera",editor_label:"Opções de dependência"},dimensions:{aspect_ratio:"",editor_label:"",layout:{editor_label:"",fit:"Ajuste de layout",fits:{contain:"A mídia é contida no cartão",cover:"A mídia se expande proporcionalmente para cobrir o cartão",fill:"A mídia é esticada para preencher o cartão"},pan:{x:"",y:""},position:{editor_label:"",x:"Porcentagem do posicionamento horizontal",y:"Porcentagem do posicionamento vertical"},view_box:{bottom:"",editor_label:"",left:"",right:"",top:""},zoom:""}},engines:{editor_label:"Opções do motor da câmera"},frigate:{camera_name:"Nome da câmera do Frigate (detectado automaticamente pela entidade)",client_id:"ID do cliente do Frigate (para >1 servidor Frigate)",editor_label:"Opções do Frigate",labels:"Rótulos do Frigate/filtros de objetos",url:"URL do servidor Frigate",zones:"Zonas do Frigate"},go2rtc:{editor_label:"Opções do go2rtc",modes:{editor_label:"Modos do go2rtc",mjpeg:"Motion JPEG (MJPEG)",mp4:"MPEG-4 (MP4)",mse:"Media Source Extensions (MSE)",webrtc:"Web Real-Time Communication (WebRTC)"},stream:"Nome do stream do go2rtc"},icon:"Ícone para esta câmera (detectado automaticamente pela entidade)",id:"ID exclusivo para esta câmera nesse cartão",image:{editor_label:"Opções de Imagem",refresh_seconds:"Número de segundos após os quais atualizar a imagem ao vivo (0=nunca)",url:"URL da imagem para usar em vez do instantâneo da entidade da câmera"},live_provider:"Provedor de visualização ao vivo para esta câmera",live_provider_options:{editor_label:"Opções do provedor de visualização ao vivo"},live_providers:{auto:"Automatico",go2rtc:"go2rtc",ha:"Stream de vídeo do Home Assistant (ou seja, HLS, LL-HLS, WebRTC via HA)",image:"Imagens do Home Assistant",jsmpeg:"JSMpeg","webrtc-card":"Cartão WebRTC (de @AlexxIT)"},motioneye:{editor_label:"Opções do MotionEye",images:{directory_pattern:"Padrão de diretório de imagens",file_pattern:"Padrão de arquivo de imagens"},movies:{directory_pattern:"Padrão de diretório de filmes",file_pattern:"Padrão de arquivo de filmes"},url:"URL da interface de usuário do MotionEye"},proxy:{dynamic:"",editor_label:"",media:{auto:"",editor_label:"",false:"",true:""},ssl_ciphers:{auto:"",default:"",editor_label:"",insecure:"",intermediate:"",modern:""},ssl_verification:{auto:"",editor_label:"",false:"",true:""}},reolink:{editor_label:"",media_resolution:{editor_label:"",high:"",low:""},url:""},title:"Título para esta câmera (detectado automaticamente pela entidade)",triggers:{editor_label:"Opções de acionamento",entities:"Acionar a partir de outras entidades",events:{clips:"",editor_label:"",events:"",snapshots:""},motion:"Acionar detectando automaticamente o sensor de movimento",occupancy:"Acionar detectando automaticamente o sensor de ocupação"},webrtc_card:{editor_label:"Opções do cartão WebRTC",entity:"Entidade de câmera de cartão WebRTC (não é uma câmera Frigate)",url:"URL da câmera do cartão WebRTC"}},common:{controls:{builtin:"",filter:{editor_label:"Filtro de Mídia",mode:"Modo do filtro",modes:{left:"Filtro de mídia em uma gaveta à esquerda",none:"Sem filtro de mídia",right:"Filtro de mídia em uma gaveta à direita"}},next_previous:{editor_label:"Próximo",size:"Tamanho de controle próximo e anterior",style:"Estilo do controle próximo e anterior",styles:{chevrons:"Setas",icons:"Ícones",none:"Nenhum",thumbnails:"Miniaturas"}},thumbnails:{editor_label:"Miniaturas",events_media_type:"Se deve mostrar miniaturas de clipes ou snapshots",events_media_types:{clips:"Miniaturas de clipes",snapshots:"Miniaturas de Snapshots"},media_type:"",media_types:{events:"",recordings:""},mode:"Modo de miniaturas",modes:{above:"Miniaturas acima da mídia",below:"Miniaturas abaixo da mídia",left:"Miniaturas em uma gaveta à esquerda",none:"Sem miniaturas",right:"Miniaturas em uma gaveta à direita"},show_details:"Mostrar detalhes com miniaturas",show_download_control:"Mostrar controle de download nas miniaturas",show_favorite_control:"Mostrar controle de favorito nas miniaturas",show_timeline_control:"Mostrar controle da linha do tempo nas miniaturas",size:"Tamanho das miniaturas em pixels"},timeline:{editor_label:"Controles da linha do tempo",mode:"Modo",modes:{above:"Acima",below:"Abaixo",none:"Nenhum"},pan_mode:"",pan_modes:{pan:"",seek:"","seek-in-camera":"","seek-in-media":""}}},display:{editor_label:"",grid_columns:"",grid_max_columns:"",grid_selected_width_factor:"",mode:""},image:{entity:"",entity_parameters:"",mode:"Modo de visualização de imagem",modes:{camera:"Instantâneo da câmera do Home Assistant, da entidade de câmera",entity:"",screensaver:"Logo Frigate embutido",url:"Imagem arbitrária especificada por URL"},refresh_seconds:"Número de segundos após o qual atualizar (0 = nunca)",url:"Imagem arbitrária especificada por URL"},media_action_conditions:{all:"Todas as oportunidades",hidden:"Ao ocultar o navegador/aba",microphone_mute:"",microphone_unmute:"",never:"Nunca",selected:"Ao selecionar",unselected:"Ao desselecionar",visible:"Ao mostrar o navegador/aba"},timeline:{clustering_threshold:"A contagem de eventos nos quais eles são agrupados (0 = sem agrupamento)",events_media_type:"A mídia que a linha do tempo exibe",events_media_types:{all:"Todos os tipos de mídia",clips:"Clipes",snapshots:"Instantâneos"},show_recordings:"Mostrar gravações",style:"",styles:{ribbon:"",stack:""},window_seconds:"A duração padrão da visualização da linha do tempo em segundos"}},dimensions:{aspect_ratio:"Proporção padrão (e.g. '16:9')",aspect_ratio_mode:"Modo de proporção",aspect_ratio_modes:{dynamic:"A proporção se ajusta à mídia",static:"Proporção estática",unconstrained:"Proporção irrestrita"},height:""},live:{auto_mute:"Silenciar câmeras ao vivo automaticamente",auto_pause:"Pausar câmeras ao vivo automaticamente",auto_play:"Reproduzir câmeras ao vivo automaticamente",auto_unmute:"Ativar automaticamente o som das câmeras ao vivo",controls:{editor_label:"Controles da visualização ao vivo",ptz:{editor_label:"",hide_home:"",hide_pan_tilt:"",hide_zoom:"",mode:"",modes:{off:"",on:""},orientation:"",orientations:{horizontal:"",vertical:""},position:"",positions:{"bottom-left":"","bottom-right":"","top-left":"","top-right":""}}},draggable:"A visualização ao vivo das câmeras pode ser arrastada/deslizada",lazy_load:"As câmeras ao vivo são carregadas lentamente",lazy_unload:"As câmeras ao vivo são descarregadas preguiçosamente",microphone:{always_connected:"",disconnect_seconds:"",editor_label:"",enabled:"",mute_after_microphone_mute_seconds:""},preload:"Pré-carregar a visualização ao vivo em segundo plano",show_image_during_load:"Mostrar imagem estática enquanto a transmissão ao vivo está carregando",transition_effect:"Efeito de transição de câmera ao vivo",zoomable:""},media_viewer:{auto_mute:"Silenciar mídia automaticamente",auto_pause:"Pausar mídia automaticamente",auto_play:"Reproduzir mídia automaticamente",auto_unmute:"Ativar mídia automaticamente",controls:{editor_label:"Controles do visualizador de mídia"},draggable:"Visualizador de eventos pode ser arrastado/deslizado",lazy_load:"A mídia do Visualizador de eventos é carregada lentamente no carrossel",snapshot_click_plays_clip:"Clicar em um instantâneo reproduz um clipe relacionado",transition_effect:"Efeito de transição do Visualizador de eventos",transition_effects:{none:"Sem transição",slide:"Transição de slides"},zoomable:""},menu:{alignment:"Alinhamento do menu",alignments:{bottom:"Alinhado à parte inferior",left:"Alinhado à esquerda",right:"Alinhado à direita",top:"Alinhado ao topo"},button_size:"Tamanho do botão de menu (e.g. '40px')",buttons:{alignment:"Alinhamento do botão",alignments:{matching:"Mesmo alinhamento do menu",opposing:"Opor-se ao alinhamento do menu"},camera_ui:"Interface de usuário da câmera",cameras:"Selecionar câmera",clips:"Clipes",display_mode:"",download:"Baixe a mídia do evento",enabled:"Botão ativado",expand:"Expandir",frigate:"Frigate menu / Visualização padrão",fullscreen:"Tela cheia",icon:"Ícone",image:"Imagem",live:"Ao vivo",media_player:"Enviar para o reprodutor de mídia",microphone:"",mute:"",permanent:"",play:"",priority:"Prioridade",ptz_controls:"",ptz_home:"",recordings:"Gravações",screenshot:"",snapshots:"Instantâneos",substreams:"Substream(s)",timeline:"Linha do tempo",type:"",types:{momentary:"",toggle:""}},position:"Posição do menu",positions:{bottom:"Posicionado na parte inferior",left:"Posicionado à esquerda",right:"Posicionado à direita",top:"Posicionado no topo"},style:"Estilo do menu",styles:{hidden:"Menu oculto",hover:"Menu suspenso","hover-card":"Menu suspenso (em todo o cartão)",none:"Sem menu",outside:"Menu externo",overlay:"Menu sobreposto"}},overrides:{info:"Esta configuração do cartão especificou manualmente as substituições configuradas que podem substituir os valores mostrados no editor visual, consulte o editor de código para visualizar/modificar essas substituições"},performance:{features:{animated_progress_indicator:"Indicador de Carregamento Animado",editor_label:"Opções de recursos",max_simultaneous_engine_requests:"",media_chunk_size:"Tamanho do bloco de mídia"},style:{border_radius:"Curvas",box_shadow:"Sombras",editor_label:"Opções de estilo"},warning:"Este cartão está no modo de baixo desempenho, então os padrões foram alterados para otimizar o desempenho"},profiles:{casting:"",editor_label:"","low-performance":"",scrubbing:""},status_bar:{height:"",items:{enabled:"",engine:"",live_provider:"",priority:"",resolution:"",technology:"",title:""},popup_seconds:"",position:"",positions:{bottom:"",top:""},style:"",styles:{hover:"","hover-card":"",none:"",outside:"",overlay:"",popup:""}},view:{camera_select:"Visualização de câmeras recém-selecionadas",dark_mode:"Modo escuro",dark_modes:{auto:"Automático",off:"Desligado",on:"Ligado"},default:"Visualização padrão",default_cycle_camera:"Percorrer as câmeras quando a visualização padrão for atualizada",default_reset:{after_interaction:"",editor_label:"",entities:"",every_seconds:"Atualize a visualização padrão a cada X segundos (0 = nunca)",interaction_mode:"",interaction_modes:{active:"",all:"",inactive:""}},interaction_seconds:"",keyboard_shortcuts:{editor_label:"",enabled:"",ptz_down:"",ptz_home:"",ptz_left:"",ptz_right:"",ptz_up:"",ptz_zoom_in:"",ptz_zoom_out:""},triggers:{actions:{editor_label:"",interaction_mode:"",interaction_modes:{active:"",all:"",inactive:""},trigger:"",triggers:{default:"",live:"",media:"",none:""},untrigger:"",untriggers:{default:"",none:""}},editor_label:"",filter_selected_camera:"",show_trigger_status:"Pulsar borda quando acionado",untrigger_seconds:"Segundos após a mudar para o estado inativo para desacionar"},views:{clip:"Clipe mais recente",clips:"Galeria de clipes",current:"Visualização atual",image:"Imagem estática",live:"Visualização ao vivo",recording:"Gravação mais recente",recordings:"Galeria de gravações",snapshot:"Snapshot mais recente",snapshots:"Galeria de Snapshots",timeline:"Visualização da linha do tempo"}}},o={grid:"",single:""},i={add_new_camera:"Adicionar nova câmera",button:"Botão",camera:"Câmera",cameras:"Câmeras",cameras_secondary:"Quais câmeras renderizar neste cartão",delete:"Excluir",dimensions:"",dimensions_secondary:"",image:"Imagem",image_secondary:"Opções de visualização de imagem estática",live:"Ao vivo",live_secondary:"Opções de visualização da câmera ao vivo",media_gallery:"Galeria de mídia",media_gallery_secondary:"Opções da galeria de mídia",media_viewer:"Visualizador de eventos",media_viewer_secondary:"Opções do visualizador de Snapshots e clipes",menu:"Menu",menu_secondary:"Opções de aparência do menu",move_down:"Descer",move_up:"Subir",overrides:"As substituições estão ativas",overrides_secondary:"Substituições de configuração dinâmica detectadas",performance:"Desempenho",performance_secondary:"Opções de desempenho do cartão",profiles:"",profiles_secondary:"",status_bar:"",status_bar_secondary:"",timeline:"Linha do tempo",timeline_secondary:"Opções do evento da linha do tempo",upgrade:"Upgrade",upgrade_available:"Um upgrade automático da configuração de cartão está disponível",view:"Visualizar",view_secondary:"O que o cartão deve mostrar e como mostrá-lo"},r={ptz:{down:"Baixo",home:"Casa",left:"Esquerda",right:"Direita",up:"Cima",zoom_in:"Aumentar Zoom",zoom_out:"Reduzir Zoom"}},t={awaiting_live:"",awaiting_media:"",camera_initialization:"",camera_initialization_reolink:"",could_not_render_elements:"Não foi possível renderizar os elementos da imagem",could_not_resolve:"Não foi possível resolver o URL de mídia",diagnostics:"Diagnósticos do cartão. Revise as informações confidenciais antes de compartilhar",download_no_media:"Nenhuma mídia para download",download_sign_failed:"Não foi possível assinar o URL de mídia para download",duplicate_camera_id:"Duplique o ID da câmera Frigate para a câmera a seguir, use o parâmetro 'id' para identificar exclusivamente as câmeras",empty_response:"Sem resposta do Home Assistant para a solicitação",failed_response:"Falha ao receber resposta do Home Assistant para solicitação",failed_retain:"Não foi possível reter o evento",failed_sign:"Não foi possível assinar a URL do Home Assistant",image_load_error:"A imagem não pôde ser carregada",invalid_configuration:"Configuração inválida",invalid_configuration_no_hint:"Nenhuma dica de local disponível (tipo incorreto ou ausente?)",invalid_configuration_override:"",invalid_elements_config:"Configuração de elementos de imagem inválida",invalid_response:"Resposta inválida recebida do Home Assistant para a solicitação",jsmpeg_no_player:"Não foi possível iniciar o player JSMPEG",live_camera_no_endpoint:"Não foi possível obter o endereço da câmera para este provedor ao vivo (configuração incompleta?)",live_camera_not_found:"A entidade de câmera configurada não foi encontrada",live_camera_unavailable:"Câmera indisponível",no_camera_engine:"Não foi possível determinar o motor adequado para a câmera",no_camera_entity:"Não foi possível encontrar a entidade da câmera",no_camera_entity_for_triggers:"Uma entidade de câmera é necessária para detectar automaticamente os gatilhos",no_camera_id:"Não foi possível determinar o ID da câmera para a câmera a seguir, pode ser necessário definir o parâmetro 'id' manualmente",no_camera_name:"Não foi possível determinar o nome da câmera da Frigate, especifique 'camera_entity' ou 'camera_name' para a câmera a seguir",no_dashboard_or_view:"",no_live_camera:"O parâmetro camera_entity deve ser definido e válido para este provedor ativo",no_supported_camera:"",no_supported_cameras:"",reconnecting:"Reconectando",too_many_automations:"",troubleshooting:"Verifique a solução de problemas",unknown:"Erro desconhecido",upgrade_available:"Uma atualização automatizada da configuração do cartão está disponível, visite o editor visual do cartão",webrtc_card_reported_error:"O cartão WebRTC relatou um erro",webrtc_card_waiting:"Aguardando o cartão WebRTC carregar ..."},s={camera:"Câmera",duration:"Duração",in_progress:"Em andamento",score:"Pontuação",seek:"Procurar",start:"Início",tag:"Etiqueta",what:"O que",where:"Onde"},n={assign:"",assigning:"",modifiers:{alt:"",ctrl:"",meta:"",shift:""},unassign:""},d={all:"Todos",camera:"Câmera",favorite:"Favorito",media_type:"Tipo de mídia",media_types:{clips:"Clipes",recordings:"Gravações",snapshots:"Instantâneos"},not_favorite:"Não favorito",select_camera:"Selecione a câmera...",select_favorite:"Selecione favorito...",select_media_type:"Selecione o tipo de mídia...",select_tag:"Selecione a etiqueta...",select_what:"Selecione o que...",select_when:"Selecione quando...",select_where:"Selecione onde...",tag:"Etiqueta",what:"O que",when:"Quando",whens:{custom:"",past_month:"Mês passado",past_week:"Semana passada",today:"Hoje",yesterday:"Ontem"},where:"Onde"},m={unseekable:""},l={camera:"Câmera",duration:"Duração",events:"Eventos",in_progress:"Em andamento",seek:"Procurar",start:"Começar"},c={download:"Baixar mídia",no_thumbnail:"Nenhuma miniatura disponível",retain_indefinitely:"Evento será retido por tempo indeterminado",timeline:"Ver evento na linha do tempo"},u={select_date:"Escolha a data"},p={common:e,config:a,display_modes:o,editor:i,elements:r,error:t,event:s,key_assigner:n,media_filter:d,media_viewer:m,recording:l,thumbnail:c,timeline:u};export{e as common,a as config,p as default,o as display_modes,i as editor,r as elements,t as error,s as event,n as key_assigner,d as media_filter,m as media_viewer,l as recording,c as thumbnail,u as timeline}; diff --git a/config/www/community/frigate-hass-card/lang-pt-BR-83a703b9.js.gz b/config/www/community/frigate-hass-card/lang-pt-BR-83a703b9.js.gz new file mode 100644 index 00000000..53e5bad7 Binary files /dev/null and b/config/www/community/frigate-hass-card/lang-pt-BR-83a703b9.js.gz differ diff --git a/config/www/community/frigate-hass-card/lang-pt-PT-c4863423.js b/config/www/community/frigate-hass-card/lang-pt-PT-c4863423.js new file mode 100644 index 00000000..fd669394 --- /dev/null +++ b/config/www/community/frigate-hass-card/lang-pt-PT-c4863423.js @@ -0,0 +1 @@ +var e={frigate_card:"Cartão Frigate",frigate_card_description:"Um cartão da Lovelace para usar com Frigate",live:"Ao Vivo",no_media:"Sem média",recordings:"Gravações",version:"Versão"},a={cameras:{camera_entity:"Entidade da Câmera",capabilities:{capabilities:{clips:"","favorite-events":"","favorite-recordings":"",live:"",menu:"",ptz:"",recordings:"",seek:"",snapshots:"",substream:""},disable:"",disable_except:"",editor_label:""},cast:{dashboard:{dashboard_path:"",view_path:""},editor_label:"",method:"",methods:{dashboard:"",standard:""}},dependencies:{all_cameras:"Mostrar eventos para todas as câmeras nesta câmera",cameras:"Mostrar eventos para câmeras específicas nesta câmera",editor_label:"Opções de dependência"},dimensions:{aspect_ratio:"",editor_label:"",layout:{editor_label:"",fit:"Fit",fits:{contain:"Conter",cover:"Tapar",fill:"Preencher"},pan:{x:"",y:""},position:{editor_label:"",x:"Percentagem da localização horizontal",y:"Percentagem da localização vertical"},view_box:{bottom:"",editor_label:"",left:"",right:"",top:""},zoom:""}},engines:{editor_label:"Editor de etiquetas"},frigate:{camera_name:"Nome da câmera do Frigate (detectado automaticamente pela entidade)",client_id:"ID do cliente do Frigate (para >1 servidor Frigate)",editor_label:"Opções do Frigate",labels:"Etiquetas",url:"URL do servidor Frigate",zones:"Zonas"},go2rtc:{editor_label:"Editor de etiquetas",modes:{editor_label:"Editor de etiquetas",mjpeg:"Mjpeg",mp4:"Mp4",mse:"Mse",webrtc:"Webrtc"},stream:"Stream"},icon:"Ícone para esta câmera (detectado automaticamente pela entidade)",id:"ID exclusivo para esta câmera nesse cartão",image:{editor_label:"Editor etiquetas",refresh_seconds:"Atualizar em segundos",url:"Link"},live_provider:"Fonte de visualização ao vivo para esta câmera",live_provider_options:{editor_label:"Editor de etiquetas"},live_providers:{auto:"Automatico",go2rtc:"Go2rtc",ha:"Ha",image:"Imagem",jsmpeg:"JSMpeg","webrtc-card":"Cartão WebRTC (de @AlexxIT)"},motioneye:{editor_label:"Directoria pre-definido",images:{directory_pattern:"Directoria pre-definido",file_pattern:"Ficheiro pre-definido"},movies:{directory_pattern:"Directoria pre-definida",file_pattern:"Ficheiro pre-definido"},url:"Link"},proxy:{dynamic:"",editor_label:"",media:{auto:"",editor_label:"",false:"",true:""},ssl_ciphers:{auto:"",default:"",editor_label:"",insecure:"",intermediate:"",modern:""},ssl_verification:{auto:"",editor_label:"",false:"",true:""}},reolink:{editor_label:"",media_resolution:{editor_label:"",high:"",low:""},url:""},title:"Título para esta câmera (detectado automaticamente pela entidade)",triggers:{editor_label:"Opções de activação",entities:"Activar a partir de outras entidades",events:{clips:"",editor_label:"",events:"",snapshots:""},motion:"Activar detectando automaticamente o sensor de movimento",occupancy:"Activar detectando automaticamente o sensor de ocupação"},webrtc_card:{editor_label:"Opções do cartão WebRTC",entity:"Entidade de câmera de cartão WebRTC (não é uma câmera Frigate)",url:"URL da câmera do cartão WebRTC"}},common:{controls:{builtin:"",filter:{editor_label:"Editor de titulos",mode:"Modo",modes:{left:"Esquerda",none:"Nenhum",right:"Direita"}},next_previous:{editor_label:"Editor de titulos",size:"Tamanho de controle próximo e anterior",style:"Estilo do controle próximo e anterior",styles:{chevrons:"Setas",icons:"Ícones",none:"Nenhum",thumbnails:"Miniaturas"}},thumbnails:{editor_label:"Editor de titulos",events_media_type:"Mostrar miniaturas de clipes ou snapshots",events_media_types:{clips:"Miniaturas de clipes",snapshots:"Miniaturas de Snapshots"},media_type:"",media_types:{events:"",recordings:""},mode:"Modos",modes:{above:"Miniaturas acima da mídia",below:"Miniaturas abaixo da mídia",left:"Miniaturas em uma gaveta à esquerda",none:"Sem miniaturas",right:"Miniaturas em uma gaveta à direita"},show_details:"Mostrar detalhes",show_download_control:"Mostrar o botão de download",show_favorite_control:"Mostrar o botão de favorito nas miniaturas",show_timeline_control:"Mostrar a linha do tempo nas miniaturas",size:"Tamanho das miniaturas em pixels"},timeline:{editor_label:"Controles de linha do tempo",mode:"Modo",modes:{above:"Por cima",below:"Abaixo",none:"Nenhum"},pan_mode:"",pan_modes:{pan:"",seek:"","seek-in-camera":"","seek-in-media":""}}},display:{editor_label:"",grid_columns:"",grid_max_columns:"",grid_selected_width_factor:"",mode:""},image:{entity:"",entity_parameters:"",mode:"Modo de visualização de imagem",modes:{camera:"Instantâneo da câmera do Home Assistant, da entidade de câmera",entity:"",screensaver:"Logo Frigate embutido",url:"Imagem arbitrária especificada por URL"},refresh_seconds:"Número de segundos após o qual atualizar (0 = nunca)",url:"Imagem arbitrária especificada por URL"},media_action_conditions:{all:"Todas as oportunidades",hidden:"Ao ocultar o navegador/aba",microphone_mute:"",microphone_unmute:"",never:"Nunca",selected:"Ao selecionar",unselected:"Ao desselecionar",visible:"Ao mostrar o navegador/aba"},timeline:{clustering_threshold:"A contagem de eventos nos quais eles são agrupados (0 = sem agrupamento)",events_media_type:"A mídia que a linha do tempo exibe",events_media_types:{all:"Todos os tipos de mídia",clips:"Clipes",snapshots:"Instantâneos"},show_recordings:"Mostrar gravações",style:"",styles:{ribbon:"",stack:""},window_seconds:"A duração padrão da visualização da linha do tempo em segundos"}},dimensions:{aspect_ratio:"Proporção padrão (e.g. '16:9')",aspect_ratio_mode:"Modo de proporção",aspect_ratio_modes:{dynamic:"A proporção se ajusta à mídia",static:"Proporção estática",unconstrained:"Proporção irrestrita"},height:""},live:{auto_mute:"Silenciar câmeras ao vivo automaticamente",auto_pause:"Parar câmeras ao vivo automaticamente",auto_play:"Reproduzir câmeras ao vivo automaticamente",auto_unmute:"Ativar automaticamente o som das câmeras ao vivo",controls:{editor_label:"Controles da visualização ao vivo",ptz:{editor_label:"",hide_home:"",hide_pan_tilt:"",hide_zoom:"",mode:"",modes:{off:"",on:""},orientation:"",orientations:{horizontal:"",vertical:""},position:"",positions:{"bottom-left":"","bottom-right":"","top-left":"","top-right":""}}},draggable:"A visualização ao vivo das câmeras pode ser arrastada/deslizada",lazy_load:"As câmeras ao vivo são carregadas lentamente",lazy_unload:"As câmeras ao vivo são descarregadas preguiçosamente",microphone:{always_connected:"",disconnect_seconds:"",editor_label:"",enabled:"",mute_after_microphone_mute_seconds:""},preload:"Pré-carregar a visualização ao vivo em segundo plano",show_image_during_load:"Mostar imagem durante o carregamento",transition_effect:"Efeito de transição de câmera ao vivo",zoomable:""},media_viewer:{auto_mute:"Silenciar mídia automaticamente",auto_pause:"Parar mídia automaticamente",auto_play:"Reproduzir mídia automaticamente",auto_unmute:"Ativar mídia automaticamente",controls:{editor_label:"Controles do visualizador de mídia"},draggable:"Visualizador de eventos pode ser arrastado/deslizado",lazy_load:"A mídia do Visualizador de eventos é carregada lentamente no carrossel",snapshot_click_plays_clip:"",transition_effect:"Efeito de transição do Visualizador de eventos",transition_effects:{none:"Sem transição",slide:"Transição de slides"},zoomable:""},menu:{alignment:"Alinhamento do menu",alignments:{bottom:"Alinhado à parte inferior",left:"Alinhado à esquerda",right:"Alinhado à direita",top:"Alinhado ao topo"},button_size:"Tamanho do botão de menu (e.g. '40px')",buttons:{alignment:"Alinhamento do botão",alignments:{matching:"Mesmo alinhamento do menu",opposing:"Opor-se ao alinhamento do menu"},camera_ui:"Camera",cameras:"Selecionar câmera",clips:"Clipes",display_mode:"",download:"Descarregar mídia do evento",enabled:"Botão ativado",expand:"Expandir",frigate:"Frigate menu / Visualização padrão",fullscreen:"Tela cheia",icon:"Ícone",image:"Imagem",live:"Ao vivo",media_player:"Enviar para o reprodutor de mídia",microphone:"",mute:"",permanent:"",play:"",priority:"Prioridade",ptz_controls:"",ptz_home:"",recordings:"",screenshot:"",snapshots:"Instantâneos",substreams:"substreams",timeline:"Linha do tempo",type:"",types:{momentary:"",toggle:""}},position:"Posição do menu",positions:{bottom:"Posicionado na parte inferior",left:"Posicionado à esquerda",right:"Posicionado à direita",top:"Posicionado no topo"},style:"Estilo do menu",styles:{hidden:"Menu oculto",hover:"Menu suspenso","hover-card":"",none:"Sem menu",outside:"Menu externo",overlay:"Menu sobreposto"}},overrides:{info:"Esta configuração do cartão especificou manualmente as substituições configuradas que podem substituir os valores mostrados no editor visual, consulte o editor de código para visualizar/modificar essas substituições"},performance:{features:{animated_progress_indicator:"Animação na barra de progresso",editor_label:"Editor de etiquetas",max_simultaneous_engine_requests:"",media_chunk_size:"Tamanho do ficheiro"},style:{border_radius:"Tamanho do bordo",box_shadow:"Caixa de Fundo",editor_label:"Editor de etiquetas"},warning:"Avisos"},profiles:{casting:"",editor_label:"","low-performance":"",scrubbing:""},status_bar:{height:"",items:{enabled:"",engine:"",live_provider:"",priority:"",resolution:"",technology:"",title:""},popup_seconds:"",position:"",positions:{bottom:"",top:""},style:"",styles:{hover:"","hover-card":"",none:"",outside:"",overlay:"",popup:""}},view:{camera_select:"Visualização de câmeras recém-selecionadas",dark_mode:"Modo escuro",dark_modes:{auto:"Automático",off:"Desligado",on:"Ligado"},default:"Visualização padrão",default_cycle_camera:"Percorrer as câmeras quando a visualização padrão for atualizada",default_reset:{after_interaction:"",editor_label:"",entities:"",every_seconds:"Atualize a visualização padrão a cada X segundos (0 = nunca)",interaction_mode:"",interaction_modes:{active:"",all:"",inactive:""}},interaction_seconds:"",keyboard_shortcuts:{editor_label:"",enabled:"",ptz_down:"",ptz_home:"",ptz_left:"",ptz_right:"",ptz_up:"",ptz_zoom_in:"",ptz_zoom_out:""},triggers:{actions:{editor_label:"",interaction_mode:"",interaction_modes:{active:"",all:"",inactive:""},trigger:"",triggers:{default:"",live:"",media:"",none:""},untrigger:"",untriggers:{default:"",none:""}},editor_label:"",filter_selected_camera:"",show_trigger_status:"Exibir estado do gatilho",untrigger_seconds:"Segundos após a mudar para o estado inativo para desacionar"},views:{clip:"Clipe mais recente",clips:"Galeria de clipes",current:"Visualização atual",image:"Imagem estática",live:"Visualização ao vivo",recording:"",recordings:"",snapshot:"Snapshot mais recente",snapshots:"Galeria de Snapshots",timeline:"Visualização da linha do tempo"}}},o={grid:"",single:""},i={add_new_camera:"Adicionar nova câmera",button:"Botão",camera:"Câmera",cameras:"Câmeras",cameras_secondary:"Câmeras para renderizar neste cartão",delete:"Excluir",dimensions:"",dimensions_secondary:"",image:"Imagem",image_secondary:"Opções de visualização de imagem estática",live:"Ao vivo",live_secondary:"Opções de visualização da câmera ao vivo",media_gallery:"Galeria",media_gallery_secondary:"Galeria Secundaria",media_viewer:"Visualizador de eventos",media_viewer_secondary:"Opções do visualizador de Snapshots e clipes",menu:"Menu",menu_secondary:"Opções de aparência do menu",move_down:"Descer",move_up:"Subir",overrides:"As substituições estão ativas",overrides_secondary:"Substituições de configuração dinâmica detectadas",performance:"",performance_secondary:"",profiles:"",profiles_secondary:"",status_bar:"",status_bar_secondary:"",timeline:"Linha do tempo",timeline_secondary:"Opções do evento da linha do tempo",upgrade:"Actualização",upgrade_available:"Está disponível uma atualização automática do cartão",view:"Visualizar",view_secondary:"O que deve ser mostrado neste cartão"},t={ptz:{down:"Baixo",home:"Origem",left:"Esquerda",right:"Direira",up:"Cima",zoom_in:"Ampliar",zoom_out:"Reduzir"}},r={awaiting_live:"",awaiting_media:"",camera_initialization:"",camera_initialization_reolink:"",could_not_render_elements:"Não foi possível renderizar os elementos da imagem",could_not_resolve:"Não foi possível resolver o URL de mídia",diagnostics:"Diagnósticos do cartão. Reveja as informações confidenciais antes de partilhar",download_no_media:"Nenhuma mídia para download",download_sign_failed:"Não foi possível assinar o URL de mídia para download",duplicate_camera_id:"Duplique o ID da câmera Frigate para a câmera a seguir, use o parâmetro 'id' para identificar exclusivamente as câmeras",empty_response:"Sem resposta do Home Assistant para a solicitação",failed_response:"Falha ao receber resposta do Home Assistant para solicitação",failed_retain:"Não foi possível reter o evento",failed_sign:"Não foi possível assinar a URL do Home Assistant",image_load_error:"A imagem não pôde ser carregada",invalid_configuration:"Configuração inválida",invalid_configuration_no_hint:"Nenhuma dica de local disponível (tipo incorreto ou ausente?)",invalid_configuration_override:"",invalid_elements_config:"Configuração de elementos de imagem inválida",invalid_response:"Resposta inválida recebida do Home Assistant para a solicitação",jsmpeg_no_player:"Não foi possível iniciar o player JSMPEG",live_camera_no_endpoint:"Nenhuma câmera ao vivo",live_camera_not_found:"Nenhuma câmera ao vivo não foi encontrada",live_camera_unavailable:"Câmera ao vivo indisponivel",no_camera_engine:"Não existe câmera",no_camera_entity:"Não existe uma entidade câmera",no_camera_entity_for_triggers:"Não existe camera para a acção",no_camera_id:"Não foi possível determinar o ID da câmera para a câmera a seguir, pode ser necessário definir o parâmetro 'id' manualmente",no_camera_name:"Não foi possível determinar o nome da câmera da Frigate, especifique 'camera_entity' ou 'camera_name' para a câmera a seguir",no_dashboard_or_view:"",no_live_camera:"O parâmetro camera_entity deve ser definido e válido para este serviço ativo",no_supported_camera:"",no_supported_cameras:"",reconnecting:"A voltar a ligar",too_many_automations:"",troubleshooting:"Verifique a solução de problemas",unknown:"Erro desconhecido",upgrade_available:"Uma atualização automatizada da configuração do cartão está disponível, visite o editor visual do cartão",webrtc_card_reported_error:"O cartão WebRTC relatou um erro",webrtc_card_waiting:"Aguardar o cartão WebRTC carregar ..."},s={camera:"Camera",duration:"Duração",in_progress:"Em andamento",score:"Pontuação",seek:"Procurar",start:"Início",tag:"",what:"O quê",where:"Onde"},n={assign:"",assigning:"",modifiers:{alt:"",ctrl:"",meta:"",shift:""},unassign:""},d={all:"Todos",camera:"Camera",favorite:"Favoritos",media_type:"Tipos de media",media_types:{clips:"Clips",recordings:"Gravações",snapshots:"Imagens"},not_favorite:"Não favorito",select_camera:"Seleciona a camara",select_favorite:"Seleciona o favorito",select_media_type:"Seleciona o tipo de media",select_tag:"",select_what:"Seleciona",select_when:"Seleciona quando",select_where:"Seleciona onde",tag:"",what:"O que",when:"Quando",whens:{custom:"",past_month:"O mes passado",past_week:"A semana passada",today:"Hoje",yesterday:"Ontem"},where:"Onde"},l={unseekable:""},m={camera:"Camera",duration:"Duração",events:"Eventos",in_progress:"Em andamento",seek:"Procurar",start:"Começar"},c={download:"",no_thumbnail:"Nenhuma miniatura disponível",retain_indefinitely:"Evento será retido por tempo indeterminado",timeline:"Ver evento na linha do tempo"},u={select_date:"Selecionar a data"},_={common:e,config:a,display_modes:o,editor:i,elements:t,error:r,event:s,key_assigner:n,media_filter:d,media_viewer:l,recording:m,thumbnail:c,timeline:u};export{e as common,a as config,_ as default,o as display_modes,i as editor,t as elements,r as error,s as event,n as key_assigner,d as media_filter,l as media_viewer,m as recording,c as thumbnail,u as timeline}; diff --git a/config/www/community/frigate-hass-card/lang-pt-PT-c4863423.js.gz b/config/www/community/frigate-hass-card/lang-pt-PT-c4863423.js.gz new file mode 100644 index 00000000..faec0e45 Binary files /dev/null and b/config/www/community/frigate-hass-card/lang-pt-PT-c4863423.js.gz differ diff --git a/config/www/community/frigate-hass-card/media-1a34ac2c.js b/config/www/community/frigate-hass-card/media-1a34ac2c.js new file mode 100644 index 00000000..4def2bf4 --- /dev/null +++ b/config/www/community/frigate-hass-card/media-1a34ac2c.js @@ -0,0 +1,33 @@ +import{cL as t,cM as a,dC as n,dD as i,cP as o,dE as e,_ as r,n as s,b as c,t as d,a as l,dF as h,x as p,e as m,dG as u,r as g,dH as _,dI as f,dJ as v,dK as b,dL as y,l as z}from"./card-45855f1f.js"; +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const w={},C=t(class extends a{constructor(){super(...arguments),this.ot=w}render(t,a){return a()}update(t,[a,i]){if(Array.isArray(a)){if(Array.isArray(this.ot)&&this.ot.length===a.length&&a.every(((t,a)=>t===this.ot[a])))return n}else if(this.ot===a)return n;return this.ot=Array.isArray(a)?Array.from(a):a,this.render(a,i)}});class x{constructor(){this._options=null,this._viewportIntersecting=null,this._microphoneMuteTimer=new i,this._root=null,this._eventListeners=new Map,this._children=[],this._target=null,this._mutationObserver=new MutationObserver(this._mutationHandler.bind(this)),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this)),this._mediaLoadedHandler=async t=>{this._target?.index===t&&(await this._unmuteTargetIfConfigured(this._target.selected?"selected":"visible"),await this._playTargetIfConfigured(this._target.selected?"selected":"visible"))},this._visibilityHandler=async()=>{await this._changeVisibility("visible"===document.visibilityState)},this._changeVisibility=async t=>{t?(await this._unmuteTargetIfConfigured("visible"),await this._playTargetIfConfigured("visible")):(await this._pauseAllIfConfigured("hidden"),await this._muteAllIfConfigured("hidden"))},this._microphoneChangeHandler=async t=>{"unmuted"===t?await this._unmuteTargetIfConfigured("microphone"):"muted"===t&&this._options?.autoMuteConditions?.includes("microphone")&&this._microphoneMuteTimer.start(this._options.microphoneMuteSeconds??60,(async()=>{await this._muteTargetIfConfigured("microphone")}))}}setOptions(t){this._options=t,this._options?.microphoneManager&&(this._options.microphoneManager.removeListener(this._microphoneChangeHandler),this._options.microphoneManager.addListener(this._microphoneChangeHandler))}hasRoot(){return!!this._root}destroy(){this._viewportIntersecting=null,this._microphoneMuteTimer.stop(),this._root=null,this._removeChildHandlers(),this._children=[],this._target=null,this._mutationObserver.disconnect(),this._intersectionObserver.disconnect(),this._options?.microphoneManager?.removeListener(this._microphoneChangeHandler),document.removeEventListener("visibilitychange",this._visibilityHandler)}async setTarget(t,a){this._target?.index===t&&this._target?.selected===a||(this._target?.selected&&(await this._pauseTargetIfConfigured("unselected"),await this._muteTargetIfConfigured("unselected"),this._microphoneMuteTimer.stop()),this._target={selected:a,index:t},a?(await this._unmuteTargetIfConfigured("selected"),await this._playTargetIfConfigured("selected")):(await this._unmuteTargetIfConfigured("visible"),await this._playTargetIfConfigured("visible")))}unsetTarget(){this._target=null}async _playTargetIfConfigured(t){null!==this._target&&this._options?.autoPlayConditions?.includes(t)&&await this._play(this._target.index)}async _play(t){await(this._children[t]?.play())}async _unmuteTargetIfConfigured(t){null!==this._target&&this._options?.autoUnmuteConditions?.includes(t)&&await this._unmute(this._target.index)}async _unmute(t){await(this._children[t]?.unmute())}async _pauseAllIfConfigured(t){if(this._options?.autoPauseConditions?.includes(t))for(const t of this._children.keys())await this._pause(t)}async _pauseTargetIfConfigured(t){null!==this._target&&this._options?.autoPauseConditions?.includes(t)&&await this._pause(this._target.index)}async _pause(t){await(this._children[t]?.pause())}async _muteAllIfConfigured(t){if(this._options?.autoMuteConditions?.includes(t))for(const t of this._children.keys())await this._mute(t)}async _muteTargetIfConfigured(t){null!==this._target&&this._options?.autoMuteConditions?.includes(t)&&await this._mute(this._target.index)}async _mute(t){await(this._children[t]?.mute())}_mutationHandler(t,a){this._initializeRoot()}_removeChildHandlers(){for(const[t,a]of this._eventListeners.entries())t.removeEventListener("frigate-card:media:loaded",a);this._eventListeners.clear()}initialize(t){this._root=t,this._initializeRoot(),document.addEventListener("visibilitychange",this._visibilityHandler),this._intersectionObserver.disconnect(),this._intersectionObserver.observe(t),this._mutationObserver.disconnect(),this._mutationObserver.observe(this._root,{childList:!0,subtree:!0})}_initializeRoot(){if(this._options&&this._root){this._removeChildHandlers(),this._children=[...this._root.querySelectorAll(this._options.playerSelector)];for(const[t,a]of this._children.entries()){const n=()=>this._mediaLoadedHandler(t);this._eventListeners.set(a,n),a.addEventListener("frigate-card:media:loaded",n)}}}async _intersectionHandler(t){const a=this._viewportIntersecting;this._viewportIntersecting=t.some((t=>t.isIntersecting)),null!==a&&a!==this._viewportIntersecting&&await this._changeVisibility(this._viewportIntersecting)}}const I={active:!0,breakpoints:{},lazyLoadCount:0};function A(t={}){let a,n,i;const o=new Set,e=["init","select"],r=["select"];function s(){"hidden"===document.visibilityState&&a.lazyUnloadConditions?.includes("hidden")?o.forEach((t=>{a.lazyUnloadCallback&&(a.lazyUnloadCallback(t,i[t]),o.delete(t))})):"visible"===document.visibilityState&&a.lazyLoadCallback&&d()}function c(t){return o.has(t)}function d(){const t=a.lazyLoadCount,e=n.selectedScrollSnap(),r=new Set;for(let a=1;a<=t&&e-a>=0;a++)r.add(e-a);r.add(e);for(let a=1;a<=t&&e+a{!c(t)&&a.lazyLoadCallback&&(o.add(t),a.lazyLoadCallback(t,i[t]))}))}function l(){const t=n.previousScrollSnap();c(t)&&a.lazyUnloadCallback&&(a.lazyUnloadCallback(t,i[t]),o.delete(t))}return{name:"autoLazyLoad",options:t,init:function(o,c){const{mergeOptions:h,optionsAtMedia:p}=c,m=h(I,t);a=p(m),n=o,i=n.slideNodes(),a.lazyLoadCallback&&e.forEach((t=>n.on(t,d))),a.lazyUnloadCallback&&a.lazyUnloadConditions?.includes("unselected")&&r.forEach((t=>n.on(t,l))),document.addEventListener("visibilitychange",s)},destroy:function(){a.lazyLoadCallback&&e.forEach((t=>n.off(t,d))),a.lazyUnloadCallback&&r.forEach((t=>n.off(t,l))),document.removeEventListener("visibilitychange",s)}}}function L(){let t,a=[];const n=[];function i(i){const o=i.composedPath();for(const[e,r]of[...a.entries()].reverse())if(o.includes(r)){n[e]=i.detail,e!==t.selectedScrollSnap()&&i.stopPropagation();break}}function e(i){const o=i.composedPath();for(const[e,r]of a.entries())if(o.includes(r)){delete n[e],e!==t.selectedScrollSnap()&&i.stopPropagation();break}}function r(){const i=t.selectedScrollSnap(),e=n[i];e&&o(a[i],e)}return{name:"autoMediaLoadedInfo",options:{},init:function(n){t=n,a=t.slideNodes();for(const t of a)t.addEventListener("frigate-card:media:loaded",i),t.addEventListener("frigate-card:media:unloaded",e);t.on("init",r),t.containerNode().addEventListener("frigate-card:carousel:force-select",r)},destroy:function(){for(const t of a)t.removeEventListener("frigate-card:media:loaded",i),t.removeEventListener("frigate-card:media:unloaded",e);t.off("init",r),t.containerNode().removeEventListener("frigate-card:carousel:force-select",r)}}}class S{constructor(t){this._scrolling=!1,this._shouldReInitOnScrollStop=!1,this._scrollingStart=()=>{this._scrolling=!0},this._scrollingStop=()=>{this._scrolling=!1,this._shouldReInitOnScrollStop&&(this._shouldReInitOnScrollStop=!1,this._debouncedReInit())},this._debouncedReInit=e((()=>{this._scrolling=!1,this._shouldReInitOnScrollStop=!1,this._emblaApi?.reInit()}),500,{trailing:!0}),this._emblaApi=t,this._emblaApi.on("scroll",this._scrollingStart),this._emblaApi.on("settle",this._scrollingStop),this._emblaApi.on("destroy",this.destroy)}destroy(){this._emblaApi.off("scroll",this._scrollingStart),this._emblaApi.off("settle",this._scrollingStop),this._emblaApi.off("destroy",this.destroy)}reinit(){this._scrolling?this._shouldReInitOnScrollStop=!0:this._debouncedReInit()}}function T(){let t,a=null,n=null;const i=new Map,o=new ResizeObserver((function(t){let a=!1;for(const n of t){const t={height:n.contentRect.height,width:n.contentRect.width},o=i.get(n.target);t.width&&t.height&&(o?.height!==t.height||o?.width!==t.width)&&(i.set(n.target,t),a=!0)}a&&s()})),r=new IntersectionObserver((function(t){const i=t.some((t=>t.isIntersecting));if(i!==n){const t=i&&null!==n;n=i,t&&a?.reinit()}})),s=e((()=>function(){const{slideRegistry:n,options:{axis:i}}=t.internalEngine();if("y"===i)return;t.containerNode().style.removeProperty("max-height");const o=n[t.selectedScrollSnap()],e=t.slideNodes(),r=Math.max(...o.map((t=>e[t].getBoundingClientRect().height)));!isNaN(r)&&r>0&&(t.containerNode().style.maxHeight=`${r}px`);a?.reinit()}()),200,{trailing:!0});return{name:"autoSize",options:{},init:function(n){t=n,a=new S(t),r.observe(t.containerNode()),o.observe(t.containerNode());for(const a of t.slideNodes())o.observe(a);t.containerNode().addEventListener("frigate-card:media:loaded",s),t.on("settle",s)},destroy:function(){r.disconnect(),o.disconnect(),a?.destroy(),t.containerNode().removeEventListener("frigate-card:media:loaded",s),t.off("settle",s)}}}let $=class extends l{constructor(){super(...arguments),this.disabled=!1,this.label="",this._embedThumbnailTask=h(this,(()=>this.hass),(()=>this.thumbnail))}set controlConfig(t){t?.size&&this.style.setProperty("--frigate-card-next-prev-size",`${t.size}px`),this._controlConfig=t}render(){if(this.disabled||!this._controlConfig||"none"==this._controlConfig.style)return p``;const t=!this.thumbnail||["chevrons","icons"].includes(this._controlConfig.style),a={controls:!0,previous:"previous"===this.direction,next:"next"===this.direction,thumbnails:!t,icons:t,button:t};if(t){const t=this.thumbnail&&this.icon&&"chevrons"!==this._controlConfig.style?this.icon:"previous"===this.direction?"mdi:chevron-left":"mdi:chevron-right";return p` + + `}return u(this,this._embedThumbnailTask,(t=>t?p``:p``),{inProgressFunc:()=>p`
`})}static get styles(){return g("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n --frigate-card-next-prev-size: 48px;\n --frigate-card-next-prev-size-hover: calc(var(--frigate-card-next-prev-size) * 2);\n --frigate-card-prev-position: 45px;\n --frigate-card-next-position: 45px;\n --mdc-icon-button-size: var(--frigate-card-next-prev-size);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n}\n\n.controls {\n position: absolute;\n z-index: 1;\n overflow: hidden;\n}\n\n.controls.previous {\n left: var(--frigate-card-prev-position);\n}\n\n.controls.next {\n right: var(--frigate-card-next-position);\n}\n\n.controls.icons {\n top: calc(50% - var(--frigate-card-next-prev-size) / 2);\n}\n\n.controls.thumbnails {\n border-radius: 50%;\n height: var(--frigate-card-next-prev-size);\n top: calc(50% - var(--frigate-card-next-prev-size) / 2);\n box-shadow: var(--frigate-card-css-box-shadow, 0px 0px 20px 5px black);\n transition: all 0.2s ease-out;\n opacity: 0.8;\n aspect-ratio: 1/1;\n}\n\n.controls.thumbnails:hover {\n opacity: 1 !important;\n height: var(--frigate-card-next-prev-size-hover);\n top: calc(50% - var(--frigate-card-next-prev-size-hover) / 2);\n}\n\n.controls.previous.thumbnails:hover {\n left: calc(var(--frigate-card-prev-position) - (var(--frigate-card-next-prev-size-hover) - var(--frigate-card-next-prev-size)) / 2);\n}\n\n.controls.next.thumbnails:hover {\n right: calc(var(--frigate-card-next-position) - (var(--frigate-card-next-prev-size-hover) - var(--frigate-card-next-prev-size)) / 2);\n}")}};r([s({attribute:!1})],$.prototype,"direction",void 0),r([s({attribute:!1})],$.prototype,"hass",void 0),r([c()],$.prototype,"_controlConfig",void 0),r([s({attribute:!1})],$.prototype,"thumbnail",void 0),r([s({attribute:!1})],$.prototype,"icon",void 0),r([s({attribute:!0,type:Boolean})],$.prototype,"disabled",void 0),r([s()],$.prototype,"label",void 0),$=r([d("frigate-card-next-previous-control")],$);class P{constructor(t){this._config=null,this._hass=null,this._cameraManager=null,this._cameraID=null,this._host=t}setConfig(t){this._config=t??null,this._host.setAttribute("data-orientation",t?.orientation??"horizontal"),this._host.setAttribute("data-position",t?.position??"bottom-right"),this._host.setAttribute("style",Object.entries(t?.style??{}).map((([t,a])=>`${t}:${a}`)).join(";"))}getConfig(){return this._config}setCamera(t,a){this._cameraManager=t??null,this._cameraID=a??null}setForceVisibility(t){this._forceVisibility=t}handleAction(t,a){t.stopPropagation();const n=t.detail.action,i=_(n,a);i&&f(this._host,{action:i,...a&&{config:a}})}hasUsefulAction(){const t={pt:!0,z:!0,home:!0};if(!this._cameraID)return t;const a=this._cameraManager?.getCameraCapabilities(this._cameraID);if(!a||!a.hasPTZCapability())return t;const n=a.getPTZCapabilities();return{pt:!!(n?.up||n?.down||n?.left||n?.right),z:!!n?.zoomIn||!!n?.zoomOut,home:!!n?.presets?.length}}shouldDisplay(){return void 0!==this._forceVisibility?this._forceVisibility:"auto"===this._config?.mode?!!this._cameraID&&!!this._cameraManager?.getCameraCapabilities(this._cameraID)?.hasPTZCapability():"on"===this._config?.mode}getPTZActions(){const t=t=>({start_tap_action:v({ptzAction:t?.ptzAction,ptzPhase:"start",ptzPreset:t?.preset}),end_tap_action:v({ptzAction:t?.ptzAction,ptzPhase:"stop",ptzPreset:t?.preset})}),a={};return a.up=t({ptzAction:"up"}),a.down=t({ptzAction:"down"}),a.left=t({ptzAction:"left"}),a.right=t({ptzAction:"right"}),a.zoom_in=t({ptzAction:"zoom_in"}),a.zoom_out=t({ptzAction:"zoom_out"}),a.home={tap_action:v()},a}}let k=class extends l{constructor(){super(...arguments),this._controller=new P(this),this._actions=this._controller.getPTZActions(),this._actionPresence=null}willUpdate(t){t.has("config")&&this._controller.setConfig(this.config),(t.has("cameraManager")||t.has("cameraID"))&&this._controller.setCamera(this.cameraManager,this.cameraID),t.has("forceVisibility")&&this._controller.setForceVisibility(this.forceVisibility),(t.has("cameraID")||t.has("cameraManager"))&&(this._actionPresence=this._controller.hasUsefulAction())}render(){if(!this._controller.shouldDisplay())return;const t=(t,a,n)=>n?p`this._controller.handleAction(t,n)} + >`:p``,a=this._controller.getConfig();return p`
+ ${!a?.hide_pan_tilt&&this._actionPresence?.pt?p`
+ ${t("right","mdi:arrow-right",this._actions.right)} + ${t("left","mdi:arrow-left",this._actions.left)} + ${t("up","mdi:arrow-up",this._actions.up)} + ${t("down","mdi:arrow-down",this._actions.down)} +
`:""} + ${!a?.hide_zoom&&this._actionPresence?.z?p`
+ ${t("zoom_in","mdi:plus",this._actions.zoom_in)} + ${t("zoom_out","mdi:minus",this._actions.zoom_out)} +
`:p``} + ${!a?.hide_home&&this._actionPresence?.home?p`
+ ${t("home","mdi:home",this._actions.home)} +
`:p``} +
`}static get styles(){return g(":host {\n position: absolute;\n width: fit-content;\n height: fit-content;\n --frigate-card-ptz-icon-size: 24px;\n}\n\n:host([data-position$=-left]) {\n left: 5%;\n}\n\n:host([data-position$=-right]) {\n right: 5%;\n}\n\n:host([data-position^=top-]) {\n top: 5%;\n}\n\n:host([data-position^=bottom-]) {\n bottom: 5%;\n}\n\n/*****************\n * Main Containers\n *****************/\n.ptz {\n display: flex;\n gap: 10px;\n color: var(--light-primary-color);\n opacity: 0.4;\n transition: opacity 0.3s ease-in-out;\n}\n\n:host([data-orientation=vertical]) .ptz {\n flex-direction: column;\n}\n\n:host([data-orientation=horizontal]) .ptz {\n flex-direction: row;\n}\n\n.ptz:hover {\n opacity: 1;\n}\n\n:host([data-orientation=vertical]) .ptz div {\n width: calc(var(--frigate-card-ptz-icon-size) * 3);\n}\n\n:host([data-orientation=horizontal]) .ptz div {\n height: calc(var(--frigate-card-ptz-icon-size) * 3);\n}\n\n.ptz-move,\n.ptz-zoom,\n.ptz-home {\n position: relative;\n background-color: rgba(0, 0, 0, 0.3);\n}\n\n.ptz-move {\n height: calc(var(--frigate-card-ptz-icon-size) * 3);\n width: calc(var(--frigate-card-ptz-icon-size) * 3);\n border-radius: 50%;\n}\n\n:host([data-orientation=horizontal]) .ptz .ptz-zoom,\n:host([data-orientation=horizontal]) .ptz .ptz-home {\n width: calc(var(--frigate-card-ptz-icon-size) * 1.5);\n}\n\n:host([data-orientation=vertical]) .ptz .ptz-zoom,\n:host([data-orientation=vertical]) .ptz .ptz-home {\n height: calc(var(--frigate-card-ptz-icon-size) * 1.5);\n}\n\n.ptz-zoom,\n.ptz-home {\n border-radius: var(--ha-card-border-radius, 4px);\n}\n\n/***********\n * PTZ Icons\n ***********/\nha-icon {\n position: absolute;\n --mdc-icon-size: var(--frigate-card-ptz-icon-size);\n}\n\nha-icon:not(.disabled) {\n cursor: pointer;\n}\n\n.disabled {\n color: var(--disabled-text-color);\n}\n\n.up {\n top: 5px;\n left: 50%;\n transform: translateX(-50%);\n}\n\n.down {\n bottom: 5px;\n left: 50%;\n transform: translateX(-50%);\n}\n\n.left {\n left: 5px;\n top: 50%;\n transform: translateY(-50%);\n}\n\n.right {\n right: 5px;\n top: 50%;\n transform: translateY(-50%);\n}\n\n:host([data-orientation=vertical]) .zoom_in {\n right: 5px;\n top: 50%;\n}\n\n:host([data-orientation=vertical]) .zoom_out {\n left: 5px;\n top: 50%;\n}\n\n:host([data-orientation=horizontal]) .zoom_in {\n left: 50%;\n top: 5px;\n}\n\n:host([data-orientation=horizontal]) .zoom_out {\n left: 50%;\n bottom: 5px;\n}\n\n:host([data-orientation=vertical]) .zoom_in,\n:host([data-orientation=vertical]) .zoom_out {\n transform: translateY(-50%);\n}\n\n:host([data-orientation=horizontal]) .zoom_in,\n:host([data-orientation=horizontal]) .zoom_out {\n transform: translateX(-50%);\n}\n\n.home {\n top: 50%;\n left: 50%;\n transform: translateX(-50%) translateY(-50%);\n}")}};r([s({attribute:!1})],k.prototype,"config",void 0),r([s({attribute:!1})],k.prototype,"cameraManager",void 0),r([s({attribute:!1})],k.prototype,"cameraID",void 0),r([s({attribute:!1})],k.prototype,"forceVisibility",void 0),k=r([d("frigate-card-ptz")],k);const M=(t,a)=>{void 0!==a?.fit?t.style.setProperty("--frigate-card-media-layout-fit",a.fit):t.style.removeProperty("--frigate-card-media-layout-fit");for(const n of["x","y"])void 0!==a?.position?.[n]?t.style.setProperty(`--frigate-card-media-layout-position-${n}`,`${a.position[n]}%`):t.style.removeProperty(`--frigate-card-media-layout-position-${n}`);for(const n of["top","bottom","left","right"])void 0!==a?.view_box?.[n]?t.style.setProperty(`--frigate-card-media-layout-view-box-${n}`,`${a.view_box[n]}%`):t.style.removeProperty(`--frigate-card-media-layout-view-box-${n}`)},E=2,H=(t,a)=>{t._controlsHideTimer&&(t._controlsHideTimer.stop(),delete t._controlsHideTimer,delete t._controlsOriginalValue),t.controls=a},O=(t,a=1)=>{const n=t._controlsOriginalValue??t.controls;H(t,!1),t._controlsHideTimer??=new i,t._controlsOriginalValue=n;const o=()=>{H(t,n),t.removeEventListener("loadstart",o)};t.addEventListener("loadstart",o),t._controlsHideTimer.start(a,(()=>{H(t,n)}))},R=async(t,a)=>{if(a?.play)try{await a.play()}catch(n){if("NotAllowedError"===n.name&&!t.isMuted()){await t.mute();try{await a.play()}catch(t){}}}};export{A,x as M,L as a,T as b,E as c,O as h,C as i,R as p,H as s,M as u}; diff --git a/config/www/community/frigate-hass-card/media-1a34ac2c.js.gz b/config/www/community/frigate-hass-card/media-1a34ac2c.js.gz new file mode 100644 index 00000000..1c6fac3e Binary files /dev/null and b/config/www/community/frigate-hass-card/media-1a34ac2c.js.gz differ diff --git a/config/www/community/frigate-hass-card/media-67c578aa.js b/config/www/community/frigate-hass-card/media-67c578aa.js new file mode 100644 index 00000000..e9756ec2 --- /dev/null +++ b/config/www/community/frigate-hass-card/media-67c578aa.js @@ -0,0 +1,33 @@ +import{cL as t,cM as a,dC as n,dD as i,cP as o,dE as e,_ as r,n as s,b as c,t as d,a as l,dF as h,x as p,e as m,dG as u,r as g,dH as _,dI as f,dJ as v,dK as b,dL as y,l as z}from"./card-7cd05290.js"; +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const w={},C=t(class extends a{constructor(){super(...arguments),this.ot=w}render(t,a){return a()}update(t,[a,i]){if(Array.isArray(a)){if(Array.isArray(this.ot)&&this.ot.length===a.length&&a.every(((t,a)=>t===this.ot[a])))return n}else if(this.ot===a)return n;return this.ot=Array.isArray(a)?Array.from(a):a,this.render(a,i)}});class x{constructor(){this._options=null,this._viewportIntersecting=null,this._microphoneMuteTimer=new i,this._root=null,this._eventListeners=new Map,this._children=[],this._target=null,this._mutationObserver=new MutationObserver(this._mutationHandler.bind(this)),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this)),this._mediaLoadedHandler=async t=>{this._target?.index===t&&(await this._unmuteTargetIfConfigured(this._target.selected?"selected":"visible"),await this._playTargetIfConfigured(this._target.selected?"selected":"visible"))},this._visibilityHandler=async()=>{await this._changeVisibility("visible"===document.visibilityState)},this._changeVisibility=async t=>{t?(await this._unmuteTargetIfConfigured("visible"),await this._playTargetIfConfigured("visible")):(await this._pauseAllIfConfigured("hidden"),await this._muteAllIfConfigured("hidden"))},this._microphoneChangeHandler=async t=>{"unmuted"===t?await this._unmuteTargetIfConfigured("microphone"):"muted"===t&&this._options?.autoMuteConditions?.includes("microphone")&&this._microphoneMuteTimer.start(this._options.microphoneMuteSeconds??60,(async()=>{await this._muteTargetIfConfigured("microphone")}))}}setOptions(t){this._options=t,this._options?.microphoneManager&&(this._options.microphoneManager.removeListener(this._microphoneChangeHandler),this._options.microphoneManager.addListener(this._microphoneChangeHandler))}hasRoot(){return!!this._root}destroy(){this._viewportIntersecting=null,this._microphoneMuteTimer.stop(),this._root=null,this._removeChildHandlers(),this._children=[],this._target=null,this._mutationObserver.disconnect(),this._intersectionObserver.disconnect(),this._options?.microphoneManager?.removeListener(this._microphoneChangeHandler),document.removeEventListener("visibilitychange",this._visibilityHandler)}async setTarget(t,a){this._target?.index===t&&this._target?.selected===a||(this._target?.selected&&(await this._pauseTargetIfConfigured("unselected"),await this._muteTargetIfConfigured("unselected"),this._microphoneMuteTimer.stop()),this._target={selected:a,index:t},a?(await this._unmuteTargetIfConfigured("selected"),await this._playTargetIfConfigured("selected")):(await this._unmuteTargetIfConfigured("visible"),await this._playTargetIfConfigured("visible")))}unsetTarget(){this._target=null}async _playTargetIfConfigured(t){null!==this._target&&this._options?.autoPlayConditions?.includes(t)&&await this._play(this._target.index)}async _play(t){await(this._children[t]?.play())}async _unmuteTargetIfConfigured(t){null!==this._target&&this._options?.autoUnmuteConditions?.includes(t)&&await this._unmute(this._target.index)}async _unmute(t){await(this._children[t]?.unmute())}async _pauseAllIfConfigured(t){if(this._options?.autoPauseConditions?.includes(t))for(const t of this._children.keys())await this._pause(t)}async _pauseTargetIfConfigured(t){null!==this._target&&this._options?.autoPauseConditions?.includes(t)&&await this._pause(this._target.index)}async _pause(t){await(this._children[t]?.pause())}async _muteAllIfConfigured(t){if(this._options?.autoMuteConditions?.includes(t))for(const t of this._children.keys())await this._mute(t)}async _muteTargetIfConfigured(t){null!==this._target&&this._options?.autoMuteConditions?.includes(t)&&await this._mute(this._target.index)}async _mute(t){await(this._children[t]?.mute())}_mutationHandler(t,a){this._initializeRoot()}_removeChildHandlers(){for(const[t,a]of this._eventListeners.entries())t.removeEventListener("frigate-card:media:loaded",a);this._eventListeners.clear()}initialize(t){this._root=t,this._initializeRoot(),document.addEventListener("visibilitychange",this._visibilityHandler),this._intersectionObserver.disconnect(),this._intersectionObserver.observe(t),this._mutationObserver.disconnect(),this._mutationObserver.observe(this._root,{childList:!0,subtree:!0})}_initializeRoot(){if(this._options&&this._root){this._removeChildHandlers(),this._children=[...this._root.querySelectorAll(this._options.playerSelector)];for(const[t,a]of this._children.entries()){const n=()=>this._mediaLoadedHandler(t);this._eventListeners.set(a,n),a.addEventListener("frigate-card:media:loaded",n)}}}async _intersectionHandler(t){const a=this._viewportIntersecting;this._viewportIntersecting=t.some((t=>t.isIntersecting)),null!==a&&a!==this._viewportIntersecting&&await this._changeVisibility(this._viewportIntersecting)}}const I={active:!0,breakpoints:{},lazyLoadCount:0};function A(t={}){let a,n,i;const o=new Set,e=["init","select"],r=["select"];function s(){"hidden"===document.visibilityState&&a.lazyUnloadConditions?.includes("hidden")?o.forEach((t=>{a.lazyUnloadCallback&&(a.lazyUnloadCallback(t,i[t]),o.delete(t))})):"visible"===document.visibilityState&&a.lazyLoadCallback&&d()}function c(t){return o.has(t)}function d(){const t=a.lazyLoadCount,e=n.selectedScrollSnap(),r=new Set;for(let a=1;a<=t&&e-a>=0;a++)r.add(e-a);r.add(e);for(let a=1;a<=t&&e+a{!c(t)&&a.lazyLoadCallback&&(o.add(t),a.lazyLoadCallback(t,i[t]))}))}function l(){const t=n.previousScrollSnap();c(t)&&a.lazyUnloadCallback&&(a.lazyUnloadCallback(t,i[t]),o.delete(t))}return{name:"autoLazyLoad",options:t,init:function(o,c){const{mergeOptions:h,optionsAtMedia:p}=c,m=h(I,t);a=p(m),n=o,i=n.slideNodes(),a.lazyLoadCallback&&e.forEach((t=>n.on(t,d))),a.lazyUnloadCallback&&a.lazyUnloadConditions?.includes("unselected")&&r.forEach((t=>n.on(t,l))),document.addEventListener("visibilitychange",s)},destroy:function(){a.lazyLoadCallback&&e.forEach((t=>n.off(t,d))),a.lazyUnloadCallback&&r.forEach((t=>n.off(t,l))),document.removeEventListener("visibilitychange",s)}}}function L(){let t,a=[];const n=[];function i(i){const o=i.composedPath();for(const[e,r]of[...a.entries()].reverse())if(o.includes(r)){n[e]=i.detail,e!==t.selectedScrollSnap()&&i.stopPropagation();break}}function e(i){const o=i.composedPath();for(const[e,r]of a.entries())if(o.includes(r)){delete n[e],e!==t.selectedScrollSnap()&&i.stopPropagation();break}}function r(){const i=t.selectedScrollSnap(),e=n[i];e&&o(a[i],e)}return{name:"autoMediaLoadedInfo",options:{},init:function(n){t=n,a=t.slideNodes();for(const t of a)t.addEventListener("frigate-card:media:loaded",i),t.addEventListener("frigate-card:media:unloaded",e);t.on("init",r),t.containerNode().addEventListener("frigate-card:carousel:force-select",r)},destroy:function(){for(const t of a)t.removeEventListener("frigate-card:media:loaded",i),t.removeEventListener("frigate-card:media:unloaded",e);t.off("init",r),t.containerNode().removeEventListener("frigate-card:carousel:force-select",r)}}}class S{constructor(t){this._scrolling=!1,this._shouldReInitOnScrollStop=!1,this._scrollingStart=()=>{this._scrolling=!0},this._scrollingStop=()=>{this._scrolling=!1,this._shouldReInitOnScrollStop&&(this._shouldReInitOnScrollStop=!1,this._debouncedReInit())},this._debouncedReInit=e((()=>{this._scrolling=!1,this._shouldReInitOnScrollStop=!1,this._emblaApi?.reInit()}),500,{trailing:!0}),this._emblaApi=t,this._emblaApi.on("scroll",this._scrollingStart),this._emblaApi.on("settle",this._scrollingStop),this._emblaApi.on("destroy",this.destroy)}destroy(){this._emblaApi.off("scroll",this._scrollingStart),this._emblaApi.off("settle",this._scrollingStop),this._emblaApi.off("destroy",this.destroy)}reinit(){this._scrolling?this._shouldReInitOnScrollStop=!0:this._debouncedReInit()}}function T(){let t,a=null,n=null;const i=new Map,o=new ResizeObserver((function(t){let a=!1;for(const n of t){const t={height:n.contentRect.height,width:n.contentRect.width},o=i.get(n.target);t.width&&t.height&&(o?.height!==t.height||o?.width!==t.width)&&(i.set(n.target,t),a=!0)}a&&s()})),r=new IntersectionObserver((function(t){const i=t.some((t=>t.isIntersecting));if(i!==n){const t=i&&null!==n;n=i,t&&a?.reinit()}})),s=e((()=>function(){const{slideRegistry:n,options:{axis:i}}=t.internalEngine();if("y"===i)return;t.containerNode().style.removeProperty("max-height");const o=n[t.selectedScrollSnap()],e=t.slideNodes(),r=Math.max(...o.map((t=>e[t].getBoundingClientRect().height)));!isNaN(r)&&r>0&&(t.containerNode().style.maxHeight=`${r}px`);a?.reinit()}()),200,{trailing:!0});return{name:"autoSize",options:{},init:function(n){t=n,a=new S(t),r.observe(t.containerNode()),o.observe(t.containerNode());for(const a of t.slideNodes())o.observe(a);t.containerNode().addEventListener("frigate-card:media:loaded",s),t.on("settle",s)},destroy:function(){r.disconnect(),o.disconnect(),a?.destroy(),t.containerNode().removeEventListener("frigate-card:media:loaded",s),t.off("settle",s)}}}let $=class extends l{constructor(){super(...arguments),this.disabled=!1,this.label="",this._embedThumbnailTask=h(this,(()=>this.hass),(()=>this.thumbnail))}set controlConfig(t){t?.size&&this.style.setProperty("--frigate-card-next-prev-size",`${t.size}px`),this._controlConfig=t}render(){if(this.disabled||!this._controlConfig||"none"==this._controlConfig.style)return p``;const t=!this.thumbnail||["chevrons","icons"].includes(this._controlConfig.style),a={controls:!0,previous:"previous"===this.direction,next:"next"===this.direction,thumbnails:!t,icons:t,button:t};if(t){const t=this.thumbnail&&this.icon&&"chevrons"!==this._controlConfig.style?this.icon:"previous"===this.direction?"mdi:chevron-left":"mdi:chevron-right";return p` + + `}return u(this,this._embedThumbnailTask,(t=>t?p``:p``),{inProgressFunc:()=>p`
`})}static get styles(){return g("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n --frigate-card-next-prev-size: 48px;\n --frigate-card-next-prev-size-hover: calc(var(--frigate-card-next-prev-size) * 2);\n --frigate-card-prev-position: 45px;\n --frigate-card-next-position: 45px;\n --mdc-icon-button-size: var(--frigate-card-next-prev-size);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n}\n\n.controls {\n position: absolute;\n z-index: 1;\n overflow: hidden;\n}\n\n.controls.previous {\n left: var(--frigate-card-prev-position);\n}\n\n.controls.next {\n right: var(--frigate-card-next-position);\n}\n\n.controls.icons {\n top: calc(50% - var(--frigate-card-next-prev-size) / 2);\n}\n\n.controls.thumbnails {\n border-radius: 50%;\n height: var(--frigate-card-next-prev-size);\n top: calc(50% - var(--frigate-card-next-prev-size) / 2);\n box-shadow: var(--frigate-card-css-box-shadow, 0px 0px 20px 5px black);\n transition: all 0.2s ease-out;\n opacity: 0.8;\n aspect-ratio: 1/1;\n}\n\n.controls.thumbnails:hover {\n opacity: 1 !important;\n height: var(--frigate-card-next-prev-size-hover);\n top: calc(50% - var(--frigate-card-next-prev-size-hover) / 2);\n}\n\n.controls.previous.thumbnails:hover {\n left: calc(var(--frigate-card-prev-position) - (var(--frigate-card-next-prev-size-hover) - var(--frigate-card-next-prev-size)) / 2);\n}\n\n.controls.next.thumbnails:hover {\n right: calc(var(--frigate-card-next-position) - (var(--frigate-card-next-prev-size-hover) - var(--frigate-card-next-prev-size)) / 2);\n}")}};r([s({attribute:!1})],$.prototype,"direction",void 0),r([s({attribute:!1})],$.prototype,"hass",void 0),r([c()],$.prototype,"_controlConfig",void 0),r([s({attribute:!1})],$.prototype,"thumbnail",void 0),r([s({attribute:!1})],$.prototype,"icon",void 0),r([s({attribute:!0,type:Boolean})],$.prototype,"disabled",void 0),r([s()],$.prototype,"label",void 0),$=r([d("frigate-card-next-previous-control")],$);class P{constructor(t){this._config=null,this._hass=null,this._cameraManager=null,this._cameraID=null,this._host=t}setConfig(t){this._config=t??null,this._host.setAttribute("data-orientation",t?.orientation??"horizontal"),this._host.setAttribute("data-position",t?.position??"bottom-right"),this._host.setAttribute("style",Object.entries(t?.style??{}).map((([t,a])=>`${t}:${a}`)).join(";"))}getConfig(){return this._config}setCamera(t,a){this._cameraManager=t??null,this._cameraID=a??null}setForceVisibility(t){this._forceVisibility=t}handleAction(t,a){t.stopPropagation();const n=t.detail.action,i=_(n,a);i&&f(this._host,{action:i,...a&&{config:a}})}hasUsefulAction(){const t={pt:!0,z:!0,home:!0};if(!this._cameraID)return t;const a=this._cameraManager?.getCameraCapabilities(this._cameraID);if(!a||!a.hasPTZCapability())return t;const n=a.getPTZCapabilities();return{pt:!!(n?.up||n?.down||n?.left||n?.right),z:!!n?.zoomIn||!!n?.zoomOut,home:!!n?.presets?.length}}shouldDisplay(){return void 0!==this._forceVisibility?this._forceVisibility:"auto"===this._config?.mode?!!this._cameraID&&!!this._cameraManager?.getCameraCapabilities(this._cameraID)?.hasPTZCapability():"on"===this._config?.mode}getPTZActions(){const t=t=>({start_tap_action:v({ptzAction:t?.ptzAction,ptzPhase:"start",ptzPreset:t?.preset}),end_tap_action:v({ptzAction:t?.ptzAction,ptzPhase:"stop",ptzPreset:t?.preset})}),a={};return a.up=t({ptzAction:"up"}),a.down=t({ptzAction:"down"}),a.left=t({ptzAction:"left"}),a.right=t({ptzAction:"right"}),a.zoom_in=t({ptzAction:"zoom_in"}),a.zoom_out=t({ptzAction:"zoom_out"}),a.home={tap_action:v()},a}}let k=class extends l{constructor(){super(...arguments),this._controller=new P(this),this._actions=this._controller.getPTZActions(),this._actionPresence=null}willUpdate(t){t.has("config")&&this._controller.setConfig(this.config),(t.has("cameraManager")||t.has("cameraID"))&&this._controller.setCamera(this.cameraManager,this.cameraID),t.has("forceVisibility")&&this._controller.setForceVisibility(this.forceVisibility),(t.has("cameraID")||t.has("cameraManager"))&&(this._actionPresence=this._controller.hasUsefulAction())}render(){if(!this._controller.shouldDisplay())return;const t=(t,a,n)=>n?p`this._controller.handleAction(t,n)} + >`:p``,a=this._controller.getConfig();return p`
+ ${!a?.hide_pan_tilt&&this._actionPresence?.pt?p`
+ ${t("right","mdi:arrow-right",this._actions.right)} + ${t("left","mdi:arrow-left",this._actions.left)} + ${t("up","mdi:arrow-up",this._actions.up)} + ${t("down","mdi:arrow-down",this._actions.down)} +
`:""} + ${!a?.hide_zoom&&this._actionPresence?.z?p`
+ ${t("zoom_in","mdi:plus",this._actions.zoom_in)} + ${t("zoom_out","mdi:minus",this._actions.zoom_out)} +
`:p``} + ${!a?.hide_home&&this._actionPresence?.home?p`
+ ${t("home","mdi:home",this._actions.home)} +
`:p``} +
`}static get styles(){return g(":host {\n position: absolute;\n width: fit-content;\n height: fit-content;\n --frigate-card-ptz-icon-size: 24px;\n}\n\n:host([data-position$=-left]) {\n left: 5%;\n}\n\n:host([data-position$=-right]) {\n right: 5%;\n}\n\n:host([data-position^=top-]) {\n top: 5%;\n}\n\n:host([data-position^=bottom-]) {\n bottom: 5%;\n}\n\n/*****************\n * Main Containers\n *****************/\n.ptz {\n display: flex;\n gap: 10px;\n color: var(--light-primary-color);\n opacity: 0.4;\n transition: opacity 0.3s ease-in-out;\n}\n\n:host([data-orientation=vertical]) .ptz {\n flex-direction: column;\n}\n\n:host([data-orientation=horizontal]) .ptz {\n flex-direction: row;\n}\n\n.ptz:hover {\n opacity: 1;\n}\n\n:host([data-orientation=vertical]) .ptz div {\n width: calc(var(--frigate-card-ptz-icon-size) * 3);\n}\n\n:host([data-orientation=horizontal]) .ptz div {\n height: calc(var(--frigate-card-ptz-icon-size) * 3);\n}\n\n.ptz-move,\n.ptz-zoom,\n.ptz-home {\n position: relative;\n background-color: rgba(0, 0, 0, 0.3);\n}\n\n.ptz-move {\n height: calc(var(--frigate-card-ptz-icon-size) * 3);\n width: calc(var(--frigate-card-ptz-icon-size) * 3);\n border-radius: 50%;\n}\n\n:host([data-orientation=horizontal]) .ptz .ptz-zoom,\n:host([data-orientation=horizontal]) .ptz .ptz-home {\n width: calc(var(--frigate-card-ptz-icon-size) * 1.5);\n}\n\n:host([data-orientation=vertical]) .ptz .ptz-zoom,\n:host([data-orientation=vertical]) .ptz .ptz-home {\n height: calc(var(--frigate-card-ptz-icon-size) * 1.5);\n}\n\n.ptz-zoom,\n.ptz-home {\n border-radius: var(--ha-card-border-radius, 4px);\n}\n\n/***********\n * PTZ Icons\n ***********/\nha-icon {\n position: absolute;\n --mdc-icon-size: var(--frigate-card-ptz-icon-size);\n}\n\nha-icon:not(.disabled) {\n cursor: pointer;\n}\n\n.disabled {\n color: var(--disabled-text-color);\n}\n\n.up {\n top: 5px;\n left: 50%;\n transform: translateX(-50%);\n}\n\n.down {\n bottom: 5px;\n left: 50%;\n transform: translateX(-50%);\n}\n\n.left {\n left: 5px;\n top: 50%;\n transform: translateY(-50%);\n}\n\n.right {\n right: 5px;\n top: 50%;\n transform: translateY(-50%);\n}\n\n:host([data-orientation=vertical]) .zoom_in {\n right: 5px;\n top: 50%;\n}\n\n:host([data-orientation=vertical]) .zoom_out {\n left: 5px;\n top: 50%;\n}\n\n:host([data-orientation=horizontal]) .zoom_in {\n left: 50%;\n top: 5px;\n}\n\n:host([data-orientation=horizontal]) .zoom_out {\n left: 50%;\n bottom: 5px;\n}\n\n:host([data-orientation=vertical]) .zoom_in,\n:host([data-orientation=vertical]) .zoom_out {\n transform: translateY(-50%);\n}\n\n:host([data-orientation=horizontal]) .zoom_in,\n:host([data-orientation=horizontal]) .zoom_out {\n transform: translateX(-50%);\n}\n\n.home {\n top: 50%;\n left: 50%;\n transform: translateX(-50%) translateY(-50%);\n}")}};r([s({attribute:!1})],k.prototype,"config",void 0),r([s({attribute:!1})],k.prototype,"cameraManager",void 0),r([s({attribute:!1})],k.prototype,"cameraID",void 0),r([s({attribute:!1})],k.prototype,"forceVisibility",void 0),k=r([d("frigate-card-ptz")],k);const M=(t,a)=>{void 0!==a?.fit?t.style.setProperty("--frigate-card-media-layout-fit",a.fit):t.style.removeProperty("--frigate-card-media-layout-fit");for(const n of["x","y"])void 0!==a?.position?.[n]?t.style.setProperty(`--frigate-card-media-layout-position-${n}`,`${a.position[n]}%`):t.style.removeProperty(`--frigate-card-media-layout-position-${n}`);for(const n of["top","bottom","left","right"])void 0!==a?.view_box?.[n]?t.style.setProperty(`--frigate-card-media-layout-view-box-${n}`,`${a.view_box[n]}%`):t.style.removeProperty(`--frigate-card-media-layout-view-box-${n}`)},E=2,H=(t,a)=>{t._controlsHideTimer&&(t._controlsHideTimer.stop(),delete t._controlsHideTimer,delete t._controlsOriginalValue),t.controls=a},O=(t,a=1)=>{const n=t._controlsOriginalValue??t.controls;H(t,!1),t._controlsHideTimer??=new i,t._controlsOriginalValue=n;const o=()=>{H(t,n),t.removeEventListener("loadstart",o)};t.addEventListener("loadstart",o),t._controlsHideTimer.start(a,(()=>{H(t,n)}))},R=async(t,a)=>{if(a?.play)try{await a.play()}catch(n){if("NotAllowedError"===n.name&&!t.isMuted()){await t.mute();try{await a.play()}catch(t){}}}};export{A,x as M,L as a,T as b,E as c,O as h,C as i,R as p,H as s,M as u}; diff --git a/config/www/community/frigate-hass-card/media-67c578aa.js.gz b/config/www/community/frigate-hass-card/media-67c578aa.js.gz new file mode 100644 index 00000000..12fe00b9 Binary files /dev/null and b/config/www/community/frigate-hass-card/media-67c578aa.js.gz differ diff --git a/config/www/community/frigate-hass-card/media-6eadcd60.js b/config/www/community/frigate-hass-card/media-6eadcd60.js new file mode 100644 index 00000000..0dce9440 --- /dev/null +++ b/config/www/community/frigate-hass-card/media-6eadcd60.js @@ -0,0 +1,33 @@ +import{cL as t,cM as a,dC as n,dD as i,cP as o,dE as e,_ as r,n as s,b as c,t as d,a as l,dF as h,x as p,e as m,dG as u,r as g,dH as _,dI as f,dJ as v,dK as b,dL as y,l as z}from"./card-c642ee74.js"; +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const w={},C=t(class extends a{constructor(){super(...arguments),this.ot=w}render(t,a){return a()}update(t,[a,i]){if(Array.isArray(a)){if(Array.isArray(this.ot)&&this.ot.length===a.length&&a.every(((t,a)=>t===this.ot[a])))return n}else if(this.ot===a)return n;return this.ot=Array.isArray(a)?Array.from(a):a,this.render(a,i)}});class x{constructor(){this._options=null,this._viewportIntersecting=null,this._microphoneMuteTimer=new i,this._root=null,this._eventListeners=new Map,this._children=[],this._target=null,this._mutationObserver=new MutationObserver(this._mutationHandler.bind(this)),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this)),this._mediaLoadedHandler=async t=>{this._target?.index===t&&(await this._unmuteTargetIfConfigured(this._target.selected?"selected":"visible"),await this._playTargetIfConfigured(this._target.selected?"selected":"visible"))},this._visibilityHandler=async()=>{await this._changeVisibility("visible"===document.visibilityState)},this._changeVisibility=async t=>{t?(await this._unmuteTargetIfConfigured("visible"),await this._playTargetIfConfigured("visible")):(await this._pauseAllIfConfigured("hidden"),await this._muteAllIfConfigured("hidden"))},this._microphoneChangeHandler=async t=>{"unmuted"===t?await this._unmuteTargetIfConfigured("microphone"):"muted"===t&&this._options?.autoMuteConditions?.includes("microphone")&&this._microphoneMuteTimer.start(this._options.microphoneMuteSeconds??60,(async()=>{await this._muteTargetIfConfigured("microphone")}))}}setOptions(t){this._options=t,this._options?.microphoneManager&&(this._options.microphoneManager.removeListener(this._microphoneChangeHandler),this._options.microphoneManager.addListener(this._microphoneChangeHandler))}hasRoot(){return!!this._root}destroy(){this._viewportIntersecting=null,this._microphoneMuteTimer.stop(),this._root=null,this._removeChildHandlers(),this._children=[],this._target=null,this._mutationObserver.disconnect(),this._intersectionObserver.disconnect(),this._options?.microphoneManager?.removeListener(this._microphoneChangeHandler),document.removeEventListener("visibilitychange",this._visibilityHandler)}async setTarget(t,a){this._target?.index===t&&this._target?.selected===a||(this._target?.selected&&(await this._pauseTargetIfConfigured("unselected"),await this._muteTargetIfConfigured("unselected"),this._microphoneMuteTimer.stop()),this._target={selected:a,index:t},a?(await this._unmuteTargetIfConfigured("selected"),await this._playTargetIfConfigured("selected")):(await this._unmuteTargetIfConfigured("visible"),await this._playTargetIfConfigured("visible")))}unsetTarget(){this._target=null}async _playTargetIfConfigured(t){null!==this._target&&this._options?.autoPlayConditions?.includes(t)&&await this._play(this._target.index)}async _play(t){await(this._children[t]?.play())}async _unmuteTargetIfConfigured(t){null!==this._target&&this._options?.autoUnmuteConditions?.includes(t)&&await this._unmute(this._target.index)}async _unmute(t){await(this._children[t]?.unmute())}async _pauseAllIfConfigured(t){if(this._options?.autoPauseConditions?.includes(t))for(const t of this._children.keys())await this._pause(t)}async _pauseTargetIfConfigured(t){null!==this._target&&this._options?.autoPauseConditions?.includes(t)&&await this._pause(this._target.index)}async _pause(t){await(this._children[t]?.pause())}async _muteAllIfConfigured(t){if(this._options?.autoMuteConditions?.includes(t))for(const t of this._children.keys())await this._mute(t)}async _muteTargetIfConfigured(t){null!==this._target&&this._options?.autoMuteConditions?.includes(t)&&await this._mute(this._target.index)}async _mute(t){await(this._children[t]?.mute())}_mutationHandler(t,a){this._initializeRoot()}_removeChildHandlers(){for(const[t,a]of this._eventListeners.entries())t.removeEventListener("frigate-card:media:loaded",a);this._eventListeners.clear()}initialize(t){this._root=t,this._initializeRoot(),document.addEventListener("visibilitychange",this._visibilityHandler),this._intersectionObserver.disconnect(),this._intersectionObserver.observe(t),this._mutationObserver.disconnect(),this._mutationObserver.observe(this._root,{childList:!0,subtree:!0})}_initializeRoot(){if(this._options&&this._root){this._removeChildHandlers(),this._children=[...this._root.querySelectorAll(this._options.playerSelector)];for(const[t,a]of this._children.entries()){const n=()=>this._mediaLoadedHandler(t);this._eventListeners.set(a,n),a.addEventListener("frigate-card:media:loaded",n)}}}async _intersectionHandler(t){const a=this._viewportIntersecting;this._viewportIntersecting=t.some((t=>t.isIntersecting)),null!==a&&a!==this._viewportIntersecting&&await this._changeVisibility(this._viewportIntersecting)}}const I={active:!0,breakpoints:{},lazyLoadCount:0};function A(t={}){let a,n,i;const o=new Set,e=["init","select"],r=["select"];function s(){"hidden"===document.visibilityState&&a.lazyUnloadConditions?.includes("hidden")?o.forEach((t=>{a.lazyUnloadCallback&&(a.lazyUnloadCallback(t,i[t]),o.delete(t))})):"visible"===document.visibilityState&&a.lazyLoadCallback&&d()}function c(t){return o.has(t)}function d(){const t=a.lazyLoadCount,e=n.selectedScrollSnap(),r=new Set;for(let a=1;a<=t&&e-a>=0;a++)r.add(e-a);r.add(e);for(let a=1;a<=t&&e+a{!c(t)&&a.lazyLoadCallback&&(o.add(t),a.lazyLoadCallback(t,i[t]))}))}function l(){const t=n.previousScrollSnap();c(t)&&a.lazyUnloadCallback&&(a.lazyUnloadCallback(t,i[t]),o.delete(t))}return{name:"autoLazyLoad",options:t,init:function(o,c){const{mergeOptions:h,optionsAtMedia:p}=c,m=h(I,t);a=p(m),n=o,i=n.slideNodes(),a.lazyLoadCallback&&e.forEach((t=>n.on(t,d))),a.lazyUnloadCallback&&a.lazyUnloadConditions?.includes("unselected")&&r.forEach((t=>n.on(t,l))),document.addEventListener("visibilitychange",s)},destroy:function(){a.lazyLoadCallback&&e.forEach((t=>n.off(t,d))),a.lazyUnloadCallback&&r.forEach((t=>n.off(t,l))),document.removeEventListener("visibilitychange",s)}}}function L(){let t,a=[];const n=[];function i(i){const o=i.composedPath();for(const[e,r]of[...a.entries()].reverse())if(o.includes(r)){n[e]=i.detail,e!==t.selectedScrollSnap()&&i.stopPropagation();break}}function e(i){const o=i.composedPath();for(const[e,r]of a.entries())if(o.includes(r)){delete n[e],e!==t.selectedScrollSnap()&&i.stopPropagation();break}}function r(){const i=t.selectedScrollSnap(),e=n[i];e&&o(a[i],e)}return{name:"autoMediaLoadedInfo",options:{},init:function(n){t=n,a=t.slideNodes();for(const t of a)t.addEventListener("frigate-card:media:loaded",i),t.addEventListener("frigate-card:media:unloaded",e);t.on("init",r),t.containerNode().addEventListener("frigate-card:carousel:force-select",r)},destroy:function(){for(const t of a)t.removeEventListener("frigate-card:media:loaded",i),t.removeEventListener("frigate-card:media:unloaded",e);t.off("init",r),t.containerNode().removeEventListener("frigate-card:carousel:force-select",r)}}}class S{constructor(t){this._scrolling=!1,this._shouldReInitOnScrollStop=!1,this._scrollingStart=()=>{this._scrolling=!0},this._scrollingStop=()=>{this._scrolling=!1,this._shouldReInitOnScrollStop&&(this._shouldReInitOnScrollStop=!1,this._debouncedReInit())},this._debouncedReInit=e((()=>{this._scrolling=!1,this._shouldReInitOnScrollStop=!1,this._emblaApi?.reInit()}),500,{trailing:!0}),this._emblaApi=t,this._emblaApi.on("scroll",this._scrollingStart),this._emblaApi.on("settle",this._scrollingStop),this._emblaApi.on("destroy",this.destroy)}destroy(){this._emblaApi.off("scroll",this._scrollingStart),this._emblaApi.off("settle",this._scrollingStop),this._emblaApi.off("destroy",this.destroy)}reinit(){this._scrolling?this._shouldReInitOnScrollStop=!0:this._debouncedReInit()}}function T(){let t,a=null,n=null;const i=new Map,o=new ResizeObserver((function(t){let a=!1;for(const n of t){const t={height:n.contentRect.height,width:n.contentRect.width},o=i.get(n.target);t.width&&t.height&&(o?.height!==t.height||o?.width!==t.width)&&(i.set(n.target,t),a=!0)}a&&s()})),r=new IntersectionObserver((function(t){const i=t.some((t=>t.isIntersecting));if(i!==n){const t=i&&null!==n;n=i,t&&a?.reinit()}})),s=e((()=>function(){const{slideRegistry:n,options:{axis:i}}=t.internalEngine();if("y"===i)return;t.containerNode().style.removeProperty("max-height");const o=n[t.selectedScrollSnap()],e=t.slideNodes(),r=Math.max(...o.map((t=>e[t].getBoundingClientRect().height)));!isNaN(r)&&r>0&&(t.containerNode().style.maxHeight=`${r}px`);a?.reinit()}()),200,{trailing:!0});return{name:"autoSize",options:{},init:function(n){t=n,a=new S(t),r.observe(t.containerNode()),o.observe(t.containerNode());for(const a of t.slideNodes())o.observe(a);t.containerNode().addEventListener("frigate-card:media:loaded",s),t.on("settle",s)},destroy:function(){r.disconnect(),o.disconnect(),a?.destroy(),t.containerNode().removeEventListener("frigate-card:media:loaded",s),t.off("settle",s)}}}let $=class extends l{constructor(){super(...arguments),this.disabled=!1,this.label="",this._embedThumbnailTask=h(this,(()=>this.hass),(()=>this.thumbnail))}set controlConfig(t){t?.size&&this.style.setProperty("--frigate-card-next-prev-size",`${t.size}px`),this._controlConfig=t}render(){if(this.disabled||!this._controlConfig||"none"==this._controlConfig.style)return p``;const t=!this.thumbnail||["chevrons","icons"].includes(this._controlConfig.style),a={controls:!0,previous:"previous"===this.direction,next:"next"===this.direction,thumbnails:!t,icons:t,button:t};if(t){const t=this.thumbnail&&this.icon&&"chevrons"!==this._controlConfig.style?this.icon:"previous"===this.direction?"mdi:chevron-left":"mdi:chevron-right";return p` + + `}return u(this,this._embedThumbnailTask,(t=>t?p``:p``),{inProgressFunc:()=>p`
`})}static get styles(){return g("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n --frigate-card-next-prev-size: 48px;\n --frigate-card-next-prev-size-hover: calc(var(--frigate-card-next-prev-size) * 2);\n --frigate-card-prev-position: 45px;\n --frigate-card-next-position: 45px;\n --mdc-icon-button-size: var(--frigate-card-next-prev-size);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n}\n\n.controls {\n position: absolute;\n z-index: 1;\n overflow: hidden;\n}\n\n.controls.previous {\n left: var(--frigate-card-prev-position);\n}\n\n.controls.next {\n right: var(--frigate-card-next-position);\n}\n\n.controls.icons {\n top: calc(50% - var(--frigate-card-next-prev-size) / 2);\n}\n\n.controls.thumbnails {\n border-radius: 50%;\n height: var(--frigate-card-next-prev-size);\n top: calc(50% - var(--frigate-card-next-prev-size) / 2);\n box-shadow: var(--frigate-card-css-box-shadow, 0px 0px 20px 5px black);\n transition: all 0.2s ease-out;\n opacity: 0.8;\n aspect-ratio: 1/1;\n}\n\n.controls.thumbnails:hover {\n opacity: 1 !important;\n height: var(--frigate-card-next-prev-size-hover);\n top: calc(50% - var(--frigate-card-next-prev-size-hover) / 2);\n}\n\n.controls.previous.thumbnails:hover {\n left: calc(var(--frigate-card-prev-position) - (var(--frigate-card-next-prev-size-hover) - var(--frigate-card-next-prev-size)) / 2);\n}\n\n.controls.next.thumbnails:hover {\n right: calc(var(--frigate-card-next-position) - (var(--frigate-card-next-prev-size-hover) - var(--frigate-card-next-prev-size)) / 2);\n}")}};r([s({attribute:!1})],$.prototype,"direction",void 0),r([s({attribute:!1})],$.prototype,"hass",void 0),r([c()],$.prototype,"_controlConfig",void 0),r([s({attribute:!1})],$.prototype,"thumbnail",void 0),r([s({attribute:!1})],$.prototype,"icon",void 0),r([s({attribute:!0,type:Boolean})],$.prototype,"disabled",void 0),r([s()],$.prototype,"label",void 0),$=r([d("frigate-card-next-previous-control")],$);class P{constructor(t){this._config=null,this._hass=null,this._cameraManager=null,this._cameraID=null,this._host=t}setConfig(t){this._config=t??null,this._host.setAttribute("data-orientation",t?.orientation??"horizontal"),this._host.setAttribute("data-position",t?.position??"bottom-right"),this._host.setAttribute("style",Object.entries(t?.style??{}).map((([t,a])=>`${t}:${a}`)).join(";"))}getConfig(){return this._config}setCamera(t,a){this._cameraManager=t??null,this._cameraID=a??null}setForceVisibility(t){this._forceVisibility=t}handleAction(t,a){t.stopPropagation();const n=t.detail.action,i=_(n,a);i&&f(this._host,{action:i,...a&&{config:a}})}hasUsefulAction(){const t={pt:!0,z:!0,home:!0};if(!this._cameraID)return t;const a=this._cameraManager?.getCameraCapabilities(this._cameraID);if(!a||!a.hasPTZCapability())return t;const n=a.getPTZCapabilities();return{pt:!!(n?.up||n?.down||n?.left||n?.right),z:!!n?.zoomIn||!!n?.zoomOut,home:!!n?.presets?.length}}shouldDisplay(){return void 0!==this._forceVisibility?this._forceVisibility:"auto"===this._config?.mode?!!this._cameraID&&!!this._cameraManager?.getCameraCapabilities(this._cameraID)?.hasPTZCapability():"on"===this._config?.mode}getPTZActions(){const t=t=>({start_tap_action:v({ptzAction:t?.ptzAction,ptzPhase:"start",ptzPreset:t?.preset}),end_tap_action:v({ptzAction:t?.ptzAction,ptzPhase:"stop",ptzPreset:t?.preset})}),a={};return a.up=t({ptzAction:"up"}),a.down=t({ptzAction:"down"}),a.left=t({ptzAction:"left"}),a.right=t({ptzAction:"right"}),a.zoom_in=t({ptzAction:"zoom_in"}),a.zoom_out=t({ptzAction:"zoom_out"}),a.home={tap_action:v()},a}}let k=class extends l{constructor(){super(...arguments),this._controller=new P(this),this._actions=this._controller.getPTZActions(),this._actionPresence=null}willUpdate(t){t.has("config")&&this._controller.setConfig(this.config),(t.has("cameraManager")||t.has("cameraID"))&&this._controller.setCamera(this.cameraManager,this.cameraID),t.has("forceVisibility")&&this._controller.setForceVisibility(this.forceVisibility),(t.has("cameraID")||t.has("cameraManager"))&&(this._actionPresence=this._controller.hasUsefulAction())}render(){if(!this._controller.shouldDisplay())return;const t=(t,a,n)=>n?p`this._controller.handleAction(t,n)} + >`:p``,a=this._controller.getConfig();return p`
+ ${!a?.hide_pan_tilt&&this._actionPresence?.pt?p`
+ ${t("right","mdi:arrow-right",this._actions.right)} + ${t("left","mdi:arrow-left",this._actions.left)} + ${t("up","mdi:arrow-up",this._actions.up)} + ${t("down","mdi:arrow-down",this._actions.down)} +
`:""} + ${!a?.hide_zoom&&this._actionPresence?.z?p`
+ ${t("zoom_in","mdi:plus",this._actions.zoom_in)} + ${t("zoom_out","mdi:minus",this._actions.zoom_out)} +
`:p``} + ${!a?.hide_home&&this._actionPresence?.home?p`
+ ${t("home","mdi:home",this._actions.home)} +
`:p``} +
`}static get styles(){return g(":host {\n position: absolute;\n width: fit-content;\n height: fit-content;\n --frigate-card-ptz-icon-size: 24px;\n}\n\n:host([data-position$=-left]) {\n left: 5%;\n}\n\n:host([data-position$=-right]) {\n right: 5%;\n}\n\n:host([data-position^=top-]) {\n top: 5%;\n}\n\n:host([data-position^=bottom-]) {\n bottom: 5%;\n}\n\n/*****************\n * Main Containers\n *****************/\n.ptz {\n display: flex;\n gap: 10px;\n color: var(--light-primary-color);\n opacity: 0.4;\n transition: opacity 0.3s ease-in-out;\n}\n\n:host([data-orientation=vertical]) .ptz {\n flex-direction: column;\n}\n\n:host([data-orientation=horizontal]) .ptz {\n flex-direction: row;\n}\n\n.ptz:hover {\n opacity: 1;\n}\n\n:host([data-orientation=vertical]) .ptz div {\n width: calc(var(--frigate-card-ptz-icon-size) * 3);\n}\n\n:host([data-orientation=horizontal]) .ptz div {\n height: calc(var(--frigate-card-ptz-icon-size) * 3);\n}\n\n.ptz-move,\n.ptz-zoom,\n.ptz-home {\n position: relative;\n background-color: rgba(0, 0, 0, 0.3);\n}\n\n.ptz-move {\n height: calc(var(--frigate-card-ptz-icon-size) * 3);\n width: calc(var(--frigate-card-ptz-icon-size) * 3);\n border-radius: 50%;\n}\n\n:host([data-orientation=horizontal]) .ptz .ptz-zoom,\n:host([data-orientation=horizontal]) .ptz .ptz-home {\n width: calc(var(--frigate-card-ptz-icon-size) * 1.5);\n}\n\n:host([data-orientation=vertical]) .ptz .ptz-zoom,\n:host([data-orientation=vertical]) .ptz .ptz-home {\n height: calc(var(--frigate-card-ptz-icon-size) * 1.5);\n}\n\n.ptz-zoom,\n.ptz-home {\n border-radius: var(--ha-card-border-radius, 4px);\n}\n\n/***********\n * PTZ Icons\n ***********/\nha-icon {\n position: absolute;\n --mdc-icon-size: var(--frigate-card-ptz-icon-size);\n}\n\nha-icon:not(.disabled) {\n cursor: pointer;\n}\n\n.disabled {\n color: var(--disabled-text-color);\n}\n\n.up {\n top: 5px;\n left: 50%;\n transform: translateX(-50%);\n}\n\n.down {\n bottom: 5px;\n left: 50%;\n transform: translateX(-50%);\n}\n\n.left {\n left: 5px;\n top: 50%;\n transform: translateY(-50%);\n}\n\n.right {\n right: 5px;\n top: 50%;\n transform: translateY(-50%);\n}\n\n:host([data-orientation=vertical]) .zoom_in {\n right: 5px;\n top: 50%;\n}\n\n:host([data-orientation=vertical]) .zoom_out {\n left: 5px;\n top: 50%;\n}\n\n:host([data-orientation=horizontal]) .zoom_in {\n left: 50%;\n top: 5px;\n}\n\n:host([data-orientation=horizontal]) .zoom_out {\n left: 50%;\n bottom: 5px;\n}\n\n:host([data-orientation=vertical]) .zoom_in,\n:host([data-orientation=vertical]) .zoom_out {\n transform: translateY(-50%);\n}\n\n:host([data-orientation=horizontal]) .zoom_in,\n:host([data-orientation=horizontal]) .zoom_out {\n transform: translateX(-50%);\n}\n\n.home {\n top: 50%;\n left: 50%;\n transform: translateX(-50%) translateY(-50%);\n}")}};r([s({attribute:!1})],k.prototype,"config",void 0),r([s({attribute:!1})],k.prototype,"cameraManager",void 0),r([s({attribute:!1})],k.prototype,"cameraID",void 0),r([s({attribute:!1})],k.prototype,"forceVisibility",void 0),k=r([d("frigate-card-ptz")],k);const M=(t,a)=>{void 0!==a?.fit?t.style.setProperty("--frigate-card-media-layout-fit",a.fit):t.style.removeProperty("--frigate-card-media-layout-fit");for(const n of["x","y"])void 0!==a?.position?.[n]?t.style.setProperty(`--frigate-card-media-layout-position-${n}`,`${a.position[n]}%`):t.style.removeProperty(`--frigate-card-media-layout-position-${n}`);for(const n of["top","bottom","left","right"])void 0!==a?.view_box?.[n]?t.style.setProperty(`--frigate-card-media-layout-view-box-${n}`,`${a.view_box[n]}%`):t.style.removeProperty(`--frigate-card-media-layout-view-box-${n}`)},E=2,H=(t,a)=>{t._controlsHideTimer&&(t._controlsHideTimer.stop(),delete t._controlsHideTimer,delete t._controlsOriginalValue),t.controls=a},O=(t,a=1)=>{const n=t._controlsOriginalValue??t.controls;H(t,!1),t._controlsHideTimer??=new i,t._controlsOriginalValue=n;const o=()=>{H(t,n),t.removeEventListener("loadstart",o)};t.addEventListener("loadstart",o),t._controlsHideTimer.start(a,(()=>{H(t,n)}))},R=async(t,a)=>{if(a?.play)try{await a.play()}catch(n){if("NotAllowedError"===n.name&&!t.isMuted()){await t.mute();try{await a.play()}catch(t){}}}};export{A,x as M,L as a,T as b,E as c,O as h,C as i,R as p,H as s,M as u}; diff --git a/config/www/community/frigate-hass-card/media-6eadcd60.js.gz b/config/www/community/frigate-hass-card/media-6eadcd60.js.gz new file mode 100644 index 00000000..7c57f011 Binary files /dev/null and b/config/www/community/frigate-hass-card/media-6eadcd60.js.gz differ diff --git a/config/www/community/frigate-hass-card/media-aef44451.js b/config/www/community/frigate-hass-card/media-aef44451.js new file mode 100644 index 00000000..5fdf39b1 --- /dev/null +++ b/config/www/community/frigate-hass-card/media-aef44451.js @@ -0,0 +1,33 @@ +import{cL as t,cM as a,dC as n,dD as i,cP as o,dE as e,_ as r,n as s,b as c,t as d,a as l,dF as h,x as p,e as m,dG as u,r as g,dH as _,dI as f,dJ as v,dK as b,dL as y,l as z}from"./card-09c4bade.js"; +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const w={},C=t(class extends a{constructor(){super(...arguments),this.ot=w}render(t,a){return a()}update(t,[a,i]){if(Array.isArray(a)){if(Array.isArray(this.ot)&&this.ot.length===a.length&&a.every(((t,a)=>t===this.ot[a])))return n}else if(this.ot===a)return n;return this.ot=Array.isArray(a)?Array.from(a):a,this.render(a,i)}});class x{constructor(){this._options=null,this._viewportIntersecting=null,this._microphoneMuteTimer=new i,this._root=null,this._eventListeners=new Map,this._children=[],this._target=null,this._mutationObserver=new MutationObserver(this._mutationHandler.bind(this)),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this)),this._mediaLoadedHandler=async t=>{this._target?.index===t&&(await this._unmuteTargetIfConfigured(this._target.selected?"selected":"visible"),await this._playTargetIfConfigured(this._target.selected?"selected":"visible"))},this._visibilityHandler=async()=>{await this._changeVisibility("visible"===document.visibilityState)},this._changeVisibility=async t=>{t?(await this._unmuteTargetIfConfigured("visible"),await this._playTargetIfConfigured("visible")):(await this._pauseAllIfConfigured("hidden"),await this._muteAllIfConfigured("hidden"))},this._microphoneChangeHandler=async t=>{"unmuted"===t?await this._unmuteTargetIfConfigured("microphone"):"muted"===t&&this._options?.autoMuteConditions?.includes("microphone")&&this._microphoneMuteTimer.start(this._options.microphoneMuteSeconds??60,(async()=>{await this._muteTargetIfConfigured("microphone")}))}}setOptions(t){this._options=t,this._options?.microphoneManager&&(this._options.microphoneManager.removeListener(this._microphoneChangeHandler),this._options.microphoneManager.addListener(this._microphoneChangeHandler))}hasRoot(){return!!this._root}destroy(){this._viewportIntersecting=null,this._microphoneMuteTimer.stop(),this._root=null,this._removeChildHandlers(),this._children=[],this._target=null,this._mutationObserver.disconnect(),this._intersectionObserver.disconnect(),this._options?.microphoneManager?.removeListener(this._microphoneChangeHandler),document.removeEventListener("visibilitychange",this._visibilityHandler)}async setTarget(t,a){this._target?.index===t&&this._target?.selected===a||(this._target?.selected&&(await this._pauseTargetIfConfigured("unselected"),await this._muteTargetIfConfigured("unselected"),this._microphoneMuteTimer.stop()),this._target={selected:a,index:t},a?(await this._unmuteTargetIfConfigured("selected"),await this._playTargetIfConfigured("selected")):(await this._unmuteTargetIfConfigured("visible"),await this._playTargetIfConfigured("visible")))}unsetTarget(){this._target=null}async _playTargetIfConfigured(t){null!==this._target&&this._options?.autoPlayConditions?.includes(t)&&await this._play(this._target.index)}async _play(t){await(this._children[t]?.play())}async _unmuteTargetIfConfigured(t){null!==this._target&&this._options?.autoUnmuteConditions?.includes(t)&&await this._unmute(this._target.index)}async _unmute(t){await(this._children[t]?.unmute())}async _pauseAllIfConfigured(t){if(this._options?.autoPauseConditions?.includes(t))for(const t of this._children.keys())await this._pause(t)}async _pauseTargetIfConfigured(t){null!==this._target&&this._options?.autoPauseConditions?.includes(t)&&await this._pause(this._target.index)}async _pause(t){await(this._children[t]?.pause())}async _muteAllIfConfigured(t){if(this._options?.autoMuteConditions?.includes(t))for(const t of this._children.keys())await this._mute(t)}async _muteTargetIfConfigured(t){null!==this._target&&this._options?.autoMuteConditions?.includes(t)&&await this._mute(this._target.index)}async _mute(t){await(this._children[t]?.mute())}_mutationHandler(t,a){this._initializeRoot()}_removeChildHandlers(){for(const[t,a]of this._eventListeners.entries())t.removeEventListener("frigate-card:media:loaded",a);this._eventListeners.clear()}initialize(t){this._root=t,this._initializeRoot(),document.addEventListener("visibilitychange",this._visibilityHandler),this._intersectionObserver.disconnect(),this._intersectionObserver.observe(t),this._mutationObserver.disconnect(),this._mutationObserver.observe(this._root,{childList:!0,subtree:!0})}_initializeRoot(){if(this._options&&this._root){this._removeChildHandlers(),this._children=[...this._root.querySelectorAll(this._options.playerSelector)];for(const[t,a]of this._children.entries()){const n=()=>this._mediaLoadedHandler(t);this._eventListeners.set(a,n),a.addEventListener("frigate-card:media:loaded",n)}}}async _intersectionHandler(t){const a=this._viewportIntersecting;this._viewportIntersecting=t.some((t=>t.isIntersecting)),null!==a&&a!==this._viewportIntersecting&&await this._changeVisibility(this._viewportIntersecting)}}const I={active:!0,breakpoints:{},lazyLoadCount:0};function A(t={}){let a,n,i;const o=new Set,e=["init","select"],r=["select"];function s(){"hidden"===document.visibilityState&&a.lazyUnloadConditions?.includes("hidden")?o.forEach((t=>{a.lazyUnloadCallback&&(a.lazyUnloadCallback(t,i[t]),o.delete(t))})):"visible"===document.visibilityState&&a.lazyLoadCallback&&d()}function c(t){return o.has(t)}function d(){const t=a.lazyLoadCount,e=n.selectedScrollSnap(),r=new Set;for(let a=1;a<=t&&e-a>=0;a++)r.add(e-a);r.add(e);for(let a=1;a<=t&&e+a{!c(t)&&a.lazyLoadCallback&&(o.add(t),a.lazyLoadCallback(t,i[t]))}))}function l(){const t=n.previousScrollSnap();c(t)&&a.lazyUnloadCallback&&(a.lazyUnloadCallback(t,i[t]),o.delete(t))}return{name:"autoLazyLoad",options:t,init:function(o,c){const{mergeOptions:h,optionsAtMedia:p}=c,m=h(I,t);a=p(m),n=o,i=n.slideNodes(),a.lazyLoadCallback&&e.forEach((t=>n.on(t,d))),a.lazyUnloadCallback&&a.lazyUnloadConditions?.includes("unselected")&&r.forEach((t=>n.on(t,l))),document.addEventListener("visibilitychange",s)},destroy:function(){a.lazyLoadCallback&&e.forEach((t=>n.off(t,d))),a.lazyUnloadCallback&&r.forEach((t=>n.off(t,l))),document.removeEventListener("visibilitychange",s)}}}function L(){let t,a=[];const n=[];function i(i){const o=i.composedPath();for(const[e,r]of[...a.entries()].reverse())if(o.includes(r)){n[e]=i.detail,e!==t.selectedScrollSnap()&&i.stopPropagation();break}}function e(i){const o=i.composedPath();for(const[e,r]of a.entries())if(o.includes(r)){delete n[e],e!==t.selectedScrollSnap()&&i.stopPropagation();break}}function r(){const i=t.selectedScrollSnap(),e=n[i];e&&o(a[i],e)}return{name:"autoMediaLoadedInfo",options:{},init:function(n){t=n,a=t.slideNodes();for(const t of a)t.addEventListener("frigate-card:media:loaded",i),t.addEventListener("frigate-card:media:unloaded",e);t.on("init",r),t.containerNode().addEventListener("frigate-card:carousel:force-select",r)},destroy:function(){for(const t of a)t.removeEventListener("frigate-card:media:loaded",i),t.removeEventListener("frigate-card:media:unloaded",e);t.off("init",r),t.containerNode().removeEventListener("frigate-card:carousel:force-select",r)}}}class S{constructor(t){this._scrolling=!1,this._shouldReInitOnScrollStop=!1,this._scrollingStart=()=>{this._scrolling=!0},this._scrollingStop=()=>{this._scrolling=!1,this._shouldReInitOnScrollStop&&(this._shouldReInitOnScrollStop=!1,this._debouncedReInit())},this._debouncedReInit=e((()=>{this._scrolling=!1,this._shouldReInitOnScrollStop=!1,this._emblaApi?.reInit()}),500,{trailing:!0}),this._emblaApi=t,this._emblaApi.on("scroll",this._scrollingStart),this._emblaApi.on("settle",this._scrollingStop),this._emblaApi.on("destroy",this.destroy)}destroy(){this._emblaApi.off("scroll",this._scrollingStart),this._emblaApi.off("settle",this._scrollingStop),this._emblaApi.off("destroy",this.destroy)}reinit(){this._scrolling?this._shouldReInitOnScrollStop=!0:this._debouncedReInit()}}function T(){let t,a=null,n=null;const i=new Map,o=new ResizeObserver((function(t){let a=!1;for(const n of t){const t={height:n.contentRect.height,width:n.contentRect.width},o=i.get(n.target);t.width&&t.height&&(o?.height!==t.height||o?.width!==t.width)&&(i.set(n.target,t),a=!0)}a&&s()})),r=new IntersectionObserver((function(t){const i=t.some((t=>t.isIntersecting));if(i!==n){const t=i&&null!==n;n=i,t&&a?.reinit()}})),s=e((()=>function(){const{slideRegistry:n,options:{axis:i}}=t.internalEngine();if("y"===i)return;t.containerNode().style.removeProperty("max-height");const o=n[t.selectedScrollSnap()],e=t.slideNodes(),r=Math.max(...o.map((t=>e[t].getBoundingClientRect().height)));!isNaN(r)&&r>0&&(t.containerNode().style.maxHeight=`${r}px`);a?.reinit()}()),200,{trailing:!0});return{name:"autoSize",options:{},init:function(n){t=n,a=new S(t),r.observe(t.containerNode()),o.observe(t.containerNode());for(const a of t.slideNodes())o.observe(a);t.containerNode().addEventListener("frigate-card:media:loaded",s),t.on("settle",s)},destroy:function(){r.disconnect(),o.disconnect(),a?.destroy(),t.containerNode().removeEventListener("frigate-card:media:loaded",s),t.off("settle",s)}}}let $=class extends l{constructor(){super(...arguments),this.disabled=!1,this.label="",this._embedThumbnailTask=h(this,(()=>this.hass),(()=>this.thumbnail))}set controlConfig(t){t?.size&&this.style.setProperty("--frigate-card-next-prev-size",`${t.size}px`),this._controlConfig=t}render(){if(this.disabled||!this._controlConfig||"none"==this._controlConfig.style)return p``;const t=!this.thumbnail||["chevrons","icons"].includes(this._controlConfig.style),a={controls:!0,previous:"previous"===this.direction,next:"next"===this.direction,thumbnails:!t,icons:t,button:t};if(t){const t=this.thumbnail&&this.icon&&"chevrons"!==this._controlConfig.style?this.icon:"previous"===this.direction?"mdi:chevron-left":"mdi:chevron-right";return p` + + `}return u(this,this._embedThumbnailTask,(t=>t?p``:p``),{inProgressFunc:()=>p`
`})}static get styles(){return g("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n --frigate-card-next-prev-size: 48px;\n --frigate-card-next-prev-size-hover: calc(var(--frigate-card-next-prev-size) * 2);\n --frigate-card-prev-position: 45px;\n --frigate-card-next-position: 45px;\n --mdc-icon-button-size: var(--frigate-card-next-prev-size);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n}\n\n.controls {\n position: absolute;\n z-index: 1;\n overflow: hidden;\n}\n\n.controls.previous {\n left: var(--frigate-card-prev-position);\n}\n\n.controls.next {\n right: var(--frigate-card-next-position);\n}\n\n.controls.icons {\n top: calc(50% - var(--frigate-card-next-prev-size) / 2);\n}\n\n.controls.thumbnails {\n border-radius: 50%;\n height: var(--frigate-card-next-prev-size);\n top: calc(50% - var(--frigate-card-next-prev-size) / 2);\n box-shadow: var(--frigate-card-css-box-shadow, 0px 0px 20px 5px black);\n transition: all 0.2s ease-out;\n opacity: 0.8;\n aspect-ratio: 1/1;\n}\n\n.controls.thumbnails:hover {\n opacity: 1 !important;\n height: var(--frigate-card-next-prev-size-hover);\n top: calc(50% - var(--frigate-card-next-prev-size-hover) / 2);\n}\n\n.controls.previous.thumbnails:hover {\n left: calc(var(--frigate-card-prev-position) - (var(--frigate-card-next-prev-size-hover) - var(--frigate-card-next-prev-size)) / 2);\n}\n\n.controls.next.thumbnails:hover {\n right: calc(var(--frigate-card-next-position) - (var(--frigate-card-next-prev-size-hover) - var(--frigate-card-next-prev-size)) / 2);\n}")}};r([s({attribute:!1})],$.prototype,"direction",void 0),r([s({attribute:!1})],$.prototype,"hass",void 0),r([c()],$.prototype,"_controlConfig",void 0),r([s({attribute:!1})],$.prototype,"thumbnail",void 0),r([s({attribute:!1})],$.prototype,"icon",void 0),r([s({attribute:!0,type:Boolean})],$.prototype,"disabled",void 0),r([s()],$.prototype,"label",void 0),$=r([d("frigate-card-next-previous-control")],$);class P{constructor(t){this._config=null,this._hass=null,this._cameraManager=null,this._cameraID=null,this._host=t}setConfig(t){this._config=t??null,this._host.setAttribute("data-orientation",t?.orientation??"horizontal"),this._host.setAttribute("data-position",t?.position??"bottom-right"),this._host.setAttribute("style",Object.entries(t?.style??{}).map((([t,a])=>`${t}:${a}`)).join(";"))}getConfig(){return this._config}setCamera(t,a){this._cameraManager=t??null,this._cameraID=a??null}setForceVisibility(t){this._forceVisibility=t}handleAction(t,a){t.stopPropagation();const n=t.detail.action,i=_(n,a);i&&f(this._host,{action:i,...a&&{config:a}})}hasUsefulAction(){const t={pt:!0,z:!0,home:!0};if(!this._cameraID)return t;const a=this._cameraManager?.getCameraCapabilities(this._cameraID);if(!a||!a.hasPTZCapability())return t;const n=a.getPTZCapabilities();return{pt:!!(n?.up||n?.down||n?.left||n?.right),z:!!n?.zoomIn||!!n?.zoomOut,home:!!n?.presets?.length}}shouldDisplay(){return void 0!==this._forceVisibility?this._forceVisibility:"auto"===this._config?.mode?!!this._cameraID&&!!this._cameraManager?.getCameraCapabilities(this._cameraID)?.hasPTZCapability():"on"===this._config?.mode}getPTZActions(){const t=t=>({start_tap_action:v({ptzAction:t?.ptzAction,ptzPhase:"start",ptzPreset:t?.preset}),end_tap_action:v({ptzAction:t?.ptzAction,ptzPhase:"stop",ptzPreset:t?.preset})}),a={};return a.up=t({ptzAction:"up"}),a.down=t({ptzAction:"down"}),a.left=t({ptzAction:"left"}),a.right=t({ptzAction:"right"}),a.zoom_in=t({ptzAction:"zoom_in"}),a.zoom_out=t({ptzAction:"zoom_out"}),a.home={tap_action:v()},a}}let k=class extends l{constructor(){super(...arguments),this._controller=new P(this),this._actions=this._controller.getPTZActions(),this._actionPresence=null}willUpdate(t){t.has("config")&&this._controller.setConfig(this.config),(t.has("cameraManager")||t.has("cameraID"))&&this._controller.setCamera(this.cameraManager,this.cameraID),t.has("forceVisibility")&&this._controller.setForceVisibility(this.forceVisibility),(t.has("cameraID")||t.has("cameraManager"))&&(this._actionPresence=this._controller.hasUsefulAction())}render(){if(!this._controller.shouldDisplay())return;const t=(t,a,n)=>n?p`this._controller.handleAction(t,n)} + >`:p``,a=this._controller.getConfig();return p`
+ ${!a?.hide_pan_tilt&&this._actionPresence?.pt?p`
+ ${t("right","mdi:arrow-right",this._actions.right)} + ${t("left","mdi:arrow-left",this._actions.left)} + ${t("up","mdi:arrow-up",this._actions.up)} + ${t("down","mdi:arrow-down",this._actions.down)} +
`:""} + ${!a?.hide_zoom&&this._actionPresence?.z?p`
+ ${t("zoom_in","mdi:plus",this._actions.zoom_in)} + ${t("zoom_out","mdi:minus",this._actions.zoom_out)} +
`:p``} + ${!a?.hide_home&&this._actionPresence?.home?p`
+ ${t("home","mdi:home",this._actions.home)} +
`:p``} +
`}static get styles(){return g(":host {\n position: absolute;\n width: fit-content;\n height: fit-content;\n --frigate-card-ptz-icon-size: 24px;\n}\n\n:host([data-position$=-left]) {\n left: 5%;\n}\n\n:host([data-position$=-right]) {\n right: 5%;\n}\n\n:host([data-position^=top-]) {\n top: 5%;\n}\n\n:host([data-position^=bottom-]) {\n bottom: 5%;\n}\n\n/*****************\n * Main Containers\n *****************/\n.ptz {\n display: flex;\n gap: 10px;\n color: var(--light-primary-color);\n opacity: 0.4;\n transition: opacity 0.3s ease-in-out;\n}\n\n:host([data-orientation=vertical]) .ptz {\n flex-direction: column;\n}\n\n:host([data-orientation=horizontal]) .ptz {\n flex-direction: row;\n}\n\n.ptz:hover {\n opacity: 1;\n}\n\n:host([data-orientation=vertical]) .ptz div {\n width: calc(var(--frigate-card-ptz-icon-size) * 3);\n}\n\n:host([data-orientation=horizontal]) .ptz div {\n height: calc(var(--frigate-card-ptz-icon-size) * 3);\n}\n\n.ptz-move,\n.ptz-zoom,\n.ptz-home {\n position: relative;\n background-color: rgba(0, 0, 0, 0.3);\n}\n\n.ptz-move {\n height: calc(var(--frigate-card-ptz-icon-size) * 3);\n width: calc(var(--frigate-card-ptz-icon-size) * 3);\n border-radius: 50%;\n}\n\n:host([data-orientation=horizontal]) .ptz .ptz-zoom,\n:host([data-orientation=horizontal]) .ptz .ptz-home {\n width: calc(var(--frigate-card-ptz-icon-size) * 1.5);\n}\n\n:host([data-orientation=vertical]) .ptz .ptz-zoom,\n:host([data-orientation=vertical]) .ptz .ptz-home {\n height: calc(var(--frigate-card-ptz-icon-size) * 1.5);\n}\n\n.ptz-zoom,\n.ptz-home {\n border-radius: var(--ha-card-border-radius, 4px);\n}\n\n/***********\n * PTZ Icons\n ***********/\nha-icon {\n position: absolute;\n --mdc-icon-size: var(--frigate-card-ptz-icon-size);\n}\n\nha-icon:not(.disabled) {\n cursor: pointer;\n}\n\n.disabled {\n color: var(--disabled-text-color);\n}\n\n.up {\n top: 5px;\n left: 50%;\n transform: translateX(-50%);\n}\n\n.down {\n bottom: 5px;\n left: 50%;\n transform: translateX(-50%);\n}\n\n.left {\n left: 5px;\n top: 50%;\n transform: translateY(-50%);\n}\n\n.right {\n right: 5px;\n top: 50%;\n transform: translateY(-50%);\n}\n\n:host([data-orientation=vertical]) .zoom_in {\n right: 5px;\n top: 50%;\n}\n\n:host([data-orientation=vertical]) .zoom_out {\n left: 5px;\n top: 50%;\n}\n\n:host([data-orientation=horizontal]) .zoom_in {\n left: 50%;\n top: 5px;\n}\n\n:host([data-orientation=horizontal]) .zoom_out {\n left: 50%;\n bottom: 5px;\n}\n\n:host([data-orientation=vertical]) .zoom_in,\n:host([data-orientation=vertical]) .zoom_out {\n transform: translateY(-50%);\n}\n\n:host([data-orientation=horizontal]) .zoom_in,\n:host([data-orientation=horizontal]) .zoom_out {\n transform: translateX(-50%);\n}\n\n.home {\n top: 50%;\n left: 50%;\n transform: translateX(-50%) translateY(-50%);\n}")}};r([s({attribute:!1})],k.prototype,"config",void 0),r([s({attribute:!1})],k.prototype,"cameraManager",void 0),r([s({attribute:!1})],k.prototype,"cameraID",void 0),r([s({attribute:!1})],k.prototype,"forceVisibility",void 0),k=r([d("frigate-card-ptz")],k);const M=(t,a)=>{void 0!==a?.fit?t.style.setProperty("--frigate-card-media-layout-fit",a.fit):t.style.removeProperty("--frigate-card-media-layout-fit");for(const n of["x","y"])void 0!==a?.position?.[n]?t.style.setProperty(`--frigate-card-media-layout-position-${n}`,`${a.position[n]}%`):t.style.removeProperty(`--frigate-card-media-layout-position-${n}`);for(const n of["top","bottom","left","right"])void 0!==a?.view_box?.[n]?t.style.setProperty(`--frigate-card-media-layout-view-box-${n}`,`${a.view_box[n]}%`):t.style.removeProperty(`--frigate-card-media-layout-view-box-${n}`)},E=2,H=(t,a)=>{t._controlsHideTimer&&(t._controlsHideTimer.stop(),delete t._controlsHideTimer,delete t._controlsOriginalValue),t.controls=a},O=(t,a=1)=>{const n=t._controlsOriginalValue??t.controls;H(t,!1),t._controlsHideTimer??=new i,t._controlsOriginalValue=n;const o=()=>{H(t,n),t.removeEventListener("loadstart",o)};t.addEventListener("loadstart",o),t._controlsHideTimer.start(a,(()=>{H(t,n)}))},R=async(t,a)=>{if(a?.play)try{await a.play()}catch(n){if("NotAllowedError"===n.name&&!t.isMuted()){await t.mute();try{await a.play()}catch(t){}}}};export{A,x as M,L as a,T as b,E as c,O as h,C as i,R as p,H as s,M as u}; diff --git a/config/www/community/frigate-hass-card/media-aef44451.js.gz b/config/www/community/frigate-hass-card/media-aef44451.js.gz new file mode 100644 index 00000000..45af4000 Binary files /dev/null and b/config/www/community/frigate-hass-card/media-aef44451.js.gz differ diff --git a/config/www/community/frigate-hass-card/media-c9012082.js b/config/www/community/frigate-hass-card/media-c9012082.js new file mode 100644 index 00000000..45e63029 --- /dev/null +++ b/config/www/community/frigate-hass-card/media-c9012082.js @@ -0,0 +1 @@ +var e;!function(e){e.MP4="mp4",e.HLS="hls"}(e||(e={}));class t{constructor(e,t){this._mediaType=e,this._cameraID=t}getCameraID(){return this._cameraID}getMediaType(){return this._mediaType}getVideoContentType(){return null}getID(){return null}getStartTime(){return null}getEndTime(){return null}getUsableEndTime(){return this.getEndTime()??(this.inProgress()?new Date:this.getStartTime())}inProgress(){return null}getContentID(){return null}getTitle(){return null}getThumbnail(){return null}isFavorite(){return null}includesTime(e){const t=this.getStartTime(),r=this.getUsableEndTime();return!!t&&!!r&&e>=t&&e<=r}setFavorite(e){}getWhere(){return null}}export{e as V,t as a}; diff --git a/config/www/community/frigate-hass-card/media-c9012082.js.gz b/config/www/community/frigate-hass-card/media-c9012082.js.gz new file mode 100644 index 00000000..c6837be4 Binary files /dev/null and b/config/www/community/frigate-hass-card/media-c9012082.js.gz differ diff --git a/config/www/community/frigate-hass-card/media-d4c0d154.js b/config/www/community/frigate-hass-card/media-d4c0d154.js new file mode 100644 index 00000000..0dfb8e68 --- /dev/null +++ b/config/www/community/frigate-hass-card/media-d4c0d154.js @@ -0,0 +1,33 @@ +import{cL as t,cM as a,dC as n,dD as i,cP as o,dE as e,_ as r,n as s,b as c,t as d,a as l,dF as h,x as p,e as m,dG as u,r as g,dH as _,dI as f,dJ as v,dK as b,dL as y,l as z}from"./card-769e2b91.js"; +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const w={},C=t(class extends a{constructor(){super(...arguments),this.ot=w}render(t,a){return a()}update(t,[a,i]){if(Array.isArray(a)){if(Array.isArray(this.ot)&&this.ot.length===a.length&&a.every(((t,a)=>t===this.ot[a])))return n}else if(this.ot===a)return n;return this.ot=Array.isArray(a)?Array.from(a):a,this.render(a,i)}});class x{constructor(){this._options=null,this._viewportIntersecting=null,this._microphoneMuteTimer=new i,this._root=null,this._eventListeners=new Map,this._children=[],this._target=null,this._mutationObserver=new MutationObserver(this._mutationHandler.bind(this)),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this)),this._mediaLoadedHandler=async t=>{this._target?.index===t&&(await this._unmuteTargetIfConfigured(this._target.selected?"selected":"visible"),await this._playTargetIfConfigured(this._target.selected?"selected":"visible"))},this._visibilityHandler=async()=>{await this._changeVisibility("visible"===document.visibilityState)},this._changeVisibility=async t=>{t?(await this._unmuteTargetIfConfigured("visible"),await this._playTargetIfConfigured("visible")):(await this._pauseAllIfConfigured("hidden"),await this._muteAllIfConfigured("hidden"))},this._microphoneChangeHandler=async t=>{"unmuted"===t?await this._unmuteTargetIfConfigured("microphone"):"muted"===t&&this._options?.autoMuteConditions?.includes("microphone")&&this._microphoneMuteTimer.start(this._options.microphoneMuteSeconds??60,(async()=>{await this._muteTargetIfConfigured("microphone")}))}}setOptions(t){this._options=t,this._options?.microphoneManager&&(this._options.microphoneManager.removeListener(this._microphoneChangeHandler),this._options.microphoneManager.addListener(this._microphoneChangeHandler))}hasRoot(){return!!this._root}destroy(){this._viewportIntersecting=null,this._microphoneMuteTimer.stop(),this._root=null,this._removeChildHandlers(),this._children=[],this._target=null,this._mutationObserver.disconnect(),this._intersectionObserver.disconnect(),this._options?.microphoneManager?.removeListener(this._microphoneChangeHandler),document.removeEventListener("visibilitychange",this._visibilityHandler)}async setTarget(t,a){this._target?.index===t&&this._target?.selected===a||(this._target?.selected&&(await this._pauseTargetIfConfigured("unselected"),await this._muteTargetIfConfigured("unselected"),this._microphoneMuteTimer.stop()),this._target={selected:a,index:t},a?(await this._unmuteTargetIfConfigured("selected"),await this._playTargetIfConfigured("selected")):(await this._unmuteTargetIfConfigured("visible"),await this._playTargetIfConfigured("visible")))}unsetTarget(){this._target=null}async _playTargetIfConfigured(t){null!==this._target&&this._options?.autoPlayConditions?.includes(t)&&await this._play(this._target.index)}async _play(t){await(this._children[t]?.play())}async _unmuteTargetIfConfigured(t){null!==this._target&&this._options?.autoUnmuteConditions?.includes(t)&&await this._unmute(this._target.index)}async _unmute(t){await(this._children[t]?.unmute())}async _pauseAllIfConfigured(t){if(this._options?.autoPauseConditions?.includes(t))for(const t of this._children.keys())await this._pause(t)}async _pauseTargetIfConfigured(t){null!==this._target&&this._options?.autoPauseConditions?.includes(t)&&await this._pause(this._target.index)}async _pause(t){await(this._children[t]?.pause())}async _muteAllIfConfigured(t){if(this._options?.autoMuteConditions?.includes(t))for(const t of this._children.keys())await this._mute(t)}async _muteTargetIfConfigured(t){null!==this._target&&this._options?.autoMuteConditions?.includes(t)&&await this._mute(this._target.index)}async _mute(t){await(this._children[t]?.mute())}_mutationHandler(t,a){this._initializeRoot()}_removeChildHandlers(){for(const[t,a]of this._eventListeners.entries())t.removeEventListener("frigate-card:media:loaded",a);this._eventListeners.clear()}initialize(t){this._root=t,this._initializeRoot(),document.addEventListener("visibilitychange",this._visibilityHandler),this._intersectionObserver.disconnect(),this._intersectionObserver.observe(t),this._mutationObserver.disconnect(),this._mutationObserver.observe(this._root,{childList:!0,subtree:!0})}_initializeRoot(){if(this._options&&this._root){this._removeChildHandlers(),this._children=[...this._root.querySelectorAll(this._options.playerSelector)];for(const[t,a]of this._children.entries()){const n=()=>this._mediaLoadedHandler(t);this._eventListeners.set(a,n),a.addEventListener("frigate-card:media:loaded",n)}}}async _intersectionHandler(t){const a=this._viewportIntersecting;this._viewportIntersecting=t.some((t=>t.isIntersecting)),null!==a&&a!==this._viewportIntersecting&&await this._changeVisibility(this._viewportIntersecting)}}const I={active:!0,breakpoints:{},lazyLoadCount:0};function A(t={}){let a,n,i;const o=new Set,e=["init","select"],r=["select"];function s(){"hidden"===document.visibilityState&&a.lazyUnloadConditions?.includes("hidden")?o.forEach((t=>{a.lazyUnloadCallback&&(a.lazyUnloadCallback(t,i[t]),o.delete(t))})):"visible"===document.visibilityState&&a.lazyLoadCallback&&d()}function c(t){return o.has(t)}function d(){const t=a.lazyLoadCount,e=n.selectedScrollSnap(),r=new Set;for(let a=1;a<=t&&e-a>=0;a++)r.add(e-a);r.add(e);for(let a=1;a<=t&&e+a{!c(t)&&a.lazyLoadCallback&&(o.add(t),a.lazyLoadCallback(t,i[t]))}))}function l(){const t=n.previousScrollSnap();c(t)&&a.lazyUnloadCallback&&(a.lazyUnloadCallback(t,i[t]),o.delete(t))}return{name:"autoLazyLoad",options:t,init:function(o,c){const{mergeOptions:h,optionsAtMedia:p}=c,m=h(I,t);a=p(m),n=o,i=n.slideNodes(),a.lazyLoadCallback&&e.forEach((t=>n.on(t,d))),a.lazyUnloadCallback&&a.lazyUnloadConditions?.includes("unselected")&&r.forEach((t=>n.on(t,l))),document.addEventListener("visibilitychange",s)},destroy:function(){a.lazyLoadCallback&&e.forEach((t=>n.off(t,d))),a.lazyUnloadCallback&&r.forEach((t=>n.off(t,l))),document.removeEventListener("visibilitychange",s)}}}function L(){let t,a=[];const n=[];function i(i){const o=i.composedPath();for(const[e,r]of[...a.entries()].reverse())if(o.includes(r)){n[e]=i.detail,e!==t.selectedScrollSnap()&&i.stopPropagation();break}}function e(i){const o=i.composedPath();for(const[e,r]of a.entries())if(o.includes(r)){delete n[e],e!==t.selectedScrollSnap()&&i.stopPropagation();break}}function r(){const i=t.selectedScrollSnap(),e=n[i];e&&o(a[i],e)}return{name:"autoMediaLoadedInfo",options:{},init:function(n){t=n,a=t.slideNodes();for(const t of a)t.addEventListener("frigate-card:media:loaded",i),t.addEventListener("frigate-card:media:unloaded",e);t.on("init",r),t.containerNode().addEventListener("frigate-card:carousel:force-select",r)},destroy:function(){for(const t of a)t.removeEventListener("frigate-card:media:loaded",i),t.removeEventListener("frigate-card:media:unloaded",e);t.off("init",r),t.containerNode().removeEventListener("frigate-card:carousel:force-select",r)}}}class S{constructor(t){this._scrolling=!1,this._shouldReInitOnScrollStop=!1,this._scrollingStart=()=>{this._scrolling=!0},this._scrollingStop=()=>{this._scrolling=!1,this._shouldReInitOnScrollStop&&(this._shouldReInitOnScrollStop=!1,this._debouncedReInit())},this._debouncedReInit=e((()=>{this._scrolling=!1,this._shouldReInitOnScrollStop=!1,this._emblaApi?.reInit()}),500,{trailing:!0}),this._emblaApi=t,this._emblaApi.on("scroll",this._scrollingStart),this._emblaApi.on("settle",this._scrollingStop),this._emblaApi.on("destroy",this.destroy)}destroy(){this._emblaApi.off("scroll",this._scrollingStart),this._emblaApi.off("settle",this._scrollingStop),this._emblaApi.off("destroy",this.destroy)}reinit(){this._scrolling?this._shouldReInitOnScrollStop=!0:this._debouncedReInit()}}function T(){let t,a=null,n=null;const i=new Map,o=new ResizeObserver((function(t){let a=!1;for(const n of t){const t={height:n.contentRect.height,width:n.contentRect.width},o=i.get(n.target);t.width&&t.height&&(o?.height!==t.height||o?.width!==t.width)&&(i.set(n.target,t),a=!0)}a&&s()})),r=new IntersectionObserver((function(t){const i=t.some((t=>t.isIntersecting));if(i!==n){const t=i&&null!==n;n=i,t&&a?.reinit()}})),s=e((()=>function(){const{slideRegistry:n,options:{axis:i}}=t.internalEngine();if("y"===i)return;t.containerNode().style.removeProperty("max-height");const o=n[t.selectedScrollSnap()],e=t.slideNodes(),r=Math.max(...o.map((t=>e[t].getBoundingClientRect().height)));!isNaN(r)&&r>0&&(t.containerNode().style.maxHeight=`${r}px`);a?.reinit()}()),200,{trailing:!0});return{name:"autoSize",options:{},init:function(n){t=n,a=new S(t),r.observe(t.containerNode()),o.observe(t.containerNode());for(const a of t.slideNodes())o.observe(a);t.containerNode().addEventListener("frigate-card:media:loaded",s),t.on("settle",s)},destroy:function(){r.disconnect(),o.disconnect(),a?.destroy(),t.containerNode().removeEventListener("frigate-card:media:loaded",s),t.off("settle",s)}}}let $=class extends l{constructor(){super(...arguments),this.disabled=!1,this.label="",this._embedThumbnailTask=h(this,(()=>this.hass),(()=>this.thumbnail))}set controlConfig(t){t?.size&&this.style.setProperty("--frigate-card-next-prev-size",`${t.size}px`),this._controlConfig=t}render(){if(this.disabled||!this._controlConfig||"none"==this._controlConfig.style)return p``;const t=!this.thumbnail||["chevrons","icons"].includes(this._controlConfig.style),a={controls:!0,previous:"previous"===this.direction,next:"next"===this.direction,thumbnails:!t,icons:t,button:t};if(t){const t=this.thumbnail&&this.icon&&"chevrons"!==this._controlConfig.style?this.icon:"previous"===this.direction?"mdi:chevron-left":"mdi:chevron-right";return p` + + `}return u(this,this._embedThumbnailTask,(t=>t?p``:p``),{inProgressFunc:()=>p`
`})}static get styles(){return g("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n --frigate-card-next-prev-size: 48px;\n --frigate-card-next-prev-size-hover: calc(var(--frigate-card-next-prev-size) * 2);\n --frigate-card-prev-position: 45px;\n --frigate-card-next-position: 45px;\n --mdc-icon-button-size: var(--frigate-card-next-prev-size);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n}\n\n.controls {\n position: absolute;\n z-index: 1;\n overflow: hidden;\n}\n\n.controls.previous {\n left: var(--frigate-card-prev-position);\n}\n\n.controls.next {\n right: var(--frigate-card-next-position);\n}\n\n.controls.icons {\n top: calc(50% - var(--frigate-card-next-prev-size) / 2);\n}\n\n.controls.thumbnails {\n border-radius: 50%;\n height: var(--frigate-card-next-prev-size);\n top: calc(50% - var(--frigate-card-next-prev-size) / 2);\n box-shadow: var(--frigate-card-css-box-shadow, 0px 0px 20px 5px black);\n transition: all 0.2s ease-out;\n opacity: 0.8;\n aspect-ratio: 1/1;\n}\n\n.controls.thumbnails:hover {\n opacity: 1 !important;\n height: var(--frigate-card-next-prev-size-hover);\n top: calc(50% - var(--frigate-card-next-prev-size-hover) / 2);\n}\n\n.controls.previous.thumbnails:hover {\n left: calc(var(--frigate-card-prev-position) - (var(--frigate-card-next-prev-size-hover) - var(--frigate-card-next-prev-size)) / 2);\n}\n\n.controls.next.thumbnails:hover {\n right: calc(var(--frigate-card-next-position) - (var(--frigate-card-next-prev-size-hover) - var(--frigate-card-next-prev-size)) / 2);\n}")}};r([s({attribute:!1})],$.prototype,"direction",void 0),r([s({attribute:!1})],$.prototype,"hass",void 0),r([c()],$.prototype,"_controlConfig",void 0),r([s({attribute:!1})],$.prototype,"thumbnail",void 0),r([s({attribute:!1})],$.prototype,"icon",void 0),r([s({attribute:!0,type:Boolean})],$.prototype,"disabled",void 0),r([s()],$.prototype,"label",void 0),$=r([d("frigate-card-next-previous-control")],$);class P{constructor(t){this._config=null,this._hass=null,this._cameraManager=null,this._cameraID=null,this._host=t}setConfig(t){this._config=t??null,this._host.setAttribute("data-orientation",t?.orientation??"horizontal"),this._host.setAttribute("data-position",t?.position??"bottom-right"),this._host.setAttribute("style",Object.entries(t?.style??{}).map((([t,a])=>`${t}:${a}`)).join(";"))}getConfig(){return this._config}setCamera(t,a){this._cameraManager=t??null,this._cameraID=a??null}setForceVisibility(t){this._forceVisibility=t}handleAction(t,a){t.stopPropagation();const n=t.detail.action,i=_(n,a);i&&f(this._host,{action:i,...a&&{config:a}})}hasUsefulAction(){const t={pt:!0,z:!0,home:!0};if(!this._cameraID)return t;const a=this._cameraManager?.getCameraCapabilities(this._cameraID);if(!a||!a.hasPTZCapability())return t;const n=a.getPTZCapabilities();return{pt:!!(n?.up||n?.down||n?.left||n?.right),z:!!n?.zoomIn||!!n?.zoomOut,home:!!n?.presets?.length}}shouldDisplay(){return void 0!==this._forceVisibility?this._forceVisibility:"auto"===this._config?.mode?!!this._cameraID&&!!this._cameraManager?.getCameraCapabilities(this._cameraID)?.hasPTZCapability():"on"===this._config?.mode}getPTZActions(){const t=t=>({start_tap_action:v({ptzAction:t?.ptzAction,ptzPhase:"start",ptzPreset:t?.preset}),end_tap_action:v({ptzAction:t?.ptzAction,ptzPhase:"stop",ptzPreset:t?.preset})}),a={};return a.up=t({ptzAction:"up"}),a.down=t({ptzAction:"down"}),a.left=t({ptzAction:"left"}),a.right=t({ptzAction:"right"}),a.zoom_in=t({ptzAction:"zoom_in"}),a.zoom_out=t({ptzAction:"zoom_out"}),a.home={tap_action:v()},a}}let k=class extends l{constructor(){super(...arguments),this._controller=new P(this),this._actions=this._controller.getPTZActions(),this._actionPresence=null}willUpdate(t){t.has("config")&&this._controller.setConfig(this.config),(t.has("cameraManager")||t.has("cameraID"))&&this._controller.setCamera(this.cameraManager,this.cameraID),t.has("forceVisibility")&&this._controller.setForceVisibility(this.forceVisibility),(t.has("cameraID")||t.has("cameraManager"))&&(this._actionPresence=this._controller.hasUsefulAction())}render(){if(!this._controller.shouldDisplay())return;const t=(t,a,n)=>n?p`this._controller.handleAction(t,n)} + >`:p``,a=this._controller.getConfig();return p`
+ ${!a?.hide_pan_tilt&&this._actionPresence?.pt?p`
+ ${t("right","mdi:arrow-right",this._actions.right)} + ${t("left","mdi:arrow-left",this._actions.left)} + ${t("up","mdi:arrow-up",this._actions.up)} + ${t("down","mdi:arrow-down",this._actions.down)} +
`:""} + ${!a?.hide_zoom&&this._actionPresence?.z?p`
+ ${t("zoom_in","mdi:plus",this._actions.zoom_in)} + ${t("zoom_out","mdi:minus",this._actions.zoom_out)} +
`:p``} + ${!a?.hide_home&&this._actionPresence?.home?p`
+ ${t("home","mdi:home",this._actions.home)} +
`:p``} +
`}static get styles(){return g(":host {\n position: absolute;\n width: fit-content;\n height: fit-content;\n --frigate-card-ptz-icon-size: 24px;\n}\n\n:host([data-position$=-left]) {\n left: 5%;\n}\n\n:host([data-position$=-right]) {\n right: 5%;\n}\n\n:host([data-position^=top-]) {\n top: 5%;\n}\n\n:host([data-position^=bottom-]) {\n bottom: 5%;\n}\n\n/*****************\n * Main Containers\n *****************/\n.ptz {\n display: flex;\n gap: 10px;\n color: var(--light-primary-color);\n opacity: 0.4;\n transition: opacity 0.3s ease-in-out;\n}\n\n:host([data-orientation=vertical]) .ptz {\n flex-direction: column;\n}\n\n:host([data-orientation=horizontal]) .ptz {\n flex-direction: row;\n}\n\n.ptz:hover {\n opacity: 1;\n}\n\n:host([data-orientation=vertical]) .ptz div {\n width: calc(var(--frigate-card-ptz-icon-size) * 3);\n}\n\n:host([data-orientation=horizontal]) .ptz div {\n height: calc(var(--frigate-card-ptz-icon-size) * 3);\n}\n\n.ptz-move,\n.ptz-zoom,\n.ptz-home {\n position: relative;\n background-color: rgba(0, 0, 0, 0.3);\n}\n\n.ptz-move {\n height: calc(var(--frigate-card-ptz-icon-size) * 3);\n width: calc(var(--frigate-card-ptz-icon-size) * 3);\n border-radius: 50%;\n}\n\n:host([data-orientation=horizontal]) .ptz .ptz-zoom,\n:host([data-orientation=horizontal]) .ptz .ptz-home {\n width: calc(var(--frigate-card-ptz-icon-size) * 1.5);\n}\n\n:host([data-orientation=vertical]) .ptz .ptz-zoom,\n:host([data-orientation=vertical]) .ptz .ptz-home {\n height: calc(var(--frigate-card-ptz-icon-size) * 1.5);\n}\n\n.ptz-zoom,\n.ptz-home {\n border-radius: var(--ha-card-border-radius, 4px);\n}\n\n/***********\n * PTZ Icons\n ***********/\nha-icon {\n position: absolute;\n --mdc-icon-size: var(--frigate-card-ptz-icon-size);\n}\n\nha-icon:not(.disabled) {\n cursor: pointer;\n}\n\n.disabled {\n color: var(--disabled-text-color);\n}\n\n.up {\n top: 5px;\n left: 50%;\n transform: translateX(-50%);\n}\n\n.down {\n bottom: 5px;\n left: 50%;\n transform: translateX(-50%);\n}\n\n.left {\n left: 5px;\n top: 50%;\n transform: translateY(-50%);\n}\n\n.right {\n right: 5px;\n top: 50%;\n transform: translateY(-50%);\n}\n\n:host([data-orientation=vertical]) .zoom_in {\n right: 5px;\n top: 50%;\n}\n\n:host([data-orientation=vertical]) .zoom_out {\n left: 5px;\n top: 50%;\n}\n\n:host([data-orientation=horizontal]) .zoom_in {\n left: 50%;\n top: 5px;\n}\n\n:host([data-orientation=horizontal]) .zoom_out {\n left: 50%;\n bottom: 5px;\n}\n\n:host([data-orientation=vertical]) .zoom_in,\n:host([data-orientation=vertical]) .zoom_out {\n transform: translateY(-50%);\n}\n\n:host([data-orientation=horizontal]) .zoom_in,\n:host([data-orientation=horizontal]) .zoom_out {\n transform: translateX(-50%);\n}\n\n.home {\n top: 50%;\n left: 50%;\n transform: translateX(-50%) translateY(-50%);\n}")}};r([s({attribute:!1})],k.prototype,"config",void 0),r([s({attribute:!1})],k.prototype,"cameraManager",void 0),r([s({attribute:!1})],k.prototype,"cameraID",void 0),r([s({attribute:!1})],k.prototype,"forceVisibility",void 0),k=r([d("frigate-card-ptz")],k);const M=(t,a)=>{void 0!==a?.fit?t.style.setProperty("--frigate-card-media-layout-fit",a.fit):t.style.removeProperty("--frigate-card-media-layout-fit");for(const n of["x","y"])void 0!==a?.position?.[n]?t.style.setProperty(`--frigate-card-media-layout-position-${n}`,`${a.position[n]}%`):t.style.removeProperty(`--frigate-card-media-layout-position-${n}`);for(const n of["top","bottom","left","right"])void 0!==a?.view_box?.[n]?t.style.setProperty(`--frigate-card-media-layout-view-box-${n}`,`${a.view_box[n]}%`):t.style.removeProperty(`--frigate-card-media-layout-view-box-${n}`)},E=2,H=(t,a)=>{t._controlsHideTimer&&(t._controlsHideTimer.stop(),delete t._controlsHideTimer,delete t._controlsOriginalValue),t.controls=a},O=(t,a=1)=>{const n=t._controlsOriginalValue??t.controls;H(t,!1),t._controlsHideTimer??=new i,t._controlsOriginalValue=n;const o=()=>{H(t,n),t.removeEventListener("loadstart",o)};t.addEventListener("loadstart",o),t._controlsHideTimer.start(a,(()=>{H(t,n)}))},R=async(t,a)=>{if(a?.play)try{await a.play()}catch(n){if("NotAllowedError"===n.name&&!t.isMuted()){await t.mute();try{await a.play()}catch(t){}}}};export{A,x as M,L as a,T as b,E as c,O as h,C as i,R as p,H as s,M as u}; diff --git a/config/www/community/frigate-hass-card/media-d4c0d154.js.gz b/config/www/community/frigate-hass-card/media-d4c0d154.js.gz new file mode 100644 index 00000000..925fe27e Binary files /dev/null and b/config/www/community/frigate-hass-card/media-d4c0d154.js.gz differ diff --git a/config/www/community/frigate-hass-card/media-grid-0f7352bc.js b/config/www/community/frigate-hass-card/media-grid-0f7352bc.js new file mode 100644 index 00000000..69a2913d --- /dev/null +++ b/config/www/community/frigate-hass-card/media-grid-0f7352bc.js @@ -0,0 +1,22 @@ +import{dN as t,dM as e,dh as i,eE as n,i as o,dg as s,cP as r,cS as a,s as h,_ as l,n as d,t as u,a as c,cR as f,x as m,cV as p,r as g}from"./card-45855f1f.js";var v,y={exports:{}},_={exports:{}},b={exports:{}};function C(){return v||(v=1,e=b,i="undefined"!=typeof window?window:t,n=function(){function t(){}var e=t.prototype;return e.on=function(t,e){if(t&&e){var i=this._events=this._events||{},n=i[t]=i[t]||[];return-1==n.indexOf(e)&&n.push(e),this}},e.once=function(t,e){if(t&&e){this.on(t,e);var i=this._onceEvents=this._onceEvents||{};return(i[t]=i[t]||{})[e]=!0,this}},e.off=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var n=i.indexOf(e);return-1!=n&&i.splice(n,1),this}},e.emitEvent=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){i=i.slice(0),e=e||[];for(var n=this._onceEvents&&this._onceEvents[t],o=0;o