import{getAvailableInstances as t}from"@clevercloud/client/esm/api/v2/product.js";import{ONE_DAY as r}from"@clevercloud/client/esm/with-cache.js";import{fetchPriceSystem as o}from"./lib/api-helpers.js";import{defineSmartComponent as n}from"./lib/define-smart-component.js";import{formatRuntimeProduct as e,getRunnerProduct as c}from"./lib/product.js";import{sendToApi as i}from"./lib/send-to-api.js";import"./cc-smart-container.js";import"./cc-pricing-product.js";function a({productId:o,signal:n}){return t().then(i({cacheDelay:r,signal:n})).then((t=>{const r=t.find((t=>t.variant.slug===o));if(null==r){const t=c(o);if(null!=t)return t;throw new Error(`Unknown variant slug: ${o}`)}return r}))}n({selector:'cc-pricing-product[mode="runtime"]',params:{productId:{type:String},zoneId:{type:String}},onContextUpdate({context:t,updateComponent:r,signal:n}){const{productId:c,zoneId:i}=t;r("state",{state:"loading"}),function({productId:t,zoneId:r,signal:n}){return Promise.all([a({productId:t,signal:n}),o({zoneId:r,signal:n})]).then((([t,r])=>e(t,r)))}({productId:c,zoneId:i,signal:n}).then((t=>{r("product",{state:"loaded",name:t.name,productFeatures:t.productFeatures,plans:t.plans})})).catch((t=>{console.error(t),r("product",{state:"error"})}))}});
//# sourceMappingURL=cc-pricing-product.smart-runtime.js.map
