import{ONE_SECOND as e}from"@clevercloud/client/esm/with-cache.js";import{getDocUrl as t}from"./lib/dev-hub-url.js";import{sendToApi as n}from"./lib/send-to-api.js";import{defineSmartComponent as o}from"./lib/smart/define-smart-component.js";import{i18n as r}from"./translation.js";import"./cc-smart-container.js";import"./cc-addon-info.js";const s={type:"loading",version:{stateType:"up-to-date",installed:"0.0.0",latest:"0.0.0"},creationDate:"2025-08-06 15:03:00"};o({selector:'cc-addon-info[smart-mode="kubernetes"]',params:{apiConfig:{type:Object},ownerId:{type:String},kubernetesId:{type:String}},onContextUpdate({context:e,updateComponent:n,signal:o}){const{apiConfig:a,ownerId:d,kubernetesId:c}=e,l=new i({apiConfig:a,ownerId:d,kubernetesId:c,signal:o});n("state",s),n("docLink",{text:r("cc-addon-info.doc-link.kubernetes"),href:t("/kubernetes")}),l.getKubeInfo(d,c).then((e=>{n("state",{type:"loaded",version:{stateType:"up-to-date",installed:e.version,latest:e.version},creationDate:e.creationDate})})).catch((e=>{console.error(e),n("state",{type:"error"})}))}});class i{constructor({apiConfig:e,ownerId:t,kubernetesId:n,signal:o}){this._apiConfig=e,this._ownerId=t,this._kubernetesId=n,this._signal=o}getKubeInfo(t,o){return(r={ownerId:t,kubernetesId:o},Promise.resolve({method:"get",url:`/v4/kubernetes/organisations/${r.ownerId}/clusters/${r.kubernetesId}`})).then(n({apiConfig:this._apiConfig,signal:this._signal,cacheDelay:e})).then((e=>{if("DELETED"===e.status)throw new Error("This cluster has been deleted");return e}));var r}}
//# sourceMappingURL=cc-addon-info.smart-kubernetes.js.map
