(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([[3282],{2852:(e,t,r)=>{"use strict";r.d(t,{t:()=>d});var i=r(15652),n=r(85415),o=r(91177),a=r(73728),s=r(5986),l=r(52871);const d=(e,t)=>(0,l.w)(e,t,{loadDevicesAndAreas:!0,getFlowHandlers:async e=>{const[t]=await Promise.all([(0,a.d4)(e),e.loadBackendTranslation("title",void 0,!0)]);return t.sort(((t,r)=>(0,n.w)((0,s.Lh)(e.localize,t),(0,s.Lh)(e.localize,r))))},createFlow:async(e,t)=>{const[r]=await Promise.all([(0,a.Ky)(e,t),e.loadBackendTranslation("config",t)]);return r},fetchFlow:async(e,t)=>{const r=await(0,a.D4)(e,t);return await e.loadBackendTranslation("config",r.handler),r},handleFlowStep:a.XO,deleteFlow:a.oi,renderAbortDescription(e,t){const r=(0,o.I)(e.localize,`component.${t.handler}.config.abort.${t.reason}`,t.description_placeholders);return r?i.dy`
            <ha-markdown allowsvg breaks .content=${r}></ha-markdown>
          `:""},renderShowFormStepHeader:(e,t)=>e.localize(`component.${t.handler}.config.step.${t.step_id}.title`)||e.localize(`component.${t.handler}.title`),renderShowFormStepDescription(e,t){const r=(0,o.I)(e.localize,`component.${t.handler}.config.step.${t.step_id}.description`,t.description_placeholders);return r?i.dy`
            <ha-markdown allowsvg breaks .content=${r}></ha-markdown>
          `:""},renderShowFormStepFieldLabel:(e,t,r)=>e.localize(`component.${t.handler}.config.step.${t.step_id}.data.${r.name}`),renderShowFormStepFieldError:(e,t,r)=>e.localize(`component.${t.handler}.config.error.${r}`),renderExternalStepHeader:(e,t)=>e.localize(`component.${t.handler}.config.step.${t.step_id}.title`)||e.localize("ui.panel.config.integrations.config_flow.external_step.open_site"),renderExternalStepDescription(e,t){const r=(0,o.I)(e.localize,`component.${t.handler}.config.${t.step_id}.description`,t.description_placeholders);return i.dy`
        <p>
          ${e.localize("ui.panel.config.integrations.config_flow.external_step.description")}
        </p>
        ${r?i.dy`
              <ha-markdown
                allowsvg
                breaks
                .content=${r}
              ></ha-markdown>
            `:""}
      `},renderCreateEntryDescription(e,t){const r=(0,o.I)(e.localize,`component.${t.handler}.config.create_entry.${t.description||"default"}`,t.description_placeholders);return i.dy`
        ${r?i.dy`
              <ha-markdown
                allowsvg
                breaks
                .content=${r}
              ></ha-markdown>
            `:""}
        <p>
          ${e.localize("ui.panel.config.integrations.config_flow.created_config","name",t.title)}
        </p>
      `},renderShowFormProgressHeader:(e,t)=>e.localize(`component.${t.handler}.title`),renderShowFormProgressDescription(e,t){const r=(0,o.I)(e.localize,`component.${t.handler}.config.progress.${t.progress_action}`,t.description_placeholders);return r?i.dy`
            <ha-markdown allowsvg breaks .content=${r}></ha-markdown>
          `:""}})},52871:(e,t,r)=>{"use strict";r.d(t,{w:()=>o});var i=r(47181);const n=()=>Promise.all([r.e(5009),r.e(8161),r.e(2955),r.e(8200),r.e(879),r.e(1041),r.e(8374),r.e(1458),r.e(486),r.e(6863),r.e(3648),r.e(4930),r.e(1480),r.e(2474),r.e(6509),r.e(1206),r.e(4940),r.e(8331),r.e(8101),r.e(7791)]).then(r.bind(r,49877)),o=(e,t,r)=>{(0,i.B)(e,"show-dialog",{dialogTag:"dialog-data-entry-flow",dialogImport:n,dialogParams:{...t,flowConfig:r}})}},73953:(e,t,r)=>{"use strict";r.d(t,{J:()=>a});r(71948);var i=r(7778);const n=new Set(["error","state-label"]),o={"entity-filter":()=>r.e(8045).then(r.bind(r,68045))},a=e=>(0,i.Tw)("badge",e,n,o,void 0,"state-label")},51153:(e,t,r)=>{"use strict";r.d(t,{l$:()=>a,Z6:()=>s,Do:()=>l});r(49072),r(72225),r(26654),r(10175),r(80251),r(99471),r(14888),r(69377),r(95035),r(38026),r(89173),r(41043),r(57464),r(24617),r(26136),r(82778),r(28738),r(55227);var i=r(7778);const n=new Set(["ais-easy-picker","ais-button","ais-files-list","entity","entities","button","entity-button","glance","history-graph","horizontal-stack","light","sensor","thermostat","vertical-stack","weather-forecast","ais-zigbee2mqtt","ais-mini-media-player"]),o={"alarm-panel":()=>r.e(1878).then(r.bind(r,81878)),error:()=>Promise.all([r.e(9033),r.e(1572),r.e(8394)]).then(r.bind(r,55796)),"empty-state":()=>r.e(7284).then(r.bind(r,67284)),grid:()=>r.e(6169).then(r.bind(r,6169)),starting:()=>r.e(7873).then(r.bind(r,47873)),"entity-filter":()=>r.e(3688).then(r.bind(r,33688)),humidifier:()=>r.e(8558).then(r.bind(r,68558)),"media-control":()=>Promise.all([r.e(9824),r.e(4564)]).then(r.bind(r,54564)),"picture-elements":()=>Promise.all([r.e(4909),r.e(319),r.e(7282),r.e(9810),r.e(1441)]).then(r.bind(r,83358)),"picture-entity":()=>Promise.all([r.e(319),r.e(7282),r.e(8317)]).then(r.bind(r,41500)),"picture-glance":()=>Promise.all([r.e(319),r.e(7282),r.e(7987)]).then(r.bind(r,66621)),"plant-status":()=>r.e(8723).then(r.bind(r,48723)),"safe-mode":()=>r.e(4503).then(r.bind(r,24503)),"shopping-list":()=>Promise.all([r.e(7440),r.e(3376)]).then(r.bind(r,43376)),conditional:()=>r.e(8857).then(r.bind(r,68857)),gauge:()=>r.e(6130).then(r.bind(r,6130)),iframe:()=>r.e(5018).then(r.bind(r,95018)),map:()=>r.e(76).then(r.bind(r,60076)),markdown:()=>Promise.all([r.e(4940),r.e(6474)]).then(r.bind(r,51282)),picture:()=>r.e(5338).then(r.bind(r,45338)),"ais-list":()=>r.e(1401).then(r.t.bind(r,1401,7)),"ais-auto-entities":()=>r.e(2657).then(r.t.bind(r,82657,7)),"ais-monster":()=>r.e(7680).then(r.t.bind(r,47680,7)),"ais-fold-entity-row":()=>r.e(9795).then(r.t.bind(r,9795,7)),"ais-now-playing-poster":()=>r.e(6327).then(r.bind(r,86327)),"ais-light":()=>r.e(6246).then(r.bind(r,63238)),calendar:()=>Promise.resolve().then(r.bind(r,80251)),logbook:()=>Promise.all([r.e(9160),r.e(6576),r.e(851)]).then(r.bind(r,8436))},a=e=>(0,i.Xm)("card",e,n,o,void 0,void 0),s=e=>(0,i.Tw)("card",e,n,o,void 0,void 0),l=e=>(0,i.ED)(e,"card",n,o)},89026:(e,t,r)=>{"use strict";r.d(t,{t:()=>o,Q:()=>a});var i=r(7778);const n={picture:()=>r.e(9130).then(r.bind(r,69130)),buttons:()=>r.e(2587).then(r.bind(r,32587)),graph:()=>r.e(5773).then(r.bind(r,25773))},o=e=>(0,i.Tw)("header-footer",e,void 0,n,void 0,void 0),a=e=>(0,i.ED)(e,"header-footer",void 0,n)},97504:(e,t,r)=>{"use strict";r.d(t,{F:()=>o});var i=r(47181);const n=()=>Promise.all([r.e(1458),r.e(9160),r.e(3330),r.e(3648),r.e(6619),r.e(1480),r.e(2076),r.e(5796),r.e(9779),r.e(1900),r.e(2979),r.e(4077),r.e(8170)]).then(r.bind(r,52408)),o=(e,t)=>{(0,i.B)(e,"show-dialog",{dialogTag:"hui-dialog-create-card",dialogImport:n,dialogParams:t})}},19961:(e,t,r)=>{"use strict";var i=r(15652),n=r(43260),o=(r(6315),r(52039),r(90271)),a=r(73953),s=r(51153),l=r(55317),d=r(81471),c=r(87744),h=r(96151),p=r(50467),u=r(97504);function f(){f=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,t){["method","field"].forEach((function(r){t.forEach((function(t){t.kind===r&&"own"===t.placement&&this.defineClassElement(e,t)}),this)}),this)},initializeClassElements:function(e,t){var r=e.prototype;["method","field"].forEach((function(i){t.forEach((function(t){var n=t.placement;if(t.kind===i&&("static"===n||"prototype"===n)){var o="static"===n?e:r;this.defineClassElement(o,t)}}),this)}),this)},defineClassElement:function(e,t){var r=t.descriptor;if("field"===t.kind){var i=t.initializer;r={enumerable:r.enumerable,writable:r.writable,configurable:r.configurable,value:void 0===i?void 0:i.call(e)}}Object.defineProperty(e,t.key,r)},decorateClass:function(e,t){var r=[],i=[],n={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,n)}),this),e.forEach((function(e){if(!y(e))return r.push(e);var t=this.decorateElement(e,n);r.push(t.element),r.push.apply(r,t.extras),i.push.apply(i,t.finishers)}),this),!t)return{elements:r,finishers:i};var o=this.decorateConstructor(r,t);return i.push.apply(i,o.finishers),o.finishers=i,o},addElementPlacement:function(e,t,r){var i=t[e.placement];if(!r&&-1!==i.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");i.push(e.key)},decorateElement:function(e,t){for(var r=[],i=[],n=e.decorators,o=n.length-1;o>=0;o--){var a=t[e.placement];a.splice(a.indexOf(e.key),1);var s=this.fromElementDescriptor(e),l=this.toElementFinisherExtras((0,n[o])(s)||s);e=l.element,this.addElementPlacement(e,t),l.finisher&&i.push(l.finisher);var d=l.extras;if(d){for(var c=0;c<d.length;c++)this.addElementPlacement(d[c],t);r.push.apply(r,d)}}return{element:e,finishers:i,extras:r}},decorateConstructor:function(e,t){for(var r=[],i=t.length-1;i>=0;i--){var n=this.fromClassDescriptor(e),o=this.toClassDescriptor((0,t[i])(n)||n);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 k(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)?k(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=w(e.key),i=String(e.placement);if("static"!==i&&"prototype"!==i&&"own"!==i)throw new TypeError('An element descriptor\'s .placement property must be one of "static", "prototype" or "own", but a decorator created an element descriptor with .placement "'+i+'"');var n=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var o={kind:t,key:r,placement:i,descriptor:Object.assign({},n)};return"field"!==t?this.disallowProperty(e,"initializer","A method descriptor"):(this.disallowProperty(n,"get","The property descriptor of a field descriptor"),this.disallowProperty(n,"set","The property descriptor of a field descriptor"),this.disallowProperty(n,"value","The property descriptor of a field descriptor"),o.initializer=e.initializer),o},toElementFinisherExtras:function(e){return{element:this.toElementDescriptor(e),finisher:g(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=g(e,"finisher");return{elements:this.toElementDescriptors(e.elements),finisher:r}},runClassFinishers:function(e,t){for(var r=0;r<t.length;r++){var i=(0,t[r])(e);if(void 0!==i){if("function"!=typeof i)throw new TypeError("Finishers must return a constructor.");e=i}}return e},disallowProperty:function(e,t,r){if(void 0!==e[t])throw new TypeError(r+" can't have a ."+t+" property.")}};return e}function m(e){var t,r=w(e.key);"method"===e.kind?t={value:e.value,writable:!0,configurable:!0,enumerable:!1}:"get"===e.kind?t={get:e.value,configurable:!0,enumerable:!1}:"set"===e.kind?t={set:e.value,configurable:!0,enumerable:!1}:"field"===e.kind&&(t={configurable:!0,writable:!0,enumerable:!0});var i={kind:"field"===e.kind?"field":"method",key:r,placement:e.static?"static":"field"===e.kind?"own":"prototype",descriptor:t};return e.decorators&&(i.decorators=e.decorators),"field"===e.kind&&(i.initializer=e.value),i}function v(e,t){void 0!==e.descriptor.get?t.descriptor.get=e.descriptor.get:t.descriptor.set=e.descriptor.set}function y(e){return e.decorators&&e.decorators.length}function b(e){return void 0!==e&&!(void 0===e.value&&void 0===e.writable)}function g(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 w(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function k(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r<t;r++)i[r]=e[r];return i}function E(e,t,r){return(E="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var i=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=_(e)););return e}(e,t);if(i){var n=Object.getOwnPropertyDescriptor(i,t);return n.get?n.get.call(r):n.value}})(e,t,r||e)}function _(e){return(_=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}let C=!1;const P=(e,t)=>{let r=0;for(let i=0;i<e.length;i++){if(e[i]<5){r=i;break}e[i]<e[r]&&(r=i)}return e[r]+=t,r};let x=function(e,t,r,i){var n=f();if(i)for(var o=0;o<i.length;o++)n=i[o](n);var a=t((function(e){n.initializeInstanceElements(e,s.elements)}),r),s=n.decorateClass(function(e){for(var t=[],r=function(e){return"method"===e.kind&&e.key===o.key&&e.placement===o.placement},i=0;i<e.length;i++){var n,o=e[i];if("method"===o.kind&&(n=t.find(r)))if(b(o.descriptor)||b(n.descriptor)){if(y(o)||y(n))throw new ReferenceError("Duplicated methods ("+o.key+") can't be decorated.");n.descriptor=o.descriptor}else{if(y(o)){if(y(n))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+o.key+").");n.decorators=o.decorators}v(o,n)}else t.push(o)}return t}(a.d.map(m)),e);return n.initializeClassElements(a.F,s.elements),n.runClassFinishers(a.F,s.finishers)}(null,(function(e,t){class n extends t{constructor(){super(),e(this),this.addEventListener("iron-resize",(e=>e.stopPropagation()))}}return{F:n,d:[{kind:"field",decorators:[(0,i.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,i.Cb)({attribute:!1})],key:"lovelace",value:void 0},{kind:"field",decorators:[(0,i.Cb)({type:Boolean})],key:"narrow",value:void 0},{kind:"field",decorators:[(0,i.Cb)({type:Number})],key:"index",value:void 0},{kind:"field",decorators:[(0,i.Cb)({attribute:!1})],key:"cards",value:()=>[]},{kind:"field",decorators:[(0,i.Cb)({attribute:!1})],key:"badges",value:()=>[]},{kind:"field",decorators:[(0,i.sz)()],key:"_columns",value:void 0},{kind:"field",key:"_createColumnsIteration",value:()=>0},{kind:"field",key:"_mqls",value:void 0},{kind:"method",key:"setConfig",value:function(e){}},{kind:"method",key:"render",value:function(){var e;return i.dy`
      <div
        id="badges"
        style=${this.badges.length>0?"display: block":"display: none"}
      >
        ${this.badges.map((e=>i.dy`${e}`))}
      </div>
      <div id="columns"></div>
      ${(null===(e=this.lovelace)||void 0===e?void 0:e.editMode)?i.dy`
            <mwc-fab
              .label=${this.hass.localize("ui.panel.lovelace.editor.edit_card.add")}
              extended
              @click=${this._addCard}
              class=${(0,d.$)({rtl:(0,c.HE)(this.hass)})}
            >
              <ha-svg-icon slot="icon" .path=${l.qX5}></ha-svg-icon>
            </mwc-fab>
          `:""}
    `}},{kind:"method",key:"firstUpdated",value:function(){this._mqls=[300,600,900,1200].map((e=>{const t=window.matchMedia(`(min-width: ${e}px)`);return t.addListener((()=>this._updateColumns())),t})),this._updateColumns()}},{kind:"method",key:"updated",value:function(e){var t,i,o;if(E(_(n.prototype),"updated",this).call(this,e),(null===(t=this.lovelace)||void 0===t?void 0:t.editMode)&&!C&&(C=!0,Promise.all([r.e(2174),r.e(9290),r.e(4910)]).then(r.bind(r,70858))),e.has("hass")){const t=e.get("hass");if(t&&this.hass.dockedSidebar!==t.dockedSidebar&&this._updateColumns(),1===e.size)return}e.has("narrow")&&this._updateColumns();const a=e.get("lovelace");(e.has("lovelace")&&((null==a?void 0:a.config)!==(null===(i=this.lovelace)||void 0===i?void 0:i.config)||(null==a?void 0:a.editMode)!==(null===(o=this.lovelace)||void 0===o?void 0:o.editMode))||e.has("_columns"))&&this._createColumns()}},{kind:"method",key:"_addCard",value:function(){(0,u.F)(this,{lovelaceConfig:this.lovelace.config,saveConfig:this.lovelace.saveConfig,path:[this.index]})}},{kind:"method",key:"_createColumns",value:async function(){if(!this._columns)return;this._createColumnsIteration++;const e=this._createColumnsIteration,t=this.shadowRoot.getElementById("columns");for(;t.lastChild;)t.removeChild(t.lastChild);const r=[],i=[];for(let a=0;a<Math.min(this._columns,this.cards.length);a++){const e=document.createElement("div");e.classList.add("column"),t.appendChild(e),r.push(0),i.push(e)}let n,o;for(const[a,s]of this.cards.entries()){let t;void 0===n&&(n=(0,h.y)().then((()=>{n=void 0,o=void 0}))),void 0===o?o=new Date:(new Date).getTime()-o.getTime()>16&&(t=n);const l=(0,p.N)(s),[d]=await Promise.all([l,t]);if(e!==this._createColumnsIteration)return;this._addCardToColumn(i[P(r,d)],a,this.lovelace.editMode)}i.forEach((e=>{e.lastChild||e.parentElement.removeChild(e)}))}},{kind:"method",key:"_addCardToColumn",value:function(e,t,r){const i=this.cards[t];if(r){const r=document.createElement("hui-card-options");r.hass=this.hass,r.lovelace=this.lovelace,r.path=[this.index,t],i.editMode=!0,r.appendChild(i),e.appendChild(r)}else i.editMode=!1,e.appendChild(i)}},{kind:"method",key:"_updateColumns",value:function(){if(!this._mqls)return;const e=this._mqls.reduce(((e,t)=>e+Number(t.matches)),0);this._columns=Math.max(1,e-Number(!this.narrow&&"docked"===this.hass.dockedSidebar))}},{kind:"get",static:!0,key:"styles",value:function(){return i.iv`
      :host {
        display: block;
        padding-top: 4px;
        height: 100%;
        box-sizing: border-box;
      }

      #badges {
        margin: 8px 16px;
        font-size: 85%;
        text-align: center;
      }

      #columns {
        display: flex;
        flex-direction: row;
        justify-content: center;
        margin-left: 4px;
        margin-right: 4px;
      }

      .column {
        flex: 1 0 0;
        max-width: 500px;
        min-width: 0;
      }

      .column > * {
        display: block;
        margin: 4px 4px 8px;
      }

      mwc-fab {
        position: sticky;
        float: right;
        right: calc(16px + env(safe-area-inset-right));
        bottom: calc(16px + env(safe-area-inset-bottom));
        z-index: 1;
      }

      mwc-fab.rtl {
        float: left;
        right: auto;
        left: calc(16px + env(safe-area-inset-left));
      }

      @media (max-width: 500px) {
        .column > * {
          margin-left: 0;
          margin-right: 0;
        }
      }

      @media (max-width: 599px) {
        .column {
          max-width: 600px;
        }
      }
    `}}]}}),i.oi);customElements.define("hui-masonry-view",x);var D=r(7778);const z=new Set(["masonry"]),S={panel:()=>r.e(8480).then(r.bind(r,48480))};function A(){A=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,t){["method","field"].forEach((function(r){t.forEach((function(t){t.kind===r&&"own"===t.placement&&this.defineClassElement(e,t)}),this)}),this)},initializeClassElements:function(e,t){var r=e.prototype;["method","field"].forEach((function(i){t.forEach((function(t){var n=t.placement;if(t.kind===i&&("static"===n||"prototype"===n)){var o="static"===n?e:r;this.defineClassElement(o,t)}}),this)}),this)},defineClassElement:function(e,t){var r=t.descriptor;if("field"===t.kind){var i=t.initializer;r={enumerable:r.enumerable,writable:r.writable,configurable:r.configurable,value:void 0===i?void 0:i.call(e)}}Object.defineProperty(e,t.key,r)},decorateClass:function(e,t){var r=[],i=[],n={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,n)}),this),e.forEach((function(e){if(!O(e))return r.push(e);var t=this.decorateElement(e,n);r.push(t.element),r.push.apply(r,t.extras),i.push.apply(i,t.finishers)}),this),!t)return{elements:r,finishers:i};var o=this.decorateConstructor(r,t);return i.push.apply(i,o.finishers),o.finishers=i,o},addElementPlacement:function(e,t,r){var i=t[e.placement];if(!r&&-1!==i.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");i.push(e.key)},decorateElement:function(e,t){for(var r=[],i=[],n=e.decorators,o=n.length-1;o>=0;o--){var a=t[e.placement];a.splice(a.indexOf(e.key),1);var s=this.fromElementDescriptor(e),l=this.toElementFinisherExtras((0,n[o])(s)||s);e=l.element,this.addElementPlacement(e,t),l.finisher&&i.push(l.finisher);var d=l.extras;if(d){for(var c=0;c<d.length;c++)this.addElementPlacement(d[c],t);r.push.apply(r,d)}}return{element:e,finishers:i,extras:r}},decorateConstructor:function(e,t){for(var r=[],i=t.length-1;i>=0;i--){var n=this.fromClassDescriptor(e),o=this.toClassDescriptor((0,t[i])(n)||n);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 M(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)?M(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),i=String(e.placement);if("static"!==i&&"prototype"!==i&&"own"!==i)throw new TypeError('An element descriptor\'s .placement property must be one of "static", "prototype" or "own", but a decorator created an element descriptor with .placement "'+i+'"');var n=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var o={kind:t,key:r,placement:i,descriptor:Object.assign({},n)};return"field"!==t?this.disallowProperty(e,"initializer","A method descriptor"):(this.disallowProperty(n,"get","The property descriptor of a field descriptor"),this.disallowProperty(n,"set","The property descriptor of a field descriptor"),this.disallowProperty(n,"value","The property descriptor of a field descriptor"),o.initializer=e.initializer),o},toElementFinisherExtras:function(e){return{element:this.toElementDescriptor(e),finisher:F(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=F(e,"finisher");return{elements:this.toElementDescriptors(e.elements),finisher:r}},runClassFinishers:function(e,t){for(var r=0;r<t.length;r++){var i=(0,t[r])(e);if(void 0!==i){if("function"!=typeof i)throw new TypeError("Finishers must return a constructor.");e=i}}return e},disallowProperty:function(e,t,r){if(void 0!==e[t])throw new TypeError(r+" can't have a ."+t+" property.")}};return e}function T(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 i={kind:"field"===e.kind?"field":"method",key:r,placement:e.static?"static":"field"===e.kind?"own":"prototype",descriptor:t};return e.decorators&&(i.decorators=e.decorators),"field"===e.kind&&(i.initializer=e.value),i}function $(e,t){void 0!==e.descriptor.get?t.descriptor.get=e.descriptor.get:t.descriptor.set=e.descriptor.set}function O(e){return e.decorators&&e.decorators.length}function j(e){return void 0!==e&&!(void 0===e.value&&void 0===e.writable)}function F(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"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function M(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r<t;r++)i[r]=e[r];return i}function B(e,t,r){return(B="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var i=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=R(e)););return e}(e,t);if(i){var n=Object.getOwnPropertyDescriptor(i,t);return n.get?n.get.call(r):n.value}})(e,t,r||e)}function R(e){return(R=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}!function(e,t,r,i){var n=A();if(i)for(var o=0;o<i.length;o++)n=i[o](n);var a=t((function(e){n.initializeInstanceElements(e,s.elements)}),r),s=n.decorateClass(function(e){for(var t=[],r=function(e){return"method"===e.kind&&e.key===o.key&&e.placement===o.placement},i=0;i<e.length;i++){var n,o=e[i];if("method"===o.kind&&(n=t.find(r)))if(j(o.descriptor)||j(n.descriptor)){if(O(o)||O(n))throw new ReferenceError("Duplicated methods ("+o.key+") can't be decorated.");n.descriptor=o.descriptor}else{if(O(o)){if(O(n))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+o.key+").");n.decorators=o.decorators}$(o,n)}else t.push(o)}return t}(a.d.map(T)),e);n.initializeClassElements(a.F,s.elements),n.runClassFinishers(a.F,s.finishers)}([(0,i.Mo)("hui-view")],(function(e,t){class r extends t{constructor(...t){super(...t),e(this)}}return{F:r,d:[{kind:"field",decorators:[(0,i.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,i.Cb)({attribute:!1})],key:"lovelace",value:void 0},{kind:"field",decorators:[(0,i.Cb)({type:Boolean})],key:"narrow",value:void 0},{kind:"field",decorators:[(0,i.Cb)({type:Number})],key:"index",value:void 0},{kind:"field",decorators:[(0,i.sz)()],key:"_cards",value:()=>[]},{kind:"field",decorators:[(0,i.sz)()],key:"_badges",value:()=>[]},{kind:"field",key:"_layoutElement",value:void 0},{kind:"method",key:"createCardElement",value:function(e){const t=(0,s.Z6)(e);return t.hass=this.hass,t.addEventListener("ll-rebuild",(r=>{this.lovelace.editMode||(r.stopPropagation(),this._rebuildCard(t,e))}),{once:!0}),t}},{kind:"method",key:"createBadgeElement",value:function(e){const t=(0,a.J)(e);return t.hass=this.hass,t.addEventListener("ll-badge-rebuild",(()=>{this._rebuildBadge(t,e)}),{once:!0}),t}},{kind:"method",key:"updated",value:function(e){B(R(r.prototype),"updated",this).call(this,e);const t=this.hass,i=this.lovelace,o=e.has("hass"),a=e.get("lovelace");let s,l=!1,d=!1;var c;e.has("index")?d=!0:e.has("lovelace")&&(l=a&&i.editMode!==a.editMode,d=!a||i.config!==a.config),d&&(s=i.config.views[this.index],s={...s,type:s.panel?"panel":s.type||"masonry"}),d&&!this._layoutElement&&(this._layoutElement=(c=s,(0,D.Tw)("view",c,z,S))),d&&(this._createBadges(s),this._createCards(s),this._layoutElement.hass=this.hass,this._layoutElement.narrow=this.narrow,this._layoutElement.lovelace=i,this._layoutElement.index=this.index),o&&(this._badges.forEach((e=>{e.hass=t})),this._cards.forEach((e=>{e.hass=t})),this._layoutElement.hass=this.hass),e.has("narrow")&&(this._layoutElement.narrow=this.narrow),l&&(this._layoutElement.lovelace=i),(d||o||l||e.has("_cards")||e.has("_badges"))&&(this._layoutElement.cards=this._cards,this._layoutElement.badges=this._badges);const h=e.get("hass");(d||l||o&&h&&(t.themes!==h.themes||t.selectedTheme!==h.selectedTheme))&&(0,n.R)(this,t.themes,i.config.views[this.index].theme),this._layoutElement&&!this.lastChild&&this.appendChild(this._layoutElement)}},{kind:"method",key:"_createBadges",value:function(e){if(!e||!e.badges||!Array.isArray(e.badges))return void(this._badges=[]);const t=(0,o.A)(e.badges);this._badges=t.map((e=>{const t=(0,a.J)(e);return t.hass=this.hass,t}))}},{kind:"method",key:"_createCards",value:function(e){e&&e.cards&&Array.isArray(e.cards)?this._cards=e.cards.map((e=>{const t=this.createCardElement(e);return t.hass=this.hass,t})):this._cards=[]}},{kind:"method",key:"_rebuildCard",value:function(e,t){const r=this.createCardElement(t);r.hass=this.hass,e.parentElement&&e.parentElement.replaceChild(r,e),this._cards=this._cards.map((t=>t===e?r:t))}},{kind:"method",key:"_rebuildBadge",value:function(e,t){const r=this.createBadgeElement(t);r.hass=this.hass,e.parentElement&&e.parentElement.replaceChild(r,e),this._badges=this._badges.map((t=>t===e?r:t))}}]}}),i.f4)}}]);
//# sourceMappingURL=chunk.6b29cc45eb334e0743b4.js.map