import{j as c,M as r,aB as i}from"./index-BTX30BGB.js";import{g as o}from"./operations-Bh89JbNy.js";import{a as m}from"./index.esm-BV12eBbn.js";import{R as p}from"./ResourceLink-O9uDwzG_.js";import{i as l}from"./instanceOptions-BVjIWe7l.js";const h=({instance:e})=>c.jsx(p,{type:e.type,value:e.name,to:`/ui/project/${e.project}/instance/${e.name}`}),N=e=>{const{operation:t,project:a,instanceType:n}=e,s=o(t==null?void 0:t.metadata);if(s)return c.jsx(h,{instance:{name:s,project:a||"default",type:n}})},f=(e,t,a)=>m().test("deduplicate","An instance with this name already exists",n=>a===n||r(n,e,t,"instances")).test("size","Instance name must be between 1 and 63 characters",n=>!n||n.length<64).matches(/^[A-Za-z0-9-]+$/,{message:"Only alphanumeric and hyphen characters are allowed"}).matches(/^[A-Za-z].*$/,{message:"Instance name must start with a letter"}),u=(e,t="")=>(e.length>63-t.length&&(e=e.slice(0,63-t.length)),e+t),g=e=>e.replace(/[^A-Za-z0-9-]/g,"-"),L=(e,t)=>{const a=i(e);e=a?e.replace(a,""):e;const n=g(e);return u(n,t)},$=e=>{var a,n;const t=(a=l.find(s=>s.value===e.type))==null?void 0:a.label;return((n=e.config)==null?void 0:n["volatile.container.oci"])==="true"?`${t} (App)`:t||""};export{h as I,N as a,L as f,$ as g,f as i,u as t};
