iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
14 lines • 41.3 kB
JavaScript
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[10615],{17079:function(e,t,i){i.d(t,{X:function(){return o}});i(16280),i(44114);class o{hostConnected(){window.addEventListener("undo-change",this._onUndoChange)}hostDisconnected(){window.removeEventListener("undo-change",this._onUndoChange)}get canUndo(){return this._undoStack.length>0}get canRedo(){return this._redoStack.length>0}commit(e){this._undoStack.length>=this._stackLimit&&this._undoStack.shift(),this._undoStack.push(Object.assign({},e)),this._redoStack=[]}undo(){if(0===this._undoStack.length)return;this._redoStack.push(Object.assign({},this._currentConfig()));const e=this._undoStack.pop();this._apply(e),this._host.requestUpdate()}redo(){if(0===this._redoStack.length)return;this._undoStack.push(Object.assign({},this._currentConfig()));const e=this._redoStack.pop();this._apply(e),this._host.requestUpdate()}reset(){this._undoStack=[],this._redoStack=[]}constructor(e,t){this._undoStack=[],this._redoStack=[],this._stackLimit=75,this._apply=()=>{throw new Error("No apply function provided")},this._currentConfig=()=>{throw new Error("No currentConfig function provided")},this._onUndoChange=e=>{e.stopPropagation(),this.undo(),this._host.requestUpdate()},void 0!==t.stackLimit&&(this._stackLimit=t.stackLimit),this._apply=t.apply,this._currentConfig=t.currentConfig,this._host=e,e.addController(this)}}},51758:function(e,t,i){i.d(t,{Z:function(){return o}});const o=e=>{const t=window.location.pathname;return e?t+"?"+e:t}},99028:function(e,t,i){i.a(e,async function(e,o){try{i.r(t),i.d(t,{HaIconButtonArrowNext:function(){return p}});i(62953);var a=i(40445),n=i(5124),s=i(67576),r=i(63091),l=i(26300),h=e([l]);l=(h.then?(await h)():h)[0];let c,d=e=>e;const u="M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z",v="M4,11V13H16L10.5,18.5L11.92,19.92L19.84,12L11.92,4.08L10.5,5.5L16,11H4Z";class p extends n.WF{render(){var e;return(0,n.qy)(c||(c=d` <ha-icon-button .disabled="${0}" .label="${0}" .path="${0}"></ha-icon-button> `),this.disabled,this.label||(null===(e=this.hass)||void 0===e?void 0:e.localize("ui.common.next"))||"Next",this._icon)}constructor(...e){super(...e),this.disabled=!1,this._icon="rtl"===r.G.document.dir?u:v}}(0,a.Cg)([(0,s.MZ)({attribute:!1})],p.prototype,"hass",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean})],p.prototype,"disabled",void 0),(0,a.Cg)([(0,s.MZ)()],p.prototype,"label",void 0),(0,a.Cg)([(0,s.wk)()],p.prototype,"_icon",void 0),p=(0,a.Cg)([(0,s.EM)("ha-icon-button-arrow-next")],p),o()}catch(c){o(c)}})},62647:function(e,t,i){var o=i(40445),a=i(9866),n=i(5124),s=i(67576);let r,l=e=>e;class h extends a.A{static get styles(){return[a.A.styles,(0,n.AH)(r||(r=l`:host{font-size:var(--ha-font-size-m);--wa-color-brand-on-quiet:var(
--ha-tab-active-text-color,
var(--primary-color)
);--wa-color-neutral-on-quiet:var(--wa-color-brand-on-quiet);opacity:.8;color:inherit;--wa-space-l:16px}:host([active]:not([disabled])){opacity:1} (hover:hover){:host(:hover:not([disabled]):not([active])) .tab{color:var(--wa-color-brand-on-quiet)}}`))]}}h=(0,o.Cg)([(0,s.EM)("ha-tab-group-tab")],h)},66289:function(e,t,i){i.a(e,async function(e,t){try{i(62953);var o=i(40445),a=i(42814),n=i(5124),s=i(67576),r=i(36356),l=e([a]);a=(l.then?(await l)():l)[0];let h,c=e=>e;class d extends a.A{connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",this._handleKeyDown,!0)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this._handleKeyDown,!0)}handleClick(e){this._dragScrollController.scrolled||super.handleClick(e)}static get styles(){return[a.A.styles,(0,n.AH)(h||(h=c`:host{--track-width:2px;--track-color:var(--ha-tab-track-color, var(--divider-color));--indicator-color:var(
--ha-tab-indicator-color,
var(--primary-color)
);--wa-color-neutral-on-quiet:var(--indicator-color)}.tab-group-top ::slotted(ha-tab-group-tab[active]){border-block-end:solid var(--track-width) var(--indicator-color);margin-block-end:calc(-1 * var(--track-width))}.tab-group-start ::slotted(ha-tab-group-tab[active]){border-inline-end:solid var(--track-width) var(--indicator-color);margin-inline-end:calc(-1 * var(--track-width))}.tab-group-end ::slotted(ha-tab-group-tab[active]){border-inline-start:solid var(--track-width) var(--indicator-color);margin-inline-start:calc(-1 * var(--track-width))}.scroll-button::part(base):hover{background-color:transparent}`))]}constructor(...e){super(...e),this._dragScrollController=new r.q(this,{selector:".nav"}),this.tabTag="ha-tab-group-tab",this.tabOnly=!0,this._handleKeyDown=e=>{(e.altKey||e.metaKey)&&e.stopPropagation()}}}(0,o.Cg)([(0,s.MZ)({attribute:"tab-tag"})],d.prototype,"tabTag",void 0),(0,o.Cg)([(0,s.MZ)({attribute:"tab-only",type:Boolean})],d.prototype,"tabOnly",void 0),d=(0,o.Cg)([(0,s.EM)("ha-tab-group")],d),t()}catch(h){t(h)}})},9022:function(e,t,i){i.d(t,{i:function(){return a}});i(3362),i(62953);var o=i(1087);const a=(e,t)=>(0,o.r)(e,"show-dialog",{dialogTag:"dialog-list-items",dialogImport:()=>i.e(75939).then(i.bind(i,21006)),dialogParams:t})},34023:function(e,t,i){i.d(t,{E:function(){return a},J:function(){return n}});i(3362),i(62953);var o=i(1087);const a=()=>Promise.all([i.e(32450),i.e(7305),i.e(92769),i.e(3283),i.e(85010),i.e(89100),i.e(33889),i.e(62574),i.e(26092),i.e(39005),i.e(8851),i.e(66201),i.e(52808),i.e(33887),i.e(33790),i.e(61023)]).then(i.bind(i,39803)),n=(e,t)=>{(0,o.r)(e,"show-dialog",{dialogTag:"dialog-area-registry-detail",dialogImport:a,dialogParams:t})}},14839:function(e,t,i){i.d(t,{l:function(){return n}});i(3362),i(62953);var o=i(1087);const a=()=>i.e(58938).then(i.bind(i,59502)),n=(e,t)=>{(0,o.r)(e,"show-dialog",{dialogTag:"ha-dialog-new-automation",dialogImport:a,dialogParams:t})}},76559:function(e,t,i){i.d(t,{X:function(){return a},n:function(){return n}});i(3362),i(62953);var o=i(1087);const a=(e,t)=>{(0,o.r)(e,"show-dialog",{dialogTag:"dialog-add-integration",dialogImport:()=>Promise.all([i.e(92769),i.e(50672)]).then(i.bind(i,60051)),dialogParams:t})},n=(e,t)=>{(0,o.r)(e,"show-dialog",{dialogTag:"dialog-yaml-integration",dialogImport:()=>i.e(24096).then(i.bind(i,95683)),dialogParams:t})}},58142:function(e,t,i){i.d(t,{T:function(){return a},o:function(){return n}});i(3362),i(62953);var o=i(1087);const a=()=>Promise.all([i.e(72850),i.e(39763),i.e(32450),i.e(7305),i.e(92769),i.e(3283),i.e(59979),i.e(27671),i.e(17388),i.e(62574),i.e(26092),i.e(39005),i.e(8851),i.e(82209),i.e(1535),i.e(33887),i.e(80850)]).then(i.bind(i,33256)),n=(e,t)=>{(0,o.r)(e,"show-dialog",{dialogTag:"dialog-person-detail",dialogImport:a,dialogParams:t})}},46925:function(e,t,i){i.d(t,{Y:function(){return n}});i(3362),i(62953);var o=i(1087);const a=()=>i.e(856).then(i.bind(i,9579)),n=(e,t)=>{(0,o.r)(e,"show-dialog",{dialogTag:"dialog-dashboard-strategy-editor",dialogImport:a,dialogParams:t})}},1412:function(e,t,i){i.d(t,{z:function(){return s}});i(3362),i(62953);var o=i(1087);const a="show-save-config";let n=!1;const s=(e,t)=>{n||(n=!0,(0,o.r)(e,"register-dialog",{dialogShowEvent:a,dialogTag:"hui-dialog-save-config",dialogImport:()=>i.e(87980).then(i.bind(i,24519))})),(0,o.r)(e,a,t)}},874:function(e,t,i){i.d(t,{f:function(){return s}});i(3362),i(62953);var o=i(1087);let a=!1;const n="show-edit-view",s=(e,t)=>{a||(a=!0,(e=>{(0,o.r)(e,"register-dialog",{dialogShowEvent:n,dialogTag:"hui-dialog-edit-view",dialogImport:()=>i.e(5590).then(i.bind(i,70997))})})(e)),(0,o.r)(e,n,t)}},29994:function(e,t,i){i.a(e,async function(e,t){try{i(49255),i(44114),i(18111),i(22489),i(20116),i(7588),i(61701),i(13579),i(3362),i(27495),i(62953);var o=i(40445),a=i(5124),n=i(67576),s=i(6412),r=i(63672),l=i(22786),h=i(36312),c=i(17079),d=i(1087),u=i(91926),v=i(51758),p=i(6030),g=i(12587),b=i(18350),w=i(29823),f=(i(70947),i(47680),i(26300)),_=i(99028),m=i(90248),y=i(2054),C=(i(67094),i(66289)),V=(i(62647),i(34127)),k=i(53641),x=i(35952),A=i(71730),M=i(25612),$=i(99774),H=i(85547),L=i(9022),S=i(65063),z=i(24673),P=i(42269),E=i(34779),q=i(27560),I=i(14503),Z=i(36918),T=i(41570),R=i(84187),B=i(81619),D=i(34023),U=i(14839),N=i(76559),F=i(96489),O=i(60653),K=i(58142),W=i(82360),j=i(46925),J=i(1412),Q=i(874),X=i(15656),Y=i(53338),G=i(75400),ee=(i(77985),i(87778),i(44249)),te=i(59531),ie=e([b,w,f,_,m,y,C,V,G,z]);[b,w,f,_,m,y,C,V,G,z]=ie.then?(await ie)():ie;let oe,ae,ne,se,re,le,he,ce,de,ue,ve,pe,ge,be,we,fe,_e,me,ye,Ce,Ve,ke,xe,Ae,Me=e=>e;const $e="M12,4A4,4 0 0,1 16,8A4,4 0 0,1 12,12A4,4 0 0,1 8,8A4,4 0 0,1 12,4M12,14C16.42,14 20,15.79 20,18V20H4V18C4,15.79 7.58,14 12,14Z",He="M8,3A2,2 0 0,0 6,5V9A2,2 0 0,1 4,11H3V13H4A2,2 0 0,1 6,15V19A2,2 0 0,0 8,21H10V19H8V14A2,2 0 0,0 6,12A2,2 0 0,0 8,10V5H10V3M16,3A2,2 0 0,1 18,5V9A2,2 0 0,0 20,11H21V13H20A2,2 0 0,0 18,15V19A2,2 0 0,1 16,21H14V19H16V14A2,2 0 0,1 18,12A2,2 0 0,1 16,10V5H14V3H16Z",Le="M9,22A1,1 0 0,1 8,21V18H4A2,2 0 0,1 2,16V4C2,2.89 2.9,2 4,2H20A2,2 0 0,1 22,4V16A2,2 0 0,1 20,18H13.9L10.2,21.71C10,21.9 9.75,22 9.5,22V22H9M10,16V19.08L13.08,16H20V4H4V16H10M17,11H15V9H17V11M13,11H11V9H13V11M9,11H7V9H9V11Z",Se="M3 6H21V4H3C1.9 4 1 4.9 1 6V18C1 19.1 1.9 20 3 20H7V18H3V6M13 12H9V13.78C8.39 14.33 8 15.11 8 16C8 16.89 8.39 17.67 9 18.22V20H13V18.22C13.61 17.67 14 16.88 14 16S13.61 14.33 13 13.78V12M11 17.5C10.17 17.5 9.5 16.83 9.5 16S10.17 14.5 11 14.5 12.5 15.17 12.5 16 11.83 17.5 11 17.5M22 8H16C15.5 8 15 8.5 15 9V19C15 19.5 15.5 20 16 20H22C22.5 20 23 19.5 23 19V9C23 8.5 22.5 8 22 8M21 18H17V10H21V18Z",ze="M12,16A2,2 0 0,1 14,18A2,2 0 0,1 12,20A2,2 0 0,1 10,18A2,2 0 0,1 12,16M12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12A2,2 0 0,1 12,10M12,4A2,2 0 0,1 14,6A2,2 0 0,1 12,8A2,2 0 0,1 10,6A2,2 0 0,1 12,4Z",Pe="M15,7H20.5L15,1.5V7M8,0H16L22,6V18A2,2 0 0,1 20,20H8C6.89,20 6,19.1 6,18V2A2,2 0 0,1 8,0M4,4V22H20V24H4A2,2 0 0,1 2,22V4H4Z",Ee="M5,15.5L7.5,20H2.5L5,15.5M9,19H21V17H9V19M5,9.5L7.5,14H2.5L5,9.5M9,13H21V11H9V13M5,3.5L7.5,8H2.5L5,3.5M9,7H21V5H9V7Z",qe="M11,18H13V16H11V18M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,6A4,4 0 0,0 8,10H10A2,2 0 0,1 12,8A2,2 0 0,1 14,10C14,12 11,11.75 11,15H13C13,12.75 16,12.5 16,10A4,4 0 0,0 12,6Z",Ie="M9.5,3A6.5,6.5 0 0,1 16,9.5C16,11.11 15.41,12.59 14.44,13.73L14.71,14H15.5L20.5,19L19,20.5L14,15.5V14.71L13.73,14.44C12.59,15.41 11.11,16 9.5,16A6.5,6.5 0 0,1 3,9.5A6.5,6.5 0 0,1 9.5,3M9.5,5C7,5 5,7 5,9.5C5,12 7,14 9.5,14C12,14 14,12 14,9.5C14,7 12,5 9.5,5Z",Ze="M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z",Te="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",Re="M18.4,10.6C16.55,9 14.15,8 11.5,8C6.85,8 2.92,11.03 1.54,15.22L3.9,16C4.95,12.81 7.95,10.5 11.5,10.5C13.45,10.5 15.23,11.22 16.62,12.38L13,16H22V7L18.4,10.6Z",Be="M17.65,6.35C16.2,4.9 14.21,4 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20C15.73,20 18.84,17.45 19.73,14H17.65C16.83,16.33 14.61,18 12,18A6,6 0 0,1 6,12A6,6 0 0,1 12,6C13.66,6 15.14,6.69 16.22,7.78L13,11H20V4L17.65,6.35Z",De="M12,2A2,2 0 0,1 14,4C14,4.74 13.6,5.39 13,5.73V7H14A7,7 0 0,1 21,14H22A1,1 0 0,1 23,15V18A1,1 0 0,1 22,19H21V20A2,2 0 0,1 19,22H5A2,2 0 0,1 3,20V19H2A1,1 0 0,1 1,18V15A1,1 0 0,1 2,14H3A7,7 0 0,1 10,7H11V5.73C10.4,5.39 10,4.74 10,4A2,2 0 0,1 12,2M7.5,13A2.5,2.5 0 0,0 5,15.5A2.5,2.5 0 0,0 7.5,18A2.5,2.5 0 0,0 10,15.5A2.5,2.5 0 0,0 7.5,13M16.5,13A2.5,2.5 0 0,0 14,15.5A2.5,2.5 0 0,0 16.5,18A2.5,2.5 0 0,0 19,15.5A2.5,2.5 0 0,0 16.5,13Z",Ue="M11,13.5V21.5H3V13.5H11M12,2L17.5,11H6.5L12,2M17.5,13C20,13 22,15 22,17.5C22,20 20,22 17.5,22C15,22 13,20 13,17.5C13,15 15,13 17.5,13Z",Ne="M12.5 7C12.5 5.89 13.39 5 14.5 5H18C19.1 5 20 5.9 20 7V9.16C18.84 9.57 18 10.67 18 11.97V14H12.5V7M6 11.96V14H11.5V7C11.5 5.89 10.61 5 9.5 5H6C4.9 5 4 5.9 4 7V9.15C5.16 9.56 6 10.67 6 11.96M20.66 10.03C19.68 10.19 19 11.12 19 12.12V15H5V12C5 10.9 4.11 10 3 10S1 10.9 1 12V17C1 18.1 1.9 19 3 19V21H5V19H19V21H21V19C22.1 19 23 18.1 23 17V12C23 10.79 21.91 9.82 20.66 10.03Z",Fe="M12.5,8C9.85,8 7.45,9 5.6,10.6L2,7V16H11L7.38,12.38C8.77,11.22 10.54,10.5 12.5,10.5C16.04,10.5 19.05,12.81 20.1,16L22.47,15.22C21.08,11.03 17.15,8 12.5,8Z",Oe="M13,3V9H21V3M13,21H21V11H13M3,21H11V15H3M3,13H11V3H3V13Z",Ke="M21,19V20H3V19L5,17V11C5,7.9 7.03,5.17 10,4.29C10,4.19 10,4.1 10,4A2,2 0 0,1 12,2A2,2 0 0,1 14,4C14,4.1 14,4.19 14,4.29C16.97,5.17 19,7.9 19,11V17L21,19M14,21A2,2 0 0,1 12,23A2,2 0 0,1 10,21";class We extends a.WF{get _livePanel(){var e,t;if(this.panel)return null!==(e=null===(t=this.hass.panels)||void 0===t?void 0:t[this.panel.url_path])&&void 0!==e?e:this.panel}_renderActionItems(){var e,t;const i=[];this._editMode?i.push((0,a.qy)(oe||(oe=Me`<ha-icon-button slot="toolbar-icon" .path="${0}" ="${0}" .disabled="${0}" id="button-undo"> </ha-icon-button> <ha-tooltip placement="bottom" for="button-undo"> ${0} </ha-tooltip> <ha-icon-button slot="toolbar-icon" .path="${0}" ="${0}" .disabled="${0}" id="button-redo"> </ha-icon-button> <ha-tooltip placement="bottom" for="button-redo"> ${0} </ha-tooltip> <ha-button appearance="filled" size="small" class="exit-edit-mode" ="${0}"> ${0} </ha-button> <ha-icon-button .label="${0}" .path="${0}" href="${0}" rel="noreferrer" target="_blank"></ha-icon-button>`),Fe,this._undo,!this._undoRedoController.canUndo,this.hass.localize("ui.common.undo"),Re,this._redo,!this._undoRedoController.canRedo,this.hass.localize("ui.common.redo"),this._editModeDisable,this.hass.localize("ui.panel.lovelace.menu.exit_edit_mode"),this.hass.localize("ui.panel.lovelace.menu.help"),qe,(0,Z.o)(this.hass,"/dashboards/"))):i.push(this._renderNotificationButton());const o="lovelace"===(null===(e=this.panel)||void 0===e?void 0:e.component_name),n=[{icon:Ee,key:"ui.panel.lovelace.unused_entities.title",overflowAction:this._handleUnusedEntities,visible:this._editMode&&!0,overflow:!0},{icon:He,key:"ui.panel.lovelace.editor.menu.raw_editor",overflowAction:this._handleRawEditor,visible:this._editMode,overflow:!0},{icon:Oe,key:"ui.panel.lovelace.editor.menu.manage_dashboards",overflowAction:this._handleManageDashboards,visible:this._editMode&&!0,overflow:!0},{icon:Pe,key:"ui.panel.lovelace.editor.menu.manage_resources",overflowAction:this._handleManageResources,visible:this._editMode,overflow:!0},{icon:Te,key:"ui.panel.lovelace.menu.add",visible:!1,overflow:this.narrow,subItems:[{icon:Se,key:"ui.panel.lovelace.menu.add_device",visible:!0,action:this._addDevice,overflowAction:this._addDevice},{icon:De,key:"ui.panel.lovelace.menu.create_automation",visible:!0,action:this._createAutomation},{icon:Ne,key:"ui.panel.lovelace.menu.create_area",visible:!0,action:this._createArea,overflowAction:this._createArea},{icon:$e,key:"ui.panel.lovelace.menu.add_person",visible:!0,action:this._addPerson,overflowAction:this._addPerson}]},{icon:Ie,key:"ui.panel.lovelace.menu.search_home_assistant",buttonAction:this._showQuickBar,overflowAction:this._showQuickBar,suffix:this.hass.enableShortcuts&&!R.M?T.c?"(⌘ + K)":"(Ctrl + K)":void 0,visible:!this._editMode&&!this.hass.kioskMode,overflow:this.narrow},{icon:Le,key:"ui.panel.lovelace.menu.assist_tooltip",buttonAction:this._showVoiceCommandDialog,overflowAction:this._showVoiceCommandDialog,suffix:this.hass.enableShortcuts&&!R.M?"(A)":void 0,visible:!this._editMode&&this._conversation(this.hass.config.components),overflow:this.narrow},{icon:Be,key:"ui.common.refresh",overflowAction:this._handleRefresh,visible:!this._editMode&&this._yamlMode,overflow:!0},{icon:Ue,key:"ui.panel.lovelace.unused_entities.title",overflowAction:this._handleUnusedEntities,visible:!this._editMode&&this._yamlMode,overflow:!0},{icon:Be,key:"ui.panel.lovelace.menu.reload_resources",overflowAction:this._handleReloadResources,visible:!this._editMode&&"yaml"===this._resourceMode&&o,overflow:!0},{icon:Ze,key:"ui.panel.lovelace.menu.configure_ui",overflowAction:this._enableEditMode,buttonAction:this._enableEditMode,visible:!this._editMode&&(null===(t=this.hass.user)||void 0===t?void 0:t.is_admin)&&!this.hass.config.recovery_mode&&!this.hass.kioskMode&&!this.noEdit,overflow:!0,overflow_can_promote:!0}];this.extraActionItems&&this.extraActionItems.forEach(e=>{n.push({icon:e.icon,key:e.labelKey,buttonAction:e.action,overflowAction:e.action,visible:!0,overflow:this.narrow})});const s=n.filter(e=>e.visible&&e.overflow),r=1===s.length&&s[0].overflow_can_promote;return n.filter(e=>e.visible&&(!e.overflow||r)).forEach((e,t)=>{const o=[this.hass.localize(e.key),e.suffix].join(" "),n=e.subItems?(0,a.qy)(ae||(ae=Me` <ha-dropdown slot="actionItems" -select="${0}" placement="bottom-end"> <ha-icon-button .id="button-${0}" .path="${0}" slot="trigger" .label="${0}" hide-title></ha-icon-button> ${0} </ha-dropdown> <ha-tooltip placement="bottom" .for="button-${0}"> ${0} </ha-tooltip> `),this._handleSubItemSelect,t,e.icon,o,e.subItems.filter(e=>e.visible).map(e=>(0,a.qy)(ne||(ne=Me` <ha-dropdown-item .value="${0}" .data="${0}"> <ha-svg-icon slot="icon" .path="${0}"> </ha-svg-icon> ${0} </ha-dropdown-item> `),e.key,e,e.icon,this.hass.localize(e.key))),t,o):(0,a.qy)(se||(se=Me` <ha-icon-button slot="actionItems" .id="button-${0}" .path="${0}" .label="${0}" hide-title ="${0}"></ha-icon-button> <ha-tooltip placement="bottom" .for="button-${0}"> ${0} </ha-tooltip> `),t,e.icon,o,e.buttonAction,t,o);i.push(n)}),s.length&&!r&&i.push((0,a.qy)(re||(re=Me` <ha-dropdown slot="actionItems" -select="${0}"> <ha-icon-button slot="trigger" id="dashboardmenu" .path="${0}" .label="${0}" hide-title></ha-icon-button> ${0} </ha-dropdown> `),this._handleOverflowItemSelect,ze,this.hass.localize("ui.panel.lovelace.editor.menu.open"),s.map(e=>{const t=[this.hass.localize(e.key),e.suffix].join(" ");return(0,a.qy)(le||(le=Me`<ha-dropdown-item .value="${0}" .data="${0}"> <ha-svg-icon slot="icon" .path="${0}"></ha-svg-icon> ${0} </ha-dropdown-item>`),e.key,e,e.icon,t)}))),(0,a.qy)(he||(he=Me`${0}`),i)}render(){var e,t,i,o;const n=null!==(e=null===(t=this.lovelace)||void 0===t?void 0:t.config.views)&&void 0!==e?e:[],l="number"==typeof this._curView?n[this._curView]:void 0,h=this._livePanel?(0,$.hL)(this.hass,this._livePanel):void 0,c=(null==l?void 0:l.background)||this.config.background,d=e=>void 0!==e.visible&&(Array.isArray(e.visible)&&!e.visible.some(e=>{var t;return e.user===(null===(t=this.hass.user)||void 0===t?void 0:t.id)})||!1===e.visible),u=(0,a.qy)(ce||(ce=Me`<ha-tab-group -tab-show="${0}"> ${0} </ha-tab-group>`),this._handleViewSelected,n.map((e,t)=>{const i=e.show_icon_and_title&&e.icon&&e.title,o=e.icon&&!i,l=!o&&!i,h=!this._editMode&&(e.subview||d(e));return(0,a.qy)(de||(de=Me` <ha-tab-group-tab slot="nav" panel="${0}" .active="${0}" .disabled="${0}" aria-label="${0}" class="${0}"> ${0} ${0} ${0} ${0} ${0} </ha-tab-group-tab> `),t,this._curView===t,h,(0,r.J)(e.title),(0,s.H)({"icon-only":Boolean(o),"icon-and-title":Boolean(i),"hide-tab":Boolean(h)}),this._editMode?(0,a.qy)(ue||(ue=Me` <ha-icon-button-arrow-prev .hass="${0}" .label="${0}" class="edit-icon view" ="${0}" .disabled="${0}"></ha-icon-button-arrow-prev> `),this.hass,this.hass.localize("ui.panel.lovelace.editor.edit_view.move_left"),this._moveViewLeft,0===this._curView):a.s6,o||i?(0,a.qy)(ve||(ve=Me`<ha-icon class="${0}" title="${0}" .icon="${0}"></ha-icon>`),(0,s.H)({"child-view-icon":Boolean(e.subview)}),(0,r.J)(e.title),e.icon):a.s6,i?e.title:a.s6,l?e.title||this.hass.localize("ui.panel.lovelace.views.unnamed_view"):a.s6,this._editMode?(0,a.qy)(pe||(pe=Me` <ha-icon-button .title="${0}" class="edit-icon view" .path="${0}" ="${0}"></ha-icon-button> <ha-icon-button-arrow-next .hass="${0}" .label="${0}" class="edit-icon view" ="${0}" .disabled="${0}"></ha-icon-button-arrow-next> `),this.hass.localize("ui.panel.lovelace.editor.edit_view.edit"),Ze,this._editView,this.hass,this.hass.localize("ui.panel.lovelace.editor.edit_view.move_right"),this._moveViewRight,this._curView+1===n.length):a.s6)})),v=null==l?void 0:l.subview,p=n.filter(e=>!e.subview).length>1;return(0,a.qy)(ge||(ge=Me` <div class="${0}"> <div class="header"> <slot name="toolbar"> <div class="toolbar"> ${0} </div> ${0} </slot> </div> <hui-view-container class="${0}" .hass="${0}" .theme="${0}" id="view"> <hui-view-background .hass="${0}" .background="${0}"> </hui-view-background> </hui-view-container> </div> `),(0,s.H)({"edit-mode":this._editMode,narrow:this.narrow}),this._editMode?(0,a.qy)(be||(be=Me` <div class="main-title"> ${0} <ha-icon-button slot="actionItems" .label="${0}" .path="${0}" class="edit-icon" ="${0}"></ha-icon-button> </div> <div class="action-items">${0}</div> `),h||this.hass.localize("ui.panel.lovelace.editor.header"),this.hass.localize("ui.panel.lovelace.editor.edit_lovelace.edit_title"),Ze,this._editDashboardOrPanel,this._renderActionItems()):(0,a.qy)(we||(we=Me` ${0} ${0} <div class="action-items">${0}</div> `),v||this.backButton?(0,a.qy)(fe||(fe=Me` <ha-icon-button-arrow-prev .hass="${0}" slot="navigationIcon" ="${0}"></ha-icon-button-arrow-prev> `),this.hass,this._goBack):(0,a.qy)(_e||(_e=Me` <ha-menu-button slot="navigationIcon" .hass="${0}" .narrow="${0}"></ha-menu-button> `),this.hass,this.narrow),v?(0,a.qy)(me||(me=Me` <div class="main-title">${0}</div> `),l.title):p?u:(0,a.qy)(ye||(ye=Me` <div class="main-title"> ${0} </div> `),null!==(i=null===(o=n[0])||void 0===o?void 0:o.title)&&void 0!==i?i:h),this._renderActionItems()),this._editMode?(0,a.qy)(Ce||(Ce=Me` <div class="tab-bar"> ${0} <ha-icon-button slot="nav" id="add-view" ="${0}" .label="${0}" .path="${0}"></ha-icon-button> </div> `),u,this._addView,this.hass.localize("ui.panel.lovelace.editor.edit_view.add"),Te):a.s6,this._editMode?"has-tab-bar":"",this.hass,null==l?void 0:l.theme,this.hass,c)}_clearParam(e){window.history.replaceState(null,"",(0,v.Z)((0,p.s8)(e)))}firstUpdated(e){super.firstUpdated(e),window.addEventListener("scroll",this._handleWindowScroll,{passive:!0}),this._handleUrlChanged(),(0,M.KQ)(this.hass).then(e=>{this._resourceMode=e.resource_mode})}connectedCallback(){super.connectedCallback(),window.addEventListener("scroll",this._handleWindowScroll,{passive:!0}),window.addEventListener("popstate",this._handlePopState),window.addEventListener("location-changed",this._locationChanged),window.history.scrollRestoration="manual",this._unsubNotifications=(0,ee.V)(this.hass.connection,e=>{this._persistentNotifications=(null==e?void 0:e.length)||0})}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("scroll",this._handleWindowScroll),window.removeEventListener("popstate",this._handlePopState),window.removeEventListener("location-changed",this._locationChanged),this.toggleAttribute("scrolled",0!==window.scrollY),window.history.scrollRestoration="auto",this._unsubNotifications&&this._unsubNotifications()}_handleUrlChanged(){const e=(0,p.px)();var t;if("1"===e.edit)this._clearParam("edit"),null!==(t=this.hass.user)&&void 0!==t&&t.is_admin&&"storage"===this.lovelace.mode&&this.lovelace.setEditMode(!0);else if("1"===e.conversation)this._clearParam("conversation"),this._showVoiceCommandDialog();else if(e["more-info-entity-id"]){const t=e["more-info-entity-id"],i=e["more-info-view"];this._clearParam("more-info-entity-id"),i&&this._clearParam("more-info-view"),(0,g.m)(()=>{(0,P.p)(this,{entityId:t,view:(0,z.HD)(i)?i:void 0})})}}willUpdate(e){if(e.has("lovelace")){const t=e.get("lovelace");if(t&&this.lovelace.rawConfig!==t.rawConfig&&!this._configChangedByUndo){const e=this.route.path.split("/")[1];this._undoRedoController.commit({location:e,config:t.rawConfig})}else this._configChangedByUndo=!1}}updated(e){super.updated(e);const t=this._viewRoot.lastChild;let i;e.has("hass")&&t&&(t.hass=this.hass),e.has("narrow")&&t&&(t.narrow=this.narrow);let o=this.route.path.split("/")[1];if(o=o?decodeURI(o):void 0,e.has("route")){const e=this.config.views;if(!o&&e.length)i=e.findIndex(this._isVisible),this._navigateToView(e[i].path||i,!0);else if("hass-unused-entities"===o)i="hass-unused-entities";else if(o){const t=o,a=Number(t);let n=0;for(let i=0;i<e.length;i++)if(e[i].path===t||i===a){n=i;break}i=n}}if(e.has("lovelace")){const a=e.get("lovelace");if(a&&a.config!==this.lovelace.config&&this._cleanupViewCache(),!a||a.editMode!==this.lovelace.editMode){const e=this.config&&this.config.views;"storage"===this.lovelace.mode&&"hass-unused-entities"===o&&(i=e.findIndex(this._isVisible),this._navigateToView(e[i].path||i,!0))}t&&(t.lovelace=this.lovelace)}void 0!==i&&(0,g.m)(()=>{if(e.has("route")){const e=this._restoreScroll&&this._viewScrollPositions[i]||0;this._restoreScroll=!1,requestAnimationFrame(()=>scrollTo({behavior:"auto",top:e}))}this._selectView(i)})}_renderNotificationButton(){return document.body.getElementsByTagName("ha-sidebar").length>0?(0,a.qy)(Ve||(Ve=Me`""`)):(0,a.qy)(ke||(ke=Me` <mwc-icon-button style="cursor:pointer;position:relative" label="${0}" ="${0}"> <ha-svg-icon path="${0}"></ha-svg-icon> ${0} </mwc-icon-button> `),this.hass.localize("ui.notification_drawer.title"),this._handleShowNotificationDrawer,Ke,this._notificationsCount>0?(0,a.qy)(xe||(xe=Me` <span style="top:-4px;right:-6px;font-size:1rem;position:absolute;min-width:20px;box-sizing:border-box;border-radius:50%;font-weight:400;background-color:var(--accent-color);line-height:24px;text-align:center;padding:0 6px;color:var(--text-primary-color)"> ${0} </span> `),this._notificationsCount):"")}get _notificationsCount(){const e=this.hass.states,t=Object.keys(e).filter(e=>"configurator"===e.substr(0,e.indexOf("."))).map(t=>e[t]).length;return(this._persistentNotifications||0)+t}_handleShowNotificationDrawer(){(0,te.c)(this,{narrow:this.narrow})}get config(){return this.lovelace.config}get _yamlMode(){return"yaml"===this.lovelace.mode}get _editMode(){return this.lovelace.editMode}get _viewRoot(){return this.shadowRoot.getElementById("view")}_goBack(){var e,t;const i=null!==(e=null===(t=this.lovelace)||void 0===t?void 0:t.config.views)&&void 0!==e?e:[],o="number"==typeof this._curView?i[this._curView]:void 0;null!=(null==o?void 0:o.back_path)?(0,u.oo)(o.back_path,{replace:!0}):this.backPath?(0,u.oo)(this.backPath,{replace:!0}):history.length>1?(0,u.OE)():i[0].subview?(0,u.oo)("/"):(0,u.oo)(this.route.prefix,{replace:!0})}_editModeDisable(){this.lovelace.setEditMode(!1),this._undoRedoController.reset()}_editDashboardOrPanel(){var e;(null===(e=this.panel)||void 0===e?void 0:e.component_name)===$.JF?this._editPanel():this._editDashboard()}async _editPanel(){var e;if(!this.panel)return;const t=this.panel;await this.hass.loadFragmentTranslation("config");const i=(null===(e=this.hass.systemData)||void 0===e?void 0:e.default_panel)||"home";(0,O.x)(this,{urlPath:t.url_path,title:(0,$.hL)(this.hass,t)||t.url_path,icon:(0,$.Q)(t),requireAdmin:t.require_admin||!1,showInSidebar:t.show_in_sidebar||!1,isDefault:t.url_path===i,updatePanel:async e=>{await(0,$.W5)(this.hass,t.url_path,e)}})}async _editDashboard(){var e;const t=null===(e=this.route)||void 0===e?void 0:e.prefix.slice(1);await this.hass.loadFragmentTranslation("config");const i=(await(0,A.SJ)(this.hass)).find(e=>e.url_path===t);(0,F.B)(this,{dashboard:i,urlPath:t,updateDashboard:async e=>{await(0,A.mQ)(this.hass,i.id,e)},removeDashboard:async()=>{if(!(await(0,S.dk)(this,{title:this.hass.localize("ui.panel.config.lovelace.dashboards.confirm_delete_title",{dashboard_title:i.title}),text:this.hass.localize("ui.panel.config.lovelace.dashboards.confirm_delete_text"),confirmText:this.hass.localize("ui.common.delete"),destructive:!0})))return!1;try{return await(0,A.A_)(this.hass,i.id),!0}catch(e){return!1}}})}_navigateToView(e,t){const i=this.lovelace.editMode?`${this.route.prefix}/${e}?${(0,p.$X)({edit:"1"})}`:`${this.route.prefix}/${e}${location.search}`;`${location.pathname}${location.search}`!==i&&(0,u.oo)(i,{replace:t})}_editView(){(0,Q.f)(this,{lovelace:this.lovelace,viewIndex:this._curView,saveCallback:(e,t)=>{const i=t.path||e;this._navigateToView(i)}})}_moveViewLeft(e){if(e.stopPropagation(),0===this._curView)return;const t=this.lovelace,i=this._curView,o=this._curView-1;this.config.views[i].path||this._navigateToView(o,!0),t.saveConfig((0,W.Bl)(t.config,i,o)),this._selectView(o)}_moveViewRight(e){if(e.stopPropagation(),this._curView+1===this.lovelace.config.views.length)return;const t=this.lovelace,i=this._curView,o=this._curView+1;this.config.views[i].path||this._navigateToView(o,!0),t.saveConfig((0,W.Bl)(t.config,i,o)),this._selectView(o)}_addView(){(0,Q.f)(this,{lovelace:this.lovelace,saveCallback:(e,t)=>{const i=t.path||e;this._navigateToView(i)}})}_handleViewSelected(e){e.preventDefault();const t=Number(e.detail.name);if(t!==this._curView){const e=this.config.views[t].path||t;this._navigateToView(e)}else this._editMode||scrollTo({behavior:"smooth",top:0})}_cleanupViewCache(){const e=null!=this._curView?this._viewCache[this._curView]:void 0;this._viewCache={},e&&null!=this._curView&&(this._viewCache[this._curView]=e)}_selectView(e){if(this._curView===e)return;null!=this._curView&&(this._viewScrollPositions[this._curView]=window.scrollY),e=void 0===e?0:e,this._curView=e;const t=this._viewRoot;if(t.lastChild&&t.removeChild(t.lastChild),"hass-unused-entities"===e){const e=document.createElement("hui-unused-entities");return Promise.all([i.e(67785),i.e(61854)]).then(i.bind(i,39693)).then(()=>{e.hass=this.hass,e.lovelace=this.lovelace,e.narrow=this.narrow}),void t.appendChild(e)}let o;this.config.views[e]?(this._viewCache[e]?o=this._viewCache[e]:(o=document.createElement("hui-view"),o.index=e,this._viewCache[e]=o),o.lovelace=this.lovelace,o.hass=this.hass,o.narrow=this.narrow,t.appendChild(o)):this.lovelace.setEditMode(!0)}async _applyUndoRedo(e){this._configChangedByUndo=!0;try{await this.lovelace.saveConfig(e.config)}catch(t){return this._configChangedByUndo=!1,void(0,B.P)(this,{message:this.hass.localize("ui.panel.lovelace.editor.undo_redo_failed_to_apply_changes",{error:t.message}),duration:4e3,dismissable:!0})}this._navigateToView(e.location)}_undo(){this._undoRedoController.undo()}_redo(){this._undoRedoController.redo()}_handleSubItemSelect(e){const t=e.detail.item.data;null!=t&&t.action?t.action():null!=t&&t.overflowAction&&t.overflowAction()}_handleOverflowItemSelect(e){const t=e.detail.item.data;if(null!=t&&t.subItems){const e=[this.hass.localize(t.key),t.suffix].join(" ");(0,L.i)(this,{title:e,mode:this.narrow?"bottom-sheet":"dialog",items:t.subItems.map(e=>({iconPath:e.icon,label:this.hass.localize(e.key),action:e.action}))})}else null!=t&&t.overflowAction&&t.overflowAction()}static get styles(){return[I.RF,(0,a.AH)(Ae||(Ae=Me`:host{-ms-user-select:none;-webkit-user-select:none;-moz-user-select:none}.header{background-color:var(--app-header-background-color);color:var(--app-header-text-color,#fff);position:fixed;top:0;width:calc(var(--ha-top-app-bar-width,100%) - var(--safe-area-inset-right,0px));-webkit-backdrop-filter:var(--app-header-backdrop-filter,none);backdrop-filter:var(--app-header-backdrop-filter,none);padding-top:var(--safe-area-inset-top);padding-right:var(--safe-area-inset-right);z-index:4}.narrow .header{width:calc(var(--ha-top-app-bar-width,100%) - var(--safe-area-inset-left,0px) - var(--safe-area-inset-right,0px));padding-left:var(--safe-area-inset-left)}:host([scrolled]) .header{box-shadow:var(--bar-box-shadow,0px 2px 4px -1px rgba(0,0,0,.2),0px 4px 5px 0px rgba(0,0,0,.14),0px 1px 10px 0px rgba(0,0,0,.12))}.edit-mode .header{background-color:var(--app-header-edit-background-color,#455a64);color:var(--app-header-edit-text-color,#fff)}.toolbar{border-bottom:var(--app-header-border-bottom,none);height:var(--header-height);display:flex;align-items:center;font-size:var(--ha-font-size-xl);padding:0px 12px;font-weight:var(--ha-font-weight-normal);box-sizing:border-box}.edit-mode .toolbar{border-bottom:none}.narrow .toolbar{padding:0 4px}.main-title{margin-inline-start:var(--ha-space-6);line-height:var(--ha-line-height-normal);flex-grow:1;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;min-width:0}.narrow .main-title{margin-inline-start:var(--ha-space-2)}.action-items{white-space:nowrap;display:flex;align-items:center}.edit-mode .action-items ha-icon-button[disabled]{--ha-color-on-disabled-quiet:color-mix(
in srgb,
var(--app-header-edit-text-color, #fff) 50%,
transparent
)}ha-tab-group{--ha-tab-indicator-color:var(
--app-header-selection-bar-color,
var(--app-header-text-color, white)
);--ha-tab-active-text-color:var(--app-header-text-color, white);--ha-tab-track-color:transparent;align-self:flex-end;flex-grow:1;min-width:0;height:100%}ha-tab-group::part(nav){padding:0}ha-tab-group::part(scroll-button){inset-block-end:var(--safe-track-width);background-color:var(--app-header-background-color);background:linear-gradient(90deg,var(--app-header-background-color),transparent);z-index:1}ha-tab-group::part(scroll-button-end){background:linear-gradient(270deg,var(--app-header-background-color),transparent)}.edit-mode ha-tab-group::part(scroll-button){background-color:var(--app-header-edit-background-color,#455a64);background:linear-gradient(90deg,var(--app-header-edit-background-color,#455a64),transparent)}.edit-mode ha-tab-group::part(scroll-button-end){background:linear-gradient(270deg,var(--app-header-edit-background-color,#455a64),transparent)}.edit-mode div[main-title]{pointer-events:auto}.tab-bar{display:flex}.edit-mode ha-tab-group{flex-grow:0;color:var(--app-header-edit-text-color,#fff);--ha-tab-active-text-color:var(--app-header-edit-text-color, #fff);--ha-tab-indicator-color:var(--app-header-edit-text-color, #fff)}ha-tab-group-tab{--ha-tab-group-tab-height:var(--header-height, 56px);height:var(--ha-tab-group-tab-height)}.tab-bar ha-tab-group-tab{--ha-tab-group-tab-height:var(--tab-bar-height, 56px)}ha-tab-group-tab[aria-selected=true] .edit-icon{display:inline-flex}ha-tab-group-tab::part(base){padding-inline-start:var(--ha-tab-padding-start,var(--wa-space-l));padding-inline-end:var(--ha-tab-padding-end,var(--wa-space-l));padding-top:calc((var(--ha-tab-group-tab-height) - 20px)/ 2)}ha-tab-group-tab.icon-and-title::part(base),ha-tab-group-tab.icon-only::part(base){padding-top:calc((var(--ha-tab-group-tab-height) - 20px)/ 2 - 2px);padding-bottom:calc((var(--ha-tab-group-tab-height) - 20px)/ 2 - 4px)}ha-tab-group-tab.icon-and-title ha-icon{margin-inline-end:var(--ha-space-2)}.edit-mode ha-tab-group-tab[aria-selected=true]::part(base){padding:0;margin-top:calc((var(--tab-bar-height,56px) - 48px)/ 2)}.edit-icon{color:var(--accent-color);padding:0 8px;vertical-align:middle;--mdc-theme-text-disabled-on-light:var(--disabled-text-color);direction:var(--direction)}.edit-icon:last-child{padding-left:0}.edit-icon.view{display:none}#add-view{white-space:nowrap;display:flex;align-items:center}#add-view ha-svg-icon{background-color:var(--accent-color);border-radius:var(--ha-border-radius-sm)}a{color:var(--text-primary-color,#fff)}hui-view-container{position:relative;display:flex;min-height:100vh;box-sizing:border-box;padding-top:calc(var(--header-height) + var(--safe-area-inset-top) + var(--view-container-padding-top,0px));padding-right:var(--safe-area-inset-right);padding-inline-end:var(--safe-area-inset-right);padding-bottom:calc(var(--safe-area-inset-bottom) + var(--view-container-padding-bottom,0px))}.narrow hui-view-container{padding-left:var(--safe-area-inset-left);padding-inline-start:var(--safe-area-inset-left)}hui-view-container>*{display:flex;flex-direction:column;flex:1 1 100%;max-width:100%}hui-view-container.has-tab-bar{padding-top:calc(var(--header-height,56px) + calc(var(--tab-bar-height,56px) - 2px) + var(--safe-area-inset-top,0px))}.hide-tab{display:none}.exit-edit-mode{--mdc-theme-primary:var(--app-header-edit-text-color, #fff);--mdc-button-outline-color:var(--app-header-edit-text-color, #fff);--mdc-typography-button-font-size:var(--ha-font-size-m)}.child-view-icon{opacity:.5}`))]}constructor(...e){super(...e),this.narrow=!1,this.noEdit=!1,this.backButton=!1,this._resourceMode="storage",this._configChangedByUndo=!1,this._viewCache={},this._viewScrollPositions={},this._restoreScroll=!1,this._undoRedoController=new c.X(this,{apply:e=>this._applyUndoRedo(e),currentConfig:()=>({location:this.route.path.split("/")[1],config:this.lovelace.rawConfig})}),this._conversation=(0,l.A)(e=>(0,h.x)(this.hass.config,"conversation")),this._handleWindowScroll=()=>{this.toggleAttribute("scrolled",0!==window.scrollY)},this._locationChanged=()=>{this._handleUrlChanged()},this._handlePopState=()=>{this._restoreScroll=!0,this._handleUrlChanged()},this._isVisible=e=>Boolean(this._editMode||void 0===e.visible||!0===e.visible||Array.isArray(e.visible)&&e.visible.some(e=>{var t;return e.user===(null===(t=this.hass.user)||void 0===t?void 0:t.id)})),this._handleRefresh=()=>{(0,d.r)(this,"config-refresh")},this._handleReloadResources=()=>{this.hass.callService("lovelace","reload_resources"),(0,S.dk)(this,{title:this.hass.localize("ui.panel.lovelace.reload_resources.refresh_header"),text:this.hass.localize("ui.panel.lovelace.reload_resources.refresh_body"),confirmText:this.hass.localize("ui.common.refresh"),dismissText:this.hass.localize("ui.common.not_now"),confirm:()=>location.reload()})},this._showQuickBar=()=>{(0,E.uq)(this,{showHint:this.hass.enableShortcuts})},this._addDevice=async()=>{await this.hass.loadFragmentTranslation("config"),(0,N.X)(this,{navigateToResult:!0})},this._createAutomation=async()=>{await this.hass.loadFragmentTranslation("config"),(0,U.l)(this,{mode:"automation"})},this._createArea=async()=>{await this.hass.loadFragmentTranslation("config"),(0,D.J)(this,{createEntry:async e=>{const t=await(0,k.L3)(this.hass,e);(0,x.Wu)(this.lovelace.rawConfig)&&(0,d.r)(this,"config-refresh"),(0,B.P)(this,{message:this.hass.localize("ui.panel.lovelace.menu.create_area_success"),action:{action:()=>{(0,u.oo)(`/config/areas/area/${t.area_id}`)},text:this.hass.localize("ui.panel.lovelace.menu.create_area_action")}})}})},this._addPerson=async()=>{await this.hass.loadFragmentTranslation("config"),(0,K.o)(this,{users:[],createEntry:async e=>{await(0,H.Gu)(this.hass,e),(0,B.P)(this,{message:this.hass.localize("ui.panel.lovelace.menu.add_person_success"),action:{action:()=>{(0,u.oo)("/config/person")},text:this.hass.localize("ui.panel.lovelace.menu.add_person_action")}})}})},this._handleRawEditor=()=>{this.lovelace.enableFullEditMode()},this._handleManageDashboards=()=>{(0,u.oo)("/config/lovelace/dashboards")},this._handleManageResources=()=>{(0,u.oo)("/config/lovelace/resources")},this._handleUnusedEntities=()=>{var e;(0,u.oo)(`${null===(e=this.route)||void 0===e?void 0:e.prefix}/hass-unused-entities`)},this._showVoiceCommandDialog=()=>{(0,q.z)(this,this.hass,{pipeline_id:"last_used"})},this._enableEditMode=async()=>{if(this._yamlMode)(0,S.showAlertDialog)(this,{text:this.hass.localize("ui.panel.lovelace.editor.yaml_unsupported")});else{if((0,x.Wu)(this.lovelace.rawConfig)&&!(0,Y.B2)(this.lovelace.rawConfig.strategy)){var e;const t=await(0,X.Nu)("dashboard",this.lovelace.rawConfig.strategy.type).catch(e=>{});if(null!=t&&t.noEditor)return void(0,J.z)(this,{lovelace:this.lovelace,mode:"storage",narrow:this.narrow});const i=null===(e=this.route)||void 0===e?void 0:e.prefix.slice(1);await this.hass.loadFragmentTranslation("config");const o=(await(0,A.SJ)(this.hass)).find(e=>e.url_path===i);return void(0,j.Y)(this,{config:this.lovelace.rawConfig,title:this._livePanel?(0,$.hL)(this.hass,this._livePanel):void 0,saveConfig:this.lovelace.saveConfig,takeControl:()=>{(0,J.z)(this,{lovelace:this.lovelace,mode:"storage",narrow:this.narrow})},deleteDashboard:async()=>{if(!(await(0,S.dk)(this,{title:this.hass.localize("ui.panel.config.lovelace.dashboards.confirm_delete_title",{dashboard_title:o.title}),text:this.hass.localize("ui.panel.config.lovelace.dashboards.confirm_delete_text"),confirmText:this.hass.localize("ui.common.delete"),destructive:!0})))return!1;try{return await(0,A.A_)(this.hass,o.id),!0}catch(e){return!1}}})}this.lovelace.setEditMode(!0)}}}}(0,o.Cg)([(0,n.MZ)({attribute:!1})],We.prototype,"panel",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],We.prototype,"hass",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],We.prototype,"lovelace",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean})],We.prototype,"narrow",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],We.prototype,"route",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],We.prototype,"extraActionItems",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean,attribute:"no-edit"})],We.prototype,"noEdit",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],We.prototype,"backButton",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],We.prototype,"backPath",void 0),(0,o.Cg)([(0,n.wk)()],We.prototype,"_curView",void 0),(0,o.Cg)([(0,n.wk)()],We.prototype,"_resourceMode",void 0),(0,o.Cg)([(0,n.MZ)()],We.prototype,"_persistentNotifications",void 0),We=(0,o.Cg)([(0,n.EM)("hui-root")],We),t()}catch(oe){t(oe)}})},41570:function(e,t,i){i.d(t,{c:function(){return o}});i(27495);const o=/Mac/i.test(navigator.userAgent)},84187:function(e,t,i){i.d(t,{M:function(){return o}});i(27495);const o=/(?:iphone|android|ipad)/i.test(navigator.userAgent)}}]);