import{fj as p,Q as d,fk as E}from"./index-DHiyXWqE.js";var l=(e=>(e.NODE="NODE",e.KUBE_CLUSTER="KUBE_CLUSTER",e.LOAD_BALANCER="LOAD_BALANCER",e))(l||{}),g=(e=>(e.HTTP="HTTP",e.HTTPS="HTTPS",e.STATUS="STATUS",e.TLS="TLS",e))(g||{});const N={name:({name:e},{name:r})=>e.localeCompare(r),"last created":({created:e},{created:r})=>{const o=new Date(e).getTime(),s=new Date(r).getTime();return o===s?0:o<s?1:-1}},L=(e,r)=>{const o=N[r];return o?e.sort(o):e},h=(e,r)=>r?e.filter(o=>o.name.toLowerCase().includes(r.toLowerCase())):e,S=(e,{selectedModel:r,selectedStatuses:o,selectedUsername:s})=>{let t=e;return r&&r!=="ANY"&&(r==="NONE"?t=t.filter(i=>!i.modelName):t=t.filter(i=>i.modelName===r)),o!=null&&o.length&&(t=t.filter(i=>o.includes(i.status.toLowerCase()))),s?t.filter(i=>i.creator.toLowerCase()===s):t},D=e=>p(d("modelName"),e).filter(E("modelName")).map(r=>r.modelName),T=e=>e.batchingEnabled?e:{},v=(e,r)=>{if(e&&r)return"ALL";if(e)return"MODEL_INPUTS";if(r)return"PREDICTIONS"},m=(e,r,o,s)=>{let t=e.substring(e.lastIndexOf("/")+1);return e.endsWith(`Models/${s}/${o}/Artifacts/${r}/${t}`)?(t.startsWith("predictor-")?t=t.slice(10):t.startsWith("transformer-")?t=t.slice(12):t.startsWith("configfile-")&&(t=t.slice(11)),t):e},O=({formValues:e,apiValues:r={},project:o})=>({...r,modelServer:e.modelServer,name:e.name,description:e.description,modelName:e.modelName,...e.modelName?{modelPath:`/Projects/${o.projectName}/Models/${e.modelName}`,modelVersion:e.modelVersion,modelFramework:e.modelFramework}:{},artifactVersion:e.artifactVersion,servingTool:e.kserve?"KSERVE":"DEFAULT",...e.environmentDTO?{environmentDTO:e.environmentDTO}:{},...e.kserve?{apiProtocol:e.apiProtocol}:{},predictor:e.predictor?m(e.predictor,e.artifactVersion,e.modelVersion,e.modelName):void 0,transformer:e.transformer?m(e.transformer,e.artifactVersion,e.modelVersion,e.modelName):void 0,configFile:e.configFile?m(e.configFile,e.artifactVersion,e.modelVersion,e.modelName):void 0,inferenceLogging:v(e.modelInput,e.predictions),kafkaTopicDTO:e.kafkaTopicDTO,batchingConfiguration:T(e.batchingConfiguration),requestedInstances:e.requestedInstances,requestedTransformerInstances:e.transformer?e.requestedTransformerInstances:void 0,predictorResources:{requests:{cores:e.predictorResources.cores[0],memory:e.predictorResources.memory[0],gpus:e.predictorResources.gpus},limits:{cores:e.predictorResources.cores[1],memory:e.predictorResources.memory[1],gpus:e.predictorResources.gpus}},predictorScalingConfig:e.predictorScalingConfig,transformerResources:e.transformer&&e.transformerResources?{requests:{cores:e.transformerResources.cores[0],memory:e.transformerResources.memory[0],gpus:e.transformerResources.gpus},limits:{cores:e.transformerResources.cores[1],memory:e.transformerResources.memory[1],gpus:e.transformerResources.gpus}}:void 0,transformerScalingConfig:e.transformerScalingConfig,schedulingConfig:e.schedulingConfig}),_=e=>{if(!e)return e;const{kafkaTopicDTO:r,inferenceLogging:o}=e,{predictorResources:s,transformerResources:t}=e,i=s.requests,n=s.limits,c=t==null?void 0:t.requests,a=t==null?void 0:t.limits;return{...e,kafkaTopicDTO:r??{name:"NONE"},inferenceLogging:o??"NONE",predictorResources:{cores:[i.cores,n.cores],memory:[i.memory,n.memory],gpus:i.gpus},transformerResources:c&&a?{cores:[c.cores,a.cores],memory:[c.memory,a.memory],gpus:c.gpus}:void 0}},C=[{label:"predict",value:"predict"},{label:"regress",value:"regress"},{label:"classify",value:"classify"}],f=[{label:"predict",value:"predict"}],u=[{label:"v1/chat/completions",value:"v1/chat/completions"},{label:"v1/completions",value:"v1/completions"}],b=[{label:"openai/v1/chat/completions",value:"openai/v1/chat/completions"},{label:"openai/v1/completions",value:"openai/v1/completions"}],y=e=>{const r=e.ports.find(n=>n.name===g.HTTP),o=e.ports.find(n=>n.name===g.HTTPS),s=o?o.number:r==null?void 0:r.number;let i=`${o?"https":"http"}://${e.hosts[0]}`;return s!==80&&s!==443&&(i+=`:${s}`),i};export{l as I,u as K,C as N,b as a,f as b,O as c,_ as d,D as e,h as f,y as g,L as h,S as i,N as s};
