home-assistant / frontend

:lollipop: Frontend for Home Assistant
https://demo.home-assistant.io
Other
3.95k stars 2.68k forks source link

Supervisor entrypoints are too big ? #15956

Closed toxic0berliner closed 1 year ago

toxic0berliner commented 1 year ago

Checklist

Describe the issue you are experiencing

Entrypoint.something.js has grown beyond 1.4MB and is being truncated by default reverse proxy settings in nginx

Took me a while to fix and another while to unregister the service workers that cache this file.

Now it's working for me but I'm guessing many a reverse proxy user will struggle.

Maybe something can be done to compress the file or split it up or refactor and maybe nothing can be done, just wanted to report here this will probably cause some headaches...

Using HAOS and all updated to the latest stable version.

Describe the behavior you expected

No file above 1MB should be needed for the UI?

Steps to reproduce the issue

Load the UI over a nginx reverse proxy Observe entrypoint.xxxxx.js is truncated

What version of Home Assistant Core has the issue?

2023.3.6

What was the last working version of Home Assistant Core?

2023.3.4 or 5

In which browser are you experiencing the issue with?

all, not a browser issue but nginx default max body size

Which operating system are you using to run this browser?

all

State of relevant entities

No response

Problem-relevant frontend configuration

No response

Javascript errors shown in your browser console/inspector

Depends where the file gets truncated, can vary a bit

Additional information

No response

steverep commented 1 year ago

Depends where the file gets truncated, can vary a bit

Please paste it anyway.

I would assume you're talking about the supervisor entrypoint, but it's not clear without the full error and URI.

toxic0berliner commented 1 year ago

Took ma a while, it's this one :

/api/hassio/app/frontend_latest/entrypoint.fc042133.js
/*! For license information please see entrypoint.fc042133.js.LICENSE.txt */ (()=>{var e,t,r,i,o,n,a,s,l,c,d={14079:(e,t,r)=>{"use strict";r(44577);var i=r(37500),o=r(57626),n=r(14516),a=r(63864),s=r(47181),l=r(83849),c=r(15493),d=(r(81545),r(66255),r(65040),r(34154)),p=r(41682),h=r(26765);r(21625),r(47915),r(1822);r(18938);var u=r(85415);r(22098),r(46586);function f(e){return Array.isArray?Array.isArray(e):"[object Array]"===k(e)}const m=1/0;function y(e){return null==e?"":function(e){if("string"==typeof e)return e;let t=e+"";return"0"==t&&1/e==-m?"-0":t}(e)}function v(e){return"string"==typeof e}function b(e){return"number"==typeof e}function g(e){return!0===e||!1===e||function(e){return _(e)&&null!==e}(e)&&"[object Boolean]"==k(e)}function _(e){return"object"==typeof e}function w(e){return null!=e}function x(e){return!e.trim().length}function k(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const E=e=>`Invalid value for key ${e}`,C=e=>`Pattern length exceeds max of ${e}.`,A=e=>`Missing ${e} property in key`,S=e=>`Property 'weight' in key '${e}' must be a positive integer`,T=Object.prototype.hasOwnProperty;class P{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach((e=>{let r=I(e);t+=r.weight,this._keys.push(r),this._keyMap[r.id]=r,t+=r.weight})),this._keys.forEach((e=>{e.weight/=t}))}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function I(e){let t=null,r=null,i=null,o=1,n=null;if(v(e)||f(e))i=e,t=O(e),r=D(e);else{if(!T.call(e,"name"))throw new Error(A("name"));const a=e.name;if(i=a,T.call(e,"weight")&&(o=e.weight,o<=0))throw new Error(S(a));t=O(a),r=D(a),n=e.getFn}return{path:t,id:r,weight:o,src:i,getFn:n}}function O(e){return f(e)?e:e.split(".")}function D(e){return f(e)?e.join("."):e}var R={isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx{if(w(e))if(t[n]){const a=e[t[n]];if(!w(a))return;if(n===t.length-1&&(v(a)||b(a)||g(a)))r.push(y(a));else if(f(a)){i=!0;for(let e=0,r=a.length;e{this._keysMap[e.id]=t}))}create(){!this.isCreated&&this.docs.length&&(this.isCreated=!0,v(this.docs[0])?this.docs.forEach(((e,t)=>{this._addString(e,t)})):this.docs.forEach(((e,t)=>{this._addObject(e,t)})),this.norm.clear())}add(e){const t=this.size();v(e)?this._addString(e,t):this._addObject(e,t)}removeAt(e){this.records.splice(e,1);for(let t=e,r=this.size();t{let o=t.getFn?t.getFn(e):this.getFn(e,t.path);if(w(o))if(f(o)){let e=[];const t=[{nestedArrIndex:-1,value:o}];for(;t.length;){const{nestedArrIndex:r,value:i}=t.pop();if(w(i))if(v(i)&&!x(i)){let t={v:i,i:r,n:this.norm.get(i)};e.push(t)}else f(i)&&i.forEach(((e,r)=>{t.push({nestedArrIndex:r,value:e})}))}r.$[i]=e}else if(v(o)&&!x(o)){let e={v:o,n:this.norm.get(o)};r.$[i]=e}})),this.records.push(r)}toJSON(){return{keys:this.keys,records:this.records}}}function $(e,t,{getFn:r=R.getFn,fieldNormWeight:i=R.fieldNormWeight}={}){const o=new z({getFn:r,fieldNormWeight:i});return o.setKeys(e.map(I)),o.setSources(t),o.create(),o}function F(e,{errors:t=0,currentLocation:r=0,expectedLocation:i=0,distance:o=R.distance,ignoreLocation:n=R.ignoreLocation}={}){const a=t/e.length;if(n)return a;const s=Math.abs(i-r);return o?a+s/o:s?1:a}const N=32;function M(e,t,r,{location:i=R.location,distance:o=R.distance,threshold:n=R.threshold,findAllMatches:a=R.findAllMatches,minMatchCharLength:s=R.minMatchCharLength,includeMatches:l=R.includeMatches,ignoreLocation:c=R.ignoreLocation}={}){if(t.length>N)throw new Error(C(N));const d=t.length,p=e.length,h=Math.max(0,Math.min(i,p));let u=n,f=h;const m=s>1||l,y=m?Array(p):[];let v;for(;(v=e.indexOf(t,f))>-1;){let e=F(t,{currentLocation:v,expectedLocation:h,distance:o,ignoreLocation:c});if(u=Math.min(e,u),f=v+d,m){let e=0;for(;e=l;n-=1){let a=n-1,s=r[e.charAt(a)];if(m&&(y[a]=+!!s),x[n]=(x[n+1]<<1|1)&s,i&&(x[n]|=(b[n+1]|b[n])<<1|1|b[n+1]),x[n]&w&&(g=F(t,{errors:i,currentLocation:a,expectedLocation:h,distance:o,ignoreLocation:c}),g<=u)){if(u=g,f=a,f<=h)break;l=Math.max(1,2*h-f)}}if(F(t,{errors:i+1,currentLocation:h,expectedLocation:h,distance:o,ignoreLocation:c})>u)break;b=x}const x={isMatch:f>=0,score:Math.max(.001,g)};if(m){const e=function(e=[],t=R.minMatchCharLength){let r=[],i=-1,o=-1,n=0;for(let a=e.length;n=t&&r.push([i,o]),i=-1)}return e[n-1]&&n-i>=t&&r.push([i,n-1]),r}(y,s);e.length?l&&(x.indices=e):x.isMatch=!1}return x}function B(e){let t={};for(let r=0,i=e.length;r{this.chunks.push({pattern:e,alphabet:B(e),startIndex:t})},d=this.pattern.length;if(d>N){let e=0;const t=d%N,r=d-t;for(;e{const{isMatch:f,score:m,indices:y}=M(e,t,h,{location:i+u,distance:o,threshold:n,findAllMatches:a,minMatchCharLength:s,includeMatches:r,ignoreLocation:l});f&&(p=!0),d+=m,f&&y&&(c=[...c,...y])}));let h={isMatch:p,score:p?d/this.chunks.length:1};return p&&r&&(h.indices=c),h}}class j{constructor(e){this.pattern=e}static isMultiMatch(e){return U(e,this.multiRegex)}static isSingleMatch(e){return U(e,this.singleRegex)}search(){}}function U(e,t){const r=e.match(t);return r?r[1]:null}class V extends j{constructor(e,{location:t=R.location,threshold:r=R.threshold,distance:i=R.distance,includeMatches:o=R.includeMatches,findAllMatches:n=R.findAllMatches,minMatchCharLength:a=R.minMatchCharLength,isCaseSensitive:s=R.isCaseSensitive,ignoreLocation:l=R.ignoreLocation}={}){super(e),this._bitapSearch=new H(e,{location:t,threshold:r,distance:i,includeMatches:o,findAllMatches:n,minMatchCharLength:a,isCaseSensitive:s,ignoreLocation:l})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class G extends j{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let t,r=0;const i=[],o=this.pattern.length;for(;(t=e.indexOf(this.pattern,r))>-1;)r=t+o,i.push([t,r-1]);const n=!!i.length;return{isMatch:n,score:n?0:1,indices:i}}}const K=[class extends j{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){const t=e===this.pattern;return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}},G,class extends j{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){const t=e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}},class extends j{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){const t=!e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},class extends j{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){const t=!e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},class extends j{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){const t=e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[e.length-this.pattern.length,e.length-1]}}},class extends j{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){const t=-1===e.indexOf(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},V],W=K.length,Y=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,X="|";const q=new Set([V.type,G.type]);class Z{constructor(e,{isCaseSensitive:t=R.isCaseSensitive,includeMatches:r=R.includeMatches,minMatchCharLength:i=R.minMatchCharLength,ignoreLocation:o=R.ignoreLocation,findAllMatches:n=R.findAllMatches,location:a=R.location,threshold:s=R.threshold,distance:l=R.distance}={}){this.query=null,this.options={isCaseSensitive:t,includeMatches:r,minMatchCharLength:i,findAllMatches:n,ignoreLocation:o,location:a,threshold:s,distance:l},this.pattern=t?e:e.toLowerCase(),this.query=function(e,t={}){return e.split(X).map((e=>{let r=e.trim().split(Y).filter((e=>e&&!!e.trim())),i=[];for(let e=0,o=r.length;e!(!e[ee]&&!e[te]),oe=e=>!!e[re.PATH],ne=e=>!f(e)&&_(e)&&!ie(e),ae=e=>({[ee]:Object.keys(e).map((t=>({[t]:e[t]})))});function se(e,t,{auto:r=!0}={}){const i=e=>{let o=Object.keys(e);const n=oe(e);if(!n&&o.length>1&&!ie(e))return i(ae(e));if(ne(e)){const i=n?e[re.PATH]:o[0],a=n?e[re.PATTERN]:e[i];if(!v(a))throw new Error(E(i));const s={keyId:D(i),pattern:a};return r&&(s.searcher=Q(a,t)),s}let a={children:[],operator:o[0]};return o.forEach((t=>{const r=e[t];f(r)&&r.forEach((e=>{a.children.push(i(e))}))})),a};return ie(e)||(e=ae(e)),i(e)}function le(e,t){const r=e.matches;t.matches=[],w(r)&&r.forEach((e=>{if(!w(e.indices)||!e.indices.length)return;const{indices:r,value:i}=e;let o={indices:r,value:i};e.key&&(o.key=e.key.src),e.idx>-1&&(o.refIndex=e.idx),t.matches.push(o)}))}function ce(e,t){t.score=e.score}class de{constructor(e,t={},r){this.options={...R,...t},this.options.useExtendedSearch,this._keyStore=new P(this.options.keys),this.setCollection(e,r)}setCollection(e,t){if(this._docs=e,t&&!(t instanceof z))throw new Error("Incorrect 'index' type");this._myIndex=t||$(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){w(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=(()=>!1)){const t=[];for(let r=0,i=this._docs.length;r{let r=1;e.matches.forEach((({key:e,norm:i,score:o})=>{const n=e?e.weight:null;r*=Math.pow(0===o&&n?Number.EPSILON:o,(n||1)*(t?1:i))})),e.score=r}))}(s,{ignoreFieldNorm:a}),o&&s.sort(n),b(t)&&t>-1&&(s=s.slice(0,t)),function(e,t,{includeMatches:r=R.includeMatches,includeScore:i=R.includeScore}={}){const o=[];return r&&o.push(le),i&&o.push(ce),e.map((e=>{const{idx:r}=e,i={item:t[r],refIndex:r};return o.length&&o.forEach((t=>{t(e,i)})),i}))}(s,this._docs,{includeMatches:r,includeScore:i})}_searchStringList(e){const t=Q(e,this.options),{records:r}=this._myIndex,i=[];return r.forEach((({v:e,i:r,n:o})=>{if(!w(e))return;const{isMatch:n,score:a,indices:s}=t.searchIn(e);n&&i.push({item:e,idx:r,matches:[{score:a,value:e,norm:o,indices:s}]})})),i}_searchLogical(e){const t=se(e,this.options),r=(e,t,i)=>{if(!e.children){const{keyId:r,searcher:o}=e,n=this._findMatches({key:this._keyStore.get(r),value:this._myIndex.getValueForItemAtKeyId(t,r),searcher:o});return n&&n.length?[{idx:i,item:t,matches:n}]:[]}const o=[];for(let n=0,a=e.children.length;n{if(w(e)){let a=r(t,e,i);a.length&&(o[i]||(o[i]={idx:i,item:e,matches:[]},n.push(o[i])),a.forEach((({matches:e})=>{o[i].matches.push(...e)})))}})),n}_searchObjectList(e){const t=Q(e,this.options),{keys:r,records:i}=this._myIndex,o=[];return i.forEach((({$:e,i})=>{if(!w(e))return;let n=[];r.forEach(((r,i)=>{n.push(...this._findMatches({key:r,value:e[i],searcher:t}))})),n.length&&o.push({idx:i,item:e,matches:n})})),o}_findMatches({key:e,value:t,searcher:r}){if(!w(t))return[];let i=[];if(f(t))t.forEach((({v:t,i:o,n})=>{if(!w(t))return;const{isMatch:a,score:s,indices:l}=r.searchIn(t);a&&i.push({score:s,key:e,value:t,idx:o,norm:n,indices:l})}));else{const{v:o,n}=t,{isMatch:a,score:s,indices:l}=r.searchIn(o);a&&i.push({score:s,key:e,value:o,norm:n,indices:l})}return i}}de.version="6.6.2",de.createIndex=$,de.parseIndex=function(e,{getFn:t=R.getFn,fieldNormWeight:r=R.fieldNormWeight}={}){const{keys:i,records:o}=e,n=new z({getFn:t,fieldNormWeight:r});return n.setKeys(i),n.setIndexRecords(o),n},de.config=R,de.parseQuery=se,function(...e){J.push(...e)}(Z);var pe=r(55677);function he(){he=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,t){["method","field"].forEach((function(r){t.forEach((function(t){t.kind===r&&"own"===t.placement&&this.defineClassElement(e,t)}),this)}),this)},initializeClassElements:function(e,t){var r=e.prototype;["method","field"].forEach((function(i){t.forEach((function(t){var o=t.placement;if(t.kind===i&&("static"===o||"prototype"===o)){var n="static"===o?e:r;this.defineClassElement(n,t)}}),this)}),this)},defineClassElement:function(e,t){var r=t.descriptor;if("field"===t.kind){var i=t.initializer;r={enumerable:r.enumerable,writable:r.writable,configurable:r.configurable,value:void 0===i?void 0:i.call(e)}}Object.defineProperty(e,t.key,r)},decorateClass:function(e,t){var r=[],i=[],o={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,o)}),this),e.forEach((function(e){if(!me(e))return r.push(e);var t=this.decorateElement(e,o);r.push(t.element),r.push.apply(r,t.extras),i.push.apply(i,t.finishers)}),this),!t)return{elements:r,finishers:i};var n=this.decorateConstructor(r,t);return i.push.apply(i,n.finishers),n.finishers=i,n},addElementPlacement:function(e,t,r){var i=t[e.placement];if(!r&&-1!==i.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");i.push(e.key)},decorateElement:function(e,t){for(var r=[],i=[],o=e.decorators,n=o.length-1;n>=0;n--){var a=t[e.placement];a.splice(a.indexOf(e.key),1);var s=this.fromElementDescriptor(e),l=this.toElementFinisherExtras((0,o[n])(s)||s);e=l.element,this.addElementPlacement(e,t),l.finisher&&i.push(l.finisher);var c=l.extras;if(c){for(var d=0;d=0;i--){var o=this.fromClassDescriptor(e),n=this.toClassDescriptor((0,t[i])(o)||o);if(void 0!==n.finisher&&r.push(n.finisher),void 0!==n.elements){e=n.elements;for(var a=0;ae.length)&&(t=e.length);for(var r=0,i=new Array(t);rt?function(e,t){return new de(e,{keys:["name","description","slug"],isCaseSensitive:!1,minMatchCharLength:2,threshold:.2}).search(t).map((e=>e.item))}(e,t):e.sort(((e,t)=>(0,u.f)(e.name,t.name,this.hass.locale.language)))))}},{kind:"method",key:"render",value:function(){var e;const t=this.repo;let r=this.addons;null!==(e=this.hass.userData)&&void 0!==e&&e.showAdvanced||(r=r.filter((e=>!e.advanced&&"stable"===e.stage)));const o=this._getAddons(r,this.filter);return this.filter&&o.length<1?i.dy`

${this.supervisor.localize("store.no_results_found","repository",t.name)}

`:i.dy`

${t.name}

${o.map((e=>i.dy`
`))}
`}},{kind:"method",key:"_addonTapped",value:function(e){(0,l.c)(`/hassio/addon/${e.currentTarget.addon.slug}?store=true`)}},{kind:"get",static:!0,key:"styles",value:function(){return[pe.l,i.iv`ha-card{cursor:pointer}.not_available{opacity:0.6}a.repo{color:var(--primary-text-color)}`]}}]}}),i.oi);function _e(){_e=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,t){["method","field"].forEach((function(r){t.forEach((function(t){t.kind===r&&"own"===t.placement&&this.defineClassElement(e,t)}),this)}),this)},initializeClassElements:function(e,t){var r=e.prototype;["method","field"].forEach((function(i){t.forEach((function(t){var o=t.placement;if(t.kind===i&&("static"===o||"prototype"===o)){var n="static"===o?e:r;this.defineClassElement(n,t)}}),this)}),this)},defineClassElement:function(e,t){var r=t.descriptor;if("field"===t.kind){var i=t.initializer;r={enumerable:r.enumerable,writable:r.writable,configurable:r.configurable,value:void 0===i?void 0:i.call(e)}}Object.defineProperty(e,t.key,r)},decorateClass:function(e,t){var r=[],i=[],o={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,o)}),this),e.forEach((function(e){if(!ke(e))return r.push(e);var t=this.decorateElement(e,o);r.push(t.element),r.push.apply(r,t.extras),i.push.apply(i,t.finishers)}),this),!t)return{elements:r,finishers:i};var n=this.decorateConstructor(r,t);return i.push.apply(i,n.finishers),n.finishers=i,n},addElementPlacement:function(e,t,r){var i=t[e.placement];if(!r&&-1!==i.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");i.push(e.key)},decorateElement:function(e,t){for(var r=[],i=[],o=e.decorators,n=o.length-1;n>=0;n--){var a=t[e.placement];a.splice(a.indexOf(e.key),1);var s=this.fromElementDescriptor(e),l=this.toElementFinisherExtras((0,o[n])(s)||s);e=l.element,this.addElementPlacement(e,t),l.finisher&&i.push(l.finisher);var c=l.extras;if(c){for(var d=0;d=0;i--){var o=this.fromClassDescriptor(e),n=this.toClassDescriptor((0,t[i])(o)||o);if(void 0!==n.finisher&&r.push(n.finisher),void 0!==n.elements){e=n.elements;for(var a=0;ae.length)&&(t=e.length);for(var r=0,i=new Array(t);r"local"===e.slug?-1:"local"===t.slug?1:"core"===e.slug?-1:"core"===t.slug?1:e.name.toUpperCase() ${this.supervisor.localize("store.repositories")} ${this.supervisor.localize("store.check_updates")} ${null!==(e=this.hass.userData)&&void 0!==e&&e.showAdvanced&&(0,a.I)(this.hass.config.version,0,117)?i.dy` ${this.supervisor.localize("store.registries")} `:""} ${0===r.length?i.dy``:i.dy` ${r} `} ${null!==(t=this.hass.userData)&&void 0!==t&&t.showAdvanced?"":i.dy` `} `}},{kind:"method",key:"firstUpdated",value:function(e){Te(Pe(u.prototype),"firstUpdated",this).call(this,e);const t=(0,c.io)("repository_url");(0,l.c)("/hassio/store",{replace:!0}),t&&this._manageRepositories(t),this.addEventListener("hass-api-called",(e=>this.apiCalled(e))),this._loadData()}},{kind:"field",key:"addonRepositories",value(){return(0,n.Z)(((e,t,r)=>e.sort(Ie).map((e=>{const o=t.filter((t=>t.repository===e.slug));return 0!==o.length?i.dy` `:i.Ld}))))}},{kind:"method",key:"_handleAction",value:function(e){switch(e.detail.index){case 0:this._manageRepositoriesClicked();break;case 1:this.refreshData();break;case 2:this._manageRegistries()}}},{kind:"method",key:"apiCalled",value:function(e){e.detail.success&&this._loadData()}},{kind:"method",key:"_manageRepositoriesClicked",value:function(){this._manageRepositories()}},{kind:"method",key:"_manageRepositories",value:async function(e){var t,i;t=this,i={supervisor:this.supervisor,url:e},(0,s.B)(t,"show-dialog",{dialogTag:"dialog-hassio-repositories",dialogImport:()=>Promise.resolve().then(r.bind(r,18938)),dialogParams:i})}},{kind:"method",key:"_manageRegistries",value:async function(){var e,t;e=this,t={supervisor:this.supervisor},(0,s.B)(e,"show-dialog",{dialogTag:"dialog-hassio-registries",dialogImport:()=>Promise.resolve().then(r.bind(r,1822)),dialogParams:t})}},{kind:"method",key:"_loadData",value:async function(){(0,s.B)(this,"supervisor-collection-refresh",{collection:"addon"}),(0,s.B)(this,"supervisor-collection-refresh",{collection:"supervisor"})}},{kind:"method",key:"_filterChanged",value:async function(e){this._filter=e.detail.value}},{kind:"get",static:!0,key:"styles",value:function(){return i.iv`hassio-addon-repository{margin-top:24px}.search{position:sticky;top:0;z-index:2}search-input{display:block;--mdc-text-field-fill-color:var(--sidebar-background-color);--mdc-text-field-idle-line-color:var(--divider-color)}.advanced{padding:12px;display:flex;flex-wrap:wrap;color:var(--primary-text-color)}.advanced a{margin-left:0.5em;color:var(--primary-color)}`}}]}}),i.oi)},2853:(e,t,r)=>{"use strict";r.a(e,(async(e,t)=>{try{r(30437),r(44577);var i=r(37500),o=r(57626),n=r(8636),a=r(14516),s=r(63864),l=r(5435),c=(r(81545),r(36938),r(66255),r(52039),r(60538)),d=r(41682),p=r(26765),h=(r(55181),r(11654)),u=r(97458),f=r(77828),m=r(46094),y=r(43499),v=r(55677),b=e([l]);function g(e,t,r,i){var o=_();if(i)for(var n=0;n=0;n--){var a=t[e.placement];a.splice(a.indexOf(e.key),1);var s=this.fromElementDescriptor(e),l=this.toElementFinisherExtras((0,o[n])(s)||s);e=l.element,this.addElementPlacement(e,t),l.finisher&&i.push(l.finisher);var c=l.extras;if(c){for(var d=0;d=0;i--){var o=this.fromClassDescriptor(e),n=this.toClassDescriptor((0,t[i])(o)||o);if(void 0!==n.finisher&&r.push(n.finisher),void 0!==n.elements){e=n.elements;for(var a=0;ae.length)&&(t=e.length);for(var r=0,i=new Array(t);r[]},{kind:"field",decorators:[(0,o.SB)()],key:"_backups",value:()=>[]},{kind:"field",decorators:[(0,o.IO)("hass-tabs-subpage-data-table",!0)],key:"_dataTable",value:void 0},{kind:"field",key:"_firstUpdatedCalled",value:()=>!1},{kind:"method",key:"connectedCallback",value:function(){L($(r.prototype),"connectedCallback",this).call(this),this.hass&&this._firstUpdatedCalled&&this.refreshData()}},{kind:"method",key:"refreshData",value:async function(){await(0,c.Fk)(this.hass),await this.fetchBackups()}},{kind:"field",key:"_computeBackupContent",value(){return e=>{if("full"===e.type)return this.supervisor.localize("backup.full_backup");const t=[];if(e.content.homeassistant&&t.push("Home Assistant"),0!==e.content.folders.length)for(const r of e.content.folders)t.push(c.wb[r]||r);if(0!==e.content.addons.length)for(const i of e.content.addons){var r;t.push((null===(r=this.supervisor.addon.addons.find((e=>e.slug===i)))||void 0===r?void 0:r.name)||i)}return t.join(", ")}}},{kind:"method",key:"firstUpdated",value:function(e){L($(r.prototype),"firstUpdated",this).call(this,e),this.hass&&this.isConnected&&this.refreshData(),this._firstUpdatedCalled=!0}},{kind:"field",key:"_columns",value(){return(0,a.Z)((e=>({name:{title:this.supervisor.localize("backup.name"),main:!0,sortable:!0,filterable:!0,grows:!0,template:(e,t)=>i.dy`${e||t.slug}
${t.secondary}
`},size:{title:this.supervisor.localize("backup.size"),width:"15%",hidden:e,filterable:!0,sortable:!0,template:e=>Math.ceil(10*e)/10+" MB"},date:{title:this.supervisor.localize("backup.created"),width:"15%",direction:"desc",hidden:e,filterable:!0,sortable:!0,template:e=>(0,l.G)(new Date(e),this.hass.locale)},secondary:{title:"",hidden:!0,filterable:!0}})))}},{kind:"field",key:"_backupData",value(){return(0,a.Z)((e=>e.map((e=>({...e,secondary:this._computeBackupContent(e)})))))}},{kind:"method",key:"render",value:function(){var e;return this.supervisor?i.dy` ${this.supervisor.localize("common.reload")} ${(0,s.I)(this.hass.config.version,0,116)?i.dy` ${this.supervisor.localize("backup.upload_backup")} `:""} ${this._selectedBackups.length?i.dy`

${this.supervisor.localize("backup.selected",{number:this._selectedBackups.length})}

${this.narrow?i.dy` ${this.supervisor.localize("backup.delete_selected")} `:i.dy` ${this.supervisor.localize("backup.delete_selected")} `}
`:""}
`:i.Ld}},{kind:"method",key:"_handleAction",value:function(e){switch(e.detail.index){case 0:this.refreshData();break;case 1:this._showUploadBackupDialog()}}},{kind:"method",key:"_handleSelectionChanged",value:function(e){this._selectedBackups=e.detail.value}},{kind:"method",key:"_showUploadBackupDialog",value:function(){(0,u.k)(this,{showBackup:e=>(0,f.Y)(this,{slug:e,supervisor:this.supervisor,onDelete:()=>this.fetchBackups()}),reloadBackup:()=>this.refreshData()})}},{kind:"method",key:"fetchBackups",value:async function(){await(0,c.Fk)(this.hass),this._backups=await(0,c.jc)(this.hass)}},{kind:"method",key:"_deleteSelected",value:async function(){if(await(0,p.g7)(this,{title:this.supervisor.localize("backup.delete_backup_title"),text:this.supervisor.localize("backup.delete_backup_text",{number:this._selectedBackups.length}),confirmText:this.supervisor.localize("backup.delete_backup_confirm")})){try{await Promise.all(this._selectedBackups.map((e=>(0,c.FZ)(this.hass,e))))}catch(e){return void(0,p.Ys)(this,{title:this.supervisor.localize("backup.failed_to_delete"),text:(0,d.js)(e)})}await(0,c.Fk)(this.hass),this._backups=await(0,c.jc)(this.hass),this._dataTable.clearSelection()}}},{kind:"method",key:"_handleRowClicked",value:function(e){const t=e.detail.id;(0,f.Y)(this,{slug:t,supervisor:this.supervisor,onDelete:()=>this.fetchBackups()})}},{kind:"method",key:"_createBackup",value:function(){"running"===this.supervisor.info.state?(0,m.m)(this,{supervisor:this.supervisor,onCreate:()=>this.fetchBackups()}):(0,p.Ys)(this,{title:this.supervisor.localize("backup.could_not_create"),text:this.supervisor.localize("backup.create_blocked_not_running","state",this.supervisor.info.state)})}},{kind:"get",static:!0,key:"styles",value:function(){return[h.Qx,v.l,i.iv`.table-header{display:flex;justify-content:space-between;align-items:center;height:58px;border-bottom:1px solid rgba(var(--rgb-primary-text-color), 0.12)}.header-toolbar{display:flex;justify-content:space-between;align-items:center;color:var(--secondary-text-color);position:relative;top:-4px}.selected-txt{font-weight:bold;padding-left:16px;color:var(--primary-text-color)}.table-header .selected-txt{margin-top:20px}.header-toolbar .selected-txt{font-size:16px}.header-toolbar .header-btns{margin-right:-12px}.header-btns > mwc-button,.header-btns > ha-icon-button{margin:8px}`]}}]}}),i.oi);t()}catch(H){t(H)}}))},46586:(e,t,r)=>{"use strict";var i=r(37500),o=r(57626);r(52039);function n(){n=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,t){["method","field"].forEach((function(r){t.forEach((function(t){t.kind===r&&"own"===t.placement&&this.defineClassElement(e,t)}),this)}),this)},initializeClassElements:function(e,t){var r=e.prototype;["method","field"].forEach((function(i){t.forEach((function(t){var o=t.placement;if(t.kind===i&&("static"===o||"prototype"===o)){var n="static"===o?e:r;this.defineClassElement(n,t)}}),this)}),this)},defineClassElement:function(e,t){var r=t.descriptor;if("field"===t.kind){var i=t.initializer;r={enumerable:r.enumerable,writable:r.writable,configurable:r.configurable,value:void 0===i?void 0:i.call(e)}}Object.defineProperty(e,t.key,r)},decorateClass:function(e,t){var r=[],i=[],o={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,o)}),this),e.forEach((function(e){if(!l(e))return r.push(e);var t=this.decorateElement(e,o);r.push(t.element),r.push.apply(r,t.extras),i.push.apply(i,t.finishers)}),this),!t)return{elements:r,finishers:i};var n=this.decorateConstructor(r,t);return i.push.apply(i,n.finishers),n.finishers=i,n},addElementPlacement:function(e,t,r){var i=t[e.placement];if(!r&&-1!==i.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");i.push(e.key)},decorateElement:function(e,t){for(var r=[],i=[],o=e.decorators,n=o.length-1;n>=0;n--){var a=t[e.placement];a.splice(a.indexOf(e.key),1);var s=this.fromElementDescriptor(e),l=this.toElementFinisherExtras((0,o[n])(s)||s);e=l.element,this.addElementPlacement(e,t),l.finisher&&i.push(l.finisher);var c=l.extras;if(c){for(var d=0;d=0;i--){var o=this.fromClassDescriptor(e),n=this.toClassDescriptor((0,t[i])(o)||o);if(void 0!==n.finisher&&r.push(n.finisher),void 0!==n.elements){e=n.elements;for(var a=0;ae.length)&&(t=e.length);for(var r=0,i=new Array(t);r!0},{kind:"field",decorators:[(0,o.Cb)({type:Boolean})],key:"showTopbar",value:()=>!1},{kind:"field",decorators:[(0,o.Cb)()],key:"topbarClass",value:void 0},{kind:"field",decorators:[(0,o.Cb)()],key:"iconTitle",value:void 0},{kind:"field",decorators:[(0,o.Cb)()],key:"iconClass",value:void 0},{kind:"field",decorators:[(0,o.Cb)()],key:"icon",value:()=>"M15.07,11.25L14.17,12.17C13.45,12.89 13,13.5 13,15H11V14.5C11,13.39 11.45,12.39 12.17,11.67L13.41,10.41C13.78,10.05 14,9.55 14,9C14,7.89 13.1,7 12,7A2,2 0 0,0 10,9H8A4,4 0 0,1 12,5A4,4 0 0,1 16,9C16,9.88 15.64,10.67 15.07,11.25M13,19H11V17H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12C22,6.47 17.5,2 12,2Z"},{kind:"field",decorators:[(0,o.Cb)()],key:"iconImage",value:void 0},{kind:"method",key:"render",value:function(){return i.dy` ${this.showTopbar?i.dy`
`:""} ${this.iconImage?i.dy`
`:i.dy` `}
${this.title}
${this.description} ${!1===this.available?" (Not available)":""}
`}},{kind:"get",static:!0,key:"styles",value:function(){return i.iv`ha-svg-icon{margin-right:24px;margin-left:8px;margin-top:12px;float:left;color:var(--secondary-text-color)}ha-svg-icon.update{color:var(--warning-color)}ha-svg-icon.running,ha-svg-icon.installed{color:var(--success-color)}ha-svg-icon.hassupdate,ha-svg-icon.backup{color:var(--paper-item-icon-color)}ha-svg-icon.not_available{color:var(--error-color)}.title{color:var(--primary-text-color);white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.addition{color:var(--secondary-text-color);overflow:hidden;position:relative;height:2.4em;line-height:1.2em}.icon_image img{max-height:40px;max-width:40px;margin-top:4px;margin-right:16px;float:left}.icon_image.stopped,.icon_image.not_available{filter:grayscale(1)}.dot{position:absolute;background-color:var(--warning-color);width:12px;height:12px;top:8px;right:8px;border-radius:50%}.topbar{position:absolute;width:100%;height:2px;top:0;left:0;border-top-left-radius:2px;border-top-right-radius:2px}.topbar.installed{background-color:var(--primary-color)}.topbar.update{background-color:var(--accent-color)}.topbar.unavailable{background-color:var(--error-color)}`}}]}}),i.oi)},63226:(e,t,r)=>{"use strict";var i=r(37500),o=r(57626),n=r(8636),a=(r(12373),r(14089),r(88027));function s(){s=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,t){["method","field"].forEach((function(r){t.forEach((function(t){t.kind===r&&"own"===t.placement&&this.defineClassElement(e,t)}),this)}),this)},initializeClassElements:function(e,t){var r=e.prototype;["method","field"].forEach((function(i){t.forEach((function(t){var o=t.placement;if(t.kind===i&&("static"===o||"prototype"===o)){var n="static"===o?e:r;this.defineClassElement(n,t)}}),this)}),this)},defineClassElement:function(e,t){var r=t.descriptor;if("field"===t.kind){var i=t.initializer;r={enumerable:r.enumerable,writable:r.writable,configurable:r.configurable,value:void 0===i?void 0:i.call(e)}}Object.defineProperty(e,t.key,r)},decorateClass:function(e,t){var r=[],i=[],o={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,o)}),this),e.forEach((function(e){if(!d(e))return r.push(e);var t=this.decorateElement(e,o);r.push(t.element),r.push.apply(r,t.extras),i.push.apply(i,t.finishers)}),this),!t)return{elements:r,finishers:i};var n=this.decorateConstructor(r,t);return i.push.apply(i,n.finishers),n.finishers=i,n},addElementPlacement:function(e,t,r){var i=t[e.placement];if(!r&&-1!==i.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");i.push(e.key)},decorateElement:function(e,t){for(var r=[],i=[],o=e.decorators,n=o.length-1;n>=0;n--){var a=t[e.placement];a.splice(a.indexOf(e.key),1);var s=this.fromElementDescriptor(e),l=this.toElementFinisherExtras((0,o[n])(s)||s);e=l.element,this.addElementPlacement(e,t),l.finisher&&i.push(l.finisher);var c=l.extras;if(c){for(var d=0;d=0;i--){var o=this.fromClassDescriptor(e),n=this.toClassDescriptor((0,t[i])(o)||o);if(void 0!==n.finisher&&r.push(n.finisher),void 0!==n.elements){e=n.elements;for(var a=0;ae.length)&&(t=e.length);for(var r=0,i=new Array(t);r ${this.description}
${t} % 50,"target-critical":t>85})}" .value="${this.value}">
`}},{kind:"get",static:!0,key:"styles",value:function(){return i.iv`ha-settings-row{padding:0;height:54px;width:100%}ha-settings-row > div[slot="description"]{white-space:normal;color:var(--secondary-text-color);display:flex;justify-content:space-between}ha-bar{--ha-bar-primary-color:var( --hassio-bar-ok-color, var(--success-color) )}.target-warning{--ha-bar-primary-color:var( --hassio-bar-warning-color, var(--warning-color) )}.target-critical{--ha-bar-primary-color:var( --hassio-bar-critical-color, var(--error-color) )}.value{width:48px;padding-right:4px;flex-shrink:0}`}}]}}),i.oi)},57252:(e,t,r)=>{"use strict";var i=r(37500),o=r(57626),n=r(63864),a=(r(36938),r(1359),r(11654)),s=r(43499),l=r(83849),c=r(85415),d=(r(22098),r(46586),r(55677));function p(){p=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,t){["method","field"].forEach((function(r){t.forEach((function(t){t.kind===r&&"own"===t.placement&&this.defineClassElement(e,t)}),this)}),this)},initializeClassElements:function(e,t){var r=e.prototype;["method","field"].forEach((function(i){t.forEach((function(t){var o=t.placement;if(t.kind===i&&("static"===o||"prototype"===o)){var n="static"===o?e:r;this.defineClassElement(n,t)}}),this)}),this)},defineClassElement:function(e,t){var r=t.descriptor;if("field"===t.kind){var i=t.initializer;r={enumerable:r.enumerable,writable:r.writable,configurable:r.configurable,value:void 0===i?void 0:i.call(e)}}Object.defineProperty(e,t.key,r)},decorateClass:function(e,t){var r=[],i=[],o={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,o)}),this),e.forEach((function(e){if(!f(e))return r.push(e);var t=this.decorateElement(e,o);r.push(t.element),r.push.apply(r,t.extras),i.push.apply(i,t.finishers)}),this),!t)return{elements:r,finishers:i};var n=this.decorateConstructor(r,t);return i.push.apply(i,n.finishers),n.finishers=i,n},addElementPlacement:function(e,t,r){var i=t[e.placement];if(!r&&-1!==i.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");i.push(e.key)},decorateElement:function(e,t){for(var r=[],i=[],o=e.decorators,n=o.length-1;n>=0;n--){var a=t[e.placement];a.splice(a.indexOf(e.key),1);var s=this.fromElementDescriptor(e),l=this.toElementFinisherExtras((0,o[n])(s)||s);e=l.element,this.addElementPlacement(e,t),l.finisher&&i.push(l.finisher);var c=l.extras;if(c){for(var d=0;d=0;i--){var o=this.fromClassDescriptor(e),n=this.toClassDescriptor((0,t[i])(o)||o);if(void 0!==n.finisher&&r.push(n.finisher),void 0!==n.elements){e=n.elements;for(var a=0;ae.length)&&(t=e.length);for(var r=0,i=new Array(t);r ${(0,n.I)(this.hass.config.version,2021,12)?"":i.dy`

${this.supervisor.localize("dashboard.addons")}

`}
${this.supervisor.addon.addons.length?this.supervisor.addon.addons.sort(((e,t)=>(0,c.f)(e.name,t.name,this.hass.locale.language))).map((e=>i.dy`
`)):i.dy`
`}
`}},{kind:"get",static:!0,key:"styles",value:function(){return[a.Qx,d.l,i.iv`ha-card{cursor:pointer}`]}},{kind:"method",key:"_addonTapped",value:function(e){(0,l.c)(`/hassio/addon/${e.currentTarget.addon.slug}/info`)}},{kind:"method",key:"_openStore",value:function(){(0,l.c)("/hassio/store")}}]}}),i.oi);r(30437);var g=r(14516);r(98762),r(14089),r(52039);function _(){_=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,t){["method","field"].forEach((function(r){t.forEach((function(t){t.kind===r&&"own"===t.placement&&this.defineClassElement(e,t)}),this)}),this)},initializeClassElements:function(e,t){var r=e.prototype;["method","field"].forEach((function(i){t.forEach((function(t){var o=t.placement;if(t.kind===i&&("static"===o||"prototype"===o)){var n="static"===o?e:r;this.defineClassElement(n,t)}}),this)}),this)},defineClassElement:function(e,t){var r=t.descriptor;if("field"===t.kind){var i=t.initializer;r={enumerable:r.enumerable,writable:r.writable,configurable:r.configurable,value:void 0===i?void 0:i.call(e)}}Object.defineProperty(e,t.key,r)},decorateClass:function(e,t){var r=[],i=[],o={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,o)}),this),e.forEach((function(e){if(!k(e))return r.push(e);var t=this.decorateElement(e,o);r.push(t.element),r.push.apply(r,t.extras),i.push.apply(i,t.finishers)}),this),!t)return{elements:r,finishers:i};var n=this.decorateConstructor(r,t);return i.push.apply(i,n.finishers),n.finishers=i,n},addElementPlacement:function(e,t,r){var i=t[e.placement];if(!r&&-1!==i.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");i.push(e.key)},decorateElement:function(e,t){for(var r=[],i=[],o=e.decorators,n=o.length-1;n>=0;n--){var a=t[e.placement];a.splice(a.indexOf(e.key),1);var s=this.fromElementDescriptor(e),l=this.toElementFinisherExtras((0,o[n])(s)||s);e=l.element,this.addElementPlacement(e,t),l.finisher&&i.push(l.finisher);var c=l.extras;if(c){for(var d=0;d=0;i--){var o=this.fromClassDescriptor(e),n=this.toClassDescriptor((0,t[i])(o)||o);if(void 0!==n.finisher&&r.push(n.finisher),void 0!==n.elements){e=n.elements;for(var a=0;ae.length)&&(t=e.length);for(var r=0,i=new Array(t);r"os"===e?t:`${e}-${t}`;!function(e,t,r,i){var o=_();if(i)for(var n=0;n(0,g.Z)((e=>Object.keys(e).filter((t=>e[t].update_available)).length))},{kind:"method",key:"render",value:function(){if(!this.supervisor)return i.Ld;const e=this._pendingUpdates(this.supervisor);return e?i.dy`

${this.supervisor.localize("common.update_available","count",e)} 🎉

${this._renderUpdateCard("Home Assistant Core","core",this.supervisor.core)} ${this._renderUpdateCard("Supervisor","supervisor",this.supervisor.supervisor)} ${this.supervisor.host.features.includes("haos")?this._renderUpdateCard("Operating System","os",this.supervisor.os):""}
`:i.Ld}},{kind:"method",key:"_renderUpdateCard",value:function(e,t,r){return r.update_available?i.dy`
${e}
${this.supervisor.localize("common.version")} ${T(t,r.version)} ${this.supervisor.localize("common.newest_version")} ${T(t,r.version_latest)}
`:i.Ld}},{kind:"get",static:!0,key:"styles",value:function(){return[a.Qx,d.l,i.iv`.icon{--mdc-icon-size:48px;float:right;margin:0 0 2px 10px;color:var(--primary-text-color)}.update-heading{font-size:var(--paper-font-subhead_-_font-size);font-weight:500;margin-bottom:0.5em;color:var(--primary-text-color)}.card-content{height:calc(100% - 47px);box-sizing:border-box}.card-actions{text-align:right}a{text-decoration:none}ha-settings-row{padding:0}`]}}]}}),i.oi);r(47915);function P(){P=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,t){["method","field"].forEach((function(r){t.forEach((function(t){t.kind===r&&"own"===t.placement&&this.defineClassElement(e,t)}),this)}),this)},initializeClassElements:function(e,t){var r=e.prototype;["method","field"].forEach((function(i){t.forEach((function(t){var o=t.placement;if(t.kind===i&&("static"===o||"prototype"===o)){var n="static"===o?e:r;this.defineClassElement(n,t)}}),this)}),this)},defineClassElement:function(e,t){var r=t.descriptor;if("field"===t.kind){var i=t.initializer;r={enumerable:r.enumerable,writable:r.writable,configurable:r.configurable,value:void 0===i?void 0:i.call(e)}}Object.defineProperty(e,t.key,r)},decorateClass:function(e,t){var r=[],i=[],o={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,o)}),this),e.forEach((function(e){if(!D(e))return r.push(e);var t=this.decorateElement(e,o);r.push(t.element),r.push.apply(r,t.extras),i.push.apply(i,t.finishers)}),this),!t)return{elements:r,finishers:i};var n=this.decorateConstructor(r,t);return i.push.apply(i,n.finishers),n.finishers=i,n},addElementPlacement:function(e,t,r){var i=t[e.placement];if(!r&&-1!==i.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");i.push(e.key)},decorateElement:function(e,t){for(var r=[],i=[],o=e.decorators,n=o.length-1;n>=0;n--){var a=t[e.placement];a.splice(a.indexOf(e.key),1);var s=this.fromElementDescriptor(e),l=this.toElementFinisherExtras((0,o[n])(s)||s);e=l.element,this.addElementPlacement(e,t),l.finisher&&i.push(l.finisher);var c=l.extras;if(c){for(var d=0;d=0;i--){var o=this.fromClassDescriptor(e),n=this.toClassDescriptor((0,t[i])(o)||o);if(void 0!==n.finisher&&r.push(n.finisher),void 0!==n.elements){e=n.elements;for(var a=0;ae.length)&&(t=e.length);for(var r=0,i=new Array(t);r `:i.dy` ${this.supervisor.localize((0,n.I)(this.hass.config.version,2021,12)?"panel.addons":"panel.dashboard")}
${(0,n.I)(this.hass.config.version,2021,12)?"":i.dy` `}
`}},{kind:"get",static:!0,key:"styles",value:function(){return[a.Qx,i.iv`.content{margin:0 auto}ha-fab.non-tabs{position:fixed;right:calc(16px + env(safe-area-inset-right));bottom:calc(16px + env(safe-area-inset-bottom));z-index:1}`]}}]}}),i.oi)},24486:(e,t,r)=>{"use strict";r.r(t),r.d(t,{DialogHassioBackupUpload:()=>A});var i=r(37500),o=r(57626),n=r(47181),a=(r(11876),r(66255),r(11654)),s=(r(34552),r(67622),r(60538)),l=r(41682),c=r(26765);function d(){d=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,t){["method","field"].forEach((function(r){t.forEach((function(t){t.kind===r&&"own"===t.placement&&this.defineClassElement(e,t)}),this)}),this)},initializeClassElements:function(e,t){var r=e.prototype;["method","field"].forEach((function(i){t.forEach((function(t){var o=t.placement;if(t.kind===i&&("static"===o||"prototype"===o)){var n="static"===o?e:r;this.defineClassElement(n,t)}}),this)}),this)},defineClassElement:function(e,t){var r=t.descriptor;if("field"===t.kind){var i=t.initializer;r={enumerable:r.enumerable,writable:r.writable,configurable:r.configurable,value:void 0===i?void 0:i.call(e)}}Object.defineProperty(e,t.key,r)},decorateClass:function(e,t){var r=[],i=[],o={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,o)}),this),e.forEach((function(e){if(!u(e))return r.push(e);var t=this.decorateElement(e,o);r.push(t.element),r.push.apply(r,t.extras),i.push.apply(i,t.finishers)}),this),!t)return{elements:r,finishers:i};var n=this.decorateConstructor(r,t);return i.push.apply(i,n.finishers),n.finishers=i,n},addElementPlacement:function(e,t,r){var i=t[e.placement];if(!r&&-1!==i.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");i.push(e.key)},decorateElement:function(e,t){for(var r=[],i=[],o=e.decorators,n=o.length-1;n>=0;n--){var a=t[e.placement];a.splice(a.indexOf(e.key),1);var s=this.fromElementDescriptor(e),l=this.toElementFinisherExtras((0,o[n])(s)||s);e=l.element,this.addElementPlacement(e,t),l.finisher&&i.push(l.finisher);var c=l.extras;if(c){for(var d=0;d=0;i--){var o=this.fromClassDescriptor(e),n=this.toClassDescriptor((0,t[i])(o)||o);if(void 0!==n.finisher&&r.push(n.finisher),void 0!==n.elements){e=n.elements;for(var a=0;aObject.prototype.hasOwnProperty.call(e,t),l={},c="home-assistant-frontend:",h.l=(e,t,r,i)=>{if(l[e])l[e].push(t);else{var o,n;if(void 0!==r)for(var a=document.getElementsByTagName("script"),s=0;s{o.onerror=o.onload=null,clearTimeout(u);var i=l[e];if(delete l[e],o.parentNode&&o.parentNode.removeChild(o),i&&i.forEach((e=>e(r))),t)return t(r)},u=setTimeout(p.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=p.bind(null,o.onerror),o.onload=p.bind(null,o.onload),n&&document.head.appendChild(o)}},h.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},h.p="/api/hassio/app/frontend_latest/",(()=>{h.b=document.baseURI||self.location.href;var e={9976:0};h.f.j=(t,r)=>{var i=h.o(e,t)?e[t]:void 0;if(0!==i)if(i)r.push(i[2]);else{var o=new Promise(((r,o)=>i=e[t]=[r,o]));r.push(i[2]=o);var n=h.p+h.u(t),a=new Error;h.l(n,(r=>{if(h.o(e,t)&&(0!==(i=e[t])&&(e[t]=void 0),i)){var o=r&&("load"===r.type?"missing":r.type),n=r&&r.target&&r.target.src;a.message="Loading chunk "+t+" failed.\n("+o+": "+n+")",a.name="ChunkLoadError",a.type=o,a.request=n,i[1](a)}}),"chunk-"+t,t)}};var t=(t,r)=>{var i,o,[n,a,s]=r,l=0;if(n.some((t=>0!==e[t]))){for(i in a)h.o(a,i)&&(h.m[i]=a[i]);if(s)s(h)}for(t&&t(r);l

Had to cut it even more as comment length in github is also restrained. Took it from the full file so you can also see the real end of the file with the sourcemapping.

Running the latest on HAOS : Home Assistant 2023.4.4 Supervisor 2023.04.0 Operating System 9.5 UI : 20230411.1 - latest

steverep commented 1 year ago

Thanks for confirming. I agree it's too big (and the ES5 entry is insanely big at 4 MB).

@bramkragten this needs some strategic dynamic importing IMO, but I see several comments wishing not to split code... ❓

steverep commented 1 year ago

@toxic0berliner I determined the biggest culprit here is that polyfills for Intl in JS are being included in the entrypoints (which is certainly not desired). I fixed this for the ES5 frontend build in #16349 but a little more work is needed to fix for the supervisor builds.

toxic0berliner commented 1 year ago

Thanks a lto @steverep ! My new boysize limit is 5MB so that leaves room & time to fix but I fear others with reverse proxies might not find it as easy to fix so thanks for the nice effort of optimization !

bramkragten commented 1 year ago

Thanks for confirming. I agree it's too big (and the ES5 entry is insanely big at 4 MB).

@bramkragten this needs some strategic dynamic importing IMO, but I see several comments wishing not to split code... ❓

Since we only use a small portion of the supervisor panel in normal use now, and the rest is just legacy, I think it makes sense to optimize for the small path. I'll look into it tomorrow

steverep commented 1 year ago

Since we only use a small portion of the supervisor panel in normal use now, and the rest is just legacy, I think it makes sense to optimize for the small path. I'll look into it tomorrow

Excellent.. that'll hopefully drop the total bundle size a good amount. I already have a simple maneuver ready to get rid of all entrypoint size issues across the board, but I need to do some simple performance testing first.

bramkragten commented 1 year ago

https://github.com/home-assistant/frontend/pull/16379

steverep commented 1 year ago

Closing since the latest entrypoint is now under 500 KB and ES5 is under 1 MB, but know I'm trying to get them down more.

toxic0berliner commented 1 year ago

Thanks to all for the efforts and congrats for the great optim already done !