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 o}from"./lib/send-to-api.js";import{defineSmartComponent as n}from"./lib/smart/define-smart-component.js";import{i18n as r}from"./translation.js";import"./cc-smart-container.js";import{CcAddonInfoClient as d}from"./cc-addon-info.client.js";import"./cc-addon-info.js";const a="addon-pulsar";n({selector:'cc-addon-info[smart-mode="pulsar"]',params:{apiConfig:{type:Object},ownerId:{type:String},addonId:{type:String}},onContextUpdate({context:e,updateComponent:o,signal:n}){const{apiConfig:d,ownerId:a,addonId:s}=e,c=new i({apiConfig:d,ownerId:a,addonId:s,signal:n});o("state",{type:"loading",type:"loading",version:{stateType:"up-to-date",installed:"0.0.0",latest:"0.0.0"},creationDate:"2025-08-06 15:03:00"}),o("docLink",{text:r("cc-addon-info.doc-link.pulsar"),href:t("/addons/pulsar")}),c.getPulsarAddonInfo().then((({rawAddon:e,clusterVersion:t})=>{o("state",{type:"loaded",version:{stateType:"up-to-date",installed:t,latest:t},creationDate:e.creationDate})})).catch((e=>{console.error(e),o("state",{type:"error"})}))}});class i extends d{constructor({apiConfig:e,ownerId:t,addonId:o,signal:n}){super({apiConfig:e,ownerId:t,addonId:o,providerId:a,signal:n})}_getAddonProvider(t){return s({providerId:a,addonId:t}).then(o({apiConfig:this._apiConfig,signal:this._signal,cacheDelay:e}))}_getCluster(t){return c({providerId:a,clusterId:t}).then(o({apiConfig:this._apiConfig,signal:this._signal,cacheDelay:e}))}async getPulsarAddonInfo(){const e=await this._getAddon(),t=e.realId,o=await this._getAddonProvider(t);return{rawAddon:e,clusterVersion:(await this._getCluster(o.cluster_id)).version}}}function s(e){return Promise.resolve({method:"get",url:`/v4/addon-providers/${e.providerId}/addons/${e.addonId}`,headers:{Accept:"application/json"}})}function c(e){return Promise.resolve({method:"get",url:`/v4/addon-providers/${e.providerId}/clusters/${e.clusterId}`,headers:{Accept:"application/json"}})}export{s as getAddonProvider,c as getCluster};
//# sourceMappingURL=cc-addon-info.smart-pulsar.js.map
