UNPKG

iobroker.lovelace

Version:

With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI

24 lines 30.9 kB
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[11798],{8480:function(e,t,a){a.a(e,async function(e,i){try{a.d(t,{wj:function(){return v}});var r,o,n,s=a(74487),c=a(29079),l=a(46927),d=e([s]);s=(d.then?(await d)():d)[0];const h=null===(r=Intl.DateTimeFormat)||void 0===r||null===(o=(n=r.call(Intl)).resolvedOptions)||void 0===o?void 0:o.call(n).timeZone,f=h&&("UTC"===h||"Etc/UTC"===h||h in c)?h:void 0,u=null!=f?f:"UTC",v=(e,t)=>e===l.Wj.local&&f?u:t;i()}catch(h){i(h)}})},20058:function(e,t,a){a.a(e,async function(e,i){try{a.d(t,{QL:function(){return h},ZQ:function(){return f},ZV:function(){return d},ty:function(){return c},x:function(){return s}});var r=a(74487),o=(a(74423),a(18111),a(61701),a(46927)),n=e([r]);r=(n.then?(await n)():n)[0];const s=e=>c(e.attributes),c=(e,t)=>!!e.unit_of_measurement||!!e.state_class||(t||[]).includes(e.device_class||""),l=e=>{switch(e.number_format){case o.jG.comma_decimal:return["en-US","en"];case o.jG.decimal_comma:return["de","es","it"];case o.jG.space_comma:return["fr","sv","cs"];case o.jG.quote_decimal:return["de-CH"];case o.jG.system:return;default:return e.language}},d=(e,t,a)=>h(e,t,a).map(e=>e.value).join(""),h=(e,t,a)=>{const i=t?l(t):void 0;return(null==t?void 0:t.number_format)===o.jG.none||Number.isNaN(Number(e))?Number.isNaN(Number(e))||""===e||(null==t?void 0:t.number_format)!==o.jG.none?[{type:"literal",value:e}]:new Intl.NumberFormat("en-US",u(e,Object.assign(Object.assign({},a),{},{useGrouping:!1}))).formatToParts(Number(e)):new Intl.NumberFormat(i,u(e,a)).formatToParts(Number(e))},f=(e,t)=>{var a;const i=null==t?void 0:t.display_precision;return null!=i?{maximumFractionDigits:i,minimumFractionDigits:i}:Number.isInteger(Number(null==e||null===(a=e.attributes)||void 0===a?void 0:a.step))&&Number.isInteger(Number(null==e?void 0:e.state))?{maximumFractionDigits:0}:void 0},u=(e,t)=>{const a=Object.assign({maximumFractionDigits:2},t);if("string"!=typeof e)return a;if(!t||void 0===t.minimumFractionDigits&&void 0===t.maximumFractionDigits){const t=e.indexOf(".")>-1?e.split(".")[1].length:0;a.minimumFractionDigits=t,a.maximumFractionDigits=t}return a};i()}catch(s){i(s)}})},70947:function(e,t,a){a(62953);var i=a(40445),r=a(50759),o=(a(38625),a(5124)),n=a(67576);a(67094);let s,c,l=e=>e;class d extends r.A{renderCheckboxIcon(){return(0,o.qy)(s||(s=l` <ha-svg-icon id="check" part="checkmark" .path="${0}"></ha-svg-icon> `),this.checked?"M10,17L5,12L6.41,10.58L10,14.17L17.59,6.58L19,8M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3Z":"M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3M19,5V19H5V5H19Z")}static get styles(){return[r.A.styles,(0,o.AH)(c||(c=l`:host{min-height:var(--ha-space-10)}#check{visibility:visible;flex-shrink:0}#icon ::slotted(*){color:var(--ha-color-on-neutral-normal)}:host([variant=danger]) #icon ::slotted(*){color:var(--ha-color-on-danger-quiet)}:host([selected]){font-weight:var(--ha-font-weight-medium);color:var(--primary-color);background-color:var(--ha-color-fill-primary-quiet-resting);--icon-primary-color:var(--primary-color)}:host([selected]:hover){background-color:var(--ha-color-fill-primary-quiet-hover)}`))]}constructor(...e){super(...e),this.selected=!1}}(0,i.Cg)([(0,n.MZ)({type:Boolean,reflect:!0})],d.prototype,"selected",void 0),d=(0,i.Cg)([(0,n.EM)("ha-dropdown-item")],d)},29823:function(e,t,a){a.a(e,async function(e,t){try{a(3362),a(62953);var i=a(40445),r=a(52254),o=a(5124),n=a(67576),s=e([r]);r=(s.then?(await s)():s)[0];let c,l=e=>e;class d extends r.A{get anchorElement(){var e;return null===(e=this.popup)||void 0===e?void 0:e.anchor}set anchorElement(e){this.popup&&(this.popup.anchor&&"ha-icon-button"===this.popup.anchor.localName&&(this.popup.anchor.selected=!1),this.popup.anchor=e)}getTrigger(){return this.anchorElement?this.anchorElement:super.getTrigger()}async showMenu(){await super.showMenu();const e=this.getTrigger();e&&"ha-icon-button"===e.localName&&(e.selected=!0)}async hideMenu(){const e=this.getTrigger();e&&"ha-icon-button"===e.localName&&(e.selected=!1),await super.hideMenu()}static get styles(){return[r.A.styles,(0,o.AH)(c||(c=l`:host{font-size:var(--ha-dropdown-font-size, var(--ha-font-size-m));--wa-color-surface-raised:var( --card-background-color, var(--ha-dialog-surface-background, var(--mdc-theme-surface, #fff)), )}#menu{padding:var(--ha-space-1)}wa-popup::part(popup){z-index:200}`))]}constructor(...e){super(...e),this.dropdownTag="ha-dropdown",this.dropdownItemTag="ha-dropdown-item"}}(0,i.Cg)([(0,n.MZ)({attribute:!1})],d.prototype,"dropdownTag",void 0),(0,i.Cg)([(0,n.MZ)({attribute:!1})],d.prototype,"dropdownItemTag",void 0),d=(0,i.Cg)([(0,n.EM)("ha-dropdown")],d),t()}catch(c){t(c)}})},47680:function(e,t,a){a.r(t),a.d(t,{HaIcon:function(){return M}});a(74423),a(3362),a(62953);var i=a(40445),r=a(5124),o=a(67576),n=a(1087),s=a(9899),c=a(700),l=(a(44114),a(18111),a(7588),a(96167),a(95192)),d=a(7553);const h=JSON.parse('{"version":"7.4.47","parts":[{"file":"7a7139d465f1f41cb26ab851a17caa21a9331234"},{"start":"account-supervisor-circle-","file":"9561286c4c1021d46b9006596812178190a7cc1c"},{"start":"alpha-r-c","file":"eb466b7087fb2b4d23376ea9bc86693c45c500fa"},{"start":"arrow-decision-o","file":"4b3c01b7e0723b702940c5ac46fb9e555646972b"},{"start":"baby-f","file":"2611401d85450b95ab448ad1d02c1a432b409ed2"},{"start":"battery-hi","file":"89bcd31855b34cd9d31ac693fb073277e74f1f6a"},{"start":"blur-r","file":"373709cd5d7e688c2addc9a6c5d26c2d57c02c48"},{"start":"briefcase-account-","file":"a75956cf812ee90ee4f656274426aafac81e1053"},{"start":"calendar-question-","file":"3253f2529b5ebdd110b411917bacfacb5b7063e6"},{"start":"car-lig","file":"74566af3501ad6ae58ad13a8b6921b3cc2ef879d"},{"start":"cellphone-co","file":"7677f1cfb2dd4f5562a2aa6d3ae43a2e6997b21a"},{"start":"circle-slice-2","file":"70d08c50ec4522dd75d11338db57846588263ee2"},{"start":"cloud-co","file":"141d2bfa55ca4c83f4bae2812a5da59a84fec4ff"},{"start":"cog-s","file":"5a640365f8e47c609005d5e098e0e8104286d120"},{"start":"cookie-l","file":"dd85b8eb8581b176d3acf75d1bd82e61ca1ba2fc"},{"start":"currency-eur-","file":"15362279f4ebfc3620ae55f79d2830ad86d5213e"},{"start":"delete-o","file":"239434ab8df61237277d7599ebe066c55806c274"},{"start":"draw-","file":"5605918a592070803ba2ad05a5aba06263da0d70"},{"start":"emoticon-po","file":"a838cfcec34323946237a9f18e66945f55260f78"},{"start":"fan","file":"effd56103b37a8c7f332e22de8e4d67a69b70db7"},{"start":"file-question-","file":"b2424b50bd465ae192593f1c3d086c5eec893af8"},{"start":"flask-off-","file":"3b76295cde006a18f0301dd98eed8c57e1d5a425"},{"start":"food-s","file":"1c6941474cbeb1755faaaf5771440577f4f1f9c6"},{"start":"gamepad-u","file":"c6efe18db6bc9654ae3540c7dee83218a5450263"},{"start":"google-f","file":"df341afe6ad4437457cf188499cb8d2df8ac7b9e"},{"start":"head-c","file":"282121c9e45ed67f033edcc1eafd279334c00f46"},{"start":"home-pl","file":"27e8e38fc7adcacf2a210802f27d841b49c8c508"},{"start":"inbox-","file":"0f0316ec7b1b7f7ce3eaabce26c9ef619b5a1694"},{"start":"key-v","file":"ea33462be7b953ff1eafc5dac2d166b210685a60"},{"start":"leaf-circle-","file":"33db9bbd66ce48a2db3e987fdbd37fb0482145a4"},{"start":"lock-p","file":"b89e27ed39e9d10c44259362a4b57f3c579d3ec8"},{"start":"message-s","file":"7b5ab5a5cadbe06e3113ec148f044aa701eac53a"},{"start":"moti","file":"01024d78c248d36805b565e343dd98033cc3bcaf"},{"start":"newspaper-variant-o","file":"22a6ec4a4fdd0a7c0acaf805f6127b38723c9189"},{"start":"on","file":"c73d55b412f394e64632e2011a59aa05e5a1f50d"},{"start":"paw-ou","file":"3f669bf26d16752dc4a9ea349492df93a13dcfbf"},{"start":"pigg","file":"0c24edb27eb1c90b6e33fc05f34ef3118fa94256"},{"start":"printer-pos-sy","file":"41a55cda866f90b99a64395c3bb18c14983dcf0a"},{"start":"read","file":"c7ed91552a3a64c9be88c85e807404cf705b7edf"},{"start":"robot-vacuum-variant-o","file":"917d2a35d7268c0ea9ad9ecab2778060e19d90e0"},{"start":"sees","file":"6e82d9861d8fac30102bafa212021b819f303bdb"},{"start":"shoe-f","file":"e2fe7ce02b5472301418cc90a0e631f187b9f238"},{"start":"snowflake-m","file":"a28ba9f5309090c8b49a27ca20ff582a944f6e71"},{"start":"st","file":"7e92d03f095ec27e137b708b879dfd273bd735ab"},{"start":"su","file":"61c74913720f9de59a379bdca37f1d2f0dc1f9db"},{"start":"tag-plus-","file":"8f3184156a4f38549cf4c4fffba73a6a941166ae"},{"start":"timer-a","file":"baab470d11cfb3a3cd3b063ee6503a77d12a80d0"},{"start":"transit-d","file":"8561c0d9b1ac03fab360fd8fe9729c96e8693239"},{"start":"vector-arrange-b","file":"c9a3439257d4bab33d3355f1f2e11842e8171141"},{"start":"water-ou","file":"02dbccfb8ca35f39b99f5a085b095fc1275005a0"},{"start":"webc","file":"57bafd4b97341f4f2ac20a609d023719f23a619c"},{"start":"zip","file":"65ae094e8263236fa50486584a08c03497a38d93"}]}');let f;const u=()=>(f||(f=v().catch(e=>{throw f=void 0,e})),f),v=async()=>{const e=(0,l.y$)("hass-icon-db","mdi-icon-store"),t=await(0,l.Jt)("_version",e);return t?t!==h.version&&(await(0,l.IU)(e),(0,l.hZ)("_version",h.version,e)):(0,l.hZ)("_version",h.version,e),e},p=["mdi","hass","hassio","hademo"];let g=[];a(67094);let m,b,y,w=e=>e;const _={},x={},C=(0,s.s)(()=>(async e=>{const t=Object.keys(e),a=await Promise.allSettled(Object.values(e));(await u())("readwrite",i=>{a.forEach((a,r)=>{"fulfilled"===a.status&&Object.entries(a.value).forEach(([e,t])=>{i.put(t,e)}),delete e[t[r]]})})})(x),2e3),k={},$={"home-assistant":()=>a.e(58781).then(a.bind(a,53580)).then(e=>e.mdiHomeAssistant),"music-assistant":()=>a.e(56009).then(a.bind(a,10576)).then(e=>e.mdiMusicAssistant),esphome:()=>a.e(88800).then(a.bind(a,45091)).then(e=>e.mdiEsphomeLogo)};class M extends r.WF{willUpdate(e){super.willUpdate(e),e.has("icon")&&(this._path=void 0,this._secondaryPath=void 0,this._viewBox=void 0,this._loadIcon())}render(){return this.icon?this._legacy?(0,r.qy)(m||(m=w` <iron-icon .icon="${0}"></iron-icon>`),this.icon):(0,r.qy)(b||(b=w`<ha-svg-icon .path="${0}" .secondaryPath="${0}" .viewBox="${0}"></ha-svg-icon>`),this._path,this._secondaryPath,this._viewBox):r.s6}async _loadIcon(){if(!this.icon)return;const e=this.icon,[t,a]=this.icon.split(":",2);let i,r=a;if(!t||!r)return;if(!p.includes(t)){const a=c.y[t];return a?void(a&&"function"==typeof a.getIcon&&this._setCustomPath(a.getIcon(r),e)):void(this._legacy=!0)}if(this._legacy=!1,r in _){const e=_[r];let a;e.newName?(a=`Icon ${t}:${r} was renamed to ${t}:${e.newName}, please change your config, it will be removed in version ${e.removeIn}.`,r=e.newName):a=`Icon ${t}:${r} was removed from MDI, please replace this icon with an other icon in your config, it will be removed in version ${e.removeIn}.`,console.warn(a),(0,n.r)(this,"write_log",{level:"warning",message:a})}if(r in k)return void(this._path=k[r]);if(r in $){const t=await $[r]();return this.icon===e&&(this._path=t),void(k[r]=t)}try{i=await(e=>new Promise((t,a)=>{if(g.push([e,t,a]),g.length>1)return;const i=u();(0,d.h)(1e3,(async()=>{(await i)("readonly",e=>{for(const[t,a,i]of g)(0,l.Yd)(e.get(t)).then(e=>a(e)).catch(e=>i(e));g=[]})})()).catch(e=>{for(const[,,t]of g)t(e);g=[]})}))(r)}catch(f){i=void 0}if(i)return this.icon===e&&(this._path=i),void(k[r]=i);const o=(e=>{let t;for(const a of h.parts){if(void 0!==a.start&&e<a.start)break;t=a}return t.file})(r);if(o in x)return void this._setPath(x[o],r,e);const s=fetch(`/static/mdi/${o}.json`).then(e=>e.json());x[o]=s,this._setPath(s,r,e),s.catch(()=>{delete x[o]}),C()}async _setCustomPath(e,t){const a=await e;this.icon===t&&(this._path=a.path,this._secondaryPath=a.secondaryPath,this._viewBox=a.viewBox)}async _setPath(e,t,a){try{const i=await e;this.icon===a&&(this._path=i[t]),k[t]=i[t]}catch(i){}}constructor(...e){super(...e),this._legacy=!1}}M.styles=(0,r.AH)(y||(y=w`:host{fill:currentcolor}`)),(0,i.Cg)([(0,o.MZ)()],M.prototype,"icon",void 0),(0,i.Cg)([(0,o.wk)()],M.prototype,"_path",void 0),(0,i.Cg)([(0,o.wk)()],M.prototype,"_secondaryPath",void 0),(0,i.Cg)([(0,o.wk)()],M.prototype,"_viewBox",void 0),(0,i.Cg)([(0,o.wk)()],M.prototype,"_legacy",void 0),M=(0,i.Cg)([(0,o.EM)("ha-icon")],M)},93367:function(e,t,a){a.a(e,async function(e,t){try{var i=a(40445),r=a(35211),o=a(5124),n=a(67576),s=a(91450),c=a(69093),l=a(22792),d=a(85694),h=(a(47680),a(67094),e([d]));d=(h.then?(await h)():h)[0];let f,u,v,p,g=e=>e;class m extends o.WF{render(){var e,t;const a=this.icon||this.stateObj&&(null===(e=this._entities)||void 0===e||null===(e=e[this.stateObj.entity_id])||void 0===e?void 0:e.icon)||(null===(t=this.stateObj)||void 0===t?void 0:t.attributes.icon);if(a)return(0,o.qy)(f||(f=g`<ha-icon .icon="${0}"></ha-icon>`),a);if(!this.stateObj)return o.s6;if(!this._config||!this._connection||!this._entities)return this._renderFallback();const i=(0,d.fq)(this._entities,this._config.config,this._connection.connection,this.stateObj,this.stateValue).then(e=>e?(0,o.qy)(u||(u=g`<ha-icon .icon="${0}"></ha-icon>`),e):this._renderFallback());return(0,o.qy)(v||(v=g`${0}`),(0,s.T)(i))}_renderFallback(){const e=(0,c.t)(this.stateObj);return(0,o.qy)(p||(p=g` <ha-svg-icon .path="${0}"></ha-svg-icon> `),d.l[e]||d.lW)}}(0,i.Cg)([(0,n.MZ)({attribute:!1})],m.prototype,"stateObj",void 0),(0,i.Cg)([(0,n.MZ)({attribute:!1})],m.prototype,"stateValue",void 0),(0,i.Cg)([(0,n.MZ)()],m.prototype,"icon",void 0),(0,i.Cg)([(0,n.wk)(),(0,r.Fg)({context:l.WF,subscribe:!0})],m.prototype,"_config",void 0),(0,i.Cg)([(0,n.wk)(),(0,r.Fg)({context:l.Wq,subscribe:!0})],m.prototype,"_connection",void 0),(0,i.Cg)([(0,n.wk)(),(0,r.Fg)({context:l.X1,subscribe:!0})],m.prototype,"_entities",void 0),m=(0,i.Cg)([(0,n.EM)("ha-state-icon")],m),t()}catch(f){t(f)}})},700:function(e,t,a){a.d(t,{y:function(){return n}});const i=window;"customIconsets"in i||(i.customIconsets={});const r=i.customIconsets,o=window;"customIcons"in o||(o.customIcons={});const n=new Proxy(o.customIcons,{get:(e,t)=>{var a;return null!==(a=e[t])&&void 0!==a?a:r[t]?{getIcon:r[t]}:void 0}})},22675:function(e,t,a){a.d(t,{HV:function(){return o},Hh:function(){return r}});var i=a(23832);const r="unavailable",o="unknown",n=[r,o,"off"];(0,i.g)(n)},21875:function(e,t,a){a.a(e,async function(e,i){try{a.r(t);a(74423),a(18111),a(22489),a(20116),a(7588),a(61701),a(3362),a(62953);var r=a(40445),o=(a(68825),a(88696)),n=a(5124),s=a(67576),c=a(93905),l=a(28978),d=a(18350),h=(a(76776),a(29823)),f=(a(70947),a(26300)),u=(a(8630),a(28732),a(2054)),v=a(65829),p=a(93367),g=(a(67094),a(81762),a(55156)),m=a(59241),b=a(95350),y=a(77763),w=a(54706),_=a(14503),x=a(63556),C=e([d,h,f,u,v,p,x,o]);[d,h,f,u,v,p,x,o]=C.then?(await C)():C;let k,$,M,z,H,A,j,q,I,V=e=>e;const F="M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z",E="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",Z="M17.65,6.35C16.2,4.9 14.21,4 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20C15.73,20 18.84,17.45 19.73,14H17.65C16.83,16.33 14.61,18 12,18A6,6 0 0,1 6,12A6,6 0 0,1 12,6C13.66,6 15.14,6.69 16.22,7.78L13,11H20V4L17.65,6.35Z";class N extends((0,w.E)(n.WF)){connectedCallback(){super.connectedCallback(),this._mql=window.matchMedia("(max-width: 450px), all and (max-height: 500px)"),this._mql.addListener(this._setIsMobile),this.mobile=this._mql.matches}disconnectedCallback(){var e;super.disconnectedCallback(),null===(e=this._mql)||void 0===e||e.removeListener(this._setIsMobile),this._mql=void 0,this._unsubscribeAll()}hassSubscribe(){return[(0,m.Bz)(this.hass.connection,e=>{this._entityRegistry=e,this._calendars=(0,g.ar)(this.hass,this,this._entityRegistry),this._start&&this._end&&this._unsubscribeAll().then(()=>{this._events=[],this._subscribeCalendarEvents(this._selectedCalendars)})})]}render(){var e,t,a;if(!this._entityRegistry)return(0,n.qy)(k||(k=V` <ha-two-pane-top-app-bar-fixed .narrow="${0}"> <ha-menu-button slot="navigationIcon" .hass="${0}" .narrow="${0}"></ha-menu-button> <div slot="title"> ${0} </div> <div class="loading"> <ha-spinner></ha-spinner> </div> </ha-two-pane-top-app-bar-fixed> `),this.narrow,this.hass,this.narrow,this.hass.localize("ui.components.calendar.my_calendars"));const i=this._calendars.map(e=>(0,n.qy)($||($=V` <ha-dropdown-item type="checkbox" @click="${0}" .value="${0}" .checked="${0}"> <ha-state-icon slot="icon" .stateObj="${0}" style="--icon-primary-color:${0}"></ha-state-icon> ${0} </ha-dropdown-item> `),this._requestSelected,e.entity_id,!this._deSelectedCalendars.includes(e.entity_id),e,e.backgroundColor,e.name)),r=null!==(e=this._showPaneController.value)&&void 0!==e?e:!this.narrow;return(0,n.qy)(M||(M=V` <ha-two-pane-top-app-bar-fixed .pane="${0}" footer .narrow="${0}"> <ha-menu-button slot="navigationIcon" .hass="${0}" .narrow="${0}"></ha-menu-button> ${0} <ha-icon-button slot="actionItems" .path="${0}" .label="${0}" @click="${0}"></ha-icon-button> ${0} <ha-full-calendar add-fab .events="${0}" .calendars="${0}" .narrow="${0}" .initialView="${0}" .hass="${0}" .error="${0}" @view-changed="${0}"></ha-full-calendar> </ha-two-pane-top-app-bar-fixed> `),r,this.narrow,this.hass,this.narrow,r?(0,n.qy)(A||(A=V`<div slot="title"> ${0} </div>`),this.hass.localize("ui.components.calendar.my_calendars")):(0,n.qy)(z||(z=V`<ha-dropdown slot="title"> <ha-button slot="trigger"> ${0} <ha-svg-icon slot="end" .path="${0}"></ha-svg-icon> </ha-button> ${0} ${0} </ha-dropdown>`),this.hass.localize("ui.components.calendar.my_calendars"),F,i,null!==(t=this.hass.user)&&void 0!==t&&t.is_admin?(0,n.qy)(H||(H=V`<wa-divider></wa-divider> <ha-dropdown-item @click="${0}"> <ha-svg-icon .path="${0}" slot="icon"></ha-svg-icon> ${0} </ha-dropdown-item>`),this._addCalendar,E,this.hass.localize("ui.components.calendar.create_calendar")):n.s6),Z,this.hass.localize("ui.common.refresh"),this._handleRefresh,r?(0,n.qy)(j||(j=V`<ha-list slot="pane" multi>${0}</ha-list>${0}`),i,null!==(a=this.hass.user)&&void 0!==a&&a.is_admin?(0,n.qy)(q||(q=V`<ha-list-item graphic="icon" slot="pane-footer" @click="${0}"> <ha-svg-icon .path="${0}" slot="graphic"></ha-svg-icon> ${0} </ha-list-item>`),this._addCalendar,E,this.hass.localize("ui.components.calendar.create_calendar")):n.s6):n.s6,this._events,this._calendars,this.narrow,this.narrow?"listWeek":"dayGridMonth",this.hass,this._error,this._handleViewChanged)}get _selectedCalendars(){return this._calendars.filter(e=>!this._deSelectedCalendars.includes(e.entity_id)).map(e=>e)}_subscribeCalendarEvents(e){this._start&&this._end&&0!==e.length&&(this._error=void 0,e.forEach(e=>{e.entity_id in this._unsubs&&this._unsubs[e.entity_id].then(e=>e()).catch(()=>{});const t=(0,g.iO)(this.hass,e.entity_id,this._start,this._end,t=>{this._handleCalendarUpdate(e,t)});this._unsubs[e.entity_id]=t}))}_handleCalendarUpdate(e,t){if(this._events=this._events.filter(t=>t.calendar!==e.entity_id),null===t.events)return this._errorCalendars.includes(e.entity_id)||(this._errorCalendars=[...this._errorCalendars,e.entity_id]),void this._handleErrors(this._errorCalendars);this._errorCalendars=this._errorCalendars.filter(t=>t!==e.entity_id),this._handleErrors(this._errorCalendars);const a=t.events.map(t=>(0,g.TK)(t,e)).filter(e=>null!==e);this._events=[...this._events,...a]}async _unsubscribeAll(){await Promise.all(Object.values(this._unsubs).map(e=>e.then(e=>e()).catch(()=>{}))),this._unsubs={}}_unsubscribeCalendar(e){e in this._unsubs&&(this._unsubs[e].then(e=>e()).catch(()=>{}),delete this._unsubs[e])}_requestSelected(e){e.stopPropagation();const t=e.currentTarget,a=t.value;if(t.checked)this._deSelectedCalendars=[...this._deSelectedCalendars,a],this._unsubscribeCalendar(a),this._events=this._events.filter(e=>e.calendar!==a);else{this._deSelectedCalendars=this._deSelectedCalendars.filter(e=>e!==a);const e=this._calendars.find(e=>e.entity_id===a);if(!e)return;this._subscribeCalendarEvents([e])}}async _handleViewChanged(e){this._start=e.detail.start,this._end=e.detail.end,await this._unsubscribeAll(),this._events=[],this._subscribeCalendarEvents(this._selectedCalendars)}async _handleRefresh(){await this._unsubscribeAll(),this._events=[],this._subscribeCalendarEvents(this._selectedCalendars)}_handleErrors(e){if(this._error=void 0,e.length>0){const t=e.map(e=>this.hass.states[e]?(0,l.u)(this.hass.states[e]):e).join(", ");this._error=`${this.hass.localize("ui.components.calendar.event_retrieval_error")} ${t}`}}static get styles(){return[_.RF,(0,n.AH)(I||(I=V`:host{display:block}ha-full-calendar{--calendar-header-padding:12px;--calendar-border-radius:var(--ha-border-radius-square);--calendar-border-width:1px 0;height:calc(100vh - var(--header-height,0px) - var(--safe-area-inset-top,0px) - var(--safe-area-inset-bottom,0px))}ha-dropdown ha-button{--ha-font-size-m:var(--ha-font-size-l)}ha-dropdown-item{padding-left:32px;padding-inline-start:32px;padding-inline-end:initial;--icon-primary-color:var(--ha-color-fill-neutral-loud-resting)}ha-dropdown-item[aria-checked=true]{--icon-primary-color:var(--primary-color)}:host([mobile]){padding-left:unset;padding-inline-start:unset;padding-inline-end:initial}.loading{display:flex;align-items:center;justify-content:center;padding:var(--ha-space-8);min-height:400px}`))]}constructor(...e){super(...e),this.narrow=!1,this.mobile=!1,this._calendars=[],this._events=[],this._error=void 0,this._errorCalendars=[],this._deSelectedCalendars=[],this._unsubs={},this._showPaneController=new o.P(this,{callback:e=>{var t;return(null===(t=e[0])||void 0===t?void 0:t.contentRect.width)>750}}),this._setIsMobile=e=>{this.mobile=e.matches},this._addCalendar=async()=>{(0,y.W)(this,{startFlowHandler:"local_calendar",manifest:await(0,b.QC)(this.hass,"local_calendar"),dialogClosedCallback:({flowFinished:e})=>{e&&(this._calendars=(0,g.ar)(this.hass,this,this._entityRegistry))}})}}}(0,r.Cg)([(0,s.MZ)({attribute:!1})],N.prototype,"hass",void 0),(0,r.Cg)([(0,s.MZ)({type:Boolean,reflect:!0})],N.prototype,"narrow",void 0),(0,r.Cg)([(0,s.MZ)({type:Boolean,reflect:!0})],N.prototype,"mobile",void 0),(0,r.Cg)([(0,s.wk)()],N.prototype,"_calendars",void 0),(0,r.Cg)([(0,s.wk)()],N.prototype,"_events",void 0),(0,r.Cg)([(0,s.wk)()],N.prototype,"_error",void 0),(0,r.Cg)([(0,s.wk)()],N.prototype,"_errorCalendars",void 0),(0,r.Cg)([(0,s.wk)()],N.prototype,"_entityRegistry",void 0),(0,r.Cg)([(0,s.wk)(),(0,c.I)({key:"deSelectedCalendars",state:!0})],N.prototype,"_deSelectedCalendars",void 0),N=(0,r.Cg)([(0,s.EM)("ha-panel-calendar")],N),i()}catch(k){i(k)}})},4397:function(e,t,a){a.r(t),a.d(t,{HuiErrorCard:function(){return f}});a(62953);var i=a(40445),r=a(5124),o=a(67576);a(76776),a(67094);let n,s,c,l,d=e=>e;const h={warning:"M12,2L1,21H23M12,6L19.53,19H4.47M11,10V14H13V10M11,16V18H13V16",error:"M11,15H13V17H11V15M11,7H13V13H11V7M12,2C6.47,2 2,6.5 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20Z"};class f extends r.WF{getCardSize(){return 1}getGridOptions(){return{columns:6,rows:this.preview?"auto":1,min_rows:1,min_columns:6}}setConfig(e){this._config=e,this.severity=e.severity||"error"}render(){var e,t,a,i,o;const l=(null===(e=this._config)||void 0===e?void 0:e.error)||"warning"===this.severity&&(null===(t=this.hass)||void 0===t?void 0:t.localize("ui.errors.config.configuration_warning"))||(null===(a=this.hass)||void 0===a?void 0:a.localize("ui.errors.config.configuration_error")),f=void 0===this.hass||(null===(i=this.hass)||void 0===i||null===(i=i.user)||void 0===i?void 0:i.is_admin)||this.preview,u=this.preview;return(0,r.qy)(n||(n=d` <ha-card class="${0} ${0}"> <div class="header"> <div class="icon"> <slot name="icon"> <ha-svg-icon .path="${0}"></ha-svg-icon> </slot> </div> ${0} </div> ${0} </ha-card> `),this.severity,f?"":"no-title",h[this.severity],f?(0,r.qy)(s||(s=d`<div class="title"><slot>${0}</slot></div>`),l):r.s6,u&&null!==(o=this._config)&&void 0!==o&&o.message?(0,r.qy)(c||(c=d`<div class="message">${0}</div>`),this._config.message):r.s6)}constructor(...e){super(...e),this.preview=!1,this.severity="error"}}f.styles=(0,r.AH)(l||(l=d`ha-card{height:100%;border-width:0}ha-card::after{position:absolute;top:0;right:0;bottom:0;left:0;opacity:.12;pointer-events:none;content:"";border-radius:var(--ha-card-border-radius,var(--ha-border-radius-lg))}.header{display:flex;align-items:center;gap:var(--ha-space-2);padding:16px}.message{padding:0 16px 16px 16px}.no-title{justify-content:center}.title{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-weight:var(--ha-font-weight-bold)}ha-card.warning .icon{color:var(--warning-color)}ha-card.warning::after{background-color:var(--warning-color)}ha-card.error .icon{color:var(--error-color)}ha-card.error::after{background-color:var(--error-color)}`)),(0,i.Cg)([(0,o.MZ)({attribute:!1})],f.prototype,"hass",void 0),(0,i.Cg)([(0,o.MZ)({attribute:!1})],f.prototype,"preview",void 0),(0,i.Cg)([(0,o.MZ)({attribute:"severity"})],f.prototype,"severity",void 0),(0,i.Cg)([(0,o.wk)()],f.prototype,"_config",void 0),f=(0,i.Cg)([(0,o.EM)("hui-error-card")],f)},85979:function(e,t,a){a.a(e,async function(e,i){try{a.d(t,{j:function(){return f}});var r=a(40445),o=a(58888),n=a(5124),s=a(67576),c=a(38962),l=(a(4397),e([c]));c=(l.then?(await l)():l)[0];let d,h=e=>e;const f=(e,t)=>e.config.state!==o.m2?e.localize("ui.card.common.entity_not_found"):e.localize("ui.panel.lovelace.warning.starting");class u extends n.WF{render(){return(0,n.qy)(d||(d=h`<hui-error-card .hass="${0}" severity="warning"><slot></slot></hui-error-card>`),this.hass)}}(0,r.Cg)([(0,s.MZ)({attribute:!1})],u.prototype,"hass",void 0),u=(0,r.Cg)([(0,s.EM)("hui-warning")],u),i()}catch(d){i(d)}})},69235:function(e,t,a){a.a(e,async function(e,t){try{a(3362),a(62953);"function"!=typeof window.ResizeObserver&&(window.ResizeObserver=(await a.e(71055).then(a.bind(a,52370))).default),t()}catch(i){t(i)}},1)},14503:function(e,t,a){a.d(t,{RF:function(){return f},dp:function(){return p},kO:function(){return v},nA:function(){return u},og:function(){return h}});var i=a(5124);let r,o,n,s,c,l,d=e=>e;const h=(0,i.AH)(r||(r=d`button.link{background:0 0;color:inherit;border:none;padding:0;font:inherit;text-align:left;text-decoration:underline;cursor:pointer;outline:0}`)),f=(0,i.AH)(o||(o=d`:host{font-family:var(--ha-font-family-body);-webkit-font-smoothing:var(--ha-font-smoothing);-moz-osx-font-smoothing:var(--ha-moz-osx-font-smoothing);font-size:var(--ha-font-size-m);font-weight:var(--ha-font-weight-normal);line-height:var(--ha-line-height-normal)}app-header div[sticky]{height:48px}app-toolbar [main-title]{margin-left:20px;margin-inline-start:20px;margin-inline-end:initial}.header{transition:box-shadow .2s linear,width var(--ha-animation-duration-normal) ease,padding-left var(--ha-animation-duration-normal) ease,padding-right var(--ha-animation-duration-normal) ease}@media (prefers-reduced-motion:reduce){.header{transition:box-shadow .2s linear}}h1{font-family:var(--ha-font-family-heading);-webkit-font-smoothing:var(--ha-font-smoothing);-moz-osx-font-smoothing:var(--ha-moz-osx-font-smoothing);font-size:var(--ha-font-size-2xl);font-weight:var(--ha-font-weight-normal);line-height:var(--ha-line-height-condensed)}h2{font-family:var(--ha-font-family-body);-webkit-font-smoothing:var(--ha-font-smoothing);-moz-osx-font-smoothing:var(--ha-moz-osx-font-smoothing);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:var(--ha-font-size-xl);font-weight:var(--ha-font-weight-medium);line-height:var(--ha-line-height-normal)}h3{font-family:var(--ha-font-family-body);-webkit-font-smoothing:var(--ha-font-smoothing);-moz-osx-font-smoothing:var(--ha-moz-osx-font-smoothing);font-size:var(--ha-font-size-l);font-weight:var(--ha-font-weight-normal);line-height:var(--ha-line-height-normal)}a{color:var(--primary-color)}.secondary{color:var(--secondary-text-color)}.error{color:var(--error-color)}.warning{color:var(--error-color)}${0} .card-actions a{text-decoration:none}.card-actions .warning{--mdc-theme-primary:var(--error-color)}.layout.horizontal,.layout.vertical{display:flex}.layout.inline{display:inline-flex}.layout.horizontal{flex-direction:row}.layout.vertical{flex-direction:column}.layout.wrap{flex-wrap:wrap}.layout.no-wrap{flex-wrap:nowrap}.layout.center,.layout.center-center{align-items:center}.layout.bottom{align-items:flex-end}.layout.center-center,.layout.center-justified{justify-content:center}.flex{flex:1;flex-basis:0.000000001px}.flex-auto{flex:1 1 auto}.flex-none{flex:none}.layout.justified{justify-content:space-between}`),h),u=(0,i.AH)(n||(n=d`ha-adaptive-dialog,ha-dialog{--mdc-dialog-min-width:400px;--mdc-dialog-max-width:600px;--mdc-dialog-max-width:min(600px, 95vw);--justify-action-buttons:space-between;--dialog-container-padding:var(--safe-area-inset-top, 0) var(--safe-area-inset-right, 0) var(--safe-area-inset-bottom, 0) var(--safe-area-inset-left, 0);--dialog-surface-padding:0px}ha-adaptive-dialog .form,ha-dialog .form{color:var(--primary-text-color)}a{color:var(--primary-color)}@media all and (max-width:450px),all and (max-height:500px){ha-adaptive-dialog,ha-dialog{--mdc-dialog-min-width:100vw;--mdc-dialog-max-width:100vw;--mdc-dialog-min-height:100vh;--mdc-dialog-min-height:100svh;--mdc-dialog-max-height:100vh;--mdc-dialog-max-height:100svh;--dialog-container-padding:0px;--dialog-surface-padding:var(--safe-area-inset-top, 0) var(--safe-area-inset-right, 0) var(--safe-area-inset-bottom, 0) var(--safe-area-inset-left, 0);--vertical-align-dialog:flex-end}ha-dialog{--ha-dialog-border-radius:var(--ha-border-radius-square)}}.error{color:var(--error-color)}`)),v=(0,i.AH)(s||(s=d`ha-adaptive-dialog,ha-dialog{--vertical-align-dialog:flex-start;--dialog-surface-margin-top:var(--ha-space-10);--mdc-dialog-max-height:calc( 100vh - var(--dialog-surface-margin-top) - var(--ha-space-2) - var( --safe-area-inset-y, 0px ) );--mdc-dialog-max-height:calc( 100svh - var(--dialog-surface-margin-top) - var(--ha-space-2) - var( --safe-area-inset-y, 0px ) );--ha-dialog-max-height:calc( 100vh - var(--dialog-surface-margin-top) - var(--ha-space-2) - var( --safe-area-inset-y, 0px ) );--ha-dialog-max-height:calc( 100svh - var(--dialog-surface-margin-top) - var(--ha-space-2) - var( --safe-area-inset-y, 0px ) )}@media all and (max-width:450px),all and (max-height:500px){ha-adaptive-dialog,ha-dialog{--dialog-surface-margin-top:0px;--mdc-dialog-min-height:100vh;--mdc-dialog-min-height:100svh;--mdc-dialog-max-height:100vh;--mdc-dialog-max-height:100svh;--ha-dialog-max-height:100vh;--ha-dialog-max-height:100svh}}`)),p=(0,i.AH)(c||(c=d`.ha-scrollbar::-webkit-scrollbar{width:.4rem;height:.4rem}.ha-scrollbar::-webkit-scrollbar-thumb{border-radius:var(--ha-border-radius-sm);background:var(--scrollbar-thumb-color)}.ha-scrollbar{overflow-y:auto;scrollbar-color:var(--scrollbar-thumb-color) transparent;scrollbar-width:thin}`));(0,i.AH)(l||(l=d`body{background-color:var(--primary-background-color);color:var(--primary-text-color);height:calc(100vh - 32px);width:100vw}`))}}]);