import{getAssetUrl as e}from"./assets-url.js";function n(e,n,r){const t=e.plans.filter((e=>e.zones.length>0));return{name:e.name,productFeatures:o(e.features,r),plans:c(t,n,r)}}const r=720;function t(e){return{sections:[{type:"storage",...s(e,"cellar.storage"),service:"cellar.storage"},{type:"outbound-traffic",...s(e,"cellar.outbound"),service:"cellar.outbound"}]}}function u(e){return{sections:[{type:"storage",...s(e,"fsbucket.storage"),service:"fsbucket.storage"}]}}function a(e){return{sections:[{type:"storage",...s(e,"pulsar_storage_size"),service:"pulsar_storage_size"},{type:"inbound-traffic",...s(e,"pulsar_throughput_in"),service:"pulsar_throughput_in"},{type:"outbound-traffic",...s(e,"pulsar_throughput_out"),service:"pulsar_throughput_out"}]}}function i(e){return{sections:[{type:"storage",...s(e,"heptapod.storage"),service:"heptapod.storage"},{type:"private-users",progressive:!0,...s(e,"heptapod.private_active_users"),service:"heptapod.private_active_users"},{type:"public-users",progressive:!0,...s(e,"heptapod.public_active_users"),service:"heptapod.public_active_users"}]}}function s(e,n){const t=e.countable.find((e=>e.service===n)),u="insecable"===t?.data_quantity_for_price?.secability?t.data_quantity_for_price.quantity:1,a=("PT1H"===t?.time_interval_for_price?.interval?r:1)/(t?.data_quantity_for_price?.quantity??1);return{secability:u,intervals:t.price_plans.map(((e,n,r)=>({minRange:0===n?0:r[n-1].max_quantity,maxRange:e.max_quantity,price:e.price*a})))}}function o(e,n){return(null==n?e.map((e=>e.name_code)).filter((e=>null!=e)):n).map((n=>e.find((e=>e.name_code===n)))).filter((e=>null!=e)).map((e=>({code:e.name_code,type:e.type.toLowerCase(),value:e.computable_value??"",name:e.name})))}function c(e,n,r){return e.map((e=>{const t=n.runtime.find((n=>n.slug_id.toLowerCase()===e.price_id.toLowerCase()));return{name:e.name,price:t?.price??0,features:o(e.features,r),priceId:t?.slug_id}}))}function p(e,n){const r=function(e){const n=[{code:"cpu",type:"number-cpu-runtime"},{code:"memory",type:"bytes"}];e.variant.slug.startsWith("ml_")&&n.push({code:"gpu",type:"number"});return n}(e);return{name:e.variant.name,productFeatures:r,plans:l(e.flavors,n,r)}}function l(e,n,r){return e.map((e=>{const t=n.runtime.find((n=>n.slug_id.toLowerCase()===e.price_id.toLowerCase()));return{name:e.name,price:t?.price??0,features:d(r,e),priceId:t.slug_id}}))}function d(e,n){return e.map((e=>({...e,value:m(e.code,n)})))}function m(e,n){switch(e){case"cpu":return{cpu:n.cpus,shared:n.microservice,nice:n.nice};case"memory":return n.memory.value;case"gpu":return n.gpus;default:return null}}function f(n){const r={type:"docker",version:"20211001",name:"Docker",defaultFlavor:null,buildFlavor:null,enabled:!0,comingSoon:!1,maxInstances:40,tags:[],deployments:["git"]};return"jenkins-runner"===n?{...r,variant:{id:"b8093938-4846-4f74-8c4a-82660180093e",slug:"jenkins-runner",name:"Jenkins runner",deployType:"docker",logo:e("/logos/jenkins.svg")},description:"Jenkins runner",flavors:[_("jenkins-runner.","XS",1,2),_("jenkins-runner.","S",2,4),_("jenkins-runner.","M",4,8),_("jenkins-runner.","L",6,12),_("jenkins-runner.","XL",8,16),_("jenkins-runner.","2XL",12,24),_("jenkins-runner.","3XL",16,32)]}:"heptapod-runner"===n?{...r,variant:{id:"9b207292-732b-4594-b48b-09a91ac72f0c",slug:"heptapod-runner",name:"Heptapod runner",deployType:"docker",logo:e("/logos/heptapod.svg")},description:"Heptapod runner",flavors:[_("heptapod-runner.","XS",1,2,!0,5),_("heptapod-runner.","S",2,4,!0,5),_("heptapod-runner.","M",4,8,!0,5),_("heptapod-runner.","L",6,12,!0,5),_("heptapod-runner.","XL",8,16,!0,5),_("heptapod-runner.","2XL",12,24,!0,5),_("heptapod-runner.","3XL",16,32,!0,5)]}:void 0}function _(e,n,r,t,u=!1,a=0){return{name:n,mem:null,cpus:r,gpus:0,disk:null,price:null,available:!0,microservice:u,machine_learning:!1,nice:a,price_id:e+n,memory:{unit:"B",value:t*1024**3,formatted:null}}}function g(e){return{runtimePrices:e.runtime.filter((({source:e})=>"adc"!==e)).map((({slug_id:e,price:n})=>({priceId:e,price:n}))),countablePrices:[...t(e).sections,...u(e).sections,...a(e).sections,...i(e).sections]}}export{t as formatAddonCellar,u as formatAddonFsbucket,i as formatAddonHeptapod,n as formatAddonProduct,a as formatAddonPulsar,g as formatEstimationPrices,s as formatProductConsumptionIntervals,p as formatRuntimeProduct,f as getRunnerProduct};
//# sourceMappingURL=product.js.map
