import{an as e,S as t,ao as i,ap as a,aq as o,P as s,Q as l,a5 as r,_ as n,j as c,e as d,i as h,y as u,ar as f,a4 as p,O as m,d as b,n as v,t as _,E as g,G as y,k,C as w,p as x,as as $,at as z,ae as R,ac as S,au as C,h as T,R as F,av as D,aw as H,ax as E,ay as L,az as M,aA as P,aB as B,aC as A,ag as j,aD as O,aE as N,aF as W,aG as I,aH as U,aI as q,aJ as K,af as V,aK as G,c as Y,aL as X}from"./main-85e087f9.js";import{c as Q,b as Z}from"./c.eab7754a.js";import{p as J}from"./c.ef7f8e16.js";import{L as ee}from"./c.d32a5f4a.js";import{d as te,a as ie}from"./c.388f6c87.js";import{b as ae}from"./c.07e395f8.js";import{m as oe}from"./c.f2af93f0.js";import{a as se}from"./c.ccbe2b52.js";import{r as le,a as re}from"./c.2a64ceac.js";import"./c.e651e5fa.js";import{d as ne}from"./c.10855172.js";import{i as ce}from"./c.21c042d4.js";import"./c.8e28b461.js";import"./c.743a15a1.js";import"./c.2610e8cd.js";import"./c.a0946910.js";import"./c.117d0056.js";import"./c.5ebe89cb.js";import"./c.f2bb3724.js";var de=new Set;const he=[{properties:{_parentResizable:{type:Object,observer:"_parentResizableChanged"},_notifyingDescendant:{type:Boolean,value:!1}},listeners:{"iron-request-resize-notifications":"_onIronRequestResizeNotifications"},created:function(){this._interestedResizables=[],this._boundNotifyResize=this.notifyResize.bind(this),this._boundOnDescendantIronResize=this._onDescendantIronResize.bind(this)},attached:function(){this._requestResizeNotifications()},detached:function(){this._parentResizable?this._parentResizable.stopResizeNotificationsFor(this):(de.delete(this),window.removeEventListener("resize",this._boundNotifyResize)),this._parentResizable=null},notifyResize:function(){this.isAttached&&(this._interestedResizables.forEach((function(e){this.resizerShouldNotify(e)&&this._notifyDescendant(e)}),this),this._fireResize())},assignParentResizable:function(e){this._parentResizable&&this._parentResizable.stopResizeNotificationsFor(this),this._parentResizable=e,e&&-1===e._interestedResizables.indexOf(this)&&(e._interestedResizables.push(this),e._subscribeIronResize(this))},stopResizeNotificationsFor:function(e){var t=this._interestedResizables.indexOf(e);t>-1&&(this._interestedResizables.splice(t,1),this._unsubscribeIronResize(e))},_subscribeIronResize:function(e){e.addEventListener("iron-resize",this._boundOnDescendantIronResize)},_unsubscribeIronResize:function(e){e.removeEventListener("iron-resize",this._boundOnDescendantIronResize)},resizerShouldNotify:function(e){return!0},_onDescendantIronResize:function(t){this._notifyingDescendant?t.stopPropagation():e||this._fireResize()},_fireResize:function(){this.fire("iron-resize",null,{node:this,bubbles:!1})},_onIronRequestResizeNotifications:function(e){var i=t(e).rootTarget;i!==this&&(i.assignParentResizable(this),this._notifyDescendant(i),e.stopPropagation())},_parentResizableChanged:function(e){e&&window.removeEventListener("resize",this._boundNotifyResize)},_notifyDescendant:function(e){this.isAttached&&(this._notifyingDescendant=!0,e.notifyResize(),this._notifyingDescendant=!1)},_requestResizeNotifications:function(){if(this.isAttached)if("loading"===document.readyState){var e=this._requestResizeNotifications.bind(this);document.addEventListener("readystatechange",(function t(){document.removeEventListener("readystatechange",t),e()}))}else this._findParent(),this._parentResizable?this._parentResizable._interestedResizables.forEach((function(e){e!==this&&e._findParent()}),this):(de.forEach((function(e){e!==this&&e._findParent()}),this),window.addEventListener("resize",this._boundNotifyResize),this.notifyResize())},_findParent:function(){this.assignParentResizable(null),this.fire("iron-request-resize-notifications",null,{node:this,bubbles:!0,cancelable:!0}),this._parentResizable?de.delete(this):de.add(this)}},{listeners:{"app-reset-layout":"_appResetLayoutHandler","iron-resize":"resetLayout"},attached:function(){this.fire("app-reset-layout")},_appResetLayoutHandler:function(e){t(e).path[0]!==this&&(this.resetLayout(),e.stopPropagation())},_updateLayoutStates:function(){console.error("unimplemented")},resetLayout:function(){var e=this._updateLayoutStates.bind(this);this._layoutDebouncer=i.debounce(this._layoutDebouncer,a,e),o(this._layoutDebouncer),this._notifyDescendantResize()},_notifyLayoutChanged:function(){var e=this;requestAnimationFrame((function(){e.fire("app-reset-layout")}))},_notifyDescendantResize:function(){this.isAttached&&this._interestedResizables.forEach((function(e){this.resizerShouldNotify(e)&&this._notifyDescendant(e)}),this)}}],ue={properties:{scrollTarget:{type:HTMLElement,value:function(){return this._defaultScrollTarget}}},observers:["_scrollTargetChanged(scrollTarget, isAttached)"],_shouldHaveListener:!0,_scrollTargetChanged:function(e,i){if(this._oldScrollTarget&&(this._toggleScrollListener(!1,this._oldScrollTarget),this._oldScrollTarget=null),i)if("document"===e)this.scrollTarget=this._doc;else if("string"==typeof e){var a=this.domHost;this.scrollTarget=a&&a.$?a.$[e]:t(this.ownerDocument).querySelector("#"+e)}else this._isValidScrollTarget()&&(this._oldScrollTarget=e,this._toggleScrollListener(this._shouldHaveListener,e))},_scrollHandler:function(){},get _defaultScrollTarget(){return this._doc},get _doc(){return this.ownerDocument.documentElement},get _scrollTop(){return this._isValidScrollTarget()?this.scrollTarget===this._doc?window.pageYOffset:this.scrollTarget.scrollTop:0},get _scrollLeft(){return this._isValidScrollTarget()?this.scrollTarget===this._doc?window.pageXOffset:this.scrollTarget.scrollLeft:0},set _scrollTop(e){this.scrollTarget===this._doc?window.scrollTo(window.pageXOffset,e):this._isValidScrollTarget()&&(this.scrollTarget.scrollTop=e)},set _scrollLeft(e){this.scrollTarget===this._doc?window.scrollTo(e,window.pageYOffset):this._isValidScrollTarget()&&(this.scrollTarget.scrollLeft=e)},scroll:function(e,t){var i;"object"==typeof e?(i=e.left,t=e.top):i=e,i=i||0,t=t||0,this.scrollTarget===this._doc?window.scrollTo(i,t):this._isValidScrollTarget()&&(this.scrollTarget.scrollLeft=i,this.scrollTarget.scrollTop=t)},get _scrollTargetWidth(){return this._isValidScrollTarget()?this.scrollTarget===this._doc?window.innerWidth:this.scrollTarget.offsetWidth:0},get _scrollTargetHeight(){return this._isValidScrollTarget()?this.scrollTarget===this._doc?window.innerHeight:this.scrollTarget.offsetHeight:0},_isValidScrollTarget:function(){return this.scrollTarget instanceof HTMLElement},_toggleScrollListener:function(e,t){var i=t===this._doc?window:t;e?this._boundScrollHandler||(this._boundScrollHandler=this._scrollHandler.bind(this),i.addEventListener("scroll",this._boundScrollHandler)):this._boundScrollHandler&&(i.removeEventListener("scroll",this._boundScrollHandler),this._boundScrollHandler=null)},toggleScrollListener:function(e){this._shouldHaveListener=e,this._toggleScrollListener(e,this.scrollTarget)}},fe={},pe=[ue,{properties:{effects:{type:String},effectsConfig:{type:Object,value:function(){return{}}},disabled:{type:Boolean,reflectToAttribute:!0,value:!1},threshold:{type:Number,value:0},thresholdTriggered:{type:Boolean,notify:!0,readOnly:!0,reflectToAttribute:!0}},observers:["_effectsChanged(effects, effectsConfig, isAttached)"],_updateScrollState:function(e){},isOnScreen:function(){return!1},isContentBelow:function(){return!1},_effectsRunFn:null,_effects:null,get _clampedScrollTop(){return Math.max(0,this._scrollTop)},attached:function(){this._scrollStateChanged()},detached:function(){this._tearDownEffects()},createEffect:function(e,t){var i=fe[e];if(!i)throw new ReferenceError(this._getUndefinedMsg(e));var a=this._boundEffect(i,t||{});return a.setUp(),a},_effectsChanged:function(e,t,i){this._tearDownEffects(),e&&i&&(e.split(" ").forEach((function(e){var i;""!==e&&((i=fe[e])?this._effects.push(this._boundEffect(i,t[e])):console.warn(this._getUndefinedMsg(e)))}),this),this._setUpEffect())},_layoutIfDirty:function(){return this.offsetWidth},_boundEffect:function(e,t){t=t||{};var i=parseFloat(t.startsAt||0),a=parseFloat(t.endsAt||1),o=a-i,s=function(){},l=0===i&&1===a?e.run:function(t,a){e.run.call(this,Math.max(0,(t-i)/o),a)};return{setUp:e.setUp?e.setUp.bind(this,t):s,run:e.run?l.bind(this):s,tearDown:e.tearDown?e.tearDown.bind(this):s}},_setUpEffect:function(){this.isAttached&&this._effects&&(this._effectsRunFn=[],this._effects.forEach((function(e){!1!==e.setUp()&&this._effectsRunFn.push(e.run)}),this))},_tearDownEffects:function(){this._effects&&this._effects.forEach((function(e){e.tearDown()})),this._effectsRunFn=[],this._effects=[]},_runEffects:function(e,t){this._effectsRunFn&&this._effectsRunFn.forEach((function(i){i(e,t)}))},_scrollHandler:function(){this._scrollStateChanged()},_scrollStateChanged:function(){if(!this.disabled){var e=this._clampedScrollTop;this._updateScrollState(e),this.threshold>0&&this._setThresholdTriggered(e>=this.threshold)}},_getDOMRef:function(e){console.warn("_getDOMRef","`"+e+"` is undefined")},_getUndefinedMsg:function(e){return"Scroll effect `"+e+"` is undefined. Did you forget to import app-layout/app-scroll-effects/effects/"+e+".html ?"}}];s({_template:l`
`,is:"app-header",behaviors:[pe,he],properties:{condenses:{type:Boolean,value:!1},fixed:{type:Boolean,value:!1},reveals:{type:Boolean,value:!1},shadow:{type:Boolean,reflectToAttribute:!0,value:!1}},observers:["_configChanged(isAttached, condenses, fixed)"],_height:0,_dHeight:0,_stickyElTop:0,_stickyElRef:null,_top:0,_progress:0,_wasScrollingDown:!1,_initScrollTop:0,_initTimestamp:0,_lastTimestamp:0,_lastScrollTop:0,get _maxHeaderTop(){return this.fixed?this._dHeight:this._height+5},get _stickyEl(){if(this._stickyElRef)return this._stickyElRef;for(var e,i=t(this.$.slot).getDistributedNodes(),a=0;e=i[a];a++)if(e.nodeType===Node.ELEMENT_NODE){if(e.hasAttribute("sticky")){this._stickyElRef=e;break}this._stickyElRef||(this._stickyElRef=e)}return this._stickyElRef},_configChanged:function(){this.resetLayout(),this._notifyLayoutChanged()},_updateLayoutStates:function(){if(0!==this.offsetWidth||0!==this.offsetHeight){var e=this._clampedScrollTop,t=0===this._height||0===e,i=this.disabled;this._height=this.offsetHeight,this._stickyElRef=null,this.disabled=!0,t||this._updateScrollState(0,!0),this._mayMove()?this._dHeight=this._stickyEl?this._height-this._stickyEl.offsetHeight:0:this._dHeight=0,this._stickyElTop=this._stickyEl?this._stickyEl.offsetTop:0,this._setUpEffect(),t?this._updateScrollState(e,!0):(this._updateScrollState(this._lastScrollTop,!0),this._layoutIfDirty()),this.disabled=i}},_updateScrollState:function(e,t){if(0!==this._height){var i=0,a=0,o=this._top;this._lastScrollTop;var s=this._maxHeaderTop,l=e-this._lastScrollTop,r=Math.abs(l),n=e>this._lastScrollTop,c=performance.now();if(this._mayMove()&&(a=this._clamp(this.reveals?o+l:e,0,s)),e>=this._dHeight&&(a=this.condenses&&!this.fixed?Math.max(this._dHeight,a):a,this.style.transitionDuration="0ms"),this.reveals&&!this.disabled&&r<100&&((c-this._initTimestamp>300||this._wasScrollingDown!==n)&&(this._initScrollTop=e,this._initTimestamp=c),e>=s))if(Math.abs(this._initScrollTop-e)>30||r>10){n&&e>=s?a=s:!n&&e>=this._dHeight&&(a=this.condenses&&!this.fixed?this._dHeight:0);var d=l/(c-this._lastTimestamp);this.style.transitionDuration=this._clamp((a-o)/d,0,300)+"ms"}else a=this._top;i=0===this._dHeight?e>0?1:0:a/this._dHeight,t||(this._lastScrollTop=e,this._top=a,this._wasScrollingDown=n,this._lastTimestamp=c),(t||i!==this._progress||o!==a||0===e)&&(this._progress=i,this._runEffects(i,a),this._transformHeader(a))}},_mayMove:function(){return this.condenses||!this.fixed},willCondense:function(){return this._dHeight>0&&this.condenses},isOnScreen:function(){return 0!==this._height&&this._top0:this._clampedScrollTop-this._maxHeaderTop>=0},_transformHeader:function(e){this.translate3d(0,-e+"px",0),this._stickyEl&&this.translate3d(0,this.condenses&&e>=this._stickyElTop?Math.min(e,this._dHeight)-this._stickyElTop+"px":0,0,this._stickyEl)},_clamp:function(e,t,i){return Math.min(i,Math.max(t,e))},_ensureBgContainers:function(){this._bgContainer||(this._bgContainer=document.createElement("div"),this._bgContainer.id="background",this._bgRear=document.createElement("div"),this._bgRear.id="backgroundRearLayer",this._bgContainer.appendChild(this._bgRear),this._bgFront=document.createElement("div"),this._bgFront.id="backgroundFrontLayer",this._bgContainer.appendChild(this._bgFront),t(this.root).insertBefore(this._bgContainer,this.$.contentContainer))},_getDOMRef:function(e){switch(e){case"backgroundFrontLayer":return this._ensureBgContainers(),this._bgFront;case"backgroundRearLayer":return this._ensureBgContainers(),this._bgRear;case"background":return this._ensureBgContainers(),this._bgContainer;case"mainTitle":return t(this).querySelector("[main-title]");case"condensedTitle":return t(this).querySelector("[condensed-title]")}return null},getScrollState:function(){return{progress:this._progress,top:this._top}}});const me={second:45,minute:45,hour:22,day:5,week:4,month:11};J&&await J;const be=r((e=>new Intl.RelativeTimeFormat(e.language,{numeric:"auto"}))),ve=(e,t,i,a=!0)=>{const o=function(e,t=Date.now(),i={}){const a={...me,...i||{}},o=(+e-+t)/1e3;if(Math.abs(o)!1},{kind:"field",decorators:[d({type:Boolean})],key:"autofocus",value:()=>!1},{kind:"field",decorators:[d({type:String})],key:"label",value:void 0},{kind:"method",key:"focus",value:function(){var e;null===(e=this._input)||void 0===e||e.focus()}},{kind:"field",decorators:[h("ha-textfield",!0)],key:"_input",value:void 0},{kind:"method",key:"render",value:function(){return u`
${this.filter&&u`
`}
`}},{kind:"method",key:"_filterChanged",value:async function(e){m(this,"value-changed",{value:String(e)})}},{kind:"method",key:"_filterInputChanged",value:async function(e){this._filterChanged(e.target.value)}},{kind:"method",key:"_clearSearch",value:async function(){this._filterChanged("")}},{kind:"get",static:!0,key:"styles",value:function(){return b`
:host {
display: inline-flex;
}
ha-svg-icon,
ha-icon-button {
color: var(--primary-text-color);
}
ha-svg-icon {
outline: none;
}
.clear-button {
--mdc-icon-size: 20px;
}
ha-textfield {
display: inherit;
}
.trailing {
display: flex;
align-items: center;
}
`}}]}}),c);const _e=Symbol("Comlink.proxy"),ge=Symbol("Comlink.endpoint"),ye=Symbol("Comlink.releaseProxy"),ke=Symbol("Comlink.thrown"),we=e=>"object"==typeof e&&null!==e||"function"==typeof e,xe=new Map([["proxy",{canHandle:e=>we(e)&&e[_e],serialize(e){const{port1:t,port2:i}=new MessageChannel;return $e(e,t),[i,[i]]},deserialize:e=>(e.start(),Re(e))}],["throw",{canHandle:e=>we(e)&&ke in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){if(e.isError)throw Object.assign(new Error(e.value.message),e.value);throw e.value}}]]);function $e(e,t=self){t.addEventListener("message",(function i(a){if(!a||!a.data)return;const{id:o,type:s,path:l}=Object.assign({path:[]},a.data),r=(a.data.argumentList||[]).map(He);let n;try{const t=l.slice(0,-1).reduce(((e,t)=>e[t]),e),i=l.reduce(((e,t)=>e[t]),e);switch(s){case"GET":n=i;break;case"SET":t[l.slice(-1)[0]]=He(a.data.value),n=!0;break;case"APPLY":n=i.apply(t,r);break;case"CONSTRUCT":n=function(e){return Object.assign(e,{[_e]:!0})}(new i(...r));break;case"ENDPOINT":{const{port1:t,port2:i}=new MessageChannel;$e(e,i),n=function(e,t){return Fe.set(e,t),e}(t,[t])}break;case"RELEASE":n=void 0;break;default:return}}catch(e){n={value:e,[ke]:0}}Promise.resolve(n).catch((e=>({value:e,[ke]:0}))).then((e=>{const[a,l]=De(e);t.postMessage(Object.assign(Object.assign({},a),{id:o}),l),"RELEASE"===s&&(t.removeEventListener("message",i),ze(t))}))})),t.start&&t.start()}function ze(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function Re(e,t){return Ce(e,[],t)}function Se(e){if(e)throw new Error("Proxy has been released and is not useable")}function Ce(e,t=[],i=function(){}){let a=!1;const o=new Proxy(i,{get(i,s){if(Se(a),s===ye)return()=>Ee(e,{type:"RELEASE",path:t.map((e=>e.toString()))}).then((()=>{ze(e),a=!0}));if("then"===s){if(0===t.length)return{then:()=>o};const i=Ee(e,{type:"GET",path:t.map((e=>e.toString()))}).then(He);return i.then.bind(i)}return Ce(e,[...t,s])},set(i,o,s){Se(a);const[l,r]=De(s);return Ee(e,{type:"SET",path:[...t,o].map((e=>e.toString())),value:l},r).then(He)},apply(i,o,s){Se(a);const l=t[t.length-1];if(l===ge)return Ee(e,{type:"ENDPOINT"}).then(He);if("bind"===l)return Ce(e,t.slice(0,-1));const[r,n]=Te(s);return Ee(e,{type:"APPLY",path:t.map((e=>e.toString())),argumentList:r},n).then(He)},construct(i,o){Se(a);const[s,l]=Te(o);return Ee(e,{type:"CONSTRUCT",path:t.map((e=>e.toString())),argumentList:s},l).then(He)}});return o}function Te(e){const t=e.map(De);return[t.map((e=>e[0])),(i=t.map((e=>e[1])),Array.prototype.concat.apply([],i))];var i}const Fe=new WeakMap;function De(e){for(const[t,i]of xe)if(i.canHandle(e)){const[a,o]=i.serialize(e);return[{type:"HANDLER",name:t,value:a},o]}return[{type:"RAW",value:e},Fe.get(e)||[]]}function He(e){switch(e.type){case"HANDLER":return xe.get(e.name).deserialize(e.value);case"RAW":return e.value}}function Ee(e,t,i){return new Promise((a=>{const o=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");e.addEventListener("message",(function t(i){i.data&&i.data.id&&i.data.id===o&&(e.removeEventListener("message",t),a(i.data))})),e.start&&e.start(),e.postMessage(Object.assign({id:o},t),i)}))}let Le;let Me=n([v("ha-data-table")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",decorators:[d({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[d({type:Object})],key:"columns",value:()=>({})},{kind:"field",decorators:[d({type:Array})],key:"data",value:()=>[]},{kind:"field",decorators:[d({type:Boolean})],key:"selectable",value:()=>!1},{kind:"field",decorators:[d({type:Boolean})],key:"clickable",value:()=>!1},{kind:"field",decorators:[d({type:Boolean})],key:"hasFab",value:()=>!1},{kind:"field",decorators:[d({attribute:!1})],key:"appendRow",value:void 0},{kind:"field",decorators:[d({type:Boolean,attribute:"auto-height"})],key:"autoHeight",value:()=>!1},{kind:"field",decorators:[d({type:String})],key:"id",value:()=>"id"},{kind:"field",decorators:[d({type:String})],key:"noDataText",value:void 0},{kind:"field",decorators:[d({type:String})],key:"searchLabel",value:void 0},{kind:"field",decorators:[d({type:Boolean,attribute:"no-label-float"})],key:"noLabelFloat",value:()=>!1},{kind:"field",decorators:[d({type:String})],key:"filter",value:()=>""},{kind:"field",decorators:[_()],key:"_filterable",value:()=>!1},{kind:"field",decorators:[_()],key:"_filter",value:()=>""},{kind:"field",decorators:[_()],key:"_sortColumn",value:void 0},{kind:"field",decorators:[_()],key:"_sortDirection",value:()=>null},{kind:"field",decorators:[_()],key:"_filteredData",value:()=>[]},{kind:"field",decorators:[_()],key:"_headerHeight",value:()=>0},{kind:"field",decorators:[h("slot[name='header']")],key:"_header",value:void 0},{kind:"field",decorators:[_()],key:"_items",value:()=>[]},{kind:"field",key:"_checkableRowsCount",value:void 0},{kind:"field",key:"_checkedRows",value:()=>[]},{kind:"field",key:"_sortColumns",value:()=>({})},{kind:"field",key:"curRequest",value:()=>0},{kind:"field",decorators:[le(".scroller")],key:"_savedScrollPos",value:void 0},{kind:"field",key:"_debounceSearch",value(){return te((e=>{this._filter=e}),100,!1)}},{kind:"method",key:"clearSelection",value:function(){this._checkedRows=[],this._checkedRowsChanged()}},{kind:"method",key:"connectedCallback",value:function(){g(y(i.prototype),"connectedCallback",this).call(this),this._items.length&&(this._items=[...this._items])}},{kind:"method",key:"firstUpdated",value:function(){this.updateComplete.then((()=>this._calcTableHeight()))}},{kind:"method",key:"willUpdate",value:function(e){if(g(y(i.prototype),"willUpdate",this).call(this,e),e.has("columns")){this._filterable=Object.values(this.columns).some((e=>e.filterable));for(const e in this.columns)if(this.columns[e].direction){this._sortDirection=this.columns[e].direction,this._sortColumn=e;break}const e=ne(this.columns);Object.values(e).forEach((e=>{delete e.title,delete e.type,delete e.template})),this._sortColumns=e}e.has("filter")&&this._debounceSearch(this.filter),e.has("data")&&(this._checkableRowsCount=this.data.filter((e=>!1!==e.selectable)).length),(e.has("data")||e.has("columns")||e.has("_filter")||e.has("_sortColumn")||e.has("_sortDirection"))&&this._sortFilterData()}},{kind:"method",key:"render",value:function(){return u`
${this._filterable?u`
`:""}
${this._filteredData.length?u`
`:u`
${this.noDataText||"No data"}
`}
`}},{kind:"field",key:"_renderRow",value(){return(e,t)=>e?e.append?u` ${e.content}
`:e.empty?u` `:u`
${this.selectable?u`
`:""}
${Object.entries(this.columns).map((([t,i])=>i.hidden?"":u`
${i.template?i.template(e[t],e):e[t]}
`))}
`:u``}},{kind:"method",key:"_sortFilterData",value:async function(){const e=(new Date).getTime();this.curRequest++;const t=this.curRequest;let i=this.data;this._filter&&(i=await this._memFilterData(this.data,this._sortColumns,this._filter));const a=this._sortColumn?(async(e,t,i,a)=>(Le||(Le=Re(new Worker(new URL("./sort_filter_worker",import.meta.url)))),Le.sortData(e,t,i,a)))(i,this._sortColumns[this._sortColumn],this._sortDirection,this._sortColumn):i,[o]=await Promise.all([a,R]),s=(new Date).getTime()-e;if(s<100&&await new Promise((e=>setTimeout(e,100-s))),this.curRequest===t){if(this.appendRow||this.hasFab){const e=[...o];this.appendRow&&e.push({append:!0,content:this.appendRow}),this.hasFab&&e.push({empty:!0}),this._items=e}else this._items=o;this._filteredData=o}}},{kind:"field",key:"_memFilterData",value:()=>r((async(e,t,i)=>(async(e,t,i)=>(Le||(Le=Re(new Worker(new URL("./sort_filter_worker",import.meta.url)))),Le.filterData(e,t,i)))(e,t,i)))},{kind:"method",key:"_handleHeaderClick",value:function(e){const t=e.currentTarget.columnId;this.columns[t].sortable&&(this._sortDirection&&this._sortColumn===t?"asc"===this._sortDirection?this._sortDirection="desc":this._sortDirection=null:this._sortDirection="asc",this._sortColumn=null===this._sortDirection?void 0:t,m(this,"sorting-changed",{column:t,direction:this._sortDirection}))}},{kind:"method",key:"_handleHeaderRowCheckboxClick",value:function(e){e.target.checked?(this._checkedRows=this._filteredData.filter((e=>!1!==e.selectable)).map((e=>e[this.id])),this._checkedRowsChanged()):(this._checkedRows=[],this._checkedRowsChanged())}},{kind:"field",key:"_handleRowCheckboxClick",value(){return e=>{const t=e.currentTarget,i=t.rowId;if(t.checked){if(this._checkedRows.includes(i))return;this._checkedRows=[...this._checkedRows,i]}else this._checkedRows=this._checkedRows.filter((e=>e!==i));this._checkedRowsChanged()}}},{kind:"field",key:"_handleRowClick",value(){return e=>{const t=e.target;if(["HA-CHECKBOX","MWC-BUTTON"].includes(t.tagName))return;const i=e.currentTarget.rowId;m(this,"row-click",{id:i},{bubbles:!1})}}},{kind:"method",key:"_checkedRowsChanged",value:function(){this._items.length&&(this._items=[...this._items]),m(this,"selection-changed",{value:this._checkedRows})}},{kind:"method",key:"_handleSearchChange",value:function(e){this.filter||this._debounceSearch(e.detail.value)}},{kind:"method",key:"_calcTableHeight",value:async function(){this.autoHeight||(await this.updateComplete,this._headerHeight=this._header.clientHeight)}},{kind:"method",decorators:[S({passive:!0})],key:"_saveScrollPos",value:function(e){this._savedScrollPos=e.target.scrollTop}},{kind:"get",static:!0,key:"styles",value:function(){return[C,b`
/* default mdc styles, colors changed, without checkbox styles */
:host {
height: 100%;
}
.mdc-data-table__content {
font-family: Roboto, sans-serif;
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
font-size: 0.875rem;
line-height: 1.25rem;
font-weight: 400;
letter-spacing: 0.0178571429em;
text-decoration: inherit;
text-transform: inherit;
}
.mdc-data-table {
background-color: var(--data-table-background-color);
border-radius: 4px;
border-width: 1px;
border-style: solid;
border-color: var(--divider-color);
display: inline-flex;
flex-direction: column;
box-sizing: border-box;
overflow: hidden;
}
.mdc-data-table__row--selected {
background-color: rgba(var(--rgb-primary-color), 0.04);
}
.mdc-data-table__row {
display: flex;
width: 100%;
height: 52px;
}
.mdc-data-table__row ~ .mdc-data-table__row {
border-top: 1px solid var(--divider-color);
}
.mdc-data-table__row.clickable:not(
.mdc-data-table__row--selected
):hover {
background-color: rgba(var(--rgb-primary-text-color), 0.04);
}
.mdc-data-table__header-cell {
color: var(--primary-text-color);
}
.mdc-data-table__cell {
color: var(--primary-text-color);
}
.mdc-data-table__header-row {
height: 56px;
display: flex;
width: 100%;
border-bottom: 1px solid var(--divider-color);
overflow-x: auto;
}
.mdc-data-table__header-row::-webkit-scrollbar {
display: none;
}
.mdc-data-table__cell,
.mdc-data-table__header-cell {
padding-right: 16px;
padding-left: 16px;
align-self: center;
overflow: hidden;
text-overflow: ellipsis;
flex-shrink: 0;
box-sizing: border-box;
}
.mdc-data-table__cell.mdc-data-table__cell--icon {
overflow: initial;
}
.mdc-data-table__header-cell--checkbox,
.mdc-data-table__cell--checkbox {
/* @noflip */
padding-left: 16px;
/* @noflip */
padding-right: 0;
width: 60px;
}
:host([dir="rtl"]) .mdc-data-table__header-cell--checkbox,
:host([dir="rtl"]) .mdc-data-table__cell--checkbox {
/* @noflip */
padding-left: 0;
/* @noflip */
padding-right: 16px;
}
.mdc-data-table__table {
height: 100%;
width: 100%;
border: 0;
white-space: nowrap;
}
.mdc-data-table__cell {
font-family: Roboto, sans-serif;
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
font-size: 0.875rem;
line-height: 1.25rem;
font-weight: 400;
letter-spacing: 0.0178571429em;
text-decoration: inherit;
text-transform: inherit;
}
.mdc-data-table__cell a {
color: inherit;
text-decoration: none;
}
.mdc-data-table__cell--numeric {
text-align: right;
}
:host([dir="rtl"]) .mdc-data-table__cell--numeric {
/* @noflip */
text-align: left;
}
.mdc-data-table__cell--icon {
color: var(--secondary-text-color);
text-align: center;
}
.mdc-data-table__header-cell--icon,
.mdc-data-table__cell--icon {
width: 54px;
}
.mdc-data-table__cell--icon img {
width: 24px;
height: 24px;
}
.mdc-data-table__header-cell.mdc-data-table__header-cell--icon {
text-align: center;
}
.mdc-data-table__header-cell.sortable.mdc-data-table__header-cell--icon:hover,
.mdc-data-table__header-cell.sortable.mdc-data-table__header-cell--icon:not(
.not-sorted
) {
text-align: left;
}
:host([dir="rtl"])
.mdc-data-table__header-cell.sortable.mdc-data-table__header-cell--icon:hover,
:host([dir="rtl"])
.mdc-data-table__header-cell.sortable.mdc-data-table__header-cell--icon:not(
.not-sorted
) {
text-align: right;
}
.mdc-data-table__cell--icon:first-child ha-icon,
.mdc-data-table__cell--icon:first-child img,
.mdc-data-table__cell--icon:first-child ha-state-icon,
.mdc-data-table__cell--icon:first-child ha-svg-icon {
margin-left: 8px;
}
:host([dir="rtl"]) .mdc-data-table__cell--icon:first-child ha-icon,
:host([dir="rtl"])
.mdc-data-table__cell--icon:first-child
ha-state-icon,
:host([dir="rtl"])
.mdc-data-table__cell--icon:first-child
ha-svg-icon
:host([dir="rtl"])
.mdc-data-table__cell--icon:first-child
img {
margin-left: auto;
margin-right: 8px;
}
.mdc-data-table__cell--icon:first-child state-badge {
margin-right: -8px;
}
:host([dir="rtl"]) .mdc-data-table__cell--icon:first-child state-badge {
margin-right: auto;
margin-left: -8px;
}
.mdc-data-table__cell--overflow-menu,
.mdc-data-table__header-cell--overflow-menu,
.mdc-data-table__header-cell--icon-button,
.mdc-data-table__cell--icon-button {
padding: 8px;
}
.mdc-data-table__header-cell--icon-button,
.mdc-data-table__cell--icon-button {
width: 56px;
}
.mdc-data-table__cell--overflow-menu,
.mdc-data-table__cell--icon-button {
color: var(--secondary-text-color);
text-overflow: clip;
}
.mdc-data-table__header-cell--icon-button:first-child,
.mdc-data-table__cell--icon-button:first-child,
.mdc-data-table__header-cell--icon-button:last-child,
.mdc-data-table__cell--icon-button:last-child {
width: 64px;
}
.mdc-data-table__cell--overflow-menu:first-child,
.mdc-data-table__header-cell--overflow-menu:first-child,
.mdc-data-table__header-cell--icon-button:first-child,
.mdc-data-table__cell--icon-button:first-child {
padding-left: 16px;
}
:host([dir="rtl"])
.mdc-data-table__header-cell--overflow-menu:first-child,
:host([dir="rtl"]) .mdc-data-table__cell--overflow-menu:first-child,
:host([dir="rtl"])
.mdc-data-table__header-cell--overflow-menu:first-child,
:host([dir="rtl"]) .mdc-data-table__cell--overflow-menu:first-child {
padding-left: 8px;
padding-right: 16px;
}
.mdc-data-table__cell--overflow-menu:last-child,
.mdc-data-table__header-cell--overflow-menu:last-child,
.mdc-data-table__header-cell--icon-button:last-child,
.mdc-data-table__cell--icon-button:last-child {
padding-right: 16px;
}
:host([dir="rtl"])
.mdc-data-table__header-cell--overflow-menu:last-child,
:host([dir="rtl"]) .mdc-data-table__cell--overflow-menu:last-child,
:host([dir="rtl"]) .mdc-data-table__header-cell--icon-button:last-child,
:host([dir="rtl"]) .mdc-data-table__cell--icon-button:last-child {
padding-right: 8px;
padding-left: 16px;
}
.mdc-data-table__cell--overflow-menu,
.mdc-data-table__header-cell--overflow-menu {
overflow: initial;
}
.mdc-data-table__cell--icon-button a {
color: var(--secondary-text-color);
}
.mdc-data-table__header-cell {
font-family: Roboto, sans-serif;
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
font-size: 0.875rem;
line-height: 1.375rem;
font-weight: 500;
letter-spacing: 0.0071428571em;
text-decoration: inherit;
text-transform: inherit;
text-align: left;
}
:host([dir="rtl"]) .mdc-data-table__header-cell {
/* @noflip */
text-align: right;
}
.mdc-data-table__header-cell--numeric {
text-align: right;
}
.mdc-data-table__header-cell--numeric.sortable:hover,
.mdc-data-table__header-cell--numeric.sortable:not(.not-sorted) {
text-align: left;
}
:host([dir="rtl"]) .mdc-data-table__header-cell--numeric {
/* @noflip */
text-align: left;
}
:host([dir="rtl"]) .mdc-data-table__header-cell--numeric.sortable:hover,
:host([dir="rtl"])
.mdc-data-table__header-cell--numeric.sortable:not(.not-sorted) {
text-align: right;
}
/* custom from here */
:host {
display: block;
}
.mdc-data-table {
display: block;
border-width: var(--data-table-border-width, 1px);
height: 100%;
}
.mdc-data-table__header-cell {
overflow: hidden;
position: relative;
}
.mdc-data-table__header-cell span {
position: relative;
left: 0px;
}
:host([dir="rtl"]) .mdc-data-table__header-cell span {
left: auto;
right: 0px;
}
.mdc-data-table__header-cell.sortable {
cursor: pointer;
}
.mdc-data-table__header-cell > * {
transition: left 0.2s ease;
}
:host([dir="rtl"]) .mdc-data-table__header-cell > * {
transition: right 0.2s ease;
}
.mdc-data-table__header-cell ha-svg-icon {
top: -3px;
position: absolute;
}
.mdc-data-table__header-cell.not-sorted ha-svg-icon {
left: -20px;
}
:host([dir="rtl"]) .mdc-data-table__header-cell.not-sorted ha-svg-icon {
right: -20px;
}
.mdc-data-table__header-cell.sortable:not(.not-sorted) span,
.mdc-data-table__header-cell.sortable.not-sorted:hover span {
left: 24px;
}
:host([dir="rtl"])
.mdc-data-table__header-cell.sortable:not(.not-sorted)
span,
:host([dir="rtl"])
.mdc-data-table__header-cell.sortable.not-sorted:hover
span {
left: auto;
right: 24px;
}
.mdc-data-table__header-cell.sortable:not(.not-sorted) ha-svg-icon,
.mdc-data-table__header-cell.sortable:hover.not-sorted ha-svg-icon {
left: 12px;
}
:host([dir="rtl"])
.mdc-data-table__header-cell.sortable:not(.not-sorted)
ha-svg-icon,
:host([dir="rtl"])
.mdc-data-table__header-cell.sortable:hover.not-sorted
ha-svg-icon {
left: auto;
right: 12px;
}
.table-header {
border-bottom: 1px solid var(--divider-color);
}
search-input {
display: block;
flex: 1;
}
slot[name="header"] {
display: block;
}
.center {
text-align: center;
}
.secondary {
color: var(--secondary-text-color);
}
.scroller {
height: calc(100% - 57px);
overflow: overlay !important;
}
.mdc-data-table__table.auto-height .scroller {
overflow-y: hidden !important;
}
.grows {
flex-grow: 1;
flex-shrink: 1;
}
.forceLTR {
direction: ltr;
}
.clickable {
cursor: pointer;
}
lit-virtualizer {
contain: size layout !important;
}
`]}}]}}),c);n([v("ha-tab")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[d({type:Boolean,reflect:!0})],key:"active",value:()=>!1},{kind:"field",decorators:[d({type:Boolean,reflect:!0})],key:"narrow",value:()=>!1},{kind:"field",decorators:[d()],key:"name",value:void 0},{kind:"field",decorators:[T("mwc-ripple")],key:"_ripple",value:void 0},{kind:"field",decorators:[_()],key:"_shouldRenderRipple",value:()=>!1},{kind:"method",key:"render",value:function(){return u`
${this.narrow?u``:""}
${this.name}
${this._shouldRenderRipple?u``:""}
`}},{kind:"field",key:"_rippleHandlers",value(){return new F((()=>(this._shouldRenderRipple=!0,this._ripple)))}},{kind:"method",key:"_handleKeyDown",value:function(e){13===e.keyCode&&e.target.click()}},{kind:"method",decorators:[S({passive:!0})],key:"handleRippleActivate",value:function(e){this._rippleHandlers.startPress(e)}},{kind:"method",key:"handleRippleDeactivate",value:function(){this._rippleHandlers.endPress()}},{kind:"method",key:"handleRippleMouseEnter",value:function(){this._rippleHandlers.startHover()}},{kind:"method",key:"handleRippleMouseLeave",value:function(){this._rippleHandlers.endHover()}},{kind:"method",key:"handleRippleFocus",value:function(){this._rippleHandlers.startFocus()}},{kind:"method",key:"handleRippleBlur",value:function(){this._rippleHandlers.endFocus()}},{kind:"get",static:!0,key:"styles",value:function(){return b`
div {
padding: 0 32px;
display: flex;
flex-direction: column;
text-align: center;
box-sizing: border-box;
align-items: center;
justify-content: center;
width: 100%;
height: var(--header-height);
cursor: pointer;
position: relative;
outline: none;
}
.name {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 100%;
}
:host([active]) {
color: var(--primary-color);
}
:host(:not([narrow])[active]) div {
border-bottom: 2px solid var(--primary-color);
}
:host([narrow]) {
min-width: 0;
display: flex;
justify-content: center;
overflow: hidden;
}
:host([narrow]) div {
padding: 0 4px;
}
`}}]}}),c),n([v("hass-tabs-subpage")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",decorators:[d({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[d({type:Boolean})],key:"supervisor",value:()=>!1},{kind:"field",decorators:[d({attribute:!1})],key:"localizeFunc",value:void 0},{kind:"field",decorators:[d({type:String,attribute:"back-path"})],key:"backPath",value:void 0},{kind:"field",decorators:[d()],key:"backCallback",value:void 0},{kind:"field",decorators:[d({type:Boolean,attribute:"main-page"})],key:"mainPage",value:()=>!1},{kind:"field",decorators:[d({attribute:!1})],key:"route",value:void 0},{kind:"field",decorators:[d({attribute:!1})],key:"tabs",value:void 0},{kind:"field",decorators:[d({type:Boolean,reflect:!0})],key:"narrow",value:()=>!1},{kind:"field",decorators:[d({type:Boolean,reflect:!0,attribute:"is-wide"})],key:"isWide",value:()=>!1},{kind:"field",decorators:[d({type:Boolean,reflect:!0})],key:"rtl",value:()=>!1},{kind:"field",decorators:[_()],key:"_activeTab",value:void 0},{kind:"field",decorators:[le(".content")],key:"_savedScrollPos",value:void 0},{kind:"field",key:"_getTabs",value(){return r(((e,t,i,a,o,s,l)=>{const r=e.filter((e=>(!e.component||e.core||ce(this.hass,e.component))&&(!e.advancedOnly||i)));if(r.length<2){if(1===r.length){const e=r[0];return[e.translationKey?l(e.translationKey):e.name]}return[""]}return r.map((e=>u`
${e.iconPath?u``:""}
`))}))}},{kind:"method",key:"willUpdate",value:function(e){if(e.has("route")&&(this._activeTab=this.tabs.find((e=>`${this.route.prefix}${this.route.path}`.includes(e.path)))),e.has("hass")){const t=e.get("hass");t&&t.language===this.hass.language||(this.rtl=Q(this.hass))}g(y(i.prototype),"willUpdate",this).call(this,e)}},{kind:"method",key:"render",value:function(){var e,t;const i=this._getTabs(this.tabs,this._activeTab,null===(e=this.hass.userData)||void 0===e?void 0:e.showAdvanced,this.hass.config.components,this.hass.language,this.narrow,this.localizeFunc||this.hass.localize),a=i.length>1;return u`
`}},{kind:"method",decorators:[S({passive:!0})],key:"_saveScrollPos",value:function(e){this._savedScrollPos=e.target.scrollTop}},{kind:"method",key:"_backTapped",value:function(){this.backCallback?this.backCallback():history.back()}},{kind:"get",static:!0,key:"styles",value:function(){return b`
:host {
display: block;
height: 100%;
background-color: var(--primary-background-color);
}
:host([narrow]) {
width: 100%;
position: fixed;
}
ha-menu-button {
margin-right: 24px;
}
.toolbar {
display: flex;
align-items: center;
font-size: 20px;
height: var(--header-height);
background-color: var(--sidebar-background-color);
font-weight: 400;
border-bottom: 1px solid var(--divider-color);
padding: 0 16px;
box-sizing: border-box;
}
.toolbar a {
color: var(--sidebar-text-color);
text-decoration: none;
}
.bottom-bar a {
width: 25%;
}
#tabbar {
display: flex;
font-size: 14px;
overflow: hidden;
}
#tabbar > a {
overflow: hidden;
max-width: 45%;
}
#tabbar.bottom-bar {
position: absolute;
bottom: 0;
left: 0;
padding: 0 16px;
box-sizing: border-box;
background-color: var(--sidebar-background-color);
border-top: 1px solid var(--divider-color);
justify-content: space-around;
z-index: 2;
font-size: 12px;
width: 100%;
padding-bottom: env(safe-area-inset-bottom);
}
#tabbar:not(.bottom-bar) {
flex: 1;
justify-content: center;
}
:host(:not([narrow])) #toolbar-icon {
min-width: 40px;
}
ha-menu-button,
ha-icon-button-arrow-prev,
::slotted([slot="toolbar-icon"]) {
display: flex;
flex-shrink: 0;
pointer-events: auto;
color: var(--sidebar-icon-color);
}
.main-title {
flex: 1;
max-height: var(--header-height);
line-height: 20px;
color: var(--sidebar-text-color);
margin: var(--main-title-margin, 0 0 0 24px);
}
.content {
position: relative;
width: calc(
100% - env(safe-area-inset-left) - env(safe-area-inset-right)
);
margin-left: env(safe-area-inset-left);
margin-right: env(safe-area-inset-right);
height: calc(100% - 1px - var(--header-height));
height: calc(
100% - 1px - var(--header-height) - env(safe-area-inset-bottom)
);
overflow: auto;
-webkit-overflow-scrolling: touch;
}
:host([narrow]) .content.tabs {
height: calc(100% - 2 * var(--header-height));
height: calc(
100% - 2 * var(--header-height) - env(safe-area-inset-bottom)
);
}
#fab {
position: fixed;
right: calc(16px + env(safe-area-inset-right));
bottom: calc(16px + env(safe-area-inset-bottom));
z-index: 1;
}
:host([narrow]) #fab.tabs {
bottom: calc(84px + env(safe-area-inset-bottom));
}
#fab[is-wide] {
bottom: 24px;
right: 24px;
}
:host([rtl]) #fab {
right: auto;
left: calc(16px + env(safe-area-inset-left));
}
:host([rtl][is-wide]) #fab {
bottom: 24px;
left: 24px;
right: auto;
}
`}}]}}),c);let Pe=n([v("hass-tabs-subpage-data-table")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[d({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[d({attribute:!1})],key:"localizeFunc",value:void 0},{kind:"field",decorators:[d({type:Boolean})],key:"isWide",value:()=>!1},{kind:"field",decorators:[d({type:Boolean,reflect:!0})],key:"narrow",value:()=>!1},{kind:"field",decorators:[d({type:Boolean})],key:"supervisor",value:()=>!1},{kind:"field",decorators:[d({type:Boolean,attribute:"main-page"})],key:"mainPage",value:()=>!1},{kind:"field",decorators:[d({type:Object})],key:"columns",value:()=>({})},{kind:"field",decorators:[d({type:Array})],key:"data",value:()=>[]},{kind:"field",decorators:[d({type:Boolean})],key:"selectable",value:()=>!1},{kind:"field",decorators:[d({type:Boolean})],key:"clickable",value:()=>!1},{kind:"field",decorators:[d({type:Boolean})],key:"hasFab",value:()=>!1},{kind:"field",decorators:[d({attribute:!1})],key:"appendRow",value:void 0},{kind:"field",decorators:[d({type:String})],key:"id",value:()=>"id"},{kind:"field",decorators:[d({type:String})],key:"filter",value:()=>""},{kind:"field",decorators:[d()],key:"searchLabel",value:void 0},{kind:"field",decorators:[d({type:Array})],key:"activeFilters",value:void 0},{kind:"field",decorators:[d()],key:"hiddenLabel",value:void 0},{kind:"field",decorators:[d({type:Number})],key:"numHidden",value:()=>0},{kind:"field",decorators:[d({type:String,attribute:"back-path"})],key:"backPath",value:void 0},{kind:"field",decorators:[d()],key:"backCallback",value:void 0},{kind:"field",decorators:[d({type:String})],key:"noDataText",value:void 0},{kind:"field",decorators:[d()],key:"route",value:void 0},{kind:"field",decorators:[d()],key:"tabs",value:()=>[]},{kind:"field",decorators:[d({type:Boolean})],key:"hideFilterMenu",value:()=>!1},{kind:"field",decorators:[h("ha-data-table",!0)],key:"_dataTable",value:void 0},{kind:"method",key:"clearSelection",value:function(){this._dataTable.clearSelection()}},{kind:"method",key:"render",value:function(){const e=this.numHidden?this.hiddenLabel||this.hass.localize("ui.components.data-table.hidden","number",this.numHidden)||this.numHidden:void 0,t=this.activeFilters?u`${this.hass.localize("ui.components.data-table.filtering_by")}
${this.activeFilters.join(", ")}
${e?`(${e})`:""}`:e,i=u`
${this.narrow?"":u`
${t?u`
${t}
${this.hass.localize("ui.components.data-table.clear")}
`:""}
`}
`;return u`
${this.hideFilterMenu?"":u`
${this.narrow?u`
`:""}
`}
${this.narrow?u`
`:""}
${this.narrow?u` `:u`
`}
`}},{kind:"method",key:"_preventDefault",value:function(e){e.preventDefault()}},{kind:"method",key:"_handleSearchChange",value:function(e){this.filter!==e.detail.value&&(this.filter=e.detail.value,m(this,"search-changed",{value:this.filter}))}},{kind:"method",key:"_clearFilter",value:function(){m(this,"clear-filter")}},{kind:"get",static:!0,key:"styles",value:function(){return b`
ha-data-table {
width: 100%;
height: 100%;
--data-table-border-width: 0;
}
:host(:not([narrow])) ha-data-table {
height: calc(100vh - 1px - var(--header-height));
display: block;
}
:host([narrow]) hass-tabs-subpage {
--main-title-margin: 0;
}
.table-header {
display: flex;
align-items: center;
--mdc-shape-small: 0;
height: 56px;
}
.search-toolbar {
display: flex;
align-items: center;
color: var(--secondary-text-color);
}
search-input {
--mdc-text-field-fill-color: var(--sidebar-background-color);
--mdc-text-field-idle-line-color: var(--divider-color);
--text-field-overflow: visible;
z-index: 5;
}
.table-header search-input {
display: block;
position: absolute;
top: 0;
right: 0;
left: 0;
}
.search-toolbar search-input {
display: block;
width: 100%;
color: var(--secondary-text-color);
--mdc-ripple-color: transparant;
}
.filters {
--mdc-text-field-fill-color: var(--input-fill-color);
--mdc-text-field-idle-line-color: var(--input-idle-line-color);
--mdc-shape-small: 4px;
--text-field-overflow: initial;
display: flex;
justify-content: flex-end;
margin-right: 8px;
color: var(--primary-text-color);
}
.active-filters {
color: var(--primary-text-color);
position: relative;
display: flex;
align-items: center;
padding: 2px 2px 2px 8px;
margin-left: 4px;
font-size: 14px;
width: max-content;
cursor: initial;
}
.active-filters ha-svg-icon {
color: var(--primary-color);
}
.active-filters mwc-button {
margin-left: 8px;
}
.active-filters::before {
background-color: var(--primary-color);
opacity: 0.12;
border-radius: 4px;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
content: "";
}
.badge {
min-width: 20px;
box-sizing: border-box;
border-radius: 50%;
font-weight: 400;
background-color: var(--primary-color);
line-height: 20px;
text-align: center;
padding: 0px 4px;
color: var(--text-primary-color);
position: absolute;
right: 0;
top: 4px;
font-size: 0.65em;
}
.filter-menu {
position: relative;
}
`}}]}}),c);const Be=r(((e,t,i)=>(i=i.toUpperCase(),e.filter((e=>Object.entries(t).some((t=>{const[a,o]=t;return!(!o.filterable||!String(o.filterKey?e[o.valueColumn||a][o.filterKey]:e[o.valueColumn||a]).toUpperCase().includes(i))}))))))),Ae=r(((e,t,i,a)=>e.sort(((e,o)=>{let s=1;"desc"===i&&(s=-1);let l=t.filterKey?e[t.valueColumn||a][t.filterKey]:e[t.valueColumn||a],r=t.filterKey?o[t.valueColumn||a][t.filterKey]:o[t.valueColumn||a];return"string"==typeof l&&(l=l.toUpperCase()),"string"==typeof r&&(r=r.toUpperCase()),void 0===l&&void 0!==r?1:void 0===r&&void 0!==l?-1:lr?1*s:0}))));n([v("hacs-data-table")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"method",key:"_sortFilterData",value:async function(){const e=(new Date).getTime();this.curRequest++;const t=this.curRequest;let i=this.data;this._filter&&(i=await this._memFilterData(this.data,this._sortColumns,this._filter));const a=this._sortColumn?Ae(i,this._sortColumns[this._sortColumn],this._sortDirection,this._sortColumn):i,o=(new Date).getTime()-e;if(o<100&&await new Promise((e=>setTimeout(e,100-o))),this.curRequest===t){if(this.appendRow||this.hasFab){const e=[...a];this.appendRow&&e.push({append:!0,content:this.appendRow}),this.hasFab&&e.push({empty:!0}),this._items=e}else this._items=a;this._filteredData=a}}},{kind:"field",key:"_memFilterData",value:()=>r((async(e,t,i)=>Be(e,t,i)))}]}}),Me),n([v("hacs-tabs-subpage-data-table")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"method",key:"render",value:function(){const e=this.numHidden?this.hiddenLabel||this.hass.localize("ui.components.data-table.hidden","number",this.numHidden)||this.numHidden:void 0,t=this.activeFilters?u`${this.hass.localize("ui.components.data-table.filtering_by")}
${this.activeFilters.join(", ")} ${e?`(${e})`:""}`:e,i=u`
${this.narrow?"":u`
${t?u`
${t}
${this.hass.localize("ui.components.data-table.clear")}
`:""}
`}
`;return u`
${this.hideFilterMenu?"":u`
${this.narrow?u`
`:""}
`}
${this.narrow?u`
`:""}
${this.narrow?u` `:u`
`}
`}},{kind:"get",static:!0,key:"styles",value:function(){return[g(y(i),"styles",this),b`
hacs-data-table {
width: 100%;
height: 100%;
--data-table-border-width: 0;
}
:host(:not([narrow])) hacs-data-table {
height: calc(100vh - 1px - var(--header-height));
display: block;
}
`]}}]}}),Pe);const je={appdaemon:D,integration:H,netdaemon:E,plugin:L,python_script:M,template:P,theme:B},Oe={name:!0,downloads:!0,stars:!0,last_updated:!0,installed_version:!1,available_version:!1,status:!1,category:!0},Ne={title:"",hidden:!0,filterable:!0};let We=n([v("hacs-experimental-panel")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",decorators:[d({attribute:!1})],key:"hacs",value:void 0},{kind:"field",decorators:[d({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[d({attribute:!1})],key:"route",value:void 0},{kind:"field",decorators:[d({type:Boolean,reflect:!0})],key:"narrow",value:void 0},{kind:"field",decorators:[d({type:Boolean})],key:"isWide",value:void 0},{kind:"field",decorators:[ee("hacs-table-filters",!0,!1)],key:"activeFilters",value:()=>[]},{kind:"field",decorators:[ee("hacs-table-sort",!0,!1)],key:"activeSort",value:void 0},{kind:"field",decorators:[ee("hacs-active-search",!0,!1)],key:"_activeSearch",value:void 0},{kind:"field",decorators:[ee("hacs-table-active-columns",!0,!1)],key:"_tableColumns",value:()=>Oe},{kind:"method",key:"firstUpdated",value:async function(e){var t;g(y(i.prototype),"firstUpdated",this).call(this,e);const a=this.activeFilters&&0===this.activeFilters.length?[this.hacs.localize("common.downloaded")]:this.activeFilters,o=null!==(t=this._activeSearch)&&void 0!==t&&t.length?null==a?void 0:a.filter((e=>e!==this.hacs.localize("common.downloaded"))):a;this.activeFilters=null!=o&&o.length?o:void 0}},{kind:"method",key:"updated",value:function(e){var t,a;(g(y(i.prototype),"updated",this).call(this,e),e.has("_activeSearch")&&null!==(t=this._activeSearch)&&void 0!==t&&t.length)&&(this.activeFilters=null===(a=this.activeFilters)||void 0===a?void 0:a.filter((e=>e!==this.hacs.localize("common.downloaded"))))}},{kind:"field",key:"render",value(){return()=>{var e,t,i,a,o,s,l;const r=this._filterRepositories(this.hacs.repositories,this.activeFilters),n=0!==r.filter((e=>e.new)).length;return u`
j.open("https://hacs.xyz/","_blank","noreferrer=true")},{path:O,label:"GitHub",action:()=>j.open("https://github.com/hacs","_blank","noreferrer=true")},{path:N,label:this.hacs.localize("menu.open_issue"),action:()=>j.open("https://hacs.xyz/docs/issues","_blank","noreferrer=true")},{path:W,disabled:Boolean(this.hacs.info.disabled_reason),label:this.hacs.localize("menu.custom_repositories"),action:()=>{this.dispatchEvent(new CustomEvent("hacs-dialog",{detail:{type:"custom-repositories",repositories:this.hacs.repositories},bubbles:!0,composed:!0}))}},n?{path:I,label:this.hacs.localize("menu.dismiss"),action:()=>{U(this.hass,this.hacs)}}:void 0,{path:q,label:this.hacs.localize("menu.about"),action:()=>{(async(e,t)=>{se(e,{title:"Home Assistant Community Store",confirmText:t.localize("common.close"),text:oe.html(`\n **${t.localize("dialog_about.integration_version")}:** | ${t.info.version}\n --|--\n **${t.localize("dialog_about.frontend_version")}:** | 20230406083157\n **${t.localize("common.repositories")}:** | ${t.repositories.length}\n **${t.localize("dialog_about.downloaded_repositories")}:** | ${t.repositories.filter((e=>e.installed)).length}\n\n **${t.localize("dialog_about.useful_links")}:**\n\n - [General documentation](https://hacs.xyz/)\n - [Configuration](https://hacs.xyz/docs/configuration/start)\n - [FAQ](https://hacs.xyz/docs/faq/what)\n - [GitHub](https://github.com/hacs)\n - [Discord](https://discord.gg/apgchf8)\n - [Become a GitHub sponsor? β€οΈ](https://github.com/sponsors/ludeeus)\n - [BuyMe~~Coffee~~Beer? πΊπ](https://buymeacoffee.com/ludeeus)\n\n ***\n\n _Everything you find in HACS is **not** tested by Home Assistant, that includes HACS itself.\n The HACS and Home Assistant teams do not support **anything** you find here._`)})})(this,this.hacs)}}].filter((e=>void 0!==e))}
>
${this.narrow?"":u``}
${this.hacs.localize("common.downloaded")}
${this.hacs.localize("common.new")}
${this.narrow?this.hacs.info.categories.map((e=>{var t,i;return u`
t===`${this.hacs.localize("dialog_custom_repositories.category")}: ${this.hacs.localize(`common.${e}`)}`)))&&void 0!==t&&t}
>
`})):u`
e.startsWith(`${this.hacs.localize("dialog_custom_repositories.category")}: `))))||""}
>
${this.hacs.info.categories.map((e=>u`
${this.hacs.localize(`common.${e}`)}
`))}
${Object.keys(Oe).map((e=>{var t;return u`
${this.hacs.localize(`column.${e}`)}
`}))}
`}
`}}},{kind:"field",key:"_exploreFabClicked",value(){return()=>{var e;const t=null===(e=this.activeFilters)||void 0===e?void 0:e.filter((e=>e!==this.hacs.localize("common.downloaded")));this.activeFilters=null!=t&&t.length?t:void 0}}},{kind:"field",key:"_filterRepositories",value(){return r(((e,t)=>e.filter((e=>{var i,a;return!(null!==(i=this.activeFilters)&&void 0!==i&&i.includes(this.hacs.localize("common.downloaded"))&&!e.installed)&&(!(null!==(a=this.activeFilters)&&void 0!==a&&a.includes(this.hacs.localize("common.new"))&&!e.new)&&!(null!=t&&t.filter((e=>e.startsWith(this.hacs.localize("dialog_custom_repositories.category")))).length&&!t.includes(`${this.hacs.localize("dialog_custom_repositories.category")}: ${this.hacs.localize(`common.${e.category}`)}`)))})).sort(((e,t)=>t.name.localeCompare(e.name))).sort(((e,t)=>e.starse.installed&&!t.installed?1:-1)).sort(((e,t)=>!e.new&&t.new?1:-1))))}},{kind:"field",key:"_columns",value(){return r(((e,t)=>{var i,a,o,s,l,r,n,c;return{icon:{title:"",label:this.hass.localize("ui.panel.config.lovelace.dashboards.picker.headers.icon"),hidden:this.narrow,type:"icon",template:(e,t)=>{var i,a;return"integration"===t.category?u`
`:u`
`}},name:{...Ne,title:this.hacs.localize("column.name"),main:!0,sortable:!0,direction:"name"===(null===(i=this.activeSort)||void 0===i?void 0:i.column)?this.activeSort.direction:null,hidden:!t.name,grows:!0,template:(t,i)=>{var a;return u`
${i.new?u``:""}
${null!==(a=this.activeFilters)&&void 0!==a&&a.includes(this.hacs.localize("common.downloaded"))||!i.installed?"":u``}
${t}
${e?this.hacs.localize(`common.${i.category}`):i.description}
`}},downloads:{...Ne,title:this.hacs.localize("column.downloads"),hidden:e||!t.downloads,sortable:!0,direction:"downloads"===(null===(a=this.activeSort)||void 0===a?void 0:a.column)?this.activeSort.direction:null,width:"10%",template:e=>u`${e||"-"}`},stars:{...Ne,title:this.hacs.localize("column.stars"),hidden:e||!t.stars,sortable:!0,direction:"stars"===(null===(o=this.activeSort)||void 0===o?void 0:o.column)?this.activeSort.direction:null,width:"10%"},last_updated:{...Ne,title:this.hacs.localize("column.last_updated"),hidden:e||!t.last_updated,sortable:!0,direction:"last_updated"===(null===(s=this.activeSort)||void 0===s?void 0:s.column)?this.activeSort.direction:null,width:"15%",template:(e,t)=>{try{return ve(new Date(e),this.hass.locale)}catch(e){return"-"}}},installed_version:{...Ne,title:this.hacs.localize("column.installed_version"),hidden:e||!t.installed_version,sortable:!0,direction:"installed_version"===(null===(l=this.activeSort)||void 0===l?void 0:l.column)?this.activeSort.direction:null,width:"10%",template:(e,t)=>t.installed?e:"-"},available_version:{...Ne,title:this.hacs.localize("column.available_version"),hidden:e||!t.available_version,sortable:!0,direction:"available_version"===(null===(r=this.activeSort)||void 0===r?void 0:r.column)?this.activeSort.direction:null,width:"10%",template:(e,t)=>t.installed?e:"-"},status:{...Ne,title:this.hacs.localize("column.status"),hidden:e||!t.status,sortable:!0,direction:"status"===(null===(n=this.activeSort)||void 0===n?void 0:n.column)?this.activeSort.direction:null,width:"10%",template:e=>["pending-restart","pending-upgrade"].includes(e)?this.hacs.localize(`repository_status.${e}`):"-"},category:{...Ne,title:this.hacs.localize("column.category"),hidden:e||!t.category,sortable:!0,direction:"category"===(null===(c=this.activeSort)||void 0===c?void 0:c.column)?this.activeSort.direction:null,width:"10%",template:e=>this.hacs.localize(`common.${e}`)},authors:Ne,description:Ne,domain:Ne,full_name:Ne,id:Ne,topics:Ne,actions:{title:"",width:this.narrow?void 0:"10%",type:"overflow-menu",template:(e,t)=>t.installed?u`
`:""}}}))}},{kind:"method",key:"_handleRowClicked",value:function(e){V(`/hacs/repository/${e.detail.id}`)}},{kind:"method",key:"_handleCategoryFilterChange",value:function(e){e.stopPropagation();const t=e.target.value;var i,a;t&&("HA-RADIO"===e.target.nodeName&&!1===e.target.checked?this.activeFilters=[...(null===(i=this.activeFilters)||void 0===i?void 0:i.filter((e=>!e.startsWith(this.hacs.localize("dialog_custom_repositories.category"))&&e!==t)))||[]]:this.activeFilters=[...(null===(a=this.activeFilters)||void 0===a?void 0:a.filter((e=>!e.startsWith(this.hacs.localize("dialog_custom_repositories.category"))&&e!==t)))||[],t])}},{kind:"method",key:"_handleSearchFilterChanged",value:function(e){this._activeSearch=e.detail.value}},{kind:"method",key:"_handleColumnChange",value:function(e){e.stopPropagation();const t={...this._tableColumns,[e.currentTarget.column]:e.detail.selected};this._tableColumns=Object.keys(Oe).reduce(((e,i)=>{var a;return{...e,[i]:null!==(a=t[i])&&void 0!==a?a:Oe[i]}}),{})}},{kind:"method",key:"_handleSortingChanged",value:function(e){this.activeSort=e.detail}},{kind:"method",key:"_handleDownloadFilterChange",value:function(e){var t;const i=(null===(t=this.activeFilters)||void 0===t?void 0:t.filter((e=>!e.startsWith(this.hacs.localize("common.downloaded")))))||[];e.detail.selected&&i.push(this.hacs.localize("common.downloaded")),this.activeFilters=i.length?i:void 0}},{kind:"method",key:"_handleNewFilterChange",value:function(e){var t;const i=(null===(t=this.activeFilters)||void 0===t?void 0:t.filter((e=>!e.startsWith(this.hacs.localize("common.new")))))||[];e.detail.selected&&i.push(this.hacs.localize("common.new")),this.activeFilters=i.length?i:void 0}},{kind:"method",key:"_handleClearFilter",value:function(){this.activeFilters=void 0}},{kind:"get",static:!0,key:"styles",value:function(){return[G,Y,b`
.menu_header {
font-size: 14px;
margin: 8px;
}
.divider {
bottom: 112px;
padding: 10px 0px;
}
.divider::before {
content: " ";
display: block;
height: 1px;
background-color: var(--divider-color);
}
ha-select {
margin: 8px;
}
ha-formfield {
padding: 0 4px 0 16px;
}
`]}}]}}),c);export{We as HacsExperimentalPanel};