UNPKG

iobroker.lovelace

Version:

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

593 lines (528 loc) 50.4 kB
(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([[5397],{81545:(e,t,r)=>{"use strict";r(6294);var i=r(50424),o=r(55358);function n(){n=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,t){["method","field"].forEach((function(r){t.forEach((function(t){t.kind===r&&"own"===t.placement&&this.defineClassElement(e,t)}),this)}),this)},initializeClassElements:function(e,t){var r=e.prototype;["method","field"].forEach((function(i){t.forEach((function(t){var o=t.placement;if(t.kind===i&&("static"===o||"prototype"===o)){var n="static"===o?e:r;this.defineClassElement(n,t)}}),this)}),this)},defineClassElement:function(e,t){var r=t.descriptor;if("field"===t.kind){var i=t.initializer;r={enumerable:r.enumerable,writable:r.writable,configurable:r.configurable,value:void 0===i?void 0:i.call(e)}}Object.defineProperty(e,t.key,r)},decorateClass:function(e,t){var r=[],i=[],o={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,o)}),this),e.forEach((function(e){if(!l(e))return r.push(e);var t=this.decorateElement(e,o);r.push(t.element),r.push.apply(r,t.extras),i.push.apply(i,t.finishers)}),this),!t)return{elements:r,finishers:i};var n=this.decorateConstructor(r,t);return i.push.apply(i,n.finishers),n.finishers=i,n},addElementPlacement:function(e,t,r){var i=t[e.placement];if(!r&&-1!==i.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");i.push(e.key)},decorateElement:function(e,t){for(var r=[],i=[],o=e.decorators,n=o.length-1;n>=0;n--){var a=t[e.placement];a.splice(a.indexOf(e.key),1);var s=this.fromElementDescriptor(e),l=this.toElementFinisherExtras((0,o[n])(s)||s);e=l.element,this.addElementPlacement(e,t),l.finisher&&i.push(l.finisher);var c=l.extras;if(c){for(var d=0;d<c.length;d++)this.addElementPlacement(c[d],t);r.push.apply(r,c)}}return{element:e,finishers:i,extras:r}},decorateConstructor:function(e,t){for(var r=[],i=t.length-1;i>=0;i--){var o=this.fromClassDescriptor(e),n=this.toClassDescriptor((0,t[i])(o)||o);if(void 0!==n.finisher&&r.push(n.finisher),void 0!==n.elements){e=n.elements;for(var a=0;a<e.length-1;a++)for(var s=a+1;s<e.length;s++)if(e[a].key===e[s].key&&e[a].placement===e[s].placement)throw new TypeError("Duplicated element ("+e[a].key+")")}}return{elements:e,finishers:r}},fromElementDescriptor:function(e){var t={kind:e.kind,key:e.key,placement:e.placement,descriptor:e.descriptor};return Object.defineProperty(t,Symbol.toStringTag,{value:"Descriptor",configurable:!0}),"field"===e.kind&&(t.initializer=e.initializer),t},toElementDescriptors:function(e){var t;if(void 0!==e)return(t=e,function(e){if(Array.isArray(e))return e}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return p(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?p(e,t):void 0}}(t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).map((function(e){var t=this.toElementDescriptor(e);return this.disallowProperty(e,"finisher","An element descriptor"),this.disallowProperty(e,"extras","An element descriptor"),t}),this)},toElementDescriptor:function(e){var t=String(e.kind);if("method"!==t&&"field"!==t)throw new TypeError('An element descriptor\'s .kind property must be either "method" or "field", but a decorator created an element descriptor with .kind "'+t+'"');var r=h(e.key),i=String(e.placement);if("static"!==i&&"prototype"!==i&&"own"!==i)throw new TypeError('An element descriptor\'s .placement property must be one of "static", "prototype" or "own", but a decorator created an element descriptor with .placement "'+i+'"');var o=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var n={kind:t,key:r,placement:i,descriptor:Object.assign({},o)};return"field"!==t?this.disallowProperty(e,"initializer","A method descriptor"):(this.disallowProperty(o,"get","The property descriptor of a field descriptor"),this.disallowProperty(o,"set","The property descriptor of a field descriptor"),this.disallowProperty(o,"value","The property descriptor of a field descriptor"),n.initializer=e.initializer),n},toElementFinisherExtras:function(e){return{element:this.toElementDescriptor(e),finisher:d(e,"finisher"),extras:this.toElementDescriptors(e.extras)}},fromClassDescriptor:function(e){var t={kind:"class",elements:e.map(this.fromElementDescriptor,this)};return Object.defineProperty(t,Symbol.toStringTag,{value:"Descriptor",configurable:!0}),t},toClassDescriptor:function(e){var t=String(e.kind);if("class"!==t)throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator created a class descriptor with .kind "'+t+'"');this.disallowProperty(e,"key","A class descriptor"),this.disallowProperty(e,"placement","A class descriptor"),this.disallowProperty(e,"descriptor","A class descriptor"),this.disallowProperty(e,"initializer","A class descriptor"),this.disallowProperty(e,"extras","A class descriptor");var r=d(e,"finisher");return{elements:this.toElementDescriptors(e.elements),finisher:r}},runClassFinishers:function(e,t){for(var r=0;r<t.length;r++){var i=(0,t[r])(e);if(void 0!==i){if("function"!=typeof i)throw new TypeError("Finishers must return a constructor.");e=i}}return e},disallowProperty:function(e,t,r){if(void 0!==e[t])throw new TypeError(r+" can't have a ."+t+" property.")}};return e}function a(e){var t,r=h(e.key);"method"===e.kind?t={value:e.value,writable:!0,configurable:!0,enumerable:!1}:"get"===e.kind?t={get:e.value,configurable:!0,enumerable:!1}:"set"===e.kind?t={set:e.value,configurable:!0,enumerable:!1}:"field"===e.kind&&(t={configurable:!0,writable:!0,enumerable:!0});var i={kind:"field"===e.kind?"field":"method",key:r,placement:e.static?"static":"field"===e.kind?"own":"prototype",descriptor:t};return e.decorators&&(i.decorators=e.decorators),"field"===e.kind&&(i.initializer=e.value),i}function s(e,t){void 0!==e.descriptor.get?t.descriptor.get=e.descriptor.get:t.descriptor.set=e.descriptor.set}function l(e){return e.decorators&&e.decorators.length}function c(e){return void 0!==e&&!(void 0===e.value&&void 0===e.writable)}function d(e,t){var r=e[t];if(void 0!==r&&"function"!=typeof r)throw new TypeError("Expected '"+t+"' to be a function");return r}function h(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r<t;r++)i[r]=e[r];return i}!function(e,t,r,i){var o=n();if(i)for(var d=0;d<i.length;d++)o=i[d](o);var h=t((function(e){o.initializeInstanceElements(e,p.elements)}),r),p=o.decorateClass(function(e){for(var t=[],r=function(e){return"method"===e.kind&&e.key===n.key&&e.placement===n.placement},i=0;i<e.length;i++){var o,n=e[i];if("method"===n.kind&&(o=t.find(r)))if(c(n.descriptor)||c(o.descriptor)){if(l(n)||l(o))throw new ReferenceError("Duplicated methods ("+n.key+") can't be decorated.");o.descriptor=n.descriptor}else{if(l(n)){if(l(o))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+n.key+").");o.decorators=n.decorators}s(n,o)}else t.push(n)}return t}(h.d.map(a)),e);o.initializeClassElements(h.F,p.elements),o.runClassFinishers(h.F,p.finishers)}([(0,o.Mo)("ha-button-menu")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,o.Cb)()],key:"corner",value:()=>"TOP_START"},{kind:"field",decorators:[(0,o.Cb)({type:Boolean})],key:"multi",value:()=>!1},{kind:"field",decorators:[(0,o.Cb)({type:Boolean})],key:"activatable",value:()=>!1},{kind:"field",decorators:[(0,o.Cb)({type:Boolean})],key:"disabled",value:()=>!1},{kind:"field",decorators:[(0,o.Cb)({type:Boolean})],key:"fixed",value:()=>!1},{kind:"field",decorators:[(0,o.IO)("mwc-menu",!0)],key:"_menu",value:void 0},{kind:"get",key:"items",value:function(){var e;return null===(e=this._menu)||void 0===e?void 0:e.items}},{kind:"get",key:"selected",value:function(){var e;return null===(e=this._menu)||void 0===e?void 0:e.selected}},{kind:"method",key:"render",value:function(){return i.dy` <div @click=${this._handleClick}> <slot name="trigger"></slot> </div> <mwc-menu .corner=${this.corner} .fixed=${this.fixed} .multi=${this.multi} .activatable=${this.activatable} > <slot></slot> </mwc-menu> `}},{kind:"method",key:"_handleClick",value:function(){this.disabled||(this._menu.anchor=this,this._menu.show())}},{kind:"get",static:!0,key:"styles",value:function(){return i.iv` :host { display: inline-block; position: relative; } ::slotted([disabled]) { color: var(--disabled-text-color); } `}}]}}),i.oi)},36125:(e,t,r)=>{"use strict";var i=r(20839);function o(){o=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,t){["method","field"].forEach((function(r){t.forEach((function(t){t.kind===r&&"own"===t.placement&&this.defineClassElement(e,t)}),this)}),this)},initializeClassElements:function(e,t){var r=e.prototype;["method","field"].forEach((function(i){t.forEach((function(t){var o=t.placement;if(t.kind===i&&("static"===o||"prototype"===o)){var n="static"===o?e:r;this.defineClassElement(n,t)}}),this)}),this)},defineClassElement:function(e,t){var r=t.descriptor;if("field"===t.kind){var i=t.initializer;r={enumerable:r.enumerable,writable:r.writable,configurable:r.configurable,value:void 0===i?void 0:i.call(e)}}Object.defineProperty(e,t.key,r)},decorateClass:function(e,t){var r=[],i=[],o={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,o)}),this),e.forEach((function(e){if(!s(e))return r.push(e);var t=this.decorateElement(e,o);r.push(t.element),r.push.apply(r,t.extras),i.push.apply(i,t.finishers)}),this),!t)return{elements:r,finishers:i};var n=this.decorateConstructor(r,t);return i.push.apply(i,n.finishers),n.finishers=i,n},addElementPlacement:function(e,t,r){var i=t[e.placement];if(!r&&-1!==i.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");i.push(e.key)},decorateElement:function(e,t){for(var r=[],i=[],o=e.decorators,n=o.length-1;n>=0;n--){var a=t[e.placement];a.splice(a.indexOf(e.key),1);var s=this.fromElementDescriptor(e),l=this.toElementFinisherExtras((0,o[n])(s)||s);e=l.element,this.addElementPlacement(e,t),l.finisher&&i.push(l.finisher);var c=l.extras;if(c){for(var d=0;d<c.length;d++)this.addElementPlacement(c[d],t);r.push.apply(r,c)}}return{element:e,finishers:i,extras:r}},decorateConstructor:function(e,t){for(var r=[],i=t.length-1;i>=0;i--){var o=this.fromClassDescriptor(e),n=this.toClassDescriptor((0,t[i])(o)||o);if(void 0!==n.finisher&&r.push(n.finisher),void 0!==n.elements){e=n.elements;for(var a=0;a<e.length-1;a++)for(var s=a+1;s<e.length;s++)if(e[a].key===e[s].key&&e[a].placement===e[s].placement)throw new TypeError("Duplicated element ("+e[a].key+")")}}return{elements:e,finishers:r}},fromElementDescriptor:function(e){var t={kind:e.kind,key:e.key,placement:e.placement,descriptor:e.descriptor};return Object.defineProperty(t,Symbol.toStringTag,{value:"Descriptor",configurable:!0}),"field"===e.kind&&(t.initializer=e.initializer),t},toElementDescriptors:function(e){var t;if(void 0!==e)return(t=e,function(e){if(Array.isArray(e))return e}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return h(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?h(e,t):void 0}}(t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).map((function(e){var t=this.toElementDescriptor(e);return this.disallowProperty(e,"finisher","An element descriptor"),this.disallowProperty(e,"extras","An element descriptor"),t}),this)},toElementDescriptor:function(e){var t=String(e.kind);if("method"!==t&&"field"!==t)throw new TypeError('An element descriptor\'s .kind property must be either "method" or "field", but a decorator created an element descriptor with .kind "'+t+'"');var r=d(e.key),i=String(e.placement);if("static"!==i&&"prototype"!==i&&"own"!==i)throw new TypeError('An element descriptor\'s .placement property must be one of "static", "prototype" or "own", but a decorator created an element descriptor with .placement "'+i+'"');var o=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var n={kind:t,key:r,placement:i,descriptor:Object.assign({},o)};return"field"!==t?this.disallowProperty(e,"initializer","A method descriptor"):(this.disallowProperty(o,"get","The property descriptor of a field descriptor"),this.disallowProperty(o,"set","The property descriptor of a field descriptor"),this.disallowProperty(o,"value","The property descriptor of a field descriptor"),n.initializer=e.initializer),n},toElementFinisherExtras:function(e){return{element:this.toElementDescriptor(e),finisher:c(e,"finisher"),extras:this.toElementDescriptors(e.extras)}},fromClassDescriptor:function(e){var t={kind:"class",elements:e.map(this.fromElementDescriptor,this)};return Object.defineProperty(t,Symbol.toStringTag,{value:"Descriptor",configurable:!0}),t},toClassDescriptor:function(e){var t=String(e.kind);if("class"!==t)throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator created a class descriptor with .kind "'+t+'"');this.disallowProperty(e,"key","A class descriptor"),this.disallowProperty(e,"placement","A class descriptor"),this.disallowProperty(e,"descriptor","A class descriptor"),this.disallowProperty(e,"initializer","A class descriptor"),this.disallowProperty(e,"extras","A class descriptor");var r=c(e,"finisher");return{elements:this.toElementDescriptors(e.elements),finisher:r}},runClassFinishers:function(e,t){for(var r=0;r<t.length;r++){var i=(0,t[r])(e);if(void 0!==i){if("function"!=typeof i)throw new TypeError("Finishers must return a constructor.");e=i}}return e},disallowProperty:function(e,t,r){if(void 0!==e[t])throw new TypeError(r+" can't have a ."+t+" property.")}};return e}function n(e){var t,r=d(e.key);"method"===e.kind?t={value:e.value,writable:!0,configurable:!0,enumerable:!1}:"get"===e.kind?t={get:e.value,configurable:!0,enumerable:!1}:"set"===e.kind?t={set:e.value,configurable:!0,enumerable:!1}:"field"===e.kind&&(t={configurable:!0,writable:!0,enumerable:!0});var i={kind:"field"===e.kind?"field":"method",key:r,placement:e.static?"static":"field"===e.kind?"own":"prototype",descriptor:t};return e.decorators&&(i.decorators=e.decorators),"field"===e.kind&&(i.initializer=e.value),i}function a(e,t){void 0!==e.descriptor.get?t.descriptor.get=e.descriptor.get:t.descriptor.set=e.descriptor.set}function s(e){return e.decorators&&e.decorators.length}function l(e){return void 0!==e&&!(void 0===e.value&&void 0===e.writable)}function c(e,t){var r=e[t];if(void 0!==r&&"function"!=typeof r)throw new TypeError("Expected '"+t+"' to be a function");return r}function d(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r<t;r++)i[r]=e[r];return i}function p(e,t,r){return(p="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var i=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=m(e)););return e}(e,t);if(i){var o=Object.getOwnPropertyDescriptor(i,t);return o.get?o.get.call(r):o.value}})(e,t,r||e)}function m(e){return(m=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}!function(e,t,r,i){var c=o();if(i)for(var d=0;d<i.length;d++)c=i[d](c);var h=t((function(e){c.initializeInstanceElements(e,p.elements)}),r),p=c.decorateClass(function(e){for(var t=[],r=function(e){return"method"===e.kind&&e.key===n.key&&e.placement===n.placement},i=0;i<e.length;i++){var o,n=e[i];if("method"===n.kind&&(o=t.find(r)))if(l(n.descriptor)||l(o.descriptor)){if(s(n)||s(o))throw new ReferenceError("Duplicated methods ("+n.key+") can't be decorated.");o.descriptor=n.descriptor}else{if(s(n)){if(s(o))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+n.key+").");o.decorators=n.decorators}a(n,o)}else t.push(n)}return t}(h.d.map(n)),e);c.initializeClassElements(h.F,p.elements),c.runClassFinishers(h.F,p.finishers)}([(0,r(55358).Mo)("ha-fab")],(function(e,t){class r extends t{constructor(...t){super(...t),e(this)}}return{F:r,d:[{kind:"method",key:"firstUpdated",value:function(e){p(m(r.prototype),"firstUpdated",this).call(this,e),this.style.setProperty("--mdc-theme-secondary","var(--primary-color)")}}]}}),i.L)},95397:(e,t,r)=>{"use strict";r(53918),r(62613),r(87724);var i=r(68546),o=(r(53973),r(51095),r(54444),r(50424)),n=r(55358),a=r(76666),s=r(82816),l=r(92483),c=r(47181),d=r(87744),h=r(38346),p=r(69371),m=r(26765),u=r(54845),f=r(11654),y=r(27322);r(74535),r(81545),r(22098),r(31206),r(36125),r(52039);function v(){v=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,t){["method","field"].forEach((function(r){t.forEach((function(t){t.kind===r&&"own"===t.placement&&this.defineClassElement(e,t)}),this)}),this)},initializeClassElements:function(e,t){var r=e.prototype;["method","field"].forEach((function(i){t.forEach((function(t){var o=t.placement;if(t.kind===i&&("static"===o||"prototype"===o)){var n="static"===o?e:r;this.defineClassElement(n,t)}}),this)}),this)},defineClassElement:function(e,t){var r=t.descriptor;if("field"===t.kind){var i=t.initializer;r={enumerable:r.enumerable,writable:r.writable,configurable:r.configurable,value:void 0===i?void 0:i.call(e)}}Object.defineProperty(e,t.key,r)},decorateClass:function(e,t){var r=[],i=[],o={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,o)}),this),e.forEach((function(e){if(!w(e))return r.push(e);var t=this.decorateElement(e,o);r.push(t.element),r.push.apply(r,t.extras),i.push.apply(i,t.finishers)}),this),!t)return{elements:r,finishers:i};var n=this.decorateConstructor(r,t);return i.push.apply(i,n.finishers),n.finishers=i,n},addElementPlacement:function(e,t,r){var i=t[e.placement];if(!r&&-1!==i.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");i.push(e.key)},decorateElement:function(e,t){for(var r=[],i=[],o=e.decorators,n=o.length-1;n>=0;n--){var a=t[e.placement];a.splice(a.indexOf(e.key),1);var s=this.fromElementDescriptor(e),l=this.toElementFinisherExtras((0,o[n])(s)||s);e=l.element,this.addElementPlacement(e,t),l.finisher&&i.push(l.finisher);var c=l.extras;if(c){for(var d=0;d<c.length;d++)this.addElementPlacement(c[d],t);r.push.apply(r,c)}}return{element:e,finishers:i,extras:r}},decorateConstructor:function(e,t){for(var r=[],i=t.length-1;i>=0;i--){var o=this.fromClassDescriptor(e),n=this.toClassDescriptor((0,t[i])(o)||o);if(void 0!==n.finisher&&r.push(n.finisher),void 0!==n.elements){e=n.elements;for(var a=0;a<e.length-1;a++)for(var s=a+1;s<e.length;s++)if(e[a].key===e[s].key&&e[a].placement===e[s].placement)throw new TypeError("Duplicated element ("+e[a].key+")")}}return{elements:e,finishers:r}},fromElementDescriptor:function(e){var t={kind:e.kind,key:e.key,placement:e.placement,descriptor:e.descriptor};return Object.defineProperty(t,Symbol.toStringTag,{value:"Descriptor",configurable:!0}),"field"===e.kind&&(t.initializer=e.initializer),t},toElementDescriptors:function(e){var t;if(void 0!==e)return(t=e,function(e){if(Array.isArray(e))return e}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return E(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?E(e,t):void 0}}(t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).map((function(e){var t=this.toElementDescriptor(e);return this.disallowProperty(e,"finisher","An element descriptor"),this.disallowProperty(e,"extras","An element descriptor"),t}),this)},toElementDescriptor:function(e){var t=String(e.kind);if("method"!==t&&"field"!==t)throw new TypeError('An element descriptor\'s .kind property must be either "method" or "field", but a decorator created an element descriptor with .kind "'+t+'"');var r=x(e.key),i=String(e.placement);if("static"!==i&&"prototype"!==i&&"own"!==i)throw new TypeError('An element descriptor\'s .placement property must be one of "static", "prototype" or "own", but a decorator created an element descriptor with .placement "'+i+'"');var o=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var n={kind:t,key:r,placement:i,descriptor:Object.assign({},o)};return"field"!==t?this.disallowProperty(e,"initializer","A method descriptor"):(this.disallowProperty(o,"get","The property descriptor of a field descriptor"),this.disallowProperty(o,"set","The property descriptor of a field descriptor"),this.disallowProperty(o,"value","The property descriptor of a field descriptor"),n.initializer=e.initializer),n},toElementFinisherExtras:function(e){return{element:this.toElementDescriptor(e),finisher:_(e,"finisher"),extras:this.toElementDescriptors(e.extras)}},fromClassDescriptor:function(e){var t={kind:"class",elements:e.map(this.fromElementDescriptor,this)};return Object.defineProperty(t,Symbol.toStringTag,{value:"Descriptor",configurable:!0}),t},toClassDescriptor:function(e){var t=String(e.kind);if("class"!==t)throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator created a class descriptor with .kind "'+t+'"');this.disallowProperty(e,"key","A class descriptor"),this.disallowProperty(e,"placement","A class descriptor"),this.disallowProperty(e,"descriptor","A class descriptor"),this.disallowProperty(e,"initializer","A class descriptor"),this.disallowProperty(e,"extras","A class descriptor");var r=_(e,"finisher");return{elements:this.toElementDescriptors(e.elements),finisher:r}},runClassFinishers:function(e,t){for(var r=0;r<t.length;r++){var i=(0,t[r])(e);if(void 0!==i){if("function"!=typeof i)throw new TypeError("Finishers must return a constructor.");e=i}}return e},disallowProperty:function(e,t,r){if(void 0!==e[t])throw new TypeError(r+" can't have a ."+t+" property.")}};return e}function b(e){var t,r=x(e.key);"method"===e.kind?t={value:e.value,writable:!0,configurable:!0,enumerable:!1}:"get"===e.kind?t={get:e.value,configurable:!0,enumerable:!1}:"set"===e.kind?t={set:e.value,configurable:!0,enumerable:!1}:"field"===e.kind&&(t={configurable:!0,writable:!0,enumerable:!0});var i={kind:"field"===e.kind?"field":"method",key:r,placement:e.static?"static":"field"===e.kind?"own":"prototype",descriptor:t};return e.decorators&&(i.decorators=e.decorators),"field"===e.kind&&(i.initializer=e.value),i}function g(e,t){void 0!==e.descriptor.get?t.descriptor.get=e.descriptor.get:t.descriptor.set=e.descriptor.set}function w(e){return e.decorators&&e.decorators.length}function k(e){return void 0!==e&&!(void 0===e.value&&void 0===e.writable)}function _(e,t){var r=e[t];if(void 0!==r&&"function"!=typeof r)throw new TypeError("Expected '"+t+"' to be a function");return r}function x(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function E(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r<t;r++)i[r]=e[r];return i}function $(e,t,r){return($="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var i=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=P(e)););return e}(e,t);if(i){var o=Object.getOwnPropertyDescriptor(i,t);return o.get?o.get.call(r):o.value}})(e,t,r||e)}function P(e){return(P=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}!function(e,t,r,i){var o=v();if(i)for(var n=0;n<i.length;n++)o=i[n](o);var a=t((function(e){o.initializeInstanceElements(e,s.elements)}),r),s=o.decorateClass(function(e){for(var t=[],r=function(e){return"method"===e.kind&&e.key===n.key&&e.placement===n.placement},i=0;i<e.length;i++){var o,n=e[i];if("method"===n.kind&&(o=t.find(r)))if(k(n.descriptor)||k(o.descriptor)){if(w(n)||w(o))throw new ReferenceError("Duplicated methods ("+n.key+") can't be decorated.");o.descriptor=n.descriptor}else{if(w(n)){if(w(o))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+n.key+").");o.decorators=n.decorators}g(n,o)}else t.push(n)}return t}(a.d.map(b)),e);o.initializeClassElements(a.F,s.elements),o.runClassFinishers(a.F,s.finishers)}([(0,n.Mo)("ha-media-player-browse")],(function(e,t){class r extends t{constructor(...t){super(...t),e(this)}}return{F:r,d:[{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,n.Cb)()],key:"entityId",value:void 0},{kind:"field",decorators:[(0,n.Cb)()],key:"mediaContentId",value:void 0},{kind:"field",decorators:[(0,n.Cb)()],key:"mediaContentType",value:void 0},{kind:"field",decorators:[(0,n.Cb)()],key:"action",value:()=>"play"},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"dialog",value:()=>!1},{kind:"field",decorators:[(0,n.Cb)({type:Boolean,attribute:"narrow",reflect:!0})],key:"_narrow",value:()=>!1},{kind:"field",decorators:[(0,n.Cb)({type:Boolean,attribute:"scroll",reflect:!0})],key:"_scrolled",value:()=>!1},{kind:"field",decorators:[(0,n.SB)()],key:"_loading",value:()=>!1},{kind:"field",decorators:[(0,n.SB)()],key:"_error",value:void 0},{kind:"field",decorators:[(0,n.SB)()],key:"_mediaPlayerItems",value:()=>[]},{kind:"field",decorators:[(0,n.IO)(".header")],key:"_header",value:void 0},{kind:"field",decorators:[(0,n.IO)(".content")],key:"_content",value:void 0},{kind:"field",key:"_headerOffsetHeight",value:()=>0},{kind:"field",key:"_resizeObserver",value:void 0},{kind:"method",key:"connectedCallback",value:function(){$(P(r.prototype),"connectedCallback",this).call(this),this.updateComplete.then((()=>this._attachObserver()))}},{kind:"method",key:"disconnectedCallback",value:function(){this._resizeObserver&&this._resizeObserver.disconnect()}},{kind:"method",key:"navigateBack",value:function(){this._mediaPlayerItems.pop();const e=this._mediaPlayerItems.pop();e&&this._navigate(e)}},{kind:"method",key:"render",value:function(){var e;if(this._loading)return o.dy`<ha-circular-progress active></ha-circular-progress>`;if(this._error&&!this._mediaPlayerItems.length){if(!this.dialog)return o.dy` <div class="container">${this._renderError(this._error)}</div> `;this._closeDialogAction(),(0,m.Ys)(this,{title:this.hass.localize("ui.components.media-browser.media_browsing_error"),text:this._renderError(this._error)})}if(!this._mediaPlayerItems.length)return o.dy``;const t=this._mediaPlayerItems[this._mediaPlayerItems.length-1],r=this._mediaPlayerItems.length>1?this._mediaPlayerItems[this._mediaPlayerItems.length-2]:void 0,n=this.hass.localize(`ui.components.media-browser.class.${t.media_class}`),c=p.Fn[t.media_class],h=p.Fn[t.children_media_class];return o.dy` <div class="header ${(0,a.$)({"no-img":!t.thumbnail,"no-dialog":!this.dialog})}" @transitionend=${this._setHeaderHeight} > <div class="header-content"> ${t.thumbnail?o.dy` <div class="img" style=${(0,l.V)({backgroundImage:t.thumbnail?`url(${t.thumbnail})`:"none"})} > ${this._narrow&&null!=t&&t.can_play?o.dy` <ha-fab mini .item=${t} @click=${this._actionClicked} > <ha-svg-icon slot="icon" .label=${this.hass.localize(`ui.components.media-browser.${this.action}-media`)} .path=${"play"===this.action?i._86:i.qX5} ></ha-svg-icon> ${this.hass.localize(`ui.components.media-browser.${this.action}`)} </ha-fab> `:""} </div> `:o.dy``} <div class="header-info"> <div class="breadcrumb"> ${r?o.dy` <div class="previous-title" @click=${this.navigateBack}> <ha-svg-icon .path=${i.J3k}></ha-svg-icon> ${r.title} </div> `:""} <h1 class="title">${t.title}</h1> ${n?o.dy` <h2 class="subtitle">${n}</h2> `:""} </div> ${!t.can_play||t.thumbnail&&this._narrow?"":o.dy` <mwc-button raised .item=${t} @click=${this._actionClicked} > <ha-svg-icon .label=${this.hass.localize(`ui.components.media-browser.${this.action}-media`)} .path=${"play"===this.action?i._86:i.qX5} ></ha-svg-icon> ${this.hass.localize(`ui.components.media-browser.${this.action}`)} </mwc-button> `} </div> </div> ${this.dialog?o.dy` <mwc-icon-button aria-label=${this.hass.localize("ui.dialogs.generic.close")} @click=${this._closeDialogAction} class="header_button" dir=${(0,d.Zu)(this.hass)} > <ha-svg-icon .path=${i.r5M}></ha-svg-icon> </mwc-icon-button> `:""} </div> <div class="content" @scroll=${this._scroll} @touchmove=${this._scroll}> ${this._error?o.dy` <div class="container">${this._renderError(this._error)}</div> `:null!==(e=t.children)&&void 0!==e&&e.length?"grid"===h.layout?o.dy` <div class="children ${(0,a.$)({portrait:"portrait"===h.thumbnail_ratio})}" > ${t.children.map((e=>o.dy` <div class="child" .item=${e} @click=${this._childClicked} > <div class="ha-card-parent"> <ha-card outlined style=${(0,l.V)({backgroundImage:e.thumbnail?`url(${e.thumbnail})`:"none"})} > ${e.thumbnail?"":o.dy` <ha-svg-icon class="folder" .path=${p.Fn["directory"===e.media_class&&e.children_media_class||e.media_class].icon} ></ha-svg-icon> `} </ha-card> ${e.can_play?o.dy` <mwc-icon-button class="play ${(0,a.$)({can_expand:e.can_expand})}" .item=${e} .label=${this.hass.localize(`ui.components.media-browser.${this.action}-media`)} @click=${this._actionClicked} > <ha-svg-icon .path=${"play"===this.action?i._86:i.qX5} ></ha-svg-icon> </mwc-icon-button> `:""} </div> <div class="title"> ${e.title} <paper-tooltip fitToVisibleBounds position="top" offset="4" >${e.title}</paper-tooltip > </div> <div class="type"> ${this.hass.localize(`ui.components.media-browser.content-type.${e.media_content_type}`)} </div> </div> `))} </div> `:o.dy` <mwc-list> ${t.children.map((e=>o.dy` <mwc-list-item @click=${this._childClicked} .item=${e} graphic="avatar" hasMeta dir=${(0,d.Zu)(this.hass)} > <div class="graphic" style=${(0,s.o)(c.show_list_images&&e.thumbnail?`background-image: url(${e.thumbnail})`:void 0)} slot="graphic" > <mwc-icon-button class="play ${(0,a.$)({show:!c.show_list_images||!e.thumbnail})}" .item=${e} .label=${this.hass.localize(`ui.components.media-browser.${this.action}-media`)} @click=${this._actionClicked} > <ha-svg-icon .path=${"play"===this.action?i._86:i.qX5} ></ha-svg-icon> </mwc-icon-button> </div> <span class="title">${e.title}</span> </mwc-list-item> <li divider role="separator"></li> `))} </mwc-list> `:o.dy` <div class="container"> ${this.hass.localize("ui.components.media-browser.no_items")} <br /> ${"media-source://media_source/local/."===t.media_content_id?o.dy`<br />${this.hass.localize("ui.components.media-browser.learn_adding_local_media","documentation",o.dy`<a href="${(0,y.R)(this.hass,"/more-info/local-media/add-media")}" target="_blank" rel="noreferrer" >${this.hass.localize("ui.components.media-browser.documentation")}</a >`)} <br /> ${this.hass.localize("ui.components.media-browser.local_media_files")}`:""} </div> `} </div> `}},{kind:"method",key:"firstUpdated",value:function(){this._measureCard(),this._attachObserver()}},{kind:"method",key:"updated",value:function(e){$(P(r.prototype),"updated",this).call(this,e),e.has("_mediaPlayerItems")&&this._mediaPlayerItems.length&&this._setHeaderHeight(),void 0!==e.get("_scrolled")&&this._mediaPlayerItems.length&&this._animateHeaderHeight(),(e.has("entityId")||e.has("mediaContentId")||e.has("mediaContentType")||e.has("action"))&&(e.has("entityId")&&(this._error=void 0,this._mediaPlayerItems=[]),this._fetchData(this.mediaContentId,this.mediaContentType).then((e=>{e&&(this._mediaPlayerItems=[e])})).catch((e=>{this._error=e})))}},{kind:"method",key:"_setHeaderHeight",value:async function(){await this.updateComplete;const e=this._header,t=this._content;e&&t&&(this._headerOffsetHeight=e.offsetHeight,t.style.marginTop=`${this._headerOffsetHeight}px`,t.style.maxHeight=`calc(var(--media-browser-max-height, 100%) - ${this._headerOffsetHeight}px)`)}},{kind:"method",key:"_animateHeaderHeight",value:function(){let e;const t=r=>{void 0===e&&(e=r);const i=r-e;this._setHeaderHeight(),i<400&&requestAnimationFrame(t)};requestAnimationFrame(t)}},{kind:"method",key:"_actionClicked",value:function(e){e.stopPropagation();const t=e.currentTarget.item;this._runAction(t)}},{kind:"method",key:"_runAction",value:function(e){(0,c.B)(this,"media-picked",{item:e})}},{kind:"method",key:"_childClicked",value:async function(e){const t=e.currentTarget.item;t&&(t.can_expand?this._navigate(t):this._runAction(t))}},{kind:"method",key:"_navigate",value:async function(e){var t;let r;this._error=void 0;try{r=await this._fetchData(e.media_content_id,e.media_content_type)}catch(e){return void(0,m.Ys)(this,{title:this.hass.localize("ui.components.media-browser.media_browsing_error"),text:this._renderError(e)})}null===(t=this._content)||void 0===t||t.scrollTo(0,0),this._scrolled=!1,this._mediaPlayerItems=[...this._mediaPlayerItems,r]}},{kind:"method",key:"_fetchData",value:async function(e,t){let r;this._loading=!0;try{r=this.entityId!==p.N8?await(0,p.zz)(this.hass,this.entityId,e,t):await(0,p.b)(this.hass,e)}finally{this._loading=!1}return r}},{kind:"method",key:"_measureCard",value:function(){this._narrow=(this.dialog?window.innerWidth:this.offsetWidth)<450}},{kind:"method",decorators:[(0,n.hO)({passive:!0})],key:"_scroll",value:function(e){const t=e.currentTarget;!this._scrolled&&t.scrollTop>this._headerOffsetHeight?this._scrolled=!0:this._scrolled&&t.scrollTop<this._headerOffsetHeight&&(this._scrolled=!1)}},{kind:"method",key:"_attachObserver",value:async function(){this._resizeObserver||(await(0,u.P)(),this._resizeObserver=new ResizeObserver((0,h.D)((()=>this._measureCard()),250,!1))),this._resizeObserver.observe(this)}},{kind:"method",key:"_closeDialogAction",value:function(){(0,c.B)(this,"close-dialog")}},{kind:"method",key:"_renderError",value:function(e){return"Media directory does not exist."===e.message?o.dy` <h2> ${this.hass.localize("ui.components.media-browser.no_local_media_found")} </h2> <p> ${this.hass.localize("ui.components.media-browser.no_media_folder")} <br /> ${this.hass.localize("ui.components.media-browser.setup_local_help","documentation",o.dy`<a href="${(0,y.R)(this.hass,"/more-info/local-media/setup-media")}" target="_blank" rel="noreferrer" >${this.hass.localize("ui.components.media-browser.documentation")}</a >`)} <br /> ${this.hass.localize("ui.components.media-browser.local_media_files")} </p> `:o.dy`<span class="error">${e.message}</span>`}},{kind:"get",static:!0,key:"styles",value:function(){return[f.Qx,o.iv` :host { display: flex; flex-direction: column; position: relative; } ha-circular-progress { --mdc-theme-primary: var(--primary-color); display: flex; justify-content: center; margin: 40px; } .container { padding: 16px; } .content { overflow-y: auto; padding-bottom: 20px; box-sizing: border-box; } .header { display: flex; justify-content: space-between; border-bottom: 1px solid var(--divider-color); background-color: var(--card-background-color); position: absolute; top: 0; right: 0; left: 0; z-index: 5; padding: 20px 24px 10px; } .header_button { position: relative; right: -8px; } .header-content { display: flex; flex-wrap: wrap; flex-grow: 1; align-items: flex-start; } .header-content .img { height: 200px; width: 200px; margin-right: 16px; background-size: cover; border-radius: 4px; transition: width 0.4s, height 0.4s; } .header-info { display: flex; flex-direction: column; justify-content: space-between; align-self: stretch; min-width: 0; flex: 1; } .header-info mwc-button { display: block; --mdc-theme-primary: var(--primary-color); } .breadcrumb { display: flex; flex-direction: column; overflow: hidden; flex-grow: 1; } .breadcrumb .title { font-size: 32px; line-height: 1.2; font-weight: bold; margin: 0; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; padding-right: 8px; } .breadcrumb .previous-title { font-size: 14px; padding-bottom: 8px; color: var(--secondary-text-color); overflow: hidden; text-overflow: ellipsis; cursor: pointer; --mdc-icon-size: 14px; } .breadcrumb .subtitle { font-size: 16px; overflow: hidden; text-overflow: ellipsis; margin-bottom: 0; transition: height 0.5s, margin 0.5s; } /* ============= CHILDREN ============= */ mwc-list { --mdc-list-vertical-padding: 0; --mdc-list-item-graphic-margin: 0; --mdc-theme-text-icon-on-background: var(--secondary-text-color); margin-top: 10px; } mwc-list li:last-child { display: none; } mwc-list li[divider] { border-bottom-color: var(--divider-color); } .children { display: grid; grid-template-columns: repeat( auto-fit, minmax(var(--media-browse-item-size, 175px), 0.1fr) ); grid-gap: 16px; padding: 0px 24px; margin: 8px 0px; } :host([dialog]) .children { grid-template-columns: repeat( auto-fit, minmax(var(--media-browse-item-size, 175px), 0.33fr) ); } .child { display: flex; flex-direction: column; cursor: pointer; } .ha-card-parent { position: relative; width: 100%; } .children ha-card { width: 100%; padding-bottom: 100%; position: relative; box-sizing: border-box; background-size: cover; background-repeat: no-repeat; background-position: center; transition: padding-bottom 0.1s ease-out; } .portrait.children ha-card { padding-bottom: 150%; } .child .folder, .child .play { position: absolute; } .child .folder { color: var(--secondary-text-color); top: calc(50% - (var(--mdc-icon-size) / 2)); left: calc(50% - (var(--mdc-icon-size) / 2)); --mdc-icon-size: calc(var(--media-browse-item-size, 175px) * 0.4); } .child .play { transition: color 0.5s; border-radius: 50%; bottom: calc(50% - 35px); right: calc(50% - 35px); opacity: 0; transition: opacity 0.1s ease-out; } .child .play:not(.can_expand) { --mdc-icon-button-size: 70px; --mdc-icon-size: 48px; } .ha-card-parent:hover .play:not(.can_expand) { opacity: 1; color: var(--primary-color); } .child .play.can_expand { opacity: 1; background-color: rgba(var(--rgb-card-background-color), 0.5); bottom: 4px; right: 4px; } .child .play:hover { color: var(--primary-color); } .ha-card-parent:hover ha-card { opacity: 0.5; } .child .title { font-size: 16px; padding-top: 8px; padding-left: 2px; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; text-overflow: ellipsis; } .child .type { font-size: 12px; color: var(--secondary-text-color); padding-left: 2px; } mwc-list-item .graphic { background-size: cover; } mwc-list-item .graphic .play { opacity: 0; transition: all 0.5s; background-color: rgba(var(--rgb-card-background-color), 0.5); border-radius: 50%; --mdc-icon-button-size: 40px; } mwc-list-item:hover .graphic .play { opacity: 1; color: var(--primary-color); } mwc-list-item .graphic .play.show { opacity: 1; background-color: transparent; } mwc-list-item .title { margin-left: 16px; } mwc-list-item[dir="rtl"] .title { margin-right: 16px; margin-left: 0; } /* ============= Narrow ============= */ :host([narrow]) { padding: 0; } :host([narrow]) .breadcrumb .title { font-size: 24px; } :host([narrow]) .header { padding: 0; } :host([narrow]) .header.no-dialog { display: block; } :host([narrow]) .header_button { position: absolute; top: 14px; right: 8px; } :host([narrow]) .header-content { flex-direction: column; flex-wrap: nowrap; } :host([narrow]) .header-content .img { height: auto; width: 100%; margin-right: 0; padding-bottom: 50%; margin-bottom: 8px; position: relative; background-position: center; border-radius: 0; transition: width 0.4s, height 0.4s, padding-bottom 0.4s; } ha-fab { position: absolute; --mdc-theme-secondary: var(--primary-color); bottom: -20px; right: 20px; } :host([narrow]) .header-info mwc-button { margin-top: 16px; margin-bottom: 8px; } :host([narrow]) .header-info { padding: 20px 24px 10px; } :host([narrow]) .media-source { padding: 0 24px; } :host([narrow]) .children { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important; } /* ============= Scroll ============= */ :host([scroll]) .breadcrumb .subtitle { height: 0; margin: 0; } :host([scroll]) .breadcrumb .title { -webkit-line-clamp: 1; } :host(:not([narrow])[scroll]) .header:not(.no-img) mwc-icon-button { align-self: center; } :host([scroll]) .header-info mwc-button, .no-img .header-info mwc-button { padding-right: 4px; } :host([scroll][narrow]) .no-img .header-info mwc-button { padding-right: 16px; } :host([scroll]) .header-info { flex-direction: row; } :host([scroll]) .header-info mwc-button { align-self: center; margin-top: 0; margin-bottom: 0; } :host([scroll][narrow]) .no-img .header-info { flex-direction: row-reverse; } :host([scroll][narrow]) .header-info { padding: 20px 24px 10px 24px; align-items: center; } :host([scroll]) .header-content { align-items: flex-end; flex-direction: row; } :host([scroll]) .header-content .img { height: 75px; width: 75px; } :host([scroll][narrow]) .header-content .img { height: 100px; width: 100px; padding-bottom: initial; margin-bottom: 0; } :host([scroll]) ha-fab { bottom: 4px; right: 4px; --mdc-fab-box-shadow