iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
2 lines • 23.3 kB
JavaScript
(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([[6184],{349:function(e,t,r){"use strict";function n(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 i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}r.d(t,{m:function(){return a}});var o=new(function(){function e(){var t=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),i(this,"_storage",{}),i(this,"_listeners",{}),window.addEventListener("storage",(function(e){e.key&&t.hasKey(e.key)&&(t._storage[e.key]=e.newValue?JSON.parse(e.newValue):e.newValue,t._listeners[e.key]&&t._listeners[e.key].forEach((function(r){return r(e.oldValue?JSON.parse(e.oldValue):e.oldValue,t._storage[e.key])})))}))}var t,r,o;return t=e,(r=[{key:"addFromStorage",value:function(e){if(!this._storage[e]){var t=window.localStorage.getItem(e);t&&(this._storage[e]=JSON.parse(t))}}},{key:"subscribeChanges",value:function(e,t){var r=this;return this._listeners[e]?this._listeners[e].push(t):this._listeners[e]=[t],function(){r.unsubscribeChanges(e,t)}}},{key:"unsubscribeChanges",value:function(e,t){if(e in this._listeners){var r=this._listeners[e].indexOf(t);-1!==r&&this._listeners[e].splice(r,1)}}},{key:"hasKey",value:function(e){return e in this._storage}},{key:"getValue",value:function(e){return this._storage[e]}},{key:"setValue",value:function(e,t){this._storage[e]=t;try{window.localStorage.setItem(e,JSON.stringify(t))}catch(r){}}}])&&n(t.prototype,r),o&&n(t,o),e}()),a=function(e,t,r){return function(n){var i=String(n.key);e=e||String(n.key);var a=n.initializer?n.initializer():void 0;o.addFromStorage(e);var s=function(){return o.hasKey(e)?o.getValue(e):a};return{kind:"method",placement:"prototype",key:n.key,descriptor:{set:function(r){!function(r,i){var a;t&&(a=s()),o.setValue(e,i),t&&r.requestUpdate(n.key,a)}(this,r)},get:function(){return s()},enumerable:!0,configurable:!0},finisher:function(a){if(t){var s=a.prototype.connectedCallback,c=a.prototype.disconnectedCallback;a.prototype.connectedCallback=function(){var t;s.call(this),this["__unbsubLocalStorage".concat(i)]=(t=this,o.subscribeChanges(e,(function(e){t.requestUpdate(n.key,e)})))},a.prototype.disconnectedCallback=function(){c.call(this),this["__unbsubLocalStorage".concat(i)]()},a.createProperty(n.key,Object.assign({noAccessor:!0},r))}}}}}},27269:function(e,t,r){"use strict";r.d(t,{p:function(){return n}});var n=function(e){return e.substr(e.indexOf(".")+1)}},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)}},91741:function(e,t,r){"use strict";r.d(t,{C:function(){return i}});var n=r(27269),i=function(e){return void 0===e.attributes.friendly_name?(0,n.p)(e.entity_id).replace(/_/g," "):e.attributes.friendly_name||""}},40095:function(e,t,r){"use strict";r.d(t,{e:function(){return n}});var n=function(e,t){return 0!=(e.attributes.supported_features&t)}},81303:function(e,t,r){"use strict";r(8878);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 i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(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 a(e,t,r){return(a="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=l(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 s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(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 r,n=l(e);if(t){var i=l(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return u(this,r)}}function u(e,t){return!t||"object"!==n(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 l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var f=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&&s(e,t)}(f,e);var t,r,n,u=c(f);function f(){return i(this,f),u.apply(this,arguments)}return t=f,(r=[{key:"ready",value:function(){var e=this;a(l(f.prototype),"ready",this).call(this),setTimeout((function(){"rtl"===window.getComputedStyle(e).direction&&(e.style.textAlign="right")}),100)}}])&&o(t.prototype,r),n&&o(t,n),f}(customElements.get("paper-dropdown-menu"));customElements.define("ha-paper-dropdown-menu",f)},56007:function(e,t,r){"use strict";r.d(t,{nZ:function(){return n},lz:function(){return i},V_:function(){return o}});var n="unavailable",i="unknown",o=[n,i]},69371:function(e,t,r){"use strict";r.d(t,{MU:function(){return a},xh:function(){return s},X6:function(){return c},y:function(){return u},Y3:function(){return l},Bp:function(){return f},rv:function(){return p},VJ:function(){return d},WE:function(){return h},B6:function(){return y},Hy:function(){return m},VH:function(){return v},S6:function(){return g},Dh:function(){return b},pu:function(){return _},N8:function(){return w},Fn:function(){return k},zz:function(){return E},b:function(){return O},rs:function(){return S},Mj:function(){return x},xt:function(){return P}});var n=r(68546),i=r(40095),o=r(56007),a=1,s=2,c=4,u=8,l=16,f=32,p=128,d=256,h=512,y=1024,m=2048,v=4096,g=16384,b=65536,_=131072,w="browser",k={album:{icon:n.eBO,layout:"grid"},app:{icon:n.Kpn,layout:"grid"},artist:{icon:n.HwD,layout:"grid",show_list_images:!0},channel:{icon:n.nTs,thumbnail_ratio:"portrait",layout:"grid"},composer:{icon:n.vmK,layout:"grid",show_list_images:!0},contributing_artist:{icon:n.HwD,layout:"grid",show_list_images:!0},directory:{icon:n.in3,layout:"grid",show_list_images:!0},episode:{icon:n.nTs,layout:"grid",thumbnail_ratio:"portrait"},game:{icon:n.qK8,layout:"grid",thumbnail_ratio:"portrait"},genre:{icon:n.vXW,layout:"grid",show_list_images:!0},image:{icon:n.TaT,layout:"grid"},movie:{icon:n.l1p,thumbnail_ratio:"portrait",layout:"grid"},music:{icon:n.MxT},playlist:{icon:n.MxF,layout:"grid",show_list_images:!0},podcast:{icon:n.wu9,layout:"grid"},season:{icon:n.nTs,layout:"grid",thumbnail_ratio:"portrait"},track:{icon:n.ZH0},tv_show:{icon:n.nTs,layout:"grid",thumbnail_ratio:"portrait"},url:{icon:n.m5Y},video:{icon:n.Jhp,layout:"grid"}},E=function(e,t,r,n){return e.callWS({type:"media_player/browse_media",entity_id:t,media_content_id:r,media_content_type:n})},O=function(e,t){return e.callWS({type:"media_source/browse_media",media_content_id:t})},S=function(e){var t=e.attributes.media_position;return"playing"!==e.state?t:t+=(Date.now()-new Date(e.attributes.media_position_updated_at).getTime())/1e3},x=function(e){var t;switch(e.attributes.media_content_type){case"music":case"image":t=e.attributes.media_artist;break;case"playlist":t=e.attributes.media_playlist;break;case"tvshow":t=e.attributes.media_series_title,e.attributes.media_season&&(t+=" S"+e.attributes.media_season,e.attributes.media_episode&&(t+="E"+e.attributes.media_episode));break;default:t=e.attributes.app_name||""}return t},P=function(e){if(e){var t=e.state;if(!o.V_.includes(t)){if("off"===t)return(0,i.e)(e,p)?[{icon:"hass:power",action:"turn_on"}]:void 0;var r=[];return(0,i.e)(e,d)&&r.push({icon:"hass:power",action:"turn_off"}),"playing"!==t&&"paused"!==t||!(0,i.e)(e,l)||r.push({icon:"hass:skip-previous",action:"media_previous_track"}),("playing"===t&&((0,i.e)(e,a)||(0,i.e)(e,v))||("paused"===t||"idle"===t)&&(0,i.e)(e,g)||"on"===t&&((0,i.e)(e,g)||(0,i.e)(e,a)))&&r.push({icon:"on"===t?"hass:play-pause":"playing"!==t?"hass:play":(0,i.e)(e,a)?"hass:pause":"hass:stop",action:"playing"!==t?"media_play":(0,i.e)(e,a)?"media_pause":"media_stop"}),"playing"!==t&&"paused"!==t||!(0,i.e)(e,f)||r.push({icon:"hass:skip-next",action:"media_next_track"}),r.length>0?r:void 0}}}},86184:function(e,t,r){"use strict";r.r(t),r.d(t,{DialogTryTts:function(){return B}});r(53918);var n,i,o,a,s=r(68546),c=(r(25856),r(53973),r(51095),r(50424)),u=r(55358),l=r(349),f=r(47181),p=r(22311),d=r(91741),h=r(40095),y=r(34821),m=(r(81303),r(69371)),v=r(26765),g=r(11654);function b(e){return(b="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 _(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 w(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){_(o,n,i,a,s,"next",e)}function s(e){_(o,n,i,a,s,"throw",e)}a(void 0)}))}}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 O(e,t){return(O=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function S(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 r,n=T(e);if(t){var i=T(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return x(this,r)}}function x(e,t){return!t||"object"!==b(t)&&"function"!=typeof t?P(e):t}function P(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function T(e){return(T=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function C(){C=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(!A(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&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return I(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)?I(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=V(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 j(e){var t,r=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 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 D(e,t){void 0!==e.descriptor.get?t.descriptor.get=e.descriptor.get:t.descriptor.set=e.descriptor.set}function A(e){return e.decorators&&e.decorators.length}function z(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 V(e){var t=function(e,t){if("object"!==b(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==b(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===b(t)?t:String(t)}function I(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}var B=function(e,t,r,n){var i=C();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(z(o.descriptor)||z(i.descriptor)){if(A(o)||A(i))throw new ReferenceError("Duplicated methods ("+o.key+") can't be decorated.");i.descriptor=o.descriptor}else{if(A(o)){if(A(i))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+o.key+").");i.decorators=o.decorators}D(o,i)}else t.push(o)}return t}(a.d.map(j)),e);return i.initializeClassElements(a.F,s.elements),i.runClassFinishers(a.F,s.finishers)}([(0,u.Mo)("dialog-cloud-try-tts")],(function(e,t){var r,b;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&&O(e,t)}(n,t);var r=S(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(P(t)),t}return n}(t),d:[{kind:"field",decorators:[(0,u.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,u.SB)()],key:"_loadingExample",value:function(){return!1}},{kind:"field",decorators:[(0,u.SB)()],key:"_params",value:void 0},{kind:"field",decorators:[(0,u.IO)("#target")],key:"_targetInput",value:void 0},{kind:"field",decorators:[(0,u.IO)("#message")],key:"_messageInput",value:void 0},{kind:"field",decorators:[(0,l.m)("cloudTtsTryMessage")],key:"_message",value:void 0},{kind:"field",decorators:[(0,l.m)("cloudTtsTryTarget")],key:"_target",value:void 0},{kind:"method",key:"showDialog",value:function(e){this._params=e}},{kind:"method",key:"closeDialog",value:function(){this._params=void 0,(0,f.B)(this,"dialog-closed",{dialog:this.localName})}},{kind:"method",key:"render",value:function(){return this._params?(0,c.dy)(i||(i=k(["\n <ha-dialog\n open\n @closed=","\n scrimClickAction\n escapeKeyAction\n .heading=",'\n >\n <div>\n <paper-textarea\n id="message"\n label="Message"\n .value=',"\n >\n </paper-textarea>\n\n <ha-paper-dropdown-menu\n .label=",'\n >\n <paper-listbox\n id="target"\n slot="dropdown-content"\n attr-for-selected="item-value"\n .selected=','\n >\n <paper-item item-value="browser">\n ',"\n </paper-item>\n ",'\n </paper-listbox>\n </ha-paper-dropdown-menu>\n </div>\n <mwc-button\n slot="primaryAction"\n @click=',"\n .disabled=","\n >\n <ha-svg-icon .path=","></ha-svg-icon>\n ","\n </mwc-button>\n </ha-dialog>\n "])),this.closeDialog,(0,y.i)(this.hass,this.hass.localize("ui.panel.config.cloud.account.tts.dialog.header")),this._message||this.hass.localize("ui.panel.config.cloud.account.tts.dialog.example_message","name",this.hass.user.name),this.hass.localize("ui.panel.config.cloud.account.tts.dialog.target"),this._target||"browser",this.hass.localize("ui.panel.config.cloud.account.tts.dialog.target_browser"),Object.values(this.hass.states).filter((function(e){return"media_player"===(0,p.N)(e)&&(0,h.e)(e,m.WE)})).map((function(e){return(0,c.dy)(o||(o=k(["\n <paper-item .itemValue=",">\n ","\n </paper-item>\n "])),e.entity_id,(0,d.C)(e))})),this._playExample,this._loadingExample,s.g3n,this.hass.localize("ui.panel.config.cloud.account.tts.dialog.play")):(0,c.dy)(n||(n=k([""])))}},{kind:"method",key:"_playExample",value:(b=w(regeneratorRuntime.mark((function e(){var t,r,n,i,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=String(null===(t=this._targetInput)||void 0===t?void 0:t.selected),(i=null===(r=this._messageInput)||void 0===r?void 0:r.value)&&n){e.next=4;break}return e.abrupt("return");case 4:this._message=i,this._target=n,"browser"===n?((o=new Audio).play(),this._playBrowser(i,o)):this.hass.callService("tts","cloud_say",{entity_id:n,message:i});case 7:case"end":return e.stop()}}),e,this)}))),function(){return b.apply(this,arguments)})},{kind:"method",key:"_playBrowser",value:(r=w(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._loadingExample=!0,n=this._params.defaultVoice[0],i=this._params.defaultVoice[1],e.prev=3,e.next=6,c=this.hass,u={platform:"cloud",message:t,language:n,options:{gender:i}},c.callApi("POST","tts_get_url",u);case 6:a=e.sent,o=a.path,e.next=15;break;case 10:return e.prev=10,e.t0=e.catch(3),this._loadingExample=!1,(0,v.Ys)(this,{text:"Unable to load example. ".concat(e.t0.error||e.t0.body||e.t0),warning:!0}),e.abrupt("return");case 15:r.src=o,r.addEventListener("canplaythrough",(function(){r.play()})),r.addEventListener("playing",(function(){s._loadingExample=!1})),r.addEventListener("error",(function(){(0,v.Ys)(s,{title:"Error playing audio."}),s._loadingExample=!1}));case 19:case"end":return e.stop()}var c,u}),e,this,[[3,10]])}))),function(e,t){return r.apply(this,arguments)})},{kind:"get",static:!0,key:"styles",value:function(){return[g.yu,(0,c.iv)(a||(a=k(["\n ha-dialog {\n --mdc-dialog-max-width: 500px;\n }\n "])))]}}]}}),c.oi)}}]);
//# sourceMappingURL=chunk.00743bee941ea9fd872a.js.map