iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
2 lines • 13.1 kB
JavaScript
(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([[4066],{94066:function(e,r,t){"use strict";t(53918),t(10983);var n=t(15652);function i(e){return(i="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 o(){var e=h(["<div>","</div>"]);return o=function(){return e},e}function s(){var e=h(['<div class="error">',"</div>"]);return s=function(){return e},e}function a(){var e=h(['<div class="warning">',"</div>"]);return a=function(){return e},e}function c(){var e=h(['<div class="info">',"</div>"]);return c=function(){return e},e}function l(e,r,t,n,i,o,s){try{var a=e[o](s),c=a.value}catch(l){return void t(l)}a.done?r(c):Promise.resolve(c).then(n,i)}function u(){var e=h(["\n .error-log-intro {\n text-align: center;\n margin: 16px;\n }\n\n ha-icon-button {\n float: right;\n }\n\n .error-log {\n @apply --paper-font-code)\n clear: both;\n text-align: left;\n padding-top: 12px;\n }\n\n .error {\n color: var(--error-color);\n }\n\n .warning {\n color: var(--warning-color);\n }\n "]);return u=function(){return e},e}function f(){var e=h(["\n <mwc-button raised @click=",">\n ","\n </mwc-button>\n "]);return f=function(){return e},e}function d(){var e=h(['\n <ha-card>\n <ha-icon-button\n icon="hass:refresh"\n @click=','\n ></ha-icon-button>\n <div class="card-content error-log">\n ',"\n </div>\n </ha-card>\n "]);return d=function(){return e},e}function p(){var e=h(['\n <div class="error-log-intro">\n ',"\n </div>\n "]);return p=function(){return e},e}function h(e,r){return r||(r=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(r)}}))}function m(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function y(e,r){return(y=Object.setPrototypeOf||function(e,r){return e.__proto__=r,e})(e,r)}function v(e){var r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,n=C(e);if(r){var i=C(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return b(this,t)}}function b(e,r){return!r||"object"!==i(r)&&"function"!=typeof r?g(e):r}function g(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function w(){w=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,r){["method","field"].forEach((function(t){r.forEach((function(r){r.kind===t&&"own"===r.placement&&this.defineClassElement(e,r)}),this)}),this)},initializeClassElements:function(e,r){var t=e.prototype;["method","field"].forEach((function(n){r.forEach((function(r){var i=r.placement;if(r.kind===n&&("static"===i||"prototype"===i)){var o="static"===i?e:t;this.defineClassElement(o,r)}}),this)}),this)},defineClassElement:function(e,r){var t=r.descriptor;if("field"===r.kind){var n=r.initializer;t={enumerable:t.enumerable,writable:t.writable,configurable:t.configurable,value:void 0===n?void 0:n.call(e)}}Object.defineProperty(e,r.key,t)},decorateClass:function(e,r){var t=[],n=[],i={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,i)}),this),e.forEach((function(e){if(!P(e))return t.push(e);var r=this.decorateElement(e,i);t.push(r.element),t.push.apply(t,r.extras),n.push.apply(n,r.finishers)}),this),!r)return{elements:t,finishers:n};var o=this.decorateConstructor(t,r);return n.push.apply(n,o.finishers),o.finishers=n,o},addElementPlacement:function(e,r,t){var n=r[e.placement];if(!t&&-1!==n.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");n.push(e.key)},decorateElement:function(e,r){for(var t=[],n=[],i=e.decorators,o=i.length-1;o>=0;o--){var s=r[e.placement];s.splice(s.indexOf(e.key),1);var a=this.fromElementDescriptor(e),c=this.toElementFinisherExtras((0,i[o])(a)||a);e=c.element,this.addElementPlacement(e,r),c.finisher&&n.push(c.finisher);var l=c.extras;if(l){for(var u=0;u<l.length;u++)this.addElementPlacement(l[u],r);t.push.apply(t,l)}}return{element:e,finishers:n,extras:t}},decorateConstructor:function(e,r){for(var t=[],n=r.length-1;n>=0;n--){var i=this.fromClassDescriptor(e),o=this.toClassDescriptor((0,r[n])(i)||i);if(void 0!==o.finisher&&t.push(o.finisher),void 0!==o.elements){e=o.elements;for(var s=0;s<e.length-1;s++)for(var a=s+1;a<e.length;a++)if(e[s].key===e[a].key&&e[s].placement===e[a].placement)throw new TypeError("Duplicated element ("+e[s].key+")")}}return{elements:e,finishers:t}},fromElementDescriptor:function(e){var r={kind:e.kind,key:e.key,placement:e.placement,descriptor:e.descriptor};return Object.defineProperty(r,Symbol.toStringTag,{value:"Descriptor",configurable:!0}),"field"===e.kind&&(r.initializer=e.initializer),r},toElementDescriptors:function(e){var r;if(void 0!==e)return(r=e,function(e){if(Array.isArray(e))return e}(r)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(r)||function(e,r){if(e){if("string"==typeof e)return T(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?T(e,r):void 0}}(r)||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 r=this.toElementDescriptor(e);return this.disallowProperty(e,"finisher","An element descriptor"),this.disallowProperty(e,"extras","An element descriptor"),r}),this)},toElementDescriptor:function(e){var r=String(e.kind);if("method"!==r&&"field"!==r)throw new TypeError('An element descriptor\'s .kind property must be either "method" or "field", but a decorator created an element descriptor with .kind "'+r+'"');var t=A(e.key),n=String(e.placement);if("static"!==n&&"prototype"!==n&&"own"!==n)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 "'+n+'"');var i=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var o={kind:r,key:t,placement:n,descriptor:Object.assign({},i)};return"field"!==r?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:_(e,"finisher"),extras:this.toElementDescriptors(e.extras)}},fromClassDescriptor:function(e){var r={kind:"class",elements:e.map(this.fromElementDescriptor,this)};return Object.defineProperty(r,Symbol.toStringTag,{value:"Descriptor",configurable:!0}),r},toClassDescriptor:function(e){var r=String(e.kind);if("class"!==r)throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator created a class descriptor with .kind "'+r+'"');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 t=_(e,"finisher");return{elements:this.toElementDescriptors(e.elements),finisher:t}},runClassFinishers:function(e,r){for(var t=0;t<r.length;t++){var n=(0,r[t])(e);if(void 0!==n){if("function"!=typeof n)throw new TypeError("Finishers must return a constructor.");e=n}}return e},disallowProperty:function(e,r,t){if(void 0!==e[r])throw new TypeError(t+" can't have a ."+r+" property.")}};return e}function k(e){var r,t=A(e.key);"method"===e.kind?r={value:e.value,writable:!0,configurable:!0,enumerable:!1}:"get"===e.kind?r={get:e.value,configurable:!0,enumerable:!1}:"set"===e.kind?r={set:e.value,configurable:!0,enumerable:!1}:"field"===e.kind&&(r={configurable:!0,writable:!0,enumerable:!0});var n={kind:"field"===e.kind?"field":"method",key:t,placement:e.static?"static":"field"===e.kind?"own":"prototype",descriptor:r};return e.decorators&&(n.decorators=e.decorators),"field"===e.kind&&(n.initializer=e.value),n}function E(e,r){void 0!==e.descriptor.get?r.descriptor.get=e.descriptor.get:r.descriptor.set=e.descriptor.set}function P(e){return e.decorators&&e.decorators.length}function O(e){return void 0!==e&&!(void 0===e.value&&void 0===e.writable)}function _(e,r){var t=e[r];if(void 0!==t&&"function"!=typeof t)throw new TypeError("Expected '"+r+"' to be a function");return t}function A(e){var r=function(e,r){if("object"!==i(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,r||"default");if("object"!==i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"===i(r)?r:String(r)}function T(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function D(e,r,t){return(D="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,r,t){var n=function(e,r){for(;!Object.prototype.hasOwnProperty.call(e,r)&&null!==(e=C(e)););return e}(e,r);if(n){var i=Object.getOwnPropertyDescriptor(n,r);return i.get?i.get.call(t):i.value}})(e,r,t||e)}function C(e){return(C=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var S=function(e,r,t,n){var i=w();if(n)for(var o=0;o<n.length;o++)i=n[o](i);var s=r((function(e){i.initializeInstanceElements(e,a.elements)}),t),a=i.decorateClass(function(e){for(var r=[],t=function(e){return"method"===e.kind&&e.key===o.key&&e.placement===o.placement},n=0;n<e.length;n++){var i,o=e[n];if("method"===o.kind&&(i=r.find(t)))if(O(o.descriptor)||O(i.descriptor)){if(P(o)||P(i))throw new ReferenceError("Duplicated methods ("+o.key+") can't be decorated.");i.descriptor=o.descriptor}else{if(P(o)){if(P(i))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+o.key+").");i.decorators=o.decorators}E(o,i)}else r.push(o)}return r}(s.d.map(k)),e);return i.initializeClassElements(s.F,a.elements),i.runClassFinishers(s.F,a.finishers)}(null,(function(e,r){var t,i,h=function(r){!function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),r&&y(e,r)}(n,r);var t=v(n);function n(){var r;m(this,n);for(var i=arguments.length,o=new Array(i),s=0;s<i;s++)o[s]=arguments[s];return r=t.call.apply(t,[this].concat(o)),e(g(r)),r}return n}(r);return{F:h,d:[{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,n.sz)()],key:"_errorHTML",value:void 0},{kind:"method",key:"render",value:function(){return(0,n.dy)(p(),this._errorHTML?(0,n.dy)(d(),this._refreshErrorLog,this._errorHTML):(0,n.dy)(f(),this._refreshErrorLog,this.hass.localize("ui.panel.config.logs.load_full_log")))}},{kind:"method",key:"firstUpdated",value:function(e){var r;D(C(h.prototype),"firstUpdated",this).call(this,e),(null===(r=this.hass)||void 0===r?void 0:r.config.safe_mode)&&this._refreshErrorLog()}},{kind:"get",static:!0,key:"styles",value:function(){return(0,n.iv)(u())}},{kind:"method",key:"_refreshErrorLog",value:(t=regeneratorRuntime.mark((function e(){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._errorHTML=this.hass.localize("ui.panel.config.logs.loading_log"),e.next=3,this.hass.callApi("GET","error_log");case 3:r=e.sent,this._errorHTML=r?r.split("\n").map((function(e){return e.includes("INFO")?(0,n.dy)(c(),e):e.includes("WARNING")?(0,n.dy)(a(),e):e.includes("ERROR")||e.includes("FATAL")||e.includes("CRITICAL")?(0,n.dy)(s(),e):(0,n.dy)(o(),e)})):this.hass.localize("ui.panel.config.logs.no_errors");case 5:case"end":return e.stop()}}),e,this)})),i=function(){var e=this,r=arguments;return new Promise((function(n,i){var o=t.apply(e,r);function s(e){l(o,n,i,s,a,"next",e)}function a(e){l(o,n,i,s,a,"throw",e)}s(void 0)}))},function(){return i.apply(this,arguments)})}]}}),n.oi);customElements.define("error-log-card",S)}}]);
//# sourceMappingURL=chunk.2b20a547e4f0df3b3f3e.js.map