import{a as i,H as s,e as t,m as o,aj as a,a3 as e,$ as r,aA as h,aB as c,aC as n,aD as l,aE as d,d as p,r as u,n as y}from"./main-c805434e.js";import"./c.1fc70989.js";import{m as _}from"./c.6e8e6174.js";import"./c.d49c601d.js";import"./c.70de318c.js";import"./c.743a15a1.js";import"./c.78610cf7.js";import"./c.8e28b461.js";let m=i([y("hacs-repository-info-dialog")],(function(i,s){return{F:class extends s{constructor(...s){super(...s),i(this)}},d:[{kind:"field",decorators:[t()],key:"repository",value:void 0},{kind:"field",decorators:[t({attribute:!1})],key:"_repository",value:void 0},{kind:"field",key:"_getRepository",value:()=>o(((i,s)=>null==i?void 0:i.find((i=>i.id===s))))},{kind:"field",key:"_getAuthors",value:()=>o((i=>{const s=[];if(!i.authors)return s;if(i.authors.forEach((i=>s.push(i.replace("@","")))),0===s.length){const t=i.full_name.split("/")[0];if(["custom-cards","custom-components","home-assistant-community-themes"].includes(t))return s;s.push(t)}return s}))},{kind:"method",key:"shouldUpdate",value:function(i){return i.forEach(((i,s)=>{"hass"===s&&(this.sidebarDocked='"docked"'===window.localStorage.getItem("dockedSidebar")),"hacs"===s&&(this._repository=this._getRepository(this.hacs.repositories,this.repository))})),i.has("sidebarDocked")||i.has("narrow")||i.has("active")||i.has("_repository")}},{kind:"method",key:"firstUpdated",value:async function(){var i;if(this._repository=this._getRepository(this.hacs.repositories,this.repository),null===(i=this._repository)||void 0===i||!i.updated_info){await a(this.hass,this._repository.id);const i=await e(this.hass);this.dispatchEvent(new CustomEvent("update-hacs",{detail:{repositories:i},bubbles:!0,composed:!0})),this._repository=this._getRepository(i,this.repository)}}},{kind:"method",key:"render",value:function(){if(!this.active||!this._repository)return r``;const i=this._getAuthors(this._repository);return r`
${this._repository.installed?r` ${this._repository.installed_version} `:""} ${i?i.map((i=>r` @${i} `)):""} ${this._repository.downloads?r` ${this._repository.downloads} `:""} ${this._repository.stars} ${this._repository.issues}
${this._repository.updated_info?_.html(this._repository.additional_info||this.hacs.localize("dialog_info.no_info"),this._repository):r`
`}
${!this._repository.installed&&this._repository.updated_info?r` ${this.hacs.localize("dialog_info.download")} ${this.hacs.localize("dialog_info.open_repo")} `:""}
`}},{kind:"get",static:!0,key:"styles",value:function(){return[p,u` img { max-width: 100%; } .loading { display: flex; align-items: center; justify-content: center; padding: 4rem 8rem; } .chips { display: flex; flex-wrap: wrap; padding-bottom: 8px; gap: 4px; } `]}},{kind:"method",key:"_installRepository",value:async function(){this.dispatchEvent(new CustomEvent("hacs-dialog-secondary",{detail:{type:"download",repository:this._repository.id},bubbles:!0,composed:!0}))}}]}}),s);export{m as HacsRepositoryDialog};