iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
2 lines • 40.9 kB
JavaScript
(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([[3525],{24734:function(e,t,n){"use strict";n.d(t,{B:function(){return i}});var r=n(47181),i=function(e,t){(0,r.B)(e,"show-dialog",{dialogTag:"dialog-media-player-browse",dialogImport:function(){return Promise.all([n.e(8161),n.e(1041),n.e(3967),n.e(1657),n.e(4444),n.e(7724),n.e(2613),n.e(9799),n.e(6294),n.e(839),n.e(7909),n.e(4821),n.e(4535),n.e(5397),n.e(2809)]).then(n.bind(n,52809))},dialogParams:t})}},13525:function(e,t,n){"use strict";n.r(t),n.d(t,{HuiMediaControlCard:function(){return Ee}});n(25230);var r=n(68546),i=(n(85481),n(50424)),o=n(55358),a=n(76666),s=n(92483),c=n(62877),l=n(47181),u=n(91741),d=n(36145),f=n(40095),h=n(67794),p=n.n(h),m=n(74790),v=!1;p()._pipeline.generator.register("default",(function(e){e.sort((function(e,t){return t.population-e.population}));for(var t,n=e[0],r=new Map,i=function(e,t){return r.has(e)||r.set(e,(0,m.$)(n.rgb,t)),r.get(e)>4.5},o=1;o<e.length&&void 0===t;o++){if(i(e[o].hex,e[o].rgb)){v,t=e[o].rgb;break}var a=e[o];v;for(var s=o+1;s<e.length;s++){var c=e[s],l=Math.abs(a.rgb[0]-c.rgb[0])+Math.abs(a.rgb[1]-c.rgb[1])+Math.abs(a.rgb[2]-c.rgb[2]);if(!(l>150)&&i(c.hex,c.rgb)){v,t=c.rgb;break}}}return void 0===t&&(t=n.getYiq()<200?[255,255,255]:[0,0,0]),{foreground:new n.constructor(t,0),background:n}}));var y,g,b,k,_=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16;return new(p())(e,{colorCount:t}).getPalette().then((function(e){var t=e.foreground;return{background:e.background,foreground:t}}))},w=n(38346),E=(n(22098),n(16509),n(10983),n(52039),n(24734)),x=n(56007),C=n(69371),P=n(15688),O=n(53658),S=n(54845);function j(e){return(j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function z(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function A(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function D(e,t){return(D=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function I(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=W(e);if(t){var i=W(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return T(this,n)}}function T(e,t){return!t||"object"!==j(t)&&"function"!=typeof t?B(e):t}function B(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function R(){R=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,t){["method","field"].forEach((function(n){t.forEach((function(t){t.kind===n&&"own"===t.placement&&this.defineClassElement(e,t)}),this)}),this)},initializeClassElements:function(e,t){var n=e.prototype;["method","field"].forEach((function(r){t.forEach((function(t){var i=t.placement;if(t.kind===r&&("static"===i||"prototype"===i)){var o="static"===i?e:n;this.defineClassElement(o,t)}}),this)}),this)},defineClassElement:function(e,t){var n=t.descriptor;if("field"===t.kind){var r=t.initializer;n={enumerable:n.enumerable,writable:n.writable,configurable:n.configurable,value:void 0===r?void 0:r.call(e)}}Object.defineProperty(e,t.key,n)},decorateClass:function(e,t){var n=[],r=[],i={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,i)}),this),e.forEach((function(e){if(!F(e))return n.push(e);var t=this.decorateElement(e,i);n.push(t.element),n.push.apply(n,t.extras),r.push.apply(r,t.finishers)}),this),!t)return{elements:n,finishers:r};var o=this.decorateConstructor(n,t);return r.push.apply(r,o.finishers),o.finishers=r,o},addElementPlacement:function(e,t,n){var r=t[e.placement];if(!n&&-1!==r.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");r.push(e.key)},decorateElement:function(e,t){for(var n=[],r=[],i=e.decorators,o=i.length-1;o>=0;o--){var a=t[e.placement];a.splice(a.indexOf(e.key),1);var s=this.fromElementDescriptor(e),c=this.toElementFinisherExtras((0,i[o])(s)||s);e=c.element,this.addElementPlacement(e,t),c.finisher&&r.push(c.finisher);var l=c.extras;if(l){for(var u=0;u<l.length;u++)this.addElementPlacement(l[u],t);n.push.apply(n,l)}}return{element:e,finishers:r,extras:n}},decorateConstructor:function(e,t){for(var n=[],r=t.length-1;r>=0;r--){var i=this.fromClassDescriptor(e),o=this.toClassDescriptor((0,t[r])(i)||i);if(void 0!==o.finisher&&n.push(o.finisher),void 0!==o.elements){e=o.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:n}},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 n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?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 n=V(e.key),r=String(e.placement);if("static"!==r&&"prototype"!==r&&"own"!==r)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 "'+r+'"');var i=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var o={kind:t,key:n,placement:r,descriptor:Object.assign({},i)};return"field"!==t?this.disallowProperty(e,"initializer","A method descriptor"):(this.disallowProperty(i,"get","The property descriptor of a field descriptor"),this.disallowProperty(i,"set","The property descriptor of a field descriptor"),this.disallowProperty(i,"value","The property descriptor of a field descriptor"),o.initializer=e.initializer),o},toElementFinisherExtras:function(e){return{element:this.toElementDescriptor(e),finisher:N(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 n=N(e,"finisher");return{elements:this.toElementDescriptors(e.elements),finisher:n}},runClassFinishers:function(e,t){for(var n=0;n<t.length;n++){var r=(0,t[n])(e);if(void 0!==r){if("function"!=typeof r)throw new TypeError("Finishers must return a constructor.");e=r}}return e},disallowProperty:function(e,t,n){if(void 0!==e[t])throw new TypeError(n+" can't have a ."+t+" property.")}};return e}function q(e){var t,n=V(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 r={kind:"field"===e.kind?"field":"method",key:n,placement:e.static?"static":"field"===e.kind?"own":"prototype",descriptor:t};return e.decorators&&(r.decorators=e.decorators),"field"===e.kind&&(r.initializer=e.value),r}function M(e,t){void 0!==e.descriptor.get?t.descriptor.get=e.descriptor.get:t.descriptor.set=e.descriptor.set}function F(e){return e.decorators&&e.decorators.length}function U(e){return void 0!==e&&!(void 0===e.value&&void 0===e.writable)}function N(e,t){var n=e[t];if(void 0!==n&&"function"!=typeof n)throw new TypeError("Expected '"+t+"' to be a function");return n}function V(e){var t=function(e,t){if("object"!==j(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==j(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===j(t)?t:String(t)}function H(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function L(e,t,n){return(L="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=W(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}})(e,t,n||e)}function W(e){return(W=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}!function(e,t,n,r){var i=R();if(r)for(var o=0;o<r.length;o++)i=r[o](i);var a=t((function(e){i.initializeInstanceElements(e,s.elements)}),n),s=i.decorateClass(function(e){for(var t=[],n=function(e){return"method"===e.kind&&e.key===o.key&&e.placement===o.placement},r=0;r<e.length;r++){var i,o=e[r];if("method"===o.kind&&(i=t.find(n)))if(U(o.descriptor)||U(i.descriptor)){if(F(o)||F(i))throw new ReferenceError("Duplicated methods ("+o.key+") can't be decorated.");i.descriptor=o.descriptor}else{if(F(o)){if(F(i))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+o.key+").");i.decorators=o.decorators}M(o,i)}else t.push(o)}return t}(a.d.map(q)),e);i.initializeClassElements(a.F,s.elements),i.runClassFinishers(a.F,s.finishers)}([(0,o.Mo)("hui-marquee")],(function(e,t){var n=function(t){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&D(e,t)}(r,t);var n=I(r);function r(){var t;A(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return t=n.call.apply(n,[this].concat(o)),e(B(t)),t}return r}(t);return{F:n,d:[{kind:"field",decorators:[(0,o.Cb)()],key:"text",value:void 0},{kind:"field",decorators:[(0,o.Cb)({type:Boolean})],key:"active",value:void 0},{kind:"field",decorators:[(0,o.Cb)({reflect:!0,type:Boolean,attribute:"animating"})],key:"_animating",value:function(){return!1}},{kind:"method",key:"firstUpdated",value:function(e){var t=this;L(W(n.prototype),"firstUpdated",this).call(this,e),this.addEventListener("mouseover",(function(){return t.classList.add("hovering")}),{capture:!0}),this.addEventListener("mouseout",(function(){return t.classList.remove("hovering")}))}},{kind:"method",key:"updated",value:function(e){L(W(n.prototype),"updated",this).call(this,e),e.has("text")&&this._animating&&(this._animating=!1),e.has("active")&&this.active&&this.offsetWidth<this.scrollWidth&&(this._animating=!0)}},{kind:"method",key:"render",value:function(){return this.text?(0,i.dy)(g||(g=z(['\n <div class="marquee-inner" @animationiteration=',">\n <span>","</span>\n ","\n </div>\n "])),this._onIteration,this.text,this._animating?(0,i.dy)(b||(b=z([" <span>","</span> "])),this.text):""):(0,i.dy)(y||(y=z([""])))}},{kind:"method",key:"_onIteration",value:function(){this.active||(this._animating=!1)}},{kind:"get",static:!0,key:"styles",value:function(){return(0,i.iv)(k||(k=z(["\n :host {\n display: flex;\n position: relative;\n align-items: center;\n height: 1.2em;\n contain: strict;\n }\n\n .marquee-inner {\n position: absolute;\n left: 0;\n right: 0;\n text-overflow: ellipsis;\n overflow: hidden;\n }\n\n :host(.hovering) .marquee-inner {\n text-overflow: initial;\n overflow: initial;\n }\n\n :host([animating]) .marquee-inner {\n left: initial;\n right: initial;\n animation: marquee 10s linear infinite;\n }\n\n :host([animating]) .marquee-inner span {\n padding-right: 16px;\n }\n\n @keyframes marquee {\n 0% {\n transform: translateX(0%);\n }\n 100% {\n transform: translateX(-50%);\n }\n }\n "])))}}]}}),i.oi);var $,X,G,Y,J,K,Q,Z,ee,te,ne,re=n(75502);function ie(e){return(ie="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function oe(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function ae(e,t,n,r,i,o,a){try{var s=e[o](a),c=s.value}catch(l){return void n(l)}s.done?t(c):Promise.resolve(c).then(r,i)}function se(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){ae(o,r,i,a,s,"next",e)}function s(e){ae(o,r,i,a,s,"throw",e)}a(void 0)}))}}function ce(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function le(e,t){return(le=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ue(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=we(e);if(t){var i=we(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return de(this,n)}}function de(e,t){return!t||"object"!==ie(t)&&"function"!=typeof t?fe(e):t}function fe(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function he(){he=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,t){["method","field"].forEach((function(n){t.forEach((function(t){t.kind===n&&"own"===t.placement&&this.defineClassElement(e,t)}),this)}),this)},initializeClassElements:function(e,t){var n=e.prototype;["method","field"].forEach((function(r){t.forEach((function(t){var i=t.placement;if(t.kind===r&&("static"===i||"prototype"===i)){var o="static"===i?e:n;this.defineClassElement(o,t)}}),this)}),this)},defineClassElement:function(e,t){var n=t.descriptor;if("field"===t.kind){var r=t.initializer;n={enumerable:n.enumerable,writable:n.writable,configurable:n.configurable,value:void 0===r?void 0:r.call(e)}}Object.defineProperty(e,t.key,n)},decorateClass:function(e,t){var n=[],r=[],i={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,i)}),this),e.forEach((function(e){if(!ve(e))return n.push(e);var t=this.decorateElement(e,i);n.push(t.element),n.push.apply(n,t.extras),r.push.apply(r,t.finishers)}),this),!t)return{elements:n,finishers:r};var o=this.decorateConstructor(n,t);return r.push.apply(r,o.finishers),o.finishers=r,o},addElementPlacement:function(e,t,n){var r=t[e.placement];if(!n&&-1!==r.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");r.push(e.key)},decorateElement:function(e,t){for(var n=[],r=[],i=e.decorators,o=i.length-1;o>=0;o--){var a=t[e.placement];a.splice(a.indexOf(e.key),1);var s=this.fromElementDescriptor(e),c=this.toElementFinisherExtras((0,i[o])(s)||s);e=c.element,this.addElementPlacement(e,t),c.finisher&&r.push(c.finisher);var l=c.extras;if(l){for(var u=0;u<l.length;u++)this.addElementPlacement(l[u],t);n.push.apply(n,l)}}return{element:e,finishers:r,extras:n}},decorateConstructor:function(e,t){for(var n=[],r=t.length-1;r>=0;r--){var i=this.fromClassDescriptor(e),o=this.toClassDescriptor((0,t[r])(i)||i);if(void 0!==o.finisher&&n.push(o.finisher),void 0!==o.elements){e=o.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:n}},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 ke(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ke(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 n=be(e.key),r=String(e.placement);if("static"!==r&&"prototype"!==r&&"own"!==r)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 "'+r+'"');var i=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var o={kind:t,key:n,placement:r,descriptor:Object.assign({},i)};return"field"!==t?this.disallowProperty(e,"initializer","A method descriptor"):(this.disallowProperty(i,"get","The property descriptor of a field descriptor"),this.disallowProperty(i,"set","The property descriptor of a field descriptor"),this.disallowProperty(i,"value","The property descriptor of a field descriptor"),o.initializer=e.initializer),o},toElementFinisherExtras:function(e){return{element:this.toElementDescriptor(e),finisher:ge(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 n=ge(e,"finisher");return{elements:this.toElementDescriptors(e.elements),finisher:n}},runClassFinishers:function(e,t){for(var n=0;n<t.length;n++){var r=(0,t[n])(e);if(void 0!==r){if("function"!=typeof r)throw new TypeError("Finishers must return a constructor.");e=r}}return e},disallowProperty:function(e,t,n){if(void 0!==e[t])throw new TypeError(n+" can't have a ."+t+" property.")}};return e}function pe(e){var t,n=be(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 r={kind:"field"===e.kind?"field":"method",key:n,placement:e.static?"static":"field"===e.kind?"own":"prototype",descriptor:t};return e.decorators&&(r.decorators=e.decorators),"field"===e.kind&&(r.initializer=e.value),r}function me(e,t){void 0!==e.descriptor.get?t.descriptor.get=e.descriptor.get:t.descriptor.set=e.descriptor.set}function ve(e){return e.decorators&&e.decorators.length}function ye(e){return void 0!==e&&!(void 0===e.value&&void 0===e.writable)}function ge(e,t){var n=e[t];if(void 0!==n&&"function"!=typeof n)throw new TypeError("Expected '"+t+"' to be a function");return n}function be(e){var t=function(e,t){if("object"!==ie(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==ie(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===ie(t)?t:String(t)}function ke(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function _e(e,t,n){return(_e="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=we(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}})(e,t,n||e)}function we(e){return(we=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ee=function(e,t,n,r){var i=he();if(r)for(var o=0;o<r.length;o++)i=r[o](i);var a=t((function(e){i.initializeInstanceElements(e,s.elements)}),n),s=i.decorateClass(function(e){for(var t=[],n=function(e){return"method"===e.kind&&e.key===o.key&&e.placement===o.placement},r=0;r<e.length;r++){var i,o=e[r];if("method"===o.kind&&(i=t.find(n)))if(ye(o.descriptor)||ye(i.descriptor)){if(ve(o)||ve(i))throw new ReferenceError("Duplicated methods ("+o.key+") can't be decorated.");i.descriptor=o.descriptor}else{if(ve(o)){if(ve(i))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+o.key+").");i.decorators=o.decorators}me(o,i)}else t.push(o)}return t}(a.d.map(pe)),e);return i.initializeClassElements(a.F,s.elements),i.runClassFinishers(a.F,s.finishers)}([(0,o.Mo)("hui-media-control-card")],(function(e,t){var h,p,m,v=function(t){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&le(e,t)}(r,t);var n=ue(r);function r(){var t;ce(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return t=n.call.apply(n,[this].concat(o)),e(fe(t)),t}return r}(t);return{F:v,d:[{kind:"method",static:!0,key:"getConfigElement",value:(m=se(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([n.e(5009),n.e(2955),n.e(8161),n.e(1041),n.e(1657),n.e(4268),n.e(3098),n.e(129),n.e(4535),n.e(2105)]).then(n.bind(n,52105));case 2:return e.abrupt("return",document.createElement("hui-media-control-card-editor"));case 3:case"end":return e.stop()}}),e)}))),function(){return m.apply(this,arguments)})},{kind:"method",static:!0,key:"getStubConfig",value:function(e,t,n){return{type:"media-control",entity:(0,P.j)(e,1,t,n,["media_player"])[0]||""}}},{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,o.SB)()],key:"_config",value:void 0},{kind:"field",decorators:[(0,o.SB)()],key:"_foregroundColor",value:void 0},{kind:"field",decorators:[(0,o.SB)()],key:"_backgroundColor",value:void 0},{kind:"field",decorators:[(0,o.SB)()],key:"_narrow",value:function(){return!1}},{kind:"field",decorators:[(0,o.SB)()],key:"_veryNarrow",value:function(){return!1}},{kind:"field",decorators:[(0,o.SB)()],key:"_cardHeight",value:function(){return 0}},{kind:"field",decorators:[(0,o.IO)("paper-progress")],key:"_progressBar",value:void 0},{kind:"field",decorators:[(0,o.SB)()],key:"_marqueeActive",value:function(){return!1}},{kind:"field",key:"_progressInterval",value:void 0},{kind:"field",key:"_resizeObserver",value:void 0},{kind:"method",key:"getCardSize",value:function(){return 3}},{kind:"method",key:"setConfig",value:function(e){if(!e.entity||"media_player"!==e.entity.split(".")[0])throw new Error("Specify an entity from within the media_player domain");this._config=e}},{kind:"method",key:"connectedCallback",value:function(){var e=this;if(_e(we(v.prototype),"connectedCallback",this).call(this),this.updateComplete.then((function(){return e._attachObserver()})),this.hass&&this._config){var t=this._stateObj;t&&!this._progressInterval&&this._showProgressBar&&"playing"===t.state&&(this._progressInterval=window.setInterval((function(){return e._updateProgressBar()}),1e3))}}},{kind:"method",key:"disconnectedCallback",value:function(){this._progressInterval&&(clearInterval(this._progressInterval),this._progressInterval=void 0),this._resizeObserver&&this._resizeObserver.disconnect()}},{kind:"method",key:"render",value:function(){var e=this;if(!this.hass||!this._config)return(0,i.dy)($||($=oe([""])));var t=this._stateObj;if(!t)return(0,i.dy)(X||(X=oe(["\n <hui-warning>\n ","\n </hui-warning>\n "])),(0,re.i)(this.hass,this._config.entity));var n={"background-image":this._image?"url(".concat(this.hass.hassUrl(this._image),")"):"none",width:"".concat(this._cardHeight,"px"),"background-color":this._backgroundColor||""},o={"background-image":"linear-gradient(to right, ".concat(this._backgroundColor,", ").concat(this._backgroundColor+"00",")"),width:"".concat(this._cardHeight,"px")},c=t.state,l="off"===c,h=x.V_.includes(c)||"off"===c&&!(0,f.e)(t,C.rv),p=!this._image,m=(0,C.xt)(t),v=m&&(!this._veryNarrow||l||"idle"===c||"on"===c),y=(0,C.Mj)(t);return(0,i.dy)(G||(G=oe(['\n <ha-card>\n <div\n class="background ','"\n >\n <div\n class="color-block"\n style=','\n ></div>\n <div\n class="no-img"\n style=','\n ></div>\n <div class="image" style=',"></div>\n ",'\n </div>\n <div\n class="player ','"\n style=','\n >\n <div class="top-info">\n <div class="icon-name">\n <ha-icon class="icon" .icon=',"></ha-icon>\n <div>\n ",'\n </div>\n </div>\n <div>\n <ha-icon-button\n icon="hass:dots-vertical"\n class="more-info"\n @click=',"\n ></ha-icon-button>\n </div>\n </div>\n ","\n </div>\n </ha-card>\n "])),(0,a.$)({"no-image":p,off:l||h,unavailable:h}),(0,s.V)({"background-color":this._backgroundColor||""}),(0,s.V)({"background-color":this._backgroundColor||""}),(0,s.V)(n),p?"":(0,i.dy)(Y||(Y=oe(['\n <div\n class="color-gradient"\n style=',"\n ></div>\n "])),(0,s.V)(o)),(0,a.$)({"no-image":p,narrow:this._narrow&&!this._veryNarrow,off:l||h,"no-progress":this._veryNarrow||!this._showProgressBar,"no-controls":!v}),(0,s.V)({color:this._foregroundColor||""}),(0,d.M)(t),this._config.name||(0,u.C)(this.hass.states[this._config.entity]),this._handleMoreInfo,!h&&(y||t.attributes.media_title||v)?(0,i.dy)(J||(J=oe(['\n <div>\n <div class="title-controls">\n ',"\n ","\n </div>\n ","\n </div>\n "])),y||t.attributes.media_title?(0,i.dy)(K||(K=oe(['\n <div class="media-info">\n <hui-marquee\n .text=',"\n .active=","\n @mouseover=","\n @mouseleave=","\n ></hui-marquee>\n ","\n </div>\n "])),t.attributes.media_title||y,this._marqueeActive,this._marqueeMouseOver,this._marqueeMouseLeave,t.attributes.media_title?y:""):"",v?(0,i.dy)(Q||(Q=oe(['\n <div class="controls">\n ',"\n ","\n </div>\n "])),m.map((function(t){return(0,i.dy)(Z||(Z=oe(["\n <ha-icon-button\n .title=","\n .icon=","\n action=","\n @click=","\n ></ha-icon-button>\n "])),e.hass.localize("ui.card.media_player.".concat(t.action)),t.icon,t.action,e._handleClick)})),(0,f.e)(t,C.pu)?(0,i.dy)(ee||(ee=oe(['\n <mwc-icon-button\n class="browse-media"\n .title=',"\n @click=","\n ><ha-svg-icon\n .path=","\n ></ha-svg-icon\n ></mwc-icon-button>\n "])),this.hass.localize("ui.card.media_player.browse_media"),this._handleBrowseMedia,r.hBf):""):"",this._showProgressBar?(0,i.dy)(te||(te=oe(["\n <paper-progress\n .max=","\n style=","\n @click=","\n ></paper-progress>\n "])),t.attributes.media_duration,(0,s.V)({"--paper-progress-active-color":this._foregroundColor||"var(--accent-color)",cursor:(0,f.e)(t,C.xh)?"pointer":"initial"}),this._handleSeek):""):"")}},{kind:"method",key:"shouldUpdate",value:function(e){return(0,O.G)(this,e)}},{kind:"method",key:"firstUpdated",value:function(){this._attachObserver()}},{kind:"method",key:"willUpdate",value:function(e){var t,n;if(_e(we(v.prototype),"willUpdate",this).call(this,e),this.hasUpdated||this._measureCard(),this._config&&this.hass&&(e.has("_config")||e.has("hass"))){if(!this._stateObj)return this._progressInterval&&(clearInterval(this._progressInterval),this._progressInterval=void 0),this._foregroundColor=void 0,void(this._backgroundColor=void 0);var r=e.get("hass"),i=(null==r||null===(t=r.states[this._config.entity])||void 0===t?void 0:t.attributes.entity_picture_local)||(null==r||null===(n=r.states[this._config.entity])||void 0===n?void 0:n.attributes.entity_picture);if(!this._image)return this._foregroundColor=void 0,void(this._backgroundColor=void 0);this._image!==i&&this._setColors()}}},{kind:"method",key:"updated",value:function(e){var t=this;if(this._config&&this.hass&&this._stateObj&&(e.has("_config")||e.has("hass"))){var n=this._stateObj,r=e.get("hass"),i=e.get("_config");r&&i&&r.themes===this.hass.themes&&i.theme===this._config.theme||(0,c.R)(this,this.hass.themes,this._config.theme),this._updateProgressBar(),!this._progressInterval&&this._showProgressBar&&"playing"===n.state?this._progressInterval=window.setInterval((function(){return t._updateProgressBar()}),1e3):!this._progressInterval||this._showProgressBar&&"playing"===n.state||(clearInterval(this._progressInterval),this._progressInterval=void 0)}}},{kind:"get",key:"_image",value:function(){if(this.hass&&this._config){var e=this._stateObj;if(e)return e.attributes.entity_picture_local||e.attributes.entity_picture}}},{kind:"get",key:"_showProgressBar",value:function(){if(!this.hass||!this._config||this._narrow)return!1;var e=this._stateObj;return!!e&&(("playing"===e.state||"paused"===e.state)&&"media_duration"in e.attributes&&"media_position"in e.attributes)}},{kind:"method",key:"_measureCard",value:function(){var e=this.shadowRoot.querySelector("ha-card");e&&(this._narrow=e.offsetWidth<350,this._veryNarrow=e.offsetWidth<300,this._cardHeight=e.offsetHeight)}},{kind:"method",key:"_attachObserver",value:(p=se(regeneratorRuntime.mark((function e(){var t,n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._resizeObserver){e.next=4;break}return e.next=3,(0,S.P)();case 3:this._resizeObserver=new ResizeObserver((0,w.D)((function(){return n._measureCard()}),250,!1));case 4:if(t=this.shadowRoot.querySelector("ha-card")){e.next=7;break}return e.abrupt("return");case 7:this._resizeObserver.observe(t);case 8:case"end":return e.stop()}}),e,this)}))),function(){return p.apply(this,arguments)})},{kind:"method",key:"_handleMoreInfo",value:function(){(0,l.B)(this,"hass-more-info",{entityId:this._config.entity})}},{kind:"method",key:"_handleBrowseMedia",value:function(){var e=this;(0,E.B)(this,{action:"play",entityId:this._config.entity,mediaPickedCallback:function(t){return e._playMedia(t.item.media_content_id,t.item.media_content_type)}})}},{kind:"method",key:"_playMedia",value:function(e,t){this.hass.callService("media_player","play_media",{entity_id:this._config.entity,media_content_id:e,media_content_type:t})}},{kind:"method",key:"_handleClick",value:function(e){var t=e.currentTarget.getAttribute("action");this.hass.callService("media_player",t,{entity_id:this._config.entity})}},{kind:"method",key:"_updateProgressBar",value:function(){this._progressBar&&(this._progressBar.value=(0,C.rs)(this._stateObj))}},{kind:"get",key:"_stateObj",value:function(){return this.hass.states[this._config.entity]}},{kind:"method",key:"_handleSeek",value:function(e){var t=this._stateObj;if((0,f.e)(t,C.xh)){var n=this.shadowRoot.querySelector("paper-progress").offsetWidth,r=e.offsetX/n,i=e.currentTarget.max*r;this.hass.callService("media_player","media_seek",{entity_id:this._config.entity,seek_position:i})}}},{kind:"method",key:"_setColors",value:(h=se(regeneratorRuntime.mark((function e(){var t,n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._image){e.next=2;break}return e.abrupt("return");case 2:return e.prev=2,e.next=5,_(this._image);case 5:t=e.sent,n=t.foreground,r=t.background,this._backgroundColor=r.hex,this._foregroundColor=n.hex,e.next=17;break;case 12:e.prev=12,e.t0=e.catch(2),console.error("Error getting Image Colors",e.t0),this._foregroundColor=void 0,this._backgroundColor=void 0;case 17:case"end":return e.stop()}}),e,this,[[2,12]])}))),function(){return h.apply(this,arguments)})},{kind:"method",key:"_marqueeMouseOver",value:function(){this._marqueeActive||(this._marqueeActive=!0)}},{kind:"method",key:"_marqueeMouseLeave",value:function(){this._marqueeActive&&(this._marqueeActive=!1)}},{kind:"get",static:!0,key:"styles",value:function(){return(0,i.iv)(ne||(ne=oe(['\n ha-card {\n overflow: hidden;\n height: 100%;\n }\n\n .background {\n display: flex;\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n width: 100%;\n transition: filter 0.8s;\n }\n\n .color-block {\n background-color: var(--primary-color);\n transition: background-color 0.8s;\n width: 100%;\n }\n\n .color-gradient {\n position: absolute;\n background-image: linear-gradient(\n to right,\n var(--primary-color),\n transparent\n );\n height: 100%;\n right: 0;\n opacity: 1;\n transition: width 0.8s, opacity 0.8s linear 0.8s;\n }\n\n .image {\n background-color: var(--primary-color);\n background-position: center;\n background-size: cover;\n background-repeat: no-repeat;\n position: absolute;\n right: 0;\n height: 100%;\n opacity: 1;\n transition: width 0.8s, background-image 0.8s, background-color 0.8s,\n background-size 0.8s, opacity 0.8s linear 0.8s;\n }\n\n .no-image .image {\n opacity: 0;\n }\n\n .no-img {\n background-color: var(--primary-color);\n background-size: initial;\n background-repeat: no-repeat;\n background-position: center center;\n padding-bottom: 0;\n position: absolute;\n right: 0;\n height: 100%;\n background-image: url("/static/images/card_media_player_bg.png");\n width: 50%;\n transition: opacity 0.8s, background-color 0.8s;\n }\n\n .off .image,\n .off .color-gradient {\n opacity: 0;\n transition: opacity 0s, width 0.8s;\n width: 0;\n }\n\n .unavailable .no-img,\n .background:not(.off):not(.no-image) .no-img {\n opacity: 0;\n }\n\n .player {\n position: relative;\n padding: 16px;\n height: 100%;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n color: var(--text-primary-color);\n transition-property: color, padding;\n transition-duration: 0.4s;\n }\n\n .controls {\n padding: 8px 8px 8px 0;\n display: flex;\n justify-content: flex-start;\n align-items: center;\n transition: padding, color;\n transition-duration: 0.4s;\n margin-left: -12px;\n }\n\n .controls > div {\n display: flex;\n align-items: center;\n }\n\n .controls ha-icon-button {\n --mdc-icon-button-size: 44px;\n --mdc-icon-size: 30px;\n }\n\n ha-icon-button[action="media_play"],\n ha-icon-button[action="media_play_pause"],\n ha-icon-button[action="media_pause"],\n ha-icon-button[action="media_stop"],\n ha-icon-button[action="turn_on"],\n ha-icon-button[action="turn_off"] {\n --mdc-icon-button-size: 56px;\n --mdc-icon-size: 40px;\n }\n\n mwc-icon-button.browse-media {\n position: absolute;\n right: 4px;\n --mdc-icon-size: 24px;\n }\n\n .top-info {\n display: flex;\n justify-content: space-between;\n }\n\n .icon-name {\n display: flex;\n height: fit-content;\n align-items: center;\n }\n\n .icon-name ha-icon {\n padding-right: 8px;\n }\n\n .more-info {\n position: absolute;\n top: 4px;\n right: 4px;\n }\n\n .media-info {\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n }\n\n hui-marquee {\n font-size: 1.2em;\n margin: 0px 0 4px;\n }\n\n .title-controls {\n padding-top: 16px;\n }\n\n paper-progress {\n width: 100%;\n height: var(--paper-progress-height, 4px);\n margin-top: 4px;\n border-radius: calc(var(--paper-progress-height, 4px) / 2);\n --paper-progress-container-color: rgba(200, 200, 200, 0.5);\n }\n\n .no-image .controls {\n padding: 0;\n }\n\n .off.background {\n filter: grayscale(1);\n }\n\n .narrow .controls,\n .no-progress .controls {\n padding-bottom: 0;\n }\n\n .narrow ha-icon-button {\n --mdc-icon-button-size: 40px;\n --mdc-icon-size: 28px;\n }\n\n .narrow ha-icon-button[action="media_play"],\n .narrow ha-icon-button[action="media_play_pause"],\n .narrow ha-icon-button[action="media_pause"],\n .narrow ha-icon-button[action="turn_on"] {\n --mdc-icon-button-size: 50px;\n --mdc-icon-size: 36px;\n }\n\n .narrow ha-icon-button.browse-media {\n --mdc-icon-size: 24px;\n }\n\n .no-progress.player:not(.no-controls) {\n padding-bottom: 0px;\n }\n '])))}}]}}),i.oi)}}]);
//# sourceMappingURL=chunk.a478493d75929791f2ed.js.map