Home-AssistantConfig/config/www/community/frigate-hass-card/card-320adb66.js

651 lines
518 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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?"<svg>":"",o=P;for(let t=0;t<n;t++){const n=e[t];let s,c,l=-1,d=0;for(;d<n.length&&(o.lastIndex=d,c=o.exec(n),null!==c);)d=o.lastIndex,o===P?"!--"===c[1]?o=L:void 0!==c[1]?o=N:void 0!==c[2]?(B.test(c[2])&&(i=RegExp("</"+c[2],"g")),o=F):void 0!==c[3]&&(o=F):o===F?">"===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?"</svg>":"")),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.length<o;){if(1===a.nodeType){if(a.hasAttributes())for(const e of a.getAttributeNames())if(e.endsWith($)){const t=l[r++],n=a.getAttribute(e).split(A),o=/([.?@])?(.*)/.exec(t);s.push({type:1,index:i,name:o[2],strings:n,ctor:"."===o[1]?ne:"?"===o[1]?ae:"@"===o[1]?ie:te}),a.removeAttribute(e)}else e.startsWith(A)&&(s.push({type:6,index:i}),a.removeAttribute(e));if(B.test(a.tagName)){const e=a.textContent.split(A),t=e.length-1;if(t>0){a.textContent=S?S.emptyScript:"";for(let n=0;n<t;n++)a.append(e[n],j()),Q.nextNode(),s.push({type:2,index:++i});a.append(e[t],j())}}}else if(8===a.nodeType)if(a.data===I)s.push({type:2,index:i});else{let e=-1;for(;-1!==(e=a.data.indexOf(A,e+1));)s.push({type:7,index:i}),e+=A.length-1}i++}}static createElement(e,t){const n=T.createElement("template");return n.innerHTML=e,n}}function X(e,t,n=e,a){if(t===U)return t;let i=void 0!==a?n._$Co?.[a]:n._$Cl;const r=O(t)?void 0:t._$litDirective$;return i?.constructor!==r&&(i?._$AO?.(!1),void 0===r?i=void 0:(i=new r(e),i._$AT(e,n,a)),void 0!==a?(n._$Co??=[])[a]=i:n._$Cl=i),void 0!==i&&(t=X(e,i._$AS(e,t.values),i,a)),t}let J=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:n}=this._$AD,a=(e?.creationScope??T).importNode(t,!0);Q.currentNode=a;let i=Q.nextNode(),r=0,o=0,s=n[0];for(;void 0!==s;){if(r===s.index){let t;2===s.type?t=new ee(i,i.nextSibling,this,e):1===s.type?t=new s.ctor(i,s.name,s.strings,this,e):6===s.type&&(t=new re(i,this,e)),this._$AV.push(t),s=n[++o]}r!==s?.index&&(i=Q.nextNode(),r++)}return Q.currentNode=T,a}p(e){let t=0;for(const n of this._$AV)void 0!==n&&(void 0!==n.strings?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}};class ee{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,a){this.type=2,this._$AH=W,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=a,this._$Cv=a?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=X(this,e,t),O(e)?e===W||null==e||""===e?(this._$AH!==W&&this._$AR(),this._$AH=W):e!==this._$AH&&e!==U&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=>D(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++;a<t.length&&(this._$AR(n&&n._$AB.nextSibling,a),t.length=a)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e&&e!==this._$AB;){const t=e.nextSibling;e.remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}}class te{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,a,i){this.type=1,this._$AH=W,this._$AN=void 0,this.element=e,this.name=t,this._$AM=a,this.options=i,n.length>2||""!==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<i.length-1;o++)s=X(this,a[n+o],t,o),s===U&&(s=this._$AH[o]),r||=!O(s)||s!==this._$AH[o],s===W?e=W:e!==W&&(e+=(s??"")+i[o+1]),this._$AH[o]=s}r&&!a&&this.j(e)}j(e){e===W?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class ne extends te{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===W?void 0:e}}class ae extends te{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==W)}}class ie extends te{constructor(e,t,n,a,i){super(e,t,n,a,i),this.type=5}_$AI(e,t=this){if((e=X(this,e,t,0)??W)===U)return;const n=this._$AH,a=e===W&&n!==W||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,i=e!==W&&(n===W||a);a&&this.element.removeEventListener(this.name,this,n),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}let re=class{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){X(this,e)}};const oe=k.litHtmlPolyfillSupport;oe?.(K,ee),(k.litHtmlVersions??=[]).push("3.1.2");
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
let se=class extends M{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=((e,t,n)=>{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<a.length;e++)Ce(a[e],!1),Me(a[e]);else null!=a&&(Ce(a,!1),Me(a));else Ce(this,e)}const $e=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<div id="start"></div>\n\t<div id="backup"></div>\n\t<slot></slot>\n\t<div id="end"></div>\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 <style>*{box-sizing:border-box}:host{padding:var(--dialog-container-padding,5vw 24px);z-index:var(--dialog-z-index,12345678);outline:none}#backdrop,:host{position:fixed;top:0;left:0;bottom:0;right:0}:host,:host([center]) #dialog{overflow-x:var(--dialog-overflow-x,hidden);overflow-y:var(--dialog-overflow-y,auto);overscroll-behavior:contain;-webkit-overflow-scrolling:touch}:host([center]){display:flex;align-items:center;justify-content:center;overflow:hidden}:host([center]) #dialog{max-height:var(--dialog-max-height,100%)}:host(:not(:defined)),:host(:not([open])){display:none}#backdrop{background:var(--dialog-backdrop-bg,rgba(0,0,0,.6));animation:fadeIn var(--dialog-animation-duration,.1s) var(--dialog-animation-easing,ease-out);z-index:-1}#dialog{animation:scaleIn var(--dialog-animation-duration,.1s) var(--dialog-animation-easing,ease-out);border-radius:var(--dialog-border-radius,12px);box-shadow:var(--dialog-box-shadow,0 2px 10px -5px rgba(0,0,0,.6));max-width:var(--dialog-max-width,700px);width:var(--dialog-width,100%);padding:var(--dialog-padding,24px);max-height:var(--dialog-max-height,unset);height:var(--dialog-height,auto);color:var(--dialog-color,currentColor);background:var(--dialog-bg,#fff);z-index:1;position:relative;display:flex;flex-direction:column;margin:0 auto;border:none}::slotted(article),article{flex-grow:1;overflow-y:auto;-webkit-overflow-scrolling:touch}::slotted(footer),::slotted(header),footer,header{flex-shrink:0}@keyframes scaleIn{0%{transform:scale(.9) translateY(30px);opacity:0}to{transform:scale(1) translateY(0);opacity:1}}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}</style>\n <div id="backdrop" part="backdrop"></div>\n <focus-trap id="dialog" part="dialog">\n <slot></slot>\n </focus-trap>\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(;a<i.path.length;){const n=i.path[a];a===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],a++}}};return a(this),n}static assert(e){if(!(e instanceof st))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ke.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=(e=>e.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.length<a.value&&(n=this._getOrReturnCtx(e,n),ht(n,{code:ot.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("max"===a.kind)e.data.length>a.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.length<a.value;(i||r)&&(n=this._getOrReturnCtx(e,n),i?ht(n,{code:ot.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):r&&ht(n,{code:ot.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),t.dirty())}else if("email"===a.kind)Rt.test(e.data)||(n=this._getOrReturnCtx(e,n),ht(n,{validation:"email",code:ot.invalid_string,message:a.message}),t.dirty());else if("emoji"===a.kind)Pt||(Pt=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Pt.test(e.data)||(n=this._getOrReturnCtx(e,n),ht(n,{validation:"emoji",code:ot.invalid_string,message:a.message}),t.dirty());else if("uuid"===a.kind)jt.test(e.data)||(n=this._getOrReturnCtx(e,n),ht(n,{validation:"uuid",code:ot.invalid_string,message:a.message}),t.dirty());else if("nanoid"===a.kind)Ot.test(e.data)||(n=this._getOrReturnCtx(e,n),ht(n,{validation:"nanoid",code:ot.invalid_string,message:a.message}),t.dirty());else if("cuid"===a.kind)It.test(e.data)||(n=this._getOrReturnCtx(e,n),ht(n,{validation:"cuid",code:ot.invalid_string,message:a.message}),t.dirty());else if("cuid2"===a.kind)zt.test(e.data)||(n=this._getOrReturnCtx(e,n),ht(n,{validation:"cuid2",code:ot.invalid_string,message:a.message}),t.dirty());else if("ulid"===a.kind)Tt.test(e.data)||(n=this._getOrReturnCtx(e,n),ht(n,{validation:"ulid",code:ot.invalid_string,message:a.message}),t.dirty());else if("url"===a.kind)try{new URL(e.data)}catch(i){n=this._getOrReturnCtx(e,n),ht(n,{validation:"url",code:ot.invalid_string,message:a.message}),t.dirty()}else if("regex"===a.kind){a.regex.lastIndex=0;a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),ht(n,{validation:"regex",code:ot.invalid_string,message:a.message}),t.dirty())}else if("trim"===a.kind)e.data=e.data.trim();else if("includes"===a.kind)e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),ht(n,{code:ot.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),t.dirty());else if("toLowerCase"===a.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===a.kind)e.data=e.data.toUpperCase();else if("startsWith"===a.kind)e.data.startsWith(a.value)||(n=this._getOrReturnCtx(e,n),ht(n,{code:ot.invalid_string,validation:{startsWith:a.value},message:a.message}),t.dirty());else if("endsWith"===a.kind)e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),ht(n,{code:ot.invalid_string,validation:{endsWith:a.value},message:a.message}),t.dirty());else if("datetime"===a.kind){qt(a).test(e.data)||(n=this._getOrReturnCtx(e,n),ht(n,{code:ot.invalid_string,validation:"datetime",message:a.message}),t.dirty())}else if("date"===a.kind){Ht.test(e.data)||(n=this._getOrReturnCtx(e,n),ht(n,{code:ot.invalid_string,validation:"date",message:a.message}),t.dirty())}else if("time"===a.kind){new RegExp(`^${Bt(a)}$`).test(e.data)||(n=this._getOrReturnCtx(e,n),ht(n,{code:ot.invalid_string,validation:"time",message:a.message}),t.dirty())}else"duration"===a.kind?Dt.test(e.data)||(n=this._getOrReturnCtx(e,n),ht(n,{validation:"duration",code:ot.invalid_string,message:a.message}),t.dirty()):"ip"===a.kind?Ut(e.data,a.version)||(n=this._getOrReturnCtx(e,n),ht(n,{validation:"ip",code:ot.invalid_string,message:a.message}),t.dirty()):"base64"===a.kind?Ft.test(e.data)||(n=this._getOrReturnCtx(e,n),ht(n,{validation:"base64",code:ot.invalid_string,message:a.message}),t.dirty()):Ke.assertNever(a);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement((t=>e.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.value<e)&&(e=t.value);return e}}function Zt(e,t){const n=(e.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,i=n>a?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.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty())}else if("max"===a.kind){(a.inclusive?e.data>a.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<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"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.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}Qt.create=e=>new 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.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty())}else if("max"===a.kind){(a.inclusive?e.data>a.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<e)&&(e=t.value);return e}}Gt.create=e=>{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_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),t.dirty()):"max"===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.value<e)&&(e=t.value);return null!=e?new Date(e):null}}Kt.create=e=>new 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.length<a.exactLength.value;(e||i)&&(ht(t,{code:e?ot.too_big:ot.too_small,minimum:i?a.exactLength.value:void 0,maximum:e?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),n.dirty())}if(null!==a.minLength&&t.data.length<a.minLength.value&&(ht(t,{code:ot.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),n.dirty()),null!==a.maxLength&&t.data.length>a.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<e.length;a++){const i=hn(e[a],t[a]);if(!i.valid)return{valid:!1};n.push(i.data)}return{valid:!0,data:n}}return n===it.date&&a===it.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class pn extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),a=(e,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.length<this._def.items.length)return ht(n,{code:ot.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),mt;!this._def.rest&&n.data.length>this._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.size<a.minSize.value&&(ht(n,{code:ot.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),null!==a.maxSize&&n.data.size>a.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<e.length;n++){const a=e[n];"number"==typeof a?t+="["+a+"]":t?t+=" -> "+a:t=a}return t},Ps=ba.object({key:ba.string(),ctrl:ba.boolean().optional(),shift:ba.boolean().optional(),alt:ba.boolean().optional(),meta:ba.boolean().optional()}),Ls={enabled:!0,ptz_left:{key:"ArrowLeft"},ptz_right:{key:"ArrowRight"},ptz_up:{key:"ArrowUp"},ptz_down:{key:"ArrowDown"},ptz_zoom_in:{key:"+"},ptz_zoom_out:{key:"-"},ptz_home:{key:"h"}},Ns=ba.object({enabled:ba.boolean().default(Ls.enabled),ptz_left:Ps.nullable().default(Ls.ptz_left),ptz_right:Ps.nullable().default(Ls.ptz_right),ptz_up:Ps.nullable().default(Ls.ptz_up),ptz_down:Ps.nullable().default(Ls.ptz_down),ptz_zoom_in:Ps.nullable().default(Ls.ptz_zoom_in),ptz_zoom_out:Ps.nullable().default(Ls.ptz_zoom_out),ptz_home:Ps.nullable().default(Ls.ptz_home)}),Fs=[...["left","right","up","down","zoom_in","zoom_out"],"preset"],Vs=20,Hs=20,Bs=100,qs=Bs,Us=["diagnostics","live","clip","clips","snapshot","snapshots","recording","recordings","image","timeline"],Ws="live",Zs=["unselected","hidden"],Qs=["selected","visible"],Gs=[...Qs,"microphone"],Ys=[...Zs,"microphone"],Ks=["start","stop"],Xs=["events","clips","snapshots"],Js=/^[-\w]+$/,ec=ba.object({x:ba.number().min(0).max(100).optional(),y:ba.number().min(0).max(100).optional()}),tc=ba.number().min(1).max(10),nc=ba.enum(["single","grid"]),ac=ba.object({mode:nc,grid_selected_width_factor:ba.number().min(0).optional(),grid_max_columns:ba.number().min(0).optional(),grid_columns:ba.number().min(0).optional()}).optional(),ic=ba.object({confirmation:ba.boolean().or(ba.object({text:ba.string().optional(),exemptions:ba.object({user:ba.string()}).array().optional()})).optional()}),rc=ic.extend({action:ba.literal("toggle")}),oc=ba.object({entity_id:ba.string().optional(),device_id:ba.string().optional(),area_id:ba.string().optional()}),sc=ic.extend({action:ba.literal("perform-action"),perform_action:ba.string(),data:ba.object({}).passthrough().optional(),target:oc.optional()}),cc=ic.extend({action:ba.literal("call-service"),service:ba.string(),data:ba.object({}).passthrough().optional(),target:oc.optional()}),lc=ic.extend({action:ba.literal("navigate"),navigation_path:ba.string()}),dc=ic.extend({action:ba.literal("url"),url_path:ba.string()}),uc=ic.extend({action:ba.literal("more-info")}),hc=ic.extend({action:ba.literal("fire-dom-event")}).passthrough(),pc=ic.extend({action:ba.literal("none")}),mc=hc.extend({action:ba.literal("custom:frigate-card-action").transform((()=>"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<a?7:0)+r-a;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function Xd(e){return Kd(e,{weekStartsOn:1})}function Jd(e){const t=Nd(e),n=t.getFullYear(),a=Fd(e,0);a.setFullYear(n+1,0,4),a.setHours(0,0,0,0);const i=Xd(a),r=Fd(e,0);r.setFullYear(n,0,4),r.setHours(0,0,0,0);const o=Xd(r);return t.getTime()>=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;n<e.length;n++)if(t(e[n]))return n;return}(s,(e=>e.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<n;){var a=e[t];this.set(a[0],a[1])}}Yu.prototype.clear=function(){this.__data__=[],this.size=0},Yu.prototype.delete=function(e){var t=this.__data__,n=Qu(t,e);return!(n<0)&&(n==t.length-1?t.pop():Gu.call(t,n,1),--this.size,!0)},Yu.prototype.get=function(e){var t=this.__data__,n=Qu(t,e);return n<0?void 0:t[n][1]},Yu.prototype.has=function(e){return Qu(this.__data__,e)>-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();++t<n;){var a=e[t];this.set(a[0],a[1])}}function Oh(e,t){var n=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?n["string"==typeof t?"string":"hash"]:n.map}function Dh(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var a=e[t];this.set(a[0],a[1])}}jh.prototype.clear=function(){this.__data__=Ih?Ih(null):{},this.size=0},jh.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},jh.prototype.get=function(e){var t=this.__data__;if(Ih){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return zh.call(t,e)?t[e]:void 0},jh.prototype.has=function(e){var t=this.__data__;return Ih?void 0!==t[e]:Th.call(t,e)},jh.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Ih&&void 0===t?"__lodash_hash_undefined__":t,this},Dh.prototype.clear=function(){this.size=0,this.__data__={hash:new jh,map:new(Ah||Yu),string:new jh}},Dh.prototype.delete=function(e){var t=Oh(this,e).delete(e);return this.size-=t?1:0,t},Dh.prototype.get=function(e){return Oh(this,e).get(e)},Dh.prototype.has=function(e){return Oh(this,e).has(e)},Dh.prototype.set=function(e,t){var n=Oh(this,e),a=n.size;return n.set(e,t),this.size+=n.size==a?0:1,this};function Rh(e){var t=this.__data__=new Yu(e);this.size=t.size}Rh.prototype.clear=function(){this.__data__=new Yu,this.size=0},Rh.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Rh.prototype.get=function(e){return this.__data__.get(e)},Rh.prototype.has=function(e){return this.__data__.has(e)},Rh.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Yu){var a=n.__data__;if(!Ah||a.length<199)return a.push([e,t]),this.size=++n.size,this;n=this.__data__=new Dh(a)}return n.set(e,t),this.size=n.size,this};function Ph(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Dh;++t<n;)this.add(e[t])}function Lh(e,t){for(var n=-1,a=null==e?0:e.length;++n<a;)if(t(e[n],n,e))return!0;return!1}function Nh(e,t){return e.has(t)}Ph.prototype.add=Ph.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Ph.prototype.has=function(e){return this.__data__.has(e)};var Fh=1,Vh=2;function Hh(e,t,n,a,i,r){var o=n&Fh,s=e.length,c=t.length;if(s!=c&&!(o&&c>s))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<s;){var m=e[u],g=t[u];if(a)var f=o?a(g,m,u,t,e,r):a(m,g,u,e,t,r);if(void 0!==f){if(f)continue;h=!1;break}if(p){if(!Lh(t,(function(e,t){if(!Nh(p,t)&&(m===e||i(m,e,n,a,r)))return p.push(t)}))){h=!1;break}}else if(m!==g&&!i(m,g,n,a,r)){h=!1;break}}return r.delete(e),r.delete(t),h}var Bh=Ju.Uint8Array;function qh(e){var t=-1,n=Array(e.size);return e.forEach((function(e,a){n[++t]=[a,e]})),n}function Uh(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}var Wh=1,Zh=2,Qh="[object Boolean]",Gh="[object Date]",Yh="[object Error]",Kh="[object Map]",Xh="[object Number]",Jh="[object RegExp]",ep="[object Set]",tp="[object String]",np="[object Symbol]",ap="[object ArrayBuffer]",ip="[object DataView]",rp=eh?eh.prototype:void 0,op=rp?rp.valueOf:void 0;function sp(e,t){for(var n=-1,a=t.length,i=e.length;++n<a;)e[i+n]=t[n];return e}var cp=Array.isArray;function lp(e,t,n){var a=t(e);return cp(e)?a:sp(a,n(e))}function dp(){return[]}var up=Object.prototype.propertyIsEnumerable,hp=Object.getOwnPropertySymbols,pp=hp?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var n=-1,a=null==e?0:e.length,i=0,r=[];++n<a;){var o=e[n];t(o,n,e)&&(r[i++]=o)}return r}(hp(e),(function(t){return up.call(e,t)})))}:dp;function mp(e){return null!=e&&"object"==typeof e}function gp(e){return mp(e)&&"[object Arguments]"==lh(e)}var fp=Object.prototype,_p=fp.hasOwnProperty,yp=fp.propertyIsEnumerable,vp=gp(function(){return arguments}())?gp:function(e){return mp(e)&&_p.call(e,"callee")&&!yp.call(e,"callee")};var bp="object"==typeof exports&&exports&&!exports.nodeType&&exports,wp=bp&&"object"==typeof module&&module&&!module.nodeType&&module,xp=wp&&wp.exports===bp?Ju.Buffer:void 0,Cp=(xp?xp.isBuffer:void 0)||function(){return!1},Mp=9007199254740991,kp=/^(?:0|[1-9]\d*)$/;function Sp(e,t){var n=typeof e;return!!(t=null==t?Mp:t)&&("number"==n||"symbol"!=n&&kp.test(e))&&e>-1&&e%1==0&&e<t}var Ep=9007199254740991;function $p(e){return"number"==typeof e&&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);++n<e;)a[n]=t(n);return a}(e.length,String):[],c=s.length;for(var l in e)!t&&!Lp.call(e,l)||o&&("length"==l||i&&("offset"==l||"parent"==l)||r&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||Sp(l,c))||s.push(l);return s}var Fp=Object.prototype;function Vp(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Fp)}function Hp(e,t){return function(n){return e(t(n))}}var Bp=Hp(Object.keys,Object),qp=Object.prototype.hasOwnProperty;function Up(e){return null!=e&&$p(e.length)&&!gh(e)}function Wp(e){return Up(e)?Np(e):function(e){if(!Vp(e))return Bp(e);var t=[];for(var n in Object(e))qp.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)}function Zp(e){return lp(e,Wp,pp)}var Qp=1,Gp=Object.prototype.hasOwnProperty;var Yp=$h(Ju,"DataView"),Kp=$h(Ju,"Promise"),Xp=$h(Ju,"Set"),Jp=$h(Ju,"WeakMap"),em="[object Map]",tm="[object Promise]",nm="[object Set]",am="[object WeakMap]",im="[object DataView]",rm=bh(Yp),om=bh(Ah),sm=bh(Kp),cm=bh(Xp),lm=bh(Jp),dm=lh;(Yp&&dm(new Yp(new ArrayBuffer(1)))!=im||Ah&&dm(new Ah)!=em||Kp&&dm(Kp.resolve())!=tm||Xp&&dm(new Xp)!=nm||Jp&&dm(new Jp)!=am)&&(dm=function(e){var t=lh(e),n="[object Object]"==t?e.constructor:void 0,a=n?bh(n):"";if(a)switch(a){case rm:return im;case om:return em;case sm:return tm;case cm:return nm;case lm:return am}return t});var um=dm,hm=1,pm="[object Arguments]",mm="[object Array]",gm="[object Object]",fm=Object.prototype.hasOwnProperty;function _m(e,t,n,a,i,r){var o=cp(e),s=cp(t),c=o?mm:um(e),l=s?mm:um(t),d=(c=c==pm?gm:c)==gm,u=(l=l==pm?gm:l)==gm,h=c==l;if(h&&Cp(e)){if(!Cp(t))return!1;o=!0,d=!1}if(h&&!d)return r||(r=new Rh),o||Pp(e)?Hh(e,t,n,a,i,r):function(e,t,n,a,i,r,o){switch(n){case ip:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case ap:return!(e.byteLength!=t.byteLength||!r(new Bh(e),new Bh(t)));case Qh:case Gh:case Xh:return Zu(+e,+t);case Yh:return e.name==t.name&&e.message==t.message;case Jh:case tp:return e==t+"";case Kh:var s=qh;case ep:var c=a&Wh;if(s||(s=Uh),e.size!=t.size&&!c)return!1;var l=o.get(e);if(l)return l==t;a|=Zh,o.set(e,t);var d=Hh(s(e),s(t),a,i,r,o);return o.delete(e),d;case np:if(op)return op.call(e)==op.call(t)}return!1}(e,t,c,n,a,i,r);if(!(n&hm)){var p=d&&fm.call(e,"__wrapped__"),m=u&&fm.call(t,"__wrapped__");if(p||m){var g=p?e.value():e,f=m?t.value():t;return r||(r=new Rh),i(g,f,n,a,r)}}return!!h&&(r||(r=new Rh),function(e,t,n,a,i,r){var o=n&Qp,s=Zp(e),c=s.length;if(c!=Zp(t).length&&!o)return!1;for(var l=c;l--;){var d=s[l];if(!(o?d in t:Gp.call(t,d)))return!1}var u=r.get(e),h=r.get(t);if(u&&h)return u==t&&h==e;var p=!0;r.set(e,t),r.set(t,e);for(var m=o;++l<c;){var g=e[d=s[l]],f=t[d];if(a)var _=o?a(f,g,d,t,e,r):a(g,f,d,e,t,r);if(!(void 0===_?g===f||i(g,f,n,a,r):_)){p=!1;break}m||(m="constructor"==d)}if(p&&!m){var y=e.constructor,v=t.constructor;y==v||!("constructor"in e)||!("constructor"in t)||"function"==typeof y&&y instanceof y&&"function"==typeof v&&v instanceof v||(p=!1)}return r.delete(e),r.delete(t),p}(e,t,n,a,i,r))}function ym(e,t,n,a,i){return e===t||(null==e||null==t||!mp(e)&&!mp(t)?e!=e&&t!=t:_m(e,t,n,a,ym,i))}var vm=function(){try{var e=$h(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),bm=vm;function wm(e,t,n){"__proto__"==t&&bm?bm(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function xm(e,t,n){(void 0!==n&&!Zu(e[t],n)||void 0===n&&!(t in e))&&wm(e,t,n)}var Cm,Mm=function(e,t,n){for(var a=-1,i=Object(e),r=n(e),o=r.length;o--;){var s=r[Cm?o:++a];if(!1===t(i[s],s,i))break}return e},km="object"==typeof exports&&exports&&!exports.nodeType&&exports,Sm=km&&"object"==typeof module&&module&&!module.nodeType&&module,Em=Sm&&Sm.exports===km?Ju.Buffer:void 0,$m=Em?Em.allocUnsafe:void 0;function Am(e,t){if(t)return e.slice();var n=e.length,a=$m?$m(n):new e.constructor(n);return e.copy(a),a}function Im(e){var t=new e.constructor(e.byteLength);return new Bh(t).set(new Bh(e)),t}function zm(e,t){var n=t?Im(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Tm(e,t){var n=-1,a=e.length;for(t||(t=Array(a));++n<a;)t[n]=e[n];return t}var jm=Object.create,Om=function(){function e(){}return function(t){if(!dh(t))return{};if(jm)return jm(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}(),Dm=Hp(Object.getPrototypeOf,Object);function Rm(e){return"function"!=typeof e.constructor||Vp(e)?{}:Om(Dm(e))}var Pm="[object Object]",Lm=Function.prototype,Nm=Object.prototype,Fm=Lm.toString,Vm=Nm.hasOwnProperty,Hm=Fm.call(Object);function Bm(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var qm=Object.prototype.hasOwnProperty;function Um(e,t,n){var a=e[t];qm.call(e,t)&&Zu(a,n)&&(void 0!==n||t in e)||wm(e,t,n)}function Wm(e,t,n,a){var i=!n;n||(n={});for(var r=-1,o=t.length;++r<o;){var s=t[r],c=a?a(n[s],e[s],s,n,e):void 0;void 0===c&&(c=e[s]),i?wm(n,s,c):Um(n,s,c)}return n}var Zm=Object.prototype.hasOwnProperty;function Qm(e){if(!dh(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=Vp(e),n=[];for(var a in e)("constructor"!=a||!t&&Zm.call(e,a))&&n.push(a);return n}function Gm(e){return Up(e)?Np(e,!0):Qm(e)}function Ym(e,t,n,a,i,r,o){var s=Bm(e,n),c=Bm(t,n),l=o.get(c);if(l)xm(e,n,l);else{var d,u=r?r(s,c,n+"",e,t,o):void 0,h=void 0===u;if(h){var p=cp(c),m=!p&&Cp(c),g=!p&&!m&&Pp(c);u=c,p||m||g?cp(s)?u=s:mp(d=s)&&Up(d)?u=Tm(s):m?(h=!1,u=Am(c,!0)):g?(h=!1,u=zm(c,!0)):u=[]:function(e){if(!mp(e)||lh(e)!=Pm)return!1;var t=Dm(e);if(null===t)return!0;var n=Vm.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Fm.call(n)==Hm}(c)||vp(c)?(u=s,vp(s)?u=function(e){return Wm(e,Gm(e))}(s):dh(s)&&!gh(s)||(u=Rm(c))):h=!1}h&&(o.set(c,u),i(u,c,a,r,o),o.delete(c)),xm(e,n,u)}}function Km(e,t,n,a,i){e!==t&&Mm(t,(function(r,o){if(i||(i=new Rh),dh(r))Ym(e,t,o,n,Km,a,i);else{var s=a?a(Bm(e,o),r,o+"",e,t,i):void 0;void 0===s&&(s=r),xm(e,o,s)}}),Gm)}function Xm(e){return e}var Jm=Math.max;var eg=bm?function(e,t){return bm(e,"toString",{configurable:!0,enumerable:!1,value:(n=t,function(){return n}),writable:!0});var n}:Xm,tg=eg,ng=Date.now;var ag,ig,rg,og=(ag=tg,ig=0,rg=0,function(){var e=ng(),t=16-(e-rg);if(rg=e,t>0){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);++i<r;)o[i]=a[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=a[i];return s[t]=n(o),function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}(e,this,s)}}(e,t,Xm),e+"")}function cg(e,t,n){if(!dh(n))return!1;var a=typeof t;return!!("number"==a?Up(n)&&Sp(t,n.length):"string"==a&&t in n)&&Zu(n[t],e)}function lg(e){return sg((function(t,n){var a=-1,i=n.length,r=i>1?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<i;){var s=n[a];s&&e(t,s,a,r)}return t}))}var dg=lg((function(e,t,n,a){Km(e,t,n,a)})),ug=/\s/;var hg=/^\s+/;function pg(e){return e?e.slice(0,function(e){for(var t=e.length;t--&&ug.test(e.charAt(t)););return t}(e)+1).replace(hg,""):e}var mg="[object Symbol]";function gg(e){return"symbol"==typeof e||mp(e)&&lh(e)==mg}var fg=NaN,_g=/^[-+]0x[0-9a-f]+$/i,yg=/^0b[01]+$/i,vg=/^0o[0-7]+$/i,bg=parseInt;function wg(e){if("number"==typeof e)return e;if(gg(e))return fg;if(dh(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=dh(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=pg(e);var n=yg.test(e);return n||vg.test(e)?bg(e.slice(2),n?2:8):_g.test(e)?fg:+e}var xg=1/0,Cg=17976931348623157e292;function Mg(e){var t=function(e){return e?(e=wg(e))===xg||e===-xg?(e<0?-1:1)*Cg:e==e?e:0:0===e?e:0}(e),n=t%1;return t==t?n?t-n:t:0}function kg(e,t){for(var n=-1,a=null==e?0:e.length,i=Array(a);++n<a;)i[n]=t(e[n],n,e);return i}var Sg=1/0,Eg=eh?eh.prototype:void 0,$g=Eg?Eg.toString:void 0;function Ag(e){if("string"==typeof e)return e;if(cp(e))return kg(e,Ag)+"";if(gg(e))return $g?$g.call(e):"";var t=e+"";return"0"==t&&1/e==-Sg?"-0":t}function Ig(e){return null==e?"":Ag(e)}var zg=Ju.isFinite,Tg=Math.min;var jg=function(e){var t=Math[e];return function(e,n){if(e=wg(e),(n=null==n?0:Tg(Mg(n),292))&&zg(e)){var a=(Ig(e)+"e").split("e");return+((a=(Ig(t(a[0]+"e"+(+a[1]+n)))+"e").split("e"))[0]+"e"+(+a[1]-n))}return t(e)}}("round"),Og=jg;function Dg(e){return e!=e}function Rg(e,t){return!!(null==e?0:e.length)&&function(e,t,n){return t==t?function(e,t,n){for(var a=n-1,i=e.length;++a<i;)if(e[a]===t)return a;return-1}(e,t,n):function(e,t,n,a){for(var i=e.length,r=n+(a?1:-1);a?r--:++r<i;)if(t(e[r],r,e))return r;return-1}(e,Dg,n)}(e,t,0)>-1}function Pg(e,t,n){for(var a=-1,i=null==e?0:e.length;++a<i;)if(n(t,e[a]))return!0;return!1}var Lg=Xp&&1/Uh(new Xp([,-0]))[1]==1/0?function(e){return new Xp(e)}:function(){},Ng=200;function Fg(e,t,n){var a=-1,i=Rg,r=e.length,o=!0,s=[],c=s;if(n)o=!1,i=Pg;else if(r>=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(;++a<r;){var d=e[a],u=t?t(d):d;if(d=n||0!==d?d:0,o&&u==u){for(var h=c.length;h--;)if(c[h]===u)continue e;t&&c.push(u),s.push(d)}else i(c,u,n)||(c!==s&&c.push(u),s.push(d))}return s}function Vg(e,t,n){e.dispatchEvent(new CustomEvent(`frigate-card:${t}`,{bubbles:!0,composed:!0,detail:n}))}function Hg(e){if(!e)return;return e.split(/[_\s]+/).map((e=>e[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;++n<a&&!1!==t(e[n],n,e););}(m||e,(function(a,i){m&&(a=e[i=a]),Um(o,i,c_(a,t,n,i,e,r))})),o}s_[a_]=s_["[object Array]"]=s_["[object ArrayBuffer]"]=s_["[object DataView]"]=s_["[object Boolean]"]=s_["[object Date]"]=s_["[object Float32Array]"]=s_["[object Float64Array]"]=s_["[object Int8Array]"]=s_["[object Int16Array]"]=s_["[object Int32Array]"]=s_["[object Map]"]=s_["[object Number]"]=s_[o_]=s_["[object RegExp]"]=s_["[object Set]"]=s_["[object String]"]=s_["[object Symbol]"]=s_["[object Uint8Array]"]=s_["[object Uint8ClampedArray]"]=s_["[object Uint16Array]"]=s_["[object Uint32Array]"]=!0,s_["[object Error]"]=s_[i_]=s_["[object WeakMap]"]=!1;function l_(e){return c_(e,5)}var d_="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function u_(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var h_={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,n="~";function a(){}function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function r(e,t,a,r,o){if("function"!=typeof a)throw new TypeError("The listener must be a function");var s=new i(a,r||e,o),c=n?n+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function o(e,t){0==--e._eventsCount?e._events=new a:delete e._events[t]}function s(){this._events=new a,this._eventsCount=0}Object.create&&(a.prototype=Object.create(null),(new a).__proto__||(n=!1)),s.prototype.eventNames=function(){var e,a,i=[];if(0===this._eventsCount)return i;for(a in e=this._events)t.call(e,a)&&i.push(n?a.slice(1):a);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},s.prototype.listeners=function(e){var t=n?n+e:e,a=this._events[t];if(!a)return[];if(a.fn)return[a.fn];for(var i=0,r=a.length,o=new Array(r);i<r;i++)o[i]=a[i].fn;return o},s.prototype.listenerCount=function(e){var t=n?n+e:e,a=this._events[t];return a?a.fn?1:a.length:0},s.prototype.emit=function(e,t,a,i,r,o){var s=n?n+e:e;if(!this._events[s])return!1;var c,l,d=this._events[s],u=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),u){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,a),!0;case 4:return d.fn.call(d.context,t,a,i),!0;case 5:return d.fn.call(d.context,t,a,i,r),!0;case 6:return d.fn.call(d.context,t,a,i,r,o),!0}for(l=1,c=new Array(u-1);l<u;l++)c[l-1]=arguments[l];d.fn.apply(d.context,c)}else{var h,p=d.length;for(l=0;l<p;l++)switch(d[l].once&&this.removeListener(e,d[l].fn,void 0,!0),u){case 1:d[l].fn.call(d[l].context);break;case 2:d[l].fn.call(d[l].context,t);break;case 3:d[l].fn.call(d[l].context,t,a);break;case 4:d[l].fn.call(d[l].context,t,a,i);break;default:if(!c)for(h=1,c=new Array(u-1);h<u;h++)c[h-1]=arguments[h];d[l].fn.apply(d[l].context,c)}}return!0},s.prototype.on=function(e,t,n){return r(this,e,t,n,!1)},s.prototype.once=function(e,t,n){return r(this,e,t,n,!0)},s.prototype.removeListener=function(e,t,a,i){var r=n?n+e:e;if(!this._events[r])return this;if(!t)return o(this,r),this;var s=this._events[r];if(s.fn)s.fn!==t||i&&!s.once||a&&s.context!==a||o(this,r);else{for(var c=0,l=[],d=s.length;c<d;c++)(s[c].fn!==t||i&&!s[c].once||a&&s[c].context!==a)&&l.push(s[c]);l.length?this._events[r]=1===l.length?l[0]:l:o(this,r)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&o(this,t)):(this._events=new a,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,e.exports=s}(h_);var p_=u_(h_.exports);class m_ extends Error{constructor(e){super(e),this.name="TimeoutError"}}class g_ extends Error{constructor(e){super(),this.name="AbortError",this.message=e}}const f_=e=>void 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.#i}get#g(){return this.#d<this.#u}#f(){this.#d--,this.#_(),this.emit("next")}#y(){this.#v(),this.#b(),this.#c=void 0}get#w(){const e=Date.now();if(void 0===this.#s){const t=this.#o-e;if(!(t<0))return void 0===this.#c&&(this.#c=setTimeout((()=>{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.size<e||await this.#M("next",(()=>this.#e.size<e))}async onIdle(){0===this.#d&&0===this.#e.size||await this.#M("idle")}async#M(e,t){return new Promise((n=>{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);++a<i;)r[a]=e[a+t];return r}var Q_=Math.ceil,G_=Math.max;var Y_=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,K_=/^\w*$/;function X_(e,t){if(cp(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!gg(e))||(K_.test(e)||!Y_.test(e)||null!=t&&e in Object(t))}var J_="Expected a function";function ey(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(J_);var n=function(){var a=arguments,i=t?t.apply(this,a):a[0],r=n.cache;if(r.has(i))return r.get(i);var o=e.apply(this,a);return n.cache=r.set(i,o)||r,o};return n.cache=new(ey.Cache||Dh),n}ey.Cache=Dh;var ty=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ny=/\\(\\)?/g,ay=function(e){var t=ey(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(ty,(function(e,n,a,i){t.push(a?i.replace(ny,"$1"):n||e)})),t})),iy=ay;function ry(e,t){return cp(e)?e:X_(e,t)?[e]:iy(Ig(e))}var oy=1/0;function sy(e){if("string"==typeof e||gg(e))return e;var t=e+"";return"0"==t&&1/e==-oy?"-0":t}function cy(e,t){for(var n=0,a=(t=ry(t,e)).length;null!=e&&n<a;)e=e[sy(t[n++])];return n&&n==a?e:void 0}var ly=1,dy=2;function uy(e){return e==e&&!dh(e)}function hy(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}function py(e){var t=function(e){for(var t=Wp(e),n=t.length;n--;){var a=t[n],i=e[a];t[n]=[a,i,uy(i)]}return t}(e);return 1==t.length&&t[0][2]?hy(t[0][0],t[0][1]):function(n){return n===e||function(e,t,n,a){var i=n.length,r=i,o=!a;if(null==e)return!r;for(e=Object(e);i--;){var s=n[i];if(o&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++i<r;){var c=(s=n[i])[0],l=e[c],d=s[1];if(o&&s[2]){if(void 0===l&&!(c in e))return!1}else{var u=new Rh;if(a)var h=a(l,d,c,e,t,u);if(!(void 0===h?ym(d,l,ly|dy,a,u):h))return!1}}return!0}(n,e,t)}}function my(e,t,n){var a=null==e?void 0:cy(e,t);return void 0===a?n:a}function gy(e,t){return null!=e&&t in Object(e)}function fy(e,t){return null!=e&&function(e,t,n){for(var a=-1,i=(t=ry(t,e)).length,r=!1;++a<i;){var o=sy(t[a]);if(!(r=null!=e&&n(e,o)))break;e=e[o]}return r||++a!=i?r:!!(i=null==e?0:e.length)&&$p(i)&&Sp(o,i)&&(cp(e)||vp(e))}(e,t,gy)}var _y=1,yy=2;function vy(e){return X_(e)?(t=sy(e),function(e){return null==e?void 0:e[t]}):function(e){return function(t){return cy(t,e)}}(e);var t}function by(e){return"function"==typeof e?e:null==e?Xm:"object"==typeof e?cp(e)?(t=e[0],n=e[1],X_(t)&&uy(n)?hy(sy(t),n):function(e){var a=my(e,t);return void 0===a&&a===n?fy(e,t):ym(n,a,_y|yy)}):py(e):vy(e);var t,n}var wy=function(e,t){return function(n,a){if(null==n)return n;if(!Up(n))return e(n,a);for(var i=n.length,r=t?i:-1,o=Object(n);(t?r--:++r<i)&&!1!==a(o[r],r,o););return n}}((function(e,t){return e&&Mm(e,t,Wp)})),xy=wy;function Cy(e,t){if(e!==t){var n=void 0!==e,a=null===e,i=e==e,r=gg(e),o=void 0!==t,s=null===t,c=t==t,l=gg(t);if(!s&&!l&&!r&&e>t||r&&o&&c&&!s&&!l||a&&o&&c||!n&&c||!i)return 1;if(!a&&!r&&!l&&e<t||l&&n&&i&&!a&&!r||s&&n&&i||!o&&i||!c)return-1}return 0}function My(e,t,n){t=t.length?kg(t,(function(e){return cp(e)?function(t){return cy(t,1===e.length?e[0]:e)}:e})):[Xm];var a=-1;t=kg(t,Ip(by));var i=function(e,t){var n=-1,a=Up(e)?Array(e.length):[];return xy(e,(function(e,i,r){a[++n]=t(e,i,r)})),a}(e,(function(e,n,i){return{criteria:kg(t,(function(t){return t(e)})),index:++a,value:e}}));return function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}(i,(function(e,t){return function(e,t,n){for(var a=-1,i=e.criteria,r=t.criteria,o=i.length,s=n.length;++a<o;){var c=Cy(i[a],r[a]);if(c)return a>=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));i<a;)o[r++]=Z_(e,i,i+=t);return o}(t.targets,t.concurrency??1/0)){const r=await Jg(i,(async a=>await 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=[];++n<a;){var o=e[n],s=t?t(o):o;if(!n||!Zu(s,c)){var c=s;r[i++]=0===o?0:o}}return r}(e,by(t)):[]}class Dy{constructor(e){this._ranges=e??[]}hasCoverage(e){return this._ranges.some((t=>Py(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=>t<n.expires&&Py(n,e)))}add(e){this._ranges.push(e),this._expireOldRanges()}_expireOldRanges(){const e=new Date;this._ranges=this._ranges.filter((t=>e<t.expires))}clear(){this._ranges=[]}}const Py=(e,t)=>t.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<t.expires))}}class Vy extends Fy{}class Hy{constructor(e,t){this._ranges=new Dy,this._data=[],this._timeFunc=e,this._idFunc=t}add(e,t){this._ranges.add(e),this._data=Oy(ky(this._data.concat(t),this._timeFunc,"asc"),this._idFunc)}hasCoverage(e){return this._ranges.hasCoverage(e)}get(e){if(!this.hasCoverage(e))return null;const t=[];for(const n of this._data){const a=this._timeFunc(n);if(a>=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&&t<n||"latest"===e&&t>n)&&(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})<n)return!1}}return!0}async getMediaSeekTime(e,t){const n=e.getStartTime(),a=e.getEndTime(),i=this._store.getEngineForMedia(e),r=this._api.getHASSManager().getHASS();return!r||!i||!n||!a||t<n||t>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;++a<i;){var r=t(e[a]);void 0!==r&&(n=void 0===n?r:n+r)}return n}(l,Xm):0;var l;return V_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card CameraManager request [Input queries:",n.length,", Cached output queries:",c,", Total output queries:",a.size,", Duration:",((new Date).getTime()-i.getTime())/1e3+"s,",", Queries:",n,", Results:",a,", Options:",t??{},"]"),a}_convertQueryResultsToMedia(e){const t=[],n=this._api.getHASSManager().getHASS();if(!n)return t;for(const[a,i]of e.entries()){const e=this._store.getEngineOfType(i.engine);if(e){let r=null;
/* istanbul ignore else: the else path cannot be reached -- @preserve */Jy.isEventQuery(a)&&ev.isEventQueryResult(i)?r=e.generateMediaFromEvents(n,this._store,a,i):Jy.isRecordingQuery(a)&&ev.isRecordingQueryResult(i)&&(r=e.generateMediaFromRecordings(n,this._store,a,i)),r&&t.push(...r)}}return Xy(t)}getCameraEndpoints(e,t){const n=this._store.getCameraConfig(e),a=this._store.getEngineForCameraID(e);return n&&a?a.getCameraEndpoints(n,t):null}getCameraMetadata(e){const t=this._store.getCameraConfig(e),n=this._store.getEngineForCameraID(e),a=this._api.getHASSManager().getHASS();return t&&n&&a?n.getCameraMetadata(a,t):null}getCameraCapabilities(e){return this._store.getCamera(e)?.getCapabilities()??null}getAggregateCameraCapabilities(e){const t=[...e??this._store.getCameraIDs()].map((e=>this._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<r;){var c=sy(t[i]),l=n;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(i!=o){var d=s[c];void 0===(l=a?a(d,c,s):void 0)&&(l=dh(d)?d:Sp(t[i+1])?[]:{})}Um(s,c,l),s=s[c]}return e}(e,t,n)}function Gb(e,t){return null==(e=function(e,t){return t.length<2?e:cy(e,Z_(t,0,-1))}(e,t=ry(t,e)))||delete e[sy((n=t,a=null==n?0:n.length,a?n[a-1]:void 0))];var n,a}const Yb=(e,t,n)=>{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<mw.length;n++)t=mw[n](e)||t;return t},nw=function(e){return tw(Jb(e))},aw=function(e,t,n){return function(a){return((e,t,n,a)=>{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)<e.below);case"user":return!!n.user&&e.users.includes(n.user.id);case"media_loaded":return void 0!==n.media_loaded&&e.media_loaded===n.media_loaded;case"screen":return window.matchMedia(e.media_query).matches;case"display_mode":return!!n.displayMode&&e.display_mode===n.displayMode;case"triggered":return e.triggered.some((e=>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&&n<t)&&(this._message=e,this._api.getMediaLoadedInfoManager().clear(),this._api.getCardElementManager().scrollReset(),this._api.getCardElementManager().update(),!0)}}class ax{constructor(e){this._timer=new bf,this._listeners=[],this._mute=!0,this._api=e}initialize(){this._setConditionState()}shouldConnectOnInitialization(){return!!this._api.getConfigManager().getConfig()?.live.microphone?.always_connected&&this.isSupported()}isSupported(){return!!navigator.mediaDevices?.getUserMedia}async connect(){if(!this.isSupported())return!1;try{this._stream=await navigator.mediaDevices.getUserMedia({audio:!0,video:!1})}catch(e){return Zg(e),this._stream=null,this._api.getCardElementManager().update(),!1}return this._setMute(),this._setConditionState(),!0}disconnect(){this._stream?.getTracks().forEach((e=>e.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([.:](?<cardID>\w+))?[.:](?<action>\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&&e<this._results.length)&&(this._selectedIndex=e)}selectResultIfFound(e){for(const[t,n]of this._results.entries())if(e(n)){this.selectIndex(t);break}}selectBestResult(e){const t=e(this._results);null!==t&&this.selectIndex(t)}}class Mx{constructor(e){this._resultsTimestamp=null,this._cameras=new Map,this._resultsTimestamp=new Date,this._main=new Cx(e),this._buildByCameraSlices(e?.selectApproach)}_buildByCameraSlices(e){const t=new Map;for(const e of this._main.getResults()){const n=e.getCameraID(),a=t.get(n)??[];a.push(e),t.set(n,a)}for(const[n,a]of t.entries())this._cameras.set(n,new Cx({results:a,selectApproach:e}))}clone(){const e=new Mx;e._resultsTimestamp=this._resultsTimestamp,e._main=this._main.clone();for(const[t,n]of this._cameras.entries())e._cameras.set(t,n.clone());return e}isSupersetOf(e){const t=new Set(this._main.getResults()?.map((e=>e.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;n<t;n+=1)a+=e;return a},Tx={isNothing:Ix,isObject:function(e){return"object"==typeof e&&null!==e},toArray:function(e){return Array.isArray(e)?e:Ix(e)?[]:[e]},repeat:zx,isNegativeZero:function(e){return 0===e&&Number.NEGATIVE_INFINITY===1/e},extend:function(e,t){var n,a,i,r;if(t)for(n=0,a=(r=Object.keys(t)).length;n<a;n+=1)e[i=r[n]]=t[i];return e}};function jx(e,t){var n="",a=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(n+='in "'+e.mark.name+'" '),n+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(n+="\n\n"+e.mark.snippet),a+" "+n):a}function Ox(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=jx(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||""}Ox.prototype=Object.create(Error.prototype),Ox.prototype.constructor=Ox,Ox.prototype.toString=function(e){return this.name+": "+jx(this,e)};var Dx=Ox;function Rx(e,t,n,a,i){var r="",o="",s=Math.floor(i/2)-1;return a-t>s&&(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<t;e+=1)arguments[e].forEach(a);return n}(a.compiledImplicit,a.compiledExplicit),a};var qx=Bx,Ux=new Vx("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return null!==e?e:""}}),Wx=new Vx("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return null!==e?e:[]}}),Zx=new Vx("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return null!==e?e:{}}}),Qx=new qx({explicit:[Ux,Wx,Zx]});var Gx=new Vx("tag:yaml.org,2002:null",{kind:"scalar",resolve:function(e){if(null===e)return!0;var t=e.length;return 1===t&&"~"===e||4===t&&("null"===e||"Null"===e||"NULL"===e)},construct:function(){return null},predicate:function(e){return null===e},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});var Yx=new Vx("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t=e.length;return 4===t&&("true"===e||"True"===e||"TRUE"===e)||5===t&&("false"===e||"False"===e||"FALSE"===e)},construct:function(e){return"true"===e||"True"===e||"TRUE"===e},predicate:function(e){return"[object Boolean]"===Object.prototype.toString.call(e)},represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"});function Kx(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function Xx(e){return 48<=e&&e<=55}function Jx(e){return 48<=e&&e<=57}var eC=new Vx("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n=e.length,a=0,i=!1;if(!n)return!1;if("-"!==(t=e[a])&&"+"!==t||(t=e[++a]),"0"===t){if(a+1===n)return!0;if("b"===(t=e[++a])){for(a++;a<n;a++)if("_"!==(t=e[a])){if("0"!==t&&"1"!==t)return!1;i=!0}return i&&"_"!==t}if("x"===t){for(a++;a<n;a++)if("_"!==(t=e[a])){if(!Kx(e.charCodeAt(a)))return!1;i=!0}return i&&"_"!==t}if("o"===t){for(a++;a<n;a++)if("_"!==(t=e[a])){if(!Xx(e.charCodeAt(a)))return!1;i=!0}return i&&"_"!==t}}if("_"===t)return!1;for(;a<n;a++)if("_"!==(t=e[a])){if(!Jx(e.charCodeAt(a)))return!1;i=!0}return!(!i||"_"===t)},construct:function(e){var t,n=e,a=1;if(-1!==n.indexOf("_")&&(n=n.replace(/_/g,"")),"-"!==(t=n[0])&&"+"!==t||("-"===t&&(a=-1),t=(n=n.slice(1))[0]),"0"===n)return 0;if("0"===t){if("b"===n[1])return a*parseInt(n.slice(2),2);if("x"===n[1])return a*parseInt(n.slice(2),16);if("o"===n[1])return a*parseInt(n.slice(2),8)}return a*parseInt(n,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&e%1==0&&!Tx.isNegativeZero(e)},represent:{binary:function(e){return 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;n<i;n++)if(!((t=r.indexOf(e.charAt(n)))>64)){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<i;t++)t%4==0&&t&&(s.push(o>>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<r;t++)t%3==0&&t&&(a+=o[i>>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<n;t+=1){if(a=s[t],r=!1,"[object Object]"!==pC.call(a))return!1;for(i in a)if(hC.call(a,i)){if(r)return!1;r=!0}if(!r)return!1;if(-1!==o.indexOf(i))return!1;o.push(i)}return!0},construct:function(e){return null!==e?e:[]}}),gC=Object.prototype.toString;var fC=new Vx("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,a,i,r,o=e;for(r=new Array(o.length),t=0,n=o.length;t<n;t+=1){if(a=o[t],"[object Object]"!==gC.call(a))return!1;if(1!==(i=Object.keys(a)).length)return!1;r[t]=[i[0],a[i[0]]]}return!0},construct:function(e){if(null===e)return[];var t,n,a,i,r,o=e;for(r=new Array(o.length),t=0,n=o.length;t<n;t+=1)a=o[t],i=Object.keys(a),r[t]=[i[0],a[i[0]]];return r}}),_C=Object.prototype.hasOwnProperty;var yC=new Vx("tag:yaml.org,2002:set",{kind:"mapping",resolve:function(e){if(null===e)return!0;var t,n=e;for(t in n)if(_C.call(n,t)&&null!==n[t])return!1;return!0},construct:function(e){return null!==e?e:{}}}),vC=rC.extend({implicit:[cC,lC],explicit:[uC,mC,fC,yC]}),bC=Object.prototype.hasOwnProperty,wC=1,xC=2,CC=3,MC=4,kC=1,SC=2,EC=3,$C=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,AC=/[\x85\u2028\u2029]/,IC=/[,\[\]\{\}]/,zC=/^(?:!|!!|![a-z\-]+!)$/i,TC=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function jC(e){return Object.prototype.toString.call(e)}function OC(e){return 10===e||13===e}function DC(e){return 9===e||32===e}function RC(e){return 9===e||32===e||10===e||13===e}function PC(e){return 44===e||91===e||93===e||123===e||125===e}function LC(e){var t;return 48<=e&&e<=57?e-48:97<=(t=32|e)&&t<=102?t-97+10:-1}function NC(e){return 120===e?2:117===e?4:85===e?8:0}function FC(e){return 48<=e&&e<=57?e-48:-1}function VC(e){return 48===e?"\0":97===e?"":98===e?"\b":116===e||9===e?"\t":110===e?"\n":118===e?"\v":102===e?"\f":114===e?"\r":101===e?"":32===e?" ":34===e?'"':47===e?"/":92===e?"\\":78===e?"…":95===e?" ":76===e?"\u2028":80===e?"\u2029":""}function HC(e){return e<=65535?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>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(t<n){if(s=e.input.slice(t,n),a)for(i=0,r=s.length;i<r;i+=1)9===(o=s.charCodeAt(i))||32<=o&&o<=1114111||QC(e,"expected valid JSON character");else $C.test(s)&&QC(e,"the stream contains non-printable characters");e.result+=s}}function XC(e,t,n,a){var i,r,o,s;for(Tx.isObject(n)||QC(e,"cannot merge mappings; the provided source object is unacceptable"),o=0,s=(i=Object.keys(n)).length;o<s;o+=1)r=i[o],bC.call(t,r)||(t[r]=n[r],a[r]=!0)}function JC(e,t,n,a,i,r,o,s,c){var l,d;if(Array.isArray(i))for(l=0,d=(i=Array.prototype.slice.call(i)).length;l<d;l+=1)Array.isArray(i[l])&&QC(e,"nested arrays are not supported inside keys"),"object"==typeof i&&"[object Object]"===jC(i[l])&&(i[l]="[object Object]");if("object"==typeof i&&"[object Object]"===jC(i)&&(i="[object Object]"),i=String(i),null===t&&(t={}),"tag:yaml.org,2002:merge"===a)if(Array.isArray(r))for(l=0,d=r.length;l<d;l+=1)XC(e,t,r[l],n);else XC(e,t,r,n);else e.json||bC.call(n,i)||!bC.call(t,i)||(e.line=o||e.line,e.lineStart=s||e.lineStart,e.position=c||e.position,QC(e,"duplicated mapping key")),"__proto__"===i?Object.defineProperty(t,i,{configurable:!0,enumerable:!0,writable:!0,value:r}):t[i]=r,delete n[i];return t}function eM(e){var t;10===(t=e.input.charCodeAt(e.position))?e.position++:13===t?(e.position++,10===e.input.charCodeAt(e.position)&&e.position++):QC(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function tM(e,t,n){for(var a=0,i=e.input.charCodeAt(e.position);0!==i;){for(;DC(i);)9===i&&-1===e.firstTabInLine&&(e.firstTabInLine=e.position),i=e.input.charCodeAt(++e.position);if(t&&35===i)do{i=e.input.charCodeAt(++e.position)}while(10!==i&&13!==i&&0!==i);if(!OC(i))break;for(eM(e),i=e.input.charCodeAt(e.position),a++,e.lineIndent=0;32===i;)e.lineIndent++,i=e.input.charCodeAt(++e.position)}return-1!==n&&0!==a&&e.lineIndent<n&&GC(e,"deficient indentation"),a}function nM(e){var t,n=e.position;return!(45!==(t=e.input.charCodeAt(n))&&46!==t||t!==e.input.charCodeAt(n+1)||t!==e.input.charCodeAt(n+2)||(n+=3,0!==(t=e.input.charCodeAt(n))&&!RC(t)))}function aM(e,t){1===t?e.result+=" ":t>1&&(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.lineIndent<t)break;return!!s&&(e.tag=i,e.anchor=r,e.kind="sequence",e.result=o,!0)}function rM(e){var t,n,a,i,r=!1,o=!1;if(33!==(i=e.input.charCodeAt(e.position)))return!1;if(null!==e.tag&&QC(e,"duplication of a tag property"),60===(i=e.input.charCodeAt(++e.position))?(r=!0,i=e.input.charCodeAt(++e.position)):33===i?(o=!0,n="!!",i=e.input.charCodeAt(++e.position)):n="!",t=e.position,r){do{i=e.input.charCodeAt(++e.position)}while(0!==i&&62!==i);e.position<e.length?(a=e.input.slice(t,e.position),i=e.input.charCodeAt(++e.position)):QC(e,"unexpected end of the stream within a verbatim tag")}else{for(;0!==i&&!RC(i);)33===i&&(o?QC(e,"tag suffix cannot contain exclamation marks"):(n=e.input.slice(t-1,e.position+1),zC.test(n)||QC(e,"named tag handle cannot contain such characters"),o=!0,t=e.position+1)),i=e.input.charCodeAt(++e.position);a=e.input.slice(t,e.position),IC.test(a)&&QC(e,"tag suffix cannot contain flow indicator characters")}a&&!TC.test(a)&&QC(e,"tag name cannot contain such characters: "+a);try{a=decodeURIComponent(a)}catch(t){QC(e,"tag name is malformed: "+a)}return r?e.tag=a:bC.call(e.tagMap,n)?e.tag=e.tagMap[n]+a:"!"===n?e.tag="!"+a:"!!"===n?e.tag="tag:yaml.org,2002:"+a:QC(e,'undeclared tag handle "'+n+'"'),!0}function oM(e){var t,n;if(38!==(n=e.input.charCodeAt(e.position)))return!1;for(null!==e.anchor&&QC(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),t=e.position;0!==n&&!RC(n)&&!PC(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&QC(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function sM(e,t,n,a,i){var r,o,s,c,l,d,u,h,p,m=1,g=!1,f=!1;if(null!==e.listener&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,r=o=s=MC===n||CC===n,a&&tM(e,!0,-1)&&(g=!0,e.lineIndent>t?m=1:e.lineIndent===t?m=0:e.lineIndent<t&&(m=-1)),1===m)for(;rM(e)||oM(e);)tM(e,!0,-1)?(g=!0,s=r,e.lineIndent>t?m=1:e.lineIndent===t?m=0:e.lineIndent<t&&(m=-1)):s=!1;if(s&&(s=g||i),1!==m&&MC!==n||(h=wC===n||xC===n?t:t+1,p=e.position-e.lineStart,1===m?s&&(iM(e,p)||function(e,t,n){var a,i,r,o,s,c,l,d=e.tag,u=e.anchor,h={},p=Object.create(null),m=null,g=null,f=null,_=!1,y=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=h),l=e.input.charCodeAt(e.position);0!==l;){if(_||-1===e.firstTabInLine||(e.position=e.firstTabInLine,QC(e,"tab characters must not be used in indentation")),a=e.input.charCodeAt(e.position+1),r=e.line,63!==l&&58!==l||!RC(a)){if(o=e.line,s=e.lineStart,c=e.position,!sM(e,n,xC,!1,!0))break;if(e.line===r){for(l=e.input.charCodeAt(e.position);DC(l);)l=e.input.charCodeAt(++e.position);if(58===l)RC(l=e.input.charCodeAt(++e.position))||QC(e,"a whitespace character is expected after the key-value separator within a block mapping"),_&&(JC(e,h,p,m,g,null,o,s,c),m=g=f=null),y=!0,_=!1,i=!1,m=e.tag,g=e.result;else{if(!y)return e.tag=d,e.anchor=u,!0;QC(e,"can not read an implicit mapping pair; a colon is missed")}}else{if(!y)return e.tag=d,e.anchor=u,!0;QC(e,"can not read a block mapping entry; a multiline key may not be an implicit key")}}else 63===l?(_&&(JC(e,h,p,m,g,null,o,s,c),m=g=f=null),y=!0,_=!0,i=!0):_?(_=!1,i=!0):QC(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,l=a;if((e.line===r||e.lineIndent>t)&&(_&&(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<t)break}return _&&JC(e,h,p,m,g,null,o,s,c),y&&(e.tag=d,e.anchor=u,e.kind="mapping",e.result=h),y}(e,p,h))||function(e,t){var n,a,i,r,o,s,c,l,d,u,h,p,m=!0,g=e.tag,f=e.anchor,_=Object.create(null);if(91===(p=e.input.charCodeAt(e.position)))o=93,l=!1,r=[];else{if(123!==p)return!1;o=125,l=!0,r={}}for(null!==e.anchor&&(e.anchorMap[e.anchor]=r),p=e.input.charCodeAt(++e.position);0!==p;){if(tM(e,!0,t),(p=e.input.charCodeAt(e.position))===o)return e.position++,e.tag=g,e.anchor=f,e.kind=l?"mapping":"sequence",e.result=r,!0;m?44===p&&QC(e,"expected the node content, but found ','"):QC(e,"missed comma between flow collection entries"),h=null,s=c=!1,63===p&&RC(e.input.charCodeAt(e.position+1))&&(s=c=!0,e.position++,tM(e,!0,t)),n=e.line,a=e.lineStart,i=e.position,sM(e,t,wC,!1,!0),u=e.tag,d=e.result,tM(e,!0,t),p=e.input.charCodeAt(e.position),!c&&e.line!==n||58!==p||(s=!0,p=e.input.charCodeAt(++e.position),tM(e,!0,t),sM(e,t,wC,!1,!0),h=e.result),l?JC(e,r,_,u,d,h,n,a,i):s?r.push(JC(e,null,_,u,d,h,n,a,i)):r.push(d),tM(e,!0,t),44===(p=e.input.charCodeAt(e.position))?(m=!0,p=e.input.charCodeAt(++e.position)):m=!1}QC(e,"unexpected end of the stream within a flow collection")}(e,h)?f=!0:(o&&function(e,t){var n,a,i,r,o=kC,s=!1,c=!1,l=t,d=0,u=!1;if(124===(r=e.input.charCodeAt(e.position)))a=!1;else{if(62!==r)return!1;a=!0}for(e.kind="scalar",e.result="";0!==r;)if(43===(r=e.input.charCodeAt(++e.position))||45===r)kC===o?o=43===r?EC:SC:QC(e,"repeat of a chomping mode identifier");else{if(!((i=FC(r))>=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.lineIndent<l)&&32===r;)e.lineIndent++,r=e.input.charCodeAt(++e.position);if(!c&&e.lineIndent>l&&(l=e.lineIndent),OC(r))d++;else{if(e.lineIndent<l){o===EC?e.result+=Tx.repeat("\n",s?1+d:d):o===kC&&s&&(e.result+="\n");break}for(a?DC(r)?(u=!0,e.result+=Tx.repeat("\n",s?1+d:d)):u?(u=!1,e.result+=Tx.repeat("\n",d+1)):0===d?s&&(e.result+=" "):e.result+=Tx.repeat("\n",d):e.result+=Tx.repeat("\n",s?1+d:d),s=!0,c=!0,d=0,n=e.position;!OC(r)&&0!==r;)r=e.input.charCodeAt(++e.position);KC(e,n,e.position,!1)}}return!0}(e,h)||function(e,t){var n,a,i;if(39!==(n=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,a=i=e.position;0!==(n=e.input.charCodeAt(e.position));)if(39===n){if(KC(e,a,e.position,!0),39!==(n=e.input.charCodeAt(++e.position)))return!0;a=e.position,e.position++,i=e.position}else OC(n)?(KC(e,a,i,!0),aM(e,tM(e,!1,t)),a=i=e.position):e.position===e.lineStart&&nM(e)?QC(e,"unexpected end of the document within a single quoted scalar"):(e.position++,i=e.position);QC(e,"unexpected end of the stream within a single quoted scalar")}(e,h)||function(e,t){var n,a,i,r,o,s;if(34!==(s=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,n=a=e.position;0!==(s=e.input.charCodeAt(e.position));){if(34===s)return KC(e,n,e.position,!0),e.position++,!0;if(92===s){if(KC(e,n,e.position,!0),OC(s=e.input.charCodeAt(++e.position)))tM(e,!1,t);else if(s<256&&BC[s])e.result+=qC[s],e.position++;else if((o=NC(s))>0){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<l;c+=1)if((u=e.implicitTypes[c]).resolve(e.result)){e.result=u.construct(e.result),e.tag=u.tag,null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);break}}else if("!"!==e.tag){if(bC.call(e.typeMap[e.kind||"fallback"],e.tag))u=e.typeMap[e.kind||"fallback"][e.tag];else for(u=null,c=0,l=(d=e.typeMap.multi[e.kind||"fallback"]).length;c<l;c+=1)if(e.tag.slice(0,d[c].tag.length)===d[c].tag){u=d[c];break}u||QC(e,"unknown tag !<"+e.tag+">"),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<e.length-1&&QC(e,"end of the stream or a document separator is expected")}function lM(e,t){t=t||{},0!==(e=String(e)).length&&(10!==e.charCodeAt(e.length-1)&&13!==e.charCodeAt(e.length-1)&&(e+="\n"),65279===e.charCodeAt(0)&&(e=e.slice(1)));var n=new WC(e,t),a=e.indexOf("\0");for(-1!==a&&(n.position=a,QC(n,"null byte is not allowed in input")),n.input+="\0";32===n.input.charCodeAt(n.position);)n.lineIndent+=1,n.position+=1;for(;n.position<n.length-1;)cM(n);return n.documents}var dM={loadAll:function(e,t,n){null!==t&&"object"==typeof t&&void 0===n&&(n=t,t=null);var a=lM(e,n);if("function"!=typeof t)return a;for(var i=0,r=a.length;i<r;i+=1)t(a[i])},load:function(e,t){var n=lM(e,t);if(0!==n.length){if(1===n.length)return n[0];throw new Dx("expected a single document in the stream, but found more")}}},uM=Object.prototype.toString,hM=Object.prototype.hasOwnProperty,pM=65279,mM=9,gM=10,fM=13,_M=32,yM=33,vM=34,bM=35,wM=37,xM=38,CM=39,MM=42,kM=44,SM=45,EM=58,$M=61,AM=62,IM=63,zM=64,TM=91,jM=93,OM=96,DM=123,RM=124,PM=125,LM={0:"\\0",7:"\\a",8:"\\b",9:"\\t",10:"\\n",11:"\\v",12:"\\f",13:"\\r",27:"\\e",34:'\\"',92:"\\\\",133:"\\N",160:"\\_",8232:"\\L",8233:"\\P"},NM=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],FM=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function VM(e){var t,n,a;if(t=e.toString(16).toUpperCase(),e<=255)n="x",a=2;else if(e<=65535)n="u",a=4;else{if(!(e<=4294967295))throw new Dx("code point within a string may not be greater than 0xFFFFFFFF");n="U",a=8}return"\\"+n+Tx.repeat("0",a-t.length)+t}var HM=1,BM=2;function qM(e){this.schema=e.schema||vC,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=Tx.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=function(e,t){var n,a,i,r,o,s,c;if(null===t)return{};for(n={},i=0,r=(a=Object.keys(t)).length;i<r;i+=1)o=a[i],s=String(t[o]),"!!"===o.slice(0,2)&&(o="tag:yaml.org,2002:"+o.slice(2)),(c=e.compiledTypeMap.fallback[o])&&hM.call(c.styleAliases,s)&&(s=c.styleAliases[s]),n[o]=s;return n}(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.quotingType='"'===e.quotingType?BM:HM,this.forceQuotes=e.forceQuotes||!1,this.replacer="function"==typeof e.replacer?e.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function UM(e,t){for(var n,a=Tx.repeat(" ",t),i=0,r=-1,o="",s=e.length;i<s;)-1===(r=e.indexOf("\n",i))?(n=e.slice(i),i=s):(n=e.slice(i,r+1),i=r+1),n.length&&"\n"!==n&&(o+=a),o+=n;return o}function WM(e,t){return"\n"+Tx.repeat(" ",e.indent*t)}function ZM(e){return e===_M||e===mM}function QM(e){return 32<=e&&e<=126||161<=e&&e<=55295&&8232!==e&&8233!==e||57344<=e&&e<=65533&&e!==pM||65536<=e&&e<=1114111}function GM(e){return QM(e)&&e!==pM&&e!==fM&&e!==gM}function YM(e,t,n){var a=GM(e),i=a&&!ZM(e);return(n?a:a&&e!==kM&&e!==TM&&e!==jM&&e!==DM&&e!==PM)&&e!==bM&&!(t===EM&&!i)||GM(t)&&!ZM(t)&&e===bM||t===EM&&i}function KM(e,t){var n,a=e.charCodeAt(t);return a>=55296&&a<=56319&&t+1<e.length&&(n=e.charCodeAt(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<e.length;l>=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<e.length;l>=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<a;n+=1)if(e.implicitTypes[n].resolve(t))return!0;return!1}(e,t)}),e.quotingType,e.forceQuotes&&!a,i)){case JM:return t;case ek:return"'"+t.replace(/'/g,"''")+"'";case tk:return"|"+ok(t,e.indent)+sk(UM(t,r));case nk:return">"+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<e.length;a>=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<r;i+=1)o=n[i],e.replacer&&(o=e.replacer.call(n,String(i),o)),(uk(e,t+1,o,!0,!0,!1,!0)||void 0===o&&uk(e,t+1,null,!0,!0,!1,!0))&&(a&&""===s||(s+=WM(e,t)),e.dump&&gM===e.dump.charCodeAt(0)?s+="-":s+="- ",s+=e.dump);e.tag=c,e.dump=s||"[]"}function dk(e,t,n){var a,i,r,o,s,c;for(r=0,o=(i=n?e.explicitTypes:e.implicitTypes).length;r<o;r+=1)if(((s=i[r]).instanceOf||s.predicate)&&(!s.instanceOf||"object"==typeof t&&t instanceof s.instanceOf)&&(!s.predicate||s.predicate(t))){if(n?s.multi&&s.representName?e.tag=s.representName(t):e.tag=s.tag:e.tag="?",s.represent){if(c=e.styleMap[s.tag]||s.defaultStyle,"[object Function]"===uM.call(s.represent))a=s.represent(t,c);else{if(!hM.call(s.represent,c))throw new Dx("!<"+s.tag+'> 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;i<r;i+=1)l="",a&&""===d||(l+=WM(e,t)),s=n[o=h[i]],e.replacer&&(s=e.replacer.call(n,o,s)),uk(e,t+1,o,!0,!0,!0)&&((c=null!==e.tag&&"?"!==e.tag||e.dump&&e.dump.length>1024)&&(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;a<i;a+=1)s="",""!==c&&(s+=", "),e.condenseFlow&&(s+='"'),o=n[r=d[a]],e.replacer&&(o=e.replacer.call(n,r,o)),uk(e,t,r,!1,!1)&&(e.dump.length>1024&&(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<i;a+=1)r=n[a],e.replacer&&(r=e.replacer.call(n,String(a),r)),(uk(e,t,r,!1,!1)||void 0===r&&uk(e,t,null,!1,!1))&&(""!==o&&(o+=","+(e.condenseFlow?"":" ")),o+=e.dump);e.tag=s,e.dump="["+o+"]"}(e,t,e.dump),u&&(e.dump="&ref_"+d+" "+e.dump));else{if("[object String]"!==c){if("[object Undefined]"===c)return!1;if(e.skipInvalid)return!1;throw new Dx("unacceptable kind of an object to dump "+c)}"?"!==e.tag&&rk(e,e.dump,t,r,l)}null!==e.tag&&"?"!==e.tag&&(s=encodeURI("!"===e.tag[0]?e.tag.slice(1):e.tag).replace(/!/g,"%21"),s="!"===e.tag[0]?"!"+s:"tag:yaml.org,2002:"===s.slice(0,18)?"!!"+s.slice(18):"!<"+s+">",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;n<a;n+=1)t.duplicates.push(i[r[n]]);t.usedDuplicates=new Array(a)}function pk(e,t,n){var a,i,r;if(null!==e&&"object"==typeof e)if(-1!==(i=t.indexOf(e)))-1===n.indexOf(i)&&n.push(i);else if(t.push(e),Array.isArray(e))for(i=0,r=e.length;i<r;i+=1)pk(e[i],t,n);else for(i=0,r=(a=Object.keys(e)).length;i<r;i+=1)pk(e[a[i]],t,n)}function mk(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}var gk={Type:Vx,Schema:qx,FAILSAFE_SCHEMA:Qx,JSON_SCHEMA:iC,CORE_SCHEMA:rC,DEFAULT_SCHEMA:vC,load:dM.load,loadAll:dM.loadAll,dump:{dump:function(e,t){var n=new qM(t=t||{});n.noRefs||hk(e,n);var a=e;return n.replacer&&(a=n.replacer.call({"":a},"",a)),uk(n,0,a,!0,!0)?n.dump+"\n":""}}.dump,YAMLException:Dx,types:{binary:uC,float:aC,map:Zx,null:Gx,pairs:fC,set:yC,timestamp:cC,bool:Yx,int:eC,merge:lC,omap:mC,seq:Wx,str:Ux},safeLoad:mk("safeLoad","load"),safeLoadAll:mk("safeLoadAll","loadAll"),safeDump:mk("safeDump","dump")},fk='.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: block;\n height: 100%;\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n user-select: text;\n -webkit-user-select: text;\n color: var(--primary-text-color);\n}\n\ndiv.wrapper {\n height: 100%;\n}\n\ndiv.message {\n display: flex;\n justify-content: center;\n align-items: center;\n box-sizing: border-box;\n height: 100%;\n}\n\ndiv.message.padded {\n padding: 20px;\n}\n\ndiv.message div.contents {\n display: flex;\n flex-direction: column;\n padding: 10px;\n margin-top: auto;\n margin-bottom: auto;\n min-width: 0;\n}\n\ndiv.message div.icon {\n padding: 10px;\n}\n\n.vertical {\n flex-direction: column;\n}\n\n.message a {\n color: var(--primary-text-color, white);\n word-break: break-word;\n}\n\n.message pre {\n margin-top: 20px;\n overflow-x: auto;\n border: 1px dotted var(--divider-color);\n padding: 1em;\n}';let _k=class extends se{constructor(){super(...arguments),this.message=""}render(){const e=this.icon?this.icon:"mdi:information-outline",t={dotdotdot:!!this.dotdotdot},n=e=>q`<pre>${gk.dump(e)}</pre>`;return q` <div class="wrapper">
<div class="message padded">
<div class="icon">
<ha-icon icon="${e}"> </ha-icon>
</div>
<div class="contents">
<span class="${_e(t)}">
${this.message?q`${this.message}${this.context&&"string"==typeof this.context?": "+this.context:""}`:""}
</span>
${this.context&&Array.isArray(this.context)?this.context.map((e=>n(e))):"object"==typeof this.context?n(this.context):""}
</div>
</div>
</div>`}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` <frigate-card-message
.message=${q` ${this.message.message}.
<a href="${"https://card.camera/#/troubleshooting"}"> ${N_("error.troubleshooting")}</a>.`}
.icon=${this.message.icon??"mdi:alert-circle"}
.context=${this.message.context}
.dotdotdot=${this.message.dotdotdot}
>
</frigate-card-message>`}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` <div class="message vertical">
${this.animated?q`<ha-circular-progress active="true" size="${this.size}">
</ha-circular-progress>`:q`<ha-icon icon="mdi:timer-sand"></ha-icon>`}
${this.message?q`<span>${this.message}</span>`:q``}
</div>`}static get styles(){return o(fk)}};function bk(e){return"error"===e?.type?q` <frigate-card-error-message
.message=${e}
></frigate-card-error-message>`:e?q` <frigate-card-message
.message=${e.message}
.icon=${e.icon}
.context=${e.context}
.dotdotdot=${e.dotdotdot}
></frigate-card-message>`:q``}function wk(e){return q`
<frigate-card-progress-indicator
class="${_e(e?.classes??{})}"
.size=${e?.size}
${e?.componentRef?je(e.componentRef):""}
.message=${e?.message||""}
.animated=${e?.cardWideConfig?.performance?.features.animated_progress_indicator??!0}
>
</frigate-card-progress-indicator>
`}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`<frigate-card-elements-core
.hass=${this.hass}
.conditionsManagerEpoch=${this.conditionsManagerEpoch}
.elements=${this.elements}
>
</frigate-card-elements-core>`}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` <frigate-card-elements-core
.hass=${this.hass}
.elements=${this._config?.elements}
>
</frigate-card-elements-core>`}};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` <img src="${"data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3csvg inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' sodipodi:docname='camera-iris.svg' id='svg4' version='1.1' viewBox='0 0 24 24' 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='defs8' /%3e %3csodipodi:namedview id='namedview6' pagecolor='%23b93e3e' bordercolor='black' borderopacity='0.25' inkscape:showpageshadow='2' inkscape:pageopacity='0.60784314' inkscape:pagecheckerboard='false' inkscape:deskcolor='%23d1d1d1' showgrid='false' inkscape:zoom='26.62506' inkscape:cx='-1.934268' inkscape:cy='15.680716' inkscape:window-width='3840' inkscape:window-height='1527' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='svg4' /%3e %3cg id='g1119' style='fill-opacity:0.05%3bfill:white'%3e %3ccircle style='fill:white%3bfill-opacity:0.05%3bstroke-width:1.39729' id='path170' cx='12' cy='12' inkscape:label='White Background' r='11.25' /%3e %3cpath d='M 13.730001%2c15 9.8300003%2c21.76 C 10.53%2c21.91 11.25%2c22 12%2c22 c 2.400001%2c0 4.6%2c-0.85 6.32%2c-2.25 L 14.660001%2c13.4 M 2.4600003%2c15 c 0.92%2c2.92 3.15%2c5.26 5.99%2c6.34 L 12.12%2c15 m -3.5799997%2c-3 -3.9%2c-6.7499996 c -1.64%2c1.749999 -2.64%2c4.1399993 -2.64%2c6.7499996 0%2c0.68 0.07%2c1.35 0.2%2c2 h 7.49 M 21.8%2c9.9999997 H 14.310001 L 14.600001%2c10.5 19.36%2c18.75 C 21%2c16.97 22%2c14.6 22%2c12 22%2c11.31 21.93%2c10.64 21.8%2c9.9999997 m -0.26%2c-1 C 20.62%2c6.0700005 18.39%2c3.7400002 15.550001%2c2.6600002 L 11.88%2c8.9999997 M 9.4000003%2c10.5 14.170001%2c2.2400002 c -0.7%2c-0.15 -1.420001%2c-0.24 -2.170001%2c-0.24 -2.3999997%2c0 -4.5999997%2c0.84 -6.3199997%2c2.2500003 l 3.66%2c6.3499995 z' id='path2' inkscape:label='Iris' style='fill-opacity:0.05%3bfill:white' /%3e %3c/g%3e%3c/svg%3e"}" /> `}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`
<mwc-list-item
style="${Re(t.style||{})}"
graphic=${ye(t.icon?"icon":void 0)}
?twoline=${!!e.subtitle}
?selected=${e.selected}
?activated=${e.selected}
?disabled=${!1===e.enabled}
aria-label="${t.title||""}"
@action=${t=>{t.detail.config=e}}
.actionHandler=${Cf({hasHold:yf(e.hold_action),hasDoubleClick:yf(e.double_tap_action)})}
>
<span>${t.title||""}</span>
${e.subtitle?q`<span slot="secondary">${e.subtitle}</span>`:""}
${(e=>{if(e.icon){const t=Bk(e.icon);return t?q`<img
style="${Re(e.style||{})}"
data-domain=${ye(e.data_domain)}
data-state=${ye(e.data_state)}
slot="graphic"
src=${t}
/>`:q` <ha-icon
style="${Re(e.style||{})}"
data-domain=${ye(e.data_domain)}
data-state=${ye(e.data_state)}
slot="graphic"
icon="${e.icon||""}"
>
</ha-icon>`}return q``})(t)}
</mwc-list-item>
`}render(){if(!this.submenu)return q``;const e=this.submenu.items;return q`
<ha-button-menu
corner=${"BOTTOM_LEFT"}
@closed=${e=>e.stopPropagation()}
@click=${e=>vf(e)}
>
<ha-icon-button
style="${Re(this.submenu.style||{})}"
class="button"
slot="trigger"
.label=${this.submenu.title||""}
.actionHandler=${Cf({allowPropagation:!0,hasHold:yf(this.submenu.hold_action),hasDoubleClick:yf(this.submenu.double_tap_action)})}
>
<ha-icon icon="${this.submenu.icon}"></ha-icon>
</ha-icon-button>
${e.map(this._renderItem.bind(this))}
</ha-button-menu>
`}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` <frigate-card-submenu
.hass=${this.hass}
.submenu=${this._generatedSubmenu}
></frigate-card-submenu>`}};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` <frigate-card-submenu
.hass=${this.hass}
.submenu=${e}
@action=${e=>this._controller.actionHandler(e)}
>
</frigate-card-submenu>`;if("custom:frigate-card-menu-submenu-select"===e.type)return q` <frigate-card-submenu-select
.hass=${this.hass}
.submenuSelect=${e}
.entityRegistryManager=${this.entityRegistryManager}
@action=${e=>this._controller.actionHandler(e)}
>
</frigate-card-submenu-select>`;const t=this._controller.getFreshButtonState(this.hass,e),n=Bk(t.icon);return q` <ha-icon-button
data-domain=${ye(t.data_domain)}
data-state=${ye(t.data_state)}
class="button"
style="${Re(t.style||{})}"
.actionHandler=${Cf({hasHold:yf(e.hold_action),hasDoubleClick:yf(e.double_tap_action)})}
.label=${t.title||""}
@action=${t=>this._controller.actionHandler(t,e)}
>
${n?q`<img src="${n}" />`:q`<ha-icon
icon="${t.icon||"mdi:gesture-tap-button"}"
></ha-icon>`}
</ha-icon-button>`}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` <div
class="matching"
style="${Re({flex:String(n.length)})}"
>
${n.map((e=>this._renderButton(e)))}
</div>
<div
class="opposing"
style="${Re({flex:String(a.length)})}"
>
${a.map((e=>this._renderButton(e)))}
</div>`}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`
<slot name="top"></slot>
<slot name="left"></slot>
<slot name="right"></slot>
<slot name="bottom"></slot>
`}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`
<div class="status">
${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`<div
.actionHandler=${n}
class="${t}"
@action=${t=>this._controller.actionHandler(t,e.actions)}
>
${e.string}
</div>`;if("custom:frigate-card-status-bar-icon"===e.type){const a=Bk(e.icon);return a?q`<img
.actionHandler=${n}
class="${t}"
src="${a}"
@action=${t=>this._controller.actionHandler(t,e.actions)}
/>`:q`<ha-icon
.actionHandler=${n}
class="${t}"
icon="${e.icon}"
@action=${t=>this._controller.actionHandler(t,e.actions)}
></ha-icon>`}return"custom:frigate-card-status-bar-image"===e.type?q`<img
.actionHandler=${n}
class="${t}"
src="${e.image}"
@action=${t=>this._controller.actionHandler(t,e.actions)}
/>`:void 0}))}
</div>
`}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 t<e}function i(e){return e>t}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)<k?a:f&&t?.5*a:d.byIndex(n.get(),0).distance}(b(n),t),i=function(e,t){if(0===e||0===t)return 0;if(tS(e)<=tS(t))return 0;const n=aS(tS(e),tS(t));return tS(n/e)}(n,a),o=$-10*i,s=_+i/50;j=!1,T=!1,M.clear(),l.useDuration(o).useFriction(s),c.distance(a,!m),D=!1,h.emit("pointerUp")}function L(e){O&&(e.stopPropagation(),e.preventDefault(),O=!1)}return{init:function(e){if(!y)return;function s(s){(Jk(y)||y(e,s))&&function(e){const s=uS(e,a);if(D=s,O=m&&s&&!e.buttons&&A,A=aS(i.get(),o.get())>=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)<r&&(n.set(e.constrain(n.get())),a.useDuration(25).useBaseFriction())},toggleActive:function(e){c=!e}}}function bS(e,t,n,a){const i=t.min+.1,r=t.max+.1,{reachedMin:o,reachedMax:s}=mS(i,r);const c={loop:function(t){if(!function(e){return 1===e?s(n.get()):-1===e&&o(n.get())}(t))return;const i=e*(-1*t);a.forEach((e=>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<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},jS.apply(this,arguments)}TS.globalOptions=void 0;var OS=function(e,t){return void 0===t&&(t=.996),e*t/(1-t)};function DS(e,t){if(e.length!==t.length)throw new Error("vectors must be same length");return e.map((function(e,n){return e+t[n]}))}function RS(e){return Math.max.apply(Math,e.map(Math.abs))}function PS(e){return Object.freeze(e),Object.values(e).forEach((function(e){null===e||"object"!=typeof e||Object.isFrozen(e)||PS(e)})),e}var LS=[1,18,"undefined"!=typeof window&&window.innerHeight||800];var NS=[-1,-1,-1];var FS=function(e){return jS({},e,{axisDelta:e.axisDelta.map((function(e){return t=e,n=-700,a=700,Math.min(Math.max(n,t),a);var t,n,a}))})},VS=.6,HS=.96,BS=2,qS=5,US=PS({preventWheelAction:!0,reverseSign:[!0,!0,!1]}),WS=400;function ZS(){return{isStarted:!1,isStartPublished:!1,isMomentum:!1,startTime:0,lastAbsDelta:1/0,axisMovement:[0,0,0],axisVelocity:[0,0,0],accelerationFactors:[],scrollPoints:[],scrollPointsToMerge:[],willEndTimeout:WS}}function QS(e){void 0===e&&(e={});var t,n,a,i=function(){var e={};function t(t,n){e[t]=(e[t]||[]).filter((function(e){return e!==n}))}return PS({on:function(n,a){return e[n]=(e[n]||[]).concat(a),function(){return t(n,a)}},off:t,dispatch:function(t,n){t in e&&e[t].forEach((function(e){return e(n)}))}})}(),r=i.on,o=i.off,s=i.dispatch,c=US,l=ZS(),d=!1,u=function(e){Array.isArray(e)?e.forEach((function(e){return m(e)})):m(e)},h=function(e){return void 0===e&&(e={}),Object.values(e).some((function(e){return null==e}))?c:c=PS(jS({},US,c,e))},p=function(e){var a=jS({event:t,isStart:!1,isEnding:!1,isMomentumCancel:!1,isMomentum:l.isMomentum,axisDelta:[0,0,0],axisVelocity:l.axisVelocity,axisMovement:l.axisMovement,get axisMovementProjection(){return DS(a.axisMovement,a.axisVelocity.map((function(e){return OS(e)})))}},e);s("wheel",jS({},a,{previous:n})),n=a},m=function(e){var n=FS(function(e,t){if(!t)return e;var n=!0===t?NS:t.map((function(e){return e?-1:1}));return jS({},e,{axisDelta:e.axisDelta.map((function(e,t){return e*n[t]}))})}(function(e){var t=e.deltaX*LS[e.deltaMode],n=e.deltaY*LS[e.deltaMode],a=(e.deltaZ||0)*LS[e.deltaMode];return{timeStamp:e.timeStamp,axisDelta:[t,n,a]}}(e),c.reverseSign)),a=n.axisDelta,i=n.timeStamp,r=RS(a);e.preventDefault&&function(e,t){var n=c.preventWheelAction,a=t[0],i=t[1],r=t[2];if("boolean"==typeof n)return n;switch(n){case"x":return Math.abs(a)>=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` <div class="embla">
<slot name="left"></slot>
<div ${je(this._refRoot)} class="embla__viewport">
<div class="embla__container">
<slot ${je(this._refParent)}></slot>
</div>
</div>
<slot name="right"></slot>
</div>`}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`<ha-icon
icon="mdi:image-off"
title=${N_("thumbnail.no_thumbnail")}
></ha-icon> `;return!this._embedThumbnailTask||this._thumbnailError?e:q`${this.thumbnail?xE(this._embedThumbnailTask,(e=>e?q`<img src="${e}" />`: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`<img class="background" src="${this.cameraMetadata.engineLogo}" />`:""}
<div class="content">
<div class="title">${qu(this.date,"HH:mm")}</div>
<div class="subtitle">${qu(this.date,"MMM do")}</div>
${this.showCameraTitle&&this.cameraMetadata?.title?q`<div class="camera">${this.cameraMetadata.title}</div>`:q``}
</div>
`}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` <div class="title">
<span title=${d}>${d}</span>
${t?q`<span title="${t}">${t}</span>`:""}
</div>`:""}
<div class="details">
${a?q` <div>
<ha-icon
title=${N_("event.start")}
.icon=${"mdi:calendar-clock-outline"}
></ha-icon>
<span title="${a}">${a}</span>
</div>
${r||o?q` <div>
<ha-icon
title=${N_("event.duration")}
.icon=${"mdi:clock-outline"}
></ha-icon>
${r?q`<span title="${r}">${r}</span>`:""}
${o?q`<span title="${o}">${o}</span>`:""}
</div>`:""}`:""}
${this.cameraTitle?q` <div>
<ha-icon title=${N_("event.camera")} .icon=${"mdi:cctv"}></ha-icon>
<span title="${this.cameraTitle}">${this.cameraTitle}</span>
</div>`:""}
${c?q` <div>
<ha-icon
title=${N_("event.where")}
.icon=${"mdi:map-marker-outline"}
></ha-icon>
<span title="${c}">${c}</span>
</div>`:q``}
${l?q` <div>
<ha-icon title=${N_("event.tag")} .icon=${"mdi:tag"}></ha-icon>
<span title="${l}">${l}</span>
</div>`:q``}
${u?q` <div>
<ha-icon
title=${N_("event.seek")}
.icon=${"mdi:clock-fast"}
></ha-icon>
<span title="${u}">${u}</span>
</div>`:q``}
</div>
`}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` <div class="title">
<span title="${this.cameraTitle}">${this.cameraTitle}</span>
</div>`:""}
<div class="details">
${t?q` <div>
<ha-icon
title=${N_("recording.start")}
.icon=${"mdi:calendar-clock-outline"}
></ha-icon>
<span title="${t}">${t}</span>
</div>
${a||i?q` <div>
<ha-icon
title=${N_("recording.duration")}
.icon=${"mdi:clock-outline"}
></ha-icon>
${a?q`<span title="${a}">${a}</span>`:""}
${i?q`<span title="${i}">${i}</span>`:""}
</div>`:""}`:""}
${r?q` <div>
<ha-icon
title=${N_("event.seek")}
.icon=${"mdi:clock-fast"}
></ha-icon>
<span title="${r}">${r}</span>
</div>`:q``}
${null!==o?q`<div>
<ha-icon
title=${N_("recording.events")}
.icon=${"mdi:shield-alert"}
></ha-icon>
<span title="${o}">${o}</span>
</div>`:""}
</div>
`}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`<frigate-card-thumbnail-feature-thumbnail
aria-label="${t??""}"
title=${t}
.hass=${this.hass}
.date=${this.media.getStartTime()??void 0}
.thumbnail=${e??void 0}
></frigate-card-thumbnail-feature-thumbnail>`:ex.isEvent(this.media)||ex.isRecording(this.media)?q`<frigate-card-thumbnail-feature-text
aria-label="${t??""}"
title="${t??""}"
.cameraMetadata=${s}
.showCameraTitle=${!this.details}
.date=${this.media.getStartTime()??void 0}
></frigate-card-thumbnail-feature-text>`:q``}
${r?q` <ha-icon
class="${_e(n)}"
icon=${this.media.isFavorite()?"mdi:star":"mdi:star-outline"}
title=${N_("thumbnail.retain_indefinitely")}
@click=${async e=>{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()}}}
/></ha-icon>`:""}
${this.details&&ex.isEvent(this.media)?q`<frigate-card-thumbnail-details-event
.media=${this.media??void 0}
.cameraTitle=${s?.title}
.seek=${this.seek}
></frigate-card-thumbnail-details-event>`:this.details&&ex.isRecording(this.media)?q`<frigate-card-thumbnail-details-recording
.media=${this.media??void 0}
.cameraTitle=${s?.title}
.seek=${this.seek}
></frigate-card-thumbnail-details-recording>`:q``}
${a?q`<ha-icon
class="timeline"
icon="mdi:target"
title=${N_("thumbnail.timeline")}
@click=${e=>{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"])]})}}
></ha-icon>`:""}
${o?q` <ha-icon
class="download"
icon=${"mdi:download"}
title=${N_("thumbnail.download")}
@click=${async e=>{if(vf(e),this.hass&&this.cameraManager&&this.media)try{await Sw(this.hass,this.cameraManager,this.media)}catch(e){Ck(this,e)}}}
></ha-icon>`:""}
`}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` <frigate-card-thumbnail
class="${_e(r)}"
.cameraManager=${this.cameraManager}
.hass=${this.hass}
.media=${i}
.viewManagerEpoch=${this.viewManagerEpoch}
.seek=${n&&i.includesTime(n)?n:void 0}
?details=${!!this.config?.show_details}
?show_favorite_control=${this.config?.show_favorite_control}
?show_timeline_control=${this.config?.show_timeline_control}
?show_download_control=${this.config?.show_download_control}
@click=${e=>{const n=this.viewManagerEpoch?.manager.getView();n&&n.queryResults&&Vg(this,"thumbnail-carousel:tap",{queryResults:n.queryResults.clone().selectIndex(t)}),vf(e)}}
>
</frigate-card-thumbnail>`)}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`<frigate-card-carousel
direction=${e}
.selected=${this._getSelectedSlide()??0}
.dragFree=${!0}
>
${this._thumbnailSlides}
</frigate-card-carousel>`}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='<style>\n:host {\n background-color: #ffffff;\n width: 350px;\n max-width: 75vw;\n\n visibility: hidden;\n transition: visibility 0.5s;\n}\n\n:host([open]) {\n visibility: visible;\n}\n\n::slotted(div) {\n box-sizing: border-box;\n}\n\n#d {\n position: fixed;\n z-index: 99;\n background-color: inherit;\n -webkit-overflow-scrolling: touch;\n overflow: auto;\n overscroll-behavior: contain;\n backdrop-filter: var(--side-drawer-backdrop-filter, none);\n\n top: 0;\n bottom: 0;\n left: 0;\n height: 100%;\n box-sizing: border-box;\n transform: translateX(-100%);\n transition: var(\n --side-drawer-transition,\n transform 0.25s ease-out\n );\n width: inherit;\n max-width: inherit;\n border-top-right-radius: inherit;\n border-bottom-right-radius: inherit;\n}\n\n:host([open]) #d {\n transform: none;\n box-shadow: 0px 0px 25px 0px rgba(0, 0, 0, 0.5);\n}\n\n#fs {\n position: fixed;\n z-index: 98;\n background-color: #000000;\n backdrop-filter: var(--side-drawer-backdrop-filter, none);\n\n top: 0;\n bottom: 0;\n right: -30px; /* hide scrollbar until overscroll bug is fixed */\n height: 100vh;\n transition: var(\n --side-drawer-overlay-transition,\n opacity linear 0.25s\n );\n width: calc(\n 100vw + 30px\n ); /* put back to just 100vw once overscroll bug fixed */\n opacity: 0;\n visibility: hidden;\n\n overflow: auto;\n overscroll-behavior: contain;\n}\n\n:host([open]) #fs {\n opacity: var(--side-drawer-overlay-opacity, 0.7);\n visibility: visible;\n}\n\n/*\n * Workaround for bug https://bugs.chromium.org/p/chromium/issues/detail?id=813094\n * Once bug is fixed and in the wild we can remove this element and make #if overflow:hidden\n * and set "right: 0; width: 100vw" for #fs\n */\n#ifs {\n height: calc(100vh + 1px);\n}\n</style>\n<div id="d"><slot></slot></div>\n<div id="fs"><div id="ifs"></div></div>\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`
<side-drawer
${je(this._refDrawer)}
location="${this.location}"
?open=${this.open}
@mouseleave=${()=>{this.open&&(this.open=!1)}}
>
${this.control?q`
<div
class="control-surround"
@click=${e=>{vf(e),this.open=!this.open}}
>
<ha-icon
class="control"
icon="${this.open?this.icons?.open??"mdi:menu-open":this.icons?.closed??"mdi:menu"}"
@mouseenter=${()=>{this._isHoverableDevice&&!this.open&&(this.open=!0)}}
>
</ha-icon>
</div>
`:""}
<slot ${je(this._refSlot)} @slotchange=${()=>this._slotChanged()}></slot>
</side-drawer>
`}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` <slot name="above"></slot>
<slot></slot>
<frigate-card-drawer
${je(this._refDrawerLeft)}
location="left"
.icons=${this.drawerIcons?.left}
>
<slot name="left"></slot>
</frigate-card-drawer>
<frigate-card-drawer
${je(this._refDrawerRight)}
location="right"
.icons=${this.drawerIcons?.right}
>
<slot name="right"></slot>
</frigate-card-drawer>
<slot name="below"></slot>`}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` <frigate-card-surround-basic
@frigate-card:thumbnails:open=${e=>t(e,"open")}
@frigate-card:thumbnails:close=${e=>t(e,"close")}
>
${this.thumbnailConfig&&"none"!==this.thumbnailConfig.mode?q` <frigate-card-thumbnail-carousel
slot=${this.thumbnailConfig.mode}
.hass=${this.hass}
.config=${this.thumbnailConfig}
.cameraManager=${this.cameraManager}
.fadeThumbnails=${e.isViewerView()}
.viewManagerEpoch=${this.viewManagerEpoch}
.selected=${e.queryResults?.getSelectedIndex()??void 0}
@frigate-card:thumbnail-carousel:tap=${e=>{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"))}}
>
</frigate-card-thumbnail-carousel>`:""}
${this.timelineConfig&&"none"!==this.timelineConfig.mode?q` <frigate-card-timeline-core
slot=${this.timelineConfig.mode}
.hass=${this.hass}
.viewManagerEpoch=${this.viewManagerEpoch}
.itemClickAction=${e.isViewerView()||!this.thumbnailConfig||"none"===this.thumbnailConfig?.mode?"play":"select"}
.cameraIDs=${this._cameraIDsForTimeline}
.mini=${!0}
.timelineConfig=${this.timelineConfig}
.thumbnailConfig=${this.thumbnailConfig}
.cameraManager=${this.cameraManager}
.cardWideConfig=${this.cardWideConfig}
>
</frigate-card-timeline-core>`:""}
<slot></slot>
</frigate-card-surround-basic>`}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` <frigate-card-surround
class="${_e(n)}"
.hass=${this.hass}
.viewManagerEpoch=${this.viewManagerEpoch}
.thumbnailConfig=${this.hide?void 0:a}
.timelineConfig=${this.hide?void 0:i}
.cameraManager=${this.cameraManager}
.cardWideConfig=${this.cardWideConfig}
>
${!this.hide&&e?.is("image")&&r?q` <frigate-card-image
.imageConfig=${this.overriddenConfig.image}
.view=${e}
.hass=${this.hass}
.cameraConfig=${r}
.cameraManager=${this.cameraManager}
>
</frigate-card-image>`:""}
${!this.hide&&e?.isGalleryView()?q` <frigate-card-gallery
.hass=${this.hass}
.viewManagerEpoch=${this.viewManagerEpoch}
.galleryConfig=${this.overriddenConfig.media_gallery}
.cameraManager=${this.cameraManager}
.cardWideConfig=${this.cardWideConfig}
>
</frigate-card-gallery>`:""}
${!this.hide&&e?.isViewerView()?q`
<frigate-card-viewer
.hass=${this.hass}
.viewManagerEpoch=${this.viewManagerEpoch}
.viewerConfig=${this.overriddenConfig.media_viewer}
.resolvedMediaCache=${this.resolvedMediaCache}
.cameraManager=${this.cameraManager}
.cardWideConfig=${this.cardWideConfig}
>
</frigate-card-viewer>
`:""}
${!this.hide&&e?.is("timeline")?q` <frigate-card-timeline
.hass=${this.hass}
.viewManagerEpoch=${this.viewManagerEpoch}
.timelineConfig=${this.overriddenConfig.timeline}
.cameraManager=${this.cameraManager}
.cardWideConfig=${this.cardWideConfig}
>
</frigate-card-timeline>`:""}
${!this.hide&&e?.is("diagnostics")?q` <frigate-card-diagnostics
.hass=${this.hass}
.rawConfig=${this.rawConfig}
.deviceRegistryManager=${this.deviceRegistryManager}
>
</frigate-card-diagnostics>`:""}
${this._shouldLivePreload()||!this.hide&&e?.is("live")?q`
<frigate-card-live
.hass=${this.hass}
.viewManagerEpoch=${this.viewManagerEpoch}
.nonOverriddenLiveConfig=${this.nonOverriddenConfig.live}
.overriddenLiveConfig=${this.overriddenConfig.live}
.conditionsManagerEpoch=${this.conditionsManagerEpoch}
.overrides=${this.overriddenConfig.overrides}
.cameraManager=${this.cameraManager}
.cardWideConfig=${this.cardWideConfig}
.microphoneManager=${this.microphoneManager}
.triggeredCameraIDs=${this.triggeredCameraIDs}
class="${_e(t)}"
>
</frigate-card-live>
`:""}
</frigate-card-surround>`}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`<frigate-card-overlay>${r("overlay")}</frigate-card-overlay>`:q`<div class="outerlay" data-position="${e}">
${r("outerlay")}
</div>`}
`}_renderMenu(e){const t=this._controller.getViewManager().getView();if(this._hass&&this._config)return q`
<frigate-card-menu
${je(this._refMenu)}
slot=${ye(e)}
.hass=${this._hass}
.menuConfig=${this._config.menu}
.buttons=${this._menuButtonController.calculateButtons(this._hass,this._config,this._controller.getCameraManager(),{inExpandedMode:this._controller.getExpandManager().isExpanded(),inFullscreenMode:this._controller.getFullscreenManager().isInFullscreen(),currentMediaLoadedInfo:this._controller.getMediaLoadedInfoManager().get(),showCameraUIButton:this._controller.getCameraURLManager().hasCameraURL(),mediaPlayerController:this._controller.getMediaPlayerManager(),microphoneManager:this._controller.getMicrophoneManager(),view:t,viewManager:this._controller.getViewManager()})}
.entityRegistryManager=${this._controller.getEntityRegistryManager()}
></frigate-card-menu>
`}_renderStatusBar(e){if(this._config)return q`
<frigate-card-status-bar
slot=${ye(e)}
.items=${this._controller.getStatusBarItemManager().calculateItems({statusConfig:this._config.status_bar,cameraManager:this._controller.getCameraManager(),view:this._controller.getViewManager().getView(),mediaLoadedInfo:this._controller.getMediaLoadedInfoManager().get()})}
.config=${this._config.status_bar}
></frigate-card-status-bar>
`}updated(){this._controller.getInitializationManager().isInitializedMandatory()&&this._controller.getQueryStringManager().executeIfNecessary()}_renderInDialogIfNecessary(e){return this._controller.getExpandManager().isExpanded()?q` <web-dialog
open
center
@close=${()=>{this._controller.getExpandManager().setExpanded(!1)}}
>
${e}
</web-dialog>`: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` <ha-card
id="ha-card"
.actionHandler=${Cf({hasHold:yf(t.hold_action),hasDoubleClick:yf(t.double_tap_action)})}
style="${Re(this._controller.getStyleManager().getAspectRatioStyle())}"
@frigate-card:message=${e=>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`<frigate-card-loading></frigate-card-loading>`:""}
${this._renderMenuStatusContainer("top")}
${this._renderMenuStatusContainer("overlay")}
<div ${je(this._refMain)} class="${_e(e)}">
<frigate-card-views
${je(this._refViews)}
.hass=${this._hass}
.viewManagerEpoch=${this._controller.getViewManager().getEpoch()}
.cameraManager=${n}
.resolvedMediaCache=${this._controller.getResolvedMediaCache()}
.nonOverriddenConfig=${this._controller.getConfigManager().getNonOverriddenConfig()}
.overriddenConfig=${this._controller.getConfigManager().getConfig()}
.cardWideConfig=${this._controller.getConfigManager().getCardWideConfig()}
.rawConfig=${this._controller.getConfigManager().getRawConfig()}
.configManager=${this._controller.getConfigManager()}
.conditionsManagerEpoch=${this._controller.getConditionsManager()?.getEpoch()}
.hide=${!!this._controller.getMessageManager().hasMessage()}
.microphoneManager=${this._controller.getMicrophoneManager()}
.triggeredCameraIDs=${this._config?.view.triggers.show_trigger_status?this._controller.getTriggersManager().getTriggeredCameraIDs():void 0}
.deviceRegistryManager=${this._controller.getDeviceRegistryManager()}
></frigate-card-views>
${bk(this._controller.getMessageManager().getMessage())}
</div>
${this._renderMenuStatusContainer("bottom")}
${this._config?.elements?q` <frigate-card-elements
${je(this._refElements)}
.hass=${this._hass}
.elements=${this._config?.elements}
.conditionsManagerEpoch=${this._controller.getConditionsManager()?.getEpoch()}
@frigate-card:menu:add=${e=>{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)}}
>
</frigate-card-elements>`:""}
</ha-card>`)}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};