iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
2 lines • 39.7 kB
JavaScript
(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([[6475],{22311:function(e,t,r){"use strict";r.d(t,{N:function(){return i}});var n=r(58831),i=function(e){return(0,n.M)(e.entity_id)}},83447:function(e,t,r){"use strict";r.d(t,{l:function(){return n}});var n=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"_",r="àáäâãåăæąçćčđďèéěėëêęğǵḧìíïîįłḿǹńňñòóöôœøṕŕřßşśšșťțùúüûǘůűūųẃẍÿýźžż·/_,:;",n="aaaaaaaaacccddeeeeeeegghiiiiilmnnnnooooooprrsssssttuuuuuuuuuwxyyzzz".concat(t).concat(t).concat(t).concat(t).concat(t).concat(t),i=new RegExp(r.split("").join("|"),"g");return e.toString().toLowerCase().replace(/\s+/g,t).replace(i,(function(e){return n.charAt(r.indexOf(e))})).replace(/&/g,"".concat(t,"and").concat(t)).replace(/[^\w-]+/g,"").replace(/-/,t).replace(new RegExp("/".concat(t).concat(t,"+/"),"g"),t).replace(new RegExp("/^".concat(t,"+/")),"").replace(new RegExp("/-+$/"),"")}},67102:function(e,t,r){"use strict";var n=r(50856);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=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}([" [[_getDescription(hass, domain, service)]] "]);return o=function(){return e},e}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(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 Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=f(e);if(t){var i=f(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return l(this,r)}}function l(e,t){return!t||"object"!==i(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var d=function(e){!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&&c(e,t)}(f,e);var t,r,i,l=u(f);function f(){return a(this,f),l.apply(this,arguments)}return t=f,i=[{key:"template",get:function(){return(0,n.d)(o())}},{key:"properties",get:function(){return{hass:Object,domain:String,service:String}}}],(r=[{key:"_getDescription",value:function(e,t,r){var n=e.services[t];if(!n)return"";var i=n[r];return i?i.description:""}}])&&s(t.prototype,r),i&&s(t,i),f}(r(28426).H3);customElements.define("ha-service-description",d)},57066:function(e,t,r){"use strict";r.d(t,{Lo:function(){return a},IO:function(){return s},qv:function(){return c},sG:function(){return f}});var n=r(95282),i=r(85415),o=r(38346),a=function(e,t){return e.callWS(Object.assign({type:"config/area_registry/create"},t))},s=function(e,t,r){return e.callWS(Object.assign({type:"config/area_registry/update",area_id:t},r))},c=function(e,t){return e.callWS({type:"config/area_registry/delete",area_id:t})},u=function(e){return e.sendMessagePromise({type:"config/area_registry/list"}).then((function(e){return e.sort((function(e,t){return(0,i.q)(e.name,t.name)}))}))},l=function(e,t){return e.subscribeEvents((0,o.D)((function(){return u(e).then((function(e){return t.setState(e,!0)}))}),500,!0),"area_registry_updated")},f=function(e,t){return(0,n.B)("_areaRegistry",u,l,e,t)}},74186:function(e,t,r){"use strict";r.d(t,{eD:function(){return a},Mw:function(){return s},vA:function(){return c},L3:function(){return u},Nv:function(){return l},z3:function(){return f},LM:function(){return h}});var n=r(95282),i=r(91741),o=r(38346),a=function(e,t){return t.find((function(t){return e.states[t.entity_id]&&"battery"===e.states[t.entity_id].attributes.device_class}))},s=function(e,t){return t.find((function(t){return e.states[t.entity_id]&&"battery_charging"===e.states[t.entity_id].attributes.device_class}))},c=function(e,t){if(t.name)return t.name;var r=e.states[t.entity_id];return r?(0,i.C)(r):null},u=function(e,t){return e.callWS({type:"config/entity_registry/get",entity_id:t})},l=function(e,t,r){return e.callWS(Object.assign({type:"config/entity_registry/update",entity_id:t},r))},f=function(e,t){return e.callWS({type:"config/entity_registry/remove",entity_id:t})},d=function(e){return e.sendMessagePromise({type:"config/entity_registry/list"})},p=function(e,t){return e.subscribeEvents((0,o.D)((function(){return d(e).then((function(e){return t.setState(e,!0)}))}),500,!0),"entity_registry_updated")},h=function(e,t){return(0,n.B)("_entityRegistry",d,p,e,t)}},11052:function(e,t,r){"use strict";r.d(t,{I:function(){return d}});var n=r(76389),i=r(47181);function o(e){return(o="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 a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(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 Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=f(e);if(t){var i=f(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return l(this,r)}}function l(e,t){return!t||"object"!==o(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var d=(0,n.o)((function(e){return function(e){!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&&c(e,t)}(l,e);var t,r,n,o=u(l);function l(){return a(this,l),o.apply(this,arguments)}return t=l,(r=[{key:"fire",value:function(e,t,r){return r=r||{},(0,i.B)(r.node||this,e,t,r)}}])&&s(t.prototype,r),n&&s(t,n),l}(e)}))},80033:function(e,t,r){"use strict";r.d(t,{xC:function(){return n},p4:function(){return i},jg:function(){return o},pN:function(){return a},Dm:function(){return s}});var n=function(e){var t=e;return"string"==typeof e&&(t=parseInt(e,16)),"0x"+t.toString(16).padStart(4,"0")},i=function(e){return e.split(":").slice(-4).reverse().join("")},o=function(e,t){var r=e.user_given_name?e.user_given_name:e.name,n=t.user_given_name?t.user_given_name:t.name;return r.localeCompare(n)},a=function(e,t){var r=e.name,n=t.name;return r.localeCompare(n)},s=function(e){return"".concat(e.name," (Endpoint id: ").concat(e.endpoint_id,", Id: ").concat(n(e.id),", Type: ").concat(e.type,")")}},89339:function(e,t,r){"use strict";r.r(t);r(53918),r(10983),r(31206);var n=r(15652),i=(r(67102),r(25856),r(1359),r(11654)),o=(r(30879),r(51095),r(47181)),a=r(91741),s=(r(54909),r(3143),r(22098),r(57292)),c=(r(68101),r(26765)),u=r(73826),l=r(74186),f=r(14516),d=r(85415),p=r(80033),h=r(83447);function y(e){return(y="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 v(){var e=k(["\n .device-entities {\n display: flex;\n flex-wrap: wrap;\n padding: 4px;\n justify-content: left;\n min-height: 48px;\n }\n .device {\n width: 30%;\n }\n .device .name {\n font-weight: bold;\n }\n .device .manuf {\n color: var(--secondary-text-color);\n margin-bottom: 20px;\n }\n .extra-info {\n margin-top: 8px;\n }\n state-badge {\n cursor: pointer;\n }\n "]);return v=function(){return e},e}function m(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(u){return void r(u)}s.done?t(c):Promise.resolve(c).then(n,i)}function b(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){m(o,n,i,a,s,"next",e)}function s(e){m(o,n,i,a,s,"throw",e)}a(void 0)}))}}function g(){var e=k(['\n <state-badge\n @click="','"\n .title=','\n .stateObj="','"\n slot="item-icon"\n ></state-badge>\n ']);return g=function(){return e},e}function _(){var e=k(["\n <ha-card .header=",'>\n <div class="card-content">\n <div class="info">\n <div class="model">','</div>\n <div class="manuf">\n ','\n </div>\n </div>\n\n <div class="device-entities">\n ','\n </div>\n <paper-input\n type="string"\n @change=',"\n .value=","\n .label=","\n ></paper-input>\n <ha-area-picker\n .hass=","\n .device=","\n @value-changed=","\n ></ha-area-picker>\n </div>\n </ha-card>\n "]);return _=function(){return e},e}function w(){var e=k([""]);return w=function(){return e},e}function k(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function E(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function x(e,t){return(x=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function O(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 Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=j(e);if(t){var i=j(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return P(this,r)}}function P(e,t){return!t||"object"!==y(t)&&"function"!=typeof t?S(e):t}function S(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function j(e){return(j=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function z(){z=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(n){t.forEach((function(t){var i=t.placement;if(t.kind===n&&("static"===i||"prototype"===i)){var o="static"===i?e:r;this.defineClassElement(o,t)}}),this)}),this)},defineClassElement:function(e,t){var r=t.descriptor;if("field"===t.kind){var n=t.initializer;r={enumerable:r.enumerable,writable:r.writable,configurable:r.configurable,value:void 0===n?void 0:n.call(e)}}Object.defineProperty(e,t.key,r)},decorateClass:function(e,t){var r=[],n=[],i={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,i)}),this),e.forEach((function(e){if(!T(e))return r.push(e);var t=this.decorateElement(e,i);r.push(t.element),r.push.apply(r,t.extras),n.push.apply(n,t.finishers)}),this),!t)return{elements:r,finishers:n};var o=this.decorateConstructor(r,t);return n.push.apply(n,o.finishers),o.finishers=n,o},addElementPlacement:function(e,t,r){var n=t[e.placement];if(!r&&-1!==n.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");n.push(e.key)},decorateElement:function(e,t){for(var r=[],n=[],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&&n.push(c.finisher);var u=c.extras;if(u){for(var l=0;l<u.length;l++)this.addElementPlacement(u[l],t);r.push.apply(r,u)}}return{element:e,finishers:n,extras:r}},decorateConstructor:function(e,t){for(var r=[],n=t.length-1;n>=0;n--){var i=this.fromClassDescriptor(e),o=this.toClassDescriptor((0,t[n])(i)||i);if(void 0!==o.finisher&&r.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: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&&Symbol.iterator in Object(e))return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return F(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)?F(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=I(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:t,key:r,placement:n,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:R(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=R(e,"finisher");return{elements:this.toElementDescriptors(e.elements),finisher:r}},runClassFinishers:function(e,t){for(var r=0;r<t.length;r++){var n=(0,t[r])(e);if(void 0!==n){if("function"!=typeof n)throw new TypeError("Finishers must return a constructor.");e=n}}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 D(e){var t,r=I(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 n={kind:"field"===e.kind?"field":"method",key:r,placement:e.static?"static":"field"===e.kind?"own":"prototype",descriptor:t};return e.decorators&&(n.decorators=e.decorators),"field"===e.kind&&(n.initializer=e.value),n}function C(e,t){void 0!==e.descriptor.get?t.descriptor.get=e.descriptor.get:t.descriptor.set=e.descriptor.set}function T(e){return e.decorators&&e.decorators.length}function A(e){return void 0!==e&&!(void 0===e.value&&void 0===e.writable)}function R(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 I(e){var t=function(e,t){if("object"!==y(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==y(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===y(t)?t:String(t)}function F(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}!function(e,t,r,n){var i=z();if(n)for(var o=0;o<n.length;o++)i=n[o](i);var a=t((function(e){i.initializeInstanceElements(e,s.elements)}),r),s=i.decorateClass(function(e){for(var t=[],r=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=t.find(r)))if(A(o.descriptor)||A(i.descriptor)){if(T(o)||T(i))throw new ReferenceError("Duplicated methods ("+o.key+") can't be decorated.");i.descriptor=o.descriptor}else{if(T(o)){if(T(i))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+o.key+").");i.decorators=o.decorators}C(o,i)}else t.push(o)}return t}(a.d.map(D)),e);i.initializeClassElements(a.F,s.elements),i.runClassFinishers(a.F,s.finishers)}([(0,n.Mo)("zha-device-card")],(function(e,t){var r,u;return{F: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&&x(e,t)}(n,t);var r=O(n);function n(){var t;E(this,n);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return t=r.call.apply(r,[this].concat(o)),e(S(t)),t}return n}(t),d:[{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,n.Cb)()],key:"device",value:void 0},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"narrow",value:void 0},{kind:"field",decorators:[(0,n.sz)()],key:"_entities",value:function(){return[]}},{kind:"field",key:"_deviceEntities",value:function(){var e=this;return(0,f.Z)((function(t,r){return r.filter((function(e){return e.device_id===t})).map((function(t){return Object.assign({},t,{stateName:e._computeEntityName(t)})})).sort((function(e,t){return(0,d.q)(e.stateName||"zzz".concat(e.entity_id),t.stateName||"zzz".concat(t.entity_id))}))}))}},{kind:"method",key:"hassSubscribe",value:function(){var e=this;return[(0,l.LM)(this.hass.connection,(function(t){e._entities=t}))]}},{kind:"method",key:"render",value:function(){var e=this;if(!this.hass||!this.device)return(0,n.dy)(w());var t=this._deviceEntities(this.device.device_reg_id,this._entities);return(0,n.dy)(_(),this.device.user_given_name||this.device.name,this.device.model,this.hass.localize("ui.dialogs.zha_device_info.manuf","manufacturer",this.device.manufacturer),t.map((function(t){return(0,n.dy)(g(),e._openMoreInfo,t.stateName,e.hass.states[t.entity_id])})),this._rename,this.device.user_given_name||this.device.name,this.hass.localize("ui.dialogs.zha_device_info.zha_device_card.device_name_placeholder"),this.hass,this.device.device_reg_id,this._areaPicked)}},{kind:"method",key:"_rename",value:(u=b(regeneratorRuntime.mark((function e(t){var r,n,i,o,a,c,u,f,d=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.hass&&this.device){e.next=2;break}return e.abrupt("return");case 2:return r=this.device,n=r.user_given_name||r.name,i=t.target.value,this.device.user_given_name=i,e.next=8,(0,s.t1)(this.hass,r.device_reg_id,{name_by_user:i});case 8:if(n&&i&&n!==i){e.next=10;break}return e.abrupt("return");case 10:return o=this._deviceEntities(r.device_reg_id,this._entities),a=(0,h.l)(n),c=(0,h.l)(i),u=(0,p.p4)(r.ieee),f=o.map((function(e){var t=e.name||e.stateName,r=null,o=null;return t&&t.includes(n)&&(o=(o=t.replace(" ".concat(u),"")).replace(n,i),r=(r=e.entity_id.replace("_".concat(u),"")).replace(a,c)),o||r?(0,l.Nv)(d.hass,e.entity_id,{name:o||t,disabled_by:e.disabled_by,new_entity_id:r||e.entity_id}):new Promise((function(e){return e()}))})),e.next=17,Promise.all(f);case 17:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{kind:"method",key:"_openMoreInfo",value:function(e){(0,o.B)(this,"hass-more-info",{entityId:e.currentTarget.stateObj.entity_id})}},{kind:"method",key:"_computeEntityName",value:function(e){return this.hass.states[e.entity_id]?(0,a.C)(this.hass.states[e.entity_id]):e.name}},{kind:"method",key:"_areaPicked",value:(r=b(regeneratorRuntime.mark((function e(t){var r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.currentTarget,n=t.detail.value,e.prev=2,e.next=5,(0,s.t1)(this.hass,this.device.device_reg_id,{area_id:n});case 5:this.device.area_id=n,e.next=12;break;case 8:e.prev=8,e.t0=e.catch(2),(0,c.Ys)(this,{text:this.hass.localize("ui.panel.config.integrations.config_flow.error_saving_area","error",e.t0.message)}),r.value=null;case 12:case"end":return e.stop()}}),e,this,[[2,8]])}))),function(e){return r.apply(this,arguments)})},{kind:"get",static:!0,key:"styles",value:function(){return[i.Qx,(0,n.iv)(v())]}}]}}),(0,u.f)(n.oi));var M=r(58851);function N(e){return(N="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 L(){var e=Y(["\n .discovery-text {\n width: 100%;\n padding: 16px;\n display: flex;\n flex-direction: column;\n align-items: center;\n }\n .content {\n display: flex;\n flex-wrap: wrap;\n padding: 4px;\n justify-content: center;\n }\n .error {\n color: var(--error-color);\n }\n ha-circular-progress {\n padding: 20px;\n }\n .searching {\n margin-top: 20px;\n display: flex;\n flex-direction: column;\n align-items: center;\n }\n .card {\n margin: 8px;\n }\n .log {\n padding: 16px;\n }\n .toggle-help-icon {\n position: absolute;\n margin-top: 16px;\n margin-right: 16px;\n top: -6px;\n right: 0;\n color: var(--primary-color);\n }\n ha-service-description {\n margin-top: 16px;\n margin-left: 16px;\n display: block;\n color: grey;\n }\n .search-button {\n margin-top: 16px;\n margin-left: 16px;\n }\n .help-text {\n color: grey;\n padding-left: 16px;\n }\n "]);return L=function(){return e},e}function H(){var e=Y(['<paper-textarea\n readonly\n max-rows="10"\n class="log"\n value="','"\n >\n </paper-textarea>']);return H=function(){return e},e}function W(){var e=Y(['\n <zha-device-card\n class="card"\n .hass=',"\n .device=","\n .narrow=","\n .showHelp=","\n ></zha-device-card>\n "]);return W=function(){return e},e}function B(){var e=Y(["\n ","\n "]);return B=function(){return e},e}function q(){var e=Y(['\n <div class="discovery-text">\n <h4>\n ',"\n </h4>\n <h4>\n ","\n </h4>\n </div>\n "]);return q=function(){return e},e}function $(){var e=Y([' <div class="error">',"</div> "]);return $=function(){return e},e}function Q(){var e=Y(["\n <div>\n <mwc-button @click=",' class="search-button">\n ',"\n </mwc-button>\n </div>\n "]);return Q=function(){return e},e}function U(){var e=Y(["\n <h1>\n ",'\n </h1>\n <ha-circular-progress\n active\n alt="Searching"\n ></ha-circular-progress>\n ']);return U=function(){return e},e}function G(){var e=Y(["\n <hass-tabs-subpage\n .hass=","\n .narrow=","\n .route=","\n .tabs=",'\n >\n <mwc-button slot="toolbar-icon" @click=',"\n >",'</mwc-button\n >\n <div class="searching">\n ',"\n </div>\n ",'\n <div class="content">\n ',"\n </div>\n ","\n </hass-tabs-subpage>\n "]);return G=function(){return e},e}function Y(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function Z(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function J(e,t){return(J=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function K(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 Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=ue(e);if(t){var i=ue(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return V(this,r)}}function V(e,t){return!t||"object"!==N(t)&&"function"!=typeof t?X(e):t}function X(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ee(){ee=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(n){t.forEach((function(t){var i=t.placement;if(t.kind===n&&("static"===i||"prototype"===i)){var o="static"===i?e:r;this.defineClassElement(o,t)}}),this)}),this)},defineClassElement:function(e,t){var r=t.descriptor;if("field"===t.kind){var n=t.initializer;r={enumerable:r.enumerable,writable:r.writable,configurable:r.configurable,value:void 0===n?void 0:n.call(e)}}Object.defineProperty(e,t.key,r)},decorateClass:function(e,t){var r=[],n=[],i={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,i)}),this),e.forEach((function(e){if(!ne(e))return r.push(e);var t=this.decorateElement(e,i);r.push(t.element),r.push.apply(r,t.extras),n.push.apply(n,t.finishers)}),this),!t)return{elements:r,finishers:n};var o=this.decorateConstructor(r,t);return n.push.apply(n,o.finishers),o.finishers=n,o},addElementPlacement:function(e,t,r){var n=t[e.placement];if(!r&&-1!==n.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");n.push(e.key)},decorateElement:function(e,t){for(var r=[],n=[],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&&n.push(c.finisher);var u=c.extras;if(u){for(var l=0;l<u.length;l++)this.addElementPlacement(u[l],t);r.push.apply(r,u)}}return{element:e,finishers:n,extras:r}},decorateConstructor:function(e,t){for(var r=[],n=t.length-1;n>=0;n--){var i=this.fromClassDescriptor(e),o=this.toClassDescriptor((0,t[n])(i)||i);if(void 0!==o.finisher&&r.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: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&&Symbol.iterator in Object(e))return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return se(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)?se(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=ae(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:t,key:r,placement:n,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:oe(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=oe(e,"finisher");return{elements:this.toElementDescriptors(e.elements),finisher:r}},runClassFinishers:function(e,t){for(var r=0;r<t.length;r++){var n=(0,t[r])(e);if(void 0!==n){if("function"!=typeof n)throw new TypeError("Finishers must return a constructor.");e=n}}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 te(e){var t,r=ae(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 n={kind:"field"===e.kind?"field":"method",key:r,placement:e.static?"static":"field"===e.kind?"own":"prototype",descriptor:t};return e.decorators&&(n.decorators=e.decorators),"field"===e.kind&&(n.initializer=e.value),n}function re(e,t){void 0!==e.descriptor.get?t.descriptor.get=e.descriptor.get:t.descriptor.set=e.descriptor.set}function ne(e){return e.decorators&&e.decorators.length}function ie(e){return void 0!==e&&!(void 0===e.value&&void 0===e.writable)}function oe(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 ae(e){var t=function(e,t){if("object"!==N(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==N(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===N(t)?t:String(t)}function se(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function ce(e,t,r){return(ce="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=ue(e)););return e}(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(r):i.value}})(e,t,r||e)}function ue(e){return(ue=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}!function(e,t,r,n){var i=ee();if(n)for(var o=0;o<n.length;o++)i=n[o](i);var a=t((function(e){i.initializeInstanceElements(e,s.elements)}),r),s=i.decorateClass(function(e){for(var t=[],r=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=t.find(r)))if(ie(o.descriptor)||ie(i.descriptor)){if(ne(o)||ne(i))throw new ReferenceError("Duplicated methods ("+o.key+") can't be decorated.");i.descriptor=o.descriptor}else{if(ne(o)){if(ne(i))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+o.key+").");i.decorators=o.decorators}re(o,i)}else t.push(o)}return t}(a.d.map(te)),e);i.initializeClassElements(a.F,s.elements),i.runClassFinishers(a.F,s.finishers)}([(0,n.Mo)("zha-add-devices-page")],(function(e,t){var r=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&&J(e,t)}(n,t);var r=K(n);function n(){var t;Z(this,n);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return t=r.call.apply(r,[this].concat(o)),e(X(t)),t}return n}(t);return{F:r,d:[{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,n.Cb)()],key:"narrow",value:void 0},{kind:"field",decorators:[(0,n.Cb)()],key:"isWide",value:void 0},{kind:"field",decorators:[(0,n.Cb)()],key:"route",value:void 0},{kind:"field",decorators:[(0,n.sz)()],key:"_error",value:void 0},{kind:"field",decorators:[(0,n.sz)()],key:"_discoveredDevices",value:function(){return[]}},{kind:"field",decorators:[(0,n.sz)()],key:"_formattedEvents",value:function(){return""}},{kind:"field",decorators:[(0,n.sz)()],key:"_active",value:function(){return!1}},{kind:"field",decorators:[(0,n.sz)()],key:"_showHelp",value:function(){return!1}},{kind:"field",decorators:[(0,n.sz)()],key:"_showLogs",value:function(){return!1}},{kind:"field",key:"_ieeeAddress",value:void 0},{kind:"field",key:"_addDevicesTimeoutHandle",value:function(){}},{kind:"field",key:"_subscribed",value:void 0},{kind:"method",key:"connectedCallback",value:function(){ce(ue(r.prototype),"connectedCallback",this).call(this),this.route&&this.route.path&&""!==this.route.path?this._ieeeAddress=this.route.path.substring(1):this._ieeeAddress=void 0,this._subscribe()}},{kind:"method",key:"disconnectedCallback",value:function(){ce(ue(r.prototype),"disconnectedCallback",this).call(this),this._unsubscribe(),this._error=void 0,this._discoveredDevices=[],this._formattedEvents=""}},{kind:"method",key:"updated",value:function(e){ce(ue(r.prototype),"updated",this).call(this,e),!e.has("hass")||this._active||e.get("hass")||this._subscribe()}},{kind:"method",key:"render",value:function(){var e=this;return(0,n.dy)(G(),this.hass,this.narrow,this.route,M.zhaTabs,this._toggleLogs,this._showLogs?"Hide logs":"Show logs",this._active?(0,n.dy)(U(),this.hass.localize("ui.panel.config.zha.add_device_page.spinner")):(0,n.dy)(Q(),this._subscribe,this.hass.localize("ui.panel.config.zha.add_device_page.search_again")),this._error?(0,n.dy)($(),this._error):"",this._discoveredDevices.length<1?(0,n.dy)(q(),this.hass.localize("ui.panel.config.zha.add_device_page.pairing_mode"),this.hass.localize(this._active?"ui.panel.config.zha.add_device_page.discovered_text":"ui.panel.config.zha.add_device_page.no_devices_found")):(0,n.dy)(B(),this._discoveredDevices.map((function(t){return(0,n.dy)(W(),e.hass,t,e.narrow,e._showHelp)}))),this._showLogs?(0,n.dy)(H(),this._formattedEvents):"")}},{kind:"method",key:"_toggleLogs",value:function(){this._showLogs=!this._showLogs}},{kind:"method",key:"_handleMessage",value:function(e){if("log_output"===e.type&&(this._formattedEvents+=e.log_entry.message+"\n",this.shadowRoot)){var t=this.shadowRoot.querySelector("paper-textarea");if(t){var r=t.inputElement.textarea;r.scrollTop=r.scrollHeight}}e.type&&"device_fully_initialized"===e.type&&this._discoveredDevices.push(e.device_info)}},{kind:"method",key:"_unsubscribe",value:function(){this._active=!1,this._addDevicesTimeoutHandle&&clearTimeout(this._addDevicesTimeoutHandle),this._subscribed&&(this._subscribed.then((function(e){return e()})),this._subscribed=void 0)}},{kind:"method",key:"_subscribe",value:function(){var e=this;if(this.hass){this._active=!0;var t={type:"zha/devices/permit"};this._ieeeAddress&&(t.ieee=this._ieeeAddress),this._subscribed=this.hass.connection.subscribeMessage((function(t){return e._handleMessage(t)}),t),this._addDevicesTimeoutHandle=setTimeout((function(){return e._unsubscribe()}),12e4)}}},{kind:"get",static:!0,key:"styles",value:function(){return[i.Qx,(0,n.iv)(L())]}}]}}),n.oi)}}]);
//# sourceMappingURL=chunk.97c187aadbca0c4c71f6.js.map